import marimo

__generated_with = "0.15.2"
app = marimo.App(width="medium")


@app.cell
def _():
    import marimo as mo
    return (mo,)


@app.cell
def _():
    from mopaint import Paint
    from mohtml import img, div, tailwind_css
    return Paint, div, img


@app.cell
def _(Paint, mo):
    widget = mo.ui.anywidget(Paint(height=550))
    widget
    return (widget,)


@app.cell
def _(widget):
    widget.value
    return


@app.cell
def _(div, img, widget):
    div(
        img(src=widget.get_base64()), klass="bg-gray-200 p-4"
    )  # Use base64 representation directly with mohtml
    return


@app.cell
def _(widget):
    widget.get_pil()
    return


if __name__ == "__main__":
    app.run()
