const TURN_CANCELLED_ERROR_NAME=`TurnCancelledError`;var TurnCancelledError=class extends Error{constructor(t=`The turn was cancelled.`){super(t),this.name=TURN_CANCELLED_ERROR_NAME}};function isTurnCancellation(t){let n=t,r=new Set;for(;typeof n==`object`&&n&&!r.has(n);){if(r.add(n),n.name===TURN_CANCELLED_ERROR_NAME)return!0;n=n.cause}return!1}function throwIfTurnAborted(e){if(e?.aborted===!0)throw isTurnCancellation(e.reason)?e.reason:new TurnCancelledError}export{TurnCancelledError,isTurnCancellation,throwIfTurnAborted};