Should be (line 101)
if (!org.ametys.utils.Widgets._widgets[widgetType]) { throw "The type '" + widgetType + "' is unknown !"; }
widgetType instead of type