/*
    *
    * Wijmo Library 5.20183.550
    * http://wijmo.com/
    *
    * Copyright(c) GrapeCity, Inc.  All rights reserved.
    *
    * Licensed under the GrapeCity Commercial License.
    * sales@wijmo.com
    * wijmo.com/products/wijmo-5/license/
    *
    */
"use strict";function isIOS(){return _isIOS}function _pointMove(e,t,r,i){var o,a=e?1:-1;return r instanceof wjcCore.Point?(o=r.x,i=r.y):(o=r,i=i||0),new wjcCore.Point(t.x+a*o,t.y+a*i)}function _createSvgBtn(e){var t=_toDOM(_svgStart+e+_svgEnd);wjcCore.addClass(t,"wj-svg-btn");var r=document.createElement("a");return r.appendChild(t),wjcCore.addClass(r,"wj-btn"),r.tabIndex=0,r}function _setLandscape(e,t){if(e.landscape!==t){e.landscape=t;var r=e.width;e.width=e.height,e.height=r;var i=e.leftMargin;t?(e.leftMargin=e.bottomMargin,e.bottomMargin=e.rightMargin,e.rightMargin=e.topMargin,e.topMargin=i):(e.leftMargin=e.topMargin,e.topMargin=e.rightMargin,e.rightMargin=e.bottomMargin,e.bottomMargin=i)}}function _clonePageSettings(e){if(!e)return null;var t={};return t.height=e.height?new _Unit(e.height):null,t.width=e.width?new _Unit(e.width):null,t.bottomMargin=e.bottomMargin?new _Unit(e.bottomMargin):null,t.leftMargin=e.leftMargin?new _Unit(e.leftMargin):null,t.rightMargin=e.rightMargin?new _Unit(e.rightMargin):null,t.topMargin=e.topMargin?new _Unit(e.topMargin):null,t.landscape=e.landscape,t.paperSize=e.paperSize,t}function _enumToArray(e){var t=[];for(var r in e)r&&r.length&&"_"!=r[0]&&!isNaN(parseInt(r))&&t.push({text:e[r],value:r});return t}function _removeChildren(e,t){if(e&&e.children)for(var r=e.children,i=r.length-1;i>-1;i--){var o=r[i];if(null==t||t(o)){var a=o.querySelector(".wj-control");a&&(a=wjcCore.Control.getControl(a))&&a.dispose(),e.removeChild(o)}}}function _toDOMs(e){var t,r=document.createElement("div"),i=document.createDocumentFragment();for(r.innerHTML=e;t=r.firstChild;)i.appendChild(t);return i}function _toDOM(e){return _toDOMs(e).firstChild}function _addEvent(e,t,r,i){for(var o,a=t.split(","),n=0;n<a.length;n++)o=a[n].trim(),e.addEventListener?e.addEventListener(o,r,i):e.attachEvent?e.attachEvent("on"+o,r):e["on"+o]=r}function _removeEvent(e,t,r){for(var i,o=t.split(","),a=0;a<o.length;a++)i=o[a].trim(),e.removeEventListener?e.removeEventListener(i,r):e.detachEvent?e.detachEvent("on"+i,r):e["on"+i]=null}function _checkImageButton(e,t){t?wjcCore.addClass(e,_checkedCss):wjcCore.removeClass(e,_checkedCss)}function _disableImageButton(e,t){t?wjcCore.addClass(e,_disabledCss):wjcCore.removeClass(e,_disabledCss)}function _showImageButton(e,t){t?wjcCore.removeClass(e,exports._hiddenCss):wjcCore.addClass(e,exports._hiddenCss)}function _isDisabledImageButton(e){return wjcCore.hasClass(e,_disabledCss)}function _isCheckedImageButton(e){return wjcCore.hasClass(e,_checkedCss)}function _addWjHandler(e,t,r,i){if(e){var o=t[wjEventsName];o||(o=t[wjEventsName]={});var a=o[e];a||(a=o[e]=[]),a.push(r)}t.addHandler(r,i)}function _removeAllWjHandlers(e,t){if(e){var r=t[wjEventsName];if(r){var i=r[e];i&&i.forEach(e=>t.removeHandler(e))}}}function _getErrorMessage(e){var t;return _ArReportService.IsError(e)?t=e.json.Error.Description:(t=e,e.Message&&(t=e.Message,e.ExceptionMessage&&(t+="<br/>"+e.ExceptionMessage))),t||wjcCore.culture.Viewer.errorOccured}function _checkSeparatorShown(e){for(var t,r,i,o,a=!0,n=0;n<e.children.length;n++)r=e.children[n],t=wjcCore.hasClass(r,"wj-separator"),i=wjcCore.hasClass(r,exports._hiddenCss),t||i?t&&(a?i||wjcCore.addClass(r,exports._hiddenCss):(i&&wjcCore.removeClass(r,exports._hiddenCss),o=r),a=!0):a=!1;a&&o&&wjcCore.addClass(o,"hidden")}function _twipToPixel(e){return _Unit.convertValue(e,_UnitType.Twip,_UnitType.Dip)}function _pixelToTwip(e){return _Unit.convertValue(e,_UnitType.Dip,_UnitType.Twip)}function _hasScrollbar(e,t){return t?e.scrollWidth>e.clientWidth:e.scrollHeight>e.clientHeight}function _transformSvg(e,t,r,i,o){i=null==i?1:i;var a=e.querySelector("g");if(a){var n="scale("+i+")";if(null!=o)switch(o){case _RotateAngle.Rotation90:n+=" rotate(90)",n+=" translate(0 "+-r+")";break;case _RotateAngle.Rotation180:n+=" rotate(180)",n+=" translate("+-t+" "+-r+")";break;case _RotateAngle.Rotation270:n+=" rotate(270)",n+=" translate("+-t+" 0)"}a.setAttribute("transform",n),wjcCore.isIE&&((e=a.parentNode).removeChild(a),e.appendChild(a))}return e}function _getTransformedPosition(e,t,r,i){var o,a,n={x:_twipToPixel(e.x),y:_twipToPixel(e.y),width:_twipToPixel(e.width),height:_twipToPixel(e.height)};switch(r){case _RotateAngle.NoRotate:o=n.y,a=n.x;break;case _RotateAngle.Rotation90:o=n.x,a=t.height.valueInPixel-n.y-n.height;break;case _RotateAngle.Rotation180:o=t.height.valueInPixel-n.y-n.height,a=t.width.valueInPixel-n.x-n.width;break;case _RotateAngle.Rotation270:o=t.width.valueInPixel-n.x-n.width,a=n.y}return new wjcCore.Point(a*i,o*i)}function _getRotatedSize(e,t){return t===_RotateAngle.NoRotate||t===_RotateAngle.Rotation180?e:{width:e.height,height:e.width}}function _getPositionByHitTestInfo(e){return e?{pageIndex:e.pageIndex,pageBounds:{x:e.x,y:e.y,width:0,height:0}}:{pageIndex:0,pageBounds:{x:0,y:0,width:0,height:0}}}function _strEndsWith(e,t,r=!1){return r?e.slice(-t.length).toLowerCase()===t.toLowerCase():e.slice(-t.length)===t}function _isEqual(e,t){return e&&t&&wjcCore.isFunction(e.valueOf)&&wjcCore.isFunction(t.valueOf)?e.valueOf()===t.valueOf():e===t}function _statusJsonReviver(e,t){if(wjcCore.isString(t)){if(_strEndsWith(e,"DateTime"))return new Date(t);if("width"===e||"height"===e||_strEndsWith(e,"Margin"))return new _Unit(t)}return t}function _pageSettingsJsonReviver(e,t){return wjcCore.isString(t)&&("width"===e||"height"===e||_strEndsWith(e,"Margin"))?new _Unit(t):t}function _appendQueryString(e,t){t=t||{};var r=[];for(var i in t)r.push(i+"="+t[i]);return r.length&&(e+=(e.indexOf("?")<0?"?":"&")+r.join("&")),e}function _joinUrl(...e){for(var t=[],r=0,i=e.length;r<i;r++){var o=e[r];o&&("string"!=typeof o?t=t.concat(_joinStringUrl(o)):t.push(_prepareStringUrl(o).join("/")))}return t.join("/")}function _joinStringUrl(e){if(null==e)return null;for(var t=[],r=0,i=e.length;r<i;r++)t=t.concat(_prepareStringUrl(e[r]));return t}function _prepareStringUrl(e){var t=e.split("/");return t.length>0&&!t[t.length-1].length&&t.splice(t.length-1),t}function _httpRequest(e,t,r){if(r&&r.cache||(e=_disableCache(e)),r&&"GET"!==(r.method||"GET").toUpperCase()){if(r.data&&!1!==r.urlEncode){var i=_objToParams(r.data);null!=i&&(r.data=i)}!1!==r.urlEncode&&(r.requestHeaders?r.requestHeaders["Content-Type"]||(r.requestHeaders["Content-Type"]="application/x-www-form-urlencoded"):r.requestHeaders={"Content-Type":"application/x-www-form-urlencoded"})}t&&t.requestHeaders&&((r=r||{}).requestHeaders=r.requestHeaders||{},Object.keys(t.requestHeaders).forEach(e=>{r.requestHeaders[e]=t.requestHeaders[e]}));var o=new RequestEventArgs(e,r);return t&&t.beforeSend&&t.beforeSend(o),wjcCore.httpRequest(o.url,o.settings)}function _saveBlob(e,t){if(e&&e instanceof Blob&&t)if(navigator.msSaveBlob)navigator.msSaveBlob(e,t);else{var r=document.createElement("a"),i=function(e){var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),e.dispatchEvent(t)};if("download"in r){var o=window.URL||window.webkitURL||window,a=o.createObjectURL(e);r.href=a,r.target="_blank",r.download=t,i(r),r=null,window.setTimeout(()=>{o.revokeObjectURL(a)},3e4)}else{var n=new FileReader;n.onloadend=(e=>{r.download=t,r.href=n.result,i(r),r=null}),n.readAsDataURL(e)}}}function _objToParams(e){var t=[];e=e||{};for(var r in e)if(null!==e[r]&&void 0!==e[r])if(wjcCore.isArray(e[r]))if(e[r].length>0)for(var i=0;i<e[r].length;i++)t.push(r+"="+encodeURIComponent(e[r][i]));else t.push(r+"=");else t.push(r+"="+encodeURIComponent(e[r]));return t.join("&")}function _disableCache(e){return e+(-1==e.indexOf("?")?"?":"&")+"_="+(new Date).getTime()}function _parseReportExecutionInfo(e){return JSON.parse(e,_statusJsonReviver)}function _parseExecutionInfo(e){return JSON.parse(e,_statusJsonReviver)}function _getTouchEventMap(){return"ontouchstart"in window?_touchEventsMap:_pointerEventsMap}Object.defineProperty(exports,"__esModule",{value:!0});const wjcCore=require("wijmo/wijmo"),wjcInput=require("wijmo/wijmo.input"),wjcGrid=require("wijmo/wijmo.grid");var __glob="undefined"!=typeof window?window:self;const wjcSelfRef=require("wijmo/wijmo.viewer");var wjcSelf=wjcSelfRef||exports;__glob.wijmo=__glob.wijmo||{},__glob.wijmo.viewer=wjcSelf;const _isIOS=null!=navigator.userAgent.match(/iPhone|iPad|iPod/i);exports.isIOS=isIOS;var _svgStart='<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 24 24" xml:space="preserve">',_svgEnd="</svg>";exports.icons={paginated:'<rect x="16" y= "1" width="1" height="1" /><rect x="17" y= "2" width="1" height="1" /><rect x="18" y= "3" width="1" height="1" /><path d= "M20,5V4h-1v1h-0.6H18h-3V2V1.3V1h1V0h-1h0H5H4H3v24h2v0h13h1.1H20L20,5L20,5z M5,22.1V2h8v5h1h1h3v15.1H5z" /><rect x="6" y= "8" width="10" height="1" /><rect x="6" y= "5" width="5" height="1" /><rect x="6" y= "11" width="10" height="1" /><rect x="6" y= "14" width="10" height="1" /><rect x="6" y= "17" width="10" height="1" /><rect x="6" y= "20" width="10" height="1" />',print:'<rect x="5" y= "1" width="14" height="4" /><polygon points= "22,8 22,7 19,7 19,6 5,6 5,7 2,7 2,8 1,8 1,11 1,20 2,20 2,21 5,21 5,11 19,11 19,21 22,21 22,20 23,20 23, 11 23, 8 "/><path d="M6,12v11h12V12H6z M16,21H8v-1h8V21z M16,18H8v-1h8V18z M16,15H8v-1h8V15z" />',exports:'<path d="M19.6,23"/><polyline points="5,19 5,2 13,2 13,7 14.3,7 15,7 18,7 18,9 20,9 20,7 20,6.4 20,5 20,4 19,4 19,5 15,5 15,2 15,1 16,1 16,0 15,0 5,0 3,0 3,2 3,19 3,21 5,21 "/><rect x="18" y="3" width="1" height="1"/><rect x="17" y="2" width="1" height="1"/><rect x="16" y="1" width="1" height="1"/><polygon points="17,16.6 20,14.1 17,11.6 17,13.6 13,13.6 13,14.6 17,14.6 "/><rect x="3" y="20.9" width="2" height="3.1"/><rect x="4.5" y="22" width="15.6" height="2"/><rect x="18" y="8.4" width="2" height="1.6"/><rect x="18" y="18" width="2.1" height="6"/>',portrait:'<path d="M19,0L19,0L5,0v0H3v24h0.1H5h14h1.7H21V0H19z M12.5,23h-1v-1h1V23z M19,21H5V2h14V21z"/>',landscape:'<path d="M24,19L24,19l0-14h0V3H0v0.1V5v14v1.7V21h24V19z M1,12.5v-1h1v1H1z M3,19V5h19v14H3z"/>',pageSetup:'<rect x="18" y="1" width="1" height="1"/><rect x="19" y="2" width="1" height="1"/><rect x="20" y="3" width="1" height="1"/><polygon points="22,5 22,4 21,4 21,5 20.4,5 20,5 17,5 17,2 17,1.3 17,1 18,1 18,0 17,0 17,0 7,0 6,0 5,0 5,5 7,5 7,2 15,2 15,7 16,7 17,7 20,7 20,22.1 7,22.1 7,19 5,19 5,24 5.9,24 7,24 20,24 21.1,24 22,24 22,5 "/><rect x="5" y="7" width="2" height="2"/><rect x="5" y="11" width="2" height="2"/><rect x="5" y="15" width="2" height="2"/><rect x="9" y="11" width="2" height="2"/><rect x="1" y="11" width="2" height="2"/><polygon points="9,8 9,8 8,8 8,9 9,9 9,10 10,10 10,8 "/><polygon points="2,9 2,9 2,10 3,10 3,9 4,9 4,8 2,8 "/><polygon points="3,16 3,16 4,16 4,15 3,15 3,14 2,14 2,16 "/><polygon points="10,15 10,15 10,14 9,14 9,15 8,15 8,16 10,16 "/>',previousPage:'<circle opacity=".25" cx="12" cy="12" r="12"/><polygon points="5.6,10.7 12,4.4 18.4,10.7 18.4,15 13.5,10.1 13.5,19.6 10.4,19.6 10.4,10.1 5.6,15 " />',nextPage:'<circle opacity=".25" cx="12" cy="12" r="12"/><polygon points="18.4,13.3 12,19.6 5.6,13.3 5.6,9 10.5,13.9 10.5,4.4 13.6,4.4 13.6,13.9 18.4,9 " />',firstPage:'<circle opacity=".25" cx="12" cy="12" r="12"/><polygon points="6.5,13.1 12,7.8 17.5,13.1 17.5,17.5 13.5,13.5 13.5,19.6 10.4,19.6 10.4,13.5 6.5,17.5 " /><rect x="6.5" y= "4.4" width="10.9" height="2.2" />',lastPage:'<circle opacity=".25" cx="12" cy="12" r="12"/><polygon points="17.5,10.9 12,16.2 6.5,10.9 6.5,6.5 10.5,10.5 10.5,4.4 13.6,4.4 13.6,10.5 17.5,6.5 " /><rect x="6.5" y= "17.5" transform="matrix(-1 -8.987357e-011 8.987357e-011 -1 24 37.0909)" width="10.9" height="2.2" />',backwardHistory:'<circle opacity=".25" cx="12" cy="12" r="12"/><polygon points="10.7,18.4 4.4,12 10.7,5.6 15,5.6 10.1,10.5 19.6,10.5 19.6,13.6 10.1,13.6 15,18.4 " />',forwardHistory:'<circle opacity=".25" cx="12" cy="12" r="12"/><polygon points="13.3,5.6 19.6,12 13.3,18.4 9,18.4 13.9,13.5 4.4,13.5 4.4,10.4 13.9,10.4 9,5.6 " />',selectTool:'<polygon points="19.9,13.4 5.6,1.1 5.3,19.9 10.5,14.7 14.3,23.3 16.4,22.4 12.6,13.8 "/>',moveTool:'<polygon points="12.5,3 14.5,3 12,0 9.5,3 11.5,3 11.5,21 11.5,21 9.6,21 12,24 14.5,21 12.5,21 "/><polygon points="21,12.5 21,14.5 24,12 21,9.5 21,11.5 3,11.5 3,11.5 3,9.6 0,12 3,14.5 3,12.5 "/>',continuousView:'<polygon points="22,0 22,5 9,5 9,0 7,0 7,5 7,7 7,7 24,7 24,7 24,5 24,0 "/><polygon points="23,15 19,15 19,11 20,11 20,10 19,10 18,10 17,10 9,10 7.4,10 7,10 7,24 9,24 9,12 17,12 17,15 17,16.6 17,17 22,17 22,24 24,24 24,17 24,15.1 24,15 24,15 24,14 23,14 "/><rect x="22" y="13" width="1" height="1"/><polygon points="20.9,12 20.9,13 22,13 22,12 21,12 21,11 20,11 20,12 "/><polygon points="4.9,5.2 2.5,2.2 0,5.2 2,5.2 2,9.2 3,9.2 3,5.2 "/><polygon points="2.9,19.2 2.9,15.2 1.9,15.2 1.9,19.2 0,19.2 2.5,22.1 4.9,19.2 "/>',singleView:'<rect x="16" y="1" width="1" height="1"/><rect x="17" y="2" width="1" height="1"/><rect x="18" y="3" width="1" height="1"/><path d="M20,5V4h-1v1h-0.6H18h-3V2V1.3V1h1V0h-1h0H5H4H3v24h2v0h13h1.1H20L20,5L20,5z M5,22.1V2h8v5h1h1h3v15.1H5z"/>',fitWholePage:'<rect x="16" y="1" width="1" height="1"/><rect x="17" y="2" width="1" height="1"/><rect x="18" y="3" width="1" height="1"/><path d="M20,5V4h-1v1h-0.6H18h-3V2V1.3V1h1V0h-1h0H5H4H3v24h2v0h13h1.1H20L20,5L20,5z M18,22.1H5V2h8v5h1h1h3V22.1z"/><polygon points="17,13.5 15,11 15,13 13,13 13,14 15,14 15,16 "/><polygon points="6,13.5 8,16 8,14 10,14 10,13 8,13 8,11 "/><polygon points="11.5,7 9,9 11,9 11,11 12,11 12,9 14,9 "/><polygon points="11.5,20 14,18 12,18 12,16 11,16 11,18 9,18 "/>',fitPageWidth:'<rect x="16" y="1" width="1" height="1"/><rect x="17" y="2" width="1" height="1"/><rect x="18" y="3" width="1" height="1"/><path d="M20,5V4h-1v1h-0.6H18h-3V2V1.3V1h1V0h-1h0H5H4H3v24h2v0h13h1.1H20L20,5L20,5z M5,22.1V2h8v5h1h1h3v15.1H5z"/><polygon points="14,15.5 17,13 14,10.6 14,12.6 13,12.6 13,13.6 14,13.6 "/><polyline points="6,13.1 9,15.6 9,13.6 10,13.6 10,12.6 9,12.6 9,10.6 6,13.1 "/>',zoomOut:'<circle opacity=".25" cx="12" cy="12" r="12"/><rect opacity=".75" x="5" y="10" width="14" height="3"/>',zoomIn:'<circle opacity=".25" cx="12" cy="12" r="12"/><polygon opacity=".75" points="19,10 13.5,10 13.5,4.5 10.5,4.5 10.5,10 5,10 5,13 10.5,13 10.5,18.5 13.5,18.5 13.5,13 19,13 " />',fullScreen:'<path d="M22,0H0v2.8V4v20h1.5H2h20h0.7H24V4V0H22z M7,1h1v1H7V1z M5,1h1v1H5V1z M3,1h1v1H3V1z M22,22H2L2,4h20L22,22z" /><polygon points="19.6,9.9 20,6 16.1,6.4 17.6,7.8 14.7,10.6 15.4,11.3 18.3,8.5"/><polygon points="4.4,16.2 4,20 7.9,19.7 6.5,18.3 9.3,15.5 8.6,14.8 5.8,17.6"/>',exitFullScreen:'<path d="M22,0H0v2.8V4v20h1.5H2h20h0.7H24V4V0H22z M7,1h1v1H7V1z M5,1h1v1H5V1z M3,1h1v1H3V1z M22,22H2L2,4h20L22,22z" /><polygon points="9.2,18.6 9.6,14.7 5.7,15.1 7.2,16.5 4.3,19.3 5,20 7.9,17.2"/><polygon points="14.8,7.5 14.4,11.3 18.3,11 16.9,9.6 19.7,6.8 19,6.1 16.2,8.9"/>',thumbnails:'<path d="M20,2h-5h-2v2v5v2v0h2v0h5v0h2v0V9V4V2H20z M20,9h-5V4h5V9z"/><path d="M20,13h-5h-2v2v5v2v0h2v0h5v0h2v0v-2v-5v-2H20z M20,20h-5v-5h5V20z"/><path d="M9,13H4H2v2v5v2v0h2v0h5v0h2v0v-2v-5v-2H9z M9,20H4v-5h5V20z"/><rect x="2" y="2" width="9" height="9"/>',outlines:'<path d="M22,0H2H0v2v20v2h2h20h2v-2V2V0H22z M2,2h12v20H2V2z M22,22h-6V2h6V22z"/><rect x="17.5" y="5" width="3" height="1" /><rect x="17.5" y="8" width="3" height="1"/><rect x="17.5" y="11" width="3" height="1"/>',search:'<circle stroke-width="2" fill="none" cx="9.5" cy="9.5" r="8.5"/><rect x="16.9" y="13.7" transform="matrix(-0.7193 0.6947 -0.6947 -0.7193 44.3315 18.4942)" width="3" height="9"/>',searchNext:'<polygon points="12,12.6 4,4.5 4,11.4 12,19.5 20,11.4 20,4.5 "/>',searchPrevious:'<polygon points="12,11.4 20,19.5 20,12.6 12,4.5 4,12.6 4,19.5 "/>',hamburgerMenu:'<rect x="2" y="4.875" width="20" height="1.5"/><rect x="2" y="11.25" width="20" height="1.5"/><rect x="2" y="17.625" width="20" height="1.5"/>',viewMenu:'<path transform="scale(1.5)" d="M8,2.9c-4.4,0-8,2.2-8,5s3.6,5,8,5s8-2.2,8-5S12.4,2.9,8,2.9z M8,11.8c-2.2,0-4-1.8-4-4c0-2.2,1.8-4,4-4s4, 1.8,4,4C12, 10,10.2,11.8,8,11.8z"/><circle class="st0" cx="12" cy="11.85" r="3.45"/>',searchOptions:'<polygon points="12,12.6 4,4.5 4,11.4 12,19.5 20,11.4 20,4.5 "/>',searchLeft:'<polygon points="11.4,12 19.5,20 12.6,20 4.5,12 12.6,4 19.5,4 "/>',searchRight:'<polygon points="12.6,12 4.5,4 11.4,4 19.5,12 11.4,20 4.5,20 "/>',showZoomBar:'<path d="M22.8,20.7l-4.4-4.4c1.1-1.6,1.8-3.5,1.8-5.6c0-5.2-4.3-9.5-9.5-9.5s-9.5,4.3-9.5,9.5s4.3,9.5,9.5,9.5 c2.1,0,4-0.7,5.6-1.8l4.4,4.4L22.8,20.7z M4.2,10.7c0-3.6,2.9-6.5,6.5-6.5s6.5,2.9,6.5,6.5s-2.9,6.5-6.5,6.5S4.2,14.3,4.2,10.7z"/><polygon points="7.2,9.2 7.2,7.2 9.2,7.2 9.2,6.2 6.2,6.2 6.2,9.2 "/><polygon points="12.2,7.2 14.2,7.2 14.2,9.2 15.2,9.2 15.2,6.2 12.2,6.2 "/><polygon points="9.2,14.2 7.2,14.2 7.2,12.2 6.2,12.2 6.2,15.2 9.2,15.2 "/><polygon points="14.2,12.2 14.2,14.2 12.2,14.2 12.2,15.2 15.2,15.2 15.2,12.2 "/>',rubberbandTool:`\n        <g>\n\t        <polygon points="11.5,2 4,2 2,2 2,4 2,11.5 4,11.5 4,4 11.5,4 \t"/>\n\t        <path d="M16,10V8h-2h-4H8v2v4v2h2h4h2v-2V10z M14,14h-4v-4h4V14z"/>\n\t        <polygon points="20,12 20,19 19,19 19,20 12,20 12,22 20,22 22,22 22,20 22,12 \t"/>\n\t        <rect x="16" y="16" class="st0" width="1" height="1"/>\n\t        <rect x="17" y="17" class="st0" width="1" height="1"/>\n\t        <rect x="18" y="18" class="st0" width="1" height="1"/>\n        </g>`,magnifierTool:`\n        <circle fill="none" stroke-width="2" stroke-miterlimit="10" cx="9.5" cy="9.5" r="7.5"/>\n        <rect x="17" y="13.7" transform="matrix(0.7193 -0.6947 0.6947 0.7193 -7.4537 17.9238)" class="st1" width="3" height="9"/>\n        <polygon points="14,8.5 10.5,8.5 10.5,5 8.5,5 8.5,8.5 5,8.5 5,10.5 8.5,10.5 8.5,14 10.5,14 10.5,10.5 14,10.5 "/>\n        `,rotateDocument:`\n        <g>\n\t        <path d="M18,0H5H3v4v18v2h2h13h2v-2V4V0H18z M18,22H5V4h13V22z"/>\n\t        <polygon points="9,12 13,12 13,14 15,11.5 13,9 13,11 9,11 8,11 8,12 8,17 9,17 \t"/>\n        </g>`,rotatePage:`\n        <g>\n\t        <rect x="16" y="1" width="1" height="1"/>\n\t        <rect x="17" y="2" width="1" height="1"/>\n\t        <rect x="18" y="3" width="1" height="1"/>\n\t        <path class="st0" d="M19,4v1h-0.6H18h-3V2V1.3V1h1V0h-1H5H4H3v24h2h13h1.1H20V5V4H19z M18,22.1H5V2h8v5h1h1h3V22.1z"/>\n\t        <polygon points="13,11 9,11 8,11 8,12 8,17 9,17 9,12 13,12 13,14 15,11.5 13,9 \t"/>\n        </g>`},exports._hiddenCss="hidden",exports._commandTagAttr="command-tag",exports._pointMove=_pointMove;class _ActionQueue{constructor(){this._actions=[],this._isStarted=!1}_any(){return this._actions.length>0}queue(e){var t=this._any();this._actions.push(()=>{e(),this._continue()}),this.isStarted&&!t&&this._continue()}_continue(){var e=this._actions.shift();e&&e()}start(){this._isStarted||(this._isStarted=!0,this._continue())}get isStarted(){return this._isStarted}}exports._ActionQueue=_ActionQueue,exports._createSvgBtn=_createSvgBtn,exports._setLandscape=_setLandscape,exports._clonePageSettings=_clonePageSettings,exports._enumToArray=_enumToArray,exports._removeChildren=_removeChildren,exports._toDOMs=_toDOMs,exports._toDOM=_toDOM,exports._addEvent=_addEvent,exports._removeEvent=_removeEvent;var _checkedCss="wj-state-active",_disabledCss="wj-state-disabled";exports._checkImageButton=_checkImageButton,exports._disableImageButton=_disableImageButton,exports._showImageButton=_showImageButton,exports._isDisabledImageButton=_isDisabledImageButton,exports._isCheckedImageButton=_isCheckedImageButton;var wjEventsName="__wjEvents";exports._addWjHandler=_addWjHandler,exports._removeAllWjHandlers=_removeAllWjHandlers,exports._getErrorMessage=_getErrorMessage,exports._checkSeparatorShown=_checkSeparatorShown,exports._twipToPixel=_twipToPixel,exports._pixelToTwip=_pixelToTwip,exports._hasScrollbar=_hasScrollbar,exports._transformSvg=_transformSvg,exports._getTransformedPosition=_getTransformedPosition,exports._getRotatedSize=_getRotatedSize,exports._getPositionByHitTestInfo=_getPositionByHitTestInfo,exports._strEndsWith=_strEndsWith,exports._isEqual=_isEqual;class _DocumentSource{constructor(e,t){this._hasOutlines=!1,this._pageCount=0,this._supportedExportDescriptions=[],this._isLoadCompleted=!1,this._isInstanceCreated=!1,this._isDisposed=!1,this._errors=[],this.pageCountChanged=new wjcCore.Event,this.disposed=new wjcCore.Event,this.pageSettingsChanged=new wjcCore.Event,this.loading=new wjcCore.Event,this.loadCompleted=new wjcCore.Event,this.queryLoadingData=new wjcCore.Event,this._httpHandler=t,this._service=this._createDocumentService(e),this._paginated=e.paginated}onQueryLoadingData(e){this.queryLoadingData.raise(this,e)}_updateIsLoadCompleted(e){this._isLoadCompleted!==e&&(this._isLoadCompleted=e,e&&this.onLoadCompleted())}_updateIsDisposed(e){this._isDisposed!==e&&(this._isDisposed=e,this.onDisposed())}_getIsDisposed(){return this._isDisposed}_checkHasOutlines(e){return e.hasOutlines}_checkIsLoadCompleted(e){return e.status===_ExecutionStatus.completed||e.status===_ExecutionStatus.stopped||e.status===_ExecutionStatus.loaded}get encodeRequestParams(){return!0}get executionDateTime(){return this._executionDateTime}get expiredDateTime(){return this._expiredDateTime}get errors(){return this._errors}get isLoadCompleted(){return this._isLoadCompleted}get isInstanceCreated(){return this._isInstanceCreated}get isDisposed(){return this._getIsDisposed()}get features(){return this._features}get pageSettings(){return this._pageSettings}onPageSettingsChanged(e){this.pageSettingsChanged.raise(this,e||new wjcCore.EventArgs)}onLoadCompleted(e){this.loadCompleted.raise(this,e||new wjcCore.EventArgs)}onLoading(e){this.loading.raise(this,e||new wjcCore.EventArgs)}onDisposed(e){this.disposed.raise(this,e||new wjcCore.EventArgs)}setPageSettings(e){return this._innerService.setPageSettings(e).then(e=>this._updatePageSettings(e))}_updatePageSettings(e){this._pageSettings=e,this.onPageSettingsChanged()}get _innerService(){return this._service}get paginated(){return this.pageSettings?this.pageSettings.paginated:this._paginated}get hasThumbnails(){return!0}get hasOutlines(){return this._hasOutlines}get pageCount(){return this._pageCount}get initialPosition(){return this._initialPosition}set initialPosition(e){this._initialPosition=e}get service(){return this._service}getSupportedExportDescriptions(){return this._innerService.getSupportedExportDescriptions()}getBookmark(e){return this._innerService.getBookmark(e)}executeCustomAction(e){return this._innerService.executeCustomAction(e)}getOutlines(){return this._innerService.getOutlines()}getFeatures(){return this._innerService.getFeatures().then(e=>{this._features=e})}dispose(){return this._innerService.dispose().then(()=>this._updateIsDisposed(!0))}load(){this.onLoading();var e={};null!=this._paginated&&(e["pageSettings.paginated"]=this.paginated);var t=new QueryLoadingDataEventArgs(e);return this.onQueryLoadingData(t),this._innerService.load(t.data).then(e=>{this._updateExecutionInfo(e)})}_updateExecutionInfo(e){null!=e&&(this._executionDateTime=this._getExecutionDateTime(e),this._expiredDateTime=this._getExpiredDateTime(e),this._updatePageSettings(e.pageSettings),this._features=e.features,this._isInstanceCreated=null!=e.status&&e.status.status!==_ExecutionStatus.notFound&&e.status.status!==_ExecutionStatus.cleared,this._updateDocumentStatus(e.status))}_updateDocumentStatus(e){e&&(this._errors=e.errorList,this._initialPosition=e.initialPosition,this._updatePageCount(this._getPageCount(e)),this._expiredDateTime=this._getExpiredDateTime(e),this._hasOutlines=this._checkHasOutlines(e),this._updateIsLoadCompleted(this._checkIsLoadCompleted(e)))}_getExecutionDateTime(e){return e.loadedDateTime}_getExpiredDateTime(e){return e.expiredDateTime}_getPageCount(e){return e.pageCount}_updatePageCount(e){this._pageCount!==e&&(this._pageCount=e,this.onPageCountChanged())}getStatus(){return this._innerService.getStatus().then(e=>{this._updateDocumentStatus(e)})}_createDocumentService(e){throw _DocumentSource._abstractMethodException}onPageCountChanged(e){this.pageCountChanged.raise(this,e||new wjcCore.EventArgs)}export(e){this.getExportedUrl(e).then(t=>{this._innerService.downloadBlob(t).then(t=>{let r=e.format;r.match("emf|bmp|gif|jpeg|jpg|png|tif|tiff")&&"application/zip"===t.type&&(r="zip"),"zip"===r&&"application/x-emf"===t.type&&(r="emf"),_saveBlob(t,`${this._innerService.getFileName()}.${r}`)})})}print(e){if(wjcCore.isMobile())this.export({format:"pdf"});else{var t=new wjcCore.PrintDocument({title:"Document"});this.renderToFilter({format:"html"}).then(r=>{t.append(r.responseText),t._getDocument().close(),window.setTimeout(()=>{this._removeScript(t),this._rotate(t,e),t.print()},100)})}}get httpHandler(){return this._httpHandler}_removeScript(e){for(var t=e._getDocument().querySelectorAll("script"),r=0;r<t.length;r++){var i=t.item(r);i.parentElement.removeChild(i)}}_rotate(e,t){if(t&&t.length)for(var r=e._getDocument().querySelectorAll("svg"),i=0;i<r.length;i++){var o=t[i];if(o){for(var a=r[i],n=document.createElementNS("http://www.w3.org/2000/svg","g");a.hasChildNodes();)n.appendChild(a.firstChild);a.appendChild(n);var s={width:new _Unit(a.width.baseVal.value),height:new _Unit(a.height.baseVal.value)},h=_getRotatedSize(s,o),l=a.parentNode;l.style.width=h.width.valueInPixel+"px",l.style.height=h.height.valueInPixel+"px",a.setAttribute("width",h.width.valueInPixel.toString()+"px"),a.setAttribute("height",h.height.valueInPixel.toString()+"px"),_transformSvg(r[i],s.width.valueInPixel,s.height.valueInPixel,1,o)}}}renderToFilter(e){return this._innerService.renderToFilter(e)}getRenderToFilterUrl(e){return this._innerService.getRenderToFilterUrl(e)}getExportedUrl(e,t=!1){var r=new _Promise;return this._innerService.getExportedUrl(e).then(e=>{var i=new RequestEventArgs(e,null);t&&this.httpHandler.beforeSend(i),r.resolve(i.url)}),r}search(e){return this._innerService.search(e)}}_DocumentSource._abstractMethodException="It is an abstract method, please implement it.",exports._DocumentSource=_DocumentSource,exports._statusJsonReviver=_statusJsonReviver;class _DocumentService{constructor(e,t){this._url="",this._url=e.serviceUrl||"",this._documentPath=e.filePath,this._httpHandler=t}get serviceUrl(){return this._url}get filePath(){return this._documentPath}getStatus(){throw _DocumentSource._abstractMethodException}setPageSettings(e){throw _DocumentSource._abstractMethodException}getBookmark(e){throw _DocumentSource._abstractMethodException}executeCustomAction(e){throw _DocumentSource._abstractMethodException}load(e){throw _DocumentSource._abstractMethodException}dispose(){throw _DocumentSource._abstractMethodException}getOutlines(){throw _DocumentSource._abstractMethodException}renderToFilter(e){throw _DocumentSource._abstractMethodException}search(e){throw _DocumentSource._abstractMethodException}getRenderToFilterUrl(e){throw _DocumentSource._abstractMethodException}getExportedUrl(e){throw _DocumentSource._abstractMethodException}getSupportedExportDescriptions(){throw _DocumentSource._abstractMethodException}getFeatures(){throw _DocumentSource._abstractMethodException}getPingTimeout(){return 100}getFileName(){var e=/([^\\/]+)$/.exec(this.filePath)[1];return e.lastIndexOf(".")>=0?e.substr(0,e.lastIndexOf(".")):e}downloadDataUrl(e){var t=new _Promise;return this.downloadBlob(e).then(e=>{var r=new FileReader;r.onloadend=(e=>{t.resolve(r.result)}),r.readAsDataURL(e)}),t}downloadBlob(e){var t=new _Promise;return this.httpRequest(e,{beforeSend:e=>{e.responseType="blob"}}).then(e=>{t.resolve(e.response)}),t}httpRequest(e,t){t=t||{};var r=new _Promise,i=t.error,o=t.success;return t.error=(e=>{wjcCore.isFunction(i)&&i.call(this,e),r.reject(e)}),t.success=(e=>{wjcCore.isFunction(o)&&o.call(this,e),r.resolve(e)}),_httpRequest(e,this._httpHandler,t),r}}exports._DocumentService=_DocumentService,exports._pageSettingsJsonReviver=_pageSettingsJsonReviver,exports._appendQueryString=_appendQueryString,exports._joinUrl=_joinUrl,exports._joinStringUrl=_joinStringUrl,exports._prepareStringUrl=_prepareStringUrl,exports._httpRequest=_httpRequest,exports._saveBlob=_saveBlob,exports._objToParams=_objToParams;class RequestEventArgs extends wjcCore.EventArgs{constructor(e,t){super(),this._url=e,this._settings=t}get url(){return this._url}set url(e){this._url=e}get settings(){return this._settings}set settings(e){this._settings=e}}exports.RequestEventArgs=RequestEventArgs,exports._disableCache=_disableCache;var _UnitType;!function(e){e[e.Document=0]="Document",e[e.Inch=1]="Inch",e[e.Mm=2]="Mm",e[e.Pica=3]="Pica",e[e.Point=4]="Point",e[e.Twip=5]="Twip",e[e.InHs=6]="InHs",e[e.Display=7]="Display",e[e.Cm=8]="Cm",e[e.Dip=9]="Dip"}(_UnitType=exports._UnitType||(exports._UnitType={}));class _Unit{constructor(e,t=_UnitType.Dip){if(_Unit._initUnitTypeDic(),wjcCore.isObject(e)){var r=e;e=r.value,t=r.units}else if(wjcCore.isString(e)){var i=parseFloat(e);isNaN(i)||(t=_Unit._unitTypeDic[e.substr(i.toString().length)],e=i)}this._value=e,this._units=t,this._valueInPixel=_Unit.convertValue(e,t,_UnitType.Dip)}static _initUnitTypeDic(){if(!_Unit._unitTypeDic){_Unit._unitTypeDic={};for(var e in _Unit._unitTypes)_Unit._unitTypeDic[_Unit._unitTypeDic[e]=_Unit._unitTypes[e]]=e}}get value(){return this._value}get units(){return this._units}get valueInPixel(){return this._valueInPixel}toString(){return _Unit.toString(this)}static toString(e){return null==e.value?"":e.value+_Unit._unitTypeDic[e.units]}static convertValue(e,t,r){if(t===r)return e;var i;switch(t){case _UnitType.Document:i=e/_Unit._DocumentUnitsPerInch;break;case _UnitType.Inch:i=e;break;case _UnitType.Mm:i=e/_Unit._MmPerInch;break;case _UnitType.Pica:i=e/_Unit._PicaPerInch;break;case _UnitType.Point:i=e/_Unit._PointsPerInch;break;case _UnitType.Twip:i=e/_Unit._TwipsPerInch;break;case _UnitType.InHs:i=e/100;break;case _UnitType.Display:i=e/_Unit._DisplayPerInch;break;case _UnitType.Cm:i=e/_Unit._CmPerInch;break;case _UnitType.Dip:i=e/_Unit._DipPerInch;break;default:throw"Invalid from _UnitType: "+t}switch(r){case _UnitType.Document:return i*_Unit._DocumentUnitsPerInch;case _UnitType.Inch:return i;case _UnitType.Mm:return i*_Unit._MmPerInch;case _UnitType.Pica:return i*_Unit._PicaPerInch;case _UnitType.Point:return i*_Unit._PointsPerInch;case _UnitType.Twip:return i*_Unit._TwipsPerInch;case _UnitType.InHs:return 100*i;case _UnitType.Display:return i*_Unit._DisplayPerInch;case _UnitType.Cm:return i*_Unit._CmPerInch;case _UnitType.Dip:return i*_Unit._DipPerInch;default:throw"Invalid to _UnitType: "+r}}}_Unit._MmPerInch=25.4,_Unit._DocumentUnitsPerInch=300,_Unit._PointsPerInch=72,_Unit._TwipsPerInch=1440,_Unit._PicaPerInch=6,_Unit._CmPerInch=_Unit._MmPerInch/10,_Unit._DisplayPerInch=75,_Unit._DipPerInch=96,_Unit._unitTypes={doc:_UnitType.Document,in:_UnitType.Inch,mm:_UnitType.Mm,pc:_UnitType.Pica,pt:_UnitType.Point,tw:_UnitType.Twip,inhs:_UnitType.InHs,dsp:_UnitType.Display,cm:_UnitType.Cm,dip:_UnitType.Dip,px:_UnitType.Dip},exports._Unit=_Unit;class _Promise{constructor(){this._callbacks=[]}then(e,t){return this._callbacks.push({onFulfilled:e,onRejected:t}),this}catch(e){return this.then(null,e)}resolve(e){return setTimeout(()=>{try{this.onFulfilled(e)}catch(e){this.onRejected(e)}},0),this}reject(e){return setTimeout(()=>{this.onRejected(e)},0),this}onFulfilled(e){for(var t;t=this._callbacks.shift();)if(t.onFulfilled){var r=t.onFulfilled(e);void 0!==r&&(e=r)}}onRejected(e){for(var t;t=this._callbacks.shift();)if(t.onRejected){var r=t.onRejected(e);return void this.onFulfilled(r)}throw e}}exports._Promise=_Promise;class _CompositedPromise extends _Promise{constructor(e){super(),this._promises=e,this._init()}_init(){if(this._promises&&this._promises.length){var e=this._promises.length,t=0,r=[],i=!1;this._promises.some(o=>(o.then(o=>{i||(r.push(o),++t>=e&&this.resolve(r))}).catch(e=>{i=!0,this.reject(e)}),i))}else this.reject("No promises in current composited promise.")}}exports._CompositedPromise=_CompositedPromise;var _PaperKind;!function(e){e[e.Custom=0]="Custom",e[e.Letter=1]="Letter",e[e.LetterSmall=2]="LetterSmall",e[e.Tabloid=3]="Tabloid",e[e.Ledger=4]="Ledger",e[e.Legal=5]="Legal",e[e.Statement=6]="Statement",e[e.Executive=7]="Executive",e[e.A3=8]="A3",e[e.A4=9]="A4",e[e.A4Small=10]="A4Small",e[e.A5=11]="A5",e[e.B4=12]="B4",e[e.B5=13]="B5",e[e.Folio=14]="Folio",e[e.Quarto=15]="Quarto",e[e.Standard10x14=16]="Standard10x14",e[e.Standard11x17=17]="Standard11x17",e[e.Note=18]="Note",e[e.Number9Envelope=19]="Number9Envelope",e[e.Number10Envelope=20]="Number10Envelope",e[e.Number11Envelope=21]="Number11Envelope",e[e.Number12Envelope=22]="Number12Envelope",e[e.Number14Envelope=23]="Number14Envelope",e[e.CSheet=24]="CSheet",e[e.DSheet=25]="DSheet",e[e.ESheet=26]="ESheet",e[e.DLEnvelope=27]="DLEnvelope",e[e.C5Envelope=28]="C5Envelope",e[e.C3Envelope=29]="C3Envelope",e[e.C4Envelope=30]="C4Envelope",e[e.C6Envelope=31]="C6Envelope",e[e.C65Envelope=32]="C65Envelope",e[e.B4Envelope=33]="B4Envelope",e[e.B5Envelope=34]="B5Envelope",e[e.B6Envelope=35]="B6Envelope",e[e.ItalyEnvelope=36]="ItalyEnvelope",e[e.MonarchEnvelope=37]="MonarchEnvelope",e[e.PersonalEnvelope=38]="PersonalEnvelope",e[e.USStandardFanfold=39]="USStandardFanfold",e[e.GermanStandardFanfold=40]="GermanStandardFanfold",e[e.GermanLegalFanfold=41]="GermanLegalFanfold",e[e.IsoB4=42]="IsoB4",e[e.JapanesePostcard=43]="JapanesePostcard",e[e.Standard9x11=44]="Standard9x11",e[e.Standard10x11=45]="Standard10x11",e[e.Standard15x11=46]="Standard15x11",e[e.InviteEnvelope=47]="InviteEnvelope",e[e.LetterExtra=50]="LetterExtra",e[e.LegalExtra=51]="LegalExtra",e[e.TabloidExtra=52]="TabloidExtra",e[e.A4Extra=53]="A4Extra",e[e.LetterTransverse=54]="LetterTransverse",e[e.A4Transverse=55]="A4Transverse",e[e.LetterExtraTransverse=56]="LetterExtraTransverse",e[e.APlus=57]="APlus",e[e.BPlus=58]="BPlus",e[e.LetterPlus=59]="LetterPlus",e[e.A4Plus=60]="A4Plus",e[e.A5Transverse=61]="A5Transverse",e[e.B5Transverse=62]="B5Transverse",e[e.A3Extra=63]="A3Extra",e[e.A5Extra=64]="A5Extra",e[e.B5Extra=65]="B5Extra",e[e.A2=66]="A2",e[e.A3Transverse=67]="A3Transverse",e[e.A3ExtraTransverse=68]="A3ExtraTransverse",e[e.JapaneseDoublePostcard=69]="JapaneseDoublePostcard",e[e.A6=70]="A6",e[e.JapaneseEnvelopeKakuNumber2=71]="JapaneseEnvelopeKakuNumber2",e[e.JapaneseEnvelopeKakuNumber3=72]="JapaneseEnvelopeKakuNumber3",e[e.JapaneseEnvelopeChouNumber3=73]="JapaneseEnvelopeChouNumber3",e[e.JapaneseEnvelopeChouNumber4=74]="JapaneseEnvelopeChouNumber4",e[e.LetterRotated=75]="LetterRotated",e[e.A3Rotated=76]="A3Rotated",e[e.A4Rotated=77]="A4Rotated",e[e.A5Rotated=78]="A5Rotated",e[e.B4JisRotated=79]="B4JisRotated",e[e.B5JisRotated=80]="B5JisRotated",e[e.JapanesePostcardRotated=81]="JapanesePostcardRotated",e[e.JapaneseDoublePostcardRotated=82]="JapaneseDoublePostcardRotated",e[e.A6Rotated=83]="A6Rotated",e[e.JapaneseEnvelopeKakuNumber2Rotated=84]="JapaneseEnvelopeKakuNumber2Rotated",e[e.JapaneseEnvelopeKakuNumber3Rotated=85]="JapaneseEnvelopeKakuNumber3Rotated",e[e.JapaneseEnvelopeChouNumber3Rotated=86]="JapaneseEnvelopeChouNumber3Rotated",e[e.JapaneseEnvelopeChouNumber4Rotated=87]="JapaneseEnvelopeChouNumber4Rotated",e[e.B6Jis=88]="B6Jis",e[e.B6JisRotated=89]="B6JisRotated",e[e.Standard12x11=90]="Standard12x11",e[e.JapaneseEnvelopeYouNumber4=91]="JapaneseEnvelopeYouNumber4",e[e.JapaneseEnvelopeYouNumber4Rotated=92]="JapaneseEnvelopeYouNumber4Rotated",e[e.Prc16K=93]="Prc16K",e[e.Prc32K=94]="Prc32K",e[e.Prc32KBig=95]="Prc32KBig",e[e.PrcEnvelopeNumber1=96]="PrcEnvelopeNumber1",e[e.PrcEnvelopeNumber2=97]="PrcEnvelopeNumber2",e[e.PrcEnvelopeNumber3=98]="PrcEnvelopeNumber3",e[e.PrcEnvelopeNumber4=99]="PrcEnvelopeNumber4",e[e.PrcEnvelopeNumber5=100]="PrcEnvelopeNumber5",e[e.PrcEnvelopeNumber6=101]="PrcEnvelopeNumber6",e[e.PrcEnvelopeNumber7=102]="PrcEnvelopeNumber7",e[e.PrcEnvelopeNumber8=103]="PrcEnvelopeNumber8",e[e.PrcEnvelopeNumber9=104]="PrcEnvelopeNumber9",e[e.PrcEnvelopeNumber10=105]="PrcEnvelopeNumber10",e[e.Prc16KRotated=106]="Prc16KRotated",e[e.Prc32KRotated=107]="Prc32KRotated",e[e.Prc32KBigRotated=108]="Prc32KBigRotated",e[e.PrcEnvelopeNumber1Rotated=109]="PrcEnvelopeNumber1Rotated",e[e.PrcEnvelopeNumber2Rotated=110]="PrcEnvelopeNumber2Rotated",e[e.PrcEnvelopeNumber3Rotated=111]="PrcEnvelopeNumber3Rotated",e[e.PrcEnvelopeNumber4Rotated=112]="PrcEnvelopeNumber4Rotated",e[e.PrcEnvelopeNumber5Rotated=113]="PrcEnvelopeNumber5Rotated",e[e.PrcEnvelopeNumber6Rotated=114]="PrcEnvelopeNumber6Rotated",e[e.PrcEnvelopeNumber7Rotated=115]="PrcEnvelopeNumber7Rotated",e[e.PrcEnvelopeNumber8Rotated=116]="PrcEnvelopeNumber8Rotated",e[e.PrcEnvelopeNumber9Rotated=117]="PrcEnvelopeNumber9Rotated",e[e.PrcEnvelopeNumber10Rotated=118]="PrcEnvelopeNumber10Rotated"}(_PaperKind=exports._PaperKind||(exports._PaperKind={}));class QueryLoadingDataEventArgs extends wjcCore.EventArgs{constructor(e){super(),this._data=e||{}}get data(){return this._data}}exports.QueryLoadingDataEventArgs=QueryLoadingDataEventArgs;class _ReportServiceBase extends _DocumentService{render(){throw _DocumentSource._abstractMethodException}}exports._ReportServiceBase=_ReportServiceBase;class _ReportSourceBase extends _DocumentSource{constructor(e,t){super(e,t),this._status=_ExecutionStatus.notFound,this.statusChanged=new wjcCore.Event}get autoRun(){return!0}get hasParameters(){throw _DocumentSource._abstractMethodException}get status(){return this._status}set status(e){e!==this._status&&(this._status=e,this.onStatusChanged(wjcCore.EventArgs.empty))}getParameters(){throw _DocumentSource._abstractMethodException}setParameters(e){throw _DocumentSource._abstractMethodException}render(){return this._innerService.render().then(e=>this._updateDocumentStatus(e))}executeCustomAction(e){return this._innerService.executeCustomAction(e).then(e=>this._updateDocumentStatus(e))}onStatusChanged(e){this.statusChanged.raise(this,e)}get _innerService(){return this.service}_updateDocumentStatus(e){e&&(this.status=e.status),super._updateDocumentStatus(e)}}exports._ReportSourceBase=_ReportSourceBase;class _Report extends _ReportSourceBase{constructor(e,t){super(e,t),this._hasParameters=!1}static getReportNames(e,t,r){return _ReportService.getReportNames(e,t,r)}static getReports(e,t,r,i){return wjcCore.isBoolean(r)&&(r={recursive:r}),_ReportService.getReports(e,t,r,i)}get reportName(){return this._innerService?this._innerService.reportName:null}get hasParameters(){return this._hasParameters}load(){return super.load()}cancel(){return this._innerService.cancel().then(e=>this._updateDocumentStatus(e))}dispose(){return super.dispose()}setParameters(e){return this._innerService.setParameters(e).then(e=>void(this._parameters=e))}getParameters(){if(this._parameters&&this._parameters.length){var e=new _Promise;return e.resolve(this._parameters),e}return this._innerService.getParameters().then(e=>void(this._parameters=e))}_getIsDisposed(){return super._getIsDisposed()||this._innerService.isCleared}_updateExecutionInfo(e){null==e||this.isDisposed||(this._hasParameters=!!e.hasParameters,super._updateExecutionInfo(e))}_checkIsLoadCompleted(e){return e.status===_ExecutionStatus.completed||e.status===_ExecutionStatus.stopped}_createDocumentService(e){return new _ReportService(e,this.httpHandler)}get _innerService(){return this.service}}exports._Report=_Report;class _ReportService extends _ReportServiceBase{constructor(e,t){super(e,t),this._reportName=e.reportName}get isCleared(){return!this._instanceId&&this._status==_ExecutionStatus.cleared}static getReportNames(e,t,r){return _ReportService.getReports(e,t,null,r).then(e=>{if(!e)return null;var t=[];return e.items.forEach(e=>{e.type===CatalogItemType.Report&&t.push(e.name)}),t})}static getReports(e,t,r,i){var o=new _Promise;return _httpRequest(_joinUrl(e,t),i,{data:r,success:e=>{o.resolve(JSON.parse(e.responseText))},error:e=>o.reject(e)}),o}get reportName(){return this._reportName}getBookmark(e){var t=new _Promise;return this._checkReportInstanceController(t)?(this.httpRequest(this._getReportInstancesUrl(_ReportService._bookmarkAction,e)).then(e=>{t.resolve(JSON.parse(e.responseText))}),t):t}executeCustomAction(e){var t={};return t[_ReportService._customActionParam]=e.data,this.render(t)}getStatus(){var e=new _Promise;return this.httpRequest(this._statusLocation).then(t=>{e.resolve(JSON.parse(t.responseText,_statusJsonReviver))}),e}getDocumentStatus(){return this._getReportCache()}_getReportCache(){var e=new _Promise;return this._checkReportInstanceController(e)?(this.httpRequest(this._getReportInstancesUrl()).then(t=>{e.resolve(_parseReportExecutionInfo(t.responseText))}),e):e}getParameters(){var e=new _Promise;return this._checkReportInstanceController(e)?(this.httpRequest(this._getReportInstancesUrl(_ReportService._parametersAction)).then(t=>{e.resolve(JSON.parse(t.responseText))}),e):e}_getUrlMainPart(){return _joinUrl(this.serviceUrl,this.filePath,this.reportName)}_getReportUrl(...e){return _joinUrl(this._getUrlMainPart(),_ReportService._reportCommand,e)}_getReportInstancesUrl(...e){return _joinUrl(this._getUrlMainPart(),_ReportService._instancesCommand,this._instanceId,e)}_checkReportController(e){return!(null==this.serviceUrl||!this.filePath||(_strEndsWith(this.filePath,".flxr",!0)||_strEndsWith(this.filePath,".xml",!0))&&!this.reportName)||(e&&e.reject(_ReportService._invalidReportControllerError),!1)}_checkReportInstanceController(e){return!(!this._checkReportController(e)||!this._instanceId)||(e&&e.reject(_ReportService._invalidReportCacheControllerError),!1)}_getError(e){var t=e.responseText;try{t&&(t=JSON.parse(t))}finally{return t}}render(e){var t=new _Promise;return this._checkReportInstanceController(t)?(this.httpRequest(this._getReportInstancesUrl(_ReportService._renderAction),{method:"POST",data:e}).then(e=>{var r=202===e.status?{status:_ExecutionStatus.rendering}:_parseReportExecutionInfo(e.responseText);this._status=r.status,t.resolve(r)},e=>{t.reject(this._getError(e))}),t):t}renderToFilter(e){var t=new _Promise;return this._checkReportInstanceController(t)?(this.getRenderToFilterUrl(e).then(e=>{this.httpRequest(e,{cache:!0}).then(e=>{t.resolve(e)},e=>{t.reject(this._getError(e))})}),t):t}load(e){var t=new _Promise;return this._checkReportController(t)?(this.httpRequest(this._getReportInstancesUrl(),{method:"POST",data:e}).then(e=>{var r=_parseReportExecutionInfo(e.responseText);this._instanceId=r.id,this._status=_ExecutionStatus.loaded,this._outlinesLocation=r.outlinesLocation,this._statusLocation=r.statusLocation,this._pageSettingsLocation=r.pageSettingsLocation,this._featuresLocation=r.featuresLocation,this._parametersLocation=r.parametersLocation,t.resolve(r)},e=>{t.reject(this._getError(e))}),t):t}cancel(){var e=new _Promise;return this._checkReportInstanceController(e)?this._status!==_ExecutionStatus.rendering?(e.reject("Cannot execute cancel when the report is not rendering."),e):(this.httpRequest(this._getReportInstancesUrl(_ReportService._cancelAction),{method:"POST"}).then(t=>{var r=_parseReportExecutionInfo(t.responseText);this._status=r.status.status,e.resolve(r)}),e):e}dispose(){var e=new _Promise;return this._checkReportInstanceController()?(this.httpRequest(this._getReportInstancesUrl(),{method:"DELETE"}).then(t=>{this._status=_ExecutionStatus.cleared,this._instanceId="",e.resolve()}),e):e}getOutlines(){var e=new _Promise;return this._checkReportInstanceController(e)?(this.httpRequest(this._getReportInstancesUrl(_ReportService._outlinesAction)).then(t=>{e.resolve(JSON.parse(t.responseText))}),e):e}getRenderToFilterUrl(e){var t=new _Promise,r=null;return this._checkReportInstanceController()&&(r=_appendQueryString(r=_disableCache(r=this._getReportInstancesUrl(_ReportService._exportAction)),e),t.resolve(r)),t.resolve(r),t}getExportedUrl(e){return this.getRenderToFilterUrl(e)}search(e){var t=new _Promise;return this._checkReportInstanceController(t)?(this.httpRequest(this._getReportInstancesUrl(_ReportService._searchAction),{data:e}).then(e=>{t.resolve(JSON.parse(e.responseText))}),t):t}setPageSettings(e){var t=new _Promise;if(!this._checkReportInstanceController(t))return t;var r=this._getReportInstancesUrl(_ReportService._pageSettingsAction);return this.httpRequest(r,{method:"PUT",data:e}).then(e=>{t.resolve(JSON.parse(e.responseText,_pageSettingsJsonReviver))},e=>{t.reject(this._getError(e))}),t}setParameters(e){var t=new _Promise;if(!this._checkReportInstanceController(t))return t;Object.keys(e).forEach(t=>{null===e[t]&&(e[t]="")});var r=this._getReportInstancesUrl(_ReportService._parametersAction);return this.httpRequest(r,{method:"PATCH",data:e}).then(e=>{t.resolve(JSON.parse(e.responseText))},e=>{t.reject(this._getError(e))}),t}getSupportedExportDescriptions(){var e=new _Promise;return this._checkReportInstanceController(e)?(this.httpRequest(this._getReportInstancesUrl(_ReportService._supportedFormatsAction)).then(t=>{e.resolve(JSON.parse(t.responseText))}),e):e}getFeatures(){var e=new _Promise;return this._checkReportInstanceController(e)?(this.httpRequest(this._featuresLocation).then(t=>{e.resolve(JSON.parse(t.responseText))}),e):e}}_ReportService._reportCommand="$report",_ReportService._instancesCommand="$instances",_ReportService._customActionParam="actionString",_ReportService._renderAction="render",_ReportService._searchAction="search",_ReportService._cancelAction="stop",_ReportService._outlinesAction="outlines",_ReportService._exportAction="export",_ReportService._parametersAction="parameters",_ReportService._bookmarkAction="bookmarks",_ReportService._pageSettingsAction="pagesettings",_ReportService._supportedFormatsAction="supportedformats",_ReportService._invalidReportControllerError="Cannot call the service without service url, document path or report name.",_ReportService._invalidReportCacheControllerError="Cannot call the service when service url is not set or the report is not loaded.",exports._ReportService=_ReportService,exports._parseReportExecutionInfo=_parseReportExecutionInfo;class _ExecutionStatus{}_ExecutionStatus.loaded="Loaded",_ExecutionStatus.rendering="Rendering",_ExecutionStatus.completed="Completed",_ExecutionStatus.stopped="Stopped",_ExecutionStatus.cleared="Cleared",_ExecutionStatus.notFound="NotFound",exports._ExecutionStatus=_ExecutionStatus;var _ParameterType;!function(e){e[e.Boolean=0]="Boolean",e[e.DateTime=1]="DateTime",e[e.Time=2]="Time",e[e.Date=3]="Date",e[e.Integer=4]="Integer",e[e.Float=5]="Float",e[e.String=6]="String"}(_ParameterType=exports._ParameterType||(exports._ParameterType={}));var CatalogItemType;!function(e){e[e.Folder=0]="Folder",e[e.File=1]="File",e[e.Report=2]="Report"}(CatalogItemType=exports.CatalogItemType||(exports.CatalogItemType={}));class _PdfDocumentSource extends _DocumentSource{constructor(e,t){super(e,t),this._status=_ExecutionStatus.notFound}get status(){return this._status}get _innerService(){return this.service}_createDocumentService(e){return new _PdfDocumentService(e,this.httpHandler)}load(){return super.load()}_updateStatus(e){this._status!==e&&(this._status=e)}getStatus(){var e=new QueryLoadingDataEventArgs;return this.onQueryLoadingData(e),this._innerService.getStatus(e.data).then(e=>this._updateDocumentStatus(e))}renderToFilter(e){var t=new QueryLoadingDataEventArgs;return this.onQueryLoadingData(t),this._innerService.renderToFilter(e,t.data)}_updateDocumentStatus(e){null!=e&&(this._updateStatus(e.status),super._updateDocumentStatus(e))}}exports._PdfDocumentSource=_PdfDocumentSource;class _PdfDocumentService extends _DocumentService{_getPdfUrl(...e){return _joinUrl(this.serviceUrl,this.filePath,_PdfDocumentService._pdfCommand,e)}_getPdfStatus(e){var t=new _Promise;return this._checkPdfController(t)?(this.httpRequest(this._getPdfUrl(),{data:e}).then(e=>{var r=_parseExecutionInfo(e.responseText);this._status=_ExecutionStatus.loaded,this._statusLocation=r.statusLocation,this._featuresLocation=r.featuresLocation,t.resolve(r)},e=>{t.reject(e.statusText)}),t):t}_checkPdfController(e){return!(null==this.serviceUrl||!this.filePath)||(e&&e.reject(_PdfDocumentService._invalidPdfControllerError),!1)}dispose(){var e=new _Promise;return e.resolve(),e}load(e){return this._getPdfStatus(e)}getStatus(e){var t=new _Promise;return this.httpRequest(this._statusLocation,{data:e}).then(e=>{t.resolve(JSON.parse(e.responseText))}),t}renderToFilter(e,t){var r=new _Promise;return this._checkPdfController(r)?(this.getRenderToFilterUrl(e).then(e=>{this.httpRequest(e,{data:t,cache:!0}).then(e=>{r.resolve(e)})}),r):r}getRenderToFilterUrl(e){var t=new _Promise,r=null;return this._checkPdfController()&&(r=_appendQueryString(r=_disableCache(r=this._getPdfUrl(_PdfDocumentService._exportAction)),e)),t.resolve(r),t}getExportedUrl(e){return this.getRenderToFilterUrl(e)}getSupportedExportDescriptions(){var e=new _Promise;return this._checkPdfController(e)?(this.httpRequest(this._getPdfUrl(_PdfDocumentService._supportedFormatsAction)).then(t=>{e.resolve(JSON.parse(t.responseText))}),e):e}getFeatures(){var e=new _Promise;return this._checkPdfController(e)?(this.httpRequest(this._featuresLocation).then(t=>{e.resolve(JSON.parse(t.responseText))}),e):e}search(e){var t=new _Promise;return this._checkPdfController(t)?(this.httpRequest(this._getPdfUrl(_PdfDocumentService._searchAction),{data:e}).then(e=>{t.resolve(JSON.parse(e.responseText))}),t):t}}_PdfDocumentService._pdfCommand="$pdf",_PdfDocumentService._exportAction="export",_PdfDocumentService._supportedFormatsAction="supportedformats",_PdfDocumentService._searchAction="search",_PdfDocumentService._invalidPdfControllerError="Cannot call the service when service url is not set or the pdf is not loaded.",exports._PdfDocumentService=_PdfDocumentService,exports._parseExecutionInfo=_parseExecutionInfo,wjcCore._addCultureInfo("Viewer",{cancel:"Cancel",ok:"OK",bottom:"Bottom:",top:"Top:",right:"Right:",left:"Left:",margins:"Margins(inches)",orientation:"Orientation:",paperKind:"Paper Kind:",pageSetup:"Page Setup",landscape:"Landscape",portrait:"Portrait",pageNumber:"Page Number",zoomFactor:"Zoom Factor",paginated:"Print Layout",print:"Print",search:"Search",matchCase:"Match case",wholeWord:"Match whole word only",searchResults:"Search Results",previousPage:"Previous Page",nextPage:"Next Page",firstPage:"First Page",lastPage:"Last Page",backwardHistory:"Backward",forwardHistory:"Forward",pageCount:"Page Count",selectTool:"Select Tool",moveTool:"Move Tool",continuousMode:"Continuous Page View",singleMode:"Single Page View",wholePage:"Fit Whole Page",pageWidth:"Fit Page Width",zoomOut:"Zoom Out",zoomIn:"Zoom In",rubberbandTool:"Zoom by Selection",magnifierTool:"Magnifier",rotatePage:"Rotate Page",rotateDocument:"Rotate Document",exports:"Export",fullScreen:"Full Screen",exitFullScreen:"Exit Full Screen",hamburgerMenu:"Tools",showSearchBar:"Show Search Bar",viewMenu:"Layout Options",searchOptions:"Search Options",matchCaseMenuItem:"Match Case",wholeWordMenuItem:"Match Whole Word",thumbnails:"Page Thumbnails",outlines:"Document Map",loading:"Loading...",pdfExportName:"Adobe PDF",docxExportName:"Open XML Word",xlsxExportName:"Open XML Excel",docExportName:"Microsoft Word",xlsExportName:"Microsoft Excel",mhtmlExportName:"Web archive (MHTML)",htmlExportName:"HTML document",rtfExportName:"RTF document",metafileExportName:"Compressed metafiles",csvExportName:"CSV",tiffExportName:"Tiff images",bmpExportName:"BMP images",emfExportName:"Enhanced metafile",gifExportName:"GIF images",jpgExportName:"JPEG images",jpegExportName:"JPEG images",pngExportName:"PNG images",abstractMethodException:"It is an abstract method, please implement it.",cannotRenderPageNoViewPage:"Cannot render page without document source and view page.",cannotRenderPageNoDoc:"Cannot render page without document source and view page.",exportFormat:"Export format:",exportOptionTitle:"Export options",documentRestrictionsGroup:"Document restrictions",passwordSecurityGroup:"Password security",outputRangeGroup:"Output range",documentInfoGroup:"Document info",generalGroup:"General",docInfoTitle:"Title",docInfoAuthor:"Author",docInfoManager:"Manager",docInfoOperator:"Operator",docInfoCompany:"Company",docInfoSubject:"Subject",docInfoComment:"Comment",docInfoCreator:"Creator",docInfoProducer:"Producer",docInfoCreationTime:"Creation time",docInfoRevisionTime:"Revision time",docInfoKeywords:"Keywords",embedFonts:"Embed TrueType fonts",pdfACompatible:"PDF/A compatible (level 2B)",useCompression:"Use compression",useOutlines:"Generate outlines",allowCopyContent:"Allow content copying or extraction",allowEditAnnotations:"Allow annotations editing",allowEditContent:"Allow content editing",allowPrint:"Allow printing",ownerPassword:"Permissions (owner) password:",userPassword:"Document open (user) password:",encryptionType:"Encryption level:",paged:"Paged",showNavigator:"Show Navigator",navigatorPosition:"Navigator Position",singleFile:"Single File",tolerance:"Tolerance when detecting text bounds (points):",pictureLayer:"Use separate picture layer",metafileType:"Metafile Type:",monochrome:"Monochrome",resolution:"Resolution:",outputRange:"Page range:",outputRangeInverted:"Inverted",showZoomBar:"Zoom Bar",searchPrev:"Search Previous",searchNext:"Search Next",checkMark:"✓",exportOk:"Export...",cannotSearch:"Search requires a document source to be specified.",parameters:"Parameters",requiringParameters:"Please input parameters.",nullParameterError:"Value cannot be null.",invalidParameterError:"Invalid input.",parameterNoneItemsSelected:"(none)",parameterAllItemsSelected:"(all)",parameterSelectAllItemText:"(Select All)",selectParameterValue:"(select value)",apply:"Apply",errorOccured:"An error has occured."});class _SearchManager{constructor(){this._currentIndex=-1,this.currentChanged=new wjcCore.Event,this.searchStarted=new wjcCore.Event,this.searchCompleted=new wjcCore.Event}get current(){return this._currentIndex<0?null:this._searchResult[this._currentIndex]}get currentIndex(){return this._currentIndex}set currentIndex(e){e!==this._currentIndex&&this._getSearchResults().then(t=>{this._currentIndex=e,this._onCurrentChanged()})}get documentSource(){return this._documentSource}set documentSource(e){this._documentSource=e,this.clear()}get matchCase(){return this._matchCase}set matchCase(e){this._matchCase!==e&&(this._matchCase=e,this._needUpdate=!0)}get searchResult(){return this._searchResult}get text(){return this._text}set text(e){this._text!==e&&(this._text=e,this._needUpdate=!0)}get wholeWord(){return this._wholeWord}set wholeWord(e){this._wholeWord!==e&&(this._wholeWord=e,this._needUpdate=!0)}clear(){this._clearResults(),this._text=null,this._matchCase=!1,this._wholeWord=!1,this._currentIndex=-1}search(e){this._needUpdate&&this._clearResults(),this._getSearchResults().then(t=>{var r=this._searchResult.length;e?(this._currentIndex--,this._currentIndex<0&&(this._currentIndex=r-1)):(this._currentIndex++,this._currentIndex>=r&&(this._currentIndex=0)),this._currentIndex=Math.max(Math.min(this._currentIndex,r-1),0),this._onCurrentChanged()})}_clearResults(){this._currentIndex=-1,this._searchResult=null}_getSearchResults(){var e=new _Promise;return this._searchResult?(e.resolve(this._searchResult),e):this.documentSource?null==this._text||0===this._text.length?e:(this._needUpdate=!1,this._onSearchStarted(),this.documentSource.search({text:this.documentSource.encodeRequestParams?encodeURIComponent(this.text):this.text,matchCase:this.matchCase,wholeWord:this.wholeWord}).then(e=>{this._searchResult=e,this._onSearchCompleted()})):(e.reject(wjcCore.culture.Viewer.cannotSearch),e)}_onCurrentChanged(){this.currentChanged.raise(this,new wjcCore.EventArgs)}_onSearchStarted(){this.searchStarted.raise(this,new wjcCore.EventArgs)}_onSearchCompleted(){this.searchCompleted.raise(this,new wjcCore.EventArgs)}}exports._SearchManager=_SearchManager,window.TouchEvent=window.TouchEvent||(()=>{}),window.PointerEvent=window.PointerEvent||(()=>{}),window.Touch=window.Touch||(()=>{});var _eventSeparator=",",_touchEventsMap={startName:"touchstart",moveName:"touchmove",endName:["touchend","touchcancel","touchleave"].join(_eventSeparator)},_pointerEventsMap={startName:["pointerdown","pointerenter"].join(_eventSeparator),moveName:"pointermove",endName:["pointerup","pointercancel","pointerleave"].join(_eventSeparator)};exports._getTouchEventMap=_getTouchEventMap;var _TouchDirection;!function(e){e[e.None=0]="None",e[e.Left=1]="Left",e[e.Up=2]="Up",e[e.Right=3]="Right",e[e.Down=4]="Down"}(_TouchDirection=exports._TouchDirection||(exports._TouchDirection={}));class _TouchInfo{static getCenter(e,t){return new wjcCore.Point(e.x+(t.x-e.x)/2,e.y+(t.y-e.y)/2)}static getCenterClient(e,t){return _TouchInfo.getCenter(new wjcCore.Point(e.clientX,e.clientY),new wjcCore.Point(t.clientX,t.clientY))}static getCenterScreen(e,t){return _TouchInfo.getCenter(new wjcCore.Point(e.screenX,e.screenY),new wjcCore.Point(t.screenX,t.screenY))}static getDistance(e,t){var r=Math.abs(e.clientX-t.clientX),i=Math.abs(e.clientY-t.clientY);return Math.sqrt(r*r+i*i)}static _getDirection(e,t){var r=t.clientX-e.clientX,i=t.clientY-e.clientY;return Math.abs(r)>=Math.abs(i)?r>0?_TouchDirection.Right:r<0?_TouchDirection.Left:_TouchDirection.None:i>0?_TouchDirection.Down:i<0?_TouchDirection.Up:_TouchDirection.None}constructor(e){this._systemTouchInfo=e,e instanceof Touch?this._id=e.identifier:this._id=e.pointerId,this._target=e.target,this._screenX=e.screenX,this._screenY=e.screenY,this._clientX=e.clientX,this._clientY=e.clientY}get id(){return this._id}get systemTouchInfo(){return this._systemTouchInfo}get screenX(){return this._screenX}get screenY(){return this._screenY}get clientX(){return this._clientX}get clientY(){return this._clientY}}exports._TouchInfo=_TouchInfo;class _SpeedReducer{constructor(){this._timeInterval=50,this._speedInterval=5}get timeInterval(){return this._timeInterval}set timeInterval(e){this._timeInterval=e}get speedInterval(){return this._speedInterval}set speedInterval(e){this._speedInterval=e}stop(){null!=this._timer&&(clearInterval(this._timer),this._timer=null)}start(e,t,r){if(this.stop(),r){var i=e>=0?1:-1,o=t>=0?1:-1,a=Math.abs(e*this._timeInterval),n=Math.abs(t*this._timeInterval),s=Math.max(a,n),h=Math.floor(s/this.speedInterval),l=Math.floor(a/h),c=Math.floor(n/h);this._timer=setInterval(()=>{a-=l,n-=c,a=Math.max(0,a),n=Math.max(0,n),a&&n?r(a*i,n*o):this.stop()},this._timeInterval)}}}exports._SpeedReducer=_SpeedReducer;var _TouchEventType;!function(e){e[e.Start=0]="Start",e[e.Move=1]="Move",e[e.End=2]="End"}(_TouchEventType=exports._TouchEventType||(exports._TouchEventType={}));class _TouchEventArgs extends wjcCore.EventArgs{constructor(e){if(super(),e instanceof _TouchEventArgs)return this._systemEvent=e.systemEvent,this._type=e.type,void(this._touchInfos=e.touchInfos);this._systemEvent=e,_TouchManager._registerTouchInfo(e),this._type=_TouchManager._isTouchStart(e.type)?_TouchEventType.Start:_TouchManager._isTouchEnd(e.type)?_TouchEventType.End:_TouchEventType.Move,this._touchInfos=_TouchManager._allTouchInfos?_TouchManager._allTouchInfos.slice():[]}get timeStamp(){return this.systemEvent.timeStamp}get touchInfos(){return this._touchInfos}get systemEvent(){return this._systemEvent}get target(){return this.systemEvent.target}get currentTarget(){return this.systemEvent.currentTarget}get type(){return this._type}get pointersCount(){return this.touchInfos.length}get cancelBubble(){return this._systemEvent.cancelBubble}set cancelBubble(e){this._systemEvent.cancelBubble=e}preventDefault(){this._systemEvent.preventDefault()}}exports._TouchEventArgs=_TouchEventArgs;class _TouchEvent extends wjcCore.Event{raise(e,t){super.raise(e,t)}}exports._TouchEvent=_TouchEvent;class _TouchTrigger{constructor(e){this.touchMove=new _TouchEvent,this.touchStart=new _TouchEvent,this.touchEnd=new _TouchEvent;var t=wjcCore.getElement(e);this._element=t;var r=_TouchTrigger.getTrigger(t);if(r){var i=this._onTouchEvent.bind(this);return r.touchMove.addHandler(i),r.touchStart.addHandler(i),r.touchEnd.addHandler(i),void(this._disposeAction=(()=>{r.touchMove.removeHandler(i),r.touchStart.removeHandler(i),r.touchEnd.removeHandler(i),this._disposeAction=null}))}var o=_getTouchEventMap(),a=this._onSystemTouchEvent.bind(this);_addEvent(t,o.startName,a),_addEvent(t,o.moveName,a),_addEvent(t,o.endName,a),_TouchTrigger.bindElement(t,this),this._disposeAction=(()=>{_removeEvent(t,o.startName,a),_removeEvent(t,o.moveName,a),_removeEvent(t,o.endName,a),_TouchTrigger.unbindElement(t),this._disposeAction=null})}static bindElement(e,t){if(e[_TouchTrigger._elementDataName])throw"Cannot bind multi _TouchTrigger on the same element.";e[_TouchTrigger._elementDataName]=t}static unbindElement(e){e[_TouchTrigger._elementDataName]=null}static getTrigger(e){return e[_TouchTrigger._elementDataName]}_onSystemTouchEvent(e){var t=this._createTouchEventArgs(e);t&&this._onTouchEvent(this,t)}_createTouchEventArgs(e){return _TouchManager._isTouchEvent(e)?new _TouchEventArgs(e):null}dispose(){this._disposeAction&&this._disposeAction()}get hostElement(){return this._element}_onTouchEvent(e,t){switch(t.type){case _TouchEventType.Start:return void this.onTouchStart(t);case _TouchEventType.Move:return void this.onTouchMove(t);case _TouchEventType.End:this.onTouchEnd(t)}}onTouchEnd(e){this.touchEnd.raise(this,e)}onTouchStart(e){this.touchStart.raise(this,e)}onTouchMove(e){this.touchMove.raise(this,e)}}_TouchTrigger._elementDataName="__wjTouchTrigger",exports._TouchTrigger=_TouchTrigger;class _PanEventArgs extends _TouchEventArgs{constructor(e,t,r){super(e),this._panType=null==r?e.type:r,this._client=new wjcCore.Point(this.touchInfo.clientX,this.touchInfo.clientY),this._screen=new wjcCore.Point(this.touchInfo.screenX,this.touchInfo.screenY),t&&(this._clientDelta=new wjcCore.Point(this.client.x-t.client.x,this.client.y-t.client.y),this._screenDelta=new wjcCore.Point(this.screen.x-t.screen.x,this.screen.y-t.screen.y))}get type(){return this._panType}get clientDelta(){return this._clientDelta}get screenDelta(){return this._screenDelta}get client(){return this._client}get screen(){return this._screen}get pointersCount(){return this.type==_TouchEventType.End?0:1}get touchInfo(){return this.touchInfos[0]||{}}}exports._PanEventArgs=_PanEventArgs;class _PanEvent extends _TouchEvent{raise(e,t){super.raise(e,t)}}exports._PanEvent=_PanEvent;class _PanTrigger extends _TouchTrigger{constructor(){super(...arguments),this.panMove=new _PanEvent,this.panStart=new _PanEvent,this.panEnd=new _PanEvent}onPanEnd(e){this.panEnd.raise(this,e)}onPanStart(e){this.panStart.raise(this,e)}onPanMove(e){this.panMove.raise(this,e)}_prepareMove(e){this._prePanEventArgs=e,this._panEvents.queue(()=>{this.onPanMove(e)})}_prepareStart(e){this._prePanEventArgs=e,this._panEvents.queue(()=>{this.onPanStart(e)}),this._clearPanStartTimer(),this._panStartTimer=setTimeout(()=>{this._panEvents&&this._panEvents.start(),this._clearPanStartTimer()},_PanTrigger._threhold)}_prepareEnd(e){this._prePanEventArgs=null,this._panEvents.queue(()=>{var t=e instanceof _PanEventArgs?e:new _PanEventArgs(e,null,_TouchEventType.End);this.onPanEnd(t),this._stopPan()})}_clearPanStartTimer(){null!=this._panStartTimer&&(clearTimeout(this._panStartTimer),this._panStartTimer=null)}_tryStopPan(e){this._panEvents&&this._panEvents.isStarted?this._prepareEnd(e):this._stopPan()}_stopPan(){this._clearPanStartTimer(),this._panEvents=null,this._prePanEventArgs=null}_processPan(e){var t=this._createPanEventArgs(e);if(t)switch(t.type){case _TouchEventType.Start:return void this._prepareStart(t);case _TouchEventType.Move:return void this._prepareMove(t);case _TouchEventType.End:return void this._prepareEnd(t)}else this._tryStopPan(e)}onTouchStart(e){super.onTouchStart(e),this._processPan(e)}onTouchMove(e){super.onTouchMove(e),this._processPan(e)}onTouchEnd(e){super.onTouchEnd(e);var t=this._createPanEventArgs(e);t?this._prepareEnd(t):this._tryStopPan(e)}_createPanEventArgs(e){if(e.type==_TouchEventType.End&&0!=e.pointersCount||e.type!=_TouchEventType.End&&1!=e.pointersCount)return null;var t=new _PanEventArgs(e,this._prePanEventArgs);if(t.type!=_TouchEventType.Start){if(!this._panEvents)return null}else this._panEvents=new _ActionQueue;return t}}_PanTrigger._threhold=10,exports._PanTrigger=_PanTrigger;class _SwipeEventArgs extends _PanEventArgs{constructor(e,t,r,i){super(r),this._duration=i,this._startTouchInfo=e,this._endTouchInfo=t;var o=_pointMove(!1,new wjcCore.Point(this.endTouchInfo.clientX,this.endTouchInfo.clientY),new wjcCore.Point(this.startTouchInfo.clientX,this.startTouchInfo.clientY));this._speed=new wjcCore.Point(_SwipeTrigger.getSpeed(o.x,this.duration),_SwipeTrigger.getSpeed(o.y,this.duration)),this._direction=_TouchInfo._getDirection(this.startTouchInfo,this.endTouchInfo)}get duration(){return this._duration}get startTouchInfo(){return this._startTouchInfo}get endTouchInfo(){return this._endTouchInfo}get speed(){return this._speed}get pointersCount(){return 1}get direction(){return this._direction}}exports._SwipeEventArgs=_SwipeEventArgs;class _SwipeEvent extends _PanEvent{raise(e,t){super.raise(e,t)}}exports._SwipeEvent=_SwipeEvent;class _SwipeTrigger extends _PanTrigger{constructor(){super(...arguments),this.swipe=new _SwipeEvent}static getSpeed(e,t){return e/t}onPanStart(e){super.onPanStart(e),this._panStartEventArgs=e}onPanMove(e){super.onPanMove(e),this._prePanMoveEventArgs=e}onPanEnd(e){super.onPanEnd(e);var t=this._createSwipeEventArgs(e);t&&this.onSwipe(t),this._panStartEventArgs=null,this._prePanMoveEventArgs=null}onSwipe(e){this.swipe.raise(this,e)}_createSwipeEventArgs(e){if(!this._panStartEventArgs||!this._prePanMoveEventArgs)return null;var t=e.timeStamp-this._panStartEventArgs.timeStamp;return t>_SwipeTrigger.maxDuration?null:_TouchInfo.getDistance(this._panStartEventArgs.touchInfo,this._prePanMoveEventArgs.touchInfo)<_SwipeTrigger.minDistance?null:new _SwipeEventArgs(this._panStartEventArgs.touchInfo,this._prePanMoveEventArgs.touchInfo,e,t)}}_SwipeTrigger.minDistance=50,_SwipeTrigger.maxDuration=300,exports._SwipeTrigger=_SwipeTrigger;class _PinchEventArgs extends _TouchEventArgs{constructor(e,t,r){super(e),this._zoom=1,this._pinchType=t,this._pre=r||{},this.type!=_TouchEventType.End&&(this._pinchDistance=_TouchInfo.getDistance(this.touchInfos[0],this.touchInfos[1]),this._centerClient=_TouchInfo.getCenterClient(this.touchInfos[0],this.touchInfos[1]),this._centerScreen=_TouchInfo.getCenterScreen(this.touchInfos[0],this.touchInfos[1]),this.type!=_TouchEventType.Start&&(this._zoom=this.pinchDistance/this.prePinchDistance,this._centerClientDelta=new wjcCore.Point(this.centerClient.x-this.preCenterClient.x,this.centerClient.y-this.preCenterClient.y),this._centerScreenDelta=new wjcCore.Point(this.centerScreen.x-this.preCenterScreen.x,this.centerScreen.y-this.preCenterScreen.y)))}get zoom(){return this._zoom}get pointersCount(){return this.type==_TouchEventType.End?0:2}get prePinchDistance(){return this._pre.pinchDistance}get pinchDistance(){return this._pinchDistance}get centerScreenDelta(){return this._centerScreenDelta}get centerClientDelta(){return this._centerClientDelta}get centerClient(){return this._centerClient}get preCenterClient(){return this._pre.centerClient}get centerScreen(){return this._centerScreen}get preCenterScreen(){return this._pre.centerScreen}get type(){return this._pinchType}}exports._PinchEventArgs=_PinchEventArgs;class _PinchEvent extends _TouchEvent{raise(e,t){super.raise(e,t)}}exports._PinchEvent=_PinchEvent;class _PinchTrigger extends _TouchTrigger{constructor(){super(...arguments),this.pinch=new _PinchEvent}onPinch(e){this.pinch.raise(this,e)}onTouchStart(e){this._process(e)}onTouchend(e){this._process(e)}onTouchMove(e){this._process(e)}_onPinching(e){var t=new _PinchEventArgs(e,this._preEventArgs?_TouchEventType.Move:_TouchEventType.Start,this._preEventArgs);this.onPinch(t),this._preEventArgs=t}_onPinchEnd(e){if(this._preEventArgs){var t=new _PinchEventArgs(e,_TouchEventType.End,this._preEventArgs);this.onPinch(t),this._preEventArgs=null}}_process(e){if(2==e.pointersCount)switch(e.type){case _TouchEventType.Start:case _TouchEventType.Move:return void this._onPinching(e);case _TouchEventType.End:return void this._onPinchEnd(e)}else this._onPinchEnd(e)}}exports._PinchTrigger=_PinchTrigger;class _TouchManager{constructor(e,t=!0){this.touchMove=new _TouchEvent,this.touchStart=new _TouchEvent,this.touchEnd=new _TouchEvent,this.panMove=new _PanEvent,this.panStart=new _PanEvent,this.panEnd=new _PanEvent,this.swipe=new _SwipeEvent,this.pinch=new _PinchEvent,this._trigger=new _SwipeTrigger(e),this._trigger.touchStart.addHandler((e,t)=>this.onTouchStart(t)),this._trigger.touchMove.addHandler((e,t)=>this.onTouchMove(t)),this._trigger.touchEnd.addHandler((e,t)=>this.onTouchEnd(t)),this._trigger.panStart.addHandler((e,t)=>this.onPanStart(t)),this._trigger.panMove.addHandler((e,t)=>this.onPanMove(t)),this._trigger.panEnd.addHandler((e,t)=>this.onPanEnd(t)),this._trigger.swipe.addHandler((e,t)=>this.onSwipe(t)),this._pinchTrigger=new _PinchTrigger(e),this._pinchTrigger.pinch.addHandler((e,t)=>this.onPinch(t)),this.removeDefaultTouch=t}static _isTouchEvent(e){return e instanceof TouchEvent||(e.pointerType||"").toLowerCase()===_TouchManager._touchPointerName}static _isTouchStart(e){return _TouchManager._eventTypeContains(e,_getTouchEventMap().startName)}static _isTouchEnd(e){return _TouchManager._eventTypeContains(e,_getTouchEventMap().endName)}static _isTouchMove(e){return _TouchManager._eventTypeContains(e,_getTouchEventMap().moveName)}static _eventTypeContains(e,t){var r=t.split(",");e=e.toLowerCase();for(var i=0,o=r.length;i<o;i++){var a=r[i].trim().toLowerCase();if(e.indexOf(a)>-1)return!0}return!1}static _registerTouchInfo(e){if(_TouchManager._isTouchEvent(e))if(e instanceof TouchEvent){_TouchManager._allTouchInfos=[];for(var t=0,r=e.touches.length;t<r;t++)_TouchManager._allTouchInfos.push(new _TouchInfo(e.touches.item(t)))}else if(e instanceof PointerEvent){if(_TouchManager._allTouchInfos=_TouchManager._allTouchInfos||[],_TouchManager._isTouchEnd(e.type)){for(var i=0,r=_TouchManager._allTouchInfos.length;i<r;i++)if(_TouchManager._allTouchInfos[i].id==e.pointerId)return void _TouchManager._allTouchInfos.splice(i,1);return}for(var i=0,r=_TouchManager._allTouchInfos.length;i<r;i++)if(_TouchManager._allTouchInfos[i].id==e.pointerId)return void(_TouchManager._allTouchInfos[i]=new _TouchInfo(e));_TouchManager._allTouchInfos.push(new _TouchInfo(e))}}onPinch(e){this.pinch.raise(this,e)}onSwipe(e){this.swipe.raise(this,e)}onTouchEnd(e){this.touchEnd.raise(this,e)}onTouchStart(e){this.touchStart.raise(this,e)}onTouchMove(e){this.touchMove.raise(this,e)}onPanEnd(e){this.panEnd.raise(this,e)}onPanStart(e){this.panStart.raise(this,e)}onPanMove(e){this.panMove.raise(this,e)}get removeDefaultTouch(){return this._removeDefaultTouch}set removeDefaultTouch(e){this._removeDefaultTouch=e;var t=this.hostElement.style;e?(t.touchAction="none",t.msTouchAction="none"):(t.touchAction=this._defaultTouchAction,t.msTouchAction=this._defaultMsTouchAction)}get hostElement(){return this._pinchTrigger.hostElement}get contentElement(){return this.hostElement.children.length?this.hostElement.children[0]:null}dispose(){this._pinchTrigger&&this._pinchTrigger.dispose(),this._trigger&&this._trigger.dispose(),this.removeDefaultTouch&&(this.removeDefaultTouch=!1)}}_TouchManager._touchPointerName="touch",_TouchManager._allTouchInfos=[],exports._TouchManager=_TouchManager;class _PageSetupEditor extends wjcCore.Control{constructor(e){super(e),this._uiUpdating=!1;wjcCore.assert(null!=wjcInput.ComboBox,"Missing dependency: _PageSetupEditor requires wijmo.input.");var t;t=this.getTemplate(),this.applyTemplate("wj-control",t,{_divPaperKind:"div-paper-kind",_divOrientation:"div-page-orientation",_divMarginsLeft:"div-margins-left",_divMarginsRight:"div-margins-right",_divMarginsTop:"div-margins-top",_divMarginsBottom:"div-margins-bottom",_gPaperKind:"g-paperkind",_gOrientation:"g-orientation",_gMargins:"g-margins",_gLeft:"g-left",_gRight:"g-right",_gTop:"g-top",_gBottom:"g-bottom"});let r={format:"n2",min:0,max:4,step:.25,valueChanged:this._updateValue.bind(this)};this._numMarginsLeft=new wjcInput.InputNumber(this._divMarginsLeft,r),this._numMarginsRight=new wjcInput.InputNumber(this._divMarginsRight,r),this._numMarginsTop=new wjcInput.InputNumber(this._divMarginsTop,r),this._numMarginsBottom=new wjcInput.InputNumber(this._divMarginsBottom,r),this._cmbPaperKind=new wjcInput.ComboBox(this._divPaperKind,{itemsSource:_enumToArray(_PaperKind),displayMemberPath:"text",selectedValuePath:"value",isEditable:!1}),this._cmbPaperKind.selectedIndexChanged.addHandler(this._updateValue,this),this._cmbOrientation=new wjcInput.ComboBox(this._divOrientation,{itemsSource:[wjcCore.culture.Viewer.portrait,wjcCore.culture.Viewer.landscape],isEditable:!1}),this._cmbOrientation.selectedIndexChanged.addHandler(this._updateValue,this),this._globalize()}get pageSettings(){return this._pageSettings}set pageSettings(e){var t=_clonePageSettings(e);this._pageSettings=t,this._updateUI(),this._cmbPaperKind.focus()}_globalize(){var e=wjcCore.culture.Viewer;this._gPaperKind.textContent=e.paperKind,this._gOrientation.textContent=e.orientation,this._gMargins.textContent=e.margins,this._gLeft.textContent=e.left,this._gRight.textContent=e.right,this._gTop.textContent=e.top,this._gBottom.textContent=e.bottom;var t=this._cmbOrientation.selectedIndex;this._cmbOrientation.itemsSource=[wjcCore.culture.Viewer.portrait,wjcCore.culture.Viewer.landscape],this._cmbOrientation.selectedIndex=t}_updateValue(){if(!this._uiUpdating){var e=this.pageSettings;e&&(e.bottomMargin=new _Unit(this._numMarginsBottom.value,_UnitType.Inch),e.leftMargin=new _Unit(this._numMarginsLeft.value,_UnitType.Inch),e.rightMargin=new _Unit(this._numMarginsRight.value,_UnitType.Inch),e.topMargin=new _Unit(this._numMarginsTop.value,_UnitType.Inch),e.paperSize=this._cmbPaperKind.selectedValue,_setLandscape(e,this._cmbOrientation.text===wjcCore.culture.Viewer.landscape),this._updateUI())}}_updateUI(){this._uiUpdating=!0;var e=this.pageSettings,t=(e,t)=>{e.value=_Unit.convertValue(t.value,t.units,_UnitType.Inch)};e&&(this._cmbPaperKind.selectedValue=e.paperSize,this._cmbOrientation.text=e.landscape?wjcCore.culture.Viewer.landscape:wjcCore.culture.Viewer.portrait,t(this._numMarginsLeft,e.leftMargin),t(this._numMarginsRight,e.rightMargin),t(this._numMarginsTop,e.topMargin),t(this._numMarginsBottom,e.bottomMargin)),this._uiUpdating=!1}refresh(e=!0){super.refresh(e),e&&this._globalize()}}_PageSetupEditor.controlTemplate='<div><div style="padding:12px;"><table style="table-layout:fixed"><tr><td wj-part="g-paperkind"></td><td><div wj-part="div-paper-kind"></div></td></tr><tr><td wj-part="g-orientation"></td><td><div wj-part="div-page-orientation"></div></td></tr></table><fieldset style="margin-top: 12px"><legend wj-part="g-margins"></legend><table style="table-layout:fixed"><tr><td wj-part="g-left"></td><td><div wj-part="div-margins-left"></div></td></tr><tr><td wj-part="g-right"></td><td><div wj-part="div-margins-right"></div></td></tr><tr><td wj-part="g-top"></td><td><div wj-part="div-margins-top"></div></td></tr><tr><td wj-part="g-bottom"></td><td><div wj-part="div-margins-bottom"></div></td></tr></table></fieldset></div></div>',exports._PageSetupEditor=_PageSetupEditor;class _ExportOptionEditor extends wjcCore.Control{constructor(e){super(e),this._options={},this._optionLabels=null,this._groupTitleField=null,wjcCore.addClass(e,"wj-export-editor")}get options(){return this._options}get exportDescription(){return this._exportDescription}set exportDescription(e){this._exportDescription=e,this._options={},e&&(this._options.format=this.exportDescription.format,this._render())}_skipOption(e){return _ExportOptionEditor._skippedOptions.indexOf(e)>=0}_render(){if(_removeChildren(this.hostElement),this.exportDescription){document.createElement("table");var e=this.exportDescription.optionDescriptions,t={};if(e)for(var r=0;r<e.length;r++){var i=e[r];this._skipOption(i.name)||(i.group?(t[i.group]||(t[i.group]=[]),t[i.group].push(i)):(t[_ExportOptionEditor._generalGroupName]||(t[_ExportOptionEditor._generalGroupName]=[]),i.group=_ExportOptionEditor._generalGroupName,t[_ExportOptionEditor._generalGroupName].push(i)))}for(var o in t)this.hostElement.appendChild(this._generateGroup(t[o]));this._updateEditors()}}_generateEditor(e){var t;if(wjcCore.isArray(e.allowedValues))t=this._generateComboEditor(e);else switch(e.type){case"bool":t=this._generateBoolEditor(e);break;case"int":case"float":t=this._generateNumberEditor(e);break;case"unit":e.defaultValue=new _Unit(e.defaultValue);case"string":default:t=this._generateStringEditor(e)}return t.setAttribute(_ExportOptionEditor._optionIdAttr,e.name),t}_generateComboEditor(e){for(var t,r=[],i=document.createElement("div"),o=0;o<e.allowedValues.length;o++)r.push(e.allowedValues[o]);return t=new wjcInput.ComboBox(i),t.isEditable=!1,t.itemsSource=r,t.selectedValue=e.defaultValue,t.selectedIndexChanged.addHandler(t=>{this._setOptionValue(e.name,t.selectedValue.toString())}),i}_generateBoolEditor(e){var t;if(e.nullable){t=document.createElement("div");var r=new wjcInput.ComboBox(t),i=[];r.isEditable=!1,r.displayMemberPath="name",r.selectedValuePath="value",i.push({name:"None",value:null}),i.push({name:"True",value:!0}),i.push({name:"False",value:!1}),r.itemsSource=i,r.selectedValue=e.defaultValue,r.selectedIndexChanged.addHandler(t=>{this._setOptionValue(e.name,t.selectedValue),this._updateEditors(e.name)})}else{(t=document.createElement("input")).type="checkbox";var o=wjcCore.changeType(e.defaultValue,wjcCore.DataType.Boolean,null);t.checked=o,_addEvent(t,"click",()=>{this._setOptionValue(e.name,t.checked),this._updateEditors(e.name)})}return t}_generateNumberEditor(e){var t,r,i="int"===e.type;return t=document.createElement("div"),r=new wjcInput.InputNumber(t),r.format=i?"n0":"n2",r.isRequired=!e.nullable,r.value=e.defaultValue,r.valueChanged.addHandler(t=>{this._setOptionValue(e.name,t.value)}),t}_generateStringEditor(e){var t;return t=document.createElement("input"),e.name.match(/password/i)?t.type="password":t.type="text",t.value=e.defaultValue,_addEvent(t,"change,keyup,paste,input",()=>{this._setOptionValue(e.name,t.value)}),t}_generateGroup(e){var t=document.createElement("fieldset"),r=document.createElement("legend"),i=e[0].group;wjcCore.addClass(t,"wj-exportformats-group"),r.innerHTML=this._groupTitle[i],r.setAttribute(_ExportOptionEditor._optionNameAttr,i),t.appendChild(r);for(var o=document.createElement("table"),a=0;a<e.length;a++){var n=e[a],s=document.createElement("tr"),h=document.createElement("td"),l=document.createElement("td");h.innerHTML=this._getOptionLabel(n.name),h.setAttribute(_ExportOptionEditor._optionNameAttr,n.name),l.appendChild(this._generateEditor(n)),s.appendChild(h),s.appendChild(l),o.appendChild(s)}return t.appendChild(o),t}_updateEditors(e){if("pdfACompatible"!==e&&e){if("paged"===e||!e){var t=this.hostElement.querySelector("["+_ExportOptionEditor._optionIdAttr+'="showNavigator"]');if(t){var r=wjcCore.changeType(this._getOptionValue("paged"),wjcCore.DataType.Boolean,null);r?(t.checked=this._previousShowNavigator,this._setOptionValue("showNavigator",this._previousShowNavigator)):(this._previousShowNavigator=t.checked,t.checked=!1,this._setOptionValue("showNavigator",!1)),t.disabled=!r}}}else{var i=this.hostElement.querySelector("["+_ExportOptionEditor._optionIdAttr+'="embedFonts"]');if(i){var o=wjcCore.changeType(this._getOptionValue("pdfACompatible"),wjcCore.DataType.Boolean,null);o?(this._previousEmbedFonts=i.checked,i.checked=!0,this._setOptionValue("embedFonts",!0)):(i.checked=this._previousEmbedFonts,this._setOptionValue("embedFonts",this._previousEmbedFonts)),i.disabled=o}}}_getOptionLabel(e){var t=this._optionLabelsText[e];return t||e[0].toUpperCase()+e.substring(1)}_getOptionDescByName(e){var t=null;return this._exportDescription.optionDescriptions.some(r=>r.name===e&&(t=r,!0)),t}_getOptionValue(e){return void 0!==this._options[e]?this._options[e]:this._getOptionDescByName(e).defaultValue}_setOptionValue(e,t){var r=this._getOptionDescByName(e),i=r.defaultValue;"unit"===r.type&&(i=r.defaultValue.toString()),t!==i?this._options[e]=t:void 0!==this._options[e]&&delete this._options[e]}get _optionLabelsText(){if(!this._optionLabels){let e=wjcCore.culture.Viewer;this._optionLabels={title:e.docInfoTitle,author:e.docInfoAuthor,manager:e.docInfoManager,operator:e.docInfoOperator,company:e.docInfoCompany,subject:e.docInfoSubject,comment:e.docInfoComment,creator:e.docInfoCreator,producer:e.docInfoProducer,creationTime:e.docInfoCreationTime,revisionTime:e.docInfoRevisionTime,keywords:e.docInfoKeywords,embedFonts:e.embedFonts,pdfACompatible:e.pdfACompatible,useCompression:e.useCompression,useOutlines:e.useOutlines,allowCopyContent:e.allowCopyContent,allowEditAnnotations:e.allowEditAnnotations,allowEditContent:e.allowEditContent,allowPrint:e.allowPrint,ownerPassword:e.ownerPassword,userPassword:e.userPassword,encryptionType:e.encryptionType,paged:e.paged,showNavigator:e.showNavigator,navigatorPosition:e.navigatorPosition,singleFile:e.singleFile,tolerance:e.tolerance,pictureLayer:e.pictureLayer,metafileType:e.metafileType,monochrome:e.monochrome,resolution:e.resolution,outputRange:e.outputRange,outputRangeInverted:e.outputRangeInverted}}return this._optionLabels}get _groupTitle(){return this._groupTitleField||(this._groupTitleField={documentRestrictions:wjcCore.culture.Viewer.documentRestrictionsGroup,passwordSecurity:wjcCore.culture.Viewer.passwordSecurityGroup,outputRange:wjcCore.culture.Viewer.outputRangeGroup,documentInfo:wjcCore.culture.Viewer.documentInfoGroup,general:wjcCore.culture.Viewer.generalGroup}),this._groupTitleField}_globalize(){for(var e=this.hostElement.querySelectorAll("["+_ExportOptionEditor._optionNameAttr+"]"),t=0;t<e.length;t++){var r=e[t];r instanceof HTMLLegendElement?r.innerHTML=this._groupTitle[r.getAttribute(_ExportOptionEditor._optionNameAttr)]:r.innerHTML=this._getOptionLabel(r.getAttribute(_ExportOptionEditor._optionNameAttr))}}refresh(e=!0){super.refresh(e),e&&(this._optionLabels=null,this._groupTitleField=null,this._globalize())}}_ExportOptionEditor._optionIdAttr="option-id",_ExportOptionEditor._optionNameAttr="option-name",_ExportOptionEditor._skippedOptions=["shapesWord2007Compatible","sheetName","navigatorPositions"],_ExportOptionEditor._generalGroupName="general",exports._ExportOptionEditor=_ExportOptionEditor;class _Toolbar extends wjcCore.Control{constructor(e){super(e),this._disposed=!1,this.svgButtonClicked=new wjcCore.Event;var t;t=this.getTemplate(),this.applyTemplate("wj-toolbar",t,{_toolbarWrapper:"toolbar-wrapper",_toolbarContainer:"toolbar-container",_toolbarLeft:"toolbar-left",_toolbarRight:"toolbar-right"}),_addEvent(this._toolbarLeft,"mouseover",()=>{this._scrollLeft()}),_addEvent(this._toolbarLeft,"mouseout",()=>{this._clearToolbarMoveTimer()}),_addEvent(this._toolbarRight,"mouseover",()=>{this._scrollRight()}),_addEvent(this._toolbarRight,"mouseout",()=>{this._clearToolbarMoveTimer()})}applyTemplate(e,t,r){var i=this.hostElement;if(wjcCore.addClass(i,e),i.appendChild(_toDOMs(t)),r)for(var o in r){var a=r[o];if(this[o]=i.querySelector('[wj-part="'+a+'"]'),null==this[o]&&i.getAttribute("wj-part")==a&&(this[o]=t),null==this[o])throw'Missing template part: "'+a+'"'}return i}dispose(){this._disposed=!0,super.dispose()}_clearToolbarMoveTimer(){null!=this._toolbarMoveTimer&&(clearTimeout(this._toolbarMoveTimer),this._toolbarMoveTimer=null)}_scrollRight(){var e=this._toolbarContainer.offsetWidth-this._toolbarWrapper.offsetWidth,t=this._toolbarWrapper.style,r=(t.left?parseInt(t.left):0)-_Toolbar._moveStep;this._checkMoveButtonEnabled(),r<e||(t.left=r+"px",this._toolbarMoveTimer=setTimeout(()=>this._scrollRight(),_Toolbar._moveInterval))}_scrollLeft(){var e=this._toolbarWrapper.style,t=(e.left?parseInt(e.left):0)+_Toolbar._moveStep;this._checkMoveButtonEnabled(),t>0||(e.left=t+"px",this._toolbarMoveTimer=setTimeout(()=>this._scrollLeft(),_Toolbar._moveInterval))}_checkMoveButtonEnabled(){var e=this._toolbarLeft.getBoundingClientRect().width,t=this._toolbarWrapper.offsetLeft-e+_Toolbar._moveStep,r=t<=0,i=wjcCore.hasClass(this._toolbarLeft,_Toolbar._enabledCss);r?i||wjcCore.addClass(this._toolbarLeft,_Toolbar._enabledCss):i&&wjcCore.removeClass(this._toolbarLeft,_Toolbar._enabledCss);var o=this._toolbarRight.getBoundingClientRect().width,a=this._toolbarContainer.getBoundingClientRect().width-this._toolbarWrapper.getBoundingClientRect().width,n=(t=this._toolbarWrapper.offsetLeft-o-_Toolbar._moveStep)>=a,s=wjcCore.hasClass(this._toolbarRight,_Toolbar._enabledCss);n?s||wjcCore.addClass(this._toolbarRight,_Toolbar._enabledCss):s&&wjcCore.removeClass(this._toolbarRight,_Toolbar._enabledCss)}_showToolbarMoveButton(e){var t=e?"visible":"hidden";this._toolbarLeft.style.visibility=t,this._toolbarRight.style.visibility=t,this._checkMoveButtonEnabled()}_globalize(){}resetWidth(){var e=this._toolbarLeft.getBoundingClientRect().width,t=this._toolbarRight.getBoundingClientRect().width,r=this.hostElement.getBoundingClientRect().width;this._toolbarContainer.style.width="1500px",this._toolbarWrapper.style.width="auto";var i=this._toolbarWrapper.getBoundingClientRect().width+2;this._toolbarWrapper.style.width=i+"px",this._toolbarContainer.style.width=r-e-t+"px";var o=e+t+i>r;this._showToolbarMoveButton(o),o||(this._toolbarWrapper.style.left="0px")}addSeparator(){var e=document.createElement("span");return e.className="wj-separator",this._toolbarWrapper.appendChild(e),e}onSvgButtonClicked(e){this.svgButtonClicked.raise(this,e)}addCustomItem(e,t){wjcCore.isString(e)&&(e=_toDOM(e)),null!=t&&e.setAttribute(exports._commandTagAttr,t.toString()),this._toolbarWrapper.appendChild(e)}addSvgButton(e,t,r,i){var o=_createSvgBtn(t);return o.title=e,o.setAttribute(exports._commandTagAttr,r.toString()),this._toolbarWrapper.appendChild(o),_addEvent(o,"click,keydown",e=>{var t=e||window.event;!("keydown"===t.type&&t.keyCode===wjcCore.Key.Enter||"click"===t.type)||_isDisabledImageButton(o)||!i&&_isCheckedImageButton(o)||this.onSvgButtonClicked({commandTag:r})}),o}refresh(e=!0){super.refresh(e),e&&this._globalize()}}_Toolbar._moveStep=4,_Toolbar._moveInterval=5,_Toolbar._enabledCss="enabled",_Toolbar.controlTemplate='<div class="wj-toolbar-move left" wj-part="toolbar-left"><span class="wj-glyph-left"></span></div><div class="wj-toolbarcontainer" wj-part="toolbar-container"><div class="wj-toolbarwrapper wj-btn-group" wj-part="toolbar-wrapper"></div></div><div class="wj-toolbar-move right" wj-part="toolbar-right"><span class="wj-glyph-right"></span></div>',exports._Toolbar=_Toolbar;class _ViewerToolbarBase extends _Toolbar{constructor(e,t){super(e),this._viewer=t,this._initToolbarItems();var r=()=>this.isDisabled=!this._viewer._getDocumentSource();this._viewer._documentSourceChanged.addHandler(r),r(),this._viewer._viewerActionStatusChanged.addHandler((e,t)=>{var r=t.action,i=this.hostElement.querySelector('[command-tag="'+r.actionType.toString()+'"]');_checkImageButton(i,r.checked),_disableImageButton(i,r.disabled),_showImageButton(i,r.shown),_checkSeparatorShown(this._toolbarWrapper)})}_initToolbarItems(){throw wjcCore.culture.Viewer.abstractMethodException}onSvgButtonClicked(e){super.onSvgButtonClicked(e),this._viewer._executeAction(parseInt(e.commandTag))}get viewer(){return this._viewer}static _initToolbarZoomValue(e,t){var r,i,o,a,n=wjcCore.Control.getControl(e),s=document.createElement("div"),h=ViewerBase._defaultZoomValues;s.className="wj-input-zoom",n.addCustomItem(s,_ViewerActionType.ZoomValue),(r=new wjcInput.ComboBox(s)).deferUpdate(()=>{for(o=0;o<h.length;o++)for(a=o+1;a<h.length;a++)h[o].value>h[a].value&&(i=h[o],h[o]=h[a],h[a]=i);r.itemsSource=h,r.isEditable=!0,r.displayMemberPath="name",r.selectedValuePath="value",r.selectedValue=1}),r.selectedIndexChanged.addHandler(()=>{if(r.isDroppedDown){var e=r.selectedValue;if(null==e){var i=r.text.replace(",","");e=parseFloat(i),isNaN(e)&&(e=100),e*=.01}t.zoomFactor=e}}),_addEvent(s,"keypress",e=>{var i,o=e||window.event,a=r.text;o.keyCode===wjcCore.Key.Enter&&(a.lastIndexOf("%")===a.length-1&&(a=a.substring(0,r.text.length-1)),a=a.replace(",",""),i=parseFloat(a),isNaN(i)?r.text=wjcCore.Globalize.format(t.zoomFactor,"p0"):(wjcCore.setSelectionRange(r.inputElement,0,0),t.zoomFactor=.01*i))}),_addEvent(s.querySelector(".wj-form-control"),"blur",e=>{r.text=wjcCore.Globalize.format(t.zoomFactor,"p0")}),t.zoomFactorChanged.addHandler(()=>{r.isDroppedDown=!1,r.text=wjcCore.Globalize.format(t.zoomFactor,"p0")})}static _initToolbarPageNumberInput(e,t){var r,i=wjcCore.Control.getControl(e),o=document.createElement("div"),a=document.createElement("span"),n=()=>{var e=t._getDocumentSource();e&&null!=e.pageCount&&(r.value=t.pageIndex+1)},s=()=>{var e=t._getDocumentSource();e&&null!=e.pageCount&&(a.innerHTML=e.pageCount.toString(),r.max=e.pageCount,r.min=Math.min(e.pageCount,1),n())},h=()=>{var e=t._getDocumentSource();e&&(s(),_addWjHandler(t._documentEventKey,e.pageCountChanged,s),_addWjHandler(t._documentEventKey,e.loadCompleted,s))};o.className="wj-pagenumber",i.addCustomItem(o,_ViewerActionType.PageNumber),(r=new wjcInput.InputNumber(o)).format="n0",_addEvent(o,"keyup",e=>{(e||window.event).keyCode===wjcCore.Key.Enter&&t.moveToPage(r.value-1)}),_addEvent(r.inputElement,"blur",e=>{t.moveToPage(r.value-1)}),i.addCustomItem('<span class="slash">/</span>'),a.className="wj-pagecount",i.addCustomItem(a,_ViewerActionType.PageCountLabel),t.pageIndexChanged.addHandler(n),t._getDocumentSource()&&h(),t._documentSourceChanged.addHandler(h)}}exports._ViewerToolbarBase=_ViewerToolbarBase;class _ViewerToolbar extends _ViewerToolbarBase{constructor(e,t){super(e,t)}_globalize(){let e=wjcCore.culture.Viewer;this._gPaginated.title=e.paginated,this._gPrint.title=e.print,this._gExports.title=e.exports,this._gPortrait.title=e.portrait,this._gLandscape.title=e.landscape,this._gPageSetup.title=e.pageSetup,this._gFirstPage.title=e.firstPage,this._gPreviousPage.title=e.previousPage,this._gNextPage.title=e.nextPage,this._gLastPage.title=e.lastPage,this._gBackwardHistory.title=e.backwardHistory,this._gForwardHistory.title=e.forwardHistory,this._gSelectTool.title=e.selectTool,this._gMoveTool.title=e.moveTool,this._gContinuousMode.title=e.continuousMode,this._gSingleMode.title=e.singleMode,this._gWholePage.title=e.wholePage,this._gPageWidth.title=e.pageWidth,this._gZoomOut.title=e.zoomOut,this._gZoomIn.title=e.zoomIn,this._gRubberbandTool.title=e.rubberbandTool,this._gMagnifierTool.title=e.magnifierTool,this._gRotateDocument.title=e.rotateDocument,this._gRotatePage.title=e.rotatePage,this._gFullScreen.title=e.fullScreen}_initToolbarItems(){let e=wjcCore.culture.Viewer;this._gPaginated=this.addSvgButton(e.paginated,exports.icons.paginated,_ViewerActionType.TogglePaginated,!0),this._gPrint=this.addSvgButton(e.print,exports.icons.print,_ViewerActionType.Print),this._gExports=this.addSvgButton(e.exports,exports.icons.exports,_ViewerActionType.ShowExportsPanel),this.addSeparator(),this._gPortrait=this.addSvgButton(e.portrait,exports.icons.portrait,_ViewerActionType.Portrait),this._gLandscape=this.addSvgButton(e.landscape,exports.icons.landscape,_ViewerActionType.Landscape),this._gPageSetup=this.addSvgButton(e.pageSetup,exports.icons.pageSetup,_ViewerActionType.ShowPageSetupDialog),this.addSeparator(),this._gFirstPage=this.addSvgButton(e.firstPage,exports.icons.firstPage,_ViewerActionType.FirstPage),this._gPreviousPage=this.addSvgButton(e.previousPage,exports.icons.previousPage,_ViewerActionType.PrePage),this._gNextPage=this.addSvgButton(e.nextPage,exports.icons.nextPage,_ViewerActionType.NextPage),this._gLastPage=this.addSvgButton(e.lastPage,exports.icons.lastPage,_ViewerActionType.LastPage),_ViewerToolbarBase._initToolbarPageNumberInput(this.hostElement,this.viewer),this.addSeparator(),this._gBackwardHistory=this.addSvgButton(e.backwardHistory,exports.icons.backwardHistory,_ViewerActionType.Backward),this._gForwardHistory=this.addSvgButton(e.forwardHistory,exports.icons.forwardHistory,_ViewerActionType.Forward),this.addSeparator(),this._gSelectTool=this.addSvgButton(e.selectTool,exports.icons.selectTool,_ViewerActionType.SelectTool),this._gMoveTool=this.addSvgButton(e.moveTool,exports.icons.moveTool,_ViewerActionType.MoveTool),this._gContinuousMode=this.addSvgButton(e.continuousMode,exports.icons.continuousView,_ViewerActionType.Continuous),this._gSingleMode=this.addSvgButton(e.singleMode,exports.icons.singleView,_ViewerActionType.Single),this.addSeparator(),this._gWholePage=this.addSvgButton(e.wholePage,exports.icons.fitWholePage,_ViewerActionType.FitWholePage),this._gPageWidth=this.addSvgButton(e.pageWidth,exports.icons.fitPageWidth,_ViewerActionType.FitPageWidth),this._gZoomOut=this.addSvgButton(e.zoomOut,exports.icons.zoomOut,_ViewerActionType.ZoomOut),this._gZoomIn=this.addSvgButton(e.zoomIn,exports.icons.zoomIn,_ViewerActionType.ZoomIn),this._gRubberbandTool=this.addSvgButton(e.rubberbandTool,exports.icons.rubberbandTool,_ViewerActionType.RubberbandTool),this._gMagnifierTool=this.addSvgButton(e.magnifierTool,exports.icons.magnifierTool,_ViewerActionType.MagnifierTool),this._gRotateDocument=this.addSvgButton(e.rotateDocument,exports.icons.rotateDocument,_ViewerActionType.RotateDocument),this._gRotatePage=this.addSvgButton(e.rotatePage,exports.icons.rotatePage,_ViewerActionType.RotatePage),_ViewerToolbarBase._initToolbarZoomValue(this.hostElement,this.viewer),this._gFullScreen=this.addSvgButton(e.fullScreen,exports.icons.fullScreen,_ViewerActionType.ToggleFullScreen,!0)}}exports._ViewerToolbar=_ViewerToolbar;class _ViewerMiniToolbar extends _ViewerToolbarBase{constructor(e,t){super(e,t)}_initToolbarItems(){let e=wjcCore.culture.Viewer;this._gPrint=this.addSvgButton(e.print,exports.icons.print,_ViewerActionType.Print),this.addSeparator(),this._gPreviousPage=this.addSvgButton(e.previousPage,exports.icons.previousPage,_ViewerActionType.PrePage),this._gNextPage=this.addSvgButton(e.nextPage,exports.icons.nextPage,_ViewerActionType.NextPage),_ViewerToolbarBase._initToolbarPageNumberInput(this.hostElement,this.viewer),this.addSeparator(),this._gZoomOut=this.addSvgButton(e.zoomOut,exports.icons.zoomOut,_ViewerActionType.ZoomOut),this._gZoomIn=this.addSvgButton(e.zoomIn,exports.icons.zoomIn,_ViewerActionType.ZoomIn),this._gExitFullScreen=this.addSvgButton(e.exitFullScreen,exports.icons.exitFullScreen,_ViewerActionType.ToggleFullScreen,!0)}_globalize(){var e=wjcCore.culture.Viewer;this._gPrint.title=e.print,this._gPreviousPage.title=e.previousPage,this._gNextPage.title=e.nextPage,this._gZoomOut.title=e.zoomOut,this._gZoomIn.title=e.zoomIn,this._gExitFullScreen.title=e.exitFullScreen}}exports._ViewerMiniToolbar=_ViewerMiniToolbar;class _ViewerMobileToolbarBase extends _ViewerToolbarBase{constructor(e,t){super(e,t),wjcCore.addClass(this.hostElement,"mobile")}}exports._ViewerMobileToolbarBase=_ViewerMobileToolbarBase;class _ViewerMobileToolbar extends _ViewerMobileToolbarBase{constructor(e,t){super(e,t)}_initToolbarItems(){let e=wjcCore.culture.Viewer;this._gShowHamburgerMenu=this.addSvgButton(e.hamburgerMenu,exports.icons.hamburgerMenu,_ViewerActionType.ShowHamburgerMenu),this.viewer._initHamburgerMenu(this._gShowHamburgerMenu),this._gPrevPage=this.addSvgButton(e.previousPage,exports.icons.previousPage,_ViewerActionType.PrePage),this._gNextPage=this.addSvgButton(e.nextPage,exports.icons.nextPage,_ViewerActionType.NextPage),_ViewerToolbarBase._initToolbarPageNumberInput(this.hostElement,this.viewer),this._gShowViewMenu=this.addSvgButton(e.viewMenu,exports.icons.viewMenu,_ViewerActionType.ShowViewMenu),this.viewer._initViewMenu(this._gShowViewMenu),this._gShowSearchBar=this.addSvgButton(e.showSearchBar,exports.icons.search,_ViewerActionType.ShowSearchBar,!0),this._gFullScreen=this.addSvgButton(e.fullScreen,exports.icons.fullScreen,_ViewerActionType.ToggleFullScreen,!0)}_globalize(){let e=wjcCore.culture.Viewer;this._gShowHamburgerMenu.title=e.hamburgerMenu,this._gPrevPage.title=e.previousPage,this._gNextPage.title=e.nextPage,this._gShowViewMenu.title=e.viewMenu,this._gShowSearchBar.title=e.showSearchBar,this._gFullScreen.title=e.fullScreen}}exports._ViewerMobileToolbar=_ViewerMobileToolbar;class _ViewerZoomBar extends _ViewerMobileToolbarBase{constructor(e,t){super(e,t),wjcCore.addClass(this.hostElement,"wj-zoombar")}_initToolbarItems(){let e=wjcCore.culture.Viewer;this._gZoomOut=this.addSvgButton(e.zoomOut,exports.icons.zoomOut,_ViewerActionType.ZoomOut),_ViewerToolbarBase._initToolbarZoomValue(this.hostElement,this.viewer),this._gZoomIn=this.addSvgButton(e.zoomIn,exports.icons.zoomIn,_ViewerActionType.ZoomIn)}_globalize(){let e=wjcCore.culture.Viewer;this._gZoomOut.title=e.zoomOut,this._gZoomIn.title=e.zoomIn}}exports._ViewerZoomBar=_ViewerZoomBar;class _SearchBar extends _ViewerMobileToolbarBase{constructor(e,t){super(e,t)}_initToolbarItems(){let e=wjcCore.culture.Viewer;this._gSearchOptions=this.addSvgButton(e.searchOptions,exports.icons.searchOptions,_ViewerActionType.ShowSearchOptions),this.viewer._initSearchOptionsMenu(this._gSearchOptions),this._initSearchInput(),this._initSearchBtnGroups()}_initSearchInput(){var e=_toDOM('<div class="wj-searchcontainer"><input class="wj-searchbox" wj-part="search-box" type="text"/><div class="wj-btn-group"><button class="wj-btn wj-btn-search">'+_createSvgBtn(exports.icons.search).innerHTML+"</button></div></div>"),t=e.querySelector('input[type="text"]'),r=e.querySelector(".wj-btn-search");_addEvent(t,"input",()=>{this.viewer._searchManager.text=t.value}),_addEvent(r,"click",()=>{this.viewer._searchManager.search()}),this.viewer._searchManager.searchStarted.addHandler(()=>{t.disabled=!0}),this.viewer._searchManager.searchCompleted.addHandler(()=>{t.disabled=!1}),this.addCustomItem(e)}_initSearchBtnGroups(){var e=_toDOM('<div class="wj-searchbtn-groups wj-btn-group wj-toolbarwrapper"></div>');let t=wjcCore.culture.Viewer;this._gSearchPrev=this.addSvgButton(t.searchPrev,exports.icons.searchLeft,_ViewerActionType.SearchPrev),this._gSearchNext=this.addSvgButton(t.searchNext,exports.icons.searchRight,_ViewerActionType.SearchNext),e.appendChild(this._gSearchPrev),e.appendChild(this._gSearchNext),this.addCustomItem(e)}_globalize(){let e=wjcCore.culture.Viewer;this._gSearchOptions.title=e.searchOptions,this._gSearchPrev.title=e.searchPrev,this._gSearchNext.title=e.searchNext}}exports._SearchBar=_SearchBar;var _RotateAngle;!function(e){e[e.NoRotate=0]="NoRotate",e[e.Rotation90=1]="Rotation90",e[e.Rotation180=2]="Rotation180",e[e.Rotation270=3]="Rotation270"}(_RotateAngle=exports._RotateAngle||(exports._RotateAngle={}));class _Page{constructor(e,t,r){this._content=null,this._rotateAngle=_RotateAngle.NoRotate,this.linkClicked=new wjcCore.Event,this._documentSource=e,this._index=t,this._size=r}get index(){return this._index}get size(){return this._size}get rotateAngle(){return this._rotateAngle}set rotateAngle(e){this._rotateAngle=e}get content(){return this._content}getContent(){var e=new _Promise,t=this._documentSource;return t?this._content?(e.resolve(this._content),e):(t.renderToFilter({format:"html",paged:t.paginated,outputRange:(this.index+1).toString()}).then(r=>{if(this._documentSource===t){var i=document.createElement("div");i.innerHTML=this._processSvgResponse(this._addGlobalUniqueId(r.responseText));for(var o=i.querySelector("svg"),a=document.createElementNS("http://www.w3.org/2000/svg","g");o.hasChildNodes();)a.appendChild(o.firstChild);o.appendChild(a),this._size={width:new _Unit(o.width.baseVal.value),height:new _Unit(o.height.baseVal.value)},this._content=o,this._processActionLinks(o,e=>{_addEvent(e,"click",()=>{this._onLinkClicked(new _LinkClickedEventArgs(e))})}),e.resolve(this._content)}}),e):(e.reject(wjcCore.culture.Viewer.cannotRenderPageNoDoc),e)}_processSvgResponse(e){return e}_extractSize(e){if(e){var t=e.querySelector("svg");if(t)return{width:new _Unit(t.width.baseVal.value),height:new _Unit(t.height.baseVal.value)}}return null}_onLinkClicked(e){this.linkClicked.raise(this,e)}_processActionLinks(e,t){for(var r=e.querySelectorAll("a"),i=0;i<r.length;i++){var o=r.item(i),a=o.href?o.href.baseVal:"";if(a.indexOf("navigate")>0){var n=_Page._bookmarkReg.exec(a);n&&(n[1]&&n[1].length>0?(o.href.baseVal=_Page._invalidHref,o.setAttribute(_Page._bookmarkAttr,n[1]),t(o)):o.removeAttribute("xlink:href"))}else _Page._customActionReg.test(a)&&(o.href.baseVal=_Page._invalidHref,o.setAttribute(_Page._customActionAttr,a.substr(3)),t(o))}}_addGlobalUniqueId(e){var t=(new Date).getTime().toString();return e=e.replace(_Page._idReg,"$1$2"+t+"$3$4"),e=e.replace(_Page._idReferReg,"$1$2"+t+"$3$4")}}_Page._bookmarkReg=/javascript\:navigate\(['|"](.*)['|"]\)/,_Page._bookmarkAttr="bookmark",_Page._customActionReg=/^CA\:/,_Page._customActionAttr="customAction",_Page._idReg=/(\<[^\>]+)(id=['|"])(\w+)(['|"])/g,_Page._idReferReg=/(\<[^\>]+)(url\(#)(\w+)(\))/g,_Page._invalidHref="javascript:void(0)",exports._Page=_Page;class _CompositePageView extends wjcCore.Control{constructor(e){super(e),this._viewMode=ViewMode.Single,this.pageIndexChanged=new wjcCore.Event,this.zoomFactorChanged=new wjcCore.Event,this.zoomModeChanged=new wjcCore.Event,this.positionChanged=new wjcCore.Event,this.rotateAngleChanged=new wjcCore.Event;var t;t=this.getTemplate(),this.applyTemplate("wj-viewpanel-container",t,{_singlePageView:"single-pageview",_continuousPageView:"continuous-pageview"}),this._initPageView()}applyTemplate(e,t,r){var i=this.hostElement;if(wjcCore.addClass(i,e),i.appendChild(_toDOMs(t)),r)for(var o in r){var a=r[o];if(this[o]=i.querySelector('[wj-part="'+a+'"]'),null==this[o]&&i.getAttribute("wj-part")==a&&(this[o]=t),null==this[o])throw'Missing template part: "'+a+'"'}return i}get pageIndex(){return this._activePageView.pageIndex}get pages(){return this._activePageView.pages}set pages(e){this._activePageView.pages=e}get zoomMode(){return this._activePageView.zoomMode}set zoomMode(e){this._activePageView.zoomMode=e}get zoomFactor(){return this._activePageView.zoomFactor}set zoomFactor(e){this._activePageView.zoomFactor=e}get panMode(){return this._activePageView.panMode}set panMode(e){this._activePageView.panMode=e}get viewMode(){return this._viewMode}set viewMode(e){this._viewMode!==e&&(this._viewMode=e,this._updateActivePageView())}get scrollTop(){return this._activePageView.scrollTop}get scrollLeft(){return this._activePageView.scrollLeft}get _activePageViewElement(){return this.viewMode===ViewMode.Single?this._singlePageView:this._continuousPageView}onPageIndexChanged(){this.pageIndexChanged.raise(this)}onZoomFactorChanged(e,t){this.zoomFactorChanged.raise(this,{oldValue:e,newValue:t})}onZoomModeChanged(e,t){this.zoomModeChanged.raise(this,{oldValue:e,newValue:t})}onPositionChanged(){this.positionChanged.raise(this)}onRotateAngleChanged(){this.rotateAngleChanged.raise(this)}_updateActivePageView(){var e=this._activePageView.pageIndex,t=this._activePageView.pages,r=this._activePageView.zoomFactor,i=this._activePageView.zoomMode,o=this._activePageView.panMode;this._removePageViewHandlers(this._activePageView),this._activePageView=wjcCore.Control.getControl(this._activePageViewElement),this._addPageViewHandlers(this._activePageView),this._activePageView.pages||(this._activePageView.pages=t),this._activePageView.invalidate(),this._activePageView.moveToPage(e),this._activePageView.zoomFactor=r,this._activePageView.zoomMode=i,this._activePageView.panMode=o,this._updatePageViewsVisible()}_initPageView(){this._activePageView=new _SinglePageView(this._singlePageView),this._addPageViewHandlers(this._activePageView),new _ContinuousPageView(this._continuousPageView),this._updatePageViewsVisible()}_addPageViewHandlers(e){this._activePageView.pageIndexChanged.addHandler(()=>{this.onPageIndexChanged()}),this._activePageView.zoomFactorChanged.addHandler((e,t)=>{this.onZoomFactorChanged(t.oldValue,t.newValue)}),this._activePageView.zoomModeChanged.addHandler((e,t)=>{this.onZoomModeChanged(t.oldValue,t.newValue)}),this._activePageView.positionChanged.addHandler(()=>{this.onPositionChanged()}),this._activePageView.rotateAngleChanged.addHandler(()=>{this.onRotateAngleChanged()})}_removePageViewHandlers(e){e.pageIndexChanged.removeHandler(this.onPageIndexChanged,this),e.zoomFactorChanged.removeHandler(this.onZoomFactorChanged,this),e.zoomModeChanged.removeHandler(this.onZoomModeChanged,this),e.positionChanged.removeHandler(this.onPositionChanged,this),e.rotateAngleChanged.removeHandler(this.onRotateAngleChanged,this)}_updatePageViewsVisible(){this.viewMode===ViewMode.Single?(wjcCore.removeClass(this._singlePageView,exports._hiddenCss),wjcCore.hasClass(this._continuousPageView,exports._hiddenCss)||wjcCore.addClass(this._continuousPageView,exports._hiddenCss)):(wjcCore.removeClass(this._continuousPageView,exports._hiddenCss),wjcCore.hasClass(this._singlePageView,exports._hiddenCss)||wjcCore.addClass(this._singlePageView,exports._hiddenCss))}moveToPage(e){return this._activePageView.moveToPage(e)}moveToPosition(e){return this._activePageView.moveToPosition(e)}rotatePageTo(e,t){this._activePageView.rotatePageTo(e,t)}hitTest(e,t){return this._activePageView.hitTest(e,t)}resetPages(){wjcCore.Control.getControl(this._singlePageView).resetPages(),wjcCore.Control.getControl(this._continuousPageView).resetPages()}refresh(e=!0){super.refresh(e),wjcCore.Control.getControl(this._activePageViewElement).invalidate(),this._activePageView.refresh()}isPageContentLoaded(e){return this._activePageView.isPageContentLoaded(e)}}_CompositePageView.controlTemplate='<div class="wj-pageview" wj-part="single-pageview"></div><div class="wj-pageview" wj-part="continuous-pageview"></div>',exports._CompositePageView=_CompositePageView;class _PageViewBase extends wjcCore.Control{constructor(e){super(e),this._autoHeightCalculated=!1,this._startX=null,this._startY=null,this._panMode=!1,this._pageIndex=-1,this._zoomFactor=1,this._zoomMode=ZoomMode.Custom,this._zoomModeUpdating=!1,this.pageIndexChanged=new wjcCore.Event,this.zoomFactorChanged=new wjcCore.Event,this.zoomModeChanged=new wjcCore.Event,this.positionChanged=new wjcCore.Event,this.rotateAngleChanged=new wjcCore.Event;var t;t=this.getTemplate(),this.applyTemplate("wj-pageview",t,this._getTemplateParts()),this._fBorderBoxMode="border-box"===getComputedStyle(e).boxSizing,this._init()}_getTemplateParts(){return{_pagesWrapper:"pages-wrapper"}}_getPagesContainer(){return this.hostElement}_init(){this._bindEvents()}dispose(){this._touchManager&&this._touchManager.dispose(),super.dispose()}_bindTouchEvents(e){e.touchStart.addHandler(()=>{this.hostElement.focus()}),e.panMove.addHandler((t,r)=>{e.hostElement.scrollTop-=r.clientDelta.y,e.hostElement.scrollLeft-=r.clientDelta.x}),e.pinch.addHandler(this._zoomByPinch,this)}_initTouchEvents(){var e=this._pagesWrapper.parentElement,t=new _TouchManager(e);this._touchManager=t,this._bindTouchEvents(t)}get _borderBoxMode(){return this._fBorderBoxMode}_zoomByPinch(e,t){if(t.preventDefault(),t.type==_TouchEventType.Move){var r=wjcCore.getElementRect(e.contentElement),i=getComputedStyle(e.contentElement),o=parseInt(i.marginTop),a=parseInt(i.marginLeft),n=_pointMove(!1,t.preCenterClient,r.left-a,r.top-o);this._zoom(e.hostElement,t.zoom,n,t.centerClientDelta)}}_getFixedPosition(e){return new wjcCore.Point(_PageViewBase._pageMargin,_PageViewBase._pageMargin+this._getAbovePageCount(e.y)*_PageViewBase._pageMargin)}_getAbovePageCount(e){return 0}_zoom(e,t,r,i){var o=_pointMove(!1,r,e.scrollLeft,e.scrollTop),a=this._getFixedPosition(r),n=this.zoomFactor;this.zoomFactor=this.zoomFactor*t;var s=this.zoomFactor/n,h=_pointMove(!1,new wjcCore.Point((r.x-a.x)*s+a.x,(r.y-a.y)*s+a.y),_pointMove(!0,o,i));e.scrollTop=Math.round(h.y),e.scrollLeft=Math.round(h.x)}get pageIndex(){return this._pageIndex}get pages(){return this._pages}set pages(e){this._pages=e,this._reserveViewPage()}get scrollTop(){return this.hostElement.scrollTop}get scrollLeft(){return this.hostElement.scrollLeft}get zoomFactor(){return this._zoomFactor}set zoomFactor(e){if(e=Math.max(.05,Math.min(10,e)),this._zoomFactor!=e){var t=this._zoomFactor;this._zoomFactor=e,this._updatePageViewTransform(),this._zoomModeUpdating||(this.zoomMode=ZoomMode.Custom),this._onZoomFactorChanged(t,e)}}get zoomMode(){return this._zoomMode}set zoomMode(e){if(this._zoomMode!=e){this._zoomModeUpdating=!0;var t=this._zoomMode;this._calcZoomModeZoom(e),this._zoomMode=e,this._onZoomModeChanged(t,e),this._zoomModeUpdating=!1}}get panMode(){return this._panMode}set panMode(e){this._panMode!=e&&(this._panMode=e)}_bindEvents(){_addEvent(document,"mousemove",e=>{null!==this._startX&&null!==this._startY&&this._panning(e)}),_addEvent(document,"mouseup",e=>{this._stopPanning()}),this._initTouchEvents()}_startPanning(e){this._startX=e.screenX,this._startY=e.screenY}_panning(e){var t=this._getPagesContainer();t.scrollLeft+=this._startX-e.screenX,t.scrollTop+=this._startY-e.screenY,this._startX=e.screenX,this._startY=e.screenY}_stopPanning(){this._startX=null,this._startY=null}_onPageIndexChanged(){this.pageIndexChanged.raise(this)}_onZoomFactorChanged(e,t){this.zoomFactorChanged.raise(this,{oldValue:e,newValue:t})}_onZoomModeChanged(e,t){this.zoomModeChanged.raise(this,{oldValue:e,newValue:t})}_onPositionChanged(){this.positionChanged.raise(this)}_onRotateAngleChanged(){this.rotateAngleChanged.raise(this)}_onPageLoaded(e){}_renderViewPage(e,t){var r,i=new _Promise;if(t=t<0?0:t,!e)return i.reject(wjcCore.culture.Viewer.cannotRenderPageNoViewPage),i;if(_removeChildren(e),this._pages[t].content){var o=this._pages[t].content;return e.appendChild(o),this._setPageTransform(e,t),i.resolve(t),i}return r=document.createElement("div"),r.className="wj-loading",r.style.height=e.style.height,r.style.lineHeight=e.style.height,r.innerHTML=wjcCore.culture.Viewer.loading,e.appendChild(r),this._pages[t].getContent().then(r=>{if(this.pages){var o=r;_removeChildren(e),e.appendChild(o),this._setPageTransform(e,t),this._onPageLoaded(t),i.resolve(t)}}).catch(e=>{r.innerHTML=_getErrorMessage(e)}),i}_reserveViewPage(){throw wjcCore.culture.Viewer.abstractMethodException}_getViewPortHeight(){var e=this._pagesWrapper.currentStyle||window.getComputedStyle(this._pagesWrapper);return this.hostElement.offsetHeight-parseFloat(e.marginBottom)-parseFloat(e.marginTop)}_getViewPortWidth(){var e=this._pagesWrapper.currentStyle||window.getComputedStyle(this._pagesWrapper);return this.hostElement.offsetWidth-parseFloat(e.marginLeft)-parseFloat(e.marginRight)}_setPageTransform(e,t){var r;if(e&&!(t<0)){var i=this._getPageSize(t),o=this._pages[t].rotateAngle;e.style.height=i.height.valueInPixel*this._zoomFactor+"px",e.style.width=i.width.valueInPixel*this._zoomFactor+"px",(r=e.querySelector("g"))&&(r.parentNode.setAttribute("height",i.height.valueInPixel*this._zoomFactor+"px"),r.parentNode.setAttribute("width",i.width.valueInPixel*this._zoomFactor+"px"),_transformSvg(r.parentNode,this._pages[t].size.width.valueInPixel,this._pages[t].size.height.valueInPixel,this._zoomFactor,o))}}_addViewPage(){var e=document.createElement("div");return e.className="wj-view-page",_addEvent(e,"mousedown",e=>{this._panMode&&this._startPanning(e)}),_addEvent(e,"dragstart",e=>{this._panMode&&e.preventDefault()}),this._pagesWrapper.appendChild(e),e}_getPageSize(e){if(e<0||e>=this._pages.length)return null;var t=this._pages[e];return _getRotatedSize(t.size,t.rotateAngle)}_render(e){throw wjcCore.culture.Viewer.abstractMethodException}_moveToPagePosition(e){throw wjcCore.culture.Viewer.abstractMethodException}_updatePageViewTransform(){throw wjcCore.culture.Viewer.abstractMethodException}_updatePageIndex(e){this.pages&&(e=this.resolvePageIndex(e),this._pageIndex!==e&&(this._pageIndex=e,this._onPageIndexChanged()))}moveToPage(e){return this.moveToPosition({pageIndex:e})}resolvePageIndex(e){return Math.min((this.pages||[]).length-1,Math.max(e,0))}moveToPosition(e){var t=e.pageIndex||0,r=new _Promise,i=this.pageIndex;return!this.pages||t<0?(r.resolve(t),r):(t=this.resolvePageIndex(t),e.pageIndex=t,t!==i?(this._updatePageIndex(t),r=this._render(t)):r.resolve(t),r.then(()=>{this.pages&&(e.samePage=t===i,this._moveToPagePosition(e))}),r.then(e=>t).then(()=>{this._calcZoomModeZoom(),this._onPositionChanged()}))}_calcZoomModeZoom(e){switch(this._zoomModeUpdating=!0,e=null==e?this.zoomMode:e){case ZoomMode.PageWidth:this._zoomToViewWidth();break;case ZoomMode.WholePage:this._zoomToView()}this._zoomModeUpdating=!1}_zoomToView(){var e=this._getViewPortHeight(),t=this._getViewPortWidth(),r=this._getPageSize(this.pageIndex);r&&(this.zoomFactor=Math.min(e/r.height.valueInPixel,t/r.width.valueInPixel))}_zoomToViewWidth(){throw wjcCore.culture.Viewer.abstractMethodException}_getTransformedPoint(e,t,r){t/=this.zoomFactor,r/=this.zoomFactor;var i=this.pages[e],o=i.size;switch(i.rotateAngle){case _RotateAngle.Rotation90:a=t;t=o.height.valueInPixel-r,r=a;break;case _RotateAngle.Rotation180:t=o.height.valueInPixel-t,r=o.width.valueInPixel-r;break;case _RotateAngle.Rotation270:var a=t;t=r,r=o.width.valueInPixel-a}return new wjcCore.Point(r,t)}_hitTestPagePosition(e){if(!e||e.pageIndex<0)return null;var t=e.y,r=e.x,i=e.pageIndex;t-=_PageViewBase._pageMargin+_PageViewBase._pageBorderWidth,r-=_PageViewBase._pageMargin+_PageViewBase._pageBorderWidth;var o=this._getTransformedPoint(e.pageIndex,t,r);t=o.y,r=o.x;var a=_pixelToTwip(t),n=_pixelToTwip(r),s=this.pages[i].size;return{pageIndex:i,x:n,y:a,hitWorkingArea:t>=0&&t<=s.height.valueInPixel&&r>=0&&r<=s.width.valueInPixel}}rotatePageTo(e,t){this._pages[e].rotateAngle=t,this._updatePageViewTransform(),this._onRotateAngleChanged()}hitTest(e,t){if(this._pointInViewPanelClientArea(e,t)){var r=this._panelViewPntToPageView(e,t);return this._hitTestPagePosition(r)}return null}resetPages(){this._pageIndex=-1,this._pages=null,_removeChildren(this._pagesWrapper),this._addViewPage(),this.invalidate()}refresh(e=!0){super.refresh(e),this._autoHeightCalculated=!1,!this.pages||0==this.pages.length||this.pageIndex<0||this.pageIndex>=this.pages.length||(this._render(this.pageIndex),this._calcZoomModeZoom())}isPageContentLoaded(e){var t=this.pages;return!!t&&e>=0&&e<t.length&&!!t[e].content}_hitTestPageIndex(e){throw wjcCore.culture.Viewer.abstractMethodException}_pointInViewPanelClientArea(e,t){throw wjcCore.culture.Viewer.abstractMethodException}_panelViewPntToPageView(e,t){throw wjcCore.culture.Viewer.abstractMethodException}}_PageViewBase._pageMargin=30,_PageViewBase._pageBorderWidth=1,_PageViewBase.controlTemplate='<div class="wj-pages-wrapper" wj-part="pages-wrapper"></div>',exports._PageViewBase=_PageViewBase;class _Scroller extends wjcCore.Control{static getScrollbarWidth(e){var t,r;return _Scroller._scrollbarWidth&&!e||((t=document.createElement("div")).style.width="50px",t.style.height="50px",t.style.overflow="auto",document.body.appendChild(t),(r=document.createElement("div")).style.height="60px",t.appendChild(r),_Scroller._scrollbarWidth=t.offsetWidth-t.clientWidth,document.body.removeChild(t)),_Scroller._scrollbarWidth}}_Scroller._scrollbarWidth=null,exports._Scroller=_Scroller;class _VScroller extends _Scroller{constructor(e){super(e),this._height=100,this._max=100,this._desiredValue=0,this.valueChanged=new wjcCore.Event;var t;t=this.getTemplate(),this.applyTemplate(null,t,{_wrapper:"wrapper"}),this.hostElement.style.width=_Scroller.getScrollbarWidth()+1+"px",_addEvent(this.hostElement,"scroll",()=>{this.onValueChanged()})}onValueChanged(){this._desiredValue!=this.value&&this.valueChanged.raise(this)}preventScrollEvent(){this._desiredValue=this.hostElement.scrollTop}get height(){return this._height}set height(e){e!==this._height&&(this._height=e,this.invalidate())}get value(){return this.hostElement.scrollTop}set value(e){this.hostElement.scrollTop=e,this.preventScrollEvent()}get max(){return this._max}set max(e){this._max!==e&&(this._max=e,this.invalidate())}refresh(e=!0){super.refresh(e);var t=this._height+"px";this.hostElement.style.height!==t&&(this.hostElement.style.height=t);var r=this._max+this.hostElement.clientHeight+"px";this._wrapper.style.height!==r&&(this._wrapper.style.height=r),this.preventScrollEvent()}}_VScroller.controlTemplate='<div class="wj-vscroller-wrapper" wj-part="wrapper"></div>',exports._VScroller=_VScroller;class _SinglePageView extends _PageViewBase{constructor(e){super(e),this._innerNavigating=!1,this._virtualScrollMode=!0,wjcCore.addClass(e,"wj-pageview-single")}_init(){super._init(),this._initScroller(),this._initEvents()}_initScroller(){new _VScroller(this._vscroller).valueChanged.addHandler(()=>{setTimeout(()=>this._doScrollerValueChanged())})}_initEvents(){_addEvent(this._pagesContainer,"wheel",e=>{this._doContainerWheel(e)}),_addEvent(this._pagesContainer,"scroll",e=>{this._doContainerScroll()}),_addEvent(this._pagesContainer,"keydown",e=>{this._doContainerKeyDown()}),_addEvent(this._pagesContainer,"click",e=>{this._pagesContainer.focus()})}_bindTouchEvents(e){super._bindTouchEvents(e),e.swipe.addHandler((e,t)=>{switch(t.direction){case _TouchDirection.Down:var r=this.resolvePageIndex(this.pageIndex-1);r!=this.pageIndex&&this.moveToPage(r);break;case _TouchDirection.Up:var i=this.resolvePageIndex(this.pageIndex+1);i!=this.pageIndex&&this.moveToPage(i)}})}_getTemplateParts(){return{_pagesWrapper:"pages-wrapper",_pagesContainer:"pages-container",_vscroller:"vscroller"}}applyTemplate(e,t,r){var i=this.hostElement;if(wjcCore.addClass(i,e),i.appendChild(_toDOMs(t)),r)for(var o in r){var a=r[o];if(this[o]=i.querySelector('[wj-part="'+a+'"]'),null==this[o]&&i.getAttribute("wj-part")==a&&(this[o]=t),null==this[o])throw'Missing template part: "'+a+'"'}return i}get virtualScrollMode(){return this._virtualScrollMode}set virtualScrollMode(e){this._virtualScrollMode!==e&&(this._virtualScrollMode=e,this.invalidate())}get _isScrollerVisible(){return this._virtualScrollMode&&this.pages&&this.pages.length>1}get _scroller(){return wjcCore.Control.getControl(this._vscroller)}get _hasPageVScrollBar(){return _hasScrollbar(this._pagesContainer)}get _hasPageHScrollBar(){return _hasScrollbar(this._pagesContainer,!0)}_getPagesContainer(){return this._pagesContainer}_getPageHeightWithoutZoom(e){var t=this._pagesContainer.clientHeight,r=this._getPageSize(e).height.valueInPixel+2*_PageViewBase._pageMargin;return Math.max(r,t)}_updateScroller(){if(this._isScrollerVisible){var e=this._scroller;e.height=this._pagesContainer.clientHeight;for(var t=0,r=0;r<this.pages.length;r++)t+=this._getPageHeightWithoutZoom(r);e.max=t,this._updateScrollerValue()}}_updateScrollerValue(){if(this._isScrollerVisible){var e=this.pageIndex;if(!(e<0)){var t=0;this._pagesContainer.scrollTop>0&&(t=this._pagesContainer.scrollTop/(this._pagesContainer.scrollHeight-this._pagesContainer.clientHeight));for(var r=this._scroller,i=this.pages.length,o=0,a=0;a<e;a++)o+=this._getPageHeightWithoutZoom(a);o+=this._getPageHeightWithoutZoom(e)*t,e>=i-1&&!this._hasPageVScrollBar&&(o=r.max),r.value=o}}}_doScrollerValueChanged(){if(this._isScrollerVisible){for(var e=this._scroller,t=this.pages.length,r=e.value,i=0,o=1;i<t;i++){var a=this._getPageHeightWithoutZoom(i);if(!(r>a)){o=r/a;break}r-=a}i>=t&&(i=t-1),this._innerMoveToPage(i,o)}}_doContainerWheel(e){if(this._isScrollerVisible&&0!=e.deltaY){var t=e.deltaY<0;if(this._hasPageVScrollBar)if(t){if(this._pagesContainer.scrollTop>0)return}else if(this._pagesContainer.scrollTop<this._pagesContainer.scrollHeight-this._pagesContainer.clientHeight)return;t?this._innerMoveToPreviousPageAtBottom(e):this._innerMoveToNextPageAtTop(e)}}_doContainerScroll(){this._isScrollerVisible&&this._pagesContainer.scrollTop!=this._desiredPageScrollTop&&(this._updateScrollerValue(),this._onPositionChanged())}_doContainerKeyDown(){if(this._isScrollerVisible){var e=event;if(this._hasPageVScrollBar)switch(e.keyCode){case wjcCore.Key.PageDown:this._pagesContainer.scrollTop>=this._pagesContainer.scrollHeight-this._pagesContainer.clientHeight&&this._innerMoveToNextPageAtTop(e);break;case wjcCore.Key.PageUp:0==this._pagesContainer.scrollTop&&this._innerMoveToPreviousPageAtBottom(e)}else switch(e.keyCode){case wjcCore.Key.Down:case wjcCore.Key.PageDown:this._innerMoveToNextPageAtTop(e);break;case wjcCore.Key.Up:case wjcCore.Key.PageUp:this._innerMoveToPreviousPageAtBottom(e)}}}_preventContainerScroll(){this._desiredPageScrollTop=this._pagesContainer.scrollTop}_innerMoveToPreviousPageAtBottom(e){this.pageIndex>0&&(e&&e.preventDefault(),this._innerMoveToPage(this.pageIndex-1,1),this._updateScrollerValue())}_innerMoveToNextPageAtTop(e){this.pageIndex<this.pages.length-1&&(e&&e.preventDefault(),this._innerMoveToPage(this.pageIndex+1,0),this._updateScrollerValue())}_innerMoveToPage(e,t){this._innerNavigating=!0;var r={pageIndex:e};this.moveToPosition(r).then(e=>{this._innerMoveToPagePosition(t),this._innerNavigating=!1})}_innerMoveToPagePosition(e){if(this._hasPageVScrollBar){var t=(this._pagesContainer.scrollHeight-this._pagesContainer.clientHeight)*e;this._pagesContainer.scrollTop=t,this._preventContainerScroll()}}moveToPosition(e){var t=super.moveToPosition(e);return this._innerNavigating||this._updateScrollerValue(),t}_moveToPagePosition(e){var t=e.pageBounds||{x:0,y:0,width:0,height:0},r=e.pageBounds?_PageViewBase._pageMargin:0,i=this.pages[this.pageIndex],o=_getTransformedPosition(t,i.size,i.rotateAngle,this.zoomFactor);e.samePage||(this._pagesContainer.scrollTop=o.y+r,this._pagesContainer.scrollLeft=o.x+r)}_hitTestPageIndex(e){return this.pageIndex}_pointInViewPanelClientArea(e,t){return e>=0&&t>=0&&e<this._pagesContainer.clientWidth&&t<this._pagesContainer.clientHeight}_panelViewPntToPageView(e,t){if(this.pageIndex<0)return null;var r=this._pagesContainer.scrollTop+t,i=0;if(this._pagesContainer.scrollLeft>0)i=this._pagesContainer.scrollLeft+e;else{var o=this._pagesContainer.getBoundingClientRect();i=e-(this._pagesWrapper.getBoundingClientRect().left-o.left)+_PageViewBase._pageMargin}return{x:i,y:r,pageIndex:this.pageIndex}}_render(e){return this._renderViewPage(this._pagesWrapper.querySelector(".wj-view-page"),e)}_guessPageIndex(){return this.pageIndex}_reserveViewPage(){_removeChildren(this._pagesWrapper),this._addViewPage(),this.invalidate()}_updatePageViewTransform(){var e;e=this._pagesWrapper.querySelector(".wj-view-page"),this._setPageTransform(e,this.pageIndex)}_onPageLoaded(e){super._onPageLoaded(e),this._updateScroller()}_onZoomFactorChanged(e,t){super._onZoomFactorChanged(e,t),this._updateScroller()}_zoomToViewWidth(){var e,t;e=this._getViewPortHeight(),t=this._getViewPortWidth();var r=this._getPageSize(this.pageIndex);if(r){var i=r.height.valueInPixel,o=r.width.valueInPixel;t/o>e/i&&(t-=_Scroller.getScrollbarWidth()),this.zoomFactor=t/o}}refresh(e=!0){super.refresh(e),this._isScrollerVisible?wjcCore.addClass(this.hostElement,"virtual"):wjcCore.removeClass(this.hostElement,"virtual"),this._updateScroller()}}_SinglePageView.controlTemplate='<div class="wj-pageview-pagescontainer" wj-part="pages-container" tabindex="0">   <div class="wj-pages-wrapper" wj-part="pages-wrapper"></div></div><div class="wj-pageview-vscroller" wj-part="vscroller" tabindex="-1"></div> ',exports._SinglePageView=_SinglePageView;class _ContinuousPageView extends _PageViewBase{constructor(e){super(e),wjcCore.addClass(e,"wj-pageview-continuous")}_init(){super._init(),_addEvent(this.hostElement,"click",e=>{this.hostElement.focus()}),_addEvent(this.hostElement,"scroll",()=>{this._onPositionChanged(),clearTimeout(this._scrollingTimer),this._scrollingTimer=setTimeout(()=>{this._ensurePageIndexPosition()},200)}),this.zoomFactorChanged.addHandler(()=>{clearTimeout(this._zoomFactorTimer),this._zoomFactorTimer=setTimeout(()=>{this._ensurePageIndexPosition()},200)})}dispose(){clearTimeout(this._scrollingTimer),clearTimeout(this._zoomFactorTimer),this._disposeBodyStopSwipe&&this._disposeBodyStopSwipe(),super.dispose()}_stopSwip(){this._swipeSpeedReducer&&this._swipeSpeedReducer.stop()}_bindTouchEvents(e){super._bindTouchEvents(e),e.touchStart.addHandler(this._stopSwip,this),e.swipe.addHandler((t,r)=>{this._swipeSpeedReducer||(this._swipeSpeedReducer=new _SpeedReducer),this._swipeSpeedReducer.start(r.speed.x,r.speed.y,(t,r)=>{var i=e.hostElement.scrollLeft,o=e.hostElement.scrollTop;e.hostElement.scrollLeft-=t,e.hostElement.scrollTop-=r,i==e.hostElement.scrollLeft&&o==e.hostElement.scrollTop&&this._stopSwip()})});var t=new _TouchManager(document.body,!1),r=this._stopSwip.bind(this);_addEvent(document.body,"mousedown",r,!0),t.touchStart.addHandler(r),this._disposeBodyStopSwipe=(()=>{this._stopSwip(),_removeEvent(document.body,"mousedown",r),t.touchStart.removeHandler(r),t.dispose(),this._disposeBodyStopSwipe=null})}_getAbovePageCount(e){return this._hitTestPageIndex(e)}refresh(e){this._stopSwip(),super.refresh(e)}_hitTestPageIndex(e){if(!this.pages)return this.pageIndex;for(var t=0,r=0;t<this.pages.length;t++)if(r+=this._getPageSize(t).height.valueInPixel*this.zoomFactor+_PageViewBase._pageMargin,e<r){if(r-e<1)continue;break}return Math.min(t,this.pages.length-1)}_guessPageIndex(){return this.pages&&this.hostElement.scrollHeight-this.hostElement.clientHeight<=this.hostElement.scrollTop?this.pages.length-1:this._hitTestPageIndex(this.hostElement.scrollTop)}_render(e){var t=this.pages.length,r=e-_ContinuousPageView._preFetchPageCount,i=e+_ContinuousPageView._preFetchPageCount,o=[];r=r<0?0:r,i=i>t-1?t-1:i;for(var a=r;a<=i;a++)o.push(this._renderViewPage(this._pagesWrapper.querySelectorAll(".wj-view-page").item(a),a));return new _CompositedPromise(o)}_moveToPagePosition(e){this._stopSwip();for(var t=0,r=0,i=!e.pageBounds,o=e.pageBounds||{x:0,y:0,width:0,height:0},a=i?0:_PageViewBase._pageMargin,n=this.pages[this.pageIndex],s=0;s<e.pageIndex;s++)t+=this._getPageSize(s).height.valueInPixel*this.zoomFactor+_PageViewBase._pageMargin,this._borderBoxMode||(t+=2*_PageViewBase._pageBorderWidth);var h=_getTransformedPosition(o,n.size,i?_RotateAngle.NoRotate:n.rotateAngle,this.zoomFactor);t+=h.y+a,r+=h.x+a,r+=this._getPageViewOffsetLeft(e.pageIndex),this.hostElement.scrollTop=t,this.hostElement.scrollLeft=r}_pointInViewPanelClientArea(e,t){return e>=0&&t>=0&&e<this.hostElement.clientWidth&&t<this.hostElement.clientHeight}_panelViewPntToPageView(e,t){var r=this.hostElement.scrollTop+t,i=0;if(this.hostElement.scrollLeft>0)i=this.hostElement.scrollLeft+e;else{var o=this.hostElement.getBoundingClientRect();i=e-(this._pagesWrapper.getBoundingClientRect().left-o.left)+_PageViewBase._pageMargin}var a=this._hitTestPageIndex(r);if(a<0)return null;i-=this._getPageViewOffsetLeft(a);for(var n=0;n<a;n++)r-=this._getPageSize(n).height.valueInPixel*this.zoomFactor+_PageViewBase._pageMargin,this._borderBoxMode||(r-=2*_PageViewBase._pageBorderWidth);return{x:i,y:r,pageIndex:a}}_reserveViewPage(){_removeChildren(this._pagesWrapper);for(var e=0;e<(this.pages||[]).length;e++){var t=this._addViewPage(),r=this._getPageSize(e);t.style.height=r.height.valueInPixel*this.zoomFactor+"px",t.style.width=r.width.valueInPixel*this.zoomFactor+"px"}}_updatePageViewTransform(){if(this.pages&&this.pages.length){var e;e=this._pagesWrapper.querySelectorAll(".wj-view-page");for(var t=0;t<e.length;t++)this._setPageTransform(e.item(t),t)}}_zoomToViewWidth(){if(this.pages&&0!=this.pages.length){var e,t;e=this._getViewPortHeight(),t=this._getViewPortWidth();for(var r=0,i=0,o=0;o<this.pages.length;o++){var a=this._getPageSize(o);a.width.valueInPixel>r&&(r=a.width.valueInPixel),i+=a.height.valueInPixel}t/r>e/i&&(t-=_Scroller.getScrollbarWidth()),this.zoomFactor=t/r}}_ensurePageIndexPosition(){var e=this._guessPageIndex();this.pageIndex!==e&&(this._render(e),this._updatePageIndex(e))}_getPageViewOffsetLeft(e){var t=this._pagesWrapper.querySelectorAll(".wj-view-page").item(e);return t?t.offsetLeft-this._pagesWrapper.offsetLeft:0}}_ContinuousPageView._preFetchPageCount=3,exports._ContinuousPageView=_ContinuousPageView;class _SideTabs extends wjcCore.Control{constructor(e){super(e),this._idCounter=0,this._tabPages=[],this._tabPageDic={},this.tabPageActived=new wjcCore.Event,this.tabPageVisibilityChanged=new wjcCore.Event,this.expanded=new wjcCore.Event,this.collapsed=new wjcCore.Event;var t=this.getTemplate();this.applyTemplate("wj-control",t,{_headersContainer:"wj-headers",_contentsContainer:"wj-contents"})}applyTemplate(e,t,r){var i=this.hostElement;if(wjcCore.addClass(i,e),i.appendChild(_toDOMs(t)),r)for(var o in r){var a=r[o];if(this[o]=i.querySelector('[wj-part="'+a+'"]'),null==this[o]&&i.getAttribute("wj-part")==a&&(this[o]=t),null==this[o])throw'Missing template part: "'+a+'"'}return i}get tabPages(){return this._tabPages}getTabPage(e){return this._tabPageDic[e]}getFirstShownTabPage(e){var t;return this._tabPages.some(r=>!r.isHidden&&r!==e&&(t=r,!0)),t}get visibleTabPagesCount(){var e=0;return this._tabPages.forEach(t=>{t.isHidden||e++}),e}get activedTabPage(){var e;return this._tabPages.some(t=>!!t.isActived&&(e=t,!0)),e}removePage(e){var t;if(t="string"==typeof e?this.getTabPage(e):e){var r=t.id,i=this._tabPages.indexOf(t);if(!(i<0)){if(this._tabPages.splice(i,1),this._tabPageDic[r]=void 0,!this.isCollapsed&&t.isActived){var o=this.getFirstShownTabPage();o?this.active(o):this.collapse()}this._headersContainer.removeChild(t.header),this._contentsContainer.removeChild(t.outContent)}}}addPage(e,t,r){var i=this._getNewTabPageId(),o=document.createElement("li"),a=_toDOM('<div class="wj-tabpane"><div class="wj-tabtitle-wrapper"><h3 class="wj-tabtitle">'+e+'</h3><span class="wj-close">×</span></div><div class="wj-tabcontent-wrapper"><div class="wj-tabcontent-inner"></div></div></div>'),n=_createSvgBtn(t);o.appendChild(n),r=null==r?this._tabPages.length:r,(r=Math.min(Math.max(r,0),this._tabPages.length))>=this._tabPages.length?(this._headersContainer.appendChild(o),this._contentsContainer.appendChild(a)):(this._headersContainer.insertBefore(o,this._tabPages[r].header),this._contentsContainer.insertBefore(a,this._tabPages[r].outContent)),_addEvent(a.querySelector(".wj-close"),"click",()=>{this.collapse()}),_addEvent(o.querySelector("a"),"click,keydown",e=>{var t=this.getTabPage(i);t&&("keydown"===e.type&&e.keyCode===wjcCore.Key.Enter||"click"===e.type)&&this.active(t)});var s=new _TabPage(a,o,i);return r>=this._tabPages.length?this._tabPages.push(s):this._tabPages.splice(r,0,s),this._tabPageDic[i]=s,this.isCollapsed||this.activedTabPage||this.active(s),s}get isCollapsed(){return wjcCore.hasClass(this.hostElement,_SideTabs._collapsedCss)}hide(e){var t="string"==typeof e?this.getTabPage(e):e;t&&(wjcCore.hasClass(t.header,exports._hiddenCss)||(wjcCore.addClass(t.header,exports._hiddenCss),this.onTabPageVisibilityChanged(t),this.deactive(t)))}show(e){var t="string"==typeof e?this.getTabPage(e):e;t&&wjcCore.hasClass(t.header,exports._hiddenCss)&&(wjcCore.removeClass(t.header,exports._hiddenCss),this.onTabPageVisibilityChanged(t),this.isCollapsed||this.activedTabPage||this.active(t))}deactive(e){var t="string"==typeof e?this.getTabPage(e):e;if(t&&t.isActived){wjcCore.removeClass(t.outContent,_SideTabs._activedCss),_checkImageButton(t.header.querySelector("a"),!1);var r=this.getFirstShownTabPage(t);r?this.active(r):this.collapse()}}active(e){var t="string"==typeof e?this.getTabPage(e):e;t&&(this.expand(),t.isActived||(this._clearActiveStyles(),this.show(t),wjcCore.addClass(t.outContent,_SideTabs._activedCss),_checkImageButton(t.header.querySelector("a"),!0),this.onTabPageActived()))}enable(e,t=!0){var r="string"==typeof e?this.getTabPage(e):e;r&&r.enable(t)}enableAll(e=!0){this._tabPages.forEach(t=>{t.enable(e)})}onTabPageActived(){this.tabPageActived.raise(this,new wjcCore.EventArgs)}onTabPageVisibilityChanged(e){this.tabPageVisibilityChanged.raise(this,{tabPage:e})}onExpanded(){this.expanded.raise(this,new wjcCore.EventArgs)}onCollapsed(){this.collapsed.raise(this,new wjcCore.EventArgs)}collapse(){this.isCollapsed||(this._clearActiveStyles(),wjcCore.addClass(this.hostElement,_SideTabs._collapsedCss),this.onCollapsed())}expand(){if(this.isCollapsed){if(wjcCore.removeClass(this.hostElement,_SideTabs._collapsedCss),!this.activedTabPage){var e=this.getFirstShownTabPage();e&&this.active(e)}this.onExpanded()}}toggle(){this.isCollapsed?this.expand():this.collapse()}_clearActiveStyles(){this._tabPages.forEach(e=>{wjcCore.removeClass(e.outContent,_SideTabs._activedCss),_checkImageButton(e.header.querySelector("a"),!1)})}_getNewTabPageId(){for(;this._tabPageDic[(this._idCounter++).toString()];);return this._idCounter.toString()}}_SideTabs._activedCss="active",_SideTabs._collapsedCss="collapsed",_SideTabs.controlTemplate='<ul class="wj-nav wj-btn-group" wj-part="wj-headers"></ul><div class="wj-tabcontent" wj-part="wj-contents"></div>',exports._SideTabs=_SideTabs;class _TabPage{constructor(e,t,r){this._header=t,this._outContent=e,this._content=e.querySelector(".wj-tabcontent-inner"),this._id=r}get isActived(){return wjcCore.hasClass(this.outContent,_SideTabs._activedCss)}get isHidden(){return wjcCore.hasClass(this.header,exports._hiddenCss)}get id(){return this._id}get header(){return this._header}get content(){return this._content}get outContent(){return this._outContent}enable(e=!0){wjcCore.enable(this._header,e),wjcCore.enable(this._content,e)}format(e){e(this)}}exports._TabPage=_TabPage;class _ViewerMenuBase extends wjcInput.Menu{constructor(e,t,r){super(document.createElement("div"),r),this.owner=t,this.hostElement.style.display="none",this.owner.appendChild(this.hostElement),this.showDropDownButton=!1,this.itemClicked.addHandler(this._onItemClicked,this),this.formatItem.addHandler(this._formatItem,this),this._viewer=e,this._bindMenuItems(),this.displayMemberPath="title",this.selectedValuePath="commandTag",this._viewer._viewerActionStatusChanged.addHandler((e,t)=>{var r=this.dropDown.querySelector("["+exports._commandTagAttr+'="'+t.action.actionType.toString()+'"]');this._updateActionStatusCore(r,t.action)})}get viewer(){return this._viewer}_bindMenuItems(){this.itemsSource=this._initItems()}_initItems(){throw wjcCore.culture.Viewer.abstractMethodException}_internalFormatItem(e,t){if(e&&void 0!==e.commandTag){if(_removeChildren(t),e.icon){var r=document.createElement("span");r.appendChild(_createSvgBtn(e.icon)),t.insertBefore(r,t.firstChild)}t.setAttribute(exports._commandTagAttr,e.commandTag.toString()),this._updateActionStatus(t,e.commandTag)}}_formatItem(e,t){this._internalFormatItem(this.itemsSource[t.index],t.item)}_onItemClicked(e){this._viewer._executeAction(parseInt(e.selectedItem.commandTag))}_updateActionStatus(e,t){this._updateActionStatusCore(e,{actionType:t,checked:this._viewer._actionIsChecked(t),disabled:this._viewer._actionIsDisabled(t),shown:this._viewer._actionIsShown(t)})}_updateActionStatusCore(e,t){_checkImageButton(e,t.checked),_disableImageButton(e,t.disabled),_showImageButton(e,t.shown)}_updateItemsStatus(){for(var e=this.dropDown.querySelectorAll("["+exports._commandTagAttr+"]"),t=0;t<e.length;t++){var r=e[t],i=r.getAttribute(exports._commandTagAttr);null!=i&&this._updateActionStatus(r,parseInt(i))}_checkSeparatorShown(this.dropDown)}refresh(e=!0){super.refresh(e),e&&this._bindMenuItems(),this.isDroppedDown&&this.showMenu()}showMenu(e){this.selectedIndex=-1,wjcCore.showPopup(this.dropDown,this.owner,e,!1,!1),this.dropDown.style.color=this._viewer.hostElement.style.color,wjcCore.addClass(this.dropDown,"wj-btn-group-vertical"),wjcCore.addClass(this.dropDown,"wj-viewer-menu"),this._updateItemsStatus(),this.dropDown.focus()}}exports._ViewerMenuBase=_ViewerMenuBase;class _HamburgerMenu extends _ViewerMenuBase{constructor(e,t,r){super(e,t,r)}_initItems(){let e=[],t=wjcCore.culture.Viewer;return e.push({title:t.thumbnails,icon:exports.icons.thumbnails,commandTag:_ViewerActionType.ShowThumbnails}),e.push({title:t.outlines,icon:exports.icons.outlines,commandTag:_ViewerActionType.ShowOutlines}),e.push({title:t.exports,icon:exports.icons.exports,commandTag:_ViewerActionType.ShowExportsPanel}),e.push({title:ViewerBase._seperatorHtml}),e.push({title:t.portrait,icon:exports.icons.portrait,commandTag:_ViewerActionType.Portrait}),e.push({title:t.landscape,icon:exports.icons.landscape,commandTag:_ViewerActionType.Landscape}),e.push({title:t.pageSetup,icon:exports.icons.pageSetup,commandTag:_ViewerActionType.ShowPageSetupPanel}),e.push({title:ViewerBase._seperatorHtml}),e.push({title:t.showZoomBar,icon:exports.icons.showZoomBar,commandTag:_ViewerActionType.ShowZoomBar}),e.push({title:ViewerBase._seperatorHtml}),e.push({title:t.paginated,icon:exports.icons.paginated,commandTag:_ViewerActionType.TogglePaginated}),e.push({title:t.print,icon:exports.icons.print,commandTag:_ViewerActionType.Print}),e.push({title:ViewerBase._seperatorHtml}),e.push({title:t.backwardHistory,icon:exports.icons.backwardHistory,commandTag:_ViewerActionType.Backward}),e.push({title:t.forwardHistory,icon:exports.icons.forwardHistory,commandTag:_ViewerActionType.Forward}),e}}exports._HamburgerMenu=_HamburgerMenu;class _ViewMenu extends _ViewerMenuBase{constructor(e,t,r){super(e,t,r)}_initItems(){var e=[];return e.push({title:wjcCore.culture.Viewer.singleMode,icon:exports.icons.singleView,commandTag:_ViewerActionType.Single}),e.push({title:wjcCore.culture.Viewer.continuousMode,icon:exports.icons.continuousView,commandTag:_ViewerActionType.Continuous}),e.push({title:ViewerBase._seperatorHtml}),e.push({title:wjcCore.culture.Viewer.wholePage,icon:exports.icons.fitWholePage,commandTag:_ViewerActionType.FitWholePage}),e.push({title:wjcCore.culture.Viewer.pageWidth,icon:exports.icons.fitPageWidth,commandTag:_ViewerActionType.FitPageWidth}),e}}exports._ViewMenu=_ViewMenu;class _SearchOptionsMenu extends _ViewerMenuBase{constructor(e,t,r){super(e,t,r)}_initItems(){var e=[];return e.push({title:wjcCore.culture.Viewer.wholeWordMenuItem,commandTag:_ViewerActionType.SearchMatchWholeWord}),e.push({title:wjcCore.culture.Viewer.matchCaseMenuItem,commandTag:_ViewerActionType.SearchMatchCase}),e}_internalFormatItem(e,t){if(super._internalFormatItem(e,t),e&&void 0!==e.commandTag){var r=document.createElement("span");r.innerHTML=wjcCore.culture.Viewer.checkMark,wjcCore.addClass(r,"checkIcon"),t.insertBefore(r,t.firstChild)}}_updateActionStatus(e,t){super._updateActionStatus(e,t),this.viewer._actionIsChecked(t)&&wjcCore.addClass(e,"checked")}}exports._SearchOptionsMenu=_SearchOptionsMenu;var MouseMode;!function(e){e[e.SelectTool=0]="SelectTool",e[e.MoveTool=1]="MoveTool",e[e.RubberbandTool=2]="RubberbandTool",e[e.MagnifierTool=3]="MagnifierTool"}(MouseMode=exports.MouseMode||(exports.MouseMode={}));var ViewMode;!function(e){e[e.Single=0]="Single",e[e.Continuous=1]="Continuous"}(ViewMode=exports.ViewMode||(exports.ViewMode={}));var ZoomMode;!function(e){e[e.Custom=0]="Custom",e[e.PageWidth=1]="PageWidth",e[e.WholePage=2]="WholePage"}(ZoomMode=exports.ZoomMode||(exports.ZoomMode={}));class _LinkClickedEventArgs extends wjcCore.EventArgs{constructor(e){super(),this._a=e}get element(){return this._a}}exports._LinkClickedEventArgs=_LinkClickedEventArgs;var _ActionKind;!function(e){e[e.Bookmark=0]="Bookmark",e[e.Custom=1]="Custom"}(_ActionKind=exports._ActionKind||(exports._ActionKind={}));class _HistoryManager{constructor(){this._items=[{}],this._position=0,this.statusChanged=new wjcCore.Event}_onStatusChanged(){this.statusChanged.raise(this,new wjcCore.EventArgs)}get current(){return this._items[this._position]}clear(){this._items=[{}],this._position=0,this._onStatusChanged()}add(){this._items.splice(++this._position),this._items.push({}),this._onStatusChanged()}forward(){if(!this.canForward())return null;var e=this._items[++this._position];return this._onStatusChanged(),e}backward(){if(!this.canBackward())return null;var e=this._items[--this._position];return this._onStatusChanged(),e}canForward(){return this._position<this._items.length-1}canBackward(){return this._position>0}}exports._HistoryManager=_HistoryManager;class ViewerBase extends wjcCore.Control{constructor(e,t){super(e,t,!0),this._pages=[],this._pageIndex=0,this._mouseMode=MouseMode.SelectTool,this._viewMode=ViewMode.Single,this._needBind=!1,this._historyManager=new _HistoryManager,this._fullScreen=!1,this._miniToolbarPinnedTimer=null,this._autoHeightCalculated=!1,this._searchManager=new _SearchManager,this._thresholdWidth=767,this._historyMoving=!1,this._documentSourceChanged=new wjcCore.Event,this.pageIndexChanged=new wjcCore.Event,this.viewModeChanged=new wjcCore.Event,this.selectMouseModeChanged=new wjcCore.Event,this.mouseModeChanged=new wjcCore.Event,this.fullScreenChanged=new wjcCore.Event,this.zoomFactorChanged=new wjcCore.Event,this.queryLoadingData=new wjcCore.Event,this.beforeSendRequest=new wjcCore.Event,this._viewerActionStatusChanged=new wjcCore.Event,this._documentEventKey=(new Date).getTime().toString(),this._init(t)}_getProductInfo(){return"QNI5,ViewerBase"}get serviceUrl(){return this._serviceUrl}set serviceUrl(e){e!=this._serviceUrl&&(this._serviceUrl=e,this._needBindDocumentSource(),this.invalidate())}get filePath(){return this._filePath}set filePath(e){e!=this._filePath&&(this._filePath=e,this._needBindDocumentSource(),this.invalidate())}get requestHeaders(){return this._requestHeaders}set requestHeaders(e){this._requestHeaders=e}get thresholdWidth(){return this._thresholdWidth}set thresholdWidth(e){e!=this._thresholdWidth&&(this._thresholdWidth=e,this.invalidate())}get _innerPaginated(){return this._documentSource&&!this._needBind?this._documentSource.paginated:this._paginated}set _innerPaginated(e){this._documentSource&&!this._needBind?this._setPaginated(e):this._paginated=null==e?null:wjcCore.asBoolean(e),this._setViewerAction(_ViewerActionType.TogglePaginated,!0)}reload(){this._needBindDocumentSource(),this.invalidate()}refresh(e=!0){if(super.refresh(e),this._needBind&&(this._setDocumentSource(this._getSource()),this._needBind=!1),e){var t=wjcCore.Control.getControl(this._toolbar);t&&t.refresh();var r=wjcCore.Control.getControl(this._miniToolbar);r&&r.refresh();var i=wjcCore.Control.getControl(this._mobileToolbar);i&&i.refresh();var o=wjcCore.Control.getControl(this._zoomBar);o&&o.refresh();var a=wjcCore.Control.getControl(this._searchBar);a&&a.refresh(),this._hamburgerMenu&&this._hamburgerMenu.refresh(),this._viewMenu&&this._viewMenu.refresh(),this._searchOptionsMenu&&this._searchOptionsMenu.refresh(),ViewerBase._exportItems=null,this._updateExportTab(!0),this._globalize(),this._updateLayout()}this._resetMiniToolbarPosition(),this._resetToolbarWidth(),this._resetViewPanelContainerWidth(),this._autoHeightCalculated=!1}_updateLayout(){this._switchTemplate(this._isMobileTemplate())}_switchTemplate(e){var t=this.hostElement.querySelector(".wj-viewer-outer"),r=wjcCore.Control.getControl(this._sidePanel),i=r.getTabPage(this._pageSetupPageId);e?(wjcCore.addClass(t,"mobile"),r.show(i)):(wjcCore.removeClass(t,"mobile"),r.hide(i))}_getSource(){return this.filePath?new _DocumentSource({serviceUrl:this._serviceUrl,filePath:this._filePath},this):null}_needBindDocumentSource(){this._needBind=!0}_supportsPageSettingActions(){return!1}_isMobileTemplate(){return this.thresholdWidth>this.hostElement.getBoundingClientRect().width}_init(e){this._createChildren(),this._autoCalculateHeight(),this._resetToolbarWidth(),this._resetViewPanelContainerWidth(),this._bindEvents(),this._initTools(),this.deferUpdate(()=>{this.initialize(e)})}_initTools(){this._rubberband=new _Rubberband(document.createElement("div"),this._viewpanelContainer,this._pageView),this._rubberband.applied.addHandler((e,t)=>{var r=t.rect,i=this._pageView.hitTest(r.left,r.top),o=this._viewpanelContainer.getBoundingClientRect();r.width>r.height?this._pageView.zoomFactor*=o.width/r.width:this._pageView.zoomFactor*=o.height/r.height,this._pageView.moveToPosition(_getPositionByHitTestInfo(i))}),this._magnifier=new _Magnifier(document.createElement("div"),this._viewpanelContainer,this._pageView)}_globalize(){var e=wjcCore.culture.Viewer;this._gSearchTitle.textContent=e.search,this._gMatchCase.innerHTML="&nbsp;&nbsp;&nbsp;"+e.matchCase,this._gWholeWord.innerHTML="&nbsp;&nbsp;&nbsp;"+e.wholeWord,this._gSearchResults.textContent=e.searchResults,this._gThumbnailsTitle.textContent=e.thumbnails,this._gOutlinesTitle.textContent=e.outlines,this._gPageSetupTitle.textContent=e.pageSetup,this._gPageSetupApplyBtn.textContent=e.ok,this._gExportsPageTitle.textContent=e.exports,this._gExportsPageApplyBtn.textContent=e.exportOk,this._gExportFormatTitle.textContent=e.exportFormat}_autoCalculateHeight(){if(this._shouldAutoHeight()){var e=this._viewpanelContainer.style.height;this._viewpanelContainer.style.height="100%",this._viewerContainer.style.height=Math.max(this._viewpanelContainer.getBoundingClientRect().height,ViewerBase._viewpanelContainerMinHeight)+"px",this._viewpanelContainer.style.height=e}}_bindEvents(){_addEvent(window,"unload",()=>{this._documentSource&&this._documentSource.dispose()}),_addEvent(document,"mousemove",e=>{if(this.fullScreen&&this._miniToolbar){var t=this._checkMiniToolbarVisible(e);null!=this._miniToolbarPinnedTimer&&t?(clearTimeout(this._miniToolbarPinnedTimer),this._miniToolbarPinnedTimer=null,this._showMiniToolbar(t)):null==this._miniToolbarPinnedTimer&&this._showMiniToolbar(t)}}),_addEvent(document,"keydown",e=>{e.keyCode===wjcCore.Key.Escape&&(this.fullScreen=!1)}),this._historyManager.statusChanged.addHandler(this._onHistoryManagerStatusUpdated,this),this._onHistoryManagerStatusUpdated(),this._pageView.pageIndexChanged.addHandler(()=>{this._addHistory(!1,!0),this._updatePageIndex(this._pageView.pageIndex)}),this._pageView.zoomFactorChanged.addHandler((e,t)=>{this.zoomMode===ZoomMode.Custom&&this._addHistory(!1,!0,{zoomFactor:t.oldValue}),this.onZoomFactorChanged()}),this._pageView.zoomModeChanged.addHandler((e,t)=>{this._addHistory(!1,!0,{zoomMode:t.oldValue}),this._updateZoomModeActions()}),this._pageView.positionChanged.addHandler(()=>{setTimeout(()=>{this._historyManager.current.position=this._getCurrentPosition()},ViewerBase._historyTimeout)});var e=!1;this._searchManager.currentChanged.addHandler(()=>{if(!e){var t=this._searchManager.current;t&&(e=!0,this._highlightPosition(t.pageIndex,t.boundsList),e=!1)}})}_checkMiniToolbarVisible(e){var t=e.clientX,r=e.clientY,i=this._miniToolbar.getBoundingClientRect(),o=i.left-60,a=i.right+60,n=i.top-60,s=i.bottom+60;return t>=o&&t<=a&&r>=n&&r<=s}_showMiniToolbar(e){var t,r=parseFloat(getComputedStyle(this._miniToolbar,"").opacity),i=this._miniToolbar;t=e?setInterval(function(){r>=.8?window.clearInterval(t):(r+=.01,i.style.opacity=r.toString())},1):setInterval(function(){r<0?window.clearInterval(t):(r-=.01,i.style.opacity=r.toString())},1)}_goToBookmark(e){this._documentSource&&e.data&&this._documentSource.getBookmark(e.data).then(e=>{e&&this._scrollToPosition(e,!0)})}_executeCustomAction(e){if(this._documentSource&&e.data){this._initialPosition={pageIndex:this._pageIndex,pageBounds:{x:0,y:0,width:0,height:0}},this._resetDocument(),this._showViewPanelMessage(),this._setDocumentRendering();var t=this._documentSource;this._documentSource.executeCustomAction(e).then(e=>{this._initialPosition=e||this._initialPosition,this._getStatusUtilCompleted(t)}).catch(e=>{this._showViewPanelErrorMessage(_getErrorMessage(e))})}}_getStatusUtilCompleted(e){!e||e.isLoadCompleted||e.isDisposed||e.getStatus().then(t=>{this._documentSource===e&&setTimeout(()=>this._getStatusUtilCompleted(e),e._innerService.getPingTimeout())}).catch(e=>{this._showViewPanelErrorMessage(e)})}_initChildren(){this._initPageView(),this._initToolbar(),this._initSidePanel(),this._initSplitter(),this._initFooter(),this._initSearchBar(),this._initMiniToolbar()}_initSearchBar(){new _SearchBar(this._searchBar,this),this._showSearchBar(!1)}_showSearchBar(e){var t=this.hostElement.querySelector(".wj-viewer-outer");e?(wjcCore.removeClass(this._searchBar,exports._hiddenCss),wjcCore.addClass(t,"with-searchbar")):(wjcCore.addClass(this._searchBar,exports._hiddenCss),wjcCore.removeClass(t,"with-searchbar"))}_initFooter(){new _ViewerZoomBar(this._zoomBar,this),_addEvent(this._footer.querySelector(".wj-close"),"click",()=>{this._showFooter(!1)})}_showFooter(e){var t=this.hostElement.querySelector(".wj-viewer-outer");e?(wjcCore.removeClass(this._footer,exports._hiddenCss),wjcCore.addClass(t,"with-footer")):(wjcCore.addClass(this._footer,exports._hiddenCss),wjcCore.removeClass(t,"with-footer"))}_createChildren(){var e=this.getTemplate();this.applyTemplate("wj-viewer wj-control",e,{_viewpanelContainer:"viewpanel-container",_toolbar:"toolbar",_mobileToolbar:"mobile-toolbar",_miniToolbar:"mini-toolbar",_leftPanel:"viewer-left-panel",_sidePanel:"side-panel",_viewerContainer:"viewer-container",_splitter:"splitter",_footer:"viewer-footer",_zoomBar:"zoom-bar",_searchBar:"search-bar"}),this._initChildren()}_initPageView(){new _CompositePageView(this._viewpanelContainer).viewMode=this.viewMode}get _pageView(){return wjcCore.Control.getControl(this._viewpanelContainer)}_initSplitter(){_addEvent(this._splitter,"click",()=>this._toggleSplitter())}_toggleSplitter(e){var t=this._splitter.querySelector("span"),r=wjcCore.Control.getControl(this._sidePanel);if(!0===e){if(wjcCore.hasClass(t,"wj-glyph-right"))return}else if(!1===e){if(wjcCore.hasClass(t,"wj-glyph-left"))return}else e=wjcCore.hasClass(t,"wj-glyph-left");if(e)r.collapse(),t.className="wj-glyph-right";else{if(0===r.visibleTabPagesCount)return;t.className="wj-glyph-left",r.expand()}this._resetViewPanelContainerWidth()}_resetMiniToolbarPosition(){if(this._miniToolbar){var e=this.hostElement.getBoundingClientRect().width,t=this._miniToolbar.getBoundingClientRect().width;this._miniToolbar.style.left=(e-t)/2+"px"}}_resetToolbarWidth(){wjcCore.Control.getControl(this._toolbar).resetWidth()}_resetViewPanelContainerWidth(){!this._isMobileTemplate()&&this.hostElement.getBoundingClientRect().width<=ViewerBase._narrowWidthThreshold?wjcCore.addClass(this.hostElement,ViewerBase._narrowCss):wjcCore.removeClass(this.hostElement,ViewerBase._narrowCss);var e=this._splitter?this._splitter.getBoundingClientRect().width:0,t=this._leftPanel?this._leftPanel.getBoundingClientRect().width:0;this._viewpanelContainer.style.width=this._viewerContainer.getBoundingClientRect().width-e-t+"px",this._pageView.invalidate()}_shouldAutoHeight(){return("100%"===this.hostElement.style.height||"auto"===this.hostElement.style.height)&&!this.fullScreen}_initSidePanel(){var e=new _SideTabs(this._sidePanel);e.collapse(),e.collapsed.addHandler(()=>{this._toggleSplitter(!0)}),e.expanded.addHandler(()=>{this._toggleSplitter(!1);var e=this._splitter?this._splitter.getBoundingClientRect().width:0;this._sidePanel.getBoundingClientRect().width+e>this._viewerContainer.getBoundingClientRect().width&&wjcCore.addClass(this._sidePanel,"collapsed")}),e.tabPageVisibilityChanged.addHandler((t,r)=>{(!r.tabPage.isHidden&&1==e.visibleTabPagesCount||r.tabPage.isHidden&&0==e.visibleTabPagesCount)&&this._resetViewPanelContainerWidth()}),this._initSidePanelThumbnails(),this._initSidePanelOutlines(),this._initSidePanelSearch(),this._initSidePanelExports(),this._initSidePanelPageSetup()}_clearPreHightLights(){this._pages.forEach(e=>{var t;if(e.content){t=e.content.querySelectorAll(".highlight");for(var r=0;r<t.length;r++)t.item(r).parentNode.removeChild(t.item(r))}})}_highlightPosition(e,t){this._pageIndex,this._pageView.scrollTop,this._pageView.scrollLeft;var r,i={pageIndex:e,pageBounds:t.length>0?t[0]:null};this._scrollToPosition(i,!0).then(e=>{this._clearPreHightLights(),this._pages[this.pageIndex].getContent().then(e=>{r=e.querySelector("g");for(var i=0;i<t.length;i++){var o=document.createElementNS("http://www.w3.org/2000/svg","rect");o.setAttributeNS(null,"x",_twipToPixel(t[i].x).toString()),o.setAttributeNS(null,"y",_twipToPixel(t[i].y).toString()),o.setAttributeNS(null,"height",_twipToPixel(t[i].height).toString()),o.setAttributeNS(null,"width",_twipToPixel(t[i].width).toString()),o.setAttributeNS(null,"class","highlight"),r.appendChild(o)}})})}_scrollToPosition(e,t){return!0===t&&this._addHistory(!0,!1),e.pageIndex=e.pageIndex||0,this._pageView.moveToPosition(e)}_initSidePanelSearch(){var e=wjcCore.Control.getControl(this._sidePanel),t=e.addPage(wjcCore.culture.Viewer.search,exports.icons.search);this._gSearchTitle=t.outContent.querySelector(".wj-tabtitle"),t.format(r=>{var i=_toDOMs('<div class="wj-searchcontainer"><input class="wj-searchbox" wj-part="search-box" type="text"/><div class="wj-btn-group"><button class="wj-btn wj-btn-searchpre">'+_createSvgBtn(exports.icons.searchPrevious).innerHTML+'</button><button class="wj-btn wj-btn-searchnext">'+_createSvgBtn(exports.icons.searchNext).innerHTML+'</button></div></div><div class="wj-searchoption"><label><span wj-part="g-matchCase">&nbsp;&nbsp;&nbsp;'+wjcCore.culture.Viewer.matchCase+'</span><input type="checkbox" wj-part="match-case" /></label></div><div class="wj-searchoption"><label><span wj-part="g-wholeWord">&nbsp;&nbsp;&nbsp;'+wjcCore.culture.Viewer.wholeWord+'</span><input type="checkbox" wj-part="whole-word" /></label></div><h3 wj-part="g-searchResults" class="wj-searchresult">'+wjcCore.culture.Viewer.searchResults+"</h3>");this._gMatchCase=i.querySelector('[wj-part="g-matchCase"]'),this._gWholeWord=i.querySelector('[wj-part="g-wholeWord"]'),this._gSearchResults=i.querySelector('[wj-part="g-searchResults"]'),r.outContent.querySelector(".wj-tabtitle-wrapper").appendChild(i);var o=r.outContent.querySelectorAll('input[type="checkbox"]')[0],a=r.outContent.querySelectorAll('input[type="checkbox"]')[1],n=r.outContent.querySelector('input[type="text"]'),s=r.outContent.querySelector(".wj-btn-searchpre"),h=r.outContent.querySelector(".wj-btn-searchnext");wjcCore.addClass(r.content.parentElement,"search-wrapper"),wjcCore.addClass(r.content,"wj-searchresultlist");var l=new wjcInput.ListBox(r.content),c=!1,d=!1;l.formatItem.addHandler((e,t)=>{var r=t.item,i=t.data,o=document.createElement("div"),a=document.createElement("div");r.innerHTML="",a.innerHTML=i.nearText,a.className="wj-search-text",o.innerHTML="Page "+(i.pageIndex+1),o.className="wj-search-page",wjcCore.addClass(r,"wj-search-item"),r.setAttribute("tabIndex","-1"),r.appendChild(a),r.appendChild(o)}),l.selectedIndexChanged.addHandler(()=>this._searchManager.currentIndex=l.selectedIndex);var u=(e=!0)=>{for(var r=t.outContent.querySelectorAll("input"),i=0;i<r.length;i++)r.item(i).disabled=!e};this._searchManager.searchStarted.addHandler(()=>{u(!1)}),this._searchManager.searchCompleted.addHandler(()=>{c=!0,this._clearPreHightLights(),l.itemsSource=this._searchManager.searchResult,c=!1,u(!0)}),this._searchManager.currentChanged.addHandler(()=>{c||d||this._searchManager.current&&(d=!0,l.selectedIndex=this._searchManager.currentIndex,d=!1)});var p=()=>{this._searchManager.clear(),l.itemsSource=null,o.checked=!1,a.checked=!1,n.value="",this._documentSource&&this._documentSource.features&&(!this._documentSource.paginated||this._documentSource.features.textSearchInPaginatedMode)?e.show(r):e.hide(r)};this._documentSourceChanged.addHandler(()=>{this._documentSource&&_addWjHandler(this._documentEventKey,this._documentSource.loadCompleted,p),p()}),_addEvent(o,"click",()=>{this._searchManager.matchCase=o.checked}),_addEvent(a,"click",()=>{this._searchManager.wholeWord=a.checked}),_addEvent(n,"input",()=>{this._searchManager.text=n.value}),_addEvent(n,"keyup",e=>{var t=e||window.event;t.keyCode===wjcCore.Key.Enter&&this._searchManager.search(t.shiftKey)}),_addEvent(h,"click",()=>this._searchManager.search()),_addEvent(s,"click",()=>this._searchManager.search(!0)),_addEvent(r.header,"keydown",e=>{var t,r=this._toolbar;e.keyCode===wjcCore.Key.Tab&&(t=r.querySelector("[tabIndex=0]")||r.querySelector('input:not([type="hidden"])')||r)&&t.focus&&(t.focus(),e.preventDefault())})})}_initSidePanelOutlines(){var e=wjcCore.Control.getControl(this._sidePanel),t=e.addPage(wjcCore.culture.Viewer.outlines,exports.icons.outlines);this._gOutlinesTitle=t.outContent.querySelector(".wj-tabtitle"),this._outlinesPageId=t.id,t.format(t=>{wjcCore.addClass(t.content,"wj-outlines-tree");var r=new wjcGrid.FlexGrid(t.content);r.initialize({autoGenerateColumns:!1,columns:[{binding:"caption",width:"*"}],isReadOnly:!0,childItemsPath:"children",allowResizing:wjcGrid.AllowResizing.None,headersVisibility:wjcGrid.HeadersVisibility.None}),r.itemFormatter=function(e,t,r,i){var o;o=i.firstElementChild?i.firstElementChild.outerHTML:"&nbsp;&nbsp;&nbsp;&nbsp;";var a=e.rows[t].dataItem;i.innerHTML=o+"<a>"+a.caption+"</a>"};var i=!0;r.selectionChanged.addHandler((t,r)=>{if(!i){var o=r.panel.rows[r.row];if(o){var a=o.dataItem;if(a.position)this._scrollToPosition(a.position,!0);else if(a.target){if(!this._documentSource)return;this._documentSource.getBookmark(a.target).then(e=>{a.position=e,t.getSelectedState(r.row,r.col)!=wjcGrid.SelectedState.None&&this._scrollToPosition(e,!0)},e=>{})}this._isMobileTemplate()&&e.collapse()}}});var o=!1,a=()=>{o||e.isCollapsed||!t.isActived||t.isHidden||(r.refresh(),o=!0)},n=()=>{if(!this._documentSource)return r.itemsSource=null,void e.hide(t);_addWjHandler(this._documentEventKey,this._documentSource.loadCompleted,()=>{if(!this._documentSource.hasOutlines)return r.itemsSource=null,void e.hide(t);this._documentSource.getOutlines().then(n=>{o=!1,r.itemsSource=n,e.show(t),a(),i=!1})})};this._documentSourceChanged.addHandler(n),e.expanded.addHandler(a),e.tabPageActived.addHandler(a),n()})}_initSidePanelThumbnails(){var e=wjcCore.Control.getControl(this._sidePanel),t=e.addPage(wjcCore.culture.Viewer.thumbnails,exports.icons.thumbnails);this._gThumbnailsTitle=t.outContent.querySelector(".wj-tabtitle"),this._thumbnailsPageId=t.id,t.format(t=>{wjcCore.addClass(t.content,"wj-thumbnaillist");var r=new wjcInput.ListBox(t.content),i=null,o=!1;r.formatItem.addHandler((e,t)=>{var r=t.item,i=t.data;if(r.innerHTML="",this._pageView.pages){var o=document.createElement("div"),n=_toDOM('<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml: space = "preserve" ></svg>'),s=document.createElementNS("http://www.w3.org/2000/svg","g"),h=document.createElementNS("http://www.w3.org/2000/svg","image"),l=document.createElement("div"),c=this._pageView.pages[t.index],d=c.size.height.valueInPixel*ViewerBase._thumbnailWidth/c.size.width.valueInPixel;wjcCore.addClass(r,"wj-thumbnail-item"),i().then(e=>{h.setAttributeNS("http://www.w3.org/1999/xlink","href",e)}),h.setAttribute("x","0"),h.setAttribute("y","0"),h.setAttribute("width",ViewerBase._thumbnailWidth.toString()),h.setAttribute("height",d.toString()),wjcCore.addClass(o,"wj-pagethumbnail"),o.setAttribute("tabIndex","-1"),s.appendChild(h),n.appendChild(s),o.appendChild(n),r.appendChild(o),a(n,c),l.className="page-index",l.innerHTML=(t.index+1).toString(),r.appendChild(l)}}),r.selectedIndexChanged.addHandler(()=>{o||r.selectedIndex<0||r.selectedIndex==this._pageIndex||(this.moveToPage(r.selectedIndex),this._isMobileTemplate()&&e.collapse())}),this.pageIndexChanged.addHandler(()=>r.selectedIndex=this._pageIndex);var a=(e,t)=>{var r=ViewerBase._thumbnailWidth,i=t.size.height.valueInPixel*r/t.size.width.valueInPixel,o=e.parentNode;switch(_transformSvg(e,r,i,1,t.rotateAngle),t.rotateAngle){case _RotateAngle.Rotation90:case _RotateAngle.Rotation270:var a=i;i=r,r=a}o.style.width=r+"px",o.style.height=i+"px",e.setAttribute("width",r.toString()),e.setAttribute("height",i.toString())},n=()=>{if(!this._documentSource||!this._documentSource.isLoadCompleted||!this._documentSource.pageCount)return null;for(var e=[],t=0;t<this._documentSource.pageCount;t++)(t=>{e.push(()=>{var e=new _Promise;return this._documentSource.getExportedUrl({format:"png",resolution:50,outputRange:t+1}).then(t=>{this._documentSource&&this._documentSource._innerService&&!this._documentSource.isDisposed||e.resolve(null),this._documentSource._innerService.downloadDataUrl(t).then(t=>{e.resolve(t)},t=>e.resolve(null))},t=>e.resolve(null)),e})})(t);return e},s=()=>{!e.isCollapsed&&t.isActived&&(i=i||n(),t.isActived&&r.itemsSource!==i&&r.deferUpdate(()=>{o=!0,r.itemsSource=i,r.selectedIndex=this._pageIndex,o=!1}))},h=()=>{if(!this._documentSource||!this._documentSource.paginated||!this._documentSource.hasThumbnails)return e.hide(t),void(r.itemsSource=null);e.show(t),i=null,s()},l=()=>{if(!this._documentSource||!this._documentSource.hasThumbnails)return e.hide(t),void(r.itemsSource=null);_addWjHandler(this._documentEventKey,this._documentSource.loadCompleted,h),_addWjHandler(this._documentEventKey,this._documentSource.pageCountChanged,h),_addWjHandler(this._documentEventKey,this._documentSource.pageSettingsChanged,h),h()};this._documentSourceChanged.addHandler(l),l(),e.expanded.addHandler(()=>{e.activedTabPage.id===this._thumbnailsPageId&&s()}),e.tabPageActived.addHandler(()=>{e.activedTabPage.id===this._thumbnailsPageId&&s()}),s(),this._pageView.rotateAngleChanged.addHandler(()=>{for(var e=r.hostElement.querySelectorAll("svg"),t=0;t<e.length;t++)a(e.item(t),this._pageView.pages[t])})})}_initSidePanelExports(){var e=wjcCore.Control.getControl(this._sidePanel),t=e.addPage(wjcCore.culture.Viewer.exports,exports.icons.exports);this._gExportsPageTitle=t.outContent.querySelector(".wj-tabtitle"),this._exportsPageId=t.id,t.format(t=>{var r=_toDOMs('<div class="wj-exportcontainer"><label wj-part="g-wj-exportformat">'+wjcCore.culture.Viewer.exportFormat+'</label><div class="wj-exportformats"></div></div>');t.outContent.querySelector(".wj-tabtitle-wrapper").appendChild(r),this._gExportFormatTitle=t.outContent.querySelector('[wj-part="g-wj-exportformat"]');var i=t.outContent.querySelector(".wj-exportformats");new wjcInput.ComboBox(i),wjcCore.addClass(t.content.parentElement,"wj-exportformats-wrapper");var o=document.createElement("div"),a=new _ExportOptionEditor(o);t.content.appendChild(o);var n=_toDOMs('<div class="wj-exportformats-footer"><a wj-part="btn-apply" class="wj-btn wj-applybutton" tabindex="-1">'+wjcCore.culture.Viewer.exportOk+"</a></div>");t.content.appendChild(n);var s=t.content.querySelector('[wj-part="btn-apply"]');this._gExportsPageApplyBtn=s,_addEvent(s,"click",()=>{this._documentSource.export(a.options),e.collapse()})});var r=!0;this._documentSourceChanged.addHandler(()=>{r=!0,this._documentSource&&_addWjHandler(this._documentEventKey,this._documentSource.loadCompleted,()=>{r&&this._ensureExportFormatsLoaded().then(()=>{this._updateExportTab(),r=null==this._exportFormats})})}),e.tabPageActived.addHandler(()=>{r&&e.activedTabPage.id===this._exportsPageId&&this._ensureExportFormatsLoaded().then(()=>{this._updateExportTab(),r=null==this._exportFormats})})}_ensureExportFormatsLoaded(){if(!this._exportFormats&&this._documentSource&&!this._documentSource.isDisposed&&this._documentSource.isInstanceCreated)return this._documentSource.getSupportedExportDescriptions().then(e=>{this._exportFormats=e,this._setViewerAction(_ViewerActionType.ShowExportsPanel)});var e=new _Promise;return e.resolve(),e}_updateExportTab(e){if(this._exportFormats){var t=wjcCore.Control.getControl(this._sidePanel).getTabPage(this._exportsPageId),r=wjcCore.Control.getControl(t.outContent.querySelector(".wj-exportformats")),i=wjcCore.Control.getControl(t.content.firstElementChild);if(e)i.refresh(),r.itemsSource&&r.itemsSource.forEach(e=>{e.name=this._exportItemDescriptions[e.format].name}),r.refresh();else{var o=[];this._exportFormats.forEach(e=>{var t=this._exportItemDescriptions[e.format];isIOS()&&!t.supportIOS||(e.name=t.name,o.push(e))}),r.selectedIndexChanged.addHandler(()=>{i.exportDescription=r.selectedItem}),r.itemsSource=o,r.displayMemberPath="name",r.selectedValuePath="format",r.selectedIndex=-1}}}_initSidePanelPageSetup(){var e=wjcCore.Control.getControl(this._sidePanel),t=e.addPage(wjcCore.culture.Viewer.pageSetup,exports.icons.pageSetup);this._gPageSetupTitle=t.outContent.querySelector(".wj-tabtitle"),this._pageSetupPageId=t.id,t.format(t=>{var r=document.createElement("div"),i=new _PageSetupEditor(r);t.content.appendChild(r),wjcCore.addClass(r,"wj-pagesetupcontainer");var o=_toDOMs('<div class="wj-pagesetup-footer"><a wj-part="btn-apply" class="wj-btn wj-applybutton" tabindex="-1">'+wjcCore.culture.Viewer.ok+"</a></div>");t.content.appendChild(o);var a=t.content.querySelector('[wj-part="btn-apply"]');this._gPageSetupApplyBtn=a,_addEvent(a,"click",()=>{this._setPageSettings(i.pageSettings),e.collapse()});var n=()=>{i.pageSettings=this._documentSource.pageSettings},s=()=>{this._documentSource&&(_addWjHandler(this._documentEventKey,this._documentSource.pageSettingsChanged,n),n())};this._documentSourceChanged.addHandler(s),s()})}_executeAction(e){if(!this._actionIsDisabled(e))switch(e){case _ViewerActionType.TogglePaginated:this._innerPaginated=!this._innerPaginated;break;case _ViewerActionType.Print:this._documentSource&&this._documentSource.print(this._pages.map(e=>e.rotateAngle));break;case _ViewerActionType.ShowExportsPanel:wjcCore.Control.getControl(this._sidePanel).active(this._exportsPageId);break;case _ViewerActionType.Portrait:this._setPageLandscape(!1);break;case _ViewerActionType.Landscape:this._setPageLandscape(!0);break;case _ViewerActionType.ShowPageSetupDialog:this.showPageSetupDialog();break;case _ViewerActionType.FirstPage:this.moveToPage(0);break;case _ViewerActionType.LastPage:this._moveToLastPage();break;case _ViewerActionType.PrePage:this.moveToPage(this._pageIndex-1);break;case _ViewerActionType.NextPage:this.moveToPage(this._pageIndex+1);break;case _ViewerActionType.Backward:this._moveBackwardHistory();break;case _ViewerActionType.Forward:this._moveForwardHistory();break;case _ViewerActionType.SelectTool:this.mouseMode=MouseMode.SelectTool;break;case _ViewerActionType.MoveTool:this.mouseMode=MouseMode.MoveTool;break;case _ViewerActionType.Continuous:this._addHistory(!1,!0),this.viewMode=ViewMode.Continuous;break;case _ViewerActionType.Single:this._addHistory(!1,!0),this.viewMode=ViewMode.Single;break;case _ViewerActionType.FitPageWidth:this.zoomMode=ZoomMode.PageWidth;break;case _ViewerActionType.FitWholePage:this.zoomMode=ZoomMode.WholePage;break;case _ViewerActionType.ZoomOut:this._zoomBtnClicked(!1,ViewerBase._defaultZoomValues);break;case _ViewerActionType.ZoomIn:this._zoomBtnClicked(!0,ViewerBase._defaultZoomValues);break;case _ViewerActionType.ToggleFullScreen:this.fullScreen=!this.fullScreen;break;case _ViewerActionType.ShowHamburgerMenu:this._hamburgerMenu.showMenu();break;case _ViewerActionType.ShowViewMenu:this._viewMenu.showMenu();break;case _ViewerActionType.ShowSearchBar:this._showSearchBar(wjcCore.hasClass(this._searchBar,exports._hiddenCss)),this._setViewerAction(_ViewerActionType.ShowSearchBar);break;case _ViewerActionType.ShowThumbnails:wjcCore.Control.getControl(this._sidePanel).active(this._thumbnailsPageId);break;case _ViewerActionType.ShowOutlines:wjcCore.Control.getControl(this._sidePanel).active(this._outlinesPageId);break;case _ViewerActionType.ShowPageSetupPanel:wjcCore.Control.getControl(this._sidePanel).active(this._pageSetupPageId);break;case _ViewerActionType.ShowZoomBar:this._showFooter(!0);break;case _ViewerActionType.SearchPrev:this._searchManager.search(!0);break;case _ViewerActionType.SearchNext:this._searchManager.search();break;case _ViewerActionType.ShowSearchOptions:this._searchOptionsMenu.showMenu(!0);break;case _ViewerActionType.SearchMatchCase:this._searchManager.matchCase=!this._searchManager.matchCase;break;case _ViewerActionType.SearchMatchWholeWord:this._searchManager.wholeWord=!this._searchManager.wholeWord;break;case _ViewerActionType.RubberbandTool:this.mouseMode=MouseMode.RubberbandTool;break;case _ViewerActionType.MagnifierTool:this.mouseMode=MouseMode.MagnifierTool;break;case _ViewerActionType.RotateDocument:this._rotateDocument();break;case _ViewerActionType.RotatePage:this._rotatePage()}}_initSearchOptionsMenu(e){this._searchOptionsMenu=new _SearchOptionsMenu(this,e)}_initHamburgerMenu(e){this._hamburgerMenu=new _HamburgerMenu(this,e)}_initViewMenu(e){this._viewMenu=new _ViewMenu(this,e)}_initToolbar(){new _ViewerToolbar(this._toolbar,this),new _ViewerMobileToolbar(this._mobileToolbar,this)}_clearExportFormats(){this._exportFormats=null}get _exportItemDescriptions(){return ViewerBase._exportItems||(ViewerBase._exportItems={pdf:{name:wjcCore.culture.Viewer.pdfExportName,supportIOS:!0},doc:{name:wjcCore.culture.Viewer.docExportName,supportIOS:!1},docx:{name:wjcCore.culture.Viewer.docxExportName,supportIOS:!1},rtf:{name:wjcCore.culture.Viewer.rtfExportName,supportIOS:!1},xlsx:{name:wjcCore.culture.Viewer.xlsxExportName,supportIOS:!0},xls:{name:wjcCore.culture.Viewer.xlsExportName,supportIOS:!0},mhtml:{name:wjcCore.culture.Viewer.mhtmlExportName,supportIOS:!0},html:{name:wjcCore.culture.Viewer.htmlExportName,supportIOS:!0},zip:{name:wjcCore.culture.Viewer.metafileExportName,supportIOS:!1},csv:{name:wjcCore.culture.Viewer.csvExportName,supportIOS:!0},tiff:{name:wjcCore.culture.Viewer.tiffExportName,supportIOS:!0},bmp:{name:wjcCore.culture.Viewer.bmpExportName,supportIOS:!1},emf:{name:wjcCore.culture.Viewer.emfExportName,supportIOS:!1},gif:{name:wjcCore.culture.Viewer.gifExportName,supportIOS:!1},jpeg:{name:wjcCore.culture.Viewer.jpegExportName,suportIOS:!1},jpg:{name:wjcCore.culture.Viewer.jpegExportName,supportIOS:!1},png:{name:wjcCore.culture.Viewer.pngExportName,supportIOS:!1},xml:{name:"XML document",supportIOS:!1}}),ViewerBase._exportItems}_actionIsChecked(e){switch(e){case _ViewerActionType.TogglePaginated:return!0===this._innerPaginated;case _ViewerActionType.Landscape:return!(!this._documentSource||!this._documentSource.pageSettings)&&this._documentSource.pageSettings.landscape;case _ViewerActionType.Portrait:return!(!this._documentSource||!this._documentSource.pageSettings)&&!this._documentSource.pageSettings.landscape;case _ViewerActionType.SelectTool:return this.mouseMode===MouseMode.SelectTool;case _ViewerActionType.MoveTool:return this.mouseMode===MouseMode.MoveTool;case _ViewerActionType.RubberbandTool:return this.mouseMode===MouseMode.RubberbandTool;case _ViewerActionType.MagnifierTool:return this.mouseMode===MouseMode.MagnifierTool;case _ViewerActionType.Continuous:return this.viewMode==ViewMode.Continuous;case _ViewerActionType.Single:return this.viewMode==ViewMode.Single;case _ViewerActionType.ToggleFullScreen:return this.fullScreen;case _ViewerActionType.FitPageWidth:return this.zoomMode==ZoomMode.PageWidth;case _ViewerActionType.FitWholePage:return this.zoomMode==ZoomMode.WholePage;case _ViewerActionType.SearchMatchCase:return this._searchManager.matchCase;case _ViewerActionType.SearchMatchWholeWord:return this._searchManager.wholeWord;case _ViewerActionType.ShowSearchBar:return!wjcCore.hasClass(this._searchBar,exports._hiddenCss)}return!1}_isDocumentSourceLoaded(){return this._documentSource&&this._documentSource.isLoadCompleted}_actionIsDisabled(e){if(!(this._isDocumentSourceLoaded()&&this._documentSource.pageCount>0))return!0;switch(e){case _ViewerActionType.TogglePaginated:return null==this._innerPaginated;case _ViewerActionType.ShowExportsPanel:return!this._exportFormats||0===this._exportFormats.length;case _ViewerActionType.Landscape:case _ViewerActionType.Portrait:case _ViewerActionType.ShowPageSetupDialog:case _ViewerActionType.ShowPageSetupPanel:return!this._documentSource||!this._documentSource.pageSettings||!this._documentSource.paginated;case _ViewerActionType.FirstPage:case _ViewerActionType.PrePage:return this._pageIndex<=0;case _ViewerActionType.LastPage:case _ViewerActionType.NextPage:return this._pageIndex>=this._documentSource.pageCount-1;case _ViewerActionType.Backward:return!this._historyManager.canBackward();case _ViewerActionType.Forward:return!this._historyManager.canForward();case _ViewerActionType.Continuous:case _ViewerActionType.Single:return!this._documentSource||!this._documentSource.paginated;case _ViewerActionType.ZoomOut:return this.zoomFactor<=ViewerBase._defaultZoomValues[0].value;case _ViewerActionType.ZoomIn:var t=ViewerBase._defaultZoomValues;return this.zoomFactor>=t[t.length-1].value}return!1}_actionIsShown(e){var t=this._documentSource?this._documentSource.features:null;switch(e){case _ViewerActionType.TogglePaginated:return t&&t.paginated&&t.nonPaginated;case _ViewerActionType.Landscape:case _ViewerActionType.Portrait:case _ViewerActionType.ShowPageSetupDialog:case _ViewerActionType.ShowPageSetupPanel:return t?t.pageSettings:this._supportsPageSettingActions();case _ViewerActionType.SelectTool:case _ViewerActionType.MoveTool:case _ViewerActionType.MagnifierTool:case _ViewerActionType.RubberbandTool:return!wjcCore.isMobile();case _ViewerActionType.ShowSearchBar:return t&&(!this._documentSource.paginated||t.textSearchInPaginatedMode);case _ViewerActionType.ShowOutlines:return this._documentSource&&this._documentSource.hasOutlines;case _ViewerActionType.ShowThumbnails:return this._documentSource&&this._documentSource.hasThumbnails}return!0}_onViewerActionStatusChanged(e){this._viewerActionStatusChanged.raise(this,e)}_setViewerAction(e,t,r,i){var o={actionType:e,disabled:t||this._actionIsDisabled(e),checked:r||this._actionIsChecked(e),shown:i||this._actionIsShown(e)};this._onViewerActionStatusChanged({action:o})}_updateViewerActions(){this._updatePageSettingsActions(),this._updateViewModeActions(),this._updateMouseModeActions(),this._setViewerAction(_ViewerActionType.ShowExportsPanel)}_updateViewModeActions(){this._setViewerAction(_ViewerActionType.Continuous),this._setViewerAction(_ViewerActionType.Single)}_updatePageSettingsActions(){this._setViewerAction(_ViewerActionType.TogglePaginated),this._setViewerAction(_ViewerActionType.Landscape),this._setViewerAction(_ViewerActionType.Portrait),this._setViewerAction(_ViewerActionType.ShowPageSetupDialog)}_updateMouseModeActions(){this._setViewerAction(_ViewerActionType.SelectTool),this._setViewerAction(_ViewerActionType.MoveTool),this._setViewerAction(_ViewerActionType.MagnifierTool),this._setViewerAction(_ViewerActionType.RubberbandTool)}_updateZoomModeActions(){this._setViewerAction(_ViewerActionType.FitPageWidth),this._setViewerAction(_ViewerActionType.FitWholePage)}_updateZoomFactorActions(){this._setViewerAction(_ViewerActionType.ZoomOut),this._setViewerAction(_ViewerActionType.ZoomIn)}_onPageSettingsUpdated(){this._updatePageSettingsActions(),this._updateViewModeActions(),this._resetToolbarWidth()}_onPageCountUpdated(){this._updatePageNavActions(),this._resetToolbarWidth()}_updatePageNavActions(){this._setViewerAction(_ViewerActionType.FirstPage),this._setViewerAction(_ViewerActionType.LastPage),this._setViewerAction(_ViewerActionType.PrePage),this._setViewerAction(_ViewerActionType.NextPage)}_onHistoryManagerStatusUpdated(){this._setViewerAction(_ViewerActionType.Backward),this._setViewerAction(_ViewerActionType.Forward)}_updateUI(){Object.keys(_ViewerActionType).forEach(e=>{isNaN(e)||this._setViewerAction(_ViewerActionType[_ViewerActionType[e]])});var e=wjcCore.Control.getControl(this._sidePanel);e&&e.enableAll(this._isDocumentSourceLoaded())}_updateViewContainerCursor(){this.mouseMode===MouseMode.MoveTool?wjcCore.hasClass(this._viewpanelContainer,"move")||wjcCore.addClass(this._viewpanelContainer,"move"):wjcCore.hasClass(this._viewpanelContainer,"move")&&wjcCore.removeClass(this._viewpanelContainer,"move")}_updateFullScreenStyle(){var e=document.body;this.fullScreen?(this._bodyOriginScrollLeft=document.documentElement&&document.documentElement.scrollLeft||e.scrollLeft,this._bodyOriginScrollTop=document.documentElement&&document.documentElement.scrollTop||e.scrollTop,wjcCore.addClass(this.hostElement,"full-screen"),wjcCore.addClass(e,"full-screen"),this._hostOriginWidth=this.hostElement.style.width,this._hostOriginHeight=this.hostElement.style.height,this.hostElement.style.width="100%",this.hostElement.style.height="100%",window.scrollTo(0,0)):(wjcCore.removeClass(this.hostElement,"full-screen"),wjcCore.removeClass(e,"full-screen"),this.hostElement.style.width=this._hostOriginWidth,this.hostElement.style.height=this._hostOriginHeight,wjcCore.isNumber(this._bodyOriginScrollLeft)&&(document.documentElement&&(document.documentElement.scrollLeft=this._bodyOriginScrollLeft),e.scrollLeft=this._bodyOriginScrollLeft),wjcCore.isNumber(this._bodyOriginScrollTop)&&(document.documentElement&&(document.documentElement.scrollTop=this._bodyOriginScrollTop),e.scrollTop=this._bodyOriginScrollTop)),this.refresh()}showPageSetupDialog(){this._pageSetupDialog||this._createPageSetupDialog(),this._pageSetupDialog.showWithValue(this._documentSource.pageSettings)}_createPageSetupDialog(){var e=this,t=document.createElement("div");t.style.display="none",e.hostElement.appendChild(t),e._pageSetupDialog=new _PageSetupDialog(t),e._pageSetupDialog.applied.addHandler(()=>e._setPageSettings(e._pageSetupDialog.pageSettings))}zoomToView(){wjcCore._deprecated("zoomToView","zoomMode"),this._documentSource&&(this.zoomMode=ZoomMode.WholePage)}zoomToViewWidth(){wjcCore._deprecated("zoomToViewWidth","zoomMode"),this._documentSource&&(this.zoomMode=ZoomMode.PageWidth)}_setPageLandscape(e){var t=this,r=this._documentSource.pageSettings;_setLandscape(r,e),t._setPageSettings(r)}_setPaginated(e){var t=this._documentSource.features,r=this._documentSource.pageSettings;t&&r&&e!=r.paginated&&(e&&t.paginated?(r.paginated=!0,this._setPageSettings(r)):!e&&t.nonPaginated&&(r.paginated=!1,this._setPageSettings(r)))}_setPageSettings(e){return this._showViewPanelMessage(),this._setDocumentRendering(),this._documentSource.setPageSettings(e).then(e=>{this._resetDocument(),this._reRenderDocument()}).catch(e=>{this._showViewPanelErrorMessage(_getErrorMessage(e))})}_showViewPanelErrorMessage(e){this._showViewPanelMessage(e,"errormessage")}_showViewPanelMessage(e,t){var r=this._viewpanelContainer.querySelector(".wj-viewer-loading");r||((r=document.createElement("div")).innerHTML='<span class="verticalalign"></span><span class="textspan"></span>',this._viewpanelContainer.appendChild(r)),r.className="wj-viewer-loading",t&&wjcCore.addClass(r,t);var i=r.querySelector(".textspan");i&&(i.innerHTML=e||wjcCore.culture.Viewer.loading)}_removeViewPanelMessage(){var e=this._viewpanelContainer.querySelector(".wj-viewer-loading");e&&this._viewpanelContainer.removeChild(e)}_reRenderDocument(){this._documentSource&&(this._showViewPanelMessage(),this._documentSource.load())}_zoomBtnClicked(e,t){var r,i;for(r=0;r<t.length;r++){if(t[r].value>this.zoomFactor){i=r-.5;break}if(t[r].value===this.zoomFactor){i=r;break}}null==i&&(i=t.length-.5),i<=0&&!e||i>=t.length-1&&e||(i=e?Math.floor(i)+1:Math.ceil(i)-1,this.zoomFactor=t[i].value)}_getDocumentSource(){return this._documentSource}_setDocumentSource(e){this._loadDocument(e).then(t=>{this._documentSource==e&&this._ensureExportFormatsLoaded()})}_loadDocument(e,t=!1,r=!0){var i=new _Promise;return this._documentSource!==e||t?(this._disposeDocument(r),this._documentSource=e,e&&(_addWjHandler(this._documentEventKey,e.loading,()=>{this._updateUI()},this),_addWjHandler(this._documentEventKey,e.loadCompleted,this._onDocumentSourceLoadCompleted,this),_addWjHandler(this._documentEventKey,e.queryLoadingData,(e,t)=>{this.onQueryLoadingData(t)},this),e.isLoadCompleted?(this._onDocumentSourceLoadCompleted(),this._keepServiceConnection(),i.resolve()):(this._showViewPanelMessage(),e.load().then(e=>{this._keepServiceConnection(),i.resolve(e)}).catch(e=>{this._showViewPanelErrorMessage(_getErrorMessage(e))}))),this._onDocumentSourceChanged(),i):i}_actionElementClicked(e){var t=this._getActionInfo(e);t&&(t.kind===_ActionKind.Bookmark?this._goToBookmark(t):t.kind===_ActionKind.Custom&&this._executeCustomAction(t))}_getActionInfo(e){var t=e.getAttribute(_Page._bookmarkAttr);return t?{kind:_ActionKind.Bookmark,data:t}:(t=e.getAttribute(_Page._customActionAttr))?{kind:_ActionKind.Custom,data:t}:null}_onDocumentSourceLoadCompleted(){var e=this._documentSource.errors;if(this._documentSource.isLoadCompleted){if(this._removeViewPanelMessage(),this._pages.length=0,this._documentSource.pageCount<=0)return void this._updateUI();for(var t={width:this._documentSource.pageSettings.width,height:this._documentSource.pageSettings.height},r=0;r<this._documentSource.pageCount;r++){var i=this._createPage(r,t);i.linkClicked.addHandler((e,t)=>{this._magnifier&&this._magnifier.isActive||this._rubberband&&this._rubberband.isActive||this._actionElementClicked(t.element)}),this._pages.push(i)}this._pageView.pages=this._pages,this._autoHeightCalculated||(this._autoCalculateHeight(),this._autoHeightCalculated=!0);var o=this._documentSource.initialPosition||this._initialPosition;if(this._documentSource.initialPosition=null,this._initialPosition=null,o&&0!=o.pageIndex||(this._pageIndex=0,o={pageIndex:0}),this._scrollToPosition(o),this._updateHistoryCurrent(),this._documentSource.paginated||(this.viewMode=ViewMode.Single),e&&e.length>0)for(r=0;r<e.length;r++)e[r]+"\r\n";this._updateUI()}}_createPage(e,t){return new _Page(this._documentSource,e,t)}_clearKeepSerConnTimer(){null!=this._keepSerConnTimer&&clearTimeout(this._keepSerConnTimer)}_keepServiceConnection(){this._clearKeepSerConnTimer();var e=this._documentSource;e&&(this._keepSerConnTimer=setTimeout(()=>{this._documentSource===e&&this._documentSource.getStatus().then(e=>this._keepServiceConnection())},this._getExpiredTime()))}_getExpiredTime(){if(this._expiredTime)return this._expiredTime;var e=this._documentSource;return e&&e.expiredDateTime&&e.executionDateTime?(this._expiredTime=e.expiredDateTime.getTime()-e.executionDateTime.getTime(),this._expiredTime=Math.max(this._expiredTime-12e4,0),this._expiredTime):6e3}_disposeDocument(e=!0){this._documentSource&&(_removeAllWjHandlers(this._documentEventKey,this._documentSource.disposed),_removeAllWjHandlers(this._documentEventKey,this._documentSource.pageCountChanged),_removeAllWjHandlers(this._documentEventKey,this._documentSource.pageSettingsChanged),_removeAllWjHandlers(this._documentEventKey,this._documentSource.loadCompleted),_removeAllWjHandlers(this._documentEventKey,this._documentSource.queryLoadingData),e&&this._documentSource.dispose()),this._resetDocument()}_resetDocument(){this._pages.length=0,this._pageView.resetPages(),this._pageIndex=0,clearTimeout(this._historyTimer),this._historyManager.clear(),this._rubberband&&this._rubberband.reset(),this._magnifier&&this._magnifier.reset()}_setDocumentRendering(){this._documentSource._updateIsLoadCompleted(!1)}moveToPage(e){return this._innerMoveToPage(e)}_getCurrentPosition(){return _getPositionByHitTestInfo(this._pageView.hitTest(0,0))}_resolvePageIndex(e){return Math.min(this._documentSource.pageCount-1,Math.max(e,0))}_innerMoveToPage(e){return this._resolvePageIndex(e)!=this.pageIndex&&this._addHistory(!1,!0),this._updatePageIndex(e),this._pageView.moveToPage(e)}_moveToLastPage(){var e=new _Promise;return this._ensureDocumentLoadCompleted(e)?this._innerMoveToPage(this._documentSource.pageCount-1):e}_moveBackwardHistory(){if(this._ensureDocumentLoadCompleted()&&this._historyManager.canBackward()){var e=this._historyManager.backward();this._moveToHistory(e)}}_moveForwardHistory(){if(this._ensureDocumentLoadCompleted()&&this._historyManager.canForward()){var e=this._historyManager.forward();this._moveToHistory(e)}}_moveToHistory(e){if(e){this._historyMoving=!0,this.viewMode=e.viewMode,e.zoomMode===ZoomMode.Custom?this.zoomFactor=e.zoomFactor:this.zoomMode=e.zoomMode,this._scrollToPosition(e.position).then(e=>{this._historyMoving=!1});for(var t=0;t<e.pageAngles.length;t++)this._pageView.rotatePageTo(t,e.pageAngles[t])}}_isPositionEquals(e,t,r){return e.pageIndex===t.pageIndex&&(!r||(e.pageBounds==t.pageBounds||null!=e.pageBounds&&null!=t.pageBounds&&(e.pageBounds.x===t.pageBounds.x&&e.pageBounds.y===t.pageBounds.y)))}_isPageAnglesChanged(e){if(e.length!=this._pageView.pages.length)return!0;for(var t=e.length,r=0;r<t;r++)if(e[r]!==this._pageView.pages[r].rotateAngle)return!0;return!1}_updateHistoryCurrent(){this._historyManager.current.position=this._getCurrentPosition(),this._historyManager.current.zoomMode=this.zoomMode,this._historyManager.current.zoomFactor=this.zoomFactor,this._historyManager.current.viewMode=this.viewMode,this._updateCurrentPageAngles(this._historyManager.current)}_innerAddHistory(e){var t=this._getCurrentPosition(),r=this._historyManager.current;this._isPositionEquals(t,r.position,e)&&this.viewMode===r.viewMode&&this.zoomMode===r.zoomMode&&this.zoomFactor===r.zoomFactor&&!this._isPageAnglesChanged(r.pageAngles)||(r.position=r.position||this._getCurrentPosition(),r.viewMode=null==r.viewMode?this.viewMode:r.viewMode,r.zoomMode=null==r.zoomMode?this.zoomMode:r.zoomMode,r.zoomFactor=null==r.zoomFactor?this.zoomFactor:r.zoomFactor,r.pageAngles||this._updateCurrentPageAngles(r),this._historyManager.add(),this._updateHistoryCurrent())}_addHistory(e,t,r){this.isUpdating||this._historyMoving||!this._isDocumentSourceLoaded()||(t?(this._mergeHistory(r),null!=this._historyTimer&&clearTimeout(this._historyTimer),this._historyTimer=setTimeout(()=>{this._historyTimer=null,this._innerAddHistory(e)},ViewerBase._historyTimeout)):this._innerAddHistory(e))}_updateCurrentPageAngles(e){e.pageAngles||(e.pageAngles=new Array);for(var t=this._pageView.pages.length,r=0;r<t;r++)e.pageAngles[r]=this._pageView.pages[r].rotateAngle}_mergeHistory(e){var t=this._historyManager.current;if(!e)return t.viewMode=this.viewMode,t.zoomMode=this.zoomMode,t.zoomFactor=this.zoomFactor,void this._updateCurrentPageAngles(t);if(null!=e.viewMode&&(t.viewMode=e.viewMode),null!=e.zoomMode&&(t.zoomMode=e.zoomMode),null!=e.zoomFactor&&(t.zoomFactor=e.zoomFactor),e.pageAngles){t.pageAngles=new Array;for(var r=this._pageView.pages.length,i=0;i<r;i++)t.pageAngles[i]=e.pageAngles[i]}}_ensureDocumentLoadCompleted(e){return this._documentSource?!!this._documentSource.isLoadCompleted||(e&&e.reject("Cannot set page index when document source is not loaded completely."),!1):(e&&e.reject("Cannot set page index without document source."),!1)}_updatePageIndex(e){this._documentSource&&(e=Math.min(this._documentSource.pageCount-1,Math.max(e,0)),this._pageIndex!==e&&(this._pageIndex=e,this.onPageIndexChanged()))}_getRotatedAngle(e){switch(e){case _RotateAngle.NoRotate:return _RotateAngle.Rotation90;case _RotateAngle.Rotation90:return _RotateAngle.Rotation180;case _RotateAngle.Rotation180:return _RotateAngle.Rotation270;case _RotateAngle.Rotation270:return _RotateAngle.NoRotate}return _RotateAngle.NoRotate}_rotateDocument(){this._addHistory(!1,!0);for(var e=this._pageView.pages.length,t=0;t<e;t++)this._pageView.rotatePageTo(t,this._getRotatedAngle(this._pageView.pages[t].rotateAngle))}_rotatePage(){this._addHistory(!1,!0);var e=this._pageView.pages[this._pageIndex];this._pageView.rotatePageTo(this._pageIndex,this._getRotatedAngle(e.rotateAngle))}get zoomMode(){return this._pageView.zoomMode}set zoomMode(e){this._pageView.zoomMode=wjcCore.asEnum(e,ZoomMode),this._updateZoomModeActions()}get zoomFactor(){return this._pageView.zoomFactor}set zoomFactor(e){this._pageView.zoomFactor=e}get viewMode(){return this._viewMode}set viewMode(e){e=wjcCore.asEnum(e,ViewMode),this._viewMode!==e&&(this._viewMode=e,this.onViewModeChanged())}get selectMouseMode(){return this._mouseMode===MouseMode.SelectTool}set selectMouseMode(e){wjcCore._deprecated("selectMouseMode","mouseMode"),e&&this._mouseMode===MouseMode.SelectTool||!e&&this._mouseMode!==MouseMode.SelectTool||(this.mouseMode=e?MouseMode.SelectTool:MouseMode.MoveTool)}get mouseMode(){return this._mouseMode}set mouseMode(e){if(this._mouseMode===(e=wjcCore.asEnum(e,MouseMode)))return;let t=this.selectMouseMode;switch(this._mouseMode=e,this._mouseMode){case MouseMode.RubberbandTool:this._rubberband.activate(),this._magnifier.deactivate();break;case MouseMode.MagnifierTool:this._magnifier.activate(),this._rubberband.deactivate();break;default:this._magnifier.deactivate(),this._rubberband.deactivate()}this.onMouseModeChanged(),t!=this.selectMouseMode&&this.onSelectMouseModeChanged()}get fullScreen(){return this._fullScreen}set fullScreen(e){this._fullScreen!==e&&(this._fullScreen=e,this.onFullScreenChanged())}get pageIndex(){return this._pageIndex}_initMiniToolbar(){wjcCore.Control.getControl(this._miniToolbar)||(new _ViewerMiniToolbar(this._miniToolbar,this),wjcCore.addClass(this._miniToolbar,"wj-mini-toolbar"))}_pinMiniToolbar(){this._showMiniToolbar(!0),this._miniToolbarPinnedTimer=setTimeout(()=>{this._showMiniToolbar(!1),this._miniToolbarPinnedTimer=null},ViewerBase._miniToolbarPinnedTime)}_onDocumentSourceChanged(e){this._clearExportFormats(),this._documentSourceChanged.raise(this,e||new wjcCore.EventArgs),this._updateViewerActions(),this._onPageSettingsUpdated(),this._onPageCountUpdated(),this._updateViewModeActions(),this._searchManager.documentSource=this._documentSource,this._documentSource&&(_addWjHandler(this._documentEventKey,this._documentSource.pageSettingsChanged,this._onPageSettingsUpdated,this),_addWjHandler(this._documentEventKey,this._documentSource.pageCountChanged,this._onPageCountUpdated,this),_addWjHandler(this._documentEventKey,this._documentSource.loadCompleted,this._onPageCountUpdated,this))}onPageIndexChanged(e){this.pageIndexChanged.raise(this,e||new wjcCore.EventArgs),this._updatePageNavActions()}onViewModeChanged(e){this.viewModeChanged.raise(this,e||new wjcCore.EventArgs),this._updateViewModeActions(),this._pageView.viewMode=this.viewMode}onSelectMouseModeChanged(e){this.selectMouseModeChanged.hasHandlers&&wjcCore._deprecated("selectMouseModeChanged","mouseModeChanged"),this.selectMouseModeChanged.raise(this,e)}onMouseModeChanged(e){this.mouseModeChanged.raise(this,e||new wjcCore.EventArgs),(this.mouseMode!==MouseMode.MoveTool&&this.mouseMode!==MouseMode.SelectTool||!wjcCore.isMobile())&&(this._updateMouseModeActions(),this._updateViewContainerCursor(),this._pageView.panMode=this.mouseMode===MouseMode.MoveTool)}onFullScreenChanged(e){this.fullScreenChanged.raise(this,e||new wjcCore.EventArgs),this._setViewerAction(_ViewerActionType.ToggleFullScreen),this._updateFullScreenStyle(),this.fullScreen&&this._pinMiniToolbar()}onZoomFactorChanged(e){this.zoomFactorChanged.raise(this,e||new wjcCore.EventArgs),this._updateZoomFactorActions(),this._updateZoomModeActions()}onQueryLoadingData(e){this.queryLoadingData.raise(this,e)}onBeforeSendRequest(e){this.beforeSendRequest.raise(this,e)}beforeSend(e){this.onBeforeSendRequest(e)}}ViewerBase._seperatorHtml="<div class='wj-separator' style='width:100%;height: 1px;margin: 3px 0;background-color:rgba(0,0,0,.2)'></div>",ViewerBase._viewpanelContainerMinHeight=300,ViewerBase._miniToolbarPinnedTime=3e3,ViewerBase._narrowCss="narrow",ViewerBase._narrowWidthThreshold=400,ViewerBase._thumbnailWidth=100,ViewerBase._historyTimeout=300,ViewerBase._defaultZoomValues=[{name:wjcCore.Globalize.format(.05,"p0"),value:.05},{name:wjcCore.Globalize.format(.25,"p0"),value:.25},{name:wjcCore.Globalize.format(.5,"p0"),value:.5},{name:wjcCore.Globalize.format(.75,"p0"),value:.75},{name:wjcCore.Globalize.format(1,"p0"),value:1},{name:wjcCore.Globalize.format(2,"p0"),value:2},{name:wjcCore.Globalize.format(3,"p0"),value:3},{name:wjcCore.Globalize.format(4,"p0"),value:4},{name:wjcCore.Globalize.format(8,"p0"),value:8},{name:wjcCore.Globalize.format(10,"p0"),value:10}],ViewerBase.controlTemplate='<div class="wj-viewer-outer wj-content with-footer"><div wj-part="toolbar"></div><div wj-part="mobile-toolbar"></div><div class="wj-viewer-container" wj-part="viewer-container"><div class="wj-viewer-leftpanel" wj-part="viewer-left-panel"><div class="wj-viewer-tabsleft" wj-part="side-panel"></div></div><div class="wj-viewer-splitter" wj-part="splitter"><button class="wj-btn wj-btn-default"><span class="wj-glyph-right"></span></button></div><div class="wj-viewpanel-container" wj-part="viewpanel-container"></div></div><div wj-part="mini-toolbar"></div><div class="wj-searchbar mobile" wj-part="search-bar"></div><div class="wj-viewer-footer mobile" class="wj-viewer-footer" wj-part="viewer-footer"><div wj-part="zoom-bar"></div><span class="wj-close">×</span></div></div>',exports.ViewerBase=ViewerBase;class _PageSetupDialog extends wjcInput.Popup{constructor(e){super(e),this.applied=new wjcCore.Event;var t;this.modal=!0,this.hideTrigger=wjcInput.PopupTrigger.None,t=this.getTemplate(),this.applyTemplate("wj-control wj-content",t,{_gHeader:"g-header",_pageSetupEditorElement:"pagesetup-editor",_btnApply:"btn-apply",_btnCancel:"btn-cancel",_btnClose:"a-close"}),this._pageSetupEditor=new _PageSetupEditor(this._pageSetupEditorElement),this._globalize(),this._addEvents()}get pageSettings(){return this._pageSetupEditor.pageSettings}_globalize(){var e=wjcCore.culture.Viewer;this._gHeader.textContent=e.pageSetup,this._btnApply.textContent=e.ok,this._btnCancel.textContent=e.cancel}_addEvents(){var e=this;_addEvent(e._btnClose,"click",()=>{e.hide()}),_addEvent(e._btnCancel,"click",()=>{e.hide()}),_addEvent(e._btnApply,"click",()=>{e._apply(),e.hide()})}_apply(){this.onApplied()}onApplied(){this.applied.raise(this,new wjcCore.EventArgs)}showWithValue(e){this._pageSetupEditor.pageSettings=e,super.show()}refresh(e=!0){super.refresh(e),e&&(this._globalize(),this._pageSetupEditor.refresh())}}_PageSetupDialog.controlTemplate='<div><div wj-part="g-header" class="wj-dialog-header"><a class="wj-hide" wj-part="a-close" style="float:right;outline:none;text-decoration:none;padding:0px 6px" href="" tabindex="-1" draggable="false">&times;</a></div><div style="padding:12px;"><div wj-part="pagesetup-editor"></div></div><div class="wj-dialog-footer"><a wj-part="btn-apply" class="wj-hide wj-btn" tabindex="-1"></a>&nbsp;&nbsp;<a wj-part="btn-cancel" class="wj-hide wj-btn" tabindex="-1"></a></div></div>',exports._PageSetupDialog=_PageSetupDialog;var _ViewerActionType;!function(e){e[e.TogglePaginated=0]="TogglePaginated",e[e.Print=1]="Print",e[e.Portrait=2]="Portrait",e[e.Landscape=3]="Landscape",e[e.ShowPageSetupDialog=4]="ShowPageSetupDialog",e[e.FirstPage=5]="FirstPage",e[e.PrePage=6]="PrePage",e[e.NextPage=7]="NextPage",e[e.LastPage=8]="LastPage",e[e.PageNumber=9]="PageNumber",e[e.PageCountLabel=10]="PageCountLabel",e[e.Backward=11]="Backward",e[e.Forward=12]="Forward",e[e.SelectTool=13]="SelectTool",e[e.MoveTool=14]="MoveTool",e[e.Continuous=15]="Continuous",e[e.Single=16]="Single",e[e.ZoomOut=17]="ZoomOut",e[e.ZoomIn=18]="ZoomIn",e[e.ZoomValue=19]="ZoomValue",e[e.FitWholePage=20]="FitWholePage",e[e.FitPageWidth=21]="FitPageWidth",e[e.ToggleFullScreen=22]="ToggleFullScreen",e[e.ShowHamburgerMenu=23]="ShowHamburgerMenu",e[e.ShowViewMenu=24]="ShowViewMenu",e[e.ShowSearchBar=25]="ShowSearchBar",e[e.ShowThumbnails=26]="ShowThumbnails",e[e.ShowOutlines=27]="ShowOutlines",e[e.ShowExportsPanel=28]="ShowExportsPanel",e[e.ShowPageSetupPanel=29]="ShowPageSetupPanel",e[e.ShowZoomBar=30]="ShowZoomBar",e[e.ShowSearchOptions=31]="ShowSearchOptions",e[e.SearchPrev=32]="SearchPrev",e[e.SearchNext=33]="SearchNext",e[e.SearchMatchCase=34]="SearchMatchCase",e[e.SearchMatchWholeWord=35]="SearchMatchWholeWord",e[e.RubberbandTool=36]="RubberbandTool",e[e.MagnifierTool=37]="MagnifierTool",e[e.RotateDocument=38]="RotateDocument",e[e.RotatePage=39]="RotatePage"}(_ViewerActionType=exports._ViewerActionType||(exports._ViewerActionType={}));class _MouseTool extends wjcCore.Control{constructor(e,t,r,i,o,a,n){super(e),this._stopOnClientOut=i,this._css=o,this._activeCss=a,this._visibleCss=n,this._pageView=r,this._viewPanelContainer=t,this._initElement(),this._bindEvents()}activate(){this._isActive||(this._isActive=!0,wjcCore.addClass(this._viewPanelContainer,this._activeCss))}deactivate(){this._isActive&&(this._isActive=!1,wjcCore.removeClass(this._viewPanelContainer,this._activeCss))}reset(){this._innerStop(null)}get isActive(){return this._isActive}get startPnt(){return this._startPnt}get pageView(){return this._pageView}get viewPanelContainer(){return this._viewPanelContainer}_initElement(){this.applyTemplate(this._css,this.getTemplate(),this._getTemplateParts()),this._viewPanelContainer.appendChild(this.hostElement)}_innerStop(e){try{this._stop(e)}finally{this._isStarted=!1,this._startPnt=null}}_getTemplateParts(){return null}_onMouseDown(e){var t=this._toClientPoint(e),r=this._testPageWorkingAreaHit(t);r&&this.pageView.isPageContentLoaded(r.pageIndex)&&(void 0!==window.getSelection&&getSelection().removeAllRanges(),this._isStarted=!0,this._startPnt=t,this._start(r))}_onMouseMove(e){if(this._isStarted){var t=this._toClientPoint(e),r=this._testPageWorkingAreaHit(t);r&&this.pageView.isPageContentLoaded(r.pageIndex)?this._move(t,r):this._stopOnClientOut&&this._stop(t)}}_onMouseUp(e){this._isStarted&&this._innerStop(this._toClientPoint(e))}_start(e){wjcCore.addClass(this.hostElement,this._visibleCss)}_move(e,t){}_stop(e){wjcCore.removeClass(this.hostElement,this._visibleCss)}_bindEvents(){this.addEventListener(this._viewPanelContainer,"mousedown",e=>{this._isActive&&this._onMouseDown(e)}),this.addEventListener(this._viewPanelContainer,"mousemove",e=>{this._isActive&&this._onMouseMove(e)}),this.addEventListener(document,"mouseup",e=>{this._isActive&&this._onMouseUp(e)})}_toClientPoint(e){var t=this._viewPanelContainer.getBoundingClientRect();return new wjcCore.Point(e.clientX-t.left,e.clientY-t.top)}_testPageWorkingAreaHit(e){var t=this._pageView.hitTest(e.x,e.y);return t&&t.hitWorkingArea?t:null}}exports._MouseTool=_MouseTool;class _RubberbandOnAppliedEventArgs extends wjcCore.EventArgs{constructor(e){super(),this._rect=e}get rect(){return this._rect}}exports._RubberbandOnAppliedEventArgs=_RubberbandOnAppliedEventArgs;class _Rubberband extends _MouseTool{constructor(e,t,r){super(e,t,r,!1,"wj-rubberband","rubberband-actived","show"),this.applied=new wjcCore.Event}_start(e){super._start(e),this.hostElement.style.left=this.startPnt.x+"px",this.hostElement.style.top=this.startPnt.y+"px"}_move(e,t){if(this.startPnt){this.viewPanelContainer.getBoundingClientRect();this.hostElement.style.width=e.x-this.startPnt.x+"px",this.hostElement.style.height=e.y-this.startPnt.y+"px"}}_stop(e){if(e){var t=this.hostElement.getBoundingClientRect();t.width>5&&t.height>5&&this._onApplied(new _RubberbandOnAppliedEventArgs(new wjcCore.Rect(this.startPnt.x,this.startPnt.y,t.width,t.height)))}this.hostElement.style.width="0px",this.hostElement.style.height="0px",super._stop(e)}_onApplied(e){this.applied.raise(this,e)}}exports._Rubberband=_Rubberband;class _Magnifier extends _MouseTool{constructor(e,t,r){super(e,t,r,!0,"wj-magnifier","magnifier-actived","show"),this._Magnification=2,this._currentPageIndex=-1}deactivate(){super.deactivate(),this._currentPageIndex=-1}reset(){super.reset(),this._currentPageIndex=-1}_getTemplateParts(){return{_viewPageDiv:"view-page-div"}}_bindEvents(){super._bindEvents();var e=()=>{if(!(this._currentPageIndex<0)){var e=this.pageView.pages[this._currentPageIndex],t=_getRotatedSize(e.size,e.rotateAngle),r=this._viewPageDiv.querySelector("svg");this._viewPageDiv.style.height=t.height.valueInPixel*this.pageView.zoomFactor*this._Magnification+"px",this._viewPageDiv.style.width=t.width.valueInPixel*this.pageView.zoomFactor*this._Magnification+"px",r.setAttribute("width",this._viewPageDiv.style.width),r.setAttribute("height",this._viewPageDiv.style.height),_transformSvg(r,e.size.width.valueInPixel,e.size.height.valueInPixel,this._Magnification*this.pageView.zoomFactor,e.rotateAngle)}};this.pageView.zoomFactorChanged.addHandler(()=>{e()}),this.pageView.rotateAngleChanged.addHandler(()=>{e()})}_start(e){super._start(e),this._showMagnifer(this.startPnt,e)}_move(e,t){this._showMagnifer(e,t)}_showMagnifer(e,t){var r=this.hostElement.getBoundingClientRect(),i=_getPositionByHitTestInfo(t);this.hostElement.style.left=e.x-r.width/2+"px",this.hostElement.style.top=e.y-r.height/2+"px",this._fillPage(i),this._showHitPosition(i)}_fillPage(e){e.pageIndex!==this._currentPageIndex&&(this._currentPageIndex=e.pageIndex,this.pageView.pages[this._currentPageIndex].getContent().then(e=>{var t=e.cloneNode(!0);this._viewPageDiv.innerHTML="",this._viewPageDiv.appendChild(t),t.setAttribute("width",new _Unit(t.getAttribute("width")).valueInPixel*this._Magnification+"px"),t.setAttribute("height",new _Unit(t.getAttribute("height")).valueInPixel*this._Magnification+"px");var r=this.pageView.pages[this._currentPageIndex].size;_transformSvg(t,r.width.valueInPixel,r.height.valueInPixel,this._Magnification*this.pageView.zoomFactor,this.pageView.pages[this._currentPageIndex].rotateAngle),this._viewPageDiv.style.width=t.getAttribute("width"),this._viewPageDiv.style.height=t.getAttribute("height")}))}_showHitPosition(e){var t=this.hostElement.getBoundingClientRect(),r=this.pageView.pages[this._currentPageIndex],i=_getTransformedPosition(e.pageBounds,r.size,r.rotateAngle,this.pageView.zoomFactor);this._viewPageDiv.style.left=-i.x*this._Magnification+t.width/2+"px",this._viewPageDiv.style.top=-i.y*this._Magnification+t.height/2+"px"}}_Magnifier.controlTemplate='<div wj-part="view-page-div" class="wj-view-page"></div>',exports._Magnifier=_Magnifier;var parametersIcon='<path d="M24,11.9v-2h-4V7h0V5h0h-1h-5V2h0V0h0h-1H1H0h0v2h0v11h0v1h0h1h5v4h0v1h0h1h3v4h0v1h0h1h2.1v-1H11V12h2.1v-2H11h-1h0v2h0v6H7V7h12v2.9h-1v2h5V23h-4.9v1H23h1h0v-1h0L24,11.9L24,11.9z M6,5L6,5l0,2h0v6H1V2h12v3H7H6z"/><path d="M20,20v-3v-1h-1h-1v-1v-1h-1h-3h-1v1v3v1h1h1v2h0h1h3h1h0L20,20L20,20z M14,18v-3h3v1h-1h-1v1v1H14z M17,17v1h-1v-1H17z M16,20v-1h1h1v-1v-1h1v3H16z"/>';class ReportViewer extends ViewerBase{constructor(e,t){super(e,t),this._initSidePanelParameters()}_getProductInfo(){return"QNI5,ReportViewer"}get reportName(){return this._reportName}set reportName(e){e!=this._reportName&&(this._reportName=e,this._needBindDocumentSource(),this.invalidate())}get paginated(){return this._innerPaginated}set paginated(e){this._innerPaginated=e}get parameters(){return this._clientParameters}set parameters(e){e!=this._clientParameters&&(this._clientParameters=e,this._needBindDocumentSource(),this.invalidate())}static getReportNames(e,t,r){return _Report.getReportNames(e,t,r)}static getReports(e,t,r,i){return _Report.getReports(e,t,r,i)}onQueryLoadingData(e){this.parameters&&Object.keys(this.parameters).forEach(t=>e.data["parameters."+t]=this.parameters[t]),super.onQueryLoadingData(e)}_globalize(){super._globalize();var e=wjcCore.culture.Viewer;this._gParameterTitle.textContent=e.parameters}_executeAction(e){if(super._executeAction(e),!this._actionIsDisabled(e))switch(e){case ReportViewer._parameterCommandTag:wjcCore.Control.getControl(this._sidePanel).active(this._parametersPageId)}}_executeCustomAction(e){if(this._isArReport()&&e.arKind===_ArActionKind.Drillthrough){var t=JSON.parse(e.data),r=this._getDocumentSource();r._innerService.setDrillthroughData(t),r._updateIsLoadCompleted(!1),this._loadDocument(r,!0,!1)}else super._executeCustomAction(e)}_actionIsDisabled(e){switch(e){case ReportViewer._parameterCommandTag:return!this._innerDocumentSource||!this._innerDocumentSource.hasParameters}return super._actionIsDisabled(e)}_initHamburgerMenu(e){this._hamburgerMenu=new _ReportHamburgerMenu(this,e)}_initSidePanelParameters(){var e=wjcCore.Control.getControl(this._sidePanel),t=e.addPage(wjcCore.culture.Viewer.parameters,parametersIcon,2);this._parametersPageId=t.id,this._gParameterTitle=t.outContent.querySelector(".wj-tabtitle"),t.format(t=>{this._paramsEditor=new _ParametersEditor(t.content),this._paramsEditor.commit.addHandler(()=>{this._innerDocumentSource&&this._innerDocumentSource.hasParameters&&(this._showViewPanelMessage(),this._innerDocumentSource.setParameters(this._paramsEditor.parameters).then(e=>{var t=e||[],r=t.some(e=>!!e.error);this._paramsEditor._reset(),r?this._paramsEditor.itemsSource=t:(this._resetDocument(),this._paramsEditor.isDisabled=!0,this._renderDocumentSource())}).catch(e=>{this._showViewPanelErrorMessage(_getErrorMessage(e))}),this._isMobileTemplate()&&e.collapse())}),this._paramsEditor.validate.addHandler(()=>{this._innerDocumentSource&&this._innerDocumentSource.hasParameters&&(this._paramsEditor.isDisabled=!0,this._innerDocumentSource.setParameters(this._paramsEditor.parameters).then(e=>{this._paramsEditor.itemsSource=e,this._paramsEditor.isDisabled=!1},e=>{this._paramsEditor.isDisabled=!1}))});var r=()=>{var r=this._innerDocumentSource;r.status===_ExecutionStatus.cleared||r.status===_ExecutionStatus.notFound?_removeChildren(t.content):r.status===_ExecutionStatus.rendering?this._paramsEditor.isDisabled=!0:r.status===_ExecutionStatus.completed&&(this._paramsEditor.isDisabled=!1),r.status===_ExecutionStatus.loaded&&(r.hasParameters?r.getParameters().then(i=>{i.filter(e=>!e.hidden).length?(e.show(t),e.active(t)):e.hide(t),this._innerDocumentSource!=r||r.isDisposed||(this._paramsEditor.itemsSource=i,i.filter(e=>null==e.value&&!e.nullable&&!e.hidden).length?(this._showViewPanelMessage(wjcCore.culture.Viewer.requiringParameters),this._updateUI(),wjcCore.Control.getControl(this._sidePanel).enable(this._parametersPageId)):(this._paramsEditor.isDisabled=!0,this._renderDocumentSource()))}):e.hide(t))},i=()=>{this._innerDocumentSource&&(_addWjHandler(this._documentEventKey,this._innerDocumentSource.statusChanged,r),r())};this._documentSourceChanged.addHandler(i),i()})}get _innerDocumentSource(){return this._getDocumentSource()}_loadDocument(e,t=!1,r=!0){var i=this._innerDocumentSource!==e&&!t,o=super._loadDocument(e,t,r);return e&&i&&_addWjHandler(this._documentEventKey,e.statusChanged,this._onDocumentStatusChanged,this),o}_reRenderDocument(){this._renderDocumentSource()}_onDocumentStatusChanged(){this._innerDocumentSource&&this._innerDocumentSource.status===_ExecutionStatus.loaded&&!this._innerDocumentSource.hasParameters&&this._innerDocumentSource.autoRun&&this._renderDocumentSource()}_renderDocumentSource(){if(this._innerDocumentSource){this._setDocumentRendering();var e=this._innerDocumentSource;e.render().then(t=>this._getStatusUtilCompleted(e))}}_disposeDocument(e=!0){this._innerDocumentSource&&_removeAllWjHandlers(this._documentEventKey,this._innerDocumentSource.statusChanged),super._disposeDocument(e)}_setDocumentRendering(){this._innerDocumentSource.status=_ExecutionStatus.rendering,super._setDocumentRendering()}_getSource(){return this.filePath?this._isArReport()?new _ArReportSource({serviceUrl:this.serviceUrl,filePath:this.filePath},this):new _Report({serviceUrl:this.serviceUrl,filePath:this.filePath,reportName:this.reportName,paginated:this.paginated},this):null}_supportsPageSettingActions(){return!0}refresh(e=!0){super.refresh(e),e&&this._paramsEditor.refresh()}_isArReport(){return!!this.filePath&&_strEndsWith(this.filePath,".rdlx",!0)}_createPage(e,t){return this._isArReport()?new _ArPage(this._getDocumentSource(),e,t):super._createPage(e,t)}_actionElementClicked(e){if(this._isArReport()){var t=this._getActionInfo(e);t&&t.arKind===_ArActionKind.Hyperlink?window.open(t.data,"_blank"):super._actionElementClicked(e)}else super._actionElementClicked(e)}_getActionInfo(e){if(!this._isArReport())return super._getActionInfo(e);var t=e.attributes["arsvg:data-action-type"].value,r=e.attributes["arsvg:data-action-data"].value.replace(/&quot;/g,'"'),i=e.attributes["arsvg:data-action-page"].value;if(t)switch(t){case _ArActionKind.Bookmark:return{kind:_ActionKind.Bookmark,data:r?`${i}|${r}`:i,arKind:t};default:return{kind:_ActionKind.Custom,data:r,arKind:t}}return null}}ReportViewer._parameterCommandTag=99,exports.ReportViewer=ReportViewer;class _ParametersEditor extends wjcCore.Control{constructor(e){super(e),this._parameters={},this._errors=[],this._errorsVisible=!1,this.commit=new wjcCore.Event,this.validate=new wjcCore.Event,wjcCore.addClass(this.hostElement,"wj-parameterscontainer"),this._updateErrorsVisible()}_setErrors(e){this._errors=e,this._updateErrorDiv()}get parameters(){return this._parameters}get itemsSource(){return this._itemSources}set itemsSource(e){this._itemSources=e,this._parameters={},this._render();var t=[];(e||[]).forEach(e=>{e.error&&t.push({key:e.name,value:e.error})}),this._setErrors(t)}_reset(){this._lastEditedParam=null}_setErrorsVisible(e){this._errorsVisible=e,this._updateErrorsVisible()}_updateErrorsVisible(){this._errorsVisible?wjcCore.removeClass(this.hostElement,_ParametersEditor._errorsHiddenCss):wjcCore.addClass(this.hostElement,_ParametersEditor._errorsHiddenCss)}onCommit(){this.commit.raise(this,new wjcCore.EventArgs)}onValidate(){this.validate.raise(this,new wjcCore.EventArgs),this._setErrorsVisible(!1)}_deferValidate(e,t,r){null!=this._validateTimer&&(clearTimeout(this._validateTimer),this._validateTimer=null),this._validateTimer=setTimeout(()=>{null!=t&&t(),this.onValidate(),null!=r&&r(),this._lastEditedParam=e,this._validateTimer=null},500)}_updateErrorDiv(){for(var e=this._errors||[],t=this.hostElement.querySelectorAll(".error"),r=0;r<t.length;r++)t[r].parentNode.removeChild(t[r]);for(r=0;r<e.length;r++){var i,o=this.hostElement.querySelector("*["+_ParametersEditor._paramIdAttr+'="'+e[r].key+'"]'),a=e[r].value;o&&((i=document.createElement("div")).innerHTML=a,i.className="error",o.appendChild(i))}}_render(){var e;if(_removeChildren(this.hostElement,t=>{if(!this._lastEditedParam||t.getAttribute(_ParametersEditor._paramIdAttr)!==this._lastEditedParam)return!0;e=t}),this._itemSources){this._itemSources.forEach(t=>{if(this._lastEditedParam===t.name)return this._lastEditedParam=null,void(e=null);if(!t.hidden){var r=document.createElement("div"),i=document.createElement("span"),o=null;if(r.className="wj-parametercontainer",i.className="wj-parameterhead",i.innerHTML=t.prompt||t.name,wjcCore.isArray(t.allowedValues))o=this._generateComboEditor(t);else switch(t.dataType){case _ParameterType.Boolean:o=this._generateBoolEditor(t);break;case _ParameterType.DateTime:case _ParameterType.Time:case _ParameterType.Date:o=this._generateDateTimeEditor(t);break;case _ParameterType.Integer:case _ParameterType.Float:o=this._generateNumberEditor(t);break;case _ParameterType.String:o=this._generateStringEditor(t)}o&&(o.className+=" wj-parametercontrol",r.setAttribute(_ParametersEditor._paramIdAttr,t.name),r.appendChild(i),r.appendChild(o),e?this.hostElement.insertBefore(r,e):this.hostElement.appendChild(r))}});var t=document.createElement("input");t.type="button",t.value=wjcCore.culture.Viewer.apply,t.className="wj-applybutton",_addEvent(t,"click",()=>{this._validateParameters()&&(this._errors=[],this.onCommit()),this._setErrorsVisible(!0)}),this.hostElement.appendChild(t)}}refresh(e=!0){super.refresh(e),e&&(this._reset(),this._render())}_validateParameters(){for(var e,t=this.hostElement.querySelectorAll("textarea"),r=[],i=this.itemsSource,o=0;o<i.length;o++){var a=i[o];e=this.hostElement.querySelector("["+_ParametersEditor._paramIdAttr+'="'+a.name+'"]'),null!=a.value&&""!==a.value||a.nullable||a.dataType===_ParameterType.String&&a.allowBlank||this.parameters.hasOwnProperty(a.name)||this.parameters[a.name]||e&&r.push({key:a.name,value:wjcCore.culture.Viewer.nullParameterError})}for(o=0;o<t.length;o++){var n=t.item(o),s=!0;switch(parseInt(n.getAttribute("data-type"))){case _ParameterType.Date:case _ParameterType.DateTime:case _ParameterType.Time:s=_ParametersEditor._checkValueType(n.value,wjcCore.isDate);break;case _ParameterType.Float:s=_ParametersEditor._checkValueType(n.value,_ParametersEditor._isFloat);break;case _ParameterType.Integer:s=_ParametersEditor._checkValueType(n.value,wjcCore.isInt)}s||r.push({key:n.parentElement.id,value:wjcCore.culture.Viewer.invalidParameterError})}return this._setErrors(r),r.length<=0}static _isFloat(e){return!isNaN(parseFloat(e))}static _checkValueType(e,t){for(var r=e.split("\n"),i=0;i<r.length;i++)if(!(r[i].trim().length<=0||t(r[i].trim())))return!1;return!0}_generateComboEditor(e){var t,r,i,o=[],a=document.createElement("div"),n=[],s=e.allowedValues&&e.allowedValues.length>0,h=s&&e.allowedValues.filter(t=>_isEqual(t.value,e.value)).length>0;e.multiValue?t=new _MultiSelectEx(a):(t=new wjcInput.ComboBox(a),e.nullable?o.push({name:wjcCore.culture.Viewer.parameterNoneItemsSelected,value:null}):!s||null!=e.value&&h||o.push({name:wjcCore.culture.Viewer.selectParameterValue,value:null})),t.isEditable=!1,t.displayMemberPath="name",t.selectedValuePath="value",t.isDisabled=!s;for(l=0;l<e.allowedValues.length;l++)o.push({name:e.allowedValues[l].key,value:e.allowedValues[l].value});if(t.itemsSource=o,e.multiValue){if(r=t,s){if(e.value){for(var l=0;l<e.value.length;l++)for(var c=0;c<r.itemsSource.length;c++)if(_isEqual(r.itemsSource[c].value,e.value[l])){n.push(r.itemsSource[c]);break}r.checkedItems=n}}else r.checkedItems=[];r.checkedItemsChanged.addHandler(()=>{this._deferValidate(e.name,()=>{i=[];for(var t=0;t<r.checkedItems.length;t++)i.push(r.checkedItems[t].value);this._updateParameters(e,i)},()=>{i.length>0&&!e.nullable&&this._validateNullValueOfParameter(a)})})}else{t.selectedValue=s&&h?e.value:null;var d=!1;t.selectedIndexChanged.addHandler(t=>{this._deferValidate(e.name,()=>{d||(this._updateParameters(e,t.selectedValue),t.selectedValue&&t.itemsSource[0].name===wjcCore.culture.Viewer.selectParameterValue&&setTimeout(()=>{d=!0;var e=t.selectedValue,r=t.selectedIndex;t.itemsSource.shift(),t.collectionView.refresh(),t.selectedValue=e,t.selectedIndex=r-1,d=!1}))},()=>this._validateNullValueOfParameter(a))})}return a}_updateParameters(e,t){var r;this.itemsSource.some(t=>t.name===e.name&&(r=t,!0)),this._parameters[e.name]=r.value=e.value=((e,t)=>t&&wjcCore.isString(e)?e.split(/[\r\n]+/):e)(t,e.multiValue)}_generateBoolEditor(e){var t,r,i=[];return e.nullable?(r=document.createElement("div"),(t=new wjcInput.ComboBox(r)).isEditable=!1,t.displayMemberPath="name",t.selectedValuePath="value",i.push({name:"None",value:null}),i.push({name:"True",value:!0}),i.push({name:"False",value:!1}),t.itemsSource=i,t.selectedValue=e.value,t.selectedIndexChanged.addHandler(t=>{this._deferValidate(e.name,()=>this._updateParameters(e,t.selectedValue))})):((r=document.createElement("input")).type="checkbox",r.checked=e.value,_addEvent(r,"click",()=>{this._deferValidate(e.name,()=>this._updateParameters(e,r.checked))})),r}_generateStringEditor(e){var t,r=this;return e.multiValue?(t=r._createTextarea(e.value,e.dataType),e.maxLength>0&&(t.maxLength=e.maxLength)):((t=document.createElement("input")).type="text",e.value&&(t.value=e.value),e.maxLength>0&&(t.maxLength=e.maxLength)),r._bindTextChangedEvent(t,e),t}_createTextarea(e,t){var r,i=document.createElement("textarea"),o=[];if(t!==_ParameterType.DateTime&&t!==_ParameterType.Time&&t!==_ParameterType.Date||(r=_ParametersEditor._dateTimeFormat),e&&e.length>0)if(r){for(var a=0;a<e.length;a++)o.push(wjcCore.Globalize.formatDate(new Date(e[a]),r));i.value=o.join("\n")}else i.value=e.join("\n");return i.wrap="off",i.setAttribute("data-type",t.toString()),i}_bindTextChangedEvent(e,t){_addEvent(e,"change,keyup,paste,input",r=>{r.target&&r.target.disabled||this._deferValidate(t.name,()=>this._updateParameters(t,e.value),()=>{e.value&&!t.nullable&&this._validateNullValueOfParameter(e)})})}_generateNumberEditor(e){var t,r;return e.multiValue?(t=this._createTextarea(e.value,e.dataType),this._bindTextChangedEvent(t,e)):(t=document.createElement("div"),(r=new wjcInput.InputNumber(t)).format=e.dataType===_ParameterType.Integer?"n0":"n2",r.isRequired=!e.nullable,e.value&&(r.value=e.dataType===_ParameterType.Integer?parseInt(e.value):parseFloat(e.value)),r.valueChanged.addHandler(t=>{this._deferValidate(e.name,()=>this._updateParameters(e,t.value))})),t}_generateDateTimeEditor(e){var t,r;return e.multiValue?((t=this._createTextarea(e.value,e.dataType)).title=_ParametersEditor._dateTimeFormat,this._bindTextChangedEvent(t,e)):(t=document.createElement("div"),e.dataType==_ParameterType.Date?r=new wjcInput.InputDate(t):e.dataType==_ParameterType.DateTime?(r=new wjcInput.InputDateTime(t)).timeStep=60:(r=new wjcInput.InputTime(t)).step=60,r.isRequired=!1,null!=e.value?r.value=new Date(e.value):r.value=null,r.isRequired=!e.nullable,r.valueChanged.addHandler(()=>{this._deferValidate(e.name,()=>this._updateParameters(e,r.value&&r.value.toJSON()))})),t}_validateNullValueOfParameter(e){var t=this._errors;if(t&&t.length)for(var r=0;r<t.length;r++)if(t[r].key===e.parentElement.getAttribute(_ParametersEditor._paramIdAttr)){var i=e.parentElement.querySelector(".error");if(i){e.parentElement.removeChild(i),t.splice(r,1);break}}}}_ParametersEditor._paramIdAttr="param-id",_ParametersEditor._errorsHiddenCss="wj-parametererrors-hidden",_ParametersEditor._dateTimeFormat="MM/dd/yyyy HH:mm",exports._ParametersEditor=_ParametersEditor;class _MultiSelectEx{constructor(e){this._selectedAll=!1,this._innerCheckedItemsChanged=!1,this.checkedItemsChanged=new wjcCore.Event;var t=this,r=new wjcInput.MultiSelect(e);t._multiSelect=r,r.checkedItemsChanged.addHandler(t.onCheckedItemsChanged,t),r.isDroppedDownChanged.addHandler(t.onIsDroppedDownChanged,t),r.headerFormatter=(()=>t._updateHeader())}_updateHeader(){var e=this,t=e.checkedItems||[],r=[],i=e.displayMemberPath;if(!t.length)return wjcCore.culture.Viewer.parameterNoneItemsSelected;if(e._selectedAll)return wjcCore.culture.Viewer.parameterAllItemsSelected;if(i){for(var o=0;o<t.length;o++)r[o]=t[o][i];return r.join(", ")}return t.join(", ")}onIsDroppedDownChanged(){this._multiSelect.isDroppedDown&&this._updateSelectedAll()}onCheckedItemsChanged(e,t){var r=this;r._innerCheckedItemsChanged||(r._selectAllItem?(r._updateSelectedAll(),r.checkedItemsChanged.raise(r,t)):r.checkedItemsChanged.raise(r,t))}get isEditable(){return this._multiSelect.isEditable}set isEditable(e){this._multiSelect.isEditable=e}get isDisabled(){return this._multiSelect.isDisabled}set isDisabled(e){this._multiSelect.isDisabled=e}get displayMemberPath(){return this._multiSelect.displayMemberPath}set displayMemberPath(e){this._multiSelect.displayMemberPath=e}get selectedValuePath(){return this._multiSelect.selectedValuePath}set selectedValuePath(e){this._multiSelect.selectedValuePath=e}get itemsSource(){return this._itemsSource}set itemsSource(e){var t=this,r=t.displayMemberPath||"name";t._itemsSource=e;var i=[];e&&(e.length>1?(t._selectAllItem={},t._selectAllItem[r]=wjcCore.culture.Viewer.parameterSelectAllItemText,i.push(t._selectAllItem)):t._selectAllItem=null,i=i.concat(e)),t._multiSelect.itemsSource=i}get checkedItems(){var e=this,t=[];e._multiSelect.checkedItems&&(t=e._multiSelect.checkedItems.slice());var r=t.indexOf(e._selectAllItem);return r>-1&&t.splice(r,1),t}set checkedItems(e){var t=this;t._multiSelect.checkedItems=e,t._selectedAll=!1,t._updateSelectedAll()}_updateSelectedAll(){var e=this;if(e._selectAllItem){var t=e._multiSelect.checkedItems||[],r=t.indexOf(e._selectAllItem),i=r>-1;if(e._selectedAll!==i)return e._selectedAll=i,e._innerCheckedItemsChanged=!0,e._selectedAll?e._multiSelect.checkedItems=e._multiSelect.itemsSource.slice():e._multiSelect.checkedItems=[],void(e._innerCheckedItemsChanged=!1);e._selectedAll=t&&e._itemsSource&&t.length-(i?1:0)===e._itemsSource.length,e._selectedAll!==i&&(e._innerCheckedItemsChanged=!0,e._selectedAll?e._multiSelect.checkedItems=t.concat(e._selectAllItem):((t=t.slice()).splice(r,1),e._multiSelect.checkedItems=t),e._innerCheckedItemsChanged=!1)}}}exports._MultiSelectEx=_MultiSelectEx;class _ReportHamburgerMenu extends _HamburgerMenu{constructor(e,t,r){super(e,t,r)}_initItems(){var e=super._initItems();return e.splice(2,0,{title:wjcCore.culture.Viewer.parameters,icon:parametersIcon,commandTag:ReportViewer._parameterCommandTag}),e}}exports._ReportHamburgerMenu=_ReportHamburgerMenu;class PdfViewer extends ViewerBase{constructor(e,t){super(e,t)}_getProductInfo(){return"QNI5,PdfViewer"}get _innerDocumentSource(){return this._getDocumentSource()}_getSource(){return this.filePath?new _PdfDocumentSource({serviceUrl:this.serviceUrl,filePath:this.filePath},this):null}}exports.PdfViewer=PdfViewer;var _ArActionKind;!function(e){e.Hyperlink="hyperlink",e.Bookmark="bookmark",e.Drillthrough="drillthrough",e.Sort="sort",e.Toggle="toggle"}(_ArActionKind=exports._ArActionKind||(exports._ArActionKind={}));var _ArParameterType;!function(e){e[e.String=0]="String",e[e.DateTime=1]="DateTime",e[e.Boolean=2]="Boolean",e[e.Integer=3]="Integer",e[e.Float=4]="Float"}(_ArParameterType=exports._ArParameterType||(exports._ArParameterType={}));var _ArParameterState;!function(e){e[e.OK=0]="OK",e[e.ExpectValue=1]="ExpectValue",e[e.HasOutstandingDependencies=2]="HasOutstandingDependencies",e[e.ValuesValidationFailed=3]="ValuesValidationFailed",e[e.DynamicValuesUnavailable=4]="DynamicValuesUnavailable"}(_ArParameterState=exports._ArParameterState||(exports._ArParameterState={}));class _ArPage extends _Page{_processSvgResponse(e){e=super._processSvgResponse(e);var t=(new DOMParser).parseFromString(e,"text/xml");return e=(new XMLSerializer).serializeToString(t)}_processActionLinks(e,t){for(var r=e.querySelectorAll("rect[arsvg\\:data-action-type]"),i=0;i<r.length;i++)t(r[i])}}exports._ArPage=_ArPage;var _ArReportFormat;!function(e){e[e.Rpx=0]="Rpx",e[e.Rdf=1]="Rdf",e[e.Rdlx=2]="Rdlx"}(_ArReportFormat||(_ArReportFormat={}));var _ArDocumentFormat;!function(e){e[e.Image=3]="Image",e[e.Pdf=4]="Pdf",e[e.Html=5]="Html",e[e.Word=6]="Word",e[e.Xls=7]="Xls",e[e.Xml=8]="Xml",e[e.Svg=9]="Svg"}(_ArDocumentFormat=exports._ArDocumentFormat||(exports._ArDocumentFormat={}));var _ArLoadState;!function(e){e[e.NotStarted=0]="NotStarted",e[e.Rendering=1]="Rendering",e[e.Rendered=2]="Rendered",e[e.Cancelling=3]="Cancelling",e[e.Cancelled=4]="Cancelled",e[e.Error=5]="Error"}(_ArLoadState=exports._ArLoadState||(exports._ArLoadState={}));var _ArErrorCode;!function(e){e[e.InvalidCulture=0]="InvalidCulture",e[e.InvalidVersion=1]="InvalidVersion",e[e.UnknownReportType=2]="UnknownReportType",e[e.NoSuchReport=3]="NoSuchReport",e[e.ParametersNotSet=4]="ParametersNotSet",e[e.RuntimeIsBusy=5]="RuntimeIsBusy",e[e.InternalError=6]="InternalError",e[e.ParameterNotExists=7]="ParameterNotExists",e[e.NoAcceptableFormats=8]="NoAcceptableFormats",e[e.InvalidToken=9]="InvalidToken",e[e.UnsupportedFormat=10]="UnsupportedFormat",e[e.InvalidSetOfParameters=11]="InvalidSetOfParameters",e[e.MethodNotSupported=12]="MethodNotSupported",e[e.NoValidLicenseFound=13]="NoValidLicenseFound"}(_ArErrorCode=exports._ArErrorCode||(exports._ArErrorCode={}));var ticksOffsetFromUnixEpoch=621355968e9,ticksInMillisecond=1e4,millisecondsInMinute=6e4;class _ArReportService extends _DocumentService{constructor(){super(...arguments),this._lifeTime=6e5,this._drillthroughData=null,this._canChangeRenderMode=!1,this._uid=(new Date).getTime().toString(),this._isDisposed=!1,this._hasOutlines=void 0}static StateToStatus(e){switch(e){case _ArLoadState.NotStarted:return _ExecutionStatus.notFound;case _ArLoadState.Rendered:return _ExecutionStatus.completed;case _ArLoadState.Rendering:return _ExecutionStatus.rendering;case _ArLoadState.Cancelled:return _ExecutionStatus.stopped;default:throw`Not supported state: ${e}`}}static ConvertFormat(e){switch(e){case"doc":case"docx":return _ArDocumentFormat.Word;case"html":return _ArDocumentFormat.Svg;case"mhtml":return _ArDocumentFormat.Html;case"pdf":return _ArDocumentFormat.Pdf;case"svg":return _ArDocumentFormat.Svg;case"tiff":case"png":return _ArDocumentFormat.Image;case"xml":return _ArDocumentFormat.Xml;case"xlsx":case"xls":return _ArDocumentFormat.Xls;default:throw`Not supported format: ${e}`}}static IsError(e){return!!(e&&e.json&&e.json.Error)}get isDisposed(){return this._isDisposed}get autoRun(){return this._autoRun}get canChangeRenderMode(){return this._canChangeRenderMode}get parameters(){return this._parameters||[]}getStatus(){var e=new _Promise;return this._isDisposed?e.resolve({status:_ExecutionStatus.cleared}):this._token?(this._ajax(this.serviceUrl+"/GetStatus",{method:"POST",data:{token:this._token}}).then(t=>{let r=_ArReportService.StateToStatus(t.json.LoadState),i={errorList:t.json.Error?[t.json.Error.Description]:[],pageCount:t.json.AvailablePages,hasOutlines:!!this._hasOutlines,progress:0,status:r};r===_ExecutionStatus.completed&&null==this._hasOutlines?this.getOutlines(!0).then(t=>{i.hasOutlines=this._hasOutlines=(t||[]).length>0,e.resolve(i)}):e.resolve(i)},t=>{e.reject(this._getError(t))}),e):e.resolve({status:_ExecutionStatus.notFound})}setPageSettings(e){throw _DocumentSource._abstractMethodException}getBookmark(e){let t=new _Promise,r=e.split("|");return t.resolve({pageIndex:parseInt(r[0],10)-1,pageBounds:(e=>{if(e){let t=e.split(" ");return{x:_Unit.convertValue(parseFloat(t[0]),_UnitType.Dip,_UnitType.Twip),y:_Unit.convertValue(parseFloat(t[1]),_UnitType.Dip,_UnitType.Twip)}}})(r[1])})}executeCustomAction(e){switch(e.arKind){case _ArActionKind.Drillthrough:var t=JSON.parse(e.data);return(new _Promise).resolve(t);case _ArActionKind.Toggle:return this.processOnClick(e.data);default:return(new _Promise).reject(`Not implemented action: ${e.arKind}`)}}load(e){var t=[];if(e){Object.keys(e).forEach(r=>{0===r.indexOf("parameters.")&&(t.push({Name:r.substring("parameters.".length),Value:e[r]}),delete e[r])})}if(this._drillthroughData)return t.length&&this._mergeParameters(t,this._drillthroughData.Parameters||[]),this.loadDrillthroughReport(this._drillthroughData);var r=new _Promise;return this._ajax(this.serviceUrl+"/OpenReport",{method:"POST",data:this._merge(e,{acceptedFormats:[_ArDocumentFormat.Svg],culture:"en-US",lifeTime:this._lifeTime/1e3,reportPath:this.filePath,version:4})}).then(e=>{this._hasDelayedContent=e.json.HasDelayedContent,this._autoRun=!!e.json.AutoRun,this._documentFormat=e.json.DocumentFormat,this._parameters=(e.json.ParameterCollection||[]).map(e=>this._convertFromServiceParameter(e)),this._token=e.json.Token,this._isDisposed=!1;let t=new Date,r=new Date(t.getTime()+this._lifeTime);return{expiredDateTime:r,loadedDateTime:t,features:{nonPaginated:!1,paginated:!0,pageSettings:!1,textSearchInPaginatedMode:!0},pageSettings:{height:new _Unit(1056,_UnitType.Dip),width:new _Unit(816,_UnitType.Dip),leftMargin:new _Unit(48,_UnitType.Dip),rightMargin:new _Unit(48,_UnitType.Dip),topMargin:new _Unit(48,_UnitType.Dip),bottomMargin:new _Unit(48,_UnitType.Dip),paginated:!0},status:{errorList:e.json.Error?[e.json.Error.Description]:[],expiredDateTime:r,pageCount:0,progress:0,status:_ExecutionStatus.loaded}}}).then(e=>{this.getReportProperty("ChangeRenderModeSupported").then(i=>{if(this._canChangeRenderMode=!!i,t&&t.length){var o=this._mergeParameters(t,this._parameters);this.setParameters(o).then(t=>{r.resolve(e)})}else r.resolve(e)})}).catch(e=>{r.reject(this._getError(e))}),r}loadDrillthroughReport(e){var t=new _Promise;return this._ajax(this.serviceUrl+"/OpenDrillthroughReport",{method:"POST",data:{token:this._token,lifeTime:this._lifeTime/1e3,reportPath:e.ReportName}}).then(r=>{this.dispose(!1).then(()=>{this._hasDelayedContent=r.json.HasDelayedContent,this._autoRun=!!r.json.AutoRun,this._documentFormat=r.json.DocumentFormat,this._parameters=(r.json.ParameterCollection||[]).map(e=>this._convertFromServiceParameter(e)),this._token=r.json.Token,this._isDisposed=!1;let i=new Date,o=new Date(i.getTime()+this._lifeTime);var a={expiredDateTime:o,loadedDateTime:i,features:{nonPaginated:!1,paginated:!0,pageSettings:!1,textSearchInPaginatedMode:!0},pageSettings:{height:new _Unit(1056,_UnitType.Dip),width:new _Unit(816,_UnitType.Dip),leftMargin:new _Unit(48,_UnitType.Dip),rightMargin:new _Unit(48,_UnitType.Dip),topMargin:new _Unit(48,_UnitType.Dip),bottomMargin:new _Unit(48,_UnitType.Dip),paginated:!0},status:{errorList:r.json.Error?[r.json.Error.Description]:[],expiredDateTime:o,pageCount:0,progress:0,status:_ExecutionStatus.loaded}};this.getReportProperty("ChangeRenderModeSupported").then(r=>{this._canChangeRenderMode=!!r,wjcCore.isArray(e.Parameters)&&e.Parameters.length?this.setParameters(e.Parameters).then(e=>{t.resolve(a)}):t.resolve(a)})})},e=>{t.reject(this._getError(e))}),t}processOnClick(e){var t=new _Promise;return this._ajax(this.serviceUrl+"/ProcessOnClick",{method:"POST",data:{token:this._token,data:{Action:"toggle",Data:e}}}).then(e=>{t.resolve({status:_ExecutionStatus.rendering})},e=>{t.reject(this._getError(e))}),t}getReportProperty(e){return this._ajax(this.serviceUrl+"/GetReportProperty",{method:"POST",data:{token:this._token,propertyName:e}}).then(e=>e.json.Error?null:e.json.PropertyValue).catch(e=>null)}render(e){return this._ajax(this.serviceUrl+"/RunReport",{method:"POST",data:{token:this._token}}).then(e=>(this._isDisposed=!1,{errorList:e.json.Error?[e.json.Error.Description]:[],status:_ExecutionStatus.rendering}))}setDrillthroughData(e){this._drillthroughData=e}dispose(e=!0){return this._token?this._ajax(this.serviceUrl+"/CloseReport",{method:"POST",async:e,data:{token:this._token}}).then(()=>(this._isDisposed=!0,this._token=null,this._hasOutlines=void 0,{status:_ExecutionStatus.cleared})):new _Promise}getOutlines(e=!1){return this._getBookmarks(-1,0,e?1:100,!e)}_getError(e){var t=e;return _ArReportService.IsError(t)?`ErrorCode: "${t.json.Error.ErrorCode}". Description: "${t.json.Error.Description}"`:e.responseText}_getBookmarks(e,t,r,i=!0){var o=new _Promise;return this._ajax(this.serviceUrl+"/GetBookmarks",{method:"POST",data:{token:this._token,parentId:e,fromChild:t,count:r}}).then(a=>{var n=(a.json.Bookmarks||[]).map(e=>({caption:e.Name,children:e.ChildrenCount>0?()=>this._getBookmarks(e.ID,0,r):null,position:{pageBounds:{height:_Unit.convertValue(e.Size.Width||0,_UnitType.Inch,_UnitType.Twip),width:_Unit.convertValue(e.Size.Height||0,_UnitType.Inch,_UnitType.Twip),x:_Unit.convertValue(e.Location.X||0,_UnitType.Inch,_UnitType.Twip),y:_Unit.convertValue(e.Location.Y||0,_UnitType.Inch,_UnitType.Twip)},pageIndex:e.Page},target:""})),s=t+n.length;!i||s>=a.json.ChildrenCount||s>=1e5?o.resolve(n):this._getBookmarks(e,s,r).then(e=>{o.resolve(n.concat(e))})}),o}renderToFilter(e){var t=new _Promise;return this.getRenderToFilterUrl(e).then(r=>{this._ajax(r+`&WebViewerControlClientId=${this._uid}`+(e.outputRange?`&Page=${e.outputRange}`:""),{method:"GET",parseResponse:!1}).then(e=>{t.resolve(e.xhr)},r=>{_ArReportService.IsError(r)&&r.json.Error.ErrorCode==_ArErrorCode.RuntimeIsBusy?setTimeout(()=>this.renderToFilter(e),this.getPingTimeout()):t.reject(r)})}),t}search(e){var t=new _Promise;return this._ajax(this.serviceUrl+"/Search",{method:"POST",data:{token:this._token,options:{Text:e.text,MatchCase:e.matchCase,WholeWord:e.wholeWord},startFrom:{PageIndex:-1},numberOfResults:100}}).then(e=>{var r=e.json.SearchResults.map(e=>({nearText:e.DisplayText,positionInNearText:e.TextStart,pageIndex:e.PageIndex,boundsList:[{height:_Unit.convertValue(e.ItemArea.Height||0,_UnitType.Inch,_UnitType.Twip),width:_Unit.convertValue(e.ItemArea.Width||0,_UnitType.Inch,_UnitType.Twip),x:_Unit.convertValue(e.ItemArea.Left||0,_UnitType.Inch,_UnitType.Twip),y:_Unit.convertValue(e.ItemArea.Top||0,_UnitType.Inch,_UnitType.Twip)}]}));t.resolve(r)},e=>t.reject(e)),t}setParameters(e){var t=new _Promise;return this._ajax(this.serviceUrl+"/SetParameters",{method:"POST",data:{token:this._token,parametersSetAtClient:(e||[]).map(e=>this._convertToServiceParameter(e))}}).then(e=>{t.resolve(this._parameters=(e.json.ParameterCollection||[]).map(e=>this._convertFromServiceParameter(e)))}).catch(e=>{_ArReportService.IsError(e)&&e.json.Error.ErrorCode==_ArErrorCode.ParametersNotSet?t.resolve(this._parameters=(e.json.ParameterCollection||[]).map(e=>this._convertFromServiceParameter(e))):t.reject(e)}),t}validateParameter(e){return this._ajax(this.serviceUrl+"/ValidateParameter",{method:"POST",data:{token:this._token,parametersSetAtClient:this._convertToServiceParameter(e)}}).then(e=>null)}getRenderToFilterUrl(e){var t=new _Promise;return this._ajax(this.serviceUrl+"/GetRenderedReportLink",{method:"POST",data:{token:this._token}}).then(e=>{t.resolve(e.json.ReportLink.Uri)},r=>{_ArReportService.IsError(r)&&r.json.Error.ErrorCode==_ArErrorCode.RuntimeIsBusy?setTimeout(()=>this.getRenderToFilterUrl(e),this.getPingTimeout()):t.reject(r)}),t}getExportedUrl(e){var t=_ArReportService.ConvertFormat(e.format),r=(()=>{var r={FileName:this.getFileName()};return t==_ArDocumentFormat.Pdf&&(r.EmbedFonts="All"),t==_ArDocumentFormat.Image&&("png"===e.format&&(r.ImageType="PNG"),e.outputRange&&(r.StartPage=e.outputRange.toString(),r.EndPage=e.outputRange.toString()),e.resolution&&(r.DpiX=e.resolution.toString(),r.DpiY=e.resolution.toString())),e.printing&&t==_ArDocumentFormat.Pdf&&(r.PrintOnOpen=!0),r})(),i=new _Promise;return this._ajax(this.serviceUrl+"/GetExportedReportLink",{method:"POST",data:{token:this._token,format:t,exportingParameters:r,pageRange:null}}).then(t=>{i.resolve(t.json.ReportLink.Uri+(wjcCore.isNumber(e.outputRange)?`&outputRange=${e.outputRange}`:"")+(e.printing?"":"&Attachment=1"))},t=>{_ArReportService.IsError(t)&&t.json.Error.ErrorCode==_ArErrorCode.RuntimeIsBusy?setTimeout(()=>this.getExportedUrl(e),this.getPingTimeout()):i.reject(t)}),i}getPingTimeout(){return 1e3}getSupportedExportDescriptions(){var e=new _Promise;return e.resolve([{name:"TIFF image",format:"tiff"},{name:"Adobe PDF",format:"pdf"},{name:"Web archive (MHTML)",format:"mhtml"},{name:"Microsoft Word",format:"doc"},{name:"Microsoft Excel",format:"xls"},{name:"XML document",format:"xml"}]),e}getFeatures(){throw _DocumentSource._abstractMethodException}_ajax(e,t){let r=new _Promise;return t=t||{},t.urlEncode=!1,this.httpRequest(e,t).then(e=>{let i={xhr:e};try{if(e.responseText&&!1!==t.parseResponse&&(i.json=JSON.parse(e.responseText).d),i.json&&i.json.Error)throw"";r.resolve(i)}catch(e){r.reject(i)}},e=>{r.reject(e)}),r}_convertFromServiceParameter(e){var t=(e,t)=>(null!=e&&_ArParameterType.DateTime,e);return e.Value=t(e.Value,e.ParameterType),e.AvailableValues=(e.AvailableValues||[]).map(r=>({Label:r.Label,Value:t(r.Value,e.ParameterType)})),e}_convertToServiceParameter(e){var t=(e,t)=>(null!=e&&_ArParameterType.DateTime,e);return e.Value=t(e.Value,e.ParameterType),e.Values&&e.Values.forEach(r=>{r.Value=t(r.Value,e.ParameterType)}),e}_merge(e,t){if(e&&t){for(let r in e)t[r]=e[r];return t}}_mergeParameters(e,t){var r=[],i=t.map(t=>{var i=t.Name.toLowerCase();r.push(i);var o=e.filter(e=>i===e.Name.toLowerCase());return o.length?(t.Value=o[0].Value,t):t});return i.push.apply(i,e.filter(e=>r.indexOf(e.Name.toLowerCase())<0)),i}_parseXml(e){return(new DOMParser).parseFromString(e,"text/xml")}}exports._ArReportService=_ArReportService;class _ArReportSource extends _ReportSourceBase{constructor(e,t){super(e,t)}get autoRun(){return this._innerService.autoRun}get encodeRequestParams(){return!1}get hasParameters(){var e=this._innerService.parameters;return e&&e.length>0}get hasThumbnails(){return!1}get _innerService(){return this.service}getParameters(){var e=new _Promise,t=this._convertParameters(this._innerService.parameters);return e.resolve(t)}setParameters(e){var t=new _Promise,r=[],i={};return this._innerService.parameters.forEach(e=>{i[e.Name]=e}),Object.keys(e).forEach(t=>{var o;r.push(o={AllowEmpty:i[t].AllowEmpty,DateOnly:i[t].DateOnly,MultiLine:i[t].MultiLine,MultiValue:i[t].MultiValue,Name:t,Nullable:i[t].Nullable,ParameterType:i[t].ParameterType}),o.MultiValue&&wjcCore.isArray(e[t])?o.Values=e[t].map(e=>({Value:e})):o.Value=e[t]}),this._innerService.setParameters(r).then(e=>{this._convertParameters(e.filter(e=>e.State!==_ArParameterState.OK));t.resolve(this._convertParameters(e))}),t}print(e){this.getExportedUrl({format:"pdf",printing:!0},!0).then(e=>{if(e)try{var t=window.open(e,"_blank");t&&t.focus()}catch(t){window.location.assign(e+"&Attachment=1")}})}_createDocumentService(e){return new _ArReportService(e,this.httpHandler)}_getIsDisposed(){return super._getIsDisposed()||this._innerService.isDisposed}_updateExecutionInfo(e){super._updateExecutionInfo(e)}_checkIsLoadCompleted(e){return e.status===_ExecutionStatus.completed||e.status===_ExecutionStatus.stopped}_convertParameters(e){return e.map(e=>({allowedValues:e.AvailableValues&&e.AvailableValues.length?e.AvailableValues.map(e=>({key:e.Label,value:e.Value})):void 0,allowBlank:e.AllowEmpty,dataType:e.ParameterType===_ArParameterType.Boolean?_ParameterType.Boolean:e.ParameterType===_ArParameterType.DateTime?_ParameterType.DateTime:e.ParameterType===_ArParameterType.Float?_ParameterType.Float:e.ParameterType===_ArParameterType.Integer?_ParameterType.Integer:_ParameterType.String,error:e.ExtendedErrorInfo,hidden:!1,name:e.Name,nullable:!!e.Nullable,maxLength:0,multiValue:e.MultiValue,prompt:e.Prompt,value:e.MultiValue&&e.Values&&e.Values.length?e.Values.map(e=>e.Value):e.Value}))}}exports._ArReportSource=_ArReportSource;