function getMultiplier(e){switch(e){case"d":return 864e5;case"h":return 36e5;case"m":return 6e4;case"s":return 1e3;case"ms":return 1}return 0}function parseString(e,t){if(e.indexOf(t)+t.length!==e.length)return 0;t=new Number(e.substr(0,e.length-t.length)).valueOf()*getMultiplier(t);return t==t?t:0}function toMilliseconds(e){if("number"==typeof e)return e==e?e:0;if("string"==typeof e)return parseString(e,"d")||parseString(e,"h")||parseString(e,"m")||parseString(e,"s")||parseString(e,"ms");if("object"!=typeof e||null===e)return 0;e=e.value*getMultiplier(e.unit);return e==e?e:0}class Delay{execute(e,n){const r=toMilliseconds(e.duration);return new Promise(function(e){let t=setTimeout(function(){void 0!==t&&(e({}),t=void 0)},r);n.cancellationToken.finally(function(){void 0!==t&&(clearTimeout(t),t=void 0)})})}}Delay.action="gcx:wf:core::Delay",Delay.suite="gcx:wf:builtin";export{Delay};