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:",d,"\nresponse:",S,"\nresult:",p),this.spinner.stop(),g(p,q,C,J))}),H)}),H,mxUtils.bind(this,function(q){3>t++?v.clear()&&(this.spinner.stop(),u()):H(q)}))}),H);else{var F={message:mxResources.get("error")+" "+L.getStatus()};try{F=JSON.parse(L.getText()),F=F.error}catch(S){}H(F)}}),H)}),n)});u()};EditorUi.prototype.extractMermaidMindmap=function(d){for(0<d[1].indexOf("orientation")&&d.splice(1,1);1<d.length&&""==d[1];)d.splice(1,1);
for(var g=[],n=2;n<d.length;n++){var t=mxUtils.trim(d[n]);"["!=t&&"]"!=t&&"%%"!=t.substring(0,2)&&"##"!=t.substring(0,2)&&(t=d[n].replace(/[-|>]/g," "),""!=mxUtils.trim(t)&&" "==t.charAt(0)&&g.push(t))}return"mindmap\nroot(("+mxUtils.trim(d[1])+"))\n"+g.join("\n")};EditorUi.prototype.extractMermaidDeclaration=function(d){"o\n\n"==d.substring(0,3)&&(d=d.substring(3));var g=d.split("```");g=1<g.length?g:d.split("<pre>");g=1<g.length?g:d.split("~~~");g=1<g.length?g:d.split("%%");g=1<g.length?g:d.split("(Begins)");