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