!function(t){"object"==typeof module&&"object"==typeof module.exports?t(require,exports):"function"==typeof define&&define.amd&&define(["require","exports","tslib","../../Errors","../../Validation","./tools","./ArcGisApiVersion","esri/request"],t)}(function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=t("tslib"),c=t("../../Errors"),p=t("../../Validation"),m=t("./tools"),f=t("./ArcGisApiVersion"),h=n.__importDefault(t("esri/request")),t=(i.prototype.execute=function(t,e){var n=p.validation.urlOrLayer(t,f.isArcGisApiVersion3x).trim(),i=p.validation.number("objectId",t.objectId,p.validation.never),a=p.validation.number("attachmentId",t.attachmentId,p.validation.never),o=p.validation.exists("attachment",t.attachment,p.validation.never),r=p.validation.string("gdbVersion",t.gdbVersion),d=p.validation.boolean("returnEditMoment",t.returnEditMoment,!1),s=p.validation.number("uploadId",t.uploadId),u=p.validation.number("timeout",t.timeout),n=m.addToPath(n,i+"/updateAttachment"),i=p.validation.string("attachmentName",t.attachmentName,"").trim();""===i&&(i=void 0);var l,t=new FormData;return t.append("f","json"),t.append("attachmentId",a.toString()),t.append("attachment",o,i),r&&t.append("gdbVersion",r),t.append("returnEditMoment",d?"true":"false"),null!=s&&t.append("uploadId",s?"true":"false"),l=f.isArcGisApiVersion3x?h.default(l={url:n,form:t,handleAs:"json",timeout:u},{usePost:!0}):(l={method:"post",body:t,responseType:"json",timeout:u,cacheBust:!1},m.isAbortable(e.cancellationToken)&&(l.signal=e.cancellationToken.signal),h.default(n,l).then(function(t){return t.data})),m.schedulePromiseCancellation(e,l),m.inline(l,function(t){t=t.updateAttachmentResult;if(!t)throw new c.GenericActivityError('Error running the "Update Attachment" activity. The response did not include the required "updateAttachmentResult" property.');return{result:t}})},i.action="gcx:wf:arcgis::UpdateAttachment",i.suite="gcx:wf:builtin",i);function i(){}e.UpdateAttachment=t});