"use strict";function clippyCopiedCallback(){$("#api_key_copied").fadeIn().delay(1e3).fadeOut()}var SwaggerUi=Backbone.Router.extend({dom_id:"swagger_ui",options:null,api:null,headerView:null,mainView:null,initialize:function(e){e=e||{},e.dom_id&&(this.dom_id=e.dom_id,delete e.dom_id),e.supportedSubmitMethods||(e.supportedSubmitMethods=["get","put","post","delete","head","options","patch"]),$("#"+this.dom_id)||$("body").append('
'),this.options=e,marked.setOptions({gfm:!0}),this.options.success=function(){return this.render()},this.options.progress=function(e){return this.showMessage(e)},this.options.failure=function(e){return this.onLoadFailure(e)},this.headerView=new HeaderView({el:$("#header")}),this.headerView.on("update-swagger-ui",function(e){return this.updateSwaggerUi(e)})},setOption:function(e,n){this.options[e]=n},getOption:function(e){return this.options[e]},updateSwaggerUi:function(e){this.options.url=e.url,this.load()},load:function(){this.mainView&&this.mainView.clear();var e=this.options.url;e&&0!==e.indexOf("http")&&(e=this.buildUrl(window.location.href.toString(),e)),this.options.url=e,this.headerView.update(e),this.api=new SwaggerClient(this.options)},collapseAll:function(){Docs.collapseEndpointListForResource("")},listAll:function(){Docs.collapseOperationsForResource("")},expandAll:function(){Docs.expandOperationsForResource("")},render:function(){switch(this.showMessage("Finished Loading Resource Information. Rendering Swagger UI..."),this.mainView=new MainView({model:this.api,el:$("#"+this.dom_id),swaggerOptions:this.options}).render(),this.showMessage(),this.options.docExpansion){case"full":this.expandAll();break;case"list":this.listAll()}this.renderGFM(),this.options.onComplete&&this.options.onComplete(this.api,this),setTimeout(Docs.shebang.bind(this),100)},buildUrl:function(e,n){if(0===n.indexOf("/")){var a=e.split("/");return e=a[0]+"//"+a[2],e+n}var t=e.length;return e.indexOf("?")>-1&&(t=Math.min(t,e.indexOf("?"))),e.indexOf("#")>-1&&(t=Math.min(t,e.indexOf("#"))),e=e.substring(0,t),-1!==e.indexOf("/",e.length-1)?e+n:e+"/"+n},showMessage:function(e){void 0===e&&(e=""),$("#message-bar").removeClass("message-fail"),$("#message-bar").addClass("message-success"),$("#message-bar").html(e)},onLoadFailure:function(e){void 0===e&&(e=""),$("#message-bar").removeClass("message-success"),$("#message-bar").addClass("message-fail");var n=$("#message-bar").html(e);return this.options.onFailure&&this.options.onFailure(e),n},renderGFM:function(){$(".markdown").each(function(){$(this).html(marked($(this).html()))})}});window.SwaggerUi=SwaggerUi,this.Handlebars=this.Handlebars||{},this.Handlebars.templates=this.Handlebars.templates||{},this.Handlebars.templates.apikey_button_view=Handlebars.template({compiler:[6,">= 2.0.0-beta.1"],main:function(e,n,a,t){var s,i="function",l=n.helperMissing,r=this.escapeExpression;return"\n
\n
\n
"+r((s=null!=(s=n.keyName||(null!=e?e.keyName:e))?s:l,typeof s===i?s.call(e,{name:"keyName",hash:{},data:t}):s))+'
\n \n \n
\n
\n\n'},useData:!0}),this.Handlebars.templates.basic_auth_button_view=Handlebars.template({compiler:[6,">= 2.0.0-beta.1"],main:function(){return'
\n
\n
\n
Username
\n \n
Password
\n \n \n
\n
\n\n'},useData:!0}),this.Handlebars.templates.content_type=Handlebars.template({1:function(e,n,a,t){var s,i="";return s=n.each.call(e,null!=e?e.produces:e,{name:"each",hash:{},fn:this.program(2,t),inverse:this.noop,data:t}),null!=s&&(i+=s),i},2:function(e){var n,a=this.lambda,t=' \n"},4:function(){return' \n'},compiler:[6,">= 2.0.0-beta.1"],main:function(e,n,a,t){var s,i='\n\n"},useData:!0}),$(function(){$.fn.vAlign=function(){return this.each(function(){var e=$(this).height(),n=$(this).parent().height(),a=(n-e)/2;$(this).css("margin-top",a)})},$.fn.stretchFormtasticInputWidthToParent=function(){return this.each(function(){var e=$(this).closest("form").innerWidth(),n=parseInt($(this).closest("form").css("padding-left"),10)+parseInt($(this).closest("form").css("padding-right"),10),a=parseInt($(this).css("padding-left"),10)+parseInt($(this).css("padding-right"),10);$(this).css("width",e-n-a)})},$("form.formtastic li.string input, form.formtastic textarea").stretchFormtasticInputWidthToParent(),$("ul.downplayed li div.content p").vAlign(),$("form.sandbox").submit(function(){var e=!0;return $(this).find("input.required").each(function(){$(this).removeClass("error"),""==$(this).val()&&($(this).addClass("error"),$(this).wiggle(),e=!1)}),e})}),log=function(){log.history=log.history||[],log.history.push(arguments),this.console&&console.log(Array.prototype.slice.call(arguments)[0])},Function.prototype.bind&&console&&"object"==typeof console.log&&["log","info","warn","error","assert","dir","clear","profile","profileEnd"].forEach(function(e){console[e]=this.bind(console[e],console)},Function.prototype.call);var Docs={shebang:function(){var e=$.param.fragment().split("/");switch(e.shift(),e.length){case 1:var n="resource_"+e[0];Docs.expandEndpointListForResource(e[0]),$("#"+n).slideto({highlight:!1});break;case 2:Docs.expandEndpointListForResource(e[0]),$("#"+n).slideto({highlight:!1});var a=e.join("_"),t=a+"_content";Docs.expandOperation($("#"+t)),$("#"+a).slideto({highlight:!1})}},toggleEndpointListForResource:function(e){var n=$("li#resource_"+Docs.escapeResourceName(e)+" ul.endpoints");n.is(":visible")?Docs.collapseEndpointListForResource(e):Docs.expandEndpointListForResource(e)},expandEndpointListForResource:function(e){var e=Docs.escapeResourceName(e);if(""==e)return void $(".resource ul.endpoints").slideDown();$("li#resource_"+e).addClass("active");var n=$("li#resource_"+e+" ul.endpoints");n.slideDown()},collapseEndpointListForResource:function(e){var e=Docs.escapeResourceName(e);if(""==e)return void $(".resource ul.endpoints").slideUp();$("li#resource_"+e).removeClass("active");var n=$("li#resource_"+e+" ul.endpoints");n.slideUp()},expandOperationsForResource:function(e){return Docs.expandEndpointListForResource(e),""==e?void $(".resource ul.endpoints li.operation div.content").slideDown():void $("li#resource_"+Docs.escapeResourceName(e)+" li.operation div.content").each(function(){Docs.expandOperation($(this))})},collapseOperationsForResource:function(e){return Docs.expandEndpointListForResource(e),""==e?void $(".resource ul.endpoints li.operation div.content").slideUp():void $("li#resource_"+Docs.escapeResourceName(e)+" li.operation div.content").each(function(){Docs.collapseOperation($(this))})},escapeResourceName:function(e){return e.replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]\^`{|}~]/g,"\\$&")},expandOperation:function(e){e.slideDown()},collapseOperation:function(e){e.slideUp()}};Handlebars.registerHelper("sanitize",function(e){return e=e.replace(/)<[^<]*)*<\/script>/gi,""),new Handlebars.SafeString(e)}),this.Handlebars.templates.main=Handlebars.template({1:function(e,n,a,t){var s,i=this.lambda,l=this.escapeExpression,r='
'+l(i(null!=(s=null!=e?e.info:e)?s.title:s,e))+'
\n
';return s=i(null!=(s=null!=e?e.info:e)?s.description:s,e),null!=s&&(r+=s),r+="
\n",s=n["if"].call(e,null!=e?e.externalDocs:e,{name:"if",hash:{},fn:this.program(2,t),inverse:this.noop,data:t}),null!=s&&(r+=s),r+=" ",s=n["if"].call(e,null!=(s=null!=e?e.info:e)?s.termsOfServiceUrl:s,{name:"if",hash:{},fn:this.program(4,t),inverse:this.noop,data:t}),null!=s&&(r+=s),r+="\n ",s=n["if"].call(e,null!=(s=null!=(s=null!=e?e.info:e)?s.contact:s)?s.name:s,{name:"if",hash:{},fn:this.program(6,t),inverse:this.noop,data:t}),null!=s&&(r+=s),r+="\n ",s=n["if"].call(e,null!=(s=null!=(s=null!=e?e.info:e)?s.contact:s)?s.url:s,{name:"if",hash:{},fn:this.program(8,t),inverse:this.noop,data:t}),null!=s&&(r+=s),r+="\n ",s=n["if"].call(e,null!=(s=null!=(s=null!=e?e.info:e)?s.contact:s)?s.email:s,{name:"if",hash:{},fn:this.program(10,t),inverse:this.noop,data:t}),null!=s&&(r+=s),r+="\n ",s=n["if"].call(e,null!=(s=null!=e?e.info:e)?s.license:s,{name:"if",hash:{},fn:this.program(12,t),inverse:this.noop,data:t}),null!=s&&(r+=s),r+"\n"},2:function(e){var n,a=this.lambda,t=this.escapeExpression;return"
More documentations
\n

"+t(a(null!=(n=null!=e?e.externalDocs:e)?n.description:n,e))+'

\n '+t(a(null!=(n=null!=e?e.externalDocs:e)?n.url:n,e))+"\n"},4:function(e){var n,a=this.lambda,t=this.escapeExpression;return'
Terms of service
'},6:function(e){var n,a=this.lambda,t=this.escapeExpression;return"
Created by "+t(a(null!=(n=null!=(n=null!=e?e.info:e)?n.contact:n)?n.name:n,e))+"
"},8:function(e){var n,a=this.lambda,t=this.escapeExpression;return"
See more at '+t(a(null!=(n=null!=(n=null!=e?e.info:e)?n.contact:n)?n.url:n,e))+"
"},10:function(e){var n,a=this.lambda,t=this.escapeExpression;return"
Contact the developer
'},12:function(e){var n,a=this.lambda,t=this.escapeExpression;return"
"+t(a(null!=(n=null!=(n=null!=e?e.info:e)?n.license:n)?n.name:n,e))+"
"},14:function(e){var n,a=this.lambda,t=this.escapeExpression;return' , api version: '+t(a(null!=(n=null!=e?e.info:e)?n.version:n,e))+"\n "},16:function(e,n,a,t){var s,i="function",l=n.helperMissing,r=this.escapeExpression;return' \n \n'},compiler:[6,">= 2.0.0-beta.1"],main:function(e,n,a,t){var s,i,l="function",r=n.helperMissing,o=this.escapeExpression,u="
\n";return s=n["if"].call(e,null!=e?e.info:e,{name:"if",hash:{},fn:this.program(1,t),inverse:this.noop,data:t}),null!=s&&(u+=s),u+="
\n
\n \n\n
\n
\n
\n

[ base url: "+o((i=null!=(i=n.basePath||(null!=e?e.basePath:e))?i:r,typeof i===l?i.call(e,{name:"basePath",hash:{},data:t}):i))+"\n",s=n["if"].call(e,null!=(s=null!=e?e.info:e)?s.version:s,{name:"if",hash:{},fn:this.program(14,t),inverse:this.noop,data:t}),null!=s&&(u+=s),u+="]\n",s=n["if"].call(e,null!=e?e.validatorUrl:e,{name:"if",hash:{},fn:this.program(16,t),inverse:this.noop,data:t}),null!=s&&(u+=s),u+"

\n
\n
\n"},useData:!0}),this.Handlebars.templates.operation=Handlebars.template({1:function(){return"deprecated"},3:function(){return"

Warning: Deprecated

\n"},5:function(e,n,a,t){var s,i,l="function",r=n.helperMissing,o='

Implementation Notes

\n

';return i=null!=(i=n.description||(null!=e?e.description:e))?i:r,s=typeof i===l?i.call(e,{name:"description",hash:{},data:t}):i,null!=s&&(o+=s),o+"

\n"},7:function(){return'
\n '},9:function(e,n,a,t){var s,i=' \n"},10:function(e){var n,a=this.lambda,t=this.escapeExpression,s="
"+t(a(null!=e?e.scope:e,e))+"
\n"},12:function(){return"
"},14:function(){return'
\n \n
\n'},16:function(e,n,a,t){var s,i="function",l=n.helperMissing,r=this.escapeExpression;return"

Response Class (Status "+r((s=null!=(s=n.successCode||(null!=e?e.successCode:e))?s:l,typeof s===i?s.call(e,{name:"successCode",hash:{},data:t}):s))+')

\n

\n
\n
\n'},18:function(){return'

Parameters

\n \n \n \n \n \n \n \n \n \n \n \n\n \n
ParameterValueDescriptionParameter TypeData Type
\n'},20:function(){return"
\n

Response Messages

\n \n \n \n \n \n \n \n \n \n \n\n \n
HTTP Status CodeReasonResponse ModelHeaders
\n"},22:function(){return""},24:function(){return"
\n \n \n \n
\n"},compiler:[6,">= 2.0.0-beta.1"],main:function(e,n,a,t){var s,i,l,r="function",o=n.helperMissing,u=this.escapeExpression,p=n.blockHelperMissing,d="\n \n"},useData:!0}),this.Handlebars.templates.param=Handlebars.template({1:function(e,n,a,t){var s,i="";return s=n["if"].call(e,null!=e?e.isFile:e,{name:"if",hash:{},fn:this.program(2,t),inverse:this.program(4,t),data:t}),null!=s&&(i+=s),i},2:function(e,n,a,t){var s,i="function",l=n.helperMissing,r=this.escapeExpression;return' \n
\n'},4:function(e,n,a,t){var s,i="";return s=n["if"].call(e,null!=e?e["default"]:e,{name:"if",hash:{},fn:this.program(5,t),inverse:this.program(7,t),data:t}),null!=s&&(i+=s),i},5:function(e,n,a,t){var s,i="function",l=n.helperMissing,r=this.escapeExpression;return" \n
\n
\n'},7:function(e,n,a,t){var s,i="function",l=n.helperMissing,r=this.escapeExpression;return" \n
\n
\n'},9:function(e,n,a,t){var s,i="";return s=n["if"].call(e,null!=e?e.isFile:e,{name:"if",hash:{},fn:this.program(2,t),inverse:this.program(10,t),data:t}),null!=s&&(i+=s),i},10:function(e,n,a,t){var s,i="";return s=n["if"].call(e,null!=e?e["default"]:e,{name:"if",hash:{},fn:this.program(11,t),inverse:this.program(13,t),data:t}),null!=s&&(i+=s),i},11:function(e,n,a,t){var s,i="function",l=n.helperMissing,r=this.escapeExpression;return" \n"},13:function(e,n,a,t){var s,i="function",l=n.helperMissing,r=this.escapeExpression;return" \n"},compiler:[6,">= 2.0.0-beta.1"],main:function(e,n,a,t){var s,i,l="function",r=n.helperMissing,o=this.escapeExpression,u=""+o((i=null!=(i=n.name||(null!=e?e.name:e))?i:r,typeof i===l?i.call(e,{name:"name",hash:{},data:t}):i))+"\n\n\n";return s=n["if"].call(e,null!=e?e.isBody:e,{name:"if",hash:{},fn:this.program(1,t),inverse:this.program(9,t),data:t}),null!=s&&(u+=s),u+='\n\n',i=null!=(i=n.description||(null!=e?e.description:e))?i:r,s=typeof i===l?i.call(e,{name:"description",hash:{},data:t}):i,null!=s&&(u+=s),u+="\n",i=null!=(i=n.paramType||(null!=e?e.paramType:e))?i:r,s=typeof i===l?i.call(e,{name:"paramType",hash:{},data:t}):i,null!=s&&(u+=s),u+'\n\n \n\n'},useData:!0}),this.Handlebars.templates.param_list=Handlebars.template({1:function(e,n,a,t){var s,i="function",l=n.helperMissing,r=this.escapeExpression;return""+r((s=null!=(s=n.name||(null!=e?e.name:e))?s:l,typeof s===i?s.call(e,{name:"name",hash:{},data:t}):s))+"\n"},3:function(){return" multiple='multiple'"},5:function(){return""},7:function(e,n,a,t){var s,i="";return s=n["if"].call(e,null!=e?e["default"]:e,{name:"if",hash:{},fn:this.program(5,t),inverse:this.program(8,t),data:t}),null!=s&&(i+=s),i},8:function(e,n,a,t){var s,i=n.helperMissing,l="";return s=(n.isArray||e&&e.isArray||i).call(e,e,{name:"isArray",hash:{},fn:this.program(5,t),inverse:this.program(9,t),data:t}),null!=s&&(l+=s),l},9:function(){return" \n"},11:function(e,n,a,t){var s,i="";return s=n["if"].call(e,null!=e?e.isDefault:e,{name:"if",hash:{},fn:this.program(12,t),inverse:this.program(14,t),data:t}),null!=s&&(i+=s),i},12:function(e,n,a,t){var s,i="function",l=n.helperMissing,r=this.escapeExpression;return' \n"},14:function(e,n,a,t){var s,i="function",l=n.helperMissing,r=this.escapeExpression;return" \n"},compiler:[6,">= 2.0.0-beta.1"],main:function(e,n,a,t){var s,i,l="function",r=n.helperMissing,o=this.escapeExpression,u="";return s=n["if"].call(e,null!=e?e.required:e,{name:"if",hash:{},fn:this.program(1,t),inverse:this.noop,data:t}),null!=s&&(u+=s),u+=""+o((i=null!=(i=n.name||(null!=e?e.name:e))?i:r,typeof i===l?i.call(e,{name:"name",hash:{},data:t}):i))+"\n\n \n\n',i=null!=(i=n.description||(null!=e?e.description:e))?i:r,s=typeof i===l?i.call(e,{name:"description",hash:{},data:t}):i,null!=s&&(u+=s),u+="\n",i=null!=(i=n.paramType||(null!=e?e.paramType:e))?i:r,s=typeof i===l?i.call(e,{name:"paramType",hash:{},data:t}):i,null!=s&&(u+=s),u+'\n'},useData:!0}),this.Handlebars.templates.param_readonly=Handlebars.template({1:function(e,n,a,t){var s,i="function",l=n.helperMissing,r=this.escapeExpression;return" \n"},3:function(e,n,a,t){var s,i="";return s=n["if"].call(e,null!=e?e["default"]:e,{name:"if",hash:{},fn:this.program(4,t),inverse:this.program(6,t),data:t}),null!=s&&(i+=s),i},4:function(e,n,a,t){var s,i="function",l=n.helperMissing,r=this.escapeExpression;return" "+r((s=null!=(s=n["default"]||(null!=e?e["default"]:e))?s:l,typeof s===i?s.call(e,{name:"default",hash:{},data:t}):s))+"\n"},6:function(){return" (empty)\n"},compiler:[6,">= 2.0.0-beta.1"],main:function(e,n,a,t){var s,i,l="function",r=n.helperMissing,o=this.escapeExpression,u=""+o((i=null!=(i=n.name||(null!=e?e.name:e))?i:r,typeof i===l?i.call(e,{name:"name",hash:{},data:t}):i))+"\n\n";return s=n["if"].call(e,null!=e?e.isBody:e,{name:"if",hash:{},fn:this.program(1,t),inverse:this.program(3,t),data:t}),null!=s&&(u+=s),u+='\n',i=null!=(i=n.description||(null!=e?e.description:e))?i:r,s=typeof i===l?i.call(e,{name:"description",hash:{},data:t}):i,null!=s&&(u+=s),u+="\n",i=null!=(i=n.paramType||(null!=e?e.paramType:e))?i:r,s=typeof i===l?i.call(e,{name:"paramType",hash:{},data:t}):i,null!=s&&(u+=s),u+'\n\n'},useData:!0}),this.Handlebars.templates.param_readonly_required=Handlebars.template({1:function(e,n,a,t){var s,i="function",l=n.helperMissing,r=this.escapeExpression;return" \n"},3:function(e,n,a,t){var s,i="";return s=n["if"].call(e,null!=e?e["default"]:e,{name:"if",hash:{},fn:this.program(4,t),inverse:this.program(6,t),data:t}),null!=s&&(i+=s),i},4:function(e,n,a,t){var s,i="function",l=n.helperMissing,r=this.escapeExpression;return" "+r((s=null!=(s=n["default"]||(null!=e?e["default"]:e))?s:l,typeof s===i?s.call(e,{name:"default",hash:{},data:t}):s))+"\n"},6:function(){return" (empty)\n"},compiler:[6,">= 2.0.0-beta.1"],main:function(e,n,a,t){var s,i,l="function",r=n.helperMissing,o=this.escapeExpression,u=""+o((i=null!=(i=n.name||(null!=e?e.name:e))?i:r,typeof i===l?i.call(e,{name:"name",hash:{},data:t}):i))+"\n\n";return s=n["if"].call(e,null!=e?e.isBody:e,{name:"if",hash:{},fn:this.program(1,t),inverse:this.program(3,t),data:t}),null!=s&&(u+=s),u+='\n',i=null!=(i=n.description||(null!=e?e.description:e))?i:r,s=typeof i===l?i.call(e,{name:"description",hash:{},data:t}):i,null!=s&&(u+=s),u+="\n",i=null!=(i=n.paramType||(null!=e?e.paramType:e))?i:r,s=typeof i===l?i.call(e,{name:"paramType",hash:{},data:t}):i,null!=s&&(u+=s),u+'\n\n'},useData:!0}),this.Handlebars.templates.param_required=Handlebars.template({1:function(e,n,a,t){var s,i="";return s=n["if"].call(e,null!=e?e.isFile:e,{name:"if",hash:{},fn:this.program(2,t),inverse:this.program(4,t),data:t}),null!=s&&(i+=s),i},2:function(e,n,a,t){var s,i="function",l=n.helperMissing,r=this.escapeExpression;return' \n"},4:function(e,n,a,t){var s,i="";return s=n["if"].call(e,null!=e?e["default"]:e,{name:"if",hash:{},fn:this.program(5,t),inverse:this.program(7,t),data:t}),null!=s&&(i+=s),i},5:function(e,n,a,t){var s,i="function",l=n.helperMissing,r=this.escapeExpression;return" \n
\n
\n'},7:function(e,n,a,t){var s,i="function",l=n.helperMissing,r=this.escapeExpression;return" \n
\n
\n'},9:function(e,n,a,t){var s,i="";return s=n["if"].call(e,null!=e?e.isFile:e,{name:"if",hash:{},fn:this.program(10,t),inverse:this.program(12,t),data:t}),null!=s&&(i+=s),i},10:function(e,n,a,t){var s,i="function",l=n.helperMissing,r=this.escapeExpression;return" \n"},12:function(e,n,a,t){var s,i="";return s=n["if"].call(e,null!=e?e["default"]:e,{name:"if",hash:{},fn:this.program(13,t),inverse:this.program(15,t),data:t}),null!=s&&(i+=s),i },13:function(e,n,a,t){var s,i="function",l=n.helperMissing,r=this.escapeExpression;return" \n"},15:function(e,n,a,t){var s,i="function",l=n.helperMissing,r=this.escapeExpression;return" \n"},compiler:[6,">= 2.0.0-beta.1"],main:function(e,n,a,t){var s,i,l="function",r=n.helperMissing,o=this.escapeExpression,u=""+o((i=null!=(i=n.name||(null!=e?e.name:e))?i:r,typeof i===l?i.call(e,{name:"name",hash:{},data:t}):i))+"\n\n";return s=n["if"].call(e,null!=e?e.isBody:e,{name:"if",hash:{},fn:this.program(1,t),inverse:this.program(9,t),data:t}),null!=s&&(u+=s),u+='\n\n ',i=null!=(i=n.description||(null!=e?e.description:e))?i:r,s=typeof i===l?i.call(e,{name:"description",hash:{},data:t}):i,null!=s&&(u+=s),u+="\n\n",i=null!=(i=n.paramType||(null!=e?e.paramType:e))?i:r,s=typeof i===l?i.call(e,{name:"paramType",hash:{},data:t}):i,null!=s&&(u+=s),u+'\n\n'},useData:!0}),this.Handlebars.templates.parameter_content_type=Handlebars.template({1:function(e,n,a,t){var s,i="";return s=n.each.call(e,null!=e?e.consumes:e,{name:"each",hash:{},fn:this.program(2,t),inverse:this.noop,data:t}),null!=s&&(i+=s),i},2:function(e){var n,a=this.lambda,t=' \n"},4:function(){return' \n'},compiler:[6,">= 2.0.0-beta.1"],main:function(e,n,a,t){var s,i='\n\n"},useData:!0}),this.Handlebars.templates.resource=Handlebars.template({1:function(){return" : "},3:function(e,n,a,t){var s,i="function",l=n.helperMissing,r=this.escapeExpression;return"
  • \n Raw\n
  • \n"},compiler:[6,">= 2.0.0-beta.1"],main:function(e,n,a,t){var s,i,l,r="function",o=n.helperMissing,u=this.escapeExpression,p=n.blockHelperMissing,d="
    \n

    \n '+u((i=null!=(i=n.name||(null!=e?e.name:e))?i:o,typeof i===r?i.call(e,{name:"name",hash:{},data:t}):i))+" ";return i=null!=(i=n.summary||(null!=e?e.summary:e))?i:o,l={name:"summary",hash:{},fn:this.program(1,t),inverse:this.noop,data:t},s=typeof i===r?i.call(e,l):i,n.summary||(s=p.call(e,s,l)),null!=s&&(d+=s),i=null!=(i=n.summary||(null!=e?e.summary:e))?i:o,s=typeof i===r?i.call(e,{name:"summary",hash:{},data:t}):i,null!=s&&(d+=s),d+="\n

    \n \n
    \n\n"},useData:!0}),this.Handlebars.templates.response_content_type=Handlebars.template({1:function(e,n,a,t){var s,i="";return s=n.each.call(e,null!=e?e.produces:e,{name:"each",hash:{},fn:this.program(2,t),inverse:this.noop,data:t}),null!=s&&(i+=s),i},2:function(e){var n,a=this.lambda,t=' \n"},4:function(){return' \n'},compiler:[6,">= 2.0.0-beta.1"],main:function(e,n,a,t){var s,i='\n\n"},useData:!0}),this.Handlebars.templates.signature=Handlebars.template({compiler:[6,">= 2.0.0-beta.1"],main:function(e,n,a,t){var s,i,l="function",r=n.helperMissing,o=this.escapeExpression,u='
    \n\n
    \n\n
    \n
    \n ';return i=null!=(i=n.signature||(null!=e?e.signature:e))?i:r,s=typeof i===l?i.call(e,{name:"signature",hash:{},data:t}):i,null!=s&&(u+=s),u+'\n
    \n\n
    \n
    '+o((i=null!=(i=n.sampleJSON||(null!=e?e.sampleJSON:e))?i:r,typeof i===l?i.call(e,{name:"sampleJSON",hash:{},data:t}):i))+'
    \n \n
    \n
    \n\n'},useData:!0}),this.Handlebars.templates.status_code=Handlebars.template({1:function(e,n,a,t){var s=this.lambda,i=this.escapeExpression;return" \n "+i(s(t&&t.key,e))+"\n "+i(s(null!=e?e.description:e,e))+"\n "+i(s(null!=e?e.type:e,e))+"\n \n"},compiler:[6,">= 2.0.0-beta.1"],main:function(e,n,a,t){var s,i,l="function",r=n.helperMissing,o=this.escapeExpression,u=""+o((i=null!=(i=n.code||(null!=e?e.code:e))?i:r,typeof i===l?i.call(e,{name:"code",hash:{},data:t}):i))+"\n";return i=null!=(i=n.message||(null!=e?e.message:e))?i:r,s=typeof i===l?i.call(e,{name:"message",hash:{},data:t}):i,null!=s&&(u+=s),u+='\n\n\n \n \n',s=n.each.call(e,null!=e?e.headers:e,{name:"each",hash:{},fn:this.program(1,t),inverse:this.noop,data:t}),null!=s&&(u+=s),u+" \n
    \n"},useData:!0});var ApiKeyButton=Backbone.View.extend({events:{"click #apikey_button":"toggleApiKeyContainer","click #apply_api_key":"applyApiKey"},initialize:function(){},render:function(){var e=this.template();return $(this.el).html(e(this.model)),this},applyApiKey:function(){var e=new ApiKeyAuthorization(this.model.name,$("#input_apiKey_entry").val(),this.model["in"]);window.authorizations.add(this.model.name,e),window.swaggerUi.load(),$("#apikey_container").show()},toggleApiKeyContainer:function(){if($("#apikey_container").length>0){var e=$("#apikey_container").first();e.is(":visible")?e.hide():($(".auth_container").hide(),e.show())}},template:function(){return Handlebars.templates.apikey_button_view}}),BasicAuthButton=Backbone.View.extend({initialize:function(){},render:function(){var e=this.template();return $(this.el).html(e(this.model)),this},events:{"click #basic_auth_button":"togglePasswordContainer","click #apply_basic_auth":"applyPassword"},applyPassword:function(){var e=$(".input_username").val(),n=$(".input_password").val(),a=new PasswordAuthorization("basic",e,n);window.authorizations.add(this.model.type,a),window.swaggerUi.load(),$("#basic_auth_container").hide()},togglePasswordContainer:function(){if($("#basic_auth_container").length>0){var e=$("#basic_auth_container").show();e.is(":visible")?e.slideUp():($(".auth_container").hide(),e.show())}},template:function(){return Handlebars.templates.basic_auth_button_view}}),ContentTypeView=Backbone.View.extend({initialize:function(){},render:function(){return $(this.el).html(Handlebars.templates.content_type(this.model)),$("label[for=contentType]",$(this.el)).text("Response Content Type"),this}}),HeaderView=Backbone.View.extend({events:{"click #show-pet-store-icon":"showPetStore","click #show-wordnik-dev-icon":"showWordnikDev","click #explore":"showCustom","keyup #input_baseUrl":"showCustomOnKeyup","keyup #input_apiKey":"showCustomOnKeyup"},initialize:function(){},showPetStore:function(){this.trigger("update-swagger-ui",{url:"http://petstore.swagger.wordnik.com/api/api-docs"})},showWordnikDev:function(){this.trigger("update-swagger-ui",{url:"http://api.wordnik.com/v4/resources.json"})},showCustomOnKeyup:function(e){13===e.keyCode&&this.showCustom()},showCustom:function(e){e&&e.preventDefault(),this.trigger("update-swagger-ui",{url:$("#input_baseUrl").val(),apiKey:$("#input_apiKey").val()})},update:function(e,n,a){void 0===a&&(a=!1),$("#input_baseUrl").val(e),a&&this.trigger("update-swagger-ui",{url:e})}}),MainView=Backbone.View.extend({initialize:function(e){e=e||{},this.model.auths=[];var n,a;for(n in this.model.securityDefinitions)a=this.model.securityDefinitions[n],this.model.auths.push({name:n,type:a.type,value:a});"2.0"===this.model.swaggerVersion&&(this.model.validatorUrl="validatorUrl"in e.swaggerOptions?e.swaggerOptions.validatorUrl:this.model.url.indexOf("localhost")>0?null:"http://online.swagger.io/validator")},render:function(){if(this.model.securityDefinitions)for(var e in this.model.securityDefinitions){var n,a=this.model.securityDefinitions[e];"apiKey"===a.type&&0===$("#apikey_button").length&&(n=new ApiKeyButton({model:a}).render().el,$(".auth_main_container").append(n)),"basicAuth"===a.type&&0===$("#basic_auth_button").length&&(n=new BasicAuthButton({model:a}).render().el,$(".auth_main_container").append(n))}$(this.el).html(Handlebars.templates.main(this.model));var t={},s=0;return this.model.apisArray.forEach(function(e){for(var n=e.name;"undefined"!=typeof t[n];)n=n+"_"+s,s+=1;e.id=n,t[n]=e,this.addResource(e,this.model.auths)}),$(".propWrap").hover(function(){$(".optionsWrapper",$(this)).show()},function(){$(".optionsWrapper",$(this)).hide()}),this},addResource:function(e,n){e.id=e.id.replace(/\s/g,"_");var a=new ResourceView({model:e,tagName:"li",id:"resource_"+e.id,className:"resource",auths:n,swaggerOptions:this.options.swaggerOptions});$("#resources").append(a.render().el)},clear:function(){$(this.el).html("")}}),OperationView=Backbone.View.extend({invocationUrl:null,events:{"submit .sandbox":"submitOperation","click .submit":"submitOperation","click .response_hider":"hideResponse","click .toggleOperation":"toggleOperationContent","mouseenter .api-ic":"mouseEnter","mouseout .api-ic":"mouseExit"},initialize:function(e){return e=e||{},this.auths=e.auths,this.parentId=this.model.parentId,this.nickname=this.model.nickname,this},mouseEnter:function(e){var n=$(this.el).find(".content"),a=e.pageX,t=e.pageY,s=$(window).scrollLeft(),i=$(window).scrollTop(),l=s+$(window).width(),r=i+$(window).height(),o=n.width(),u=n.height();a+o>l&&(a=l-o),s>a&&(a=s),t+u>r&&(t=r-u),i>t&&(t=i);var p={};p.top=t,p.left=a,n.css(p),$(e.currentTarget.parentNode).find("#api_information_panel").show()},mouseExit:function(e){$(e.currentTarget.parentNode).find("#api_information_panel").hide()},render:function(){var e,n,a,t,s,i,l,r,o,u,p,d,h,c,m,f,g,v,y,b,w,_,x,k,O,C,S,T,D,E,M,H,R,V,N,U,P,A;if(i=jQuery.inArray(this.model.method,this.model.supportedSubmitMethods())>=0,i||(this.model.isReadOnly=!0),this.model.description=this.model.description||this.model.notes,this.model.description&&(this.model.description=this.model.description.replace(/(?:\r\n|\r|\n)/g,"
    ")),this.model.oauth=null,f=this.model.authorizations||this.model.security)if(Array.isArray(f))for(o=0,u=f.length;u>o;o++){a=f[o];for(r in a){n=a[r];for(e in this.auths)if(n=this.auths[e],"oauth2"===n.type){this.model.oauth={},this.model.oauth.scopes=[],x=n.value.scopes;for(l in x)P=x[l],H=a[r].indexOf(l),H>=0&&(v={scope:l,description:P},this.model.oauth.scopes.push(v))}}}else for(l in f)if(P=f[l],"oauth2"===l)for(null===this.model.oauth&&(this.model.oauth={}),void 0===this.model.oauth.scopes&&(this.model.oauth.scopes=[]),m=0,p=P.length;p>m;m++)v=P[m],this.model.oauth.scopes.push(v);if("undefined"!=typeof this.model.responses){this.model.responseMessages=[],k=this.model.responses;for(t in k)A=k[t],E=null,M=this.model.responses[t].schema,M&&M.$ref&&(E=M.$ref,0===E.indexOf("#/definitions/")&&(E=E.substring("#/definitions/".length))),this.model.responseMessages.push({code:t,message:A.description,responseModel:E})}if("undefined"==typeof this.model.responseMessages&&(this.model.responseMessages=[]),R=null,this.model.successResponse){N=this.model.successResponse;for(r in N)A=N[r],this.model.successCode=r,"object"==typeof A&&"function"==typeof A.createJSONSample&&(R={sampleJSON:JSON.stringify(A.createJSONSample(),void 0,2),isParam:!1,signature:A.getMockSignature()})}else this.model.responseClassSignature&&"string"!==this.model.responseClassSignature&&(R={sampleJSON:this.model.responseSampleJSON,isParam:!1,signature:this.model.responseClassSignature});for($(this.el).html(Handlebars.templates.operation(this.model)),R?(D=new SignatureView({model:R,tagName:"div"}),$(".model-signature",$(this.el)).append(D.render().el)):(this.model.responseClassSignature="string",$(".model-signature",$(this.el)).html(this.model.type)),s={isParam:!1},s.consumes=this.model.consumes,s.produces=this.model.produces,O=this.model.parameters,g=0,d=O.length;d>g;g++)b=O[g],U=b.type||b.dataType||"","undefined"==typeof U&&(E=b.schema,E&&E.$ref&&(_=E.$ref,U=0===_.indexOf("#/definitions/")?_.substring("#/definitions/".length):_)),U&&"file"===U.toLowerCase()&&(s.consumes||(s.consumes="multipart/form-data")),b.type=U;for(T=new ResponseContentTypeView({model:s}),$(".response-content-type",$(this.el)).append(T.render().el),C=this.model.parameters,y=0,h=C.length;h>y;y++)b=C[y],this.addParameter(b,s.consumes);for(S=this.model.responseMessages,w=0,c=S.length;c>w;w++)V=S[w],this.addStatusCode(V);return this},addParameter:function(e,n){e.consumes=n;var a=new ParameterView({model:e,tagName:"tr",readOnly:this.model.isReadOnly});$(".operation-params",$(this.el)).append(a.render().el)},addStatusCode:function(e){var n=new StatusCodeView({model:e,tagName:"tr"});$(".operation-status",$(this.el)).append(n.render().el)},submitOperation:function(e){var n,a,t,s,i,l,r,o,u,p,d,h,c,m,f,g;if(null!==e&&e.preventDefault(),a=$(".sandbox",$(this.el)),n=!0,a.find("input.required").each(function(){$(this).removeClass("error"),""===jQuery.trim($(this).val())&&($(this).addClass("error"),$(this).wiggle({callback:function(e){return function(){$(e).focus()}}(this)}),n=!1)}),a.find("textarea.required").each(function(){$(this).removeClass("error"),""===jQuery.trim($(this).val())&&($(this).addClass("error"),$(this).wiggle({callback:function(e){return function(){return $(e).focus()}}(this)}),n=!1)}),n){for(u={},h={parent:this},t=!1,c=a.find("input"),s=0,i=c.length;i>s;s++)d=c[s],null!==d.value&&jQuery.trim(d.value).length>0&&(u[d.name]=d.value),"file"===d.type&&(u[d.name]=d.files[0],t=!0);for(m=a.find("textarea"),o=0,l=m.length;l>o;o++)d=m[o],null!==d.value&&jQuery.trim(d.value).length>0&&(u[d.name]=d.value);for(f=a.find("select"),p=0,r=f.length;r>p;p++)d=f[p],g=this.getSelectedValue(d),null!==g&&jQuery.trim(g).length>0&&(u[d.name]=g);return h.responseContentType=$("div select[name=responseContentType]",$(this.el)).val(),h.requestContentType=$("div select[name=parameterContentType]",$(this.el)).val(),$(".response_throbber",$(this.el)).show(),t?this.handleFileUpload(u,a):this.model["do"](u,h,this.showCompleteStatus,this.showErrorStatus,this)}},success:function(e,n){n.showCompleteStatus(e)},handleFileUpload:function(e,n){var a,t,s,i,l,r,o,u,p,d,h,c,m,f,g,v,y,b,w;for(v=n.serializeArray(),i=0,l=v.length;l>i;i++)h=v[i],null!==h.value&&jQuery.trim(h.value).length>0&&(e[h.name]=h.value);for(a=new FormData,g=0,y=this.model.parameters,p=0,r=y.length;r>p;p++)f=y[p],("form"===f.paramType||"formData"===f["in"])&&"file"!==f.type.toLowerCase()&&void 0!==e[f.name]&&a.append(f.name,e[f.name]);for(s={},b=this.model.parameters,d=0,o=b.length;o>d;d++)f=b[d],"header"===f.paramType&&(s[f.name]=e[f.name]);for(w=n.find('input[type~="file"]'),m=0,u=w.length;u>m;m++)t=w[m],"undefined"!=typeof t.files[0]&&(a.append($(t).attr("name"),t.files[0]),g+=1);return this.invocationUrl=this.model.supportHeaderParams()?(s=this.model.getHeaderParams(e),delete s["Content-Type"],this.model.urlify(e,!1)):this.model.urlify(e,!0),$(".request_url",$(this.el)).html("
    "),$(".request_url pre",$(this.el)).text(this.invocationUrl),c={type:this.model.method,url:this.invocationUrl,headers:s,data:a,dataType:"json",contentType:!1,processData:!1,error:function(e){return function(n){return e.showErrorStatus(e.wrap(n),e)}}(this),success:function(e){return function(n){return e.showResponse(n,e)}}(this),complete:function(e){return function(n){return e.showCompleteStatus(e.wrap(n),e)}}(this)},window.authorizations&&window.authorizations.apply(c),0===g&&c.data.append("fake","true"),jQuery.ajax(c),!1},wrap:function(e){var n,a,t,s,i,l,r;for(t={},a=e.getAllResponseHeaders().split("\r"),i=0,l=a.length;l>i;i++)s=a[i],n=s.match(/^([^:]*?):(.*)$/),n||(n=[]),n.shift(),void 0!==n[0]&&void 0!==n[1]&&(t[n[0].trim()]=n[1].trim());return r={},r.content={},r.content.data=e.responseText,r.headers=t,r.request={},r.request.url=this.invocationUrl,r.status=e.status,r},getSelectedValue:function(e){if(e.multiple){for(var n=[],a=0,t=e.options.length;t>a;a++){var s=e.options[a];s.selected&&n.push(s.value)}return n.length>0?n:null}return e.value},hideResponse:function(e){e&&e.preventDefault(),$(".response",$(this.el)).slideUp(),$(".response_hider",$(this.el)).fadeOut()},showResponse:function(e){var n=JSON.stringify(e,null,"	").replace(/\n/g,"
    ");$(".response_body",$(this.el)).html(_.escape(n))},showErrorStatus:function(e,n){n.showStatus(e)},showCompleteStatus:function(e,n){n.showStatus(e)},formatXml:function(e){var n,a,t,s,i,l,r,o,u,p,d,h,c;for(d=/(>)(<)(\/*)/g,c=/[ ]*(.*)[ ]+\n/g,n=/(<.+>)(.+\n)/g,e=e.replace(d,"$1\n$2$3").replace(c,"$1\n").replace(n,"$1\n$2"),p=0,t="",o=e.split("\n"),s=0,l="other",h={"single->single":0,"single->closing":-1,"single->opening":0,"single->other":0,"closing->single":0,"closing->closing":-1,"closing->opening":0,"closing->other":0,"opening->single":1,"opening->closing":0,"opening->opening":1,"opening->other":1,"other->single":0,"other->closing":-1,"other->opening":0,"other->other":0},a=function(e){var n,a,i,r,o,u,p;u={single:Boolean(e.match(/<.+\/>/)),closing:Boolean(e.match(/<\/.+>/)),opening:Boolean(e.match(/<[^!?].*>/))},o=function(){var e;e=[];for(i in u)p=u[i],p&&e.push(i);return e}()[0],o=void 0===o?"other":o,n=l+"->"+o,l=o,r="",s+=h[n],r=function(){var e,n,t;for(t=[],a=e=0,n=s;n>=0?n>e:e>n;a=n>=0?++e:--e)t.push(" ");return t}().join(""),"opening->closing"===n?t=t.substr(0,t.length-1)+e+"\n":t+=r+e+"\n"},i=0,r=o.length;r>i;i++)u=o[i],a(u);return t},showStatus:function(e){var n,a;void 0===e.content?(a=e.data,n=e.url):(a=e.content.data,n=e.request.url);var t=e.headers,s=null;t&&(s=t["Content-Type"]||t["content-type"],s&&(s=s.split(";")[0].trim())),$(".response_body",$(this.el)).removeClass("json"),$(".response_body",$(this.el)).removeClass("xml");var i,l,r=function(e){var n=document.createElement("audio");return!(!n.canPlayType||!n.canPlayType(e).replace(/no/,""))};if(a)if("application/json"===s||/\+json$/.test(s)){var o=null;try{o=JSON.stringify(JSON.parse(a),null," ")}catch(u){o="can't parse JSON. Raw result:\n\n"+a}l=$("").text(o),i=$('
    ').append(l)}else"application/xml"===s||/\+xml$/.test(s)?(l=$("").text(this.formatXml(a)),i=$('
    ').append(l)):"text/html"===s?(l=$("").html(_.escape(a)),i=$('
    ').append(l)):/^image\//.test(s)?i=$("").attr("src",n):/^audio\//.test(s)&&r(s)?i=$("