!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 i=t("tslib"),a=t("../../Errors"),s=t("../../Validation"),d=t("./tools"),c=t("./ArcGisApiVersion"),u=i.__importDefault(t("esri/request")),t=(n.prototype.execute=function(t,e){var i,n=s.validation.urlOrLayer(t,c.isArcGisApiVersion3x).trim(),o=s.validation.number("objectId",t.objectId,s.validation.never),r=s.validation.exists("attachmentIds",t.attachment,s.validation.never),t=s.validation.number("timeout",t.timeout,void 0),n=d.addToPath(n,o+"/addAttachment"),o=new FormData;return o.append("attachment",r),o.append("f","json"),i=c.isArcGisApiVersion3x?u.default(i={url:n,form:o,handleAs:"json",timeout:t},{usePost:!0}):(i={method:"post",body:o,responseType:"json",timeout:t,cacheBust:!1},d.isAbortable(e.cancellationToken)&&(i.signal=e.cancellationToken.signal),u.default(n,i).then(function(t){return t.data})),d.schedulePromiseCancellation(e,i),d.inline(i,function(t){t=t.addAttachmentResult;if(!t)throw new a.GenericActivityError('Error running the "Add Attachment" activity. The response did not include the required "addAttachmentResult" property.');return{result:t}})},n.action="gcx:wf:arcgis::AddAttachment",n.suite="gcx:wf:builtin",n);function n(){}e.AddAttachment=t});