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