var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(d,n,h){d instanceof String&&(d=String(d));for(var t=d.length,p=0;p<t;p++){var x=d[p];if(n.call(h,x,p,d))return{i:p,v:x}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(d,n,h){d!=Array.prototype&&d!=Object.prototype&&(d[n]=h.value)};
$jscomp.getGlobal=function(d){return"undefined"!=typeof window&&window===d?d:"undefined"!=typeof global&&null!=global?global:d};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(d,n,h,t){if(n){h=$jscomp.global;d=d.split(".");for(t=0;t<d.length-1;t++){var p=d[t];p in h||(h[p]={});h=h[p]}d=d[d.length-1];t=h[d];n=n(t);n!=t&&null!=n&&$jscomp.defineProperty(h,d,{configurable:!0,writable:!0,value:n})}};
$jscomp.polyfill("Array.prototype.find",function(d){return d?d:function(d,h){return $jscomp.findInternal(this,d,h).v}},"es6","es3");$jscomp.polyfill("Object.is",function(d){return d?d:function(d,h){return d===h?0!==d||1/d===1/h:d!==d&&h!==h}},"es6","es3");$jscomp.polyfill("Array.prototype.includes",function(d){return d?d:function(d,h){var n=this;n instanceof String&&(n=String(n));var p=n.length;for(h=h||0;h<p;h++)if(n[h]==d||Object.is(n[h],d))return!0;return!1}},"es7","es3");
$jscomp.checkStringArgs=function(d,n,h){if(null==d)throw new TypeError("The 'this' value for String.prototype."+h+" must not be null or undefined");if(n instanceof RegExp)throw new TypeError("First argument to String.prototype."+h+" must not be a regular expression");return d+""};$jscomp.polyfill("String.prototype.includes",function(d){return d?d:function(d,h){return-1!==$jscomp.checkStringArgs(this,d,"includes").indexOf(d,h||0)}},"es6","es3");
$(function(){function d(){g.push("About this plugin");g.push(new k("name",f.fields.name,"Plugin Name","submit2-name",y({size:32},function(a,b,c){var e=this;this.locked?"undefined"!==typeof c&&c.preventDefault():(this.ajaxLock=a,this.invalid=!0,ajax("release.submit.validate.name",{data:{name:a},method:"POST",success:function(b){e.ajaxLock===a&&(e.invalid=!b.ok,e.reactInput(b.message,b.ok?"form-input-good":"form-input-error"))}}))}),function(){return{valid:!this.invalid,message:"Invalid plugin name: "+
this.$getRow().find(".form-input-react").text()}},!1,"submit"!==f.mode));g.push(new k("shortDesc",f.fields.shortDesc,"Synopsis","submit2-tagline",y({size:64,maxlength:128}),function(){var a=this.getValue();return{valid:a.length>=r.MIN_SHORT_DESC_LENGTH&&a.length<=r.MAX_SHORT_DESC_LENGTH,message:"The length of the synopsis must be within "+r.MIN_SHORT_DESC_LENGTH+" and "+r.MAX_SHORT_DESC_LENGTH+" characters"}}));getAdminLevel()>=PoggitConsts.AdminLevel.REVIEWER&&g.push(new k("official",f.fields.official,
"Official?","submit2-official",D,function(){return{valid:!0}}));g.push(F=new k("description",f.fields.description,"Description","submit2-description",G({cols:72,rows:15}),function(){return{valid:this.getValue().text.length>=r.MIN_DESCRIPTION_LENGTH,message:"The description must be at least "+r.MIN_DESCRIPTION_LENGTH+" characters long"}}));g.push("About this version");g.push(new k("version",f.fields.version,"Version","submit2-version",y({size:10,maxlength:16},function(a,b,c){var e=this;this.locked?
"undefined"!==typeof c&&c.preventDefault():ajax("release.submit.validate.version",{data:{version:a,projectId:f.buildInfo.projectId},method:"POST",success:function(a){e.invalid=!a.ok;e.reactInput(a.message,a.ok?"form-input-good":"form-input-error")}})}),function(){return{valid:!this.invalid,message:"Invalid plugin version: "+this.$getRow().find(".form-input-react").text()}},!0,"edit"===f.mode));g.push(new k("preRelease",f.fields.preRelease,"Pre-release?","submit2-prerelease",D,function(){return{valid:!0}}));
"edit"===f.mode&&g.push(new k("outdated",f.fields.outdated,"Outdated?","submit2-outdated",D,function(){return{valid:!0}}));"object"===typeof f.fields.changelog&&g.push(new k("changelog",f.fields.changelog,"What's New","submit2-changelog",G({cols:72,rows:8}),function(){return{valid:this.getValue().text.length>=r.MIN_CHANGELOG_LENGTH,message:"The changelog must be at least "+r.MIN_CHANGELOG_LENGTH+" characters long"}}));g.push("Help users find this plugin");g.push(new k("majorCategory",f.fields.majorCategory,
"Major Category","submit2-majorcat",I(f.consts.categories,{},function(a){var b=$("#submit2-minorcats").find(".cbinput");b.removeClass("submit-cb-disabled").children(".submit-cb").prop("disabled",!1);b.filter(function(){var b=this.getElementsByClassName("submit-cb");console.assert(1===b.length);return Number(b[0].value)===Number(a)}).addClass("submit-cb-disabled").find(".submit-cb").prop("disabled",!0)}),function(){return{valid:!0}}));g.push(new k("minorCategories",f.fields.minorCategories,"Minor Categories",
"submit2-minorcats",J(f.consts.categories),function(){return{valid:!0}}));g.push(new k("keywords",f.fields.keywords,"Keywords","submit2-keywords",y,function(){var a=this.getValue();if(a.split(" ").length>r.MAX_KEYWORD_COUNT)return{valid:!1,message:"Too many keywords! Only supply up to "+r.MAX_KEYWORD_COUNT+" keywords."};for(var b=0;b<a.length;++b)if(a[b].length>r.MAX_KEYWORD_LENGTH)return{valid:!1,message:'The keyword "'+a[b]+'" is too long. Each keyword should not have more than '+r.MAX_KEYWORD_LENGTH+
" characters."};return{valid:!0}}));g.push("About installation");g.push(new k("deps",f.fields.deps,"Dependencies","submit2-deps",K,function(){return{valid:!0}}));g.push(new k("requires",f.fields.reqrs,"Manual Setup","submit2-requires",L,function(){return{valid:!0}}));g.push(new k("spoons",f.fields.spoons,"Supported APIs","submit2-spoons",M,function(){return{valid:1<=this.getValue().length,message:"There must be at least one supported API version range!"}},!0,"edit"===f.mode&&0!==f.refRelease.state));
g.push("Plugin association");g.push(new k("assocParent",f.fields.assocParent,"Associate Release of:","submit2-assoc-parent",N,function(){return{valid:!0}}));0<f.assocChildren.length&&g.push(new k("assocChildrenUpdates",f.fields.assocChildren,"Children Associate Releases","submit2-assoc-children-updates",H(f.assocChildren,!0),function(){return{valid:!0}}));g.push("Other details");g.push(new k("license",f.fields.license,"License","submit2-license",O,function(){return null!==this.getValue().custom&&
200>this.getValue().custom.length?{valid:!1,message:"The custom license must be a open source license, and the full text is required."}:null===this.getValue().type?{valid:!1,message:"A license is required before it can be submitted."}:{valid:!0}}));g.push(new k("perms",f.fields.perms,"Permissions","submit2-perms",H(f.consts.perms,!0),function(){return{valid:!0}}));g.push(E=new k("authors",f.fields.authors,"Producers","submit2-authors",P,function(){return{valid:this.getValue().length>=E.type.minRows,
message:"There must be at least 1 producer!"}}));t(F);setTimeout(p,500,E);var a=$(".form-table");a.empty();for(var b=0;b<g.length;++b)g[b].constructor===String?$("<div class='form-subtitle'></div>").append($("<span></span>").text(g[b])).appendTo(a):g[b].constructor===k&&g[b].appendTo(a);for(b=0;b<g.length;++b)g[b].constructor===k&&g[b].setDefaults();$("#submit2-assoc-children-updates").find("input.submit-cb").prop("checked",!0);a.append($("<div class='form-row'></div>").append("<div class='form-key'>Icon</div>").append($("<div class='form-value'></div>").html(f.icon.html)).append($("<div class='form-icon-preview'></div>").append($("<img/>").attr("src",
null===f.icon.url?getRelativeRootPath()+"res/defaultPluginIcon2.png":f.icon.url))));b=$("<div class='submit-buttons'></div>");var c=null,l=null;"edit"!==f.mode?(c=null!==f.last?"Submit Update":"Submit Plugin",l="Save as Draft"):0===f.refRelease.state?(c=null!==f.last?"Submit Update from Draft":"Submit Plugin from Draft",l="Save Edit"):2===f.refRelease.state?(c="Save Edit",l="Restore to Draft"):c="Save Edit";null!==c&&b.append($("<span class='action-red'></span>").text(c).click(function(){n("submit")}));
null!==l&&b.append($("<span class='action-red'></span>").text(l).click(function(){n("draft")}));b.appendTo(a)}function n(a){var b=!1;$(".submit-deps-version").each(function(){"undefined"===typeof $(this).attr("data-relid")&&(alert("You haven't selected the version in one of the dependencies yet!"),b=!0)});if(!b)if(0<$("#submit-assoc-parent-name").val().length&&"undefined"===typeof $("#submit-assoc-parent-version").attr("data-relid"))alert("You haven't selected the version for the associate release parent yet!");
else{var c=$("#wait-spinner");c.modal();for(var l=0;l<g.length;++l)if(g[l].constructor===k&&!g[l].locked){var e=g[l].validator.call(g[l]);if(!e.valid){c.modal("hide");if("submit"===a){alert("Cannot submit due to a problem in "+g[l].name+":\n\n"+e.message);return}if(!confirm("Warning: This plugin cannot be submitted due to a problem in "+g[l].name+":\n\n"+e.message+"\n\nDo you still want to save this draft?"))return}}a={form:x(),action:a,submitFormToken:f.submitFormToken};ajax("submit.new.ajax",{method:"POST",
data:JSON.stringify(a),success:function(a){a.status?(z=!1,window.location.assign(a.link)):(c.modal("hide"),alert(a.error))},error:function(a){c.modal("hide");a=JSON.parse(a.responseText);alert(a.error)}})}}function h(a,b){if("object"===typeof b)for(var c in b)b.hasOwnProperty(c)&&("boolean"===typeof b[c]?a.prop(c,b[c]):a.attr(c,b[c]))}function t(a){ghApi("search/code?q="+encodeURIComponent("readme in:path repo:"+f.repoInfo.full_name),{},"GET",function(b){b=b.items;var c=f.buildInfo.path;b.sort(function(a,
b){var e=a.path.substring(0,c.length)===c,l=b.path.substring(0,c.length)===c;return e&&l?Math.compare(a.path.length,b.path.length):e!==l?e?-1:1:a.path===a.name?-1:b.path===b.name?1:a.path.localeCompare(b.path)});for(var l=a.$getRow(),e=0;e<b.length;++e){var q=l.find(".form-value-defaults"),v=$("<span class='action form-value-import'></span>");v.text("Import from "+b[e].path);v.click(function(a){return function(){$.get("https://raw.githubusercontent.com/"+f.repoInfo.full_name+"/"+f.repoInfo.default_branch+
"/"+a.path,{},function(a){l.find(".submit-hybrid-content").val(a);l.find(".submit-hybrid-format").val("sm")})}}(b[e]));v.appendTo(q)}})}function p(a){var b=a.$getRow().find(".submit-tableentry-row");b.each(function(){var a=$(this),l=a.find(".submit-authors-name");if(a.prop("data-changed")||a.prop("data-duplicated")){var e=a.find(".submit-authors-name-react"),q=l.val();a.prop("data-changed",!1).prop("data-duplicated",!1);var f=a.find(".submit-authors-avatar");f.attr("src",getRelativeRootPath()+"res/ghMark.png");
e.removeClass("form-input-good form-input-error").html("&nbsp;");if(1<b.find(".submit-authors-name").filter(function(){return this.value.toLowerCase()===q.toLowerCase()}).length)e.addClass("form-input-error").html("&cross; Duplicated producer"),a.prop("data-duplicated",!0);else if(/^[a-z\d](?:[a-z\d]|-(?=[a-z\d])){0,38}$/i.test(q)){var d=q.toLowerCase();a.attr("data-lock",d);ghApi("users/"+q,{},"GET",function(b){a.attr("data-lock")===d&&("undefined"!==typeof b.avatar_url?"User"!==b.type?e.addClass("form-input-error").html("&cross; Only users can be added as producers. @"+
q+" is an "+b.type.toLowerCase()+"."):(f.attr("src",b.avatar_url),e.addClass("form-input-good").html("&checkmark; Found user"+(null!==b.name?" ("+b.name+")":"")),a.attr("data-uid",b.id)):e.addClass("form-input-error").html("&cross; @"+q+" was not registered on GitHub!"))})}else e.addClass("form-input-error").html("&cross; Invalid username")}});setTimeout(p,500,a)}function x(){for(var a={},b=0;b<g.length;++b)if(g[b].constructor===k&&!g[b].locked){var c=g[b].getValue();null!==c&&(a[g[b].submitKey]=
c)}return a}function k(a,b,c,l,e,q,v,d){"function"===typeof e&&(e=e());console.assert("function"===typeof e.appender);console.assert("function"===typeof e.getter);console.assert("function"===typeof e.setter);console.assert("boolean"===typeof e.afterRemarks);console.assert("function"===typeof q);this.type=e;this.validator=q;this.id=l;this.submitKey=a;this.name=c;this.rem=b.remarks;this.refDefault=b.refDefault;this.srcDefault=b.srcDefault;this.prefSrc="edit"===f.mode?!1:"undefined"===typeof v?!1:v;
this.locked="undefined"===typeof d?!1:d;this.isThisFirstEntry=this.constructor.isNextFirstEntry;this.constructor.isNextFirstEntry=!1}function y(a,b){return{appender:function(c){var l=this,e=$("<input/>");e.addClass("submit-textinput");this.locked&&e.prop("disabled",!0);h(e,a);if("function"===typeof b)e.on("input",function(a){a=b.call(l,e.val(),e,a);"string"===typeof a&&e.val(a)});e.appendTo(c)},getter:function(){return this.$getRow().find(".submit-textinput").val()},setter:function(a){var c=this.$getRow().find(".submit-textinput");
c.val(a);"function"===typeof b&&b.call(this,a,c,void 0)},afterRemarks:!1}}function D(a){return{appender:function(b){var c=$("<input type='checkbox'/>");c.addClass("submit-checkinput");this.locked&&c.prop("disabled",!0);h(c,a);c.appendTo(b)},getter:function(){return this.$getRow().find(".submit-checkinput").prop("checked")},setter:function(a){this.$getRow().find(".submit-checkinput").prop("checked",a)},afterRemarks:!1}}function G(a){return{appender:function(b){var c=$("<textarea class='submit-hybrid-content'></textarea>");
this.locked&&c.prop("disabled",!0);h(c,a);c.appendTo(b);c="https://github.com/"+f.repoInfo.full_name+"/tree/"+f.buildInfo.sha.substring(0,7)+"/";$("<div></div>").append("<label style='padding: 5px;'>Format:</label>").append($("<select class='submit-hybrid-format' style='display: inline-flex;'></select>").append($("<option value='txt'>Plain Text (You may indent with spaces)</option>")).append($("<option value='sm'></option>").text("Standard Markdown (rendered like README, links relative to "+c+")")).append($("<option value='gfm'></option>").text("GFM (rendered like issue comments, links relative to "+
c+")"))).appendTo(b)},getter:function(){var a=this.$getRow();return{text:a.find(".submit-hybrid-content").val(),type:a.find(".submit-hybrid-format").val()}},setter:function(a){var b=this.$getRow();b.find(".submit-hybrid-content").val(a.text);b.find(".submit-hybrid-format").val(a.type)},noDefaults:function(){this.$getRow().find(".submit-hybrid-format").val("sm")},afterRemarks:!1}}function O(){var a={},b=function(){var a=$("<div id='licenseViewDialog'></div>"),b=$("<div id='licenseDialogLoading'></div>").css("font-size",
"x-large").text("Loading..."),e=$("<div id='licenseDialogInner' autofocus></div>").css("display","none");b.appendTo(a);e.appendTo(a);var q=$("<p id='licenseDescription'></p>");q.appendTo(e);var f=$("<div id='licenseMetaDiv'></div>").css("display","flex"),d={permissions:"Permissions",conditions:"Conditions",limitations:"Limitations"},g={};for(w in d)if(d.hasOwnProperty(w)){var h=$("<div class='license-metadata'></div>");$("<div></div>").css("font-weight","bold").text(d[w]).appendTo(h);var k=$("<ul></ul>");
g[w]=k;k.appendTo(h);h.appendTo(f)}f.appendTo(e);var w=$("<pre></pre>");w.appendTo(e);a.dialog({autoOpen:!1,width:Math.min(.8*window.innerWidth,600),modal:!0,height:.8*window.innerHeight,position:modalPosition,open:function(a,b){$(".ui-widget-overlay").bind("click",function(){$("#licenseViewDialog").dialog("close")})}});return{dialogDiv:a,innerLoadingDiv:b,innerDialogDiv:e,ulNames:d,ulList:f,description:q,metadataUls:g,bodyPre:w}};return{appender:function(c){var l=this;this.ready=!1;var e=$("<select></select>").addClass("submit-license-type").append($("<optgroup label='Special'></optgroup>").append($("<option></option>").text("Custom License").attr("value",
"custom")));var q=$("<optgroup></optgroup>").attr("label","Featured");q.appendTo(e);var f=$("<optgroup></optgroup>").attr("label","Others");f.appendTo(e);e.change(function(){d.css("display","custom"===e.val()?"block":"none");var a="none"===e.val()||"custom"===e.val();h.hasClass("disabled")!==a&&(a?h.addClass("disabled"):h.removeClass("disabled"))}).appendTo(c);var d=$("<textarea></textarea>").addClass("submit-license-custom").css("display","none").appendTo(c);var g=b();var h=$("<span></span>").addClass("action disabled").attr("id",
"licenseView").text("View license details").click(function(){var b=e.val();void 0!==a[b]&&(b=a[b],g.dialogDiv.dialog("option","title",b.name),g.dialogDiv.dialog("open"),g.innerLoadingDiv.css("display","block"),g.innerDialogDiv.css("display","none"),ghApi("licenses/"+b.key,{},"GET",function(a){g.description.text(a.description);for(var b in g.ulNames){var c=g.metadataUls[b],e=a[b];c.empty();for(var l=0;l<e.length;++l)$("<li></li>").text(e[l]).appendTo(c)}g.bodyPre.text(a.body);g.innerLoadingDiv.css("display",
"none");g.innerDialogDiv.css("display","block")},void 0,"Accept: application/vnd.github.drax-preview+json"))}).appendTo(c);ghApi("licenses",{},"GET",function(b){b.sort(function(a,b){return a.name.localeCompare(b.name)});for(var c=0;c<b.length;c++){var d=$("<option></option>");d.attr("value",b[c].key);d.attr("data-url",b[c].url);d.text(b[c].name);a[b[c].key]=b[c];"undefined"!==typeof l.wannaSet&&b[c].key===l.wannaSet.type&&(d.prop("selected",!0),h.removeClass("disabled"));d.appendTo(b[c].featured?
q:f)}l.ready=!0;"undefined"!==typeof l.wannaSet&&e.val(l.wannaSet.type)},void 0,"Accept: application/vnd.github.drax-preview+json")},getter:function(){if(!this.ready)return this.wannaSet;var a=this.$getRow(),b=a.find(".submit-license-type").val();return{type:b,custom:"custom"===b?a.find(".submit-license-custom").val():null}},setter:function(a){if(this.ready||"custom"===a.type||"none"===a.type){var b=this.$getRow();b.find(".submit-license-type").val(a.type);"custom"===a.type&&b.find(".submit-license-custom").val(a.custom)}else this.wannaSet=
a},afterRemarks:!1}}function I(a,b,c){return{appender:function(l){var e=this,f=$("<select></select>");f.addClass("submit-selinput");this.locked&&f.prop("disabled",!0);for(var d in a)if(a.hasOwnProperty(d)){var g=$("<option></option>");g.attr("value",d);g.text(a[d]);g.appendTo(f)}h(f,b);"function"===typeof c&&f.change(function(a){a=c.call(e,f.val(),f,a);"string"===typeof a&&f.val(a)});f.appendTo(l)},getter:function(){return this.$getRow().find(".submit-selinput").val()},setter:function(a){this.$getRow().find(".submit-selinput").val(a);
"function"===typeof c&&c.call(this,a)},noDefaults:function(){"function"===typeof c&&c.call(this,this.$getRow().find(".submit-selinput").val())},afterRemarks:!1}}function J(a,b,c,f){return{appender:function(e){var l=$("<div></div>");l.addClass("submit-cbgrp-compact");for(var d in a)if(a.hasOwnProperty(d)){var g=$("<div class='cbinput'></div>"),k=$("<input type='checkbox'/>");k.addClass("submit-cb");k.attr("value",d);k.appendTo(g);g.append(a[d]);g.appendTo(l);this.locked&&k.prop("disabled",!0);h(k,
b);h(g,c)}h(l,f);l.appendTo(e)},getter:function(){return this.$getRow().find(".submit-cb:checked").map(function(){return this.value}).get()},setter:function(a){this.$getRow().find(".submit-cb").not(".submit-cb-disabled").each(function(){this.checked=a.map(String).includes(this.value)})},afterRemarks:!1}}function H(a,b){return{afterRemarks:b,appender:function(b){var c=$("<div></div>");c.addClass("submit-expcb-wrapper");for(var e in a)if(a.hasOwnProperty(e)){var f=$("<div></div>").addClass("submit-expcb-row"),
d=$("<div></div>").addClass("cbinput"),g=$("<input type='checkbox'/>").addClass("submit-cb").attr("value",e);g.appendTo(d);this.locked&&g.prop("disabled",!0);d.append("<div class='cblabel'>"+a[e].name+"</div>");d.appendTo(f);$("<div></div>").addClass("remark").text(a[e].description).appendTo(f);f.appendTo(c)}c.appendTo(b)},getter:function(){return this.$getRow().find(".submit-cb:checked").map(function(){return this.value}).get()},setter:function(a){this.$getRow().find(".submit-cb").not(".submit-cb-disabled").each(function(){this.checked=
a.map(String).includes(this.value)})}}}function A(a,b,c,f,e){function d(a,c){var f=$("<tr class='submit-tableentry-row'></tr>");b(f,c);c.locked||(c=$("<td></td>"),$("<span class='action-red'>&cross;</span>").click(function(){a.find(".submit-tableentry-row").length<=e?alert("There must be at least "+e+" rows!"):f.remove()}).appendTo(c),c.appendTo(f));f.appendTo(a);return f}"undefined"===typeof e&&(e=0);return{appender:function(b){var c=$("<table class='submit-tableentry-table'></table>");a(c);for(var f=
0;f<e;++f)d(c,this);c.appendTo(b);this.locked||$("<span class='action'>&plus;</span>").click(function(){d(c,this)}).appendTo(b)},getter:function(){var a=[];this.$getRow().find(".submit-tableentry-row").each(function(){var b=c($(this));null!==b&&a.push(b)});return a},setter:function(a){console.assert(a.constructor===Array,"values passed for "+this.name+" is not array but ",a);var b=this.$getRow().find(".submit-tableentry-table");b.children(".submit-tableentry-row").remove();for(var c=0;c<a.length;++c){var e=
d(b,this);f(e,a[c])}},minRows:e,afterRemarks:!1}}function P(){return A(function(a){$("<tr class='submit-authors-row-default'></tr>").append($("<th>GitHub username</th>").css("width","200px")).append("<th>Type</th>").appendTo(a)},function(a){$("<td class='submit-authors-user-cell'></td>").append($("<img height='28' class='submit-authors-avatar'/>").attr("src",getRelativeRootPath()+"res/ghMark.png")).append($("<input class='submit-authors-name' size='15'/>").on("input",function(){a.prop("data-changed",
!0);a.removeAttr("data-uid")})).append($("<div class='submit-authors-name-react'>&nbsp;</div>")).appendTo(a);var b=$("<select class='submit-authors-level'></select>"),c;for(c in f.consts.authors)if(f.consts.authors.hasOwnProperty(c)){var d=f.consts.authors[c];$("<option></option>").attr("value",c).text(d).appendTo(b)}$("<td class='submit-authors-level-cell'></td>").append(b).appendTo(a)},function(a){return"undefined"===typeof a.attr("data-uid")?null:a.find(".submit-authors-name-react").hasClass("form-input-good")?
{uid:a.attr("data-uid"),name:a.find(".submit-authors-name").val(),level:a.find(".submit-authors-level").val()}:null},function(a,b){if(b.uid===f.repoInfo.owner.id){a.attr("data-lock",b.name);a.attr("data-uid",b.uid);a.prop("data-changed",!1);var c=a.find(".submit-authors-name");c.val(b.name);c.prop("disabled",!0);c=a.find(".submit-authors-level");c.val(b.level);c.prop("disabled",!0);a.find(".submit-authors-avatar").attr("src",f.repoInfo.owner.avatar_url);a.find(".action-red").remove();a.find(".submit-authors-name-react").addClass("form-input-good").html("The repo owner is an explicit collaborator")}else a.attr("data-uid",
b.uid),a.prop("data-changed",!0),a.find(".submit-authors-name").val(b.name),a.find(".submit-authors-level").val(b.level)},1)}function M(){function a(a){for(var b in f.consts.spoons)f.consts.spoons.hasOwnProperty(b)&&$("<option></option>").addClass("submit-spoons-option").attr("value",b).text(b).appendTo(a)}return A($.noop,function(b,c){var d=$("<select class='submit-spoons-start'></select>"),e=$("<select class='submit-spoons-end'></select>");c.locked&&(d.prop("disabled",!0),e.prop("disabled",!0));
var g=f.consts.spoons,h=Object.sizeof(g),k=Object.keysToArray(g),m=Object.valuesToArray(g);a(d);a(e);var n=d.children("option"),p=e.children("option");d.change(function(){var a=k.indexOf(this.value),b=e.val(),c=k.indexOf(b);p.prop("disabled",!1);p.slice(0,a).prop("disabled",!0);for(var f=a;f<h;++f)h===f+1||m[f+1].incompatible?p.eq(f).prop("disabled",!1):p.eq(f).prop("disabled",!0);c<a&&(c=a);if(c+1<g.length&&!m[c+1].incompatible){for(a=c+1;a<h;++a)if(a+1===h||m[a+1].incompatible){c=a;break}console.assert(c===
a);b=k[b];e.val(b);e.change()}});e.change(function(){var a=k.indexOf(d.val()),b=k.indexOf(e.val());n.slice(0,b+1).prop("disabled",!1);n.slice(b+1).prop("disabled",!0);a>b&&d.val(k[b])});d.val(f.consts.promotedSpoon);e.val(Object.keysToArray(f.consts.spoons).slice(-1)[0]);d.wrap("<td></td>").parent().appendTo(b);b.append("<td>&mdash;</td>");e.wrap("<td></td>").parent().appendTo(b)},function(a){return[a.find(".submit-spoons-start").val(),a.find(".submit-spoons-end").val()]},function(a,c){var b=a.find(".submit-spoons-start").val(c[0]);
a=a.find(".submit-spoons-end").val(c[1]);b.change();a.change()},1)}function L(){return A(function(a){$("<tr></tr>").append($("<th>Required?</th>").css("width","150px")).append($("<th>Type</th>").css("width","250px")).append($("<th>Details</th>").css("width","500px")).appendTo(a)},function(a){var b=$("<select class='submit-requires-type'></select>"),c=$("<input class='submit-requires-details'/>").attr("size",50),d;for(d in f.consts.reqrs)if(f.consts.reqrs.hasOwnProperty(d)){var e=f.consts.reqrs[d].name;
$("<option></option>").attr("value",d).text(e).appendTo(b)}b.change(function(){c.attr("placeholder",f.consts.reqrs[this.value].details)}).change();a.append($("<select class='submit-requires-isrequire'></select>").append("<option value='require'>Requirement</option>").append("<option value='enhance'>Enhancement</option>").wrap("<td></td>").parent()).append(b.wrap("<td></td>").parent()).append(c.wrap("<td></td>").parent())},function(a){return{type:a.find(".submit-requires-type").val(),details:a.find(".submit-requires-details").val(),
isRequire:"require"===a.find(".submit-requires-isrequire").val()}},function(a,b){a.find(".submit-requires-type").val(b.type).change();a.find(".submit-requires-details").val(b.details);a.find(".submit-requires-isrequire").val(b.isRequire?"require":"enhance")})}function K(){return A(function(a){$("<tr></tr>").append($("<th>Required?</th>").css("width","100px")).append($("<th>Plugin Name</th>").css("width","200px")).append($("<th>Version</th>")).appendTo(a)},function(a){var b=$("<input class='submit-deps-name' size='15'/>"),
c=$("<span class='submit-deps-version action'>Choose a version...</span>");b.change(function(){c.text("Choose a version").removeAttr("data-relid")});c.click(function(){B=c;var a=u=Math.random(),e=b.val();m.dialog.dialog("option","title",'Choose a version of "'+b.val()+'"');m.loading.css("display","block");m.error.css("display","none");m.inner.css("display","none");m.dialog.dialog("open");ajax("submit.deps.getversions",{data:{name:e,owner:"false"},success:function(b){if(a===u)if(0===Object.sizeof(b))m.loading.css("display",
"none"),m.error.text("There aren't any submitted (and not rejected) plugins on Poggit called "+e).css("display","block");else{m.loading.css("display","none");C=b;m.table.find("tr.submit-deps-version-select-row").remove();m.table.find("tr.submit-deps-version-header").remove();for(var c in b)if(b.hasOwnProperty(c)){var f=$("<span></span>").attr("data-timestamp",b[c].submitTime);timeTextFunc.call(f.get()[0]);m.table.prepend($("<tr></tr>").addClass("submit-deps-version-select-row").append($("<td></td>").append($("<input type='radio'/>").addClass("submit-dep-dialog-version-radio").attr("name",
u).attr("data-value",c).prop("checked",!0)).append($("<label></label>").text(b[c].version))).append($("<td></td>").append($("<input type='checkbox' disabled/>").prop("checked",b[c].preRelease))).append($("<td></td>").append(b[c].stateName)).append($("<td></td>").append(f)))}m.table.prepend("<tr class='submit-deps-version-header'><th>Version</th><th>Pre-release</th><th>Status</th><th>Submitted</th></tr>");m.inner.css("display","block")}}})});a.append($("<select class='submit-deps-required'></select>").append("<option value='required'>Required</option>").append("<option value='optional'>Optional</option>").wrap("<td></td>").parent()).append(b.wrap("<td></td>").parent()).append(c.wrap("<td></td>").parent())},
function(a){var b=a.find("span.submit-deps-version");return"undefined"===typeof b.attr("data-relid")?null:{name:a.find("input.submit-deps-name").val(),version:b.attr("data-version"),depRelId:Number(b.attr("data-relid")),required:"required"===a.find("select.submit-deps-required").val()}},function(a,b){a.find("input.submit-deps-name").val(b.name);a.find("span.submit-deps-version").text("Change: v"+b.version).attr("data-version",b.version).attr("data-relid",b.depRelId);a.find("select.submit-deps-required").val(b.required?
"required":"optional")})}function N(){return{afterRemarks:!0,appender:function(a){var b=$("<input id='submit-assoc-parent-name' size='15' placeholder='Plugin Name'/>"),c=$("<span id='submit-assoc-parent-version' class='action'>Choose a version...</span>");b.change(function(){c.text("Choose a version").removeAttr("data-relid")});c.click(function(){b.css("border","");if(3>b.val().length)b.css("border","1px solid red");else{var a=u=Math.random();B=c;var e=b.val();m.dialog.dialog("option","title",'Choose a version of "'+
b.val()+'"');m.loading.css("display","block");m.error.css("display","none");m.inner.css("display","none");m.dialog.dialog("open");ajax("submit.deps.getversions",{data:{name:e,owner:"true"},success:function(b){if(a===u)if(0===Object.sizeof(b))m.loading.css("display","none"),m.error.text("You do not own any submitted (and not rejected) plugins on Poggit called "+e).css("display","block");else{m.loading.css("display","none");C=b;m.table.find("tr.submit-deps-version-select-row").remove();m.table.find("tr.submit-deps-version-header").remove();
for(var c in b)if(b.hasOwnProperty(c)){var f=$("<span></span>").attr("data-timestamp",b[c].submitTime);timeTextFunc.call(f.get()[0]);m.table.prepend($("<tr></tr>").addClass("submit-deps-version-select-row").append($("<td></td>").append($("<input type='radio'/>").addClass("submit-dep-dialog-version-radio").attr("name",u).attr("data-value",c).prop("checked",!0)).append($("<label></label>").text(b[c].version))).append($("<td></td>").append($("<input type='checkbox' disabled/>").prop("checked",b[c].preRelease))).append($("<td></td>").append(b[c].stateName)).append($("<td></td>").append(f)))}m.table.prepend("<tr class='submit-deps-version-header'><th>Version</th><th>Pre-release</th><th>Status</th><th>Submitted</th></tr>");
m.inner.css("display","block")}}})}});$("<div></div>").css("display","flex").append(b).append(c).appendTo(a)},getter:function(){var a=this.$getRow().find("#submit-assoc-parent-version");return"undefined"===typeof a.attr("data-relid")?null:{releaseId:Number(a.attr("data-relid")),name:this.$getRow().find("submit-assoc-parent-name").val(),version:a.attr("data-version")}},setter:function(a){null!==a&&null!==a.version&&($("#submit-assoc-parent-version").text("Change: v"+a.version).attr("data-version",
a.version).attr("data-relid",a.releaseId),$("#submit-assoc-parent-name").val(a.name))}}}var g=[],r=PoggitConsts.Config,F,E,f,z=!1;$(window).bind("beforeunload",function(){return z?"Changes will not be saved":void 0});ajax("submit.form",{data:{query:window.location.pathname.substr(getRelativeRootPath().length)},success:function(a){if("error/redirect"===a.action)window.location.replace(a.target),null!==a.message&&alert(a.message);else{var b=$("#body");if("error/bad_query"===a.action)b.html("<h1>400 Bad Request</h1>"),
a.text?$("<p></p>").text(a.message).appendTo(b):b.append("<p>"+a.message+"</p>");else if("error/access_denied"===a.action)b.html("<h1>401 Access Denied</h1>"),a.text?$("<p></p>").text("Details: "+a.message).appendTo(b):b.append("<p>Details:&nbsp;"+a.message+"</p>");else if("error/not_found"===a.action)b.html("<h1>404 Not Found</h1>"),a.text?$("<p></p>").text(a.message).appendTo(b):b.append("<p>"+a.message+"</p>");else if("success"!==a.action)alert("The server returns an unknown result! Please copy (or screenshot) the following data:\n\n"+
JSON.stringify(a));else{f=a.submitData;b=a.submitData.last;document.title=a.title;document.getElementById("submit-title-action").innerHTML=a.actionTitle;generateGhLink(a.treeLink).appendTo(document.getElementById("submit-title-gh"));a=f.args.slice(0,3).join("/");$("<a class='colorless-link' target='_blank'></a>").attr("href",getRelativeRootPath()+"ci/"+a).append($("<img/>").attr("src",getRelativeRootPath()+"ci.badge/"+a+"?build="+f.args[3])).appendTo(document.getElementById("submit-title-badge"));
if(null!=b){var c=document.getElementById("submit-intro-last-name");$("<h5></h5>").text("Updates v"+b.version).append($("<sub></sub>").append($("<a class='colorless-link' target='_blank'></a>").attr("href",getRelativeRootPath()+"ci/"+a+"/"+b.internal).text("Dev Build #"+b.internal+" (&"+b.buildId+")"))).appendTo(c);c.style.display="block"}d();z=!0}}},error:function(a){a=a.getResponseHeader("X-Poggit-Request-ID");z=!1;window.location.replace(getRelativeRootPath()+"500ise.template?id="+a)}});k.isNextFirstEntry=
!0;k.prototype.$getRow=function(){return $(document.getElementById(this.id))};k.prototype.appendTo=function(a){var b=this,c=$("<div class='form-row'></div>").attr("id",this.id);$("<div class='form-key'></div>").text(this.name).appendTo(c);var d=$("<span></span>").addClass("explain").html(this.rem),e=$("<div class='form-value'></div>");this.type.afterRemarks?(d.addClass("explain-before-input").appendTo(e),this.type.appender.call(this,e)):(this.type.appender.call(this,e),d.addClass("explain-after-input").appendTo(e));
e.appendTo(c);$("<div class='form-input-react'></div>").appendTo(e);if(!this.locked){d=$("<div class='form-value-defaults'></div>");var g=e=null;null!==this.refDefault&&(e=$("<span class='action form-value-import'></span>").text("edit"===f.mode?"Reset":this.isThisFirstEntry?"Copy from last release":"Copy"),e.click(function(){b.type.setter.call(b,b.refDefault)}));null!==this.srcDefault&&(g=$("<span class='action form-value-import'></span>").text(this.isThisFirstEntry?"Detect from code":"Detect"),g.click(function(){b.type.setter.call(b,
b.srcDefault)}));this.prefSrc?(null!==g&&g.appendTo(d),null!==e&&e.appendTo(d)):(null!==e&&e.appendTo(d),null!==g&&g.appendTo(d));d.appendTo(c)}c.appendTo(a)};k.prototype.setDefaults=function(){if(this.prefSrc)if(null!==this.srcDefault)var a=this.srcDefault;else null!==this.refDefault&&(a=this.refDefault);else null!==this.refDefault?a=this.refDefault:null!==this.srcDefault&&(a=this.srcDefault);void 0!==a?this.type.setter.call(this,a):"function"===typeof this.type.noDefaults&&this.type.noDefaults.call(this)};
k.prototype.reactInput=function(a,b){var c=this.$getRow().find(".form-input-react");c.html(a);if("object"===typeof this.classes&&this.classes.constructor===Array)for(a=0;a<this.classes.length;++a)c.removeClass(this.classes[a]);this.classes=[];if("string"===typeof b)this.classes.push(b),c.addClass(b);else if("object"===typeof b&&b.constructor===Array)for(a=0;a<b.length;++a)this.classes.push(b[a]),c.addClass(b[a])};k.prototype.getValue=function(){return this.locked?null:this.type.getter.call(this)};
k.prototype.isValid=function(){return this.validator.call(this)};var B,u,C,m=function(){var a=$("<div id='depSelectDialog'></div>"),b=$("<div></div>").css("font-size","x-large").text("Loading versions..."),c=$("<div></div>").addClass("fallback-error"),d=$("<div></div>");d.append("<p>Select the <strong>recommended</strong> version of the dependency plugin, usually the <em>latest</em> version. You don't need to select older versions; if you want to, mention it in the Description.</p>");d.append("<p>Keep in mind that the state of your plugin will never be higher than the state of your dependencies (except Featured). For example, if your plugin depends on a release that has not been approved yet, your plugin won't get approved either before the dependency release gets approved.</p>");
var e=$("<table></table>");e.appendTo(d);a.append(b).append(c).append(d);a.dialog({autoOpen:!1,width:Math.min(.8*window.innerWidth,600),modal:!0,height:.8*window.innerHeight,position:modalPosition,buttons:{Select:function(){var a=$("input.submit-dep-dialog-version-radio:checked").attr("data-value"),b=C[a].version;B.text("Change: v"+b).attr("data-relid",a).attr("data-version",b);$(this).dialog("close");C=u=B=void 0}},open:function(a,b){$(".ui-widget-overlay").bind("click",function(){$("#depSelectDialog").dialog("close")})}});
return{dialog:a,loading:b,error:c,inner:d,table:e}}()});
