import{validation}from"../../Validation.js";import{ActivityInputError}from"../../Errors.js";class CreateFile{async execute(t){var e=validation.exists("content",t.content),n=validation.string("name",t.name,validation.never),t=validation.string("contentType",t.contentType);if(!(e instanceof ArrayBuffer||e instanceof Blob||"string"==typeof e))throw new ActivityInputError("content","Unsupported content. Content must be an ArrayBuffer, Blob or string.");t=this.determineContentType(t,e);return{result:this.getValidContent(e,n,t)}}determineContentType(t,e){return t||("string"==typeof e?"text/plain":"application/octet-stream")}getValidContent(e,n,r){try{return new File([e],n,{type:r})}catch(t){if(document.documentMode){const i=new Blob([e],{type:r});return i.lastModifiedDate=new Date,i.name=n,i}throw t}}}CreateFile.action="gcx:wf:core::CreateFile",CreateFile.suite="gcx:wf:builtin";export{CreateFile};