@cyberskill/shared 1.190.0 → 1.192.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/dist/_tsup-dts-rollup.d.cts +54 -0
  2. package/dist/_tsup-dts-rollup.d.ts +54 -0
  3. package/dist/config/config.util.cjs +1 -1
  4. package/dist/config/config.util.js +1 -1
  5. package/dist/config/index.cjs +1 -1
  6. package/dist/config/index.js +1 -1
  7. package/dist/config/vitest/index.cjs +1 -1
  8. package/dist/config/vitest/index.js +1 -1
  9. package/dist/config/vitest/vitest.unit.cjs +1 -1
  10. package/dist/config/vitest/vitest.unit.js +1 -1
  11. package/dist/node/cli/cli.util.cjs +1 -1
  12. package/dist/node/cli/cli.util.js +1 -1
  13. package/dist/node/cli/index.cjs +1 -1
  14. package/dist/node/cli/index.js +1 -1
  15. package/dist/node/command/command.util.cjs +1 -1
  16. package/dist/node/command/command.util.js +1 -1
  17. package/dist/node/command/index.cjs +1 -1
  18. package/dist/node/command/index.js +1 -1
  19. package/dist/node/fs/fs.util.cjs +1 -1
  20. package/dist/node/fs/fs.util.d.cts +1 -0
  21. package/dist/node/fs/fs.util.d.ts +1 -0
  22. package/dist/node/fs/fs.util.js +1 -1
  23. package/dist/node/fs/index.cjs +1 -1
  24. package/dist/node/fs/index.d.cts +1 -0
  25. package/dist/node/fs/index.d.ts +1 -0
  26. package/dist/node/fs/index.js +1 -1
  27. package/dist/node/index.cjs +1 -1
  28. package/dist/node/index.d.cts +7 -0
  29. package/dist/node/index.d.ts +7 -0
  30. package/dist/node/index.js +1 -1
  31. package/dist/node/mongo/index.cjs +1 -1
  32. package/dist/node/mongo/index.js +1 -1
  33. package/dist/node/mongo/mongo.util.cjs +1 -1
  34. package/dist/node/mongo/mongo.util.js +1 -1
  35. package/dist/node/package/index.cjs +1 -1
  36. package/dist/node/package/index.js +1 -1
  37. package/dist/node/package/package.util.cjs +1 -1
  38. package/dist/node/package/package.util.js +1 -1
  39. package/dist/node/path/index.cjs +1 -1
  40. package/dist/node/path/index.d.cts +1 -0
  41. package/dist/node/path/index.d.ts +1 -0
  42. package/dist/node/path/index.js +1 -1
  43. package/dist/node/path/path.constant.cjs +1 -1
  44. package/dist/node/path/path.constant.js +1 -1
  45. package/dist/node/path/path.util.cjs +1 -1
  46. package/dist/node/path/path.util.d.cts +1 -0
  47. package/dist/node/path/path.util.d.ts +1 -0
  48. package/dist/node/path/path.util.js +1 -1
  49. package/dist/node/upload/index.cjs +1 -0
  50. package/dist/node/upload/index.d.cts +5 -0
  51. package/dist/node/upload/index.d.ts +5 -0
  52. package/dist/node/upload/index.js +1 -0
  53. package/dist/node/upload/upload.type.cjs +1 -0
  54. package/dist/node/upload/upload.type.d.cts +4 -0
  55. package/dist/node/upload/upload.type.d.ts +4 -0
  56. package/dist/node/upload/upload.type.js +0 -0
  57. package/dist/node/upload/upload.util.cjs +1 -0
  58. package/dist/node/upload/upload.util.d.cts +1 -0
  59. package/dist/node/upload/upload.util.d.ts +1 -0
  60. package/dist/node/upload/upload.util.js +1 -0
  61. package/dist/react/index.cjs +1 -1
  62. package/dist/react/index.css +1 -1
  63. package/dist/react/index.js +1 -1
  64. package/dist/react/loading/index.cjs +1 -1
  65. package/dist/react/loading/index.css +1 -1
  66. package/dist/react/loading/index.js +1 -1
  67. package/dist/react/loading/loading.component.cjs +1 -1
  68. package/dist/react/loading/loading.component.css +1 -1
  69. package/dist/react/loading/loading.component.js +1 -1
  70. package/dist/react/loading/loading.provider.cjs +1 -1
  71. package/dist/react/loading/loading.provider.css +1 -1
  72. package/dist/react/loading/loading.provider.js +1 -1
  73. package/package.json +6 -1
@@ -1 +1 @@
1
- function e(e,t){if(t==null||t>e.length)t=e.length;for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function t(e){if(Array.isArray(e))return e}function n(t){if(Array.isArray(t))return e(t)}function r(e){if(e===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return e}function s(e,t,n,r,s,i,o){try{var a=e[i](o);var c=a.value}catch(e){n(e);return}if(a.done){t(c)}else{Promise.resolve(c).then(r,s)}}function i(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){s(o,r,i,a,c,"next",e)}function c(e){s(o,r,i,a,c,"throw",e)}a(undefined)})}}function o(e,t,n){t=d(t);return D(e,R()?Reflect.construct(t,n||[],d(e).constructor):t.apply(e,n))}function a(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function c(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}function u(e,t,n){if(t)c(e.prototype,t);if(n)c(e,n);return e}function l(e,t,n){if(t in e){Object.defineProperty(e,t,{value:n,enumerable:true,configurable:true,writable:true})}else{e[t]=n}return e}function d(e){d=Object.setPrototypeOf?Object.getPrototypeOf:function e(e){return e.__proto__||Object.getPrototypeOf(e)};return d(e)}function p(e,t){if(typeof t!=="function"&&t!==null){throw new TypeError("Super expression must either be null or a function")}e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:true,configurable:true}});if(t)_(e,t)}function f(e,t){if(t!=null&&typeof Symbol!=="undefined"&&t[Symbol.hasInstance]){return!!t[Symbol.hasInstance](e)}else{return e instanceof t}}function E(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function m(e,t){var n=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(n==null)return;var r=[];var s=true;var i=false;var o,a;try{for(n=n.call(e);!(s=(o=n.next()).done);s=true){r.push(o.value);if(t&&r.length===t)break}}catch(e){i=true;a=e}finally{try{if(!s&&n["return"]!=null)n["return"]()}finally{if(i)throw a}}return r}function g(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function h(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function y(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};var r=Object.keys(n);if(typeof Object.getOwnPropertySymbols==="function"){r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))}r.forEach(function(t){l(e,t,n[t])})}return e}function v(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);if(t){r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})}n.push.apply(n,r)}return n}function S(e,t){t=t!=null?t:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(t))}else{v(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}function O(e,t){if(e==null)return{};var n=C(e,t);var r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++){r=i[s];if(t.indexOf(r)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(e,r))continue;n[r]=e[r]}}return n}function C(e,t){if(e==null)return{};var n={};var r=Object.keys(e);var s,i;for(i=0;i<r.length;i++){s=r[i];if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function D(e,t){if(t&&(T(t)==="object"||typeof t==="function")){return t}return r(e)}function _(e,t){_=Object.setPrototypeOf||function e(e,t){e.__proto__=t;return e};return _(e,t)}function I(e,n){return t(e)||m(e,n)||A(e,n)||g()}function N(e){return t(e)||E(e)||A(e)||g()}function b(e){return n(e)||E(e)||A(e)||h()}function T(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function A(t,n){if(!t)return;if(typeof t==="string")return e(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor)r=t.constructor.name;if(r==="Map"||r==="Set")return Array.from(r);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e(t,n)}function R(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(R=function(){return!!e})()}function x(e,t){var n,r,s,i={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},o=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return o.next=a(0),o["throw"]=a(1),o["return"]=a(2),typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(e){return function(t){return c([e,t])}}function c(a){if(n)throw new TypeError("Generator is already executing.");while(o&&(o=0,a[0]&&(i=0)),i)try{if(n=1,r&&(s=a[0]&2?r["return"]:a[0]?r["throw"]||((s=r["return"])&&s.call(r),0):r.next)&&!(s=s.call(r,a[1])).done)return s;if(r=0,s)a=[a[0]&2,s.value];switch(a[0]){case 0:case 1:s=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;r=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(s=i.trys,s=s.length>0&&s[s.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!s||a[1]>s[0]&&a[1]<s[3])){i.label=a[1];break}if(a[0]===6&&i.label<s[1]){i.label=s[1];s=a;break}if(s&&i.label<s[2]){i.label=s[2];i.ops.push(a);break}if(s[2])i.ops.pop();i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e];r=0}finally{n=s=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}}var G=Object.defineProperty;var P=function(e,t,n){return t in e?G(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n};var M=function(e,t){return G(e,"name",{value:t,configurable:!0})};var w=function(e,t,n){return P(e,(typeof t==="undefined"?"undefined":T(t))!="symbol"?t+"":t,n)};import{ApolloServer as L}from"@apollo/server";import{expressMiddleware as j}from"@apollo/server/express4";import{ApolloServerPluginDrainHttpServer as k}from"@apollo/server/plugin/drainHttpServer";import{ApolloServerPluginLandingPageLocalDefault as U,ApolloServerPluginLandingPageProductionDefault as F}from"@apollo/server/plugin/landingPage/default";var V=function(e){return e.Error="error",e.Warning="warning",e}({});import q from"chalk";import Y from"consola";import{GraphQLError as K}from"graphql";var B=".cyberskill-storage";import H from"@dotenvx/dotenvx";import{bool as Q,cleanEnv as W,str as J}from"envalid";import $ from"os";import X from"path";import z from"process";var Z=function(e){return e.PRODUCTION="production",e.STAGING="staging",e.DEVELOPMENT="development",e}({});var ee=!1;function et(){z.env.NODE_ENV!==Z.PRODUCTION&&!ee&&(H.config(),ee=!0)}M(et,"loadEnvFile");function en(){et();var e=W(z.env,{CWD:J({default:z.cwd()}),DEBUG:Q({default:!1}),CYBERSKILL_STORAGE_DIRECTORY:J({default:X.join($.homedir(),B)})});return{CWD:e.CWD,DEBUG:e.DEBUG,CYBERSKILL_STORAGE_DIRECTORY:e.CYBERSKILL_STORAGE_DIRECTORY}}M(en,"getEnv");var er={GRAPHQL_PARSE_FAILED:{CODE:"GRAPHQL_PARSE_FAILED",MESSAGE:"The GraphQL operation string contains a syntax error."},GRAPHQL_VALIDATION_FAILED:{CODE:"GRAPHQL_VALIDATION_FAILED",MESSAGE:"The GraphQL operation is not valid against the server's schema."},BAD_USER_INPUT:{CODE:"BAD_USER_INPUT",MESSAGE:"The GraphQL operation includes an invalid value for a field argument."},PERSISTED_QUERY_NOT_FOUND:{CODE:"PERSISTED_QUERY_NOT_FOUND",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the query was not in the APQ cache."},PERSISTED_QUERY_NOT_SUPPORTED:{CODE:"PERSISTED_QUERY_NOT_SUPPORTED",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the server has disabled APQ."},OPERATION_RESOLUTION_FAILURE:{CODE:"OPERATION_RESOLUTION_FAILURE",MESSAGE:"The request was parsed successfully and is valid against the server's schema, but the server couldn't resolve which operation to run. This occurs when a request containing multiple named operations doesn't specify which operation to run (i.e.,operationName), or if the named operation isn't included in the request."},CONTINUE:{CODE:100,MESSAGE:"Continue"},SWITCHING_PROTOCOLS:{CODE:101,MESSAGE:"Switching Protocols"},PROCESSING:{CODE:102,MESSAGE:"Processing"},OK:{CODE:200,MESSAGE:"OK"},CREATED:{CODE:201,MESSAGE:"Created"},ACCEPTED:{CODE:202,MESSAGE:"Accepted"},NON_AUTHORITATIVE_INFORMATION:{CODE:203,MESSAGE:"Non Authoritative Information"},NO_CONTENT:{CODE:204,MESSAGE:"No Content"},RESET_CONTENT:{CODE:205,MESSAGE:"Reset Content"},PARTIAL_CONTENT:{CODE:206,MESSAGE:"Partial Content"},MULTI_STATUS:{CODE:207,MESSAGE:"Multi-Status"},MULTIPLE_CHOICES:{CODE:300,MESSAGE:"Multiple Choices"},MOVED_PERMANENTLY:{CODE:301,MESSAGE:"Moved Permanently"},MOVED_TEMPORARILY:{CODE:302,MESSAGE:"Moved Temporarily"},SEE_OTHER:{CODE:303,MESSAGE:"See Other"},NOT_MODIFIED:{CODE:304,MESSAGE:"Not Modified"},USE_PROXY:{CODE:305,MESSAGE:"Use Proxy"},TEMPORARY_REDIRECT:{CODE:307,MESSAGE:"Temporary Redirect"},PERMANENT_REDIRECT:{CODE:308,MESSAGE:"Permanent Redirect"},BAD_REQUEST:{CODE:400,MESSAGE:"Bad Request"},UNAUTHORIZED:{CODE:401,MESSAGE:"Unauthorized"},PAYMENT_REQUIRED:{CODE:402,MESSAGE:"Payment Required"},FORBIDDEN:{CODE:403,MESSAGE:"Forbidden"},NOT_FOUND:{CODE:404,MESSAGE:"Not Found"},METHOD_NOT_ALLOWED:{CODE:405,MESSAGE:"Method Not Allowed"},NOT_ACCEPTABLE:{CODE:406,MESSAGE:"Not Acceptable"},PROXY_AUTHENTICATION_REQUIRED:{CODE:407,MESSAGE:"Proxy Authentication Required"},REQUEST_TIMEOUT:{CODE:408,MESSAGE:"Request Timeout"},CONFLICT:{CODE:409,MESSAGE:"Conflict"},GONE:{CODE:410,MESSAGE:"Gone"},LENGTH_REQUIRED:{CODE:411,MESSAGE:"Length Required"},PRECONDITION_FAILED:{CODE:412,MESSAGE:"Precondition Failed"},REQUEST_TOO_LONG:{CODE:413,MESSAGE:"Request Entity Too Large"},REQUEST_URI_TOO_LONG:{CODE:414,MESSAGE:"Request-URI Too Long"},UNSUPPORTED_MEDIA_TYPE:{CODE:415,MESSAGE:"Unsupported Media Type"},REQUESTED_RANGE_NOT_SATISFIABLE:{CODE:416,MESSAGE:"Requested Range Not Satisfiable"},EXPECTATION_FAILED:{CODE:417,MESSAGE:"Expectation Failed"},IM_A_TEAPOT:{CODE:418,MESSAGE:"I'm a teapot"},INSUFFICIENT_SPACE_ON_RESOURCE:{CODE:419,MESSAGE:"Insufficient Space on Resource"},METHOD_FAILURE:{CODE:420,MESSAGE:"Method Failure"},MISDIRECTED_REQUEST:{CODE:421,MESSAGE:"Misdirected Request"},UNPROCESSABLE_ENTITY:{CODE:422,MESSAGE:"Unprocessable Entity"},LOCKED:{CODE:423,MESSAGE:"Locked"},FAILED_DEPENDENCY:{CODE:424,MESSAGE:"Failed Dependency"},PRECONDITION_REQUIRED:{CODE:428,MESSAGE:"Precondition Required"},TOO_MANY_REQUESTS:{CODE:429,MESSAGE:"Too Many Requests"},REQUEST_HEADER_FIELDS_TOO_LARGE:{CODE:431,MESSAGE:"Request Header Fields Too Large"},UNAVAILABLE_FOR_LEGAL_REASONS:{CODE:451,MESSAGE:"Unavailable For Legal Reasons"},INTERNAL_SERVER_ERROR:{CODE:500,MESSAGE:"Internal Server Error"},NOT_IMPLEMENTED:{CODE:501,MESSAGE:"Not Implemented"},BAD_GATEWAY:{CODE:502,MESSAGE:"Bad Gateway"},SERVICE_UNAVAILABLE:{CODE:503,MESSAGE:"Service Unavailable"},GATEWAY_TIMEOUT:{CODE:504,MESSAGE:"Gateway Timeout"},HTTP_VERSION_NOT_SUPPORTED:{CODE:505,MESSAGE:"HTTP Version Not Supported"},INSUFFICIENT_STORAGE:{CODE:507,MESSAGE:"Insufficient Storage"},NETWORK_AUTHENTICATION_REQUIRED:{CODE:511,MESSAGE:"Network Authentication Required"}};var es=en();function ei(e){var t=e.message,n=e.status,r=n===void 0?er.INTERNAL_SERVER_ERROR:n,s=e.type,i=s===void 0?"graphql":s;var o;var a=(o=t!==null&&t!==void 0?t:r.MESSAGE)!==null&&o!==void 0?o:"Internal server error";throw i==="graphql"?new K(a,{extensions:{code:r.CODE}}):new Error(a)}M(ei,"throwError");es.DEBUG||(Y.level=4);function eo(e){var t=q[e];return typeof t=="function"?t:q.green}M(eo,"chalkKeyword");var ea={silent:Y.silent,level:Y.level,fatal:Y.fatal,error:Y.error,warn:Y.warn,log:Y.log,info:Y.info,success:Y.success,ready:Y.ready,start:Y.start,box:Y.box,debug:Y.debug,trace:Y.trace,verbose:Y.verbose,printBoxedLog:function e(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(t===null||t===void 0?void 0:t.length)){Y.box(q.green(e));return}t.forEach(function(e){var t=e.file,r=e.position,s=e.rule,i=e.message;Y.log("".concat(q.gray("File:")," ").concat(q.blue("".concat(t).concat(r?":".concat(r):"")))),s&&Y.log(" ".concat(eo(n)("Rule:")," ").concat(s)),Y.log(" ".concat(eo(n)("Message:")," ").concat(i))}),Y.box(eo(n)("".concat(e," : ").concat(t.length))),Y.log(q.gray("─".repeat(40)))}};function ec(e,t){var n=t!==null&&t!==void 0?t:{},r=n.shouldLog,s=r===void 0?!0:r,i=n.returnValue,o=n.callback,a=f(e,Error)?e:new Error(typeof e=="string"?e:"Unknown error");return s&&ea.error(a.message),o&&typeof o=="function"&&o(a),i||{success:!1,message:a.message,code:er.INTERNAL_SERVER_ERROR.CODE}}M(ec,"catchError");function eu(e){return new L(y({schema:e.schema,plugins:[e.isDev?U():F(),k({httpServer:e.server})].concat(b(e.drainServer?[{serverWillStart:function t(){return i(function(){return x(this,function(t){return[2,{drainServer:function t(){return i(function(){var t;return x(this,function(n){(t=e.drainServer)===null||t===void 0?void 0:t.call(e),ea.info("Apollo Server drainServer hook called");return[2]})})()}}]})})()}}]:[]))},e.isDev&&{introspection:!0,includeStacktraceInErrorResponses:!0}))}M(eu,"createApolloServer");import el from"process";import{hideBin as ed}from"yargs/helpers";import ep from"yargs/yargs";var ef={name:"@cyberskill/shared",type:"module",version:"1.189.0",description:"CyberSkill Shared",author:"Stephen Cheng",license:"MIT",homepage:"https://github.com/cyberskill-world/shared#readme",repository:{type:"git",url:"git+https://github.com/cyberskill-world/shared.git"},bugs:{url:"https://github.com/cyberskill-world/shared/issues"},exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/index.cjs"},"./config":{types:"./dist/config/index.d.ts",import:"./dist/config/index.js",require:"./dist/config/index.cjs"},"./config/commitlint":{types:"./dist/config/commitlint/index.d.ts",import:"./dist/config/commitlint/index.js",require:"./dist/config/commitlint/index.cjs"},"./config/env":{types:"./dist/config/env/index.d.ts",import:"./dist/config/env/index.js",require:"./dist/config/env/index.cjs"},"./config/eslint":{types:"./dist/config/eslint/index.d.ts",import:"./dist/config/eslint/index.js",require:"./dist/config/eslint/index.cjs"},"./config/graphql-codegen":{types:"./dist/config/graphql-codegen/index.d.ts",import:"./dist/config/graphql-codegen/index.js",require:"./dist/config/graphql-codegen/index.cjs"},"./config/lint-staged":{types:"./dist/config/lint-staged/index.d.ts",import:"./dist/config/lint-staged/index.js",require:"./dist/config/lint-staged/index.cjs"},"./config/vitest":{types:"./dist/config/vitest/index.d.ts",import:"./dist/config/vitest/index.js",require:"./dist/config/vitest/index.cjs"},"./constant":{types:"./dist/constant/index.d.ts",import:"./dist/constant/index.js",require:"./dist/constant/index.cjs"},"./node":{types:"./dist/node/index.d.ts",import:"./dist/node/index.js",require:"./dist/node/index.cjs"},"./node/apollo-server":{types:"./dist/node/apollo-server/index.d.ts",import:"./dist/node/apollo-server/index.js",require:"./dist/node/apollo-server/index.cjs"},"./node/cli":{types:"./dist/node/cli/index.d.ts",import:"./dist/node/cli/index.js",require:"./dist/node/cli/index.cjs"},"./node/command":{types:"./dist/node/command/index.d.ts",import:"./dist/node/command/index.js",require:"./dist/node/command/index.cjs"},"./node/express":{types:"./dist/node/express/index.d.ts",import:"./dist/node/express/index.js",require:"./dist/node/express/index.cjs"},"./node/fs":{types:"./dist/node/fs/index.d.ts",import:"./dist/node/fs/index.js",require:"./dist/node/fs/index.cjs"},"./node/log":{types:"./dist/node/log/index.d.ts",import:"./dist/node/log/index.js",require:"./dist/node/log/index.cjs"},"./node/mongo":{types:"./dist/node/mongo/index.d.ts",import:"./dist/node/mongo/index.js",require:"./dist/node/mongo/index.cjs"},"./node/package":{types:"./dist/node/package/index.d.ts",import:"./dist/node/package/index.js",require:"./dist/node/package/index.cjs"},"./node/path":{types:"./dist/node/path/index.d.ts",import:"./dist/node/path/index.js",require:"./dist/node/path/index.cjs"},"./node/storage":{types:"./dist/node/storage/index.d.ts",import:"./dist/node/storage/index.js",require:"./dist/node/storage/index.cjs"},"./node/ws":{types:"./dist/node/ws/index.d.ts",import:"./dist/node/ws/index.js",require:"./dist/node/ws/index.cjs"},"./react":{types:"./dist/react/index.d.ts",import:"./dist/react/index.js",require:"./dist/react/index.cjs"},"./react/apollo-client":{types:"./dist/react/apollo-client/index.d.ts",import:"./dist/react/apollo-client/index.js",require:"./dist/react/apollo-client/index.cjs"},"./react/apollo-error":{types:"./dist/react/apollo-error/index.d.ts",import:"./dist/react/apollo-error/index.js",require:"./dist/react/apollo-error/index.cjs"},"./react/i18next":{types:"./dist/react/i18next/index.d.ts",import:"./dist/react/i18next/index.js",require:"./dist/react/i18next/index.cjs"},"./react/loading":{types:"./dist/react/loading/index.d.ts",import:"./dist/react/loading/index.js",require:"./dist/react/loading/index.cjs"},"./react/log":{types:"./dist/react/log/index.d.ts",import:"./dist/react/log/index.js",require:"./dist/react/log/index.cjs"},"./react/next-intl":{types:"./dist/react/next-intl/index.d.ts",import:"./dist/react/next-intl/index.js",require:"./dist/react/next-intl/index.cjs"},"./react/storage":{types:"./dist/react/storage/index.d.ts",import:"./dist/react/storage/index.js",require:"./dist/react/storage/index.cjs"},"./react/toast":{types:"./dist/react/toast/index.d.ts",import:"./dist/react/toast/index.js",require:"./dist/react/toast/index.cjs"},"./react/index.css":{import:"./dist/react/index.css",require:"./dist/react/index.css"},"./typescript":{types:"./dist/typescript/index.d.ts",import:"./dist/typescript/index.js",require:"./dist/typescript/index.cjs"},"./util":{types:"./dist/util/index.d.ts",import:"./dist/util/index.js",require:"./dist/util/index.cjs"}},typesVersions:{"*":{config:["dist/config/index.d.ts"],constant:["dist/constant/index.d.ts"],node:["dist/node/index.d.ts"],react:["dist/react/index.d.ts"],typescript:["dist/typescript/index.d.ts"],util:["dist/util/index.d.ts"]}},bin:{cyberskill:"dist/node/cli/index.js"},files:["dist","public"],scripts:{build:"tsup",commitlint:"tsx src/node/cli/index.ts commitlint",dev:"tsup --watch",inspect:"tsx src/node/cli/index.ts inspect",lint:"tsx src/node/cli/index.ts lint","lint:fix":"tsx src/node/cli/index.ts lint:fix","lint:inspect":"tsx src/node/cli/index.ts lint:inspect",ready:"tsx src/node/cli/index.ts ready",reset:"tsx src/node/cli/index.ts reset","test:e2e":"tsx src/node/cli/index.ts test:e2e","test:unit":"tsx src/node/cli/index.ts test:unit"},dependencies:{"@antfu/eslint-config":"4.16.1","@apollo/client":"3.13.8","@apollo/server":"4.12.2","@dotenvx/dotenvx":"1.45.1","@eddeee888/gcg-typescript-resolver-files":"0.12.1","@graphql-codegen/cli":"5.0.7","@graphql-codegen/client-preset":"4.8.2","@nestjs/common":"11.1.3","@nestjs/core":"11.1.3","@vitejs/plugin-react-swc":"3.10.2","body-parser":"2.2.0",chalk:"5.4.1",clsx:"2.1.1",compression:"1.8.0",consola:"3.4.2","cookie-parser":"1.4.7",cors:"2.8.5","crypto-js":"4.2.0","date-fns":"4.1.0",envalid:"8.0.0",express:"4.21.2","express-session":"1.18.1","express-useragent":"1.0.15","fs-extra":"11.3.0",globals:"16.2.0",graphql:"16.11.0","graphql-ws":"6.0.5",i18next:"25.2.1",jsdom:"26.1.0",localforage:"1.10.0","migrate-mongo":"12.1.3",mongodb:"6.17.0",mongoose:"8.16.0","mongoose-aggregate-paginate-v2":"1.1.4","mongoose-paginate-v2":"1.9.1","next-intl":"4.3.0","node-fetch":"3.3.2","node-persist":"4.0.4",qs:"6.14.0",react:"19.1.0","react-dom":"19.1.0","react-hot-toast":"2.5.2","react-i18next":"15.5.3",sass:"1.89.2",slugify:"1.6.6",unorm:"1.6.0",uuid:"11.1.0",vite:"7.0.0",ws:"8.18.2",yargs:"18.0.0"},devDependencies:{"@commitlint/cli":"19.8.1","@commitlint/config-conventional":"19.8.1","@eslint-react/eslint-plugin":"1.52.2","@eslint/config-inspector":"1.1.0","@microsoft/api-extractor":"7.52.8","@next/eslint-plugin-next":"15.3.4","@testing-library/jest-dom":"6.6.3","@testing-library/react":"16.3.0","@types/body-parser":"1.19.6","@types/compression":"1.8.1","@types/cookie-parser":"1.4.9","@types/cors":"2.8.19","@types/crypto-js":"4.2.2","@types/express":"4.17.21","@types/express-session":"1.18.2","@types/express-useragent":"1.0.5","@types/fs-extra":"11.0.4","@types/migrate-mongo":"10.0.5","@types/node":"24.0.3","@types/node-persist":"3.1.8","@types/react":"19.1.8","@types/react-dom":"19.1.6","@types/unorm":"1.3.31","@types/uuid":"10.0.0","@types/ws":"8.18.1","@types/yargs":"17.0.33","@vitest/browser":"3.2.4","esbuild-sass-plugin":"3.3.1",eslint:"9.29.0","eslint-config-next":"15.3.4","eslint-plugin-format":"1.0.1","eslint-plugin-react-hooks":"5.2.0","eslint-plugin-react-refresh":"0.4.20","lint-staged":"16.1.2","node-modules-inspector":"1.0.0",playwright:"1.53.1",postcss:"8.5.6","postcss-modules":"6.0.1","simple-git-hooks":"2.13.0",tsup:"8.5.0",tsx:"4.20.3",typescript:"5.8.3",vitest:"3.2.4"},publishConfig:{access:"public",registry:"https://registry.npmjs.org/"}};var eE=function(e){return e.CLI="CLI",e.STRING="STRING",e.FUNCTION="FUNCTION",e}({});import{exec as em}from"child_process";import eg from"process";import*as eh from"util";var ey=function(e){return e.DEPENDENCY="dependencies",e.DEV_DEPENDENCY="devDependencies",e.PEER_DEPENDENCY="peerDependencies",e.BUNDLE_DEPENDENCY="bundleDependencies",e.OPTIONAL_DEPENDENCY="optionalDependencies",e}({});import ev from"node-fetch";import eS from"fs-extra";import eO from"path";var eC=eS,eD=eS.lstatSync,e_=eS.readdirSync,eI=eS.mkdirSync,eN=eS.readFileSync,eb=eS.unlinkSync,eT=eS.statSync,eA=eS.readJsonSync;function eR(e,t,n){eS.writeFileSync(e,t,n!==null&&n!==void 0?n:"utf-8")}M(eR,"writeFileSync");function ex(e,t,n){eS.appendFileSync(e,t,n!==null&&n!==void 0?n:"utf-8")}M(ex,"appendFileSync");function eG(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return t.every(function(e){return eS.pathExistsSync(e)})}M(eG,"pathExistsSync");function eP(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}t.forEach(function(e){eG(e)&&eS.removeSync(e)})}M(eP,"removeSync");function eM(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=n.extensions,s=O(n,["extensions"]);eS.copySync(e,t,y({filter:M(function(e){return eT(e).isDirectory()||!r||r.length===0?!0:r.includes(eO.extname(e))},"filter")},s))}M(eM,"copySync");import ew from"fs-extra";import eL from"path";var ej=en(),ek=eL;function eU(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=ek).resolve.apply(r,[ej.CWD].concat(b(t)))}M(eU,"resolveWorkingPath");function eF(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=ek).resolve.apply(r,b(t))}M(eF,"resolve");function eV(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=ek).join.apply(r,b(t))}M(eV,"join");var eq=en(),eY=eq.CWD,eK="@cyberskill/shared",eB="node_modules",eH="dist",eQ="public",eW="package.json",eJ="package-lock.json",e$="tsconfig.json",eX=".gitignore",ez=".simple-git-hooks.json",eZ="pnpm-lock.yaml",e0=".git/hooks/",e1=".git/COMMIT_EDITMSG",e2=".migrate-mongo.config.js",e4=function(){var e=ew.readJsonSync(eU(eW)).name===eK?eY:eV(eY,eB,eK);return eV(e,eH)}(),e3="cyberskill",e5="src/node/cli/index.ts",e8="eslint",e6="eslint",e7="vitest",e9="playwright",te="vitest",tt="@commitlint/cli",tn="@commitlint/config-conventional",tr="commitlint",ts="lint-staged",ti="lint-staged",to="typescript",ta="tsc",tc="tsx",tu="git",tl="pnpm",td="pnpm exec",tp="simple-git-hooks",tf="simple-git-hooks",tE="@eslint/config-inspector",tm="eslint-config-inspector",tg="node-modules-inspector",th="node-modules-inspector",ty="migrate-mongo",tv="./node_modules/migrate-mongo/bin/migrate-mongo",tS={CYBERSKILL_DIRECTORY:e4,WORKING_DIRECTORY:eY,PUBLIC_DIRECTORY:eU(eQ),TS_CONFIG:eU(e$),GIT_IGNORE:eU(eX),GIT_HOOK:eU(e0),GIT_COMMIT_MSG:eU(e1),SIMPLE_GIT_HOOKS_JSON:eU(ez),PACKAGE_JSON:eU(eW),PACKAGE_LOCK_JSON:eU(eJ),PNPM_LOCK_YAML:eU(eZ),NODE_MODULES:eU(eB),MIGRATE_MONGO_CONFIG:eU(e2),LINT_STAGED_CONFIG:eU("".concat(e4,"/config/lint-staged/index.js")),COMMITLINT_CONFIG:eU("".concat(e4,"/config/commitlint/index.js")),VITEST_UNIT_CONFIG:eU("".concat(e4,"/config/vitest/vitest.unit.js")),VITEST_UNIT_SETUP_CONFIG:eU("".concat(e4,"/config/vitest/vitest.unit.setup.js")),VITEST_E2E_CONFIG:eU("".concat(e4,"/config/vitest/vitest.e2e.js"))};function tO(e){var t=e.isCurrentProject;return y({"pre-commit":ti,"commit-msg":tr},t&&{"pre-push":tY("".concat(tu," pull"))})}M(tO,"createGitHooksConfig");function tC(e){var t=e.type,n=e.packages,r=e.command;var s=n===null||n===void 0?void 0:n.reduce(function(e,t){return e.some(function(e){return e.name===t.name})||e.push(t),e},[]);return function(){return i(function(){var e;return x(this,function(n){switch(n.label){case 0:switch(t){case eE.CLI:return[3,1];case eE.STRING:return[3,4]}return[3,5];case 1:e=s===null||s===void 0?void 0:s.length;if(!e)return[3,3];return[4,tA(s,{install:!0})];case 2:e=n.sent();n.label=3;case 3:return[2,(e,tB(tY("".concat(td," ").concat(r))))];case 4:return[2,tB(tY(r))];case 5:throw new Error("Unsupported command type");case 6:return[2]}})})()}}M(tC,"buildCommand");var tD={simpleGitHooks:tC({type:eE.CLI,packages:[{name:tp,type:ey.DEV_DEPENDENCY}],command:tf}),eslintInspect:tC({type:eE.CLI,packages:[{name:tE,type:ey.DEV_DEPENDENCY}],command:tm}),nodeModulesInspect:tC({type:eE.CLI,packages:[{name:tg,type:ey.DEV_DEPENDENCY}],command:th}),eslintCheck:tC({type:eE.CLI,packages:[{name:e8,type:ey.DEV_DEPENDENCY}],command:"".concat(e6," ").concat(tS.WORKING_DIRECTORY," --no-cache")}),eslintFix:tC({type:eE.CLI,packages:[{name:e8,type:ey.DEV_DEPENDENCY}],command:"".concat(e6," ").concat(tS.WORKING_DIRECTORY," --fix --no-cache")}),typescriptCheck:tC({type:eE.CLI,packages:[{name:to,type:ey.DEV_DEPENDENCY}],command:"".concat(ta," -p ").concat(tS.TS_CONFIG," --noEmit")}),testUnit:tC({type:eE.CLI,packages:[{name:e7,type:ey.DEV_DEPENDENCY}],command:"".concat(te," --config ").concat(tS.VITEST_UNIT_CONFIG)}),testE2e:tC({type:eE.CLI,packages:[{name:e7,type:ey.DEV_DEPENDENCY}],command:"".concat(te," --config ").concat(tS.VITEST_E2E_CONFIG)}),mongoMigrateCreate:M(function(e){return tC({type:eE.CLI,packages:[{name:tc,type:ey.DEPENDENCY},{name:ty,type:ey.DEPENDENCY}],command:"".concat(tc," ").concat(tv," create ").concat(e," -f ").concat(tS.MIGRATE_MONGO_CONFIG)})()},"mongoMigrateCreate"),mongoMigrateUp:tC({type:eE.CLI,packages:[{name:tc,type:ey.DEPENDENCY},{name:ty,type:ey.DEPENDENCY}],command:"".concat(tc," ").concat(tv," up -f ").concat(tS.MIGRATE_MONGO_CONFIG)}),mongoMigrateDown:tC({type:eE.CLI,packages:[{name:tc,type:ey.DEPENDENCY},{name:ty,type:ey.DEPENDENCY}],command:"".concat(tc," ").concat(tv," down -f ").concat(tS.MIGRATE_MONGO_CONFIG)}),commitLint:tC({type:eE.CLI,packages:[{name:tt,type:ey.DEV_DEPENDENCY},{name:tn,type:ey.DEV_DEPENDENCY}],command:"".concat(tr," --edit ").concat(tS.GIT_COMMIT_MSG," --config ").concat(tS.COMMITLINT_CONFIG)}),lintStaged:tC({type:eE.CLI,packages:[{name:ts,type:ey.DEV_DEPENDENCY}],command:"".concat(ti," --config ").concat(tS.LINT_STAGED_CONFIG)}),configureGitHook:tC({type:eE.STRING,command:"".concat(tu," config core.hooksPath ").concat(tS.GIT_HOOK)}),build:tC({type:eE.STRING,command:"".concat(tl," run --if-present build")}),pnpmInstallStandard:tC({type:eE.STRING,command:"".concat(tl," install --ignore-scripts")}),pnpmInstallLegacy:tC({type:eE.STRING,command:"".concat(tl," install --ignore-scripts --legacy-peer-deps")}),pnpmInstallForce:tC({type:eE.STRING,command:"".concat(tl," install --ignore-scripts --force")}),pnpmPruneStore:tC({type:eE.STRING,command:"".concat(tl," store prune")}),pnpmCleanCache:tC({type:eE.STRING,command:"".concat(tl," cache delete")})};var t_=en();function tI(e){return i(function(){var t,n,r,s;return x(this,function(i){switch(i.label){case 0:i.trys.push([0,3,,4]);return[4,ev("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:t=i.sent();if(!t.ok)throw new Error("Failed to fetch latest version: ".concat(t.status," ").concat(t.statusText));return[4,t.json()];case 2:n=i.sent(),r=n.version;return[2,{success:!0,result:r}];case 3:s=i.sent();return[2,ec(s)];case 4:return[2]}})})()}M(tI,"getLatestPackageVersion");function tN(e){return i(function(){var t,n,r,s,i,o,a,c,u,l,d,p,f,E,m,g,h,y,v,S,O,C,D,_;return x(this,function(I){switch(I.label){case 0:I.trys.push([0,2,,3]);if(!e){if(eG(tS.PACKAGE_JSON)){t=eA(tS.PACKAGE_JSON),n=t.name,r=n===void 0?"":n,s=t.version,i=s===void 0?"":s;return[2,{success:!0,result:{name:r,currentVersion:i,latestVersion:i,isCurrentProject:!0,isInstalled:!0,isUpToDate:!0,isDependency:!1,isDevDependency:!1,installedPath:tS.PACKAGE_JSON,file:t}}]}return[2,{success:!0,result:{name:"",currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:!1,isDevDependency:!1,installedPath:"",file:{}}}]}if(!eG(tS.PACKAGE_JSON))return[2,{success:!0,result:{name:e.name,currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:e.type===ey.DEPENDENCY,isDevDependency:e.type===ey.DEV_DEPENDENCY,installedPath:"",file:{}}}];o=eA(tS.PACKAGE_JSON),a=o.name,c=o.version,u=c===void 0?"":c,l=o.dependencies,d=l===void 0?{}:l,p=o.devDependencies,f=p===void 0?{}:p;if(e.name===a)return[2,{success:!0,result:{name:a,currentVersion:u,latestVersion:u,isCurrentProject:!0,isInstalled:!0,isUpToDate:!0,isDependency:e.type===ey.DEPENDENCY,isDevDependency:e.type===ey.DEV_DEPENDENCY,installedPath:tS.PACKAGE_JSON,file:o}}];E=e.name in d,m=e.name in f;return[4,tI(e.name)];case 1:g=I.sent();if(!g.success)return[2,{success:!0,result:{name:e.name,currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:E,isDevDependency:m,installedPath:"",file:{}}}];if(!E&&!m)return[2,{success:!0,result:{name:e.name,currentVersion:"",latestVersion:g.result,isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:e.type===ey.DEPENDENCY,isDevDependency:e.type===ey.DEV_DEPENDENCY,installedPath:"",file:{}}}];v=(y=(h=d[e.name])!==null&&h!==void 0?h:f[e.name])!==null&&y!==void 0?y:"",S=eV(t_.CWD,eB,e.name,eW);if(!eG(S))return[2,{success:!0,result:{name:e.name,currentVersion:"",latestVersion:g.result,isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:E,isDevDependency:m,installedPath:"",file:{}}}];O=eA(S),C=O.version,D=C===void 0?"":C;return[2,v!==D?{success:!0,result:{name:e.name,currentVersion:D||v,latestVersion:g.result,isCurrentProject:!1,isInstalled:!0,isUpToDate:!1,isDependency:E,isDevDependency:m,installedPath:S,file:O}}:{success:!0,result:{name:e.name,currentVersion:v,latestVersion:g.result,isCurrentProject:!1,isInstalled:!0,isUpToDate:v===g.result,isDependency:E,isDevDependency:m,installedPath:S,file:O}}];case 2:_=I.sent();return[2,ec(_)];case 3:return[2]}})})()}M(tN,"getPackage");function tb(e){return i(function(){var t,n,r,s,i;return x(this,function(o){try{;r=eA(tS.PACKAGE_JSON),s=(t=r.dependencies)!==null&&t!==void 0?t:{},i=(n=r.devDependencies)!==null&&n!==void 0?n:{};e.isDependency?s[e.name]=e.latestVersion:e.isDevDependency&&(i[e.name]=e.latestVersion),eR(tS.PACKAGE_JSON,JSON.stringify(r,null,4)),ea.info('Updated "'.concat(e.name,'" to version ').concat(e.latestVersion))}catch(e){ec(e)}return[2]})})()}M(tb,"updatePackage");function tT(){return i(function(){var e,t,n,r,s,i,o,a,c,u,l,d,p;return x(this,function(f){switch(f.label){case 0:f.trys.push([0,12,,13]);e=[{command:M(function(){return tD.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:M(function(){return tD.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:M(function(){return tD.pnpmInstallForce()},"command"),message:"Retrying with force install"}];t=true,n=false,r=undefined;f.label=1;case 1:f.trys.push([1,9,10,11]);s=e[Symbol.iterator]();f.label=2;case 2:if(!!(t=(i=s.next()).done))return[3,8];o=i.value,a=o.command,c=o.message;f.label=3;case 3:f.trys.push([3,6,,7]);return[4,a()];case 4:u=f.sent();return[4,tQ("".concat(c," using: ").concat(u),u)];case 5:f.sent();return[2];case 6:l=f.sent();ec(l);return[3,7];case 7:t=true;return[3,2];case 8:return[3,11];case 9:d=f.sent();n=true;r=d;return[3,11];case 10:try{if(!t&&s.return!=null){s.return()}}finally{if(n){throw r}}return[7];case 11:return[3,13];case 12:p=f.sent();ec(p);return[3,13];case 13:return[2]}})})()}M(tT,"installDependencies");function tA(e,t){return i(function(){var n,r,s,i,o,a,c,u,l,d,p,f,E,m,g,h,y;return x(this,function(v){switch(v.label){case 0:v.trys.push([0,15,,16]);if(!eG(tS.PACKAGE_JSON)){ea.error("package.json not found. Aborting setup.");return[2]}return[4,Promise.all(e.map(tN))];case 1:s=v.sent().filter(function(e){return e.success&&!!e.result&&!e.result.isCurrentProject}).map(function(e){return e.result}),i=s.filter(function(e){return!e.isInstalled}),o=s.filter(function(e){return!e.isUpToDate}),a=[];(t===null||t===void 0?void 0:t.install)&&i.length>0&&(n=a).push.apply(n,b(i.map(tb))),(t===null||t===void 0?void 0:t.update)&&o.length>0&&(r=a).push.apply(r,b(o.map(tb)));c=a.length>0;if(!c)return[3,6];return[4,Promise.all(a)];case 2:v.sent();return[4,tT()];case 3:v.sent();u=["Running ESLint with auto-fix"];return[4,tD.eslintFix()];case 4:return[4,tQ.apply(void 0,u.concat([v.sent()]))];case 5:c=v.sent();v.label=6;case 6:c;d=true,p=false,f=undefined;v.label=7;case 7:v.trys.push([7,12,13,14]);E=((l=t===null||t===void 0?void 0:t.callbacks)!==null&&l!==void 0?l:[])[Symbol.iterator]();v.label=8;case 8:if(!!(d=(m=E.next()).done))return[3,11];g=m.value;return[4,g()];case 9:v.sent();v.label=10;case 10:d=true;return[3,8];case 11:return[3,14];case 12:h=v.sent();p=true;f=h;return[3,14];case 13:try{if(!d&&E.return!=null){E.return()}}finally{if(p){throw f}}return[7];case 14:return[3,16];case 15:y=v.sent();ec(y);return[3,16];case 16:return[2]}})})()}M(tA,"setupPackages");import tR from"node-persist";var tx=en();function tG(){return i(function(){var e;return x(this,function(t){switch(t.label){case 0:e=tR.defaultInstance;if(e)return[3,2];return[4,tR.init({dir:tx.CYBERSKILL_STORAGE_DIRECTORY})];case 1:e=t.sent();t.label=2;case 2:e;return[2]}})})()}M(tG,"initNodePersist");var tP={get:function e(e){return i(function(){var t,n;return x(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,tG()];case 1:r.sent();return[4,tR.getItem(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:null];case 3:n=r.sent();return[2,ec(n,{returnValue:null})];case 4:return[2]}})})()},set:function e(e,t){return i(function(){var n;return x(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,tG()];case 1:r.sent();return[4,tR.setItem(e,t)];case 2:r.sent();return[3,4];case 3:n=r.sent();ec(n);return[3,4];case 4:return[2]}})})()},remove:function e(e){return i(function(){var t;return x(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,tG()];case 1:n.sent();return[4,tR.removeItem(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();ec(t);return[3,4];case 4:return[2]}})})()},keys:function e(){return i(function(){var e,t;return x(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,tG()];case 1:n.sent();return[4,tR.keys()];case 2:e=n.sent();return[2,Array.isArray(e)?e:(ea.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=n.sent();return[2,ec(t,{returnValue:[]})];case 4:return[2]}})})()},getLogLink:function e(e){return i(function(){return x(this,function(t){try{return[2,"".concat(tx.CYBERSKILL_STORAGE_DIRECTORY," (key: ").concat(e,")")]}catch(e){return[2,ec(e,{returnValue:null})]}return[2]})})()}};var tM=en(),tw=eh.promisify(em);function tL(){return i(function(){var e;return x(this,function(t){switch(t.label){case 0:return[4,tN()];case 1:e=t.sent();return[2,e.success?e.result.name:Date.now().toString()]}})})()}M(tL,"getPackageName");function tj(e){return i(function(){var t,n;return x(this,function(r){switch(r.label){case 0:if(e.length===0)return[2];return[4,tL()];case 1:t=r.sent();r.label=2;case 2:r.trys.push([2,4,,5]);return[4,tP.set(t,e)];case 3:r.sent(),setTimeout(function(){return i(function(){var e;return x(this,function(n){switch(n.label){case 0:return[4,tP.getLogLink(t)];case 1:e=n.sent();e&&ea.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})})()},0);return[3,5];case 4:n=r.sent();ec(n);return[3,5];case 5:return[2]}})})()}M(tj,"saveErrorListToStorage");function tk(){return i(function(){var e,t,n;return x(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,tL()];case 1:e=r.sent();return[4,tP.get(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:[]];case 3:n=r.sent();return[2,ec(n,{returnValue:[]})];case 4:return[2]}})})()}M(tk,"getStoredErrorLists");function tU(){return i(function(){var e,t;return x(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,tL()];case 1:e=n.sent();return[4,tP.remove(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();ec(t);return[3,4];case 4:return[2]}})})()}M(tU,"clearAllErrorLists");function tF(e){var t=[],n=[],r="",s=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,i=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,o=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))r=e.trim();else{var a,c,u,l,d;var p=s.exec(e)||[],f=i.exec(e)||[],E=o.exec(e)||[];var m,g,h,y,v,S;p.length&&r?t.push({file:r,position:"".concat(p[1],":").concat(p[2]),type:p[3]===V.Error?V.Error:V.Warning,message:(m=p===null||p===void 0?void 0:(a=p[4])===null||a===void 0?void 0:a.trim())!==null&&m!==void 0?m:"",rule:(g=p===null||p===void 0?void 0:(c=p[5])===null||c===void 0?void 0:c.trim())!==null&&g!==void 0?g:""}):f.length?t.push({file:(h=f===null||f===void 0?void 0:f[1])!==null&&h!==void 0?h:"",position:"".concat(f[2],":").concat(f[3]),type:f[4]===V.Error?V.Error:V.Warning,message:(y=f===null||f===void 0?void 0:(u=f[5])===null||u===void 0?void 0:u.trim())!==null&&y!==void 0?y:""}):E.length?t.push({file:"commitlint",type:V.Error,message:(v=E===null||E===void 0?void 0:(l=E[1])===null||l===void 0?void 0:l.trim())!==null&&v!==void 0?v:"",rule:(S=E===null||E===void 0?void 0:(d=E[2])===null||d===void 0?void 0:d.trim())!==null&&S!==void 0?S:""}):n.push(e.trim())}}),t.length&&tj(t),tM.DEBUG&&n.length&&(ea.warn("Unmatched lines:"),n.forEach(function(e){return ea.info(" ".concat(e))}))}M(tF,"parseTextErrors");function tV(e){try{var t=JSON.parse(e),n=[];t.forEach(function(e){var t=e.filePath,r=e.messages;r.forEach(function(e){var r=e.severity,s=e.line,i=e.column,o=e.ruleId,a=e.message;n.push({type:r===2?V.Error:V.Warning,file:t,position:"".concat(s,":").concat(i),rule:o,message:a})})}),n.length&&tj(n)}catch(t){tF(e)}}M(tV,"parseCommandOutput");function tq(e){return i(function(e){var t,n,r,s,i,o,a,c,u;var l=arguments;return x(this,function(d){switch(d.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:tV;n=new AbortController;eg.on("SIGINT",function(){ea.warn("Process interrupted. Terminating..."),n.abort(),eg.exit()});d.label=1;case 1:d.trys.push([1,4,,5]);if(!(typeof e=="string"))return[3,3];return[4,tw(e,{maxBuffer:0x6400000,signal:n.signal})];case 2:r=d.sent(),s=r.stdout,i=r.stderr;[s,i].forEach(function(e){return e&&t(e)});d.label=3;case 3:return[3,5];case 4:o=d.sent();a=o.stdout,c=o.stderr,u=o.message;[a,c].forEach(function(e){return e&&t(e)}),!c&&!a&&ea.error("Command failed: ".concat(u));return[3,5];case 5:return[2]}})}).apply(this,arguments)}M(tq,"executeCommand");function tY(e){return{raw:!0,cmd:e}}M(tY,"rawCommand");function tK(e,t){return(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(td," ").concat(tc," ").concat(e5," ").concat(e):"".concat(td," ").concat(e3," ").concat(e)}M(tK,"formatCLI");function tB(e,t){return typeof e=="function"?tK(e(t),t):(typeof e==="undefined"?"undefined":T(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?tK(e,t):e}M(tB,"formatCommand");function tH(e){return i(function(){var t,n,r;return x(this,function(s){switch(s.label){case 0:return[4,tN({name:eK})];case 1:t=s.sent();if(t.success){n={isCurrentProject:t.result.isCurrentProject},r=typeof e=="function"?e(n):e;return[2,Object.fromEntries(Object.entries(r).map(function(e){var t=I(e,2),r=t[0],s=t[1];return[r,tB(s,n)]}))]}return[2]}})})()}M(tH,"resolveCommands");function tQ(e,t){return i(function(){var n;return x(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);ea.start("".concat(e)),tM.DEBUG&&ea.info("→ ".concat(t));return[4,tq(t)];case 1:r.sent(),ea.success("".concat(e," done."));return[3,3];case 2:n=r.sent();ec(n);return[3,3];case 3:return[2]}})})()}M(tQ,"runCommand");function tW(){return i(function(){var e,t;return x(this,function(n){switch(n.label){case 0:if(!eG(tS.TS_CONFIG))return[3,3];t=["Performing TypeScript validation"];return[4,tD.typescriptCheck()];case 1:return[4,tQ.apply(void 0,t.concat([n.sent()]))];case 2:e=n.sent();return[3,4];case 3:e=ea.warn("No TypeScript configuration found. Skipping type check.");n.label=4;case 4:e;return[2]}})})()}M(tW,"checkTypescript");function tJ(){return i(function(){var e,t,n,r;var s=arguments;return x(this,function(i){switch(i.label){case 0:e=s.length>0&&s[0]!==void 0?s[0]:!1;if(!e)return[3,3];n=["Running ESLint with auto-fix"];return[4,tD.eslintFix()];case 1:return[4,tQ.apply(void 0,n.concat([i.sent()]))];case 2:t=i.sent();return[3,6];case 3:r=["Running ESLint check"];return[4,tD.eslintCheck()];case 4:return[4,tQ.apply(void 0,r.concat([i.sent()]))];case 5:t=i.sent();i.label=6;case 6:t;return[2]}})}).apply(this,arguments)}M(tJ,"checkEslint");function t$(e,t){if(!t.length)return;var n=e==="Errors"?"red":"yellow";ea.printBoxedLog(e==="Errors"?"✖ Errors":"⚠ Warnings",t,n)}M(t$,"printIssues");function tX(){return i(function(){return x(this,function(e){setTimeout(function(){return i(function(){var e,t,n;return x(this,function(r){switch(r.label){case 0:return[4,tk()];case 1:e=r.sent(),t=e.filter(function(e){return e.type===V.Error}),n=e.filter(function(e){return e.type===V.Warning});!t.length&&!n.length?ea.printBoxedLog("✔ NO ISSUES FOUND",[],"green"):(t$("Warnings",n),t$("Errors",t),(t.length>0||n.length>0)&&el.exit(1));return[2]}})})()},0);return[2]})})()}M(tX,"showCheckResult");function tz(){return i(function(){var e,t,n,r;return x(this,function(s){switch(s.label){case 0:return[4,tU()];case 1:s.sent();return[4,tN({name:eK})];case 2:e=s.sent();if(!e.success){ea.error("Failed to retrieve package information. Aborting lint-staged.");return[2]}t=e.result.isCurrentProject;if(!t)return[3,5];n=["Building package: ".concat(eK)];return[4,tD.build()];case 3:return[4,tQ.apply(void 0,n.concat([s.sent()]))];case 4:t=s.sent();s.label=5;case 5:t;r=["Executing lint-staged"];return[4,tD.lintStaged()];case 6:return[4,tQ.apply(void 0,r.concat([s.sent()]))];case 7:s.sent(),tX();return[2]}})})()}M(tz,"lintStaged");function tZ(){return i(function(){var e;return x(this,function(t){switch(t.label){case 0:e=["Inspecting ESLint configuration"];return[4,tD.eslintInspect()];case 1:return[4,tQ.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}M(tZ,"inspectLint");function t0(){return i(function(){return x(this,function(e){switch(e.label){case 0:return[4,tU()];case 1:e.sent();return[4,Promise.all([tW(),tJ()])];case 2:e.sent(),tX();return[2]}})})()}M(t0,"lintCheck");function t1(){return i(function(){return x(this,function(e){switch(e.label){case 0:return[4,tU()];case 1:e.sent();return[4,Promise.all([tW(),tJ(!0)])];case 2:e.sent(),tX();return[2]}})})()}M(t1,"lintFix");function t2(){return i(function(){var e;return x(this,function(t){switch(t.label){case 0:return[4,tU()];case 1:t.sent();e=["Validating commit message"];return[4,tD.commitLint()];case 2:return[4,tQ.apply(void 0,e.concat([t.sent()]))];case 3:t.sent(),tX();return[2]}})})()}M(t2,"commitLint");function t4(){return i(function(){var e,t,n,r;return x(this,function(s){switch(s.label){case 0:e=["Configuring Git hooks"];return[4,tD.configureGitHook()];case 1:return[4,tQ.apply(void 0,e.concat([s.sent()]))];case 2:s.sent(),eP(tS.GIT_HOOK);return[4,tH(tO)];case 3:t=s.sent();eR(tS.SIMPLE_GIT_HOOKS_JSON,JSON.stringify(t,null,4));n="\n".concat(ez,"\n");eG(tS.GIT_IGNORE)?eN(tS.GIT_IGNORE,"utf-8").split("\n").includes(ez)||ex(tS.GIT_IGNORE,n):eR(tS.GIT_IGNORE,n);r=["Setting up simple-git-hooks"];return[4,tD.simpleGitHooks()];case 4:return[4,tQ.apply(void 0,r.concat([s.sent()]))];case 5:s.sent();return[2]}})})()}M(t4,"setupGitHook");function t3(){return i(function(){return x(this,function(e){switch(e.label){case 0:return[4,tT()];case 1:e.sent();return[4,t4()];case 2:e.sent();return[2]}})})()}M(t3,"ready");function t5(){return i(function(){var e,t;return x(this,function(n){switch(n.label){case 0:eP(tS.NODE_MODULES,tS.PNPM_LOCK_YAML);e=["Pruning pnpm store"];return[4,tD.pnpmPruneStore()];case 1:return[4,tQ.apply(void 0,e.concat([n.sent()]))];case 2:n.sent();t=["Clearing pnpm cache"];return[4,tD.pnpmCleanCache()];case 3:return[4,tQ.apply(void 0,t.concat([n.sent()]))];case 4:n.sent();return[4,tT()];case 5:n.sent();return[4,t4()];case 6:n.sent();return[2]}})})()}M(t5,"reset");function t8(){return i(function(){var e;return x(this,function(t){switch(t.label){case 0:e=["Inspecting project dependencies"];return[4,tD.nodeModulesInspect()];case 1:return[4,tQ.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}M(t8,"inspect");function t6(){return i(function(){var e;return x(this,function(t){switch(t.label){case 0:e=["Running unit tests"];return[4,tD.testUnit()];case 1:return[4,tQ.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}M(t6,"testUnit");function t7(){return i(function(){var e;return x(this,function(t){switch(t.label){case 0:e=["Running end-to-end tests"];return[4,tD.testE2e()];case 1:return[4,tQ.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}M(t7,"testE2E");function t9(e){return i(function(){var t;return x(this,function(n){switch(n.label){case 0:t=["Creating MongoDB migration"];return[4,tD.mongoMigrateCreate(e)];case 1:return[4,tQ.apply(void 0,t.concat([n.sent()]))];case 2:n.sent();return[2]}})})()}M(t9,"mongoMigrateCreate");function ne(){return i(function(){var e;return x(this,function(t){switch(t.label){case 0:e=["Running MongoDB migrations"];return[4,tD.mongoMigrateUp()];case 1:return[4,tQ.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}M(ne,"mongoMigrateUp");function nt(){return i(function(){var e;return x(this,function(t){switch(t.label){case 0:e=["Rolling back MongoDB migration"];return[4,tD.mongoMigrateDown()];case 1:return[4,tQ.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}M(nt,"mongoMigrateDown");(function(){return i(function(){var e;return x(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,ep(ed(el.argv)).scriptName(e3).usage("$0 <command> [options]").command("lint","Check code for linting issues",t0).command("lint:fix","Fix linting issues automatically",t1).command("lint:inspect","View active ESLint configuration",tZ).command("lint-staged","Run lint checks on staged files",tz).command("commitlint","Validate commit message format",t2).command("ready","Initialize project and dependencies",t3).command("reset","Reset the project and reinstall dependencies",t5).command("inspect","Analyze installed project dependencies",t8).command("test:unit","Run unit test suite",t6).command("test:e2e","Run end-to-end test suite",t7).command("mongo:migrate:create <name>","Create a MongoDB migration",function(e){return e.positional("name",{describe:"Migration name",type:"string"})},function(e){return i(function(){return x(this,function(t){switch(t.label){case 0:if(!e.name){ea.error("Migration name is required.");return[2]}return[4,t9(e.name)];case 1:t.sent();return[2]}})})()}).command("mongo:migrate:up","Apply all MongoDB migrations",ne).command("mongo:migrate:down","Rollback last MongoDB migration",nt).demandCommand(1,"Please specify a valid command.").strict().help().alias("h","help").alias("v","version").version(ef.version).epilog('\uD83D\uDCA1 Tip: Use "--help" with any command to see options\n').parse()];case 1:t.sent();return[3,3];case 2:e=t.sent();ec(e),el.exit(1);return[3,3];case 3:return[2]}})})()})();import{Router as nn}from"express";import{NestFactory as nr}from"@nestjs/core";import ns from"body-parser";import ni from"compression";import no from"cookie-parser";import na from"cors";import nc from"express";import nu from"express-session";import nl from"express-useragent";function nd(e){var t=e.isDev,n=e.whiteList,r=O(e,["isDev","whiteList"]);return y({origin:M(function(e,r){t||!e||(n===null||n===void 0?void 0:n.includes(e!==null&&e!==void 0?e:""))?r(null,!0):r(new Error("Not allowed by CORS"),!1)},"origin"),credentials:!0},r)}M(nd,"createCorsOptions");function np(e){return na(nd(e))}M(np,"createCors");function nf(e){return nu(e)}M(nf,"createSession");function nE(e){var t=nc();return t.set("trust proxy",1),t.use(no()),t.use(nc.urlencoded({extended:!0})),t.use(ni()),t.use(nl.express()),(e===null||e===void 0?void 0:e.staticFolder)&&t.use(nc.static(e.staticFolder)),t}M(nE,"createExpress");function nm(e){return i(function(){var t,n,r;return x(this,function(s){switch(s.label){case 0:return[4,nr.create(e.module)];case 1:r=s.sent();return[2,(r.getHttpAdapter().getInstance().set("trust proxy",1),r.use(nc.urlencoded({extended:!0})),r.use(no()),r.use(ni()),r.use(nl.express()),e.staticFolder&&r.use(nc.static(e.staticFolder)),e.filters&&(t=r).useGlobalFilters.apply(t,b(e.filters)),e.pipes&&(n=r).useGlobalPipes.apply(n,b(e.pipes)),r)]}})})()}M(nm,"createNest");var ng="MONGO_MIGRATE_OPTIONS";import{Collection as nh,Db as ny}from"mongodb";import{Document as nv,Model as nS}from"mongoose";var nO=/*#__PURE__*/function(e){"use strict";p(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(ny);M(nO,"C_Db");var nC=nO,nD=/*#__PURE__*/function(e){"use strict";p(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(nv);M(nD,"C_Document");var n_=nD,nI=/*#__PURE__*/function(e){"use strict";p(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(nS);M(nI,"C_Model");var nN=nI,nb=/*#__PURE__*/function(e){"use strict";p(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(nh);M(nb,"C_Collection");var nT=nb;import{format as nA}from"date-fns";import nR from"migrate-mongo";import{Document as nx}from"mongoose";import nG from"mongoose-aggregate-paginate-v2";import nP from"mongoose-paginate-v2";import{v4 as nM}from"uuid";import nw from"unorm";var nL={a:["\xe0","\xe1","ạ","ả","\xe3","\xe2","ầ","ấ","ậ","ẩ","ẫ","ă","ằ","ắ","ặ","ẳ","ẵ"],e:["\xe8","\xe9","ẹ","ẻ","ẽ","\xea","ề","ế","ệ","ể","ễ"],i:["\xec","\xed","ị","ỉ","ĩ"],o:["\xf2","\xf3","ọ","ỏ","\xf5","\xf4","ồ","ố","ộ","ổ","ỗ","ơ","ờ","ớ","ợ","ở","ỡ"],u:["\xf9","\xfa","ụ","ủ","ũ","ư","ừ","ứ","ự","ử","ữ"],y:["ỳ","\xfd","ỵ","ỷ","ỹ"],d:["đ"]},nj=Object.entries(nL).reduce(function(e,t){var n=I(t,2),r=n[0],s=n[1];return e[r.toUpperCase()]=s.map(function(e){return e.toUpperCase()}),e},{});function nk(e){e=nw.nfkc(e);var t=y({},nL,nj);var n=true,r=false,s=undefined;try{for(var i=Object.entries(t)[Symbol.iterator](),o;!(n=(o=i.next()).done);n=true){var a=I(o.value,2),c=a[0],u=a[1];var l="[".concat(c).concat(u.join(""),"]"),d="(".concat([c].concat(b(u)).join("|"),")");e=e.replace(new RegExp(l,"g"),d)}}catch(e){r=true;s=e}finally{try{if(!n&&i.return!=null){i.return()}}finally{if(r){throw s}}}return e}M(nk,"regexSearchMapper");function nU(e){return(typeof e==="undefined"?"undefined":T(e))=="object"&&e!==null&&!Array.isArray(e)}M(nU,"isObject");function nF(e){return JSON.parse(JSON.stringify(e))}M(nF,"deepClone");function nV(e,t){return t.reduce(function(e,t){if(e&&(typeof e==="undefined"?"undefined":T(e))=="object"&&t in e)return e[t]},e)}M(nV,"getNestedValue");function nq(e,t,n){if(t.length===0)return e;var r=N(t),s=r[0],i=r.slice(1);if(i.length===0)return S(y({},e),l({},s,n));var o=e[s];return S(y({},e),l({},s,nq((typeof o==="undefined"?"undefined":T(o))=="object"&&o!==null?o:{},i,n)))}M(nq,"setNestedValue");import nY from"crypto-js";import nK from"slugify";var nB=nK.default||nK;function nH(e,t){var n=M(function(e){var n,r;return nB(e!==null&&e!==void 0?e:"",y({lower:(n=t===null||t===void 0?void 0:t.lower)!==null&&n!==void 0?n:!0,locale:(r=t===null||t===void 0?void 0:t.locale)!==null&&r!==void 0?r:"vi"},t))},"slugifyWithOptions");if(nU(e)){var r={};var s=true,i=false,o=undefined;try{for(var a=Object.entries(e)[Symbol.iterator](),c;!(s=(c=a.next()).done);s=true){var u=I(c.value,2),l=u[0],d=u[1];r[l]=n(d)}}catch(e){i=true;o=e}finally{try{if(!s&&a.return!=null){a.return()}}finally{if(i){throw o}}}return r}return n(e)}M(nH,"generateSlug");function nQ(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:4;return nY.SHA256(e).toString(nY.enc.Hex).slice(0,t)}M(nQ,"generateShortId");var nW={isEmpty:function e(e){return e==null?!0:typeof e=="string"?e.trim().length===0:Array.isArray(e)?e.length===0:(typeof e==="undefined"?"undefined":T(e))=="object"?f(e,Date)?!1:f(e,Map)||f(e,Set)?e.size===0:f(e,WeakMap)||f(e,WeakSet)?!0:ArrayBuffer.isView(e)?e.byteLength===0:Object.keys(e).length===0:!1},isValidIP:function e(e){var t=e.split(".");return t.length===4&&t.every(function(e){return/^\d+$/.test(e)&&Number(e)>=0&&Number(e)<=255})?!0:/^(([a-f\d]{1,4}:){7}[a-f\d]{1,4}|((?:[a-f\d]{1,4}:){1,7}:)|((?:[a-f\d]{1,4}:){1,6}:[a-f\d]{1,4})|::)$/i.test(e)}};var nJ={getDateTime:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:new Date;return nA(e,"yyyy-MM-dd HH:mm:ss.SSS")},createGenericFields:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.returnDateAs,n=t===void 0?"string":t;var r=n==="string"?nJ.getDateTime():new Date;return{id:nM(),isDel:!1,createdAt:r,updatedAt:r}},applyPlugins:function e(e,t){t.filter(function(e){return typeof e=="function"}).forEach(function(t){return e.plugin(t)})},applyMiddlewares:function e(e,t){t.forEach(function(t){var n=t.method,r=t.pre,s=t.post;n&&r&&e.pre(n,r),n&&s&&e.post(n,s)})},createGenericSchema:function e(e){return new e.Schema({id:{type:String,default:nM,unique:!0},isDel:{type:Boolean,default:!1}},{timestamps:!0})},createSchema:function e(e){var t=e.mongoose,n=e.schema,r=e.virtuals,s=r===void 0?[]:r,i=e.standalone,o=i===void 0?!1:i;var a=new t.Schema(n);return s.forEach(function(e){var t=e.name,n=e.options,r=e.get;var s=a.virtual(t,n);r&&s.get(r)}),o||a.add(nJ.createGenericSchema(t)),a},createModel:function e(e){var t=e.mongoose,n=e.name,r=e.schema,s=e.pagination,i=s===void 0?!1:s,o=e.aggregate,a=o===void 0?!1:o,c=e.virtuals,u=c===void 0?[]:c,l=e.middlewares,d=l===void 0?[]:l;if(!n)throw new Error("Model name is required.");if(t.models[n])return t.models[n];var p=nJ.createSchema({mongoose:t,schema:r,virtuals:u});return nJ.applyPlugins(p,[i&&nP,a&&nG]),nJ.applyMiddlewares(p,d),t.model(n,p)},validator:{isRequired:function e(){return function(e){return i(function(){return x(this,function(t){return[2,!nW.isEmpty(e)]})})()}},isUnique:function e(e){return function(t){return i(function(){var n;return x(this,function(r){switch(r.label){case 0:if(!Array.isArray(e)||e.length===0)throw new Error("Fields must be a non-empty array of strings.");n={$or:e.map(function(e){return l({},e,t)})};return[4,this.constructor.exists(n)];case 1:return[2,!r.sent()]}})}).call(this)}},matchesRegex:function e(e){return function(t){return i(function(){return x(this,function(n){if(!Array.isArray(e)||e.some(function(e){return!f(e,RegExp)}))throw new Error("regexArray must be an array of valid RegExp objects.");return[2,e.every(function(e){return e.test(t)})]})})()}}},migrate:S(y({},nR),{setConfig:M(function(e){var t="// This file is automatically generated by the Cyberskill CLI.\nmodule.exports = ".concat(JSON.stringify(e,null,4));eR(tS.MIGRATE_MONGO_CONFIG,t);var n="\n".concat(e2,"\n");eG(tS.GIT_IGNORE)?eN(tS.GIT_IGNORE,"utf-8").split("\n").includes(e2)||ex(tS.GIT_IGNORE,n):eR(tS.GIT_IGNORE,n)},"setConfig")}),regexify:function e(e,t){if(!e)return{};var n=nF(e);if(!t||t.length===0)return n;var r=true,s=false,i=undefined;try{for(var o=t[Symbol.iterator](),a;!(r=(a=o.next()).done);r=true){var c=a.value;var u=c.toString().split("."),l=nV(n,u);if(typeof l=="string"&&l.length>0){var d={$regex:".*".concat(nk(l),".*"),$options:"i"};n=nq(n,u,d)}}}catch(e){s=true;i=e}finally{try{if(!r&&o.return!=null){o.return()}}finally{if(s){throw i}}}return n}},n$=/*#__PURE__*/function(){"use strict";function e(t,n){a(this,e);w(this,"collection");this.collection=t.collection(n)}u(e,[{key:"createOne",value:function e(e){return i(function(){var t,n;return x(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);t=y({},nJ.createGenericFields(),e);return[4,this.collection.insertOne(t)];case 1:return[2,r.sent().acknowledged?{success:!0,message:"Document created successfully",result:t}:{success:!1,message:"Document creation failed",code:er.INTERNAL_SERVER_ERROR.CODE}];case 2:n=r.sent();return[2,ec(n)];case 3:return[2]}})}).call(this)}},{key:"createMany",value:function e(e){return i(function(){var t,n,r;return x(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);t=e.map(function(e){return y({},nJ.createGenericFields(),e)});return[4,this.collection.insertMany(t)];case 1:n=s.sent();return[2,n.insertedCount===0?{success:!1,message:"No documents were inserted",code:er.INTERNAL_SERVER_ERROR.CODE}:{success:!0,message:"".concat(n.insertedCount," documents created successfully"),result:t}];case 2:r=s.sent();return[2,ec(r)];case 3:return[2]}})}).call(this)}},{key:"findOne",value:function e(e){return i(function(){var t,n;return x(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,this.collection.findOne(e)];case 1:t=r.sent();return[2,t?{success:!0,message:"Document found",result:t}:{success:!1,message:"Document not found",code:er.NOT_FOUND.CODE}];case 2:n=r.sent();return[2,ec(n)];case 3:return[2]}})}).call(this)}},{key:"findAll",value:function e(){return i(function(){var e,t,n;var r=arguments;return x(this,function(s){switch(s.label){case 0:e=r.length>0&&r[0]!==void 0?r[0]:{};s.label=1;case 1:s.trys.push([1,3,,4]);t={success:!0,message:"Documents retrieved successfully"};return[4,this.collection.find(e).toArray()];case 2:return[2,(t.result=s.sent(),t)];case 3:n=s.sent();return[2,ec(n)];case 4:return[2]}})}).apply(this,arguments)}},{key:"count",value:function e(){return i(function(){var e,t,n;var r=arguments;return x(this,function(s){switch(s.label){case 0:e=r.length>0&&r[0]!==void 0?r[0]:{};s.label=1;case 1:s.trys.push([1,3,,4]);t={success:!0,message:"Count retrieved successfully"};return[4,this.collection.countDocuments(e)];case 2:return[2,(t.result=s.sent(),t)];case 3:n=s.sent();return[2,ec(n)];case 4:return[2]}})}).apply(this,arguments)}},{key:"updateOne",value:function e(e,t){return i(function(){var n,r;return x(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);return[4,this.collection.updateOne(e,{$set:t})];case 1:n=s.sent();return[2,n.matchedCount===0?{success:!1,message:"No documents matched the filter",code:er.INTERNAL_SERVER_ERROR.CODE}:{success:!0,message:"Document updated successfully",result:n}];case 2:r=s.sent();return[2,ec(r)];case 3:return[2]}})}).call(this)}},{key:"updateMany",value:function e(e,t){return i(function(){var n,r;return x(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);return[4,this.collection.updateMany(e,{$set:t})];case 1:n=s.sent();return[2,n.matchedCount===0?{success:!1,message:"No documents matched the filter",code:er.INTERNAL_SERVER_ERROR.CODE}:{success:!0,message:"Documents updated successfully",result:n}];case 2:r=s.sent();return[2,ec(r)];case 3:return[2]}})}).call(this)}},{key:"deleteOne",value:function e(e){return i(function(){var t,n;return x(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,this.collection.deleteOne(e)];case 1:t=r.sent();return[2,t.deletedCount===0?{success:!1,message:"No documents matched the filter",code:er.INTERNAL_SERVER_ERROR.CODE}:{success:!0,message:"Document deleted successfully",result:t}];case 2:n=r.sent();return[2,ec(n)];case 3:return[2]}})}).call(this)}},{key:"deleteMany",value:function e(e){return i(function(){var t,n;return x(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,this.collection.deleteMany(e)];case 1:t=r.sent();return[2,t.deletedCount===0?{success:!1,message:"No documents matched the filter",code:er.INTERNAL_SERVER_ERROR.CODE}:{success:!0,message:"Documents deleted successfully",result:t}];case 2:n=r.sent();return[2,ec(n)];case 3:return[2]}})}).call(this)}}]);return e}();M(n$,"MongoController");var nX=n$,nz=/*#__PURE__*/function(){"use strict";function e(t){a(this,e);w(this,"model");this.model=t}u(e,[{key:"getModelName",value:function e(){return this.model.modelName}},{key:"findOne",value:function e(e){return i(function(){var e,t,n,r,s,i,o;var a=arguments;return x(this,function(c){switch(c.label){case 0:e=a.length>0&&a[0]!==void 0?a[0]:{},t=a.length>1&&a[1]!==void 0?a[1]:{},n=a.length>2&&a[2]!==void 0?a[2]:{},r=a.length>3?a[3]:void 0;c.label=1;case 1:c.trys.push([1,3,,4]);s=this.model.findOne(e,t,n);r&&s.populate(r);return[4,s.exec()];case 2:i=c.sent();return[2,i?{success:!0,result:i}:{success:!1,message:"No ".concat(this.getModelName()," found."),code:er.NOT_FOUND.CODE}];case 3:o=c.sent();return[2,ec(o)];case 4:return[2]}})}).apply(this,arguments)}},{key:"findAll",value:function e(e){return i(function(){var e,t,n,r,s,i,o;var a=arguments;return x(this,function(c){switch(c.label){case 0:e=a.length>0&&a[0]!==void 0?a[0]:{},t=a.length>1&&a[1]!==void 0?a[1]:{},n=a.length>2&&a[2]!==void 0?a[2]:{},r=a.length>3?a[3]:void 0;c.label=1;case 1:c.trys.push([1,3,,4]);s=this.model.find(e,t,n);r&&s.populate(r);i={success:!0};return[4,s.exec()];case 2:return[2,(i.result=c.sent(),i)];case 3:o=c.sent();return[2,ec(o)];case 4:return[2]}})}).apply(this,arguments)}},{key:"findPaging",value:function e(){return i(function(){var e,t,n,r;var s=arguments;return x(this,function(i){switch(i.label){case 0:e=s.length>0&&s[0]!==void 0?s[0]:{},t=s.length>1&&s[1]!==void 0?s[1]:{};i.label=1;case 1:i.trys.push([1,3,,4]);n={success:!0};return[4,this.model.paginate(e,t)];case 2:return[2,(n.result=i.sent(),n)];case 3:r=i.sent();return[2,ec(r)];case 4:return[2]}})}).apply(this,arguments)}},{key:"findPagingAggregate",value:function e(e){return i(function(e){var t,n,r;var s=arguments;return x(this,function(i){switch(i.label){case 0:t=s.length>1&&s[1]!==void 0?s[1]:{};i.label=1;case 1:i.trys.push([1,3,,4]);n={success:!0};return[4,this.model.aggregatePaginate(this.model.aggregate(e),t)];case 2:return[2,(n.result=i.sent(),n)];case 3:r=i.sent();return[2,ec(r)];case 4:return[2]}})}).apply(this,arguments)}},{key:"count",value:function e(){return i(function(){var e,t,n;var r=arguments;return x(this,function(s){switch(s.label){case 0:e=r.length>0&&r[0]!==void 0?r[0]:{};s.label=1;case 1:s.trys.push([1,3,,4]);t={success:!0};return[4,this.model.countDocuments(e)];case 2:return[2,(t.result=s.sent(),t)];case 3:n=s.sent();return[2,ec(n)];case 4:return[2]}})}).apply(this,arguments)}},{key:"createOne",value:function e(e){return i(function(){var t,n;return x(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);t={success:!0};return[4,this.model.create(e)];case 1:return[2,(t.result=r.sent(),t)];case 2:n=r.sent();return[2,ec(n)];case 3:return[2]}})}).call(this)}},{key:"createMany",value:function e(e){return i(function(e){var t,n,r;var s=arguments;return x(this,function(i){switch(i.label){case 0:t=s.length>1&&s[1]!==void 0?s[1]:{};i.label=1;case 1:i.trys.push([1,3,,4]);n={success:!0};return[4,this.model.insertMany(e,t)];case 2:return[2,(n.result=i.sent().map(function(e){return f(e,nx)?e.toObject():null}).filter(function(e){return e!==null}),n)];case 3:r=i.sent();return[2,ec(r)];case 4:return[2]}})}).apply(this,arguments)}},{key:"updateOne",value:function e(){return i(function(){var e,t,n,r,s;var i=arguments;return x(this,function(o){switch(o.label){case 0:e=i.length>0&&i[0]!==void 0?i[0]:{},t=i.length>1&&i[1]!==void 0?i[1]:{},n=i.length>2&&i[2]!==void 0?i[2]:{};o.label=1;case 1:o.trys.push([1,3,,4]);return[4,this.model.findOneAndUpdate(e,t,y({new:!0},n)).exec()];case 2:r=o.sent();return[2,r?{success:!0,result:r}:{success:!1,message:"Failed to update ".concat(this.getModelName(),"."),code:er.NOT_FOUND.CODE}];case 3:s=o.sent();return[2,ec(s)];case 4:return[2]}})}).apply(this,arguments)}},{key:"updateMany",value:function e(){return i(function(){var e,t,n,r,s;var i=arguments;return x(this,function(o){switch(o.label){case 0:e=i.length>0&&i[0]!==void 0?i[0]:{},t=i.length>1&&i[1]!==void 0?i[1]:{},n=i.length>2&&i[2]!==void 0?i[2]:{};o.label=1;case 1:o.trys.push([1,3,,4]);r={success:!0};return[4,this.model.updateMany(e,t,n).exec()];case 2:return[2,(r.result=o.sent(),r)];case 3:s=o.sent();return[2,ec(s)];case 4:return[2]}})}).apply(this,arguments)}},{key:"deleteOne",value:function e(){return i(function(){var e,t,n,r;var s=arguments;return x(this,function(i){switch(i.label){case 0:e=s.length>0&&s[0]!==void 0?s[0]:{},t=s.length>1&&s[1]!==void 0?s[1]:{};i.label=1;case 1:i.trys.push([1,3,,4]);return[4,this.model.findOneAndDelete(e,t).exec()];case 2:n=i.sent();return[2,n?{success:!0,result:n}:{success:!1,message:"No ".concat(this.getModelName()," found to delete."),code:er.NOT_FOUND.CODE}];case 3:r=i.sent();return[2,ec(r)];case 4:return[2]}})}).apply(this,arguments)}},{key:"deleteMany",value:function e(){return i(function(){var e,t,n,r;var s=arguments;return x(this,function(i){switch(i.label){case 0:e=s.length>0&&s[0]!==void 0?s[0]:{},t=s.length>1&&s[1]!==void 0?s[1]:{};i.label=1;case 1:i.trys.push([1,3,,4]);return[4,this.model.deleteMany(e,t).exec()];case 2:n=i.sent();return[2,n.deletedCount===0?{success:!1,message:"No documents found to delete.",code:er.NOT_FOUND.CODE}:{success:!0,result:n}];case 3:r=i.sent();return[2,ec(r)];case 4:return[2]}})}).apply(this,arguments)}},{key:"createShortId",value:function e(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:4;return i(function(){var n,r,s,i,o;return x(this,function(a){switch(a.label){case 0:a.trys.push([0,6,,7]);n=new Set;r=0;a.label=1;case 1:if(!(r<10))return[3,5];s=nQ(e,r+t);i=!n.has(s);if(!i)return[3,3];n.add(s);return[4,this.model.exists({shortId:s})];case 2:i=!a.sent();a.label=3;case 3:if(i)return[2,{success:!0,result:s}];a.label=4;case 4:r++;return[3,1];case 5:return[2,{success:!1,message:"Failed to create a unique shortId",code:er.INTERNAL_SERVER_ERROR.CODE}];case 6:o=a.sent();return[2,ec(o)];case 7:return[2]}})}).call(this)}},{key:"createSlugQuery",value:function e(e){var t=e.slug,n=e.field,r=e.isObject,s=e.filter;var i=y({},s!==null&&s!==void 0?s:{});return r?S(y({},i),{$or:[l({},"slug.".concat(n),t),{slugHistory:{$elemMatch:l({},"slug.".concat(n),t)}}]}):S(y({},i),{$or:[{slug:t},{slugHistory:t}]})}},{key:"createUniqueSlug",value:function e(e){return i(function(e){var t,n,r,s,i,o,a;return x(this,function(c){switch(c.label){case 0:t=e.slug,n=e.field,r=e.isObject,s=e.filter;i=nH(t),o=i,a=1;c.label=1;case 1:return[4,this.model.exists(this.createSlugQuery({slug:o,field:n,isObject:r,filter:s}))];case 2:if(!c.sent())return[3,4];o="".concat(i,"-").concat(a++);c.label=3;case 3:return[3,1];case 4:return[2,o]}})}).apply(this,arguments)}},{key:"createSlug",value:function e(e){return i(function(e){var t,n,r,s,o,a,c,u,l,d;return x(this,function(p){switch(p.label){case 0:t=this;n=e.field,r=e.from,s=e.filter;p.label=1;case 1:p.trys.push([1,6,,7]);o=r[n];if(!nU(o))return[3,3];c={success:!0};u=Object.fromEntries;return[4,Promise.all(Object.entries(o).map(function(e){var n=I(e,2),r=n[0],o=n[1];return i(function(){var e;return x(this,function(t){switch(t.label){case 0:return[4,this.createUniqueSlug({slug:o,field:r,isObject:!0,filter:s})];case 1:e=t.sent();return[2,[r,e]]}})}).call(t)}))];case 2:a=(c.result=u.apply(Object,[p.sent()]),c);return[3,5];case 3:l={success:!0};return[4,this.createUniqueSlug({slug:o,field:n,isObject:!1,filter:s})];case 4:a=(l.result=p.sent(),l);p.label=5;case 5:return[2,a];case 6:d=p.sent();return[2,ec(d)];case 7:return[2]}})}).apply(this,arguments)}},{key:"checkSlug",value:function e(e){return i(function(e){var t,n,r,s,i,o,a,c,u,l,d,p,f,E,m,g;return x(this,function(h){switch(h.label){case 0:t=e.slug,n=e.field,r=e.from,s=e.filter;h.label=1;case 1:h.trys.push([1,12,,13]);i=r[n];if(!nU(i))return[3,10];o=true,a=false,c=undefined;h.label=2;case 2:h.trys.push([2,7,8,9]);u=Object.values(i)[Symbol.iterator]();h.label=3;case 3:if(!!(o=(l=u.next()).done))return[3,6];d=l.value;p=nH(d);return[4,this.model.exists(this.createSlugQuery({slug:p,field:n,isObject:!0,filter:s}))];case 4:if(h.sent())return[2,{success:!0,result:!0}];h.label=5;case 5:o=true;return[3,3];case 6:return[3,9];case 7:f=h.sent();a=true;c=f;return[3,9];case 8:try{if(!o&&u.return!=null){u.return()}}finally{if(a){throw c}}return[7];case 9:return[2,{success:!0,result:!1}];case 10:E=nH(t);m={success:!0};return[4,this.model.exists(this.createSlugQuery({slug:E,field:n,isObject:!1,filter:s}))];case 11:return[2,(m.result=h.sent()!==null,m)];case 12:g=h.sent();return[2,ec(g)];case 13:return[2]}})}).apply(this,arguments)}},{key:"aggregate",value:function e(e){return i(function(){var t,n;return x(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);t={success:!0};return[4,this.model.aggregate(e)];case 1:return[2,(t.result=r.sent(),t)];case 2:n=r.sent();return[2,ec(n)];case 3:return[2]}})}).call(this)}}]);return e}();M(nz,"MongooseController");var nZ=nz;import{useServer as n0}from"graphql-ws/use/ws";import{WebSocketServer as n1}from"ws";function n2(e){return new n1({server:e.server,path:e.path})}M(n2,"createWSServer");function n4(e){return n0({schema:e.schema},e.server)}M(n4,"initGraphQLWS");export{eH as BUILD_DIRECTORY,tr as COMMIT_LINT_CLI,tn as COMMIT_LINT_CONVENTIONAL_CONFIG_PACKAGE_NAME,tt as COMMIT_LINT_PACKAGE_NAME,e3 as CYBERSKILL_CLI,e5 as CYBERSKILL_CLI_PATH,e4 as CYBERSKILL_DIRECTORY,eK as CYBERSKILL_PACKAGE_NAME,nT as C_Collection,nC as C_Db,n_ as C_Document,nN as C_Model,e6 as ESLINT_CLI,tm as ESLINT_INSPECT_CLI,tE as ESLINT_INSPECT_PACKAGE_NAME,e8 as ESLINT_PACKAGE_NAME,eE as E_CommandType,V as E_IssueType,ey as E_PackageType,tu as GIT_CLI,e1 as GIT_COMMIT_EDITMSG,e0 as GIT_HOOK,eX as GIT_IGNORE,ti as LINT_STAGED_CLI,ts as LINT_STAGED_PACKAGE_NAME,tv as MIGRATE_MONGO_CLI,e2 as MIGRATE_MONGO_CONFIG,ty as MIGRATE_MONGO_PACKAGE_NAME,ng as MONGO_MIGRATE_OPTIONS,nX as MongoController,nZ as MongooseController,eB as NODE_MODULES,th as NODE_MODULES_INSPECT_CLI,tg as NODE_MODULES_INSPECT_PACKAGE_NAME,eW as PACKAGE_JSON,eJ as PACKAGE_LOCK_JSON,tS as PATH,e9 as PLAYWRIGHT_PACKAGE_NAME,tl as PNPM_CLI,td as PNPM_EXEC_CLI,eZ as PNPM_LOCK_YAML,eQ as PUBLIC_DIRECTORY,nn as Router,tp as SIMPLE_GIT_HOOKS_PACKAGE_NAME,tf as SIMPLE_GIT_HOOK_CLI,ez as SIMPLE_GIT_HOOK_JSON,e$ as TSCONFIG_JSON,ta as TSC_CLI,to as TSC_PACKAGE_NAME,tc as TSX_CLI,te as VITEST_CLI,e7 as VITEST_PACKAGE_NAME,eY as WORKING_DIRECTORY,nG as aggregatePaginate,ex as appendFileSync,ns as bodyParser,ec as catchError,tU as clearAllErrorLists,tD as command,eM as copySync,eu as createApolloServer,np as createCors,nd as createCorsOptions,nE as createExpress,tO as createGitHooksConfig,nm as createNest,nf as createSession,n2 as createWSServer,nc as express,j as expressMiddleware,tB as formatCommand,eC as fs,tI as getLatestPackageVersion,tN as getPackage,tk as getStoredErrorLists,n4 as initGraphQLWS,tT as installDependencies,eV as join,ea as log,eD as lstatSync,eI as mkdirSync,nJ as mongo,nP as mongoosePaginate,ek as path,eG as pathExistsSync,tY as rawCommand,eN as readFileSync,eA as readJsonSync,e_ as readdirSync,eP as removeSync,eF as resolve,tH as resolveCommands,eU as resolveWorkingPath,tQ as runCommand,tA as setupPackages,eT as statSync,tP as storage,ei as throwError,eb as unlinkSync,tb as updatePackage,eR as writeFileSync};
1
+ function e(e,t){if(t==null||t>e.length)t=e.length;for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function t(e){if(Array.isArray(e))return e}function n(t){if(Array.isArray(t))return e(t)}function r(e){if(e===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return e}function s(e,t,n,r,s,i,a){try{var o=e[i](a);var c=o.value}catch(e){n(e);return}if(o.done){t(c)}else{Promise.resolve(c).then(r,s)}}function i(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){s(a,r,i,o,c,"next",e)}function c(e){s(a,r,i,o,c,"throw",e)}o(undefined)})}}function a(e,t,n){t=d(t);return D(e,R()?Reflect.construct(t,n||[],d(e).constructor):t.apply(e,n))}function o(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function c(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}function u(e,t,n){if(t)c(e.prototype,t);if(n)c(e,n);return e}function l(e,t,n){if(t in e){Object.defineProperty(e,t,{value:n,enumerable:true,configurable:true,writable:true})}else{e[t]=n}return e}function d(e){d=Object.setPrototypeOf?Object.getPrototypeOf:function e(e){return e.__proto__||Object.getPrototypeOf(e)};return d(e)}function f(e,t){if(typeof t!=="function"&&t!==null){throw new TypeError("Super expression must either be null or a function")}e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:true,configurable:true}});if(t)_(e,t)}function p(e,t){if(t!=null&&typeof Symbol!=="undefined"&&t[Symbol.hasInstance]){return!!t[Symbol.hasInstance](e)}else{return e instanceof t}}function m(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function E(e,t){var n=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(n==null)return;var r=[];var s=true;var i=false;var a,o;try{for(n=n.call(e);!(s=(a=n.next()).done);s=true){r.push(a.value);if(t&&r.length===t)break}}catch(e){i=true;o=e}finally{try{if(!s&&n["return"]!=null)n["return"]()}finally{if(i)throw o}}return r}function g(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function h(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function y(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};var r=Object.keys(n);if(typeof Object.getOwnPropertySymbols==="function"){r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))}r.forEach(function(t){l(e,t,n[t])})}return e}function v(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);if(t){r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})}n.push.apply(n,r)}return n}function S(e,t){t=t!=null?t:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(t))}else{v(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}function O(e,t){if(e==null)return{};var n=C(e,t);var r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++){r=i[s];if(t.indexOf(r)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(e,r))continue;n[r]=e[r]}}return n}function C(e,t){if(e==null)return{};var n={};var r=Object.keys(e);var s,i;for(i=0;i<r.length;i++){s=r[i];if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function D(e,t){if(t&&(T(t)==="object"||typeof t==="function")){return t}return r(e)}function _(e,t){_=Object.setPrototypeOf||function e(e,t){e.__proto__=t;return e};return _(e,t)}function I(e,n){return t(e)||E(e,n)||A(e,n)||g()}function N(e){return t(e)||m(e)||A(e)||g()}function b(e){return n(e)||m(e)||A(e)||h()}function T(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function A(t,n){if(!t)return;if(typeof t==="string")return e(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor)r=t.constructor.name;if(r==="Map"||r==="Set")return Array.from(r);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e(t,n)}function R(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(R=function(){return!!e})()}function x(e,t){var n,r,s,i={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},a=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return a.next=o(0),a["throw"]=o(1),a["return"]=o(2),typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function o(e){return function(t){return c([e,t])}}function c(o){if(n)throw new TypeError("Generator is already executing.");while(a&&(a=0,o[0]&&(i=0)),i)try{if(n=1,r&&(s=o[0]&2?r["return"]:o[0]?r["throw"]||((s=r["return"])&&s.call(r),0):r.next)&&!(s=s.call(r,o[1])).done)return s;if(r=0,s)o=[o[0]&2,s.value];switch(o[0]){case 0:case 1:s=o;break;case 4:i.label++;return{value:o[1],done:false};case 5:i.label++;r=o[1];o=[0];continue;case 7:o=i.ops.pop();i.trys.pop();continue;default:if(!(s=i.trys,s=s.length>0&&s[s.length-1])&&(o[0]===6||o[0]===2)){i=0;continue}if(o[0]===3&&(!s||o[1]>s[0]&&o[1]<s[3])){i.label=o[1];break}if(o[0]===6&&i.label<s[1]){i.label=s[1];s=o;break}if(s&&i.label<s[2]){i.label=s[2];i.ops.push(o);break}if(s[2])i.ops.pop();i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e];r=0}finally{n=s=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:true}}}var P=Object.defineProperty;var G=function(e,t,n){return t in e?P(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n};var M=function(e,t){return P(e,"name",{value:t,configurable:!0})};var w=function(e,t,n){return G(e,(typeof t==="undefined"?"undefined":T(t))!="symbol"?t+"":t,n)};import{ApolloServer as L}from"@apollo/server";import{expressMiddleware as j}from"@apollo/server/express4";import{ApolloServerPluginDrainHttpServer as k}from"@apollo/server/plugin/drainHttpServer";import{ApolloServerPluginLandingPageLocalDefault as U,ApolloServerPluginLandingPageProductionDefault as F}from"@apollo/server/plugin/landingPage/default";var V=function(e){return e.Error="error",e.Warning="warning",e}({});import q from"chalk";import Y from"consola";import{GraphQLError as K}from"graphql";var B=".cyberskill-storage";import H from"@dotenvx/dotenvx";import{bool as W,cleanEnv as Q,str as J}from"envalid";import z from"os";import $ from"path";import X from"process";var Z=function(e){return e.PRODUCTION="production",e.STAGING="staging",e.DEVELOPMENT="development",e}({});var ee=!1;function et(){X.env.NODE_ENV!==Z.PRODUCTION&&!ee&&(H.config(),ee=!0)}M(et,"loadEnvFile");function en(){et();var e=Q(X.env,{CWD:J({default:X.cwd()}),DEBUG:W({default:!1}),CYBERSKILL_STORAGE_DIRECTORY:J({default:$.join(z.homedir(),B)})});return{CWD:e.CWD,DEBUG:e.DEBUG,CYBERSKILL_STORAGE_DIRECTORY:e.CYBERSKILL_STORAGE_DIRECTORY}}M(en,"getEnv");var er={GRAPHQL_PARSE_FAILED:{CODE:"GRAPHQL_PARSE_FAILED",MESSAGE:"The GraphQL operation string contains a syntax error."},GRAPHQL_VALIDATION_FAILED:{CODE:"GRAPHQL_VALIDATION_FAILED",MESSAGE:"The GraphQL operation is not valid against the server's schema."},BAD_USER_INPUT:{CODE:"BAD_USER_INPUT",MESSAGE:"The GraphQL operation includes an invalid value for a field argument."},PERSISTED_QUERY_NOT_FOUND:{CODE:"PERSISTED_QUERY_NOT_FOUND",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the query was not in the APQ cache."},PERSISTED_QUERY_NOT_SUPPORTED:{CODE:"PERSISTED_QUERY_NOT_SUPPORTED",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the server has disabled APQ."},OPERATION_RESOLUTION_FAILURE:{CODE:"OPERATION_RESOLUTION_FAILURE",MESSAGE:"The request was parsed successfully and is valid against the server's schema, but the server couldn't resolve which operation to run. This occurs when a request containing multiple named operations doesn't specify which operation to run (i.e.,operationName), or if the named operation isn't included in the request."},CONTINUE:{CODE:100,MESSAGE:"Continue"},SWITCHING_PROTOCOLS:{CODE:101,MESSAGE:"Switching Protocols"},PROCESSING:{CODE:102,MESSAGE:"Processing"},OK:{CODE:200,MESSAGE:"OK"},CREATED:{CODE:201,MESSAGE:"Created"},ACCEPTED:{CODE:202,MESSAGE:"Accepted"},NON_AUTHORITATIVE_INFORMATION:{CODE:203,MESSAGE:"Non Authoritative Information"},NO_CONTENT:{CODE:204,MESSAGE:"No Content"},RESET_CONTENT:{CODE:205,MESSAGE:"Reset Content"},PARTIAL_CONTENT:{CODE:206,MESSAGE:"Partial Content"},MULTI_STATUS:{CODE:207,MESSAGE:"Multi-Status"},MULTIPLE_CHOICES:{CODE:300,MESSAGE:"Multiple Choices"},MOVED_PERMANENTLY:{CODE:301,MESSAGE:"Moved Permanently"},MOVED_TEMPORARILY:{CODE:302,MESSAGE:"Moved Temporarily"},SEE_OTHER:{CODE:303,MESSAGE:"See Other"},NOT_MODIFIED:{CODE:304,MESSAGE:"Not Modified"},USE_PROXY:{CODE:305,MESSAGE:"Use Proxy"},TEMPORARY_REDIRECT:{CODE:307,MESSAGE:"Temporary Redirect"},PERMANENT_REDIRECT:{CODE:308,MESSAGE:"Permanent Redirect"},BAD_REQUEST:{CODE:400,MESSAGE:"Bad Request"},UNAUTHORIZED:{CODE:401,MESSAGE:"Unauthorized"},PAYMENT_REQUIRED:{CODE:402,MESSAGE:"Payment Required"},FORBIDDEN:{CODE:403,MESSAGE:"Forbidden"},NOT_FOUND:{CODE:404,MESSAGE:"Not Found"},METHOD_NOT_ALLOWED:{CODE:405,MESSAGE:"Method Not Allowed"},NOT_ACCEPTABLE:{CODE:406,MESSAGE:"Not Acceptable"},PROXY_AUTHENTICATION_REQUIRED:{CODE:407,MESSAGE:"Proxy Authentication Required"},REQUEST_TIMEOUT:{CODE:408,MESSAGE:"Request Timeout"},CONFLICT:{CODE:409,MESSAGE:"Conflict"},GONE:{CODE:410,MESSAGE:"Gone"},LENGTH_REQUIRED:{CODE:411,MESSAGE:"Length Required"},PRECONDITION_FAILED:{CODE:412,MESSAGE:"Precondition Failed"},REQUEST_TOO_LONG:{CODE:413,MESSAGE:"Request Entity Too Large"},REQUEST_URI_TOO_LONG:{CODE:414,MESSAGE:"Request-URI Too Long"},UNSUPPORTED_MEDIA_TYPE:{CODE:415,MESSAGE:"Unsupported Media Type"},REQUESTED_RANGE_NOT_SATISFIABLE:{CODE:416,MESSAGE:"Requested Range Not Satisfiable"},EXPECTATION_FAILED:{CODE:417,MESSAGE:"Expectation Failed"},IM_A_TEAPOT:{CODE:418,MESSAGE:"I'm a teapot"},INSUFFICIENT_SPACE_ON_RESOURCE:{CODE:419,MESSAGE:"Insufficient Space on Resource"},METHOD_FAILURE:{CODE:420,MESSAGE:"Method Failure"},MISDIRECTED_REQUEST:{CODE:421,MESSAGE:"Misdirected Request"},UNPROCESSABLE_ENTITY:{CODE:422,MESSAGE:"Unprocessable Entity"},LOCKED:{CODE:423,MESSAGE:"Locked"},FAILED_DEPENDENCY:{CODE:424,MESSAGE:"Failed Dependency"},PRECONDITION_REQUIRED:{CODE:428,MESSAGE:"Precondition Required"},TOO_MANY_REQUESTS:{CODE:429,MESSAGE:"Too Many Requests"},REQUEST_HEADER_FIELDS_TOO_LARGE:{CODE:431,MESSAGE:"Request Header Fields Too Large"},UNAVAILABLE_FOR_LEGAL_REASONS:{CODE:451,MESSAGE:"Unavailable For Legal Reasons"},INTERNAL_SERVER_ERROR:{CODE:500,MESSAGE:"Internal Server Error"},NOT_IMPLEMENTED:{CODE:501,MESSAGE:"Not Implemented"},BAD_GATEWAY:{CODE:502,MESSAGE:"Bad Gateway"},SERVICE_UNAVAILABLE:{CODE:503,MESSAGE:"Service Unavailable"},GATEWAY_TIMEOUT:{CODE:504,MESSAGE:"Gateway Timeout"},HTTP_VERSION_NOT_SUPPORTED:{CODE:505,MESSAGE:"HTTP Version Not Supported"},INSUFFICIENT_STORAGE:{CODE:507,MESSAGE:"Insufficient Storage"},NETWORK_AUTHENTICATION_REQUIRED:{CODE:511,MESSAGE:"Network Authentication Required"}};var es=en();function ei(e){var t=e.message,n=e.status,r=n===void 0?er.INTERNAL_SERVER_ERROR:n,s=e.type,i=s===void 0?"graphql":s;var a;var o=(a=t!==null&&t!==void 0?t:r.MESSAGE)!==null&&a!==void 0?a:"Internal server error";throw i==="graphql"?new K(o,{extensions:{code:r.CODE}}):new Error(o)}M(ei,"throwError");es.DEBUG||(Y.level=4);function ea(e){var t=q[e];return typeof t=="function"?t:q.green}M(ea,"chalkKeyword");var eo={silent:Y.silent,level:Y.level,fatal:Y.fatal,error:Y.error,warn:Y.warn,log:Y.log,info:Y.info,success:Y.success,ready:Y.ready,start:Y.start,box:Y.box,debug:Y.debug,trace:Y.trace,verbose:Y.verbose,printBoxedLog:function e(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(t===null||t===void 0?void 0:t.length)){Y.box(q.green(e));return}t.forEach(function(e){var t=e.file,r=e.position,s=e.rule,i=e.message;Y.log("".concat(q.gray("File:")," ").concat(q.blue("".concat(t).concat(r?":".concat(r):"")))),s&&Y.log(" ".concat(ea(n)("Rule:")," ").concat(s)),Y.log(" ".concat(ea(n)("Message:")," ").concat(i))}),Y.box(ea(n)("".concat(e," : ").concat(t.length))),Y.log(q.gray("─".repeat(40)))}};function ec(e,t){var n=t!==null&&t!==void 0?t:{},r=n.shouldLog,s=r===void 0?!0:r,i=n.returnValue,a=n.callback,o=p(e,Error)?e:new Error(typeof e=="string"?e:"Unknown error");return s&&eo.error(o.message),a&&typeof a=="function"&&a(o),i||{success:!1,message:o.message,code:er.INTERNAL_SERVER_ERROR.CODE}}M(ec,"catchError");function eu(e){return new L(y({schema:e.schema,plugins:[e.isDev?U():F(),k({httpServer:e.server})].concat(b(e.drainServer?[{serverWillStart:function t(){return i(function(){return x(this,function(t){return[2,{drainServer:function t(){return i(function(){var t;return x(this,function(n){(t=e.drainServer)===null||t===void 0?void 0:t.call(e),eo.info("Apollo Server drainServer hook called");return[2]})})()}}]})})()}}]:[]))},e.isDev&&{introspection:!0,includeStacktraceInErrorResponses:!0}))}M(eu,"createApolloServer");import el from"process";import{hideBin as ed}from"yargs/helpers";import ef from"yargs/yargs";var ep={name:"@cyberskill/shared",type:"module",version:"1.191.0",description:"CyberSkill Shared",author:"Stephen Cheng",license:"MIT",homepage:"https://github.com/cyberskill-world/shared#readme",repository:{type:"git",url:"git+https://github.com/cyberskill-world/shared.git"},bugs:{url:"https://github.com/cyberskill-world/shared/issues"},exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/index.cjs"},"./config":{types:"./dist/config/index.d.ts",import:"./dist/config/index.js",require:"./dist/config/index.cjs"},"./config/commitlint":{types:"./dist/config/commitlint/index.d.ts",import:"./dist/config/commitlint/index.js",require:"./dist/config/commitlint/index.cjs"},"./config/env":{types:"./dist/config/env/index.d.ts",import:"./dist/config/env/index.js",require:"./dist/config/env/index.cjs"},"./config/eslint":{types:"./dist/config/eslint/index.d.ts",import:"./dist/config/eslint/index.js",require:"./dist/config/eslint/index.cjs"},"./config/graphql-codegen":{types:"./dist/config/graphql-codegen/index.d.ts",import:"./dist/config/graphql-codegen/index.js",require:"./dist/config/graphql-codegen/index.cjs"},"./config/lint-staged":{types:"./dist/config/lint-staged/index.d.ts",import:"./dist/config/lint-staged/index.js",require:"./dist/config/lint-staged/index.cjs"},"./config/vitest":{types:"./dist/config/vitest/index.d.ts",import:"./dist/config/vitest/index.js",require:"./dist/config/vitest/index.cjs"},"./constant":{types:"./dist/constant/index.d.ts",import:"./dist/constant/index.js",require:"./dist/constant/index.cjs"},"./node":{types:"./dist/node/index.d.ts",import:"./dist/node/index.js",require:"./dist/node/index.cjs"},"./node/apollo-server":{types:"./dist/node/apollo-server/index.d.ts",import:"./dist/node/apollo-server/index.js",require:"./dist/node/apollo-server/index.cjs"},"./node/cli":{types:"./dist/node/cli/index.d.ts",import:"./dist/node/cli/index.js",require:"./dist/node/cli/index.cjs"},"./node/command":{types:"./dist/node/command/index.d.ts",import:"./dist/node/command/index.js",require:"./dist/node/command/index.cjs"},"./node/express":{types:"./dist/node/express/index.d.ts",import:"./dist/node/express/index.js",require:"./dist/node/express/index.cjs"},"./node/fs":{types:"./dist/node/fs/index.d.ts",import:"./dist/node/fs/index.js",require:"./dist/node/fs/index.cjs"},"./node/log":{types:"./dist/node/log/index.d.ts",import:"./dist/node/log/index.js",require:"./dist/node/log/index.cjs"},"./node/mongo":{types:"./dist/node/mongo/index.d.ts",import:"./dist/node/mongo/index.js",require:"./dist/node/mongo/index.cjs"},"./node/package":{types:"./dist/node/package/index.d.ts",import:"./dist/node/package/index.js",require:"./dist/node/package/index.cjs"},"./node/path":{types:"./dist/node/path/index.d.ts",import:"./dist/node/path/index.js",require:"./dist/node/path/index.cjs"},"./node/storage":{types:"./dist/node/storage/index.d.ts",import:"./dist/node/storage/index.js",require:"./dist/node/storage/index.cjs"},"./node/upload":{types:"./dist/node/upload/index.d.ts",import:"./dist/node/upload/index.js",require:"./dist/node/upload/index.cjs"},"./node/ws":{types:"./dist/node/ws/index.d.ts",import:"./dist/node/ws/index.js",require:"./dist/node/ws/index.cjs"},"./react":{types:"./dist/react/index.d.ts",import:"./dist/react/index.js",require:"./dist/react/index.cjs"},"./react/apollo-client":{types:"./dist/react/apollo-client/index.d.ts",import:"./dist/react/apollo-client/index.js",require:"./dist/react/apollo-client/index.cjs"},"./react/apollo-error":{types:"./dist/react/apollo-error/index.d.ts",import:"./dist/react/apollo-error/index.js",require:"./dist/react/apollo-error/index.cjs"},"./react/i18next":{types:"./dist/react/i18next/index.d.ts",import:"./dist/react/i18next/index.js",require:"./dist/react/i18next/index.cjs"},"./react/loading":{types:"./dist/react/loading/index.d.ts",import:"./dist/react/loading/index.js",require:"./dist/react/loading/index.cjs"},"./react/log":{types:"./dist/react/log/index.d.ts",import:"./dist/react/log/index.js",require:"./dist/react/log/index.cjs"},"./react/next-intl":{types:"./dist/react/next-intl/index.d.ts",import:"./dist/react/next-intl/index.js",require:"./dist/react/next-intl/index.cjs"},"./react/storage":{types:"./dist/react/storage/index.d.ts",import:"./dist/react/storage/index.js",require:"./dist/react/storage/index.cjs"},"./react/toast":{types:"./dist/react/toast/index.d.ts",import:"./dist/react/toast/index.js",require:"./dist/react/toast/index.cjs"},"./react/index.css":{import:"./dist/react/index.css",require:"./dist/react/index.css"},"./typescript":{types:"./dist/typescript/index.d.ts",import:"./dist/typescript/index.js",require:"./dist/typescript/index.cjs"},"./util":{types:"./dist/util/index.d.ts",import:"./dist/util/index.js",require:"./dist/util/index.cjs"}},typesVersions:{"*":{config:["dist/config/index.d.ts"],constant:["dist/constant/index.d.ts"],node:["dist/node/index.d.ts"],react:["dist/react/index.d.ts"],typescript:["dist/typescript/index.d.ts"],util:["dist/util/index.d.ts"]}},bin:{cyberskill:"dist/node/cli/index.js"},files:["dist","public"],scripts:{build:"tsup",commitlint:"tsx src/node/cli/index.ts commitlint",dev:"tsup --watch",inspect:"tsx src/node/cli/index.ts inspect",lint:"tsx src/node/cli/index.ts lint","lint:fix":"tsx src/node/cli/index.ts lint:fix","lint:inspect":"tsx src/node/cli/index.ts lint:inspect",ready:"tsx src/node/cli/index.ts ready",reset:"tsx src/node/cli/index.ts reset","test:e2e":"tsx src/node/cli/index.ts test:e2e","test:unit":"tsx src/node/cli/index.ts test:unit"},dependencies:{"@antfu/eslint-config":"4.16.1","@apollo/client":"3.13.8","@apollo/server":"4.12.2","@dotenvx/dotenvx":"1.45.1","@eddeee888/gcg-typescript-resolver-files":"0.12.1","@graphql-codegen/cli":"5.0.7","@graphql-codegen/client-preset":"4.8.2","@nestjs/common":"11.1.3","@nestjs/core":"11.1.3","@vitejs/plugin-react-swc":"3.10.2","body-parser":"2.2.0",chalk:"5.4.1",clsx:"2.1.1",compression:"1.8.0",consola:"3.4.2","cookie-parser":"1.4.7",cors:"2.8.5","crypto-js":"4.2.0","date-fns":"4.1.0",envalid:"8.0.0",express:"4.21.2","express-session":"1.18.1","express-useragent":"1.0.15","fs-extra":"11.3.0",globals:"16.2.0",graphql:"16.11.0","graphql-ws":"6.0.5",i18next:"25.2.1",jsdom:"26.1.0",localforage:"1.10.0","migrate-mongo":"12.1.3",mongodb:"6.17.0",mongoose:"8.16.0","mongoose-aggregate-paginate-v2":"1.1.4","mongoose-paginate-v2":"1.9.1","next-intl":"4.3.0","node-fetch":"3.3.2","node-persist":"4.0.4",qs:"6.14.0",react:"19.1.0","react-dom":"19.1.0","react-hot-toast":"2.5.2","react-i18next":"15.5.3",sass:"1.89.2",slugify:"1.6.6",unorm:"1.6.0",uuid:"11.1.0",vite:"7.0.0",ws:"8.18.2",yargs:"18.0.0"},devDependencies:{"@commitlint/cli":"19.8.1","@commitlint/config-conventional":"19.8.1","@eslint-react/eslint-plugin":"1.52.2","@eslint/config-inspector":"1.1.0","@microsoft/api-extractor":"7.52.8","@next/eslint-plugin-next":"15.3.4","@testing-library/jest-dom":"6.6.3","@testing-library/react":"16.3.0","@types/body-parser":"1.19.6","@types/compression":"1.8.1","@types/cookie-parser":"1.4.9","@types/cors":"2.8.19","@types/crypto-js":"4.2.2","@types/express":"4.17.21","@types/express-session":"1.18.2","@types/express-useragent":"1.0.5","@types/fs-extra":"11.0.4","@types/migrate-mongo":"10.0.5","@types/node":"24.0.3","@types/node-persist":"3.1.8","@types/react":"19.1.8","@types/react-dom":"19.1.6","@types/unorm":"1.3.31","@types/uuid":"10.0.0","@types/ws":"8.18.1","@types/yargs":"17.0.33","@vitest/browser":"3.2.4","esbuild-sass-plugin":"3.3.1",eslint:"9.29.0","eslint-config-next":"15.3.4","eslint-plugin-format":"1.0.1","eslint-plugin-react-hooks":"5.2.0","eslint-plugin-react-refresh":"0.4.20","lint-staged":"16.1.2","node-modules-inspector":"1.0.0",playwright:"1.53.1",postcss:"8.5.6","postcss-modules":"6.0.1","simple-git-hooks":"2.13.0",tsup:"8.5.0",tsx:"4.20.3",typescript:"5.8.3",vitest:"3.2.4"},publishConfig:{access:"public",registry:"https://registry.npmjs.org/"}};var em=function(e){return e.CLI="CLI",e.STRING="STRING",e.FUNCTION="FUNCTION",e}({});import{exec as eE}from"child_process";import eg from"process";import*as eh from"util";var ey=function(e){return e.DEPENDENCY="dependencies",e.DEV_DEPENDENCY="devDependencies",e.PEER_DEPENDENCY="peerDependencies",e.BUNDLE_DEPENDENCY="bundleDependencies",e.OPTIONAL_DEPENDENCY="optionalDependencies",e}({});import ev from"node-fetch";import eS from"fs-extra";import eO from"path";var eC=eS,eD=eS.lstatSync,e_=eS.readdirSync,eI=eS.mkdirSync,eN=eS.readFileSync,eb=eS.unlinkSync,eT=eS.statSync,eA=eS.createWriteStream,eR=eS.readJsonSync;function ex(e,t,n){eS.writeFileSync(e,t,n!==null&&n!==void 0?n:"utf-8")}M(ex,"writeFileSync");function eP(e,t,n){eS.appendFileSync(e,t,n!==null&&n!==void 0?n:"utf-8")}M(eP,"appendFileSync");function eG(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return t.every(function(e){return eS.pathExistsSync(e)})}M(eG,"pathExistsSync");function eM(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}t.forEach(function(e){eG(e)&&eS.removeSync(e)})}M(eM,"removeSync");function ew(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=n.extensions,s=O(n,["extensions"]);eS.copySync(e,t,y({filter:M(function(e){return eT(e).isDirectory()||!r||r.length===0?!0:r.includes(eO.extname(e))},"filter")},s))}M(ew,"copySync");import eL from"fs-extra";import ej from"path";var ek=en(),eU=ej,eF=eU.dirname;function eV(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=eU).resolve.apply(r,[ek.CWD].concat(b(t)))}M(eV,"resolveWorkingPath");function eq(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=eU).resolve.apply(r,b(t))}M(eq,"resolve");function eY(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=eU).join.apply(r,b(t))}M(eY,"join");var eK=en(),eB=eK.CWD,eH="@cyberskill/shared",eW="node_modules",eQ="dist",eJ="public",ez="package.json",e$="package-lock.json",eX="tsconfig.json",eZ=".gitignore",e0=".simple-git-hooks.json",e1="pnpm-lock.yaml",e2=".git/hooks/",e4=".git/COMMIT_EDITMSG",e3=".migrate-mongo.config.js",e5=function(){var e=eL.readJsonSync(eV(ez)).name===eH?eB:eY(eB,eW,eH);return eY(e,eQ)}(),e8="cyberskill",e6="src/node/cli/index.ts",e7="eslint",e9="eslint",te="vitest",tt="playwright",tn="vitest",tr="@commitlint/cli",ts="@commitlint/config-conventional",ti="commitlint",ta="lint-staged",to="lint-staged",tc="typescript",tu="tsc",tl="tsx",td="git",tf="pnpm",tp="pnpm exec",tm="simple-git-hooks",tE="simple-git-hooks",tg="@eslint/config-inspector",th="eslint-config-inspector",ty="node-modules-inspector",tv="node-modules-inspector",tS="migrate-mongo",tO="./node_modules/migrate-mongo/bin/migrate-mongo",tC={CYBERSKILL_DIRECTORY:e5,WORKING_DIRECTORY:eB,PUBLIC_DIRECTORY:eV(eJ),TS_CONFIG:eV(eX),GIT_IGNORE:eV(eZ),GIT_HOOK:eV(e2),GIT_COMMIT_MSG:eV(e4),SIMPLE_GIT_HOOKS_JSON:eV(e0),PACKAGE_JSON:eV(ez),PACKAGE_LOCK_JSON:eV(e$),PNPM_LOCK_YAML:eV(e1),NODE_MODULES:eV(eW),MIGRATE_MONGO_CONFIG:eV(e3),LINT_STAGED_CONFIG:eV("".concat(e5,"/config/lint-staged/index.js")),COMMITLINT_CONFIG:eV("".concat(e5,"/config/commitlint/index.js")),VITEST_UNIT_CONFIG:eV("".concat(e5,"/config/vitest/vitest.unit.js")),VITEST_UNIT_SETUP_CONFIG:eV("".concat(e5,"/config/vitest/vitest.unit.setup.js")),VITEST_E2E_CONFIG:eV("".concat(e5,"/config/vitest/vitest.e2e.js"))};function tD(e){var t=e.isCurrentProject;return y({"pre-commit":to,"commit-msg":ti},t&&{"pre-push":tB("".concat(td," pull"))})}M(tD,"createGitHooksConfig");function t_(e){var t=e.type,n=e.packages,r=e.command;var s=n===null||n===void 0?void 0:n.reduce(function(e,t){return e.some(function(e){return e.name===t.name})||e.push(t),e},[]);return function(){return i(function(){var e;return x(this,function(n){switch(n.label){case 0:switch(t){case em.CLI:return[3,1];case em.STRING:return[3,4]}return[3,5];case 1:e=s===null||s===void 0?void 0:s.length;if(!e)return[3,3];return[4,tx(s,{install:!0})];case 2:e=n.sent();n.label=3;case 3:return[2,(e,tW(tB("".concat(tp," ").concat(r))))];case 4:return[2,tW(tB(r))];case 5:throw new Error("Unsupported command type");case 6:return[2]}})})()}}M(t_,"buildCommand");var tI={simpleGitHooks:t_({type:em.CLI,packages:[{name:tm,type:ey.DEV_DEPENDENCY}],command:tE}),eslintInspect:t_({type:em.CLI,packages:[{name:tg,type:ey.DEV_DEPENDENCY}],command:th}),nodeModulesInspect:t_({type:em.CLI,packages:[{name:ty,type:ey.DEV_DEPENDENCY}],command:tv}),eslintCheck:t_({type:em.CLI,packages:[{name:e7,type:ey.DEV_DEPENDENCY}],command:"".concat(e9," ").concat(tC.WORKING_DIRECTORY," --no-cache")}),eslintFix:t_({type:em.CLI,packages:[{name:e7,type:ey.DEV_DEPENDENCY}],command:"".concat(e9," ").concat(tC.WORKING_DIRECTORY," --fix --no-cache")}),typescriptCheck:t_({type:em.CLI,packages:[{name:tc,type:ey.DEV_DEPENDENCY}],command:"".concat(tu," -p ").concat(tC.TS_CONFIG," --noEmit")}),testUnit:t_({type:em.CLI,packages:[{name:te,type:ey.DEV_DEPENDENCY}],command:"".concat(tn," --config ").concat(tC.VITEST_UNIT_CONFIG)}),testE2e:t_({type:em.CLI,packages:[{name:te,type:ey.DEV_DEPENDENCY}],command:"".concat(tn," --config ").concat(tC.VITEST_E2E_CONFIG)}),mongoMigrateCreate:M(function(e){return t_({type:em.CLI,packages:[{name:tl,type:ey.DEPENDENCY},{name:tS,type:ey.DEPENDENCY}],command:"".concat(tl," ").concat(tO," create ").concat(e," -f ").concat(tC.MIGRATE_MONGO_CONFIG)})()},"mongoMigrateCreate"),mongoMigrateUp:t_({type:em.CLI,packages:[{name:tl,type:ey.DEPENDENCY},{name:tS,type:ey.DEPENDENCY}],command:"".concat(tl," ").concat(tO," up -f ").concat(tC.MIGRATE_MONGO_CONFIG)}),mongoMigrateDown:t_({type:em.CLI,packages:[{name:tl,type:ey.DEPENDENCY},{name:tS,type:ey.DEPENDENCY}],command:"".concat(tl," ").concat(tO," down -f ").concat(tC.MIGRATE_MONGO_CONFIG)}),commitLint:t_({type:em.CLI,packages:[{name:tr,type:ey.DEV_DEPENDENCY},{name:ts,type:ey.DEV_DEPENDENCY}],command:"".concat(ti," --edit ").concat(tC.GIT_COMMIT_MSG," --config ").concat(tC.COMMITLINT_CONFIG)}),lintStaged:t_({type:em.CLI,packages:[{name:ta,type:ey.DEV_DEPENDENCY}],command:"".concat(to," --config ").concat(tC.LINT_STAGED_CONFIG)}),configureGitHook:t_({type:em.STRING,command:"".concat(td," config core.hooksPath ").concat(tC.GIT_HOOK)}),build:t_({type:em.STRING,command:"".concat(tf," run --if-present build")}),pnpmInstallStandard:t_({type:em.STRING,command:"".concat(tf," install --ignore-scripts")}),pnpmInstallLegacy:t_({type:em.STRING,command:"".concat(tf," install --ignore-scripts --legacy-peer-deps")}),pnpmInstallForce:t_({type:em.STRING,command:"".concat(tf," install --ignore-scripts --force")}),pnpmPruneStore:t_({type:em.STRING,command:"".concat(tf," store prune")}),pnpmCleanCache:t_({type:em.STRING,command:"".concat(tf," cache delete")})};var tN=en();function tb(e){return i(function(){var t,n,r,s;return x(this,function(i){switch(i.label){case 0:i.trys.push([0,3,,4]);return[4,ev("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:t=i.sent();if(!t.ok)throw new Error("Failed to fetch latest version: ".concat(t.status," ").concat(t.statusText));return[4,t.json()];case 2:n=i.sent(),r=n.version;return[2,{success:!0,result:r}];case 3:s=i.sent();return[2,ec(s)];case 4:return[2]}})})()}M(tb,"getLatestPackageVersion");function tT(e){return i(function(){var t,n,r,s,i,a,o,c,u,l,d,f,p,m,E,g,h,y,v,S,O,C,D,_;return x(this,function(I){switch(I.label){case 0:I.trys.push([0,2,,3]);if(!e){if(eG(tC.PACKAGE_JSON)){t=eR(tC.PACKAGE_JSON),n=t.name,r=n===void 0?"":n,s=t.version,i=s===void 0?"":s;return[2,{success:!0,result:{name:r,currentVersion:i,latestVersion:i,isCurrentProject:!0,isInstalled:!0,isUpToDate:!0,isDependency:!1,isDevDependency:!1,installedPath:tC.PACKAGE_JSON,file:t}}]}return[2,{success:!0,result:{name:"",currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:!1,isDevDependency:!1,installedPath:"",file:{}}}]}if(!eG(tC.PACKAGE_JSON))return[2,{success:!0,result:{name:e.name,currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:e.type===ey.DEPENDENCY,isDevDependency:e.type===ey.DEV_DEPENDENCY,installedPath:"",file:{}}}];a=eR(tC.PACKAGE_JSON),o=a.name,c=a.version,u=c===void 0?"":c,l=a.dependencies,d=l===void 0?{}:l,f=a.devDependencies,p=f===void 0?{}:f;if(e.name===o)return[2,{success:!0,result:{name:o,currentVersion:u,latestVersion:u,isCurrentProject:!0,isInstalled:!0,isUpToDate:!0,isDependency:e.type===ey.DEPENDENCY,isDevDependency:e.type===ey.DEV_DEPENDENCY,installedPath:tC.PACKAGE_JSON,file:a}}];m=e.name in d,E=e.name in p;return[4,tb(e.name)];case 1:g=I.sent();if(!g.success)return[2,{success:!0,result:{name:e.name,currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:m,isDevDependency:E,installedPath:"",file:{}}}];if(!m&&!E)return[2,{success:!0,result:{name:e.name,currentVersion:"",latestVersion:g.result,isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:e.type===ey.DEPENDENCY,isDevDependency:e.type===ey.DEV_DEPENDENCY,installedPath:"",file:{}}}];v=(y=(h=d[e.name])!==null&&h!==void 0?h:p[e.name])!==null&&y!==void 0?y:"",S=eY(tN.CWD,eW,e.name,ez);if(!eG(S))return[2,{success:!0,result:{name:e.name,currentVersion:"",latestVersion:g.result,isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:m,isDevDependency:E,installedPath:"",file:{}}}];O=eR(S),C=O.version,D=C===void 0?"":C;return[2,v!==D?{success:!0,result:{name:e.name,currentVersion:D||v,latestVersion:g.result,isCurrentProject:!1,isInstalled:!0,isUpToDate:!1,isDependency:m,isDevDependency:E,installedPath:S,file:O}}:{success:!0,result:{name:e.name,currentVersion:v,latestVersion:g.result,isCurrentProject:!1,isInstalled:!0,isUpToDate:v===g.result,isDependency:m,isDevDependency:E,installedPath:S,file:O}}];case 2:_=I.sent();return[2,ec(_)];case 3:return[2]}})})()}M(tT,"getPackage");function tA(e){return i(function(){var t,n,r,s,i;return x(this,function(a){try{;r=eR(tC.PACKAGE_JSON),s=(t=r.dependencies)!==null&&t!==void 0?t:{},i=(n=r.devDependencies)!==null&&n!==void 0?n:{};e.isDependency?s[e.name]=e.latestVersion:e.isDevDependency&&(i[e.name]=e.latestVersion),ex(tC.PACKAGE_JSON,JSON.stringify(r,null,4)),eo.info('Updated "'.concat(e.name,'" to version ').concat(e.latestVersion))}catch(e){ec(e)}return[2]})})()}M(tA,"updatePackage");function tR(){return i(function(){var e,t,n,r,s,i,a,o,c,u,l,d,f;return x(this,function(p){switch(p.label){case 0:p.trys.push([0,12,,13]);e=[{command:M(function(){return tI.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:M(function(){return tI.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:M(function(){return tI.pnpmInstallForce()},"command"),message:"Retrying with force install"}];t=true,n=false,r=undefined;p.label=1;case 1:p.trys.push([1,9,10,11]);s=e[Symbol.iterator]();p.label=2;case 2:if(!!(t=(i=s.next()).done))return[3,8];a=i.value,o=a.command,c=a.message;p.label=3;case 3:p.trys.push([3,6,,7]);return[4,o()];case 4:u=p.sent();return[4,tJ("".concat(c," using: ").concat(u),u)];case 5:p.sent();return[2];case 6:l=p.sent();ec(l);return[3,7];case 7:t=true;return[3,2];case 8:return[3,11];case 9:d=p.sent();n=true;r=d;return[3,11];case 10:try{if(!t&&s.return!=null){s.return()}}finally{if(n){throw r}}return[7];case 11:return[3,13];case 12:f=p.sent();ec(f);return[3,13];case 13:return[2]}})})()}M(tR,"installDependencies");function tx(e,t){return i(function(){var n,r,s,i,a,o,c,u,l,d,f,p,m,E,g,h,y;return x(this,function(v){switch(v.label){case 0:v.trys.push([0,15,,16]);if(!eG(tC.PACKAGE_JSON)){eo.error("package.json not found. Aborting setup.");return[2]}return[4,Promise.all(e.map(tT))];case 1:s=v.sent().filter(function(e){return e.success&&!!e.result&&!e.result.isCurrentProject}).map(function(e){return e.result}),i=s.filter(function(e){return!e.isInstalled}),a=s.filter(function(e){return!e.isUpToDate}),o=[];(t===null||t===void 0?void 0:t.install)&&i.length>0&&(n=o).push.apply(n,b(i.map(tA))),(t===null||t===void 0?void 0:t.update)&&a.length>0&&(r=o).push.apply(r,b(a.map(tA)));c=o.length>0;if(!c)return[3,6];return[4,Promise.all(o)];case 2:v.sent();return[4,tR()];case 3:v.sent();u=["Running ESLint with auto-fix"];return[4,tI.eslintFix()];case 4:return[4,tJ.apply(void 0,u.concat([v.sent()]))];case 5:c=v.sent();v.label=6;case 6:c;d=true,f=false,p=undefined;v.label=7;case 7:v.trys.push([7,12,13,14]);m=((l=t===null||t===void 0?void 0:t.callbacks)!==null&&l!==void 0?l:[])[Symbol.iterator]();v.label=8;case 8:if(!!(d=(E=m.next()).done))return[3,11];g=E.value;return[4,g()];case 9:v.sent();v.label=10;case 10:d=true;return[3,8];case 11:return[3,14];case 12:h=v.sent();f=true;p=h;return[3,14];case 13:try{if(!d&&m.return!=null){m.return()}}finally{if(f){throw p}}return[7];case 14:return[3,16];case 15:y=v.sent();ec(y);return[3,16];case 16:return[2]}})})()}M(tx,"setupPackages");import tP from"node-persist";var tG=en();function tM(){return i(function(){var e;return x(this,function(t){switch(t.label){case 0:e=tP.defaultInstance;if(e)return[3,2];return[4,tP.init({dir:tG.CYBERSKILL_STORAGE_DIRECTORY})];case 1:e=t.sent();t.label=2;case 2:e;return[2]}})})()}M(tM,"initNodePersist");var tw={get:function e(e){return i(function(){var t,n;return x(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,tM()];case 1:r.sent();return[4,tP.getItem(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:null];case 3:n=r.sent();return[2,ec(n,{returnValue:null})];case 4:return[2]}})})()},set:function e(e,t){return i(function(){var n;return x(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,tM()];case 1:r.sent();return[4,tP.setItem(e,t)];case 2:r.sent();return[3,4];case 3:n=r.sent();ec(n);return[3,4];case 4:return[2]}})})()},remove:function e(e){return i(function(){var t;return x(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,tM()];case 1:n.sent();return[4,tP.removeItem(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();ec(t);return[3,4];case 4:return[2]}})})()},keys:function e(){return i(function(){var e,t;return x(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,tM()];case 1:n.sent();return[4,tP.keys()];case 2:e=n.sent();return[2,Array.isArray(e)?e:(eo.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=n.sent();return[2,ec(t,{returnValue:[]})];case 4:return[2]}})})()},getLogLink:function e(e){return i(function(){return x(this,function(t){try{return[2,"".concat(tG.CYBERSKILL_STORAGE_DIRECTORY," (key: ").concat(e,")")]}catch(e){return[2,ec(e,{returnValue:null})]}return[2]})})()}};var tL=en(),tj=eh.promisify(eE);function tk(){return i(function(){var e;return x(this,function(t){switch(t.label){case 0:return[4,tT()];case 1:e=t.sent();return[2,e.success?e.result.name:Date.now().toString()]}})})()}M(tk,"getPackageName");function tU(e){return i(function(){var t,n;return x(this,function(r){switch(r.label){case 0:if(e.length===0)return[2];return[4,tk()];case 1:t=r.sent();r.label=2;case 2:r.trys.push([2,4,,5]);return[4,tw.set(t,e)];case 3:r.sent(),setTimeout(function(){return i(function(){var e;return x(this,function(n){switch(n.label){case 0:return[4,tw.getLogLink(t)];case 1:e=n.sent();e&&eo.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})})()},0);return[3,5];case 4:n=r.sent();ec(n);return[3,5];case 5:return[2]}})})()}M(tU,"saveErrorListToStorage");function tF(){return i(function(){var e,t,n;return x(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,tk()];case 1:e=r.sent();return[4,tw.get(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:[]];case 3:n=r.sent();return[2,ec(n,{returnValue:[]})];case 4:return[2]}})})()}M(tF,"getStoredErrorLists");function tV(){return i(function(){var e,t;return x(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,tk()];case 1:e=n.sent();return[4,tw.remove(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();ec(t);return[3,4];case 4:return[2]}})})()}M(tV,"clearAllErrorLists");function tq(e){var t=[],n=[],r="",s=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,i=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,a=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))r=e.trim();else{var o,c,u,l,d;var f=s.exec(e)||[],p=i.exec(e)||[],m=a.exec(e)||[];var E,g,h,y,v,S;f.length&&r?t.push({file:r,position:"".concat(f[1],":").concat(f[2]),type:f[3]===V.Error?V.Error:V.Warning,message:(E=f===null||f===void 0?void 0:(o=f[4])===null||o===void 0?void 0:o.trim())!==null&&E!==void 0?E:"",rule:(g=f===null||f===void 0?void 0:(c=f[5])===null||c===void 0?void 0:c.trim())!==null&&g!==void 0?g:""}):p.length?t.push({file:(h=p===null||p===void 0?void 0:p[1])!==null&&h!==void 0?h:"",position:"".concat(p[2],":").concat(p[3]),type:p[4]===V.Error?V.Error:V.Warning,message:(y=p===null||p===void 0?void 0:(u=p[5])===null||u===void 0?void 0:u.trim())!==null&&y!==void 0?y:""}):m.length?t.push({file:"commitlint",type:V.Error,message:(v=m===null||m===void 0?void 0:(l=m[1])===null||l===void 0?void 0:l.trim())!==null&&v!==void 0?v:"",rule:(S=m===null||m===void 0?void 0:(d=m[2])===null||d===void 0?void 0:d.trim())!==null&&S!==void 0?S:""}):n.push(e.trim())}}),t.length&&tU(t),tL.DEBUG&&n.length&&(eo.warn("Unmatched lines:"),n.forEach(function(e){return eo.info(" ".concat(e))}))}M(tq,"parseTextErrors");function tY(e){try{var t=JSON.parse(e),n=[];t.forEach(function(e){var t=e.filePath,r=e.messages;r.forEach(function(e){var r=e.severity,s=e.line,i=e.column,a=e.ruleId,o=e.message;n.push({type:r===2?V.Error:V.Warning,file:t,position:"".concat(s,":").concat(i),rule:a,message:o})})}),n.length&&tU(n)}catch(t){tq(e)}}M(tY,"parseCommandOutput");function tK(e){return i(function(e){var t,n,r,s,i,a,o,c,u;var l=arguments;return x(this,function(d){switch(d.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:tY;n=new AbortController;eg.on("SIGINT",function(){eo.warn("Process interrupted. Terminating..."),n.abort(),eg.exit()});d.label=1;case 1:d.trys.push([1,4,,5]);if(!(typeof e=="string"))return[3,3];return[4,tj(e,{maxBuffer:0x6400000,signal:n.signal})];case 2:r=d.sent(),s=r.stdout,i=r.stderr;[s,i].forEach(function(e){return e&&t(e)});d.label=3;case 3:return[3,5];case 4:a=d.sent();o=a.stdout,c=a.stderr,u=a.message;[o,c].forEach(function(e){return e&&t(e)}),!c&&!o&&eo.error("Command failed: ".concat(u));return[3,5];case 5:return[2]}})}).apply(this,arguments)}M(tK,"executeCommand");function tB(e){return{raw:!0,cmd:e}}M(tB,"rawCommand");function tH(e,t){return(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(tp," ").concat(tl," ").concat(e6," ").concat(e):"".concat(tp," ").concat(e8," ").concat(e)}M(tH,"formatCLI");function tW(e,t){return typeof e=="function"?tH(e(t),t):(typeof e==="undefined"?"undefined":T(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?tH(e,t):e}M(tW,"formatCommand");function tQ(e){return i(function(){var t,n,r;return x(this,function(s){switch(s.label){case 0:return[4,tT({name:eH})];case 1:t=s.sent();if(t.success){n={isCurrentProject:t.result.isCurrentProject},r=typeof e=="function"?e(n):e;return[2,Object.fromEntries(Object.entries(r).map(function(e){var t=I(e,2),r=t[0],s=t[1];return[r,tW(s,n)]}))]}return[2]}})})()}M(tQ,"resolveCommands");function tJ(e,t){return i(function(){var n;return x(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);eo.start("".concat(e)),tL.DEBUG&&eo.info("→ ".concat(t));return[4,tK(t)];case 1:r.sent(),eo.success("".concat(e," done."));return[3,3];case 2:n=r.sent();ec(n);return[3,3];case 3:return[2]}})})()}M(tJ,"runCommand");function tz(){return i(function(){var e,t;return x(this,function(n){switch(n.label){case 0:if(!eG(tC.TS_CONFIG))return[3,3];t=["Performing TypeScript validation"];return[4,tI.typescriptCheck()];case 1:return[4,tJ.apply(void 0,t.concat([n.sent()]))];case 2:e=n.sent();return[3,4];case 3:e=eo.warn("No TypeScript configuration found. Skipping type check.");n.label=4;case 4:e;return[2]}})})()}M(tz,"checkTypescript");function t$(){return i(function(){var e,t,n,r;var s=arguments;return x(this,function(i){switch(i.label){case 0:e=s.length>0&&s[0]!==void 0?s[0]:!1;if(!e)return[3,3];n=["Running ESLint with auto-fix"];return[4,tI.eslintFix()];case 1:return[4,tJ.apply(void 0,n.concat([i.sent()]))];case 2:t=i.sent();return[3,6];case 3:r=["Running ESLint check"];return[4,tI.eslintCheck()];case 4:return[4,tJ.apply(void 0,r.concat([i.sent()]))];case 5:t=i.sent();i.label=6;case 6:t;return[2]}})}).apply(this,arguments)}M(t$,"checkEslint");function tX(e,t){if(!t.length)return;var n=e==="Errors"?"red":"yellow";eo.printBoxedLog(e==="Errors"?"✖ Errors":"⚠ Warnings",t,n)}M(tX,"printIssues");function tZ(){return i(function(){return x(this,function(e){setTimeout(function(){return i(function(){var e,t,n;return x(this,function(r){switch(r.label){case 0:return[4,tF()];case 1:e=r.sent(),t=e.filter(function(e){return e.type===V.Error}),n=e.filter(function(e){return e.type===V.Warning});!t.length&&!n.length?eo.printBoxedLog("✔ NO ISSUES FOUND",[],"green"):(tX("Warnings",n),tX("Errors",t),(t.length>0||n.length>0)&&el.exit(1));return[2]}})})()},0);return[2]})})()}M(tZ,"showCheckResult");function t0(){return i(function(){var e,t,n,r;return x(this,function(s){switch(s.label){case 0:return[4,tV()];case 1:s.sent();return[4,tT({name:eH})];case 2:e=s.sent();if(!e.success){eo.error("Failed to retrieve package information. Aborting lint-staged.");return[2]}t=e.result.isCurrentProject;if(!t)return[3,5];n=["Building package: ".concat(eH)];return[4,tI.build()];case 3:return[4,tJ.apply(void 0,n.concat([s.sent()]))];case 4:t=s.sent();s.label=5;case 5:t;r=["Executing lint-staged"];return[4,tI.lintStaged()];case 6:return[4,tJ.apply(void 0,r.concat([s.sent()]))];case 7:s.sent(),tZ();return[2]}})})()}M(t0,"lintStaged");function t1(){return i(function(){var e;return x(this,function(t){switch(t.label){case 0:e=["Inspecting ESLint configuration"];return[4,tI.eslintInspect()];case 1:return[4,tJ.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}M(t1,"inspectLint");function t2(){return i(function(){return x(this,function(e){switch(e.label){case 0:return[4,tV()];case 1:e.sent();return[4,Promise.all([tz(),t$()])];case 2:e.sent(),tZ();return[2]}})})()}M(t2,"lintCheck");function t4(){return i(function(){return x(this,function(e){switch(e.label){case 0:return[4,tV()];case 1:e.sent();return[4,Promise.all([tz(),t$(!0)])];case 2:e.sent(),tZ();return[2]}})})()}M(t4,"lintFix");function t3(){return i(function(){var e;return x(this,function(t){switch(t.label){case 0:return[4,tV()];case 1:t.sent();e=["Validating commit message"];return[4,tI.commitLint()];case 2:return[4,tJ.apply(void 0,e.concat([t.sent()]))];case 3:t.sent(),tZ();return[2]}})})()}M(t3,"commitLint");function t5(){return i(function(){var e,t,n,r;return x(this,function(s){switch(s.label){case 0:e=["Configuring Git hooks"];return[4,tI.configureGitHook()];case 1:return[4,tJ.apply(void 0,e.concat([s.sent()]))];case 2:s.sent(),eM(tC.GIT_HOOK);return[4,tQ(tD)];case 3:t=s.sent();ex(tC.SIMPLE_GIT_HOOKS_JSON,JSON.stringify(t,null,4));n="\n".concat(e0,"\n");eG(tC.GIT_IGNORE)?eN(tC.GIT_IGNORE,"utf-8").split("\n").includes(e0)||eP(tC.GIT_IGNORE,n):ex(tC.GIT_IGNORE,n);r=["Setting up simple-git-hooks"];return[4,tI.simpleGitHooks()];case 4:return[4,tJ.apply(void 0,r.concat([s.sent()]))];case 5:s.sent();return[2]}})})()}M(t5,"setupGitHook");function t8(){return i(function(){return x(this,function(e){switch(e.label){case 0:return[4,tR()];case 1:e.sent();return[4,t5()];case 2:e.sent();return[2]}})})()}M(t8,"ready");function t6(){return i(function(){var e,t;return x(this,function(n){switch(n.label){case 0:eM(tC.NODE_MODULES,tC.PNPM_LOCK_YAML);e=["Pruning pnpm store"];return[4,tI.pnpmPruneStore()];case 1:return[4,tJ.apply(void 0,e.concat([n.sent()]))];case 2:n.sent();t=["Clearing pnpm cache"];return[4,tI.pnpmCleanCache()];case 3:return[4,tJ.apply(void 0,t.concat([n.sent()]))];case 4:n.sent();return[4,tR()];case 5:n.sent();return[4,t5()];case 6:n.sent();return[2]}})})()}M(t6,"reset");function t7(){return i(function(){var e;return x(this,function(t){switch(t.label){case 0:e=["Inspecting project dependencies"];return[4,tI.nodeModulesInspect()];case 1:return[4,tJ.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}M(t7,"inspect");function t9(){return i(function(){var e;return x(this,function(t){switch(t.label){case 0:e=["Running unit tests"];return[4,tI.testUnit()];case 1:return[4,tJ.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}M(t9,"testUnit");function ne(){return i(function(){var e;return x(this,function(t){switch(t.label){case 0:e=["Running end-to-end tests"];return[4,tI.testE2e()];case 1:return[4,tJ.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}M(ne,"testE2E");function nt(e){return i(function(){var t;return x(this,function(n){switch(n.label){case 0:t=["Creating MongoDB migration"];return[4,tI.mongoMigrateCreate(e)];case 1:return[4,tJ.apply(void 0,t.concat([n.sent()]))];case 2:n.sent();return[2]}})})()}M(nt,"mongoMigrateCreate");function nn(){return i(function(){var e;return x(this,function(t){switch(t.label){case 0:e=["Running MongoDB migrations"];return[4,tI.mongoMigrateUp()];case 1:return[4,tJ.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}M(nn,"mongoMigrateUp");function nr(){return i(function(){var e;return x(this,function(t){switch(t.label){case 0:e=["Rolling back MongoDB migration"];return[4,tI.mongoMigrateDown()];case 1:return[4,tJ.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}M(nr,"mongoMigrateDown");(function(){return i(function(){var e;return x(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,ef(ed(el.argv)).scriptName(e8).usage("$0 <command> [options]").command("lint","Check code for linting issues",t2).command("lint:fix","Fix linting issues automatically",t4).command("lint:inspect","View active ESLint configuration",t1).command("lint-staged","Run lint checks on staged files",t0).command("commitlint","Validate commit message format",t3).command("ready","Initialize project and dependencies",t8).command("reset","Reset the project and reinstall dependencies",t6).command("inspect","Analyze installed project dependencies",t7).command("test:unit","Run unit test suite",t9).command("test:e2e","Run end-to-end test suite",ne).command("mongo:migrate:create <name>","Create a MongoDB migration",function(e){return e.positional("name",{describe:"Migration name",type:"string"})},function(e){return i(function(){return x(this,function(t){switch(t.label){case 0:if(!e.name){eo.error("Migration name is required.");return[2]}return[4,nt(e.name)];case 1:t.sent();return[2]}})})()}).command("mongo:migrate:up","Apply all MongoDB migrations",nn).command("mongo:migrate:down","Rollback last MongoDB migration",nr).demandCommand(1,"Please specify a valid command.").strict().help().alias("h","help").alias("v","version").version(ep.version).epilog('\uD83D\uDCA1 Tip: Use "--help" with any command to see options\n').parse()];case 1:t.sent();return[3,3];case 2:e=t.sent();ec(e),el.exit(1);return[3,3];case 3:return[2]}})})()})();import{Router as ns}from"express";import{NestFactory as ni}from"@nestjs/core";import na from"body-parser";import no from"compression";import nc from"cookie-parser";import nu from"cors";import nl from"express";import nd from"express-session";import nf from"express-useragent";function np(e){var t=e.isDev,n=e.whiteList,r=O(e,["isDev","whiteList"]);return y({origin:M(function(e,r){t||!e||(n===null||n===void 0?void 0:n.includes(e!==null&&e!==void 0?e:""))?r(null,!0):r(new Error("Not allowed by CORS"),!1)},"origin"),credentials:!0},r)}M(np,"createCorsOptions");function nm(e){return nu(np(e))}M(nm,"createCors");function nE(e){return nd(e)}M(nE,"createSession");function ng(e){var t=nl();return t.set("trust proxy",1),t.use(nc()),t.use(nl.urlencoded({extended:!0})),t.use(no()),t.use(nf.express()),(e===null||e===void 0?void 0:e.staticFolder)&&t.use(nl.static(e.staticFolder)),t}M(ng,"createExpress");function nh(e){return i(function(){var t,n,r;return x(this,function(s){switch(s.label){case 0:return[4,ni.create(e.module)];case 1:r=s.sent();return[2,(r.getHttpAdapter().getInstance().set("trust proxy",1),r.use(nl.urlencoded({extended:!0})),r.use(nc()),r.use(no()),r.use(nf.express()),e.staticFolder&&r.use(nl.static(e.staticFolder)),e.filters&&(t=r).useGlobalFilters.apply(t,b(e.filters)),e.pipes&&(n=r).useGlobalPipes.apply(n,b(e.pipes)),r)]}})})()}M(nh,"createNest");var ny="MONGO_MIGRATE_OPTIONS";import{Collection as nv,Db as nS}from"mongodb";import{Document as nO,Model as nC}from"mongoose";var nD=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){o(this,t);return a(this,t,arguments)}return t}(nS);M(nD,"C_Db");var n_=nD,nI=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){o(this,t);return a(this,t,arguments)}return t}(nO);M(nI,"C_Document");var nN=nI,nb=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){o(this,t);return a(this,t,arguments)}return t}(nC);M(nb,"C_Model");var nT=nb,nA=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){o(this,t);return a(this,t,arguments)}return t}(nv);M(nA,"C_Collection");var nR=nA;import{format as nx}from"date-fns";import nP from"migrate-mongo";import{Document as nG}from"mongoose";import nM from"mongoose-aggregate-paginate-v2";import nw from"mongoose-paginate-v2";import{v4 as nL}from"uuid";import nj from"unorm";var nk={a:["\xe0","\xe1","ạ","ả","\xe3","\xe2","ầ","ấ","ậ","ẩ","ẫ","ă","ằ","ắ","ặ","ẳ","ẵ"],e:["\xe8","\xe9","ẹ","ẻ","ẽ","\xea","ề","ế","ệ","ể","ễ"],i:["\xec","\xed","ị","ỉ","ĩ"],o:["\xf2","\xf3","ọ","ỏ","\xf5","\xf4","ồ","ố","ộ","ổ","ỗ","ơ","ờ","ớ","ợ","ở","ỡ"],u:["\xf9","\xfa","ụ","ủ","ũ","ư","ừ","ứ","ự","ử","ữ"],y:["ỳ","\xfd","ỵ","ỷ","ỹ"],d:["đ"]},nU=Object.entries(nk).reduce(function(e,t){var n=I(t,2),r=n[0],s=n[1];return e[r.toUpperCase()]=s.map(function(e){return e.toUpperCase()}),e},{});function nF(e){e=nj.nfkc(e);var t=y({},nk,nU);var n=true,r=false,s=undefined;try{for(var i=Object.entries(t)[Symbol.iterator](),a;!(n=(a=i.next()).done);n=true){var o=I(a.value,2),c=o[0],u=o[1];var l="[".concat(c).concat(u.join(""),"]"),d="(".concat([c].concat(b(u)).join("|"),")");e=e.replace(new RegExp(l,"g"),d)}}catch(e){r=true;s=e}finally{try{if(!n&&i.return!=null){i.return()}}finally{if(r){throw s}}}return e}M(nF,"regexSearchMapper");function nV(e){return(typeof e==="undefined"?"undefined":T(e))=="object"&&e!==null&&!Array.isArray(e)}M(nV,"isObject");function nq(e){return JSON.parse(JSON.stringify(e))}M(nq,"deepClone");function nY(e,t){return t.reduce(function(e,t){if(e&&(typeof e==="undefined"?"undefined":T(e))=="object"&&t in e)return e[t]},e)}M(nY,"getNestedValue");function nK(e,t,n){if(t.length===0)return e;var r=N(t),s=r[0],i=r.slice(1);if(i.length===0)return S(y({},e),l({},s,n));var a=e[s];return S(y({},e),l({},s,nK((typeof a==="undefined"?"undefined":T(a))=="object"&&a!==null?a:{},i,n)))}M(nK,"setNestedValue");import nB from"crypto-js";import nH from"slugify";var nW=nH.default||nH;function nQ(e,t){var n=M(function(e){var n,r;return nW(e!==null&&e!==void 0?e:"",y({lower:(n=t===null||t===void 0?void 0:t.lower)!==null&&n!==void 0?n:!0,locale:(r=t===null||t===void 0?void 0:t.locale)!==null&&r!==void 0?r:"vi"},t))},"slugifyWithOptions");if(nV(e)){var r={};var s=true,i=false,a=undefined;try{for(var o=Object.entries(e)[Symbol.iterator](),c;!(s=(c=o.next()).done);s=true){var u=I(c.value,2),l=u[0],d=u[1];r[l]=n(d)}}catch(e){i=true;a=e}finally{try{if(!s&&o.return!=null){o.return()}}finally{if(i){throw a}}}return r}return n(e)}M(nQ,"generateSlug");function nJ(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:4;return nB.SHA256(e).toString(nB.enc.Hex).slice(0,t)}M(nJ,"generateShortId");var nz={isEmpty:function e(e){return e==null?!0:typeof e=="string"?e.trim().length===0:Array.isArray(e)?e.length===0:(typeof e==="undefined"?"undefined":T(e))=="object"?p(e,Date)?!1:p(e,Map)||p(e,Set)?e.size===0:p(e,WeakMap)||p(e,WeakSet)?!0:ArrayBuffer.isView(e)?e.byteLength===0:Object.keys(e).length===0:!1},isValidIP:function e(e){var t=e.split(".");return t.length===4&&t.every(function(e){return/^\d+$/.test(e)&&Number(e)>=0&&Number(e)<=255})?!0:/^(([a-f\d]{1,4}:){7}[a-f\d]{1,4}|((?:[a-f\d]{1,4}:){1,7}:)|((?:[a-f\d]{1,4}:){1,6}:[a-f\d]{1,4})|::)$/i.test(e)}};var n$={getDateTime:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:new Date;return nx(e,"yyyy-MM-dd HH:mm:ss.SSS")},createGenericFields:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.returnDateAs,n=t===void 0?"string":t;var r=n==="string"?n$.getDateTime():new Date;return{id:nL(),isDel:!1,createdAt:r,updatedAt:r}},applyPlugins:function e(e,t){t.filter(function(e){return typeof e=="function"}).forEach(function(t){return e.plugin(t)})},applyMiddlewares:function e(e,t){t.forEach(function(t){var n=t.method,r=t.pre,s=t.post;n&&r&&e.pre(n,r),n&&s&&e.post(n,s)})},createGenericSchema:function e(e){return new e.Schema({id:{type:String,default:nL,unique:!0},isDel:{type:Boolean,default:!1}},{timestamps:!0})},createSchema:function e(e){var t=e.mongoose,n=e.schema,r=e.virtuals,s=r===void 0?[]:r,i=e.standalone,a=i===void 0?!1:i;var o=new t.Schema(n);return s.forEach(function(e){var t=e.name,n=e.options,r=e.get;var s=o.virtual(t,n);r&&s.get(r)}),a||o.add(n$.createGenericSchema(t)),o},createModel:function e(e){var t=e.mongoose,n=e.name,r=e.schema,s=e.pagination,i=s===void 0?!1:s,a=e.aggregate,o=a===void 0?!1:a,c=e.virtuals,u=c===void 0?[]:c,l=e.middlewares,d=l===void 0?[]:l;if(!n)throw new Error("Model name is required.");if(t.models[n])return t.models[n];var f=n$.createSchema({mongoose:t,schema:r,virtuals:u});return n$.applyPlugins(f,[i&&nw,o&&nM]),n$.applyMiddlewares(f,d),t.model(n,f)},validator:{isRequired:function e(){return function(e){return i(function(){return x(this,function(t){return[2,!nz.isEmpty(e)]})})()}},isUnique:function e(e){return function(t){return i(function(){var n;return x(this,function(r){switch(r.label){case 0:if(!Array.isArray(e)||e.length===0)throw new Error("Fields must be a non-empty array of strings.");n={$or:e.map(function(e){return l({},e,t)})};return[4,this.constructor.exists(n)];case 1:return[2,!r.sent()]}})}).call(this)}},matchesRegex:function e(e){return function(t){return i(function(){return x(this,function(n){if(!Array.isArray(e)||e.some(function(e){return!p(e,RegExp)}))throw new Error("regexArray must be an array of valid RegExp objects.");return[2,e.every(function(e){return e.test(t)})]})})()}}},migrate:S(y({},nP),{setConfig:M(function(e){var t="// This file is automatically generated by the Cyberskill CLI.\nmodule.exports = ".concat(JSON.stringify(e,null,4));ex(tC.MIGRATE_MONGO_CONFIG,t);var n="\n".concat(e3,"\n");eG(tC.GIT_IGNORE)?eN(tC.GIT_IGNORE,"utf-8").split("\n").includes(e3)||eP(tC.GIT_IGNORE,n):ex(tC.GIT_IGNORE,n)},"setConfig")}),regexify:function e(e,t){if(!e)return{};var n=nq(e);if(!t||t.length===0)return n;var r=true,s=false,i=undefined;try{for(var a=t[Symbol.iterator](),o;!(r=(o=a.next()).done);r=true){var c=o.value;var u=c.toString().split("."),l=nY(n,u);if(typeof l=="string"&&l.length>0){var d={$regex:".*".concat(nF(l),".*"),$options:"i"};n=nK(n,u,d)}}}catch(e){s=true;i=e}finally{try{if(!r&&a.return!=null){a.return()}}finally{if(s){throw i}}}return n}},nX=/*#__PURE__*/function(){"use strict";function e(t,n){o(this,e);w(this,"collection");this.collection=t.collection(n)}u(e,[{key:"createOne",value:function e(e){return i(function(){var t,n;return x(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);t=y({},n$.createGenericFields(),e);return[4,this.collection.insertOne(t)];case 1:return[2,r.sent().acknowledged?{success:!0,message:"Document created successfully",result:t}:{success:!1,message:"Document creation failed",code:er.INTERNAL_SERVER_ERROR.CODE}];case 2:n=r.sent();return[2,ec(n)];case 3:return[2]}})}).call(this)}},{key:"createMany",value:function e(e){return i(function(){var t,n,r;return x(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);t=e.map(function(e){return y({},n$.createGenericFields(),e)});return[4,this.collection.insertMany(t)];case 1:n=s.sent();return[2,n.insertedCount===0?{success:!1,message:"No documents were inserted",code:er.INTERNAL_SERVER_ERROR.CODE}:{success:!0,message:"".concat(n.insertedCount," documents created successfully"),result:t}];case 2:r=s.sent();return[2,ec(r)];case 3:return[2]}})}).call(this)}},{key:"findOne",value:function e(e){return i(function(){var t,n;return x(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,this.collection.findOne(e)];case 1:t=r.sent();return[2,t?{success:!0,message:"Document found",result:t}:{success:!1,message:"Document not found",code:er.NOT_FOUND.CODE}];case 2:n=r.sent();return[2,ec(n)];case 3:return[2]}})}).call(this)}},{key:"findAll",value:function e(){return i(function(){var e,t,n;var r=arguments;return x(this,function(s){switch(s.label){case 0:e=r.length>0&&r[0]!==void 0?r[0]:{};s.label=1;case 1:s.trys.push([1,3,,4]);t={success:!0,message:"Documents retrieved successfully"};return[4,this.collection.find(e).toArray()];case 2:return[2,(t.result=s.sent(),t)];case 3:n=s.sent();return[2,ec(n)];case 4:return[2]}})}).apply(this,arguments)}},{key:"count",value:function e(){return i(function(){var e,t,n;var r=arguments;return x(this,function(s){switch(s.label){case 0:e=r.length>0&&r[0]!==void 0?r[0]:{};s.label=1;case 1:s.trys.push([1,3,,4]);t={success:!0,message:"Count retrieved successfully"};return[4,this.collection.countDocuments(e)];case 2:return[2,(t.result=s.sent(),t)];case 3:n=s.sent();return[2,ec(n)];case 4:return[2]}})}).apply(this,arguments)}},{key:"updateOne",value:function e(e,t){return i(function(){var n,r;return x(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);return[4,this.collection.updateOne(e,{$set:t})];case 1:n=s.sent();return[2,n.matchedCount===0?{success:!1,message:"No documents matched the filter",code:er.INTERNAL_SERVER_ERROR.CODE}:{success:!0,message:"Document updated successfully",result:n}];case 2:r=s.sent();return[2,ec(r)];case 3:return[2]}})}).call(this)}},{key:"updateMany",value:function e(e,t){return i(function(){var n,r;return x(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);return[4,this.collection.updateMany(e,{$set:t})];case 1:n=s.sent();return[2,n.matchedCount===0?{success:!1,message:"No documents matched the filter",code:er.INTERNAL_SERVER_ERROR.CODE}:{success:!0,message:"Documents updated successfully",result:n}];case 2:r=s.sent();return[2,ec(r)];case 3:return[2]}})}).call(this)}},{key:"deleteOne",value:function e(e){return i(function(){var t,n;return x(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,this.collection.deleteOne(e)];case 1:t=r.sent();return[2,t.deletedCount===0?{success:!1,message:"No documents matched the filter",code:er.INTERNAL_SERVER_ERROR.CODE}:{success:!0,message:"Document deleted successfully",result:t}];case 2:n=r.sent();return[2,ec(n)];case 3:return[2]}})}).call(this)}},{key:"deleteMany",value:function e(e){return i(function(){var t,n;return x(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,this.collection.deleteMany(e)];case 1:t=r.sent();return[2,t.deletedCount===0?{success:!1,message:"No documents matched the filter",code:er.INTERNAL_SERVER_ERROR.CODE}:{success:!0,message:"Documents deleted successfully",result:t}];case 2:n=r.sent();return[2,ec(n)];case 3:return[2]}})}).call(this)}}]);return e}();M(nX,"MongoController");var nZ=nX,n0=/*#__PURE__*/function(){"use strict";function e(t){o(this,e);w(this,"model");this.model=t}u(e,[{key:"getModelName",value:function e(){return this.model.modelName}},{key:"findOne",value:function e(e){return i(function(){var e,t,n,r,s,i,a;var o=arguments;return x(this,function(c){switch(c.label){case 0:e=o.length>0&&o[0]!==void 0?o[0]:{},t=o.length>1&&o[1]!==void 0?o[1]:{},n=o.length>2&&o[2]!==void 0?o[2]:{},r=o.length>3?o[3]:void 0;c.label=1;case 1:c.trys.push([1,3,,4]);s=this.model.findOne(e,t,n);r&&s.populate(r);return[4,s.exec()];case 2:i=c.sent();return[2,i?{success:!0,result:i}:{success:!1,message:"No ".concat(this.getModelName()," found."),code:er.NOT_FOUND.CODE}];case 3:a=c.sent();return[2,ec(a)];case 4:return[2]}})}).apply(this,arguments)}},{key:"findAll",value:function e(e){return i(function(){var e,t,n,r,s,i,a;var o=arguments;return x(this,function(c){switch(c.label){case 0:e=o.length>0&&o[0]!==void 0?o[0]:{},t=o.length>1&&o[1]!==void 0?o[1]:{},n=o.length>2&&o[2]!==void 0?o[2]:{},r=o.length>3?o[3]:void 0;c.label=1;case 1:c.trys.push([1,3,,4]);s=this.model.find(e,t,n);r&&s.populate(r);i={success:!0};return[4,s.exec()];case 2:return[2,(i.result=c.sent(),i)];case 3:a=c.sent();return[2,ec(a)];case 4:return[2]}})}).apply(this,arguments)}},{key:"findPaging",value:function e(){return i(function(){var e,t,n,r;var s=arguments;return x(this,function(i){switch(i.label){case 0:e=s.length>0&&s[0]!==void 0?s[0]:{},t=s.length>1&&s[1]!==void 0?s[1]:{};i.label=1;case 1:i.trys.push([1,3,,4]);n={success:!0};return[4,this.model.paginate(e,t)];case 2:return[2,(n.result=i.sent(),n)];case 3:r=i.sent();return[2,ec(r)];case 4:return[2]}})}).apply(this,arguments)}},{key:"findPagingAggregate",value:function e(e){return i(function(e){var t,n,r;var s=arguments;return x(this,function(i){switch(i.label){case 0:t=s.length>1&&s[1]!==void 0?s[1]:{};i.label=1;case 1:i.trys.push([1,3,,4]);n={success:!0};return[4,this.model.aggregatePaginate(this.model.aggregate(e),t)];case 2:return[2,(n.result=i.sent(),n)];case 3:r=i.sent();return[2,ec(r)];case 4:return[2]}})}).apply(this,arguments)}},{key:"count",value:function e(){return i(function(){var e,t,n;var r=arguments;return x(this,function(s){switch(s.label){case 0:e=r.length>0&&r[0]!==void 0?r[0]:{};s.label=1;case 1:s.trys.push([1,3,,4]);t={success:!0};return[4,this.model.countDocuments(e)];case 2:return[2,(t.result=s.sent(),t)];case 3:n=s.sent();return[2,ec(n)];case 4:return[2]}})}).apply(this,arguments)}},{key:"createOne",value:function e(e){return i(function(){var t,n;return x(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);t={success:!0};return[4,this.model.create(e)];case 1:return[2,(t.result=r.sent(),t)];case 2:n=r.sent();return[2,ec(n)];case 3:return[2]}})}).call(this)}},{key:"createMany",value:function e(e){return i(function(e){var t,n,r;var s=arguments;return x(this,function(i){switch(i.label){case 0:t=s.length>1&&s[1]!==void 0?s[1]:{};i.label=1;case 1:i.trys.push([1,3,,4]);n={success:!0};return[4,this.model.insertMany(e,t)];case 2:return[2,(n.result=i.sent().map(function(e){return p(e,nG)?e.toObject():null}).filter(function(e){return e!==null}),n)];case 3:r=i.sent();return[2,ec(r)];case 4:return[2]}})}).apply(this,arguments)}},{key:"updateOne",value:function e(){return i(function(){var e,t,n,r,s;var i=arguments;return x(this,function(a){switch(a.label){case 0:e=i.length>0&&i[0]!==void 0?i[0]:{},t=i.length>1&&i[1]!==void 0?i[1]:{},n=i.length>2&&i[2]!==void 0?i[2]:{};a.label=1;case 1:a.trys.push([1,3,,4]);return[4,this.model.findOneAndUpdate(e,t,y({new:!0},n)).exec()];case 2:r=a.sent();return[2,r?{success:!0,result:r}:{success:!1,message:"Failed to update ".concat(this.getModelName(),"."),code:er.NOT_FOUND.CODE}];case 3:s=a.sent();return[2,ec(s)];case 4:return[2]}})}).apply(this,arguments)}},{key:"updateMany",value:function e(){return i(function(){var e,t,n,r,s;var i=arguments;return x(this,function(a){switch(a.label){case 0:e=i.length>0&&i[0]!==void 0?i[0]:{},t=i.length>1&&i[1]!==void 0?i[1]:{},n=i.length>2&&i[2]!==void 0?i[2]:{};a.label=1;case 1:a.trys.push([1,3,,4]);r={success:!0};return[4,this.model.updateMany(e,t,n).exec()];case 2:return[2,(r.result=a.sent(),r)];case 3:s=a.sent();return[2,ec(s)];case 4:return[2]}})}).apply(this,arguments)}},{key:"deleteOne",value:function e(){return i(function(){var e,t,n,r;var s=arguments;return x(this,function(i){switch(i.label){case 0:e=s.length>0&&s[0]!==void 0?s[0]:{},t=s.length>1&&s[1]!==void 0?s[1]:{};i.label=1;case 1:i.trys.push([1,3,,4]);return[4,this.model.findOneAndDelete(e,t).exec()];case 2:n=i.sent();return[2,n?{success:!0,result:n}:{success:!1,message:"No ".concat(this.getModelName()," found to delete."),code:er.NOT_FOUND.CODE}];case 3:r=i.sent();return[2,ec(r)];case 4:return[2]}})}).apply(this,arguments)}},{key:"deleteMany",value:function e(){return i(function(){var e,t,n,r;var s=arguments;return x(this,function(i){switch(i.label){case 0:e=s.length>0&&s[0]!==void 0?s[0]:{},t=s.length>1&&s[1]!==void 0?s[1]:{};i.label=1;case 1:i.trys.push([1,3,,4]);return[4,this.model.deleteMany(e,t).exec()];case 2:n=i.sent();return[2,n.deletedCount===0?{success:!1,message:"No documents found to delete.",code:er.NOT_FOUND.CODE}:{success:!0,result:n}];case 3:r=i.sent();return[2,ec(r)];case 4:return[2]}})}).apply(this,arguments)}},{key:"createShortId",value:function e(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:4;return i(function(){var n,r,s,i,a;return x(this,function(o){switch(o.label){case 0:o.trys.push([0,6,,7]);n=new Set;r=0;o.label=1;case 1:if(!(r<10))return[3,5];s=nJ(e,r+t);i=!n.has(s);if(!i)return[3,3];n.add(s);return[4,this.model.exists({shortId:s})];case 2:i=!o.sent();o.label=3;case 3:if(i)return[2,{success:!0,result:s}];o.label=4;case 4:r++;return[3,1];case 5:return[2,{success:!1,message:"Failed to create a unique shortId",code:er.INTERNAL_SERVER_ERROR.CODE}];case 6:a=o.sent();return[2,ec(a)];case 7:return[2]}})}).call(this)}},{key:"createSlugQuery",value:function e(e){var t=e.slug,n=e.field,r=e.isObject,s=e.filter;var i=y({},s!==null&&s!==void 0?s:{});return r?S(y({},i),{$or:[l({},"slug.".concat(n),t),{slugHistory:{$elemMatch:l({},"slug.".concat(n),t)}}]}):S(y({},i),{$or:[{slug:t},{slugHistory:t}]})}},{key:"createUniqueSlug",value:function e(e){return i(function(e){var t,n,r,s,i,a,o;return x(this,function(c){switch(c.label){case 0:t=e.slug,n=e.field,r=e.isObject,s=e.filter;i=nQ(t),a=i,o=1;c.label=1;case 1:return[4,this.model.exists(this.createSlugQuery({slug:a,field:n,isObject:r,filter:s}))];case 2:if(!c.sent())return[3,4];a="".concat(i,"-").concat(o++);c.label=3;case 3:return[3,1];case 4:return[2,a]}})}).apply(this,arguments)}},{key:"createSlug",value:function e(e){return i(function(e){var t,n,r,s,a,o,c,u,l,d;return x(this,function(f){switch(f.label){case 0:t=this;n=e.field,r=e.from,s=e.filter;f.label=1;case 1:f.trys.push([1,6,,7]);a=r[n];if(!nV(a))return[3,3];c={success:!0};u=Object.fromEntries;return[4,Promise.all(Object.entries(a).map(function(e){var n=I(e,2),r=n[0],a=n[1];return i(function(){var e;return x(this,function(t){switch(t.label){case 0:return[4,this.createUniqueSlug({slug:a,field:r,isObject:!0,filter:s})];case 1:e=t.sent();return[2,[r,e]]}})}).call(t)}))];case 2:o=(c.result=u.apply(Object,[f.sent()]),c);return[3,5];case 3:l={success:!0};return[4,this.createUniqueSlug({slug:a,field:n,isObject:!1,filter:s})];case 4:o=(l.result=f.sent(),l);f.label=5;case 5:return[2,o];case 6:d=f.sent();return[2,ec(d)];case 7:return[2]}})}).apply(this,arguments)}},{key:"checkSlug",value:function e(e){return i(function(e){var t,n,r,s,i,a,o,c,u,l,d,f,p,m,E,g;return x(this,function(h){switch(h.label){case 0:t=e.slug,n=e.field,r=e.from,s=e.filter;h.label=1;case 1:h.trys.push([1,12,,13]);i=r[n];if(!nV(i))return[3,10];a=true,o=false,c=undefined;h.label=2;case 2:h.trys.push([2,7,8,9]);u=Object.values(i)[Symbol.iterator]();h.label=3;case 3:if(!!(a=(l=u.next()).done))return[3,6];d=l.value;f=nQ(d);return[4,this.model.exists(this.createSlugQuery({slug:f,field:n,isObject:!0,filter:s}))];case 4:if(h.sent())return[2,{success:!0,result:!0}];h.label=5;case 5:a=true;return[3,3];case 6:return[3,9];case 7:p=h.sent();o=true;c=p;return[3,9];case 8:try{if(!a&&u.return!=null){u.return()}}finally{if(o){throw c}}return[7];case 9:return[2,{success:!0,result:!1}];case 10:m=nQ(t);E={success:!0};return[4,this.model.exists(this.createSlugQuery({slug:m,field:n,isObject:!1,filter:s}))];case 11:return[2,(E.result=h.sent()!==null,E)];case 12:g=h.sent();return[2,ec(g)];case 13:return[2]}})}).apply(this,arguments)}},{key:"aggregate",value:function e(e){return i(function(){var t,n;return x(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);t={success:!0};return[4,this.model.aggregate(e)];case 1:return[2,(t.result=r.sent(),t)];case 2:n=r.sent();return[2,ec(n)];case 3:return[2]}})}).call(this)}}]);return e}();M(n0,"MongooseController");var n1=n0;function n2(e){return i(function(){return x(this,function(t){return[2,new Promise(function(t,n){var r=0;e.on("data",function(e){r+=e.length}),e.on("end",function(){return t(r)}),e.on("error",n)})]})})()}M(n2,"getFileSizeFromStream");function n4(e,t){var n=e.lastIndexOf(".");if(n===-1)return!1;var r=e.substring(n+1).toLowerCase();return t.includes(r)}M(n4,"validateFileExtension");function n3(e,t){var n=e.filename,r=e.fileSize,s=t.allowedExtensions,i=t.sizeLimit;return n4(n,s)?r!==void 0&&r>i?{isValid:!1,error:"File size exceeds limit. Maximum size: ".concat(Math.round(i/1048576),"MB")}:{isValid:!0}:{isValid:!1,error:"File extension not allowed. Allowed extensions: ".concat(s.join(", "))}}M(n3,"validateUpload");function n5(e){return i(function(){var t,n,r,s,i,a,o,c,u,l,d,f,m;return x(this,function(E){switch(E.label){case 0:t=e.path,n=e.file,r=e.config;if(!t||typeof t!="string")return[2,{success:!1,message:"Invalid path provided",result:""}];if(!n||(typeof n==="undefined"?"undefined":T(n))!="object")return[2,{success:!1,message:"Invalid file provided",result:""}];if(r){if(!Array.isArray(r.allowedExtensions)||r.allowedExtensions.length===0)return[2,{success:!1,message:"Invalid allowedExtensions in config",result:""}];if(typeof r.sizeLimit!="number"||r.sizeLimit<=0)return[2,{success:!1,message:"Invalid sizeLimit in config",result:""}]}E.label=1;case 1:E.trys.push([1,7,,8]);return[4,n];case 2:return[4,E.sent().file];case 3:s=E.sent(),i=s.filename,a=s.createReadStream;if(!r)return[3,5];o=a();return[4,n2(o)];case 4:c=E.sent(),u=n3({filename:i,fileSize:c},r);if(!u.isValid)return[2,{success:!1,message:u.error||"File validation failed",result:""}];E.label=5;case 5:l=eF(t);eG(l)||eI(l,{recursive:!0});d=a(),f=eA(t);d.pipe(f);return[4,new Promise(function(e,t){f.on("finish",function(){return e()}),f.on("error",t),d.on("error",t)})];case 6:return[2,(E.sent(),{success:!0,message:"File uploaded successfully",result:t})];case 7:m=E.sent();return[2,{success:!1,message:p(m,Error)?m.message:"File upload failed",result:""}];case 8:return[2]}})})()}M(n5,"upload");import{useServer as n8}from"graphql-ws/use/ws";import{WebSocketServer as n6}from"ws";function n7(e){return new n6({server:e.server,path:e.path})}M(n7,"createWSServer");function n9(e){return n8({schema:e.schema},e.server)}M(n9,"initGraphQLWS");export{eQ as BUILD_DIRECTORY,ti as COMMIT_LINT_CLI,ts as COMMIT_LINT_CONVENTIONAL_CONFIG_PACKAGE_NAME,tr as COMMIT_LINT_PACKAGE_NAME,e8 as CYBERSKILL_CLI,e6 as CYBERSKILL_CLI_PATH,e5 as CYBERSKILL_DIRECTORY,eH as CYBERSKILL_PACKAGE_NAME,nR as C_Collection,n_ as C_Db,nN as C_Document,nT as C_Model,e9 as ESLINT_CLI,th as ESLINT_INSPECT_CLI,tg as ESLINT_INSPECT_PACKAGE_NAME,e7 as ESLINT_PACKAGE_NAME,em as E_CommandType,V as E_IssueType,ey as E_PackageType,td as GIT_CLI,e4 as GIT_COMMIT_EDITMSG,e2 as GIT_HOOK,eZ as GIT_IGNORE,to as LINT_STAGED_CLI,ta as LINT_STAGED_PACKAGE_NAME,tO as MIGRATE_MONGO_CLI,e3 as MIGRATE_MONGO_CONFIG,tS as MIGRATE_MONGO_PACKAGE_NAME,ny as MONGO_MIGRATE_OPTIONS,nZ as MongoController,n1 as MongooseController,eW as NODE_MODULES,tv as NODE_MODULES_INSPECT_CLI,ty as NODE_MODULES_INSPECT_PACKAGE_NAME,ez as PACKAGE_JSON,e$ as PACKAGE_LOCK_JSON,tC as PATH,tt as PLAYWRIGHT_PACKAGE_NAME,tf as PNPM_CLI,tp as PNPM_EXEC_CLI,e1 as PNPM_LOCK_YAML,eJ as PUBLIC_DIRECTORY,ns as Router,tm as SIMPLE_GIT_HOOKS_PACKAGE_NAME,tE as SIMPLE_GIT_HOOK_CLI,e0 as SIMPLE_GIT_HOOK_JSON,eX as TSCONFIG_JSON,tu as TSC_CLI,tc as TSC_PACKAGE_NAME,tl as TSX_CLI,tn as VITEST_CLI,te as VITEST_PACKAGE_NAME,eB as WORKING_DIRECTORY,nM as aggregatePaginate,eP as appendFileSync,na as bodyParser,ec as catchError,tV as clearAllErrorLists,tI as command,ew as copySync,eu as createApolloServer,nm as createCors,np as createCorsOptions,ng as createExpress,tD as createGitHooksConfig,nh as createNest,nE as createSession,n7 as createWSServer,eA as createWriteStream,eF as dirname,nl as express,j as expressMiddleware,tW as formatCommand,eC as fs,tb as getLatestPackageVersion,tT as getPackage,tF as getStoredErrorLists,n9 as initGraphQLWS,tR as installDependencies,eY as join,eo as log,eD as lstatSync,eI as mkdirSync,n$ as mongo,nw as mongoosePaginate,eU as path,eG as pathExistsSync,tB as rawCommand,eN as readFileSync,eR as readJsonSync,e_ as readdirSync,eM as removeSync,eq as resolve,tQ as resolveCommands,eV as resolveWorkingPath,tJ as runCommand,tx as setupPackages,eT as statSync,tw as storage,ei as throwError,eb as unlinkSync,tA as updatePackage,n5 as upload,ex as writeFileSync};