import { completionAnimationEffect } from "./todoDecorations"
import { EditorView } from "@codemirror/view"

export const triggerTodoCompletionEffect = async (view: EditorView, pos: number) => {
  // Dispatch the completion animation effect
  view.dispatch({
    effects: completionAnimationEffect.of({ pos, duration: 1000 }),
  })

  // Only play sound in browser environment (not during SSR)
  const { zzfx } = await import("zzfx")
  zzfx(...[0.8, , 617, 0.02, 0.03, 0.18, , 3, -0.1, , 358, 0.06, -0.01, , , , 0.02, 1.09, 0.05, 0.02, -1213]) // Pickup 58 - Mutation 5
}
