UNPKG

@re621/zestyapi

Version:

Comprehensive JS wrapper for e621.net API

1 lines 61.7 kB
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("cross-fetch")):"function"==typeof define&&define.amd?define(["cross-fetch"],e):"object"==typeof exports?exports.ZestyAPI=e(require("cross-fetch")):t.ZestyAPI=e(t["cross-fetch"])}(this,(function(t){return(()=>{"use strict";var e={332:function(t,e,n){var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,a){function s(t){try{i(r.next(t))}catch(t){a(t)}}function u(t){try{i(r.throw(t))}catch(t){a(t)}}function i(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,u)}i((r=r.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var n,r,o,a,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}};Object.defineProperty(e,"__esModule",{value:!0});var a=n(365),s=n(751),u=function(){function t(t){this.endpoint="unknown",this.searchParams=[],this.searchParamAliases={},this.api=t}return t.prototype.find=function(e){return void 0===e&&(e={}),r(this,void 0,void 0,(function(){var n,r,s=this;return o(this,(function(o){n=this.splitQueryParams(e);try{r=this.validateParams(e,n)}catch(e){return[2,t.makeMalformedRequestResponse()]}return[2,this.api.makeRequest(this.endpoint+".json",{query:t.flattenParams(r)}).then((function(e){return e.data[s.endpoint]&&(e.status.code=a.ResponseCode.NotFound,e.status.message=a.ResponseStatusMessage.NotFound,e.data=[]),t.formatAPIResponse(e.status,e.data)}),(function(e){return t.formatAPIResponse(e.status,[])}))]}))}))},t.prototype.splitQueryParams=function(t){void 0===t&&(t={});var e={};return t.limit&&(e.limit=t.limit),t.page&&(e.page=t.page),e},t.prototype.validateParams=function(t,e){void 0===t&&(t={}),void 0===e&&(e={}),t=this.validateSearchParams(t),e=this.validateQueryParams(e);var n=Object.keys(e).length?e:{};return Object.keys(t).length&&(n.search=t),n},t.prototype.validateSearchParams=function(t){void 0===t&&(t={});for(var e={},n=0,r=Object.entries(this.searchParamAliases);n<r.length;n++){var o=r[n],a=o[0],s=o[1];t[a]&&(t[s]=t[a]),delete t[a]}for(var u=0,i=this.searchParams;u<i.length;u++){var c=i[u];void 0!==t[c]&&(e[c]=t[c])}return e},t.prototype.validateQueryParams=function(t){void 0===t&&(t={});var e={};return t?(t.limit&&"number"==typeof t.limit&&(e.limit=s.default.Math.clamp(t.limit,1,320)),t.page&&("number"==typeof t.page?e.page=s.default.Math.clamp(t.page,1,750):"string"==typeof t.page&&/[ab]\d+/.test(t.page)&&(e.page=t.page)),e):e},t.makeMalformedRequestResponse=function(){return Promise.resolve({status:{code:a.ResponseCode.MalformedRequest,message:a.ResponseStatusMessage.MalformedRequest,url:null},data:[]})},t.flattenParams=function(t,e,n){void 0===e&&(e=",");for(var r={},o=0,a=Object.entries(t);o<a.length;o++){var u=a[o];i(r,u[0],u[1],n,e,[])}return r;function i(t,e,n,r,o,a){if(void 0===r&&(r={}),void 0===o&&(o=","),void 0===a&&(a=[]),null!=n&&""!==n){if(r[e]&&(e=r[e]),Array.isArray(n)){if(0==n.length)return;return n=s.default.encodeArray(n),void(t[f(e,a)]=n.join(o))}if("object"!=typeof n)return n=s.default.encode(n),void(t[f(e,a)]=n);a.push(e);for(var u=0,c=Object.entries(n);u<c.length;u++){var l=c[u];i(t,l[0],l[1],r,o,a)}}function f(t,e){if(void 0===e&&(e=[]),0==e.length)return t;for(var n=e[0],r=0,o=e.slice(1);r<o.length;r++){n+="["+o[r]+"]"}return n+="["+t+"]"}}},t.formatAPIResponse=function(t,e){return t.url||(t.url=null),e||(e=[]),{status:t,data:e}},t}();e.default=u},376:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(){}return t.log=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.debug&&console.log(t)},t.connect=function(t){this.debug&&console.log("%cCONNECT "+t,"color: blueviolet")},t.debug=!1,t}();e.default=n},614:function(t,e,n){var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,a){function s(t){try{i(r.next(t))}catch(t){a(t)}}function u(t){try{i(r.throw(t))}catch(t){a(t)}}function i(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,u)}i((r=r.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var n,r,o,a,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}};Object.defineProperty(e,"__esModule",{value:!0});var a=n(503),s=n(365),u=n(376),i=n(751),c=n.g.fetch?n.g.fetch:a.default,l=n.g.fetch?Request:a.Request,f=function(){function t(){}return t.add=function(t,e,n){var r=this;return void 0===n&&(n=500),n<500&&(n=500),new Promise((function(o,a){r.queue.push({request:new l(t,e),success:o,failure:a,timeout:n}),r.run()}))},t.run=function(){return r(this,void 0,void 0,(function(){var t,e,n;return o(this,(function(r){switch(r.label){case 0:if(this.running)return[2];this.running=!0,r.label=1;case 1:if(!(t=this.queue.shift()))return[3,13];r.label=2;case 2:r.trys.push([2,10,,11]),u.default.connect(t.request.url),e=void 0,r.label=3;case 3:return r.trys.push([3,5,,6]),[4,c(t.request)];case 4:return e=r.sent(),[3,6];case 5:return r.sent(),e={status:s.ResponseCode.FetchError,statusText:"An error occurred while fetching data"},[3,6];case 6:return e.status===s.ResponseCode.Success?[3,7]:(t.failure({status:{code:e.status,url:t.request.url,message:e.statusText},data:null}),[3,9]);case 7:return"HEAD"==t.request.method?(t.success({status:{code:e.status,url:t.request.url,message:e.statusText},data:e.headers}),[3,1]):[4,e.json()];case 8:if(void 0===(n=r.sent())||void 0!==n.success&&!1===n.success)return t.failure({status:{code:e.status,url:t.request.url,message:e.statusText},data:null}),[3,1];t.success({status:{code:e.status,url:t.request.url,message:e.statusText},data:n}),r.label=9;case 9:return[3,11];case 10:return r.sent(),t.failure({status:{code:s.ResponseCode.ParsingError,url:t.request.url,message:s.ResponseStatusMessage.ProcessingError},data:null}),[3,11];case 11:return[4,i.default.sleep(t.timeout)];case 12:return r.sent(),[3,1];case 13:return this.running=!1,[2]}}))}))},t.queue=[],t.running=!1,t}();e.default=f},751:function(t,e,n){var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,a){function s(t){try{i(r.next(t))}catch(t){a(t)}}function u(t){try{i(r.throw(t))}catch(t){a(t)}}function i(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,u)}i((r=r.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var n,r,o,a,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}};Object.defineProperty(e,"__esModule",{value:!0});var a=n(401),s=n(609),u=n(497),i=function(){function t(){}return t.sleep=function(t){return r(this,void 0,void 0,(function(){return o(this,(function(e){return[2,new Promise((function(e){setTimeout((function(){e()}),t)}))]}))}))},t.encode=function(t){return encodeURIComponent(t+"")},t.encodeArray=function(t){for(var e=[],n=0,r=t;n<r.length;n++){var o=r[n];e.push(this.encode(o))}return e},t.btoa=function(t){return this.isBrowser?btoa(t):Buffer.from(t).toString("base64")},t.atob=function(t){return this.isBrowser?atob(t):Buffer.from(t,"base64").toString()},t.Math=s.default,t.ID=a.default,t.Type=u.default,t.isBrowser="undefined"==typeof process,t}();e.default=i},401:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(){}return t.make=function(t){if(void 0===t&&(t=!0),!t)return n();var e;do{e=n()}while(this.uniqueIDs.has(e));return this.uniqueIDs.add(e),e;function n(){return(+new Date).toString(36)}},t.has=function(t){return this.uniqueIDs.has(t)},t.remove=function(t){return!!this.has(t)&&(this.uniqueIDs.delete(t),!0)},t.uniqueIDs=new Set,t}();e.default=n},609:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(){}return t.clamp=function(t,e,n){return Math.min(Math.max(t,e),n)},t.between=function(t,e,n){return e<=t&&n>=t},t.round=function(t,e){return void 0===e&&(e=2),0==e?parseInt(t.toFixed(e)):parseFloat(t.toFixed(e))},t}();e.default=n},497:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(){}return t.prefix=function(t,e){for(var n={},r=0,o=Object.entries(e);r<o.length;r++){var a=o[r],s=a[0],u=a[1];n[t+"[".concat(s,"]")]=u}return n},t}();e.default=n},466:function(t,e,n){var r,o=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var a,s=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.endpoint="blips",e.searchParams=["creator_name","body_matches","response_to","order","id","creator_id"],e.searchParamAliases={body:"body_matches"},e}return o(e,t),e.prototype.find=function(e){return void 0===e&&(e={}),t.prototype.find.call(this,e)},e}(n(332).default);e.default=s,function(t){t.Created="id_desc",t.Updated="updated_at_desc"}(a||(a={}))},468:function(t,e,n){var r,o=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var a,s=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.endpoint="comments",e.searchParams=["creator_name","body_matches","post_tags_match","is_hidden","is_sticky","order","id","post_id","creator_id"],e.searchParamAliases={body:"body_matches",post_tags:"post_tags_match"},e}return o(e,t),e.prototype.find=function(e){return void 0===e&&(e={}),t.prototype.find.call(this,e)},e.prototype.validateQueryParams=function(e){void 0===e&&(e={});var n=t.prototype.validateQueryParams.call(this,e);return n.group_by="comment",n},e}(n(332).default);e.default=s,function(t){t.Created="id_desc",t.Updated="updated_at_desc",t.Score="score_desc",t.Post="post_id_desc"}(a||(a={}))},381:function(t,e,n){var r,o=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),a=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,a){function s(t){try{i(r.next(t))}catch(t){a(t)}}function u(t){try{i(r.throw(t))}catch(t){a(t)}}function i(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,u)}i((r=r.apply(t,e||[])).next())}))},s=this&&this.__generator||function(t,e){var n,r,o,a,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}};Object.defineProperty(e,"__esModule",{value:!0});var u=n(332),i=n(365),c=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.endpoint="favorites.json",e}return o(e,t),e.prototype.find=function(t){return a(this,void 0,void 0,(function(){var e;return s(this,(function(n){try{e=this.validateParams({},t)}catch(t){return[2,u.default.makeMalformedRequestResponse()]}return[2,this.api.makeRequest("favorites.json",{query:u.default.flattenParams(e)}).then((function(t){return t.data.posts&&0!=t.data.posts.length?t.data=t.data.posts:(t.status.code=i.ResponseCode.NotFound,t.status.message=i.ResponseStatusMessage.NotFound,t.data=[]),u.default.formatAPIResponse(t.status,t.data)}),(function(t){return u.default.formatAPIResponse(t.status,[])}))]}))}))},e.prototype.add=function(t){return a(this,void 0,void 0,(function(){return s(this,(function(e){return this.api.isAuthSet?[2,this.api.makeRequest(this.endpoint,{method:"POST",body:{post_id:t}}).then((function(t){return u.default.formatAPIResponse(t.status,[])}),(function(t){return u.default.formatAPIResponse(t.status,[])}))]:[2,u.default.formatAPIResponse({code:i.ResponseCode.Unauthorized,message:i.ResponseStatusMessage.Unauthorized,url:null},[])]}))}))},e.prototype.remove=function(t){return a(this,void 0,void 0,(function(){return s(this,(function(e){return this.api.isAuthSet?[2,this.api.makeRequest("favorites/".concat(t,".json"),{method:"DELETE"}).then((function(t){return u.default.formatAPIResponse(t.status,[])}),(function(t){return u.default.formatAPIResponse(t.status,[])}))]:[2,u.default.formatAPIResponse({code:i.ResponseCode.Unauthorized,message:i.ResponseStatusMessage.Unauthorized,url:null},[])]}))}))},e.prototype.validateQueryParams=function(e){void 0===e&&(e={});var n=t.prototype.validateQueryParams.call(this,e);if(e.user_id){var r="string"==typeof e.user_id?e.user_id.split(",")[0]:e.user_id;"number"!=typeof r&&(e.user_id=parseInt(r)),e.user_id?n.user_id=e.user_id:delete e.user_id}return n},e}(u.default);e.default=c},338:function(t,e,n){var r,o=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var a=n(332),s=n(270),u=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.Category=s.APIForumCategoryID,e.endpoint="forum_posts",e.searchParams=["topic_title_matches","body_matches","creator_name","topic_category_id","id","creator_id","topic_id","is_hidden"],e.searchParamAliases={title:"topic_title_matches",body:"body_matches"},e}return o(e,t),e.prototype.find=function(e){return void 0===e&&(e={}),t.prototype.find.call(this,e)},e}(a.default);e.default=u},86:function(t,e,n){var r,o=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),a=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,a){function s(t){try{i(r.next(t))}catch(t){a(t)}}function u(t){try{i(r.throw(t))}catch(t){a(t)}}function i(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,u)}i((r=r.apply(t,e||[])).next())}))},s=this&&this.__generator||function(t,e){var n,r,o,a,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}};Object.defineProperty(e,"__esModule",{value:!0});var u=n(332),i=n(365),c=n(270),l=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.Category=c.APIForumCategoryID,e.searchParams=["id","title_matches","is_sticky","is_hidden","category_id"],e.searchParamAliases={title:"title_matches"},e}return o(e,t),e.prototype.find=function(t){return void 0===t&&(t={}),a(this,void 0,void 0,(function(){var e,n;return s(this,(function(r){e=this.splitQueryParams(t);try{n=this.validateParams(t,e)}catch(t){return[2,u.default.makeMalformedRequestResponse()]}return[2,this.api.makeRequest("forum_topics.json",{query:u.default.flattenParams(n)}).then((function(t){return t.data&&0!=t.data.length||(t.status.code=i.ResponseCode.NotFound,t.status.message=i.ResponseStatusMessage.NotFound,t.data=[]),u.default.formatAPIResponse(t.status,t.data)}),(function(t){return u.default.formatAPIResponse(t.status,[])}))]}))}))},e}(u.default);e.default=l},104:function(t,e,n){var r,o=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),a=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,a){function s(t){try{i(r.next(t))}catch(t){a(t)}}function u(t){try{i(r.throw(t))}catch(t){a(t)}}function i(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,u)}i((r=r.apply(t,e||[])).next())}))},s=this&&this.__generator||function(t,e){var n,r,o,a,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}};Object.defineProperty(e,"__esModule",{value:!0});var u=n(332),i=n(365),c=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.find=function(t){return void 0===t&&(t={}),a(this,void 0,void 0,(function(){var e;return s(this,(function(n){try{e=this.validateParams({},t)}catch(t){return[2,u.default.makeMalformedRequestResponse()]}return[2,this.api.makeRequest("iqdb_queries.json",{query:u.default.flattenParams(e),rateLimit:2e3}).then((function(t){return t.data.posts&&(t.status.code=i.ResponseCode.NotFound,t.status.message=i.ResponseStatusMessage.NotFound,t.data=[]),u.default.formatAPIResponse(t.status,t.data)}),(function(t){return u.default.formatAPIResponse(t.status,[])}))]}))}))},e.prototype.validateQueryParams=function(t){var e={};return void 0!==t.url&&(e.url=t.url),void 0!==t.post_id&&(e.post_id=t.post_id),e},e}(u.default);e.default=c},949:function(t,e,n){var r,o=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var a=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.endpoint="notes",e.searchParams=["body_matches","creator_name","post_tags_match","id","creator_id","post_id"],e.searchParamAliases={body:"body_matches",post_tags:"post_tags_match"},e}return o(e,t),e.prototype.find=function(e){return void 0===e&&(e={}),t.prototype.find.call(this,e)},e}(n(332).default);e.default=a},644:function(t,e,n){var r,o=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var a,s=n(332),u=n(365),i=n(841),c=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.Category=i.APIPoolCategory,e.searchParams=["name_matches","description_matches","creator_name","is_active","order","id","creator_id","category"],e.searchParamAliases={name:"name_matches",description:"description_matches"},e}return o(e,t),e.prototype.find=function(t){void 0===t&&(t={});var e,n=this.splitQueryParams(t);try{e=this.validateParams(t,n)}catch(t){return s.default.makeMalformedRequestResponse()}return this.api.makeRequest("pools.json",{query:s.default.flattenParams(e)}).then((function(t){return t.data&&0!=t.data.length||(t.status.code=u.ResponseCode.NotFound,t.status.message=u.ResponseStatusMessage.NotFound,t.data=[]),s.default.formatAPIResponse(t.status,t.data)}),(function(t){return s.default.formatAPIResponse(t.status,[])}))},e}(s.default);e.default=c,function(t){t.UpdatedAt="updated_at",t.CreatedAt="created_at",t.Name="name",t.PostCount="post_count"}(a||(a={}))},656:function(t,e,n){var r,o=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),a=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,a){function s(t){try{i(r.next(t))}catch(t){a(t)}}function u(t){try{i(r.throw(t))}catch(t){a(t)}}function i(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,u)}i((r=r.apply(t,e||[])).next())}))},s=this&&this.__generator||function(t,e){var n,r,o,a,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}};Object.defineProperty(e,"__esModule",{value:!0});var u=n(332),i=n(365),c=n(366),l=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.Action=c.APIPostEventAction,e.searchParams=["post_id","creator_name","action","id","creator_id"],e}return o(e,t),e.prototype.find=function(t){return void 0===t&&(t={}),a(this,void 0,void 0,(function(){var e,n;return s(this,(function(r){e=this.splitQueryParams(t);try{n=this.validateParams(t,e)}catch(t){return[2,u.default.makeMalformedRequestResponse()]}return[2,this.api.makeRequest("post_events.json",{query:u.default.flattenParams(n)}).then((function(t){return t.data.post_events&&0!=t.data.post_events.length?t.data=t.data.post_events:(t.status.code=i.ResponseCode.NotFound,t.status.message=i.ResponseStatusMessage.NotFound,t.data=[]),u.default.formatAPIResponse(t.status,t.data)}),(function(t){return u.default.formatAPIResponse(t.status,[])}))]}))}))},e}(u.default);e.default=l},296:function(t,e,n){var r,o=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var a,s=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.endpoint="post_sets",e.searchParams=["name","shortname","creator_name","order","is_public","id"],e}return o(e,t),e.prototype.find=function(e){return void 0===e&&(e={}),t.prototype.find.call(this,e)},e}(n(332).default);e.default=s,function(t){t.Name="name",t.ShortName="shortname",t.PostCount="postcount",t.CreatedAt="created_at",t.UpdatedAt="update"}(a||(a={}))},589:function(t,e,n){var r,o=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),a=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,a){function s(t){try{i(r.next(t))}catch(t){a(t)}}function u(t){try{i(r.throw(t))}catch(t){a(t)}}function i(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,u)}i((r=r.apply(t,e||[])).next())}))},s=this&&this.__generator||function(t,e){var n,r,o,a,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}};Object.defineProperty(e,"__esModule",{value:!0});var u=n(332),i=n(27),c=n(365),l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.find=function(){return a(this,void 0,void 0,(function(){return s(this,(function(t){throw i.MalformedRequestError.NotImplemented()}))}))},e.prototype.vote=function(t,e,n){return void 0===n&&(n=!1),a(this,void 0,void 0,(function(){return s(this,(function(r){return this.api.isAuthSet?[2,this.api.makeRequest("posts/".concat(t,"/votes.json"),{method:"POST",body:{score:e,no_unvote:!0===n}}).then((function(t){return!1===t.data.success&&(t.status.code=c.ResponseCode.NotFound,t.status.message=c.ResponseStatusMessage.NotFound,t.data=[]),u.default.formatAPIResponse(t.status,[t.data])}),(function(t){return u.default.formatAPIResponse(t.status,[])}))]:[2,u.default.formatAPIResponse({code:c.ResponseCode.Unauthorized,message:c.ResponseStatusMessage.Unauthorized,url:null},[])]}))}))},e}(u.default);e.default=l},45:function(t,e,n){var r,o=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),a=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,a){function s(t){try{i(r.next(t))}catch(t){a(t)}}function u(t){try{i(r.throw(t))}catch(t){a(t)}}function i(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,u)}i((r=r.apply(t,e||[])).next())}))},s=this&&this.__generator||function(t,e){var n,r,o,a,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}};Object.defineProperty(e,"__esModule",{value:!0});var u=n(332),i=n(751),c=n(27),l=n(365),f=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.find=function(t){return void 0===t&&(t={}),a(this,void 0,void 0,(function(){var e;return s(this,(function(n){try{e=this.validateParams({},t)}catch(t){return[2,u.default.makeMalformedRequestResponse()]}return[2,this.api.makeRequest("posts.json",{query:u.default.flattenParams(e,"+")}).then((function(t){return t.data.posts&&0!=t.data.posts.length?t.data=t.data.posts:(t.status.code=l.ResponseCode.NotFound,t.status.message=l.ResponseStatusMessage.NotFound,t.data=[]),u.default.formatAPIResponse(t.status,t.data)}),(function(t){return u.default.formatAPIResponse(t.status,[])}))]}))}))},e.prototype.get=function(t){return a(this,void 0,void 0,(function(){return s(this,(function(e){return"number"!=typeof t?[2,u.default.makeMalformedRequestResponse()]:[2,this.api.makeRequest("posts/".concat(t,".json")).then((function(t){return t.data.post?t.data=[t.data.post]:(t.status.code=l.ResponseCode.NotFound,t.status.message=l.ResponseStatusMessage.NotFound,t.data=[]),u.default.formatAPIResponse(t.status,t.data)}),(function(t){return u.default.formatAPIResponse(t.status,[])}))]}))}))},e.prototype.getMany=function(t){return a(this,void 0,void 0,(function(){return s(this,(function(e){return Array.isArray(t)?[2,this.find({tags:"id:"+t.join(",")})]:[2,u.default.makeMalformedRequestResponse()]}))}))},e.prototype.random=function(){return a(this,void 0,void 0,(function(){return s(this,(function(t){return[2,this.api.makeRequest("posts/random.json").then((function(t){return t.data.post?t.data=[t.data.post]:(t.status.code=l.ResponseCode.NotFound,t.status.message=l.ResponseStatusMessage.NotFound,t.data=[]),u.default.formatAPIResponse(t.status,t.data)}),(function(t){return u.default.formatAPIResponse(t.status,[])}))]}))}))},e.prototype.randomMany=function(t,e){return void 0===t&&(t={}),a(this,void 0,void 0,(function(){return s(this,(function(n){return t.tags?Array.isArray(t.tags)||(t.tags=t.tags.trim().split(" ").filter((function(t){return t}))):t.tags=[],t.tags.push("order:random"),e&&t.tags.push("randseed:"+e),[2,this.find(t)]}))}))},e.prototype.update=function(t,e){return a(this,void 0,void 0,(function(){return s(this,(function(n){return this.api.isAuthSet?[2,this.api.makeRequest("posts/".concat(t,".json"),{method:"PATCH",body:i.default.Type.prefix("post",e)}).then((function(t){return t.data.post?t.data=[t.data.post]:(t.status.code=l.ResponseCode.NotFound,t.status.message=l.ResponseStatusMessage.NotFound,t.data=[]),u.default.formatAPIResponse(t.status,t.data)}),(function(t){return u.default.formatAPIResponse(t.status,[])}))]:[2,u.default.formatAPIResponse({code:l.ResponseCode.Unauthorized,message:l.ResponseStatusMessage.Unauthorized,url:null},[])]}))}))},e.prototype.validateQueryParams=function(e){void 0===e&&(e={});var n=t.prototype.validateQueryParams.call(this,e);if(e.tags)if("object"!=typeof e.tags)n.tags=(e.tags+"").trim().split(" ").filter((function(t){return t}));else{if(!Array.isArray(e.tags))throw c.MalformedRequestError.Params();n.tags=e.tags}else n.tags=[];if(n.tags.length>40)throw c.MalformedRequestError.TooMany("tags");return n},e}(u.default);e.default=f},825:function(t,e,n){var r,o=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var a=n(523),s=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.AliasStatus=a.APITagAliasStatus,e.endpoint="tag_aliases",e}return o(e,t),e}(n(741).default);e.default=s},323:function(t,e,n){var r,o=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var a=n(523),s=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.ImplicationStatus=a.APITagAliasStatus,e.endpoint="tag_implications",e}return o(e,t),e}(n(741).default);e.default=s},741:function(t,e,n){var r,o=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var a,s=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.searchParams=["name_matches","antecedent_name","consequent_name","creator_name","approver_name","antecedent_tag_category","consequent_tag_category","status","order"],e.searchParamAliases={name:"name_matches"},e}return o(e,t),e.prototype.find=function(e){return void 0===e&&(e={}),t.prototype.find.call(this,e)},e}(n(332).default);e.default=s,function(t){t.Status="status",t.CreatedAt="created_at",t.UpdatedAt="updated_at",t.Name="name",t.TagCount="tag_count"}(a||(a={}))},484:function(t,e,n){var r,o=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var a,s=n(332),u=n(824),i=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.Category=u.APITagCategory,e.endpoint="tags",e.searchParams=["name","category","order","has_wiki","has_artist","hide_empty"],e}return o(e,t),e.prototype.find=function(e){return void 0===e&&(e={}),t.prototype.find.call(this,e)},e.prototype.get=function(t){return"object"==typeof t||void 0===t?s.default.makeMalformedRequestResponse():this.api.makeRequest("tags/".concat(t,".json")).then((function(t){return s.default.formatAPIResponse(t.status,t.data)}),(function(t){return s.default.formatAPIResponse(t.status,[])}))},e}(s.default);e.default=i,function(t){t.Newest="date",t.Count="count",t.Name="name"}(a||(a={}))},709:function(t,e,n){var r,o=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var a=n(332),s=n(769),u=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.FeedbackCategory=s.APIFeedbackCategory,e.endpoint="user_feedbacks",e.searchParams=["user_name","creator_name","body_matches","category","id","user_id","creator_id"],e.searchParamAliases={body:"body_matches"},e}return o(e,t),e.prototype.find=function(e){return void 0===e&&(e={}),t.prototype.find.call(this,e)},e}(a.default);e.default=u},936:function(t,e,n){var r,o=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),a=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,a){function s(t){try{i(r.next(t))}catch(t){a(t)}}function u(t){try{i(r.throw(t))}catch(t){a(t)}}function i(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,u)}i((r=r.apply(t,e||[])).next())}))},s=this&&this.__generator||function(t,e){var n,r,o,a,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.UserSearchOrder=void 0;var u,i=n(332),c=n(365),l=n(827),f=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.Level=l.APIUserLevel,e.SearchOrder=u,e.searchParams=["name_matches","email_matches","level","min_level","max_level","can_upload_free","can_approve_posts","order"],e.searchParamAliases={name:"name_matches",email:"email_matches"},e}return o(e,t),e.prototype.find=function(t){return void 0===t&&(t={}),a(this,void 0,void 0,(function(){var e,n;return s(this,(function(r){e=this.splitQueryParams(t);try{n=this.validateParams(t,e)}catch(t){return[2,i.default.makeMalformedRequestResponse()]}return[2,this.api.makeRequest("users.json",{query:i.default.flattenParams(n)}).then((function(t){return t.data&&0!=t.data.length||(t.status.code=c.ResponseCode.NotFound,t.status.message=c.ResponseStatusMessage.NotFound,t.data=[]),i.default.formatAPIResponse(t.status,t.data)}),(function(t){return i.default.formatAPIResponse(t.status,[])}))]}))}))},e.prototype.get=function(t){return a(this,void 0,void 0,(function(){return s(this,(function(e){return"object"==typeof t||void 0===t?[2,i.default.makeMalformedRequestResponse()]:[2,this.api.makeRequest("users/".concat(t,".json")).then((function(t){return i.default.formatAPIResponse(t.status,t.data)}),(function(t){return i.default.formatAPIResponse(t.status,[])}))]}))}))},e.prototype.isAuthenticated=function(){return a(this,void 0,void 0,(function(){var t;return s(this,(function(e){return(t=this.api.getAuthLogin())?[2,this.get(t.username).then((function(t){return 200==t.status.code}))]:[2,Promise.resolve(!1)]}))}))},e}(i.default);e.default=f,function(t){t.Date="date",t.Name="name",t.PostUploadCount="post_upload_count",t.NoteCount="note_count",t.PostUpdateCount="post_update_count"}(u=e.UserSearchOrder||(e.UserSearchOrder={}))},653:function(t,e,n){var r,o=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),a=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,a){function s(t){try{i(r.next(t))}catch(t){a(t)}}function u(t){try{i(r.throw(t))}catch(t){a(t)}}function i(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,u)}i((r=r.apply(t,e||[])).next())}))},s=this&&this.__generator||function(t,e){var n,r,o,a,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}};Object.defineProperty(e,"__esModule",{value:!0});var u=n(332),i=n(751),c=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.makeID=function(t){return void 0===t&&(t=!0),i.default.ID.make(t)},e.prototype.hasID=function(t){return i.default.ID.has(t)},e.prototype.clearID=function(t){return i.default.ID.remove(t)},e.prototype.isOnline=function(){return a(this,void 0,void 0,(function(){return s(this,(function(t){return[2,this.api.makeRequest("posts.json",{method:"HEAD"}).then((function(t){return 200==t.status.code}),(function(){return!1}))]}))}))},e.prototype.test403=function(){return a(this,void 0,void 0,(function(){return s(this,(function(t){return[2,this.api.makeRequest("test403").then((function(t){return u.default.formatAPIResponse(t.status,t.data)}),(function(t){return u.default.formatAPIResponse(t.status,[])}))]}))}))},e.prototype.test404=function(){return a(this,void 0,void 0,(function(){return s(this,(function(t){return[2,this.api.makeRequest("test404").then((function(t){return u.default.formatAPIResponse(t.status,t.data)}),(function(t){return u.default.formatAPIRespon