/*!
* Box Content Preview
*
* Copyright 2017 Box, Inc. All rights reserved.
*
* This product includes software developed by Box, Inc. ("Box")
* (http://www.box.com)
*
* ALL BOX SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL BOX BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* See the Box license for the specific language governing permissions
* and limitations under the license.
*/
!function(e){function t(i){if(n[i])return n[i].exports;var r=n[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,i){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:i})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=104)}([,function(e,t,n){"use strict";n.d(t,"H",function(){return i}),n.d(t,"A",function(){return r}),n.d(t,"I",function(){return o}),n.d(t,"d",function(){return a}),n.d(t,"e",function(){return s}),n.d(t,"f",function(){return l}),n.d(t,"g",function(){return c}),n.d(t,"c",function(){return u}),n.d(t,"h",function(){return h}),n.d(t,"i",function(){return d}),n.d(t,"j",function(){return p}),n.d(t,"k",function(){return f}),n.d(t,"l",function(){return v}),n.d(t,"m",function(){return g}),n.d(t,"n",function(){return m}),n.d(t,"o",function(){return b}),n.d(t,"p",function(){return y}),n.d(t,"q",function(){return E}),n.d(t,"r",function(){return w}),n.d(t,"s",function(){return _}),n.d(t,"u",function(){return k}),n.d(t,"t",function(){return O}),n.d(t,"x",function(){return C}),n.d(t,"y",function(){return S}),n.d(t,"z",function(){return P}),n.d(t,"B",function(){return x}),n.d(t,"F",function(){return L}),n.d(t,"G",function(){return T}),n.d(t,"D",function(){return j}),n.d(t,"E",function(){return A}),n.d(t,"C",function(){return H}),n.d(t,"w",function(){return R}),n.d(t,"v",function(){return M}),n.d(t,"J",function(){return D}),n.d(t,"_3",function(){return B}),n.d(t,"X",function(){return I}),n.d(t,"_4",function(){return N}),n.d(t,"_10",function(){return V}),n.d(t,"_11",function(){return F}),n.d(t,"Z",function(){return z}),n.d(t,"Y",function(){return U}),n.d(t,"_2",function(){return q}),n.d(t,"_0",function(){return W}),n.d(t,"_1",function(){return G}),n.d(t,"_5",function(){return X}),n.d(t,"_6",function(){return Y}),n.d(t,"_7",function(){return Z}),n.d(t,"_8",function(){return K}),n.d(t,"_9",function(){return J}),n.d(t,"T",function(){return Q}),n.d(t,"U",function(){return $}),n.d(t,"a",function(){return ee}),n.d(t,"b",function(){return te}),n.d(t,"O",function(){return ne}),n.d(t,"V",function(){return ie}),n.d(t,"_12",function(){return re}),n.d(t,"_13",function(){return oe}),n.d(t,"_16",function(){return ae}),n.d(t,"_17",function(){return se}),n.d(t,"_18",function(){return le}),n.d(t,"_19",function(){return ce}),n.d(t,"_20",function(){return ue}),n.d(t,"P",function(){return he}),n.d(t,"R",function(){return de}),n.d(t,"S",function(){return pe}),n.d(t,"Q",function(){return fe}),n.d(t,"K",function(){return ve}),n.d(t,"M",function(){return ge}),n.d(t,"N",function(){return me}),n.d(t,"_14",function(){return be}),n.d(t,"_15",function(){return ye}),n.d(t,"L",function(){return Ee}),n.d(t,"W",function(){return we});var i="bp-is-navigation-visible",r="bp-is-hidden",o="bp-loaded",a="bp-btn",s="bp-find-bar",l="bp-has-header",c="bp-header",u="bp-base-header",h="bp-link",d="bp-menu",p="bp-is-mobile",f="bp-overlay",v="bp-overlay-wrapper",g="bp-preload",m="bp-preload-content",b="bp-preload-overlay",y="bp-document-preload-wrapper",E="bp-presentation-preload-wrapper",w="bp-progress-bar",_="bp-progress-bar-container",k="bp-toggle-overlay",O="bp-theme-dark",C="bp-has-keyboard-focus",S="bp-is-fullscreen",P="bp-fullscreen-unsupported",x="bp-is-invisible",L="bp-is-transparent",T="bp-is-visible",j="bp-is-scrollable",A="bp-is-selectable",H="bp-is-buffering",R="bp-dark",M="bp-crawler",D="bp-spinner",B=".bp-container",I=".bp",N=".bp-crawler-wrapper",V=".bp-navigate-left",F=".bp-navigate-right",z=".bp-btn-annotate-point",U=".bp-btn-annotate-draw",q=".bp-btn-print",W=".bp-btn-download",G=".bp-btn-loading-download",X=".bp-icon",Y=".bp-loading-text",Z=".bp-loading-wrapper",K=".bp-custom-logo",J=".bp-default-logo",Q="can_download",$="can_preview",ee="https://api.box.com",te="https://app.box.com",ne="ORIGINAL",ie="jpg",re="success",oe="viewable",ae="[3d][pdf][text][mp3]",se="[jpg?dimensions=1024x1024&paged=false]",le="[jpg?dimensions=2048x2048,png?dimensions=2048x2048]",ce="[dash,mp4][filmstrip]",ue="[mp4]",he=96/72,de=1.25,pe=40,fe=5,ve="1.17.0",ge="1.8.0",me="1.12.0",be="0.112.0",ye="0.114.0",Ee={numbers:"We're sorry, iWork files are not currently supported.",pages:"We're sorry, iWork files are not currently supported.",key:"We're sorry, iWork files are not currently supported."},we="preview.js"},function(e,t,n){"use strict";function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e){if(e.status>=200&&e.status<300)return e;var t=new Error(e.statusText);throw t.response=e,t}function o(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return fetch(t,{headers:n,method:e,body:JSON.stringify(i)}).then(r).then(U)}function a(){var e=document.querySelector("#downloadiframe");return e||(e=document.createElement("iframe"),e.setAttribute("id","downloadiframe"),e.style.display="none",e=document.body.appendChild(e)),e.contentDocument.write("
"),e}function s(e){var t=void 0,n=void 0;"string"==typeof(arguments.length<=1?void 0:arguments[1])?n=arguments.length<=1?void 0:arguments[1]:(t=arguments.length<=1?void 0:arguments[1],n=arguments.length<=2?void 0:arguments[2]),t=t||{},n=n||"json";var i=void 0;switch(n){case"text":i=q;break;case"blob":i=W;break;case"any":i=G;break;case"json":default:i=U}return fetch(e,{headers:t}).then(r).then(i)}function l(){for(var e=arguments.length,t=Array(e),n=0;n \s*<"))}function d(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;e.insertBefore(h(e,t),n)}function p(e){var t=document.createElement("script");return t.src=e,t.async=!1,t}function f(e){var t=document.createElement("link");return t.rel="prefetch",t.href=e,t}function v(e){var t=document.createElement("link");return t.rel="stylesheet",t.type="text/css",t.href=e,t}function g(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";return t&&(e.Authorization="Bearer "+t),n&&(e.BoxApi="shared_link="+n,i&&(e.BoxApi=e.BoxApi+"&shared_link_password="+i)),F&&(e[B]=F),z&&(e[I]=z),e}function m(e,t){if(!t)return e;var n=new M.a(e);return Object.keys(t).forEach(function(e){var i=t[e];i&&(n.hasQueryParam(e)?n.replaceQueryParam(e,i):n.addQueryParam(e,i))}),n.toString()}function b(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";return n||r?m(e,(t={access_token:n,shared_link:r,shared_link_password:o},i(t,N,F),i(t,V,z),t)):e}function y(e,t){return e.replace("{+asset_path}",t||"")}function E(e){var t=e.baseURI,n=e.staticBaseURI;return function(e){return 0===e.indexOf("http")?e:0===e.indexOf("third-party")?n+e:t+e}}function w(e){var t=document,n=t.head;e.forEach(function(e){n.querySelector('link[rel="prefetch"][href="'+e+'"]')||n.appendChild(f(e))})}function _(e){var t=document,n=t.head;e.forEach(function(e){n.querySelector('link[rel="stylesheet"][href="'+e+'"]')||n.appendChild(v(e))})}function k(e){var t=document,n=t.head,i=[];return e.forEach(function(e){if(!n.querySelector('script[src="'+e+'"]')){var t=p(e);i.push(new Promise(function(e,n){t.addEventListener("load",e),t.addEventListener("error",n)})),n.appendChild(t)}}),Promise.all(i)}function O(e){var t="",n=e.key||e.keyIdentifier||"";return e.ctrlKey?t="Control":e.shiftKey?t="Shift":e.metaKey&&(t="Meta"),n===t&&(n=""),0===n.indexOf("U+")&&(n="U+001B"===n?"Escape":String.fromCharCode(n.replace("U+","0x"))),n?(" "===n&&(n="Space"),"Esc"===n&&(n="Escape"),"Right"!==n&&"Left"!==n&&"Down"!==n&&"Up"!==n||(n="Arrow"+n),t&&(t+="+"),t+n):""}function C(e,t){var n=document.querySelector('script[src*="/'+e+'"]')||{},i=t?t.src:n.src;if(!i||-1===i.indexOf(e)&&-1===i.indexOf("__tests__"))throw new Error("Missing or malformed "+e+" library");var r=document.createElement("a");r.href=i;var o=r.pathname,a=o.split("/"),s=a.length,l=a[s-1],c=a[s-2],u=a[s-3],h=r.search,d=r.href.replace(l,"").replace(h,""),p=d.replace(u+"/"+c+"/","");return{origin:r.origin,host:r.host,hostname:r.hostname,search:h,protocol:r.protocol,port:r.port,href:r.href,pathname:o,locale:c,version:u,baseURI:d,staticBaseURI:p}}function S(e,t){var n=/\{\d+\}/g;return e&&e.length?e.replace(n,function(e){var n=parseInt(e.replace(/^\D+/g,""),10)-1;return t[n]?t[n]:e}):e}function P(e){return e.name.slice(0,e.name.lastIndexOf(".")).endsWith(".360")}function x(e){return/.*\.(vera\..*|vera)\.html/i.test(e.name)}function L(e,t,n){e.style.width=t+"px",e.style.height=n+"px"}function T(e){return function(t){if("click"===t.type)e(t);else if("keydown"===t.type){var n=O(t);"Space"!==n&&"Enter"!==n||(e(t),t.preventDefault(),t.stopPropagation())}}}function j(e,t){e.addEventListener("click",t),e.addEventListener("keydown",t)}function A(e,t){e.removeEventListener("click",t),e.removeEventListener("keydown",t)}function H(e,t,n,i){var r=e,o=i.scrollTop,a=i.scrollTop+i.offsetHeight,s=n.offsetTop+n.clientHeight/2;return o>t?r=o>s?e+1:e:o=r.top&&i<=r.bottom&&n>=r.left&&n<=r.right}function f(e,t){var n=document.createRange();return n.selectNode(e),n.createContextualFragment(t.replace(/>\s*<"))}function v(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;e.insertBefore(f(e,t),n)}function g(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",r=document.createElement("button");return e.forEach(function(e){return r.classList.add(e)}),r.title=t,r.innerHTML=n,r.setAttribute("data-type",i),r}function m(e){var t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=window.innerHeight&&t.right<=window.innerWidth}function b(e,t,n,i){if(""!==e)return(' ').trim();var r="";return"0"!==t&&(r=n.replace(/\W*(\w)\w*/g,"$1").toUpperCase().substring(0,3)),(''+r+"
").trim()}function y(e){return parseFloat(e.getAttribute("data-scale"))||1}function E(e){return e[Object.keys(e)[0]]}function w(e){var t=Object.keys(e).length;return e[Object.keys(e)[t-1]]}function _(e){var t=E(e);return 1===Object.keys(e).length&&""===t.text}function k(e){return e===U._36.highlight||e===U._36.highlight_comment}function O(e,t,n,i){var r=null;if(e&&void 0!==e.x&&void 0!==e.y){var o=t.width/n,a=(t.height-i)/n;(Math.abs(o-e.x)>1||Math.abs(a!==e.y)>1)&&(r={x:o/e.x,y:a/e.y})}return r}function C(e){return(""+e).replace(/&/g,"&").replace(/>/g,">").replace(/r,s=e.querySelector(U._23);if(o&&!a){var l=Math.max(10,i);return s.style.left=l+"px",0}if(a&&!o){var c=Math.max(10,r-i);return s.style.left=n-c+"px",r-n}return s.style.left="50%",t}function P(e){return U._9.indexOf(e)>-1}function x(e){return!!(e&&e.x&&e.y)}function L(e){return!(!e||!e.quadPoints)}function T(e){return!!(e&&e.minX&&e.minY&&e.maxX&&e.maxY)}function j(e){return!!e&&(!(e.type===U._36.point&&!x(e.location)||k(e.type)&&!L(e.location)||e.type===U._36.draw&&!T(e.location))&&Z.every(function(t){return void 0!==e[t]}))}function A(e,t){return function(n){var i=n||window.event;if(i&&(!i.target||"BUTTON"!==i.target.nodeName)){i.preventDefault(),i.stopPropagation();var r=e(i);t(r)}}}function H(e){e&&(e.preventDefault(),e.stopPropagation())}function R(e,t,n){var i={x:e,y:t};return n&&(i.dimensions=n),i}function M(e){var t="",n=e.key||e.keyIdentifier||"";return e.ctrlKey?t="Control":e.shiftKey?t="Shift":e.metaKey&&(t="Meta"),n===t&&(n=""),0===n.indexOf("U+")&&(n="U+001B"===n?"Escape":String.fromCharCode(n.replace("U+","0x"))),n?(" "===n&&(n="Space"),"Esc"===n&&(n="Escape"),"Right"!==n&&"Left"!==n&&"Down"!==n&&"Up"!==n||(n="Arrow"+n),t&&(t+="+"),t+n):""}function D(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";return t&&(e.Authorization="Bearer "+t),n&&(e.BoxApi="shared_link="+n,i&&(e.BoxApi=e.BoxApi+"&shared_link_password="+i)),G&&(e[q]=G),X&&(e[W]=X),e}function B(e,t){var n=(e+"e").split("e");return n=(Math.round(n[0]+"e"+(+n[1]+t))+"e").split("e"),+(n[0]+"e"+(+n[1]-t))}function I(e,t){var n=/\{\d+\}/g;return e&&e.length?e.replace(n,function(e){var n=parseInt(e.replace(/^\D+/g,""),10)-1;return t[n]?t[n]:e}):e}function N(e){if(!e)return!1;var t=e[U._10],n=e[U._11],i=e[U._12];return!!t||!!n||!!i}function V(e,t){var n=e.location.page||1,i=t[n]||{};return i[e.threadID]=e,{page:n,pageThreads:i}}function F(e,t){var n=e.location.page||1,i=t[n]||{};return delete i[e.threadID],{page:n,pageThreads:i}}t.p=r,t.i=o,t.G=a,t.r=s,t.f=l,t.g=c,t.H=u,t.s=h,t.E=d,t.x=p,t.u=v,t.j=g,t.v=m,t.k=b,t.q=y,t.m=E,t.o=w,t.z=_,t.w=k,t.l=O,t.t=C,t.D=S,t.y=P,t.b=j,t.h=A,t.A=H,t.d=R,t.e=M,t.n=D,t.F=B,t.C=I,t.c=N,t.a=V,t.B=F;var z=n(34),U=(n.n(z),n(5)),q="X-Box-Client-Name",W="X-Box-Client-Version",G="box-content-preview",X="1.21.0",Y=9,Z=["annotations","annotationService","fileVersionId","locale","location","type"]},function(e,t){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(e){return"function"==typeof e}function r(e){return"number"==typeof e}function o(e){return"object"==typeof e&&null!==e}function a(e){return void 0===e}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!r(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,r,s,l,c;if(this._events||(this._events={}),"error"===e&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var u=new Error('Uncaught, unspecified "error" event. ('+t+")");throw u.context=t,u}if(n=this._events[e],a(n))return!1;if(i(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),n.apply(this,s)}else if(o(n))for(s=Array.prototype.slice.call(arguments,1),c=n.slice(),r=c.length,l=0;l0&&this._events[e].length>r&&(this._events[e].warned=!0,console.trace),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function n(){this.removeListener(e,n),r||(r=!0,t.apply(this,arguments))}if(!i(t))throw TypeError("listener must be a function");var r=!1;return n.listener=t,this.on(e,n),this},n.prototype.removeListener=function(e,t){var n,r,a,s;if(!i(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],a=n.length,r=-1,n===t||i(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(o(n)){for(s=a;s-- >0;)if(n[s]===t||n[s].listener&&n[s].listener===t){r=s;break}if(r<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(r,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[e],i(n))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){return this._events&&this._events[e]?i(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(i(t))return 1;if(t)return t.length}return 0},n.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,n){"use strict";n.d(t,"_37",function(){return i}),n.d(t,"b",function(){return r}),n.d(t,"E",function(){return o}),n.d(t,"H",function(){return a}),n.d(t,"D",function(){return s}),n.d(t,"x",function(){return l}),n.d(t,"z",function(){return c}),n.d(t,"A",function(){return u}),n.d(t,"h",function(){return h}),n.d(t,"i",function(){return d}),n.d(t,"l",function(){return p}),n.d(t,"p",function(){return f}),n.d(t,"u",function(){return v}),n.d(t,"v",function(){return g}),n.d(t,"t",function(){return m}),n.d(t,"j",function(){return b}),n.d(t,"w",function(){return y}),n.d(t,"y",function(){return E}),n.d(t,"k",function(){return w}),n.d(t,"f",function(){return _}),n.d(t,"I",function(){return k}),n.d(t,"J",function(){return O}),n.d(t,"K",function(){return C}),n.d(t,"C",function(){return S}),n.d(t,"L",function(){return P}),n.d(t,"F",function(){return x}),n.d(t,"d",function(){return L}),n.d(t,"e",function(){return T}),n.d(t,"s",function(){return j}),n.d(t,"q",function(){return A}),n.d(t,"r",function(){return H}),n.d(t,"o",function(){return R}),n.d(t,"n",function(){return M}),n.d(t,"m",function(){return D}),n.d(t,"g",function(){return B}),n.d(t,"c",function(){return I}),n.d(t,"B",function(){return N}),n.d(t,"G",function(){return V}),n.d(t,"P",function(){return F}),n.d(t,"Q",function(){return z}),n.d(t,"W",function(){return U}),n.d(t,"O",function(){return q}),n.d(t,"X",function(){return W}),n.d(t,"R",function(){return G}),n.d(t,"Z",function(){return X}),n.d(t,"T",function(){return Y}),n.d(t,"Y",function(){return Z}),n.d(t,"V",function(){return K}),n.d(t,"S",function(){return J}),n.d(t,"U",function(){return Q}),n.d(t,"_13",function(){return $}),n.d(t,"_14",function(){return ee}),n.d(t,"_28",function(){return te}),n.d(t,"_21",function(){return ne}),n.d(t,"_20",function(){return ie}),n.d(t,"_19",function(){return re}),n.d(t,"_18",function(){return oe}),n.d(t,"_17",function(){return ae}),n.d(t,"_22",function(){return se}),n.d(t,"_25",function(){return le}),n.d(t,"_26",function(){return ce}),n.d(t,"_23",function(){return ue}),n.d(t,"_27",function(){return he}),n.d(t,"_29",function(){return de}),n.d(t,"_24",function(){return pe}),n.d(t,"_33",function(){return fe}),n.d(t,"_31",function(){return ve}),n.d(t,"_32",function(){return ge}),n.d(t,"_15",function(){return me}),n.d(t,"_16",function(){return be}),n.d(t,"_30",function(){return ye}),n.d(t,"_10",function(){return Ee}),n.d(t,"_11",function(){return we}),n.d(t,"_12",function(){return _e}),n.d(t,"_4",function(){return ke}),n.d(t,"_34",function(){return Oe}),n.d(t,"_9",function(){return Ce}),n.d(t,"_36",function(){return Se}),n.d(t,"_5",function(){return Pe}),n.d(t,"a",function(){return xe}),n.d(t,"_35",function(){return Le}),n.d(t,"M",function(){return Te}),n.d(t,"N",function(){return je}),n.d(t,"_8",function(){return Ae}),n.d(t,"_7",function(){return He}),n.d(t,"_6",function(){return Re}),n.d(t,"_3",function(){return Me}),n.d(t,"_0",function(){return De}),n.d(t,"_1",function(){return Be}),n.d(t,"_2",function(){return Ie});var i="Anonymous",r="bp-is-active",o="bp-is-hidden",a="bp-is-invisible",s="is-disabled",l="bp-btn",c="bp-btn-plain",u="bp-btn-primary",h="cancel-annotation-btn",d="post-annotation-btn",p="bp-annotation-dialog",f="bp-annotation-highlight-dialog",v="bp-plain-highlight",g="bp-point-annotation-marker",m="bp-annotation-mode",b="bp-annotation-caret",y="annotation-textarea",E="button-container",w="annotation-container",_="bp-animate-show-dialog",k="bp-mobile-annotation-dialog",O="bp-mobile-create-annotation-dialog",C="bp-annotation-mobile-header",S="bp-annotation-dialog-close",P="bp-textarea",x="bp-annotation-highlight-btns",L="bp-add-highlight-btn",T="bp-highlight-comment-btn",j="bp-annotation-layer-highlight",A="bp-annotation-layer-draw",H="bp-annotation-layer-draw-in-progress",R="bp-annotation-drawing-label",M="bp-annotation-drawing-dialog",D="bp-annotation-drawing-btns",B="bp-annotate-draw-background",I="bp-btn-annotate-draw-add",N="bp-btn-annotate-draw-delete",V="bp-invalid-input",F="annotation-dialog",z="annotation-indicator",U="highlight-btn",q="add-highlight-comment-btn",W="post-annotation-btn",G="cancel-annotation-btn",X="reply-textarea",Y="cancel-reply-btn",Z="post-reply-btn",K="delete-btn",J="cancel-delete-btn",Q="confirm-delete-btn",$='[data-section="create"]',ee='[data-section="show"]',te=".bp-base-header",ne=".bp-btn-annotate-draw-undo",ie=".bp-btn-annotate-draw-redo",re=".bp-btn-annotate-draw-post",oe=".bp-btn-annotate-draw-cancel",ae="."+h,se="."+d,le=".bp-annotate-draw-header",ce="."+f,ue="."+b,he="."+y,de="."+E,pe="."+w,fe="."+C,ve="."+S,ge="."+x,me="."+L,be="."+T,ye=".delete-comment-btn",Ee="can_annotate",we="can_view_annotations_all",_e="can_view_annotations_self",ke={idle:"idle",drawing:"drawing",erasing:"erasing"},Oe={hover:"hover",inactive:"inactive",pending:"pending",pending_active:"pending-active"},Ce=[Oe.pending,Oe.pending_active],Se={point:"point",highlight:"highlight",draw:"draw",highlight_comment:"highlight-comment"},Pe={normal:"rgba(254, 217, 78, 0.5)",active:"rgba(255, 201, 0, 0.5)",erase:"rgba(255, 245, 132, 1)"},xe={modeEnter:"annotationmodeenter",modeExit:"annotationmodeexit",fetch:"annotationsfetched",error:"annotationerror",scale:"scaleannotations"},Le={pending:"annotationpending",threadSave:"annotationthreadsaved",threadDelete:"annotationthreaddeleted",threadCleanup:"annotationthreadcleanup",save:"annotationsaved",delete:"annotationdeleted",deleteError:"annotationdeleteerror",cancel:"annotationcanceled",createError:"annotationcreateerror"},Te={toggleMode:"togglemode",enter:"annotationmodeenter",exit:"annotationmodeexit",register:"registerthread",unregister:"unregisterthread",showHighlights:"showhighlights",bindDOMListeners:"binddomlisteners",unbindDOMListeners:"unbinddomlisteners"},je={init:"init",post:"post_comment",cancel:"cancel",plain:"plain_highlight_create",comment:"comment_highlight_edit"},Ae=15,He=15,Re="mobile-annotation-dialog",Me=16.67,De=3,Be=5,Ie=5},,function(e,t,n){"use strict";function i(e){var t=dt[e];return ht[t]}function r(e){return ht[e]}n.d(t,"h",function(){return Ue}),n.d(t,"i",function(){return qe}),n.d(t,"l",function(){return We}),n.d(t,"m",function(){return Ge}),n.d(t,"s",function(){return Xe}),n.d(t,"u",function(){return Ye}),n.d(t,"v",function(){return Ze}),n.d(t,"d",function(){return Ke}),n.d(t,"e",function(){return Je}),n.d(t,"f",function(){return Qe}),n.d(t,"n",function(){return $e}),n.d(t,"c",function(){return et}),n.d(t,"o",function(){return tt}),n.d(t,"p",function(){return nt}),n.d(t,"q",function(){return it}),n.d(t,"a",function(){return rt}),n.d(t,"b",function(){return ot}),n.d(t,"j",function(){return at}),n.d(t,"k",function(){return st}),n.d(t,"g",function(){return lt}),n.d(t,"t",function(){return ct}),n.d(t,"r",function(){return ut}),t.w=i,t.x=r;var o=n(147),a=n.n(o),s=n(148),l=n.n(s),c=n(149),u=n.n(c),h=n(150),d=n.n(h),p=n(151),f=n.n(p),v=n(152),g=n.n(v),m=n(153),b=n.n(m),y=n(154),E=n.n(y),w=n(155),_=n.n(w),k=n(156),O=n.n(k),C=n(157),S=n.n(C),P=n(158),x=n.n(P),L=n(159),T=n.n(L),j=n(160),A=n.n(j),H=n(161),R=n.n(H),M=n(162),D=n.n(M),B=n(163),I=n.n(B),N=n(164),V=n.n(N),F=n(165),z=n.n(F),U=n(166),q=n.n(U),W=n(167),G=n.n(W),X=n(168),Y=n.n(X),Z=n(169),K=n.n(Z),J=n(170),Q=n.n(J),$=n(171),ee=n.n($),te=n(172),ne=n.n(te),ie=n(173),re=n.n(ie),oe=n(174),ae=n.n(oe),se=n(175),le=n.n(se),ce=n(176),ue=n.n(ce),he=n(177),de=n.n(he),pe=n(178),fe=n.n(pe),ve=n(179),ge=n.n(ve),me=n(180),be=n.n(me),ye=n(181),Ee=n.n(ye),we=n(182),_e=n.n(we),ke=n(183),Oe=n.n(ke),Ce=n(184),Se=n.n(Ce),Pe=n(185),xe=n.n(Pe),Le=n(186),Te=n.n(Le),je=n(187),Ae=n.n(je),He=n(188),Re=n.n(He),Me=n(189),De=n.n(Me),Be=n(190),Ie=n.n(Be),Ne=n(191),Ve=n.n(Ne),Fe=n(192),ze=n.n(Fe),Ue=a.a,qe=l.a,We=(u.a,d.a),Ge=f.a,Xe=g.a,Ye=b.a,Ze=E.a,Ke=_.a,Je=O.a,Qe=S.a,$e=x.a,et=_e.a,tt=Oe.a,nt=Se.a,it=xe.a,rt=Te.a,ot=Ae.a,at=Re.a,st=De.a,lt=Ie.a,ct=Ve.a,ut=ze.a,ht={FILE_AUDIO:T.a,FILE_BOX_NOTE:A.a,FILE_CODE:R.a,FILE_DEFAULT:I.a,FILE_DICOM:D.a,FILE_DOCUMENT:V.a,FILE_EXCEL:z.a,FILE_GOOGLE_DOC:q.a,FILE_GOOGLE_SHEET:G.a,FILE_GOOGLE_SLIDE:Y.a,FILE_ILLUSTRATOR:K.a,FILE_IMAGE:Q.a,FILE_KEYNOTE:ee.a,FILE_MEDIA:ne.a,FILE_NUMBERS:re.a,FILE_OBJ:ae.a,FILE_PAGES:le.a,FILE_PDF:ue.a,FILE_POWERPOINT:de.a,FILE_PRESENTATION:fe.a,FILE_SPREADSHEET:ge.a,FILE_WORD:be.a,FILE_ZIP:Ee.a},dt={};["aac","aif","aifc","aiff","amr","au","flac","m4a","mp3","ra","wav","wma"].forEach(function(e){dt[e]="FILE_AUDIO"}),["boxnote"].forEach(function(e){dt[e]="FILE_BOX_NOTE"}),["as","as3","asm","bat","c","cc","cmake","cpp","cs","css","cxx","diff","erb","groovy","h","haml","hh","htm","html","java","js","json","less","m","make","md","ml","mm","php","pl","plist","properties","py","rb","rst","sass","scala","script","scm","sml","sql","sh","vi","vim","webdoc","xml","xsd","xsl","yaml"].forEach(function(e){dt[e]="FILE_CODE"}),["xls","xlsm","xlsx"].forEach(function(e){dt[e]="FILE_EXCEL"}),["log","msg","ods","rtf","txt","wpd"].forEach(function(e){dt[e]="FILE_DOCUMENT"}),["gdoc"].forEach(function(e){dt[e]="FILE_GOOGLE_DOC"}),["gsheet"].forEach(function(e){dt[e]="FILE_GOOGLE_SHEET"}),["gslide"].forEach(function(e){dt[e]="FILE_GOOGLE_SLIDE"}),["ai","bmp","dcm","eps","gif","jpg","jpeg","png","ps","psd","svg","svs","swf","tga","tif","tiff"].forEach(function(e){dt[e]="FILE_IMAGE"}),["key"].forEach(function(e){dt[e]="FILE_KEYNOTE"}),["3g2","3gp","avi","flv","m2v","m2ts","m4v","mkv","mov","mp4","mpeg","mpg","mts","ogg","qt","ts","wmv"].forEach(function(e){dt[e]="FILE_MEDIA"}),["numbers"].forEach(function(e){dt[e]="FILE_NUMBERS"}),["3ds","box3d","dae","fbx","obj","ply","stl"].forEach(function(e){dt[e]="FILE_OBJ"}),["pages"].forEach(function(e){dt[e]="FILE_PAGES"}),["pdf"].forEach(function(e){dt[e]="FILE_PDF"}),["ppt","pptx"].forEach(function(e){dt[e]="FILE_POWERPOINT"}),["odp"].forEach(function(e){dt[e]="FILE_PRESENTATION"}),["csv","tsv"].forEach(function(e){dt[e]="FILE_SPREADSHEET"}),["doc","docx"].forEach(function(e){dt[e]="FILE_WORD"}),["tgz","zip"].forEach(function(e){dt[e]="FILE_ZIP"})},function(e,t,n){"use strict";(function(e){function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var n=0;n0?a="Edge":o.indexOf("OPR/")>0||o.indexOf("Opera/")>0?a="Opera":o.indexOf("Chrome/")>0?a="Chrome":o.indexOf("Safari/")>0?a="Safari":o.indexOf("Trident/")>0?a="Explorer":o.indexOf("Firefox/")>0&&(a="Firefox"),a)}},{key:"canPlayType",value:function(e,t){var n=void 0;if(0===e.indexOf("audio/"))n=document.createElement("audio");else{if(0!==e.indexOf("video/"))return!1;n=document.createElement("video")}return!(!n.canPlayType||n.canPlayType(e).replace(/^no$/,"")!==t)}},{key:"canPlayH264",value:function(e){return t.canPlayType(e,"maybe")||t.canPlayType(e,"probably")}},{key:"canPlayH264Baseline",value:function(){return t.canPlayH264('video/mp4; codecs="avc1.42E01E"')}},{key:"canPlayH264Main",value:function(){return t.canPlayH264('video/mp4; codecs="avc1.4D401E"')}},{key:"canPlayH264High",value:function(){return t.canPlayH264('video/mp4; codecs="avc1.64001E"')}},{key:"canPlayMP3",value:function(){return t.canPlayType("audio/mpeg","maybe")||t.canPlayType("audio/mpeg","probably")}},{key:"canPlayDash",value:function(){var n=e.MediaSource,i=!1;return n&&(i="function"==typeof n.isTypeSupported?n.isTypeSupported('video/mp4; codecs="avc1.64001E"'):t.canPlayH264High()),i}},{key:"hasMSE",value:function(){return!!e.MediaSource}},{key:"hasWebGL",value:function(){if(!s){var e=document.createElement("canvas");e.addEventListener("webglcontextlost",function(e){e.preventDefault(),e.stopPropagation()});try{s=e.getContext("webgl")||e.getContext("experimental-webgl")}catch(e){}l=null!==s&&void 0!==s}return l}},{key:"clearGLContext",value:function(){if(s){var e=s.getExtension("WEBGL_lose_context");e&&"function"==typeof e.loseContext&&e.loseContext(),s=null}}},{key:"supportsModel3D",value:function(){return!!t.hasWebGL()&&!!s.getExtension("OES_standard_derivatives")}},{key:"hasFlash",value:function(){var t=!1;try{t=Boolean(new ActiveXObject("ShockwaveFlash.ShockwaveFlash"))}catch(n){t=void 0!==e.navigator.mimeTypes["application/x-shockwave-flash"]}return t}},{key:"hasSVG",value:function(){return document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")}},{key:"hasTouch",value:function(){return"ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch}},{key:"isMobile",value:function(){return/iphone|ipad|ipod|android|blackberry|bb10|mini|windows\sce|palm/i.test(o)}},{key:"canDownload",value:function(){return!t.isMobile()||!window.externalHost&&"download"in document.createElement("a")}},{key:"isIOS",value:function(){return/(iPad|iPhone|iPod)/g.test(o)}},{key:"isAndroid",value:function(){return/Android/g.test(o)}},{key:"isMac",value:function(){return/Macintosh; Intel Mac OS X/g.test(o)}},{key:"hasFontIssue",value:function(){return t.isIOS()&&/(?:OS\s)10_3/i.test(o)||t.isMac()&&"Safari"===t.getName()}},{key:"getBrowserInfo",value:function(){return{name:t.getName(),swf:t.hasFlash(),svg:t.hasSVG(),mse:t.hasMSE(),webgl:t.hasWebGL(),mp3:t.canPlayMP3(),dash:t.canPlayDash(),box3d:t.supportsModel3D(),h264:{baseline:t.canPlayH264Baseline(),main:t.canPlayH264Main(),high:t.canPlayH264High()}}}}]),t}();t.a=c}).call(t,n(15))},,function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var r=function(){function e(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:[];return!!this.determineViewer(e,t)}},{key:"getViewers",value:function(){return Array.isArray(this.viewers)?this.viewers:[]}},{key:"determineViewer",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return this.viewers.find(function(n){return!(t.indexOf(n.NAME)>-1)&&(n.EXT.indexOf(e.extension)>-1&&e.representations.entries.some(function(e){return n.REP===e.representation}))})}},{key:"determineRepresentation",value:function(e,t){return e.representations.entries.find(function(e){return t.REP===e.representation})}}]),e}();t.a=o},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(112),s=(n.n(a),n(113)),l=n(4),c=n.n(l),u=n(75),h=n.n(u),d=n(66),p=n.n(d),f=n(12),v=n(45),g=n(2),m=n(8),b=n(1),y=n(7),E=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},t=this.options,n=t.token,i=t.sharedLink,r=t.sharedLinkPassword;return Object(g.l)(e,n,i,r)}},{key:"addCommonListeners",value:function(){var e=this;f.a.addListener("enter",this.onFullscreenToggled),f.a.addListener("exit",this.onFullscreenToggled),document.defaultView.addEventListener("resize",this.debouncedResizeHandler);var t=this.options.file.permissions;t&&!t.can_download&&this.containerEl.addEventListener("contextmenu",this.preventDefault),this.addListener("load",function(t){t&&t.scale&&(e.scale=t.scale),e.annotatorConf&&e.initAnnotations()})}},{key:"preventDefault",value:function(e){e.preventDefault()}},{key:"toggleFullscreen",value:function(){f.a.toggle(this.containerEl)}},{key:"onFullscreenToggled",value:function(){this.containerEl.classList.toggle(b.y),f.a.isSupported()||this.containerEl.classList.toggle(b.z),this.resize()}},{key:"resize",value:function(){this.emit("resize",{width:document.documentElement.clientWidth,height:document.documentElement.clientHeight})}},{key:"allowNavigationArrows",value:function(){return!0}},{key:"emit",value:function(e,n){var i=this.options,r=i.file,o=i.viewer;w(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"emit",this).call(this,e,n),w(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"emit",this).call(this,"viewerevent",{event:e,data:n,viewerName:o?o.NAME:"",fileId:r.id})}},{key:"mobileZoomStartHandler",value:function(e){m.a.isIOS()?(this._scaling=!0,e.preventDefault(),e.stopPropagation()):2===e.touches.length?(this._pinchScale={initial:{0:[e.touches[0].clientX,e.touches[0].clientY],1:[e.touches[1].clientX,e.touches[1].clientY]},end:{}},this._scaling=!0,e.preventDefault(),e.stopPropagation()):(this._scaling=!1,this._pinchScale=void 0)}},{key:"mobileZoomChangeHandler",value:function(e){2===e.touches.length&&this._scaling&&(this._pinchScale.end={0:[e.touches[0].clientX,e.touches[0].clientY],1:[e.touches[1].clientX,e.touches[1].clientY]})}},{key:"mobileZoomEndHandler",value:function(e){if(this._scaling){var t=0;if(m.a.isIOS())t=e.scale-1;else{var n=Math.sqrt((this._pinchScale.initial[0][0]-this._pinchScale.initial[1][0])*(this._pinchScale.initial[0][0]-this._pinchScale.initial[1][0])+(this._pinchScale.initial[0][1]-this._pinchScale.initial[1][1])*(this._pinchScale.initial[0][1]-this._pinchScale.initial[1][1]));t=Math.sqrt((this._pinchScale.end[0][0]-this._pinchScale.end[1][0])*(this._pinchScale.end[0][0]-this._pinchScale.end[1][0])+(this._pinchScale.end[0][1]-this._pinchScale.end[1][1])*(this._pinchScale.end[0][1]-this._pinchScale.end[1][1]))-n}t>0?this.zoomIn():t<0&&this.zoomOut(),this._scaling=!1,this._pinchScale=void 0}}},{key:"getViewerOption",value:function(e){var t=this.options,n=t.viewers,i=t.viewer;return n&&n[i.NAME]?n[i.NAME][e]:null}},{key:"loadAssets",value:function(e,t){var n=this.options.location,i=Object(g.e)(n);return Object(g.p)((t||[]).map(i)),Object(g.o)((e||[]).map(i))}},{key:"prefetchAssets",value:function(e,t){var n=this.options.location,i=Object(g.e)(n);Object(g.u)((t||[]).map(i)),Object(g.u)((e||[]).map(i))}},{key:"getRepStatus",value:function(e){var t=this.options,n=t.token,i=t.sharedLink,r=t.sharedLinkPassword,o=t.logger,a=new v.a({representation:e||this.options.representation,token:n,sharedLink:i,sharedLinkPassword:r,logger:e?null:o});return a.addListener("conversionpending",this.resetLoadTimeout),this.repStatuses.push(a),a}},{key:"isRepresentationReady",value:function(e){var t=v.a.getStatus(e);return t===b._12||t===b._13}},{key:"disableViewerControls",value:function(){this.controls&&this.controls.disable()}},{key:"enableViewerControls",value:function(){this.controls&&this.controls.enable()}},{key:"loadAnnotator",value:function(){if(this.areAnnotationsEnabled())try{var e=new s.a;this.annotatorConf=e.determineAnnotator(this.options,this.viewerConfig)}catch(e){}}},{key:"initAnnotations",value:function(){var e=this,t=this.createAnnotatorOptions({annotator:this.annotatorConf,modeButtons:_});this.annotator=new this.annotatorConf.CONSTRUCTOR(t),this.annotator.init(this.scale),this.emit("annotator",this.annotator),this.addListener("toggleannotationmode",function(t){return e.annotator.toggleAnnotationMode(t)}),this.addListener("scale",function(t){e.annotator.emit(k.scale,t)}),this.addListener("scrolltoannotation",function(t){return e.annotator.scrollToAnnotation(t)}),this.annotator.addListener("annotatorevent",this.handleAnnotatorEvents)}},{key:"areAnnotationsEnabled",value:function(){return this.viewerConfig=this.getViewerAnnotationsConfig(),this.viewerConfig&&void 0!==this.viewerConfig.enabled?this.viewerConfig.enabled:!!this.options.showAnnotations}},{key:"getViewerAnnotationsConfig",value:function(){var e=this.getViewerOption("annotations"),t=null!==e&&void 0!==e?e:{};return"boolean"==typeof t?{enabled:t}:t}},{key:"handleAnnotatorEvents",value:function(e){switch(e.event){case k.modeEnter:this.disableViewerControls(),"point"===e.data.mode?this.emit("notificationshow","Click anywhere to add a comment to the document"):"draw"===e.data.mode&&(this.emit("notificationshow","Press down and drag the pointer to draw on the document"),this.previewUI.replaceHeader(e.data.headerSelector));break;case k.modeExit:this.enableViewerControls(),this.emit("notificationhide"),"draw"===e.data.mode&&this.previewUI.replaceHeader(e.data.headerSelector);break;case k.error:this.emit("notificationshow",e.data);break;case k.fetch:this.emit("scale",{scale:this.scale,rotationAngle:this.rotationAngle})}this.emit(e.event,e.data),this.emit("annotatorevent",e)}},{key:"createAnnotatorOptions",value:function(e){var t={loadError:"We're sorry, annotations failed to load for this file.",createError:"We're sorry, the annotation could not be created.",deleteError:"We're sorry, the annotation could not be deleted.",authError:"Your session has expired. Please refresh the page.",cancelButton:"Cancel",saveButton:"Save",postButton:"Post",deleteButton:"Delete",addCommentPlaceholder:"Add a comment here...",replyPlaceholder:"Post a reply...",deleteConfirmation:"Delete this annotation?",posting:"Posting...",profileAlt:"Avatar",anonymousUserName:"Some User",pointToggle:"Point annotation mode",highlightToggle:"Highlight text",highlightComment:"Add comment to highlighted text",whoHighlighted:"{1} highlighted",drawToggle:"Drawing annotation mode",drawSave:"Save drawing",drawDelete:"Delete drawing",whoDrew:"{1} drew"};return p()(Object.assign({},this.options,e,{isMobile:this.isMobile,hasTouch:this.hasTouch,locale:this.options.location.locale,localizedStrings:t}))}}]),t}(c.a);t.a=O},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(4),s=n.n(a),l=n(1),c=function(){function e(e,t){for(var n=0;n=t||n<0||S&&i>=m}function u(){var e=k();if(c(e))return h(e);y=setTimeout(u,a(e))}function h(e){return y=void 0,P&&v?i(e):(v=g=void 0,b)}function d(){void 0!==y&&clearTimeout(y),O=0,v=E=g=y=void 0}function p(){return void 0===y?b:h(k())}function f(){var e=k(),n=c(e);if(v=arguments,g=this,E=e,n){if(void 0===y)return o(E);if(S)return y=setTimeout(u,t),i(E)}return void 0===y&&(y=setTimeout(u,t)),b}var v,g,m,b,y,E,O=0,C=!1,S=!1,P=!0;if("function"!=typeof e)throw new TypeError(l);return t=s(t)||0,r(n)&&(C=!!n.leading,S="maxWait"in n,m=S?w(s(n.maxWait)||0,t):m,P="trailing"in n?!!n.trailing:P),f.cancel=d,f.flush=p,f}function i(e,t,i){var o=!0,a=!0;if("function"!=typeof e)throw new TypeError(l);return r(i)&&(o="leading"in i?!!i.leading:o,a="trailing"in i?!!i.trailing:a),n(e,t,{leading:o,maxWait:t,trailing:a})}function r(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function o(e){return!!e&&"object"==typeof e}function a(e){return"symbol"==typeof e||o(e)&&E.call(e)==u}function s(e){if("number"==typeof e)return e;if(a(e))return c;if(r(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=r(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(h,"");var n=p.test(e);return n||f.test(e)?v(e.slice(2),n?2:8):d.test(e)?c:+e}var l="Expected a function",c=NaN,u="[object Symbol]",h=/^\s+|\s+$/g,d=/^[-+]0x[0-9a-f]+$/i,p=/^0b[01]+$/i,f=/^0o[0-7]+$/i,v=parseInt,g="object"==typeof t&&t&&t.Object===Object&&t,m="object"==typeof self&&self&&self.Object===Object&&self,b=g||m||Function("return this")(),y=Object.prototype,E=y.toString,w=Math.max,_=Math.min,k=function(){return b.Date.now()};e.exports=i}).call(t,n(15))},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var r=n(27),o=n.n(r),a=n(8),s=n(1),l=function(){function e(e,t){for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:"",i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",r=document.createElement("div");r.className="bp-controls-cell";var o=document.createElement("button");return o.setAttribute("aria-label",e),o.setAttribute("title",e),o.className="bp-controls-btn "+n,o.addEventListener("click",t),i&&(o.innerHTML=i),r.appendChild(o),this.controlsEl.appendChild(r),this.buttonRefs.push({button:o,handler:t}),o}},{key:"enable",value:function(){this.controlsEl.classList.remove(s.A)}},{key:"disable",value:function(){this.controlsEl.classList.add(s.A)}},{key:"isPageNumFocused",value:function(){return document.activeElement&&document.activeElement.classList.contains("bp-page-num-input")}}]),e}();t.a=h},function(e,t,n){"use strict";function i(e,t,n){for(var i=!1,r=-1,o=e.length,a=o-1;++r\n
\n
\n
'.trim(),e.appendChild(i);var r=i.querySelector(".corner1"),o=i.querySelector(".corner2"),a=i.querySelector(".corner3"),l=i.querySelector(".corner4"),c=r.getBoundingClientRect(),u=o.getBoundingClientRect(),h=a.getBoundingClientRect(),d=l.getBoundingClientRect(),p=t.getBoundingClientRect(),f=p.height-m._8-m._7,v=p.left,g=p.top+m._8;return e.removeChild(i),s([c.left-v,c.top-g,u.left-v,u.top-g,h.left-v,h.top-g,d.left-v,d.top-g],f,n)}function u(e){var t=b(e[e.length-1],8),n=t[0],i=t[1],r=t[2],o=t[3],a=t[4],s=t[5],l=t[6],c=t[7];return[Math.max(n,r,a,l),Math.min(i,o,s,c)]}function h(e){return!(e.rangeCount<=0||e.isCollapsed||""===e.toString())}function d(e,t){var n=e.getBoundingClientRect(),i=window.devicePixelRatio||1,r=n.width,o=n.height-m._8-m._7,a=t;if(a.width=i*r,a.height=i*o,1!==i){a.style.width=r+"px",a.style.height=o+"px";t.getContext("2d").scale(i,i)}return a}function p(e,t){if(!e)return null;var n=e.querySelector("."+t);if(!n){n=document.createElement("canvas"),n.classList.add(t),n=d(e,n);var i=e.querySelector(".textLayer");e.insertBefore(n,i)}return n.getContext("2d")}function f(e,t){return e.querySelector('[data-page-number="'+t+'"]')}function v(e){var t=g.i(e);return-1!==_.indexOf(t)}t.j=i,t.e=r,t.k=o,t.b=a,t.a=s,t.c=l,t.h=c,t.f=u,t.l=h,t.m=d,t.d=p,t.g=f,t.i=v;var g=n(3),m=n(5),b=function(){function e(e,t){var n=[],i=!0,r=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(i=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);i=!0);}catch(e){r=!0,o=e}finally{try{!i&&s.return&&s.return()}finally{if(r)throw o}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),y=30,E=4/3,w=.75,_=[m.P,m.Q,m.W,m.O,m.X,m.R,m.Z,m.T,m.Y,m.V,m.S,m.U]},,,,function(e,t,n){var i,r;!function(o,a){i=o,void 0!==(r="function"==typeof i?i.call(t,n,t,e):i)&&(e.exports=r)}(function(){function e(e,t){var n=typeof e[t];return n==E||!(n!=y||!e[t])||"unknown"==n}function t(e,t){return!(typeof e[t]!=y||!e[t])}function n(e,t){return typeof e[t]!=w}function i(e){return function(t,n){for(var i=n.length;i--;)if(!e(t,n[i]))return!1;return!0}}function r(e){return e&&S(e,C)&&x(e,O)}function o(e){return t(e,"body")?e.body:e.getElementsByTagName("body")[0]}function a(t){typeof console!=w&&e(console,"log")}function s(e,t){j&&t?alert(e):a(e)}function l(e){H.initialized=!0,H.supported=!1,s("Rangy is not supported in this environment. Reason: "+e,H.config.alertOnFail)}function c(e){s("Rangy warning: "+e,H.config.alertOnWarn)}function u(e){return e.message||e.description||String(e)}function h(){if(j&&!H.initialized){var t,n=!1,i=!1;e(document,"createRange")&&(t=document.createRange(),S(t,k)&&x(t,_)&&(n=!0));var s=o(document);if(!s||"body"!=s.nodeName.toLowerCase())return void l("No body element found");if(s&&e(s,"createTextRange")&&(t=s.createTextRange(),r(t)&&(i=!0)),!n&&!i)return void l("Neither Range nor TextRange are available");H.initialized=!0,H.features={implementsDomRange:n,implementsTextRange:i};var c,h;for(var d in T)(c=T[d])instanceof v&&c.init(c,H);for(var p=0,f=D.length;pt?(o.node=i,o.offset-=t):o.node==e.parentNode&&o.offset>r(e)&&++o.offset;return i}function f(e){if(9==e.nodeType)return e;if(typeof e.ownerDocument!=j)return e.ownerDocument;if(typeof e.document!=j)return e.document;if(e.parentNode)return f(e.parentNode);throw t.createError("getDocument: no document found for node")}function v(e){var n=f(e);if(typeof n.defaultView!=j)return n.defaultView;if(typeof n.parentWindow!=j)return n.parentWindow;throw t.createError("Cannot get a window object for node")}function g(e){if(typeof e.contentDocument!=j)return e.contentDocument;if(typeof e.contentWindow!=j)return e.contentWindow.document;throw t.createError("getIframeDocument: No Document object found for iframe element")}function m(e){if(typeof e.contentWindow!=j)return e.contentWindow;if(typeof e.contentDocument!=j)return e.contentDocument.defaultView;throw t.createError("getIframeWindow: No Window object found for iframe element")}function b(e){return e&&A.isHostMethod(e,"setTimeout")&&A.isHostObject(e,"document")}function y(e,t,n){var i;if(e?A.isHostProperty(e,"nodeType")?i=1==e.nodeType&&"iframe"==e.tagName.toLowerCase()?g(e):f(e):b(e)&&(i=e.document):i=document,!i)throw t.createError(n+"(): Parameter must be a Window object or DOM node");return i}function E(e){for(var t;t=e.parentNode;)e=t;return e}function w(e,n,i,o){var s,l,u,h,d;if(e==i)return n===o?0:n[index:"+r(e)+",length:"+e.childNodes.length+"]["+(e.innerHTML||"[innerHTML not supported]").slice(0,25)+"]"}return e.nodeName}function O(e){for(var t,n=f(e).createDocumentFragment();t=e.firstChild;)n.appendChild(t);return n}function C(e,t,n){var i=H(e),r=e.createElement("div");r.contentEditable=""+!!n,t&&(r.innerHTML=t);var o=i.firstChild;return o?i.insertBefore(r,o):i.appendChild(r),r}function S(e){return e.parentNode.removeChild(e)}function P(e){this.root=e,this._next=e}function x(e){return new P(e)}function L(e,t){this.node=e,this.offset=t}function T(e){this.code=this[e],this.codeName=e,this.message="DOMException: "+this.codeName}var j="undefined",A=e.util,H=A.getBody;A.areHostMethods(document,["createDocumentFragment","createElement","createTextNode"])||t.fail("document missing a Node creation method"),A.isHostMethod(document,"getElementsByTagName")||t.fail("document missing getElementsByTagName method");var R=document.createElement("div");A.areHostMethods(R,["insertBefore","appendChild","cloneNode"]||!A.areHostObjects(R,["previousSibling","nextSibling","childNodes","parentNode"]))||t.fail("Incomplete Element implementation"),A.isHostProperty(R,"innerHTML")||t.fail("Element is missing innerHTML property");var M=document.createTextNode("test");A.areHostMethods(M,["splitText","deleteData","insertData","appendData","cloneNode"]||!A.areHostObjects(R,["previousSibling","nextSibling","childNodes","parentNode"])||!A.areHostProperties(M,["data"]))||t.fail("Incomplete Text Node implementation");var D=function(e,t){for(var n=e.length;n--;)if(e[n]===t)return!0;return!1},B=!1;!function(){var t=document.createElement("b");t.innerHTML="1";var n=t.firstChild;t.innerHTML=" ",B=_(n),e.features.crashyTextNodes=B}();var I;typeof window.getComputedStyle!=j?I=function(e,t){return v(e).getComputedStyle(e,null)[t]}:typeof document.documentElement.currentStyle!=j?I=function(e,t){return e.currentStyle?e.currentStyle[t]:""}:t.fail("No means of obtaining computed style properties found"),P.prototype={_current:null,hasNext:function(){return!!this._next},next:function(){var e,t,n=this._current=this._next;if(this._current)if(e=n.firstChild)this._next=e;else{for(t=null;n!==this.root&&!(t=n.nextSibling);)n=n.parentNode;this._next=t}return this._current},detach:function(){this._current=this._next=this.root=null}},L.prototype={equals:function(e){return!!e&&this.node===e.node&&this.offset==e.offset},inspect:function(){return"[DomPosition("+k(this.node)+":"+this.offset+")]"},toString:function(){return this.inspect()}},T.prototype={INDEX_SIZE_ERR:1,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INVALID_STATE_ERR:11,INVALID_NODE_TYPE_ERR:24},T.prototype.toString=function(){return this.message},e.dom={arrayContains:D,isHtmlNamespace:n,parentElement:i,getNodeIndex:r,getNodeLength:o,getCommonAncestor:a,isAncestorOf:s,isOrIsAncestorOf:l,getClosestAncestorIn:c,isCharacterDataNode:u,isTextOrCommentNode:h,insertAfter:d,splitDataNode:p,getDocument:f,getWindow:v,getIframeWindow:m,getIframeDocument:g,getBody:H,isWindow:b,getContentDocument:y,getRootContainer:E,comparePoints:w,isBrokenNode:_,inspectNode:k,getComputedStyleProperty:I,createTestElement:C,removeNode:S,fragmentFromNodeChildren:O,createIterator:x,DomPosition:L},e.DOMException=T}),H.createCoreModule("DomRange",["DomUtil"],function(e,t){function n(e,t){return 3!=e.nodeType&&(F(e,t.startContainer)||F(e,t.endContainer))}function i(e){return e.document||z(e.startContainer)}function r(e){return Y(e.startContainer)}function o(e){return new B(e.parentNode,V(e))}function a(e){return new B(e.parentNode,V(e)+1)}function s(e,t,n){var i=11==e.nodeType?e.firstChild:e;return N(t)?n==t.length?M.insertAfter(e,t):t.parentNode.insertBefore(e,0==n?t:q(t,n)):n>=t.childNodes.length?t.appendChild(e):t.insertBefore(e,t.childNodes[n]),i}function l(e,t,n){if(C(e),C(t),i(t)!=i(e))throw new I("WRONG_DOCUMENT_ERR");var r=U(e.startContainer,e.startOffset,t.endContainer,t.endOffset),o=U(e.endContainer,e.endOffset,t.startContainer,t.startOffset);return n?r<=0&&o>=0:r<0&&o>0}function c(e){for(var t,n,r,o=i(e.range).createDocumentFragment();n=e.next();){if(t=e.isPartiallySelectedSubtree(),n=n.cloneNode(!t),t&&(r=e.getSubtreeIterator(),n.appendChild(c(r)),r.detach()),10==n.nodeType)throw new I("HIERARCHY_REQUEST_ERR");o.appendChild(n)}return o}function u(e,t,n){var i,r;n=n||{stop:!1};for(var o,a;o=e.next();)if(e.isPartiallySelectedSubtree()){if(!1===t(o))return void(n.stop=!0);if(a=e.getSubtreeIterator(),u(a,t,n),a.detach(),n.stop)return}else for(i=M.createIterator(o);r=i.next();)if(!1===t(r))return void(n.stop=!0)}function h(e){for(var t;e.next();)e.isPartiallySelectedSubtree()?(t=e.getSubtreeIterator(),h(t),t.detach()):e.remove()}function d(e){for(var t,n,r=i(e.range).createDocumentFragment();t=e.next();){if(e.isPartiallySelectedSubtree()?(t=t.cloneNode(!1),n=e.getSubtreeIterator(),t.appendChild(d(n)),n.detach()):e.remove(),10==t.nodeType)throw new I("HIERARCHY_REQUEST_ERR");r.appendChild(t)}return r}function p(e,t,n){var i,r=!(!t||!t.length),o=!!n;r&&(i=new RegExp("^("+t.join("|")+")$"));var a=[];return u(new v(e,!1),function(t){if((!r||i.test(t.nodeType))&&(!o||n(t))){var s=e.startContainer;if(t!=s||!N(s)||e.startOffset!=s.length){var l=e.endContainer;t==l&&N(l)&&0==e.endOffset||a.push(t)}}}),a}function f(e){return"["+(void 0===e.getName?"Range":e.getName())+"("+M.inspectNode(e.startContainer)+":"+e.startOffset+", "+M.inspectNode(e.endContainer)+":"+e.endOffset+")]"}function v(e,t){if(this.range=e,this.clonePartiallySelectedTextNodes=t,!e.collapsed){this.sc=e.startContainer,this.so=e.startOffset,this.ec=e.endContainer,this.eo=e.endOffset;var n=e.commonAncestorContainer;this.sc===this.ec&&N(this.sc)?(this.isSingleCharacterDataNode=!0,this._first=this._last=this._next=this.sc):(this._first=this._next=this.sc!==n||N(this.sc)?W(this.sc,n,!0):this.sc.childNodes[this.so],this._last=this.ec!==n||N(this.ec)?W(this.ec,n,!0):this.ec.childNodes[this.eo-1])}}function g(e){return function(t,n){for(var i,r=n?t:t.parentNode;r;){if(i=r.nodeType,X(e,i))return r;r=r.parentNode}return null}}function m(e,t){if(re(e,t))throw new I("INVALID_NODE_TYPE_ERR")}function b(e,t){if(!X(t,e.nodeType))throw new I("INVALID_NODE_TYPE_ERR")}function y(e,t){if(t<0||t>(N(e)?e.length:e.childNodes.length))throw new I("INDEX_SIZE_ERR")}function E(e,t){if(ne(e,!0)!==ne(t,!0))throw new I("WRONG_DOCUMENT_ERR")}function w(e){if(ie(e,!0))throw new I("NO_MODIFICATION_ALLOWED_ERR")}function _(e,t){if(!e)throw new I(t)}function k(e,t){return t<=(N(e)?e.length:e.childNodes.length)}function O(e){return!!e.startContainer&&!!e.endContainer&&!(Z&&(M.isBrokenNode(e.startContainer)||M.isBrokenNode(e.endContainer)))&&Y(e.startContainer)==Y(e.endContainer)&&k(e.startContainer,e.startOffset)&&k(e.endContainer,e.endOffset)}function C(e){if(!O(e))throw new Error("Range error: Range is not valid. This usually happens after DOM mutation. Range: ("+e.inspect()+")")}function S(e,t){C(e);var n=e.startContainer,i=e.startOffset,r=e.endContainer,o=e.endOffset,a=n===r;N(r)&&o>0&&o0&&i=V(n)&&o++,i=0),e.setStartAndEnd(n,i,r,o)}function P(e){C(e);var t=e.commonAncestorContainer.parentNode.cloneNode(!1);return t.appendChild(e.cloneContents()),t.innerHTML}function x(e){e.START_TO_START=ce,e.START_TO_END=ue,e.END_TO_END=he,e.END_TO_START=de,e.NODE_BEFORE=pe,e.NODE_AFTER=fe,e.NODE_BEFORE_AND_AFTER=ve,e.NODE_INSIDE=ge}function L(e){x(e),x(e.prototype)}function T(e,t){return function(){C(this);var n,i,r=this.startContainer,o=this.startOffset,s=this.commonAncestorContainer,l=new v(this,!0);r!==s&&(n=W(r,s,!0),i=a(n),r=i.node,o=i.offset),u(l,w),l.reset();var c=e(l);return l.detach(),t(this,r,o,r,o),c}}function j(t,i){function r(e,t){return function(n){b(n,J),b(Y(n),Q);var i=(e?o:a)(n);(t?s:l)(this,i.node,i.offset)}}function s(e,t,n){var r=e.endContainer,o=e.endOffset;t===e.startContainer&&n===e.startOffset||(Y(t)==Y(r)&&1!=U(t,n,r,o)||(r=t,o=n),i(e,t,n,r,o))}function l(e,t,n){var r=e.startContainer,o=e.startOffset;t===e.endContainer&&n===e.endOffset||(Y(t)==Y(r)&&-1!=U(t,n,r,o)||(r=t,o=n),i(e,r,o,t,n))}var c=function(){};c.prototype=e.rangePrototype,t.prototype=new c,D.extend(t.prototype,{setStart:function(e,t){m(e,!0),y(e,t),s(this,e,t)},setEnd:function(e,t){m(e,!0),y(e,t),l(this,e,t)},setStartAndEnd:function(){var e=arguments,t=e[0],n=e[1],r=t,o=n;switch(e.length){case 3:o=e[2];break;case 4:r=e[2],o=e[3]}i(this,t,n,r,o)},setBoundary:function(e,t,n){this["set"+(n?"Start":"End")](e,t)},setStartBefore:r(!0,!0),setStartAfter:r(!1,!0),setEndBefore:r(!0,!1),setEndAfter:r(!1,!1),collapse:function(e){C(this),e?i(this,this.startContainer,this.startOffset,this.startContainer,this.startOffset):i(this,this.endContainer,this.endOffset,this.endContainer,this.endOffset)},selectNodeContents:function(e){m(e,!0),i(this,e,0,e,G(e))},selectNode:function(e){m(e,!1),b(e,J);var t=o(e),n=a(e);i(this,t.node,t.offset,n.node,n.offset)},extractContents:T(d,i),deleteContents:T(h,i),canSurroundContents:function(){C(this),w(this.startContainer),w(this.endContainer);var e=new v(this,!0),t=e._first&&n(e._first,this)||e._last&&n(e._last,this);return e.detach(),!t},splitBoundaries:function(){S(this)},splitBoundariesPreservingPositions:function(e){S(this,e)},normalizeBoundaries:function(){C(this);var e,t=this.startContainer,n=this.startOffset,r=this.endContainer,o=this.endOffset,a=function(e){var t=e.nextSibling;t&&t.nodeType==e.nodeType&&(r=e,o=e.length,e.appendData(t.data),K(t))},s=function(e){var i=e.previousSibling;if(i&&i.nodeType==e.nodeType){t=e;var a=e.length;if(n=i.length,e.insertData(0,i.data),K(i),t==r)o+=n,r=t;else if(r==e.parentNode){var s=V(e);o==s?(r=e,o=a):o>s&&o--}}},l=!0;if(N(r))o==r.length?a(r):0==o&&(e=r.previousSibling)&&e.nodeType==r.nodeType&&(o=e.length,t==r&&(l=!1),e.appendData(r.data),K(r),r=e);else{if(o>0){var c=r.childNodes[o-1];c&&N(c)&&a(c)}l=!this.collapsed}if(l){if(N(t))0==n?s(t):n==t.length&&(e=t.nextSibling)&&e.nodeType==t.nodeType&&(r==e&&(r=t,o+=t.length),t.appendData(e.data),K(e));else if(nx",ae=3==oe.firstChild.nodeType}catch(e){}e.features.htmlParsingConforms=ae;var se=ae?function(e){var t=this.startContainer,n=z(t);if(!t)throw new I("INVALID_STATE_ERR");var i=null;return 1==t.nodeType?i=t:N(t)&&(i=M.parentElement(t)),i=null===i||"HTML"==i.nodeName&&M.isHtmlNamespace(z(i).documentElement)&&M.isHtmlNamespace(i)?n.createElement("body"):i.cloneNode(!1),i.innerHTML=e,M.fragmentFromNodeChildren(i)}:function(e){var t=i(this),n=t.createElement("body");return n.innerHTML=e,M.fragmentFromNodeChildren(n)},le=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],ce=0,ue=1,he=2,de=3,pe=0,fe=1,ve=2,ge=3;D.extend(e.rangePrototype,{compareBoundaryPoints:function(e,t){C(this),E(this.startContainer,t.startContainer);var n,i,r,o,a=e==de||e==ce?"start":"end",s=e==ue||e==ce?"start":"end";return n=this[a+"Container"],i=this[a+"Offset"],r=t[s+"Container"],o=t[s+"Offset"],U(n,i,r,o)},insertNode:function(e){if(C(this),b(e,ee),w(this.startContainer),F(e,this.startContainer))throw new I("HIERARCHY_REQUEST_ERR");var t=s(e,this.startContainer,this.startOffset);this.setStartBefore(t)},cloneContents:function(){C(this);var e,t;if(this.collapsed)return i(this).createDocumentFragment();if(this.startContainer===this.endContainer&&N(this.startContainer))return e=this.startContainer.cloneNode(!0),e.data=e.data.slice(this.startOffset,this.endOffset),t=i(this).createDocumentFragment(),t.appendChild(e),t;var n=new v(this,!0);return e=c(n),n.detach(),e},canSurroundContents:function(){C(this),w(this.startContainer),w(this.endContainer);var e=new v(this,!0),t=e._first&&n(e._first,this)||e._last&&n(e._last,this);return e.detach(),!t},surroundContents:function(e){if(b(e,te),!this.canSurroundContents())throw new I("INVALID_STATE_ERR");var t=this.extractContents();if(e.hasChildNodes())for(;e.lastChild;)e.removeChild(e.lastChild);s(e,this.startContainer,this.startOffset),e.appendChild(t),this.selectNode(e)},cloneRange:function(){C(this);for(var e,t=new R(i(this)),n=le.length;n--;)e=le[n],t[e]=this[e];return t},toString:function(){C(this);var e=this.startContainer;if(e===this.endContainer&&N(e))return 3==e.nodeType||4==e.nodeType?e.data.slice(this.startOffset,this.endOffset):"";var t=[],n=new v(this,!0);return u(n,function(e){3!=e.nodeType&&4!=e.nodeType||t.push(e.data)}),n.detach(),t.join("")},compareNode:function(e){C(this);var t=e.parentNode,n=V(e);if(!t)throw new I("NOT_FOUND_ERR");var i=this.comparePoint(t,n),r=this.comparePoint(t,n+1);return i<0?r>0?ve:pe:r>0?fe:ge},comparePoint:function(e,t){return C(this),_(e,"HIERARCHY_REQUEST_ERR"),E(e,this.startContainer),U(e,t,this.startContainer,this.startOffset)<0?-1:U(e,t,this.endContainer,this.endOffset)>0?1:0},createContextualFragment:se,toHtml:function(){return P(this)},intersectsNode:function(e,t){if(C(this),Y(e)!=r(this))return!1;var n=e.parentNode,i=V(e);if(!n)return!0;var o=U(n,i,this.endContainer,this.endOffset),a=U(n,i+1,this.startContainer,this.startOffset);return t?o<=0&&a>=0:o<0&&a>0},isPointInRange:function(e,t){return C(this),_(e,"HIERARCHY_REQUEST_ERR"),E(e,this.startContainer),U(e,t,this.startContainer,this.startOffset)>=0&&U(e,t,this.endContainer,this.endOffset)<=0},intersectsRange:function(e){return l(this,e,!1)},intersectsOrTouchesRange:function(e){return l(this,e,!0)},intersection:function(e){if(this.intersectsRange(e)){var t=U(this.startContainer,this.startOffset,e.startContainer,e.startOffset),n=U(this.endContainer,this.endOffset,e.endContainer,e.endOffset),i=this.cloneRange();return-1==t&&i.setStart(e.startContainer,e.startOffset),1==n&&i.setEnd(e.endContainer,e.endOffset),i}return null},union:function(e){if(this.intersectsOrTouchesRange(e)){var t=this.cloneRange();return-1==U(e.startContainer,e.startOffset,this.startContainer,this.startOffset)&&t.setStart(e.startContainer,e.startOffset),1==U(e.endContainer,e.endOffset,this.endContainer,this.endOffset)&&t.setEnd(e.endContainer,e.endOffset),t}throw new I("Ranges do not intersect")},containsNode:function(e,t){return t?this.intersectsNode(e,!1):this.compareNode(e)==ge},containsNodeContents:function(e){return this.comparePoint(e,0)>=0&&this.comparePoint(e,G(e))<=0},containsRange:function(e){var t=this.intersection(e);return null!==t&&e.equals(t)},containsNodeText:function(e){var t=this.cloneRange();t.selectNode(e);var n=t.getNodes([3]);if(n.length>0){t.setStart(n[0],0);var i=n.pop();return t.setEnd(i,i.length),this.containsRange(t)}return this.containsNodeContents(e)},getNodes:function(e,t){return C(this),p(this,e,t)},getDocument:function(){return i(this)},collapseBefore:function(e){this.setEndBefore(e),this.collapse(!1)},collapseAfter:function(e){this.setStartAfter(e),this.collapse(!0)},getBookmark:function(t){var n=i(this),r=e.createRange(n);t=t||M.getBody(n),r.selectNodeContents(t);var o=this.intersection(r),a=0,s=0;return o&&(r.setEnd(o.startContainer,o.startOffset),a=r.toString().length,s=a+o.toString().length),{start:a,end:s,containerNode:t}},moveToBookmark:function(e){var t=e.containerNode,n=0;this.setStart(t,0),this.collapse(!0);for(var i,r,o,a,s=[t],l=!1,c=!1;!c&&(i=s.pop());)if(3==i.nodeType)r=n+i.length,!l&&e.start>=n&&e.start<=r&&(this.setStart(i,e.start-n),l=!0),l&&e.end>=n&&e.end<=r&&(this.setEnd(i,e.end-n),c=!0),n=r;else for(a=i.childNodes,o=a.length;o--;)s.push(a[o])},getName:function(){return"DomRange"},equals:function(e){return R.rangesEqual(this,e)},isValid:function(){return O(this)},inspect:function(){return f(this)},detach:function(){}}),j(R,H),D.extend(R,{rangeProperties:le,RangeIterator:v,copyComparisonConstants:L,createPrototypeRange:j,inspect:f,toHtml:P,getRangeDocument:i,rangesEqual:function(e,t){return e.startContainer===t.startContainer&&e.startOffset===t.startOffset&&e.endContainer===t.endContainer&&e.endOffset===t.endOffset}}),e.DomRange=R}),H.createCoreModule("WrappedRange",["DomRange"],function(e,t){var n,i,r=e.dom,o=e.util,a=r.DomPosition,s=e.DomRange,l=r.getBody,c=r.getContentDocument,u=r.isCharacterDataNode;if(e.features.implementsDomRange&&function(){function i(e){for(var t,n=d.length;n--;)t=d[n],e[t]=e.nativeRange[t];e.collapsed=e.startContainer===e.endContainer&&e.startOffset===e.endOffset}function a(e,t,n,i,r){var o=e.startContainer!==t||e.startOffset!=n,a=e.endContainer!==i||e.endOffset!=r,s=!e.equals(e.nativeRange);(o||a||s)&&(e.setEnd(i,r),e.setStart(t,n))}var u,h,d=s.rangeProperties;n=function(e){if(!e)throw t.createError("WrappedRange: Range must be specified");this.nativeRange=e,i(this)},s.createPrototypeRange(n,a),u=n.prototype,u.selectNode=function(e){this.nativeRange.selectNode(e),i(this)},u.cloneContents=function(){return this.nativeRange.cloneContents()},u.surroundContents=function(e){this.nativeRange.surroundContents(e),i(this)},u.collapse=function(e){this.nativeRange.collapse(e),i(this)},u.cloneRange=function(){return new n(this.nativeRange.cloneRange())},u.refresh=function(){i(this)},u.toString=function(){return this.nativeRange.toString()};var p=document.createTextNode("test");l(document).appendChild(p);var f=document.createRange();f.setStart(p,0),f.setEnd(p,0);try{f.setStart(p,1),u.setStart=function(e,t){this.nativeRange.setStart(e,t),i(this)},u.setEnd=function(e,t){this.nativeRange.setEnd(e,t),i(this)},h=function(e){return function(t){this.nativeRange[e](t),i(this)}}}catch(e){u.setStart=function(e,t){try{this.nativeRange.setStart(e,t)}catch(n){this.nativeRange.setEnd(e,t),this.nativeRange.setStart(e,t)}i(this)},u.setEnd=function(e,t){try{this.nativeRange.setEnd(e,t)}catch(n){this.nativeRange.setStart(e,t),this.nativeRange.setEnd(e,t)}i(this)},h=function(e,t){return function(n){try{this.nativeRange[e](n)}catch(i){this.nativeRange[t](n),this.nativeRange[e](n)}i(this)}}}u.setStartBefore=h("setStartBefore","setEndBefore"),u.setStartAfter=h("setStartAfter","setEndAfter"),u.setEndBefore=h("setEndBefore","setStartBefore"),u.setEndAfter=h("setEndAfter","setStartAfter"),u.selectNodeContents=function(e){this.setStartAndEnd(e,0,r.getNodeLength(e))},f.selectNodeContents(p),f.setEnd(p,3);var v=document.createRange();v.selectNodeContents(p),v.setEnd(p,4),v.setStart(p,2),-1==f.compareBoundaryPoints(f.START_TO_END,v)&&1==f.compareBoundaryPoints(f.END_TO_START,v)?u.compareBoundaryPoints=function(e,t){return t=t.nativeRange||t,e==t.START_TO_END?e=t.END_TO_START:e==t.END_TO_START&&(e=t.START_TO_END),this.nativeRange.compareBoundaryPoints(e,t)}:u.compareBoundaryPoints=function(e,t){return this.nativeRange.compareBoundaryPoints(e,t.nativeRange||t)};var g=document.createElement("div");g.innerHTML="123";var m=g.firstChild,b=l(document);b.appendChild(g),f.setStart(m,1),f.setEnd(m,2),f.deleteContents(),"13"==m.data&&(u.deleteContents=function(){this.nativeRange.deleteContents(),i(this)},u.extractContents=function(){var e=this.nativeRange.extractContents();return i(this),e}),b.removeChild(g),b=null,o.isHostMethod(f,"createContextualFragment")&&(u.createContextualFragment=function(e){return this.nativeRange.createContextualFragment(e)}),l(document).removeChild(p),u.getName=function(){return"WrappedRange"},e.WrappedRange=n,e.createNativeRange=function(e){return e=c(e,t,"createNativeRange"),e.createRange()}}(),e.features.implementsTextRange){var h=function(e){var t=e.parentElement(),n=e.duplicate();n.collapse(!0);var i=n.parentElement();n=e.duplicate(),n.collapse(!1);var o=n.parentElement(),a=i==o?i:r.getCommonAncestor(i,o);return a==t?a:r.getCommonAncestor(t,a)},d=function(e){return 0==e.compareEndPoints("StartToEnd",e)},p=function(e,t,n,i,o){var s=e.duplicate();s.collapse(n);var l=s.parentElement();if(r.isOrIsAncestorOf(t,l)||(l=t),!l.canHaveHTML){var c=new a(l.parentNode,r.getNodeIndex(l));return{boundaryPosition:c,nodeInfo:{nodeIndex:c.offset,containerElement:c.node}}}var h=r.getDocument(l).createElement("span");h.parentNode&&r.removeNode(h);for(var d,p,f,v,g,m=n?"StartToStart":"StartToEnd",b=o&&o.containerElement==l?o.nodeIndex:0,y=l.childNodes.length,E=y,w=E;;){if(w==y?l.appendChild(h):l.insertBefore(h,l.childNodes[w]),s.moveToElementText(h),0==(d=s.compareEndPoints(m,e))||b==E)break;if(-1==d){if(E==b+1)break;b=w}else E=E==b+1?b:w;w=Math.floor((b+E)/2),l.removeChild(h)}if(g=h.nextSibling,-1==d&&g&&u(g)){s.setEndPoint(n?"EndToStart":"EndToEnd",e);var _;if(/[\r\n]/.test(g.data)){var k=s.duplicate(),O=k.text.replace(/\r\n/g,"\r").length;for(_=k.moveStart("character",O);-1==(d=k.compareEndPoints("StartToEnd",k));)_++,k.moveStart("character",1)}else _=s.text.length;v=new a(g,_)}else p=(i||!n)&&h.previousSibling,f=(i||n)&&h.nextSibling,v=f&&u(f)?new a(f,0):p&&u(p)?new a(p,p.data.length):new a(l,r.getNodeIndex(h));return r.removeNode(h),{boundaryPosition:v,nodeInfo:{nodeIndex:w,containerElement:l}}},f=function(e,t){var n,i,o,a,s=e.offset,c=r.getDocument(e.node),h=l(c).createTextRange(),d=u(e.node);return d?(n=e.node,i=n.parentNode):(a=e.node.childNodes,n=s1,r=[],o=a(t),s=0;s=36)G=!1;else{var d=u.cloneRange();u.setStart(c,0),d.setEnd(c,3),d.setStart(c,2),t.addRange(u),t.addRange(d),G=2==t.rangeCount}}for(S.removeNode(l),t.removeAllRanges(),s=0;s1)E(this,e);else{this.removeAllRanges();for(var t=0,n=e.length;t1?E(this,e):t&&this.addRange(e[0])}}ee.getRangeAt=function(e){if(e<0||e>=this.rangeCount)throw new j("INDEX_SIZE_ERR");return this._ranges[e].cloneRange()};var ne;if(N)ne=function(t){var n;e.isSelectionValid(t.win)?n=t.docSelection.createRange():(n=M(t.win.document).createTextRange(),n.collapse(!0)),"Control"==t.docSelection.type?v(t):p(n)?f(t,n):c(t)};else if(x(V,"getRangeAt")&&"number"==typeof V.rangeCount)ne=function(t){if(K&&I&&"Control"==t.docSelection.type)v(t);else if(t._ranges.length=t.rangeCount=t.nativeSelection.rangeCount,t.rangeCount){for(var n=0,i=t.rangeCount;n0)return e.WrappedTextRange.rangeToTextRange(this.getRangeAt(0));throw t.createError("getNativeTextRange: selection contains no range")}),ee.getName=function(){return"WrappedSelection"},ee.inspect=function(){return k(this)},ee.detach=function(){y(this.win,"delete"),b(this)},m.detachAll=function(){y(null,"deleteAll")},m.inspect=k,m.isDirectionBackward=n,e.Selection=m,e.selectionPrototype=ee,e.addShimListener(function(e){void 0===e.getSelection&&(e.getSelection=function(){return $(e)}),e=null})});var I=!1,N=function(e){I||(I=!0,!H.initialized&&H.config.autoInitialize&&h())};return j&&("complete"==document.readyState?N():(e(document,"addEventListener")&&document.addEventListener("DOMContentLoaded",N,!1),M(window,"load",N))),H})},function(e,t){!function(e){"use strict";function t(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function n(e){return"string"!=typeof e&&(e=String(e)),e}function i(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return m.iterable&&(t[Symbol.iterator]=function(){return t}),t}function r(e){this.map={},e instanceof r?e.forEach(function(e,t){this.append(t,e)},this):Array.isArray(e)?e.forEach(function(e){this.append(e[0],e[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}function o(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function a(e){return new Promise(function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}})}function s(e){var t=new FileReader,n=a(t);return t.readAsArrayBuffer(e),n}function l(e){var t=new FileReader,n=a(t);return t.readAsText(e),n}function c(e){for(var t=new Uint8Array(e),n=new Array(t.length),i=0;i-1?t:e}function p(e,t){t=t||{};var n=t.body;if(e instanceof p){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new r(e.headers)),this.method=e.method,this.mode=e.mode,n||null==e._bodyInit||(n=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"omit",!t.headers&&this.headers||(this.headers=new r(t.headers)),this.method=d(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function f(e){var t=new FormData;return e.trim().split("&").forEach(function(e){if(e){var n=e.split("="),i=n.shift().replace(/\+/g," "),r=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(i),decodeURIComponent(r))}}),t}function v(e){var t=new r;return e.split(/\r?\n/).forEach(function(e){var n=e.split(":"),i=n.shift().trim();if(i){var r=n.join(":").trim();t.append(i,r)}}),t}function g(e,t){t||(t={}),this.type="default",this.status="status"in t?t.status:200,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new r(t.headers),this.url=t.url||"",this._initBody(e)}if(!e.fetch){var m={searchParams:"URLSearchParams"in e,iterable:"Symbol"in e&&"iterator"in Symbol,blob:"FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),formData:"FormData"in e,arrayBuffer:"ArrayBuffer"in e};if(m.arrayBuffer)var b=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],y=function(e){return e&&DataView.prototype.isPrototypeOf(e)},E=ArrayBuffer.isView||function(e){return e&&b.indexOf(Object.prototype.toString.call(e))>-1};r.prototype.append=function(e,i){e=t(e),i=n(i);var r=this.map[e];this.map[e]=r?r+","+i:i},r.prototype.delete=function(e){delete this.map[t(e)]},r.prototype.get=function(e){return e=t(e),this.has(e)?this.map[e]:null},r.prototype.has=function(e){return this.map.hasOwnProperty(t(e))},r.prototype.set=function(e,i){this.map[t(e)]=n(i)},r.prototype.forEach=function(e,t){for(var n in this.map)this.map.hasOwnProperty(n)&&e.call(t,this.map[n],n,this)},r.prototype.keys=function(){var e=[];return this.forEach(function(t,n){e.push(n)}),i(e)},r.prototype.values=function(){var e=[];return this.forEach(function(t){e.push(t)}),i(e)},r.prototype.entries=function(){var e=[];return this.forEach(function(t,n){e.push([n,t])}),i(e)},m.iterable&&(r.prototype[Symbol.iterator]=r.prototype.entries);var w=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];p.prototype.clone=function(){return new p(this,{body:this._bodyInit})},h.call(p.prototype),h.call(g.prototype),g.prototype.clone=function(){return new g(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new r(this.headers),url:this.url})},g.error=function(){var e=new g(null,{status:0,statusText:""});return e.type="error",e};var _=[301,302,303,307,308];g.redirect=function(e,t){if(-1===_.indexOf(t))throw new RangeError("Invalid status code");return new g(null,{status:t,headers:{location:e}})},e.Headers=r,e.Request=p,e.Response=g,e.fetch=function(e,t){return new Promise(function(n,i){var r=new p(e,t),o=new XMLHttpRequest;o.onload=function(){var e={status:o.status,statusText:o.statusText,headers:v(o.getAllResponseHeaders()||"")};e.url="responseURL"in o?o.responseURL:e.headers.get("X-Request-URL");var t="response"in o?o.response:o.responseText;n(new g(t,e))},o.onerror=function(){i(new TypeError("Network request failed"))},o.ontimeout=function(){i(new TypeError("Network request failed"))},o.open(r.method,r.url,!0),"include"===r.credentials&&(o.withCredentials=!0),"responseType"in o&&m.blob&&(o.responseType="blob"),r.headers.forEach(function(e,t){o.setRequestHeader(t,e)}),o.send(void 0===r._bodyInit?null:r._bodyInit)})},e.fetch.polyfill=!0}}("undefined"!=typeof self?self:this)},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(4),s=n.n(a),l=n(70),c=n(69),u=n(3),h=n(21),d=n(5),p=function(){function e(e,t){for(var n=0;n1&&void 0!==arguments[1])||arguments[1],i=this.annotations[e];if(!i)return this.emit(d._35.deleteError),Promise.reject();if(i.permissions&&!i.permissions.can_delete)return this.emit(d._35.deleteError),Promise.reject();delete this.annotations[e];var r=u.m(this.annotations),o=r&&r.permissions&&r.permissions.can_delete;return u.z(this.annotations)&&!o?this.cancelFirstComment():!r||u.z(this.annotations)?(this.isMobile&&this.dialog&&(this.dialog.hideMobileDialog(),this.dialog.removeAnnotation(e)),this.destroy()):this.dialog&&(this.dialog.removeAnnotation(e),this.showDialog(),this.dialog.activateReply()),n?this.annotationService.delete(e).then(function(){r=u.m(t.annotations),o=r&&r.permissions&&r.permissions.can_delete,u.z(t.annotations)&&o&&t.annotationService.delete(r.annotationID),r=u.m(t.annotations),r||t.emit(d._35.threadCleanup),t.emit(d._35.delete)}).catch(function(e){t.emit(d._35.deleteError)}):Promise.resolve()}},{key:"cancelFirstComment",value:function(){}},{key:"show",value:function(){}},{key:"createDialog",value:function(){}},{key:"setup",value:function(){var e=u.m(this.annotations);this.state=e?d._34.inactive:d._34.pending,this.createDialog(),this.bindCustomListenersOnDialog(),this.dialog&&(this.dialog.isMobile=this.isMobile,this.dialog.localized=this.localized),this.setupElement()}},{key:"setupElement",value:function(){this.element=this.createElement(),this.bindDOMListeners()}},{key:"bindDOMListeners",value:function(){this.element&&(this.element.addEventListener("click",this.showDialog),this.element.addEventListener("mouseenter",this.showDialog),this.isMobile||this.element.addEventListener("mouseleave",this.mouseoutHandler))}},{key:"unbindDOMListeners",value:function(){this.element&&(this.element.removeEventListener("click",this.showDialog),this.element.removeEventListener("mouseenter",this.showDialog),this.isMobile||this.element.removeEventListener("mouseleave",this.mouseoutHandler))}},{key:"bindCustomListenersOnDialog",value:function(){this.dialog&&(this.createAnnotation=this.createAnnotation.bind(this),this.cancelUnsavedAnnotation=this.cancelUnsavedAnnotation.bind(this),this.deleteAnnotationWithID=this.deleteAnnotationWithID.bind(this),this.dialog.addListener("annotationcreate",this.createAnnotation),this.dialog.addListener("annotationcancel",this.cancelUnsavedAnnotation),this.dialog.addListener("annotationdelete",this.deleteAnnotationWithID))}},{key:"unbindCustomListenersOnDialog",value:function(){this.dialog&&(this.dialog.removeAllListeners("annotationcreate"),this.dialog.removeAllListeners("annotationcancel"),this.dialog.removeAllListeners("annotationdelete"))}},{key:"cancelUnsavedAnnotation",value:function(){u.y(this.state)&&(this.emit(d._35.cancel),this.destroy())}},{key:"scrollIntoView",value:function(){var e=parseInt(this.location.y,10);this.scrollToPage(),this.centerAnnotation(this.annotatedElement.scrollTop+e)}},{key:"scrollToPage",value:function(){if(this.location&&this.location.page){this.annotatedElement.querySelector('[data-page-number="'+this.location.page+'"]').scrollIntoView()}}},{key:"centerAnnotation",value:function(e){e0&&(e.userId=this.annotationService.user.id),this.threadNumber&&(e.threadNumber=this.threadNumber),e}},{key:"emit",value:function(e,n){var i=this.getThreadEventData();f(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"emit",this).call(this,e,{data:i,eventData:n}),f(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"emit",this).call(this,"threadevent",{event:e,data:i,eventData:n})}}]),t}(s.a);t.a=v},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(4),s=n.n(a),l=n(3),c=n(5),u=n(21),h=function(){function e(e,t){for(var n=0;n0,n.canAnnotate=e.canAnnotate,n.locale=e.locale,n.isMobile=e.isMobile,n.keydownHandler=n.keydownHandler.bind(n),n.clickHandler=n.clickHandler.bind(n),n.stopPropagation=n.stopPropagation.bind(n),n.validateTextArea=n.validateTextArea.bind(n),n.isMobile||(n.mouseenterHandler=n.mouseenterHandler.bind(n),n.mouseleaveHandler=n.mouseleaveHandler.bind(n)),n}return o(t,e),h(t,[{key:"destroy",value:function(){this.element&&(this.unbindDOMListeners(),this.element.parentNode&&this.element.parentNode.removeChild(this.element),this.element=null)}},{key:"show",value:function(){this.isMobile&&this.showMobileDialog();var e=this.hasAnnotations?this.element.querySelector(".reply-textarea"):this.element.querySelector(c._27);e.classList.contains(c.b)&&this.element.parentNode||(this.isMobile||this.position(),this.hasAnnotations?this.activateReply():e.classList.add(c.b),e.selectionStart&&(e.selectionEnd=e.value.length,e.selectionStart=e.selectionEnd),l.v(e)&&e.focus(),this.scrollToLastComment())}},{key:"scrollToLastComment",value:function(){var e=this.dialogEl.querySelector(c._24);if(e){var t=this.dialogEl.classList.contains(d),n=t?0:e.clientHeight;e.scrollTop=e.scrollHeight-n}}},{key:"showMobileDialog",value:function(){this.element=this.container.querySelector("."+c.I),l.G(this.element),this.element.appendChild(this.dialogEl);var e=this.element.querySelectorAll(".annotation-comment");if(this.highlightDialogEl&&!e.length){this.element.classList.add(c.u);this.element.querySelector(c._33).classList.add(c.E)}var t=this.element.querySelector(c._31);this.hideMobileDialog=this.hideMobileDialog.bind(this),t.addEventListener("click",this.hideMobileDialog),this.element.classList.add(c.f),this.bindDOMListeners()}},{key:"hideMobileDialog",value:function(){if(this.element){this.dialogEl&&this.dialogEl.parentNode&&this.dialogEl.parentNode.removeChild(this.dialogEl),this.element.classList.remove(c.f),this.element.innerHTML=('\n \n '+u.a+" \n
").trim(),this.element.classList.remove(c.u);this.element.querySelector(c._31).removeEventListener("click",this.hideMobileDialog),l.r(this.element),this.unbindDOMListeners(),this.cancelAnnotation()}}},{key:"hide",value:function(){this.element&&this.element.classList.contains(c.E)||(this.isMobile&&this.hideMobileDialog(),l.r(this.element),this.deactivateReply(),this.toggleFlippedThreadEl())}},{key:"addAnnotation",value:function(e){if(!this.hasAnnotations){var t=this.element.querySelector(c._13),n=this.element.querySelector(c._14);l.r(t),l.G(n),this.hasAnnotations=!0}this.addAnnotationElement(e)}},{key:"removeAnnotation",value:function(e){var t=this.element.querySelector('[data-annotation-id="'+e+'"]');t&&t.parentNode.removeChild(t);var n=this.element.querySelector(".reply-textarea");n&&n.focus()}},{key:"postAnnotation",value:function(e){var t=this.element.querySelector(c._27),n=e||t.value;if(""===n.trim())return void t.classList.add(c.G);this.emit("annotationcreate",{text:n}),t.value="",t.focus()}},{key:"position",value:function(){}},{key:"setup",value:function(e,t){if(this.threadEl=t,this.dialogEl=this.generateDialogEl(Object.keys(e).length),this.dialogEl.classList.add(c.k),!this.isMobile){this.element=document.createElement("div"),this.element.setAttribute("data-type",c.P),this.element.classList.add(c.l),this.element.innerHTML='
',this.element.appendChild(this.dialogEl);var n=l.m(e);n&&(this.element.dataset.threadNumber=n.threadNumber),this.bindDOMListeners()}this.addSortedAnnotations(e)}},{key:"addSortedAnnotations",value:function(e){var t=this,n=Object.keys(e).map(function(t){return e[t]});n.sort(function(e,t){return new Date(e.created)-new Date(t.created)}),n.forEach(function(e){t.addAnnotationElement(e)})}},{key:"bindDOMListeners",value:function(){this.element.addEventListener("keydown",this.keydownHandler),this.element.addEventListener("click",this.clickHandler),this.element.addEventListener("mouseup",this.stopPropagation),this.element.addEventListener("wheel",this.stopPropagation);var e=this.element.querySelector(".reply-textarea");e&&e.addEventListener("focus",this.validateTextArea);var t=this.element.querySelector(c._27);t&&t.addEventListener("focus",this.validateTextArea),this.isMobile||(this.element.addEventListener("mouseenter",this.mouseenterHandler),this.element.addEventListener("mouseleave",this.mouseleaveHandler))}},{key:"validateTextArea",value:function(e){var t=e.target;"textarea"===t.type&&""!==t.value.trim()&&t.classList.remove(c.G)}},{key:"unbindDOMListeners",value:function(){this.element.removeEventListener("keydown",this.keydownHandler),this.element.removeEventListener("click",this.clickHandler),this.element.removeEventListener("mouseup",this.stopPropagation),this.element.removeEventListener("wheel",this.stopPropagation);var e=this.element.querySelector(".reply-textarea");e&&e.removeEventListener("focus",this.validateTextArea);var t=this.element.querySelector(c._27);t&&t.removeEventListener("focus",this.validateTextArea),this.isMobile||(this.element.removeEventListener("mouseenter",this.mouseenterHandler),this.element.removeEventListener("mouseleave",this.mouseleaveHandler))}},{key:"mouseenterHandler",value:function(){if(this.element.classList.contains(c.E)){l.G(this.element);var e=this.element.querySelector(".reply-textarea"),t=this.element.querySelector(c._27);""===e.textContent&&""===t.textContent||this.emit("annotationcommentpending")}this.activateReply()}},{key:"mouseleaveHandler",value:function(){this.hasAnnotations&&this.hide()}},{key:"enable",value:function(e){var t=this.element.querySelector('[data-annotation-id="'+e+'"]');if(t){var n=t.querySelectorAll("button");Array.prototype.forEach.call(n,function(e){e.classList.remove(c.D)})}}},{key:"disable",value:function(e){var t=this.element.querySelector('[data-annotation-id="'+e+'"]');if(t){var n=t.querySelectorAll("button");Array.prototype.forEach.call(n,function(e){e.classList.add(c.D)})}}},{key:"keydownHandler",value:function(e){(e.stopPropagation(),"Escape"===l.e(e))?this.hide():"reply-textarea"===l.i(e.target)&&this.activateReply()}},{key:"stopPropagation",value:function(e){e.stopPropagation()}},{key:"clickHandler",value:function(e){e.stopPropagation();var t=e.target,n=l.i(t),i=l.i(t,"data-annotation-id");switch(n){case c.X:this.postAnnotation();break;case c.R:this.isMobile?this.hide():this.cancelAnnotation(),this.deactivateReply(!0);break;case c.Z:this.activateReply();break;case c.T:this.deactivateReply(!0);break;case c.Y:this.postReply();break;case c.V:this.showDeleteConfirmation(i);break;case c.S:this.hideDeleteConfirmation(i);break;case c.U:this.deleteAnnotation(i)}}},{key:"addAnnotationElement",value:function(e){var t=l.t(e.user.id||"0"),n=void 0;n="0"===t?this.localized.posting:l.t(e.user.name)||this.localized.anonymousUserName;var i=l.t(e.user.avatarUrl||""),r=l.k(i,t,n,this.localized.profileAlt),o=new Date(e.created).toLocaleString(this.locale,{month:"2-digit",day:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"}),a=l.t(e.text),s=document.createElement("div");s.classList.add("annotation-comment"),s.setAttribute("data-annotation-id",e.annotationID),this.dialogEl.querySelector(".annotation-comments").appendChild(s);var h=document.createElement("div");h.classList.add("profile-image-container"),h.innerHTML=r,s.appendChild(h);var d=document.createElement("div");d.classList.add("profile-container"),s.appendChild(d);var p=document.createElement("div");p.classList.add("user-name"),p.textContent=n,d.appendChild(p);var f=document.createElement("div");f.classList.add("comment-date"),f.textContent=o,d.appendChild(f);var v=document.createElement("div");if(v.classList.add("comment-text"),v.textContent=a,s.appendChild(v),e.permissions.can_delete){var g=l.j([c.z,"delete-comment-btn"],this.localized.deleteButton,u.b,c.V);s.appendChild(g);var m=document.createElement("div");m.classList.add("delete-confirmation"),m.classList.add(c.E),s.appendChild(m);var b=document.createElement("div");b.classList.add("delete-confirmation-message"),b.textContent=this.localized.deleteConfirmation,m.appendChild(b);var y=document.createElement("div");y.classList.add(c.y),m.appendChild(y);var E=l.j([c.x,"cancel-delete-btn"],this.localized.cancelButton,this.localized.cancelButton,c.S);y.appendChild(E);var w=l.j([c.x,"confirm-delete-btn",c.A],this.localized.deleteButton,this.localized.deleteButton,c.U);y.appendChild(w)}}},{key:"cancelAnnotation",value:function(){this.emit("annotationcancel")}},{key:"activateReply",value:function(){if(this.dialogEl){var e=this.dialogEl.querySelector(".reply-textarea");if(!e.classList.contains(c.b)){var t=e.parentNode.querySelector(c._29);e.classList.add(c.b),l.G(t),this.scrollToLastComment()}}}},{key:"deactivateReply",value:function(e){if(this.dialogEl){var t=this.dialogEl.querySelector(".reply-container"),n=t.querySelector(".reply-textarea"),i=t.querySelector(c._29);l.E(n,e),l.r(i),l.v(n)&&n.focus(),this.scrollToLastComment()}}},{key:"postReply",value:function(){var e=this.element.querySelector(".reply-textarea"),t=e.value;if(""===t.trim())return void e.classList.add(c.G);this.emit("annotationcreate",{text:t}),e.value="",e.focus()}},{key:"showDeleteConfirmation",value:function(e){var t=this.element.querySelector('[data-annotation-id="'+e+'"]'),n=t.querySelector(".delete-confirmation"),i=t.querySelector(".cancel-delete-btn"),r=t.querySelector(c._30);l.r(r),l.G(n),i.focus()}},{key:"hideDeleteConfirmation",value:function(e){var t=this.element.querySelector('[data-annotation-id="'+e+'"]'),n=t.querySelector(".delete-confirmation"),i=t.querySelector(c._30);l.G(i),l.r(n),i.focus()}},{key:"deleteAnnotation",value:function(e){this.emit("annotationdelete",{annotationID:e})}},{key:"generateDialogEl",value:function(e){var t=document.createElement("div");return t.innerHTML=('\n \n \n \n \n '+this.localized.cancelButton+'\n \n \n '+this.localized.postButton+'\n \n
\n \n \n \n \n
\n
\n \n '+this.localized.cancelButton+'\n \n \n '+this.localized.postButton+"\n \n
\n
\n ").trim(),t}},{key:"flipDialog",value:function(e,t){var n="",i="",r=this.element.querySelector(c._23);if(e<=t/2)n=e-8+"px",i="",this.element.classList.remove(d),r.style.bottom="";else{var o=t-e-27;n="",i=o+"px",this.element.classList.add(d),r.style.top="",r.style.bottom="0px"}return this.fitDialogHeightInPage(),this.toggleFlippedThreadEl(),{top:n,bottom:i}}},{key:"toggleFlippedThreadEl",value:function(){if(this.element&&this.threadEl){this.element.classList.contains(d)&&(this.element.classList.contains(c.E)?this.threadEl.classList.remove(d):this.threadEl.classList.add(d))}}},{key:"fitDialogHeightInPage",value:function(){var e=this.container.clientHeight/2-c._8-c._7;this.dialogEl.style.maxHeight=e+"px";var t=this.dialogEl.querySelector("."+c.k);t&&(t.style.maxHeight=e+"px")}}]),t}(s.a);t.a=p},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function a(e,t,n){var i="";if(n){i="&shared_link_password="+encodeURI(n)}e.setRequestHeader("boxapi","shared_link="+encodeURI(t)+i)}var s=n(34),l=(n.n(s),n(4)),c=n.n(l),u=n(16),h=n(1),d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},p=function(){function e(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:{};return this.staticBaseURI=t&&t.location?t.location.staticBaseURI:"",this.initBox3d(t)}},{key:"destroy",value:function(){this.box3d&&(this.box3d.canvas&&(this.box3d.canvas.removeEventListener("webglcontextlost",this.handleContextLost),this.box3d.canvas.removeEventListener("webglcontextrestored",this.handleContextRestored)),this.disableVr(),this.box3d.destroy(),this.box3d=null)}},{key:"reset",value:function(){this.resetView()}},{key:"resetView",value:function(){var e=this.getCamera();e&&(e.setPosition(this.savedCameraPosition.x,this.savedCameraPosition.y,this.savedCameraPosition.z),e.setQuaternion(this.savedCameraQuaternion.x,this.savedCameraQuaternion.y,this.savedCameraQuaternion.z,this.savedCameraQuaternion.w))}},{key:"getCamera",value:function(){return this.box3d?this.box3d.getObjectByClass(Box3D.CameraObject):null}},{key:"getScene",value:function(){return this.box3d?this.box3d.getObjectByClass(Box3D.SceneObject):null}},{key:"getBox3D",value:function(){return this.box3d}},{key:"configureXHR",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=new XMLHttpRequest;return i.open("GET",t),n.isExternal||(i.setRequestHeader("Authorization","Bearer "+e.token),e.sharedLink&&a(i,e.sharedLink,e.sharedLinkPassword)),Promise.resolve(i)}},{key:"getEntitiesFromUrl",value:function(e){return fetch(e).then(function(e){return e.json()})}},{key:"initBox3d",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!Box3D)return Promise.reject(new Error("Missing Box3D"));if(!t.file||!t.file.file_version)return Promise.reject(new Error("Missing file version"));var n=new Box3D.XhrResourceLoader(this.configureXHR.bind(this,t)),i=t&&t.box3dApplication?t.box3dApplication:{},r=Promise.resolve([]);return"object"===(void 0===i?"undefined":d(i))?r=Promise.resolve(i):"string"==typeof i&&(r=this.getEntitiesFromUrl(i)),r.then(function(i){return e.createBox3d(n,t.sceneEntities,i.entities,""+t.apiHost)})}},{key:"createBox3d",value:function(e,t,n,i){var r=this,o=new Box3D.Engine({container:this.containerEl,engineName:"Default",resourceLoader:e,apiBase:i});return o.canvas&&(o.canvas.addEventListener("webglcontextlost",this.handleContextLost),o.canvas.addEventListener("webglcontextrestored",this.handleContextRestored)),new Promise(function(e){n&&o.addEntities(n);var i=o.getAssetByClass(Box3D.ApplicationAsset);o.addEntities(t),i||(i=o.getAssetByClass(Box3D.ApplicationAsset)),i.load(),r.box3d=o,e(r.box3d)})}},{key:"handleContextLost",value:function(e){e.preventDefault(),this.emit(u.k)}},{key:"handleContextRestored",value:function(){this.emit(u.l)}},{key:"onSceneLoad",value:function(){var e=this.getCamera();e&&(this.savedCameraPosition=e.getPosition(),this.savedCameraQuaternion=e.getQuaternion()),this.reset(),this.emit(u.g),this.initVr()}},{key:"toggleVr",value:function(){this.vrEnabled?this.disableVr():this.enableVr()}},{key:"onDisableVr",value:function(){this.enableCameraControls(),this.box3d.trigger("resize"),this.box3d.getRenderer().setAttribute("renderOnDemand",!0),this.hideVrGamepads();var e=this.box3d.getVrDisplay();this.vrEnabled=e&&e.isPresenting,this.resetView()}},{key:"onEnableVr",value:function(){this.disableCameraControls(),this.box3d.getRenderer().setAttribute("renderOnDemand",!1),this.showVrGamepads();var e=this.box3d.getVrDisplay();this.vrEnabled=e&&e.isPresenting}},{key:"enableVr",value:function(){this.vrEnabled||this.box3d.trigger("enableVrRendering")}},{key:"disableVr",value:function(){this.vrEnabled&&this.box3d.trigger("disableVrRendering")}},{key:"resize",value:function(){this.box3d&&this.box3d.trigger("resize")}},{key:"enableCameraControls",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"orbit_camera",t=this.getCamera(),n=t.getComponentByScriptId(e);n&&n.enable()}},{key:"disableCameraControls",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"orbit_camera",t=this.getCamera(),n=t.getComponentByScriptId(e);n&&n.disable()}},{key:"initVr",value:function(){var e=this;if(!Box3D.isTablet()){var t=this.box3d.getApplication(),n=t.getComponentByScriptId("vr_presenter");n&&n.whenDisplaysAvailable(function(t){t.length&&(e.emit(u.h),e.box3d.listenTo(e.box3d,"vrRenderingDisabled",e.onDisableVr.bind(e)),e.box3d.listenTo(e.box3d,"vrRenderingEnabled",e.onEnableVr.bind(e)),e.createVrGamepads())})}}},{key:"createVrGamepads",value:function(){var e=this;this.vrGamepads.length||(this.vrGamepads=[Box3D.Handedness.Left,Box3D.Handedness.Right].map(function(t){return e.createVrGamepad(t)}))}},{key:"createVrGamepad",value:function(e){var t=this,n=this.box3d.createNode(),i=function(e){var i=e.find(function(e){return"prefab"===e.type}),r=t.box3d.getAssetById(i.id);n.addChild(r.createInstance()),t.vrEnabled?t.showVrGamepads():t.hideVrGamepads()},r=function(e){var n=null,r=null;if(e.id.indexOf("Oculus")>-1)switch(r="oculusTouchCommon",e.hand){case"left":n="oculusTouchLeft";break;default:n="oculusTouchRight"}else e.id.indexOf("OpenVR")>-1&&(n="viveController");t.vrCommonLoadPromise||(t.vrCommonLoadPromise=r?t.box3d.importEntitiesFromUrl(t.staticBaseURI+"third-party/model3d/"+h.N+"/WebVR/"+r+"/entities.json",{isExternal:!0}):Promise.resolve()),t.vrGamepadLoadPromises[n]||(t.vrGamepadLoadPromises[n]=t.vrCommonLoadPromise.then(function(){return t.box3d.importEntitiesFromUrl(t.staticBaseURI+"third-party/model3d/"+h.N+"/WebVR/"+n+"/entities.json",{isExternal:!0})})),t.vrGamepadLoadPromises[n].then(i)},o=n.addComponent("motion_gamepad_device",{handPreference:e});return n.addComponent("intersection_checker",{objectTypeFilter:["mesh"]}),this.getScene().addChild(n),o.whenGamepadFound(r),n}},{key:"showVrGamepads",value:function(){this.vrGamepads.forEach(function(e){return e.setProperty("visible",!0)})}},{key:"hideVrGamepads",value:function(){this.vrGamepads.forEach(function(e){return e.setProperty("visible",!1)})}}]),t}(c.a);t.a=f},,,,,,,function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(4),s=n.n(a),l=n(3),c=n(5),u=function(){function e(e,t){for(var n=0;n0;)!function(){var t=e.handlers.pop();(t.type instanceof Array?t.type:[t.type]).forEach(function(e){t.eventObj.removeEventListener(e,t.func)})}()}},{key:"registerThread",value:function(e){var t=this,n=Object(l.a)(e,this.threads),i=n.page,r=n.pageThreads;this.threads[i]=r,this.emit(c.M.register,e),e.addListener("threadevent",function(n){return t.handleThreadEvents(e,n)})}},{key:"unregisterThread",value:function(e){var t=Object(l.B)(e,this.threads),n=t.page,i=t.pageThreads;this.threads[n]=i,this.emit(c.M.unregister,e),e.removeListener("threadevent",this.handleThreadEvents)}},{key:"getThreadByID",value:function(e){var t=this,n=null;return Object.keys(this.threads).some(function(i){var r=t.threads[i]||{};return e in r&&(n=r[e]),null!==n}),n}},{key:"removeSelection",value:function(){}},{key:"setupHandlers",value:function(){}},{key:"handleThreadEvents",value:function(e,t){switch(t.event){case c._35.save:case c._35.cancel:this.hadPendingThreads=!1,this.emit(t.event,t.data);break;case c._35.threadCleanup:this.unregisterThread(e);break;case c._35.threadDelete:this.unregisterThread(e),this.emit(t.event,t.data);break;case c._35.deleteError:this.emit(c.a.error,this.localized.deleteError),this.emit(t.event,t.data);break;case c._35.createError:this.emit(c.a.error,this.localized.createError),this.emit(t.event,t.data);break;default:this.emit(t.event,t.data)}}},{key:"pushElementHandler",value:function(e,t,n){e&&this.handlers.push({eventObj:e,func:n,type:t})}},{key:"setupHeader",value:function(e,t){var n=e.firstElementChild;Object(l.u)(e,t,n)}},{key:"destroyPendingThreads",value:function(){var e=this,t=!1;return Object.keys(this.threads).forEach(function(n){var i=e.threads[n]||{};Object.keys(i).forEach(function(e){var n=i[e];Object(l.y)(n.state)&&(t=!0,n.destroy())})}),t}},{key:"emit",value:function(e,n){h(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"emit",this).call(this,e,n),h(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"emit",this).call(this,"annotationcontrollerevent",{event:e,data:n,mode:this.mode})}}]),t}(s.a);t.a=d},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(4),s=n.n(a),l=n(2),c=n(1),u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},h=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:"",t=document.createElement("div");return t.classList.add(u.j),t.textContent=e,t}function o(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=document.createElement("button");return t.textContent=e,t.classList.add(h.d),t}function a(){var e=document.createElement("input");return e.type="checkbox",e}function s(){var e=document.createElement("div");return e.classList.add(u.h),e.classList.add(u.i),e.classList.add(u.g),e}function l(e){var t=document.createElement("div");if(t.classList.add(u.k),e){var n=r(e);t.appendChild(n)}return t}function c(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],i=l(e),r=document.createElement("div");r.classList.add(h.u);var a=document.createElement("div");a.classList.add(h.l),a.innerHTML="\n \n ';var s=o(t);s.addEventListener("click",function(){a.classList.toggle(h.G)});var c=a.querySelector("ul");return n.forEach(function(e){var t=document.createElement("li"),n=document.createElement("a");n.classList.add(h.h),n.textContent=e.text,n.addEventListener("click",function(){s.textContent=e.text,a.classList.toggle(h.G),e.callback()}),t.appendChild(n),c.appendChild(t)}),r.appendChild(s),r.appendChild(a),i.appendChild(r),i}n.d(t,"b",function(){return a}),n.d(t,"c",function(){return c}),n.d(t,"d",function(){return r}),n.d(t,"e",function(){return s}),n.d(t,"f",function(){return l}),n.d(t,"a",function(){return p});var u=n(22),h=n(1),d=function(){function e(e,t){for(var n=0;n\n \n "+o.g+"\n \n \n \n
\n ").trim(),this.messageEl=this.popupEl.querySelector("#"+r),this.buttonEl=this.popupEl.querySelector("button.bp-popup-btn"),this.closeButtonEl=this.popupEl.querySelector("button.bp-modal-close-button"),this.contentEl=this.popupEl.querySelector("div.bp-modal-content"),this.backdropEl=this.popupEl.querySelector("div.bp-modal-backdrop"),this.buttonDisabled=!1,this.popupEl.addEventListener("click",this.popupClickHandler),document.addEventListener("keydown",this.keydownHandler);var s=document.createElement("div");s.className="bp-popup-modal",s.appendChild(this.popupEl),t.appendChild(s)}return s(e,[{key:"destroy",value:function(){if(this.popupEl){this.popupEl.removeEventListener("click",this.popupClickHandler),document.removeEventListener("keydown",this.keydownHandler);var e=this.popupEl.parentNode;e.parentNode.removeChild(e),this.popupEl=null}}},{key:"show",value:function(e,t,n){this.messageEl.textContent=e,this.buttonEl.textContent=t||"Okay",n&&"function"==typeof n&&(this.buttonEl.handler=n),this.popupEl.classList.remove(r.A),this.popupEl.focus()}},{key:"hide",value:function(){this.popupEl.classList.add(r.A)}},{key:"addContent",value:function(e,t){t?this.contentEl.insertBefore(e,this.contentEl.firstChild):this.contentEl.appendChild(e)}},{key:"isVisible",value:function(){return!this.popupEl.classList.contains(r.A)}},{key:"isButtonDisabled",value:function(){return this.buttonDisabled}},{key:"disableButton",value:function(){this.buttonDisabled=!0,this.buttonEl.classList.add("is-disabled")}},{key:"enableButton",value:function(){this.buttonDisabled=!1,this.buttonEl.classList.remove("is-disabled")}}]),e}();t.a=l},function(e,t,n){"use strict";n.d(t,"c",function(){return r}),n.d(t,"a",function(){return a}),n.d(t,"d",function(){return s}),n.d(t,"b",function(){return l});var i=["csv","log","md","tsv","txt"],r=["htm","html","xhtml","xml","xsd","xsl"],o=["as","as3","asm","bat","c","cc","cmake","cpp","cs","css","cxx","diff","erb","groovy","h","haml","hh","java","js","json","less","m","make","ml","mm","php","pl","plist","properties","py","rb","rst","sass","scala","script","scm","sml","sql","sh","vi","vim","webdoc","yaml"],a=o.concat(i).concat(r).concat(["doc","docx","gdoc","gsheet","msg","odp","ods","odt","pdf","ppt","pptx","rtf","wpd","xls","xlsm","xlsx"]),s=o.concat(i),l=o.concat(r)},,,,,,,,,,,,,,,,,function(e,t,n){(function(e,n){function i(e,t){return e.set(t[0],t[1]),e}function r(e,t){return e.add(t),e}function o(e,t){for(var n=-1,i=e?e.length:0;++n-1}function C(e,t){var n=this.__data__,i=V(n,e);return i<0?n.push([e,t]):n[i][1]=t,this}function S(e){var t=-1,n=e?e.length:0;for(this.clear();++t-1&&e%1==0&&e-1&&e%1==0&&e<=Te}function ke(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Oe(e){return!!e&&"object"==typeof e}function Ce(e){return ye(e)?I(e):X(e)}function Se(){return[]}function Pe(){return!1}var xe=200,Le="__lodash_hash_undefined__",Te=9007199254740991,je="[object Arguments]",Ae="[object Boolean]",He="[object Date]",Re="[object Function]",Me="[object GeneratorFunction]",De="[object Map]",Be="[object Number]",Ie="[object Object]",Ne="[object RegExp]",Ve="[object Set]",Fe="[object String]",ze="[object Symbol]",Ue="[object ArrayBuffer]",qe="[object DataView]",We="[object Float32Array]",Ge="[object Float64Array]",Xe="[object Int8Array]",Ye="[object Int16Array]",Ze="[object Int32Array]",Ke="[object Uint8Array]",Je="[object Uint8ClampedArray]",Qe="[object Uint16Array]",$e="[object Uint32Array]",et=/[\\^$.*+?()[\]{}|]/g,tt=/\w*$/,nt=/^\[object .+?Constructor\]$/,it=/^(?:0|[1-9]\d*)$/,rt={};rt[je]=rt["[object Array]"]=rt[Ue]=rt[qe]=rt[Ae]=rt[He]=rt[We]=rt[Ge]=rt[Xe]=rt[Ye]=rt[Ze]=rt[De]=rt[Be]=rt[Ie]=rt[Ne]=rt[Ve]=rt[Fe]=rt[ze]=rt[Ke]=rt[Je]=rt[Qe]=rt[$e]=!0,rt["[object Error]"]=rt[Re]=rt["[object WeakMap]"]=!1;var ot="object"==typeof e&&e&&e.Object===Object&&e,at="object"==typeof self&&self&&self.Object===Object&&self,st=ot||at||Function("return this")(),lt="object"==typeof t&&t&&!t.nodeType&&t,ct=lt&&"object"==typeof n&&n&&!n.nodeType&&n,ut=ct&&ct.exports===lt,ht=Array.prototype,dt=Function.prototype,pt=Object.prototype,ft=st["__core-js_shared__"],vt=function(){var e=/[^.]+$/.exec(ft&&ft.keys&&ft.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),gt=dt.toString,mt=pt.hasOwnProperty,bt=pt.toString,yt=RegExp("^"+gt.call(mt).replace(et,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Et=ut?st.Buffer:void 0,wt=st.Symbol,_t=st.Uint8Array,kt=d(Object.getPrototypeOf,Object),Ot=Object.create,Ct=pt.propertyIsEnumerable,St=ht.splice,Pt=Object.getOwnPropertySymbols,xt=Et?Et.isBuffer:void 0,Lt=d(Object.keys,Object),Tt=se(st,"DataView"),jt=se(st,"Map"),At=se(st,"Promise"),Ht=se(st,"Set"),Rt=se(st,"WeakMap"),Mt=se(Object,"create"),Dt=ve(Tt),Bt=ve(jt),It=ve(At),Nt=ve(Ht),Vt=ve(Rt),Ft=wt?wt.prototype:void 0,zt=Ft?Ft.valueOf:void 0;f.prototype.clear=v,f.prototype.delete=g,f.prototype.get=m,f.prototype.has=b,f.prototype.set=y,E.prototype.clear=w,E.prototype.delete=_,E.prototype.get=k,E.prototype.has=O,E.prototype.set=C,S.prototype.clear=P,S.prototype.delete=x,S.prototype.get=L,S.prototype.has=T,S.prototype.set=j,A.prototype.clear=H,A.prototype.delete=R,A.prototype.get=M,A.prototype.has=D,A.prototype.set=B;var Ut=Pt?d(Pt,Object):Se,qt=W;(Tt&&qt(new Tt(new ArrayBuffer(1)))!=qe||jt&&qt(new jt)!=De||At&&"[object Promise]"!=qt(At.resolve())||Ht&&qt(new Ht)!=Ve||Rt&&"[object WeakMap]"!=qt(new Rt))&&(qt=function(e){var t=bt.call(e),n=t==Ie?e.constructor:void 0,i=n?ve(n):void 0;if(i)switch(i){case Dt:return qe;case Bt:return De;case It:return"[object Promise]";case Nt:return Ve;case Vt:return"[object WeakMap]"}return t});var Wt=Array.isArray,Gt=xt||Pe;n.exports=ge}).call(t,n(15),n(107)(e))},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(28),s=n(11),l=n(8),c=n(7),u=n(2),h=n(1),d=function(){function e(e,t){var n=[],i=!0,r=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(i=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);i=!0);}catch(e){r=!0,o=e}finally{try{!i&&s.return&&s.return()}finally{if(r)throw o}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),p=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:1;this.container=this.options.container,"string"==typeof this.options.container&&(this.container=document.querySelector(this.options.container)),this.annotatedElement=this.getAnnotatedEl(this.container),this.isMobile&&this.setupMobileDialog(),this.setScale(e),this.setupAnnotations(),this.loadAnnotations()}},{key:"isModeAnnotatable",value:function(e){if(!this.options.annotator)return!1;var t=this.options.annotator.TYPE;return!(e&&t&&!t.some(function(t){return e===t}))}},{key:"loadAnnotations",value:function(){var e=this;this.fetchPromise.then(function(){e.generateThreadMap(e.threadMap),e.renderAnnotations()}).catch(function(t){e.emit(h.a.loadError,t)})}},{key:"hideAnnotations",value:function(){var e=this;Object.keys(this.threads).forEach(function(t){e.hideAnnotationsOnPage(t)})}},{key:"hideAnnotationsOnPage",value:function(e){if(this.threads){var t=this.threads[e]||{};Object.keys(t).forEach(function(e){t[e].hide()})}}},{key:"setScale",value:function(e){this.annotatedElement.setAttribute("data-scale",e)}},{key:"getLocationFromEvent",value:function(e,t){}},{key:"createAnnotationThread",value:function(e,t,n){}},{key:"getAnnotatedEl",value:function(e){}},{key:"setupAnnotations",value:function(){this.threads={},this.bindDOMListeners(),this.bindCustomListenersOnService(this.annotationService),this.addListener(h.a.scale,this.scaleAnnotations),this.setupControllers()}},{key:"setupControllers",value:function(){var e=this;this.modeButtons=this.options.modeButtons||{};var t={header:this.options.header,isMobile:this.isMobile,hasTouch:this.hasTouch};Object.keys(this.modeControllers).forEach(function(n){var i=e.modeControllers[n];i.init({container:e.container,annotatedElement:e.annotatedElement,mode:n,modeButton:e.modeButtons[n],permissions:e.permissions,annotator:e,options:t}),i.addListener("annotationcontrollerevent",e.handleControllerEvents)})}},{key:"setupMobileDialog",value:function(){this.mobileDialogEl=document.createElement("div"),this.mobileDialogEl.setAttribute("data-type",h.P),this.mobileDialogEl.classList.add(h.I),this.mobileDialogEl.classList.add(h.l),this.mobileDialogEl.classList.add(h.E),this.mobileDialogEl.id=h._6,this.mobileDialogEl.innerHTML=('\n \n '+u.a+" \n
").trim(),this.container.appendChild(this.mobileDialogEl);var e=this.modeControllers[h._36.point];e&&e.setupSharedDialog(this.container,{isMobile:this.isMobile,hasTouch:this.hasTouch,localized:this.localized})}},{key:"fetchAnnotations",value:function(){var e=this;return this.threads={},this.permissions.canViewAllAnnotations||this.permissions.canViewOwnAnnotations?this.annotationService.getThreadMap(this.fileVersionId).then(function(t){e.threadMap=t,e.emit(h.a.fetch)}).catch(function(t){e.emit(h.a.loadError,t)}):Promise.resolve(this.threads)}},{key:"generateThreadMap",value:function(e){var t=this;this.options.annotator&&Object.keys(e).forEach(function(n){var i=e[n],r=c.o(i);if(r&&t.isModeAnnotatable(r.type)){var o=c.o(i),a=t.createAnnotationThread(i,o.location,o.type),s=t.modeControllers[o.type];s&&s.registerThread(a)}})}},{key:"bindDOMListeners",value:function(){}},{key:"unbindDOMListeners",value:function(){}},{key:"bindCustomListenersOnService",value:function(){var e=this.annotationService;e&&e instanceof l.a&&e.addListener(h.a.error,this.handleServicesErrors)}},{key:"unbindCustomListenersOnService",value:function(){var e=this.annotationService;e&&e instanceof l.a&&e.removeListener(h.a.error,this.handleServicesErrors)}},{key:"getThreadParams",value:function(e,t,n){var i={annotatedElement:this.annotatedElement,annotations:e,annotationService:this.annotationService,container:this.container,fileVersionId:this.fileVersionId,isMobile:this.isMobile,hasTouch:this.hasTouch,locale:this.locale,location:t,type:n,permissions:this.permissions,localized:this.localized},r=c.m(e);return r&&(i.threadID=r.threadID,i.threadNumber=r.threadNumber),i}},{key:"getCurrentAnnotationMode",value:function(){var e=this;return Object.keys(this.modeControllers).filter(function(t){return e.modeControllers[t].isEnabled()})[0]||null}},{key:"createPointThread",value:function(e){var t=e.commentText,n=e.lastPointEvent,i=e.pendingThreadID;if(!n||!i||!t||""===t.trim())return null;var r=this.getLocationFromEvent(n,h._36.point);if(!r)return null;var o=this.threads[r.page]||{},a=o[i];return a?(a.dialog.hasComments=!0,a.state=h._34.hover,a.showDialog(),a.dialog.postAnnotation(t),this.emit(h._35.threadSave,a.getThreadEventData()),a):null}},{key:"renderAnnotations",value:function(){var e=this;Object.keys(this.threads).forEach(function(t){e.renderAnnotationsOnPage(t)})}},{key:"renderAnnotationsOnPage",value:function(e){var t=this;if(this.threads){var n=this.threads[e]||{};Object.keys(n).forEach(function(e){var i=n[e];i.annotatedElement||(i.annotatedElement=t.annotatedElement),i.show()})}}},{key:"rotateAnnotations",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;t?this.renderAnnotationsOnPage(t):this.renderAnnotations();var n=this.modeControllers[h._36.point];if(this.permissions.canAnnotate&&n){var i=this.modeButtons[h._36.point].selector,r=n.getButton(i);0!==e?c.r(r):c.G(r)}}},{key:"getAnnotationPermissions",value:function(e){var t=e.permissions||{};return{canAnnotate:t.can_annotate||!1,canViewAllAnnotations:t.can_view_annotations_all||!1,canViewOwnAnnotations:t.can_view_annotations_self||!1}}},{key:"scaleAnnotations",value:function(e){this.setScale(e.scale),this.rotateAnnotations(e.rotationAngle,e.pageNum)}},{key:"toggleAnnotationMode",value:function(e){var t=this.getCurrentAnnotationMode();t&&this.modeControllers[t].exit(),t!==e&&this.modeControllers[e].enter()}},{key:"scrollToAnnotation",value:function(e){e&&Object.values(this.threads).forEach(function(t){if(e in t){t[e].scrollIntoView()}})}},{key:"handleValidationError",value:function(){this.validationErrorEmitted||(this.emit(h.a.error,this.localized.loadError),this.validationErrorEmitted=!0)}},{key:"handleServicesErrors",value:function(e){var t="";switch(e.reason){case"read":t=this.localized.loadError;break;case"create":t=this.localized.createError,this.loadAnnotations();break;case"delete":t=this.localized.deleteError,this.loadAnnotations();break;case"authorization":t=this.localized.authError}e.error,t&&this.emit(h.a.error,t)}},{key:"handleControllerEvents",value:function(e){var t={page:1,pageThreads:{}},n=e.data?e.data.headerSelector:"";switch(e.event){case h.M.toggleMode:this.toggleAnnotationMode(e.mode);break;case h.M.enter:this.emit(e.event,{mode:e.mode,headerSelector:n}),this.unbindDOMListeners();break;case h.M.exit:this.emit(e.event,{mode:e.mode,headerSelector:n}),this.bindDOMListeners();break;case h.M.register:t=c.a(e.data,this.threads),this.threads[t.page]=t.pageThreads,this.emit(e.event,e.data);break;case h.M.unregister:t=c.B(e.data,this.threads),this.threads[t.page]=t.pageThreads,this.emit(e.event,e.data);break;case h.M.createThread:this.createPointThread(e.data);break;default:this.emit(e.event,e.data)}}},{key:"emit",value:function(e,n){var i=this.options.annotator;p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"emit",this).call(this,e,n),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"emit",this).call(this,"annotatorevent",{event:e,data:n,annotatorName:i?i.NAME:"",fileVersionId:this.fileVersionId,fileId:this.fileId})}}]),t}(s.a);t.a=f},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(34),s=(n.n(a),n(4)),l=n.n(s),c=n(70),u=n(3),h=function(){function e(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=this.api+"/2.0/files/"+this.fileId+"/annotations?version="+e+"&fields=item,thread,details,message,created_by,created_at,modified_at,permissions";return t&&(i+="&marker="+t),n&&(i+="&limit="+n),i}},{key:"readFromMarker",value:function(e,t,n){var i=this,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;fetch(this.getReadUrl(n,r,o),{headers:this.headers}).then(function(e){return e.json()}).then(function(r){if("error"!==r.type&&Array.isArray(r.entries))r.entries.forEach(function(e){var t=i.createAnnotation(e);i.annotations[t.annotationID]=t}),r.next_marker?i.readFromMarker(e,t,n,r.next_marker,o):e(i.annotations);else{var a=new Error("Could not read annotations from file version with ID "+n);t(a),i.emit("annotationerror",{reason:"read",error:a.toString()})}}).catch(function(e){t(new Error("Could not read annotations from file due to invalid or expired token")),i.emit("annotationerror",{reason:"authorization",error:e.toString()})})}}]),t}(l.a);t.a=d},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var r=function e(t){i(this,e),this.annotationID=t.annotationID,this.fileVersionId=t.fileVersionId,this.threadID=t.threadID,this.threadNumber=t.threadNumber,this.type=t.type,this.text=t.text,this.location=t.location,this.user=t.user,this.permissions=t.permissions,this.created=t.created,this.modified=t.modified};t.a=r},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(72),s=n(132),l=n(134),c=n(5),u=n(29),h=n(3),d=function(){function e(e,t){var n=[],i=!0,r=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(i=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);i=!0);}catch(e){r=!0,o=e}finally{try{!i&&s.return&&s.return()}finally{if(r)throw o}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),p=function(){function e(e,t){for(var n=0;nthis.maxY&&(this.maxY=i),n>this.maxX&&(this.maxX=n),this.path.push(Object(r.d)(n,i)),t&&t.x&&t.y&&this.browserPath.push(t)}}},{key:"isEmpty",value:function(){return 0===this.path.length}},{key:"drawPath",value:function(e){var t=e;if(t&&this.browserPath)for(var n=this.browserPath.length,i=0;i0?(r=this.browserPath[i-1].x,o=this.browserPath[i-1].y):(r=this.browserPath[i].x,o=this.browserPath[i].y,t.moveTo(r,o));var a=(this.browserPath[i].x+r)/2,s=(this.browserPath[i].y+o)/2;t.quadraticCurveTo(r,o,a,s)}}},{key:"generateBrowserPath",value:function(e){this.path&&(this.browserPath=this.path.map(e))}}],[{key:"extractDrawingInfo",value:function(e,t){var n=t.paths,i={path:e.path};return n?n.push(i):n=[i],{minX:t.minX?Math.min(t.minX,e.minX):e.minX,maxX:t.maxX?Math.max(t.maxX,e.maxX):e.maxX,minY:t.minY?Math.min(t.minY,e.minY):e.minY,maxY:t.maxY?Math.max(t.maxY,e.maxY):e.maxY,paths:n}}}]),e}();t.a=a},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(4),s=n.n(a),l=n(136),c=n(3),u=n(5),h=function(){function e(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:{};i(this,t);var o=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return o.position={x:0,y:0},o.parentEl=e,o.isMobile=!!n.isMobile||!1,o.hasTouch=!!n.hasTouch||!1,o.localized=n.localized,o.isVisible=!1,o}return o(t,e),h(t,[{key:"setParentEl",value:function(e){this.parentEl=e}},{key:"setPosition",value:function(e,t){this.position.x=e,this.position.y=t,this.updatePosition()}},{key:"show",value:function(e){this.isVisible=!0,this.containerEl||this.createElement(),e&&this.setParentEl(e),this.setButtonVisibility(!0),Object(c.G)(this.containerEl),this.emit(u.N.init)}},{key:"showCommentBox",value:function(){this.commentBox.show(),this.commentBox.focus()}},{key:"hide",value:function(){this.isVisible=!1,this.containerEl&&(Object(c.r)(this.containerEl),this.commentBox&&(this.commentBox.hide(),this.commentBox.clear()))}},{key:"destroy",value:function(){this.containerEl&&(this.hide(),this.containerEl.removeEventListener("click",this.stopPropagation),this.containerEl.removeEventListener("mouseup",this.stopPropagation),this.containerEl.removeEventListener("dblclick",this.stopPropagation),this.hasTouch&&this.containerEl.removeEventListener("touchend",this.stopPropagation),this.containerEl.remove(),this.containerEl=null,this.parentEl=null,this.commentBox&&(this.commentBox.removeListener(l.a.CommentEvents.post,this.onCommentPost),this.commentBox.removeListener(l.a.CommentEvents.cancel,this.onCommentCancel),this.commentBox.destroy(),this.commentBox=null))}},{key:"updatePosition",value:function(){this.isMobile||(this.containerEl.style.left=this.position.x-1-this.containerEl.clientWidth/2+"px",this.containerEl.style.top=this.position.y+5+"px")}},{key:"onCommentPost",value:function(e){this.emit(u.N.post,e),e&&(this.commentBox.clear(),this.commentBox.blur())}},{key:"onCommentCancel",value:function(){this.emit(u.N.cancel),this.commentBox.hide(),this.setButtonVisibility(!0),this.updatePosition()}},{key:"setButtonVisibility",value:function(e){e?Object(c.G)(this.buttonsEl):Object(c.r)(this.buttonsEl)}},{key:"stopPropagation",value:function(e){e.stopPropagation()}},{key:"setupCommentBox",value:function(e){var t=new l.a(e,{hasTouch:this.hasTouch,localized:this.localized});return e.appendChild(t.containerEl),t.addListener(l.a.CommentEvents.post,this.onCommentPost.bind(this)),t.addListener(l.a.CommentEvents.cancel,this.onCommentCancel.bind(this)),t.hide(),t}},{key:"createElement",value:function(){this.containerEl=document.createElement("div"),this.containerEl.classList.add(u.J),this.containerEl.classList.add(u.l),this.containerEl.addEventListener("click",this.stopPropagation),this.containerEl.addEventListener("mouseup",this.stopPropagation),this.containerEl.addEventListener("dblclick",this.stopPropagation),this.hasTouch&&this.containerEl.addEventListener("touchend",this.stopPropagation),this.commentBox=this.setupCommentBox(this.containerEl),this.containerEl.appendChild(this.commentBox.containerEl)}}]),t}(s.a);t.a=d},function(e,t,n){"use strict";function i(e,t,n,i,r){var o=i.height,a=i.width,s=a/r,l=o/r;switch(n){case c:return[t,l-e];case u:return[s-e,l-t];case h:return[s-t,e]}return[e,t]}function r(e,t,n,i,r){var o=i.height,a=i.width;switch(n){case c:return[a/r-t,e];case u:return[a/r-e,o/r-t];case h:return[t,o/r-e]}return[e,t]}function o(e,t){var n=t.querySelector('[data-page-number="'+(e.page||1)+'"]')||t.querySelector("img"),r=t.getBoundingClientRect(),o=n.getBoundingClientRect(),c=a.q(t),h=o.top-r.top+t.scrollTop,d=o.left-r.left+t.scrollLeft,p=Number(n.getAttribute("data-rotation-angle")),f=i(e.x,e.y,p,o,c),v=s(f,2),g=v[0],m=v[1];return g*=c,m*=c,d>=0&&(g+=d),h>=0&&(m+=h),p===u&&(m-=l/2),[g,m]}t.b=r,t.a=o;var a=n(3),s=function(){function e(e,t){var n=[],i=!0,r=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(i=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);i=!0);}catch(e){r=!0,o=e}finally{try{!i&&s.return&&s.return()}finally{if(r)throw o}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),l=15,c=-90,u=-180,h=-270},function(e,t,n){(function(t){function n(e,t,n){function r(t){var n=v,i=g;return v=g=void 0,O=t,b=e.apply(i,n)}function o(e){return O=e,y=setTimeout(u,t),C?r(e):b}function l(e){var n=e-k,i=e-O,r=t-n;return S?w(r,m-i):r}function c(e){var n=e-k,i=e-O;return void 0===k||n>=t||n<0||S&&i>=m}function u(){var e=_();if(c(e))return h(e);y=setTimeout(u,l(e))}function h(e){return y=void 0,P&&v?r(e):(v=g=void 0,b)}function d(){void 0!==y&&clearTimeout(y),O=0,v=k=g=y=void 0}function p(){return void 0===y?b:h(_())}function f(){var e=_(),n=c(e);if(v=arguments,g=this,k=e,n){if(void 0===y)return o(k);if(S)return y=setTimeout(u,t),r(k)}return void 0===y&&(y=setTimeout(u,t)),b}var v,g,m,b,y,k,O=0,C=!1,S=!1,P=!0;if("function"!=typeof e)throw new TypeError(s);return t=a(t)||0,i(n)&&(C=!!n.leading,S="maxWait"in n,m=S?E(a(n.maxWait)||0,t):m,P="trailing"in n?!!n.trailing:P),f.cancel=d,f.flush=p,f}function i(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function r(e){return!!e&&"object"==typeof e}function o(e){return"symbol"==typeof e||r(e)&&y.call(e)==c}function a(e){if("number"==typeof e)return e;if(o(e))return l;if(i(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=i(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(u,"");var n=d.test(e);return n||p.test(e)?f(e.slice(2),n?2:8):h.test(e)?l:+e}var s="Expected a function",l=NaN,c="[object Symbol]",u=/^\s+|\s+$/g,h=/^[-+]0x[0-9a-f]+$/i,d=/^0b[01]+$/i,p=/^0o[0-7]+$/i,f=parseInt,v="object"==typeof t&&t&&t.Object===Object&&t,g="object"==typeof self&&self&&self.Object===Object&&self,m=v||g||Function("return this")(),b=Object.prototype,y=b.toString,E=Math.max,w=Math.min,_=function(){return m.Date.now()};e.exports=n}).call(t,n(15))},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(4),s=n.n(a),l=n(12),c=n(8),u=n(2),h=n(7),d=function(){function e(e,t){for(var n=0;n\n 1 \n \n / \n 1 \n ".replace(/>\s*<"),f=function(e){function t(e,n){i(this,t);var o=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return o.controls=e,o.controlsEl=e.controlsEl,o.contentEl=n,o.pageNumInputBlurHandler=o.pageNumInputBlurHandler.bind(o),o.pageNumInputKeydownHandler=o.pageNumInputKeydownHandler.bind(o),o.setPreviousPage=o.setPreviousPage.bind(o),o.showPageNumInput=o.showPageNumInput.bind(o),o.setNextPage=o.setNextPage.bind(o),o}return o(t,e),d(t,[{key:"add",value:function(e,t){this.controls.add("Previous page",this.setPreviousPage,"bp-previous-page-icon bp-previous-page",h.i),this.controls.add("Click to enter page number",this.showPageNumInput,"bp-page-num",p),this.controls.add("Next page",this.setNextPage,"bp-next-page-icon bp-next-page",h.h);var n=this.controlsEl.querySelector(".bp-page-num");this.totalPagesEl=n.querySelector(".bp-total-pages"),this.totalPagesEl.textContent=t,this.currentPageEl=n.querySelector(".bp-current-page"),this.currentPageEl.textContent=e,this.pageNumInputEl=n.querySelector(".bp-page-num-input"),this.checkPaginationButtons()}},{key:"showPageNumInput",value:function(){this.controlsEl.classList.add("show-page-number-input"),this.pageNumInputEl.value=this.getCurrentPageNumber(),this.pageNumInputEl.focus(),this.pageNumInputEl.select(),this.pageNumInputEl.addEventListener("blur",this.pageNumInputBlurHandler),this.pageNumInputEl.addEventListener("keydown",this.pageNumInputKeydownHandler)}},{key:"hidePageNumInput",value:function(){this.controlsEl.classList.remove("show-page-number-input"),this.pageNumInputEl.removeEventListener("blur",this.pageNumInputBlurHandler),this.pageNumInputEl.removeEventListener("keydown",this.pageNumInputKeydownHandler)}},{key:"checkPaginationButtons",value:function(){var e=this.controlsEl.querySelector(".bp-page-num"),t=this.controlsEl.querySelector(".bp-previous-page"),n=this.controlsEl.querySelector(".bp-next-page"),i="Safari"===c.a.getName()&&l.a.isFullscreen(this.controlsEl);e&&(this.getTotalPages()<=1||i?e.disabled=!0:e.disabled=!1),t&&(1===this.getCurrentPageNumber()?t.disabled=!0:t.disabled=!1),n&&(this.getCurrentPageNumber()===this.getTotalPages()?n.disabled=!0:n.disabled=!1)}},{key:"updateCurrentPage",value:function(e){this.pageNumInputEl&&(this.pageNumInputEl.value=e),this.currentPageEl&&this.setCurrentPageNumber(e),this.checkPaginationButtons()}},{key:"setPreviousPage",value:function(){this.emit("pagechange",this.getCurrentPageNumber()-1)}},{key:"setNextPage",value:function(){this.emit("pagechange",this.getCurrentPageNumber()+1)}},{key:"getCurrentPageNumber",value:function(){return parseInt(this.currentPageEl.textContent,10)}},{key:"setCurrentPageNumber",value:function(e){this.currentPageEl.textContent=e}},{key:"getTotalPages",value:function(){return parseInt(this.totalPagesEl.textContent,10)}},{key:"pageNumInputBlurHandler",value:function(e){var t=e.target,n=parseInt(t.value,10);Number.isNaN(n)||this.emit("pagechange",n),this.hidePageNumInput()}},{key:"pageNumInputKeydownHandler",value:function(e){switch(Object(u.i)(e)){case"Enter":case"Tab":this.contentEl.focus(),"Explorer"!==c.a.getName()&&e.target.blur(),e.stopPropagation(),e.preventDefault();break;case"Escape":this.hidePageNumInput(),this.contentEl.focus(),e.stopPropagation(),e.preventDefault()}}}]),t}(s.a);t.a=f},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(10),s=n(2),l=function(){function e(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:[],i=c(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"determineViewer",this).call(this,e,n);if(i&&Object(s.x)(e))return i}}]),t}(a.a);t.a=u},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(11),s=n(12),l=n(46),c=n(37),u=n(8),h=n(79),d=n(2),p=n(16),f=n(80),v=n(200),g=(n.n(v),function(){function e(e,t){for(var n=0;n\n Okay \n ').trim(),this.messageEl=this.notificationEl.querySelector("#"+r),this.buttonEl=this.notificationEl.querySelector("button");var o=document.createElement("div");o.className="bp-notifications-wrapper",o.appendChild(this.notificationEl),t.appendChild(o)}return o(e,[{key:"show",value:function(e,t){this.messageEl.textContent=e,this.buttonEl.textContent=t||"Okay",this.notificationEl.classList.remove(r.A),this.notificationEl.focus(),this.timeout=setTimeout(this.hide.bind(this),5e3)}},{key:"hide",value:function(){this.timeout&&(clearTimeout(this.timeout),this.timeout=null),this.notificationEl&&this.notificationEl.classList.add(r.A)}}]),e}();t.a=a},function(e,t,n){"use strict";var i=n(1),r="third-party/model3d/"+i.N+"/",o=[r+"boxsdk.min.js",r+"three.min.js",r+"box3d-runtime.min.js",r+"webvr-polyfill.js",r+"WebVR/VRConfig.js"];t.a=o},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(206),s=(n.n(a),n(82)),l=n(8),c=n(48),u=n(1),h=n(7),d=n(49),p=n(2),f=function(){function e(e,t){for(var n=0;ng;var s=o.truncated?{Range:"bytes=0-"+g}:{};Object(p.k)(o.createContentUrlWithAuthParams(i),s,"text").then(function(e){if(!o.isDestroyed()){var t=e;o.truncated&&(t+="..."),-1===d.b.indexOf(r)?o.finishLoading(t,!1):o.initHighlightJs(t)}}).catch(o.handleAssetError)},a=n,r(o,a)}return o(t,e),f(t,[{key:"destroy",value:function(){if(this.textEl){var e=this.textEl.querySelector(".bp-btn-download");e&&e.removeEventListener("click",this.download.bind(this))}this.printIframe=null,v(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"destroy",this).call(this)}},{key:"load",value:function(){this.setup(),v(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"load",this).call(this);var e=this.loadAssets(this.getJS(),this.getCSS());return Promise.all([e,this.getRepStatus().getPromise()]).then(this.postLoad).catch(this.handleAssetError)}},{key:"prefetch",value:function(e){var t=e.assets,n=void 0===t||t,i=e.content,r=void 0===i||i;n&&this.prefetchAssets(this.getJS(),this.getCSS());var o=this.options.representation;if(r&&this.isRepresentationReady(o)){var a=o.content.url_template;Object(p.k)(this.createContentUrlWithAuthParams(a),"any")}}},{key:"print",value:function(){var e=this;if(!this.printReady)return this.preparePrint(this.getCSS().concat("preview.css")),this.printPopup.show("Preparing to print...","Print",function(){e.printPopup.hide(),e.printIframe()}),void this.printPopup.disableButton();this.printIframe(),this.emit("printsuccess")}},{key:"setup",value:function(){v(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setup",this).call(this),this.textEl=this.containerEl.appendChild(document.createElement("pre")),this.textEl.className="bp-text bp-text-plain hljs",this.textEl.classList.add(u.A),this.codeEl=this.textEl.appendChild(document.createElement("code")),this.codeEl.classList.add(this.options.file.extension),this.truncated=!1,this.initPrint()}},{key:"getJS",value:function(){return b}},{key:"getCSS",value:function(){return y}},{key:"finishLoading",value:function(e,t){t?this.codeEl.innerHTML=e:this.codeEl.textContent=e,this.loadUI(),this.textEl.classList.remove(u.A),this.loaded=!0,this.emit("load"),this.truncated&&this.showTruncatedDownloadButton(),this.workerSrc&&URL.revokeObjectURL(this.workerSrc)}},{key:"initHighlightJs",value:function(e){var t=this,n=new Blob(["onmessage=function(e){importScripts(e.data.highlightSrc);postMessage(self.hljs.highlightAuto(e.data.text).value)};"],{type:"application/javascript"});this.workerSrc=URL.createObjectURL(n);var i=new Worker(this.workerSrc);i.onmessage=function(e){t.finishLoading(e.data,!0)};var r=Object(p.e)(this.options.location),o=r("third-party/text/"+u._15+"/highlight.min.js");i.postMessage({highlightSrc:o,text:e})}},{key:"initPrint",value:function(){this.printPopup=new c.a(this.containerEl);var e=document.createElement("div");e.className="bp-print-check "+u.A,e.innerHTML=h.r.trim();var t=document.createElement("div");t.classList.add("bp-crawler"),t.innerHTML="\n
\n
\n
".trim(),this.printPopup.addContent(t,!0),this.printPopup.addContent(e,!0),this.printPopup.loadingIndicator=t,this.printPopup.printCheckmark=e}},{key:"preparePrint",value:function(e){var t=this,n=Object(p.e)(this.options.location);this.printframe=Object(p.q)(this.textEl.outerHTML),e.forEach(function(e){t.printframe.contentDocument.head.appendChild(Object(p.h)(n(e)))}),setTimeout(function(){t.printPopup&&(t.printPopup.enableButton(),t.printPopup.messageEl.textContent="Ready to print.",t.printPopup.loadingIndicator.classList.add(u.A),t.printPopup.printCheckmark.classList.remove(u.A)),t.printReady=!0},5e3)}},{key:"printIframe",value:function(){this.printframe.contentWindow.focus(),"Explorer"===l.a.getName()||"Edge"===l.a.getName()?this.printframe.contentWindow.document.execCommand("print",!1,null):this.printframe.contentWindow.print()}},{key:"showTruncatedDownloadButton",value:function(){var e=document.createElement("div");e.classList.add("bp-text-truncated");var t=document.createElement("p");t.textContent="This file has been truncated due to size limits. Please download to view the whole file.";var n=document.createElement("button");n.className="bp-btn bp-btn-primary bp-btn-download",n.textContent="Download File",e.appendChild(t),e.appendChild(n),this.textEl.appendChild(e),n.addEventListener("click",this.download.bind(this))}},{key:"download",value:function(){this.emit("download")}}]),t}(s.a);t.a=E},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(28),s=n(11),l=n(13),c=n(1),u=n(7),h=function(){function e(e,t){for(var n=0;n0&&this.emit("ratechange",e),this.mediaEl.playbackRate=e}},{key:"handleVolume",value:function(){var e=this.cache.has("media-volume")?this.cache.get("media-volume"):1;0!==e&&(this.oldVolume=e),this.mediaEl.volume!==e&&(this.debouncedEmit("volume",e),this.mediaEl.volume=e)}},{key:"handleAutoplay",value:function(){this.emit("autoplay",this.isAutoplayEnabled())}},{key:"autoplay",value:function(){var e=this,t=this.mediaEl.play();t&&"function"==typeof t.then?t.then(function(){e.handleRate(),e.handleVolume()}).catch(function(){e.pause()}):this.mediaEl.autoplay=!0}},{key:"isAutoplayEnabled",value:function(){return"Enabled"===this.cache.get("media-autoplay")}},{key:"loadUI",value:function(){this.mediaControls=new u.a(this.mediaContainerEl,this.mediaEl,this.cache),this.addEventListenersForMediaControls(),this.addEventListenersForMediaElement()}},{key:"handleTimeupdateFromMediaControls",value:function(e){this.removePauseEventListener(),this.setMediaTime(e)}},{key:"addEventListenersForMediaControls",value:function(){this.mediaControls.addListener("timeupdate",this.handleTimeupdateFromMediaControls),this.mediaControls.addListener("volumeupdate",this.setVolume),this.mediaControls.addListener("toggleplayback",this.togglePlay),this.mediaControls.addListener("togglemute",this.toggleMute),this.mediaControls.addListener("ratechange",this.handleRate),this.mediaControls.addListener("autoplaychange",this.handleAutoplay)}},{key:"setTimeCode",value:function(){this.mediaControls.setTimeCode(this.mediaEl.currentTime)}},{key:"setMediaTime",value:function(e){this.mediaEl.currentTime=e}},{key:"setVolume",value:function(e){this.cache.set("media-volume",e,!0),this.handleVolume()}},{key:"updateVolumeIcon",value:function(){this.mediaControls.updateVolumeIcon(this.mediaEl.volume)}},{key:"playingHandler",value:function(){this.mediaControls.showPauseIcon(),this.hideLoadingIcon(),this.handleRate(),this.handleVolume(),this.emit("play")}},{key:"progressHandler",value:function(){this.mediaControls.updateProgress()}},{key:"pauseHandler",value:function(){this.mediaControls.showPlayIcon()}},{key:"seekHandler",value:function(){this.hideLoadingIcon(),this.debouncedEmit("seeked",this.mediaEl.currentTime)}},{key:"mediaendHandler",value:function(){this.isAutoplayEnabled()&&this.emit("mediaendautoplay")}},{key:"showPlayButton",value:function(){this.playButtonEl&&this.playButtonEl.classList.remove(h.A)}},{key:"hidePlayButton",value:function(){this.playButtonEl&&this.playButtonEl.classList.add(h.A)}},{key:"resetPlayIcon",value:function(){this.mediaControls.setTimeCode(0),this.hideLoadingIcon(),this.pauseHandler()}},{key:"removePauseEventListener",value:function(){this.mediaEl&&this.pauseListener&&this.mediaEl.removeEventListener("timeupdate",this.pauseListener)}},{key:"isValidTime",value:function(e){return"number"==typeof e&&Number.isFinite(e)&&e>=0&&e<=this.mediaEl.duration}},{key:"play",value:function(e,t){var n=this.isValidTime(e),i=this.isValidTime(t);this.removePauseEventListener(),n&&(i&&ee&&t.pause()},this.mediaEl.addEventListener("timeupdate",this.pauseListener)):(this.mediaEl.pause(),this.emit("pause"))}},{key:"togglePlay",value:function(){this.mediaEl.paused?this.play():this.pause()}},{key:"toggleMute",value:function(){this.mediaEl.volume?(this.oldVolume=this.mediaEl.volume,this.cache.set("media-volume",0,!0)):this.cache.set("media-volume",this.oldVolume,!0),this.handleVolume()}},{key:"hideLoadingIcon",value:function(){this.containerEl&&this.containerEl.classList.remove(h.C)}},{key:"showLoadingIcon",value:function(){this.containerEl&&this.mediaEl&&!this.mediaEl.paused&&!this.mediaEl.ended&&(this.containerEl.classList.add(h.C),this.hidePlayButton())}},{key:"addEventListenersForMediaElement",value:function(){this.mediaEl.addEventListener("timeupdate",this.setTimeCode),this.mediaEl.addEventListener("progress",this.progressHandler),this.mediaEl.addEventListener("volumechange",this.updateVolumeIcon),this.mediaEl.addEventListener("playing",this.playingHandler),this.mediaEl.addEventListener("pause",this.pauseHandler),this.mediaEl.addEventListener("ended",this.resetPlayIcon),this.mediaEl.addEventListener("seeked",this.seekHandler),this.mediaEl.addEventListener("ended",this.mediaendHandler)}},{key:"quickSeek",value:function(e){var t=this.mediaEl.currentTime+e;this.removePauseEventListener(),t=Math.max(0,Math.min(t,this.mediaEl.duration)),this.setMediaTime(t)}},{key:"increaseVolume",value:function(){var e=Math.round(100*(this.mediaEl.volume+.05))/100;e=Math.min(1,e),this.setVolume(e)}},{key:"decreaseVolume",value:function(){var e=Math.round(100*(this.mediaEl.volume-.05))/100;e=Math.max(0,e),this.setVolume(e)}},{key:"onKeydown",value:function(e){if(!this.mediaControls)return!1;switch(e.toLowerCase()){case"tab":case"shift+tab":return this.mediaContainerEl.classList.add(h.x),this.mediaControls.show(),!1;case"space":case"k":this.togglePlay();break;case"arrowleft":this.mediaControls.isVolumeScrubberFocused()?this.decreaseVolume():this.quickSeek(-5);break;case"j":this.quickSeek(-10);break;case"arrowright":this.mediaControls.isVolumeScrubberFocused()?this.increaseVolume():this.quickSeek(5);break;case"l":this.quickSeek(10);break;case"0":case"home":this.setMediaTime(0);break;case"arrowup":this.mediaControls.isTimeScrubberFocused()?this.quickSeek(5):this.increaseVolume();break;case"arrowdown":this.mediaControls.isTimeScrubberFocused()?this.quickSeek(-5):this.decreaseVolume();break;case"shift+>":this.mediaControls.increaseSpeed();break;case"shift+<":this.mediaControls.decreaseSpeed();break;case"f":case"shift+f":this.mediaControls.toggleFullscreen();break;case"m":case"shift+m":this.toggleMute();break;case"c":case"shift+c":this.mediaControls.toggleSubtitles();break;default:return!1}return this.mediaControls.show(),!0}}]),t}(l.a);t.a=v},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(27),s=n.n(a),l=n(83),c=n(1),u=n(7),h=function(){function e(e,t){for(var n=0;n1&&this.emit("error",t)}},{key:"addEventListenersForMediaControls",value:function(){f(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"addEventListenersForMediaControls",this).call(this),this.mediaControls.addListener("qualitychange",this.handleQuality),this.mediaControls.addListener("subtitlechange",this.handleSubtitle),this.mediaControls.addListener("audiochange",this.handleAudioTrack)}},{key:"loadSubtitles",value:function(){this.textTracks=this.player.getTextTracks().sort(function(e,t){return e.id-t.id}),this.textTracks.length>0&&this.mediaControls.initSubtitles(this.textTracks.map(function(e){return Object(d.a)(e.language)||e.language}),Object(d.a)(this.options.location.locale.substring(0,2)))}},{key:"loadAlternateAudio",value:function(){var e=this.player.getVariantTracks().sort(function(e,t){return e.audioId-t.audioId}),t=[],n=[],i=0;for(i=0;i1){var o=this.audioTracks.map(function(e){return Object(d.a)(e.language)||e.language});this.mediaControls.initAlternateAudio(o)}}},{key:"loadeddataHandler",value:function(){this.isDestroyed()||(this.isAutoplayEnabled()&&this.autoplay(),this.calculateVideoDimensions(),this.loadUI(),this.loadFilmStrip(),this.resize(),this.handleVolume(),this.startBandwidthTracking(),this.handleQuality(),this.loadSubtitles(),this.loadAlternateAudio(),this.showPlayButton(),this.loaded=!0,this.emit("load"),this.showMedia(),this.mediaControls.show(),this.mediaContainerEl.focus())}},{key:"loadUI",value:function(){f(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"loadUI",this).call(this),-1!==this.hdVideoId&&this.mediaControls.enableHDSettings()}},{key:"loadFilmStrip",value:function(){var e=Object(c.f)(this.options.file,"filmstrip");if(e&&e.metadata&&e.metadata.interval>0){var t=this.createContentUrlWithAuthParams(e.content.url_template);this.filmstripStatus=this.getRepStatus(e),this.mediaControls.initFilmstrip(t,this.filmstripStatus,this.aspect,e.metadata.interval)}}},{key:"calculateVideoDimensions",value:function(){var e=this.player.getVariantTracks(),t=e.reduce(function(e,t){return e.width>t.width?e:t}),n=e.reduce(function(e,t){return e.width=1?this.mediaEl.style.width=e+"px":this.mediaEl.style.width=n*this.aspect+"px";else{var r=(i.height-n)/n,o=e+e*r;n+n*((i.width-e)/e)<=i.height?this.mediaEl.style.width=i.width+"px":o<=i.width&&(this.mediaEl.style.width=i.height*this.aspect+"px")}f(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"resize",this).call(this)}},{key:"getBandwidthInterval",value:function(){if(!this.isDestroyed()&&this.player&&this.player.getStats&&!this.mediaEl.paused&&!this.mediaEl.ended){var e=this.player.getStats(),t=e.estimatedBandwidth,n=e.switchHistory,i=e.streamBandwidth;this.bandwidthHistory.push({bandwidth:t,stream:i}),this.switchHistory.push({switchHistory:n,stream:i}),this.statsEl&&(this.statsEl.textContent=Math.round(t/1e3)+" kbps")}}},{key:"startBandwidthTracking",value:function(){this.statsIntervalId=setInterval(this.getBandwidthInterval,3e3)}},{key:"removeStats",value:function(){this.statsEl&&this.mediaContainerEl&&this.mediaContainerEl.removeChild(this.statsEl),this.statsEl=void 0}},{key:"toggleStats",value:function(){if(this.statsEl)return void this.removeStats();this.statsEl=this.mediaContainerEl.appendChild(document.createElement("div")),this.statsEl.className="bp-media-dash-stats",this.statsEl.textContent="?!? kbps"}},{key:"onKeydown",value:function(e){return"Shift+I"===e&&this.player?(this.toggleStats(),!0):f(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"onKeydown",this).call(this,e)}}]),t}(a.a);t.a=v},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(27),s=n.n(a),l=n(11),c=n(8),u=n(28),h=n(76),d=n(231),p=n(12),f=n(48),v=n(45),g=n(1),m=n(13),b=n(2),y=n(7),E=n(232),w=function(){function e(e,t){for(var n=0;n1&&void 0!==arguments[1]&&arguments[1];this.findBar&&(this.setPage(1),this.findBar.setFindFieldElValue(e),this.findBar.findFieldHandler(),t&&this.findBar.open())}},{key:"print",value:function(){var e=this;if(!this.printBlob)return this.fetchPrintBlob(this.pdfUrl).then(this.print),void(this.printDialogTimeout=setTimeout(function(){e.printPopup.show("Preparing to print...","Print",function(){e.printPopup.hide(),e.browserPrint()}),e.printPopup.disableButton(),e.printDialogTimeout=null},500));this.printDialogTimeout||!this.printPopup.isVisible()?(clearTimeout(this.printDialogTimeout),this.browserPrint()):(this.printPopup.enableButton(),this.printPopup.messageEl.textContent="Ready to print.",this.printPopup.loadingIndicator.classList.add(g.A),this.printPopup.printCheckmark.classList.remove(g.A))}},{key:"previousPage",value:function(){this.setPage(this.pdfViewer.currentPageNumber-1)}},{key:"nextPage",value:function(){this.setPage(this.pdfViewer.currentPageNumber+1)}},{key:"setPage",value:function(e){!e||e<1||e>this.pdfViewer.pagesCount||(this.pdfViewer.currentPageNumber=e,this.cachePage(this.pdfViewer.currentPageNumber))}},{key:"getCachedPage",value:function(){var e=1;if(this.cache.has("doc-current-page-map")){e=this.cache.get("doc-current-page-map")[this.options.file.id]||e}return e}},{key:"cachePage",value:function(e){var t={};this.cache.has("doc-current-page-map")&&(t=this.cache.get("doc-current-page-map")),t[this.options.file.id]=e,this.cache.set("doc-current-page-map",t,!0)}},{key:"zoomIn",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=e,n=this.pdfViewer.currentScale;do{n=(1.1*n).toFixed(3),n=Math.min(10,n),t-=1}while(t>0&&n<10);this.pdfViewer.currentScale!==n&&this.emit("zoom",{zoom:n,canZoomOut:!0,canZoomIn:n<10}),this.pdfViewer.currentScaleValue=n}},{key:"zoomOut",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=e,n=this.pdfViewer.currentScale;do{n=(n/1.1).toFixed(3),n=Math.max(.1,n),t-=1}while(t>0&&n>.1);this.pdfViewer.currentScale!==n&&this.emit("zoom",{zoom:n,canZoomOut:n>.1,canZoomIn:!0}),this.pdfViewer.currentScaleValue=n}},{key:"onKeydown",value:function(e){switch(e){case"ArrowLeft":this.previousPage();break;case"ArrowRight":this.nextPage();break;case"[":this.previousPage();break;case"]":this.nextPage();break;default:return!1}return!0}},{key:"initViewer",value:function(e){var t=this;this.bindDOMListeners(),this.pdfViewer=new PDFJS.PDFViewer({container:this.docEl,linkService:new PDFJS.PDFLinkService,enhanceTextSelection:!this.isMobile});var n=this.getViewerOption("rangeChunkSize");n||(n="en-US"===this.options.location.locale?1048576:524288);var i={url:e,rangeChunkSize:n};return c.a.isIOS()&&(i.httpHeaders={"If-None-Match":"webkit-no-cache"}),this.pdfLoadingTask=PDFJS.getDocument(i),this.pdfLoadingTask.then(function(n){t.pdfViewer.setDocument(n);var i=t.pdfViewer.linkService;i instanceof PDFJS.PDFLinkService&&(i.setDocument(n,e),i.setViewer(t.pdfViewer))}).catch(function(e){var n=e;e instanceof Error&&(n.displayMessage="We're sorry, the preview didn't load. This document may be protected."),t.triggerError(e)})}},{key:"resize",value:function(){if(this.pdfViewer&&this.pdfViewer.pageViewsReady){var e=this.pdfViewer.currentPageNumber.currentPageNumber;this.pdfViewer.currentScaleValue=this.pdfViewer.currentScaleValue||"auto",this.pdfViewer.update(),this.setPage(e),_(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"resize",this).call(this)}}},{key:"setupPdfjs",value:function(){var e=this.options,t=e.file,n=e.location,i=t.size,r=t.watermark_info,o=Object(b.e)(n);PDFJS.workerSrc=o("third-party/doc/"+g.K+"/pdf.worker.min.js"),PDFJS.imageResourcesPath=o("third-party/doc/"+g.K+"/images/"),PDFJS.cMapUrl=n.staticBaseURI+"third-party/doc/"+g.K+"/cmaps/",PDFJS.cMapPacked=!0,PDFJS.externalLinkTarget=PDFJS.LinkTarget.BLANK,PDFJS.disableStream=!0,PDFJS.disableFontFace=PDFJS.disableFontFace||c.a.hasFontIssue(),PDFJS.disableRange="en-US"!==n.locale&&i<26214400,PDFJS.disableRange=PDFJS.disableRange||r&&r.is_watermarked,PDFJS.disableTextLayer=!Object(m.d)(t,g.T)||!!this.getViewerOption("disableTextLayer"),PDFJS.maxCanvasPixels=this.isMobile?2949120:PDFJS.maxCanvasPixels,PDFJS.disableCreateObjectURL=!1;var a=PDFJS.PDFPageView.prototype.reset;PDFJS.PDFPageView.prototype.reset=function(){for(var e=arguments.length,t=Array(e),n=0;n"}}},{key:"initPrint",value:function(){this.printPopup=new f.a(this.containerEl);var e=document.createElement("div");e.className="bp-print-check "+g.A,e.innerHTML=y.r.trim();var t=document.createElement("div");t.classList.add(g.v),t.innerHTML="\n
\n
\n
".trim(),this.printPopup.addContent(t,!0),this.printPopup.addContent(e,!0),this.printPopup.loadingIndicator=t,this.printPopup.printCheckmark=e}},{key:"setupPageIds",value:function(){var e=this.containerEl.querySelectorAll(".page");[].forEach.call(e,function(e){var t=e.dataset.pageNumber;t&&(e.id="bp-page-"+t)})}},{key:"fetchPrintBlob",value:function(e){var t=this;return Object(b.k)(e,"blob").then(function(e){t.printBlob=e})}},{key:"browserPrint",value:function(){if("function"==typeof window.navigator.msSaveOrOpenBlob){window.navigator.msSaveOrOpenBlob(this.printBlob,"print.pdf")?this.emit("printsuccess"):this.emit("printerror")}else{this.printURL||(this.printURL=URL.createObjectURL(this.printBlob));var e=window.open(this.printURL);if(e&&"function"==typeof e.print){var t=c.a.getName();"Chrome"===t?e.addEventListener("load",function(){e.print()}):"Safari"===t&&setTimeout(function(){e.print()},1e3)}!e||e.closed||void 0===e.closed?this.emit("printerror"):this.emit("printsuccess")}}},{key:"loadUI",value:function(){this.controls=new u.a(this.containerEl),this.pageControls=new h.a(this.controls,this.docEl),this.pageControls.addListener("pagechange",this.setPage),this.bindControlListeners()}},{key:"bindDOMListeners",value:function(){this.docEl.addEventListener("pagesinit",this.pagesinitHandler),this.docEl.addEventListener("pagerendered",this.pagerenderedHandler),this.docEl.addEventListener("pagechange",this.pagechangeHandler),this.docEl.addEventListener("scroll",this.throttledScrollHandler),p.a.addListener("enter",this.enterfullscreenHandler),p.a.addListener("exit",this.exitfullscreenHandler),this.isMobile&&(c.a.isIOS()?(this.docEl.addEventListener("gesturestart",this.mobileZoomStartHandler),this.docEl.addEventListener("gestureend",this.mobileZoomEndHandler)):(this.docEl.addEventListener("touchstart",this.mobileZoomStartHandler),this.docEl.addEventListener("touchmove",this.mobileZoomChangeHandler),this.docEl.addEventListener("touchend",this.mobileZoomEndHandler)))}},{key:"unbindDOMListeners",value:function(){this.docEl&&(this.docEl.removeEventListener("pagesinit",this.pagesinitHandler),this.docEl.removeEventListener("pagerendered",this.pagerenderedHandler),this.docEl.removeEventListener("pagechange",this.pagechangeHandler),this.docEl.removeEventListener("scroll",this.throttledScrollHandler),this.isMobile&&(c.a.isIOS()?(this.docEl.removeEventListener("gesturestart",this.mobileZoomStartHandler),this.docEl.removeEventListener("gestureend",this.mobileZoomEndHandler)):(this.docEl.removeEventListener("touchstart",this.mobileZoomStartHandler),this.docEl.removeEventListener("touchmove",this.mobileZoomChangeHandler),this.docEl.removeEventListener("touchend",this.mobileZoomEndHandler)))),p.a.removeListener("enter",this.enterfullscreenHandler),p.a.removeListener("exit",this.exitfullscreenHandler)}},{key:"bindControlListeners",value:function(){}},{key:"pagesinitHandler",value:function(){this.pdfViewer.currentScaleValue="auto",this.loadUI(),this.setPage(this.getCachedPage()),this.docEl.classList.add(g.D),this.loaded||(this.loaded=!0,this.emit("load",{numPages:this.pdfViewer.pagesCount,endProgress:!1,scale:this.pdfViewer.currentScale}),this.setupPageIds())}},{key:"pagerenderedHandler",value:function(e){var t=e.detail?e.detail.pageNumber:void 0;t&&(this.emit("pagerender",t),this.emit("scale",{scale:this.pdfViewer.currentScale,pageNum:t}),this.somePageRendered||(this.hidePreload(),this.emit("progressend"),this.somePageRendered=!0))}},{key:"pagechangeHandler",value:function(e){var t=e.pageNumber;this.pageControls.updateCurrentPage(t),this.loaded&&this.cachePage(t),this.emit("pagefocus",t)}},{key:"enterfullscreenHandler",value:function(){this.pdfViewer.currentScaleValue="page-fit",this.resize()}},{key:"exitfullscreenHandler",value:function(){this.pdfViewer.currentScaleValue="auto",this.resize()}},{key:"getScrollHandler",value:function(){var e=this;return s()(function(){e.scrollTimer&&clearTimeout(e.scrollTimer),e.scrollStarted||(e.emit("scrollstart",{scrollTop:e.docEl.scrollTop,scrollLeft:e.docEl.scrollLeft}),e.scrollStarted=!0),e.scrollTimer=setTimeout(function(){e.emit("scrollend",{scrollTop:e.docEl.scrollTop,scrollLeft:e.docEl.scrollLeft}),e.scrollStarted=!1},k)},200)}}]),t}(l.a);t.a=O},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(4),s=n.n(a),l=n(1),c=n(2),u=function(){function e(e,t){for(var n=0;n
',v=function(e){function t(e){i(this,t);var n=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.maxZoomScale=l.R,n.cleanupPreload=function(){n.wrapperEl&&(n.wrapperEl.parentNode.removeChild(n.wrapperEl),n.wrapperEl=void 0),n.preloadEl=void 0,n.imageEl=void 0,n.srcUrl&&URL.revokeObjectURL(n.srcUrl)},n.loadHandler=function(){return n.preloadEl&&n.imageEl?n.readEXIF(n.imageEl).then(function(e){var t=e.pdfWidth,i=e.pdfHeight,r=e.numPages,o=n.getScaledDimensions(t,i),a=o.scaledWidth,s=o.scaledHeight;n.scaleAndShowPreload(a,s,Math.min(r,p))}).catch(function(){var e=n.imageEl,t=e.naturalWidth,i=e.naturalHeight,r=n.getScaledDimensions(t,i),o=r.scaledWidth,a=r.scaledHeight;n.scaleAndShowPreload(o,a,d)}):Promise.resolve()},n.previewUI=e,n.wrapperClassName=l.p,n}return o(t,e),u(t,[{key:"showPreload",value:function(e,t){var n=this;return this.containerEl=t,Object(c.k)(e,"blob").then(function(e){n.checkDocumentLoaded()||(n.srcUrl=URL.createObjectURL(e),n.wrapperEl=document.createElement("div"),n.wrapperEl.className=n.wrapperClassName,n.wrapperEl.innerHTML=('\n \n
\n
\n '+f+"\n
\n
\n ").trim(),n.containerEl.appendChild(n.wrapperEl),n.preloadEl=n.wrapperEl.querySelector("."+l.m),n.imageEl=n.preloadEl.querySelector("img."+l.n),n.overlayEl=n.preloadEl.querySelector("."+l.o),n.bindDOMListeners())})}},{key:"scaleAndShowPreload",value:function(e,t,n){if(!this.checkDocumentLoaded()){Object(c.y)(this.imageEl,e,t),Object(c.y)(this.overlayEl,e,t);for(var i=0;i0&&(t.scrollTop=e)}},{key:"getScaledDimensions",value:function(e,t){var n=this.wrapperEl,i=n.clientWidth,r=n.clientHeight,o=(i-l.S)/e,a=(r-l.Q)/t,s=e>t,c=s?Math.min(a,o):o;return this.maxZoomScale&&(c=Math.min(this.maxZoomScale,c)),{scaledWidth:Math.floor(c*e),scaledHeight:Math.floor(c*t)}}},{key:"readEXIF",value:function(e){return new Promise(function(t,n){try{EXIF.getData(e,function(){var i=EXIF.getTag(e,"UserComment"),r=i.map(function(e){return String.fromCharCode(e)}).join(""),o=h.exec(r);if(!o||4!==o.length)return void n(new Error("No valid EXIF data found"));var a=parseInt(o[1],10)*l.P,s=parseInt(o[2],10)*l.P,c=parseInt(o[3],10);if(c<=0)return void n(new Error("EXIF num pages data is invalid"));var u=a/s,d=e.naturalWidth/e.naturalHeight;if(Math.abs(u-d)>.025){var p=s/a;if(Math.abs(p-d)>.025)return void n(new Error("EXIF PDF width and height are invalid"));var f=a;a=s,s=f}t({pdfWidth:a,pdfHeight:s,numPages:c})})}catch(e){n(new Error("Error reading EXIF data"))}})}},{key:"checkDocumentLoaded",value:function(){return!!this.containerEl.classList.contains(l.I)&&(this.hidePreload(),!0)}}]),t}(s.a);t.a=v},,,,,,,,,,,,,,,,,function(e,t,n){e.exports=n(105)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(106),s=(n.n(a),n(4)),l=n.n(s),c=n(27),u=n.n(c),h=n(66),d=n.n(h),p=n(8),f=n(108),v=n(109),g=n(250),m=n(251),b=n(253),y=n(256),E=n(2),w=n(13),_=n(1),k=n(257),O=(n.n(k),"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e}),C=function(){function e(e,t){for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:{};if(null!==t&&"object"===(void 0===t?"undefined":O(t)))throw new Error("Bad access token!");this.previewOptions=Object.assign({},n,{token:t}),this.updateCollection(n.collection),this.load(e)}},{key:"hide",value:function(){this.open=!1,this.destroy(),this.ui.cleanup(),this.file=void 0}},{key:"updateCollection",value:function(e){var t=Array.isArray(e)?e:[],n=[],i=[];t.forEach(function(e){if(e&&"string"==typeof e)i.push(e);else{if(!e||"object"!==(void 0===e?"undefined":O(e))||"string"!=typeof e.id)throw new Error("Bad collection provided!");i.push(e.id),n.push(e)}}),this.updateFileCache(n),this.collection=i,this.file&&this.ui.showNavigation(this.file.id,this.collection)}},{key:"updateFileCache",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=t;Array.isArray(n)||(n=[t]),n.forEach(function(t){t.watermark_info&&t.watermark_info.is_watermarked||Object(w.c)(t)&&Object(w.a)(e.cache,t)})}},{key:"getCurrentViewer",value:function(){return this.viewer}},{key:"getCurrentFile",value:function(){return this.file}},{key:"getCurrentCollection",value:function(){return this.collection}},{key:"getViewers",value:function(){var e=[];return this.loaders.forEach(function(t){e=e.concat(t.getViewers())}),e}},{key:"disableViewers",value:function(e){var t=this;Array.isArray(e)?e.forEach(function(e){t.disabledViewers[e]=1}):e&&(this.disabledViewers[e]=1)}},{key:"enableViewers",value:function(e){var t=this;Array.isArray(e)?e.forEach(function(e){delete t.disabledViewers[e]}):e&&delete this.disabledViewers[e]}},{key:"disableHotkeys",value:function(){this.options.useHotkeys=!1}},{key:"enableHotkeys",value:function(){this.options.useHotkeys=!0}},{key:"resize",value:function(){this.viewer&&"function"==typeof this.viewer.resize&&this.viewer.resize()}},{key:"print",value:function(){Object(w.d)(this.file,_.T)&&Object(w.b)(this.viewer,"print")&&this.viewer.print()}},{key:"download",value:function(){var e=this.options,t=e.apiHost,n=e.queryParams;if(Object(w.d)(this.file,_.T)){var i=Object(E.d)(Object(w.e)(this.file.id,t),n);Object(E.k)(i,this.getRequestHeaders()).then(function(e){Object(E.r)(e.download_url)})}}},{key:"updateToken",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.previewOptions.token=e,t&&this.load(this.file.id)}},{key:"prefetch",value:function(e){var t=e.fileId,n=e.token,i=e.sharedLink,r=void 0===i?"":i,o=e.sharedLinkPassword,a=void 0===o?"":o,s=e.preload,l=void 0!==s&&s,c=void 0,u=void 0,h=void 0;try{if(c=this.cache.get(t),u=c?this.getLoader(c):null,!(h=u?u.determineViewer(c):null))return}catch(e){return}var d={viewer:h,file:c,token:n,representation:u.determineRepresentation(c,h)};l&&(d.sharedLink=r,d.sharedLinkPassword=a);var p=new h.CONSTRUCTOR(this.createViewerOptions(d));"function"==typeof p.prefetch&&p.prefetch({assets:!0,preload:l||p.getViewerOption("preload"),content:!l})}},{key:"prefetchViewers",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.getViewers().filter(function(e){return-1!==t.indexOf(e.NAME)}).forEach(function(t){var n=new t.CONSTRUCTOR(e.createViewerOptions({viewer:t}));"function"==typeof n.prefetch&&n.prefetch({assets:!0,preload:!1,content:!1})})}},{key:"load",value:function(e){this.destroy(),this.open=!0,this.logger=new f.a(this.location.locale,this.browserInfo),clearTimeout(this.retryTimeout);var t=this.file?this.file.id:void 0;if("string"==typeof e)this.file=this.cache.get(e)||{id:e};else if(Object(w.c)(e))this.file=e;else{if(!e||"string"!=typeof e.id)throw new Error("File is not a well-formed Box File object. See FILE_FIELDS in file.js for a list of required fields.");this.file={id:e.id}}this.file.id===t?this.retryCount+=1:this.retryCount=0,Object(y.a)(this.file.id,this.previewOptions.token).then(this.handleTokenResponse).catch(this.handleFetchError)}},{key:"handleTokenResponse",value:function(e){if(this.retryCount>0)return void this.loadFromServer();this.parseOptions(this.previewOptions,e),this.container=this.ui.setup(this.options,this.keydownHandler,this.navigateLeft,this.navigateRight,this.throttledMousemoveHandler),this.ui.showLoadingIndicator(),this.ui.startProgressBar(),this.ui.showNavigation(this.file.id,this.collection),Object(w.c)(this.file)?(Object(w.a)(this.cache,this.file),this.loadFromCache()):this.loadFromServer()}},{key:"parseOptions",value:function(e,t){var n=this,i=Object.assign({},e);this.options={},this.options.container=i.container,this.options.token=t[this.file.id],this.options.sharedLink=i.sharedLink,this.options.sharedLinkPassword=i.sharedLinkPassword,this.options.apiHost=i.apiHost?i.apiHost.replace(/\/$/,""):_.a,this.options.appHost=i.appHost?i.appHost.replace(/\/$/,""):_.b,this.options.header=i.header||"light",this.options.logoUrl=i.logoUrl||"",this.options.showDownload=!!i.showDownload,this.options.showAnnotations=!!i.showAnnotations,this.options.useHotkeys=!1!==i.useHotkeys,this.options.box3dApplication=i.box3dApplication,this.options.viewers=i.viewers||{},this.options.skipServerUpdate=!!i.skipServerUpdate,this.options.queryParams=i.queryParams||{},this.loaders=(i.loaders||[]).concat(v.a),Object.keys(this.options.viewers).forEach(function(e){var t=n.options.viewers[e].disabled;!0===t?n.disableViewers(e):!1===t&&n.enableViewers(e)})}},{key:"createViewerOptions",value:function(e){return d()(Object.assign({},this.options,e,{location:this.location,cache:this.cache,ui:this.ui}))}},{key:"loadFromCache",value:function(){this.logger.setCached(),this.loadViewer(),this.options.skipServerUpdate||this.loadFromServer()}},{key:"loadFromServer",value:function(){var e=this.options,t=e.apiHost,n=e.queryParams,i=Object(E.d)(Object(w.g)(this.file.id,t),n);Object(E.k)(i,this.getRequestHeaders()).then(this.handleFileInfoResponse).catch(this.handleFetchError)}},{key:"handleFileInfoResponse",value:function(e){if(this.open&&(!this.file||this.file.id===e.id))try{this.file=e,this.logger.setFile(e);var t=this.cache.get(e.id),n=e.watermark_info&&e.watermark_info.is_watermarked;n?Object(w.h)(this.cache,e):Object(w.a)(this.cache,e);(!t||!Object(w.c)(t)||t.file_version.sha1!==e.file_version.sha1||n)&&(this.logger.setCacheStale(),this.loadViewer())}catch(e){this.triggerError(e instanceof Error?e:new Error("We're sorry, the preview didn't load. Please refresh the page."))}}},{key:"loadViewer",value:function(){if(this.open){if(!Object(w.d)(this.file,_.U))throw new Error("We're sorry, you don't have permission to preview this file.");Object(w.d)(this.file,_.T)&&this.options.showDownload&&p.a.canDownload()&&this.ui.showLoadingDownloadButton(this.download);var e=this.getLoader(this.file);if(!e)throw new Error(_.L[this.file.extension]||"We're sorry, the preview didn't load. This file type may not be supported.");var t=e.determineViewer(this.file,Object.keys(this.disabledViewers));this.logger.setType(t.NAME);var n=e.determineRepresentation(this.file,t),i=this.createViewerOptions({viewer:t,representation:n,container:this.container,file:this.file});i.logger=this.logger,this.viewer=new t.CONSTRUCTOR(i),this.attachViewerListeners(),this.viewer.load(),this.emit("viewer",this.viewer),this.retryCount=0}}},{key:"attachViewerListeners",value:function(){this.viewer.addListener("error",this.triggerError),this.viewer.addListener("viewerevent",this.handleViewerEvents)}},{key:"handleViewerEvents",value:function(e){switch(e.event){case"download":this.download();break;case"reload":this.show(this.file.id,this.previewOptions);break;case"load":this.finishLoading(e.data);break;case"progressstart":this.ui.startProgressBar();break;case"progressend":this.ui.finishProgressBar();break;case"notificationshow":this.ui.showNotification(e.data);break;case"notificationhide":this.ui.hideNotification();break;case"mediaendautoplay":this.navigateRight();break;default:this.emit(e.event,e.data),this.emit("viewerevent",e)}}},{key:"emit",value:function(e,n){try{S(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"emit",this).call(this,e,n)}catch(e){}}},{key:"finishLoading",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Object(w.d)(this.file,_.T)&&this.options.showDownload&&p.a.canDownload()&&(this.ui.showDownloadButton(this.download),Object(w.b)(this.viewer,"print")&&!p.a.isMobile()&&this.ui.showPrintButton(this.print));var t=e.error;t?(this.count.error+=1,this.emit("load",{error:t,metrics:this.logger.done(this.count),file:this.file}),"function"==typeof window.callPhantom&&window.callPhantom(0)):(this.count.success+=1,this.emit("load",{viewer:this.viewer,metrics:this.logger.done(this.count),file:this.file}),this.logPreviewEvent(this.file.id,this.options),"function"==typeof window.callPhantom&&window.callPhantom(1)),!1!==e.endProgress&&this.ui.finishProgressBar(),this.viewer&&this.viewer.containerEl&&this.viewer.containerEl.focus(),this.ui.hideLoadingIndicator(),this.prefetchNextFiles()}},{key:"logPreviewEvent",value:function(e,t){var n=this;this.logRetryCount=this.logRetryCount||0;var i=t.apiHost,r=t.token,o=t.sharedLink,a=t.sharedLinkPassword,s=Object(E.l)({},r,o,a);Object(E.t)(i+"/2.0/events",s,{event_type:"preview",source:{type:"file",id:e}}).then(function(){n.logRetryCount=0}).catch(function(){if(n.logRetryCount+=1,n.logRetryCount>3)return void(n.logRetryCount=0);clearTimeout(n.logRetryTimeout),n.logRetryTimeout=setTimeout(function(){n.logPreviewEvent(e,t)},500*n.logRetryCount)})}},{key:"handleFetchError",value:function(e){var t=this;if(this.open){if(this.cache.unset(this.file.id),this.retryCount>5){var n="We're sorry, the preview didn't load. Please refresh the page.";return e.response&&429===e.response.status&&(n="We're sorry, the preview didn't load because your request was rate limited. Please wait a few minutes and try again."),void this.triggerError(new Error(n))}clearTimeout(this.retryTimeout),this.retryTimeout=setTimeout(function(){t.load(t.file.id)},500*this.retryCount)}}},{key:"getErrorViewer",value:function(){return new m.a(this.createViewerOptions({viewer:{NAME:"Error"},container:this.container,file:this.file}))}},{key:"triggerError",value:function(e){this.open&&(this.open=!1,this.cache.unset(this.file.id),this.destroy(),this.viewer=this.getErrorViewer(),this.attachViewerListeners(),this.viewer.load(e))}},{key:"getRequestHeaders",value:function(e){var t=p.a.canPlayDash()&&!this.disabledViewers.Dash?_._19:_._20,n={"X-Rep-Hints":""+_._16+_._17+_._18+t};return Object(E.l)(n,e||this.options.token,this.options.sharedLink,this.options.sharedLinkPassword)}},{key:"prefetchNextFiles",value:function(){var e=this,t=this.options,n=t.apiHost,i=t.queryParams,r=t.skipServerUpdate;if(!(this.collection.length<2||r)){this.prefetchedCollection=this.prefetchedCollection||[];var o=this.collection.indexOf(this.file.id),a=this.collection.slice(o+1,o+4+1).filter(function(t){return-1===e.prefetchedCollection.indexOf(t)});0!==a.length&&Object(y.a)(a,this.previewOptions.token).then(function(t){a.forEach(function(r){var o=t[r],a=Object(E.d)(Object(w.g)(r,n),i);Object(E.k)(a,e.getRequestHeaders(o)).then(function(t){Object(w.a)(e.cache,t),e.prefetchedCollection.push(t.id),e.prefetch({fileId:t.id,token:o})}).catch(function(e){})})}).catch(function(){})}}},{key:"getGlobalMousemoveHandler",value:function(){var e=this;return u()(function(){if(clearTimeout(e.timeoutHandler),e.container){var t=!!e.viewer;e.container.classList.remove(_.H),t&&!e.viewer.allowNavigationArrows()||e.container.classList.add(_.H),e.timeoutHandler=setTimeout(function(){e.container&&e.container.classList.remove(_.H)},1500)}},1e3,!0)}},{key:"navigateToIndex",value:function(e){var t=this.collection[e];this.emit("navigate",t),this.count.navigation+=1,this.load(t)}},{key:"navigateLeft",value:function(){var e=this.collection.indexOf(this.file.id),t=0===e?0:e-1;t!==e&&this.navigateToIndex(t)}},{key:"navigateRight",value:function(){var e=this.collection.indexOf(this.file.id),t=e===this.collection.length-1?this.collection.length-1:e+1;t!==e&&this.navigateToIndex(t)}},{key:"getLoader",value:function(e){var t=this;return this.loaders.find(function(n){return n.canLoad(e,Object.keys(t.disabledViewers))})}},{key:"keydownHandler",value:function(e){var t=e.target;if(this.options.useHotkeys&&!(!t||x.indexOf(t.nodeName)>-1||"DIV"===t.nodeName&&t.getAttribute("contenteditable"))){var n=!1,i=Object(E.i)(e);if(i){if(this.viewer&&"function"==typeof this.viewer.onKeydown&&(n=!!this.viewer.onKeydown(i)),!n)switch(i){case"ArrowLeft":this.navigateLeft(),n=!0;break;case"ArrowRight":this.navigateRight(),n=!0}n&&(e.preventDefault(),e.stopPropagation())}}}}]),t}(l.a);e.Box=e.Box||{},e.Box.Preview=T,t.default=T}.call(t,n(15))},function(e,t){!function(){var e={};if(!Object.setPrototypeOf&&!e.__proto__){var t=Object.getPrototypeOf;Object.getPrototypeOf=function(e){return e.__proto__?e.__proto__:t.call(Object,e)}}}(),"function"!=typeof Object.assign&&function(){Object.assign=function(e){"use strict";if(void 0===e||null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=1;n>>0;if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var i=arguments[1],r=0;r>>0;if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var i=arguments[1],r=0;r>>0;if(0===i)return!1;for(var r=0|t,o=Math.max(r>=0?r:i-Math.abs(r),0);on.length)&&(t=n.length),t-=e.length;var i=n.indexOf(e,t);return-1!==i&&i===t}})},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var r=function(){function e(e,t){for(var n=0;nthis.wrapperEl.clientWidth||this.imageEl.width>this.wrapperEl.clientHeight:this.isPannable=this.imageEl.width>this.wrapperEl.clientWidth||this.imageEl.height>this.wrapperEl.clientHeight,this.didPan=!1,this.updateCursor())}},{key:"rotateLeft",value:function(){this.currentRotationAngle=(this.currentRotationAngle-90)%3600%360,this.imageEl.setAttribute("data-rotation-angle",this.currentRotationAngle),this.imageEl.style.transform="rotate("+this.currentRotationAngle+"deg)",this.emit("rotate"),this.handleOrientationChange(),this.setScale(this.imageEl.offsetwidth,this.imageEl.offsetHeight)}},{key:"zoom",value:function(e){var t=void 0,n=void 0,i=this.imageEl.getBoundingClientRect(),r=i.height,o=i.width,a=o/r,s={width:this.wrapperEl.clientWidth-15,height:this.wrapperEl.clientHeight-15},l=a>=1;switch(e){case"in":l?t=1.2*o:n=1.2*r;break;case"out":l?t=o/1.2:n=r/1.2;break;case"reset":return this.imageEl.style.width="",this.imageEl.style.height="",this.adjustImageZoomPadding(),void this.zoom();default:if(o>s.width||r>s.height){var c=Math.min(s.width/o,s.height/r);l?t=o*c:n=r*c}else if(l){var u=this.isRotated()?this.imageEl.getAttribute("originalHeight"):this.imageEl.getAttribute("originalWidth");t=Math.min(s.width,u)}else{var h=this.isRotated()?this.imageEl.getAttribute("originalWidth"):this.imageEl.getAttribute("originalHeight");n=Math.min(s.height,h)}}if(this.isRotated()){var d=t;t=n,n=d}this.imageEl.style.width=t?t+"px":"",this.imageEl.style.height=n?n+"px":"",this.adjustImageZoomPadding(),setTimeout(this.updatePannability,50),this.setScale(t,n),this.emit("zoom",{newScale:[t||o,n||r],canZoomIn:!0,canZoomOut:!0})}},{key:"setScale",value:function(e,t){this.scale=e?e/this.imageEl.getAttribute("originalWidth"):t/this.imageEl.getAttribute("originalHeight"),this.rotationAngle=this.currentRotationAngle%3600%360,this.emit("scale",{scale:this.scale,rotationAngle:this.rotationAngle})}},{key:"loadUI",value:function(){p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"loadUI",this).call(this),this.controls.add("Rotate left",this.rotateLeft,"bp-image-rotate-left-icon",l.s),this.controls.add("Enter fullscreen",this.toggleFullscreen,"bp-enter-fullscreen-icon",l.l),this.controls.add("Exit fullscreen",this.toggleFullscreen,"bp-exit-fullscreen-icon",l.m)}},{key:"print",value:function(){this.printframe=Object(u.q)(this.imageEl.outerHTML),this.printframe.contentWindow.focus(),this.printImage=this.printframe.contentDocument.querySelector("img"),this.printImage.style.display="block",this.printImage.style.margin="0 auto","Explorer"===a.a.getName()||"Edge"===a.a.getName()?this.printframe.contentWindow.document.execCommand("print",!1,null):this.printframe.contentWindow.print(),this.emit("printsuccess")}},{key:"isRotated",value:function(){return Math.abs(this.currentRotationAngle)%180==90}},{key:"adjustImageZoomPadding",value:function(){var e=0,t=0,n=0,i=0,r=this.wrapperEl.getBoundingClientRect(),o={width:this.wrapperEl.clientWidth-15,height:this.wrapperEl.clientHeight-15};this.isRotated()?(n=r.width>this.imageEl.clientHeight?r.width:this.imageEl.clientHeight,i=r.height>this.imageEl.clientWidth?r.height:this.imageEl.clientWidth):(n=r.width>this.imageEl.clientWidth?r.width:this.imageEl.clientWidth,i=r.height>this.imageEl.clientHeight?r.height:this.imageEl.clientHeight),e=(n-this.imageEl.clientWidth)/2,t=(i-this.imageEl.clientHeight)/2,this.imageEl.style.left=e+"px",this.imageEl.style.top=t+"px",this.wrapperEl.scrollLeft=(this.wrapperEl.scrollWidth-o.width)/2,this.wrapperEl.scrollTop=(this.wrapperEl.scrollHeight-o.height)/2}},{key:"bindDOMListeners",value:function(){p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"bindDOMListeners",this).call(this),this.imageEl.addEventListener("load",this.finishLoading),this.imageEl.addEventListener("error",this.errorHandler),this.isMobile&&this.imageEl.addEventListener("orientationchange",this.handleOrientationChange)}},{key:"unbindDOMListeners",value:function(){p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"unbindDOMListeners",this).call(this),this.imageEl&&(this.imageEl.removeEventListener("load",this.finishLoading),this.imageEl.removeEventListener("error",this.errorHandler)),this.isMobile&&this.imageEl.removeEventListener("orientationchange",this.handleOrientationChange)}},{key:"handleOrientationChange",value:function(){this.adjustImageZoomPadding(),this.scale=this.imageEl.clientWidth/this.imageEl.getAttribute("originalWidth"),this.rotationAngle=this.currentRotationAngle%3600%360,this.emit("scale",{scale:this.scale,rotationAngle:this.rotationAngle})}}]),t}(s.a);t.a=f},function(e,t){},function(e,t,n){"use strict";function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t1&&void 0!==arguments[1]?arguments[1]:[],n=this.getAnnotators(),i=n.find(function(n){return!t.includes(n.NAME)&&n.VIEWER.includes(e)});return this.instantiateControllers(i),i}},{key:"instantiateControllers",value:function(e){if(e&&e.TYPE&&!e.CONTROLLERS){e.CONTROLLERS={};this.getAnnotatorTypes(e).forEach(function(t){t in g&&(e.CONTROLLERS[t]=new g[t].CONSTRUCTOR)})}}},{key:"getAnnotatorTypes",value:function(e){if(!this.viewerConfig)return[].concat(i(e.DEFAULT_TYPES));var t=this.viewerConfig.enabledTypes||[].concat(i(e.DEFAULT_TYPES)),n=this.viewerConfig.disabledTypes||[];return t.filter(function(t){return!n.some(function(e){return e===t})&&e.TYPE.some(function(e){return e===t})})}},{key:"determineAnnotator",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],i=null;this.viewerConfig=t;var r=Object(p.c)(e.file.permissions),o=this.getAnnotatorsForViewer(e.viewer.NAME,n);return r&&o&&!1!==this.viewerConfig.enabled?(i=Object.assign({},o),i.TYPE=this.getAnnotatorTypes(i),i):i}}]),e}();t.a=m},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function a(e){return e.state===y._34.hover}var s=n(33),l=n.n(s),c=n(115),u=(n.n(c),n(116)),h=(n.n(u),n(117)),d=(n.n(h),n(68)),p=n(128),f=n(130),v=n(71),g=n(135),m=n(3),b=n(29),y=n(5),E=function(){function e(e,t){var n=[],i=!0,r=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(i=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);i=!0);}catch(e){r=!0,o=e}finally{try{!i&&s.return&&s.return()}finally{if(r)throw o}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),w=function(){function e(e,t){for(var n=0;n5||Math.abs(e.clientY-this.mouseY)>5)&&(this.didMouseMove=!0),this.isCreatingHighlight||(this.mouseMoveEvent=e)}},{key:"drawingSelectionHandler",value:function(e){var t=this.modeControllers[y._36.draw];!t||this.isCreatingAnnotation()||this.isCreatingHighlight||t.handleSelection(e)}},{key:"isCreatingAnnotation",value:function(){var e=this,t=!1;return Object.keys(this.modeControllers).some(function(n){return e.modeControllers[n].hadPendingThreads&&(t=!0),t}),t}},{key:"highlightMouseupHandler",value:function(e){this.highlighter&&this.highlighter.removeAllHighlights(),this.createHighlightDialog&&this.createHighlightDialog.isVisible&&(this.createHighlightDialog.hide(),document.getSelection().removeAllRanges()),this.isCreatingHighlight=!1;var t=this.modeControllers[y._36.point];t&&t.hadPendingThreads||(this.createHighlightDialog&&(this.didMouseMove||"dblclick"===e.type)?this.highlightCreateHandler(e):this.highlightClickHandler(e))}},{key:"highlightCreateHandler",value:function(e){e.stopPropagation();var t=window.getSelection();if(b.l(t)){var n=m.p(t.anchorNode),i=n.pageEl;if(i){var r=t.getRangeAt(t.rangeCount-1),o=r.getClientRects();if(0!==o.length){var a=o[o.length-1],s=a.right,l=a.bottom,c=i.getBoundingClientRect(),u=c.left,h=c.top+y._8,d=this.isMobile?this.container:i;this.createHighlightDialog.show(d),this.isMobile||this.createHighlightDialog.setPosition(s-u,l-h),this.isCreatingHighlight=!0,this.lastHighlightEvent=e}}}}},{key:"highlightClickHandler",value:function(e){var t=this,n=!1,i=null,r=m.p(e.target),o=r.page,a=this.threads[o]||{};Object.keys(a).forEach(function(r){var o=a[r];if(m.y(o.state))o.type===y._36.point?o.destroy():o.cancelFirstComment();else if(m.w(o.type)){var s=o.onClick(e,n);s&&(i=o),n=n||s}else t.isMobile&&o.hideDialog()}),i&&i.show(this.plainHighlightEnabled,this.commentHighlightEnabled)}},{key:"useDefaultCursor",value:function(){this.annotatedElement.classList.add("bp-use-default-cursor")}},{key:"removeDefaultCursor",value:function(){this.annotatedElement.classList.remove("bp-use-default-cursor")}},{key:"getHighlightThreadsOnPage",value:function(e){var t=[],n=this.threads[e]||{};return Object.keys(n).forEach(function(e){var i=n[e];m.w(i.type)&&t.push(i)}),t}},{key:"showHighlightsOnPage",value:function(e){var t=this,n=this.annotatedElement.querySelector('[data-page-number="'+e+'"]'),i=n.querySelector("."+y.s);if(i){i.getContext("2d").clearRect(0,0,i.width,i.height)}this.getHighlightThreadsOnPage(e).forEach(function(e){e.show(t.plainHighlightEnabled,t.commentHighlightEnabled)})}},{key:"removeRangyHighlight",value:function(e){var t=this.highlighter.highlights;if(Array.isArray(t)){var n=t.filter(function(t){return t.id===e.id});this.highlighter.removeHighlights(n)}}},{key:"handleControllerEvents",value:function(e){var n=this.createHighlightDialog&&this.createHighlightDialog.isVisible;switch(e.event){case y.M.toggleMode:n&&(document.getSelection().removeAllRanges(),this.createHighlightDialog.hide());break;case y.M.showHighlights:this.showHighlightsOnPage(e.data);break;case y.M.bindDOMListeners:n&&this.createHighlightDialog.hide()}_(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"handleControllerEvents",this).call(this,e)}},{key:"showFirstDialogFilter",value:function(e,t){0===t?e.show(this.plainHighlightEnabled,this.commentHighlightEnabled):e.hideDialog()}}]),t}(d.a);t.a=O},function(e,t,n){var r,o,a;!function(i,s){o=[n(33)],r=i,void 0!==(a="function"==typeof r?r.apply(t,o):r)&&(e.exports=a)}(function(e){return e.createModule("ClassApplier",["WrappedSelection"],function(e,t){function n(e,t){for(var n in e)if(e.hasOwnProperty(n)&&!1===t(n,e[n]))return!1;return!0}function r(e){return e.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function o(e,t){return!!e&&new RegExp("(?:^|\\s)"+t+"(?:\\s|$)").test(e)}function a(e,t){return"object"==typeof e.classList?e.classList.contains(t):o("string"==typeof e.className?e.className:e.getAttribute("class"),t)}function s(e,t){if("object"==typeof e.classList)e.classList.add(t);else{var n="string"==typeof e.className,i=n?e.className:e.getAttribute("class");i?o(i,t)||(i+=" "+t):i=t,n?e.className=i:e.setAttribute("class",i)}}function l(e){return"string"==typeof e.className?e.className:e.getAttribute("class")}function c(e){return e&&e.split(/\s+/).sort().join(" ")}function u(e){return c(l(e))}function h(e,t){return u(e)==u(t)}function d(e,t){for(var n=t.split(/\s+/),i=0,o=n.length;ir&&++l,o!=t||a!=n&&a!=n+1||(s=i,l+=r-n),o==t&&a>n+1&&--l,e.node=s,e.offset=l}function v(e,t,n){e.node==t&&e.offset>n&&--e.offset}function g(e,t,n,i){-1==n&&(n=t.childNodes.length);var r=e.parentNode,o=B.getNodeIndex(e);F(i,function(e){f(e,r,o,t,n)}),t.childNodes.length==n?t.appendChild(e):t.insertBefore(e,t.childNodes[n])}function m(e,t){var n=e.parentNode,i=B.getNodeIndex(e);F(t,function(e){v(e,n,i)}),B.removeNode(e)}function b(e,t,n,i,r){for(var o,a=[];o=e.firstChild;)g(o,t,n++,r),a.push(o);return i&&m(e,r),a}function y(e,t){return b(e,e.parentNode,B.getNodeIndex(e),!0,t)}function E(e,t){var n=e.cloneRange();n.selectNodeContents(t);var i=n.intersection(e);return""!=(i?i.toString():"")}function w(e){for(var t,n=e.getNodes([3]),i=0;(t=n[i])&&!E(e,t);)++i;for(var r=n.length-1;(t=n[r])&&!E(e,t);)--r;return n.slice(i,r+1)}function _(e,t){if(e.attributes.length!=t.attributes.length)return!1;for(var n,i,r,o=0,a=e.attributes.length;o0&&t1){var i,r=B.getNodeIndex(n),o=[],a=0;F(t,function(t,s){i=t.parentNode,s>0&&(i.removeChild(t),i.hasChildNodes()||B.removeNode(i),e&&F(e,function(e){e.node==t&&(e.node=n,e.offset+=a),e.node==i&&e.offset>r&&--e.offset==r+1&&se.start},isContiguousWith:function(e){return this.start==e.end||this.end==e.start},union:function(e){return new s(Math.min(this.start,e.start),Math.max(this.end,e.end))},intersection:function(e){return new s(Math.max(this.start,e.start),Math.min(this.end,e.end))},getComplements:function(e){var t=[];if(this.start>=e.start){if(this.end<=e.end)return[];t.push(new s(e.end,this.end))}else t.push(new s(this.start,Math.min(this.end,e.start))),this.end>e.end&&t.push(new s(e.end,this.end));return t},toString:function(){return"[CharacterRange("+this.start+", "+this.end+")]"}},s.fromCharacterRange=function(e){return new s(e.start,e.end)};var m={rangeToCharacterRange:function(e,t){var n=e.getBookmark(t);return new s(n.start,n.end)},characterRangeToRange:function(t,n,i){var r=e.createRange(t);return r.moveToBookmark({start:n.start,end:n.end,containerNode:i}),r},serializeSelection:function(e,t){for(var n=e.getAllRanges(),i=n.length,r=[],o=1==i&&e.isBackward(),a=0,s=n.length;a0},serialize:function(e){var t,i,r,o,s=this,l=s.highlights;return l.sort(n),e=p(e,{serializeHighlightText:!1,type:s.converter.type}),t=e.type,r=t!=s.converter.type,r&&(o=a(t)),i=["type:"+t],f(l,function(t){var n,a=t.characterRange;r&&(n=t.getContainerElement(),a=o.rangeToCharacterRange(s.converter.characterRangeToRange(s.doc,a,n),n));var l=[a.start,a.end,t.id,t.classApplier.className,t.containerElementId];e.serializeHighlightText&&l.push(t.getText()),i.push(l.join("$"))}),i.join("|")},deserialize:function(e){var t,n,r,o=e.split("|"),c=[],u=o[0],h=!1;if(!u||!(t=/^type:(\w+)$/.exec(u)))throw new Error("Serialized highlights are invalid.");n=t[1],n!=this.converter.type&&(r=a(n),h=!0),o.shift();for(var d,p,f,v,g,m,b=o.length;b-- >0;){if(m=o[b].split("$"),f=new s(+m[0],+m[1]),v=m[4]||null,h&&(g=i(this.doc,v),f=this.converter.rangeToCharacterRange(r.characterRangeToRange(this.doc,f,g),g)),!(d=this.classAppliers[m[3]]))throw new Error("No class applier found for class '"+m[3]+"'");p=new l(this.doc,f,d,this.converter,parseInt(m[2]),v),p.apply(),c.push(p)}this.highlights=c}},e.Highlighter=c,e.createHighlighter=function(e,t){return new c(e,t)}}),e})},function(e,t,n){var i,r,o;!function(a,s){r=[n(33)],i=a,void 0!==(o="function"==typeof i?i.apply(t,r):i)&&(e.exports=o)}(function(e){return e.createModule("SaveRestore",["WrappedRange"],function(e,t){function n(e,t){return(t||document).getElementById(e)}function i(e,t){var n,i="selectionBoundary_"+ +new Date+"_"+(""+Math.random()).slice(2),r=f.getDocument(e.startContainer),o=e.cloneRange();return o.collapse(t),n=r.createElement("span"),n.id=i,n.style.lineHeight="0",n.style.display="none",n.className="rangySelectionBoundary",n.appendChild(r.createTextNode(m)),o.insertNode(n),n}function r(e,i,r,o){var a=n(r,e);a?(i[o?"setStartBefore":"setEndBefore"](a),v(a)):t.warn("Marker element has been removed. Cannot restore selection.")}function o(e,t){return t.compareBoundaryPoints(e.START_TO_START,e)}function a(t,n){var r,o,a=e.DomRange.getRangeDocument(t),s=t.toString(),l=g(n);return t.collapsed?(o=i(t,!1),{document:a,markerId:o.id,collapsed:!0}):(o=i(t,!1),r=i(t,!0),{document:a,startMarkerId:r.id,endMarkerId:o.id,collapsed:!1,backward:l,toString:function(){return"original text: '"+s+"', new text: '"+t.toString()+"'"}})}function s(i,o){var a=i.document;void 0===o&&(o=!0);var s=e.createRange(a);if(i.collapsed){var l=n(i.markerId,a);if(l){l.style.display="inline";var c=l.previousSibling;c&&3==c.nodeType?(v(l),s.collapseToPoint(c,c.length)):(s.collapseBefore(l),v(l))}else t.warn("Marker element has been removed. Cannot restore selection.")}else r(a,s,i.startMarkerId,!0),r(a,s,i.endMarkerId,!1);return o&&s.normalizeBoundaries(),s}function l(t,i){var r,s,l=[],c=g(i);t=t.slice(0),t.sort(o);for(var u=0,h=t.length;u=0;--u)r=t[u],s=e.DomRange.getRangeDocument(r),r.collapsed?r.collapseAfter(n(l[u].markerId,s)):(r.setEndBefore(n(l[u].endMarkerId,s)),r.setStartAfter(n(l[u].startMarkerId,s)));return l}function c(n){if(!e.isSelectionValid(n))return t.warn("Cannot save selection. This usually happens when the selection is collapsed and the selection document has lost focus."),null;var i=e.getSelection(n),r=i.getAllRanges(),o=1==r.length&&i.isBackward(),a=l(r,o);return o?i.setSingleRange(r[0],o):i.setRanges(r),{win:n,rangeInfos:a,restored:!1}}function u(e){for(var t=[],n=e.length,i=n-1;i>=0;i--)t[i]=s(e[i],!0);return t}function h(t,n){if(!t.restored){var i=t.rangeInfos,r=e.getSelection(t.win),o=u(i);1==i.length&&n&&e.features.selectionHasExtend&&i[0].backward?(r.removeAllRanges(),r.addRange(o[0],!0)):r.setRanges(o),t.restored=!0}}function d(e,t){var i=n(t,e);i&&v(i)}function p(e){for(var t,n=e.rangeInfos,i=0,r=n.length;i\n \n\n'},function(e,t){e.exports='\n \n \n \n \n \n'},function(e,t){e.exports='\n \n \n \n \n \n \n \n \n'},function(e,t){e.exports='\n \n \n \n'},function(e,t){e.exports='\n \n \n \n'},function(e,t){e.exports='\n \n \n \n'},function(e,t){e.exports='\n \n \n \n \n \n'},function(e,t){e.exports='\n \n \n \n'},function(e,t){e.exports=' '},function(e,t){e.exports=' '},function(e,t,n){"use strict";function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t1&&void 0!==arguments[1])||arguments[1];f(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"deleteAnnotation",this).call(this,e,n);var i=c.m(this.annotations);if(i){if((""!==i.text||Object.keys(this.annotations).length>1)&&i.permissions&&!i.permissions.can_delete){var r=this.dialog.element.querySelector(h._15);c.r(r)}}}},{key:"onMousedown",value:function(){this.state===h._34.pending&&this.destroy()}},{key:"onClick",value:function(e,t){return!t&&this.isOnHighlight(e)?(this.state=h._34.hover,!0):(this.reset(),!1)}},{key:"isOnHighlight",value:function(e){return c.x(e,this.dialog.element)||this.isInHighlight(e)}},{key:"activateDialog",value:function(){this.state=h._34.hover,this.dialog.element||this.dialog.setup(this.annotations),this.dialog.mouseenterHandler(),clearTimeout(this.hoverTimeoutHandler)}},{key:"onMousemove",value:function(e){var t=this;if(c.x(e,this.dialog.element)){if(this.state===h._34.pending_active)return!1;this.state=h._34.hover}else{if(!this.isInHighlight(e))return this.state!==h._34.inactive&&(this.hoverTimeoutHandler=setTimeout(function(){t.reset()},75),!1);this.activateDialog()}return!0}},{key:"show",value:function(e,t){switch(this.state){case h._34.pending:this.showDialog(e,t);break;case h._34.inactive:this.hideDialog(),this.draw(h._5.normal);break;case h._34.hover:case h._34.pending_active:this.showDialog(e,t),this.draw(h._5.active)}}},{key:"showDialog",value:function(e,t){this.dialog.element||this.dialog.setup(this.annotations),this.dialog.show(e,t)}},{key:"createDialog",value:function(){this.dialog=new l.a({annotatedElement:this.annotatedElement,container:this.container,annotations:this.annotations,locale:this.locale,location:this.location,canAnnotate:this.permissions.canAnnotate});var e=c.m(this.annotations);if(e){(""!==e.text||Object.keys(this.annotations).length>1)&&this.type===h._36.highlight&&(this.type=h._36.highlight_comment)}}},{key:"setupElement",value:function(){}},{key:"handleDraw",value:function(){this.state=h._34.pending_active,window.getSelection().removeAllRanges(),this.show()}},{key:"handleCommentPending",value:function(){this.state=h._34.pending_active}},{key:"handleCreate",value:function(e){e?(this.type=h._36.highlight_comment,this.dialog.toggleHighlightCommentsReply(Object.keys(this.annotations).length)):this.type=h._36.highlight,this.saveAnnotation(this.type,e?e.text:"")}},{key:"handleDelete",value:function(e){if(e)return void this.deleteAnnotation(e.annotationID);var t=c.m(this.annotations);t&&this.deleteAnnotation(t.annotationID)}},{key:"bindCustomListenersOnDialog",value:function(){this.handleDraw=this.handleDraw.bind(this),this.handleCommentPending=this.handleCommentPending.bind(this),this.handleCreate=this.handleCreate.bind(this),this.handleDelete=this.handleDelete.bind(this),this.cancelFirstComment=this.cancelFirstComment.bind(this),this.dialog.addListener("annotationdraw",this.handleDraw),this.dialog.addListener("annotationcommentpending",this.handleCommentPending),this.dialog.addListener("annotationcreate",this.handleCreate),this.dialog.addListener("annotationcancel",this.cancelFirstComment),this.dialog.addListener("annotationdelete",this.handleDelete)}},{key:"unbindCustomListenersOnDialog",value:function(){this.dialog.removeAllListeners("annotationdraw"),this.dialog.removeAllListeners("annotationcommentpending"),this.dialog.removeAllListeners("annotationcreate"),this.dialog.removeAllListeners("annotationcancel"),this.dialog.removeAllListeners("annotationdelete")}},{key:"scrollIntoView",value:function(){this.scrollToPage();var e=u.f(this.location.quadPoints),t=d(e,1),n=t[0];this.adjustScroll(this.annotatedElement.scrollTop+n)}},{key:"draw",value:function(e){var t=this,n=this.getPageEl(),i=u.d(n,h.s);if(i){var r=n.getBoundingClientRect(),o=r.height-h._8-h._7,a=c.q(this.annotatedElement),s=c.l(this.location.dimensions,r,a,h._8+h._7);this.location.quadPoints.forEach(function(n){var r=n;s&&(r=n.map(function(e,t){return t%2?e*s.y:e*s.x}));var l=u.b(r,o,a),c=d(l,8),p=c[0],f=c[1],v=c[2],g=c[3],m=c[4],b=c[5],y=c[6],E=c[7];i.fillStyle=e,i.beginPath(),i.moveTo(p,f),i.lineTo(v,g),i.lineTo(m,b),i.lineTo(y,E),i.closePath(),i.save(),i.globalCompositeOperation="destination-out",i.fillStyle=h._5.erase,i.fill(),i.restore(),e!==h._5.erase&&(i.fill(),t.dialog.element&&t.dialog.toggleHighlightIcon(e))})}}},{key:"isInHighlight",value:function(e){for(var t=this.getPageEl(),n=t.getBoundingClientRect(),r=n.height-h._8-h._7,o=n.top+h._8,a=c.q(this.annotatedElement),s=c.l(this.location.dimensions,n,a,h._8+h._7),l=e.clientX-n.left,p=e.clientY-o,f=!1,v=this.location.quadPoints,g=v.length,m=0;m0&&void 0!==arguments[0])||arguments[0],n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this.highlightDialogEl.querySelector("button."+u.d);i&&(e?s.G(i):s.r(i));var r=this.highlightDialogEl.querySelector("button."+u.e);r&&(n?s.G(r):s.r(r)),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"show",this).call(this)}},{key:"position",value:function(){var e=this.annotatedElement.querySelector('[data-page-number="'+this.location.page+'"]'),t=e.getBoundingClientRect(),n=t.height-15-15,i=this.getScaledPDFCoordinates(t,n),r=h(i,2),o=r[0],a=r[1];e.appendChild(this.element);var l=this.getDialogWidth(),c=o-l/2,u=this.hasComments?a-10:a;u-=10,this.hasComments&&(this.element.style.borderTopWidth="30px"),c=s.D(this.element,c,l,o,t.width),u<0?u=0:u+38>n&&(u=n-38),this.element.style.left=c+"px",this.element.style.top=u+15+"px",this.fitDialogHeightInPage(),s.G(this.element)}},{key:"toggleHighlightDialogs",value:function(){if(this.commentsDialogEl&&this.highlightDialogEl){if(this.commentsDialogEl.classList.contains(u.E)){this.element.classList.remove("bp-highlight-dialog"),s.r(this.highlightDialogEl),this.element.classList.add(u.l),s.G(this.commentsDialogEl),this.hasComments=!0;this.dialogEl.querySelector(u._27).classList.add(u.b)}else this.element.classList.remove(u.l),s.r(this.commentsDialogEl),this.element.classList.add("bp-highlight-dialog"),s.G(this.highlightDialogEl),this.hasComments=!1;this.isMobile||this.position()}}},{key:"toggleHighlightCommentsReply",value:function(e){var t=this.commentsDialogEl.querySelector(u._13),n=this.commentsDialogEl.querySelector(u._14);e?(s.r(t),s.G(n),this.deactivateReply()):(s.r(n),s.G(t),this.activateReply()),this.isMobile||this.position()}},{key:"setup",value:function(e){this.element||(this.element=document.createElement("div"));var t=s.m(e);t&&(this.hasComments=""!==t.text||Object.keys(e).length>1);var n=t?t.permissions.can_delete:this.canAnnotate;if(this.highlightDialogEl=this.generateHighlightDialogEl(n),this.highlightDialogEl.classList.add(u.p),this.commentsDialogEl=this.generateDialogEl(Object.keys(e).length),this.commentsDialogEl.classList.add(u.k),this.dialogEl=document.createElement("div"),this.dialogEl.appendChild(this.highlightDialogEl),this.dialogEl.appendChild(this.commentsDialogEl),this.hasComments?this.highlightDialogEl.classList.add(u.E):this.commentsDialogEl.classList.add(u.E),this.isMobile||(this.element.setAttribute("data-type",u.P),this.element.classList.add(u.l),this.element.innerHTML='
',this.element.appendChild(this.dialogEl),t&&(this.element.dataset.threadNumber=t.threadNumber)),t&&this.dialogEl.classList.add("bp-is-text-highlighted"),s.z(e)&&t&&"0"!==t.user.id){var i=this.highlightDialogEl.querySelector(".bp-annotation-highlight-label");i.textContent=s.C(this.localized.whoHighlighted,[t.user.name]),s.G(i)}this.addSortedAnnotations(e),!this.isMobile&&this.canAnnotate&&this.bindDOMListeners()}},{key:"bindDOMListeners",value:function(){this.element.addEventListener("mousedown",this.mousedownHandler),this.element.addEventListener("keydown",this.keydownHandler),this.element.addEventListener("mouseup",this.stopPropagation),this.element.addEventListener("wheel",this.stopPropagation),this.isMobile||(this.element.addEventListener("mouseenter",this.mouseenterHandler),this.element.addEventListener("mouseleave",this.mouseleaveHandler))}},{key:"unbindDOMListeners",value:function(){this.element.removeEventListener("mousedown",this.mousedownHandler),this.element.removeEventListener("keydown",this.keydownHandler),this.element.removeEventListener("mouseup",this.stopPropagation),this.element.removeEventListener("wheel",this.stopPropagation),this.isMobile||(this.element.removeEventListener("mouseenter",this.mouseenterHandler),this.element.removeEventListener("mouseleave",this.mouseleaveHandler))}},{key:"toggleHighlightIcon",value:function(e){var t=this.dialogEl.querySelector(u._15);t&&(e===u._5.active?t.classList.add(u.b):t.classList.remove(u.b))}},{key:"keydownHandler",value:function(e){e.stopPropagation(),"Enter"===s.e(e)&&this.mousedownHandler(e),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"keydownHandler",this).call(this,e)}},{key:"mousedownHandler",value:function(e){switch(e.stopPropagation(),s.i(e.target)){case u.W:this.drawAnnotation();break;case u.O:this.emit("annotationdraw"),this.toggleHighlightCommentsReply(!1),this.toggleHighlightDialogs(),e.preventDefault(),this.focusAnnotationsTextArea();break;default:p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"clickHandler",this).call(this,e)}}},{key:"toggleHighlight",value:function(){this.dialogEl.classList.contains("bp-is-text-highlighted")?(this.hasComments=!0,this.emit("annotationdelete")):(this.hasComments=!1,this.dialogEl.classList.add("bp-is-text-highlighted"),this.emit("annotationcreate"))}},{key:"focusAnnotationsTextArea",value:function(){var e=this.dialogEl.querySelector(u._27);s.v(e)&&e.focus()}},{key:"getDialogWidth",value:function(){var e=this.element.style.left;return this.element.style.left=0,s.s(this.element),s.G(this.element),this.highlightDialogWidth=this.element.getBoundingClientRect().width,s.r(this.element),s.H(this.element),this.element.style.left=e,this.highlightDialogWidth}},{key:"getScaledPDFCoordinates",value:function(e,t){var n=s.q(this.annotatedElement),i=l.f(this.location.quadPoints),r=h(i,2),o=r[0],a=r[1],c=s.l(this.location.dimensions,e,n,30);return c&&(o*=c.x,a*=c.y),l.b([o,a],t,n)}},{key:"addAnnotationElement",value:function(e){""===e.text?this.highlightDialogEl.dataset.annotationId=e.annotationID:p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"addAnnotationElement",this).call(this,e)}},{key:"generateHighlightDialogEl",value:function(e){var t=document.createElement("div"),n=document.createElement("span");if(n.classList.add("bp-annotation-highlight-label"),n.classList.add(u.E),t.appendChild(n),!this.canAnnotate)return t;var i=document.createElement("span");if(i.classList.add(u.F),t.appendChild(i),e){var r=s.j([u.z,u.d],this.localized.highlightToggle,c.e,u.W);i.appendChild(r)}var o=s.j([u.z,u.e],this.localized.highlightComment,c.f,u.O);return i.appendChild(o),t}}]),t}(a.a);t.a=f},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(35),s=n(131),l=n(3),c=n(29),u=n(5),h=function(){function e(e,t){var n=[],i=!0,r=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(i=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);i=!0);}catch(e){r=!0,o=e}finally{try{!i&&s.return&&s.return()}finally{if(r)throw o}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),d=function(){function e(e,t){for(var n=0;n1&&void 0!==arguments[1]&&arguments[1];if(e){if(t){var n=e.canvas;e.clearRect(0,0,n.width,n.height)}e.beginPath(),this.pathContainer.applyToItems(function(t){return t.drawPath(e)}),this.pendingPath&&!this.pendingPath.isEmpty()&&this.pendingPath.drawPath(e),e.stroke()}}},{key:"emitAvailableActions",value:function(){var e=this.pathContainer.getNumberOfItems();this.emit("availableactions",{undo:e.undoCount,redo:e.redoCount})}},{key:"drawBoundary",value:function(){if(this.location.page){var e=this.getBrowserRectangularBoundary(),t=h(e,4),n=t[0],i=t[1],r=t[2],o=t[3];this.drawingContext.save(),this.drawingContext.beginPath(),this.drawingContext.lineWidth=this.drawingContext.lineWidth/2,this.drawingContext.setLineDash([u._2,2*u._2]),this.drawingContext.rect(n,i,r,o),this.drawingContext.stroke(),this.drawingContext.restore(),this.dialog&&(this.dialog.isVisible()||this.pathContainer.isEmpty()||this.showDialog(),this.dialog.position(n+r,i))}}},{key:"render",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.performance.now(),t=!0;e-(this.lastRenderTimestamp||0)>=u._3&&(this.draw(this.drawingContext,!0),this.lastRenderTimestamp=e,t=this.drawingFlag===u._4.drawing),t&&(this.lastAnimationRequestId=window.requestAnimationFrame(this.render))}},{key:"updateBoundary",value:function(e){var t=e?s.a.extractDrawingInfo(e,this.location):this.pathContainer.getAxisAlignedBoundingBox();Object.assign(this.location,t)}},{key:"setBoundary",value:function(){if(this.location){var e=this.location;this.minX=e.minX,this.maxX=e.maxX,this.minY=e.minY,this.maxY=e.maxY,this.dialog&&this.pathContainer.isEmpty()&&this.dialog.hide()}}},{key:"getBrowserRectangularBoundary",value:function(){}},{key:"clearBoundary",value:function(){if(this.drawingContext){var e=this.drawingContext.canvas;this.drawingContext.clearRect(0,0,e.width,e.height)}this.dialog&&this.dialog.isVisible()&&this.dialog.hide()}}]),t}(a.a);t.a=f},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var r=function(){function e(e,t){for(var n=0;n1&&void 0!==arguments[1]&&arguments[1];this.undoStack.forEach(e),t&&this.redoStack.forEach(e)}}]),e}();t.a=o},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(36),s=n(3),l=n(5),c=n(21),u=function(){function e(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:{};i(this,t);var o=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return o.position={x:0,y:0},o.allowHighlight=n.allowHighlight||!1,o.allowComment=n.allowComment||!1,o.allowHighlight&&(o.onHighlightClick=o.onHighlightClick.bind(o)),o.allowComment&&(o.onCommentClick=o.onCommentClick.bind(o),o.onCommentPost=o.onCommentPost.bind(o),o.onCommentCancel=o.onCommentCancel.bind(o)),o.createElement(),o}return o(t,e),u(t,[{key:"show",value:function(e){h(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"show",this).call(this,e),this.parentEl.querySelector(".bp-create-annotation-dialog")||this.parentEl.appendChild(this.containerEl)}},{key:"destroy",value:function(){h(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"destroy",this).call(this),this.highlightCreateEl&&(this.highlightCreateEl.removeEventListener("click",this.onHighlightClick),this.highlightCreateEl.removeEventListener("touchstart",this.stopPropagation),this.highlightCreateEl.removeEventListener("touchend",this.onHighlightClick)),this.commentCreateEl&&(this.commentCreateEl.removeEventListener("click",this.onCommentClick),this.commentCreateEl.removeEventListener("touchstart",this.stopPropagation),this.commentCreateEl.removeEventListener("touchend",this.onCommentClick))}},{key:"updatePosition",value:function(){if(!this.isMobile){var e=this.position.x-1-this.containerEl.clientWidth/2,t=Object(l.D)(this.containerEl,e,78,this.position.x,this.parentEl.clientWidth);this.containerEl.style.left=t+"px",this.containerEl.style.top=this.position.y+5+"px"}}},{key:"onHighlightClick",value:function(e){e.preventDefault(),e.stopPropagation(),this.emit(c.N.plain)}},{key:"onCommentClick",value:function(e){e.preventDefault(),e.stopPropagation(),this.emit(c.N.comment),this.commentBox.show(),this.commentBox.focus(),this.setButtonVisibility(!1),this.updatePosition()}},{key:"createElement",value:function(){if(this.containerEl=document.createElement("div"),this.containerEl.classList.add("bp-create-annotation-dialog"),!this.isMobile){var e=document.createElement("div");e.classList.add(c.j),e.left="50%",this.containerEl.appendChild(e)}var t=document.createElement("span");if(t.classList.add(c.F),this.allowHighlight){var n=Object(l.j)([c.z,c.d],this.localized.highlightToggle,s.e,"add-highlight-btn");t.appendChild(n)}var i=document.createElement("div");i.classList.add(c.p),i.appendChild(t),this.containerEl.appendChild(i),this.isMobile&&(this.containerEl.classList.add(c.I),this.containerEl.classList.add(c.l));var r=this.containerEl.querySelector(c._26);if(this.buttonsEl=r.querySelector(c._32),this.containerEl.addEventListener("click",this.stopPropagation),this.containerEl.addEventListener("mouseup",this.stopPropagation),this.containerEl.addEventListener("dblclick",this.stopPropagation),this.allowHighlight&&(this.highlightCreateEl=r.querySelector(c._15),this.highlightCreateEl.addEventListener("click",this.onHighlightClick),this.hasTouch&&(this.highlightCreateEl.addEventListener("touchstart",this.stopPropagation),this.highlightCreateEl.addEventListener("touchend",this.onHighlightClick))),this.allowComment){var o=Object(l.j)([c.z,c.e],this.localized.highlightComment,s.f,"add-highlight-comment-btn");t.appendChild(o),this.commentBox=this.setupCommentBox(r),this.commentCreateEl=r.querySelector(c._16),this.commentCreateEl.addEventListener("click",this.onCommentClick),this.hasTouch&&(this.commentCreateEl.addEventListener("touchstart",this.stopPropagation),this.commentCreateEl.addEventListener("touchend",this.onCommentClick))}this.hasTouch&&this.containerEl.addEventListener("touchend",this.stopPropagation)}}]),t}(a.a);t.a=d},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(4),s=n.n(a),l=n(5),c=n(3),u=function(){function e(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:{};i(this,t);var o=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return o.parentEl=e,o.hasTouch=n.hasTouch,o.localized=n.localized,o.cancelText=n.localized.cancelButton,o.postText=n.localized.postButton,o.placeholderText=n.localized.addCommentPlaceholder,o.containerEl=o.createCommentBox(),o}return o(t,e),u(t,[{key:"focus",value:function(){this.textAreaEl&&(this.textAreaEl.focus(),this.textAreaEl.classList.remove(l.G))}},{key:"blur",value:function(){document.activeElement&&document.activeElement.blur()}},{key:"clear",value:function(){this.textAreaEl&&(this.textAreaEl.value="")}},{key:"hide",value:function(){this.containerEl&&Object(c.r)(this.containerEl)}},{key:"show",value:function(){this.containerEl||(this.containerEl=this.createCommentBox(),this.parentEl.appendChild(this.containerEl)),Object(c.G)(this.containerEl)}},{key:"destroy",value:function(){this.containerEl&&(this.containerEl.removeEventListener("touchend",this.preventDefaultAndPropagation),this.containerEl.remove(),this.parentEl=null,this.containerEl=null,this.cancelEl&&(this.cancelEl.removeEventListener("click",this.onCancel),this.cancelEl.removeEventListener("touchend",this.onCancel)),this.postEl&&(this.postEl.removeEventListener("click",this.onPost),this.postEl.removeEventListener("touchend",this.onPost)),this.textAreaEl&&this.textAreaEl.removeEventListener("focus",this.focus))}},{key:"createHTML",value:function(){var e=document.createElement("section");return e.classList.add("bp-create-comment"),e.innerHTML=('\n \n \n \n '+this.cancelText+'\n \n \n '+this.postText+"\n \n
").trim(),e}},{key:"preventDefaultAndPropagation",value:function(e){e.preventDefault(),e.stopPropagation()}},{key:"onCancel",value:function(e){this.preventDefaultAndPropagation(e),this.clear(),this.emit(t.CommentEvents.cancel)}},{key:"onPost",value:function(e){this.preventDefaultAndPropagation(e);var n=this.textAreaEl.value;if(""===n.trim())return void this.textAreaEl.classList.add(l.G);this.emit(t.CommentEvents.post,n),this.clear()}},{key:"createCommentBox",value:function(){var e=this.createHTML();return this.textAreaEl=e.querySelector(l._27),this.cancelEl=e.querySelector(l._17),this.postEl=e.querySelector(l._22),this.focus=this.focus.bind(this),this.onCancel=this.onCancel.bind(this),this.onPost=this.onPost.bind(this),this.hasTouch?(this.textAreaEl.addEventListener("focus",this.focus),e.addEventListener("touchend",this.preventDefaultAndPropagation.bind(this)),this.cancelEl.addEventListener("touchend",this.onCancel),this.postEl.addEventListener("touchend",this.onPost)):(this.textAreaEl.addEventListener("focus",this.focus),this.cancelEl.addEventListener("click",this.onCancel),this.postEl.addEventListener("click",this.onPost)),e}}]),t}(s.a);h.CommentEvents={cancel:"comment_cancel",post:"comment_post"},t.a=h},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(68),s=n(138),l=n(3),c=n(74),u=n(5),h=function(){function e(e,t){var n=[],i=!0,r=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(i=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);i=!0);}catch(e){r=!0,o=e}finally{try{!i&&s.return&&s.return()}finally{if(r)throw o}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),d=function(){function e(e,t){for(var n=0;nthis.annotatedElement.clientWidth?n.clientWidth:this.annotatedElement.clientWidth;r=s.D(this.element,r,t,i,a),this.element.style.left=r+"px";var l=this.flipDialog(o,this.container.clientHeight);this.element.style.top=l.top,this.element.style.bottom=l.bottom}}]),t}(a.a);t.a=c},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(141),s=n.n(a),l=n(44),c=n(143),u=n.n(c),h=n(71),d=n(3),p=n(5),f=function(){function e(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:{},i=n.eventData;switch(n.event){case"softcommit":this.currentThread=void 0,e.saveAnnotation(p._36.draw),this.registerThread(e),this.unbindListeners(),this.bindListeners(),i&&i.location&&this.currentThread.handleStart(i.location);break;case"dialogdelete":if(!e.dialog)return;if(e.state===p._34.pending)e.destroy(),this.unbindListeners(),this.bindListeners();else{e.deleteThread(),this.unregisterThread(e);var r=e.location.page;this.threads[r].all().forEach(function(e){return e.show()})}break;case"availableactions":this.updateUndoRedoButtonEls(i.undo,i.redo)}v(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"handleThreadEvents",this).call(this,e,n)}},{key:"handleSelection",value:function(e){if(e&&(!e.target||"BUTTON"!==e.target.nodeName)){var t=this.annotator.getLocationFromEvent(e,p._36.point);if(t){var n={minX:+t.x-p._1,minY:+t.y-p._1,maxX:+t.x+p._1,maxY:+t.y+p._1},i=this.threads[t.page].search(n);if(this.removeSelection(),0===i.length)return void(this.selectedThread=void 0);var r=Math.floor(Math.random()*i.length),o=i[r];this.select(o)}}}},{key:"removeSelection",value:function(){this.selectedThread&&(this.selectedThread.clearBoundary(),this.selectedThread=void 0)}},{key:"select",value:function(e){e.drawBoundary(),this.selectedThread=e}},{key:"updateUndoRedoButtonEls",value:function(e,t){this.undoButtonEl&&(1===e?d.g(this.undoButtonEl):0===e&&d.f(this.undoButtonEl)),this.redoButtonEl&&(1===t?d.g(this.redoButtonEl):0===t&&d.f(this.redoButtonEl))}}]),t}(l.a);t.a=g},function(e,t,n){"use strict";function i(e,t){if(!(this instanceof i))return new i(e,t);this._maxEntries=Math.max(4,e||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),t&&this._initFormat(t),this.clear()}function r(e,t,n){if(!n)return t.indexOf(e);for(var i=0;i=e.minX&&t.maxY>=e.minY}function g(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function m(e,t,n,i,r){for(var o,a=[t,n];a.length;)n=a.pop(),t=a.pop(),n-t<=i||(o=t+Math.ceil((n-t)/i/2)*i,b(e,o,t,n,r),a.push(t,o,o,n))}e.exports=i;var b=n(142);i.prototype={all:function(){return this._all(this.data,[])},search:function(e){var t=this.data,n=[],i=this.toBBox;if(!v(e,t))return n;for(var r,o,a,s,l=[];t;){for(r=0,o=t.children.length;r=0&&o[t].children.length>this._maxEntries;)this._split(o,t),t--;this._adjustParentBBoxes(r,o,t)},_split:function(e,t){var n=e[t],i=n.children.length,r=this._minEntries;this._chooseSplitAxis(n,r,i);var a=this._chooseSplitIndex(n,r,i),s=g(n.children.splice(a,n.children.length-a));s.height=n.height,s.leaf=n.leaf,o(n,this.toBBox),o(s,this.toBBox),t?e[t-1].children.push(s):this._splitRoot(n,s)},_splitRoot:function(e,t){this.data=g([e,t]),this.data.height=e.height+1,this.data.leaf=!1,o(this.data,this.toBBox)},_chooseSplitIndex:function(e,t,n){var i,r,o,s,l,c,h,d;for(c=h=1/0,i=t;i<=n-t;i++)r=a(e,0,i,this.toBBox),o=a(e,i,n,this.toBBox),s=p(r,o),l=u(r)+u(o),s=t;r--)o=e.children[r],s(u,e.leaf?l(o):o),d+=h(u);return d},_adjustParentBBoxes:function(e,t,n){for(var i=n;i>=0;i--)s(t[i],e)},_condense:function(e){for(var t,n=e.length-1;n>=0;n--)0===e[n].children.length?n>0?(t=e[n-1].children,t.splice(t.indexOf(e[n]),1)):this.clear():o(e[n],this.toBBox)},_initFormat:function(e){var t=["return a"," - b",";"];this.compareMinX=new Function("a","b",t.join(e[0])),this.compareMinY=new Function("a","b",t.join(e[1])),this.toBBox=new Function("a","return {minX: a"+e[0]+", minY: a"+e[1]+", maxX: a"+e[2]+", maxY: a"+e[3]+"};")}}},function(e,t,n){"use strict";function i(e,t,n,a,s){for(n=n||0,a=a||e.length-1,s=s||o;a>n;){if(a-n>600){var l=a-n+1,c=t-n+1,u=Math.log(l),h=.5*Math.exp(2*u/3),d=.5*Math.sqrt(u*h*(l-h)/l)*(c-l/2<0?-1:1);i(e,t,Math.max(n,Math.floor(t-c*h/l+d)),Math.min(a,Math.floor(t+(l-c)*h/l+d)),s)}var p=e[t],f=n,v=a;for(r(e,n,t),s(e[a],p)>0&&r(e,n,a);f0;)v--}0===s(e[n],p)?r(e,n,v):(v++,r(e,v,a)),v<=t&&(n=v+1),t<=v&&(a=v-1)}}function r(e,t,n){var i=e[t];e[t]=e[n],e[n]=i}function o(e,t){return et?1:0}e.exports=i},function(e,t){e.exports='\n'},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(44),s=n(5),l=n(73),c=function(){function e(e,t){for(var n=0;n>>0;if("function"!=typeof e)throw new TypeError(e+" is not a function");for(arguments.length>1&&(n=t),i=0;i0&&(r+="&"),null===n[1]?r+=n[0]:(r+=n[0],r+="=",void 0!==n[1]&&(r+=encodeURIComponent(n[1])));return r.length>0?"?"+r:r},l.prototype.getQueryParamValue=function(e){var t,n,i;for(n=0,i=this.queryPairs.length;n0&&this.queryPairs.push([e,t]),this},l.prototype.hasQueryParam=function(e){var t,n=this.queryPairs.length;for(t=0;t=0&&this.deleteQueryParam(e,o(n)).addQueryParam(e,t,a)}else{for(i=0;i\n \n \n\n'},function(e,t){e.exports='\n \n \n \n'},function(e,t){e.exports='\n \n \n \n'},function(e,t){e.exports='\n \n \n \n \n \n\n'},function(e,t){e.exports='\n \n \n \n \n \n'},function(e,t){e.exports='\n \n \n \n'},function(e,t){e.exports='\n \n \n \n \n'},function(e,t){e.exports='\n \n \n \n'},function(e,t){e.exports='\n \n \n \n'},function(e,t){e.exports='\n \n \n \n'},function(e,t){e.exports='\n \n \n \n'},function(e,t){e.exports='\n \n \n'},function(e,t){e.exports=' \n'},function(e,t){e.exports=' \n'},function(e,t){e.exports=' \n'},function(e,t){e.exports=' \n'},function(e,t){e.exports=' \n'},function(e,t){e.exports=' \n'},function(e,t){e.exports=' \n'},function(e,t){e.exports=' \n'},function(e,t){e.exports=' \n'},function(e,t){e.exports=' \n'},function(e,t){e.exports=' \n'},function(e,t){e.exports=' \n'},function(e,t){e.exports=' \n'},function(e,t){e.exports=' \n'},function(e,t){e.exports=' \n'},function(e,t){e.exports=' \n'},function(e,t){e.exports=' \n'},function(e,t){e.exports=' \n'},function(e,t){e.exports=' \n'},function(e,t){e.exports=' \n'},function(e,t){e.exports='SPREADSHEET \n'},function(e,t){e.exports=' \n'},function(e,t){e.exports=' \n'},function(e,t){e.exports='\n \n \n \n \n \n \n'},function(e,t){e.exports='\n \n \n \n'},function(e,t){e.exports='\n \n \n \n'},function(e,t){e.exports='\n \n \n \n'},function(e,t){e.exports='\n \n \n \n'},function(e,t){e.exports='\n \n \n \n \n \n'},function(e,t){e.exports='\n \n \n \n'},function(e,t){e.exports='\n \n \n \n'},function(e,t){e.exports='\n \n \n \n'},function(e,t){e.exports='\n \n \n \n'},function(e,t){e.exports='\n \n \n'},function(e,t){},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(67),s=n(76),l=n(195),c=(n.n(l),n(7)),u=n(1),h=n(2),d=function(){function e(e,t){for(var n=0;n0&&this.singleImageEls.forEach(function(t,n){e.unbindImageListeners(n)}),this.pageControls&&this.pageControls.removeListener("pagechange",this.setPage),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"destroy",this).call(this)}},{key:"load",value:function(){var e=this;return this.setup(),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"load",this).call(this),this.imageEl.classList.add(u.B),this.bindImageListeners(0),this.bindDOMListeners(),this.getRepStatus().getPromise().then(function(){var t=e.options.representation.content.url_template;e.imageUrls=e.constructImageUrls(t),e.imageUrls.forEach(function(t,n){return e.setupImageEls(t,n)}),e.wrapperEl.addEventListener("scroll",e.scrollHandler,!0)}).catch(this.handleAssetError)}},{key:"constructImageUrls",value:function(e){var t=this.options,n=t.viewer,i=t.representation,r=i.metadata,o=n.ASSET;this.pagesCount=r.pages;for(var a=this.createContentUrlWithAuthParams(e,o),s=[],l=1;l<=this.pagesCount;l++)s.push(a.replace("{page}",l));return s}},{key:"setupImageEls",value:function(e,t){0!==t&&(this.singleImageEls[t]=this.imageEl.appendChild(document.createElement("img")),this.bindImageListeners(t)),this.singleImageEls[t].setAttribute("data-page-number",t+1),this.singleImageEls[t].classList.add("page"),this.singleImageEls[t].src=e}},{key:"updatePannability",value:function(){this.wrapperEl&&(this.isPannable=this.imageEl.clientWidth>this.wrapperEl.clientWidth,this.didPan=!1,this.updateCursor())}},{key:"zoom",value:function(e){var t=void 0,n=this.imageEl.parentNode.clientWidth,i=this.imageEl.clientWidth;switch(e){case"in":t=i+100;break;case"out":t=i-100;break;default:t=n}this.imageEl.style.width=t+"px",this.imageEl.parentNode.scrollLeft=(this.imageEl.parentNode.scrollWidth-n)/2,this.setScale(this.imageEl.offsetWidth,this.imageEl.offsetHeight),this.emit("zoom"),setTimeout(this.updatePannability,50),this.setPage(this.currentPageNumber)}},{key:"setScale",value:function(e,t){var n=this.singleImageEls[0];this.scale=e?e/n.naturalWidth:t/n.naturalHeight,this.emit("scale",{scale:this.scale})}},{key:"loadUI",value:function(){p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"loadUI",this).call(this),this.pageControls=new s.a(this.controls,this.wrapperEl),this.bindPageControlListeners()}},{key:"bindPageControlListeners",value:function(){this.pageControls.add(this.currentPageNumber,this.pagesCount),this.pageControls.addListener("pagechange",this.setPage),this.controls.add("Enter fullscreen",this.toggleFullscreen,"bp-enter-fullscreen-icon",c.l),this.controls.add("Exit fullscreen",this.toggleFullscreen,"bp-exit-fullscreen-icon",c.m)}},{key:"bindImageListeners",value:function(e){0===e&&this.singleImageEls[e].addEventListener("load",this.finishLoading),this.singleImageEls[e].addEventListener("error",this.errorHandler)}},{key:"unbindImageListeners",value:function(e){0===e&&this.singleImageEls[e].removeEventListener("load",this.finishLoading),this.singleImageEls[e].removeEventListener("error",this.errorHandler)}},{key:"previousPage",value:function(){this.setPage(this.currentPageNumber-1)}},{key:"nextPage",value:function(){this.setPage(this.currentPageNumber+1)}},{key:"setPage",value:function(e){this.isValidPageChange(e)&&(this.singleImageEls[e-1].scrollIntoView(),this.updateCurrentPage(e))}},{key:"updateCurrentPage",value:function(e){this.isValidPageChange(e)&&(this.currentPageNumber=e,this.pageControls.updateCurrentPage(e),this.emit("pagefocus",{pageNumber:e}))}},{key:"isValidPageChange",value:function(e){return e>=1&&e<=this.pagesCount&&e!==this.currentPageNumber}},{key:"scrollHandler",value:function(){if(!this.scrollCheckHandler){var e=this.handlePageChangeFromScroll;this.scrollCheckHandler=window.requestAnimationFrame(e)}}},{key:"handlePageChangeFromScroll",value:function(){var e=Object(h.s)(this.currentPageNumber,this.previousScrollTop,this.singleImageEls[this.currentPageNumber-1],this.wrapperEl);this.updateCurrentPage(e),this.scrollCheckHandler=null,this.previousScrollTop=this.wrapperEl.scrollTop}}]),t}(a.a);t.a=f},function(e,t){},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(77),s=n(8),l=n(2),c=n(197),u=function(){function e(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:[],i=h(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"determineViewer",this).call(this,e,n);if(i&&!s.a.hasWebGL()){var r=Object(l.w)("We're sorry, your browser doesn't support preview for {1}.",["360-degree images"]);throw new Error(r)}return i}}]),t}(a.a);t.a=new p},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(198),s=(n.n(a),n(78)),l=n(46),c=n(201),u=function(){function e(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:{},i=n;return i.sceneEntities=i.sceneEntities||s.a,c(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"load",this).call(this,e,i).then(this.loadPanoramaFile.bind(this,e)).then(this.onSceneLoad.bind(this))}},{key:"loadPanoramaFile",value:function(e){var t=this;return this.box3d.importEntitiesFromUrl(e).then(function(){return t.imageAsset=t.box3d.getAssetByClass(Box3D.ImageAsset),t.textureAsset=t.box3d.createTexture2d(),t.textureAsset.setProperties({imageId:t.imageAsset.id,wrapModeV:"clampToEdge",wrapModeU:"clampToEdge"}),new Promise(function(e){t.textureAsset.load(function(){t.skybox=t.getSkyboxComponent(),t.skybox.enable(),t.skybox.setAttribute("skyboxTexture",t.textureAsset.id),e()})})},function(){return t.onUnsupportedRepresentation()})}},{key:"enableVr",value:function(){c(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"enableVr",this).call(this),this.getSkyboxComponent().setAttribute("stereoEnabled",!0)}},{key:"disableVr",value:function(){c(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"disableVr",this).call(this),this.getSkyboxComponent().setAttribute("stereoEnabled",!1)}}]),t}(a.a);t.a=u},function(e,t,n){"use strict";var i=n(8);t.a=[{id:"CAMERA_ID",type:"camera",parentId:"SCENE_ID",properties:{near:.05,far:200,fov:70},components:[{name:"Render View",enabled:!0,scriptId:"vr_render_view"},{name:"Orbit Camera",attributes:{panEnabled:!1,zoomEnabled:!0,inertialDamping:.2,lookSpeed:.5},enabled:!0,scriptId:"orbit_camera"},{name:"VR Camera Controller",enabled:!0,scriptId:"vr_camera_controller"}]},{id:"SCENE_ID",type:"scene",children:["CAMERA_ID"],components:[{name:"Skybox",attributes:{size:100},scriptId:"skybox_renderer",enabled:!1}]},{id:"APP_ASSET_ID",type:"application",properties:{startupSceneId:"SCENE_ID"},components:[{name:"Renderer",attributes:{antialias:!i.a.isMobile(),maxTextureSize2d:8192,renderOnDemand:!0},scriptId:"box3d_renderer",isBuiltIn:!0,enabled:!0},{name:"Debug Performance",scriptId:"debug_performance",enabled:!1},{name:"Input",scriptId:"input",isBuiltIn:!0,enabled:!0,attributes:{mouseEvents:{enable:!0,scroll:!0,preventScrollDefault:!0,move:!0,down:!0,preventDownDefault:!1,up:!0,doubleClick:!0,leave:!0,contextMenu:!0,preventContextMenuDefault:!0,dragBufferDistance:12,eventHandler:!0},touchEvents:{enable:!0,start:!0,preventStartDefault:!1,end:!0,doubleTap:!0,cancel:!0,leave:!0,move:!0,preventMoveDefault:!0,dragBufferDistance:12,eventHandler:!0},keyEvents:{enable:!0,down:!0,up:!0,preventDefault:!1,eventHandler:!0}}},{name:"VR Presenter",scriptId:"vr_presenter"}]}]},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(10),s=n(204),l=n(1),c=[{NAME:"SWF",CONSTRUCTOR:s.a,REP:l.O,EXT:["swf"]}],u=function(e){function t(){i(this,t);var e=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.viewers=c,e}return o(t,e),t}(a.a);t.a=new u},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(11),s=n(1),l=function(){function e(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:[],i=f(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"determineViewer",this).call(this,e,n);if(!i||!Object(u.n)(e))return i}}]),t}(a.a);t.a=new g},function(e,t){},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(28),s=n(81),l=n(1),c=n(7),u=n(208),h=(n.n(u),function(){function e(e,t){for(var n=0;n'},e}}]),t}(s.a);t.a=f},function(e,t){},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(82),s=n(2),l=n(1),c=n(210),u=(n.n(c),function(){function e(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:[],i=p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"determineViewer",this).call(this,e,n);if(i&&Object(s.x)(e)){var r=Object(s.w)("We're sorry, your browser doesn't support preview for {1}.",["360-degree videos"]);throw new Error(r)}return i}}]),t}(a.a);t.a=new g},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(83),s=n(218),l=(n.n(s),function(){function e(e,t){for(var n=0;n0?t.toString()+":":"",o=i<10?"0"+i.toString():i.toString(),a=n.toString();return t>0&&n<10&&(a="0"+a),""+r+a+":"+o}},{key:"setDuration",value:function(e){this.durationEl.textContent=this.formatTime(e||0)}},{key:"setTimeCode",value:function(e){var t=this.mediaEl.duration;this.timeScrubber.setValue(t?(e||0)/t:0),this.timecodeEl.textContent=this.formatTime(e||0),this.timeScrubber.setAriaValues(Math.floor(e),this.timecodeEl.textContent+" of "+this.durationEl.textContent)}},{key:"updateProgress",value:function(){var e=this.mediaEl.buffered,t=this.mediaEl.duration||1,n=e.length,i=n?e.end(n-1):0;this.timeScrubber.setBufferedValue(i/t)}},{key:"toggleMute",value:function(){this.show(),this.emit("togglemute")}},{key:"togglePlay",value:function(){this.show(),this.emit("toggleplayback")}},{key:"toggleFullscreen",value:function(){this.show(),this.emit("togglefullscreen")}},{key:"toggleFullscreenIcon",value:function(){d.a.isFullscreen(this.containerEl)?(this.setLabel(this.fullscreenButtonEl,"Exit fullscreen"),this.containerEl.classList.add("bp-is-fullscreen")):(this.setLabel(this.fullscreenButtonEl,"Enter fullscreen"),this.containerEl.classList.remove("bp-is-fullscreen"))}},{key:"toggleSettings",value:function(){this.show(),this.isSettingsVisible()?this.settings.hide():this.settings.show()}},{key:"toggleSubtitles",value:function(){this.show(),this.settings.toggleSubtitles(),this.emit("togglesubtitles")}},{key:"setLabel",value:function(e,t){e.setAttribute("aria-label",t),e.setAttribute("title",t)}},{key:"isSettingsVisible",value:function(){return!!this.settings&&this.settings.isVisible()}},{key:"showPauseIcon",value:function(){this.wrapperEl.classList.add("bp-media-is-playing"),this.setLabel(this.playButtonEl,"Pause")}},{key:"showPlayIcon",value:function(){this.wrapperEl.classList.remove("bp-media-is-playing"),this.setLabel(this.playButtonEl,"Play")}},{key:"updateVolumeIcon",value:function(e){var t=this;v.forEach(function(e){t.volButtonEl.classList.remove(e)}),this.volButtonEl.classList.add(v[Math.ceil(3*e)]),this.volScrubber.setValue(e);var n=Math.floor(100*e);this.volScrubber.setAriaValues(n,n+"% Volume");var i=0===Math.ceil(3*e)?"Unmute":"Mute";this.setLabel(this.volButtonEl,i)}},{key:"increaseSpeed",value:function(){this.settings.increaseSpeed()}},{key:"decreaseSpeed",value:function(){this.settings.decreaseSpeed()}},{key:"scrubberMouseUpHandler",value:function(){this.volScrubbing=!1,this.volScrubberWrapperEl.classList.remove("bp-media-controls-volume-scrubber-expand"),document.removeEventListener("mouseup",this.scrubberMouseUpHandler),document.removeEventListener("mouseleave",this.scrubberMouseUpHandler)}},{key:"scrubberMouseDownHandler",value:function(){this.volScrubbing=!0,document.addEventListener("mouseup",this.scrubberMouseUpHandler),document.addEventListener("mouseleave",this.scrubberMouseUpHandler)}},{key:"scrubberExpand",value:function(){this.volScrubberWrapperEl.classList.add("bp-media-controls-volume-scrubber-expand")}},{key:"scrubberHide",value:function(){this.volScrubbing||this.volScrubberWrapperEl.classList.remove("bp-media-controls-volume-scrubber-expand")}},{key:"attachVolumeScrubberWrapperExpansionHandlers",value:function(){this.volScrubbing=!1,this.volButtonEl.addEventListener("mouseenter",this.scrubberExpand),this.volButtonEl.addEventListener("mouseleave",this.scrubberHide),this.volScrubberEl.addEventListener("mouseenter",this.scrubberExpand),this.volScrubberEl.addEventListener("mouseleave",this.scrubberHide),this.volScrubberEl.addEventListener("mousedown",this.scrubberMouseDownHandler),this.volScrubberEl.addEventListener("mouseup",this.scrubberMouseUpHandler),this.volScrubberEl.addEventListener("focus",this.scrubberExpand),this.volScrubberEl.addEventListener("blur",this.scrubberHide)}},{key:"removeVolumeScrubberWrapperExpansionHandlers",value:function(){this.volButtonEl.removeEventListener("mouseenter",this.scrubberExpand),this.volButtonEl.removeEventListener("mouseleave",this.scrubberHide),this.volScrubberEl.removeEventListener("mouseenter",this.scrubberExpand),this.volScrubberEl.removeEventListener("mouseleave",this.scrubberHide),this.volScrubberEl.removeEventListener("mousedown",this.scrubberMouseDownHandler),this.volScrubberEl.removeEventListener("mouseup",this.scrubberMouseUpHandler),this.volScrubberEl.removeEventListener("focus",this.scrubberExpand),this.volScrubberEl.removeEventListener("blur",this.scrubberHide)}},{key:"attachEventHandlers",value:function(){this.wrapperEl.addEventListener("mouseenter",this.mouseenterHandler),this.wrapperEl.addEventListener("mouseleave",this.mouseleaveHandler),this.attachVolumeScrubberWrapperExpansionHandlers(),this.togglePlayHandler=Object(p.a)(this.togglePlay),this.toggleMuteHandler=Object(p.a)(this.toggleMute),this.toggleFullscreenHandler=Object(p.a)(this.toggleFullscreen),this.toggleSettingsHandler=Object(p.a)(this.toggleSettings),this.toggleSubtitlesHandler=Object(p.a)(this.toggleSubtitles),Object(p.b)(this.playButtonEl,this.togglePlayHandler),Object(p.b)(this.volButtonEl,this.toggleMuteHandler),Object(p.b)(this.fullscreenButtonEl,this.toggleFullscreenHandler),Object(p.b)(this.settingsButtonEl,this.toggleSettingsHandler),Object(p.b)(this.subtitlesButtonEl,this.toggleSubtitlesHandler),d.a.addListener("exit",this.toggleFullscreenIcon),d.a.addListener("enter",this.toggleFullscreenIcon)}},{key:"mouseenterHandler",value:function(){this.preventHiding=!0,this.show()}},{key:"mouseleaveHandler",value:function(){this.preventHiding=!1,this.show()}},{key:"show",value:function(){var e=this;this.wrapperEl&&this.wrapperEl.parentNode&&(this.wrapperEl.parentNode.classList.add("bp-media-controls-is-visible"),clearTimeout(this.autoHideTimeout),this.autoHideTimeout=setTimeout(function(){e.hide()},2e3))}},{key:"hide",value:function(){if(this.preventHiding||this.isSettingsVisible())return void this.show();this.wrapperEl&&this.wrapperEl.parentNode&&(this.wrapperEl.parentNode.classList.remove("bp-media-controls-is-visible"),this.filmstripHideHandler())}},{key:"toggle",value:function(){this.isVisible()?(this.preventHiding=!1,this.settings.hide(),this.hide()):this.show()}},{key:"isVisible",value:function(){return this.wrapperEl.parentNode.classList.contains("bp-media-controls-is-visible")}},{key:"resizeTimeScrubber",value:function(){this.timeScrubber&&this.timeScrubber.resize(32)}},{key:"setFilmstrip",value:function(){this.filmstripEl&&(this.filmstripEl.src=this.filmstripUrl)}},{key:"initFilmstrip",value:function(e,t,n,i){var r=this;this.filmstripUrl=e,this.filmstripInterval=i,this.filmstripContainerEl=this.containerEl.appendChild(document.createElement("div")),this.filmstripContainerEl.className="bp-media-filmstrip-container",this.filmstripContainerEl.innerHTML='',this.filmstripEl=this.filmstripContainerEl.appendChild(document.createElement("img")),this.filmstripEl.className="bp-media-filmstrip",this.filmstripTimeEl=this.filmstripContainerEl.appendChild(document.createElement("div")),this.filmstripTimeEl.className="bp-media-filmstrip-timecode";var o=90*n;this.timeScrubber.getHandleEl().addEventListener("mousedown",this.timeScrubbingStartHandler),this.hasTouch&&this.timeScrubberEl.addEventListener("touchstart",this.timeScrubbingStartHandler),this.timeScrubber.getConvertedEl().addEventListener("mousemove",this.filmstripShowHandler),this.timeScrubber.getConvertedEl().addEventListener("mouseleave",this.filmstripHideHandler),this.filmstripEl.onload=function(){r.filmstripContainerEl&&(r.filmstripContainerEl.style.width=o+2+"px",r.filmstripContainerEl.querySelector(".bp-media-crawler-wrapper").style.display="none")},t.getPromise().then(this.setFilmstrip)}},{key:"timeScrubbingStartHandler",value:function(){this.isScrubbing=!0,this.preventHiding=!0,document.addEventListener("mouseup",this.timeScrubbingStopHandler),this.hasTouch&&document.addEventListener("touchend",this.timeScrubbingStopHandler),document.addEventListener("mousemove",this.filmstripShowHandler),this.hasTouch&&document.addEventListener("touchmove",this.show)}},{key:"timeScrubbingStopHandler",value:function(e){this.isScrubbing=!1,this.preventHiding=!1,document.removeEventListener("mouseup",this.timeScrubbingStopHandler),document.removeEventListener("mousemove",this.filmstripShowHandler),document.removeEventListener("touchend",this.timeScrubbingStopHandler),document.removeEventListener("touchmove",this.show),this.timeScrubberEl.contains(e.target)||(this.filmstripContainerEl.style.display="none")}},{key:"computeFilmstripPositions",value:function(e,t,n,i){var r=this.timeScrubber.computeScrubberPosition(e)*this.mediaEl.duration,o=Math.floor(r/this.filmstripInterval),a=i/100,s=o%100*-1*a,l=-90*Math.floor(o/100);i||(s=0,l=0,a=160);var c=Math.max(0,e-t-a/2);return{time:r,left:s,top:l,containerLeft:Math.min(c,n-a)}}},{key:"filmstripShowHandler",value:function(e){if(!this.isSettingsVisible()){var t=this.containerEl.getBoundingClientRect(),n=e.pageX,i=this.computeFilmstripPositions(n,t.left,t.width,this.filmstripEl.naturalWidth);this.filmstripEl.style.left=i.left+"px",this.filmstripEl.style.top=i.top+"px",this.filmstripContainerEl.style.display="block",this.filmstripContainerEl.style.left=i.containerLeft+"px",this.filmstripTimeEl.textContent=this.formatTime(i.time)}}},{key:"filmstripHideHandler",value:function(){!this.isScrubbing&&this.filmstripEl&&(this.filmstripContainerEl.style.display="none")}},{key:"isTimeScrubberFocused",value:function(){return document.activeElement===this.timeScrubberEl}},{key:"isVolumeScrubberFocused",value:function(){return document.activeElement===this.volScrubberEl}},{key:"initSubtitles",value:function(e,t){this.settings.addListener("subtitles",this.handleSubtitle),this.settings.loadSubtitles(e,t)}},{key:"initAlternateAudio",value:function(e){this.settings.addListener("audiotracks",this.handleAudioTrack),this.settings.loadAlternateAudio(e)}},{key:"enableHDSettings",value:function(){this.settings.enableHD()}}]),t}(s.a);t.a=g},function(e,t){e.exports='\n'},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(4),s=n.n(a),l=n(216),c=n.n(l),u=n(8),h=function(){function e(e,t){for(var n=0;n4&&void 0!==arguments[4]?arguments[4]:d,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:p,h=arguments.length>6&&void 0!==arguments[6]?arguments[6]:p;i(this,t);var v=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return v.containerEl=e,v.containerEl.setAttribute("role","slider"),v.containerEl.setAttribute("aria-label",n),v.containerEl.setAttribute("title",n),v.containerEl.setAttribute("aria-valuemin",o),v.containerEl.setAttribute("aria-valuemax",a),v.containerEl.setAttribute("aria-valuenow",s),v.containerEl.innerHTML=c.a.replace(/>\s* <"),v.scrubberContainerEl=v.containerEl.querySelector(".bp-media-scrubber-container"),v.scrubberWrapperEl=v.containerEl.querySelector(".bp-media-scrubber-wrapper"),v.scrubberEl=v.containerEl.querySelector(".bp-media-scrubber"),v.bufferedEl=v.scrubberEl.querySelector(".bp-media-scrubber-buffered"),v.convertedEl=v.scrubberEl.querySelector(".bp-media-scrubber-converted"),v.playedEl=v.scrubberEl.querySelector(".bp-media-scrubber-played"),v.handleEl=v.scrubberEl.querySelector(".bp-media-scrubber-handle"),v.hasTouch=u.a.hasTouch(),v.setConvertedValue(h),v.setBufferedValue(l),v.setValue(s),v.pointerUpHandler=v.pointerUpHandler.bind(v),v.scrubbingHandler=v.scrubbingHandler.bind(v),v.pointerDownHandler=v.pointerDownHandler.bind(v),v.playedEl.addEventListener("mousedown",v.pointerDownHandler),v.convertedEl.addEventListener("mousedown",v.pointerDownHandler),v.handleEl.addEventListener("mousedown",v.pointerDownHandler),v.hasTouch&&(v.scrubberContainerEl.addEventListener("touchstart",v.pointerDownHandler),v.scrubberWrapperEl.classList.add(f)),v}return o(t,e),h(t,[{key:"destroy",value:function(){this.removeAllListeners(),this.destroyDocumentHandlers(),this.playedEl.removeEventListener("mousedown",this.pointerDownHandler),this.convertedEl.removeEventListener("mousedown",this.pointerDownHandler),this.handleEl.removeEventListener("mousedown",this.pointerDownHandler),this.scrubberContainerEl.removeEventListener("touchstart",this.pointerDownHandler),this.scrubberContainerEl=void 0,this.scrubberWrapperEl=void 0,this.scrubberEl=void 0,this.bufferedEl=void 0,this.convertedEl=void 0,this.playedEl=void 0,this.handleEl=void 0,this.containerEl.innerHTML=""}},{key:"resize",value:function(e){this.scrubberWrapperEl.style.width=this.containerEl.clientWidth-e+"px"}},{key:"setAriaValues",value:function(e,t){this.containerEl.setAttribute("aria-valuenow",e),this.containerEl.setAttribute("aria-valuetext",t)}},{key:"setValue",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:d;e!==this.value&&(this.value=Math.max(Math.min(e,this.convertedValue),d),this.playedEl.style.width=100*this.value+"%",this.handleEl.style.left=100*this.value+"%")}},{key:"setBufferedValue",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:p;e!==this.bufferedValue&&(this.bufferedValue=Math.max(Math.min(e,this.convertedValue),this.value||d),this.bufferedEl.style.width=100*this.bufferedValue+"%")}},{key:"setConvertedValue",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:p;e!==this.convertedValue&&(this.convertedValue=Math.max(Math.min(Math.max(e,this.convertedValue||d),p),d),this.convertedEl.style.width=100*this.convertedValue+"%")}},{key:"computeScrubberPosition",value:function(e){var t=this.scrubberEl.getBoundingClientRect(),n=(e-t.left)/t.width;return Math.max(Math.min(n,p),d)}},{key:"scrubbingHandler",value:function(e){e.preventDefault();var t=e.pageX;e.touches&&(t=e.touches[0].pageX);var n=this.computeScrubberPosition(t);this.setValue(n),this.emit("valuechange")}},{key:"pointerDownHandler",value:function(e){!("number"!=typeof e.button||e.button<2)||e.ctrlKey||e.metaKey||(this.scrubbingHandler(e),document.addEventListener("mouseup",this.pointerUpHandler),document.addEventListener("mouseleave",this.pointerUpHandler),document.addEventListener("mousemove",this.scrubbingHandler),this.hasTouch?(document.addEventListener("touchmove",this.scrubbingHandler),document.addEventListener("touchend",this.pointerUpHandler)):this.scrubberWrapperEl.classList.add("bp-media-scrubber-hover"),e.preventDefault())}},{key:"pointerUpHandler",value:function(){this.scrubberWrapperEl.classList.remove("bp-media-scrubber-hover"),this.destroyDocumentHandlers()}},{key:"destroyDocumentHandlers",value:function(){document.removeEventListener("mousemove",this.scrubbingHandler),document.removeEventListener("mouseup",this.pointerUpHandler),document.removeEventListener("mouseleave",this.pointerUpHandler),this.hasTouch&&(document.removeEventListener("touchmove",this.scrubbingHandler),document.removeEventListener("touchend",this.pointerUpHandler))}},{key:"getValue",value:function(){return this.value}},{key:"getHandleEl",value:function(){return this.handleEl}},{key:"getConvertedEl",value:function(){return this.convertedEl}}]),t}(s.a);t.a=v},function(e,t){e.exports='\n'},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(4),s=n.n(a),l=n(2),c=n(7),u=n(1),h=n(8),d=function(){function e(e,t){for(var n=0;n\n \n \n \n \n \n \n',y='',E=function(e){function t(e,n){i(this,t);var o=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return o.visible=!1,o.subtitles=[],o.language=void 0,o.toggleToSubtitle=void 0,o.containerEl=e,o.cache=n,o.handleTransitionEnd=o.handleTransitionEnd.bind(o),o.blurHandler=o.blurHandler.bind(o),o.menuEventHandler=o.menuEventHandler.bind(o),Object(l.m)(o.containerEl,b,e.querySelector(".bp-media-controls-wrapper")),o.settingsEl=o.containerEl.querySelector(".bp-media-settings"),o.firstMenuItem=o.settingsEl.querySelectorAll(".bp-media-settings-item")[0],o.settingsButtonEl=o.containerEl.querySelector(".bp-media-gear-icon"),o.ccButtonEl=o.containerEl.querySelector(".bp-media-cc-icon"),Object(l.b)(o.settingsEl,o.menuEventHandler),o.containerEl.classList.add(p),o.containerEl.classList.add(f),o.containerEl.classList.add(v),o.settingsEl.addEventListener("transitionend",o.handleTransitionEnd),h.a.isMobile()&&o.containerEl.classList.add(g),o.init(),o}return o(t,e),d(t,[{key:"init",value:function(){var e=this.cache.get("media-speed")||"1.0",t=this.cache.get("media-autoplay")||"Disabled";this.chooseOption("quality","sd",!1),this.chooseOption("speed",e),this.chooseOption("autoplay",t)}},{key:"destroy",value:function(){this.settingsEl&&(Object(l.v)(this.settingsEl,this.menuEventHandler),this.settingsEl.removeEventListener("transitionend",this.handleTransitionEnd)),document.removeEventListener("click",this.blurHandler)}},{key:"reset",value:function(){this.settingsEl.className="bp-media-settings";var e=this.settingsEl.querySelector(".bp-media-settings-menu-main");this.setMenuContainerDimensions(e)}},{key:"getMediaSpeeds",value:function(){return m}},{key:"increaseSpeed",value:function(){var e=parseFloat(this.cache.get("media-speed")||"1.0"),t=m.filter(function(t){return parseFloat(t)>e});t.length>0&&this.chooseOption("speed",t[0])}},{key:"decreaseSpeed",value:function(){var e=parseFloat(this.cache.get("media-speed")||"1.0"),t=m.filter(function(t){return parseFloat(t)0&&this.chooseOption("speed",t[t.length-1])}},{key:"setMenuContainerDimensions",value:function(e){this.settingsEl.style.width=e.offsetWidth+18+"px";var t=[].reduce.call(e.children,function(e,t){return e+t.offsetHeight},0);this.settingsEl.style.height=t+18+"px"}},{key:"findParentDataType",value:function(e){for(var t=e;t&&t!==this.settingsEl;){if("string"==typeof t.getAttribute("data-type"))return t;t=t.parentNode}return null}},{key:"showSubMenu",value:function(e){var t=this.settingsEl.querySelector(".bp-media-settings-menu-"+e);if(!t.getAttribute("data-disabled")){this.settingsEl.classList.add("bp-media-settings-show-"+e),this.setMenuContainerDimensions(t);this.settingsEl.querySelector('[data-type="'+e+'"].bp-media-settings-sub-item.bp-media-settings-selected').focus()}}},{key:"menuItemSelect",value:function(e){var t=e.getAttribute("data-type"),n=e.getAttribute("data-value");this.settingsEl.classList.add("bp-media-settings-in-transition"),"menu"===t?(this.reset(),this.firstMenuItem.focus()):t&&n?this.chooseOption(t,n):t&&this.showSubMenu(t)}},{key:"menuEventHandler",value:function(e){var t=this.findParentDataType(e.target);if(t){if("click"===e.type)this.menuItemSelect(t);else if("keydown"===e.type){var n=Object(l.i)(e).toLowerCase(),i=t.parentElement,r=[].filter.call(i.children,function(e){return null!==e.offsetParent}),o=[].findIndex.call(r,function(e){return e.contains(t)});switch(n){case"space":case"enter":this.containerEl.classList.add(u.x),this.menuItemSelect(t);break;case"arrowup":if(this.containerEl.classList.add(u.x),o>0){var a=r[o-1];a.focus()}break;case"arrowdown":if(this.containerEl.classList.add(u.x),o>=0&&o=0&&!r[o].classList.contains("bp-media-settings-item")&&(this.reset(),this.firstMenuItem.focus());break;case"arrowright":if(o>=0){var c=r[o],h=c.getAttribute("data-type");c.classList.contains("bp-media-settings-item")&&"menu"!==h&&this.showSubMenu(h)}break;case"escape":this.hide(),this.settingsButtonEl.focus();break;default:return}e.preventDefault(),e.stopPropagation()}"keydown"===e.type&&(e.preventDefault(),e.stopPropagation())}}},{key:"handleTransitionEnd",value:function(){this.settingsEl.classList.remove("bp-media-settings-in-transition")}},{key:"getSelectedOption",value:function(e){return this.settingsEl.querySelector('[data-type="'+e+'"].bp-media-settings-sub-item.bp-media-settings-selected')}},{key:"chooseOption",value:function(e,t){(!(arguments.length>2&&void 0!==arguments[2])||arguments[2])&&this.cache.set("media-"+e,t,!0),this.emit(e);var n=this.settingsEl.querySelector('[data-type="'+e+'"][data-value="'+t+'"]'),i=n.querySelector(".bp-media-settings-value").textContent;this.settingsEl.querySelector('[data-type="'+e+'"] .bp-media-settings-value').textContent=i;var r=this.getSelectedOption(e);r&&(r.classList.remove("bp-media-settings-selected"),r.removeAttribute("aria-checked")),n.classList.add("bp-media-settings-selected"),n.setAttribute("aria-checked","true"),this.reset(),this.firstMenuItem.focus(),"subtitles"===e&&this.handleSubtitleSelection(r.getAttribute("data-value"),t)}},{key:"handleSubtitleSelection",value:function(e,t){"-1"===t?(e!==t&&(this.toggleToSubtitle=e),this.containerEl.classList.remove("bp-media-settings-subtitles-on"),this.ccButtonEl.setAttribute("aria-pressed","false")):(this.containerEl.classList.add("bp-media-settings-subtitles-on"),this.ccButtonEl.setAttribute("aria-pressed","true"))}},{key:"blurHandler",value:function(e){if(!this.settingsEl.contains(e.target)){var t=Object(l.i)(e);if("Escape"===t)return this.hide(),e.preventDefault(),void e.stopPropagation();this.settingsButtonEl.contains(e.target)||"click"!==e.type&&"Space"!==t&&"Enter"!==t||this.hide()}}},{key:"isVisible",value:function(){return this.visible}},{key:"show",value:function(){this.visible=!0,this.containerEl.classList.add("bp-media-settings-is-open"),this.firstMenuItem.focus(),document.addEventListener("click",this.blurHandler,!0),document.addEventListener("keydown",this.blurHandler,!0)}},{key:"hide",value:function(){this.reset(),this.containerEl.classList.remove("bp-media-settings-is-open"),this.visible=!1,document.removeEventListener("click",this.blurHandler,!0),document.removeEventListener("keydown",this.blurHandler,!0)}},{key:"areSubtitlesOn",value:function(){return"-1"!==this.getSelectedOption("subtitles").getAttribute("data-value")}},{key:"hasSubtitles",value:function(){return!!this.settingsEl.querySelector('[data-type="subtitles"][data-value="0"].bp-media-settings-sub-item')}},{key:"toggleSubtitles",value:function(){var e=this;if(this.areSubtitlesOn())this.chooseOption("subtitles","-1");else if(void 0!==this.toggleToSubtitle)this.chooseOption("subtitles",this.toggleToSubtitle.toString());else{var t=this.subtitles.findIndex(function(t){return t===e.language});-1===t&&-1===(t=this.subtitles.findIndex(function(e){return"English"===e}))&&(t=0),this.chooseOption("subtitles",t.toString())}}},{key:"loadSubtitles",value:function(e,t){var n=this.settingsEl.querySelector(".bp-media-settings-menu-subtitles");this.subtitles=e,this.language=t,this.subtitles.forEach(function(e,t){Object(l.m)(n,y.replace(/{{dataType}}/g,"subtitles").replace(/{{dataValue}}/g,t)),n.lastChild.querySelector(".bp-media-settings-value").textContent=e}),this.containerEl.classList.remove(p);var i=this.cache.get("media-subtitles");null!==i&&"-1"!==i&&this.toggleSubtitles(),this.reset()}},{key:"loadAlternateAudio",value:function(e){var t=this.settingsEl.querySelector(".bp-media-settings-menu-audiotracks");e.forEach(function(e,n){Object(l.m)(t,y.replace(/{{dataType}}/g,"audiotracks").replace(/{{dataValue}}/g,n));var i=t.lastChild.querySelector(".bp-media-settings-value"),r="Track "+(n+1);"und"!==e&&(r=r+" ("+e+")"),i.textContent=r}),this.chooseOption("audiotracks","0"),this.containerEl.classList.remove(f),this.reset()}},{key:"enableHD",value:function(){this.containerEl.classList.remove(v),this.containerEl.querySelector(".bp-media-settings-menu-quality").setAttribute("data-disabled","");var e=this.cache.get("media-quality")||"auto";this.chooseOption("quality",e)}}]),t}(s.a);t.a=E},function(e,t){},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(84),s=n(220),l=(n.n(s),function(){function e(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:[],i=h(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"determineViewer",this).call(this,e,n);if(i){var r=s.a.getName(),o=s.a.isIOS();if(!p.some(function(e){return e===r})||o||!s.a.hasWebGL()){var a=Object(l.w)("We're sorry, your browser doesn't support preview for {1}.",["360-degree videos"]);throw new Error(a)}}return i}}]),t}(a.a);t.a=new v},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(12),s=n(85),l=n(225),c=n(226),u=n(227),h=n(16),d=n(80),p=n(228),f=(n.n(p),function(){function e(e,t){for(var n=0;n'+u.k+"").trim(),t=(''+u.j+" ").trim(),n=(''+u.g+" ").trim();this.findButtonContainerEl=document.createElement("span"),this.findButtonContainerEl.classList.add("bp-doc-find-controls"),this.findButtonContainerEl.innerHTML=e+t+n,this.bar.appendChild(this.findButtonContainerEl)}},{key:"destroy",value:function(){this.currentMatch=0,this.unbindDOMListeners(),this.bar&&this.bar.parentNode&&this.bar.parentNode.removeChild(this.bar)}},{key:"dispatchFindEvent",value:function(e,t){this.findController.executeCommand(e,{query:this.findFieldEl.value,phraseSearch:!0,highlightAll:!0,findPrevious:t})}},{key:"updateUIState",value:function(e){switch(this.status="",e){case 1:this.findFieldEl.classList.add("bp-find-match-not-found");break;case 3:this.status="pending";break;case 0:this.findFieldEl.classList.remove("bp-find-match-not-found")}this.findFieldEl.setAttribute("data-status",this.status),this.updateUIResultsCount()}},{key:"updateUIResultsCount",value:function(){if(this.findResultsCountEl){if(!this.findController.matchCount)return void this.findResultsCountEl.classList.add(c.A);var e=this.findResultsCountEl.getBoundingClientRect().width+13;this.findFieldEl.style.paddingRight=e+"px",this.findResultsCountEl.textContent=this.currentMatch+" of "+this.findController.matchCount,this.findResultsCountEl.classList.remove(c.A)}}},{key:"setFindFieldElValue",value:function(e){this.findFieldEl.value=e}},{key:"bindDOMListeners",value:function(){this.bar.addEventListener("keydown",this.barKeyDownHandler),this.findFieldEl.addEventListener("input",this.findFieldHandler),this.findPreviousButtonEl.addEventListener("click",this.findPreviousHandler),this.findNextButtonEl.addEventListener("click",this.findNextHandler),this.findCloseButtonEl.addEventListener("click",this.close),document.addEventListener("keydown",this.displayFindBarHandler)}},{key:"unbindDOMListeners",value:function(){this.bar.removeEventListener("keydown",this.barKeyDownHandler),this.findFieldEl.removeEventListener("input",this.findFieldHandler),this.findPreviousButtonEl.removeEventListener("click",this.findPreviousHandler),this.findNextButtonEl.removeEventListener("click",this.findNextHandler),this.findCloseButtonEl.removeEventListener("click",this.close),document.removeEventListener("keydown",this.displayFindBarHandler)}},{key:"displayFindBarHandler",value:function(e){switch(Object(l.i)(e).toLowerCase()){case"meta+f":case"control+f":case"meta+g":case"control+g":case"f3":this.canDownload&&this.open(),e.preventDefault()}}},{key:"findFieldHandler",value:function(){this.dispatchFindEvent("find"),this.currentMatch=1}},{key:"barKeyDownHandler",value:function(e){switch(Object(l.i)(e).toLowerCase()){case"enter":this.findNextHandler(!1);break;case"shift+enter":this.findPreviousHandler(!1);break;case"escape":case"esc":if(!this.opened)return;this.close(),e.stopPropagation(),e.preventDefault();break;case"shift++":case"shift+_":case"[":case"]":e.stopPropagation()}}},{key:"findNextHandler",value:function(e){this.findFieldEl.value&&(e?(this.dispatchFindEvent("findagain",!1),this.currentMatch=this.currentMatch+1,this.currentMatch>this.findController.matchCount&&(this.currentMatch=1)):this.findNextButtonEl.focus())}},{key:"findPreviousHandler",value:function(e){this.findFieldEl.value&&(e?(this.dispatchFindEvent("findagain",!0),this.currentMatch=this.currentMatch-1,this.currentMatch<=0&&(this.currentMatch=this.findController.matchCount)):this.findPreviousButtonEl.focus())}},{key:"open",value:function(){this.prevSearchQuery&&(this.setFindFieldElValue(this.prevSearchQuery),this.findFieldHandler()),this.opened||(this.opened=!0,this.bar.classList.remove(c.A)),this.findFieldEl.select(),this.findFieldEl.focus()}},{key:"close",value:function(){this.prevSearchQuery=this.findFieldEl.value,this.setFindFieldElValue(""),this.findFieldHandler(),this.opened&&(this.opened=!1,this.bar.classList.add(c.A),this.findController.active=!1)}}]),t}(s.a);t.a=d},function(e,t,n){"use strict";n.d(t,"b",function(){return o}),n.d(t,"a",function(){return a});var i=n(1),r="third-party/doc/"+i.K+"/",o=[r+"pdf.min.js",r+"pdf_viewer.min.js",r+"pdf.worker.min.js",r+"exif.min.js"],a=[r+"pdf_viewer.min.css"]},function(e,t){},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(27),s=n.n(a),l=n(86),c=n(235),u=n(1),h=n(7),d=n(236),p=(n.n(d),function(){function e(e,t){for(var n=0;ne.clientWidth,i=t.clientHeight-30>e.clientHeight;return e.classList.remove("overflow-x"),e.classList.remove("overflow-y"),n&&e.classList.add("overflow-x"),i&&e.classList.add("overflow-y"),n||i}},{key:"initViewer",value:function(e){f(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"initViewer",this).call(this,e),this.overwritePdfViewerBehavior()}},{key:"bindDOMListeners",value:function(){f(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"bindDOMListeners",this).call(this),this.docEl.addEventListener("wheel",this.throttledWheelHandler),this.hasTouch&&(this.docEl.addEventListener("touchstart",this.mobileScrollHandler),this.docEl.addEventListener("touchmove",this.mobileScrollHandler),this.docEl.addEventListener("touchend",this.mobileScrollHandler))}},{key:"unbindDOMListeners",value:function(){f(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"unbindDOMListeners",this).call(this),this.docEl.removeEventListener("wheel",this.throttledWheelHandler),this.hasTouch&&(this.docEl.removeEventListener("touchstart",this.mobileScrollHandler),this.docEl.removeEventListener("touchmove",this.mobileScrollHandler),this.docEl.removeEventListener("touchend",this.mobileScrollHandler))}},{key:"bindControlListeners",value:function(){f(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"bindControlListeners",this).call(this),this.controls.add("Zoom out",this.zoomOut,"bp-exit-zoom-out-icon",h.v),this.controls.add("Zoom in",this.zoomIn,"bp-enter-zoom-in-icon",h.u),this.pageControls.add(this.pdfViewer.currentPageNumber,this.pdfViewer.pagesCount),this.controls.add("Enter fullscreen",this.toggleFullscreen,"bp-enter-fullscreen-icon",h.l),this.controls.add("Exit fullscreen",this.toggleFullscreen,"bp-exit-fullscreen-icon",h.m)}},{key:"mobileScrollHandler",value:function(e){if(!this.checkOverflow())if("touchstart"===e.type)this.scrollStart=e.changedTouches[0].clientY;else if("touchmove"===e.type)e.preventDefault();else{var t=e.changedTouches[0].clientY;this.scrollStart&&this.scrollStart>t+5?this.nextPage():this.scrollStart&&this.scrollStart0?e.nextPage():t.deltaY<0&&e.previousPage())},200)}},{key:"overwritePdfViewerBehavior",value:function(){var e=this;this.pdfViewer.scrollPageIntoView=function(t){var n=t;"number"!=typeof n&&(n=t.pageNumber||1),e.setPage(n)},this.pdfViewer._getVisiblePages=function(){var t=e.pdfViewer._pages[e.pdfViewer._currentPageNumber-1];return{first:t,last:t,views:[{id:t.id,view:t}]}}}}]),t}(l.a);t.a=v},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(87),s=n(1),l=n(2),c=function(){function e(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:[],i=h(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"determineViewer",this).call(this,e,n);if(i&&!s.a.supportsModel3D()){var r=Object(l.w)("We're sorry, your browser doesn't support preview for {1}.",["3D models"]);throw new Error(r)}return i}}]),t}(a.a);t.a=new p},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(78),s=n(239),l=n(242),c=n(22),u=n(16),h=n(245),d=(n.n(h),function(){function e(e,t){for(var n=0;n2&&void 0!==arguments[2])||arguments[2];this.renderer.setAxisRotation(e,t,n)}},{key:"handleSceneLoaded",value:function(){var e=this;return this.loaded=!0,this.boxSdk.getMetadataClient().get(this.options.file.id,"global","box3d").then(function(e){if(200!==e.status)throw new Error("Received unsuccessful response status: "+e.status);return e.response}).catch(this.onMetadataError).then(function(t){return e.controls&&e.controls.addUi(),e.axes.up=t.upAxis||"+Y",e.axes.forward=t.forwardAxis||"+Z",e.renderMode=t.defaultRenderMode||c.A,e.projection=t.cameraProjection||c.e,"true"===t.renderGrid?e.renderGrid=!0:"false"===t.renderGrid?e.renderGrid=!1:e.renderGrid=!0,"+Y"===e.axes.up&&"+Z"===e.axes.forward||e.handleRotationAxisSet(e.axes.up,e.axes.forward,!1),e.handleReset(),e.populateAnimationControls(),e.showWrapper(),e.emit(u.e),!0})}},{key:"onMetadataError",value:function(e){return{}}},{key:"populateAnimationControls",value:function(){var e=this;if(this.controls){var t=this.renderer.box3d.getEntitiesByType("animation");if(t.length>0){var n=t[0].getClipIds();n.forEach(function(n){var i=t[0].getClip(n),r=i.stop-i.start;e.controls.addAnimationClip(n,i.name,r)}),n.length>0&&(this.controls.showAnimationControls(),this.controls.selectAnimationClip(n[0]))}}}},{key:"handleToggleAnimation",value:function(e){this.renderer.toggleAnimation(e)}},{key:"handleCanvasClick",value:function(){this.controls.hidePullups()}},{key:"showWrapper",value:function(){this.wrapperEl.classList.remove(u.c)}},{key:"handleReset",value:function(){p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"handleReset",this).call(this),this.controls&&(this.controls.handleSetRenderMode(this.renderMode),this.controls.setCurrentProjectionMode(this.projection),this.controls.handleSetSkeletonsVisible(!1),this.controls.handleSetWireframesVisible(!1),this.controls.handleSetGridVisible(this.renderGrid)),this.renderer&&(this.handleRotationAxisSet(this.axes.up,this.axes.forward,!1),this.renderer.stopAnimation(),this.renderer.resetView())}},{key:"handleSetRenderMode",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Lit";this.renderer.setRenderMode(e)}},{key:"handleToggleHelpers",value:function(e){this.renderer.toggleHelpers(e)}},{key:"handleSetCameraProjection",value:function(e){this.renderer.setCameraProjection(e)}},{key:"handleShowSkeletons",value:function(e){this.renderer.setSkeletonsVisible(e)}},{key:"handleShowWireframes",value:function(e){this.renderer.setWireframesVisible(e)}},{key:"handleShowGrid",value:function(e){this.renderer.setGridVisible(e)}}]),t}(a.a);t.a=f},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(46),s=n(240),l=n(241),c=n(22),u=n(16),h=n(7),d=function(){function e(e,t){for(var n=0;n\n
\n
\n '.trim(),f=function(e){function t(){i(this,t);var e=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.pullupEl=Object(c.e)(),e.pullupEl.classList.add(l.f),e.uiRegistry=new c.a,e.uiRegistry.registerItem("settings-pullup-el",e.pullupEl),e.clipEls={},e}return o(t,e),d(t,[{key:"addClip",value:function(e,t,n){var i=Object(h.g)(this.pullupEl,p),r=i.firstChild,o=this.formatDurationStr(n),a=r.querySelector(".box3d-animation-clip-value");a.setAttribute("data-value",e),a.textContent=o+" "+t,a.addEventListener("click",this.handleClipClick.bind(this)),this.pullupEl.appendChild(r),this.clipEls[e]=r}},{key:"destroy",value:function(){this.pullupEl=null,this.uiRegistry.unregisterAll(),this.uiRegistry=null}},{key:"formatDurationStr",value:function(e){var t=Math.floor(e),n=Math.floor(t/3600),i=this.padLeft(n.toString(),2);t-=3600*n;var r=Math.floor(t/60),o=this.padLeft(r.toString(),2);return t-=60*r,i+":"+o+":"+this.padLeft(t.toString(),2)}},{key:"getClipCount",value:function(){return Object.keys(this.clipEls).length}},{key:"getClipId",value:function(e){return Object.keys(this.clipEls)[e]}},{key:"handleClipClick",value:function(e){if(e.target){var t=e.target.getAttribute("data-value");this.selectClip(t)}}},{key:"hide",value:function(){this.pullupEl.classList.add(l.g)}},{key:"padLeft",value:function(e,t){return e.length>=t?e:new Array(t-e.length+1).join("0")+e}},{key:"reset",value:function(){this.getClipCount()>0&&this.selectClip(this.getClipId(0))}},{key:"selectClip",value:function(e){var t=this;Object.keys(this.clipEls).forEach(function(n){t.clipEls[n].querySelector(".box3d-animation-clip-icon").innerHTML=n===e?u.f:""}),this.emit(l.o,e)}},{key:"show",value:function(){this.pullupEl.classList.remove(l.g)}},{key:"toggle",value:function(){this.pullupEl.classList.toggle(l.g)}}]),t}(s.a);t.a=f},function(e,t,n){"use strict";function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t1&&void 0!==arguments[1]?arguments[1]:{},r=p({},i),o=r.location;if(o&&(r.sceneEntities=Object(c.a)(o.staticBaseURI),!r.box3dApplication)){var a=Object(d.e)(o);r.box3dApplication=a(g)}return v(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"load",this).call(this,e,r).then(this.loadBox3dFile.bind(this,i.file.id)).catch(function(){return n.onUnsupportedRepresentation()})}},{key:"handleCanvasClick",value:function(e){this.emit(u.l,e)}},{key:"loadBox3dFile",value:function(e){var t=this;this.box3d.canvas.addEventListener("click",this.handleCanvasClick);var n=this.box3d.getApplication().getComponentByScriptId("render_modes");return n&&n.setAttribute("shapeTexture","MAT_CAP_TEX"),new Promise(function(n,i){var r=t.getScene();r||i(new Error("Provided Box3D application data contains no scene")),t.instance=r.getDescendantByName("Preview Model"),t.instance||i(new Error('Provided Box3D application must include node named "Preview Model"')),t.instance.getComponentByScriptId("remote_instance")?(t.instance.once("remoteInstanceCreated",function(){t.setupScene(),n()}),t.instance.trigger("createRemoteInstance",e)):t.instance.when("load",function(){t.setupScene(),n()})})}},{key:"setupScene",value:function(){var e=this,t=this.getScene();if(!t)return void this.onSceneLoad();this.instance.addComponent("axis_rotation",{},"axis_rotation_"+this.instance.id),this.instance.addComponent("animation",{},"animation_"+this.instance.id);var n=this.box3d.getAssetsByClass(Box3D.AnimationAsset);n.length>0&&this.setAnimationAsset(n[0]),this.addHelpersToScene(),t.when("load",function(){return e.onSceneLoad()})}},{key:"reset",value:function(){this.resetModel(),v(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"reset",this).call(this)}},{key:"resetModel",value:function(){if(this.instance){this.instance.getChildren().forEach(function(e){e.setPosition(m.x,m.y,m.z),e.setScale(1,1,1),e.setQuaternion(b.x,b.y,b.z,b.w),e.unsetProperty("bounds")}),this.instance.unsetProperty("bounds");var e=this.instance.getComponentByScriptId("scale_to_size");e&&e.enable();var t=this.instance.getComponentByScriptId("align_to_position");t&&t.enable(),this.vrEnabled&&this.disableAutoTransform()}}},{key:"resetView",value:function(){v(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"resetView",this).call(this);var e=this.getCamera();if(e){var n=e.getComponentByScriptId("orbit_camera");if(n&&this.instance.runtimeData){var i=this.instance.getBounds();this.instance.runtimeData.updateMatrixWorld(),i.min.applyMatrix4(this.instance.runtimeData.matrixWorld),i.max.applyMatrix4(this.instance.runtimeData.matrixWorld);var r=new THREE.Vector3;r.subVectors(i.max,i.min);var o=this.instance.getCenter();o.applyMatrix4(this.instance.runtimeData.matrixWorld),n.reset(),n.setPivotPosition(o);var a=1.5*Math.max(Math.max(r.x,r.y),r.z);n.setOrbitDistance(a)}}}},{key:"onSceneLoad",value:function(){v(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"onSceneLoad",this).call(this),this.initVrGamepadControls(),this.resetSkeletons(),this.box3d.getEntitiesByType("video").forEach(function(e){return e.play()})}},{key:"setAnimationAsset",value:function(e){if(this.instance){var t=this.instance.getComponentByScriptId("animation");t.setAsset(e),t.setLoop(!0)}}},{key:"setAnimationClip",value:function(e){if(this.instance){this.instance.getComponentByScriptId("animation").setClipId(e)}}},{key:"toggleAnimation",value:function(e){var t=this;if(this.instance){var n=this.instance.getComponentByScriptId("animation"),i=n?n.asset:void 0;i&&i.when("load",function(){t.instance.when("load",function(){e?n.play():n.pause()})})}}},{key:"stopAnimation",value:function(){if(this.instance){var e=this.instance.getComponentByScriptId("animation");e&&e.stop()}}},{key:"onUnsupportedRepresentation",value:function(){this.emit("error",new Error("We're sorry, the preview didn't load. This file type may not be supported."))}},{key:"addHelpersToScene",value:function(){var e=this.getScene()?this.getScene().runtimeData:void 0;e&&(this.grid=new THREE.GridHelper(u.z,u.y,u.x,u.w),this.grid.material.transparent=!0,this.grid.material.blending=THREE.MultiplyBlending,e.add(this.grid),this.grid.visible=!0,this.axisDisplay=new THREE.AxisHelper(.5),e.add(this.axisDisplay),this.axisDisplay.visible=!1)}},{key:"cleanupHelpers",value:function(){var e=this.getScene()?this.getScene().runtimeData:void 0;e&&(this.grid&&(e.remove(this.grid),this.grid.material.dispose(),this.grid.geometry.dispose()),this.axisDisplay&&(e.remove(this.axisDisplay),this.axisDisplay.material.dispose(),this.axisDisplay.geometry.dispose()))}},{key:"toggleHelpers",value:function(e){var t=void 0!==e?e:!this.axisDisplay.visible;this.axisDisplay.visible=t,this.box3d.needsRender=!0}},{key:"cleanupScene",value:function(){this.cleanupHelpers(),this.resetSkeletons()}},{key:"resetSkeletons",value:function(){this.box3d&&Box3D.globalEvents.trigger(u.m)}},{key:"setRenderMode",value:function(e){this.box3d&&Box3D.globalEvents.trigger(u.r,this.renderModeValues[e])}},{key:"setCameraProjection",value:function(e){var t=this.getCamera();if(t){switch(e){case u.d:t.setProperty("cameraType","orthographic");break;case u.e:t.setProperty("cameraType","perspective")}this.resetView()}}},{key:"rotateOnAxis",value:function(e){this.instance&&this.box3d&&this.instance.trigger("rotate_on_axis",e,!0)}},{key:"setAxisRotation",value:function(e,t,n){this.instance&&this.instance.trigger("set_axes_orientation",e,t,n)}},{key:"setSkeletonsVisible",value:function(e){this.box3d&&Box3D.globalEvents.trigger(u.s,e)}},{key:"setWireframesVisible",value:function(e){this.box3d&&Box3D.globalEvents.trigger(u.t,e)}},{key:"setGridVisible",value:function(e){this.box3d&&(this.grid.visible=e)}},{key:"enableVr",value:function(){if(!this.vrEnabled){v(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"enableVr",this).call(this);var e=this.box3d.getVrDisplay();this.vrDeviceHasPosition=e?e.capabilities.hasPosition:void 0,this.vrDeviceHasPosition?this.grid.visible=!0:this.box3d.on("update",this.updateNonPositionalVrControls,this),this.disableAutoTransform()}}},{key:"onDisableVr",value:function(){this.vrDeviceHasPosition||this.box3d.off("update",this.updateNonPositionalVrControls,this),v(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"onDisableVr",this).call(this)}},{key:"disableAutoTransform",value:function(){if(this.instance){var e=this.instance.getComponentByScriptId("scale_to_size");if(e){var t=this.instance.getScale();e.disable(),this.instance.setScale(t.x,t.y,t.z)}var n=this.instance.getComponentByScriptId("align_to_position");if(n){var i=this.instance.getPosition();n.disable(),this.instance.setPosition(i.x,i.y,i.z)}}}},{key:"updateNonPositionalVrControls",value:function(){var e=this.getCamera(),t=e.getComponentByScriptId("orbit_camera");if(t){var n=e.runtimeData;n.position.set(0,0,t.getOrbitDistance()),n.position.applyQuaternion(n.quaternion),n.position.add(t.pivotPoint.position)}}},{key:"initVrGamepadControls",value:function(){this.vrControls=new l.a(this.vrGamepads,this.box3d)}}]),t}(s.a);t.a=y},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var r=function(){function e(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:[],i=e.shared_link&&e.shared_link.is_password_enabled;return(!Object(l.d)(e,c.T)||e.size>5242880||i)&&n.push("Office"),h(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"determineViewer",this).call(this,e,n)}}]),t}(a.a);t.a=new p},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(11),s=n(8),l=n(48),c=n(1),u=n(13),h=n(7),d=n(2),p=function(){function e(e,t){for(var n=0;n\n
\n
".trim(),this.printPopup.addContent(t,!0),this.printPopup.addContent(e,!0),this.printPopup.loadingIndicator=t,this.printPopup.printCheckmark=e}},{key:"setupPDFUrl",value:function(){var e=this.options.file,t=Object(u.f)(e,"pdf"),n=t.content.url_template;this.pdfUrl=this.createContentUrlWithAuthParams(n)}},{key:"setupIframe",value:function(){var e=this.options,t=e.appHost,n=e.apiHost,i=e.file,r=e.sharedLink,o=e.location.locale,a=this.createIframeElement();if(this.containerEl.appendChild(a),this.platformSetup){this.createFormElement(n,i.id,r,o).submit(),a.contentWindow.postMessage("Host_PostmessageReady",window.location.origin)}else a.src=this.setupRunmodeURL(t,i.id,r)}},{key:"setupRunmodeURL",value:function(e,t,n){var i="/integrations/officeonline/openExcelOnlinePreviewer",r=document.createElement("a");if(r.href=n,n){i=""+(r.protocol+"//"+r.hostname)+i;var o=n.split("/s/")[1];if(o)i=i+"?s="+o+"&fileId="+t;else{var a=r.hostname.split(".")[0];i=i+"?v="+r.href.split("/v/")[1]+"&vanity_subdomain="+a+"&fileId="+t}}else i=""+e+i+"?fileId="+t;return i}},{key:"setupWOPISrc",value:function(e,t,n){var i=e+"/wopi/files/";if(n){var r=n.split("/s/")[1];r&&(i=i+"s_"+r+"_f_")}return""+i+t}},{key:"createIframeElement",value:function(){var e=document.createElement("iframe");return e.setAttribute("width","100%"),e.setAttribute("height","100%"),e.setAttribute("frameborder",0),e.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms allow-popups"),this.platformSetup&&(e.setAttribute("allowfullscreen","true"),e.name="office-online-iframe",e.id="office-online-iframe"),e}},{key:"createFormElement",value:function(e,t,n,i){var r=this.setupWOPISrc(e,t,n),o={origin:window.location.origin},a=this.containerEl.appendChild(document.createElement("form"));a.setAttribute("action","https://excel.officeapps.live.com/x/_layouts/xlembed.aspx?ui="+i+"&rs="+i+"&WOPISrc="+r+"&sc="+JSON.stringify(o)),a.setAttribute("method","POST"),a.setAttribute("target","office-online-iframe");var s=document.createElement("input");s.setAttribute("name","access_token"),s.setAttribute("value",""+this.options.token),s.setAttribute("type","hidden");var l=document.createElement("input");return l.setAttribute("name","access_token_TTL"),l.setAttribute("value",0),l.setAttribute("type","hidden"),a.appendChild(s),a.appendChild(l),a}},{key:"fetchPrintBlob",value:function(e){var t=this;return Object(d.k)(e,"blob").then(function(e){t.printBlob=e})}},{key:"browserPrint",value:function(){if("function"==typeof window.navigator.msSaveOrOpenBlob){window.navigator.msSaveOrOpenBlob(this.printBlob,"print.pdf")?this.emit("printsuccess"):this.emit("printerror")}else{this.printURL||(this.printURL=URL.createObjectURL(this.printBlob));var e=window.open(this.printURL);if(e&&"function"==typeof e.print){var t=s.a.getName();"Chrome"===t?e.addEventListener("load",function(){e.print()}):"Safari"===t&&setTimeout(function(){e.print()},1e3)}!e||e.closed||void 0===e.closed?this.emit("printerror"):this.emit("printsuccess")}}}]),t}(a.a);t.a=v},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var r=function(){function e(e,t){for(var n=0;n0&&(n.addEventListener("click",this.leftHandler),n.classList.remove(c.A)),r=95)return void clearInterval(e.progressInterval);e.progress>=80?e.progress+=Math.random():e.progress+=5*Math.random(),e.updateProgress(e.progress)},150)}},{key:"finish",value:function(){this.hideProgress(),clearInterval(this.progressInterval),this.updateProgress(100)}},{key:"updateProgress",value:function(e){this.progressBarEl&&(this.progressBarEl.style.width=e+"%")}},{key:"showProgress",value:function(){this.progressBarEl&&this.progressBarEl.classList.add(r.G)}},{key:"hideProgress",value:function(){this.progressBarEl&&this.progressBarEl.classList.remove(r.G)}}]),e}();t.a=a},function(e,t){e.exports='\n
\n
\n \n \n \n \n
\n \n
\n
\n
\n \n \n \n \n \n
\n \n \n \n \n \n
\n'},function(e,t,n){"use strict";function i(e){return"file_"+e}function r(e,t){var n={};return e.forEach(function(e){var r=i(e);if(t&&"string"!=typeof t)if("object"===(void 0===t?"undefined":a(t))&&t[r])n[e]=t[r];else{if("object"!==(void 0===t?"undefined":a(t))||!t[e])throw s;n[e]=t[e]}else n[e]=t}),n}function o(e,t){if(!e)return Promise.reject(s);var n=void 0;return n=Array.isArray(e)?e:[e],t&&"string"!=typeof t?new Promise(function(e,o){var a=n.map(function(e){return i(e)});t(a).then(function(t){try{e(r(n,t))}catch(e){o(e)}})}):Promise.resolve(r(n,t))}t.a=o;var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=new Error("Bad Auth Token!")},function(e,t){}]);