@pageproof/sdk-pr 108.0.1537501172464 → 108.0.1537745921075
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return call&&(typeof call==="object"||typeof call==="function")?call:self}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass)}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass}var FinalDeliveryNotifications=function(_API){_inherits(FinalDeliveryNotifications,_API);function FinalDeliveryNotifications(){_classCallCheck(this,FinalDeliveryNotifications);return _possibleConstructorReturn(this,_API.apply(this,arguments))}FinalDeliveryNotifications.prototype.add=function add(proofId,type,users,
|
|
1
|
+
"use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return call&&(typeof call==="object"||typeof call==="function")?call:self}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass)}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass}var FinalDeliveryNotifications=function(_API){_inherits(FinalDeliveryNotifications,_API);function FinalDeliveryNotifications(){_classCallCheck(this,FinalDeliveryNotifications);return _possibleConstructorReturn(this,_API.apply(this,arguments))}FinalDeliveryNotifications.prototype.add=function add(proofId,type,users,fileIds,_ref){var message=_ref.message;return this.client.request("proofs.final-delivery.notification.add",{proofId:proofId,type:type,users:users,fileIds:fileIds,message:message})};FinalDeliveryNotifications.prototype.remove=function remove(notificationId){return this.client.request("proofs.final-delivery.notification.delete",{notificationId:notificationId})};FinalDeliveryNotifications.prototype.get=function get(notificationId){return this.client.request("proofs.final-delivery.get-notification",{notificationId:notificationId})};FinalDeliveryNotifications.prototype.send=function send(notificationId){return this.client.request("proofs.final-delivery.notification.send",{notificationId:notificationId})};return FinalDeliveryNotifications}(_API3.default);exports.default=FinalDeliveryNotifications;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";exports.__esModule=true;var FinalDeliveryNotificationType={Email:"email"};exports.default=FinalDeliveryNotificationType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;var _transform=require("./transform");var _transform2=_interopRequireDefault(_transform);var _File=require("./File");var _File2=_interopRequireDefault(_File);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}var finalDeliverySchema={id:"Id",name:"Name",files:(0,_transform.each)("
|
|
1
|
+
"use strict";exports.__esModule=true;var _transform=require("./transform");var _transform2=_interopRequireDefault(_transform);var _File=require("./File");var _File2=_interopRequireDefault(_File);var _FinalDeliveryNotification=require("./FinalDeliveryNotification");var _FinalDeliveryNotification2=_interopRequireDefault(_FinalDeliveryNotification);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}var finalDeliverySchema={id:"Id",name:"Name",files:(0,_transform.each)("Files",function(fileData){return(new _File2.default).fromFile(fileData)}),notifications:(0,_transform.each)("Notifications",function(notificationData){return(new _FinalDeliveryNotification2.default).fromFinalDeliveryNotification(notificationData)})};var FinalDelivery=function(){function FinalDelivery(){_classCallCheck(this,FinalDelivery)}FinalDelivery.prototype.fromProofFinalDelivery=function fromProofFinalDelivery(finalDeliveryData){(0,_transform2.default)(this,finalDeliverySchema,finalDeliveryData);console.debug("i m here transformed data: ",finalDeliveryData,this);return this};return FinalDelivery}();exports.default=FinalDelivery;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";exports.__esModule=true;var _transform=require("./transform");var _transform2=_interopRequireDefault(_transform);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}var finalDeliveryNotificationSchema={id:"NotificationId",notificationType:"Type",proofId:"ProoId",isSent:"Sent",users:"Users",files:"Files",message:"Message"};var FinalDeliveryNotification=function(){function FinalDeliveryNotification(){_classCallCheck(this,FinalDeliveryNotification)}FinalDeliveryNotification.prototype.fromFinalDeliveryNotification=function fromFinalDeliveryNotification(notificationData){(0,_transform2.default)(this,finalDeliveryNotificationSchema,notificationData);return this};return FinalDeliveryNotification}();exports.default=FinalDeliveryNotification;
|
package/lib/pageproof.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.PageProof=t():e.PageProof=t()}(this,function(){return function(e){function t(n){if(o[n])return o[n].exports;var r=o[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var o={};return t.m=e,t.c=o,t.d=function(e,o,n){t.o(e,o)||Object.defineProperty(e,o,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var o=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(o,"a",o),o},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=32)}([function(e,t,o){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var r=function e(t){n(this,e),this.client=t};t.default=r},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t,o){var n=[],r={};return Array.isArray(t)?(n=t,t.forEach(function(e){r[e]=e})):(0,y.default)(t)&&(n=Object.keys(t),r=t),n.forEach(function(t){var n=r[t],i=void 0;if("string"==typeof n)i=-1!==n.indexOf(".")?function(){for(var e=n.split("."),t=o,r=0;r<e.length;r++){var i=e[r];if(!(0,w.default)(t,i)){t=void 0;break}t=t[i]}return t}:function(){return o[n]};else{if("function"!=typeof n){if(null===n)return;throw new Error("Unknown transformer.")}i=n}var a=i.call(e,o);void 0!==a&&(e[t]=a)}),e}function i(e){return function(t){return Number(t[e])}}function a(e,t){return function(o){return t[o[e]]}}function s(e){return function(t){var o=t[e];if(o&&"0001-01-01T00:00:00"!==o)return"number"==typeof o?new Date(1e3*o):new Date(o+"Z")}}function u(e){return function(t){var o=String(t[e]);return"1"===o||"true"===o}}function f(e){return function(t){return w.default.call(t,e)}}function c(e,t){return function(o){return o[e]?o[e].map(t):[]}}function l(e,t){return function(o){return o[e]?JSON.parse(o[e]):Array.isArray(t)?[].concat(t):d({},t)}}function p(e){return function(t){return t[e]?t[e]:void 0}}t.__esModule=!0;var d=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e};t.number=i,t.enumeration=a,t.date=s,t.truthy=u,t.exists=f,t.each=c,t.json=l,t.optional=p;var h=o(16),y=n(h),m=o(10),w=n(m);t.default=r},function(e,t,o){"use strict";t.__esModule=!0;t.TOKEN_HEADER="x-authorization-token",t.HMAC_HEADER="x-authorization-hmac",t.TIMESTAMP_HEADER="x-timestamp",t.DEVICE_ID_HEADER="x-device-id",t.SUBSCRIPTION_KEY_HEADER="ocp-apim-subscription-key",t.SDK_VERSION_HEADER="x-pageproof-javascript-sdk",t.RETRY_AFTER_HEADER="retry-after",t.BYTES_PER_BLOCK=2097152,t.MENTION_REGEX=/@{(U[a-zA-Z0-9]{15}|~everyone)}{(.*?)}/g,t.ISO_REGEX=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/,t.DEFAULT_ISO_DATE="0001-01-01T00:00:00",t.DAY_IN_MS=864e5,t.COMMENT_CACHE_PREFIX="comment",t.THUMBNAIL_CACHE_PREFIX="thumbnail"},function(e,t,o){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var r=o(1),i=function(e){return e&&e.__esModule?e:{default:e}}(r),a={id:"UserId",name:"Name",email:"Email",hasActivated:"Activated",hasRegistered:"IsRegistered",hasAvatar:"HasAvatar",accountType:"AccountType",teamType:"TeamType",teamLogo:"Branding.LogoURL",registeredDate:(0,r.date)("Registered"),lastLoginDate:(0,r.date)("LastLogin"),lastUploadDate:(0,r.date)("LastUpload"),isAdmin:"IsDomainAdmin"},s=function(){function e(){n(this,e)}return e.prototype.fromJSON=function(e){return(0,i.default)(this,Object.keys(a),e),this},e.prototype.fromUser=function(e){return(0,i.default)(this,a,e),this},e}();t.default=s},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(){return this.dueDate&&this.dueDate.getTime()<Date.now()}t.__esModule=!0;var a=o(1),s=n(a),u=o(18),f=n(u),c=o(19),l=n(c),p=o(5),d=n(p),h=o(20),y={id:"ProofId",name:"Title",status:"Status",workflowId:"WorkflowId",version:"Version",dueDate:(0,a.date)("DueDate"),createdDate:(0,a.date)("CreatedDate"),approvedDate:(0,a.date)("ApprovedDate"),isLocked:"Locked",isArchived:"Closed",isOverdue:i,uploaderUserId:"UserId",ownerUserIds:"OwnerIds",editorUserId:"EditorId",editorUserIds:"EditorIds",lockerUserId:"ProofLockerId",messageToReviewers:"Description",messageToOwners:"OwnerMessage",messageToEditor:"EditorMessage",fileId:"FileId",fileExtension:"Extension",fileStatus:"FileStatus",fileMessage:"FileStatusMessage",pageCount:(0,a.number)("Pages"),commentCount:(0,a.number)("ParentComments"),canDownload:(0,a.truthy)("DownloadOriginal"),type:"Type",processStatus:"ProcessStatus",recipient:"Recipient",todoCommentCount:(0,a.number)("CountTodoComments"),doneCommentCount:(0,a.number)("CountDoneComments")},m=function(){function e(){r(this,e)}return e.prototype.getState=function(){var e=f.default.ACTIVE;return this.fileStatus===d.default.UPLOADING?e=f.default.UPLOADING:this.hasFileError()?e=f.default.FILE_ERROR:this.isProcessing()?e=f.default.PROCESSING:this.status===l.default.ARCHIVED?e=f.default.ARCHIVED:this.hasWorkflow()?this.status===l.default.TODOS_REQUESTED?e=f.default.TODOS_REQUESTED:this.status===l.default.AWAITING_NEW_VERSION?e=f.default.AWAITING_NEW_VERSION:this.status===l.default.APPROVED?e=f.default.APPROVED:this.hasWorkflowStarted()?this.isOverdue&&(e=f.default.OVERDUE):e=f.default.NOT_STARTED:e=f.default.PROOFERS_NEEDED,e},e.prototype.hasWorkflowStarted=function(){return this.hasWorkflow()&&this.status!==l.default.NEW},e.prototype.isProcessing=function(){return this.fileStatus===d.default.UPLOADING||this.fileStatus===d.default.QUEUED||this.fileStatus===d.default.RIPPING},e.prototype.getProcessingProgress=function(){switch(this.fileStatus){case d.default.UPLOADING:return.1;case d.default.QUEUED:return.2;case d.default.RIPPING:return.6;default:return-1}},e.prototype.hasWorkflow=function(){return(0,h.isWorkflowId)(this.workflowId)},e.prototype.hasFile=function(){return(0,h.isFileId)(this.fileId)},e.prototype.hasFileError=function(){return this.fileStatus===d.default.ERROR||!this.fileStatus||!this.hasFile()},e.prototype.hasEditor=function(){return(0,h.isUserId)(this.editorUserId)},e.prototype.hasThumbnail=function(){return this.fileStatus===d.default.OK},e.prototype.canUserUploadNewVersion=function(e){return this.getState()===f.default.AWAITING_NEW_VERSION&&(this.editorUserId===e||this.isOwner(e))},e.prototype.isOwner=function(e){return-1!==this.ownerUserIds.indexOf(e)},e.prototype.calculateState=function(){this.state=this.getState()},e.prototype.fromProof=function(e){return(0,s.default)(this,y,e),this.calculateState(),this},e}();t.default=m},function(e,t,o){"use strict";t.__esModule=!0;var n={OK:"OK",UPLOADING:"Uploading",QUEUED:"Queued",RIPPING:"Ripping",ERROR:"Error"};t.default=n},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=o(1),a=n(i),s=o(3),u=n(s),f={userId:"UserId",token:"Token",sharedKey:"SharedKey",privateKeyPEM$:"PrivateKey",privateKeyPEM:null,publicKeyPEM:"PublicKey",serverPublicKeyPEM:"PublicServerKey"},c=function(){function e(){r(this,e)}return e.prototype.fromJSON=function(e){return(0,a.default)(this,Object.keys(f),e),this.user=(new u.default).fromJSON(e.user),this},e.prototype.fromSession=function(e){return(0,a.default)(this,f,e),this.user=(new u.default).fromUser(e),this},e}();t.default=c},function(e,t,o){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var r=o(1),i=function(e){return e&&e.__esModule?e:{default:e}}(r),a={id:"FileId",name:"Name",blocks:"Chunks",downloadable:"Downloadable",assignedTo:"AssignedTo",assignedType:"AssignedType",status:"Status",message:"Message"},s={id:"Attachment",name:"AttachmentName",blocks:"AttachmentChunks",assignedTo:"CommentId",assignedType:function(){return"attachment"},status:"AttachmentStatus",message:function(){return""}},u=function(){function e(){n(this,e)}return e.prototype.fromFile=function(e){return(0,i.default)(this,a,e),this},e.prototype.fromCommentAttachment=function(e){return(0,i.default)(this,s,e),this},e}();t.default=u},function(e,t,o){"use strict";function n(){if("function"==typeof n.driver){return new(0,n.driver)}if("string"==typeof n.driver){var e=void 0;switch(n.driver){case"Blob":e=o(60).default;break;case"Buffer":e=o(61).default;break;case"String":e=o(62).default;break;default:throw new Error('Unknown Bluffer driver "'+n.driver+'".')}if(e)return new e;throw new Error('Bluffer driver "'+n.driver+'" not found.')}throw new Error('Bluffer.driver must be either "Blob", "Bluffer", or "String" or a custom constructor.')}t.__esModule=!0;var r=o(12)("bluffer");n.driver="String","undefined"!=typeof Blob?n.driver="Blob":(r("The current JavaScript environment does not support native Bluffer, falling back to using StringBluffer."),n.driver="String"),t.default=n},function(e,t,o){"use strict";t.__esModule=!0;var n={ERROR_CRITICAL:3,OK:200,ERROR_INVALID:201,ERROR_NO_ACCESS:100,ERROR_NO_ACCESS_WRITE:101,ERROR_RESTRICTED:102,ERROR_SQL_ERROR:105,ERROR_OUT_SYNC:106,ERROR_STORAGE_ERROR:110,ERROR_QUEUE_ERROR:111,ERROR_SQL_DEADLOCK_ERROR:121,ERROR_BAD_REQUEST:400,ERROR_UNAUTHORISED:401,ERROR_MEDIA_PERMISSION_NO_ACCESS:402,ERROR_NOT_FOUND:1e3,ERROR_CREATE:1001,ERROR_UPDATE:1002,ERROR_DELETE:1003,ERROR_EXISTS:1004,ERROR_USER_INVALID_LOGIN:1010,ERROR_USER_INVALID_PASSWORD:1011,ERROR_USER_IS_REGISTERED:1012,ERROR_USER_INVALID_EMAIL:1013,ERROR_USER_INVALID_LOGIN_COUNT:1014,ERROR_USER_DISABLED:1015,ERROR_BAD_REQUEST_DATE:201,ERROR_THROTTLED:429,ERROR_REUSED_CREATION_TOKEN:2011,ERROR_UPGRADE_REQUIRED:3e3,ERROR_VISIBLE_WORKFLOW_USERS_EXIST:3001,ERROR_GROUP_EXISTS:3002,ERROR_GROUP_PROOFS_EXIST:3003};t.default=n},function(e,t,o){"use strict";t.__esModule=!0,t.default=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=o(1),a=n(i),s=o(4),u=n(s),f={id:"GroupId",name:"Name",proofs:(0,i.each)("ProofInfo",function(e){return(new u.default).fromProof(e)})},c=function(){function e(){r(this,e)}return e.prototype.fromProofGroup=function(e){return(0,a.default)(this,f,e),this},e}();t.default=c},function(e,t,o){"use strict";e.exports=function e(){return e}},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=o(1),a=n(i),s=o(14),u=n(s),f=o(28),c=n(f),l={id:"StepId",name:"Title",position:(0,i.number)("Position"),state:function(e){return e.Complete?c.default.COMPLETE:e.Visible?c.default.VISIBLE:c.default.NOT_VISIBLE},users:(0,i.each)("Users",function(e,t){var o=(new u.default).fromWorkflowUser(e);return o._calculateState(e,t),o})},p=function(){function e(){r(this,e)}return e.prototype.fromWorkflowStep=function(e){return(0,a.default)(this,l,e),this},e}();t.default=p},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=o(1),u=n(s),f=o(3),c=n(f),l=o(27),p=n(l),d={id:"UserId",name:"Name",email:"Email",role:"Role",permissions:function(e){return{inviter:e.IsInviter}}},h=function(e){function t(){return r(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype._calculateState=function(e,t){e.SkippedInStep?this.state=p.default.SKIPPED:e.CompleteInStep?this.state=p.default.FINISHED:e.ViewedInStep?this.state=p.default.SEEN:t.Visible?this.state=p.default.VISIBLE:this.state=p.default.NOT_VISIBLE},t.prototype.fromWorkflowUser=function(e){return this._calculateState({},{}),(0,u.default)(this,d,e),this},t}(c.default);t.default=h},function(e,t,o){"use strict";t.__esModule=!0;var n={COMMENT:"comment",TODO:"todo",DONE:"done"};t.default=n},function(e,t,o){"use strict";t.__esModule=!0;var n=Object.prototype.toString;t.default=function(e){return"[object Object]"===n.call(e)}},function(e,t,o){"use strict";t.__esModule=!0;var n=void 0;n="108.0.1537501172464",t.default=n},function(e,t,o){"use strict";t.__esModule=!0;var n={UPLOADING:"uploading",FILE_ERROR:"file-error",PROCESSING:"processing",ARCHIVED:"archived",PROOFERS_NEEDED:"proofers-needed",TODOS_REQUESTED:"todos-requested",AWAITING_NEW_VERSION:"awaiting-new-version",APPROVED:"approved",NOT_STARTED:"not-started",OVERDUE:"overdue",ACTIVE:"active"};t.default=n},function(e,t,o){"use strict";t.__esModule=!0;var n={NEW:0,PROOFING:10,FINAL_APPROVING:30,TODOS_REQUESTED:50,AWAITING_NEW_VERSION:60,APPROVED:70,ARCHIVED:100};t.default=n},function(e,t,o){"use strict";var n={Proof:"P",Workflow:"W",File:"F",User:"U",Brief:"B"},r={};Object.keys(n).forEach(function(e){r["is"+e+"Id"]=function(t){return t&&16===t.length&&t[0]===n[e]}}),e.exports=r},function(e,t,o){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var r=o(1),i=function(e){return e&&e.__esModule?e:{default:e}}(r),a={id:"ProofId",version:"Version"},s=function(){function e(){n(this,e)}return e.prototype.fromProofVersion=function(e){return(0,i.default)(this,a,e),this},e}();t.default=s},function(e,t,o){"use strict";function n(e,t){return r(function(t){return t[e]},t)}function r(e,t){var o=t?1:-1,n=t?-1:1;return function(t,r){var i=e(t),a=e(r);return i<a?o:i>a?n:0}}function i(e,t){var o={};t.forEach(function(e,t){o[e]=t});var n="function"==typeof e?e:function(t){return t[e]};return function(e,t){var r=o[n(e)],i=o[n(t)];return r<i?-1:r>i?1:0}}function a(){for(var e=arguments.length,t=Array(e),o=0;o<e;o++)t[o]=arguments[o];var n=t.length;return function(e,o){for(var r=0;r<n;r++){var i=t[r](e,o);if(i)return i}return 0}}t.__esModule=!0,t.sortObjectsByKey=n,t.sortObjectsBy=r,t.sortObjectsByValues=i,t.combineSort=a},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){var t=e.lastIndexOf(".");return{name:e.substring(0,t),extension:e.substring(t+1)}}t.__esModule=!0;var u=o(0),f=n(u),c=o(7),l=n(c),p=o(5),d=n(p),h=o(24),y=n(h),m=o(59),w=n(m),v=o(8),_=n(v),b=o(64),E=n(b),g=o(2),O=function(e){function t(){return r(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.generateToken=function(e,t){return e&&!t?Promise.reject(Error('The "assignedType" option is required when specifying the "assignedTo" option.')):!e&&t?Promise.reject(Error('The "assignedTo" option is required when specifying the "assignedType" option.')):this.client.request("files.generate-token",{relatedId:e,fileType:t}).then(function(e){return e.data.Token})},t.prototype._waitFileProcessed=function(e){var t=this;return new Promise(function(o,n){var r=null,i=null;!function a(){t.details(e).then(function(t){switch(r=null,t.status){case d.default.OK:o(t);break;case d.default.ERROR:n(new Error("File "+e+" encountered a processing error: "+t.message));break;default:r=setTimeout(a,5e3)}r&&t.status!==d.default.RIPPING||clearTimeout(i)}).catch(n)}(),i=setTimeout(function(){clearTimeout(r),n(new Error("File did not finish processing within specified duration."))},3e4)})},t.prototype.import=function(e){var t=this,o=e.name,n=e.url,r=e.provider,i=void 0===r?y.default.NONE:r,a=e.auth,u=e.download,f=void 0!==u&&u,c=e.process,p=void 0!==c&&c;if(!Object.keys(y.default).some(function(e){return y.default[e]===i}))return Promise.reject(new Error('Unsupported provider "'+i+'"'));var d=i;i===y.default.NONE&&(d="generic");var h=s(o),m=h.name,w=h.extension;return this._generateKeyIVEnvelope().then(function(e){var o=e.envelope;return t.client.request("files.import."+d,{extn:w,filename:m,url:n,envelope:o,accessToken:a,storeOriginal:f})}).then(function(e){return e.data}).then(function(e){if(p)return t._waitFileProcessed(e);var o=new l.default;return o.id=e,o})},t.prototype._generateKeyIVEnvelope=function(){var e=this;return this.client.crypto().generateKeyIV().then(function(t){return Promise.all([t,e.client.crypto().envelopeSeal(t.keyIV,[e.client.session.serverPublicKeyPEM,e.client.session.publicKeyPEM])])}).then(function(e){return{keyIV:e[0],envelope:e[1]}})},t.prototype.upload=function(e){var t=this,o=e.name,n=e.contents,r=e.assignedTo,i=e.assignedType,a=e.download,s=void 0!==a&&a,u=e.async,f=void 0===u||u,c=e.onProgress,p=e.onError;return this.generateToken(r,i).then(function(e){return Promise.all([e,t._generateKeyIVEnvelope()])}).then(function(e){var r=e[0],i=e[1],a=i.keyIV,u=i.envelope,l=t._upload({name:o,contents:n,download:s,token:r,keyIV:a,envelope:u,onProgress:c,onError:p});return f&&(l=Promise.resolve()),l.then(function(){return r})}).then(function(e){var t=new l.default;return t.id=e,t})},t.prototype._upload=function(e){var t=this,o=e.name,n=e.contents,r=e.download,i=e.token,a=e.keyIV,u=e.envelope,f=e.onProgress;return new Promise(function(e){function c(){y().then(function(t){if(!_)if(null===t)_=!0,e(m.then(T));else{var o=I(t,v++);m=m.then(function(){return o}),o.then(c)}})}var l=4,p=s(o),d=p.name,h=p.extension,y=(0,w.default)(n),m=Promise.resolve(),v=0,_=!1,b=Math.ceil((0,E.default)(n)/g.BYTES_PER_BLOCK),O=new Array(b),P=function(){};f&&(P=function(e,t){O[e]=Math.max(t,O[e]||0),f(O.reduce(function(e,t){return e+(t||0)},0)/b*.99)});for(var I=function(e,o){return t.client.crypto().encryptFileBlock(a,e).then(function(e){return t.client.request("files.upload-block",{block:o,part:1,token:i,data:e},{onUploadProgress:P.bind(null,o)})})},T=function(){return t.client.request("files.upload-complete",{block:0,blockCount:v,part:0,token:i,extn:h,pages:1,filename:d,storeoriginal:r?1:0,envelope:u}).then(function(){return f&&f(100)})};l--;)c()})},t.prototype.download=function(e){var t=this,o="string"==typeof e?{fileId:e}:e,n=o.fileId,r=o.onFileDetails;return this.details(n).then(function(e){if(!e.downloadable)throw new Error("File "+n+" is not downloadable.");if(e.status!==d.default.OK)throw new Error("File "+n+" cannot be download. The file may still be uploading, processing or has errored.");if(!e.blocks)throw new Error("File "+n+" is empty.");return r&&r(e),t._downloadFile(e,o)})},t.prototype._downloadFile=function(e,t){var o=this;return new Promise(function(n){function r(){if(!y)if(h<u.length){var e=h++,t=d(e);f=f.then(function(){return t.then(function(t){return c(t,e,s)})}),t.then(r)}else y=!0,n(f.then(m))}var i=4,a=new _.default,s=e.blocks,u=new Array(s),f=Promise.resolve(),c=t.onData||function(e,t){u[t]=e},l=function(){};if(t.onProgress){var p=new Array(s);l=function(e,o){p[e]=Math.max(o,p[e]||0),t.onProgress(p.reduce(function(e,t){return e+(t||0)},0)/s*.99)}}for(var d=function(t){return o.client.request("files.download-block",{proofId:e.assignedTo,fileId:e.id,block:t+1},{onDownloadProgress:l.bind(null,t)}).then(function(e){return o.client.crypto().decryptFileBlock(e.data,o.client.session.privateKeyPEM).then(function(e){return a.createBase64(e)})})},h=0,y=!1,m=function(){return t.onProgress&&t.onProgress(100),t.onData?null:a.combine.apply(a,u)};i--;)r()})},t.prototype.details=function(e){return this.client.request("files.details",{fileId:e}).then(function(e){return(new l.default).fromFile(e.data)})},t.prototype.thumbnail=function(e){var t=this;return this.client.cache.auto(g.THUMBNAIL_CACHE_PREFIX+e,function(){return t._thumbnail(e)})},t.prototype._thumbnail=function(e){var t=this;return this.client.request("files.thumbnail",{fileId:e}).then(function(e){return t.client.crypto().decryptImage(e.data,t.client.session.privateKeyPEM)}).then(function(e){return(new _.default).createBase64(e)})},t.prototype.thumbnails=function(e,t){var o=this,n=t.async,r=void 0!==n&&n,i=t.onLoadThumbnails,a=[];return Promise.all(e.map(function(e){return o.client.cache.auto(g.THUMBNAIL_CACHE_PREFIX+e,function(t){a.push({fileId:e,resolve:t})}).then(function(t){var o;return t&&(o={},o[e]=t,o)})})).then(function(e){var t=Promise.all(a.map(function(e){var t=e.fileId,n=e.resolve;return o._thumbnail(t).then(function(e){if(n(e),r){var o;i((o={},o[t]=e,o))}return e})}));return r?e:t.then(function(t){return[].concat(e,t)})}).then(function(e){return Object.assign.apply(Object,[{}].concat(e))})},t}(f.default);t.default=O},function(e,t,o){"use strict";t.__esModule=!0;var n={NONE:"none",GOOGLE_DRIVE:"drive",DROPBOX:"dropbox",ONEDRIVE:"onedrive",BOX:"box"};t.default=n},function(e,t,o){"use strict";t.__esModule=!0;var n={PROOF:"proof",ATTACHMENT:"attachment",SNAPSHOT:"snapshot",FINAL_FILE:"final-file"};t.default=n},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=o(1),a=n(i),s=o(13),u=n(s),f={id:"WorkflowId",name:"Title",steps:(0,i.each)("WorkflowSteps",function(e){return(new u.default).fromWorkflowStep(e)})},c=function(){function e(){r(this,e)}return e.prototype.getStepByPosition=function(e){for(var t=this.steps.length,o=0;o<t;o+=1){var n=this.steps[o];if(n.position===e)return n}return null},e.prototype.getOrderedSteps=function(){return this.steps.sort(function(e,t){return e.position<t.position?-1:e.position>t.position?1:0})},e.prototype.getApproverStep=function(){return this.getStepByPosition(1e3)},e.prototype.fromWorkflow=function(e){return(0,a.default)(this,f,e),this},e}();t.default=c},function(e,t,o){"use strict";t.__esModule=!0;var n={NONE:null,NOT_VISIBLE:"not-visible",VISIBLE:"visible",SEEN:"seen",SKIPPED:"skipped",FINISHED:"finished"};t.default=n},function(e,t,o){"use strict";t.__esModule=!0;var n={NONE:null,NOT_VISIBLE:"not-visible",VISIBLE:"visible",COMPLETE:"complete"};t.default=n},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=o(1),a=n(i),s=o(3),u=n(s),f=o(30),c=n(f),l=o(7),p=n(l),d=o(15),h=n(d),y=o(31),m={__prepare:function(e){e._XY=c.default.parseValue(e.XY)},id:"CommentId",proofId:"ProofId",pin:function(e){return(new c.default).fromPin(e._XY)},user:function(e){return(new u.default).fromUser(e)},comment$:"EncryptedComment",envelope:"Envelope",attachments:function(e){return e.Attachment?[(new p.default).fromCommentAttachment(e)]:[]},agreeCount:function(e){return e.Agrees.length},pageNumber:(0,i.number)("Page"),mediaTime:function(e){return null==e._XY.time?void 0:e._XY.time},mediaDuration:function(e){return null==e._XY.duration?void 0:e._XY.duration},createdDate:(0,i.date)("Timestamp"),updatedDate:(0,i.date)("Updated"),parentCommentId:(0,i.optional)("Parent"),metadata:(0,i.json)("Metadata",{}),state:function(e){return+e.Done?h.default.DONE:+e.Change?h.default.TODO:h.default.COMMENT}},w=function(){function e(){r(this,e)}return e.prototype.fromComment=function(e){return(0,a.default)(this,m,e),this},e.prototype.fromRawComment=function(e){var t=(0,y.parseComment)(e);return this.raw=t.raw,this.text=t.text,this.html=t.html,this.tokens=t.tokens,this},e}();t.default=w},function(e,t,o){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e},i=o(1),a=function(e){return e&&e.__esModule?e:{default:e}}(i),s={x:"x",y:"y",x2:(0,i.optional)("x2"),y2:(0,i.optional)("y2")},u=function(){function e(){n(this,e)}return e.prototype.fromPin=function(e){return(0,a.default)(this,s,e),this},e.parseValue=function(e){var t={x:null,y:null,x2:null,y2:null,time:null,duration:null};if("{"===e[0]){var o=JSON.parse(e);t=r({},t,o)}else if(-1!==e.indexOf(",")){var n=e.split(","),i=n[0],a=n[1];t.x=parseFloat(i),t.y=parseFloat(a)}return t},e}();t.default=u},function(e,t,o){"use strict";function n(e){return(0,c.default)(e)}function r(e){return e.replace(l.MENTION_REGEX,function(e,t,o){return o})}function i(e){var t=0;return e.replace(l.MENTION_REGEX,function(e,o,n,r){return'<span data-mention data-mention-index="'+t+++'" data-mention-user-id="'+o+'" data-mention-user-label="'+n.replace(/"/,'\\"')+'" data-mention-start-index="'+r+'" data-mention-end-index="'+(r+e.length)+'" data-mention-length="'+e.length+'">'+n+"</span>"})}function a(e){var t=[];return e.replace(l.MENTION_REGEX,function(e,o,n,r){t.push({id:o,label:n,index:r,length:e.length})}),t}function s(e){var t=a(e),o=[],n=0;t.forEach(function(t){var r=e.slice(n,t.index);n=t.index+t.length,r&&o.push({type:"text",value:r}),o.push({type:"mention",value:t})});var r=e.slice(n);return r&&o.push({type:"text",value:r}),o}function u(e){var t=n(e);return{raw:e,text:r(t),html:i(t),mentions:a(e),tokens:s(e)}}t.__esModule=!0,t.getCommentTokens=t.getCommentText=t.getCommentMentions=t.getCommentHTML=t.getCommentEscaped=t.parseComment=void 0;var f=o(75),c=function(e){return e&&e.__esModule?e:{default:e}}(f),l=o(2);t.parseComment=u,t.getCommentEscaped=n,t.getCommentHTML=i,t.getCommentMentions=a,t.getCommentText=r,t.getCommentTokens=s},function(e,t,o){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t.default=e,t}function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0,t.version=t.Model=t.Enum=t.Bluffer=t.Client=void 0;var i=o(33),a=r(i),s=o(8),u=r(s),f=o(82),c=n(f),l=o(85),p=n(l),d=o(17),h=r(d);t.default=a.default,t.Client=a.default,t.Bluffer=u.default,t.Enum=c,t.Model=p,t.version=h.default},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=o(34),a=n(i),s=o(39),u=n(s),f=o(40),c=n(f),l=o(42),p=n(l),d=o(44),h=n(d),y=o(46),m=n(y),w=o(48),v=n(w),_=o(49),b=n(_),E=o(66),g=n(E),O=o(23),P=n(O),I=o(67),T=n(I),S=o(70),R=n(S),k=o(72),M=n(k),A=o(74),C=n(A),j=o(78),D=n(j),q=o(79),N=n(q),x=o(6),U=n(x),B=o(80),G=n(B),L=o(9),F=n(L),K=o(81),W=n(K),V=o(12)("PageProof"),H=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};r(this,e),this.options=t,this.events=new G.default,this.adapters=new a.default(this.options.adapters),this.cache=new u.default(this),this.accounts=new h.default(this),this.comments=new C.default(this),this.dashboard=new m.default(this),this.files=new P.default(this),this.profile=new D.default(this),this.proofs=new b.default(this),this.briefs=new g.default(this),this.users=new v.default(this),this.workflows=new R.default(this),this.preferences=new M.default(this),this.sessions=new N.default(this),this._registerCoreHooks(),this._enhance()}return e.prototype._registerCoreHooks=function(){this.on("error.throttled",function(e){var t=e.data.response.data.timeout;return V("Sleeping "+t+"ms until rate limit resets"),(0,W.default)(t)})},e.prototype._enhance=function(){var e=this;this.adapters.getEnhancementAdapters().forEach(function(t){return t.onClientReady(e)})},e.prototype.setSession=function(e){return!e||e instanceof U.default?this.session=e||null:this.session=(new U.default).fromJSON(e),this.session},e.prototype.request=function(e,t,o){var n=this,r=new c.default(e,t),i=this.adapters.getRequestAdapter(),a=Promise.resolve();if(!r.endpoint.anonymous){if(!this.session)return Promise.reject(new Error("Cannot make call to endpoint ("+e+") when unauthorized."));a=this.adapters.getCryptoAdapter().generateAuthorizationHeaders(r.getMethod(),r.getPath(),this.session).then(function(e){return r.addHeaders(e)})}var s={request:r};return a.then(function(){var e=r.build();return n.events.emit("experimental.request.before",s,!0).then(function(){return e})}).then(function(e){return i.send(e,o)}).then(p.default.parse).then(function(r){if(s.response=r,n.events.emit("experimental.request.after",s),r.code===F.default.ERROR_THROTTLED){var i=n.events.emit("error.throttled",s);if(i.some(Boolean))return Promise.all(i).then(function(){return n.events.emit("experimental.request.retry",s),n.request(e,t,o)})}if(r.code===F.default.ERROR_UNAUTHORISED){var a=n.session?n.session.token:null;return n.events.emit("error.unauthorized",s,!0).then(function(){return n.session&&n.session.token!==a?n.request(e,t,o):r})}if(r.deprecated){var u="The "+e+" API has been deprecated. "+(r.deprecated||"");n.events.emit("error.deprecated",{name:e,message:u})}return r}).then(function(t){try{if(t.error){n.events.emit("error.response",s);var o=new Error(e+" request resulted in an "+t.code+" error.");return o.response=t,o.request=r,Promise.reject(o)}return n.events.emit("experimental.request.resolve",s),Promise.resolve(t)}finally{n.events.emit("experimental.request.finally",s)}})},e.prototype.admin=function(){return this.session?this.session.user.isAdmin?(this._admin||(this._admin=Promise.resolve(new T.default(this))),this._admin):Promise.reject(new Error("The current user must be an administrator of a team or enterprise account.")):Promise.reject(new Error("You must be logged in to use the Admin API."))},e.prototype.crypto=function(){return this.adapters.getCryptoAdapter()},e.prototype.on=function(e,t){return this.events.on(e,t)},e}();t.default=H},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=o(35),a=n(i),s=o(36),u=n(s),f=o(37),c=n(f),l=o(38),p=n(l),d=function(){function e(t){r(this,e),this.adapters=[].concat(t)}return e.prototype.getAdapterInstanceOf=function(e){return this.getAnyAdaptersInstanceOf(e)[0]||null},e.prototype.getAnyAdaptersInstanceOf=function(e){for(var t=[],o=e.__adapter__,n=0;n<this.adapters.length;n+=1){var r=this.adapters[n];Object.getPrototypeOf(Object.getPrototypeOf(r)).constructor.__adapter__===o&&t.push(r)}return t},e.prototype.getCryptoAdapter=function(){var e=this.getAdapterInstanceOf(a.default);if(!e)throw new Error("ICryptoAdapter not found. This adapter is required for the SDK to function correctly.");return e},e.prototype.getRequestAdapter=function(){var e=this.getAdapterInstanceOf(u.default);if(!e)throw new Error("IRequestAdapter not found. This adapter is required for the SDK to function correctly.");return e},e.prototype.getCacheAdapter=function(){return this.getAdapterInstanceOf(c.default)},e.prototype.getEnhancementAdapters=function(){return this.getAnyAdaptersInstanceOf(p.default)},e}();t.default=d},function(e,t,o){"use strict";function n(){}t.__esModule=!0,n.__adapter__="ICryptoAdapter",t.default=n},function(e,t,o){"use strict";function n(){}t.__esModule=!0,n.__adapter__="IRequestAdapter",t.default=n},function(e,t,o){"use strict";function n(){}t.__esModule=!0,n.__adapter__="ICacheAdapter",t.default=n},function(e,t,o){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t,o){var n=e[t];e[t]=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];var i=n.bind.apply(n,[this].concat(t));return o(i,this,t).apply(this,t)}}function i(e){function t(r){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],a=Object.getOwnPropertyNames(r).filter(function(t){return r[t].client===e}),s=Object.getPrototypeOf(r),u=Object.keys(s).filter(function(e){return"function"==typeof s[e]&&0!==e.indexOf("_")});(i.length||o)&&u.forEach(function(e){n.push({namespace:i.join("."),name:e,api:r})}),a.forEach(function(e){t(r[e],i.concat(e))})}var o=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=[];return t(e),n}t.__esModule=!0;var a,s,u=(s=a=function(){function e(){n(this,e)}return e.prototype.onClientReady=function(e){var t=this;i(e).forEach(function(e){r(e.api,e.name,function(o){var n={api:e.api,namespace:e.namespace,name:e.name,displayName:e.namespace+"."+e.name};return t.onMethodBefore(n),function(){var e=void 0;try{e=o()}catch(e){throw n.error=e,t.onMethodThrown(n),e}finally{n.value=e,t.onMethodAfter(n),e&&"function"==typeof e.then&&e.then(function(e){n.resolved=e,t.onMethodResolve(n)},function(e){n.rejected=e,t.onMethodReject(n)}).then(function(){t.onMethodFinally(n)})}return e}})}),e.on("experimental.request.before",function(e){return t.onRequestBefore(e.data)}),e.on("experimental.request.after",function(e){return t.onRequestAfter(e.data)}),e.on("error.response",function(e){return t.onRequestReject(e.data)}),e.on("error.throttled",function(e){return t.onRequestThrottled(e.data)}),e.on("experimental.request.retry",function(e){return t.onRequestRetry(e.data)}),e.on("error.unauthorized",function(e){return t.onRequestUnauthorized(e.data)}),e.on("error.deprecated",function(e){return t.onRequestDeprecated(e.data)}),e.on("experimental.request.resolve",function(e){return t.onRequestResolve(e.data)}),e.on("experimental.request.finally",function(e){return t.onRequestFinally(e.data)})},e.prototype.onMethodBefore=function(){},e.prototype.onMethodAfter=function(){},e.prototype.onMethodReject=function(){},e.prototype.onMethodResolve=function(){},e.prototype.onMethodFinally=function(){},e.prototype.onMethodThrown=function(){},e.prototype.onRequestBefore=function(){},e.prototype.onRequestAfter=function(){},e.prototype.onRequestReject=function(){},e.prototype.onRequestThrottled=function(){},e.prototype.onRequestRetry=function(){},e.prototype.onRequestUnauthorized=function(){},e.prototype.onRequestDeprecated=function(){},e.prototype.onRequestResolve=function(){},e.prototype.onRequestFinally=function(){},e}(),a.__adapter__="IEnhancementAdapter",s);t.default=u},function(e,t,o){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var r=function(){function e(t){n(this,e),this.client=t}return e.prototype.auto=function(e,t){var o=this.client.adapters.getCacheAdapter(),n=function(){};return o?(n=function(t){void 0!==t&&o.set(e,t)},o.get(e).catch(function(){return Promise.resolve(t(n)).then(function(e){return n(e),e})})):Promise.resolve(t(n))},e}();t.default=r},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e},a=o(41),s=n(a),u=o(16),f=n(u),c=o(17),l=n(c),p=o(2),d=function(){function e(t,o){if(r(this,e),this.name=t,this.endpoint=s.default[t],!this.endpoint)throw new Error('Unknown request endpoint "'+t+'".');this.params={},this.addParams(o),this.headers={}}return e.prototype.addHeaders=function(e){return this.headers=i({},this.headers,e),this},e.prototype.addHeader=function(e,t){return this.headers[e]=t,this},e.prototype.addParams=function(e){return this.params=i({},this.params,e),this},e.prototype.addParam=function(e,t){this.params[e]=t},e.prototype.getPath=function(){var e=this,t=this.endpoint,o=t.path,n=t.chain,r=t.trailing,i=o;return n&&n.forEach(function(t){"/"!==i[i.length-1]&&(i+="/"),i+=e.params[t]}),r&&"/"!==i[i.length-1]&&(i+="/"),i},e.prototype.getQuery=function(){var e=this,t=this.endpoint.query;if(t){var o=t.map(function(t){return void 0!==e.params[t]?t+"="+encodeURIComponent(e.params[t]):null}).filter(Boolean).join("&");if(o)return"?"+o}return""},e.prototype.getHeaders=function(){var e,t=i({},this.headers,(e={},e[p.SDK_VERSION_HEADER]=l.default,e));if("POST"===this.endpoint.method)switch(this.endpoint.version){case 2:t["Content-Type"]="application/json";break;case 1:default:t["Content-Type"]="application/x-www-form-urlencoded"}return t},e.prototype.getBody=function(){var e=this,t=this.endpoint;if(t.body){if("string"==typeof t.body){var o=this.params[t.body];return o=(0,f.default)(o)?JSON.stringify(o):String(o)}var n=!0===t.body?Object.keys(this.params):t.body,r={};switch(n.forEach(function(t){var o=e.params[t];void 0!==o&&(r[t]=o)}),t.version){case 2:return JSON.stringify(r);case 1:default:return Object.keys(r).map(function(t){return t+"="+encodeURIComponent(e.params[t])}).join("&")}}return null},e.prototype.getMethod=function(){return(this.endpoint.method||"GET").toUpperCase()},e.prototype.isWithCredentials=function(){return!0===this.endpoint.credentials},e.prototype.build=function(){return{method:this.getMethod(),path:this.getPath(),query:this.getQuery(),body:this.getBody(),headers:this.getHeaders(),credentials:this.isWithCredentials()}},e}();t.default=d},function(e,t){e.exports={"accounts.register":{method:"POST",path:"/api/users/register",body:["email","password","privateKey","publicKey"],anonymous:!0},"accounts.login":{method:"POST",path:"/api/users/login",body:["email","password"],anonymous:!0},"accounts.generate-activation-code":{method:"GET",path:"/api/users/auth/generate",chain:["userId"],trailing:!0},"accounts.activate":{method:"POST",path:"/api/users/auth/activate",body:["userId","authCode"],trailing:!0},"accounts.logout":{method:"GET",path:"/api/users/logout"},"profile.upload-avatar":{method:"POST",path:"/api/media/file/avatar",body:["uploadedImage"]},"profile.change-password":{method:"POST",path:"/api/users/changepassword",body:["oldPassword","newPassword","newPrivateKey"],trailing:!0},"preferences.all":{method:"GET",path:"/api/users/preferences/all"},"preferences.get":{method:"GET",path:"/api/users/preferences/get",query:["preferences"]},"preferences.update":{method:"POST",path:"/api/users/preferences/update",body:!0},"preferences.reset":{method:"POST",path:"api/users/preferences/update",body:["preferences"]},"dashboard.inbox":{method:"GET",path:"/api/proofs/dashboard/proofin",trailing:!0},"dashboard.sent":{method:"GET",path:"/api/proofs/dashboard/proofout",trailing:!0},"dashboard.outbox":{method:"GET",path:"/api/proofs/dashboard/proofoutbox",trailing:!0},"dashboard.search":{method:"POST",path:"/api/proofs/search",body:["query","all","filterBy"]},"dashboard.groups.filter-by":{method:"GET",path:"/api/proofs/dashboard/groups",chain:["filterBy"],trailing:!0},"users.by-id":{method:"GET",path:"/api/users",chain:["userId"]},"users.by-email":{method:"POST",path:"/api/users/email",body:["email"],trailing:!0},"users.invite":{method:"POST",path:"/api/users/create",body:["email"]},"proofs.create":{method:"POST",path:"/api/proofs/create",body:["title","dueDate","description","groupId"]},"proofs.normalize-workflow":{method:"POST",path:"/api/proofs/permission/check",body:["proofId","workflowId"]},"proofs.set-workflow":{method:"POST",path:"/api/proofs/update",body:["proofId","workflowId"]},"proofs.set-tags":{method:"POST",path:"/api/tags/create",body:["relatedId","tag"]},"proofs.set-file":{method:"POST",path:"/api/proofs/update",body:["proofId","fileId"]},"proofs.distribute-file":{method:"GET",path:"/api/proofs/distribute",chain:["proofId"],trailing:!0},"proofs.archive":{version:2,method:"POST",path:"/api/proofs/close",body:["proofIds"]},"proofs.unarchive":{method:"GET",path:"/api/proofs/reopen",chain:["proofId"],trailing:!0},"proofs.delete":{method:"GET",path:"/api/proofs/delete",chain:["proofId"],trailing:!0},"proofs.start":{method:"POST",path:"/api/proofs/startworkflow",body:["proofId"],trailing:!0},"proofs.editors.add":{version:2,method:"POST",path:"/api/proofs/editor/add",body:["proofId","editors","editorMessage"]},"proofs.editors.remove":{version:2,method:"POST",path:"/api/proofs/editor/remove",body:["proofId","editors"]},"proofs.editors.replace":{version:2,method:"POST",path:"/api/proofs/editor/replace",body:["proofId","oldEditors","newEditors"]},"proofs.editors.set":{version:2,method:"POST",path:"/api/proofs/editor/set",body:["proofId","editors"]},"briefs.start":{method:"POST",path:"/api/briefs/start",body:["briefId"]},"proofs.return":{method:"GET",path:"/api/proofs/returnproof",chain:["proofId"]},"proofs.groups.create":{method:"POST",path:"/api/proofs/groups/create",body:["name"]},"proofs.groups.update":{method:"POST",path:"/api/proofs/groups/update",body:["groupId","name"]},"proofs.groups.load":{method:"GET",path:"/api/proofs/group",chain:["groupId"]},"proofs.groups.ready":{method:"POST",path:"/api/proofs/groups/ready",body:["groupId"]},"proofs.groups.owners.add":{version:2,method:"POST",path:"/api/v2/proofs/owners/groups/add",body:["groupId","owners"]},"proofs.groups.workflows.add-reviewers":{version:2,method:"POST",path:"/api/v2/workflows/groups/reviewers/add",body:["groupId","reviewers"]},"proofs.versions.attach":{method:"POST",path:"/api/proofs/versions/create",body:["proofId","versionId"]},"proofs.versions.list":{method:"GET",path:"/api/proofs/versions",chain:["proofId"],trailing:!0},"proofs.load":{method:"GET",path:"/api/proofs/",chain:["proofId"],trailing:!0},"proofs.request-access":{method:"GET",path:"/api/proofs/requestaccess",chain:["proofId"]},"proofs.lock":{method:"GET",path:"/api/proofs/lock/",chain:["proofId"],trailing:!0},"proofs.unlock":{method:"GET",path:"/api/proofs/unlock/",chain:["proofId"],trailing:!0},"proofs.request-unlock":{method:"GET",path:"/api/proofs/unlockemail/",chain:["proofId"],trailing:!0},"files.generate-token":{method:"GET",path:"/api/media/getfiletoken",query:["relatedId","fileType"]},"files.upload-block":{method:"POST",path:"/api/media/file",query:["block","part","token"],body:"data"},"files.upload-complete":{method:"POST",path:"/api/media/file",query:["block","blockCount","part","token","extn","pages","filename","storeoriginal"],body:"envelope"},"files.details":{method:"GET",path:"/api/media/file/details",chain:["fileId"]},"files.download-block":{method:"GET",path:"/api/media/getfilechunk",chain:["proofId","fileId","block"]},"files.thumbnail":{method:"GET",path:"/api/media/getimage/thumb",chain:["fileId"]},"files.import.generic":{method:"POST",path:"/api/media/filedrive",body:["extn","filename","url","envelope","storeOriginal"]},"files.import.drive":{method:"POST",path:"/api/media/filedrive",body:["extn","filename","url","envelope","storeOriginal","accessToken"]},"files.import.onedrive":{method:"POST",path:"/api/media/fileonedrive",body:["extn","filename","url","envelope","storeOriginal","accessToken"]},"files.import.box":{method:"POST",path:"/api/media/filebox",body:["extn","filename","url","envelope","storeOriginal","accessToken"]},"files.import.dropbox":{method:"POST",path:"/api/media/filedropbox",body:["extn","filename","url","envelope","storeOriginal","accessToken"]},"workflows.create":{version:2,method:"POST",path:"/api/v2/workflows/create",body:["title"]},"workflows.load":{version:2,method:"GET",path:"/api/v2/workflows/detail",chain:["workflowId"]},"workflows.steps.add":{version:2,method:"POST",path:"/api/v2/workflows/steps/add",body:["workflowId","title","position"]},"workflows.steps.move-before":{method:"POST",path:"/api/workflows/step/movebefore",body:["stepId","beforeStepId"]},"workflows.steps.move-after":{method:"POST",path:"/api/workflows/step/moveafter",body:["stepId","afterStepId"]},"workflows.steps.swap":{method:"POST",path:"/api/workflows/step/swap",body:["stepId","swapStepId"]},"workflows.users.set":{version:2,method:"POST",path:"/api/v2/workflows/users/set",body:["workflowId","stepId","position","users"]},"workflows.users.update":{version:2,method:"POST",path:"/api/v2/workflows/users/update",body:["workflowId","stepId","userId","role","permissions"]},"workflows.users.add":{version:2,method:"POST",path:"/api/v2/workflows/users/add",body:["workflowId","stepId","users"]},"workflows.delete":{method:"POST",path:"/api/workflows/delete",body:["workflowId"]},"workflows.duplicate":{method:"POST",path:"/api/workflows/duplicateonly",body:["workflowId"]},"workflows.owned":{method:"GET",path:"/api/workflows",trailing:!0},"workflows.shared":{method:"GET",path:"/api/workflows/share/user",trailing:!0},"comments.load-all":{method:"POST",path:"/api/proofs/recent",body:["proofId","timestamp"]},"comments.load-page":{method:"POST",path:"/api/proofs/comment/recent",body:["proofId","timestamp","page"]},"comments.state.update":{method:"POST",path:"/api/proofs/comment/updatestatus",body:["commentId","change","done"]},"comments.create":{method:"POST",path:"/api/proofs/comment/create",body:["proofId","page","envelope","encryptedComment","xy","parent","mentions","metadata","creationToken","change","done"]},"proofs-owners.add":{version:2,method:"POST",path:"/api/v2/proofs/owners/add",body:["proofId","users"]},"proofs-owners.remove":{version:2,method:"POST",path:"/api/v2/proofs/owners/remove",body:["proofId","users"]},"proofs.tag-delete":{method:"POST",path:"/api/tags/delete",body:["relatedId","tag"]},"proofs.remove-editor":{method:"GET",path:"/api/proofs/deleteeditor",chain:["proofId"],trailing:!0},"proofs.final-delivery.get-all":{method:"GET",path:"/api/proofs/final-delivery",chain:["proofId"],trailing:!0},"proofs.final-delivery.get-files":{method:"GET",path:"/api/proofs/final-delivery/files",chain:["proofId"],trailing:!0},"proofs.final-delivery.files.delete":{method:"POST",path:"/api/proofs/final-delivery/files/delete",body:["proofId","fileIds"]},"proofs.final-delivery.notification.add":{method:"POST",path:"/api/proofs/final-delivery/notification/create",body:["proofId","type","users","fileIds","options"]},"proofs.final-delivery.get-notification":{method:"GET",path:"/api/proofs/final-delivery/notification",chain:["notificationId"],trailing:!0},"proofs.final-delivery.notification.delete":{method:"POST",path:"/api/proofs/final-delivery/notification/delete",body:["notificationId"]},"proofs.final-delivery.notification.send":{method:"POST",path:"/api/proofs/final-delivery/notification/sent",body:["notificationId"]},"briefs.create":{method:"POST",path:"/api/briefs/create",body:["title","messageToRecipient","dueDate","tag"]},"briefs.update":{method:"POST",path:"/api/briefs/update",body:["briefId","title","messageToRecipient","dueDate","tag","recipient","editorId","editorMessage"]},"admin.team.users.enabled":{method:"GET",path:"/api/admin/getusers/active",trailing:!0},"admin.team.users.disabled":{method:"GET",path:"/api/admin/getusers/inactive",trailing:!0},"admin.team.users.set-enabled":{method:"POST",path:"/api/admin/setenabled",body:["email","enabled"]},"sessions.check":{method:"GET",path:"/api/sessions/check"},"sso.get-public-key":{method:"GET",path:"/sso/public_key",anonymous:!0},"sso.get-session":{version:2,method:"POST",path:"/sso/session",body:["nonce"],anonymous:!0,credentials:!0},"sso.get-login-options":{version:2,method:"POST",path:"/sso/login_options",body:["email"],anonymous:!0}}},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=o(9),a=n(i),s=o(43),u=o(2),f=o(10),c=n(f),l=function(){function e(){r(this,e),this.error=!1,this.code=-1,this.data=null,this.message=null,this.deprecated=null}return e.parse=function(t){var o=t.status,n=t.headers,r=void 0===n?{}:n,i=t.body,f=new e;if(o===s.TOO_MANY_REQUESTS_STATUS)return f.error=!0,f.message="PageProof Error #h"+s.TOO_MANY_REQUESTS_STATUS,f.code=a.default.ERROR_THROTTLED,f.data={timeout:1e3*(parseFloat(r[u.RETRY_AFTER_HEADER])||60)},f;if((0,c.default)(r,"deprecated")&&(f.deprecated=r.deprecated),o===s.OK_STATUS&&!i)return f.code=a.default.OK,f;try{var l=JSON.parse(i);"string"==typeof l||(l&&"ResponseCode"in l?(f.code=l.ResponseCode,f.code!==a.default.OK&&(f.error=!0)):l.Message&&1===Object.keys(l).length&&(f.error=!0,f.code=a.default.ERROR_CRITICAL)),f.error&&(f.message="PageProof Error #s"+f.code),f.data=l}catch(e){f.error=!0}return f},e}();t.default=l},function(e,t,o){"use strict";t.__esModule=!0;t.TOO_MANY_REQUESTS_STATUS=429,t.OK_STATUS=200},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=o(0),u=n(s),f=o(6),c=n(f),l=o(45),p=n(l),d=function(e){function t(o){r(this,t);var n=i(this,e.call(this,o));return n.sso=new p.default(o),n}return a(t,e),t.prototype.register=function(e,t){var o=this;return this.client.crypto().generatePasswordHash(t).then(function(e){return Promise.all([e,o.client.crypto().generateKeyPair()])}).then(function(e){var n=e[0],r=e[1];return Promise.all([n,r,o.client.crypto().encryptPrivateKey(r.privateKeyPEM,t)])}).then(function(t){var n=t[0],r=t[1],i=t[2];return Promise.all([r,o.client.request("accounts.register",{email:e,password:n,privateKey:i,publicKey:r.publicKeyPEM})])}).then(function(n){var r=n[0];return Promise.all([r,o.login(e,t,!1)])}).then(function(e){var t=e[0],n=e[1];return Promise.all([t,n,o.generateActivationCode()])}).then(function(e){var t=e[0],o=e[1];return o.privateKeyPEM=t.privateKeyPEM,o})},t.prototype.generateActivationCode=function(){return this.client.request("accounts.generate-activation-code",{userId:this.client.session.userId})},t.prototype.activate=function(e){var t=this;return this.client.request("accounts.activate",{userId:this.client.session.userId,authCode:e}).then(function(){t.client.session.user.hasActivated=!0})},t.prototype.login=function(e,t){var o=this,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return this.client.crypto().generatePasswordHash(t).then(function(t){return o.client.request("accounts.login",{email:e,password:t})}).then(function(t){var o=(new c.default).fromSession(t.data);return o.user.email=e,o}).then(function(e){return n?o.client.crypto().decryptPrivateKey(e.privateKeyPEM$,t).then(function(t){return e.privateKeyPEM=t,e}):e}).then(function(e){return o.client.setSession(e),e})},t.prototype.logout=function(){var e=this;return this.client.request("accounts.logout").catch(function(t){return e.client.setSession(null),Promise.reject(t)}).then(function(){e.client.setSession(null)})},t}(u.default);t.default=d},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=o(0),u=n(s),f=o(6),c=n(f),l=function(e){function t(){return r(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.getSession=function(){var e=this;return this.client.request("sso.get-public-key").then(function(e){return e.data.ServerPublicKey}).then(function(t){return e.client.crypto().generateWrappedSymmetricKey(t)}).then(function(t){var o=t.key,n=t.key$;return Promise.all([o,e.client.request("sso.get-session",{nonce:n})])}).then(function(t){var o=t[0],n=t[1],r=(new c.default).fromSession(n.data);return Promise.all([r,e.client.crypto().decryptManagedPrivateKey(r.privateKeyPEM$,o)])}).then(function(e){var t=e[0],o=e[1];return t.privateKeyPEM=o,t})},t.prototype.getLoginOptions=function(e){return this.client.request("sso.get-login-options",{email:e}).then(function(e){return e.data})},t}(u.default);t.default=l},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){var t={};return Object.keys(y).forEach(function(o){t[o]=e[y[o]]}),t}function u(e){return(e||[]).map(function(e){return(new p.default).fromProof(e)})}t.__esModule=!0;var f=o(0),c=n(f),l=o(4),p=n(l),d=o(47),h=n(d),y={inbox:"ProofIn",sent:"ProofOut",outbox:"ProofOutBox"},m=function(e){function t(o){r(this,t);var n=i(this,e.call(this,o));return n.groups=new h.default(o),n}return a(t,e),t.prototype.inbox=function(){return this._loadSingleTabProofs("inbox")},t.prototype.sent=function(){return this._loadSingleTabProofs("sent")},t.prototype.outbox=function(){return this._loadSingleTabProofs("outbox")},t.prototype._loadSingleTabProofs=function(e){return this.client.request("dashboard."+e).then(function(e){return s(e.data)}).then(function(t){return t[e]}).then(u)},t.prototype.search=function(e){return this._loadSearchProofs({query:e})},t.prototype.everything=function(){return this._loadSearchProofs({all:1})},t.prototype.approved=function(){return this._loadSearchProofs({filterBy:70})},t.prototype.archived=function(){return this._loadSearchProofs({filterBy:100})},t.prototype._loadSearchProofs=function(e){return this.client.request("dashboard.search",e).then(function(e){return u(e.data.Proofs)})},t}(c.default);t.default=m},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){return(e||[]).map(function(e){return(new l.default).fromProofGroup(e)})}t.__esModule=!0;var u=o(0),f=n(u),c=o(11),l=n(c),p=function(e){function t(){return r(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype._loadGroups=function(e){return this.client.request("dashboard.groups.filter-by",{filterBy:e}).then(function(e){return s(e.data)})},t.prototype.current=function(){return this._loadGroups("current")},t}(f.default);t.default=p},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){return e.data.length>0?(new p.default).fromUser(e.data[0]):(new p.default).fromUser(e.data)}function u(e){return e.data.length?(new p.default).fromUser(e.data[0]):null}t.__esModule=!0;var f=o(0),c=n(f),l=o(3),p=n(l),d=function(e){function t(){return r(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.byEmail=function(e){return this.client.request("users.by-email",{email:e}).then(u)},t.prototype.byId=function(e){return this.client.request("users.by-id",{userId:e}).then(s)},t.prototype.invite=function(e){return this.client.request("users.invite",{email:e}).then(s)},t}(c.default);t.default=d},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=o(0),u=n(s),f=o(50),c=n(f),l=o(51),p=n(l),d=o(52),h=n(d),y=o(53),m=n(y),w=o(56),v=n(w),_=o(4),b=n(_),E=o(5),g=n(E),O=o(2),P=function(e){function t(o){r(this,t);var n=i(this,e.call(this,o));return n.owners=new c.default(o),n.editors=new p.default(o),n.versions=new h.default(o),n.groups=new m.default(o),n.finalDelivery=new v.default(o),n}return a(t,e),t.prototype.setWorkflow=function(e,t){var o=this;return this.client.request("proofs.normalize-workflow",{proofId:e,workflowId:t}).then(function(){return o.client.request("proofs.set-workflow",{proofId:e,workflowId:t})})},t.prototype.setTags=function(e,t){return this.client.request("proofs.set-tags",{relatedId:e,tag:t.join(",")})},t.prototype.deleteTag=function(e,t){return this.client.request("proofs.tag-delete",{relatedId:e,tag:t})},t.prototype.setFile=function(e,t){var o=this;return this.client.request("proofs.set-file",{proofId:e,fileId:t}).then(function(){return o.client.request("proofs.distribute-file",{proofId:e})})},t.prototype.create=function(e){var t=this,o=e.name,n=e.tags,r=void 0===n?[]:n,i=e.dueDate,a=void 0===i?new Date(Date.now()+3*O.DAY_IN_MS):i,s=e.messageToReviewers,u=e.workflow,f=e.file,c=e.group,l=e.start,p=void 0===l||l,d=p&&!c;return this.client.request("proofs.create",{title:o,dueDate:a.toISOString(),description:s,groupId:c?c.id:void 0}).then(function(e){var o=(new b.default).fromProof(e.data);return Promise.all([o,r.length&&t.setTags(o.id,r),u&&t.setWorkflow(o.id,u.id),f&&t.setFile(o.id,f.id)])}).then(function(e){var o=e[0];return Promise.resolve(d&&t.start(o.id)).then(function(){return o})}).then(function(e){return u&&(e.workflowId=u.id),f&&(e.fileId=f.id,e.fileStatus=g.default.UPLOADING),e.calculateState(),e})},t.prototype.archive=function(e){return this.client.request("proofs.archive",{proofIds:e})},t.prototype.unarchive=function(e){return this.client.request("proofs.unarchive",{proofId:e})},t.prototype.delete=function(e){return this.client.request("proofs.delete",{proofId:e})},t.prototype.return=function(e){return this.client.request("proofs.return",{proofId:e})},t.prototype.start=function(e){return this.client.request("proofs.start",{proofId:e})},t.prototype.removeEditor=function(e){return this.client.request("proofs.remove-editor",{proofId:e})},t.prototype.load=function(e){return this.client.request("proofs.load",{proofId:e}).then(function(e){return(new b.default).fromProof(e.data)})},t.prototype.lock=function(e){return this.client.request("proofs.lock",{proofId:e})},t.prototype.unlock=function(e){return this.client.request("proofs.unlock",{proofId:e})},t.prototype.requestUnlock=function(e){return this.client.request("proofs.request-unlock",{proofId:e})},t.prototype.requestAccess=function(e){return this.client.request("proofs.request-access",{proofId:e})},t}(u.default);t.default=P},function(e,t,o){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=o(0),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(e){function t(){return n(this,t),r(this,e.apply(this,arguments))}return i(t,e),t.prototype.add=function(e,t){return this.client.request("proofs-owners.add",{proofId:e,users:[].concat(t)})},t.prototype.remove=function(e,t){return this.client.request("proofs-owners.remove",{proofId:e,users:[].concat(t)})},t}(s.default);t.default=u},function(e,t,o){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=o(0),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(e){function t(){return n(this,t),r(this,e.apply(this,arguments))}return i(t,e),t.prototype.add=function(e,t,o){var n={proofId:e,editors:[].concat(t),editorMessage:null===o?"":o};return this.client.request("proofs.editors.add",n)},t.prototype.remove=function(e,t){return this.client.request("proofs.editors.remove",{proofId:e,editors:[].concat(t)})},t.prototype.replace=function(e,t,o){return this.client.request("proofs.editors.replace",{proofId:e,oldEditors:[].concat(t),newEditors:[].concat(o)})},t.prototype.set=function(e,t){return this.client.request("proofs.editors.set",{proofId:e,editors:[].concat(t)})},t}(s.default);t.default=u},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=o(0),u=n(s),f=o(21),c=n(f),l=o(22),p=(0,l.sortObjectsByKey)("version"),d=function(e){function t(){return r(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.attach=function(e,t){return this.client.request("proofs.versions.attach",{proofId:e,versionId:t})},t.prototype.list=function(e){return this.client.request("proofs.versions.list",{proofId:e}).then(function(e){return e.data.map(function(e){return(new c.default).fromProofVersion(e)}).sort(p)})},t}(u.default);t.default=d},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){return(new l.default).fromProofGroup(e.data)}t.__esModule=!0;var u=o(0),f=n(u),c=o(11),l=n(c),p=o(54),d=n(p),h=o(55),y=n(h),m=function(e){function t(o){r(this,t);var n=i(this,e.call(this,o));return n.owners=new d.default(o),n.workflows=new y.default(o),n}return a(t,e),t.prototype.create=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.name;return this.client.request("proofs.groups.create",{name:t}).then(s)},t.prototype.load=function(e){return this.client.request("proofs.groups.load",{groupId:e}).then(s)},t.prototype.ready=function(e){return this.client.request("proofs.groups.ready",{groupId:e})},t.prototype.update=function(e,t){var o=t.name;return this.client.request("proofs.groups.update",{groupId:e,name:o}).then(s)},t}(f.default);t.default=m},function(e,t,o){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=o(0),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(e){function t(){return n(this,t),r(this,e.apply(this,arguments))}return i(t,e),t.prototype.add=function(e,t){return this.client.request("proofs.groups.owners.add",{groupId:e,owners:[].concat(t)})},t}(s.default);t.default=u},function(e,t,o){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=o(0),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(e){function t(){return n(this,t),r(this,e.apply(this,arguments))}return i(t,e),t.prototype.addReviewers=function(e,t){return this.client.request("proofs.groups.workflows.add-reviewers",{groupId:e,reviewers:[].concat(t)})},t}(s.default);t.default=u},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){return(new l.default).fromProofFinalDelivery(e.data)}t.__esModule=!0;var u=o(0),f=n(u),c=o(57),l=n(c),p=o(58),d=n(p),h=o(65),y=n(h),m=function(e){function t(o){r(this,t);var n=i(this,e.call(this,o));return n.files=new d.default(o),n.notifications=new y.default(o),n}return a(t,e),t.prototype.all=function(e){return this.client.request("proofs.final-delivery.get-all",{proofId:e}).then(s)},t}(f.default);t.default=m},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=o(1),a=n(i),s=o(7),u=n(s),f={id:"Id",name:"Name",files:(0,i.each)("ProofInfo",function(e){return(new u.default).fromProof(e)})},c=function(){function e(){r(this,e)}return e.prototype.fromProofFinalDelivery=function(e){return(0,a.default)(this,f,e),this},e}();t.default=c},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=o(0),u=n(s),f=o(23),c=n(f),l=o(25),p=n(l),d=function(e){function t(o){r(this,t);var n=i(this,e.call(this,o));return n.files=new c.default(o),n}return a(t,e),t.prototype.add=function(e){var t=e.proofId,o=e.file,n=e.onProgress;return this.files.upload({name:o.name,contents:o,assignedTo:t,assignedType:p.default.FINAL_FILE,onProgress:n})},t.prototype.remove=function(e,t){return this.client.request("proofs.final-delivery.files.delete",{proofId:e,fileId:t})},t.prototype.load=function(e){return this.client.request("proofs.final-delivery.get-files",{proofId:e})},t}(u.default);t.default=d},function(e,t,o){"use strict";function n(e){var t=new a.default,o=0,n=Promise.resolve(),i=t.size(e);return function(){var a=o++*r.BYTES_PER_BLOCK,s=a+r.BYTES_PER_BLOCK;return n=n.then(function(){return a>i?null:t.slice(e,a,s).then(t.readBase64).then(function(e){return"data:;base64,"+e})})}}t.__esModule=!0;var r=o(2),i=o(8),a=function(e){return e&&e.__esModule?e:{default:e}}(i);t.default=n},function(e,t,o){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e){for(var t=new ArrayBuffer(e.length),o=new Uint8Array(t),n=0;n<e.length;n++)o[n]=e.charCodeAt(n);return t}t.__esModule=!0;var i=function(){function e(){n(this,e)}return e.prototype.create=function(e){return Promise.resolve(new Blob([r(e)]))},e.prototype.createBase64=function(e){return this.create(atob(e))},e.prototype.combine=function(){for(var e=arguments.length,t=Array(e),o=0;o<e;o++)t[o]=arguments[o];return Promise.resolve(new Blob(t))},e.prototype.slice=function(e,t,o){return Promise.resolve(e.slice(t,o))},e.prototype.read=function(e){return new Promise(function(t,o){var n=new FileReader;n.onload=function(){t(n.result)},n.onerror=function(){o(n.error)},n.readAsText(e)})},e.prototype.readBase64=function(e){return new Promise(function(t,o){var n=new FileReader;n.onload=function(){var e=n.result;t(e.substring(e.indexOf(",")+1))},n.onerror=function(){o(n.error)},n.readAsDataURL(e)})},e.prototype.size=function(e){return e.size},e}();t.default=i},function(e,t,o){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var r=function(){function e(){n(this,e)}return e.prototype.create=function(e){return Promise.resolve(Buffer.from(e))},e.prototype.createBase64=function(e){return Promise.resolve(Buffer.from(e,"base64"))},e.prototype.combine=function(){for(var e=arguments.length,t=Array(e),o=0;o<e;o++)t[o]=arguments[o];return Promise.resolve(Buffer.concat(t))},e.prototype.slice=function(e,t,o){return Promise.resolve(e.slice(t,o))},e.prototype.read=function(e){return Promise.resolve(e.toString())},e.prototype.readBase64=function(e){return Promise.resolve(e.toString("base64"))},e.prototype.size=function(e){return Buffer.byteLength(e)},e}();t.default=r},function(e,t,o){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e){for(var t=e.length,o=e.length-1;o>=0;o--){var n=e.charCodeAt(o);n>127&&n<=2047?t++:n>2047&&n<=65535&&(t+=2),n>=56320&&n<=57343&&o--}return t}t.__esModule=!0;var i=o(63),a=function(){function e(){n(this,e)}return e.prototype.create=function(e){return Promise.resolve(e)},e.prototype.createBase64=function(e){return Promise.resolve((0,i.atob)(e))},e.prototype.combine=function(){for(var e=arguments.length,t=Array(e),o=0;o<e;o++)t[o]=arguments[o];return Promise.resolve(t.join(""))},e.prototype.slice=function(e,t,o){return Promise.resolve(e.slice(t,o))},e.prototype.read=function(e){return Promise.resolve(e)},e.prototype.readBase64=function(e){return Promise.resolve((0,i.btoa)(e))},e.prototype.size=function(e){return r(e)},e}();t.default=a},function(e,t,o){!function(){function e(e){this.message=e}var o=t,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";e.prototype=new Error,e.prototype.name="InvalidCharacterError",o.btoa||(o.btoa=function(t){for(var o,r,i=String(t),a=0,s=n,u="";i.charAt(0|a)||(s="=",a%1);u+=s.charAt(63&o>>8-a%1*8)){if((r=i.charCodeAt(a+=.75))>255)throw new e("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");o=o<<8|r}return u}),o.atob||(o.atob=function(t){var o=String(t).replace(/[=]+$/,"");if(o.length%4==1)throw new e("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,i,a=0,s=0,u="";i=o.charAt(s++);~i&&(r=a%4?64*r+i:i,a++%4)?u+=String.fromCharCode(255&r>>(-2*a&6)):0)i=n.indexOf(i);return u})}()},function(e,t,o){"use strict";function n(e){return"undefined"!=typeof Blob&&e instanceof Blob?e.size:0}t.__esModule=!0,t.default=n},function(e,t,o){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=o(0),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(e){function t(){return n(this,t),r(this,e.apply(this,arguments))}return i(t,e),t.prototype.add=function(e,t,o,n,r){var i=r.message;return this.client.request("proofs.final-delivery.notification.add",{proofId:e,type:t,users:o,files:n,message:i})},t.prototype.remove=function(e){return this.client.request("proofs.final-delivery.notification.delete",{notificationId:e})},t.prototype.get=function(e){return this.client.request("proofs.final-delivery.get-notification",{notificationId:e})},t.prototype.send=function(e){return this.client.request("proofs.final-delivery.notification.send",{notificationId:e})},t}(s.default);t.default=u},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=o(0),u=n(s),f=o(4),c=n(f),l=o(5),p=n(l),d=o(2),h=function(e){function t(){return r(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.setTags=function(e,t){return this.client.request("proofs.set-tags",{relatedId:e,tag:t.join(",")})},t.prototype.deleteTag=function(e,t){return this.client.request("proofs.tag-delete",{relatedId:e,tag:t})},t.prototype.setFile=function(e,t){var o=this;return this.client.request("proofs.set-file",{proofId:e,fileId:t}).then(function(){return o.client.request("proofs.distribute-file",{proofId:e})})},t.prototype.create=function(e){var t=this,o=e.name,n=e.file,r=e.tags,i=void 0===r?[]:r,a=e.dueDate,s=void 0===a?new Date(Date.now()+3*d.DAY_IN_MS):a;return this.client.request("briefs.create",{title:o,messageToRecipient:"",dueDate:s.toISOString(),tag:i.join(",")}).then(function(e){var o=(new c.default).fromProof(e.data.Brief);return Promise.all([o,n&&t.setFile(o.id,n.id)])}).then(function(e){var t=e[0];return n&&(t.fileId=n.id,t.fileStatus=p.default.UPLOADING),t.calculateState(),t})},t.prototype.update=function(e){var t=this,o=e.briefId,n=e.data,r=e.start,i=void 0!==r&&r;return this.client.request("briefs.update",{briefId:o,title:n.title,messageToRecipient:n.messageToRecipient,dueDate:n.dueDate?n.dueDate.toISOString():"",tag:n.tags?n.tags.join(","):"",recipient:n.recipient,editorId:n.editorId,editorMessage:n.editorMessage}).then(function(e){return(new c.default).fromProof(e.data.Brief)}).then(function(e){return Promise.resolve(i&&t.start(e.id)).then(function(){return e})})},t.prototype.delete=function(e){return this.client.request("proofs.delete",{proofId:e})},t.prototype.start=function(e){return this.client.request("briefs.start",{briefId:e})},t}(u.default);t.default=h},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=o(0),u=n(s),f=o(68),c=n(f),l=function(e){function t(o){r(this,t);var n=i(this,e.call(this,o));return n.team=new c.default(o),n}return a(t,e),t}(u.default);t.default=l},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=o(0),u=n(s),f=o(69),c=n(f),l=function(e){function t(o){r(this,t);var n=i(this,e.call(this,o));return n.users=new c.default(o),n}return a(t,e),t}(u.default);t.default=l},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){return e.data.map(function(e){return(new l.default).fromUser(e)})}t.__esModule=!0;var u=o(0),f=n(u),c=o(3),l=n(c),p=function(e){function t(){return r(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.enabled=function(){return this.client.request("admin.team.users.enabled").then(s)},t.prototype.disabled=function(){return this.client.request("admin.team.users.disabled").then(s)},t.prototype._setEnabled=function(e,t){return this.client.request("admin.team.users.set-enabled",{email:e,enabled:t})},t.prototype.enable=function(e){return this._setEnabled(e,!0)},t.prototype.disable=function(e){return this._setEnabled(e,!1)},t}(f.default);t.default=p},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){return e&&((0,w.isUserId)(e.id)||e.email)}function u(e){return(e||[]).map(function(e){return(new p.default).fromWorkflow(e)})}t.__esModule=!0;var f=o(0),c=n(f),l=o(26),p=n(l),d=o(13),h=n(d),y=o(14),m=n(y),w=o(20),v=o(71),_=n(v),b=function(e){function t(o){r(this,t);var n=i(this,e.call(this,o));return n.steps=new _.default(o),n}return a(t,e),t.prototype.create=function(e){var t=this,o=e.save,n=void 0!==o&&o,r=e.name,i=e.steps,a=void 0===i?[]:i,u=e.reviewers,f=e.approver;if(!s(f))return Promise.reject(Error("An approver is required to create a workflow."));if(n&&!r)return Promise.reject(Error("A workflow must have a name when saving it as a workflow template."));var c=a;u&&u.length&&c.splice(0,0,{users:u}),f&&c.push({position:1e3,users:[f]});for(var l=0,p=0;p<c.length;p++){var d=c[p];if(!d.users||!d.users.length)return Promise.reject(Error("Workflow steps must contain users."));(!d.position||d.position<l)&&(d.position=l+1),l=Math.max(l,d.position);for(var h=0;h<d.users.length;h++){if(!s(d.users[h]))return Promise.reject(Error("A user id or email address must be provided for a workflow user."))}}var y=void 0;return this._createWorkflow(r).then(function(e){return y=e.id,Promise.all([e,Promise.all(c.map(function(o){var n=e.getStepByPosition(o.position);return n?t._setWorkflowStepUsersMutate(e.id,n,o.users):t._addWorkflowStepAndUsers(e.id,o)}))])}).then(function(e){var t=e[0],o=e[1];return t.steps=o,t}).then(function(e){return n?t._duplicateWorkflow(y):e}).catch(function(e){return Promise.resolve(y&&t._deleteWorkflow(y)).then(function(){return Promise.reject(e)})})},t.prototype.load=function(e){return this.client.request("workflows.load",{workflowId:e}).then(function(e){return(new p.default).fromWorkflow(e.data)})},t.prototype.use=function(e){return this.duplicate(e)},t.prototype.duplicate=function(e){return this._duplicateWorkflow(e)},t.prototype.delete=function(e){return this._deleteWorkflow(e)},t.prototype.all=function(){return Promise.all([this.owned(),this.shared()]).then(function(e){return[].concat(e[0],e[1])})},t.prototype.owned=function(){return this.client.request("workflows.owned").then(function(e){return u(e.data)})},t.prototype.shared=function(){return this.client.request("workflows.shared").then(function(e){return u(e.data)})},t.prototype.setApprover=function(e,t){return this.client.request("workflows.users.set",{workflowId:e,position:1e3,users:[t]})},t.prototype._duplicateWorkflow=function(e){var t=this;return this.client.request("workflows.duplicate",{workflowId:e}).then(function(e){var o=e.data.WorkflowId;return t.load(o)})},t.prototype._deleteWorkflow=function(e){return this.client.request("workflows.delete",{workflowId:e})},t.prototype._createWorkflow=function(e){return this.client.request("workflows.create",{title:e}).then(function(e){return(new p.default).fromWorkflow(e.data)})},t.prototype._addWorkflowStepAndUsers=function(e,t){var o=this;return this.client.request("workflows.steps.add",{workflowId:e,title:t.name,position:t.position}).then(function(n){var r=(new h.default).fromWorkflowStep(n.data);return o._setWorkflowStepUsersMutate(e,r,t.users)})},t.prototype._setWorkflowStepUsersMutate=function(e,t,o){return this.client.request("workflows.users.set",{workflowId:e,stepId:t.id,users:o.map(function(e){return{email:e.email,userId:e.id,role:e.role,permissions:e.permissions&&{inviter:!!e.permissions.inviter}}})}).then(function(e){var o=e.data.map(function(e){return(new m.default).fromWorkflowUser(e)});return t.users=o,t})},t}(c.default);t.default=b},function(e,t,o){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=o(0),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(e){function t(){return n(this,t),r(this,e.apply(this,arguments))}return i(t,e),t.prototype.moveBefore=function(e,t){return this.client.request("workflows.steps.move-before",{stepId:e,beforeStepId:t})},t.prototype.moveAfter=function(e,t){return this.client.request("workflows.steps.move-after",{stepId:e,afterStepId:t})},t.prototype.swap=function(e,t){return this.client.request("workflows.steps.swap",{stepId:e,swapStepId:t})},t}(s.default);t.default=u},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){return(new p.default).fromPreference(e)}function u(e,t){var o=new Array(e.length);return t.forEach(function(t){o[e.indexOf(t.name)]=t}),o}t.__esModule=!0;var f=o(0),c=n(f),l=o(73),p=n(l),d=function(e){function t(){return r(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.all=function(){return this.client.request("preferences.all")},t.prototype.get=function(e){var t=[].concat(e);return this.client.request("preferences.get",{preferences:t}).then(function(e){return e.data.map(s)}).then(function(o){return"string"==typeof e?o[0]:u(t,o)})},t.prototype.update=function(e,t){var o,n=void 0!==t?(o={},o[e]=t,o):e;return this.client.request("preferences.update",n)},t.prototype.reset=function(e){return this.client.request("preferences.reset",{preferences:[].concat(e)})},t}(c.default);t.default=d},function(e,t,o){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var r=o(1),i=function(e){return e&&e.__esModule?e:{default:e}}(r),a={name:"Name",defaultValue:"DefaultValue",value:"Value"},s=function(){function e(){n(this,e)}return e.prototype.getValueOrDefault=function(){return null===this.value?this.defaultValue:this.value},e.prototype.fromPreference=function(e){return(0,i.default)(this,a,e),this},e}();t.default=s},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){var t=[];return Object.keys(e).forEach(function(o){e[o].Comments.forEach(function(e){t.push(e)})}),t}function u(e){var t=[],o=[];e.forEach(function(e){var n=(new p.default).fromComment(e);n.parentCommentId?o.push(n):t.push(n)}),t.sort(P);var n=t.map(function(e){return e.id}),r=(0,m.sortObjectsBy)(function(e){return n.indexOf(e.parentCommentId)},!0);return o.sort((0,m.combineSort)(I,r)),t.concat(o)}t.__esModule=!0;var f=o(0),c=n(f),l=o(29),p=n(l),d=o(15),h=n(d),y=o(2),m=o(22),w=o(31),v=o(76),_=o(77),b=n(_),E=(0,m.sortObjectsByKey)("pageNumber"),g=(0,m.sortObjectsByKey)("createdDate",!0),O=(0,m.sortObjectsByKey)("createdDate",!1),P=(0,m.combineSort)(E,g),I=(0,m.combineSort)(E,O),T=function(e){function t(){return r(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype._mark=function(e,t,o){var n,r=void 0;switch(t){case h.default.TODO:r="change";break;case h.default.DONE:r="done";break;default:throw new Error('Cannot mark comment state "'+t+'".')}var i=(n={commentId:e},n[r]=o?1:0,n);return this.client.request("comments.state.update",i).then(function(){return null})},t.prototype.mark=function(e,t){return this._mark(e,t,!0)},t.prototype.unmark=function(e,t){return this._mark(e,t,!1)},t.prototype.load=function(e){var t=this,o="string"==typeof e?{proofId:e}:e,n=o.proofId,r=o.pageNumber,i=void 0===r?null:r,a=o.sinceDate,f=void 0===a?null:a,c=o.async,l=void 0!==c&&c,p=o.decrypt,d=void 0===p||p,h=o.onDecryptComment,m=o.onDecryptComments,w=o.onDecryptCommentsThrottleMs,v=void 0===w?1e3:w,_=o.onDecryptError,E=f?f.toISOString().match(y.ISO_REGEX)[0]:y.DEFAULT_ISO_DATE,g={proofId:n,page:i,timestamp:E};return this.client.request(null!==i?"comments.load-page":"comments.load-all",g).then(function(e){var o=u(e.data.Pages?s(e.data.Pages):e.data),n=Promise.resolve();if(d){var r=[],i=[],a=m?(0,b.default)(function(){i.length&&(m(i),i=[])},v):function(){},f=Promise.all(o.map(function(e){return t.client.cache.auto(y.COMMENT_CACHE_PREFIX+e.comment$,function(t){r.push({comment:e,resolve:t})}).then(function(t){return t&&e.fromRawComment(t),e})}));n=n.then(function(){return f}),n=n.then(function(){var e=r.map(function(e){var o=e.comment,n=e.resolve;return t.client.crypto().decryptComment(o.comment$,o.envelope,t.client.session.privateKeyPEM).then(function(e){o.fromRawComment(e),n(e),h&&h(o),i.push(o),a()}).catch(function(e){if(_&&_(e,o),!l)return Promise.reject(e)})});return l?null:Promise.all(e)})}return n.then(function(){return o})})},t.prototype.create=function(e){var t=this,o=e.raw,n=e.proofId,r=e.pageNumber,i=void 0===r?1:r,a=e.pin,s=e.mediaTime,u=e.mediaDuration,f=e.parentCommentId,c=e.metadata,l=e.state,d=e.creationToken,y=(0,w.getCommentMentions)(o),m=d||(0,v.generateCreationToken)();return this.client.crypto().encryptComment(o,[this.client.session.serverPublicKeyPEM,this.client.session.publicKeyPEM]).then(function(e){var t=e.envelope,o=e.comment$;return{proofId:n,page:f?void 0:i,envelope:t,encryptedComment:o,xy:JSON.stringify({x:a&&"number"==typeof a.x?a.x:null,y:a&&"number"==typeof a.y?a.y:null,x2:a&&"number"==typeof a.x2?a.x2:null,y2:a&&"number"==typeof a.y2?a.y2:null,time:"number"==typeof s?s:null,duration:"number"==typeof u?u:null}),parent:f||void 0,mentions:y.map(function(e){return e.id}).join(","),metadata:c?JSON.stringify(c):"{}",creationToken:m,change:l===h.default.TODO?"1":void 0,done:l===h.default.DONE?"1":void 0}}).then(function(e){return t.client.request("comments.create",e).then(function(e){return(new p.default).fromComment(e.data).fromRawComment(o)})}).catch(function(e){return e&&(e.creationToken=m),Promise.reject(e)})},t}(c.default);t.default=T},function(e,t,o){"use strict";function n(e){var t=""+e,o=r.exec(t);if(!o)return t;var n,i="",a=0,s=0;for(a=o.index;a<t.length;a++){switch(t.charCodeAt(a)){case 34:n=""";break;case 38:n="&";break;case 39:n="'";break;case 60:n="<";break;case 62:n=">";break;default:continue}s!==a&&(i+=t.substring(s,a)),s=a+1,i+=n}return s!==a?i+t.substring(s,a):i}/*!
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.PageProof=t():e.PageProof=t()}(this,function(){return function(e){function t(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=32)}([function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var r=function e(t){o(this,e),this.client=t};t.default=r},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t,n){var o=[],r={};return Array.isArray(t)?(o=t,t.forEach(function(e){r[e]=e})):(0,y.default)(t)&&(o=Object.keys(t),r=t),o.forEach(function(t){var o=r[t],i=void 0;if("string"==typeof o)i=-1!==o.indexOf(".")?function(){for(var e=o.split("."),t=n,r=0;r<e.length;r++){var i=e[r];if(!(0,w.default)(t,i)){t=void 0;break}t=t[i]}return t}:function(){return n[o]};else{if("function"!=typeof o){if(null===o)return;throw new Error("Unknown transformer.")}i=o}var a=i.call(e,n);void 0!==a&&(e[t]=a)}),e}function i(e){return function(t){return Number(t[e])}}function a(e,t){return function(n){return t[n[e]]}}function s(e){return function(t){var n=t[e];if(n&&"0001-01-01T00:00:00"!==n)return"number"==typeof n?new Date(1e3*n):new Date(n+"Z")}}function u(e){return function(t){var n=String(t[e]);return"1"===n||"true"===n}}function f(e){return function(t){return w.default.call(t,e)}}function c(e,t){return function(n){return n[e]?n[e].map(t):[]}}function l(e,t){return function(n){return n[e]?JSON.parse(n[e]):Array.isArray(t)?[].concat(t):d({},t)}}function p(e){return function(t){return t[e]?t[e]:void 0}}t.__esModule=!0;var d=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e};t.number=i,t.enumeration=a,t.date=s,t.truthy=u,t.exists=f,t.each=c,t.json=l,t.optional=p;var h=n(16),y=o(h),m=n(10),w=o(m);t.default=r},function(e,t,n){"use strict";t.__esModule=!0;t.TOKEN_HEADER="x-authorization-token",t.HMAC_HEADER="x-authorization-hmac",t.TIMESTAMP_HEADER="x-timestamp",t.DEVICE_ID_HEADER="x-device-id",t.SUBSCRIPTION_KEY_HEADER="ocp-apim-subscription-key",t.SDK_VERSION_HEADER="x-pageproof-javascript-sdk",t.RETRY_AFTER_HEADER="retry-after",t.BYTES_PER_BLOCK=2097152,t.MENTION_REGEX=/@{(U[a-zA-Z0-9]{15}|~everyone)}{(.*?)}/g,t.ISO_REGEX=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/,t.DEFAULT_ISO_DATE="0001-01-01T00:00:00",t.DAY_IN_MS=864e5,t.COMMENT_CACHE_PREFIX="comment",t.THUMBNAIL_CACHE_PREFIX="thumbnail"},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var r=n(1),i=function(e){return e&&e.__esModule?e:{default:e}}(r),a={id:"UserId",name:"Name",email:"Email",hasActivated:"Activated",hasRegistered:"IsRegistered",hasAvatar:"HasAvatar",accountType:"AccountType",teamType:"TeamType",teamLogo:"Branding.LogoURL",registeredDate:(0,r.date)("Registered"),lastLoginDate:(0,r.date)("LastLogin"),lastUploadDate:(0,r.date)("LastUpload"),isAdmin:"IsDomainAdmin"},s=function(){function e(){o(this,e)}return e.prototype.fromJSON=function(e){return(0,i.default)(this,Object.keys(a),e),this},e.prototype.fromUser=function(e){return(0,i.default)(this,a,e),this},e}();t.default=s},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(){return this.dueDate&&this.dueDate.getTime()<Date.now()}t.__esModule=!0;var a=n(1),s=o(a),u=n(18),f=o(u),c=n(19),l=o(c),p=n(5),d=o(p),h=n(20),y={id:"ProofId",name:"Title",status:"Status",workflowId:"WorkflowId",version:"Version",dueDate:(0,a.date)("DueDate"),createdDate:(0,a.date)("CreatedDate"),approvedDate:(0,a.date)("ApprovedDate"),isLocked:"Locked",isArchived:"Closed",isOverdue:i,uploaderUserId:"UserId",ownerUserIds:"OwnerIds",editorUserId:"EditorId",editorUserIds:"EditorIds",lockerUserId:"ProofLockerId",messageToReviewers:"Description",messageToOwners:"OwnerMessage",messageToEditor:"EditorMessage",fileId:"FileId",fileExtension:"Extension",fileStatus:"FileStatus",fileMessage:"FileStatusMessage",pageCount:(0,a.number)("Pages"),commentCount:(0,a.number)("ParentComments"),canDownload:(0,a.truthy)("DownloadOriginal"),type:"Type",processStatus:"ProcessStatus",recipient:"Recipient",todoCommentCount:(0,a.number)("CountTodoComments"),doneCommentCount:(0,a.number)("CountDoneComments")},m=function(){function e(){r(this,e)}return e.prototype.getState=function(){var e=f.default.ACTIVE;return this.fileStatus===d.default.UPLOADING?e=f.default.UPLOADING:this.hasFileError()?e=f.default.FILE_ERROR:this.isProcessing()?e=f.default.PROCESSING:this.status===l.default.ARCHIVED?e=f.default.ARCHIVED:this.hasWorkflow()?this.status===l.default.TODOS_REQUESTED?e=f.default.TODOS_REQUESTED:this.status===l.default.AWAITING_NEW_VERSION?e=f.default.AWAITING_NEW_VERSION:this.status===l.default.APPROVED?e=f.default.APPROVED:this.hasWorkflowStarted()?this.isOverdue&&(e=f.default.OVERDUE):e=f.default.NOT_STARTED:e=f.default.PROOFERS_NEEDED,e},e.prototype.hasWorkflowStarted=function(){return this.hasWorkflow()&&this.status!==l.default.NEW},e.prototype.isProcessing=function(){return this.fileStatus===d.default.UPLOADING||this.fileStatus===d.default.QUEUED||this.fileStatus===d.default.RIPPING},e.prototype.getProcessingProgress=function(){switch(this.fileStatus){case d.default.UPLOADING:return.1;case d.default.QUEUED:return.2;case d.default.RIPPING:return.6;default:return-1}},e.prototype.hasWorkflow=function(){return(0,h.isWorkflowId)(this.workflowId)},e.prototype.hasFile=function(){return(0,h.isFileId)(this.fileId)},e.prototype.hasFileError=function(){return this.fileStatus===d.default.ERROR||!this.fileStatus||!this.hasFile()},e.prototype.hasEditor=function(){return(0,h.isUserId)(this.editorUserId)},e.prototype.hasThumbnail=function(){return this.fileStatus===d.default.OK},e.prototype.canUserUploadNewVersion=function(e){return this.getState()===f.default.AWAITING_NEW_VERSION&&(this.editorUserId===e||this.isOwner(e))},e.prototype.isOwner=function(e){return-1!==this.ownerUserIds.indexOf(e)},e.prototype.calculateState=function(){this.state=this.getState()},e.prototype.fromProof=function(e){return(0,s.default)(this,y,e),this.calculateState(),this},e}();t.default=m},function(e,t,n){"use strict";t.__esModule=!0;var o={OK:"OK",UPLOADING:"Uploading",QUEUED:"Queued",RIPPING:"Ripping",ERROR:"Error"};t.default=o},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=n(1),a=o(i),s=n(3),u=o(s),f={userId:"UserId",token:"Token",sharedKey:"SharedKey",privateKeyPEM$:"PrivateKey",privateKeyPEM:null,publicKeyPEM:"PublicKey",serverPublicKeyPEM:"PublicServerKey"},c=function(){function e(){r(this,e)}return e.prototype.fromJSON=function(e){return(0,a.default)(this,Object.keys(f),e),this.user=(new u.default).fromJSON(e.user),this},e.prototype.fromSession=function(e){return(0,a.default)(this,f,e),this.user=(new u.default).fromUser(e),this},e}();t.default=c},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var r=n(1),i=function(e){return e&&e.__esModule?e:{default:e}}(r),a={id:"FileId",name:"Name",blocks:"Chunks",downloadable:"Downloadable",assignedTo:"AssignedTo",assignedType:"AssignedType",status:"Status",message:"Message"},s={id:"Attachment",name:"AttachmentName",blocks:"AttachmentChunks",assignedTo:"CommentId",assignedType:function(){return"attachment"},status:"AttachmentStatus",message:function(){return""}},u=function(){function e(){o(this,e)}return e.prototype.fromFile=function(e){return(0,i.default)(this,a,e),this},e.prototype.fromCommentAttachment=function(e){return(0,i.default)(this,s,e),this},e}();t.default=u},function(e,t,n){"use strict";function o(){if("function"==typeof o.driver){return new(0,o.driver)}if("string"==typeof o.driver){var e=void 0;switch(o.driver){case"Blob":e=n(61).default;break;case"Buffer":e=n(62).default;break;case"String":e=n(63).default;break;default:throw new Error('Unknown Bluffer driver "'+o.driver+'".')}if(e)return new e;throw new Error('Bluffer driver "'+o.driver+'" not found.')}throw new Error('Bluffer.driver must be either "Blob", "Bluffer", or "String" or a custom constructor.')}t.__esModule=!0;var r=n(12)("bluffer");o.driver="String","undefined"!=typeof Blob?o.driver="Blob":(r("The current JavaScript environment does not support native Bluffer, falling back to using StringBluffer."),o.driver="String"),t.default=o},function(e,t,n){"use strict";t.__esModule=!0;var o={ERROR_CRITICAL:3,OK:200,ERROR_INVALID:201,ERROR_NO_ACCESS:100,ERROR_NO_ACCESS_WRITE:101,ERROR_RESTRICTED:102,ERROR_SQL_ERROR:105,ERROR_OUT_SYNC:106,ERROR_STORAGE_ERROR:110,ERROR_QUEUE_ERROR:111,ERROR_SQL_DEADLOCK_ERROR:121,ERROR_BAD_REQUEST:400,ERROR_UNAUTHORISED:401,ERROR_MEDIA_PERMISSION_NO_ACCESS:402,ERROR_NOT_FOUND:1e3,ERROR_CREATE:1001,ERROR_UPDATE:1002,ERROR_DELETE:1003,ERROR_EXISTS:1004,ERROR_USER_INVALID_LOGIN:1010,ERROR_USER_INVALID_PASSWORD:1011,ERROR_USER_IS_REGISTERED:1012,ERROR_USER_INVALID_EMAIL:1013,ERROR_USER_INVALID_LOGIN_COUNT:1014,ERROR_USER_DISABLED:1015,ERROR_BAD_REQUEST_DATE:201,ERROR_THROTTLED:429,ERROR_REUSED_CREATION_TOKEN:2011,ERROR_UPGRADE_REQUIRED:3e3,ERROR_VISIBLE_WORKFLOW_USERS_EXIST:3001,ERROR_GROUP_EXISTS:3002,ERROR_GROUP_PROOFS_EXIST:3003};t.default=o},function(e,t,n){"use strict";t.__esModule=!0,t.default=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=n(1),a=o(i),s=n(4),u=o(s),f={id:"GroupId",name:"Name",proofs:(0,i.each)("ProofInfo",function(e){return(new u.default).fromProof(e)})},c=function(){function e(){r(this,e)}return e.prototype.fromProofGroup=function(e){return(0,a.default)(this,f,e),this},e}();t.default=c},function(e,t,n){"use strict";e.exports=function e(){return e}},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=n(1),a=o(i),s=n(14),u=o(s),f=n(28),c=o(f),l={id:"StepId",name:"Title",position:(0,i.number)("Position"),state:function(e){return e.Complete?c.default.COMPLETE:e.Visible?c.default.VISIBLE:c.default.NOT_VISIBLE},users:(0,i.each)("Users",function(e,t){var n=(new u.default).fromWorkflowUser(e);return n._calculateState(e,t),n})},p=function(){function e(){r(this,e)}return e.prototype.fromWorkflowStep=function(e){return(0,a.default)(this,l,e),this},e}();t.default=p},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=n(1),u=o(s),f=n(3),c=o(f),l=n(27),p=o(l),d={id:"UserId",name:"Name",email:"Email",role:"Role",permissions:function(e){return{inviter:e.IsInviter}}},h=function(e){function t(){return r(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype._calculateState=function(e,t){e.SkippedInStep?this.state=p.default.SKIPPED:e.CompleteInStep?this.state=p.default.FINISHED:e.ViewedInStep?this.state=p.default.SEEN:t.Visible?this.state=p.default.VISIBLE:this.state=p.default.NOT_VISIBLE},t.prototype.fromWorkflowUser=function(e){return this._calculateState({},{}),(0,u.default)(this,d,e),this},t}(c.default);t.default=h},function(e,t,n){"use strict";t.__esModule=!0;var o={COMMENT:"comment",TODO:"todo",DONE:"done"};t.default=o},function(e,t,n){"use strict";t.__esModule=!0;var o=Object.prototype.toString;t.default=function(e){return"[object Object]"===o.call(e)}},function(e,t,n){"use strict";t.__esModule=!0;var o=void 0;o="108.0.1537745921075",t.default=o},function(e,t,n){"use strict";t.__esModule=!0;var o={UPLOADING:"uploading",FILE_ERROR:"file-error",PROCESSING:"processing",ARCHIVED:"archived",PROOFERS_NEEDED:"proofers-needed",TODOS_REQUESTED:"todos-requested",AWAITING_NEW_VERSION:"awaiting-new-version",APPROVED:"approved",NOT_STARTED:"not-started",OVERDUE:"overdue",ACTIVE:"active"};t.default=o},function(e,t,n){"use strict";t.__esModule=!0;var o={NEW:0,PROOFING:10,FINAL_APPROVING:30,TODOS_REQUESTED:50,AWAITING_NEW_VERSION:60,APPROVED:70,ARCHIVED:100};t.default=o},function(e,t,n){"use strict";var o={Proof:"P",Workflow:"W",File:"F",User:"U",Brief:"B"},r={};Object.keys(o).forEach(function(e){r["is"+e+"Id"]=function(t){return t&&16===t.length&&t[0]===o[e]}}),e.exports=r},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var r=n(1),i=function(e){return e&&e.__esModule?e:{default:e}}(r),a={id:"ProofId",version:"Version"},s=function(){function e(){o(this,e)}return e.prototype.fromProofVersion=function(e){return(0,i.default)(this,a,e),this},e}();t.default=s},function(e,t,n){"use strict";function o(e,t){return r(function(t){return t[e]},t)}function r(e,t){var n=t?1:-1,o=t?-1:1;return function(t,r){var i=e(t),a=e(r);return i<a?n:i>a?o:0}}function i(e,t){var n={};t.forEach(function(e,t){n[e]=t});var o="function"==typeof e?e:function(t){return t[e]};return function(e,t){var r=n[o(e)],i=n[o(t)];return r<i?-1:r>i?1:0}}function a(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];var o=t.length;return function(e,n){for(var r=0;r<o;r++){var i=t[r](e,n);if(i)return i}return 0}}t.__esModule=!0,t.sortObjectsByKey=o,t.sortObjectsBy=r,t.sortObjectsByValues=i,t.combineSort=a},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){var t=e.lastIndexOf(".");return{name:e.substring(0,t),extension:e.substring(t+1)}}t.__esModule=!0;var u=n(0),f=o(u),c=n(7),l=o(c),p=n(5),d=o(p),h=n(24),y=o(h),m=n(60),w=o(m),v=n(8),_=o(v),b=n(65),E=o(b),g=n(2),O=function(e){function t(){return r(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.generateToken=function(e,t){return e&&!t?Promise.reject(Error('The "assignedType" option is required when specifying the "assignedTo" option.')):!e&&t?Promise.reject(Error('The "assignedTo" option is required when specifying the "assignedType" option.')):this.client.request("files.generate-token",{relatedId:e,fileType:t}).then(function(e){return e.data.Token})},t.prototype._waitFileProcessed=function(e){var t=this;return new Promise(function(n,o){var r=null,i=null;!function a(){t.details(e).then(function(t){switch(r=null,t.status){case d.default.OK:n(t);break;case d.default.ERROR:o(new Error("File "+e+" encountered a processing error: "+t.message));break;default:r=setTimeout(a,5e3)}r&&t.status!==d.default.RIPPING||clearTimeout(i)}).catch(o)}(),i=setTimeout(function(){clearTimeout(r),o(new Error("File did not finish processing within specified duration."))},3e4)})},t.prototype.import=function(e){var t=this,n=e.name,o=e.url,r=e.provider,i=void 0===r?y.default.NONE:r,a=e.auth,u=e.download,f=void 0!==u&&u,c=e.process,p=void 0!==c&&c;if(!Object.keys(y.default).some(function(e){return y.default[e]===i}))return Promise.reject(new Error('Unsupported provider "'+i+'"'));var d=i;i===y.default.NONE&&(d="generic");var h=s(n),m=h.name,w=h.extension;return this._generateKeyIVEnvelope().then(function(e){var n=e.envelope;return t.client.request("files.import."+d,{extn:w,filename:m,url:o,envelope:n,accessToken:a,storeOriginal:f})}).then(function(e){return e.data}).then(function(e){if(p)return t._waitFileProcessed(e);var n=new l.default;return n.id=e,n})},t.prototype._generateKeyIVEnvelope=function(){var e=this;return this.client.crypto().generateKeyIV().then(function(t){return Promise.all([t,e.client.crypto().envelopeSeal(t.keyIV,[e.client.session.serverPublicKeyPEM,e.client.session.publicKeyPEM])])}).then(function(e){return{keyIV:e[0],envelope:e[1]}})},t.prototype.upload=function(e){var t=this,n=e.name,o=e.contents,r=e.assignedTo,i=e.assignedType,a=e.download,s=void 0!==a&&a,u=e.async,f=void 0===u||u,c=e.onProgress,p=e.onError;return this.generateToken(r,i).then(function(e){return Promise.all([e,t._generateKeyIVEnvelope()])}).then(function(e){var r=e[0],i=e[1],a=i.keyIV,u=i.envelope,l=t._upload({name:n,contents:o,download:s,token:r,keyIV:a,envelope:u,onProgress:c,onError:p});return f&&(l=Promise.resolve()),l.then(function(){return r})}).then(function(e){var t=new l.default;return t.id=e,t})},t.prototype._upload=function(e){var t=this,n=e.name,o=e.contents,r=e.download,i=e.token,a=e.keyIV,u=e.envelope,f=e.onProgress;return new Promise(function(e){function c(){y().then(function(t){if(!_)if(null===t)_=!0,e(m.then(T));else{var n=I(t,v++);m=m.then(function(){return n}),n.then(c)}})}var l=4,p=s(n),d=p.name,h=p.extension,y=(0,w.default)(o),m=Promise.resolve(),v=0,_=!1,b=Math.ceil((0,E.default)(o)/g.BYTES_PER_BLOCK),O=new Array(b),P=function(){};f&&(P=function(e,t){O[e]=Math.max(t,O[e]||0),f(O.reduce(function(e,t){return e+(t||0)},0)/b*.99)});for(var I=function(e,n){return t.client.crypto().encryptFileBlock(a,e).then(function(e){return t.client.request("files.upload-block",{block:n,part:1,token:i,data:e},{onUploadProgress:P.bind(null,n)})})},T=function(){return t.client.request("files.upload-complete",{block:0,blockCount:v,part:0,token:i,extn:h,pages:1,filename:d,storeoriginal:r?1:0,envelope:u}).then(function(){return f&&f(100)})};l--;)c()})},t.prototype.download=function(e){var t=this,n="string"==typeof e?{fileId:e}:e,o=n.fileId,r=n.onFileDetails;return this.details(o).then(function(e){if(!e.downloadable)throw new Error("File "+o+" is not downloadable.");if(e.status!==d.default.OK)throw new Error("File "+o+" cannot be download. The file may still be uploading, processing or has errored.");if(!e.blocks)throw new Error("File "+o+" is empty.");return r&&r(e),t._downloadFile(e,n)})},t.prototype._downloadFile=function(e,t){var n=this;return new Promise(function(o){function r(){if(!y)if(h<u.length){var e=h++,t=d(e);f=f.then(function(){return t.then(function(t){return c(t,e,s)})}),t.then(r)}else y=!0,o(f.then(m))}var i=4,a=new _.default,s=e.blocks,u=new Array(s),f=Promise.resolve(),c=t.onData||function(e,t){u[t]=e},l=function(){};if(t.onProgress){var p=new Array(s);l=function(e,n){p[e]=Math.max(n,p[e]||0),t.onProgress(p.reduce(function(e,t){return e+(t||0)},0)/s*.99)}}for(var d=function(t){return n.client.request("files.download-block",{proofId:e.assignedTo,fileId:e.id,block:t+1},{onDownloadProgress:l.bind(null,t)}).then(function(e){return n.client.crypto().decryptFileBlock(e.data,n.client.session.privateKeyPEM).then(function(e){return a.createBase64(e)})})},h=0,y=!1,m=function(){return t.onProgress&&t.onProgress(100),t.onData?null:a.combine.apply(a,u)};i--;)r()})},t.prototype.details=function(e){return this.client.request("files.details",{fileId:e}).then(function(e){return(new l.default).fromFile(e.data)})},t.prototype.thumbnail=function(e){var t=this;return this.client.cache.auto(g.THUMBNAIL_CACHE_PREFIX+e,function(){return t._thumbnail(e)})},t.prototype._thumbnail=function(e){var t=this;return this.client.request("files.thumbnail",{fileId:e}).then(function(e){return t.client.crypto().decryptImage(e.data,t.client.session.privateKeyPEM)}).then(function(e){return(new _.default).createBase64(e)})},t.prototype.thumbnails=function(e,t){var n=this,o=t.async,r=void 0!==o&&o,i=t.onLoadThumbnails,a=[];return Promise.all(e.map(function(e){return n.client.cache.auto(g.THUMBNAIL_CACHE_PREFIX+e,function(t){a.push({fileId:e,resolve:t})}).then(function(t){var n;return t&&(n={},n[e]=t,n)})})).then(function(e){var t=Promise.all(a.map(function(e){var t=e.fileId,o=e.resolve;return n._thumbnail(t).then(function(e){if(o(e),r){var n;i((n={},n[t]=e,n))}return e})}));return r?e:t.then(function(t){return[].concat(e,t)})}).then(function(e){return Object.assign.apply(Object,[{}].concat(e))})},t}(f.default);t.default=O},function(e,t,n){"use strict";t.__esModule=!0;var o={NONE:"none",GOOGLE_DRIVE:"drive",DROPBOX:"dropbox",ONEDRIVE:"onedrive",BOX:"box"};t.default=o},function(e,t,n){"use strict";t.__esModule=!0;var o={PROOF:"proof",ATTACHMENT:"attachment",SNAPSHOT:"snapshot",FINAL_FILE:"final-file"};t.default=o},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=n(1),a=o(i),s=n(13),u=o(s),f={id:"WorkflowId",name:"Title",steps:(0,i.each)("WorkflowSteps",function(e){return(new u.default).fromWorkflowStep(e)})},c=function(){function e(){r(this,e)}return e.prototype.getStepByPosition=function(e){for(var t=this.steps.length,n=0;n<t;n+=1){var o=this.steps[n];if(o.position===e)return o}return null},e.prototype.getOrderedSteps=function(){return this.steps.sort(function(e,t){return e.position<t.position?-1:e.position>t.position?1:0})},e.prototype.getApproverStep=function(){return this.getStepByPosition(1e3)},e.prototype.fromWorkflow=function(e){return(0,a.default)(this,f,e),this},e}();t.default=c},function(e,t,n){"use strict";t.__esModule=!0;var o={NONE:null,NOT_VISIBLE:"not-visible",VISIBLE:"visible",SEEN:"seen",SKIPPED:"skipped",FINISHED:"finished"};t.default=o},function(e,t,n){"use strict";t.__esModule=!0;var o={NONE:null,NOT_VISIBLE:"not-visible",VISIBLE:"visible",COMPLETE:"complete"};t.default=o},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=n(1),a=o(i),s=n(3),u=o(s),f=n(30),c=o(f),l=n(7),p=o(l),d=n(15),h=o(d),y=n(31),m={__prepare:function(e){e._XY=c.default.parseValue(e.XY)},id:"CommentId",proofId:"ProofId",pin:function(e){return(new c.default).fromPin(e._XY)},user:function(e){return(new u.default).fromUser(e)},comment$:"EncryptedComment",envelope:"Envelope",attachments:function(e){return e.Attachment?[(new p.default).fromCommentAttachment(e)]:[]},agreeCount:function(e){return e.Agrees.length},pageNumber:(0,i.number)("Page"),mediaTime:function(e){return null==e._XY.time?void 0:e._XY.time},mediaDuration:function(e){return null==e._XY.duration?void 0:e._XY.duration},createdDate:(0,i.date)("Timestamp"),updatedDate:(0,i.date)("Updated"),parentCommentId:(0,i.optional)("Parent"),metadata:(0,i.json)("Metadata",{}),state:function(e){return+e.Done?h.default.DONE:+e.Change?h.default.TODO:h.default.COMMENT}},w=function(){function e(){r(this,e)}return e.prototype.fromComment=function(e){return(0,a.default)(this,m,e),this},e.prototype.fromRawComment=function(e){var t=(0,y.parseComment)(e);return this.raw=t.raw,this.text=t.text,this.html=t.html,this.tokens=t.tokens,this},e}();t.default=w},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},i=n(1),a=function(e){return e&&e.__esModule?e:{default:e}}(i),s={x:"x",y:"y",x2:(0,i.optional)("x2"),y2:(0,i.optional)("y2")},u=function(){function e(){o(this,e)}return e.prototype.fromPin=function(e){return(0,a.default)(this,s,e),this},e.parseValue=function(e){var t={x:null,y:null,x2:null,y2:null,time:null,duration:null};if("{"===e[0]){var n=JSON.parse(e);t=r({},t,n)}else if(-1!==e.indexOf(",")){var o=e.split(","),i=o[0],a=o[1];t.x=parseFloat(i),t.y=parseFloat(a)}return t},e}();t.default=u},function(e,t,n){"use strict";function o(e){return(0,c.default)(e)}function r(e){return e.replace(l.MENTION_REGEX,function(e,t,n){return n})}function i(e){var t=0;return e.replace(l.MENTION_REGEX,function(e,n,o,r){return'<span data-mention data-mention-index="'+t+++'" data-mention-user-id="'+n+'" data-mention-user-label="'+o.replace(/"/,'\\"')+'" data-mention-start-index="'+r+'" data-mention-end-index="'+(r+e.length)+'" data-mention-length="'+e.length+'">'+o+"</span>"})}function a(e){var t=[];return e.replace(l.MENTION_REGEX,function(e,n,o,r){t.push({id:n,label:o,index:r,length:e.length})}),t}function s(e){var t=a(e),n=[],o=0;t.forEach(function(t){var r=e.slice(o,t.index);o=t.index+t.length,r&&n.push({type:"text",value:r}),n.push({type:"mention",value:t})});var r=e.slice(o);return r&&n.push({type:"text",value:r}),n}function u(e){var t=o(e);return{raw:e,text:r(t),html:i(t),mentions:a(e),tokens:s(e)}}t.__esModule=!0,t.getCommentTokens=t.getCommentText=t.getCommentMentions=t.getCommentHTML=t.getCommentEscaped=t.parseComment=void 0;var f=n(76),c=function(e){return e&&e.__esModule?e:{default:e}}(f),l=n(2);t.parseComment=u,t.getCommentEscaped=o,t.getCommentHTML=i,t.getCommentMentions=a,t.getCommentText=r,t.getCommentTokens=s},function(e,t,n){"use strict";function o(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0,t.version=t.Model=t.Enum=t.Bluffer=t.Client=void 0;var i=n(33),a=r(i),s=n(8),u=r(s),f=n(83),c=o(f),l=n(86),p=o(l),d=n(17),h=r(d);t.default=a.default,t.Client=a.default,t.Bluffer=u.default,t.Enum=c,t.Model=p,t.version=h.default},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=n(34),a=o(i),s=n(39),u=o(s),f=n(40),c=o(f),l=n(42),p=o(l),d=n(44),h=o(d),y=n(46),m=o(y),w=n(48),v=o(w),_=n(49),b=o(_),E=n(67),g=o(E),O=n(23),P=o(O),I=n(68),T=o(I),S=n(71),R=o(S),k=n(73),M=o(k),A=n(75),C=o(A),j=n(79),D=o(j),q=n(80),N=o(q),x=n(6),U=o(x),B=n(81),G=o(B),L=n(9),F=o(L),K=n(82),W=o(K),V=n(12)("PageProof"),H=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};r(this,e),this.options=t,this.events=new G.default,this.adapters=new a.default(this.options.adapters),this.cache=new u.default(this),this.accounts=new h.default(this),this.comments=new C.default(this),this.dashboard=new m.default(this),this.files=new P.default(this),this.profile=new D.default(this),this.proofs=new b.default(this),this.briefs=new g.default(this),this.users=new v.default(this),this.workflows=new R.default(this),this.preferences=new M.default(this),this.sessions=new N.default(this),this._registerCoreHooks(),this._enhance()}return e.prototype._registerCoreHooks=function(){this.on("error.throttled",function(e){var t=e.data.response.data.timeout;return V("Sleeping "+t+"ms until rate limit resets"),(0,W.default)(t)})},e.prototype._enhance=function(){var e=this;this.adapters.getEnhancementAdapters().forEach(function(t){return t.onClientReady(e)})},e.prototype.setSession=function(e){return!e||e instanceof U.default?this.session=e||null:this.session=(new U.default).fromJSON(e),this.session},e.prototype.request=function(e,t,n){var o=this,r=new c.default(e,t),i=this.adapters.getRequestAdapter(),a=Promise.resolve();if(!r.endpoint.anonymous){if(!this.session)return Promise.reject(new Error("Cannot make call to endpoint ("+e+") when unauthorized."));a=this.adapters.getCryptoAdapter().generateAuthorizationHeaders(r.getMethod(),r.getPath(),this.session).then(function(e){return r.addHeaders(e)})}var s={request:r};return a.then(function(){var e=r.build();return o.events.emit("experimental.request.before",s,!0).then(function(){return e})}).then(function(e){return i.send(e,n)}).then(p.default.parse).then(function(r){if(s.response=r,o.events.emit("experimental.request.after",s),r.code===F.default.ERROR_THROTTLED){var i=o.events.emit("error.throttled",s);if(i.some(Boolean))return Promise.all(i).then(function(){return o.events.emit("experimental.request.retry",s),o.request(e,t,n)})}if(r.code===F.default.ERROR_UNAUTHORISED){var a=o.session?o.session.token:null;return o.events.emit("error.unauthorized",s,!0).then(function(){return o.session&&o.session.token!==a?o.request(e,t,n):r})}if(r.deprecated){var u="The "+e+" API has been deprecated. "+(r.deprecated||"");o.events.emit("error.deprecated",{name:e,message:u})}return r}).then(function(t){try{if(t.error){o.events.emit("error.response",s);var n=new Error(e+" request resulted in an "+t.code+" error.");return n.response=t,n.request=r,Promise.reject(n)}return o.events.emit("experimental.request.resolve",s),Promise.resolve(t)}finally{o.events.emit("experimental.request.finally",s)}})},e.prototype.admin=function(){return this.session?this.session.user.isAdmin?(this._admin||(this._admin=Promise.resolve(new T.default(this))),this._admin):Promise.reject(new Error("The current user must be an administrator of a team or enterprise account.")):Promise.reject(new Error("You must be logged in to use the Admin API."))},e.prototype.crypto=function(){return this.adapters.getCryptoAdapter()},e.prototype.on=function(e,t){return this.events.on(e,t)},e}();t.default=H},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=n(35),a=o(i),s=n(36),u=o(s),f=n(37),c=o(f),l=n(38),p=o(l),d=function(){function e(t){r(this,e),this.adapters=[].concat(t)}return e.prototype.getAdapterInstanceOf=function(e){return this.getAnyAdaptersInstanceOf(e)[0]||null},e.prototype.getAnyAdaptersInstanceOf=function(e){for(var t=[],n=e.__adapter__,o=0;o<this.adapters.length;o+=1){var r=this.adapters[o];Object.getPrototypeOf(Object.getPrototypeOf(r)).constructor.__adapter__===n&&t.push(r)}return t},e.prototype.getCryptoAdapter=function(){var e=this.getAdapterInstanceOf(a.default);if(!e)throw new Error("ICryptoAdapter not found. This adapter is required for the SDK to function correctly.");return e},e.prototype.getRequestAdapter=function(){var e=this.getAdapterInstanceOf(u.default);if(!e)throw new Error("IRequestAdapter not found. This adapter is required for the SDK to function correctly.");return e},e.prototype.getCacheAdapter=function(){return this.getAdapterInstanceOf(c.default)},e.prototype.getEnhancementAdapters=function(){return this.getAnyAdaptersInstanceOf(p.default)},e}();t.default=d},function(e,t,n){"use strict";function o(){}t.__esModule=!0,o.__adapter__="ICryptoAdapter",t.default=o},function(e,t,n){"use strict";function o(){}t.__esModule=!0,o.__adapter__="IRequestAdapter",t.default=o},function(e,t,n){"use strict";function o(){}t.__esModule=!0,o.__adapter__="ICacheAdapter",t.default=o},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t,n){var o=e[t];e[t]=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];var i=o.bind.apply(o,[this].concat(t));return n(i,this,t).apply(this,t)}}function i(e){function t(r){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],a=Object.getOwnPropertyNames(r).filter(function(t){return r[t].client===e}),s=Object.getPrototypeOf(r),u=Object.keys(s).filter(function(e){return"function"==typeof s[e]&&0!==e.indexOf("_")});(i.length||n)&&u.forEach(function(e){o.push({namespace:i.join("."),name:e,api:r})}),a.forEach(function(e){t(r[e],i.concat(e))})}var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=[];return t(e),o}t.__esModule=!0;var a,s,u=(s=a=function(){function e(){o(this,e)}return e.prototype.onClientReady=function(e){var t=this;i(e).forEach(function(e){r(e.api,e.name,function(n){var o={api:e.api,namespace:e.namespace,name:e.name,displayName:e.namespace+"."+e.name};return t.onMethodBefore(o),function(){var e=void 0;try{e=n()}catch(e){throw o.error=e,t.onMethodThrown(o),e}finally{o.value=e,t.onMethodAfter(o),e&&"function"==typeof e.then&&e.then(function(e){o.resolved=e,t.onMethodResolve(o)},function(e){o.rejected=e,t.onMethodReject(o)}).then(function(){t.onMethodFinally(o)})}return e}})}),e.on("experimental.request.before",function(e){return t.onRequestBefore(e.data)}),e.on("experimental.request.after",function(e){return t.onRequestAfter(e.data)}),e.on("error.response",function(e){return t.onRequestReject(e.data)}),e.on("error.throttled",function(e){return t.onRequestThrottled(e.data)}),e.on("experimental.request.retry",function(e){return t.onRequestRetry(e.data)}),e.on("error.unauthorized",function(e){return t.onRequestUnauthorized(e.data)}),e.on("error.deprecated",function(e){return t.onRequestDeprecated(e.data)}),e.on("experimental.request.resolve",function(e){return t.onRequestResolve(e.data)}),e.on("experimental.request.finally",function(e){return t.onRequestFinally(e.data)})},e.prototype.onMethodBefore=function(){},e.prototype.onMethodAfter=function(){},e.prototype.onMethodReject=function(){},e.prototype.onMethodResolve=function(){},e.prototype.onMethodFinally=function(){},e.prototype.onMethodThrown=function(){},e.prototype.onRequestBefore=function(){},e.prototype.onRequestAfter=function(){},e.prototype.onRequestReject=function(){},e.prototype.onRequestThrottled=function(){},e.prototype.onRequestRetry=function(){},e.prototype.onRequestUnauthorized=function(){},e.prototype.onRequestDeprecated=function(){},e.prototype.onRequestResolve=function(){},e.prototype.onRequestFinally=function(){},e}(),a.__adapter__="IEnhancementAdapter",s);t.default=u},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var r=function(){function e(t){o(this,e),this.client=t}return e.prototype.auto=function(e,t){var n=this.client.adapters.getCacheAdapter(),o=function(){};return n?(o=function(t){void 0!==t&&n.set(e,t)},n.get(e).catch(function(){return Promise.resolve(t(o)).then(function(e){return o(e),e})})):Promise.resolve(t(o))},e}();t.default=r},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},a=n(41),s=o(a),u=n(16),f=o(u),c=n(17),l=o(c),p=n(2),d=function(){function e(t,n){if(r(this,e),this.name=t,this.endpoint=s.default[t],!this.endpoint)throw new Error('Unknown request endpoint "'+t+'".');this.params={},this.addParams(n),this.headers={}}return e.prototype.addHeaders=function(e){return this.headers=i({},this.headers,e),this},e.prototype.addHeader=function(e,t){return this.headers[e]=t,this},e.prototype.addParams=function(e){return this.params=i({},this.params,e),this},e.prototype.addParam=function(e,t){this.params[e]=t},e.prototype.getPath=function(){var e=this,t=this.endpoint,n=t.path,o=t.chain,r=t.trailing,i=n;return o&&o.forEach(function(t){"/"!==i[i.length-1]&&(i+="/"),i+=e.params[t]}),r&&"/"!==i[i.length-1]&&(i+="/"),i},e.prototype.getQuery=function(){var e=this,t=this.endpoint.query;if(t){var n=t.map(function(t){return void 0!==e.params[t]?t+"="+encodeURIComponent(e.params[t]):null}).filter(Boolean).join("&");if(n)return"?"+n}return""},e.prototype.getHeaders=function(){var e,t=i({},this.headers,(e={},e[p.SDK_VERSION_HEADER]=l.default,e));if("POST"===this.endpoint.method)switch(this.endpoint.version){case 2:t["Content-Type"]="application/json";break;case 1:default:t["Content-Type"]="application/x-www-form-urlencoded"}return t},e.prototype.getBody=function(){var e=this,t=this.endpoint;if(t.body){if("string"==typeof t.body){var n=this.params[t.body];return n=(0,f.default)(n)?JSON.stringify(n):String(n)}var o=!0===t.body?Object.keys(this.params):t.body,r={};switch(o.forEach(function(t){var n=e.params[t];void 0!==n&&(r[t]=n)}),t.version){case 2:return JSON.stringify(r);case 1:default:return Object.keys(r).map(function(t){return t+"="+encodeURIComponent(e.params[t])}).join("&")}}return null},e.prototype.getMethod=function(){return(this.endpoint.method||"GET").toUpperCase()},e.prototype.isWithCredentials=function(){return!0===this.endpoint.credentials},e.prototype.build=function(){return{method:this.getMethod(),path:this.getPath(),query:this.getQuery(),body:this.getBody(),headers:this.getHeaders(),credentials:this.isWithCredentials()}},e}();t.default=d},function(e,t){e.exports={"accounts.register":{method:"POST",path:"/api/users/register",body:["email","password","privateKey","publicKey"],anonymous:!0},"accounts.login":{method:"POST",path:"/api/users/login",body:["email","password"],anonymous:!0},"accounts.generate-activation-code":{method:"GET",path:"/api/users/auth/generate",chain:["userId"],trailing:!0},"accounts.activate":{method:"POST",path:"/api/users/auth/activate",body:["userId","authCode"],trailing:!0},"accounts.logout":{method:"GET",path:"/api/users/logout"},"profile.upload-avatar":{method:"POST",path:"/api/media/file/avatar",body:["uploadedImage"]},"profile.change-password":{method:"POST",path:"/api/users/changepassword",body:["oldPassword","newPassword","newPrivateKey"],trailing:!0},"preferences.all":{method:"GET",path:"/api/users/preferences/all"},"preferences.get":{method:"GET",path:"/api/users/preferences/get",query:["preferences"]},"preferences.update":{method:"POST",path:"/api/users/preferences/update",body:!0},"preferences.reset":{method:"POST",path:"api/users/preferences/update",body:["preferences"]},"dashboard.inbox":{method:"GET",path:"/api/proofs/dashboard/proofin",trailing:!0},"dashboard.sent":{method:"GET",path:"/api/proofs/dashboard/proofout",trailing:!0},"dashboard.outbox":{method:"GET",path:"/api/proofs/dashboard/proofoutbox",trailing:!0},"dashboard.search":{method:"POST",path:"/api/proofs/search",body:["query","all","filterBy"]},"dashboard.groups.filter-by":{method:"GET",path:"/api/proofs/dashboard/groups",chain:["filterBy"],trailing:!0},"users.by-id":{method:"GET",path:"/api/users",chain:["userId"]},"users.by-email":{method:"POST",path:"/api/users/email",body:["email"],trailing:!0},"users.invite":{method:"POST",path:"/api/users/create",body:["email"]},"proofs.create":{method:"POST",path:"/api/proofs/create",body:["title","dueDate","description","groupId"]},"proofs.normalize-workflow":{method:"POST",path:"/api/proofs/permission/check",body:["proofId","workflowId"]},"proofs.set-workflow":{method:"POST",path:"/api/proofs/update",body:["proofId","workflowId"]},"proofs.set-tags":{method:"POST",path:"/api/tags/create",body:["relatedId","tag"]},"proofs.set-file":{method:"POST",path:"/api/proofs/update",body:["proofId","fileId"]},"proofs.distribute-file":{method:"GET",path:"/api/proofs/distribute",chain:["proofId"],trailing:!0},"proofs.archive":{version:2,method:"POST",path:"/api/proofs/close",body:["proofIds"]},"proofs.unarchive":{method:"GET",path:"/api/proofs/reopen",chain:["proofId"],trailing:!0},"proofs.delete":{method:"GET",path:"/api/proofs/delete",chain:["proofId"],trailing:!0},"proofs.start":{method:"POST",path:"/api/proofs/startworkflow",body:["proofId"],trailing:!0},"proofs.editors.add":{version:2,method:"POST",path:"/api/proofs/editor/add",body:["proofId","editors","editorMessage"]},"proofs.editors.remove":{version:2,method:"POST",path:"/api/proofs/editor/remove",body:["proofId","editors"]},"proofs.editors.replace":{version:2,method:"POST",path:"/api/proofs/editor/replace",body:["proofId","oldEditors","newEditors"]},"proofs.editors.set":{version:2,method:"POST",path:"/api/proofs/editor/set",body:["proofId","editors"]},"briefs.start":{method:"POST",path:"/api/briefs/start",body:["briefId"]},"proofs.return":{method:"GET",path:"/api/proofs/returnproof",chain:["proofId"]},"proofs.groups.create":{method:"POST",path:"/api/proofs/groups/create",body:["name"]},"proofs.groups.update":{method:"POST",path:"/api/proofs/groups/update",body:["groupId","name"]},"proofs.groups.load":{method:"GET",path:"/api/proofs/group",chain:["groupId"]},"proofs.groups.ready":{method:"POST",path:"/api/proofs/groups/ready",body:["groupId"]},"proofs.groups.owners.add":{version:2,method:"POST",path:"/api/v2/proofs/owners/groups/add",body:["groupId","owners"]},"proofs.groups.workflows.add-reviewers":{version:2,method:"POST",path:"/api/v2/workflows/groups/reviewers/add",body:["groupId","reviewers"]},"proofs.versions.attach":{method:"POST",path:"/api/proofs/versions/create",body:["proofId","versionId"]},"proofs.versions.list":{method:"GET",path:"/api/proofs/versions",chain:["proofId"],trailing:!0},"proofs.load":{method:"GET",path:"/api/proofs/",chain:["proofId"],trailing:!0},"proofs.request-access":{method:"GET",path:"/api/proofs/requestaccess",chain:["proofId"]},"proofs.lock":{method:"GET",path:"/api/proofs/lock/",chain:["proofId"],trailing:!0},"proofs.unlock":{method:"GET",path:"/api/proofs/unlock/",chain:["proofId"],trailing:!0},"proofs.request-unlock":{method:"GET",path:"/api/proofs/unlockemail/",chain:["proofId"],trailing:!0},"files.generate-token":{method:"GET",path:"/api/media/getfiletoken",query:["relatedId","fileType"]},"files.upload-block":{method:"POST",path:"/api/media/file",query:["block","part","token"],body:"data"},"files.upload-complete":{method:"POST",path:"/api/media/file",query:["block","blockCount","part","token","extn","pages","filename","storeoriginal"],body:"envelope"},"files.details":{method:"GET",path:"/api/media/file/details",chain:["fileId"]},"files.download-block":{method:"GET",path:"/api/media/getfilechunk",chain:["proofId","fileId","block"]},"files.thumbnail":{method:"GET",path:"/api/media/getimage/thumb",chain:["fileId"]},"files.import.generic":{method:"POST",path:"/api/media/filedrive",body:["extn","filename","url","envelope","storeOriginal"]},"files.import.drive":{method:"POST",path:"/api/media/filedrive",body:["extn","filename","url","envelope","storeOriginal","accessToken"]},"files.import.onedrive":{method:"POST",path:"/api/media/fileonedrive",body:["extn","filename","url","envelope","storeOriginal","accessToken"]},"files.import.box":{method:"POST",path:"/api/media/filebox",body:["extn","filename","url","envelope","storeOriginal","accessToken"]},"files.import.dropbox":{method:"POST",path:"/api/media/filedropbox",body:["extn","filename","url","envelope","storeOriginal","accessToken"]},"workflows.create":{version:2,method:"POST",path:"/api/v2/workflows/create",body:["title"]},"workflows.load":{version:2,method:"GET",path:"/api/v2/workflows/detail",chain:["workflowId"]},"workflows.steps.add":{version:2,method:"POST",path:"/api/v2/workflows/steps/add",body:["workflowId","title","position"]},"workflows.steps.move-before":{method:"POST",path:"/api/workflows/step/movebefore",body:["stepId","beforeStepId"]},"workflows.steps.move-after":{method:"POST",path:"/api/workflows/step/moveafter",body:["stepId","afterStepId"]},"workflows.steps.swap":{method:"POST",path:"/api/workflows/step/swap",body:["stepId","swapStepId"]},"workflows.users.set":{version:2,method:"POST",path:"/api/v2/workflows/users/set",body:["workflowId","stepId","position","users"]},"workflows.users.update":{version:2,method:"POST",path:"/api/v2/workflows/users/update",body:["workflowId","stepId","userId","role","permissions"]},"workflows.users.add":{version:2,method:"POST",path:"/api/v2/workflows/users/add",body:["workflowId","stepId","users"]},"workflows.delete":{method:"POST",path:"/api/workflows/delete",body:["workflowId"]},"workflows.duplicate":{method:"POST",path:"/api/workflows/duplicateonly",body:["workflowId"]},"workflows.owned":{method:"GET",path:"/api/workflows",trailing:!0},"workflows.shared":{method:"GET",path:"/api/workflows/share/user",trailing:!0},"comments.load-all":{method:"POST",path:"/api/proofs/recent",body:["proofId","timestamp"]},"comments.load-page":{method:"POST",path:"/api/proofs/comment/recent",body:["proofId","timestamp","page"]},"comments.state.update":{method:"POST",path:"/api/proofs/comment/updatestatus",body:["commentId","change","done"]},"comments.create":{method:"POST",path:"/api/proofs/comment/create",body:["proofId","page","envelope","encryptedComment","xy","parent","mentions","metadata","creationToken","change","done"]},"proofs-owners.add":{version:2,method:"POST",path:"/api/v2/proofs/owners/add",body:["proofId","users"]},"proofs-owners.remove":{version:2,method:"POST",path:"/api/v2/proofs/owners/remove",body:["proofId","users"]},"proofs.tag-delete":{method:"POST",path:"/api/tags/delete",body:["relatedId","tag"]},"proofs.remove-editor":{method:"GET",path:"/api/proofs/deleteeditor",chain:["proofId"],trailing:!0},"proofs.final-delivery.get-all":{method:"GET",path:"/api/proofs/final-delivery",chain:["proofId"],trailing:!0},"proofs.final-delivery.get-files":{method:"GET",path:"/api/proofs/final-delivery/files",chain:["proofId"],trailing:!0},"proofs.final-delivery.files.delete":{method:"POST",path:"/api/proofs/final-delivery/files/delete",body:["proofId","fileIds"]},"proofs.final-delivery.notification.add":{method:"POST",path:"/api/proofs/final-delivery/notification/create",body:["proofId","type","users","fileIds","options"]},"proofs.final-delivery.get-notification":{method:"GET",path:"/api/proofs/final-delivery/notification",chain:["notificationId"],trailing:!0},"proofs.final-delivery.notification.delete":{method:"POST",path:"/api/proofs/final-delivery/notification/delete",body:["notificationId"]},"proofs.final-delivery.notification.send":{method:"POST",path:"/api/proofs/final-delivery/notification/sent",body:["notificationId"]},"briefs.create":{method:"POST",path:"/api/briefs/create",body:["title","messageToRecipient","dueDate","tag"]},"briefs.update":{method:"POST",path:"/api/briefs/update",body:["briefId","title","messageToRecipient","dueDate","tag","recipient","editorId","editorMessage"]},"admin.team.users.enabled":{method:"GET",path:"/api/admin/getusers/active",trailing:!0},"admin.team.users.disabled":{method:"GET",path:"/api/admin/getusers/inactive",trailing:!0},"admin.team.users.set-enabled":{method:"POST",path:"/api/admin/setenabled",body:["email","enabled"]},"sessions.check":{method:"GET",path:"/api/sessions/check"},"sso.get-public-key":{method:"GET",path:"/sso/public_key",anonymous:!0},"sso.get-session":{version:2,method:"POST",path:"/sso/session",body:["nonce"],anonymous:!0,credentials:!0},"sso.get-login-options":{version:2,method:"POST",path:"/sso/login_options",body:["email"],anonymous:!0}}},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=n(9),a=o(i),s=n(43),u=n(2),f=n(10),c=o(f),l=function(){function e(){r(this,e),this.error=!1,this.code=-1,this.data=null,this.message=null,this.deprecated=null}return e.parse=function(t){var n=t.status,o=t.headers,r=void 0===o?{}:o,i=t.body,f=new e;if(n===s.TOO_MANY_REQUESTS_STATUS)return f.error=!0,f.message="PageProof Error #h"+s.TOO_MANY_REQUESTS_STATUS,f.code=a.default.ERROR_THROTTLED,f.data={timeout:1e3*(parseFloat(r[u.RETRY_AFTER_HEADER])||60)},f;if((0,c.default)(r,"deprecated")&&(f.deprecated=r.deprecated),n===s.OK_STATUS&&!i)return f.code=a.default.OK,f;try{var l=JSON.parse(i);"string"==typeof l||(l&&"ResponseCode"in l?(f.code=l.ResponseCode,f.code!==a.default.OK&&(f.error=!0)):l.Message&&1===Object.keys(l).length&&(f.error=!0,f.code=a.default.ERROR_CRITICAL)),f.error&&(f.message="PageProof Error #s"+f.code),f.data=l}catch(e){f.error=!0}return f},e}();t.default=l},function(e,t,n){"use strict";t.__esModule=!0;t.TOO_MANY_REQUESTS_STATUS=429,t.OK_STATUS=200},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=n(0),u=o(s),f=n(6),c=o(f),l=n(45),p=o(l),d=function(e){function t(n){r(this,t);var o=i(this,e.call(this,n));return o.sso=new p.default(n),o}return a(t,e),t.prototype.register=function(e,t){var n=this;return this.client.crypto().generatePasswordHash(t).then(function(e){return Promise.all([e,n.client.crypto().generateKeyPair()])}).then(function(e){var o=e[0],r=e[1];return Promise.all([o,r,n.client.crypto().encryptPrivateKey(r.privateKeyPEM,t)])}).then(function(t){var o=t[0],r=t[1],i=t[2];return Promise.all([r,n.client.request("accounts.register",{email:e,password:o,privateKey:i,publicKey:r.publicKeyPEM})])}).then(function(o){var r=o[0];return Promise.all([r,n.login(e,t,!1)])}).then(function(e){var t=e[0],o=e[1];return Promise.all([t,o,n.generateActivationCode()])}).then(function(e){var t=e[0],n=e[1];return n.privateKeyPEM=t.privateKeyPEM,n})},t.prototype.generateActivationCode=function(){return this.client.request("accounts.generate-activation-code",{userId:this.client.session.userId})},t.prototype.activate=function(e){var t=this;return this.client.request("accounts.activate",{userId:this.client.session.userId,authCode:e}).then(function(){t.client.session.user.hasActivated=!0})},t.prototype.login=function(e,t){var n=this,o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return this.client.crypto().generatePasswordHash(t).then(function(t){return n.client.request("accounts.login",{email:e,password:t})}).then(function(t){var n=(new c.default).fromSession(t.data);return n.user.email=e,n}).then(function(e){return o?n.client.crypto().decryptPrivateKey(e.privateKeyPEM$,t).then(function(t){return e.privateKeyPEM=t,e}):e}).then(function(e){return n.client.setSession(e),e})},t.prototype.logout=function(){var e=this;return this.client.request("accounts.logout").catch(function(t){return e.client.setSession(null),Promise.reject(t)}).then(function(){e.client.setSession(null)})},t}(u.default);t.default=d},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=n(0),u=o(s),f=n(6),c=o(f),l=function(e){function t(){return r(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.getSession=function(){var e=this;return this.client.request("sso.get-public-key").then(function(e){return e.data.ServerPublicKey}).then(function(t){return e.client.crypto().generateWrappedSymmetricKey(t)}).then(function(t){var n=t.key,o=t.key$;return Promise.all([n,e.client.request("sso.get-session",{nonce:o})])}).then(function(t){var n=t[0],o=t[1],r=(new c.default).fromSession(o.data);return Promise.all([r,e.client.crypto().decryptManagedPrivateKey(r.privateKeyPEM$,n)])}).then(function(e){var t=e[0],n=e[1];return t.privateKeyPEM=n,t})},t.prototype.getLoginOptions=function(e){return this.client.request("sso.get-login-options",{email:e}).then(function(e){return e.data})},t}(u.default);t.default=l},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){var t={};return Object.keys(y).forEach(function(n){t[n]=e[y[n]]}),t}function u(e){return(e||[]).map(function(e){return(new p.default).fromProof(e)})}t.__esModule=!0;var f=n(0),c=o(f),l=n(4),p=o(l),d=n(47),h=o(d),y={inbox:"ProofIn",sent:"ProofOut",outbox:"ProofOutBox"},m=function(e){function t(n){r(this,t);var o=i(this,e.call(this,n));return o.groups=new h.default(n),o}return a(t,e),t.prototype.inbox=function(){return this._loadSingleTabProofs("inbox")},t.prototype.sent=function(){return this._loadSingleTabProofs("sent")},t.prototype.outbox=function(){return this._loadSingleTabProofs("outbox")},t.prototype._loadSingleTabProofs=function(e){return this.client.request("dashboard."+e).then(function(e){return s(e.data)}).then(function(t){return t[e]}).then(u)},t.prototype.search=function(e){return this._loadSearchProofs({query:e})},t.prototype.everything=function(){return this._loadSearchProofs({all:1})},t.prototype.approved=function(){return this._loadSearchProofs({filterBy:70})},t.prototype.archived=function(){return this._loadSearchProofs({filterBy:100})},t.prototype._loadSearchProofs=function(e){return this.client.request("dashboard.search",e).then(function(e){return u(e.data.Proofs)})},t}(c.default);t.default=m},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){return(e||[]).map(function(e){return(new l.default).fromProofGroup(e)})}t.__esModule=!0;var u=n(0),f=o(u),c=n(11),l=o(c),p=function(e){function t(){return r(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype._loadGroups=function(e){return this.client.request("dashboard.groups.filter-by",{filterBy:e}).then(function(e){return s(e.data)})},t.prototype.current=function(){return this._loadGroups("current")},t}(f.default);t.default=p},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){return e.data.length>0?(new p.default).fromUser(e.data[0]):(new p.default).fromUser(e.data)}function u(e){return e.data.length?(new p.default).fromUser(e.data[0]):null}t.__esModule=!0;var f=n(0),c=o(f),l=n(3),p=o(l),d=function(e){function t(){return r(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.byEmail=function(e){return this.client.request("users.by-email",{email:e}).then(u)},t.prototype.byId=function(e){return this.client.request("users.by-id",{userId:e}).then(s)},t.prototype.invite=function(e){return this.client.request("users.invite",{email:e}).then(s)},t}(c.default);t.default=d},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=n(0),u=o(s),f=n(50),c=o(f),l=n(51),p=o(l),d=n(52),h=o(d),y=n(53),m=o(y),w=n(56),v=o(w),_=n(4),b=o(_),E=n(5),g=o(E),O=n(2),P=function(e){function t(n){r(this,t);var o=i(this,e.call(this,n));return o.owners=new c.default(n),o.editors=new p.default(n),o.versions=new h.default(n),o.groups=new m.default(n),o.finalDelivery=new v.default(n),o}return a(t,e),t.prototype.setWorkflow=function(e,t){var n=this;return this.client.request("proofs.normalize-workflow",{proofId:e,workflowId:t}).then(function(){return n.client.request("proofs.set-workflow",{proofId:e,workflowId:t})})},t.prototype.setTags=function(e,t){return this.client.request("proofs.set-tags",{relatedId:e,tag:t.join(",")})},t.prototype.deleteTag=function(e,t){return this.client.request("proofs.tag-delete",{relatedId:e,tag:t})},t.prototype.setFile=function(e,t){var n=this;return this.client.request("proofs.set-file",{proofId:e,fileId:t}).then(function(){return n.client.request("proofs.distribute-file",{proofId:e})})},t.prototype.create=function(e){var t=this,n=e.name,o=e.tags,r=void 0===o?[]:o,i=e.dueDate,a=void 0===i?new Date(Date.now()+3*O.DAY_IN_MS):i,s=e.messageToReviewers,u=e.workflow,f=e.file,c=e.group,l=e.start,p=void 0===l||l,d=p&&!c;return this.client.request("proofs.create",{title:n,dueDate:a.toISOString(),description:s,groupId:c?c.id:void 0}).then(function(e){var n=(new b.default).fromProof(e.data);return Promise.all([n,r.length&&t.setTags(n.id,r),u&&t.setWorkflow(n.id,u.id),f&&t.setFile(n.id,f.id)])}).then(function(e){var n=e[0];return Promise.resolve(d&&t.start(n.id)).then(function(){return n})}).then(function(e){return u&&(e.workflowId=u.id),f&&(e.fileId=f.id,e.fileStatus=g.default.UPLOADING),e.calculateState(),e})},t.prototype.archive=function(e){return this.client.request("proofs.archive",{proofIds:e})},t.prototype.unarchive=function(e){return this.client.request("proofs.unarchive",{proofId:e})},t.prototype.delete=function(e){return this.client.request("proofs.delete",{proofId:e})},t.prototype.return=function(e){return this.client.request("proofs.return",{proofId:e})},t.prototype.start=function(e){return this.client.request("proofs.start",{proofId:e})},t.prototype.removeEditor=function(e){return this.client.request("proofs.remove-editor",{proofId:e})},t.prototype.load=function(e){return this.client.request("proofs.load",{proofId:e}).then(function(e){return(new b.default).fromProof(e.data)})},t.prototype.lock=function(e){return this.client.request("proofs.lock",{proofId:e})},t.prototype.unlock=function(e){return this.client.request("proofs.unlock",{proofId:e})},t.prototype.requestUnlock=function(e){return this.client.request("proofs.request-unlock",{proofId:e})},t.prototype.requestAccess=function(e){return this.client.request("proofs.request-access",{proofId:e})},t}(u.default);t.default=P},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=n(0),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(e){function t(){return o(this,t),r(this,e.apply(this,arguments))}return i(t,e),t.prototype.add=function(e,t){return this.client.request("proofs-owners.add",{proofId:e,users:[].concat(t)})},t.prototype.remove=function(e,t){return this.client.request("proofs-owners.remove",{proofId:e,users:[].concat(t)})},t}(s.default);t.default=u},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=n(0),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(e){function t(){return o(this,t),r(this,e.apply(this,arguments))}return i(t,e),t.prototype.add=function(e,t,n){var o={proofId:e,editors:[].concat(t),editorMessage:null===n?"":n};return this.client.request("proofs.editors.add",o)},t.prototype.remove=function(e,t){return this.client.request("proofs.editors.remove",{proofId:e,editors:[].concat(t)})},t.prototype.replace=function(e,t,n){return this.client.request("proofs.editors.replace",{proofId:e,oldEditors:[].concat(t),newEditors:[].concat(n)})},t.prototype.set=function(e,t){return this.client.request("proofs.editors.set",{proofId:e,editors:[].concat(t)})},t}(s.default);t.default=u},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=n(0),u=o(s),f=n(21),c=o(f),l=n(22),p=(0,l.sortObjectsByKey)("version"),d=function(e){function t(){return r(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.attach=function(e,t){return this.client.request("proofs.versions.attach",{proofId:e,versionId:t})},t.prototype.list=function(e){return this.client.request("proofs.versions.list",{proofId:e}).then(function(e){return e.data.map(function(e){return(new c.default).fromProofVersion(e)}).sort(p)})},t}(u.default);t.default=d},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){return(new l.default).fromProofGroup(e.data)}t.__esModule=!0;var u=n(0),f=o(u),c=n(11),l=o(c),p=n(54),d=o(p),h=n(55),y=o(h),m=function(e){function t(n){r(this,t);var o=i(this,e.call(this,n));return o.owners=new d.default(n),o.workflows=new y.default(n),o}return a(t,e),t.prototype.create=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.name;return this.client.request("proofs.groups.create",{name:t}).then(s)},t.prototype.load=function(e){return this.client.request("proofs.groups.load",{groupId:e}).then(s)},t.prototype.ready=function(e){return this.client.request("proofs.groups.ready",{groupId:e})},t.prototype.update=function(e,t){var n=t.name;return this.client.request("proofs.groups.update",{groupId:e,name:n}).then(s)},t}(f.default);t.default=m},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=n(0),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(e){function t(){return o(this,t),r(this,e.apply(this,arguments))}return i(t,e),t.prototype.add=function(e,t){return this.client.request("proofs.groups.owners.add",{groupId:e,owners:[].concat(t)})},t}(s.default);t.default=u},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=n(0),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(e){function t(){return o(this,t),r(this,e.apply(this,arguments))}return i(t,e),t.prototype.addReviewers=function(e,t){return this.client.request("proofs.groups.workflows.add-reviewers",{groupId:e,reviewers:[].concat(t)})},t}(s.default);t.default=u},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){return(new l.default).fromProofFinalDelivery(e.data)}t.__esModule=!0;var u=n(0),f=o(u),c=n(57),l=o(c),p=n(59),d=o(p),h=n(66),y=o(h),m=function(e){function t(n){r(this,t);var o=i(this,e.call(this,n));return o.files=new d.default(n),o.notifications=new y.default(n),o}return a(t,e),t.prototype.all=function(e){return this.client.request("proofs.final-delivery.get-all",{proofId:e}).then(s)},t}(f.default);t.default=m},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=n(1),a=o(i),s=n(7),u=o(s),f=n(58),c=o(f),l={id:"Id",name:"Name",files:(0,i.each)("Files",function(e){return(new u.default).fromFile(e)}),notifications:(0,i.each)("Notifications",function(e){return(new c.default).fromFinalDeliveryNotification(e)})},p=function(){function e(){r(this,e)}return e.prototype.fromProofFinalDelivery=function(e){return(0,a.default)(this,l,e),console.debug("i m here transformed data: ",e,this),this},e}();t.default=p},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var r=n(1),i=function(e){return e&&e.__esModule?e:{default:e}}(r),a={id:"NotificationId",notificationType:"Type",proofId:"ProoId",isSent:"Sent",users:"Users",files:"Files",message:"Message"},s=function(){function e(){o(this,e)}return e.prototype.fromFinalDeliveryNotification=function(e){return(0,i.default)(this,a,e),this},e}();t.default=s},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=n(0),u=o(s),f=n(23),c=o(f),l=n(25),p=o(l),d=function(e){function t(n){r(this,t);var o=i(this,e.call(this,n));return o.files=new c.default(n),o}return a(t,e),t.prototype.add=function(e){var t=e.proofId,n=e.file,o=e.onProgress;return this.files.upload({name:n.name,contents:n,assignedTo:t,assignedType:p.default.FINAL_FILE,onProgress:o})},t.prototype.remove=function(e,t){return this.client.request("proofs.final-delivery.files.delete",{proofId:e,fileId:t})},t.prototype.load=function(e){return this.client.request("proofs.final-delivery.get-files",{proofId:e})},t}(u.default);t.default=d},function(e,t,n){"use strict";function o(e){var t=new a.default,n=0,o=Promise.resolve(),i=t.size(e);return function(){var a=n++*r.BYTES_PER_BLOCK,s=a+r.BYTES_PER_BLOCK;return o=o.then(function(){return a>i?null:t.slice(e,a,s).then(t.readBase64).then(function(e){return"data:;base64,"+e})})}}t.__esModule=!0;var r=n(2),i=n(8),a=function(e){return e&&e.__esModule?e:{default:e}}(i);t.default=o},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e){for(var t=new ArrayBuffer(e.length),n=new Uint8Array(t),o=0;o<e.length;o++)n[o]=e.charCodeAt(o);return t}t.__esModule=!0;var i=function(){function e(){o(this,e)}return e.prototype.create=function(e){return Promise.resolve(new Blob([r(e)]))},e.prototype.createBase64=function(e){return this.create(atob(e))},e.prototype.combine=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return Promise.resolve(new Blob(t))},e.prototype.slice=function(e,t,n){return Promise.resolve(e.slice(t,n))},e.prototype.read=function(e){return new Promise(function(t,n){var o=new FileReader;o.onload=function(){t(o.result)},o.onerror=function(){n(o.error)},o.readAsText(e)})},e.prototype.readBase64=function(e){return new Promise(function(t,n){var o=new FileReader;o.onload=function(){var e=o.result;t(e.substring(e.indexOf(",")+1))},o.onerror=function(){n(o.error)},o.readAsDataURL(e)})},e.prototype.size=function(e){return e.size},e}();t.default=i},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var r=function(){function e(){o(this,e)}return e.prototype.create=function(e){return Promise.resolve(Buffer.from(e))},e.prototype.createBase64=function(e){return Promise.resolve(Buffer.from(e,"base64"))},e.prototype.combine=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return Promise.resolve(Buffer.concat(t))},e.prototype.slice=function(e,t,n){return Promise.resolve(e.slice(t,n))},e.prototype.read=function(e){return Promise.resolve(e.toString())},e.prototype.readBase64=function(e){return Promise.resolve(e.toString("base64"))},e.prototype.size=function(e){return Buffer.byteLength(e)},e}();t.default=r},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e){for(var t=e.length,n=e.length-1;n>=0;n--){var o=e.charCodeAt(n);o>127&&o<=2047?t++:o>2047&&o<=65535&&(t+=2),o>=56320&&o<=57343&&n--}return t}t.__esModule=!0;var i=n(64),a=function(){function e(){o(this,e)}return e.prototype.create=function(e){return Promise.resolve(e)},e.prototype.createBase64=function(e){return Promise.resolve((0,i.atob)(e))},e.prototype.combine=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return Promise.resolve(t.join(""))},e.prototype.slice=function(e,t,n){return Promise.resolve(e.slice(t,n))},e.prototype.read=function(e){return Promise.resolve(e)},e.prototype.readBase64=function(e){return Promise.resolve((0,i.btoa)(e))},e.prototype.size=function(e){return r(e)},e}();t.default=a},function(e,t,n){!function(){function e(e){this.message=e}var n=t,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";e.prototype=new Error,e.prototype.name="InvalidCharacterError",n.btoa||(n.btoa=function(t){for(var n,r,i=String(t),a=0,s=o,u="";i.charAt(0|a)||(s="=",a%1);u+=s.charAt(63&n>>8-a%1*8)){if((r=i.charCodeAt(a+=.75))>255)throw new e("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");n=n<<8|r}return u}),n.atob||(n.atob=function(t){var n=String(t).replace(/[=]+$/,"");if(n.length%4==1)throw new e("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,i,a=0,s=0,u="";i=n.charAt(s++);~i&&(r=a%4?64*r+i:i,a++%4)?u+=String.fromCharCode(255&r>>(-2*a&6)):0)i=o.indexOf(i);return u})}()},function(e,t,n){"use strict";function o(e){return"undefined"!=typeof Blob&&e instanceof Blob?e.size:0}t.__esModule=!0,t.default=o},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=n(0),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(e){function t(){return o(this,t),r(this,e.apply(this,arguments))}return i(t,e),t.prototype.add=function(e,t,n,o,r){var i=r.message;return this.client.request("proofs.final-delivery.notification.add",{proofId:e,type:t,users:n,fileIds:o,message:i})},t.prototype.remove=function(e){return this.client.request("proofs.final-delivery.notification.delete",{notificationId:e})},t.prototype.get=function(e){return this.client.request("proofs.final-delivery.get-notification",{notificationId:e})},t.prototype.send=function(e){return this.client.request("proofs.final-delivery.notification.send",{notificationId:e})},t}(s.default);t.default=u},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=n(0),u=o(s),f=n(4),c=o(f),l=n(5),p=o(l),d=n(2),h=function(e){function t(){return r(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.setTags=function(e,t){return this.client.request("proofs.set-tags",{relatedId:e,tag:t.join(",")})},t.prototype.deleteTag=function(e,t){return this.client.request("proofs.tag-delete",{relatedId:e,tag:t})},t.prototype.setFile=function(e,t){var n=this;return this.client.request("proofs.set-file",{proofId:e,fileId:t}).then(function(){return n.client.request("proofs.distribute-file",{proofId:e})})},t.prototype.create=function(e){var t=this,n=e.name,o=e.file,r=e.tags,i=void 0===r?[]:r,a=e.dueDate,s=void 0===a?new Date(Date.now()+3*d.DAY_IN_MS):a;return this.client.request("briefs.create",{title:n,messageToRecipient:"",dueDate:s.toISOString(),tag:i.join(",")}).then(function(e){var n=(new c.default).fromProof(e.data.Brief);return Promise.all([n,o&&t.setFile(n.id,o.id)])}).then(function(e){var t=e[0];return o&&(t.fileId=o.id,t.fileStatus=p.default.UPLOADING),t.calculateState(),t})},t.prototype.update=function(e){var t=this,n=e.briefId,o=e.data,r=e.start,i=void 0!==r&&r;return this.client.request("briefs.update",{briefId:n,title:o.title,messageToRecipient:o.messageToRecipient,dueDate:o.dueDate?o.dueDate.toISOString():"",tag:o.tags?o.tags.join(","):"",recipient:o.recipient,editorId:o.editorId,editorMessage:o.editorMessage}).then(function(e){return(new c.default).fromProof(e.data.Brief)}).then(function(e){return Promise.resolve(i&&t.start(e.id)).then(function(){return e})})},t.prototype.delete=function(e){return this.client.request("proofs.delete",{proofId:e})},t.prototype.start=function(e){return this.client.request("briefs.start",{briefId:e})},t}(u.default);t.default=h},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=n(0),u=o(s),f=n(69),c=o(f),l=function(e){function t(n){r(this,t);var o=i(this,e.call(this,n));return o.team=new c.default(n),o}return a(t,e),t}(u.default);t.default=l},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=n(0),u=o(s),f=n(70),c=o(f),l=function(e){function t(n){r(this,t);var o=i(this,e.call(this,n));return o.users=new c.default(n),o}return a(t,e),t}(u.default);t.default=l},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){return e.data.map(function(e){return(new l.default).fromUser(e)})}t.__esModule=!0;var u=n(0),f=o(u),c=n(3),l=o(c),p=function(e){function t(){return r(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.enabled=function(){return this.client.request("admin.team.users.enabled").then(s)},t.prototype.disabled=function(){return this.client.request("admin.team.users.disabled").then(s)},t.prototype._setEnabled=function(e,t){return this.client.request("admin.team.users.set-enabled",{email:e,enabled:t})},t.prototype.enable=function(e){return this._setEnabled(e,!0)},t.prototype.disable=function(e){return this._setEnabled(e,!1)},t}(f.default);t.default=p},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){return e&&((0,w.isUserId)(e.id)||e.email)}function u(e){return(e||[]).map(function(e){return(new p.default).fromWorkflow(e)})}t.__esModule=!0;var f=n(0),c=o(f),l=n(26),p=o(l),d=n(13),h=o(d),y=n(14),m=o(y),w=n(20),v=n(72),_=o(v),b=function(e){function t(n){r(this,t);var o=i(this,e.call(this,n));return o.steps=new _.default(n),o}return a(t,e),t.prototype.create=function(e){var t=this,n=e.save,o=void 0!==n&&n,r=e.name,i=e.steps,a=void 0===i?[]:i,u=e.reviewers,f=e.approver;if(!s(f))return Promise.reject(Error("An approver is required to create a workflow."));if(o&&!r)return Promise.reject(Error("A workflow must have a name when saving it as a workflow template."));var c=a;u&&u.length&&c.splice(0,0,{users:u}),f&&c.push({position:1e3,users:[f]});for(var l=0,p=0;p<c.length;p++){var d=c[p];if(!d.users||!d.users.length)return Promise.reject(Error("Workflow steps must contain users."));(!d.position||d.position<l)&&(d.position=l+1),l=Math.max(l,d.position);for(var h=0;h<d.users.length;h++){if(!s(d.users[h]))return Promise.reject(Error("A user id or email address must be provided for a workflow user."))}}var y=void 0;return this._createWorkflow(r).then(function(e){return y=e.id,Promise.all([e,Promise.all(c.map(function(n){var o=e.getStepByPosition(n.position);return o?t._setWorkflowStepUsersMutate(e.id,o,n.users):t._addWorkflowStepAndUsers(e.id,n)}))])}).then(function(e){var t=e[0],n=e[1];return t.steps=n,t}).then(function(e){return o?t._duplicateWorkflow(y):e}).catch(function(e){return Promise.resolve(y&&t._deleteWorkflow(y)).then(function(){return Promise.reject(e)})})},t.prototype.load=function(e){return this.client.request("workflows.load",{workflowId:e}).then(function(e){return(new p.default).fromWorkflow(e.data)})},t.prototype.use=function(e){return this.duplicate(e)},t.prototype.duplicate=function(e){return this._duplicateWorkflow(e)},t.prototype.delete=function(e){return this._deleteWorkflow(e)},t.prototype.all=function(){return Promise.all([this.owned(),this.shared()]).then(function(e){return[].concat(e[0],e[1])})},t.prototype.owned=function(){return this.client.request("workflows.owned").then(function(e){return u(e.data)})},t.prototype.shared=function(){return this.client.request("workflows.shared").then(function(e){return u(e.data)})},t.prototype.setApprover=function(e,t){return this.client.request("workflows.users.set",{workflowId:e,position:1e3,users:[t]})},t.prototype._duplicateWorkflow=function(e){var t=this;return this.client.request("workflows.duplicate",{workflowId:e}).then(function(e){var n=e.data.WorkflowId;return t.load(n)})},t.prototype._deleteWorkflow=function(e){return this.client.request("workflows.delete",{workflowId:e})},t.prototype._createWorkflow=function(e){return this.client.request("workflows.create",{title:e}).then(function(e){return(new p.default).fromWorkflow(e.data)})},t.prototype._addWorkflowStepAndUsers=function(e,t){var n=this;return this.client.request("workflows.steps.add",{workflowId:e,title:t.name,position:t.position}).then(function(o){var r=(new h.default).fromWorkflowStep(o.data);return n._setWorkflowStepUsersMutate(e,r,t.users)})},t.prototype._setWorkflowStepUsersMutate=function(e,t,n){return this.client.request("workflows.users.set",{workflowId:e,stepId:t.id,users:n.map(function(e){return{email:e.email,userId:e.id,role:e.role,permissions:e.permissions&&{inviter:!!e.permissions.inviter}}})}).then(function(e){var n=e.data.map(function(e){return(new m.default).fromWorkflowUser(e)});return t.users=n,t})},t}(c.default);t.default=b},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=n(0),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(e){function t(){return o(this,t),r(this,e.apply(this,arguments))}return i(t,e),t.prototype.moveBefore=function(e,t){return this.client.request("workflows.steps.move-before",{stepId:e,beforeStepId:t})},t.prototype.moveAfter=function(e,t){return this.client.request("workflows.steps.move-after",{stepId:e,afterStepId:t})},t.prototype.swap=function(e,t){return this.client.request("workflows.steps.swap",{stepId:e,swapStepId:t})},t}(s.default);t.default=u},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){return(new p.default).fromPreference(e)}function u(e,t){var n=new Array(e.length);return t.forEach(function(t){n[e.indexOf(t.name)]=t}),n}t.__esModule=!0;var f=n(0),c=o(f),l=n(74),p=o(l),d=function(e){function t(){return r(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.all=function(){return this.client.request("preferences.all")},t.prototype.get=function(e){var t=[].concat(e);return this.client.request("preferences.get",{preferences:t}).then(function(e){return e.data.map(s)}).then(function(n){return"string"==typeof e?n[0]:u(t,n)})},t.prototype.update=function(e,t){var n,o=void 0!==t?(n={},n[e]=t,n):e;return this.client.request("preferences.update",o)},t.prototype.reset=function(e){return this.client.request("preferences.reset",{preferences:[].concat(e)})},t}(c.default);t.default=d},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var r=n(1),i=function(e){return e&&e.__esModule?e:{default:e}}(r),a={name:"Name",defaultValue:"DefaultValue",value:"Value"},s=function(){function e(){o(this,e)}return e.prototype.getValueOrDefault=function(){return null===this.value?this.defaultValue:this.value},e.prototype.fromPreference=function(e){return(0,i.default)(this,a,e),this},e}();t.default=s},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){var t=[];return Object.keys(e).forEach(function(n){e[n].Comments.forEach(function(e){t.push(e)})}),t}function u(e){var t=[],n=[];e.forEach(function(e){var o=(new p.default).fromComment(e);o.parentCommentId?n.push(o):t.push(o)}),t.sort(P);var o=t.map(function(e){return e.id}),r=(0,m.sortObjectsBy)(function(e){return o.indexOf(e.parentCommentId)},!0);return n.sort((0,m.combineSort)(I,r)),t.concat(n)}t.__esModule=!0;var f=n(0),c=o(f),l=n(29),p=o(l),d=n(15),h=o(d),y=n(2),m=n(22),w=n(31),v=n(77),_=n(78),b=o(_),E=(0,m.sortObjectsByKey)("pageNumber"),g=(0,m.sortObjectsByKey)("createdDate",!0),O=(0,m.sortObjectsByKey)("createdDate",!1),P=(0,m.combineSort)(E,g),I=(0,m.combineSort)(E,O),T=function(e){function t(){return r(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype._mark=function(e,t,n){var o,r=void 0;switch(t){case h.default.TODO:r="change";break;case h.default.DONE:r="done";break;default:throw new Error('Cannot mark comment state "'+t+'".')}var i=(o={commentId:e},o[r]=n?1:0,o);return this.client.request("comments.state.update",i).then(function(){return null})},t.prototype.mark=function(e,t){return this._mark(e,t,!0)},t.prototype.unmark=function(e,t){return this._mark(e,t,!1)},t.prototype.load=function(e){var t=this,n="string"==typeof e?{proofId:e}:e,o=n.proofId,r=n.pageNumber,i=void 0===r?null:r,a=n.sinceDate,f=void 0===a?null:a,c=n.async,l=void 0!==c&&c,p=n.decrypt,d=void 0===p||p,h=n.onDecryptComment,m=n.onDecryptComments,w=n.onDecryptCommentsThrottleMs,v=void 0===w?1e3:w,_=n.onDecryptError,E=f?f.toISOString().match(y.ISO_REGEX)[0]:y.DEFAULT_ISO_DATE,g={proofId:o,page:i,timestamp:E};return this.client.request(null!==i?"comments.load-page":"comments.load-all",g).then(function(e){var n=u(e.data.Pages?s(e.data.Pages):e.data),o=Promise.resolve();if(d){var r=[],i=[],a=m?(0,b.default)(function(){i.length&&(m(i),i=[])},v):function(){},f=Promise.all(n.map(function(e){return t.client.cache.auto(y.COMMENT_CACHE_PREFIX+e.comment$,function(t){r.push({comment:e,resolve:t})}).then(function(t){return t&&e.fromRawComment(t),e})}));o=o.then(function(){return f}),o=o.then(function(){var e=r.map(function(e){var n=e.comment,o=e.resolve;return t.client.crypto().decryptComment(n.comment$,n.envelope,t.client.session.privateKeyPEM).then(function(e){n.fromRawComment(e),o(e),h&&h(n),i.push(n),a()}).catch(function(e){if(_&&_(e,n),!l)return Promise.reject(e)})});return l?null:Promise.all(e)})}return o.then(function(){return n})})},t.prototype.create=function(e){var t=this,n=e.raw,o=e.proofId,r=e.pageNumber,i=void 0===r?1:r,a=e.pin,s=e.mediaTime,u=e.mediaDuration,f=e.parentCommentId,c=e.metadata,l=e.state,d=e.creationToken,y=(0,w.getCommentMentions)(n),m=d||(0,v.generateCreationToken)();return this.client.crypto().encryptComment(n,[this.client.session.serverPublicKeyPEM,this.client.session.publicKeyPEM]).then(function(e){var t=e.envelope,n=e.comment$;return{proofId:o,page:f?void 0:i,envelope:t,encryptedComment:n,xy:JSON.stringify({x:a&&"number"==typeof a.x?a.x:null,y:a&&"number"==typeof a.y?a.y:null,x2:a&&"number"==typeof a.x2?a.x2:null,y2:a&&"number"==typeof a.y2?a.y2:null,time:"number"==typeof s?s:null,duration:"number"==typeof u?u:null}),parent:f||void 0,mentions:y.map(function(e){return e.id}).join(","),metadata:c?JSON.stringify(c):"{}",creationToken:m,change:l===h.default.TODO?"1":void 0,done:l===h.default.DONE?"1":void 0}}).then(function(e){return t.client.request("comments.create",e).then(function(e){return(new p.default).fromComment(e.data).fromRawComment(n)})}).catch(function(e){return e&&(e.creationToken=m),Promise.reject(e)})},t}(c.default);t.default=T},function(e,t,n){"use strict";function o(e){var t=""+e,n=r.exec(t);if(!n)return t;var o,i="",a=0,s=0;for(a=n.index;a<t.length;a++){switch(t.charCodeAt(a)){case 34:o=""";break;case 38:o="&";break;case 39:o="'";break;case 60:o="<";break;case 62:o=">";break;default:continue}s!==a&&(i+=t.substring(s,a)),s=a+1,i+=o}return s!==a?i+t.substring(s,a):i}/*!
|
|
2
2
|
* escape-html
|
|
3
3
|
* Copyright(c) 2012-2013 TJ Holowaychuk
|
|
4
4
|
* Copyright(c) 2015 Andreas Lubbe
|
|
5
5
|
* Copyright(c) 2015 Tiancheng "Timothy" Gu
|
|
6
6
|
* MIT Licensed
|
|
7
7
|
*/
|
|
8
|
-
var r=/["'&<>]/;e.exports=
|
|
8
|
+
var r=/["'&<>]/;e.exports=o},function(e,t,n){"use strict";function o(){for(var e=(new Date).getTime(),t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789~`!@#$%^&*()_+-={}[]:\";'<>?,./|\\",n="",o=r;o>0;--o)n+=t[Math.round(Math.random()*(t.length-1))];return n+"-"+e}t.__esModule=!0;var r=32;t.generateCreationToken=o},function(e,t,n){"use strict";function o(e,t){var n=void 0;return function(){n||(n=setTimeout(function(){e(),n=null},t))}}t.__esModule=!0,t.default=o},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=n(0),u=o(s),f=n(8),c=o(f),l=function(e){function t(){return r(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.uploadAvatar=function(e){var t=this;return(new c.default).readBase64(e).then(function(e){return t.client.request("profile.upload-avatar",{uploadedImage:"data:image/png;base64,"+e})})},t.prototype.changePassword=function(e,t){var n=this,o=this.client.crypto();return Promise.all([o.generatePasswordHash(e),o.generatePasswordHash(t),o.encryptPrivateKey(this.client.session.privateKeyPEM,t)]).then(function(e){var t=e[0],o=e[1],r=e[2];return n.client.request("profile.change-password",{oldPassword:t,newPassword:o,newPrivateKey:r})})},t}(u.default);t.default=l},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=n(0),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(e){function t(){return o(this,t),r(this,e.apply(this,arguments))}return i(t,e),t.prototype.check=function(){return this.client.request("sessions.check").then(function(){return null})},t}(s.default);t.default=u},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=n(10),a=function(e){return e&&e.__esModule?e:{default:e}}(i),s=n(12)("EventEmitter"),u=function(){function e(){o(this,e),this.handlers={}}return e.prototype.getHandlers=function(e){var t=this,n=[],o=[e];if(-1!==e.indexOf("."))for(var r=e;(r=r.substring(0,r.lastIndexOf("."))).length;)o.push(r+".*");return o.push("*"),o.forEach(function(e){(0,a.default)(t.handlers,e)&&n.push.apply(n,t.handlers[e])}),n},e.prototype.on=function(e,t){if("function"!=typeof t)return void s("Handler is not a function, got "+(void 0===t?"undefined":r(t)));(0,a.default)(this.handlers,e)||(this.handlers[e]=[]),this.handlers[e].push(t)},e.prototype.off=function(e,t){if((0,a.default)(this.handlers,e)){var n=this.handlers[e];n.splice(n.indexOf(t),1)}},e.prototype.addEventListener=function(e,t){return this.on(e,t)},e.prototype.removeEventListener=function(e,t){return this.off(e,t)},e.prototype.emit=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=this.getHandlers(e),r=new Array(o.length);s("Emitting"+(n?" async":"")+' "'+e+'" event ('+(t?"with":"without")+" data) to "+o.length+" handler(s)");var i=Object.freeze({type:e,data:t,timestamp:Date.now()});return o.forEach(function(e,t){try{r[t]=e(i)}catch(e){r[t]=e}}),n?Promise.all(r):r},e}();t.default=u},function(e,t,n){"use strict";t.__esModule=!0,t.default=function(e,t,n){return new Promise(function(o,r){setTimeout(function(){void 0!==n?r(n):o(t)},e)})}},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0,t.Preference=t.WorkflowUserState=t.WorkflowUserRole=t.WorkflowStepState=t.ResponseStatus=t.ProofStatus=t.ProofState=t.ImportProvider=t.FileStatus=t.FileAssignee=t.CommentState=void 0;var r=n(15),i=o(r),a=n(25),s=o(a),u=n(5),f=o(u),c=n(24),l=o(c),p=n(18),d=o(p),h=n(19),y=o(h),m=n(9),w=o(m),v=n(28),_=o(v),b=n(84),E=o(b),g=n(27),O=o(g),P=n(85),I=o(P);t.CommentState=i.default,t.FileAssignee=s.default,t.FileStatus=f.default,t.ImportProvider=l.default,t.ProofState=d.default,t.ProofStatus=y.default,t.ResponseStatus=w.default,t.WorkflowStepState=_.default,t.WorkflowUserRole=E.default,t.WorkflowUserState=O.default,t.Preference=I.default},function(e,t,n){"use strict";t.__esModule=!0;var o={REVIEWER:"reviewer",MANDATORY:"mandatory",GATEKEEPER:"gatekeeper",APPROVER:"approver"};t.default=o},function(e,t,n){"use strict";t.__esModule=!0;var o={DEFAULT_DUE_DATE:"dueDate",DEFAULT_MESSAGE_TO_REVIEWERS:"messageToReviewers",ENABLE_COLOR_BLIND_UI:"colorBlind"};t.default=o},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0,t.WorkflowUser=t.WorkflowStep=t.Workflow=t.User=t.Session=t.ProofVersion=t.ProofGroup=t.Proof=t.Pin=t.File=t.Comment=void 0;var r=n(29),i=o(r),a=n(7),s=o(a),u=n(30),f=o(u),c=n(4),l=o(c),p=n(11),d=o(p),h=n(21),y=o(h),m=n(6),w=o(m),v=n(3),_=o(v),b=n(26),E=o(b),g=n(13),O=o(g),P=n(14),I=o(P);t.Comment=i.default,t.File=s.default,t.Pin=f.default,t.Proof=l.default,t.ProofGroup=d.default,t.ProofVersion=y.default,t.Session=w.default,t.User=_.default,t.Workflow=E.default,t.WorkflowStep=O.default,t.WorkflowUser=I.default}])});
|
|
9
9
|
//# sourceMappingURL=pageproof.js.map
|