├── README.md ├── codemirror ├── addons │ ├── codemirror-addon-active-line.js │ ├── codemirror-addon-annotatescrollbar.js │ ├── codemirror-addon-anyword-hint.js │ ├── codemirror-addon-brace-fold.js │ ├── codemirror-addon-closebrackets.js │ ├── codemirror-addon-closetag.js │ ├── codemirror-addon-comment-fold.js │ ├── codemirror-addon-comment.js │ ├── codemirror-addon-continuecomment.js │ ├── codemirror-addon-css-hint.js │ ├── codemirror-addon-css-lint.js │ ├── codemirror-addon-dialog.css │ ├── codemirror-addon-dialog.js │ ├── codemirror-addon-foldcode.js │ ├── codemirror-addon-foldgutter.css │ ├── codemirror-addon-foldgutter.js │ ├── codemirror-addon-html-hint.js │ ├── codemirror-addon-html-lint.js │ ├── codemirror-addon-indent-fold.js │ ├── codemirror-addon-javascript-hint.js │ ├── codemirror-addon-javascript-lint.js │ ├── codemirror-addon-json-lint.js │ ├── codemirror-addon-jump-to-line.js │ ├── codemirror-addon-lint.css │ ├── codemirror-addon-lint.js │ ├── codemirror-addon-markdown-fold.js │ ├── codemirror-addon-match-highlighter.js │ ├── codemirror-addon-matchbrackets.js │ ├── codemirror-addon-matchesonscrollbar.css │ ├── codemirror-addon-matchesonscrollbar.js │ ├── codemirror-addon-matchtags.js │ ├── codemirror-addon-merge.css │ ├── codemirror-addon-merge.js │ ├── codemirror-addon-rulers.js │ ├── codemirror-addon-scrollpastend.js │ ├── codemirror-addon-search.js │ ├── codemirror-addon-searchcursor.js │ ├── codemirror-addon-show-hint.css │ ├── codemirror-addon-show-hint.js │ ├── codemirror-addon-simplescrollbars.css │ ├── codemirror-addon-simplescrollbars.js │ ├── codemirror-addon-xml-fold.js │ └── codemirror-addon-xml-hint.js ├── beautify │ ├── beautify-css.js │ ├── beautify-html.js │ └── beautify.js ├── codemirror.css ├── codemirror.js ├── linter │ ├── codemirror-linter-csslint.js │ ├── codemirror-linter-htmlhint.js │ ├── codemirror-linter-jshint.js │ └── codemirror-linter-jsonlint.js └── modes │ ├── codemirror-mode-css.js │ ├── codemirror-mode-gfm.js │ ├── codemirror-mode-go.js │ ├── codemirror-mode-htmlmixed.js │ ├── codemirror-mode-javascript.js │ ├── codemirror-mode-markdown.js │ └── codemirror-mode-xml.js ├── fonts ├── material-design-icons │ ├── materialdesignicons-webfont.eot │ ├── materialdesignicons-webfont.ttf │ ├── materialdesignicons-webfont.woff │ └── materialdesignicons-webfont.woff2 ├── material-icons │ ├── MaterialIcons-Regular.eot │ ├── MaterialIcons-Regular.ttf │ ├── MaterialIcons-Regular.woff │ └── MaterialIcons-Regular.woff2 ├── roboto-mono │ ├── roboto-mono-400-italic.woff │ ├── roboto-mono-400-italic.woff2 │ ├── roboto-mono-400.woff │ ├── roboto-mono-400.woff2 │ ├── roboto-mono-700-italic.woff │ ├── roboto-mono-700-italic.woff2 │ ├── roboto-mono-700.woff │ └── roboto-mono-700.woff2 └── roboto │ ├── roboto-300-italic.woff │ ├── roboto-300-italic.woff2 │ ├── roboto-300.woff │ ├── roboto-300.woff2 │ ├── roboto-400-italic.woff │ ├── roboto-400-italic.woff2 │ ├── roboto-400.woff │ ├── roboto-400.woff2 │ ├── roboto-500-italic.woff │ ├── roboto-500-italic.woff2 │ ├── roboto-500.woff │ ├── roboto-500.woff2 │ ├── roboto-700-italic.woff │ ├── roboto-700-italic.woff2 │ ├── roboto-700.woff │ └── roboto-700.woff2 ├── images ├── favicon-16x16.png ├── favicon-32x32.png ├── favicon-android-chrome-192x192.png ├── favicon-android-chrome-512x512.png ├── favicon-apple-touch-icon-180x180.png ├── favicon.ico ├── notification-icon.png └── unknown.jpg ├── index.html ├── libraries ├── FileSaver.min.js ├── Sortable.js ├── hammer-time.min.js ├── hammer.min.js ├── jszip.min.js ├── moment.min.js ├── mousetrap-global-bind.min.js └── mousetrap.min.js └── manifest.json /README.md: -------------------------------------------------------------------------------- 1 | # Codestrates 2 | 3 | [Codestrates](http://codestrates.org) is a literate computing approach to developing interactive software inspired by interactive notebooks such as [Jupyter notebook](http://jupyter.org). However, in Codestrates, real-time collaboration is built in, it is possible to create stand-alone applications with persistent state, and to reprogram the functionality of the environment it self. 4 | 5 | Codestrates builds on [Webstrates](http://webstrates.net). A web-page served from a Webstrates server is called a _webstrate_, and is a web-page where changes to the document object model (DOM) are persisted to the server and synchronized with other clients of the same page. 6 | 7 | A codestrate is a webstrate that contains everything needed for developing new content, or reprogramming the codestrate it self. So, Codestrates provides a literate computing based development environment for Webstrates. 8 | On [codestrates.org](http://codestrates.org) you can learn more about the Codestrates research project. Visit [webstrates.net](http://webstrates.net) to learn more about Webstrates. 9 | 10 | ## Installation 11 | 12 | To use Codestrates you need access to a [Webstrates](http://webstrates.net) server. Refer to the [Webstrates documentation](http://webstrates.github.io) for instructions on how to set one up. 13 | To create a new codestrate on a Webstrates server go to: 14 | 15 | ``` 16 | https://yourserver.com/new?prototypeUrl=https://github.com/Webstrates/Codestrates/archive/master.zip 17 | ``` 18 | 19 | You can also [click here](https://demo.webstrates.net/new?prototypeUrl=https://github.com/Webstrates/Codestrates/archive/master.zip) to create a new codestrate on the [demo.webstrates.net](demo.webstrates.net) server. 20 | 21 | ### Codestrate Packages 22 | 23 | The codestrate prototype in this repository provides the basic functions to use Codestrates. For extended features like a drawing canvas or collaboration features Codestrates uses a package system: Features can be added and removed from a codestrate. See the [Codestrate Packages](https://github.com/Webstrates/Codestrate-Packages) repository for basic packages and more information. 24 | 25 | ## Disclaimer 26 | 27 | Codestrates is a research prototype in active development. Many features are still experimental and yet to be properly documented. 28 | 29 | --- 30 | 31 |

© 2018 Aarhus University

32 | -------------------------------------------------------------------------------- /codemirror/addons/codemirror-addon-active-line.js: -------------------------------------------------------------------------------- 1 | (function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)})(function(e){"use strict";function t(e){for(var t=0;ts)return i.charCoords(t,"local")[e?"top":"bottom"];var n=i.heightAtLine(l,"local");return n+(e?0:l.height)}t!==!1&&this.computeScale();var i=this.cm,n=this.hScale,o=document.createDocumentFragment(),r=this.annotations,a=i.getOption("lineWrapping"),s=a&&1.5*i.defaultTextHeight(),h=null,l=null,d=i.lastLine();if(i.display.barWidth)for(var c,p=0;pd)){for(var f=c||e(u.from,!0)*n,m=e(u.to,!1)*n;pd)&&(c=e(r[p+1].from,!0)*n,!(c>m+.9));)u=r[++p],m=e(u.to,!1)*n;if(m!=f){var g=Math.max(m-f,3),H=o.appendChild(document.createElement("div"));H.style.cssText="position: absolute; right: 0px; width: "+Math.max(i.display.barWidth-1,2)+"px; top: "+(f+this.buttonHeight)+"px; height: "+g+"px",H.className=this.options.className,u.id&&H.setAttribute("annotation-id",u.id)}}}this.div.textContent="",this.div.appendChild(o)},e.prototype.clear=function(){this.cm.off("refresh",this.resizeHandler),this.cm.off("markerAdded",this.resizeHandler),this.cm.off("markerCleared",this.resizeHandler),this.changeHandler&&this.cm.off("change",this.changeHandler),this.div.parentNode.removeChild(this.div)}}); -------------------------------------------------------------------------------- /codemirror/addons/codemirror-addon-anyword-hint.js: -------------------------------------------------------------------------------- 1 | (function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)})(function(e){"use strict";var r=/[\w$]+/,t=500;e.registerHelper("hint","anyword",function(o,i){for(var n=i&&i.word||r,f=i&&i.range||t,s=o.getCursor(),a=o.getLine(s.line),c=s.ch,l=c;l&&n.test(a.charAt(l-1));)--l;for(var d=l!=c&&a.slice(l,c),u=i&&i.list||[],p={},g=new RegExp(n.source,"g"),h=-1;h<=1;h+=2)for(var m=s.line,y=Math.min(Math.max(m+h*f,o.firstLine()),o.lastLine())+h;m!=y;m+=h)for(var b,v=o.getLine(m);b=g.exec(v);)m==s.line&&b[0]===d||d&&0!=b[0].lastIndexOf(d,0)||Object.prototype.hasOwnProperty.call(p,b[0])||(p[b[0]]=!0,u.push(b[0]));return{list:u,from:e.Pos(s.line,l),to:e.Pos(s.line,c)}})}); -------------------------------------------------------------------------------- /codemirror/addons/codemirror-addon-brace-fold.js: -------------------------------------------------------------------------------- 1 | (function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)})(function(e){"use strict";e.registerHelper("fold","brace",function(r,n){function t(t){for(var f=n.ch,s=0;;){var u=f<=0?-1:l.lastIndexOf(t,f-1);if(u!=-1){if(1==s&&ur.lastLine())return null;var t=r.getTokenAt(e.Pos(n,1));if(/\S/.test(t.string)||(t=r.getTokenAt(e.Pos(n,t.end+1))),"keyword"!=t.type||"import"!=t.string)return null;for(var i=n,o=Math.min(r.lastLine(),n+10);i<=o;++i){var l=r.getLine(i),f=l.indexOf(";");if(f!=-1)return{startCh:t.end,end:e.Pos(i,f)}}}var i,o=n.line,l=t(o);if(!l||t(o-1)||(i=t(o-2))&&i.end.line==o-1)return null;for(var f=l.end;;){var s=t(f.line+1);if(null==s)break;f=s.end}return{from:r.clipPos(e.Pos(o,l.startCh+1)),to:f}}),e.registerHelper("fold","include",function(r,n){function t(n){if(nr.lastLine())return null;var t=r.getTokenAt(e.Pos(n,1));return/\S/.test(t.string)||(t=r.getTokenAt(e.Pos(n,t.end+1))),"meta"==t.type&&"#include"==t.string.slice(0,8)?t.start+8:void 0}var i=n.line,o=t(i);if(null==o||null!=t(i-1))return null;for(var l=i;;){var f=t(l+1);if(null==f)break;++l}return{from:e.Pos(i,o+1),to:r.clipPos(e.Pos(l))}})}); -------------------------------------------------------------------------------- /codemirror/addons/codemirror-addon-closebrackets.js: -------------------------------------------------------------------------------- 1 | (function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)})(function(e){function t(e,t){return"pairs"==t&&"string"==typeof e?e:"object"==typeof e&&null!=e[t]?e[t]:u[t]}function n(e){return function(t){return s(t,e)}}function r(e){var t=e.state.closeBrackets;if(!t||t.override)return t;var n=e.getModeAt(e.getCursor());return n.closeBrackets||t}function i(n){var i=r(n);if(!i||n.getOption("disableInput"))return e.Pass;for(var a=t(i,"pairs"),o=n.listSelections(),s=0;s=0;s--){var f=o[s].head;n.replaceRange("",d(f.line,f.ch-1),d(f.line,f.ch+1),"+delete")}}function a(n){var i=r(n),a=i&&t(i,"explode");if(!a||n.getOption("disableInput"))return e.Pass;for(var o=n.listSelections(),s=0;s0;return{anchor:new d(t.anchor.line,t.anchor.ch+(n?-1:1)),head:new d(t.head.line,t.head.ch+(n?1:-1))}}function s(n,i){var a=r(n);if(!a||n.getOption("disableInput"))return e.Pass;var s=t(a,"pairs"),l=s.indexOf(i);if(l==-1)return e.Pass;for(var u,g=t(a,"triples"),p=s.charAt(l+1)==i,v=n.listSelections(),m=l%2==0,b=0;b1&&g.indexOf(i)>=0&&n.getRange(d(k.line,k.ch-2),k)==i+i&&(k.ch<=2||n.getRange(d(k.line,k.ch-3),d(k.line,k.ch-2))!=i))x="addFour";else if(p){if(e.isWordChar(P)||!f(n,k,i))return e.Pass;x="both"}else{if(!m||n.getLine(k.line).length!=k.ch&&!c(P,s)&&!/\s/.test(P))return e.Pass;x="both"}else x=p&&h(n,k)?"both":g.indexOf(i)>=0&&n.getRange(k,d(k.line,k.ch+3))==i+i+i?"skipThree":"skip";if(u){if(u!=x)return e.Pass}else u=x}var S=l%2?s.charAt(l-1):i,y=l%2?i:s.charAt(l+1);n.operation(function(){if("skip"==u)n.execCommand("goCharRight");else if("skipThree"==u)for(var e=0;e<3;e++)n.execCommand("goCharRight");else if("surround"==u){for(var t=n.getSelections(),e=0;e-1&&n%2==1}function l(e,t){var n=e.getRange(d(t.line,t.ch-1),d(t.line,t.ch+1));return 2==n.length?n:null}function f(t,n,r){var i=t.getLine(n.line),a=t.getTokenAt(n);if(/\bstring2?\b/.test(a.type)||h(t,n))return!1;var o=new e.StringStream(i.slice(0,n.ch)+r+i.slice(n.ch),4);for(o.pos=o.start=a.start;;){var s=t.getMode().token(o,a.state);if(o.pos>=n.ch+1)return/\bstring2?\b/.test(s);o.start=o.pos}}function h(e,t){var n=e.getTokenAt(d(t.line,t.ch+1));return/\bstring/.test(n.type)&&n.start==t.ch}var u={pairs:"()[]{}''\"\"",triples:"",explode:"[]{}"},d=e.Pos;e.defineOption("autoCloseBrackets",!1,function(t,n,r){r&&r!=e.Init&&(t.removeKeyMap(p),t.state.closeBrackets=null),n&&(t.state.closeBrackets=n,t.addKeyMap(p))});for(var g=u.pairs+"`",p={Backspace:i,Enter:a},v=0;vc.ch&&(v=v.slice(0,v.length-d.end+c.ch));var b=v.toLowerCase();if(!v||"string"==d.type&&(d.end!=c.ch||!/[\"\']/.test(d.string.charAt(d.string.length-1))||1==d.string.length)||"tag"==d.type&&"closeTag"==g.type||d.string.indexOf("/")==d.string.length-1||h&&r(h,b)>-1||a(t,v,c,g,!0))return e.Pass;var y=p&&r(p,b)>-1;o[l]={indent:y,text:">"+(y?"\n\n":"")+"",newPos:y?e.Pos(c.line+1,0):e.Pos(c.line,c.ch+1)}}for(var l=n.length-1;l>=0;l--){var x=o[l];t.replaceRange(x.text,n[l].head,n[l].anchor,"+insert");var P=t.listSelections().slice(0);P[l]={head:x.newPos,anchor:x.newPos},t.setSelections(P),x.indent&&(t.indentLine(x.newPos.line,null,!0),t.indentLine(x.newPos.line+1,null,!0))}}function n(t,n){for(var o=t.listSelections(),r=[],i=n?"/":""!=t.getLine(l.line).charAt(c.end)&&(g+=">"),r[s]=g}t.replaceSelections(r),o=t.listSelections();for(var s=0;s'"]=function(e){return t(e)}),n.addKeyMap(i)}});var i=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],s=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];e.commands.closeTag=function(e){return n(e)}}); -------------------------------------------------------------------------------- /codemirror/addons/codemirror-addon-comment-fold.js: -------------------------------------------------------------------------------- 1 | (function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)})(function(e){"use strict";e.registerGlobalHelper("fold","comment",function(e){return e.blockCommentStart&&e.blockCommentEnd},function(t,n){var o=t.getModeAt(n),r=o.blockCommentStart,i=o.blockCommentEnd;if(r&&i){for(var f,l=n.line,c=t.getLine(l),m=n.ch,a=0;;){var d=m<=0?-1:c.lastIndexOf(r,m-1);if(d!=-1){if(1==a&&d=0;a--){var m=i[a].from(),c=i[a].to();m.line>=t||(c.line>=t&&(c=r(t,0)),t=m.line,null==o?n.uncomment(m,c,e)?o="un":(n.lineComment(m,c,e),o="line"):"un"==o?n.uncomment(m,c,e):n.lineComment(m,c,e))}}),e.defineExtension("lineComment",function(e,a,m){m||(m=l);var c=this,f=i(c,e),g=c.getLine(e.line);if(null!=g&&!t(c,e,g)){var s=m.lineComment||f.lineComment;if(!s)return void((m.blockCommentStart||f.blockCommentStart)&&(m.fullLines=!0,c.blockComment(e,a,m)));var d=Math.min(0!=a.ch||a.line==e.line?a.line+1:a.line,c.lastLine()+1),u=null==m.padding?" ":m.padding,h=m.commentBlankLines||e.line==a.line;c.operation(function(){if(m.indent){for(var t=null,i=e.line;ia.length)&&(t=a)}for(var i=e.line;ig||a.operation(function(){if(0!=t.fullLines){var i=o.test(a.getLine(g));a.replaceRange(s+f,r(g)),a.replaceRange(c+s,r(e.line,0));var l=t.blockCommentLead||m.blockCommentLead;if(null!=l)for(var d=e.line+1;d<=g;++d)(d!=g||i)&&a.replaceRange(l+s,r(d,0))}else a.replaceRange(f,n),a.replaceRange(c,e)})}}),e.defineExtension("uncomment",function(e,n,t){t||(t=l);var a,m=this,c=i(m,e),f=Math.min(0!=n.ch||n.line==e.line?n.line:n.line-1,m.lastLine()),g=Math.min(e.line,f),s=t.lineComment||c.lineComment,d=[],u=null==t.padding?" ":t.padding;e:if(s){for(var h=g;h<=f;++h){var v=m.getLine(h),p=v.indexOf(s);if(p>-1&&!/comment/.test(m.getTokenTypeAt(r(h,p+1)))&&(p=-1),p==-1&&o.test(v))break e;if(p>-1&&o.test(v.slice(0,p)))break e;d.push(v)}if(m.operation(function(){for(var e=g;e<=f;++e){var n=d[e-g],t=n.indexOf(s),i=t+s.length;t<0||(n.slice(i,i+u.length)==u&&(i+=u.length),a=!0,m.replaceRange("",r(e,t),r(e,i)))}}),a)return!0}var C=t.blockCommentStart||c.blockCommentStart,b=t.blockCommentEnd||c.blockCommentEnd;if(!C||!b)return!1;var k=t.blockCommentLead||c.blockCommentLead,L=m.getLine(g),x=L.indexOf(C);if(x==-1)return!1;var R=f==g?L:m.getLine(f),O=R.indexOf(b,f==g?x+C.length:0);O==-1&&g!=f&&(R=m.getLine(--f),O=R.indexOf(b));var T=r(g,x+1),y=r(f,O+1);if(O==-1||!/comment/.test(m.getTokenTypeAt(T))||!/comment/.test(m.getTokenTypeAt(y))||m.getRange(T,y,"\n").indexOf(b)>-1)return!1;var E=L.lastIndexOf(C,e.ch),M=E==-1?-1:L.slice(0,e.ch).indexOf(b,E+C.length);if(E!=-1&&M!=-1&&M+b.length!=e.ch)return!1;M=R.indexOf(b,n.ch);var S=R.slice(n.ch).lastIndexOf(C,M-n.ch);return E=M==-1||S==-1?-1:n.ch+S,(M==-1||E==-1||E==n.ch)&&(m.operation(function(){m.replaceRange("",r(f,O-(u&&R.slice(O-u.length,O)==u?u.length:0)),r(f,O+b.length));var e=x+C.length;if(u&&L.slice(e,e+u.length)==u&&(e+=u.length),m.replaceRange("",r(g,x),r(g,e)),k)for(var n=g+1;n<=f;++n){var t=m.getLine(n),i=t.indexOf(k);if(i!=-1&&!o.test(t.slice(0,i))){var l=i+k.length;u&&t.slice(l,l+u.length)==u&&(l+=u.length),m.replaceRange("",r(n,i),r(n,l))}}}),!0)})}); -------------------------------------------------------------------------------- /codemirror/addons/codemirror-addon-continuecomment.js: -------------------------------------------------------------------------------- 1 | (function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)})(function(e){function n(n){if(n.getOption("disableInput"))return e.Pass;for(var o,i=n.listSelections(),r=[],l=0;l=u);else if(0==s.string.indexOf(o.blockCommentStart)){if(f=d.slice(0,s.start),!/^\s*$/.test(f)){f="";for(var C=0;Cs.start&&/^\s*$/.test(d.slice(0,a))&&(f=d.slice(0,a));null!=f&&(f+=o.blockCommentContinue)}if(null==f&&o.lineComment&&t(n)){var g=n.getLine(m.line),a=g.indexOf(o.lineComment);a>-1&&(f=g.slice(0,a),/\S/.test(f)?f=null:f+=o.lineComment+g.slice(a+o.lineComment.length).match(/^\s*/)[0])}if(null==f)return e.Pass;r[l]="\n"+f}n.operation(function(){for(var e=i.length-1;e>=0;e--)n.replaceRange(r[e],i[e].from(),i[e].to(),"+insert")})}function t(e){var n=e.getOption("continueComments");return!n||"object"!=typeof n||n.continueLineComment!==!1}for(var o=["clike","css","javascript"],i=0;io.firstLine();)i=n.Pos(i.line-1,0),a=f(!1);if(a&&!a.cleared&&"unfold"!==l){var c=e(o,t);n.on(c,"mousedown",function(o){s.clear(),n.e_preventDefault(o)});var s=o.markText(a.from,a.to,{replacedWith:c,clearOnEnter:r(o,t,"clearOnEnter"),__isFold:!0});s.on("clear",function(e,r){n.signal(o,"unfold",o,e,r)}),n.signal(o,"fold",o,a.from,a.to)}}function e(n,o){var e=r(n,o,"widget");if("string"==typeof e){var i=document.createTextNode(e);e=document.createElement("span"),e.appendChild(i),e.className="CodeMirror-foldmarker"}return e}function r(n,o,e){if(o&&void 0!==o[e])return o[e];var r=n.options.foldOptions;return r&&void 0!==r[e]?r[e]:i[e]}n.newFoldFunction=function(n,e){return function(r,i){o(r,i,{rangeFinder:n,widget:e})}},n.defineExtension("foldCode",function(n,e,r){o(this,n,e,r)}),n.defineExtension("isFolded",function(n){for(var o=this.findMarksAt(n),e=0;e=d&&(e=n(i.indicatorOpen))}o.setGutterMarker(t,i.gutter,e),++f})}function f(o){var t=o.getViewport(),e=o.state.foldGutter;e&&(o.operation(function(){i(o,t.from,t.to)}),e.from=t.from,e.to=t.to)}function d(o,t,e){var n=o.state.foldGutter;if(n){var i=n.options;if(e==i.gutter){var f=r(o,t);f?f.clear():o.foldCode(c(t,0),i.rangeFinder)}}}function a(o){var t=o.state.foldGutter;if(t){var e=t.options;t.from=t.to=0,clearTimeout(t.changeUpdate),t.changeUpdate=setTimeout(function(){f(o)},e.foldOnChangeTimeSpan||600)}}function u(o){var t=o.state.foldGutter;if(t){var e=t.options;clearTimeout(t.changeUpdate),t.changeUpdate=setTimeout(function(){var e=o.getViewport();t.from==t.to||e.from-t.to>20||t.from-e.to>20?f(o):o.operation(function(){e.fromt.to&&(i(o,t.to,e.to),t.to=e.to)})},e.updateViewportTimeSpan||400)}}function l(o,t){var e=o.state.foldGutter;if(e){var r=t.line;r>=e.from&&r][<][=] [X]","device-aspect-ratio: X/Y","orientation:portrait","orientation:landscape","device-height: [X]","device-width: [X]"],i={attrs:{}},d={a:{attrs:{href:null,ping:null,type:null,media:u,target:n,hreflang:a}},abbr:i,acronym:i,address:i,applet:i,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:u,hreflang:a,type:null,shape:["default","rect","circle","poly"]}},article:i,aside:i,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["","autoplay"],loop:["","loop"],controls:["","controls"]}},b:i,base:{attrs:{href:null,target:n}},basefont:i,bdi:i,bdo:i,big:i,blockquote:{attrs:{cite:null}},body:i,br:i,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["","autofocus"],disabled:["","autofocus"],formenctype:s,formmethod:o,formnovalidate:["","novalidate"],formtarget:n,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:i,center:i,cite:i,code:i,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["","disabled"],checked:["","checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["","disabled"],multiple:["","multiple"]}},datalist:{attrs:{data:null}},dd:i,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["","open"]}},dfn:i,dir:i,div:i,dl:i,dt:i,em:i,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["","disabled"],form:null,name:null}},figcaption:i,figure:i,font:i,footer:i,form:{attrs:{action:null,name:null,"accept-charset":r,autocomplete:["on","off"],enctype:s,method:o,novalidate:["","novalidate"],target:n}},frame:i,frameset:i,h1:i,h2:i,h3:i,h4:i,h5:i,h6:i,head:{attrs:{},children:["title","base","link","style","meta","script","noscript","command"]},header:i,hgroup:i,hr:i,html:{attrs:{manifest:null},children:["head","body"]},i:i,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["","seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["","autofocus"],checked:["","checked"],disabled:["","disabled"],formenctype:s,formmethod:o,formnovalidate:["","novalidate"],formtarget:n,multiple:["","multiple"],readonly:["","readonly"],required:["","required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:i,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["","autofocus"],disabled:["","disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:i,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:a,media:u,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:i,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:r,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:i,noframes:i,noscript:i,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["","typemustmatch"]}},ol:{attrs:{reversed:["","reversed"],start:null,type:["1","a","A","i","I"]}},optgroup:{attrs:{disabled:["","disabled"],label:null}},option:{attrs:{disabled:["","disabled"],label:null,selected:["","selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:i,param:{attrs:{name:null,value:null}},pre:i,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:i,rt:i,ruby:i,s:i,samp:i,script:{attrs:{type:["text/javascript"],src:null,async:["","async"],defer:["","defer"],charset:r}},section:i,select:{attrs:{form:null,name:null,size:null,autofocus:["","autofocus"],disabled:["","disabled"],multiple:["","multiple"]}},small:i,source:{attrs:{src:null,type:null,media:null}},span:i,strike:i,strong:i,style:{attrs:{type:["text/css"],media:u,scoped:null}},sub:i,summary:i,sup:i,table:i,tbody:i,td:{attrs:{colspan:null,rowspan:null,headers:null}},textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["","autofocus"],disabled:["","disabled"],readonly:["","readonly"],required:["","required"],wrap:["soft","hard"]}},tfoot:i,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:i,time:{attrs:{datetime:null}},title:i,tr:i,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:a}},tt:i,u:i,ul:i,var:i,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["","autoplay"],mediagroup:["movie"],muted:["","muted"],controls:["","controls"]}},wbr:i},c={accesskey:["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9"],class:null,contenteditable:["true","false"],contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["en","es"],spellcheck:["true","false"],style:null,tabindex:["1","2","3","4","5","6","7","8","9"],title:null,translate:["yes","no"],onclick:null,rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"]};t(i);for(var m in d)d.hasOwnProperty(m)&&d[m]!=i&&t(d[m]);l.htmlSchema=d,l.registerHelper("hint","html",e)}); -------------------------------------------------------------------------------- /codemirror/addons/codemirror-addon-html-lint.js: -------------------------------------------------------------------------------- 1 | (function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("htmlhint")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","htmlhint"],e):e(CodeMirror,window.HTMLHint)})(function(e,r){"use strict";var o={"tagname-lowercase":!0,"attr-lowercase":!0,"attr-value-double-quotes":!0,"doctype-first":!1,"tag-pair":!0,"spec-char-escape":!0,"id-unique":!0,"src-not-empty":!0,"attr-no-duplication":!0};e.registerHelper("lint","html",function(t,i){var n=[];if(r&&!r.verify&&(r=r.HTMLHint),r||(r=window.HTMLHint),!r)return window.console&&window.console.error("Error: HTMLHint not found, not defined on window, or not available through define/require, CodeMirror HTML linting cannot run."),n;for(var a=r.verify(t,i&&i.rules||o),l=0;lo))break;r=l}}return r?{from:e.Pos(i.line,t.getLine(i.line).length),to:e.Pos(r,t.getLine(r).length)}:void 0}})}); -------------------------------------------------------------------------------- /codemirror/addons/codemirror-addon-javascript-hint.js: -------------------------------------------------------------------------------- 1 | (function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)})(function(t){function e(t,e){for(var r=0,n=t.length;ro.ch&&(s.end=o.ch,s.string=s.string.slice(0,o.ch-s.start)):s={start:o.ch,end:o.ch,string:"",state:s.state,type:"."==s.string?"property":null};for(var a=s;"property"==a.type;){if(a=n(e,l(o.line,a.start)),"."!=a.string)return;if(a=n(e,l(o.line,a.start)),!c)var c=[];c.push(a)}return{list:f(s,c,r,i),from:l(o.line,s.start),to:l(o.line,s.end)}}}function i(t,e){return n(t,g,function(t,e){return t.getTokenAt(e)},e)}function o(t,e){var r=t.getTokenAt(e);return e.ch==r.start+1&&"."==r.string.charAt(0)?(r.end=r.start,r.string=".",r.type="property"):/^\.[\w$_]*$/.test(r.string)&&(r.type="property",r.start++,r.string=r.string.replace(/\./,"")),r}function s(t,e){return n(t,d,o,e)}function a(t,e){if(Object.getOwnPropertyNames&&Object.getPrototypeOf)for(var r=t;r;r=Object.getPrototypeOf(r))Object.getOwnPropertyNames(r).forEach(e);else for(var n in t)e(n)}function f(t,n,i,o){function s(t){0!=t.lastIndexOf(g,0)||r(l,t)||l.push(t)}function f(t){"string"==typeof t?e(c,s):t instanceof Array?e(p,s):t instanceof Function&&e(u,s),a(t,s)}var l=[],g=t.string,d=o&&o.globalScope||window;if(n&&n.length){var y,h=n.pop();for(h.type&&0===h.type.indexOf("variable")?(o&&o.additionalContext&&(y=o.additionalContext[h.string]),o&&o.useGlobalScope===!1||(y=y||d[h.string])):"string"==h.type?y="":"atom"==h.type?y=1:"function"==h.type&&(null==d.jQuery||"$"!=h.string&&"jQuery"!=h.string||"function"!=typeof d.jQuery?null!=d._&&"_"==h.string&&"function"==typeof d._&&(y=d._()):y=d.jQuery());null!=y&&n.length;)y=y[n.pop().string];null!=y&&f(y)}else{for(var b=t.state.localVars;b;b=b.next)s(b.name);for(var b=t.state.globalVars;b;b=b.next)s(b.name);o&&o.useGlobalScope===!1||f(d),e(i,s)}return l}var l=t.Pos;t.registerHelper("hint","javascript",i),t.registerHelper("hint","coffeescript",s);var c="charAt charCodeAt indexOf lastIndexOf substring substr slice trim trimLeft trimRight toUpperCase toLowerCase split concat match replace search".split(" "),p="length concat join splice push pop shift unshift slice reverse sort indexOf lastIndexOf every some filter forEach map reduce reduceRight ".split(" "),u="prototype apply call bind".split(" "),g="break case catch continue debugger default delete do else false finally for function if in instanceof new null return switch throw true try typeof var void while with".split(" "),d="and break catch class continue delete do else extends false finally for if in instanceof isnt new no not null of off on or return switch then throw true try typeof until void while with yes".split(" ")}); -------------------------------------------------------------------------------- /codemirror/addons/codemirror-addon-javascript-lint.js: -------------------------------------------------------------------------------- 1 | (function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)})(function(e){"use strict";function r(e,r){if(!window.JSHINT)return window.console&&window.console.error("Error: window.JSHINT not defined, CodeMirror JavaScript linting cannot run."),[];JSHINT(e,r,r.globals);var n=JSHINT.data().errors,i=[];return n&&t(n,i),i}function n(e){return i(e,c,"warning",!0),i(e,s,"error"),o(e)?null:e}function i(e,r,n,i){var o,t,a,c,s;o=e.description;for(var d=0;d0){var f=t.character;s.forEach(function(e){f>e&&(f-=1)}),t.character=f}}var l=t.character-1,u=l+1;t.evidence&&(c=t.evidence.substring(l).search(/.\b/),c>-1&&(u+=c)),t.description=t.reason,t.start=t.character,t.end=u,t=n(t),t&&i.push({message:t.description,severity:t.severity,from:e.Pos(t.line-1,l),to:e.Pos(t.line-1,u)})}}}var a=["Dangerous comment"],c=[["Expected '{'","Statement body should be inside '{ }' braces."]],s=["Missing semicolon","Extra comma","Missing property name","Unmatched "," and instead saw"," is not defined","Unclosed string","Stopping, unable to continue"];e.registerHelper("lint","javascript",r)}); -------------------------------------------------------------------------------- /codemirror/addons/codemirror-addon-json-lint.js: -------------------------------------------------------------------------------- 1 | (function(o){"object"==typeof exports&&"object"==typeof module?o(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.registerHelper("lint","json",function(n){var r=[];if(!window.jsonlint)return window.console&&window.console.error("Error: window.jsonlint not defined, CodeMirror JSON linting cannot run."),r;jsonlint.parseError=function(n,e){var i=e.loc;r.push({from:o.Pos(i.first_line-1,i.first_column),to:o.Pos(i.last_line-1,i.last_column),message:n})};try{jsonlint.parse(n)}catch(o){}return r})}); -------------------------------------------------------------------------------- /codemirror/addons/codemirror-addon-jump-to-line.js: -------------------------------------------------------------------------------- 1 | (function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../dialog/dialog")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../dialog/dialog"],e):e(CodeMirror)})(function(e){"use strict";function o(e,o,r,i,t){e.openDialog?e.openDialog(o,t,{value:i,selectValueOnOpen:!0}):t(prompt(r,i))}function r(e,o){var r=Number(o);return/^[-+]/.test(o)?e.getCursor().line+r:r-1}var i='Jump to line: (Use line:column or scroll% syntax)';e.commands.jumpToLine=function(e){var t=e.getCursor();o(e,i,"Jump to line:",t.line+1+":"+t.ch,function(o){if(o){var i;if(i=/^\s*([\+\-]?\d+)\s*\:\s*(\d+)\s*$/.exec(o))e.setCursor(r(e,i[1]),Number(i[2]));else if(i=/^\s*([\+\-]?\d+(\.\d+)?)\%\s*/.exec(o)){var n=Math.round(e.lineCount()*Number(i[1])/100);/^[-+]/.test(i[1])&&(n=t.line+n+1),e.setCursor(n-1,t.ch)}else(i=/^\s*\:?\s*([\+\-]?\d+)\s*/.exec(o))&&e.setCursor(r(e,i[1]),t.ch)}})},e.keyMap.default["Alt-G"]="jumpToLine"}); -------------------------------------------------------------------------------- /codemirror/addons/codemirror-addon-lint.css: -------------------------------------------------------------------------------- 1 | .CodeMirror-lint-markers{width:16px}.CodeMirror-lint-tooltip{background-color:#ffd;border:1px solid #000;border-radius:4px;color:#000;font-family:monospace;font-size:10pt;overflow:hidden;padding:2px 5px;position:fixed;white-space:pre;white-space:pre-wrap;z-index:100;max-width:600px;opacity:0;transition:opacity .4s;-moz-transition:opacity .4s;-webkit-transition:opacity .4s;-o-transition:opacity .4s;-ms-transition:opacity .4s}.CodeMirror-lint-mark-error,.CodeMirror-lint-mark-warning{background-position:left bottom;background-repeat:repeat-x}.CodeMirror-lint-mark-error{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJDw4cOCW1/KIAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAHElEQVQI12NggIL/DAz/GdA5/xkY/qPKMDAwAADLZwf5rvm+LQAAAABJRU5ErkJggg==)}.CodeMirror-lint-mark-warning{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJFhQXEbhTg7YAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAMklEQVQI12NkgIIvJ3QXMjAwdDN+OaEbysDA4MPAwNDNwMCwiOHLCd1zX07o6kBVGQEAKBANtobskNMAAAAASUVORK5CYII=)}.CodeMirror-lint-marker-error,.CodeMirror-lint-marker-warning{background-position:center center;background-repeat:no-repeat;cursor:pointer;display:inline-block;height:16px;width:16px;vertical-align:middle;position:relative}.CodeMirror-lint-message-error,.CodeMirror-lint-message-warning{padding-left:18px;background-position:top left;background-repeat:no-repeat}.CodeMirror-lint-marker-error,.CodeMirror-lint-message-error{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAHlBMVEW7AAC7AACxAAC7AAC7AAAAAAC4AAC5AAD///+7AAAUdclpAAAABnRSTlMXnORSiwCK0ZKSAAAATUlEQVR42mWPOQ7AQAgDuQLx/z8csYRmPRIFIwRGnosRrpamvkKi0FTIiMASR3hhKW+hAN6/tIWhu9PDWiTGNEkTtIOucA5Oyr9ckPgAWm0GPBog6v4AAAAASUVORK5CYII=)}.CodeMirror-lint-marker-warning,.CodeMirror-lint-message-warning{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAANlBMVEX/uwDvrwD/uwD/uwD/uwD/uwD/uwD/uwD/uwD6twD/uwAAAADurwD2tQD7uAD+ugAAAAD/uwDhmeTRAAAADHRSTlMJ8mN1EYcbmiixgACm7WbuAAAAVklEQVR42n3PUQqAIBBFUU1LLc3u/jdbOJoW1P08DA9Gba8+YWJ6gNJoNYIBzAA2chBth5kLmG9YUoG0NHAUwFXwO9LuBQL1giCQb8gC9Oro2vp5rncCIY8L8uEx5ZkAAAAASUVORK5CYII=)}.CodeMirror-lint-marker-multiple{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAHCAMAAADzjKfhAAAACVBMVEUAAAAAAAC/v7914kyHAAAAAXRSTlMAQObYZgAAACNJREFUeNo1ioEJAAAIwmz/H90iFFSGJgFMe3gaLZ0od+9/AQZ0ADosbYraAAAAAElFTkSuQmCC);background-repeat:no-repeat;background-position:right bottom;width:100%;height:100%} -------------------------------------------------------------------------------- /codemirror/addons/codemirror-addon-lint.js: -------------------------------------------------------------------------------- 1 | (function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)})(function(t){"use strict";function e(e,n){function o(e){return r.parentNode?(r.style.top=Math.max(0,e.clientY-r.offsetHeight-5)+"px",void(r.style.left=e.clientX+5+"px")):t.off(document,"mousemove",o)}var r=document.createElement("div");return r.className="CodeMirror-lint-tooltip",r.appendChild(n.cloneNode(!0)),document.body.appendChild(r),t.on(document,"mousemove",o),o(e),null!=r.style.opacity&&(r.style.opacity=1),r}function n(t){t.parentNode&&t.parentNode.removeChild(t)}function o(t){t.parentNode&&(null==t.style.opacity&&n(t),t.style.opacity=0,setTimeout(function(){n(t)},600))}function r(n,r,i){function a(){t.off(i,"mouseout",a),s&&(o(s),s=null)}var s=e(n,r),u=setInterval(function(){if(s)for(var t=i;;t=t.parentNode){if(t&&11==t.nodeType&&(t=t.host),t==document.body)return;if(!t){a();break}}if(!s)return clearInterval(u)},400);t.on(i,"mouseout",a)}function i(t,e,n){this.marked=[],this.options=e,this.timeout=null,this.hasGutter=n,this.onMouseOver=function(e){v(t,e)},this.waitingFor=0}function a(t,e){return e instanceof Function?{getAnnotations:e}:(e&&e!==!0||(e={}),e)}function s(t){var e=t.state.lint;e.hasGutter&&t.clearGutter(y);for(var n=0;n1,n.options.tooltips))}}o.onUpdateLinting&&o.onUpdateLinting(e,r,t)}function h(t){var e=t.state.lint;e&&(clearTimeout(e.timeout),e.timeout=setTimeout(function(){d(t)},e.options.delay||500))}function g(t,e){for(var n=e.target||e.srcElement,o=document.createDocumentFragment(),i=0;i=e.options.minChars&&r(t,g,!1,e.options.style)}})}function c(t,e,o){var i=t.getRange(e,o);if(null!==i.match(/^\w+$/)){if(e.ch>0){var n={line:e.line,ch:e.ch-1},r=t.getRange(n,e);if(null===r.match(/\W/))return!1}if(o.ch=0&&c[i.text.charAt(o)]||c[i.text.charAt(++o)];if(!f)return null;var s=">"==f.charAt(1)?1:-1;if(r&&r.strict&&s>0!=(o==t.ch))return null;var u=e.getTokenTypeAt(a(t.line,o+1)),h=n(e,a(t.line,o+(s>0?1:0)),s,u||null,r);return null==h?null:{from:a(t.line,o),to:h&&h.pos,match:h&&h.ch==f.charAt(0),forward:s>0}}function n(e,t,n,r,i){for(var o=i&&i.maxScanLineLength||1e4,l=i&&i.maxScanLines||1e3,f=[],s=i&&i.bracketRegex?i.bracketRegex:/[(){}[\]]/,u=n>0?Math.min(t.line+l,e.lastLine()+1):Math.max(e.firstLine()-1,t.line-l),h=t.line;h!=u;h+=n){var m=e.getLine(h);if(m){var d=n>0?0:m.length-1,g=n>0?m.length:-1;if(!(m.length>o))for(h==t.line&&(d=t.ch-(n<0?1:0));d!=g;d+=n){var p=m.charAt(d);if(s.test(p)&&(void 0===r||e.getTokenTypeAt(a(h,d+1))==r)){var v=c[p];if(">"==v.charAt(1)==n>0)f.push(p);else{if(!f.length)return{pos:a(h,d),ch:p};f.pop()}}}}}return h-n!=(n>0?e.lastLine():e.firstLine())&&null}function r(e,n,r){for(var i=e.state.matchBrackets.maxHighlightLineLength||1e3,c=[],l=e.listSelections(),f=0;f",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},l=null;e.defineOption("matchBrackets",!1,function(t,n,r){r&&r!=e.Init&&(t.off("cursorActivity",i),l&&(l(),l=null)),n&&(t.state.matchBrackets="object"==typeof n?n:{},t.on("cursorActivity",i))}),e.defineExtension("matchBrackets",function(){r(this,!0)}),e.defineExtension("findMatchingBracket",function(e,n,r){return(r||"boolean"==typeof n)&&(r?(r.strict=n,n=r):n=n?{strict:!0}:null),t(this,e,n)}),e.defineExtension("scanForBracket",function(e,t,r,i){return n(this,e,t,r,i)})}); -------------------------------------------------------------------------------- /codemirror/addons/codemirror-addon-matchesonscrollbar.css: -------------------------------------------------------------------------------- 1 | .CodeMirror-search-match{background:gold;border-top:1px solid orange;border-bottom:1px solid orange;-moz-box-sizing:border-box;box-sizing:border-box;opacity:.5} -------------------------------------------------------------------------------- /codemirror/addons/codemirror-addon-matchesonscrollbar.js: -------------------------------------------------------------------------------- 1 | (function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror"),require("./searchcursor"),require("../scroll/annotatescrollbar")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./searchcursor","../scroll/annotatescrollbar"],t):t(CodeMirror)})(function(t){"use strict";function e(t,e,i,o){this.cm=t,this.options=o;var a={listenForChanges:!1};for(var n in o)a[n]=o[n];a.className||(a.className="CodeMirror-search-match"),this.annotation=t.annotateScrollbar(a),this.query=e,this.caseFold=i,this.gap={from:t.firstLine(),to:t.lastLine()+1},this.matches=[],this.update=null,this.findMatches(),this.annotation.update(this.matches);var s=this;t.on("change",this.changeHandler=function(t,e){s.onChange(e)})}function i(t,e,i){return t<=e?t:Math.max(e,t+i)}t.defineExtension("showMatchesOnScrollbar",function(t,i,o){return"string"==typeof o&&(o={className:o}),o||(o={}),new e(this,t,i,o)});var o=1e3;e.prototype.findMatches=function(){if(this.gap){for(var e=0;e=this.gap.to)break;i.to.line>=this.gap.from&&this.matches.splice(e--,1)}for(var a=this.cm.getSearchCursor(this.query,t.Pos(this.gap.from,0),this.caseFold),n=this.options&&this.options.maxMatches||o;a.findNext();){var i={from:a.from(),to:a.to()};if(i.from.line>=this.gap.to)break;if(this.matches.splice(e++,0,i),this.matches.length>n)break}this.gap=null}},e.prototype.onChange=function(e){var o=e.from.line,a=t.changeEnd(e).line,n=a-e.to.line;if(this.gap?(this.gap.from=Math.min(i(this.gap.from,o,n),e.from.line),this.gap.to=Math.max(i(this.gap.to,o,n),e.from.line)):this.gap={from:e.from.line,to:a+1},n)for(var s=0;s1){var i=e.display.scroller.clientHeight-30,o=e.getLineHandle(e.lastLine()).height;n=i-o+"px"}e.state.scrollPastEndPadding!=n&&(e.state.scrollPastEndPadding=n,e.display.lineSpace.parentNode.style.paddingBottom=n,e.off("refresh",t),e.setSize(),e.on("refresh",t))}e.defineOption("scrollPastEnd",!1,function(i,o,r){r&&r!=e.Init&&(i.off("change",n),i.off("refresh",t),i.display.lineSpace.parentNode.style.paddingBottom="",i.state.scrollPastEndPadding=null),o&&(i.on("change",n),i.on("refresh",t),t(i))})}); -------------------------------------------------------------------------------- /codemirror/addons/codemirror-addon-search.js: -------------------------------------------------------------------------------- 1 | (function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("./searchcursor"),require("../dialog/dialog")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./searchcursor","../dialog/dialog"],e):e(CodeMirror)})(function(e){"use strict";function o(e,o){return"string"==typeof e?e=new RegExp(e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),o?"gi":"g"):e.global||(e=new RegExp(e.source,e.ignoreCase?"gi":"g")),{token:function(o){e.lastIndex=o.pos;var n=e.exec(o.string);return n&&n.index==o.pos?(o.pos+=n[0].length||1,"searching"):void(n?o.pos=n.index:o.skipToEnd())}}}function n(){this.posFrom=this.posTo=this.lastQuery=this.query=null,this.overlay=null}function t(e){return e.state.search||(e.state.search=new n)}function r(e){return"string"==typeof e&&e==e.toLowerCase()}function i(e,o,n){return e.getSearchCursor(o,n,{caseFold:r(o),multiline:!0})}function a(e,o,n,t,r){e.openDialog(o,t,{value:n,selectValueOnOpen:!0,closeOnEnter:!1,onClose:function(){y(e)},onKeyDown:r})}function s(e,o,n,t,r){e.openDialog?e.openDialog(o,r,{value:t,selectValueOnOpen:!0}):r(prompt(n,t))}function c(e,o,n,t){e.openConfirm?e.openConfirm(o,t):confirm(n)&&t[0]()}function l(e){return e.replace(/\\(.)/g,function(e,o){return"n"==o?"\n":"r"==o?"\r":o})}function u(e){var o=e.match(/^\/(.*)\/([a-z]*)$/);if(o)try{e=new RegExp(o[1],o[2].indexOf("i")==-1?"":"i")}catch(e){}else e=l(e);return("string"==typeof e?""==e:e.test(""))&&(e=/x^/),e}function f(e,n,t){n.queryText=t,n.query=u(t),e.removeOverlay(n.overlay,r(n.query)),n.overlay=o(n.query,r(n.query)),e.addOverlay(n.overlay),e.showMatchesOnScrollbar&&(n.annotate&&(n.annotate.clear(),n.annotate=null),n.annotate=e.showMatchesOnScrollbar(n.query,r(n.query)))}function p(o,n,r,i){var c=t(o);if(c.query)return d(o,n);var l=o.getSelection()||c.lastQuery;if(r&&o.openDialog){var u=null,p=function(n,t){e.e_stop(t),n&&(n!=c.queryText&&(f(o,c,n),c.posFrom=c.posTo=o.getCursor()),u&&(u.style.opacity=1),d(o,t.shiftKey,function(e,n){var t;n.line<3&&document.querySelector&&(t=o.display.wrapper.querySelector(".CodeMirror-dialog"))&&t.getBoundingClientRect().bottom-4>o.cursorCoords(n,"window").top&&((u=t).style.opacity=.4)}))};a(o,h,l,p,function(n,r){var i=e.keyName(n),a=e.keyMap[o.getOption("keyMap")][i];a||(a=o.getOption("extraKeys")[i]),"findNext"==a||"findPrev"==a||"findPersistentNext"==a||"findPersistentPrev"==a?(e.e_stop(n),f(o,t(o),r),o.execCommand(a)):"find"!=a&&"findPersistent"!=a||(e.e_stop(n),p(r,n))}),i&&l&&(f(o,c,l),d(o,n))}else s(o,h,"Search for:",l,function(e){e&&!c.query&&o.operation(function(){f(o,c,e),c.posFrom=c.posTo=o.getCursor(),d(o,n)})})}function d(o,n,r){o.operation(function(){var a=t(o),s=i(o,a.query,n?a.posFrom:a.posTo);(s.find(n)||(s=i(o,a.query,n?e.Pos(o.lastLine()):e.Pos(o.firstLine(),0)),s.find(n)))&&(o.setSelection(s.from(),s.to()),o.scrollIntoView({from:s.from(),to:s.to()},20),a.posFrom=s.from(),a.posTo=s.to(),r&&r(s.from(),s.to()))})}function y(e){e.operation(function(){var o=t(e);o.lastQuery=o.query,o.query&&(o.query=o.queryText=null,e.removeOverlay(o.overlay),o.annotate&&(o.annotate.clear(),o.annotate=null))})}function m(e,o,n){e.operation(function(){for(var t=i(e,o);t.findNext();)if("string"!=typeof o){var r=e.getRange(t.from(),t.to()).match(o);t.replace(n.replace(/\$(\d)/g,function(e,o){return r[o]}))}else t.replace(n)})}function g(e,o){if(!e.getOption("readOnly")){var n=e.getSelection()||t(e).lastQuery,r=''+(o?"Replace all:":"Replace:")+"";s(e,r+v,r,n,function(n){n&&(n=u(n),s(e,x,"Replace with:","",function(t){if(t=l(t),o)m(e,n,t);else{y(e);var r=i(e,n,e.getCursor("from")),a=function(){var o,l=r.from();!(o=r.findNext())&&(r=i(e,n),!(o=r.findNext())||l&&r.from().line==l.line&&r.from().ch==l.ch)||(e.setSelection(r.from(),r.to()),e.scrollIntoView({from:r.from(),to:r.to()}),c(e,C,"Replace?",[function(){s(o)},a,function(){m(e,n,t)}]))},s=function(e){r.replace("string"==typeof n?t:t.replace(/\$(\d)/g,function(o,n){return e[n]})),a()};a()}}))})}}var h='Search: (Use /re/ syntax for regexp search)',v=' (Use /re/ syntax for regexp search)',x='With: ',C='Replace? ';e.commands.find=function(e){y(e),p(e)},e.commands.findPersistent=function(e){y(e),p(e,!1,!0)},e.commands.findPersistentNext=function(e){p(e,!1,!0,!0)},e.commands.findPersistentPrev=function(e){p(e,!0,!0,!0)},e.commands.findNext=p,e.commands.findPrev=function(e){p(e,!0)},e.commands.clearSearch=y,e.commands.replace=g,e.commands.replaceAll=function(e){g(e,!0)}}); -------------------------------------------------------------------------------- /codemirror/addons/codemirror-addon-searchcursor.js: -------------------------------------------------------------------------------- 1 | (function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)})(function(t){"use strict";function n(t){var n=t.flags;return null!=n?n:(t.ignoreCase?"i":"")+(t.global?"g":"")+(t.multiline?"m":"")}function e(t){return t.global?t:new RegExp(t.source,n(t)+"g")}function i(t){return/\\s|\\n|\n|\\W|\\D|\[\^/.test(t.source)}function r(t,n,i){n=e(n);for(var r=i.line,o=i.ch,l=t.lastLine();r<=l;r++,o=0){n.lastIndex=o;var h=t.getLine(r),s=n.exec(h);if(s)return{from:v(r,s.index),to:v(r,s.index+s[0].length),match:s}}}function o(t,n,o){if(!i(n))return r(t,n,o);n=e(n);for(var l,h=1,s=o.line,c=t.lastLine();s<=c;){for(var f=0;f=h;r--,o=-1){var s=t.getLine(r);o>-1&&(s=s.slice(0,o));var c=l(s,n);if(c)return{from:v(r,c.index),to:v(r,c.index+c[0].length),match:c}}}function s(t,n,i){n=e(n);for(var r,o=1,h=i.line,s=t.firstLine();h>=s;){for(var c=0;ce))return r;--r}}}function f(t,n,e,i){if(!n.length)return null;var r=i?g:m,o=r(n).split(/\r|\n\r?/);t:for(var l=e.line,h=e.ch,s=t.lastLine()+1-o.length;l<=s;l++,h=0){var f=t.getLine(l).slice(h),u=r(f);if(1==o.length){var a=u.indexOf(o[0]);if(a==-1)continue t;var e=c(f,u,a,r)+h;return{from:v(l,c(f,u,a,r)+h),to:v(l,c(f,u,a+o[0].length,r)+h)}}var d=u.length-o[0].length;if(u.slice(d)==o[0]){for(var p=1;p=s;l--,h=-1){var f=t.getLine(l);h>-1&&(f=f.slice(0,h));var u=r(f);if(1==o.length){var a=u.lastIndexOf(o[0]);if(a==-1)continue t;return{from:v(l,c(f,u,a,r)),to:v(l,c(f,u,a+o[0].length,r))}}var d=o[o.length-1];if(u.slice(0,d.length)==d){for(var p=1,e=l-o.length+1;p0);)i.push({anchor:r.from(),head:r.to()});i.length&&this.setSelections(i,0)})}); -------------------------------------------------------------------------------- /codemirror/addons/codemirror-addon-show-hint.css: -------------------------------------------------------------------------------- 1 | .CodeMirror-hints{position:absolute;z-index:10;overflow:hidden;list-style:none;margin:0;padding:2px;-webkit-box-shadow:2px 3px 5px rgba(0,0,0,.2);-moz-box-shadow:2px 3px 5px rgba(0,0,0,.2);box-shadow:2px 3px 5px rgba(0,0,0,.2);border-radius:3px;border:1px solid silver;background:#fff;font-size:90%;font-family:monospace;max-height:20em;overflow-y:auto}.CodeMirror-hint{margin:0;padding:0 4px;border-radius:2px;white-space:pre;color:#000;cursor:pointer}li.CodeMirror-hint-active{background:#08f;color:#fff} -------------------------------------------------------------------------------- /codemirror/addons/codemirror-addon-show-hint.js: -------------------------------------------------------------------------------- 1 | (function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)})(function(t){"use strict";function i(t,i){this.cm=t,this.options=i,this.widget=null,this.debounce=0,this.tick=0,this.startPos=this.cm.getCursor("start"),this.startLen=this.cm.getLine(this.startPos.line).length-this.cm.getSelection().length;var e=this;t.on("cursorActivity",this.activityFunc=function(){e.cursorActivity()})}function e(i,e){var n=t.cmpPos(e.from,i.from);return n>0&&i.to.ch-i.from.ch!=e.to.ch-e.from.ch}function n(t,i,e){var n=t.options.hintOptions,o={};for(var s in m)o[s]=m[s];if(n)for(var s in n)void 0!==n[s]&&(o[s]=n[s]);if(e)for(var s in e)void 0!==e[s]&&(o[s]=e[s]);return o.hint.resolve&&(o.hint=o.hint.resolve(t,i)),o}function o(t){return"string"==typeof t?t:t.text}function s(t,i){function e(t,e){var o;o="string"!=typeof e?function(t){return e(t,i)}:n.hasOwnProperty(e)?n[e]:e,s[t]=o}var n={Up:function(){i.moveFocus(-1)},Down:function(){i.moveFocus(1)},PageUp:function(){i.moveFocus(-i.menuSize()+1,!0)},PageDown:function(){i.moveFocus(i.menuSize()-1,!0)},Home:function(){i.setFocus(0)},End:function(){i.setFocus(i.length-1)},Enter:i.pick,Tab:i.pick,Esc:i.close},o=t.options.customKeys,s=o?{}:n;if(o)for(var c in o)o.hasOwnProperty(c)&&e(c,o[c]);var r=t.options.extraKeys;if(r)for(var c in r)r.hasOwnProperty(c)&&e(c,r[c]);return s}function c(t,i){for(;i&&i!=t;){if("LI"===i.nodeName.toUpperCase()&&i.parentNode==t)return i;i=i.parentNode}}function r(i,e){this.completion=i,this.data=e,this.picked=!1;var n=this,r=i.cm,h=this.hints=document.createElement("ul");h.className="CodeMirror-hints",this.selectedHint=e.selectedHint||0;for(var l=e.list,a=0;ah.clientHeight+1,A=r.getScrollInfo();if(b>0){var S=C.bottom-C.top,T=g.top-(g.bottom-C.top);if(T-S>0)h.style.top=(y=g.top-S)+"px",w=!1;else if(S>k){h.style.height=k-5+"px",h.style.top=(y=g.bottom-C.top)+"px";var M=r.getCursor();e.from.ch!=M.ch&&(g=r.cursorCoords(M),h.style.left=(v=g.left)+"px",C=h.getBoundingClientRect())}}var F=C.right-H;if(F>0&&(C.right-C.left>H&&(h.style.width=H-5+"px",F-=C.right-C.left-H),h.style.left=(v=g.left-F)+"px"),x)for(var N=h.firstChild;N;N=N.nextSibling)N.style.paddingRight=r.display.nativeBarWidth+"px";if(r.addKeyMap(this.keyMap=s(i,{moveFocus:function(t,i){n.changeActive(n.selectedHint+t,i)},setFocus:function(t){n.changeActive(t)},menuSize:function(){return n.screenAmount()},length:l.length,close:function(){i.close()},pick:function(){n.pick()},data:e})),i.options.closeOnUnfocus){var E;r.on("blur",this.onBlur=function(){E=setTimeout(function(){i.close()},100)}),r.on("focus",this.onFocus=function(){clearTimeout(E)})}return r.on("scroll",this.onScroll=function(){var t=r.getScrollInfo(),e=r.getWrapperElement().getBoundingClientRect(),n=y+A.top-t.top,o=n-(window.pageYOffset||(document.documentElement||document.body).scrollTop);return w||(o+=h.offsetHeight),o<=e.top||o>=e.bottom?i.close():(h.style.top=n+"px",void(h.style.left=v+A.left-t.left+"px"))}),t.on(h,"dblclick",function(t){var i=c(h,t.target||t.srcElement);i&&null!=i.hintId&&(n.changeActive(i.hintId),n.pick())}),t.on(h,"click",function(t){var e=c(h,t.target||t.srcElement);e&&null!=e.hintId&&(n.changeActive(e.hintId),i.options.completeOnSingleClick&&n.pick())}),t.on(h,"mousedown",function(){setTimeout(function(){r.focus()},20)}),t.signal(e,"select",l[0],h.firstChild),!0}function h(t,i){if(!t.somethingSelected())return i;for(var e=[],n=0;n0?i(t):n(o+1)})}var s=h(t,o);n(0)};return s.async=!0,s.supportsSelection=!0,s}return(n=i.getHelper(i.getCursor(),"hintWords"))?function(i){return t.hint.fromList(i,{words:n})}:t.hint.anyword?function(i,e){return t.hint.anyword(i,e)}:function(){}}var u="CodeMirror-hint",f="CodeMirror-hint-active";t.showHint=function(t,i,e){if(!i)return t.showHint(e);e&&e.async&&(i.async=!0);var n={hint:i};if(e)for(var o in e)n[o]=e[o];return t.showHint(n)},t.defineExtension("showHint",function(e){e=n(this,this.getCursor("start"),e);var o=this.listSelections();if(!(o.length>1)){if(this.somethingSelected()){if(!e.hint.supportsSelection)return;for(var s=0;s=this.data.list.length?i=e?this.data.list.length-1:0:i<0&&(i=e?0:this.data.list.length-1),this.selectedHint!=i){var n=this.hints.childNodes[this.selectedHint];n.className=n.className.replace(" "+f,""),n=this.hints.childNodes[this.selectedHint=i],n.className+=" "+f,n.offsetTopthis.hints.scrollTop+this.hints.clientHeight&&(this.hints.scrollTop=n.offsetTop+n.offsetHeight-this.hints.clientHeight+3),t.signal(this.data,"select",this.data.list[this.selectedHint],n)}},screenAmount:function(){return Math.floor(this.hints.clientHeight/this.hints.firstChild.offsetHeight)||1}},t.registerHelper("hint","auto",{resolve:a}),t.registerHelper("hint","fromList",function(i,e){var n=i.getCursor(),o=i.getTokenAt(n),s=t.Pos(n.line,o.end);if(o.string&&/\w/.test(o.string[o.string.length-1]))var c=o.string,r=t.Pos(n.line,o.start);else var c="",r=s;for(var h=[],l=0;l,]/,closeOnUnfocus:!0,completeOnSingleClick:!0,container:null,customKeys:null,extraKeys:null};t.defineOption("hintOptions",null)}); -------------------------------------------------------------------------------- /codemirror/addons/codemirror-addon-simplescrollbars.css: -------------------------------------------------------------------------------- 1 | .CodeMirror-simplescroll-horizontal div,.CodeMirror-simplescroll-vertical div{position:absolute;background:#ccc;-moz-box-sizing:border-box;box-sizing:border-box;border:1px solid #bbb;border-radius:2px}.CodeMirror-simplescroll-horizontal,.CodeMirror-simplescroll-vertical{position:absolute;z-index:6;background:#eee}.CodeMirror-simplescroll-horizontal{bottom:0;left:0;height:8px}.CodeMirror-simplescroll-horizontal div{bottom:0;height:100%}.CodeMirror-simplescroll-vertical{right:0;top:0;width:8px}.CodeMirror-simplescroll-vertical div{right:0;width:100%}.CodeMirror-overlayscroll .CodeMirror-gutter-filler,.CodeMirror-overlayscroll .CodeMirror-scrollbar-filler{display:none}.CodeMirror-overlayscroll-horizontal div,.CodeMirror-overlayscroll-vertical div{position:absolute;background:#bcd;border-radius:3px}.CodeMirror-overlayscroll-horizontal,.CodeMirror-overlayscroll-vertical{position:absolute;z-index:6}.CodeMirror-overlayscroll-horizontal{bottom:0;left:0;height:6px}.CodeMirror-overlayscroll-horizontal div{bottom:0;height:100%}.CodeMirror-overlayscroll-vertical{right:0;top:0;width:6px}.CodeMirror-overlayscroll-vertical div{right:0;width:100%} -------------------------------------------------------------------------------- /codemirror/addons/codemirror-addon-simplescrollbars.js: -------------------------------------------------------------------------------- 1 | (function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)})(function(t){"use strict";function e(e,o,i){function n(e){var o=t.wheelEventPixels(e)["horizontal"==s.orientation?"x":"y"],i=s.pos;s.moveTo(s.pos+o),s.pos!=i&&t.e_preventDefault(e)}this.orientation=o,this.scroll=i,this.screen=this.total=this.size=1,this.pos=0,this.node=document.createElement("div"),this.node.className=e+"-"+o,this.inner=this.node.appendChild(document.createElement("div"));var s=this;t.on(this.inner,"mousedown",function(e){function o(){t.off(document,"mousemove",i),t.off(document,"mouseup",o)}function i(t){return 1!=t.which?o():void s.moveTo(h+(t[n]-r)*(s.total/s.size))}if(1==e.which){t.e_preventDefault(e);var n="horizontal"==s.orientation?"pageX":"pageY",r=e[n],h=s.pos;t.on(document,"mousemove",i),t.on(document,"mouseup",o)}}),t.on(this.node,"click",function(e){t.e_preventDefault(e);var o,i=s.inner.getBoundingClientRect();o="horizontal"==s.orientation?e.clientXi.right?1:0:e.clientYi.bottom?1:0,s.moveTo(s.pos+o*s.screen)}),t.on(this.node,"mousewheel",n),t.on(this.node,"DOMMouseScroll",n)}function o(t,o,i){this.addClass=t,this.horiz=new e(t,"horizontal",i),o(this.horiz.node),this.vert=new e(t,"vertical",i),o(this.vert.node),this.width=null}e.prototype.setPos=function(t,e){return t<0&&(t=0),t>this.total-this.screen&&(t=this.total-this.screen),!(!e&&t==this.pos)&&(this.pos=t,this.inner.style["horizontal"==this.orientation?"left":"top"]=t*(this.size/this.total)+"px",!0)},e.prototype.moveTo=function(t){this.setPos(t)&&this.scroll(t,this.orientation)};var i=10;e.prototype.update=function(t,e,o){var n=this.screen!=e||this.total!=t||this.size!=o;n&&(this.screen=e,this.total=t,this.size=o);var s=this.screen*(this.size/this.total);st.clientWidth+1,n=t.scrollHeight>t.clientHeight+1;return this.vert.node.style.display=n?"block":"none",this.horiz.node.style.display=i?"block":"none",n&&(this.vert.update(t.scrollHeight,t.clientHeight,t.viewHeight-(i?o:0)),this.vert.node.style.bottom=i?o+"px":"0"),i&&(this.horiz.update(t.scrollWidth,t.clientWidth,t.viewWidth-(n?o:0)-t.barLeft),this.horiz.node.style.right=n?o+"px":"0",this.horiz.node.style.left=t.barLeft+"px"),{right:n?o:0,bottom:i?o:0}},o.prototype.setScrollTop=function(t){this.vert.setPos(t)},o.prototype.setScrollLeft=function(t){this.horiz.setPos(t)},o.prototype.clear=function(){var t=this.horiz.node.parentNode;t.removeChild(this.horiz.node),t.removeChild(this.vert.node)},t.scrollbarModel.simple=function(t,e){return new o("CodeMirror-simplescroll",t,e)},t.scrollbarModel.overlay=function(t,e){return new o("CodeMirror-overlayscroll",t,e)}}); -------------------------------------------------------------------------------- /codemirror/addons/codemirror-addon-xml-fold.js: -------------------------------------------------------------------------------- 1 | (function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)})(function(e){"use strict";function n(e,n){return e.line-n.line||e.ch-n.ch}function t(e,n,t,i){this.line=n,this.ch=t,this.cm=e,this.text=e.getLine(n),this.min=i?Math.max(i.from,e.firstLine()):e.firstLine(),this.max=i?Math.min(i.to-1,e.lastLine()):e.lastLine()}function i(e,n){var t=e.cm.getTokenTypeAt(h(e.line,n));return t&&/\btag\b/.test(t)}function r(e){if(!(e.line>=e.max))return e.ch=0,e.text=e.cm.getLine(++e.line),!0}function f(e){if(!(e.line<=e.min))return e.text=e.cm.getLine(--e.line),e.ch=e.text.length,!0}function o(e){for(;;){var n=e.text.indexOf(">",e.ch);if(n==-1){if(r(e))continue;return}{if(i(e,n+1)){var t=e.text.lastIndexOf("/",n),f=t>-1&&!/\S/.test(e.text.slice(t+1,n));return e.ch=n+1,f?"selfClose":"regular"}e.ch=n+1}}}function u(e){for(;;){var n=e.ch?e.text.lastIndexOf("<",e.ch-1):-1;if(n==-1){if(f(e))continue;return}if(i(e,n+1)){v.lastIndex=n,e.ch=n;var t=v.exec(e.text);if(t&&t.index==n)return t}else e.ch=n}}function l(e){for(;;){v.lastIndex=e.ch;var n=v.exec(e.text);if(!n){if(r(e))continue;return}{if(i(e,n.index+1))return e.ch=n.index+n[0].length,n;e.ch=n.index+1}}}function c(e){for(;;){var n=e.ch?e.text.lastIndexOf(">",e.ch-1):-1;if(n==-1){if(f(e))continue;return}{if(i(e,n+1)){var t=e.text.lastIndexOf("/",n),r=t>-1&&!/\S/.test(e.text.slice(t+1,n));return e.ch=n+1,r?"selfClose":"regular"}e.ch=n}}}function a(e,n){for(var t=[];;){var i,r=l(e),f=e.line,u=e.ch-(r?r[0].length:0);if(!r||!(i=o(e)))return;if("selfClose"!=i)if(r[1]){for(var c=t.length-1;c>=0;--c)if(t[c]==r[2]){t.length=c;break}if(c<0&&(!n||n==r[2]))return{tag:r[2],from:h(f,u),to:h(e.line,e.ch)}}else t.push(r[2])}}function s(e,n){for(var t=[];;){var i=c(e);if(!i)return;if("selfClose"!=i){var r=e.line,f=e.ch,o=u(e);if(!o)return;if(o[1])t.push(o[2]);else{for(var l=t.length-1;l>=0;--l)if(t[l]==o[2]){t.length=l;break}if(l<0&&(!n||n==o[2]))return{tag:o[2],from:h(e.line,e.ch),to:h(r,f)}}}else u(e)}}var h=e.Pos,x="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",g=x+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",v=new RegExp("<(/?)(["+x+"]["+g+"]*)","g");e.registerHelper("fold","xml",function(e,n){for(var i=new t(e,n.line,0);;){var r,f=l(i);if(!f||i.line!=n.line||!(r=o(i)))return;if(!f[1]&&"selfClose"!=r){var u=h(i.line,i.ch),c=a(i,f[2]);return c&&{from:u,to:c.from}}}}),e.findMatchingTag=function(e,i,r){var f=new t(e,i.line,i.ch,r);if(f.text.indexOf(">")!=-1||f.text.indexOf("<")!=-1){var l=o(f),c=l&&h(f.line,f.ch),x=l&&u(f);if(l&&x&&!(n(f,i)>0)){var g={from:h(f.line,f.ch),to:c,tag:x[2]};return"selfClose"==l?{open:g,close:null,at:"open"}:x[1]?{open:s(f,x[2]),close:g,at:"close"}:(f=new t(e,c.line,c.ch,r),{open:g,close:a(f,x[2]),at:"open"})}}},e.findEnclosingTag=function(e,n,i,r){for(var f=new t(e,n.line,n.ch,i);;){var o=s(f,r);if(!o)break;var u=new t(e,n.line,n.ch,i),l=a(u,o.tag);if(l)return{open:o,close:l}}},e.scanForClosingTag=function(e,n,i,r){var f=new t(e,n.line,n.ch,r?{from:0,to:r}:null);return a(f,i)}}); -------------------------------------------------------------------------------- /codemirror/addons/codemirror-addon-xml-hint.js: -------------------------------------------------------------------------------- 1 | (function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)})(function(t){"use strict";function e(e,s){var n=s&&s.schemaInfo,a=s&&s.quoteChar||'"';if(n){var i=e.getCursor(),o=e.getTokenAt(i);o.end>i.ch&&(o.end=i.ch,o.string=o.string.slice(0,i.ch-o.start));var l=t.innerMode(e.getMode(),o.state);if("xml"==l.mode.name){var f,g,c=[],h=!1,p=/\btag\b/.test(o.type)&&!/>$/.test(o.string),u=p&&/^\w/.test(o.string);if(u){var d=e.getLine(i.line).slice(Math.max(0,o.start-2),o.start),m=/<\/$/.test(d)?"close":/<$/.test(d)?"open":null;m&&(g=o.start-("close"==m?2:1))}else p&&"<"==o.string?m="open":p&&"")}else{var y=n[l.state.tagName],w=y&&y.attrs,I=n["!attrs"];if(!w&&!I)return;if(w){if(I){var P={};for(var A in I)I.hasOwnProperty(A)&&(P[A]=I[A]);for(var A in w)w.hasOwnProperty(A)&&(P[A]=w[A]);w=P}}else w=I;if("string"==o.type||"="==o.string){var M,d=e.getRange(r(i.line,Math.max(0,i.ch-60)),r(i.line,"string"==o.type?o.start:o.end)),N=d.match(/([^\s\u00a0=<>\"\']+)=$/);if(!N||!w.hasOwnProperty(N[1])||!(M=w[N[1]]))return;if("function"==typeof M&&(M=M.call(this,e)),"string"==o.type){f=o.string;var $=0;/['"]/.test(o.string.charAt(0))&&(a=o.string.charAt(0),f=o.string.slice(1),$++);var C=o.string.length;/['"]/.test(o.string.charAt(C-1))&&(a=o.string.charAt(C-1),f=o.string.substr($,C-2)),h=!0}for(var O=0;O0&&N--}n=n||{},n=r(n,"css"),e=e||"";var v=0,m=n.indent_size?parseInt(n.indent_size,10):4,k=n.indent_char||" ",y=void 0!==n.preserve_newlines&&n.preserve_newlines,x=void 0===n.selector_separator_newline||n.selector_separator_newline,O=void 0!==n.end_with_newline&&n.end_with_newline,j=void 0===n.newline_between_rules||n.newline_between_rules,E=void 0!==n.space_around_combinator&&n.space_around_combinator;E=E||void 0!==n.space_around_selector_separator&&n.space_around_selector_separator;var L=n.eol?n.eol:"auto";n.indent_with_tabs&&(k="\t",m=1),"auto"===L&&(L="\n",e&&u.test(e||"")&&(L=e.match(u)[0])),L=L.replace(/\\r/,"\r").replace(/\\n/,"\n"),e=e.replace(_,"\n");var A,I=/^\s+$/,R=-1,C=0,B="",S=0;if(e&&e.length){for(;" "===e.charAt(S)||"\t"===e.charAt(S);)S+=1;B=e.substring(0,S),js_source_text=e.substring(S)}var N,T,U,$=new Array(m+1).join(k);this.beautify=function(){U=new o($,B),N=0,T=0,R=-1,A=null,C=0;for(var e=!1,n=!1,r=!1,u="",_="";;){var m=f(),k=""!==m,y=m.indexOf("\n")!==-1;if(_=u,u=A,!A)break;if("/"===A&&"*"===i()){var S=0===N;(y||S)&&U.add_new_line(),p(l()),U.add_new_line(),S&&U.add_new_line(!0)}else if("/"===A&&"/"===i())y||"{"===_||U.trim(!0),U.space_before_token=!0,p(l()),U.add_new_line();else if("@"===A)if(g(k),"{"===i())p(s("}"));else{p(A);var D=a(": ,;{}()[]/='\"");D.match(/[ :]$/)&&(t(),D=s(": ").replace(/\s$/,""),p(D),U.space_before_token=!0),D=D.replace(/\s$/,""),D in this.NESTED_AT_RULE&&(T+=1,D in this.CONDITIONAL_GROUP_RULE&&(r=!0))}else"#"===A&&"{"===i()?(g(k),p(s("}"))):"{"===A?"}"===i(!0)?(c(),t(),U.space_before_token=!0,p("{}"),c(!0)||U.add_new_line(),v<2&&j&&0===N&&U.add_new_line(!0)):(w(),U.space_before_token=!0,p(A),c(!0)||U.add_new_line(),r?(r=!1,e=N>T):e=N>=T):"}"===A?(b(),U.add_new_line(),p(A),e=!1,n=!1,T&&T--,c(!0)||U.add_new_line(),v<2&&j&&0===N&&U.add_new_line(!0)):":"===A?(c(),!e&&!r||d("&")||h()||d("(")?(d(" ")&&(U.space_before_token=!0),":"===i()?(t(),p("::")):p(":")):(p(":"),n||(n=!0,U.space_before_token=!0))):'"'===A||"'"===A?(g(k),p(s(A))):";"===A?(n=!1,p(A),c(!0)||U.add_new_line()):"("===A?d("url")?(p(A),c(),t()&&(")"!==A&&'"'!==A&&"'"!==A?p(s(")")):R--)):(C++,g(k),p(A),c()):")"===A?(p(A),C--):","===A?(p(A),!c(!0)&&x&&!n&&C<1?U.add_new_line():U.space_before_token=!0):(">"===A||"+"===A||"~"===A)&&!n&&C<1?E?(U.space_before_token=!0,p(A),U.space_before_token=!0):(p(A),c(),A&&I.test(A)&&(A="")):"]"===A?p(A):"["===A?(g(k),p(A)):"="===A?(c(),p("="),I.test(A)&&(A="")):(g(k),p(A))}var P=U.get_code(O,L);return P},this.NESTED_AT_RULE={"@page":!0,"@font-face":!0,"@keyframes":!0,"@media":!0,"@supports":!0,"@document":!0},this.CONDITIONAL_GROUP_RULE={"@media":!0,"@supports":!0,"@document":!0}}var r=t(2).mergeOpts,s=t(1),o=t(3).Output,u=s.lineBreak,_=s.allLineBreaks;e.exports.Beautifier=i},function(e,n){var t="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛰᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々-〇〡-〩〱-〵〸-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",i="̀-ͯ҃-֑҇-ׇֽֿׁׂׅׄؐ-ؚؠ-ىٲ-ۓۧ-ۨۻ-ۼܰ-݊ࠀ-ࠔࠛ-ࠣࠥ-ࠧࠩ-࠭ࡀ-ࡗࣤ-ࣾऀ-ःऺ-़ा-ॏ॑-ॗॢ-ॣ०-९ঁ-ঃ়া-ৄেৈৗয়-ৠਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢ-ૣ૦-૯ଁ-ଃ଼ା-ୄେୈୋ-୍ୖୗୟ-ୠ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఁ-ఃె-ైొ-్ౕౖౢ-ౣ౦-౯ಂಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢ-ೣ೦-೯ംഃെ-ൈൗൢ-ൣ൦-൯ංඃ්ා-ුූෘ-ෟෲෳิ-ฺเ-ๅ๐-๙ິ-ູ່-ໍ໐-໙༘༙༠-༩༹༵༷ཁ-ཇཱ-྄྆-྇ྍ-ྗྙ-ྼ࿆က-ဩ၀-၉ၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟ᜎ-ᜐᜠ-ᜰᝀ-ᝐᝲᝳក-ឲ៝០-៩᠋-᠍᠐-᠙ᤠ-ᤫᤰ-᤻ᥑ-ᥭᦰ-ᧀᧈ-ᧉ᧐-᧙ᨀ-ᨕᨠ-ᩓ᩠-᩿᩼-᪉᪐-᪙ᭆ-ᭋ᭐-᭙᭫-᭳᮰-᮹᯦-᯳ᰀ-ᰢ᱀-᱉ᱛ-ᱽ᳐-᳒ᴀ-ᶾḁ-ἕ‌‍‿⁀⁔⃐-⃥⃜⃡-⃰ⶁ-ⶖⷠ-ⷿ〡-〨゙゚Ꙁ-ꙭꙴ-꙽ꚟ꛰-꛱ꟸ-ꠀ꠆ꠋꠣ-ꠧꢀ-ꢁꢴ-꣄꣐-꣙ꣳ-ꣷ꤀-꤉ꤦ-꤭ꤰ-ꥅꦀ-ꦃ꦳-꧀ꨀ-ꨧꩀ-ꩁꩌ-ꩍ꩐-꩙ꩻꫠ-ꫩꫲ-ꫳꯀ-ꯡ꯬꯭꯰-꯹ﬠ-ﬨ︀-️︠-︦︳︴﹍-﹏0-9_",r=new RegExp("["+t+"]"),s=new RegExp("["+t+i+"]");n.newline=/[\n\r\u2028\u2029]/,n.lineBreak=new RegExp("\r\n|"+n.newline.source),n.allLineBreaks=new RegExp(n.lineBreak.source,"g"),n.isIdentifierStart=function(e){return e<65?36===e||64===e:e<91||(e<97?95===e:e<123||e>=170&&r.test(String.fromCharCode(e)))},n.isIdentifierChar=function(e){return e<48?36===e:e<58||!(e<65)&&(e<91||(e<97?95===e:e<123||e>=170&&s.test(String.fromCharCode(e))))}},function(e,n){function t(e,n){var t,i={};for(t in e)t!==n&&(i[t]=e[t]);if(n in e)for(t in e[n])i[t]=e[n][t];return i}e.exports.mergeOpts=t},function(e,n){function t(e){var n=0,t=-1,i=[],r=!0;this.set_indent=function(i){n=e.baseIndentLength+i*e.indent_length,t=i},this.get_character_count=function(){return n},this.is_empty=function(){return r},this.last=function(){return this._empty?null:i[i.length-1]},this.push=function(e){i.push(e),n+=e.length,r=!1},this.pop=function(){var e=null;return r||(e=i.pop(),n-=e.length,r=0===i.length),e},this.remove_indent=function(){t>0&&(t-=1,n-=e.indent_length)},this.trim=function(){for(;" "===this.last();)i.pop(),n-=1;r=0===i.length},this.toString=function(){var n="";return this._empty||(t>=0&&(n=e.indent_cache[t]),n+=i.join("")),n}}function i(e,n){n=n||"",this.indent_cache=[n],this.baseIndentLength=n.length,this.indent_length=e.length,this.raw=!1;var i=[];this.baseIndentString=n,this.indent_string=e,this.previous_line=null,this.current_line=null,this.space_before_token=!1,this.add_outputline=function(){this.previous_line=this.current_line,this.current_line=new t(this),i.push(this.current_line)},this.add_outputline(),this.get_line_number=function(){return i.length},this.add_new_line=function(e){return(1!==this.get_line_number()||!this.just_added_newline())&&(!(!e&&this.just_added_newline())&&(this.raw||this.add_outputline(),!0))},this.get_code=function(e,n){var t=i.join("\n").replace(/[\r\n\t ]+$/,"");return e&&(t+="\n"),"\n"!==n&&(t=t.replace(/[\n]/g,n)),t},this.set_indent=function(e){if(i.length>1){for(;e>=this.indent_cache.length;)this.indent_cache.push(this.indent_cache[this.indent_cache.length-1]+this.indent_string);return this.current_line.set_indent(e),!0}return this.current_line.set_indent(0),!1},this.add_raw_token=function(e){for(var n=0;n1&&this.current_line.is_empty();)i.pop(),this.current_line=i[i.length-1],this.current_line.trim();this.previous_line=i.length>1?i[i.length-2]:null},this.just_added_newline=function(){return this.current_line.is_empty()},this.just_added_blankline=function(){if(this.just_added_newline()){if(1===i.length)return!0;var e=i[i.length-2];return e.is_empty()}return!1}}e.exports.Output=i},function(e,n,t){function i(e,n){var t=new r(e,n);return t.beautify()}var r=t(0).Beautifier;e.exports=i}]),n=e;"function"==typeof define&&define.amd?define([],function(){return{css_beautify:n}}):"undefined"!=typeof exports?exports.css_beautify=n:"undefined"!=typeof window?window.css_beautify=n:"undefined"!=typeof global&&(global.css_beautify=n)})(); -------------------------------------------------------------------------------- /codemirror/beautify/beautify-html.js: -------------------------------------------------------------------------------- 1 | (function(){var t=function(t){function e(i){if(n[i])return n[i].exports;var s=n[i]={i:i,l:!1,exports:{}};return t[i].call(s.exports,s,s.exports,e),s.l=!0,s.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,i){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=3)}([function(t,e,n){function i(t){return t.replace(/^\s+/g,"")}function s(t){return t.replace(/\s+$/g,"")}function r(t,e,n,r){function h(){function t(t){var e="",n=function(n){var i=e+n.toLowerCase();e=i.length<=t.length?i:i.substr(i.length-t.length,t.length)},i=function(){return e.indexOf(t)===-1};return{add:n,doesNotMatch:i}}return this.pos=0,this.token="",this.current_mode="CONTENT",this.tags={parent:"parent1",parentcount:1,parent1:""},this.tag_type="",this.token_text=this.last_token=this.last_text=this.token_type="",this.newlines=0,this.indent_content=p,this.indent_body_inner_html=l,this.indent_head_inner_html=c,this.Utils={whitespace:"\n\r\t ".split(""),single_token:e.void_elements||["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr","!doctype","?xml","?php","basefont","isindex"],extra_liners:C,in_array:function(t,e){for(var n=0;n=this.wrap_line_length?(this.print_newline(!1,t),this.print_indentation(t),!0):(this.line_char_count++,t.push(" "),!1)},this.get_content=function(){for(var t="",e=[],n=0;"<"!==this.input.charAt(this.pos)||2===n;){if(this.pos>=this.input.length)return e.length?e.join(""):["","TK_EOF"];if(n<2&&this.traverse_whitespace())this.space_or_wrap(e);else{if(t=this.input.charAt(this.pos),k){if("{"===t?n+=1:n<2&&(n=0),"}"===t&&n>0&&0===n--)break;var i=this.input.substr(this.pos,3);if("{{#"===i||"{{/"===i)break;if("{{!"===i)return[this.get_tag(),"TK_TAG_HANDLEBARS_COMMENT"];if("{{"===this.input.substr(this.pos,2)&&"{{else}}"===this.get_tag(!0))break}this.pos++,this.line_char_count++,e.push(t)}}return e.length?e.join(""):""},this.get_contents_to=function(t){if(this.pos===this.input.length)return["","TK_EOF"];var e="",n=new RegExp("","igm");n.lastIndex=this.pos;var i=n.exec(this.input),s=i?i.index:this.input.length;return this.pos=this.input.length)return t&&(this.pos=p,this.line_char_count=l),a.length?a.join(""):["","TK_EOF"];if(r=this.input.charAt(this.pos),this.pos++,this.Utils.in_array(r,this.Utils.whitespace))o=!0;else{if("'"!==r&&'"'!==r||(r+=this.get_unformatted(r),o=!0),"="===r&&(o=!1),s=this.input.substr(this.pos-1),!E||!u||c||">"!==r&&"/"!==r||s.match(/^\/?\s*>/)&&(o=!1,c=!0,this.print_newline(!1,a),this.print_indentation(a)),a.length&&"="!==a[a.length-1]&&">"!==r&&o){var f=this.space_or_wrap(a),d=f&&"/"!==r&&!A;if(o=!1,A&&"/"!==r){var g=!1;if(E&&_){var v=null!==s.match(/^\S*(="([^"]|\\")*")?\s*\/?\s*>/);g=!v}_&&!g||(this.print_newline(!1,a),this.print_indentation(a),d=!0)}if(d){u=!0;var b=T;O&&(b=a.indexOf(" ")+1);for(var y=0;y=2&&"{"===a[a.length-1]&&"{"===a[a.length-2]&&(e="#"===r||"/"===r||"!"===r?this.pos-3:this.pos-2,i="{"),this.line_char_count++,a.push(r),a[1]&&("!"===a[1]||"?"===a[1]||"%"===a[1])){a=[this.get_comment(e)];break}if(k&&a[1]&&"{"===a[1]&&a[2]&&"!"===a[2]){a=[this.get_comment(e)];break}if(k&&"{"===i&&a.length>2&&"}"===a[a.length-2]&&"}"===a[a.length-1])break}}while(">"!==r);var N,C,S=a.join("");N=S.indexOf(" ")!==-1?S.indexOf(" "):S.indexOf("\n")!==-1?S.indexOf("\n"):"{"===S.charAt(0)?S.indexOf("}"):S.indexOf(">"),C="<"!==S.charAt(0)&&k?"#"===S.charAt(2)?3:2:1;var K=S.substring(C,N).toLowerCase();return"/"===S.charAt(S.length-2)||this.Utils.in_array(K,this.Utils.single_token)?t||(this.tag_type="SINGLE"):k&&"{"===S.charAt(0)&&"else"===K?t||(this.indent_to_tag("if"),this.tag_type="HANDLEBARS_ELSE",this.indent_content=!0,this.traverse_whitespace()):this.is_unformatted(K,m)||this.is_unformatted(K,w)?(h=this.get_unformatted("",S),a.push(h),n=this.pos-1,this.tag_type="SINGLE"):"script"===K&&(S.search("type")===-1||S.search("type")>-1&&S.search(/\b(text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect)/)>-1)?t||(this.record_tag(K),this.tag_type="SCRIPT"):"style"===K&&(S.search("type")===-1||S.search("type")>-1&&S.search("text/css")>-1)?t||(this.record_tag(K),this.tag_type="STYLE"):"!"===K.charAt(0)?t||(this.tag_type="SINGLE",this.traverse_whitespace()):t||("/"===K.charAt(0)?(this.retrieve_tag(K.substring(1)),this.tag_type="END"):(this.record_tag(K),"html"!==K.toLowerCase()&&(this.indent_content=!0),this.tag_type="START"),this.traverse_whitespace()&&this.space_or_wrap(a),this.Utils.in_array(K,this.Utils.extra_liners)&&(this.print_newline(!1,this.output),this.output.length&&"\n"!==this.output[this.output.length-2]&&this.print_newline(!0,this.output))),t&&(this.pos=p,this.line_char_count=l),a.join("")},this.get_comment=function(t){var e="",n=">",i=!1;this.pos=t;var s=this.input.charAt(this.pos);for(this.pos++;this.pos<=this.input.length&&(e+=s,e.charAt(e.length-1)!==n.charAt(n.length-1)||e.indexOf(n)===-1);)!i&&e.length<10&&(0===e.indexOf("",i=!0):0===e.indexOf("",i=!0):0===e.indexOf("",i=!0):0===e.indexOf("",i=!0):0===e.indexOf("{{!--")?(n="--}}",i=!0):0===e.indexOf("{{!")?5===e.length&&e.indexOf("{{!--")===-1&&(n="}}",i=!0):0===e.indexOf("",i=!0):0===e.indexOf("<%")&&(n="%>",i=!0)),s=this.input.charAt(this.pos),this.pos++;return e},this.get_unformatted=function(e,n){if(n&&n.toLowerCase().indexOf(e)!==-1)return"";var i="",s="",r=!0,a=t(e);do{if(this.pos>=this.input.length)return s;if(i=this.input.charAt(this.pos),this.pos++,this.Utils.in_array(i,this.Utils.whitespace)){if(!r){this.line_char_count--;continue}if("\n"===i||"\r"===i){s+="\n",this.line_char_count=0;continue}}s+=i,a.add(i),this.line_char_count++,r=!0,k&&"{"===i&&s.length&&"{"===s.charAt(s.length-2)&&(s+=this.get_unformatted("}}"))}while(a.doesNotMatch());return s},this.get_token=function(){var t;if("TK_TAG_SCRIPT"===this.last_token||"TK_TAG_STYLE"===this.last_token){var e=this.last_token.substr(7);return t=this.get_contents_to(e),"string"!=typeof t?t:[t,"TK_"+e]}if("CONTENT"===this.current_mode)return t=this.get_content(),"string"!=typeof t?t:[t,"TK_CONTENT"];if("TAG"===this.current_mode){if(t=this.get_tag(),"string"!=typeof t)return t;var n="TK_TAG_"+this.tag_type;return[t,n]}},this.get_full_indent=function(t){return t=this.indent_level+t||0,t<1?"":Array(t+1).join(this.indent_string)},this.is_unformatted=function(t,e){if(!this.Utils.in_array(t,e))return!1;if("a"!==t.toLowerCase()||!this.Utils.in_array("a",e))return!0;var n=this.get_tag(!0),i=(n||"").match(/^\s*<\s*\/?([a-z]*)\s*[^>]*>\s*$/);return!(i&&!this.Utils.in_array(i[1],e))},this.printer=function(t,e,n,r,a){this.input=t||"",this.input=this.input.replace(/\r\n|[\r\u2028\u2029]/g,"\n"),this.output=[],this.indent_character=e,this.indent_string="",this.indent_size=n,this.brace_style=a,this.indent_level=0,this.wrap_line_length=r,this.line_char_count=0;for(var h=0;h0&&(t=s(t)),t&&""!==t&&(t.length>1&&"\n"===t.charAt(t.length-1)?(this.output.push(t.slice(0,-1)),this.print_newline(!1,this.output)):this.output.push(t));for(var e=0;e0,this.output);this.newlines=0},this.indent=function(){this.indent_level++},this.unindent=function(){this.indent_level>0&&this.indent_level--}},this}t=t||"";var u,p,l,c,f,d,g,v,m,w,b,y,k,x,T,A,E,O,N,C,S;e=e||{},e=a(e,"html"),void 0!==e.wrap_line_length&&0!==parseInt(e.wrap_line_length,10)||void 0===e.max_char||0===parseInt(e.max_char,10)||(e.wrap_line_length=e.max_char),p=void 0!==e.indent_inner_html&&e.indent_inner_html,l=void 0===e.indent_body_inner_html||e.indent_body_inner_html,c=void 0===e.indent_head_inner_html||e.indent_head_inner_html,f=void 0===e.indent_size?4:parseInt(e.indent_size,10),d=void 0===e.indent_char?" ":e.indent_char,v=void 0===e.brace_style?"collapse":e.brace_style,g=0===parseInt(e.wrap_line_length,10)?32786:parseInt(e.wrap_line_length||250,10),m=e.unformatted||["a","abbr","area","audio","b","bdi","bdo","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","keygen","label","map","mark","math","meter","noscript","object","output","progress","q","ruby","s","samp","select","small","span","strong","sub","sup","svg","template","textarea","time","u","var","video","wbr","text","acronym","address","big","dt","ins","strike","tt"],w=e.content_unformatted||["pre"],b=void 0===e.preserve_newlines||e.preserve_newlines,y=b?isNaN(parseInt(e.max_preserve_newlines,10))?32786:parseInt(e.max_preserve_newlines,10):0,k=void 0!==e.indent_handlebars&&e.indent_handlebars,x=void 0===e.wrap_attributes?"auto":e.wrap_attributes,T=isNaN(parseInt(e.wrap_attributes_indent_size,10))?f:parseInt(e.wrap_attributes_indent_size,10),A="force"===x.substr(0,"force".length),E="force-expand-multiline"===x,O="force-aligned"===x,N=void 0!==e.end_with_newline&&e.end_with_newline,C="object"==typeof e.extra_liners&&e.extra_liners?e.extra_liners.concat():"string"==typeof e.extra_liners?e.extra_liners.split(","):"head,body,/html".split(","),S=e.eol?e.eol:"auto",e.indent_with_tabs&&(d="\t",f=1),"auto"===S&&(S="\n",t&&o.test(t||"")&&(S=t.match(o)[0])),S=S.replace(/\\r/,"\r").replace(/\\n/,"\n"),t=t.replace(_,"\n"),this.beautify=function(){for(u=new h,u.printer(t,d,f,g,v);;){var i=u.get_token();if(u.token_text=i[0],u.token_type=i[1],"TK_EOF"===u.token_type)break;switch(u.token_type){case"TK_TAG_START":u.print_newline(!1,u.output),u.print_token(u.token_text),u.indent_content&&(!u.indent_body_inner_html&&u.token_text.match(//)||!u.indent_head_inner_html&&u.token_text.match(//)||u.indent(),u.indent_content=!1),u.current_mode="CONTENT";break;case"TK_TAG_STYLE":case"TK_TAG_SCRIPT":u.print_newline(!1,u.output),u.print_token(u.token_text),u.current_mode="CONTENT";break;case"TK_TAG_END":if("TK_CONTENT"===u.last_token&&""===u.last_text){var s=(u.token_text.match(/\w+/)||[])[0],a=null;u.output.length&&(a=u.output[u.output.length-1].match(/(?:<|{{#)\s*(\w+)/)),(null===a||a[1]!==s&&!u.Utils.in_array(a[1],m))&&u.print_newline(!1,u.output)}u.print_token(u.token_text),u.current_mode="CONTENT";break;case"TK_TAG_SINGLE":var o=u.token_text.match(/^\s*<([a-z-]+)/i);o&&u.Utils.in_array(o[1],m)||u.print_newline(!1,u.output),u.print_token(u.token_text),u.current_mode="CONTENT";break;case"TK_TAG_HANDLEBARS_ELSE":for(var _=!1,p=u.output.length-1;p>=0&&"\n"!==u.output[p];p--)if(u.output[p].match(/{{#if/)){_=!0;break}_||u.print_newline(!1,u.output),u.print_token(u.token_text),u.indent_content&&(u.indent(),u.indent_content=!1),u.current_mode="CONTENT";break;case"TK_TAG_HANDLEBARS_COMMENT":u.print_token(u.token_text),u.current_mode="TAG";break;case"TK_CONTENT":u.print_token(u.token_text),u.current_mode="TAG";break;case"TK_STYLE":case"TK_SCRIPT":if(""!==u.token_text){u.print_newline(!1,u.output);var l,c=u.token_text,w=1;"TK_SCRIPT"===u.token_type?l="function"==typeof n&&n:"TK_STYLE"===u.token_type&&(l="function"==typeof r&&r),"keep"===e.indent_scripts?w=0:"separate"===e.indent_scripts&&(w=-u.indent_level);var b=u.get_full_indent(w);if(l){var y=function(){this.eol="\n"};y.prototype=e;var k=new y;c=l(c.replace(/^\s*/,b),k)}else{var x=c.match(/^\s*/)[0],T=x.match(/[^\n\r]*$/)[0].split(u.indent_string).length-1,A=u.get_full_indent(w-T);c=c.replace(/^\s*/,b).replace(/\r\n|\r|\n/g,"\n"+A).replace(/\s+$/,"")}c&&(u.print_token_raw(c),u.print_newline(!0,u.output))}u.current_mode="TAG";break;default:""!==u.token_text&&u.print_token(u.token_text)}u.last_token=u.token_type,u.last_text=u.token_text}var E=u.output.join("").replace(/[\r\n\t ]+$/,"");return N&&(E+="\n"),"\n"!==S&&(E=E.replace(/[\n]/g,S)),E}}var a=n(2).mergeOpts,h=n(1),o=h.lineBreak,_=h.allLineBreaks;t.exports.Beautifier=r},function(t,e){var n="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛰᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々-〇〡-〩〱-〵〸-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",i="̀-ͯ҃-֑҇-ׇֽֿׁׂׅׄؐ-ؚؠ-ىٲ-ۓۧ-ۨۻ-ۼܰ-݊ࠀ-ࠔࠛ-ࠣࠥ-ࠧࠩ-࠭ࡀ-ࡗࣤ-ࣾऀ-ःऺ-़ा-ॏ॑-ॗॢ-ॣ०-९ঁ-ঃ়া-ৄেৈৗয়-ৠਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢ-ૣ૦-૯ଁ-ଃ଼ା-ୄେୈୋ-୍ୖୗୟ-ୠ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఁ-ఃె-ైొ-్ౕౖౢ-ౣ౦-౯ಂಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢ-ೣ೦-೯ംഃെ-ൈൗൢ-ൣ൦-൯ංඃ්ා-ුූෘ-ෟෲෳิ-ฺเ-ๅ๐-๙ິ-ູ່-ໍ໐-໙༘༙༠-༩༹༵༷ཁ-ཇཱ-྄྆-྇ྍ-ྗྙ-ྼ࿆က-ဩ၀-၉ၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟ᜎ-ᜐᜠ-ᜰᝀ-ᝐᝲᝳក-ឲ៝០-៩᠋-᠍᠐-᠙ᤠ-ᤫᤰ-᤻ᥑ-ᥭᦰ-ᧀᧈ-ᧉ᧐-᧙ᨀ-ᨕᨠ-ᩓ᩠-᩿᩼-᪉᪐-᪙ᭆ-ᭋ᭐-᭙᭫-᭳᮰-᮹᯦-᯳ᰀ-ᰢ᱀-᱉ᱛ-ᱽ᳐-᳒ᴀ-ᶾḁ-ἕ‌‍‿⁀⁔⃐-⃥⃜⃡-⃰ⶁ-ⶖⷠ-ⷿ〡-〨゙゚Ꙁ-ꙭꙴ-꙽ꚟ꛰-꛱ꟸ-ꠀ꠆ꠋꠣ-ꠧꢀ-ꢁꢴ-꣄꣐-꣙ꣳ-ꣷ꤀-꤉ꤦ-꤭ꤰ-ꥅꦀ-ꦃ꦳-꧀ꨀ-ꨧꩀ-ꩁꩌ-ꩍ꩐-꩙ꩻꫠ-ꫩꫲ-ꫳꯀ-ꯡ꯬꯭꯰-꯹ﬠ-ﬨ︀-️︠-︦︳︴﹍-﹏0-9_",s=new RegExp("["+n+"]"),r=new RegExp("["+n+i+"]");e.newline=/[\n\r\u2028\u2029]/,e.lineBreak=new RegExp("\r\n|"+e.newline.source),e.allLineBreaks=new RegExp(e.lineBreak.source,"g"),e.isIdentifierStart=function(t){return t<65?36===t||64===t:t<91||(t<97?95===t:t<123||t>=170&&s.test(String.fromCharCode(t)))},e.isIdentifierChar=function(t){return t<48?36===t:t<58||!(t<65)&&(t<91||(t<97?95===t:t<123||t>=170&&r.test(String.fromCharCode(t))))}},function(t,e){function n(t,e){var n,i={};for(n in t)n!==e&&(i[n]=t[n]);if(e in t)for(n in t[e])i[n]=t[e][n];return i}t.exports.mergeOpts=n},function(t,e,n){function i(t,e,n,i){var r=new s(t,e,n,i);return r.beautify()}var s=n(0).Beautifier;t.exports=i}]),e=t;if("function"==typeof define&&define.amd)define(["require","./beautify","./beautify-css"],function(t){var n=t("./beautify"),i=t("./beautify-css");return{html_beautify:function(t,s){return e(t,s,n.js_beautify,i.css_beautify)}}});else if("undefined"!=typeof exports){var n=require("./beautify.js"),i=require("./beautify-css.js");exports.html_beautify=function(t,s){return e(t,s,n.js_beautify,i.css_beautify)}}else"undefined"!=typeof window?window.html_beautify=function(t,n){return e(t,n,window.js_beautify,window.css_beautify)}:"undefined"!=typeof global&&(global.html_beautify=function(t,n){return e(t,n,global.js_beautify,global.css_beautify)})})(); -------------------------------------------------------------------------------- /codemirror/codemirror.css: -------------------------------------------------------------------------------- 1 | .CodeMirror{font-family:monospace;height:300px;color:#000}.CodeMirror-lines{padding:4px 0}.CodeMirror pre{padding:0 4px}.CodeMirror-gutter-filler,.CodeMirror-scrollbar-filler{background-color:#fff}.CodeMirror-gutters{border-right:1px solid #ddd;background-color:#f7f7f7;white-space:nowrap}.CodeMirror-linenumber{padding:0 3px 0 5px;min-width:20px;text-align:right;color:#999;white-space:nowrap}.CodeMirror-guttermarker{color:#000}.CodeMirror-guttermarker-subtle{color:#999}.CodeMirror-cursor{border-left:1px solid #000;border-right:none;width:0}.CodeMirror div.CodeMirror-secondarycursor{border-left:1px solid silver}.cm-fat-cursor .CodeMirror-cursor{width:auto;border:0!important;background:#7e7}.cm-fat-cursor div.CodeMirror-cursors{z-index:1}.cm-animate-fat-cursor{width:auto;border:0;-webkit-animation:blink 1.06s steps(1) infinite;-moz-animation:blink 1.06s steps(1) infinite;animation:blink 1.06s steps(1) infinite;background-color:#7e7}@-moz-keyframes blink{50%{background-color:transparent}}@-webkit-keyframes blink{50%{background-color:transparent}}@keyframes blink{50%{background-color:transparent}}.cm-tab{display:inline-block;text-decoration:inherit}.CodeMirror-rulers{position:absolute;left:0;right:0;top:-50px;bottom:-20px;overflow:hidden}.CodeMirror-ruler{border-left:1px solid #ccc;top:0;bottom:0;position:absolute}.cm-s-default .cm-header{color:#00f}.cm-s-default .cm-quote{color:#090}.cm-negative{color:#d44}.cm-positive{color:#292}.cm-header,.cm-strong{font-weight:700}.cm-em{font-style:italic}.cm-link{text-decoration:underline}.cm-strikethrough{text-decoration:line-through}.cm-s-default .cm-keyword{color:#708}.cm-s-default .cm-atom{color:#219}.cm-s-default .cm-number{color:#164}.cm-s-default .cm-def{color:#00f}.cm-s-default .cm-variable-2{color:#05a}.cm-s-default .cm-type,.cm-s-default .cm-variable-3{color:#085}.cm-s-default .cm-comment{color:#a50}.cm-s-default .cm-string{color:#a11}.cm-s-default .cm-string-2{color:#f50}.cm-s-default .cm-meta,.cm-s-default .cm-qualifier{color:#555}.cm-s-default .cm-builtin{color:#30a}.cm-s-default .cm-bracket{color:#997}.cm-s-default .cm-tag{color:#170}.cm-s-default .cm-attribute{color:#00c}.cm-s-default .cm-hr{color:#999}.cm-s-default .cm-link{color:#00c}.cm-invalidchar,.cm-s-default .cm-error{color:red}.CodeMirror-composing{border-bottom:2px solid}div.CodeMirror span.CodeMirror-matchingbracket{color:#0f0}div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#f22}.CodeMirror-matchingtag{background:rgba(255,150,0,.3)}.CodeMirror-activeline-background{background:#e8f2ff}.CodeMirror{position:relative;overflow:hidden;background:#fff}.CodeMirror-scroll{overflow:scroll!important;margin-bottom:-30px;margin-right:-30px;padding-bottom:30px;height:100%;outline:0;position:relative}.CodeMirror-sizer{position:relative;border-right:30px solid transparent}.CodeMirror-gutter-filler,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler,.CodeMirror-vscrollbar{position:absolute;z-index:6;display:none}.CodeMirror-vscrollbar{right:0;top:0;overflow-x:hidden;overflow-y:scroll}.CodeMirror-hscrollbar{bottom:0;left:0;overflow-y:hidden;overflow-x:scroll}.CodeMirror-scrollbar-filler{right:0;bottom:0}.CodeMirror-gutter-filler{left:0;bottom:0}.CodeMirror-gutters{position:absolute;left:0;top:0;min-height:100%;z-index:3}.CodeMirror-gutter{white-space:normal;height:100%;display:inline-block;vertical-align:top;margin-bottom:-30px}.CodeMirror-gutter-wrapper{position:absolute;z-index:4;background:0 0!important;border:none!important}.CodeMirror-gutter-background{position:absolute;top:0;bottom:0;z-index:4}.CodeMirror-gutter-elt{position:absolute;cursor:default;z-index:4}.CodeMirror-gutter-wrapper ::selection{background-color:transparent}.CodeMirror-gutter-wrapper ::-moz-selection{background-color:transparent}.CodeMirror-lines{cursor:text;min-height:1px}.CodeMirror pre{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0;border-width:0;background:0 0;font-family:inherit;font-size:inherit;margin:0;white-space:pre;word-wrap:normal;line-height:inherit;color:inherit;z-index:2;position:relative;overflow:visible;-webkit-tap-highlight-color:transparent;-webkit-font-variant-ligatures:contextual;font-variant-ligatures:contextual}.CodeMirror-wrap pre{word-wrap:break-word;white-space:pre-wrap;word-break:normal}.CodeMirror-linebackground{position:absolute;left:0;right:0;top:0;bottom:0;z-index:0}.CodeMirror-linewidget{position:relative;z-index:2;overflow:auto}.CodeMirror-rtl pre{direction:rtl}.CodeMirror-code{outline:0}.CodeMirror-gutter,.CodeMirror-gutters,.CodeMirror-linenumber,.CodeMirror-scroll,.CodeMirror-sizer{-moz-box-sizing:content-box;box-sizing:content-box}.CodeMirror-measure{position:absolute;width:100%;height:0;overflow:hidden;visibility:hidden}.CodeMirror-cursor{position:absolute;pointer-events:none}.CodeMirror-measure pre{position:static}div.CodeMirror-cursors{visibility:hidden;position:relative;z-index:3}.CodeMirror-focused div.CodeMirror-cursors,div.CodeMirror-dragcursors{visibility:visible}.CodeMirror-selected{background:#d9d9d9}.CodeMirror-focused .CodeMirror-selected{background:#d7d4f0}.CodeMirror-crosshair{cursor:crosshair}.CodeMirror-line::selection,.CodeMirror-line>span::selection,.CodeMirror-line>span>span::selection{background:#d7d4f0}.CodeMirror-line::-moz-selection,.CodeMirror-line>span::-moz-selection,.CodeMirror-line>span>span::-moz-selection{background:#d7d4f0}.cm-searching{background:#ffa;background:rgba(255,255,0,.4)}.cm-force-border{padding-right:.1px}@media print{.CodeMirror div.CodeMirror-cursors{visibility:hidden}}.cm-tab-wrap-hack:after{content:''}span.CodeMirror-selectedtext{background:0 0} -------------------------------------------------------------------------------- /codemirror/linter/codemirror-linter-htmlhint.js: -------------------------------------------------------------------------------- 1 | var HTMLHint=function(e){function t(e,t){return Array(e+1).join(t||" ")}var a={};return a.version="0.9.13",a.release="20160501",a.rules={},a.defaultRuleset={"tagname-lowercase":!0,"attr-lowercase":!0,"attr-value-double-quotes":!0,"doctype-first":!0,"tag-pair":!0,"spec-char-escape":!0,"id-unique":!0,"src-not-empty":!0,"attr-no-duplication":!0,"title-require":!0},a.addRule=function(e){a.rules[e.id]=e},a.verify=function(t,n){(n===e||0===Object.keys(n).length)&&(n=a.defaultRuleset),t=t.replace(/^\s*/i,function(t,a){return n===e&&(n={}),a.replace(/(?:^|,)\s*([^:,]+)\s*(?:\:\s*([^,\s]+))?/g,function(t,a,i){"false"===i?i=!1:"true"===i&&(i=!0),n[a]=i===e||i}),""});var i,r=new HTMLParser,s=new a.Reporter(t,n),o=a.rules;for(var l in n)i=o[l],i!==e&&n[l]!==!1&&i.init(r,s,n[l]);return r.parse(t),s.messages},a.format=function(e,a){a=a||{};var n=[],i={white:"",grey:"",red:"",reset:""};a.colors&&(i.white="",i.grey="",i.red="",i.reset="");var r=a.indent||0;return e.forEach(function(e){var a=40,s=a+20,o=e.evidence,l=e.line,u=e.col,d=o.length,c=u>a+1?u-a:1,f=o.length>u+s?u+s:d;a+1>u&&(f+=a-u+1),o=o.replace(/\t/g," ").substring(c-1,f),c>1&&(o="..."+o,c-=3),d>f&&(o+="..."),n.push(i.white+t(r)+"L"+l+" |"+i.grey+o+i.reset);var g=u-c,h=o.substring(0,g).match(/[^\u0000-\u00ff]/g);null!==h&&(g+=h.length),n.push(i.white+t(r)+t((l+"").length+3+g)+"^ "+i.red+e.message+" ("+e.rule.id+")"+i.reset)}),n},a}();"object"==typeof exports&&exports&&(exports.HTMLHint=HTMLHint),function(e){var t=function(){var e=this;e._init.apply(e,arguments)};t.prototype={_init:function(e,t){var a=this;a.html=e,a.lines=e.split(/\r?\n/);var n=e.match(/\r?\n/);a.brLen=null!==n?n[0].length:0,a.ruleset=t,a.messages=[]},error:function(e,t,a,n,i){this.report("error",e,t,a,n,i)},warn:function(e,t,a,n,i){this.report("warning",e,t,a,n,i)},info:function(e,t,a,n,i){this.report("info",e,t,a,n,i)},report:function(e,t,a,n,i,r){for(var s,o,l=this,u=l.lines,d=l.brLen,c=a-1,f=u.length;f>c&&(s=u[c],o=s.length,n>o&&f>a);c++)a++,n-=o,1!==n&&(n-=d);l.messages.push({type:e,message:t,raw:r,evidence:s,line:a,col:n,rule:{id:i.id,description:i.description,link:"https://github.com/yaniswang/HTMLHint/wiki/"+i.id}})}},e.Reporter=t}(HTMLHint);var HTMLParser=function(e){var t=function(){var e=this;e._init.apply(e,arguments)};return t.prototype={_init:function(){var e=this;e._listeners={},e._mapCdataTags=e.makeMap("script,style"),e._arrBlocks=[],e.lastEvent=null},makeMap:function(e){for(var t={},a=e.split(","),n=0;a.length>n;n++)t[a[n]]=!0;return t},parse:function(t){function a(t,a,n,i){var r=n-b+1;i===e&&(i={}),i.raw=a,i.pos=n,i.line=w,i.col=r,L.push(i),c.fire(t,i);for(var s;s=m.exec(a);)w++,b=n+m.lastIndex}var n,i,r,s,o,l,u,d,c=this,f=c._mapCdataTags,g=/<(?:\/([^\s>]+)\s*|!--([\s\S]*?)--|!([^>]*?)|([\w\-:]+)((?:\s+[^\s"'>\/=\x00-\x0F\x7F\x80-\x9F]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'>]*))?)*?)\s*(\/?))>/g,h=/\s*([^\s"'>\/=\x00-\x0F\x7F\x80-\x9F]+)(?:\s*=\s*(?:(")([^"]*)"|(')([^']*)'|([^\s"'>]*)))?/g,m=/\r?\n/g,p=0,v=0,b=0,w=1,L=c._arrBlocks;for(c.fire("start",{pos:0,line:1,col:1});n=g.exec(t);)if(i=n.index,i>p&&(d=t.substring(p,i),o?u.push(d):a("text",d,p)),p=g.lastIndex,!(r=n[1])||(o&&r===o&&(d=u.join(""),a("cdata",d,v,{tagName:o,attrs:l}),o=null,l=null,u=null),o))if(o)u.push(n[0]);else if(r=n[4]){s=[];for(var y,T=n[5],H=0;y=h.exec(T);){var x=y[1],M=y[2]?y[2]:y[4]?y[4]:"",N=y[3]?y[3]:y[5]?y[5]:y[6]?y[6]:"";s.push({name:x,value:N,quote:M,index:y.index,raw:y[0]}),H+=y[0].length}H===T.length?(a("tagstart",n[0],i,{tagName:r,attrs:s,close:n[6]}),f[r]&&(o=r,l=s.concat(),u=[],v=p)):a("text",n[0],i)}else(n[2]||n[3])&&a("comment",n[0],i,{content:n[2]||n[3],long:!!n[2]});else a("tagend",n[0],i,{tagName:r});t.length>p&&(d=t.substring(p,t.length),a("text",d,p)),c.fire("end",{pos:p,line:w,col:t.length-b+1})},addListener:function(t,a){for(var n,i=this._listeners,r=t.split(/[,\s]/),s=0,o=r.length;o>s;s++)n=r[s],i[n]===e&&(i[n]=[]),i[n].push(a)},fire:function(t,a){a===e&&(a={}),a.type=t;var n=this,i=[],r=n._listeners[t],s=n._listeners.all;r!==e&&(i=i.concat(r)),s!==e&&(i=i.concat(s));var o=n.lastEvent;null!==o&&(delete o.lastEvent,a.lastEvent=o),n.lastEvent=a;for(var l=0,u=i.length;u>l;l++)i[l].call(n,a)},removeListener:function(t,a){var n=this._listeners[t];if(n!==e)for(var i=0,r=n.length;r>i;i++)if(n[i]===a){n.splice(i,1);break}},fixPos:function(e,t){var a,n=e.raw.substr(0,t),i=n.split(/\r?\n/),r=i.length-1,s=e.line;return r>0?(s+=r,a=i[r].length+1):a=e.col+t,{line:s,col:a}},getMapAttrs:function(e){for(var t,a={},n=0,i=e.length;i>n;n++)t=e[n],a[t.name]=t.value;return a}},t}();"object"==typeof exports&&exports&&(exports.HTMLParser=HTMLParser),HTMLHint.addRule({id:"alt-require",description:"The alt attribute of an element must be present and alt attribute of area[href] and input[type=image] must have a value.",init:function(e,t){var a=this;e.addListener("tagstart",function(n){var i,r=n.tagName.toLowerCase(),s=e.getMapAttrs(n.attrs),o=n.col+r.length+1;"img"!==r||"alt"in s?("area"===r&&"href"in s||"input"===r&&"image"===s.type)&&("alt"in s&&""!==s.alt||(i="area"===r?"area[href]":"input[type=image]",t.warn("The alt attribute of "+i+" must have a value.",n.line,o,a,n.raw))):t.warn("An alt attribute must be present on elements.",n.line,o,a,n.raw)})}}),HTMLHint.addRule({id:"attr-lowercase",description:"All attribute names must be in lowercase.",init:function(e,t,a){var n=this,i=Array.isArray(a)?a:[];e.addListener("tagstart",function(e){for(var a,r=e.attrs,s=e.col+e.tagName.length+1,o=0,l=r.length;l>o;o++){a=r[o];var u=a.name;-1===i.indexOf(u)&&u!==u.toLowerCase()&&t.error("The attribute name of [ "+u+" ] must be in lowercase.",e.line,s+a.index,n,a.raw)}})}}),HTMLHint.addRule({id:"attr-no-duplication",description:"Elements cannot have duplicate attributes.",init:function(e,t){var a=this;e.addListener("tagstart",function(e){for(var n,i,r=e.attrs,s=e.col+e.tagName.length+1,o={},l=0,u=r.length;u>l;l++)n=r[l],i=n.name,o[i]===!0&&t.error("Duplicate of attribute name [ "+n.name+" ] was found.",e.line,s+n.index,a,n.raw),o[i]=!0})}}),HTMLHint.addRule({id:"attr-unsafe-chars",description:"Attribute values cannot contain unsafe chars.",init:function(e,t){var a=this;e.addListener("tagstart",function(e){for(var n,i,r=e.attrs,s=e.col+e.tagName.length+1,o=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/,l=0,u=r.length;u>l;l++)if(n=r[l],i=n.value.match(o),null!==i){var d=escape(i[0]).replace(/%u/,"\\u").replace(/%/,"\\x");t.warn("The value of attribute [ "+n.name+" ] cannot contain an unsafe char [ "+d+" ].",e.line,s+n.index,a,n.raw)}})}}),HTMLHint.addRule({id:"attr-value-double-quotes",description:"Attribute values must be in double quotes.",init:function(e,t){var a=this;e.addListener("tagstart",function(e){for(var n,i=e.attrs,r=e.col+e.tagName.length+1,s=0,o=i.length;o>s;s++)n=i[s],(""!==n.value&&'"'!==n.quote||""===n.value&&"'"===n.quote)&&t.error("The value of attribute [ "+n.name+" ] must be in double quotes.",e.line,r+n.index,a,n.raw)})}}),HTMLHint.addRule({id:"attr-value-not-empty",description:"All attributes must have values.",init:function(e,t){var a=this;e.addListener("tagstart",function(e){for(var n,i=e.attrs,r=e.col+e.tagName.length+1,s=0,o=i.length;o>s;s++)n=i[s],""===n.quote&&""===n.value&&t.warn("The attribute [ "+n.name+" ] must have a value.",e.line,r+n.index,a,n.raw)})}}),HTMLHint.addRule({id:"csslint",description:"Scan css with csslint.",init:function(e,t,a){var n=this;e.addListener("cdata",function(e){if("style"===e.tagName.toLowerCase()){var i;if(i="object"==typeof exports&&require?require("csslint").CSSLint.verify:CSSLint.verify,void 0!==a){var r=e.line-1,s=e.col-1;try{var o=i(e.raw,a).messages;o.forEach(function(e){var a=e.line;t["warning"===e.type?"warn":"error"]("["+e.rule.id+"] "+e.message,r+a,(1===a?s:0)+e.col,n,e.evidence)})}catch(e){}}}})}}),HTMLHint.addRule({id:"doctype-first",description:"Doctype must be declared first.",init:function(e,t){var a=this,n=function(i){"start"===i.type||"text"===i.type&&/^\s*$/.test(i.raw)||(("comment"!==i.type&&i.long===!1||/^DOCTYPE\s+/i.test(i.content)===!1)&&t.error("Doctype must be declared first.",i.line,i.col,a,i.raw),e.removeListener("all",n))};e.addListener("all",n)}}),HTMLHint.addRule({id:"doctype-html5",description:'Invalid doctype. Use: ""',init:function(e,t){function a(e){e.long===!1&&"doctype html"!==e.content.toLowerCase()&&t.warn('Invalid doctype. Use: ""',e.line,e.col,i,e.raw)}function n(){e.removeListener("comment",a),e.removeListener("tagstart",n)}var i=this;e.addListener("all",a),e.addListener("tagstart",n)}}),HTMLHint.addRule({id:"head-script-disabled",description:"The