function r(t){if(!t||typeof t!="object"||Array.isArray(t))return t;if(t.runtimeException)return t.cause&&(t.cause=r(t.cause)),t;{const e={message:t.message,stack:t.stack};return t.cause&&(e.cause=r(t.cause)),e}}function n(t){if(!t)return"";let e=r(t),s;if(!e||typeof e!="object"||t.runtimeException)try{s=typeof e=="string"?e:`${JSON.stringify(e,null,"  ")}
`}catch(i){s=`<report-error>${i.message}</report-error>
`}else if(s=`
Error message: ${e.message}
`,e.stack&&(s+=`Error stack: ${e.stack}
`),e.cause)try{let i=typeof e.cause=="string"?e.cause:JSON.stringify(e.cause,null,"  ");s+=`Caused by: ${i}
`}catch(i){s+=`Caused by:
<report-error>${i.message}</report-error>
`}return s.split("\\n").join(`
`).split("\\\\").join("\\")}function c(t,e,s,i){e?it(t,a(()=>e().finally(()=>{w3n.testStand.focusThisWindow?.()})),s):it(t)}function a(t,e){return async()=>{try{await t()}catch(s){if(typeof s=="string")fail(s);else if(s.runtimeException)fail(n(s));else throw s}}}export{c as i};
