{% from "_macros.html" import icon %} {# The head, the tab strip and whichever file is in front. Everything the panel swaps, in one fragment. Both together, always: rendering only the body would leave the strip showing a tab that is no longer there after a close, and rendering only the strip would leave the previous file on screen after a switch. #}

{{ icon("file-text", "icon--sm") }} {{ doc.title if doc else "Canvas" }} {% if doc and doc.subtitle %} {{ doc.subtitle }} {% endif %}

{% if doc and doc.key.startswith("scratch:") %} {# A copy, like every other attach path -- a transcript must not change because the pad was edited afterwards. #} {% endif %}
{% include "chat/_canvas_tabs.html" %} {# Opening one by hand. A path box rather than a file browser: the model opens what it touches, which is the path this feature is really for, and a second directory browser beside the one the composer already has would be a lot of interface for the rarer case. A relative path resolves against the project directory, exactly as it does for the model. #}
{% if canvas_agent %} {# Its own form. A second control named `key` in the same one -- the Scratch button below -- would send two values for one field, and which of them the server took would be an accident. #}
{% endif %}
{% if error %} {% elif conflict %} {% include "chat/_canvas_conflict.html" %} {% elif doc %} {% include "chat/_canvas_doc.html" %} {% else %}

Nothing open. A file the model reads or writes appears here, and {% if canvas_agent %}the @ menu can put one here too.{% else %}notes, skills and this chat's own scratch document can be opened from the @ menu. {% endif %}

{% endif %}