@syncfusion/ej2-pdfviewer
Version:
Essential JS 2 PDF viewer Component
10 lines • 3.19 MB
JavaScript
/*!
* filename: ej2-pdfviewer.umd.min.js
* version : 29.1.35
* Copyright Syncfusion Inc. 2001 - 2024. All rights reserved.
* Use of this code is subject to the terms of our license.
* A copy of the current license can be obtained at any time by e-mailing
* licensing@syncfusion.com. Any infringement will be prosecuted under
* applicable laws.
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@syncfusion/ej2-base"),require("@syncfusion/ej2-drawings"),require("@syncfusion/ej2-inputs"),require("@syncfusion/ej2-popups"),require("@syncfusion/ej2-splitbuttons"),require("@syncfusion/ej2-inplace-editor"),require("@syncfusion/ej2-navigations"),require("@syncfusion/ej2-notifications"),require("@syncfusion/ej2-pdf"),require("@syncfusion/ej2-buttons"),require("@syncfusion/ej2-dropdowns"),require("@syncfusion/ej2-data"),require("@syncfusion/ej2-lists")):"function"==typeof define&&define.amd?define(["exports","@syncfusion/ej2-base","@syncfusion/ej2-drawings","@syncfusion/ej2-inputs","@syncfusion/ej2-popups","@syncfusion/ej2-splitbuttons","@syncfusion/ej2-inplace-editor","@syncfusion/ej2-navigations","@syncfusion/ej2-notifications","@syncfusion/ej2-pdf","@syncfusion/ej2-buttons","@syncfusion/ej2-dropdowns","@syncfusion/ej2-data","@syncfusion/ej2-lists"],t):t((e=e||self).ej={},e.ej2Base,e.ej2Drawings,e.ej2Inputs,e.ej2Popups,e.ej2Splitbuttons,e.ej2InplaceEditor,e.ej2Navigations,e.ej2Notifications,e.ej2Pdf,e.ej2Buttons,e.ej2Dropdowns,e.ej2Data,e.ej2Lists)}(this,function(P,G,J,F,T,k,N,w,R,j,L,U,O,z){"use strict";H=function(e,t){return(H=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])}))(e,t)};var H,Y,K=function(e,t){function i(){this.constructor=e}H(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},e=function(e,t,i,n){var o,r=arguments.length,a=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;0<=s;s--)(o=e[s])&&(a=(r<3?o(a):3<r?o(t,i,a):o(t,i))||a);return 3<r&&a&&Object.defineProperty(t,i,a),a},W=(Y=G.ChildProperty,K(Z,Y),e([G.Property(0)],Z.prototype,"x",void 0),e([G.Property(0)],Z.prototype,"y",void 0),e([G.Property(0)],Z.prototype,"width",void 0),e([G.Property(0)],Z.prototype,"height",void 0),e([G.Property(0)],Z.prototype,"left",void 0),e([G.Property(0)],Z.prototype,"top",void 0),e([G.Property(0)],Z.prototype,"right",void 0),e([G.Property(0)],Z.prototype,"bottom",void 0),e([G.Complex({x:0,y:0},J.Point)],Z.prototype,"location",void 0),e([G.Complex(new J.Size(0,0),J.Size)],Z.prototype,"size",void 0),Z);function Z(){return null!==Y&&Y.apply(this,arguments)||this}X=G.ChildProperty,K(q,X),e([G.Property(!1)],q.prototype,"isBold",void 0),e([G.Property(!1)],q.prototype,"isItalic",void 0),e([G.Property(!1)],q.prototype,"isUnderline",void 0),e([G.Property(!1)],q.prototype,"isStrikeout",void 0);var X,_=q;function q(){return null!==X&&X.apply(this,arguments)||this}$=G.ChildProperty,K(t,$),e([G.Property("")],t.prototype,"id",void 0),e([G.Property("Rectangle")],t.prototype,"shapeAnnotationType",void 0),e([G.Property(null)],t.prototype,"formFieldAnnotationType",void 0),e([G.Property("")],t.prototype,"measureType",void 0),e([G.Property("")],t.prototype,"author",void 0),e([G.Property("")],t.prototype,"modifiedDate",void 0),e([G.Property("")],t.prototype,"subject",void 0),e([G.Property("")],t.prototype,"notes",void 0),e([G.Property(!1)],t.prototype,"isCommentLock",void 0),e([G.Property("black")],t.prototype,"strokeColor",void 0),e([G.Property("#ffffff00")],t.prototype,"fillColor",void 0),e([G.Property("#ffffff00")],t.prototype,"stampFillColor",void 0),e([G.Property("black")],t.prototype,"stampStrokeColor",void 0),e([G.Property("")],t.prototype,"data",void 0),e([G.Property(1)],t.prototype,"opacity",void 0),e([G.Property(1)],t.prototype,"thickness",void 0),e([G.Property("")],t.prototype,"borderStyle",void 0),e([G.Property("")],t.prototype,"borderDashArray",void 0),e([G.Property(0)],t.prototype,"rotateAngle",void 0),e([G.Property(!1)],t.prototype,"isCloudShape",void 0),e([G.Property(0)],t.prototype,"cloudIntensity",void 0),e([G.Property(40)],t.prototype,"leaderHeight",void 0),e([G.Property(null)],t.prototype,"lineHeadStart",void 0),e([G.Property(null)],t.prototype,"lineHeadEnd",void 0),e([G.Property([])],t.prototype,"vertexPoints",void 0),e([G.Property(null)],t.prototype,"sourcePoint",void 0),e([G.Property("None")],t.prototype,"sourceDecoraterShapes",void 0),e([G.Property("None")],t.prototype,"taregetDecoraterShapes",void 0),e([G.Property(null)],t.prototype,"targetPoint",void 0),e([G.Property([])],t.prototype,"segments",void 0),e([G.Complex({x:0,y:0},W)],t.prototype,"bounds",void 0),e([G.Property(0)],t.prototype,"pageIndex",void 0),e([G.Property(-1)],t.prototype,"zIndex",void 0),e([G.Property(null)],t.prototype,"wrapper",void 0),e([G.Property(!1)],t.prototype,"isDynamicStamp",void 0),e([G.Property("")],t.prototype,"dynamicText",void 0),e([G.Property("")],t.prototype,"annotName",void 0),e([G.Property({})],t.prototype,"review",void 0),e([G.Property([])],t.prototype,"comments",void 0),e([G.Property("#000")],t.prototype,"fontColor",void 0),e([G.Property(16)],t.prototype,"fontSize",void 0),e([G.Property("Helvetica")],t.prototype,"fontFamily",void 0),e([G.Property("None")],t.prototype,"fontStyle",void 0),e([G.Property(!1)],t.prototype,"enableShapeLabel",void 0),e([G.Property("label")],t.prototype,"labelContent",void 0),e([G.Property("#ffffff00")],t.prototype,"labelFillColor",void 0),e([G.Property(15)],t.prototype,"labelMaxLength",void 0),e([G.Property("")],t.prototype,"template",void 0),e([G.Property("")],t.prototype,"templateSize",void 0),e([G.Property(1)],t.prototype,"labelOpacity",void 0),e([G.Property("")],t.prototype,"annotationSelectorSettings",void 0),e([G.Property("#ffffff00")],t.prototype,"labelBorderColor",void 0),e([G.Property("left")],t.prototype,"textAlign",void 0),e([G.Property("")],t.prototype,"signatureName",void 0),e([G.Property(0)],t.prototype,"minHeight",void 0),e([G.Property(0)],t.prototype,"minWidth",void 0),e([G.Property(0)],t.prototype,"maxHeight",void 0),e([G.Property(0)],t.prototype,"maxWidth",void 0),e([G.Property(!1)],t.prototype,"isLock",void 0),e([G.Property("UI Drawn Annotation")],t.prototype,"annotationAddMode",void 0),e([G.Property("")],t.prototype,"annotationSettings",void 0),e([G.Property(16)],t.prototype,"previousFontSize",void 0),e([G.Complex({isBold:!1,isItalic:!1,isStrikeout:!1,isUnderline:!1},_)],t.prototype,"font",void 0),e([G.Complex({x:0,y:0},W)],t.prototype,"labelBounds",void 0),e([G.Property(null)],t.prototype,"customData",void 0),e([G.Property(["None"])],t.prototype,"allowedInteractions",void 0),e([G.Property(!0)],t.prototype,"isPrint",void 0),e([G.Property(!1)],t.prototype,"isReadonly",void 0),e([G.Property(0)],t.prototype,"pageRotation",void 0),e([G.Property("")],t.prototype,"icon",void 0),e([G.Property(!1)],t.prototype,"isAddAnnotationProgrammatically",void 0),e([G.Property(!1)],t.prototype,"isTransparentSet",void 0);var $,ee=t;function t(e,t,i,n){return $.call(this,e,t,i,n)||this}te=G.ChildProperty,K(i,te),e([G.Property("")],i.prototype,"id",void 0),e([G.Property("")],i.prototype,"signatureType",void 0),e([G.Property("")],i.prototype,"name",void 0),e([G.Property("")],i.prototype,"value",void 0),e([G.Property(null)],i.prototype,"formFieldAnnotationType",void 0),e([G.Property("#daeaf7ff")],i.prototype,"backgroundColor",void 0),e([G.Property("black")],i.prototype,"color",void 0),e([G.Property("#303030")],i.prototype,"borderColor",void 0),e([G.Property("")],i.prototype,"tooltip",void 0),e([G.Property(1)],i.prototype,"opacity",void 0),e([G.Property(1)],i.prototype,"thickness",void 0),e([G.Property(0)],i.prototype,"rotateAngle",void 0),e([G.Complex({x:0,y:0},W)],i.prototype,"bounds",void 0),e([G.Property(0)],i.prototype,"pageIndex",void 0),e([G.Property(1)],i.prototype,"pageNumber",void 0),e([G.Property(-1)],i.prototype,"zIndex",void 0),e([G.Property(null)],i.prototype,"wrapper",void 0),e([G.Property(16)],i.prototype,"fontSize",void 0),e([G.Property("Helvetica")],i.prototype,"fontFamily",void 0),e([G.Property("None")],i.prototype,"fontStyle",void 0),e([G.Property("left")],i.prototype,"alignment",void 0),e([G.Property(0)],i.prototype,"minHeight",void 0),e([G.Property(0)],i.prototype,"minWidth",void 0),e([G.Property(0)],i.prototype,"maxHeight",void 0),e([G.Property(0)],i.prototype,"maxWidth",void 0),e([G.Property(0)],i.prototype,"maxLength",void 0),e([G.Property("visible")],i.prototype,"visibility",void 0),e([G.Property(!0)],i.prototype,"isPrint",void 0),e([G.Property(!1)],i.prototype,"isReadonly",void 0),e([G.Property(!1)],i.prototype,"isChecked",void 0),e([G.Property(!1)],i.prototype,"isSelected",void 0),e([G.Property(!1)],i.prototype,"isRequired",void 0),e([G.Property(!1)],i.prototype,"isMultiline",void 0),e([G.Property(!1)],i.prototype,"isTransparent",void 0),e([G.Property(!1)],i.prototype,"insertSpaces",void 0),e([G.Property("")],i.prototype,"options",void 0),e([G.Property()],i.prototype,"signatureIndicatorSettings",void 0),e([G.Complex({isBold:!1,isItalic:!1,isStrikeout:!1,isUnderline:!1},_)],i.prototype,"font",void 0),e([G.Property()],i.prototype,"selectedIndex",void 0),e([G.Property(null)],i.prototype,"customData",void 0);var te,ie=i;function i(e,t,i,n){return te.call(this,e,t,i,n)||this}Object.defineProperty(oe.prototype,"pageId",{get:function(){return this.pageIdTemp},set:function(e){this.pageIdTemp=e},enumerable:!0,configurable:!0}),Object.defineProperty(oe.prototype,"zIndex",{get:function(){return this.zIndexTemp},set:function(e){this.zIndexTemp=e},enumerable:!0,configurable:!0}),Object.defineProperty(oe.prototype,"objects",{get:function(){return this.childNodesTemp},set:function(e){this.childNodesTemp=e},enumerable:!0,configurable:!0});var ne=oe;function oe(){this.pageIdTemp=0,this.zIndexTemp=-1,this.childNodesTemp=[],this.objects=[],this.zIndexTemp=-1,this.pageIdTemp=0}re=function(e,t){return(re=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])}))(e,t)};var re,ae,K=function(e,t){function i(){this.constructor=e}re(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},e=function(e,t,i,n){var o,r=arguments.length,a=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;0<=s;s--)(o=e[s])&&(a=(r<3?o(a):3<r?o(t,i,a):o(t,i))||a);return 3<r&&a&&Object.defineProperty(t,i,a),a},se=(ae=G.ChildProperty,K(le,ae),le.prototype.init=function(e){var t=new J.Container;if(t.measureChildren=!1,t.children=[],this.formFields&&0<this.formFields.length)for(var i=0;i<this.formFields.length;i++){var n=e.pdfViewer.nameTable[this.formFields[parseInt(i.toString(),10)].id].wrapper;t.children.push(n)}else if(this.annotations)for(i=0;i<this.annotations.length;i++)G.isNullOrUndefined(this.annotations[parseInt(i.toString(),10)])||(n=e.pdfViewer.nameTable[this.annotations[parseInt(i.toString(),10)].id].wrapper,t.children.push(n));return this.wrapper=t},e([G.Property(null)],le.prototype,"wrapper",void 0),e([G.Collection([],ee)],le.prototype,"annotations",void 0),e([G.Collection([],ie)],le.prototype,"formFields",void 0),e([G.Property()],le.prototype,"width",void 0),e([G.Property()],le.prototype,"height",void 0),e([G.Property(0)],le.prototype,"rotateAngle",void 0),e([G.Property(0)],le.prototype,"offsetX",void 0),e([G.Property(0)],le.prototype,"offsetY",void 0),e([G.Complex({x:.5,y:.5},J.Point)],le.prototype,"pivot",void 0),le);function le(){return null!==ae&&ae.apply(this,arguments)||this}function de(e){return"Line"===e.shapeAnnotationType||"LineWidthArrowHead"===e.shapeAnnotationType||"Distance"===e.shapeAnnotationType||"Polygon"===e.shapeAnnotationType}function Ae(e,t){var i;e&&t&&(e.formFieldAnnotationType?-1!==e.id.indexOf("diagram_helper")?(t.style.fill="transparent",t.style.strokeWidth=1,t.style.strokeDashArray=e.borderDashArray):(t.style.fill="transparent",t.style.strokeWidth=0):(i="#ffffff00"===e.fillColor?"transparent":e.fillColor,t.style.fill=i||"white",t.style.strokeColor=e.strokeColor||e.borderColor,t.style.color=e.strokeColor||e.borderColor,t.style.strokeWidth=e.thickness,"Image"!==e.shapeAnnotationType&&"SignatureText"!==e.shapeAnnotationType&&"SignatureImage"!==e.shapeAnnotationType||(t.style.strokeWidth=0),t.style.strokeDashArray=e.borderDashArray,t.style.opacity=e.opacity))}function pe(e){for(var t=0,i=0;i<e.length-1;i++)t+=J.Point.findLength(e[parseInt(i.toString(),10)],e[i+1]);return t}function he(e,t){e={width:e.actualSize.width,height:e.actualSize.height,x:e.offsetX-e.actualSize.width*e.pivot.x+.5,y:e.offsetY-e.actualSize.height*e.pivot.y+.5,angle:e.rotateAngle+e.parentTransform,fill:e.style.fill,stroke:e.style.strokeColor,pivotX:e.pivot.x,pivotY:e.pivot.y,strokeWidth:1,opacity:e.style.opacity,dashArray:e.style.strokeDashArray||"",visible:e.visible,id:e.id};return t&&(e.x+=t.tx,e.y+=t.ty),e}function ce(e){return e=void 0!==e&&"string"==typeof e?G.getValue(e,window):e}function b(e,t,i){var n={};if(e){i=e.propName;for(var o=e.properties||e,r=[],a=[],s=((r=r.concat(Object.keys(o))).push("version"),i&&(a=(o=ce(t))?o(i):[],r=r.concat(a)),ue(i)),l=0,d=r=r.concat(s);l<d.length;l++){var A=d[l];"historyManager"!==A&&("wrapper"!==A?e[""+A]&&Object.prototype.hasOwnProperty.call(e,"observers")||(e[""+A]instanceof Array?n[""+A]=ge((-1===s.indexOf(A)&&e[""+i]?e[""+i]:e)[""+A],t):e[""+A]instanceof Array==!1&&e[""+A]instanceof HTMLElement?n[""+A]=e[""+A].cloneNode(!0).innerHtml:e[""+A]instanceof Array==!1&&e[""+A]instanceof Object&&"template"!==A?n[""+A]=b((-1===s.indexOf(A)&&e[""+i]?e[""+i]:e)[""+A]):n[""+A]=e[""+A]):e[""+A]&&(n[""+A]={actualSize:{width:e[""+A].actualSize.width,height:e[""+A].actualSize.height},offsetX:e[""+A].offsetX,offsetY:e[""+A].offsetY}))}}return n}function ge(e,t,i){if(e)for(var n=[],o=0;o<e.length;o++)!(e[parseInt(o.toString(),10)]instanceof Array)&&e[parseInt(o.toString(),10)]instanceof Object?n.push(b(e[parseInt(o.toString(),10)],t)):n.push(e[parseInt(o.toString(),10)]);return n}function ue(e){switch(e){case"nodes":case"children":return["inEdges","outEdges","parentId","processId","nodeId","umlIndex","isPhase","isLane"];case"connectors":return["parentId"];case"annotation":case"annotations":return["nodeId"];case"shape":return["hasHeader"]}return[]}function fe(e,t){var i;if("Distance"===e.shapeAnnotationType)for(var n=0,o=void 0,r=0;r<e.wrapper.children.length;r++){var a=J.Point.findAngle(e.sourcePoint,e.targetPoint);if(-1<e.wrapper.children[parseInt(r.toString(),10)].id.indexOf("leader")){var s=e.wrapper.children[0].bounds.center,s=0===n?(o={x:e.sourcePoint.x,y:e.sourcePoint.y-e.leaderHeight},e.sourcePoint):(o={x:e.targetPoint.x,y:e.targetPoint.y-e.leaderHeight},e.targetPoint),l=J.identityMatrix();if(J.rotateMatrix(l,a,s.x,s.y),i=J.transformPointByMatrix(l,{x:o.x,y:o.y}),t==="Leader"+n)return{leader:"leader"+n,point:i};n++}}return{leader:"",point:i}}function me(e,t){var i=e.vertexPoints.slice(0);return i&&0<i.length&&(e.sourcePoint=i[0],e.targetPoint=i[i.length-1]),i}function we(e,t){for(var i,n="",o=[],r=0;r<t.length;)o.push({x:t[parseInt(r.toString(),10)].x,y:t[parseInt(r.toString(),10)].y}),r++;for(var o=Ie(e,o),a=0;a<o.length;a++)i=o[parseInt(a.toString(),10)],0===a&&(n="M"+i.x+" "+i.y),0<a&&(n+=" L"+i.x+" "+i.y);return n}function Be(e,t,i){new J.Rect;var n=we(e,t),t=J.Rect.toBounds(t);return i.width=t.width,i.height=t.height,i.offsetX=t.x+i.width/2,i.offsetY=t.y+i.height/2,i.data=n,e.wrapper&&(e.wrapper.offsetX=i.offsetX,e.wrapper.offsetY=i.offsetY,n=t.width,n=t.width<t.height?t.height:t.width,e.wrapper.width=e.enableShapeLabel?n/2:n,e.wrapper.height=t.height),i}function Ce(e,t){var i=me(e);return t.staticSize=!0,Ae(e,t=Be(e,i,t)),t}function Se(e,t,i,n,o){t.offsetX=i.x,t.offsetY=i.y;i=J.Point.findAngle(i,n),n=Re(o?e.sourceDecoraterShapes:e.taregetDecoraterShapes),o=0,o="LineWidthArrowHead"===e.shapeAnnotationType||"Line"===e.shapeAnnotationType?(o=e.thickness,new J.Size(12*o,12*o)):(o=e.thickness<=5?5:e.thickness,new J.Size(2*o,2*o));t.transform=J.RotateTransform.Self,Ae(e,t),t.style.fill="tranparent"!==e.fillColor?e.fillColor:"white",t.rotateAngle=i,t.data=n,t.canMeasurePath=!0,t.width=o.width,t.height=o.height,"Butt"===e.sourceDecoraterShapes&&(t.width=o.width-10,t.height=o.height+10)}function ye(e,t,i,n){var o=new J.PathElement;return Se(e,o,t,i,n),o}function Ie(e,t){return t[0]=Ee(e,t,!0),t[t.length-1]=Ee(e,t,!1),t}function Ee(e,t,i){var n={x:0,y:0},o=t.length,r=i?t[0]:t[o-1],i=i?t[1]:t[o-2],t=0===(t=J.Point.distancePoints(r,i))?1:t,o=e.thickness;n.x=Math.round(r.x+o*(i.x-r.x)/t),n.y=Math.round(r.y+o*(i.y-r.y)/t);return n=J.Point.adjustPoint(n,i,!0,.5)}function Qe(e,t,i,n){var o=[],r=J.Point.findAngle(t[0],t[1]),a=Fe(e,r);return!n.enableImportAnnotationMeasurement&&e.notes&&""!==e.notes?a.content=e.notes:a.content=i.setConversion(pe([t[0],t[1]])*i.pixelToPointFactor,e),a.rotateValue={y:-10,angle:r},!0===e.enableShapeLabel&&(a.style.strokeColor=e.labelBorderColor,a.style.fill=e.labelFillColor,a.style.fontSize=e.fontSize,a.style.color=e.fontColor,a.style.fontFamily=e.fontFamily),o.push(a),o}function De(e,t,i){for(var n,o=0;o<e.wrapper.children.length;o++){var r=e.wrapper.children[parseInt(o.toString(),10)];r&&!G.isNullOrUndefined(r.content)&&(n=i.setConversion(pe([t[0],t[1]])*i.pixelToPointFactor,e),r.content=n,r.childNodes[0].text=r.content,r.refreshTextElement())}return n}function Ve(e,t){for(var i,n=0;n<e.wrapper.children.length;n++){var o=e.wrapper.children[parseInt(n.toString(),10)];o&&!G.isNullOrUndefined(o.content)&&(i=t.setConversion(e.bounds.width/2*t.pixelToPointFactor,e),o.content=i,2===o.childNodes.length?(o.childNodes[0].text=i,o.childNodes.splice(o.childNodes.length-1,1)):o.childNodes[0].text=i,o.refreshTextElement())}return i}function xe(e,t,i,n){var o=[],t=J.Point.findAngle(t[0],t[1]),r=Fe(e,t);return!n.enableImportAnnotationMeasurement&&e.notes&&""!==e.notes?r.content=e.notes:r.content=i.calculatePerimeter(e),!0===e.enableShapeLabel&&(r.style.strokeColor=e.labelBorderColor,r.style.fill=e.labelFillColor,r.style.fontSize=e.fontSize,r.style.color=e.fontColor,r.style.fontFamily=e.fontFamily),r.rotateValue={y:-10,angle:t},o.push(r),o}function be(e,t,i){for(var n,o=0;o<e.wrapper.children.length;o++){var r=e.wrapper.children[parseInt(o.toString(),10)];r&&!G.isNullOrUndefined(r.content)&&(n=i.calculatePerimeter(e),r.content=n,r.childNodes[0].text=r.content,r.refreshTextElement())}return n}function Me(e){if(e.wrapper&&e.wrapper.children)for(var t=0;t<e.wrapper.children.length;t++){var i=e.wrapper.children[parseInt(t.toString(),10)];i&&!G.isNullOrUndefined(i.content)&&(i.content=e.notes,i.childNodes[0].text=i.content,i.refreshTextElement())}}function ve(e){for(var t,i="",i="M"+e[0].x+" "+e[0].y,n=1;n<e.length;n++)i+="L"+(t=e[parseInt(n.toString(),10)]).x+" "+t.y;return i+="Z"}function Fe(e,t){var i=new J.TextElement;return Ae(e,i),i.style.fill="transparent",i.id=J.randomId(),i.horizontalAlignment="Center",i.rotateValue={y:10,angle:t},i.verticalAlignment="Top",i.relativeMode="Object",i.setOffsetWithRespectToBounds(.5,.5,"Absolute"),i.style.textWrapping="NoWrap",i}function Te(e,t){var i=[],n=ke(e,t[0],t[1]);return i.push(n),n=ke(e,t[1],t[0],!0),i.push(n),i}function ke(e,t,i,n){var o=new J.PathElement,r=(o.offsetX=t.x,o.offsetY=t.y,J.Point.findAngle(t,i)),i={x:(t.x+i.x)/2,y:(t.y+i.y)/2},a=J.identityMatrix();J.rotateMatrix(a,0-r,i.x,i.y);var s={x:(i=J.transformPointByMatrix(a,t)).x,y:i.y-e.leaderHeight},a=J.identityMatrix(),i=(J.rotateMatrix(a,r,o.offsetX,o.offsetY),J.transformPointByMatrix(a,s)),a={x:t.x,y:t.y},s=(o.offsetX=a.x,o.offsetY=a.y,o.transform=J.RotateTransform.Self,"M"+t.x+","+t.y+",L"+i.x+","+i.y+"Z"),a=new J.Size(0,e.leaderHeight);return o.pivot.x=.5,n?(o.id="leader2_"+J.randomId(),o.pivot.y=0):(o.id="leader1_"+J.randomId(),o.pivot.y=1),Ae(e,o),o.rotateAngle=r,o.data=s,o.canMeasurePath=!0,o.width=a.width,o.height=a.height,o}function Pe(e,t){var i=e.vertexPoints;if(!G.isNullOrUndefined(i))for(var n=0;n<i.length-1;n++){var o=i[parseInt(n.toString(),10)],r=i[n+1],a=J.Rect.toBounds([o,r]);if(a.Inflate(10),a.containsPoint(t)){var a=Ne(t,o,r),s={x1:o.x,x2:r.x,y1:o.y,y2:r.y},l={x1:t.x,x2:a.x,y1:t.y,y2:a.y},s=J.intersect3(s,l);if(s.enabled){l=J.Point.findLength(t,s.intersectPt);if(Math.abs(l)<10)return!0}else{s=J.Rect.toBounds([t,t]);if(s.Inflate(3),s.containsPoint(o)||s.containsPoint(r))return!0}if(J.Point.equals(t,a))return!0}}return!1}function Ne(e,t,i){var n=J.Point.findLength(t,e),n=J.Point.findLength(i,e)<n?i:t,t=J.Point.findAngle(t,i),i=J.Point.findAngle(n,e),e=J.Point.findLength(n,e),t=i+2*(t-i);return{x:n.x+e*Math.cos(t*Math.PI/180),y:n.y+e*Math.sin(t*Math.PI/180)}}function Re(e){return Oe[""+e]}var Le,Ue,Oe={OpenArrow:"M15.9,23 L5,16 L15.9,9 L17,10.7 L8.7,16 L17,21.3Z",Square:"M0,0 L10,0 L10,10 L0,10 z",Fletch:"M14.8,10c0,0-3.5,6,0.2,12c0,0-2.5-6-10.9-6C4.1,16,11.3,16,14.8,10z",OpenFetch:"M6,17c-0.6,0-1-0.4-1-1s0.4-1,1-1c10.9,0,11-5,11-5c0-0.6,0.4-1,1-1s1,0.4,1,1C19,10.3,18.9,17,6,17C6,17,6,17,6,17z M18,23c-0.5,0-1-0.4-1-1c0-0.2-0.3-5-11-5c-0.6,0-1-0.5-1-1s0.4-1,1-1c0,0,0,0,0,0c12.9,0,13,6.7,13,7 C19,22.6,18.6,23,18,23z",IndentedArrow:"M17,10c0,0-4.5,5.5,0,12L5,16L17,10z",OutdentedArrow:"M14.6,10c0,0,5.4,6,0,12L5,16L14.6,10z",DoubleArrow:"M19,10 L19,22 L13,16Z M12,10 L12,22 L6,16Z",Arrow:"M15,10 L15,22 L5,16Z",Diamond:"M12,23l-7-7l7-7l6.9,7L12,23z",Circle:"M0,50 A50,50,0 1 1 100,50 A50,50,0 1 1 0,50 Z",Butt:"M0,0 L0,90"},K=(Le=function(e,t){return(Le=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])}))(e,t)},function(e,t){function i(){this.constructor=e}Le(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),ze=(Ue=J.DrawingElement,K(He,Ue),He.prototype.templateCompiler=function(t){if(t)try{return"function"!=typeof t&&document.querySelectorAll(t).length?G.compile(document.querySelector(t).innerHTML.trim()):G.compile(t)}catch(e){return G.compile(t)}},He.prototype.getNodeTemplate=function(){return this.templateFn},He);function He(e){var t=Ue.call(this)||this;return t.templateFn=t.templateCompiler(e),t}n.prototype.renderLabels=function(e){var t=e.annotations;if(t)for(var i=0;i<t.length;i++){var n=t[parseInt(i.toString(),10)];this.initObject(n)}},n.prototype.createNewZindexTable=function(e){var t=new ne;return this.pdfViewer.zIndex++,t.pageId=this.pdfViewer.zIndex,this.pdfViewer.zIndexTable.push(t),t},n.prototype.getPageTable=function(e){var t;if(void 0!==this.pdfViewer.zIndexTable.length){for(var i=!0,n=0;n<this.pdfViewer.zIndexTable.length;n++)if(this.pdfViewer.zIndexTable[parseInt(n.toString(),10)].pageId===e){i=!1,t=this.pdfViewer.zIndexTable[parseInt(n.toString(),10)];break}i&&((t=this.createNewZindexTable(e)).pageId=e)}else t=this.createNewZindexTable(e);return t},n.prototype.setZIndex=function(e,t){if(void 0!==t.pageIndex){var i,n=this.getPageTable(t.pageIndex),o=!1;if("Polygon"!==t.shapeAnnotationType)for(var r=0;r<n.objects.length;r++)if(t.id===n.objects[parseInt(r.toString(),10)].id){n.objects.splice(parseInt(r.toString(),10),1),n.objects.splice(parseInt(r.toString(),10),0,t),o=!0;break}o||(-1===t.zIndex?(n.zIndex++,t.zIndex=n.zIndex):(i=n.objects.length,t.zIndex=i++),n.objects.push(t))}},n.prototype.initObject=function(e){return this.setZIndex(this.pdfViewer.zIndex,e),J.createMeasureElements(),de(e)?(this.initLine(e),e.wrapper.measure(new J.Size(void 0,void 0)),e.wrapper.arrange(e.wrapper.desiredSize)):this.initNode(e),e.wrapper,(this.pdfViewer.nameTable[e.id]=e).formFieldAnnotationType&&this.nodePropertyChange(e,{bounds:{width:e.bounds.width,height:e.bounds.height}}),e},n.prototype.initNode=function(e){var t=this.initContainer(e);t.children||(t.children=[]),this.init(e,t),t.rotateAngle=e.rotateAngle,t.measure(new J.Size(e.wrapper.width,e.wrapper.height)),t.arrange(t.desiredSize),this.isDynamicStamps&&(this.pdfViewer.annotation.stampAnnotationModule.updateSessionStorage(e,null,"dynamicStamp"),this.isDynamicStamps=!1)},n.prototype.init=function(e,t){var i=new J.DrawingElement,n=this.pdfViewer.annotationModule?this.pdfViewer.annotationModule.findAnnotationSettings(e):{},o=0,r=0,a=0,s=0,n=((n.minWidth||n.maxWidth||n.minHeight||n.maxHeight)&&(o=n.maxHeight||2e3,r=n.maxWidth||2e3,a=n.minHeight||0,s=n.minWidth||0),!1);return(a||s||o||r)&&(n=!0),(i=e.formFieldAnnotationType?this.initFormFields(e,i,t):this.initAnnotationObject(e,void 0,i,t,!1,void 0,n,o,r,s,a)).id=e.id+"_content",i.relativeMode="Object","Stamp"!==e.shapeAnnotationType&&(void 0!==e.bounds.width&&(i.width=e.bounds.width,n)&&(i.width<s||i.width>r)&&(i.width<s&&(i.width=s),i.width>r)&&(i.width=r),i.horizontalAlignment="Stretch",void 0!==e.bounds.height&&(i.height=e.bounds.height,n)&&(i.height<a||i.width>o)&&(i.height<a&&(i.height=a),i.height>o)&&(i.height=o),Ae(e,i),this.pdfViewer.viewerBase.drawSignatureWithTool)&&"SignatureText"===e.shapeAnnotationType&&(i.style.strokeWidth=0),i.isRectElement=!0,i.verticalAlignment="Stretch",i},n.prototype.initFormFields=function(e,t,i){switch(e.formFieldAnnotationType){case"Textbox":case"PasswordField":case"Checkbox":case"RadioButton":case"DropdownList":case"ListBox":case"SignatureField":case"InitialField":(t=new ze).id=e.id+"_content",i.children.push(t)}return t},n.prototype.initAnnotationObject=function(e,t,i,n,o,r,a,s,l,d,A){switch(e.shapeAnnotationType){case"Ellipse":(t=new J.PathElement).data="M80.5,12.5 C80.5,19.127417 62.59139,24.5 40.5,24.5 C18.40861,24.5 0.5,19.127417 0.5,12.5C0.5,5.872583 18.40861,0.5 40.5,0.5 C62.59139,0.5 80.5,5.872583 80.5,12.5 z",i=t,n.children.push(i),e.enableShapeLabel&&((g=this.textElement(e)).content=e.labelContent,g.style.color=e.fontColor,g.style.strokeColor=e.labelBorderColor,g.style.fill=e.labelFillColor,g.style.fontSize=e.fontSize,g.style.fontFamily=e.fontFamily,g.style.opacity=e.labelOpacity,n.children.push(g));break;case"Path":(t=new J.PathElement).data=e.data,i=t,n.children.push(i);break;case"HandWrittenSignature":case"Ink":(t=new J.PathElement).data=e.data,t.style.strokeColor=e.strokeColor,t.style.strokeWidth=e.thickness,t.style.opacity=e.opacity,i=t,n.children.push(i);break;case"Polygon":(t=new J.PathElement).data=ve(e.vertexPoints),i=t,n.children.push(i);break;case"Stamp":this.isDynamicStamps=o=!0,e&&e.annotationAddMode&&("Existing Annotation"===e.annotationAddMode||"Imported Annotation"===e.annotationAddMode)&&(e.bounds.width=e.bounds.width-20,e.bounds.height=e.bounds.height-20),e.isDynamicStamp?(n.horizontalAlignment="Left",(i=r=new J.DrawingElement).cornerRadius=10,i.style.fill=e.stampFillColor,i.style.strokeColor=e.stampStrokeColor,n.children.push(i),h=this.textElement(e),(h=new J.TextElement).style.fontFamily="Helvetica",h.style.fontSize=14,h.style.italic=!0,h.style.bold=!0,h.style.color=e.fillColor,h.rotateValue=void 0,h.content=e.dynamicText,h.relativeMode="Point",h.margin.left=10,h.margin.bottom=-7,h.setOffsetWithRespectToBounds(0,.57,null),h.relativeMode="Point","Existing Annotation"!==e.annotationAddMode&&"Imported Annotation"!==e.annotationAddMode||(h.style.fontSize=this.fontSizeCalculation(e,h,e.bounds.width-10)),n.children.push(h),(p=new J.PathElement).id=J.randomId()+"_stamp",p.data=e.data,p.width=e.bounds.width,a&&e.bounds.width>l&&(p.width=l,e.bounds.width=l),p.height=e.bounds.height/2,a&&e.bounds.height>s&&(p.height=s/2,e.bounds.height=s/2),p.rotateValue=void 0,p.margin.left=10,p.margin.bottom=-5,p.relativeMode="Point",p.setOffsetWithRespectToBounds(0,.1,null),(c=p).style.fill=e.fillColor,p.style.strokeColor=e.strokeColor,p.style.opacity=e.opacity,i.width=e.bounds.width+20,i.height=e.bounds.height+20,i.style.opacity=e.opacity,n.children.push(c)):(n.horizontalAlignment="Left",(i=r=new J.DrawingElement).cornerRadius=10,i.style.fill=e.stampFillColor,i.style.strokeColor=e.stampStrokeColor,n.children.push(i),(p=new J.PathElement).id=J.randomId()+"_stamp",p.data=e.data,p.width=e.bounds.width,a&&e.bounds.width>l&&(p.width=l,e.bounds.width=l),p.height=e.bounds.height,a&&e.bounds.height>s&&(p.height=s,e.bounds.height=s),p.minWidth=p.width/2,p.minHeight=p.height/2,(c=p).style.fill=e.fillColor,p.style.strokeColor=e.strokeColor,p.style.opacity=e.opacity,i.width=e.bounds.width+20,i.height=e.bounds.height+20,i.minWidth=p.width/2,i.minHeight=p.height/2,i.style.opacity=e.opacity,n.children.push(c),n.minHeight=i.minHeight+20,n.minWidth=i.minWidth+20);break;case"Image":case"SignatureImage":var p=new J.ImageElement;p.source=e.data,(i=p).style.strokeWidth=0,n.children.push(i);break;case"Rectangle":i=r=new J.DrawingElement,n.children.push(i),e.enableShapeLabel&&((g=this.textElement(e)).content=e.labelContent,g.style.color=e.fontColor,g.style.strokeColor=e.labelBorderColor,g.style.fill=e.labelFillColor,g.style.fontSize=e.fontSize,g.style.fontFamily=e.fontFamily,g.style.opacity=e.labelOpacity,n.children.push(g));break;case"Perimeter":(t=new J.PathElement).data="M80.5,12.5 C80.5,19.127417 62.59139,24.5 40.5,24.5 C18.40861,24.5 0.5,19.127417 0.5,12.5C0.5,5.872583 18.40861,0.5 40.5,0.5 C62.59139,0.5 80.5,5.872583 80.5,12.5 z",Ae(e,i=t),n.children.push(i),(r=new J.DrawingElement).id="perimeter_"+J.randomId(),r.height=.2,r.width=.2,r.transform=J.RotateTransform.Self,r.horizontalAlignment="Stretch",this.setNodePosition(r,e),r.rotateAngle=e.rotateAngle,Ae(e,r),n.children.push(r);var h=this.textElement(e);(h=new J.TextElement).content=h.content=pe([{x:e.bounds.x,y:e.bounds.y},{x:e.bounds.x+e.bounds.width,y:e.bounds.y+e.bounds.height}]).toString(),h.rotateValue={y:-10,angle:e.rotateAngle},n.children.push(h);break;case"Radius":(t=new J.PathElement).data="M80.5,12.5 C80.5,19.127417 62.59139,24.5 40.5,24.5 C18.40861,24.5 0.5,19.127417 0.5,12.5C0.5,5.872583 18.40861,0.5 40.5,0.5 C62.59139,0.5 80.5,5.872583 80.5,12.5 z",Ae(e,i=t),n.children.push(i),(r=new J.DrawingElement).id="radius_"+J.randomId(),r.height=.2,r.width=e.bounds.width/2,r.transform=J.RotateTransform.Self,this.setNodePosition(r,e),r.rotateAngle=e.rotateAngle,Ae(e,r),n.children.push(r);var c=this.textElement(e);e.enableShapeLabel&&(c.style.color=e.fontColor,c.style.strokeColor=e.labelBorderColor,c.style.fill=e.labelFillColor,c.style.fontSize=e.fontSize,c.style.fontFamily=e.fontFamily,c.style.opacity=e.labelOpacity),pe([{x:e.bounds.x,y:e.bounds.y},{x:e.bounds.x+e.bounds.width,y:e.bounds.y+e.bounds.height}]);!this.pdfViewer.enableImportAnnotationMeasurement&&e.notes&&""!==e.notes?c.content=e.notes:c.content=this.pdfViewer.annotation.measureAnnotationModule.setConversion(e.bounds.width/2*this.pdfViewer.annotation.measureAnnotationModule.pixelToPointFactor,e),c.rotateValue={y:-10,x:e.bounds.width/4,angle:e.rotateAngle},n.children.push(c);break;case"StickyNotes":p=new J.ImageElement;p.source=e.data,p.width=e.bounds.width,p.height=e.bounds.height,p.style.strokeColor=e.strokeColor,p.style.strokeWidth=0,n.children.push(i=p);break;case"SignatureText":var g=new J.DrawingElement,h=(g.style.strokeWidth=0,(i=g).style.strokeWidth=0,n.style.strokeWidth=0,n.children.push(i),this.textElement(e));h.style.fontFamily=e.fontFamily,h.style.fontSize=e.fontSize,h.style.textAlign="Left",h.rotateValue=void 0,h.content=e.data,h.style.strokeWidth=0,n.children.push(h);break;case"FreeText":c=new J.DrawingElement,p=(n.children.push(i=c),this.textElement(e));(p=new J.TextElement).style.fontFamily=e.fontFamily,p.style.fontSize=e.fontSize,p.style.textAlign="Left","center"===e.textAlign.toLowerCase()?p.style.textAlign="Center":"right"===e.textAlign.toLowerCase()?p.style.textAlign="Right":"justify"===e.textAlign.toLowerCase()&&(p.style.textAlign="Justify"),p.style.color=e.fontColor,p.style.bold=e.font.isBold,p.style.italic=e.font.isItalic,!0===e.font.isUnderline?p.style.textDecoration="Underline":!0===e.font.isStrikeout&&(p.style.textDecoration="LineThrough"),p.rotateValue=void 0,p.content=e.dynamicText,p.style.opacity=e.opacity,p.margin.left=4,p.margin.right=5,p.margin.top=e.fontSize/16*5,this.pdfViewer.freeTextSettings.enableAutoFit?p.style.textWrapping="Wrap":p.style.textWrapping="WrapWithOverflow",p.relativeMode="Point",p.setOffsetWithRespectToBounds(0,0,null),p.relativeMode="Point",n.children.push(p)}return i.id=e.id+"_content",i.relativeMode="Object",o||(void 0!==e.bounds.width&&(i.width=e.bounds.width,a)&&(i.width<d||i.width>l)&&(i.width<d&&(i.width=d),i.width>l)&&(i.width=l),i.horizontalAlignment="Stretch",void 0!==e.bounds.height&&(i.height=e.bounds.height,a)&&(i.height<A||i.width>s)&&(i.height<A&&(i.height=A),i.height>s)&&(i.height=s),Ae(e,i)),i.isRectElement=!0,i.verticalAlignment="Stretch",i},n.prototype.textElement=function(e){var t=new J.TextElement;return Ae(e,t),t.horizontalAlignment="Center",t.verticalAlignment="SignatureText"===e.shapeAnnotationType?"Center":"Top",t.relativeMode="Object",t.setOffsetWithRespectToBounds(.5,.5,"Absolute"),t},n.prototype.setNodePosition=function(e,t){var i,n,o;"Perimeter"===t.shapeAnnotationType?(e.offsetX=t.bounds.x+t.bounds.width/2,e.offsetY=t.bounds.y+t.bounds.height/2):"Radius"===t.shapeAnnotationType&&(i={x:t.bounds.x+t.bounds.width/2+t.bounds.width/4,y:t.bounds.y+t.bounds.height/2},n={x:t.bounds.x+t.bounds.width/2,y:t.bounds.y+t.bounds.height/2},o=J.identityMatrix(),J.rotateMatrix(o,t.rotateAngle,n.x,n.y),o={x:(n=J.transformPointByMatrix(o,i)).x,y:n.y},e.offsetX=o.x,e.offsetY=o.y,e.width=t.bounds.width/2)},n.prototype.initContainer=function(e){e.id||(e.id=J.randomId());var t=new J.Canvas;return t.id=e.id,t.offsetX=e.bounds.x+.5*e.bounds.width,t.offsetY=e.bounds.y+.5*e.bounds.height,t.style.fill="transparent",t.style.strokeColor="transparent",t.rotateAngle=e.rotateAngle,e.wrapper=t},n.prototype.initLine=function(e){e.id||(e.id=J.randomId());var t=new J.Canvas,i=((r=new J.PathElement).id=e.id+"_path",new J.PathElement),n=new J.PathElement;if(e.vertexPoints.length){e.sourcePoint=e.vertexPoints[0],e.targetPoint=e.vertexPoints[e.vertexPoints.length-1];for(var o=0;o<e.vertexPoints.length;o++)0!==o&&o!==e.vertexPoints.length-1&&e.segments.push(e.vertexPoints[parseInt(o.toString(),10)])}var r=Ce(e,r),a=me(e),s=[],l=[],d=("Distance"===e.shapeAnnotationType&&(s=Te(e,a),l=Qe(e,a,this.pdfViewer.annotation.measureAnnotationModule,this.pdfViewer)),"Line"!==e.shapeAnnotationType&&"LineWidthArrowHead"!==e.shapeAnnotationType||"Perimeter"!==e.measureType||(l=xe(e,a,this.pdfViewer.annotation.measureAnnotationModule,this.pdfViewer)),!0===e.enableShapeLabel&&"Distance"!==e.shapeAnnotationType&&"Perimeter"!==e.measureType&&(d=J.Point.findAngle(a[0],a[1]),(A=this.textElement(e)).id=J.randomId(),!this.pdfViewer.enableImportAnnotationMeasurement&&e.notes&&""!==e.notes?A.content=e.notes:A.content=e.labelContent,A.style.strokeColor=e.labelBorderColor,A.style.fill=e.labelFillColor,A.style.fontSize=e.fontSize,A.style.color=e.fontColor,A.style.fontFamily=e.fontFamily,A.style.opacity=e.labelOpacity,A.rotateValue={y:-10,angle:d},l.push(A)),a=Ie(e,a),J.Rect.toBounds(a)),A=(t.width=d.width,t.height=d.height,t.offsetX=d.x+t.pivot.x*d.width,t.offsetY=d.y+t.pivot.y*d.height,e.vertexPoints);if("Line"!==e.shapeAnnotationType&&"LineWidthArrowHead"!==e.shapeAnnotationType&&"Distance"!==e.shapeAnnotationType||(i=ye(e,a[0],A[1],!0),n=ye(e,a[a.length-1],A[A.length-2],!1)),i.id=e.id+"_srcDec",n.id=e.id+"_tarDec",r.style.fill="transparent",t.style.strokeColor="transparent",t.style.fill="transparent",t.style.strokeWidth=0,t.children=[],Ae(e,r),t.children.push(r),0<s.length)for(o=0;o<s.length;o++)t.children.push(s[parseInt(o.toString(),10)]);if(0<l.length)for(o=0;o<l.length;o++)t.children.push(l[parseInt(o.toString(),10)]);if(t.children.push(i),t.children.push(n),"LineWidthArrowHead"===e.shapeAnnotationType)for(o=0;o<t.children.length;o++){var p=t.children[parseInt(o.toString(),10)];(p.id.includes("srcDec")||p.id.includes("tarDec"))&&(p.width=12*e.thickness,p.height=12*e.thickness)}return t.id=e.id,t.offsetX=r.offsetX,t.offsetY=r.offsetY,t.width=r.width,t.height=r.height,me(e),e.wrapper=t},n.prototype.add=function(e){var t=this.pdfViewer.allowServerDataBinding;return this.pdfViewer.enableServerDataBinding(!1),(e.formFieldAnnotationType&&this.pdfViewer.formDesignerModule?(e=new ie(this.pdfViewer,"formFields",e,!0),e=this.initObject(e),this.pdfViewer.formFields):(e=new ee(this.pdfViewer,"annotations",e,!0),e=this.initObject(e),this.pdfViewer.annotations)).push(e),this.pdfViewer.enableServerDataBinding(t,!0),e},n.prototype.remove=function(e){for(var t=this.pdfViewer.allowServerDataBinding,i=(this.pdfViewer.enableServerDataBinding(!1),e.pageIndex),n=0;n<this.pdfViewer.annotations.length;n++){var o=this.pdfViewer.annotations[parseInt(n.toString(),10)];if(o.id&&(o.id===e.id||o.id.split("_")[0]===e.id)||o.wrapper&&o.wrapper.id===e.id){this.pdfViewer.annotations.splice(n,1);for(var r=this.getPageObjects(e.pageIndex),a=0;a<r.length;a++)r[parseInt(a.toString(),10)].id===e.id&&(r.splice(a,1),"Path"===e.shapeAnnotationType||"SignatureImage"===e.shapeAnnotationType||"SignatureText"===e.shapeAnnotationType?this.refreshCanvasDiagramLayer(void 0,i,e.id):this.pdfViewer.renderDrawing(void 0,i))}}for(n=0;n<this.pdfViewer.formFields.length;n++)if((l=this.pdfViewer.formFields[parseInt(n.toString(),10)]).id===e.id||l.wrapper.id===e.id){this.pdfViewer.formFields.splice(n,1),this.pdfViewer.formDesignerModule&&e.formFieldAnnotationType&&this.pdfViewer.formFieldCollection.splice(n,1);for(r=this.getPageObjects(e.pageIndex),a=0;a<r.length;a++){if(r[parseInt(a.toString(),10)].id===e.id){r.splice(a,1);break}r[parseInt(a.toString(),10)]&&r[parseInt(a.toString(),10)].id&&-1!==r[parseInt(a.toString(),10)].id.indexOf(e.id)&&r.splice(a,1)}}if("Textbox"===e.formFieldAnnotationType||"Checkbox"===e.formFieldAnnotationType||"RadioButton"===e.formFieldAnnotationType||"PasswordField"===e.formFieldAnnotationType||"DropdownList"===e.formFieldAnnotationType||"ListBox"===e.formFieldAnnotationType||"SignatureField"===e.formFieldAnnotationType||"InitialField"===e.formFieldAnnotationType){var s=document.getElementById("form_field_"+e.id+"_content_html_element");s&&(s.remove(),this.pdfViewer.renderDrawing(void 0,i));for(var l,n=0;n<this.pdfViewer.formFieldCollections.length;n++)(l=this.pdfViewer.formFieldCollections[parseInt(n.toString(),10)]).id===e.id&&this.pdfViewer.formFieldCollections.splice(n,1);for(n=0;n<this.pdfViewer.viewerBase.formFieldCollection.length;n++)e.id==this.pdfViewer.viewerBase.formFieldCollection[parseInt(n.toString(),10)]&&this.pdfViewer.viewerBase.formFieldCollection.splice(n,1);s={name:e.name,id:e.id,value:e.value,fontFamily:e.fontFamily,fontSize:e.fontSize,fontStyle:e.fontStyle,color:e.color,backgroundColor:e.backgroundColor,alignment:e.alignment,isReadonly:e.isReadonly,visibility:e.visibility,maxLength:e.maxLength,isRequired:e.isRequired,isPrint:e.isPrint,rotation:e.rotateAngle,tooltip:e.tooltip,options:e.options,isChecked:e.isChecked,isSelected:e.isSelected};G.isNullOrUndefined(s)||"diagram_helper"===s.id||(this.pdfViewer.fireFormFieldRemoveEvent("formFieldRemove",s,e.pageIndex),this.pdfViewer.formDesignerModule.removeFieldsFromAnnotationCollections(e.id,s.name))}this.pdfViewer.enableServerDataBinding(t,!0)},n.prototype.getPageObjects=function(e){return this.getPageTable(e).objects},n.prototype.refreshCanvasDiagramLayer=function(e,t,i){var n=this;if(e=e||this.pdfViewer.viewerBase.getAnnotationCanvas("_annotationCanvas_",t)){var o=void 0,o=e.id===this.pdfViewer.element.id+"_print_annotation_layer_"+t?1:this.pdfViewer.viewerBase.getZoomFactor(),r=e.width/o,a=e.height/o,s=e.getContext("2d");s.lineCap="round",s.lineJoin="round",o<1&&(s.lineWidth=s.lineWidth/o);var l=o*this.pdfViewer.viewerBase.getWindowDevicePixelRatio();!G.Browser.isDevice||G.Browser.isDevice&&o<=.7?s.setTransform(l,0,0,l,0,0):s.setTransform(o,0,0,o,0,0),s.clearRect(0,0,r,a);for(var d=this.getPageObjects(t).filter(function(t,e,i){return"free"===t.id.split("_")[0]||(G.isNullOrUndefined(n.pdfViewer.formDesignerModule)?e===i.findIndex(function(e){return e.id===t.id}):e===i.findIndex(function(e){return e.id.split("_")[0]===t.id.split("_")[0]}))}),A=0;A<d.length;A++){var p,h,c=void 0;e.id===this.pdfViewer.element.id+"_print_annotation_layer_"+t?d[parseInt(A.toString(),10)].isPrint&&(c=this.pdfViewer.nameTable[d[parseInt(A.toString(),10)].id].wrapper,G.isNullOrUndefined(c)||J.refreshDiagramElements(e,[c],this.renderer)):(c=this.pdfViewer.nameTable[d[parseInt(A.toString(),10)].id].wrapper,p=d[parseInt(A.toString(),10)].id,p=this.pdfViewer.nameTable[""+p],(c&&this.shouldRefreshElement(p)||G.isNullOrUndefined(this.pdfViewer.formDesignerModule))&&(!G.isNullOrUndefined(p.properties.data)&&p.properties.data.includes("base64")&&((h=new Image).src=p.properties.data,null==window.customStampCollection&&void 0===window.customStampCollection&&(window.customStampCollection=new Map),window.customStampCollection)&&!window.customStampCollection.get(c.id)&&window.customStampCollection.set(c.id,h),J.refreshDiagramElements(e,[c],this.renderer)))}}},n.prototype.shouldRefreshElement=function(e){var t=this.pdfViewer.nameTable[e.id.split("_")[0]];return!G.isNullOrUndefined(t)&&"visible"===e.visibility||!G.isNullOrUndefined(e.subject)&&"SignatureField"!==e.annotName&&G.isNullOrUndefined(e.visibility)||"annotations"===e.propName&&"Path"!==e.shapeAnnotationType&&"SignatureText"!==e.shapeAnnotationType&&"SignatureImage"!==e.shapeAnnotationType||"SignatureImage"===e.shapeAnnotationType&&"formFields"!==e.propName||"SignatureText"===e.shapeAnnotationType&&"formFields"!==e.propName||G.isNullOrUndefined(t)&&"diagram_helper"===e.id},n.prototype.clearHighlighter=function(e){var e=this.getAdornerLayerSvg(this.pdfViewer.element.id+e+"_diagramAdornerLayer",e);e&&(e=e.getElementById(e.id+"_highlighter"))&&e.parentNode.removeChild(e)},n.prototype.getSelectorElement=function(e,t){var i=null,n=this.getAdornerLayerSvg(e,t);return i=n?n.getElementById(e+t+"_SelectorElement"):i},n.prototype.getAdornerLayerSvg=function(e,t){var i=null,e=J.getDiagramElement(e+t+"_diagramAdornerLayer");return i=e?e.getElementsByClassName("e-adorner-layer"+t)[0]:i},n.prototype.clearSelectorLayer=function(e){var t=this.getAdornerLayerSvg(this.pdfViewer.element.id,e);if(t)for(var t=t.getElementById(this.pdfViewer.adornerSvgLayer.id+"_selected_region"),i=(t&&t.parentNode.removeChild(t),this.clearHighlighter(e),this.getSelectorElement(this.pdfViewer.element.id,e).childNodes),n=void 0,o=i.length;0<o;o--)(n=i[o-1]).parentNode.removeChild(n)},n.prototype.renderSelector=function(e,t,i,n){if(!i||n){var n=new J.Size,o=this.pdfViewer.selectedItems;if(this.clearSelectorLayer(e),o.wrapper){o.wrapper.measure(n);var r=this.pdfViewer.viewerBase.getZoomFactor(),a=(o.wrapper.arrange(o.wrapper.desiredSize),o.width=o.wrapper.actualSize.width,o.height=o.wrapper.actualSize.height,o.offsetX=o.wrapper.offsetX,o.offsetY=o.wrapper.offsetY,1===o.annotations.length&&(o.rotateAngle=o.annotations[0].rotateAngle,o.wrapper.rotateAngle=o.annotations[0].rotateAngle),void 0);if(o.formFields.length)for(var s=0;s<o.formFields.length;s++){var l=o.formFields[parseInt(s.toString(),10)];(a=this.getSelectorElement(this.pdfViewer.element.id,e))&&l.pageIndex===e&&this.pdfViewer.designerMode&&this.renderResizeHandle(l.wrapper.children[0],a,o.thumbsConstraints,r,void 0,void 0,void 0,!1,!0,null,null,t),this.pdfViewer.formDesignerModule&&l.formFieldAnnotationType&&(this.pdfViewer.viewerBase.isFormFieldSelect||this.pdfViewer.viewerBase.isFormFieldMouseDown||this.pdfViewer.viewerBase.isFormFieldMouseMove||(this.pdfViewer.viewerBase.isFormFieldSelect=!0,p={name:l.name,id:l.id,value:l.value,fontFamily:l.fontFamily,fontSize:l.fontSize,fontStyle:l.fontStyle,color:l.color,backgroundColor:l.backgroundColor,alignment:l.alignment,isReadonly:l.isReadonly,visibility:l.visibility,maxLength:l.maxLength,isRequired:l.isRequired,isPrint:l.isPrint,rotation:l.rotateAngle,tooltip:l.tooltip,options:l.options,isChecked:l.isChecked,isSelected:l.isSelected,bounds:l.bounds},this.pdfViewer.formDesignerModule.isFormFieldSizeUpdated||this.pdfViewer.fireFormFieldSelectEvent("formFieldSelect",p,l.pageIndex,this.pdfViewer.formDesignerModule.isProgrammaticSelection),this.pdfViewer.formDesignerModule.isFormFieldSizeUpdated=!1))}if(o.annotations.length)for(var d=0;d<o.annotations.length;d++){var A,p,l=o.annotations[parseInt(d.toString(),10)];(a=this.getSelectorElement(this.pdfViewer.element.id,e))&&l.pageIndex===e&&("Distance"===l.shapeAnnotationType||"Line"===l.shapeAnnotationType||"LineWidthArrowHead"===l.shapeAnnotationType||"Polygon"===l.shapeAnnotationType?this.renderEndPointHandle(l,a,o.thumbsConstraints,{scale:r,tx:0,ty:0},void 0,void 0,!0,t):"StickyNotes"===l.shapeAnnotationType?this.renderResizeHandle(l.wrapper.children[0],a,o.thumbsConstraints,r,void 0,void 0,void 0,!1,!0,null,null,t):"Stamp"!==this.pdfViewer.tool&&(A="Path"===l.shapeAnnotationType||"SignatureField"===l.formFieldAnnotationType||"InitialField"===l.formFieldAnnotationType,this.renderResizeHandle(l.wrapper.children[0],a,o.thumbsConstraints,r,void 0,void 0,void 0,"Stamp"===l.shapeAnnotationType,!1,A,"FreeText"===l.shapeAnnotationType||"HandWrittenSignature"===l.shapeAnnotationType||"SignatureImage"===l.shapeAnnotationType||"Image"===l.shapeAnnotationType||"SignatureText"===l.shapeAnnotationType,t)),this.pdfViewer.viewerBase.isNewSignatureAdded||"HandWrittenSignature"!==l.shapeAnnotationType&&"SignatureText"!==l.shapeAnnotationType&&"SignatureImage"!==l.shapeAnnotationType||this.pdfViewer.annotationModule.selectSignature(l.signatureName,l.pageIndex,l),this.pdfViewer.formDesignerModule&&l.formFieldAnnotationType&&(this.pdfViewer.viewerBase.isFormFieldSelect||this.pdfViewer.viewerBase.isFormFieldMouseDown||this.pdfViewer.viewerBase.isFormFieldMouseMove||(this.pdfViewer.viewerBase.isFormFieldSelect=!0,p={value:l.value,fontFamily:l.fontFamily,fontSize:l.fontSize,fontStyle:l.fontStyle,color:l.color,backgroundColor:l.backgroundColor,alignment:l.alignment,isReadonly:l.isReadonly,visibility:l.visibility,maxLength:l.maxLength,isRequired:l.isRequired,isPrint:l.isPrint,rotation:l.rotateAngle,tooltip:l.tooltip,options:l.options,isChecked:l.isChecked,isSelected:l.isSelected,bounds:l.bounds},this.pdfViewer.formDesignerModule.isFormFieldSizeUpdated||this.pdfViewer.fireFormFieldSelectEvent("formFieldSelect",p,l.pageIndex,this.pdfViewer.formDesignerModule.isProgrammaticSelection),this.pdfViewer.formDesignerModule.isFormFieldSizeUpdated=!1)),""===l.annotName&&"ink"!==l.signatureName||"SignatureText"===l.annotName||!i||l!==i||l.formFieldAnnotationType||this.pdfViewer.viewerBase.isAddComment||this.pdfViewer.viewerBase.isAnnotationSelect||this.pdfViewer.viewerBase.isAnnotationMouseDown||this.pdfViewer.viewerBase.isAnnotationMouseMove||this.pdfViewer.viewerBase.isInkAdded||this.pdfViewer.viewerBase.isNewStamp||(this.pdfViewer.viewerBase.isAnnotationSelect=!0,this.pdfViewer.annotationModule.annotationSelect(l.annotName,l.pageIndex,l)))}}}},n.prototype.rotate=function(e,t,i,n){var o;e&&(i=i||{x:e.wrapper.offsetX,y:e.wrapper.offsetY},e instanceof se?(e.rotateAngle+=t,e.wrapper.rotateAngle+=t,o=(o=[]).concat(e.annotations),this.rotateObjects(e,o,t,i,null,n)):this.rotateObjects(e,[e],t,i))},n.prototype.rotateObjects=function(e,t,i,n,o,r){n=n||{};var a=J.identityMatrix();J.rotateMatrix(a,i,n.x,n.y);for(var s=0,l=t;s<l.length;s++){var d,A=l[s];A instanceof ee&&(!1===o&&e===A||(A.rotateAngle+=i,A.rotateAngle=(A.rotateAngle+360)%360,d=J.transformPointByMatrix(a,{x:A.wrapper.offsetX,y:A.wrapper.offsetY}),A.wrapper.offsetX=d.x,A.wrapper.offsetY=d.y,this.nodePropertyChange(A,{rotateAngle:A.rotateAngle})),this.renderSelector(A.pageIndex,r))}},n.prototype.getParentSvg=function(e,t,i){return e&&e.id&&t&&"selector"===t?this.pdfViewer.adornerSvgLayer:i},n.prototype.shownBorder=function(){var e,t,i=!1;return this.pdfViewer.annotationModule&&(t=this.pdfViewer.selectedItems.annotations[0],e=this.pdfViewer.annotationModule.updateAnnotationAllowedInteractions(t),t=this.pdfViewer.annotationModule.checkIsLockSettings(t),i=!G.isNullOrUndefined(e)&&(e.includes("Select")||!t)),i},n.prototype.renderBorder=function(e,t,i,n,o,r,a,s){var l,d,A,p,h=he(e,n);n=n||{scale:1,tx:0,ty:0},s?(h.x*=n.scale,h.y*=n.scale,h.width*=n.scale,h.height*=n.scale,l=0<this.pdfViewer.selectedItems.annotations.length?this.pdfViewer.selectedItems.annotations[0].shapeAnnotationType:this.pdfViewer.selectedItems.formFields[0].formFieldAnnotationType,i&&"object"!=typeof i&&""!==i?(A=""===(d=JSON.parse(i)).selectionBorderColor?"black":d.selectionBorderColor,h.stroke=A,h.strokeWidth=1===i.selectionBorderThickness?1:d.selectionBorderThickness,2<(p=0===d.selectorLineDashArray.length?[6,3]:d.selectorLineDashArray).length&&(p=[p[0],p[1]]),h.dashArray=p.toString()):i&&""!==i?(A=""===i.selectionBorderColor?"black":i.selectionBorderColor,h.stroke=A,h.strokeWidth=1===i.selectionBorderThickness?1:i.selectionBorderThickness,p=G.isNullOrUndefined(i.selectorLineDashArray)||0!==i.selectorLineDashArray.length?i.selectorLineDashArray:[6,3],!G.isNullOrUndefined(p)&&2<p.length&&(p=[p[0],p[1]]),G.isNullOrUndefined(p)||(h.dashArray=p.toString())):this.getBorderSelector(l,h)):(h.x*=n.scale,h.y*=n.scale,h.width*=n.scale,h.height*=n.scale,h.fill="transparent",l=this.pdfViewer.selectedItems.annotations[0].shapeAnnotationType,i&&"object"!=typeof i&&""!==i?(A=""===(d=JSON.parse(i)).selectionBorderColor?"black":d.selectionBorderColor,h.stroke=A,h.strokeWidth=1===i.selectionBorderThickness?1:d.selectionBorderThickness,2<(p=0===d.selectorLineDashArray.length?[6,3]:d.selectorLineDashArray).length&&(p=[p[0],p[1]]),h.dashArray=p.toString()):i&&""!==i?(A=""===i.selectionBorderColor?"black":i.selectionBorderColor,h.stroke=A,h.strokeWidth=1===i.selectionBorderThickness?1:i.selectionBorderThickness,p=G.isNullOrUndefined(i.selectorLineDashArray)||0!==i.selectorLineDashArray.length?i.selectorLineDashArray:[6,3],!G.isNullOrUndefined(p)&&2<p.lengt