@syncfusion/ej2-pdfviewer
Version:
Essential JS 2 PDF viewer Component
10 lines • 3.69 MB
JavaScript
/*!
* filename: ej2-pdfviewer.umd.min.js
* version : 33.1.49
* Copyright Syncfusion Inc. 2001 - 2025. 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"),require("@syncfusion/ej2-pdf-data-extract")):"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","@syncfusion/ej2-pdf-data-extract"],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,e.ej2PdfDataExtract)}(this,function(N,G,j,w,T,Q,F,C,k,J,P,L,O,U,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,a=arguments.length,r=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;0<=s;s--)(o=e[s])&&(r=(a<3?o(r):3<a?o(t,i,r):o(t,i))||r);return 3<a&&r&&Object.defineProperty(t,i,r),r},W=(Y=G.ChildProperty,K(_,Y),e([G.Property(0)],_.prototype,"x",void 0),e([G.Property(0)],_.prototype,"y",void 0),e([G.Property(0)],_.prototype,"width",void 0),e([G.Property(0)],_.prototype,"height",void 0),e([G.Property(0)],_.prototype,"left",void 0),e([G.Property(0)],_.prototype,"top",void 0),e([G.Property(0)],_.prototype,"right",void 0),e([G.Property(0)],_.prototype,"bottom",void 0),e([G.Complex({x:0,y:0},j.Point)],_.prototype,"location",void 0),e([G.Complex(new j.Size(0,0),j.Size)],_.prototype,"size",void 0),_);function _(){return null!==Y&&Y.apply(this,arguments)||this}Z=G.ChildProperty,K(q,Z),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 Z,X=q;function q(){return null!==Z&&Z.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,"overlayText",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(!1)],t.prototype,"isRepeat",void 0),e([G.Property(!1)],t.prototype,"useOverlayText",void 0),e([G.Property(1)],t.prototype,"markerOpacity",void 0),e([G.Property("rgba(255, 0, 0, 1)")],t.prototype,"markerBorderColor",void 0),e([G.Property("rgba(0, 0, 0, 1)")],t.prototype,"originalFillColor",void 0),e([G.Property("rgba(255, 255, 255, 1)")],t.prototype,"markerFillColor",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},X)],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,"isSignatureText",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},X)],i.prototype,"font",void 0),e([G.Property()],i.prototype,"selectedIndex",void 0),e([G.Property(null)],i.prototype,"customData",void 0),e([G.Property(!1)],i.prototype,"isUnisonSelected",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}ae=function(e,t){return(ae=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 ae,re,K=function(e,t){function i(){this.constructor=e}ae(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},e=function(e,t,i,n){var o,a=arguments.length,r=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;0<=s;s--)(o=e[s])&&(r=(a<3?o(r):3<a?o(t,i,r):o(t,i))||r);return 3<a&&r&&Object.defineProperty(t,i,r),r},se=(re=G.ChildProperty,K(le,re),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!==re&&re.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,n;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,n="Perimeter"!==e.measureType||!(!t.id||!t.id.toLowerCase().includes("srcdec")&&!t.id.toLowerCase().includes("tardec")),t.style.fill=i&&n?i:"transparent","Redaction"===e.shapeAnnotationType&&(i=he(e.markerFillColor,e.markerOpacity),t.style.fill=i),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 he(e,o){return e.replace(/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*[\d.]+\s*\)/,function(e,t,i,n){return"rgba("+t+","+i+","+n+","+o+")"})}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 ce(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 ge(e){return e=void 0!==e&&"string"==typeof e?G.getValue(e,window):e}function R(e,t,i){var n={};if(e){i=e.propName;for(var o=e.properties||e,a=[],r=[],s=((a=a.concat(Object.keys(o))).push("version"),i&&(r=(o=ge(t))?o(i):[],a=a.concat(r)),fe(i)),l=0,d=a=a.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]=ue((-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]=R((-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 ue(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(R(e[parseInt(o.toString(),10)],t)):n.push(e[parseInt(o.toString(),10)]);return n}function fe(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 me(e,t){var i;if("Distance"===e.shapeAnnotationType)for(var n=0,o=void 0,a=0;a<e.wrapper.children.length;a++){var r=j.Point.findAngle(e.sourcePoint,e.targetPoint);if(-1<e.wrapper.children[parseInt(a.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,r,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 we(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 Ce(e,t){for(var i,n="",o=[],a=0;a<t.length;)o.push({x:t[parseInt(a.toString(),10)].x,y:t[parseInt(a.toString(),10)].y}),a++;for(var o=Ee(e,o),r=0;r<o.length;r++)i=o[parseInt(r.toString(),10)],0===r&&(n="M"+i.x+" "+i.y),0<r&&(n+=" L"+i.x+" "+i.y);return n}function Be(e,t,i){new j.Rect;var n=Ce(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 ye(e,t){var i=we(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=Le(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&&"Butt"!==e.taregetDecoraterShapes||(t.width=o.width-10,t.height=o.height+10)}function Ie(e,t,i,n){var o=new j.PathElement;return Se(e,o,t,i,n),o}function Ee(e,t){return t[0]=be(e,t,!0),t[t.length-1]=be(e,t,!1),t}function be(e,t,i){var n={x:0,y:0},o=t.length,a=i?t[0]:t[o-1],t=i?t[1]:t[o-2];return"Butt"===(i?e.sourceDecoraterShapes:e.taregetDecoraterShapes)?a:(o=0===(o=j.Point.distancePoints(a,t))?1:o,i=e.thickness,n.x=Math.round(a.x+i*(t.x-a.x)/o),n.y=Math.round(a.y+i*(t.y-a.y)/o),j.Point.adjustPoint(n,t,!0,.5))}function xe(e,t,i,n){var o=[],a=j.Point.findAngle(t[0],t[1]),r=Fe(e,a);return!n.enableImportAnnotationMeasurement&&e.notes&&""!==e.notes?r.content=e.notes:r.content=i.setConversion(pe([t[0],t[1]])*i.pixelToPointFactor,e),r.rotateValue={y:-10,angle:a},!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),o.push(r),o}function Ve(e,t,i){for(var n,o=0;o<e.wrapper.children.length;o++){var a=e.wrapper.children[parseInt(o.toString(),10)];a&&!G.isNullOrUndefined(a.content)&&(n=i.setConversion(pe([t[0],t[1]])*i.pixelToPointFactor,e),a.content=n,a.childNodes[0].text=a.content,a.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 Me(e,t,i,n){var o=[],t=j.Point.findAngle(t[0],t[1]),a=Fe(e,t);return!n.enableImportAnnotationMeasurement&&e.notes&&""!==e.notes?a.content=e.notes:a.content=i.calculatePerimeter(e),!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),a.rotateValue={y:-10,angle:t},o.push(a),o}function De(e,t,i){for(var n,o=0;o<e.wrapper.children.length;o++){var a=e.wrapper.children[parseInt(o.toString(),10)];a&&!G.isNullOrUndefined(a.content)&&(n=i.calculatePerimeter(e),a.content=n,a.childNodes[0].text=a.content,a.refreshTextElement())}return n}function Te(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 Qe(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 ke(e,t){var i=[],n=Pe(e,t[0],t[1]);return i.push(n),n=Pe(e,t[1],t[0],!0),i.push(n),i}function Pe(e,t,i,n){var o=new j.PathElement,a=(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},r=j.identityMatrix();j.rotateMatrix(r,0-a,i.x,i.y);var s={x:(i=j.transformPointByMatrix(r,t)).x,y:i.y-e.leaderHeight},r=j.identityMatrix(),i=(j.rotateMatrix(r,a,o.offsetX,o.offsetY),j.transformPointByMatrix(r,s)),r={x:t.x,y:t.y},s=(o.offsetX=r.x,o.offsetY=r.y,o.transform=j.RotateTransform.Self,"M"+t.x+","+t.y+",L"+i.x+","+i.y+"Z"),r=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=a,o.data=s,o.canMeasurePath=!0,o.width=r.width,o.height=r.height,o}function Ne(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)],a=i[n+1],r=j.Rect.toBounds([o,a]);if(r.Inflate(10),r.containsPoint(t)){var r=Re(t,o,a),s={x1:o.x,x2:a.x,y1:o.y,y2:a.y},l={x1:t.x,x2:r.x,y1:t.y,y2:r.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(a))return!0}if(j.Point.equals(t,r))return!0}}return!1}function Re(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 Le(e){return ze[""+e]}var Oe,Ue,ze={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=(Oe=function(e,t){return(Oe=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}Oe(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),He=(Ue=j.DrawingElement,K(Ye,Ue),Ye.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)}},Ye.prototype.getNodeTemplate=function(){return this.templateFn},Ye);function Ye(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 a=0;a<n.objects.length;a++)if(t.id===n.objects[parseInt(a.toString(),10)].id){n.objects.splice(parseInt(a.toString(),10),1),n.objects.splice(parseInt(a.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.children[1]instanceof j.TextElement&&(e.wrapper.children[1].isEJ2=!0,"FreeText"===e.shapeAnnotationType)&&(e.wrapper.children[1].isFreeText=!0),e.wrapper.measure(new j.Size(void 0,void 0)),e.wrapper.arrange(e.wrapper.desiredSize)):this.initNode(e),e.wrapper,"Stamp"!==(this.pdfViewer.nameTable[e.id]=e).shapeAnnotationType||"Existing Annotation"!==e.annotationAddMode&&"Imported Annotation"!==e.annotationAddMode||"diagram_helper"===e.id||this.isPasted||G.isNullOrUndefined(this.pdfViewer.annotationModule)||this.pdfViewer.annotationModule.isUndoRedoAction||this.nodePropertyChange(e,{bounds:{width:e.bounds.width,height:e.bounds.height}}),e},n.prototype.initNode=function(e){!G.isNullOrUndefined(this.pdfViewer.annotationModule)&&this.pdfViewer.annotationModule.isUndoRedoAction&&"Stamp"===e.shapeAnnotationType&&(t=e.id,t=this.pdfViewer.nameTable[""+t].wrapper.children,this.stampPreviousSize=JSON.parse(JSON.stringify(t)),this.stampPreviousWidth=G.isNullOrUndefined(e.wrapper.actualSize)||G.isNullOrUndefined(e.wrapper.actualSize.width)?null:e.wrapper.actualSize.width,this.stampPerviousHeight=G.isNullOrUndefined(e.wrapper.actualSize)||G.isNullOrUndefined(e.wrapper.actualSize.height)?null:e.wrapper.actualSize.height),this.isPasted&&"Stamp"===e.shapeAnnotationType&&(this.stampOriginalWidth=G.isNullOrUndefined(e.wrapper.actualSize)||G.isNullOrUndefined(e.wrapper.actualSize.width)?null:e.wrapper.actualSize.width,this.stampOriginalHeight=G.isNullOrUndefined(e.wrapper.actualSize)||G.isNullOrUndefined(e.wrapper.actualSize.height)?null:e.wrapper.actualSize.height);var t=this.initContainer(e);t.children||(t.children=[]),this.init(e,t),t.rotateAngle=e.rotateAngle,e.wrapper.children[1]instanceof j.TextElement&&(e.wrapper.children[1].isEJ2=!0,"FreeText"===e.shapeAnnotationType)&&(e.wrapper.children[1].isFreeText=!0),!G.isNullOrUndefined(e)&&"Stamp"===e.shapeAnnotationType&&!G.isNullOrUndefined(e.wrapper.children[2])&&e.wrapper.children[2]&&e.wrapper.children[2]instanceof j.TextElement&&(e.wrapper.children[2].isEJ2=!0),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),e.wrapper instanceof j.DrawingElement&&"Stamp"===e.shapeAnnotationType&&(e.bounds.width=e.wrapper.bounds.width,e.bounds.height=e.wrapper.bounds.height,e.bounds.x=e.wrapper.bounds.x,e.bounds.y=e.wrapper.bounds.y)},n.prototype.init=function(e,t){var i=new j.DrawingElement,n=this.pdfViewer.annotationModule?this.pdfViewer.annotationModule.findAnnotationSettings(e):{},o=0,a=0,r=0,s=0,n=((n.minWidth||n.maxWidth||n.minHeight||n.maxHeight)&&(o=n.maxHeight||2e3,a=n.maxWidth||2e3,r=n.minHeight||0,s=n.minWidth||0),!1);return(r||s||o||a)&&(n=!0),(i=e.formFieldAnnotationType?this.initFormFields(e,i,t):this.initAnnotationObject(e,void 0,i,t,!1,void 0,n,o,a,s,r)).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>a)&&(i.width<s&&(i.width=s),i.width>a)&&(i.width=a),i.horizontalAlignment="Stretch",void 0!==e.bounds.height&&(i.height=e.bounds.height,n)&&(i.height<r||i.width>o)&&(i.height<r&&(i.height=r),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 He).id=e.id+"_content",i.children.push(t)}return t},n.prototype.initAnnotationObject=function(e,t,i,n,o,a,r,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&&((u=this.textElement(e)).content=e.labelContent,u.style.color=e.fontColor,u.style.strokeColor=e.labelBorderColor,u.style.fill=e.labelFillColor,u.style.fontSize=e.fontSize,u.style.fontFamily=e.fontFamily,u.style.opacity=e.labelOpacity,n.children.push(u));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=Qe(e.vertexPoints),i=t,n.children.push(i);break;case"Stamp":this.isDynamicStamps=o=!0;var h,p,c=void 0;this.isPasted&&(C=this.pdfViewer.clipboardData.clipObject[0].id,c=this.pdfViewer.nameTable[""+C]),e.isDynamicStamp?(n.horizontalAlignment="Left",(i=a=new j.DrawingElement).cornerRadius=10,i.style.fill=e.stampFillColor,i.style.strokeColor=e.stampStrokeColor,n.children.push(i),(f=new j.TextElement).style.fontFamily="Helvetica",f.style.fontSize=14,f.style.italic=!0,f.style.bold=!0,f.style.color=e.fillColor,f.rotateValue=void 0,f.content=e.dynamicText,f.style.textAlign="Left",f.relativeMode="Point",f.margin.left=5,f.margin.bottom=3,f.setOffsetWithRespectToBounds(0,.75,null),r&&(y=.02*(B=e.bounds.width),g=Math.max(0,B-2*y),f.style.fontSize=this.fontSizeCalculation(e,f,g,f.content)),"Existing Annotation"!==e.annotationAddMode&&"Imported Annotation"!==e.annotationAddMode||(B=e.bounds.width,S=e.bounds.height,y=.02*B,g=Math.max(0,B-2*y),f.style.fontSize=this.fontSizeCalculation(e,f,g,f.content),C=(.25*S-(m=this.measureTextMetrics(e,f.content,f.style.fontSize,f.style.fontFamily)).height)/8,f.margin.bottom=Math.max(0,C),f.margin.bottom<1&&(f.margin.bottom=5),f.margin.left=(B-m.width)/2),this.isPasted&&(f.style.fontSize=c.wrapper.children[1].style.fontSize,f.margin.left=c.wrapper.children[1].margin.left),!G.isNullOrUndefined(this.pdfViewer.annotationModule)&&this.pdfViewer.annotationModule.isUndoRedoAction&&(f.style.fontSize=this.stampPreviousSize[1].style.fontSize),"diagram_helper"!==e.id&&n.children.push(f),(h=new j.TextElement).style.fontFamily="Helvetica",h.style.fontSize=e.fontSize,h.style.italic=!0,h.style.bold=!0,h.style.color=e.fillColor,h.rotateValue=void 0,h.content=e.icon.toUpperCase(),h.style.textAlign="Left",h.relativeMode="Point",h.margin.left=5,h.margin.top=4,h.setOffsetWithRespectToBounds(0,.1,null),r&&(p=B=e.bounds.width,"REVISED"===h.content||"REVIEWED"===h.content||"RECEIVED"===h.content||"APPROVED"===h.content?p/=2:"CONFIDENTIAL"!==h.content&&"NOT APPROVED"!==h.content||(p*=.75),y=.02*p,g=Math.max(0,p-2*y),h.style.fontSize=this.fontSizeCalculation(e,h,g,h.content)),"Existing Annotation"!==e.annotationAddMode&&"Imported Annotation"!==e.annotationAddMode||(B=e.bounds.width,S=e.bounds.height,p=B,"REVISED"===h.content||"REVIEWED"===h.content||"RECEIVED"===h.content||"APPROVED"===h.content?p/=2:"CONFIDENTIAL"!==h.content&&"NOT APPROVED"!==h.content||(p*=.75),y=.02*p,g=Math.max(0,p-2*y),h.style.fontSize=this.fontSizeCalculation(e,h,g,h.content),C=(.75*S-(m=this.measureTextMetrics(e,h.content,h.style.fontSize,h.style.fontFamily)).height)/10,h.margin.top=Math.max(0,C),"CONFIDENTIAL"===h.content||"NOT APPROVED"===h.content?h.margin.left=(B-m.width*(4/3))/2:h.margin.left=(B-2*m.width)/2),this.isPasted?(h.style.fontSize=c.wrapper.children[2].style.fontSize,h.margin.left=c.wrapper.children[2].margin.left,h.margin.top=c.wrapper.children[2].margin.top,i.width=this.stampOriginalWidth,i.height=this.stampOriginalHeight):!G.isNullOrUndefined(this.pdfViewer.annotationModule)&&this.pdfViewer.annotationModule.isUndoRedoAction?(h.style.fontSize=this.stampPreviousSize[2].style.fontSize,i.width=this.stampPreviousWidth,i.height=this.stampPerviousHeight):(i.width=e.bounds.width,i.height=e.bounds.height),i.style.opacity=e.opacity,h.id=j.randomId()+"_stamp","diagram_helper"!==e.id&&n.children.push(h)):(n.horizontalAlignment="Left",(i=a=new j.DrawingElement).cornerRadius=10,i.style.fill=e.stampFillColor,i.style.strokeColor=e.stampStrokeColor,n.children.push(i),"Accepted"===e.icon||"Rejected"===e.icon?(i.style.fill="transparent",i.style.strokeColor="transparent",(p=new j.PathElement).id=j.randomId()+"_stamp",p.data=e.data,p.width=e.bounds.width,r&&e.bounds.width>l&&(p.width=l,e.bounds.width=l),p.height=e.bounds.height,r&&e.bounds.height>s&&(p.height=s,e.bounds.height=s),(y=p).style.fill=e.fillColor,p.style.strokeColor=e.strokeColor,p.style.opacity=e.opacity,i.width=e.bounds.width,i.height=e.bounds.height,i.style.opacity=e.opacity,n.children.push(y)):((h=new j.TextElement).style.fontFamily="Helvetica",h.style.fontSize=e.fontSize,h.style.italic=!0,h.style.bold=!0,h.style.color=e.fillColor,h.rotateValue=void 0,h.style.textAlign="Left",h.content=e.icon.toUpperCase(),h.relativeMode="Point",h.setOffsetWithRespectToBounds(0,.1,null),r&&(w=.05*(B=e.bounds.width),g=Math.max(0,B-2*w),h.style.fontSize=this.fontSizeCalculation(e,h,g,h.content)),m=this.measureTextMetrics(e,h.content,h.style.fontSize,h.style.fontFamily),h.margin.top=5,h.margin.left=(e.bounds.width-m.width)/2,"Existing Annotation"!==e.annotationAddMode&&"Imported Annotation"!==e.annotationAddMode||(B=e.bounds.width,S=e.bounds.height,w=.05*B,C=Math.max(0,B-2*w),h.style.fontSize=this.fontSizeCalculation(e,h,C,h.content),y=(B-(p=this.measureTextMetrics(e,h.content,h.style.fontSize,h.style.fontFamily)).width)/2,h.margin.left=Math.max(0,y),h.margin.top=(S-p.height)/2),this.isPasted?(h.style.fontSize=c.wrapper.children[1].style.fontSize,h.margin.left=c.wrapper.children[1].margin.left,h.margin.top=c.wrapper.children[1].margin.top,h.margin.bottom=c.wrapper.children[1].margin.bottom,i.width=this.stampOriginalWidth,i.height=this.stampOriginalHeight):!G.isNullOrUndefined(this.pdfViewer.annotationModule)&&this.pdfViewer.annotationModule.isUndoRedoAction?(h.style.fontSize=this.stampPreviousSize[1].style.fontSize,h.margin.top=this.stampPreviousSize[1].margin.top-.5*this.stampPreviousSize[1].margin.top,h.margin.left=this.stampPreviousSize[1].margin.left,i.width=this.stampPreviousWidth,i.height=this.stampPerviousHeight):(i.width=e.bounds.width,i.height=e.bounds.height),i.style.opacity=e.opacity,h.id=j.randomId()+"_stamp","diagram_helper"!==e.id&&n.children.push(h)));break;case"Image":case"SignatureImage":var g=new j.ImageElement;g.source=e.data,(i=g).style.strokeWidth=0,n.children.push(i);break;case"Rectangle":case"Redaction":var u;i=a=new j.DrawingElement,n.children.push(i),e.enableShapeLabel&&((u=this.textElement(e)).content=e.labelContent,u.style.color=e.fontColor,u.style.strokeColor=e.labelBorderColor,u.style.fill=e.labelFillColor,u.style.fontSize=e.fontSize,u.style.fontFamily=e.fontFamily,u.style.opacity=e.labelOpacity,n.children.push(u));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),(a=new j.DrawingElement).id="perimeter_"+j.randomId(),a.height=.2,a.width=.2,a.transform=j.RotateTransform.Self,a.horizontalAlignment="Stretch",this.setNodePosition(a,e),a.rotateAngle=e.rotateAngle,Ae(e,a),n.children.push(a);var f=this.textElement(e);(f=new j.TextElement).content=f.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(),f.rotateValue={y:-10,angle:e.rotateAngle},n.children.push(f);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),(a=new j.DrawingElement).id="radius_"+j.randomId(),a.height=.2,a.width=e.bounds.width/2,a.transform=j.RotateTransform.Self,this.setNodePosition(a,e),a.rotateAngle=e.rotateAngle,Ae(e,a),n.children.push(a);var m=this.textElement(e);e.enableShapeLabel&&(m.style.color=e.fontColor,m.style.strokeColor=e.labelBorderColor,m.style.fill=e.labelFillColor,m.style.fontSize=e.fontSize,m.style.fontFamily=e.fontFamily,m.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?m.content=e.notes:m.content=this.pdfViewer.annotation.measureAnnotationModule.setConversion(e.bounds.width/2*this.pdfViewer.annotation.measureAnnotationModule.pixelToPointFactor,e),m.rotateValue={y:-10,x:e.bounds.width/4,angle:e.rotateAngle},n.children.push(m);break;case"StickyNotes":var w=new j.ImageElement;w.source=e.data,w.width=e.bounds.width,w.height=e.bounds.height,w.style.strokeColor=e.strokeColor,w.style.strokeWidth=0,n.children.push(i=w);break;case"SignatureText":var C=new j.DrawingElement,B=(C.style.strokeWidth=0,(i=C).style.strokeWidth=0,n.style.strokeWidth=0,n.children.push(i),this.textElement(e));B.style.fontFamily=e.fontFamily,B.style.fontSize=e.fontSize,B.style.textAlign="Left",B.rotateValue=void 0,B.content=e.data,B.style.strokeWidth=0,n.children.push(B);break;case"FreeText":var y=new j.DrawingElement,S=(n.children.push(i=y),this.textElement(e));(S=new j.TextElement).style.fontFamily=e.fontFamily,S.style.fontSize=e.fontSize,S.style.textAlign="Left","center"===e.textAlign.toLowerCase()?S.style.textAlign="Center":"right"===e.textAlign.toLowerCase()?S.style.textAlign="Right":"justify"===e.textAlign.toLowerCase()&&(S.style.textAlign="Justify"),S.style.color=e.fontColor,S.style.bold=e.font.isBold,S.style.italic=e.font.isItalic,void 0!==e.font.isUnderline&&(!0===e.font.isUnderline?e.font.isStrikeout?S.style.textDecoration="Underline LineThrough":S.style.textDecoration="Underline":e.font.isStrikeout&&("Underline LineThrough"===S.style.textDecoration?S.style.textDecoration="LineThrough":S.style.textDecoration="None")),void 0!==e.font.isStrikeout&&(!0===e.font.isStrikeout?e.font.isUnderline?S.style.textDecoration="Underline LineThrough":S.style.textDecoration="LineThrough":e.font.isUnderline||("Underline LineThrough"===S.style.textDecoration?S.style.textDecoration="Underline":S.style.textDecoration="None")),S.rotateValue=void 0,S.content=e.dynamicText,S.style.opacity=e.opacity,S.style.strokeWidth=e.thickness,e.isSignatureText?(S.margin.left=4,S.margin.right=5,S.margin.top=e.fontSize/16*5):(S.margin.left=0,S.margin.right=0,S.margin.top=0),this.isPasted=!1,this.pdfViewer.freeTextSettings.enableAutoFit?S.style.textWrapping="Wrap":S.style.textWrapping="WrapWithOverflow",S.relativeMode="Point",S.setOffsetWithRespectToBounds(0,0,null),S.relativeMode="Point",n.children.push(S)}return i.id=e.id+"_content",i.relativeMode="Object",o||(void 0!==e.bounds.width&&(i.width=e.bounds.width,r)&&(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,r)&&(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=((a=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 a=ye(e,a),r=we(e),s=[],l=[],d=("Distance"===e.shapeAnnotationType&&(s=ke(e,r),l=xe(e,r,this.pdfViewer.annotation.measureAnnotationModule,this.pdfViewer)),"Line"!==e.shapeAnnotationType&&"LineWidthArrowHead"!==e.shapeAnnotationType||"Perimeter"!==e.measureType||(l=Me(e,r,this.pdfViewer.annotation.measureAnnotationModule,this.pdfViewer)),!0===e.enableShapeLabel&&"Distance"!==e.shapeAnnotationType&&"Perimeter"!==e.measureType&&(d=j.Point.findAngle(r[0],r[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)),r=Ee(e,r),j.Rect.toBounds(r)),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=Ie(e,r[0],A[1],!0),n=Ie(e,r[r.length-1],A[A.length-2],!1)),i.id=e.id+"_srcDec",n.id=e.id+"_tarDec","Polygon"===e.shapeAnnotationType&&(a.data=Qe(e.vertexPoints)),a.style.fill="transparent",t.style.strokeColor="transparent",t.style.fill="transparent",t.style.strokeWidth=0,t.children=[],Ae(e,a),t.children.push(a),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 h=t.children[parseInt(o.toString(),10)];(h.id.includes("srcDec")||h.id.includes("tarDec"))&&("Butt"!==e.sourceDecoraterShapes&&"Butt"!==e.taregetDecoraterShapes&&(h.width=12*e.thickness),h.height=12*e.thickness)}return t.id=e.id,t.offsetX=a.offsetX,t.offsetY=a.offsetY,t.width=a.width,t.height=a.height,we(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 a=this.getPageObjects(e.pageIndex),r=0;r<a.length;r++)a[parseInt(r.toString(),10)].id===e.id&&(a.splice(r,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(a=this.getPageObjects(e.pageIndex),r=0;r<a.length;r++){if(a[parseInt(r.toString(),10)].id===e.id){a.splice(r,1);break}a[parseInt(r.toString(),10)]&&a[parseInt(r.toString(),10)].id&&-1!==a[parseInt(r.toString(),10)].id.indexOf(e.id)&&a.splice(r,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,customData:e.customData,lineBound:e.bounds,pageNumber:e.pageIndex,insertSpaces:e.insertSpaces,formFieldAnnotationType:e.formFieldAnnotationType,borderColor:e.borderColor,thickness:e.thickness,isTransparent:e.isTransparent};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(),a=e.width/o,r=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,a,r);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 h,p,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,h=d[parseInt(A.toString(),10)].id,h=this.pdfViewer.nameTable[""+h],(c&&this.shouldRefreshElement(h)||G.isNullOrUndefined(this.pdfViewer.formDesignerModule))&&(!G.isNullOrUndefined(h.properties.data)&&h.properties.data.includes("base64")?((p=new Image).src=h.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,p)):!G.isNullOrUndefined(h.properties.value)&&h.properties.value.includes("base64")&&((p=new Image).src=h.properties.value,null==window.signatureCollection&&void 0===window.signatureCollection&&(window.signatureCollection=new Map),window.signatureCollection)&&!window.signatureCollection.get(c.id)&&window.signatureCollection.set(c.id,p),c.children[1]instanceof j.TextElement&&(c.children[1].isEJ2=!0),"FreeText"!==h.shapeAnnotationType||h.isSignatureText||(c.children[0].isEJ2=!0,c.children[1].isEJ2=!0),"Stamp"===h.shapeAnnotationType&&(!G.isNullOrUndefined(c.children[0])&&c.children[0]instanceof j.DrawingElement&&(c.children[0].isEJ2=!0),!G.isNullOrUndefined(c.children[1])&&c.children[0]instanceof j.TextElement&&(c.children[1].isEJ2=!0),!G.isNullOrUndefined(c.children[2]))&&c.children[0]instanceof j.TextElement&&(c.children[2].isEJ2=!0),"FreeText"===h.shapeAnnotationType&&!h.isSignatureText||"Stamp"===h.shapeAnnotationType?j.refreshDiagramElements(e,[c],this.renderer,null,h.shapeAnnotationType):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.shape