Language: JavaScript
Label: vulnerable
CWE: CWE-79 \u2014 Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.

Code:
(EditorUi.debug("EditorUi.generateOpenAiMermaidDiagram","\nprompt:",c,"\nresponse:",S,"\nresult:",l),this.spinner.stop(),e(l,n,z,C))}),B)}),B,mxUtils.bind(this,function(n){3>q++?t.clear()&&(this.spinner.stop(),p()):B(n)}))}),B);else{var A={message:mxResources.get("error")+" "+I.getStatus()};try{A=JSON.parse(I.getText()),A=A.error}catch(S){}B(A)}}),B)}),g)});p()};EditorUi.prototype.extractMermaidMindmap=function(c){for(0<c[1].indexOf("orientation")&&c.splice(1,1);1<c.length&&""==c[1];)c.splice(1,1);
for(var e=[],g=2;g<c.length;g++){var q=mxUtils.trim(c[g]);"["!=q&&"]"!=q&&"%%"!=q.substring(0,2)&&"##"!=q.substring(0,2)&&(q=c[g].replace(/[-|>]/g," "),""!=mxUtils.trim(q)&&" "==q.charAt(0)&&e.push(q))}return"mindmap\nroot(("+mxUtils.trim(c[1])+"))\n"+e.join("\n")};EditorUi.prototype.extractMermaidDeclaration=function(c){"o\n\n"==c.substring(0,3)&&(c=c.substring(3));var e=c.split("```");e=1<e.length?e:c.split("<pre>");e=1<e.length?e:c.split("~~~");e=1<e.length?e:c.split("%%");e=1<e.length?e:c.split("(Begins)");