bfg-common 1.1.106 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/minify.js +126 -51
  2. package/package.json +4 -2
  3. package/plugins/spice-console/spice.console.ts +3 -113
  4. package/public/spice-console-minify/run.min.js +71 -10
  5. package/public/spice-console-minify/application/WorkerProcess.min.js +0 -1
  6. package/public/spice-console-minify/application/WorkerProcess_back.min.js +0 -1
  7. package/public/spice-console-minify/application/WorkerProcess_meta.min.js +0 -1
  8. package/public/spice-console-minify/application/WorkerProcess_reverse.min.js +0 -1
  9. package/public/spice-console-minify/application/agent.min.js +0 -1
  10. package/public/spice-console-minify/application/application.min.js +0 -1
  11. package/public/spice-console-minify/application/checkActivity.min.js +0 -1
  12. package/public/spice-console-minify/application/clientgui.min.js +0 -1
  13. package/public/spice-console-minify/application/clipboard/clipboarddataparser.min.js +0 -1
  14. package/public/spice-console-minify/application/clipboard/local/localClipboard.min.js +0 -1
  15. package/public/spice-console-minify/application/clipboard.min.js +0 -1
  16. package/public/spice-console-minify/application/codec.min.js +0 -1
  17. package/public/spice-console-minify/application/imagecache.min.js +0 -1
  18. package/public/spice-console-minify/application/inputmanager.min.js +0 -1
  19. package/public/spice-console-minify/application/packetfactory.min.js +0 -1
  20. package/public/spice-console-minify/application/packetfilter.min.js +0 -1
  21. package/public/spice-console-minify/application/packetprocess.min.js +0 -1
  22. package/public/spice-console-minify/application/rasteroperation.min.js +0 -1
  23. package/public/spice-console-minify/application/spiceconnection.min.js +0 -1
  24. package/public/spice-console-minify/application/stream.min.js +0 -1
  25. package/public/spice-console-minify/application/virtualmouse.min.js +0 -1
  26. package/public/spice-console-minify/keymaps/keyevent.min.js +0 -1
  27. package/public/spice-console-minify/keymaps/keymap.min.js +0 -1
  28. package/public/spice-console-minify/keymaps/keymapes.min.js +0 -1
  29. package/public/spice-console-minify/keymaps/keymapesObj.min.js +0 -1
  30. package/public/spice-console-minify/keymaps/keymapus.min.js +0 -1
  31. package/public/spice-console-minify/keymaps/scanCodeObjModifier.min.js +0 -1
  32. package/public/spice-console-minify/keymaps/scanCodeObjProvider.min.js +0 -1
  33. package/public/spice-console-minify/lib/AsyncConsumer.min.js +0 -1
  34. package/public/spice-console-minify/lib/AsyncWorker.min.js +0 -1
  35. package/public/spice-console-minify/lib/CollisionDetector.min.js +0 -1
  36. package/public/spice-console-minify/lib/DataLogger.min.js +0 -1
  37. package/public/spice-console-minify/lib/GenericObjectPool.min.js +0 -1
  38. package/public/spice-console-minify/lib/GlobalPool.min.js +0 -1
  39. package/public/spice-console-minify/lib/ImageUncompressor.min.js +0 -1
  40. package/public/spice-console-minify/lib/IntegrationBenchmark.min.js +0 -1
  41. package/public/spice-console-minify/lib/PacketWorkerIdentifier.min.js +0 -1
  42. package/public/spice-console-minify/lib/SyncAsyncHandler.min.js +0 -1
  43. package/public/spice-console-minify/lib/base64.min.js +0 -1
  44. package/public/spice-console-minify/lib/biginteger.min.js +0 -1
  45. package/public/spice-console-minify/lib/bowser.min.js +0 -1
  46. package/public/spice-console-minify/lib/decoder/dixie.min.js +0 -5
  47. package/public/spice-console-minify/lib/decoder/jmuxer.min.js +0 -1
  48. package/public/spice-console-minify/lib/displayRouter.min.js +0 -1
  49. package/public/spice-console-minify/lib/encrypt.min.js +0 -1
  50. package/public/spice-console-minify/lib/flipper.min.js +0 -1
  51. package/public/spice-console-minify/lib/graphic.min.js +0 -1
  52. package/public/spice-console-minify/lib/graphicdebug.min.js +0 -1
  53. package/public/spice-console-minify/lib/images/bitmap.min.js +0 -1
  54. package/public/spice-console-minify/lib/images/jsquic_family.min.js +0 -1
  55. package/public/spice-console-minify/lib/images/jsquic_rgba.min.js +0 -1
  56. package/public/spice-console-minify/lib/images/jsquic_uncompress.min.js +0 -1
  57. package/public/spice-console-minify/lib/images/lz.min.js +0 -1
  58. package/public/spice-console-minify/lib/images/png.min.js +0 -1
  59. package/public/spice-console-minify/lib/jgestures.min.js +0 -25
  60. package/public/spice-console-minify/lib/jquery-2.0.3.min.js +0 -25
  61. package/public/spice-console-minify/lib/jquery-mousewheel.min.js +0 -12
  62. package/public/spice-console-minify/lib/jquery-visibility.min.js +0 -2
  63. package/public/spice-console-minify/lib/jsbn.min.js +0 -1
  64. package/public/spice-console-minify/lib/jsbn2.min.js +0 -1
  65. package/public/spice-console-minify/lib/lodash.4.0.0.min.js +0 -6
  66. package/public/spice-console-minify/lib/modernizr.min.js +0 -1
  67. package/public/spice-console-minify/lib/pixastic.min.js +0 -1
  68. package/public/spice-console-minify/lib/prettyprint.min.js +0 -1
  69. package/public/spice-console-minify/lib/prng4.min.js +0 -1
  70. package/public/spice-console-minify/lib/queue.min.js +0 -1
  71. package/public/spice-console-minify/lib/rasterEngine.min.js +0 -1
  72. package/public/spice-console-minify/lib/rng.min.js +0 -1
  73. package/public/spice-console-minify/lib/runqueue.min.js +0 -1
  74. package/public/spice-console-minify/lib/sha1.min.js +0 -1
  75. package/public/spice-console-minify/lib/stuckkeyshandler.min.js +0 -1
  76. package/public/spice-console-minify/lib/timelapsedetector.min.js +0 -1
  77. package/public/spice-console-minify/lib/utils.min.js +0 -1
  78. package/public/spice-console-minify/lib/virtualjoystick.min.js +0 -1
  79. package/public/spice-console-minify/network/busconnection.min.js +0 -1
  80. package/public/spice-console-minify/network/clusternodechooser.min.js +0 -1
  81. package/public/spice-console-minify/network/connectioncontrol.min.js +0 -1
  82. package/public/spice-console-minify/network/packetcontroller.min.js +0 -1
  83. package/public/spice-console-minify/network/packetextractor.min.js +0 -1
  84. package/public/spice-console-minify/network/packetlinkfactory.min.js +0 -1
  85. package/public/spice-console-minify/network/packetreassembler.min.js +0 -1
  86. package/public/spice-console-minify/network/reassemblerfactory.min.js +0 -1
  87. package/public/spice-console-minify/network/sizedefiner.min.js +0 -1
  88. package/public/spice-console-minify/network/socket.min.js +0 -1
  89. package/public/spice-console-minify/network/socketqueue.min.js +0 -1
  90. package/public/spice-console-minify/network/spicechannel.min.js +0 -1
  91. package/public/spice-console-minify/network/websocketwrapper.min.js +0 -1
  92. package/public/spice-console-minify/process/busprocess.min.js +0 -1
  93. package/public/spice-console-minify/process/cursorprocess.min.js +0 -1
  94. package/public/spice-console-minify/process/displaypreprocess.min.js +0 -1
  95. package/public/spice-console-minify/process/displayprocess.min.js +0 -1
  96. package/public/spice-console-minify/process/inputprocess.min.js +0 -1
  97. package/public/spice-console-minify/process/mainprocess.min.js +0 -1
  98. package/public/spice-console-minify/process/playbackprocess.min.js +0 -1
  99. package/public/spice-console-minify/spiceobjects/generated/protocol.min.js +0 -1
  100. package/public/spice-console-minify/spiceobjects/spiceobjects.min.js +0 -1
  101. package/public/spice-console-minify/swcanvas/swcanvas.min.js +0 -1
@@ -1,17 +1,81 @@
1
+
1
2
  !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("stream")):"function"==typeof define&&define.amd?define(["stream"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).JMuxer=t(e.stream)}(this,(function(e){"use strict";function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function i(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&u(e,t)}function o(e){return o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},o(e)}function u(e,t){return u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},u(e,t)}function c(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function f(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=o(e);if(t){var i=o(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return c(e)}(this,r)}}function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var n,i,a=[],s=!0,o=!1;try{for(r=r.call(e);!(s=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);s=!0);}catch(e){o=!0,i=e}finally{try{s||null==r.return||r.return()}finally{if(o)throw i}}return a}(e,t)||h(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e,t){if(e){if("string"==typeof e)return d(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?d(e,t):void 0}}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function y(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=h(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,o=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){o=!0,a=e},f:function(){try{s||null==r.return||r.return()}finally{if(o)throw a}}}}var p,v;function m(e){if(p){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];p.apply(void 0,[e].concat(r))}}function k(e){if(v){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];v.apply(void 0,[e].concat(r))}}var g=function(){function e(t){r(this,e),this.payload=t,this.nri=(96&this.payload[0])>>5,this.ntype=31&this.payload[0],this.isvcl=1==this.ntype||5==this.ntype,this.stype="",this.isfmb=!1}return i(e,[{key:"toString",value:function(){return"".concat(e.type(this),": NRI: ").concat(this.getNri())}},{key:"getNri",value:function(){return this.nri}},{key:"type",value:function(){return this.ntype}},{key:"isKeyframe",value:function(){return this.ntype===e.IDR}},{key:"getPayload",value:function(){return this.payload}},{key:"getPayloadSize",value:function(){return this.payload.byteLength}},{key:"getSize",value:function(){return 4+this.getPayloadSize()}},{key:"getData",value:function(){var e=new Uint8Array(this.getSize());return new DataView(e.buffer).setUint32(0,this.getSize()-4),e.set(this.getPayload(),4),e}}],[{key:"NDR",get:function(){return 1}},{key:"IDR",get:function(){return 5}},{key:"SEI",get:function(){return 6}},{key:"SPS",get:function(){return 7}},{key:"PPS",get:function(){return 8}},{key:"AUD",get:function(){return 9}},{key:"TYPES",get:function(){var t;return a(t={},e.IDR,"IDR"),a(t,e.SEI,"SEI"),a(t,e.SPS,"SPS"),a(t,e.PPS,"PPS"),a(t,e.NDR,"NDR"),a(t,e.AUD,"AUD"),t}},{key:"type",value:function(t){return t.ntype in e.TYPES?e.TYPES[t.ntype]:"UNKNOWN"}}]),e}();function b(e,t){var r=new Uint8Array((0|e.byteLength)+(0|t.byteLength));return r.set(e,0),r.set(t,0|e.byteLength),r}var S=function(){function e(t){r(this,e),this.data=t,this.index=0,this.bitLength=8*t.byteLength}return i(e,[{key:"setData",value:function(e){this.data=e,this.index=0,this.bitLength=8*e.byteLength}},{key:"bitsAvailable",get:function(){return this.bitLength-this.index}},{key:"skipBits",value:function(e){if(this.bitsAvailable<e)return!1;this.index+=e}},{key:"readBits",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.getBits(e,this.index,t)}},{key:"getBits",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(this.bitsAvailable<e)return 0;var n=t%8,i=this.data[t/8|0]&255>>>n,a=8-n;if(a>=e)return r&&(this.index+=e),i>>a-e;r&&(this.index+=a);var s=e-a;return i<<s|this.getBits(s,t+a,r)}},{key:"skipLZ",value:function(){var e;for(e=0;e<this.bitLength-this.index;++e)if(0!==this.getBits(1,this.index+e,!1))return this.index+=e,e;return e}},{key:"skipUEG",value:function(){this.skipBits(1+this.skipLZ())}},{key:"skipEG",value:function(){this.skipBits(1+this.skipLZ())}},{key:"readUEG",value:function(){var e=this.skipLZ();return this.readBits(e+1)-1}},{key:"readEG",value:function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}},{key:"readBoolean",value:function(){return 1===this.readBits(1)}},{key:"readUByte",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.readBits(8*e)}},{key:"readUShort",value:function(){return this.readBits(16)}},{key:"readUInt",value:function(){return this.readBits(32)}}]),e}(),w=function(){function e(t){r(this,e),this.remuxer=t,this.track=t.mp4track}return i(e,[{key:"parseSPS",value:function(t){var r=e.readSPS(new Uint8Array(t));this.track.fps=r.fps,this.track.width=r.width,this.track.height=r.height,this.track.sps=[new Uint8Array(t)],this.track.codec="avc1.";for(var n=new DataView(t.buffer,t.byteOffset+1,4),i=0;i<3;++i){var a=n.getUint8(i).toString(16);a.length<2&&(a="0"+a),this.track.codec+=a}}},{key:"parsePPS",value:function(e){this.track.pps=[new Uint8Array(e)]}},{key:"parseNAL",value:function(e){if(!e)return!1;var t=!1;switch(e.type()){case g.IDR:case g.NDR:t=!0;break;case g.PPS:this.track.pps||(this.parsePPS(e.getPayload()),!this.remuxer.readyToDecode&&this.track.pps&&this.track.sps&&(this.remuxer.readyToDecode=!0)),t=!0;break;case g.SPS:this.track.sps||(this.parseSPS(e.getPayload()),!this.remuxer.readyToDecode&&this.track.pps&&this.track.sps&&(this.remuxer.readyToDecode=!0)),t=!0;break;case g.AUD:m("AUD - ignoing");break;case g.SEI:m("SEI - ignoing")}return t}}],[{key:"extractNALu",value:function(e){for(var t,r,n=0,i=e.byteLength,a=0,s=[],o=0;n<i;)switch(t=e[n++],a){case 0:0===t&&(a=1);break;case 1:a=0===t?2:0;break;case 2:case 3:0===t?a=3:1===t&&n<i?(o!=n-a-1&&s.push(e.subarray(o,n-a-1)),o=n,a=0):a=0}return o<i&&(r=e.subarray(o,i)),[s,r]}},{key:"skipScalingList",value:function(e,t){for(var r=8,n=8,i=0;i<t;i++)0!==n&&(n=(r+e.readEG()+256)%256),r=0===n?r:n}},{key:"readSPS",value:function(t){var r,n,i,a,s,o,u=new S(t),c=0,f=0,l=0,h=0,d=1,y=0;u.readUByte();for(var p=[],v=t.byteLength,m=1;m<v;m++)m+2<v&&3===u.readBits(24,!1)?(p.push(u.readBits(8)),p.push(u.readBits(8)),m+=2,u.readBits(8)):p.push(u.readBits(8));if(u.setData(new Uint8Array(p)),r=u.readUByte(),u.readBits(5),u.skipBits(3),u.readUByte(),u.skipUEG(),100===r||110===r||122===r||244===r||44===r||83===r||86===r||118===r||128===r){var k=u.readUEG();if(3===k&&u.skipBits(1),u.skipUEG(),u.skipUEG(),u.skipBits(1),u.readBoolean()){o=3!==k?8:12;for(var g=0;g<o;++g)u.readBoolean()&&(g<6?e.skipScalingList(u,16):e.skipScalingList(u,64))}}u.skipUEG();var b=u.readUEG();if(0===b)u.readUEG();else if(1===b){u.skipBits(1),u.skipEG(),u.skipEG(),n=u.readUEG();for(var w=0;w<n;++w)u.skipEG()}if(u.skipUEG(),u.skipBits(1),i=u.readUEG(),a=u.readUEG(),0===(s=u.readBits(1))&&u.skipBits(1),u.skipBits(1),u.readBoolean()&&(c=u.readUEG(),f=u.readUEG(),l=u.readUEG(),h=u.readUEG()),u.readBoolean()){if(u.readBoolean()){var x;switch(u.readUByte()){case 1:x=[1,1];break;case 2:x=[12,11];break;case 3:x=[10,11];break;case 4:x=[16,11];break;case 5:x=[40,33];break;case 6:x=[24,11];break;case 7:x=[20,11];break;case 8:x=[32,11];break;case 9:x=[80,33];break;case 10:x=[18,11];break;case 11:x=[15,11];break;case 12:x=[64,33];break;case 13:x=[160,99];break;case 14:x=[4,3];break;case 15:x=[3,2];break;case 16:x=[2,1];break;case 255:x=[u.readUByte()<<8|u.readUByte(),u.readUByte()<<8|u.readUByte()]}x&&x[0]>0&&x[1]>0&&(d=x[0]/x[1])}if(u.readBoolean()&&u.skipBits(1),u.readBoolean()&&(u.skipBits(4),u.readBoolean()&&u.skipBits(24)),u.readBoolean()&&(u.skipUEG(),u.skipUEG()),u.readBoolean()){var U=u.readUInt(),A=u.readUInt();u.readBoolean()&&(y=A/(2*U))}}return{fps:y>0?y:void 0,width:Math.ceil((16*(i+1)-2*c-2*f)*d),height:(2-s)*(a+1)*16-(s?2:4)*(l+h)}}},{key:"parseHeader",value:function(e){var t=new S(e.getPayload());t.readUByte(),e.isfmb=0===t.readUEG(),e.stype=t.readUEG()}}]),e}(),x=function(){function e(t){r(this,e),this.remuxer=t,this.track=t.mp4track}return i(e,[{key:"extractAAC",value:function(t){var r,n,i=0,a=t.byteLength,s=[];if(!e.isAACPattern(t))return k("Invalid ADTS audio format"),s;for(r=e.getHeaderLength(t),this.aacHeader||(this.aacHeader=t.subarray(0,r));i<a;)n=e.getFrameLength(t),s.push(t.subarray(r,n)),t=t.slice(n),i+=n;return s}},{key:"setAACConfig",value:function(){var e,t,r,n=new Uint8Array(2),i=this.aacHeader;i&&(e=1+((192&i[2])>>>6),t=(60&i[2])>>>2,r=(1&i[2])<<2,r|=(192&i[3])>>>6,n[0]=e<<3,n[0]|=(14&t)>>1,n[1]|=(1&t)<<7,n[1]|=r<<3,this.track.codec="mp4a.40."+e,this.track.channelCount=r,this.track.config=n,this.remuxer.readyToDecode=!0)}}],[{key:"samplingRateMap",get:function(){return[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350]}},{key:"getHeaderLength",value:function(e){return 1&e[1]?7:9}},{key:"getFrameLength",value:function(e){return(3&e[3])<<11|e[4]<<3|(224&e[5])>>>5}},{key:"isAACPattern",value:function(e){return 255===e[0]&&240==(240&e[1])&&0==(6&e[1])}}]),e}(),U=function(){function e(t){r(this,e),this.listener={},this.type=""|t}return i(e,[{key:"on",value:function(e,t){return this.listener[e]||(this.listener[e]=[]),this.listener[e].push(t),!0}},{key:"off",value:function(e,t){if(this.listener[e]){var r=this.listener[e].indexOf(t);return r>-1&&this.listener[e].splice(r,1),!0}return!1}},{key:"offAll",value:function(){this.listener={}}},{key:"dispatch",value:function(e,t){return!!this.listener[e]&&(this.listener[e].map((function(e){e.apply(null,[t])})),!0)}}]),e}(),A=function(){function e(){r(this,e)}return i(e,null,[{key:"init",value:function(){var t;for(t in e.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]},e.types)e.types.hasOwnProperty(t)&&(e.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);var r=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),n=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);e.HDLR_TYPES={video:r,audio:n};var i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),a=new Uint8Array([0,0,0,0,0,0,0,0]);e.STTS=e.STSC=e.STCO=a,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var s=new Uint8Array([105,115,111,109]),o=new Uint8Array([97,118,99,49]),u=new Uint8Array([0,0,0,1]);e.FTYP=e.box(e.types.ftyp,s,u,s,o),e.DINF=e.box(e.types.dinf,e.box(e.types.dref,i))}},{key:"box",value:function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];for(var i,a=8,s=r.length,o=s;s--;)a+=r[s].byteLength;for((i=new Uint8Array(a))[0]=a>>24&255,i[1]=a>>16&255,i[2]=a>>8&255,i[3]=255&a,i.set(e,4),s=0,a=8;s<o;++s)i.set(r[s],a),a+=r[s].byteLength;return i}},{key:"hdlr",value:function(t){return e.box(e.types.hdlr,e.HDLR_TYPES[t])}},{key:"mdat",value:function(t){return e.box(e.types.mdat,t)}},{key:"mdhd",value:function(t,r){return e.box(e.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,r>>24,r>>16&255,r>>8&255,255&r,85,196,0,0]))}},{key:"mdia",value:function(t){return e.box(e.types.mdia,e.mdhd(t.timescale,t.duration),e.hdlr(t.type),e.minf(t))}},{key:"mfhd",value:function(t){return e.box(e.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))}},{key:"minf",value:function(t){return"audio"===t.type?e.box(e.types.minf,e.box(e.types.smhd,e.SMHD),e.DINF,e.stbl(t)):e.box(e.types.minf,e.box(e.types.vmhd,e.VMHD),e.DINF,e.stbl(t))}},{key:"moof",value:function(t,r,n){return e.box(e.types.moof,e.mfhd(t),e.traf(n,r))}},{key:"moov",value:function(t,r,n){for(var i=t.length,a=[];i--;)a[i]=e.trak(t[i]);return e.box.apply(null,[e.types.moov,e.mvhd(n,r)].concat(a).concat(e.mvex(t)))}},{key:"mvex",value:function(t){for(var r=t.length,n=[];r--;)n[r]=e.trex(t[r]);return e.box.apply(null,[e.types.mvex].concat(n))}},{key:"mvhd",value:function(t,r){var n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,t>>24&255,t>>16&255,t>>8&255,255&t,r>>24&255,r>>16&255,r>>8&255,255&r,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return e.box(e.types.mvhd,n)}},{key:"sdtp",value:function(t){var r,n,i=t.samples||[],a=new Uint8Array(4+i.length);for(n=0;n<i.length;n++)r=i[n].flags,a[n+4]=r.dependsOn<<4|r.isDependedOn<<2|r.hasRedundancy;return e.box(e.types.sdtp,a)}},{key:"stbl",value:function(t){return e.box(e.types.stbl,e.stsd(t),e.box(e.types.stts,e.STTS),e.box(e.types.stsc,e.STSC),e.box(e.types.stsz,e.STSZ),e.box(e.types.stco,e.STCO))}},{key:"avc1",value:function(t){var r,n,i,a=[],s=[];for(r=0;r<t.sps.length;r++)i=(n=t.sps[r]).byteLength,a.push(i>>>8&255),a.push(255&i),a=a.concat(Array.prototype.slice.call(n));for(r=0;r<t.pps.length;r++)i=(n=t.pps[r]).byteLength,s.push(i>>>8&255),s.push(255&i),s=s.concat(Array.prototype.slice.call(n));var o=e.box(e.types.avcC,new Uint8Array([1,a[3],a[4],a[5],255,224|t.sps.length].concat(a).concat([t.pps.length]).concat(s))),u=t.width,c=t.height;return e.box(e.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,u>>8&255,255&u,c>>8&255,255&c,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,98,105,110,101,108,112,114,111,46,114,117,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o,e.box(e.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])))}},{key:"esds",value:function(e){var t=e.config.byteLength,r=new Uint8Array(26+t+3);return r.set([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5,t]),r.set(e.config,26),r.set([6,1,2],26+t),r}},{key:"mp4a",value:function(t){var r=t.audiosamplerate;return e.box(e.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,r>>8&255,255&r,0,0]),e.box(e.types.esds,e.esds(t)))}},{key:"stsd",value:function(t){return"audio"===t.type?e.box(e.types.stsd,e.STSD,e.mp4a(t)):e.box(e.types.stsd,e.STSD,e.avc1(t))}},{key:"tkhd",value:function(t){var r=t.id,n=t.duration,i=t.width,a=t.height,s=t.volume;return e.box(e.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,r>>24&255,r>>16&255,r>>8&255,255&r,0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n,0,0,0,0,0,0,0,0,0,0,0,0,s>>0&255,s%1*10>>0&255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,i>>8&255,255&i,0,0,a>>8&255,255&a,0,0]))}},{key:"traf",value:function(t,r){var n=e.sdtp(t),i=t.id;return e.box(e.types.traf,e.box(e.types.tfhd,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,255&i])),e.box(e.types.tfdt,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r])),e.trun(t,n.length+16+16+8+16+8+8),n)}},{key:"trak",value:function(t){return t.duration=t.duration||4294967295,e.box(e.types.trak,e.tkhd(t),e.mdia(t))}},{key:"trex",value:function(t){var r=t.id;return e.box(e.types.trex,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}},{key:"trun",value:function(t,r){var n,i,a,s,o,u,c=t.samples||[],f=c.length,l=12+16*f,h=new Uint8Array(l);for(r+=8+l,h.set([0,0,15,1,f>>>24&255,f>>>16&255,f>>>8&255,255&f,r>>>24&255,r>>>16&255,r>>>8&255,255&r],0),n=0;n<f;n++)a=(i=c[n]).duration,s=i.size,o=i.flags,u=i.cts,h.set([a>>>24&255,a>>>16&255,a>>>8&255,255&a,s>>>24&255,s>>>16&255,s>>>8&255,255&s,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,61440&o.degradPrio,15&o.degradPrio,u>>>24&255,u>>>16&255,u>>>8&255,255&u],12+16*n);return e.box(e.types.trun,h)}},{key:"initSegment",value:function(t,r,n){e.types||e.init();var i,a=e.moov(t,r,n);return(i=new Uint8Array(e.FTYP.byteLength+a.byteLength)).set(e.FTYP),i.set(a,e.FTYP.byteLength),i}}]),e}(),B=1,D=function(){function e(){r(this,e)}return i(e,[{key:"flush",value:function(){this.mp4track.len=0,this.mp4track.samples=[]}},{key:"isReady",value:function(){return!(!this.readyToDecode||!this.samples.length)||null}}],[{key:"getTrackID",value:function(){return B++}}]),e}(),C=function(e){s(n,e);var t=f(n);function n(e){var i;return r(this,n),(i=t.call(this)).readyToDecode=!1,i.nextDts=0,i.dts=0,i.mp4track={id:D.getTrackID(),type:"audio",channelCount:0,len:0,fragmented:!0,timescale:e,duration:e,samples:[],config:"",codec:""},i.samples=[],i.aac=new x(c(i)),i}return i(n,[{key:"resetTrack",value:function(){this.readyToDecode=!1,this.mp4track.codec="",this.mp4track.channelCount="",this.mp4track.config="",this.mp4track.timescale=this.timescale,this.nextDts=0,this.dts=0}},{key:"remux",value:function(e){if(e.length>0)for(var t=0;t<e.length;t++){var r=e[t],n=r.units,i=n.byteLength;this.samples.push({units:n,size:i,duration:r.duration}),this.mp4track.len+=i,this.readyToDecode||this.aac.setAACConfig()}}},{key:"getPayload",value:function(){if(!this.isReady())return null;var e,t,r=new Uint8Array(this.mp4track.len),n=0,i=this.mp4track.samples;for(this.dts=this.nextDts;this.samples.length;){var a=this.samples.shift();a.units,(t=a.duration)<=0?(m("remuxer: invalid sample duration at DTS: ".concat(this.nextDts," :").concat(t)),this.mp4track.len-=a.size):(this.nextDts+=t,e={size:a.size,duration:t,cts:0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1}},r.set(a.units,n),n+=a.size,i.push(e))}return i.length?new Uint8Array(r.buffer,0,this.mp4track.len):null}},{key:"getAacParser",value:function(){return this.aac}}]),n}(D),E=function(e){s(n,e);var t=f(n);function n(e){var i;return r(this,n),(i=t.call(this)).readyToDecode=!1,i.nextDts=0,i.dts=0,i.mp4track={id:D.getTrackID(),type:"video",len:0,fragmented:!0,sps:"",pps:"",fps:30,width:0,height:0,timescale:e,duration:e,samples:[]},i.samples=[],i.h264=new w(c(i)),i}return i(n,[{key:"resetTrack",value:function(){this.readyToDecode=!1,this.mp4track.sps="",this.mp4track.pps="",this.nextDts=0,this.dts=0}},{key:"remux",value:function(e){var t,r=y(e);try{for(r.s();!(t=r.n()).done;){var n,i=t.value,a=[],s=0,o=y(i.units);try{for(o.s();!(n=o.n()).done;){var u=n.value;this.h264.parseNAL(u)&&(a.push(u),s+=u.getSize())}}catch(e){o.e(e)}finally{o.f()}a.length>0&&this.readyToDecode&&(this.mp4track.len+=s,this.samples.push({units:a,size:s,keyFrame:i.keyFrame,duration:i.duration,compositionTimeOffset:i.compositionTimeOffset}))}}catch(e){r.e(e)}finally{r.f()}}},{key:"getPayload",value:function(){if(!this.isReady())return null;var e,t,r=new Uint8Array(this.mp4track.len),n=0,i=this.mp4track.samples;for(this.dts=this.nextDts;this.samples.length;){var a=this.samples.shift(),s=a.units;if((t=a.duration)<=0)m("remuxer: invalid sample duration at DTS: ".concat(this.nextDts," :").concat(t)),this.mp4track.len-=a.size;else{this.nextDts+=t,e={size:a.size,duration:t,cts:a.compositionTimeOffset||0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,isNonSync:a.keyFrame?0:1,dependsOn:a.keyFrame?2:1}};var o,u=y(s);try{for(u.s();!(o=u.n()).done;){var c=o.value;r.set(c.getData(),n),n+=c.getSize()}}catch(e){u.e(e)}finally{u.f()}i.push(e)}}return i.length?new Uint8Array(r.buffer,0,this.mp4track.len):null}}]),n}(D),T=function(e){s(n,e);var t=f(n);function n(e){var i;return r(this,n),(i=t.call(this,"remuxer")).initialized=!1,i.trackTypes=[],i.tracks={},i.seq=1,i.env=e,i.timescale=1e3,i.mediaDuration=0,i.aacParser=null,i}return i(n,[{key:"addTrack",value:function(e){if("video"!==e&&"both"!==e||(this.tracks.video=new E(this.timescale),this.trackTypes.push("video")),"audio"===e||"both"===e){var t=new C(this.timescale);this.aacParser=t.getAacParser(),this.tracks.audio=t,this.trackTypes.push("audio")}}},{key:"reset",value:function(){var e,t=y(this.trackTypes);try{for(t.s();!(e=t.n()).done;){var r=e.value;this.tracks[r].resetTrack()}}catch(e){t.e(e)}finally{t.f()}this.initialized=!1}},{key:"destroy",value:function(){this.tracks={},this.offAll()}},{key:"flush",value:function(){if(this.initialized){var e,t=y(this.trackTypes);try{for(t.s();!(e=t.n()).done;){var r=e.value,n=this.tracks[r],i=n.getPayload();if(i&&i.byteLength){var a={type:r,payload:b(A.moof(this.seq,n.dts,n.mp4track),A.mdat(i)),dts:n.dts};"video"===r&&(a.fps=n.mp4track.fps),this.dispatch("buffer",a);var s=(o=n.dts/this.timescale,u=void 0,c=void 0,f=void 0,l=void 0,l="",u=Math.floor(o),(c=parseInt(u/3600,10)%24)>0&&(l+=(c<10?"0"+c:c)+":"),l+=((f=parseInt(u/60,10)%60)<10?"0"+f:f)+":"+((u=u<0?0:u%60)<10?"0"+u:u));m("put segment (".concat(r,"): dts: ").concat(n.dts," frames: ").concat(n.mp4track.samples.length," second: ").concat(s)),n.flush(),this.seq++}}}catch(e){t.e(e)}finally{t.f()}}else this.isReady()&&(this.dispatch("ready"),this.initSegment(),this.initialized=!0,this.flush());var o,u,c,f,l}},{key:"initSegment",value:function(){var e,t=[],r=y(this.trackTypes);try{for(r.s();!(e=r.n()).done;){var n=e.value,i=this.tracks[n];if("browser"==this.env){var a={type:n,payload:A.initSegment([i.mp4track],this.mediaDuration,this.timescale)};this.dispatch("buffer",a)}else t.push(i.mp4track)}}catch(e){r.e(e)}finally{r.f()}if("node"==this.env){var s={type:"all",payload:A.initSegment(t,this.mediaDuration,this.timescale)};this.dispatch("buffer",s)}m("Initial segment generated.")}},{key:"isReady",value:function(){var e,t=y(this.trackTypes);try{for(t.s();!(e=t.n()).done;){var r=e.value;if(!this.tracks[r].readyToDecode||!this.tracks[r].samples.length)return!1}}catch(e){t.e(e)}finally{t.f()}return!0}},{key:"remux",value:function(e){var t,r=y(this.trackTypes);try{for(r.s();!(t=r.n()).done;){var n=t.value,i=e[n];"audio"===n&&this.tracks.video&&!this.tracks.video.readyToDecode||i.length>0&&this.tracks[n].remux(i)}}catch(e){r.e(e)}finally{r.f()}this.flush()}}]),n}(U),P=function(e){s(n,e);var t=f(n);function n(e,i){var a;return r(this,n),(a=t.call(this,"buffer")).type=i,a.queue=new Uint8Array,a.cleaning=!1,a.pendingCleaning=0,a.cleanOffset=30,a.cleanRanges=[],a.sourceBuffer=e,a.sourceBuffer.addEventListener("updateend",(function(){a.pendingCleaning>0&&(a.initCleanup(a.pendingCleaning),a.pendingCleaning=0),a.cleaning=!1,a.cleanRanges.length&&a.doCleanup()})),a.sourceBuffer.addEventListener("error",(function(){a.dispatch("error",{type:a.type,name:"buffer",error:"buffer error"})})),a}return i(n,[{key:"destroy",value:function(){this.queue=null,this.sourceBuffer=null,this.offAll()}},{key:"doCleanup",value:function(){if(this.cleanRanges.length){var e=this.cleanRanges.shift();m("".concat(this.type," remove range [").concat(e[0]," - ").concat(e[1],")")),this.cleaning=!0,this.sourceBuffer.remove(e[0],e[1])}else this.cleaning=!1}},{key:"initCleanup",value:function(e){try{if(this.sourceBuffer.updating)return void(this.pendingCleaning=e);if(this.sourceBuffer.buffered&&this.sourceBuffer.buffered.length&&!this.cleaning){for(var t=0;t<this.sourceBuffer.buffered.length;++t){var r=this.sourceBuffer.buffered.start(t),n=this.sourceBuffer.buffered.end(t);e-r>this.cleanOffset&&r<(n=e-this.cleanOffset)&&this.cleanRanges.push([r,n])}this.doCleanup()}}catch(e){k("Error occured while cleaning ".concat(this.type," buffer - ").concat(e.name,": ").concat(e.message))}}},{key:"doAppend",value:function(){if(this.queue.length&&this.sourceBuffer&&!this.sourceBuffer.updating)try{this.sourceBuffer.appendBuffer(this.queue),this.queue=new Uint8Array}catch(t){var e="unexpectedError";"QuotaExceededError"===t.name?(m("".concat(this.type," buffer quota full")),e="QuotaExceeded"):(k("Error occured while appending ".concat(this.type," buffer - ").concat(t.name,": ").concat(t.message)),e="InvalidStateError"),this.dispatch("error",{type:this.type,name:e,error:"buffer error"})}}},{key:"feed",value:function(e){this.queue=b(this.queue,e)}}]),n}(U);return function(n){s(o,n);var a=f(o);function o(e){var n;r(this,o),(n=a.call(this,"jmuxer")).isReset=!1;return n.options=Object.assign({},{node:"",mode:"both",flushingTime:500,maxDelay:500,clearBuffer:!0,fps:30,readFpsFromTrack:!1,debug:!1,onReady:function(){},onError:function(){}},e),n.env="object"===("undefined"==typeof process?"undefined":t(process))&&"undefined"==typeof window?"node":"browser",n.options.debug&&(p=console.log,v=console.error),n.options.fps||(n.options.fps=30),n.frameDuration=1e3/n.options.fps|0,n.remuxController=new T(n.env),n.remuxController.addTrack(n.options.mode),n.initData(),n.remuxController.on("buffer",n.onBuffer.bind(c(n))),"browser"==n.env&&(n.remuxController.on("ready",n.createBuffer.bind(c(n))),n.initBrowser()),n}return i(o,[{key:"initData",value:function(){this.lastCleaningTime=Date.now(),this.kfPosition=[],this.kfCounter=0,this.pendingUnits={},this.remainingData=new Uint8Array,this.startInterval()}},{key:"initBrowser",value:function(){"string"==typeof this.options.node&&""==this.options.node&&k("no video element were found to render, provide a valid video element"),this.node="string"==typeof this.options.node?document.getElementById(this.options.node):this.options.node,this.mseReady=!1,this.setupMSE()}},{key:"createStream",value:function(){var t=this.feed.bind(this),r=this.destroy.bind(this);return this.stream=new e.Duplex({writableObjectMode:!0,read:function(e){},write:function(e,r,n){t(e),n()},final:function(e){r(),e()}}),this.stream}},{key:"setupMSE",value:function(){if(window.MediaSource=window.MediaSource||window.WebKitMediaSource,!window.MediaSource)throw"Oops! Browser does not support media source extension.";this.isMSESupported=!!window.MediaSource,this.mediaSource=new MediaSource,this.url=URL.createObjectURL(this.mediaSource),this.node.src=this.url,this.mseEnded=!1,this.mediaSource.addEventListener("sourceopen",this.onMSEOpen.bind(this)),this.mediaSource.addEventListener("sourceclose",this.onMSEClose.bind(this)),this.mediaSource.addEventListener("webkitsourceopen",this.onMSEOpen.bind(this)),this.mediaSource.addEventListener("webkitsourceclose",this.onMSEClose.bind(this))}},{key:"endMSE",value:function(){if(!this.mseEnded)try{this.mseEnded=!0,this.mediaSource.endOfStream()}catch(e){k("mediasource is not available to end")}}},{key:"feed",value:function(e){var t,r,n,i=!1,a={video:[],audio:[]};if(e&&this.remuxController){if(n=e.duration?parseInt(e.duration):0,e.video){e.video=b(this.remainingData,e.video);var s=l(w.extractNALu(e.video),2);if(t=s[0],r=s[1],this.remainingData=r||new Uint8Array,!(t.length>0))return void k("Failed to extract any NAL units from video data:",r);a.video=this.getVideoFrames(t,n,e.compositionTimeOffset),i=!0}if(e.audio){if(!((t=this.remuxController.aacParser.extractAAC(e.audio)).length>0))return void k("Failed to extract audio data from:",e.audio);a.audio=this.getAudioFrames(t,n),i=!0}i?this.remuxController.remux(a):k("Input object must have video and/or audio property. Make sure it is a valid typed array")}}},{key:"getVideoFrames",value:function(e,t,r){var n,i=this,a=[],s=[],o=0,u=!1,c=!1;this.pendingUnits.units&&(a=this.pendingUnits.units,c=this.pendingUnits.vcl,u=this.pendingUnits.keyFrame,this.pendingUnits={});var f,l=y(e);try{for(l.s();!(f=l.n()).done;){var h=f.value,d=new g(h);d.type()!==g.IDR&&d.type()!==g.NDR||w.parseHeader(d),a.length&&c&&(d.isfmb||!d.isvcl)&&(s.push({units:a,keyFrame:u}),a=[],u=!1,c=!1),a.push(d),u=u||d.isKeyframe(),c=c||d.isvcl}}catch(e){l.e(e)}finally{l.f()}if(a.length)if(t)if(c)s.push({units:a,keyFrame:u});else{var p=s.length-1;p>=0&&(s[p].units=s[p].units.concat(a))}else this.pendingUnits={units:a,keyFrame:u,vcl:c};return n=t?t/s.length|0:this.frameDuration,o=t?t-n*s.length:0,s.map((function(e){e.duration=n,e.compositionTimeOffset=r,o>0&&(e.duration++,o--),i.kfCounter++,e.keyFrame&&i.options.clearBuffer&&i.kfPosition.push(i.kfCounter*n/1e3)})),m("jmuxer: No. of frames of the last chunk: ".concat(s.length)),s}},{key:"getAudioFrames",value:function(e,t){var r,n,i=[],a=0,s=y(e);try{for(s.s();!(n=s.n()).done;){var o=n.value;i.push({units:o})}}catch(e){s.e(e)}finally{s.f()}return r=t?t/i.length|0:this.frameDuration,a=t?t-r*i.length:0,i.map((function(e){e.duration=r,a>0&&(e.duration++,a--)})),i}},{key:"destroy",value:function(){if(this.stopInterval(),this.stream&&(this.remuxController.flush(),this.stream.push(null),this.stream=null),this.remuxController&&(this.remuxController.destroy(),this.remuxController=null),this.bufferControllers){for(var e in this.bufferControllers)this.bufferControllers[e].destroy();this.bufferControllers=null,this.endMSE()}this.node=!1,this.mseReady=!1,this.videoStarted=!1,this.mediaSource=null}},{key:"reset",value:function(){if(this.stopInterval(),this.isReset=!0,this.node.pause(),this.remuxController&&this.remuxController.reset(),this.bufferControllers){for(var e in this.bufferControllers)this.bufferControllers[e].destroy();this.bufferControllers=null,this.endMSE()}this.initData(),"browser"==this.env&&this.initBrowser(),m("JMuxer was reset")}},{key:"createBuffer",value:function(){if(this.mseReady&&this.remuxController&&this.remuxController.isReady()&&!this.bufferControllers)for(var e in this.bufferControllers={},this.remuxController.tracks){var t=this.remuxController.tracks[e];if(!o.isSupported("".concat(e,'/mp4; codecs="').concat(t.mp4track.codec,'"')))return k("Browser does not support codec"),!1;var r=this.mediaSource.addSourceBuffer("".concat(e,'/mp4; codecs="').concat(t.mp4track.codec,'"'));this.bufferControllers[e]=new P(r,e),this.bufferControllers[e].on("error",this.onBufferError.bind(this))}}},{key:"startInterval",value:function(){var e=this;this.interval=setInterval((function(){e.options.flushingTime?e.applyAndClearBuffer():e.bufferControllers&&e.cancelDelay()}),this.options.flushingTime||1e3)}},{key:"stopInterval",value:function(){this.interval&&clearInterval(this.interval)}},{key:"cancelDelay",value:function(){if(this.node.buffered&&this.node.buffered.length>0&&!this.node.seeking){var e=this.node.buffered.end(0);e-this.node.currentTime>this.options.maxDelay/1e3&&(console.log("delay"),this.node.currentTime=e-.001)}}},{key:"releaseBuffer",value:function(){for(var e in this.bufferControllers)this.bufferControllers[e].doAppend()}},{key:"applyAndClearBuffer",value:function(){this.bufferControllers&&(this.releaseBuffer(),this.clearBuffer())}},{key:"getSafeClearOffsetOfBuffer",value:function(e){for(var t,r="audio"===this.options.mode&&e||0,n=0;n<this.kfPosition.length&&!(this.kfPosition[n]>=e);n++)t=this.kfPosition[n];return t&&(this.kfPosition=this.kfPosition.filter((function(e){return e<t&&(r=e),e>=t}))),r}},{key:"clearBuffer",value:function(){if(this.options.clearBuffer&&Date.now()-this.lastCleaningTime>1e4){for(var e in this.bufferControllers){var t=this.getSafeClearOffsetOfBuffer(this.node.currentTime);this.bufferControllers[e].initCleanup(t)}this.lastCleaningTime=Date.now()}}},{key:"onBuffer",value:function(e){this.options.readFpsFromTrack&&void 0!==e.fps&&this.options.fps!=e.fps&&(this.options.fps=e.fps,this.frameDuration=Math.ceil(1e3/e.fps),m("JMuxer changed FPS to ".concat(e.fps," from track data"))),"browser"==this.env?this.bufferControllers&&this.bufferControllers[e.type]&&this.bufferControllers[e.type].feed(e.payload):this.stream&&this.stream.push(e.payload),0===this.options.flushingTime&&this.applyAndClearBuffer()}},{key:"onMSEOpen",value:function(){this.mseReady=!0,URL.revokeObjectURL(this.url),"function"==typeof this.options.onReady&&this.options.onReady.call(null,this.isReset)}},{key:"onMSEClose",value:function(){this.mseReady=!1,this.videoStarted=!1}},{key:"onBufferError",value:function(e){if("QuotaExceeded"==e.name)return m("JMuxer cleaning ".concat(e.type," buffer due to QuotaExceeded error")),void this.bufferControllers[e.type].initCleanup(this.node.currentTime);"InvalidStateError"==e.name?(m("JMuxer is reseting due to InvalidStateError"),this.reset()):this.endMSE(),"function"==typeof this.options.onError&&this.options.onError.call(null,e)}}],[{key:"isSupported",value:function(e){return window.MediaSource&&window.MediaSource.isTypeSupported(e)}}]),o}(U)}));
2
3
  "use strict";function strcmp(_,e){return _==e?0:_>e?1:-1}var ptr=0,EXIT_SUCCESS=0,EXIT_FAILURE=1,SEEK_CUR=1,SEEK_END=2,SEEK_SET=0,buffer8k=function(){return Arr(8800,0)};function fread(_,e,r,t){if(_.val=new buffer8k,t.data.length<r+t.data_off)return t.data_off+=r,0;for(var n=0;n<r;++n)_.val[n]=t.data[t.data_off++];return _.val.length=r,n}function ftell(_){return _.data_off}function feof(_){return _.data.length<_.data_off?1:0}var char_=0,short_=0,int_=0,long_=0,void_=0,int8_t=char_,uint8_t=char_,int16_t=short_,uint16_t=short_,int32_t=int_,uint32_t=int_,uint64_t=long_,int64_t=long_,float_=0,size_t=0,double_=0,score_t=int64_t,CHAR_BIT=8,ptrdiff_t=int_,UINT8=char_,INT16=short_;function newObjectIt(_){return void 0===_?"error":JSON.parse(JSON.stringify(_))}function memcpy(_,e,r,t,n){var i;for(i=0;i<n;++i)_[e+i]=r[t+i];return _}function memset(_,e,r,t){var n=0;for(n=0;n<t;++n)_[e+n]=r}function malloc(_,e){var r,t=new Array;for(r=0;r<_;++r)t.push(e);return t}function assert(_){if(!_)throw new Error("assert :P")}function setjmp(_){return 0}function offsetof(_,e){return e}function Arr(_,e){var r,t=new Array;for(r=0;r<_;++r)t.push(e);return t}function Arr_new(_,e){var r,t=new Array;for(r=0;r<_;++r)t.push(new e);return t}function Arr_nOI(_,e){var r,t=new Array;for(r=0;r<_;++r)t.push(newObjectIt(e));return t}function ArrM(_,e){var r;new Array;for(r=_.length-1;r>=0;--r)e=newObjectIt(Arr(_[r],e));return e}function create_obj_vals_from_arrayChilds(_,e){var r;for(r=0;r<e.length;++r)e[r]=create_obj_vals_from_array(new _,e[r]);return e}function create_obj_vals_from_array(_,e){var r=_,t=0;for(var n in r)"object"==typeof r[n]&&Object.keys(r[n]).length==e[t].length?r[n]=create_obj_vals_from_array(r[n],e[t]):r[n]=e[t],t++;return r}var DC_PRED=0,V_PRED=1,H_PRED=2,TM_PRED=3,B_PRED=4,NEARESTMV=5,NEARMV=6,ZEROMV=7,NEWMV=8,SPLITMV=9,MB_MODE_COUNT=10,B_DC_PRED=0,B_TM_PRED=1,B_VE_PRED=2,B_HE_PRED=3,B_LD_PRED=4,B_RD_PRED=5,B_VR_PRED=6,B_VL_PRED=7,B_HD_PRED=8,B_HU_PRED=9,LEFT4X4=10,ABOVE4X4=11,ZERO4X4=12,NEW4X4=13,B_MODE_COUNT=14;function CODEC_INTERFACE(_,e){window[_+"_algo"]=create_obj_vals_from_array(vpx_codec_iface_t,e)}var VPX_CODEC_INTERNAL_ABI_VERSION=3,VPX_CODEC_CAP_DECODER=1,vpx_codec_ctrl_fn_map_t=function(){this.ctrl_id=int_,this.fn=0
3
- /*!\brief Decoder algorithm interface interface 285
4
- *
5
- * All decoders \ref MUST expose a variable of this type.
6
- */},vpx_codec_iface=function(){this.name=char_,this.abi_version=int_,this.caps=long_,this.init="vpx_codec_init_fn_t",this.destroy="vpx_codec_destroy_fn_t",this.ctrl_maps=new vpx_codec_ctrl_fn_map_t,this.get_mmap="vpx_codec_get_mmap_fn_t",this.set_mmap="vpx_codec_set_mmap_fn_t",this.dec=new Object({peek_si:"vpx_codec_peek_si_fn_t",get_si:"vpx_codec_get_si_fn_t",decode:"vpx_codec_decode_fn_t",get_frame:"vpx_codec_get_frame_fn_t"})},vpx_codec_iface_t=vpx_codec_iface,VERSION_STRING=" v0.9.7",VPX_CODEC_OK=0,VPX_CODEC_MEM_ERROR=2,VPX_IMAGE_ABI_VERSION=1;VPX_IMG_FMT_I420=258,VPX_IMG_FMT_VPXI420=260;var VPX_PLANE_PACKED=0,VPX_PLANE_Y=0,VPX_PLANE_U=1,VPX_PLANE_V=2,VPX_PLANE_ALPHA=3,PLANE_PACKED=VPX_PLANE_PACKED,PLANE_Y=VPX_PLANE_Y,PLANE_U=VPX_PLANE_U,PLANE_V=VPX_PLANE_V,PLANE_ALPHA=VPX_PLANE_ALPHA,vpx_image_t=function(){this.fmt=0,this.w=this.w=int_,this.h=this.h=int_,this.d_w=this.d_w=int_,this.d_h=this.d_h=int_,this.x_chroma_shift=this.x_chroma_shift=int_,this.y_chroma_shift=this.y_chroma_shift=int_,this.planes=this.planes=new Array(4),this.planes_off=this.planes_off=new Array(4),this.stride=this.stride=new Array(4),this.bps=this.bps=int_,this.user_priv=this.user_priv=void_,this.img_data=this.img_data=char_,this.img_data_off=this.img_data_off=0,this.img_data_owner=this.img_data_owner=int_,this.self_allocd=this.self_allocd=int_},NESTEGG_TRACK_VIDEO=0,NESTEGG_TRACK_AUDIO=1,NESTEGG_CODEC_VP8=0,NESTEGG_CODEC_VORBIS=1,NESTEGG_SEEK_SET=0,NESTEGG_SEEK_CUR=1,NESTEGG_SEEK_END=2,NESTEGG_LOG_DEBUG=1,NESTEGG_LOG_INFO=10,NESTEGG_LOG_WARNING=100,NESTEGG_LOG_ERROR=1e3,NESTEGG_LOG_CRITICAL=1e4,nestegg_io=function(){this.read=int_,this.seek=int_,this.tell=int64_t,this.userdata=void_},nestegg_video_params=function(){this.width=int_,this.height=int_,this.display_width=int_,this.display_height=int_,this.crop_bottom=int_,this.crop_top=int_,this.crop_left=int_,this.crop_right=int_},ID_EBML=440786851,ID_EBML_VERSION=17030,ID_EBML_READ_VERSION=17143,ID_EBML_MAX_ID_LENGTH=17138,ID_EBML_MAX_SIZE_LENGTH=17139,ID_DOCTYPE=17026,ID_DOCTYPE_VERSION=17031,ID_DOCTYPE_READ_VERSION=17029,ID_VOID=236,ID_CRC32=191,ID_SEGMENT=408125543,ID_SEEK_HEAD=290298740,ID_SEEK=19899,ID_SEEK_ID=21419,ID_SEEK_POSITION=21420,ID_INFO=357149030,ID_TIMECODE_SCALE=2807729,ID_DURATION=17545,ID_CLUSTER=524531317,ID_TIMECODE=231,ID_BLOCK_GROUP=160,ID_SIMPLE_BLOCK=163,ID_BLOCK=161,ID_BLOCK_DURATION=155,ID_REFERENCE_BLOCK=251,ID_TRACKS=374648427,ID_TRACK_ENTRY=174,ID_TRACK_NUMBER=215,ID_TRACK_UID=29637,ID_TRACK_TYPE=131,ID_FLAG_ENABLED=185,ID_FLAG_DEFAULT=136,ID_FLAG_LACING=156,ID_TRACK_TIMECODE_SCALE=2306383,ID_LANGUAGE=2274716,ID_CODEC_ID=134,ID_CODEC_PRIVATE=25506,ID_VIDEO=224,ID_PIXEL_WIDTH=176,ID_PIXEL_HEIGHT=186,ID_PIXEL_CROP_BOTTOM=21674,ID_PIXEL_CROP_TOP=21691,ID_PIXEL_CROP_LEFT=21708,ID_PIXEL_CROP_RIGHT=21725,ID_DISPLAY_WIDTH=21680,ID_DISPLAY_HEIGHT=21690,ID_AUDIO=225,ID_SAMPLING_FREQUENCY=181,ID_CHANNELS=159,ID_BIT_DEPTH=25188,ID_CUES=475249515,ID_CUE_POINT=187,ID_CUE_TIME=179,ID_CUE_TRACK_POSITIONS=183,ID_CUE_TRACK=247,ID_CUE_CLUSTER_POSITION=241,ID_CUE_BLOCK_NUMBER=21368,TYPE_UNKNOWN=0,TYPE_MASTER=1,TYPE_UINT=2,TYPE_FLOAT=3,TYPE_INT=4,TYPE_STRING=5,TYPE_BINARY=6,LIMIT_STRING=1<<20,LIMIT_BINARY=1<<24,LIMIT_BLOCK=1<<30,LIMIT_FRAME=1<<28,DESC_FLAG_NONE=0,DESC_FLAG_MULTI=1,DESC_FLAG_SUSPEND=2,DESC_FLAG_OFFSET=4,BLOCK_FLAGS_LACING=6,LACING_NONE=0,LACING_XIPH=1,LACING_FIXED=2,LACING_EBML=3,TRACK_TYPE_VIDEO=1,TRACK_TYPE_AUDIO=2,TRACK_ID_VP8="V_VP8",TRACK_ID_VORBIS="A_VORBIS",MASK_NONE=0,MASK_FIRST_BIT=1,ebml_binary=function(){this.data=char_,this.length=size_t},ebml_list_node=function(){this.next=null,this.id=uint64_t,this.data=void_},ebml_list=function(){this.head=null,this.tail=null},ebml_type=function(){this.v=new Object({u:uint64_t,f:double_,i:int64_t,s:char_,b:new ebml_binary}),this.type=0,this.read=int_},ebml=window.ebml=function(){this.ebml_version=this.ebml_version=new ebml_type,this.ebml_read_version=this.ebml_read_version=new ebml_type,this.ebml_max_id_length=this.ebml_max_id_length=new ebml_type,this.ebml_max_size_length=this.ebml_max_size_length=new ebml_type,this.doctype=this.doctype=new ebml_type,this.doctype_version=this.doctype_version=new ebml_type,this.doctype_read_version=this.doctype_read_version=new ebml_type},seek=window.seek=function(){this.id=this.id=new ebml_type,this.position=this.position=new ebml_type},seek_head=window.seek_head=function(){this.seek=this.seek=new ebml_list},info=window.info=function(){this.timecode_scale=this.timecode_scale=new ebml_type,this.duration=this.duration=new ebml_type},block_group=window.block_group=function(){this.duration=this.duration=new ebml_type,this.reference_block=this.reference_block=new ebml_type},cluster=window.cluster=function(){this.timecode=this.timecode=new ebml_type,this.block_group=this.block_group=new ebml_list},video=window.video=function(){this.pixel_width=this.pixel_width=new ebml_type,this.pixel_height=this.pixel_height=new ebml_type,this.pixel_crop_bottom=this.pixel_crop_bottom=new ebml_type,this.pixel_crop_top=this.pixel_crop_top=new ebml_type,this.pixel_crop_left=this.pixel_crop_left=new ebml_type,this.pixel_crop_right=this.pixel_crop_right=new ebml_type,this.display_width=this.display_width=new ebml_type,this.display_height=this.display_height=new ebml_type},audio=window.audio=function(){this.sampling_frequency=this.sampling_frequency=new ebml_type,this.channels=this.channels=new ebml_type,this.bit_depth=this.bit_depth=new ebml_type},track_entry=window.track_entry=function(){this.number=this.number=new ebml_type,this.uid=this.uid=new ebml_type,this.type=this.type=new ebml_type,this.flag_enabled=this.flag_enabled=new ebml_type,this.flag_default=this.flag_default=new ebml_type,this.flag_lacing=this.flag_lacing=new ebml_type,this.track_timecode_scale=this.track_timecode_scale=new ebml_type,this.language=this.language=new ebml_type,this.codec_id=this.codec_id=new ebml_type,this.codec_private=this.codec_private=new ebml_type,this.video=this.video=new video,this.audio=this.audio=new audio},tracks=window.tracks=function(){this.track_entry=this.track_entry=new ebml_list},cue_track_positions=window.cue_track_positions=function(){this.track=this.track=new ebml_type,this.cluster_position=this.cluster_position=new ebml_type,this.block_number=this.block_number=new ebml_type},cue_point=window.cue_point=function(){this.time=this.time=new ebml_type,this.cue_track_positions=this.cue_track_positions=new ebml_list},cues=window.cues=function(){this.cue_point=this.cue_point=new ebml_list},segment=window.segment=function(){this.seek_head=this.seek_head=new ebml_list,this.info=this.info=new info,this.cluster=this.cluster=new ebml_list,this.tracks=this.tracks=new tracks,this.cues=this.cues=new cues},pool_ctx=function(){this.dummy=char_},list_node=function(){this.previous=0,this.node=new ebml_element_desc,this.data=char_},frame=function(){this.data=char_,this.length=size_t,this.next=null},nestegg=function(){this.io=new nestegg_io,this.log_=0,this.alloc_pool=new pool_ctx,this.last_id=uint64_t,this.last_size=uint64_t,this.ancestor=null,this.ebml=this.ebml=new ebml,this.segment=this.segment=new segment,this.segment_offset=int64_t,this.track_count=int_},nestegg_packet=function(){this.track=uint64_t,this.timecode=uint64_t,this.frame=new frame},ebml_element_desc=function(){this.name=char_,this.id=uint64_t,this.type=0,this.offset=size_t,this.flags=int_,this.children=null,this.size=size_t,this.data_offset=size_t};function E_FIELD(_,e,r,t,n){return new Array(_,e,r,n,DESC_FLAG_NONE,null,0,0)}function E_MASTER(_,e,r,t,n,i){return new Array(_,e,r,n,DESC_FLAG_MULTI,i,1,0)}function E_SINGLE_MASTER_O(_,e,r,t,n,i){return new Array(_,e,r,n,DESC_FLAG_OFFSET,i,0,n+"_offset")}function E_SINGLE_MASTER(_,e,r,t,n,i){return new Array(_,e,r,n,DESC_FLAG_NONE,i,0,0)}function E_SUSPEND(_,e,r){return new Array(_,e,r,0,DESC_FLAG_SUSPEND,null,0,0)}var E_LAST=new Array(null,0,0,0,DESC_FLAG_NONE,null,0,0),ne_ebml_elements=create_ebml_element_desc(new Array(E_FIELD("ID_EBML_VERSION",ID_EBML_VERSION,TYPE_UINT,"ebml","ebml_version"),E_FIELD("ID_EBML_READ_VERSION",ID_EBML_READ_VERSION,TYPE_UINT,"ebml","ebml_read_version"),E_FIELD("ID_EBML_MAX_ID_LENGTH",ID_EBML_MAX_ID_LENGTH,TYPE_UINT,"ebml","ebml_max_id_length"),E_FIELD("ID_EBML_MAX_SIZE_LENGTH",ID_EBML_MAX_SIZE_LENGTH,TYPE_UINT,"ebml","ebml_max_size_length"),E_FIELD("ID_DOCTYPE",ID_DOCTYPE,TYPE_STRING,"ebml","doctype"),E_FIELD("ID_DOCTYPE_VERSION",ID_DOCTYPE_VERSION,TYPE_UINT,"ebml","doctype_version"),E_FIELD("ID_DOCTYPE_READ_VERSION",ID_DOCTYPE_READ_VERSION,TYPE_UINT,"ebml","doctype_read_version"),E_LAST)),ne_seek_elements=create_ebml_element_desc(new Array(E_FIELD("ID_SEEK_ID",ID_SEEK_ID,TYPE_BINARY,"seek","id"),E_FIELD("ID_SEEK_POSITION",ID_SEEK_POSITION,TYPE_UINT,"seek","position"),E_LAST)),ne_seek_head_elements=create_ebml_element_desc(new Array(E_MASTER("ID_SEEK",ID_SEEK,TYPE_MASTER,"seek_head","seek",ne_seek_elements),E_LAST)),ne_info_elements=create_ebml_element_desc(new Array(E_FIELD("ID_TIMECODE_SCALE",ID_TIMECODE_SCALE,TYPE_UINT,"info","timecode_scale"),E_FIELD("ID_DURATION",ID_DURATION,TYPE_FLOAT,"info","duration"),E_LAST)),ne_block_group_elements=create_ebml_element_desc(new Array(E_SUSPEND("ID_BLOCK",ID_BLOCK,TYPE_BINARY),E_FIELD("ID_BLOCK_DURATION",ID_BLOCK_DURATION,TYPE_UINT,"block_group","duration"),E_FIELD("ID_REFERENCE_BLOCK",ID_REFERENCE_BLOCK,TYPE_INT,"block_group","reference_block"),E_LAST)),ne_cluster_elements=create_ebml_element_desc(new Array(E_FIELD("ID_TIMECODE",ID_TIMECODE,TYPE_UINT,"cluster","timecode"),E_MASTER("ID_BLOCK_GROUP",ID_BLOCK_GROUP,TYPE_MASTER,"cluster","block_group",ne_block_group_elements),E_SUSPEND("ID_SIMPLE_BLOCK",ID_SIMPLE_BLOCK,TYPE_BINARY),E_LAST)),ne_video_elements=create_ebml_element_desc(new Array(E_FIELD("ID_PIXEL_WIDTH",ID_PIXEL_WIDTH,TYPE_UINT,"video","pixel_width"),E_FIELD("ID_PIXEL_HEIGHT",ID_PIXEL_HEIGHT,TYPE_UINT,"video","pixel_height"),E_FIELD("ID_PIXEL_CROP_BOTTOM",ID_PIXEL_CROP_BOTTOM,TYPE_UINT,"video","pixel_crop_bottom"),E_FIELD("ID_PIXEL_CROP_TOP",ID_PIXEL_CROP_TOP,TYPE_UINT,"video","pixel_crop_top"),E_FIELD("ID_PIXEL_CROP_LEFT",ID_PIXEL_CROP_LEFT,TYPE_UINT,"video","pixel_crop_left"),E_FIELD("ID_PIXEL_CROP_RIGHT",ID_PIXEL_CROP_RIGHT,TYPE_UINT,"video","pixel_crop_right"),E_FIELD("ID_DISPLAY_WIDTH",ID_DISPLAY_WIDTH,TYPE_UINT,"video","display_width"),E_FIELD("ID_DISPLAY_HEIGHT",ID_DISPLAY_HEIGHT,TYPE_UINT,"video","display_height"),E_LAST)),ne_audio_elements=create_ebml_element_desc(new Array(E_FIELD("ID_SAMPLING_FREQUENCY",ID_SAMPLING_FREQUENCY,TYPE_FLOAT,"audio","sampling_frequency"),E_FIELD("ID_CHANNELS",ID_CHANNELS,TYPE_UINT,"audio","channels"),E_FIELD("ID_BIT_DEPTH",ID_BIT_DEPTH,TYPE_UINT,"audio","bit_depth"),E_LAST)),ne_track_entry_elements=create_ebml_element_desc(new Array(E_FIELD("ID_TRACK_NUMBER",ID_TRACK_NUMBER,TYPE_UINT,"track_entry","number"),E_FIELD("ID_TRACK_UID",ID_TRACK_UID,TYPE_UINT,"track_entry","uid"),E_FIELD("ID_TRACK_TYPE",ID_TRACK_TYPE,TYPE_UINT,"track_entry","type"),E_FIELD("ID_FLAG_ENABLED",ID_FLAG_ENABLED,TYPE_UINT,"track_entry","flag_enabled"),E_FIELD("ID_FLAG_DEFAULT",ID_FLAG_DEFAULT,TYPE_UINT,"track_entry","flag_default"),E_FIELD("ID_FLAG_LACING",ID_FLAG_LACING,TYPE_UINT,"track_entry","flag_lacing"),E_FIELD("ID_TRACK_TIMECODE_SCALE",ID_TRACK_TIMECODE_SCALE,TYPE_FLOAT,"track_entry","track_timecode_scale"),E_FIELD("ID_LANGUAGE",ID_LANGUAGE,TYPE_STRING,"track_entry","language"),E_FIELD("ID_CODEC_ID",ID_CODEC_ID,TYPE_STRING,"track_entry","codec_id"),E_FIELD("ID_CODEC_PRIVATE",ID_CODEC_PRIVATE,TYPE_BINARY,"track_entry","codec_private"),E_SINGLE_MASTER("ID_VIDEO",ID_VIDEO,TYPE_MASTER,"track_entry","video",ne_video_elements),E_SINGLE_MASTER("ID_AUDIO",ID_AUDIO,TYPE_MASTER,"track_entry","audio",ne_audio_elements),E_LAST)),ne_tracks_elements=create_ebml_element_desc(new Array(E_MASTER("ID_TRACK_ENTRY",ID_TRACK_ENTRY,TYPE_MASTER,"tracks","track_entry",ne_track_entry_elements),E_LAST)),ne_cue_track_positions_elements=create_ebml_element_desc(new Array(E_FIELD("ID_CUE_TRACK",ID_CUE_TRACK,TYPE_UINT,"cue_track_positions","track"),E_FIELD("ID_CUE_CLUSTER_POSITION",ID_CUE_CLUSTER_POSITION,TYPE_UINT,"cue_track_positions","cluster_position"),E_FIELD("ID_CUE_BLOCK_NUMBER",ID_CUE_BLOCK_NUMBER,TYPE_UINT,"cue_track_positions","block_number"),E_LAST)),ne_cue_point_elements=create_ebml_element_desc(new Array(E_FIELD("ID_CUE_TIME",ID_CUE_TIME,TYPE_UINT,"cue_point","time"),E_MASTER("ID_CUE_TRACK_POSITIONS",ID_CUE_TRACK_POSITIONS,TYPE_MASTER,"cue_point","cue_track_positions",ne_cue_track_positions_elements),E_LAST)),ne_cues_elements=create_ebml_element_desc(new Array(E_MASTER("ID_CUE_POINT",ID_CUE_POINT,TYPE_MASTER,"cues","cue_point",ne_cue_point_elements),E_LAST)),ne_segment_elements=create_ebml_element_desc(new Array(E_MASTER("ID_SEEK_HEAD",ID_SEEK_HEAD,TYPE_MASTER,"segment","seek_head",ne_seek_head_elements),E_SINGLE_MASTER("ID_INFO",ID_INFO,TYPE_MASTER,"segment","info",ne_info_elements),E_MASTER("ID_CLUSTER",ID_CLUSTER,TYPE_MASTER,"segment","cluster",ne_cluster_elements),E_SINGLE_MASTER("ID_TRACKS",ID_TRACKS,TYPE_MASTER,"segment","tracks",ne_tracks_elements),E_SINGLE_MASTER("ID_CUES",ID_CUES,TYPE_MASTER,"segment","cues",ne_cues_elements),E_LAST)),ne_top_level_elements=create_ebml_element_desc(new Array(E_SINGLE_MASTER("ID_EBML",ID_EBML,TYPE_MASTER,"nestegg","ebml",ne_ebml_elements),E_SINGLE_MASTER_O("ID_SEGMENT",ID_SEGMENT,TYPE_MASTER,"nestegg","segment",ne_segment_elements),E_LAST));function create_ebml_element_desc(_){for(var e=new Array,r=0;r<_.length;++r){var t=0,n=new ebml_element_desc;for(var i in n)"undefined"!==_[r][t]&&(n[i]=_[r][t++]);e.push(n)}return e}function ne_pool_init(_){return new pool_ctx}var buffer_8192=Arr(8192,0);function ne_io_read_skip(_,e){for(var r=size_t,t={val:buffer_8192},n=1;e>0&&1==(n=ne_io_read(_,t,r=e<t.val.length?e:t.val.length));)e-=r;return n}function ne_io_tell(_){return _.tell(_.userdata)}function ne_bare_read_vint(_,e,r,t){var n=int_,i={val:char_},a=1,o=128;if(1!=(n=ne_io_read(_,i,1)))return n;for(;a<8&&0==(i.val[0]&o);)o>>=1,a+=1;for(r&&(r.val=a),e.val=i.val[0],t==MASK_FIRST_BIT&&(e.val=i.val[0]&~o);--a;){if(1!=(n=ne_io_read(_,i,1)))return n;e.val<<=8,e.val|=i.val[0]}return 1}function ne_io_read(_,e,r){return _.read(e,r,_.userdata)}function ne_read_id(_,e,r){return ne_bare_read_vint(_,e,r,MASK_NONE)}function ne_read_vint(_,e,r){return ne_bare_read_vint(_,e,r,MASK_FIRST_BIT)}function ne_read_svint(_,e,r){var t=int_,n=[uint64_t],i=[uint64_t],a=new Array(63,8191,1048575,134217727,17179869183,2199023255551,0xffffffffffff,0x80000000000000);return 1!=(t=ne_bare_read_vint(_,n,i,MASK_FIRST_BIT))||(e[0]=n-a[i-1],r&&(r[0]=i)),t}function ne_read_uint(_,e,r){var t={val:char_},n=int_;if(0==r||r>8)return-1;if(1!=(n=ne_io_read(_,t,1)))return n;for(e[0]=t.val[0];--r;){if(1!=(n=ne_io_read(_,t,1)))return n;e[0]<<=8,e[0]|=t.val[0]}return 1}function ne_read_int(_,e,r){var t,n=[uint64_t],i=uint64_t;return 1!=(t=ne_read_uint(_,n,r))?t:(r<8?(i=1,n>=(i<<=8*r-1)?(i=1,i<<=8*r):i=0,e[0]=n-i):e[0]=n,1)}function ne_read_float(_,e,r){var t,n={u:[uint64_t],f:[float_],d:[double_]};return 4!=r&&8!=r?-1:1!=(t=ne_read_uint(_,n.u,r))?t:(e[0]=4==r?n.f=n.u:n.d=n.u,1)}function ne_read_string(_,e,r){var t,n={val:char_};if(0==r||r>LIMIT_STRING)return-1;if(1!=(t=ne_io_read(_.io,n,r)))return t;for(var i="",a=0;a<r;++a)i+=String.fromCharCode(n.val[a]);return n.val=i,e[0]=n.val,1}function ne_read_binary(_,e,r){return 0==r||r>LIMIT_BINARY?-1:(e.data={val:0},e.length=r,ne_io_read(_.io,e.data,r))}function ne_get_uint(_,e){return _.read?(assert(_.type==TYPE_UINT),e[0]=_.v.u,0):-1}function ne_get_string(_,e){return _.read?(assert(_.type==TYPE_STRING),e[0]=_.v.s,0):-1}function ne_is_ancestor_element(_,e){for(;e;e=e.previous)for(var r=e.node,t=0;r[t].id;++t)if(r[t].id==_)return 1;return 0}function ne_find_element(_,e){for(var r=e,t=0;r[t].id;++t)if(r[t].id==_)return r[t];return null}function ne_ctx_push(_,e,r){var t=new list_node;t.previous=_.ancestor,t.node=e,t.data=r,_.ancestor=t}function ne_ctx_pop(_){var e;e=_.ancestor,_.ancestor=e.previous,e=""}function ne_peek_element(_,e,r){var t=int_;return _.last_id&&_.last_size?(e&&(e[0]=_.last_id),r&&(r[0]=_.last_size),1):(_.last_id={val:_.last_id},t=ne_read_id(_.io,_.last_id,null),_.last_id=_.last_id.val,1!=t?t:(_.last_size={val:_.last_size},t=ne_read_vint(_.io,_.last_size,null),_.last_size=_.last_size.val,1!=t?t:(e&&(e[0]=_.last_id),r&&(r[0]=_.last_size),1)))}function ne_read_element(_,e,r){var t;return 1!=(t=ne_peek_element(_,e,r))?t:(_.last_id=0,_.last_size=0,1)}function ne_read_master(_,e){var r,t,n=new ebml_list_node;assert(e.type==TYPE_MASTER&&e.flags&DESC_FLAG_MULTI),_.ancestor.data[e.offset]&&(r=_.ancestor.data[e.offset]),n.id=e.id,n.data=new window[e.offset],(t=r.tail)&&(t.next=n),r.tail=n,r.head||(r.head=n),ne_ctx_push(_,e.children,n.data)}function ne_read_single_master(_,e){assert(e.type==TYPE_MASTER&&!(e.flags&DESC_FLAG_MULTI)),ne_ctx_push(_,e.children,_.ancestor.data[e.offset])}function ne_read_simple(_,e,r){var t,n=int_;if(_.ancestor.data[e.offset]&&(t=_.ancestor.data[e.offset]),t.read)return 0;switch(t.type=e.type,n=-1,e.type){case TYPE_UINT:t.v.u=[t.v.u],n=ne_read_uint(_.io,t.v.u,r),t.v.u=t.v.u[0];break;case TYPE_FLOAT:t.v.f=[t.v.f],n=ne_read_float(_.io,t.v.f,r),t.v.f=t.v.f[0];break;case TYPE_INT:t.v.i=[t.v.i],n=ne_read_int(_.io,t.v.i,r),t.v.i=t.v.i[0];break;case TYPE_STRING:t.v.s=[t.v.s],n=ne_read_string(_,t.v.s,r),t.v.s=t.v.s[0];break;case TYPE_BINARY:n=ne_read_binary(_,t.v.b,r);break;case TYPE_MASTER:case TYPE_UNKNOWN:assert(0)}return 1==n&&(t.read=1),n}function ne_parse(_,e){var r,t=int_,n=int64_t,i=[uint64_t],a=[uint64_t];if(!_.ancestor)return-1;for(;1==(t=ne_peek_element(_,i,a));)if(r=ne_find_element(i[0],_.ancestor.node)){if(r.flags&DESC_FLAG_SUSPEND){assert(r.type==TYPE_BINARY),t=1;break}if(1!=(t=ne_read_element(_,i,a)))break;if(r.flags&DESC_FLAG_OFFSET&&((n=_.ancestor.data[r.data_offset]={v:null}).v=ne_io_tell(_.io),n<0)){t=-1;break}if(r.type==TYPE_MASTER){r.flags&DESC_FLAG_MULTI?ne_read_master(_,r):ne_read_single_master(_,r);continue}if((t=ne_read_simple(_,r,a[0]))<0)break}else if(ne_is_ancestor_element(i,_.ancestor.previous)){if(e&&_.ancestor.node==e){t=1;break}ne_ctx_pop(_)}else{if(1!=(t=ne_read_element(_,i,a)))break;if(1!=(t=ne_io_read_skip(_.io,a[0])))break}if(1!=t)for(;_.ancestor;)ne_ctx_pop(_);return t}function ne_read_xiph_lace_value(_,e,r,t){var n=int_,i=[uint64_t];if(1!=(n=ne_read_uint(_,i,1)))return n;for(t[0]+=1,e[r+0]=i[0];255==i[0];){if(1!=(n=ne_read_uint(_,i,1)))return n;t[0]+=1,e[r+0]+=i[0]}return 1}function ne_read_xiph_lacing(_,e,r,t,n){for(var i=int_,a=0,o=0;--t;){if(1!=(i=ne_read_xiph_lace_value(_,n,a,r)))return i;o+=n[a],a+=1}return r[0]+o>e?-1:(n[a]=e-r[0]-o,1)}function ne_read_ebml_lacing(_,e,r,t,n){var i=int_,a=[uint64_t],o=uint64_t,s=[uint64_t],f=[int64_t],d=0;if(1!=(i=ne_read_vint(_,a,s)))return i;for(r[0]+=s[0],n[d]=a[0],o=n[d],d+=1,t-=1;--t;){if(1!=(i=ne_read_svint(_,f,s)))return i;r[0]+=s[0],n[d]=n[d-1]+f[0],o+=n[d],d+=1}return r[0]+o>e?-1:(n[d]=e-r[0]-o,1)}function ne_get_timecode_scale(_){var e=[uint64_t];return 0!=ne_get_uint(_.segment.info.timecode_scale,e)&&(e[0]=1e6),e[0]}function ne_find_track_entry(_,e){for(var r=0,t=_.segment.tracks.track_entry.head;t;){if(assert(t.id==ID_TRACK_ENTRY),e==r)return t.data;r+=1,t=t.next}return null}var frame_sizes_256=Arr(256,0);function ne_read_block(_,e,r,t){var n,i,a,o,s,f,d=int_,E=[int64_t],c={val:uint64_t},l={val:uint64_t},m=frame_sizes_256,A=[uint64_t],u=[uint64_t],p=[uint64_t],T=uint64_t,y=int_,b=[0];if(t[0]=null,r>LIMIT_BLOCK)return-1;if(1!=(d=ne_read_vint(_.io,c,l)))return d;if(0==c.val||c.val>_.track_count)return-1;if(b[0]+=l.val,1!=(d=ne_read_int(_.io,E,2)))return d;if(b[0]+=2,1!=(d=ne_read_uint(_.io,u,1)))return d;switch(b[0]+=1,p[0]=0,f=(u[0]&BLOCK_FLAGS_LACING)>>1){case LACING_NONE:p[0]=1;break;case LACING_XIPH:case LACING_FIXED:case LACING_EBML:if(1!=(d=ne_read_uint(_.io,p,1)))return d;b[0]+=1,p[0]+=1}if(p[0]>256)return-1;switch(f){case LACING_NONE:m[0]=r-b[0];break;case LACING_XIPH:if(1==p)return-1;if(1!=(d=ne_read_xiph_lacing(_.io,r,b,p,m)))return d;break;case LACING_FIXED:if((r-b[0])%p[0])return-1;for(y=0;y<p[0];++y)m[y]=(r-b[0])/p>>0;break;case LACING_EBML:if(1==p[0])return-1;if(1!=(d=ne_read_ebml_lacing(_.io,r,b,p,m)))return d}for(T=b[0],y=0;y<p[0];++y)T+=m[y];if(T>r)return-1;if(!ne_find_track_entry(_,c.val-1))return-1;if(1,s=ne_get_timecode_scale(_),assert(_.segment.cluster.tail.id==ID_CLUSTER),0!=ne_get_uint(_.segment.cluster.tail.data.timecode,A))return-1;if((n=E[0]+A[0])<0)return-1;for((i=new nestegg_packet).track=c.val-1,i.timecode=n*s*1,o=null,y=0;y<p[0];++y){if(m[y]>LIMIT_FRAME)return nestegg_free_packet(i),-1;if((a=new frame).data=[],a.length=m[y],a.data={val:a.data},d=ne_io_read(_.io,a.data,m[y]),a.data=a.data.val,1!=d)return a.data=null,a=null,nestegg_free_packet(i),-1;o?o.next=a:i.frame=a,o=a}return t[0]=i,1}function ne_null_log_callback(_,e,r,t){}function ne_is_suspend_element(_){return _==ID_SIMPLE_BLOCK||_==ID_BLOCK?1:0}var ctx_=new nestegg;function nestegg_init(_,e,r){var t,n=[0],i=[0],a=[uint64_t],o=[char_],s=ctx_;if(!(e.read&&e.seek&&e.tell))return-1;if(s.io=e,s.alloc_pool=ne_pool_init(),1!=ne_peek_element(s,n,null))return nestegg_destroy(s),-1;if(n[0]!=ID_EBML)return nestegg_destroy(s),-1;if(ne_ctx_push(s,ne_top_level_elements,s),1!=ne_parse(s,null))return nestegg_destroy(s),-1;if(0!=ne_get_uint(s.ebml.ebml_read_version,i)&&(i=1),1!=i[0])return nestegg_destroy(s),-1;if(0!=ne_get_string(s.ebml.doctype,o)&&(o[0]="matroska"),0!=strcmp(o[0],"webm"))return nestegg_destroy(s),-1;if(0!=ne_get_uint(s.ebml.doctype_read_version,a)&&(a[0]=1),a[0]<1||a[0]>2)return nestegg_destroy(s),-1;if(!s.segment.tracks.track_entry.head)return nestegg_destroy(s),-1;for(t=s.segment.tracks.track_entry.head,s.track_count=0;t;)s.track_count+=1,t=t.next;return _[0]=s,0}function nestegg_destroy(_){}function nestegg_track_count(_,e){return e[0]=_.track_count,0}function nestegg_track_type(_,e){var r=[uint64_t],t=ne_find_track_entry(_,e);return t?0!=ne_get_uint(t.type,r)?-1:r[0]&TRACK_TYPE_VIDEO?NESTEGG_TRACK_VIDEO:r[0]&TRACK_TYPE_AUDIO?NESTEGG_TRACK_AUDIO:-1:-1}function nestegg_track_codec_id(_,e){var r=[char_],t=ne_find_track_entry(_,e);return t?0!=ne_get_string(t.codec_id,r)?-1:0==strcmp(r[0],TRACK_ID_VP8)?NESTEGG_CODEC_VP8:0==strcmp(r[0],TRACK_ID_VORBIS)?NESTEGG_CODEC_VORBIS:-1:-1}function nestegg_track_video_params(_,e,r){var t=[uint64_t],n=ne_find_track_entry(_,e);return n?nestegg_track_type(_,e)!=NESTEGG_TRACK_VIDEO||0!=ne_get_uint(n.video.pixel_width,t)?-1:(r.width=t[0],0!=ne_get_uint(n.video.pixel_height,t)?-1:(r.height=t[0],t[0]=0,ne_get_uint(n.video.pixel_crop_bottom,t),r.crop_bottom=t[0],t[0]=0,ne_get_uint(n.video.pixel_crop_top,t),r.crop_top=t[0],t[0]=0,ne_get_uint(n.video.pixel_crop_left,t),r.crop_left=t[0],t[0]=0,ne_get_uint(n.video.pixel_crop_right,t),r.crop_right=t[0],t[0]=r.width,ne_get_uint(n.video.display_width,t),r.display_width=t[0],t[0]=r.height,ne_get_uint(n.video.display_height,t),r.display_height=t[0],0)):-1}function nestegg_read_packet(_,e){var r=int_,t=[uint64_t],n=[uint64_t];for(e[0]=null;;){if(1!=(r=ne_peek_element(_,t,n)))return r;if(ne_is_suspend_element(t))return 1!=(r=ne_read_element(_,t,n))?r:r=ne_read_block(_,t,n[0],e);if(1!=(r=ne_parse(_,null)))return r}return 1}function nestegg_free_packet(_){for(var e;_.frame;)e=_.frame,_.frame=e.next,e.data="",e="";_=""}function nestegg_packet_track(_,e){return e[0]=_[0].track,0}function nestegg_packet_count(_,e){var r=_[0].frame;for(e[0]=0;r;)e[0]+=1,r=r.next;return 0}function nestegg_packet_data(_,e,r,t){var n=_[0].frame,i=0;for(r[0]=null,t[0]=0;n;){if(i==e)return r[0]=n.data,t[0]=n.length,0;i+=1,n=n.next}return-1}VPX_IMAGE_ABI_VERSION=1;var VPX_IMG_FMT_PLANAR=256,VPX_IMG_FMT_UV_FLIP=512,VPX_IMG_FMT_HAS_ALPHA=1024,VPX_IMG_FMT_NONE=0,VPX_IMG_FMT_RGB24=1,VPX_IMG_FMT_RGB32=2,VPX_IMG_FMT_RGB565=3,VPX_IMG_FMT_RGB555=4,VPX_IMG_FMT_UYVY=5,VPX_IMG_FMT_YUY2=6,VPX_IMG_FMT_YVYU=7,VPX_IMG_FMT_BGR24=8,VPX_IMG_FMT_RGB32_LE=9,VPX_IMG_FMT_ARGB=10,VPX_IMG_FMT_ARGB_LE=11,VPX_IMG_FMT_RGB565_LE=12,VPX_IMG_FMT_RGB555_LE=13,VPX_IMG_FMT_YV12=VPX_IMG_FMT_PLANAR|VPX_IMG_FMT_UV_FLIP|1,VPX_IMG_FMT_I420=2|VPX_IMG_FMT_PLANAR,VPX_IMG_FMT_VPXYV12=VPX_IMG_FMT_PLANAR|VPX_IMG_FMT_UV_FLIP|3,VPX_IMG_FMT_VPXI420=4|VPX_IMG_FMT_PLANAR,IMG_FMT_PLANAR=VPX_IMG_FMT_PLANAR,IMG_FMT_UV_FLIP=VPX_IMG_FMT_UV_FLIP,IMG_FMT_HAS_ALPHA=VPX_IMG_FMT_HAS_ALPHA,IMG_FMT_NONE=VPX_IMG_FMT_NONE,IMG_FMT_RGB24=VPX_IMG_FMT_RGB24,IMG_FMT_RGB32=VPX_IMG_FMT_RGB32,IMG_FMT_RGB565=VPX_IMG_FMT_RGB565,IMG_FMT_RGB555=VPX_IMG_FMT_RGB555,IMG_FMT_UYVY=VPX_IMG_FMT_UYVY,IMG_FMT_YUY2=VPX_IMG_FMT_YUY2,IMG_FMT_YVYU=VPX_IMG_FMT_YVYU,IMG_FMT_BGR24=VPX_IMG_FMT_BGR24,IMG_FMT_RGB32_LE=VPX_IMG_FMT_RGB32_LE,IMG_FMT_ARGB=VPX_IMG_FMT_ARGB,IMG_FMT_ARGB_LE=VPX_IMG_FMT_ARGB_LE,IMG_FMT_RGB565_LE=VPX_IMG_FMT_RGB565_LE,IMG_FMT_RGB555_LE=VPX_IMG_FMT_RGB555_LE,IMG_FMT_YV12=VPX_IMG_FMT_YV12,IMG_FMT_I420=VPX_IMG_FMT_I420,IMG_FMT_VPXYV12=VPX_IMG_FMT_VPXYV12,IMG_FMT_VPXI420=VPX_IMG_FMT_VPXI420;function img_alloc_helper(_,e,r,t,n,i){var a,o,s=int_,f=int_,d=int_,E=int_,c=int_;switch(n||(n=1),n&n-1&&alert("goto fail"),e){case VPX_IMG_FMT_RGB32:case VPX_IMG_FMT_RGB32_LE:case VPX_IMG_FMT_ARGB:case VPX_IMG_FMT_ARGB_LE:E=32;break;case VPX_IMG_FMT_RGB24:case VPX_IMG_FMT_BGR24:E=24;break;case VPX_IMG_FMT_RGB565:case VPX_IMG_FMT_RGB565_LE:case VPX_IMG_FMT_RGB555:case VPX_IMG_FMT_RGB555_LE:case VPX_IMG_FMT_UYVY:case VPX_IMG_FMT_YUY2:case VPX_IMG_FMT_YVYU:E=16;break;case VPX_IMG_FMT_I420:case VPX_IMG_FMT_YV12:case VPX_IMG_FMT_VPXI420:case VPX_IMG_FMT_VPXYV12:E=12;break;default:E=16}switch(e){case VPX_IMG_FMT_I420:case VPX_IMG_FMT_YV12:case VPX_IMG_FMT_VPXI420:case VPX_IMG_FMT_VPXYV12:f=1;break;default:f=0}switch(e){case VPX_IMG_FMT_I420:case VPX_IMG_FMT_YV12:case VPX_IMG_FMT_VPXI420:case VPX_IMG_FMT_VPXYV12:d=1;break;default:d=0}return o=r+(c=(1<<f)-1)&~c,a=t+(c=(1<<d)-1)&~c,s=(s=e&VPX_IMG_FMT_PLANAR?o:E*o/8)+n-1&~(n-1),_||((_=new vpx_image_t)||alert("goto fail"),_.self_allocd=1),_.img_data=i,i||(_.img_data=malloc(e&VPX_IMG_FMT_PLANAR?a*o*E/8:a*s,0),_.img_data_owner=1),_.img_data||alert("goto fail"),_.fmt=_.fmt=e,_.w=_.w=o,_.h=_.h=a,_.x_chroma_shift=_.x_chroma_shift=f,_.y_chroma_shift=_.y_chroma_shift=d,_.bps=_.bps=E,_.stride[VPX_PLANE_Y]=_.stride[VPX_PLANE_ALPHA]=s,_.stride[VPX_PLANE_U]=_.stride[VPX_PLANE_V]=s>>f,vpx_img_set_rect(_,0,0,r,t)?(vpx_img_free(_),null):_}function vpx_img_alloc(_,e,r,t,n){return img_alloc_helper(_,e,r,t,n,null)}function vpx_img_set_rect(_,e,r,t,n){var i=char_,a=0;return e+t<=_.w&&r+n<=_.h?(_.d_w=_.d_w=t,_.d_h=_.d_h=n,_.fmt&VPX_IMG_FMT_PLANAR?(i=_.img_data,a=_.img_data_off,_.fmt&VPX_IMG_FMT_HAS_ALPHA&&(_.planes[VPX_PLANE_ALPHA]=i,_.planes_off[VPX_PLANE_ALPHA]=a+e+r*_.stride[VPX_PLANE_ALPHA],a+=_.h*_.stride[VPX_PLANE_ALPHA]),_.planes[VPX_PLANE_Y]=i,_.planes_off[VPX_PLANE_Y]=a+e+r*_.stride[VPX_PLANE_Y],a+=_.h*_.stride[VPX_PLANE_Y],_.fmt&VPX_IMG_FMT_UV_FLIP?(_.planes[VPX_PLANE_V]=i,_.planes_off[VPX_PLANE_V]=a+(e>>_.x_chroma_shift)+(r>>_.y_chroma_shift)*_.stride[VPX_PLANE_V],a+=(_.h>>_.y_chroma_shift)*_.stride[VPX_PLANE_V],_.planes[VPX_PLANE_U]=i,_.planes_off[VPX_PLANE_U]=a+(e>>_.x_chroma_shift)+(r>>_.y_chroma_shift)*_.stride[VPX_PLANE_U]):(_.planes[VPX_PLANE_U]=i,_.planes_off[VPX_PLANE_U]=a+(e>>_.x_chroma_shift)+(r>>_.y_chroma_shift)*_.stride[VPX_PLANE_U],a+=(_.h>>_.y_chroma_shift)*_.stride[VPX_PLANE_U],_.planes[VPX_PLANE_V]=i,_.planes_off[VPX_PLANE_V]=a+(e>>_.x_chroma_shift)+(r>>_.y_chroma_shift)*_.stride[VPX_PLANE_V])):(_.planes[VPX_PLANE_PACKED]=_.img_data,_.img_data_of,parseInt(e*_.bps/8+r*_.stride[VPX_PLANE_PACKED],10)),0):-1}function vpx_img_free(_){_&&(_.img_data&&_.img_data_owner&&(_.img_data=""),_.self_allocd&&(_=""))}var bool_decoder=function(){this.input=char_,this.input_off=0,this.input_len=size_t,this.range=int_,this.value=int_,this.bit_count=int_};function init_bool_decoder(_,e,r,t){t>=2?(_.value=e[r+0]<<8|e[r+1],_.input=e,_.input_off=r+2,_.input_len=t-2):(_.value=0,_.input=null,_.input_len=0),_.range=255,_.bit_count=0}function bool_get(_,e){var r=1+((_.range-1)*e>>8),t=r<<8,n=int_;for(_.value>=t?(n=1,_.range-=r,_.value-=t):(n=0,_.range=r);_.range<128;)_.value<<=1,_.range<<=1,8==++_.bit_count&&(_.bit_count=0,_.input_len&&(_.value|=_.input[_.input_off++],_.input_len--));return n}function bool_get_bit(_){return bool_get(_,128)}function bool_get_uint(_,e){var r=0,t=int_;for(t=e-1;t>=0;t--)r|=bool_get_bit(_)<<t;return r}function bool_get_int(_,e){var r=0,t=int_;for(t=e-1;t>=0;t--)r|=bool_get_bit(_)<<t;return bool_get_bit(_)?-r:r}function bool_maybe_get_int(_,e){return bool_get_bit(_)?bool_get_int(_,e):0}function bool_read_tree(_,e,r,t){var n=0;if(void 0!==t)for(;(n=e[n+bool_get(_,r[t+(n>>1)])])>0;);else for(;(n=e[n+bool_get(_,r[n>>1])])>0;);return-n}function BITS_MASK(_){return(1<<_)-1}function BITS_GET(_,e,r){return _>>e&BITS_MASK(r)}var vp8_frame_hdr=function(){this.is_keyframe=int_,this.is_experimental=int_,this.version=int_,this.is_shown=int_,this.part0_sz=int_,this.kf=new Object({w:int_,h:int_,scale_w:int_,scale_h:int_}),this.frame_size_updated=int_},MB_FEATURE_TREE_PROBS=3,MAX_MB_SEGMENTS=4,vp8_segment_hdr=function(){this.enabled=int_,this.update_data=int_,this.update_map=int_,this.abs_=int_,this.tree_probs=new Array(MB_FEATURE_TREE_PROBS),this.lf_level=new Array(MAX_MB_SEGMENTS),this.quant_idx=new Array(MAX_MB_SEGMENTS)},BLOCK_CONTEXTS=4,vp8_loopfilter_hdr=function(){this.use_simple=int_,this.level=int_,this.sharpness=int_,this.delta_enabled=int_,this.ref_delta=new Array(BLOCK_CONTEXTS),this.mode_delta=new Array(BLOCK_CONTEXTS)},MAX_PARTITIONS=8,vp8_token_hdr=function(){this.partitions=int_,this.partition_sz=new Array(MAX_PARTITIONS)},vp8_quant_hdr=function(){this.q_index=int_,this.delta_update=int_,this.y1_dc_delta_q=int_,this.y2_dc_delta_q=int_,this.y2_ac_delta_q=int_,this.uv_dc_delta_q=int_,this.uv_ac_delta_q=int_},vp8_reference_hdr=function(){this.refresh_last=int_,this.refresh_gf=int_,this.refresh_arf=int_,this.copy_gf=int_,this.copy_arf=int_,this.sign_bias=new Array(4),this.refresh_entropy=int_},BLOCK_TYPES=4,PREV_COEF_CONTEXTS=3,COEF_BANDS=8,ENTROPY_NODES=11,coeff_probs_table_t=function(){return ArrM(new Array(BLOCK_TYPES,COEF_BANDS,PREV_COEF_CONTEXTS,ENTROPY_NODES),char_)},MV_PROB_CNT=19,mv_component_probs_t=function(){return new Array(MV_PROB_CNT)},Arr_1056=Arr(1056,0),vp8_entropy_hdr=function(){this.coeff_probs=new coeff_probs_table_t,this.coeff_probs_=Arr(1056,0),this.mv_probs=Arr_new(2,mv_component_probs_t),this.coeff_skip_enabled=int_,this.coeff_skip_prob=char_,this.y_mode_probs=new Array(0,0,0,0),this.uv_mode_probs=new Array(0,0,0),this.prob_inter=char_,this.prob_last=char_,this.prob_gf=char_},CURRENT_FRAME=0,LAST_FRAME=1,GOLDEN_FRAME=2,ALTREF_FRAME=3,NUM_REF_FRAMES=4,filter_t=function(){return new Array(6)},mv=function(){this.d={x:int16_t,y:int16_t}},mb_base_info=function(){this.y_mode=char_,this.uv_mode=char_,this.segment_id=char_,this.ref_frame=char_,this.skip_coeff=char_,this.need_mc_border=char_,this.partitioning=null,this.mv=new mv,this.eob_mask=int_},mb_info=function(){this.base=new mb_base_info,this.splitt=new Object({mvs:Arr_new(16,mv),modes:new Array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)})},token_entropy_ctx_t=function(){return new Array(9)},token_decoder=function(){this.bool=new bool_decoder,this.left_token_entropy_ctx=new token_entropy_ctx_t,this.coeffs=short_},TOKEN_BLOCK_Y1=0,TOKEN_BLOCK_UV=1,TOKEN_BLOCK_Y2=2,TOKEN_BLOCK_TYPES=3,dequant_factors=function(){this.quant_idx=int_,this.factor=ArrM(new Array(TOKEN_BLOCK_TYPES,2),short_)},ref_cnt_img=function(){this.img=new vpx_image_t,this.ref_cnt=int_},vp8_decoder_ctx=function(){this.error=[],this.frame_cnt=int_,this.frame_hdr=new vp8_frame_hdr,this.segment_hdr=new vp8_segment_hdr,this.loopfilter_hdr=new vp8_loopfilter_hdr,this.token_hdr=new vp8_token_hdr,this.quant_hdr=new vp8_quant_hdr,this.reference_hdr=new vp8_reference_hdr,this.entropy_hdr=new vp8_entropy_hdr,this.saved_entropy=new vp8_entropy_hdr,this.saved_entropy_valid=int_,this.mb_rows=int_,this.mb_cols=int_,this.mb_info_storage=null,this.mb_info_storage_off=0,this.mb_info_storage_object=mb_info,this.mb_info_rows_storage=null,this.mb_info_rows_storage_off=0,this.mb_info_rows_storage_object=mb_info,this.mb_info_rows=null,this.mb_info_rows_off=0,this.above_token_entropy_ctx=null,this.above_token_entropy_ctx_object=token_entropy_ctx_t,this.tokens=Arr_new(MAX_PARTITIONS,token_decoder),this.dequant_factors=Arr_new(MAX_MB_SEGMENTS,dequant_factors),this.frame_strg=Arr_new(NUM_REF_FRAMES,ref_cnt_img),this.ref_frames=Arr_new(NUM_REF_FRAMES,ref_cnt_img),this.ref_frame_offsets=new Array(0,0,0,0),this.ref_frame_offsets_=new Array(0,0,0,0),this.subpixel_filters=new filter_t};function CLAMP_255(_){return _<0?0:_>255?255:_}function vp8_dixie_walsh(_,e,r,t){var n=int_,i=int_,a=int_,o=int_,s=int_,f=int_,d=int_,E=int_,c=int_,l=_,m=e,A=r,u=t;for(n=0;n<4;n++)i=l[m+0]+l[m+12],a=l[m+4]+l[m+8],o=l[m+4]-l[m+8],s=l[m+0]-l[m+12],A[u+0]=i+a,A[u+4]=o+s,A[u+8]=i-a,A[u+12]=s-o,m++,u++;for(l=r,m=t,A=r,u=t,n=0;n<4;n++)f=(i=l[m+0]+l[m+3])+(a=l[m+1]+l[m+2]),d=(o=l[m+1]-l[m+2])+(s=l[m+0]-l[m+3]),E=i-a,c=s-o,A[u+0]=f+3>>3,A[u+1]=d+3>>3,A[u+2]=E+3>>3,A[u+3]=c+3>>3,m+=4,u+=4}var cospi8sqrt2minus1=20091,sinpi8sqrt2=35468;function idct_columns(_,e,r,t){var n=int_,i=int_,a=int_,o=int_,s=int_,f=_,d=e,E=r,c=t;for(n=0;n<4;n++)i=f[d+0]+f[d+8],a=f[d+0]-f[d+8],o=(f[d+4]*sinpi8sqrt2>>16)-(f[d+12]+(f[d+12]*cospi8sqrt2minus1>>16)),s=f[d+4]+(f[d+4]*cospi8sqrt2minus1>>16)+(f[d+12]*sinpi8sqrt2>>16),E[c+0]=i+s,E[c+12]=i-s,E[c+4]=a+o,E[c+8]=a-o,d++,c++}var tmp_2=Arr(16,0);function vp8_dixie_idct_add(_,e,r,t,n,i,a){var o=int_,s=int_,f=int_,d=int_,E=int_;for(idct_columns(i,a,tmp_2,0),i=tmp_2,a=0,o=0;o<4;o++)s=i[a+0]+i[a+2],f=i[a+0]-i[a+2],d=(i[a+1]*sinpi8sqrt2>>16)-(i[a+3]+(i[a+3]*cospi8sqrt2minus1>>16)),E=i[a+1]+(i[a+1]*cospi8sqrt2minus1>>16)+(i[a+3]*sinpi8sqrt2>>16),_[e+0]=r[t+0]+(s+E+4>>3),_[e+3]=r[t+3]+(s-E+4>>3),_[e+1]=r[t+1]+(f+d+4>>3),_[e+2]=r[t+2]+(f-d+4>>3),a+=4,e+=n,t+=n}var k_coeff_entropy_update_probs=new Array(new Array(new Array(new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(176,246,255,255,255,255,255,255,255,255,255),new Array(223,241,252,255,255,255,255,255,255,255,255),new Array(249,253,253,255,255,255,255,255,255,255,255)),new Array(new Array(255,244,252,255,255,255,255,255,255,255,255),new Array(234,254,254,255,255,255,255,255,255,255,255),new Array(253,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,246,254,255,255,255,255,255,255,255,255),new Array(239,253,254,255,255,255,255,255,255,255,255),new Array(254,255,254,255,255,255,255,255,255,255,255)),new Array(new Array(255,248,254,255,255,255,255,255,255,255,255),new Array(251,255,254,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,253,254,255,255,255,255,255,255,255,255),new Array(251,254,254,255,255,255,255,255,255,255,255),new Array(254,255,254,255,255,255,255,255,255,255,255)),new Array(new Array(255,254,253,255,254,255,255,255,255,255,255),new Array(250,255,254,255,254,255,255,255,255,255,255),new Array(254,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255))),new Array(new Array(new Array(217,255,255,255,255,255,255,255,255,255,255),new Array(225,252,241,253,255,255,254,255,255,255,255),new Array(234,250,241,250,253,255,253,254,255,255,255)),new Array(new Array(255,254,255,255,255,255,255,255,255,255,255),new Array(223,254,254,255,255,255,255,255,255,255,255),new Array(238,253,254,254,255,255,255,255,255,255,255)),new Array(new Array(255,248,254,255,255,255,255,255,255,255,255),new Array(249,254,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,253,255,255,255,255,255,255,255,255,255),new Array(247,254,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,253,254,255,255,255,255,255,255,255,255),new Array(252,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,254,254,255,255,255,255,255,255,255,255),new Array(253,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,254,253,255,255,255,255,255,255,255,255),new Array(250,255,255,255,255,255,255,255,255,255,255),new Array(254,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255))),new Array(new Array(new Array(186,251,250,255,255,255,255,255,255,255,255),new Array(234,251,244,254,255,255,255,255,255,255,255),new Array(251,251,243,253,254,255,254,255,255,255,255)),new Array(new Array(255,253,254,255,255,255,255,255,255,255,255),new Array(236,253,254,255,255,255,255,255,255,255,255),new Array(251,253,253,254,254,255,255,255,255,255,255)),new Array(new Array(255,254,254,255,255,255,255,255,255,255,255),new Array(254,254,254,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,254,255,255,255,255,255,255,255,255,255),new Array(254,254,255,255,255,255,255,255,255,255,255),new Array(254,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(254,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255))),new Array(new Array(new Array(248,255,255,255,255,255,255,255,255,255,255),new Array(250,254,252,254,255,255,255,255,255,255,255),new Array(248,254,249,253,255,255,255,255,255,255,255)),new Array(new Array(255,253,253,255,255,255,255,255,255,255,255),new Array(246,253,253,255,255,255,255,255,255,255,255),new Array(252,254,251,254,254,255,255,255,255,255,255)),new Array(new Array(255,254,252,255,255,255,255,255,255,255,255),new Array(248,254,253,255,255,255,255,255,255,255,255),new Array(253,255,254,254,255,255,255,255,255,255,255)),new Array(new Array(255,251,254,255,255,255,255,255,255,255,255),new Array(245,251,254,255,255,255,255,255,255,255,255),new Array(253,253,254,255,255,255,255,255,255,255,255)),new Array(new Array(255,251,253,255,255,255,255,255,255,255,255),new Array(252,253,254,255,255,255,255,255,255,255,255),new Array(255,254,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,252,255,255,255,255,255,255,255,255,255),new Array(249,255,254,255,255,255,255,255,255,255,255),new Array(255,255,254,255,255,255,255,255,255,255,255)),new Array(new Array(255,255,253,255,255,255,255,255,255,255,255),new Array(250,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(254,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)))),k_default_y_mode_probs=new Array(112,86,140,37),k_default_uv_mode_probs=new Array(162,101,204),k_default_coeff_probs=new Array(new Array(new Array(new Array(128,128,128,128,128,128,128,128,128,128,128),new Array(128,128,128,128,128,128,128,128,128,128,128),new Array(128,128,128,128,128,128,128,128,128,128,128)),new Array(new Array(253,136,254,255,228,219,128,128,128,128,128),new Array(189,129,242,255,227,213,255,219,128,128,128),new Array(106,126,227,252,214,209,255,255,128,128,128)),new Array(new Array(1,98,248,255,236,226,255,255,128,128,128),new Array(181,133,238,254,221,234,255,154,128,128,128),new Array(78,134,202,247,198,180,255,219,128,128,128)),new Array(new Array(1,185,249,255,243,255,128,128,128,128,128),new Array(184,150,247,255,236,224,128,128,128,128,128),new Array(77,110,216,255,236,230,128,128,128,128,128)),new Array(new Array(1,101,251,255,241,255,128,128,128,128,128),new Array(170,139,241,252,236,209,255,255,128,128,128),new Array(37,116,196,243,228,255,255,255,128,128,128)),new Array(new Array(1,204,254,255,245,255,128,128,128,128,128),new Array(207,160,250,255,238,128,128,128,128,128,128),new Array(102,103,231,255,211,171,128,128,128,128,128)),new Array(new Array(1,152,252,255,240,255,128,128,128,128,128),new Array(177,135,243,255,234,225,128,128,128,128,128),new Array(80,129,211,255,194,224,128,128,128,128,128)),new Array(new Array(1,1,255,128,128,128,128,128,128,128,128),new Array(246,1,255,128,128,128,128,128,128,128,128),new Array(255,128,128,128,128,128,128,128,128,128,128))),new Array(new Array(new Array(198,35,237,223,193,187,162,160,145,155,62),new Array(131,45,198,221,172,176,220,157,252,221,1),new Array(68,47,146,208,149,167,221,162,255,223,128)),new Array(new Array(1,149,241,255,221,224,255,255,128,128,128),new Array(184,141,234,253,222,220,255,199,128,128,128),new Array(81,99,181,242,176,190,249,202,255,255,128)),new Array(new Array(1,129,232,253,214,197,242,196,255,255,128),new Array(99,121,210,250,201,198,255,202,128,128,128),new Array(23,91,163,242,170,187,247,210,255,255,128)),new Array(new Array(1,200,246,255,234,255,128,128,128,128,128),new Array(109,178,241,255,231,245,255,255,128,128,128),new Array(44,130,201,253,205,192,255,255,128,128,128)),new Array(new Array(1,132,239,251,219,209,255,165,128,128,128),new Array(94,136,225,251,218,190,255,255,128,128,128),new Array(22,100,174,245,186,161,255,199,128,128,128)),new Array(new Array(1,182,249,255,232,235,128,128,128,128,128),new Array(124,143,241,255,227,234,128,128,128,128,128),new Array(35,77,181,251,193,211,255,205,128,128,128)),new Array(new Array(1,157,247,255,236,231,255,255,128,128,128),new Array(121,141,235,255,225,227,255,255,128,128,128),new Array(45,99,188,251,195,217,255,224,128,128,128)),new Array(new Array(1,1,251,255,213,255,128,128,128,128,128),new Array(203,1,248,255,255,128,128,128,128,128,128),new Array(137,1,177,255,224,255,128,128,128,128,128))),new Array(new Array(new Array(253,9,248,251,207,208,255,192,128,128,128),new Array(175,13,224,243,193,185,249,198,255,255,128),new Array(73,17,171,221,161,179,236,167,255,234,128)),new Array(new Array(1,95,247,253,212,183,255,255,128,128,128),new Array(239,90,244,250,211,209,255,255,128,128,128),new Array(155,77,195,248,188,195,255,255,128,128,128)),new Array(new Array(1,24,239,251,218,219,255,205,128,128,128),new Array(201,51,219,255,196,186,128,128,128,128,128),new Array(69,46,190,239,201,218,255,228,128,128,128)),new Array(new Array(1,191,251,255,255,128,128,128,128,128,128),new Array(223,165,249,255,213,255,128,128,128,128,128),new Array(141,124,248,255,255,128,128,128,128,128,128)),new Array(new Array(1,16,248,255,255,128,128,128,128,128,128),new Array(190,36,230,255,236,255,128,128,128,128,128),new Array(149,1,255,128,128,128,128,128,128,128,128)),new Array(new Array(1,226,255,128,128,128,128,128,128,128,128),new Array(247,192,255,128,128,128,128,128,128,128,128),new Array(240,128,255,128,128,128,128,128,128,128,128)),new Array(new Array(1,134,252,255,255,128,128,128,128,128,128),new Array(213,62,250,255,255,128,128,128,128,128,128),new Array(55,93,255,128,128,128,128,128,128,128,128)),new Array(new Array(128,128,128,128,128,128,128,128,128,128,128),new Array(128,128,128,128,128,128,128,128,128,128,128),new Array(128,128,128,128,128,128,128,128,128,128,128))),new Array(new Array(new Array(202,24,213,235,186,191,220,160,240,175,255),new Array(126,38,182,232,169,184,228,174,255,187,128),new Array(61,46,138,219,151,178,240,170,255,216,128)),new Array(new Array(1,112,230,250,199,191,247,159,255,255,128),new Array(166,109,228,252,211,215,255,174,128,128,128),new Array(39,77,162,232,172,180,245,178,255,255,128)),new Array(new Array(1,52,220,246,198,199,249,220,255,255,128),new Array(124,74,191,243,183,193,250,221,255,255,128),new Array(24,71,130,219,154,170,243,182,255,255,128)),new Array(new Array(1,182,225,249,219,240,255,224,128,128,128),new Array(149,150,226,252,216,205,255,171,128,128,128),new Array(28,108,170,242,183,194,254,223,255,255,128)),new Array(new Array(1,81,230,252,204,203,255,192,128,128,128),new Array(123,102,209,247,188,196,255,233,128,128,128),new Array(20,95,153,243,164,173,255,203,128,128,128)),new Array(new Array(1,222,248,255,216,213,128,128,128,128,128),new Array(168,175,246,252,235,205,255,255,128,128,128),new Array(47,116,215,255,211,212,255,255,128,128,128)),new Array(new Array(1,121,236,253,212,214,255,255,128,128,128),new Array(141,84,213,252,201,202,255,219,128,128,128),new Array(42,80,160,240,162,185,255,205,128,128,128)),new Array(new Array(1,1,255,128,128,128,128,128,128,128,128),new Array(244,1,255,128,128,128,128,128,128,128,128),new Array(238,1,255,128,128,128,128,128,128,128,128)))),k_mv_entropy_update_probs=new Array(new Array(237,246,253,253,254,254,254,254,254,254,254,254,254,254,250,250,252,254,254),new Array(231,243,245,253,254,254,254,254,254,254,254,254,254,254,251,251,254,254,254)),k_default_mv_probs=function(){return new Array(new Array(162,128,225,146,172,147,214,39,156,128,129,132,75,145,178,206,239,254,254),new Array(164,128,204,170,119,235,140,230,228,128,130,130,74,148,180,203,236,254,254))},dc_q_lookup=new Array(4,5,6,7,8,9,10,10,11,12,13,14,15,16,17,17,18,19,20,20,21,21,22,22,23,23,24,25,25,26,27,28,29,30,31,32,33,34,35,36,37,37,38,39,40,41,42,43,44,45,46,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,76,77,78,79,80,81,82,83,84,85,86,87,88,89,91,93,95,96,98,100,101,102,104,106,108,110,112,114,116,118,122,124,126,128,130,132,134,136,138,140,143,145,148,151,154,157),ac_q_lookup=new Array(4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,119,122,125,128,131,134,137,140,143,146,149,152,155,158,161,164,167,170,173,177,181,185,189,193,197,201,205,209,213,217,221,225,229,234,239,245,249,254,259,264,269,274,279,284),kf_y_mode_probs=new Array(145,156,163,128),kf_uv_mode_probs=new Array(142,114,183),kf_b_mode_probs=new Array(new Array(new Array(231,120,48,89,115,113,120,152,112),new Array(152,179,64,126,170,118,46,70,95),new Array(175,69,143,80,85,82,72,155,103),new Array(56,58,10,171,218,189,17,13,152),new Array(144,71,10,38,171,213,144,34,26),new Array(114,26,17,163,44,195,21,10,173),new Array(121,24,80,195,26,62,44,64,85),new Array(170,46,55,19,136,160,33,206,71),new Array(63,20,8,114,114,208,12,9,226),new Array(81,40,11,96,182,84,29,16,36)),new Array(new Array(134,183,89,137,98,101,106,165,148),new Array(72,187,100,130,157,111,32,75,80),new Array(66,102,167,99,74,62,40,234,128),new Array(41,53,9,178,241,141,26,8,107),new Array(104,79,12,27,217,255,87,17,7),new Array(74,43,26,146,73,166,49,23,157),new Array(65,38,105,160,51,52,31,115,128),new Array(87,68,71,44,114,51,15,186,23),new Array(47,41,14,110,182,183,21,17,194),new Array(66,45,25,102,197,189,23,18,22)),new Array(new Array(88,88,147,150,42,46,45,196,205),new Array(43,97,183,117,85,38,35,179,61),new Array(39,53,200,87,26,21,43,232,171),new Array(56,34,51,104,114,102,29,93,77),new Array(107,54,32,26,51,1,81,43,31),new Array(39,28,85,171,58,165,90,98,64),new Array(34,22,116,206,23,34,43,166,73),new Array(68,25,106,22,64,171,36,225,114),new Array(34,19,21,102,132,188,16,76,124),new Array(62,18,78,95,85,57,50,48,51)),new Array(new Array(193,101,35,159,215,111,89,46,111),new Array(60,148,31,172,219,228,21,18,111),new Array(112,113,77,85,179,255,38,120,114),new Array(40,42,1,196,245,209,10,25,109),new Array(100,80,8,43,154,1,51,26,71),new Array(88,43,29,140,166,213,37,43,154),new Array(61,63,30,155,67,45,68,1,209),new Array(142,78,78,16,255,128,34,197,171),new Array(41,40,5,102,211,183,4,1,221),new Array(51,50,17,168,209,192,23,25,82)),new Array(new Array(125,98,42,88,104,85,117,175,82),new Array(95,84,53,89,128,100,113,101,45),new Array(75,79,123,47,51,128,81,171,1),new Array(57,17,5,71,102,57,53,41,49),new Array(115,21,2,10,102,255,166,23,6),new Array(38,33,13,121,57,73,26,1,85),new Array(41,10,67,138,77,110,90,47,114),new Array(101,29,16,10,85,128,101,196,26),new Array(57,18,10,102,102,213,34,20,43),new Array(117,20,15,36,163,128,68,1,26)),new Array(new Array(138,31,36,171,27,166,38,44,229),new Array(67,87,58,169,82,115,26,59,179),new Array(63,59,90,180,59,166,93,73,154),new Array(40,40,21,116,143,209,34,39,175),new Array(57,46,22,24,128,1,54,17,37),new Array(47,15,16,183,34,223,49,45,183),new Array(46,17,33,183,6,98,15,32,183),new Array(65,32,73,115,28,128,23,128,205),new Array(40,3,9,115,51,192,18,6,223),new Array(87,37,9,115,59,77,64,21,47)),new Array(new Array(104,55,44,218,9,54,53,130,226),new Array(64,90,70,205,40,41,23,26,57),new Array(54,57,112,184,5,41,38,166,213),new Array(30,34,26,133,152,116,10,32,134),new Array(75,32,12,51,192,255,160,43,51),new Array(39,19,53,221,26,114,32,73,255),new Array(31,9,65,234,2,15,1,118,73),new Array(88,31,35,67,102,85,55,186,85),new Array(56,21,23,111,59,205,45,37,192),new Array(55,38,70,124,73,102,1,34,98)),new Array(new Array(102,61,71,37,34,53,31,243,192),new Array(69,60,71,38,73,119,28,222,37),new Array(68,45,128,34,1,47,11,245,171),new Array(62,17,19,70,146,85,55,62,70),new Array(75,15,9,9,64,255,184,119,16),new Array(37,43,37,154,100,163,85,160,1),new Array(63,9,92,136,28,64,32,201,85),new Array(86,6,28,5,64,255,25,248,1),new Array(56,8,17,132,137,255,55,116,128),new Array(58,15,20,82,135,57,26,121,40)),new Array(new Array(164,50,31,137,154,133,25,35,218),new Array(51,103,44,131,131,123,31,6,158),new Array(86,40,64,135,148,224,45,183,128),new Array(22,26,17,131,240,154,14,1,209),new Array(83,12,13,54,192,255,68,47,28),new Array(45,16,21,91,64,222,7,1,197),new Array(56,21,39,155,60,138,23,102,213),new Array(85,26,85,85,128,128,32,146,171),new Array(18,11,7,63,144,171,4,4,246),new Array(35,27,10,146,174,171,12,26,128)),new Array(new Array(190,80,35,99,180,80,126,54,45),new Array(85,126,47,87,176,51,41,20,32),new Array(101,75,128,139,118,146,116,128,85),new Array(56,41,15,176,236,85,37,9,62),new Array(146,36,19,30,171,255,97,27,20),new Array(71,30,17,119,118,255,17,18,138),new Array(101,38,60,138,55,70,43,26,142),new Array(138,45,61,62,219,1,81,188,64),new Array(32,41,20,117,151,142,20,21,163),new Array(112,19,12,61,195,128,48,4,24))),kf_y_mode_tree=new Array(-B_PRED,2,4,6,-DC_PRED,-V_PRED,-H_PRED,-TM_PRED),y_mode_tree=new Array(-DC_PRED,2,4,6,-V_PRED,-H_PRED,-TM_PRED,-B_PRED),uv_mode_tree=new Array(-DC_PRED,2,-V_PRED,4,-H_PRED,-TM_PRED),b_mode_tree=new Array(-B_DC_PRED,2,-B_TM_PRED,4,-B_VE_PRED,6,8,12,-B_HE_PRED,10,-B_RD_PRED,-B_VR_PRED,-B_LD_PRED,14,-B_VL_PRED,16,-B_HD_PRED,-B_HU_PRED),small_mv_tree=new Array(2,8,4,6,-0,-1,-2,-3,10,12,-4,-5,-6,-7),mv_ref_tree=new Array(-ZEROMV,2,-NEARESTMV,4,-NEARMV,6,-NEWMV,-SPLITMV),submv_ref_tree=new Array(-LEFT4X4,2,-ABOVE4X4,4,-ZERO4X4,-NEW4X4),split_mv_tree=new Array(-3,2,-2,4,-0,-1),default_b_mode_probs=new Array(120,90,79,133,87,85,80,111,151),mv_counts_to_probs=new Array(new Array(7,1,1,143),new Array(14,18,14,107),new Array(135,64,57,68),new Array(60,56,128,65),new Array(159,134,128,34),new Array(234,188,128,28)),split_mv_probs=new Array(110,111,150),submv_ref_probs2=new Array(new Array(147,136,18),new Array(106,145,1),new Array(179,121,1),new Array(223,1,34),new Array(208,1,1)),mv_partitions=new Array(new Array(0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1),new Array(0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1),new Array(0,0,1,1,0,0,1,1,2,2,3,3,2,2,3,3),new Array(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15)),mv_clamp_rect=function(){this.to_left=int_,this.to_right=int_,this.to_top=int_,this.to_bottom=int_};function clamp_mv(_,e){var r=new mv;return r.d.x=_.d.x<e.to_left?e.to_left:_.d.x,r.d.x=_.d.x>e.to_right?e.to_right:r.d.x,r.d.y=_.d.y<e.to_top?e.to_top:_.d.y,r.d.y=_.d.y>e.to_bottom?e.to_bottom:r.d.y,r}function read_segment_id(_,e){return bool_get(_,e.tree_probs[0])?2+bool_get(_,e.tree_probs[2]):bool_get(_,e.tree_probs[1])}function above_block_mode(_,e,r){if(r<4)switch(e.base.y_mode){case DC_PRED:return B_DC_PRED;case V_PRED:return B_VE_PRED;case H_PRED:return B_HE_PRED;case TM_PRED:return B_TM_PRED;case B_PRED:return e.splitt.mvs[r+12].d.x;default:assert(0)}return _.splitt.mvs[r-4].d.x}function left_block_mode(_,e,r){if(!(3&r))switch(e.base.y_mode){case DC_PRED:return B_DC_PRED;case V_PRED:return B_VE_PRED;case H_PRED:return B_HE_PRED;case TM_PRED:return B_TM_PRED;case B_PRED:return e.splitt.mvs[r+3].d.x;default:assert(0)}return _.splitt.mvs[r-1].d.x}function decode_kf_mb_mode(_,e,r,t,n,i,a){var o,s;if((o=bool_read_tree(a,kf_y_mode_tree,kf_y_mode_probs))==B_PRED){var f=int_;for(f=0;f<16;f++){var d,E=above_block_mode(_[e],n[i],f),c=left_block_mode(_[e],r[t],f);d=bool_read_tree(a,b_mode_tree,kf_b_mode_probs[E][c]),_[e].splitt.modes[f]=_[e].splitt.mvs[f].d.x=d,_[e].splitt.mvs[f].d.y=0}}s=bool_read_tree(a,uv_mode_tree,kf_uv_mode_probs),_[e].base.y_mode=o,_[e].base.uv_mode=s,_[e].base.mv.d.x=_[e].base.mv.d.y=0,_[e].base.ref_frame=0}function decode_intra_mb_mode(_,e,r){var t,n;if((t=bool_read_tree(r,y_mode_tree,e.y_mode_probs))==B_PRED){var i=int_;for(i=0;i<16;i++){var a;a=bool_read_tree(r,b_mode_tree,default_b_mode_probs),_.splitt.modes[i]=_.splitt.mvs[i].d.x=a,_.splitt.mvs[i].d.y=0}}n=bool_read_tree(r,uv_mode_tree,e.uv_mode_probs),_.base.y_mode=t,_.base.uv_mode=n,_.base.mv.d.x=_.base.mv.d.y=0,_.base.ref_frame=CURRENT_FRAME}function read_mv_component(_,e){var r=0;if(bool_get(_,e[0])){var t=0;for(t=0;t<3;t++)r+=bool_get(_,e[9+t])<<t;for(t=9;t>3;t--)r+=bool_get(_,e[9+t])<<t;65520&r&&!bool_get(_,e[12])||(r+=8)}else r=bool_read_tree(_,small_mv_tree,e,2);return r&&bool_get(_,e[1])&&(r=-r),r<<1}function above_block_mv(_,e,r){return r<4?e.base.y_mode==SPLITMV?e.splitt.mvs[r+12]:e.base.mv:_.splitt.mvs[r-4]}function left_block_mv(_,e,r){return 3&r?_.splitt.mvs[r-1]:e.base.y_mode==SPLITMV?e.splitt.mvs[r+3]:e.base.mv}function submv_ref(_,e,r){var t=!(e.d.x||e.d.y)+0,n=!(r.d.x||r.d.y)+0,i=(e.d.x==r.d.x&&e.d.y==r.d.y)+0,a=0;return i&&t?a=4:i?a=3:n?a=2:t&&(a=1),bool_read_tree(_,submv_ref_tree,submv_ref_probs2[a])}function read_mv(_,e,r){e.d.y=read_mv_component(_,r[0]),e.d.x=read_mv_component(_,r[1])}function mv_bias(_,e,r,t){e[_.base.ref_frame]^e[r]&&(t.d.x*=-1,t.d.y*=-1)}var CNT_BEST=0,CNT_ZEROZERO=0,CNT_NEAREST=1,CNT_NEAR=2,CNT_SPLITMV=3,this_mv_1=new mv,this_mv_2=new mv;function find_near_mvs(_,e,r,t,n,i,a,o){var s=t,f=n-1,d=a,E=0,c=o,l=0;d[0].d.x=d[1].d.x=d[2].d.x=0,d[0].d.y=d[1].d.y=d[2].d.y=0,o[0]=o[1]=o[2]=o[3]=0;var m,A=t[n],u=e[r],p=s[f];(A.base.ref_frame!=CURRENT_FRAME&&((A.base.mv.d.x||A.base.mv.d.y)&&(d[++E].d.x=A.base.mv.d.x,d[E].d.y=A.base.mv.d.y,mv_bias(A,i,_.base.ref_frame,d[E]),++l),c[l]+=2),u.base.ref_frame!=CURRENT_FRAME)&&(u.base.mv.d.x||u.base.mv.d.y?((m=this_mv_1).d.x=u.base.mv.d.x,m.d.y=u.base.mv.d.y,mv_bias(u,i,_.base.ref_frame,m),m.d.x==d[E].d.x&&m.d.y==d[E].d.y||(d[++E].d.x=m.d.x,d[E].d.y=m.d.y,++l),c[l]+=2):o[CNT_ZEROZERO]+=2);p.base.ref_frame!=CURRENT_FRAME&&(p.base.mv.d.x||p.base.mv.d.y?((m=this_mv_2).d.x=p.base.mv.d.x,m.d.y=p.base.mv.d.y,mv_bias(p,i,_.base.ref_frame,m),m.d.x==d[E].d.x&&m.d.y==d[E].d.y||(d[++E].d.x=m.d.x,d[E].d.y=m.d.y,++l),c[l]+=1):o[CNT_ZEROZERO]+=1);if(o[CNT_SPLITMV]&&d[E].d.x==a[CNT_NEAREST].d.x&&d[E].d.y==a[CNT_NEAREST].d.y&&(o[CNT_NEAREST]+=1),o[CNT_SPLITMV]=2*((A.base.y_mode==SPLITMV)+(u.base.y_mode==SPLITMV))+(p.base.y_mode==SPLITMV),o[CNT_NEAR]>o[CNT_NEAREST]){var T,y=int_;y=o[CNT_NEAREST],o[CNT_NEAREST]=o[CNT_NEAR],o[CNT_NEAR]=y,y=a[CNT_NEAREST].d.x,T=a[CNT_NEAREST].d.y,a[CNT_NEAREST].d.x=a[CNT_NEAR].d.x,a[CNT_NEAREST].d.y=a[CNT_NEAR].d.y,a[CNT_NEAR].d.x=y,a[CNT_NEAR].d.y=T}o[CNT_NEAREST]>=o[CNT_BEST]&&(a[CNT_BEST].d.x=a[CNT_NEAREST].d.x,a[CNT_BEST].d.y=a[CNT_NEAREST].d.y)}function decode_split_mv(_,e,r,t,n,i){var a,o,s=int_,f=int_,d=int_;for(o=bool_read_tree(i,split_mv_tree,split_mv_probs),a=mv_partitions[o],_.base.partitioning=o,s=0,d=0;d<65535;s++){var E,c,l=new mv;for(f=0;s!=a[f];f++);switch(submv_ref(i,E=left_block_mv(_,e,f),c=above_block_mv(_,r,f))){case LEFT4X4:l=E;break;case ABOVE4X4:l=c;break;case ZERO4X4:l.d.x=l.d.y=0;break;case NEW4X4:read_mv(i,l,t.mv_probs),l.d.x+=n.d.x,l.d.y+=n.d.y;break;default:assert(0)}for(;f<16;f++)s==a[f]&&(_.splitt.mvs[f].d.x=l.d.x,_.splitt.mvs[f].d.y=l.d.y,d|=1<<f)}}function need_mc_border(_,e,r,t,n,i){return e+=_.d.x>>3,r+=_.d.y>>3,e>>1<2||n-(e+t)>>1<3||r>>1<2||i-(r+t)>>1<3}var near_mvs_4=Arr_new(4,mv),mv_cnts_4=new Array(0,0,0,0),probs_4=new Array(0,0,0,0),chroma_mv_4=Arr_new(4,mv),clamped_best_mv_1=new mv;function decode_mvs(_,e,r,t,n,i,a,o,s){var f,d,E,c,l=_.entropy_hdr,m=near_mvs_4,A=clamped_best_mv_1,u=mv_cnts_4,p=probs_4,T=int_;switch(e[r].base.ref_frame=bool_get(s,l.prob_last)?2+bool_get(s,l.prob_gf):1,find_near_mvs(e[r],e,r-1,i,a,_.reference_hdr.sign_bias,m,u),p[0]=mv_counts_to_probs[u[0]][0],p[1]=mv_counts_to_probs[u[1]][1],p[2]=mv_counts_to_probs[u[2]][2],p[3]=mv_counts_to_probs[u[3]][3],(e=e[r]).base.y_mode=bool_read_tree(s,mv_ref_tree,p),e.base.uv_mode=e.base.y_mode,e.base.need_mc_border=0,f=-o.to_left-128>>3,d=-o.to_top-128>>3,E=16*_.mb_cols,c=16*_.mb_rows,e.base.y_mode){case NEARESTMV:e.base.mv=clamp_mv(m[1],o);break;case NEARMV:e.base.mv=clamp_mv(m[2],o);break;case ZEROMV:return void(e.base.mv.d.x=e.base.mv.d.y=0);case NEWMV:A=clamp_mv(m[0],o),read_mv(s,e.base.mv,l.mv_probs),e.base.mv.d.x+=A.d.x,e.base.mv.d.y+=A.d.y;break;case SPLITMV:var y=chroma_mv_4;for(A=clamp_mv(m[0],o),decode_split_mv(e,t[n],i[a],l,A,s),e.base.mv.d.x=e.splitt.mvs[15].d.x,e.base.mv.d.y=e.splitt.mvs[15].d.y,T=0;T<16;T++)if(y[(T>>1&1)+(T>>2&2)].d.x+=e.splitt.mvs[T].d.x,y[(T>>1&1)+(T>>2&2)].d.y+=e.splitt.mvs[T].d.y,need_mc_border(e.splitt.mvs[T],f+4*(3&T),d+(-4&T),4,E,c)){e.base.need_mc_border=1;break}for(T=0;T<4;T++)if(y[T].d.x+=4,y[T].d.y+=4,y[T].d.x>>=2,y[T].d.y>>=2,need_mc_border(y[T],f+8*(1&T),d+8*(T>>1),16,E,c)){e.base.need_mc_border=1;break}return;default:assert(0)}need_mc_border(e.base.mv,f,d,16,E,c)&&(e.base.need_mc_border=1)}var bounds_=new mv_clamp_rect;function vp8_dixie_modemv_process_row(_,e,r,t,n){var i,a,o=0,s=0,f=int_,d=bounds_;for(a=_.mb_info_rows[1+r],s=_.mb_info_rows_off[1+r]+t,i=_.mb_info_rows[1+r-1],o=_.mb_info_rows_off[1+r-1]+t,d.to_left=-(t+1<<7),d.to_right=_.mb_cols-t<<7,d.to_top=-(r+1<<7),d.to_bottom=_.mb_rows-r<<7,f=t;f<t+n;f++)_.segment_hdr.update_map&&(a[s].base.segment_id=read_segment_id(e,_.segment_hdr)),_.entropy_hdr.coeff_skip_enabled&&(a[s].base.skip_coeff=bool_get(e,_.entropy_hdr.coeff_skip_prob)),_.frame_hdr.is_keyframe?(_.segment_hdr.update_map||(a[s].base.segment_id=0),decode_kf_mb_mode(a,s,a,s-1,i,o,e)):(bool_get(e,_.entropy_hdr.prob_inter)?decode_mvs(_,a,s,a,s-1,i,o,d,e):decode_intra_mb_mode(a[s],_.entropy_hdr,e),d.to_left-=128,d.to_right-=128),s++,o++}function vp8_dixie_modemv_init(_){var e,r,t=int_,n=new mb_info,i=0;for(e=_.mb_cols+1,r=_.mb_rows+1,_.frame_hdr.frame_size_updated&&(_.mb_info_storage=null,_.mb_info_rows_storage=null),_.mb_info_storage||(_.mb_info_storage=Arr_new(e*r,_.mb_info_storage_object),_.mb_info_storage_off=0),_.mb_info_rows_storage||(_.mb_info_rows_storage=Arr_new(r,_.mb_info_rows_storage_object),_.mb_info_rows_storage_off=new Array(r)),n=_.mb_info_storage,i=_.mb_info_storage_off+1,t=0;t<r;t++)_.mb_info_rows_storage[t]=n,_.mb_info_rows_storage_off[t]=i,i+=e;_.mb_info_rows=_.mb_info_rows_storage,_.mb_info_rows_off=_.mb_info_rows_storage_off}var EOB_CONTEXT_NODE=0,ZERO_CONTEXT_NODE=1,ONE_CONTEXT_NODE=2,LOW_VAL_CONTEXT_NODE=3,TWO_CONTEXT_NODE=4,THREE_CONTEXT_NODE=5,HIGH_LOW_CONTEXT_NODE=6,CAT_ONE_CONTEXT_NODE=7,CAT_THREEFOUR_CONTEXT_NODE=8,CAT_THREE_CONTEXT_NODE=9,CAT_FIVE_CONTEXT_NODE=10,ZERO_TOKEN=0,ONE_TOKEN=1,TWO_TOKEN=2,THREE_TOKEN=3,FOUR_TOKEN=4,DCT_VAL_CATEGORY1=5,DCT_VAL_CATEGORY2=6,DCT_VAL_CATEGORY3=7,DCT_VAL_CATEGORY4=8,DCT_VAL_CATEGORY5=9,DCT_VAL_CATEGORY6=10,DCT_EOB_TOKEN=11,MAX_ENTROPY_TOKENS=12,left_context_index=new Array(0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,5,5,6,6,7,7,8),above_context_index=new Array(0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3,4,5,4,5,6,7,6,7,8);function X(_){return _*PREV_COEF_CONTEXTS*ENTROPY_NODES}var bands_x=new Array(X(0),X(1),X(2),X(3),X(6),X(4),X(5),X(6),X(6),X(6),X(6),X(6),X(6),X(6),X(6),X(7)),extrabits=new Array({min_val:0,length:-1,probs:new Array(0,0,0,0,0,0,0,0,0,0,0,0)},{min_val:1,length:0,probs:new Array(0,0,0,0,0,0,0,0,0,0,0,0)},{min_val:2,length:0,probs:new Array(0,0,0,0,0,0,0,0,0,0,0,0)},{min_val:3,length:0,probs:new Array(0,0,0,0,0,0,0,0,0,0,0,0)},{min_val:4,length:0,probs:new Array(0,0,0,0,0,0,0,0,0,0,0,0)},{min_val:5,length:0,probs:new Array(159,0,0,0,0,0,0,0,0,0,0,0)},{min_val:7,length:1,probs:new Array(145,165,0,0,0,0,0,0,0,0,0,0)},{min_val:11,length:2,probs:new Array(140,148,173,0,0,0,0,0,0,0,0,0)},{min_val:19,length:3,probs:new Array(135,140,155,176,0,0,0,0,0,0,0,0)},{min_val:35,length:4,probs:new Array(130,134,141,157,180,0,0,0,0,0,0,0)},{min_val:67,length:10,probs:new Array(129,130,133,140,153,177,196,230,243,254,254,0)},{min_val:0,length:-1,probs:new Array(0,0,0,0,0,0,0,0,0,0,0,0)}),zigzag=new Array(0,1,4,8,5,2,3,6,9,12,13,10,7,11,14,15),BLOCK_LOOP=0,DO_WHILE=1,CHECK_0_=2,CAT_FIVE_CONTEXT_NODE_0_=3,CAT_THREEFOUR_CONTEXT_NODE_0_=4,CAT_THREE_CONTEXT_NODE_0_=5,HIGH_LOW_CONTEXT_NODE_0_=6,CAT_ONE_CONTEXT_NODE_0_=7,LOW_VAL_CONTEXT_NODE_0_=8,THREE_CONTEXT_NODE_0_=9,TWO_CONTEXT_NODE_0_=10,ONE_CONTEXT_NODE_0_=11,BLOCK_FINISHED=12,END=13;function decode_mb_tokens(_,e,r,t,n,i,a,o){function s(e){y=(bool_get_bit(_)?-e:e)*P[!!p+0]}function f(e,r){if(!bool_get(_,e))return g=r,1}function d(e,r){if(!bool_get(_,e))return D=R,p<15?(++p,D+=bands_x[p],g=r,1):(g=BLOCK_FINISHED,1)}function E(_){return s(_),D=R+2*ENTROPY_NODES,p<15?(w[I+zigzag[p]]=y,++p,g=DO_WHILE,1):(w[I+zigzag[15]]=y,g=BLOCK_FINISHED,1)}function c(e,r){b+=bool_get(_,extrabits[e].probs[r])<<r}var l,m=int_,A=int_,u=int_,p=int_,T=int_,y=int_,b=int_,v=int_,h=int_,w=short_,I=0,R=0,N=char_,D=0,P=short_;h=0,i!=B_PRED&&i!=SPLITMV?(m=24,A=24,u=1,w=t,I=n+384,P=o[TOKEN_BLOCK_Y2]):(m=0,A=16,u=3,w=t,I=n,P=o[TOKEN_BLOCK_Y1]),l=a,R=u*COEF_BANDS*PREV_COEF_CONTEXTS*ENTROPY_NODES;var g=BLOCK_LOOP;do{if(g==BLOCK_LOOP&&(T=e[left_context_index[m]]+r[above_context_index[m]],p=!u+0,N=l,D=R,D+=T*ENTROPY_NODES,g=DO_WHILE),g==DO_WHILE){if(f(N[(D+=bands_x[p])+EOB_CONTEXT_NODE],BLOCK_FINISHED))continue;g=CHECK_0_}if(g==CHECK_0_){if(d(N[D+ZERO_CONTEXT_NODE],CHECK_0_))continue;if(f(N[D+ONE_CONTEXT_NODE],ONE_CONTEXT_NODE_0_))continue;if(f(N[D+LOW_VAL_CONTEXT_NODE],LOW_VAL_CONTEXT_NODE_0_))continue;if(f(N[D+HIGH_LOW_CONTEXT_NODE],HIGH_LOW_CONTEXT_NODE_0_))continue;if(f(N[D+CAT_THREEFOUR_CONTEXT_NODE],CAT_THREEFOUR_CONTEXT_NODE_0_))continue;if(f(N[D+CAT_FIVE_CONTEXT_NODE],CAT_FIVE_CONTEXT_NODE_0_))continue;b=extrabits[DCT_VAL_CATEGORY6].min_val,v=extrabits[DCT_VAL_CATEGORY6].length;do{c(DCT_VAL_CATEGORY6,v),v--}while(v>=0);if(E(b))continue}if(g!=CAT_FIVE_CONTEXT_NODE_0_||(b=extrabits[DCT_VAL_CATEGORY5].min_val,c(DCT_VAL_CATEGORY5,4),c(DCT_VAL_CATEGORY5,3),c(DCT_VAL_CATEGORY5,2),c(DCT_VAL_CATEGORY5,1),c(DCT_VAL_CATEGORY5,0),!E(b))){if(g==CAT_THREEFOUR_CONTEXT_NODE_0_){if(f(N[D+CAT_THREE_CONTEXT_NODE],CAT_THREE_CONTEXT_NODE_0_))continue;if(b=extrabits[DCT_VAL_CATEGORY4].min_val,c(DCT_VAL_CATEGORY4,3),c(DCT_VAL_CATEGORY4,2),c(DCT_VAL_CATEGORY4,1),c(DCT_VAL_CATEGORY4,0),E(b))continue}if(g!=CAT_THREE_CONTEXT_NODE_0_||(b=extrabits[DCT_VAL_CATEGORY3].min_val,c(DCT_VAL_CATEGORY3,2),c(DCT_VAL_CATEGORY3,1),c(DCT_VAL_CATEGORY3,0),!E(b))){if(g==HIGH_LOW_CONTEXT_NODE_0_){if(f(N[D+CAT_ONE_CONTEXT_NODE],CAT_ONE_CONTEXT_NODE_0_))continue;if(b=extrabits[DCT_VAL_CATEGORY2].min_val,c(DCT_VAL_CATEGORY2,1),c(DCT_VAL_CATEGORY2,0),E(b))continue}if(g!=CAT_ONE_CONTEXT_NODE_0_||(b=extrabits[DCT_VAL_CATEGORY1].min_val,c(DCT_VAL_CATEGORY1,0),!E(b))){if(g==LOW_VAL_CONTEXT_NODE_0_){if(f(N[D+TWO_CONTEXT_NODE],TWO_CONTEXT_NODE_0_))continue;if(f(N[D+THREE_CONTEXT_NODE],THREE_CONTEXT_NODE_0_))continue;if(E(4))continue}if(!(g==THREE_CONTEXT_NODE_0_&&E(3)||g==TWO_CONTEXT_NODE_0_&&E(2))){if(g==ONE_CONTEXT_NODE_0_){if(s(1),D=R+ENTROPY_NODES,p<15){w[I+zigzag[p]]=y,++p,g=DO_WHILE;continue}w[I+zigzag[15]]=y,g=BLOCK_FINISHED}if(g==BLOCK_FINISHED){if(h=((h=(h|(p>1)+0<<m)>>>0)|(T=(p!=!u)+0)<<31)>>>0,e[left_context_index[m]]=r[above_context_index[m]]=T,I+=16,++m<A){g=BLOCK_LOOP;continue}if(25==m){m=0,A=16,R=(u=0)*COEF_BANDS*PREV_COEF_CONTEXTS*ENTROPY_NODES,I=n,P=o[TOKEN_BLOCK_Y1],g=BLOCK_LOOP;continue}if(16==m){R=(u=2)*COEF_BANDS*PREV_COEF_CONTEXTS*ENTROPY_NODES,A=24,P=o[TOKEN_BLOCK_UV],g=BLOCK_LOOP;continue}}g=END}}}}}while(g!=END);return h}function reset_row_context(_){memset(_,0,0,_.length)}function reset_above_context(_,e){var r=0;for(r=0;r<e;++r)memset(_[r],0,0,_[r].length)}function reset_mb_context(_,e,r){memset(_,0,0,8),memset(e,0,0,8),r!=B_PRED&&r!=SPLITMV&&(_[8]=0,e[8]=0)}function vp8_dixie_tokens_process_row(_,e,r,t,n){var i=_.tokens[e],a=i.coeffs,o=400*t,s=int_,f=_.above_token_entropy_ctx,d=+t,E=i.left_token_entropy_ctx,c=_.mb_info_rows[1+r],l=_.mb_info_rows_off[1+r]+t;for(0==r&&reset_above_context(f,n),0==t&&reset_row_context(E),s=t;s<t+n;s++){if(memset(a,o,0,400),c[l].base.skip_coeff)reset_mb_context(E,f[d],c[l].base.y_mode),c[l].base.eob_mask=0;else{var m,A;m=_.dequant_factors,A=+c[l].base.segment_id,c[l].base.eob_mask=decode_mb_tokens(i.bool,E,f[d],a,o,c[l].base.y_mode,_.entropy_hdr.coeff_probs_,m[A].factor)}d++,l++,o+=400}}function vp8_dixie_tokens_init(_){var e=_.token_hdr.partitions;if(_.frame_hdr.frame_size_updated){var r=int_,t=25*_.mb_cols*16;for(r=0;r<e;r++)_.tokens[r].coeffs=new Array(t),_.tokens[r].coeffs||vpx_internal_error(_.error,VPX_CODEC_MEM_ERROR,null);_.above_token_entropy_ctx=Arr_new(_.mb_cols,_.above_token_entropy_ctx_object),_.above_token_entropy_ctx||vpx_internal_error(_.error,VPX_CODEC_MEM_ERROR,null)}}function ABS(_){return _>=0?_:-_}function saturate_int8(_){return _<-128?-128:_>127?127:_}function saturate_uint8(_){return _<0?0:_>255?255:_}function high_edge_variance(_,e,r,t){var n=_[e-2*r],i=_[e-1*r],a=_[e+0*r],o=_[e+1*r];return ABS(n-i)>t||ABS(o-a)>t}function simple_threshold(_,e,r,t){var n=_[e-2*r],i=_[e-1*r],a=_[e+0*r],o=_[e+1*r];return 2*ABS(i-a)+(ABS(n-o)>>1)<=t}function normal_threshold(_,e,r,t,n){var i=_[e-4*r],a=_[e-3*r],o=_[e-2*r],s=_[e-1*r],f=_[e+0*r],d=_[e+1*r],E=_[e+2*r],c=_[e+3*r],l=n;return simple_threshold(_,e,r,2*t+l)&&ABS(i-a)<=l&&ABS(a-o)<=l&&ABS(o-s)<=l&&ABS(c-E)<=l&&ABS(E-d)<=l&&ABS(d-f)<=l}function filter_common(_,e,r,t){var n,i=_[e-2*r],a=_[e-1*r],o=_[e+0*r],s=_[e+1*r],f=int_;f=3*(o-a),t&&(f+=saturate_int8(i-s)),n=((f=saturate_int8(f))+4>127?127:f+4)>>3,a=saturate_uint8(a+((f+3>127?127:f+3)>>3)),o=saturate_uint8(o-n),t||(i=saturate_uint8(i+(f=n+1>>1)),s=saturate_uint8(s-f)),_[e-2*r]=i,_[e-1*r]=a,_[e+0*r]=o,_[e+1*r]=s}function filter_mb_edge(_,e,r){var t,n=_[e-3*r],i=_[e-2*r],a=_[e-1*r],o=_[e+0*r],s=_[e+1*r],f=_[e+2*r],d=int_;a=saturate_uint8(a+(d=27*(t=saturate_int8(saturate_int8(i-s)+3*(o-a)))+63>>7)),o=saturate_uint8(o-d),i=saturate_uint8(i+(d=18*t+63>>7)),s=saturate_uint8(s-d),n=saturate_uint8(n+(d=9*t+63>>7)),f=saturate_uint8(f-d),_[e-3*r]=n,_[e-2*r]=i,_[e-1*r]=a,_[e+0*r]=o,_[e+1*r]=s,_[e+2*r]=f}function filter_mb_v_edge(_,e,r,t,n,i,a){var o=int_;for(o=0;o<8*a;o++)normal_threshold(_,e,1,t,n)&&(high_edge_variance(_,e,1,i)?filter_common(_,e,1,1):filter_mb_edge(_,e,1)),e+=r}function filter_subblock_v_edge(_,e,r,t,n,i,a){var o=int_;for(o=0;o<8*a;o++)normal_threshold(_,e,1,t,n)&&filter_common(_,e,1,high_edge_variance(_,e,1,i)),e+=r}function filter_mb_h_edge(_,e,r,t,n,i,a){var o=int_;for(o=0;o<8*a;o++)normal_threshold(_,e,r,t,n)&&(high_edge_variance(_,e,r,i)?filter_common(_,e,r,1):filter_mb_edge(_,e,r)),e+=1}function filter_subblock_h_edge(_,e,r,t,n,i,a){var o=int_;for(o=0;o<8*a;o++)normal_threshold(_,e,r,t,n)&&filter_common(_,e,r,high_edge_variance(_,e,r,i)),e+=1}function filter_v_edge_simple(_,e,r,t){var n=int_;for(n=0;n<16;n++)simple_threshold(_,e,1,t)&&filter_common(_,e,1,1),e+=r}function filter_h_edge_simple(_,e,r,t){var n=int_;for(n=0;n<16;n++)simple_threshold(_,e,r,t)&&filter_common(_,e,r,1),e+=1}function calculate_filter_parameters(_,e,r,t,n){var i=int_,a=int_,o=int_;i=_.loopfilter_hdr.level,_.segment_hdr.enabled&&(_.segment_hdr.abs_?i=_.segment_hdr.lf_level[e.base.segment_id]:i+=_.segment_hdr.lf_level[e.base.segment_id]),_.loopfilter_hdr.delta_enabled&&(i+=_.loopfilter_hdr.ref_delta[e.base.ref_frame],e.base.ref_frame==CURRENT_FRAME?e.base.y_mode==B_PRED&&(i+=_.loopfilter_hdr.mode_delta[0]):e.base.y_mode==ZEROMV?i+=_.loopfilter_hdr.mode_delta[1]:e.base.y_mode==SPLITMV?i+=_.loopfilter_hdr.mode_delta[3]:i+=_.loopfilter_hdr.mode_delta[2]),i>63?i=63:i<0&&(i=0),a=i,_.loopfilter_hdr.sharpness&&(a>>=_.loopfilter_hdr.sharpness>4?2:1)>9-_.loopfilter_hdr.sharpness&&(a=9-_.loopfilter_hdr.sharpness),a<1&&(a=1),o=i>=15,i>=40&&o++,i>=20&&!_.frame_hdr.is_keyframe&&o++,r[0]=i,t[0]=a,n[0]=o}function filter_row_normal(_,e,r,t){var n,i,a,o,s,f,d=0,E=0,c=0,l=0,m=int_;for(o=_.ref_frames[CURRENT_FRAME].img.stride[PLANE_Y],s=_.ref_frames[CURRENT_FRAME].img.stride[PLANE_U],n=_.ref_frames[CURRENT_FRAME].img.planes[PLANE_Y],d=_.ref_frames[CURRENT_FRAME].img.planes_off[PLANE_Y],i=_.ref_frames[CURRENT_FRAME].img.planes[PLANE_U],E=_.ref_frames[CURRENT_FRAME].img.planes_off[PLANE_U],a=_.ref_frames[CURRENT_FRAME].img.planes[PLANE_V],c=_.ref_frames[CURRENT_FRAME].img.planes_off[PLANE_V],d+=16*(o*e+r),E+=8*(s*e+r),c+=8*(s*e+r),f=_.mb_info_rows[1+e],l=_.mb_info_rows_off[1+e]+r,m=r;m<r+t;m++){var A=[int_],u=[int_],p=[int_];calculate_filter_parameters(_,f[l],A,u,p),A=A[0],u=u[0],p=p[0],A&&(m&&(filter_mb_v_edge(n,d,o,A+2,u,p,2),filter_mb_v_edge(i,E,s,A+2,u,p,1),filter_mb_v_edge(a,c,s,A+2,u,p,1)),(f[l].base.eob_mask||f[l].base.y_mode==SPLITMV||f[l].base.y_mode==B_PRED)&&(filter_subblock_v_edge(n,d+4,o,A,u,p,2),filter_subblock_v_edge(n,d+8,o,A,u,p,2),filter_subblock_v_edge(n,d+12,o,A,u,p,2),filter_subblock_v_edge(i,E+4,s,A,u,p,1),filter_subblock_v_edge(a,c+4,s,A,u,p,1)),e&&(filter_mb_h_edge(n,d,o,A+2,u,p,2),filter_mb_h_edge(i,E,s,A+2,u,p,1),filter_mb_h_edge(a,c,s,A+2,u,p,1)),(f[l].base.eob_mask||f[l].base.y_mode==SPLITMV||f[l].base.y_mode==B_PRED)&&(filter_subblock_h_edge(n,d+4*o,o,A,u,p,2),filter_subblock_h_edge(n,d+8*o,o,A,u,p,2),filter_subblock_h_edge(n,d+12*o,o,A,u,p,2),filter_subblock_h_edge(i,E+4*s,s,A,u,p,1),filter_subblock_h_edge(a,c+4*s,s,A,u,p,1))),d+=16,E+=8,c+=8,l++}}function filter_row_simple(_,e,r,t){var n,i,a,o=0,s=0,f=int_;for(i=_.ref_frames[CURRENT_FRAME].img.stride[PLANE_Y],n=_.ref_frames[CURRENT_FRAME].img.planes[PLANE_Y],o=_.ref_frames[CURRENT_FRAME].img.planes_off[PLANE_Y],o+=16*(i*e+r),a=_.mb_info_rows[1+e],s=_.mb_info_rows_off[1+e]+r,f=r;f<r+t;f++){var d=[int_],E=[int_],c=[int_];if(calculate_filter_parameters(_,a[s],d,E,c),d[0]){var l=(a[s].base.eob_mask||a[s].base.y_mode==SPLITMV||a[s].base.y_mode==B_PRED)+0,m=2*(d[0]+2)+E[0],A=2*d[0]+E[0];f&&filter_v_edge_simple(n,o,i,m),l&&(filter_v_edge_simple(n,o+4,i,A),filter_v_edge_simple(n,o+8,i,A),filter_v_edge_simple(n,o+12,i,A)),e&&filter_h_edge_simple(n,o,i,m),l&&(filter_h_edge_simple(n,o+4*i,i,A),filter_h_edge_simple(n,o+8*i,i,A),filter_h_edge_simple(n,o+12*i,i,A))}o+=16,s++}}function vp8_dixie_loopfilter_process_row(_,e,r,t){_.loopfilter_hdr.use_simple?filter_row_simple(_,e,r,t):filter_row_normal(_,e,r,t)}var BORDER_PIXELS=16,sixtap_filters=new Array(new Array(0,0,128,0,0,0),new Array(0,-6,123,12,-1,0),new Array(2,-11,108,36,-8,1),new Array(0,-9,93,50,-6,0),new Array(3,-16,77,77,-16,3),new Array(0,-6,50,93,-9,0),new Array(1,-8,36,108,-11,2),new Array(0,-1,12,123,-6,0)),bilinear_filters=new Array(new Array(0,0,128,0,0,0),new Array(0,0,112,16,0,0),new Array(0,0,96,32,0,0),new Array(0,0,80,48,0,0),new Array(0,0,64,64,0,0),new Array(0,0,48,80,0,0),new Array(0,0,32,96,0,0),new Array(0,0,16,112,0,0));function predict_h_nxn(_,e,r,t){var n=_,i=e-1,a=int_,o=int_;for(a=0;a<t;a++)for(o=0;o<t;o++)_[e+a*r+o]=n[i+a*r]}function predict_v_nxn(_,e,r,t){var n=_,i=e-r,a=int_,o=int_;for(a=0;a<t;a++)for(o=0;o<t;o++)_[e+a*r+o]=n[i+o]}function predict_tm_nxn(_,e,r,t){var n=_,i=e-1,a=_,o=e-r,s=a[o-1],f=int_,d=int_;for(d=0;d<t;d++){for(f=0;f<t;f++)_[e+f]=CLAMP_255(n[i]+a[o+f]-s);e+=r,i+=r}}function predict_dc_nxn(_,e,r,t){var n=_,i=e-1,a=_,o=e-r,s=int_,f=int_,d=0;for(s=0;s<t;s++)d+=n[i]+a[o+s],i+=r;switch(t){case 16:d=d+16>>5;break;case 8:d=d+8>>4;break;case 4:d=d+4>>3}for(s=0;s<t;s++)for(f=0;f<t;f++)_[e+s*r+f]=d}function predict_ve_4x4(_,e,r){var t=_,n=e-r,i=int_,a=int_;for(_[e+0]=t[n-1]+2*t[n+0]+t[n+1]+2>>2,_[e+1]=t[n+0]+2*t[n+1]+t[n+2]+2>>2,_[e+2]=t[n+1]+2*t[n+2]+t[n+3]+2>>2,_[e+3]=t[n+2]+2*t[n+3]+t[n+4]+2>>2,i=1;i<4;i++)for(a=0;a<4;a++)_[e+i*r+a]=_[e+a]}function predict_he_4x4(_,e,r){var t=_,n=e-1;_[e+0]=_[e+1]=_[e+2]=_[e+3]=t[n-r]+2*t[n+0]+t[n+r]+2>>2,n+=r,_[(e+=r)+0]=_[e+1]=_[e+2]=_[e+3]=t[n-r]+2*t[n+0]+t[n+r]+2>>2,n+=r,_[(e+=r)+0]=_[e+1]=_[e+2]=_[e+3]=t[n-r]+2*t[n+0]+t[n+r]+2>>2,n+=r,_[(e+=r)+0]=_[e+1]=_[e+2]=_[e+3]=t[n-r]+2*t[n+0]+t[n+0]+2>>2}function predict_ld_4x4(_,e,r){var t,n,i,a,o,s=_,f=e-r;_[e+0]=s[f+0]+2*s[f+1]+s[f+2]+2>>2,_[e+1]=t=s[f+1]+2*s[f+2]+s[f+3]+2>>2,_[e+2]=n=s[f+2]+2*s[f+3]+s[f+4]+2>>2,_[e+3]=i=s[f+3]+2*s[f+4]+s[f+5]+2>>2,_[(e+=r)+0]=t,_[e+1]=n,_[e+2]=i,_[e+3]=a=s[f+4]+2*s[f+5]+s[f+6]+2>>2,_[(e+=r)+0]=n,_[e+1]=i,_[e+2]=a,_[e+3]=o=s[f+5]+2*s[f+6]+s[f+7]+2>>2,_[(e+=r)+0]=i,_[e+1]=a,_[e+2]=o,_[e+3]=s[f+6]+2*s[f+7]+s[f+7]+2>>2}function predict_rd_4x4(_,e,r){var t,n,i,a,o,s=_,f=e-1,d=_,E=e-r;_[e+0]=t=s[f+0]+2*d[E-1]+d[E+0]+2>>2,_[e+1]=n=d[E-1]+2*d[E+0]+d[E+1]+2>>2,_[e+2]=i=d[E+0]+2*d[E+1]+d[E+2]+2>>2,_[e+3]=d[E+1]+2*d[E+2]+d[E+3]+2>>2,_[(e+=r)+0]=a=s[f+r]+2*s[f+0]+d[E-1]+2>>2,_[e+1]=t,_[e+2]=n,_[e+3]=i,_[(e+=r)+0]=o=s[f+2*r]+2*s[f+r]+s[f+0]+2>>2,_[e+1]=a,_[e+2]=t,_[e+3]=n,_[(e+=r)+0]=s[f+3*r]+2*s[f+2*r]+s[f+r]+2>>2,_[e+1]=o,_[e+2]=a,_[e+3]=t}function predict_vr_4x4(_,e,r){var t,n,i,a,o,s,f=_,d=e-1,E=_,c=e-r;_[e+0]=t=E[c-1]+E[c+0]+1>>1,_[e+1]=n=E[c+0]+E[c+1]+1>>1,_[e+2]=i=E[c+1]+E[c+2]+1>>1,_[e+3]=E[c+2]+E[c+3]+1>>1,_[(e+=r)+0]=a=f[d+0]+2*E[c-1]+E[c+0]+2>>2,_[e+1]=o=E[c-1]+2*E[c+0]+E[c+1]+2>>2,_[e+2]=s=E[c+0]+2*E[c+1]+E[c+2]+2>>2,_[e+3]=E[c+1]+2*E[c+2]+E[c+3]+2>>2,_[(e+=r)+0]=f[d+r]+2*f[d+0]+E[c-1]+2>>2,_[e+1]=t,_[e+2]=n,_[e+3]=i,_[(e+=r)+0]=f[d+2*r]+2*f[d+r]+f[d+0]+2>>2,_[e+1]=a,_[e+2]=o,_[e+3]=s}function predict_vl_4x4(_,e,r){var t,n,i,a,o,s,f=_,d=e-r;_[e+0]=f[d+0]+f[d+1]+1>>1,_[e+1]=t=f[d+1]+f[d+2]+1>>1,_[e+2]=n=f[d+2]+f[d+3]+1>>1,_[e+3]=i=f[d+3]+f[d+4]+1>>1,_[(e+=r)+0]=f[d+0]+2*f[d+1]+f[d+2]+2>>2,_[e+1]=a=f[d+1]+2*f[d+2]+f[d+3]+2>>2,_[e+2]=o=f[d+2]+2*f[d+3]+f[d+4]+2>>2,_[e+3]=s=f[d+3]+2*f[d+4]+f[d+5]+2>>2,_[(e+=r)+0]=t,_[e+1]=n,_[e+2]=i,_[e+3]=f[d+4]+2*f[d+5]+f[d+6]+2>>2,_[(e+=r)+0]=a,_[e+1]=o,_[e+2]=s,_[e+3]=f[d+5]+2*f[d+6]+f[d+7]+2>>2}function predict_hd_4x4(_,e,r){var t,n,i,a,o,s,f=_,d=e-1,E=_,c=e-r;_[e+0]=t=f[d+0]+E[c-1]+1>>1,_[e+1]=n=f[d+0]+2*E[c-1]+E[c+0]+2>>2,_[e+2]=E[c-1]+2*E[c+0]+E[c+1]+2>>2,_[e+3]=E[c+0]+2*E[c+1]+E[c+2]+2>>2,_[(e+=r)+0]=i=f[d+r]+f[d+0]+1>>1,_[e+1]=a=f[d+r]+2*f[d+0]+E[c-1]+2>>2,_[e+2]=t,_[e+3]=n,_[(e+=r)+0]=o=f[d+2*r]+f[d+r]+1>>1,_[e+1]=s=f[d+2*r]+2*f[d+r]+f[d+0]+2>>2,_[e+2]=i,_[e+3]=a,_[(e+=r)+0]=f[d+3*r]+f[d+2*r]+1>>1,_[e+1]=f[d+3*r]+2*f[d+2*r]+f[d+r]+2>>2,_[e+2]=o,_[e+3]=s}function predict_hu_4x4(_,e,r){var t,n,i,a,o,s=_,f=e-1;_[e+0]=s[f+0*r]+s[f+1*r]+1>>1,_[e+1]=s[f+0*r]+2*s[f+1*r]+s[f+2*r]+2>>2,_[e+2]=t=s[f+1*r]+s[f+2*r]+1>>1,_[e+3]=n=s[f+1*r]+2*s[f+2*r]+s[f+3*r]+2>>2,_[(e+=r)+0]=t,_[e+1]=n,_[e+2]=i=s[f+2*r]+s[f+3*r]+1>>1,_[e+3]=a=s[f+2*r]+2*s[f+3*r]+s[f+3*r]+2>>2,_[(e+=r)+0]=i,_[e+1]=a,_[e+2]=o=s[f+3*r],_[e+3]=o,_[(e+=r)+0]=o,_[e+1]=o,_[e+2]=o,_[e+3]=o}function predict_h_16x16(_,e,r){predict_h_nxn(_,e,r,16)}function predict_v_16x16(_,e,r){predict_v_nxn(_,e,r,16)}function predict_tm_16x16(_,e,r){predict_tm_nxn(_,e,r,16)}function predict_h_8x8(_,e,r){predict_h_nxn(_,e,r,8)}function predict_v_8x8(_,e,r){predict_v_nxn(_,e,r,8)}function predict_tm_8x8(_,e,r){predict_tm_nxn(_,e,r,8)}function predict_tm_4x4(_,e,r){predict_tm_nxn(_,e,r,4)}var tmp_4=new Array(0,0,0,0);function copy_down(_,e,r){var t,n=_,i=e+16-r;for(t=0;t<4;++t)tmp_4[0+t]=n[i+t];for(i+=4*r,t=0;t<4;++t)n[i+t]=tmp_4[0+t];for(i+=4*r,t=0;t<4;++t)n[i+t]=tmp_4[0+t];for(i+=4*r,t=0;t<4;++t)n[i+t]=tmp_4[0+t]}function b_pred(_,e,r,t,n,i){var a=int_;for(copy_down(_,e,r),a=0;a<16;a++){var o=_,s=e+4*(3&a);switch(t.splitt.mvs[a].d.x){case B_DC_PRED:predict_dc_nxn(o,s,r,4);break;case B_TM_PRED:predict_tm_4x4(o,s,r);break;case B_VE_PRED:predict_ve_4x4(o,s,r);break;case B_HE_PRED:predict_he_4x4(o,s,r);break;case B_LD_PRED:predict_ld_4x4(o,s,r);break;case B_RD_PRED:predict_rd_4x4(o,s,r);break;case B_VR_PRED:predict_vr_4x4(o,s,r);break;case B_VL_PRED:predict_vl_4x4(o,s,r);break;case B_HD_PRED:predict_hd_4x4(o,s,r);break;case B_HU_PRED:predict_hu_4x4(o,s,r);break;default:assert(0)}vp8_dixie_idct_add(o,s,o,s,r,n,i),i+=16,3==(3&a)&&(e+=4*r)}}var y2_16=Arr(16,0);function fixup_dc_coeffs(_,e,r){var t=int_;for(vp8_dixie_walsh(e,r+384,y2_16,0),t=0;t<16;t++)e[r+16*t]=y2_16[t]}function predict_intra_luma(_,e,r,t,n,i){if(t.base.y_mode==B_PRED)b_pred(_,e,r,t,n,i);else{var a=int_;switch(t.base.y_mode){case DC_PRED:predict_dc_nxn(_,e,r,16);break;case V_PRED:predict_v_16x16(_,e,r);break;case H_PRED:predict_h_16x16(_,e,r);break;case TM_PRED:predict_tm_16x16(_,e,r);break;default:assert(0)}for(fixup_dc_coeffs(t,n,i),a=0;a<16;a++)vp8_dixie_idct_add(_,e,_,e,r,n,i),i+=16,e+=4,3==(3&a)&&(e+=4*r-16)}}function predict_intra_chroma(_,e,r,t,n,i,a,o){var s=int_;switch(i.base.uv_mode){case DC_PRED:predict_dc_nxn(_,e,n,8),predict_dc_nxn(r,t,n,8);break;case V_PRED:predict_v_8x8(_,e,n),predict_v_8x8(r,t,n);break;case H_PRED:predict_h_8x8(_,e,n),predict_h_8x8(r,t,n);break;case TM_PRED:predict_tm_8x8(_,e,n),predict_tm_8x8(r,t,n);break;default:assert(0)}for(o+=256,s=16;s<20;s++)vp8_dixie_idct_add(_,e,_,e,n,a,o),o+=16,e+=4,1&s&&(e+=4*n-8);for(s=20;s<24;s++)vp8_dixie_idct_add(r,t,r,t,n,a,o),o+=16,t+=4,1&s&&(t+=4*n-8)}function sixtap_horiz(_,e,r,t,n,i,a,o,s){var f=int_,d=int_,E=int_;for(f=0;f<o;f++){for(d=0;d<a;d++)E=t[n-2]*s[0]+t[n-1]*s[1]+t[n+0]*s[2]+t[n+1]*s[3]+t[n+2]*s[4]+t[n+3]*s[5]+64,E>>=7,_[e+d]=E,n++;n+=i-a,e+=r}}function sixtap_vert(_,e,r,t,n,i,a,o,s){var f=int_,d=int_,E=int_;for(f=0;f<o;f++){for(d=0;d<a;d++)E=t[n-2*i]*s[0]+t[n-1*i]*s[1]+t[n+0*i]*s[2]+t[n+1*i]*s[3]+t[n+2*i]*s[4]+t[n+3*i]*s[5]+64,E>>=7,_[e+d]=E,n++;n+=i-a,e+=r}}var temp_=new Array(336);function sixtap_2d(_,e,r,t,n,i,a,o,s,f,d){sixtap_horiz(temp_,0,16,t,n-2*i,i,a,o+5,d[s]),sixtap_vert(_,e,r,temp_,32,16,a,o,d[f])}var img_index=function(){this.y=char_,this.u=char_,this.v=char_,this.y_off=0,this.u_off=0,this.v_off=0,this.stride=int_,this.uv_stride=int_};function filter_block(_,e,r,t,n,i,a,o){var s,f;return a.d.x||a.d.y?(s=7&a.d.x,f=7&a.d.y,n+=(a.d.y>>3)*i+(a.d.x>>3),s|f&&(sixtap_2d(e,r,i,t,n,i,4,4,s,f,o),t=e,n=r),_[0]=n,t):(_[0]=n,t)}function recon_1_block(_,e,r,t,n,i,a,o,s,f,d){var E=[0];vp8_dixie_idct_add(_,e,filter_block(E,_,e,r,t,n,i,a),E[0],n,o,s+16*d)}function calculate_chroma_splitmv(_,e,r){var t=int_,n=new mv;return(t=_.splitt.mvs[e].d.x+_.splitt.mvs[e+1].d.x+_.splitt.mvs[e+4].d.x+_.splitt.mvs[e+5].d.x)<0?t-=4:t+=4,n.d.x=parseInt(t/8,10),(t=_.splitt.mvs[e].d.y+_.splitt.mvs[e+1].d.y+_.splitt.mvs[e+4].d.y+_.splitt.mvs[e+5].d.y)<0?t-=4:t+=4,n.d.y=parseInt(t/8,10),r&&(n.d.x&=-8,n.d.y&=-8),n}function build_mc_border(_,e,r,t,n,i,a,o,s,f,d){var E,c=char_;E=r,c=t-i-a*n,a>=d?c+=(d-1)*n:a>0&&(c+=a*n);do{var l,m=int_,A=0;(m=i<0?-i:0)>o&&(m=o),i+o>f&&(A=i+o-f),A>o&&(A=o),l=o-m-A,m&&memset(_,e,E[c+0],m),l&&memcpy(_,e+m,E,c+i+m,l),A&&memset(_,e+m+l,E[c+f-1],A),e+=n,++a<d&&a>0&&(c+=n)}while(--s)}function recon_1_edge_block(_,e,r,t,n,i,a,o,s,f,d,E,c,l,m,A,u){var p=u;c+=o.d.x>>3,l+=o.d.y>>3,(c<2||c+4-1+3>=m||l<2||l+4-1+3>=A)&&(build_mc_border(r,t,n,(i+=(o.d.x>>3)+(o.d.y>>3)*a)-2-2*a,a,c-2,l-2,9,9,m,A),n=r,i=t+2*a+2,i-=(o.d.x>>3)+(o.d.y>>3)*a);var T=[0];vp8_dixie_idct_add(_,e,filter_block(T,_,e,n,i,a,o,s),T[0],a,f,d+16*p)}var uvmv_1=new mv;function predict_inter_emulated_edge(_,e,r,t,n,i,a){var o,s,f,d=_.frame_strg[0].img.img_data,E=_.frame_strg[0].img.img_data_off,c=0,l=0,m=int_,A=int_,u=int_,p=int_,T=int_,y=Arr_new(4,mv),b=e.u,v=e.v,h=e.u_off,w=e.v_off,I=(3==_.frame_hdr.version)+0;if(u=16*i,p=16*a,m=16*_.mb_cols,A=16*_.mb_rows,s=e.y,l=e.y_off,f=_.ref_frame_offsets[n.base.ref_frame],o=_.ref_frame_offsets_[n.base.ref_frame],c=l+f,n.base.y_mode!=SPLITMV){var R=uvmv_1;R.d.x=n.base.mv.d.x,R.d.y=n.base.mv.d.y,R.d.x=R.d.x+1>>1,R.d.y=R.d.y+1>>1,I&&(R.d.x&=-8,R.d.y&=-8),y[0].d.x=R.d.x,y[0].d.y=R.d.y,y[1].d.x=R.d.x,y[1].d.y=R.d.y,y[2].d.x=R.d.x,y[2].d.y=R.d.y,y[3].d.x=R.d.x,y[3].d.y=R.d.y}else y[0]=calculate_chroma_splitmv(n,0,I),y[1]=calculate_chroma_splitmv(n,2,I),y[2]=calculate_chroma_splitmv(n,8,I),y[3]=calculate_chroma_splitmv(n,10,I);for(T=0;T<16;T++){var N;N=n.base.y_mode!=SPLITMV?n.base.mv:n.splitt.mvs[+T],recon_1_edge_block(s,l,d,E,o,c,e.stride,N,_.subpixel_filters,r,t,n,u,p,m,A,T),u+=4,l+=4,c+=4,3==(3&T)&&(u-=16,p+=4,l+=4*e.stride-16,c+=4*e.stride-16)}for(u=16*i,p=16*a,u>>=1,p>>=1,m>>=1,A>>=1,T=0;T<4;T++)recon_1_edge_block(b,h,d,E,o,h+f,e.uv_stride,y[T],_.subpixel_filters,r,t,n,u,p,m,A,T+16),recon_1_edge_block(v,w,d,E,o,w+f,e.uv_stride,y[T],_.subpixel_filters,r,t,n,u,p,m,A,T+20),h+=4,w+=4,u+=4,1&T&&(u-=8,p+=4,h+=4*e.uv_stride-8,w+=4*e.uv_stride-8)}var uvmv_2=new mv;function predict_inter(_,e,r,t,n){var i,a,o=e.y,s=e.y_off,f=e.u,d=e.u_off,E=e.v,c=e.v_off,l=Arr_new(4,mv),m=(3==_.frame_hdr.version)+0,A=int_;if(n.base.y_mode!=SPLITMV){var u=uvmv_2;u.d.x=n.base.mv.d.x,u.d.y=n.base.mv.d.y,u.d.x=u.d.x+1>>1,u.d.y=u.d.y+1>>1,m&&(u.d.x&=-8,u.d.y&=-8),l[0].d.x=l[1].d.x=l[2].d.x=l[3].d.x=u.d.x,l[0].d.y=l[1].d.y=l[2].d.y=l[3].d.y=u.d.y}else l[0]=calculate_chroma_splitmv(n,0,m),l[1]=calculate_chroma_splitmv(n,2,m),l[2]=calculate_chroma_splitmv(n,8,m),l[3]=calculate_chroma_splitmv(n,10,m);for(a=_.ref_frame_offsets[n.base.ref_frame],i=_.ref_frame_offsets_[n.base.ref_frame],A=0;A<16;A++){var p;p=n.base.y_mode!=SPLITMV?n.base.mv:n.splitt.mvs[+A],recon_1_block(o,s,i,s+a,e.stride,p,_.subpixel_filters,r,t,n,A),s+=4,3==(3&A)&&(s+=4*e.stride-16)}for(A=0;A<4;A++)recon_1_block(f,d,i,d+a,e.uv_stride,l[A],_.subpixel_filters,r,t,n,A+16),recon_1_block(E,c,i,c+a,e.uv_stride,l[A],_.subpixel_filters,r,t,n,A+20),d+=4,c+=4,1&A&&(d+=4*e.uv_stride-8,c+=4*e.uv_stride-8)}function vp8_dixie_release_ref_frame(_){_&&(assert(_.ref_cnt),_.ref_cnt--)}function vp8_dixie_ref_frame(_){return _.ref_cnt++,_}function vp8_dixie_find_free_ref_frame(_){var e=int_;for(e=0;e<NUM_REF_FRAMES;e++)if(0==_[e].ref_cnt)return _[e].ref_cnt=1,_[e];return assert(0),null}function fixup_left(_,e,r,t,n,i){var a=_,o=e-1,s=int_;if(i==DC_PRED&&n){var f=_,d=e-t;for(s=0;s<r;s++)a[o]=f[d+s],o+=t}else for(o-=t,s=-1;s<r;s++)a[o]=129,o+=t}function fixup_above(_,e,r,t,n,i){var a=_,o=e-t,s=int_;if(i==DC_PRED&&n){var f=_,d=e-1;for(s=0;s<r;s++)a[o+s]=f[d],d+=t}else memset(a,o-1,127,r+1);memset(a,o+r,127,4)}function vp8_dixie_predict_init(_){var e,r=int_;if(_.frame_hdr.frame_size_updated){for(r=0;r<NUM_REF_FRAMES;r++){var t=16*_.mb_cols+2*BORDER_PIXELS,n=16*_.mb_rows+2*BORDER_PIXELS;vpx_img_free(_.frame_strg[r].img),_.frame_strg[r].ref_cnt=0,_.ref_frames[r]=null,vpx_img_alloc(_.frame_strg[r].img,IMG_FMT_I420,t,n,16)||vpx_internal_error(_.error,VPX_CODEC_MEM_ERROR,"Failed to allocate %dx%d framebuffer",t,n),vpx_img_set_rect(_.frame_strg[r].img,BORDER_PIXELS,BORDER_PIXELS,_.frame_hdr.kf.w,_.frame_hdr.kf.h)}_.frame_hdr.version?_.subpixel_filters=bilinear_filters:_.subpixel_filters=sixtap_filters}for(_.ref_frames[CURRENT_FRAME]&&vp8_dixie_release_ref_frame(_.ref_frames[CURRENT_FRAME]),_.ref_frames[CURRENT_FRAME]=vp8_dixie_find_free_ref_frame(_.frame_strg),e=_.ref_frames[CURRENT_FRAME].img.img_data,r=0;r<NUM_REF_FRAMES;r++){var i=_.ref_frames[r];_.ref_frame_offsets[r]=i?i.img.img_data_off-0:0,_.ref_frame_offsets_[r]=i?i.img.img_data:e}}var img_1=new img_index;function vp8_dixie_predict_process_row(_,e,r,t){var n,i,a=img_1,o=0,s=int_,f=0;for(a.stride=_.ref_frames[CURRENT_FRAME].img.stride[PLANE_Y],a.uv_stride=_.ref_frames[CURRENT_FRAME].img.stride[PLANE_U],a.y=_.ref_frames[CURRENT_FRAME].img.planes[PLANE_Y],a.y_off=_.ref_frames[CURRENT_FRAME].img.planes_off[PLANE_Y],a.u=_.ref_frames[CURRENT_FRAME].img.planes[PLANE_U],a.u_off=_.ref_frames[CURRENT_FRAME].img.planes_off[PLANE_U],a.v=_.ref_frames[CURRENT_FRAME].img.planes[PLANE_V],a.v_off=_.ref_frames[CURRENT_FRAME].img.planes_off[PLANE_V],a.y_off+=16*(a.stride*e+r),a.u_off+=8*(a.uv_stride*e+r),a.v_off+=8*(a.uv_stride*e+r),n=_.mb_info_rows[1+e],o=_.mb_info_rows_off[1+e]+r,i=_.tokens[e&_.token_hdr.partitions-1].coeffs,f=400*r,0==r&&(fixup_left(a.y,a.y_off,16,a.stride,e,n[o].base.y_mode),fixup_left(a.u,a.u_off,8,a.uv_stride,e,n[o].base.uv_mode),fixup_left(a.v,a.v_off,8,a.uv_stride,e,n[o].base.uv_mode),0==e&&(a.y[a.y_off-a.stride-1]=127)),s=r;s<r+t;s++)0==e&&(fixup_above(a.y,a.y_off,16,a.stride,s,n[o].base.y_mode),fixup_above(a.u,a.u_off,8,a.uv_stride,s,n[o].base.uv_mode),fixup_above(a.v,a.v_off,8,a.uv_stride,s,n[o].base.uv_mode)),n[o].base.y_mode<=B_PRED?(predict_intra_luma(a.y,a.y_off,a.stride,n[o],i,f),predict_intra_chroma(a.u,a.u_off,a.v,a.v_off,a.uv_stride,n[o],i,f)):(n[o].base.y_mode!=SPLITMV&&fixup_dc_coeffs(n[o],i,f),n[o].base.need_mc_border?predict_inter_emulated_edge(_,a,i,f,n[o],s,e):predict_inter(_,a,i,f,n[o])),o++,a.y_off+=16,a.u_off+=8,a.v_off+=8,f+=400;if(s==_.mb_cols){var d=a.y,E=a.y_off+15*a.stride,c=a.y[a.y_off-1+15*a.stride];d[E]=d[E+1]=d[E+2]=d[E+3]=c}}var FRAME_HEADER_SZ=3,KEYFRAME_HEADER_SZ=7;function ARRAY_COPY(_,e){assert(_.length==e.length),memcpy(_,0,e,0,_.length)}function decode_entropy_header(_,e,r){var t=int_,n=int_,i=int_,a=int_,o=0;for(t=0;t<BLOCK_TYPES;t++)for(n=0;n<COEF_BANDS;n++)for(i=0;i<PREV_COEF_CONTEXTS;i++)for(a=0;a<ENTROPY_NODES;a++)bool_get(e,k_coeff_entropy_update_probs[t][n][i][a])&&(r.coeff_probs_[o]=r.coeff_probs[t][n][i][a]=bool_get_uint(e,8)),o++;if(r.coeff_skip_enabled=bool_get_bit(e),r.coeff_skip_enabled&&(r.coeff_skip_prob=bool_get_uint(e,8)),!_.frame_hdr.is_keyframe){if(r.prob_inter=bool_get_uint(e,8),r.prob_last=bool_get_uint(e,8),r.prob_gf=bool_get_uint(e,8),bool_get_bit(e))for(t=0;t<4;t++)r.y_mode_probs[t]=bool_get_uint(e,8);if(bool_get_bit(e))for(t=0;t<3;t++)r.uv_mode_probs[t]=bool_get_uint(e,8);for(t=0;t<2;t++)for(n=0;n<MV_PROB_CNT;n++)if(bool_get(e,k_mv_entropy_update_probs[t][n])){var s=bool_get_uint(e,7);r.mv_probs[t][n]=s?s<<1:1}}}function decode_reference_header(_,e,r){var t=_.frame_hdr.is_keyframe;r.refresh_gf=t?1:bool_get_bit(e),r.refresh_arf=t?1:bool_get_bit(e),r.copy_gf=t||r.refresh_gf?0:bool_get_uint(e,2),r.copy_arf=t||r.refresh_arf?0:bool_get_uint(e,2),r.sign_bias[GOLDEN_FRAME]=t?0:bool_get_bit(e),r.sign_bias[ALTREF_FRAME]=t?0:bool_get_bit(e),r.refresh_entropy=bool_get_bit(e),r.refresh_last=t?1:bool_get_bit(e)}function decode_quantizer_header(_,e,r){var t=int_,n=r.q_index;r.q_index=bool_get_uint(e,7),t=(n!=r.q_index)+0,t|=r.y1_dc_delta_q=bool_maybe_get_int(e,4),t|=r.y2_dc_delta_q=bool_maybe_get_int(e,4),t|=r.y2_ac_delta_q=bool_maybe_get_int(e,4),t|=r.uv_dc_delta_q=bool_maybe_get_int(e,4),t|=r.uv_ac_delta_q=bool_maybe_get_int(e,4),r.delta_update=t}function decode_and_init_token_partitions(_,e,r,t,n,i){var a=int_;for(i.partitions=1<<bool_get_uint(e,2),n<3*(i.partitions-1)&&vpx_internal_error(_.error,VPX_CODEC_CORRUPT_FRAME,"Truncated packet found parsing partition lengths."),n-=3*(i.partitions-1),a=0;a<i.partitions;a++)a<i.partitions-1?(i.partition_sz[a]=r[t+2]<<16|r[t+1]<<8|r[t+0],t+=3):i.partition_sz[a]=n,n<i.partition_sz[a]&&vpx_internal_error(_.error,VPX_CODEC_CORRUPT_FRAME,"Truncated partition %d",a),n-=i.partition_sz[a];for(a=0;a<_.token_hdr.partitions;a++)init_bool_decoder(_.tokens[a].bool,r,t,_.token_hdr.partition_sz[a]),t+=_.token_hdr.partition_sz[a]}function decode_loopfilter_header(_,e,r){if(_.frame_hdr.is_keyframe&&memset(r,0,1),r.use_simple=bool_get_bit(e),r.level=bool_get_uint(e,6),r.sharpness=bool_get_uint(e,3),r.delta_enabled=bool_get_bit(e),r.delta_enabled&&bool_get_bit(e)){var t=int_;for(t=0;t<BLOCK_CONTEXTS;t++)r.ref_delta[t]=bool_maybe_get_int(e,6);for(t=0;t<BLOCK_CONTEXTS;t++)r.mode_delta[t]=bool_maybe_get_int(e,6)}}function decode_segmentation_header(_,e,r){if(_.frame_hdr.is_keyframe&&memset(r,0,1),r.enabled=bool_get_bit(e),r.enabled){var t=int_;if(r.update_map=bool_get_bit(e),r.update_data=bool_get_bit(e),r.update_data){for(r.abs_=bool_get_bit(e),t=0;t<MAX_MB_SEGMENTS;t++)r.quant_idx[t]=bool_maybe_get_int(e,7);for(t=0;t<MAX_MB_SEGMENTS;t++)r.lf_level[t]=bool_maybe_get_int(e,6)}if(r.update_map)for(t=0;t<MB_FEATURE_TREE_PROBS;t++)r.tree_probs[t]=bool_get_bit(e)?bool_get_uint(e,8):255}else r.update_map=0,r.update_data=0}function clamp_q(_){return _<0?0:_>127?127:_}function dc_q(_){return dc_q_lookup[clamp_q(_)]}function ac_q(_){return ac_q_lookup[clamp_q(_)]}function dequant_init(_,e,r){var t=int_,n=int_,i=_,a=0;for(t=0;t<(e.enabled?MAX_MB_SEGMENTS:1);t++)n=r.q_index,e.enabled&&(n=e.abs_?e.quant_idx[t]:n+e.quant_idx[t]),(i[a].quant_idx!=n||r.delta_update)&&(i[a].factor[TOKEN_BLOCK_Y1][0]=dc_q(n+r.y1_dc_delta_q),i[a].factor[TOKEN_BLOCK_Y1][1]=ac_q(n),i[a].factor[TOKEN_BLOCK_UV][0]=dc_q(n+r.uv_dc_delta_q),i[a].factor[TOKEN_BLOCK_UV][1]=ac_q(n+r.uv_ac_delta_q),i[a].factor[TOKEN_BLOCK_Y2][0]=2*dc_q(n+r.y2_dc_delta_q),i[a].factor[TOKEN_BLOCK_Y2][1]=parseInt(155*ac_q(n+r.y2_ac_delta_q)/100),i[a].factor[TOKEN_BLOCK_Y2][1]<8&&(i[a].factor[TOKEN_BLOCK_Y2][1]=8),i[a].factor[TOKEN_BLOCK_UV][0]>132&&(i[a].factor[TOKEN_BLOCK_UV][0]=132),i[a].quant_idx=n),a++}var bool_1=new bool_decoder;function decode_frame(_,e,r,t){var n,i=bool_1,a=int_,o=int_,s=int_;if(_.saved_entropy_valid=0,(n=vp8_parse_frame_header(e,t,_.frame_hdr))&&vpx_internal_error(_.error,n,"Failed to parse frame header"),_.frame_hdr.is_experimental&&vpx_internal_error(_.error,VPX_CODEC_UNSUP_BITSTREAM,"Experimental bitstreams not supported."),r+=FRAME_HEADER_SZ,t-=FRAME_HEADER_SZ,_.frame_hdr.is_keyframe&&(r+=KEYFRAME_HEADER_SZ,t-=KEYFRAME_HEADER_SZ,_.mb_cols=parseInt((_.frame_hdr.kf.w+15)/16,10),_.mb_rows=parseInt((_.frame_hdr.kf.h+15)/16,10)),init_bool_decoder(i,e,r,_.frame_hdr.part0_sz),_.frame_hdr.is_keyframe&&bool_get_uint(i,2)&&vpx_internal_error(_.error,VPX_CODEC_UNSUP_BITSTREAM,"Reserved bits not supported."),decode_segmentation_header(_,i,_.segment_hdr),decode_loopfilter_header(_,i,_.loopfilter_hdr),decode_and_init_token_partitions(_,i,e,r+_.frame_hdr.part0_sz,t-_.frame_hdr.part0_sz,_.token_hdr),decode_quantizer_header(_,i,_.quant_hdr),decode_reference_header(_,i,_.reference_hdr),_.frame_hdr.is_keyframe){a=int_;var f=int_,d=int_,E=int_,c=0;for(a=0;a<BLOCK_TYPES;a++)for(f=0;f<COEF_BANDS;f++)for(d=0;d<PREV_COEF_CONTEXTS;d++)for(E=0;E<ENTROPY_NODES;E++)_.entropy_hdr.coeff_probs_[c]=_.entropy_hdr.coeff_probs[a][f][d][E]=k_default_coeff_probs[a][f][d][E],c++;_.entropy_hdr.mv_probs=new k_default_mv_probs,ARRAY_COPY(_.entropy_hdr.y_mode_probs,k_default_y_mode_probs),ARRAY_COPY(_.entropy_hdr.uv_mode_probs,k_default_uv_mode_probs)}if(!_.reference_hdr.refresh_entropy){var l=_.saved_entropy,m=_.entropy_hdr;c=0;for(a=0;a<BLOCK_TYPES;a++)for(f=0;f<COEF_BANDS;f++)for(d=0;d<PREV_COEF_CONTEXTS;d++)for(E=0;E<ENTROPY_NODES;E++)l.coeff_probs_[c]=l.coeff_probs[a][f][d][E]=m.coeff_probs[a][f][d][E],c++;for(l.coeff_skip_enabled=m.coeff_skip_enabled,l.coeff_skip_prob=m.coeff_skip_prob,a=0;a<2;++a)for(f=0;f<19;++f)l.mv_probs[a][f]=m.mv_probs[a][f];for(l.prob_gf=m.prob_gf,l.prob_inter=m.prob_inter,l.prob_last=m.prob_last,a=0;a<3;++a)l.uv_mode_probs[a]=m.uv_mode_probs[a];for(a=0;a<4;++a)l.y_mode_probs[a]=m.y_mode_probs[a];_.saved_entropy_valid=1}for(decode_entropy_header(_,i,_.entropy_hdr),vp8_dixie_modemv_init(_),vp8_dixie_tokens_init(_),vp8_dixie_predict_init(_),dequant_init(_.dequant_factors,_.segment_hdr,_.quant_hdr),o=0,s=0;o<_.mb_rows;o++)vp8_dixie_modemv_process_row(_,i,o,0,_.mb_cols),vp8_dixie_tokens_process_row(_,s,o,0,_.mb_cols),vp8_dixie_predict_process_row(_,o,0,_.mb_cols),_.loopfilter_hdr.level&&o&&vp8_dixie_loopfilter_process_row(_,o-1,0,_.mb_cols),++s==_.token_hdr.partitions&&(s=0);if(_.loopfilter_hdr.level&&vp8_dixie_loopfilter_process_row(_,o-1,0,_.mb_cols),_.frame_cnt++,!_.reference_hdr.refresh_entropy){l=_.entropy_hdr,m=_.saved_entropy,c=0;for(a=0;a<BLOCK_TYPES;a++)for(f=0;f<COEF_BANDS;f++)for(d=0;d<PREV_COEF_CONTEXTS;d++)for(E=0;E<ENTROPY_NODES;E++)l.coeff_probs_[c]=l.coeff_probs[a][f][d][E]=m.coeff_probs[a][f][d][E]=m.coeff_probs_[c],c++;for(l.coeff_skip_enabled=m.coeff_skip_enabled,l.coeff_skip_prob=m.coeff_skip_prob,a=0;a<2;++a)for(f=0;f<19;++f)l.mv_probs[a][f]=m.mv_probs[a][f];for(l.prob_gf=m.prob_gf,l.prob_inter=m.prob_inter,l.prob_last=m.prob_last,a=0;a<3;++a)l.uv_mode_probs[a]=m.uv_mode_probs[a];for(a=0;a<4;++a)l.y_mode_probs[a]=m.y_mode_probs[a];_.saved_entropy_valid=0}1==_.reference_hdr.copy_arf?(vp8_dixie_release_ref_frame(_.ref_frames[ALTREF_FRAME]),_.ref_frames[ALTREF_FRAME]=vp8_dixie_ref_frame(_.ref_frames[LAST_FRAME])):2==_.reference_hdr.copy_arf&&(vp8_dixie_release_ref_frame(_.ref_frames[ALTREF_FRAME]),_.ref_frames[ALTREF_FRAME]=vp8_dixie_ref_frame(_.ref_frames[GOLDEN_FRAME])),1==_.reference_hdr.copy_gf?(vp8_dixie_release_ref_frame(_.ref_frames[GOLDEN_FRAME]),_.ref_frames[GOLDEN_FRAME]=vp8_dixie_ref_frame(_.ref_frames[LAST_FRAME])):2==_.reference_hdr.copy_gf&&(vp8_dixie_release_ref_frame(_.ref_frames[GOLDEN_FRAME]),_.ref_frames[GOLDEN_FRAME]=vp8_dixie_ref_frame(_.ref_frames[ALTREF_FRAME])),_.reference_hdr.refresh_gf&&(vp8_dixie_release_ref_frame(_.ref_frames[GOLDEN_FRAME]),_.ref_frames[GOLDEN_FRAME]=vp8_dixie_ref_frame(_.ref_frames[CURRENT_FRAME])),_.reference_hdr.refresh_arf&&(vp8_dixie_release_ref_frame(_.ref_frames[ALTREF_FRAME]),_.ref_frames[ALTREF_FRAME]=vp8_dixie_ref_frame(_.ref_frames[CURRENT_FRAME])),_.reference_hdr.refresh_last&&(vp8_dixie_release_ref_frame(_.ref_frames[LAST_FRAME]),_.ref_frames[LAST_FRAME]=vp8_dixie_ref_frame(_.ref_frames[CURRENT_FRAME]))}function CHECK_FOR_UPDATE(_,e,r){var t=_;return r[0]|=t!=(_=e),_}function vp8_parse_frame_header(_,e,r){var t=long_;if(e<10)return VPX_CODEC_CORRUPT_FRAME;if(t=_[0]|_[1]<<8|_[2]<<16,r.is_keyframe=!BITS_GET(t,0,1),r.version=BITS_GET(t,1,2),r.is_experimental=BITS_GET(t,3,1),r.is_shown=BITS_GET(t,4,1),r.part0_sz=BITS_GET(t,5,19),e<=r.part0_sz+(r.is_keyframe?10:3))return VPX_CODEC_CORRUPT_FRAME;if(r.frame_size_updated=0,r.is_keyframe){var n=[0];if(157!=_[3]||1!=_[4]||42!=_[5])return VPX_CODEC_UNSUP_BITSTREAM;if(t=_[6]|_[7]<<8|_[8]<<16|_[9]<<24,r.kf.w=CHECK_FOR_UPDATE(r.kf.w,BITS_GET(t,0,14),n),r.kf.scale_w=CHECK_FOR_UPDATE(r.kf.scale_w,BITS_GET(t,14,2),n),r.kf.h=CHECK_FOR_UPDATE(r.kf.h,BITS_GET(t,16,14),n),r.kf.scale_h=CHECK_FOR_UPDATE(r.kf.scale_h,BITS_GET(t,30,2),n),r.frame_size_updated=n[0],!r.kf.w||!r.kf.h)return VPX_CODEC_UNSUP_BITSTREAM}return VPX_CODEC_OK}function vp8_dixie_decode_frame(_,e,r){var t=_;return _.error.error_code=VPX_CODEC_OK,_.error.has_detail=0,setjmp(_.error.jmp)||decode_frame(_,e,0,r),t.error.error_code}function vp8_dixie_decode_destroy(_){vp8_dixie_predict_destroy(_),vp8_dixie_tokens_destroy(_),vp8_dixie_modemv_destroy(_)}var vpx_codec_alg_priv=function(){decoder_ctx=new vp8_decoder_ctx,img=new vpx_image_t,img_avail=int_};function update_error_state(_,e){var r;return(r=e.error_code)&&(_.base.err_detail=e.has_detail?e.detail:null),r}function vp8_init(_){var e=VPX_CODEC_OK;if(!_.priv){var r=new vpx_codec_alg_priv_t;if(_.priv=r,!_.priv)return VPX_CODEC_MEM_ERROR;_.priv.sz=1,_.priv.iface=_.iface,_.priv.alg_priv=r,_.priv.init_flags=_.init_flags,_.config.dec&&(_.priv.alg_priv.cfg=_.config.dec,_.config.dec=_.priv.alg_priv.cfg)}return e}function vp8_destroy(_){return vp8_dixie_decode_destroy(_.decoder_ctx),_.base.alg_priv="",VPX_CODEC_OK}function vp8_peek_si(_,e,r){var t,n=new vp8_frame_hdr;return(t=vp8_parse_frame_header(_,e,n))||(r.is_kf=n.is_keyframe,r.is_kf?(r.w=n.kf.w,r.h=n.kf.h):(r.w=0,r.h=0)),t}function vp8_get_si(_,e){var r=int_;return r=(e.sz,1),memcpy(e,_.si,r),alert("todo"),e.sz=r,VPX_CODEC_OK}function vp8_decode(_,e,r,t,n){var i;return(i=vp8_dixie_decode_frame(_.decoder_ctx,e,r))&&update_error_state(_,_.decoder_ctx.error),_.img_avail=_.decoder_ctx.frame_hdr.is_shown,_.img=_.decoder_ctx.ref_frames[CURRENT_FRAME].img,i}function vp8_get_frame(_,e){var r=null;return _.img_avail&&(e[0]||(r=_.img,e[0]=r)),r}var ctf_maps=create_obj_vals_from_arrayChilds(vpx_codec_ctrl_fn_map_t,[[-1,null]]);function webmdata(_){main(_)}CODEC_INTERFACE("vpx_codec_vp8_dx",new Array('VP8 "Dixie" Decoder'+VERSION_STRING,VPX_CODEC_INTERNAL_ABI_VERSION,VPX_CODEC_CAP_DECODER,"vp8_init","vp8_destroy","ctf_maps",null,null,new Array("vp8_peek_si","vp8_get_si","vp8_decode","vp8_get_frame"))),window.webmdata=webmdata;var VP8_FOURCC=3690582,ifaces=new Array({name:char_,iface:0,fourcc:int_,fourcc_mask:int_});ifaces[0]={name:"vp8",iface:new vpx_codec_vp8_dx_algo,fourcc:VP8_FOURCC,fourcc_mask:16777215};var RAW_FILE=0,IVF_FILE=1,WEBM_FILE=2,IVF_FRAME_HDR_SZ=12,RAW_FRAME_HDR_SZ=4;function read_frame(_,e,r,t,n){new Array(IVF_FRAME_HDR_SZ);var i=size_t,a=_.infile;if(_.kind==WEBM_FILE){if(_.chunk>=_.chunks){var o=[int_];do{if(_.pkt&&nestegg_free_packet(_.pkt),nestegg_read_packet(_.nestegg_ctx,_.pkt)<=0||nestegg_packet_track(_.pkt,o))return 1}while(o!=_.video_track);if(nestegg_packet_count(_.pkt,_.chunks))return 1;_.chunk=0}return nestegg_packet_data(_.pkt,_.chunk,e,t)?1:(_.chunk++,0)}return t[0]=i,t?fread(e,1,t[0],a)!=t[0]?(fprintf(stderr,"Failed to read full frame\n"),1):0:1}var input_ctx=function(){this.kind=0,this.infile=0,this.nestegg_ctx=new nestegg,this.pkt=[null],this.chunk=int_,this.chunks=[int_],this.video_track=int_};function nestegg_read_cb(_,e,r){var t=r;return fread(_,1,e,t)<e&&feof(t)?0:1}function nestegg_seek_cb(_,e,r){switch(e){case NESTEGG_SEEK_SET:e=SEEK_SET;break;case NESTEGG_SEEK_CUR:e=SEEK_CUR;break;case NESTEGG_SEEK_END:e=SEEK_END}return fseek(r,_,e)?-1:0}function nestegg_tell_cb(_){return ftell(_)}function file_is_webm(_,e,r,t,n,i){var a=int_,o=[int_],s=-1,f={read:nestegg_read_cb,seek:nestegg_seek_cb,tell:nestegg_tell_cb,userdata:_.infile},d=new nestegg_video_params;for(_.nestegg_ctx=[_.nestegg_ctx],nestegg_init(_.nestegg_ctx,f,null)&&alert("goto fail"),_.nestegg_ctx=_.nestegg_ctx[0],nestegg_track_count(_.nestegg_ctx,o)&&alert("goto fail"),a=0;a<o&&(s=nestegg_track_type(_.nestegg_ctx,a))!=NESTEGG_TRACK_VIDEO;a++)s<0&&alert("goto fail");return nestegg_track_codec_id(_.nestegg_ctx,a)!=NESTEGG_CODEC_VP8&&(fprintf(stderr,"Not VP8 video, quitting.\n"),exit(1)),_.video_track=a,nestegg_track_video_params(_.nestegg_ctx,a,d)&&alert("goto fail"),n[0]=0,i[0]=0,e[0]=VP8_FOURCC,r[0]=d.width,t[0]=d.height,1}function main(_,e,r){var t=[null],n=[null],i=[0],a=[0],o={data:_,data_off:0},s=[int_],f=[int_],d=[int_],E=[int_],c=[int_],l=new input_ctx;if(l.infile=o,!file_is_webm(l,s,f,d,E,c))return alert("Unrecognized input file type.\n"),EXIT_FAILURE;l.kind=WEBM_FILE;var m=document.getElementById("timecode"),A=document.getElementById("render"),u=document.getElementById("frame"),p=new Date,T=0,y=new vp8_decoder_ctx;!function _(){!read_frame(l,t,n,i,a)&&setTimeout((function(){t=t[0],p=new Date,vp8_dixie_decode_frame(y,t,i),t=[t];var e=y.frame_hdr.is_shown,r=y.ref_frames[0].img;b=new Date,m.innerHTML=l.pkt[0].timecode+" ("+(l.pkt[0].timecode/1e9>>0)+" sec)",e&&(A.innerHTML=b-p+"ms<br />FPS:"+(1e3/(b-p)).toFixed(2),r&&vpximg2canvas(r),T++,u.innerHTML=T),_()}),0)}();var b=new Date}
4
+ /*!\brief Decoder algorithm interface interface 285
5
+ *
6
+ * All decoders \ref MUST expose a variable of this type.
7
+ */},vpx_codec_iface=function(){this.name=char_,this.abi_version=int_,this.caps=long_,this.init="vpx_codec_init_fn_t",this.destroy="vpx_codec_destroy_fn_t",this.ctrl_maps=new vpx_codec_ctrl_fn_map_t,this.get_mmap="vpx_codec_get_mmap_fn_t",this.set_mmap="vpx_codec_set_mmap_fn_t",this.dec=new Object({peek_si:"vpx_codec_peek_si_fn_t",get_si:"vpx_codec_get_si_fn_t",decode:"vpx_codec_decode_fn_t",get_frame:"vpx_codec_get_frame_fn_t"})},vpx_codec_iface_t=vpx_codec_iface,VERSION_STRING=" v0.9.7",VPX_CODEC_OK=0,VPX_CODEC_MEM_ERROR=2,VPX_IMAGE_ABI_VERSION=1;VPX_IMG_FMT_I420=258,VPX_IMG_FMT_VPXI420=260;var VPX_PLANE_PACKED=0,VPX_PLANE_Y=0,VPX_PLANE_U=1,VPX_PLANE_V=2,VPX_PLANE_ALPHA=3,PLANE_PACKED=VPX_PLANE_PACKED,PLANE_Y=VPX_PLANE_Y,PLANE_U=VPX_PLANE_U,PLANE_V=VPX_PLANE_V,PLANE_ALPHA=VPX_PLANE_ALPHA,vpx_image_t=function(){this.fmt=0,this.w=this.w=int_,this.h=this.h=int_,this.d_w=this.d_w=int_,this.d_h=this.d_h=int_,this.x_chroma_shift=this.x_chroma_shift=int_,this.y_chroma_shift=this.y_chroma_shift=int_,this.planes=this.planes=new Array(4),this.planes_off=this.planes_off=new Array(4),this.stride=this.stride=new Array(4),this.bps=this.bps=int_,this.user_priv=this.user_priv=void_,this.img_data=this.img_data=char_,this.img_data_off=this.img_data_off=0,this.img_data_owner=this.img_data_owner=int_,this.self_allocd=this.self_allocd=int_},NESTEGG_TRACK_VIDEO=0,NESTEGG_TRACK_AUDIO=1,NESTEGG_CODEC_VP8=0,NESTEGG_CODEC_VORBIS=1,NESTEGG_SEEK_SET=0,NESTEGG_SEEK_CUR=1,NESTEGG_SEEK_END=2,NESTEGG_LOG_DEBUG=1,NESTEGG_LOG_INFO=10,NESTEGG_LOG_WARNING=100,NESTEGG_LOG_ERROR=1e3,NESTEGG_LOG_CRITICAL=1e4,nestegg_io=function(){this.read=int_,this.seek=int_,this.tell=int64_t,this.userdata=void_},nestegg_video_params=function(){this.width=int_,this.height=int_,this.display_width=int_,this.display_height=int_,this.crop_bottom=int_,this.crop_top=int_,this.crop_left=int_,this.crop_right=int_},ID_EBML=440786851,ID_EBML_VERSION=17030,ID_EBML_READ_VERSION=17143,ID_EBML_MAX_ID_LENGTH=17138,ID_EBML_MAX_SIZE_LENGTH=17139,ID_DOCTYPE=17026,ID_DOCTYPE_VERSION=17031,ID_DOCTYPE_READ_VERSION=17029,ID_VOID=236,ID_CRC32=191,ID_SEGMENT=408125543,ID_SEEK_HEAD=290298740,ID_SEEK=19899,ID_SEEK_ID=21419,ID_SEEK_POSITION=21420,ID_INFO=357149030,ID_TIMECODE_SCALE=2807729,ID_DURATION=17545,ID_CLUSTER=524531317,ID_TIMECODE=231,ID_BLOCK_GROUP=160,ID_SIMPLE_BLOCK=163,ID_BLOCK=161,ID_BLOCK_DURATION=155,ID_REFERENCE_BLOCK=251,ID_TRACKS=374648427,ID_TRACK_ENTRY=174,ID_TRACK_NUMBER=215,ID_TRACK_UID=29637,ID_TRACK_TYPE=131,ID_FLAG_ENABLED=185,ID_FLAG_DEFAULT=136,ID_FLAG_LACING=156,ID_TRACK_TIMECODE_SCALE=2306383,ID_LANGUAGE=2274716,ID_CODEC_ID=134,ID_CODEC_PRIVATE=25506,ID_VIDEO=224,ID_PIXEL_WIDTH=176,ID_PIXEL_HEIGHT=186,ID_PIXEL_CROP_BOTTOM=21674,ID_PIXEL_CROP_TOP=21691,ID_PIXEL_CROP_LEFT=21708,ID_PIXEL_CROP_RIGHT=21725,ID_DISPLAY_WIDTH=21680,ID_DISPLAY_HEIGHT=21690,ID_AUDIO=225,ID_SAMPLING_FREQUENCY=181,ID_CHANNELS=159,ID_BIT_DEPTH=25188,ID_CUES=475249515,ID_CUE_POINT=187,ID_CUE_TIME=179,ID_CUE_TRACK_POSITIONS=183,ID_CUE_TRACK=247,ID_CUE_CLUSTER_POSITION=241,ID_CUE_BLOCK_NUMBER=21368,TYPE_UNKNOWN=0,TYPE_MASTER=1,TYPE_UINT=2,TYPE_FLOAT=3,TYPE_INT=4,TYPE_STRING=5,TYPE_BINARY=6,LIMIT_STRING=1<<20,LIMIT_BINARY=1<<24,LIMIT_BLOCK=1<<30,LIMIT_FRAME=1<<28,DESC_FLAG_NONE=0,DESC_FLAG_MULTI=1,DESC_FLAG_SUSPEND=2,DESC_FLAG_OFFSET=4,BLOCK_FLAGS_LACING=6,LACING_NONE=0,LACING_XIPH=1,LACING_FIXED=2,LACING_EBML=3,TRACK_TYPE_VIDEO=1,TRACK_TYPE_AUDIO=2,TRACK_ID_VP8="V_VP8",TRACK_ID_VORBIS="A_VORBIS",MASK_NONE=0,MASK_FIRST_BIT=1,ebml_binary=function(){this.data=char_,this.length=size_t},ebml_list_node=function(){this.next=null,this.id=uint64_t,this.data=void_},ebml_list=function(){this.head=null,this.tail=null},ebml_type=function(){this.v=new Object({u:uint64_t,f:double_,i:int64_t,s:char_,b:new ebml_binary}),this.type=0,this.read=int_},ebml=window.ebml=function(){this.ebml_version=this.ebml_version=new ebml_type,this.ebml_read_version=this.ebml_read_version=new ebml_type,this.ebml_max_id_length=this.ebml_max_id_length=new ebml_type,this.ebml_max_size_length=this.ebml_max_size_length=new ebml_type,this.doctype=this.doctype=new ebml_type,this.doctype_version=this.doctype_version=new ebml_type,this.doctype_read_version=this.doctype_read_version=new ebml_type},seek=window.seek=function(){this.id=this.id=new ebml_type,this.position=this.position=new ebml_type},seek_head=window.seek_head=function(){this.seek=this.seek=new ebml_list},info=window.info=function(){this.timecode_scale=this.timecode_scale=new ebml_type,this.duration=this.duration=new ebml_type},block_group=window.block_group=function(){this.duration=this.duration=new ebml_type,this.reference_block=this.reference_block=new ebml_type},cluster=window.cluster=function(){this.timecode=this.timecode=new ebml_type,this.block_group=this.block_group=new ebml_list},video=window.video=function(){this.pixel_width=this.pixel_width=new ebml_type,this.pixel_height=this.pixel_height=new ebml_type,this.pixel_crop_bottom=this.pixel_crop_bottom=new ebml_type,this.pixel_crop_top=this.pixel_crop_top=new ebml_type,this.pixel_crop_left=this.pixel_crop_left=new ebml_type,this.pixel_crop_right=this.pixel_crop_right=new ebml_type,this.display_width=this.display_width=new ebml_type,this.display_height=this.display_height=new ebml_type},audio=window.audio=function(){this.sampling_frequency=this.sampling_frequency=new ebml_type,this.channels=this.channels=new ebml_type,this.bit_depth=this.bit_depth=new ebml_type},track_entry=window.track_entry=function(){this.number=this.number=new ebml_type,this.uid=this.uid=new ebml_type,this.type=this.type=new ebml_type,this.flag_enabled=this.flag_enabled=new ebml_type,this.flag_default=this.flag_default=new ebml_type,this.flag_lacing=this.flag_lacing=new ebml_type,this.track_timecode_scale=this.track_timecode_scale=new ebml_type,this.language=this.language=new ebml_type,this.codec_id=this.codec_id=new ebml_type,this.codec_private=this.codec_private=new ebml_type,this.video=this.video=new video,this.audio=this.audio=new audio},tracks=window.tracks=function(){this.track_entry=this.track_entry=new ebml_list},cue_track_positions=window.cue_track_positions=function(){this.track=this.track=new ebml_type,this.cluster_position=this.cluster_position=new ebml_type,this.block_number=this.block_number=new ebml_type},cue_point=window.cue_point=function(){this.time=this.time=new ebml_type,this.cue_track_positions=this.cue_track_positions=new ebml_list},cues=window.cues=function(){this.cue_point=this.cue_point=new ebml_list},segment=window.segment=function(){this.seek_head=this.seek_head=new ebml_list,this.info=this.info=new info,this.cluster=this.cluster=new ebml_list,this.tracks=this.tracks=new tracks,this.cues=this.cues=new cues},pool_ctx=function(){this.dummy=char_},list_node=function(){this.previous=0,this.node=new ebml_element_desc,this.data=char_},frame=function(){this.data=char_,this.length=size_t,this.next=null},nestegg=function(){this.io=new nestegg_io,this.log_=0,this.alloc_pool=new pool_ctx,this.last_id=uint64_t,this.last_size=uint64_t,this.ancestor=null,this.ebml=this.ebml=new ebml,this.segment=this.segment=new segment,this.segment_offset=int64_t,this.track_count=int_},nestegg_packet=function(){this.track=uint64_t,this.timecode=uint64_t,this.frame=new frame},ebml_element_desc=function(){this.name=char_,this.id=uint64_t,this.type=0,this.offset=size_t,this.flags=int_,this.children=null,this.size=size_t,this.data_offset=size_t};function E_FIELD(_,e,r,t,n){return new Array(_,e,r,n,DESC_FLAG_NONE,null,0,0)}function E_MASTER(_,e,r,t,n,i){return new Array(_,e,r,n,DESC_FLAG_MULTI,i,1,0)}function E_SINGLE_MASTER_O(_,e,r,t,n,i){return new Array(_,e,r,n,DESC_FLAG_OFFSET,i,0,n+"_offset")}function E_SINGLE_MASTER(_,e,r,t,n,i){return new Array(_,e,r,n,DESC_FLAG_NONE,i,0,0)}function E_SUSPEND(_,e,r){return new Array(_,e,r,0,DESC_FLAG_SUSPEND,null,0,0)}var E_LAST=new Array(null,0,0,0,DESC_FLAG_NONE,null,0,0),ne_ebml_elements=create_ebml_element_desc(new Array(E_FIELD("ID_EBML_VERSION",ID_EBML_VERSION,TYPE_UINT,"ebml","ebml_version"),E_FIELD("ID_EBML_READ_VERSION",ID_EBML_READ_VERSION,TYPE_UINT,"ebml","ebml_read_version"),E_FIELD("ID_EBML_MAX_ID_LENGTH",ID_EBML_MAX_ID_LENGTH,TYPE_UINT,"ebml","ebml_max_id_length"),E_FIELD("ID_EBML_MAX_SIZE_LENGTH",ID_EBML_MAX_SIZE_LENGTH,TYPE_UINT,"ebml","ebml_max_size_length"),E_FIELD("ID_DOCTYPE",ID_DOCTYPE,TYPE_STRING,"ebml","doctype"),E_FIELD("ID_DOCTYPE_VERSION",ID_DOCTYPE_VERSION,TYPE_UINT,"ebml","doctype_version"),E_FIELD("ID_DOCTYPE_READ_VERSION",ID_DOCTYPE_READ_VERSION,TYPE_UINT,"ebml","doctype_read_version"),E_LAST)),ne_seek_elements=create_ebml_element_desc(new Array(E_FIELD("ID_SEEK_ID",ID_SEEK_ID,TYPE_BINARY,"seek","id"),E_FIELD("ID_SEEK_POSITION",ID_SEEK_POSITION,TYPE_UINT,"seek","position"),E_LAST)),ne_seek_head_elements=create_ebml_element_desc(new Array(E_MASTER("ID_SEEK",ID_SEEK,TYPE_MASTER,"seek_head","seek",ne_seek_elements),E_LAST)),ne_info_elements=create_ebml_element_desc(new Array(E_FIELD("ID_TIMECODE_SCALE",ID_TIMECODE_SCALE,TYPE_UINT,"info","timecode_scale"),E_FIELD("ID_DURATION",ID_DURATION,TYPE_FLOAT,"info","duration"),E_LAST)),ne_block_group_elements=create_ebml_element_desc(new Array(E_SUSPEND("ID_BLOCK",ID_BLOCK,TYPE_BINARY),E_FIELD("ID_BLOCK_DURATION",ID_BLOCK_DURATION,TYPE_UINT,"block_group","duration"),E_FIELD("ID_REFERENCE_BLOCK",ID_REFERENCE_BLOCK,TYPE_INT,"block_group","reference_block"),E_LAST)),ne_cluster_elements=create_ebml_element_desc(new Array(E_FIELD("ID_TIMECODE",ID_TIMECODE,TYPE_UINT,"cluster","timecode"),E_MASTER("ID_BLOCK_GROUP",ID_BLOCK_GROUP,TYPE_MASTER,"cluster","block_group",ne_block_group_elements),E_SUSPEND("ID_SIMPLE_BLOCK",ID_SIMPLE_BLOCK,TYPE_BINARY),E_LAST)),ne_video_elements=create_ebml_element_desc(new Array(E_FIELD("ID_PIXEL_WIDTH",ID_PIXEL_WIDTH,TYPE_UINT,"video","pixel_width"),E_FIELD("ID_PIXEL_HEIGHT",ID_PIXEL_HEIGHT,TYPE_UINT,"video","pixel_height"),E_FIELD("ID_PIXEL_CROP_BOTTOM",ID_PIXEL_CROP_BOTTOM,TYPE_UINT,"video","pixel_crop_bottom"),E_FIELD("ID_PIXEL_CROP_TOP",ID_PIXEL_CROP_TOP,TYPE_UINT,"video","pixel_crop_top"),E_FIELD("ID_PIXEL_CROP_LEFT",ID_PIXEL_CROP_LEFT,TYPE_UINT,"video","pixel_crop_left"),E_FIELD("ID_PIXEL_CROP_RIGHT",ID_PIXEL_CROP_RIGHT,TYPE_UINT,"video","pixel_crop_right"),E_FIELD("ID_DISPLAY_WIDTH",ID_DISPLAY_WIDTH,TYPE_UINT,"video","display_width"),E_FIELD("ID_DISPLAY_HEIGHT",ID_DISPLAY_HEIGHT,TYPE_UINT,"video","display_height"),E_LAST)),ne_audio_elements=create_ebml_element_desc(new Array(E_FIELD("ID_SAMPLING_FREQUENCY",ID_SAMPLING_FREQUENCY,TYPE_FLOAT,"audio","sampling_frequency"),E_FIELD("ID_CHANNELS",ID_CHANNELS,TYPE_UINT,"audio","channels"),E_FIELD("ID_BIT_DEPTH",ID_BIT_DEPTH,TYPE_UINT,"audio","bit_depth"),E_LAST)),ne_track_entry_elements=create_ebml_element_desc(new Array(E_FIELD("ID_TRACK_NUMBER",ID_TRACK_NUMBER,TYPE_UINT,"track_entry","number"),E_FIELD("ID_TRACK_UID",ID_TRACK_UID,TYPE_UINT,"track_entry","uid"),E_FIELD("ID_TRACK_TYPE",ID_TRACK_TYPE,TYPE_UINT,"track_entry","type"),E_FIELD("ID_FLAG_ENABLED",ID_FLAG_ENABLED,TYPE_UINT,"track_entry","flag_enabled"),E_FIELD("ID_FLAG_DEFAULT",ID_FLAG_DEFAULT,TYPE_UINT,"track_entry","flag_default"),E_FIELD("ID_FLAG_LACING",ID_FLAG_LACING,TYPE_UINT,"track_entry","flag_lacing"),E_FIELD("ID_TRACK_TIMECODE_SCALE",ID_TRACK_TIMECODE_SCALE,TYPE_FLOAT,"track_entry","track_timecode_scale"),E_FIELD("ID_LANGUAGE",ID_LANGUAGE,TYPE_STRING,"track_entry","language"),E_FIELD("ID_CODEC_ID",ID_CODEC_ID,TYPE_STRING,"track_entry","codec_id"),E_FIELD("ID_CODEC_PRIVATE",ID_CODEC_PRIVATE,TYPE_BINARY,"track_entry","codec_private"),E_SINGLE_MASTER("ID_VIDEO",ID_VIDEO,TYPE_MASTER,"track_entry","video",ne_video_elements),E_SINGLE_MASTER("ID_AUDIO",ID_AUDIO,TYPE_MASTER,"track_entry","audio",ne_audio_elements),E_LAST)),ne_tracks_elements=create_ebml_element_desc(new Array(E_MASTER("ID_TRACK_ENTRY",ID_TRACK_ENTRY,TYPE_MASTER,"tracks","track_entry",ne_track_entry_elements),E_LAST)),ne_cue_track_positions_elements=create_ebml_element_desc(new Array(E_FIELD("ID_CUE_TRACK",ID_CUE_TRACK,TYPE_UINT,"cue_track_positions","track"),E_FIELD("ID_CUE_CLUSTER_POSITION",ID_CUE_CLUSTER_POSITION,TYPE_UINT,"cue_track_positions","cluster_position"),E_FIELD("ID_CUE_BLOCK_NUMBER",ID_CUE_BLOCK_NUMBER,TYPE_UINT,"cue_track_positions","block_number"),E_LAST)),ne_cue_point_elements=create_ebml_element_desc(new Array(E_FIELD("ID_CUE_TIME",ID_CUE_TIME,TYPE_UINT,"cue_point","time"),E_MASTER("ID_CUE_TRACK_POSITIONS",ID_CUE_TRACK_POSITIONS,TYPE_MASTER,"cue_point","cue_track_positions",ne_cue_track_positions_elements),E_LAST)),ne_cues_elements=create_ebml_element_desc(new Array(E_MASTER("ID_CUE_POINT",ID_CUE_POINT,TYPE_MASTER,"cues","cue_point",ne_cue_point_elements),E_LAST)),ne_segment_elements=create_ebml_element_desc(new Array(E_MASTER("ID_SEEK_HEAD",ID_SEEK_HEAD,TYPE_MASTER,"segment","seek_head",ne_seek_head_elements),E_SINGLE_MASTER("ID_INFO",ID_INFO,TYPE_MASTER,"segment","info",ne_info_elements),E_MASTER("ID_CLUSTER",ID_CLUSTER,TYPE_MASTER,"segment","cluster",ne_cluster_elements),E_SINGLE_MASTER("ID_TRACKS",ID_TRACKS,TYPE_MASTER,"segment","tracks",ne_tracks_elements),E_SINGLE_MASTER("ID_CUES",ID_CUES,TYPE_MASTER,"segment","cues",ne_cues_elements),E_LAST)),ne_top_level_elements=create_ebml_element_desc(new Array(E_SINGLE_MASTER("ID_EBML",ID_EBML,TYPE_MASTER,"nestegg","ebml",ne_ebml_elements),E_SINGLE_MASTER_O("ID_SEGMENT",ID_SEGMENT,TYPE_MASTER,"nestegg","segment",ne_segment_elements),E_LAST));function create_ebml_element_desc(_){for(var e=new Array,r=0;r<_.length;++r){var t=0,n=new ebml_element_desc;for(var i in n)"undefined"!==_[r][t]&&(n[i]=_[r][t++]);e.push(n)}return e}function ne_pool_init(_){return new pool_ctx}var buffer_8192=Arr(8192,0);function ne_io_read_skip(_,e){for(var r=size_t,t={val:buffer_8192},n=1;e>0&&1==(n=ne_io_read(_,t,r=e<t.val.length?e:t.val.length));)e-=r;return n}function ne_io_tell(_){return _.tell(_.userdata)}function ne_bare_read_vint(_,e,r,t){var n=int_,i={val:char_},a=1,o=128;if(1!=(n=ne_io_read(_,i,1)))return n;for(;a<8&&0==(i.val[0]&o);)o>>=1,a+=1;for(r&&(r.val=a),e.val=i.val[0],t==MASK_FIRST_BIT&&(e.val=i.val[0]&~o);--a;){if(1!=(n=ne_io_read(_,i,1)))return n;e.val<<=8,e.val|=i.val[0]}return 1}function ne_io_read(_,e,r){return _.read(e,r,_.userdata)}function ne_read_id(_,e,r){return ne_bare_read_vint(_,e,r,MASK_NONE)}function ne_read_vint(_,e,r){return ne_bare_read_vint(_,e,r,MASK_FIRST_BIT)}function ne_read_svint(_,e,r){var t=int_,n=[uint64_t],i=[uint64_t],a=new Array(63,8191,1048575,134217727,17179869183,2199023255551,0xffffffffffff,0x80000000000000);return 1!=(t=ne_bare_read_vint(_,n,i,MASK_FIRST_BIT))||(e[0]=n-a[i-1],r&&(r[0]=i)),t}function ne_read_uint(_,e,r){var t={val:char_},n=int_;if(0==r||r>8)return-1;if(1!=(n=ne_io_read(_,t,1)))return n;for(e[0]=t.val[0];--r;){if(1!=(n=ne_io_read(_,t,1)))return n;e[0]<<=8,e[0]|=t.val[0]}return 1}function ne_read_int(_,e,r){var t,n=[uint64_t],i=uint64_t;return 1!=(t=ne_read_uint(_,n,r))?t:(r<8?(i=1,n>=(i<<=8*r-1)?(i=1,i<<=8*r):i=0,e[0]=n-i):e[0]=n,1)}function ne_read_float(_,e,r){var t,n={u:[uint64_t],f:[float_],d:[double_]};return 4!=r&&8!=r?-1:1!=(t=ne_read_uint(_,n.u,r))?t:(e[0]=4==r?n.f=n.u:n.d=n.u,1)}function ne_read_string(_,e,r){var t,n={val:char_};if(0==r||r>LIMIT_STRING)return-1;if(1!=(t=ne_io_read(_.io,n,r)))return t;for(var i="",a=0;a<r;++a)i+=String.fromCharCode(n.val[a]);return n.val=i,e[0]=n.val,1}function ne_read_binary(_,e,r){return 0==r||r>LIMIT_BINARY?-1:(e.data={val:0},e.length=r,ne_io_read(_.io,e.data,r))}function ne_get_uint(_,e){return _.read?(assert(_.type==TYPE_UINT),e[0]=_.v.u,0):-1}function ne_get_string(_,e){return _.read?(assert(_.type==TYPE_STRING),e[0]=_.v.s,0):-1}function ne_is_ancestor_element(_,e){for(;e;e=e.previous)for(var r=e.node,t=0;r[t].id;++t)if(r[t].id==_)return 1;return 0}function ne_find_element(_,e){for(var r=e,t=0;r[t].id;++t)if(r[t].id==_)return r[t];return null}function ne_ctx_push(_,e,r){var t=new list_node;t.previous=_.ancestor,t.node=e,t.data=r,_.ancestor=t}function ne_ctx_pop(_){var e;e=_.ancestor,_.ancestor=e.previous,e=""}function ne_peek_element(_,e,r){var t=int_;return _.last_id&&_.last_size?(e&&(e[0]=_.last_id),r&&(r[0]=_.last_size),1):(_.last_id={val:_.last_id},t=ne_read_id(_.io,_.last_id,null),_.last_id=_.last_id.val,1!=t?t:(_.last_size={val:_.last_size},t=ne_read_vint(_.io,_.last_size,null),_.last_size=_.last_size.val,1!=t?t:(e&&(e[0]=_.last_id),r&&(r[0]=_.last_size),1)))}function ne_read_element(_,e,r){var t;return 1!=(t=ne_peek_element(_,e,r))?t:(_.last_id=0,_.last_size=0,1)}function ne_read_master(_,e){var r,t,n=new ebml_list_node;assert(e.type==TYPE_MASTER&&e.flags&DESC_FLAG_MULTI),_.ancestor.data[e.offset]&&(r=_.ancestor.data[e.offset]),n.id=e.id,n.data=new window[e.offset],(t=r.tail)&&(t.next=n),r.tail=n,r.head||(r.head=n),ne_ctx_push(_,e.children,n.data)}function ne_read_single_master(_,e){assert(e.type==TYPE_MASTER&&!(e.flags&DESC_FLAG_MULTI)),ne_ctx_push(_,e.children,_.ancestor.data[e.offset])}function ne_read_simple(_,e,r){var t,n=int_;if(_.ancestor.data[e.offset]&&(t=_.ancestor.data[e.offset]),t.read)return 0;switch(t.type=e.type,n=-1,e.type){case TYPE_UINT:t.v.u=[t.v.u],n=ne_read_uint(_.io,t.v.u,r),t.v.u=t.v.u[0];break;case TYPE_FLOAT:t.v.f=[t.v.f],n=ne_read_float(_.io,t.v.f,r),t.v.f=t.v.f[0];break;case TYPE_INT:t.v.i=[t.v.i],n=ne_read_int(_.io,t.v.i,r),t.v.i=t.v.i[0];break;case TYPE_STRING:t.v.s=[t.v.s],n=ne_read_string(_,t.v.s,r),t.v.s=t.v.s[0];break;case TYPE_BINARY:n=ne_read_binary(_,t.v.b,r);break;case TYPE_MASTER:case TYPE_UNKNOWN:assert(0)}return 1==n&&(t.read=1),n}function ne_parse(_,e){var r,t=int_,n=int64_t,i=[uint64_t],a=[uint64_t];if(!_.ancestor)return-1;for(;1==(t=ne_peek_element(_,i,a));)if(r=ne_find_element(i[0],_.ancestor.node)){if(r.flags&DESC_FLAG_SUSPEND){assert(r.type==TYPE_BINARY),t=1;break}if(1!=(t=ne_read_element(_,i,a)))break;if(r.flags&DESC_FLAG_OFFSET&&((n=_.ancestor.data[r.data_offset]={v:null}).v=ne_io_tell(_.io),n<0)){t=-1;break}if(r.type==TYPE_MASTER){r.flags&DESC_FLAG_MULTI?ne_read_master(_,r):ne_read_single_master(_,r);continue}if((t=ne_read_simple(_,r,a[0]))<0)break}else if(ne_is_ancestor_element(i,_.ancestor.previous)){if(e&&_.ancestor.node==e){t=1;break}ne_ctx_pop(_)}else{if(1!=(t=ne_read_element(_,i,a)))break;if(1!=(t=ne_io_read_skip(_.io,a[0])))break}if(1!=t)for(;_.ancestor;)ne_ctx_pop(_);return t}function ne_read_xiph_lace_value(_,e,r,t){var n=int_,i=[uint64_t];if(1!=(n=ne_read_uint(_,i,1)))return n;for(t[0]+=1,e[r+0]=i[0];255==i[0];){if(1!=(n=ne_read_uint(_,i,1)))return n;t[0]+=1,e[r+0]+=i[0]}return 1}function ne_read_xiph_lacing(_,e,r,t,n){for(var i=int_,a=0,o=0;--t;){if(1!=(i=ne_read_xiph_lace_value(_,n,a,r)))return i;o+=n[a],a+=1}return r[0]+o>e?-1:(n[a]=e-r[0]-o,1)}function ne_read_ebml_lacing(_,e,r,t,n){var i=int_,a=[uint64_t],o=uint64_t,s=[uint64_t],f=[int64_t],d=0;if(1!=(i=ne_read_vint(_,a,s)))return i;for(r[0]+=s[0],n[d]=a[0],o=n[d],d+=1,t-=1;--t;){if(1!=(i=ne_read_svint(_,f,s)))return i;r[0]+=s[0],n[d]=n[d-1]+f[0],o+=n[d],d+=1}return r[0]+o>e?-1:(n[d]=e-r[0]-o,1)}function ne_get_timecode_scale(_){var e=[uint64_t];return 0!=ne_get_uint(_.segment.info.timecode_scale,e)&&(e[0]=1e6),e[0]}function ne_find_track_entry(_,e){for(var r=0,t=_.segment.tracks.track_entry.head;t;){if(assert(t.id==ID_TRACK_ENTRY),e==r)return t.data;r+=1,t=t.next}return null}var frame_sizes_256=Arr(256,0);function ne_read_block(_,e,r,t){var n,i,a,o,s,f,d=int_,E=[int64_t],c={val:uint64_t},l={val:uint64_t},m=frame_sizes_256,A=[uint64_t],u=[uint64_t],p=[uint64_t],T=uint64_t,y=int_,b=[0];if(t[0]=null,r>LIMIT_BLOCK)return-1;if(1!=(d=ne_read_vint(_.io,c,l)))return d;if(0==c.val||c.val>_.track_count)return-1;if(b[0]+=l.val,1!=(d=ne_read_int(_.io,E,2)))return d;if(b[0]+=2,1!=(d=ne_read_uint(_.io,u,1)))return d;switch(b[0]+=1,p[0]=0,f=(u[0]&BLOCK_FLAGS_LACING)>>1){case LACING_NONE:p[0]=1;break;case LACING_XIPH:case LACING_FIXED:case LACING_EBML:if(1!=(d=ne_read_uint(_.io,p,1)))return d;b[0]+=1,p[0]+=1}if(p[0]>256)return-1;switch(f){case LACING_NONE:m[0]=r-b[0];break;case LACING_XIPH:if(1==p)return-1;if(1!=(d=ne_read_xiph_lacing(_.io,r,b,p,m)))return d;break;case LACING_FIXED:if((r-b[0])%p[0])return-1;for(y=0;y<p[0];++y)m[y]=(r-b[0])/p>>0;break;case LACING_EBML:if(1==p[0])return-1;if(1!=(d=ne_read_ebml_lacing(_.io,r,b,p,m)))return d}for(T=b[0],y=0;y<p[0];++y)T+=m[y];if(T>r)return-1;if(!ne_find_track_entry(_,c.val-1))return-1;if(1,s=ne_get_timecode_scale(_),assert(_.segment.cluster.tail.id==ID_CLUSTER),0!=ne_get_uint(_.segment.cluster.tail.data.timecode,A))return-1;if((n=E[0]+A[0])<0)return-1;for((i=new nestegg_packet).track=c.val-1,i.timecode=n*s*1,o=null,y=0;y<p[0];++y){if(m[y]>LIMIT_FRAME)return nestegg_free_packet(i),-1;if((a=new frame).data=[],a.length=m[y],a.data={val:a.data},d=ne_io_read(_.io,a.data,m[y]),a.data=a.data.val,1!=d)return a.data=null,a=null,nestegg_free_packet(i),-1;o?o.next=a:i.frame=a,o=a}return t[0]=i,1}function ne_null_log_callback(_,e,r,t){}function ne_is_suspend_element(_){return _==ID_SIMPLE_BLOCK||_==ID_BLOCK?1:0}var ctx_=new nestegg;function nestegg_init(_,e,r){var t,n=[0],i=[0],a=[uint64_t],o=[char_],s=ctx_;if(!(e.read&&e.seek&&e.tell))return-1;if(s.io=e,s.alloc_pool=ne_pool_init(),1!=ne_peek_element(s,n,null))return nestegg_destroy(s),-1;if(n[0]!=ID_EBML)return nestegg_destroy(s),-1;if(ne_ctx_push(s,ne_top_level_elements,s),1!=ne_parse(s,null))return nestegg_destroy(s),-1;if(0!=ne_get_uint(s.ebml.ebml_read_version,i)&&(i=1),1!=i[0])return nestegg_destroy(s),-1;if(0!=ne_get_string(s.ebml.doctype,o)&&(o[0]="matroska"),0!=strcmp(o[0],"webm"))return nestegg_destroy(s),-1;if(0!=ne_get_uint(s.ebml.doctype_read_version,a)&&(a[0]=1),a[0]<1||a[0]>2)return nestegg_destroy(s),-1;if(!s.segment.tracks.track_entry.head)return nestegg_destroy(s),-1;for(t=s.segment.tracks.track_entry.head,s.track_count=0;t;)s.track_count+=1,t=t.next;return _[0]=s,0}function nestegg_destroy(_){}function nestegg_track_count(_,e){return e[0]=_.track_count,0}function nestegg_track_type(_,e){var r=[uint64_t],t=ne_find_track_entry(_,e);return t?0!=ne_get_uint(t.type,r)?-1:r[0]&TRACK_TYPE_VIDEO?NESTEGG_TRACK_VIDEO:r[0]&TRACK_TYPE_AUDIO?NESTEGG_TRACK_AUDIO:-1:-1}function nestegg_track_codec_id(_,e){var r=[char_],t=ne_find_track_entry(_,e);return t?0!=ne_get_string(t.codec_id,r)?-1:0==strcmp(r[0],TRACK_ID_VP8)?NESTEGG_CODEC_VP8:0==strcmp(r[0],TRACK_ID_VORBIS)?NESTEGG_CODEC_VORBIS:-1:-1}function nestegg_track_video_params(_,e,r){var t=[uint64_t],n=ne_find_track_entry(_,e);return n?nestegg_track_type(_,e)!=NESTEGG_TRACK_VIDEO||0!=ne_get_uint(n.video.pixel_width,t)?-1:(r.width=t[0],0!=ne_get_uint(n.video.pixel_height,t)?-1:(r.height=t[0],t[0]=0,ne_get_uint(n.video.pixel_crop_bottom,t),r.crop_bottom=t[0],t[0]=0,ne_get_uint(n.video.pixel_crop_top,t),r.crop_top=t[0],t[0]=0,ne_get_uint(n.video.pixel_crop_left,t),r.crop_left=t[0],t[0]=0,ne_get_uint(n.video.pixel_crop_right,t),r.crop_right=t[0],t[0]=r.width,ne_get_uint(n.video.display_width,t),r.display_width=t[0],t[0]=r.height,ne_get_uint(n.video.display_height,t),r.display_height=t[0],0)):-1}function nestegg_read_packet(_,e){var r=int_,t=[uint64_t],n=[uint64_t];for(e[0]=null;;){if(1!=(r=ne_peek_element(_,t,n)))return r;if(ne_is_suspend_element(t))return 1!=(r=ne_read_element(_,t,n))?r:r=ne_read_block(_,t,n[0],e);if(1!=(r=ne_parse(_,null)))return r}return 1}function nestegg_free_packet(_){for(var e;_.frame;)e=_.frame,_.frame=e.next,e.data="",e="";_=""}function nestegg_packet_track(_,e){return e[0]=_[0].track,0}function nestegg_packet_count(_,e){var r=_[0].frame;for(e[0]=0;r;)e[0]+=1,r=r.next;return 0}function nestegg_packet_data(_,e,r,t){var n=_[0].frame,i=0;for(r[0]=null,t[0]=0;n;){if(i==e)return r[0]=n.data,t[0]=n.length,0;i+=1,n=n.next}return-1}VPX_IMAGE_ABI_VERSION=1;var VPX_IMG_FMT_PLANAR=256,VPX_IMG_FMT_UV_FLIP=512,VPX_IMG_FMT_HAS_ALPHA=1024,VPX_IMG_FMT_NONE=0,VPX_IMG_FMT_RGB24=1,VPX_IMG_FMT_RGB32=2,VPX_IMG_FMT_RGB565=3,VPX_IMG_FMT_RGB555=4,VPX_IMG_FMT_UYVY=5,VPX_IMG_FMT_YUY2=6,VPX_IMG_FMT_YVYU=7,VPX_IMG_FMT_BGR24=8,VPX_IMG_FMT_RGB32_LE=9,VPX_IMG_FMT_ARGB=10,VPX_IMG_FMT_ARGB_LE=11,VPX_IMG_FMT_RGB565_LE=12,VPX_IMG_FMT_RGB555_LE=13,VPX_IMG_FMT_YV12=VPX_IMG_FMT_PLANAR|VPX_IMG_FMT_UV_FLIP|1,VPX_IMG_FMT_I420=2|VPX_IMG_FMT_PLANAR,VPX_IMG_FMT_VPXYV12=VPX_IMG_FMT_PLANAR|VPX_IMG_FMT_UV_FLIP|3,VPX_IMG_FMT_VPXI420=4|VPX_IMG_FMT_PLANAR,IMG_FMT_PLANAR=VPX_IMG_FMT_PLANAR,IMG_FMT_UV_FLIP=VPX_IMG_FMT_UV_FLIP,IMG_FMT_HAS_ALPHA=VPX_IMG_FMT_HAS_ALPHA,IMG_FMT_NONE=VPX_IMG_FMT_NONE,IMG_FMT_RGB24=VPX_IMG_FMT_RGB24,IMG_FMT_RGB32=VPX_IMG_FMT_RGB32,IMG_FMT_RGB565=VPX_IMG_FMT_RGB565,IMG_FMT_RGB555=VPX_IMG_FMT_RGB555,IMG_FMT_UYVY=VPX_IMG_FMT_UYVY,IMG_FMT_YUY2=VPX_IMG_FMT_YUY2,IMG_FMT_YVYU=VPX_IMG_FMT_YVYU,IMG_FMT_BGR24=VPX_IMG_FMT_BGR24,IMG_FMT_RGB32_LE=VPX_IMG_FMT_RGB32_LE,IMG_FMT_ARGB=VPX_IMG_FMT_ARGB,IMG_FMT_ARGB_LE=VPX_IMG_FMT_ARGB_LE,IMG_FMT_RGB565_LE=VPX_IMG_FMT_RGB565_LE,IMG_FMT_RGB555_LE=VPX_IMG_FMT_RGB555_LE,IMG_FMT_YV12=VPX_IMG_FMT_YV12,IMG_FMT_I420=VPX_IMG_FMT_I420,IMG_FMT_VPXYV12=VPX_IMG_FMT_VPXYV12,IMG_FMT_VPXI420=VPX_IMG_FMT_VPXI420;function img_alloc_helper(_,e,r,t,n,i){var a,o,s=int_,f=int_,d=int_,E=int_,c=int_;switch(n||(n=1),n&n-1&&alert("goto fail"),e){case VPX_IMG_FMT_RGB32:case VPX_IMG_FMT_RGB32_LE:case VPX_IMG_FMT_ARGB:case VPX_IMG_FMT_ARGB_LE:E=32;break;case VPX_IMG_FMT_RGB24:case VPX_IMG_FMT_BGR24:E=24;break;case VPX_IMG_FMT_RGB565:case VPX_IMG_FMT_RGB565_LE:case VPX_IMG_FMT_RGB555:case VPX_IMG_FMT_RGB555_LE:case VPX_IMG_FMT_UYVY:case VPX_IMG_FMT_YUY2:case VPX_IMG_FMT_YVYU:E=16;break;case VPX_IMG_FMT_I420:case VPX_IMG_FMT_YV12:case VPX_IMG_FMT_VPXI420:case VPX_IMG_FMT_VPXYV12:E=12;break;default:E=16}switch(e){case VPX_IMG_FMT_I420:case VPX_IMG_FMT_YV12:case VPX_IMG_FMT_VPXI420:case VPX_IMG_FMT_VPXYV12:f=1;break;default:f=0}switch(e){case VPX_IMG_FMT_I420:case VPX_IMG_FMT_YV12:case VPX_IMG_FMT_VPXI420:case VPX_IMG_FMT_VPXYV12:d=1;break;default:d=0}return o=r+(c=(1<<f)-1)&~c,a=t+(c=(1<<d)-1)&~c,s=(s=e&VPX_IMG_FMT_PLANAR?o:E*o/8)+n-1&~(n-1),_||((_=new vpx_image_t)||alert("goto fail"),_.self_allocd=1),_.img_data=i,i||(_.img_data=malloc(e&VPX_IMG_FMT_PLANAR?a*o*E/8:a*s,0),_.img_data_owner=1),_.img_data||alert("goto fail"),_.fmt=_.fmt=e,_.w=_.w=o,_.h=_.h=a,_.x_chroma_shift=_.x_chroma_shift=f,_.y_chroma_shift=_.y_chroma_shift=d,_.bps=_.bps=E,_.stride[VPX_PLANE_Y]=_.stride[VPX_PLANE_ALPHA]=s,_.stride[VPX_PLANE_U]=_.stride[VPX_PLANE_V]=s>>f,vpx_img_set_rect(_,0,0,r,t)?(vpx_img_free(_),null):_}function vpx_img_alloc(_,e,r,t,n){return img_alloc_helper(_,e,r,t,n,null)}function vpx_img_set_rect(_,e,r,t,n){var i=char_,a=0;return e+t<=_.w&&r+n<=_.h?(_.d_w=_.d_w=t,_.d_h=_.d_h=n,_.fmt&VPX_IMG_FMT_PLANAR?(i=_.img_data,a=_.img_data_off,_.fmt&VPX_IMG_FMT_HAS_ALPHA&&(_.planes[VPX_PLANE_ALPHA]=i,_.planes_off[VPX_PLANE_ALPHA]=a+e+r*_.stride[VPX_PLANE_ALPHA],a+=_.h*_.stride[VPX_PLANE_ALPHA]),_.planes[VPX_PLANE_Y]=i,_.planes_off[VPX_PLANE_Y]=a+e+r*_.stride[VPX_PLANE_Y],a+=_.h*_.stride[VPX_PLANE_Y],_.fmt&VPX_IMG_FMT_UV_FLIP?(_.planes[VPX_PLANE_V]=i,_.planes_off[VPX_PLANE_V]=a+(e>>_.x_chroma_shift)+(r>>_.y_chroma_shift)*_.stride[VPX_PLANE_V],a+=(_.h>>_.y_chroma_shift)*_.stride[VPX_PLANE_V],_.planes[VPX_PLANE_U]=i,_.planes_off[VPX_PLANE_U]=a+(e>>_.x_chroma_shift)+(r>>_.y_chroma_shift)*_.stride[VPX_PLANE_U]):(_.planes[VPX_PLANE_U]=i,_.planes_off[VPX_PLANE_U]=a+(e>>_.x_chroma_shift)+(r>>_.y_chroma_shift)*_.stride[VPX_PLANE_U],a+=(_.h>>_.y_chroma_shift)*_.stride[VPX_PLANE_U],_.planes[VPX_PLANE_V]=i,_.planes_off[VPX_PLANE_V]=a+(e>>_.x_chroma_shift)+(r>>_.y_chroma_shift)*_.stride[VPX_PLANE_V])):(_.planes[VPX_PLANE_PACKED]=_.img_data,_.img_data_of,parseInt(e*_.bps/8+r*_.stride[VPX_PLANE_PACKED],10)),0):-1}function vpx_img_free(_){_&&(_.img_data&&_.img_data_owner&&(_.img_data=""),_.self_allocd&&(_=""))}var bool_decoder=function(){this.input=char_,this.input_off=0,this.input_len=size_t,this.range=int_,this.value=int_,this.bit_count=int_};function init_bool_decoder(_,e,r,t){t>=2?(_.value=e[r+0]<<8|e[r+1],_.input=e,_.input_off=r+2,_.input_len=t-2):(_.value=0,_.input=null,_.input_len=0),_.range=255,_.bit_count=0}function bool_get(_,e){var r=1+((_.range-1)*e>>8),t=r<<8,n=int_;for(_.value>=t?(n=1,_.range-=r,_.value-=t):(n=0,_.range=r);_.range<128;)_.value<<=1,_.range<<=1,8==++_.bit_count&&(_.bit_count=0,_.input_len&&(_.value|=_.input[_.input_off++],_.input_len--));return n}function bool_get_bit(_){return bool_get(_,128)}function bool_get_uint(_,e){var r=0,t=int_;for(t=e-1;t>=0;t--)r|=bool_get_bit(_)<<t;return r}function bool_get_int(_,e){var r=0,t=int_;for(t=e-1;t>=0;t--)r|=bool_get_bit(_)<<t;return bool_get_bit(_)?-r:r}function bool_maybe_get_int(_,e){return bool_get_bit(_)?bool_get_int(_,e):0}function bool_read_tree(_,e,r,t){var n=0;if(void 0!==t)for(;(n=e[n+bool_get(_,r[t+(n>>1)])])>0;);else for(;(n=e[n+bool_get(_,r[n>>1])])>0;);return-n}function BITS_MASK(_){return(1<<_)-1}function BITS_GET(_,e,r){return _>>e&BITS_MASK(r)}var vp8_frame_hdr=function(){this.is_keyframe=int_,this.is_experimental=int_,this.version=int_,this.is_shown=int_,this.part0_sz=int_,this.kf=new Object({w:int_,h:int_,scale_w:int_,scale_h:int_}),this.frame_size_updated=int_},MB_FEATURE_TREE_PROBS=3,MAX_MB_SEGMENTS=4,vp8_segment_hdr=function(){this.enabled=int_,this.update_data=int_,this.update_map=int_,this.abs_=int_,this.tree_probs=new Array(MB_FEATURE_TREE_PROBS),this.lf_level=new Array(MAX_MB_SEGMENTS),this.quant_idx=new Array(MAX_MB_SEGMENTS)},BLOCK_CONTEXTS=4,vp8_loopfilter_hdr=function(){this.use_simple=int_,this.level=int_,this.sharpness=int_,this.delta_enabled=int_,this.ref_delta=new Array(BLOCK_CONTEXTS),this.mode_delta=new Array(BLOCK_CONTEXTS)},MAX_PARTITIONS=8,vp8_token_hdr=function(){this.partitions=int_,this.partition_sz=new Array(MAX_PARTITIONS)},vp8_quant_hdr=function(){this.q_index=int_,this.delta_update=int_,this.y1_dc_delta_q=int_,this.y2_dc_delta_q=int_,this.y2_ac_delta_q=int_,this.uv_dc_delta_q=int_,this.uv_ac_delta_q=int_},vp8_reference_hdr=function(){this.refresh_last=int_,this.refresh_gf=int_,this.refresh_arf=int_,this.copy_gf=int_,this.copy_arf=int_,this.sign_bias=new Array(4),this.refresh_entropy=int_},BLOCK_TYPES=4,PREV_COEF_CONTEXTS=3,COEF_BANDS=8,ENTROPY_NODES=11,coeff_probs_table_t=function(){return ArrM(new Array(BLOCK_TYPES,COEF_BANDS,PREV_COEF_CONTEXTS,ENTROPY_NODES),char_)},MV_PROB_CNT=19,mv_component_probs_t=function(){return new Array(MV_PROB_CNT)},Arr_1056=Arr(1056,0),vp8_entropy_hdr=function(){this.coeff_probs=new coeff_probs_table_t,this.coeff_probs_=Arr(1056,0),this.mv_probs=Arr_new(2,mv_component_probs_t),this.coeff_skip_enabled=int_,this.coeff_skip_prob=char_,this.y_mode_probs=new Array(0,0,0,0),this.uv_mode_probs=new Array(0,0,0),this.prob_inter=char_,this.prob_last=char_,this.prob_gf=char_},CURRENT_FRAME=0,LAST_FRAME=1,GOLDEN_FRAME=2,ALTREF_FRAME=3,NUM_REF_FRAMES=4,filter_t=function(){return new Array(6)},mv=function(){this.d={x:int16_t,y:int16_t}},mb_base_info=function(){this.y_mode=char_,this.uv_mode=char_,this.segment_id=char_,this.ref_frame=char_,this.skip_coeff=char_,this.need_mc_border=char_,this.partitioning=null,this.mv=new mv,this.eob_mask=int_},mb_info=function(){this.base=new mb_base_info,this.splitt=new Object({mvs:Arr_new(16,mv),modes:new Array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)})},token_entropy_ctx_t=function(){return new Array(9)},token_decoder=function(){this.bool=new bool_decoder,this.left_token_entropy_ctx=new token_entropy_ctx_t,this.coeffs=short_},TOKEN_BLOCK_Y1=0,TOKEN_BLOCK_UV=1,TOKEN_BLOCK_Y2=2,TOKEN_BLOCK_TYPES=3,dequant_factors=function(){this.quant_idx=int_,this.factor=ArrM(new Array(TOKEN_BLOCK_TYPES,2),short_)},ref_cnt_img=function(){this.img=new vpx_image_t,this.ref_cnt=int_},vp8_decoder_ctx=function(){this.error=[],this.frame_cnt=int_,this.frame_hdr=new vp8_frame_hdr,this.segment_hdr=new vp8_segment_hdr,this.loopfilter_hdr=new vp8_loopfilter_hdr,this.token_hdr=new vp8_token_hdr,this.quant_hdr=new vp8_quant_hdr,this.reference_hdr=new vp8_reference_hdr,this.entropy_hdr=new vp8_entropy_hdr,this.saved_entropy=new vp8_entropy_hdr,this.saved_entropy_valid=int_,this.mb_rows=int_,this.mb_cols=int_,this.mb_info_storage=null,this.mb_info_storage_off=0,this.mb_info_storage_object=mb_info,this.mb_info_rows_storage=null,this.mb_info_rows_storage_off=0,this.mb_info_rows_storage_object=mb_info,this.mb_info_rows=null,this.mb_info_rows_off=0,this.above_token_entropy_ctx=null,this.above_token_entropy_ctx_object=token_entropy_ctx_t,this.tokens=Arr_new(MAX_PARTITIONS,token_decoder),this.dequant_factors=Arr_new(MAX_MB_SEGMENTS,dequant_factors),this.frame_strg=Arr_new(NUM_REF_FRAMES,ref_cnt_img),this.ref_frames=Arr_new(NUM_REF_FRAMES,ref_cnt_img),this.ref_frame_offsets=new Array(0,0,0,0),this.ref_frame_offsets_=new Array(0,0,0,0),this.subpixel_filters=new filter_t};function CLAMP_255(_){return _<0?0:_>255?255:_}function vp8_dixie_walsh(_,e,r,t){var n=int_,i=int_,a=int_,o=int_,s=int_,f=int_,d=int_,E=int_,c=int_,l=_,m=e,A=r,u=t;for(n=0;n<4;n++)i=l[m+0]+l[m+12],a=l[m+4]+l[m+8],o=l[m+4]-l[m+8],s=l[m+0]-l[m+12],A[u+0]=i+a,A[u+4]=o+s,A[u+8]=i-a,A[u+12]=s-o,m++,u++;for(l=r,m=t,A=r,u=t,n=0;n<4;n++)f=(i=l[m+0]+l[m+3])+(a=l[m+1]+l[m+2]),d=(o=l[m+1]-l[m+2])+(s=l[m+0]-l[m+3]),E=i-a,c=s-o,A[u+0]=f+3>>3,A[u+1]=d+3>>3,A[u+2]=E+3>>3,A[u+3]=c+3>>3,m+=4,u+=4}var cospi8sqrt2minus1=20091,sinpi8sqrt2=35468;function idct_columns(_,e,r,t){var n=int_,i=int_,a=int_,o=int_,s=int_,f=_,d=e,E=r,c=t;for(n=0;n<4;n++)i=f[d+0]+f[d+8],a=f[d+0]-f[d+8],o=(f[d+4]*sinpi8sqrt2>>16)-(f[d+12]+(f[d+12]*cospi8sqrt2minus1>>16)),s=f[d+4]+(f[d+4]*cospi8sqrt2minus1>>16)+(f[d+12]*sinpi8sqrt2>>16),E[c+0]=i+s,E[c+12]=i-s,E[c+4]=a+o,E[c+8]=a-o,d++,c++}var tmp_2=Arr(16,0);function vp8_dixie_idct_add(_,e,r,t,n,i,a){var o=int_,s=int_,f=int_,d=int_,E=int_;for(idct_columns(i,a,tmp_2,0),i=tmp_2,a=0,o=0;o<4;o++)s=i[a+0]+i[a+2],f=i[a+0]-i[a+2],d=(i[a+1]*sinpi8sqrt2>>16)-(i[a+3]+(i[a+3]*cospi8sqrt2minus1>>16)),E=i[a+1]+(i[a+1]*cospi8sqrt2minus1>>16)+(i[a+3]*sinpi8sqrt2>>16),_[e+0]=r[t+0]+(s+E+4>>3),_[e+3]=r[t+3]+(s-E+4>>3),_[e+1]=r[t+1]+(f+d+4>>3),_[e+2]=r[t+2]+(f-d+4>>3),a+=4,e+=n,t+=n}var k_coeff_entropy_update_probs=new Array(new Array(new Array(new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(176,246,255,255,255,255,255,255,255,255,255),new Array(223,241,252,255,255,255,255,255,255,255,255),new Array(249,253,253,255,255,255,255,255,255,255,255)),new Array(new Array(255,244,252,255,255,255,255,255,255,255,255),new Array(234,254,254,255,255,255,255,255,255,255,255),new Array(253,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,246,254,255,255,255,255,255,255,255,255),new Array(239,253,254,255,255,255,255,255,255,255,255),new Array(254,255,254,255,255,255,255,255,255,255,255)),new Array(new Array(255,248,254,255,255,255,255,255,255,255,255),new Array(251,255,254,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,253,254,255,255,255,255,255,255,255,255),new Array(251,254,254,255,255,255,255,255,255,255,255),new Array(254,255,254,255,255,255,255,255,255,255,255)),new Array(new Array(255,254,253,255,254,255,255,255,255,255,255),new Array(250,255,254,255,254,255,255,255,255,255,255),new Array(254,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255))),new Array(new Array(new Array(217,255,255,255,255,255,255,255,255,255,255),new Array(225,252,241,253,255,255,254,255,255,255,255),new Array(234,250,241,250,253,255,253,254,255,255,255)),new Array(new Array(255,254,255,255,255,255,255,255,255,255,255),new Array(223,254,254,255,255,255,255,255,255,255,255),new Array(238,253,254,254,255,255,255,255,255,255,255)),new Array(new Array(255,248,254,255,255,255,255,255,255,255,255),new Array(249,254,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,253,255,255,255,255,255,255,255,255,255),new Array(247,254,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,253,254,255,255,255,255,255,255,255,255),new Array(252,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,254,254,255,255,255,255,255,255,255,255),new Array(253,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,254,253,255,255,255,255,255,255,255,255),new Array(250,255,255,255,255,255,255,255,255,255,255),new Array(254,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255))),new Array(new Array(new Array(186,251,250,255,255,255,255,255,255,255,255),new Array(234,251,244,254,255,255,255,255,255,255,255),new Array(251,251,243,253,254,255,254,255,255,255,255)),new Array(new Array(255,253,254,255,255,255,255,255,255,255,255),new Array(236,253,254,255,255,255,255,255,255,255,255),new Array(251,253,253,254,254,255,255,255,255,255,255)),new Array(new Array(255,254,254,255,255,255,255,255,255,255,255),new Array(254,254,254,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,254,255,255,255,255,255,255,255,255,255),new Array(254,254,255,255,255,255,255,255,255,255,255),new Array(254,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(254,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255))),new Array(new Array(new Array(248,255,255,255,255,255,255,255,255,255,255),new Array(250,254,252,254,255,255,255,255,255,255,255),new Array(248,254,249,253,255,255,255,255,255,255,255)),new Array(new Array(255,253,253,255,255,255,255,255,255,255,255),new Array(246,253,253,255,255,255,255,255,255,255,255),new Array(252,254,251,254,254,255,255,255,255,255,255)),new Array(new Array(255,254,252,255,255,255,255,255,255,255,255),new Array(248,254,253,255,255,255,255,255,255,255,255),new Array(253,255,254,254,255,255,255,255,255,255,255)),new Array(new Array(255,251,254,255,255,255,255,255,255,255,255),new Array(245,251,254,255,255,255,255,255,255,255,255),new Array(253,253,254,255,255,255,255,255,255,255,255)),new Array(new Array(255,251,253,255,255,255,255,255,255,255,255),new Array(252,253,254,255,255,255,255,255,255,255,255),new Array(255,254,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,252,255,255,255,255,255,255,255,255,255),new Array(249,255,254,255,255,255,255,255,255,255,255),new Array(255,255,254,255,255,255,255,255,255,255,255)),new Array(new Array(255,255,253,255,255,255,255,255,255,255,255),new Array(250,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)),new Array(new Array(255,255,255,255,255,255,255,255,255,255,255),new Array(254,255,255,255,255,255,255,255,255,255,255),new Array(255,255,255,255,255,255,255,255,255,255,255)))),k_default_y_mode_probs=new Array(112,86,140,37),k_default_uv_mode_probs=new Array(162,101,204),k_default_coeff_probs=new Array(new Array(new Array(new Array(128,128,128,128,128,128,128,128,128,128,128),new Array(128,128,128,128,128,128,128,128,128,128,128),new Array(128,128,128,128,128,128,128,128,128,128,128)),new Array(new Array(253,136,254,255,228,219,128,128,128,128,128),new Array(189,129,242,255,227,213,255,219,128,128,128),new Array(106,126,227,252,214,209,255,255,128,128,128)),new Array(new Array(1,98,248,255,236,226,255,255,128,128,128),new Array(181,133,238,254,221,234,255,154,128,128,128),new Array(78,134,202,247,198,180,255,219,128,128,128)),new Array(new Array(1,185,249,255,243,255,128,128,128,128,128),new Array(184,150,247,255,236,224,128,128,128,128,128),new Array(77,110,216,255,236,230,128,128,128,128,128)),new Array(new Array(1,101,251,255,241,255,128,128,128,128,128),new Array(170,139,241,252,236,209,255,255,128,128,128),new Array(37,116,196,243,228,255,255,255,128,128,128)),new Array(new Array(1,204,254,255,245,255,128,128,128,128,128),new Array(207,160,250,255,238,128,128,128,128,128,128),new Array(102,103,231,255,211,171,128,128,128,128,128)),new Array(new Array(1,152,252,255,240,255,128,128,128,128,128),new Array(177,135,243,255,234,225,128,128,128,128,128),new Array(80,129,211,255,194,224,128,128,128,128,128)),new Array(new Array(1,1,255,128,128,128,128,128,128,128,128),new Array(246,1,255,128,128,128,128,128,128,128,128),new Array(255,128,128,128,128,128,128,128,128,128,128))),new Array(new Array(new Array(198,35,237,223,193,187,162,160,145,155,62),new Array(131,45,198,221,172,176,220,157,252,221,1),new Array(68,47,146,208,149,167,221,162,255,223,128)),new Array(new Array(1,149,241,255,221,224,255,255,128,128,128),new Array(184,141,234,253,222,220,255,199,128,128,128),new Array(81,99,181,242,176,190,249,202,255,255,128)),new Array(new Array(1,129,232,253,214,197,242,196,255,255,128),new Array(99,121,210,250,201,198,255,202,128,128,128),new Array(23,91,163,242,170,187,247,210,255,255,128)),new Array(new Array(1,200,246,255,234,255,128,128,128,128,128),new Array(109,178,241,255,231,245,255,255,128,128,128),new Array(44,130,201,253,205,192,255,255,128,128,128)),new Array(new Array(1,132,239,251,219,209,255,165,128,128,128),new Array(94,136,225,251,218,190,255,255,128,128,128),new Array(22,100,174,245,186,161,255,199,128,128,128)),new Array(new Array(1,182,249,255,232,235,128,128,128,128,128),new Array(124,143,241,255,227,234,128,128,128,128,128),new Array(35,77,181,251,193,211,255,205,128,128,128)),new Array(new Array(1,157,247,255,236,231,255,255,128,128,128),new Array(121,141,235,255,225,227,255,255,128,128,128),new Array(45,99,188,251,195,217,255,224,128,128,128)),new Array(new Array(1,1,251,255,213,255,128,128,128,128,128),new Array(203,1,248,255,255,128,128,128,128,128,128),new Array(137,1,177,255,224,255,128,128,128,128,128))),new Array(new Array(new Array(253,9,248,251,207,208,255,192,128,128,128),new Array(175,13,224,243,193,185,249,198,255,255,128),new Array(73,17,171,221,161,179,236,167,255,234,128)),new Array(new Array(1,95,247,253,212,183,255,255,128,128,128),new Array(239,90,244,250,211,209,255,255,128,128,128),new Array(155,77,195,248,188,195,255,255,128,128,128)),new Array(new Array(1,24,239,251,218,219,255,205,128,128,128),new Array(201,51,219,255,196,186,128,128,128,128,128),new Array(69,46,190,239,201,218,255,228,128,128,128)),new Array(new Array(1,191,251,255,255,128,128,128,128,128,128),new Array(223,165,249,255,213,255,128,128,128,128,128),new Array(141,124,248,255,255,128,128,128,128,128,128)),new Array(new Array(1,16,248,255,255,128,128,128,128,128,128),new Array(190,36,230,255,236,255,128,128,128,128,128),new Array(149,1,255,128,128,128,128,128,128,128,128)),new Array(new Array(1,226,255,128,128,128,128,128,128,128,128),new Array(247,192,255,128,128,128,128,128,128,128,128),new Array(240,128,255,128,128,128,128,128,128,128,128)),new Array(new Array(1,134,252,255,255,128,128,128,128,128,128),new Array(213,62,250,255,255,128,128,128,128,128,128),new Array(55,93,255,128,128,128,128,128,128,128,128)),new Array(new Array(128,128,128,128,128,128,128,128,128,128,128),new Array(128,128,128,128,128,128,128,128,128,128,128),new Array(128,128,128,128,128,128,128,128,128,128,128))),new Array(new Array(new Array(202,24,213,235,186,191,220,160,240,175,255),new Array(126,38,182,232,169,184,228,174,255,187,128),new Array(61,46,138,219,151,178,240,170,255,216,128)),new Array(new Array(1,112,230,250,199,191,247,159,255,255,128),new Array(166,109,228,252,211,215,255,174,128,128,128),new Array(39,77,162,232,172,180,245,178,255,255,128)),new Array(new Array(1,52,220,246,198,199,249,220,255,255,128),new Array(124,74,191,243,183,193,250,221,255,255,128),new Array(24,71,130,219,154,170,243,182,255,255,128)),new Array(new Array(1,182,225,249,219,240,255,224,128,128,128),new Array(149,150,226,252,216,205,255,171,128,128,128),new Array(28,108,170,242,183,194,254,223,255,255,128)),new Array(new Array(1,81,230,252,204,203,255,192,128,128,128),new Array(123,102,209,247,188,196,255,233,128,128,128),new Array(20,95,153,243,164,173,255,203,128,128,128)),new Array(new Array(1,222,248,255,216,213,128,128,128,128,128),new Array(168,175,246,252,235,205,255,255,128,128,128),new Array(47,116,215,255,211,212,255,255,128,128,128)),new Array(new Array(1,121,236,253,212,214,255,255,128,128,128),new Array(141,84,213,252,201,202,255,219,128,128,128),new Array(42,80,160,240,162,185,255,205,128,128,128)),new Array(new Array(1,1,255,128,128,128,128,128,128,128,128),new Array(244,1,255,128,128,128,128,128,128,128,128),new Array(238,1,255,128,128,128,128,128,128,128,128)))),k_mv_entropy_update_probs=new Array(new Array(237,246,253,253,254,254,254,254,254,254,254,254,254,254,250,250,252,254,254),new Array(231,243,245,253,254,254,254,254,254,254,254,254,254,254,251,251,254,254,254)),k_default_mv_probs=function(){return new Array(new Array(162,128,225,146,172,147,214,39,156,128,129,132,75,145,178,206,239,254,254),new Array(164,128,204,170,119,235,140,230,228,128,130,130,74,148,180,203,236,254,254))},dc_q_lookup=new Array(4,5,6,7,8,9,10,10,11,12,13,14,15,16,17,17,18,19,20,20,21,21,22,22,23,23,24,25,25,26,27,28,29,30,31,32,33,34,35,36,37,37,38,39,40,41,42,43,44,45,46,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,76,77,78,79,80,81,82,83,84,85,86,87,88,89,91,93,95,96,98,100,101,102,104,106,108,110,112,114,116,118,122,124,126,128,130,132,134,136,138,140,143,145,148,151,154,157),ac_q_lookup=new Array(4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,119,122,125,128,131,134,137,140,143,146,149,152,155,158,161,164,167,170,173,177,181,185,189,193,197,201,205,209,213,217,221,225,229,234,239,245,249,254,259,264,269,274,279,284),kf_y_mode_probs=new Array(145,156,163,128),kf_uv_mode_probs=new Array(142,114,183),kf_b_mode_probs=new Array(new Array(new Array(231,120,48,89,115,113,120,152,112),new Array(152,179,64,126,170,118,46,70,95),new Array(175,69,143,80,85,82,72,155,103),new Array(56,58,10,171,218,189,17,13,152),new Array(144,71,10,38,171,213,144,34,26),new Array(114,26,17,163,44,195,21,10,173),new Array(121,24,80,195,26,62,44,64,85),new Array(170,46,55,19,136,160,33,206,71),new Array(63,20,8,114,114,208,12,9,226),new Array(81,40,11,96,182,84,29,16,36)),new Array(new Array(134,183,89,137,98,101,106,165,148),new Array(72,187,100,130,157,111,32,75,80),new Array(66,102,167,99,74,62,40,234,128),new Array(41,53,9,178,241,141,26,8,107),new Array(104,79,12,27,217,255,87,17,7),new Array(74,43,26,146,73,166,49,23,157),new Array(65,38,105,160,51,52,31,115,128),new Array(87,68,71,44,114,51,15,186,23),new Array(47,41,14,110,182,183,21,17,194),new Array(66,45,25,102,197,189,23,18,22)),new Array(new Array(88,88,147,150,42,46,45,196,205),new Array(43,97,183,117,85,38,35,179,61),new Array(39,53,200,87,26,21,43,232,171),new Array(56,34,51,104,114,102,29,93,77),new Array(107,54,32,26,51,1,81,43,31),new Array(39,28,85,171,58,165,90,98,64),new Array(34,22,116,206,23,34,43,166,73),new Array(68,25,106,22,64,171,36,225,114),new Array(34,19,21,102,132,188,16,76,124),new Array(62,18,78,95,85,57,50,48,51)),new Array(new Array(193,101,35,159,215,111,89,46,111),new Array(60,148,31,172,219,228,21,18,111),new Array(112,113,77,85,179,255,38,120,114),new Array(40,42,1,196,245,209,10,25,109),new Array(100,80,8,43,154,1,51,26,71),new Array(88,43,29,140,166,213,37,43,154),new Array(61,63,30,155,67,45,68,1,209),new Array(142,78,78,16,255,128,34,197,171),new Array(41,40,5,102,211,183,4,1,221),new Array(51,50,17,168,209,192,23,25,82)),new Array(new Array(125,98,42,88,104,85,117,175,82),new Array(95,84,53,89,128,100,113,101,45),new Array(75,79,123,47,51,128,81,171,1),new Array(57,17,5,71,102,57,53,41,49),new Array(115,21,2,10,102,255,166,23,6),new Array(38,33,13,121,57,73,26,1,85),new Array(41,10,67,138,77,110,90,47,114),new Array(101,29,16,10,85,128,101,196,26),new Array(57,18,10,102,102,213,34,20,43),new Array(117,20,15,36,163,128,68,1,26)),new Array(new Array(138,31,36,171,27,166,38,44,229),new Array(67,87,58,169,82,115,26,59,179),new Array(63,59,90,180,59,166,93,73,154),new Array(40,40,21,116,143,209,34,39,175),new Array(57,46,22,24,128,1,54,17,37),new Array(47,15,16,183,34,223,49,45,183),new Array(46,17,33,183,6,98,15,32,183),new Array(65,32,73,115,28,128,23,128,205),new Array(40,3,9,115,51,192,18,6,223),new Array(87,37,9,115,59,77,64,21,47)),new Array(new Array(104,55,44,218,9,54,53,130,226),new Array(64,90,70,205,40,41,23,26,57),new Array(54,57,112,184,5,41,38,166,213),new Array(30,34,26,133,152,116,10,32,134),new Array(75,32,12,51,192,255,160,43,51),new Array(39,19,53,221,26,114,32,73,255),new Array(31,9,65,234,2,15,1,118,73),new Array(88,31,35,67,102,85,55,186,85),new Array(56,21,23,111,59,205,45,37,192),new Array(55,38,70,124,73,102,1,34,98)),new Array(new Array(102,61,71,37,34,53,31,243,192),new Array(69,60,71,38,73,119,28,222,37),new Array(68,45,128,34,1,47,11,245,171),new Array(62,17,19,70,146,85,55,62,70),new Array(75,15,9,9,64,255,184,119,16),new Array(37,43,37,154,100,163,85,160,1),new Array(63,9,92,136,28,64,32,201,85),new Array(86,6,28,5,64,255,25,248,1),new Array(56,8,17,132,137,255,55,116,128),new Array(58,15,20,82,135,57,26,121,40)),new Array(new Array(164,50,31,137,154,133,25,35,218),new Array(51,103,44,131,131,123,31,6,158),new Array(86,40,64,135,148,224,45,183,128),new Array(22,26,17,131,240,154,14,1,209),new Array(83,12,13,54,192,255,68,47,28),new Array(45,16,21,91,64,222,7,1,197),new Array(56,21,39,155,60,138,23,102,213),new Array(85,26,85,85,128,128,32,146,171),new Array(18,11,7,63,144,171,4,4,246),new Array(35,27,10,146,174,171,12,26,128)),new Array(new Array(190,80,35,99,180,80,126,54,45),new Array(85,126,47,87,176,51,41,20,32),new Array(101,75,128,139,118,146,116,128,85),new Array(56,41,15,176,236,85,37,9,62),new Array(146,36,19,30,171,255,97,27,20),new Array(71,30,17,119,118,255,17,18,138),new Array(101,38,60,138,55,70,43,26,142),new Array(138,45,61,62,219,1,81,188,64),new Array(32,41,20,117,151,142,20,21,163),new Array(112,19,12,61,195,128,48,4,24))),kf_y_mode_tree=new Array(-B_PRED,2,4,6,-DC_PRED,-V_PRED,-H_PRED,-TM_PRED),y_mode_tree=new Array(-DC_PRED,2,4,6,-V_PRED,-H_PRED,-TM_PRED,-B_PRED),uv_mode_tree=new Array(-DC_PRED,2,-V_PRED,4,-H_PRED,-TM_PRED),b_mode_tree=new Array(-B_DC_PRED,2,-B_TM_PRED,4,-B_VE_PRED,6,8,12,-B_HE_PRED,10,-B_RD_PRED,-B_VR_PRED,-B_LD_PRED,14,-B_VL_PRED,16,-B_HD_PRED,-B_HU_PRED),small_mv_tree=new Array(2,8,4,6,-0,-1,-2,-3,10,12,-4,-5,-6,-7),mv_ref_tree=new Array(-ZEROMV,2,-NEARESTMV,4,-NEARMV,6,-NEWMV,-SPLITMV),submv_ref_tree=new Array(-LEFT4X4,2,-ABOVE4X4,4,-ZERO4X4,-NEW4X4),split_mv_tree=new Array(-3,2,-2,4,-0,-1),default_b_mode_probs=new Array(120,90,79,133,87,85,80,111,151),mv_counts_to_probs=new Array(new Array(7,1,1,143),new Array(14,18,14,107),new Array(135,64,57,68),new Array(60,56,128,65),new Array(159,134,128,34),new Array(234,188,128,28)),split_mv_probs=new Array(110,111,150),submv_ref_probs2=new Array(new Array(147,136,18),new Array(106,145,1),new Array(179,121,1),new Array(223,1,34),new Array(208,1,1)),mv_partitions=new Array(new Array(0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1),new Array(0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1),new Array(0,0,1,1,0,0,1,1,2,2,3,3,2,2,3,3),new Array(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15)),mv_clamp_rect=function(){this.to_left=int_,this.to_right=int_,this.to_top=int_,this.to_bottom=int_};function clamp_mv(_,e){var r=new mv;return r.d.x=_.d.x<e.to_left?e.to_left:_.d.x,r.d.x=_.d.x>e.to_right?e.to_right:r.d.x,r.d.y=_.d.y<e.to_top?e.to_top:_.d.y,r.d.y=_.d.y>e.to_bottom?e.to_bottom:r.d.y,r}function read_segment_id(_,e){return bool_get(_,e.tree_probs[0])?2+bool_get(_,e.tree_probs[2]):bool_get(_,e.tree_probs[1])}function above_block_mode(_,e,r){if(r<4)switch(e.base.y_mode){case DC_PRED:return B_DC_PRED;case V_PRED:return B_VE_PRED;case H_PRED:return B_HE_PRED;case TM_PRED:return B_TM_PRED;case B_PRED:return e.splitt.mvs[r+12].d.x;default:assert(0)}return _.splitt.mvs[r-4].d.x}function left_block_mode(_,e,r){if(!(3&r))switch(e.base.y_mode){case DC_PRED:return B_DC_PRED;case V_PRED:return B_VE_PRED;case H_PRED:return B_HE_PRED;case TM_PRED:return B_TM_PRED;case B_PRED:return e.splitt.mvs[r+3].d.x;default:assert(0)}return _.splitt.mvs[r-1].d.x}function decode_kf_mb_mode(_,e,r,t,n,i,a){var o,s;if((o=bool_read_tree(a,kf_y_mode_tree,kf_y_mode_probs))==B_PRED){var f=int_;for(f=0;f<16;f++){var d,E=above_block_mode(_[e],n[i],f),c=left_block_mode(_[e],r[t],f);d=bool_read_tree(a,b_mode_tree,kf_b_mode_probs[E][c]),_[e].splitt.modes[f]=_[e].splitt.mvs[f].d.x=d,_[e].splitt.mvs[f].d.y=0}}s=bool_read_tree(a,uv_mode_tree,kf_uv_mode_probs),_[e].base.y_mode=o,_[e].base.uv_mode=s,_[e].base.mv.d.x=_[e].base.mv.d.y=0,_[e].base.ref_frame=0}function decode_intra_mb_mode(_,e,r){var t,n;if((t=bool_read_tree(r,y_mode_tree,e.y_mode_probs))==B_PRED){var i=int_;for(i=0;i<16;i++){var a;a=bool_read_tree(r,b_mode_tree,default_b_mode_probs),_.splitt.modes[i]=_.splitt.mvs[i].d.x=a,_.splitt.mvs[i].d.y=0}}n=bool_read_tree(r,uv_mode_tree,e.uv_mode_probs),_.base.y_mode=t,_.base.uv_mode=n,_.base.mv.d.x=_.base.mv.d.y=0,_.base.ref_frame=CURRENT_FRAME}function read_mv_component(_,e){var r=0;if(bool_get(_,e[0])){var t=0;for(t=0;t<3;t++)r+=bool_get(_,e[9+t])<<t;for(t=9;t>3;t--)r+=bool_get(_,e[9+t])<<t;65520&r&&!bool_get(_,e[12])||(r+=8)}else r=bool_read_tree(_,small_mv_tree,e,2);return r&&bool_get(_,e[1])&&(r=-r),r<<1}function above_block_mv(_,e,r){return r<4?e.base.y_mode==SPLITMV?e.splitt.mvs[r+12]:e.base.mv:_.splitt.mvs[r-4]}function left_block_mv(_,e,r){return 3&r?_.splitt.mvs[r-1]:e.base.y_mode==SPLITMV?e.splitt.mvs[r+3]:e.base.mv}function submv_ref(_,e,r){var t=!(e.d.x||e.d.y)+0,n=!(r.d.x||r.d.y)+0,i=(e.d.x==r.d.x&&e.d.y==r.d.y)+0,a=0;return i&&t?a=4:i?a=3:n?a=2:t&&(a=1),bool_read_tree(_,submv_ref_tree,submv_ref_probs2[a])}function read_mv(_,e,r){e.d.y=read_mv_component(_,r[0]),e.d.x=read_mv_component(_,r[1])}function mv_bias(_,e,r,t){e[_.base.ref_frame]^e[r]&&(t.d.x*=-1,t.d.y*=-1)}var CNT_BEST=0,CNT_ZEROZERO=0,CNT_NEAREST=1,CNT_NEAR=2,CNT_SPLITMV=3,this_mv_1=new mv,this_mv_2=new mv;function find_near_mvs(_,e,r,t,n,i,a,o){var s=t,f=n-1,d=a,E=0,c=o,l=0;d[0].d.x=d[1].d.x=d[2].d.x=0,d[0].d.y=d[1].d.y=d[2].d.y=0,o[0]=o[1]=o[2]=o[3]=0;var m,A=t[n],u=e[r],p=s[f];(A.base.ref_frame!=CURRENT_FRAME&&((A.base.mv.d.x||A.base.mv.d.y)&&(d[++E].d.x=A.base.mv.d.x,d[E].d.y=A.base.mv.d.y,mv_bias(A,i,_.base.ref_frame,d[E]),++l),c[l]+=2),u.base.ref_frame!=CURRENT_FRAME)&&(u.base.mv.d.x||u.base.mv.d.y?((m=this_mv_1).d.x=u.base.mv.d.x,m.d.y=u.base.mv.d.y,mv_bias(u,i,_.base.ref_frame,m),m.d.x==d[E].d.x&&m.d.y==d[E].d.y||(d[++E].d.x=m.d.x,d[E].d.y=m.d.y,++l),c[l]+=2):o[CNT_ZEROZERO]+=2);p.base.ref_frame!=CURRENT_FRAME&&(p.base.mv.d.x||p.base.mv.d.y?((m=this_mv_2).d.x=p.base.mv.d.x,m.d.y=p.base.mv.d.y,mv_bias(p,i,_.base.ref_frame,m),m.d.x==d[E].d.x&&m.d.y==d[E].d.y||(d[++E].d.x=m.d.x,d[E].d.y=m.d.y,++l),c[l]+=1):o[CNT_ZEROZERO]+=1);if(o[CNT_SPLITMV]&&d[E].d.x==a[CNT_NEAREST].d.x&&d[E].d.y==a[CNT_NEAREST].d.y&&(o[CNT_NEAREST]+=1),o[CNT_SPLITMV]=2*((A.base.y_mode==SPLITMV)+(u.base.y_mode==SPLITMV))+(p.base.y_mode==SPLITMV),o[CNT_NEAR]>o[CNT_NEAREST]){var T,y=int_;y=o[CNT_NEAREST],o[CNT_NEAREST]=o[CNT_NEAR],o[CNT_NEAR]=y,y=a[CNT_NEAREST].d.x,T=a[CNT_NEAREST].d.y,a[CNT_NEAREST].d.x=a[CNT_NEAR].d.x,a[CNT_NEAREST].d.y=a[CNT_NEAR].d.y,a[CNT_NEAR].d.x=y,a[CNT_NEAR].d.y=T}o[CNT_NEAREST]>=o[CNT_BEST]&&(a[CNT_BEST].d.x=a[CNT_NEAREST].d.x,a[CNT_BEST].d.y=a[CNT_NEAREST].d.y)}function decode_split_mv(_,e,r,t,n,i){var a,o,s=int_,f=int_,d=int_;for(o=bool_read_tree(i,split_mv_tree,split_mv_probs),a=mv_partitions[o],_.base.partitioning=o,s=0,d=0;d<65535;s++){var E,c,l=new mv;for(f=0;s!=a[f];f++);switch(submv_ref(i,E=left_block_mv(_,e,f),c=above_block_mv(_,r,f))){case LEFT4X4:l=E;break;case ABOVE4X4:l=c;break;case ZERO4X4:l.d.x=l.d.y=0;break;case NEW4X4:read_mv(i,l,t.mv_probs),l.d.x+=n.d.x,l.d.y+=n.d.y;break;default:assert(0)}for(;f<16;f++)s==a[f]&&(_.splitt.mvs[f].d.x=l.d.x,_.splitt.mvs[f].d.y=l.d.y,d|=1<<f)}}function need_mc_border(_,e,r,t,n,i){return e+=_.d.x>>3,r+=_.d.y>>3,e>>1<2||n-(e+t)>>1<3||r>>1<2||i-(r+t)>>1<3}var near_mvs_4=Arr_new(4,mv),mv_cnts_4=new Array(0,0,0,0),probs_4=new Array(0,0,0,0),chroma_mv_4=Arr_new(4,mv),clamped_best_mv_1=new mv;function decode_mvs(_,e,r,t,n,i,a,o,s){var f,d,E,c,l=_.entropy_hdr,m=near_mvs_4,A=clamped_best_mv_1,u=mv_cnts_4,p=probs_4,T=int_;switch(e[r].base.ref_frame=bool_get(s,l.prob_last)?2+bool_get(s,l.prob_gf):1,find_near_mvs(e[r],e,r-1,i,a,_.reference_hdr.sign_bias,m,u),p[0]=mv_counts_to_probs[u[0]][0],p[1]=mv_counts_to_probs[u[1]][1],p[2]=mv_counts_to_probs[u[2]][2],p[3]=mv_counts_to_probs[u[3]][3],(e=e[r]).base.y_mode=bool_read_tree(s,mv_ref_tree,p),e.base.uv_mode=e.base.y_mode,e.base.need_mc_border=0,f=-o.to_left-128>>3,d=-o.to_top-128>>3,E=16*_.mb_cols,c=16*_.mb_rows,e.base.y_mode){case NEARESTMV:e.base.mv=clamp_mv(m[1],o);break;case NEARMV:e.base.mv=clamp_mv(m[2],o);break;case ZEROMV:return void(e.base.mv.d.x=e.base.mv.d.y=0);case NEWMV:A=clamp_mv(m[0],o),read_mv(s,e.base.mv,l.mv_probs),e.base.mv.d.x+=A.d.x,e.base.mv.d.y+=A.d.y;break;case SPLITMV:var y=chroma_mv_4;for(A=clamp_mv(m[0],o),decode_split_mv(e,t[n],i[a],l,A,s),e.base.mv.d.x=e.splitt.mvs[15].d.x,e.base.mv.d.y=e.splitt.mvs[15].d.y,T=0;T<16;T++)if(y[(T>>1&1)+(T>>2&2)].d.x+=e.splitt.mvs[T].d.x,y[(T>>1&1)+(T>>2&2)].d.y+=e.splitt.mvs[T].d.y,need_mc_border(e.splitt.mvs[T],f+4*(3&T),d+(-4&T),4,E,c)){e.base.need_mc_border=1;break}for(T=0;T<4;T++)if(y[T].d.x+=4,y[T].d.y+=4,y[T].d.x>>=2,y[T].d.y>>=2,need_mc_border(y[T],f+8*(1&T),d+8*(T>>1),16,E,c)){e.base.need_mc_border=1;break}return;default:assert(0)}need_mc_border(e.base.mv,f,d,16,E,c)&&(e.base.need_mc_border=1)}var bounds_=new mv_clamp_rect;function vp8_dixie_modemv_process_row(_,e,r,t,n){var i,a,o=0,s=0,f=int_,d=bounds_;for(a=_.mb_info_rows[1+r],s=_.mb_info_rows_off[1+r]+t,i=_.mb_info_rows[1+r-1],o=_.mb_info_rows_off[1+r-1]+t,d.to_left=-(t+1<<7),d.to_right=_.mb_cols-t<<7,d.to_top=-(r+1<<7),d.to_bottom=_.mb_rows-r<<7,f=t;f<t+n;f++)_.segment_hdr.update_map&&(a[s].base.segment_id=read_segment_id(e,_.segment_hdr)),_.entropy_hdr.coeff_skip_enabled&&(a[s].base.skip_coeff=bool_get(e,_.entropy_hdr.coeff_skip_prob)),_.frame_hdr.is_keyframe?(_.segment_hdr.update_map||(a[s].base.segment_id=0),decode_kf_mb_mode(a,s,a,s-1,i,o,e)):(bool_get(e,_.entropy_hdr.prob_inter)?decode_mvs(_,a,s,a,s-1,i,o,d,e):decode_intra_mb_mode(a[s],_.entropy_hdr,e),d.to_left-=128,d.to_right-=128),s++,o++}function vp8_dixie_modemv_init(_){var e,r,t=int_,n=new mb_info,i=0;for(e=_.mb_cols+1,r=_.mb_rows+1,_.frame_hdr.frame_size_updated&&(_.mb_info_storage=null,_.mb_info_rows_storage=null),_.mb_info_storage||(_.mb_info_storage=Arr_new(e*r,_.mb_info_storage_object),_.mb_info_storage_off=0),_.mb_info_rows_storage||(_.mb_info_rows_storage=Arr_new(r,_.mb_info_rows_storage_object),_.mb_info_rows_storage_off=new Array(r)),n=_.mb_info_storage,i=_.mb_info_storage_off+1,t=0;t<r;t++)_.mb_info_rows_storage[t]=n,_.mb_info_rows_storage_off[t]=i,i+=e;_.mb_info_rows=_.mb_info_rows_storage,_.mb_info_rows_off=_.mb_info_rows_storage_off}var EOB_CONTEXT_NODE=0,ZERO_CONTEXT_NODE=1,ONE_CONTEXT_NODE=2,LOW_VAL_CONTEXT_NODE=3,TWO_CONTEXT_NODE=4,THREE_CONTEXT_NODE=5,HIGH_LOW_CONTEXT_NODE=6,CAT_ONE_CONTEXT_NODE=7,CAT_THREEFOUR_CONTEXT_NODE=8,CAT_THREE_CONTEXT_NODE=9,CAT_FIVE_CONTEXT_NODE=10,ZERO_TOKEN=0,ONE_TOKEN=1,TWO_TOKEN=2,THREE_TOKEN=3,FOUR_TOKEN=4,DCT_VAL_CATEGORY1=5,DCT_VAL_CATEGORY2=6,DCT_VAL_CATEGORY3=7,DCT_VAL_CATEGORY4=8,DCT_VAL_CATEGORY5=9,DCT_VAL_CATEGORY6=10,DCT_EOB_TOKEN=11,MAX_ENTROPY_TOKENS=12,left_context_index=new Array(0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,5,5,6,6,7,7,8),above_context_index=new Array(0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3,4,5,4,5,6,7,6,7,8);function X(_){return _*PREV_COEF_CONTEXTS*ENTROPY_NODES}var bands_x=new Array(X(0),X(1),X(2),X(3),X(6),X(4),X(5),X(6),X(6),X(6),X(6),X(6),X(6),X(6),X(6),X(7)),extrabits=new Array({min_val:0,length:-1,probs:new Array(0,0,0,0,0,0,0,0,0,0,0,0)},{min_val:1,length:0,probs:new Array(0,0,0,0,0,0,0,0,0,0,0,0)},{min_val:2,length:0,probs:new Array(0,0,0,0,0,0,0,0,0,0,0,0)},{min_val:3,length:0,probs:new Array(0,0,0,0,0,0,0,0,0,0,0,0)},{min_val:4,length:0,probs:new Array(0,0,0,0,0,0,0,0,0,0,0,0)},{min_val:5,length:0,probs:new Array(159,0,0,0,0,0,0,0,0,0,0,0)},{min_val:7,length:1,probs:new Array(145,165,0,0,0,0,0,0,0,0,0,0)},{min_val:11,length:2,probs:new Array(140,148,173,0,0,0,0,0,0,0,0,0)},{min_val:19,length:3,probs:new Array(135,140,155,176,0,0,0,0,0,0,0,0)},{min_val:35,length:4,probs:new Array(130,134,141,157,180,0,0,0,0,0,0,0)},{min_val:67,length:10,probs:new Array(129,130,133,140,153,177,196,230,243,254,254,0)},{min_val:0,length:-1,probs:new Array(0,0,0,0,0,0,0,0,0,0,0,0)}),zigzag=new Array(0,1,4,8,5,2,3,6,9,12,13,10,7,11,14,15),BLOCK_LOOP=0,DO_WHILE=1,CHECK_0_=2,CAT_FIVE_CONTEXT_NODE_0_=3,CAT_THREEFOUR_CONTEXT_NODE_0_=4,CAT_THREE_CONTEXT_NODE_0_=5,HIGH_LOW_CONTEXT_NODE_0_=6,CAT_ONE_CONTEXT_NODE_0_=7,LOW_VAL_CONTEXT_NODE_0_=8,THREE_CONTEXT_NODE_0_=9,TWO_CONTEXT_NODE_0_=10,ONE_CONTEXT_NODE_0_=11,BLOCK_FINISHED=12,END=13;function decode_mb_tokens(_,e,r,t,n,i,a,o){function s(e){y=(bool_get_bit(_)?-e:e)*P[!!p+0]}function f(e,r){if(!bool_get(_,e))return g=r,1}function d(e,r){if(!bool_get(_,e))return D=R,p<15?(++p,D+=bands_x[p],g=r,1):(g=BLOCK_FINISHED,1)}function E(_){return s(_),D=R+2*ENTROPY_NODES,p<15?(w[I+zigzag[p]]=y,++p,g=DO_WHILE,1):(w[I+zigzag[15]]=y,g=BLOCK_FINISHED,1)}function c(e,r){b+=bool_get(_,extrabits[e].probs[r])<<r}var l,m=int_,A=int_,u=int_,p=int_,T=int_,y=int_,b=int_,v=int_,h=int_,w=short_,I=0,R=0,N=char_,D=0,P=short_;h=0,i!=B_PRED&&i!=SPLITMV?(m=24,A=24,u=1,w=t,I=n+384,P=o[TOKEN_BLOCK_Y2]):(m=0,A=16,u=3,w=t,I=n,P=o[TOKEN_BLOCK_Y1]),l=a,R=u*COEF_BANDS*PREV_COEF_CONTEXTS*ENTROPY_NODES;var g=BLOCK_LOOP;do{if(g==BLOCK_LOOP&&(T=e[left_context_index[m]]+r[above_context_index[m]],p=!u+0,N=l,D=R,D+=T*ENTROPY_NODES,g=DO_WHILE),g==DO_WHILE){if(f(N[(D+=bands_x[p])+EOB_CONTEXT_NODE],BLOCK_FINISHED))continue;g=CHECK_0_}if(g==CHECK_0_){if(d(N[D+ZERO_CONTEXT_NODE],CHECK_0_))continue;if(f(N[D+ONE_CONTEXT_NODE],ONE_CONTEXT_NODE_0_))continue;if(f(N[D+LOW_VAL_CONTEXT_NODE],LOW_VAL_CONTEXT_NODE_0_))continue;if(f(N[D+HIGH_LOW_CONTEXT_NODE],HIGH_LOW_CONTEXT_NODE_0_))continue;if(f(N[D+CAT_THREEFOUR_CONTEXT_NODE],CAT_THREEFOUR_CONTEXT_NODE_0_))continue;if(f(N[D+CAT_FIVE_CONTEXT_NODE],CAT_FIVE_CONTEXT_NODE_0_))continue;b=extrabits[DCT_VAL_CATEGORY6].min_val,v=extrabits[DCT_VAL_CATEGORY6].length;do{c(DCT_VAL_CATEGORY6,v),v--}while(v>=0);if(E(b))continue}if(g!=CAT_FIVE_CONTEXT_NODE_0_||(b=extrabits[DCT_VAL_CATEGORY5].min_val,c(DCT_VAL_CATEGORY5,4),c(DCT_VAL_CATEGORY5,3),c(DCT_VAL_CATEGORY5,2),c(DCT_VAL_CATEGORY5,1),c(DCT_VAL_CATEGORY5,0),!E(b))){if(g==CAT_THREEFOUR_CONTEXT_NODE_0_){if(f(N[D+CAT_THREE_CONTEXT_NODE],CAT_THREE_CONTEXT_NODE_0_))continue;if(b=extrabits[DCT_VAL_CATEGORY4].min_val,c(DCT_VAL_CATEGORY4,3),c(DCT_VAL_CATEGORY4,2),c(DCT_VAL_CATEGORY4,1),c(DCT_VAL_CATEGORY4,0),E(b))continue}if(g!=CAT_THREE_CONTEXT_NODE_0_||(b=extrabits[DCT_VAL_CATEGORY3].min_val,c(DCT_VAL_CATEGORY3,2),c(DCT_VAL_CATEGORY3,1),c(DCT_VAL_CATEGORY3,0),!E(b))){if(g==HIGH_LOW_CONTEXT_NODE_0_){if(f(N[D+CAT_ONE_CONTEXT_NODE],CAT_ONE_CONTEXT_NODE_0_))continue;if(b=extrabits[DCT_VAL_CATEGORY2].min_val,c(DCT_VAL_CATEGORY2,1),c(DCT_VAL_CATEGORY2,0),E(b))continue}if(g!=CAT_ONE_CONTEXT_NODE_0_||(b=extrabits[DCT_VAL_CATEGORY1].min_val,c(DCT_VAL_CATEGORY1,0),!E(b))){if(g==LOW_VAL_CONTEXT_NODE_0_){if(f(N[D+TWO_CONTEXT_NODE],TWO_CONTEXT_NODE_0_))continue;if(f(N[D+THREE_CONTEXT_NODE],THREE_CONTEXT_NODE_0_))continue;if(E(4))continue}if(!(g==THREE_CONTEXT_NODE_0_&&E(3)||g==TWO_CONTEXT_NODE_0_&&E(2))){if(g==ONE_CONTEXT_NODE_0_){if(s(1),D=R+ENTROPY_NODES,p<15){w[I+zigzag[p]]=y,++p,g=DO_WHILE;continue}w[I+zigzag[15]]=y,g=BLOCK_FINISHED}if(g==BLOCK_FINISHED){if(h=((h=(h|(p>1)+0<<m)>>>0)|(T=(p!=!u)+0)<<31)>>>0,e[left_context_index[m]]=r[above_context_index[m]]=T,I+=16,++m<A){g=BLOCK_LOOP;continue}if(25==m){m=0,A=16,R=(u=0)*COEF_BANDS*PREV_COEF_CONTEXTS*ENTROPY_NODES,I=n,P=o[TOKEN_BLOCK_Y1],g=BLOCK_LOOP;continue}if(16==m){R=(u=2)*COEF_BANDS*PREV_COEF_CONTEXTS*ENTROPY_NODES,A=24,P=o[TOKEN_BLOCK_UV],g=BLOCK_LOOP;continue}}g=END}}}}}while(g!=END);return h}function reset_row_context(_){memset(_,0,0,_.length)}function reset_above_context(_,e){var r=0;for(r=0;r<e;++r)memset(_[r],0,0,_[r].length)}function reset_mb_context(_,e,r){memset(_,0,0,8),memset(e,0,0,8),r!=B_PRED&&r!=SPLITMV&&(_[8]=0,e[8]=0)}function vp8_dixie_tokens_process_row(_,e,r,t,n){var i=_.tokens[e],a=i.coeffs,o=400*t,s=int_,f=_.above_token_entropy_ctx,d=+t,E=i.left_token_entropy_ctx,c=_.mb_info_rows[1+r],l=_.mb_info_rows_off[1+r]+t;for(0==r&&reset_above_context(f,n),0==t&&reset_row_context(E),s=t;s<t+n;s++){if(memset(a,o,0,400),c[l].base.skip_coeff)reset_mb_context(E,f[d],c[l].base.y_mode),c[l].base.eob_mask=0;else{var m,A;m=_.dequant_factors,A=+c[l].base.segment_id,c[l].base.eob_mask=decode_mb_tokens(i.bool,E,f[d],a,o,c[l].base.y_mode,_.entropy_hdr.coeff_probs_,m[A].factor)}d++,l++,o+=400}}function vp8_dixie_tokens_init(_){var e=_.token_hdr.partitions;if(_.frame_hdr.frame_size_updated){var r=int_,t=25*_.mb_cols*16;for(r=0;r<e;r++)_.tokens[r].coeffs=new Array(t),_.tokens[r].coeffs||vpx_internal_error(_.error,VPX_CODEC_MEM_ERROR,null);_.above_token_entropy_ctx=Arr_new(_.mb_cols,_.above_token_entropy_ctx_object),_.above_token_entropy_ctx||vpx_internal_error(_.error,VPX_CODEC_MEM_ERROR,null)}}function ABS(_){return _>=0?_:-_}function saturate_int8(_){return _<-128?-128:_>127?127:_}function saturate_uint8(_){return _<0?0:_>255?255:_}function high_edge_variance(_,e,r,t){var n=_[e-2*r],i=_[e-1*r],a=_[e+0*r],o=_[e+1*r];return ABS(n-i)>t||ABS(o-a)>t}function simple_threshold(_,e,r,t){var n=_[e-2*r],i=_[e-1*r],a=_[e+0*r],o=_[e+1*r];return 2*ABS(i-a)+(ABS(n-o)>>1)<=t}function normal_threshold(_,e,r,t,n){var i=_[e-4*r],a=_[e-3*r],o=_[e-2*r],s=_[e-1*r],f=_[e+0*r],d=_[e+1*r],E=_[e+2*r],c=_[e+3*r],l=n;return simple_threshold(_,e,r,2*t+l)&&ABS(i-a)<=l&&ABS(a-o)<=l&&ABS(o-s)<=l&&ABS(c-E)<=l&&ABS(E-d)<=l&&ABS(d-f)<=l}function filter_common(_,e,r,t){var n,i=_[e-2*r],a=_[e-1*r],o=_[e+0*r],s=_[e+1*r],f=int_;f=3*(o-a),t&&(f+=saturate_int8(i-s)),n=((f=saturate_int8(f))+4>127?127:f+4)>>3,a=saturate_uint8(a+((f+3>127?127:f+3)>>3)),o=saturate_uint8(o-n),t||(i=saturate_uint8(i+(f=n+1>>1)),s=saturate_uint8(s-f)),_[e-2*r]=i,_[e-1*r]=a,_[e+0*r]=o,_[e+1*r]=s}function filter_mb_edge(_,e,r){var t,n=_[e-3*r],i=_[e-2*r],a=_[e-1*r],o=_[e+0*r],s=_[e+1*r],f=_[e+2*r],d=int_;a=saturate_uint8(a+(d=27*(t=saturate_int8(saturate_int8(i-s)+3*(o-a)))+63>>7)),o=saturate_uint8(o-d),i=saturate_uint8(i+(d=18*t+63>>7)),s=saturate_uint8(s-d),n=saturate_uint8(n+(d=9*t+63>>7)),f=saturate_uint8(f-d),_[e-3*r]=n,_[e-2*r]=i,_[e-1*r]=a,_[e+0*r]=o,_[e+1*r]=s,_[e+2*r]=f}function filter_mb_v_edge(_,e,r,t,n,i,a){var o=int_;for(o=0;o<8*a;o++)normal_threshold(_,e,1,t,n)&&(high_edge_variance(_,e,1,i)?filter_common(_,e,1,1):filter_mb_edge(_,e,1)),e+=r}function filter_subblock_v_edge(_,e,r,t,n,i,a){var o=int_;for(o=0;o<8*a;o++)normal_threshold(_,e,1,t,n)&&filter_common(_,e,1,high_edge_variance(_,e,1,i)),e+=r}function filter_mb_h_edge(_,e,r,t,n,i,a){var o=int_;for(o=0;o<8*a;o++)normal_threshold(_,e,r,t,n)&&(high_edge_variance(_,e,r,i)?filter_common(_,e,r,1):filter_mb_edge(_,e,r)),e+=1}function filter_subblock_h_edge(_,e,r,t,n,i,a){var o=int_;for(o=0;o<8*a;o++)normal_threshold(_,e,r,t,n)&&filter_common(_,e,r,high_edge_variance(_,e,r,i)),e+=1}function filter_v_edge_simple(_,e,r,t){var n=int_;for(n=0;n<16;n++)simple_threshold(_,e,1,t)&&filter_common(_,e,1,1),e+=r}function filter_h_edge_simple(_,e,r,t){var n=int_;for(n=0;n<16;n++)simple_threshold(_,e,r,t)&&filter_common(_,e,r,1),e+=1}function calculate_filter_parameters(_,e,r,t,n){var i=int_,a=int_,o=int_;i=_.loopfilter_hdr.level,_.segment_hdr.enabled&&(_.segment_hdr.abs_?i=_.segment_hdr.lf_level[e.base.segment_id]:i+=_.segment_hdr.lf_level[e.base.segment_id]),_.loopfilter_hdr.delta_enabled&&(i+=_.loopfilter_hdr.ref_delta[e.base.ref_frame],e.base.ref_frame==CURRENT_FRAME?e.base.y_mode==B_PRED&&(i+=_.loopfilter_hdr.mode_delta[0]):e.base.y_mode==ZEROMV?i+=_.loopfilter_hdr.mode_delta[1]:e.base.y_mode==SPLITMV?i+=_.loopfilter_hdr.mode_delta[3]:i+=_.loopfilter_hdr.mode_delta[2]),i>63?i=63:i<0&&(i=0),a=i,_.loopfilter_hdr.sharpness&&(a>>=_.loopfilter_hdr.sharpness>4?2:1)>9-_.loopfilter_hdr.sharpness&&(a=9-_.loopfilter_hdr.sharpness),a<1&&(a=1),o=i>=15,i>=40&&o++,i>=20&&!_.frame_hdr.is_keyframe&&o++,r[0]=i,t[0]=a,n[0]=o}function filter_row_normal(_,e,r,t){var n,i,a,o,s,f,d=0,E=0,c=0,l=0,m=int_;for(o=_.ref_frames[CURRENT_FRAME].img.stride[PLANE_Y],s=_.ref_frames[CURRENT_FRAME].img.stride[PLANE_U],n=_.ref_frames[CURRENT_FRAME].img.planes[PLANE_Y],d=_.ref_frames[CURRENT_FRAME].img.planes_off[PLANE_Y],i=_.ref_frames[CURRENT_FRAME].img.planes[PLANE_U],E=_.ref_frames[CURRENT_FRAME].img.planes_off[PLANE_U],a=_.ref_frames[CURRENT_FRAME].img.planes[PLANE_V],c=_.ref_frames[CURRENT_FRAME].img.planes_off[PLANE_V],d+=16*(o*e+r),E+=8*(s*e+r),c+=8*(s*e+r),f=_.mb_info_rows[1+e],l=_.mb_info_rows_off[1+e]+r,m=r;m<r+t;m++){var A=[int_],u=[int_],p=[int_];calculate_filter_parameters(_,f[l],A,u,p),A=A[0],u=u[0],p=p[0],A&&(m&&(filter_mb_v_edge(n,d,o,A+2,u,p,2),filter_mb_v_edge(i,E,s,A+2,u,p,1),filter_mb_v_edge(a,c,s,A+2,u,p,1)),(f[l].base.eob_mask||f[l].base.y_mode==SPLITMV||f[l].base.y_mode==B_PRED)&&(filter_subblock_v_edge(n,d+4,o,A,u,p,2),filter_subblock_v_edge(n,d+8,o,A,u,p,2),filter_subblock_v_edge(n,d+12,o,A,u,p,2),filter_subblock_v_edge(i,E+4,s,A,u,p,1),filter_subblock_v_edge(a,c+4,s,A,u,p,1)),e&&(filter_mb_h_edge(n,d,o,A+2,u,p,2),filter_mb_h_edge(i,E,s,A+2,u,p,1),filter_mb_h_edge(a,c,s,A+2,u,p,1)),(f[l].base.eob_mask||f[l].base.y_mode==SPLITMV||f[l].base.y_mode==B_PRED)&&(filter_subblock_h_edge(n,d+4*o,o,A,u,p,2),filter_subblock_h_edge(n,d+8*o,o,A,u,p,2),filter_subblock_h_edge(n,d+12*o,o,A,u,p,2),filter_subblock_h_edge(i,E+4*s,s,A,u,p,1),filter_subblock_h_edge(a,c+4*s,s,A,u,p,1))),d+=16,E+=8,c+=8,l++}}function filter_row_simple(_,e,r,t){var n,i,a,o=0,s=0,f=int_;for(i=_.ref_frames[CURRENT_FRAME].img.stride[PLANE_Y],n=_.ref_frames[CURRENT_FRAME].img.planes[PLANE_Y],o=_.ref_frames[CURRENT_FRAME].img.planes_off[PLANE_Y],o+=16*(i*e+r),a=_.mb_info_rows[1+e],s=_.mb_info_rows_off[1+e]+r,f=r;f<r+t;f++){var d=[int_],E=[int_],c=[int_];if(calculate_filter_parameters(_,a[s],d,E,c),d[0]){var l=(a[s].base.eob_mask||a[s].base.y_mode==SPLITMV||a[s].base.y_mode==B_PRED)+0,m=2*(d[0]+2)+E[0],A=2*d[0]+E[0];f&&filter_v_edge_simple(n,o,i,m),l&&(filter_v_edge_simple(n,o+4,i,A),filter_v_edge_simple(n,o+8,i,A),filter_v_edge_simple(n,o+12,i,A)),e&&filter_h_edge_simple(n,o,i,m),l&&(filter_h_edge_simple(n,o+4*i,i,A),filter_h_edge_simple(n,o+8*i,i,A),filter_h_edge_simple(n,o+12*i,i,A))}o+=16,s++}}function vp8_dixie_loopfilter_process_row(_,e,r,t){_.loopfilter_hdr.use_simple?filter_row_simple(_,e,r,t):filter_row_normal(_,e,r,t)}var BORDER_PIXELS=16,sixtap_filters=new Array(new Array(0,0,128,0,0,0),new Array(0,-6,123,12,-1,0),new Array(2,-11,108,36,-8,1),new Array(0,-9,93,50,-6,0),new Array(3,-16,77,77,-16,3),new Array(0,-6,50,93,-9,0),new Array(1,-8,36,108,-11,2),new Array(0,-1,12,123,-6,0)),bilinear_filters=new Array(new Array(0,0,128,0,0,0),new Array(0,0,112,16,0,0),new Array(0,0,96,32,0,0),new Array(0,0,80,48,0,0),new Array(0,0,64,64,0,0),new Array(0,0,48,80,0,0),new Array(0,0,32,96,0,0),new Array(0,0,16,112,0,0));function predict_h_nxn(_,e,r,t){var n=_,i=e-1,a=int_,o=int_;for(a=0;a<t;a++)for(o=0;o<t;o++)_[e+a*r+o]=n[i+a*r]}function predict_v_nxn(_,e,r,t){var n=_,i=e-r,a=int_,o=int_;for(a=0;a<t;a++)for(o=0;o<t;o++)_[e+a*r+o]=n[i+o]}function predict_tm_nxn(_,e,r,t){var n=_,i=e-1,a=_,o=e-r,s=a[o-1],f=int_,d=int_;for(d=0;d<t;d++){for(f=0;f<t;f++)_[e+f]=CLAMP_255(n[i]+a[o+f]-s);e+=r,i+=r}}function predict_dc_nxn(_,e,r,t){var n=_,i=e-1,a=_,o=e-r,s=int_,f=int_,d=0;for(s=0;s<t;s++)d+=n[i]+a[o+s],i+=r;switch(t){case 16:d=d+16>>5;break;case 8:d=d+8>>4;break;case 4:d=d+4>>3}for(s=0;s<t;s++)for(f=0;f<t;f++)_[e+s*r+f]=d}function predict_ve_4x4(_,e,r){var t=_,n=e-r,i=int_,a=int_;for(_[e+0]=t[n-1]+2*t[n+0]+t[n+1]+2>>2,_[e+1]=t[n+0]+2*t[n+1]+t[n+2]+2>>2,_[e+2]=t[n+1]+2*t[n+2]+t[n+3]+2>>2,_[e+3]=t[n+2]+2*t[n+3]+t[n+4]+2>>2,i=1;i<4;i++)for(a=0;a<4;a++)_[e+i*r+a]=_[e+a]}function predict_he_4x4(_,e,r){var t=_,n=e-1;_[e+0]=_[e+1]=_[e+2]=_[e+3]=t[n-r]+2*t[n+0]+t[n+r]+2>>2,n+=r,_[(e+=r)+0]=_[e+1]=_[e+2]=_[e+3]=t[n-r]+2*t[n+0]+t[n+r]+2>>2,n+=r,_[(e+=r)+0]=_[e+1]=_[e+2]=_[e+3]=t[n-r]+2*t[n+0]+t[n+r]+2>>2,n+=r,_[(e+=r)+0]=_[e+1]=_[e+2]=_[e+3]=t[n-r]+2*t[n+0]+t[n+0]+2>>2}function predict_ld_4x4(_,e,r){var t,n,i,a,o,s=_,f=e-r;_[e+0]=s[f+0]+2*s[f+1]+s[f+2]+2>>2,_[e+1]=t=s[f+1]+2*s[f+2]+s[f+3]+2>>2,_[e+2]=n=s[f+2]+2*s[f+3]+s[f+4]+2>>2,_[e+3]=i=s[f+3]+2*s[f+4]+s[f+5]+2>>2,_[(e+=r)+0]=t,_[e+1]=n,_[e+2]=i,_[e+3]=a=s[f+4]+2*s[f+5]+s[f+6]+2>>2,_[(e+=r)+0]=n,_[e+1]=i,_[e+2]=a,_[e+3]=o=s[f+5]+2*s[f+6]+s[f+7]+2>>2,_[(e+=r)+0]=i,_[e+1]=a,_[e+2]=o,_[e+3]=s[f+6]+2*s[f+7]+s[f+7]+2>>2}function predict_rd_4x4(_,e,r){var t,n,i,a,o,s=_,f=e-1,d=_,E=e-r;_[e+0]=t=s[f+0]+2*d[E-1]+d[E+0]+2>>2,_[e+1]=n=d[E-1]+2*d[E+0]+d[E+1]+2>>2,_[e+2]=i=d[E+0]+2*d[E+1]+d[E+2]+2>>2,_[e+3]=d[E+1]+2*d[E+2]+d[E+3]+2>>2,_[(e+=r)+0]=a=s[f+r]+2*s[f+0]+d[E-1]+2>>2,_[e+1]=t,_[e+2]=n,_[e+3]=i,_[(e+=r)+0]=o=s[f+2*r]+2*s[f+r]+s[f+0]+2>>2,_[e+1]=a,_[e+2]=t,_[e+3]=n,_[(e+=r)+0]=s[f+3*r]+2*s[f+2*r]+s[f+r]+2>>2,_[e+1]=o,_[e+2]=a,_[e+3]=t}function predict_vr_4x4(_,e,r){var t,n,i,a,o,s,f=_,d=e-1,E=_,c=e-r;_[e+0]=t=E[c-1]+E[c+0]+1>>1,_[e+1]=n=E[c+0]+E[c+1]+1>>1,_[e+2]=i=E[c+1]+E[c+2]+1>>1,_[e+3]=E[c+2]+E[c+3]+1>>1,_[(e+=r)+0]=a=f[d+0]+2*E[c-1]+E[c+0]+2>>2,_[e+1]=o=E[c-1]+2*E[c+0]+E[c+1]+2>>2,_[e+2]=s=E[c+0]+2*E[c+1]+E[c+2]+2>>2,_[e+3]=E[c+1]+2*E[c+2]+E[c+3]+2>>2,_[(e+=r)+0]=f[d+r]+2*f[d+0]+E[c-1]+2>>2,_[e+1]=t,_[e+2]=n,_[e+3]=i,_[(e+=r)+0]=f[d+2*r]+2*f[d+r]+f[d+0]+2>>2,_[e+1]=a,_[e+2]=o,_[e+3]=s}function predict_vl_4x4(_,e,r){var t,n,i,a,o,s,f=_,d=e-r;_[e+0]=f[d+0]+f[d+1]+1>>1,_[e+1]=t=f[d+1]+f[d+2]+1>>1,_[e+2]=n=f[d+2]+f[d+3]+1>>1,_[e+3]=i=f[d+3]+f[d+4]+1>>1,_[(e+=r)+0]=f[d+0]+2*f[d+1]+f[d+2]+2>>2,_[e+1]=a=f[d+1]+2*f[d+2]+f[d+3]+2>>2,_[e+2]=o=f[d+2]+2*f[d+3]+f[d+4]+2>>2,_[e+3]=s=f[d+3]+2*f[d+4]+f[d+5]+2>>2,_[(e+=r)+0]=t,_[e+1]=n,_[e+2]=i,_[e+3]=f[d+4]+2*f[d+5]+f[d+6]+2>>2,_[(e+=r)+0]=a,_[e+1]=o,_[e+2]=s,_[e+3]=f[d+5]+2*f[d+6]+f[d+7]+2>>2}function predict_hd_4x4(_,e,r){var t,n,i,a,o,s,f=_,d=e-1,E=_,c=e-r;_[e+0]=t=f[d+0]+E[c-1]+1>>1,_[e+1]=n=f[d+0]+2*E[c-1]+E[c+0]+2>>2,_[e+2]=E[c-1]+2*E[c+0]+E[c+1]+2>>2,_[e+3]=E[c+0]+2*E[c+1]+E[c+2]+2>>2,_[(e+=r)+0]=i=f[d+r]+f[d+0]+1>>1,_[e+1]=a=f[d+r]+2*f[d+0]+E[c-1]+2>>2,_[e+2]=t,_[e+3]=n,_[(e+=r)+0]=o=f[d+2*r]+f[d+r]+1>>1,_[e+1]=s=f[d+2*r]+2*f[d+r]+f[d+0]+2>>2,_[e+2]=i,_[e+3]=a,_[(e+=r)+0]=f[d+3*r]+f[d+2*r]+1>>1,_[e+1]=f[d+3*r]+2*f[d+2*r]+f[d+r]+2>>2,_[e+2]=o,_[e+3]=s}function predict_hu_4x4(_,e,r){var t,n,i,a,o,s=_,f=e-1;_[e+0]=s[f+0*r]+s[f+1*r]+1>>1,_[e+1]=s[f+0*r]+2*s[f+1*r]+s[f+2*r]+2>>2,_[e+2]=t=s[f+1*r]+s[f+2*r]+1>>1,_[e+3]=n=s[f+1*r]+2*s[f+2*r]+s[f+3*r]+2>>2,_[(e+=r)+0]=t,_[e+1]=n,_[e+2]=i=s[f+2*r]+s[f+3*r]+1>>1,_[e+3]=a=s[f+2*r]+2*s[f+3*r]+s[f+3*r]+2>>2,_[(e+=r)+0]=i,_[e+1]=a,_[e+2]=o=s[f+3*r],_[e+3]=o,_[(e+=r)+0]=o,_[e+1]=o,_[e+2]=o,_[e+3]=o}function predict_h_16x16(_,e,r){predict_h_nxn(_,e,r,16)}function predict_v_16x16(_,e,r){predict_v_nxn(_,e,r,16)}function predict_tm_16x16(_,e,r){predict_tm_nxn(_,e,r,16)}function predict_h_8x8(_,e,r){predict_h_nxn(_,e,r,8)}function predict_v_8x8(_,e,r){predict_v_nxn(_,e,r,8)}function predict_tm_8x8(_,e,r){predict_tm_nxn(_,e,r,8)}function predict_tm_4x4(_,e,r){predict_tm_nxn(_,e,r,4)}var tmp_4=new Array(0,0,0,0);function copy_down(_,e,r){var t,n=_,i=e+16-r;for(t=0;t<4;++t)tmp_4[0+t]=n[i+t];for(i+=4*r,t=0;t<4;++t)n[i+t]=tmp_4[0+t];for(i+=4*r,t=0;t<4;++t)n[i+t]=tmp_4[0+t];for(i+=4*r,t=0;t<4;++t)n[i+t]=tmp_4[0+t]}function b_pred(_,e,r,t,n,i){var a=int_;for(copy_down(_,e,r),a=0;a<16;a++){var o=_,s=e+4*(3&a);switch(t.splitt.mvs[a].d.x){case B_DC_PRED:predict_dc_nxn(o,s,r,4);break;case B_TM_PRED:predict_tm_4x4(o,s,r);break;case B_VE_PRED:predict_ve_4x4(o,s,r);break;case B_HE_PRED:predict_he_4x4(o,s,r);break;case B_LD_PRED:predict_ld_4x4(o,s,r);break;case B_RD_PRED:predict_rd_4x4(o,s,r);break;case B_VR_PRED:predict_vr_4x4(o,s,r);break;case B_VL_PRED:predict_vl_4x4(o,s,r);break;case B_HD_PRED:predict_hd_4x4(o,s,r);break;case B_HU_PRED:predict_hu_4x4(o,s,r);break;default:assert(0)}vp8_dixie_idct_add(o,s,o,s,r,n,i),i+=16,3==(3&a)&&(e+=4*r)}}var y2_16=Arr(16,0);function fixup_dc_coeffs(_,e,r){var t=int_;for(vp8_dixie_walsh(e,r+384,y2_16,0),t=0;t<16;t++)e[r+16*t]=y2_16[t]}function predict_intra_luma(_,e,r,t,n,i){if(t.base.y_mode==B_PRED)b_pred(_,e,r,t,n,i);else{var a=int_;switch(t.base.y_mode){case DC_PRED:predict_dc_nxn(_,e,r,16);break;case V_PRED:predict_v_16x16(_,e,r);break;case H_PRED:predict_h_16x16(_,e,r);break;case TM_PRED:predict_tm_16x16(_,e,r);break;default:assert(0)}for(fixup_dc_coeffs(t,n,i),a=0;a<16;a++)vp8_dixie_idct_add(_,e,_,e,r,n,i),i+=16,e+=4,3==(3&a)&&(e+=4*r-16)}}function predict_intra_chroma(_,e,r,t,n,i,a,o){var s=int_;switch(i.base.uv_mode){case DC_PRED:predict_dc_nxn(_,e,n,8),predict_dc_nxn(r,t,n,8);break;case V_PRED:predict_v_8x8(_,e,n),predict_v_8x8(r,t,n);break;case H_PRED:predict_h_8x8(_,e,n),predict_h_8x8(r,t,n);break;case TM_PRED:predict_tm_8x8(_,e,n),predict_tm_8x8(r,t,n);break;default:assert(0)}for(o+=256,s=16;s<20;s++)vp8_dixie_idct_add(_,e,_,e,n,a,o),o+=16,e+=4,1&s&&(e+=4*n-8);for(s=20;s<24;s++)vp8_dixie_idct_add(r,t,r,t,n,a,o),o+=16,t+=4,1&s&&(t+=4*n-8)}function sixtap_horiz(_,e,r,t,n,i,a,o,s){var f=int_,d=int_,E=int_;for(f=0;f<o;f++){for(d=0;d<a;d++)E=t[n-2]*s[0]+t[n-1]*s[1]+t[n+0]*s[2]+t[n+1]*s[3]+t[n+2]*s[4]+t[n+3]*s[5]+64,E>>=7,_[e+d]=E,n++;n+=i-a,e+=r}}function sixtap_vert(_,e,r,t,n,i,a,o,s){var f=int_,d=int_,E=int_;for(f=0;f<o;f++){for(d=0;d<a;d++)E=t[n-2*i]*s[0]+t[n-1*i]*s[1]+t[n+0*i]*s[2]+t[n+1*i]*s[3]+t[n+2*i]*s[4]+t[n+3*i]*s[5]+64,E>>=7,_[e+d]=E,n++;n+=i-a,e+=r}}var temp_=new Array(336);function sixtap_2d(_,e,r,t,n,i,a,o,s,f,d){sixtap_horiz(temp_,0,16,t,n-2*i,i,a,o+5,d[s]),sixtap_vert(_,e,r,temp_,32,16,a,o,d[f])}var img_index=function(){this.y=char_,this.u=char_,this.v=char_,this.y_off=0,this.u_off=0,this.v_off=0,this.stride=int_,this.uv_stride=int_};function filter_block(_,e,r,t,n,i,a,o){var s,f;return a.d.x||a.d.y?(s=7&a.d.x,f=7&a.d.y,n+=(a.d.y>>3)*i+(a.d.x>>3),s|f&&(sixtap_2d(e,r,i,t,n,i,4,4,s,f,o),t=e,n=r),_[0]=n,t):(_[0]=n,t)}function recon_1_block(_,e,r,t,n,i,a,o,s,f,d){var E=[0];vp8_dixie_idct_add(_,e,filter_block(E,_,e,r,t,n,i,a),E[0],n,o,s+16*d)}function calculate_chroma_splitmv(_,e,r){var t=int_,n=new mv;return(t=_.splitt.mvs[e].d.x+_.splitt.mvs[e+1].d.x+_.splitt.mvs[e+4].d.x+_.splitt.mvs[e+5].d.x)<0?t-=4:t+=4,n.d.x=parseInt(t/8,10),(t=_.splitt.mvs[e].d.y+_.splitt.mvs[e+1].d.y+_.splitt.mvs[e+4].d.y+_.splitt.mvs[e+5].d.y)<0?t-=4:t+=4,n.d.y=parseInt(t/8,10),r&&(n.d.x&=-8,n.d.y&=-8),n}function build_mc_border(_,e,r,t,n,i,a,o,s,f,d){var E,c=char_;E=r,c=t-i-a*n,a>=d?c+=(d-1)*n:a>0&&(c+=a*n);do{var l,m=int_,A=0;(m=i<0?-i:0)>o&&(m=o),i+o>f&&(A=i+o-f),A>o&&(A=o),l=o-m-A,m&&memset(_,e,E[c+0],m),l&&memcpy(_,e+m,E,c+i+m,l),A&&memset(_,e+m+l,E[c+f-1],A),e+=n,++a<d&&a>0&&(c+=n)}while(--s)}function recon_1_edge_block(_,e,r,t,n,i,a,o,s,f,d,E,c,l,m,A,u){var p=u;c+=o.d.x>>3,l+=o.d.y>>3,(c<2||c+4-1+3>=m||l<2||l+4-1+3>=A)&&(build_mc_border(r,t,n,(i+=(o.d.x>>3)+(o.d.y>>3)*a)-2-2*a,a,c-2,l-2,9,9,m,A),n=r,i=t+2*a+2,i-=(o.d.x>>3)+(o.d.y>>3)*a);var T=[0];vp8_dixie_idct_add(_,e,filter_block(T,_,e,n,i,a,o,s),T[0],a,f,d+16*p)}var uvmv_1=new mv;function predict_inter_emulated_edge(_,e,r,t,n,i,a){var o,s,f,d=_.frame_strg[0].img.img_data,E=_.frame_strg[0].img.img_data_off,c=0,l=0,m=int_,A=int_,u=int_,p=int_,T=int_,y=Arr_new(4,mv),b=e.u,v=e.v,h=e.u_off,w=e.v_off,I=(3==_.frame_hdr.version)+0;if(u=16*i,p=16*a,m=16*_.mb_cols,A=16*_.mb_rows,s=e.y,l=e.y_off,f=_.ref_frame_offsets[n.base.ref_frame],o=_.ref_frame_offsets_[n.base.ref_frame],c=l+f,n.base.y_mode!=SPLITMV){var R=uvmv_1;R.d.x=n.base.mv.d.x,R.d.y=n.base.mv.d.y,R.d.x=R.d.x+1>>1,R.d.y=R.d.y+1>>1,I&&(R.d.x&=-8,R.d.y&=-8),y[0].d.x=R.d.x,y[0].d.y=R.d.y,y[1].d.x=R.d.x,y[1].d.y=R.d.y,y[2].d.x=R.d.x,y[2].d.y=R.d.y,y[3].d.x=R.d.x,y[3].d.y=R.d.y}else y[0]=calculate_chroma_splitmv(n,0,I),y[1]=calculate_chroma_splitmv(n,2,I),y[2]=calculate_chroma_splitmv(n,8,I),y[3]=calculate_chroma_splitmv(n,10,I);for(T=0;T<16;T++){var N;N=n.base.y_mode!=SPLITMV?n.base.mv:n.splitt.mvs[+T],recon_1_edge_block(s,l,d,E,o,c,e.stride,N,_.subpixel_filters,r,t,n,u,p,m,A,T),u+=4,l+=4,c+=4,3==(3&T)&&(u-=16,p+=4,l+=4*e.stride-16,c+=4*e.stride-16)}for(u=16*i,p=16*a,u>>=1,p>>=1,m>>=1,A>>=1,T=0;T<4;T++)recon_1_edge_block(b,h,d,E,o,h+f,e.uv_stride,y[T],_.subpixel_filters,r,t,n,u,p,m,A,T+16),recon_1_edge_block(v,w,d,E,o,w+f,e.uv_stride,y[T],_.subpixel_filters,r,t,n,u,p,m,A,T+20),h+=4,w+=4,u+=4,1&T&&(u-=8,p+=4,h+=4*e.uv_stride-8,w+=4*e.uv_stride-8)}var uvmv_2=new mv;function predict_inter(_,e,r,t,n){var i,a,o=e.y,s=e.y_off,f=e.u,d=e.u_off,E=e.v,c=e.v_off,l=Arr_new(4,mv),m=(3==_.frame_hdr.version)+0,A=int_;if(n.base.y_mode!=SPLITMV){var u=uvmv_2;u.d.x=n.base.mv.d.x,u.d.y=n.base.mv.d.y,u.d.x=u.d.x+1>>1,u.d.y=u.d.y+1>>1,m&&(u.d.x&=-8,u.d.y&=-8),l[0].d.x=l[1].d.x=l[2].d.x=l[3].d.x=u.d.x,l[0].d.y=l[1].d.y=l[2].d.y=l[3].d.y=u.d.y}else l[0]=calculate_chroma_splitmv(n,0,m),l[1]=calculate_chroma_splitmv(n,2,m),l[2]=calculate_chroma_splitmv(n,8,m),l[3]=calculate_chroma_splitmv(n,10,m);for(a=_.ref_frame_offsets[n.base.ref_frame],i=_.ref_frame_offsets_[n.base.ref_frame],A=0;A<16;A++){var p;p=n.base.y_mode!=SPLITMV?n.base.mv:n.splitt.mvs[+A],recon_1_block(o,s,i,s+a,e.stride,p,_.subpixel_filters,r,t,n,A),s+=4,3==(3&A)&&(s+=4*e.stride-16)}for(A=0;A<4;A++)recon_1_block(f,d,i,d+a,e.uv_stride,l[A],_.subpixel_filters,r,t,n,A+16),recon_1_block(E,c,i,c+a,e.uv_stride,l[A],_.subpixel_filters,r,t,n,A+20),d+=4,c+=4,1&A&&(d+=4*e.uv_stride-8,c+=4*e.uv_stride-8)}function vp8_dixie_release_ref_frame(_){_&&(assert(_.ref_cnt),_.ref_cnt--)}function vp8_dixie_ref_frame(_){return _.ref_cnt++,_}function vp8_dixie_find_free_ref_frame(_){var e=int_;for(e=0;e<NUM_REF_FRAMES;e++)if(0==_[e].ref_cnt)return _[e].ref_cnt=1,_[e];return assert(0),null}function fixup_left(_,e,r,t,n,i){var a=_,o=e-1,s=int_;if(i==DC_PRED&&n){var f=_,d=e-t;for(s=0;s<r;s++)a[o]=f[d+s],o+=t}else for(o-=t,s=-1;s<r;s++)a[o]=129,o+=t}function fixup_above(_,e,r,t,n,i){var a=_,o=e-t,s=int_;if(i==DC_PRED&&n){var f=_,d=e-1;for(s=0;s<r;s++)a[o+s]=f[d],d+=t}else memset(a,o-1,127,r+1);memset(a,o+r,127,4)}function vp8_dixie_predict_init(_){var e,r=int_;if(_.frame_hdr.frame_size_updated){for(r=0;r<NUM_REF_FRAMES;r++){var t=16*_.mb_cols+2*BORDER_PIXELS,n=16*_.mb_rows+2*BORDER_PIXELS;vpx_img_free(_.frame_strg[r].img),_.frame_strg[r].ref_cnt=0,_.ref_frames[r]=null,vpx_img_alloc(_.frame_strg[r].img,IMG_FMT_I420,t,n,16)||vpx_internal_error(_.error,VPX_CODEC_MEM_ERROR,"Failed to allocate %dx%d framebuffer",t,n),vpx_img_set_rect(_.frame_strg[r].img,BORDER_PIXELS,BORDER_PIXELS,_.frame_hdr.kf.w,_.frame_hdr.kf.h)}_.frame_hdr.version?_.subpixel_filters=bilinear_filters:_.subpixel_filters=sixtap_filters}for(_.ref_frames[CURRENT_FRAME]&&vp8_dixie_release_ref_frame(_.ref_frames[CURRENT_FRAME]),_.ref_frames[CURRENT_FRAME]=vp8_dixie_find_free_ref_frame(_.frame_strg),e=_.ref_frames[CURRENT_FRAME].img.img_data,r=0;r<NUM_REF_FRAMES;r++){var i=_.ref_frames[r];_.ref_frame_offsets[r]=i?i.img.img_data_off-0:0,_.ref_frame_offsets_[r]=i?i.img.img_data:e}}var img_1=new img_index;function vp8_dixie_predict_process_row(_,e,r,t){var n,i,a=img_1,o=0,s=int_,f=0;for(a.stride=_.ref_frames[CURRENT_FRAME].img.stride[PLANE_Y],a.uv_stride=_.ref_frames[CURRENT_FRAME].img.stride[PLANE_U],a.y=_.ref_frames[CURRENT_FRAME].img.planes[PLANE_Y],a.y_off=_.ref_frames[CURRENT_FRAME].img.planes_off[PLANE_Y],a.u=_.ref_frames[CURRENT_FRAME].img.planes[PLANE_U],a.u_off=_.ref_frames[CURRENT_FRAME].img.planes_off[PLANE_U],a.v=_.ref_frames[CURRENT_FRAME].img.planes[PLANE_V],a.v_off=_.ref_frames[CURRENT_FRAME].img.planes_off[PLANE_V],a.y_off+=16*(a.stride*e+r),a.u_off+=8*(a.uv_stride*e+r),a.v_off+=8*(a.uv_stride*e+r),n=_.mb_info_rows[1+e],o=_.mb_info_rows_off[1+e]+r,i=_.tokens[e&_.token_hdr.partitions-1].coeffs,f=400*r,0==r&&(fixup_left(a.y,a.y_off,16,a.stride,e,n[o].base.y_mode),fixup_left(a.u,a.u_off,8,a.uv_stride,e,n[o].base.uv_mode),fixup_left(a.v,a.v_off,8,a.uv_stride,e,n[o].base.uv_mode),0==e&&(a.y[a.y_off-a.stride-1]=127)),s=r;s<r+t;s++)0==e&&(fixup_above(a.y,a.y_off,16,a.stride,s,n[o].base.y_mode),fixup_above(a.u,a.u_off,8,a.uv_stride,s,n[o].base.uv_mode),fixup_above(a.v,a.v_off,8,a.uv_stride,s,n[o].base.uv_mode)),n[o].base.y_mode<=B_PRED?(predict_intra_luma(a.y,a.y_off,a.stride,n[o],i,f),predict_intra_chroma(a.u,a.u_off,a.v,a.v_off,a.uv_stride,n[o],i,f)):(n[o].base.y_mode!=SPLITMV&&fixup_dc_coeffs(n[o],i,f),n[o].base.need_mc_border?predict_inter_emulated_edge(_,a,i,f,n[o],s,e):predict_inter(_,a,i,f,n[o])),o++,a.y_off+=16,a.u_off+=8,a.v_off+=8,f+=400;if(s==_.mb_cols){var d=a.y,E=a.y_off+15*a.stride,c=a.y[a.y_off-1+15*a.stride];d[E]=d[E+1]=d[E+2]=d[E+3]=c}}var FRAME_HEADER_SZ=3,KEYFRAME_HEADER_SZ=7;function ARRAY_COPY(_,e){assert(_.length==e.length),memcpy(_,0,e,0,_.length)}function decode_entropy_header(_,e,r){var t=int_,n=int_,i=int_,a=int_,o=0;for(t=0;t<BLOCK_TYPES;t++)for(n=0;n<COEF_BANDS;n++)for(i=0;i<PREV_COEF_CONTEXTS;i++)for(a=0;a<ENTROPY_NODES;a++)bool_get(e,k_coeff_entropy_update_probs[t][n][i][a])&&(r.coeff_probs_[o]=r.coeff_probs[t][n][i][a]=bool_get_uint(e,8)),o++;if(r.coeff_skip_enabled=bool_get_bit(e),r.coeff_skip_enabled&&(r.coeff_skip_prob=bool_get_uint(e,8)),!_.frame_hdr.is_keyframe){if(r.prob_inter=bool_get_uint(e,8),r.prob_last=bool_get_uint(e,8),r.prob_gf=bool_get_uint(e,8),bool_get_bit(e))for(t=0;t<4;t++)r.y_mode_probs[t]=bool_get_uint(e,8);if(bool_get_bit(e))for(t=0;t<3;t++)r.uv_mode_probs[t]=bool_get_uint(e,8);for(t=0;t<2;t++)for(n=0;n<MV_PROB_CNT;n++)if(bool_get(e,k_mv_entropy_update_probs[t][n])){var s=bool_get_uint(e,7);r.mv_probs[t][n]=s?s<<1:1}}}function decode_reference_header(_,e,r){var t=_.frame_hdr.is_keyframe;r.refresh_gf=t?1:bool_get_bit(e),r.refresh_arf=t?1:bool_get_bit(e),r.copy_gf=t||r.refresh_gf?0:bool_get_uint(e,2),r.copy_arf=t||r.refresh_arf?0:bool_get_uint(e,2),r.sign_bias[GOLDEN_FRAME]=t?0:bool_get_bit(e),r.sign_bias[ALTREF_FRAME]=t?0:bool_get_bit(e),r.refresh_entropy=bool_get_bit(e),r.refresh_last=t?1:bool_get_bit(e)}function decode_quantizer_header(_,e,r){var t=int_,n=r.q_index;r.q_index=bool_get_uint(e,7),t=(n!=r.q_index)+0,t|=r.y1_dc_delta_q=bool_maybe_get_int(e,4),t|=r.y2_dc_delta_q=bool_maybe_get_int(e,4),t|=r.y2_ac_delta_q=bool_maybe_get_int(e,4),t|=r.uv_dc_delta_q=bool_maybe_get_int(e,4),t|=r.uv_ac_delta_q=bool_maybe_get_int(e,4),r.delta_update=t}function decode_and_init_token_partitions(_,e,r,t,n,i){var a=int_;for(i.partitions=1<<bool_get_uint(e,2),n<3*(i.partitions-1)&&vpx_internal_error(_.error,VPX_CODEC_CORRUPT_FRAME,"Truncated packet found parsing partition lengths."),n-=3*(i.partitions-1),a=0;a<i.partitions;a++)a<i.partitions-1?(i.partition_sz[a]=r[t+2]<<16|r[t+1]<<8|r[t+0],t+=3):i.partition_sz[a]=n,n<i.partition_sz[a]&&vpx_internal_error(_.error,VPX_CODEC_CORRUPT_FRAME,"Truncated partition %d",a),n-=i.partition_sz[a];for(a=0;a<_.token_hdr.partitions;a++)init_bool_decoder(_.tokens[a].bool,r,t,_.token_hdr.partition_sz[a]),t+=_.token_hdr.partition_sz[a]}function decode_loopfilter_header(_,e,r){if(_.frame_hdr.is_keyframe&&memset(r,0,1),r.use_simple=bool_get_bit(e),r.level=bool_get_uint(e,6),r.sharpness=bool_get_uint(e,3),r.delta_enabled=bool_get_bit(e),r.delta_enabled&&bool_get_bit(e)){var t=int_;for(t=0;t<BLOCK_CONTEXTS;t++)r.ref_delta[t]=bool_maybe_get_int(e,6);for(t=0;t<BLOCK_CONTEXTS;t++)r.mode_delta[t]=bool_maybe_get_int(e,6)}}function decode_segmentation_header(_,e,r){if(_.frame_hdr.is_keyframe&&memset(r,0,1),r.enabled=bool_get_bit(e),r.enabled){var t=int_;if(r.update_map=bool_get_bit(e),r.update_data=bool_get_bit(e),r.update_data){for(r.abs_=bool_get_bit(e),t=0;t<MAX_MB_SEGMENTS;t++)r.quant_idx[t]=bool_maybe_get_int(e,7);for(t=0;t<MAX_MB_SEGMENTS;t++)r.lf_level[t]=bool_maybe_get_int(e,6)}if(r.update_map)for(t=0;t<MB_FEATURE_TREE_PROBS;t++)r.tree_probs[t]=bool_get_bit(e)?bool_get_uint(e,8):255}else r.update_map=0,r.update_data=0}function clamp_q(_){return _<0?0:_>127?127:_}function dc_q(_){return dc_q_lookup[clamp_q(_)]}function ac_q(_){return ac_q_lookup[clamp_q(_)]}function dequant_init(_,e,r){var t=int_,n=int_,i=_,a=0;for(t=0;t<(e.enabled?MAX_MB_SEGMENTS:1);t++)n=r.q_index,e.enabled&&(n=e.abs_?e.quant_idx[t]:n+e.quant_idx[t]),(i[a].quant_idx!=n||r.delta_update)&&(i[a].factor[TOKEN_BLOCK_Y1][0]=dc_q(n+r.y1_dc_delta_q),i[a].factor[TOKEN_BLOCK_Y1][1]=ac_q(n),i[a].factor[TOKEN_BLOCK_UV][0]=dc_q(n+r.uv_dc_delta_q),i[a].factor[TOKEN_BLOCK_UV][1]=ac_q(n+r.uv_ac_delta_q),i[a].factor[TOKEN_BLOCK_Y2][0]=2*dc_q(n+r.y2_dc_delta_q),i[a].factor[TOKEN_BLOCK_Y2][1]=parseInt(155*ac_q(n+r.y2_ac_delta_q)/100),i[a].factor[TOKEN_BLOCK_Y2][1]<8&&(i[a].factor[TOKEN_BLOCK_Y2][1]=8),i[a].factor[TOKEN_BLOCK_UV][0]>132&&(i[a].factor[TOKEN_BLOCK_UV][0]=132),i[a].quant_idx=n),a++}var bool_1=new bool_decoder;function decode_frame(_,e,r,t){var n,i=bool_1,a=int_,o=int_,s=int_;if(_.saved_entropy_valid=0,(n=vp8_parse_frame_header(e,t,_.frame_hdr))&&vpx_internal_error(_.error,n,"Failed to parse frame header"),_.frame_hdr.is_experimental&&vpx_internal_error(_.error,VPX_CODEC_UNSUP_BITSTREAM,"Experimental bitstreams not supported."),r+=FRAME_HEADER_SZ,t-=FRAME_HEADER_SZ,_.frame_hdr.is_keyframe&&(r+=KEYFRAME_HEADER_SZ,t-=KEYFRAME_HEADER_SZ,_.mb_cols=parseInt((_.frame_hdr.kf.w+15)/16,10),_.mb_rows=parseInt((_.frame_hdr.kf.h+15)/16,10)),init_bool_decoder(i,e,r,_.frame_hdr.part0_sz),_.frame_hdr.is_keyframe&&bool_get_uint(i,2)&&vpx_internal_error(_.error,VPX_CODEC_UNSUP_BITSTREAM,"Reserved bits not supported."),decode_segmentation_header(_,i,_.segment_hdr),decode_loopfilter_header(_,i,_.loopfilter_hdr),decode_and_init_token_partitions(_,i,e,r+_.frame_hdr.part0_sz,t-_.frame_hdr.part0_sz,_.token_hdr),decode_quantizer_header(_,i,_.quant_hdr),decode_reference_header(_,i,_.reference_hdr),_.frame_hdr.is_keyframe){a=int_;var f=int_,d=int_,E=int_,c=0;for(a=0;a<BLOCK_TYPES;a++)for(f=0;f<COEF_BANDS;f++)for(d=0;d<PREV_COEF_CONTEXTS;d++)for(E=0;E<ENTROPY_NODES;E++)_.entropy_hdr.coeff_probs_[c]=_.entropy_hdr.coeff_probs[a][f][d][E]=k_default_coeff_probs[a][f][d][E],c++;_.entropy_hdr.mv_probs=new k_default_mv_probs,ARRAY_COPY(_.entropy_hdr.y_mode_probs,k_default_y_mode_probs),ARRAY_COPY(_.entropy_hdr.uv_mode_probs,k_default_uv_mode_probs)}if(!_.reference_hdr.refresh_entropy){var l=_.saved_entropy,m=_.entropy_hdr;c=0;for(a=0;a<BLOCK_TYPES;a++)for(f=0;f<COEF_BANDS;f++)for(d=0;d<PREV_COEF_CONTEXTS;d++)for(E=0;E<ENTROPY_NODES;E++)l.coeff_probs_[c]=l.coeff_probs[a][f][d][E]=m.coeff_probs[a][f][d][E],c++;for(l.coeff_skip_enabled=m.coeff_skip_enabled,l.coeff_skip_prob=m.coeff_skip_prob,a=0;a<2;++a)for(f=0;f<19;++f)l.mv_probs[a][f]=m.mv_probs[a][f];for(l.prob_gf=m.prob_gf,l.prob_inter=m.prob_inter,l.prob_last=m.prob_last,a=0;a<3;++a)l.uv_mode_probs[a]=m.uv_mode_probs[a];for(a=0;a<4;++a)l.y_mode_probs[a]=m.y_mode_probs[a];_.saved_entropy_valid=1}for(decode_entropy_header(_,i,_.entropy_hdr),vp8_dixie_modemv_init(_),vp8_dixie_tokens_init(_),vp8_dixie_predict_init(_),dequant_init(_.dequant_factors,_.segment_hdr,_.quant_hdr),o=0,s=0;o<_.mb_rows;o++)vp8_dixie_modemv_process_row(_,i,o,0,_.mb_cols),vp8_dixie_tokens_process_row(_,s,o,0,_.mb_cols),vp8_dixie_predict_process_row(_,o,0,_.mb_cols),_.loopfilter_hdr.level&&o&&vp8_dixie_loopfilter_process_row(_,o-1,0,_.mb_cols),++s==_.token_hdr.partitions&&(s=0);if(_.loopfilter_hdr.level&&vp8_dixie_loopfilter_process_row(_,o-1,0,_.mb_cols),_.frame_cnt++,!_.reference_hdr.refresh_entropy){l=_.entropy_hdr,m=_.saved_entropy,c=0;for(a=0;a<BLOCK_TYPES;a++)for(f=0;f<COEF_BANDS;f++)for(d=0;d<PREV_COEF_CONTEXTS;d++)for(E=0;E<ENTROPY_NODES;E++)l.coeff_probs_[c]=l.coeff_probs[a][f][d][E]=m.coeff_probs[a][f][d][E]=m.coeff_probs_[c],c++;for(l.coeff_skip_enabled=m.coeff_skip_enabled,l.coeff_skip_prob=m.coeff_skip_prob,a=0;a<2;++a)for(f=0;f<19;++f)l.mv_probs[a][f]=m.mv_probs[a][f];for(l.prob_gf=m.prob_gf,l.prob_inter=m.prob_inter,l.prob_last=m.prob_last,a=0;a<3;++a)l.uv_mode_probs[a]=m.uv_mode_probs[a];for(a=0;a<4;++a)l.y_mode_probs[a]=m.y_mode_probs[a];_.saved_entropy_valid=0}1==_.reference_hdr.copy_arf?(vp8_dixie_release_ref_frame(_.ref_frames[ALTREF_FRAME]),_.ref_frames[ALTREF_FRAME]=vp8_dixie_ref_frame(_.ref_frames[LAST_FRAME])):2==_.reference_hdr.copy_arf&&(vp8_dixie_release_ref_frame(_.ref_frames[ALTREF_FRAME]),_.ref_frames[ALTREF_FRAME]=vp8_dixie_ref_frame(_.ref_frames[GOLDEN_FRAME])),1==_.reference_hdr.copy_gf?(vp8_dixie_release_ref_frame(_.ref_frames[GOLDEN_FRAME]),_.ref_frames[GOLDEN_FRAME]=vp8_dixie_ref_frame(_.ref_frames[LAST_FRAME])):2==_.reference_hdr.copy_gf&&(vp8_dixie_release_ref_frame(_.ref_frames[GOLDEN_FRAME]),_.ref_frames[GOLDEN_FRAME]=vp8_dixie_ref_frame(_.ref_frames[ALTREF_FRAME])),_.reference_hdr.refresh_gf&&(vp8_dixie_release_ref_frame(_.ref_frames[GOLDEN_FRAME]),_.ref_frames[GOLDEN_FRAME]=vp8_dixie_ref_frame(_.ref_frames[CURRENT_FRAME])),_.reference_hdr.refresh_arf&&(vp8_dixie_release_ref_frame(_.ref_frames[ALTREF_FRAME]),_.ref_frames[ALTREF_FRAME]=vp8_dixie_ref_frame(_.ref_frames[CURRENT_FRAME])),_.reference_hdr.refresh_last&&(vp8_dixie_release_ref_frame(_.ref_frames[LAST_FRAME]),_.ref_frames[LAST_FRAME]=vp8_dixie_ref_frame(_.ref_frames[CURRENT_FRAME]))}function CHECK_FOR_UPDATE(_,e,r){var t=_;return r[0]|=t!=(_=e),_}function vp8_parse_frame_header(_,e,r){var t=long_;if(e<10)return VPX_CODEC_CORRUPT_FRAME;if(t=_[0]|_[1]<<8|_[2]<<16,r.is_keyframe=!BITS_GET(t,0,1),r.version=BITS_GET(t,1,2),r.is_experimental=BITS_GET(t,3,1),r.is_shown=BITS_GET(t,4,1),r.part0_sz=BITS_GET(t,5,19),e<=r.part0_sz+(r.is_keyframe?10:3))return VPX_CODEC_CORRUPT_FRAME;if(r.frame_size_updated=0,r.is_keyframe){var n=[0];if(157!=_[3]||1!=_[4]||42!=_[5])return VPX_CODEC_UNSUP_BITSTREAM;if(t=_[6]|_[7]<<8|_[8]<<16|_[9]<<24,r.kf.w=CHECK_FOR_UPDATE(r.kf.w,BITS_GET(t,0,14),n),r.kf.scale_w=CHECK_FOR_UPDATE(r.kf.scale_w,BITS_GET(t,14,2),n),r.kf.h=CHECK_FOR_UPDATE(r.kf.h,BITS_GET(t,16,14),n),r.kf.scale_h=CHECK_FOR_UPDATE(r.kf.scale_h,BITS_GET(t,30,2),n),r.frame_size_updated=n[0],!r.kf.w||!r.kf.h)return VPX_CODEC_UNSUP_BITSTREAM}return VPX_CODEC_OK}function vp8_dixie_decode_frame(_,e,r){var t=_;return _.error.error_code=VPX_CODEC_OK,_.error.has_detail=0,setjmp(_.error.jmp)||decode_frame(_,e,0,r),t.error.error_code}function vp8_dixie_decode_destroy(_){vp8_dixie_predict_destroy(_),vp8_dixie_tokens_destroy(_),vp8_dixie_modemv_destroy(_)}var vpx_codec_alg_priv=function(){decoder_ctx=new vp8_decoder_ctx,img=new vpx_image_t,img_avail=int_};function update_error_state(_,e){var r;return(r=e.error_code)&&(_.base.err_detail=e.has_detail?e.detail:null),r}function vp8_init(_){var e=VPX_CODEC_OK;if(!_.priv){var r=new vpx_codec_alg_priv_t;if(_.priv=r,!_.priv)return VPX_CODEC_MEM_ERROR;_.priv.sz=1,_.priv.iface=_.iface,_.priv.alg_priv=r,_.priv.init_flags=_.init_flags,_.config.dec&&(_.priv.alg_priv.cfg=_.config.dec,_.config.dec=_.priv.alg_priv.cfg)}return e}function vp8_destroy(_){return vp8_dixie_decode_destroy(_.decoder_ctx),_.base.alg_priv="",VPX_CODEC_OK}function vp8_peek_si(_,e,r){var t,n=new vp8_frame_hdr;return(t=vp8_parse_frame_header(_,e,n))||(r.is_kf=n.is_keyframe,r.is_kf?(r.w=n.kf.w,r.h=n.kf.h):(r.w=0,r.h=0)),t}function vp8_get_si(_,e){var r=int_;return r=(e.sz,1),memcpy(e,_.si,r),alert("todo"),e.sz=r,VPX_CODEC_OK}function vp8_decode(_,e,r,t,n){var i;return(i=vp8_dixie_decode_frame(_.decoder_ctx,e,r))&&update_error_state(_,_.decoder_ctx.error),_.img_avail=_.decoder_ctx.frame_hdr.is_shown,_.img=_.decoder_ctx.ref_frames[CURRENT_FRAME].img,i}function vp8_get_frame(_,e){var r=null;return _.img_avail&&(e[0]||(r=_.img,e[0]=r)),r}var ctf_maps=create_obj_vals_from_arrayChilds(vpx_codec_ctrl_fn_map_t,[[-1,null]]);function webmdata(_){main(_)}CODEC_INTERFACE("vpx_codec_vp8_dx",new Array('VP8 "Dixie" Decoder'+VERSION_STRING,VPX_CODEC_INTERNAL_ABI_VERSION,VPX_CODEC_CAP_DECODER,"vp8_init","vp8_destroy","ctf_maps",null,null,new Array("vp8_peek_si","vp8_get_si","vp8_decode","vp8_get_frame"))),window.webmdata=webmdata;var VP8_FOURCC=3690582,ifaces=new Array({name:char_,iface:0,fourcc:int_,fourcc_mask:int_});ifaces[0]={name:"vp8",iface:new vpx_codec_vp8_dx_algo,fourcc:VP8_FOURCC,fourcc_mask:16777215};var RAW_FILE=0,IVF_FILE=1,WEBM_FILE=2,IVF_FRAME_HDR_SZ=12,RAW_FRAME_HDR_SZ=4;function read_frame(_,e,r,t,n){new Array(IVF_FRAME_HDR_SZ);var i=size_t,a=_.infile;if(_.kind==WEBM_FILE){if(_.chunk>=_.chunks){var o=[int_];do{if(_.pkt&&nestegg_free_packet(_.pkt),nestegg_read_packet(_.nestegg_ctx,_.pkt)<=0||nestegg_packet_track(_.pkt,o))return 1}while(o!=_.video_track);if(nestegg_packet_count(_.pkt,_.chunks))return 1;_.chunk=0}return nestegg_packet_data(_.pkt,_.chunk,e,t)?1:(_.chunk++,0)}return t[0]=i,t?fread(e,1,t[0],a)!=t[0]?(fprintf(stderr,"Failed to read full frame\n"),1):0:1}var input_ctx=function(){this.kind=0,this.infile=0,this.nestegg_ctx=new nestegg,this.pkt=[null],this.chunk=int_,this.chunks=[int_],this.video_track=int_};function nestegg_read_cb(_,e,r){var t=r;return fread(_,1,e,t)<e&&feof(t)?0:1}function nestegg_seek_cb(_,e,r){switch(e){case NESTEGG_SEEK_SET:e=SEEK_SET;break;case NESTEGG_SEEK_CUR:e=SEEK_CUR;break;case NESTEGG_SEEK_END:e=SEEK_END}return fseek(r,_,e)?-1:0}function nestegg_tell_cb(_){return ftell(_)}function file_is_webm(_,e,r,t,n,i){var a=int_,o=[int_],s=-1,f={read:nestegg_read_cb,seek:nestegg_seek_cb,tell:nestegg_tell_cb,userdata:_.infile},d=new nestegg_video_params;for(_.nestegg_ctx=[_.nestegg_ctx],nestegg_init(_.nestegg_ctx,f,null)&&alert("goto fail"),_.nestegg_ctx=_.nestegg_ctx[0],nestegg_track_count(_.nestegg_ctx,o)&&alert("goto fail"),a=0;a<o&&(s=nestegg_track_type(_.nestegg_ctx,a))!=NESTEGG_TRACK_VIDEO;a++)s<0&&alert("goto fail");return nestegg_track_codec_id(_.nestegg_ctx,a)!=NESTEGG_CODEC_VP8&&(fprintf(stderr,"Not VP8 video, quitting.\n"),exit(1)),_.video_track=a,nestegg_track_video_params(_.nestegg_ctx,a,d)&&alert("goto fail"),n[0]=0,i[0]=0,e[0]=VP8_FOURCC,r[0]=d.width,t[0]=d.height,1}function main(_,e,r){var t=[null],n=[null],i=[0],a=[0],o={data:_,data_off:0},s=[int_],f=[int_],d=[int_],E=[int_],c=[int_],l=new input_ctx;if(l.infile=o,!file_is_webm(l,s,f,d,E,c))return alert("Unrecognized input file type.\n"),EXIT_FAILURE;l.kind=WEBM_FILE;var m=document.getElementById("timecode"),A=document.getElementById("render"),u=document.getElementById("frame"),p=new Date,T=0,y=new vp8_decoder_ctx;!function _(){!read_frame(l,t,n,i,a)&&setTimeout((function(){t=t[0],p=new Date,vp8_dixie_decode_frame(y,t,i),t=[t];var e=y.frame_hdr.is_shown,r=y.ref_frames[0].img;b=new Date,m.innerHTML=l.pkt[0].timecode+" ("+(l.pkt[0].timecode/1e9>>0)+" sec)",e&&(A.innerHTML=b-p+"ms<br />FPS:"+(1e3/(b-p)).toFixed(2),r&&vpximg2canvas(r),T++,u.innerHTML=T),_()}),0)}();var b=new Date}
8
+ /*!
9
+ * jQuery JavaScript Library v2.0.3
10
+ * http://jquery.com/
11
+ *
12
+ * Includes Sizzle.js
13
+ * http://sizzlejs.com/
14
+ *
15
+ * Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors
16
+ * Released under the MIT license
17
+ * http://jquery.org/license
18
+ *
19
+ * Date: 2013-07-03T13:30Z
20
+ */
7
21
  !function(e,t){var n,r,i=typeof t,o=e.location,s=e.document,a=s.documentElement,u=e.jQuery,l=e.$,c={},f=[],p="2.0.3",d=f.concat,h=f.push,g=f.slice,m=f.indexOf,y=c.toString,v=c.hasOwnProperty,x=p.trim,b=function(e,t){return new b.fn.init(e,t,n)},w=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=/\S+/g,C=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,N=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,k=/^-ms-/,E=/-([\da-z])/gi,S=function(e,t){return t.toUpperCase()},j=function(){s.removeEventListener("DOMContentLoaded",j,!1),e.removeEventListener("load",j,!1),b.ready()};function D(e){var t=e.length,n=b.type(e);return!b.isWindow(e)&&(!(1!==e.nodeType||!t)||("array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)))}b.fn=b.prototype={jquery:p,constructor:b,init:function(e,n,r){var i,o;if(!e)return this;if("string"==typeof e){if(!(i="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:C.exec(e))||!i[1]&&n)return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e);if(i[1]){if(n=n instanceof b?n[0]:n,b.merge(this,b.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:s,!0)),N.test(i[1])&&b.isPlainObject(n))for(i in n)b.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i]);return this}return(o=s.getElementById(i[2]))&&o.parentNode&&(this.length=1,this[0]=o),this.context=s,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):b.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),b.makeArray(e,this))},selector:"",length:0,toArray:function(){return g.call(this)},get:function(e){return null==e?this.toArray():e<0?this[this.length+e]:this[e]},pushStack:function(e){var t=b.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return b.each(this,e,t)},ready:function(e){return b.ready.promise().done(e),this},slice:function(){return this.pushStack(g.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<t?[this[n]]:[])},map:function(e){return this.pushStack(b.map(this,(function(t,n){return e.call(t,n,t)})))},end:function(){return this.prevObject||this.constructor(null)},push:h,sort:[].sort,splice:[].splice},b.fn.init.prototype=b.fn,b.extend=b.fn.extend=function(){var e,n,r,i,o,s,a=arguments[0]||{},u=1,l=arguments.length,c=!1;for("boolean"==typeof a&&(c=a,a=arguments[1]||{},u=2),"object"==typeof a||b.isFunction(a)||(a={}),l===u&&(a=this,--u);u<l;u++)if(null!=(e=arguments[u]))for(n in e)r=a[n],a!==(i=e[n])&&(c&&i&&(b.isPlainObject(i)||(o=b.isArray(i)))?(o?(o=!1,s=r&&b.isArray(r)?r:[]):s=r&&b.isPlainObject(r)?r:{},a[n]=b.extend(c,s,i)):i!==t&&(a[n]=i));return a},b.extend({expando:"jQuery"+(p+Math.random()).replace(/\D/g,""),noConflict:function(t){return e.$===b&&(e.$=l),t&&e.jQuery===b&&(e.jQuery=u),b},isReady:!1,readyWait:1,holdReady:function(e){e?b.readyWait++:b.ready(!0)},ready:function(e){(!0===e?--b.readyWait:b.isReady)||(b.isReady=!0,!0!==e&&--b.readyWait>0||(r.resolveWith(s,[b]),b.fn.trigger&&b(s).trigger("ready").off("ready")))},isFunction:function(e){return"function"===b.type(e)},isArray:Array.isArray,isWindow:function(e){return null!=e&&e===e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?String(e):"object"==typeof e||"function"==typeof e?c[y.call(e)]||"object":typeof e},isPlainObject:function(e){if("object"!==b.type(e)||e.nodeType||b.isWindow(e))return!1;try{if(e.constructor&&!v.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(e){return!1}return!0},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw new Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||s;var r=N.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=b.buildFragment([e],t,i),i&&b(i).remove(),b.merge([],r.childNodes))},parseJSON:JSON.parse,parseXML:function(e){var n;if(!e||"string"!=typeof e)return null;try{n=(new DOMParser).parseFromString(e,"text/xml")}catch(e){n=t}return n&&!n.getElementsByTagName("parsererror").length||b.error("Invalid XML: "+e),n},noop:function(){},globalEval:function(e){var t,n=eval;(e=b.trim(e))&&(1===e.indexOf("use strict")?((t=s.createElement("script")).text=e,s.head.appendChild(t).parentNode.removeChild(t)):n(e))},camelCase:function(e){return e.replace(k,"ms-").replace(E,S)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r=0,i=e.length,o=D(e);if(n){if(o)for(;r<i&&!1!==t.apply(e[r],n);r++);else for(r in e)if(!1===t.apply(e[r],n))break}else if(o)for(;r<i&&!1!==t.call(e[r],r,e[r]);r++);else for(r in e)if(!1===t.call(e[r],r,e[r]))break;return e},trim:function(e){return null==e?"":x.call(e)},makeArray:function(e,t){var n=t||[];return null!=e&&(D(Object(e))?b.merge(n,"string"==typeof e?[e]:e):h.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:m.call(t,e,n)},merge:function(e,n){var r=n.length,i=e.length,o=0;if("number"==typeof r)for(;o<r;o++)e[i++]=n[o];else for(;n[o]!==t;)e[i++]=n[o++];return e.length=i,e},grep:function(e,t,n){var r=[],i=0,o=e.length;for(n=!!n;i<o;i++)n!==!!t(e[i],i)&&r.push(e[i]);return r},map:function(e,t,n){var r,i=0,o=e.length,s=[];if(D(e))for(;i<o;i++)null!=(r=t(e[i],i,n))&&(s[s.length]=r);else for(i in e)null!=(r=t(e[i],i,n))&&(s[s.length]=r);return d.apply([],s)},guid:1,proxy:function(e,n){var r,i,o;return"string"==typeof n&&(r=e[n],n=e,e=r),b.isFunction(e)?(i=g.call(arguments,2),o=function(){return e.apply(n||this,i.concat(g.call(arguments)))},o.guid=e.guid=e.guid||b.guid++,o):t},access:function(e,n,r,i,o,s,a){var u=0,l=e.length,c=null==r;if("object"===b.type(r))for(u in o=!0,r)b.access(e,n,u,r[u],!0,s,a);else if(i!==t&&(o=!0,b.isFunction(i)||(a=!0),c&&(a?(n.call(e,i),n=null):(c=n,n=function(e,t,n){return c.call(b(e),n)})),n))for(;u<l;u++)n(e[u],r,a?i:i.call(e[u],u,n(e[u],r)));return o?e:c?n.call(e):l?n(e[0],r):s},now:Date.now,swap:function(e,t,n,r){var i,o,s={};for(o in t)s[o]=e.style[o],e.style[o]=t[o];for(o in i=n.apply(e,r||[]),t)e.style[o]=s[o];return i}}),b.ready.promise=function(t){return r||(r=b.Deferred(),"complete"===s.readyState?setTimeout(b.ready):(s.addEventListener("DOMContentLoaded",j,!1),e.addEventListener("load",j,!1))),r.promise(t)},b.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),(function(e,t){c["[object "+t+"]"]=t.toLowerCase()})),n=b(s),
8
- function(e,t){var n,r,i,o,s,a,u,l,c,f,p,d,h,g,m,y,v,x="sizzle"+-new Date,w=e.document,T=0,C=0,N=se(),k=se(),E=se(),S=!1,j=function(e,t){return e===t?(S=!0,0):0},D=typeof t,A=1<<31,L={}.hasOwnProperty,q=[],H=q.pop,O=q.push,F=q.push,P=q.slice,R=q.indexOf||function(e){for(var t=0,n=this.length;t<n;t++)if(this[t]===e)return t;return-1},M="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",W="[\\x20\\t\\r\\n\\f]",$="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",B=$.replace("w","w#"),I="\\["+W+"*("+$+")"+W+"*(?:([*^$|!~]?=)"+W+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+B+")|)|)"+W+"*\\]",z=":("+$+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+I.replace(3,8)+")*)|.*)\\)|)",_=new RegExp("^"+W+"+|((?:^|[^\\\\])(?:\\\\.)*)"+W+"+$","g"),X=new RegExp("^"+W+"*,"+W+"*"),U=new RegExp("^"+W+"*([>+~]|"+W+")"+W+"*"),Y=new RegExp(W+"*[+~]"),V=new RegExp("="+W+"*([^\\]'\"]*)"+W+"*\\]","g"),G=new RegExp(z),J=new RegExp("^"+B+"$"),Q={ID:new RegExp("^#("+$+")"),CLASS:new RegExp("^\\.("+$+")"),TAG:new RegExp("^("+$.replace("w","w*")+")"),ATTR:new RegExp("^"+I),PSEUDO:new RegExp("^"+z),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+W+"*(even|odd|(([+-]|)(\\d*)n|)"+W+"*(?:([+-]|)"+W+"*(\\d+)|))"+W+"*\\)|)","i"),bool:new RegExp("^(?:"+M+")$","i"),needsContext:new RegExp("^"+W+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+W+"*((?:-\\d)?\\d*)"+W+"*\\)|)(?=[^-]|$)","i")},K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/^(?:input|select|textarea|button)$/i,te=/^h\d$/i,ne=/'|\\/g,re=new RegExp("\\\\([\\da-f]{1,6}"+W+"?|("+W+")|.)","ig"),ie=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)};try{F.apply(q=P.call(w.childNodes),w.childNodes),q[w.childNodes.length].nodeType}catch(e){F={apply:q.length?function(e,t){O.apply(e,P.call(t))}:function(e,t){for(var n=e.length,r=0;e[n++]=t[r++];);e.length=n-1}}}function oe(e,t,n,i){var s,a,l,c,d,m,y,b,T,C;if((t?t.ownerDocument||t:w)!==p&&f(t),n=n||[],!e||"string"!=typeof e)return n;if(1!==(c=(t=t||p).nodeType)&&9!==c)return[];if(h&&!i){if(s=Z.exec(e))if(l=s[1]){if(9===c){if(!(a=t.getElementById(l))||!a.parentNode)return n;if(a.id===l)return n.push(a),n}else if(t.ownerDocument&&(a=t.ownerDocument.getElementById(l))&&v(t,a)&&a.id===l)return n.push(a),n}else{if(s[2])return F.apply(n,t.getElementsByTagName(e)),n;if((l=s[3])&&r.getElementsByClassName&&t.getElementsByClassName)return F.apply(n,t.getElementsByClassName(l)),n}if(r.qsa&&(!g||!g.test(e))){if(b=y=x,T=t,C=9===c&&e,1===c&&"object"!==t.nodeName.toLowerCase()){for(m=ge(e),(y=t.getAttribute("id"))?b=y.replace(ne,"\\$&"):t.setAttribute("id",b),b="[id='"+b+"'] ",d=m.length;d--;)m[d]=b+me(m[d]);T=Y.test(e)&&t.parentNode||t,C=m.join(",")}if(C)try{return F.apply(n,T.querySelectorAll(C)),n}catch(e){}finally{y||t.removeAttribute("id")}}}return function(e,t,n,i){var s,a,l,c,f,p=ge(e);if(!i&&1===p.length){if((a=p[0]=p[0].slice(0)).length>2&&"ID"===(l=a[0]).type&&r.getById&&9===t.nodeType&&h&&o.relative[a[1].type]){if(!(t=(o.find.ID(l.matches[0].replace(re,ie),t)||[])[0]))return n;e=e.slice(a.shift().value.length)}for(s=Q.needsContext.test(e)?0:a.length;s--&&(l=a[s],!o.relative[c=l.type]);)if((f=o.find[c])&&(i=f(l.matches[0].replace(re,ie),Y.test(a[0].type)&&t.parentNode||t))){if(a.splice(s,1),!(e=i.length&&me(a)))return F.apply(n,i),n;break}}return u(e,p)(i,t,!h,n,Y.test(e)),n}(e.replace(_,"$1"),t,n,i)}function se(){var e=[];return function t(n,r){return e.push(n+=" ")>o.cacheLength&&delete t[e.shift()],t[n]=r}}function ae(e){return e[x]=!0,e}function ue(e){var t=p.createElement("div");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function le(e,t){for(var n=e.split("|"),r=e.length;r--;)o.attrHandle[n[r]]=t}function ce(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||A)-(~e.sourceIndex||A);if(r)return r;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function fe(e){return function(t){return"input"===t.nodeName.toLowerCase()&&t.type===e}}function pe(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function de(e){return ae((function(t){return t=+t,ae((function(n,r){for(var i,o=e([],n.length,t),s=o.length;s--;)n[i=o[s]]&&(n[i]=!(r[i]=n[i]))}))}))}for(n in a=oe.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},r=oe.support={},f=oe.setDocument=function(e){var t=e?e.ownerDocument||e:w,n=t.defaultView;return t!==p&&9===t.nodeType&&t.documentElement?(p=t,d=t.documentElement,h=!a(t),n&&n.attachEvent&&n!==n.top&&n.attachEvent("onbeforeunload",(function(){f()})),r.attributes=ue((function(e){return e.className="i",!e.getAttribute("className")})),r.getElementsByTagName=ue((function(e){return e.appendChild(t.createComment("")),!e.getElementsByTagName("*").length})),r.getElementsByClassName=ue((function(e){return e.innerHTML="<div class='a'></div><div class='a i'></div>",e.firstChild.className="i",2===e.getElementsByClassName("i").length})),r.getById=ue((function(e){return d.appendChild(e).id=x,!t.getElementsByName||!t.getElementsByName(x).length})),r.getById?(o.find.ID=function(e,t){if(typeof t.getElementById!==D&&h){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},o.filter.ID=function(e){var t=e.replace(re,ie);return function(e){return e.getAttribute("id")===t}}):(delete o.find.ID,o.filter.ID=function(e){var t=e.replace(re,ie);return function(e){var n=typeof e.getAttributeNode!==D&&e.getAttributeNode("id");return n&&n.value===t}}),o.find.TAG=r.getElementsByTagName?function(e,t){if(typeof t.getElementsByTagName!==D)return t.getElementsByTagName(e)}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){for(;n=o[i++];)1===n.nodeType&&r.push(n);return r}return o},o.find.CLASS=r.getElementsByClassName&&function(e,t){if(typeof t.getElementsByClassName!==D&&h)return t.getElementsByClassName(e)},m=[],g=[],(r.qsa=K.test(t.querySelectorAll))&&(ue((function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||g.push("\\["+W+"*(?:value|"+M+")"),e.querySelectorAll(":checked").length||g.push(":checked")})),ue((function(e){var n=t.createElement("input");n.setAttribute("type","hidden"),e.appendChild(n).setAttribute("t",""),e.querySelectorAll("[t^='']").length&&g.push("[*^$]="+W+"*(?:''|\"\")"),e.querySelectorAll(":enabled").length||g.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),g.push(",.*:")}))),(r.matchesSelector=K.test(y=d.webkitMatchesSelector||d.mozMatchesSelector||d.oMatchesSelector||d.msMatchesSelector))&&ue((function(e){r.disconnectedMatch=y.call(e,"div"),y.call(e,"[s!='']:x"),m.push("!=",z)})),g=g.length&&new RegExp(g.join("|")),m=m.length&&new RegExp(m.join("|")),v=K.test(d.contains)||d.compareDocumentPosition?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},j=d.compareDocumentPosition?function(e,n){if(e===n)return S=!0,0;var i=n.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(n);return i?1&i||!r.sortDetached&&n.compareDocumentPosition(e)===i?e===t||v(w,e)?-1:n===t||v(w,n)?1:c?R.call(c,e)-R.call(c,n):0:4&i?-1:1:e.compareDocumentPosition?-1:1}:function(e,n){var r,i=0,o=e.parentNode,s=n.parentNode,a=[e],u=[n];if(e===n)return S=!0,0;if(!o||!s)return e===t?-1:n===t?1:o?-1:s?1:c?R.call(c,e)-R.call(c,n):0;if(o===s)return ce(e,n);for(r=e;r=r.parentNode;)a.unshift(r);for(r=n;r=r.parentNode;)u.unshift(r);for(;a[i]===u[i];)i++;return i?ce(a[i],u[i]):a[i]===w?-1:u[i]===w?1:0},t):p},oe.matches=function(e,t){return oe(e,null,null,t)},oe.matchesSelector=function(e,t){if((e.ownerDocument||e)!==p&&f(e),t=t.replace(V,"='$1']"),r.matchesSelector&&h&&(!m||!m.test(t))&&(!g||!g.test(t)))try{var n=y.call(e,t);if(n||r.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){}return oe(t,p,null,[e]).length>0},oe.contains=function(e,t){return(e.ownerDocument||e)!==p&&f(e),v(e,t)},oe.attr=function(e,n){(e.ownerDocument||e)!==p&&f(e);var i=o.attrHandle[n.toLowerCase()],s=i&&L.call(o.attrHandle,n.toLowerCase())?i(e,n,!h):t;return s===t?r.attributes||!h?e.getAttribute(n):(s=e.getAttributeNode(n))&&s.specified?s.value:null:s},oe.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},oe.uniqueSort=function(e){var t,n=[],i=0,o=0;if(S=!r.detectDuplicates,c=!r.sortStable&&e.slice(0),e.sort(j),S){for(;t=e[o++];)t===e[o]&&(i=n.push(o));for(;i--;)e.splice(n[i],1)}return e},s=oe.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=s(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=s(t);return n},o=oe.selectors={cacheLength:50,createPseudo:ae,match:Q,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(re,ie),e[3]=(e[4]||e[5]||"").replace(re,ie),"~="===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]||oe.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]&&oe.error(e[0]),e},PSEUDO:function(e){var n,r=!e[5]&&e[2];return Q.CHILD.test(e[0])?null:(e[3]&&e[4]!==t?e[2]=e[4]:r&&G.test(r)&&(n=ge(r,!0))&&(n=r.indexOf(")",r.length-n)-r.length)&&(e[0]=e[0].slice(0,n),e[2]=r.slice(0,n)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(re,ie).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=N[e+" "];return t||(t=new RegExp("(^|"+W+")"+e+"("+W+"|$)"))&&N(e,(function(e){return t.test("string"==typeof e.className&&e.className||typeof e.getAttribute!==D&&e.getAttribute("class")||"")}))},ATTR:function(e,t,n){return function(r){var i=oe.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+" ").indexOf(n)>-1:"|="===t&&(i===n||i.slice(0,n.length+1)===n+"-"))}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),s="last"!==e.slice(-4),a="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,f,p,d,h,g=o!==s?"nextSibling":"previousSibling",m=t.parentNode,y=a&&t.nodeName.toLowerCase(),v=!u&&!a;if(m){if(o){for(;g;){for(f=t;f=f[g];)if(a?f.nodeName.toLowerCase()===y:1===f.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[s?m.firstChild:m.lastChild],s&&v){for(d=(l=(c=m[x]||(m[x]={}))[e]||[])[0]===T&&l[1],p=l[0]===T&&l[2],f=d&&m.childNodes[d];f=++d&&f&&f[g]||(p=d=0)||h.pop();)if(1===f.nodeType&&++p&&f===t){c[e]=[T,d,p];break}}else if(v&&(l=(t[x]||(t[x]={}))[e])&&l[0]===T)p=l[1];else for(;(f=++d&&f&&f[g]||(p=d=0)||h.pop())&&((a?f.nodeName.toLowerCase()!==y:1!==f.nodeType)||!++p||(v&&((f[x]||(f[x]={}))[e]=[T,p]),f!==t)););return(p-=i)===r||p%r==0&&p/r>=0}}},PSEUDO:function(e,t){var n,r=o.pseudos[e]||o.setFilters[e.toLowerCase()]||oe.error("unsupported pseudo: "+e);return r[x]?r(t):r.length>1?(n=[e,e,"",t],o.setFilters.hasOwnProperty(e.toLowerCase())?ae((function(e,n){for(var i,o=r(e,t),s=o.length;s--;)e[i=R.call(e,o[s])]=!(n[i]=o[s])})):function(e){return r(e,0,n)}):r}},pseudos:{not:ae((function(e){var t=[],n=[],r=u(e.replace(_,"$1"));return r[x]?ae((function(e,t,n,i){for(var o,s=r(e,null,i,[]),a=e.length;a--;)(o=s[a])&&(e[a]=!(t[a]=o))})):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}})),has:ae((function(e){return function(t){return oe(e,t).length>0}})),contains:ae((function(e){return function(t){return(t.textContent||t.innerText||s(t)).indexOf(e)>-1}})),lang:ae((function(e){return J.test(e||"")||oe.error("unsupported lang: "+e),e=e.replace(re,ie).toLowerCase(),function(t){var n;do{if(n=h?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.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!o.pseudos.empty(e)},header:function(e){return te.test(e.nodeName)},input:function(e){return ee.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"))||t.toLowerCase()===e.type)},first:de((function(){return[0]})),last:de((function(e,t){return[t-1]})),eq:de((function(e,t,n){return[n<0?n+t:n]})),even:de((function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e})),odd:de((function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e})),lt:de((function(e,t,n){for(var r=n<0?n+t:n;--r>=0;)e.push(r);return e})),gt:de((function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e}))}},o.pseudos.nth=o.pseudos.eq,{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})o.pseudos[n]=fe(n);for(n in{submit:!0,reset:!0})o.pseudos[n]=pe(n);function he(){}function ge(e,t){var n,r,i,s,a,u,l,c=k[e+" "];if(c)return t?0:c.slice(0);for(a=e,u=[],l=o.preFilter;a;){for(s in n&&!(r=X.exec(a))||(r&&(a=a.slice(r[0].length)||a),u.push(i=[])),n=!1,(r=U.exec(a))&&(n=r.shift(),i.push({value:n,type:r[0].replace(_," ")}),a=a.slice(n.length)),o.filter)!(r=Q[s].exec(a))||l[s]&&!(r=l[s](r))||(n=r.shift(),i.push({value:n,type:s,matches:r}),a=a.slice(n.length));if(!n)break}return t?a.length:a?oe.error(e):k(e,u).slice(0)}function me(e){for(var t=0,n=e.length,r="";t<n;t++)r+=e[t].value;return r}function ye(e,t,n){var r=t.dir,o=n&&"parentNode"===r,s=C++;return t.first?function(t,n,i){for(;t=t[r];)if(1===t.nodeType||o)return e(t,n,i)}:function(t,n,a){var u,l,c,f=T+" "+s;if(a){for(;t=t[r];)if((1===t.nodeType||o)&&e(t,n,a))return!0}else for(;t=t[r];)if(1===t.nodeType||o)if((l=(c=t[x]||(t[x]={}))[r])&&l[0]===f){if(!0===(u=l[1])||u===i)return!0===u}else if((l=c[r]=[f])[1]=e(t,n,a)||i,!0===l[1])return!0}}function ve(e){return e.length>1?function(t,n,r){for(var i=e.length;i--;)if(!e[i](t,n,r))return!1;return!0}:e[0]}function xe(e,t,n,r,i){for(var o,s=[],a=0,u=e.length,l=null!=t;a<u;a++)(o=e[a])&&(n&&!n(o,r,i)||(s.push(o),l&&t.push(a)));return s}function be(e,t,n,r,i,o){return r&&!r[x]&&(r=be(r)),i&&!i[x]&&(i=be(i,o)),ae((function(o,s,a,u){var l,c,f,p=[],d=[],h=s.length,g=o||function(e,t,n){for(var r=0,i=t.length;r<i;r++)oe(e,t[r],n);return n}(t||"*",a.nodeType?[a]:a,[]),m=!e||!o&&t?g:xe(g,p,e,a,u),y=n?i||(o?e:h||r)?[]:s:m;if(n&&n(m,y,a,u),r)for(l=xe(y,d),r(l,[],a,u),c=l.length;c--;)(f=l[c])&&(y[d[c]]=!(m[d[c]]=f));if(o){if(i||e){if(i){for(l=[],c=y.length;c--;)(f=y[c])&&l.push(m[c]=f);i(null,y=[],l,u)}for(c=y.length;c--;)(f=y[c])&&(l=i?R.call(o,f):p[c])>-1&&(o[l]=!(s[l]=f))}}else y=xe(y===s?y.splice(h,y.length):y),i?i(null,s,y,u):F.apply(s,y)}))}function we(e){for(var t,n,r,i=e.length,s=o.relative[e[0].type],a=s||o.relative[" "],u=s?1:0,c=ye((function(e){return e===t}),a,!0),f=ye((function(e){return R.call(t,e)>-1}),a,!0),p=[function(e,n,r){return!s&&(r||n!==l)||((t=n).nodeType?c(e,n,r):f(e,n,r))}];u<i;u++)if(n=o.relative[e[u].type])p=[ye(ve(p),n)];else{if((n=o.filter[e[u].type].apply(null,e[u].matches))[x]){for(r=++u;r<i&&!o.relative[e[r].type];r++);return be(u>1&&ve(p),u>1&&me(e.slice(0,u-1).concat({value:" "===e[u-2].type?"*":""})).replace(_,"$1"),n,u<r&&we(e.slice(u,r)),r<i&&we(e=e.slice(r)),r<i&&me(e))}p.push(n)}return ve(p)}he.prototype=o.filters=o.pseudos,o.setFilters=new he,u=oe.compile=function(e,t){var n,r=[],s=[],a=E[e+" "];if(!a){for(t||(t=ge(e)),n=t.length;n--;)(a=we(t[n]))[x]?r.push(a):s.push(a);a=E(e,function(e,t){var n=0,r=t.length>0,s=e.length>0,a=function(a,u,c,f,d){var h,g,m,y=[],v=0,x="0",b=a&&[],w=null!=d,C=l,N=a||s&&o.find.TAG("*",d&&u.parentNode||u),k=T+=null==C?1:Math.random()||.1;for(w&&(l=u!==p&&u,i=n);null!=(h=N[x]);x++){if(s&&h){for(g=0;m=e[g++];)if(m(h,u,c)){f.push(h);break}w&&(T=k,i=++n)}r&&((h=!m&&h)&&v--,a&&b.push(h))}if(v+=x,r&&x!==v){for(g=0;m=t[g++];)m(b,y,u,c);if(a){if(v>0)for(;x--;)b[x]||y[x]||(y[x]=H.call(f));y=xe(y)}F.apply(f,y),w&&!a&&y.length>0&&v+t.length>1&&oe.uniqueSort(f)}return w&&(T=k,l=C),b};return r?ae(a):a}(s,r))}return a},r.sortStable=x.split("").sort(j).join("")===x,r.detectDuplicates=S,f(),r.sortDetached=ue((function(e){return 1&e.compareDocumentPosition(p.createElement("div"))})),ue((function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")}))||le("type|href|height|width",(function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)})),r.attributes&&ue((function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")}))||le("value",(function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue})),ue((function(e){return null==e.getAttribute("disabled")}))||le(M,(function(e,t,n){var r;if(!n)return(r=e.getAttributeNode(t))&&r.specified?r.value:!0===e[t]?t.toLowerCase():null})),b.find=oe,b.expr=oe.selectors,b.expr[":"]=b.expr.pseudos,b.unique=oe.uniqueSort,b.text=oe.getText,b.isXMLDoc=oe.isXML,b.contains=oe.contains}(e);var A,L,q,H,O,F,P={};b.Callbacks=function(e){e="string"==typeof e?P[e]||function(e){var t=P[e]={};return b.each(e.match(T)||[],(function(e,n){t[n]=!0})),t}(e):b.extend({},e);var n,r,i,o,s,a,u=[],l=!e.once&&[],c=function(t){for(n=e.memory&&t,r=!0,a=o||0,o=0,s=u.length,i=!0;u&&a<s;a++)if(!1===u[a].apply(t[0],t[1])&&e.stopOnFalse){n=!1;break}i=!1,u&&(l?l.length&&c(l.shift()):n?u=[]:f.disable())},f={add:function(){if(u){var t=u.length;!function t(n){b.each(n,(function(n,r){var i=b.type(r);"function"===i?e.unique&&f.has(r)||u.push(r):r&&r.length&&"string"!==i&&t(r)}))}(arguments),i?s=u.length:n&&(o=t,c(n))}return this},remove:function(){return u&&b.each(arguments,(function(e,t){for(var n;(n=b.inArray(t,u,n))>-1;)u.splice(n,1),i&&(n<=s&&s--,n<=a&&a--)})),this},has:function(e){return e?b.inArray(e,u)>-1:!(!u||!u.length)},empty:function(){return u=[],s=0,this},disable:function(){return u=l=n=t,this},disabled:function(){return!u},lock:function(){return l=t,n||f.disable(),this},locked:function(){return!l},fireWith:function(e,t){return!u||r&&!l||(t=[e,(t=t||[]).slice?t.slice():t],i?l.push(t):c(t)),this},fire:function(){return f.fireWith(this,arguments),this},fired:function(){return!!r}};return f},b.extend({Deferred:function(e){var t=[["resolve","done",b.Callbacks("once memory"),"resolved"],["reject","fail",b.Callbacks("once memory"),"rejected"],["notify","progress",b.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return b.Deferred((function(n){b.each(t,(function(t,o){var s=o[0],a=b.isFunction(e[t])&&e[t];i[o[1]]((function(){var e=a&&a.apply(this,arguments);e&&b.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[s+"With"](this===r?n.promise():this,a?[e]:arguments)}))})),e=null})).promise()},promise:function(e){return null!=e?b.extend(e,r):r}},i={};return r.pipe=r.then,b.each(t,(function(e,o){var s=o[2],a=o[3];r[o[1]]=s.add,a&&s.add((function(){n=a}),t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=s.fireWith})),r.promise(i),e&&e.call(i,i),i},when:function(e){var t,n,r,i=0,o=g.call(arguments),s=o.length,a=1!==s||e&&b.isFunction(e.promise)?s:0,u=1===a?e:b.Deferred(),l=function(e,n,r){return function(i){n[e]=this,r[e]=arguments.length>1?g.call(arguments):i,r===t?u.notifyWith(n,r):--a||u.resolveWith(n,r)}};if(s>1)for(t=new Array(s),n=new Array(s),r=new Array(s);i<s;i++)o[i]&&b.isFunction(o[i].promise)?o[i].promise().done(l(i,r,o)).fail(u.reject).progress(l(i,n,t)):--a;return a||u.resolveWith(r,o),u.promise()}}),b.support=(A={},L=s.createElement("input"),q=s.createDocumentFragment(),H=s.createElement("div"),O=s.createElement("select"),F=O.appendChild(s.createElement("option")),L.type?(L.type="checkbox",A.checkOn=""!==L.value,A.optSelected=F.selected,A.reliableMarginRight=!0,A.boxSizingReliable=!0,A.pixelPosition=!1,L.checked=!0,A.noCloneChecked=L.cloneNode(!0).checked,O.disabled=!0,A.optDisabled=!F.disabled,(L=s.createElement("input")).value="t",L.type="radio",A.radioValue="t"===L.value,L.setAttribute("checked","t"),L.setAttribute("name","t"),q.appendChild(L),A.checkClone=q.cloneNode(!0).cloneNode(!0).lastChild.checked,A.focusinBubbles="onfocusin"in e,H.style.backgroundClip="content-box",H.cloneNode(!0).style.backgroundClip="",A.clearCloneStyle="content-box"===H.style.backgroundClip,b((function(){var t,n,r=s.getElementsByTagName("body")[0];r&&((t=s.createElement("div")).style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",r.appendChild(t).appendChild(H),H.innerHTML="",H.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%",b.swap(r,null!=r.style.zoom?{zoom:1}:{},(function(){A.boxSizing=4===H.offsetWidth})),e.getComputedStyle&&(A.pixelPosition="1%"!==(e.getComputedStyle(H,null)||{}).top,A.boxSizingReliable="4px"===(e.getComputedStyle(H,null)||{width:"4px"}).width,(n=H.appendChild(s.createElement("div"))).style.cssText=H.style.cssText="padding:0;margin:0;border:0;display:block;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box",n.style.marginRight=n.style.width="0",H.style.width="1px",A.reliableMarginRight=!parseFloat((e.getComputedStyle(n,null)||{}).marginRight)),r.removeChild(t))})),A):A);var R,M,W=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,$=/([A-Z])/g;function B(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=b.expando+Math.random()}function I(e,n,r){var i;if(r===t&&1===e.nodeType)if(i="data-"+n.replace($,"-$1").toLowerCase(),"string"==typeof(r=e.getAttribute(i))){try{r="true"===r||"false"!==r&&("null"===r?null:+r+""===r?+r:W.test(r)?JSON.parse(r):r)}catch(e){}R.set(e,n,r)}else r=t;return r}B.uid=1,B.accepts=function(e){return!e.nodeType||(1===e.nodeType||9===e.nodeType)},B.prototype={key:function(e){if(!B.accepts(e))return 0;var t={},n=e[this.expando];if(!n){n=B.uid++;try{t[this.expando]={value:n},Object.defineProperties(e,t)}catch(r){t[this.expando]=n,b.extend(e,t)}}return this.cache[n]||(this.cache[n]={}),n},set:function(e,t,n){var r,i=this.key(e),o=this.cache[i];if("string"==typeof t)o[t]=n;else if(b.isEmptyObject(o))b.extend(this.cache[i],t);else for(r in t)o[r]=t[r];return o},get:function(e,n){var r=this.cache[this.key(e)];return n===t?r:r[n]},access:function(e,n,r){var i;return n===t||n&&"string"==typeof n&&r===t?(i=this.get(e,n))!==t?i:this.get(e,b.camelCase(n)):(this.set(e,n,r),r!==t?r:n)},remove:function(e,n){var r,i,o,s=this.key(e),a=this.cache[s];if(n===t)this.cache[s]={};else{b.isArray(n)?i=n.concat(n.map(b.camelCase)):(o=b.camelCase(n),i=n in a?[n,o]:(i=o)in a?[i]:i.match(T)||[]),r=i.length;for(;r--;)delete a[i[r]]}},hasData:function(e){return!b.isEmptyObject(this.cache[e[this.expando]]||{})},discard:function(e){e[this.expando]&&delete this.cache[e[this.expando]]}},R=new B,M=new B,b.extend({acceptData:B.accepts,hasData:function(e){return R.hasData(e)||M.hasData(e)},data:function(e,t,n){return R.access(e,t,n)},removeData:function(e,t){R.remove(e,t)},_data:function(e,t,n){return M.access(e,t,n)},_removeData:function(e,t){M.remove(e,t)}}),b.fn.extend({data:function(e,n){var r,i,o=this[0],s=0,a=null;if(e===t){if(this.length&&(a=R.get(o),1===o.nodeType&&!M.get(o,"hasDataAttrs"))){for(r=o.attributes;s<r.length;s++)0===(i=r[s].name).indexOf("data-")&&(i=b.camelCase(i.slice(5)),I(o,i,a[i]));M.set(o,"hasDataAttrs",!0)}return a}return"object"==typeof e?this.each((function(){R.set(this,e)})):b.access(this,(function(n){var r,i=b.camelCase(e);if(o&&n===t)return(r=R.get(o,e))!==t||(r=R.get(o,i))!==t||(r=I(o,i,t))!==t?r:void 0;this.each((function(){var r=R.get(this,i);R.set(this,i,n),-1!==e.indexOf("-")&&r!==t&&R.set(this,e,n)}))}),null,n,arguments.length>1,null,!0)},removeData:function(e){return this.each((function(){R.remove(this,e)}))}}),b.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=M.get(e,t),n&&(!r||b.isArray(n)?r=M.access(e,t,b.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=b.queue(e,t),r=n.length,i=n.shift(),o=b._queueHooks(e,t);"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,(function(){b.dequeue(e,t)}),o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return M.get(e,n)||M.access(e,n,{empty:b.Callbacks("once memory").add((function(){M.remove(e,[t+"queue",n])}))})}}),b.fn.extend({queue:function(e,n){var r=2;return"string"!=typeof e&&(n=e,e="fx",r--),arguments.length<r?b.queue(this[0],e):n===t?this:this.each((function(){var t=b.queue(this,e,n);b._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&b.dequeue(this,e)}))},dequeue:function(e){return this.each((function(){b.dequeue(this,e)}))},delay:function(e,t){return e=b.fx&&b.fx.speeds[e]||e,t=t||"fx",this.queue(t,(function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}}))},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,o=b.Deferred(),s=this,a=this.length,u=function(){--i||o.resolveWith(s,[s])};for("string"!=typeof e&&(n=e,e=t),e=e||"fx";a--;)(r=M.get(s[a],e+"queueHooks"))&&r.empty&&(i++,r.empty.add(u));return u(),o.promise(n)}});var z,_=/[\t\r\n\f]/g,X=/\r/g,U=/^(?:input|select|textarea|button)$/i;b.fn.extend({attr:function(e,t){return b.access(this,b.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each((function(){b.removeAttr(this,e)}))},prop:function(e,t){return b.access(this,b.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each((function(){delete this[b.propFix[e]||e]}))},addClass:function(e){var t,n,r,i,o,s=0,a=this.length,u="string"==typeof e&&e;if(b.isFunction(e))return this.each((function(t){b(this).addClass(e.call(this,t,this.className))}));if(u)for(t=(e||"").match(T)||[];s<a;s++)if(r=1===(n=this[s]).nodeType&&(n.className?(" "+n.className+" ").replace(_," "):" ")){for(o=0;i=t[o++];)r.indexOf(" "+i+" ")<0&&(r+=i+" ");n.className=b.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,s=0,a=this.length,u=0===arguments.length||"string"==typeof e&&e;if(b.isFunction(e))return this.each((function(t){b(this).removeClass(e.call(this,t,this.className))}));if(u)for(t=(e||"").match(T)||[];s<a;s++)if(r=1===(n=this[s]).nodeType&&(n.className?(" "+n.className+" ").replace(_," "):"")){for(o=0;i=t[o++];)for(;r.indexOf(" "+i+" ")>=0;)r=r.replace(" "+i+" "," ");n.className=e?b.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e;return"boolean"==typeof t&&"string"===n?t?this.addClass(e):this.removeClass(e):b.isFunction(e)?this.each((function(n){b(this).toggleClass(e.call(this,n,this.className,t),t)})):this.each((function(){if("string"===n)for(var t,r=0,o=b(this),s=e.match(T)||[];t=s[r++];)o.hasClass(t)?o.removeClass(t):o.addClass(t);else n!==i&&"boolean"!==n||(this.className&&M.set(this,"__className__",this.className),this.className=this.className||!1===e?"":M.get(this,"__className__")||"")}))},hasClass:function(e){for(var t=" "+e+" ",n=0,r=this.length;n<r;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(_," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,o=this[0];return arguments.length?(i=b.isFunction(e),this.each((function(r){var o;1===this.nodeType&&(null==(o=i?e.call(this,r,b(this).val()):e)?o="":"number"==typeof o?o+="":b.isArray(o)&&(o=b.map(o,(function(e){return null==e?"":e+""}))),(n=b.valHooks[this.type]||b.valHooks[this.nodeName.toLowerCase()])&&"set"in n&&n.set(this,o,"value")!==t||(this.value=o))}))):o?(n=b.valHooks[o.type]||b.valHooks[o.nodeName.toLowerCase()])&&"get"in n&&(r=n.get(o,"value"))!==t?r:"string"==typeof(r=o.value)?r.replace(X,""):null==r?"":r:void 0}}),b.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){for(var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||i<0,s=o?null:[],a=o?i+1:r.length,u=i<0?a:o?i:0;u<a;u++)if(((n=r[u]).selected||u===i)&&(b.support.optDisabled?!n.disabled:null===n.getAttribute("disabled"))&&(!n.parentNode.disabled||!b.nodeName(n.parentNode,"optgroup"))){if(t=b(n).val(),o)return t;s.push(t)}return s},set:function(e,t){for(var n,r,i=e.options,o=b.makeArray(t),s=i.length;s--;)((r=i[s]).selected=b.inArray(b(r).val(),o)>=0)&&(n=!0);return n||(e.selectedIndex=-1),o}}},attr:function(e,n,r){var o,s,a=e.nodeType;if(e&&3!==a&&8!==a&&2!==a)return typeof e.getAttribute===i?b.prop(e,n,r):(1===a&&b.isXMLDoc(e)||(n=n.toLowerCase(),o=b.attrHooks[n]||(b.expr.match.bool.test(n)?z:undefined)),r===t?o&&"get"in o&&null!==(s=o.get(e,n))?s:null==(s=b.find.attr(e,n))?t:s:null!==r?o&&"set"in o&&(s=o.set(e,r,n))!==t?s:(e.setAttribute(n,r+""),r):void b.removeAttr(e,n))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(T);if(o&&1===e.nodeType)for(;n=o[i++];)r=b.propFix[n]||n,b.expr.match.bool.test(n)&&(e[r]=!1),e.removeAttribute(n)},attrHooks:{type:{set:function(e,t){if(!b.support.radioValue&&"radio"===t&&b.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{for:"htmlFor",class:"className"},prop:function(e,n,r){var i,o,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return(1!==s||!b.isXMLDoc(e))&&(n=b.propFix[n]||n,o=b.propHooks[n]),r!==t?o&&"set"in o&&(i=o.set(e,r,n))!==t?i:e[n]=r:o&&"get"in o&&null!==(i=o.get(e,n))?i:e[n]},propHooks:{tabIndex:{get:function(e){return e.hasAttribute("tabindex")||U.test(e.nodeName)||e.href?e.tabIndex:-1}}}}),z={set:function(e,t,n){return!1===t?b.removeAttr(e,n):e.setAttribute(n,n),n}},b.each(b.expr.match.bool.source.match(/\w+/g),(function(e,n){var r=b.expr.attrHandle[n]||b.find.attr;b.expr.attrHandle[n]=function(e,n,i){var o=b.expr.attrHandle[n],s=i?t:(b.expr.attrHandle[n]=t)!=r(e,n,i)?n.toLowerCase():null;return b.expr.attrHandle[n]=o,s}})),b.support.optSelected||(b.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null}}),b.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],(function(){b.propFix[this.toLowerCase()]=this})),b.each(["radio","checkbox"],(function(){b.valHooks[this]={set:function(e,t){if(b.isArray(t))return e.checked=b.inArray(b(e).val(),t)>=0}},b.support.checkOn||(b.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})}));var Y=/^key/,V=/^(?:mouse|contextmenu)|click/,G=/^(?:focusinfocus|focusoutblur)$/,J=/^([^.]*)(?:\.(.+)|)$/;function Q(){return!0}function K(){return!1}function Z(){try{return s.activeElement}catch(e){}}b.event={global:{},add:function(e,n,r,o,s){var a,u,l,c,f,p,d,h,g,m,y,v=M.get(e);if(v){for(r.handler&&(r=(a=r).handler,s=a.selector),r.guid||(r.guid=b.guid++),(c=v.events)||(c=v.events={}),(u=v.handle)||(u=v.handle=function(e){return typeof b===i||e&&b.event.triggered===e.type?t:b.event.dispatch.apply(u.elem,arguments)},u.elem=e),f=(n=(n||"").match(T)||[""]).length;f--;)g=y=(l=J.exec(n[f])||[])[1],m=(l[2]||"").split(".").sort(),g&&(d=b.event.special[g]||{},g=(s?d.delegateType:d.bindType)||g,d=b.event.special[g]||{},p=b.extend({type:g,origType:y,data:o,handler:r,guid:r.guid,selector:s,needsContext:s&&b.expr.match.needsContext.test(s),namespace:m.join(".")},a),(h=c[g])||((h=c[g]=[]).delegateCount=0,d.setup&&!1!==d.setup.call(e,o,m,u)||e.addEventListener&&e.addEventListener(g,u,!1)),d.add&&(d.add.call(e,p),p.handler.guid||(p.handler.guid=r.guid)),s?h.splice(h.delegateCount++,0,p):h.push(p),b.event.global[g]=!0);e=null}},remove:function(e,t,n,r,i){var o,s,a,u,l,c,f,p,d,h,g,m=M.hasData(e)&&M.get(e);if(m&&(u=m.events)){for(l=(t=(t||"").match(T)||[""]).length;l--;)if(d=g=(a=J.exec(t[l])||[])[1],h=(a[2]||"").split(".").sort(),d){for(f=b.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],a=a[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),s=o=p.length;o--;)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||a&&!a.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));s&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,m.handle)||b.removeEvent(e,d,m.handle),delete u[d])}else for(d in u)b.event.remove(e,d+t[l],n,r,!0);b.isEmptyObject(u)&&(delete m.handle,M.remove(e,"events"))}},trigger:function(n,r,i,o){var a,u,l,c,f,p,d,h=[i||s],g=v.call(n,"type")?n.type:n,m=v.call(n,"namespace")?n.namespace.split("."):[];if(u=l=i=i||s,3!==i.nodeType&&8!==i.nodeType&&!G.test(g+b.event.triggered)&&(g.indexOf(".")>=0&&(m=g.split("."),g=m.shift(),m.sort()),f=g.indexOf(":")<0&&"on"+g,(n=n[b.expando]?n:new b.Event(g,"object"==typeof n&&n)).isTrigger=o?2:3,n.namespace=m.join("."),n.namespace_re=n.namespace?new RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,n.result=t,n.target||(n.target=i),r=null==r?[n]:b.makeArray(r,[n]),d=b.event.special[g]||{},o||!d.trigger||!1!==d.trigger.apply(i,r))){if(!o&&!d.noBubble&&!b.isWindow(i)){for(c=d.delegateType||g,G.test(c+g)||(u=u.parentNode);u;u=u.parentNode)h.push(u),l=u;l===(i.ownerDocument||s)&&h.push(l.defaultView||l.parentWindow||e)}for(a=0;(u=h[a++])&&!n.isPropagationStopped();)n.type=a>1?c:d.bindType||g,(p=(M.get(u,"events")||{})[n.type]&&M.get(u,"handle"))&&p.apply(u,r),(p=f&&u[f])&&b.acceptData(u)&&p.apply&&!1===p.apply(u,r)&&n.preventDefault();return n.type=g,o||n.isDefaultPrevented()||d._default&&!1!==d._default.apply(h.pop(),r)||!b.acceptData(i)||f&&b.isFunction(i[g])&&!b.isWindow(i)&&((l=i[f])&&(i[f]=null),b.event.triggered=g,i[g](),b.event.triggered=t,l&&(i[f]=l)),n.result}},dispatch:function(e){e=b.event.fix(e);var n,r,i,o,s,a,u=g.call(arguments),l=(M.get(this,"events")||{})[e.type]||[],c=b.event.special[e.type]||{};if(u[0]=e,e.delegateTarget=this,!c.preDispatch||!1!==c.preDispatch.call(this,e)){for(a=b.event.handlers.call(this,e,l),n=0;(o=a[n++])&&!e.isPropagationStopped();)for(e.currentTarget=o.elem,r=0;(s=o.handlers[r++])&&!e.isImmediatePropagationStopped();)e.namespace_re&&!e.namespace_re.test(s.namespace)||(e.handleObj=s,e.data=s.data,(i=((b.event.special[s.origType]||{}).handle||s.handler).apply(o.elem,u))!==t&&!1===(e.result=i)&&(e.preventDefault(),e.stopPropagation()));return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,n){var r,i,o,s,a=[],u=n.delegateCount,l=e.target;if(u&&l.nodeType&&(!e.button||"click"!==e.type))for(;l!==this;l=l.parentNode||this)if(!0!==l.disabled||"click"!==e.type){for(i=[],r=0;r<u;r++)i[o=(s=n[r]).selector+" "]===t&&(i[o]=s.needsContext?b(o,this).index(l)>=0:b.find(o,this,null,[l]).length),i[o]&&i.push(s);i.length&&a.push({elem:l,handlers:i})}return u<n.length&&a.push({elem:this,handlers:n.slice(u)}),a},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,i,o,a=n.button;return null==e.pageX&&null!=n.clientX&&(i=(r=e.target.ownerDocument||s).documentElement,o=r.body,e.pageX=n.clientX+(i&&i.scrollLeft||o&&o.scrollLeft||0)-(i&&i.clientLeft||o&&o.clientLeft||0),e.pageY=n.clientY+(i&&i.scrollTop||o&&o.scrollTop||0)-(i&&i.clientTop||o&&o.clientTop||0)),e.which||a===t||(e.which=1&a?1:2&a?3:4&a?2:0),e}},fix:function(e){if(e[b.expando])return e;var t,n,r,i=e.type,o=e,a=this.fixHooks[i];for(a||(this.fixHooks[i]=a=V.test(i)?this.mouseHooks:Y.test(i)?this.keyHooks:{}),r=a.props?this.props.concat(a.props):this.props,e=new b.Event(o),t=r.length;t--;)e[n=r[t]]=o[n];return e.target||(e.target=s),3===e.target.nodeType&&(e.target=e.target.parentNode),a.filter?a.filter(e,o):e},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==Z()&&this.focus)return this.focus(),!1},delegateType:"focusin"},blur:{trigger:function(){if(this===Z()&&this.blur)return this.blur(),!1},delegateType:"focusout"},click:{trigger:function(){if("checkbox"===this.type&&this.click&&b.nodeName(this,"input"))return this.click(),!1},_default:function(e){return b.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){e.result!==t&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=b.extend(new b.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?b.event.trigger(i,null,t):b.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},b.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)},b.Event=function(e,t){if(!(this instanceof b.Event))return new b.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.getPreventDefault&&e.getPreventDefault()?Q:K):this.type=e,t&&b.extend(this,t),this.timeStamp=e&&e.timeStamp||b.now(),this[b.expando]=!0},b.Event.prototype={isDefaultPrevented:K,isPropagationStopped:K,isImmediatePropagationStopped:K,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=Q,e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=Q,e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Q,this.stopPropagation()}},b.each({mouseenter:"mouseover",mouseleave:"mouseout"},(function(e,t){b.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=e.relatedTarget,i=e.handleObj;return r&&(r===this||b.contains(this,r))||(e.type=i.origType,n=i.handler.apply(this,arguments),e.type=t),n}}})),b.support.focusinBubbles||b.each({focus:"focusin",blur:"focusout"},(function(e,t){var n=0,r=function(e){b.event.simulate(t,e.target,b.event.fix(e),!0)};b.event.special[t]={setup:function(){0==n++&&s.addEventListener(e,r,!0)},teardown:function(){0==--n&&s.removeEventListener(e,r,!0)}}})),b.fn.extend({on:function(e,n,r,i,o){var s,a;if("object"==typeof e){for(a in"string"!=typeof n&&(r=r||n,n=t),e)this.on(a,n,r,e[a],o);return this}if(null==r&&null==i?(i=n,r=n=t):null==i&&("string"==typeof n?(i=r,r=t):(i=r,r=n,n=t)),!1===i)i=K;else if(!i)return this;return 1===o&&(s=i,i=function(e){return b().off(e),s.apply(this,arguments)},i.guid=s.guid||(s.guid=b.guid++)),this.each((function(){b.event.add(this,e,i,r,n)}))},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,o;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,b(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof e){for(o in e)this.off(o,n,e[o]);return this}return!1!==n&&"function"!=typeof n||(r=n,n=t),!1===r&&(r=K),this.each((function(){b.event.remove(this,e,r,n)}))},trigger:function(e,t){return this.each((function(){b.event.trigger(e,t,this)}))},triggerHandler:function(e,t){var n=this[0];if(n)return b.event.trigger(e,t,n,!0)}});var ee=/^.[^:#\[\.,]*$/,te=/^(?:parents|prev(?:Until|All))/,ne=b.expr.match.needsContext,re={children:!0,contents:!0,next:!0,prev:!0};function ie(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}function oe(e,t,n){if(b.isFunction(t))return b.grep(e,(function(e,r){return!!t.call(e,r,e)!==n}));if(t.nodeType)return b.grep(e,(function(e){return e===t!==n}));if("string"==typeof t){if(ee.test(t))return b.filter(t,e,n);t=b.filter(t,e)}return b.grep(e,(function(e){return m.call(t,e)>=0!==n}))}b.fn.extend({find:function(e){var t,n=[],r=this,i=r.length;if("string"!=typeof e)return this.pushStack(b(e).filter((function(){for(t=0;t<i;t++)if(b.contains(r[t],this))return!0})));for(t=0;t<i;t++)b.find(e,r[t],n);return(n=this.pushStack(i>1?b.unique(n):n)).selector=this.selector?this.selector+" "+e:e,n},has:function(e){var t=b(e,this),n=t.length;return this.filter((function(){for(var e=0;e<n;e++)if(b.contains(this,t[e]))return!0}))},not:function(e){return this.pushStack(oe(this,e||[],!0))},filter:function(e){return this.pushStack(oe(this,e||[],!1))},is:function(e){return!!oe(this,"string"==typeof e&&ne.test(e)?b(e):e||[],!1).length},closest:function(e,t){for(var n,r=0,i=this.length,o=[],s=ne.test(e)||"string"!=typeof e?b(e,t||this.context):0;r<i;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(s?s.index(n)>-1:1===n.nodeType&&b.find.matchesSelector(n,e))){n=o.push(n);break}return this.pushStack(o.length>1?b.unique(o):o)},index:function(e){return e?"string"==typeof e?m.call(b(e),this[0]):m.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?b(e,t):b.makeArray(e&&e.nodeType?[e]:e),r=b.merge(this.get(),n);return this.pushStack(b.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),b.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return b.dir(e,"parentNode")},parentsUntil:function(e,t,n){return b.dir(e,"parentNode",n)},next:function(e){return ie(e,"nextSibling")},prev:function(e){return ie(e,"previousSibling")},nextAll:function(e){return b.dir(e,"nextSibling")},prevAll:function(e){return b.dir(e,"previousSibling")},nextUntil:function(e,t,n){return b.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return b.dir(e,"previousSibling",n)},siblings:function(e){return b.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return b.sibling(e.firstChild)},contents:function(e){return e.contentDocument||b.merge([],e.childNodes)}},(function(e,t){b.fn[e]=function(n,r){var i=b.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=b.filter(r,i)),this.length>1&&(re[e]||b.unique(i),te.test(e)&&i.reverse()),this.pushStack(i)}})),b.extend({filter:function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?b.find.matchesSelector(r,e)?[r]:[]:b.find.matches(e,b.grep(t,(function(e){return 1===e.nodeType})))},dir:function(e,n,r){for(var i=[],o=r!==t;(e=e[n])&&9!==e.nodeType;)if(1===e.nodeType){if(o&&b(e).is(r))break;i.push(e)}return i},sibling:function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});var se=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,ae=/<([\w:]+)/,ue=/<|&#?\w+;/,le=/<(?:script|style|link)/i,ce=/^(?:checkbox|radio)$/i,fe=/checked\s*(?:[^=]|=\s*.checked.)/i,pe=/^$|\/(?:java|ecma)script/i,de=/^true\/(.*)/,he=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,ge={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};function me(e,t){return b.nodeName(e,"table")&&b.nodeName(1===t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function ye(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function ve(e){var t=de.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function xe(e,t){for(var n=e.length,r=0;r<n;r++)M.set(e[r],"globalEval",!t||M.get(t[r],"globalEval"))}function be(e,t){var n,r,i,o,s,a,u,l;if(1===t.nodeType){if(M.hasData(e)&&(o=M.access(e),s=M.set(t,o),l=o.events))for(i in delete s.handle,s.events={},l)for(n=0,r=l[i].length;n<r;n++)b.event.add(t,i,l[i][n]);R.hasData(e)&&(a=R.access(e),u=b.extend({},a),R.set(t,u))}}function we(e,n){var r=e.getElementsByTagName?e.getElementsByTagName(n||"*"):e.querySelectorAll?e.querySelectorAll(n||"*"):[];return n===t||n&&b.nodeName(e,n)?b.merge([e],r):r}function Te(e,t){var n=t.nodeName.toLowerCase();"input"===n&&ce.test(e.type)?t.checked=e.checked:"input"!==n&&"textarea"!==n||(t.defaultValue=e.defaultValue)}ge.optgroup=ge.option,ge.tbody=ge.tfoot=ge.colgroup=ge.caption=ge.thead,ge.th=ge.td,b.fn.extend({text:function(e){return b.access(this,(function(e){return e===t?b.text(this):this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(e))}),null,e,arguments.length)},append:function(){return this.domManip(arguments,(function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||me(this,e).appendChild(e)}))},prepend:function(){return this.domManip(arguments,(function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=me(this,e);t.insertBefore(e,t.firstChild)}}))},before:function(){return this.domManip(arguments,(function(e){this.parentNode&&this.parentNode.insertBefore(e,this)}))},after:function(){return this.domManip(arguments,(function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)}))},remove:function(e,t){for(var n,r=e?b.filter(e,this):this,i=0;null!=(n=r[i]);i++)t||1!==n.nodeType||b.cleanData(we(n)),n.parentNode&&(t&&b.contains(n.ownerDocument,n)&&xe(we(n,"script")),n.parentNode.removeChild(n));return this},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(b.cleanData(we(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map((function(){return b.clone(this,e,t)}))},html:function(e){return b.access(this,(function(e){var n=this[0]||{},r=0,i=this.length;if(e===t&&1===n.nodeType)return n.innerHTML;if("string"==typeof e&&!le.test(e)&&!ge[(ae.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(se,"<$1></$2>");try{for(;r<i;r++)1===(n=this[r]||{}).nodeType&&(b.cleanData(we(n,!1)),n.innerHTML=e);n=0}catch(e){}}n&&this.empty().append(e)}),null,e,arguments.length)},replaceWith:function(){var e=b.map(this,(function(e){return[e.nextSibling,e.parentNode]})),t=0;return this.domManip(arguments,(function(n){var r=e[t++],i=e[t++];i&&(r&&r.parentNode!==i&&(r=this.nextSibling),b(this).remove(),i.insertBefore(n,r))}),!0),t?this:this.remove()},detach:function(e){return this.remove(e,!0)},domManip:function(e,t,n){e=d.apply([],e);var r,i,o,s,a,u,l=0,c=this.length,f=this,p=c-1,h=e[0],g=b.isFunction(h);if(g||!(c<=1||"string"!=typeof h||b.support.checkClone)&&fe.test(h))return this.each((function(r){var i=f.eq(r);g&&(e[0]=h.call(this,r,i.html())),i.domManip(e,t,n)}));if(c&&(i=(r=b.buildFragment(e,this[0].ownerDocument,!1,!n&&this)).firstChild,1===r.childNodes.length&&(r=i),i)){for(s=(o=b.map(we(r,"script"),ye)).length;l<c;l++)a=r,l!==p&&(a=b.clone(a,!0,!0),s&&b.merge(o,we(a,"script"))),t.call(this[l],a,l);if(s)for(u=o[o.length-1].ownerDocument,b.map(o,ve),l=0;l<s;l++)a=o[l],pe.test(a.type||"")&&!M.access(a,"globalEval")&&b.contains(u,a)&&(a.src?b._evalUrl(a.src):b.globalEval(a.textContent.replace(he,"")))}return this}}),b.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},(function(e,t){b.fn[e]=function(e){for(var n,r=[],i=b(e),o=i.length-1,s=0;s<=o;s++)n=s===o?this:this.clone(!0),b(i[s])[t](n),h.apply(r,n.get());return this.pushStack(r)}})),b.extend({clone:function(e,t,n){var r,i,o,s,a=e.cloneNode(!0),u=b.contains(e.ownerDocument,e);if(!(b.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||b.isXMLDoc(e)))for(s=we(a),r=0,i=(o=we(e)).length;r<i;r++)Te(o[r],s[r]);if(t)if(n)for(o=o||we(e),s=s||we(a),r=0,i=o.length;r<i;r++)be(o[r],s[r]);else be(e,a);return(s=we(a,"script")).length>0&&xe(s,!u&&we(e,"script")),a},buildFragment:function(e,t,n,r){for(var i,o,s,a,u,l,c=0,f=e.length,p=t.createDocumentFragment(),d=[];c<f;c++)if((i=e[c])||0===i)if("object"===b.type(i))b.merge(d,i.nodeType?[i]:i);else if(ue.test(i)){for(o=o||p.appendChild(t.createElement("div")),s=(ae.exec(i)||["",""])[1].toLowerCase(),a=ge[s]||ge._default,o.innerHTML=a[1]+i.replace(se,"<$1></$2>")+a[2],l=a[0];l--;)o=o.lastChild;b.merge(d,o.childNodes),(o=p.firstChild).textContent=""}else d.push(t.createTextNode(i));for(p.textContent="",c=0;i=d[c++];)if((!r||-1===b.inArray(i,r))&&(u=b.contains(i.ownerDocument,i),o=we(p.appendChild(i),"script"),u&&xe(o),n))for(l=0;i=o[l++];)pe.test(i.type||"")&&n.push(i);return p},cleanData:function(e){for(var n,r,i,o,s,a,u=b.event.special,l=0;(r=e[l])!==t;l++){if(B.accepts(r)&&(s=r[M.expando])&&(n=M.cache[s])){if((i=Object.keys(n.events||{})).length)for(a=0;(o=i[a])!==t;a++)u[o]?b.event.remove(r,o):b.removeEvent(r,o,n.handle);M.cache[s]&&delete M.cache[s]}delete R.cache[r[R.expando]]}},_evalUrl:function(e){return b.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,throws:!0})}}),b.fn.extend({wrapAll:function(e){var t;return b.isFunction(e)?this.each((function(t){b(this).wrapAll(e.call(this,t))})):(this[0]&&(t=b(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 b.isFunction(e)?this.each((function(t){b(this).wrapInner(e.call(this,t))})):this.each((function(){var t=b(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)}))},wrap:function(e){var t=b.isFunction(e);return this.each((function(n){b(this).wrapAll(t?e.call(this,n):e)}))},unwrap:function(){return this.parent().each((function(){b.nodeName(this,"body")||b(this).replaceWith(this.childNodes)})).end()}});var Ce,Ne,ke=/^(none|table(?!-c[ea]).+)/,Ee=/^margin/,Se=new RegExp("^("+w+")(.*)$","i"),je=new RegExp("^("+w+")(?!px)[a-z%]+$","i"),De=new RegExp("^([+-])=("+w+")","i"),Ae={BODY:"block"},Le={position:"absolute",visibility:"hidden",display:"block"},qe={letterSpacing:0,fontWeight:400},He=["Top","Right","Bottom","Left"],Oe=["Webkit","O","Moz","ms"];function Fe(e,t){if(t in e)return t;for(var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=Oe.length;i--;)if((t=Oe[i]+n)in e)return t;return r}function Pe(e,t){return e=t||e,"none"===b.css(e,"display")||!b.contains(e.ownerDocument,e)}function Re(t){return e.getComputedStyle(t,null)}function Me(e,t){for(var n,r,i,o=[],s=0,a=e.length;s<a;s++)(r=e[s]).style&&(o[s]=M.get(r,"olddisplay"),n=r.style.display,t?(o[s]||"none"!==n||(r.style.display=""),""===r.style.display&&Pe(r)&&(o[s]=M.access(r,"olddisplay",Ie(r.nodeName)))):o[s]||(i=Pe(r),(n&&"none"!==n||!i)&&M.set(r,"olddisplay",i?n:b.css(r,"display"))));for(s=0;s<a;s++)(r=e[s]).style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[s]||"":"none"));return e}function We(e,t,n){var r=Se.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function $e(e,t,n,r,i){for(var o=n===(r?"border":"content")?4:"width"===t?1:0,s=0;o<4;o+=2)"margin"===n&&(s+=b.css(e,n+He[o],!0,i)),r?("content"===n&&(s-=b.css(e,"padding"+He[o],!0,i)),"margin"!==n&&(s-=b.css(e,"border"+He[o]+"Width",!0,i))):(s+=b.css(e,"padding"+He[o],!0,i),"padding"!==n&&(s+=b.css(e,"border"+He[o]+"Width",!0,i)));return s}function Be(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=Re(e),s=b.support.boxSizing&&"border-box"===b.css(e,"boxSizing",!1,o);if(i<=0||null==i){if(((i=Ce(e,t,o))<0||null==i)&&(i=e.style[t]),je.test(i))return i;r=s&&(b.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+$e(e,t,n||(s?"border":"content"),r,o)+"px"}function Ie(e){var t=s,n=Ae[e];return n||("none"!==(n=ze(e,t))&&n||((t=((Ne=(Ne||b("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(t.documentElement))[0].contentWindow||Ne[0].contentDocument).document).write("<!doctype html><html><body>"),t.close(),n=ze(e,t),Ne.detach()),Ae[e]=n),n}function ze(e,t){var n=b(t.createElement(e)).appendTo(t.body),r=b.css(n[0],"display");return n.remove(),r}b.fn.extend({css:function(e,n){return b.access(this,(function(e,n,r){var i,o,s={},a=0;if(b.isArray(n)){for(i=Re(e),o=n.length;a<o;a++)s[n[a]]=b.css(e,n[a],!1,i);return s}return r!==t?b.style(e,n,r):b.css(e,n)}),e,n,arguments.length>1)},show:function(){return Me(this,!0)},hide:function(){return Me(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each((function(){Pe(this)?b(this).show():b(this).hide()}))}}),b.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Ce(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{float:"cssFloat"},style:function(e,n,r,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,s,a,u=b.camelCase(n),l=e.style;if(n=b.cssProps[u]||(b.cssProps[u]=Fe(l,u)),a=b.cssHooks[n]||b.cssHooks[u],r===t)return a&&"get"in a&&(o=a.get(e,!1,i))!==t?o:l[n];"string"===(s=typeof r)&&(o=De.exec(r))&&(r=(o[1]+1)*o[2]+parseFloat(b.css(e,n)),s="number"),null==r||"number"===s&&isNaN(r)||("number"!==s||b.cssNumber[u]||(r+="px"),b.support.clearCloneStyle||""!==r||0!==n.indexOf("background")||(l[n]="inherit"),a&&"set"in a&&(r=a.set(e,r,i))===t||(l[n]=r))}},css:function(e,n,r,i){var o,s,a,u=b.camelCase(n);return n=b.cssProps[u]||(b.cssProps[u]=Fe(e.style,u)),(a=b.cssHooks[n]||b.cssHooks[u])&&"get"in a&&(o=a.get(e,!0,r)),o===t&&(o=Ce(e,n,i)),"normal"===o&&n in qe&&(o=qe[n]),""===r||r?(s=parseFloat(o),!0===r||b.isNumeric(s)?s||0:o):o}}),Ce=function(e,n,r){var i,o,s,a=r||Re(e),u=a?a.getPropertyValue(n)||a[n]:t,l=e.style;return a&&(""!==u||b.contains(e.ownerDocument,e)||(u=b.style(e,n)),je.test(u)&&Ee.test(n)&&(i=l.width,o=l.minWidth,s=l.maxWidth,l.minWidth=l.maxWidth=l.width=u,u=a.width,l.width=i,l.minWidth=o,l.maxWidth=s)),u},b.each(["height","width"],(function(e,t){b.cssHooks[t]={get:function(e,n,r){if(n)return 0===e.offsetWidth&&ke.test(b.css(e,"display"))?b.swap(e,Le,(function(){return Be(e,t,r)})):Be(e,t,r)},set:function(e,n,r){var i=r&&Re(e);return We(0,n,r?$e(e,t,r,b.support.boxSizing&&"border-box"===b.css(e,"boxSizing",!1,i),i):0)}}})),b((function(){b.support.reliableMarginRight||(b.cssHooks.marginRight={get:function(e,t){if(t)return b.swap(e,{display:"inline-block"},Ce,[e,"marginRight"])}}),!b.support.pixelPosition&&b.fn.position&&b.each(["top","left"],(function(e,t){b.cssHooks[t]={get:function(e,n){if(n)return n=Ce(e,t),je.test(n)?b(e).position()[t]+"px":n}}}))})),b.expr&&b.expr.filters&&(b.expr.filters.hidden=function(e){return e.offsetWidth<=0&&e.offsetHeight<=0},b.expr.filters.visible=function(e){return!b.expr.filters.hidden(e)}),b.each({margin:"",padding:"",border:"Width"},(function(e,t){b.cssHooks[e+t]={expand:function(n){for(var r=0,i={},o="string"==typeof n?n.split(" "):[n];r<4;r++)i[e+He[r]+t]=o[r]||o[r-2]||o[0];return i}},Ee.test(e)||(b.cssHooks[e+t].set=We)}));var _e=/%20/g,Xe=/\[\]$/,Ue=/\r?\n/g,Ye=/^(?:submit|button|image|reset|file)$/i,Ve=/^(?:input|select|textarea|keygen)/i;function Ge(e,t,n,r){var i;if(b.isArray(t))b.each(t,(function(t,i){n||Xe.test(e)?r(e,i):Ge(e+"["+("object"==typeof i?t:"")+"]",i,n,r)}));else if(n||"object"!==b.type(t))r(e,t);else for(i in t)Ge(e+"["+i+"]",t[i],n,r)}b.fn.extend({serialize:function(){return b.param(this.serializeArray())},serializeArray:function(){return this.map((function(){var e=b.prop(this,"elements");return e?b.makeArray(e):this})).filter((function(){var e=this.type;return this.name&&!b(this).is(":disabled")&&Ve.test(this.nodeName)&&!Ye.test(e)&&(this.checked||!ce.test(e))})).map((function(e,t){var n=b(this).val();return null==n?null:b.isArray(n)?b.map(n,(function(e){return{name:t.name,value:e.replace(Ue,"\r\n")}})):{name:t.name,value:n.replace(Ue,"\r\n")}})).get()}}),b.param=function(e,n){var r,i=[],o=function(e,t){t=b.isFunction(t)?t():null==t?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(n===t&&(n=b.ajaxSettings&&b.ajaxSettings.traditional),b.isArray(e)||e.jquery&&!b.isPlainObject(e))b.each(e,(function(){o(this.name,this.value)}));else for(r in e)Ge(r,e[r],n,o);return i.join("&").replace(_e,"+")},b.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){b.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}})),b.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}});var Je,Qe,Ke=b.now(),Ze=/\?/,et=/#.*$/,tt=/([?&])_=[^&]*/,nt=/^(.*?):[ \t]*([^\r\n]*)$/gm,rt=/^(?:GET|HEAD)$/,it=/^\/\//,ot=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,st=b.fn.load,at={},ut={},lt="*/".concat("*");try{Qe=o.href}catch(e){(Qe=s.createElement("a")).href="",Qe=Qe.href}function ct(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(T)||[];if(b.isFunction(n))for(;r=o[i++];)"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function ft(e,t,n,r){var i={},o=e===ut;function s(a){var u;return i[a]=!0,b.each(e[a]||[],(function(e,a){var l=a(t,n,r);return"string"!=typeof l||o||i[l]?o?!(u=l):void 0:(t.dataTypes.unshift(l),s(l),!1)})),u}return s(t.dataTypes[0])||!i["*"]&&s("*")}function pt(e,n){var r,i,o=b.ajaxSettings.flatOptions||{};for(r in n)n[r]!==t&&((o[r]?e:i||(i={}))[r]=n[r]);return i&&b.extend(!0,e,i),e}Je=ot.exec(Qe.toLowerCase())||[],b.fn.load=function(e,n,r){if("string"!=typeof e&&st)return st.apply(this,arguments);var i,o,s,a=this,u=e.indexOf(" ");return u>=0&&(i=e.slice(u),e=e.slice(0,u)),b.isFunction(n)?(r=n,n=t):n&&"object"==typeof n&&(o="POST"),a.length>0&&b.ajax({url:e,type:o,dataType:"html",data:n}).done((function(e){s=arguments,a.html(i?b("<div>").append(b.parseHTML(e)).find(i):e)})).complete(r&&function(e,t){a.each(r,s||[e.responseText,t,e])}),this},b.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],(function(e,t){b.fn[t]=function(e){return this.on(t,e)}})),b.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Qe,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(Je[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":lt,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":b.parseJSON,"text xml":b.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?pt(pt(e,b.ajaxSettings),t):pt(b.ajaxSettings,e)},ajaxPrefilter:ct(at),ajaxTransport:ct(ut),ajax:function(e,n){"object"==typeof e&&(n=e,e=t),n=n||{};var r,i,o,s,a,u,l,c,f=b.ajaxSetup({},n),p=f.context||f,d=f.context&&(p.nodeType||p.jquery)?b(p):b.event,h=b.Deferred(),g=b.Callbacks("once memory"),m=f.statusCode||{},y={},v={},x=0,w="canceled",C={readyState:0,getResponseHeader:function(e){var t;if(2===x){if(!s)for(s={};t=nt.exec(o);)s[t[1].toLowerCase()]=t[2];t=s[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===x?o:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return x||(e=v[n]=v[n]||e,y[e]=t),this},overrideMimeType:function(e){return x||(f.mimeType=e),this},statusCode:function(e){var t;if(e)if(x<2)for(t in e)m[t]=[m[t],e[t]];else C.always(e[C.status]);return this},abort:function(e){var t=e||w;return r&&r.abort(t),N(0,t),this}};if(h.promise(C).complete=g.add,C.success=C.done,C.error=C.fail,f.url=((e||f.url||Qe)+"").replace(et,"").replace(it,Je[1]+"//"),f.type=n.method||n.type||f.method||f.type,f.dataTypes=b.trim(f.dataType||"*").toLowerCase().match(T)||[""],null==f.crossDomain&&(u=ot.exec(f.url.toLowerCase()),f.crossDomain=!(!u||u[1]===Je[1]&&u[2]===Je[2]&&(u[3]||("http:"===u[1]?"80":"443"))===(Je[3]||("http:"===Je[1]?"80":"443")))),f.data&&f.processData&&"string"!=typeof f.data&&(f.data=b.param(f.data,f.traditional)),ft(at,f,n,C),2===x)return C;for(c in(l=f.global)&&0==b.active++&&b.event.trigger("ajaxStart"),f.type=f.type.toUpperCase(),f.hasContent=!rt.test(f.type),i=f.url,f.hasContent||(f.data&&(i=f.url+=(Ze.test(i)?"&":"?")+f.data,delete f.data),!1===f.cache&&(f.url=tt.test(i)?i.replace(tt,"$1_="+Ke++):i+(Ze.test(i)?"&":"?")+"_="+Ke++)),f.ifModified&&(b.lastModified[i]&&C.setRequestHeader("If-Modified-Since",b.lastModified[i]),b.etag[i]&&C.setRequestHeader("If-None-Match",b.etag[i])),(f.data&&f.hasContent&&!1!==f.contentType||n.contentType)&&C.setRequestHeader("Content-Type",f.contentType),C.setRequestHeader("Accept",f.dataTypes[0]&&f.accepts[f.dataTypes[0]]?f.accepts[f.dataTypes[0]]+("*"!==f.dataTypes[0]?", "+lt+"; q=0.01":""):f.accepts["*"]),f.headers)C.setRequestHeader(c,f.headers[c]);if(f.beforeSend&&(!1===f.beforeSend.call(p,C,f)||2===x))return C.abort();for(c in w="abort",{success:1,error:1,complete:1})C[c](f[c]);if(r=ft(ut,f,n,C)){C.readyState=1,l&&d.trigger("ajaxSend",[C,f]),f.async&&f.timeout>0&&(a=setTimeout((function(){C.abort("timeout")}),f.timeout));try{x=1,r.send(y,N)}catch(e){if(!(x<2))throw e;N(-1,e)}}else N(-1,"No Transport");function N(e,n,s,u){var c,y,v,w,T,N=n;2!==x&&(x=2,a&&clearTimeout(a),r=t,o=u||"",C.readyState=e>0?4:0,c=e>=200&&e<300||304===e,s&&(w=function(e,n,r){var i,o,s,a,u=e.contents,l=e.dataTypes;for(;"*"===l[0];)l.shift(),i===t&&(i=e.mimeType||n.getResponseHeader("Content-Type"));if(i)for(o in u)if(u[o]&&u[o].test(i)){l.unshift(o);break}if(l[0]in r)s=l[0];else{for(o in r){if(!l[0]||e.converters[o+" "+l[0]]){s=o;break}a||(a=o)}s=s||a}if(s)return s!==l[0]&&l.unshift(s),r[s]}(f,C,s)),w=function(e,t,n,r){var i,o,s,a,u,l={},c=e.dataTypes.slice();if(c[1])for(s in e.converters)l[s.toLowerCase()]=e.converters[s];o=c.shift();for(;o;)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=c.shift())if("*"===o)o=u;else if("*"!==u&&u!==o){if(!(s=l[u+" "+o]||l["* "+o]))for(i in l)if((a=i.split(" "))[1]===o&&(s=l[u+" "+a[0]]||l["* "+a[0]])){!0===s?s=l[i]:!0!==l[i]&&(o=a[0],c.unshift(a[1]));break}if(!0!==s)if(s&&e.throws)t=s(t);else try{t=s(t)}catch(e){return{state:"parsererror",error:s?e:"No conversion from "+u+" to "+o}}}return{state:"success",data:t}}(f,w,C,c),c?(f.ifModified&&((T=C.getResponseHeader("Last-Modified"))&&(b.lastModified[i]=T),(T=C.getResponseHeader("etag"))&&(b.etag[i]=T)),204===e||"HEAD"===f.type?N="nocontent":304===e?N="notmodified":(N=w.state,y=w.data,c=!(v=w.error))):(v=N,!e&&N||(N="error",e<0&&(e=0))),C.status=e,C.statusText=(n||N)+"",c?h.resolveWith(p,[y,N,C]):h.rejectWith(p,[C,N,v]),C.statusCode(m),m=t,l&&d.trigger(c?"ajaxSuccess":"ajaxError",[C,f,c?y:v]),g.fireWith(p,[C,N]),l&&(d.trigger("ajaxComplete",[C,f]),--b.active||b.event.trigger("ajaxStop")))}return C},getJSON:function(e,t,n){return b.get(e,t,n,"json")},getScript:function(e,n){return b.get(e,t,n,"script")}}),b.each(["get","post"],(function(e,n){b[n]=function(e,r,i,o){return b.isFunction(r)&&(o=o||i,i=r,r=t),b.ajax({url:e,type:n,dataType:o,data:r,success:i})}})),b.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return b.globalEval(e),e}}}),b.ajaxPrefilter("script",(function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET")})),b.ajaxTransport("script",(function(e){var t,n;if(e.crossDomain)return{send:function(r,i){t=b("<script>").prop({async:!0,charset:e.scriptCharset,src:e.url}).on("load error",n=function(e){t.remove(),n=null,e&&i("error"===e.type?404:200,e.type)}),s.head.appendChild(t[0])},abort:function(){n&&n()}}}));var dt=[],ht=/(=)\?(?=&|$)|\?\?/;b.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=dt.pop()||b.expando+"_"+Ke++;return this[e]=!0,e}}),b.ajaxPrefilter("json jsonp",(function(n,r,i){var o,s,a,u=!1!==n.jsonp&&(ht.test(n.url)?"url":"string"==typeof n.data&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&ht.test(n.data)&&"data");if(u||"jsonp"===n.dataTypes[0])return o=n.jsonpCallback=b.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,u?n[u]=n[u].replace(ht,"$1"+o):!1!==n.jsonp&&(n.url+=(Ze.test(n.url)?"&":"?")+n.jsonp+"="+o),n.converters["script json"]=function(){return a||b.error(o+" was not called"),a[0]},n.dataTypes[0]="json",s=e[o],e[o]=function(){a=arguments},i.always((function(){e[o]=s,n[o]&&(n.jsonpCallback=r.jsonpCallback,dt.push(o)),a&&b.isFunction(s)&&s(a[0]),a=s=t})),"script"})),b.ajaxSettings.xhr=function(){try{return new XMLHttpRequest}catch(e){}};var gt=b.ajaxSettings.xhr(),mt={0:200,1223:204},yt=0,vt={};e.ActiveXObject&&b(e).on("unload",(function(){for(var e in vt)vt[e]();vt=t})),b.support.cors=!!gt&&"withCredentials"in gt,b.support.ajax=gt=!!gt,b.ajaxTransport((function(e){var n;if(b.support.cors||gt&&!e.crossDomain)return{send:function(r,i){var o,s,a=e.xhr();if(a.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(o in e.xhrFields)a[o]=e.xhrFields[o];for(o in e.mimeType&&a.overrideMimeType&&a.overrideMimeType(e.mimeType),e.crossDomain||r["X-Requested-With"]||(r["X-Requested-With"]="XMLHttpRequest"),r)a.setRequestHeader(o,r[o]);n=function(e){return function(){n&&(delete vt[s],n=a.onload=a.onerror=null,"abort"===e?a.abort():"error"===e?i(a.status||404,a.statusText):i(mt[a.status]||a.status,a.statusText,"string"==typeof a.responseText?{text:a.responseText}:t,a.getAllResponseHeaders()))}},a.onload=n(),a.onerror=n("error"),n=vt[s=yt++]=n("abort"),a.send(e.hasContent&&e.data||null)},abort:function(){n&&n()}}}));var xt,bt,wt=/^(?:toggle|show|hide)$/,Tt=new RegExp("^(?:([+-])=|)("+w+")([a-z%]*)$","i"),Ct=/queueHooks$/,Nt=[function(e,n,r){var i,o,s,a,u,l,c=this,f={},p=e.style,d=e.nodeType&&Pe(e),h=M.get(e,"fxshow");r.queue||(null==(u=b._queueHooks(e,"fx")).unqueued&&(u.unqueued=0,l=u.empty.fire,u.empty.fire=function(){u.unqueued||l()}),u.unqueued++,c.always((function(){c.always((function(){u.unqueued--,b.queue(e,"fx").length||u.empty.fire()}))})));1===e.nodeType&&("height"in n||"width"in n)&&(r.overflow=[p.overflow,p.overflowX,p.overflowY],"inline"===b.css(e,"display")&&"none"===b.css(e,"float")&&(p.display="inline-block"));r.overflow&&(p.overflow="hidden",c.always((function(){p.overflow=r.overflow[0],p.overflowX=r.overflow[1],p.overflowY=r.overflow[2]})));for(i in n)if(o=n[i],wt.exec(o)){if(delete n[i],s=s||"toggle"===o,o===(d?"hide":"show")){if("show"!==o||!h||h[i]===t)continue;d=!0}f[i]=h&&h[i]||b.style(e,i)}if(!b.isEmptyObject(f))for(i in h?"hidden"in h&&(d=h.hidden):h=M.access(e,"fxshow",{}),s&&(h.hidden=!d),d?b(e).show():c.done((function(){b(e).hide()})),c.done((function(){var t;for(t in M.remove(e,"fxshow"),f)b.style(e,t,f[t])})),f)a=St(d?h[i]:0,i,c),i in h||(h[i]=a.start,d&&(a.end=a.start,a.start="width"===i||"height"===i?1:0))}],kt={"*":[function(e,t){var n=this.createTween(e,t),r=n.cur(),i=Tt.exec(t),o=i&&i[3]||(b.cssNumber[e]?"":"px"),s=(b.cssNumber[e]||"px"!==o&&+r)&&Tt.exec(b.css(n.elem,e)),a=1,u=20;if(s&&s[3]!==o){o=o||s[3],i=i||[],s=+r||1;do{s/=a=a||".5",b.style(n.elem,e,s+o)}while(a!==(a=n.cur()/r)&&1!==a&&--u)}return i&&(s=n.start=+s||+r||0,n.unit=o,n.end=i[1]?s+(i[1]+1)*i[2]:+i[2]),n}]};function Et(){return setTimeout((function(){xt=t})),xt=b.now()}function St(e,t,n){for(var r,i=(kt[t]||[]).concat(kt["*"]),o=0,s=i.length;o<s;o++)if(r=i[o].call(n,t,e))return r}function jt(e,t,n){var r,i,o=0,s=Nt.length,a=b.Deferred().always((function(){delete u.elem})),u=function(){if(i)return!1;for(var t=xt||Et(),n=Math.max(0,l.startTime+l.duration-t),r=1-(n/l.duration||0),o=0,s=l.tweens.length;o<s;o++)l.tweens[o].run(r);return a.notifyWith(e,[l,r,n]),r<1&&s?n:(a.resolveWith(e,[l]),!1)},l=a.promise({elem:e,props:b.extend({},t),opts:b.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:xt||Et(),duration:n.duration,tweens:[],createTween:function(t,n){var r=b.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(r),r},stop:function(t){var n=0,r=t?l.tweens.length:0;if(i)return this;for(i=!0;n<r;n++)l.tweens[n].run(1);return t?a.resolveWith(e,[l,t]):a.rejectWith(e,[l,t]),this}}),c=l.props;for(!function(e,t){var n,r,i,o,s;for(n in e)if(i=t[r=b.camelCase(n)],o=e[n],b.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),(s=b.cssHooks[r])&&"expand"in s)for(n in o=s.expand(o),delete e[r],o)n in e||(e[n]=o[n],t[n]=i);else t[r]=i}(c,l.opts.specialEasing);o<s;o++)if(r=Nt[o].call(l,e,c,l.opts))return r;return b.map(c,St,l),b.isFunction(l.opts.start)&&l.opts.start.call(e,l),b.fx.timer(b.extend(u,{elem:e,anim:l,queue:l.opts.queue})),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always)}function Dt(e,t,n,r,i){return new Dt.prototype.init(e,t,n,r,i)}function At(e,t){var n,r={height:e},i=0;for(t=t?1:0;i<4;i+=2-t)r["margin"+(n=He[i])]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}function Lt(e){return b.isWindow(e)?e:9===e.nodeType&&e.defaultView}b.Animation=b.extend(jt,{tweener:function(e,t){b.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");for(var n,r=0,i=e.length;r<i;r++)n=e[r],kt[n]=kt[n]||[],kt[n].unshift(t)},prefilter:function(e,t){t?Nt.unshift(e):Nt.push(e)}}),b.Tween=Dt,Dt.prototype={constructor:Dt,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(b.cssNumber[n]?"":"px")},cur:function(){var e=Dt.propHooks[this.prop];return e&&e.get?e.get(this):Dt.propHooks._default.get(this)},run:function(e){var t,n=Dt.propHooks[this.prop];return this.options.duration?this.pos=t=b.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):Dt.propHooks._default.set(this),this}},Dt.prototype.init.prototype=Dt.prototype,Dt.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=b.css(e.elem,e.prop,""))&&"auto"!==t?t:0:e.elem[e.prop]},set:function(e){b.fx.step[e.prop]?b.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[b.cssProps[e.prop]]||b.cssHooks[e.prop])?b.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},Dt.propHooks.scrollTop=Dt.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},b.each(["toggle","show","hide"],(function(e,t){var n=b.fn[t];b.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(At(t,!0),e,r,i)}})),b.fn.extend({fadeTo:function(e,t,n,r){return this.filter(Pe).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=b.isEmptyObject(e),o=b.speed(t,n,r),s=function(){var t=jt(this,b.extend({},e),o);(i||M.get(this,"finish"))&&t.stop(!0)};return s.finish=s,i||!1===o.queue?this.each(s):this.queue(o.queue,s)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=n,n=e,e=t),n&&!1!==e&&this.queue(e||"fx",[]),this.each((function(){var t=!0,n=null!=e&&e+"queueHooks",o=b.timers,s=M.get(this);if(n)s[n]&&s[n].stop&&i(s[n]);else for(n in s)s[n]&&s[n].stop&&Ct.test(n)&&i(s[n]);for(n=o.length;n--;)o[n].elem!==this||null!=e&&o[n].queue!==e||(o[n].anim.stop(r),t=!1,o.splice(n,1));!t&&r||b.dequeue(this,e)}))},finish:function(e){return!1!==e&&(e=e||"fx"),this.each((function(){var t,n=M.get(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=b.timers,s=r?r.length:0;for(n.finish=!0,b.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;t<s;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish}))}}),b.each({slideDown:At("show"),slideUp:At("hide"),slideToggle:At("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},(function(e,t){b.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}})),b.speed=function(e,t,n){var r=e&&"object"==typeof e?b.extend({},e):{complete:n||!n&&t||b.isFunction(e)&&e,duration:e,easing:n&&t||t&&!b.isFunction(t)&&t};return r.duration=b.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in b.fx.speeds?b.fx.speeds[r.duration]:b.fx.speeds._default,null!=r.queue&&!0!==r.queue||(r.queue="fx"),r.old=r.complete,r.complete=function(){b.isFunction(r.old)&&r.old.call(this),r.queue&&b.dequeue(this,r.queue)},r},b.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},b.timers=[],b.fx=Dt.prototype.init,b.fx.tick=function(){var e,n=b.timers,r=0;for(xt=b.now();r<n.length;r++)(e=n[r])()||n[r]!==e||n.splice(r--,1);n.length||b.fx.stop(),xt=t},b.fx.timer=function(e){e()&&b.timers.push(e)&&b.fx.start()},b.fx.interval=13,b.fx.start=function(){bt||(bt=setInterval(b.fx.tick,b.fx.interval))},b.fx.stop=function(){clearInterval(bt),bt=null},b.fx.speeds={slow:600,fast:200,_default:400},b.fx.step={},b.expr&&b.expr.filters&&(b.expr.filters.animated=function(e){return b.grep(b.timers,(function(t){return e===t.elem})).length}),b.fn.offset=function(e){if(arguments.length)return e===t?this:this.each((function(t){b.offset.setOffset(this,e,t)}));var n,r,o=this[0],s={top:0,left:0},a=o&&o.ownerDocument;return a?(n=a.documentElement,b.contains(n,o)?(typeof o.getBoundingClientRect!==i&&(s=o.getBoundingClientRect()),r=Lt(a),{top:s.top+r.pageYOffset-n.clientTop,left:s.left+r.pageXOffset-n.clientLeft}):s):void 0},b.offset={setOffset:function(e,t,n){var r,i,o,s,a,u,l=b.css(e,"position"),c=b(e),f={};"static"===l&&(e.style.position="relative"),a=c.offset(),o=b.css(e,"top"),u=b.css(e,"left"),("absolute"===l||"fixed"===l)&&(o+u).indexOf("auto")>-1?(s=(r=c.position()).top,i=r.left):(s=parseFloat(o)||0,i=parseFloat(u)||0),b.isFunction(t)&&(t=t.call(e,n,a)),null!=t.top&&(f.top=t.top-a.top+s),null!=t.left&&(f.left=t.left-a.left+i),"using"in t?t.using.call(e,f):c.css(f)}},b.fn.extend({position:function(){if(this[0]){var e,t,n=this[0],r={top:0,left:0};return"fixed"===b.css(n,"position")?t=n.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),b.nodeName(e[0],"html")||(r=e.offset()),r.top+=b.css(e[0],"borderTopWidth",!0),r.left+=b.css(e[0],"borderLeftWidth",!0)),{top:t.top-r.top-b.css(n,"marginTop",!0),left:t.left-r.left-b.css(n,"marginLeft",!0)}}},offsetParent:function(){return this.map((function(){for(var e=this.offsetParent||a;e&&!b.nodeName(e,"html")&&"static"===b.css(e,"position");)e=e.offsetParent;return e||a}))}}),b.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},(function(n,r){var i="pageYOffset"===r;b.fn[n]=function(o){return b.access(this,(function(n,o,s){var a=Lt(n);if(s===t)return a?a[r]:n[o];a?a.scrollTo(i?e.pageXOffset:s,i?s:e.pageYOffset):n[o]=s}),n,o,arguments.length,null)}})),b.each({Height:"height",Width:"width"},(function(e,n){b.each({padding:"inner"+e,content:n,"":"outer"+e},(function(r,i){b.fn[i]=function(i,o){var s=arguments.length&&(r||"boolean"!=typeof i),a=r||(!0===i||!0===o?"margin":"border");return b.access(this,(function(n,r,i){var o;return b.isWindow(n)?n.document.documentElement["client"+e]:9===n.nodeType?(o=n.documentElement,Math.max(n.body["scroll"+e],o["scroll"+e],n.body["offset"+e],o["offset"+e],o["client"+e])):i===t?b.css(n,r,a):b.style(n,r,i,a)}),n,s?i:t,s,null)}}))})),b.fn.size=function(){return this.length},b.fn.andSelf=b.fn.addBack,"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=b:"function"==typeof define&&define.amd&&define("jquery",[],(function(){return b})),"object"==typeof e&&"object"==typeof e.document&&(e.jQuery=e.$=b)}(window);
22
+ /*!
23
+ * Sizzle CSS Selector Engine v1.9.4-pre
24
+ * http://sizzlejs.com/
25
+ *
26
+ * Copyright 2013 jQuery Foundation, Inc. and other contributors
27
+ * Released under the MIT license
28
+ * http://jquery.org/license
29
+ *
30
+ * Date: 2013-06-03
31
+ */
32
+ function(e,t){var n,r,i,o,s,a,u,l,c,f,p,d,h,g,m,y,v,x="sizzle"+-new Date,w=e.document,T=0,C=0,N=se(),k=se(),E=se(),S=!1,j=function(e,t){return e===t?(S=!0,0):0},D=typeof t,A=1<<31,L={}.hasOwnProperty,q=[],H=q.pop,O=q.push,F=q.push,P=q.slice,R=q.indexOf||function(e){for(var t=0,n=this.length;t<n;t++)if(this[t]===e)return t;return-1},M="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",W="[\\x20\\t\\r\\n\\f]",$="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",B=$.replace("w","w#"),I="\\["+W+"*("+$+")"+W+"*(?:([*^$|!~]?=)"+W+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+B+")|)|)"+W+"*\\]",z=":("+$+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+I.replace(3,8)+")*)|.*)\\)|)",_=new RegExp("^"+W+"+|((?:^|[^\\\\])(?:\\\\.)*)"+W+"+$","g"),X=new RegExp("^"+W+"*,"+W+"*"),U=new RegExp("^"+W+"*([>+~]|"+W+")"+W+"*"),Y=new RegExp(W+"*[+~]"),V=new RegExp("="+W+"*([^\\]'\"]*)"+W+"*\\]","g"),G=new RegExp(z),J=new RegExp("^"+B+"$"),Q={ID:new RegExp("^#("+$+")"),CLASS:new RegExp("^\\.("+$+")"),TAG:new RegExp("^("+$.replace("w","w*")+")"),ATTR:new RegExp("^"+I),PSEUDO:new RegExp("^"+z),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+W+"*(even|odd|(([+-]|)(\\d*)n|)"+W+"*(?:([+-]|)"+W+"*(\\d+)|))"+W+"*\\)|)","i"),bool:new RegExp("^(?:"+M+")$","i"),needsContext:new RegExp("^"+W+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+W+"*((?:-\\d)?\\d*)"+W+"*\\)|)(?=[^-]|$)","i")},K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/^(?:input|select|textarea|button)$/i,te=/^h\d$/i,ne=/'|\\/g,re=new RegExp("\\\\([\\da-f]{1,6}"+W+"?|("+W+")|.)","ig"),ie=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)};try{F.apply(q=P.call(w.childNodes),w.childNodes),q[w.childNodes.length].nodeType}catch(e){F={apply:q.length?function(e,t){O.apply(e,P.call(t))}:function(e,t){for(var n=e.length,r=0;e[n++]=t[r++];);e.length=n-1}}}function oe(e,t,n,i){var s,a,l,c,d,m,y,b,T,C;if((t?t.ownerDocument||t:w)!==p&&f(t),n=n||[],!e||"string"!=typeof e)return n;if(1!==(c=(t=t||p).nodeType)&&9!==c)return[];if(h&&!i){if(s=Z.exec(e))if(l=s[1]){if(9===c){if(!(a=t.getElementById(l))||!a.parentNode)return n;if(a.id===l)return n.push(a),n}else if(t.ownerDocument&&(a=t.ownerDocument.getElementById(l))&&v(t,a)&&a.id===l)return n.push(a),n}else{if(s[2])return F.apply(n,t.getElementsByTagName(e)),n;if((l=s[3])&&r.getElementsByClassName&&t.getElementsByClassName)return F.apply(n,t.getElementsByClassName(l)),n}if(r.qsa&&(!g||!g.test(e))){if(b=y=x,T=t,C=9===c&&e,1===c&&"object"!==t.nodeName.toLowerCase()){for(m=ge(e),(y=t.getAttribute("id"))?b=y.replace(ne,"\\$&"):t.setAttribute("id",b),b="[id='"+b+"'] ",d=m.length;d--;)m[d]=b+me(m[d]);T=Y.test(e)&&t.parentNode||t,C=m.join(",")}if(C)try{return F.apply(n,T.querySelectorAll(C)),n}catch(e){}finally{y||t.removeAttribute("id")}}}return function(e,t,n,i){var s,a,l,c,f,p=ge(e);if(!i&&1===p.length){if((a=p[0]=p[0].slice(0)).length>2&&"ID"===(l=a[0]).type&&r.getById&&9===t.nodeType&&h&&o.relative[a[1].type]){if(!(t=(o.find.ID(l.matches[0].replace(re,ie),t)||[])[0]))return n;e=e.slice(a.shift().value.length)}for(s=Q.needsContext.test(e)?0:a.length;s--&&(l=a[s],!o.relative[c=l.type]);)if((f=o.find[c])&&(i=f(l.matches[0].replace(re,ie),Y.test(a[0].type)&&t.parentNode||t))){if(a.splice(s,1),!(e=i.length&&me(a)))return F.apply(n,i),n;break}}return u(e,p)(i,t,!h,n,Y.test(e)),n}(e.replace(_,"$1"),t,n,i)}function se(){var e=[];return function t(n,r){return e.push(n+=" ")>o.cacheLength&&delete t[e.shift()],t[n]=r}}function ae(e){return e[x]=!0,e}function ue(e){var t=p.createElement("div");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function le(e,t){for(var n=e.split("|"),r=e.length;r--;)o.attrHandle[n[r]]=t}function ce(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||A)-(~e.sourceIndex||A);if(r)return r;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function fe(e){return function(t){return"input"===t.nodeName.toLowerCase()&&t.type===e}}function pe(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function de(e){return ae((function(t){return t=+t,ae((function(n,r){for(var i,o=e([],n.length,t),s=o.length;s--;)n[i=o[s]]&&(n[i]=!(r[i]=n[i]))}))}))}for(n in a=oe.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},r=oe.support={},f=oe.setDocument=function(e){var t=e?e.ownerDocument||e:w,n=t.defaultView;return t!==p&&9===t.nodeType&&t.documentElement?(p=t,d=t.documentElement,h=!a(t),n&&n.attachEvent&&n!==n.top&&n.attachEvent("onbeforeunload",(function(){f()})),r.attributes=ue((function(e){return e.className="i",!e.getAttribute("className")})),r.getElementsByTagName=ue((function(e){return e.appendChild(t.createComment("")),!e.getElementsByTagName("*").length})),r.getElementsByClassName=ue((function(e){return e.innerHTML="<div class='a'></div><div class='a i'></div>",e.firstChild.className="i",2===e.getElementsByClassName("i").length})),r.getById=ue((function(e){return d.appendChild(e).id=x,!t.getElementsByName||!t.getElementsByName(x).length})),r.getById?(o.find.ID=function(e,t){if(typeof t.getElementById!==D&&h){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},o.filter.ID=function(e){var t=e.replace(re,ie);return function(e){return e.getAttribute("id")===t}}):(delete o.find.ID,o.filter.ID=function(e){var t=e.replace(re,ie);return function(e){var n=typeof e.getAttributeNode!==D&&e.getAttributeNode("id");return n&&n.value===t}}),o.find.TAG=r.getElementsByTagName?function(e,t){if(typeof t.getElementsByTagName!==D)return t.getElementsByTagName(e)}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){for(;n=o[i++];)1===n.nodeType&&r.push(n);return r}return o},o.find.CLASS=r.getElementsByClassName&&function(e,t){if(typeof t.getElementsByClassName!==D&&h)return t.getElementsByClassName(e)},m=[],g=[],(r.qsa=K.test(t.querySelectorAll))&&(ue((function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||g.push("\\["+W+"*(?:value|"+M+")"),e.querySelectorAll(":checked").length||g.push(":checked")})),ue((function(e){var n=t.createElement("input");n.setAttribute("type","hidden"),e.appendChild(n).setAttribute("t",""),e.querySelectorAll("[t^='']").length&&g.push("[*^$]="+W+"*(?:''|\"\")"),e.querySelectorAll(":enabled").length||g.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),g.push(",.*:")}))),(r.matchesSelector=K.test(y=d.webkitMatchesSelector||d.mozMatchesSelector||d.oMatchesSelector||d.msMatchesSelector))&&ue((function(e){r.disconnectedMatch=y.call(e,"div"),y.call(e,"[s!='']:x"),m.push("!=",z)})),g=g.length&&new RegExp(g.join("|")),m=m.length&&new RegExp(m.join("|")),v=K.test(d.contains)||d.compareDocumentPosition?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},j=d.compareDocumentPosition?function(e,n){if(e===n)return S=!0,0;var i=n.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(n);return i?1&i||!r.sortDetached&&n.compareDocumentPosition(e)===i?e===t||v(w,e)?-1:n===t||v(w,n)?1:c?R.call(c,e)-R.call(c,n):0:4&i?-1:1:e.compareDocumentPosition?-1:1}:function(e,n){var r,i=0,o=e.parentNode,s=n.parentNode,a=[e],u=[n];if(e===n)return S=!0,0;if(!o||!s)return e===t?-1:n===t?1:o?-1:s?1:c?R.call(c,e)-R.call(c,n):0;if(o===s)return ce(e,n);for(r=e;r=r.parentNode;)a.unshift(r);for(r=n;r=r.parentNode;)u.unshift(r);for(;a[i]===u[i];)i++;return i?ce(a[i],u[i]):a[i]===w?-1:u[i]===w?1:0},t):p},oe.matches=function(e,t){return oe(e,null,null,t)},oe.matchesSelector=function(e,t){if((e.ownerDocument||e)!==p&&f(e),t=t.replace(V,"='$1']"),r.matchesSelector&&h&&(!m||!m.test(t))&&(!g||!g.test(t)))try{var n=y.call(e,t);if(n||r.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){}return oe(t,p,null,[e]).length>0},oe.contains=function(e,t){return(e.ownerDocument||e)!==p&&f(e),v(e,t)},oe.attr=function(e,n){(e.ownerDocument||e)!==p&&f(e);var i=o.attrHandle[n.toLowerCase()],s=i&&L.call(o.attrHandle,n.toLowerCase())?i(e,n,!h):t;return s===t?r.attributes||!h?e.getAttribute(n):(s=e.getAttributeNode(n))&&s.specified?s.value:null:s},oe.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},oe.uniqueSort=function(e){var t,n=[],i=0,o=0;if(S=!r.detectDuplicates,c=!r.sortStable&&e.slice(0),e.sort(j),S){for(;t=e[o++];)t===e[o]&&(i=n.push(o));for(;i--;)e.splice(n[i],1)}return e},s=oe.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=s(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=s(t);return n},o=oe.selectors={cacheLength:50,createPseudo:ae,match:Q,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(re,ie),e[3]=(e[4]||e[5]||"").replace(re,ie),"~="===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]||oe.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]&&oe.error(e[0]),e},PSEUDO:function(e){var n,r=!e[5]&&e[2];return Q.CHILD.test(e[0])?null:(e[3]&&e[4]!==t?e[2]=e[4]:r&&G.test(r)&&(n=ge(r,!0))&&(n=r.indexOf(")",r.length-n)-r.length)&&(e[0]=e[0].slice(0,n),e[2]=r.slice(0,n)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(re,ie).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=N[e+" "];return t||(t=new RegExp("(^|"+W+")"+e+"("+W+"|$)"))&&N(e,(function(e){return t.test("string"==typeof e.className&&e.className||typeof e.getAttribute!==D&&e.getAttribute("class")||"")}))},ATTR:function(e,t,n){return function(r){var i=oe.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+" ").indexOf(n)>-1:"|="===t&&(i===n||i.slice(0,n.length+1)===n+"-"))}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),s="last"!==e.slice(-4),a="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,f,p,d,h,g=o!==s?"nextSibling":"previousSibling",m=t.parentNode,y=a&&t.nodeName.toLowerCase(),v=!u&&!a;if(m){if(o){for(;g;){for(f=t;f=f[g];)if(a?f.nodeName.toLowerCase()===y:1===f.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[s?m.firstChild:m.lastChild],s&&v){for(d=(l=(c=m[x]||(m[x]={}))[e]||[])[0]===T&&l[1],p=l[0]===T&&l[2],f=d&&m.childNodes[d];f=++d&&f&&f[g]||(p=d=0)||h.pop();)if(1===f.nodeType&&++p&&f===t){c[e]=[T,d,p];break}}else if(v&&(l=(t[x]||(t[x]={}))[e])&&l[0]===T)p=l[1];else for(;(f=++d&&f&&f[g]||(p=d=0)||h.pop())&&((a?f.nodeName.toLowerCase()!==y:1!==f.nodeType)||!++p||(v&&((f[x]||(f[x]={}))[e]=[T,p]),f!==t)););return(p-=i)===r||p%r==0&&p/r>=0}}},PSEUDO:function(e,t){var n,r=o.pseudos[e]||o.setFilters[e.toLowerCase()]||oe.error("unsupported pseudo: "+e);return r[x]?r(t):r.length>1?(n=[e,e,"",t],o.setFilters.hasOwnProperty(e.toLowerCase())?ae((function(e,n){for(var i,o=r(e,t),s=o.length;s--;)e[i=R.call(e,o[s])]=!(n[i]=o[s])})):function(e){return r(e,0,n)}):r}},pseudos:{not:ae((function(e){var t=[],n=[],r=u(e.replace(_,"$1"));return r[x]?ae((function(e,t,n,i){for(var o,s=r(e,null,i,[]),a=e.length;a--;)(o=s[a])&&(e[a]=!(t[a]=o))})):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}})),has:ae((function(e){return function(t){return oe(e,t).length>0}})),contains:ae((function(e){return function(t){return(t.textContent||t.innerText||s(t)).indexOf(e)>-1}})),lang:ae((function(e){return J.test(e||"")||oe.error("unsupported lang: "+e),e=e.replace(re,ie).toLowerCase(),function(t){var n;do{if(n=h?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.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!o.pseudos.empty(e)},header:function(e){return te.test(e.nodeName)},input:function(e){return ee.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"))||t.toLowerCase()===e.type)},first:de((function(){return[0]})),last:de((function(e,t){return[t-1]})),eq:de((function(e,t,n){return[n<0?n+t:n]})),even:de((function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e})),odd:de((function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e})),lt:de((function(e,t,n){for(var r=n<0?n+t:n;--r>=0;)e.push(r);return e})),gt:de((function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e}))}},o.pseudos.nth=o.pseudos.eq,{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})o.pseudos[n]=fe(n);for(n in{submit:!0,reset:!0})o.pseudos[n]=pe(n);function he(){}function ge(e,t){var n,r,i,s,a,u,l,c=k[e+" "];if(c)return t?0:c.slice(0);for(a=e,u=[],l=o.preFilter;a;){for(s in n&&!(r=X.exec(a))||(r&&(a=a.slice(r[0].length)||a),u.push(i=[])),n=!1,(r=U.exec(a))&&(n=r.shift(),i.push({value:n,type:r[0].replace(_," ")}),a=a.slice(n.length)),o.filter)!(r=Q[s].exec(a))||l[s]&&!(r=l[s](r))||(n=r.shift(),i.push({value:n,type:s,matches:r}),a=a.slice(n.length));if(!n)break}return t?a.length:a?oe.error(e):k(e,u).slice(0)}function me(e){for(var t=0,n=e.length,r="";t<n;t++)r+=e[t].value;return r}function ye(e,t,n){var r=t.dir,o=n&&"parentNode"===r,s=C++;return t.first?function(t,n,i){for(;t=t[r];)if(1===t.nodeType||o)return e(t,n,i)}:function(t,n,a){var u,l,c,f=T+" "+s;if(a){for(;t=t[r];)if((1===t.nodeType||o)&&e(t,n,a))return!0}else for(;t=t[r];)if(1===t.nodeType||o)if((l=(c=t[x]||(t[x]={}))[r])&&l[0]===f){if(!0===(u=l[1])||u===i)return!0===u}else if((l=c[r]=[f])[1]=e(t,n,a)||i,!0===l[1])return!0}}function ve(e){return e.length>1?function(t,n,r){for(var i=e.length;i--;)if(!e[i](t,n,r))return!1;return!0}:e[0]}function xe(e,t,n,r,i){for(var o,s=[],a=0,u=e.length,l=null!=t;a<u;a++)(o=e[a])&&(n&&!n(o,r,i)||(s.push(o),l&&t.push(a)));return s}function be(e,t,n,r,i,o){return r&&!r[x]&&(r=be(r)),i&&!i[x]&&(i=be(i,o)),ae((function(o,s,a,u){var l,c,f,p=[],d=[],h=s.length,g=o||function(e,t,n){for(var r=0,i=t.length;r<i;r++)oe(e,t[r],n);return n}(t||"*",a.nodeType?[a]:a,[]),m=!e||!o&&t?g:xe(g,p,e,a,u),y=n?i||(o?e:h||r)?[]:s:m;if(n&&n(m,y,a,u),r)for(l=xe(y,d),r(l,[],a,u),c=l.length;c--;)(f=l[c])&&(y[d[c]]=!(m[d[c]]=f));if(o){if(i||e){if(i){for(l=[],c=y.length;c--;)(f=y[c])&&l.push(m[c]=f);i(null,y=[],l,u)}for(c=y.length;c--;)(f=y[c])&&(l=i?R.call(o,f):p[c])>-1&&(o[l]=!(s[l]=f))}}else y=xe(y===s?y.splice(h,y.length):y),i?i(null,s,y,u):F.apply(s,y)}))}function we(e){for(var t,n,r,i=e.length,s=o.relative[e[0].type],a=s||o.relative[" "],u=s?1:0,c=ye((function(e){return e===t}),a,!0),f=ye((function(e){return R.call(t,e)>-1}),a,!0),p=[function(e,n,r){return!s&&(r||n!==l)||((t=n).nodeType?c(e,n,r):f(e,n,r))}];u<i;u++)if(n=o.relative[e[u].type])p=[ye(ve(p),n)];else{if((n=o.filter[e[u].type].apply(null,e[u].matches))[x]){for(r=++u;r<i&&!o.relative[e[r].type];r++);return be(u>1&&ve(p),u>1&&me(e.slice(0,u-1).concat({value:" "===e[u-2].type?"*":""})).replace(_,"$1"),n,u<r&&we(e.slice(u,r)),r<i&&we(e=e.slice(r)),r<i&&me(e))}p.push(n)}return ve(p)}he.prototype=o.filters=o.pseudos,o.setFilters=new he,u=oe.compile=function(e,t){var n,r=[],s=[],a=E[e+" "];if(!a){for(t||(t=ge(e)),n=t.length;n--;)(a=we(t[n]))[x]?r.push(a):s.push(a);a=E(e,function(e,t){var n=0,r=t.length>0,s=e.length>0,a=function(a,u,c,f,d){var h,g,m,y=[],v=0,x="0",b=a&&[],w=null!=d,C=l,N=a||s&&o.find.TAG("*",d&&u.parentNode||u),k=T+=null==C?1:Math.random()||.1;for(w&&(l=u!==p&&u,i=n);null!=(h=N[x]);x++){if(s&&h){for(g=0;m=e[g++];)if(m(h,u,c)){f.push(h);break}w&&(T=k,i=++n)}r&&((h=!m&&h)&&v--,a&&b.push(h))}if(v+=x,r&&x!==v){for(g=0;m=t[g++];)m(b,y,u,c);if(a){if(v>0)for(;x--;)b[x]||y[x]||(y[x]=H.call(f));y=xe(y)}F.apply(f,y),w&&!a&&y.length>0&&v+t.length>1&&oe.uniqueSort(f)}return w&&(T=k,l=C),b};return r?ae(a):a}(s,r))}return a},r.sortStable=x.split("").sort(j).join("")===x,r.detectDuplicates=S,f(),r.sortDetached=ue((function(e){return 1&e.compareDocumentPosition(p.createElement("div"))})),ue((function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")}))||le("type|href|height|width",(function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)})),r.attributes&&ue((function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")}))||le("value",(function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue})),ue((function(e){return null==e.getAttribute("disabled")}))||le(M,(function(e,t,n){var r;if(!n)return(r=e.getAttributeNode(t))&&r.specified?r.value:!0===e[t]?t.toLowerCase():null})),b.find=oe,b.expr=oe.selectors,b.expr[":"]=b.expr.pseudos,b.unique=oe.uniqueSort,b.text=oe.getText,b.isXMLDoc=oe.isXML,b.contains=oe.contains}(e);var A,L,q,H,O,F,P={};b.Callbacks=function(e){e="string"==typeof e?P[e]||function(e){var t=P[e]={};return b.each(e.match(T)||[],(function(e,n){t[n]=!0})),t}(e):b.extend({},e);var n,r,i,o,s,a,u=[],l=!e.once&&[],c=function(t){for(n=e.memory&&t,r=!0,a=o||0,o=0,s=u.length,i=!0;u&&a<s;a++)if(!1===u[a].apply(t[0],t[1])&&e.stopOnFalse){n=!1;break}i=!1,u&&(l?l.length&&c(l.shift()):n?u=[]:f.disable())},f={add:function(){if(u){var t=u.length;!function t(n){b.each(n,(function(n,r){var i=b.type(r);"function"===i?e.unique&&f.has(r)||u.push(r):r&&r.length&&"string"!==i&&t(r)}))}(arguments),i?s=u.length:n&&(o=t,c(n))}return this},remove:function(){return u&&b.each(arguments,(function(e,t){for(var n;(n=b.inArray(t,u,n))>-1;)u.splice(n,1),i&&(n<=s&&s--,n<=a&&a--)})),this},has:function(e){return e?b.inArray(e,u)>-1:!(!u||!u.length)},empty:function(){return u=[],s=0,this},disable:function(){return u=l=n=t,this},disabled:function(){return!u},lock:function(){return l=t,n||f.disable(),this},locked:function(){return!l},fireWith:function(e,t){return!u||r&&!l||(t=[e,(t=t||[]).slice?t.slice():t],i?l.push(t):c(t)),this},fire:function(){return f.fireWith(this,arguments),this},fired:function(){return!!r}};return f},b.extend({Deferred:function(e){var t=[["resolve","done",b.Callbacks("once memory"),"resolved"],["reject","fail",b.Callbacks("once memory"),"rejected"],["notify","progress",b.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return b.Deferred((function(n){b.each(t,(function(t,o){var s=o[0],a=b.isFunction(e[t])&&e[t];i[o[1]]((function(){var e=a&&a.apply(this,arguments);e&&b.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[s+"With"](this===r?n.promise():this,a?[e]:arguments)}))})),e=null})).promise()},promise:function(e){return null!=e?b.extend(e,r):r}},i={};return r.pipe=r.then,b.each(t,(function(e,o){var s=o[2],a=o[3];r[o[1]]=s.add,a&&s.add((function(){n=a}),t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=s.fireWith})),r.promise(i),e&&e.call(i,i),i},when:function(e){var t,n,r,i=0,o=g.call(arguments),s=o.length,a=1!==s||e&&b.isFunction(e.promise)?s:0,u=1===a?e:b.Deferred(),l=function(e,n,r){return function(i){n[e]=this,r[e]=arguments.length>1?g.call(arguments):i,r===t?u.notifyWith(n,r):--a||u.resolveWith(n,r)}};if(s>1)for(t=new Array(s),n=new Array(s),r=new Array(s);i<s;i++)o[i]&&b.isFunction(o[i].promise)?o[i].promise().done(l(i,r,o)).fail(u.reject).progress(l(i,n,t)):--a;return a||u.resolveWith(r,o),u.promise()}}),b.support=(A={},L=s.createElement("input"),q=s.createDocumentFragment(),H=s.createElement("div"),O=s.createElement("select"),F=O.appendChild(s.createElement("option")),L.type?(L.type="checkbox",A.checkOn=""!==L.value,A.optSelected=F.selected,A.reliableMarginRight=!0,A.boxSizingReliable=!0,A.pixelPosition=!1,L.checked=!0,A.noCloneChecked=L.cloneNode(!0).checked,O.disabled=!0,A.optDisabled=!F.disabled,(L=s.createElement("input")).value="t",L.type="radio",A.radioValue="t"===L.value,L.setAttribute("checked","t"),L.setAttribute("name","t"),q.appendChild(L),A.checkClone=q.cloneNode(!0).cloneNode(!0).lastChild.checked,A.focusinBubbles="onfocusin"in e,H.style.backgroundClip="content-box",H.cloneNode(!0).style.backgroundClip="",A.clearCloneStyle="content-box"===H.style.backgroundClip,b((function(){var t,n,r=s.getElementsByTagName("body")[0];r&&((t=s.createElement("div")).style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",r.appendChild(t).appendChild(H),H.innerHTML="",H.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%",b.swap(r,null!=r.style.zoom?{zoom:1}:{},(function(){A.boxSizing=4===H.offsetWidth})),e.getComputedStyle&&(A.pixelPosition="1%"!==(e.getComputedStyle(H,null)||{}).top,A.boxSizingReliable="4px"===(e.getComputedStyle(H,null)||{width:"4px"}).width,(n=H.appendChild(s.createElement("div"))).style.cssText=H.style.cssText="padding:0;margin:0;border:0;display:block;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box",n.style.marginRight=n.style.width="0",H.style.width="1px",A.reliableMarginRight=!parseFloat((e.getComputedStyle(n,null)||{}).marginRight)),r.removeChild(t))})),A):A);var R,M,W=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,$=/([A-Z])/g;function B(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=b.expando+Math.random()}function I(e,n,r){var i;if(r===t&&1===e.nodeType)if(i="data-"+n.replace($,"-$1").toLowerCase(),"string"==typeof(r=e.getAttribute(i))){try{r="true"===r||"false"!==r&&("null"===r?null:+r+""===r?+r:W.test(r)?JSON.parse(r):r)}catch(e){}R.set(e,n,r)}else r=t;return r}B.uid=1,B.accepts=function(e){return!e.nodeType||(1===e.nodeType||9===e.nodeType)},B.prototype={key:function(e){if(!B.accepts(e))return 0;var t={},n=e[this.expando];if(!n){n=B.uid++;try{t[this.expando]={value:n},Object.defineProperties(e,t)}catch(r){t[this.expando]=n,b.extend(e,t)}}return this.cache[n]||(this.cache[n]={}),n},set:function(e,t,n){var r,i=this.key(e),o=this.cache[i];if("string"==typeof t)o[t]=n;else if(b.isEmptyObject(o))b.extend(this.cache[i],t);else for(r in t)o[r]=t[r];return o},get:function(e,n){var r=this.cache[this.key(e)];return n===t?r:r[n]},access:function(e,n,r){var i;return n===t||n&&"string"==typeof n&&r===t?(i=this.get(e,n))!==t?i:this.get(e,b.camelCase(n)):(this.set(e,n,r),r!==t?r:n)},remove:function(e,n){var r,i,o,s=this.key(e),a=this.cache[s];if(n===t)this.cache[s]={};else{b.isArray(n)?i=n.concat(n.map(b.camelCase)):(o=b.camelCase(n),i=n in a?[n,o]:(i=o)in a?[i]:i.match(T)||[]),r=i.length;for(;r--;)delete a[i[r]]}},hasData:function(e){return!b.isEmptyObject(this.cache[e[this.expando]]||{})},discard:function(e){e[this.expando]&&delete this.cache[e[this.expando]]}},R=new B,M=new B,b.extend({acceptData:B.accepts,hasData:function(e){return R.hasData(e)||M.hasData(e)},data:function(e,t,n){return R.access(e,t,n)},removeData:function(e,t){R.remove(e,t)},_data:function(e,t,n){return M.access(e,t,n)},_removeData:function(e,t){M.remove(e,t)}}),b.fn.extend({data:function(e,n){var r,i,o=this[0],s=0,a=null;if(e===t){if(this.length&&(a=R.get(o),1===o.nodeType&&!M.get(o,"hasDataAttrs"))){for(r=o.attributes;s<r.length;s++)0===(i=r[s].name).indexOf("data-")&&(i=b.camelCase(i.slice(5)),I(o,i,a[i]));M.set(o,"hasDataAttrs",!0)}return a}return"object"==typeof e?this.each((function(){R.set(this,e)})):b.access(this,(function(n){var r,i=b.camelCase(e);if(o&&n===t)return(r=R.get(o,e))!==t||(r=R.get(o,i))!==t||(r=I(o,i,t))!==t?r:void 0;this.each((function(){var r=R.get(this,i);R.set(this,i,n),-1!==e.indexOf("-")&&r!==t&&R.set(this,e,n)}))}),null,n,arguments.length>1,null,!0)},removeData:function(e){return this.each((function(){R.remove(this,e)}))}}),b.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=M.get(e,t),n&&(!r||b.isArray(n)?r=M.access(e,t,b.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=b.queue(e,t),r=n.length,i=n.shift(),o=b._queueHooks(e,t);"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,(function(){b.dequeue(e,t)}),o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return M.get(e,n)||M.access(e,n,{empty:b.Callbacks("once memory").add((function(){M.remove(e,[t+"queue",n])}))})}}),b.fn.extend({queue:function(e,n){var r=2;return"string"!=typeof e&&(n=e,e="fx",r--),arguments.length<r?b.queue(this[0],e):n===t?this:this.each((function(){var t=b.queue(this,e,n);b._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&b.dequeue(this,e)}))},dequeue:function(e){return this.each((function(){b.dequeue(this,e)}))},delay:function(e,t){return e=b.fx&&b.fx.speeds[e]||e,t=t||"fx",this.queue(t,(function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}}))},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,o=b.Deferred(),s=this,a=this.length,u=function(){--i||o.resolveWith(s,[s])};for("string"!=typeof e&&(n=e,e=t),e=e||"fx";a--;)(r=M.get(s[a],e+"queueHooks"))&&r.empty&&(i++,r.empty.add(u));return u(),o.promise(n)}});var z,_=/[\t\r\n\f]/g,X=/\r/g,U=/^(?:input|select|textarea|button)$/i;b.fn.extend({attr:function(e,t){return b.access(this,b.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each((function(){b.removeAttr(this,e)}))},prop:function(e,t){return b.access(this,b.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each((function(){delete this[b.propFix[e]||e]}))},addClass:function(e){var t,n,r,i,o,s=0,a=this.length,u="string"==typeof e&&e;if(b.isFunction(e))return this.each((function(t){b(this).addClass(e.call(this,t,this.className))}));if(u)for(t=(e||"").match(T)||[];s<a;s++)if(r=1===(n=this[s]).nodeType&&(n.className?(" "+n.className+" ").replace(_," "):" ")){for(o=0;i=t[o++];)r.indexOf(" "+i+" ")<0&&(r+=i+" ");n.className=b.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,s=0,a=this.length,u=0===arguments.length||"string"==typeof e&&e;if(b.isFunction(e))return this.each((function(t){b(this).removeClass(e.call(this,t,this.className))}));if(u)for(t=(e||"").match(T)||[];s<a;s++)if(r=1===(n=this[s]).nodeType&&(n.className?(" "+n.className+" ").replace(_," "):"")){for(o=0;i=t[o++];)for(;r.indexOf(" "+i+" ")>=0;)r=r.replace(" "+i+" "," ");n.className=e?b.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e;return"boolean"==typeof t&&"string"===n?t?this.addClass(e):this.removeClass(e):b.isFunction(e)?this.each((function(n){b(this).toggleClass(e.call(this,n,this.className,t),t)})):this.each((function(){if("string"===n)for(var t,r=0,o=b(this),s=e.match(T)||[];t=s[r++];)o.hasClass(t)?o.removeClass(t):o.addClass(t);else n!==i&&"boolean"!==n||(this.className&&M.set(this,"__className__",this.className),this.className=this.className||!1===e?"":M.get(this,"__className__")||"")}))},hasClass:function(e){for(var t=" "+e+" ",n=0,r=this.length;n<r;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(_," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,o=this[0];return arguments.length?(i=b.isFunction(e),this.each((function(r){var o;1===this.nodeType&&(null==(o=i?e.call(this,r,b(this).val()):e)?o="":"number"==typeof o?o+="":b.isArray(o)&&(o=b.map(o,(function(e){return null==e?"":e+""}))),(n=b.valHooks[this.type]||b.valHooks[this.nodeName.toLowerCase()])&&"set"in n&&n.set(this,o,"value")!==t||(this.value=o))}))):o?(n=b.valHooks[o.type]||b.valHooks[o.nodeName.toLowerCase()])&&"get"in n&&(r=n.get(o,"value"))!==t?r:"string"==typeof(r=o.value)?r.replace(X,""):null==r?"":r:void 0}}),b.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){for(var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||i<0,s=o?null:[],a=o?i+1:r.length,u=i<0?a:o?i:0;u<a;u++)if(((n=r[u]).selected||u===i)&&(b.support.optDisabled?!n.disabled:null===n.getAttribute("disabled"))&&(!n.parentNode.disabled||!b.nodeName(n.parentNode,"optgroup"))){if(t=b(n).val(),o)return t;s.push(t)}return s},set:function(e,t){for(var n,r,i=e.options,o=b.makeArray(t),s=i.length;s--;)((r=i[s]).selected=b.inArray(b(r).val(),o)>=0)&&(n=!0);return n||(e.selectedIndex=-1),o}}},attr:function(e,n,r){var o,s,a=e.nodeType;if(e&&3!==a&&8!==a&&2!==a)return typeof e.getAttribute===i?b.prop(e,n,r):(1===a&&b.isXMLDoc(e)||(n=n.toLowerCase(),o=b.attrHooks[n]||(b.expr.match.bool.test(n)?z:undefined)),r===t?o&&"get"in o&&null!==(s=o.get(e,n))?s:null==(s=b.find.attr(e,n))?t:s:null!==r?o&&"set"in o&&(s=o.set(e,r,n))!==t?s:(e.setAttribute(n,r+""),r):void b.removeAttr(e,n))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(T);if(o&&1===e.nodeType)for(;n=o[i++];)r=b.propFix[n]||n,b.expr.match.bool.test(n)&&(e[r]=!1),e.removeAttribute(n)},attrHooks:{type:{set:function(e,t){if(!b.support.radioValue&&"radio"===t&&b.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{for:"htmlFor",class:"className"},prop:function(e,n,r){var i,o,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return(1!==s||!b.isXMLDoc(e))&&(n=b.propFix[n]||n,o=b.propHooks[n]),r!==t?o&&"set"in o&&(i=o.set(e,r,n))!==t?i:e[n]=r:o&&"get"in o&&null!==(i=o.get(e,n))?i:e[n]},propHooks:{tabIndex:{get:function(e){return e.hasAttribute("tabindex")||U.test(e.nodeName)||e.href?e.tabIndex:-1}}}}),z={set:function(e,t,n){return!1===t?b.removeAttr(e,n):e.setAttribute(n,n),n}},b.each(b.expr.match.bool.source.match(/\w+/g),(function(e,n){var r=b.expr.attrHandle[n]||b.find.attr;b.expr.attrHandle[n]=function(e,n,i){var o=b.expr.attrHandle[n],s=i?t:(b.expr.attrHandle[n]=t)!=r(e,n,i)?n.toLowerCase():null;return b.expr.attrHandle[n]=o,s}})),b.support.optSelected||(b.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null}}),b.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],(function(){b.propFix[this.toLowerCase()]=this})),b.each(["radio","checkbox"],(function(){b.valHooks[this]={set:function(e,t){if(b.isArray(t))return e.checked=b.inArray(b(e).val(),t)>=0}},b.support.checkOn||(b.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})}));var Y=/^key/,V=/^(?:mouse|contextmenu)|click/,G=/^(?:focusinfocus|focusoutblur)$/,J=/^([^.]*)(?:\.(.+)|)$/;function Q(){return!0}function K(){return!1}function Z(){try{return s.activeElement}catch(e){}}b.event={global:{},add:function(e,n,r,o,s){var a,u,l,c,f,p,d,h,g,m,y,v=M.get(e);if(v){for(r.handler&&(r=(a=r).handler,s=a.selector),r.guid||(r.guid=b.guid++),(c=v.events)||(c=v.events={}),(u=v.handle)||(u=v.handle=function(e){return typeof b===i||e&&b.event.triggered===e.type?t:b.event.dispatch.apply(u.elem,arguments)},u.elem=e),f=(n=(n||"").match(T)||[""]).length;f--;)g=y=(l=J.exec(n[f])||[])[1],m=(l[2]||"").split(".").sort(),g&&(d=b.event.special[g]||{},g=(s?d.delegateType:d.bindType)||g,d=b.event.special[g]||{},p=b.extend({type:g,origType:y,data:o,handler:r,guid:r.guid,selector:s,needsContext:s&&b.expr.match.needsContext.test(s),namespace:m.join(".")},a),(h=c[g])||((h=c[g]=[]).delegateCount=0,d.setup&&!1!==d.setup.call(e,o,m,u)||e.addEventListener&&e.addEventListener(g,u,!1)),d.add&&(d.add.call(e,p),p.handler.guid||(p.handler.guid=r.guid)),s?h.splice(h.delegateCount++,0,p):h.push(p),b.event.global[g]=!0);e=null}},remove:function(e,t,n,r,i){var o,s,a,u,l,c,f,p,d,h,g,m=M.hasData(e)&&M.get(e);if(m&&(u=m.events)){for(l=(t=(t||"").match(T)||[""]).length;l--;)if(d=g=(a=J.exec(t[l])||[])[1],h=(a[2]||"").split(".").sort(),d){for(f=b.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],a=a[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),s=o=p.length;o--;)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||a&&!a.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));s&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,m.handle)||b.removeEvent(e,d,m.handle),delete u[d])}else for(d in u)b.event.remove(e,d+t[l],n,r,!0);b.isEmptyObject(u)&&(delete m.handle,M.remove(e,"events"))}},trigger:function(n,r,i,o){var a,u,l,c,f,p,d,h=[i||s],g=v.call(n,"type")?n.type:n,m=v.call(n,"namespace")?n.namespace.split("."):[];if(u=l=i=i||s,3!==i.nodeType&&8!==i.nodeType&&!G.test(g+b.event.triggered)&&(g.indexOf(".")>=0&&(m=g.split("."),g=m.shift(),m.sort()),f=g.indexOf(":")<0&&"on"+g,(n=n[b.expando]?n:new b.Event(g,"object"==typeof n&&n)).isTrigger=o?2:3,n.namespace=m.join("."),n.namespace_re=n.namespace?new RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,n.result=t,n.target||(n.target=i),r=null==r?[n]:b.makeArray(r,[n]),d=b.event.special[g]||{},o||!d.trigger||!1!==d.trigger.apply(i,r))){if(!o&&!d.noBubble&&!b.isWindow(i)){for(c=d.delegateType||g,G.test(c+g)||(u=u.parentNode);u;u=u.parentNode)h.push(u),l=u;l===(i.ownerDocument||s)&&h.push(l.defaultView||l.parentWindow||e)}for(a=0;(u=h[a++])&&!n.isPropagationStopped();)n.type=a>1?c:d.bindType||g,(p=(M.get(u,"events")||{})[n.type]&&M.get(u,"handle"))&&p.apply(u,r),(p=f&&u[f])&&b.acceptData(u)&&p.apply&&!1===p.apply(u,r)&&n.preventDefault();return n.type=g,o||n.isDefaultPrevented()||d._default&&!1!==d._default.apply(h.pop(),r)||!b.acceptData(i)||f&&b.isFunction(i[g])&&!b.isWindow(i)&&((l=i[f])&&(i[f]=null),b.event.triggered=g,i[g](),b.event.triggered=t,l&&(i[f]=l)),n.result}},dispatch:function(e){e=b.event.fix(e);var n,r,i,o,s,a,u=g.call(arguments),l=(M.get(this,"events")||{})[e.type]||[],c=b.event.special[e.type]||{};if(u[0]=e,e.delegateTarget=this,!c.preDispatch||!1!==c.preDispatch.call(this,e)){for(a=b.event.handlers.call(this,e,l),n=0;(o=a[n++])&&!e.isPropagationStopped();)for(e.currentTarget=o.elem,r=0;(s=o.handlers[r++])&&!e.isImmediatePropagationStopped();)e.namespace_re&&!e.namespace_re.test(s.namespace)||(e.handleObj=s,e.data=s.data,(i=((b.event.special[s.origType]||{}).handle||s.handler).apply(o.elem,u))!==t&&!1===(e.result=i)&&(e.preventDefault(),e.stopPropagation()));return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,n){var r,i,o,s,a=[],u=n.delegateCount,l=e.target;if(u&&l.nodeType&&(!e.button||"click"!==e.type))for(;l!==this;l=l.parentNode||this)if(!0!==l.disabled||"click"!==e.type){for(i=[],r=0;r<u;r++)i[o=(s=n[r]).selector+" "]===t&&(i[o]=s.needsContext?b(o,this).index(l)>=0:b.find(o,this,null,[l]).length),i[o]&&i.push(s);i.length&&a.push({elem:l,handlers:i})}return u<n.length&&a.push({elem:this,handlers:n.slice(u)}),a},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,i,o,a=n.button;return null==e.pageX&&null!=n.clientX&&(i=(r=e.target.ownerDocument||s).documentElement,o=r.body,e.pageX=n.clientX+(i&&i.scrollLeft||o&&o.scrollLeft||0)-(i&&i.clientLeft||o&&o.clientLeft||0),e.pageY=n.clientY+(i&&i.scrollTop||o&&o.scrollTop||0)-(i&&i.clientTop||o&&o.clientTop||0)),e.which||a===t||(e.which=1&a?1:2&a?3:4&a?2:0),e}},fix:function(e){if(e[b.expando])return e;var t,n,r,i=e.type,o=e,a=this.fixHooks[i];for(a||(this.fixHooks[i]=a=V.test(i)?this.mouseHooks:Y.test(i)?this.keyHooks:{}),r=a.props?this.props.concat(a.props):this.props,e=new b.Event(o),t=r.length;t--;)e[n=r[t]]=o[n];return e.target||(e.target=s),3===e.target.nodeType&&(e.target=e.target.parentNode),a.filter?a.filter(e,o):e},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==Z()&&this.focus)return this.focus(),!1},delegateType:"focusin"},blur:{trigger:function(){if(this===Z()&&this.blur)return this.blur(),!1},delegateType:"focusout"},click:{trigger:function(){if("checkbox"===this.type&&this.click&&b.nodeName(this,"input"))return this.click(),!1},_default:function(e){return b.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){e.result!==t&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=b.extend(new b.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?b.event.trigger(i,null,t):b.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},b.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)},b.Event=function(e,t){if(!(this instanceof b.Event))return new b.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.getPreventDefault&&e.getPreventDefault()?Q:K):this.type=e,t&&b.extend(this,t),this.timeStamp=e&&e.timeStamp||b.now(),this[b.expando]=!0},b.Event.prototype={isDefaultPrevented:K,isPropagationStopped:K,isImmediatePropagationStopped:K,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=Q,e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=Q,e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Q,this.stopPropagation()}},b.each({mouseenter:"mouseover",mouseleave:"mouseout"},(function(e,t){b.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=e.relatedTarget,i=e.handleObj;return r&&(r===this||b.contains(this,r))||(e.type=i.origType,n=i.handler.apply(this,arguments),e.type=t),n}}})),b.support.focusinBubbles||b.each({focus:"focusin",blur:"focusout"},(function(e,t){var n=0,r=function(e){b.event.simulate(t,e.target,b.event.fix(e),!0)};b.event.special[t]={setup:function(){0==n++&&s.addEventListener(e,r,!0)},teardown:function(){0==--n&&s.removeEventListener(e,r,!0)}}})),b.fn.extend({on:function(e,n,r,i,o){var s,a;if("object"==typeof e){for(a in"string"!=typeof n&&(r=r||n,n=t),e)this.on(a,n,r,e[a],o);return this}if(null==r&&null==i?(i=n,r=n=t):null==i&&("string"==typeof n?(i=r,r=t):(i=r,r=n,n=t)),!1===i)i=K;else if(!i)return this;return 1===o&&(s=i,i=function(e){return b().off(e),s.apply(this,arguments)},i.guid=s.guid||(s.guid=b.guid++)),this.each((function(){b.event.add(this,e,i,r,n)}))},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,o;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,b(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof e){for(o in e)this.off(o,n,e[o]);return this}return!1!==n&&"function"!=typeof n||(r=n,n=t),!1===r&&(r=K),this.each((function(){b.event.remove(this,e,r,n)}))},trigger:function(e,t){return this.each((function(){b.event.trigger(e,t,this)}))},triggerHandler:function(e,t){var n=this[0];if(n)return b.event.trigger(e,t,n,!0)}});var ee=/^.[^:#\[\.,]*$/,te=/^(?:parents|prev(?:Until|All))/,ne=b.expr.match.needsContext,re={children:!0,contents:!0,next:!0,prev:!0};function ie(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}function oe(e,t,n){if(b.isFunction(t))return b.grep(e,(function(e,r){return!!t.call(e,r,e)!==n}));if(t.nodeType)return b.grep(e,(function(e){return e===t!==n}));if("string"==typeof t){if(ee.test(t))return b.filter(t,e,n);t=b.filter(t,e)}return b.grep(e,(function(e){return m.call(t,e)>=0!==n}))}b.fn.extend({find:function(e){var t,n=[],r=this,i=r.length;if("string"!=typeof e)return this.pushStack(b(e).filter((function(){for(t=0;t<i;t++)if(b.contains(r[t],this))return!0})));for(t=0;t<i;t++)b.find(e,r[t],n);return(n=this.pushStack(i>1?b.unique(n):n)).selector=this.selector?this.selector+" "+e:e,n},has:function(e){var t=b(e,this),n=t.length;return this.filter((function(){for(var e=0;e<n;e++)if(b.contains(this,t[e]))return!0}))},not:function(e){return this.pushStack(oe(this,e||[],!0))},filter:function(e){return this.pushStack(oe(this,e||[],!1))},is:function(e){return!!oe(this,"string"==typeof e&&ne.test(e)?b(e):e||[],!1).length},closest:function(e,t){for(var n,r=0,i=this.length,o=[],s=ne.test(e)||"string"!=typeof e?b(e,t||this.context):0;r<i;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(s?s.index(n)>-1:1===n.nodeType&&b.find.matchesSelector(n,e))){n=o.push(n);break}return this.pushStack(o.length>1?b.unique(o):o)},index:function(e){return e?"string"==typeof e?m.call(b(e),this[0]):m.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?b(e,t):b.makeArray(e&&e.nodeType?[e]:e),r=b.merge(this.get(),n);return this.pushStack(b.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),b.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return b.dir(e,"parentNode")},parentsUntil:function(e,t,n){return b.dir(e,"parentNode",n)},next:function(e){return ie(e,"nextSibling")},prev:function(e){return ie(e,"previousSibling")},nextAll:function(e){return b.dir(e,"nextSibling")},prevAll:function(e){return b.dir(e,"previousSibling")},nextUntil:function(e,t,n){return b.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return b.dir(e,"previousSibling",n)},siblings:function(e){return b.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return b.sibling(e.firstChild)},contents:function(e){return e.contentDocument||b.merge([],e.childNodes)}},(function(e,t){b.fn[e]=function(n,r){var i=b.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=b.filter(r,i)),this.length>1&&(re[e]||b.unique(i),te.test(e)&&i.reverse()),this.pushStack(i)}})),b.extend({filter:function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?b.find.matchesSelector(r,e)?[r]:[]:b.find.matches(e,b.grep(t,(function(e){return 1===e.nodeType})))},dir:function(e,n,r){for(var i=[],o=r!==t;(e=e[n])&&9!==e.nodeType;)if(1===e.nodeType){if(o&&b(e).is(r))break;i.push(e)}return i},sibling:function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});var se=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,ae=/<([\w:]+)/,ue=/<|&#?\w+;/,le=/<(?:script|style|link)/i,ce=/^(?:checkbox|radio)$/i,fe=/checked\s*(?:[^=]|=\s*.checked.)/i,pe=/^$|\/(?:java|ecma)script/i,de=/^true\/(.*)/,he=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,ge={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};function me(e,t){return b.nodeName(e,"table")&&b.nodeName(1===t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function ye(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function ve(e){var t=de.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function xe(e,t){for(var n=e.length,r=0;r<n;r++)M.set(e[r],"globalEval",!t||M.get(t[r],"globalEval"))}function be(e,t){var n,r,i,o,s,a,u,l;if(1===t.nodeType){if(M.hasData(e)&&(o=M.access(e),s=M.set(t,o),l=o.events))for(i in delete s.handle,s.events={},l)for(n=0,r=l[i].length;n<r;n++)b.event.add(t,i,l[i][n]);R.hasData(e)&&(a=R.access(e),u=b.extend({},a),R.set(t,u))}}function we(e,n){var r=e.getElementsByTagName?e.getElementsByTagName(n||"*"):e.querySelectorAll?e.querySelectorAll(n||"*"):[];return n===t||n&&b.nodeName(e,n)?b.merge([e],r):r}function Te(e,t){var n=t.nodeName.toLowerCase();"input"===n&&ce.test(e.type)?t.checked=e.checked:"input"!==n&&"textarea"!==n||(t.defaultValue=e.defaultValue)}ge.optgroup=ge.option,ge.tbody=ge.tfoot=ge.colgroup=ge.caption=ge.thead,ge.th=ge.td,b.fn.extend({text:function(e){return b.access(this,(function(e){return e===t?b.text(this):this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(e))}),null,e,arguments.length)},append:function(){return this.domManip(arguments,(function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||me(this,e).appendChild(e)}))},prepend:function(){return this.domManip(arguments,(function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=me(this,e);t.insertBefore(e,t.firstChild)}}))},before:function(){return this.domManip(arguments,(function(e){this.parentNode&&this.parentNode.insertBefore(e,this)}))},after:function(){return this.domManip(arguments,(function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)}))},remove:function(e,t){for(var n,r=e?b.filter(e,this):this,i=0;null!=(n=r[i]);i++)t||1!==n.nodeType||b.cleanData(we(n)),n.parentNode&&(t&&b.contains(n.ownerDocument,n)&&xe(we(n,"script")),n.parentNode.removeChild(n));return this},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(b.cleanData(we(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map((function(){return b.clone(this,e,t)}))},html:function(e){return b.access(this,(function(e){var n=this[0]||{},r=0,i=this.length;if(e===t&&1===n.nodeType)return n.innerHTML;if("string"==typeof e&&!le.test(e)&&!ge[(ae.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(se,"<$1></$2>");try{for(;r<i;r++)1===(n=this[r]||{}).nodeType&&(b.cleanData(we(n,!1)),n.innerHTML=e);n=0}catch(e){}}n&&this.empty().append(e)}),null,e,arguments.length)},replaceWith:function(){var e=b.map(this,(function(e){return[e.nextSibling,e.parentNode]})),t=0;return this.domManip(arguments,(function(n){var r=e[t++],i=e[t++];i&&(r&&r.parentNode!==i&&(r=this.nextSibling),b(this).remove(),i.insertBefore(n,r))}),!0),t?this:this.remove()},detach:function(e){return this.remove(e,!0)},domManip:function(e,t,n){e=d.apply([],e);var r,i,o,s,a,u,l=0,c=this.length,f=this,p=c-1,h=e[0],g=b.isFunction(h);if(g||!(c<=1||"string"!=typeof h||b.support.checkClone)&&fe.test(h))return this.each((function(r){var i=f.eq(r);g&&(e[0]=h.call(this,r,i.html())),i.domManip(e,t,n)}));if(c&&(i=(r=b.buildFragment(e,this[0].ownerDocument,!1,!n&&this)).firstChild,1===r.childNodes.length&&(r=i),i)){for(s=(o=b.map(we(r,"script"),ye)).length;l<c;l++)a=r,l!==p&&(a=b.clone(a,!0,!0),s&&b.merge(o,we(a,"script"))),t.call(this[l],a,l);if(s)for(u=o[o.length-1].ownerDocument,b.map(o,ve),l=0;l<s;l++)a=o[l],pe.test(a.type||"")&&!M.access(a,"globalEval")&&b.contains(u,a)&&(a.src?b._evalUrl(a.src):b.globalEval(a.textContent.replace(he,"")))}return this}}),b.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},(function(e,t){b.fn[e]=function(e){for(var n,r=[],i=b(e),o=i.length-1,s=0;s<=o;s++)n=s===o?this:this.clone(!0),b(i[s])[t](n),h.apply(r,n.get());return this.pushStack(r)}})),b.extend({clone:function(e,t,n){var r,i,o,s,a=e.cloneNode(!0),u=b.contains(e.ownerDocument,e);if(!(b.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||b.isXMLDoc(e)))for(s=we(a),r=0,i=(o=we(e)).length;r<i;r++)Te(o[r],s[r]);if(t)if(n)for(o=o||we(e),s=s||we(a),r=0,i=o.length;r<i;r++)be(o[r],s[r]);else be(e,a);return(s=we(a,"script")).length>0&&xe(s,!u&&we(e,"script")),a},buildFragment:function(e,t,n,r){for(var i,o,s,a,u,l,c=0,f=e.length,p=t.createDocumentFragment(),d=[];c<f;c++)if((i=e[c])||0===i)if("object"===b.type(i))b.merge(d,i.nodeType?[i]:i);else if(ue.test(i)){for(o=o||p.appendChild(t.createElement("div")),s=(ae.exec(i)||["",""])[1].toLowerCase(),a=ge[s]||ge._default,o.innerHTML=a[1]+i.replace(se,"<$1></$2>")+a[2],l=a[0];l--;)o=o.lastChild;b.merge(d,o.childNodes),(o=p.firstChild).textContent=""}else d.push(t.createTextNode(i));for(p.textContent="",c=0;i=d[c++];)if((!r||-1===b.inArray(i,r))&&(u=b.contains(i.ownerDocument,i),o=we(p.appendChild(i),"script"),u&&xe(o),n))for(l=0;i=o[l++];)pe.test(i.type||"")&&n.push(i);return p},cleanData:function(e){for(var n,r,i,o,s,a,u=b.event.special,l=0;(r=e[l])!==t;l++){if(B.accepts(r)&&(s=r[M.expando])&&(n=M.cache[s])){if((i=Object.keys(n.events||{})).length)for(a=0;(o=i[a])!==t;a++)u[o]?b.event.remove(r,o):b.removeEvent(r,o,n.handle);M.cache[s]&&delete M.cache[s]}delete R.cache[r[R.expando]]}},_evalUrl:function(e){return b.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,throws:!0})}}),b.fn.extend({wrapAll:function(e){var t;return b.isFunction(e)?this.each((function(t){b(this).wrapAll(e.call(this,t))})):(this[0]&&(t=b(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 b.isFunction(e)?this.each((function(t){b(this).wrapInner(e.call(this,t))})):this.each((function(){var t=b(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)}))},wrap:function(e){var t=b.isFunction(e);return this.each((function(n){b(this).wrapAll(t?e.call(this,n):e)}))},unwrap:function(){return this.parent().each((function(){b.nodeName(this,"body")||b(this).replaceWith(this.childNodes)})).end()}});var Ce,Ne,ke=/^(none|table(?!-c[ea]).+)/,Ee=/^margin/,Se=new RegExp("^("+w+")(.*)$","i"),je=new RegExp("^("+w+")(?!px)[a-z%]+$","i"),De=new RegExp("^([+-])=("+w+")","i"),Ae={BODY:"block"},Le={position:"absolute",visibility:"hidden",display:"block"},qe={letterSpacing:0,fontWeight:400},He=["Top","Right","Bottom","Left"],Oe=["Webkit","O","Moz","ms"];function Fe(e,t){if(t in e)return t;for(var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=Oe.length;i--;)if((t=Oe[i]+n)in e)return t;return r}function Pe(e,t){return e=t||e,"none"===b.css(e,"display")||!b.contains(e.ownerDocument,e)}function Re(t){return e.getComputedStyle(t,null)}function Me(e,t){for(var n,r,i,o=[],s=0,a=e.length;s<a;s++)(r=e[s]).style&&(o[s]=M.get(r,"olddisplay"),n=r.style.display,t?(o[s]||"none"!==n||(r.style.display=""),""===r.style.display&&Pe(r)&&(o[s]=M.access(r,"olddisplay",Ie(r.nodeName)))):o[s]||(i=Pe(r),(n&&"none"!==n||!i)&&M.set(r,"olddisplay",i?n:b.css(r,"display"))));for(s=0;s<a;s++)(r=e[s]).style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[s]||"":"none"));return e}function We(e,t,n){var r=Se.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function $e(e,t,n,r,i){for(var o=n===(r?"border":"content")?4:"width"===t?1:0,s=0;o<4;o+=2)"margin"===n&&(s+=b.css(e,n+He[o],!0,i)),r?("content"===n&&(s-=b.css(e,"padding"+He[o],!0,i)),"margin"!==n&&(s-=b.css(e,"border"+He[o]+"Width",!0,i))):(s+=b.css(e,"padding"+He[o],!0,i),"padding"!==n&&(s+=b.css(e,"border"+He[o]+"Width",!0,i)));return s}function Be(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=Re(e),s=b.support.boxSizing&&"border-box"===b.css(e,"boxSizing",!1,o);if(i<=0||null==i){if(((i=Ce(e,t,o))<0||null==i)&&(i=e.style[t]),je.test(i))return i;r=s&&(b.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+$e(e,t,n||(s?"border":"content"),r,o)+"px"}function Ie(e){var t=s,n=Ae[e];return n||("none"!==(n=ze(e,t))&&n||((t=((Ne=(Ne||b("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(t.documentElement))[0].contentWindow||Ne[0].contentDocument).document).write("<!doctype html><html><body>"),t.close(),n=ze(e,t),Ne.detach()),Ae[e]=n),n}function ze(e,t){var n=b(t.createElement(e)).appendTo(t.body),r=b.css(n[0],"display");return n.remove(),r}b.fn.extend({css:function(e,n){return b.access(this,(function(e,n,r){var i,o,s={},a=0;if(b.isArray(n)){for(i=Re(e),o=n.length;a<o;a++)s[n[a]]=b.css(e,n[a],!1,i);return s}return r!==t?b.style(e,n,r):b.css(e,n)}),e,n,arguments.length>1)},show:function(){return Me(this,!0)},hide:function(){return Me(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each((function(){Pe(this)?b(this).show():b(this).hide()}))}}),b.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Ce(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{float:"cssFloat"},style:function(e,n,r,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,s,a,u=b.camelCase(n),l=e.style;if(n=b.cssProps[u]||(b.cssProps[u]=Fe(l,u)),a=b.cssHooks[n]||b.cssHooks[u],r===t)return a&&"get"in a&&(o=a.get(e,!1,i))!==t?o:l[n];"string"===(s=typeof r)&&(o=De.exec(r))&&(r=(o[1]+1)*o[2]+parseFloat(b.css(e,n)),s="number"),null==r||"number"===s&&isNaN(r)||("number"!==s||b.cssNumber[u]||(r+="px"),b.support.clearCloneStyle||""!==r||0!==n.indexOf("background")||(l[n]="inherit"),a&&"set"in a&&(r=a.set(e,r,i))===t||(l[n]=r))}},css:function(e,n,r,i){var o,s,a,u=b.camelCase(n);return n=b.cssProps[u]||(b.cssProps[u]=Fe(e.style,u)),(a=b.cssHooks[n]||b.cssHooks[u])&&"get"in a&&(o=a.get(e,!0,r)),o===t&&(o=Ce(e,n,i)),"normal"===o&&n in qe&&(o=qe[n]),""===r||r?(s=parseFloat(o),!0===r||b.isNumeric(s)?s||0:o):o}}),Ce=function(e,n,r){var i,o,s,a=r||Re(e),u=a?a.getPropertyValue(n)||a[n]:t,l=e.style;return a&&(""!==u||b.contains(e.ownerDocument,e)||(u=b.style(e,n)),je.test(u)&&Ee.test(n)&&(i=l.width,o=l.minWidth,s=l.maxWidth,l.minWidth=l.maxWidth=l.width=u,u=a.width,l.width=i,l.minWidth=o,l.maxWidth=s)),u},b.each(["height","width"],(function(e,t){b.cssHooks[t]={get:function(e,n,r){if(n)return 0===e.offsetWidth&&ke.test(b.css(e,"display"))?b.swap(e,Le,(function(){return Be(e,t,r)})):Be(e,t,r)},set:function(e,n,r){var i=r&&Re(e);return We(0,n,r?$e(e,t,r,b.support.boxSizing&&"border-box"===b.css(e,"boxSizing",!1,i),i):0)}}})),b((function(){b.support.reliableMarginRight||(b.cssHooks.marginRight={get:function(e,t){if(t)return b.swap(e,{display:"inline-block"},Ce,[e,"marginRight"])}}),!b.support.pixelPosition&&b.fn.position&&b.each(["top","left"],(function(e,t){b.cssHooks[t]={get:function(e,n){if(n)return n=Ce(e,t),je.test(n)?b(e).position()[t]+"px":n}}}))})),b.expr&&b.expr.filters&&(b.expr.filters.hidden=function(e){return e.offsetWidth<=0&&e.offsetHeight<=0},b.expr.filters.visible=function(e){return!b.expr.filters.hidden(e)}),b.each({margin:"",padding:"",border:"Width"},(function(e,t){b.cssHooks[e+t]={expand:function(n){for(var r=0,i={},o="string"==typeof n?n.split(" "):[n];r<4;r++)i[e+He[r]+t]=o[r]||o[r-2]||o[0];return i}},Ee.test(e)||(b.cssHooks[e+t].set=We)}));var _e=/%20/g,Xe=/\[\]$/,Ue=/\r?\n/g,Ye=/^(?:submit|button|image|reset|file)$/i,Ve=/^(?:input|select|textarea|keygen)/i;function Ge(e,t,n,r){var i;if(b.isArray(t))b.each(t,(function(t,i){n||Xe.test(e)?r(e,i):Ge(e+"["+("object"==typeof i?t:"")+"]",i,n,r)}));else if(n||"object"!==b.type(t))r(e,t);else for(i in t)Ge(e+"["+i+"]",t[i],n,r)}b.fn.extend({serialize:function(){return b.param(this.serializeArray())},serializeArray:function(){return this.map((function(){var e=b.prop(this,"elements");return e?b.makeArray(e):this})).filter((function(){var e=this.type;return this.name&&!b(this).is(":disabled")&&Ve.test(this.nodeName)&&!Ye.test(e)&&(this.checked||!ce.test(e))})).map((function(e,t){var n=b(this).val();return null==n?null:b.isArray(n)?b.map(n,(function(e){return{name:t.name,value:e.replace(Ue,"\r\n")}})):{name:t.name,value:n.replace(Ue,"\r\n")}})).get()}}),b.param=function(e,n){var r,i=[],o=function(e,t){t=b.isFunction(t)?t():null==t?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(n===t&&(n=b.ajaxSettings&&b.ajaxSettings.traditional),b.isArray(e)||e.jquery&&!b.isPlainObject(e))b.each(e,(function(){o(this.name,this.value)}));else for(r in e)Ge(r,e[r],n,o);return i.join("&").replace(_e,"+")},b.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){b.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}})),b.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}});var Je,Qe,Ke=b.now(),Ze=/\?/,et=/#.*$/,tt=/([?&])_=[^&]*/,nt=/^(.*?):[ \t]*([^\r\n]*)$/gm,rt=/^(?:GET|HEAD)$/,it=/^\/\//,ot=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,st=b.fn.load,at={},ut={},lt="*/".concat("*");try{Qe=o.href}catch(e){(Qe=s.createElement("a")).href="",Qe=Qe.href}function ct(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(T)||[];if(b.isFunction(n))for(;r=o[i++];)"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function ft(e,t,n,r){var i={},o=e===ut;function s(a){var u;return i[a]=!0,b.each(e[a]||[],(function(e,a){var l=a(t,n,r);return"string"!=typeof l||o||i[l]?o?!(u=l):void 0:(t.dataTypes.unshift(l),s(l),!1)})),u}return s(t.dataTypes[0])||!i["*"]&&s("*")}function pt(e,n){var r,i,o=b.ajaxSettings.flatOptions||{};for(r in n)n[r]!==t&&((o[r]?e:i||(i={}))[r]=n[r]);return i&&b.extend(!0,e,i),e}Je=ot.exec(Qe.toLowerCase())||[],b.fn.load=function(e,n,r){if("string"!=typeof e&&st)return st.apply(this,arguments);var i,o,s,a=this,u=e.indexOf(" ");return u>=0&&(i=e.slice(u),e=e.slice(0,u)),b.isFunction(n)?(r=n,n=t):n&&"object"==typeof n&&(o="POST"),a.length>0&&b.ajax({url:e,type:o,dataType:"html",data:n}).done((function(e){s=arguments,a.html(i?b("<div>").append(b.parseHTML(e)).find(i):e)})).complete(r&&function(e,t){a.each(r,s||[e.responseText,t,e])}),this},b.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],(function(e,t){b.fn[t]=function(e){return this.on(t,e)}})),b.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Qe,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(Je[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":lt,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":b.parseJSON,"text xml":b.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?pt(pt(e,b.ajaxSettings),t):pt(b.ajaxSettings,e)},ajaxPrefilter:ct(at),ajaxTransport:ct(ut),ajax:function(e,n){"object"==typeof e&&(n=e,e=t),n=n||{};var r,i,o,s,a,u,l,c,f=b.ajaxSetup({},n),p=f.context||f,d=f.context&&(p.nodeType||p.jquery)?b(p):b.event,h=b.Deferred(),g=b.Callbacks("once memory"),m=f.statusCode||{},y={},v={},x=0,w="canceled",C={readyState:0,getResponseHeader:function(e){var t;if(2===x){if(!s)for(s={};t=nt.exec(o);)s[t[1].toLowerCase()]=t[2];t=s[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===x?o:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return x||(e=v[n]=v[n]||e,y[e]=t),this},overrideMimeType:function(e){return x||(f.mimeType=e),this},statusCode:function(e){var t;if(e)if(x<2)for(t in e)m[t]=[m[t],e[t]];else C.always(e[C.status]);return this},abort:function(e){var t=e||w;return r&&r.abort(t),N(0,t),this}};if(h.promise(C).complete=g.add,C.success=C.done,C.error=C.fail,f.url=((e||f.url||Qe)+"").replace(et,"").replace(it,Je[1]+"//"),f.type=n.method||n.type||f.method||f.type,f.dataTypes=b.trim(f.dataType||"*").toLowerCase().match(T)||[""],null==f.crossDomain&&(u=ot.exec(f.url.toLowerCase()),f.crossDomain=!(!u||u[1]===Je[1]&&u[2]===Je[2]&&(u[3]||("http:"===u[1]?"80":"443"))===(Je[3]||("http:"===Je[1]?"80":"443")))),f.data&&f.processData&&"string"!=typeof f.data&&(f.data=b.param(f.data,f.traditional)),ft(at,f,n,C),2===x)return C;for(c in(l=f.global)&&0==b.active++&&b.event.trigger("ajaxStart"),f.type=f.type.toUpperCase(),f.hasContent=!rt.test(f.type),i=f.url,f.hasContent||(f.data&&(i=f.url+=(Ze.test(i)?"&":"?")+f.data,delete f.data),!1===f.cache&&(f.url=tt.test(i)?i.replace(tt,"$1_="+Ke++):i+(Ze.test(i)?"&":"?")+"_="+Ke++)),f.ifModified&&(b.lastModified[i]&&C.setRequestHeader("If-Modified-Since",b.lastModified[i]),b.etag[i]&&C.setRequestHeader("If-None-Match",b.etag[i])),(f.data&&f.hasContent&&!1!==f.contentType||n.contentType)&&C.setRequestHeader("Content-Type",f.contentType),C.setRequestHeader("Accept",f.dataTypes[0]&&f.accepts[f.dataTypes[0]]?f.accepts[f.dataTypes[0]]+("*"!==f.dataTypes[0]?", "+lt+"; q=0.01":""):f.accepts["*"]),f.headers)C.setRequestHeader(c,f.headers[c]);if(f.beforeSend&&(!1===f.beforeSend.call(p,C,f)||2===x))return C.abort();for(c in w="abort",{success:1,error:1,complete:1})C[c](f[c]);if(r=ft(ut,f,n,C)){C.readyState=1,l&&d.trigger("ajaxSend",[C,f]),f.async&&f.timeout>0&&(a=setTimeout((function(){C.abort("timeout")}),f.timeout));try{x=1,r.send(y,N)}catch(e){if(!(x<2))throw e;N(-1,e)}}else N(-1,"No Transport");function N(e,n,s,u){var c,y,v,w,T,N=n;2!==x&&(x=2,a&&clearTimeout(a),r=t,o=u||"",C.readyState=e>0?4:0,c=e>=200&&e<300||304===e,s&&(w=function(e,n,r){var i,o,s,a,u=e.contents,l=e.dataTypes;for(;"*"===l[0];)l.shift(),i===t&&(i=e.mimeType||n.getResponseHeader("Content-Type"));if(i)for(o in u)if(u[o]&&u[o].test(i)){l.unshift(o);break}if(l[0]in r)s=l[0];else{for(o in r){if(!l[0]||e.converters[o+" "+l[0]]){s=o;break}a||(a=o)}s=s||a}if(s)return s!==l[0]&&l.unshift(s),r[s]}(f,C,s)),w=function(e,t,n,r){var i,o,s,a,u,l={},c=e.dataTypes.slice();if(c[1])for(s in e.converters)l[s.toLowerCase()]=e.converters[s];o=c.shift();for(;o;)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=c.shift())if("*"===o)o=u;else if("*"!==u&&u!==o){if(!(s=l[u+" "+o]||l["* "+o]))for(i in l)if((a=i.split(" "))[1]===o&&(s=l[u+" "+a[0]]||l["* "+a[0]])){!0===s?s=l[i]:!0!==l[i]&&(o=a[0],c.unshift(a[1]));break}if(!0!==s)if(s&&e.throws)t=s(t);else try{t=s(t)}catch(e){return{state:"parsererror",error:s?e:"No conversion from "+u+" to "+o}}}return{state:"success",data:t}}(f,w,C,c),c?(f.ifModified&&((T=C.getResponseHeader("Last-Modified"))&&(b.lastModified[i]=T),(T=C.getResponseHeader("etag"))&&(b.etag[i]=T)),204===e||"HEAD"===f.type?N="nocontent":304===e?N="notmodified":(N=w.state,y=w.data,c=!(v=w.error))):(v=N,!e&&N||(N="error",e<0&&(e=0))),C.status=e,C.statusText=(n||N)+"",c?h.resolveWith(p,[y,N,C]):h.rejectWith(p,[C,N,v]),C.statusCode(m),m=t,l&&d.trigger(c?"ajaxSuccess":"ajaxError",[C,f,c?y:v]),g.fireWith(p,[C,N]),l&&(d.trigger("ajaxComplete",[C,f]),--b.active||b.event.trigger("ajaxStop")))}return C},getJSON:function(e,t,n){return b.get(e,t,n,"json")},getScript:function(e,n){return b.get(e,t,n,"script")}}),b.each(["get","post"],(function(e,n){b[n]=function(e,r,i,o){return b.isFunction(r)&&(o=o||i,i=r,r=t),b.ajax({url:e,type:n,dataType:o,data:r,success:i})}})),b.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return b.globalEval(e),e}}}),b.ajaxPrefilter("script",(function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET")})),b.ajaxTransport("script",(function(e){var t,n;if(e.crossDomain)return{send:function(r,i){t=b("<script>").prop({async:!0,charset:e.scriptCharset,src:e.url}).on("load error",n=function(e){t.remove(),n=null,e&&i("error"===e.type?404:200,e.type)}),s.head.appendChild(t[0])},abort:function(){n&&n()}}}));var dt=[],ht=/(=)\?(?=&|$)|\?\?/;b.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=dt.pop()||b.expando+"_"+Ke++;return this[e]=!0,e}}),b.ajaxPrefilter("json jsonp",(function(n,r,i){var o,s,a,u=!1!==n.jsonp&&(ht.test(n.url)?"url":"string"==typeof n.data&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&ht.test(n.data)&&"data");if(u||"jsonp"===n.dataTypes[0])return o=n.jsonpCallback=b.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,u?n[u]=n[u].replace(ht,"$1"+o):!1!==n.jsonp&&(n.url+=(Ze.test(n.url)?"&":"?")+n.jsonp+"="+o),n.converters["script json"]=function(){return a||b.error(o+" was not called"),a[0]},n.dataTypes[0]="json",s=e[o],e[o]=function(){a=arguments},i.always((function(){e[o]=s,n[o]&&(n.jsonpCallback=r.jsonpCallback,dt.push(o)),a&&b.isFunction(s)&&s(a[0]),a=s=t})),"script"})),b.ajaxSettings.xhr=function(){try{return new XMLHttpRequest}catch(e){}};var gt=b.ajaxSettings.xhr(),mt={0:200,1223:204},yt=0,vt={};e.ActiveXObject&&b(e).on("unload",(function(){for(var e in vt)vt[e]();vt=t})),b.support.cors=!!gt&&"withCredentials"in gt,b.support.ajax=gt=!!gt,b.ajaxTransport((function(e){var n;if(b.support.cors||gt&&!e.crossDomain)return{send:function(r,i){var o,s,a=e.xhr();if(a.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(o in e.xhrFields)a[o]=e.xhrFields[o];for(o in e.mimeType&&a.overrideMimeType&&a.overrideMimeType(e.mimeType),e.crossDomain||r["X-Requested-With"]||(r["X-Requested-With"]="XMLHttpRequest"),r)a.setRequestHeader(o,r[o]);n=function(e){return function(){n&&(delete vt[s],n=a.onload=a.onerror=null,"abort"===e?a.abort():"error"===e?i(a.status||404,a.statusText):i(mt[a.status]||a.status,a.statusText,"string"==typeof a.responseText?{text:a.responseText}:t,a.getAllResponseHeaders()))}},a.onload=n(),a.onerror=n("error"),n=vt[s=yt++]=n("abort"),a.send(e.hasContent&&e.data||null)},abort:function(){n&&n()}}}));var xt,bt,wt=/^(?:toggle|show|hide)$/,Tt=new RegExp("^(?:([+-])=|)("+w+")([a-z%]*)$","i"),Ct=/queueHooks$/,Nt=[function(e,n,r){var i,o,s,a,u,l,c=this,f={},p=e.style,d=e.nodeType&&Pe(e),h=M.get(e,"fxshow");r.queue||(null==(u=b._queueHooks(e,"fx")).unqueued&&(u.unqueued=0,l=u.empty.fire,u.empty.fire=function(){u.unqueued||l()}),u.unqueued++,c.always((function(){c.always((function(){u.unqueued--,b.queue(e,"fx").length||u.empty.fire()}))})));1===e.nodeType&&("height"in n||"width"in n)&&(r.overflow=[p.overflow,p.overflowX,p.overflowY],"inline"===b.css(e,"display")&&"none"===b.css(e,"float")&&(p.display="inline-block"));r.overflow&&(p.overflow="hidden",c.always((function(){p.overflow=r.overflow[0],p.overflowX=r.overflow[1],p.overflowY=r.overflow[2]})));for(i in n)if(o=n[i],wt.exec(o)){if(delete n[i],s=s||"toggle"===o,o===(d?"hide":"show")){if("show"!==o||!h||h[i]===t)continue;d=!0}f[i]=h&&h[i]||b.style(e,i)}if(!b.isEmptyObject(f))for(i in h?"hidden"in h&&(d=h.hidden):h=M.access(e,"fxshow",{}),s&&(h.hidden=!d),d?b(e).show():c.done((function(){b(e).hide()})),c.done((function(){var t;for(t in M.remove(e,"fxshow"),f)b.style(e,t,f[t])})),f)a=St(d?h[i]:0,i,c),i in h||(h[i]=a.start,d&&(a.end=a.start,a.start="width"===i||"height"===i?1:0))}],kt={"*":[function(e,t){var n=this.createTween(e,t),r=n.cur(),i=Tt.exec(t),o=i&&i[3]||(b.cssNumber[e]?"":"px"),s=(b.cssNumber[e]||"px"!==o&&+r)&&Tt.exec(b.css(n.elem,e)),a=1,u=20;if(s&&s[3]!==o){o=o||s[3],i=i||[],s=+r||1;do{s/=a=a||".5",b.style(n.elem,e,s+o)}while(a!==(a=n.cur()/r)&&1!==a&&--u)}return i&&(s=n.start=+s||+r||0,n.unit=o,n.end=i[1]?s+(i[1]+1)*i[2]:+i[2]),n}]};function Et(){return setTimeout((function(){xt=t})),xt=b.now()}function St(e,t,n){for(var r,i=(kt[t]||[]).concat(kt["*"]),o=0,s=i.length;o<s;o++)if(r=i[o].call(n,t,e))return r}function jt(e,t,n){var r,i,o=0,s=Nt.length,a=b.Deferred().always((function(){delete u.elem})),u=function(){if(i)return!1;for(var t=xt||Et(),n=Math.max(0,l.startTime+l.duration-t),r=1-(n/l.duration||0),o=0,s=l.tweens.length;o<s;o++)l.tweens[o].run(r);return a.notifyWith(e,[l,r,n]),r<1&&s?n:(a.resolveWith(e,[l]),!1)},l=a.promise({elem:e,props:b.extend({},t),opts:b.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:xt||Et(),duration:n.duration,tweens:[],createTween:function(t,n){var r=b.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(r),r},stop:function(t){var n=0,r=t?l.tweens.length:0;if(i)return this;for(i=!0;n<r;n++)l.tweens[n].run(1);return t?a.resolveWith(e,[l,t]):a.rejectWith(e,[l,t]),this}}),c=l.props;for(!function(e,t){var n,r,i,o,s;for(n in e)if(i=t[r=b.camelCase(n)],o=e[n],b.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),(s=b.cssHooks[r])&&"expand"in s)for(n in o=s.expand(o),delete e[r],o)n in e||(e[n]=o[n],t[n]=i);else t[r]=i}(c,l.opts.specialEasing);o<s;o++)if(r=Nt[o].call(l,e,c,l.opts))return r;return b.map(c,St,l),b.isFunction(l.opts.start)&&l.opts.start.call(e,l),b.fx.timer(b.extend(u,{elem:e,anim:l,queue:l.opts.queue})),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always)}function Dt(e,t,n,r,i){return new Dt.prototype.init(e,t,n,r,i)}function At(e,t){var n,r={height:e},i=0;for(t=t?1:0;i<4;i+=2-t)r["margin"+(n=He[i])]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}function Lt(e){return b.isWindow(e)?e:9===e.nodeType&&e.defaultView}b.Animation=b.extend(jt,{tweener:function(e,t){b.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");for(var n,r=0,i=e.length;r<i;r++)n=e[r],kt[n]=kt[n]||[],kt[n].unshift(t)},prefilter:function(e,t){t?Nt.unshift(e):Nt.push(e)}}),b.Tween=Dt,Dt.prototype={constructor:Dt,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(b.cssNumber[n]?"":"px")},cur:function(){var e=Dt.propHooks[this.prop];return e&&e.get?e.get(this):Dt.propHooks._default.get(this)},run:function(e){var t,n=Dt.propHooks[this.prop];return this.options.duration?this.pos=t=b.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):Dt.propHooks._default.set(this),this}},Dt.prototype.init.prototype=Dt.prototype,Dt.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=b.css(e.elem,e.prop,""))&&"auto"!==t?t:0:e.elem[e.prop]},set:function(e){b.fx.step[e.prop]?b.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[b.cssProps[e.prop]]||b.cssHooks[e.prop])?b.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},Dt.propHooks.scrollTop=Dt.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},b.each(["toggle","show","hide"],(function(e,t){var n=b.fn[t];b.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(At(t,!0),e,r,i)}})),b.fn.extend({fadeTo:function(e,t,n,r){return this.filter(Pe).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=b.isEmptyObject(e),o=b.speed(t,n,r),s=function(){var t=jt(this,b.extend({},e),o);(i||M.get(this,"finish"))&&t.stop(!0)};return s.finish=s,i||!1===o.queue?this.each(s):this.queue(o.queue,s)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=n,n=e,e=t),n&&!1!==e&&this.queue(e||"fx",[]),this.each((function(){var t=!0,n=null!=e&&e+"queueHooks",o=b.timers,s=M.get(this);if(n)s[n]&&s[n].stop&&i(s[n]);else for(n in s)s[n]&&s[n].stop&&Ct.test(n)&&i(s[n]);for(n=o.length;n--;)o[n].elem!==this||null!=e&&o[n].queue!==e||(o[n].anim.stop(r),t=!1,o.splice(n,1));!t&&r||b.dequeue(this,e)}))},finish:function(e){return!1!==e&&(e=e||"fx"),this.each((function(){var t,n=M.get(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=b.timers,s=r?r.length:0;for(n.finish=!0,b.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;t<s;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish}))}}),b.each({slideDown:At("show"),slideUp:At("hide"),slideToggle:At("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},(function(e,t){b.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}})),b.speed=function(e,t,n){var r=e&&"object"==typeof e?b.extend({},e):{complete:n||!n&&t||b.isFunction(e)&&e,duration:e,easing:n&&t||t&&!b.isFunction(t)&&t};return r.duration=b.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in b.fx.speeds?b.fx.speeds[r.duration]:b.fx.speeds._default,null!=r.queue&&!0!==r.queue||(r.queue="fx"),r.old=r.complete,r.complete=function(){b.isFunction(r.old)&&r.old.call(this),r.queue&&b.dequeue(this,r.queue)},r},b.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},b.timers=[],b.fx=Dt.prototype.init,b.fx.tick=function(){var e,n=b.timers,r=0;for(xt=b.now();r<n.length;r++)(e=n[r])()||n[r]!==e||n.splice(r--,1);n.length||b.fx.stop(),xt=t},b.fx.timer=function(e){e()&&b.timers.push(e)&&b.fx.start()},b.fx.interval=13,b.fx.start=function(){bt||(bt=setInterval(b.fx.tick,b.fx.interval))},b.fx.stop=function(){clearInterval(bt),bt=null},b.fx.speeds={slow:600,fast:200,_default:400},b.fx.step={},b.expr&&b.expr.filters&&(b.expr.filters.animated=function(e){return b.grep(b.timers,(function(t){return e===t.elem})).length}),b.fn.offset=function(e){if(arguments.length)return e===t?this:this.each((function(t){b.offset.setOffset(this,e,t)}));var n,r,o=this[0],s={top:0,left:0},a=o&&o.ownerDocument;return a?(n=a.documentElement,b.contains(n,o)?(typeof o.getBoundingClientRect!==i&&(s=o.getBoundingClientRect()),r=Lt(a),{top:s.top+r.pageYOffset-n.clientTop,left:s.left+r.pageXOffset-n.clientLeft}):s):void 0},b.offset={setOffset:function(e,t,n){var r,i,o,s,a,u,l=b.css(e,"position"),c=b(e),f={};"static"===l&&(e.style.position="relative"),a=c.offset(),o=b.css(e,"top"),u=b.css(e,"left"),("absolute"===l||"fixed"===l)&&(o+u).indexOf("auto")>-1?(s=(r=c.position()).top,i=r.left):(s=parseFloat(o)||0,i=parseFloat(u)||0),b.isFunction(t)&&(t=t.call(e,n,a)),null!=t.top&&(f.top=t.top-a.top+s),null!=t.left&&(f.left=t.left-a.left+i),"using"in t?t.using.call(e,f):c.css(f)}},b.fn.extend({position:function(){if(this[0]){var e,t,n=this[0],r={top:0,left:0};return"fixed"===b.css(n,"position")?t=n.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),b.nodeName(e[0],"html")||(r=e.offset()),r.top+=b.css(e[0],"borderTopWidth",!0),r.left+=b.css(e[0],"borderLeftWidth",!0)),{top:t.top-r.top-b.css(n,"marginTop",!0),left:t.left-r.left-b.css(n,"marginLeft",!0)}}},offsetParent:function(){return this.map((function(){for(var e=this.offsetParent||a;e&&!b.nodeName(e,"html")&&"static"===b.css(e,"position");)e=e.offsetParent;return e||a}))}}),b.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},(function(n,r){var i="pageYOffset"===r;b.fn[n]=function(o){return b.access(this,(function(n,o,s){var a=Lt(n);if(s===t)return a?a[r]:n[o];a?a.scrollTo(i?e.pageXOffset:s,i?s:e.pageYOffset):n[o]=s}),n,o,arguments.length,null)}})),b.each({Height:"height",Width:"width"},(function(e,n){b.each({padding:"inner"+e,content:n,"":"outer"+e},(function(r,i){b.fn[i]=function(i,o){var s=arguments.length&&(r||"boolean"!=typeof i),a=r||(!0===i||!0===o?"margin":"border");return b.access(this,(function(n,r,i){var o;return b.isWindow(n)?n.document.documentElement["client"+e]:9===n.nodeType?(o=n.documentElement,Math.max(n.body["scroll"+e],o["scroll"+e],n.body["offset"+e],o["offset"+e],o["client"+e])):i===t?b.css(n,r,a):b.style(n,r,i,a)}),n,s?i:t,s,null)}}))})),b.fn.size=function(){return this.length},b.fn.andSelf=b.fn.addBack,"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=b:"function"==typeof define&&define.amd&&define("jquery",[],(function(){return b})),"object"==typeof e&&"object"==typeof e.document&&(e.jQuery=e.$=b)}(window);
9
33
  "undefined"!=typeof module&&module.exports&&(jQuery=$={isArray:function(e){return"[object Array]"===Object.prototype.toString.apply(e)},isPlainObject:function(e){var t;if(!e||"object"!==jQuery.type(e)||e.nodeType||jQuery.isWindow(e))return!1;if(e.constructor&&!core_hasOwn.call(e,"constructor")&&!core_hasOwn.call(e.constructor.prototype,"isPrototypeOf"))return!1;for(t in e);return void 0===t||core_hasOwn.call(e,t)},extend:function(){var e,t,n,i,s,o,r=arguments[0]||{},a=1,l=arguments.length,c=!1;for("boolean"==typeof r&&(c=r,r=arguments[1]||{},a=2),l===a&&(r=this,--a);a<l;a++)if(null!=(e=arguments[a]))for(t in e)n=r[t],r!==(i=e[t])&&(c&&i&&(this.isPlainObject(i)||(s=this.isArray(i)))?(s?(s=!1,o=n&&this.isArray(n)?n:[]):o=n&&this.isPlainObject(n)?n:{},r[t]=this.extend(c,o,i)):void 0!==i&&(r[t]=i));return r}}),$.extend({spcExtend:function(e){var t=function(e){void 0!==this.init&&this.init(e||{})};t.prototype.superInit=e.init;var n=[];n.push(t.prototype);for(var i=arguments.length,s=0;s<i;s++)n.push(arguments[s]);return $.extend.apply($,n),t}}),$.extend(String.prototype,{lpad:function(e,t){for(var n=this;n.length<t;)n=e+n;return n},rpad:function(e,t){for(var n=this;n.length<t;)n+=e;return n}}),wdi={},wdi.DomainObject={},wdi.RawMessage=$.spcExtend(wdi.DomainObject,{status:null,data:null,init:function(e){this.status=e.status,this.data=e.data}}),wdi.RawSpiceMessage=$.spcExtend(wdi.DomainObject,{header:null,body:null,channel:null,set:function(e,t,n){this.header=e,this.body=t,this.channel=n}}),wdi.SpiceMessage=$.spcExtend(wdi.DomainObject,{messageType:null,args:null,channel:null,init:function(e){this.channel=e.channel,this.messageType=e.messageType,this.args=e.args}}),wdi.EventObject=$.spcExtend(wdi.DomainObject,{events:null,init:function(){this.eyeEvents={}},getListenersLength:function(e){return null==this.eyeEvents[e]&&(this.eyeEvents[e]=[]),this.eyeEvents[e].length},addListener:function(e,t,n){n=n||this,null==this.eyeEvents[e]&&(this.eyeEvents[e]=[]),this.eyeEvents[e].push({fn:t,scope:n})},removeEvent:function(e){this.eyeEvents[e]=void 0},clearEvents:function(){this.eyeEvents={}},fire:function(e,t){var n=this.eyeEvents[e];if(n)for(var i=n.length;i--;)n[i].fn.call(n[i].scope,t)}}),wdi.CHANNEL_STATUS={disconnected:-1,idle:0,establishing:1,established:2},wdi.Debug={debug:!0,log:function(e){this.debug&&console.log.apply(console,Array.prototype.slice.call(arguments))},warn:function(e){console.warn.apply(console,Array.prototype.slice.call(arguments))},info:function(e){this.debug&&console.info.apply(console,Array.prototype.slice.call(arguments))},error:function(e){console.error.apply(console,Array.prototype.slice.call(arguments))}},wdi.Utils={generateWebSocketUrl:function(e,t,n,i,s,o,r,a){return url=i&&s?CONSOLE.wsUrl:e+"://"+t+":"+n+"/websockify/destInfoToken/"+r+"/type/"+o,url}},wdi.postMessageW3CCompilant="undefined"!=typeof window&&window.bowser&&!(window.bowser.msie&&window.bowser.version>=10),wdi.Exception=$.spcExtend(wdi.DomainObject,{errorCode:null,message:null,init:function(e){this.message=e.message||"",this.errorCode=e.errorCode||0}});try{new ImageData(1,1)}catch(e){"undefined"!=typeof window&&(window.ImageData=function(e,t,n){var i=document.createElement("canvas").getContext("2d").createImageData(t,n);return i.data.set(e),i})}wdi.bppMask=[],wdi.bppMask[1]=[128,64,32,16,8,4,2,1],wdi.bppMask[4]=[240,15],wdi.bppMask[8]=[255],wdi.SeamlessIntegration=!0,wdi.Debug.debug=!1,wdi.exceptionHandling=!0,wdi.IntegrationBenchmarkEnabled=!1,wdi.useWorkers=!0,wdi.logOperations=!1;
10
34
  window.Modernizr=function(e,t,n){function r(e){f.cssText=e}function o(e,t){return typeof e===t}var i,a,c={},l=t.documentElement,s="modernizr",u=t.createElement(s),f=u.style,d=" -webkit- -moz- -o- -ms- ".split(" "),p="Webkit Moz O ms",h=p.split(" "),m=p.toLowerCase().split(" "),y={},v=[],g=v.slice,b=function(e,n,r,o){var i,a,c,u=t.createElement("div"),f=t.body,d=f||t.createElement("body");if(parseInt(r,10))for(;r--;)(c=t.createElement("div")).id=o?o[r]:s+(r+1),u.appendChild(c);return i=["&#173;",'<style id="s',s,'">',e,"</style>"].join(""),u.id=s,(f?u:d).innerHTML+=i,d.appendChild(u),f||(d.style.background="",l.appendChild(d)),a=n(u,e),f?u.parentNode.removeChild(u):d.parentNode.removeChild(d),!!a},E={}.hasOwnProperty;for(var C in a=o(E,"undefined")||o(E.call,"undefined")?function(e,t){return t in e&&o(e.constructor.prototype[t],"undefined")}:function(e,t){return E.call(e,t)},Function.prototype.bind||(Function.prototype.bind=function(e){var t=this;if("function"!=typeof t)throw new TypeError;var n=g.call(arguments,1),r=function(){if(this instanceof r){var o=function(){};o.prototype=t.prototype;var i=new o,a=t.apply(i,n.concat(g.call(arguments)));return Object(a)===a?a:i}return t.apply(e,n.concat(g.call(arguments)))};return r}),y.canvas=function(){var e=t.createElement("canvas");return!!e.getContext&&!!e.getContext("2d")},y.webgl=function(){return!!e.WebGLRenderingContext},y.touch=function(){var n;return"ontouchstart"in e||e.DocumentTouch&&t instanceof DocumentTouch?n=!0:b(["@media (",d.join("touch-enabled),("),s,")","{#modernizr{top:9px;position:absolute}}"].join(""),(function(e){n=9===e.offsetTop})),n},y.websockets=function(){return"WebSocket"in e||"MozWebSocket"in e},y)a(y,C)&&(i=C.toLowerCase(),c[i]=y[C](),v.push((c[i]?"":"no-")+i));return c.addTest=function(e,t){if("object"==typeof e)for(var r in e)a(e,r)&&c.addTest(r,e[r]);else{if(e=e.toLowerCase(),c[e]!==n)return c;t="function"==typeof t?t():t,l.className+=" "+(t?"":"no-")+e,c[e]=t}return c},r(""),u=null,function(e,t){function n(){var e=h.elements;return"string"==typeof e?e.split(" "):e}function r(e){var t=p[e[f]];return t||(t={},d++,e[f]=d,p[d]=t),t}function o(e,n,o){return n||(n=t),c?n.createElement(e):(o||(o=r(n)),(i=o.cache[e]?o.cache[e].cloneNode():u.test(e)?(o.cache[e]=o.createElem(e)).cloneNode():o.createElem(e)).canHaveChildren&&!s.test(e)?o.frag.appendChild(i):i);var i}function i(e){e||(e=t);var i=r(e);return h.shivCSS&&!a&&!i.hasCSS&&(i.hasCSS=!!function(e,t){var n=e.createElement("p"),r=e.getElementsByTagName("head")[0]||e.documentElement;return n.innerHTML="x<style>"+t+"</style>",r.insertBefore(n.lastChild,r.firstChild)}(e,"article,aside,figcaption,figure,footer,header,hgroup,nav,section{display:block}mark{background:#FF0;color:#000}")),c||function(e,t){t.cache||(t.cache={},t.createElem=e.createElement,t.createFrag=e.createDocumentFragment,t.frag=t.createFrag()),e.createElement=function(n){return h.shivMethods?o(n,e,t):t.createElem(n)},e.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+n().join().replace(/\w+/g,(function(e){return t.createElem(e),t.frag.createElement(e),'c("'+e+'")'}))+");return n}")(h,t.frag)}(e,i),e}var a,c,l=e.html5||{},s=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,u=/^<|^(?:a|b|button|code|div|fieldset|form|h1|h2|h3|h4|h5|h6|i|iframe|img|input|label|li|link|ol|option|p|param|q|script|select|span|strong|style|table|tbody|td|textarea|tfoot|th|thead|tr|ul)$/i,f="_html5shiv",d=0,p={};!function(){try{var e=t.createElement("a");e.innerHTML="<xyz></xyz>",a="hidden"in e,c=1==e.childNodes.length||function(){t.createElement("a");var e=t.createDocumentFragment();return void 0===e.cloneNode||void 0===e.createDocumentFragment||void 0===e.createElement}()}catch(e){a=!0,c=!0}}();var h={elements:l.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:!1!==l.shivCSS,supportsUnknownElements:c,shivMethods:!1!==l.shivMethods,type:"default",shivDocument:i,createElement:o,createDocumentFragment:function(e,o){if(e||(e=t),c)return e.createDocumentFragment();for(var i=(o=o||r(e)).frag.cloneNode(),a=0,l=n(),s=l.length;a<s;a++)i.createElement(l[a]);return i}};e.html5=h,i(t)}(this,t),c._version="2.6.0",c._prefixes=d,c._domPrefixes=m,c._cssomPrefixes=h,c.testStyles=b,l.className=l.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+" js "+v.join(" "),c}(this,this.document),function(e,t,n){function r(e){return"[object Function]"==y.call(e)}function o(e){return"string"==typeof e}function i(){}function a(e){return!e||"loaded"==e||"complete"==e||"uninitialized"==e}function c(){var e=v.shift();g=1,e?e.t?h((function(){("c"==e.t?d.injectCss:d.injectJs)(e.s,0,e.a,e.x,e.e,1)}),0):(e(),c()):g=0}function l(e,n,r,o,i,l,s){function u(t){if(!p&&a(f.readyState)&&(b.r=p=1,!g&&c(),f.onload=f.onreadystatechange=null,t))for(var r in"img"!=e&&h((function(){C.removeChild(f)}),50),k[n])k[n].hasOwnProperty(r)&&k[n][r].onload()}s=s||d.errorTimeout;var f={},p=0,y=0,b={t:r,s:n,e:i,a:l,x:s};1===k[n]&&(y=1,k[n]=[],f=t.createElement(e)),"object"==e?f.data=n:(f.src=n,f.type=e),f.width=f.height="0",f.onerror=f.onload=f.onreadystatechange=function(){u.call(this,y)},v.splice(o,0,b),"img"!=e&&(y||2===k[n]?(C.insertBefore(f,E?null:m),h(u,s)):k[n].push(f))}function s(e,t,n,r,i){return g=0,t=t||"j",o(e)?l("c"==t?S:w,e,t,this.i++,n,r,i):(v.splice(this.i++,0,e),1==v.length&&c()),this}function u(){var e=d;return e.loader={load:s,i:0},e}var f,d,p=t.documentElement,h=e.setTimeout,m=t.getElementsByTagName("script")[0],y={}.toString,v=[],g=0,b="MozAppearance"in p.style,E=b&&!!t.createRange().compareNode,C=E?p:m.parentNode,w=(p=e.opera&&"[object Opera]"==y.call(e.opera),p=!!t.attachEvent&&!p,b?"object":p?"script":"img"),S=p?"script":w,j=Array.isArray||function(e){return"[object Array]"==y.call(e)},x=[],k={},T={timeout:function(e,t){return t.length&&(e.timeout=t[0]),e}};d=function(e){function t(e,t,n,o,i){var a=function(e){e=e.split("!");var t,n,r,o=x.length,i=e.pop(),a=e.length;for(i={url:i,origUrl:i,prefixes:e},n=0;n<a;n++)r=e[n].split("="),(t=T[r.shift()])&&(i=t(i,r));for(n=0;n<o;n++)i=x[n](i);return i}(e),l=a.autoCallback;a.url.split(".").pop().split("?").shift(),a.bypass||(t&&(t=r(t)?t:t[e]||t[o]||t[e.split("/").pop().split("?")[0]]||c),a.instead?a.instead(e,t,n,o,i):(k[a.url]?a.noexec=!0:k[a.url]=1,n.load(a.url,a.forceCSS||!a.forceJS&&"css"==a.url.split(".").pop().split("?").shift()?"c":undefined,a.noexec,a.attrs,a.timeout),(r(t)||r(l))&&n.load((function(){u(),t&&t(a.origUrl,i,o),l&&l(a.origUrl,i,o),k[a.url]=2}))))}function n(e,n){function a(e,i){if(e){if(o(e))i||(f=function(){var e=[].slice.call(arguments);d.apply(this,e),p()}),t(e,f,n,0,s);else if(Object(e)===e)for(l in c=function(){var t,n=0;for(t in e)e.hasOwnProperty(t)&&n++;return n}(),e)e.hasOwnProperty(l)&&(!i&&! --c&&(r(f)?f=function(){var e=[].slice.call(arguments);d.apply(this,e),p()}:f[l]=function(e){return function(){var t=[].slice.call(arguments);e&&e.apply(this,t),p()}}(d[l])),t(e[l],f,n,l,s))}else!i&&p()}var c,l,s=!!e.test,u=e.load||e.both,f=e.callback||i,d=f,p=e.complete||i;a(s?e.yep:e.nope,!!u),u&&a(u)}var a,l,s=this.yepnope.loader;if(o(e))t(e,0,s,0);else if(j(e))for(a=0;a<e.length;a++)o(l=e[a])?t(l,0,s,0):j(l)?d(l):Object(l)===l&&n(l,s);else Object(e)===e&&n(e,s)},d.addPrefix=function(e,t){T[e]=t},d.addFilter=function(e){x.push(e)},d.errorTimeout=1e4,null==t.readyState&&t.addEventListener&&(t.readyState="loading",t.addEventListener("DOMContentLoaded",f=function(){t.removeEventListener("DOMContentLoaded",f,0),t.readyState="complete"},0)),e.yepnope=u(),e.yepnope.executeStack=c,e.yepnope.injectJs=function(e,n,r,o,l,s){var u,f,p=t.createElement("script");o=o||d.errorTimeout;for(f in p.src=e,r)p.setAttribute(f,r[f]);n=s?c:n||i,p.onreadystatechange=p.onload=function(){!u&&a(p.readyState)&&(u=1,n(),p.onload=p.onreadystatechange=null)},h((function(){u||(u=1,n(1))}),o),l?p.onload():m.parentNode.insertBefore(p,m)},e.yepnope.injectCss=function(e,n,r,o,a,l){var s;o=t.createElement("link"),n=l?c:n||i;for(s in o.href=e,o.rel="stylesheet",o.type="text/css",r)o.setAttribute(s,r[s]);a||(m.parentNode.insertBefore(o,m),h(n,0))}}(this,document),Modernizr.load=function(){yepnope.apply(window,[].slice.call(arguments,0))},Modernizr.addTest("websocketsbinary",(function(){var e,t="https:"==location.protocol?"wss":"ws";if("WebSocket"in window){if(e="binaryType"in WebSocket.prototype)return e;try{return!!new WebSocket(t+"://.").binaryType}catch(e){}}return!1}));
35
+ /*! Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net)
36
+ * Licensed under the MIT License (LICENSE.txt).
37
+ *
38
+ * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
39
+ * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
40
+ * Thanks to: Seamus Leahy for adding deltaX and deltaY
41
+ *
42
+ * Version: 3.0.6
43
+ *
44
+ * Requires: 1.2.2+
45
+ */
11
46
  !function(e){var t=["DOMMouseScroll","mousewheel"];if(e.event.fixHooks)for(var n=t.length;n;)e.event.fixHooks[t[--n]]=e.event.mouseHooks;function i(t){var n=t||window.event,i=[].slice.call(arguments,1),l=0,s=0,o=0;return(t=e.event.fix(n)).type="mousewheel",n.wheelDelta&&(l=n.wheelDelta/120),n.detail&&(l=-n.detail/3),o=l,void 0!==n.axis&&n.axis===n.HORIZONTAL_AXIS&&(o=0,s=-1*l),void 0!==n.wheelDeltaY&&(o=n.wheelDeltaY/120),void 0!==n.wheelDeltaX&&(s=-1*n.wheelDeltaX/120),i.unshift(t,l,s,o),(e.event.dispatch||e.event.handle).apply(this,i)}e.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var e=t.length;e;)this.addEventListener(t[--e],i,!1);else this.onmousewheel=i},teardown:function(){if(this.removeEventListener)for(var e=t.length;e;)this.removeEventListener(t[--e],i,!1);else this.onmousewheel=null}},e.fn.extend({mousewheel:function(e){return e?this.bind("mousewheel",e):this.trigger("mousewheel")},unmousewheel:function(e){return this.unbind("mousewheel",e)}})}(jQuery);
12
47
  /*! jquery-visibility v1.0.11 | MIT license | http://mths.be/visibility */
13
48
  !function(e,i){"function"==typeof define&&define.amd?define(["jquery"],(function(t){return i(e,t)})):"object"==typeof exports?module.exports=i(e,require("jquery")):i(e,jQuery)}(this,(function(e,i,t){"use strict";function o(){"hidden"!==n&&(r.hidden=f.pageVisibility?r[n]:t)}for(var n,u,r=e.document,s=["webkit","o","ms","moz",""],f=i.support||{},c=("onfocusin"in r&&"hasFocus"in r?"focusin focusout":"focus blur");(u=s.pop())!==t;)if(n=(u?u+"H":"h")+"idden",f.pageVisibility=r[n]!==t,f.pageVisibility){c=u+"visibilitychange";break}o(),i(/blur$/.test(c)?e:r).on(c,(function(e){var u=e.type,s=e.originalEvent;if(s){var f=s.toElement;(!/^focus./.test(u)||f===t&&s.fromElement===t&&s.relatedTarget===t)&&i(r).triggerHandler(n&&r[n]||/^(?:blur|focusout)$/.test(u)?"hide":"show"),o()}}))}));
49
+ /**
50
+ * @license
51
+ * lodash 4.0.0 (Custom Build) lodash.com/license | Underscore.js 1.8.3 underscorejs.org/LICENSE
52
+ * Build: `lodash -o ./dist/lodash.js`
53
+ */
14
54
  (function(){function n(n,t){return n.set(t[0],t[1]),n}function t(n,t){return n.add(t),n}function r(n,t,r){switch(r?r.length:0){case 0:return n.call(t);case 1:return n.call(t,r[0]);case 2:return n.call(t,r[0],r[1]);case 3:return n.call(t,r[0],r[1],r[2])}return n.apply(t,r)}function e(n,t){for(var r=-1,e=n.length;++r<e&&!1!==t(n[r],r,n););return n}function u(n,t){for(var r=-1,e=n.length;++r<e;)if(!t(n[r],r,n))return!1;return!0}function o(n,t){for(var r=-1,e=n.length,u=-1,o=[];++r<e;){var i=n[r];t(i,r,n)&&(o[++u]=i)}return o}function i(n,t){return!!n.length&&-1<g(n,t,0)}function f(n,t,r){for(var e=-1,u=n.length;++e<u;)if(r(t,n[e]))return!0;return!1}function c(n,t){for(var r=-1,e=n.length,u=Array(e);++r<e;)u[r]=t(n[r],r,n);return u}function a(n,t){for(var r=-1,e=t.length,u=n.length;++r<e;)n[u+r]=t[r];return n}function l(n,t,r,e){var u=-1,o=n.length;for(e&&o&&(r=n[++u]);++u<o;)r=t(r,n[u],u,n);return r}function s(n,t,r,e){var u=n.length;for(e&&u&&(r=n[--u]);u--;)r=t(r,n[u],u,n);return r}function h(n,t){for(var r=-1,e=n.length;++r<e;)if(t(n[r],r,n))return!0;return!1}function p(n,t,r){for(var e=-1,u=n.length;++e<u;){var o=n[e],i=t(o);if(null!=i&&(f===M?i==i:r(i,f)))var f=i,c=o}return c}function _(n,t,r,e){var u;return r(n,(function(n,r,o){return t(n,r,o)?(u=e?r:n,!1):void 0})),u}function v(n,t,r){for(var e=n.length,u=r?e:-1;r?u--:++u<e;)if(t(n[u],u,n))return u;return-1}function g(n,t,r){if(t!=t)return S(n,r);--r;for(var e=n.length;++r<e;)if(n[r]===t)return r;return-1}function d(n,t,r,e,u){return u(n,(function(n,u,o){r=e?(e=!1,n):t(r,n,u,o)})),r}function y(n,t){for(var r,e=-1,u=n.length;++e<u;){var o=t(n[e]);o!==M&&(r=r===M?o:r+o)}return r}function b(n,t){for(var r=-1,e=Array(n);++r<n;)e[r]=t(r);return e}function x(n,t){return c(t,(function(t){return[t,n[t]]}))}function j(n){return function(t){return n(t)}}function m(n,t){return c(t,(function(t){return n[t]}))}function w(n,t){for(var r=-1,e=n.length;++r<e&&-1<g(t,n[r],0););return r}function A(n,t){for(var r=n.length;r--&&-1<g(t,n[r],0););return r}function O(n){return n&&n.Object===Object?n:null}function E(n,t){if(n!==t){var r=null===n,e=n===M,u=n==n,o=null===t,i=t===M,f=t==t;if(n>t&&!o||!u||r&&!i&&f||e&&f)return 1;if(t>n&&!r||!f||o&&!e&&u||i&&u)return-1}return 0}function k(n){return Sn[n]}function I(n){return Wn[n]}function R(n){return"\\"+zn[n]}function S(n,t,r){var e=n.length;for(t+=r?0:-1;r?t--:++t<e;){var u=n[t];if(u!=u)return t}return-1}function W(n){var t=!1;if(null!=n&&"function"!=typeof n.toString)try{t=!!(n+"")}catch(n){}return t}function C(n,t){return(n="number"==typeof n||vn.test(n)?+n:-1)>-1&&0==n%1&&(null==t?9007199254740991:t)>n}function U(n){for(var t,r=[];!(t=n.next()).done;)r.push(t.value);return r}function z(n){var t=-1,r=Array(n.size);return n.forEach((function(n,e){r[++t]=[e,n]})),r}function B(n,t){for(var r=-1,e=n.length,u=-1,o=[];++r<e;)n[r]===t&&(n[r]="__lodash_placeholder__",o[++u]=r);return o}function L(n){var t=-1,r=Array(n.size);return n.forEach((function(n){r[++t]=n})),r}function $(n){if(!n||!wn.test(n))return n.length;for(var t=mn.lastIndex=0;mn.test(n);)t++;return t}function F(n){return Cn[n]}var M,N=1/0,Z=NaN,D=/\b__p\+='';/g,q=/\b(__p\+=)''\+/g,P=/(__e\(.*?\)|\b__t\))\+'';/g,T=/&(?:amp|lt|gt|quot|#39|#96);/g,K=/[&<>"'`]/g,G=RegExp(T.source),V=RegExp(K.source),J=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,H=/<%=([\s\S]+?)%>/g,Q=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,X=/^\w*$/,nn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g,tn=/[\\^$.*+?()[\]{}|]/g,rn=RegExp(tn.source),en=/^\s+|\s+$/g,un=/^\s+/,on=/\s+$/,fn=/\\(\\)?/g,cn=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,an=/\w*$/,ln=/^0x/i,sn=/^[-+]0x[0-9a-f]+$/i,hn=/^0b[01]+$/i,pn=/^\[object .+?Constructor\]$/,_n=/^0o[0-7]+$/i,vn=/^(?:0|[1-9]\d*)$/,gn=/[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g,dn=/($^)/,yn=/['\n\r\u2028\u2029\\]/g,bn="[\\ufe0e\\ufe0f]?(?:\\ud83c[\\udffb-\\udfff])?(?:\\u200d(?:[^\\ud800-\\udfff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])[\\ufe0e\\ufe0f]?(?:\\ud83c[\\udffb-\\udfff])?)*",xn="(?:[\\u2700-\\u27bf]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])"+bn,jn=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe23]","g"),mn=RegExp("(?:[^\\ud800-\\udfff][\\u0300-\\u036f\\ufe20-\\ufe23]?|[\\u0300-\\u036f\\ufe20-\\ufe23]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\ud800-\\udfff])"+bn,"g"),wn=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe23\\ufe0e\\ufe0f]"),An=/[a-zA-Z0-9]+/g,On=RegExp(["[A-Z\\xc0-\\xd6\\xd8-\\xde]?[a-z\\xdf-\\xf6\\xf8-\\xff]+(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2018\\u2019\\u201c\\u201d \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde]|$)|(?:[A-Z\\xc0-\\xd6\\xd8-\\xde]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2018\\u2019\\u201c\\u201d \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2018\\u2019\\u201c\\u201d \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde](?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2018\\u2019\\u201c\\u201d \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])|$)|[A-Z\\xc0-\\xd6\\xd8-\\xde]?(?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2018\\u2019\\u201c\\u201d \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+|\\d+(?:(?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2018\\u2019\\u201c\\u201d \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+)?",xn].join("|"),"g"),En=/[a-z][A-Z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,kn="Array Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Map Math Object Reflect RegExp Set String Symbol TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array WeakMap _ clearTimeout isFinite parseInt setTimeout".split(" "),In={};In["[object Float32Array]"]=In["[object Float64Array]"]=In["[object Int8Array]"]=In["[object Int16Array]"]=In["[object Int32Array]"]=In["[object Uint8Array]"]=In["[object Uint8ClampedArray]"]=In["[object Uint16Array]"]=In["[object Uint32Array]"]=!0,In["[object Arguments]"]=In["[object Array]"]=In["[object ArrayBuffer]"]=In["[object Boolean]"]=In["[object Date]"]=In["[object Error]"]=In["[object Function]"]=In["[object Map]"]=In["[object Number]"]=In["[object Object]"]=In["[object RegExp]"]=In["[object Set]"]=In["[object String]"]=In["[object WeakMap]"]=!1;var Rn={};Rn["[object Arguments]"]=Rn["[object Array]"]=Rn["[object ArrayBuffer]"]=Rn["[object Boolean]"]=Rn["[object Date]"]=Rn["[object Float32Array]"]=Rn["[object Float64Array]"]=Rn["[object Int8Array]"]=Rn["[object Int16Array]"]=Rn["[object Int32Array]"]=Rn["[object Map]"]=Rn["[object Number]"]=Rn["[object Object]"]=Rn["[object RegExp]"]=Rn["[object Set]"]=Rn["[object String]"]=Rn["[object Symbol]"]=Rn["[object Uint8Array]"]=Rn["[object Uint8ClampedArray]"]=Rn["[object Uint16Array]"]=Rn["[object Uint32Array]"]=!0,Rn["[object Error]"]=Rn["[object Function]"]=Rn["[object WeakMap]"]=!1;var Sn={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss"},Wn={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","`":"&#96;"},Cn={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'","&#96;":"`"},Un={function:!0,object:!0},zn={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Bn=parseFloat,Ln=parseInt,$n=Un[typeof exports]&&exports&&!exports.nodeType?exports:null,Fn=Un[typeof module]&&module&&!module.nodeType?module:null,Mn=O(Un[typeof self]&&self),Nn=O(Un[typeof window]&&window),Zn=Fn&&Fn.exports===$n?$n:null,Dn=O(Un[typeof this]&&this),qn=O($n&&Fn&&"object"==typeof global&&global)||Nn!==(Dn&&Dn.window)&&Nn||Mn||Dn||Function("return this")(),Pn=function O(vn){function bn(n){if(ee(n)&&!xo(n)&&!(n instanceof Wn)){if(n instanceof Sn)return n;if(Pe.call(n,"__wrapped__"))return kr(n)}return new Sn(n)}function xn(){}function Sn(n,t){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=M}function Wn(n){this.__wrapped__=n,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function Cn(){}function Un(n){var t=-1,r=n?n.length:0;for(this.clear();++t<r;){var e=n[t];this.set(e[0],e[1])}}function zn(n){var t=-1,r=n?n.length:0;for(this.__data__=new Un;++t<r;)this.push(n[t])}function $n(n,t){var r=n.__data__;return br(t)?(r=r.__data__,"__lodash_hash_undefined__"===("string"==typeof t?r.string:r.hash)[t]):r.has(t)}function Fn(n){var t=-1,r=n?n.length:0;for(this.clear();++t<r;){var e=n[t];this.set(e[0],e[1])}}function Mn(n,t){var r=Zn(n,t);return!(0>r)&&(r==n.length-1?n.pop():iu.call(n,r,1),!0)}function Nn(n,t){var r=Zn(n,t);return 0>r?M:n[r][1]}function Zn(n,t){for(var r=n.length;r--;)if(Gr(n[r][0],t))return r;return-1}function Dn(n,t,r){var e=Zn(n,t);0>e?n.push([t,r]):n[e][1]=r}function Tn(n,t,r,e){return n===M||Gr(n,De[r])&&!Pe.call(e,r)?t:n}function Kn(n,t,r){(r!==M&&!Gr(n[t],r)||"number"==typeof t&&r===M&&!(t in n))&&(n[t]=r)}function Gn(n,t,r){var e=n[t];(!Gr(e,r)||Gr(e,De[t])&&!Pe.call(n,t)||r===M&&!(t in n))&&(n[t]=r)}function Vn(n,t){return n&&Zt(t,je(t),n)}function Jn(n,t){for(var r=-1,e=null==n,u=t.length,o=Array(u);++r<u;)o[r]=e?M:ye(n,t[r]);return o}function Yn(n,t,r){return n==n&&(r!==M&&(n=n>r?r:n),t!==M&&(n=t>n?t:n)),n}function Hn(n,t,r,u,o,i){var f;if(r&&(f=o?r(n,u,o,i):r(n)),f!==M)return f;if(!re(n))return n;if(u=xo(n)){if(f=function(n){var t=n.length,r=n.constructor(t);return t&&"string"==typeof n[0]&&Pe.call(n,"index")&&(r.index=n.index,r.input=n.input),r}(n),!t)return Nt(n,f)}else{var c=pr(n),a="[object Function]"==c||"[object GeneratorFunction]"==c;if("[object Object]"!=c&&"[object Arguments]"!=c&&(!a||o))return Rn[c]?vr(n,c,t):o?n:{};if(W(n))return o?n:{};if(f=function(n){return n=n.constructor,Iu(Xr(n)?n.prototype:M)}(a?{}:n),!t)return qt(n,Vn(f,n))}return i||(i=new Fn),(o=i.get(n))?o:(i.set(n,f),(u?e:et)(n,(function(e,u){Gn(f,u,Hn(e,t,r,u,n,i))})),u?f:qt(n,f))}function Qn(n,t,r){if("function"!=typeof n)throw new Ne("Expected a function");return ou((function(){n.apply(M,r)}),t)}function Xn(n,t,r,e){var u=-1,o=i,a=!0,l=n.length,s=[],h=t.length;if(!l)return s;r&&(t=c(t,j(r))),e?(o=f,a=!1):t.length>=200&&(o=$n,a=!1,t=new zn(t));n:for(;++u<l;){var p=n[u],_=r?r(p):p;if(a&&_==_){for(var v=h;v--;)if(t[v]===_)continue n;s.push(p)}else o(t,_,e)||s.push(p)}return s}function nt(n,t){var r=!0;return Ru(n,(function(n,e,u){return r=!!t(n,e,u)})),r}function tt(n,t){var r=[];return Ru(n,(function(n,e,u){t(n,e,u)&&r.push(n)})),r}function rt(n,t,r,e){e||(e=[]);for(var u=-1,o=n.length;++u<o;){var i=n[u];Hr(i)&&(r||xo(i)||Jr(i))?t?rt(i,t,r,e):a(e,i):r||(e[e.length]=i)}return e}function et(n,t){return n&&Wu(n,t,je)}function ut(n,t){return n&&Cu(n,t,je)}function ot(n,t){return o(t,(function(t){return Xr(n[t])}))}function it(n,t){for(var r=0,e=(t=yr(t,n)?[t+""]:Ct(t)).length;null!=n&&e>r;)n=n[t[r++]];return r&&r==e?n:M}function ft(n,t){return Pe.call(n,t)||"object"==typeof n&&t in n&&null===tu(n)}function ct(n,t){return t in Object(n)}function at(n,t,r){for(var e=r?f:i,u=n.length,o=u,a=Array(u),l=[];o--;){var s=n[o];o&&t&&(s=c(s,j(t))),a[o]=r||!t&&120>s.length?M:new zn(o&&s)}var h=-1,p=(s=n[0]).length,_=a[0];n:for(;++h<p;){var v=s[h],g=t?t(v):v;if(_?!$n(_,g):!e(l,g,r)){for(o=u;--o;){var d=a[o];if(d?!$n(d,g):!e(n[o],g,r))continue n}_&&_.push(g),l.push(v)}}return l}function lt(n,t,e){return yr(t,n)||(n=wr(n,t=Ct(t)),t=Wr(t)),null==(t=null==n?n:n[t])?M:r(t,n,e)}function st(n,t,r,e,u){if(n===t)n=!0;else if(null==n||null==t||!re(n)&&!ee(t))n=n!=n&&t!=t;else n:{var o=xo(n),i=xo(t),f="[object Array]",c="[object Array]";o||("[object Arguments]"==(f=pr(n))?f="[object Object]":"[object Object]"!=f&&(o=le(n))),i||("[object Arguments]"==(c=pr(t))?c="[object Object]":"[object Object]"!=c&&le(t));var a="[object Object]"==f&&!W(n);i="[object Object]"==c&&!W(t);if(!(c=f==c)||o||a){if(!(2&e)&&(f=a&&Pe.call(n,"__wrapped__"),i=i&&Pe.call(t,"__wrapped__"),f||i)){n=st(f?n.value():n,i?t.value():t,r,e,u);break n}c?(u||(u=new Fn),n=(o?fr:cr)(n,t,st,r,e,u)):n=!1}else n=function(n,t,r,e,u,o){switch(r){case"[object ArrayBuffer]":if(n.byteLength!=t.byteLength||!e(new Qe(n),new Qe(t)))break;return!0;case"[object Boolean]":case"[object Date]":return+n==+t;case"[object Error]":return n.name==t.name&&n.message==t.message;case"[object Number]":return n!=+n?t!=+t:n==+t;case"[object RegExp]":case"[object String]":return n==t+"";case"[object Map]":var i=z;case"[object Set]":return i||(i=L),(2&o||n.size==t.size)&&e(i(n),i(t),u,1|o);case"[object Symbol]":return!!Ye&&Ou.call(n)==Ou.call(t)}return!1}(n,t,f,st,r,e)}return n}function ht(n,t,r,e){var u=r.length,o=u,i=!e;if(null==n)return!o;for(n=Object(n);u--;){var f=r[u];if(i&&f[2]?f[1]!==n[f[0]]:!(f[0]in n))return!1}for(;++u<o;){var c=(f=r[u])[0],a=n[c],l=f[1];if(i&&f[2]){if(a===M&&!(c in n))return!1}else if(f=new Fn,(c=e?e(a,l,c,n,t,f):M)===M?!st(l,a,e,3,f):!c)return!1}return!0}function pt(n){var t=typeof n;return"function"==t?n:null==n?Re:"object"==t?xo(n)?dt(n[0],n[1]):gt(n):ze(n)}function _t(n){n=null==n?n:Object(n);var t,r=[];for(t in n)r.push(t);return r}function vt(n,t){var r=-1,e=Yr(n)?Array(n.length):[];return Ru(n,(function(n,u,o){e[++r]=t(n,u,o)})),e}function gt(n){var t=sr(n);if(1==t.length&&t[0][2]){var r=t[0][0],e=t[0][1];return function(n){return null!=n&&(n[r]===e&&(e!==M||r in Object(n)))}}return function(r){return r===n||ht(r,n,t)}}function dt(n,t){return function(r){var e=ye(r,n);return e===M&&e===t?xe(r,n):st(t,e,M,3)}}function yt(n,t,r,u){if(n!==t){var o=xo(t)||le(t)?M:me(t);e(o||t,(function(e,i){if(o&&(e=t[i=e]),re(e)){u||(u=new Fn);var f=i,c=u,a=n[f],l=t[f];if(s=c.get(l)||c.get(a))Kn(n,f,s);else{var s,h=(s=r?r(a,l,f+"",n,t,c):M)===M;h&&(s=l,xo(l)||le(l)?s=xo(a)?a:Hr(a)?Nt(a):Hn(l):ie(l)||Jr(l)?s=Jr(a)?ge(a):re(a)?a:Hn(l):h=Xr(l)),c.set(l,s),h&&yt(s,l,r,c),Kn(n,f,s)}}else(f=r?r(n[i],e,i+"",n,t,u):M)===M&&(f=e),Kn(n,i,f)}))}}function bt(n,t,r){var e=-1,u=lr();return t=c(t.length?t:Array(1),(function(n){return u(n)})),n=vt(n,(function(n){return{a:c(t,(function(t){return t(n)})),b:++e,c:n}})),function(n,t){var r=n.length;for(n.sort(t);r--;)n[r]=n[r].c;return n}(n,(function(n,t){var e;n:{e=-1;for(var u=n.a,o=t.a,i=u.length,f=r.length;++e<i;){var c=E(u[e],o[e]);if(c){e=f>e?c*("desc"==r[e]?-1:1):c;break n}}e=n.b-t.b}return e}))}function xt(n,t){return n=Object(n),l(t,(function(t,r){return r in n&&(t[r]=n[r]),t}),{})}function jt(n,t){var r={};return function(n,t){null==n||Wu(n,t,me)}(n,(function(n,e){t(n)&&(r[e]=n)})),r}function mt(n){return function(t){return null==t?M:t[n]}}function wt(n,t,r){var e=-1,u=t.length,o=n;for(r&&(o=c(n,(function(n){return r(n)})));++e<u;){var i=0,f=t[e];for(f=r?r(f):f;-1<(i=g(o,f,i));)o!==n&&iu.call(o,i,1),iu.call(n,i,1)}return n}function At(n,t){for(var r=n?t.length:0,e=r-1;r--;){var u=t[r];if(e==r||u!=o){var o=u;if(C(u))iu.call(n,u,1);else if(yr(u,n))delete n[u];else{var i=wr(n,u=Ct(u));null!=i&&delete i[Wr(u)]}}}}function Ot(n,t){return n+cu(vu()*(t-n+1))}function Et(n,t,r,e){for(var u=-1,o=(t=yr(t,n)?[t+""]:Ct(t)).length,i=o-1,f=n;null!=f&&++u<o;){var c=t[u];if(re(f)){var a=r;if(u!=i){var l=f[c];(a=e?e(l,c,f):M)===M&&(a=null==l?C(t[u+1])?[]:{}:l)}Gn(f,c,a)}f=f[c]}return n}function kt(n,t,r){var e=-1,u=n.length;for(0>t&&(t=-t>u?0:u+t),0>(r=r>u?u:r)&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0,r=Array(u);++e<u;)r[e]=n[e+t];return r}function It(n,t){var r;return Ru(n,(function(n,e,u){return!(r=t(n,e,u))})),!!r}function Rt(n,t,r){var e=0,u=n?n.length:e;if("number"==typeof t&&t==t&&2147483647>=u){for(;u>e;){var o=e+u>>>1,i=n[o];(r?t>=i:t>i)&&null!==i?e=o+1:u=o}return u}return St(n,t,Re,r)}function St(n,t,r,e){t=r(t);for(var u=0,o=n?n.length:0,i=t!=t,f=null===t,c=t===M;o>u;){var a=cu((u+o)/2),l=r(n[a]),s=l!==M,h=l==l;(i?h||e:f?h&&s&&(e||null!=l):c?h&&(e||s):null!=l&&(e?t>=l:t>l))?u=a+1:o=a}return pu(o,4294967294)}function Wt(n,t){for(var r=0,e=n.length,u=n[0],o=t?t(u):u,i=o,f=0,c=[u];++r<e;)u=n[r],Gr(o=t?t(u):u,i)||(i=o,c[++f]=u);return c}function Ct(n){return xo(n)?n:Ar(n)}function Ut(n,t,r){var e=-1,u=i,o=n.length,c=!0,a=[],l=a;if(r)c=!1,u=f;else if(o<200)l=t?[]:a;else{if(u=t?null:zu(n))return L(u);c=!1,u=$n,l=new zn}n:for(;++e<o;){var s=n[e],h=t?t(s):s;if(c&&h==h){for(var p=l.length;p--;)if(l[p]===h)continue n;t&&l.push(h),a.push(s)}else u(l,h,r)||(l!==a&&l.push(h),a.push(s))}return a}function zt(n,t,r,e){for(var u=n.length,o=e?u:-1;(e?o--:++o<u)&&t(n[o],o,n););return r?kt(n,e?0:o,e?o+1:u):kt(n,e?o+1:0,e?u:o)}function Bt(n,t){var r=n;return r instanceof Wn&&(r=r.value()),l(t,(function(n,t){return t.func.apply(t.thisArg,a([n],t.args))}),r)}function Lt(n,t,r){for(var e=-1,u=n.length;++e<u;)var o=o?a(Xn(o,n[e],t,r),Xn(n[e],o,t,r)):n[e];return o&&o.length?Ut(o,t,r):[]}function $t(n){var t=new n.constructor(n.byteLength);return new Qe(t).set(new Qe(n)),t}function Ft(n,t,r){for(var e=r.length,u=-1,o=hu(n.length-e,0),i=-1,f=t.length,c=Array(f+o);++i<f;)c[i]=t[i];for(;++u<e;)c[r[u]]=n[u];for(;o--;)c[i++]=n[u++];return c}function Mt(n,t,r){for(var e=-1,u=r.length,o=-1,i=hu(n.length-u,0),f=-1,c=t.length,a=Array(i+c);++o<i;)a[o]=n[o];for(i=o;++f<c;)a[i+f]=t[f];for(;++e<u;)a[i+r[e]]=n[o++];return a}function Nt(n,t){var r=-1,e=n.length;for(t||(t=Array(e));++r<e;)t[r]=n[r];return t}function Zt(n,t,r){return Dt(n,t,r)}function Dt(n,t,r,e){r||(r={});for(var u=-1,o=t.length;++u<o;){var i=t[u];Gn(r,i,e?e(r[i],n[i],i,r,n):n[i])}return r}function qt(n,t){return Zt(n,$u(n),t)}function Pt(n,t){return function(r,e){var u=t?t():{};if(e=lr(e),xo(r))for(var o=-1,i=r.length;++o<i;){var f=r[o];n(u,f,e(f),r)}else Ru(r,(function(t,r,o){n(u,t,e(t),o)}));return u}}function Tt(n){return Kr((function(t,r){var e=-1,u=r.length,o=u>1?r[u-1]:M,i=u>2?r[2]:M;o="function"==typeof o?(u--,o):M;for(i&&dr(r[0],r[1],i)&&(o=3>u?M:o,u=1),t=Object(t);++e<u;)(i=r[e])&&n(t,i,o);return t}))}function Kt(n,t){return function(r,e){if(null==r)return r;if(!Yr(r))return n(r,e);for(var u=r.length,o=t?u:-1,i=Object(r);(t?o--:++o<u)&&!1!==e(i[o],o,i););return r}}function Gt(n){return function(t,r,e){for(var u=-1,o=Object(t),i=(e=e(t)).length;i--;){var f=e[n?i:++u];if(!1===r(o[f],f,o))break}return t}}function Vt(n){return function(t){t=de(t);var r=wn.test(t)?t.match(mn):M,e=r?r[0]:t.charAt(0);return t=r?r.slice(1).join(""):t.slice(1),e[n]()+t}}function Jt(n){return function(t){return l(Ie(Ee(t)),n,"")}}function Yt(n){return function(){switch((t=arguments).length){case 0:return new n;case 1:return new n(t[0]);case 2:return new n(t[0],t[1]);case 3:return new n(t[0],t[1],t[2]);case 4:return new n(t[0],t[1],t[2],t[3]);case 5:return new n(t[0],t[1],t[2],t[3],t[4]);case 6:return new n(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new n(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var t,r=Iu(n.prototype);return re(t=n.apply(r,t))?t:r}}function Ht(n,t,e){var u=Yt(n);return function o(){for(var i=arguments.length,f=i,c=Array(i),a=this&&this!==qn&&this instanceof o?u:n,l=o.placeholder;f--;)c[f]=arguments[f];return i-=(f=3>i&&c[0]!==l&&c[i-1]!==l?[]:B(c,l)).length,e>i?ur(n,t,Xt,l,M,c,f,M,M,e-i):r(a,this,c)}}function Qt(n){return Kr((function(t){var r=(t=rt(t)).length,e=r,u=Sn.prototype.thru;for(n&&t.reverse();e--;){if("function"!=typeof(i=t[e]))throw new Ne("Expected a function");if(u&&!o&&"wrapper"==ar(i))var o=new Sn([],!0)}for(e=o?e:r;++e<r;){var i,f="wrapper"==(u=ar(i=t[e]))?Bu(i):M;o=f&&xr(f[0])&&424==f[1]&&!f[4].length&&1==f[9]?o[ar(f[0])].apply(o,f[3]):1==i.length&&xr(i)?o[u]():o.thru(i)}return function(){var n=(u=arguments)[0];if(o&&1==u.length&&xo(n)&&n.length>=200)return o.plant(n).value();for(var e=0,u=r?t[e].apply(this,u):n;++e<r;)u=t[e].call(this,u);return u}}))}function Xt(n,t,r,e,u,o,i,f,c,a){var l=128&t,s=1&t,h=2&t,p=8&t,_=16&t,v=512&t,g=h?M:Yt(n);return function d(){for(var y=x=arguments.length,b=Array(x);y--;)b[y]=arguments[y];if(e&&(b=Ft(b,e,u)),o&&(b=Mt(b,o,i)),p||_){var x=x-(j=B(b,y=d.placeholder)).length;if(a>x)return ur(n,t,Xt,y,r,b,j,f,c,a-x)}if(x=s?r:this,y=h?x[n]:n,f)for(var j=b.length,m=pu(f.length,j),w=Nt(b);m--;){var A=f[m];b[m]=C(A,j)?w[A]:M}else v&&b.length>1&&b.reverse();return l&&b.length>c&&(b.length=c),this&&this!==qn&&this instanceof d&&(y=g||Yt(y)),y.apply(x,b)}}function nr(n){return Kr((function(t){return t=c(rt(t),lr()),Kr((function(e){var u=this;return n(t,(function(n){return r(n,u,e)}))}))}))}function tr(n,t,r){return t=pe(t),n=$(n),t&&t>n?(n=ke(r=r===M?" ":r+"",fu((t-=n)/$(r))),wn.test(r)?n.match(mn).slice(0,t).join(""):n.slice(0,t)):""}function rr(n,t,e,u){var o=1&t,i=Yt(n);return function t(){for(var f=-1,c=arguments.length,a=-1,l=u.length,s=Array(l+c),h=this&&this!==qn&&this instanceof t?i:n;++a<l;)s[a]=u[a];for(;c--;)s[a++]=arguments[++f];return r(h,o?e:this,s)}}function er(n){return function(t,r,e){e&&"number"!=typeof e&&dr(t,r,e)&&(r=e=M),t=(t=ve(t))==t?t:0,r===M?(r=t,t=0):r=ve(r)||0,e=e===M?r>t?1:-1:ve(e)||0;var u=-1;r=hu(fu((r-t)/(e||1)),0);for(var o=Array(r);r--;)o[n?r:++u]=t,t+=e;return o}}function ur(n,t,r,e,u,o,i,f,c,a){var l=8&t;return f=f?Nt(f):M,4&(t=(t|(l?32:64))&~(l?64:32))||(t&=-4),t=[n,t,u,l?o:M,l?i:M,o=l?M:o,i=l?M:i,f,c,a],r=r.apply(M,t),xr(n)&&Fu(r,t),r.placeholder=e,r}function or(n){var t=Fe[n];return function(n,r){if(n=ve(n),r=pe(r)){var e=(de(n)+"e").split("e");return+((e=(de(e=t(e[0]+"e"+(+e[1]+r)))+"e").split("e"))[0]+"e"+(+e[1]-r))}return t(n)}}function ir(n,t,r,e,u,o,i,f){var c=2&t;if(!c&&"function"!=typeof n)throw new Ne("Expected a function");var a=e?e.length:0;if(a||(t&=-97,e=u=M),i=i===M?i:hu(pe(i),0),f=f===M?f:pe(f),a-=u?u.length:0,64&t){var l=e,s=u;e=u=M}var h=c?M:Bu(n);return o=[n,t,r,e,u,l,s,o,i,f],h&&(t=(r=o[1])|(n=h[1]),e=128==n&&8==r||128==n&&256==r&&h[8]>=o[7].length||384==n&&h[8]>=h[7].length&&8==r,131>t||e)&&(1&n&&(o[2]=h[2],t|=1&r?0:4),(r=h[3])&&(e=o[3],o[3]=e?Ft(e,r,h[4]):Nt(r),o[4]=e?B(o[3],"__lodash_placeholder__"):Nt(h[4])),(r=h[5])&&(e=o[5],o[5]=e?Mt(e,r,h[6]):Nt(r),o[6]=e?B(o[5],"__lodash_placeholder__"):Nt(h[6])),(r=h[7])&&(o[7]=Nt(r)),128&n&&(o[8]=null==o[8]?h[8]:pu(o[8],h[8])),null==o[9]&&(o[9]=h[9]),o[0]=h[0],o[1]=t),n=o[0],t=o[1],r=o[2],e=o[3],u=o[4],!(f=o[9]=null==o[9]?c?0:n.length:hu(o[9]-a,0))&&24&t&&(t&=-25),(h?Uu:Fu)(t&&1!=t?8==t||16==t?Ht(n,t,f):32!=t&&33!=t||u.length?Xt.apply(M,o):rr(n,t,r,e):function(n,t,r){var e=1&t,u=Yt(n);return function t(){return(this&&this!==qn&&this instanceof t?u:n).apply(e?r:this,arguments)}}(n,t,r),o)}function fr(n,t,r,e,u,o){var i=-1,f=2&u,c=1&u,a=n.length,l=t.length;if(!(a==l||f&&l>a))return!1;if(l=o.get(n))return l==t;for(l=!0,o.set(n,t);++i<a;){var s=n[i],p=t[i];if(e)var _=f?e(p,s,i,t,n,o):e(s,p,i,n,t,o);if(_!==M){if(_)continue;l=!1;break}if(c){if(!h(t,(function(n){return s===n||r(s,n,e,u,o)}))){l=!1;break}}else if(s!==p&&!r(s,p,e,u,o)){l=!1;break}}return o.delete(n),l}function cr(n,t,r,e,u,o){var i=2&u,f=1&u,c=je(n),a=c.length,l=je(t);if(a!=l.length&&!i)return!1;for(var s=a;s--;){var h=c[s];if(!(i?h in t:ft(t,h))||!f&&h!=l[s])return!1}if(h=o.get(n))return h==t;for(f=!0,o.set(n,t),l=i;++s<a;){var p=n[h=c[s]],_=t[h];if(e)var v=i?e(_,p,h,t,n,o):e(p,_,h,n,t,o);if(v===M?p!==_&&!r(p,_,e,u,o):!v){f=!1;break}l||(l="constructor"==h)}return f&&!l&&((r=n.constructor)!=(e=t.constructor)&&"constructor"in n&&"constructor"in t&&!("function"==typeof r&&r instanceof r&&"function"==typeof e&&e instanceof e)&&(f=!1)),o.delete(n),f}function ar(n){for(var t=n.name+"",r=ku[t],e=r?r.length:0;e--;){var u=r[e],o=u.func;if(null==o||o==n)return u.name}return t}function lr(){var n=(n=bn.iteratee||Se)===Se?pt:n;return arguments.length?n(arguments[0],arguments[1]):n}function sr(n){for(var t=(n=we(n)).length;t--;){var r=n[t][1];n[t][2]=r==r&&!re(r)}return n}function hr(n,t){var r=null==n?M:n[t];return ue(r)?r:M}function pr(n){return Ge.call(n)}function _r(n,t,r){if(null==n)return!1;var e=r(n,t);return e||yr(t)||null!=(n=wr(n,t=Ct(t)))&&(e=r(n,t=Wr(t))),e||te(n&&n.length)&&C(t,n.length)&&(xo(n)||ce(n)||Jr(n))}function vr(r,e,u){var o=r.constructor;switch(e){case"[object ArrayBuffer]":return $t(r);case"[object Boolean]":case"[object Date]":return new o(+r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return e=r.buffer,new r.constructor(u?$t(e):e,r.byteOffset,r.length);case"[object Map]":return u=r.constructor,l(z(r),n,new u);case"[object Number]":case"[object String]":return new o(r);case"[object RegExp]":return(u=new r.constructor(r.source,an.exec(r))).lastIndex=r.lastIndex,u;case"[object Set]":return u=r.constructor,l(L(r),t,new u);case"[object Symbol]":return Ye?Object(Ou.call(r)):{}}}function gr(n){var t=n?n.length:M;return te(t)&&(xo(n)||ce(n)||Jr(n))?b(t,String):null}function dr(n,t,r){if(!re(r))return!1;var e=typeof t;return!!("number"==e?Yr(r)&&C(t,r.length):"string"==e&&t in r)&&Gr(r[t],n)}function yr(n,t){return"number"==typeof n||!xo(n)&&(X.test(n)||!Q.test(n)||null!=t&&n in Object(t))}function br(n){var t=typeof n;return"number"==t||"boolean"==t||"string"==t&&"__proto__"!==n||null==n}function xr(n){var t=ar(n),r=bn[t];return"function"==typeof r&&t in Wn.prototype&&(n===r||!!(t=Bu(r))&&n===t[0])}function jr(n){var t=n&&n.constructor;return n===("function"==typeof t&&t.prototype||De)}function mr(n,t,r,e,u,o){return re(n)&&re(t)&&(o.set(t,n),yt(n,t,mr,o)),n===M?Hn(t):n}function wr(n,t){return 1==t.length?n:ye(n,kt(t,0,-1))}function Ar(n){var t=[];return de(n).replace(nn,(function(n,r,e,u){t.push(e?u.replace(fn,"$1"):r||n)})),t}function Or(n){return Hr(n)?n:[]}function Er(n){return"function"==typeof n?n:Re}function kr(n){if(n instanceof Wn)return n.clone();var t=new Sn(n.__wrapped__,n.__chain__);return t.__actions__=Nt(n.__actions__),t.__index__=n.__index__,t.__values__=n.__values__,t}function Ir(n,t,r){var e=n?n.length:0;return e?kt(n,0>(t=r||t===M?1:pe(t))?0:t,e):[]}function Rr(n,t,r){var e=n?n.length:0;return e?kt(n,0,0>(t=e-(t=r||t===M?1:pe(t)))?0:t):[]}function Sr(n){return n?n[0]:M}function Wr(n){var t=n?n.length:0;return t?n[t-1]:M}function Cr(n,t){return n&&n.length&&t&&t.length?wt(n,t):n}function Ur(n){return n?gu.call(n):n}function zr(n){if(!n||!n.length)return[];var t=0;return n=o(n,(function(n){return Hr(n)?(t=hu(n.length,t),!0):void 0})),b(t,(function(t){return c(n,mt(t))}))}function Br(n,t){if(!n||!n.length)return[];var e=zr(n);return null==t?e:c(e,(function(n){return r(t,M,n)}))}function Lr(n){return(n=bn(n)).__chain__=!0,n}function $r(n,t){return t(n)}function Fr(n,t){return"function"==typeof t&&xo(n)?e(n,t):Ru(n,Er(t))}function Mr(n,t){var r;if("function"==typeof t&&xo(n)){for(r=n.length;r--&&!1!==t(n[r],r,n););r=n}else r=Su(n,Er(t));return r}function Nr(n,t){var r=-1,e=he(n),u=(o=e.length)-1;for(t=Yn(pe(t),0,o);++r<t;){var o,i=e[o=Ot(r,u)];e[o]=e[r],e[r]=i}return e.length=t,e}function Zr(n){if(null==n)return 0;if(Yr(n)){var t=n.length;return t&&ce(n)?$(n):t}return je(n).length}function Dr(n,t,r){return t=r?M:t,t=n&&null==t?n.length:t,ir(n,128,M,M,M,M,t)}function qr(n,t){var r;if("function"!=typeof t)throw new Ne("Expected a function");return n=pe(n),function(){return 0<--n&&(r=t.apply(this,arguments)),1>=n&&(t=M),r}}function Pr(n,t,r){function e(){p&&Xe(p),a&&Xe(a),v=0,c=a=h=p=_=M}function u(t,r){r&&Xe(r),a=p=_=M,t&&(v=lo(),l=n.apply(h,c),p||a||(c=h=M))}function o(){var n=t-(lo()-s);0>=n||n>t?u(_,a):p=ou(o,n)}function i(){u(y,p)}function f(){if(c=arguments,s=lo(),h=this,_=y&&(p||!g),!1===d)var r=g&&!p;else{a||g||(v=s);var e=d-(s-v),u=0>=e||e>d;u?(a&&(a=Xe(a)),v=s,l=n.apply(h,c)):a||(a=ou(i,e))}return u&&p?p=Xe(p):p||t===d||(p=ou(o,t)),r&&(u=!0,l=n.apply(h,c)),!u||p||a||(c=h=M),l}var c,a,l,s,h,p,_,v=0,g=!1,d=!1,y=!0;if("function"!=typeof n)throw new Ne("Expected a function");return t=ve(t)||0,re(r)&&(g=!!r.leading,d="maxWait"in r&&hu(ve(r.maxWait)||0,t),y="trailing"in r?!!r.trailing:y),f.cancel=e,f.flush=function(){return(p&&_||a&&y)&&(l=n.apply(h,c)),e(),l},f}function Tr(n,t){function r(){var e=arguments,u=t?t.apply(this,e):e[0],o=r.cache;return o.has(u)?o.get(u):(e=n.apply(this,e),r.cache=o.set(u,e),e)}if("function"!=typeof n||t&&"function"!=typeof t)throw new Ne("Expected a function");return r.cache=new Tr.Cache,r}function Kr(n,t){if("function"!=typeof n)throw new Ne("Expected a function");return t=hu(t===M?n.length-1:pe(t),0),function(){for(var e=arguments,u=-1,o=hu(e.length-t,0),i=Array(o);++u<o;)i[u]=e[t+u];switch(t){case 0:return n.call(this,i);case 1:return n.call(this,e[0],i);case 2:return n.call(this,e[0],e[1],i)}for(o=Array(t+1),u=-1;++u<t;)o[u]=e[u];return o[t]=i,r(n,this,o)}}function Gr(n,t){return n===t||n!=n&&t!=t}function Vr(n,t){return n>t}function Jr(n){return Hr(n)&&Pe.call(n,"callee")&&(!uu.call(n,"callee")||"[object Arguments]"==Ge.call(n))}function Yr(n){return null!=n&&!("function"==typeof n&&Xr(n))&&te(Lu(n))}function Hr(n){return ee(n)&&Yr(n)}function Qr(n){return ee(n)&&"string"==typeof n.message&&"[object Error]"==Ge.call(n)}function Xr(n){return"[object Function]"==(n=re(n)?Ge.call(n):"")||"[object GeneratorFunction]"==n}function ne(n){return"number"==typeof n&&n==pe(n)}function te(n){return"number"==typeof n&&n>-1&&0==n%1&&9007199254740991>=n}function re(n){var t=typeof n;return!!n&&("object"==t||"function"==t)}function ee(n){return!!n&&"object"==typeof n}function ue(n){return null!=n&&(Xr(n)?Je.test(qe.call(n)):ee(n)&&(W(n)?Je:pn).test(n))}function oe(n){return"number"==typeof n||ee(n)&&"[object Number]"==Ge.call(n)}function ie(n){if(!ee(n)||"[object Object]"!=Ge.call(n)||W(n))return!1;var t=De;return"function"==typeof n.constructor&&(t=tu(n)),null===t||"function"==typeof(n=t.constructor)&&n instanceof n&&qe.call(n)==Ke}function fe(n){return re(n)&&"[object RegExp]"==Ge.call(n)}function ce(n){return"string"==typeof n||!xo(n)&&ee(n)&&"[object String]"==Ge.call(n)}function ae(n){return"symbol"==typeof n||ee(n)&&"[object Symbol]"==Ge.call(n)}function le(n){return ee(n)&&te(n.length)&&!!In[Ge.call(n)]}function se(n,t){return t>n}function he(n){if(!n)return[];if(Yr(n))return ce(n)?n.match(mn):Nt(n);if(eu&&n[eu])return U(n[eu]());var t=pr(n);return("[object Map]"==t?z:"[object Set]"==t?L:Ae)(n)}function pe(n){if(!n)return 0===n?n:0;if((n=ve(n))===N||n===-N)return 17976931348623157e292*(0>n?-1:1);var t=n%1;return n==n?t?n-t:n:0}function _e(n){return n?Yn(pe(n),0,4294967295):0}function ve(n){if(re(n)&&(n=re(n=Xr(n.valueOf)?n.valueOf():n)?n+"":n),"string"!=typeof n)return 0===n?n:+n;n=n.replace(en,"");var t=hn.test(n);return t||_n.test(n)?Ln(n.slice(2),t?2:8):sn.test(n)?Z:+n}function ge(n){return Zt(n,me(n))}function de(n){if("string"==typeof n)return n;if(null==n)return"";if(ae(n))return Ye?Eu.call(n):"";var t=n+"";return"0"==t&&1/n==-N?"-0":t}function ye(n,t,r){return(n=null==n?M:it(n,t))===M?r:n}function be(n,t){return _r(n,t,ft)}function xe(n,t){return _r(n,t,ct)}function je(n){var t=jr(n);if(!t&&!Yr(n))return su(Object(n));var r,e,u=!!(e=gr(n)),o=(e=e||[]).length;for(r in n)!ft(n,r)||u&&("length"==r||C(r,o))||t&&"constructor"==r||e.push(r);return e}function me(n){for(var t,r=-1,e=jr(n),u=_t(n),o=u.length,i=!!(t=gr(n)),f=(t=t||[]).length;++r<o;){var c=u[r];i&&("length"==c||C(c,f))||"constructor"==c&&(e||!Pe.call(n,c))||t.push(c)}return t}function we(n){return x(n,je(n))}function Ae(n){return n?m(n,je(n)):[]}function Oe(n){return $o(de(n).toLowerCase())}function Ee(n){return(n=de(n))&&n.replace(gn,k).replace(jn,"")}function ke(n,t){n=de(n),t=pe(t);var r="";if(!n||1>t||t>9007199254740991)return r;do{t%2&&(r+=n),t=cu(t/2),n+=n}while(t);return r}function Ie(n,t,r){return n=de(n),(t=r?M:t)===M&&(t=En.test(n)?On:An),n.match(t)||[]}function Re(n){return n}function Se(n){return ee(n)&&!xo(n)?We(n):pt(n)}function We(n){return gt(Hn(n,!0))}function Ce(n,t,r){var u=je(t),o=ot(t,u);null!=r||re(t)&&(o.length||!u.length)||(r=t,t=n,n=this,o=ot(t,je(t)));var i=!re(r)||!("chain"in r)||r.chain,f=Xr(n);return e(o,(function(r){var e=t[r];n[r]=e,f&&(n.prototype[r]=function(){var t=this.__chain__;if(i||t){var r=n(this.__wrapped__);return(r.__actions__=Nt(this.__actions__)).push({func:e,args:arguments,thisArg:n}),r.__chain__=t,r}return e.apply(n,a([this.value()],arguments))})})),n}function Ue(){}function ze(n){return yr(n)?mt(n):function(n){return function(t){return it(t,n)}}(n)}function Be(n){return n&&n.length?y(n,Re):M}var Le=(vn=vn?Pn.defaults({},vn,Pn.pick(qn,kn)):qn).Date,$e=vn.Error,Fe=vn.Math,Me=vn.RegExp,Ne=vn.TypeError,Ze=vn.Array.prototype,De=vn.Object.prototype,qe=vn.Function.prototype.toString,Pe=De.hasOwnProperty,Te=0,Ke=qe.call(Object),Ge=De.toString,Ve=qn._,Je=Me("^"+qe.call(Pe).replace(tn,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ye=vn.Symbol,He=vn.f,Qe=vn.Uint8Array,Xe=vn.clearTimeout,nu=He?He.g:M,tu=Object.getPrototypeOf,ru=Object.getOwnPropertySymbols,eu="symbol"==typeof(eu=Ye&&Ye.iterator)?eu:M,uu=De.propertyIsEnumerable,ou=vn.setTimeout,iu=Ze.splice,fu=Fe.ceil,cu=Fe.floor,au=vn.isFinite,lu=Ze.join,su=Object.keys,hu=Fe.max,pu=Fe.min,_u=vn.parseInt,vu=Fe.random,gu=Ze.reverse,du=hr(vn,"Map"),yu=hr(vn,"Set"),bu=hr(vn,"WeakMap"),xu=hr(Object,"create"),ju=bu&&new bu,mu=du?qe.call(du):"",wu=yu?qe.call(yu):"",Au=Ye?Ye.prototype:M,Ou=Ye?Au.valueOf:M,Eu=Ye?Au.toString:M,ku={};bn.templateSettings={escape:J,evaluate:Y,interpolate:H,variable:"",imports:{_:bn}};var Iu=function(){function n(){}return function(t){if(re(t)){n.prototype=t;var r=new n;n.prototype=M}return r||{}}}(),Ru=Kt(et),Su=Kt(ut,!0),Wu=Gt(),Cu=Gt(!0);nu&&!uu.call({valueOf:1},"valueOf")&&(_t=function(n){return U(nu(n))});var Uu=ju?function(n,t){return ju.set(n,t),n}:Re,zu=yu&&2===new yu([1,2]).size?function(n){return new yu(n)}:Ue,Bu=ju?function(n){return ju.get(n)}:Ue,Lu=mt("length"),$u=ru||function(){return[]};(du&&"[object Map]"!=pr(new du)||yu&&"[object Set]"!=pr(new yu))&&(pr=function(n){var t=Ge.call(n);if(n="function"==typeof(n="[object Object]"==t?n.constructor:null)?qe.call(n):""){if(n==mu)return"[object Map]";if(n==wu)return"[object Set]"}return t});var Fu=function(){var n=0,t=0;return function(r,e){var u=lo(),o=16-(u-t);if(t=u,o>0){if(150<=++n)return r}else n=0;return Uu(r,e)}}(),Mu=Kr((function(n,t){t=rt(t);for(var r=xo(n)?n:[Object(n)],e=t,u=-1,o=r.length,i=-1,f=e.length,c=Array(o+f);++u<o;)c[u]=r[u];for(;++i<f;)c[u++]=e[i];return c})),Nu=Kr((function(n,t){return Hr(n)?Xn(n,rt(t,!1,!0)):[]})),Zu=Kr((function(n,t){var r=Wr(t);return Hr(r)&&(r=M),Hr(n)?Xn(n,rt(t,!1,!0),lr(r)):[]})),Du=Kr((function(n,t){var r=Wr(t);return Hr(r)&&(r=M),Hr(n)?Xn(n,rt(t,!1,!0),M,r):[]})),qu=Kr((function(n){var t=c(n,Or);return t.length&&t[0]===n[0]?at(t):[]})),Pu=Kr((function(n){var t=Wr(n),r=c(n,Or);return t===Wr(r)?t=M:r.pop(),r.length&&r[0]===n[0]?at(r,lr(t)):[]})),Tu=Kr((function(n){var t=Wr(n),r=c(n,Or);return t===Wr(r)?t=M:r.pop(),r.length&&r[0]===n[0]?at(r,M,t):[]})),Ku=Kr(Cr),Gu=Kr((function(n,t){var r=Jn(n,t=c(rt(t),String));return At(n,t.sort(E)),r})),Vu=Kr((function(n){return Ut(rt(n,!1,!0))})),Ju=Kr((function(n){var t=Wr(n);return Hr(t)&&(t=M),Ut(rt(n,!1,!0),lr(t))})),Yu=Kr((function(n){var t=Wr(n);return Hr(t)&&(t=M),Ut(rt(n,!1,!0),M,t)})),Hu=Kr((function(n,t){return Hr(n)?Xn(n,t):[]})),Qu=Kr((function(n){return Lt(o(n,Hr))})),Xu=Kr((function(n){var t=Wr(n);return Hr(t)&&(t=M),Lt(o(n,Hr),lr(t))})),no=Kr((function(n){var t=Wr(n);return Hr(t)&&(t=M),Lt(o(n,Hr),M,t)})),to=Kr(zr),ro=Kr((function(n){var t="function"==typeof(t=(t=n.length)>1?n[t-1]:M)?(n.pop(),t):M;return Br(n,t)})),eo=Kr((function(n){function t(t){return Jn(t,n)}var r=(n=rt(n)).length,e=r?n[0]:0,u=this.__wrapped__;return 1>=r&&!this.__actions__.length&&u instanceof Wn&&C(e)?((u=u.slice(e,+e+(r?1:0))).__actions__.push({func:$r,args:[t],thisArg:M}),new Sn(u,this.__chain__).thru((function(n){return r&&!n.length&&n.push(M),n}))):this.thru(t)})),uo=Pt((function(n,t,r){Pe.call(n,r)?++n[r]:n[r]=1})),oo=Pt((function(n,t,r){Pe.call(n,r)?n[r].push(t):n[r]=[t]})),io=Kr((function(n,t,e){var u=-1,o="function"==typeof t,i=yr(t),f=Yr(n)?Array(n.length):[];return Ru(n,(function(n){var c=o?t:i&&null!=n?n[t]:M;f[++u]=c?r(c,n,e):lt(n,t,e)})),f})),fo=Pt((function(n,t,r){n[r]=t})),co=Pt((function(n,t,r){n[r?0:1].push(t)}),(function(){return[[],[]]})),ao=Kr((function(n,t){if(null==n)return[];var r=t.length;return r>1&&dr(n,t[0],t[1])?t=[]:r>2&&dr(t[0],t[1],t[2])&&(t.length=1),bt(n,rt(t),[])})),lo=Le.now,so=Kr((function(n,t,r){var e=1;if(r.length){var u=B(r,so.placeholder);e=32|e}return ir(n,e,t,r,u)})),ho=Kr((function(n,t,r){var e=3;if(r.length){var u=B(r,ho.placeholder);e=32|e}return ir(t,e,n,r,u)})),po=Kr((function(n,t){return Qn(n,1,t)})),_o=Kr((function(n,t,r){return Qn(n,ve(t)||0,r)})),vo=Kr((function(n,t){var e=(t=c(rt(t),lr())).length;return Kr((function(u){for(var o=-1,i=pu(u.length,e);++o<i;)u[o]=t[o].call(this,u[o]);return r(n,this,u)}))})),go=Kr((function(n,t){var r=B(t,go.placeholder);return ir(n,32,M,t,r)})),yo=Kr((function(n,t){var r=B(t,yo.placeholder);return ir(n,64,M,t,r)})),bo=Kr((function(n,t){return ir(n,256,M,M,M,rt(t))})),xo=Array.isArray,jo=Tt((function(n,t){Zt(t,je(t),n)})),mo=Tt((function(n,t){Zt(t,me(t),n)})),wo=Tt((function(n,t,r){Dt(t,me(t),n,r)})),Ao=Tt((function(n,t,r){Dt(t,je(t),n,r)})),Oo=Kr((function(n,t){return Jn(n,rt(t))})),Eo=Kr((function(n){return n.push(M,Tn),r(wo,M,n)})),ko=Kr((function(n){return n.push(M,mr),r(So,M,n)})),Io=Kr(lt),Ro=Tt((function(n,t){yt(n,t)})),So=Tt((function(n,t,r){yt(n,t,r)})),Wo=Kr((function(n,t){return null==n?{}:(t=c(rt(t),String),xt(n,Xn(me(n),t)))})),Co=Kr((function(n,t){return null==n?{}:xt(n,rt(t))})),Uo=Jt((function(n,t,r){return t=t.toLowerCase(),n+(r?Oe(t):t)})),zo=Jt((function(n,t,r){return n+(r?"-":"")+t.toLowerCase()})),Bo=Jt((function(n,t,r){return n+(r?" ":"")+t.toLowerCase()})),Lo=Vt("toLowerCase"),$o=Vt("toUpperCase"),Fo=Jt((function(n,t,r){return n+(r?"_":"")+t.toLowerCase()})),Mo=Jt((function(n,t,r){return n+(r?" ":"")+Oe(t)})),No=Jt((function(n,t,r){return n+(r?" ":"")+t.toUpperCase()})),Zo=Kr((function(n,t){try{return r(n,M,t)}catch(n){return Qr(n)?n:new $e(n)}})),Do=Kr((function(n,t){return e(rt(t),(function(t){n[t]=so(n[t],n)})),n})),qo=Qt(),Po=Qt(!0),To=Kr((function(n,t){return function(r){return lt(r,n,t)}})),Ko=Kr((function(n,t){return function(r){return lt(n,r,t)}})),Go=nr(c),Vo=nr(u),Jo=nr(h),Yo=er(),Ho=er(!0),Qo=or("ceil"),Xo=or("floor"),ni=or("round");return bn.prototype=xn.prototype,Sn.prototype=Iu(xn.prototype),Sn.prototype.constructor=Sn,Wn.prototype=Iu(xn.prototype),Wn.prototype.constructor=Wn,Cn.prototype=xu?xu(null):De,Un.prototype.clear=function(){this.__data__={hash:new Cn,map:du?new du:[],string:new Cn}},Un.prototype.delete=function(n){var t=this.__data__;return br(n)?(t="string"==typeof n?t.string:t.hash,n=(xu?t[n]!==M:Pe.call(t,n))&&delete t[n]):n=du?t.map.delete(n):Mn(t.map,n),n},Un.prototype.get=function(n){var t=this.__data__;return br(n)?(t="string"==typeof n?t.string:t.hash,xu?n="__lodash_hash_undefined__"===(n=t[n])?M:n:n=Pe.call(t,n)?t[n]:M):n=du?t.map.get(n):Nn(t.map,n),n},Un.prototype.has=function(n){var t=this.__data__;return br(n)?(t="string"==typeof n?t.string:t.hash,n=xu?t[n]!==M:Pe.call(t,n)):n=du?t.map.has(n):-1<Zn(t.map,n),n},Un.prototype.set=function(n,t){var r=this.__data__;return br(n)?("string"==typeof n?r.string:r.hash)[n]=xu&&t===M?"__lodash_hash_undefined__":t:du?r.map.set(n,t):Dn(r.map,n,t),this},zn.prototype.push=function(n){var t=this.__data__;br(n)?(t=t.__data__,("string"==typeof n?t.string:t.hash)[n]="__lodash_hash_undefined__"):t.set(n,"__lodash_hash_undefined__")},Fn.prototype.clear=function(){this.__data__={array:[],map:null}},Fn.prototype.delete=function(n){var t=this.__data__,r=t.array;return r?Mn(r,n):t.map.delete(n)},Fn.prototype.get=function(n){var t=this.__data__,r=t.array;return r?Nn(r,n):t.map.get(n)},Fn.prototype.has=function(n){var t=this.__data__,r=t.array;return r?-1<Zn(r,n):t.map.has(n)},Fn.prototype.set=function(n,t){var r=this.__data__,e=r.array;return e&&(199>e.length?Dn(e,n,t):(r.array=null,r.map=new Un(e))),(r=r.map)&&r.set(n,t),this},Tr.Cache=Un,bn.after=function(n,t){if("function"!=typeof t)throw new Ne("Expected a function");return n=pe(n),function(){return 1>--n?t.apply(this,arguments):void 0}},bn.ary=Dr,bn.assign=jo,bn.assignIn=mo,bn.assignInWith=wo,bn.assignWith=Ao,bn.at=Oo,bn.before=qr,bn.bind=so,bn.bindAll=Do,bn.bindKey=ho,bn.chain=Lr,bn.chunk=function(n,t){t=hu(pe(t),0);var r=n?n.length:0;if(!r||1>t)return[];for(var e=0,u=-1,o=Array(fu(r/t));r>e;)o[++u]=kt(n,e,e+=t);return o},bn.compact=function(n){for(var t=-1,r=n?n.length:0,e=-1,u=[];++t<r;){var o=n[t];o&&(u[++e]=o)}return u},bn.concat=Mu,bn.cond=function(n){var t=n?n.length:0,e=lr();return n=t?c(n,(function(n){if("function"!=typeof n[1])throw new Ne("Expected a function");return[e(n[0]),n[1]]})):[],Kr((function(e){for(var u=-1;++u<t;){var o=n[u];if(r(o[0],this,e))return r(o[1],this,e)}}))},bn.conforms=function(n){return function(n){var t=je(n),r=t.length;return function(e){if(null==e)return!r;for(var u=r;u--;){var o=t[u],i=n[o],f=e[o];if(f===M&&!(o in Object(e))||!i(f))return!1}return!0}}(Hn(n,!0))},bn.constant=function(n){return function(){return n}},bn.countBy=uo,bn.create=function(n,t){var r=Iu(n);return t?Vn(r,t):r},bn.curry=function n(t,r,e){return(t=ir(t,8,M,M,M,M,M,r=e?M:r)).placeholder=n.placeholder,t},bn.curryRight=function n(t,r,e){return(t=ir(t,16,M,M,M,M,M,r=e?M:r)).placeholder=n.placeholder,t},bn.debounce=Pr,bn.defaults=Eo,bn.defaultsDeep=ko,bn.defer=po,bn.delay=_o,bn.difference=Nu,bn.differenceBy=Zu,bn.differenceWith=Du,bn.drop=Ir,bn.dropRight=Rr,bn.dropRightWhile=function(n,t){return n&&n.length?zt(n,lr(t,3),!0,!0):[]},bn.dropWhile=function(n,t){return n&&n.length?zt(n,lr(t,3),!0):[]},bn.fill=function(n,t,r,e){var u=n?n.length:0;if(!u)return[];for(r&&"number"!=typeof r&&dr(n,t,r)&&(r=0,e=u),u=n.length,0>(r=pe(r))&&(r=-r>u?0:u+r),0>(e=e===M||e>u?u:pe(e))&&(e+=u),e=r>e?0:_e(e);e>r;)n[r++]=t;return n},bn.filter=function(n,t){return(xo(n)?o:tt)(n,lr(t,3))},bn.flatMap=function(n,t){return n&&n.length?rt(c(n,lr(t,3))):[]},bn.flatten=function(n){return n&&n.length?rt(n):[]},bn.flattenDeep=function(n){return n&&n.length?rt(n,!0):[]},bn.flip=function(n){return ir(n,512)},bn.flow=qo,bn.flowRight=Po,bn.fromPairs=function(n){for(var t=-1,r=n?n.length:0,e={};++t<r;){var u=n[t];Et(e,u[0],u[1])}return e},bn.functions=function(n){return null==n?[]:ot(n,je(n))},bn.functionsIn=function(n){return null==n?[]:ot(n,me(n))},bn.groupBy=oo,bn.initial=function(n){return Rr(n,1)},bn.intersection=qu,bn.intersectionBy=Pu,bn.intersectionWith=Tu,bn.invert=function(n,t,r){return l(je(n),(function(e,u){var o=n[u];return t&&!r?Pe.call(e,o)?e[o].push(u):e[o]=[u]:e[o]=u,e}),{})},bn.invokeMap=io,bn.iteratee=Se,bn.keyBy=fo,bn.keys=je,bn.keysIn=me,bn.map=function(n,t){return(xo(n)?c:vt)(n,lr(t,3))},bn.mapKeys=function(n,t){var r={};return t=lr(t,3),et(n,(function(n,e,u){r[t(n,e,u)]=n})),r},bn.mapValues=function(n,t){var r={};return t=lr(t,3),et(n,(function(n,e,u){r[e]=t(n,e,u)})),r},bn.matches=We,bn.matchesProperty=function(n,t){return dt(n,Hn(t,!0))},bn.memoize=Tr,bn.merge=Ro,bn.mergeWith=So,bn.method=To,bn.methodOf=Ko,bn.mixin=Ce,bn.negate=function(n){if("function"!=typeof n)throw new Ne("Expected a function");return function(){return!n.apply(this,arguments)}},bn.nthArg=function(n){return n=pe(n),function(){return arguments[n]}},bn.omit=Wo,bn.omitBy=function(n,t){return t=lr(t),jt(n,(function(n){return!t(n)}))},bn.once=function(n){return qr(2,n)},bn.orderBy=function(n,t,r,e){return null==n?[]:(xo(t)||(t=null==t?[]:[t]),xo(r=e?M:r)||(r=null==r?[]:[r]),bt(n,t,r))},bn.over=Go,bn.overArgs=vo,bn.overEvery=Vo,bn.overSome=Jo,bn.partial=go,bn.partialRight=yo,bn.partition=co,bn.pick=Co,bn.pickBy=function(n,t){return null==n?{}:jt(n,lr(t))},bn.property=ze,bn.propertyOf=function(n){return function(t){return null==n?M:it(n,t)}},bn.pull=Ku,bn.pullAll=Cr,bn.pullAllBy=function(n,t,r){return n&&n.length&&t&&t.length?wt(n,t,lr(r)):n},bn.pullAt=Gu,bn.range=Yo,bn.rangeRight=Ho,bn.rearg=bo,bn.reject=function(n,t){var r=xo(n)?o:tt;return t=lr(t,3),r(n,(function(n,r,e){return!t(n,r,e)}))},bn.remove=function(n,t){var r=[];if(!n||!n.length)return r;var e=-1,u=[],o=n.length;for(t=lr(t,3);++e<o;){var i=n[e];t(i,e,n)&&(r.push(i),u.push(e))}return At(n,u),r},bn.rest=Kr,bn.reverse=Ur,bn.sampleSize=Nr,bn.set=function(n,t,r){return null==n?n:Et(n,t,r)},bn.setWith=function(n,t,r,e){return e="function"==typeof e?e:M,null==n?n:Et(n,t,r,e)},bn.shuffle=function(n){return Nr(n,4294967295)},bn.slice=function(n,t,r){var e=n?n.length:0;return e?(r&&"number"!=typeof r&&dr(n,t,r)?(t=0,r=e):(t=null==t?0:pe(t),r=r===M?e:pe(r)),kt(n,t,r)):[]},bn.sortBy=ao,bn.sortedUniq=function(n){return n&&n.length?Wt(n):[]},bn.sortedUniqBy=function(n,t){return n&&n.length?Wt(n,lr(t)):[]},bn.split=function(n,t,r){return de(n).split(t,r)},bn.spread=function(n){if("function"!=typeof n)throw new Ne("Expected a function");return function(t){return r(n,this,t)}},bn.tail=function(n){return Ir(n,1)},bn.take=function(n,t,r){return n&&n.length?kt(n,0,0>(t=r||t===M?1:pe(t))?0:t):[]},bn.takeRight=function(n,t,r){var e=n?n.length:0;return e?kt(n,0>(t=e-(t=r||t===M?1:pe(t)))?0:t,e):[]},bn.takeRightWhile=function(n,t){return n&&n.length?zt(n,lr(t,3),!1,!0):[]},bn.takeWhile=function(n,t){return n&&n.length?zt(n,lr(t,3)):[]},bn.tap=function(n,t){return t(n),n},bn.throttle=function(n,t,r){var e=!0,u=!0;if("function"!=typeof n)throw new Ne("Expected a function");return re(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),Pr(n,t,{leading:e,maxWait:t,trailing:u})},bn.thru=$r,bn.toArray=he,bn.toPairs=we,bn.toPairsIn=function(n){return x(n,me(n))},bn.toPath=function(n){return xo(n)?c(n,String):Ar(n)},bn.toPlainObject=ge,bn.transform=function(n,t,r){var u=xo(n)||le(n);if(t=lr(t,4),null==r)if(u||re(n)){var o=n.constructor;r=u?xo(n)?new o:[]:Iu(Xr(o)?o.prototype:M)}else r={};return(u?e:et)(n,(function(n,e,u){return t(r,n,e,u)})),r},bn.unary=function(n){return Dr(n,1)},bn.union=Vu,bn.unionBy=Ju,bn.unionWith=Yu,bn.uniq=function(n){return n&&n.length?Ut(n):[]},bn.uniqBy=function(n,t){return n&&n.length?Ut(n,lr(t)):[]},bn.uniqWith=function(n,t){return n&&n.length?Ut(n,M,t):[]},bn.unset=function(n,t){var r,e;null==n?r=!0:(r=wr(r=n,e=yr(e=t,r)?[e+""]:Ct(e)),e=Wr(e),r=null==r||!be(r,e)||delete r[e]);return r},bn.unzip=zr,bn.unzipWith=Br,bn.values=Ae,bn.valuesIn=function(n){return null==n?m(n,me(n)):[]},bn.without=Hu,bn.words=Ie,bn.wrap=function(n,t){return go(t=null==t?Re:t,n)},bn.xor=Qu,bn.xorBy=Xu,bn.xorWith=no,bn.zip=to,bn.zipObject=function(n,t){for(var r=-1,e=n?n.length:0,u=t?t.length:0,o={};++r<e;)Et(o,n[r],u>r?t[r]:M);return o},bn.zipWith=ro,bn.each=Fr,bn.eachRight=Mr,bn.extend=mo,bn.extendWith=wo,Ce(bn,bn),bn.add=function(n,t){var r;return n!==M&&(r=n),t!==M&&(r=r===M?t:r+t),r},bn.attempt=Zo,bn.camelCase=Uo,bn.capitalize=Oe,bn.ceil=Qo,bn.clamp=function(n,t,r){return r===M&&(r=t,t=M),r!==M&&(r=(r=ve(r))==r?r:0),t!==M&&(t=(t=ve(t))==t?t:0),Yn(ve(n),t,r)},bn.clone=function(n){return Hn(n)},bn.cloneDeep=function(n){return Hn(n,!0)},bn.cloneDeepWith=function(n,t){return Hn(n,!0,t)},bn.cloneWith=function(n,t){return Hn(n,!1,t)},bn.deburr=Ee,bn.endsWith=function(n,t,r){t="string"==typeof t?t:t+"";var e=(n=de(n)).length;return r=r===M?e:Yn(pe(r),0,e),(r-=t.length)>=0&&n.indexOf(t,r)==r},bn.eq=Gr,bn.escape=function(n){return(n=de(n))&&V.test(n)?n.replace(K,I):n},bn.escapeRegExp=function(n){return(n=de(n))&&rn.test(n)?n.replace(tn,"\\$&"):n},bn.every=function(n,t,r){var e=xo(n)?u:nt;return r&&dr(n,t,r)&&(t=M),e(n,lr(t,3))},bn.find=function(n,t){if(t=lr(t,3),xo(n)){var r=v(n,t);return r>-1?n[r]:M}return _(n,t,Ru)},bn.findIndex=function(n,t){return n&&n.length?v(n,lr(t,3)):-1},bn.findKey=function(n,t){return _(n,lr(t,3),et,!0)},bn.findLast=function(n,t){if(t=lr(t,3),xo(n)){var r=v(n,t,!0);return r>-1?n[r]:M}return _(n,t,Su)},bn.findLastIndex=function(n,t){return n&&n.length?v(n,lr(t,3),!0):-1},bn.findLastKey=function(n,t){return _(n,lr(t,3),ut,!0)},bn.floor=Xo,bn.forEach=Fr,bn.forEachRight=Mr,bn.forIn=function(n,t){return null==n?n:Wu(n,Er(t),me)},bn.forInRight=function(n,t){return null==n?n:Cu(n,Er(t),me)},bn.forOwn=function(n,t){return n&&et(n,Er(t))},bn.forOwnRight=function(n,t){return n&&ut(n,Er(t))},bn.get=ye,bn.gt=Vr,bn.gte=function(n,t){return n>=t},bn.has=be,bn.hasIn=xe,bn.head=Sr,bn.identity=Re,bn.includes=function(n,t,r,e){return n=Yr(n)?n:Ae(n),r=r&&!e?pe(r):0,e=n.length,0>r&&(r=hu(e+r,0)),ce(n)?e>=r&&-1<n.indexOf(t,r):!!e&&-1<g(n,t,r)},bn.indexOf=function(n,t,r){var e=n?n.length:0;return e?(0>(r=pe(r))&&(r=hu(e+r,0)),g(n,t,r)):-1},bn.inRange=function(n,t,r){return t=ve(t)||0,r===M?(r=t,t=0):r=ve(r)||0,(n=ve(n))>=pu(t,r)&&n<hu(t,r)},bn.invoke=Io,bn.isArguments=Jr,bn.isArray=xo,bn.isArrayLike=Yr,bn.isArrayLikeObject=Hr,bn.isBoolean=function(n){return!0===n||!1===n||ee(n)&&"[object Boolean]"==Ge.call(n)},bn.isDate=function(n){return ee(n)&&"[object Date]"==Ge.call(n)},bn.isElement=function(n){return!!n&&1===n.nodeType&&ee(n)&&!ie(n)},bn.isEmpty=function(n){return!ee(n)||Xr(n.splice)?!Zr(n):!je(n).length},bn.isEqual=function(n,t){return st(n,t)},bn.isEqualWith=function(n,t,r){var e=(r="function"==typeof r?r:M)?r(n,t):M;return e===M?st(n,t,r):!!e},bn.isError=Qr,bn.isFinite=function(n){return"number"==typeof n&&au(n)},bn.isFunction=Xr,bn.isInteger=ne,bn.isLength=te,bn.isMatch=function(n,t){return n===t||ht(n,t,sr(t))},bn.isMatchWith=function(n,t,r){return r="function"==typeof r?r:M,ht(n,t,sr(t),r)},bn.isNaN=function(n){return oe(n)&&n!=+n},bn.isNative=ue,bn.isNil=function(n){return null==n},bn.isNull=function(n){return null===n},bn.isNumber=oe,bn.isObject=re,bn.isObjectLike=ee,bn.isPlainObject=ie,bn.isRegExp=fe,bn.isSafeInteger=function(n){return ne(n)&&n>=-9007199254740991&&9007199254740991>=n},bn.isString=ce,bn.isSymbol=ae,bn.isTypedArray=le,bn.isUndefined=function(n){return n===M},bn.join=function(n,t){return n?lu.call(n,t):""},bn.kebabCase=zo,bn.last=Wr,bn.lastIndexOf=function(n,t,r){var e=n?n.length:0;if(!e)return-1;var u=e;if(r!==M&&(u=(0>(u=pe(r))?hu(e+u,0):pu(u,e-1))+1),t!=t)return S(n,u,!0);for(;u--;)if(n[u]===t)return u;return-1},bn.lowerCase=Bo,bn.lowerFirst=Lo,bn.lt=se,bn.lte=function(n,t){return t>=n},bn.max=function(n){return n&&n.length?p(n,Re,Vr):M},bn.maxBy=function(n,t){return n&&n.length?p(n,lr(t),Vr):M},bn.mean=function(n){return Be(n)/(n?n.length:0)},bn.min=function(n){return n&&n.length?p(n,Re,se):M},bn.minBy=function(n,t){return n&&n.length?p(n,lr(t),se):M},bn.noConflict=function(){return qn._=Ve,this},bn.noop=Ue,bn.now=lo,bn.pad=function(n,t,r){n=de(n),t=pe(t);var e=$(n);return t&&t>e?(t=cu(e=(t-e)/2),e=fu(e),tr("",t,r)+n+tr("",e,r)):n},bn.padEnd=function(n,t,r){return(n=de(n))+tr(n,t,r)},bn.padStart=function(n,t,r){return tr(n=de(n),t,r)+n},bn.parseInt=function(n,t,r){return r||null==t?t=0:t&&(t=+t),n=de(n).replace(en,""),_u(n,t||(ln.test(n)?16:10))},bn.random=function(n,t,r){if(r&&"boolean"!=typeof r&&dr(n,t,r)&&(t=r=M),r===M&&("boolean"==typeof t?(r=t,t=M):"boolean"==typeof n&&(r=n,n=M)),n===M&&t===M?(n=0,t=1):(n=ve(n)||0,t===M?(t=n,n=0):t=ve(t)||0),n>t){var e=n;n=t,t=e}return r||n%1||t%1?(r=vu(),pu(n+r*(t-n+Bn("1e-"+((r+"").length-1))),t)):Ot(n,t)},bn.reduce=function(n,t,r){var e=xo(n)?l:d,u=3>arguments.length;return e(n,lr(t,4),r,u,Ru)},bn.reduceRight=function(n,t,r){var e=xo(n)?s:d,u=3>arguments.length;return e(n,lr(t,4),r,u,Su)},bn.repeat=ke,bn.replace=function(){var n=arguments,t=de(n[0]);return 3>n.length?t:t.replace(n[1],n[2])},bn.result=function(n,t,r){if(yr(t,n))e=null==n?M:n[t];else{var e=ye(n,t=Ct(t));n=wr(n,t)}return e===M&&(e=r),Xr(e)?e.call(n):e},bn.round=ni,bn.runInContext=O,bn.sample=function(n){var t=(n=Yr(n)?n:Ae(n)).length;return t>0?n[Ot(0,t-1)]:M},bn.size=Zr,bn.snakeCase=Fo,bn.some=function(n,t,r){var e=xo(n)?h:It;return r&&dr(n,t,r)&&(t=M),e(n,lr(t,3))},bn.sortedIndex=function(n,t){return Rt(n,t)},bn.sortedIndexBy=function(n,t,r){return St(n,t,lr(r))},bn.sortedIndexOf=function(n,t){var r=n?n.length:0;if(r){var e=Rt(n,t);if(r>e&&Gr(n[e],t))return e}return-1},bn.sortedLastIndex=function(n,t){return Rt(n,t,!0)},bn.sortedLastIndexBy=function(n,t,r){return St(n,t,lr(r),!0)},bn.sortedLastIndexOf=function(n,t){if(n&&n.length){var r=Rt(n,t,!0)-1;if(Gr(n[r],t))return r}return-1},bn.startCase=Mo,bn.startsWith=function(n,t,r){return n=de(n),r=Yn(pe(r),0,n.length),n.lastIndexOf(t,r)==r},bn.subtract=function(n,t){var r;return n!==M&&(r=n),t!==M&&(r=r===M?t:r-t),r},bn.sum=Be,bn.sumBy=function(n,t){return n&&n.length?y(n,lr(t)):M},bn.template=function(n,t,r){var e=bn.templateSettings;r&&dr(n,t,r)&&(t=M),n=de(n),t=wo({},t,e,Tn);var u,o,i=je(r=wo({},t.imports,e.imports,Tn)),f=m(r,i),c=0;r=t.interpolate||dn;var a="__p+='";r=Me((t.escape||dn).source+"|"+r.source+"|"+(r===H?cn:dn).source+"|"+(t.evaluate||dn).source+"|$","g");var l="sourceURL"in t?"//# sourceURL="+t.sourceURL+"\n":"";if(n.replace(r,(function(t,r,e,i,f,l){return e||(e=i),a+=n.slice(c,l).replace(yn,R),r&&(u=!0,a+="'+__e("+r+")+'"),f&&(o=!0,a+="';"+f+";\n__p+='"),e&&(a+="'+((__t=("+e+"))==null?'':__t)+'"),c=l+t.length,t})),a+="';",(t=t.variable)||(a="with(obj){"+a+"}"),a=(o?a.replace(D,""):a).replace(q,"$1").replace(P,"$1;"),a="function("+(t||"obj")+"){"+(t?"":"obj||(obj={});")+"var __t,__p=''"+(u?",__e=_.escape":"")+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+a+"return __p}",(t=Zo((function(){return Function(i,l+"return "+a).apply(M,f)}))).source=a,Qr(t))throw t;return t},bn.times=function(n,t){if(1>(n=pe(n))||n>9007199254740991)return[];var r=4294967295,e=pu(n,4294967295);for(n-=4294967295,e=b(e,t=Er(t));++r<n;)t(r);return e},bn.toInteger=pe,bn.toLength=_e,bn.toLower=function(n){return de(n).toLowerCase()},bn.toNumber=ve,bn.toSafeInteger=function(n){return Yn(pe(n),-9007199254740991,9007199254740991)},bn.toString=de,bn.toUpper=function(n){return de(n).toUpperCase()},bn.trim=function(n,t,r){return(n=de(n))?r||t===M?n.replace(en,""):(t+="")?(n=n.match(mn),t=t.match(mn),n.slice(w(n,t),A(n,t)+1).join("")):n:n},bn.trimEnd=function(n,t,r){return(n=de(n))?r||t===M?n.replace(on,""):(t+="")?(n=n.match(mn)).slice(0,A(n,t.match(mn))+1).join(""):n:n},bn.trimStart=function(n,t,r){return(n=de(n))?r||t===M?n.replace(un,""):(t+="")?(n=n.match(mn)).slice(w(n,t.match(mn))).join(""):n:n},bn.truncate=function(n,t){var r=30,e="...";if(re(t)){var u="separator"in t?t.separator:u;r="length"in t?pe(t.length):r,e="omission"in t?de(t.omission):e}var o=(n=de(n)).length;if(wn.test(n)){var i=n.match(mn);o=i.length}if(r>=o)return n;if(1>(o=r-$(e)))return e;if(r=i?i.slice(0,o).join(""):n.slice(0,o),u===M)return r+e;if(i&&(o+=r.length-o),fe(u)){if(n.slice(o).search(u)){var f=r;for(u.global||(u=Me(u.source,de(an.exec(u))+"g")),u.lastIndex=0;i=u.exec(f);)var c=i.index;r=r.slice(0,c===M?o:c)}}else n.indexOf(u,o)!=o&&((u=r.lastIndexOf(u))>-1&&(r=r.slice(0,u)));return r+e},bn.unescape=function(n){return(n=de(n))&&G.test(n)?n.replace(T,F):n},bn.uniqueId=function(n){var t=++Te;return de(n)+t},bn.upperCase=No,bn.upperFirst=$o,bn.first=Sr,Ce(bn,function(){var n={};return et(bn,(function(t,r){Pe.call(bn.prototype,r)||(n[r]=t)})),n}(),{chain:!1}),bn.VERSION="4.0.0",e("bind bindKey curry curryRight partial partialRight".split(" "),(function(n){bn[n].placeholder=bn})),e(["drop","take"],(function(n,t){Wn.prototype[n]=function(r){var e=this.__filtered__;if(e&&!t)return new Wn(this);r=r===M?1:hu(pe(r),0);var u=this.clone();return e?u.__takeCount__=pu(r,u.__takeCount__):u.__views__.push({size:pu(r,4294967295),type:n+(0>u.__dir__?"Right":"")}),u},Wn.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()}})),e(["filter","map","takeWhile"],(function(n,t){var r=t+1,e=1==r||3==r;Wn.prototype[n]=function(n){var t=this.clone();return t.__iteratees__.push({iteratee:lr(n,3),type:r}),t.__filtered__=t.__filtered__||e,t}})),e(["head","last"],(function(n,t){var r="take"+(t?"Right":"");Wn.prototype[n]=function(){return this[r](1).value()[0]}})),e(["initial","tail"],(function(n,t){var r="drop"+(t?"":"Right");Wn.prototype[n]=function(){return this.__filtered__?new Wn(this):this[r](1)}})),Wn.prototype.compact=function(){return this.filter(Re)},Wn.prototype.find=function(n){return this.filter(n).head()},Wn.prototype.findLast=function(n){return this.reverse().find(n)},Wn.prototype.invokeMap=Kr((function(n,t){return"function"==typeof n?new Wn(this):this.map((function(r){return lt(r,n,t)}))})),Wn.prototype.reject=function(n){return n=lr(n,3),this.filter((function(t){return!n(t)}))},Wn.prototype.slice=function(n,t){n=pe(n);var r=this;return r.__filtered__&&(n>0||0>t)?new Wn(r):(0>n?r=r.takeRight(-n):n&&(r=r.drop(n)),t!==M&&(r=0>(t=pe(t))?r.dropRight(-t):r.take(t-n)),r)},Wn.prototype.takeRightWhile=function(n){return this.reverse().takeWhile(n).reverse()},Wn.prototype.toArray=function(){return this.take(4294967295)},et(Wn.prototype,(function(n,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),e=/^(?:head|last)$/.test(t),u=bn[e?"take"+("last"==t?"Right":""):t],o=e||/^find/.test(t);u&&(bn.prototype[t]=function(){function t(n){return n=u.apply(bn,a([n],f)),e&&h?n[0]:n}var i=this.__wrapped__,f=e?[1]:arguments,c=i instanceof Wn,l=f[0],s=c||xo(i);s&&r&&"function"==typeof l&&1!=l.length&&(c=s=!1);var h=this.__chain__,p=!!this.__actions__.length;l=o&&!h,c=c&&!p;return!o&&s?(i=c?i:new Wn(this),(i=n.apply(i,f)).__actions__.push({func:$r,args:[t],thisArg:M}),new Sn(i,h)):l&&c?n.apply(this,f):(i=this.thru(t),l?e?i.value()[0]:i.value():i)})})),e("pop push shift sort splice unshift".split(" "),(function(n){var t=Ze[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:pop|shift)$/.test(n);bn.prototype[n]=function(){var n=arguments;return e&&!this.__chain__?t.apply(this.value(),n):this[r]((function(r){return t.apply(r,n)}))}})),et(Wn.prototype,(function(n,t){var r=bn[t];if(r){var e=r.name+"";(ku[e]||(ku[e]=[])).push({name:t,func:r})}})),ku[Xt(M,2).name]=[{name:"wrapper",func:M}],Wn.prototype.clone=function(){var n=new Wn(this.__wrapped__);return n.__actions__=Nt(this.__actions__),n.__dir__=this.__dir__,n.__filtered__=this.__filtered__,n.__iteratees__=Nt(this.__iteratees__),n.__takeCount__=this.__takeCount__,n.__views__=Nt(this.__views__),n},Wn.prototype.reverse=function(){if(this.__filtered__){var n=new Wn(this);n.__dir__=-1,n.__filtered__=!0}else(n=this.clone()).__dir__*=-1;return n},Wn.prototype.value=function(){var n,t=this.__wrapped__.value(),r=this.__dir__,e=xo(t),u=0>r,o=e?t.length:0;n=o;for(var i=this.__views__,f=0,c=-1,a=i.length;++c<a;){var l=i[c],s=l.size;switch(l.type){case"drop":f+=s;break;case"dropRight":n-=s;break;case"take":n=pu(n,f+s);break;case"takeRight":f=hu(f,n-s)}}if(i=(n={start:f,end:n}).start,n=(f=n.end)-i,u=u?f:i-1,f=(i=this.__iteratees__).length,c=0,a=pu(n,this.__takeCount__),!e||200>o||o==n&&a==n)return Bt(t,this.__actions__);e=[];n:for(;n--&&a>c;){for(o=-1,l=t[u+=r];++o<f;){s=(h=i[o]).type;var h=(0,h.iteratee)(l);if(2==s)l=h;else if(!h){if(1==s)continue n;break n}}e[c++]=l}return e},bn.prototype.at=eo,bn.prototype.chain=function(){return Lr(this)},bn.prototype.commit=function(){return new Sn(this.value(),this.__chain__)},bn.prototype.flatMap=function(n){return this.map(n).flatten()},bn.prototype.next=function(){this.__values__===M&&(this.__values__=he(this.value()));var n=this.__index__>=this.__values__.length;return{done:n,value:n?M:this.__values__[this.__index__++]}},bn.prototype.plant=function(n){for(var t,r=this;r instanceof xn;){var e=kr(r);e.__index__=0,e.__values__=M,t?u.__wrapped__=e:t=e;var u=e;r=r.__wrapped__}return u.__wrapped__=n,t},bn.prototype.reverse=function(){var n=this.__wrapped__;return n instanceof Wn?(this.__actions__.length&&(n=new Wn(this)),(n=n.reverse()).__actions__.push({func:$r,args:[Ur],thisArg:M}),new Sn(n,this.__chain__)):this.thru(Ur)},bn.prototype.toJSON=bn.prototype.valueOf=bn.prototype.value=function(){return Bt(this.__wrapped__,this.__actions__)},eu&&(bn.prototype[eu]=function(){return this}),bn}();(Nn||Mn||{})._=Pn,"function"==typeof define&&"object"==typeof define.amd&&define.amd?define((function(){return Pn})):$n&&Fn?(Zn&&((Fn.exports=Pn)._=Pn),$n._=Pn):qn._=Pn}).call(this);
55
+ /**
56
+ * jGestures: a jQuery plugin for gesture events
57
+ * Copyright 2010, Neue Digitale / Razorfish GmbH
58
+
59
+ * Licensed under the Apache License, Version 2.0 (the "License");
60
+ * you may not use this file except in compliance with the License.
61
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
62
+ * Unless required by applicable law or agreed to in writing, software
63
+ * distributed under the License is distributed on an "AS IS" BASIS,
64
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
65
+ * See the License for the specific language governing permissions and
66
+ * limitations under the License.
67
+ *
68
+ * This is still a beta version, bugfixes and improvements appreciated.
69
+ * @copyright Neue Digitale / Razorfish GmbH
70
+ * @author martin.krause@neue-digitale.de
71
+ * @version 0.87
72
+ *
73
+ * @requires
74
+ * jQuery JavaScript Library v1.4.2 - http://jquery.com/
75
+ * Copyright 2010, John Resig
76
+ * Dual licensed under the MIT or GPL Version 2 licenses.
77
+ * http://jquery.org/license
78
+ */
15
79
  !function(e){function t(e){e.startMove=e.startMove?e.startMove:{startX:null,startY:null,timestamp:null};var t=(new Date).getTime();if(e.touches){var s=[{lastX:e.deltaX,lastY:e.deltaY,moved:null,startX:e.screenX-e.startMove.screenX,startY:e.screenY-e.startMove.screenY}],r={vector:e.vector,orientation:window.orientation||null,lastX:s[0].lastX>0?1:s[0].lastX<0?-1:0,lastY:s[0].lastY>0?1:s[0].lastY<0?-1:0,startX:s[0].startX>0?1:s[0].startX<0?-1:0,startY:s[0].startY>0?1:s[0].startY<0?-1:0};s[0].moved=Math.sqrt(Math.pow(Math.abs(s[0].startX),2)+Math.pow(Math.abs(s[0].startY),2))}return{type:e.type||null,originalEvent:e.event||null,delta:s||null,direction:r||{orientation:window.orientation||null,vector:e.vector||null},duration:e.startMove.timestamp?t-e.timestamp:null,rotation:e.rotation||null,scale:e.scale||null,description:e.description||[e.type,":",e.touches,":",0!=s[0].lastX?s[0].lastX>0?"right":"left":"steady",":",0!=s[0].lastY?s[0].lastY>0?"down":"up":"steady"].join("")}}function s(t){e(window).triggerHandler("orientationchange",{direction:{orientation:window.orientation},description:["orientationchange:",["landscape:clockwise:","portrait:default:","landscape:counterclockwise:","portrait:upsidedown:"][window.orientation/90+1],window.orientation].join("")})}function r(t){var s=jQuery(t.currentTarget);s.triggerHandler(e.jGestures.events.touchstart,t),e.hasGestures?(t.currentTarget.addEventListener("touchmove",a,!1),t.currentTarget.addEventListener("touchend",o,!1)):(s.bind("mousemove",a),s.bind("mouseup",o));var r=s.data("ojQueryGestures"),n=t.touches?t.touches[0]:t,c={};c.oLastSwipemove={screenX:n.screenX,screenY:n.screenY,timestamp:(new Date).getTime()},c.oStartTouch={screenX:n.screenX,screenY:n.screenY,timestamp:(new Date).getTime()},s.data("ojQueryGestures",e.extend(!0,r,c))}function a(s){var r=jQuery(s.currentTarget),a=r.data("ojQueryGestures"),o=!!s.touches,n=o?s.changedTouches[0].screenX:s.screenX,c=o?s.changedTouches[0].screenY:s.screenY,i=a.oLastSwipemove,u=n-i.screenX,h=c-i.screenY;if(a.oLastSwipemove){var p=t({type:"swipemove",touches:o?s.touches.length:"1",screenY:c,screenX:n,deltaY:h,deltaX:u,startMove:i,event:s,timestamp:i.timestamp});r.triggerHandler(p.type,p)}var d={},l=s.touches?s.touches[0]:s;d.oLastSwipemove={screenX:l.screenX,screenY:l.screenY,timestamp:(new Date).getTime()},r.data("ojQueryGestures",e.extend(!0,a,d))}function o(s){var r=jQuery(s.currentTarget),n=!!s.changedTouches,c=n?s.changedTouches.length:"1",i=n?s.changedTouches[0].screenX:s.screenX,u=n?s.changedTouches[0].screenY:s.screenY;r.triggerHandler(e.jGestures.events.touchendStart,s),e.hasGestures?(s.currentTarget.removeEventListener("touchmove",a,!1),s.currentTarget.removeEventListener("touchend",o,!1)):(r.unbind("mousemove",a),r.unbind("mouseup",o));var h,p=r.data("ojQueryGestures"),d=Math.abs(p.oStartTouch.screenX-i)>e.jGestures.defaults.thresholdMove||Math.abs(p.oStartTouch.screenY-u)>e.jGestures.defaults.thresholdMove,l=Math.abs(p.oStartTouch.screenX-i)>e.jGestures.defaults.thresholdSwipe||Math.abs(p.oStartTouch.screenY-u)>e.jGestures.defaults.thresholdSwipe;for(h in p){var w=p.oStartTouch,g=(i=n?s.changedTouches[0].screenX:s.screenX,u=n?s.changedTouches[0].screenY:s.screenY,i-w.screenX),v=t({type:"swipe",touches:c,screenY:u,screenX:i,deltaY:u-w.screenY,deltaX:g,startMove:w,event:s,timestamp:w.timestamp}),j=["zero","one","two","three","four"],m=!1;switch(h){case"swipeone":if(!1===n&&1==c&&!1===d)break;(!1===n||1==c&&!0===d&&!0===l)&&(m=!0,v.type=["swipe",j[c]].join(""),r.triggerHandler(v.type,v));break;case"swipetwo":n&&2==c&&!0===d&&!0===l&&(m=!0,v.type=["swipe",j[c]].join(""),r.triggerHandler(v.type,v));break;case"swipethree":n&&3==c&&!0===d&&!0===l&&(m=!0,v.type=["swipe",j[c]].join(""),r.triggerHandler(v.type,v));break;case"swipefour":n&&4==c&&!0===d&&!0===l&&(m=!0,v.type=["swipe",j[c]].join(""),r.triggerHandler(v.type,v));break;case"swipeup":case"swiperightup":case"swiperight":case"swiperightdown":case"swipedown":case"swipeleftdown":case"swipeleft":case"swipeleftup":n&&!0===d&&!0===l&&(m=!0,v.type=["swipe",0!=v.delta[0].lastX?v.delta[0].lastX>0?"right":"left":"",0!=v.delta[0].lastY?v.delta[0].lastY>0?"down":"up":""].join(""),r.triggerHandler(v.type,v));break;case"tapone":case"taptwo":case"tapthree":case"tapfour":!0!==d&&!0!==m&&j[c]==h.slice(3)&&(v.description=["tap",j[c]].join(""),v.type=["tap",j[c]].join(""),r.triggerHandler(v.type,v))}var G={};r.data("ojQueryGestures",e.extend(!0,p,G)),r.data("ojQueryGestures",e.extend(!0,p,G))}r.triggerHandler(e.jGestures.events.touchendProcessed,s)}function n(t){var s=jQuery(t.currentTarget);s.triggerHandler(e.jGestures.events.gesturestart,t);var r=s.data("ojQueryGestures"),a={};a.oStartTouch={timestamp:(new Date).getTime()},s.data("ojQueryGestures",e.extend(!0,r,a))}function c(s){var r,a,o,n,c=jQuery(s.currentTarget),i=c.data("ojQueryGestures");for(n in i)switch(n){case"pinch":((r=s.scale)<1&&r%1<1-e.jGestures.defaults.thresholdPinchclose||r>1&&r%1>e.jGestures.defaults.thresholdPinchopen)&&(a=r<1?-1:1,o=t({type:"pinch",scale:r,touches:null,startMove:i.oStartTouch,event:s,timestamp:i.oStartTouch.timestamp,vector:a,description:["pinch:",a,":",r<1?"close":"open"].join("")}),c.triggerHandler(o.type,o));break;case"rotate":((r=s.rotation)<1&&-1*r>e.jGestures.defaults.thresholdRotateccw||r>1&&r>e.jGestures.defaults.thresholdRotatecw)&&(a=r<1?-1:1,o=t({type:"rotate",rotation:r,touches:null,startMove:i.oStartTouch,event:s,timestamp:i.oStartTouch.timestamp,vector:a,description:["rotate:",a,":",r<1?"counterclockwise":"clockwise"].join("")}),c.triggerHandler(o.type,o))}}function i(s){var r,a=jQuery(s.currentTarget);a.triggerHandler(e.jGestures.events.gestureendStart,s);var o,n=a.data("ojQueryGestures");for(o in n)switch(o){case"pinchclose":(r=s.scale)<1&&r%1<1-e.jGestures.defaults.thresholdPinchclose&&a.triggerHandler("pinchclose",t({type:"pinchclose",scale:r,vector:-1,touches:null,startMove:n.oStartTouch,event:s,timestamp:n.oStartTouch.timestamp,description:"pinch:-1:close"}));break;case"pinchopen":(r=s.scale)>1&&r%1>e.jGestures.defaults.thresholdPinchopen&&a.triggerHandler("pinchopen",t({type:"pinchopen",scale:r,vector:1,touches:null,startMove:n.oStartTouch,event:s,timestamp:n.oStartTouch.timestamp,description:"pinch:+1:open"}));break;case"rotatecw":(r=s.rotation)>1&&r>e.jGestures.defaults.thresholdRotatecw&&a.triggerHandler("rotatecw",t({type:"rotatecw",rotation:r,vector:1,touches:null,startMove:n.oStartTouch,event:s,timestamp:n.oStartTouch.timestamp,description:"rotate:+1:clockwise"}));break;case"rotateccw":(r=s.rotation)<1&&-1*r>e.jGestures.defaults.thresholdRotateccw&&a.triggerHandler("rotateccw",t({type:"rotateccw",rotation:r,vector:-1,touches:null,startMove:n.oStartTouch,event:s,timestamp:n.oStartTouch.timestamp,description:"rotate:-1:counterclockwise"}))}a.triggerHandler(e.jGestures.events.gestureendProcessed,s)}e.jGestures={},e.jGestures.defaults={},e.jGestures.defaults.thresholdPinchopen=.05,e.jGestures.defaults.thresholdPinchmove=.05,e.jGestures.defaults.thresholdPinch=.05,e.jGestures.defaults.thresholdPinchclose=.05,e.jGestures.defaults.thresholdRotatecw=5,e.jGestures.defaults.thresholdRotateccw=5,e.jGestures.defaults.thresholdMove=20,e.jGestures.defaults.thresholdSwipe=100,e.jGestures.data={},e.jGestures.data.capableDevicesInUserAgentString=["iPad","iPhone","iPod","Mobile Safari"],e.jGestures.data.hasGestures=function(){var t;for(t=0;t<e.jGestures.data.capableDevicesInUserAgentString.length;t++)if(-1!==navigator.userAgent.indexOf(e.jGestures.data.capableDevicesInUserAgentString[t]))return!0;return!1}(),e.hasGestures=e.jGestures.data.hasGestures,e.jGestures.events={touchstart:"jGestures.touchstart",touchendStart:"jGestures.touchend;start",touchendProcessed:"jGestures.touchend;processed",gesturestart:"jGestures.gesturestart",gestureendStart:"jGestures.gestureend;start",gestureendProcessed:"jGestures.gestureend;processed"},jQuery.each({orientationchange_orientationchange01:"orientationchange",gestureend_pinchopen01:"pinchopen",gestureend_pinchclose01:"pinchclose",gestureend_rotatecw01:"rotatecw",gestureend_rotateccw01:"rotateccw",gesturechange_pinch01:"pinch",gesturechange_rotate01:"rotate",touchstart_swipe13:"swipemove",touchstart_swipe01:"swipeone",touchstart_swipe02:"swipetwo",touchstart_swipe03:"swipethree",touchstart_swipe04:"swipefour",touchstart_swipe05:"swipeup",touchstart_swipe06:"swiperightup",touchstart_swipe07:"swiperight",touchstart_swipe08:"swiperightdown",touchstart_swipe09:"swipedown",touchstart_swipe10:"swipeleftdown",touchstart_swipe11:"swipeleft",touchstart_swipe12:"swipeleftup",touchstart_tap01:"tapone",touchstart_tap02:"taptwo",touchstart_tap03:"tapthree",touchstart_tap04:"tapfour"},(function(t,u){jQuery.event.special[u]={setup:function(){var a=t.split("_"),o=a[0],u=a[1].slice(0,a[1].length-2),h=jQuery(this);if(!h.data("ojQueryGestures")||!h.data("ojQueryGestures")[o]){var p=h.data("ojQueryGestures")||{},d={};if(d[o]=!0,e.extend(!0,p,d),h.data("ojQueryGestures",p),e.hasGestures)switch(u){case"orientationchange":h.get(0).addEventListener("orientationchange",s,!1);break;case"tap":case"swipe":case"swipeup":case"swiperightup":case"swiperight":case"swiperightdown":case"swipedown":case"swipeleftdown":case"swipeleft":h.get(0).addEventListener("touchstart",r,!1);break;case"pinchopen":case"pinchclose":case"rotatecw":case"rotateccw":h.get(0).addEventListener("gesturestart",n,!1),h.get(0).addEventListener("gestureend",i,!1);break;case"pinch":case"rotate":h.get(0).addEventListener("gesturestart",n,!1),h.get(0).addEventListener("gesturechange",c,!1)}else switch(u){case"tap":case"swipe":h.bind("mousedown",r)}}return!1},add:function(e){return jQuery(this).data("ojQueryGestures")[e.type]={originalType:e.type},!1},remove:function(e){var t=jQuery(this),s=t.data("ojQueryGestures");return s[e.type]=!1,t.data("ojQueryGestures",s),!1},teardown:function(){var u=t.split("_"),h=u[0],p=u[1].slice(0,u[1].length-2),d=jQuery(this);if(!d.data("ojQueryGestures")||!d.data("ojQueryGestures")[h]){var l=d.data("ojQueryGestures")||{},w={};if(w[h]=!1,e.extend(!0,l,w),d.data("ojQueryGestures",l),e.hasGestures)switch(p){case"orientationchange":d.get(0).removeEventListener("orientationchange",s,!1);break;case"tap":case"swipe":case"swipeup":case"swiperightup":case"swiperight":case"swiperightdown":case"swipedown":case"swipeleftdown":case"swipeleft":case"swipeleftup":d.get(0).removeEventListener("touchstart",r,!1),d.get(0).removeEventListener("touchmove",a,!1),d.get(0).removeEventListener("touchend",o,!1);break;case"pinchopen":case"pinchclose":case"rotatecw":case"rotateccw":d.get(0).removeEventListener("gesturestart",n,!1),d.get(0).removeEventListener("gestureend",i,!1);break;case"pinch":case"rotate":d.get(0).removeEventListener("gesturestart",n,!1),d.get(0).removeEventListener("gesturechange",c,!1)}else switch(p){case"tap":case"swipe":d.unbind("mousedown",r),d.unbind("mousemove",a),d.unbind("mouseup",o)}}return!1}}}))}(jQuery);
16
80
  var Pixastic=function(){function t(t,a,e){var r=new Array;null==a&&(a=document),null==e&&(e="*");var n=a.getElementsByTagName(e),s=n.length,o=new RegExp("(^|\\s)"+t+"(\\s|$)");for(i=0,j=0;i<s;i++)o.test(n[i].className)&&(r[j]=n[i],j++);return r}function a(t,a){if(Pixastic.debug){try{switch(a){case"warn":console.warn("Pixastic:",t);break;case"error":console.error("Pixastic:",t);break;default:console.log("Pixastic:",t)}}catch(t){}1}}"undefined"!=typeof pixastic_parseonload&&pixastic_parseonload&&function(t){var a=!1,e=function(){a||(a=!0,t())};document.write('<script defer src="//:" id="__onload_ie_pixastic__"><\/script>');var i=document.getElementById("__onload_ie_pixastic__");i.onreadystatechange=function(){"complete"==i.readyState&&(i.parentNode.removeChild(i),e())},document.addEventListener&&document.addEventListener("DOMContentLoaded",e,!1),function(t,a,e){t.addEventListener?t.addEventListener(a,e,!1):t.attachEvent&&t.attachEvent("on"+a,e)}(window,"load",e)}((function(){for(var a=t("pixastic",null,"img"),e=t("pixastic",null,"canvas"),i=a.concat(e),r=0;r<i.length;r++)!function(){for(var t=i[r],a=[],e=t.className.split(" "),n=0;n<e.length;n++){var s=e[n];if("pixastic-"==s.substring(0,9)){var o=s.substring(9);""!=o&&a.push(o)}}if(a.length)if("img"==t.tagName.toLowerCase()){var c=new Image;if(c.src=t.src,c.complete)for(var h=0;h<a.length;h++){var l=Pixastic.applyAction(t,t,a[h],null);l&&(t=l)}else c.onload=function(){for(var e=0;e<a.length;e++){var i=Pixastic.applyAction(t,t,a[e],null);i&&(t=i)}}}else setTimeout((function(){for(var e=0;e<a.length;e++){var i=Pixastic.applyAction(t,t,a[e],null);i&&(t=i)}}),1)}()}));var e=function(){var t=document.createElement("canvas"),a=!1;try{a=!("function"!=typeof t.getContext||!t.getContext("2d"))}catch(t){}return function(){return a}}(),r=function(){var t,a=document.createElement("canvas"),e=!1;try{"function"==typeof a.getContext&&(t=a.getContext("2d"))&&(e="function"==typeof t.getImageData)}catch(t){}return function(){return e}}(),n=function(){var t=!1,a=document.createElement("canvas");if(e()&&r()){a.width=a.height=1;var i=a.getContext("2d");i.fillStyle="rgb(255,0,0)",i.fillRect(0,0,1,1);var n=document.createElement("canvas");n.width=n.height=1;var s=n.getContext("2d");s.fillStyle="rgb(0,0,255)",s.fillRect(0,0,1,1),i.globalAlpha=.5,i.drawImage(n,0,0);var o=i.getImageData(0,0,1,1).data;t=255!=o[2]}return function(){return t}}();return{parseOnLoad:!1,debug:!1,applyAction:function(t,e,i,r){r=r||{};var n,s,o="canvas"==t.tagName.toLowerCase();if(o&&Pixastic.Client.isIE())return Pixastic.debug&&a("Tried to process a canvas element but browser is IE."),!1;var c=!1;Pixastic.Client.hasCanvas()&&(c=!!r.resultCanvas,s=(n=r.resultCanvas||document.createElement("canvas")).getContext("2d"));var h=t.offsetWidth,l=t.offsetHeight;if(o&&(h=t.width,l=t.height),0==h||0==l){if(null!=t.parentNode)return void(Pixastic.debug&&a("Image has 0 width and/or height."));var p=t.style.position,g=t.style.left;t.style.position="absolute",t.style.left="-9999px",document.body.appendChild(t),h=t.offsetWidth,l=t.offsetHeight,document.body.removeChild(t),t.style.position=p,t.style.left=g}if(i.indexOf("(")>-1){var v=i;i=v.substr(0,v.indexOf("("));var d=v.match(/\((.*?)\)/);if(d[1]){d=d[1].split(";");for(var u=0;u<d.length;u++)if(thisArg=d[u].split("="),2==thisArg.length)if("rect"==thisArg[0]){var f=thisArg[1].split(",");r[thisArg[0]]={left:parseInt(f[0],10)||0,top:parseInt(f[1],10)||0,width:parseInt(f[2],10)||0,height:parseInt(f[3],10)||0}}else r[thisArg[0]]=thisArg[1]}}r.rect?(r.rect.left=Math.round(r.rect.left),r.rect.top=Math.round(r.rect.top),r.rect.width=Math.round(r.rect.width),r.rect.height=Math.round(r.rect.height)):r.rect={left:0,top:0,width:h,height:l};var m=!1;if(Pixastic.Actions[i]&&"function"==typeof Pixastic.Actions[i].process&&(m=!0),!m)return Pixastic.debug&&a('Invalid action "'+i+'". Maybe file not included?'),!1;if(!Pixastic.Actions[i].checkSupport())return Pixastic.debug&&a('Action "'+i+'" not supported by this browser.'),!1;Pixastic.Client.hasCanvas()?(n!==t&&(n.width=h,n.height=l),c||(n.style.width=h+"px",n.style.height=l+"px"),s.drawImage(e,0,0,h,l),t.__pixastic_org_image?(n.__pixastic_org_image=t.__pixastic_org_image,n.__pixastic_org_width=t.__pixastic_org_width,n.__pixastic_org_height=t.__pixastic_org_height):(n.__pixastic_org_image=t,n.__pixastic_org_width=h,n.__pixastic_org_height=l)):Pixastic.Client.isIE()&&void 0===t.__pixastic_org_style&&(t.__pixastic_org_style=t.style.cssText);var x={image:t,canvas:n,width:h,height:l,useData:!0,options:r};return!!Pixastic.Actions[i].process(x)&&(Pixastic.Client.hasCanvas()?(x.useData&&Pixastic.Client.hasCanvasImageData()&&(n.getContext("2d").putImageData(x.canvasData,r.rect.left,r.rect.top),n.getContext("2d").fillRect(0,0,0,0)),r.leaveDOM||(n.title=t.title,n.imgsrc=t.imgsrc,o||(n.alt=t.alt),o||(n.imgsrc=t.src),n.className=t.className,n.style.cssText=t.style.cssText,n.name=t.name,n.tabIndex=t.tabIndex,n.id=t.id,t.parentNode&&t.parentNode.replaceChild&&t.parentNode.replaceChild(n,t)),r.resultCanvas=n,n):t)},prepareData:function(t,a){var e=t.canvas.getContext("2d"),i=t.options.rect,r=e.getImageData(i.left,i.top,i.width,i.height),n=r.data;return a||(t.canvasData=r),n},process:function(t,a,e,i){if("img"==t.tagName.toLowerCase()){var r=new Image;if(r.src=t.src,r.complete){var n=Pixastic.applyAction(t,r,a,e);return i&&i(n),n}r.onload=function(){var n=Pixastic.applyAction(t,r,a,e);i&&i(n)}}if("canvas"==t.tagName.toLowerCase()){n=Pixastic.applyAction(t,t,a,e);return i&&i(n),n}},revert:function(t){if(Pixastic.Client.hasCanvas()){if("canvas"==t.tagName.toLowerCase()&&t.__pixastic_org_image)return t.width=t.__pixastic_org_width,t.height=t.__pixastic_org_height,t.getContext("2d").drawImage(t.__pixastic_org_image,0,0),t.parentNode&&t.parentNode.replaceChild&&t.parentNode.replaceChild(t.__pixastic_org_image,t),t}else Pixastic.Client.isIE()&&void 0!==t.__pixastic_org_style&&(t.style.cssText=t.__pixastic_org_style)},Client:{hasCanvas:e,hasCanvasImageData:r,hasGlobalAlpha:n,isIE:function(){return!!document.all&&!!window.attachEvent&&!window.opera}},Actions:{}}}();"undefined"!=typeof jQuery&&jQuery&&jQuery.fn&&(jQuery.fn.pixastic=function(t,a){var e=[];return this.each((function(){if("img"!=this.tagName.toLowerCase()||this.complete){var i=Pixastic.process(this,t,a);i&&e.push(i)}})),e.length>0?jQuery(e):this}),Pixastic.Actions.blend={process:function(t){var a=parseFloat(t.options.amount),e=(t.options.mode||"normal").toLowerCase(),i=t.options.image;if(a=Math.max(0,Math.min(1,a)),!i)return!1;if(Pixastic.Client.hasCanvasImageData()){var r=t.options.rect,n=Pixastic.prepareData(t),s=r.width,o=r.height;t.useData=!1;var c=document.createElement("canvas");c.width=t.canvas.width,c.height=t.canvas.height;var h=c.getContext("2d");h.drawImage(i,0,0);var l,p,g,v,d,u,f,m,x,C,w,P,I,D,M={canvas:c,options:t.options},b=Pixastic.prepareData(M),y=M.canvasData,_=4*(S=s*o),k=!1;switch(e){case"normal":break;case"multiply":for(;S--;)b[_-=4]=n[_]*b[_]/255,b[l=_+1]=n[l]*b[l]/255,b[p=_+2]=n[p]*b[p]/255;k=!0;break;case"lighten":for(;S--;)(g=n[_-=4])>b[_]&&(b[_]=g),(v=n[l=_+1])>b[l]&&(b[l]=v),(d=n[p=_+2])>b[p]&&(b[p]=d);k=!0;break;case"darken":for(;S--;)(g=n[_-=4])<b[_]&&(b[_]=g),(v=n[l=_+1])<b[l]&&(b[l]=v),(d=n[p=_+2])<b[p]&&(b[p]=d);k=!0;break;case"darkercolor":for(;S--;).3*(g=n[_-=4])+.59*(v=n[l=_+1])+.11*(d=n[p=_+2])<=.3*b[_]+.59*b[l]+.11*b[p]&&(b[_]=g,b[l]=v,b[p]=d);k=!0;break;case"lightercolor":for(;S--;).3*(g=n[_-=4])+.59*(v=n[l=_+1])+.11*(d=n[p=_+2])>.3*b[_]+.59*b[l]+.11*b[p]&&(b[_]=g,b[l]=v,b[p]=d);k=!0;break;case"lineardodge":for(;S--;)(x=n[_-=4]+b[_])>255?b[_]=255:b[_]=x,(C=n[l=_+1]+b[l])>255?b[l]=255:b[l]=C,(w=n[p=_+2]+b[p])>255?b[p]=255:b[p]=w;k=!0;break;case"linearburn":for(;S--;)(x=n[_-=4]+b[_])<255?b[_]=0:b[_]=x-255,(C=n[l=_+1]+b[l])<255?b[l]=0:b[l]=C-255,(w=n[p=_+2]+b[p])<255?b[p]=0:b[p]=w-255;k=!0;break;case"difference":for(;S--;)(x=n[_-=4]-b[_])<0?b[_]=-x:b[_]=x,(C=n[l=_+1]-b[l])<0?b[l]=-C:b[l]=C,(w=n[p=_+2]-b[p])<0?b[p]=-w:b[p]=w;k=!0;break;case"screen":for(;S--;)b[_-=4]=255-((255-b[_])*(255-n[_])>>8),b[l=_+1]=255-((255-b[l])*(255-n[l])>>8),b[p=_+2]=255-((255-b[p])*(255-n[p])>>8);k=!0;break;case"exclusion":for(var A=2/255;S--;)b[_-=4]=(g=n[_])-(g*A-1)*b[_],b[l=_+1]=(v=n[l])-(v*A-1)*b[l],b[p=_+2]=(d=n[p])-(d*A-1)*b[p];k=!0;break;case"overlay":for(A=2/255;S--;)(g=n[_-=4])<128?b[_]=b[_]*g*A:b[_]=255-(255-b[_])*(255-g)*A,(v=n[l=_+1])<128?b[l]=b[l]*v*A:b[l]=255-(255-b[l])*(255-v)*A,(d=n[p=_+2])<128?b[p]=b[p]*d*A:b[p]=255-(255-b[p])*(255-d)*A;k=!0;break;case"softlight":for(A=2/255;S--;)(g=n[_-=4])<128?b[_]=(64+(b[_]>>1))*g*A:b[_]=255-(191-(b[_]>>1))*(255-g)*A,(v=n[l=_+1])<128?b[l]=(64+(b[l]>>1))*v*A:b[l]=255-(191-(b[l]>>1))*(255-v)*A,(d=n[p=_+2])<128?b[p]=(64+(b[p]>>1))*d*A:b[p]=255-(191-(b[p]>>1))*(255-d)*A;k=!0;break;case"hardlight":for(A=2/255;S--;)(u=b[_-=4])<128?b[_]=n[_]*u*A:b[_]=255-(255-n[_])*(255-u)*A,(f=b[l=_+1])<128?b[l]=n[l]*f*A:b[l]=255-(255-n[l])*(255-f)*A,(m=b[p=_+2])<128?b[p]=n[p]*m*A:b[p]=255-(255-n[p])*(255-m)*A;k=!0;break;case"colordodge":for(;S--;)(x=(n[_-=4]<<8)/(255-(u=b[_])))>255||255==u?b[_]=255:b[_]=x,(C=(n[l=_+1]<<8)/(255-(f=b[l])))>255||255==f?b[l]=255:b[l]=C,(w=(n[p=_+2]<<8)/(255-(m=b[p])))>255||255==m?b[p]=255:b[p]=w;k=!0;break;case"colorburn":for(;S--;)(x=255-(255-n[_-=4]<<8)/b[_])<0||0==b[_]?b[_]=0:b[_]=x,(C=255-(255-n[l=_+1]<<8)/b[l])<0||0==b[l]?b[l]=0:b[l]=C,(w=255-(255-n[p=_+2]<<8)/b[p])<0||0==b[p]?b[p]=0:b[p]=w;k=!0;break;case"linearlight":for(;S--;)(x=2*(u=b[_-=4])+n[_]-256)<0||u<128&&x<0?b[_]=0:b[_]=x>255?255:x,(C=2*(f=b[l=_+1])+n[l]-256)<0||f<128&&C<0?b[l]=0:b[l]=C>255?255:C,(w=2*(m=b[p=_+2])+n[p]-256)<0||m<128&&w<0?b[p]=0:b[p]=w>255?255:w;k=!0;break;case"vividlight":for(;S--;)(u=b[_-=4])<128?u?(x=255-(255-n[_]<<8)/(2*u))<0?b[_]=0:b[_]=x:b[_]=0:(x=P=2*u-256)<255?(x=(n[_]<<8)/(255-P))>255?b[_]=255:b[_]=x:b[_]=x<0?0:x,(f=b[l=_+1])<128?f?(C=255-(255-n[l]<<8)/(2*f))<0?b[l]=0:b[l]=C:b[l]=0:(C=I=2*f-256)<255?(C=(n[l]<<8)/(255-I))>255?b[l]=255:b[l]=C:b[l]=C<0?0:C,(m=b[p=_+2])<128?m?(w=255-(255-n[p]<<8)/(2*m))<0?b[p]=0:b[p]=w:b[p]=0:(w=D=2*m-256)<255?(w=(n[p]<<8)/(255-D))>255?b[p]=255:b[p]=w:b[p]=w<0?0:w;k=!0;break;case"pinlight":for(;S--;)(u=b[_-=4])<128?(g=n[_])<(P=2*u)?b[_]=g:b[_]=P:(g=n[_])>(P=2*u-256)?b[_]=g:b[_]=P,(f=b[l=_+1])<128?(v=n[l])<(I=2*f)?b[l]=v:b[l]=I:(v=n[l])>(I=2*f-256)?b[l]=v:b[l]=I,(u=b[p=_+2])<128?(g=n[p])<(P=2*u)?b[p]=g:b[p]=P:(g=n[p])>(P=2*u-256)?b[p]=g:b[p]=P;k=!0;break;case"hardmix":for(;S--;)(u=b[_-=4])<128?255-(255-n[_]<<8)/(2*u)<128||0==u?b[_]=0:b[_]=255:(P=2*u-256)<255&&(n[_]<<8)/(255-P)<128?b[_]=0:b[_]=255,(f=b[l=_+1])<128?255-(255-n[l]<<8)/(2*f)<128||0==f?b[l]=0:b[l]=255:(I=2*f-256)<255&&(n[l]<<8)/(255-I)<128?b[l]=0:b[l]=255,(m=b[p=_+2])<128?255-(255-n[p]<<8)/(2*m)<128||0==m?b[p]=0:b[p]=255:(D=2*m-256)<255&&(n[p]<<8)/(255-D)<128?b[p]=0:b[p]=255;k=!0}if(k&&h.putImageData(y,0,0),1==a||Pixastic.Client.hasGlobalAlpha()){var E=t.canvas.getContext("2d");E.save(),E.globalAlpha=a,E.drawImage(c,0,0,r.width,r.height,r.left,r.top,r.width,r.height),E.globalAlpha=1,E.restore()}else{for(var S=s*o,F=a,L=1-a;S--;){var N=n[_=4*S]*L+b[_]*F>>0,R=n[_+1]*L+b[_+1]*F>>0,T=n[_+2]*L+b[_+2]*F>>0;n[_]=N,n[_+1]=R,n[_+2]=T}t.useData=!0}return!0}},checkSupport:function(){return Pixastic.Client.hasCanvasImageData()}},Pixastic.Actions.blur={process:function(t){if(void 0===t.options.fixMargin&&(t.options.fixMargin=!0),Pixastic.Client.hasCanvasImageData()){for(var a=Pixastic.prepareData(t),e=Pixastic.prepareData(t,!0),i=[[0,1,0],[1,2,1],[0,1,0]],r=0,n=0;n<3;n++)for(var s=0;s<3;s++)r+=i[n][s];r=1/(2*r);var o=t.options.rect,c=o.width,h=o.height,l=4*c,p=h;do{var g=(p-1)*l,v=(1==p?0:p-2)*c*4,d=(p==h?p-1:p)*c*4,u=c;do{var f=g+(4*u-4),m=v+4*(1==u?0:u-2),x=d+4*(u==c?u-1:u);a[f]=(2*(e[m]+e[f-4]+e[f+4]+e[x])+4*e[f])*r,a[f+1]=(2*(e[m+1]+e[f-3]+e[f+5]+e[x+1])+4*e[f+1])*r,a[f+2]=(2*(e[m+2]+e[f-2]+e[f+6]+e[x+2])+4*e[f+2])*r}while(--u)}while(--p);return!0}if(Pixastic.Client.isIE())return t.image.style.filter+=" progid:DXImageTransform.Microsoft.Blur(pixelradius=1.5)",t.options.fixMargin&&(t.image.style.marginLeft=(parseInt(t.image.style.marginLeft,10)||0)-2+"px",t.image.style.marginTop=(parseInt(t.image.style.marginTop,10)||0)-2+"px"),!0},checkSupport:function(){return Pixastic.Client.hasCanvasImageData()||Pixastic.Client.isIE()}},Pixastic.Actions.blurfast={process:function(t){var a=parseFloat(t.options.amount)||0,e=!(!t.options.clear||"false"==t.options.clear);if(a=Math.max(0,Math.min(5,a)),Pixastic.Client.hasCanvas()){var i=t.options.rect,r=t.canvas.getContext("2d");r.save(),r.beginPath(),r.rect(i.left,i.top,i.width,i.height),r.clip();var n=Math.round(t.width/2),s=Math.round(t.height/2),o=document.createElement("canvas");o.width=n,o.height=s;e=!1;for(var c=Math.round(20*a),h=o.getContext("2d"),l=0;l<c;l++){var p=Math.max(1,Math.round(n-l)),g=Math.max(1,Math.round(s-l));h.clearRect(0,0,n,s),h.drawImage(t.canvas,0,0,t.width,t.height,0,0,p,g),e&&r.clearRect(i.left,i.top,i.width,i.height),r.drawImage(o,0,0,p,g,0,0,t.width,t.height)}return r.restore(),t.useData=!1,!0}if(Pixastic.Client.isIE()){var v=10*a;return t.image.style.filter+=" progid:DXImageTransform.Microsoft.Blur(pixelradius="+v+")",t.options.fixMargin,t.image.style.marginLeft=(parseInt(t.image.style.marginLeft,10)||0)-Math.round(v)+"px",t.image.style.marginTop=(parseInt(t.image.style.marginTop,10)||0)-Math.round(v)+"px",!0}},checkSupport:function(){return Pixastic.Client.hasCanvas()||Pixastic.Client.isIE()}},Pixastic.Actions.brightness={process:function(t){var a=parseInt(t.options.brightness,10)||0,e=parseFloat(t.options.contrast)||0,i=!(!t.options.legacy||"false"==t.options.legacy);if(i)a=Math.min(150,Math.max(-150,a));else var r=1+Math.min(150,Math.max(-150,a))/150;if(e=Math.max(0,e+1),Pixastic.Client.hasCanvasImageData()){var n,s,o,c,h,l,p,g=Pixastic.prepareData(t),v=t.options.rect,d=v.width*v.height,u=4*d;for(1!=e?i?(o=e,c=(a-128)*e+128):(o=r*e,c=128*-e+128):i?(o=1,c=a):(o=r,c=0);d--;)(h=g[u-=4]*o+c)>255?g[u]=255:g[u]=h<0?0:h,(l=g[n=u+1]*o+c)>255?g[n]=255:g[n]=l<0?0:l,(p=g[s=u+2]*o+c)>255?g[s]=255:g[s]=p<0?0:p;return!0}},checkSupport:function(){return Pixastic.Client.hasCanvasImageData()}},Pixastic.Actions.coloradjust={process:function(t){var a=parseFloat(t.options.red)||0,e=parseFloat(t.options.green)||0,i=parseFloat(t.options.blue)||0;if(a=Math.round(255*a),e=Math.round(255*e),i=Math.round(255*i),Pixastic.Client.hasCanvasImageData()){for(var r,n,s,o,c,h=Pixastic.prepareData(t),l=t.options.rect,p=l.width*l.height,g=4*p;p--;)g-=4,a&&((s=h[g]+a)<0?h[g]=0:h[g]=s>255?255:s),e&&((o=h[r=g+1]+e)<0?h[r]=0:h[r]=o>255?255:o),i&&((c=h[n=g+2]+i)<0?h[n]=0:h[n]=c>255?255:c);return!0}},checkSupport:function(){return Pixastic.Client.hasCanvasImageData()}},Pixastic.Actions.colorhistogram={array256:function(t){arr=[];for(var a=0;a<256;a++)arr[a]=t;return arr},process:function(t){"object"!=typeof t.options.returnValue&&(t.options.returnValue={rvals:[],gvals:[],bvals:[]});var a=!!t.options.paint,e=t.options.returnValue;if("array"!=typeof e.values&&(e.rvals=[],e.gvals=[],e.bvals=[]),Pixastic.Client.hasCanvasImageData()){var i=Pixastic.prepareData(t);t.useData=!1;for(var r=this.array256(0),n=this.array256(0),s=this.array256(0),o=t.options.rect,c=o.width*o.height,h=4*c;c--;)r[i[h-=4]]++,n[i[h+1]]++,s[i[h+2]]++;if(e.rvals=r,e.gvals=n,e.bvals=s,a)for(var l=t.canvas.getContext("2d"),p=[r,n,s],g=0;g<3;g++){for(var v=(g+1)*t.height/3,d=0,u=0;u<256;u++)p[g][u]>d&&(d=p[g][u]);var f=t.height/3/d,m=t.width/256;0==g?l.fillStyle="rgba(255,0,0,0.5)":1==g?l.fillStyle="rgba(0,255,0,0.5)":2==g&&(l.fillStyle="rgba(0,0,255,0.5)");for(u=0;u<256;u++)l.fillRect(u*m,t.height-f*p[g][u]-t.height+v,m,p[g][u]*f)}return!0}},checkSupport:function(){return Pixastic.Client.hasCanvasImageData()}},Pixastic.Actions.crop={process:function(t){if(Pixastic.Client.hasCanvas()){var a=t.options.rect,e=a.width,i=a.height,r=a.top,n=a.left;void 0!==t.options.left&&(n=parseInt(t.options.left,10)),void 0!==t.options.top&&(r=parseInt(t.options.top,10)),void 0!==t.options.height&&(e=parseInt(t.options.width,10)),void 0!==t.options.height&&(i=parseInt(t.options.height,10)),n<0&&(n=0),n>t.width-1&&(n=t.width-1),r<0&&(r=0),r>t.height-1&&(r=t.height-1),e<1&&(e=1),n+e>t.width&&(e=t.width-n),i<1&&(i=1),r+i>t.height&&(i=t.height-r);var s=document.createElement("canvas");return s.width=t.width,s.height=t.height,s.getContext("2d").drawImage(t.canvas,0,0),t.canvas.width=e,t.canvas.height=i,t.canvas.getContext("2d").clearRect(0,0,e,i),t.canvas.getContext("2d").drawImage(s,n,r,e,i,0,0,e,i),t.useData=!1,!0}},checkSupport:function(){return Pixastic.Client.hasCanvas()}},Pixastic.Actions.desaturate={process:function(t){var a=!(!t.options.average||"false"==t.options.average);if(Pixastic.Client.hasCanvasImageData()){var e,i,r=Pixastic.prepareData(t),n=t.options.rect,s=n.width*n.height,o=4*s;if(a)for(;s--;)r[o-=4]=r[e=o+1]=r[i=o+2]=(r[o]+r[e]+r[i])/3;else for(;s--;)r[o-=4]=r[e=o+1]=r[i=o+2]=.3*r[o]+.59*r[e]+.11*r[i];return!0}if(Pixastic.Client.isIE())return t.image.style.filter+=" gray",!0},checkSupport:function(){return Pixastic.Client.hasCanvasImageData()||Pixastic.Client.isIE()}},Pixastic.Actions.edges={process:function(t){var a=!(!t.options.mono||"false"==t.options.mono),e=!(!t.options.invert||"false"==t.options.invert);if(Pixastic.Client.hasCanvasImageData()){var i=Pixastic.prepareData(t),r=Pixastic.prepareData(t,!0),n=-1/8;weight=-8;var s=t.options.rect,o=s.width,c=s.height,h=4*o,l=c;do{var p=(l-1)*h,g=(1==l?0:l-2)*o*4,v=(l==c?l-1:l)*o*4,d=o;do{var u=p+(4*d-4),f=g+4*(1==d?0:d-2),m=v+4*(d==o?d-1:d),x=((r[f-4]+r[f]+r[f+4]+r[u-4]+r[u+4]+r[m-4]+r[m]+r[m+4])*n+r[u])*weight,C=((r[f-3]+r[f+1]+r[f+5]+r[u-3]+r[u+5]+r[m-3]+r[m+1]+r[m+5])*n+r[u+1])*weight,w=((r[f-2]+r[f+2]+r[f+6]+r[u-2]+r[u+6]+r[m-2]+r[m+2]+r[m+6])*n+r[u+2])*weight;if(a){var P=.3*x+.59*C+.11*w||0;e&&(P=255-P),P<0&&(P=0),P>255&&(P=255),x=C=w=P}else e&&(x=255-x,C=255-C,w=255-w),x<0&&(x=0),C<0&&(C=0),w<0&&(w=0),x>255&&(x=255),C>255&&(C=255),w>255&&(w=255);i[u]=x,i[u+1]=C,i[u+2]=w}while(--d)}while(--l);return!0}},checkSupport:function(){return Pixastic.Client.hasCanvasImageData()}},Pixastic.Actions.edges2={process:function(t){if(Pixastic.Client.hasCanvasImageData()){for(var a=Pixastic.prepareData(t),e=Pixastic.prepareData(t,!0),i=t.options.rect,r=i.width,n=4*r,s=n+4,o=i.height-1,c=r-1,h=1;h<o;++h){for(var l=s-4,p=l-n,g=l+n,v=-e[p]-e[l]-e[g],d=-e[++p]-e[++l]-e[++g],u=-e[++p]-e[++l]-e[++g],f=e[p+=2],m=e[++p],x=e[++p],C=e[l+=2],w=e[++l],P=e[++l],I=e[g+=2],D=e[++g],M=e[++g],b=-f-C-I,y=-m-w-D,_=-x-P-M,k=1;k<c;++k){g=(l=s+4)+n;var A=127+v-f- -8*C-I,E=127+d-m- -8*w-D,S=127+u-x- -8*P-M;v=b,d=y,u=_,f=e[p=l-n],m=e[++p],x=e[++p],C=e[l],w=e[++l],P=e[++l],(A+=b=-f-C-(I=e[g]))>255&&(A=255),(E+=y=-m-w-(D=e[++g]))>255&&(E=255),(S+=_=-x-P-(M=e[++g]))>255&&(S=255),A<0&&(A=0),E<0&&(E=0),S<0&&(S=0),a[s]=A,a[++s]=E,a[++s]=S,s+=2}s+=8}return!0}},checkSupport:function(){return Pixastic.Client.hasCanvasImageData()}},Pixastic.Actions.emboss={process:function(t){var a=parseFloat(t.options.strength)||1,e=void 0!==t.options.greyLevel?parseInt(t.options.greyLevel):180,i=t.options.direction||"topleft",r=!(!t.options.blend||"false"==t.options.blend),n=0,s=0;switch(i){case"topleft":n=-1,s=-1;break;case"top":n=-1,s=0;break;case"topright":n=-1,s=1;break;case"right":n=0,s=1;break;case"bottomright":n=1,s=1;break;case"bottom":n=1,s=0;break;case"bottomleft":n=1,s=-1;break;case"left":n=0,s=-1}if(Pixastic.Client.hasCanvasImageData()){var o=Pixastic.prepareData(t),c=Pixastic.prepareData(t,!0),h=(t.options.invertAlpha,t.options.rect),l=h.width,p=h.height,g=4*l,v=p;do{var d=(v-1)*g,u=n;v+u<1&&(u=0),v+u>p&&(u=0);var f=(v-1+u)*l*4,m=l;do{var x=d+4*(m-1),C=s;m+C<1&&(C=0),m+C>l&&(C=0);var w=f+4*(m-1+C),P=c[x]-c[w],I=c[x+1]-c[w+1],D=c[x+2]-c[w+2],M=P,b=M>0?M:-M;if((I>0?I:-I)>b&&(M=I),(D>0?D:-D)>b&&(M=D),M*=a,r){var y=o[x]+M,_=o[x+1]+M,k=o[x+2]+M;o[x]=y>255?255:y<0?0:y,o[x+1]=_>255?255:_<0?0:_,o[x+2]=k>255?255:k<0?0:k}else{var A=e-M;A<0?A=0:A>255&&(A=255),o[x]=o[x+1]=o[x+2]=A}}while(--m)}while(--v);return!0}if(Pixastic.Client.isIE())return t.image.style.filter+=" progid:DXImageTransform.Microsoft.emboss()",!0},checkSupport:function(){return Pixastic.Client.hasCanvasImageData()||Pixastic.Client.isIE()}},Pixastic.Actions.flip={process:function(t){var a=t.options.rect,e=document.createElement("canvas");e.width=a.width,e.height=a.height,e.getContext("2d").drawImage(t.image,a.left,a.top,a.width,a.height,0,0,a.width,a.height);var i=t.canvas.getContext("2d");return i.clearRect(a.left,a.top,a.width,a.height),"horizontal"==t.options.axis?(i.scale(-1,1),i.drawImage(e,-a.left-a.width,a.top,a.width,a.height)):(i.scale(1,-1),i.drawImage(e,a.left,-a.top-a.height,a.width,a.height)),t.useData=!1,!0},checkSupport:function(){return Pixastic.Client.hasCanvas()}},Pixastic.Actions.fliph={process:function(t){if(Pixastic.Client.hasCanvas()){var a=t.options.rect,e=document.createElement("canvas");e.width=a.width,e.height=a.height,e.getContext("2d").drawImage(t.image,a.left,a.top,a.width,a.height,0,0,a.width,a.height);var i=t.canvas.getContext("2d");return i.clearRect(a.left,a.top,a.width,a.height),i.scale(-1,1),i.drawImage(e,-a.left-a.width,a.top,a.width,a.height),t.useData=!1,!0}if(Pixastic.Client.isIE())return t.image.style.filter+=" fliph",!0},checkSupport:function(){return Pixastic.Client.hasCanvas()||Pixastic.Client.isIE()}},Pixastic.Actions.flipv={process:function(t){if(Pixastic.Client.hasCanvas()){var a=t.options.rect,e=document.createElement("canvas");e.width=a.width,e.height=a.height,e.getContext("2d").drawImage(t.image,a.left,a.top,a.width,a.height,0,0,a.width,a.height);var i=t.canvas.getContext("2d");return i.clearRect(a.left,a.top,a.width,a.height),i.scale(1,-1),i.drawImage(e,a.left,-a.top-a.height,a.width,a.height),t.useData=!1,!0}if(Pixastic.Client.isIE())return t.image.style.filter+=" flipv",!0},checkSupport:function(){return Pixastic.Client.hasCanvas()||Pixastic.Client.isIE()}},Pixastic.Actions.glow={process:function(t){var a=parseFloat(t.options.amount)||0,e=parseFloat(t.options.radius)||0;if(a=Math.min(1,Math.max(0,a)),e=Math.min(5,Math.max(0,e)),Pixastic.Client.hasCanvasImageData()){var i=t.options.rect,r=document.createElement("canvas");r.width=t.width,r.height=t.height;var n=r.getContext("2d");n.drawImage(t.canvas,0,0);var s=Math.round(t.width/2),o=Math.round(t.height/2),c=document.createElement("canvas");c.width=s,c.height=o;for(var h=Math.round(20*e),l=c.getContext("2d"),p=0;p<h;p++){var g=Math.max(1,Math.round(s-p)),v=Math.max(1,Math.round(o-p));l.clearRect(0,0,s,o),l.drawImage(r,0,0,t.width,t.height,0,0,g,v),n.clearRect(0,0,t.width,t.height),n.drawImage(c,0,0,g,v,0,0,t.width,t.height)}for(var d=Pixastic.prepareData(t),u=Pixastic.prepareData({canvas:r,options:t.options}),f=i.width*i.height,m=4*f,x=m+1,C=m+2;f--;)(d[m-=4]+=a*u[m])>255&&(d[m]=255),(d[x-=4]+=a*u[x])>255&&(d[x]=255),(d[C-=4]+=a*u[C])>255&&(d[C]=255);return!0}},checkSupport:function(){return Pixastic.Client.hasCanvasImageData()}},Pixastic.Actions.histogram={process:function(t){var a=!(!t.options.average||"false"==t.options.average),e=!(!t.options.paint||"false"==t.options.paint),i=t.options.color||"rgba(255,255,255,0.5)",r=[];"object"!=typeof t.options.returnValue&&(t.options.returnValue={values:[]});var n=t.options.returnValue;if("array"!=typeof n.values&&(n.values=[]),r=n.values,Pixastic.Client.hasCanvasImageData()){var s=Pixastic.prepareData(t);t.useData=!1;for(var o=0;o<256;o++)r[o]=0;var c=t.options.rect,h=c.width*c.height,l=4*h,p=Math.round;if(a)for(;h--;)r[p((s[l-=4]+s[l+1]+s[l+2])/3)]++;else for(;h--;)r[p(.3*s[l-=4]+.59*s[l+1]+.11*s[l+2])]++;if(e){var g=0;for(o=0;o<256;o++)r[o]>g&&(g=r[o]);var v=t.height/g,d=t.width/256,u=t.canvas.getContext("2d");u.fillStyle=i;for(o=0;o<256;o++)u.fillRect(o*d,t.height-v*r[o],d,r[o]*v)}return n.values=r,!0}},checkSupport:function(){return Pixastic.Client.hasCanvasImageData()}},Pixastic.Actions.hsl={process:function(t){var a=parseInt(t.options.hue,10)||0,e=(parseInt(t.options.saturation,10)||0)/100,i=(parseInt(t.options.lightness,10)||0)/100;if(e<0)var r=1+e;else r=1+2*e;var n=6*(a=a%360/360),s=255*i,o=1+i,c=1-i;if(Pixastic.Client.hasCanvasImageData()){for(var h=Pixastic.prepareData(t),l=t.options.rect,p=l.width*l.height,g=4*p,v=g+1,d=g+2;p--;){var u=h[g-=4],f=h[v=g+1],m=h[d=g+2];if(0!=a||0!=e){var x=u;f>x&&(x=f),m>x&&(x=m);var C=u;f<C&&(C=f),m<C&&(C=m);var w=x-C,P=(C+x)/510;if(P>0&&w>0){if(P<=.5){(D=w/(x+C)*r)>1&&(D=1);var I=P*(1+D)}else{var D;(D=w/(510-x-C)*r)>1&&(D=1);I=P+D-P*D}if(u==x)if(f==C)var M=5+(x-m)/w+n;else M=1-(x-f)/w+n;else if(f==x)if(m==C)M=1+(x-u)/w+n;else M=3-(x-m)/w+n;else if(u==C)M=3+(x-f)/w+n;else M=5-(x-u)/w+n;M<0&&(M+=6),M>=6&&(M-=6);var b=P+P-I,y=M>>0;0==y?(u=255*I,f=255*(b+(I-b)*(M-y)),m=255*b):1==y?(u=255*(I-(I-b)*(M-y)),f=255*I,m=255*b):2==y?(u=255*b,f=255*I,m=255*(b+(I-b)*(M-y))):3==y?(u=255*b,f=255*(I-(I-b)*(M-y)),m=255*I):4==y?(u=255*(b+(I-b)*(M-y)),f=255*b,m=255*I):5==y&&(u=255*I,f=255*b,m=255*(I-(I-b)*(M-y)))}}i<0?(u*=o,f*=o,m*=o):i>0&&(u=u*c+s,f=f*c+s,m=m*c+s),h[g]=u<0?0:u>255?255:u,h[v]=f<0?0:f>255?255:f,h[d]=m<0?0:m>255?255:m}return!0}},checkSupport:function(){return Pixastic.Client.hasCanvasImageData()}},Pixastic.Actions.invert={process:function(t){if(Pixastic.Client.hasCanvasImageData()){for(var a=Pixastic.prepareData(t),e=!!t.options.invertAlpha,i=t.options.rect,r=i.width*i.height,n=4*r,s=n+1,o=n+2,c=n+3;r--;)a[n-=4]=255-a[n],a[s-=4]=255-a[s],a[o-=4]=255-a[o],e&&(a[c-=4]=255-a[c]);return!0}if(Pixastic.Client.isIE())return t.image.style.filter+=" invert",!0},checkSupport:function(){return Pixastic.Client.hasCanvasImageData()||Pixastic.Client.isIE()}},Pixastic.Actions.laplace={process:function(t){var a=!(!t.options.invert||"false"==t.options.invert),e=parseFloat(t.options.edgeStrength)||0,i=parseInt(t.options.greyLevel)||0;if(e=-e,Pixastic.Client.hasCanvasImageData()){var r=Pixastic.prepareData(t),n=Pixastic.prepareData(t,!0),s=1/8,o=t.options.rect,c=o.width,h=o.height,l=4*c,p=h;do{var g=(p-1)*l,v=(1==p?0:p-2)*c*4,d=(p==h?p-1:p)*c*4,u=c;do{var f=g+(4*u-4),m=v+4*(1==u?0:u-2),x=d+4*(u==c?u-1:u),C=((-n[m-4]-n[m]-n[m+4]-n[f-4]-n[f+4]-n[x-4]-n[x]-n[x+4]+8*n[f])*s+(-n[m-3]-n[m+1]-n[m+5]-n[f-3]-n[f+5]-n[x-3]-n[x+1]-n[x+5]+8*n[f+1])*s+(-n[m-2]-n[m+2]-n[m+6]-n[f-2]-n[f+6]-n[x-2]-n[x+2]-n[x+6]+8*n[f+2])*s)/3+i;0!=e&&(C>127?C+=(C+1-128)*e:C<127&&(C-=(C+1)*e)),a&&(C=255-C),C<0&&(C=0),C>255&&(C=255),r[f]=r[f+1]=r[f+2]=C}while(--u)}while(--p);return!0}},checkSupport:function(){return Pixastic.Client.hasCanvasImageData()}},Pixastic.Actions.lighten={process:function(t){var a=parseFloat(t.options.amount)||0;if(a=Math.max(-1,Math.min(1,a)),Pixastic.Client.hasCanvasImageData()){for(var e=Pixastic.prepareData(t),i=t.options.rect,r=i.width*i.height,n=4*r,s=n+1,o=n+2,c=a+1;r--;)(e[n-=4]=e[n]*c)>255&&(e[n]=255),(e[s-=4]=e[s]*c)>255&&(e[s]=255),(e[o-=4]=e[o]*c)>255&&(e[o]=255);return!0}if(Pixastic.Client.isIE()){var h=t.image;return a<0?(h.style.filter+=" light()",h.filters[h.filters.length-1].addAmbient(255,255,255,100*-a)):a>0&&(h.style.filter+=" light()",h.filters[h.filters.length-1].addAmbient(255,255,255,100),h.filters[h.filters.length-1].addAmbient(255,255,255,100*a)),!0}},checkSupport:function(){return Pixastic.Client.hasCanvasImageData()||Pixastic.Client.isIE()}},Pixastic.Actions.mosaic={process:function(t){var a=Math.max(1,parseInt(t.options.blockSize,10));if(Pixastic.Client.hasCanvasImageData()){var e=t.options.rect,i=e.width,r=e.height,n=r,s=t.canvas.getContext("2d"),o=document.createElement("canvas");o.width=o.height=1;var c=o.getContext("2d"),h=document.createElement("canvas");h.width=i,h.height=r,h.getContext("2d").drawImage(t.canvas,e.left,e.top,i,r,0,0,i,r);for(n=0;n<r;n+=a)for(var l=0;l<i;l+=a){var p=a,g=a;p+l>i&&(p=i-l),g+n>r&&(g=r-n),c.drawImage(h,l,n,p,g,0,0,1,1);var v=c.getImageData(0,0,1,1).data;s.fillStyle="rgb("+v[0]+","+v[1]+","+v[2]+")",s.fillRect(e.left+l,e.top+n,a,a)}return t.useData=!1,!0}},checkSupport:function(){return Pixastic.Client.hasCanvasImageData()}},Pixastic.Actions.noise={process:function(t){var a=0,e=0,i=!1;void 0!==t.options.amount&&(a=parseFloat(t.options.amount)||0),void 0!==t.options.strength&&(e=parseFloat(t.options.strength)||0),void 0!==t.options.mono&&(i=!(!t.options.mono||"false"==t.options.mono)),a=Math.max(0,Math.min(1,a));var r=128*(e=Math.max(0,Math.min(1,e))),n=r/2;if(Pixastic.Client.hasCanvasImageData()){var s=Pixastic.prepareData(t),o=t.options.rect,c=o.width,h=4*c,l=o.height,p=Math.random;do{var g=(l-1)*h,v=c;do{var d=g+4*(v-1);if(p()<a){if(i)var u=-n+p()*r,f=s[d]+u,m=s[d+1]+u,x=s[d+2]+u;else f=s[d]-n+p()*r,m=s[d+1]-n+p()*r,x=s[d+2]-n+p()*r;f<0&&(f=0),m<0&&(m=0),x<0&&(x=0),f>255&&(f=255),m>255&&(m=255),x>255&&(x=255),s[d]=f,s[d+1]=m,s[d+2]=x}}while(--v)}while(--l);return!0}},checkSupport:function(){return Pixastic.Client.hasCanvasImageData()}},Pixastic.Actions.posterize={process:function(t){var a=256;if(void 0!==t.options.levels&&(a=parseInt(t.options.levels,10)||1),Pixastic.Client.hasCanvasImageData()){var e=Pixastic.prepareData(t),i=256/(a=Math.max(2,Math.min(256,a))),r=256/(a-1),n=t.options.rect,s=n.width,o=4*s,c=n.height;do{var h=(c-1)*o,l=s;do{var p=h+4*(l-1),g=r*(e[p]/i>>0),v=r*(e[p+1]/i>>0),d=r*(e[p+2]/i>>0);g>255&&(g=255),v>255&&(v=255),d>255&&(d=255),e[p]=g,e[p+1]=v,e[p+2]=d}while(--l)}while(--c);return!0}},checkSupport:function(){return Pixastic.Client.hasCanvasImageData()}},Pixastic.Actions.pointillize={process:function(t){var a=Math.max(1,parseInt(t.options.radius,10)),e=Math.min(5,Math.max(0,parseFloat(t.options.density)||0)),i=Math.max(0,parseFloat(t.options.noise)||0),r=!(!t.options.transparent||"false"==t.options.transparent);if(Pixastic.Client.hasCanvasImageData()){var n=t.options.rect,s=n.width,o=n.height,c=o,h=t.canvas.getContext("2d"),l=t.canvas.width,p=t.canvas.height,g=document.createElement("canvas");g.width=g.height=1;var v=g.getContext("2d"),d=document.createElement("canvas");d.width=s,d.height=o,d.getContext("2d").drawImage(t.canvas,n.left,n.top,s,o,0,0,s,o);var u=2*a;r&&h.clearRect(n.left,n.top,n.width,n.height);var f=a*i,m=1/e;for(c=0;c<o+a;c+=u*m)for(var x=0;x<s+a;x+=u*m){rndX=i?x+(2*Math.random()-1)*f>>0:x,rndY=i?c+(2*Math.random()-1)*f>>0:c;var C=rndX-a,w=rndY-a;C<0&&(C=0),w<0&&(w=0);var P=rndX+n.left,I=rndY+n.top;P<0&&(P=0),P>l&&(P=l),I<0&&(I=0),I>p&&(I=p);var D=u,M=u;D+C>s&&(D=s-C),M+w>o&&(M=o-w),D<1&&(D=1),M<1&&(M=1),v.drawImage(d,C,w,D,M,0,0,1,1);var b=v.getImageData(0,0,1,1).data;h.fillStyle="rgb("+b[0]+","+b[1]+","+b[2]+")",h.beginPath(),h.arc(P,I,a,0,2*Math.PI,!0),h.closePath(),h.fill()}return t.useData=!1,!0}},checkSupport:function(){return Pixastic.Client.hasCanvasImageData()}},Pixastic.Actions.removenoise={process:function(t){if(Pixastic.Client.hasCanvasImageData()){var a=Pixastic.prepareData(t),e=t.options.rect,i=e.width,r=e.height,n=4*i,s=r;do{var o=(s-1)*n,c=(1==s?0:s-2)*i*4,h=(s==r?s-1:s)*i*4,l=i;do{var p,g,v,d,u,f,m=o+(4*l-4),x=c+4*(1==l?0:l-2),C=h+4*(l==i?l-1:l);p=g=a[x];var w=a[m-4],P=a[m+4],I=a[C];w<p&&(p=w),P<p&&(p=P),I<p&&(p=I),w>g&&(g=w),P>g&&(g=P),I>g&&(g=I),v=d=a[x+1];var D=a[m-3],M=a[m+5],b=a[C+1];D<v&&(v=D),M<v&&(v=M),b<v&&(v=b),D>d&&(d=D),M>d&&(d=M),b>d&&(d=b),u=f=a[x+2];var y=a[m-2],_=a[m+6],k=a[C+2];y<u&&(u=y),_<u&&(u=_),k<u&&(u=k),y>f&&(f=y),_>f&&(f=_),k>f&&(f=k),a[m]>g?a[m]=g:a[m]<p&&(a[m]=p),a[m+1]>d?a[m+1]=d:a[m+1]<v&&(a[m+1]=v),a[m+2]>f?a[m+2]=f:a[m+2]<u&&(a[m+2]=u)}while(--l)}while(--s);return!0}},checkSupport:function(){return Pixastic.Client.hasCanvasImageData()}},Pixastic.Actions.resize={process:function(t){if(Pixastic.Client.hasCanvas()){var a=parseInt(t.options.width,10),e=parseInt(t.options.height,10),i=t.canvas;a<1&&(a=1),a<2&&(a=2);var r=document.createElement("canvas");return r.width=a,r.height=e,r.getContext("2d").drawImage(i,0,0,a,e),i.width=a,i.height=e,i.getContext("2d").drawImage(r,0,0),t.useData=!1,!0}},checkSupport:function(){return Pixastic.Client.hasCanvas()}},Pixastic.Actions.rotate={process:function(t){if(Pixastic.Client.hasCanvas()){var a=t.canvas,e=t.width,i=t.height,r=document.createElement("canvas");r.width=e,r.height=i,r.getContext("2d").drawImage(a,0,0,e,i);var n=-parseFloat(t.options.angle)*Math.PI/180,s=n;s>.5*Math.PI&&(s=Math.PI-s),s<.5*-Math.PI&&(s=-Math.PI-s);var o=Math.sqrt(e*e+i*i),c=Math.abs(s)-Math.abs(Math.atan2(i,e)),h=Math.abs(s)+Math.abs(Math.atan2(i,e)),l=Math.abs(Math.cos(c)*o),p=Math.abs(Math.sin(h)*o);a.width=l,a.height=p;var g=a.getContext("2d");return g.translate(l/2,p/2),g.rotate(n),g.drawImage(r,-e/2,-i/2),t.useData=!1,!0}},checkSupport:function(){return Pixastic.Client.hasCanvas()}},Pixastic.Actions.sepia={process:function(t){var a=parseInt(t.options.mode,10)||0;if(a<0&&(a=0),a>1&&(a=1),Pixastic.Client.hasCanvasImageData()){var e=Pixastic.prepareData(t),i=t.options.rect,r=i.width,n=4*r,s=i.height;do{var o=(s-1)*n,c=r;do{var h=o+4*(c-1);if(a)var l=.299*e[h]+.587*e[h+1]+.114*e[h+2],p=l+39,g=l+14,v=l-36;else{var d=e[h],u=e[h+1],f=e[h+2];p=.393*d+.769*u+.189*f,g=.349*d+.686*u+.168*f,v=.272*d+.534*u+.131*f}p<0&&(p=0),p>255&&(p=255),g<0&&(g=0),g>255&&(g=255),v<0&&(v=0),v>255&&(v=255),e[h]=p,e[h+1]=g,e[h+2]=v}while(--c)}while(--s);return!0}},checkSupport:function(){return Pixastic.Client.hasCanvasImageData()}},Pixastic.Actions.sharpen={process:function(t){var a=0;if(void 0!==t.options.amount&&(a=parseFloat(t.options.amount)||0),a<0&&(a=0),a>1&&(a=1),Pixastic.Client.hasCanvasImageData()){for(var e=Pixastic.prepareData(t),i=Pixastic.prepareData(t,!0),r=15,n=1+3*a,s=[[0,-n,0],[-n,r,-n],[0,-n,0]],o=0,c=0;c<3;c++)for(var h=0;h<3;h++)o+=s[c][h];o=1/o;var l=t.options.rect,p=l.width,g=l.height;r*=o,n*=o;var v=4*p,d=g;do{var u=(d-1)*v,f=(1==d?0:d-2)*v,m=(d==g?d-1:d)*v,x=p;do{var C=u+(4*x-4),w=f+4*(1==x?0:x-2),P=m+4*(x==p?x-1:x),I=(-i[w]-i[C-4]-i[C+4]-i[P])*n+i[C]*r,D=(-i[w+1]-i[C-3]-i[C+5]-i[P+1])*n+i[C+1]*r,M=(-i[w+2]-i[C-2]-i[C+6]-i[P+2])*n+i[C+2]*r;I<0&&(I=0),D<0&&(D=0),M<0&&(M=0),I>255&&(I=255),D>255&&(D=255),M>255&&(M=255),e[C]=I,e[C+1]=D,e[C+2]=M}while(--x)}while(--d);return!0}},checkSupport:function(){return Pixastic.Client.hasCanvasImageData()}},Pixastic.Actions.solarize={process:function(t){!t.options.average||t.options.average;if(Pixastic.Client.hasCanvasImageData()){var a=Pixastic.prepareData(t),e=t.options.rect,i=e.width,r=4*i,n=e.height;do{var s=(n-1)*r,o=i;do{var c=s+4*(o-1),h=a[c],l=a[c+1],p=a[c+2];h>127&&(h=255-h),l>127&&(l=255-l),p>127&&(p=255-p),a[c]=h,a[c+1]=l,a[c+2]=p}while(--o)}while(--n);return!0}},checkSupport:function(){return Pixastic.Client.hasCanvasImageData()}},Pixastic.Actions.unsharpmask={process:function(t){var a=parseFloat(t.options.amount)||0,e=parseFloat(t.options.radius)||0,i=parseFloat(t.options.threshold)||0;a=Math.min(500,Math.max(0,a))/2,e=Math.min(5,Math.max(0,e))/10,i=Math.min(255,Math.max(0,i));var r=- --i;if(a*=.016,a++,Pixastic.Client.hasCanvasImageData()){var n=t.options.rect,s=document.createElement("canvas");s.width=t.width,s.height=t.height;var o=s.getContext("2d");o.drawImage(t.canvas,0,0);var c=Math.round(t.width/2),h=Math.round(t.height/2),l=document.createElement("canvas");l.width=c,l.height=h;for(var p=Math.round(20*e),g=l.getContext("2d"),v=0;v<p;v++){var d=Math.max(1,Math.round(c-v)),u=Math.max(1,Math.round(h-v));g.clearRect(0,0,c,h),g.drawImage(s,0,0,t.width,t.height,0,0,d,u),o.clearRect(0,0,t.width,t.height),o.drawImage(l,0,0,d,u,0,0,t.width,t.height)}var f=Pixastic.prepareData(t),m=Pixastic.prepareData({canvas:s,options:t.options}),x=n.width,C=4*x,w=n.height;do{var P=(w-1)*C,I=x;do{var D=P+(4*I-4),M=f[D]-m[D];if(M>i||M<r){var b=m[D];b=a*M+b,f[D]=b>255?255:b<0?0:b}var y=f[D+1]-m[D+1];if(y>i||y<r){var _=m[D+1];_=a*y+_,f[D+1]=_>255?255:_<0?0:_}var k=f[D+2]-m[D+2];if(k>i||k<r){var A=m[D+2];A=a*k+A,f[D+2]=A>255?255:A<0?0:A}}while(--I)}while(--w);return!0}},checkSupport:function(){return Pixastic.Client.hasCanvasImageData()}};
17
81
  var Base64={toBase64Table:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",base64Pad:"=",encode:function(r){"use strict";var e,t="",a=Base64.toBase64Table.split(""),o=Base64.base64Pad,n=r.length;for(e=0;e<n-2;e+=3)t+=a[r[e]>>2],t+=a[((3&r[e])<<4)+(r[e+1]>>4)],t+=a[((15&r[e+1])<<2)+(r[e+2]>>6)],t+=a[63&r[e+2]];return n%3&&(t+=a[r[e=n-n%3]>>2],n%3==2?(t+=a[((3&r[e])<<4)+(r[e+1]>>4)],t+=a[(15&r[e+1])<<2],t+=o):(t+=a[(3&r[e])<<4],t+=o+o)),t},toBinaryTable:[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,0,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,-1,-1,-1,-1,-1],decode:function(r,e){"use strict";e=void 0!==e?e:0;var t,a,o,n,c,h,d=Base64.toBinaryTable,i=Base64.base64Pad,f=0,C=0,s=r.indexOf("=")-e;for(s<0&&(s=r.length-e),a=3*(s>>2)+Math.floor(s%4/1.5),t=new Array(a),o=0,n=e;n<r.length;n++)c=d[127&r.charCodeAt(n)],h=r.charAt(n)===i,-1!==c?(C=C<<6|c,(f+=6)>=8&&(f-=8,h||(t[o++]=C>>f&255),C&=(1<<f)-1)):console.error("Illegal character code "+r.charCodeAt(n)+" at position "+n);if(f)throw{name:"Base64-Error",message:"Corrupted base64 string"};return t},_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encodeStr:function(r){var e,t,a,o,n,c,h,d="",i=0;for(r=Base64._utf8_encode(r);i<r.length;)o=(e=r.charCodeAt(i++))>>2,n=(3&e)<<4|(t=r.charCodeAt(i++))>>4,c=(15&t)<<2|(a=r.charCodeAt(i++))>>6,h=63&a,isNaN(t)?c=h=64:isNaN(a)&&(h=64),d=d+this._keyStr.charAt(o)+this._keyStr.charAt(n)+this._keyStr.charAt(c)+this._keyStr.charAt(h);return d},decodeStr:function(r){var e,t,a,o,n,c,h="",d=0;for(r=r.replace(/[^A-Za-z0-9\+\/\=]/g,"");d<r.length;)e=this._keyStr.indexOf(r.charAt(d++))<<2|(o=this._keyStr.indexOf(r.charAt(d++)))>>4,t=(15&o)<<4|(n=this._keyStr.indexOf(r.charAt(d++)))>>2,a=(3&n)<<6|(c=this._keyStr.indexOf(r.charAt(d++))),h+=String.fromCharCode(e),64!=n&&(h+=String.fromCharCode(t)),64!=c&&(h+=String.fromCharCode(a));return h=Base64._utf8_decode(h)},_utf8_encode:function(r){r=r.replace(/\r\n/g,"\n");for(var e="",t=0;t<r.length;t++){var a=r.charCodeAt(t);a<128?e+=String.fromCharCode(a):a>127&&a<2048?(e+=String.fromCharCode(a>>6|192),e+=String.fromCharCode(63&a|128)):(e+=String.fromCharCode(a>>12|224),e+=String.fromCharCode(a>>6&63|128),e+=String.fromCharCode(63&a|128))}return e},_utf8_decode:function(r){for(var e="",t=0,a=c1=c2=0;t<r.length;)(a=r.charCodeAt(t))<128?(e+=String.fromCharCode(a),t++):a>191&&a<224?(c2=r.charCodeAt(t+1),e+=String.fromCharCode((31&a)<<6|63&c2),t+=2):(c2=r.charCodeAt(t+1),c3=r.charCodeAt(t+2),e+=String.fromCharCode((15&a)<<12|(63&c2)<<6|63&c3),t+=3);return e}};
@@ -59,7 +123,7 @@ wdi.PacketReassembler=$.spcExtend(wdi.EventObject.prototype,{packetController:nu
59
123
  wdi.ReassemblerFactory={getPacketReassembler:function(e){var t=this.getPacketExtractor(e),r=this.getSizeDefiner(),n=this.getPacketController(t,r);return new wdi.PacketReassembler({packetController:n})},getPacketExtractor:function(e){return new wdi.PacketExtractor({socketQ:e})},getSizeDefiner:function(){return new wdi.SizeDefiner},getPacketController:function(e,t){return new wdi.PacketController({packetExtractor:e,sizeDefiner:t})}};
60
124
  wdi.SizeDefiner=$.spcExtend(wdi.DomainObject,{ERROR_CODE_SIZE:4,status:null,STATUS_READY:0,STATUS_REPLY:1,STATUS_REPLY_BODY:2,STATUS_ERROR_CODE:3,STATUS_MESSAGE:4,STATUS_HEADER:5,STATUS_BODY:6,isHeader:!1,init:function(t){this.status=this.STATUS_READY},getSize:function(t){return this.STATUS_READY===this.status?(this.status++,wdi.SpiceLinkHeader.prototype.objectSize):this.STATUS_REPLY===this.status?(this.status++,this.getReplyBodySize(t)):this.STATUS_REPLY_BODY===this.status?(this.status++,this.ERROR_CODE_SIZE):this.STATUS_ERROR_CODE===this.status?(this.status++,this.isHeader=!0,6):this.isHeader?(this.isHeader=!1,this.getBodySizeFromArrayHeader(t)):(this.isHeader=!0,6)},getReplyBodySize:function(t){var e=wdi.GlobalPool.create("ViewQueue");e.setData(t);var i=(new wdi.SpiceLinkHeader).demarshall(e);return wdi.GlobalPool.discard("ViewQueue",e),i.size},getBodySizeFromArrayHeader:function(t){var e=wdi.GlobalPool.create("ViewQueue");e.setData(t);var i=(new wdi.SpiceDataHeader).demarshall(e);return wdi.GlobalPool.discard("ViewQueue",e),i.size},getStatus:function(){return this.status===this.STATUS_MESSAGE&&this.isHeader?this.STATUS_HEADER:this.status!==this.STATUS_MESSAGE||this.isHeader?this.status:this.STATUS_BODY}});
61
125
  wdi.PacketLinkFactory={extract:function(e,i){switch(e.type){case wdi.SpiceVars.SPICE_MSG_SET_ACK:return(new wdi.RedSetAck).demarshall(i);case wdi.SpiceVars.SPICE_MSG_PING:return(new wdi.RedPing).demarshall(i,e.size);case wdi.SpiceVars.SPICE_MSG_MIGRATE:return(new wdi.RedMigrate).demarshall(i);case wdi.SpiceVars.SPICE_MSG_MIGRATE_DATA:return(new wdi.RedMigrateData).demarshall(i,e.size);case wdi.SpiceVars.SPICE_MSG_WAIT_FOR_CHANNELS:return(new wdi.RedWaitForChannels).demarshall(i);case wdi.SpiceVars.SPICE_MSG_DISCONNECTING:return(new wdi.RedDisconnect).demarshall(i);case wdi.SpiceVars.SPICE_MSG_NOTIFY:return(new wdi.RedNotify).demarshall(i);case wdi.SpiceVars.SPICE_MSG_MAIN_MOUSE_MODE:return(new wdi.SpiceMouseMode).demarshall(i)}}},wdi.PacketLinkProcess={process:function(e,i,a){switch(e.type){case wdi.SpiceVars.SPICE_MSG_SET_ACK:var r=wdi.SpiceObject.numberTo32(i.generation);a.setAckWindow(i.window),a.sendObject(r,wdi.SpiceVars.SPICE_MSGC_ACK_SYNC);break;case wdi.SpiceVars.SPICE_MSG_PING:r=new wdi.RedPing({id:i.id,time:i.time}).marshall();a.sendObject(r,wdi.SpiceVars.SPICE_MSGC_PONG);break;case wdi.SpiceVars.SPICE_MSG_MAIN_MOUSE_MODE:a.fire("mouseMode",i.current_mode);break;case wdi.SpiceVars.SPICE_MSG_NOTIFY:a.fire("notify")}}};
62
- wdi.SpiceChannel=$.spcExtend(wdi.EventObject.prototype,{counter:0,ackWindow:0,connectionId:0,socketQ:null,packetReassembler:null,channel:1,codec:wdi.SpiceVideoCodecType.SPICE_VIDEO_CODEC_TYPE_MJPEG,proxy:null,token:null,init:function(e){this.superInit(),this.socketQ=e.socketQ||new wdi.SocketQueue,this.packetReassembler=e.packetReassembler||wdi.ReassemblerFactory.getPacketReassembler(this.socketQ),this.setListeners(),this.ackWindow=0},startHandshakeTimeout:function(){var e=this;this.handshakeTimeout=window.setTimeout((function(){var i=new Error("Handshake timeout");i.code=4200,wdi.Debug.error("Handshake timeout reached, raising error"),e.fire("error",i)}),5e3)},cancelHandshakeTimeout:function(){clearTimeout(this.handshakeTimeout)},setListeners:function(){var e,i=this;this.packetReassembler.addListener("packetComplete",(function(t){var s=t;if("spicePacket"===s.status){wdi.Debug.log("packetComplete spicePacket"),i.cancelHandshakeTimeout(),wdi.logOperations&&(wdi.DataLogger.logNetworkTime(),e=Date.now());var a=this.getRawSpiceMessage(s.data);a&&(wdi.logOperations&&a.channel===wdi.SpiceVars.SPICE_CHANNEL_DISPLAY&&wdi.DataLogger.setStartTime(e),this.fire("message",a))}else if("reply"===s.status){wdi.Debug.log("packetComplete reply");var n=this.getRedLinkReplyBytes(s.data);this.send(n)}else if("errorCode"===s.status){wdi.Debug.log("packetComplete errorCode"),(n=this.getErrorCodeBytes(s.data))&&(this.send(n),this.channel===wdi.SpiceVars.SPICE_CHANNEL_DISPLAY&&this.changeCodec(this.codec)),this.fire("channelConnected")}}),this),this.socketQ.addListener("open",(function(){var e=this.getRedLinkMessBytes();this.send(e),this.proxy&&this.proxy.end()}),this),this.socketQ.addListener("close",(function(e){1===this.channel&&this.fire("error",e),this.socketQ.disconnect()}),this),this.socketQ.addListener("error",(function(e){this.fire("error",e),this.socketQ.disconnect()}),this)},changeCodec:function(e){this.sendObject([...wdi.SpiceObject.numberTo16(2),...wdi.SpiceObject.numberTo16(e),...wdi.SpiceObject.numberTo16(3)],wdi.SpiceVars.SPICE_MSGC_DISPLAY_PREFERRED_VIDEO_CODEC_TYPE),wdi.currentCodec=e,console.log(`codec changed: ${e}`)},connect:function(e,i,t,s){var a=wdi.Utils.generateWebSocketUrl(e.protocol,e.host,e.port,e.vmHost,e.vmPort,"spice",e.vmInfoToken,e.vmid);this.channel=i,this.connectionId=t||0,this.socketQ.connect(a),this.startHandshakeTimeout(),this.proxy=s,this.token=e.token,this.packetReassembler.start()},disconnect:function(){wdi.Debug.log("spicechannel disconnect"),this.counter=0,this.ackWindow=0,this.connectionId=0,this.socketQ.disconnect(),this.socketQ=null,this.packetReassembler.dispose(),this.packetReassembler=null,this.channel=1,this.proxy=null,this.token=null},send:function(e,i){this.socketQ.send(e,i)},sendObject:function(e,i,t){for(var s=0;s<e.length;s+=2048){var a=e.slice(s,s+2048),n=new wdi.SpiceDataHeader({type:i,size:a.length}).marshall();n=n.concat(a),this.send(n,t)}},arrayOfNumberToUint32:function(e){let i=0;for(let t of e)i|=1<<t;return i},setAckWindow:function(e){this.ackWindow=e,this.counter=0},getRawSpiceMessage:function(e){var i=wdi.GlobalPool.create("ViewQueue"),t=wdi.GlobalPool.create("ViewQueue"),s=new Uint8Array(e,0,wdi.SpiceDataHeader.prototype.objectSize);i.setData(s);var a=(new wdi.SpiceDataHeader).demarshall(i);wdi.GlobalPool.discard("ViewQueue",i);var n=e.subarray(wdi.SpiceDataHeader.prototype.objectSize);if(t.setData(n),this.counter++,this.ackWindow&&this.counter===this.ackWindow){this.counter=0;var c=new wdi.SpiceDataHeader({type:wdi.SpiceVars.SPICE_MSGC_ACK,size:0}).marshall();this.send(c)}var o=wdi.PacketLinkFactory.extract(a,t)||!1;if(o)return wdi.PacketLinkProcess.process(a,o,this),wdi.GlobalPool.discard("ViewQueue",t),!1;var r=wdi.GlobalPool.create("RawSpiceMessage");return r.set(a,t,this.channel),r},getRedLinkReplyBytes:function(e){if(this.token){var i=new wdi.ViewQueue;i.setData(e),i.eatBytes(wdi.SpiceLinkHeader.prototype.objectSize);var t=(new wdi.SpiceLinkReply).demarshall(i);return wdi.SpiceObject.stringHexToBytes(RSA_public_encrypt(this.token,t.pub_key))}return wdi.SpiceObject.stringToBytesPadding("",128)},getRedLinkMessBytes:function(){var e=new wdi.SpiceLinkHeader({magic:1363428690,major_version:2,minor_version:2,size:26}).marshall(),i=new wdi.SpiceLinkMess({connection_id:this.connectionId,channel_type:this.channel,caps_offset:18,num_common_caps:1,num_channel_caps:1,common_caps:1<<wdi.SpiceVars.SPICE_COMMON_CAP_MINI_HEADER,channel_caps:this.arrayOfNumberToUint32([wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_SIZED_STREAM,wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_STREAM_REPORT,wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_MONITORS_CONFIG,wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_MULTI_CODEC,wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_PREF_VIDEO_CODEC_TYPE,wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_CODEC_MJPEG,wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_CODEC_VP8,wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_CODEC_H264,wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_CODEC_VP9,wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_CODEC_H265,wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_LZ4_COMPRESSION,wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_PREF_COMPRESSION])}).marshall();return e.concat(i)},getErrorCodeBytes:function(e){var i=wdi.GlobalPool.create("ViewQueue");i.setData(e);var t=wdi.SpiceObject.bytesToInt32NoAllocate(i);if(wdi.GlobalPool.discard("ViewQueue",i),0!==t)throw new wdi.Exception({message:"Server refused client",errorCode:2});if(this.channel===wdi.SpiceVars.SPICE_CHANNEL_DISPLAY){var s=new wdi.SpiceDataHeader({type:wdi.SpiceVars.SPICE_MSGC_DISPLAY_INIT,size:14}).marshall(),a=new wdi.SpiceCDisplayInit({pixmap_cache_id:1,pixmap_cache_size:1,glz_dictionary_id:0,glz_dictionary_window_size:0}).marshall();return s.concat(a)}if(this.channel==wdi.SpiceVars.SPICE_CHANNEL_MAIN)return new wdi.SpiceDataHeader({type:wdi.SpiceVars.SPICE_MSGC_MAIN_ATTACH_CHANNELS,size:0}).marshall()}});
126
+ wdi.SpiceChannel=$.spcExtend(wdi.EventObject.prototype,{counter:0,ackWindow:0,connectionId:0,socketQ:null,packetReassembler:null,channel:1,codec:wdi.SpiceVideoCodecType.SPICE_VIDEO_CODEC_TYPE_MJPEG,proxy:null,token:null,init:function(e){this.superInit(),this.socketQ=e.socketQ||new wdi.SocketQueue,this.packetReassembler=e.packetReassembler||wdi.ReassemblerFactory.getPacketReassembler(this.socketQ),this.setListeners(),this.ackWindow=0},fireHandshakeTimeoutError:function(){var e=new Error("Handshake timeout");e.code=4200,wdi.Debug.error("Handshake timeout reached, raising error"),this.fire("error",e)},setListeners:function(){var e,i=this;this.packetReassembler.addListener("packetComplete",(function(t){var s=t;if("spicePacket"===s.status){wdi.Debug.log("packetComplete spicePacket"),wdi.logOperations&&(wdi.DataLogger.logNetworkTime(),e=Date.now());var a=this.getRawSpiceMessage(s.data);a&&(wdi.logOperations&&a.channel===wdi.SpiceVars.SPICE_CHANNEL_DISPLAY&&wdi.DataLogger.setStartTime(e),this.fire("message",a))}else if("reply"===s.status){wdi.Debug.log("packetComplete reply");var n=this.getRedLinkReplyBytes(s.data);this.send(n)}else if("errorCode"===s.status){wdi.Debug.log("packetComplete errorCode"),(n=this.getErrorCodeBytes(s.data))&&(this.send(n),this.channel===wdi.SpiceVars.SPICE_CHANNEL_DISPLAY&&this.changeCodec(this.codec)),this.fire("channelConnected")}else i.fireHandshakeTimeoutError()}),this),this.socketQ.addListener("open",(function(){var e=this.getRedLinkMessBytes();this.send(e),this.proxy&&this.proxy.end()}),this),this.socketQ.addListener("close",(function(e){1===this.channel&&this.fire("error",e),this.socketQ.disconnect()}),this),this.socketQ.addListener("error",(function(e){this.fire("error",e),this.socketQ.disconnect()}),this)},changeCodec:function(e){this.sendObject([...wdi.SpiceObject.numberTo16(2),...wdi.SpiceObject.numberTo16(e),...wdi.SpiceObject.numberTo16(3)],wdi.SpiceVars.SPICE_MSGC_DISPLAY_PREFERRED_VIDEO_CODEC_TYPE),wdi.currentCodec=e,console.log(`codec changed: ${e}`)},connect:function(e,i,t,s){var a=wdi.Utils.generateWebSocketUrl(e.protocol,e.host,e.port,e.vmHost,e.vmPort,"spice",e.vmInfoToken,e.vmid);this.channel=i,this.connectionId=t||0,this.socketQ.connect(a),this.proxy=s,this.token=e.token,this.packetReassembler.start()},disconnect:function(){wdi.Debug.log("spicechannel disconnect"),this.counter=0,this.ackWindow=0,this.connectionId=0,this.socketQ.disconnect(),this.socketQ=null,this.packetReassembler.dispose(),this.packetReassembler=null,this.channel=1,this.proxy=null,this.token=null},send:function(e,i){this.socketQ.send(e,i)},sendObject:function(e,i,t){for(var s=0;s<e.length;s+=2048){var a=e.slice(s,s+2048),n=new wdi.SpiceDataHeader({type:i,size:a.length}).marshall();n=n.concat(a),this.send(n,t)}},arrayOfNumberToUint32:function(e){let i=0;for(let t of e)i|=1<<t;return i},setAckWindow:function(e){this.ackWindow=e,this.counter=0},getRawSpiceMessage:function(e){var i=wdi.GlobalPool.create("ViewQueue"),t=wdi.GlobalPool.create("ViewQueue"),s=new Uint8Array(e,0,wdi.SpiceDataHeader.prototype.objectSize);i.setData(s);var a=(new wdi.SpiceDataHeader).demarshall(i);wdi.GlobalPool.discard("ViewQueue",i);var n=e.subarray(wdi.SpiceDataHeader.prototype.objectSize);if(t.setData(n),this.counter++,this.ackWindow&&this.counter===this.ackWindow){this.counter=0;var c=new wdi.SpiceDataHeader({type:wdi.SpiceVars.SPICE_MSGC_ACK,size:0}).marshall();this.send(c)}var o=wdi.PacketLinkFactory.extract(a,t)||!1;if(o)return wdi.PacketLinkProcess.process(a,o,this),wdi.GlobalPool.discard("ViewQueue",t),!1;var r=wdi.GlobalPool.create("RawSpiceMessage");return r.set(a,t,this.channel),r},getRedLinkReplyBytes:function(e){if(this.token){var i=new wdi.ViewQueue;i.setData(e),i.eatBytes(wdi.SpiceLinkHeader.prototype.objectSize);var t=(new wdi.SpiceLinkReply).demarshall(i);return wdi.SpiceObject.stringHexToBytes(RSA_public_encrypt(this.token,t.pub_key))}return wdi.SpiceObject.stringToBytesPadding("",128)},getRedLinkMessBytes:function(){var e=new wdi.SpiceLinkHeader({magic:1363428690,major_version:2,minor_version:2,size:26}).marshall(),i=new wdi.SpiceLinkMess({connection_id:this.connectionId,channel_type:this.channel,caps_offset:18,num_common_caps:1,num_channel_caps:1,common_caps:1<<wdi.SpiceVars.SPICE_COMMON_CAP_MINI_HEADER,channel_caps:this.arrayOfNumberToUint32([wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_SIZED_STREAM,wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_STREAM_REPORT,wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_MONITORS_CONFIG,wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_MULTI_CODEC,wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_PREF_VIDEO_CODEC_TYPE,wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_CODEC_MJPEG,wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_CODEC_VP8,wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_CODEC_H264,wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_CODEC_VP9,wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_CODEC_H265,wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_LZ4_COMPRESSION,wdi.SpiceDisplayCaps.SPICE_DISPLAY_CAP_PREF_COMPRESSION])}).marshall();return e.concat(i)},getErrorCodeBytes:function(e){var i=wdi.GlobalPool.create("ViewQueue");i.setData(e);var t=wdi.SpiceObject.bytesToInt32NoAllocate(i);if(wdi.GlobalPool.discard("ViewQueue",i),0!==t)throw new wdi.Exception({message:"Server refused client",errorCode:2});if(this.channel===wdi.SpiceVars.SPICE_CHANNEL_DISPLAY){var s=new wdi.SpiceDataHeader({type:wdi.SpiceVars.SPICE_MSGC_DISPLAY_INIT,size:14}).marshall(),a=new wdi.SpiceCDisplayInit({pixmap_cache_id:1,pixmap_cache_size:1,glz_dictionary_id:0,glz_dictionary_window_size:0}).marshall();return s.concat(a)}if(this.channel==wdi.SpiceVars.SPICE_CHANNEL_MAIN)return new wdi.SpiceDataHeader({type:wdi.SpiceVars.SPICE_MSGC_MAIN_ATTACH_CHANNELS,size:0}).marshall()}});
63
127
  wdi.BusConnection=$.spcExtend(wdi.EventObject.prototype,{ws:null,subscriptions:[],_busUser:null,_busPass:null,queue:"",binary:!1,init:function(s){this.superInit(),this.ws=s.websocket||new wdi.WebSocketWrapper,this.clusterNodeChooser=s.clusterNodeChooser||new wdi.ClusterNodeChooser,this.binary=s.binary||!1},connect:function(s){s.useBus?(this._vdiBusToken=s.vdiBusToken,s.busHostList||(wdi.Debug.warn("Deprecated: using old busHost & busPort params"),s.busHostList=[{host:s.busHost,port:s.busPort}]),this.clusterNodeChooser.setNodeList(s.busHostList),Modernizr.websocketsbinary&&(this.binary=!0),this._busUser=s.busUser,this._busPass=s.busPass,this._websockifyProtocol=s.protocol,this._websockifyHost=s.host,this._websockifyPort=s.port,this.subscriptions=s.busSubscriptions,this._connectToNextHost()):wdi.Debug.warn("Not using the bus")},_connectToNextHost:function(){var s=this.clusterNodeChooser.getAnother(),t=wdi.Utils.generateWebSocketUrl(this._websockifyProtocol,this._websockifyHost,this._websockifyPort,s.host,s.port,"raw",this._vdiBusToken),e="base64";this.binary&&(e="binary"),this.ws.connect(t,e),wdi.Debug.log("BusConnection: using protocol: "+e),this.binary&&this.ws.setBinaryType("arraybuffer"),this.setListeners()},disconnect:function(){this.ws.close(),this.queue="",this.subscriptions=[]},setListeners:function(){var s=this;this.ws.onOpen((function(t){s._send("CONNECT\nlogin:"+s._busUser+"\npasscode:"+s._busPass+"\n\n\0")})),this.ws.onMessage((function(t){var e,n;s.binary?(e=String.fromCharCode.apply(null,new Uint8Array(t.data)),e=decodeURIComponent(escape(e))):e=Base64.decodeStr(t.data);var i=e.split("\0");if(1==i.length)s.queue+=i[0];else{for(var o=0;o<i.length-1;o++)e=s.queue+i[o],n=s.parseMessage(e),s.fire("busMessage",n),s.queue="";s.queue=i[i.length-1]}})),this.ws.onClose((function(t){wdi.Debug.log("BusConnection CLOSED! connecting again in 1 second"),s.fire("error",t)})),this.ws.onError((function(s){wdi.Debug.error("BusConnection ERROR:",s)}))},parseMessage:function(s){try{var t=s.split("\n\n"),e=t[0].trim(),n=t[1].replace(/\x00/,"").trim();n=0!=n.length?JSON.parse(n):null;var i=(t=e.split("\n")).shift();e="{";for(var o=t.length,r=0;r<o;r++){var u=t[r].split(":")[0];e+='"'+u+'":"'+t[r].replace(u+":","")+'"',r!=o-1&&(e+=",")}return e+="}",{verb:i,header:JSON.parse(e),body:n}}catch(s){return wdi.Debug.error("Error parsing Bus Info: ",s),{verb:"ERROR"}}},setSubscriptions:function(){for(var s=this.subscriptions.length,t=0;t<s;t++)this.subscribe(this.subscriptions[t])},send:function(s){var t=this.subscriptions[0];this._send("SEND\ndestination:"+t+"\ncontent-type:text/plain\n\n"+JSON.stringify(s)+"\0")},subscribe:function(s){this._send("SUBSCRIBE\ndestination:"+s+"\n\n\0")},_send:function(s){this.binary?this.ws.send(s):this.ws.send(Base64.encodeStr(s))}});
64
128
  wdi.WebSocketWrapper=$.spcExtend({},{ws:{},onopen:null,onmessage:null,onclose:null,onerror:null,init:function(){},connect:function(n,o){this.ws=new WebSocket(n,o)},onOpen:function(n){this.ws.onopen=n},onMessage:function(n){this.ws.onmessage=n},onClose:function(n){this.ws.onclose=n},onError:function(n){this.ws.onerror=n},setBinaryType:function(n){this.ws.binaryType=n},close:function(){this.ws&&this.ws.close&&(this.ws.close(),this.ws.onopen=function(){},this.ws.onmessage=function(){},this.ws.onclose=function(){},this.ws.onerror=function(){},this.onopen=function(){},this.onmessage=function(){},this.onclose=function(){},this.onerror=function(){})},send:function(n){this.ws.send(n)}});
65
129
  wdi.ConnectionControl=$.spcExtend(wdi.EventObject.prototype,{socket:null,pendingTimeToConnectionLost:null,previousTimeOut:null,init:function(t){this.superInit(),this.socket=t.socket||new wdi.Socket},connect:function(t){var n=wdi.Utils.generateWebSocketUrl(t.protocol,t.host,t.port,null,null,"raw",t.heartbeatToken);this.socket.connect(n),this.pendingTimeToConnectionLost=t.heartbeatTimeout,wdi.Debug.log("ConnectionControl: connected"),this.setListeners()},disconnect:function(){wdi.Debug.log("Connection Control disconnect"),this.previousTimeOut&&clearTimeout(this.previousTimeOut),this.socket.disconnect(),this.socket=null,this.pendingTimeToConnectionLost=null,this.previousTimeOut=null},setListeners:function(){var t=this;this.socket.setOnMessageCallback((function(n){wdi.Debug.log("ConectionControl: beat"),clearTimeout(t.previousTimeOut),t.previousTimeOut=setTimeout((function(){wdi.Debug.log("ConnectionControl: firing connectionLost event"),t.fire("connectionLost",n)}),t.pendingTimeToConnectionLost)}))}});
@@ -92,7 +156,4 @@ wdi.KeymapES=function(){var e={Backquote:[[5,0,0,0],[133,0,0,0]],Digit1:[[2,0,0,
92
156
  wdi.scanCodeObjProvider=$.spcExtend(wdi.EventObject.prototype,{init:function(t){this.charObj=t},getPrefix:function(){return this.prefix},getSufix:function(){return this.suffix},setPrefix:function(t){},setSuffix:function(t){},getScanCode:function(){var t=[],i=this.charObj.main;return t=t.concat(i)}});
93
157
  wdi.ScanCodeObjModifier=$.spcExtend(wdi.EventObject.prototype,{SHIFTDOWN:[42,0,0,0],SHIFTUP:[170,0,0,0],init:function(n){this.scanCodeObjProvider=new wdi.scanCodeObjProvider(n),this.prefix=[],this.suffix=[]},removeShift:function(){return this.getScanCode()},containsShiftDown:function(){return!1},addShiftUp:function(){},addShiftDown:function(){},getScanCode:function(){return this.scanCodeObjProvider.getScanCode()},_removeKeyFromPart:function(n,t){return t.filter((function(t){return!_.isEqual(t,n)}))}});
94
158
  wdi.KeymapObjES=function(){var i={Backquote:{prefix:[],main:[[41,0,0,0],[169,0,0,0]],suffix:[]},Digit1:{prefix:[],main:[[2,0,0,0],[130,0,0,0]],suffix:[]},Digit2:{prefix:[],main:[[3,0,0,0],[131,0,0,0]],suffix:[]},Digit3:{prefix:[],main:[[4,0,0,0],[132,0,0,0]],suffix:[]},Digit4:{prefix:[],main:[[5,0,0,0],[133,0,0,0]],suffix:[]},Digit5:{prefix:[],main:[[6,0,0,0],[134,0,0,0]],suffix:[]},Digit6:{prefix:[],main:[[7,0,0,0],[135,0,0,0]],suffix:[]},Digit7:{prefix:[],main:[[8,0,0,0],[136,0,0,0]],suffix:[]},Digit8:{prefix:[],main:[[9,0,0,0],[137,0,0,0]],suffix:[]},Digit9:{prefix:[],main:[[10,0,0,0],[138,0,0,0]],suffix:[]},Digit0:{prefix:[],main:[[11,0,0,0],[139,0,0,0]],suffix:[]},Minus:{prefix:[],main:[[12,0,0,0],[140,0,0,0]],suffix:[]},Equal:{prefix:[],main:[[13,0,0,0],[141,0,0,0]],suffix:[]},KeyQ:{prefix:[],main:[[16,0,0,0],[144,0,0,0]],suffix:[]},KeyW:{prefix:[],main:[[17,0,0,0],[145,0,0,0]],suffix:[]},KeyE:{prefix:[],main:[[18,0,0,0],[146,0,0,0]],suffix:[]},KeyR:{prefix:[],main:[[19,0,0,0],[147,0,0,0]],suffix:[]},KeyT:{prefix:[],main:[[20,0,0,0],[148,0,0,0]],suffix:[]},KeyY:{prefix:[],main:[[21,0,0,0],[149,0,0,0]],suffix:[]},KeyU:{prefix:[],main:[[22,0,0,0],[150,0,0,0]],suffix:[]},KeyI:{prefix:[],main:[[23,0,0,0],[151,0,0,0]],suffix:[]},KeyO:{prefix:[],main:[[24,0,0,0],[152,0,0,0]],suffix:[]},KeyP:{prefix:[],main:[[25,0,0,0],[153,0,0,0]],suffix:[]},BracketLeft:{prefix:[],main:[[26,0,0,0],[154,0,0,0]],suffix:[]},BracketRight:{prefix:[],main:[[27,0,0,0],[155,0,0,0]],suffix:[]},Backslash:{prefix:[],main:[[43,0,0,0],[171,0,0,0]],suffix:[]},KeyA:{prefix:[],main:[[30,0,0,0],[158,0,0,0]],suffix:[]},KeyS:{prefix:[],main:[[31,0,0,0],[159,0,0,0]],suffix:[]},KeyD:{prefix:[],main:[[32,0,0,0],[160,0,0,0]],suffix:[]},KeyF:{prefix:[],main:[[33,0,0,0],[161,0,0,0]],suffix:[]},KeyG:{prefix:[],main:[[34,0,0,0],[162,0,0,0]],suffix:[]},KeyH:{prefix:[],main:[[35,0,0,0],[163,0,0,0]],suffix:[]},KeyJ:{prefix:[],main:[[36,0,0,0],[164,0,0,0]],suffix:[]},KeyK:{prefix:[],main:[[37,0,0,0],[165,0,0,0]],suffix:[]},KeyL:{prefix:[],main:[[38,0,0,0],[166,0,0,0]],suffix:[]},Semicolon:{prefix:[],main:[[39,0,0,0],[167,0,0,0]],suffix:[]},Quote:{prefix:[],main:[[40,0,0,0],[168,0,0,0]],suffix:[]},KeyZ:{prefix:[],main:[[44,0,0,0],[172,0,0,0]],suffix:[]},KeyX:{prefix:[],main:[[45,0,0,0],[173,0,0,0]],suffix:[]},KeyC:{prefix:[],main:[[46,0,0,0],[174,0,0,0]],suffix:[]},KeyV:{prefix:[],main:[[47,0,0,0],[175,0,0,0]],suffix:[]},KeyB:{prefix:[],main:[[48,0,0,0],[176,0,0,0]],suffix:[]},KeyN:{prefix:[],main:[[49,0,0,0],[177,0,0,0]],suffix:[]},KeyM:{prefix:[],main:[[50,0,0,0],[178,0,0,0]],suffix:[]},Comma:{prefix:[],main:[[51,0,0,0],[179,0,0,0]],suffix:[]},Period:{prefix:[],main:[[52,0,0,0],[180,0,0,0]],suffix:[]},Slash:{prefix:[],main:[[53,0,0,0],[181,0,0,0]],suffix:[]},Numpad0:{prefix:[],main:[[11,0,0,0],[139,0,0,0]],suffix:[]},Numpad1:{prefix:[],main:[[2,0,0,0],[130,0,0,0]],suffix:[]},Numpad2:{prefix:[],main:[[3,0,0,0],[131,0,0,0]],suffix:[]},Numpad3:{prefix:[],main:[[4,0,0,0],[132,0,0,0]],suffix:[]},Numpad4:{prefix:[],main:[[5,0,0,0],[133,0,0,0]],suffix:[]},Numpad5:{prefix:[],main:[[6,0,0,0],[134,0,0,0]],suffix:[]},Numpad6:{prefix:[],main:[[7,0,0,0],[135,0,0,0]],suffix:[]},Numpad7:{prefix:[],main:[[8,0,0,0],[136,0,0,0]],suffix:[]},Numpad8:{prefix:[],main:[[9,0,0,0],[137,0,0,0]],suffix:[]},Numpad9:{prefix:[],main:[[10,0,0,0],[138,0,0,0]],suffix:[]},NumpadDivide:{prefix:[],main:[[53,0,0,0],[181,0,0,0]],suffix:[]},NumpadMultiply:{prefix:[],main:[[55,0,0,0],[183,0,0,0]],suffix:[]},NumpadSubtract:{prefix:[],main:[[74,0,0,0],[202,0,0,0]],suffix:[]},NumpadAdd:{prefix:[],main:[[78,0,0,0],[206,0,0,0]],suffix:[]},NumpadDecimal:{prefix:[],main:[[52,0,0,0],[180,0,0,0]],suffix:[]}};return{getScanCode:function(i){return new wdi.scanCodeObjProvider(this.getCharmap()[i]).getScanCode()},getCharmap:function(){return i}}}();
95
- wdi.KeymapUS=function(){var e=[];e.Backquote=[[5,0,0,0],[133,0,0,0]],e.Digit1=[[2,0,0,0],[130,0,0,0]],e.Digit2=[[3,0,0,0],[131,0,0,0]],e.Digit3=[[4,0,0,0],[132,0,0,0]],e.Digit4=[[5,0,0,0],[133,0,0,0]],e.Digit5=[[6,0,0,0],[134,0,0,0]],e.Digit6=[[7,0,0,0],[135,0,0,0]],e.Digit7=[[8,0,0,0],[136,0,0,0]],e.Digit8=[[9,0,0,0],[137,0,0,0]],e.Digit9=[[10,0,0,0],[138,0,0,0]],e.Digit0=[[11,0,0,0],[139,0,0,0]],e.Minus=[[53,0,0,0],[181,0,0,0]],e.Equal=[[11,0,0,0],[139,0,0,0]],e.KeyQ=[[16,0,0,0],[144,0,0,0]],e.KeyW=[[17,0,0,0],[145,0,0,0]],e.KeyE=[[18,0,0,0],[146,0,0,0]],e.KeyR=[[19,0,0,0],[147,0,0,0]],e.KeyT=[[20,0,0,0],[148,0,0,0]],e.KeyY=[[21,0,0,0],[149,0,0,0]],e.KeyU=[[22,0,0,0],[150,0,0,0]],e.KeyI=[[23,0,0,0],[151,0,0,0]],e.KeyO=[[24,0,0,0],[152,0,0,0]],e.KeyP=[[25,0,0,0],[153,0,0,0]],e.BracketLeft=[[26,0,0,0],[154,0,0,0]],e.BracketRight=[[27,0,0,0],[155,0,0,0]],e.Backslash=[[41,0,0,0],[169,0,0,0]],e.KeyA=[[30,0,0,0],[158,0,0,0]],e.KeyS=[[31,0,0,0],[159,0,0,0]],e.KeyD=[[32,0,0,0],[160,0,0,0]],e.KeyF=[[33,0,0,0],[161,0,0,0]],e.KeyG=[[34,0,0,0],[162,0,0,0]],e.KeyH=[[35,0,0,0],[163,0,0,0]],e.KeyJ=[[36,0,0,0],[164,0,0,0]],e.KeyK=[[37,0,0,0],[165,0,0,0]],e.KeyL=[[38,0,0,0],[166,0,0,0]],e.Semicolon=[[51,0,0,0],[179,0,0,0]],e.Quote=[[12,0,0,0],[140,0,0,0]],e.KeyZ=[[44,0,0,0],[172,0,0,0]],e.KeyX=[[45,0,0,0],[173,0,0,0]],e.KeyC=[[46,0,0,0],[174,0,0,0]],e.KeyV=[[47,0,0,0],[175,0,0,0]],e.KeyB=[[48,0,0,0],[176,0,0,0]],e.KeyN=[[49,0,0,0],[177,0,0,0]],e.KeyM=[[50,0,0,0],[178,0,0,0]],e.Comma=[[51,0,0,0],[179,0,0,0]],e.Period=[[52,0,0,0],[180,0,0,0]],e.Slash=[[53,0,0,0],[181,0,0,0]],e.Numpad0=[[11,0,0,0],[139,0,0,0]],e.Numpad1=[[2,0,0,0],[130,0,0,0]],e.Numpad2=[[3,0,0,0],[131,0,0,0]],e.Numpad3=[[4,0,0,0],[132,0,0,0]],e.Numpad4=[[5,0,0,0],[133,0,0,0]],e.Numpad5=[[6,0,0,0],[134,0,0,0]],e.Numpad6=[[7,0,0,0],[135,0,0,0]],e.Numpad7=[[8,0,0,0],[136,0,0,0]],e.Numpad8=[[9,0,0,0],[137,0,0,0]],e.Numpad9=[[10,0,0,0],[138,0,0,0]],e.NumpadDivide=[[53,0,0,0],[181,0,0,0]],e.NumpadMultiply=[[55,0,0,0],[183,0,0,0]],e.NumpadSubtract=[[74,0,0,0],[202,0,0,0]],e.NumpadAdd=[[78,0,0,0],[206,0,0,0]],e.NumpadDecimal=[[52,0,0,0],[180,0,0,0]];var t=[];t[27]=1,t[9]=15,t[20]=58,t[16]=42,t[91]=29,t[17]=29,t[32]=57,t[8]=14,t[13]=28,t[18]=56,t[92]=92,t[93]=93,t[38]=72,t[37]=75,t[40]=80,t[39]=77,t[45]=82,t[46]=83,t[36]=71,t[35]=79,t[33]=73,t[34]=81,t[144]=69,t[145]=70,t[112]=59,t[113]=60,t[114]=61,t[115]=62,t[116]=63,t[117]=64,t[118]=65,t[119]=66,t[120]=67,t[121]=68,t[122]=87,t[123]=88;var a=[];a[65]=30,a[81]=16,a[87]=17,a[69]=18,a[82]=19,a[84]=20,a[89]=21,a[85]=22,a[73]=23,a[79]=24,a[80]=25,a[65]=30,a[83]=31,a[68]=32,a[70]=33,a[71]=34,a[72]=35,a[74]=36,a[75]=37,a[76]=38,a[90]=44,a[88]=45,a[67]=46,a[86]=47,a[66]=48,a[78]=49,a[77]=50;var i=[];i[9]=15;var u=[];return u[81]=16,u[87]=17,u[69]=18,u[82]=19,u[84]=20,u[89]=21,u[85]=22,u[73]=23,u[79]=24,u[80]=25,u[65]=30,u[83]=31,u[68]=32,u[70]=33,u[71]=34,u[72]=35,u[74]=36,u[75]=37,u[76]=38,u[88]=45,u[90]=44,u[86]=47,u[67]=46,u[66]=48,u[78]=49,u[77]=50,{getKeymap:function(){return t},getCtrlKeymap:function(){return a},getCtrlForbiddenKeymap:function(){return i},getReservedCtrlKeymap:function(){return u},getCharmap:function(){return e},setCtrlKey:function(e,t){a[e]=t}}}();
96
- wdi.keyShortcutsHandled={CTRLV:0,CTRLC:1},wdi.Keymap={keymap:{},ctrlKeymap:{},ctrlForbiddenKeymap:{},charmap:{},ctrlPressed:!1,capsLock:!1,numLock:!1,isVirtualKeyboard:!1,isVirtualCapsLockOn:!1,twoBytesScanCodes:[91,219,92,220,29,157,93,221,82,210,83,211,75,203,71,201,79,207,72,200,80,208,73,201,81,209,77,205,28,156],loadKeyMap:function(e,t){try{this.keymap=wdi["Keymap"+e.toUpperCase()].getKeymap(),this.ctrlKeymap=wdi["Keymap"+e.toUpperCase()].getCtrlKeymap(),this.ctrlForbiddenKeymap=wdi["Keymap"+e.toUpperCase()].getCtrlForbiddenKeymap(),this.reservedCtrlKeymap=wdi["Keymap"+e.toUpperCase()].getReservedCtrlKeymap(),this.charmap=wdi["KeymapObj"+e.toUpperCase()].getCharmap(),this.stuckKeysHandler=t}catch(e){this.keymap=wdi.KeymapES.getKeymap(),this.ctrlKeymap=wdi.KeymapES.getCtrlKeymap(),this.ctrlForbiddenKeymap=wdi.KeymapES.getCtrlForbiddenKeymap(),this.reservedCtrlKeymap=wdi.KeymapES.getReservedCtrlKeymap(),this.charmap=wdi.KeymapObjES.getCharmap(),this.stuckKeysHandler=t}},isInKeymap:function(e){return void 0!==this.keymap[e]},getScanCodes:function(e){return e.hasScanCode?e.scanCode:this.isForbiddenCombination(e)?[]:this.isGeneratedShortcut(e.type,e.keyCode,e.generated)?this.getScanCodeFromKeyCode(e.keyCode,e.type,this.ctrlKeymap,this.reservedCtrlKeymap):this.handledByCharmap(e.type)&&e.originalEvent?this.getScanCodesFromCharCode(e.originalEvent.code):this.handledByNormalKeyCode(e.type,e.keyCode)?this.getScanCodeFromKeyCode(e.keyCode,e.type,this.keymap):[]},getScanCodeFromKeyCode:function(e,t,r,i){this.controlPressed(e,t);var a=null;if(void 0===(a=e in r?r[e]:i[e]))return[];if(a<256){if("keydown"==t)return[this.makeKeymap(a)];if("keyup"==t)return[this.makeKeymap(128|a)]}else{if("keydown"==t)return[this.makeKeymap(224|a-256<<8)];if("keyup"==t)return[this.makeKeymap(32992|a-256<<8)]}return a},isForbiddenCombination:function(e){var t=e.keyCode,r=(e.type,this.ctrlForbiddenKeymap);return!!(wdi.KeyEvent.isCtrlPressed(e)&&r[t]&&r[t])},controlPressed:function(e,t,r){if(17===e&&(this.ctrlPressed="keydown"===t),!r)return!1;17!==e&&91!==e&&("keydown"===t?wdi.KeyEvent.isCtrlPressed(r)&&(this.ctrlPressed=!0):"keyup"===t&&(wdi.KeyEvent.isCtrlPressed(r)||(this.ctrlPressed=!1)))},handledByCtrlKeyCode:function(e,t,r){if(("keydown"===e||"keyup"===e||"keypress"===e)&&this.ctrlPressed){if("keypress"===e)return!0;if(this.ctrlKeymap[t])return!0;if(r&&this.reservedCtrlKeymap[t])return!0}return!1},isGeneratedShortcut:function(e,t,r){if(("keydown"===e||"keyup"===e||"keypress"===e)&&this.ctrlPressed){if("keypress"===e)return!0;if(this.ctrlKeymap[t])return!0;if(r&&this.reservedCtrlKeymap[t])return!0}return!1},handledByNormalKeyCode:function(e,t){return!("keydown"!==e&&"keyup"!==e||!this.keymap[t])},handledByCharmap:function(e){return"inputmanager"===e},getScanCodesFromCharCode:function(e){var t=this.charmap[e];return new wdi.ScanCodeObjModifier(t).getScanCode()},makeKeymap:function(e){return-1!=$.inArray(e,this.twoBytesScanCodes)?[224,e,0,0]:[e,0,0]}};
97
-
98
- const getURLParameter=e=>{const o=new RegExp(`${e}=([^&]+)`).exec(window.location.pathname);return o&&o[1]};let vmHost=window.location.hostname;"localhost"===vmHost&&(vmHost="10.10.101.107");const vmId=getURLParameter("id"),vmPort=window.config.public.PORT;function start(){wdi.graphicDebug=new wdi.GraphicDebug({debugMode:!1});let e,o,t=!1;$(window).resize((function(){app.sendCommand("setResolution",app.toSpiceResolution({width:$(window).width(),height:$(window).height()}))}));const n={callback:function(n,i){if("windowClosed"===n)$(i.canvas).remove(),$(i.eventLayer).remove();else if("windowMoved"===n)$(i.canvas).css({top:i.info.top+"px",left:i.info.left+"px"}),$(i.eventLayer).css({top:i.info.top+"px",left:i.info.left+"px"});else if("init"===n||"windowCreated"===n){let e=null,o=null,t=null;const n=$("body");for(let s in i){e=i[s];const a=2*e.position;o=$(e.canvas).css({zIndex:1e4-a-1,position:"absolute",top:e.info.top+"px",left:e.info.left+"px"}),t=$(e.eventLayer).css({top:e.info.top+"px",left:e.info.left+"px",zIndex:1e4-a}),n.append(o),n.append(t)}}else if("ready"===n){app.setReconnecting(!1),o?.clearTimeout&&(o(),o=!1);const e=$(window).width(),t=$(window).height();app.sendCommand("setResolution",app.toSpiceResolution({width:e,height:t})),wdi.IntegrationBenchmarkEnabled&&($("#integrationBenchmark").css({display:"inline"}),$("#launchWordButton").prop("disabled",!1))}else"resolution"===n||("windowMinimized"===n?($(i.canvas).css({display:"none"}),$(i.eventLayer).css({display:"none"})):"windowMaximized"===n?($(i.canvas).css({top:i.info.top+"px",left:i.info.left+"px"}),$(i.eventLayer).css({top:i.info.top+"px",left:i.info.left+"px"})):"windowRestored"===n?($(i.canvas).css({display:"block"}),$(i.eventLayer).css({display:"block"}),$(i.canvas).css({top:i.info.top+"px",left:i.info.left+"px"}),$(i.eventLayer).css({top:i.info.top+"px",left:i.info.left+"px"})):"windowFocused"===n||("timeLapseDetected"===n?wdi.Debug.log("Detected time lapse of ",i,"seconds"):"error"===n&&(app.getReconnecting()||(e||(e=setTimeout((function(){console.log("cancelFreeze"),app.cancelFreeze()}),1e4)),o||(o=setTimeout((function(){console.log("cancel reconnection"),t=!0}),6e4))),setTimeout((function(){t||(console.log("Trying reconnect ",Date.now()),app.reconnect({freeze:!0}))}),1e3))))},context:this,host:vmHost,port:vmPort,protocol:"wss",token:"password",vmHost:vmHost,vmPort:vmPort,vmid:vmId,useBus:!1,busHost:"localhost",busPort:61613,busSubscriptions:["/topic/00000000-0000-0000-0000-000000000000"],busUser:"00000000-0000-0000-0000-000000000000",busPass:"potato",layout:"es",useWorkers:!0,seamlessDesktopIntegration:!1,connectionControl:!1,heartbeatToken:"heartbeat",heartbeatTimeout:4e3,externalClipboardHandling:!1,disableClipboard:!1,layer:document.getElementById("vmw"),disableMessageBuffering:!0,clientOffset:{x:0,y:0}};app.run(n)}window.app=new Application({supportHighDPI:!1}),$(document).ready(start);
159
+ wdi.KeymapUS=function(){var e=[];e.Backquote=[[5,0,0,0],[133,0,0,0]],e.Digit1=[[2,0,0,0],[130,0,0,0]],e.Digit2=[[3,0,0,0],[131,0,0,0]],e.Digit3=[[4,0,0,0],[132,0,0,0]],e.Digit4=[[5,0,0,0],[133,0,0,0]],e.Digit5=[[6,0,0,0],[134,0,0,0]],e.Digit6=[[7,0,0,0],[135,0,0,0]],e.Digit7=[[8,0,0,0],[136,0,0,0]],e.Digit8=[[9,0,0,0],[137,0,0,0]],e.Digit9=[[10,0,0,0],[138,0,0,0]],e.Digit0=[[11,0,0,0],[139,0,0,0]],e.Minus=[[53,0,0,0],[181,0,0,0]],e.Equal=[[11,0,0,0],[139,0,0,0]],e.KeyQ=[[16,0,0,0],[144,0,0,0]],e.KeyW=[[17,0,0,0],[145,0,0,0]],e.KeyE=[[18,0,0,0],[146,0,0,0]],e.KeyR=[[19,0,0,0],[147,0,0,0]],e.KeyT=[[20,0,0,0],[148,0,0,0]],e.KeyY=[[21,0,0,0],[149,0,0,0]],e.KeyU=[[22,0,0,0],[150,0,0,0]],e.KeyI=[[23,0,0,0],[151,0,0,0]],e.KeyO=[[24,0,0,0],[152,0,0,0]],e.KeyP=[[25,0,0,0],[153,0,0,0]],e.BracketLeft=[[26,0,0,0],[154,0,0,0]],e.BracketRight=[[27,0,0,0],[155,0,0,0]],e.Backslash=[[41,0,0,0],[169,0,0,0]],e.KeyA=[[30,0,0,0],[158,0,0,0]],e.KeyS=[[31,0,0,0],[159,0,0,0]],e.KeyD=[[32,0,0,0],[160,0,0,0]],e.KeyF=[[33,0,0,0],[161,0,0,0]],e.KeyG=[[34,0,0,0],[162,0,0,0]],e.KeyH=[[35,0,0,0],[163,0,0,0]],e.KeyJ=[[36,0,0,0],[164,0,0,0]],e.KeyK=[[37,0,0,0],[165,0,0,0]],e.KeyL=[[38,0,0,0],[166,0,0,0]],e.Semicolon=[[51,0,0,0],[179,0,0,0]],e.Quote=[[12,0,0,0],[140,0,0,0]],e.KeyZ=[[44,0,0,0],[172,0,0,0]],e.KeyX=[[45,0,0,0],[173,0,0,0]],e.KeyC=[[46,0,0,0],[174,0,0,0]],e.KeyV=[[47,0,0,0],[175,0,0,0]],e.KeyB=[[48,0,0,0],[176,0,0,0]],e.KeyN=[[49,0,0,0],[177,0,0,0]],e.KeyM=[[50,0,0,0],[178,0,0,0]],e.Comma=[[51,0,0,0],[179,0,0,0]],e.Period=[[52,0,0,0],[180,0,0,0]],e.Slash=[[53,0,0,0],[181,0,0,0]],e.Numpad0=[[11,0,0,0],[139,0,0,0]],e.Numpad1=[[2,0,0,0],[130,0,0,0]],e.Numpad2=[[3,0,0,0],[131,0,0,0]],e.Numpad3=[[4,0,0,0],[132,0,0,0]],e.Numpad4=[[5,0,0,0],[133,0,0,0]],e.Numpad5=[[6,0,0,0],[134,0,0,0]],e.Numpad6=[[7,0,0,0],[135,0,0,0]],e.Numpad7=[[8,0,0,0],[136,0,0,0]],e.Numpad8=[[9,0,0,0],[137,0,0,0]],e.Numpad9=[[10,0,0,0],[138,0,0,0]],e.NumpadDivide=[[53,0,0,0],[181,0,0,0]],e.NumpadMultiply=[[55,0,0,0],[183,0,0,0]],e.NumpadSubtract=[[74,0,0,0],[202,0,0,0]],e.NumpadAdd=[[78,0,0,0],[206,0,0,0]],e.NumpadDecimal=[[52,0,0,0],[180,0,0,0]];var t=[];t[27]=1,t[9]=15,t[20]=58,t[16]=42,t[91]=29,t[17]=29,t[32]=57,t[8]=14,t[13]=28,t[18]=56,t[92]=92,t[93]=93,t[38]=72,t[37]=75,t[40]=80,t[39]=77,t[45]=82,t[46]=83,t[36]=71,t[35]=79,t[33]=73,t[34]=81,t[144]=69,t[145]=70,t[112]=59,t[113]=60,t[114]=61,t[115]=62,t[116]=63,t[117]=64,t[118]=65,t[119]=66,t[120]=67,t[121]=68,t[122]=87,t[123]=88;var a=[];a[65]=30,a[81]=16,a[87]=17,a[69]=18,a[82]=19,a[84]=20,a[89]=21,a[85]=22,a[73]=23,a[79]=24,a[80]=25,a[65]=30,a[83]=31,a[68]=32,a[70]=33,a[71]=34,a[72]=35,a[74]=36,a[75]=37,a[76]=38,a[90]=44,a[88]=45,a[67]=46,a[86]=47,a[66]=48,a[78]=49,a[77]=50;var i=[];i[9]=15;var u=[];return u[81]=16,u[87]=17,u[69]=18,u[82]=19,u[84]=20,u[89]=21,u[85]=22,u[73]=23,u[79]=24,u[80]=25,u[65]=30,u[83]=31,u[68]=32,u[70]=33,u[71]=34,u[72]=35,u[74]=36,u[75]=37,u[76]=38,u[88]=45,u[90]=44,u[86]=47,u[67]=46,u[66]=48,u[78]=49,u[77]=50,{getKeymap:function(){return t},getCtrlKeymap:function(){return a},getCtrlForbiddenKeymap:function(){return i},getReservedCtrlKeymap:function(){return u},getCharmap:function(){return e},setCtrlKey:function(e,t){a[e]=t}}}();