The canvas is in an iframe (in HTML_Widget_1) so you can’t get it from the main document (in onSceneActivated) by using document.querySelector('.fireworks');
You can delete the HTML widget and use a Custom Element instead:
Please also exclude the script JS resource from the main document because the canvas is not available when this script is invoked, and you already clone it in onSceneActivated: