"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
exports.default = void 0;
class RenderResult {
    constructor(response, dynamic){
        this._response = response;
        this._dynamic = dynamic;
    }
    async toUnchunkedString() {
        if (typeof this._response === 'string') {
            return this._response;
        }
        const chunks = [];
        await this._response.forEach((chunk)=>chunks.push(chunk)
        );
        return chunks.join('');
    }
    forEach(fn) {
        if (typeof this._response === 'string') {
            const value = this._response;
            return new Promise((resolve)=>{
                fn(value);
                resolve();
            });
        }
        return this._response.forEach(fn);
    }
    isDynamic() {
        return this._dynamic;
    }
    static fromStatic(value) {
        return new RenderResult(value, false);
    }
}
RenderResult.empty = RenderResult.fromStatic('');
exports.default = RenderResult;

//# sourceMappingURL=render-result.js.map