diff --git a/js/app.js b/js/app.js
index 639b88ba776b40a5f3afacb17dfd22394333306d..fac488b1d78936ffc382cb6ba8b9957300696484 100644
--- a/js/app.js
+++ b/js/app.js
@@ -1 +1 @@
-var PROXY_URL="https://cors-anywhere.herokuapp.com/";function debounce(e,t,s){var a;return function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];clearTimeout(a),a=setTimeout((function(){t.apply(s,n)}),e)}}function throttle(e,t,s){var a,n;return e=e||250,function(){for(var i=[],o=arguments.length;o--;)i[o]=arguments[o];var l=+new Date;a&&l<a+e?(clearTimeout(n),n=setTimeout((function(){a=l,t.apply(s,i)}),e)):(a=l,t.apply(s,i))}}function getUrl(e,t,s){var a=""+e+t+"?client_id="+AUTH_ID+"&client_secret="+AUTH_SECRET,n="redirect_uri="+encodeURIComponent(location.protocol+"//"+location.host+"/");return s?a+"&"+Object.keys(s).map((function(e){return e+"="+s[e]})).join("&")+"&"+n:a+(!1!==s?"&"+n:"")}var GISTS={BASE_URL:"https://github.com",API_URL:"https://api.github.com",loadFrom:function(e){var t=e.replace("#","").split("/");if(1===t.length)return Promise.resolve({files:{"schema.json":{content:decodeURIComponent(t[0])}}});var s=t[0],a=t[1];switch(s){case"gist":return fetch(getUrl(GISTS.API_URL,"/gists/"+a)).then((function(e){return e.json()}));case"uri":return Promise.resolve({files:{Example:{content:decodeURIComponent(a)}}});default:throw new Error("Unknown storage type")}},save:function(e){var t={};Object.keys(e).forEach((function(s){t[s]={content:e[s].value}}));var s=window.localStorage._AUTH;if(s){var a=getUrl(GISTS.API_URL,"/gists",!1);return fetch(""+PROXY_URL+a,{method:"POST",headers:{Authorization:"bearer "+s,Accept:"application/json"},body:JSON.stringify({description:"JSON Schema created by http://json-schema-faker.js.org",files:t})}).then((function(e){return e.json()})).then((function(e){if(e.message)throw new Error(e.message);return e}))}},auth:function(e,t){window.localStorage._AUTH="";var s=getUrl(GISTS.BASE_URL,"/login/oauth/access_token",{code:e});fetch(""+PROXY_URL+s,{method:"POST",headers:{Accept:"application/json"}}).then((function(e){return e.json()})).then((function(e){e.access_token&&(window.localStorage._AUTH=e.access_token,setTimeout(t,260))}))},url:function(){return getUrl(GISTS.BASE_URL,"/login/oauth/authorize",{scope:"gist"})}},script={props:["value","readonly"],data:()=>({yaml:!1}),mounted(){this.$e=ace.edit(this.$refs.editor),this.$e.setTheme("ace/theme/github"),this.$e.getSession().setTabSize(2),this.$e.setShowPrintMargin(!1),this.$e.$blockScrolling=Infinity,this._isWatching=!1,this._backupObj=null,this.change(this.value),this.setMode(),this.readonly?this.$e.setReadOnly(!0):this.$e.getSession().on("change",()=>{this._isWatching||this.change(this.$e.getValue())})},methods:{disable(){this.yaml=!1,this.setMode()},enable(){this.yaml=!0,this.setMode()},change(e){const t=this._backupObj;try{this.yaml?this._backupObj=YAML.parse(e)||this._backupObj:this._backupObj=JSON.parse(e)||this._backupObj}catch(s){}t!==this._backupObj&&this.$emit("change",{value:this._backupObj,source:e})},update(){this.value&&this.$e.setValue(this.yaml?YAML.dump(this._backupObj,6,2):JSON.stringify(this._backupObj,null,2))},setMode(){this.$e.getSession().setMode(`ace/mode/${this.yaml?"yaml":"json"}`),this.update()}},watch:{value(){this._isWatching=!0,this.change(this.value),this.update(),this._isWatching=!1}}};function normalizeComponent(e,t,s,a,n,i,o,l,u,r){"boolean"!=typeof o&&(u=l,l=o,o=!1);var c,d="function"==typeof s?s.options:s;if(e&&e.render&&(d.render=e.render,d.staticRenderFns=e.staticRenderFns,d._compiled=!0,n&&(d.functional=!0)),a&&(d._scopeId=a),i?(c=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),t&&t.call(this,u(e)),e&&e._registeredComponents&&e._registeredComponents.add(i)},d._ssrRegister=c):t&&(c=o?function(){t.call(this,r(this.$root.$options.shadowRoot))}:function(e){t.call(this,l(e))}),c)if(d.functional){var _=d.render;d.render=function(e,t){return c.call(t),_(e,t)}}else{var h=d.beforeCreate;d.beforeCreate=h?[].concat(h,c):[c]}return s}var normalizeComponent_1=normalizeComponent;const __vue_script__=script;var __vue_render__=function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{staticClass:"rel"},[s("div",{ref:"editor",staticClass:"AceEditor nosl f b"}),e.readonly?e._e():s("div",{staticClass:"abs t0 r0 z1 nosl"},[s("ul",{staticClass:"lr ln flx"},[s("li",{staticClass:"sp"},[s("a",{staticClass:"a","class":{"-on":!e.yaml},on:{click:e.disable}},[e._v("JSON")])]),s("li",{staticClass:"sp"},[s("a",{staticClass:"a","class":{"-on":e.yaml},on:{click:e.enable}},[e._v("YAML")])])])])])},__vue_staticRenderFns__=[];const __vue_inject_styles__=undefined,__vue_scope_id__=undefined,__vue_module_identifier__=undefined,__vue_is_functional_template__=!1;var JSONEditor=normalizeComponent_1({render:__vue_render__,staticRenderFns:__vue_staticRenderFns__},__vue_inject_styles__,__vue_script__,__vue_scope_id__,!1,__vue_module_identifier__,undefined,undefined),script$1={props:["value","tabindex","placeholder"],data:()=>({selectedValue:null}),methods:{onChange(){this.$emit("change",this.selectedValue)}}};const __vue_script__$1=script$1;var __vue_render__$1=function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{staticClass:"Dropdown f"},[s("select",{directives:[{name:"model",rawName:"v-model",value:e.selectedValue,expression:"selectedValue"}],staticClass:"a",attrs:{tabindex:e.tabindex},on:{change:[function(t){var s=[].filter.call(t.target.options,(function(e){return e.selected})).map((function(e){return"_value"in e?e._value:e.value}));e.selectedValue=t.target.multiple?s:s[0]},e.onChange]}},e._l(e.value,(function(t){return s("option",[e._v(e._s(t))])})),0),s("div",{staticClass:"Dropdown--arrow"}),s("div",{staticClass:"Dropdown--value nosl"},[s("span",{staticClass:"db tr"},[e._v(e._s(e.selectedValue||e.placeholder))])])])},__vue_staticRenderFns__$1=[];const __vue_inject_styles__$1=undefined,__vue_scope_id__$1=undefined,__vue_module_identifier__$1=undefined,__vue_is_functional_template__$1=!1;var SimpleDropdown=normalizeComponent_1({render:__vue_render__$1,staticRenderFns:__vue_staticRenderFns__$1},__vue_inject_styles__$1,__vue_script__$1,__vue_scope_id__$1,!1,__vue_module_identifier__$1,undefined,undefined),script$2={props:["value","tabindex","placeholder"],data:()=>({label:"",isNew:!1,hasChanged:!1,shouldUpdate:!1,canBeDeleted:!1,selectedValue:null}),methods:{change(){this.$emit("change",{setValues:this.value})},reset(){this.shouldUpdate=!0,this.canBeDeleted=!0,this.hasChanged=!1,this.isNew=!1,this.$refs.input.focus()},update(e){e&&(this.selectedValue=e)},inputValue(e){const t=e.target.value;if(!t)return void(this.shouldUpdate=!1);const s=-1===this.value.indexOf(t),a=this.selectedValue,n=t!==a;this.isNew=s,this.hasChanged=null!==a&&n,this.shouldUpdate=s||!1===n,this.canBeDeleted=!s&&null!==a},submitValue(e){switch(e.key){case"Enter":this.addValue();break;case"ArrowUp":if(!this.hasChanged){const e=this.value,t=e.indexOf(this.selectedValue);t>0?this.update(e[t-1]):this.update(e[e.length-1])}break;case"ArrowDown":if(!this.hasChanged){const e=this.value,t=e.indexOf(this.selectedValue);t<e.length-1?this.update(e[t+1]):this.update(e[0])}}},addValue(){this.$refs.input.value&&-1===this.value.indexOf(this.$refs.input.value)&&(this.$emit("change",{addValue:this.$refs.input.value}),this.selectedValue=this.$refs.input.value,this.value.push(this.$refs.input.value),this.reset(),this.change())},updateValue(){const e=this.selectedValue,t=this.$refs.input.value;this.value.forEach((s,a)=>{s===e&&(this.$emit("change",{updateValue:t,oldValue:e}),this.value[a]=t)}),this.reset(),this.change()},removeValue(){const e=this.value,t=e.indexOf(this.selectedValue);if(this.$emit("change",{removeValue:this.value.splice(t,1)}),this.reset(),this.change(),!e.length)return this.shouldUpdate=!1,this.selectedValue=null,this.$refs.input.value="",!1;t>0?this.update(e[t-1]):this.update(e[0])}},watch:{value(e){this.canBeDeleted=e.length>0,this.shouldUpdate=e.length>0,e.length&&!this.$refs.input.value&&(this.$refs.input.value=e[e.length-1],this.$refs.input.focus()),e.length||(this.$refs.input.value="")},selectedValue(e){e?(this.$emit("change",{selectedValue:e}),this.$refs.input.value=e,this.$refs.input.focus()):this.$refs.input.value=""}}};const __vue_script__$2=script$2;var __vue_render__$2=function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{staticClass:"Dropdown f"},[s("div",{staticClass:"Dropdown--arrow"}),s("select",{directives:[{name:"model",rawName:"v-model",value:e.selectedValue,expression:"selectedValue"}],staticClass:"a",attrs:{tabindex:"-1"},on:{change:function(t){var s=[].filter.call(t.target.options,(function(e){return e.selected})).map((function(e){return"_value"in e?e._value:e.value}));e.selectedValue=t.target.multiple?s:s[0]}}},e._l(e.value,(function(t){return s("option",[e._v(e._s(t))])})),0),s("div",{staticClass:"Dropdown--value nosl"},[s("input",{ref:"input","class":e.shouldUpdate&&{"-new":e.isNew,"-edit":e.hasChanged,"-remove":e.canBeDeleted},attrs:{tabindex:e.tabindex,placeholder:e.placeholder},on:{input:e.inputValue,keydown:e.submitValue}})]),s("div",{staticClass:"Dropdown--actions nosl","class":{"-show":e.shouldUpdate}},[e.isNew?s("a",{staticClass:"a tdn sp pd",attrs:{tabindex:"-1"},on:{click:e.addValue}},[e._v("Add")]):e._e(),e.hasChanged?s("a",{staticClass:"a tdn sp pd",attrs:{tabindex:"-1"},on:{click:e.updateValue}},[e._v("Update")]):e._e(),e.canBeDeleted?s("a",{staticClass:"a tdn sp pd",attrs:{tabindex:"-1"},on:{click:e.removeValue}},[e._v("Delete")]):e._e()])])},__vue_staticRenderFns__$2=[];const __vue_inject_styles__$2=undefined,__vue_scope_id__$2=undefined,__vue_module_identifier__$2=undefined,__vue_is_functional_template__$2=!1;var EditableDropdown=normalizeComponent_1({render:__vue_render__$2,staticRenderFns:__vue_staticRenderFns__$2},__vue_inject_styles__$2,__vue_script__$2,__vue_scope_id__$2,!1,__vue_module_identifier__$2,undefined,undefined),script$3={data:()=>({libInfo:null,hasValues:!1,showMessage:!1,logMessage:"",classes:"",inputJSON:"",outputJSON:"",savedSchemas:[],availableAssets:[]}),computed:{loggedIn:()=>"undefined"!=typeof window.localStorage._AUTH&&""!==window.localStorage._AUTH,availableVersions(){return this.libInfo?this.libInfo.files.map(e=>e.version):[]}},methods:{closeLog(){this.showMessage=!1},loginAction(){location.href=GISTS.url()},synchronizeGist(e){this.$emit("synchronizeGist",e)},generateOutput(e){this.$emit("generateOutput",e)},inputChange(e){this.$emit("inputChange",e)},setFile(e){this.$emit("setFile",e)},setVersion(e){this.availableAssets=this.libInfo?this.libInfo.files.filter(t=>t.version===e)[0].files.filter(e=>-1===e.indexOf(".min")):[],this.$refs.assets.selectedValue=this.availableAssets[0],this.$refs.versions.selectedValue=e,this.$emit("setVersion",e)},setPayload(e){this.$emit("setPayload",e)},logStatus(e,t){this.classes=t,this.logMessage=e,this.showMessage=!0,clearTimeout(this._timeout),this._timeout=setTimeout(()=>{this.showMessage=!1},5e3)}},components:{JSONEditor:JSONEditor,SimpleDropdown:SimpleDropdown,EditableDropdown:EditableDropdown}};const __vue_script__$3=script$3;var __vue_render__$3=function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{staticClass:"md-flx flx-m"},[s("div",{staticClass:"flx-a md-cl-6"},[s("div",{staticClass:"flx flx-m"},[s("div",{staticClass:"flx-a"},[s("EditableDropdown",{ref:"schemas",attrs:{value:e.savedSchemas,placeholder:"Schema identifier, e.g. User",tabindex:"1"},on:{change:e.setPayload}})],1),e.hasValues?s("div",{staticClass:"flx-ml"},[e.loggedIn?s("button",{staticClass:"a bu db nosl",attrs:{tabindex:"2"},on:{click:e.synchronizeGist}},[e._v("Save as gist")]):s("button",{staticClass:"a bu db nosl",on:{click:e.loginAction}},[e._v("GitHub login")])]):e._e()]),e.hasValues?s("div",{staticClass:"mt"},[s("JSONEditor",{attrs:{value:e.inputJSON},on:{change:e.inputChange}})],1):e._e()]),s("div",{staticClass:"flx-a md-cl-6"},[s("div",{staticClass:"sm-flx flx-m"},[e.hasValues?s("div",{staticClass:"flx-mt"},[s("button",{staticClass:"a f bu db cl-12 nosl",attrs:{tabindex:"5"},on:{click:e.generateOutput}},[e._v("Generate example")])]):e._e()]),e.hasValues?s("div",{staticClass:"mt"},[s("JSONEditor",{attrs:{value:e.outputJSON,readonly:"readonly"}})],1):e._e()]),s("div",{staticClass:"Toast","class":[e.classes,{"-show":e.showMessage}]},[s("div",{staticClass:"sm-flx flx-m flx-c"},[s("div",{staticClass:"flx-a"},[e._v(e._s(e.logMessage))]),e.hasValues?s("div",{staticClass:"flx-mr"},[s("button",{staticClass:"a f bu db cl-12 nosl",attrs:{tabindex:"6"},on:{click:e.closeLog}},[e._v("OK")])]):e._e()])])])},__vue_staticRenderFns__$3=[];const __vue_inject_styles__$3=undefined,__vue_scope_id__$3=undefined,__vue_module_identifier__$3=undefined,__vue_is_functional_template__$3=!1;var App=normalizeComponent_1({render:__vue_render__$3,staticRenderFns:__vue_staticRenderFns__$3},__vue_inject_styles__$3,__vue_script__$3,__vue_scope_id__$3,!1,__vue_module_identifier__$3,undefined,undefined);window.JSCOMPILER_PRESERVE=function(){return null};var _selected,_vm,_t,SETTINGS={},SCHEMAS={};function configureJSF(){window.jsf&&window.jsf.option&&window.jsf.option(SETTINGS)}function generateOutput(){if(window.jsf){var e=new Date,t=[];if(Object.keys(SCHEMAS).forEach((function(e){e!==_selected&&t.push(JSON.parse(SCHEMAS[e].value))})),SCHEMAS[_selected]){var s;try{s=JSON.parse(SCHEMAS[_selected].value)}catch(a){return void _vm.logStatus(a.message||a.toString(),["-error"])}_vm.$el.classList.add("-dis");(parseFloat(window.jsf.version)>=.5?function(){return(window.jsf.resolve||window.jsf)(s,t)}:function(){return new Promise((function(e,n){try{e((window.jsf.generate||window.jsf.sync||window.jsf)(s,t))}catch(a){n(a)}}))})().then((function(t){_vm.$el.classList.remove("-dis"),_vm.outputJSON=JSON.stringify(t,null,2),_vm.logStatus("Example generated in "+(new Date-e)/1e3+"s",["-success"])}))["catch"]((function(e){_vm.$el.classList.remove("-dis"),_vm.logStatus((e.message||e.toString()).substr(0,200),["-error"])}))}}else setTimeout(generateOutput,1e3)}function saveSession(){var e=new Date;window.localStorage._SCHEMAS=JSON.stringify(SCHEMAS),_vm.logStatus("Session saved in "+(new Date-e)/1e3+"ms",["-success"])}function loadSession(){var e=Object.keys(SCHEMAS);_vm.savedSchemas=e,_vm.hasValues=e.length>0,e.length&&(_selected=e[0],_vm.inputJSON=SCHEMAS[e[0]].value,_vm.$refs.schemas.selectedValue=_selected),_vm.$el.classList.remove("-dis")}function loadStorage(){if(window.localStorage._SCHEMAS){var e=JSON.parse(window.localStorage._SCHEMAS);Object.keys(e).forEach((function(t){SCHEMAS[t]=e[t]}))}loadSession()}function onHashChange(){if(_vm.$el.classList.add("-dis"),_vm.inputJSON="",_vm.savedSchemas=[],_vm.hasValues=!1,Object.keys(SCHEMAS).forEach((function(e){delete SCHEMAS[e]})),location.hash){location.hash.split("/")[2];GISTS.loadFrom(location.hash).then((function(e){Object.keys(e.files).forEach((function(t){SCHEMAS[t]={value:e.files[t].content}})),loadSession()}))["catch"]((function(e){_vm.$el.classList.remove("-dis"),_vm.logStatus(e.message||e.toString(),["-error"])}))}else loadStorage()}function onLoadEnd(e){jsf.extend&&(jsf.extend("faker",(function(){return window.faker})),jsf.extend("chance",(function(){return window.chance}))),_vm.logStatus("Loaded in "+(new Date-e)/1e3+"ms",["-success"]),configureJSF(),generateOutput()}function onScripts(){clearTimeout(_t),_t=setTimeout((function(){var e=new Date;window.jsf=window.JSONSchemaFaker||window.jsf,window.jsf._loaded=!0,delete window.JSONSchemaFaker,"undefined"!=typeof jsf?onLoadEnd(e):onScripts()}),1e3)}window.addEventListener("hashchange",onHashChange),document.body.addEventListener("change",(function(e){if(0===e.target.name.indexOf("jsfOptions.")){var t=e.target.name.replace("jsfOptions.","");"checkbox"===e.target.type?SETTINGS[e.target.name.substr(11)]=e.target.checked:"random"===t?SETTINGS.random=""!==e.target.value?function(){return parseFloat(e.target.value)}:Math.random:SETTINGS[e.target.name.substr(11)]=e.value}configureJSF(),generateOutput()}));var matches=location.search&&-1!==location.search.indexOf("code=")?location.search.match(/\bcode=([\w]{20})/)[1]:null;matches&&(window.history.replaceState(null,document.title,"/"),GISTS.auth(matches,(function(){_vm&&_vm.$forceUpdate()})));var Core={init:function(e){_vm=e,setTimeout((function(){onScripts(),onHashChange()}),200),_vm.logStatus("Application loaded in "+(new Date-TIME)/1e3+"ms",["-success"]),_vm.$on("generateOutput",throttle(200,(function(e){e.target.disabled=!0,generateOutput(),e.target.disabled=!1}))),_vm.$on("setPayload",(function(e){e.addValue&&(SCHEMAS[e.addValue]={value:["{",'  "id": "'+e.addValue+'"',"}"].join("\n")},saveSession(),_vm.outputJSON=""),e.setValues&&(_vm.hasValues=e.setValues.length>0,e.setValues.length||window.history.pushState(null,document.title,"")),e.selectedValue&&(_selected=e.selectedValue,_vm.outputJSON="",_vm.inputJSON=SCHEMAS[_selected].value,window.jsf&&window.jsf._loaded&&generateOutput()),e.updateValue&&(SCHEMAS[e.updateValue]=SCHEMAS[e.oldValue],SCHEMAS[e.updateValue].value=SCHEMAS[e.updateValue].value.replace(/"id"\s*:\s*"(\w+)"/g,(function(t,s){return s===e.oldValue?'"id": "'+e.updateValue+'"':t})),_vm.inputJSON=SCHEMAS[e.updateValue].value,delete SCHEMAS[e.oldValue],saveSession()),e.removeValue&&(delete SCHEMAS[e.removeValue],Object.keys(SCHEMAS).length||window.history.pushState(null,document.title,"#"),saveSession())})),_vm.$on("inputChange",debounce(200,(function(e){_selected&&e.value&&(SCHEMAS[_selected].value=JSON.stringify(e.value),generateOutput(),saveSession())}))),_vm.$on("synchronizeGist",(function(e){var t=new Date;return e.target.disabled=!0,_vm.$el.classList.add("-dis"),GISTS.save(SCHEMAS).then((function(s){e.target.disabled=!1,_vm.$el.classList.remove("-dis"),_vm.logStatus("Gist saved in "+(new Date-t)/1e3+"s",["-success"]),window.history.pushState(null,document.title,"#gist/"+s.id)}))["catch"]((function(t){e.target.disabled=!1,_vm.$el.classList.remove("-dis"),_vm.logStatus(t.message||t.toString(),["-error"])})),!1}))}},vm=new Vue({el:"#app",render:function(e){return e(App,{ref:"UI"})}});Core.init(vm.$refs.UI);
\ No newline at end of file
+var PROXY_URL="https://cors-anywhere.herokuapp.com/",AUTH_ID="9685733337524132a430",AUTH_SECRET="bb8e95e2d20291d29eda90f8a35e0572092b37f9";function debounce(e,t,s){var a;return function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];clearTimeout(a),a=setTimeout((function(){t.apply(s,n)}),e)}}function throttle(e,t,s){var a,n;return e=e||250,function(){for(var i=[],o=arguments.length;o--;)i[o]=arguments[o];var l=+new Date;a&&l<a+e?(clearTimeout(n),n=setTimeout((function(){a=l,t.apply(s,i)}),e)):(a=l,t.apply(s,i))}}function getUrl(e,t,s){var a=""+e+t+"?client_id="+AUTH_ID+"&client_secret="+AUTH_SECRET,n="redirect_uri="+encodeURIComponent(location.protocol+"//"+location.host+"/");return s?a+"&"+Object.keys(s).map((function(e){return e+"="+s[e]})).join("&")+"&"+n:a+(!1!==s?"&"+n:"")}var GISTS={BASE_URL:"https://github.com",API_URL:"https://api.github.com",loadFrom:function(e){var t=e.replace("#","").split("/");if(1===t.length)return Promise.resolve({files:{"schema.json":{content:decodeURIComponent(t[0])}}});var s=t[0],a=t[1];switch(s){case"gist":return fetch(getUrl(GISTS.API_URL,"/gists/"+a)).then((function(e){return e.json()}));case"uri":return Promise.resolve({files:{Example:{content:decodeURIComponent(a)}}});default:throw new Error("Unknown storage type")}},save:function(e){var t={};Object.keys(e).forEach((function(s){t[s]={content:e[s].value}}));var s=window.localStorage._AUTH;if(s){var a=getUrl(GISTS.API_URL,"/gists",!1);return fetch(""+PROXY_URL+a,{method:"POST",headers:{Authorization:"bearer "+s,Accept:"application/json"},body:JSON.stringify({description:"JSON Schema created by http://json-schema-faker.js.org",files:t})}).then((function(e){return e.json()})).then((function(e){if(e.message)throw new Error(e.message);return e}))}},auth:function(e,t){window.localStorage._AUTH="";var s=getUrl(GISTS.BASE_URL,"/login/oauth/access_token",{code:e});fetch(""+PROXY_URL+s,{method:"POST",headers:{Accept:"application/json"}}).then((function(e){return e.json()})).then((function(e){e.access_token&&(window.localStorage._AUTH=e.access_token,setTimeout(t,260))}))},url:function(){return getUrl(GISTS.BASE_URL,"/login/oauth/authorize",{scope:"gist"})}},script={props:["value","readonly"],data:()=>({yaml:!1}),mounted(){this.$e=ace.edit(this.$refs.editor),this.$e.setTheme("ace/theme/github"),this.$e.getSession().setTabSize(2),this.$e.setShowPrintMargin(!1),this.$e.$blockScrolling=Infinity,this._isWatching=!1,this._backupObj=null,this.change(this.value),this.setMode(),this.readonly?this.$e.setReadOnly(!0):this.$e.getSession().on("change",()=>{this._isWatching||this.change(this.$e.getValue())})},methods:{disable(){this.yaml=!1,this.setMode()},enable(){this.yaml=!0,this.setMode()},change(e){const t=this._backupObj;try{this.yaml?this._backupObj=YAML.parse(e)||this._backupObj:this._backupObj=JSON.parse(e)||this._backupObj}catch(s){}t!==this._backupObj&&this.$emit("change",{value:this._backupObj,source:e})},update(){this.value&&this.$e.setValue(this.yaml?YAML.dump(this._backupObj,6,2):JSON.stringify(this._backupObj,null,2))},setMode(){this.$e.getSession().setMode(`ace/mode/${this.yaml?"yaml":"json"}`),this.update()}},watch:{value(){this._isWatching=!0,this.change(this.value),this.update(),this._isWatching=!1}}};function normalizeComponent(e,t,s,a,n,i,o,l,u,r){"boolean"!=typeof o&&(u=l,l=o,o=!1);var c,d="function"==typeof s?s.options:s;if(e&&e.render&&(d.render=e.render,d.staticRenderFns=e.staticRenderFns,d._compiled=!0,n&&(d.functional=!0)),a&&(d._scopeId=a),i?(c=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),t&&t.call(this,u(e)),e&&e._registeredComponents&&e._registeredComponents.add(i)},d._ssrRegister=c):t&&(c=o?function(){t.call(this,r(this.$root.$options.shadowRoot))}:function(e){t.call(this,l(e))}),c)if(d.functional){var _=d.render;d.render=function(e,t){return c.call(t),_(e,t)}}else{var h=d.beforeCreate;d.beforeCreate=h?[].concat(h,c):[c]}return s}var normalizeComponent_1=normalizeComponent;const __vue_script__=script;var __vue_render__=function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{staticClass:"rel"},[s("div",{ref:"editor",staticClass:"AceEditor nosl f b"}),e.readonly?e._e():s("div",{staticClass:"abs t0 r0 z1 nosl"},[s("ul",{staticClass:"lr ln flx"},[s("li",{staticClass:"sp"},[s("a",{staticClass:"a","class":{"-on":!e.yaml},on:{click:e.disable}},[e._v("JSON")])]),s("li",{staticClass:"sp"},[s("a",{staticClass:"a","class":{"-on":e.yaml},on:{click:e.enable}},[e._v("YAML")])])])])])},__vue_staticRenderFns__=[];const __vue_inject_styles__=undefined,__vue_scope_id__=undefined,__vue_module_identifier__=undefined,__vue_is_functional_template__=!1;var JSONEditor=normalizeComponent_1({render:__vue_render__,staticRenderFns:__vue_staticRenderFns__},__vue_inject_styles__,__vue_script__,__vue_scope_id__,!1,__vue_module_identifier__,undefined,undefined),script$1={props:["value","tabindex","placeholder"],data:()=>({selectedValue:null}),methods:{onChange(){this.$emit("change",this.selectedValue)}}};const __vue_script__$1=script$1;var __vue_render__$1=function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{staticClass:"Dropdown f"},[s("select",{directives:[{name:"model",rawName:"v-model",value:e.selectedValue,expression:"selectedValue"}],staticClass:"a",attrs:{tabindex:e.tabindex},on:{change:[function(t){var s=[].filter.call(t.target.options,(function(e){return e.selected})).map((function(e){return"_value"in e?e._value:e.value}));e.selectedValue=t.target.multiple?s:s[0]},e.onChange]}},e._l(e.value,(function(t){return s("option",[e._v(e._s(t))])})),0),s("div",{staticClass:"Dropdown--arrow"}),s("div",{staticClass:"Dropdown--value nosl"},[s("span",{staticClass:"db tr"},[e._v(e._s(e.selectedValue||e.placeholder))])])])},__vue_staticRenderFns__$1=[];const __vue_inject_styles__$1=undefined,__vue_scope_id__$1=undefined,__vue_module_identifier__$1=undefined,__vue_is_functional_template__$1=!1;var SimpleDropdown=normalizeComponent_1({render:__vue_render__$1,staticRenderFns:__vue_staticRenderFns__$1},__vue_inject_styles__$1,__vue_script__$1,__vue_scope_id__$1,!1,__vue_module_identifier__$1,undefined,undefined),script$2={props:["value","tabindex","placeholder"],data:()=>({label:"",isNew:!1,hasChanged:!1,shouldUpdate:!1,canBeDeleted:!1,selectedValue:null}),methods:{change(){this.$emit("change",{setValues:this.value})},reset(){this.shouldUpdate=!0,this.canBeDeleted=!0,this.hasChanged=!1,this.isNew=!1,this.$refs.input.focus()},update(e){e&&(this.selectedValue=e)},inputValue(e){const t=e.target.value;if(!t)return void(this.shouldUpdate=!1);const s=-1===this.value.indexOf(t),a=this.selectedValue,n=t!==a;this.isNew=s,this.hasChanged=null!==a&&n,this.shouldUpdate=s||!1===n,this.canBeDeleted=!s&&null!==a},submitValue(e){switch(e.key){case"Enter":this.addValue();break;case"ArrowUp":if(!this.hasChanged){const e=this.value,t=e.indexOf(this.selectedValue);t>0?this.update(e[t-1]):this.update(e[e.length-1])}break;case"ArrowDown":if(!this.hasChanged){const e=this.value,t=e.indexOf(this.selectedValue);t<e.length-1?this.update(e[t+1]):this.update(e[0])}}},addValue(){this.$refs.input.value&&-1===this.value.indexOf(this.$refs.input.value)&&(this.$emit("change",{addValue:this.$refs.input.value}),this.selectedValue=this.$refs.input.value,this.value.push(this.$refs.input.value),this.reset(),this.change())},updateValue(){const e=this.selectedValue,t=this.$refs.input.value;this.value.forEach((s,a)=>{s===e&&(this.$emit("change",{updateValue:t,oldValue:e}),this.value[a]=t)}),this.reset(),this.change()},removeValue(){const e=this.value,t=e.indexOf(this.selectedValue);if(this.$emit("change",{removeValue:this.value.splice(t,1)}),this.reset(),this.change(),!e.length)return this.shouldUpdate=!1,this.selectedValue=null,this.$refs.input.value="",!1;t>0?this.update(e[t-1]):this.update(e[0])}},watch:{value(e){this.canBeDeleted=e.length>0,this.shouldUpdate=e.length>0,e.length&&!this.$refs.input.value&&(this.$refs.input.value=e[e.length-1],this.$refs.input.focus()),e.length||(this.$refs.input.value="")},selectedValue(e){e?(this.$emit("change",{selectedValue:e}),this.$refs.input.value=e,this.$refs.input.focus()):this.$refs.input.value=""}}};const __vue_script__$2=script$2;var __vue_render__$2=function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{staticClass:"Dropdown f"},[s("div",{staticClass:"Dropdown--arrow"}),s("select",{directives:[{name:"model",rawName:"v-model",value:e.selectedValue,expression:"selectedValue"}],staticClass:"a",attrs:{tabindex:"-1"},on:{change:function(t){var s=[].filter.call(t.target.options,(function(e){return e.selected})).map((function(e){return"_value"in e?e._value:e.value}));e.selectedValue=t.target.multiple?s:s[0]}}},e._l(e.value,(function(t){return s("option",[e._v(e._s(t))])})),0),s("div",{staticClass:"Dropdown--value nosl"},[s("input",{ref:"input","class":e.shouldUpdate&&{"-new":e.isNew,"-edit":e.hasChanged,"-remove":e.canBeDeleted},attrs:{tabindex:e.tabindex,placeholder:e.placeholder},on:{input:e.inputValue,keydown:e.submitValue}})]),s("div",{staticClass:"Dropdown--actions nosl","class":{"-show":e.shouldUpdate}},[e.isNew?s("a",{staticClass:"a tdn sp pd",attrs:{tabindex:"-1"},on:{click:e.addValue}},[e._v("Add")]):e._e(),e.hasChanged?s("a",{staticClass:"a tdn sp pd",attrs:{tabindex:"-1"},on:{click:e.updateValue}},[e._v("Update")]):e._e(),e.canBeDeleted?s("a",{staticClass:"a tdn sp pd",attrs:{tabindex:"-1"},on:{click:e.removeValue}},[e._v("Delete")]):e._e()])])},__vue_staticRenderFns__$2=[];const __vue_inject_styles__$2=undefined,__vue_scope_id__$2=undefined,__vue_module_identifier__$2=undefined,__vue_is_functional_template__$2=!1;var EditableDropdown=normalizeComponent_1({render:__vue_render__$2,staticRenderFns:__vue_staticRenderFns__$2},__vue_inject_styles__$2,__vue_script__$2,__vue_scope_id__$2,!1,__vue_module_identifier__$2,undefined,undefined),script$3={data:()=>({libInfo:null,hasValues:!1,showMessage:!1,logMessage:"",classes:"",inputJSON:"",outputJSON:"",savedSchemas:[],availableAssets:[]}),computed:{loggedIn:()=>"undefined"!=typeof window.localStorage._AUTH&&""!==window.localStorage._AUTH,availableVersions(){return this.libInfo?this.libInfo.files.map(e=>e.version):[]}},methods:{closeLog(){this.showMessage=!1},loginAction(){location.href=GISTS.url()},synchronizeGist(e){this.$emit("synchronizeGist",e)},generateOutput(e){this.$emit("generateOutput",e)},inputChange(e){this.$emit("inputChange",e)},setFile(e){this.$emit("setFile",e)},setVersion(e){this.availableAssets=this.libInfo?this.libInfo.files.filter(t=>t.version===e)[0].files.filter(e=>-1===e.indexOf(".min")):[],this.$refs.assets.selectedValue=this.availableAssets[0],this.$refs.versions.selectedValue=e,this.$emit("setVersion",e)},setPayload(e){this.$emit("setPayload",e)},logStatus(e,t){this.classes=t,this.logMessage=e,this.showMessage=!0,clearTimeout(this._timeout),this._timeout=setTimeout(()=>{this.showMessage=!1},5e3)}},components:{JSONEditor:JSONEditor,SimpleDropdown:SimpleDropdown,EditableDropdown:EditableDropdown}};const __vue_script__$3=script$3;var __vue_render__$3=function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{staticClass:"md-flx flx-m"},[s("div",{staticClass:"flx-a md-cl-6"},[s("div",{staticClass:"flx flx-m"},[s("div",{staticClass:"flx-a"},[s("EditableDropdown",{ref:"schemas",attrs:{value:e.savedSchemas,placeholder:"Schema identifier, e.g. User",tabindex:"1"},on:{change:e.setPayload}})],1),e.hasValues?s("div",{staticClass:"flx-ml"},[e.loggedIn?s("button",{staticClass:"a bu db nosl",attrs:{tabindex:"2"},on:{click:e.synchronizeGist}},[e._v("Save as gist")]):s("button",{staticClass:"a bu db nosl",on:{click:e.loginAction}},[e._v("GitHub login")])]):e._e()]),e.hasValues?s("div",{staticClass:"mt"},[s("JSONEditor",{attrs:{value:e.inputJSON},on:{change:e.inputChange}})],1):e._e()]),s("div",{staticClass:"flx-a md-cl-6"},[s("div",{staticClass:"sm-flx flx-m"},[e.hasValues?s("div",{staticClass:"flx-mt"},[s("button",{staticClass:"a f bu db cl-12 nosl",attrs:{tabindex:"5"},on:{click:e.generateOutput}},[e._v("Generate example")])]):e._e()]),e.hasValues?s("div",{staticClass:"mt"},[s("JSONEditor",{attrs:{value:e.outputJSON,readonly:"readonly"}})],1):e._e()]),s("div",{staticClass:"Toast","class":[e.classes,{"-show":e.showMessage}]},[s("div",{staticClass:"sm-flx flx-m flx-c"},[s("div",{staticClass:"flx-a"},[e._v(e._s(e.logMessage))]),e.hasValues?s("div",{staticClass:"flx-mr"},[s("button",{staticClass:"a f bu db cl-12 nosl",attrs:{tabindex:"6"},on:{click:e.closeLog}},[e._v("OK")])]):e._e()])])])},__vue_staticRenderFns__$3=[];const __vue_inject_styles__$3=undefined,__vue_scope_id__$3=undefined,__vue_module_identifier__$3=undefined,__vue_is_functional_template__$3=!1;var App=normalizeComponent_1({render:__vue_render__$3,staticRenderFns:__vue_staticRenderFns__$3},__vue_inject_styles__$3,__vue_script__$3,__vue_scope_id__$3,!1,__vue_module_identifier__$3,undefined,undefined);window.JSCOMPILER_PRESERVE=function(){return null};var _selected,_vm,_t,SETTINGS={},SCHEMAS={};function configureJSF(){window.jsf&&window.jsf.option&&window.jsf.option(SETTINGS)}function generateOutput(){if(window.jsf){var e=new Date,t=[];if(Object.keys(SCHEMAS).forEach((function(e){e!==_selected&&t.push(JSON.parse(SCHEMAS[e].value))})),SCHEMAS[_selected]){var s;try{s=JSON.parse(SCHEMAS[_selected].value)}catch(a){return void _vm.logStatus(a.message||a.toString(),["-error"])}_vm.$el.classList.add("-dis");(parseFloat(window.jsf.version)>=.5?function(){return(window.jsf.resolve||window.jsf)(s,t)}:function(){return new Promise((function(e,n){try{e((window.jsf.generate||window.jsf.sync||window.jsf)(s,t))}catch(a){n(a)}}))})().then((function(t){_vm.$el.classList.remove("-dis"),_vm.outputJSON=JSON.stringify(t,null,2),_vm.logStatus("Example generated in "+(new Date-e)/1e3+"s",["-success"])}))["catch"]((function(e){_vm.$el.classList.remove("-dis"),_vm.logStatus((e.message||e.toString()).substr(0,200),["-error"])}))}}else setTimeout(generateOutput,1e3)}function saveSession(){var e=new Date;window.localStorage._SCHEMAS=JSON.stringify(SCHEMAS),_vm.logStatus("Session saved in "+(new Date-e)/1e3+"ms",["-success"])}function loadSession(){var e=Object.keys(SCHEMAS);_vm.savedSchemas=e,_vm.hasValues=e.length>0,e.length&&(_selected=e[0],_vm.inputJSON=SCHEMAS[e[0]].value,_vm.$refs.schemas.selectedValue=_selected),_vm.$el.classList.remove("-dis")}function loadStorage(){if(window.localStorage._SCHEMAS){var e=JSON.parse(window.localStorage._SCHEMAS);Object.keys(e).forEach((function(t){SCHEMAS[t]=e[t]}))}loadSession()}function onHashChange(){if(_vm.$el.classList.add("-dis"),_vm.inputJSON="",_vm.savedSchemas=[],_vm.hasValues=!1,Object.keys(SCHEMAS).forEach((function(e){delete SCHEMAS[e]})),location.hash){location.hash.split("/")[2];GISTS.loadFrom(location.hash).then((function(e){Object.keys(e.files).forEach((function(t){SCHEMAS[t]={value:e.files[t].content}})),loadSession()}))["catch"]((function(e){_vm.$el.classList.remove("-dis"),_vm.logStatus(e.message||e.toString(),["-error"])}))}else loadStorage()}function onLoadEnd(e){jsf.extend&&(jsf.extend("faker",(function(){return window.faker})),jsf.extend("chance",(function(){return window.chance}))),_vm.logStatus("Loaded in "+(new Date-e)/1e3+"ms",["-success"]),configureJSF(),generateOutput()}function onScripts(){clearTimeout(_t),_t=setTimeout((function(){var e=new Date;window.jsf=window.JSONSchemaFaker||window.jsf,window.jsf._loaded=!0,delete window.JSONSchemaFaker,"undefined"!=typeof jsf?onLoadEnd(e):onScripts()}),1e3)}window.addEventListener("hashchange",onHashChange),document.body.addEventListener("change",(function(e){if(0===e.target.name.indexOf("jsfOptions.")){var t=e.target.name.replace("jsfOptions.","");"checkbox"===e.target.type?SETTINGS[e.target.name.substr(11)]=e.target.checked:"random"===t?SETTINGS.random=""!==e.target.value?function(){return parseFloat(e.target.value)}:Math.random:SETTINGS[e.target.name.substr(11)]=e.value}configureJSF(),generateOutput()}));var matches=location.search&&-1!==location.search.indexOf("code=")?location.search.match(/\bcode=([\w]{20})/)[1]:null;matches&&(window.history.replaceState(null,document.title,"/"),GISTS.auth(matches,(function(){_vm&&_vm.$forceUpdate()})));var Core={init:function(e){_vm=e,setTimeout((function(){onScripts(),onHashChange()}),200),_vm.logStatus("Application loaded in "+(new Date-TIME)/1e3+"ms",["-success"]),_vm.$on("generateOutput",throttle(200,(function(e){e.target.disabled=!0,generateOutput(),e.target.disabled=!1}))),_vm.$on("setPayload",(function(e){e.addValue&&(SCHEMAS[e.addValue]={value:["{",'  "id": "'+e.addValue+'"',"}"].join("\n")},saveSession(),_vm.outputJSON=""),e.setValues&&(_vm.hasValues=e.setValues.length>0,e.setValues.length||window.history.pushState(null,document.title,"")),e.selectedValue&&(_selected=e.selectedValue,_vm.outputJSON="",_vm.inputJSON=SCHEMAS[_selected].value,window.jsf&&window.jsf._loaded&&generateOutput()),e.updateValue&&(SCHEMAS[e.updateValue]=SCHEMAS[e.oldValue],SCHEMAS[e.updateValue].value=SCHEMAS[e.updateValue].value.replace(/"id"\s*:\s*"(\w+)"/g,(function(t,s){return s===e.oldValue?'"id": "'+e.updateValue+'"':t})),_vm.inputJSON=SCHEMAS[e.updateValue].value,delete SCHEMAS[e.oldValue],saveSession()),e.removeValue&&(delete SCHEMAS[e.removeValue],Object.keys(SCHEMAS).length||window.history.pushState(null,document.title,"#"),saveSession())})),_vm.$on("inputChange",debounce(200,(function(e){_selected&&e.value&&(SCHEMAS[_selected].value=JSON.stringify(e.value),generateOutput(),saveSession())}))),_vm.$on("synchronizeGist",(function(e){var t=new Date;return e.target.disabled=!0,_vm.$el.classList.add("-dis"),GISTS.save(SCHEMAS).then((function(s){e.target.disabled=!1,_vm.$el.classList.remove("-dis"),_vm.logStatus("Gist saved in "+(new Date-t)/1e3+"s",["-success"]),window.history.pushState(null,document.title,"#gist/"+s.id)}))["catch"]((function(t){e.target.disabled=!1,_vm.$el.classList.remove("-dis"),_vm.logStatus(t.message||t.toString(),["-error"])})),!1}))}},vm=new Vue({el:"#app",render:function(e){return e(App,{ref:"UI"})}});Core.init(vm.$refs.UI);
\ No newline at end of file