import { Task as e } from "./Task.js";
class a extends e {
  rawText;
  index = 0;
  get length() {
    return this.rawText.length;
  }
  constructor(t) {
    super(), this.rawText = t;
  }
  hasMoreConversations() {
    return this.index < this.rawText.length;
  }
  nextConversation() {
    if (this.index >= this.rawText.length)
      return null;
    const t = this.rawText[this.index];
    return this.index++, this.conversationFromString(t);
  }
  nextTokens(t) {
    const n = this.nextConversation();
    return n ? t.encodeConversation(n) : null;
  }
  shuffle() {
    this.index = 0;
  }
  conversationFromString(t) {
    const n = t.indexOf(".");
    return n === -1 ? [{
      role: "assistant",
      content: this.rawText[this.index]
    }] : [
      {
        role: "user",
        content: t.slice(0, n + 1).trim()
      },
      {
        role: "assistant",
        content: t.slice(n + 1).trim()
      }
    ];
  }
  async estimateTokens(t) {
    return (await t.encodeConversation(this.conversationFromString(this.rawText[0]))).length * this.length;
  }
}
export {
  a as default
};
