Guest User

Untitled

a guest
Oct 14th, 2019
800
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function init() {
  2.     "undefined" == typeof userConfig || null === userConfig ? RDP_EPUB.config = {
  3.         fontSize: 18,
  4.         background: "#fff",
  5.         fontFamily: "Times New Roman",
  6.         color: "#000"
  7.     } : RDP_EPUB.config = {
  8.         fontSize: userConfig.fontSize,
  9.         background: userConfig.background,
  10.         fontFamily: userConfig.fontFamily,
  11.         color: userConfig.color
  12.     },
  13.     localStorage.setItem("rdp-reader-bv3", JSON.stringify(RDP_EPUB.config))
  14. }
  15. function newReader(a, b, c) {
  16.     parseEdition(a, b, c)
  17. }
  18. function parseEdition(a, b, c) {
  19.     $.ajax({
  20.         type: "GET",
  21.         url: a + "&token=" + b + "&timestamp=" + c,
  22.         dataType: "json",
  23.         success: function(a) {
  24.             initEpub(a.epub[0].basePath)
  25.         }
  26.     })
  27. }
  28. function initEpub(a) {
  29.     EPUBJS.cssPath = "css/";
  30.     ePubReader(a, {
  31.         reload: !1,
  32.         generatePagination: !1,
  33.         offline: !0,
  34.         minSpreadWidth: 3e3
  35.     })
  36. }
  37. function setBackground() {
  38.     $("#main").css("background", RDP_EPUB.config.background),
  39.     $("#main, #titlebar a, #metainfo").css("color", RDP_EPUB.config.color),
  40.     $("#titlebar a").css("opacity", "1"),
  41.     $("iframe").contents().find("body, p, a, span").css({
  42.         background: RDP_EPUB.config.background,
  43.         color: RDP_EPUB.config.color
  44.     }),
  45.     null != userConfig && (userConfig.background = RDP_EPUB.config.background,
  46.     userConfig.color = RDP_EPUB.config.color,
  47.     localStorage.setItem("rdp-reader-bv3", JSON.stringify(userConfig)))
  48. }
  49. function setFontFamily() {
  50.     $("iframe").contents().find("body, p, a, span").css({
  51.         fontFamily: RDP_EPUB.config.fontFamily
  52.     }),
  53.     null != userConfig && (userConfig.fontFamily = RDP_EPUB.config.fontFamily,
  54.     localStorage.setItem("rdp-reader-bv3", JSON.stringify(userConfig)))
  55. }
  56. function setFontSize() {
  57.     $("iframe").contents().find("body").css({
  58.         fontSize: RDP_EPUB.config.fontSize + "px"
  59.     }),
  60.     null != userConfig && (userConfig.fontSize = RDP_EPUB.config.fontSize,
  61.     localStorage.setItem("rdp-reader-bv3", JSON.stringify(userConfig)))
  62. }
  63. function setConfig() {
  64.     setBackground(),
  65.     setFontFamily(),
  66.     setFontSize()
  67. }
  68. !function(a) {
  69.     a.widget("ui.swipable", {
  70.         options: {
  71.             preventDefault: !0,
  72.             distance: 150
  73.         },
  74.         _sleeping: !1,
  75.         _startX: null,
  76.         _startY: null,
  77.         _currentX: null,
  78.         _currentY: null,
  79.         _create: function() {
  80.             return "ontouchstart"in document.documentElement ? (this.widgetEventPrefix = "swipe.",
  81.             this._eventify(),
  82.             this) : this
  83.         },
  84.         _eventify: function() {
  85.             var b = this.element.get(0);
  86.             return b.addEventListener("touchstart", a.proxy(this._touchStartHandler, this), !1),
  87.             b.addEventListener("touchmove", a.proxy(this._touchMoveHandler, this), !1),
  88.             b.addEventListener("touchend", a.proxy(this._touchEndHandler, this), !1),
  89.             b.addEventListener("touchcancel", a.proxy(this._touchCancelHandler, this), !1),
  90.             this
  91.         },
  92.         _evalSwipes: function() {
  93.             var a = this._currentX
  94.               , b = this._currentY
  95.               , c = this._startX
  96.               , d = this._startY
  97.               , e = this.options.distance;
  98.             a - c > e && this._swipeRight(),
  99.             c - a > e && this._swipeLeft(),
  100.             b - d > e && this._swipeBottom(),
  101.             d - b > e && this._swipeTop()
  102.         },
  103.         _awake: function() {
  104.             return this._sleeping = !1,
  105.             this
  106.         },
  107.         _sleep: function() {
  108.             return this._sleeping = !0,
  109.             this
  110.         },
  111.         _swipeTop: function() {
  112.             return this._sleep(),
  113.             this._trigger("top"),
  114.             this
  115.         },
  116.         _swipeRight: function() {
  117.             return this._sleep(),
  118.             this._trigger("right"),
  119.             this
  120.         },
  121.         _swipeBottom: function() {
  122.             return this._sleep(),
  123.             this._trigger("bottom"),
  124.             this
  125.         },
  126.         _swipeLeft: function() {
  127.             return this._sleep(),
  128.             this._trigger("left"),
  129.             this
  130.         },
  131.         _setStartTouch: function(a) {
  132.             return this._startX = a.pageX,
  133.             this._startY = a.pageY,
  134.             this
  135.         },
  136.         _setCurrentTouch: function(a) {
  137.             this._currentX = a.pageX,
  138.             this._currentY = a.pageY
  139.         },
  140.         _touchStartHandler: function(a) {
  141.             var b = a.touches;
  142.             if (!(b.length > 1)) {
  143.                 var c = b[0];
  144.                 this._setStartTouch(c)
  145.             }
  146.         },
  147.         _touchMoveHandler: function(a) {
  148.             var b = a.touches[0];
  149.             this._setCurrentTouch(b),
  150.             !this._sleeping && this._evalSwipes(),
  151.             this.options.preventDefault && a.preventDefault()
  152.         },
  153.         _touchEndHandler: function(a) {
  154.             this._awake()
  155.         },
  156.         _touchCancelHandler: function(a) {
  157.             this._awake()
  158.         }
  159.     })
  160. }(jQuery),
  161. !function(a) {
  162.     function b() {
  163.         var a = -1
  164.           , b = this;
  165.         b.append = function(c) {
  166.             var d, e = b.table;
  167.             for (d = 0; d < c.length; d++)
  168.                 a = a >>> 8 ^ e[255 & (a ^ c[d])]
  169.         }
  170.         ,
  171.         b.get = function() {
  172.             return ~a
  173.         }
  174.     }
  175.     function c(a, b, c) {
  176.         return a.slice ? a.slice(b, b + c) : a.webkitSlice ? a.webkitSlice(b, b + c) : a.mozSlice ? a.mozSlice(b, b + c) : a.msSlice ? a.msSlice(b, b + c) : void 0
  177.     }
  178.     function d(a, b) {
  179.         var c, d;
  180.         return c = new ArrayBuffer(a),
  181.         d = new Uint8Array(c),
  182.         b && d.set(b, 0),
  183.         {
  184.             buffer: c,
  185.             array: d,
  186.             view: new DataView(c)
  187.         }
  188.     }
  189.     function e() {}
  190.     function f(a) {
  191.         function b(b, c) {
  192.             var f = new Blob([a],{
  193.                 type: M
  194.             });
  195.             d = new h(f),
  196.             d.init(function() {
  197.                 e.size = d.size,
  198.                 b()
  199.             }, c)
  200.         }
  201.         function c(a, b, c, e) {
  202.             d.readUint8Array(a, b, c, e)
  203.         }
  204.         var d, e = this;
  205.         e.size = 0,
  206.         e.init = b,
  207.         e.readUint8Array = c
  208.     }
  209.     function g(b) {
  210.         function c(a) {
  211.             for (var c = b.length; "=" == b.charAt(c - 1); )
  212.                 c--;
  213.             f = b.indexOf(",") + 1,
  214.             g.size = Math.floor(.75 * (c - f)),
  215.             a()
  216.         }
  217.         function e(c, e, g) {
  218.             var h, i = d(e), j = 4 * Math.floor(c / 3), k = 4 * Math.ceil((c + e) / 3), l = a.atob(b.substring(j + f, k + f)), m = c - 3 * Math.floor(j / 4);
  219.             for (h = m; m + e > h; h++)
  220.                 i.array[h - m] = l.charCodeAt(h);
  221.             g(i.array)
  222.         }
  223.         var f, g = this;
  224.         g.size = 0,
  225.         g.init = c,
  226.         g.readUint8Array = e
  227.     }
  228.     function h(a) {
  229.         function b(b) {
  230.             this.size = a.size,
  231.             b()
  232.         }
  233.         function d(b, d, e, f) {
  234.             var g = new FileReader;
  235.             g.onload = function(a) {
  236.                 e(new Uint8Array(a.target.result))
  237.             }
  238.             ,
  239.             g.onerror = f,
  240.             g.readAsArrayBuffer(c(a, b, d))
  241.         }
  242.         var e = this;
  243.         e.size = 0,
  244.         e.init = b,
  245.         e.readUint8Array = d
  246.     }
  247.     function i() {}
  248.     function j(a) {
  249.         function b(a) {
  250.             e = new Blob([],{
  251.                 type: M
  252.             }),
  253.             a()
  254.         }
  255.         function c(a, b) {
  256.             e = new Blob([e, A ? a : a.buffer],{
  257.                 type: M
  258.             }),
  259.             b()
  260.         }
  261.         function d(b, c) {
  262.             var d = new FileReader;
  263.             d.onload = function(a) {
  264.                 b(a.target.result)
  265.             }
  266.             ,
  267.             d.onerror = c,
  268.             d.readAsText(e, a)
  269.         }
  270.         var e, f = this;
  271.         f.init = b,
  272.         f.writeUint8Array = c,
  273.         f.getData = d
  274.     }
  275.     function k(b) {
  276.         function c(a) {
  277.             g += "data:" + (b || "") + ";base64,",
  278.             a()
  279.         }
  280.         function d(b, c) {
  281.             var d, e = h.length, f = h;
  282.             for (h = "",
  283.             d = 0; d < 3 * Math.floor((e + b.length) / 3) - e; d++)
  284.                 f += String.fromCharCode(b[d]);
  285.             for (; d < b.length; d++)
  286.                 h += String.fromCharCode(b[d]);
  287.             f.length > 2 ? g += a.btoa(f) : h = f,
  288.             c()
  289.         }
  290.         function e(b) {
  291.             b(g + a.btoa(h))
  292.         }
  293.         var f = this
  294.           , g = ""
  295.           , h = "";
  296.         f.init = c,
  297.         f.writeUint8Array = d,
  298.         f.getData = e
  299.     }
  300.     function l(a) {
  301.         function b(b) {
  302.             e = new Blob([],{
  303.                 type: a
  304.             }),
  305.             b()
  306.         }
  307.         function c(b, c) {
  308.             e = new Blob([e, A ? b : b.buffer],{
  309.                 type: a
  310.             }),
  311.             c()
  312.         }
  313.         function d(a) {
  314.             a(e)
  315.         }
  316.         var e, f = this;
  317.         f.init = b,
  318.         f.writeUint8Array = c,
  319.         f.getData = d
  320.     }
  321.     function m(a, b, c, d, e, f, g, h, i, j) {
  322.         function k() {
  323.             a.removeEventListener(N, l, !1),
  324.             h(o)
  325.         }
  326.         function l(a) {
  327.             var b = a.data
  328.               , d = b.data;
  329.             b.onappend && (o += d.length,
  330.             c.writeUint8Array(d, function() {
  331.                 f(!1, d),
  332.                 m()
  333.             }, j)),
  334.             b.onflush && (d ? (o += d.length,
  335.             c.writeUint8Array(d, function() {
  336.                 f(!1, d),
  337.                 k()
  338.             }, j)) : k()),
  339.             b.progress && g && g(n + b.current, e)
  340.         }
  341.         function m() {
  342.             n = p * J,
  343.             e > n ? b.readUint8Array(d + n, Math.min(J, e - n), function(b) {
  344.                 a.postMessage({
  345.                     append: !0,
  346.                     data: b
  347.                 }),
  348.                 p++,
  349.                 g && g(n, e),
  350.                 f(!0, b)
  351.             }, i) : a.postMessage({
  352.                 flush: !0
  353.             })
  354.         }
  355.         var n, o, p = 0;
  356.         o = 0,
  357.         a.addEventListener(N, l, !1),
  358.         m()
  359.     }
  360.     function n(a, b, c, d, e, f, g, h, i, j) {
  361.         function k() {
  362.             var o;
  363.             l = m * J,
  364.             e > l ? b.readUint8Array(d + l, Math.min(J, e - l), function(b) {
  365.                 var h = a.append(b, function() {
  366.                     g && g(d + l, e)
  367.                 });
  368.                 n += h.length,
  369.                 f(!0, b),
  370.                 c.writeUint8Array(h, function() {
  371.                     f(!1, h),
  372.                     m++,
  373.                     setTimeout(k, 1)
  374.                 }, j),
  375.                 g && g(l, e)
  376.             }, i) : (o = a.flush(),
  377.             o ? (n += o.length,
  378.             c.writeUint8Array(o, function() {
  379.                 f(!1, o),
  380.                 h(n)
  381.             }, j)) : h(n))
  382.         }
  383.         var l, m = 0, n = 0;
  384.         k()
  385.     }
  386.     function o(c, d, e, f, g, h, i, j, k) {
  387.         function l(a, b) {
  388.             g && !a && q.append(b)
  389.         }
  390.         function o(a) {
  391.             h(a, q.get())
  392.         }
  393.         var p, q = new b;
  394.         return a.zip.useWebWorkers ? (p = new Worker(a.zip.workerScriptsPath + K),
  395.         m(p, c, d, e, f, l, i, o, j, k)) : n(new a.zip.Inflater, c, d, e, f, l, i, o, j, k),
  396.         p
  397.     }
  398.     function p(c, d, e, f, g, h, i) {
  399.         function j(a, b) {
  400.             a && p.append(b)
  401.         }
  402.         function k(a) {
  403.             f(a, p.get())
  404.         }
  405.         function l() {
  406.             o.removeEventListener(N, l, !1),
  407.             m(o, c, d, 0, c.size, j, g, k, h, i)
  408.         }
  409.         var o, p = new b;
  410.         return a.zip.useWebWorkers ? (o = new Worker(a.zip.workerScriptsPath + L),
  411.         o.addEventListener(N, l, !1),
  412.         o.postMessage({
  413.             init: !0,
  414.             level: e
  415.         })) : n(new a.zip.Deflater, c, d, 0, c.size, j, g, k, h, i),
  416.         o
  417.     }
  418.     function q(a, c, d, e, f, g, h, i, j) {
  419.         function k() {
  420.             var b = l * J;
  421.             e > b ? a.readUint8Array(d + b, Math.min(J, e - b), function(a) {
  422.                 f && m.append(a),
  423.                 h && h(b, e, a),
  424.                 c.writeUint8Array(a, function() {
  425.                     l++,
  426.                     k()
  427.                 }, j)
  428.             }, i) : g(e, m.get())
  429.         }
  430.         var l = 0
  431.           , m = new b;
  432.         k()
  433.     }
  434.     function r(a) {
  435.         var b, c, d = "", e = ["Ç", "ü", "é", "â", "ä", "à", "å", "ç", "ê", "ë", "è", "ï", "î", "ì", "Ä", "Å", "É", "æ", "Æ", "ô", "ö", "ò", "û", "ù", "ÿ", "Ö", "Ü", "ø", "£", "Ø", "×", "ƒ", "á", "í", "ó", "ú", "ñ", "Ñ", "ª", "º", "¿", "®", "¬", "½", "¼", "¡", "«", "»", "_", "_", "_", "¦", "¦", "Á", "Â", "À", "©", "¦", "¦", "+", "+", "¢", "¥", "+", "+", "-", "-", "+", "-", "+", "ã", "Ã", "+", "+", "-", "-", "¦", "-", "+", "¤", "ð", "Ð", "Ê", "Ë", "È", "i", "Í", "Î", "Ï", "+", "+", "_", "_", "¦", "Ì", "_", "Ó", "ß", "Ô", "Ò", "õ", "Õ", "µ", "þ", "Þ", "Ú", "Û", "Ù", "ý", "Ý", "¯", "´", "­", "±", "_", "¾", "¶", "§", "÷", "¸", "°", "¨", "·", "¹", "³", "²", "_", " "];
  436.         for (b = 0; b < a.length; b++)
  437.             c = 255 & a.charCodeAt(b),
  438.             d += c > 127 ? e[c - 128] : String.fromCharCode(c);
  439.         return d
  440.     }
  441.     function s(a) {
  442.         return decodeURIComponent(escape(a))
  443.     }
  444.     function t(a) {
  445.         var b, c = "";
  446.         for (b = 0; b < a.length; b++)
  447.             c += String.fromCharCode(a[b]);
  448.         return c
  449.     }
  450.     function u(a) {
  451.         var b = (4294901760 & a) >> 16
  452.           , c = 65535 & a;
  453.         try {
  454.             return new Date(1980 + ((65024 & b) >> 9),((480 & b) >> 5) - 1,31 & b,(63488 & c) >> 11,(2016 & c) >> 5,2 * (31 & c),0)
  455.         } catch (d) {}
  456.     }
  457.     function v(a, b, c, d, e) {
  458.         return a.version = b.view.getUint16(c, !0),
  459.         a.bitFlag = b.view.getUint16(c + 2, !0),
  460.         a.compressionMethod = b.view.getUint16(c + 4, !0),
  461.         a.lastModDateRaw = b.view.getUint32(c + 6, !0),
  462.         a.lastModDate = u(a.lastModDateRaw),
  463.         1 === (1 & a.bitFlag) ? void e(C) : ((d || 8 != (8 & a.bitFlag)) && (a.crc32 = b.view.getUint32(c + 10, !0),
  464.         a.compressedSize = b.view.getUint32(c + 14, !0),
  465.         a.uncompressedSize = b.view.getUint32(c + 18, !0)),
  466.         4294967295 === a.compressedSize || 4294967295 === a.uncompressedSize ? void e(D) : (a.filenameLength = b.view.getUint16(c + 22, !0),
  467.         void (a.extraFieldLength = b.view.getUint16(c + 24, !0))))
  468.     }
  469.     function w(a, b) {
  470.         function c() {}
  471.         function e(c, f) {
  472.             a.readUint8Array(a.size - c, c, function(a) {
  473.                 var b = d(a.length, a).view;
  474.                 1347093766 != b.getUint32(0) ? e(c + 1, f) : f(b)
  475.             }, function() {
  476.                 b(E)
  477.             })
  478.         }
  479.         return c.prototype.getData = function(c, e, f, g) {
  480.             function h(a, b) {
  481.                 m && m.terminate(),
  482.                 m = null,
  483.                 a && a(b)
  484.             }
  485.             function i(a) {
  486.                 var b = d(4);
  487.                 return b.view.setUint32(0, a),
  488.                 n.crc32 == b.view.getUint32(0)
  489.             }
  490.             function j(a, b) {
  491.                 g && !i(b) ? k() : c.getData(function(a) {
  492.                     h(e, a)
  493.                 })
  494.             }
  495.             function k() {
  496.                 h(b, H)
  497.             }
  498.             function l() {
  499.                 h(b, G)
  500.             }
  501.             var m, n = this;
  502.             a.readUint8Array(n.offset, 30, function(e) {
  503.                 var h, i = d(e.length, e);
  504.                 return 1347093252 != i.view.getUint32(0) ? void b(B) : (v(n, i, 4, !1, b),
  505.                 h = n.offset + 30 + n.filenameLength + n.extraFieldLength,
  506.                 void c.init(function() {
  507.                     0 === n.compressionMethod ? q(a, c, h, n.compressedSize, g, j, f, k, l) : m = o(a, c, h, n.compressedSize, g, j, f, k, l)
  508.                 }, l))
  509.             }, k)
  510.         }
  511.         ,
  512.         {
  513.             getEntries: function(f) {
  514.                 return a.size < 22 ? void b(B) : void e(22, function(e) {
  515.                     var g, h;
  516.                     g = e.getUint32(16, !0),
  517.                     h = e.getUint16(8, !0),
  518.                     a.readUint8Array(g, a.size - g, function(a) {
  519.                         var e, g, i, j, k = 0, l = [], m = d(a.length, a);
  520.                         for (e = 0; h > e; e++) {
  521.                             if (g = new c,
  522.                             1347092738 != m.view.getUint32(k))
  523.                                 return void b(B);
  524.                             v(g, m, k + 6, !0, b),
  525.                             g.commentLength = m.view.getUint16(k + 32, !0),
  526.                             g.directory = 16 == (16 & m.view.getUint8(k + 38)),
  527.                             g.offset = m.view.getUint32(k + 42, !0),
  528.                             i = t(m.array.subarray(k + 46, k + 46 + g.filenameLength)),
  529.                             g.filename = 2048 === (2048 & g.bitFlag) ? s(i) : r(i),
  530.                             g.directory || "/" != g.filename.charAt(g.filename.length - 1) || (g.directory = !0),
  531.                             j = t(m.array.subarray(k + 46 + g.filenameLength + g.extraFieldLength, k + 46 + g.filenameLength + g.extraFieldLength + g.commentLength)),
  532.                             g.comment = 2048 === (2048 & g.bitFlag) ? s(j) : r(j),
  533.                             l.push(g),
  534.                             k += 46 + g.filenameLength + g.extraFieldLength + g.commentLength
  535.                         }
  536.                         f(l)
  537.                     }, function() {
  538.                         b(E)
  539.                     })
  540.                 })
  541.             },
  542.             close: function(a) {
  543.                 a && a()
  544.             }
  545.         }
  546.     }
  547.     function x(a) {
  548.         return unescape(encodeURIComponent(a))
  549.     }
  550.     function y(a) {
  551.         var b, c = [];
  552.         for (b = 0; b < a.length; b++)
  553.             c.push(a.charCodeAt(b));
  554.         return c
  555.     }
  556.     function z(a, b, c) {
  557.         function e(a, b) {
  558.             h && h.terminate(),
  559.             h = null,
  560.             a && a(b)
  561.         }
  562.         function f() {
  563.             e(b, F)
  564.         }
  565.         function g() {
  566.             e(b, H)
  567.         }
  568.         var h, i = {}, j = [], k = 0;
  569.         return {
  570.             add: function(l, m, n, o, r) {
  571.                 function s(b) {
  572.                     var e;
  573.                     z = r.lastModDate || new Date,
  574.                     v = d(26),
  575.                     i[l] = {
  576.                         headerArray: v.array,
  577.                         directory: r.directory,
  578.                         filename: w,
  579.                         offset: k,
  580.                         comment: y(x(r.comment || ""))
  581.                     },
  582.                     v.view.setUint32(0, 335546376),
  583.                     r.version && v.view.setUint8(0, r.version),
  584.                     c || 0 === r.level || r.directory || v.view.setUint16(4, 2048),
  585.                     v.view.setUint16(6, (z.getHours() << 6 | z.getMinutes()) << 5 | z.getSeconds() / 2, !0),
  586.                     v.view.setUint16(8, (z.getFullYear() - 1980 << 4 | z.getMonth() + 1) << 5 | z.getDate(), !0),
  587.                     v.view.setUint16(22, w.length, !0),
  588.                     e = d(30 + w.length),
  589.                     e.view.setUint32(0, 1347093252),
  590.                     e.array.set(v.array, 4),
  591.                     e.array.set(w, 30),
  592.                     k += e.array.length,
  593.                     a.writeUint8Array(e.array, b, f)
  594.                 }
  595.                 function t(b, c) {
  596.                     var g = d(16);
  597.                     k += b || 0,
  598.                     g.view.setUint32(0, 1347094280),
  599.                     "undefined" != typeof c && (v.view.setUint32(10, c, !0),
  600.                     g.view.setUint32(4, c, !0)),
  601.                     m && (g.view.setUint32(8, b, !0),
  602.                     v.view.setUint32(14, b, !0),
  603.                     g.view.setUint32(12, m.size, !0),
  604.                     v.view.setUint32(18, m.size, !0)),
  605.                     a.writeUint8Array(g.array, function() {
  606.                         k += 16,
  607.                         e(n)
  608.                     }, f)
  609.                 }
  610.                 function u() {
  611.                     return r = r || {},
  612.                     l = l.trim(),
  613.                     r.directory && "/" != l.charAt(l.length - 1) && (l += "/"),
  614.                     i.hasOwnProperty(l) ? void b(I) : (w = y(x(l)),
  615.                     j.push(l),
  616.                     void s(function() {
  617.                         m ? c || 0 === r.level ? q(m, a, 0, m.size, !0, t, o, g, f) : h = p(m, a, r.level, t, o, g, f) : t()
  618.                     }, f))
  619.                 }
  620.                 var v, w, z;
  621.                 m ? m.init(u, g) : u()
  622.             },
  623.             close: function(b) {
  624.                 var c, g, h, l = 0, m = 0;
  625.                 for (g = 0; g < j.length; g++)
  626.                     h = i[j[g]],
  627.                     l += 46 + h.filename.length + h.comment.length;
  628.                 for (c = d(l + 22),
  629.                 g = 0; g < j.length; g++)
  630.                     h = i[j[g]],
  631.                     c.view.setUint32(m, 1347092738),
  632.                     c.view.setUint16(m + 4, 5120),
  633.                     c.array.set(h.headerArray, m + 6),
  634.                     c.view.setUint16(m + 32, h.comment.length, !0),
  635.                     h.directory && c.view.setUint8(m + 38, 16),
  636.                     c.view.setUint32(m + 42, h.offset, !0),
  637.                     c.array.set(h.filename, m + 46),
  638.                     c.array.set(h.comment, m + 46 + h.filename.length),
  639.                     m += 46 + h.filename.length + h.comment.length;
  640.                 c.view.setUint32(m, 1347093766),
  641.                 c.view.setUint16(m + 8, j.length, !0),
  642.                 c.view.setUint16(m + 10, j.length, !0),
  643.                 c.view.setUint32(m + 12, l, !0),
  644.                 c.view.setUint32(m + 16, k, !0),
  645.                 a.writeUint8Array(c.array, function() {
  646.                     e(function() {
  647.                         a.getData(b)
  648.                     })
  649.                 }, f)
  650.             }
  651.         }
  652.     }
  653.     var A, B = "File format is not recognized.", C = "File contains encrypted entry.", D = "File is using Zip64 (4gb+ file size).", E = "Error while reading zip file.", F = "Error while writing zip file.", G = "Error while writing file data.", H = "Error while reading file data.", I = "File already exists.", J = 524288, K = "inflate.js", L = "deflate.js", M = "text/plain", N = "message";
  654.     try {
  655.         A = 0 === new Blob([new DataView(new ArrayBuffer(0))]).size
  656.     } catch (O) {}
  657.     b.prototype.table = function() {
  658.         var a, b, c, d = [];
  659.         for (a = 0; 256 > a; a++) {
  660.             for (c = a,
  661.             b = 0; 8 > b; b++)
  662.                 1 & c ? c = c >>> 1 ^ 3988292384 : c >>>= 1;
  663.             d[a] = c
  664.         }
  665.         return d
  666.     }(),
  667.     f.prototype = new e,
  668.     f.prototype.constructor = f,
  669.     g.prototype = new e,
  670.     g.prototype.constructor = g,
  671.     h.prototype = new e,
  672.     h.prototype.constructor = h,
  673.     i.prototype.getData = function(a) {
  674.         a(this.data)
  675.     }
  676.     ,
  677.     j.prototype = new i,
  678.     j.prototype.constructor = j,
  679.     k.prototype = new i,
  680.     k.prototype.constructor = k,
  681.     l.prototype = new i,
  682.     l.prototype.constructor = l,
  683.     a.zip = {
  684.         Reader: e,
  685.         Writer: i,
  686.         BlobReader: h,
  687.         Data64URIReader: g,
  688.         TextReader: f,
  689.         BlobWriter: l,
  690.         Data64URIWriter: k,
  691.         TextWriter: j,
  692.         createReader: function(a, b, c) {
  693.             a.init(function() {
  694.                 b(w(a, c))
  695.             }, c)
  696.         },
  697.         createWriter: function(a, b, c, d) {
  698.             a.init(function() {
  699.                 b(z(a, c, d))
  700.             }, c)
  701.         },
  702.         workerScriptsPath: "",
  703.         useWebWorkers: !0
  704.     }
  705. }(this),
  706. function() {
  707.     function a(a) {
  708.         function b(b) {
  709.             this.size = a.uncompressedSize,
  710.             b()
  711.         }
  712.         function c(b) {
  713.             f.data ? b() : a.getData(new r, function(a) {
  714.                 f.data = a,
  715.                 e = new v(a),
  716.                 b()
  717.             }, null, f.checkCrc32)
  718.         }
  719.         function d(a, b, d, f) {
  720.             c(function() {
  721.                 e.readUint8Array(a, b, d, f)
  722.             }, f)
  723.         }
  724.         var e, f = this;
  725.         f.size = 0,
  726.         f.init = b,
  727.         f.readUint8Array = d
  728.     }
  729.     function b(a) {
  730.         function b(a) {
  731.             c += a.uncompressedSize || 0,
  732.             a.children.forEach(b)
  733.         }
  734.         var c = 0;
  735.         return b(a),
  736.         c
  737.     }
  738.     function c(a, b, d) {
  739.         function e() {
  740.             g++,
  741.             g < a.children.length ? f(a.children[g]) : b()
  742.         }
  743.         function f(a) {
  744.             a.directory ? c(a, e, d) : (a.reader = new a.Reader(a.data,d),
  745.             a.reader.init(function() {
  746.                 a.uncompressedSize = a.reader.size,
  747.                 e()
  748.             }))
  749.         }
  750.         var g = 0;
  751.         a.children.length ? f(a.children[g]) : b()
  752.     }
  753.     function d(a) {
  754.         var b = a.parent.children;
  755.         b.forEach(function(c, d) {
  756.             c.id == a.id && b.splice(d, 1)
  757.         })
  758.     }
  759.     function e(a, b, c, d, e) {
  760.         function f(a, b, c, d, e) {
  761.             function h() {
  762.                 var j = b.children[i];
  763.                 j ? a.add(j.getFullname(), j.reader, function() {
  764.                     g += j.uncompressedSize || 0,
  765.                     f(a, j, function() {
  766.                         i++,
  767.                         h()
  768.                     }, d, e)
  769.                 }, function(a) {
  770.                     d && d(g + a, e)
  771.                 }, {
  772.                     directory: j.directory,
  773.                     version: j.zipVersion
  774.                 }) : c()
  775.             }
  776.             var i = 0;
  777.             h()
  778.         }
  779.         var g = 0;
  780.         f(a, b, c, d, e)
  781.     }
  782.     function f(a, b, c, d) {
  783.         function e(a, b) {
  784.             a.isDirectory && a.createReader().readEntries(b),
  785.             a.isFile && b([])
  786.         }
  787.         function f(a, b, c) {
  788.             e(b, function(b) {
  789.                 function e(b) {
  790.                     function c(a) {
  791.                         f(a, b, function() {
  792.                             h++,
  793.                             g()
  794.                         })
  795.                     }
  796.                     b.isDirectory && c(a.addDirectory(b.name)),
  797.                     b.isFile && b.file(function(d) {
  798.                         var e = a.addBlob(b.name, d);
  799.                         e.uncompressedSize = d.size,
  800.                         c(e)
  801.                     }, d)
  802.                 }
  803.                 function g() {
  804.                     var a = b[h];
  805.                     a ? e(a) : c()
  806.                 }
  807.                 var h = 0;
  808.                 g()
  809.             })
  810.         }
  811.         b.isDirectory ? f(a, b, c) : b.file(function(d) {
  812.             a.addBlob(b.name, d),
  813.             c()
  814.         }, d)
  815.     }
  816.     function g(a, b, c, d, e, f, g) {
  817.         function h(a, b, c, d, e, f) {
  818.             function j(b) {
  819.                 function c(a) {
  820.                     i += b.uncompressedSize || 0,
  821.                     h(a, b, function() {
  822.                         l++,
  823.                         k()
  824.                     }, d, e, f)
  825.                 }
  826.                 b.directory ? a.getDirectory(b.name, {
  827.                     create: !0
  828.                 }, c, e) : a.getFile(b.name, {
  829.                     create: !0
  830.                 }, function(a) {
  831.                     b.getData(new zip.FileWriter(a,zip.getMimeType(b.name)), c, function(a) {
  832.                         d && d(i + a, f)
  833.                     }, g)
  834.                 }, e)
  835.             }
  836.             function k() {
  837.                 var a = b.children[l];
  838.                 a ? j(a) : c()
  839.             }
  840.             var l = 0;
  841.             k()
  842.         }
  843.         var i = 0;
  844.         b.directory ? h(a, b, c, d, e, f) : b.getData(new zip.FileWriter(a,zip.getMimeType(b.name)), c, d, g)
  845.     }
  846.     function h(a) {
  847.         a.entries = [],
  848.         a.root = new n(a)
  849.     }
  850.     function i(a, b, c, d, e) {
  851.         function f() {
  852.             var h = g * p;
  853.             d && d(h, a.size),
  854.             h < a.size ? a.readUint8Array(h, Math.min(p, a.size - h), function(a) {
  855.                 b.writeUint8Array(new Uint8Array(a), function() {
  856.                     g++,
  857.                     f()
  858.                 })
  859.             }, e) : b.getData(c)
  860.         }
  861.         var g = 0;
  862.         f()
  863.     }
  864.     function j(a, b, c, d) {
  865.         var e = this;
  866.         !a || a.constructor == e.Writer && e.data ? b(e.data) : (e.reader || (e.reader = new e.Reader(e.data,d)),
  867.         e.reader.init(function() {
  868.             a.init(function() {
  869.                 i(e.reader, a, b, c, d)
  870.             }, d)
  871.         }))
  872.     }
  873.     function k(a, b, c, d) {
  874.         if (a.directory)
  875.             return d ? new n(a.fs,b,c,a) : new m(a.fs,b,c,a);
  876.         throw "Parent entry is not a directory."
  877.     }
  878.     function l() {}
  879.     function m(a, b, c, d) {
  880.         var e = this;
  881.         l.prototype.init.call(e, a, b, c, d),
  882.         e.Reader = c.Reader,
  883.         e.Writer = c.Writer,
  884.         e.data = c.data,
  885.         e.getData = c.getData || j
  886.     }
  887.     function n(a, b, c, d) {
  888.         var e = this;
  889.         l.prototype.init.call(e, a, b, c, d),
  890.         e.directory = !0
  891.     }
  892.     function o() {
  893.         h(this)
  894.     }
  895.     var p = 524288
  896.       , q = zip.TextWriter
  897.       , r = zip.BlobWriter
  898.       , s = zip.Data64URIWriter
  899.       , t = zip.Reader
  900.       , u = zip.TextReader
  901.       , v = zip.BlobReader
  902.       , w = zip.Data64URIReader
  903.       , x = zip.createReader
  904.       , y = zip.createWriter;
  905.     a.prototype = new t,
  906.     a.prototype.constructor = a,
  907.     a.prototype.checkCrc32 = !1,
  908.     l.prototype = {
  909.         init: function(a, b, c, d) {
  910.             var e = this;
  911.             if (a.root && d && d.getChildByName(b))
  912.                 throw "Entry filename already exists.";
  913.             c || (c = {}),
  914.             e.fs = a,
  915.             e.name = b,
  916.             e.id = a.entries.length,
  917.             e.parent = d,
  918.             e.children = [],
  919.             e.zipVersion = c.zipVersion || 20,
  920.             e.uncompressedSize = 0,
  921.             a.entries.push(e),
  922.             d && e.parent.children.push(e)
  923.         },
  924.         getFileEntry: function(a, d, e, f, h) {
  925.             var i = this;
  926.             c(i, function() {
  927.                 g(a, i, d, e, f, b(i), h)
  928.             }, f)
  929.         },
  930.         moveTo: function(a) {
  931.             var b = this;
  932.             if (!a.directory)
  933.                 throw "Target entry is not a directory.";
  934.             if (a.isDescendantOf(b))
  935.                 throw "Entry is a ancestor of target entry.";
  936.             if (b != a) {
  937.                 if (a.getChildByName(b.name))
  938.                     throw "Entry filename already exists.";
  939.                 d(b),
  940.                 b.parent = a,
  941.                 a.children.push(b)
  942.             }
  943.         },
  944.         getFullname: function() {
  945.             for (var a = this, b = a.name, c = a.parent; c; )
  946.                 b = (c.name ? c.name + "/" : "") + b,
  947.                 c = c.parent;
  948.             return b
  949.         },
  950.         isDescendantOf: function(a) {
  951.             for (var b = this.parent; b && b.id != a.id; )
  952.                 b = b.parent;
  953.             return !!b
  954.         }
  955.     },
  956.     l.prototype.constructor = l;
  957.     var z;
  958.     m.prototype = z = new l,
  959.     z.constructor = m,
  960.     z.getText = function(a, b, c, d) {
  961.         this.getData(new q(d), a, b, c)
  962.     }
  963.     ,
  964.     z.getBlob = function(a, b, c, d) {
  965.         this.getData(new r(a), b, c, d)
  966.     }
  967.     ,
  968.     z.getData64URI = function(a, b, c, d) {
  969.         this.getData(new s(a), b, c, d)
  970.     }
  971.     ;
  972.     var A;
  973.     n.prototype = A = new l,
  974.     A.constructor = n,
  975.     A.addDirectory = function(a) {
  976.         return k(this, a, null, !0)
  977.     }
  978.     ,
  979.     A.addText = function(a, b) {
  980.         return k(this, a, {
  981.             data: b,
  982.             Reader: u,
  983.             Writer: q
  984.         })
  985.     }
  986.     ,
  987.     A.addBlob = function(a, b) {
  988.         return k(this, a, {
  989.             data: b,
  990.             Reader: v,
  991.             Writer: r
  992.         })
  993.     }
  994.     ,
  995.     A.addData64URI = function(a, b) {
  996.         return k(this, a, {
  997.             data: b,
  998.             Reader: w,
  999.             Writer: s
  1000.         })
  1001.     }
  1002.     ,
  1003.     A.addFileEntry = function(a, b, c) {
  1004.         f(this, a, b, c)
  1005.     }
  1006.     ,
  1007.     A.addData = function(a, b) {
  1008.         return k(this, a, b)
  1009.     }
  1010.     ,
  1011.     A.importBlob = function(a, b, c) {
  1012.         this.importZip(new v(a), b, c)
  1013.     }
  1014.     ,
  1015.     A.importText = function(a, b, c) {
  1016.         this.importZip(new u(a), b, c)
  1017.     }
  1018.     ,
  1019.     A.importData64URI = function(a, b, c) {
  1020.         this.importZip(new w(a), b, c)
  1021.     }
  1022.     ,
  1023.     A.exportBlob = function(a, b, c) {
  1024.         this.exportZip(new r("application/zip"), a, b, c)
  1025.     }
  1026.     ,
  1027.     A.exportText = function(a, b, c) {
  1028.         this.exportZip(new q, a, b, c)
  1029.     }
  1030.     ,
  1031.     A.exportFileEntry = function(a, b, c, d) {
  1032.         this.exportZip(new zip.FileWriter(a,"application/zip"), b, c, d)
  1033.     }
  1034.     ,
  1035.     A.exportData64URI = function(a, b, c) {
  1036.         this.exportZip(new s("application/zip"), a, b, c)
  1037.     }
  1038.     ,
  1039.     A.importZip = function(b, c, d) {
  1040.         var e = this;
  1041.         x(b, function(b) {
  1042.             b.getEntries(function(b) {
  1043.                 b.forEach(function(b) {
  1044.                     var c = e
  1045.                       , d = b.filename.split("/")
  1046.                       , f = d.pop();
  1047.                     d.forEach(function(a) {
  1048.                         c = c.getChildByName(a) || new n(e.fs,a,null,c)
  1049.                     }),
  1050.                     b.directory || k(c, f, {
  1051.                         data: b,
  1052.                         Reader: a
  1053.                     })
  1054.                 }),
  1055.                 c()
  1056.             })
  1057.         }, d)
  1058.     }
  1059.     ,
  1060.     A.exportZip = function(a, d, f, g) {
  1061.         var h = this;
  1062.         c(h, function() {
  1063.             y(a, function(a) {
  1064.                 e(a, h, function() {
  1065.                     a.close(d)
  1066.                 }, f, b(h))
  1067.             }, g)
  1068.         }, g)
  1069.     }
  1070.     ,
  1071.     A.getChildByName = function(a) {
  1072.         var b, c, d = this;
  1073.         for (b = 0; b < d.children.length; b++)
  1074.             if (c = d.children[b],
  1075.             c.name == a)
  1076.                 return c
  1077.     }
  1078.     ,
  1079.     o.prototype = {
  1080.         remove: function(a) {
  1081.             d(a),
  1082.             this.entries[a.id] = null
  1083.         },
  1084.         find: function(a) {
  1085.             var b, c = a.split("/"), d = this.root;
  1086.             for (b = 0; d && b < c.length; b++)
  1087.                 d = d.getChildByName(c[b]);
  1088.             return d
  1089.         },
  1090.         getById: function(a) {
  1091.             return this.entries[a]
  1092.         },
  1093.         importBlob: function(a, b, c) {
  1094.             h(this),
  1095.             this.root.importBlob(a, b, c)
  1096.         },
  1097.         importText: function(a, b, c) {
  1098.             h(this),
  1099.             this.root.importText(a, b, c)
  1100.         },
  1101.         importData64URI: function(a, b, c) {
  1102.             h(this),
  1103.             this.root.importData64URI(a, b, c)
  1104.         },
  1105.         exportBlob: function(a, b, c) {
  1106.             this.root.exportBlob(a, b, c)
  1107.         },
  1108.         exportText: function(a, b, c) {
  1109.             this.root.exportText(a, b, c)
  1110.         },
  1111.         exportFileEntry: function(a, b, c, d) {
  1112.             this.root.exportFileEntry(a, b, c, d)
  1113.         },
  1114.         exportData64URI: function(a, b, c) {
  1115.             this.root.exportData64URI(a, b, c)
  1116.         }
  1117.     },
  1118.     zip.fs = {
  1119.         FS: o,
  1120.         ZipDirectoryEntry: n,
  1121.         ZipFileEntry: m
  1122.     },
  1123.     zip.getMimeType = function() {
  1124.         return "application/octet-stream"
  1125.     }
  1126. }(),
  1127. function() {
  1128.     function a(a) {
  1129.         function b(b, c) {
  1130.             var d;
  1131.             e.data ? b() : (d = new XMLHttpRequest,
  1132.             d.addEventListener("load", function() {
  1133.                 e.size || (e.size = Number(d.getResponseHeader("Content-Length"))),
  1134.                 e.data = new Uint8Array(d.response),
  1135.                 b()
  1136.             }, !1),
  1137.             d.addEventListener("error", c, !1),
  1138.             d.open("GET", a),
  1139.             d.responseType = "arraybuffer",
  1140.             d.send())
  1141.         }
  1142.         function c(b, c) {
  1143.             var d = new XMLHttpRequest;
  1144.             d.addEventListener("load", function() {
  1145.                 e.size = Number(d.getResponseHeader("Content-Length")),
  1146.                 b()
  1147.             }, !1),
  1148.             d.addEventListener("error", c, !1),
  1149.             d.open("HEAD", a),
  1150.             d.send()
  1151.         }
  1152.         function d(a, c, d, f) {
  1153.             b(function() {
  1154.                 d(new Uint8Array(e.data.subarray(a, a + c)))
  1155.             }, f)
  1156.         }
  1157.         var e = this;
  1158.         e.size = 0,
  1159.         e.init = c,
  1160.         e.readUint8Array = d
  1161.     }
  1162.     function b(a) {
  1163.         function b(b, c) {
  1164.             var d = new XMLHttpRequest;
  1165.             d.addEventListener("load", function() {
  1166.                 e.size = Number(d.getResponseHeader("Content-Length")),
  1167.                 "bytes" == d.getResponseHeader("Accept-Ranges") ? b() : c(h)
  1168.             }, !1),
  1169.             d.addEventListener("error", c, !1),
  1170.             d.open("HEAD", a),
  1171.             d.send()
  1172.         }
  1173.         function c(b, c, d, e) {
  1174.             var f = new XMLHttpRequest;
  1175.             f.open("GET", a),
  1176.             f.responseType = "arraybuffer",
  1177.             f.setRequestHeader("Range", "bytes=" + b + "-" + (b + c - 1)),
  1178.             f.addEventListener("load", function() {
  1179.                 d(f.response)
  1180.             }, !1),
  1181.             f.addEventListener("error", e, !1),
  1182.             f.send()
  1183.         }
  1184.         function d(a, b, d, e) {
  1185.             c(a, b, function(a) {
  1186.                 d(new Uint8Array(a))
  1187.             }, e)
  1188.         }
  1189.         var e = this;
  1190.         e.size = 0,
  1191.         e.init = b,
  1192.         e.readUint8Array = d
  1193.     }
  1194.     function c(a) {
  1195.         function b(b) {
  1196.             d.size = a.byteLength,
  1197.             b()
  1198.         }
  1199.         function c(b, c, d) {
  1200.             d(new Uint8Array(a.slice(b, b + c)))
  1201.         }
  1202.         var d = this;
  1203.         d.size = 0,
  1204.         d.init = b,
  1205.         d.readUint8Array = c
  1206.     }
  1207.     function d() {
  1208.         function a(a) {
  1209.             d = new Uint8Array,
  1210.             a()
  1211.         }
  1212.         function b(a, b) {
  1213.             var c = new Uint8Array(d.length + a.length);
  1214.             c.set(d),
  1215.             c.set(a, d.length),
  1216.             d = c,
  1217.             b()
  1218.         }
  1219.         function c(a) {
  1220.             a(d.buffer)
  1221.         }
  1222.         var d, e = this;
  1223.         e.init = a,
  1224.         e.writeUint8Array = b,
  1225.         e.getData = c
  1226.     }
  1227.     function e(a, b) {
  1228.         function c(b, c) {
  1229.             a.createWriter(function(a) {
  1230.                 f = a,
  1231.                 b()
  1232.             }, c)
  1233.         }
  1234.         function d(a, c, d) {
  1235.             var e = new Blob([g ? a : a.buffer],{
  1236.                 type: b
  1237.             });
  1238.             f.onwrite = function() {
  1239.                 f.onwrite = null,
  1240.                 c()
  1241.             }
  1242.             ,
  1243.             f.onerror = d,
  1244.             f.write(e)
  1245.         }
  1246.         function e(b) {
  1247.             a.file(b)
  1248.         }
  1249.         var f, h = this;
  1250.         h.init = c,
  1251.         h.writeUint8Array = d,
  1252.         h.getData = e
  1253.     }
  1254.     var f, g, h = "HTTP Range not supported.", i = zip.Reader, j = zip.Writer;
  1255.     try {
  1256.         g = 0 === new Blob([new DataView(new ArrayBuffer(0))]).size
  1257.     } catch (k) {}
  1258.     a.prototype = new i,
  1259.     a.prototype.constructor = a,
  1260.     b.prototype = new i,
  1261.     b.prototype.constructor = b,
  1262.     c.prototype = new i,
  1263.     c.prototype.constructor = c,
  1264.     d.prototype = new j,
  1265.     d.prototype.constructor = d,
  1266.     e.prototype = new j,
  1267.     e.prototype.constructor = e,
  1268.     zip.FileWriter = e,
  1269.     zip.HttpReader = a,
  1270.     zip.HttpRangeReader = b,
  1271.     zip.ArrayBufferReader = c,
  1272.     zip.ArrayBufferWriter = d,
  1273.     zip.fs && (f = zip.fs.ZipDirectoryEntry,
  1274.     f.prototype.addHttpContent = function(c, d, e) {
  1275.         function g(a, b, c, d) {
  1276.             if (a.directory)
  1277.                 return d ? new f(a.fs,b,c,a) : new zip.fs.ZipFileEntry(a.fs,b,c,a);
  1278.             throw "Parent entry is not a directory."
  1279.         }
  1280.         return g(this, c, {
  1281.             data: d,
  1282.             Reader: e ? b : a
  1283.         })
  1284.     }
  1285.     ,
  1286.     f.prototype.importHttpContent = function(c, d, e, f) {
  1287.         this.importZip(d ? new b(c) : new a(c), e, f)
  1288.     }
  1289.     ,
  1290.     zip.fs.FS.prototype.importHttpContent = function(a, b, c, d) {
  1291.         this.entries = [],
  1292.         this.root = new f(this),
  1293.         this.root.importHttpContent(a, b, c, d)
  1294.     }
  1295.     )
  1296. }(),
  1297. function() {
  1298.     var a = {
  1299.         application: {
  1300.             "andrew-inset": "ez",
  1301.             annodex: "anx",
  1302.             "atom+xml": "atom",
  1303.             "atomcat+xml": "atomcat",
  1304.             "atomserv+xml": "atomsrv",
  1305.             bbolin: "lin",
  1306.             cap: ["cap", "pcap"],
  1307.             "cu-seeme": "cu",
  1308.             "davmount+xml": "davmount",
  1309.             dsptype: "tsp",
  1310.             ecmascript: ["es", "ecma"],
  1311.             futuresplash: "spl",
  1312.             hta: "hta",
  1313.             "java-archive": "jar",
  1314.             "java-serialized-object": "ser",
  1315.             "java-vm": "class",
  1316.             javascript: "js",
  1317.             m3g: "m3g",
  1318.             "mac-binhex40": "hqx",
  1319.             mathematica: ["nb", "ma", "mb"],
  1320.             msaccess: "mdb",
  1321.             msword: ["doc", "dot"],
  1322.             mxf: "mxf",
  1323.             oda: "oda",
  1324.             ogg: "ogx",
  1325.             pdf: "pdf",
  1326.             "pgp-keys": "key",
  1327.             "pgp-signature": ["asc", "sig"],
  1328.             "pics-rules": "prf",
  1329.             postscript: ["ps", "ai", "eps", "epsi", "epsf", "eps2", "eps3"],
  1330.             rar: "rar",
  1331.             "rdf+xml": "rdf",
  1332.             "rss+xml": "rss",
  1333.             rtf: "rtf",
  1334.             smil: ["smi", "smil"],
  1335.             "xhtml+xml": ["xhtml", "xht"],
  1336.             xml: ["xml", "xsl", "xsd"],
  1337.             "xspf+xml": "xspf",
  1338.             zip: "zip",
  1339.             "vnd.android.package-archive": "apk",
  1340.             "vnd.cinderella": "cdy",
  1341.             "vnd.google-earth.kml+xml": "kml",
  1342.             "vnd.google-earth.kmz": "kmz",
  1343.             "vnd.mozilla.xul+xml": "xul",
  1344.             "vnd.ms-excel": ["xls", "xlb", "xlt", "xlm", "xla", "xlc", "xlw"],
  1345.             "vnd.ms-pki.seccat": "cat",
  1346.             "vnd.ms-pki.stl": "stl",
  1347.             "vnd.ms-powerpoint": ["ppt", "pps", "pot"],
  1348.             "vnd.oasis.opendocument.chart": "odc",
  1349.             "vnd.oasis.opendocument.database": "odb",
  1350.             "vnd.oasis.opendocument.formula": "odf",
  1351.             "vnd.oasis.opendocument.graphics": "odg",
  1352.             "vnd.oasis.opendocument.graphics-template": "otg",
  1353.             "vnd.oasis.opendocument.image": "odi",
  1354.             "vnd.oasis.opendocument.presentation": "odp",
  1355.             "vnd.oasis.opendocument.presentation-template": "otp",
  1356.             "vnd.oasis.opendocument.spreadsheet": "ods",
  1357.             "vnd.oasis.opendocument.spreadsheet-template": "ots",
  1358.             "vnd.oasis.opendocument.text": "odt",
  1359.             "vnd.oasis.opendocument.text-master": "odm",
  1360.             "vnd.oasis.opendocument.text-template": "ott",
  1361.             "vnd.oasis.opendocument.text-web": "oth",
  1362.             "vnd.openxmlformats-officedocument.spreadsheetml.sheet": "xlsx",
  1363.             "vnd.openxmlformats-officedocument.spreadsheetml.template": "xltx",
  1364.             "vnd.openxmlformats-officedocument.presentationml.presentation": "pptx",
  1365.             "vnd.openxmlformats-officedocument.presentationml.slideshow": "ppsx",
  1366.             "vnd.openxmlformats-officedocument.presentationml.template": "potx",
  1367.             "vnd.openxmlformats-officedocument.wordprocessingml.document": "docx",
  1368.             "vnd.openxmlformats-officedocument.wordprocessingml.template": "dotx",
  1369.             "vnd.smaf": "mmf",
  1370.             "vnd.stardivision.calc": "sdc",
  1371.             "vnd.stardivision.chart": "sds",
  1372.             "vnd.stardivision.draw": "sda",
  1373.             "vnd.stardivision.impress": "sdd",
  1374.             "vnd.stardivision.math": ["sdf", "smf"],
  1375.             "vnd.stardivision.writer": ["sdw", "vor"],
  1376.             "vnd.stardivision.writer-global": "sgl",
  1377.             "vnd.sun.xml.calc": "sxc",
  1378.             "vnd.sun.xml.calc.template": "stc",
  1379.             "vnd.sun.xml.draw": "sxd",
  1380.             "vnd.sun.xml.draw.template": "std",
  1381.             "vnd.sun.xml.impress": "sxi",
  1382.             "vnd.sun.xml.impress.template": "sti",
  1383.             "vnd.sun.xml.math": "sxm",
  1384.             "vnd.sun.xml.writer": "sxw",
  1385.             "vnd.sun.xml.writer.global": "sxg",
  1386.             "vnd.sun.xml.writer.template": "stw",
  1387.             "vnd.symbian.install": ["sis", "sisx"],
  1388.             "vnd.visio": ["vsd", "vst", "vss", "vsw"],
  1389.             "vnd.wap.wbxml": "wbxml",
  1390.             "vnd.wap.wmlc": "wmlc",
  1391.             "vnd.wap.wmlscriptc": "wmlsc",
  1392.             "vnd.wordperfect": "wpd",
  1393.             "vnd.wordperfect5.1": "wp5",
  1394.             "x-123": "wk",
  1395.             "x-7z-compressed": "7z",
  1396.             "x-abiword": "abw",
  1397.             "x-apple-diskimage": "dmg",
  1398.             "x-bcpio": "bcpio",
  1399.             "x-bittorrent": "torrent",
  1400.             "x-cbr": ["cbr", "cba", "cbt", "cb7"],
  1401.             "x-cbz": "cbz",
  1402.             "x-cdf": ["cdf", "cda"],
  1403.             "x-cdlink": "vcd",
  1404.             "x-chess-pgn": "pgn",
  1405.             "x-cpio": "cpio",
  1406.             "x-csh": "csh",
  1407.             "x-debian-package": ["deb", "udeb"],
  1408.             "x-director": ["dcr", "dir", "dxr", "cst", "cct", "cxt", "w3d", "fgd", "swa"],
  1409.             "x-dms": "dms",
  1410.             "x-doom": "wad",
  1411.             "x-dvi": "dvi",
  1412.             "x-httpd-eruby": "rhtml",
  1413.             "x-font": "pcf.Z",
  1414.             "x-freemind": "mm",
  1415.             "x-gnumeric": "gnumeric",
  1416.             "x-go-sgf": "sgf",
  1417.             "x-graphing-calculator": "gcf",
  1418.             "x-gtar": ["gtar", "taz"],
  1419.             "x-hdf": "hdf",
  1420.             "x-httpd-php": ["phtml", "pht", "php"],
  1421.             "x-httpd-php-source": "phps",
  1422.             "x-httpd-php3": "php3",
  1423.             "x-httpd-php3-preprocessed": "php3p",
  1424.             "x-httpd-php4": "php4",
  1425.             "x-httpd-php5": "php5",
  1426.             "x-ica": "ica",
  1427.             "x-info": "info",
  1428.             "x-internet-signup": ["ins", "isp"],
  1429.             "x-iphone": "iii",
  1430.             "x-iso9660-image": "iso",
  1431.             "x-java-jnlp-file": "jnlp",
  1432.             "x-jmol": "jmz",
  1433.             "x-killustrator": "kil",
  1434.             "x-koan": ["skp", "skd", "skt", "skm"],
  1435.             "x-kpresenter": ["kpr", "kpt"],
  1436.             "x-kword": ["kwd", "kwt"],
  1437.             "x-latex": "latex",
  1438.             "x-lha": "lha",
  1439.             "x-lyx": "lyx",
  1440.             "x-lzh": "lzh",
  1441.             "x-lzx": "lzx",
  1442.             "x-maker": ["frm", "maker", "frame", "fm", "fb", "book", "fbdoc"],
  1443.             "x-ms-wmd": "wmd",
  1444.             "x-ms-wmz": "wmz",
  1445.             "x-msdos-program": ["com", "exe", "bat", "dll"],
  1446.             "x-msi": "msi",
  1447.             "x-netcdf": ["nc", "cdf"],
  1448.             "x-ns-proxy-autoconfig": ["pac", "dat"],
  1449.             "x-nwc": "nwc",
  1450.             "x-object": "o",
  1451.             "x-oz-application": "oza",
  1452.             "x-pkcs7-certreqresp": "p7r",
  1453.             "x-python-code": ["pyc", "pyo"],
  1454.             "x-qgis": ["qgs", "shp", "shx"],
  1455.             "x-quicktimeplayer": "qtl",
  1456.             "x-redhat-package-manager": "rpm",
  1457.             "x-ruby": "rb",
  1458.             "x-sh": "sh",
  1459.             "x-shar": "shar",
  1460.             "x-shockwave-flash": ["swf", "swfl"],
  1461.             "x-silverlight": "scr",
  1462.             "x-stuffit": "sit",
  1463.             "x-sv4cpio": "sv4cpio",
  1464.             "x-sv4crc": "sv4crc",
  1465.             "x-tar": "tar",
  1466.             "x-tcl": "tcl",
  1467.             "x-tex-gf": "gf",
  1468.             "x-tex-pk": "pk",
  1469.             "x-texinfo": ["texinfo", "texi"],
  1470.             "x-trash": ["~", "%", "bak", "old", "sik"],
  1471.             "x-troff": ["t", "tr", "roff"],
  1472.             "x-troff-man": "man",
  1473.             "x-troff-me": "me",
  1474.             "x-troff-ms": "ms",
  1475.             "x-ustar": "ustar",
  1476.             "x-wais-source": "src",
  1477.             "x-wingz": "wz",
  1478.             "x-x509-ca-cert": ["crt", "der", "cer"],
  1479.             "x-xcf": "xcf",
  1480.             "x-xfig": "fig",
  1481.             "x-xpinstall": "xpi",
  1482.             applixware: "aw",
  1483.             "atomsvc+xml": "atomsvc",
  1484.             "ccxml+xml": "ccxml",
  1485.             "cdmi-capability": "cdmia",
  1486.             "cdmi-container": "cdmic",
  1487.             "cdmi-domain": "cdmid",
  1488.             "cdmi-object": "cdmio",
  1489.             "cdmi-queue": "cdmiq",
  1490.             "docbook+xml": "dbk",
  1491.             "dssc+der": "dssc",
  1492.             "dssc+xml": "xdssc",
  1493.             "emma+xml": "emma",
  1494.             "epub+zip": "epub",
  1495.             exi: "exi",
  1496.             "font-tdpfr": "pfr",
  1497.             "gml+xml": "gml",
  1498.             "gpx+xml": "gpx",
  1499.             gxf: "gxf",
  1500.             hyperstudio: "stk",
  1501.             "inkml+xml": ["ink", "inkml"],
  1502.             ipfix: "ipfix",
  1503.             json: "json",
  1504.             "jsonml+json": "jsonml",
  1505.             "lost+xml": "lostxml",
  1506.             "mads+xml": "mads",
  1507.             marc: "mrc",
  1508.             "marcxml+xml": "mrcx",
  1509.             "mathml+xml": "mathml",
  1510.             mbox: "mbox",
  1511.             "mediaservercontrol+xml": "mscml",
  1512.             "metalink+xml": "metalink",
  1513.             "metalink4+xml": "meta4",
  1514.             "mets+xml": "mets",
  1515.             "mods+xml": "mods",
  1516.             mp21: ["m21", "mp21"],
  1517.             mp4: "mp4s",
  1518.             "oebps-package+xml": "opf",
  1519.             "omdoc+xml": "omdoc",
  1520.             onenote: ["onetoc", "onetoc2", "onetmp", "onepkg"],
  1521.             oxps: "oxps",
  1522.             "patch-ops-error+xml": "xer",
  1523.             "pgp-encrypted": "pgp",
  1524.             pkcs10: "p10",
  1525.             "pkcs7-mime": ["p7m", "p7c"],
  1526.             "pkcs7-signature": "p7s",
  1527.             pkcs8: "p8",
  1528.             "pkix-attr-cert": "ac",
  1529.             "pkix-crl": "crl",
  1530.             "pkix-pkipath": "pkipath",
  1531.             pkixcmp: "pki",
  1532.             "pls+xml": "pls",
  1533.             "prs.cww": "cww",
  1534.             "pskc+xml": "pskcxml",
  1535.             "reginfo+xml": "rif",
  1536.             "relax-ng-compact-syntax": "rnc",
  1537.             "resource-lists+xml": "rl",
  1538.             "resource-lists-diff+xml": "rld",
  1539.             "rls-services+xml": "rs",
  1540.             "rpki-ghostbusters": "gbr",
  1541.             "rpki-manifest": "mft",
  1542.             "rpki-roa": "roa",
  1543.             "rsd+xml": "rsd",
  1544.             "sbml+xml": "sbml",
  1545.             "scvp-cv-request": "scq",
  1546.             "scvp-cv-response": "scs",
  1547.             "scvp-vp-request": "spq",
  1548.             "scvp-vp-response": "spp",
  1549.             sdp: "sdp",
  1550.             "set-payment-initiation": "setpay",
  1551.             "set-registration-initiation": "setreg",
  1552.             "shf+xml": "shf",
  1553.             "sparql-query": "rq",
  1554.             "sparql-results+xml": "srx",
  1555.             srgs: "gram",
  1556.             "srgs+xml": "grxml",
  1557.             "sru+xml": "sru",
  1558.             "ssdl+xml": "ssdl",
  1559.             "ssml+xml": "ssml",
  1560.             "tei+xml": ["tei", "teicorpus"],
  1561.             "thraud+xml": "tfi",
  1562.             "timestamped-data": "tsd",
  1563.             "vnd.3gpp.pic-bw-large": "plb",
  1564.             "vnd.3gpp.pic-bw-small": "psb",
  1565.             "vnd.3gpp.pic-bw-var": "pvb",
  1566.             "vnd.3gpp2.tcap": "tcap",
  1567.             "vnd.3m.post-it-notes": "pwn",
  1568.             "vnd.accpac.simply.aso": "aso",
  1569.             "vnd.accpac.simply.imp": "imp",
  1570.             "vnd.acucobol": "acu",
  1571.             "vnd.acucorp": ["atc", "acutc"],
  1572.             "vnd.adobe.air-application-installer-package+zip": "air",
  1573.             "vnd.adobe.formscentral.fcdt": "fcdt",
  1574.             "vnd.adobe.fxp": ["fxp", "fxpl"],
  1575.             "vnd.adobe.xdp+xml": "xdp",
  1576.             "vnd.adobe.xfdf": "xfdf",
  1577.             "vnd.ahead.space": "ahead",
  1578.             "vnd.airzip.filesecure.azf": "azf",
  1579.             "vnd.airzip.filesecure.azs": "azs",
  1580.             "vnd.amazon.ebook": "azw",
  1581.             "vnd.americandynamics.acc": "acc",
  1582.             "vnd.amiga.ami": "ami",
  1583.             "vnd.anser-web-certificate-issue-initiation": "cii",
  1584.             "vnd.anser-web-funds-transfer-initiation": "fti",
  1585.             "vnd.antix.game-component": "atx",
  1586.             "vnd.apple.installer+xml": "mpkg",
  1587.             "vnd.apple.mpegurl": "m3u8",
  1588.             "vnd.aristanetworks.swi": "swi",
  1589.             "vnd.astraea-software.iota": "iota",
  1590.             "vnd.audiograph": "aep",
  1591.             "vnd.blueice.multipass": "mpm",
  1592.             "vnd.bmi": "bmi",
  1593.             "vnd.businessobjects": "rep",
  1594.             "vnd.chemdraw+xml": "cdxml",
  1595.             "vnd.chipnuts.karaoke-mmd": "mmd",
  1596.             "vnd.claymore": "cla",
  1597.             "vnd.cloanto.rp9": "rp9",
  1598.             "vnd.clonk.c4group": ["c4g", "c4d", "c4f", "c4p", "c4u"],
  1599.             "vnd.cluetrust.cartomobile-config": "c11amc",
  1600.             "vnd.cluetrust.cartomobile-config-pkg": "c11amz",
  1601.             "vnd.commonspace": "csp",
  1602.             "vnd.contact.cmsg": "cdbcmsg",
  1603.             "vnd.cosmocaller": "cmc",
  1604.             "vnd.crick.clicker": "clkx",
  1605.             "vnd.crick.clicker.keyboard": "clkk",
  1606.             "vnd.crick.clicker.palette": "clkp",
  1607.             "vnd.crick.clicker.template": "clkt",
  1608.             "vnd.crick.clicker.wordbank": "clkw",
  1609.             "vnd.criticaltools.wbs+xml": "wbs",
  1610.             "vnd.ctc-posml": "pml",
  1611.             "vnd.cups-ppd": "ppd",
  1612.             "vnd.curl.car": "car",
  1613.             "vnd.curl.pcurl": "pcurl",
  1614.             "vnd.dart": "dart",
  1615.             "vnd.data-vision.rdz": "rdz",
  1616.             "vnd.dece.data": ["uvf", "uvvf", "uvd", "uvvd"],
  1617.             "vnd.dece.ttml+xml": ["uvt", "uvvt"],
  1618.             "vnd.dece.unspecified": ["uvx", "uvvx"],
  1619.             "vnd.dece.zip": ["uvz", "uvvz"],
  1620.             "vnd.denovo.fcselayout-link": "fe_launch",
  1621.             "vnd.dna": "dna",
  1622.             "vnd.dolby.mlp": "mlp",
  1623.             "vnd.dpgraph": "dpg",
  1624.             "vnd.dreamfactory": "dfac",
  1625.             "vnd.ds-keypoint": "kpxx",
  1626.             "vnd.dvb.ait": "ait",
  1627.             "vnd.dvb.service": "svc",
  1628.             "vnd.dynageo": "geo",
  1629.             "vnd.ecowin.chart": "mag",
  1630.             "vnd.enliven": "nml",
  1631.             "vnd.epson.esf": "esf",
  1632.             "vnd.epson.msf": "msf",
  1633.             "vnd.epson.quickanime": "qam",
  1634.             "vnd.epson.salt": "slt",
  1635.             "vnd.epson.ssf": "ssf",
  1636.             "vnd.eszigno3+xml": ["es3", "et3"],
  1637.             "vnd.ezpix-album": "ez2",
  1638.             "vnd.ezpix-package": "ez3",
  1639.             "vnd.fdf": "fdf",
  1640.             "vnd.fdsn.mseed": "mseed",
  1641.             "vnd.fdsn.seed": ["seed", "dataless"],
  1642.             "vnd.flographit": "gph",
  1643.             "vnd.fluxtime.clip": "ftc",
  1644.             "vnd.framemaker": ["fm", "frame", "maker", "book"],
  1645.             "vnd.frogans.fnc": "fnc",
  1646.             "vnd.frogans.ltf": "ltf",
  1647.             "vnd.fsc.weblaunch": "fsc",
  1648.             "vnd.fujitsu.oasys": "oas",
  1649.             "vnd.fujitsu.oasys2": "oa2",
  1650.             "vnd.fujitsu.oasys3": "oa3",
  1651.             "vnd.fujitsu.oasysgp": "fg5",
  1652.             "vnd.fujitsu.oasysprs": "bh2",
  1653.             "vnd.fujixerox.ddd": "ddd",
  1654.             "vnd.fujixerox.docuworks": "xdw",
  1655.             "vnd.fujixerox.docuworks.binder": "xbd",
  1656.             "vnd.fuzzysheet": "fzs",
  1657.             "vnd.genomatix.tuxedo": "txd",
  1658.             "vnd.geogebra.file": "ggb",
  1659.             "vnd.geogebra.tool": "ggt",
  1660.             "vnd.geometry-explorer": ["gex", "gre"],
  1661.             "vnd.geonext": "gxt",
  1662.             "vnd.geoplan": "g2w",
  1663.             "vnd.geospace": "g3w",
  1664.             "vnd.gmx": "gmx",
  1665.             "vnd.grafeq": ["gqf", "gqs"],
  1666.             "vnd.groove-account": "gac",
  1667.             "vnd.groove-help": "ghf",
  1668.             "vnd.groove-identity-message": "gim",
  1669.             "vnd.groove-injector": "grv",
  1670.             "vnd.groove-tool-message": "gtm",
  1671.             "vnd.groove-tool-template": "tpl",
  1672.             "vnd.groove-vcard": "vcg",
  1673.             "vnd.hal+xml": "hal",
  1674.             "vnd.handheld-entertainment+xml": "zmm",
  1675.             "vnd.hbci": "hbci",
  1676.             "vnd.hhe.lesson-player": "les",
  1677.             "vnd.hp-hpgl": "hpgl",
  1678.             "vnd.hp-hpid": "hpid",
  1679.             "vnd.hp-hps": "hps",
  1680.             "vnd.hp-jlyt": "jlt",
  1681.             "vnd.hp-pcl": "pcl",
  1682.             "vnd.hp-pclxl": "pclxl",
  1683.             "vnd.hydrostatix.sof-data": "sfd-hdstx",
  1684.             "vnd.ibm.minipay": "mpy",
  1685.             "vnd.ibm.modcap": ["afp", "listafp", "list3820"],
  1686.             "vnd.ibm.rights-management": "irm",
  1687.             "vnd.ibm.secure-container": "sc",
  1688.             "vnd.iccprofile": ["icc", "icm"],
  1689.             "vnd.igloader": "igl",
  1690.             "vnd.immervision-ivp": "ivp",
  1691.             "vnd.immervision-ivu": "ivu",
  1692.             "vnd.insors.igm": "igm",
  1693.             "vnd.intercon.formnet": ["xpw", "xpx"],
  1694.             "vnd.intergeo": "i2g",
  1695.             "vnd.intu.qbo": "qbo",
  1696.             "vnd.intu.qfx": "qfx",
  1697.             "vnd.ipunplugged.rcprofile": "rcprofile",
  1698.             "vnd.irepository.package+xml": "irp",
  1699.             "vnd.is-xpr": "xpr",
  1700.             "vnd.isac.fcs": "fcs",
  1701.             "vnd.jam": "jam",
  1702.             "vnd.jcp.javame.midlet-rms": "rms",
  1703.             "vnd.jisp": "jisp",
  1704.             "vnd.joost.joda-archive": "joda",
  1705.             "vnd.kahootz": ["ktz", "ktr"],
  1706.             "vnd.kde.karbon": "karbon",
  1707.             "vnd.kde.kchart": "chrt",
  1708.             "vnd.kde.kformula": "kfo",
  1709.             "vnd.kde.kivio": "flw",
  1710.             "vnd.kde.kontour": "kon",
  1711.             "vnd.kde.kpresenter": ["kpr", "kpt"],
  1712.             "vnd.kde.kspread": "ksp",
  1713.             "vnd.kde.kword": ["kwd", "kwt"],
  1714.             "vnd.kenameaapp": "htke",
  1715.             "vnd.kidspiration": "kia",
  1716.             "vnd.kinar": ["kne", "knp"],
  1717.             "vnd.koan": ["skp", "skd", "skt", "skm"],
  1718.             "vnd.kodak-descriptor": "sse",
  1719.             "vnd.las.las+xml": "lasxml",
  1720.             "vnd.llamagraphics.life-balance.desktop": "lbd",
  1721.             "vnd.llamagraphics.life-balance.exchange+xml": "lbe",
  1722.             "vnd.lotus-1-2-3": "123",
  1723.             "vnd.lotus-approach": "apr",
  1724.             "vnd.lotus-freelance": "pre",
  1725.             "vnd.lotus-notes": "nsf",
  1726.             "vnd.lotus-organizer": "org",
  1727.             "vnd.lotus-screencam": "scm",
  1728.             "vnd.lotus-wordpro": "lwp",
  1729.             "vnd.macports.portpkg": "portpkg",
  1730.             "vnd.mcd": "mcd",
  1731.             "vnd.medcalcdata": "mc1",
  1732.             "vnd.mediastation.cdkey": "cdkey",
  1733.             "vnd.mfer": "mwf",
  1734.             "vnd.mfmp": "mfm",
  1735.             "vnd.micrografx.flo": "flo",
  1736.             "vnd.micrografx.igx": "igx",
  1737.             "vnd.mif": "mif",
  1738.             "vnd.mobius.daf": "daf",
  1739.             "vnd.mobius.dis": "dis",
  1740.             "vnd.mobius.mbk": "mbk",
  1741.             "vnd.mobius.mqy": "mqy",
  1742.             "vnd.mobius.msl": "msl",
  1743.             "vnd.mobius.plc": "plc",
  1744.             "vnd.mobius.txf": "txf",
  1745.             "vnd.mophun.application": "mpn",
  1746.             "vnd.mophun.certificate": "mpc",
  1747.             "vnd.ms-artgalry": "cil",
  1748.             "vnd.ms-cab-compressed": "cab",
  1749.             "vnd.ms-excel.addin.macroenabled.12": "xlam",
  1750.             "vnd.ms-excel.sheet.binary.macroenabled.12": "xlsb",
  1751.             "vnd.ms-excel.sheet.macroenabled.12": "xlsm",
  1752.             "vnd.ms-excel.template.macroenabled.12": "xltm",
  1753.             "vnd.ms-fontobject": "eot",
  1754.             "vnd.ms-htmlhelp": "chm",
  1755.             "vnd.ms-ims": "ims",
  1756.             "vnd.ms-lrm": "lrm",
  1757.             "vnd.ms-officetheme": "thmx",
  1758.             "vnd.ms-powerpoint.addin.macroenabled.12": "ppam",
  1759.             "vnd.ms-powerpoint.presentation.macroenabled.12": "pptm",
  1760.             "vnd.ms-powerpoint.slide.macroenabled.12": "sldm",
  1761.             "vnd.ms-powerpoint.slideshow.macroenabled.12": "ppsm",
  1762.             "vnd.ms-powerpoint.template.macroenabled.12": "potm",
  1763.             "vnd.ms-project": ["mpp", "mpt"],
  1764.             "vnd.ms-word.document.macroenabled.12": "docm",
  1765.             "vnd.ms-word.template.macroenabled.12": "dotm",
  1766.             "vnd.ms-works": ["wps", "wks", "wcm", "wdb"],
  1767.             "vnd.ms-wpl": "wpl",
  1768.             "vnd.ms-xpsdocument": "xps",
  1769.             "vnd.mseq": "mseq",
  1770.             "vnd.musician": "mus",
  1771.             "vnd.muvee.style": "msty",
  1772.             "vnd.mynfc": "taglet",
  1773.             "vnd.neurolanguage.nlu": "nlu",
  1774.             "vnd.nitf": ["ntf", "nitf"],
  1775.             "vnd.noblenet-directory": "nnd",
  1776.             "vnd.noblenet-sealer": "nns",
  1777.             "vnd.noblenet-web": "nnw",
  1778.             "vnd.nokia.n-gage.data": "ngdat",
  1779.             "vnd.nokia.n-gage.symbian.install": "n-gage",
  1780.             "vnd.nokia.radio-preset": "rpst",
  1781.             "vnd.nokia.radio-presets": "rpss",
  1782.             "vnd.novadigm.edm": "edm",
  1783.             "vnd.novadigm.edx": "edx",
  1784.             "vnd.novadigm.ext": "ext",
  1785.             "vnd.oasis.opendocument.chart-template": "otc",
  1786.             "vnd.oasis.opendocument.formula-template": "odft",
  1787.             "vnd.oasis.opendocument.image-template": "oti",
  1788.             "vnd.olpc-sugar": "xo",
  1789.             "vnd.oma.dd2+xml": "dd2",
  1790.             "vnd.openofficeorg.extension": "oxt",
  1791.             "vnd.openxmlformats-officedocument.presentationml.slide": "sldx",
  1792.             "vnd.osgeo.mapguide.package": "mgp",
  1793.             "vnd.osgi.dp": "dp",
  1794.             "vnd.osgi.subsystem": "esa",
  1795.             "vnd.palm": ["pdb", "pqa", "oprc"],
  1796.             "vnd.pawaafile": "paw",
  1797.             "vnd.pg.format": "str",
  1798.             "vnd.pg.osasli": "ei6",
  1799.             "vnd.picsel": "efif",
  1800.             "vnd.pmi.widget": "wg",
  1801.             "vnd.pocketlearn": "plf",
  1802.             "vnd.powerbuilder6": "pbd",
  1803.             "vnd.previewsystems.box": "box",
  1804.             "vnd.proteus.magazine": "mgz",
  1805.             "vnd.publishare-delta-tree": "qps",
  1806.             "vnd.pvi.ptid1": "ptid",
  1807.             "vnd.quark.quarkxpress": ["qxd", "qxt", "qwd", "qwt", "qxl", "qxb"],
  1808.             "vnd.realvnc.bed": "bed",
  1809.             "vnd.recordare.musicxml": "mxl",
  1810.             "vnd.recordare.musicxml+xml": "musicxml",
  1811.             "vnd.rig.cryptonote": "cryptonote",
  1812.             "vnd.rn-realmedia": "rm",
  1813.             "vnd.rn-realmedia-vbr": "rmvb",
  1814.             "vnd.route66.link66+xml": "link66",
  1815.             "vnd.sailingtracker.track": "st",
  1816.             "vnd.seemail": "see",
  1817.             "vnd.sema": "sema",
  1818.             "vnd.semd": "semd",
  1819.             "vnd.semf": "semf",
  1820.             "vnd.shana.informed.formdata": "ifm",
  1821.             "vnd.shana.informed.formtemplate": "itp",
  1822.             "vnd.shana.informed.interchange": "iif",
  1823.             "vnd.shana.informed.package": "ipk",
  1824.             "vnd.simtech-mindmapper": ["twd", "twds"],
  1825.             "vnd.smart.teacher": "teacher",
  1826.             "vnd.solent.sdkm+xml": ["sdkm", "sdkd"],
  1827.             "vnd.spotfire.dxp": "dxp",
  1828.             "vnd.spotfire.sfs": "sfs",
  1829.             "vnd.stepmania.package": "smzip",
  1830.             "vnd.stepmania.stepchart": "sm",
  1831.             "vnd.sus-calendar": ["sus", "susp"],
  1832.             "vnd.svd": "svd",
  1833.             "vnd.syncml+xml": "xsm",
  1834.             "vnd.syncml.dm+wbxml": "bdm",
  1835.             "vnd.syncml.dm+xml": "xdm",
  1836.             "vnd.tao.intent-module-archive": "tao",
  1837.             "vnd.tcpdump.pcap": ["pcap", "cap", "dmp"],
  1838.             "vnd.tmobile-livetv": "tmo",
  1839.             "vnd.trid.tpt": "tpt",
  1840.             "vnd.triscape.mxs": "mxs",
  1841.             "vnd.trueapp": "tra",
  1842.             "vnd.ufdl": ["ufd", "ufdl"],
  1843.             "vnd.uiq.theme": "utz",
  1844.             "vnd.umajin": "umj",
  1845.             "vnd.unity": "unityweb",
  1846.             "vnd.uoml+xml": "uoml",
  1847.             "vnd.vcx": "vcx",
  1848.             "vnd.visionary": "vis",
  1849.             "vnd.vsf": "vsf",
  1850.             "vnd.webturbo": "wtb",
  1851.             "vnd.wolfram.player": "nbp",
  1852.             "vnd.wqd": "wqd",
  1853.             "vnd.wt.stf": "stf",
  1854.             "vnd.xara": "xar",
  1855.             "vnd.xfdl": "xfdl",
  1856.             "vnd.yamaha.hv-dic": "hvd",
  1857.             "vnd.yamaha.hv-script": "hvs",
  1858.             "vnd.yamaha.hv-voice": "hvp",
  1859.             "vnd.yamaha.openscoreformat": "osf",
  1860.             "vnd.yamaha.openscoreformat.osfpvg+xml": "osfpvg",
  1861.             "vnd.yamaha.smaf-audio": "saf",
  1862.             "vnd.yamaha.smaf-phrase": "spf",
  1863.             "vnd.yellowriver-custom-menu": "cmp",
  1864.             "vnd.zul": ["zir", "zirz"],
  1865.             "vnd.zzazz.deck+xml": "zaz",
  1866.             "voicexml+xml": "vxml",
  1867.             widget: "wgt",
  1868.             winhlp: "hlp",
  1869.             "wsdl+xml": "wsdl",
  1870.             "wspolicy+xml": "wspolicy",
  1871.             "x-ace-compressed": "ace",
  1872.             "x-authorware-bin": ["aab", "x32", "u32", "vox"],
  1873.             "x-authorware-map": "aam",
  1874.             "x-authorware-seg": "aas",
  1875.             "x-blorb": ["blb", "blorb"],
  1876.             "x-bzip": "bz",
  1877.             "x-bzip2": ["bz2", "boz"],
  1878.             "x-cfs-compressed": "cfs",
  1879.             "x-chat": "chat",
  1880.             "x-conference": "nsc",
  1881.             "x-dgc-compressed": "dgc",
  1882.             "x-dtbncx+xml": "ncx",
  1883.             "x-dtbook+xml": "dtb",
  1884.             "x-dtbresource+xml": "res",
  1885.             "x-eva": "eva",
  1886.             "x-font-bdf": "bdf",
  1887.             "x-font-ghostscript": "gsf",
  1888.             "x-font-linux-psf": "psf",
  1889.             "x-font-otf": "otf",
  1890.             "x-font-pcf": "pcf",
  1891.             "x-font-snf": "snf",
  1892.             "x-font-ttf": ["ttf", "ttc"],
  1893.             "x-font-type1": ["pfa", "pfb", "pfm", "afm"],
  1894.             "x-font-woff": "woff",
  1895.             "x-freearc": "arc",
  1896.             "x-gca-compressed": "gca",
  1897.             "x-glulx": "ulx",
  1898.             "x-gramps-xml": "gramps",
  1899.             "x-install-instructions": "install",
  1900.             "x-lzh-compressed": ["lzh", "lha"],
  1901.             "x-mie": "mie",
  1902.             "x-mobipocket-ebook": ["prc", "mobi"],
  1903.             "x-ms-application": "application",
  1904.             "x-ms-shortcut": "lnk",
  1905.             "x-ms-xbap": "xbap",
  1906.             "x-msbinder": "obd",
  1907.             "x-mscardfile": "crd",
  1908.             "x-msclip": "clp",
  1909.             "x-msdownload": ["exe", "dll", "com", "bat", "msi"],
  1910.             "x-msmediaview": ["mvb", "m13", "m14"],
  1911.             "x-msmetafile": ["wmf", "wmz", "emf", "emz"],
  1912.             "x-msmoney": "mny",
  1913.             "x-mspublisher": "pub",
  1914.             "x-msschedule": "scd",
  1915.             "x-msterminal": "trm",
  1916.             "x-mswrite": "wri",
  1917.             "x-nzb": "nzb",
  1918.             "x-pkcs12": ["p12", "pfx"],
  1919.             "x-pkcs7-certificates": ["p7b", "spc"],
  1920.             "x-research-info-systems": "ris",
  1921.             "x-silverlight-app": "xap",
  1922.             "x-sql": "sql",
  1923.             "x-stuffitx": "sitx",
  1924.             "x-subrip": "srt",
  1925.             "x-t3vm-image": "t3",
  1926.             "x-tads": "gam",
  1927.             "x-tex": "tex",
  1928.             "x-tex-tfm": "tfm",
  1929.             "x-tgif": "obj",
  1930.             "x-xliff+xml": "xlf",
  1931.             "x-xz": "xz",
  1932.             "x-zmachine": ["z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8"],
  1933.             "xaml+xml": "xaml",
  1934.             "xcap-diff+xml": "xdf",
  1935.             "xenc+xml": "xenc",
  1936.             "xml-dtd": "dtd",
  1937.             "xop+xml": "xop",
  1938.             "xproc+xml": "xpl",
  1939.             "xslt+xml": "xslt",
  1940.             "xv+xml": ["mxml", "xhvml", "xvml", "xvm"],
  1941.             yang: "yang",
  1942.             "yin+xml": "yin",
  1943.             envoy: "evy",
  1944.             fractals: "fif",
  1945.             "internet-property-stream": "acx",
  1946.             olescript: "axs",
  1947.             "vnd.ms-outlook": "msg",
  1948.             "vnd.ms-pkicertstore": "sst",
  1949.             "x-compress": "z",
  1950.             "x-compressed": "tgz",
  1951.             "x-gzip": "gz",
  1952.             "x-perfmon": ["pma", "pmc", "pml", "pmr", "pmw"],
  1953.             "x-pkcs7-mime": ["p7c", "p7m"],
  1954.             "ynd.ms-pkipko": "pko"
  1955.         },
  1956.         audio: {
  1957.             amr: "amr",
  1958.             "amr-wb": "awb",
  1959.             annodex: "axa",
  1960.             basic: ["au", "snd"],
  1961.             flac: "flac",
  1962.             midi: ["mid", "midi", "kar", "rmi"],
  1963.             mpeg: ["mpga", "mpega", "mp2", "mp3", "m4a", "mp2a", "m2a", "m3a"],
  1964.             mpegurl: "m3u",
  1965.             ogg: ["oga", "ogg", "spx"],
  1966.             "prs.sid": "sid",
  1967.             "x-aiff": ["aif", "aiff", "aifc"],
  1968.             "x-gsm": "gsm",
  1969.             "x-ms-wma": "wma",
  1970.             "x-ms-wax": "wax",
  1971.             "x-pn-realaudio": "ram",
  1972.             "x-realaudio": "ra",
  1973.             "x-sd2": "sd2",
  1974.             "x-wav": "wav",
  1975.             adpcm: "adp",
  1976.             mp4: "mp4a",
  1977.             s3m: "s3m",
  1978.             silk: "sil",
  1979.             "vnd.dece.audio": ["uva", "uvva"],
  1980.             "vnd.digital-winds": "eol",
  1981.             "vnd.dra": "dra",
  1982.             "vnd.dts": "dts",
  1983.             "vnd.dts.hd": "dtshd",
  1984.             "vnd.lucent.voice": "lvp",
  1985.             "vnd.ms-playready.media.pya": "pya",
  1986.             "vnd.nuera.ecelp4800": "ecelp4800",
  1987.             "vnd.nuera.ecelp7470": "ecelp7470",
  1988.             "vnd.nuera.ecelp9600": "ecelp9600",
  1989.             "vnd.rip": "rip",
  1990.             webm: "weba",
  1991.             "x-aac": "aac",
  1992.             "x-caf": "caf",
  1993.             "x-matroska": "mka",
  1994.             "x-pn-realaudio-plugin": "rmp",
  1995.             xm: "xm",
  1996.             mid: ["mid", "rmi"]
  1997.         },
  1998.         chemical: {
  1999.             "x-alchemy": "alc",
  2000.             "x-cache": ["cac", "cache"],
  2001.             "x-cache-csf": "csf",
  2002.             "x-cactvs-binary": ["cbin", "cascii", "ctab"],
  2003.             "x-cdx": "cdx",
  2004.             "x-chem3d": "c3d",
  2005.             "x-cif": "cif",
  2006.             "x-cmdf": "cmdf",
  2007.             "x-cml": "cml",
  2008.             "x-compass": "cpa",
  2009.             "x-crossfire": "bsd",
  2010.             "x-csml": ["csml", "csm"],
  2011.             "x-ctx": "ctx",
  2012.             "x-cxf": ["cxf", "cef"],
  2013.             "x-embl-dl-nucleotide": ["emb", "embl"],
  2014.             "x-gamess-input": ["inp", "gam", "gamin"],
  2015.             "x-gaussian-checkpoint": ["fch", "fchk"],
  2016.             "x-gaussian-cube": "cub",
  2017.             "x-gaussian-input": ["gau", "gjc", "gjf"],
  2018.             "x-gaussian-log": "gal",
  2019.             "x-gcg8-sequence": "gcg",
  2020.             "x-genbank": "gen",
  2021.             "x-hin": "hin",
  2022.             "x-isostar": ["istr", "ist"],
  2023.             "x-jcamp-dx": ["jdx", "dx"],
  2024.             "x-kinemage": "kin",
  2025.             "x-macmolecule": "mcm",
  2026.             "x-macromodel-input": ["mmd", "mmod"],
  2027.             "x-mdl-molfile": "mol",
  2028.             "x-mdl-rdfile": "rd",
  2029.             "x-mdl-rxnfile": "rxn",
  2030.             "x-mdl-sdfile": ["sd", "sdf"],
  2031.             "x-mdl-tgf": "tgf",
  2032.             "x-mmcif": "mcif",
  2033.             "x-mol2": "mol2",
  2034.             "x-molconn-Z": "b",
  2035.             "x-mopac-graph": "gpt",
  2036.             "x-mopac-input": ["mop", "mopcrt", "mpc", "zmt"],
  2037.             "x-mopac-out": "moo",
  2038.             "x-ncbi-asn1": "asn",
  2039.             "x-ncbi-asn1-ascii": ["prt", "ent"],
  2040.             "x-ncbi-asn1-binary": ["val", "aso"],
  2041.             "x-pdb": ["pdb", "ent"],
  2042.             "x-rosdal": "ros",
  2043.             "x-swissprot": "sw",
  2044.             "x-vamas-iso14976": "vms",
  2045.             "x-vmd": "vmd",
  2046.             "x-xtel": "xtel",
  2047.             "x-xyz": "xyz"
  2048.         },
  2049.         image: {
  2050.             gif: "gif",
  2051.             ief: "ief",
  2052.             jpeg: ["jpeg", "jpg", "jpe"],
  2053.             pcx: "pcx",
  2054.             png: "png",
  2055.             "svg+xml": ["svg", "svgz"],
  2056.             tiff: ["tiff", "tif"],
  2057.             "vnd.djvu": ["djvu", "djv"],
  2058.             "vnd.wap.wbmp": "wbmp",
  2059.             "x-canon-cr2": "cr2",
  2060.             "x-canon-crw": "crw",
  2061.             "x-cmu-raster": "ras",
  2062.             "x-coreldraw": "cdr",
  2063.             "x-coreldrawpattern": "pat",
  2064.             "x-coreldrawtemplate": "cdt",
  2065.             "x-corelphotopaint": "cpt",
  2066.             "x-epson-erf": "erf",
  2067.             "x-icon": "ico",
  2068.             "x-jg": "art",
  2069.             "x-jng": "jng",
  2070.             "x-nikon-nef": "nef",
  2071.             "x-olympus-orf": "orf",
  2072.             "x-photoshop": "psd",
  2073.             "x-portable-anymap": "pnm",
  2074.             "x-portable-bitmap": "pbm",
  2075.             "x-portable-graymap": "pgm",
  2076.             "x-portable-pixmap": "ppm",
  2077.             "x-rgb": "rgb",
  2078.             "x-xbitmap": "xbm",
  2079.             "x-xpixmap": "xpm",
  2080.             "x-xwindowdump": "xwd",
  2081.             bmp: "bmp",
  2082.             cgm: "cgm",
  2083.             g3fax: "g3",
  2084.             ktx: "ktx",
  2085.             "prs.btif": "btif",
  2086.             sgi: "sgi",
  2087.             "vnd.dece.graphic": ["uvi", "uvvi", "uvg", "uvvg"],
  2088.             "vnd.dwg": "dwg",
  2089.             "vnd.dxf": "dxf",
  2090.             "vnd.fastbidsheet": "fbs",
  2091.             "vnd.fpx": "fpx",
  2092.             "vnd.fst": "fst",
  2093.             "vnd.fujixerox.edmics-mmr": "mmr",
  2094.             "vnd.fujixerox.edmics-rlc": "rlc",
  2095.             "vnd.ms-modi": "mdi",
  2096.             "vnd.ms-photo": "wdp",
  2097.             "vnd.net-fpx": "npx",
  2098.             "vnd.xiff": "xif",
  2099.             webp: "webp",
  2100.             "x-3ds": "3ds",
  2101.             "x-cmx": "cmx",
  2102.             "x-freehand": ["fh", "fhc", "fh4", "fh5", "fh7"],
  2103.             "x-pict": ["pic", "pct"],
  2104.             "x-tga": "tga",
  2105.             "cis-cod": "cod",
  2106.             pipeg: "jfif"
  2107.         },
  2108.         message: {
  2109.             rfc822: ["eml", "mime", "mht", "mhtml", "nws"]
  2110.         },
  2111.         model: {
  2112.             iges: ["igs", "iges"],
  2113.             mesh: ["msh", "mesh", "silo"],
  2114.             vrml: ["wrl", "vrml"],
  2115.             "x3d+vrml": ["x3dv", "x3dvz"],
  2116.             "x3d+xml": ["x3d", "x3dz"],
  2117.             "x3d+binary": ["x3db", "x3dbz"],
  2118.             "vnd.collada+xml": "dae",
  2119.             "vnd.dwf": "dwf",
  2120.             "vnd.gdl": "gdl",
  2121.             "vnd.gtw": "gtw",
  2122.             "vnd.mts": "mts",
  2123.             "vnd.vtu": "vtu"
  2124.         },
  2125.         text: {
  2126.             "cache-manifest": ["manifest", "appcache"],
  2127.             calendar: ["ics", "icz", "ifb"],
  2128.             css: "css",
  2129.             csv: "csv",
  2130.             h323: "323",
  2131.             html: ["html", "htm", "shtml", "stm"],
  2132.             iuls: "uls",
  2133.             mathml: "mml",
  2134.             plain: ["txt", "text", "brf", "conf", "def", "list", "log", "in", "bas"],
  2135.             richtext: "rtx",
  2136.             scriptlet: ["sct", "wsc"],
  2137.             texmacs: ["tm", "ts"],
  2138.             "tab-separated-values": "tsv",
  2139.             "vnd.sun.j2me.app-descriptor": "jad",
  2140.             "vnd.wap.wml": "wml",
  2141.             "vnd.wap.wmlscript": "wmls",
  2142.             "x-bibtex": "bib",
  2143.             "x-boo": "boo",
  2144.             "x-c++hdr": ["h++", "hpp", "hxx", "hh"],
  2145.             "x-c++src": ["c++", "cpp", "cxx", "cc"],
  2146.             "x-component": "htc",
  2147.             "x-dsrc": "d",
  2148.             "x-diff": ["diff", "patch"],
  2149.             "x-haskell": "hs",
  2150.             "x-java": "java",
  2151.             "x-literate-haskell": "lhs",
  2152.             "x-moc": "moc",
  2153.             "x-pascal": ["p", "pas"],
  2154.             "x-pcs-gcd": "gcd",
  2155.             "x-perl": ["pl", "pm"],
  2156.             "x-python": "py",
  2157.             "x-scala": "scala",
  2158.             "x-setext": "etx",
  2159.             "x-tcl": ["tcl", "tk"],
  2160.             "x-tex": ["tex", "ltx", "sty", "cls"],
  2161.             "x-vcalendar": "vcs",
  2162.             "x-vcard": "vcf",
  2163.             n3: "n3",
  2164.             "prs.lines.tag": "dsc",
  2165.             sgml: ["sgml", "sgm"],
  2166.             troff: ["t", "tr", "roff", "man", "me", "ms"],
  2167.             turtle: "ttl",
  2168.             "uri-list": ["uri", "uris", "urls"],
  2169.             vcard: "vcard",
  2170.             "vnd.curl": "curl",
  2171.             "vnd.curl.dcurl": "dcurl",
  2172.             "vnd.curl.scurl": "scurl",
  2173.             "vnd.curl.mcurl": "mcurl",
  2174.             "vnd.dvb.subtitle": "sub",
  2175.             "vnd.fly": "fly",
  2176.             "vnd.fmi.flexstor": "flx",
  2177.             "vnd.graphviz": "gv",
  2178.             "vnd.in3d.3dml": "3dml",
  2179.             "vnd.in3d.spot": "spot",
  2180.             "x-asm": ["s", "asm"],
  2181.             "x-c": ["c", "cc", "cxx", "cpp", "h", "hh", "dic"],
  2182.             "x-fortran": ["f", "for", "f77", "f90"],
  2183.             "x-opml": "opml",
  2184.             "x-nfo": "nfo",
  2185.             "x-sfv": "sfv",
  2186.             "x-uuencode": "uu",
  2187.             webviewhtml: "htt"
  2188.         },
  2189.         video: {
  2190.             "3gpp": "3gp",
  2191.             annodex: "axv",
  2192.             dl: "dl",
  2193.             dv: ["dif", "dv"],
  2194.             fli: "fli",
  2195.             gl: "gl",
  2196.             mpeg: ["mpeg", "mpg", "mpe", "m1v", "m2v", "mp2", "mpa", "mpv2"],
  2197.             mp4: ["mp4", "mp4v", "mpg4"],
  2198.             quicktime: ["qt", "mov"],
  2199.             ogg: "ogv",
  2200.             "vnd.mpegurl": ["mxu", "m4u"],
  2201.             "x-flv": "flv",
  2202.             "x-la-asf": ["lsf", "lsx"],
  2203.             "x-mng": "mng",
  2204.             "x-ms-asf": ["asf", "asx", "asr"],
  2205.             "x-ms-wm": "wm",
  2206.             "x-ms-wmv": "wmv",
  2207.             "x-ms-wmx": "wmx",
  2208.             "x-ms-wvx": "wvx",
  2209.             "x-msvideo": "avi",
  2210.             "x-sgi-movie": "movie",
  2211.             "x-matroska": ["mpv", "mkv", "mk3d", "mks"],
  2212.             "3gpp2": "3g2",
  2213.             h261: "h261",
  2214.             h263: "h263",
  2215.             h264: "h264",
  2216.             jpeg: "jpgv",
  2217.             jpm: ["jpm", "jpgm"],
  2218.             mj2: ["mj2", "mjp2"],
  2219.             "vnd.dece.hd": ["uvh", "uvvh"],
  2220.             "vnd.dece.mobile": ["uvm", "uvvm"],
  2221.             "vnd.dece.pd": ["uvp", "uvvp"],
  2222.             "vnd.dece.sd": ["uvs", "uvvs"],
  2223.             "vnd.dece.video": ["uvv", "uvvv"],
  2224.             "vnd.dvb.file": "dvb",
  2225.             "vnd.fvt": "fvt",
  2226.             "vnd.ms-playready.media.pyv": "pyv",
  2227.             "vnd.uvvu.mp4": ["uvu", "uvvu"],
  2228.             "vnd.vivo": "viv",
  2229.             webm: "webm",
  2230.             "x-f4v": "f4v",
  2231.             "x-m4v": "m4v",
  2232.             "x-ms-vob": "vob",
  2233.             "x-smv": "smv"
  2234.         },
  2235.         "x-conference": {
  2236.             "x-cooltalk": "ice"
  2237.         },
  2238.         "x-world": {
  2239.             "x-vrml": ["vrm", "vrml", "wrl", "flr", "wrz", "xaf", "xof"]
  2240.         }
  2241.     }
  2242.       , b = function() {
  2243.         var b, c, d, e, f = {};
  2244.         for (b in a)
  2245.             if (a.hasOwnProperty(b))
  2246.                 for (c in a[b])
  2247.                     if (a[b].hasOwnProperty(c))
  2248.                         if (d = a[b][c],
  2249.                         "string" == typeof d)
  2250.                             f[d] = b + "/" + c;
  2251.                         else
  2252.                             for (e = 0; e < d.length; e++)
  2253.                                 f[d[e]] = b + "/" + c;
  2254.         return f
  2255.     }();
  2256.     zip.getMimeType = function(a) {
  2257.         var c = "application/octet-stream";
  2258.         return a && b[a.split(".").pop().toLowerCase()] || c
  2259.     }
  2260. }(),
  2261. function() {
  2262.     "use strict";
  2263.     function a(a) {
  2264.         return "function" == typeof a || "object" == typeof a && null !== a
  2265.     }
  2266.     function b(a) {
  2267.         return "function" == typeof a
  2268.     }
  2269.     function c(a) {
  2270.         return "object" == typeof a && null !== a
  2271.     }
  2272.     function d() {}
  2273.     function e(a, b) {
  2274.         for (var c = 0, d = a.length; c < d; c++)
  2275.             if (a[c] === b)
  2276.                 return c;
  2277.         return -1
  2278.     }
  2279.     function f(a) {
  2280.         var b = a._promiseCallbacks;
  2281.         return b || (b = a._promiseCallbacks = {}),
  2282.         b
  2283.     }
  2284.     function g(a, b) {
  2285.         return "onerror" === a ? void wa.on("error", b) : 2 !== arguments.length ? wa[a] : void (wa[a] = b)
  2286.     }
  2287.     function h() {
  2288.         setTimeout(function() {
  2289.             for (var a, b = 0; b < xa.length; b++) {
  2290.                 a = xa[b];
  2291.                 var c = a.payload;
  2292.                 c.guid = c.key + c.id,
  2293.                 c.childGuid = c.key + c.childId,
  2294.                 c.error && (c.stack = c.error.stack),
  2295.                 wa.trigger(a.name, a.payload)
  2296.             }
  2297.             xa.length = 0
  2298.         }, 50)
  2299.     }
  2300.     function i(a, b, c) {
  2301.         1 === xa.push({
  2302.             name: a,
  2303.             payload: {
  2304.                 key: b._guidKey,
  2305.                 id: b._id,
  2306.                 eventName: a,
  2307.                 detail: b._result,
  2308.                 childId: c && c._id,
  2309.                 label: b._label,
  2310.                 timeStamp: ta(),
  2311.                 error: wa["instrument-with-stack"] ? new Error(b._label) : null
  2312.             }
  2313.         }) && h()
  2314.     }
  2315.     function j() {
  2316.         return new TypeError("A promises callback cannot return that same promise.")
  2317.     }
  2318.     function k() {}
  2319.     function l(a) {
  2320.         try {
  2321.             return a.then
  2322.         } catch (b) {
  2323.             return Ca.error = b,
  2324.             Ca
  2325.         }
  2326.     }
  2327.     function m(a, b, c, d) {
  2328.         try {
  2329.             a.call(b, c, d)
  2330.         } catch (e) {
  2331.             return e
  2332.         }
  2333.     }
  2334.     function n(a, b, c) {
  2335.         wa.async(function(a) {
  2336.             var d = !1
  2337.               , e = m(c, b, function(c) {
  2338.                 d || (d = !0,
  2339.                 b !== c ? q(a, c) : s(a, c))
  2340.             }, function(b) {
  2341.                 d || (d = !0,
  2342.                 t(a, b))
  2343.             }, "Settle: " + (a._label || " unknown promise"));
  2344.             !d && e && (d = !0,
  2345.             t(a, e))
  2346.         }, a)
  2347.     }
  2348.     function o(a, b) {
  2349.         b._state === Aa ? s(a, b._result) : b._state === Ba ? (b._onError = null,
  2350.         t(a, b._result)) : u(b, void 0, function(c) {
  2351.             b !== c ? q(a, c) : s(a, c)
  2352.         }, function(b) {
  2353.             t(a, b)
  2354.         })
  2355.     }
  2356.     function p(a, c) {
  2357.         if (c.constructor === a.constructor)
  2358.             o(a, c);
  2359.         else {
  2360.             var d = l(c);
  2361.             d === Ca ? t(a, Ca.error) : void 0 === d ? s(a, c) : b(d) ? n(a, c, d) : s(a, c)
  2362.         }
  2363.     }
  2364.     function q(b, c) {
  2365.         b === c ? s(b, c) : a(c) ? p(b, c) : s(b, c)
  2366.     }
  2367.     function r(a) {
  2368.         a._onError && a._onError(a._result),
  2369.         v(a)
  2370.     }
  2371.     function s(a, b) {
  2372.         a._state === za && (a._result = b,
  2373.         a._state = Aa,
  2374.         0 === a._subscribers.length ? wa.instrument && ya("fulfilled", a) : wa.async(v, a))
  2375.     }
  2376.     function t(a, b) {
  2377.         a._state === za && (a._state = Ba,
  2378.         a._result = b,
  2379.         wa.async(r, a))
  2380.     }
  2381.     function u(a, b, c, d) {
  2382.         var e = a._subscribers
  2383.           , f = e.length;
  2384.         a._onError = null,
  2385.         e[f] = b,
  2386.         e[f + Aa] = c,
  2387.         e[f + Ba] = d,
  2388.         0 === f && a._state && wa.async(v, a)
  2389.     }
  2390.     function v(a) {
  2391.         var b = a._subscribers
  2392.           , c = a._state;
  2393.         if (wa.instrument && ya(c === Aa ? "fulfilled" : "rejected", a),
  2394.         0 !== b.length) {
  2395.             for (var d, e, f = a._result, g = 0; g < b.length; g += 3)
  2396.                 d = b[g],
  2397.                 e = b[g + c],
  2398.                 d ? y(c, d, e, f) : e(f);
  2399.             a._subscribers.length = 0
  2400.         }
  2401.     }
  2402.     function w() {
  2403.         this.error = null
  2404.     }
  2405.     function x(a, b) {
  2406.         try {
  2407.             return a(b)
  2408.         } catch (c) {
  2409.             return Da.error = c,
  2410.             Da
  2411.         }
  2412.     }
  2413.     function y(a, c, d, e) {
  2414.         var f, g, h, i, k = b(d);
  2415.         if (k) {
  2416.             if (f = x(d, e),
  2417.             f === Da ? (i = !0,
  2418.             g = f.error,
  2419.             f = null) : h = !0,
  2420.             c === f)
  2421.                 return void t(c, j())
  2422.         } else
  2423.             f = e,
  2424.             h = !0;
  2425.         c._state !== za || (k && h ? q(c, f) : i ? t(c, g) : a === Aa ? s(c, f) : a === Ba && t(c, f))
  2426.     }
  2427.     function z(a, b) {
  2428.         var c = !1;
  2429.         try {
  2430.             b(function(b) {
  2431.                 c || (c = !0,
  2432.                 q(a, b))
  2433.             }, function(b) {
  2434.                 c || (c = !0,
  2435.                 t(a, b))
  2436.             })
  2437.         } catch (d) {
  2438.             t(a, d)
  2439.         }
  2440.     }
  2441.     function A(a, b, c) {
  2442.         return a === Aa ? {
  2443.             state: "fulfilled",
  2444.             value: c
  2445.         } : {
  2446.             state: "rejected",
  2447.             reason: c
  2448.         }
  2449.     }
  2450.     function B(a, b, c, d) {
  2451.         var e = this;
  2452.         e._instanceConstructor = a,
  2453.         e.promise = new a(k,d),
  2454.         e._abortOnReject = c,
  2455.         e._validateInput(b) ? (e._input = b,
  2456.         e.length = b.length,
  2457.         e._remaining = b.length,
  2458.         e._init(),
  2459.         0 === e.length ? s(e.promise, e._result) : (e.length = e.length || 0,
  2460.         e._enumerate(),
  2461.         0 === e._remaining && s(e.promise, e._result))) : t(e.promise, e._validationError())
  2462.     }
  2463.     function C(a, b) {
  2464.         return new Ea(this,a,(!0),b).promise
  2465.     }
  2466.     function D(a, b) {
  2467.         function c(a) {
  2468.             q(f, a)
  2469.         }
  2470.         function d(a) {
  2471.             t(f, a)
  2472.         }
  2473.         var e = this
  2474.           , f = new e(k,b);
  2475.         if (!sa(a))
  2476.             return t(f, new TypeError("You must pass an array to race.")),
  2477.             f;
  2478.         for (var g = a.length, h = 0; f._state === za && h < g; h++)
  2479.             u(e.resolve(a[h]), void 0, c, d);
  2480.         return f
  2481.     }
  2482.     function E(a, b) {
  2483.         var c = this;
  2484.         if (a && "object" == typeof a && a.constructor === c)
  2485.             return a;
  2486.         var d = new c(k,b);
  2487.         return q(d, a),
  2488.         d
  2489.     }
  2490.     function F(a, b) {
  2491.         var c = this
  2492.           , d = new c(k,b);
  2493.         return t(d, a),
  2494.         d
  2495.     }
  2496.     function G() {
  2497.         throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")
  2498.     }
  2499.     function H() {
  2500.         throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")
  2501.     }
  2502.     function I(a, c) {
  2503.         var d = this;
  2504.         d._id = Ka++,
  2505.         d._label = c,
  2506.         d._state = void 0,
  2507.         d._result = void 0,
  2508.         d._subscribers = [],
  2509.         wa.instrument && ya("created", d),
  2510.         k !== a && (b(a) || G(),
  2511.         d instanceof I || H(),
  2512.         z(d, a))
  2513.     }
  2514.     function J(a, b, c) {
  2515.         this._superConstructor(a, b, !1, c)
  2516.     }
  2517.     function K(a, b) {
  2518.         return new J(La,a,b).promise
  2519.     }
  2520.     function L(a, b) {
  2521.         return La.all(a, b)
  2522.     }
  2523.     function M(a, b) {
  2524.         Xa[Qa] = a,
  2525.         Xa[Qa + 1] = b,
  2526.         Qa += 2,
  2527.         2 === Qa && Na()
  2528.     }
  2529.     function N() {
  2530.         var a = process.nextTick
  2531.           , b = process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/);
  2532.         return Array.isArray(b) && "0" === b[1] && "10" === b[2] && (a = setImmediate),
  2533.         function() {
  2534.             a(S)
  2535.         }
  2536.     }
  2537.     function O() {
  2538.         return function() {
  2539.             Ma(S)
  2540.         }
  2541.     }
  2542.     function P() {
  2543.         var a = 0
  2544.           , b = new Ua(S)
  2545.           , c = document.createTextNode("");
  2546.         return b.observe(c, {
  2547.             characterData: !0
  2548.         }),
  2549.         function() {
  2550.             c.data = a = ++a % 2
  2551.         }
  2552.     }
  2553.     function Q() {
  2554.         var a = new MessageChannel;
  2555.         return a.port1.onmessage = S,
  2556.         function() {
  2557.             a.port2.postMessage(0)
  2558.         }
  2559.     }
  2560.     function R() {
  2561.         return function() {
  2562.             setTimeout(S, 1)
  2563.         }
  2564.     }
  2565.     function S() {
  2566.         for (var a = 0; a < Qa; a += 2) {
  2567.             var b = Xa[a]
  2568.               , c = Xa[a + 1];
  2569.             b(c),
  2570.             Xa[a] = void 0,
  2571.             Xa[a + 1] = void 0
  2572.         }
  2573.         Qa = 0
  2574.     }
  2575.     function T() {
  2576.         try {
  2577.             var a = require
  2578.               , b = a("vertx");
  2579.             return Ma = b.runOnLoop || b.runOnContext,
  2580.             O()
  2581.         } catch (c) {
  2582.             return R()
  2583.         }
  2584.     }
  2585.     function U(a) {
  2586.         var b = {};
  2587.         return b.promise = new La(function(a, c) {
  2588.             b.resolve = a,
  2589.             b.reject = c
  2590.         }
  2591.         ,a),
  2592.         b
  2593.     }
  2594.     function V(a, c, d) {
  2595.         return La.all(a, d).then(function(a) {
  2596.             if (!b(c))
  2597.                 throw new TypeError("You must pass a function as filter's second argument.");
  2598.             for (var e = a.length, f = new Array(e), g = 0; g < e; g++)
  2599.                 f[g] = c(a[g]);
  2600.             return La.all(f, d).then(function(b) {
  2601.                 for (var c = new Array(e), d = 0, f = 0; f < e; f++)
  2602.                     b[f] && (c[d] = a[f],
  2603.                     d++);
  2604.                 return c.length = d,
  2605.                 c
  2606.             })
  2607.         })
  2608.     }
  2609.     function W(a, b, c) {
  2610.         this._superConstructor(a, b, !0, c)
  2611.     }
  2612.     function X(a, b, c) {
  2613.         this._superConstructor(a, b, !1, c)
  2614.     }
  2615.     function Y(a, b) {
  2616.         return new X(La,a,b).promise
  2617.     }
  2618.     function Z(a, b) {
  2619.         return new $a(La,a,b).promise
  2620.     }
  2621.     function _(a, c, d) {
  2622.         return La.all(a, d).then(function(a) {
  2623.             if (!b(c))
  2624.                 throw new TypeError("You must pass a function as map's second argument.");
  2625.             for (var e = a.length, f = new Array(e), g = 0; g < e; g++)
  2626.                 f[g] = c(a[g]);
  2627.             return La.all(f, d)
  2628.         })
  2629.     }
  2630.     function aa() {
  2631.         this.value = void 0
  2632.     }
  2633.     function ba(a) {
  2634.         try {
  2635.             return a.then
  2636.         } catch (b) {
  2637.             return db.value = b,
  2638.             db
  2639.         }
  2640.     }
  2641.     function ca(a, b, c) {
  2642.         try {
  2643.             a.apply(b, c)
  2644.         } catch (d) {
  2645.             return db.value = d,
  2646.             db
  2647.         }
  2648.     }
  2649.     function da(a, b) {
  2650.         for (var c, d, e = {}, f = a.length, g = new Array(f), h = 0; h < f; h++)
  2651.             g[h] = a[h];
  2652.         for (d = 0; d < b.length; d++)
  2653.             c = b[d],
  2654.             e[c] = g[d + 1];
  2655.         return e
  2656.     }
  2657.     function ea(a) {
  2658.         for (var b = a.length, c = new Array(b - 1), d = 1; d < b; d++)
  2659.             c[d - 1] = a[d];
  2660.         return c
  2661.     }
  2662.     function fa(a, b) {
  2663.         return {
  2664.             then: function(c, d) {
  2665.                 return a.call(b, c, d)
  2666.             }
  2667.         }
  2668.     }
  2669.     function ga(a, b) {
  2670.         var c = function() {
  2671.             for (var c, d = this, e = arguments.length, f = new Array(e + 1), g = !1, h = 0; h < e; ++h) {
  2672.                 if (c = arguments[h],
  2673.                 !g) {
  2674.                     if (g = ja(c),
  2675.                     g === eb) {
  2676.                         var i = new La(k);
  2677.                         return t(i, eb.value),
  2678.                         i
  2679.                     }
  2680.                     g && g !== !0 && (c = fa(g, c))
  2681.                 }
  2682.                 f[h] = c
  2683.             }
  2684.             var j = new La(k);
  2685.             return f[e] = function(a, c) {
  2686.                 a ? t(j, a) : void 0 === b ? q(j, c) : b === !0 ? q(j, ea(arguments)) : sa(b) ? q(j, da(arguments, b)) : q(j, c)
  2687.             }
  2688.             ,
  2689.             g ? ia(j, f, a, d) : ha(j, f, a, d)
  2690.         };
  2691.         return c.__proto__ = a,
  2692.         c
  2693.     }
  2694.     function ha(a, b, c, d) {
  2695.         var e = ca(c, d, b);
  2696.         return e === db && t(a, e.value),
  2697.         a
  2698.     }
  2699.     function ia(a, b, c, d) {
  2700.         return La.all(b).then(function(b) {
  2701.             var e = ca(c, d, b);
  2702.             return e === db && t(a, e.value),
  2703.             a
  2704.         })
  2705.     }
  2706.     function ja(a) {
  2707.         return !(!a || "object" != typeof a) && (a.constructor === La || ba(a))
  2708.     }
  2709.     function ka(a, b) {
  2710.         return La.race(a, b)
  2711.     }
  2712.     function la(a, b) {
  2713.         return La.reject(a, b)
  2714.     }
  2715.     function ma(a, b) {
  2716.         return La.resolve(a, b)
  2717.     }
  2718.     function na(a) {
  2719.         throw setTimeout(function() {
  2720.             throw a
  2721.         }),
  2722.         a
  2723.     }
  2724.     function oa(a, b) {
  2725.         wa.async(a, b)
  2726.     }
  2727.     function pa() {
  2728.         wa.on.apply(wa, arguments)
  2729.     }
  2730.     function qa() {
  2731.         wa.off.apply(wa, arguments)
  2732.     }
  2733.     $.fn.isOnScreen = function() {
  2734.         for (var a = $(this), b = [], c = 0; c < a.length; c++) {
  2735.             var d = a[c].getBoundingClientRect();
  2736.             d.left > 0 && d.left < window.innerWidth && b.push(a[c])
  2737.         }
  2738.         return b
  2739.     }
  2740.     ;
  2741.     var ra;
  2742.     ra = Array.isArray ? Array.isArray : function(a) {
  2743.         return "[object Array]" === Object.prototype.toString.call(a)
  2744.     }
  2745.     ;
  2746.     var sa = ra
  2747.       , ta = Date.now || function() {
  2748.         return (new Date).getTime()
  2749.     }
  2750.       , ua = Object.create || function(a) {
  2751.         if (arguments.length > 1)
  2752.             throw new Error("Second argument not supported");
  2753.         if ("object" != typeof a)
  2754.             throw new TypeError("Argument must be an object");
  2755.         return d.prototype = a,
  2756.         new d
  2757.     }
  2758.       , va = {
  2759.         mixin: function(a) {
  2760.             return a.on = this.on,
  2761.             a.off = this.off,
  2762.             a.trigger = this.trigger,
  2763.             a._promiseCallbacks = void 0,
  2764.             a
  2765.         },
  2766.         on: function(a, b) {
  2767.             if ("function" != typeof b)
  2768.                 throw new TypeError("Callback must be a function");
  2769.             var c, d = f(this);
  2770.             c = d[a],
  2771.             c || (c = d[a] = []),
  2772.             e(c, b) === -1 && c.push(b)
  2773.         },
  2774.         off: function(a, b) {
  2775.             var c, d, g = f(this);
  2776.             return b ? (c = g[a],
  2777.             d = e(c, b),
  2778.             void (d !== -1 && c.splice(d, 1))) : void (g[a] = [])
  2779.         },
  2780.         trigger: function(a, b, c) {
  2781.             var d, e, g = f(this);
  2782.             if (d = g[a])
  2783.                 for (var h = 0; h < d.length; h++)
  2784.                     (e = d[h])(b, c)
  2785.         }
  2786.     }
  2787.       , wa = {
  2788.         instrument: !1
  2789.     };
  2790.     va.mixin(wa);
  2791.     var xa = []
  2792.       , ya = i
  2793.       , za = void 0
  2794.       , Aa = 1
  2795.       , Ba = 2
  2796.       , Ca = new w
  2797.       , Da = new w
  2798.       , Ea = B;
  2799.     B.prototype._validateInput = function(a) {
  2800.         return sa(a)
  2801.     }
  2802.     ,
  2803.     B.prototype._validationError = function() {
  2804.         return new Error("Array Methods must be provided an Array")
  2805.     }
  2806.     ,
  2807.     B.prototype._init = function() {
  2808.         this._result = new Array(this.length)
  2809.     }
  2810.     ,
  2811.     B.prototype._enumerate = function() {
  2812.         for (var a = this, b = a.length, c = a.promise, d = a._input, e = 0; c._state === za && e < b; e++)
  2813.             a._eachEntry(d[e], e)
  2814.     }
  2815.     ,
  2816.     B.prototype._eachEntry = function(a, b) {
  2817.         var d = this
  2818.           , e = d._instanceConstructor;
  2819.         c(a) ? a.constructor === e && a._state !== za ? (a._onError = null,
  2820.         d._settledAt(a._state, b, a._result)) : d._willSettleAt(e.resolve(a), b) : (d._remaining--,
  2821.         d._result[b] = d._makeResult(Aa, b, a))
  2822.     }
  2823.     ,
  2824.     B.prototype._settledAt = function(a, b, c) {
  2825.         var d = this
  2826.           , e = d.promise;
  2827.         e._state === za && (d._remaining--,
  2828.         d._abortOnReject && a === Ba ? t(e, c) : d._result[b] = d._makeResult(a, b, c)),
  2829.         0 === d._remaining && s(e, d._result)
  2830.     }
  2831.     ,
  2832.     B.prototype._makeResult = function(a, b, c) {
  2833.         return c
  2834.     }
  2835.     ,
  2836.     B.prototype._willSettleAt = function(a, b) {
  2837.         var c = this;
  2838.         u(a, void 0, function(a) {
  2839.             c._settledAt(Aa, b, a)
  2840.         }, function(a) {
  2841.             c._settledAt(Ba, b, a)
  2842.         })
  2843.     }
  2844.     ;
  2845.     var Fa = C
  2846.       , Ga = D
  2847.       , Ha = E
  2848.       , Ia = F
  2849.       , Ja = "rsvp_" + ta() + "-"
  2850.       , Ka = 0
  2851.       , La = I;
  2852.     I.cast = Ha,
  2853.     I.all = Fa,
  2854.     I.race = Ga,
  2855.     I.resolve = Ha,
  2856.     I.reject = Ia,
  2857.     I.prototype = {
  2858.         constructor: I,
  2859.         _guidKey: Ja,
  2860.         _onError: function(a) {
  2861.             var b = this;
  2862.             wa.after(function() {
  2863.                 b._onError && wa.trigger("error", a, b._label)
  2864.             })
  2865.         },
  2866.         then: function(a, b, c) {
  2867.             var d = this
  2868.               , e = d._state;
  2869.             if (e === Aa && !a || e === Ba && !b)
  2870.                 return wa.instrument && ya("chained", d, d),
  2871.                 d;
  2872.             d._onError = null;
  2873.             var f = new d.constructor(k,c)
  2874.               , g = d._result;
  2875.             if (wa.instrument && ya("chained", d, f),
  2876.             e) {
  2877.                 var h = arguments[e - 1];
  2878.                 wa.async(function() {
  2879.                     y(e, f, h, g)
  2880.                 })
  2881.             } else
  2882.                 u(d, f, a, b);
  2883.             return f
  2884.         },
  2885.         "catch": function(a, b) {
  2886.             return this.then(void 0, a, b)
  2887.         },
  2888.         "finally": function(a, b) {
  2889.             var c = this
  2890.               , d = c.constructor;
  2891.             return c.then(function(b) {
  2892.                 return d.resolve(a()).then(function() {
  2893.                     return b
  2894.                 })
  2895.             }, function(b) {
  2896.                 return d.resolve(a()).then(function() {
  2897.                     throw b
  2898.                 })
  2899.             }, b)
  2900.         }
  2901.     },
  2902.     J.prototype = ua(Ea.prototype),
  2903.     J.prototype._superConstructor = Ea,
  2904.     J.prototype._makeResult = A,
  2905.     J.prototype._validationError = function() {
  2906.         return new Error("allSettled must be called with an array")
  2907.     }
  2908.     ;
  2909.     var Ma, Na, Oa = K, Pa = L, Qa = 0, Ra = ({}.toString,
  2910.     M), Sa = "undefined" != typeof window ? window : void 0, Ta = Sa || {}, Ua = Ta.MutationObserver || Ta.WebKitMutationObserver, Va = "undefined" == typeof self && "undefined" != typeof process && "[object process]" === {}.toString.call(process), Wa = "undefined" != typeof Uint8ClampedArray && "undefined" != typeof importScripts && "undefined" != typeof MessageChannel, Xa = new Array(1e3);
  2911.     Na = Va ? N() : Ua ? P() : Wa ? Q() : void 0 === Sa && "function" == typeof require ? T() : R();
  2912.     var Ya = U
  2913.       , Za = V
  2914.       , $a = W;
  2915.     W.prototype = ua(Ea.prototype),
  2916.     W.prototype._superConstructor = Ea,
  2917.     W.prototype._init = function() {
  2918.         this._result = {}
  2919.     }
  2920.     ,
  2921.     W.prototype._validateInput = function(a) {
  2922.         return a && "object" == typeof a
  2923.     }
  2924.     ,
  2925.     W.prototype._validationError = function() {
  2926.         return new Error("Promise.hash must be called with an object")
  2927.     }
  2928.     ,
  2929.     W.prototype._enumerate = function() {
  2930.         var a = this
  2931.           , b = a.promise
  2932.           , c = a._input
  2933.           , d = [];
  2934.         for (var e in c)
  2935.             b._state === za && Object.prototype.hasOwnProperty.call(c, e) && d.push({
  2936.                 position: e,
  2937.                 entry: c[e]
  2938.             });
  2939.         var f = d.length;
  2940.         a._remaining = f;
  2941.         for (var g, h = 0; b._state === za && h < f; h++)
  2942.             g = d[h],
  2943.             a._eachEntry(g.entry, g.position)
  2944.     }
  2945.     ,
  2946.     X.prototype = ua($a.prototype),
  2947.     X.prototype._superConstructor = Ea,
  2948.     X.prototype._makeResult = A,
  2949.     X.prototype._validationError = function() {
  2950.         return new Error("hashSettled must be called with an object")
  2951.     }
  2952.     ;
  2953.     var _a, ab = Y, bb = Z, cb = _, db = new aa, eb = new aa, fb = ga;
  2954.     if ("object" == typeof self)
  2955.         _a = self;
  2956.     else {
  2957.         if ("object" != typeof global)
  2958.             throw new Error("no global: `self` or `global` found");
  2959.         _a = global
  2960.     }
  2961.     var gb = _a
  2962.       , hb = ka
  2963.       , ib = la
  2964.       , jb = ma
  2965.       , kb = na;
  2966.     wa.async = Ra,
  2967.     wa.after = function(a) {
  2968.         setTimeout(a, 0)
  2969.     }
  2970.     ;
  2971.     if ("undefined" != typeof window && "object" == typeof window.__PROMISE_INSTRUMENTATION__) {
  2972.         var lb = window.__PROMISE_INSTRUMENTATION__;
  2973.         g("instrument", !0);
  2974.         for (var mb in lb)
  2975.             lb.hasOwnProperty(mb) && pa(mb, lb[mb])
  2976.     }
  2977.     var nb = {
  2978.         race: hb,
  2979.         Promise: La,
  2980.         allSettled: Oa,
  2981.         hash: bb,
  2982.         hashSettled: ab,
  2983.         denodeify: fb,
  2984.         on: pa,
  2985.         off: qa,
  2986.         map: cb,
  2987.         filter: Za,
  2988.         resolve: jb,
  2989.         reject: ib,
  2990.         all: Pa,
  2991.         rethrow: kb,
  2992.         defer: Ya,
  2993.         EventTarget: va,
  2994.         configure: g,
  2995.         async: oa
  2996.     };
  2997.     "function" == typeof define && define.amd ? define(function() {
  2998.         return nb
  2999.     }) : "undefined" != typeof module && module.exports ? module.exports = nb : "undefined" != typeof gb && (gb.RSVP = nb)
  3000. }
  3001. .call(this);
  3002. var EPUBJS = EPUBJS || {};
  3003. EPUBJS.VERSION = "0.2.7",
  3004. EPUBJS.plugins = EPUBJS.plugins || {},
  3005. EPUBJS.filePath = EPUBJS.filePath || "/epubjs/",
  3006. EPUBJS.Render = {},
  3007. function(a) {
  3008.     var b = (a.ePub || {},
  3009.     a.ePub = function() {
  3010.         var a, b;
  3011.         return "undefined" != typeof arguments[0] && "string" == typeof arguments[0] && (a = arguments[0],
  3012.         arguments[1] && "object" == typeof arguments[1] ? (b = arguments[1],
  3013.         b.bookPath = a) : b = {
  3014.             bookPath: a
  3015.         }),
  3016.         arguments[0] && "object" == typeof arguments[0] && (b = arguments[0]),
  3017.         new EPUBJS.Book(b)
  3018.     }
  3019.     );
  3020.     "function" == typeof define && define.amd ? define(["rsvp"], function() {
  3021.         return b
  3022.     }) : "undefined" != typeof module && module.exports && (module.exports = b)
  3023. }(window),
  3024. EPUBJS.Book = function(a) {
  3025.     this.settings = EPUBJS.core.defaults(a || {}, {
  3026.         bookPath: void 0,
  3027.         bookKey: void 0,
  3028.         packageUrl: void 0,
  3029.         storage: !1,
  3030.         fromStorage: !1,
  3031.         saved: !1,
  3032.         online: !0,
  3033.         contained: !1,
  3034.         width: void 0,
  3035.         height: void 0,
  3036.         layoutOveride: "auto",
  3037.         orientation: void 0,
  3038.         minSpreadWidth: 768,
  3039.         gap: "auto",
  3040.         version: 1,
  3041.         restore: !1,
  3042.         reload: !1,
  3043.         "goto": !1,
  3044.         styles: {},
  3045.         headTags: {},
  3046.         withCredentials: !1,
  3047.         render_method: "Iframe"
  3048.     }),
  3049.     this.settings.EPUBJSVERSION = EPUBJS.VERSION,
  3050.     this.spinePos = 0,
  3051.     this.stored = !1,
  3052.     this.online = this.settings.online || navigator.onLine,
  3053.     this.networkListeners(),
  3054.     this.ready = {
  3055.         manifest: new RSVP.defer,
  3056.         spine: new RSVP.defer,
  3057.         metadata: new RSVP.defer,
  3058.         cover: new RSVP.defer,
  3059.         toc: new RSVP.defer,
  3060.         pageList: new RSVP.defer
  3061.     },
  3062.     this.readyPromises = [this.ready.manifest.promise, this.ready.spine.promise, this.ready.metadata.promise, this.ready.cover.promise, this.ready.toc.promise],
  3063.     this.pageList = [],
  3064.     this.pagination = new EPUBJS.Pagination,
  3065.     this.pageListReady = this.ready.pageList.promise,
  3066.     this.ready.all = RSVP.all(this.readyPromises),
  3067.     this.ready.all.then(this._ready.bind(this)),
  3068.     this.isRendered = !1,
  3069.     this._q = EPUBJS.core.queue(this),
  3070.     this._rendering = !1,
  3071.     this._displayQ = EPUBJS.core.queue(this),
  3072.     this._moving = !1,
  3073.     this._gotoQ = EPUBJS.core.queue(this),
  3074.     this.renderer = new EPUBJS.Renderer(this.settings.render_method),
  3075.     this.renderer.setMinSpreadWidth(this.settings.minSpreadWidth),
  3076.     this.renderer.setGap(this.settings.gap),
  3077.     this.listenToRenderer(this.renderer),
  3078.     this.defer_opened = new RSVP.defer,
  3079.     this.opened = this.defer_opened.promise,
  3080.     this.store = !1,
  3081.     this.settings.storage !== !1 && this.fromStorage(!0),
  3082.     "string" == typeof this.settings.bookPath && this.open(this.settings.bookPath, this.settings.reload),
  3083.     window.addEventListener("beforeunload", this.unload.bind(this), !1)
  3084. }
  3085. ,
  3086. EPUBJS.Book.prototype.open = function(a, b) {
  3087.     var c, d = this, e = new RSVP.defer;
  3088.     return this.settings.bookPath = a,
  3089.     this.bookUrl = this.urlFrom(a),
  3090.     this.settings.contained || this.isContained(a) ? (this.settings.contained = this.contained = !0,
  3091.     this.bookUrl = "",
  3092.     c = this.unarchive(a).then(function() {
  3093.         return d.loadPackage()
  3094.     })) : c = this.loadPackage(),
  3095.     this.settings.restore && !b && localStorage ? c.then(function(a) {
  3096.         var b = d.packageIdentifier(a)
  3097.           , c = d.restore(b);
  3098.         c || d.unpack(a),
  3099.         e.resolve(),
  3100.         d.defer_opened.resolve()
  3101.     }) : c.then(function(a) {
  3102.         d.unpack(a),
  3103.         e.resolve(),
  3104.         d.defer_opened.resolve()
  3105.     }),
  3106.     this._registerReplacements(this.renderer),
  3107.     e.promise
  3108. }
  3109. ,
  3110. EPUBJS.Book.prototype.loadPackage = function(a) {
  3111.     var b, c = this, d = new EPUBJS.Parser, e = a || "META-INF/container.xml";
  3112.     return b = this.settings.packageUrl ? c.loadXml(c.settings.packageUrl) : c.loadXml(c.bookUrl + e).then(function(a) {
  3113.         return d.container(a)
  3114.     }).then(function(a) {
  3115.         return c.settings.contentsPath = c.bookUrl + a.basePath,
  3116.         c.settings.packageUrl = c.bookUrl + a.packagePath,
  3117.         c.settings.encoding = a.encoding,
  3118.         c.loadXml(c.settings.packageUrl)
  3119.     }),
  3120.     b["catch"](function(a) {
  3121.         console.error("Could not load book at: " + e),
  3122.         c.trigger("book:loadFailed", e)
  3123.     }),
  3124.     b
  3125. }
  3126. ,
  3127. EPUBJS.Book.prototype.packageIdentifier = function(a) {
  3128.     var b = new EPUBJS.Parser;
  3129.     return b.identifier(a)
  3130. }
  3131. ,
  3132. EPUBJS.Book.prototype.unpack = function(a) {
  3133.     var b = this
  3134.       , c = new EPUBJS.Parser;
  3135.     b.contents = c.packageContents(a, b.settings.contentsPath),
  3136.     b.manifest = b.contents.manifest,
  3137.     b.spine = b.contents.spine,
  3138.     RDP_EPUB.tocx = b.contents.spine,
  3139.     b.spineIndexByURL = b.contents.spineIndexByURL,
  3140.     b.metadata = b.contents.metadata,
  3141.     b.settings.bookKey || (b.settings.bookKey = b.generateBookKey(b.metadata.identifier)),
  3142.     b.globalLayoutProperties = b.parseLayoutProperties(b.metadata),
  3143.     b.contents.coverPath && (b.cover = b.contents.cover = b.settings.contentsPath + b.contents.coverPath),
  3144.     b.spineNodeIndex = b.contents.spineNodeIndex,
  3145.     b.ready.manifest.resolve(b.contents.manifest),
  3146.     b.ready.spine.resolve(b.contents.spine),
  3147.     b.ready.metadata.resolve(b.contents.metadata),
  3148.     b.ready.cover.resolve(b.contents.cover),
  3149.     b.locations = new EPUBJS.Locations(b.spine,b.store,b.settings.withCredentials),
  3150.     b.contents.navPath ? (b.settings.navUrl = b.settings.contentsPath + b.contents.navPath,
  3151.     b.loadXml(b.settings.navUrl).then(function(a) {
  3152.         return c.nav(a, b.spineIndexByURL, b.spine)
  3153.     }).then(function(a) {
  3154.         b.toc = b.contents.toc = a,
  3155.         b.ready.toc.resolve(b.contents.toc)
  3156.     }, function(a) {
  3157.         b.ready.toc.resolve(!1)
  3158.     }),
  3159.     b.loadXml(b.settings.navUrl).then(function(a) {
  3160.         return c.pageList(a, b.spineIndexByURL, b.spine)
  3161.     }).then(function(a) {
  3162.         var c = new EPUBJS.EpubCFI
  3163.           , d = 0;
  3164.         0 !== a.length && (b.pageList = b.contents.pageList = a,
  3165.         b.pageList.forEach(function(a) {
  3166.             a.cfi || (d += 1,
  3167.             c.generateCfiFromHref(a.href, b).then(function(c) {
  3168.                 a.cfi = c,
  3169.                 a.packageUrl = b.settings.packageUrl,
  3170.                 d -= 1,
  3171.                 0 === d && (b.pagination.process(b.pageList),
  3172.                 b.ready.pageList.resolve(b.pageList))
  3173.             }))
  3174.         }),
  3175.         d || (b.pagination.process(b.pageList),
  3176.         b.ready.pageList.resolve(b.pageList)))
  3177.     }, function(a) {
  3178.         b.ready.pageList.resolve([])
  3179.     })) : b.contents.tocPath ? (b.settings.tocUrl = b.settings.contentsPath + b.contents.tocPath,
  3180.     b.loadXml(b.settings.tocUrl).then(function(a) {
  3181.         return c.toc(a, b.spineIndexByURL, b.spine)
  3182.     }).then(function(a) {
  3183.         b.toc = b.contents.toc = a,
  3184.         b.ready.toc.resolve(b.contents.toc)
  3185.     }, function(a) {
  3186.         b.ready.toc.resolve(!1)
  3187.     })) : b.ready.toc.resolve(!1)
  3188. }
  3189. ,
  3190. EPUBJS.Book.prototype.createHiddenRender = function(a, b, c) {
  3191.     var d, e, f = this.element.getBoundingClientRect(), g = b || this.settings.width || f.width, h = c || this.settings.height || f.height;
  3192.     return a.setMinSpreadWidth(this.settings.minSpreadWidth),
  3193.     a.setGap(this.settings.gap),
  3194.     this._registerReplacements(a),
  3195.     this.settings.forceSingle && a.forceSingle(!0),
  3196.     d = document.createElement("div"),
  3197.     d.style.visibility = "hidden",
  3198.     d.style.overflow = "hidden",
  3199.     d.style.width = "0",
  3200.     d.style.height = "0",
  3201.     this.element.appendChild(d),
  3202.     e = document.createElement("div"),
  3203.     e.style.visibility = "hidden",
  3204.     e.style.overflow = "hidden",
  3205.     e.style.width = g + "px",
  3206.     e.style.height = h + "px",
  3207.     d.appendChild(e),
  3208.     a.initialize(e),
  3209.     d
  3210. }
  3211. ,
  3212. EPUBJS.Book.prototype.generatePageList = function(a, b) {
  3213.     var c = []
  3214.       , d = new EPUBJS.Renderer(this.settings.render_method,(!1))
  3215.       , e = this.createHiddenRender(d, a, b)
  3216.       , f = new RSVP.defer
  3217.       , g = -1
  3218.       , h = this.spine.length
  3219.       , i = 0
  3220.       , j = function(a) {
  3221.         var b, e = g + 1, f = a || new RSVP.defer;
  3222.         return e >= h ? f.resolve() : (g = e,
  3223.         b = new EPUBJS.Chapter(this.spine[g],this.store),
  3224.         d.displayChapter(b, this.globalLayoutProperties).then(function(a) {
  3225.             d.pageMap.forEach(function(a) {
  3226.                 i += 1,
  3227.                 c.push({
  3228.                     cfi: a.start,
  3229.                     page: i
  3230.                 })
  3231.             }),
  3232.             d.pageMap.length % 2 > 0 && d.spreads && (i += 1,
  3233.             c.push({
  3234.                 cfi: d.pageMap[d.pageMap.length - 1].end,
  3235.                 page: i
  3236.             })),
  3237.             setTimeout(function() {
  3238.                 j(f)
  3239.             }, 1)
  3240.         })),
  3241.         f.promise
  3242.     }
  3243.     .bind(this);
  3244.     j().then(function() {
  3245.         d.remove(),
  3246.         this.element.removeChild(e),
  3247.         f.resolve(c)
  3248.     }
  3249.     .bind(this));
  3250.     return f.promise
  3251. }
  3252. ,
  3253. EPUBJS.Book.prototype.generatePagination = function(a, b) {
  3254.     var c = this
  3255.       , d = new RSVP.defer;
  3256.     return this.ready.spine.promise.then(function() {
  3257.         c.generatePageList(a, b).then(function(a) {
  3258.             c.pageList = c.contents.pageList = a,
  3259.             c.pagination.process(a),
  3260.             c.ready.pageList.resolve(c.pageList),
  3261.             d.resolve(c.pageList)
  3262.         })
  3263.     }),
  3264.     d.promise
  3265. }
  3266. ,
  3267. EPUBJS.Book.prototype.loadPagination = function(a) {
  3268.     var b = JSON.parse(a);
  3269.     return b && b.length && (this.pageList = b,
  3270.     this.pagination.process(this.pageList),
  3271.     this.ready.pageList.resolve(this.pageList)),
  3272.     this.pageList
  3273. }
  3274. ,
  3275. EPUBJS.Book.prototype.getPageList = function() {
  3276.     return this.ready.pageList.promise
  3277. }
  3278. ,
  3279. EPUBJS.Book.prototype.getMetadata = function() {
  3280.     return this.ready.metadata.promise
  3281. }
  3282. ,
  3283. EPUBJS.Book.prototype.getToc = function() {
  3284.     return this.ready.toc.promise
  3285. }
  3286. ,
  3287. EPUBJS.Book.prototype.networkListeners = function() {
  3288.     var a = this;
  3289.     window.addEventListener("offline", function(b) {
  3290.         a.online = !1,
  3291.         a.settings.storage && a.fromStorage(!0),
  3292.         a.trigger("book:offline")
  3293.     }, !1),
  3294.     window.addEventListener("online", function(b) {
  3295.         a.online = !0,
  3296.         a.settings.storage && a.fromStorage(!1),
  3297.         a.trigger("book:online")
  3298.     }, !1)
  3299. }
  3300. ,
  3301. EPUBJS.Book.prototype.listenToRenderer = function(a) {
  3302.     var b = this;
  3303.     a.Events.forEach(function(c) {
  3304.         a.on(c, function(a) {
  3305.             b.trigger(c, a)
  3306.         })
  3307.     }),
  3308.     a.on("renderer:visibleRangeChanged", function(a) {
  3309.         var b, c, d, e = [];
  3310.         this.pageList.length > 0 && (b = this.pagination.pageFromCfi(a.start),
  3311.         d = this.pagination.percentageFromPage(b),
  3312.         e.push(b),
  3313.         a.end && (c = this.pagination.pageFromCfi(a.end),
  3314.         e.push(c)),
  3315.         this.trigger("book:pageChanged", {
  3316.             anchorPage: b,
  3317.             percentage: d,
  3318.             pageRange: e
  3319.         }))
  3320.     }
  3321.     .bind(this)),
  3322.     a.on("render:loaded", this.loadChange.bind(this))
  3323. }
  3324. ,
  3325. EPUBJS.Book.prototype.loadChange = function(a) {
  3326.     var b, c, d = EPUBJS.core.uri(a), e = EPUBJS.core.uri(this.currentChapter.absolute);
  3327.     d.path != e.path ? (console.warn("Miss Match", d.path, this.currentChapter.absolute),
  3328.     b = this.spineIndexByURL[d.filename],
  3329.     c = new EPUBJS.Chapter(this.spine[b],this.store),
  3330.     this.currentChapter = c,
  3331.     this.renderer.currentChapter = c,
  3332.     this.renderer.afterLoad(this.renderer.render.docEl),
  3333.     this.renderer.beforeDisplay(function() {
  3334.         this.renderer.afterDisplay()
  3335.     }
  3336.     .bind(this))) : this._rendering || this.renderer.reformat()
  3337. }
  3338. ,
  3339. EPUBJS.Book.prototype.unlistenToRenderer = function(a) {
  3340.     a.Events.forEach(function(b) {
  3341.         a.off(b)
  3342.     })
  3343. }
  3344. ,
  3345. EPUBJS.Book.prototype.loadXml = function(a) {
  3346.     return this.settings.fromStorage ? this.store.getXml(a, this.settings.encoding) : this.settings.contained ? this.zip.getXml(a, this.settings.encoding) : EPUBJS.core.request(a, "xml", this.settings.withCredentials)
  3347. }
  3348. ,
  3349. EPUBJS.Book.prototype.urlFrom = function(a) {
  3350.     var b, c = EPUBJS.core.uri(a), d = c.protocol, e = "/" == c.path[0], f = window.location, g = f.origin || f.protocol + "//" + f.host, h = document.getElementsByTagName("base");
  3351.     return h.length && (b = h[0].href),
  3352.     c.protocol ? c.origin + c.path : !d && e ? (b || g) + c.path : d || e ? void 0 : EPUBJS.core.resolveUrl(b || f.pathname, c.path)
  3353. }
  3354. ,
  3355. EPUBJS.Book.prototype.unarchive = function(a) {
  3356.     return this.zip = new EPUBJS.Unarchiver,
  3357.     this.store = this.zip,
  3358.     this.zip.open(a)
  3359. }
  3360. ,
  3361. EPUBJS.Book.prototype.isContained = function(a) {
  3362.     var b = EPUBJS.core.uri(a);
  3363.     return !(!b.extension || "epub" != b.extension && "zip" != b.extension)
  3364. }
  3365. ,
  3366. EPUBJS.Book.prototype.isSaved = function(a) {
  3367.     var b;
  3368.     return !!localStorage && (b = localStorage.getItem(a),
  3369.     !(!localStorage || null === b))
  3370. }
  3371. ,
  3372. EPUBJS.Book.prototype.generateBookKey = function(a) {
  3373.     return "epubjs:" + EPUBJS.VERSION + ":" + window.location.host + ":" + a
  3374. }
  3375. ,
  3376. EPUBJS.Book.prototype.saveContents = function() {
  3377.     return !!localStorage && void localStorage.setItem(this.settings.bookKey, JSON.stringify(this.contents))
  3378. }
  3379. ,
  3380. EPUBJS.Book.prototype.removeSavedContents = function() {
  3381.     return !!localStorage && void localStorage.removeItem(this.settings.bookKey)
  3382. }
  3383. ,
  3384. EPUBJS.Book.prototype.renderTo = function(a) {
  3385.     var b, c = this;
  3386.     if (EPUBJS.core.isElement(a))
  3387.         this.element = a;
  3388.     else {
  3389.         if ("string" != typeof a)
  3390.             return void console.error("Not an Element");
  3391.         this.element = EPUBJS.core.getEl(a)
  3392.     }
  3393.     return b = this.opened.then(function() {
  3394.         return c.renderer.initialize(c.element, c.settings.width, c.settings.height),
  3395.         c.metadata.direction && c.renderer.setDirection(c.metadata.direction),
  3396.         c._rendered(),
  3397.         c.startDisplay()
  3398.     })
  3399. }
  3400. ,
  3401. EPUBJS.Book.prototype.startDisplay = function() {
  3402.     var a;
  3403.     return a = this.settings["goto"] ? this["goto"](this.settings["goto"]) : this.settings.previousLocationCfi ? this.gotoCfi(this.settings.previousLocationCfi) : this.displayChapter(this.spinePos)
  3404. }
  3405. ,
  3406. EPUBJS.Book.prototype.restore = function(a) {
  3407.     var b, c = this, d = ["manifest", "spine", "metadata", "cover", "toc", "spineNodeIndex", "spineIndexByURL", "globalLayoutProperties"], e = !1, f = this.generateBookKey(a), g = localStorage.getItem(f), h = d.length;
  3408.     if (this.settings.clearSaved && (e = !0),
  3409.     !e && "undefined" != g && null !== g)
  3410.         for (c.contents = JSON.parse(g),
  3411.         b = 0; b < h; b++) {
  3412.             var i = d[b];
  3413.             if (!c.contents[i]) {
  3414.                 e = !0;
  3415.                 break
  3416.             }
  3417.             c[i] = c.contents[i]
  3418.         }
  3419.     return !(e || !g || !this.contents || !this.settings.contentsPath) && (this.settings.bookKey = f,
  3420.     this.ready.manifest.resolve(this.manifest),
  3421.     this.ready.spine.resolve(this.spine),
  3422.     this.ready.metadata.resolve(this.metadata),
  3423.     this.ready.cover.resolve(this.cover),
  3424.     this.ready.toc.resolve(this.toc),
  3425.     !0)
  3426. }
  3427. ,
  3428. EPUBJS.Book.prototype.displayChapter = function(a, b, c) {
  3429.     var d, e, f, g, h = this, i = c || new RSVP.defer;
  3430.     return this.isRendered ? this._rendering || this._rendering ? (this._displayQ.enqueue("displayChapter", [a, b, i]),
  3431.     i.promise) : (EPUBJS.core.isNumber(a) ? f = a : (e = new EPUBJS.EpubCFI(a),
  3432.     f = e.spinePos),
  3433.     (f < 0 || f >= this.spine.length) && (console.warn("Not A Valid Location"),
  3434.     f = 0,
  3435.     b = !1,
  3436.     e = !1),
  3437.     g = new EPUBJS.Chapter(this.spine[f],this.store),
  3438.     this._rendering = !0,
  3439.     this._needsAssetReplacement() && g.registerHook("beforeChapterRender", [EPUBJS.replace.head, EPUBJS.replace.resources, EPUBJS.replace.svg], !0),
  3440.     h.currentChapter = g,
  3441.     d = h.renderer.displayChapter(g, this.globalLayoutProperties),
  3442.     e ? h.renderer.gotoCfi(e) : b && h.renderer.lastPage(),
  3443.     d.then(function(a) {
  3444.         h.spinePos = f,
  3445.         i.resolve(h.renderer),
  3446.         h.settings.fromStorage === !1 && h.settings.contained === !1 && h.preloadNextChapter(),
  3447.         h._rendering = !1,
  3448.         h._displayQ.dequeue(),
  3449.         0 === h._displayQ.length() && h._gotoQ.dequeue()
  3450.     }, function(a) {
  3451.         console.error("Could not load Chapter: " + g.absolute, a),
  3452.         h.trigger("book:chapterLoadFailed", g.absolute),
  3453.         h._rendering = !1,
  3454.         i.reject(a)
  3455.     }),
  3456.     i.promise) : (this._q.enqueue("displayChapter", arguments),
  3457.     i.reject({
  3458.         message: "Rendering",
  3459.         stack: (new Error).stack
  3460.     }),
  3461.     $("iframe").contents().find("body").css({
  3462.         fontSize: RDP_EPUB.config.fontSize + "px",
  3463.         fontFamily: RDP_EPUB.config.fontFamily,
  3464.         color: RDP_EPUB.config.color,
  3465.         background: RDP_EPUB.config.background
  3466.     }),
  3467.     $("iframe").contents().find("img").css("height", "auto"),
  3468.     i.promise)
  3469. }
  3470. ,
  3471. EPUBJS.Book.prototype.nextPage = function() {
  3472.     var a;
  3473.     return this.isRendered ? (a = this.renderer.nextPage()) ? ($("iframe").contents().find("body").css({
  3474.         fontSize: RDP_EPUB.config.fontSize + "px",
  3475.         fontFamily: RDP_EPUB.config.fontFamily,
  3476.         color: RDP_EPUB.config.color,
  3477.         background: RDP_EPUB.config.background
  3478.     }),
  3479.     $("iframe").contents().find("img").css("height", "auto"),
  3480.     void $("iframe").contents().find("body").css({
  3481.         "-webkit-user-select": "none",
  3482.         "-moz-user-select": "none",
  3483.         "-ms-user-select": "none",
  3484.         "user-select": "none"
  3485.     })) : this.nextChapter() : this._q.enqueue("nextPage", arguments)
  3486. }
  3487. ,
  3488. EPUBJS.Book.prototype.prevPage = function() {
  3489.     var a;
  3490.     return this.isRendered ? (a = this.renderer.prevPage()) ? ($("iframe").contents().find("body").css({
  3491.         fontSize: RDP_EPUB.config.fontSize + "px",
  3492.         fontFamily: RDP_EPUB.config.fontFamily,
  3493.         color: RDP_EPUB.config.color,
  3494.         background: RDP_EPUB.config.background
  3495.     }),
  3496.     $("iframe").contents().find("img").css("height", "auto"),
  3497.     $("iframe").contents().find("body").css({
  3498.         "-webkit-user-select": "none",
  3499.         "-moz-user-select": "none",
  3500.         "-ms-user-select": "none",
  3501.         "user-select": "none"
  3502.     }),
  3503.     void console.log($("iframe").contents().find(".divider-pageview").isOnScreen())) : this.prevChapter() : this._q.enqueue("prevPage", arguments)
  3504. }
  3505. ,
  3506. EPUBJS.Book.prototype.nextChapter = function() {
  3507.     var a;
  3508.     if (this.spinePos < this.spine.length - 1) {
  3509.         for (a = this.spinePos + 1; this.spine[a] && this.spine[a].linear && "no" == this.spine[a].linear; )
  3510.             a++;
  3511.         if (a < this.spine.length)
  3512.             return this.displayChapter(a);
  3513.         this.trigger("book:atEnd")
  3514.     } else
  3515.         this.trigger("book:atEnd")
  3516. }
  3517. ,
  3518. EPUBJS.Book.prototype.prevChapter = function() {
  3519.     var a;
  3520.     if (this.spinePos > 0) {
  3521.         for (a = this.spinePos - 1; this.spine[a] && this.spine[a].linear && "no" == this.spine[a].linear; )
  3522.             a--;
  3523.         if (a >= 0)
  3524.             return this.displayChapter(a, !0);
  3525.         this.trigger("book:atStart")
  3526.     } else
  3527.         this.trigger("book:atStart")
  3528. }
  3529. ,
  3530. EPUBJS.Book.prototype.getCurrentLocationCfi = function() {
  3531.     return !!this.isRendered && this.renderer.currentLocationCfi
  3532. }
  3533. ,
  3534. EPUBJS.Book.prototype["goto"] = function(a) {
  3535.     return 0 === a.indexOf("epubcfi(") ? this.gotoCfi(a) : a.indexOf("%") === a.length - 1 ? this.gotoPercentage(parseInt(a.substring(0, a.length - 1)) / 100) : "number" == typeof a || isNaN(a) === !1 ? this.gotoPage(a) : this.gotoHref(a)
  3536. }
  3537. ,
  3538. EPUBJS.Book.prototype.gotoCfi = function(a, b) {
  3539.     var c, d, e, f = b || new RSVP.defer;
  3540.     return this.isRendered ? this._moving || this._rendering ? (console.warn("Renderer is moving"),
  3541.     this._gotoQ.enqueue("gotoCfi", [a, f]),
  3542.     !1) : (c = new EPUBJS.EpubCFI(a),
  3543.     d = c.spinePos,
  3544.     d != -1 && (e = this.spine[d],
  3545.     promise = f.promise,
  3546.     this._moving = !0,
  3547.     this.currentChapter && this.spinePos === d ? (this.renderer.gotoCfi(c),
  3548.     this._moving = !1,
  3549.     f.resolve(this.renderer.currentLocationCfi)) : (e && d != -1 || (d = 0,
  3550.     e = this.spine[d]),
  3551.     this.currentChapter = new EPUBJS.Chapter(e,this.store),
  3552.     this.currentChapter && (this.spinePos = d,
  3553.     render = this.renderer.displayChapter(this.currentChapter, this.globalLayoutProperties),
  3554.     this.renderer.gotoCfi(c),
  3555.     render.then(function(a) {
  3556.         this._moving = !1,
  3557.         f.resolve(a.currentLocationCfi)
  3558.     }
  3559.     .bind(this)))),
  3560.     promise.then(function() {
  3561.         this._gotoQ.dequeue()
  3562.     }
  3563.     .bind(this)),
  3564.     promise)) : (console.warn("Not yet Rendered"),
  3565.     this.settings.previousLocationCfi = a,
  3566.     !1)
  3567. }
  3568. ,
  3569. EPUBJS.Book.prototype.gotoHref = function(a, b) {
  3570.     var c, d, e, f, g, h = b || new RSVP.defer;
  3571.     return this.isRendered ? this._moving || this._rendering ? (this._gotoQ.enqueue("gotoHref", [a, h]),
  3572.     !1) : (c = a.split("#"),
  3573.     d = c[0],
  3574.     e = c[1] || !1,
  3575.     f = d.replace(this.settings.contentsPath, ""),
  3576.     g = this.spineIndexByURL[f],
  3577.     d || (g = this.currentChapter ? this.currentChapter.spinePos : 0),
  3578.     "number" == typeof g && (this.currentChapter && g == this.currentChapter.spinePos ? (e ? this.renderer.section(e) : this.renderer.firstPage(),
  3579.     h.resolve(this.renderer.currentLocationCfi),
  3580.     h.promise.then(function() {
  3581.         this._gotoQ.dequeue()
  3582.     }
  3583.     .bind(this)),
  3584.     h.promise) : this.displayChapter(g).then(function() {
  3585.         e && this.renderer.section(e),
  3586.         h.resolve(this.renderer.currentLocationCfi)
  3587.     }
  3588.     .bind(this)))) : (this.settings["goto"] = a,
  3589.     !1)
  3590. }
  3591. ,
  3592. EPUBJS.Book.prototype.gotoPage = function(a) {
  3593.     var b = this.pagination.cfiFromPage(a);
  3594.     return this.gotoCfi(b)
  3595. }
  3596. ,
  3597. EPUBJS.Book.prototype.gotoPercentage = function(a) {
  3598.     var b = this.pagination.pageFromPercentage(a);
  3599.     return this.gotoPage(b)
  3600. }
  3601. ,
  3602. EPUBJS.Book.prototype.preloadNextChapter = function() {
  3603.     var a, b = this.spinePos + 1;
  3604.     return !(b >= this.spine.length) && (a = new EPUBJS.Chapter(this.spine[b]),
  3605.     void (a && EPUBJS.core.request(a.absolute)))
  3606. }
  3607. ,
  3608. EPUBJS.Book.prototype.storeOffline = function() {
  3609.     var a = this
  3610.       , b = EPUBJS.core.values(this.manifest);
  3611.     return this.store.put(b).then(function() {
  3612.         a.settings.stored = !0,
  3613.         a.trigger("book:stored")
  3614.     })
  3615. }
  3616. ,
  3617. EPUBJS.Book.prototype.availableOffline = function() {
  3618.     return this.settings.stored > 0
  3619. }
  3620. ,
  3621. EPUBJS.Book.prototype.toStorage = function() {
  3622.     var a = this.settings.bookKey;
  3623.     this.store.isStored(a).then(function(b) {
  3624.         return b === !0 ? (this.settings.stored = !0,
  3625.         !0) : this.storeOffline().then(function() {
  3626.             this.store.token(a, !0)
  3627.         }
  3628.         .bind(this))
  3629.     }
  3630.     .bind(this))
  3631. }
  3632. ,
  3633. EPUBJS.Book.prototype.fromStorage = function(a) {
  3634.     [EPUBJS.replace.head, EPUBJS.replace.resources, EPUBJS.replace.svg];
  3635.     this.contained || this.settings.contained || (this.online && this.opened.then(this.toStorage.bind(this)),
  3636.     this.store && this.settings.fromStorage && a === !1 ? (this.settings.fromStorage = !1,
  3637.     this.store.off("offline"),
  3638.     this.store = !1) : this.settings.fromStorage || (this.store = new EPUBJS.Storage(this.settings.credentials),
  3639.     this.store.on("offline", function(a) {
  3640.         a ? (this.offline = !0,
  3641.         this.settings.fromStorage = !0,
  3642.         this.trigger("book:offline")) : (this.offline = !1,
  3643.         this.settings.fromStorage = !1,
  3644.         this.trigger("book:online"))
  3645.     }
  3646.     .bind(this))))
  3647. }
  3648. ,
  3649. EPUBJS.Book.prototype.setStyle = function(a, b, c) {
  3650.     var d = ["color", "background", "background-color"];
  3651.     return this.isRendered ? (this.settings.styles[a] = b,
  3652.     this.renderer.setStyle(a, b, c),
  3653.     void (d.indexOf(a) === -1 && this.renderer.reformat())) : this._q.enqueue("setStyle", arguments)
  3654. }
  3655. ,
  3656. EPUBJS.Book.prototype.removeStyle = function(a) {
  3657.     return this.isRendered ? (this.renderer.removeStyle(a),
  3658.     this.renderer.reformat(),
  3659.     void delete this.settings.styles[a]) : this._q.enqueue("removeStyle", arguments)
  3660. }
  3661. ,
  3662. EPUBJS.Book.prototype.addHeadTag = function(a, b) {
  3663.     return this.isRendered ? void (this.settings.headTags[a] = b) : this._q.enqueue("addHeadTag", arguments)
  3664. }
  3665. ,
  3666. EPUBJS.Book.prototype.useSpreads = function(a) {
  3667.     console.warn("useSpreads is deprecated, use forceSingle or set a layoutOveride instead"),
  3668.     a === !1 ? this.forceSingle(!0) : this.forceSingle(!1)
  3669. }
  3670. ,
  3671. EPUBJS.Book.prototype.forceSingle = function(a) {
  3672.     var b = "undefined" == typeof a || a;
  3673.     this.renderer.forceSingle(b),
  3674.     this.settings.forceSingle = b,
  3675.     this.isRendered && this.renderer.reformat()
  3676. }
  3677. ,
  3678. EPUBJS.Book.prototype.setMinSpreadWidth = function(a) {
  3679.     this.settings.minSpreadWidth = a,
  3680.     this.isRendered && (this.renderer.setMinSpreadWidth(this.settings.minSpreadWidth),
  3681.     this.renderer.reformat())
  3682. }
  3683. ,
  3684. EPUBJS.Book.prototype.setGap = function(a) {
  3685.     this.settings.gap = a,
  3686.     this.isRendered && (this.renderer.setGap(this.settings.gap),
  3687.     this.renderer.reformat())
  3688. }
  3689. ,
  3690. EPUBJS.Book.prototype.chapter = function(a) {
  3691.     var b, c, d = this.spineIndexByURL[a];
  3692.     return d && (b = this.spine[d],
  3693.     c = new EPUBJS.Chapter(b,this.store,this.settings.withCredentials),
  3694.     c.load()),
  3695.     c
  3696. }
  3697. ,
  3698. EPUBJS.Book.prototype.unload = function() {
  3699.     this.settings.restore && localStorage && this.saveContents(),
  3700.     this.unlistenToRenderer(this.renderer),
  3701.     this.trigger("book:unload")
  3702. }
  3703. ,
  3704. EPUBJS.Book.prototype.destroy = function() {
  3705.     window.removeEventListener("beforeunload", this.unload),
  3706.     this.currentChapter && this.currentChapter.unload(),
  3707.     this.unload(),
  3708.     this.renderer && this.renderer.remove()
  3709. }
  3710. ,
  3711. EPUBJS.Book.prototype._ready = function() {
  3712.     this.trigger("book:ready")
  3713. }
  3714. ,
  3715. EPUBJS.Book.prototype._rendered = function(a) {
  3716.     this.isRendered = !0,
  3717.     this.trigger("book:rendered"),
  3718.     this._q.flush()
  3719. }
  3720. ,
  3721. EPUBJS.Book.prototype.applyStyles = function(a, b) {
  3722.     a.applyStyles(this.settings.styles),
  3723.     b()
  3724. }
  3725. ,
  3726. EPUBJS.Book.prototype.applyHeadTags = function(a, b) {
  3727.     a.applyHeadTags(this.settings.headTags),
  3728.     b()
  3729. }
  3730. ,
  3731. EPUBJS.Book.prototype._registerReplacements = function(a) {
  3732.     a.registerHook("beforeChapterDisplay", this.applyStyles.bind(this, a), !0),
  3733.     a.registerHook("beforeChapterDisplay", this.applyHeadTags.bind(this, a), !0),
  3734.     a.registerHook("beforeChapterDisplay", EPUBJS.replace.hrefs.bind(this), !0)
  3735. }
  3736. ,
  3737. EPUBJS.Book.prototype._needsAssetReplacement = function() {
  3738.     return !!this.settings.fromStorage || !!this.settings.contained
  3739. }
  3740. ,
  3741. EPUBJS.Book.prototype.parseLayoutProperties = function(a) {
  3742.     var b = this.layoutOveride && this.layoutOveride.layout || a.layout || "reflowable"
  3743.       , c = this.layoutOveride && this.layoutOveride.spread || a.spread || "auto"
  3744.       , d = this.layoutOveride && this.layoutOveride.orientation || a.orientation || "auto";
  3745.     return {
  3746.         layout: b,
  3747.         spread: c,
  3748.         orientation: d
  3749.     }
  3750. }
  3751. ,
  3752. RSVP.EventTarget.mixin(EPUBJS.Book.prototype),
  3753. RSVP.on("error", function(a) {}),
  3754. RSVP.configure("instrument", !1),
  3755. EPUBJS.Chapter = function(a, b, c) {
  3756.     this.href = a.href,
  3757.     this.absolute = a.url,
  3758.     this.id = a.id,
  3759.     this.spinePos = a.index,
  3760.     this.cfiBase = a.cfiBase,
  3761.     this.properties = a.properties,
  3762.     this.manifestProperties = a.manifestProperties,
  3763.     this.linear = a.linear,
  3764.     this.pages = 1,
  3765.     this.store = b,
  3766.     this.credentials = c,
  3767.     this.epubcfi = new EPUBJS.EpubCFI,
  3768.     this.deferred = new RSVP.defer,
  3769.     this.loaded = this.deferred.promise,
  3770.     EPUBJS.Hooks.mixin(this),
  3771.     this.getHooks("beforeChapterRender"),
  3772.     this.caches = {}
  3773. }
  3774. ,
  3775. EPUBJS.Chapter.prototype.load = function(a, b) {
  3776.     var c, d = a || this.store, e = b || this.credentials;
  3777.     return c = d ? d.getXml(this.absolute) : EPUBJS.core.request(this.absolute, "xml", e),
  3778.     c.then(function(a) {
  3779.         this.setDocument(a),
  3780.         this.deferred.resolve(this)
  3781.     }
  3782.     .bind(this)),
  3783.     c
  3784. }
  3785. ,
  3786. EPUBJS.Chapter.prototype.render = function(a) {
  3787.     return this.load().then(function(a) {
  3788.         var b = a.querySelector("head")
  3789.           , c = a.createElement("base");
  3790.         return c.setAttribute("href", this.absolute),
  3791.         b.insertBefore(c, b.firstChild),
  3792.         this.contents = a,
  3793.         new RSVP.Promise(function(b, c) {
  3794.             this.triggerHooks("beforeChapterRender", function() {
  3795.                 b(a)
  3796.             }
  3797.             .bind(this), this)
  3798.         }
  3799.         .bind(this))
  3800.     }
  3801.     .bind(this)).then(function(a) {
  3802.         var b = new XMLSerializer
  3803.           , c = b.serializeToString(a);
  3804.         return c
  3805.     }
  3806.     .bind(this))
  3807. }
  3808. ,
  3809. EPUBJS.Chapter.prototype.url = function(a) {
  3810.     var b, c = new RSVP.defer, d = a || this.store, e = this;
  3811.     return d ? this.tempUrl ? (b = this.tempUrl,
  3812.     c.resolve(b)) : d.getUrl(this.absolute).then(function(a) {
  3813.         e.tempUrl = a,
  3814.         c.resolve(a)
  3815.     }) : (b = this.absolute,
  3816.     c.resolve(b)),
  3817.     c.promise
  3818. }
  3819. ,
  3820. EPUBJS.Chapter.prototype.setPages = function(a) {
  3821.     this.pages = a
  3822. }
  3823. ,
  3824. EPUBJS.Chapter.prototype.getPages = function(a) {
  3825.     return this.pages
  3826. }
  3827. ,
  3828. EPUBJS.Chapter.prototype.getID = function() {
  3829.     return this.ID
  3830. }
  3831. ,
  3832. EPUBJS.Chapter.prototype.unload = function(a) {
  3833.     this.document = null,
  3834.     this.tempUrl && a && (a.revokeUrl(this.tempUrl),
  3835.     this.tempUrl = !1)
  3836. }
  3837. ,
  3838. EPUBJS.Chapter.prototype.setDocument = function(a) {
  3839.     var b = a.namespaceURI;
  3840.     a.doctype;
  3841.     this.document = a.implementation.createDocument(b, null, null),
  3842.     this.contents = this.document.importNode(a.documentElement, !0),
  3843.     this.document.appendChild(this.contents),
  3844.     !this.document.evaluate && document.evaluate && (this.document.evaluate = document.evaluate)
  3845. }
  3846. ,
  3847. EPUBJS.Chapter.prototype.cfiFromRange = function(a) {
  3848.     var b, c, d, e, f, g;
  3849.     if (this.document) {
  3850.         if ("undefined" != typeof document.evaluate) {
  3851.             if (c = EPUBJS.core.getElementXPath(a.startContainer),
  3852.             d = EPUBJS.core.getElementXPath(a.endContainer),
  3853.             e = this.document.evaluate(c, this.document, EPUBJS.core.nsResolver, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue,
  3854.             a.collapsed || (f = this.document.evaluate(d, this.document, EPUBJS.core.nsResolver, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue),
  3855.             b = this.document.createRange(),
  3856.             e)
  3857.                 try {
  3858.                     b.setStart(e, a.startOffset),
  3859.                     !a.collapsed && f && b.setEnd(f, a.endOffset)
  3860.                 } catch (h) {
  3861.                     console.log("missed"),
  3862.                     e = !1
  3863.                 }
  3864.             e || (console.log("not found, try fuzzy match"),
  3865.             cleanStartTextContent = EPUBJS.core.cleanStringForXpath(a.startContainer.textContent),
  3866.             c = "//text()[contains(.," + cleanStartTextContent + ")]",
  3867.             e = this.document.evaluate(c, this.document, EPUBJS.core.nsResolver, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue,
  3868.             e && (b.setStart(e, a.startOffset),
  3869.             a.collapsed || (g = EPUBJS.core.cleanStringForXpath(a.endContainer.textContent),
  3870.             d = "//text()[contains(.," + g + ")]",
  3871.             f = this.document.evaluate(d, this.document, EPUBJS.core.nsResolver, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue,
  3872.             f && b.setEnd(f, a.endOffset))))
  3873.         } else
  3874.             b = a;
  3875.         return this.epubcfi.generateCfiFromRange(b, this.cfiBase)
  3876.     }
  3877. }
  3878. ,
  3879. EPUBJS.Chapter.prototype.find = function(a) {
  3880.     var b = this
  3881.       , c = []
  3882.       , d = a.toLowerCase()
  3883.       , e = function(a) {
  3884.         for (var e, f, g, h = a.textContent.toLowerCase(), i = b.document.createRange(), j = -1, k = 150; f != -1; )
  3885.             f = h.indexOf(d, j + 1),
  3886.             f != -1 && (i = b.document.createRange(),
  3887.             i.setStart(a, f),
  3888.             i.setEnd(a, f + d.length),
  3889.             e = b.cfiFromRange(i),
  3890.             a.textContent.length < k ? g = a.textContent : (g = a.textContent.substring(f - k / 2, f + k / 2),
  3891.             g = "..." + g + "..."),
  3892.             c.push({
  3893.                 cfi: e,
  3894.                 excerpt: g
  3895.             })),
  3896.             j = f
  3897.     };
  3898.     return this.textSprint(this.document, function(a) {
  3899.         e(a)
  3900.     }),
  3901.     c
  3902. }
  3903. ,
  3904. EPUBJS.Chapter.prototype.textSprint = function(a, b) {
  3905.     for (var c, d = document.createTreeWalker(a, NodeFilter.SHOW_TEXT, {
  3906.         acceptNode: function(a) {
  3907.             return a.data && !/^\s*$/.test(a.data) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT
  3908.         }
  3909.     }, !1); c = d.nextNode(); )
  3910.         b(c)
  3911. }
  3912. ,
  3913. EPUBJS.Chapter.prototype.replace = function(a, b, c, d) {
  3914.     var e = this.contents.querySelectorAll(a)
  3915.       , f = Array.prototype.slice.call(e)
  3916.       , g = f.length;
  3917.     return 0 === g ? void c(!1) : void f.forEach(function(a) {
  3918.         var e = !1
  3919.           , f = function(a, b) {
  3920.             e === !1 && (g--,
  3921.             d && d(a, b, g),
  3922.             g <= 0 && c && c(!0),
  3923.             e = !0)
  3924.         };
  3925.         b(a, f)
  3926.     }
  3927.     .bind(this))
  3928. }
  3929. ,
  3930. EPUBJS.Chapter.prototype.replaceWithStored = function(a, b, c, d) {
  3931.     var e, f = {}, g = this.store, h = this.caches[a], i = EPUBJS.core.uri(this.absolute), j = i.base, k = b, l = 5, m = function(a, b, c) {
  3932.         f[b] = a
  3933.     }, n = function(a) {
  3934.         d && d(),
  3935.         EPUBJS.core.values(e).forEach(function(a) {
  3936.             g.revokeUrl(a)
  3937.         }),
  3938.         h = f
  3939.     };
  3940.     g && (h || (h = {}),
  3941.     e = EPUBJS.core.clone(h),
  3942.     this.replace(a, function(b, d) {
  3943.         var h = b.getAttribute(k)
  3944.           , i = EPUBJS.core.resolveUrl(j, h)
  3945.           , m = function(c) {
  3946.             var e;
  3947.             b.onload = function() {
  3948.                 clearTimeout(e),
  3949.                 d(c, i)
  3950.             }
  3951.             ,
  3952.             b.onerror = function(a) {
  3953.                 clearTimeout(e),
  3954.                 d(c, i),
  3955.                 console.error(a)
  3956.             }
  3957.             ,
  3958.             "image" == a && b.setAttribute("externalResourcesRequired", "true"),
  3959.             "link[href]" == a && "stylesheet" !== b.getAttribute("rel") ? d(c, i) : e = setTimeout(function() {
  3960.                 d(c, i)
  3961.             }, l),
  3962.             b.setAttribute(k, c)
  3963.         };
  3964.         i in e ? (m(e[i]),
  3965.         f[i] = e[i],
  3966.         delete e[i]) : c(g, i, m, b)
  3967.     }, n, m))
  3968. }
  3969. ;
  3970. var EPUBJS = EPUBJS || {};
  3971. EPUBJS.core = {},
  3972. EPUBJS.core.getEl = function(a) {
  3973.     return document.getElementById(a)
  3974. }
  3975. ,
  3976. EPUBJS.core.getEls = function(a) {
  3977.     return document.getElementsByClassName(a)
  3978. }
  3979. ,
  3980. EPUBJS.core.request = function(a, b, c) {
  3981.     function d() {
  3982.         if (this.readyState === this.DONE)
  3983.             if (200 === this.status || 0 === this.status && this.response) {
  3984.                 var a;
  3985.                 a = "xml" == b ? this.responseXML : "json" == b ? JSON.parse(this.response) : "blob" == b ? e ? this.response : new Blob([this.response]) : this.response,
  3986.                 g.resolve(a)
  3987.             } else
  3988.                 g.reject({
  3989.                     message: this.response,
  3990.                     stack: (new Error).stack
  3991.                 })
  3992.     }
  3993.     var e = window.URL
  3994.       , f = e ? "blob" : "arraybuffer"
  3995.       , g = new RSVP.defer
  3996.       , h = new XMLHttpRequest
  3997.       , i = XMLHttpRequest.prototype;
  3998.     return "overrideMimeType"in i || Object.defineProperty(i, "overrideMimeType", {
  3999.         value: function(a) {}
  4000.     }),
  4001.     c && (h.withCredentials = !0),
  4002.     h.open("GET", a, !0),
  4003.     h.onreadystatechange = d,
  4004.     "blob" == b && (h.responseType = f),
  4005.     "json" == b && h.setRequestHeader("Accept", "application/json"),
  4006.     "xml" == b && h.overrideMimeType("text/xml"),
  4007.     "binary" == b && (h.responseType = "arraybuffer"),
  4008.     h.send(),
  4009.     g.promise
  4010. }
  4011. ,
  4012. EPUBJS.core.toArray = function(a) {
  4013.     var b = [];
  4014.     for (var c in a) {
  4015.         var d;
  4016.         a.hasOwnProperty(c) && (d = a[c],
  4017.         d.ident = c,
  4018.         b.push(d))
  4019.     }
  4020.     return b
  4021. }
  4022. ,
  4023. EPUBJS.core.uri = function(a) {
  4024.     var b, c, d, e = {
  4025.         protocol: "",
  4026.         host: "",
  4027.         path: "",
  4028.         origin: "",
  4029.         directory: "",
  4030.         base: "",
  4031.         filename: "",
  4032.         extension: "",
  4033.         fragment: "",
  4034.         href: a
  4035.     }, f = a.indexOf("blob:"), g = a.indexOf("://"), h = a.indexOf("?"), i = a.indexOf("#");
  4036.     return 0 === f ? (e.protocol = "blob",
  4037.     e.base = a.indexOf(0, i),
  4038.     e) : (i != -1 && (e.fragment = a.slice(i + 1),
  4039.     a = a.slice(0, i)),
  4040.     h != -1 && (e.search = a.slice(h + 1),
  4041.     a = a.slice(0, h),
  4042.     href = a),
  4043.     g != -1 ? (e.protocol = a.slice(0, g),
  4044.     b = a.slice(g + 3),
  4045.     d = b.indexOf("/"),
  4046.     d === -1 ? (e.host = e.path,
  4047.     e.path = "") : (e.host = b.slice(0, d),
  4048.     e.path = b.slice(d)),
  4049.     e.origin = e.protocol + "://" + e.host,
  4050.     e.directory = EPUBJS.core.folder(e.path),
  4051.     e.base = e.origin + e.directory) : (e.path = a,
  4052.     e.directory = EPUBJS.core.folder(a),
  4053.     e.base = e.directory),
  4054.     e.filename = a.replace(e.base, ""),
  4055.     c = e.filename.lastIndexOf("."),
  4056.     c != -1 && (e.extension = e.filename.slice(c + 1)),
  4057.     e)
  4058. }
  4059. ,
  4060. EPUBJS.core.folder = function(a) {
  4061.     var b = a.lastIndexOf("/");
  4062.     if (b == -1)
  4063.         var c = "";
  4064.     return c = a.slice(0, b + 1)
  4065. }
  4066. ,
  4067. EPUBJS.core.dataURLToBlob = function(a) {
  4068.     var b, c, d, e, f, g = ";base64,";
  4069.     if (a.indexOf(g) == -1)
  4070.         return b = a.split(","),
  4071.         c = b[0].split(":")[1],
  4072.         d = b[1],
  4073.         new Blob([d],{
  4074.             type: c
  4075.         });
  4076.     b = a.split(g),
  4077.     c = b[0].split(":")[1],
  4078.     d = window.atob(b[1]),
  4079.     e = d.length,
  4080.     f = new Uint8Array(e);
  4081.     for (var h = 0; h < e; ++h)
  4082.         f[h] = d.charCodeAt(h);
  4083.     return new Blob([f],{
  4084.         type: c
  4085.     })
  4086. }
  4087. ,
  4088. EPUBJS.core.addScript = function(a, b, c) {
  4089.     var d, e;
  4090.     e = !1,
  4091.     d = document.createElement("script"),
  4092.     d.type = "text/javascript",
  4093.     d.async = !1,
  4094.     d.src = a,
  4095.     d.onload = d.onreadystatechange = function() {
  4096.         e || this.readyState && "complete" != this.readyState || (e = !0,
  4097.         b && b())
  4098.     }
  4099.     ,
  4100.     c = c || document.body,
  4101.     c.appendChild(d)
  4102. }
  4103. ,
  4104. EPUBJS.core.addScripts = function(a, b, c) {
  4105.     var d = a.length
  4106.       , e = 0
  4107.       , f = function() {
  4108.         e++,
  4109.         d == e ? b && b() : EPUBJS.core.addScript(a[e], f, c)
  4110.     };
  4111.     EPUBJS.core.addScript(a[e], f, c)
  4112. }
  4113. ,
  4114. EPUBJS.core.addCss = function(a, b, c) {
  4115.     var d, e;
  4116.     e = !1,
  4117.     d = document.createElement("link"),
  4118.     d.type = "text/css",
  4119.     d.rel = "stylesheet",
  4120.     d.href = a,
  4121.     d.onload = d.onreadystatechange = function() {
  4122.         e || this.readyState && "complete" != this.readyState || (e = !0,
  4123.         b && b())
  4124.     }
  4125.     ,
  4126.     c = c || document.body,
  4127.     c.appendChild(d)
  4128. }
  4129. ,
  4130. EPUBJS.core.prefixed = function(a) {
  4131.     var b = ["Webkit", "Moz", "O", "ms"]
  4132.       , c = a[0].toUpperCase() + a.slice(1)
  4133.       , d = b.length;
  4134.     if ("undefined" != typeof document.documentElement.style[a])
  4135.         return a;
  4136.     for (var e = 0; e < d; e++)
  4137.         if ("undefined" != typeof document.documentElement.style[b[e] + c])
  4138.             return b[e] + c;
  4139.     return a
  4140. }
  4141. ,
  4142. EPUBJS.core.resolveUrl = function(a, b) {
  4143.     var c, d, e = [], f = EPUBJS.core.uri(b), g = a.split("/");
  4144.     return f.host ? b : (g.pop(),
  4145.     d = b.split("/"),
  4146.     d.forEach(function(a) {
  4147.         ".." === a ? g.pop() : e.push(a)
  4148.     }),
  4149.     c = g.concat(e),
  4150.     c.join("/"))
  4151. }
  4152. ,
  4153. EPUBJS.core.uuid = function() {
  4154.     var a = (new Date).getTime()
  4155.       , b = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(b) {
  4156.         var c = (a + 16 * Math.random()) % 16 | 0;
  4157.         return a = Math.floor(a / 16),
  4158.         ("x" == b ? c : 7 & c | 8).toString(16)
  4159.     });
  4160.     return b
  4161. }
  4162. ,
  4163. EPUBJS.core.insert = function(a, b, c) {
  4164.     var d = EPUBJS.core.locationOf(a, b, c);
  4165.     return b.splice(d, 0, a),
  4166.     d
  4167. }
  4168. ,
  4169. EPUBJS.core.locationOf = function(a, b, c, d, e) {
  4170.     var f, g = d || 0, h = e || b.length, i = parseInt(g + (h - g) / 2);
  4171.     return c || (c = function(a, b) {
  4172.         return a > b ? 1 : a < b ? -1 : (a = b) ? 0 : void 0
  4173.     }
  4174.     ),
  4175.     h - g <= 0 ? i : (f = c(b[i], a),
  4176.     h - g === 1 ? f > 0 ? i : i + 1 : 0 === f ? i : f === -1 ? EPUBJS.core.locationOf(a, b, c, i, h) : EPUBJS.core.locationOf(a, b, c, g, i))
  4177. }
  4178. ,
  4179. EPUBJS.core.indexOfSorted = function(a, b, c, d, e) {
  4180.     var f, g = d || 0, h = e || b.length, i = parseInt(g + (h - g) / 2);
  4181.     return c || (c = function(a, b) {
  4182.         return a > b ? 1 : a < b ? -1 : (a = b) ? 0 : void 0
  4183.     }
  4184.     ),
  4185.     h - g <= 0 ? -1 : (f = c(b[i], a),
  4186.     h - g === 1 ? 0 === f ? i : -1 : 0 === f ? i : f === -1 ? EPUBJS.core.indexOfSorted(a, b, c, i, h) : EPUBJS.core.indexOfSorted(a, b, c, g, i))
  4187. }
  4188. ,
  4189. EPUBJS.core.queue = function(a) {
  4190.     var b = []
  4191.       , c = a
  4192.       , d = function(a, c, d) {
  4193.         return b.push({
  4194.             funcName: a,
  4195.             args: c,
  4196.             context: d
  4197.         }),
  4198.         b
  4199.     }
  4200.       , e = function() {
  4201.         var a;
  4202.         b.length && (a = b.shift(),
  4203.         c[a.funcName].apply(a.context || c, a.args))
  4204.     }
  4205.       , f = function() {
  4206.         for (; b.length; )
  4207.             e()
  4208.     }
  4209.       , g = function() {
  4210.         b = []
  4211.     }
  4212.       , h = function() {
  4213.         return b.length
  4214.     };
  4215.     return {
  4216.         enqueue: d,
  4217.         dequeue: e,
  4218.         flush: f,
  4219.         clear: g,
  4220.         length: h
  4221.     }
  4222. }
  4223. ,
  4224. EPUBJS.core.getElementXPath = function(a) {
  4225.     return a && a.id ? '//*[@id="' + a.id + '"]' : EPUBJS.core.getElementTreeXPath(a)
  4226. }
  4227. ,
  4228. EPUBJS.core.getElementTreeXPath = function(a) {
  4229.     var b, c, d, e, f = [], g = "http://www.w3.org/1999/xhtml" === a.ownerDocument.documentElement.getAttribute("xmlns");
  4230.     for (a.nodeType === Node.TEXT_NODE && (b = EPUBJS.core.indexOfTextNode(a) + 1,
  4231.     f.push("text()[" + b + "]"),
  4232.     a = a.parentNode); a && 1 == a.nodeType; a = a.parentNode) {
  4233.         b = 0;
  4234.         for (var h = a.previousSibling; h; h = h.previousSibling)
  4235.             h.nodeType != Node.DOCUMENT_TYPE_NODE && h.nodeName == a.nodeName && ++b;
  4236.         c = a.nodeName.toLowerCase(),
  4237.         d = g ? "xhtml:" + c : c,
  4238.         e = b ? "[" + (b + 1) + "]" : "",
  4239.         f.splice(0, 0, d + e)
  4240.     }
  4241.     return f.length ? "./" + f.join("/") : null
  4242. }
  4243. ,
  4244. EPUBJS.core.nsResolver = function(a) {
  4245.     var b = {
  4246.         xhtml: "http://www.w3.org/1999/xhtml",
  4247.         epub: "http://www.idpf.org/2007/ops"
  4248.     };
  4249.     return b[a] || null
  4250. }
  4251. ,
  4252. EPUBJS.core.cleanStringForXpath = function(a) {
  4253.     var b = a.match(/[^'"]+|['"]/g);
  4254.     return b = b.map(function(a) {
  4255.         return "'" === a ? '"\'"' : '"' === a ? "'\"'" : "'" + a + "'"
  4256.     }),
  4257.     "concat(''," + b.join(",") + ")"
  4258. }
  4259. ,
  4260. EPUBJS.core.indexOfTextNode = function(a) {
  4261.     for (var b, c = a.parentNode, d = c.childNodes, e = -1, f = 0; f < d.length && (b = d[f],
  4262.     b.nodeType === Node.TEXT_NODE && e++,
  4263.     b != a); f++)
  4264.         ;
  4265.     return e
  4266. }
  4267. ,
  4268. EPUBJS.core.defaults = function(a) {
  4269.     for (var b = 1, c = arguments.length; b < c; b++) {
  4270.         var d = arguments[b];
  4271.         for (var e in d)
  4272.             void 0 === a[e] && (a[e] = d[e])
  4273.     }
  4274.     return a
  4275. }
  4276. ,
  4277. EPUBJS.core.extend = function(a) {
  4278.     var b = [].slice.call(arguments, 1);
  4279.     return b.forEach(function(b) {
  4280.         b && Object.getOwnPropertyNames(b).forEach(function(c) {
  4281.             Object.defineProperty(a, c, Object.getOwnPropertyDescriptor(b, c))
  4282.         })
  4283.     }),
  4284.     a
  4285. }
  4286. ,
  4287. EPUBJS.core.clone = function(a) {
  4288.     return EPUBJS.core.isArray(a) ? a.slice() : EPUBJS.core.extend({}, a)
  4289. }
  4290. ,
  4291. EPUBJS.core.isElement = function(a) {
  4292.     return !(!a || 1 != a.nodeType)
  4293. }
  4294. ,
  4295. EPUBJS.core.isNumber = function(a) {
  4296.     return !isNaN(parseFloat(a)) && isFinite(a)
  4297. }
  4298. ,
  4299. EPUBJS.core.isString = function(a) {
  4300.     return "string" == typeof a || a instanceof String
  4301. }
  4302. ,
  4303. EPUBJS.core.isArray = Array.isArray || function(a) {
  4304.     return "[object Array]" === Object.prototype.toString.call(a)
  4305. }
  4306. ,
  4307. EPUBJS.core.values = function(a) {
  4308.     var b, c, d, e = -1;
  4309.     if (!a)
  4310.         return [];
  4311.     for (b = Object.keys(a),
  4312.     c = b.length,
  4313.     d = Array(c); ++e < c; )
  4314.         d[e] = a[b[e]];
  4315.     return d
  4316. }
  4317. ,
  4318. EPUBJS.EpubCFI = function(a) {
  4319.     if (a)
  4320.         return this.parse(a)
  4321. }
  4322. ,
  4323. EPUBJS.EpubCFI.prototype.generateChapterComponent = function(a, b, c) {
  4324.     var d = parseInt(b)
  4325.       , e = a + 1
  4326.       , f = "/" + e + "/";
  4327.     return f += 2 * (d + 1),
  4328.     c && (f += "[" + c + "]"),
  4329.     f
  4330. }
  4331. ,
  4332. EPUBJS.EpubCFI.prototype.generatePathComponent = function(a) {
  4333.     var b = [];
  4334.     return a.forEach(function(a) {
  4335.         var c = "";
  4336.         c += 2 * (a.index + 1),
  4337.         a.id && (c += "[" + a.id + "]"),
  4338.         b.push(c)
  4339.     }),
  4340.     b.join("/")
  4341. }
  4342. ,
  4343. EPUBJS.EpubCFI.prototype.generateCfiFromElement = function(a, b) {
  4344.     var c = this.pathTo(a)
  4345.       , d = this.generatePathComponent(c);
  4346.     return d.length ? "epubcfi(" + b + "!" + d + "/1:0)" : "epubcfi(" + b + "!/4/)"
  4347. }
  4348. ,
  4349. EPUBJS.EpubCFI.prototype.pathTo = function(a) {
  4350.     for (var b, c = []; a && null !== a.parentNode && 9 != a.parentNode.nodeType; )
  4351.         b = a.parentNode.children,
  4352.         c.unshift({
  4353.             id: a.id,
  4354.             tagName: a.tagName,
  4355.             index: b ? Array.prototype.indexOf.call(b, a) : 0
  4356.         }),
  4357.         a = a.parentNode;
  4358.     return c
  4359. }
  4360. ,
  4361. EPUBJS.EpubCFI.prototype.getChapterComponent = function(a) {
  4362.     var b = a.split("!");
  4363.     return b[0]
  4364. }
  4365. ,
  4366. EPUBJS.EpubCFI.prototype.getPathComponent = function(a) {
  4367.     var b = a.split("!")
  4368.       , c = b[1] ? b[1].split(":") : "";
  4369.     return c[0]
  4370. }
  4371. ,
  4372. EPUBJS.EpubCFI.prototype.getCharecterOffsetComponent = function(a) {
  4373.     var b = a.split(":");
  4374.     return b[1] || ""
  4375. }
  4376. ,
  4377. EPUBJS.EpubCFI.prototype.parse = function(a) {
  4378.     var b, c, d, e, f, g, h, i, j, k = {}, l = function(a) {
  4379.         var b, c, d, e;
  4380.         return b = "element",
  4381.         c = parseInt(a) / 2 - 1,
  4382.         d = a.match(/\[(.*)\]/),
  4383.         d && d[1] && (e = d[1]),
  4384.         {
  4385.             type: b,
  4386.             index: c,
  4387.             id: e || !1
  4388.         }
  4389.     };
  4390.     return "string" != typeof a ? {
  4391.         spinePos: -1
  4392.     } : (k.str = a,
  4393.     0 === a.indexOf("epubcfi(") && ")" === a[a.length - 1] && (a = a.slice(8, a.length - 1)),
  4394.     c = this.getChapterComponent(a),
  4395.     d = this.getPathComponent(a) || "",
  4396.     e = this.getCharecterOffsetComponent(a),
  4397.     c && (b = c.split("/")[2] || "") ? (k.spinePos = parseInt(b) / 2 - 1 || 0,
  4398.     g = b.match(/\[(.*)\]/),
  4399.     k.spineId = !!g && g[1],
  4400.     d.indexOf(",") != -1 && console.warn("CFI Ranges are not supported"),
  4401.     h = d.split("/"),
  4402.     i = h.pop(),
  4403.     k.steps = [],
  4404.     h.forEach(function(a) {
  4405.         var b;
  4406.         a && (b = l(a),
  4407.         k.steps.push(b))
  4408.     }),
  4409.     j = parseInt(i),
  4410.     isNaN(j) || (j % 2 === 0 ? k.steps.push(l(i)) : k.steps.push({
  4411.         type: "text",
  4412.         index: (j - 1) / 2
  4413.     })),
  4414.     f = e.match(/\[(.*)\]/),
  4415.     f && f[1] ? (k.characterOffset = parseInt(e.split("[")[0]),
  4416.     k.textLocationAssertion = f[1]) : k.characterOffset = parseInt(e),
  4417.     k) : {
  4418.         spinePos: -1
  4419.     })
  4420. }
  4421. ,
  4422. EPUBJS.EpubCFI.prototype.addMarker = function(a, b, c) {
  4423.     var d, e, f, g, h = b || document, i = c || this.createMarker(h);
  4424.     return "string" == typeof a && (a = this.parse(a)),
  4425.     e = a.steps[a.steps.length - 1],
  4426.     a.spinePos !== -1 && (!!(d = this.findParent(a, h)) && (e && "text" === e.type ? (f = d.childNodes[e.index],
  4427.     a.characterOffset ? (g = f.splitText(a.characterOffset),
  4428.     i.classList.add("EPUBJS-CFI-SPLIT"),
  4429.     d.insertBefore(i, g)) : d.insertBefore(i, f)) : d.insertBefore(i, d.firstChild),
  4430.     i))
  4431. }
  4432. ,
  4433. EPUBJS.EpubCFI.prototype.createMarker = function(a) {
  4434.     var b = a || document
  4435.       , c = b.createElement("span");
  4436.     return c.id = "EPUBJS-CFI-MARKER:" + EPUBJS.core.uuid(),
  4437.     c.classList.add("EPUBJS-CFI-MARKER"),
  4438.     c
  4439. }
  4440. ,
  4441. EPUBJS.EpubCFI.prototype.removeMarker = function(a, b) {
  4442.     b || document;
  4443.     a.classList.contains("EPUBJS-CFI-SPLIT") ? (nextSib = a.nextSibling,
  4444.     prevSib = a.previousSibling,
  4445.     nextSib && prevSib && 3 === nextSib.nodeType && 3 === prevSib.nodeType && (prevSib.textContent += nextSib.textContent,
  4446.     a.parentNode.removeChild(nextSib)),
  4447.     a.parentNode.removeChild(a)) : a.classList.contains("EPUBJS-CFI-MARKER") && a.parentNode.removeChild(a)
  4448. }
  4449. ,
  4450. EPUBJS.EpubCFI.prototype.findParent = function(a, b) {
  4451.     var c, d, e, f = b || document, g = f.getElementsByTagName("html")[0], h = Array.prototype.slice.call(g.children);
  4452.     if ("string" == typeof a && (a = this.parse(a)),
  4453.     d = a.steps.slice(0),
  4454.     !d.length)
  4455.         return f.getElementsByTagName("body")[0];
  4456.     for (; d && d.length > 0; ) {
  4457.         if (c = d.shift(),
  4458.         "text" === c.type ? (e = g.childNodes[c.index],
  4459.         g = e.parentNode || g) : g = c.id ? f.getElementById(c.id) : h[c.index],
  4460.         "undefined" == typeof g)
  4461.             return console.error("No Element For", c, a.str),
  4462.             !1;
  4463.         h = Array.prototype.slice.call(g.children)
  4464.     }
  4465.     return g
  4466. }
  4467. ,
  4468. EPUBJS.EpubCFI.prototype.compare = function(a, b) {
  4469.     if ("string" == typeof a && (a = new EPUBJS.EpubCFI(a)),
  4470.     "string" == typeof b && (b = new EPUBJS.EpubCFI(b)),
  4471.     a.spinePos > b.spinePos)
  4472.         return 1;
  4473.     if (a.spinePos < b.spinePos)
  4474.         return -1;
  4475.     for (var c = 0; c < a.steps.length; c++) {
  4476.         if (!b.steps[c])
  4477.             return 1;
  4478.         if (a.steps[c].index > b.steps[c].index)
  4479.             return 1;
  4480.         if (a.steps[c].index < b.steps[c].index)
  4481.             return -1
  4482.     }
  4483.     return a.steps.length < b.steps.length ? -1 : a.characterOffset > b.characterOffset ? 1 : a.characterOffset < b.characterOffset ? -1 : 0
  4484. }
  4485. ,
  4486. EPUBJS.EpubCFI.prototype.generateCfiFromHref = function(a, b) {
  4487.     var c, d, e = EPUBJS.core.uri(a), f = e.path, g = e.fragment, h = b.spineIndexByURL[f], i = new RSVP.defer, j = new EPUBJS.EpubCFI;
  4488.     return "undefined" != typeof h && (d = b.spine[h],
  4489.     c = b.loadXml(d.url),
  4490.     c.then(function(a) {
  4491.         var b, c = a.getElementById(g);
  4492.         b = j.generateCfiFromElement(c, d.cfiBase),
  4493.         i.resolve(b)
  4494.     })),
  4495.     i.promise
  4496. }
  4497. ,
  4498. EPUBJS.EpubCFI.prototype.generateCfiFromTextNode = function(a, b, c) {
  4499.     var d = a.parentNode
  4500.       , e = this.pathTo(d)
  4501.       , f = this.generatePathComponent(e)
  4502.       , g = 1 + 2 * Array.prototype.indexOf.call(d.childNodes, a);
  4503.     return "epubcfi(" + c + "!" + f + "/" + g + ":" + (b || 0) + ")"
  4504. }
  4505. ,
  4506. EPUBJS.EpubCFI.prototype.generateCfiFromRangeAnchor = function(a, b) {
  4507.     var c = a.anchorNode
  4508.       , d = a.anchorOffset;
  4509.     return this.generateCfiFromTextNode(c, d, b)
  4510. }
  4511. ,
  4512. EPUBJS.EpubCFI.prototype.generateCfiFromRange = function(a, b) {
  4513.     var c, d, e, f, g, h, i, j, k, l, m, n;
  4514.     if (c = a.startContainer,
  4515.     3 === c.nodeType)
  4516.         d = c.parentNode,
  4517.         h = 1 + 2 * EPUBJS.core.indexOfTextNode(c),
  4518.         e = this.pathTo(d);
  4519.     else {
  4520.         if (a.collapsed)
  4521.             return this.generateCfiFromElement(c, b);
  4522.         e = this.pathTo(c)
  4523.     }
  4524.     return f = this.generatePathComponent(e),
  4525.     g = a.startOffset,
  4526.     a.collapsed ? "epubcfi(" + b + "!" + f + "/" + h + ":" + g + ")" : (i = a.endContainer,
  4527.     3 === i.nodeType ? (j = i.parentNode,
  4528.     n = 1 + 2 * EPUBJS.core.indexOfTextNode(i),
  4529.     k = this.pathTo(j)) : k = this.pathTo(i),
  4530.     l = this.generatePathComponent(k),
  4531.     m = a.endOffset,
  4532.     l = l.replace(f, ""),
  4533.     l.length && (l += "/"),
  4534.     "epubcfi(" + b + "!" + f + "/" + h + ":" + g + "," + l + n + ":" + m + ")")
  4535. }
  4536. ,
  4537. EPUBJS.EpubCFI.prototype.generateXpathFromSteps = function(a) {
  4538.     var b = [".", "*"];
  4539.     return a.forEach(function(a) {
  4540.         var c = a.index + 1;
  4541.         a.id ? b.push("*[position()=" + c + " and @id='" + a.id + "']") : "text" === a.type ? b.push("text()[" + c + "]") : b.push("*[" + c + "]")
  4542.     }),
  4543.     b.join("/")
  4544. }
  4545. ,
  4546. EPUBJS.EpubCFI.prototype.generateQueryFromSteps = function(a) {
  4547.     var b = ["html"];
  4548.     return a.forEach(function(a) {
  4549.         var c = a.index + 1;
  4550.         a.id ? b.push("#" + a.id) : "text" === a.type || b.push("*:nth-child(" + c + ")")
  4551.     }),
  4552.     b.join(">")
  4553. }
  4554. ,
  4555. EPUBJS.EpubCFI.prototype.generateRangeFromCfi = function(a, b) {
  4556.     var c, d, e, f, g, h, i = b || document, j = i.createRange();
  4557.     return "string" == typeof a && (a = this.parse(a)),
  4558.     a.spinePos !== -1 && (c = a.steps[a.steps.length - 1],
  4559.     "undefined" != typeof document.evaluate ? (d = this.generateXpathFromSteps(a.steps),
  4560.     e = i.evaluate(d, i, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue) : (g = this.generateQueryFromSteps(a.steps),
  4561.     h = i.querySelector(g),
  4562.     h && "text" == c.type && (e = h.childNodes[c.index])),
  4563.     e ? (e && a.characterOffset >= 0 ? (f = e.length,
  4564.     a.characterOffset < f ? (j.setStart(e, a.characterOffset),
  4565.     j.setEnd(e, f)) : (console.debug("offset greater than length:", a.characterOffset, f),
  4566.     j.setStart(e, f - 1),
  4567.     j.setEnd(e, f))) : e && j.selectNode(e),
  4568.     j) : null)
  4569. }
  4570. ,
  4571. EPUBJS.EpubCFI.prototype.isCfiString = function(a) {
  4572.     return "string" == typeof a && 0 === a.indexOf("epubcfi(")
  4573. }
  4574. ,
  4575. EPUBJS.Events = function(a, b) {
  4576.     return this.events = {},
  4577.     b ? this.el = b : this.el = document.createElement("div"),
  4578.     a.createEvent = this.createEvent,
  4579.     a.tell = this.tell,
  4580.     a.listen = this.listen,
  4581.     a.deafen = this.deafen,
  4582.     a.listenUntil = this.listenUntil,
  4583.     this
  4584. }
  4585. ,
  4586. EPUBJS.Events.prototype.createEvent = function(a) {
  4587.     var b = new CustomEvent(a);
  4588.     return this.events[a] = b,
  4589.     b
  4590. }
  4591. ,
  4592. EPUBJS.Events.prototype.tell = function(a, b) {
  4593.     var c;
  4594.     this.events[a] ? c = this.events[a] : (console.warn("No event:", a, "defined yet, creating."),
  4595.     c = this.createEvent(a)),
  4596.     b && (c.msg = b),
  4597.     this.el.dispatchEvent(c)
  4598. }
  4599. ,
  4600. EPUBJS.Events.prototype.listen = function(a, b, c) {
  4601.     return this.events[a] ? void (c ? this.el.addEventListener(a, b.bind(c), !1) : this.el.addEventListener(a, b, !1)) : (console.warn("No event:", a, "defined yet, creating."),
  4602.     void this.createEvent(a))
  4603. }
  4604. ,
  4605. EPUBJS.Events.prototype.deafen = function(a, b) {
  4606.     this.el.removeEventListener(a, b, !1)
  4607. }
  4608. ,
  4609. EPUBJS.Events.prototype.listenUntil = function(a, b, c, d) {
  4610.     function e() {
  4611.         this.deafen(a, c),
  4612.         this.deafen(b, e)
  4613.     }
  4614.     this.listen(a, c, d),
  4615.     this.listen(b, e, this)
  4616. }
  4617. ,
  4618. EPUBJS.hooks = {},
  4619. EPUBJS.Hooks = function() {
  4620.     function a() {}
  4621.     return a.prototype.getHooks = function() {
  4622.         var a;
  4623.         this.hooks = {},
  4624.         Array.prototype.slice.call(arguments).forEach(function(a) {
  4625.             this.hooks[a] = []
  4626.         }, this);
  4627.         for (var b in this.hooks)
  4628.             a = EPUBJS.core.values(EPUBJS.hooks[b]),
  4629.             a.forEach(function(a) {
  4630.                 this.registerHook(b, a)
  4631.             }, this)
  4632.     }
  4633.     ,
  4634.     a.prototype.registerHook = function(a, b, c) {
  4635.         "undefined" != typeof this.hooks[a] ? "function" == typeof b ? c ? this.hooks[a].unshift(b) : this.hooks[a].push(b) : Array.isArray(b) && b.forEach(function(b) {
  4636.             c ? this.hooks[a].unshift(b) : this.hooks[a].push(b)
  4637.         }, this) : (this.hooks[a] = [b],
  4638.         "function" == typeof b ? this.hooks[a] = [b] : Array.isArray(b) && (this.hooks[a] = [],
  4639.         b.forEach(function(b) {
  4640.             this.hooks[a].push(b)
  4641.         }, this)))
  4642.     }
  4643.     ,
  4644.     a.prototype.removeHook = function(a, b) {
  4645.         var c;
  4646.         "undefined" != typeof this.hooks[a] && ("function" == typeof b ? (c = this.hooks[a].indexOf(b),
  4647.         c > -1 && this.hooks[a].splice(c, 1)) : Array.isArray(b) && b.forEach(function(b) {
  4648.             c = this.hooks[a].indexOf(b),
  4649.             c > -1 && this.hooks[a].splice(c, 1)
  4650.         }, this))
  4651.     }
  4652.     ,
  4653.     a.prototype.triggerHooks = function(a, b, c) {
  4654.         function d() {
  4655.             f--,
  4656.             f <= 0 && b && b()
  4657.         }
  4658.         var e, f;
  4659.         return "undefined" != typeof this.hooks[a] && (e = this.hooks[a],
  4660.         f = e.length,
  4661.         0 === f && b && b(),
  4662.         void e.forEach(function(a) {
  4663.             a(d, c)
  4664.         }))
  4665.     }
  4666.     ,
  4667.     {
  4668.         register: function(a) {
  4669.             if (void 0 === EPUBJS.hooks[a] && (EPUBJS.hooks[a] = {}),
  4670.             "object" != typeof EPUBJS.hooks[a])
  4671.                 throw "Already registered: " + a;
  4672.             return EPUBJS.hooks[a]
  4673.         },
  4674.         mixin: function(b) {
  4675.             for (var c in a.prototype)
  4676.                 b[c] = a.prototype[c]
  4677.         }
  4678.     }
  4679. }(),
  4680. EPUBJS.Layout = EPUBJS.Layout || {},
  4681. EPUBJS.Layout.Reflowable = function() {
  4682.     this.documentElement = null,
  4683.     this.spreadWidth = null
  4684. }
  4685. ,
  4686. EPUBJS.Layout.Reflowable.prototype.format = function(a, b, c, d) {
  4687.     var e = EPUBJS.core.prefixed("columnAxis")
  4688.       , f = EPUBJS.core.prefixed("columnGap")
  4689.       , g = EPUBJS.core.prefixed("columnWidth")
  4690.       , h = EPUBJS.core.prefixed("columnFill")
  4691.       , i = Math.floor(b)
  4692.       , j = Math.floor(i / 8)
  4693.       , k = d >= 0 ? d : j % 2 === 0 ? j : j - 1;
  4694.     return this.documentElement = a,
  4695.     this.spreadWidth = i + k,
  4696.     a.style.overflow = "hidden",
  4697.     a.style.width = i + "px",
  4698.     a.style.height = c + "px",
  4699.     a.style[e] = "horizontal",
  4700.     a.style[h] = "auto",
  4701.     a.style[g] = i + "px",
  4702.     a.style[f] = k + "px",
  4703.     this.colWidth = i,
  4704.     this.gap = k,
  4705.     {
  4706.         pageWidth: this.spreadWidth,
  4707.         pageHeight: c
  4708.     }
  4709. }
  4710. ,
  4711. EPUBJS.Layout.Reflowable.prototype.calculatePages = function() {
  4712.     var a, b;
  4713.     return this.documentElement.style.width = "auto",
  4714.     a = this.documentElement.scrollWidth,
  4715.     b = Math.ceil(a / this.spreadWidth),
  4716.     {
  4717.         displayedPages: b,
  4718.         pageCount: b
  4719.     }
  4720. }
  4721. ,
  4722. EPUBJS.Layout.ReflowableSpreads = function() {
  4723.     this.documentElement = null,
  4724.     this.spreadWidth = null
  4725. }
  4726. ,
  4727. EPUBJS.Layout.ReflowableSpreads.prototype.format = function(a, b, c, d) {
  4728.     var e = EPUBJS.core.prefixed("columnAxis")
  4729.       , f = EPUBJS.core.prefixed("columnGap")
  4730.       , g = EPUBJS.core.prefixed("columnWidth")
  4731.       , h = EPUBJS.core.prefixed("columnFill")
  4732.       , i = 2
  4733.       , j = Math.floor(b)
  4734.       , k = j % 2 === 0 ? j : j - 1
  4735.       , l = Math.floor(k / 8)
  4736.       , m = d >= 0 ? d : l % 2 === 0 ? l : l - 1
  4737.       , n = Math.floor((k - m) / i);
  4738.     return this.documentElement = a,
  4739.     this.spreadWidth = (n + m) * i,
  4740.     a.style.overflow = "hidden",
  4741.     a.style.width = k + "px",
  4742.     a.style.height = c + "px",
  4743.     a.style[e] = "horizontal",
  4744.     a.style[h] = "auto",
  4745.     a.style[f] = m + "px",
  4746.     a.style[g] = n + "px",
  4747.     this.colWidth = n,
  4748.     this.gap = m,
  4749.     {
  4750.         pageWidth: this.spreadWidth,
  4751.         pageHeight: c
  4752.     }
  4753. }
  4754. ,
  4755. EPUBJS.Layout.ReflowableSpreads.prototype.calculatePages = function() {
  4756.     var a = this.documentElement.scrollWidth
  4757.       , b = Math.ceil(a / this.spreadWidth);
  4758.     return this.documentElement.style.width = b * this.spreadWidth - this.gap + "px",
  4759.     {
  4760.         displayedPages: b,
  4761.         pageCount: 2 * b
  4762.     }
  4763. }
  4764. ,
  4765. EPUBJS.Layout.Fixed = function() {
  4766.     this.documentElement = null
  4767. }
  4768. ,
  4769. EPUBJS.Layout.Fixed.prototype.format = function(a, b, c, d) {
  4770.     var e, f, g, h, i = EPUBJS.core.prefixed("columnWidth"), j = a.querySelector("[name=viewport]");
  4771.     return this.documentElement = a,
  4772.     j && j.hasAttribute("content") && (e = j.getAttribute("content"),
  4773.     f = e.split(","),
  4774.     f[0] && (g = f[0].replace("width=", "")),
  4775.     f[1] && (h = f[1].replace("height=", ""))),
  4776.     a.style.width = g + "px" || "auto",
  4777.     a.style.height = h + "px" || "auto",
  4778.     a.style[i] = "auto",
  4779.     a.style.overflow = "auto",
  4780.     this.colWidth = g,
  4781.     this.gap = 0,
  4782.     {
  4783.         pageWidth: g,
  4784.         pageHeight: h
  4785.     }
  4786. }
  4787. ,
  4788. EPUBJS.Layout.Fixed.prototype.calculatePages = function() {
  4789.     return {
  4790.         displayedPages: 1,
  4791.         pageCount: 1
  4792.     }
  4793. }
  4794. ,
  4795. EPUBJS.Locations = function(a, b, c) {
  4796.     this.spine = a,
  4797.     this.store = b,
  4798.     this.credentials = c,
  4799.     this.epubcfi = new EPUBJS.EpubCFI,
  4800.     this._locations = [],
  4801.     this.total = 0,
  4802.     this["break"] = 150,
  4803.     this._current = 0
  4804. }
  4805. ,
  4806. EPUBJS.Locations.prototype.generate = function(a) {
  4807.     var b = new RSVP.defer
  4808.       , c = -1
  4809.       , d = this.spine.length
  4810.       , e = function(a) {
  4811.         var b, f = c + 1, g = a || new RSVP.defer;
  4812.         return f >= d ? g.resolve() : (c = f,
  4813.         b = new EPUBJS.Chapter(this.spine[c],this.store,this.credentials),
  4814.         this.process(b).then(function() {
  4815.             setTimeout(function() {
  4816.                 e(g)
  4817.             }, 1)
  4818.         })),
  4819.         g.promise
  4820.     }
  4821.     .bind(this);
  4822.     e().then(function() {
  4823.         this.total = this._locations.length - 1,
  4824.         this._currentCfi && (this.currentLocation = this._currentCfi),
  4825.         b.resolve(this._locations)
  4826.     }
  4827.     .bind(this));
  4828.     return b.promise
  4829. }
  4830. ,
  4831. EPUBJS.Locations.prototype.process = function(a) {
  4832.     return a.load().then(function(b) {
  4833.         var c, d, e = b, f = e.documentElement.querySelector("body"), g = 0;
  4834.         this.sprint(f, function(b) {
  4835.             var f, h = b.length, i = 0;
  4836.             for (0 === g && (c = e.createRange(),
  4837.             c.setStart(b, 0)),
  4838.             f = this["break"] - g,
  4839.             f > h && (g += h,
  4840.             i = h); i < h; )
  4841.                 g = this["break"],
  4842.                 i += this["break"],
  4843.                 i >= h ? g = h - (i - this["break"]) : (c.setEnd(b, i),
  4844.                 cfi = a.cfiFromRange(c),
  4845.                 this._locations.push(cfi),
  4846.                 g = 0,
  4847.                 i += 1,
  4848.                 c = e.createRange(),
  4849.                 c.setStart(b, i));
  4850.             d = b
  4851.         }
  4852.         .bind(this)),
  4853.         c && (c.setEnd(d, d.length),
  4854.         cfi = a.cfiFromRange(c),
  4855.         this._locations.push(cfi),
  4856.         g = 0)
  4857.     }
  4858.     .bind(this))
  4859. }
  4860. ,
  4861. EPUBJS.Locations.prototype.sprint = function(a, b) {
  4862.     for (var c = document.createTreeWalker(a, NodeFilter.SHOW_TEXT, null, !1); node = c.nextNode(); )
  4863.         b(node)
  4864. }
  4865. ,
  4866. EPUBJS.Locations.prototype.locationFromCfi = function(a) {
  4867.     return 0 === this._locations.length ? -1 : EPUBJS.core.locationOf(a, this._locations, this.epubcfi.compare)
  4868. }
  4869. ,
  4870. EPUBJS.Locations.prototype.percentageFromCfi = function(a) {
  4871.     var b = this.locationFromCfi(a);
  4872.     return this.percentageFromLocation(b)
  4873. }
  4874. ,
  4875. EPUBJS.Locations.prototype.percentageFromLocation = function(a) {
  4876.     return a && this.total ? a / this.total : 0
  4877. }
  4878. ,
  4879. EPUBJS.Locations.prototype.cfiFromLocation = function(a) {
  4880.     var b = -1;
  4881.     return "number" != typeof a && (a = parseInt(a)),
  4882.     a >= 0 && a < this._locations.length && (b = this._locations[a]),
  4883.     b
  4884. }
  4885. ,
  4886. EPUBJS.Locations.prototype.cfiFromPercentage = function(a) {
  4887.     var b = a > 1 ? a / 100 : a
  4888.       , c = Math.ceil(this.total * b);
  4889.     return this.cfiFromLocation(c)
  4890. }
  4891. ,
  4892. EPUBJS.Locations.prototype.load = function(a) {
  4893.     return this._locations = JSON.parse(a),
  4894.     this.total = this._locations.length - 1,
  4895.     this._locations
  4896. }
  4897. ,
  4898. EPUBJS.Locations.prototype.save = function(a) {
  4899.     return JSON.stringify(this._locations)
  4900. }
  4901. ,
  4902. EPUBJS.Locations.prototype.getCurrent = function(a) {
  4903.     return this._current
  4904. }
  4905. ,
  4906. EPUBJS.Locations.prototype.setCurrent = function(a) {
  4907.     var b;
  4908.     if ("string" == typeof a)
  4909.         this._currentCfi = a;
  4910.     else {
  4911.         if ("number" != typeof a)
  4912.             return;
  4913.         this._current = a
  4914.     }
  4915.     0 !== this._locations.length && ("string" == typeof a ? (b = this.locationFromCfi(a),
  4916.     this._current = b) : b = a,
  4917.     this.trigger("changed", {
  4918.         percentage: this.percentageFromLocation(b)
  4919.     }))
  4920. }
  4921. ,
  4922. Object.defineProperty(EPUBJS.Locations.prototype, "currentLocation", {
  4923.     get: function() {
  4924.         return this._current
  4925.     },
  4926.     set: function(a) {
  4927.         this.setCurrent(a)
  4928.     }
  4929. }),
  4930. RSVP.EventTarget.mixin(EPUBJS.Locations.prototype),
  4931. EPUBJS.Pagination = function(a) {
  4932.     this.pages = [],
  4933.     this.locations = [],
  4934.     this.epubcfi = new EPUBJS.EpubCFI,
  4935.     a && a.length && this.process(a)
  4936. }
  4937. ,
  4938. EPUBJS.Pagination.prototype.process = function(a) {
  4939.     a.forEach(function(a) {
  4940.         this.pages.push(a.page),
  4941.         this.locations.push(a.cfi)
  4942.     }, this),
  4943.     this.pageList = a,
  4944.     this.firstPage = parseInt(this.pages[0]),
  4945.     this.lastPage = parseInt(this.pages[this.pages.length - 1]),
  4946.     this.totalPages = this.lastPage - this.firstPage
  4947. }
  4948. ,
  4949. EPUBJS.Pagination.prototype.pageFromCfi = function(a) {
  4950.     var b = -1;
  4951.     if (0 === this.locations.length)
  4952.         return -1;
  4953.     var c = EPUBJS.core.indexOfSorted(a, this.locations, this.epubcfi.compare);
  4954.     return c != -1 && c < this.pages.length - 1 ? b = this.pages[c] : (c = EPUBJS.core.locationOf(a, this.locations, this.epubcfi.compare),
  4955.     b = c - 1 >= 0 ? this.pages[c - 1] : this.pages[0],
  4956.     void 0 !== b || (b = -1)),
  4957.     b
  4958. }
  4959. ,
  4960. EPUBJS.Pagination.prototype.cfiFromPage = function(a) {
  4961.     var b = -1;
  4962.     "number" != typeof a && (a = parseInt(a));
  4963.     var c = this.pages.indexOf(a);
  4964.     return c != -1 && (b = this.locations[c]),
  4965.     b
  4966. }
  4967. ,
  4968. EPUBJS.Pagination.prototype.pageFromPercentage = function(a) {
  4969.     var b = Math.round(this.totalPages * a);
  4970.     return b
  4971. }
  4972. ,
  4973. EPUBJS.Pagination.prototype.percentageFromPage = function(a) {
  4974.     var b = (a - this.firstPage) / this.totalPages;
  4975.     return Math.round(1e3 * b) / 1e3
  4976. }
  4977. ,
  4978. EPUBJS.Pagination.prototype.percentageFromCfi = function(a) {
  4979.     var b = this.pageFromCfi(a)
  4980.       , c = this.percentageFromPage(b);
  4981.     return c
  4982. }
  4983. ,
  4984. EPUBJS.Parser = function(a) {
  4985.     this.baseUrl = a || ""
  4986. }
  4987. ,
  4988. EPUBJS.Parser.prototype.container = function(a) {
  4989.     var b, c, d, e;
  4990.     return a ? (b = a.querySelector("rootfile")) ? (c = b.getAttribute("full-path"),
  4991.     d = EPUBJS.core.uri(c).directory,
  4992.     e = a.xmlEncoding,
  4993.     {
  4994.         packagePath: c,
  4995.         basePath: d,
  4996.         encoding: e
  4997.     }) : void console.error("No RootFile Found") : void console.error("Container File Not Found")
  4998. }
  4999. ,
  5000. EPUBJS.Parser.prototype.identifier = function(a) {
  5001.     var b;
  5002.     return a ? (b = a.querySelector("metadata"),
  5003.     b ? this.getElementText(b, "identifier") : void console.error("No Metadata Found")) : void console.error("Package File Not Found")
  5004. }
  5005. ,
  5006. EPUBJS.Parser.prototype.packageContents = function(a, b) {
  5007.     var c, d, e, f, g, h, i, j, k, l, m, n = this;
  5008.     return b && (this.baseUrl = b),
  5009.     a ? (c = a.querySelector("metadata")) ? (d = a.querySelector("manifest")) ? (e = a.querySelector("spine")) ? (f = n.manifest(d),
  5010.     g = n.findNavPath(d),
  5011.     h = n.findTocPath(d, e),
  5012.     i = n.findCoverPath(d),
  5013.     j = Array.prototype.indexOf.call(e.parentNode.childNodes, e),
  5014.     k = n.spine(e, f),
  5015.     l = {},
  5016.     k.forEach(function(a) {
  5017.         l[a.href] = a.index
  5018.     }),
  5019.     m = n.metadata(c),
  5020.     m.direction = e.getAttribute("page-progression-direction"),
  5021.     {
  5022.         metadata: m,
  5023.         spine: k,
  5024.         manifest: f,
  5025.         navPath: g,
  5026.         tocPath: h,
  5027.         coverPath: i,
  5028.         spineNodeIndex: j,
  5029.         spineIndexByURL: l
  5030.     }) : void console.error("No Spine Found") : void console.error("No Manifest Found") : void console.error("No Metadata Found") : void console.error("Package File Not Found")
  5031. }
  5032. ,
  5033. EPUBJS.Parser.prototype.findNavPath = function(a) {
  5034.     var b = a.querySelector("item[properties$='nav'], item[properties^='nav '], item[properties*=' nav ']");
  5035.     return !!b && b.getAttribute("href")
  5036. }
  5037. ,
  5038. EPUBJS.Parser.prototype.findTocPath = function(a, b) {
  5039.     var c, d = a.querySelector("item[media-type='application/x-dtbncx+xml']");
  5040.     return d || (c = b.getAttribute("toc"),
  5041.     c && (d = a.querySelector("item[id='" + c + "']"))),
  5042.     !!d && d.getAttribute("href")
  5043. }
  5044. ,
  5045. EPUBJS.Parser.prototype.findCoverPath = function(a) {
  5046.     var b = a.querySelector("item[properties='cover-image']");
  5047.     return !!b && b.getAttribute("href")
  5048. }
  5049. ,
  5050. EPUBJS.Parser.prototype.metadata = function(a) {
  5051.     var b = {}
  5052.       , c = this;
  5053.     return b.bookTitle = c.getElementText(a, "title"),
  5054.     b.creator = c.getElementText(a, "creator"),
  5055.     b.description = c.getElementText(a, "description"),
  5056.     b.pubdate = c.getElementText(a, "date"),
  5057.     b.publisher = c.getElementText(a, "publisher"),
  5058.     b.identifier = c.getElementText(a, "identifier"),
  5059.     b.language = c.getElementText(a, "language"),
  5060.     b.rights = c.getElementText(a, "rights"),
  5061.     b.modified_date = c.querySelectorText(a, "meta[property='dcterms:modified']"),
  5062.     b.layout = c.querySelectorText(a, "meta[property='rendition:layout']"),
  5063.     b.orientation = c.querySelectorText(a, "meta[property='rendition:orientation']"),
  5064.     b.spread = c.querySelectorText(a, "meta[property='rendition:spread']"),
  5065.     b
  5066. }
  5067. ,
  5068. EPUBJS.Parser.prototype.getElementText = function(a, b) {
  5069.     var c, d = a.getElementsByTagNameNS("http://purl.org/dc/elements/1.1/", b);
  5070.     return d && 0 !== d.length ? (c = d[0],
  5071.     c.childNodes.length ? c.childNodes[0].nodeValue : "") : ""
  5072. }
  5073. ,
  5074. EPUBJS.Parser.prototype.querySelectorText = function(a, b) {
  5075.     var c = a.querySelector(b);
  5076.     return c && c.childNodes.length ? c.childNodes[0].nodeValue : ""
  5077. }
  5078. ,
  5079. EPUBJS.Parser.prototype.manifest = function(a) {
  5080.     var b = this.baseUrl
  5081.       , c = {}
  5082.       , d = a.querySelectorAll("item")
  5083.       , e = Array.prototype.slice.call(d);
  5084.     return e.forEach(function(a) {
  5085.         var d = a.getAttribute("id")
  5086.           , e = a.getAttribute("href") || ""
  5087.           , f = a.getAttribute("media-type") || ""
  5088.           , g = a.getAttribute("properties") || "";
  5089.         c[d] = {
  5090.             href: e,
  5091.             url: b + e,
  5092.             type: f,
  5093.             properties: g
  5094.         }
  5095.     }),
  5096.     c
  5097. }
  5098. ,
  5099. EPUBJS.Parser.prototype.spine = function(a, b) {
  5100.     var c = []
  5101.       , d = a.getElementsByTagName("itemref")
  5102.       , e = Array.prototype.slice.call(d)
  5103.       , f = Array.prototype.indexOf.call(a.parentNode.childNodes, a)
  5104.       , g = new EPUBJS.EpubCFI;
  5105.     return e.forEach(function(a, d) {
  5106.         var e = a.getAttribute("idref")
  5107.           , h = g.generateChapterComponent(f, d, e)
  5108.           , i = a.getAttribute("properties") || ""
  5109.           , j = i.length ? i.split(" ") : []
  5110.           , k = b[e].properties
  5111.           , l = k.length ? k.split(" ") : []
  5112.           , m = {
  5113.             id: e,
  5114.             linear: a.getAttribute("linear") || "",
  5115.             properties: j,
  5116.             manifestProperties: l,
  5117.             href: b[e].href,
  5118.             url: b[e].url,
  5119.             index: d,
  5120.             cfiBase: h,
  5121.             cfi: "epubcfi(" + h + ")"
  5122.         };
  5123.         c.push(m)
  5124.     }),
  5125.     c
  5126. }
  5127. ,
  5128. EPUBJS.Parser.prototype.nav = function(a, b, c) {
  5129.     function d(a) {
  5130.         var b = [];
  5131.         return Array.prototype.slice.call(a.childNodes).forEach(function(a) {
  5132.             "ol" == a.tagName && Array.prototype.slice.call(a.childNodes).forEach(function(a) {
  5133.                 "li" == a.tagName && b.push(a)
  5134.             })
  5135.         }),
  5136.         b
  5137.     }
  5138.     function e(a) {
  5139.         var b = null;
  5140.         return Array.prototype.slice.call(a.childNodes).forEach(function(a) {
  5141.             "a" != a.tagName && "span" != a.tagName || (b = a)
  5142.         }),
  5143.         b
  5144.     }
  5145.     function f(a) {
  5146.         var g = []
  5147.           , i = d(a)
  5148.           , j = Array.prototype.slice.call(i)
  5149.           , k = j.length;
  5150.         return 0 !== k && (j.forEach(function(d) {
  5151.             var i = d.getAttribute("id") || !1
  5152.               , j = e(d)
  5153.               , k = j.getAttribute("href") || ""
  5154.               , l = j.textContent || ""
  5155.               , m = k.split("#")
  5156.               , n = m[0]
  5157.               , o = f(d)
  5158.               , p = b[n]
  5159.               , q = c[p]
  5160.               , r = q ? q.cfi : "";
  5161.             i || (p ? (q = c[p],
  5162.             i = q.id,
  5163.             r = q.cfi) : i = "epubjs-autogen-toc-id-" + h++),
  5164.             d.setAttribute("id", i),
  5165.             g.push({
  5166.                 id: i,
  5167.                 href: k,
  5168.                 label: l,
  5169.                 subitems: o,
  5170.                 parent: a ? a.getAttribute("id") : null,
  5171.                 cfi: r
  5172.             })
  5173.         }),
  5174.         g)
  5175.     }
  5176.     var g = a.querySelector('nav[*|type="toc"]')
  5177.       , h = 0;
  5178.     return g ? f(g) : []
  5179. }
  5180. ,
  5181. EPUBJS.Parser.prototype.toc = function(a, b, c) {
  5182.     function d(e) {
  5183.         var f = []
  5184.           , g = a.evaluate("*[local-name()='navPoint']", e, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null)
  5185.           , h = g.snapshotLength;
  5186.         if (0 === h)
  5187.             return [];
  5188.         for (var i = h - 1; i >= 0; i--) {
  5189.             var j = g.snapshotItem(i)
  5190.               , k = j.getAttribute("id") || !1
  5191.               , l = j.querySelector("content")
  5192.               , m = l.getAttribute("src")
  5193.               , n = j.querySelector("navLabel")
  5194.               , o = n.textContent ? n.textContent : ""
  5195.               , p = m.split("#")
  5196.               , q = p[0]
  5197.               , r = b[q]
  5198.               , s = c[r]
  5199.               , t = d(j)
  5200.               , u = s ? s.cfi : "";
  5201.             k || (r ? (s = c[r],
  5202.             k = s.id,
  5203.             u = s.cfi) : k = "epubjs-autogen-toc-id-" + idCounter++),
  5204.             f.unshift({
  5205.                 id: k,
  5206.                 href: m,
  5207.                 label: o,
  5208.                 spinePos: r,
  5209.                 subitems: t,
  5210.                 parent: e ? e.getAttribute("id") : null,
  5211.                 cfi: u
  5212.             })
  5213.         }
  5214.         return f
  5215.     }
  5216.     var e = a.querySelector("navMap");
  5217.     return e ? d(e) : []
  5218. }
  5219. ,
  5220. EPUBJS.Parser.prototype.pageList = function(a, b, c) {
  5221.     function d(a) {
  5222.         var b = [];
  5223.         return Array.prototype.slice.call(a.childNodes).forEach(function(a) {
  5224.             "ol" == a.tagName && Array.prototype.slice.call(a.childNodes).forEach(function(a) {
  5225.                 "li" == a.tagName && b.push(a)
  5226.             })
  5227.         }),
  5228.         b
  5229.     }
  5230.     function e(a) {
  5231.         var b = null;
  5232.         return Array.prototype.slice.call(a.childNodes).forEach(function(a) {
  5233.             "a" != a.tagName && "span" != a.tagName || (b = a)
  5234.         }),
  5235.         b
  5236.     }
  5237.     function f(a) {
  5238.         var b = []
  5239.           , c = d(a)
  5240.           , f = Array.prototype.slice.call(c)
  5241.           , g = f.length;
  5242.         return 0 !== g && (f.forEach(function(a) {
  5243.             var c, d, f, g = (a.getAttribute("id") || !1,
  5244.             e(a)), h = g.getAttribute("href") || "", i = g.textContent || "", j = parseInt(i), k = h.indexOf("epubcfi");
  5245.             k != -1 ? (c = h.split("#"),
  5246.             d = c[0],
  5247.             f = c.length > 1 && c[1],
  5248.             b.push({
  5249.                 cfi: f,
  5250.                 href: h,
  5251.                 packageUrl: d,
  5252.                 page: j
  5253.             })) : b.push({
  5254.                 href: h,
  5255.                 page: j
  5256.             })
  5257.         }),
  5258.         b)
  5259.     }
  5260.     var g = a.querySelector('nav[*|type="page-list"]');
  5261.     return g ? f(g) : []
  5262. }
  5263. ,
  5264. EPUBJS.Render.Iframe = function() {
  5265.     this.iframe = null,
  5266.     this.document = null,
  5267.     this.window = null,
  5268.     this.docEl = null,
  5269.     this.bodyEl = null,
  5270.     this.leftPos = 0,
  5271.     this.pageWidth = 0
  5272. }
  5273. ,
  5274. EPUBJS.Render.Iframe.prototype.create = function() {
  5275.     return this.iframe = document.createElement("iframe"),
  5276.     this.iframe.id = "epubjs-iframe:" + EPUBJS.core.uuid(),
  5277.     this.iframe.scrolling = "no",
  5278.     this.iframe.seamless = "seamless",
  5279.     this.iframe.style.border = "none",
  5280.     this.iframe.addEventListener("load", this.loaded.bind(this), !1),
  5281.     this.isMobile = navigator.userAgent.match(/(iPad|iPhone|iPod|Mobile|Android)/g),
  5282.     this.transform = EPUBJS.core.prefixed("transform"),
  5283.     this.iframe
  5284. }
  5285. ,
  5286. EPUBJS.Render.Iframe.prototype.load = function(a, b) {
  5287.     var c = this
  5288.       , d = new RSVP.defer;
  5289.     return this.window && this.unload(),
  5290.     this.iframe.onload = function(a) {
  5291.         c.document = c.iframe.contentDocument,
  5292.         c.docEl = c.document.documentElement,
  5293.         c.headEl = c.document.head,
  5294.         c.bodyEl = c.document.body || c.document.querySelector("body"),
  5295.         c.window = c.iframe.contentWindow,
  5296.         c.window.addEventListener("resize", c.resized.bind(c), !1),
  5297.         c.document.oncontextmenu = function() {
  5298.             return !1
  5299.         }
  5300.         ,
  5301.         c.document.onkeydown = function(a) {
  5302.             if (a = a || window.event,
  5303.             a.ctrlKey)
  5304.                 return !1
  5305.         }
  5306.         ,
  5307.         c.leftPos = 0,
  5308.         c.setLeft(0),
  5309.         c.bodyEl && (c.bodyEl.style.margin = "0"),
  5310.         "rtl" == c.direction && "rtl" != c.docEl.dir && (c.docEl.dir = "rtl",
  5311.         c.docEl.style.position = "absolute",
  5312.         c.docEl.style.right = "0"),
  5313.         d.resolve(c.docEl)
  5314.     }
  5315.     ,
  5316.     this.iframe.onerror = function(a) {
  5317.         d.reject({
  5318.             message: "Error Loading Contents: " + a,
  5319.             stack: (new Error).stack
  5320.         })
  5321.     }
  5322.     ,
  5323.     this.document = this.iframe.contentDocument,
  5324.     this.document ? (this.document.open(),
  5325.     this.document.write(a),
  5326.     this.document.close(),
  5327.     d.promise) : (d.reject(new Error("No Document Available")),
  5328.     d)
  5329. }
  5330. ,
  5331. EPUBJS.Render.Iframe.prototype.loaded = function(a) {
  5332.     var b, c, d = this.iframe.contentWindow.location.href;
  5333.     this.document = this.iframe.contentDocument,
  5334.     this.docEl = this.document.documentElement,
  5335.     this.headEl = this.document.head,
  5336.     this.bodyEl = this.document.body || this.document.querySelector("body"),
  5337.     this.window = this.iframe.contentWindow,
  5338.     "about:blank" != d && (b = this.iframe.contentDocument.querySelector("base"),
  5339.     c = b.getAttribute("href"),
  5340.     this.trigger("render:loaded", c)),
  5341.     this.document.oncontextmenu = function() {
  5342.         return !1
  5343.     }
  5344. }
  5345. ,
  5346. EPUBJS.Render.Iframe.prototype.resize = function(a, b) {
  5347.     this.iframe && (this.iframe.height = b,
  5348.     isNaN(a) || a % 2 === 0 || (a += 1),
  5349.     this.iframe.width = a,
  5350.     this.width = this.iframe.getBoundingClientRect().width || a,
  5351.     this.height = this.iframe.getBoundingClientRect().height || b)
  5352. }
  5353. ,
  5354. EPUBJS.Render.Iframe.prototype.resized = function(a) {
  5355.     this.width = this.iframe.getBoundingClientRect().width,
  5356.     this.height = this.iframe.getBoundingClientRect().height
  5357. }
  5358. ,
  5359. EPUBJS.Render.Iframe.prototype.totalWidth = function() {
  5360.     return this.docEl.scrollWidth
  5361. }
  5362. ,
  5363. EPUBJS.Render.Iframe.prototype.totalHeight = function() {
  5364.     return this.docEl.scrollHeight
  5365. }
  5366. ,
  5367. EPUBJS.Render.Iframe.prototype.setPageDimensions = function(a, b) {
  5368.     this.pageWidth = a,
  5369.     this.pageHeight = b
  5370. }
  5371. ,
  5372. EPUBJS.Render.Iframe.prototype.setDirection = function(a) {
  5373.     this.direction = a,
  5374.     this.docEl && "rtl" == this.docEl.dir && (this.docEl.dir = "rtl",
  5375.     this.docEl.style.position = "static",
  5376.     this.docEl.style.right = "auto")
  5377. }
  5378. ,
  5379. EPUBJS.Render.Iframe.prototype.setLeft = function(a) {
  5380.     this.isMobile ? this.docEl.style[this.transform] = "translate(" + -a + "px, 0)" : this.document.defaultView.scrollTo(a, 0)
  5381. }
  5382. ,
  5383. EPUBJS.Render.Iframe.prototype.setStyle = function(a, b, c) {
  5384.     c && (a = EPUBJS.core.prefixed(a)),
  5385.     this.bodyEl && (this.bodyEl.style[a] = b)
  5386. }
  5387. ,
  5388. EPUBJS.Render.Iframe.prototype.removeStyle = function(a) {
  5389.     this.bodyEl && (this.bodyEl.style[a] = "")
  5390. }
  5391. ,
  5392. EPUBJS.Render.Iframe.prototype.addHeadTag = function(a, b, c) {
  5393.     var d = c || this.document
  5394.       , e = d.createElement(a)
  5395.       , f = d.head;
  5396.     for (var g in b)
  5397.         e.setAttribute(g, b[g]);
  5398.     f && f.insertBefore(e, f.firstChild)
  5399. }
  5400. ,
  5401. EPUBJS.Render.Iframe.prototype.page = function(a) {
  5402.     this.leftPos = this.pageWidth * (a - 1),
  5403.     "rtl" === this.direction && (this.leftPos = this.leftPos * -1),
  5404.     this.setLeft(this.leftPos)
  5405. }
  5406. ,
  5407. EPUBJS.Render.Iframe.prototype.getPageNumberByElement = function(a) {
  5408.     var b, c;
  5409.     if (a)
  5410.         return b = this.leftPos + a.getBoundingClientRect().left,
  5411.         c = Math.floor(b / this.pageWidth) + 1
  5412. }
  5413. ,
  5414. EPUBJS.Render.Iframe.prototype.getPageNumberByRect = function(a) {
  5415.     var b, c;
  5416.     return b = this.leftPos + a.left,
  5417.     c = Math.floor(b / this.pageWidth) + 1
  5418. }
  5419. ,
  5420. EPUBJS.Render.Iframe.prototype.getBaseElement = function() {
  5421.     return this.bodyEl
  5422. }
  5423. ,
  5424. EPUBJS.Render.Iframe.prototype.getDocumentElement = function() {
  5425.     return this.docEl
  5426. }
  5427. ,
  5428. EPUBJS.Render.Iframe.prototype.isElementVisible = function(a) {
  5429.     var b, c;
  5430.     return !!(a && "function" == typeof a.getBoundingClientRect && (b = a.getBoundingClientRect(),
  5431.     c = b.left,
  5432.     0 !== b.width && 0 !== b.height && c >= 0 && c < this.pageWidth))
  5433. }
  5434. ,
  5435. EPUBJS.Render.Iframe.prototype.scroll = function(a) {
  5436.     a ? this.iframe.scrolling = "yes" : this.iframe.scrolling = "no"
  5437. }
  5438. ,
  5439. EPUBJS.Render.Iframe.prototype.unload = function() {
  5440.     this.window.removeEventListener("resize", this.resized),
  5441.     this.window.location.reload()
  5442. }
  5443. ,
  5444. RSVP.EventTarget.mixin(EPUBJS.Render.Iframe.prototype),
  5445. EPUBJS.Renderer = function(a, b) {
  5446.     this.listenedEvents = ["keydown", "keyup", "keypressed", "mouseup", "mousedown", "click"],
  5447.     this.upEvent = "mouseup",
  5448.     this.downEvent = "mousedown",
  5449.     "ontouchstart"in document.documentElement && (this.listenedEvents.push("touchstart", "touchend"),
  5450.     this.upEvent = "touchend",
  5451.     this.downEvent = "touchstart"),
  5452.     a && "undefined" != typeof EPUBJS.Render[a] ? this.render = new EPUBJS.Render[a] : console.error("Not a Valid Rendering Method"),
  5453.     this.render.on("render:loaded", this.loaded.bind(this)),
  5454.     this.caches = {},
  5455.     this.epubcfi = new EPUBJS.EpubCFI,
  5456.     this.spreads = !0,
  5457.     this.isForcedSingle = !1,
  5458.     this.resized = this.onResized.bind(this),
  5459.     this.layoutSettings = {},
  5460.     this.hidden = b || !1,
  5461.     EPUBJS.Hooks.mixin(this),
  5462.     this.getHooks("beforeChapterDisplay"),
  5463.     this._q = EPUBJS.core.queue(this),
  5464.     this._moving = !1
  5465. }
  5466. ,
  5467. EPUBJS.Renderer.prototype.Events = ["renderer:keydown", "renderer:keyup", "renderer:keypressed", "renderer:mouseup", "renderer:mousedown", "renderer:click", "renderer:touchstart", "renderer:touchend", "renderer:selected", "renderer:chapterUnloaded", "renderer:chapterDisplayed", "renderer:locationChanged", "renderer:visibleLocationChanged", "renderer:resized", "renderer:spreads"],
  5468. EPUBJS.Renderer.prototype.initialize = function(a, b, c) {
  5469.     this.container = a,
  5470.     this.element = this.render.create(),
  5471.     this.initWidth = b,
  5472.     this.initHeight = c,
  5473.     this.width = b || this.container.clientWidth,
  5474.     this.height = c || this.container.clientHeight,
  5475.     this.container.appendChild(this.element),
  5476.     b && c ? this.render.resize(this.width, this.height) : this.render.resize("100%", "100%"),
  5477.     document.addEventListener("orientationchange", this.onResized)
  5478. }
  5479. ,
  5480. EPUBJS.Renderer.prototype.displayChapter = function(a, b) {
  5481.     return this._moving ? void console.error("Rendering In Progress") : (this._moving = !0,
  5482.     a.render().then(function(c) {
  5483.         return this.currentChapter && (this.currentChapter.unload(),
  5484.         this.render.window && this.render.window.removeEventListener("resize", this.resized),
  5485.         this.removeEventListeners(),
  5486.         this.removeSelectionListeners(),
  5487.         this.trigger("renderer:chapterUnloaded"),
  5488.         this.contents = null,
  5489.         this.doc = null,
  5490.         this.pageMap = null),
  5491.         this.currentChapter = a,
  5492.         this.chapterPos = 1,
  5493.         this.currentChapterCfiBase = a.cfiBase,
  5494.         this.layoutSettings = this.reconcileLayoutSettings(b, a.properties),
  5495.         this.load(c, a.href)
  5496.     }
  5497.     .bind(this)))
  5498. }
  5499. ,
  5500. EPUBJS.Renderer.prototype.load = function(a, b) {
  5501.     var c = new RSVP.defer;
  5502.     return this.layoutMethod = this.determineLayout(this.layoutSettings),
  5503.     this.layout = new EPUBJS.Layout[this.layoutMethod],
  5504.     this.visible(!1),
  5505.     render = this.render.load(a, b),
  5506.     render.then(function(a) {
  5507.         this.afterLoad(a),
  5508.         this.beforeDisplay(function() {
  5509.             this.afterDisplay(),
  5510.             this.visible(!0),
  5511.             c.resolve(this)
  5512.         }
  5513.         .bind(this))
  5514.     }
  5515.     .bind(this)),
  5516.     c.promise
  5517. }
  5518. ,
  5519. EPUBJS.Renderer.prototype.afterLoad = function(a) {
  5520.     RDP_EPUB_SECTION = this.currentChapter.spinePos + 1,
  5521.     this.currentChapter.setDocument(this.render.document),
  5522.     this.contents = a,
  5523.     this.doc = this.render.document,
  5524.     this.formated = this.layout.format(a, this.render.width, this.render.height, this.gap),
  5525.     this.render.setPageDimensions(this.formated.pageWidth, this.formated.pageHeight),
  5526.     this.initWidth || this.initHeight || this.render.window.addEventListener("resize", this.resized, !1),
  5527.     this.addEventListeners(),
  5528.     this.addSelectionListeners()
  5529. }
  5530. ,
  5531. EPUBJS.Renderer.prototype.afterDisplay = function(a) {
  5532.     function b() {
  5533.         for (var a = 3760, b = $("iframe")[0], e = b.contentDocument.body, f = e.innerHTML, g = new RegExp(/([^<>]{2,})(?=<)/g), h = 0, i = [], j = null, k = []; match = g.exec(f); )
  5534.             j = match,
  5535.             0 == i.length && i.push(k),
  5536.             k.push(match),
  5537.             h += match[0].length,
  5538.             h >= a && (h -= a,
  5539.             k = [],
  5540.             i.push(k));
  5541.         j && f > 0 && k.push(j);
  5542.         var l = "break_"
  5543.           , m = c(i, f, l, !1);
  5544.         e.innerHTML = m,
  5545.         d(b, l, i.length)
  5546.     }
  5547.     function c(a, b, c, d) {
  5548.         for (var e = b, f = "", g = a.length - 1; g >= 0; g--) {
  5549.             var h = a[g];
  5550.             if (d) {
  5551.                 var i = ["red", "blue", "green", "orage", "purple", "yellow"]
  5552.                   , j = i[Math.floor(Math.random() * i.length)];
  5553.                 f = "style='background:" + j + ";'"
  5554.             }
  5555.             for (var k = h.length - 1; k >= 0; k--) {
  5556.                 var l = h[k]
  5557.                   , m = l[0].length
  5558.                   , n = c + g
  5559.                   , o = '<break id="' + n + '" page_index="' + g + '" letters_count="' + m + '" ' + f + ">";
  5560.                 e = [e.slice(0, l.index + m), "</break>", e.slice(l.index + m)].join(""),
  5561.                 e = [e.slice(0, l.index), o, e.slice(l.index)].join("")
  5562.             }
  5563.         }
  5564.         return e
  5565.     }
  5566.     function d(a, b, c) {
  5567.         var d = a.contentWindow || a.contentDocument;
  5568.         d.addEventListener("scroll", function() {
  5569.             n && clearInterval(n),
  5570.             n = setInterval(function() {
  5571.                 clearInterval(n),
  5572.                 e(a, b, c)
  5573.             }, 500)
  5574.         }),
  5575.         e(a, b, c)
  5576.     }
  5577.     function e(a, b, c) {
  5578.         for (var d = (a.contentWindow || a.contentDocument,
  5579.         a.contentDocument || a.document), e = d.getElementsByTagName("break"), i = 0, j = {}, k = 0; k < e.length; k++) {
  5580.             var l = e[k];
  5581.             if (l && g(l, a)) {
  5582.                 var m = l.getAttribute("page_index")
  5583.                   , n = l.getAttribute("letters_count");
  5584.                 j[m] || (j[m] = 0);
  5585.                 var p = parseInt(n)
  5586.                   , q = j[m] + p;
  5587.                 i += p,
  5588.                 j[m] = q
  5589.             }
  5590.         }
  5591.         currentItens = f(j, i);
  5592.         var r = JSON.stringify(o)
  5593.           , s = JSON.stringify(currentItens);
  5594.         r != s && (o = currentItens,
  5595.         h(o))
  5596.     }
  5597.     function f(a, b) {
  5598.         var c = [];
  5599.         for (var d in a) {
  5600.             var e = a[d] / b;
  5601.             if (e > .85) {
  5602.                 c = [],
  5603.                 c.push(d);
  5604.                 break
  5605.             }
  5606.             e > .3 && c.push(d)
  5607.         }
  5608.         return c = c.sort()
  5609.     }
  5610.     function g(a, b) {
  5611.         var c = b.document || b.contentDocument
  5612.           , d = a.getBoundingClientRect();
  5613.         return d.top >= 0 && d.left >= 0 && d.bottom <= (b.innerHeight || c.documentElement.clientHeight) && d.right <= (b.innerWidth || c.documentElement.clientWidth)
  5614.     }
  5615.     function h(a) {
  5616.         for (var b = p, c = [], d = 0; d < b.length; d++) {
  5617.             for (var e = !1, f = 0; f < a.length; f++)
  5618.                 if (b[d].page == j(a[f]) && RDP_EPUB_SECTION == b[d].section) {
  5619.                     e = !0;
  5620.                     break
  5621.                 }
  5622.             e ? c.push(b[d]) : i(b[d])
  5623.         }
  5624.         p = c;
  5625.         for (var d = 0; d < a.length; d++) {
  5626.             for (var e = !1, f = 0; f < b.length; f++)
  5627.                 if (j(a[d]) == b[f].page && b[f].section == RDP_EPUB_SECTION) {
  5628.                     e = !0;
  5629.                     break
  5630.                 }
  5631.             e || p.push({
  5632.                 section: RDP_EPUB_SECTION,
  5633.                 page: j(a[d]),
  5634.                 timestamp: Math.round((new Date).getTime() / 1e3)
  5635.             })
  5636.         }
  5637.     }
  5638.     function i(a) {
  5639.         var b = location.hash.split("/")[3]
  5640.           , c = a.section + "." + a.page
  5641.           , d = Math.round((new Date).getTime() / 1e3) - a.timestamp;
  5642.         Element.prototype.trackPageView(b, c, d)
  5643.     }
  5644.     function j(a) {
  5645.         return parseInt(a) + 1
  5646.     }
  5647.     console.log("afterDisplay"),
  5648.     $("iframe").contents().find("body").css({
  5649.         fontSize: RDP_EPUB.config.fontSize + "px",
  5650.         fontFamily: RDP_EPUB.config.fontFamily,
  5651.         color: RDP_EPUB.config.color,
  5652.         background: RDP_EPUB.config.background
  5653.     }),
  5654.     $("iframe").contents().find("img").css("height", "auto").css("max-height", window.innerHeight).css("max-width", window.innerWidth - 80);
  5655.     var k = this.layout.calculatePages()
  5656.       , l = this.currentChapter
  5657.       , m = this._q.length();
  5658.     this._moving = !1,
  5659.     this.updatePages(k),
  5660.     this.visibleRangeCfi = this.getVisibleRangeCfi(),
  5661.     this.currentLocationCfi = this.visibleRangeCfi.start,
  5662.     0 === m && (this.trigger("renderer:locationChanged", this.currentLocationCfi),
  5663.     this.trigger("renderer:visibleRangeChanged", this.visibleRangeCfi)),
  5664.     l.cfi = this.currentLocationCfi,
  5665.     this.trigger("renderer:chapterDisplayed", l),
  5666.     $("iframe").contents().find("body").css({
  5667.         "-webkit-user-select": "none",
  5668.         "-moz-user-select": "none",
  5669.         "-ms-user-select": "none",
  5670.         "user-select": "none"
  5671.     });
  5672.     var n, o = [], p = [];
  5673.     b()
  5674. }
  5675. ,
  5676. EPUBJS.Renderer.prototype.loaded = function(a) {
  5677.     this.trigger("render:loaded", a)
  5678. }
  5679. ,
  5680. EPUBJS.Renderer.prototype.reconcileLayoutSettings = function(a, b) {
  5681.     var c = {};
  5682.     for (var d in a)
  5683.         a.hasOwnProperty(d) && (c[d] = a[d]);
  5684.     return b.forEach(function(a) {
  5685.         var b, d, e = a.replace("rendition:", ""), f = e.indexOf("-");
  5686.         f != -1 && (b = e.slice(0, f),
  5687.         d = e.slice(f + 1),
  5688.         c[b] = d)
  5689.     }),
  5690.     c
  5691. }
  5692. ,
  5693. EPUBJS.Renderer.prototype.determineLayout = function(a) {
  5694.     var b = this.determineSpreads(this.minSpreadWidth)
  5695.       , c = b ? "ReflowableSpreads" : "Reflowable"
  5696.       , d = !1;
  5697.     return "pre-paginated" === a.layout && (c = "Fixed",
  5698.     d = !0,
  5699.     b = !1),
  5700.     "reflowable" === a.layout && "none" === a.spread && (c = "Reflowable",
  5701.     d = !1,
  5702.     b = !1),
  5703.     "reflowable" === a.layout && "both" === a.spread && (c = "ReflowableSpreads",
  5704.     d = !1,
  5705.     b = !0),
  5706.     this.spreads = b,
  5707.     this.render.scroll(d),
  5708.     this.trigger("renderer:spreads", b),
  5709.     c
  5710. }
  5711. ,
  5712. EPUBJS.Renderer.prototype.beforeDisplay = function(a, b) {
  5713.     this.triggerHooks("beforeChapterDisplay", a, this)
  5714. }
  5715. ,
  5716. EPUBJS.Renderer.prototype.updatePages = function(a) {
  5717.     this.pageMap = this.mapPage(),
  5718.     this.spreads ? this.displayedPages = Math.ceil(this.pageMap.length / 2) : this.displayedPages = this.pageMap.length,
  5719.     this.currentChapter.pages = this.pageMap.length,
  5720.     this._q.flush()
  5721. }
  5722. ,
  5723. EPUBJS.Renderer.prototype.reformat = function() {
  5724.     var a, b = this;
  5725.     this.contents && (spreads = this.determineSpreads(this.minSpreadWidth),
  5726.     spreads != this.spreads && (this.spreads = spreads,
  5727.     this.layoutMethod = this.determineLayout(this.layoutSettings),
  5728.     this.layout = new EPUBJS.Layout[this.layoutMethod]),
  5729.     this.chapterPos = 1,
  5730.     this.render.page(this.chapterPos),
  5731.     b.formated = b.layout.format(b.render.docEl, b.render.width, b.render.height, b.gap),
  5732.     b.render.setPageDimensions(b.formated.pageWidth, b.formated.pageHeight),
  5733.     a = b.layout.calculatePages(),
  5734.     b.updatePages(a),
  5735.     b.currentLocationCfi && b.gotoCfi(b.currentLocationCfi))
  5736. }
  5737. ,
  5738. EPUBJS.Renderer.prototype.visible = function(a) {
  5739.     return "undefined" == typeof a ? this.element.style.visibility : void (a !== !0 || this.hidden ? a === !1 && (this.element.style.visibility = "hidden") : this.element.style.visibility = "visible")
  5740. }
  5741. ,
  5742. EPUBJS.Renderer.prototype.remove = function() {
  5743.     this.render.window && (this.render.unload(),
  5744.     this.render.window.removeEventListener("resize", this.resized),
  5745.     this.removeEventListeners(),
  5746.     this.removeSelectionListeners()),
  5747.     this.container.removeChild(this.element)
  5748. }
  5749. ,
  5750. EPUBJS.Renderer.prototype.applyStyles = function(a) {
  5751.     for (var b in a)
  5752.         this.render.setStyle(b, a[b])
  5753. }
  5754. ,
  5755. EPUBJS.Renderer.prototype.setStyle = function(a, b, c) {
  5756.     this.render.setStyle(a, b, c)
  5757. }
  5758. ,
  5759. EPUBJS.Renderer.prototype.removeStyle = function(a) {
  5760.     this.render.removeStyle(a)
  5761. }
  5762. ,
  5763. EPUBJS.Renderer.prototype.applyHeadTags = function(a) {
  5764.     for (var b in a)
  5765.         this.render.addHeadTag(b, a[b])
  5766. }
  5767. ,
  5768. EPUBJS.Renderer.prototype.page = function(a) {
  5769.     return this.pageMap ? a >= 1 && a <= this.displayedPages && (this.chapterPos = a,
  5770.     this.render.page(a),
  5771.     this.visibleRangeCfi = this.getVisibleRangeCfi(),
  5772.     this.currentLocationCfi = this.visibleRangeCfi.start,
  5773.     this.trigger("renderer:locationChanged", this.currentLocationCfi),
  5774.     this.trigger("renderer:visibleRangeChanged", this.visibleRangeCfi),
  5775.     !0) : (console.warn("pageMap not set, queuing"),
  5776.     this._q.enqueue("page", arguments),
  5777.     !0)
  5778. }
  5779. ,
  5780. EPUBJS.Renderer.prototype.nextPage = function() {
  5781.     return this.page(this.chapterPos + 1)
  5782. }
  5783. ,
  5784. EPUBJS.Renderer.prototype.prevPage = function() {
  5785.     return this.page(this.chapterPos - 1)
  5786. }
  5787. ,
  5788. EPUBJS.Renderer.prototype.pageByElement = function(a) {
  5789.     var b;
  5790.     a && (b = this.render.getPageNumberByElement(a),
  5791.     this.page(b))
  5792. }
  5793. ,
  5794. EPUBJS.Renderer.prototype.lastPage = function() {
  5795.     return this._moving ? this._q.enqueue("lastPage", arguments) : void this.page(this.displayedPages)
  5796. }
  5797. ,
  5798. EPUBJS.Renderer.prototype.firstPage = function() {
  5799.     return this._moving ? this._q.enqueue("firstPage", arguments) : void this.page(1)
  5800. }
  5801. ,
  5802. EPUBJS.Renderer.prototype.section = function(a) {
  5803.     var b = this.doc.getElementById(a);
  5804.     b && this.pageByElement(b)
  5805. }
  5806. ,
  5807. EPUBJS.Renderer.prototype.firstElementisTextNode = function(a) {
  5808.     var b = a.childNodes
  5809.       , c = b.length;
  5810.     return !!(c && b[0] && 3 === b[0].nodeType && b[0].textContent.trim().length)
  5811. }
  5812. ,
  5813. EPUBJS.Renderer.prototype.isGoodNode = function(a) {
  5814.     var b = ["audio", "canvas", "embed", "iframe", "img", "math", "object", "svg", "video"];
  5815.     return b.indexOf(a.tagName.toLowerCase()) !== -1 || this.firstElementisTextNode(a)
  5816. }
  5817. ,
  5818. EPUBJS.Renderer.prototype.walk = function(a, b, c) {
  5819.     for (var d, e, f, g, h = a, i = [h], j = 1e4, k = 0; !d && i.length; ) {
  5820.         if (a = i.shift(),
  5821.         this.containsPoint(a, b, c) && this.isGoodNode(a) && (d = a),
  5822.         !d && a && a.childElementCount > 0) {
  5823.             if (e = a.children,
  5824.             !e || !e.length)
  5825.                 return d;
  5826.             f = e.length ? e.length : 0;
  5827.             for (var l = f - 1; l >= 0; l--)
  5828.                 e[l] != g && i.unshift(e[l])
  5829.         }
  5830.         if (!d && 0 === i.length && h && null !== h.parentNode && (i.push(h.parentNode),
  5831.         g = h,
  5832.         h = h.parentNode),
  5833.         k++,
  5834.         k > j) {
  5835.             console.error("ENDLESS LOOP");
  5836.             break
  5837.         }
  5838.     }
  5839.     return d
  5840. }
  5841. ,
  5842. EPUBJS.Renderer.prototype.containsPoint = function(a, b, c) {
  5843.     var d;
  5844.     return !!(a && "function" == typeof a.getBoundingClientRect && (d = a.getBoundingClientRect(),
  5845.     0 !== d.width && 0 !== d.height && d.left >= b && b <= d.left + d.width))
  5846. }
  5847. ,
  5848. EPUBJS.Renderer.prototype.textSprint = function(a, b) {
  5849.     for (var c, d = document.createTreeWalker(a, NodeFilter.SHOW_TEXT, {
  5850.         acceptNode: function(a) {
  5851.             return /^\s*$/.test(a.data) ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT
  5852.         }
  5853.     }, !1); c = d.nextNode(); )
  5854.         b(c)
  5855. }
  5856. ,
  5857. EPUBJS.Renderer.prototype.sprint = function(a, b) {
  5858.     for (var c, d = document.createTreeWalker(a, NodeFilter.SHOW_ELEMENT, null, !1); c = d.nextNode(); )
  5859.         b(c)
  5860. }
  5861. ,
  5862. EPUBJS.Renderer.prototype.mapPage = function() {
  5863.     var a, b, c = this, d = [], e = this.render.getBaseElement(), f = 1, g = this.layout.colWidth + this.layout.gap, h = this.formated.pageWidth * (this.chapterPos - 1), i = g * f - h, j = 0, k = function(a) {
  5864.         var b, c, d = Array.prototype.slice.call(a.childNodes);
  5865.         if (a.nodeType == Node.ELEMENT_NODE) {
  5866.             if (c = document.createRange(),
  5867.             c.selectNodeContents(a),
  5868.             b = c.getBoundingClientRect(),
  5869.             !b || 0 === b.width && 0 === b.height)
  5870.                 return;
  5871.             b.left > j && d.forEach(function(a) {
  5872.                 a.nodeType == Node.TEXT_NODE && a.textContent.trim().length && l(a)
  5873.             }),
  5874.             b.right > j && d.forEach(function(a) {
  5875.                 a.nodeType == Node.TEXT_NODE && a.textContent.trim().length && l(a)
  5876.             })
  5877.         }
  5878.     }, l = function(e) {
  5879.         var k = c.splitTextNodeIntoWordsRanges(e);
  5880.         k.forEach(function(e) {
  5881.             var k = e.getBoundingClientRect();
  5882.             !k || 0 === k.width && 0 === k.height || (k.left + k.width < i ? d[f - 1] || (e.collapse(!0),
  5883.             b = c.currentChapter.cfiFromRange(e),
  5884.             d.push({
  5885.                 start: b,
  5886.                 end: null
  5887.             })) : (a && (a.collapse(!0),
  5888.             b = c.currentChapter.cfiFromRange(a),
  5889.             d[d.length - 1].end = b),
  5890.             e.collapse(!0),
  5891.             b = c.currentChapter.cfiFromRange(e),
  5892.             d.push({
  5893.                 start: b,
  5894.                 end: null
  5895.             }),
  5896.             f += 1,
  5897.             i = g * f - h,
  5898.             j = i),
  5899.             a = e)
  5900.         })
  5901.     }, m = this.render.getDocumentElement(), n = m.dir;
  5902.     return "rtl" == n && (m.dir = "ltr",
  5903.     m.style.position = "static"),
  5904.     this.sprint(e, k),
  5905.     "rtl" == n && (m.dir = n,
  5906.     m.style.left = "auto",
  5907.     m.style.right = "0"),
  5908.     a && (a.collapse(!0),
  5909.     b = c.currentChapter.cfiFromRange(a),
  5910.     d[d.length - 1].end = b),
  5911.     d.length || (range = this.doc.createRange(),
  5912.     range.selectNodeContents(e),
  5913.     range.collapse(!0),
  5914.     b = c.currentChapter.cfiFromRange(range),
  5915.     d.push({
  5916.         start: b,
  5917.         end: b
  5918.     })),
  5919.     a = null,
  5920.     ranges = null,
  5921.     range = null,
  5922.     e = null,
  5923.     d
  5924. }
  5925. ,
  5926. EPUBJS.Renderer.prototype.indexOfBreakableChar = function(a, b) {
  5927.     var c = "- \t\r\n\b\f";
  5928.     b || (b = 0);
  5929.     for (var d = b; d < a.length; d++)
  5930.         if (c.indexOf(a.charAt(d)) != -1)
  5931.             return d;
  5932.     return -1
  5933. }
  5934. ,
  5935. EPUBJS.Renderer.prototype.splitTextNodeIntoWordsRanges = function(a) {
  5936.     var b, c = [], d = a.textContent.trim();
  5937.     if (pos = this.indexOfBreakableChar(d),
  5938.     pos === -1)
  5939.         return b = this.doc.createRange(),
  5940.         b.selectNodeContents(a),
  5941.         [b];
  5942.     for (b = this.doc.createRange(),
  5943.     b.setStart(a, 0),
  5944.     b.setEnd(a, pos),
  5945.     c.push(b),
  5946.     b = this.doc.createRange(),
  5947.     b.setStart(a, pos + 1); pos != -1; )
  5948.         pos = this.indexOfBreakableChar(d, pos + 1),
  5949.         pos > 0 && (b && (b.setEnd(a, pos),
  5950.         c.push(b)),
  5951.         b = this.doc.createRange(),
  5952.         b.setStart(a, pos + 1));
  5953.     return b && (b.setEnd(a, d.length),
  5954.     c.push(b)),
  5955.     c
  5956. }
  5957. ,
  5958. EPUBJS.Renderer.prototype.rangePosition = function(a) {
  5959.     var b, c;
  5960.     return c = a.getClientRects(),
  5961.     c.length ? b = c[0] : null
  5962. }
  5963. ,
  5964. EPUBJS.Renderer.prototype.getPageCfi = function() {
  5965.     var a;
  5966.     return this.spreads ? (a = 2 * this.chapterPos,
  5967.     startRange = this.pageMap[a - 2]) : (a = this.chapterPos,
  5968.     startRange = this.pageMap[a - 1]),
  5969.     this.pageMap[2 * this.chapterPos - 1].start
  5970. }
  5971. ,
  5972. EPUBJS.Renderer.prototype.getRange = function(a, b, c) {
  5973.     var d, e = this.doc.createRange();
  5974.     return c = !0,
  5975.     "undefined" == typeof document.caretPositionFromPoint || c ? "undefined" == typeof document.caretRangeFromPoint || c ? (this.visibileEl = this.findElementAfter(a, b),
  5976.     e.setStart(this.visibileEl, 1)) : e = this.doc.caretRangeFromPoint(a, b) : (d = this.doc.caretPositionFromPoint(a, b),
  5977.     e.setStart(d.offsetNode, d.offset)),
  5978.     e
  5979. }
  5980. ,
  5981. EPUBJS.Renderer.prototype.pagesInCurrentChapter = function() {
  5982.     var a, b;
  5983.     return this.pageMap ? (b = this.pageMap.length,
  5984.     a = this.spreads ? Math.ceil(b / 2) : b) : (console.warn("page map not loaded"),
  5985.     !1)
  5986. }
  5987. ,
  5988. EPUBJS.Renderer.prototype.currentRenderedPage = function() {
  5989.     var a;
  5990.     return this.pageMap ? a = this.spreads && this.layout.pageCount > 1 ? 2 * this.chapterPos : this.chapterPos : (console.warn("page map not loaded"),
  5991.     !1)
  5992. }
  5993. ,
  5994. EPUBJS.Renderer.prototype.getRenderedPagesLeft = function() {
  5995.     var a, b, c;
  5996.     return this.pageMap ? (b = this.pageMap.length,
  5997.     a = this.spreads ? 2 * this.chapterPos : this.chapterPos,
  5998.     c = b - a) : (console.warn("page map not loaded"),
  5999.     !1)
  6000. }
  6001. ,
  6002. EPUBJS.Renderer.prototype.getVisibleRangeCfi = function() {
  6003.     var a, b, c;
  6004.     return this.pageMap ? (this.spreads ? (a = 2 * this.chapterPos,
  6005.     b = this.pageMap[a - 2],
  6006.     c = b,
  6007.     this.layout.pageCount > 1 && (c = this.pageMap[a - 1])) : (a = this.chapterPos,
  6008.     b = this.pageMap[a - 1],
  6009.     c = b),
  6010.     b || (console.warn("page range miss:", a, this.pageMap),
  6011.     b = this.pageMap[this.pageMap.length - 1],
  6012.     c = b),
  6013.     {
  6014.         start: b.start,
  6015.         end: c.end
  6016.     }) : (console.warn("page map not loaded"),
  6017.     !1)
  6018. }
  6019. ,
  6020. EPUBJS.Renderer.prototype.gotoCfi = function(a) {
  6021.     var b, c, d;
  6022.     if (this._moving)
  6023.         return this._q.enqueue("gotoCfi", arguments);
  6024.     if (EPUBJS.core.isString(a) && (a = this.epubcfi.parse(a)),
  6025.     "undefined" == typeof document.evaluate)
  6026.         c = this.epubcfi.addMarker(a, this.doc),
  6027.         c && (b = this.render.getPageNumberByElement(c),
  6028.         this.epubcfi.removeMarker(c, this.doc),
  6029.         this.page(b));
  6030.     else if (d = this.epubcfi.generateRangeFromCfi(a, this.doc)) {
  6031.         var e = d.getBoundingClientRect();
  6032.         b = e ? this.render.getPageNumberByRect(e) : 1,
  6033.         this.page(b),
  6034.         this.currentLocationCfi = a.str
  6035.     } else
  6036.         this.page(1)
  6037. }
  6038. ,
  6039. EPUBJS.Renderer.prototype.findFirstVisible = function(a) {
  6040.     var b, c = a || this.render.getBaseElement();
  6041.     return b = this.walk(c, 0, 0),
  6042.     b ? b : a
  6043. }
  6044. ,
  6045. EPUBJS.Renderer.prototype.findElementAfter = function(a, b, c) {
  6046.     var d, e = c || this.render.getBaseElement();
  6047.     return d = this.walk(e, a, b),
  6048.     d ? d : e
  6049. }
  6050. ,
  6051. EPUBJS.Renderer.prototype.resize = function(a, b, c) {
  6052.     this.width = a,
  6053.     this.height = b,
  6054.     c !== !1 && this.render.resize(this.width, this.height),
  6055.     this.contents && this.reformat(),
  6056.     this.trigger("renderer:resized", {
  6057.         width: this.width,
  6058.         height: this.height
  6059.     })
  6060. }
  6061. ,
  6062. EPUBJS.Renderer.prototype.onResized = function(a) {
  6063.     var b = this.container.clientWidth
  6064.       , c = this.container.clientHeight;
  6065.     this.resize(b, c, !1)
  6066. }
  6067. ,
  6068. EPUBJS.Renderer.prototype.addEventListeners = function() {
  6069.     this.render.document && this.listenedEvents.forEach(function(a) {
  6070.         this.render.document.addEventListener(a, this.triggerEvent.bind(this), !1)
  6071.     }, this)
  6072. }
  6073. ,
  6074. EPUBJS.Renderer.prototype.removeEventListeners = function() {
  6075.     this.render.document && this.listenedEvents.forEach(function(a) {
  6076.         this.render.document.removeEventListener(a, this.triggerEvent, !1)
  6077.     }, this)
  6078. }
  6079. ,
  6080. EPUBJS.Renderer.prototype.triggerEvent = function(a) {
  6081.     this.trigger("renderer:" + a.type, a)
  6082. }
  6083. ,
  6084. EPUBJS.Renderer.prototype.addSelectionListeners = function() {
  6085.     this.render.document.addEventListener("selectionchange", this.onSelectionChange.bind(this), !1)
  6086. }
  6087. ,
  6088. EPUBJS.Renderer.prototype.removeSelectionListeners = function() {
  6089.     this.render.document && this.doc.removeEventListener("selectionchange", this.onSelectionChange, !1)
  6090. }
  6091. ,
  6092. EPUBJS.Renderer.prototype.onSelectionChange = function(a) {
  6093.     this.selectionEndTimeout && clearTimeout(this.selectionEndTimeout),
  6094.     this.selectionEndTimeout = setTimeout(function() {
  6095.         this.selectedRange = this.render.window.getSelection(),
  6096.         this.trigger("renderer:selected", this.selectedRange)
  6097.     }
  6098.     .bind(this), 500)
  6099. }
  6100. ,
  6101. EPUBJS.Renderer.prototype.setMinSpreadWidth = function(a) {
  6102.     this.minSpreadWidth = a,
  6103.     this.spreads = this.determineSpreads(a)
  6104. }
  6105. ,
  6106. EPUBJS.Renderer.prototype.determineSpreads = function(a) {
  6107.     return !(this.isForcedSingle || !a || this.width < a)
  6108. }
  6109. ,
  6110. EPUBJS.Renderer.prototype.forceSingle = function(a) {
  6111.     a ? this.isForcedSingle = !0 : this.isForcedSingle = !1
  6112. }
  6113. ,
  6114. EPUBJS.Renderer.prototype.setGap = function(a) {
  6115.     this.gap = a
  6116. }
  6117. ,
  6118. EPUBJS.Renderer.prototype.setDirection = function(a) {
  6119.     this.direction = a,
  6120.     this.render.setDirection(this.direction)
  6121. }
  6122. ,
  6123. EPUBJS.Renderer.prototype.replace = function(a, b, c, d) {
  6124.     var e = this.contents.querySelectorAll(a)
  6125.       , f = Array.prototype.slice.call(e)
  6126.       , g = f.length;
  6127.     return 0 === g ? void c(!1) : void f.forEach(function(a) {
  6128.         var e = !1
  6129.           , f = function(a, b) {
  6130.             e === !1 && (g--,
  6131.             d && d(a, b, g),
  6132.             g <= 0 && c && c(!0),
  6133.             e = !0)
  6134.         };
  6135.         b(a, f)
  6136.     }
  6137.     .bind(this))
  6138. }
  6139. ,
  6140. RSVP.EventTarget.mixin(EPUBJS.Renderer.prototype);
  6141. var EPUBJS = EPUBJS || {};
  6142. EPUBJS.replace = {},
  6143. EPUBJS.replace.hrefs = function(a, b) {
  6144.     var c = this
  6145.       , d = function(a, d) {
  6146.         var e, f, g = a.getAttribute("href"), h = g.search("://");
  6147.         if (h != -1)
  6148.             a.setAttribute("target", "_blank");
  6149.         else {
  6150.             var i = EPUBJS.core.uri(b.render.window.location.href);
  6151.             e = i.directory,
  6152.             f = e ? "file" === i.protocol ? EPUBJS.core.resolveUrl(i.base, g) : EPUBJS.core.resolveUrl(e, g) : g,
  6153.             a.onclick = function() {
  6154.                 return c["goto"](f),
  6155.                 !1
  6156.             }
  6157.         }
  6158.         d()
  6159.     };
  6160.     b.replace("a[href]", d, a)
  6161. }
  6162. ,
  6163. EPUBJS.replace.head = function(a, b) {
  6164.     b.replaceWithStored("link[href]", "href", EPUBJS.replace.links, a)
  6165. }
  6166. ,
  6167. EPUBJS.replace.resources = function(a, b) {
  6168.     b.replaceWithStored("[src]", "src", EPUBJS.replace.srcs, a)
  6169. }
  6170. ,
  6171. EPUBJS.replace.svg = function(a, b) {
  6172.     b.replaceWithStored("image", "xlink:href", function(a, b, c) {
  6173.         a.getUrl(b).then(c)
  6174.     }, a)
  6175. }
  6176. ,
  6177. EPUBJS.replace.srcs = function(a, b, c) {
  6178.     a.getUrl(b).then(c)
  6179. }
  6180. ,
  6181. EPUBJS.replace.links = function(a, b, c, d) {
  6182.     "stylesheet" === d.getAttribute("rel") ? EPUBJS.replace.stylesheets(a, b).then(function(a, b) {
  6183.         c(a, b)
  6184.     }, function(a) {
  6185.         c(null)
  6186.     }) : a.getUrl(b).then(c, function(a) {
  6187.         c(null)
  6188.     })
  6189. }
  6190. ,
  6191. EPUBJS.replace.stylesheets = function(a, b) {
  6192.     var c = new RSVP.defer;
  6193.     if (a)
  6194.         return a.getText(b).then(function(d) {
  6195.             EPUBJS.replace.cssUrls(a, b, d).then(function(a) {
  6196.                 var b = window.URL || window.webkitURL || window.mozURL
  6197.                   , d = new Blob([a],{
  6198.                     type: "text/css"
  6199.                 })
  6200.                   , e = b.createObjectURL(d);
  6201.                 c.resolve(e)
  6202.             }, function(a) {
  6203.                 c.reject(a)
  6204.             })
  6205.         }, function(a) {
  6206.             c.reject(a)
  6207.         }),
  6208.         c.promise
  6209. }
  6210. ,
  6211. EPUBJS.replace.cssUrls = function(a, b, c) {
  6212.     var d = new RSVP.defer
  6213.       , e = []
  6214.       , f = c.match(/url\(\'?\"?([^\'|^\"^\)]*)\'?\"?\)/g);
  6215.     if (a)
  6216.         return f ? (f.forEach(function(f) {
  6217.             var g = EPUBJS.core.resolveUrl(b, f.replace(/url\(|[|\)|\'|\"]/g, ""))
  6218.               , h = a.getUrl(g).then(function(a) {
  6219.                 c = c.replace(f, 'url("' + a + '")')
  6220.             }, function(a) {
  6221.                 d.reject(a)
  6222.             });
  6223.             e.push(h)
  6224.         }),
  6225.         RSVP.all(e).then(function() {
  6226.             d.resolve(c)
  6227.         }),
  6228.         d.promise) : (d.resolve(c),
  6229.         d.promise)
  6230. }
  6231. ,
  6232. EPUBJS.Storage = function(a) {
  6233.     this.checkRequirements(),
  6234.     this.urlCache = {},
  6235.     this.withCredentials = a,
  6236.     this.URL = window.URL || window.webkitURL || window.mozURL,
  6237.     this.offline = !1
  6238. }
  6239. ,
  6240. EPUBJS.Storage.prototype.checkRequirements = function(a) {
  6241.     "undefined" == typeof localforage && console.error("localForage library not loaded")
  6242. }
  6243. ,
  6244. EPUBJS.Storage.prototype.put = function(a, b) {
  6245.     var c = new RSVP.defer
  6246.       , d = a.length
  6247.       , e = 0
  6248.       , f = function(b) {
  6249.         var c, g, h = b || new RSVP.defer;
  6250.         return e >= d ? h.resolve() : (c = a[e].url,
  6251.         g = window.encodeURIComponent(c),
  6252.         EPUBJS.core.request(c, "binary").then(function(a) {
  6253.             return localforage.setItem(g, a)
  6254.         }).then(function(a) {
  6255.             e++,
  6256.             setTimeout(function() {
  6257.                 f(h)
  6258.             }, 1)
  6259.         })),
  6260.         h.promise
  6261.     }
  6262.     .bind(this);
  6263.     return Array.isArray(a) || (a = [a]),
  6264.     f().then(function() {
  6265.         c.resolve()
  6266.     }
  6267.     .bind(this)),
  6268.     c.promise
  6269. }
  6270. ,
  6271. EPUBJS.Storage.prototype.token = function(a, b) {
  6272.     var c = window.encodeURIComponent(a);
  6273.     return localforage.setItem(c, b).then(function(a) {
  6274.         return null !== a
  6275.     })
  6276. }
  6277. ,
  6278. EPUBJS.Storage.prototype.isStored = function(a) {
  6279.     var b = window.encodeURIComponent(a);
  6280.     return localforage.getItem(b).then(function(a) {
  6281.         return null !== a
  6282.     })
  6283. }
  6284. ,
  6285. EPUBJS.Storage.prototype.getText = function(a) {
  6286.     var b = window.encodeURIComponent(a);
  6287.     return EPUBJS.core.request(a, "arraybuffer", this.withCredentials).then(function(a) {
  6288.         return this.offline && (this.offline = !1,
  6289.         this.trigger("offline", !1)),
  6290.         localforage.setItem(b, a),
  6291.         a
  6292.     }
  6293.     .bind(this)).then(function(b) {
  6294.         var c = new RSVP.defer
  6295.           , d = EPUBJS.core.getMimeType(a)
  6296.           , e = new Blob([b],{
  6297.             type: d
  6298.         })
  6299.           , f = new FileReader;
  6300.         return f.addEventListener("loadend", function() {
  6301.             c.resolve(f.result)
  6302.         }),
  6303.         f.readAsText(e, d),
  6304.         c.promise
  6305.     })["catch"](function() {
  6306.         var c = new RSVP.defer
  6307.           , d = localforage.getItem(b);
  6308.         return this.offline || (this.offline = !0,
  6309.         this.trigger("offline", !0)),
  6310.         d ? (d.then(function(b) {
  6311.             var d = EPUBJS.core.getMimeType(a)
  6312.               , e = new Blob([b],{
  6313.                 type: d
  6314.             })
  6315.               , f = new FileReader;
  6316.             f.addEventListener("loadend", function() {
  6317.                 c.resolve(f.result)
  6318.             }),
  6319.             f.readAsText(e, d)
  6320.         }),
  6321.         c.promise) : (c.reject({
  6322.             message: "File not found in the storage: " + a,
  6323.             stack: (new Error).stack
  6324.         }),
  6325.         c.promise)
  6326.     }
  6327.     .bind(this))
  6328. }
  6329. ,
  6330. EPUBJS.Storage.prototype.getUrl = function(a) {
  6331.     var b = window.encodeURIComponent(a);
  6332.     return EPUBJS.core.request(a, "arraybuffer", this.withCredentials).then(function(c) {
  6333.         return this.offline && (this.offline = !1,
  6334.         this.trigger("offline", !1)),
  6335.         localforage.setItem(b, c),
  6336.         a
  6337.     }
  6338.     .bind(this))["catch"](function() {
  6339.         var c, d, e = new RSVP.defer, f = window.URL || window.webkitURL || window.mozURL;
  6340.         return this.offline || (this.offline = !0,
  6341.         this.trigger("offline", !0)),
  6342.         b in this.urlCache ? (e.resolve(this.urlCache[b]),
  6343.         e.promise) : (c = localforage.getItem(b)) ? (c.then(function(c) {
  6344.             var g = new Blob([c],{
  6345.                 type: EPUBJS.core.getMimeType(a)
  6346.             });
  6347.             d = f.createObjectURL(g),
  6348.             e.resolve(d),
  6349.             this.urlCache[b] = d
  6350.         }
  6351.         .bind(this)),
  6352.         e.promise) : (e.reject({
  6353.             message: "File not found in the storage: " + a,
  6354.             stack: (new Error).stack
  6355.         }),
  6356.         e.promise)
  6357.     }
  6358.     .bind(this))
  6359. }
  6360. ,
  6361. EPUBJS.Storage.prototype.getXml = function(a) {
  6362.     var b = window.encodeURIComponent(a);
  6363.     return EPUBJS.core.request(a, "arraybuffer", this.withCredentials).then(function(a) {
  6364.         return this.offline && (this.offline = !1,
  6365.         this.trigger("offline", !1)),
  6366.         localforage.setItem(b, a),
  6367.         a
  6368.     }
  6369.     .bind(this)).then(function(b) {
  6370.         var c = new RSVP.defer
  6371.           , d = EPUBJS.core.getMimeType(a)
  6372.           , e = new Blob([b],{
  6373.             type: d
  6374.         })
  6375.           , f = new FileReader;
  6376.         return f.addEventListener("loadend", function() {
  6377.             var a = new DOMParser
  6378.               , b = a.parseFromString(f.result, "text/xml");
  6379.             c.resolve(b)
  6380.         }),
  6381.         f.readAsText(e, d),
  6382.         c.promise
  6383.     })["catch"](function() {
  6384.         var c = new RSVP.defer
  6385.           , d = localforage.getItem(b);
  6386.         return this.offline || (this.offline = !0,
  6387.         this.trigger("offline", !0)),
  6388.         d ? (d.then(function(b) {
  6389.             var d = EPUBJS.core.getMimeType(a)
  6390.               , e = new Blob([b],{
  6391.                 type: d
  6392.             })
  6393.               , f = new FileReader;
  6394.             f.addEventListener("loadend", function() {
  6395.                 var a = new DOMParser
  6396.                   , b = a.parseFromString(f.result, "text/xml");
  6397.                 c.resolve(b)
  6398.             }),
  6399.             f.readAsText(e, d)
  6400.         }),
  6401.         c.promise) : (c.reject({
  6402.             message: "File not found in the storage: " + a,
  6403.             stack: (new Error).stack
  6404.         }),
  6405.         c.promise)
  6406.     }
  6407.     .bind(this))
  6408. }
  6409. ,
  6410. EPUBJS.Storage.prototype.revokeUrl = function(a) {
  6411.     var b = window.URL || window.webkitURL || window.mozURL
  6412.       , c = this.urlCache[a];
  6413.     c && b.revokeObjectURL(c)
  6414. }
  6415. ,
  6416. EPUBJS.Storage.prototype.failed = function(a) {
  6417.     console.error(a)
  6418. }
  6419. ,
  6420. RSVP.EventTarget.mixin(EPUBJS.Storage.prototype),
  6421. EPUBJS.Unarchiver = function(a) {
  6422.     this.checkRequirements(),
  6423.     this.urlCache = {}
  6424. }
  6425. ,
  6426. EPUBJS.Unarchiver.prototype.checkRequirements = function(a) {
  6427.     "undefined" == typeof JSZip && console.error("JSZip lib not loaded")
  6428. }
  6429. ,
  6430. EPUBJS.Unarchiver.prototype.open = function(a, b) {
  6431.     new RSVP.defer;
  6432.     return EPUBJS.core.request(a, "binary").then(function(a) {
  6433.         this.zip = new JSZip(a)
  6434.     }
  6435.     .bind(this))
  6436. }
  6437. ,
  6438. EPUBJS.Unarchiver.prototype.getXml = function(a, b) {
  6439.     var c = window.decodeURIComponent(a);
  6440.     return this.getText(c, b).then(function(a) {
  6441.         var b = new DOMParser;
  6442.         return b.parseFromString(a, "text/xml")
  6443.     })
  6444. }
  6445. ,
  6446. EPUBJS.Unarchiver.prototype.getUrl = function(a, b) {
  6447.     var c, d, e = this, f = new RSVP.defer, g = window.decodeURIComponent(a), h = this.zip.file(g), i = window.URL || window.webkitURL || window.mozURL;
  6448.     return h ? a in this.urlCache ? (f.resolve(this.urlCache[a]),
  6449.     f.promise) : (d = new Blob([h.asUint8Array()],{
  6450.         type: EPUBJS.core.getMimeType(h.name)
  6451.     }),
  6452.     c = i.createObjectURL(d),
  6453.     f.resolve(c),
  6454.     e.urlCache[a] = c,
  6455.     f.promise) : (f.reject({
  6456.         message: "File not found in the epub: " + a,
  6457.         stack: (new Error).stack
  6458.     }),
  6459.     f.promise)
  6460. }
  6461. ,
  6462. EPUBJS.Unarchiver.prototype.getText = function(a, b) {
  6463.     var c, d = new RSVP.defer, e = window.decodeURIComponent(a), f = this.zip.file(e);
  6464.     return f ? (c = f.asText(),
  6465.     d.resolve(c),
  6466.     d.promise) : (d.reject({
  6467.         message: "File not found in the epub: " + a,
  6468.         stack: (new Error).stack
  6469.     }),
  6470.     d.promise)
  6471. }
  6472. ,
  6473. EPUBJS.Unarchiver.prototype.revokeUrl = function(a) {
  6474.     var b = window.URL || window.webkitURL || window.mozURL
  6475.       , c = this.urlCache[a];
  6476.     c && b.revokeObjectURL(c)
  6477. }
  6478. ,
  6479. EPUBJS.Unarchiver.prototype.failed = function(a) {
  6480.     console.error(a)
  6481. }
  6482. ,
  6483. EPUBJS.Unarchiver.prototype.afterSaved = function(a) {
  6484.     this.callback()
  6485. }
  6486. ,
  6487. EPUBJS.Unarchiver.prototype.toStorage = function(a) {
  6488.     function b() {
  6489.         f--,
  6490.         0 === f && e.afterSaved()
  6491.     }
  6492.     var c = 0
  6493.       , d = 20
  6494.       , e = this
  6495.       , f = a.length;
  6496.     a.forEach(function(a) {
  6497.         setTimeout(function(a) {
  6498.             e.saveEntryFileToStorage(a, b)
  6499.         }, c, a),
  6500.         c += d
  6501.     }),
  6502.     console.log("time", c)
  6503. }
  6504. ,
  6505. function() {
  6506.     "use strict";
  6507.     var a = {
  6508.         application: {
  6509.             ecmascript: ["es", "ecma"],
  6510.             javascript: "js",
  6511.             ogg: "ogx",
  6512.             pdf: "pdf",
  6513.             postscript: ["ps", "ai", "eps", "epsi", "epsf", "eps2", "eps3"],
  6514.             "rdf+xml": "rdf",
  6515.             smil: ["smi", "smil"],
  6516.             "xhtml+xml": ["xhtml", "xht"],
  6517.             xml: ["xml", "xsl", "xsd"],
  6518.             zip: "zip",
  6519.             "x-httpd-eruby": "rhtml",
  6520.             "x-latex": "latex",
  6521.             "x-maker": ["frm", "maker", "frame", "fm", "fb", "book", "fbdoc"],
  6522.             "x-object": "o",
  6523.             "x-shockwave-flash": ["swf", "swfl"],
  6524.             "x-silverlight": "scr",
  6525.             "epub+zip": "epub",
  6526.             "font-tdpfr": "pfr",
  6527.             "inkml+xml": ["ink", "inkml"],
  6528.             json: "json",
  6529.             "jsonml+json": "jsonml",
  6530.             "mathml+xml": "mathml",
  6531.             "metalink+xml": "metalink",
  6532.             mp4: "mp4s",
  6533.             "oebps-package+xml": "opf",
  6534.             "omdoc+xml": "omdoc",
  6535.             oxps: "oxps",
  6536.             "vnd.amazon.ebook": "azw",
  6537.             widget: "wgt",
  6538.             "x-dtbncx+xml": "ncx",
  6539.             "x-dtbook+xml": "dtb",
  6540.             "x-dtbresource+xml": "res",
  6541.             "x-font-bdf": "bdf",
  6542.             "x-font-ghostscript": "gsf",
  6543.             "x-font-linux-psf": "psf",
  6544.             "x-font-otf": "otf",
  6545.             "x-font-pcf": "pcf",
  6546.             "x-font-snf": "snf",
  6547.             "x-font-ttf": ["ttf", "ttc"],
  6548.             "x-font-type1": ["pfa", "pfb", "pfm", "afm"],
  6549.             "x-font-woff": "woff",
  6550.             "x-mobipocket-ebook": ["prc", "mobi"],
  6551.             "x-mspublisher": "pub",
  6552.             "x-nzb": "nzb",
  6553.             "x-tgif": "obj",
  6554.             "xaml+xml": "xaml",
  6555.             "xml-dtd": "dtd",
  6556.             "xproc+xml": "xpl",
  6557.             "xslt+xml": "xslt",
  6558.             "internet-property-stream": "acx",
  6559.             "x-compress": "z",
  6560.             "x-compressed": "tgz",
  6561.             "x-gzip": "gz"
  6562.         },
  6563.         audio: {
  6564.             flac: "flac",
  6565.             midi: ["mid", "midi", "kar", "rmi"],
  6566.             mpeg: ["mpga", "mpega", "mp2", "mp3", "m4a", "mp2a", "m2a", "m3a"],
  6567.             mpegurl: "m3u",
  6568.             ogg: ["oga", "ogg", "spx"],
  6569.             "x-aiff": ["aif", "aiff", "aifc"],
  6570.             "x-ms-wma": "wma",
  6571.             "x-wav": "wav",
  6572.             adpcm: "adp",
  6573.             mp4: "mp4a",
  6574.             webm: "weba",
  6575.             "x-aac": "aac",
  6576.             "x-caf": "caf",
  6577.             "x-matroska": "mka",
  6578.             "x-pn-realaudio-plugin": "rmp",
  6579.             xm: "xm",
  6580.             mid: ["mid", "rmi"]
  6581.         },
  6582.         image: {
  6583.             gif: "gif",
  6584.             ief: "ief",
  6585.             jpeg: ["jpeg", "jpg", "jpe"],
  6586.             pcx: "pcx",
  6587.             png: "png",
  6588.             "svg+xml": ["svg", "svgz"],
  6589.             tiff: ["tiff", "tif"],
  6590.             "x-icon": "ico",
  6591.             bmp: "bmp",
  6592.             webp: "webp",
  6593.             "x-pict": ["pic", "pct"],
  6594.             "x-tga": "tga",
  6595.             "cis-cod": "cod"
  6596.         },
  6597.         message: {
  6598.             rfc822: ["eml", "mime", "mht", "mhtml", "nws"]
  6599.         },
  6600.         text: {
  6601.             "cache-manifest": ["manifest", "appcache"],
  6602.             calendar: ["ics", "icz", "ifb"],
  6603.             css: "css",
  6604.             csv: "csv",
  6605.             h323: "323",
  6606.             html: ["html", "htm", "shtml", "stm"],
  6607.             iuls: "uls",
  6608.             mathml: "mml",
  6609.             plain: ["txt", "text", "brf", "conf", "def", "list", "log", "in", "bas"],
  6610.             richtext: "rtx",
  6611.             "tab-separated-values": "tsv",
  6612.             "x-bibtex": "bib",
  6613.             "x-dsrc": "d",
  6614.             "x-diff": ["diff", "patch"],
  6615.             "x-haskell": "hs",
  6616.             "x-java": "java",
  6617.             "x-literate-haskell": "lhs",
  6618.             "x-moc": "moc",
  6619.             "x-pascal": ["p", "pas"],
  6620.             "x-pcs-gcd": "gcd",
  6621.             "x-perl": ["pl", "pm"],
  6622.             "x-python": "py",
  6623.             "x-scala": "scala",
  6624.             "x-setext": "etx",
  6625.             "x-tcl": ["tcl", "tk"],
  6626.             "x-tex": ["tex", "ltx", "sty", "cls"],
  6627.             "x-vcard": "vcf",
  6628.             sgml: ["sgml", "sgm"],
  6629.             "x-c": ["c", "cc", "cxx", "cpp", "h", "hh", "dic"],
  6630.             "x-fortran": ["f", "for", "f77", "f90"],
  6631.             "x-opml": "opml",
  6632.             "x-nfo": "nfo",
  6633.             "x-sfv": "sfv",
  6634.             "x-uuencode": "uu",
  6635.             webviewhtml: "htt"
  6636.         },
  6637.         video: {
  6638.             mpeg: ["mpeg", "mpg", "mpe", "m1v", "m2v", "mp2", "mpa", "mpv2"],
  6639.             mp4: ["mp4", "mp4v", "mpg4"],
  6640.             quicktime: ["qt", "mov"],
  6641.             ogg: "ogv",
  6642.             "vnd.mpegurl": ["mxu", "m4u"],
  6643.             "x-flv": "flv",
  6644.             "x-la-asf": ["lsf", "lsx"],
  6645.             "x-mng": "mng",
  6646.             "x-ms-asf": ["asf", "asx", "asr"],
  6647.             "x-ms-wm": "wm",
  6648.             "x-ms-wmv": "wmv",
  6649.             "x-ms-wmx": "wmx",
  6650.             "x-ms-wvx": "wvx",
  6651.             "x-msvideo": "avi",
  6652.             "x-sgi-movie": "movie",
  6653.             "x-matroska": ["mpv", "mkv", "mk3d", "mks"],
  6654.             "3gpp2": "3g2",
  6655.             h261: "h261",
  6656.             h263: "h263",
  6657.             h264: "h264",
  6658.             jpeg: "jpgv",
  6659.             jpm: ["jpm", "jpgm"],
  6660.             mj2: ["mj2", "mjp2"],
  6661.             "vnd.ms-playready.media.pyv": "pyv",
  6662.             "vnd.uvvu.mp4": ["uvu", "uvvu"],
  6663.             "vnd.vivo": "viv",
  6664.             webm: "webm",
  6665.             "x-f4v": "f4v",
  6666.             "x-m4v": "m4v",
  6667.             "x-ms-vob": "vob",
  6668.             "x-smv": "smv"
  6669.         }
  6670.     }
  6671.       , b = function() {
  6672.         var b, c, d, e, f = {};
  6673.         for (b in a)
  6674.             if (a.hasOwnProperty(b))
  6675.                 for (c in a[b])
  6676.                     if (a[b].hasOwnProperty(c))
  6677.                         if (d = a[b][c],
  6678.                         "string" == typeof d)
  6679.                             f[d] = b + "/" + c;
  6680.                         else
  6681.                             for (e = 0; e < d.length; e++)
  6682.                                 f[d[e]] = b + "/" + c;
  6683.         return f
  6684.     }();
  6685.     EPUBJS.core.getMimeType = function(a) {
  6686.         var c = "text/plain";
  6687.         return a && b[a.split(".").pop().toLowerCase()] || c
  6688.     }
  6689. }(),
  6690. EPUBJS.Hooks.register("beforeChapterDisplay").endnotes = function(a, b) {
  6691.     var c = b.contents.querySelectorAll("a[href]")
  6692.       , d = Array.prototype.slice.call(c)
  6693.       , e = "epub:type"
  6694.       , f = "noteref"
  6695.       , g = EPUBJS.core.folder(location.pathname)
  6696.       , h = (g + EPUBJS.cssPath || g,
  6697.     {});
  6698.     EPUBJS.core.addCss("http://cdn-html5.s3.amazonaws.com/reader_epub/1.0/css/popup.css", !1, b.render.document.head),
  6699.     d.forEach(function(a) {
  6700.         function c() {
  6701.             var c, e, f = b.height, j = b.width, p = 225;
  6702.             o || (c = l.cloneNode(!0),
  6703.             o = c.querySelector("p")),
  6704.             h[k] || (h[k] = document.createElement("div"),
  6705.             h[k].setAttribute("class", "popup"),
  6706.             pop_content = document.createElement("div"),
  6707.             h[k].appendChild(pop_content),
  6708.             pop_content.appendChild(o),
  6709.             pop_content.setAttribute("class", "pop_content"),
  6710.             b.render.document.body.appendChild(h[k]),
  6711.             h[k].addEventListener("mouseover", d, !1),
  6712.             h[k].addEventListener("mouseout", g, !1),
  6713.             b.on("renderer:pageChanged", i, this),
  6714.             b.on("renderer:pageChanged", g, this)),
  6715.             c = h[k],
  6716.             e = a.getBoundingClientRect(),
  6717.             m = e.left,
  6718.             n = e.top,
  6719.             c.classList.add("show"),
  6720.             popRect = c.getBoundingClientRect(),
  6721.             c.style.left = m - popRect.width / 2 + "px",
  6722.             c.style.top = n + "px",
  6723.             p > f / 2.5 && (p = f / 2.5,
  6724.             pop_content.style.maxHeight = p + "px"),
  6725.             popRect.height + n >= f - 25 ? (c.style.top = n - popRect.height + "px",
  6726.             c.classList.add("above")) : c.classList.remove("above"),
  6727.             m - popRect.width <= 0 ? (c.style.left = m + "px",
  6728.             c.classList.add("left")) : c.classList.remove("left"),
  6729.             m + popRect.width / 2 >= j ? (c.style.left = m - 300 + "px",
  6730.             popRect = c.getBoundingClientRect(),
  6731.             c.style.left = m - popRect.width + "px",
  6732.             popRect.height + n >= f - 25 ? (c.style.top = n - popRect.height + "px",
  6733.             c.classList.add("above")) : c.classList.remove("above"),
  6734.             c.classList.add("right")) : c.classList.remove("right")
  6735.         }
  6736.         function d() {
  6737.             h[k].classList.add("on")
  6738.         }
  6739.         function g() {
  6740.             h[k].classList.remove("on")
  6741.         }
  6742.         function i() {
  6743.             setTimeout(function() {
  6744.                 h[k].classList.remove("show")
  6745.             }, 100)
  6746.         }
  6747.         var j, k, l, m, n, o, p = a.getAttribute(e);
  6748.         p == f && (j = a.getAttribute("href"),
  6749.         k = j.replace("#", ""),
  6750.         l = b.render.document.getElementById(k),
  6751.         a.addEventListener("mouseover", c, !1),
  6752.         a.addEventListener("mouseout", i, !1))
  6753.     }),
  6754.     a && a()
  6755. }
  6756. ,
  6757. EPUBJS.Hooks.register("beforeChapterDisplay").mathml = function(a, b) {
  6758.     if (-1 !== b.currentChapter.manifestProperties.indexOf("mathml")) {
  6759.         b.render.iframe.contentWindow.mathmlCallback = a;
  6760.         var c = document.createElement("script");
  6761.         c.type = "text/x-mathjax-config",
  6762.         c.innerHTML = '        MathJax.Hub.Register.StartupHook("End",function () {           window.mathmlCallback();         });        MathJax.Hub.Config({jax: ["input/TeX","input/MathML","output/SVG"],extensions: ["tex2jax.js","mml2jax.js","MathEvents.js"],TeX: {extensions: ["noErrors.js","noUndefined.js","autoload-all.js"]},MathMenu: {showRenderer: false},menuSettings: {zoom: "Click"},messageStyle: "none"});                 ',
  6763.         b.doc.body.appendChild(c),
  6764.         EPUBJS.core.addScript("http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML", null, b.doc.head)
  6765.     } else
  6766.         a && a()
  6767. }
  6768. ,
  6769. EPUBJS.Hooks.register("beforeChapterDisplay").smartimages = function(a, b) {
  6770.     var c = b.contents.querySelectorAll("img")
  6771.       , d = Array.prototype.slice.call(c)
  6772.       , e = b.height;
  6773.     return "reflowable" != b.layoutSettings.layout ? void a() : (d.forEach(function(a) {
  6774.         function c() {
  6775.             var c, d = a.getBoundingClientRect(), f = d.height, g = d.top, h = a.getAttribute("data-height"), i = h || f, j = Number(getComputedStyle(a, "").fontSize.match(/(\d*(\.\d*)?)px/)[1]), k = j ? j / 2 : 0;
  6776.             e = b.contents.clientHeight,
  6777.             0 > g && (g = 0),
  6778.             i + g >= e ? (e / 2 > g ? (c = e - g - k,
  6779.             a.style.maxHeight = c + "px",
  6780.             a.style.width = "auto") : (i > e && (a.style.maxHeight = e + "px",
  6781.             a.style.width = "auto",
  6782.             d = a.getBoundingClientRect(),
  6783.             i = d.height),
  6784.             a.style.display = "block",
  6785.             a.style.WebkitColumnBreakBefore = "always",
  6786.             a.style.breakBefore = "column"),
  6787.             a.setAttribute("data-height", c)) : (a.style.removeProperty("max-height"),
  6788.             a.style.removeProperty("margin-top"))
  6789.         }
  6790.         a.addEventListener("load", c, !1),
  6791.         b.on("renderer:resized", c),
  6792.         b.on("renderer:chapterUnloaded", function() {
  6793.             a.removeEventListener("load", c),
  6794.             b.off("renderer:resized", c)
  6795.         }),
  6796.         c()
  6797.     }),
  6798.     void (a && a()))
  6799. }
  6800. ,
  6801. EPUBJS.Hooks.register("beforeChapterDisplay").transculsions = function(a, b) {
  6802.     var c = b.contents.querySelectorAll("[transclusion]")
  6803.       , d = Array.prototype.slice.call(c);
  6804.     d.forEach(function(a) {
  6805.         function c() {
  6806.             j = g,
  6807.             k = h,
  6808.             j > chapter.colWidth && (d = chapter.colWidth / j,
  6809.             j = chapter.colWidth,
  6810.             k *= d),
  6811.             f.width = j,
  6812.             f.height = k
  6813.         }
  6814.         var d, e = a.getAttribute("ref"), f = document.createElement("iframe"), g = a.getAttribute("width"), h = a.getAttribute("height"), i = a.parentNode, j = g, k = h;
  6815.         c(),
  6816.         b.listenUntil("renderer:resized", "renderer:chapterUnloaded", c),
  6817.         f.src = e,
  6818.         i.replaceChild(f, a)
  6819.     }),
  6820.     a && a()
  6821. }
  6822. ,
  6823. EPUBJS.reader = {},
  6824. EPUBJS.reader.plugins = {},
  6825. function(a) {
  6826.     var b = (a.ePubReader || {},
  6827.     a.ePubReader = function(a, b) {
  6828.         return new EPUBJS.Reader(a,b)
  6829.     }
  6830.     );
  6831.     "function" == typeof define && define.amd ? define(function() {
  6832.         return Reader
  6833.     }) : "undefined" != typeof module && module.exports && (module.exports = b)
  6834. }(window, jQuery),
  6835. EPUBJS.Reader = function(a, b) {
  6836.     var c, d, e, f = this, g = $("#viewer"), h = window.location.search;
  6837.     this.settings = EPUBJS.core.defaults(b || {}, {
  6838.         bookPath: a,
  6839.         restore: !0,
  6840.         reload: !1,
  6841.         bookmarks: void 0,
  6842.         annotations: void 0,
  6843.         contained: void 0,
  6844.         bookKey: void 0,
  6845.         styles: void 0,
  6846.         sidebarReflow: !1,
  6847.         generatePagination: !1,
  6848.         history: !0
  6849.     }),
  6850.     h && (e = h.slice(1).split("&"),
  6851.     e.forEach(function(a) {
  6852.         var b = a.split("=")
  6853.           , c = b[0]
  6854.           , d = b[1] || "";
  6855.         f.settings[c] = decodeURIComponent(d)
  6856.     })),
  6857.     this.setBookKey(this.settings.bookPath),
  6858.     this.settings.restore && this.isSaved() && this.applySavedSettings(),
  6859.     this.settings.styles = this.settings.styles || {
  6860.         fontSize: "100%"
  6861.     },
  6862.     this.book = c = new EPUBJS.Book(this.settings),
  6863.     this.settings.previousLocationCfi && c.gotoCfi(this.settings.previousLocationCfi),
  6864.     this.offline = !1,
  6865.     this.sidebarOpen = !1,
  6866.     this.settings.bookmarks || (this.settings.bookmarks = []),
  6867.     this.settings.annotations || (this.settings.annotations = []),
  6868.     this.settings.generatePagination && c.generatePagination(g.width(), g.height()),
  6869.     c.renderTo("viewer"),
  6870.     f.ReaderController = EPUBJS.reader.ReaderController.call(f, c),
  6871.     f.SettingsController = EPUBJS.reader.SettingsController.call(f, c),
  6872.     f.ControlsController = EPUBJS.reader.ControlsController.call(f, c),
  6873.     f.SidebarController = EPUBJS.reader.SidebarController.call(f, c),
  6874.     f.BookmarksController = EPUBJS.reader.BookmarksController.call(f, c),
  6875.     f.NotesController = EPUBJS.reader.NotesController.call(f, c);
  6876.     for (d in EPUBJS.reader.plugins)
  6877.         EPUBJS.reader.plugins.hasOwnProperty(d) && (f[d] = EPUBJS.reader.plugins[d].call(f, c));
  6878.     return c.ready.all.then(function() {
  6879.         f.ReaderController.hideLoader()
  6880.     }),
  6881.     c.getMetadata().then(function(a) {
  6882.         f.MetaController = EPUBJS.reader.MetaController.call(f, a)
  6883.     }),
  6884.     c.getToc().then(function(a) {
  6885.         f.TocController = EPUBJS.reader.TocController.call(f, a)
  6886.     }),
  6887.     window.addEventListener("beforeunload", this.unload.bind(this), !1),
  6888.     window.addEventListener("hashchange", this.hashChanged.bind(this), !1),
  6889.     document.addEventListener("keydown", this.adjustFontSize.bind(this), !1),
  6890.     c.on("renderer:keydown", this.adjustFontSize.bind(this)),
  6891.     c.on("renderer:keydown", f.ReaderController.arrowKeys.bind(this)),
  6892.     c.on("renderer:selected", this.selectedRange.bind(this)),
  6893.     this
  6894. }
  6895. ,
  6896. EPUBJS.Reader.prototype.adjustFontSize = function(a) {
  6897.     var b, c = 2, d = 187, e = 189, f = 48, g = a.ctrlKey || a.metaKey;
  6898.     this.settings.styles && (this.settings.styles.fontSize || (this.settings.styles.fontSize = "100%"),
  6899.     b = parseInt(this.settings.styles.fontSize.slice(0, -1)),
  6900.     g && a.keyCode == d && (a.preventDefault(),
  6901.     this.book.setStyle("fontSize", b + c + "%")),
  6902.     g && a.keyCode == e && (a.preventDefault(),
  6903.     this.book.setStyle("fontSize", b - c + "%")),
  6904.     g && a.keyCode == f && (a.preventDefault(),
  6905.     this.book.setStyle("fontSize", "100%")))
  6906. }
  6907. ,
  6908. EPUBJS.Reader.prototype.addBookmark = function(a) {
  6909.     var b = this.isBookmarked(a);
  6910.     b > -1 || (this.settings.bookmarks.push(a),
  6911.     this.trigger("reader:bookmarked", a))
  6912. }
  6913. ,
  6914. EPUBJS.Reader.prototype.removeBookmark = function(a) {
  6915.     var b = this.isBookmarked(a);
  6916.     -1 !== b && (this.settings.bookmarks.splice(b, 1),
  6917.     this.trigger("reader:unbookmarked", b))
  6918. }
  6919. ,
  6920. EPUBJS.Reader.prototype.isBookmarked = function(a) {
  6921.     var b = this.settings.bookmarks;
  6922.     return b.indexOf(a)
  6923. }
  6924. ,
  6925. EPUBJS.Reader.prototype.clearBookmarks = function() {
  6926.     this.settings.bookmarks = []
  6927. }
  6928. ,
  6929. EPUBJS.Reader.prototype.addNote = function(a) {
  6930.     this.settings.annotations.push(a)
  6931. }
  6932. ,
  6933. EPUBJS.Reader.prototype.removeNote = function(a) {
  6934.     var b = this.settings.annotations.indexOf(a);
  6935.     -1 !== b && delete this.settings.annotations[b]
  6936. }
  6937. ,
  6938. EPUBJS.Reader.prototype.clearNotes = function() {
  6939.     this.settings.annotations = []
  6940. }
  6941. ,
  6942. EPUBJS.Reader.prototype.setBookKey = function(a) {
  6943.     return this.settings.bookKey || (this.settings.bookKey = "epubjsreader:" + EPUBJS.VERSION + ":" + window.location.host + ":" + a),
  6944.     this.settings.bookKey
  6945. }
  6946. ,
  6947. EPUBJS.Reader.prototype.isSaved = function() {
  6948.     var a;
  6949.     return !!localStorage && (a = localStorage.getItem(this.settings.bookKey),
  6950.     null !== a)
  6951. }
  6952. ,
  6953. EPUBJS.Reader.prototype.removeSavedSettings = function() {
  6954.     return !!localStorage && void localStorage.removeItem(this.settings.bookKey)
  6955. }
  6956. ,
  6957. EPUBJS.Reader.prototype.applySavedSettings = function() {
  6958.     var a;
  6959.     if (!localStorage)
  6960.         return !1;
  6961.     try {
  6962.         a = JSON.parse(localStorage.getItem(this.settings.bookKey))
  6963.     } catch (b) {
  6964.         return !1
  6965.     }
  6966.     return !!a && (a.styles && (this.settings.styles = EPUBJS.core.defaults(this.settings.styles || {}, a.styles)),
  6967.     this.settings = EPUBJS.core.defaults(this.settings, a),
  6968.     !0)
  6969. }
  6970. ,
  6971. EPUBJS.Reader.prototype.saveSettings = function() {
  6972.     return this.book && (this.settings.previousLocationCfi = this.book.getCurrentLocationCfi()),
  6973.     !!localStorage && void localStorage.setItem(this.settings.bookKey, JSON.stringify(this.settings))
  6974. }
  6975. ,
  6976. EPUBJS.Reader.prototype.unload = function() {
  6977.     this.settings.restore && localStorage && this.saveSettings()
  6978. }
  6979. ,
  6980. EPUBJS.Reader.prototype.hashChanged = function() {
  6981.     var a = window.location.hash.slice(1);
  6982.     this.book["goto"](a)
  6983. }
  6984. ,
  6985. EPUBJS.Reader.prototype.selectedRange = function(a) {
  6986.     var b = new EPUBJS.EpubCFI
  6987.       , c = b.generateCfiFromRangeAnchor(a, this.book.renderer.currentChapter.cfiBase)
  6988.       , d = window.location.origin + window.location.pathname + window.location.hash;
  6989.     this.settings.history && window.location.hash != d && (history.pushState({}, "", d),
  6990.     this.currentLocationCfi = c)
  6991. }
  6992. ,
  6993. RSVP.EventTarget.mixin(EPUBJS.Reader.prototype),
  6994. EPUBJS.reader.BookmarksController = function() {
  6995.     var a = this.book
  6996.       , b = $("#bookmarksView")
  6997.       , c = b.find("#bookmarks")
  6998.       , d = document.createDocumentFragment()
  6999.       , e = function() {
  7000.         b.show()
  7001.     }
  7002.       , f = function() {
  7003.         b.hide()
  7004.     }
  7005.       , g = 0
  7006.       , h = function(b) {
  7007.         var c = document.createElement("li")
  7008.           , d = document.createElement("a");
  7009.         return c.id = "bookmark-" + g,
  7010.         c.classList.add("list_item"),
  7011.         d.textContent = b,
  7012.         d.href = b,
  7013.         d.classList.add("bookmark_link"),
  7014.         d.addEventListener("click", function(b) {
  7015.             var c = this.getAttribute("href");
  7016.             a.gotoCfi(c),
  7017.             b.preventDefault()
  7018.         }, !1),
  7019.         c.appendChild(d),
  7020.         g++,
  7021.         c
  7022.     };
  7023.     return this.settings.bookmarks.forEach(function(a) {
  7024.         var b = h(a);
  7025.         d.appendChild(b)
  7026.     }),
  7027.     c.append(d),
  7028.     this.on("reader:bookmarked", function(a) {
  7029.         var b = h(a);
  7030.         c.append(b)
  7031.     }),
  7032.     this.on("reader:unbookmarked", function(a) {
  7033.         var b = $("#bookmark-" + a);
  7034.         b.remove()
  7035.     }),
  7036.     {
  7037.         show: e,
  7038.         hide: f
  7039.     }
  7040. }
  7041. ,
  7042. EPUBJS.reader.ControlsController = function(a) {
  7043.     var b = this
  7044.       , c = ($("#store"),
  7045.     $("#fullscreen"))
  7046.       , d = ($("#fullscreenicon"),
  7047.     $("#cancelfullscreenicon"),
  7048.     $("#slider"))
  7049.       , e = ($("#main"),
  7050.     $("#sidebar"),
  7051.     $("#setting"))
  7052.       , f = $("#bookmark")
  7053.       , g = function() {
  7054.         b.offline = !1
  7055.     }
  7056.       , h = function() {
  7057.         b.offline = !0
  7058.     }
  7059.       , i = !1;
  7060.     return a.on("book:online", g),
  7061.     a.on("book:offline", h),
  7062.     d.on("click", function() {
  7063.         b.sidebarOpen ? (b.SidebarController.hide(),
  7064.         d.addClass("icon-menu"),
  7065.         d.removeClass("icon-right")) : (b.SidebarController.show(),
  7066.         d.addClass("icon-right"),
  7067.         d.removeClass("icon-menu"))
  7068.     }),
  7069.     "undefined" != typeof screenfull && (c.on("click", function() {
  7070.         screenfull.toggle($("#container")[0])
  7071.     }),
  7072.     screenfull.raw && document.addEventListener(screenfull.raw.fullscreenchange, function() {
  7073.         i = screenfull.isFullscreen,
  7074.         i ? c.addClass("icon-resize-small").removeClass("icon-resize-full") : c.addClass("icon-resize-full").removeClass("icon-resize-small")
  7075.     })),
  7076.     e.on("click", function() {
  7077.         b.SettingsController.show()
  7078.     }),
  7079.     f.on("click", function() {
  7080.         var a = b.book.getCurrentLocationCfi()
  7081.           , c = b.isBookmarked(a);
  7082.         -1 === c ? (b.addBookmark(a),
  7083.         f.addClass("icon-bookmark").removeClass("icon-bookmark-empty")) : (b.removeBookmark(a),
  7084.         f.removeClass("icon-bookmark").addClass("icon-bookmark-empty"))
  7085.     }),
  7086.     a.on("renderer:locationChanged", function(a) {
  7087.         var c = "#" + a
  7088.           , d = b.isBookmarked(a);
  7089.         -1 === d ? f.removeClass("icon-bookmark").addClass("icon-bookmark-empty") : f.addClass("icon-bookmark").removeClass("icon-bookmark-empty"),
  7090.         b.currentLocationCfi = a,
  7091.         b.settings.history && window.location.hash != c && history.pushState({}, "", window.location.origin + window.location.pathname + window.location.hash)
  7092.     }),
  7093.     a.on("book:pageChanged", function() {}),
  7094.     {}
  7095. }
  7096. ,
  7097. EPUBJS.reader.MetaController = function(a) {
  7098.     var b = a.bookTitle
  7099.       , c = a.creator
  7100.       , d = $("#book-title")
  7101.       , e = $("#chapter-title")
  7102.       , f = $("#title-seperator");
  7103.     document.title = b + " – " + c,
  7104.     d.html(b),
  7105.     e.html(c),
  7106.     f.show()
  7107. }
  7108. ,
  7109. EPUBJS.reader.NotesController = function() {
  7110.     var a = this.book
  7111.       , b = this
  7112.       , c = $("#notesView")
  7113.       , d = $("#notes")
  7114.       , e = $("#note-text")
  7115.       , f = $("#note-anchor")
  7116.       , g = b.settings.annotations
  7117.       , h = a.renderer
  7118.       , i = []
  7119.       , j = new EPUBJS.EpubCFI
  7120.       , k = function() {
  7121.         c.show()
  7122.     }
  7123.       , l = function() {
  7124.         c.hide()
  7125.     }
  7126.       , m = function(c) {
  7127.         var d, g, h, i, k, l = a.renderer.doc;
  7128.         if (l.caretPositionFromPoint ? (d = l.caretPositionFromPoint(c.clientX, c.clientY),
  7129.         g = d.offsetNode,
  7130.         h = d.offset) : l.caretRangeFromPoint && (d = l.caretRangeFromPoint(c.clientX, c.clientY),
  7131.         g = d.startContainer,
  7132.         h = d.startOffset),
  7133.         3 !== g.nodeType)
  7134.             for (var p = 0; p < g.childNodes.length; p++)
  7135.                 if (3 == g.childNodes[p].nodeType) {
  7136.                     g = g.childNodes[p];
  7137.                     break
  7138.                 }
  7139.         h = g.textContent.indexOf(".", h),
  7140.         -1 === h ? h = g.length : h += 1,
  7141.         i = j.generateCfiFromTextNode(g, h, a.renderer.currentChapter.cfiBase),
  7142.         k = {
  7143.             annotatedAt: new Date,
  7144.             anchor: i,
  7145.             body: e.val()
  7146.         },
  7147.         b.addNote(k),
  7148.         n(k),
  7149.         o(k),
  7150.         e.val(""),
  7151.         f.text("Attach"),
  7152.         e.prop("disabled", !1),
  7153.         a.off("renderer:click", m)
  7154.     }
  7155.       , n = function(b) {
  7156.         var c = document.createElement("li")
  7157.           , e = document.createElement("a");
  7158.         c.innerHTML = b.body,
  7159.         e.innerHTML = " context &#187;",
  7160.         e.href = "#" + b.anchor,
  7161.         e.onclick = function() {
  7162.             return a.gotoCfi(b.anchor),
  7163.             !1
  7164.         }
  7165.         ,
  7166.         c.appendChild(e),
  7167.         d.append(c)
  7168.     }
  7169.       , o = function(b) {
  7170.         var c = a.renderer.doc
  7171.           , d = document.createElement("span")
  7172.           , e = document.createElement("a");
  7173.         d.classList.add("footnotesuperscript", "reader_generated"),
  7174.         d.style.verticalAlign = "super",
  7175.         d.style.fontSize = ".75em",
  7176.         d.style.lineHeight = "1em",
  7177.         e.style.padding = "2px",
  7178.         e.style.backgroundColor = "#fffa96",
  7179.         e.style.borderRadius = "5px",
  7180.         e.style.cursor = "pointer",
  7181.         d.id = "note-" + EPUBJS.core.uuid(),
  7182.         e.innerHTML = g.indexOf(b) + 1 + "[Reader]",
  7183.         d.appendChild(e),
  7184.         j.addMarker(b.anchor, c, d),
  7185.         p(d, b.body)
  7186.     }
  7187.       , p = function(a, c) {
  7188.         var d = a.id
  7189.           , e = function() {
  7190.             var b, e, k, l, m = h.height, n = h.width, o = 225;
  7191.             i[d] || (i[d] = document.createElement("div"),
  7192.             i[d].setAttribute("class", "popup"),
  7193.             pop_content = document.createElement("div"),
  7194.             i[d].appendChild(pop_content),
  7195.             pop_content.innerHTML = c,
  7196.             pop_content.setAttribute("class", "pop_content"),
  7197.             h.render.document.body.appendChild(i[d]),
  7198.             i[d].addEventListener("mouseover", f, !1),
  7199.             i[d].addEventListener("mouseout", g, !1),
  7200.             h.on("renderer:locationChanged", j, this),
  7201.             h.on("renderer:locationChanged", g, this)),
  7202.             b = i[d],
  7203.             e = a.getBoundingClientRect(),
  7204.             k = e.left,
  7205.             l = e.top,
  7206.             b.classList.add("show"),
  7207.             popRect = b.getBoundingClientRect(),
  7208.             b.style.left = k - popRect.width / 2 + "px",
  7209.             b.style.top = l + "px",
  7210.             o > m / 2.5 && (o = m / 2.5,
  7211.             pop_content.style.maxHeight = o + "px"),
  7212.             popRect.height + l >= m - 25 ? (b.style.top = l - popRect.height + "px",
  7213.             b.classList.add("above")) : b.classList.remove("above"),
  7214.             k - popRect.width <= 0 ? (b.style.left = k + "px",
  7215.             b.classList.add("left")) : b.classList.remove("left"),
  7216.             k + popRect.width / 2 >= n ? (b.style.left = k - 300 + "px",
  7217.             popRect = b.getBoundingClientRect(),
  7218.             b.style.left = k - popRect.width + "px",
  7219.             popRect.height + l >= m - 25 ? (b.style.top = l - popRect.height + "px",
  7220.             b.classList.add("above")) : b.classList.remove("above"),
  7221.             b.classList.add("right")) : b.classList.remove("right")
  7222.         }
  7223.           , f = function() {
  7224.             i[d].classList.add("on")
  7225.         }
  7226.           , g = function() {
  7227.             i[d].classList.remove("on")
  7228.         }
  7229.           , j = function() {
  7230.             setTimeout(function() {
  7231.                 i[d].classList.remove("show")
  7232.             }, 100)
  7233.         }
  7234.           , l = function() {
  7235.             b.ReaderController.slideOut(),
  7236.             k()
  7237.         };
  7238.         a.addEventListener("mouseover", e, !1),
  7239.         a.addEventListener("mouseout", j, !1),
  7240.         a.addEventListener("click", l, !1)
  7241.     };
  7242.     return f.on("click", function() {
  7243.         f.text("Cancel"),
  7244.         e.prop("disabled", "true"),
  7245.         a.on("renderer:click", m)
  7246.     }),
  7247.     g.forEach(function(a) {
  7248.         n(a)
  7249.     }),
  7250.     h.registerHook("beforeChapterDisplay", function(a, b) {
  7251.         var c = b.currentChapter;
  7252.         g.forEach(function(a) {
  7253.             var b = j.parse(a.anchor);
  7254.             if (b.spinePos === c.spinePos)
  7255.                 try {
  7256.                     o(a)
  7257.                 } catch (d) {
  7258.                     console.log("anchoring failed", a.anchor)
  7259.                 }
  7260.         }),
  7261.         a()
  7262.     }, !0),
  7263.     {
  7264.         show: k,
  7265.         hide: l
  7266.     }
  7267. }
  7268. ,
  7269. EPUBJS.reader.ReaderController = function(a) {
  7270.     var b = $("#main")
  7271.       , c = $("#divider")
  7272.       , d = $("#loader")
  7273.       , e = $("#next")
  7274.       , f = $("#prev")
  7275.       , g = this
  7276.       , a = this.book
  7277.       , h = function() {
  7278.         var c = a.getCurrentLocationCfi();
  7279.         g.settings.sidebarReflow ? (b.removeClass("single"),
  7280.         b.one("transitionend", function() {
  7281.             a.gotoCfi(c)
  7282.         })) : b.removeClass("closed")
  7283.     }
  7284.       , i = function() {
  7285.         var c = a.getCurrentLocationCfi();
  7286.         g.settings.sidebarReflow ? (b.addClass("single"),
  7287.         b.one("transitionend", function() {
  7288.             a.gotoCfi(c)
  7289.         })) : b.addClass("closed")
  7290.     }
  7291.       , j = function() {
  7292.         d.show(),
  7293.         m()
  7294.     }
  7295.       , k = function() {
  7296.         d.hide()
  7297.     }
  7298.       , l = function() {
  7299.         c.addClass("show")
  7300.     }
  7301.       , m = function() {
  7302.         c.removeClass("show")
  7303.     }
  7304.       , n = !1
  7305.       , o = function(b) {
  7306.         37 == b.keyCode && ("rtl" === a.metadata.direction ? a.nextPage() : a.prevPage(),
  7307.         f.addClass("active"),
  7308.         n = !0,
  7309.         setTimeout(function() {
  7310.             n = !1,
  7311.             f.removeClass("active")
  7312.         }, 100),
  7313.         b.preventDefault()),
  7314.         39 == b.keyCode && ("rtl" === a.metadata.direction ? a.prevPage() : a.nextPage(),
  7315.         e.addClass("active"),
  7316.         n = !0,
  7317.         setTimeout(function() {
  7318.             n = !1,
  7319.             e.removeClass("active")
  7320.         }, 100),
  7321.         b.preventDefault())
  7322.     };
  7323.     return document.addEventListener("keydown", o, !1),
  7324.     e.on("click", function(b) {
  7325.         "rtl" === a.metadata.direction ? a.prevPage() : a.nextPage(),
  7326.         b.preventDefault()
  7327.     }),
  7328.     f.on("click", function(b) {
  7329.         "rtl" === a.metadata.direction ? a.nextPage() : a.prevPage(),
  7330.         b.preventDefault()
  7331.     }),
  7332.     a.on("renderer:spreads", function(a) {
  7333.         a ? l() : m()
  7334.     }),
  7335.     {
  7336.         slideOut: i,
  7337.         slideIn: h,
  7338.         showLoader: j,
  7339.         hideLoader: k,
  7340.         showDivider: l,
  7341.         hideDivider: m,
  7342.         arrowKeys: o
  7343.     }
  7344. }
  7345. ,
  7346. EPUBJS.reader.SettingsController = function() {
  7347.     var a = (this.book,
  7348.     this)
  7349.       , b = $("#settings-modal")
  7350.       , c = $(".overlay")
  7351.       , d = function() {
  7352.         b.addClass("md-show")
  7353.     }
  7354.       , e = function() {
  7355.         b.removeClass("md-show")
  7356.     }
  7357.       , f = $("#sidebarReflow");
  7358.     return f.on("click", function() {
  7359.         a.settings.sidebarReflow = !a.settings.sidebarReflow
  7360.     }),
  7361.     b.find(".closer").on("click", function() {
  7362.         e()
  7363.     }),
  7364.     c.on("click", function() {
  7365.         e()
  7366.     }),
  7367.     {
  7368.         show: d,
  7369.         hide: e
  7370.     }
  7371. }
  7372. ,
  7373. EPUBJS.reader.SidebarController = function() {
  7374.     var a = this
  7375.       , b = $("#sidebar")
  7376.       , c = $("#panels")
  7377.       , d = "Toc"
  7378.       , e = function(b) {
  7379.         var e = b + "Controller";
  7380.         d != b && "undefined" != typeof a[e] && (a[d + "Controller"].hide(),
  7381.         a[e].show(),
  7382.         d = b,
  7383.         c.find(".active").removeClass("active"),
  7384.         c.find("#show-" + b).addClass("active"))
  7385.     }
  7386.       , f = function() {
  7387.         return d
  7388.     }
  7389.       , g = function() {
  7390.         a.sidebarOpen = !0,
  7391.         a.ReaderController.slideOut(),
  7392.         b.addClass("open")
  7393.     }
  7394.       , h = function() {
  7395.         a.sidebarOpen = !1,
  7396.         a.ReaderController.slideIn(),
  7397.         b.removeClass("open")
  7398.     };
  7399.     return c.find(".show_view").on("click", function(a) {
  7400.         var b = $(this).data("view");
  7401.         e(b),
  7402.         a.preventDefault()
  7403.     }),
  7404.     {
  7405.         show: g,
  7406.         hide: h,
  7407.         getActivePanel: f,
  7408.         changePanelTo: e
  7409.     }
  7410. }
  7411. ,
  7412. EPUBJS.reader.TocController = function(a) {
  7413.     var b = this.book
  7414.       , c = $("#tocView")
  7415.       , d = document.createDocumentFragment()
  7416.       , e = !1
  7417.       , f = function(a, b) {
  7418.         var c = document.createElement("ul");
  7419.         return b || (b = 1),
  7420.         a.forEach(function(a) {
  7421.             var d = document.createElement("li")
  7422.               , e = document.createElement("a");
  7423.             toggle = document.createElement("a");
  7424.             var g;
  7425.             d.id = "toc-" + a.id,
  7426.             d.classList.add("list_item"),
  7427.             e.textContent = a.label,
  7428.             e.href = a.href,
  7429.             e.classList.add("toc_link"),
  7430.             d.appendChild(e),
  7431.             a.subitems.length > 0 && (b++,
  7432.             g = f(a.subitems, b),
  7433.             toggle.classList.add("toc_toggle"),
  7434.             d.insertBefore(toggle, e),
  7435.             d.appendChild(g)),
  7436.             c.appendChild(d)
  7437.         }),
  7438.         c
  7439.     }
  7440.       , g = function() {
  7441.         c.show()
  7442.     }
  7443.       , h = function() {
  7444.         c.hide()
  7445.     }
  7446.       , i = function(a) {
  7447.         var b = a.id
  7448.           , d = c.find("#toc-" + b)
  7449.           , f = c.find(".currentChapter");
  7450.         c.find(".openChapter"),
  7451.         d.length && (d != f && d.has(e).length > 0 && f.removeClass("currentChapter"),
  7452.         d.addClass("currentChapter"),
  7453.         d.parents("li").addClass("openChapter"))
  7454.     };
  7455.     b.on("renderer:chapterDisplayed", i);
  7456.     var j = f(a);
  7457.     return d.appendChild(j),
  7458.     c.append(d),
  7459.     c.find(".toc_link").on("click", function(a) {
  7460.         var d = this.getAttribute("href");
  7461.         a.preventDefault(),
  7462.         b["goto"](d),
  7463.         c.find(".currentChapter").addClass("openChapter").removeClass("currentChapter"),
  7464.         $(this).parent("li").addClass("currentChapter")
  7465.     }),
  7466.     c.find(".toc_toggle").on("click", function(a) {
  7467.         var b = $(this).parent("li")
  7468.           , c = b.hasClass("openChapter");
  7469.         a.preventDefault(),
  7470.         c ? b.removeClass("openChapter") : b.addClass("openChapter")
  7471.     }),
  7472.     {
  7473.         show: g,
  7474.         hide: h
  7475.     }
  7476. }
  7477. ,
  7478. EPUBJS.reader.search = {},
  7479. EPUBJS.reader.search.SERVER = "https://pacific-cliffs-3579.herokuapp.com",
  7480. EPUBJS.reader.search.request = function(a, b) {
  7481.     var c = $.ajax({
  7482.         dataType: "json",
  7483.         url: EPUBJS.reader.search.SERVER + "/search?q=" + encodeURIComponent(a)
  7484.     });
  7485.     c.fail(function(a) {
  7486.         console.error(a)
  7487.     }),
  7488.     c.done(function(a) {
  7489.         b(a)
  7490.     })
  7491. }
  7492. ,
  7493. EPUBJS.reader.plugins.SearchController = function(a) {
  7494.     var b, c = this, d = $("#searchBox"), e = $("#searchResults"), f = $("#searchView"), g = !1, h = function() {
  7495.         j(),
  7496.         g = !0,
  7497.         f.addClass("shown")
  7498.     }, i = function() {
  7499.         g = !1,
  7500.         f.removeClass("shown")
  7501.     }, j = function() {
  7502.         var c = d.val();
  7503.         "" != c && (e.empty(),
  7504.         e.append("<li><p>Searching...</p></li>"),
  7505.         EPUBJS.reader.search.request(c, function(d) {
  7506.             var f = d.results;
  7507.             return e.empty(),
  7508.             b && $(b).find("body").unhighlight(),
  7509.             0 == f.length ? void e.append("<li><p>No Results Found</p></li>") : (b = $("#viewer iframe")[0].contentDocument,
  7510.             $(b).find("body").highlight(c, {
  7511.                 element: "span"
  7512.             }),
  7513.             void f.forEach(function(d) {
  7514.                 var f = $("<li></li>")
  7515.                   , g = $("<a href='" + d.href + "' data-cfi='" + d.cfi + "'><span>" + d.title + "</span><p>" + d.highlight + "</p></a>");
  7516.                 g.on("click", function(d) {
  7517.                     var e = $(this)
  7518.                       , f = e.data("cfi");
  7519.                     d.preventDefault(),
  7520.                     a.gotoCfi(f + "/1:0"),
  7521.                     a.on("renderer:chapterDisplayed", function() {
  7522.                         b = $("#viewer iframe")[0].contentDocument,
  7523.                         $(b).find("body").highlight(c, {
  7524.                             element: "span"
  7525.                         })
  7526.                     })
  7527.                 }),
  7528.                 f.append(g),
  7529.                 e.append(f)
  7530.             }))
  7531.         }))
  7532.     };
  7533.     return d.on("search", function(a) {
  7534.         var f = d.val();
  7535.         return "" == f ? (e.empty(),
  7536.         "Search" == c.SidebarController.getActivePanel() && c.SidebarController.changePanelTo("Toc"),
  7537.         $(b).find("body").unhighlight(),
  7538.         void (b = !1)) : (c.SidebarController.changePanelTo("Search"),
  7539.         void a.preventDefault())
  7540.     }),
  7541.     {
  7542.         show: h,
  7543.         hide: i
  7544.     }
  7545. }
  7546. ,
  7547. jQuery.extend({
  7548.     highlight: function(a, b, c, d) {
  7549.         if (3 === a.nodeType) {
  7550.             var e = a.data.match(b);
  7551.             if (e) {
  7552.                 var f = document.createElement(c || "span");
  7553.                 f.className = d || "highlight";
  7554.                 var g = a.splitText(e.index);
  7555.                 g.splitText(e[0].length);
  7556.                 var h = g.cloneNode(!0);
  7557.                 return f.appendChild(h),
  7558.                 g.parentNode.replaceChild(f, g),
  7559.                 1
  7560.             }
  7561.         } else if (1 === a.nodeType && a.childNodes && !/(script|style)/i.test(a.tagName) && (a.tagName !== c.toUpperCase() || a.className !== d))
  7562.             for (var i = 0; i < a.childNodes.length; i++)
  7563.                 i += jQuery.highlight(a.childNodes[i], b, c, d);
  7564.         return 0
  7565.     }
  7566. }),
  7567. jQuery.fn.unhighlight = function(a) {
  7568.     var b = {
  7569.         className: "highlight",
  7570.         element: "span"
  7571.     };
  7572.     return jQuery.extend(b, a),
  7573.     this.find(b.element + "." + b.className).each(function() {
  7574.         var a = this.parentNode;
  7575.         a.replaceChild(this.firstChild, this),
  7576.         a.normalize()
  7577.     }).end()
  7578. }
  7579. ,
  7580. jQuery.fn.highlight = function(a, b) {
  7581.     var c = {
  7582.         className: "highlight",
  7583.         element: "span",
  7584.         caseSensitive: !1,
  7585.         wordsOnly: !1
  7586.     };
  7587.     if (jQuery.extend(c, b),
  7588.     a.constructor === String && (a = [a]),
  7589.     a = jQuery.grep(a, function(a, b) {
  7590.         return "" != a
  7591.     }),
  7592.     a = jQuery.map(a, function(a, b) {
  7593.         return a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&")
  7594.     }),
  7595.     0 == a.length)
  7596.         return this;
  7597.     var d = c.caseSensitive ? "" : "i"
  7598.       , e = "(" + a.join("|") + ")";
  7599.     c.wordsOnly && (e = "\\b" + e + "\\b");
  7600.     var f = new RegExp(e,d);
  7601.     return this.each(function() {
  7602.         jQuery.highlight(this, f, c.element, c.className)
  7603.     })
  7604. }
  7605. ,
  7606. EPUBJS.Hooks.register("beforeChapterDisplay").highlight = function(a, b) {
  7607.     var c = document.createElement("style");
  7608.     c.innerHTML = ".highlight { background: yellow; font-weight: normal; }",
  7609.     b.render.document.head.appendChild(c),
  7610.     a && a()
  7611. }
  7612. ,
  7613. !function(a, b) {
  7614.     "use strict";
  7615.     var c = "undefined" != typeof Element && "ALLOW_KEYBOARD_INPUT"in Element
  7616.       , d = function() {
  7617.         for (var a, c, d = [["requestFullscreen", "exitFullscreen", "fullscreenElement", "fullscreenEnabled", "fullscreenchange", "fullscreenerror"], ["webkitRequestFullscreen", "webkitExitFullscreen", "webkitFullscreenElement", "webkitFullscreenEnabled", "webkitfullscreenchange", "webkitfullscreenerror"], ["webkitRequestFullScreen", "webkitCancelFullScreen", "webkitCurrentFullScreenElement", "webkitCancelFullScreen", "webkitfullscreenchange", "webkitfullscreenerror"], ["mozRequestFullScreen", "mozCancelFullScreen", "mozFullScreenElement", "mozFullScreenEnabled", "mozfullscreenchange", "mozfullscreenerror"], ["msRequestFullscreen", "msExitFullscreen", "msFullscreenElement", "msFullscreenEnabled", "MSFullscreenchange", "MSFullscreenerror"]], e = 0, f = d.length, g = {}; f > e; e++)
  7618.             if (a = d[e],
  7619.             a && a[1]in b) {
  7620.                 for (e = 0,
  7621.                 c = a.length; c > e; e++)
  7622.                     g[d[0][e]] = a[e];
  7623.                 return g
  7624.             }
  7625.         return !1
  7626.     }()
  7627.       , e = {
  7628.         request: function(a) {
  7629.             var e = d.requestFullscreen;
  7630.             a = a || b.documentElement,
  7631.             /5\.1[\.\d]* Safari/.test(navigator.userAgent) ? a[e]() : a[e](c && Element.ALLOW_KEYBOARD_INPUT)
  7632.         },
  7633.         exit: function() {
  7634.             b[d.exitFullscreen]()
  7635.         },
  7636.         toggle: function(a) {
  7637.             this.isFullscreen ? this.exit() : this.request(a)
  7638.         },
  7639.         onchange: function() {},
  7640.         onerror: function() {},
  7641.         raw: d
  7642.     };
  7643.     return d ? (Object.defineProperties(e, {
  7644.         isFullscreen: {
  7645.             get: function() {
  7646.                 return !!b[d.fullscreenElement]
  7647.             }
  7648.         },
  7649.         element: {
  7650.             enumerable: !0,
  7651.             get: function() {
  7652.                 return b[d.fullscreenElement]
  7653.             }
  7654.         },
  7655.         enabled: {
  7656.             enumerable: !0,
  7657.             get: function() {
  7658.                 return !!b[d.fullscreenEnabled]
  7659.             }
  7660.         }
  7661.     }),
  7662.     b.addEventListener(d.fullscreenchange, function(a) {
  7663.         e.onchange.call(e, a)
  7664.     }),
  7665.     b.addEventListener(d.fullscreenerror, function(a) {
  7666.         e.onerror.call(e, a)
  7667.     }),
  7668.     void (a.screenfull = e)) : void (a.screenfull = !1)
  7669. }(window, document),
  7670. function(a, b) {
  7671.     "function" == typeof define && define.amd ? define([], b) : "object" == typeof exports ? module.exports = b() : a.X2JS = b()
  7672. }(this, function() {
  7673.     return function(a) {
  7674.         "use strict";
  7675.         function b() {
  7676.             void 0 === a.escapeMode && (a.escapeMode = !0),
  7677.             a.attributePrefix = a.attributePrefix || "_",
  7678.             a.arrayAccessForm = a.arrayAccessForm || "none",
  7679.             a.emptyNodeForm = a.emptyNodeForm || "text",
  7680.             void 0 === a.enableToStringFunc && (a.enableToStringFunc = !0),
  7681.             a.arrayAccessFormPaths = a.arrayAccessFormPaths || [],
  7682.             void 0 === a.skipEmptyTextNodesForObj && (a.skipEmptyTextNodesForObj = !0),
  7683.             void 0 === a.stripWhitespaces && (a.stripWhitespaces = !0),
  7684.             a.datetimeAccessFormPaths = a.datetimeAccessFormPaths || [],
  7685.             void 0 === a.useDoubleQuotes && (a.useDoubleQuotes = !1),
  7686.             a.xmlElementsFilter = a.xmlElementsFilter || [],
  7687.             a.jsonPropertiesFilter = a.jsonPropertiesFilter || [],
  7688.             void 0 === a.keepCData && (a.keepCData = !1)
  7689.         }
  7690.         function c() {}
  7691.         function d(a) {
  7692.             var b = a.localName;
  7693.             return null == b && (b = a.baseName),
  7694.             null != b && "" != b || (b = a.nodeName),
  7695.             b
  7696.         }
  7697.         function e(a) {
  7698.             return a.prefix
  7699.         }
  7700.         function f(a) {
  7701.             return "string" == typeof a ? a.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;") : a
  7702.         }
  7703.         function g(a, b, c, d) {
  7704.             for (var e = 0; e < a.length; e++) {
  7705.                 var f = a[e];
  7706.                 if ("string" == typeof f) {
  7707.                     if (f == d)
  7708.                         break
  7709.                 } else if (f instanceof RegExp) {
  7710.                     if (f.test(d))
  7711.                         break
  7712.                 } else if ("function" == typeof f && f(b, c, d))
  7713.                     break
  7714.             }
  7715.             return e != a.length
  7716.         }
  7717.         function h(b, c, d) {
  7718.             switch (a.arrayAccessForm) {
  7719.             case "property":
  7720.                 b[c]instanceof Array ? b[c + "_asArray"] = b[c] : b[c + "_asArray"] = [b[c]]
  7721.             }
  7722.             !(b[c]instanceof Array) && a.arrayAccessFormPaths.length > 0 && g(a.arrayAccessFormPaths, b, c, d) && (b[c] = [b[c]])
  7723.         }
  7724.         function i(a) {
  7725.             var b = a.split(/[-T:+Z]/g)
  7726.               , c = new Date(b[0],b[1] - 1,b[2])
  7727.               , d = b[5].split(".");
  7728.             if (c.setHours(b[3], b[4], d[0]),
  7729.             d.length > 1 && c.setMilliseconds(d[1]),
  7730.             b[6] && b[7]) {
  7731.                 var e = 60 * b[6] + Number(b[7])
  7732.                   , f = /\d\d-\d\d:\d\d$/.test(a) ? "-" : "+";
  7733.                 e = 0 + ("-" == f ? -1 * e : e),
  7734.                 c.setMinutes(c.getMinutes() - e - c.getTimezoneOffset())
  7735.             } else
  7736.                 a.indexOf("Z", a.length - 1) !== -1 && (c = new Date(Date.UTC(c.getFullYear(), c.getMonth(), c.getDate(), c.getHours(), c.getMinutes(), c.getSeconds(), c.getMilliseconds())));
  7737.             return c
  7738.         }
  7739.         function j(b, c, d) {
  7740.             if (a.datetimeAccessFormPaths.length > 0) {
  7741.                 var e = d.split(".#")[0];
  7742.                 return g(a.datetimeAccessFormPaths, b, c, e) ? i(b) : b
  7743.             }
  7744.             return b
  7745.         }
  7746.         function k(b, c, d, e) {
  7747.             return !(c == z.ELEMENT_NODE && a.xmlElementsFilter.length > 0) || g(a.xmlElementsFilter, b, d, e)
  7748.         }
  7749.         function l(b, c) {
  7750.             if (b.nodeType == z.DOCUMENT_NODE) {
  7751.                 for (var f = new Object, g = b.childNodes, i = 0; i < g.length; i++) {
  7752.                     var m = g.item(i);
  7753.                     if (m.nodeType == z.ELEMENT_NODE) {
  7754.                         var n = d(m);
  7755.                         f[n] = l(m, n)
  7756.                     }
  7757.                 }
  7758.                 return f
  7759.             }
  7760.             if (b.nodeType == z.ELEMENT_NODE) {
  7761.                 var f = new Object;
  7762.                 f.__cnt = 0;
  7763.                 for (var g = b.childNodes, i = 0; i < g.length; i++) {
  7764.                     var m = g.item(i)
  7765.                       , n = d(m);
  7766.                     if (m.nodeType != z.COMMENT_NODE) {
  7767.                         var o = c + "." + n;
  7768.                         k(f, m.nodeType, n, o) && (f.__cnt++,
  7769.                         null == f[n] ? (f[n] = l(m, o),
  7770.                         h(f, n, o)) : (null != f[n] && (f[n]instanceof Array || (f[n] = [f[n]],
  7771.                         h(f, n, o))),
  7772.                         f[n][f[n].length] = l(m, o)))
  7773.                     }
  7774.                 }
  7775.                 for (var p = 0; p < b.attributes.length; p++) {
  7776.                     var q = b.attributes.item(p);
  7777.                     f.__cnt++,
  7778.                     f[a.attributePrefix + q.name] = q.value
  7779.                 }
  7780.                 var r = e(b);
  7781.                 return null != r && "" != r && (f.__cnt++,
  7782.                 f.__prefix = r),
  7783.                 null != f["#text"] && (f.__text = f["#text"],
  7784.                 f.__text instanceof Array && (f.__text = f.__text.join("\n")),
  7785.                 a.stripWhitespaces && (f.__text = f.__text.trim()),
  7786.                 delete f["#text"],
  7787.                 "property" == a.arrayAccessForm && delete f["#text_asArray"],
  7788.                 f.__text = j(f.__text, n, c + "." + n)),
  7789.                 null != f["#cdata-section"] && (f.__cdata = f["#cdata-section"],
  7790.                 delete f["#cdata-section"],
  7791.                 "property" == a.arrayAccessForm && delete f["#cdata-section_asArray"]),
  7792.                 0 == f.__cnt && "text" == a.emptyNodeForm ? f = "" : 1 == f.__cnt && null != f.__text ? f = f.__text : 1 != f.__cnt || null == f.__cdata || a.keepCData ? f.__cnt > 1 && null != f.__text && a.skipEmptyTextNodesForObj && (a.stripWhitespaces && "" == f.__text || "" == f.__text.trim()) && delete f.__text : f = f.__cdata,
  7793.                 delete f.__cnt,
  7794.                 !a.enableToStringFunc || null == f.__text && null == f.__cdata || (f.toString = function() {
  7795.                     return (null != this.__text ? this.__text : "") + (null != this.__cdata ? this.__cdata : "")
  7796.                 }
  7797.                 ),
  7798.                 f
  7799.             }
  7800.             if (b.nodeType == z.TEXT_NODE || b.nodeType == z.CDATA_SECTION_NODE)
  7801.                 return b.nodeValue
  7802.         }
  7803.         function m(b, c, d, e) {
  7804.             var g = "<" + (null != b && null != b.__prefix ? b.__prefix + ":" : "") + c;
  7805.             if (null != d)
  7806.                 for (var h = 0; h < d.length; h++) {
  7807.                     var i = d[h]
  7808.                       , j = b[i];
  7809.                     a.escapeMode && (j = f(j)),
  7810.                     g += " " + i.substr(a.attributePrefix.length) + "=",
  7811.                     g += a.useDoubleQuotes ? '"' + j + '"' : "'" + j + "'"
  7812.                 }
  7813.             return g += e ? "/>" : ">"
  7814.         }
  7815.         function n(a, b) {
  7816.             return "</" + (null != a.__prefix ? a.__prefix + ":" : "") + b + ">"
  7817.         }
  7818.         function o(a, b) {
  7819.             return a.indexOf(b, a.length - b.length) !== -1
  7820.         }
  7821.         function p(b, c) {
  7822.             return !!("property" == a.arrayAccessForm && o(c.toString(), "_asArray") || 0 == c.toString().indexOf(a.attributePrefix) || 0 == c.toString().indexOf("__") || b[c]instanceof Function)
  7823.         }
  7824.         function q(a) {
  7825.             var b = 0;
  7826.             if (a instanceof Object)
  7827.                 for (var c in a)
  7828.                     p(a, c) || b++;
  7829.             return b
  7830.         }
  7831.         function r(b, c, d) {
  7832.             return 0 == a.jsonPropertiesFilter.length || "" == d || g(a.jsonPropertiesFilter, b, c, d)
  7833.         }
  7834.         function s(b) {
  7835.             var c = [];
  7836.             if (b instanceof Object)
  7837.                 for (var d in b)
  7838.                     d.toString().indexOf("__") == -1 && 0 == d.toString().indexOf(a.attributePrefix) && c.push(d);
  7839.             return c
  7840.         }
  7841.         function t(b) {
  7842.             var c = "";
  7843.             return null != b.__cdata && (c += "<![CDATA[" + b.__cdata + "]]>"),
  7844.             null != b.__text && (c += a.escapeMode ? f(b.__text) : b.__text),
  7845.             c
  7846.         }
  7847.         function u(b) {
  7848.             var c = "";
  7849.             return b instanceof Object ? c += t(b) : null != b && (c += a.escapeMode ? f(b) : b),
  7850.             c
  7851.         }
  7852.         function v(a, b) {
  7853.             return "" === a ? b : a + "." + b
  7854.         }
  7855.         function w(a, b, c, d) {
  7856.             var e = "";
  7857.             if (0 == a.length)
  7858.                 e += m(a, b, c, !0);
  7859.             else
  7860.                 for (var f = 0; f < a.length; f++)
  7861.                     e += m(a[f], b, s(a[f]), !1),
  7862.                     e += x(a[f], v(d, b)),
  7863.                     e += n(a[f], b);
  7864.             return e
  7865.         }
  7866.         function x(a, b) {
  7867.             var c = ""
  7868.               , d = q(a);
  7869.             if (d > 0)
  7870.                 for (var e in a)
  7871.                     if (!p(a, e) && ("" == b || r(a, e, v(b, e)))) {
  7872.                         var f = a[e]
  7873.                           , g = s(f);
  7874.                         if (null == f || void 0 == f)
  7875.                             c += m(f, e, g, !0);
  7876.                         else if (f instanceof Object)
  7877.                             if (f instanceof Array)
  7878.                                 c += w(f, e, g, b);
  7879.                             else if (f instanceof Date)
  7880.                                 c += m(f, e, g, !1),
  7881.                                 c += f.toISOString(),
  7882.                                 c += n(f, e);
  7883.                             else {
  7884.                                 var h = q(f);
  7885.                                 h > 0 || null != f.__text || null != f.__cdata ? (c += m(f, e, g, !1),
  7886.                                 c += x(f, v(b, e)),
  7887.                                 c += n(f, e)) : c += m(f, e, g, !0)
  7888.                             }
  7889.                         else
  7890.                             c += m(f, e, g, !1),
  7891.                             c += u(f),
  7892.                             c += n(f, e)
  7893.                     }
  7894.             return c += u(a)
  7895.         }
  7896.         var y = "1.2.0";
  7897.         a = a || {},
  7898.         b(),
  7899.         c();
  7900.         var z = {
  7901.             ELEMENT_NODE: 1,
  7902.             TEXT_NODE: 3,
  7903.             CDATA_SECTION_NODE: 4,
  7904.             COMMENT_NODE: 8,
  7905.             DOCUMENT_NODE: 9
  7906.         };
  7907.         this.parseXmlString = function(a) {
  7908.             var b = window.ActiveXObject || "ActiveXObject"in window;
  7909.             if (void 0 === a)
  7910.                 return null;
  7911.             var c;
  7912.             if (window.DOMParser) {
  7913.                 var d = new window.DOMParser
  7914.                   , e = null;
  7915.                 if (!b)
  7916.                     try {
  7917.                         e = d.parseFromString("INVALID", "text/xml").getElementsByTagName("parsererror")[0].namespaceURI
  7918.                     } catch (f) {
  7919.                         e = null
  7920.                     }
  7921.                 try {
  7922.                     c = d.parseFromString(a, "text/xml"),
  7923.                     null != e && c.getElementsByTagNameNS(e, "parsererror").length > 0 && (c = null)
  7924.                 } catch (f) {
  7925.                     c = null
  7926.                 }
  7927.             } else
  7928.                 0 == a.indexOf("<?") && (a = a.substr(a.indexOf("?>") + 2)),
  7929.                 c = new ActiveXObject("Microsoft.XMLDOM"),
  7930.                 c.async = "false",
  7931.                 c.loadXML(a);
  7932.             return c
  7933.         }
  7934.         ,
  7935.         this.asArray = function(a) {
  7936.             return void 0 === a || null == a ? [] : a instanceof Array ? a : [a]
  7937.         }
  7938.         ,
  7939.         this.toXmlDateTime = function(a) {
  7940.             return a instanceof Date ? a.toISOString() : "number" == typeof a ? new Date(a).toISOString() : null
  7941.         }
  7942.         ,
  7943.         this.asDateTime = function(a) {
  7944.             return "string" == typeof a ? i(a) : a
  7945.         }
  7946.         ,
  7947.         this.xml2json = function(a) {
  7948.             return l(a)
  7949.         }
  7950.         ,
  7951.         this.xml_str2json = function(a) {
  7952.             var b = this.parseXmlString(a);
  7953.             return null != b ? this.xml2json(b) : null
  7954.         }
  7955.         ,
  7956.         this.json2xml_str = function(a) {
  7957.             return x(a, "")
  7958.         }
  7959.         ,
  7960.         this.json2xml = function(a) {
  7961.             var b = this.json2xml_str(a);
  7962.             return this.parseXmlString(b)
  7963.         }
  7964.         ,
  7965.         this.getVersion = function() {
  7966.             return y
  7967.         }
  7968.     }
  7969. });
  7970. var x2js = new X2JS
  7971.   , RDP_EPUB = {};
  7972. RDP_EPUB.timer = function() {
  7973.     var a, b, c, d, e;
  7974.     return c = {},
  7975.     e = {},
  7976.     a = function(a) {
  7977.         return null == e[a] && (e[a] = (new Date).getTime()),
  7978.         null == c[a] && (c[a] = (new Date).getTime()),
  7979.         e[a] - c[a]
  7980.     }
  7981.     ,
  7982.     b = function(a) {
  7983.         return c[a] = (new Date).getTime(),
  7984.         e[a] = null
  7985.     }
  7986.     ,
  7987.     d = function(a) {
  7988.         if (null == e[a] && (e[a] = (new Date).getTime()),
  7989.         null == c[a])
  7990.             return c[a] = e[a]
  7991.     }
  7992.     ,
  7993.     {
  7994.         start: b,
  7995.         stop: d,
  7996.         getTime: a
  7997.     }
  7998. }();
  7999. var userConfig = JSON.parse(localStorage.getItem("rdp-reader-bv3"));
  8000. init(),
  8001. $(document).ready(function() {
  8002.     setConfig(),
  8003.     "#fff" == RDP_EPUB.config.background ? ($(".set-white-font").addClass("active"),
  8004.     $(".page-nav-btn").css("background-color", "#C7C7C7")) : "#242424" == RDP_EPUB.config.background ? ($(".set-black-font").addClass("active"),
  8005.     $(".page-nav-btn").css("background-color", "#353535")) : "#B9AE9A" == RDP_EPUB.config.background && ($(".set-sepia-font").addClass("active"),
  8006.     $(".page-nav-btn").css("background-color", "#9A9283")),
  8007.     "Arial" == RDP_EPUB.config.fontFamily ? $(".set-arial-font").addClass("font-active") : "Courier New" == RDP_EPUB.config.fontFamily ? $(".set-courier-new-font").addClass("font-active") : "Helvetica" == RDP_EPUB.config.fontFamily ? $(".set-helvetica-font").addClass("font-active") : "Times New Roman" == RDP_EPUB.config.fontFamily && $(".set-times-new-roman-font").addClass("font-active"),
  8008.     $("body").on("click", ".decrease-font", function() {
  8009.         RDP_EPUB.config.fontSize = RDP_EPUB.config.fontSize - 1,
  8010.         setConfig()
  8011.     }),
  8012.     $("body").on("click", ".increase-font", function() {
  8013.         RDP_EPUB.config.fontSize = RDP_EPUB.config.fontSize + 1,
  8014.         setConfig()
  8015.     }),
  8016.     $("body").on("click", ".set-black-font", function() {
  8017.         RDP_EPUB.config.background = "#242424",
  8018.         RDP_EPUB.config.color = "#fff",
  8019.         $(this).addClass("active"),
  8020.         $(".set-white-font, .set-sepia-font").removeClass("active"),
  8021.         $(".page-nav-btn").css("background-color", "#353535"),
  8022.         setConfig()
  8023.     }),
  8024.     $("body").on("click", ".set-white-font", function() {
  8025.         RDP_EPUB.config.background = "#fff",
  8026.         RDP_EPUB.config.color = "#000",
  8027.         $(this).addClass("active"),
  8028.         $(".set-black-font, .set-sepia-font").removeClass("active"),
  8029.         $(".page-nav-btn").css("background-color", "#C7C7C7"),
  8030.         setConfig()
  8031.     }),
  8032.     $("body").on("click", ".set-sepia-font", function() {
  8033.         RDP_EPUB.config.background = "#B9AE9A",
  8034.         RDP_EPUB.config.color = "#333332",
  8035.         $(this).addClass("active"),
  8036.         $(".set-black-font, .set-white-font").removeClass("active"),
  8037.         $(".page-nav-btn").css("background-color", "#9A9283"),
  8038.         setConfig()
  8039.     }),
  8040.     $("body").on("click", ".set-arial-font", function() {
  8041.         $(this).addClass("font-active"),
  8042.         $(".set-helvetica-font, .set-times-new-roman-font, .set-courier-new-font").removeClass("font-active"),
  8043.         RDP_EPUB.config.fontFamily = "Arial",
  8044.         setConfig()
  8045.     }),
  8046.     $("body").on("click", ".set-helvetica-font", function() {
  8047.         $(".set-arial-font, .set-times-new-roman-font, .set-courier-new-font").removeClass("font-active"),
  8048.         $(this).addClass("font-active"),
  8049.         RDP_EPUB.config.fontFamily = "Helvetica",
  8050.         setConfig()
  8051.     }),
  8052.     $("body").on("click", ".set-times-new-roman-font", function() {
  8053.         $(".set-helvetica-font, .set-arial-font, .set-courier-new-font").removeClass("font-active"),
  8054.         $(this).addClass("font-active"),
  8055.         RDP_EPUB.config.fontFamily = "Times New Roman",
  8056.         setConfig()
  8057.     }),
  8058.     $("body").on("click", ".set-courier-new-font", function() {
  8059.         $(".set-helvetica-font, .set-times-new-roman-font, .set-arial-font").removeClass("font-active"),
  8060.         $(this).addClass("font-active"),
  8061.         RDP_EPUB.config.fontFamily = "Courier New",
  8062.         setConfig()
  8063.     }),
  8064.     $("body").on("click", ".open-config", function() {
  8065.         $(".config-overlay").fadeIn()
  8066.     }),
  8067.     $("body").on("click", ".config-close-area, .modal-close", function() {
  8068.         $(".config-overlay").fadeOut()
  8069.     }),
  8070.     $("body").on("click", ".open-epub-summary", function() {
  8071.         $("#tocView").show()
  8072.     }),
  8073.     $("body").on("click", ".summary-back", function() {
  8074.         $("#tocView").hide()
  8075.     })
  8076. });
Add Comment
Please, Sign In to add comment