Fix the security issue.
[aai/esr-server.git] / esr-mgr / src / main / resources / api-doc / swagger-ui.js
1 /*
2  * Copyright 2016 ZTE Corporation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 /**
17  * swagger-ui - Swagger UI is a dependency-free collection of HTML, Javascript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API
18  * @version v2.1.8-M1
19  * @link http://swagger.io
20  * @license Apache 2.0
21  */
22 $(function() {
23
24         // Helper function for vertically aligning DOM elements
25         // http://www.seodenver.com/simple-vertical-align-plugin-for-jquery/
26         $.fn.vAlign = function() {
27                 return this.each(function(i){
28                 var ah = $(this).height();
29                 var ph = $(this).parent().height();
30                 var mh = (ph - ah) / 2;
31                 $(this).css('margin-top', mh);
32                 });
33         };
34
35         $.fn.stretchFormtasticInputWidthToParent = function() {
36                 return this.each(function(i){
37                 var p_width = $(this).closest("form").innerWidth();
38                 var p_padding = parseInt($(this).closest("form").css('padding-left') ,10) + parseInt($(this).closest("form").css('padding-right'), 10);
39                 var this_padding = parseInt($(this).css('padding-left'), 10) + parseInt($(this).css('padding-right'), 10);
40                 $(this).css('width', p_width - p_padding - this_padding);
41                 });
42         };
43
44         $('form.formtastic li.string input, form.formtastic textarea').stretchFormtasticInputWidthToParent();
45
46         // Vertically center these paragraphs
47         // Parent may need a min-height for this to work..
48         $('ul.downplayed li div.content p').vAlign();
49
50         // When a sandbox form is submitted..
51         $("form.sandbox").submit(function(){
52
53                 var error_free = true;
54
55                 // Cycle through the forms required inputs
56                 $(this).find("input.required").each(function() {
57
58                         // Remove any existing error styles from the input
59                         $(this).removeClass('error');
60
61                         // Tack the error style on if the input is empty..
62                         if ($(this).val() == '') {
63                                 $(this).addClass('error');
64                                 $(this).wiggle();
65                                 error_free = false;
66                         }
67
68                 });
69
70                 return error_free;
71         });
72
73 });
74
75 function clippyCopiedCallback(a) {
76   $('#api_key_copied').fadeIn().delay(1000).fadeOut();
77
78   // var b = $("#clippy_tooltip_" + a);
79   // b.length != 0 && (b.attr("title", "copied!").trigger("tipsy.reload"), setTimeout(function() {
80   //   b.attr("title", "copy to clipboard")
81   // },
82   // 500))
83 }
84
85 // Logging function that accounts for browsers that don't have window.console
86 log = function(){
87   log.history = log.history || [];
88   log.history.push(arguments);
89   if(this.console){
90     console.log( Array.prototype.slice.call(arguments)[0] );
91   }
92 };
93
94 // Handle browsers that do console incorrectly (IE9 and below, see http://stackoverflow.com/a/5539378/7913)
95 if (Function.prototype.bind && console && typeof console.log == "object") {
96     [
97       "log","info","warn","error","assert","dir","clear","profile","profileEnd"
98     ].forEach(function (method) {
99         console[method] = this.bind(console[method], console);
100     }, Function.prototype.call);
101 }
102
103 var Docs = {
104
105         shebang: function() {
106
107                 // If shebang has an operation nickname in it..
108                 // e.g. /docs/#!/words/get_search
109                 var fragments = $.param.fragment().split('/');
110                 fragments.shift(); // get rid of the bang
111
112                 switch (fragments.length) {
113                         case 1:
114                                 // Expand all operations for the resource and scroll to it
115                                 var dom_id = 'resource_' + fragments[0];
116
117                                 Docs.expandEndpointListForResource(fragments[0]);
118                                 $("#"+dom_id).slideto({highlight: false});
119                                 break;
120                         case 2:
121                                 // Refer to the endpoint DOM element, e.g. #words_get_search
122
123         // Expand Resource
124         Docs.expandEndpointListForResource(fragments[0]);
125         $("#"+dom_id).slideto({highlight: false});
126
127         // Expand operation
128                                 var li_dom_id = fragments.join('_');
129                                 var li_content_dom_id = li_dom_id + "_content";
130
131
132                                 Docs.expandOperation($('#'+li_content_dom_id));
133                                 $('#'+li_dom_id).slideto({highlight: false});
134                                 break;
135                 }
136
137         },
138
139         toggleEndpointListForResource: function(resource) {
140                 var elem = $('li#resource_' + Docs.escapeResourceName(resource) + ' ul.endpoints');
141                 if (elem.is(':visible')) {
142                         Docs.collapseEndpointListForResource(resource);
143                 } else {
144                         Docs.expandEndpointListForResource(resource);
145                 }
146         },
147
148         // Expand resource
149         expandEndpointListForResource: function(resource) {
150                 var resource = Docs.escapeResourceName(resource);
151                 if (resource == '') {
152                         $('.resource ul.endpoints').slideDown();
153                         return;
154                 }
155                 
156                 $('li#resource_' + resource).addClass('active');
157
158                 var elem = $('li#resource_' + resource + ' ul.endpoints');
159                 elem.slideDown();
160         },
161
162         // Collapse resource and mark as explicitly closed
163         collapseEndpointListForResource: function(resource) {
164                 var resource = Docs.escapeResourceName(resource);
165                 if (resource == '') {
166                         $('.resource ul.endpoints').slideUp();
167                         return;
168                 }
169
170                 $('li#resource_' + resource).removeClass('active');
171
172                 var elem = $('li#resource_' + resource + ' ul.endpoints');
173                 elem.slideUp();
174         },
175
176         expandOperationsForResource: function(resource) {
177                 // Make sure the resource container is open..
178                 Docs.expandEndpointListForResource(resource);
179                 
180                 if (resource == '') {
181                         $('.resource ul.endpoints li.operation div.content').slideDown();
182                         return;
183                 }
184
185                 $('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() {
186                         Docs.expandOperation($(this));
187                 });
188         },
189
190         collapseOperationsForResource: function(resource) {
191                 // Make sure the resource container is open..
192                 Docs.expandEndpointListForResource(resource);
193
194                 if (resource == '') {
195                         $('.resource ul.endpoints li.operation div.content').slideUp();
196                         return;
197                 }
198
199                 $('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() {
200                         Docs.collapseOperation($(this));
201                 });
202         },
203
204         escapeResourceName: function(resource) {
205                 return resource.replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]\^`{|}~]/g, "\\$&");
206         },
207
208         expandOperation: function(elem) {
209                 elem.slideDown();
210         },
211
212         collapseOperation: function(elem) {
213                 elem.slideUp();
214         }
215 };
216
217 this["Handlebars"] = this["Handlebars"] || {};
218 this["Handlebars"]["templates"] = this["Handlebars"]["templates"] || {};
219 this["Handlebars"]["templates"]["apikey_button_view"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
220   var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
221   return "<!--div class='auth_button' id='apikey_button'><img class='auth_icon' alt='apply api key' src='images/apikey.jpeg'></div-->\n<div class='auth_container' id='apikey_container'>\n  <div class='key_input_container'>\n    <div class='auth_label'>"
222     + escapeExpression(((helper = (helper = helpers.keyName || (depth0 != null ? depth0.keyName : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"keyName","hash":{},"data":data}) : helper)))
223     + "</div>\n    <input placeholder=\"api_key\" class=\"auth_input\" id=\"input_apiKey_entry\" name=\"apiKey\" type=\"text\"/>\n    <div class='auth_submit'><a class='auth_submit_button' id=\"apply_api_key\" href=\"#\">apply</a></div>\n  </div>\n</div>\n\n";
224 },"useData":true});
225 var SwaggerUi,
226   __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
227   __hasProp = {}.hasOwnProperty;
228
229 SwaggerUi = (function(_super) {
230   __extends(SwaggerUi, _super);
231
232   function SwaggerUi() {
233     return SwaggerUi.__super__.constructor.apply(this, arguments);
234   }
235
236   SwaggerUi.prototype.dom_id = "swagger_ui";
237
238   SwaggerUi.prototype.options = null;
239
240   SwaggerUi.prototype.api = null;
241
242   SwaggerUi.prototype.headerView = null;
243
244   SwaggerUi.prototype.mainView = null;
245
246   SwaggerUi.prototype.initialize = function(options) {
247     if (options == null) {
248       options = {};
249     }
250     if (options.dom_id != null) {
251       this.dom_id = options.dom_id;
252       delete options.dom_id;
253     }
254     if (options.supportedSubmitMethods == null) {
255       options.supportedSubmitMethods = ['get', 'put', 'post', 'delete', 'head', 'options', 'patch'];
256     }
257     if ($('#' + this.dom_id) == null) {
258       $('body').append('<div id="' + this.dom_id + '"></div>');
259     }
260     this.options = options;
261     this.options.success = (function(_this) {
262       return function() {
263         return _this.render();
264       };
265     })(this);
266     this.options.progress = (function(_this) {
267       return function(d) {
268         return _this.showMessage(d);
269       };
270     })(this);
271     this.options.failure = (function(_this) {
272       return function(d) {
273         return _this.onLoadFailure(d);
274       };
275     })(this);
276     this.headerView = new HeaderView({
277       el: $('#header')
278     });
279     return this.headerView.on('update-swagger-ui', (function(_this) {
280       return function(data) {
281         return _this.updateSwaggerUi(data);
282       };
283     })(this));
284   };
285
286   SwaggerUi.prototype.setOption = function(option, value) {
287     return this.options[option] = value;
288   };
289
290   SwaggerUi.prototype.getOption = function(option) {
291     return this.options[option];
292   };
293
294   SwaggerUi.prototype.updateSwaggerUi = function(data) {
295     this.options.url = data.url;
296     return this.load();
297   };
298
299   SwaggerUi.prototype.load = function() {
300     var url, _ref;
301     if ((_ref = this.mainView) != null) {
302       _ref.clear();
303     }
304     url = this.options.url;
305     if (url && url.indexOf("http") !== 0) {
306       url = this.buildUrl(window.location.href.toString(), url);
307     }
308     this.options.url = url;
309     this.headerView.update(url);
310     return this.api = new SwaggerClient(this.options);
311   };
312
313   SwaggerUi.prototype.collapseAll = function() {
314     return Docs.collapseEndpointListForResource('');
315   };
316
317   SwaggerUi.prototype.listAll = function() {
318     return Docs.collapseOperationsForResource('');
319   };
320
321   SwaggerUi.prototype.expandAll = function() {
322     return Docs.expandOperationsForResource('');
323   };
324
325   SwaggerUi.prototype.render = function() {
326     this.showMessage('Finished Loading Resource Information. Rendering Swagger UI...');
327     this.mainView = new MainView({
328       model: this.api,
329       el: $('#' + this.dom_id),
330       swaggerOptions: this.options
331     }).render();
332     this.showMessage();
333     switch (this.options.docExpansion) {
334       case "full":
335         this.expandAll();
336         break;
337       case "list":
338         this.listAll();
339     }
340     this.renderGFM();
341     if (this.options.onComplete) {
342       this.options.onComplete(this.api, this);
343     }
344     return setTimeout((function(_this) {
345       return function() {
346         return Docs.shebang();
347       };
348     })(this), 100);
349   };
350
351   SwaggerUi.prototype.buildUrl = function(base, url) {
352     var endOfPath, parts;
353     if (url.indexOf("/") === 0) {
354       parts = base.split("/");
355       base = parts[0] + "//" + parts[2];
356       return base + url;
357     } else {
358       endOfPath = base.length;
359       if (base.indexOf("?") > -1) {
360         endOfPath = Math.min(endOfPath, base.indexOf("?"));
361       }
362       if (base.indexOf("#") > -1) {
363         endOfPath = Math.min(endOfPath, base.indexOf("#"));
364       }
365       base = base.substring(0, endOfPath);
366       if (base.indexOf("/", base.length - 1) !== -1) {
367         return base + url;
368       }
369       return base + "/" + url;
370     }
371   };
372
373   SwaggerUi.prototype.showMessage = function(data) {
374     if (data == null) {
375       data = '';
376     }
377     $('#message-bar').removeClass('message-fail');
378     $('#message-bar').addClass('message-success');
379     return $('#message-bar').html(data);
380   };
381
382   SwaggerUi.prototype.onLoadFailure = function(data) {
383     var val;
384     if (data == null) {
385       data = '';
386     }
387     $('#message-bar').removeClass('message-success');
388     $('#message-bar').addClass('message-fail');
389     val = $('#message-bar').html(data);
390     if (this.options.onFailure != null) {
391       this.options.onFailure(data);
392     }
393     return val;
394   };
395
396   SwaggerUi.prototype.renderGFM = function(data) {
397     if (data == null) {
398       data = '';
399     }
400     return $('.markdown').each(function(index) {
401       return $(this).html(marked($(this).html()));
402     });
403   };
404
405   return SwaggerUi;
406
407 })(Backbone.Router);
408
409 window.SwaggerUi = SwaggerUi;
410
411 this["Handlebars"]["templates"]["basic_auth_button_view"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
412   return "<div class='auth_button' id='basic_auth_button'><img class='auth_icon' src='images/password.jpeg'></div>\n<div class='auth_container' id='basic_auth_container'>\n  <div class='key_input_container'>\n    <div class=\"auth_label\">Username</div>\n    <input placeholder=\"username\" class=\"auth_input\" id=\"input_username\" name=\"username\" type=\"text\"/>\n    <div class=\"auth_label\">Password</div>\n    <input placeholder=\"password\" class=\"auth_input\" id=\"input_password\" name=\"password\" type=\"password\"/>\n    <div class='auth_submit'><a class='auth_submit_button' id=\"apply_basic_auth\" href=\"#\">apply</a></div>\n  </div>\n</div>\n\n";
413   },"useData":true});
414 Handlebars.registerHelper('sanitize', function(html) {
415   html = html.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, '');
416   return new Handlebars.SafeString(html);
417 });
418
419 this["Handlebars"]["templates"]["content_type"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
420   var stack1, buffer = "";
421   stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"each","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
422   if (stack1 != null) { buffer += stack1; }
423   return buffer;
424 },"2":function(depth0,helpers,partials,data) {
425   var stack1, lambda=this.lambda, buffer = "    <option value=\"";
426   stack1 = lambda(depth0, depth0);
427   if (stack1 != null) { buffer += stack1; }
428   buffer += "\">";
429   stack1 = lambda(depth0, depth0);
430   if (stack1 != null) { buffer += stack1; }
431   return buffer + "</option>\n";
432 },"4":function(depth0,helpers,partials,data) {
433   return "  <option value=\"application/json\">application/json</option>\n";
434   },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
435   var stack1, buffer = "<label for=\"contentType\"></label>\n<select name=\"contentType\">\n";
436   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(4, data),"data":data});
437   if (stack1 != null) { buffer += stack1; }
438   return buffer + "</select>\n";
439 },"useData":true});
440 var ApiKeyButton,
441   __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
442   __hasProp = {}.hasOwnProperty;
443
444 ApiKeyButton = (function(_super) {
445   __extends(ApiKeyButton, _super);
446
447   function ApiKeyButton() {
448     return ApiKeyButton.__super__.constructor.apply(this, arguments);
449   }
450
451   ApiKeyButton.prototype.initialize = function() {};
452
453   ApiKeyButton.prototype.render = function() {
454     var template;
455     template = this.template();
456     $(this.el).html(template(this.model));
457     return this;
458   };
459
460   ApiKeyButton.prototype.events = {
461     "click #apikey_button": "toggleApiKeyContainer",
462     "click #apply_api_key": "applyApiKey"
463   };
464
465   ApiKeyButton.prototype.applyApiKey = function() {
466     var elem;
467     window.authorizations.add(this.model.name, new ApiKeyAuthorization(this.model.name, $("#input_apiKey_entry").val(), this.model["in"]));
468     window.swaggerUi.load();
469     return elem = $('#apikey_container').show();
470   };
471
472   ApiKeyButton.prototype.toggleApiKeyContainer = function() {
473     var elem;
474     if ($('#apikey_container').length > 0) {
475       elem = $('#apikey_container').first();
476       if (elem.is(':visible')) {
477         return elem.hide();
478       } else {
479         $('.auth_container').hide();
480         return elem.show();
481       }
482     }
483   };
484
485   ApiKeyButton.prototype.template = function() {
486     return Handlebars.templates.apikey_button_view;
487   };
488
489   return ApiKeyButton;
490
491 })(Backbone.View);
492
493 this["Handlebars"]["templates"]["main"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
494   var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression, buffer = "  <div class=\"info_title\">"
495     + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.title : stack1), depth0))
496     + "</div>\n  <div class=\"info_description markdown\">";
497   stack1 = lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.description : stack1), depth0);
498   if (stack1 != null) { buffer += stack1; }
499   buffer += "</div>\n  ";
500   stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.termsOfServiceUrl : stack1), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
501   if (stack1 != null) { buffer += stack1; }
502   buffer += "\n  ";
503   stack1 = helpers['if'].call(depth0, ((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.name : stack1), {"name":"if","hash":{},"fn":this.program(4, data),"inverse":this.noop,"data":data});
504   if (stack1 != null) { buffer += stack1; }
505   buffer += "\n  ";
506   stack1 = helpers['if'].call(depth0, ((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.url : stack1), {"name":"if","hash":{},"fn":this.program(6, data),"inverse":this.noop,"data":data});
507   if (stack1 != null) { buffer += stack1; }
508   buffer += "\n  ";
509   stack1 = helpers['if'].call(depth0, ((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.email : stack1), {"name":"if","hash":{},"fn":this.program(8, data),"inverse":this.noop,"data":data});
510   if (stack1 != null) { buffer += stack1; }
511   buffer += "\n  ";
512   stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.license : stack1), {"name":"if","hash":{},"fn":this.program(10, data),"inverse":this.noop,"data":data});
513   if (stack1 != null) { buffer += stack1; }
514   return buffer + "\n";
515 },"2":function(depth0,helpers,partials,data) {
516   var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
517   return "<div class=\"info_tos\"><a href=\""
518     + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.termsOfServiceUrl : stack1), depth0))
519     + "\">Terms of service</a></div>";
520 },"4":function(depth0,helpers,partials,data) {
521   var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
522   return "<div class='info_name'>Created by "
523     + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.name : stack1), depth0))
524     + "</div>";
525 },"6":function(depth0,helpers,partials,data) {
526   var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
527   return "<div class='info_url'>See more at <a href=\""
528     + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.url : stack1), depth0))
529     + "\">"
530     + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.url : stack1), depth0))
531     + "</a></div>";
532 },"8":function(depth0,helpers,partials,data) {
533   var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
534   return "<div class='info_email'><a href=\"mailto:"
535     + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.email : stack1), depth0))
536     + "?subject="
537     + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.title : stack1), depth0))
538     + "\">Contact the developer</a></div>";
539 },"10":function(depth0,helpers,partials,data) {
540   var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
541   return "<div class='info_license'><a href='"
542     + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.license : stack1)) != null ? stack1.url : stack1), depth0))
543     + "'>"
544     + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.license : stack1)) != null ? stack1.name : stack1), depth0))
545     + "</a></div>";
546 },"12":function(depth0,helpers,partials,data) {
547   var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
548   return "    , <span style=\"font-variant: small-caps\">api version</span>: "
549     + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.version : stack1), depth0))
550     + "\n    ";
551 },"14":function(depth0,helpers,partials,data) {
552   var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
553   return "    <span style=\"float:right\"><a href=\""
554     + escapeExpression(((helper = (helper = helpers.validatorUrl || (depth0 != null ? depth0.validatorUrl : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"validatorUrl","hash":{},"data":data}) : helper)))
555     + "/debug?url="
556     + escapeExpression(((helper = (helper = helpers.url || (depth0 != null ? depth0.url : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"url","hash":{},"data":data}) : helper)))
557     + "\"><img id=\"validator\" src=\""
558     + escapeExpression(((helper = (helper = helpers.validatorUrl || (depth0 != null ? depth0.validatorUrl : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"validatorUrl","hash":{},"data":data}) : helper)))
559     + "?url="
560     + escapeExpression(((helper = (helper = helpers.url || (depth0 != null ? depth0.url : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"url","hash":{},"data":data}) : helper)))
561     + "\"></a>\n    </span>\n";
562 },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
563   var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<div class='info' id='api_info'>\n";
564   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.info : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data});
565   if (stack1 != null) { buffer += stack1; }
566   buffer += "</div>\n<div class='container' id='resources_container'>\n  <ul id='resources'></ul>\n\n  <div class=\"footer\">\n    <br>\n    <br>\n    <h4 style=\"color: #999\">[ <span style=\"font-variant: small-caps\">base url</span>: "
567     + escapeExpression(((helper = (helper = helpers.basePath || (depth0 != null ? depth0.basePath : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"basePath","hash":{},"data":data}) : helper)))
568     + "\n";
569   stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.version : stack1), {"name":"if","hash":{},"fn":this.program(12, data),"inverse":this.noop,"data":data});
570   if (stack1 != null) { buffer += stack1; }
571   buffer += "]\n";
572   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.validatorUrl : depth0), {"name":"if","hash":{},"fn":this.program(14, data),"inverse":this.noop,"data":data});
573   if (stack1 != null) { buffer += stack1; }
574   return buffer + "    </h4>\n    </div>\n</div>\n";
575 },"useData":true});
576 var BasicAuthButton,
577   __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
578   __hasProp = {}.hasOwnProperty;
579
580 BasicAuthButton = (function(_super) {
581   __extends(BasicAuthButton, _super);
582
583   function BasicAuthButton() {
584     return BasicAuthButton.__super__.constructor.apply(this, arguments);
585   }
586
587   BasicAuthButton.prototype.initialize = function() {};
588
589   BasicAuthButton.prototype.render = function() {
590     var template;
591     template = this.template();
592     $(this.el).html(template(this.model));
593     return this;
594   };
595
596   BasicAuthButton.prototype.events = {
597     "click #basic_auth_button": "togglePasswordContainer",
598     "click #apply_basic_auth": "applyPassword"
599   };
600
601   BasicAuthButton.prototype.applyPassword = function() {
602     var elem, password, username;
603     username = $(".input_username").val();
604     password = $(".input_password").val();
605     window.authorizations.add(this.model.type, new PasswordAuthorization("basic", username, password));
606     window.swaggerUi.load();
607     return elem = $('#basic_auth_container').hide();
608   };
609
610   BasicAuthButton.prototype.togglePasswordContainer = function() {
611     var elem;
612     if ($('#basic_auth_container').length > 0) {
613       elem = $('#basic_auth_container').show();
614       if (elem.is(':visible')) {
615         return elem.slideUp();
616       } else {
617         $('.auth_container').hide();
618         return elem.show();
619       }
620     }
621   };
622
623   BasicAuthButton.prototype.template = function() {
624     return Handlebars.templates.basic_auth_button_view;
625   };
626
627   return BasicAuthButton;
628
629 })(Backbone.View);
630
631 this["Handlebars"]["templates"]["operation"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
632   return "deprecated";
633   },"3":function(depth0,helpers,partials,data) {
634   return "            <h4>Warning: Deprecated</h4>\n";
635   },"5":function(depth0,helpers,partials,data) {
636   var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, buffer = "        <h4>Implementation Notes</h4>\n        <p class=\"markdown\">";
637   stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
638   if (stack1 != null) { buffer += stack1; }
639   return buffer + "</p>\n";
640 },"7":function(depth0,helpers,partials,data) {
641   return "        <div class=\"auth\">\n        <span class=\"api-ic ic-error\"></span>";
642   },"9":function(depth0,helpers,partials,data) {
643   var stack1, buffer = "          <div id=\"api_information_panel\" style=\"top: 526px; left: 776px; display: none;\">\n";
644   stack1 = helpers.each.call(depth0, depth0, {"name":"each","hash":{},"fn":this.program(10, data),"inverse":this.noop,"data":data});
645   if (stack1 != null) { buffer += stack1; }
646   return buffer + "          </div>\n";
647 },"10":function(depth0,helpers,partials,data) {
648   var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression, buffer = "            <div title='";
649   stack1 = lambda((depth0 != null ? depth0.description : depth0), depth0);
650   if (stack1 != null) { buffer += stack1; }
651   return buffer + "'>"
652     + escapeExpression(lambda((depth0 != null ? depth0.scope : depth0), depth0))
653     + "</div>\n";
654 },"12":function(depth0,helpers,partials,data) {
655   return "</div>";
656   },"14":function(depth0,helpers,partials,data) {
657   return "        <div class='access'>\n          <span class=\"api-ic ic-off\" title=\"click to authenticate\"></span>\n        </div>\n";
658   },"16":function(depth0,helpers,partials,data) {
659   var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
660   return "          <h4>Response Class (Status "
661     + escapeExpression(((helper = (helper = helpers.successCode || (depth0 != null ? depth0.successCode : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"successCode","hash":{},"data":data}) : helper)))
662     + ")</h4>\n          <p><span class=\"model-signature\" /></p>\n          <br/>\n          <div class=\"response-content-type\" />\n";
663 },"18":function(depth0,helpers,partials,data) {
664   return "          <h4>Parameters</h4>\n          <table class='fullwidth'>\n          <thead>\n            <tr>\n            <th style=\"width: 100px; max-width: 100px\">Parameter</th>\n            <th style=\"width: 310px; max-width: 310px\">Value</th>\n            <th style=\"width: 200px; max-width: 200px\">Description</th>\n            <th style=\"width: 100px; max-width: 100px\">Parameter Type</th>\n            <th style=\"width: 220px; max-width: 230px\">Data Type</th>\n            </tr>\n          </thead>\n          <tbody class=\"operation-params\">\n\n          </tbody>\n          </table>\n";
665   },"20":function(depth0,helpers,partials,data) {
666   return "          <div style='margin:0;padding:0;display:inline'></div>\n          <h4>Response Messages</h4>\n          <table class='fullwidth'>\n            <thead>\n            <tr>\n              <th>HTTP Status Code</th>\n              <th>Reason</th>\n              <th>Response Model</th>\n            </tr>\n            </thead>\n            <tbody class=\"operation-status\">\n            \n            </tbody>\n          </table>\n";
667   },"22":function(depth0,helpers,partials,data) {
668   return "";
669 },"24":function(depth0,helpers,partials,data) {
670   return "          <div class='sandbox_header'>\n            <input class='submit' name='commit' type='button' value='Try it out!' />\n            <a href='#' class='response_hider' style='display:none'>Hide Response</a>\n            <span class='response_throbber' style='display:none'></span>\n          </div>\n";
671   },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
672   var stack1, helper, options, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, blockHelperMissing=helpers.blockHelperMissing, buffer = "\n  <ul class='operations' >\n    <li class='"
673     + escapeExpression(((helper = (helper = helpers.method || (depth0 != null ? depth0.method : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"method","hash":{},"data":data}) : helper)))
674     + " operation' id='"
675     + escapeExpression(((helper = (helper = helpers.parentId || (depth0 != null ? depth0.parentId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"parentId","hash":{},"data":data}) : helper)))
676     + "_"
677     + escapeExpression(((helper = (helper = helpers.nickname || (depth0 != null ? depth0.nickname : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"nickname","hash":{},"data":data}) : helper)))
678     + "'>\n      <div class='heading'>\n        <h3>\n          <span class='http_method'>\n          <a href='#!/"
679     + escapeExpression(((helper = (helper = helpers.parentId || (depth0 != null ? depth0.parentId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"parentId","hash":{},"data":data}) : helper)))
680     + "/"
681     + escapeExpression(((helper = (helper = helpers.nickname || (depth0 != null ? depth0.nickname : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"nickname","hash":{},"data":data}) : helper)))
682     + "' class=\"toggleOperation\">"
683     + escapeExpression(((helper = (helper = helpers.method || (depth0 != null ? depth0.method : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"method","hash":{},"data":data}) : helper)))
684     + "</a>\n          </span>\n          <span class='path'>\n          <a href='#!/"
685     + escapeExpression(((helper = (helper = helpers.parentId || (depth0 != null ? depth0.parentId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"parentId","hash":{},"data":data}) : helper)))
686     + "/"
687     + escapeExpression(((helper = (helper = helpers.nickname || (depth0 != null ? depth0.nickname : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"nickname","hash":{},"data":data}) : helper)))
688     + "' class=\"toggleOperation ";
689   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.deprecated : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data});
690   if (stack1 != null) { buffer += stack1; }
691   buffer += "\">"
692     + escapeExpression(((helper = (helper = helpers.path || (depth0 != null ? depth0.path : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"path","hash":{},"data":data}) : helper)))
693     + "</a>\n          </span>\n        </h3>\n        <ul class='options'>\n          <li>\n          <a href='#!/"
694     + escapeExpression(((helper = (helper = helpers.parentId || (depth0 != null ? depth0.parentId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"parentId","hash":{},"data":data}) : helper)))
695     + "/"
696     + escapeExpression(((helper = (helper = helpers.nickname || (depth0 != null ? depth0.nickname : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"nickname","hash":{},"data":data}) : helper)))
697     + "' class=\"toggleOperation\">";
698   stack1 = ((helper = (helper = helpers.summary || (depth0 != null ? depth0.summary : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"summary","hash":{},"data":data}) : helper));
699   if (stack1 != null) { buffer += stack1; }
700   buffer += "</a>\n          </li>\n        </ul>\n      </div>\n      <div class='content' id='"
701     + escapeExpression(((helper = (helper = helpers.parentId || (depth0 != null ? depth0.parentId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"parentId","hash":{},"data":data}) : helper)))
702     + "_"
703     + escapeExpression(((helper = (helper = helpers.nickname || (depth0 != null ? depth0.nickname : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"nickname","hash":{},"data":data}) : helper)))
704     + "_content' style='display:none'>\n";
705   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.deprecated : depth0), {"name":"if","hash":{},"fn":this.program(3, data),"inverse":this.noop,"data":data});
706   if (stack1 != null) { buffer += stack1; }
707   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.description : depth0), {"name":"if","hash":{},"fn":this.program(5, data),"inverse":this.noop,"data":data});
708   if (stack1 != null) { buffer += stack1; }
709   stack1 = ((helper = (helper = helpers.oauth || (depth0 != null ? depth0.oauth : depth0)) != null ? helper : helperMissing),(options={"name":"oauth","hash":{},"fn":this.program(7, data),"inverse":this.noop,"data":data}),(typeof helper === functionType ? helper.call(depth0, options) : helper));
710   if (!helpers.oauth) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
711   if (stack1 != null) { buffer += stack1; }
712   buffer += "\n";
713   stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.oauth : depth0), {"name":"each","hash":{},"fn":this.program(9, data),"inverse":this.noop,"data":data});
714   if (stack1 != null) { buffer += stack1; }
715   buffer += "        ";
716   stack1 = ((helper = (helper = helpers.oauth || (depth0 != null ? depth0.oauth : depth0)) != null ? helper : helperMissing),(options={"name":"oauth","hash":{},"fn":this.program(12, data),"inverse":this.noop,"data":data}),(typeof helper === functionType ? helper.call(depth0, options) : helper));
717   if (!helpers.oauth) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
718   if (stack1 != null) { buffer += stack1; }
719   buffer += "\n";
720   stack1 = ((helper = (helper = helpers.oauth || (depth0 != null ? depth0.oauth : depth0)) != null ? helper : helperMissing),(options={"name":"oauth","hash":{},"fn":this.program(14, data),"inverse":this.noop,"data":data}),(typeof helper === functionType ? helper.call(depth0, options) : helper));
721   if (!helpers.oauth) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
722   if (stack1 != null) { buffer += stack1; }
723   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.type : depth0), {"name":"if","hash":{},"fn":this.program(16, data),"inverse":this.noop,"data":data});
724   if (stack1 != null) { buffer += stack1; }
725   buffer += "        <form accept-charset='UTF-8' class='sandbox'>\n          <div style='margin:0;padding:0;display:inline'></div>\n";
726   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.parameters : depth0), {"name":"if","hash":{},"fn":this.program(18, data),"inverse":this.noop,"data":data});
727   if (stack1 != null) { buffer += stack1; }
728   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.responseMessages : depth0), {"name":"if","hash":{},"fn":this.program(20, data),"inverse":this.noop,"data":data});
729   if (stack1 != null) { buffer += stack1; }
730   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isReadOnly : depth0), {"name":"if","hash":{},"fn":this.program(22, data),"inverse":this.program(24, data),"data":data});
731   if (stack1 != null) { buffer += stack1; }
732   return buffer + "        </form>\n        <div class='response' style='display:none'>\n          <h4>Request URL</h4>\n          <div class='block request_url'></div>\n          <h4>Response Body</h4>\n          <div class='block response_body'></div>\n          <h4>Response Code</h4>\n          <div class='block response_code'></div>\n          <h4>Response Headers</h4>\n          <div class='block response_headers'></div>\n        </div>\n      </div>\n    </li>\n  </ul>\n";
733 },"useData":true});
734 var ContentTypeView,
735   __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
736   __hasProp = {}.hasOwnProperty;
737
738 ContentTypeView = (function(_super) {
739   __extends(ContentTypeView, _super);
740
741   function ContentTypeView() {
742     return ContentTypeView.__super__.constructor.apply(this, arguments);
743   }
744
745   ContentTypeView.prototype.initialize = function() {};
746
747   ContentTypeView.prototype.render = function() {
748     var template;
749     template = this.template();
750     $(this.el).html(template(this.model));
751     $('label[for=contentType]', $(this.el)).text('Response Content Type');
752     return this;
753   };
754
755   ContentTypeView.prototype.template = function() {
756     return Handlebars.templates.content_type;
757   };
758
759   return ContentTypeView;
760
761 })(Backbone.View);
762
763 this["Handlebars"]["templates"]["param"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
764   var stack1, buffer = "";
765   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isFile : depth0), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.program(4, data),"data":data});
766   if (stack1 != null) { buffer += stack1; }
767   return buffer;
768 },"2":function(depth0,helpers,partials,data) {
769   var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
770   return "                      <input type=\"file\" name='"
771     + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
772     + "'/>\n                    <div class=\"parameter-content-type\" />\n";
773 },"4":function(depth0,helpers,partials,data) {
774   var stack1, buffer = "";
775   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(5, data),"inverse":this.program(7, data),"data":data});
776   if (stack1 != null) { buffer += stack1; }
777   return buffer;
778 },"5":function(depth0,helpers,partials,data) {
779   var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
780   return "                              <textarea class='body-textarea' name='"
781     + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
782     + "'>"
783     + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
784     + "</textarea>\n        <br />\n        <div class=\"parameter-content-type\" />\n";
785 },"7":function(depth0,helpers,partials,data) {
786   var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
787   return "                              <textarea class='body-textarea' name='"
788     + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
789     + "'></textarea>\n                          <br />\n                                <div class=\"parameter-content-type\" />\n";
790 },"9":function(depth0,helpers,partials,data) {
791   var stack1, buffer = "";
792   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isFile : depth0), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.program(10, data),"data":data});
793   if (stack1 != null) { buffer += stack1; }
794   return buffer;
795 },"10":function(depth0,helpers,partials,data) {
796   var stack1, buffer = "";
797   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(11, data),"inverse":this.program(13, data),"data":data});
798   if (stack1 != null) { buffer += stack1; }
799   return buffer;
800 },"11":function(depth0,helpers,partials,data) {
801   var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
802   return "                              <input class='parameter' minlength='0' name='"
803     + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
804     + "' placeholder='' type='text' value='"
805     + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
806     + "'/>\n";
807 },"13":function(depth0,helpers,partials,data) {
808   var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
809   return "                              <input class='parameter' minlength='0' name='"
810     + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
811     + "' placeholder='' type='text' value=''/>\n";
812 },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
813   var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code'>"
814     + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
815     + "</td>\n<td>\n\n";
816   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(9, data),"data":data});
817   if (stack1 != null) { buffer += stack1; }
818   buffer += "\n</td>\n<td class=\"markdown\">";
819   stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
820   if (stack1 != null) { buffer += stack1; }
821   buffer += "</td>\n<td>";
822   stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
823   if (stack1 != null) { buffer += stack1; }
824   return buffer + "</td>\n<td>\n        <span class=\"model-signature\"></span>\n</td>\n";
825 },"useData":true});
826 var HeaderView,
827   __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
828   __hasProp = {}.hasOwnProperty;
829
830 HeaderView = (function(_super) {
831   __extends(HeaderView, _super);
832
833   function HeaderView() {
834     return HeaderView.__super__.constructor.apply(this, arguments);
835   }
836
837   HeaderView.prototype.events = {
838     'click #show-pet-store-icon': 'showPetStore',
839     'click #show-wordnik-dev-icon': 'showWordnikDev',
840     'click #explore': 'showCustom',
841     'keyup #input_baseUrl': 'showCustomOnKeyup',
842     'keyup #input_apiKey': 'showCustomOnKeyup'
843   };
844
845   HeaderView.prototype.initialize = function() {};
846
847   HeaderView.prototype.showPetStore = function(e) {
848     return this.trigger('update-swagger-ui', {
849       url: "http://petstore.swagger.wordnik.com/api/api-docs"
850     });
851   };
852
853   HeaderView.prototype.showWordnikDev = function(e) {
854     return this.trigger('update-swagger-ui', {
855       url: "http://api.wordnik.com/v4/resources.json"
856     });
857   };
858
859   HeaderView.prototype.showCustomOnKeyup = function(e) {
860     if (e.keyCode === 13) {
861       return this.showCustom();
862     }
863   };
864
865   HeaderView.prototype.showCustom = function(e) {
866     if (e != null) {
867       e.preventDefault();
868     }
869     return this.trigger('update-swagger-ui', {
870       url: $('#input_baseUrl').val(),
871       apiKey: $('#input_apiKey').val()
872     });
873   };
874
875   HeaderView.prototype.update = function(url, apiKey, trigger) {
876     if (trigger == null) {
877       trigger = false;
878     }
879     $('#input_baseUrl').val(url);
880     if (trigger) {
881       return this.trigger('update-swagger-ui', {
882         url: url
883       });
884     }
885   };
886
887   return HeaderView;
888
889 })(Backbone.View);
890
891 this["Handlebars"]["templates"]["param_list"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
892   return " multiple='multiple'";
893   },"3":function(depth0,helpers,partials,data) {
894   return "";
895 },"5":function(depth0,helpers,partials,data) {
896   var stack1, buffer = "";
897   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(3, data),"inverse":this.program(6, data),"data":data});
898   if (stack1 != null) { buffer += stack1; }
899   return buffer;
900 },"6":function(depth0,helpers,partials,data) {
901   var stack1, helperMissing=helpers.helperMissing, buffer = "";
902   stack1 = ((helpers.isArray || (depth0 && depth0.isArray) || helperMissing).call(depth0, depth0, {"name":"isArray","hash":{},"fn":this.program(3, data),"inverse":this.program(7, data),"data":data}));
903   if (stack1 != null) { buffer += stack1; }
904   return buffer;
905 },"7":function(depth0,helpers,partials,data) {
906   return "          <option selected=\"\" value=''></option>\n";
907   },"9":function(depth0,helpers,partials,data) {
908   var stack1, buffer = "";
909   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isDefault : depth0), {"name":"if","hash":{},"fn":this.program(10, data),"inverse":this.program(12, data),"data":data});
910   if (stack1 != null) { buffer += stack1; }
911   return buffer;
912 },"10":function(depth0,helpers,partials,data) {
913   var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
914   return "        <option selected=\"\" value='"
915     + escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
916     + "'>"
917     + escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
918     + " (default)</option>\n";
919 },"12":function(depth0,helpers,partials,data) {
920   var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
921   return "        <option value='"
922     + escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
923     + "'>"
924     + escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
925     + "</option>\n";
926 },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
927   var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code'>"
928     + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
929     + "</td>\n<td>\n  <select ";
930   stack1 = ((helpers.isArray || (depth0 && depth0.isArray) || helperMissing).call(depth0, depth0, {"name":"isArray","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data}));
931   if (stack1 != null) { buffer += stack1; }
932   buffer += " class='parameter' name='"
933     + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
934     + "'>\n";
935   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.required : depth0), {"name":"if","hash":{},"fn":this.program(3, data),"inverse":this.program(5, data),"data":data});
936   if (stack1 != null) { buffer += stack1; }
937   stack1 = helpers.each.call(depth0, ((stack1 = (depth0 != null ? depth0.allowableValues : depth0)) != null ? stack1.descriptiveValues : stack1), {"name":"each","hash":{},"fn":this.program(9, data),"inverse":this.noop,"data":data});
938   if (stack1 != null) { buffer += stack1; }
939   buffer += "  </select>\n</td>\n<td class=\"markdown\">";
940   stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
941   if (stack1 != null) { buffer += stack1; }
942   buffer += "</td>\n<td>";
943   stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
944   if (stack1 != null) { buffer += stack1; }
945   return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>";
946 },"useData":true});
947 var MainView,
948   __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
949   __hasProp = {}.hasOwnProperty;
950
951 MainView = (function(_super) {
952   var sorters;
953
954   __extends(MainView, _super);
955
956   function MainView() {
957     return MainView.__super__.constructor.apply(this, arguments);
958   }
959
960   sorters = {
961     'alpha': function(a, b) {
962       return a.path.localeCompare(b.path);
963     },
964     'method': function(a, b) {
965       return a.method.localeCompare(b.method);
966     }
967   };
968
969   MainView.prototype.initialize = function(opts) {
970     var auth, key, value, _ref;
971     if (opts == null) {
972       opts = {};
973     }
974     this.model.auths = [];
975     _ref = this.model.securityDefinitions;
976     for (key in _ref) {
977       value = _ref[key];
978       auth = {
979         name: key,
980         type: value.type,
981         value: value
982       };
983       this.model.auths.push(auth);
984     }
985     if (this.model.swaggerVersion === "2.0") {
986       if ("validatorUrl" in opts.swaggerOptions) {
987         return this.model.validatorUrl = opts.swaggerOptions.validatorUrl;
988       } else if (this.model.url.indexOf("localhost") > 0) {
989         return this.model.validatorUrl = null;
990       } else {
991         return this.model.validatorUrl = "http://online.swagger.io/validator";
992       }
993     }
994   };
995
996   MainView.prototype.render = function() {
997     var auth, button, counter, id, name, resource, resources, _i, _len, _ref;
998     if (this.model.securityDefinitions) {
999       for (name in this.model.securityDefinitions) {
1000         auth = this.model.securityDefinitions[name];
1001         if (auth.type === "apiKey" && $("#apikey_button").length === 0) {
1002           button = new ApiKeyButton({
1003             model: auth
1004           }).render().el;
1005           $('.auth_main_container').append(button);
1006         }
1007         if (auth.type === "basicAuth" && $("#basic_auth_button").length === 0) {
1008           button = new BasicAuthButton({
1009             model: auth
1010           }).render().el;
1011           $('.auth_main_container').append(button);
1012         }
1013       }
1014     }
1015     $(this.el).html(Handlebars.templates.main(this.model));
1016     resources = {};
1017     counter = 0;
1018     _ref = this.model.apisArray;
1019     for (_i = 0, _len = _ref.length; _i < _len; _i++) {
1020       resource = _ref[_i];
1021       id = resource.name;
1022       while (typeof resources[id] !== 'undefined') {
1023         id = id + "_" + counter;
1024         counter += 1;
1025       }
1026       resource.id = id;
1027       resources[id] = resource;
1028       this.addResource(resource, this.model.auths);
1029     }
1030     $('.propWrap').hover(function() {
1031       return $('.optionsWrapper', $(this)).show();
1032     }, function() {
1033       return $('.optionsWrapper', $(this)).hide();
1034     });
1035     return this;
1036   };
1037
1038   MainView.prototype.addResource = function(resource, auths) {
1039     var resourceView;
1040     resource.id = resource.id.replace(/\s/g, '_');
1041     resourceView = new ResourceView({
1042       model: resource,
1043       tagName: 'li',
1044       id: 'resource_' + resource.id,
1045       className: 'resource',
1046       auths: auths,
1047       swaggerOptions: this.options.swaggerOptions
1048     });
1049     return $('#resources').append(resourceView.render().el);
1050   };
1051
1052   MainView.prototype.clear = function() {
1053     return $(this.el).html('');
1054   };
1055
1056   return MainView;
1057
1058 })(Backbone.View);
1059
1060 this["Handlebars"]["templates"]["param_readonly"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
1061   var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1062   return "        <textarea class='body-textarea' readonly='readonly' name='"
1063     + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
1064     + "'>"
1065     + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
1066     + "</textarea>\n";
1067 },"3":function(depth0,helpers,partials,data) {
1068   var stack1, buffer = "";
1069   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(4, data),"inverse":this.program(6, data),"data":data});
1070   if (stack1 != null) { buffer += stack1; }
1071   return buffer;
1072 },"4":function(depth0,helpers,partials,data) {
1073   var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1074   return "            "
1075     + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
1076     + "\n";
1077 },"6":function(depth0,helpers,partials,data) {
1078   return "            (empty)\n";
1079   },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
1080   var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code'>"
1081     + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
1082     + "</td>\n<td>\n";
1083   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(3, data),"data":data});
1084   if (stack1 != null) { buffer += stack1; }
1085   buffer += "</td>\n<td class=\"markdown\">";
1086   stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
1087   if (stack1 != null) { buffer += stack1; }
1088   buffer += "</td>\n<td>";
1089   stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
1090   if (stack1 != null) { buffer += stack1; }
1091   return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
1092 },"useData":true});
1093 this["Handlebars"]["templates"]["param_readonly_required"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
1094   var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1095   return "        <textarea class='body-textarea'  readonly='readonly' placeholder='(required)' name='"
1096     + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
1097     + "'>"
1098     + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
1099     + "</textarea>\n";
1100 },"3":function(depth0,helpers,partials,data) {
1101   var stack1, buffer = "";
1102   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(4, data),"inverse":this.program(6, data),"data":data});
1103   if (stack1 != null) { buffer += stack1; }
1104   return buffer;
1105 },"4":function(depth0,helpers,partials,data) {
1106   var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1107   return "            "
1108     + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
1109     + "\n";
1110 },"6":function(depth0,helpers,partials,data) {
1111   return "            (empty)\n";
1112   },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
1113   var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code required'>"
1114     + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
1115     + "</td>\n<td>\n";
1116   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(3, data),"data":data});
1117   if (stack1 != null) { buffer += stack1; }
1118   buffer += "</td>\n<td class=\"markdown\">";
1119   stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
1120   if (stack1 != null) { buffer += stack1; }
1121   buffer += "</td>\n<td>";
1122   stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
1123   if (stack1 != null) { buffer += stack1; }
1124   return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
1125 },"useData":true});
1126 var OperationView,
1127   __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
1128   __hasProp = {}.hasOwnProperty;
1129
1130 OperationView = (function(_super) {
1131   __extends(OperationView, _super);
1132
1133   function OperationView() {
1134     return OperationView.__super__.constructor.apply(this, arguments);
1135   }
1136
1137   OperationView.prototype.invocationUrl = null;
1138
1139   OperationView.prototype.events = {
1140     'submit .sandbox': 'submitOperation',
1141     'click .submit': 'submitOperation',
1142     'click .response_hider': 'hideResponse',
1143     'click .toggleOperation': 'toggleOperationContent',
1144     'mouseenter .api-ic': 'mouseEnter',
1145     'mouseout .api-ic': 'mouseExit'
1146   };
1147
1148   OperationView.prototype.initialize = function(opts) {
1149     if (opts == null) {
1150       opts = {};
1151     }
1152     this.auths = opts.auths;
1153     this.parentId = this.model.parentId;
1154     this.nickname = this.model.nickname;
1155     return this;
1156   };
1157
1158   OperationView.prototype.mouseEnter = function(e) {
1159     var elem, hgh, pos, scMaxX, scMaxY, scX, scY, wd, x, y;
1160     elem = $(this.el).find('.content');
1161     x = e.pageX;
1162     y = e.pageY;
1163     scX = $(window).scrollLeft();
1164     scY = $(window).scrollTop();
1165     scMaxX = scX + $(window).width();
1166     scMaxY = scY + $(window).height();
1167     wd = elem.width();
1168     hgh = elem.height();
1169     if (x + wd > scMaxX) {
1170       x = scMaxX - wd;
1171     }
1172     if (x < scX) {
1173       x = scX;
1174     }
1175     if (y + hgh > scMaxY) {
1176       y = scMaxY - hgh;
1177     }
1178     if (y < scY) {
1179       y = scY;
1180     }
1181     pos = {};
1182     pos.top = y;
1183     pos.left = x;
1184     elem.css(pos);
1185     return $(e.currentTarget.parentNode).find('#api_information_panel').show();
1186   };
1187
1188   OperationView.prototype.mouseExit = function(e) {
1189     return $(e.currentTarget.parentNode).find('#api_information_panel').hide();
1190   };
1191
1192   OperationView.prototype.render = function() {
1193     var a, auth, auths, code, contentTypeModel, isMethodSubmissionSupported, k, key, modelAuths, o, param, ref, responseContentTypeView, responseSignatureView, schema, schemaObj, scopeIndex, signatureModel, statusCode, successResponse, type, v, value, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _m, _ref, _ref1, _ref2, _ref3, _ref4;
1194     isMethodSubmissionSupported = jQuery.inArray(this.model.method, this.model.supportedSubmitMethods()) >= 0;
1195     if (!isMethodSubmissionSupported) {
1196       this.model.isReadOnly = true;
1197     }
1198     this.model.description = this.model.description || this.model.notes;
1199     if (this.model.description) {
1200       this.model.description = this.model.description.replace(/(?:\r\n|\r|\n)/g, '<br />');
1201     }
1202     this.model.oauth = null;
1203     modelAuths = this.model.authorizations || this.model.security;
1204     if (modelAuths) {
1205       if (Array.isArray(modelAuths)) {
1206         for (_i = 0, _len = modelAuths.length; _i < _len; _i++) {
1207           auths = modelAuths[_i];
1208           for (key in auths) {
1209             auth = auths[key];
1210             for (a in this.auths) {
1211               auth = this.auths[a];
1212               if (auth.type === 'oauth2') {
1213                 this.model.oauth = {};
1214                 this.model.oauth.scopes = [];
1215                 _ref = auth.value.scopes;
1216                 for (k in _ref) {
1217                   v = _ref[k];
1218                   scopeIndex = auths[key].indexOf(k);
1219                   if (scopeIndex >= 0) {
1220                     o = {
1221                       scope: k,
1222                       description: v
1223                     };
1224                     this.model.oauth.scopes.push(o);
1225                   }
1226                 }
1227               }
1228             }
1229           }
1230         }
1231       } else {
1232         for (k in modelAuths) {
1233           v = modelAuths[k];
1234           if (k === "oauth2") {
1235             if (this.model.oauth === null) {
1236               this.model.oauth = {};
1237             }
1238             if (this.model.oauth.scopes === void 0) {
1239               this.model.oauth.scopes = [];
1240             }
1241             for (_j = 0, _len1 = v.length; _j < _len1; _j++) {
1242               o = v[_j];
1243               this.model.oauth.scopes.push(o);
1244             }
1245           }
1246         }
1247       }
1248     }
1249     if (typeof this.model.responses !== 'undefined') {
1250       this.model.responseMessages = [];
1251       _ref1 = this.model.responses;
1252       for (code in _ref1) {
1253         value = _ref1[code];
1254         schema = null;
1255         schemaObj = this.model.responses[code].schema;
1256         if (schemaObj && schemaObj['$ref']) {
1257           schema = schemaObj['$ref'];
1258           if (schema.indexOf('#/definitions/') === 0) {
1259             schema = schema.substring('#/definitions/'.length);
1260           }
1261         }
1262         this.model.responseMessages.push({
1263           code: code,
1264           message: value.description,
1265           responseModel: schema
1266         });
1267       }
1268     }
1269     if (typeof this.model.responseMessages === 'undefined') {
1270       this.model.responseMessages = [];
1271     }
1272     signatureModel = null;
1273     if (this.model.successResponse) {
1274       successResponse = this.model.successResponse;
1275       for (key in successResponse) {
1276         value = successResponse[key];
1277         this.model.successCode = key;
1278         if (typeof value === 'object' && typeof value.createJSONSample === 'function') {
1279           signatureModel = {
1280             sampleJSON: JSON.stringify(value.createJSONSample(), void 0, 2),
1281             isParam: false,
1282             signature: value.getMockSignature()
1283           };
1284         }
1285       }
1286     } else if (this.model.responseClassSignature && this.model.responseClassSignature !== 'string') {
1287       signatureModel = {
1288         sampleJSON: this.model.responseSampleJSON,
1289         isParam: false,
1290         signature: this.model.responseClassSignature
1291       };
1292     }
1293     $(this.el).html(Handlebars.templates.operation(this.model));
1294     if (signatureModel) {
1295       responseSignatureView = new SignatureView({
1296         model: signatureModel,
1297         tagName: 'div'
1298       });
1299       $('.model-signature', $(this.el)).append(responseSignatureView.render().el);
1300     } else {
1301       this.model.responseClassSignature = 'string';
1302       $('.model-signature', $(this.el)).html(this.model.type);
1303     }
1304     contentTypeModel = {
1305       isParam: false
1306     };
1307     contentTypeModel.consumes = this.model.consumes;
1308     contentTypeModel.produces = this.model.produces;
1309     _ref2 = this.model.parameters;
1310     for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
1311       param = _ref2[_k];
1312       type = param.type || param.dataType || '';
1313       if (typeof type === 'undefined') {
1314         schema = param.schema;
1315         if (schema && schema['$ref']) {
1316           ref = schema['$ref'];
1317           if (ref.indexOf('#/definitions/') === 0) {
1318             type = ref.substring('#/definitions/'.length);
1319           } else {
1320             type = ref;
1321           }
1322         }
1323       }
1324       if (type && type.toLowerCase() === 'file') {
1325         if (!contentTypeModel.consumes) {
1326           contentTypeModel.consumes = 'multipart/form-data';
1327         }
1328       }
1329       param.type = type;
1330     }
1331     responseContentTypeView = new ResponseContentTypeView({
1332       model: contentTypeModel
1333     });
1334     $('.response-content-type', $(this.el)).append(responseContentTypeView.render().el);
1335     _ref3 = this.model.parameters;
1336     for (_l = 0, _len3 = _ref3.length; _l < _len3; _l++) {
1337       param = _ref3[_l];
1338       this.addParameter(param, contentTypeModel.consumes);
1339     }
1340     _ref4 = this.model.responseMessages;
1341     for (_m = 0, _len4 = _ref4.length; _m < _len4; _m++) {
1342       statusCode = _ref4[_m];
1343       this.addStatusCode(statusCode);
1344     }
1345     return this;
1346   };
1347
1348   OperationView.prototype.addParameter = function(param, consumes) {
1349     var paramView;
1350     param.consumes = consumes;
1351     paramView = new ParameterView({
1352       model: param,
1353       tagName: 'tr',
1354       readOnly: this.model.isReadOnly
1355     });
1356     return $('.operation-params', $(this.el)).append(paramView.render().el);
1357   };
1358
1359   OperationView.prototype.addStatusCode = function(statusCode) {
1360     var statusCodeView;
1361     statusCodeView = new StatusCodeView({
1362       model: statusCode,
1363       tagName: 'tr'
1364     });
1365     return $('.operation-status', $(this.el)).append(statusCodeView.render().el);
1366   };
1367
1368   OperationView.prototype.submitOperation = function(e) {
1369     var error_free, form, isFileUpload, map, o, opts, val, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2;
1370     if (e != null) {
1371       e.preventDefault();
1372     }
1373     form = $('.sandbox', $(this.el));
1374     error_free = true;
1375     form.find("input.required").each(function() {
1376       $(this).removeClass("error");
1377       if (jQuery.trim($(this).val()) === "") {
1378         $(this).addClass("error");
1379         $(this).wiggle({
1380           callback: (function(_this) {
1381             return function() {
1382               return $(_this).focus();
1383             };
1384           })(this)
1385         });
1386         return error_free = false;
1387       }
1388     });
1389     form.find("textarea.required").each(function() {
1390       $(this).removeClass("error");
1391       if (jQuery.trim($(this).val()) === "") {
1392         $(this).addClass("error");
1393         $(this).wiggle({
1394           callback: (function(_this) {
1395             return function() {
1396               return $(_this).focus();
1397             };
1398           })(this)
1399         });
1400         return error_free = false;
1401       }
1402     });
1403     if (error_free) {
1404       map = {};
1405       opts = {
1406         parent: this
1407       };
1408       isFileUpload = false;
1409       _ref = form.find("input");
1410       for (_i = 0, _len = _ref.length; _i < _len; _i++) {
1411         o = _ref[_i];
1412         if ((o.value != null) && jQuery.trim(o.value).length > 0) {
1413           map[o.name] = o.value;
1414         }
1415         if (o.type === "file") {
1416           map[o.name] = o.files[0];
1417           isFileUpload = true;
1418         }
1419       }
1420       _ref1 = form.find("textarea");
1421       for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
1422         o = _ref1[_j];
1423         if ((o.value != null) && jQuery.trim(o.value).length > 0) {
1424           map[o.name] = o.value;
1425         }
1426       }
1427       _ref2 = form.find("select");
1428       for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
1429         o = _ref2[_k];
1430         val = this.getSelectedValue(o);
1431         if ((val != null) && jQuery.trim(val).length > 0) {
1432           map[o.name] = val;
1433         }
1434       }
1435       opts.responseContentType = $("div select[name=responseContentType]", $(this.el)).val();
1436       opts.requestContentType = $("div select[name=parameterContentType]", $(this.el)).val();
1437       $(".response_throbber", $(this.el)).show();
1438       if (isFileUpload) {
1439         return this.handleFileUpload(map, form);
1440       } else {
1441         return this.model["do"](map, opts, this.showCompleteStatus, this.showErrorStatus, this);
1442       }
1443     }
1444   };
1445
1446   OperationView.prototype.success = function(response, parent) {
1447     return parent.showCompleteStatus(response);
1448   };
1449
1450   OperationView.prototype.handleFileUpload = function(map, form) {
1451     var bodyParam, el, headerParams, o, obj, param, params, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref, _ref1, _ref2, _ref3;
1452     _ref = form.serializeArray();
1453     for (_i = 0, _len = _ref.length; _i < _len; _i++) {
1454       o = _ref[_i];
1455       if ((o.value != null) && jQuery.trim(o.value).length > 0) {
1456         map[o.name] = o.value;
1457       }
1458     }
1459     bodyParam = new FormData();
1460     params = 0;
1461     _ref1 = this.model.parameters;
1462     for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
1463       param = _ref1[_j];
1464       if (param.paramType === 'form' || param["in"] === 'formData') {
1465         if (param.type.toLowerCase() !== 'file' && map[param.name] !== void 0) {
1466           bodyParam.append(param.name, map[param.name]);
1467         }
1468       }
1469     }
1470     headerParams = {};
1471     _ref2 = this.model.parameters;
1472     for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
1473       param = _ref2[_k];
1474       if (param.paramType === 'header') {
1475         headerParams[param.name] = map[param.name];
1476       }
1477     }
1478     _ref3 = form.find('input[type~="file"]');
1479     for (_l = 0, _len3 = _ref3.length; _l < _len3; _l++) {
1480       el = _ref3[_l];
1481       if (typeof el.files[0] !== 'undefined') {
1482         bodyParam.append($(el).attr('name'), el.files[0]);
1483         params += 1;
1484       }
1485     }
1486     this.invocationUrl = this.model.supportHeaderParams() ? (headerParams = this.model.getHeaderParams(map), delete headerParams['Content-Type'], this.model.urlify(map, false)) : this.model.urlify(map, true);
1487     $(".request_url", $(this.el)).html("<pre></pre>");
1488     $(".request_url pre", $(this.el)).text(this.invocationUrl);
1489     obj = {
1490       type: this.model.method,
1491       url: this.invocationUrl,
1492       headers: headerParams,
1493       data: bodyParam,
1494       dataType: 'json',
1495       contentType: false,
1496       processData: false,
1497       error: (function(_this) {
1498         return function(data, textStatus, error) {
1499           return _this.showErrorStatus(_this.wrap(data), _this);
1500         };
1501       })(this),
1502       success: (function(_this) {
1503         return function(data) {
1504           return _this.showResponse(data, _this);
1505         };
1506       })(this),
1507       complete: (function(_this) {
1508         return function(data) {
1509           return _this.showCompleteStatus(_this.wrap(data), _this);
1510         };
1511       })(this)
1512     };
1513     if (window.authorizations) {
1514       window.authorizations.apply(obj);
1515     }
1516     if (params === 0) {
1517       obj.data.append("fake", "true");
1518     }
1519     jQuery.ajax(obj);
1520     return false;
1521   };
1522
1523   OperationView.prototype.wrap = function(data) {
1524     var h, headerArray, headers, i, o, _i, _len;
1525     headers = {};
1526     headerArray = data.getAllResponseHeaders().split("\r");
1527     for (_i = 0, _len = headerArray.length; _i < _len; _i++) {
1528       i = headerArray[_i];
1529       h = i.match(/^([^:]*?):(.*)$/);
1530       if (!h) {
1531         h = [];
1532       }
1533       h.shift();
1534       if (h[0] !== void 0 && h[1] !== void 0) {
1535         headers[h[0].trim()] = h[1].trim();
1536       }
1537     }
1538     o = {};
1539     o.content = {};
1540     o.content.data = data.responseText;
1541     o.headers = headers;
1542     o.request = {};
1543     o.request.url = this.invocationUrl;
1544     o.status = data.status;
1545     return o;
1546   };
1547
1548   OperationView.prototype.getSelectedValue = function(select) {
1549     var opt, options, _i, _len, _ref;
1550     if (!select.multiple) {
1551       return select.value;
1552     } else {
1553       options = [];
1554       _ref = select.options;
1555       for (_i = 0, _len = _ref.length; _i < _len; _i++) {
1556         opt = _ref[_i];
1557         if (opt.selected) {
1558           options.push(opt.value);
1559         }
1560       }
1561       if (options.length > 0) {
1562         return options;
1563       } else {
1564         return null;
1565       }
1566     }
1567   };
1568
1569   OperationView.prototype.hideResponse = function(e) {
1570     if (e != null) {
1571       e.preventDefault();
1572     }
1573     $(".response", $(this.el)).slideUp();
1574     return $(".response_hider", $(this.el)).fadeOut();
1575   };
1576
1577   OperationView.prototype.showResponse = function(response) {
1578     var prettyJson;
1579     prettyJson = JSON.stringify(response, null, "\t").replace(/\n/g, "<br>");
1580     return $(".response_body", $(this.el)).html(escape(prettyJson));
1581   };
1582
1583   OperationView.prototype.showErrorStatus = function(data, parent) {
1584     return parent.showStatus(data);
1585   };
1586
1587   OperationView.prototype.showCompleteStatus = function(data, parent) {
1588     return parent.showStatus(data);
1589   };
1590
1591   OperationView.prototype.formatXml = function(xml) {
1592     var contexp, formatted, indent, lastType, lines, ln, pad, reg, transitions, wsexp, _fn, _i, _len;
1593     reg = /(>)(<)(\/*)/g;
1594     wsexp = /[ ]*(.*)[ ]+\n/g;
1595     contexp = /(<.+>)(.+\n)/g;
1596     xml = xml.replace(reg, '$1\n$2$3').replace(wsexp, '$1\n').replace(contexp, '$1\n$2');
1597     pad = 0;
1598     formatted = '';
1599     lines = xml.split('\n');
1600     indent = 0;
1601     lastType = 'other';
1602     transitions = {
1603       'single->single': 0,
1604       'single->closing': -1,
1605       'single->opening': 0,
1606       'single->other': 0,
1607       'closing->single': 0,
1608       'closing->closing': -1,
1609       'closing->opening': 0,
1610       'closing->other': 0,
1611       'opening->single': 1,
1612       'opening->closing': 0,
1613       'opening->opening': 1,
1614       'opening->other': 1,
1615       'other->single': 0,
1616       'other->closing': -1,
1617       'other->opening': 0,
1618       'other->other': 0
1619     };
1620     _fn = function(ln) {
1621       var fromTo, j, key, padding, type, types, value;
1622       types = {
1623         single: Boolean(ln.match(/<.+\/>/)),
1624         closing: Boolean(ln.match(/<\/.+>/)),
1625         opening: Boolean(ln.match(/<[^!?].*>/))
1626       };
1627       type = ((function() {
1628         var _results;
1629         _results = [];
1630         for (key in types) {
1631           value = types[key];
1632           if (value) {
1633             _results.push(key);
1634           }
1635         }
1636         return _results;
1637       })())[0];
1638       type = type === void 0 ? 'other' : type;
1639       fromTo = lastType + '->' + type;
1640       lastType = type;
1641       padding = '';
1642       indent += transitions[fromTo];
1643       padding = ((function() {
1644         var _j, _ref, _results;
1645         _results = [];
1646         for (j = _j = 0, _ref = indent; 0 <= _ref ? _j < _ref : _j > _ref; j = 0 <= _ref ? ++_j : --_j) {
1647           _results.push('  ');
1648         }
1649         return _results;
1650       })()).join('');
1651       if (fromTo === 'opening->closing') {
1652         return formatted = formatted.substr(0, formatted.length - 1) + ln + '\n';
1653       } else {
1654         return formatted += padding + ln + '\n';
1655       }
1656     };
1657     for (_i = 0, _len = lines.length; _i < _len; _i++) {
1658       ln = lines[_i];
1659       _fn(ln);
1660     }
1661     return formatted;
1662   };
1663
1664   OperationView.prototype.showStatus = function(response) {
1665     var code, content, contentType, e, headers, json, opts, pre, response_body, response_body_el, url;
1666     if (response.content === void 0) {
1667       content = response.data;
1668       url = response.url;
1669     } else {
1670       content = response.content.data;
1671       url = response.request.url;
1672     }
1673     headers = response.headers;
1674     contentType = null;
1675     if (headers) {
1676       contentType = headers["Content-Type"] || headers["content-type"];
1677       if (contentType) {
1678         contentType = contentType.split(";")[0].trim();
1679       }
1680     }
1681     $(".response_body", $(this.el)).removeClass('json');
1682     $(".response_body", $(this.el)).removeClass('xml');
1683     if (!content) {
1684       code = $('<code />').text("no content");
1685       pre = $('<pre class="json" />').append(code);
1686     } else if (contentType === "application/json" || /\+json$/.test(contentType)) {
1687       json = null;
1688       try {
1689         json = JSON.stringify(JSON.parse(content), null, "  ");
1690       } catch (_error) {
1691         e = _error;
1692         json = "can't parse JSON.  Raw result:\n\n" + content;
1693       }
1694       code = $('<code />').text(json);
1695       pre = $('<pre class="json" />').append(code);
1696     } else if (contentType === "application/xml" || /\+xml$/.test(contentType)) {
1697       code = $('<code />').text(this.formatXml(content));
1698       pre = $('<pre class="xml" />').append(code);
1699     } else if (contentType === "text/html") {
1700       code = $('<code />').html(_.escape(content));
1701       pre = $('<pre class="xml" />').append(code);
1702     } else if (/^image\//.test(contentType)) {
1703       pre = $('<img>').attr('src', url);
1704     } else {
1705       code = $('<code />').text(content);
1706       pre = $('<pre class="json" />').append(code);
1707     }
1708     response_body = pre;
1709     $(".request_url", $(this.el)).html("<pre></pre>");
1710     $(".request_url pre", $(this.el)).text(url);
1711     $(".response_code", $(this.el)).html("<pre>" + response.status + "</pre>");
1712     $(".response_body", $(this.el)).html(response_body);
1713     $(".response_headers", $(this.el)).html("<pre>" + _.escape(JSON.stringify(response.headers, null, "  ")).replace(/\n/g, "<br>") + "</pre>");
1714     $(".response", $(this.el)).slideDown();
1715     $(".response_hider", $(this.el)).show();
1716     $(".response_throbber", $(this.el)).hide();
1717     response_body_el = $('.response_body', $(this.el))[0];
1718     opts = this.options.swaggerOptions;
1719     if (opts.highlightSizeThreshold && response.data.length > opts.highlightSizeThreshold) {
1720       return response_body_el;
1721     } else {
1722       return hljs.highlightBlock(response_body_el);
1723     }
1724   };
1725
1726   OperationView.prototype.toggleOperationContent = function() {
1727     var elem;
1728     elem = $('#' + Docs.escapeResourceName(this.parentId + "_" + this.nickname + "_content"));
1729     if (elem.is(':visible')) {
1730       return Docs.collapseOperation(elem);
1731     } else {
1732       return Docs.expandOperation(elem);
1733     }
1734   };
1735
1736   return OperationView;
1737
1738 })(Backbone.View);
1739
1740 var ParameterContentTypeView,
1741   __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
1742   __hasProp = {}.hasOwnProperty;
1743
1744 ParameterContentTypeView = (function(_super) {
1745   __extends(ParameterContentTypeView, _super);
1746
1747   function ParameterContentTypeView() {
1748     return ParameterContentTypeView.__super__.constructor.apply(this, arguments);
1749   }
1750
1751   ParameterContentTypeView.prototype.initialize = function() {};
1752
1753   ParameterContentTypeView.prototype.render = function() {
1754     var template;
1755     template = this.template();
1756     $(this.el).html(template(this.model));
1757     $('label[for=parameterContentType]', $(this.el)).text('Parameter content type:');
1758     return this;
1759   };
1760
1761   ParameterContentTypeView.prototype.template = function() {
1762     return Handlebars.templates.parameter_content_type;
1763   };
1764
1765   return ParameterContentTypeView;
1766
1767 })(Backbone.View);
1768
1769 this["Handlebars"]["templates"]["param_required"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
1770   var stack1, buffer = "";
1771   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isFile : depth0), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.program(4, data),"data":data});
1772   if (stack1 != null) { buffer += stack1; }
1773   return buffer;
1774 },"2":function(depth0,helpers,partials,data) {
1775   var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1776   return "                      <input type=\"file\" name='"
1777     + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
1778     + "'/>\n";
1779 },"4":function(depth0,helpers,partials,data) {
1780   var stack1, buffer = "";
1781   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(5, data),"inverse":this.program(7, data),"data":data});
1782   if (stack1 != null) { buffer += stack1; }
1783   return buffer;
1784 },"5":function(depth0,helpers,partials,data) {
1785   var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1786   return "                              <textarea class='body-textarea required' placeholder='(required)' name='"
1787     + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
1788     + "'>"
1789     + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
1790     + "</textarea>\n        <br />\n        <div class=\"parameter-content-type\" />\n";
1791 },"7":function(depth0,helpers,partials,data) {
1792   var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1793   return "                              <textarea class='body-textarea required' placeholder='(required)' name='"
1794     + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
1795     + "'></textarea>\n                          <br />\n                                <div class=\"parameter-content-type\" />\n";
1796 },"9":function(depth0,helpers,partials,data) {
1797   var stack1, buffer = "";
1798   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isFile : depth0), {"name":"if","hash":{},"fn":this.program(10, data),"inverse":this.program(12, data),"data":data});
1799   if (stack1 != null) { buffer += stack1; }
1800   return buffer;
1801 },"10":function(depth0,helpers,partials,data) {
1802   var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1803   return "                      <input class='parameter' class='required' type='file' name='"
1804     + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
1805     + "'/>\n";
1806 },"12":function(depth0,helpers,partials,data) {
1807   var stack1, buffer = "";
1808   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(13, data),"inverse":this.program(15, data),"data":data});
1809   if (stack1 != null) { buffer += stack1; }
1810   return buffer;
1811 },"13":function(depth0,helpers,partials,data) {
1812   var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1813   return "                              <input class='parameter required' minlength='1' name='"
1814     + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
1815     + "' placeholder='(required)' type='text' value='"
1816     + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
1817     + "'/>\n";
1818 },"15":function(depth0,helpers,partials,data) {
1819   var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
1820   return "                              <input class='parameter required' minlength='1' name='"
1821     + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
1822     + "' placeholder='(required)' type='text' value=''/>\n";
1823 },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
1824   var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code required'>"
1825     + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
1826     + "</td>\n<td>\n";
1827   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(9, data),"data":data});
1828   if (stack1 != null) { buffer += stack1; }
1829   buffer += "</td>\n<td>\n      <strong><span class=\"markdown\">";
1830   stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
1831   if (stack1 != null) { buffer += stack1; }
1832   buffer += "</span></strong>\n</td>\n<td>";
1833   stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
1834   if (stack1 != null) { buffer += stack1; }
1835   return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
1836 },"useData":true});
1837 this["Handlebars"]["templates"]["parameter_content_type"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
1838   var stack1, buffer = "";
1839   stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.consumes : depth0), {"name":"each","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
1840   if (stack1 != null) { buffer += stack1; }
1841   return buffer;
1842 },"2":function(depth0,helpers,partials,data) {
1843   var stack1, lambda=this.lambda, buffer = "  <option value=\"";
1844   stack1 = lambda(depth0, depth0);
1845   if (stack1 != null) { buffer += stack1; }
1846   buffer += "\">";
1847   stack1 = lambda(depth0, depth0);
1848   if (stack1 != null) { buffer += stack1; }
1849   return buffer + "</option>\n";
1850 },"4":function(depth0,helpers,partials,data) {
1851   return "  <option value=\"application/json\">application/json</option>\n";
1852   },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
1853   var stack1, buffer = "<label for=\"parameterContentType\"></label>\n<select name=\"parameterContentType\">\n";
1854   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.consumes : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(4, data),"data":data});
1855   if (stack1 != null) { buffer += stack1; }
1856   return buffer + "</select>\n";
1857 },"useData":true});
1858 var ParameterView,
1859   __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
1860   __hasProp = {}.hasOwnProperty;
1861
1862 ParameterView = (function(_super) {
1863   __extends(ParameterView, _super);
1864
1865   function ParameterView() {
1866     return ParameterView.__super__.constructor.apply(this, arguments);
1867   }
1868
1869   ParameterView.prototype.initialize = function() {
1870     return Handlebars.registerHelper('isArray', function(param, opts) {
1871       if (param.type.toLowerCase() === 'array' || param.allowMultiple) {
1872         return opts.fn(this);
1873       } else {
1874         return opts.inverse(this);
1875       }
1876     });
1877   };
1878
1879   ParameterView.prototype.render = function() {
1880     var contentTypeModel, isParam, parameterContentTypeView, ref, responseContentTypeView, schema, signatureModel, signatureView, template, type;
1881     type = this.model.type || this.model.dataType;
1882     if (typeof type === 'undefined') {
1883       schema = this.model.schema;
1884       if (schema && schema['$ref']) {
1885         ref = schema['$ref'];
1886         if (ref.indexOf('#/definitions/') === 0) {
1887           type = ref.substring('#/definitions/'.length);
1888         } else {
1889           type = ref;
1890         }
1891       }
1892     }
1893     this.model.type = type;
1894     this.model.paramType = this.model["in"] || this.model.paramType;
1895     if (this.model.paramType === 'body' || this.model["in"] === 'body') {
1896       this.model.isBody = true;
1897     }
1898     if (type && type.toLowerCase() === 'file') {
1899       this.model.isFile = true;
1900     }
1901     this.model["default"] = this.model["default"] || this.model.defaultValue;
1902     if (this.model.allowableValues) {
1903       this.model.isList = true;
1904     }
1905     template = this.template();
1906     $(this.el).html(template(this.model));
1907     signatureModel = {
1908       sampleJSON: this.model.sampleJSON,
1909       isParam: true,
1910       signature: this.model.signature
1911     };
1912     if (this.model.sampleJSON) {
1913       signatureView = new SignatureView({
1914         model: signatureModel,
1915         tagName: 'div'
1916       });
1917       $('.model-signature', $(this.el)).append(signatureView.render().el);
1918     } else {
1919       $('.model-signature', $(this.el)).html(this.model.signature);
1920     }
1921     isParam = false;
1922     if (this.model.isBody) {
1923       isParam = true;
1924     }
1925     contentTypeModel = {
1926       isParam: isParam
1927     };
1928     contentTypeModel.consumes = this.model.consumes;
1929     if (isParam) {
1930       parameterContentTypeView = new ParameterContentTypeView({
1931         model: contentTypeModel
1932       });
1933       $('.parameter-content-type', $(this.el)).append(parameterContentTypeView.render().el);
1934     } else {
1935       responseContentTypeView = new ResponseContentTypeView({
1936         model: contentTypeModel
1937       });
1938       $('.response-content-type', $(this.el)).append(responseContentTypeView.render().el);
1939     }
1940     return this;
1941   };
1942
1943   ParameterView.prototype.template = function() {
1944     if (this.model.isList) {
1945       return Handlebars.templates.param_list;
1946     } else {
1947       if (this.options.readOnly) {
1948         if (this.model.required) {
1949           return Handlebars.templates.param_readonly_required;
1950         } else {
1951           return Handlebars.templates.param_readonly;
1952         }
1953       } else {
1954         if (this.model.required) {
1955           return Handlebars.templates.param_required;
1956         } else {
1957           return Handlebars.templates.param;
1958         }
1959       }
1960     }
1961   };
1962
1963   return ParameterView;
1964
1965 })(Backbone.View);
1966
1967 var ResourceView,
1968   __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
1969   __hasProp = {}.hasOwnProperty;
1970
1971 ResourceView = (function(_super) {
1972   __extends(ResourceView, _super);
1973
1974   function ResourceView() {
1975     return ResourceView.__super__.constructor.apply(this, arguments);
1976   }
1977
1978   ResourceView.prototype.initialize = function(opts) {
1979     if (opts == null) {
1980       opts = {};
1981     }
1982     this.auths = opts.auths;
1983     if ("" === this.model.description) {
1984       this.model.description = null;
1985     }
1986     if (this.model.description != null) {
1987       return this.model.summary = this.model.description;
1988     }
1989   };
1990
1991   ResourceView.prototype.render = function() {
1992     var counter, id, methods, operation, _i, _len, _ref;
1993     methods = {};
1994     $(this.el).html(Handlebars.templates.resource(this.model));
1995     _ref = this.model.operationsArray;
1996     for (_i = 0, _len = _ref.length; _i < _len; _i++) {
1997       operation = _ref[_i];
1998       counter = 0;
1999       id = operation.nickname;
2000       while (typeof methods[id] !== 'undefined') {
2001         id = id + "_" + counter;
2002         counter += 1;
2003       }
2004       methods[id] = operation;
2005       operation.nickname = id;
2006       operation.parentId = this.model.id;
2007       this.addOperation(operation);
2008     }
2009     $('.toggleEndpointList', this.el).click(this.callDocs.bind(this, 'toggleEndpointListForResource'));
2010     $('.collapseResource', this.el).click(this.callDocs.bind(this, 'collapseOperationsForResource'));
2011     $('.expandResource', this.el).click(this.callDocs.bind(this, 'expandOperationsForResource'));
2012     return this;
2013   };
2014
2015   ResourceView.prototype.addOperation = function(operation) {
2016     var operationView;
2017     operation.number = this.number;
2018     operationView = new OperationView({
2019       model: operation,
2020       tagName: 'li',
2021       className: 'endpoint',
2022       swaggerOptions: this.options.swaggerOptions,
2023       auths: this.auths
2024     });
2025     $('.endpoints', $(this.el)).append(operationView.render().el);
2026     return this.number++;
2027   };
2028
2029   ResourceView.prototype.callDocs = function(fnName, e) {
2030     e.preventDefault();
2031     return Docs[fnName](e.currentTarget.getAttribute('data-id'));
2032   };
2033
2034   return ResourceView;
2035
2036 })(Backbone.View);
2037
2038 this["Handlebars"]["templates"]["resource"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
2039   return " : ";
2040   },"3":function(depth0,helpers,partials,data) {
2041   var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
2042   return "<li>\n      <a href='"
2043     + escapeExpression(((helper = (helper = helpers.url || (depth0 != null ? depth0.url : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"url","hash":{},"data":data}) : helper)))
2044     + "'>Raw</a>\n    </li>";
2045 },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
2046   var stack1, helper, options, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, blockHelperMissing=helpers.blockHelperMissing, buffer = "<div class='heading'>\n  <h2>\n    <a href='#!/"
2047     + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
2048     + "' class=\"toggleEndpointList\" data-id=\""
2049     + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
2050     + "\">"
2051     + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
2052     + "</a> ";
2053   stack1 = ((helper = (helper = helpers.summary || (depth0 != null ? depth0.summary : depth0)) != null ? helper : helperMissing),(options={"name":"summary","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data}),(typeof helper === functionType ? helper.call(depth0, options) : helper));
2054   if (!helpers.summary) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
2055   if (stack1 != null) { buffer += stack1; }
2056   stack1 = ((helper = (helper = helpers.summary || (depth0 != null ? depth0.summary : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"summary","hash":{},"data":data}) : helper));
2057   if (stack1 != null) { buffer += stack1; }
2058   buffer += "\n  </h2>\n  <ul class='options'>\n    <li>\n      <a href='#!/"
2059     + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
2060     + "' id='endpointListTogger_"
2061     + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
2062     + "' class=\"toggleEndpointList\" data-id=\""
2063     + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
2064     + "\">Show/Hide</a>\n    </li>\n    <li>\n      <a href='#' class=\"collapseResource\" data-id=\""
2065     + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
2066     + "\">\n        List Operations\n      </a>\n    </li>\n    <li>\n      <a href='#' class=\"expandResource\" data-id=\""
2067     + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
2068     + "\">\n        Expand Operations\n      </a>\n    </li>\n    ";
2069   stack1 = ((helper = (helper = helpers.url || (depth0 != null ? depth0.url : depth0)) != null ? helper : helperMissing),(options={"name":"url","hash":{},"fn":this.program(3, data),"inverse":this.noop,"data":data}),(typeof helper === functionType ? helper.call(depth0, options) : helper));
2070   if (!helpers.url) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
2071   if (stack1 != null) { buffer += stack1; }
2072   return buffer + "\n  </ul>\n</div>\n<ul class='endpoints' id='"
2073     + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
2074     + "_endpoint_list' style='display:none'>\n\n</ul>\n";
2075 },"useData":true});
2076 var ResponseContentTypeView,
2077   __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
2078   __hasProp = {}.hasOwnProperty;
2079
2080 ResponseContentTypeView = (function(_super) {
2081   __extends(ResponseContentTypeView, _super);
2082
2083   function ResponseContentTypeView() {
2084     return ResponseContentTypeView.__super__.constructor.apply(this, arguments);
2085   }
2086
2087   ResponseContentTypeView.prototype.initialize = function() {};
2088
2089   ResponseContentTypeView.prototype.render = function() {
2090     var template;
2091     template = this.template();
2092     $(this.el).html(template(this.model));
2093     $('label[for=responseContentType]', $(this.el)).text('Response Content Type');
2094     return this;
2095   };
2096
2097   ResponseContentTypeView.prototype.template = function() {
2098     return Handlebars.templates.response_content_type;
2099   };
2100
2101   return ResponseContentTypeView;
2102
2103 })(Backbone.View);
2104
2105 this["Handlebars"]["templates"]["response_content_type"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
2106   var stack1, buffer = "";
2107   stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"each","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
2108   if (stack1 != null) { buffer += stack1; }
2109   return buffer;
2110 },"2":function(depth0,helpers,partials,data) {
2111   var stack1, lambda=this.lambda, buffer = "  <option value=\"";
2112   stack1 = lambda(depth0, depth0);
2113   if (stack1 != null) { buffer += stack1; }
2114   buffer += "\">";
2115   stack1 = lambda(depth0, depth0);
2116   if (stack1 != null) { buffer += stack1; }
2117   return buffer + "</option>\n";
2118 },"4":function(depth0,helpers,partials,data) {
2119   return "  <option value=\"application/json\">application/json</option>\n";
2120   },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
2121   var stack1, buffer = "<label for=\"responseContentType\"></label>\n<select name=\"responseContentType\">\n";
2122   stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(4, data),"data":data});
2123   if (stack1 != null) { buffer += stack1; }
2124   return buffer + "</select>\n";
2125 },"useData":true});
2126 var SignatureView,
2127   __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
2128   __hasProp = {}.hasOwnProperty;
2129
2130 SignatureView = (function(_super) {
2131   __extends(SignatureView, _super);
2132
2133   function SignatureView() {
2134     return SignatureView.__super__.constructor.apply(this, arguments);
2135   }
2136
2137   SignatureView.prototype.events = {
2138     'click a.description-link': 'switchToDescription',
2139     'click a.snippet-link': 'switchToSnippet',
2140     'mousedown .snippet': 'snippetToTextArea'
2141   };
2142
2143   SignatureView.prototype.initialize = function() {};
2144
2145   SignatureView.prototype.render = function() {
2146     var template;
2147     template = this.template();
2148     $(this.el).html(template(this.model));
2149     this.switchToSnippet();
2150     this.isParam = this.model.isParam;
2151     if (this.isParam) {
2152       $('.notice', $(this.el)).text('Click to set as parameter value');
2153     }
2154     return this;
2155   };
2156
2157   SignatureView.prototype.template = function() {
2158     return Handlebars.templates.signature;
2159   };
2160
2161   SignatureView.prototype.switchToDescription = function(e) {
2162     if (e != null) {
2163       e.preventDefault();
2164     }
2165     $(".snippet", $(this.el)).hide();
2166     $(".description", $(this.el)).show();
2167     $('.description-link', $(this.el)).addClass('selected');
2168     return $('.snippet-link', $(this.el)).removeClass('selected');
2169   };
2170
2171   SignatureView.prototype.switchToSnippet = function(e) {
2172     if (e != null) {
2173       e.preventDefault();
2174     }
2175     $(".description", $(this.el)).hide();
2176     $(".snippet", $(this.el)).show();
2177     $('.snippet-link', $(this.el)).addClass('selected');
2178     return $('.description-link', $(this.el)).removeClass('selected');
2179   };
2180
2181   SignatureView.prototype.snippetToTextArea = function(e) {
2182     var textArea;
2183     if (this.isParam) {
2184       if (e != null) {
2185         e.preventDefault();
2186       }
2187       textArea = $('textarea', $(this.el.parentNode.parentNode.parentNode));
2188       if ($.trim(textArea.val()) === '') {
2189         return textArea.val(this.model.sampleJSON);
2190       }
2191     }
2192   };
2193
2194   return SignatureView;
2195
2196 })(Backbone.View);
2197
2198 this["Handlebars"]["templates"]["signature"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
2199   var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<div>\n<ul class=\"signature-nav\">\n  <li><a class=\"description-link\" href=\"#\">Model</a></li>\n  <li><a class=\"snippet-link\" href=\"#\">Model Schema</a></li>\n</ul>\n<div>\n\n<div class=\"signature-container\">\n  <div class=\"description\">\n    ";
2200   stack1 = ((helper = (helper = helpers.signature || (depth0 != null ? depth0.signature : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"signature","hash":{},"data":data}) : helper));
2201   if (stack1 != null) { buffer += stack1; }
2202   return buffer + "\n  </div>\n\n  <div class=\"snippet\">\n    <pre><code>"
2203     + escapeExpression(((helper = (helper = helpers.sampleJSON || (depth0 != null ? depth0.sampleJSON : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"sampleJSON","hash":{},"data":data}) : helper)))
2204     + "</code></pre>\n    <small class=\"notice\"></small>\n  </div>\n</div>\n\n";
2205 },"useData":true});
2206 var StatusCodeView,
2207   __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
2208   __hasProp = {}.hasOwnProperty;
2209
2210 StatusCodeView = (function(_super) {
2211   __extends(StatusCodeView, _super);
2212
2213   function StatusCodeView() {
2214     return StatusCodeView.__super__.constructor.apply(this, arguments);
2215   }
2216
2217   StatusCodeView.prototype.initialize = function() {};
2218
2219   StatusCodeView.prototype.render = function() {
2220     var responseModel, responseModelView, template;
2221     template = this.template();
2222     $(this.el).html(template(this.model));
2223     if (swaggerUi.api.models.hasOwnProperty(this.model.responseModel)) {
2224       responseModel = {
2225         sampleJSON: JSON.stringify(swaggerUi.api.models[this.model.responseModel].createJSONSample(), null, 2),
2226         isParam: false,
2227         signature: swaggerUi.api.models[this.model.responseModel].getMockSignature()
2228       };
2229       responseModelView = new SignatureView({
2230         model: responseModel,
2231         tagName: 'div'
2232       });
2233       $('.model-signature', this.$el).append(responseModelView.render().el);
2234     } else {
2235       $('.model-signature', this.$el).html('');
2236     }
2237     return this;
2238   };
2239
2240   StatusCodeView.prototype.template = function() {
2241     return Handlebars.templates.status_code;
2242   };
2243
2244   return StatusCodeView;
2245
2246 })(Backbone.View);
2247
2248 this["Handlebars"]["templates"]["status_code"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
2249   var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td width='15%' class='code'>"
2250     + escapeExpression(((helper = (helper = helpers.code || (depth0 != null ? depth0.code : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"code","hash":{},"data":data}) : helper)))
2251     + "</td>\n<td>";
2252   stack1 = ((helper = (helper = helpers.message || (depth0 != null ? depth0.message : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"message","hash":{},"data":data}) : helper));
2253   if (stack1 != null) { buffer += stack1; }
2254   return buffer + "</td>\n<td width='50%'><span class=\"model-signature\" /></td>";
2255 },"useData":true});