@cyberskill/shared 1.68.0 → 1.69.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.
- package/dist/_tsup-dts-rollup.d.cts +0 -3
- package/dist/_tsup-dts-rollup.d.ts +0 -3
- package/dist/configs/config.util.cjs +1 -1
- package/dist/configs/config.util.js +1 -1
- package/dist/configs/eslint/index.cjs +1 -1
- package/dist/configs/eslint/index.js +1 -1
- package/dist/configs/index.cjs +1 -1
- package/dist/configs/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/nodejs/cli/cli.util.cjs +1 -1
- package/dist/nodejs/cli/cli.util.js +1 -1
- package/dist/nodejs/cli/index.cjs +1 -1
- package/dist/nodejs/cli/index.js +1 -1
- package/dist/nodejs/index.cjs +1 -1
- package/dist/nodejs/index.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e,t){if(t==null||t>e.length)t=e.length;for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function t(e){if(Array.isArray(e))return e}function r(t){if(Array.isArray(t))return e(t)}function n(e){if(e===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return e}function s(e,t,r,n,s,i,o){try{var a=e[i](o);var c=a.value}catch(e){r(e);return}if(a.done){t(c)}else{Promise.resolve(c).then(n,s)}}function i(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(e){s(o,n,i,a,c,"next",e)}function c(e){s(o,n,i,a,c,"throw",e)}a(undefined)})}}function o(e,t,r){t=d(t);return A(e,D()?Reflect.construct(t,r||[],d(e).constructor):t.apply(e,r))}function a(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function c(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false;n.configurable=true;if("value"in n)n.writable=true;Object.defineProperty(e,n.key,n)}}function u(e,t,r){if(t)c(e.prototype,t);if(r)c(e,r);return e}function l(e,t,r){if(t in e){Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true})}else{e[t]=r}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)N(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 E(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function m(e,t){var r=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(r==null)return;var n=[];var s=true;var i=false;var o,a;try{for(r=r.call(e);!(s=(o=r.next()).done);s=true){n.push(o.value);if(t&&n.length===t)break}}catch(e){i=true;a=e}finally{try{if(!s&&r["return"]!=null)r["return"]()}finally{if(i)throw a}}return n}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 v(){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 h(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};var n=Object.keys(r);if(typeof Object.getOwnPropertySymbols==="function"){n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))}n.forEach(function(t){l(e,t,r[t])})}return e}function y(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);if(t){n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})}r.push.apply(r,n)}return r}function _(e,t){t=t!=null?t:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(t))}else{y(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function S(e,t){if(e==null)return{};var r=O(e,t);var n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++){n=i[s];if(t.indexOf(n)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(e,n))continue;r[n]=e[n]}}return r}function O(e,t){if(e==null)return{};var r={};var n=Object.keys(e);var s,i;for(i=0;i<n.length;i++){s=n[i];if(t.indexOf(s)>=0)continue;r[s]=e[s]}return r}function A(e,t){if(t&&(C(t)==="object"||typeof t==="function")){return t}return n(e)}function N(e,t){N=Object.setPrototypeOf||function e(e,t){e.__proto__=t;return e};return N(e,t)}function I(e,r){return t(e)||m(e,r)||R(e,r)||g()}function T(e){return r(e)||E(e)||R(e)||v()}function C(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function R(t,r){if(!t)return;if(typeof t==="string")return e(t,r);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor)n=t.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(t,r)}function D(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(D=function(){return!!e})()}function b(e,t){var r,n,s,i,o={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]};return i={next:a(0),"throw":a(1),"return":a(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function a(e){return function(t){return c([e,t])}}function c(i){if(r)throw new TypeError("Generator is already executing.");while(o)try{if(r=1,n&&(s=i[0]&2?n["return"]:i[0]?n["throw"]||((s=n["return"])&&s.call(n),0):n.next)&&!(s=s.call(n,i[1])).done)return s;if(n=0,s)i=[i[0]&2,s.value];switch(i[0]){case 0:case 1:s=i;break;case 4:o.label++;return{value:i[1],done:false};case 5:o.label++;n=i[1];i=[0];continue;case 7:i=o.ops.pop();o.trys.pop();continue;default:if(!(s=o.trys,s=s.length>0&&s[s.length-1])&&(i[0]===6||i[0]===2)){o=0;continue}if(i[0]===3&&(!s||i[1]>s[0]&&i[1]<s[3])){o.label=i[1];break}if(i[0]===6&&o.label<s[1]){o.label=s[1];s=i;break}if(s&&o.label<s[2]){o.label=s[2];o.ops.push(i);break}if(s[2])o.ops.pop();o.trys.pop();continue}i=t.call(e,o)}catch(e){i=[6,e];n=0}finally{r=s=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}}var w=function(e){return e.ESLINT="eslint",e.COMMITLINT="commitlint",e.LINT_STAGED="lint-staged",e.VITEST_REACT_E2E="vitest-react-e2e",e.VITEST_REACT_UNIT="vitest-react-unit",e}(w||{});import x from"@antfu/eslint-config";import L from"@vitejs/plugin-react-swc";import{defineConfig as P}from"vitest/config";function M(e){return P(h({plugins:[L()],test:{include:["**/*.test.e2e.?(c|m)[jt]s?(x)"],browser:{enabled:!0,provider:"playwright",instances:[{browser:"chromium"},{browser:"firefox"},{browser:"webkit"}]}}},e))}import j from"@vitejs/plugin-react-swc";import{defineConfig as G}from"vitest/config";import k from"node:process";var U=function(e){return e.PNPM_ADD_AND_EXEC="PNPM_ADD_AND_EXEC",e.PNPM_ADD_DEV_AND_EXEC="PNPM_ADD_DEV_AND_EXEC",e.RAW="RAW",e}(U||{});import{exec as F}from"node:child_process";import q from"node:process";import*as K from"node:util";import Y from"node:process";var H=Y.env.DEBUG==="true";var B=function(e){return e.Error="error",e.Warning="warning",e}(B||{});import V from"chalk";import Q from"consola";import{GraphQLError as J}from"graphql";var W={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"}};function X(e){var t=e.message,r=e.status,n=r===void 0?W.INTERNAL_SERVER_ERROR:r,s=e.type,i=s===void 0?"graphql":s;var o;var a=(o=t!==null&&t!==void 0?t:n.MESSAGE)!==null&&o!==void 0?o:"Internal server error";throw i==="graphql"?new J(a,{extensions:{code:n.CODE}}):new Error(a)}H||(Q.level=4);function z(e){var t=V[e];return typeof t=="function"?t:V.green}var $={silent:Q.silent,level:Q.level,fatal:Q.fatal,error:Q.error,warn:Q.warn,log:Q.log,info:Q.info,success:Q.success,ready:Q.ready,start:Q.start,box:Q.box,debug:Q.debug,trace:Q.trace,verbose:Q.verbose,printBoxedLog:function e(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(t===null||t===void 0?void 0:t.length)){Q.box(V.green(e));return}t.forEach(function(e){var t=e.file,n=e.position,s=e.rule,i=e.message;Q.log("".concat(V.gray("File:")," ").concat(V.blue("".concat(t).concat(n?":".concat(n):"")))),s&&Q.log(" ".concat(z(r)("Rule:")," ").concat(s)),Q.log(" ".concat(z(r)("Message:")," ").concat(i))}),Q.box(z(r)("".concat(e," : ").concat(t.length))),Q.log(V.gray("─".repeat(40)))}};var Z={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};import ee from"node-fetch";import*as et from"node:fs";function er(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}return t.every(function(e){return et.existsSync(e)})}function en(e,t){var r=et.readFileSync(e,"utf-8");if(t===null||t===void 0?void 0:t.asJson)try{var n=JSON.parse(r);if((typeof n==="undefined"?"undefined":C(n))=="object"&&n!==null)return n;throw new Error("Parsed JSON is not an object or array")}catch(t){throw new Error("Failed to parse JSON from file: ".concat(e))}return r}function es(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var n=r.isJson,s=n===void 0?!1:n,i=s&&(typeof t==="undefined"?"undefined":C(t))=="object"?JSON.stringify(t,null,4):String(t);et.writeFileSync(e,i,"utf-8")}function ei(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var n=r.isJson,s=n===void 0?!1:n,i=s&&(typeof t==="undefined"?"undefined":C(t))=="object"?JSON.stringify(t,null,4):String(t);et.appendFileSync(e,i,"utf-8")}function eo(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}t.forEach(function(e){er(e)&&et.rmSync(e,{recursive:!0,force:!0})})}var ea={};function ec(e){if(e in ea)return ea[e];var t=eF(eq,eV);if(!er(t))return ea[e]=!1;try{var r,n;var s=en(t,{asJson:!0}),i=s.name===e,o=!!((r=s.dependencies)===null||r===void 0?void 0:r[e]),a=!!((n=s.devDependencies)===null||n===void 0?void 0:n[e]);return i||o||a?ea[e]={path:t,file:s,isCurrentProject:i,isDepend:o,isDevDepend:a}:ea[e]=!1}catch(t){return $.warn("Failed to read package.json: ".concat(t.message)),ea[e]=!1}}function eu(e){return el.apply(this,arguments)}function el(){el=i(function(e){var t,r,n,s;return b(this,function(i){switch(i.label){case 0:i.trys.push([0,3,,4]);return[4,ee("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:r=i.sent(),n=r.version;return[2,n];case 3:s=i.sent();throw $.error('Failed to fetch version for "'.concat(e,'": ').concat(s.message)),s;case 4:return[2]}})});return el.apply(this,arguments)}function ed(e,t){return ef.apply(this,arguments)}function ef(){ef=i(function(e,t){var r,n,s,i,o,a,c,u,d,f,p,E,m,g,v;return b(this,function(y){switch(y.label){case 0:y.trys.push([0,4,,5]);o=ec(e);if(!o)return[2,h({},Z)];a=o.path,c=o.file,u=o.isCurrentProject,d=o.isDepend,f=o.isDevDepend,p="0.0.0";u&&c.version?p=c.version:d&&((r=c.dependencies)===null||r===void 0?void 0:r[e])?p=(n=c.dependencies)===null||n===void 0?void 0:n[e]:f&&((s=c.devDependencies)===null||s===void 0?void 0:s[e])&&(p=(i=c.devDependencies)===null||i===void 0?void 0:i[e]);if(!u)return[3,1];g=p;return[3,3];case 1:return[4,eu(e)];case 2:g=y.sent();y.label=3;case 3:E=g,m=u||p===E;return[2,(!m&&(t===null||t===void 0?void 0:t.update)&&(d?c.dependencies=_(h({},c.dependencies||{}),l({},e,E)):f&&(c.devDependencies=_(h({},c.devDependencies||{}),l({},e,E))),$.info('Updating package "'.concat(e,'" to version ').concat(E)),es(a,c,{isJson:!0})),{isCurrentProject:u,installedPath:a,file:c,isUpToDate:m})];case 4:v=y.sent();return[2,($.error('Error checking package "'.concat(e,'": ').concat(v.message)),h({},Z))];case 5:return[2]}})});return ef.apply(this,arguments)}import ep from"node-persist";import eE from"node:os";import em from"node:process";function eg(){return em.env.CYBERSKILL_STORAGE_DIR||eF(eE.homedir(),eY)}function ev(){return eh.apply(this,arguments)}function eh(){eh=i(function(){var e;return b(this,function(t){switch(t.label){case 0:e=ep.defaultInstance;if(e)return[3,2];return[4,ep.init({dir:eg(),stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,forgiveParseErrors:!0})];case 1:e=t.sent();t.label=2;case 2:e;return[2]}})});return eh.apply(this,arguments)}var ey={get:function e(e){return i(function(){var t,r;return b(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,ev()];case 1:n.sent();return[4,ep.getItem(e)];case 2:return[2,(t=n.sent())!==null&&t!==void 0?t:null];case 3:r=n.sent();return[2,($.error('[Storage:get] Error getting key "'.concat(e,'":'),r),null)];case 4:return[2]}})})()},set:function e(e,t){return i(function(){var r;return b(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,ev()];case 1:n.sent();return[4,ep.setItem(e,t)];case 2:n.sent();return[3,4];case 3:r=n.sent();$.error('[Storage:set] Error setting key "'.concat(e,'":'),r);return[3,4];case 4:return[2]}})})()},remove:function e(e){return i(function(){var t;return b(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,ev()];case 1:r.sent();return[4,ep.removeItem(e)];case 2:r.sent();return[3,4];case 3:t=r.sent();$.error('[Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},keys:function e(){return i(function(){var e,t;return b(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,ev()];case 1:r.sent();return[4,ep.keys()];case 2:e=r.sent();return[2,Array.isArray(e)?e:($.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=r.sent();return[2,($.error("[Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return i(function(){return b(this,function(t){try{return[2,"".concat(eg()," (key: ").concat(e,")")]}catch(e){return[2,($.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var e_=K.promisify(F);function eS(e){return"error_list:".concat(e)}function eO(e){return eA.apply(this,arguments)}function eA(){eA=i(function(e){var t,r,n;return b(this,function(s){switch(s.label){case 0:if(e.length===0)return[2];t=Date.now(),r=eS(t);s.label=1;case 1:s.trys.push([1,3,,4]);return[4,ey.set(r,{errors:e,timestamp:t})];case 2:s.sent(),setTimeout(/*#__PURE__*/i(function(){var e;return b(this,function(t){switch(t.label){case 0:return[4,ey.getLogLink(r)];case 1:e=t.sent();e&&$.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})}),10);return[3,4];case 3:n=s.sent();$.error("Failed to save errors: ".concat(n.message));return[3,4];case 4:return[2]}})});return eA.apply(this,arguments)}function eN(){return eI.apply(this,arguments)}function eI(){eI=i(function(){var e,t,r;return b(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,ey.keys()];case 1:e=n.sent(),t=Array.isArray(e)?e.filter(function(e){var t;return e===null||e===void 0?void 0:(t=e.startsWith)===null||t===void 0?void 0:t.call(e,"error_list:")}):[];return[4,Promise.all(t.map(/*#__PURE__*/function(){var e=i(function(e){var t;return b(this,function(r){switch(r.label){case 0:return[4,ey.get(e)];case 1:return[2,((t=r.sent())===null||t===void 0?void 0:t.errors)||[]]}})});return function(t){return e.apply(this,arguments)}}()))];case 2:return[2,n.sent().flat()];case 3:r=n.sent();return[2,($.error("Failed to retrieve stored errors: ".concat(r.message)),[])];case 4:return[2]}})});return eI.apply(this,arguments)}function eT(){return eC.apply(this,arguments)}function eC(){eC=i(function(){var e,t,r;return b(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,ey.keys()];case 1:e=n.sent(),t=Array.isArray(e)?e.filter(function(e){var t;return e===null||e===void 0?void 0:(t=e.startsWith)===null||t===void 0?void 0:t.call(e,"error_list:")}):[];return[4,Promise.all(t.map(function(e){return ey.remove(e)}))];case 2:n.sent();return[3,4];case 3:r=n.sent();$.error("Failed to clear error lists: ".concat(r.message));return[3,4];case 4:return[2]}})});return eC.apply(this,arguments)}function eR(e){var t=[],r=[],n="",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("/"))n=e.trim();else{var a=s.exec(e)||[],c=i.exec(e)||[],u=o.exec(e)||[];a.length&&n?t.push({file:n,position:"".concat(a[1],":").concat(a[2]),type:a[3]==="error"?"error":"warning",message:a[4].trim(),rule:a[5].trim()}):c.length?t.push({file:c[1],position:"".concat(c[2],":").concat(c[3]),type:c[4]==="error"?"error":"warning",message:c[5].trim()}):u.length?t.push({file:"commitlint",type:"error",message:u[1].trim(),rule:u[2].trim()}):r.push(e.trim())}}),t.length&&eO(t),H&&r.length&&($.warn("Unmatched lines:"),r.forEach(function(e){return $.info(" ".concat(e))}))}function eD(e){try{var t=JSON.parse(e),r=[];t.forEach(function(e){var t=e.filePath,n=e.messages;n.forEach(function(e){var n=e.severity,s=e.line,i=e.column,o=e.ruleId,a=e.message;r.push({type:n===2?"error":"warning",file:t,position:"".concat(s,":").concat(i),rule:o,message:a})})}),r.length&&eO(r)}catch(t){eR(e)}}function eb(e){return ew.apply(this,arguments)}function ew(){ew=i(function(e){var t,r,n,s,i,o,a,c,u;var l=arguments;return b(this,function(d){switch(d.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:eD;r=new AbortController;q.on("SIGINT",function(){$.warn("Process interrupted. Terminating..."),r.abort(),q.exit()});d.label=1;case 1:d.trys.push([1,3,,4]);return[4,e_(e,{maxBuffer:0x6400000,signal:r.signal})];case 2:n=d.sent(),s=n.stdout,i=n.stderr;[s,i].forEach(function(e){return e&&t(e)});return[3,4];case 3:o=d.sent();a=o.stdout,c=o.stderr,u=o.message;[a,c].forEach(function(e){return e&&t(e)}),!c&&!a&&$.error("Command failed: ".concat(u));return[3,4];case 4:return[2]}})});return ew.apply(this,arguments)}function ex(e){return{raw:!0,cmd:e}}function eL(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(ta," ").concat(eK," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(ta," ").concat(ts," ").concat(e2," ").concat(e):"".concat(ta," ").concat(e1," ").concat(e)}function eP(e,t){return typeof e=="function"?eL(e(t),t):(typeof e==="undefined"?"undefined":C(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?eL(e,t):e}function eM(e){return ej.apply(this,arguments)}function ej(){ej=i(function(e){var t,r,n,s,i,o,a;var c=arguments;return b(this,function(u){switch(u.label){case 0:t=c.length>1&&c[1]!==void 0?c[1]:{};n=(r=t===null||t===void 0?void 0:t.isRemote)!==null&&r!==void 0?r:!1;if(!n)return[3,1];a=!1;return[3,3];case 1:return[4,ed(eK)];case 2:a=u.sent().isCurrentProject;u.label=3;case 3:s=a,i={isRemote:n,isCurrentProject:s},o=typeof e=="function"?e(i):e;return[2,Object.fromEntries(Object.entries(o).map(function(e){var t=I(e,2),r=t[0],n=t[1];return[r,eP(n,i)]}))]}})});return ej.apply(this,arguments)}import*as eG from"node:path";function ek(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}var n;return(n=eG).resolve.apply(n,[eq].concat(T(t)))}function eU(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}var n;return(n=eG).resolve.apply(n,T(t))}function eF(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}var n;return(n=eG).join.apply(n,T(t))}var eq=k.env.INIT_CWD||k.cwd(),eK="@cyberskill/shared",eY=".cyberskill-storage",eH="node_modules",eB="dist",eV="package.json",eQ="package-lock.json",eJ="tsconfig.json",eW=".gitignore",eX=".simple-git-hooks.json",ez="pnpm-lock.yaml",e$=".git/hooks/",eZ=".git/COMMIT_EDITMSG",e0=eF(eq,eH,eK,eB),e1="cyberskill",e2="src/nodejs/cli/index.ts",e3="eslint",e4="eslint",e5="vitest",e8="playwright",e6="vitest",e7="@commitlint/cli",e9="commitlint",te="lint-staged",tt="lint-staged",tr="typescript",tn="tsc",ts="tsx",ti="git",to="pnpm",ta="pnpm exec",tc="simple-git-hooks",tu="simple-git-hooks",tl="@eslint/config-inspector",td="eslint-config-inspector",tf="node-modules-inspector",tp="node-modules-inspector",tE={CYBERSKILL_DIRECTORY:e0,WORKING_DIRECTORY:eq,TS_CONFIG:ek(eJ),GIT_IGNORE:ek(eW),GIT_HOOK:ek(e$),GIT_COMMIT_MSG:ek(eZ),SIMPLE_GIT_HOOKS_JSON:ek(eX),PACKAGE_JSON:ek(eV),PACKAGE_LOCK_JSON:ek(eQ),PNPM_LOCK_YAML:ek(ez),NODE_MODULES:ek(eH),CYBERSKILL:{LINT_STAGED_CONFIG:ek("".concat(e0,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:ek("".concat(e0,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:ek("".concat(e0,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:ek("".concat(e0,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:ek("".concat(e0,"/react/vitest/vitest.e2e.js"))}};function tm(e){var t=e.isCurrentProject;return h({"pre-commit":tt,"commit-msg":e9},t&&{"pre-push":ex("".concat(ti," pull"))})}function tg(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++){r[n-1]=arguments[n]}var s=I(r,2),i=s[0],o=s[1],a=e==="RAW"?!0:er.apply(void 0,T(i.split(" ").map(function(e){return eF(tE.NODE_MODULES,e)})));switch(e){case"PNPM_ADD_AND_EXEC":return eP(ex("".concat(a?"":"".concat(to," add ").concat(i," && ")).concat(ta," ").concat(o)));case"PNPM_ADD_DEV_AND_EXEC":return eP(ex("".concat(a?"":"".concat(to," add -D ").concat(i," && ")).concat(ta," ").concat(o)));case"RAW":return eP(ex(i))}}var tv={SIMPLE_GIT_HOOKS:tg("PNPM_ADD_DEV_AND_EXEC",tc,tu),ESLINT_INSPECT:tg("PNPM_ADD_DEV_AND_EXEC",tl,td),NODE_MODULES_INSPECT:tg("PNPM_ADD_DEV_AND_EXEC",tf,tp),ESLINT_CHECK:tg("PNPM_ADD_DEV_AND_EXEC",e3,"".concat(e4," ").concat(tE.WORKING_DIRECTORY)),ESLINT_FIX:tg("PNPM_ADD_DEV_AND_EXEC",e3,"".concat(e4," ").concat(tE.WORKING_DIRECTORY," --fix")),TYPESCRIPT_CHECK:tg("PNPM_ADD_AND_EXEC",tr,"".concat(tn," -p ").concat(tE.TS_CONFIG," --noEmit")),CONFIGURE_GIT_HOOK:tg("RAW","".concat(ti," config core.hooksPath ").concat(tE.GIT_HOOK)),BUILD:tg("RAW","".concat(to," run build")),STAGE_BUILD_DIRECTORY:tg("RAW","".concat(ti," add ").concat(eB)),PNPM_INSTALL_STANDARD:tg("RAW","".concat(to," install")),PNPM_INSTALL_LEGACY:tg("RAW","".concat(to," install --legacy-peer-deps")),PNPM_INSTALL_FORCE:tg("RAW","".concat(to," install --force")),CYBERSKILL:{TEST_UNIT:tg("PNPM_ADD_AND_EXEC",e5,"".concat(e6," --config ").concat(tE.CYBERSKILL.UNIT_TEST_CONFIG)),TEST_E2E:tg("PNPM_ADD_AND_EXEC","".concat(e5," ").concat(e8),"".concat(e6," --config ").concat(tE.CYBERSKILL.E2E_TEST_CONFIG)),COMMIT_LINT:tg("PNPM_ADD_DEV_AND_EXEC",e7,"".concat(e9," --edit ").concat(tE.GIT_COMMIT_MSG," --config ").concat(tE.CYBERSKILL.COMMITLINT_CONFIG)),LINT_STAGED:tg("PNPM_ADD_DEV_AND_EXEC",te,"".concat(tt," --config ").concat(tE.CYBERSKILL.LINT_STAGED_CONFIG))}};function th(e){return G(h({plugins:[j()],test:{globals:!0,environment:"jsdom",pool:"vmThreads",include:["**/*.test.unit.?(c|m)[jt]s?(x)"],setupFiles:[tE.CYBERSKILL.UNIT_TEST_SETUP_CONFIG]}},e))}function ty(e){try{return JSON.parse(e),!0}catch(e){return!1}}function t_(e){return!!e&&(typeof e==="undefined"?"undefined":C(e))=="object"&&!Array.isArray(e)}function tS(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}return t.flat().reduce(function(e,t){var r=true,n=false,s=undefined;try{for(var i=Object.entries(t)[Symbol.iterator](),o;!(r=(o=i.next()).done);r=true){var a=I(o.value,2),c=a[0],u=a[1];var l=e[c];Array.isArray(u)?e[c]=Array.from(new Set(T(Array.isArray(l)?l:[]).concat(T(u)))):t_(u)?e[c]=tS(t_(l)?l:{},u):e[c]=u}}catch(e){n=true;s=e}finally{try{if(!r&&i.return!=null){i.return()}}finally{if(n){throw s}}}return e},{})}import*as tO from"globals";var tA=[{languageOptions:{globals:h({},tO.node,tO.browser)},rules:{"no-console":"warn","no-debugger":"warn","no-alert":"warn","perfectionist/sort-imports":["error",{internalPattern:["^#.*","^@/.*"]}]},ignores:["build","dist"]}];var tN=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}return tS.apply(void 0,T(t))},tI=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}var n=tS.apply(void 0,[tA].concat(T(t))),s=n.ignores,i=S(n,["ignores"]),o=Array.isArray(s)&&s.every(function(e){return typeof e=="string"})?{ignores:s}:void 0,a=[i].concat(T(o?[o]:[]));return x.apply(void 0,[{stylistic:{semi:!0,indent:4,quotes:"single"},formatters:{css:!0,html:!0,markdown:"prettier"},yaml:!1,react:!0}].concat(T(a)))},tT=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}return M.apply(void 0,T(t))},tC=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}return th.apply(void 0,T(t))},tR={eslint:tI,commitlint:tN,"lint-staged":tN,"vitest-react-e2e":tT,"vitest-react-unit":tC};function tD(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++){r[n-1]=arguments[n]}var s=tR[e];if(!s)throw new Error("Unknown config type: ".concat(e));return s.apply(void 0,T(r))}var tb=(typeof window==="undefined"?"undefined":C(window))<"u";var tw={lint:"Check code for linting issues","lint:fix":"Fix linting issues automatically","lint:inspect":"View active ESLint configuration","lint-staged":"Run lint checks on staged files",commitlint:"Validate commit message format",setup:"Initialize project setup and dependencies",reset:"Reset the project and reinstall dependencies",inspect:"Analyze installed project dependencies","test:unit":"Run unit test suite","test:e2e":"Run end-to-end test suite"};import tx from"node:process";import{hideBin as tL}from"yargs/helpers";import tP from"yargs/yargs";var tM={name:"@cyberskill/shared",type:"module",version:"1.67.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"},"./configs":{types:"./dist/configs/index.d.ts",import:"./dist/configs/index.js",require:"./dist/configs/index.cjs"},"./configs/commitlint":{types:"./dist/configs/commitlint/index.d.ts",import:"./dist/configs/commitlint/index.js",require:"./dist/configs/commitlint/index.cjs"},"./configs/eslint":{types:"./dist/configs/eslint/index.d.ts",import:"./dist/configs/eslint/index.js",require:"./dist/configs/eslint/index.cjs"},"./configs/graphql":{types:"./dist/configs/graphql/index.d.ts",import:"./dist/configs/graphql/index.js",require:"./dist/configs/graphql/index.cjs"},"./configs/lint-staged":{types:"./dist/configs/lint-staged/index.d.ts",import:"./dist/configs/lint-staged/index.js",require:"./dist/configs/lint-staged/index.cjs"},"./configs/vitest/react/e2e":{types:"./dist/configs/vitest/react/e2e.d.ts",import:"./dist/configs/vitest/react/e2e.js",require:"./dist/configs/vitest/react/e2e.cjs"},"./configs/vitest/react/unit":{types:"./dist/configs/vitest/react/unit.d.ts",import:"./dist/configs/vitest/react/unit.js",require:"./dist/configs/vitest/react/unit.cjs"},"./constants":{types:"./dist/constants/index.d.ts",import:"./dist/constants/index.js",require:"./dist/constants/index.cjs"},"./nodejs":{types:"./dist/nodejs/index.d.ts",import:"./dist/nodejs/index.js",require:"./dist/nodejs/index.cjs"},"./nodejs/cli":{types:"./dist/nodejs/cli/index.d.ts",import:"./dist/nodejs/cli/index.js",require:"./dist/nodejs/cli/index.cjs"},"./nodejs/command":{types:"./dist/nodejs/command/index.d.ts",import:"./dist/nodejs/command/index.js",require:"./dist/nodejs/command/index.cjs"},"./nodejs/fs":{types:"./dist/nodejs/fs/index.d.ts",import:"./dist/nodejs/fs/index.js",require:"./dist/nodejs/fs/index.cjs"},"./nodejs/log":{types:"./dist/nodejs/log/index.d.ts",import:"./dist/nodejs/log/index.js",require:"./dist/nodejs/log/index.cjs"},"./nodejs/mongo":{types:"./dist/nodejs/mongo/index.d.ts",import:"./dist/nodejs/mongo/index.js",require:"./dist/nodejs/mongo/index.cjs"},"./nodejs/package":{types:"./dist/nodejs/package/index.d.ts",import:"./dist/nodejs/package/index.js",require:"./dist/nodejs/package/index.cjs"},"./nodejs/path":{types:"./dist/nodejs/path/index.d.ts",import:"./dist/nodejs/path/index.js",require:"./dist/nodejs/path/index.cjs"},"./nodejs/storage":{types:"./dist/nodejs/storage/index.d.ts",import:"./dist/nodejs/storage/index.js",require:"./dist/nodejs/storage/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/vitest":{types:"./dist/react/vitest/index.d.ts",import:"./dist/react/vitest/index.js",require:"./dist/react/vitest/index.cjs"},"./styles/reset.css":{import:"./dist/styles/reset.css",require:"./dist/styles/reset.css"},"./typescript":{types:"./dist/typescript/index.d.ts",import:"./dist/typescript/index.js",require:"./dist/typescript/index.cjs"},"./utils":{types:"./dist/utils/index.d.ts",import:"./dist/utils/index.js",require:"./dist/utils/index.cjs"}},main:"./dist/index.cjs",module:"./dist/index.js",types:"./dist/index.d.ts",bin:{cyberskill:"./dist/nodejs/cli/index.js"},files:["dist","public"],scripts:{build:"tsup",dev:"dotenv -e .env -- tsup --watch",lint:"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint","lint:fix":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint:fix","lint:inspect":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint:inspect",reset:"dotenv -e .env -- tsx src/nodejs/cli/index.ts reset",setup:"dotenv -e .env -- tsx src/nodejs/cli/index.ts setup",inspect:"dotenv -e .env -- tsx src/nodejs/cli/index.ts inspect","test:unit":"dotenv -e .env -- tsx src/nodejs/cli/index.ts test:unit","test:e2e":"dotenv -e .env -- tsx src/nodejs/cli/index.ts test:e2e",commitlint:"dotenv -e .env -- tsx src/nodejs/cli/index.ts commitlint","lint-staged":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint-staged"},dependencies:{"@antfu/eslint-config":"4.11.0","@apollo/client":"3.13.6","@eslint-react/eslint-plugin":"1.41.0","@graphql-codegen/cli":"5.0.5","@graphql-codegen/client-preset":"4.8.0","@graphql-codegen/typescript-react-apollo":"4.3.2","@microsoft/api-extractor":"7.52.3","@next/eslint-plugin-next":"15.2.4","@swc/core":"1.11.18","@testing-library/jest-dom":"6.6.3","@testing-library/react":"16.3.0","@vitejs/plugin-react-swc":"3.8.1","@vitest/browser":"3.1.1",chalk:"5.4.1",classnames:"2.5.1",consola:"3.4.2","crypto-js":"4.2.0","date-fns":"4.1.0","dotenv-cli":"8.0.0","eslint-config-next":"15.2.4","eslint-plugin-format":"1.0.1","eslint-plugin-react-hooks":"5.2.0","eslint-plugin-react-refresh":"0.4.19",globals:"16.0.0",graphql:"16.10.0","graphql-ws":"6.0.4",i18next:"24.2.3",jsdom:"26.0.0",localforage:"1.10.0","modern-normalize":"3.0.1",mongodb:"6.15.0",mongoose:"8.13.2","mongoose-aggregate-paginate-v2":"1.1.4","mongoose-paginate-v2":"1.9.0","next-intl":"4.0.2","node-fetch":"3.3.2","node-persist":"4.0.4",ora:"8.2.0",playwright:"1.51.1","postcss-modules":"6.0.1",qs:"6.14.0",react:"19.1.0","react-dom":"19.1.0","react-hot-toast":"2.5.2","react-i18next":"15.4.1","react-icons":"5.5.0",sass:"1.86.3",slugify:"1.6.6",tsup:"8.4.0",tsx:"4.19.3",typescript:"5.8.3",unorm:"1.6.0",uuid:"11.1.0",vite:"6.2.5",vitest:"3.1.1","vitest-browser-react":"0.1.1",yargs:"17.7.2"},publishConfig:{access:"public",registry:"https://registry.npmjs.org/"},devDependencies:{"@commitlint/cli":"19.8.0","@eslint/config-inspector":"1.0.2","@types/crypto-js":"4.2.2","@types/mongoose-aggregate-paginate-v2":"1.0.12","@types/node-persist":"3.1.8","@types/react":"19.1.0","@types/react-dom":"19.1.1","@types/unorm":"1.3.31","@types/uuid":"10.0.0","@types/yargs":"17.0.33",eslint:"9.24.0","lint-staged":"15.5.0","node-modules-inspector":"0.6.3","simple-git-hooks":"2.12.1"}};function tj(e,t){return tG.apply(this,arguments)}function tG(){tG=i(function(e,t){var r;return b(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);$.start("".concat(e)),H&&$.info("→ ".concat(t));return[4,eb(t)];case 1:n.sent(),$.success("".concat(e," done."));return[3,3];case 2:r=n.sent();throw $.error("".concat(e," failed: ").concat(r.message)),r;case 3:return[2]}})});return tG.apply(this,arguments)}function tk(){return tU.apply(this,arguments)}function tU(){tU=i(function(){var e;return b(this,function(t){switch(t.label){case 0:if(!er(tE.TS_CONFIG))return[3,2];return[4,tj("Performing TypeScript validation",tv.TYPESCRIPT_CHECK)];case 1:e=t.sent();return[3,3];case 2:e=$.warn("No TypeScript configuration found. Skipping type check.");t.label=3;case 3:e;return[2]}})});return tU.apply(this,arguments)}function tF(){return tq.apply(this,arguments)}function tq(){tq=i(function(){var e,t;var r=arguments;return b(this,function(n){switch(n.label){case 0:e=r.length>0&&r[0]!==void 0?r[0]:!1;if(!e)return[3,2];return[4,tj("Running ESLint with auto-fix",tv.ESLINT_FIX)];case 1:t=n.sent();return[3,4];case 2:return[4,tj("Running ESLint check",tv.ESLINT_CHECK)];case 3:t=n.sent();n.label=4;case 4:t;return[2]}})});return tq.apply(this,arguments)}function tK(e,t){if(!t.length)return;var r=e==="Errors"?"red":"yellow";$.printBoxedLog(e==="Errors"?"✖ Errors":"⚠ Warnings",t,r)}function tY(){return tH.apply(this,arguments)}function tH(){tH=i(function(){var e,t,r;return b(this,function(n){switch(n.label){case 0:return[4,eN()];case 1:e=n.sent(),t=e.filter(function(e){return e.type==="error"}),r=e.filter(function(e){return e.type==="warning"});!t.length&&!r.length?$.printBoxedLog("✔ NO ISSUES FOUND",[],"green"):(tK("Warnings",r),tK("Errors",t));return[2]}})});return tH.apply(this,arguments)}function tB(){return tV.apply(this,arguments)}function tV(){tV=i(function(){var e,t,r;return b(this,function(n){switch(n.label){case 0:return[4,eT()];case 1:n.sent();return[4,ed(eK)];case 2:e=n.sent(),t=e.isCurrentProject;if(!t)return[3,7];n.label=3;case 3:n.trys.push([3,6,,7]);return[4,tj("Building package: ".concat(eK),tv.BUILD)];case 4:n.sent();return[4,tj("Staging build artifacts",tv.STAGE_BUILD_DIRECTORY)];case 5:n.sent();return[3,7];case 6:r=n.sent();throw $.error("Error building and staging ".concat(eK,": ").concat(r.message)),r;case 7:return[4,tj("Executing lint-staged",tv.CYBERSKILL.LINT_STAGED)];case 8:n.sent(),tY();return[2]}})});return tV.apply(this,arguments)}function tQ(){return tJ.apply(this,arguments)}function tJ(){tJ=i(function(){return b(this,function(e){switch(e.label){case 0:return[4,tj("Inspecting ESLint configuration",tv.ESLINT_INSPECT)];case 1:e.sent();return[2]}})});return tJ.apply(this,arguments)}function tW(){return tX.apply(this,arguments)}function tX(){tX=i(function(){return b(this,function(e){switch(e.label){case 0:return[4,eT()];case 1:e.sent();return[4,Promise.all([tk(),tF()])];case 2:e.sent(),tY();return[2]}})});return tX.apply(this,arguments)}function tz(){return t$.apply(this,arguments)}function t$(){t$=i(function(){return b(this,function(e){switch(e.label){case 0:return[4,eT()];case 1:e.sent();return[4,Promise.all([tk(),tF(!0)])];case 2:e.sent(),tY();return[2]}})});return t$.apply(this,arguments)}function tZ(){return t0.apply(this,arguments)}function t0(){t0=i(function(){return b(this,function(e){switch(e.label){case 0:return[4,eT()];case 1:e.sent();return[4,tj("Validating commit message",tv.CYBERSKILL.COMMIT_LINT)];case 2:e.sent(),tY();return[2]}})});return t0.apply(this,arguments)}function t1(){return t2.apply(this,arguments)}function t2(){t2=i(function(){var e,t;return b(this,function(r){switch(r.label){case 0:return[4,tj("Configuring Git hooks",tv.CONFIGURE_GIT_HOOK)];case 1:r.sent(),eo(tE.GIT_HOOK);return[4,eM(tm)];case 2:e=r.sent();es(tE.SIMPLE_GIT_HOOKS_JSON,e,{isJson:!0});t="\n".concat(eX,"\n");er(tE.GIT_IGNORE)?en(tE.GIT_IGNORE).split("\n").includes(eX)||ei(tE.GIT_IGNORE,t):es(tE.GIT_IGNORE,t);return[4,tj("Setting up simple-git-hooks",tv.SIMPLE_GIT_HOOKS)];case 3:r.sent();return[2]}})});return t2.apply(this,arguments)}function t3(){return t4.apply(this,arguments)}function t4(){t4=i(function(){var e,t,r,n,s,i,o,a,c,u,l;return b(this,function(d){switch(d.label){case 0:e=[{command:tv.PNPM_INSTALL_STANDARD,message:"Installing dependencies (standard)"},{command:tv.PNPM_INSTALL_LEGACY,message:"Retrying with legacy peer dependencies"},{command:tv.PNPM_INSTALL_FORCE,message:"Retrying with force install"}];t=true,r=false,n=undefined;d.label=1;case 1:d.trys.push([1,8,9,10]);s=e[Symbol.iterator]();d.label=2;case 2:if(!!(t=(i=s.next()).done))return[3,7];o=i.value,a=o.command,c=o.message;d.label=3;case 3:d.trys.push([3,5,,6]);return[4,tj("".concat(c," using: ").concat(a),a)];case 4:d.sent();return[2];case 5:u=d.sent();$.warn("Installation attempt failed: ".concat(a)),$.error("Details: ".concat(u.message));return[3,6];case 6:t=true;return[3,2];case 7:return[3,10];case 8:l=d.sent();r=true;n=l;return[3,10];case 9:try{if(!t&&s.return!=null){s.return()}}finally{if(r){throw n}}return[7];case 10:throw new Error("All dependency installation strategies failed.")}})});return t4.apply(this,arguments)}function t5(e,t){return t8.apply(this,arguments)}function t8(){t8=i(function(e,t){var r,n,s,i,o,a,c,u,l,d,f,p;return b(this,function(E){switch(E.label){case 0:if(!er(tE.PACKAGE_JSON)){$.error("package.json not found. Aborting setup.");return[2]}E.label=1;case 1:E.trys.push([1,14,,15]);return[4,ed(e,{update:t===null||t===void 0?void 0:t.update})];case 2:r=E.sent(),n=r.isUpToDate;s=n;if(s)return[3,5];return[4,t3()];case 3:E.sent();return[4,tz()];case 4:s=E.sent();E.label=5;case 5:s;o=true,a=false,c=undefined;E.label=6;case 6:E.trys.push([6,11,12,13]);u=((i=t===null||t===void 0?void 0:t.postInstallActions)!==null&&i!==void 0?i:[])[Symbol.iterator]();E.label=7;case 7:if(!!(o=(l=u.next()).done))return[3,10];d=l.value;return[4,d()];case 8:E.sent();E.label=9;case 9:o=true;return[3,7];case 10:return[3,13];case 11:f=E.sent();a=true;c=f;return[3,13];case 12:try{if(!o&&u.return!=null){u.return()}}finally{if(a){throw c}}return[7];case 13:$.success('"'.concat(e,'" setup completed.'));return[3,15];case 14:p=E.sent();throw $.error('Failed to setup "'.concat(e,'": ').concat(p.message)),p;case 15:return[2]}})});return t8.apply(this,arguments)}function t6(){return t7.apply(this,arguments)}function t7(){t7=i(function(){return b(this,function(e){switch(e.label){case 0:return[4,t5(eK,{update:!0,postInstallActions:[t1]})];case 1:e.sent();return[2]}})});return t7.apply(this,arguments)}function t9(){return re.apply(this,arguments)}function re(){re=i(function(){return b(this,function(e){switch(e.label){case 0:eo(tE.NODE_MODULES,tE.PNPM_LOCK_YAML);return[4,t3()];case 1:e.sent();return[4,t1()];case 2:e.sent();return[2]}})});return re.apply(this,arguments)}function rt(){return rr.apply(this,arguments)}function rr(){rr=i(function(){return b(this,function(e){switch(e.label){case 0:return[4,tj("Inspecting project dependencies",tv.NODE_MODULES_INSPECT)];case 1:e.sent();return[2]}})});return rr.apply(this,arguments)}function rn(){return rs.apply(this,arguments)}function rs(){rs=i(function(){return b(this,function(e){switch(e.label){case 0:return[4,tj("Running unit tests",tv.CYBERSKILL.TEST_UNIT)];case 1:e.sent();return[2]}})});return rs.apply(this,arguments)}function ri(){return ro.apply(this,arguments)}function ro(){ro=i(function(){return b(this,function(e){switch(e.label){case 0:return[4,tj("Running end-to-end tests",tv.CYBERSKILL.TEST_E2E)];case 1:e.sent();return[2]}})});return ro.apply(this,arguments)}i(function(){var e;return b(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,tP(tL(tx.argv)).scriptName(e1).usage("$0 <command> [options]").command("lint",tw.lint,tW).command("lint:fix",tw["lint:fix"],tz).command("lint:inspect",tw["lint:inspect"],tQ).command("lint-staged",tw["lint-staged"],tB).command("commitlint",tw.commitlint,tZ).command("setup",tw.setup,t6).command("reset",tw.reset,t9).command("inspect",tw.inspect,rt).command("test:unit",tw["test:unit"],rn).command("test:e2e",tw["test:e2e"],ri).demandCommand(1,"Please specify a valid command.").strict().help().alias("h","help").alias("v","version").version(tM.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();$.error("Fatal: ".concat(e.message)),tx.exit(1);return[3,3];case 3:return[2]}})})();import{format as ra}from"date-fns";import{Document as rc}from"mongoose";import ru from"mongoose-aggregate-paginate-v2";import rl from"mongoose-paginate-v2";import{v4 as rd}from"uuid";import rf from"crypto-js";import rp from"slugify";var rE=rp.default||rp;function rm(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;var r=t||{},n=r.lower,s=n===void 0?!0:n,i=r.locale,o=i===void 0?"vi":i,a=S(r,["lower","locale"]);return rE(e,h({lower:s,locale:o},a))}function rg(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:4;return rf.SHA256(e).toString(rf.enc.Hex).slice(0,t)}var rv={isEmpty:function e(e){return e==null?!0:Array.isArray(e)?e.length===0:(typeof e==="undefined"?"undefined":C(e))=="object"?p(e,Date)?!1:Object.keys(e).length===0:typeof e=="string"?e.trim().length===0:!1}};var rh={getDateTime:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:new Date;return ra(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,r=t===void 0?"string":t;var n=r==="string"?rh.getDateTime():new Date;return{id:rd(),isDel:!1,createdAt:n,updatedAt:n}},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 r=t.method,n=t.pre,s=t.post;r&&n&&e.pre(r,n),r&&s&&e.post(r,s)})},createGenericSchema:function e(e){return new e.Schema({id:{type:String,default:rd,required:!0,unique:!0},isDel:{type:Boolean,default:!1,required:!0}},{timestamps:!0})},createSchema:function e(e){var t=e.mongoose,r=e.schema,n=e.virtuals,s=n===void 0?[]:n,i=e.standalone,o=i===void 0?!1:i;var a=new t.Schema(r,{strict:!0});return s.forEach(function(e){var t=e.name,r=e.options,n=e.get;var s=a.virtual(t,r);n&&s.get(n)}),o||a.add(rh.createGenericSchema(t)),a},createModel:function e(e){var t=e.mongoose,r=e.name,n=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(!r)throw new Error("Model name is required.");if(t.models[r])return t.models[r];var f=rh.createSchema({mongoose:t,schema:n,virtuals:u});return rh.applyPlugins(f,[i&&rl,a&&ru]),rh.applyMiddlewares(f,d),t.model(r,f)},createSlugQuery:function e(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;return _(h({},t,r&&{id:{$ne:r}}),{$or:[{slug:e},{slugHistory:e}]})},validator:{isEmpty:function e(){return /*#__PURE__*/function(){var e=i(function(e){return b(this,function(t){return[2,!rv.isEmpty(e)]})});return function(t){return e.apply(this,arguments)}}()},isUnique:function e(e){return /*#__PURE__*/function(){var t=i(function(t){var r;return b(this,function(n){switch(n.label){case 0:if(!Array.isArray(e)||e.length===0)throw new Error("Fields must be a non-empty array of strings.");r={$or:e.map(function(e){return l({},e,t)})};return[4,this.constructor.findOne(r)];case 1:return[2,!n.sent()]}})});return function(e){return t.apply(this,arguments)}}()},matchesRegex:function e(e){return /*#__PURE__*/function(){var t=i(function(t){return b(this,function(r){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)})]})});return function(e){return t.apply(this,arguments)}}()}}},ry=/*#__PURE__*/function(){"use strict";function e(t,r){a(this,e);this.collection=t.collection(r)}u(e,[{key:"createOne",value:function e(e){var t=this;return i(function(){var r,n,s;return b(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);r=h({},rh.createGenericFields(),e);n={success:!0,message:"Document created successfully"};return[4,t.collection.insertOne(r)];case 1:return[2,(n.result=i.sent(),n)];case 2:s=i.sent();return[2,{success:!1,message:s.message}];case 3:return[2]}})})()}},{key:"createMany",value:function e(e){var t=this;return i(function(){var r,n,s;return b(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);r=e.map(function(e){return h({},rh.createGenericFields(),e)});return[4,t.collection.insertMany(r)];case 1:n=i.sent();return[2,n.insertedCount===0?{success:!1,message:"No documents were inserted"}:{success:!0,message:"".concat(n.insertedCount," documents created successfully"),result:n}];case 2:s=i.sent();return[2,{success:!1,message:s.message}];case 3:return[2]}})})()}},{key:"findOne",value:function e(e){var t=this;return i(function(){var r,n;return b(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);return[4,t.collection.findOne(e)];case 1:r=s.sent();return[2,r?{success:!0,message:"Document found",result:r}:{success:!1,message:"Document not found"}];case 2:n=s.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})})()}},{key:"findAll",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};var t=this;return i(function(){var r,n;return b(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);r={success:!0,message:"Documents retrieved successfully"};return[4,t.collection.find(e).toArray()];case 1:return[2,(r.result=s.sent(),r)];case 2:n=s.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})})()}},{key:"count",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};var t=this;return i(function(){var r,n;return b(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);r={success:!0,message:"Count retrieved successfully"};return[4,t.collection.countDocuments(e)];case 1:return[2,(r.result=s.sent(),r)];case 2:n=s.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})})()}},{key:"updateOne",value:function e(e,t){var r=this;return i(function(){var n,s;return b(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);return[4,r.collection.updateOne(e,{$set:t})];case 1:n=i.sent();return[2,n.matchedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Document updated successfully",result:n}];case 2:s=i.sent();return[2,{success:!1,message:s.message}];case 3:return[2]}})})()}},{key:"updateMany",value:function e(e,t){var r=this;return i(function(){var n,s;return b(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);return[4,r.collection.updateMany(e,{$set:t})];case 1:n=i.sent();return[2,n.matchedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Documents updated successfully",result:n}];case 2:s=i.sent();return[2,{success:!1,message:s.message}];case 3:return[2]}})})()}},{key:"deleteOne",value:function e(e){var t=this;return i(function(){var r,n;return b(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);return[4,t.collection.deleteOne(e)];case 1:r=s.sent();return[2,r.deletedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Document deleted successfully",result:r}];case 2:n=s.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})})()}},{key:"deleteMany",value:function e(e){var t=this;return i(function(){var r,n;return b(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);return[4,t.collection.deleteMany(e)];case 1:r=s.sent();return[2,r.deletedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Documents deleted successfully",result:r}];case 2:n=s.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})})()}}]);return e}(),r_=/*#__PURE__*/function(){"use strict";function e(t){a(this,e);this.model=t}u(e,[{key:"getModelName",value:function e(){return this.model.modelName}},{key:"findOne",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=arguments.length>3?arguments[3]:void 0;var s=this;return i(function(){var i,o,a;return b(this,function(c){switch(c.label){case 0:c.trys.push([0,2,,3]);i=s.model.findOne(e,t,r);n&&i.populate(n);return[4,i.exec()];case 1:o=c.sent();return[2,o?{success:!0,result:o}:{success:!1,message:"No ".concat(s.getModelName()," found."),code:W.NOT_FOUND.CODE}];case 2:a=c.sent();return[2,{success:!1,message:a.message,code:W.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"findAll",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=arguments.length>3?arguments[3]:void 0;var s=this;return i(function(){var i,o,a;return b(this,function(c){switch(c.label){case 0:c.trys.push([0,2,,3]);i=s.model.find(e,t,r);n&&i.populate(n);o={success:!0};return[4,i.exec()];case 1:return[2,(o.result=c.sent(),o)];case 2:a=c.sent();return[2,{success:!1,message:a.message,code:W.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"findPaging",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var r=this;return i(function(){var n,s;return b(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);n={success:!0};return[4,r.model.paginate(e,t)];case 1:return[2,(n.result=i.sent(),n)];case 2:s=i.sent();return[2,{success:!1,message:s.message,code:W.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"findPagingAggregate",value:function e(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var r=this;return i(function(){var n,s;return b(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);n={success:!0};return[4,r.model.aggregatePaginate(r.model.aggregate(e),t)];case 1:return[2,(n.result=i.sent(),n)];case 2:s=i.sent();return[2,{success:!1,message:s.message,code:W.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"count",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};var t=this;return i(function(){var r,n;return b(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);r={success:!0};return[4,t.model.countDocuments(e)];case 1:return[2,(r.result=s.sent(),r)];case 2:n=s.sent();return[2,{success:!1,message:n.message,code:W.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"createOne",value:function e(e){var t=this;return i(function(){var r,n;return b(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);r={success:!0};return[4,t.model.create(e)];case 1:return[2,(r.result=s.sent(),r)];case 2:n=s.sent();return[2,{success:!1,message:n.message,code:W.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"createMany",value:function e(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var r=this;return i(function(){var n,s;return b(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);n={success:!0};return[4,r.model.insertMany(e,t)];case 1:return[2,(n.result=i.sent().map(function(e){return p(e,rc)?e.toObject():null}).filter(function(e){return e!==null}),n)];case 2:s=i.sent();return[2,{success:!1,message:s.message,code:W.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"updateOne",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var n=this;return i(function(){var s,i;return b(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);return[4,n.model.findOneAndUpdate(e,t,h({new:!0},r)).exec()];case 1:s=o.sent();return[2,s?{success:!0,result:s}:{success:!1,message:"Failed to update ".concat(n.getModelName(),"."),code:W.NOT_FOUND.CODE}];case 2:i=o.sent();return[2,{success:!1,message:i.message,code:W.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"updateMany",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var n=this;return i(function(){var s,i;return b(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);s={success:!0};return[4,n.model.updateMany(e,t,r).exec()];case 1:return[2,(s.result=o.sent(),s)];case 2:i=o.sent();return[2,{success:!1,message:i.message,code:W.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"deleteOne",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var r=this;return i(function(){var n,s;return b(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);return[4,r.model.findOneAndDelete(e,t).exec()];case 1:n=i.sent();return[2,n?{success:!0,result:n}:{success:!1,message:"No ".concat(r.getModelName()," found to delete."),code:W.NOT_FOUND.CODE}];case 2:s=i.sent();return[2,{success:!1,message:s.message,code:W.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"deleteMany",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var r=this;return i(function(){var n,s;return b(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);return[4,r.model.deleteMany(e,t).exec()];case 1:n=i.sent();return[2,n.deletedCount===0?{success:!1,message:"No documents found to delete.",code:W.NOT_FOUND.CODE}:{success:!0,result:n}];case 2:s=i.sent();return[2,{success:!1,message:s.message,code:W.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"createShortId",value:function e(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:4;var r=this;return i(function(){var n,s,i,o;return b(this,function(a){switch(a.label){case 0:n=new Set;s=0;a.label=1;case 1:if(!(s<10))return[3,5];i=rg(e,s+t);o=!n.has(i);if(!o)return[3,3];n.add(i);return[4,r.model.exists({shortId:i})];case 2:o=!a.sent();a.label=3;case 3:if(o)return[2,{success:!0,result:i}];a.label=4;case 4:s++;return[3,1];case 5:return[2,{success:!1,message:"Failed to create a unique shortId",code:W.INTERNAL_SERVER_ERROR.CODE}]}})})()}},{key:"createSlug",value:function e(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var n=this;return i(function(){var s,o,a,c,u,l,d,f,p,E,m;return b(this,function(g){switch(g.label){case 0:g.trys.push([0,8,,9]);s=t[e],o=/*#__PURE__*/function(){var e=i(function(e){var s,i,o;return b(this,function(a){switch(a.label){case 0:return[4,n.model.findOne(rh.createSlugQuery(e,r,t.id))];case 1:s=a.sent();if(!s)return[2,e];i=1;a.label=2;case 2:o="".concat(e,"-").concat(i);return[4,n.model.findOne(rh.createSlugQuery(o,r,t.id))];case 3:s=a.sent(),i++;a.label=4;case 4:if(s)return[3,2];a.label=5;case 5:return[2,o]}})});return function t(t){return e.apply(this,arguments)}}();if(!((typeof s==="undefined"?"undefined":C(s))=="object"))return[3,5];a={};c=[];for(u in s)c.push(u);l=0;g.label=1;case 1:if(!(l<c.length))return[3,4];d=c[l];f=rm(s[d]);return[4,o(f)];case 2:a[d]=g.sent();g.label=3;case 3:l++;return[3,1];case 4:return[2,{success:!0,result:a}];case 5:p=rm(s);E={success:!0};return[4,o(p)];case 6:return[2,(E.result=g.sent(),E)];case 7:return[3,9];case 8:m=g.sent();return[2,{success:!1,message:"Failed to create a unique slug: ".concat(m.message),code:W.INTERNAL_SERVER_ERROR.CODE}];case 9:return[2]}})})()}},{key:"aggregate",value:function e(e){var t=this;return i(function(){var r,n;return b(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);r={success:!0};return[4,t.model.aggregate(e)];case 1:return[2,(r.result=s.sent(),r)];case 2:n=s.sent();return[2,{success:!1,message:n.message,code:W.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}}]);return e}();import{Collection as rS,Db as rO}from"mongodb";import{Document as rA,Model as rN}from"mongoose";var rI=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(rO),rT=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(rA),rC=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(rN),rR=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(rS);import{ApolloClient as rD,ApolloError as rb,ApolloLink as rw,ApolloProvider as rx,from as rL,HttpLink as rP,InMemoryCache as rM,split as rj}from"@apollo/client";import{onError as rG}from"@apollo/client/link/error";import{removeTypenameFromVariables as rk}from"@apollo/client/link/remove-typename";import{GraphQLWsLink as rU}from"@apollo/client/link/subscriptions";import{getMainDefinition as rF}from"@apollo/client/utilities";import{createClient as rq}from"graphql-ws";import{useMemo as rK}from"react";import{FaInfo as rY}from"react-icons/fa6";import{use as rH}from"react";import{FaRepeat as rB}from"react-icons/fa6";import{createContext as rV}from"react";var rQ=rV(void 0);import rJ from"./react/apollo-error/apollo-error.module.scss";import{jsx as rW,jsxs as rX}from"react/jsx-runtime";function rz(){var e=rH(rQ),t=e===null||e===void 0?void 0:e.error;if(!t)return null;var r=function(e,t){return(t===null||t===void 0?void 0:t.length)?rX("div",{children:[rX("strong",{children:[e,":"]}),rW("ul",{children:t.map(function(e){return rW("li",{children:e.message},e.message)})})]}):null};return rW("div",{className:rJ["modal-backdrop"],children:rX("div",{className:rJ["modal-content"],children:[rW("button",{type:"button",className:rJ["btn-close"],onClick:e.hideError,children:"✕"}),rX("div",{className:rJ["error-title"],children:[rW("button",{type:"button",className:rJ["btn-retry"],onClick:function(){return window.location.reload()},children:rW(rB,{})})," ",t.message]}),rX("div",{className:rJ["error-details"],children:[t.networkError&&rX("pre",{className:"network",children:[rW("strong",{children:"Network Error:"})," ",t.networkError.message]}),r("GraphQL Errors",T(t.graphQLErrors)),r("Protocol Errors",T(t.protocolErrors)),r("Client Errors",T(t.clientErrors)),t.extraInfo&&rX("pre",{className:"extra",children:[rW("strong",{children:"Extra Info:"})," ",JSON.stringify(t.extraInfo,null,4)]})]})]})})}import{use as r$}from"react";function rZ(){var e=r$(rQ);if(!e)throw new Error("useApolloError must be used within ApolloErrorProvider");return e}import{useEffect as r0,useMemo as r1,useState as r2}from"react";import{jsx as r3}from"react/jsx-runtime";var r4=null;function r5(e){r4===null||r4===void 0?void 0:r4(e)}function r8(e){var t=e.children;var r=I(r2(null),2),n=r[0],s=r[1];r0(function(){r4=s},[]);var i=r1(function(){return{error:n,showError:s,hideError:function(){return s(null)}}},[n]);return r3(rQ,{value:i,children:t})}import{consola as r6}from"consola/browser";var r7={silent:r6.silent,level:r6.level,fatal:r6.fatal,error:r6.error,warn:r6.warn,log:r6.log,info:r6.info,success:r6.success,ready:r6.ready,start:r6.start,box:r6.box,debug:r6.debug,trace:r6.trace,verbose:r6.verbose};import{toast as r9,Toaster as ne}from"react-hot-toast";var nt="/graphql";import{Fragment as nr,jsx as nn,jsxs as ns}from"react/jsx-runtime";var ni=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);var e;e=o(this,t,arguments);e.count=0;return e}u(t,[{key:"request",value:function e(e,t){var r=this;var n=Date.now();return this.count+=1,t(e).map(function(t){var s=Date.now()-n,i=e.operationName||"Unnamed";return r7.info("[Apollo] #".concat(r.count,": ").concat(i," (").concat(s,"ms)")),t})}}]);return t}(rw);function no(e){var t=e||{},r=t.uri,n=t.wsUrl,s=t.customLinks,i=new ni,o=rG(function(e){var t=e.graphQLErrors,r=e.networkError,n=e.protocolErrors,s=e.operation;var i=(s===null||s===void 0?void 0:s.operationName)||"Unknown";if(t&&t.forEach(function(e){var t=e.message,r=e.locations,n=e.path;r7.error("[GraphQL error] ".concat(i,": ").concat(t,", Location: ").concat(JSON.stringify(r),", Path: ").concat(n))}),n&&n.forEach(function(e){var t=e.message,r=e.extensions;r7.error("[Protocol error]: ".concat(t,", Extensions: ").concat(JSON.stringify(r)))}),r&&r7.error("[Network error]: ".concat(r)),t||n||r){var o,a;var c=(t===null||t===void 0?void 0:(o=t[0])===null||o===void 0?void 0:o.message)||(n===null||n===void 0?void 0:(a=n[0])===null||a===void 0?void 0:a.message)||(r===null||r===void 0?void 0:r.message)||"Unexpected error",u=new rb({graphQLErrors:t||[],protocolErrors:n||[],clientErrors:[],networkError:r||null,errorMessage:c,extraInfo:{operation:s}});r9.error(function(e){return ns(nr,{children:[c,"\xa0",nn(rY,{cursor:"pointer",onClick:function(){setTimeout(function(){r5(u)},0),r9.dismiss(e.id)}})]})})}}),a=rk();r||r7.warn('[Apollo] No GraphQL URI provided — using "'.concat(nt,'" as default'));var c=new rP({uri:r!==null&&r!==void 0?r:nt,credentials:"include"}),u=n?new rU(rq({url:n})):rw.empty(),l=p(u,rw)?rj(function(e){var t=e.query;var r=rF(t);return r.kind==="OperationDefinition"&&r.operation==="subscription"},u,c):c;return l===c&&n&&r7.warn("[Apollo] WS URL is set, but subscriptions fallback to HTTP. Check your wsLink config."),[i,o,a].concat(T(s!==null&&s!==void 0?s:[]),[l])}function na(e){var t=e.isNextJS,r=e.options,n=e.children,s=e.client,i=e.provider,o=e.cache;var a=r||{},c=a.uri,u=a.wsUrl,l=a.customLinks,d=S(a,["uri","wsUrl","customLinks"]);if(typeof(s!==null&&s!==void 0?s:rD)!="function")throw new TypeError("Invalid ApolloClient provided. Ensure CustomClient is a class.");var f=i||rx,E=rK(function(){return rL(no({uri:c,wsUrl:u,customLinks:l}))},[c,u,l]),m=rK(function(){return new rD(h({link:E,cache:p(o,rM)?o:new rM},d))},[E,o,d]),g=t?nn(f,{makeClient:function(){return m},children:n}):nn(f,{client:m,children:n});return t?nn(f,{makeClient:function(){return m},children:n}):ns(nr,{children:[ns(r8,{children:[g,nn(rz,{})]}),nn(ne,{position:"top-right"})]})}import{useTranslation as nc}from"react-i18next";var nu=nc;import nl from"i18next";import{initReactI18next as nd}from"react-i18next";function nf(e){return nl.use(nd).init(e)}import np from"classnames";import nE from"./react/loading/loading.module.scss";import{jsx as nm,jsxs as ng}from"react/jsx-runtime";function nv(e){var t=e.full,r=t===void 0?!1:t,n=e.block,s=n===void 0?!1:n,i=e.className,o=i===void 0?"":i,a=e.message,c=a===void 0?"Loading":a,u=S(e,["full","block","className","message"]);function l(){return ng("div",_(h({className:nE.container},u),{children:[nm("div",{className:nE.ring}),nm("div",{className:nE.ring}),nm("div",{className:nE.ring}),nm("div",{className:nE.ring}),c&&nm("div",{className:nE.message,children:c})]}))}return r?nm("div",{className:np(nE.fullscreen,o),children:l()}):s?nm("div",{className:np(nE.block,o),children:l()}):l()}import{createContext as nh}from"react";var ny=nh(void 0);import{use as n_}from"react";function nS(){var e=n_(ny);if(!e)throw new Error("useLoading must be used within a LoadingProvider");return e}import{useCallback as nO,useMemo as nA,useState as nN}from"react";import{jsx as nI}from"react/jsx-runtime";function nT(e){var t=e.children;var r=I(nN(!1),2),n=r[0],s=r[1],i=I(nN(!1),2),o=i[0],a=i[1],c=nO(function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;s(!0),a(e)},[]),u=nO(function(){s(!1),a(!1)},[]),l=nA(function(){return{isLoading:n,isGlobalLoading:o,showLoading:c,hideLoading:u}},[n,o,c,u]);return nI(ny,{value:l,children:n?nI(nv,{full:o}):t})}import{createContext as nC}from"react";var nR=nC(void 0);import{NextIntlClientProvider as nD}from"next-intl";import{useTranslations as nb}from"next-intl";import{use as nw}from"react";function nx(){var e=nw(nR);if(!e)throw new Error("useNextIntl must be used within a NextIntlProvider");return e}var nL=nb;import{jsx as nP}from"react/jsx-runtime";function nM(e){var t=function(t){var r;var n=nx(),s=n.currentLanguage,i=t.messages,o=t.languages,a="en",c=i[(s===null||s===void 0?void 0:s.value)||a],u=(r=o.find(function(e){return e.value===(s===null||s===void 0?void 0:s.value)}))===null||r===void 0?void 0:r.timezone;return i?nP(nD,{locale:(s===null||s===void 0?void 0:s.value)||a,messages:c,timeZone:u,children:nP(e,h({},t))}):(r7.warn("Missing messages for language: ".concat((s===null||s===void 0?void 0:s.value)||a)),null)};return t.displayName="withNextIntl(".concat(e.displayName||e.name||"Component",")"),t}import{useMemo as nj}from"react";import{useCallback as nG,useEffect as nk,useState as nU}from"react";var nF={serialize:function(e){return JSON.stringify(e,function(e,t){return p(t,Date)?{__type:"Date",value:t.toISOString()}:t})},deserialize:function(e){return JSON.parse(e,function(e,t){return(t===null||t===void 0?void 0:t.__type)==="Date"?new Date(t.value):t})}};import nq from"localforage";var nK={get:function e(e){return i(function(){var t;return b(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,nq.getItem(e)];case 1:return[2,r.sent()];case 2:t=r.sent();return[2,(r7.error('[Storage:get] Error getting key "'.concat(e,'":'),t),null)];case 3:return[2]}})})()},set:function e(e,t){return i(function(){var r;return b(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,nq.setItem(e,t)];case 1:n.sent();return[3,3];case 2:r=n.sent();r7.error('[Storage:set] Error setting key "'.concat(e,'":'),r);return[3,3];case 3:return[2]}})})()},remove:function e(e){return i(function(){var t;return b(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,nq.removeItem(e)];case 1:r.sent();return[3,3];case 2:t=r.sent();r7.error('[Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,3];case 3:return[2]}})})()},keys:function e(){return i(function(){var e,t;return b(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,nq.keys()];case 1:return[2,(e=r.sent())!==null&&e!==void 0?e:[]];case 2:t=r.sent();return[2,(r7.error("[Storage:keys] Error getting keys:",t),[])];case 3:return[2]}})})()}};function nY(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:nF;var n=I(nU(t),2),s=n[0],o=n[1],a=I(nU(!1),2),c=a[0],u=a[1];nk(function(){var n=!0;return i(function(){var s,i,a,c;return b(this,function(l){switch(l.label){case 0:l.trys.push([0,6,7,8]);return[4,nK.get(e)];case 1:s=l.sent();if(!n)return[3,5];if(!(s!==null))return[3,2];i=r.deserialize(s);o(i);return[3,5];case 2:if(!(t!==void 0))return[3,4];a=r.serialize(t);return[4,nK.set(e,a)];case 3:l.sent(),o(t);return[3,5];case 4:o(void 0);l.label=5;case 5:return[3,8];case 6:c=l.sent();r7.error('Error loading value for key "'.concat(e,'":'),c),n&&o(t);return[3,8];case 7:n&&u(!0);return[7];case 8:return[2]}})})(),function(){n=!1,u(!1)}},[e,t,r]),nk(function(){if(!c)return;i(function(){var t,n;return b(this,function(i){switch(i.label){case 0:i.trys.push([0,3,,4]);if(!(s!==void 0))return[3,2];t=r.serialize(s);return[4,nK.set(e,t)];case 1:i.sent();i.label=2;case 2:return[3,4];case 3:n=i.sent();r7.error('Error saving value for key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},[s,e,r,c]);var l=nG(function(e){o(function(t){return typeof e=="function"?e(t):e})},[]),d=nG(/*#__PURE__*/i(function(){var t;return b(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,nK.remove(e)];case 1:r.sent(),o(void 0);return[3,3];case 2:t=r.sent();r7.error('Error removing key "'.concat(e,'":'),t);return[3,3];case 3:return[2]}})}),[e]);return{value:s,set:l,remove:d}}import{Fragment as nH,jsx as nB}from"react/jsx-runtime";function nV(e){var t=e.children;return nB(nH,{children:t})}var nQ=nM(nV);function nJ(e){var t=e.children,r=e.languages,n=e.messages;var s;var i=nY("lang",(s=r===null||r===void 0?void 0:r[0])!==null&&s!==void 0?s:{}),o=i.value,a=i.set,c=nj(function(){return{languages:r,currentLanguage:o,setCurrentLanguage:a}},[r,a,o]);return nB(nR,{value:c,children:nB(nQ,{languages:r,messages:n,children:t})})}import nW from"unorm";var nX={a:["\xe0","\xe1","ạ","ả","\xe3","\xe2","ầ","ấ","ậ","ẩ","ẫ","ă","ằ","ắ","ặ","ẳ","ẵ"],e:["\xe8","\xe9","ẹ","ẻ","ẽ","\xea","ề","ế","ệ","ể","ễ"],i:["\xec","\xed","ị","ỉ","ĩ"],o:["\xf2","\xf3","ọ","ỏ","\xf5","\xf4","ồ","ố","ộ","ổ","ỗ","ơ","ờ","ớ","ợ","ở","ỡ"],u:["\xf9","\xfa","ụ","ủ","ũ","ư","ừ","ứ","ự","ử","ữ"],y:["ỳ","\xfd","ỵ","ỷ","ỹ"],d:["đ"]},nz=Object.entries(nX).reduce(function(e,t){var r=I(t,2),n=r[0],s=r[1];return e[n.toUpperCase()]=s.map(function(e){return e.toUpperCase()}),e},{});function n$(e){e=nW.nfkc(e);var t=h({},nX,nz);var r=true,n=false,s=undefined;try{for(var i=Object.entries(t)[Symbol.iterator](),o;!(r=(o=i.next()).done);r=true){var a=I(o.value,2),c=a[0],u=a[1];var l="[".concat(c).concat(u.join(""),"]"),d="(".concat([c].concat(T(u)).join("|"),")");e=e.replace(new RegExp(l,"g"),d)}}catch(e){n=true;s=e}finally{try{if(!r&&i.return!=null){i.return()}}finally{if(n){throw s}}}return e}function nZ(e){return e.normalize("NFD").replace(RegExp("\\p{Diacritic}","gu"),"")}export{rz as ApolloError,rQ as ApolloErrorContext,r8 as ApolloErrorProvider,na as ApolloProvider,eB as BUILD_DIRECTORY,Z as CHECK_PACKAGE_EMPTY_RESULT,tv as COMMAND,tw as COMMAND_DESCRIPTIONS,e9 as COMMIT_LINT_CLI,e7 as COMMIT_LINT_PACKAGE_NAME,e1 as CYBERSKILL_CLI,e2 as CYBERSKILL_CLI_PATH,e0 as CYBERSKILL_DIRECTORY,eK as CYBERSKILL_PACKAGE_NAME,eY as CYBERSKILL_STORAGE,rR as C_Collection,rI as C_Db,rT as C_Document,rC as C_Model,H as DEBUG,e4 as ESLINT_CLI,td as ESLINT_INSPECT_CLI,tl as ESLINT_INSPECT_PACKAGE_NAME,e3 as ESLINT_PACKAGE_NAME,U as E_CommandType,w as E_ConfigType,B as E_IssueType,ti as GIT_CLI,eZ as GIT_COMMIT_EDITMSG,e$ as GIT_HOOK,eW as GIT_IGNORE,nt as GRAPHQL_URI_DEFAULT,tm as HOOK,tb as IS_BROWSER,tt as LINT_STAGED_CLI,te as LINT_STAGED_PACKAGE_NAME,nv as Loading,ny as LoadingContext,nT as LoadingProvider,ry as MongoController,r_ as MongooseController,eH as NODE_MODULES,tp as NODE_MODULES_INSPECT_CLI,tf as NODE_MODULES_INSPECT_PACKAGE_NAME,nR as NextIntlContext,nJ as NextIntlProvider,eV as PACKAGE_JSON,eQ as PACKAGE_LOCK_JSON,tE as PATH,e8 as PLAYWRIGHT_PACKAGE_NAME,to as PNPM_CLI,ta as PNPM_EXEC_CLI,ez as PNPM_LOCK_YAML,W as RESPONSE_STATUS,tc as SIMPLE_GIT_HOOKS_PACKAGE_NAME,tu as SIMPLE_GIT_HOOK_CLI,eX as SIMPLE_GIT_HOOK_JSON,eJ as TSCONFIG_JSON,tn as TSC_CLI,tr as TSC_PACKAGE_NAME,ts as TSX_CLI,ne as Toaster,e6 as VITEST_CLI,e5 as VITEST_PACKAGE_NAME,eq as WORKING_DIRECTORY,ru as aggregatePaginate,ei as appendFileSync,ed as checkPackage,eT as clearAllErrorLists,tS as deepMerge,eb as executeCommand,er as existsSync,eP as formatCommand,rg as generateShortId,rm as generateSlug,eu as getLatestPackageVersion,ec as getPackage,eN as getStoredErrorLists,nf as initI18next,ty as isJson,t_ as isPlainObject,eF as join,r7 as log,$ as logNodeJS,tD as mergeConfigs,rh as mongo,rl as mongoosePaginate,ex as rawCommand,en as readFileSync,n$ as regexSearchMapper,nZ as removeAccent,eU as resolve,eM as resolveCommands,ek as resolveWorkingPath,eo as rmSync,nF as serializer,r5 as showGlobalApolloError,nK as storage,ey as storageNodeJS,X as throwError,r9 as toast,rZ as useApolloError,nS as useLoading,nx as useNextIntl,nY as useStorage,nu as useTranslateI18next,nL as useTranslateNextIntl,rv as validate,M as vitestE2E,th as vitestUnit,nM as withNextIntl,es as writeFileSync};
|
|
1
|
+
function e(e,t){if(t==null||t>e.length)t=e.length;for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function t(e){if(Array.isArray(e))return e}function r(t){if(Array.isArray(t))return e(t)}function n(e){if(e===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return e}function s(e,t,r,n,s,i,o){try{var a=e[i](o);var c=a.value}catch(e){r(e);return}if(a.done){t(c)}else{Promise.resolve(c).then(n,s)}}function i(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(e){s(o,n,i,a,c,"next",e)}function c(e){s(o,n,i,a,c,"throw",e)}a(undefined)})}}function o(e,t,r){t=d(t);return A(e,D()?Reflect.construct(t,r||[],d(e).constructor):t.apply(e,r))}function a(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function c(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false;n.configurable=true;if("value"in n)n.writable=true;Object.defineProperty(e,n.key,n)}}function u(e,t,r){if(t)c(e.prototype,t);if(r)c(e,r);return e}function l(e,t,r){if(t in e){Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true})}else{e[t]=r}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)N(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 E(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function m(e,t){var r=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(r==null)return;var n=[];var s=true;var i=false;var o,a;try{for(r=r.call(e);!(s=(o=r.next()).done);s=true){n.push(o.value);if(t&&n.length===t)break}}catch(e){i=true;a=e}finally{try{if(!s&&r["return"]!=null)r["return"]()}finally{if(i)throw a}}return n}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 v(){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 h(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};var n=Object.keys(r);if(typeof Object.getOwnPropertySymbols==="function"){n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))}n.forEach(function(t){l(e,t,r[t])})}return e}function y(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);if(t){n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})}r.push.apply(r,n)}return r}function _(e,t){t=t!=null?t:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(t))}else{y(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function S(e,t){if(e==null)return{};var r=O(e,t);var n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++){n=i[s];if(t.indexOf(n)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(e,n))continue;r[n]=e[n]}}return r}function O(e,t){if(e==null)return{};var r={};var n=Object.keys(e);var s,i;for(i=0;i<n.length;i++){s=n[i];if(t.indexOf(s)>=0)continue;r[s]=e[s]}return r}function A(e,t){if(t&&(C(t)==="object"||typeof t==="function")){return t}return n(e)}function N(e,t){N=Object.setPrototypeOf||function e(e,t){e.__proto__=t;return e};return N(e,t)}function I(e,r){return t(e)||m(e,r)||R(e,r)||g()}function T(e){return r(e)||E(e)||R(e)||v()}function C(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function R(t,r){if(!t)return;if(typeof t==="string")return e(t,r);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor)n=t.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(t,r)}function D(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(D=function(){return!!e})()}function b(e,t){var r,n,s,i,o={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]};return i={next:a(0),"throw":a(1),"return":a(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function a(e){return function(t){return c([e,t])}}function c(i){if(r)throw new TypeError("Generator is already executing.");while(o)try{if(r=1,n&&(s=i[0]&2?n["return"]:i[0]?n["throw"]||((s=n["return"])&&s.call(n),0):n.next)&&!(s=s.call(n,i[1])).done)return s;if(n=0,s)i=[i[0]&2,s.value];switch(i[0]){case 0:case 1:s=i;break;case 4:o.label++;return{value:i[1],done:false};case 5:o.label++;n=i[1];i=[0];continue;case 7:i=o.ops.pop();o.trys.pop();continue;default:if(!(s=o.trys,s=s.length>0&&s[s.length-1])&&(i[0]===6||i[0]===2)){o=0;continue}if(i[0]===3&&(!s||i[1]>s[0]&&i[1]<s[3])){o.label=i[1];break}if(i[0]===6&&o.label<s[1]){o.label=s[1];s=i;break}if(s&&o.label<s[2]){o.label=s[2];o.ops.push(i);break}if(s[2])o.ops.pop();o.trys.pop();continue}i=t.call(e,o)}catch(e){i=[6,e];n=0}finally{r=s=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}}var w=function(e){return e.ESLINT="eslint",e.COMMITLINT="commitlint",e.LINT_STAGED="lint-staged",e.VITEST_REACT_E2E="vitest-react-e2e",e.VITEST_REACT_UNIT="vitest-react-unit",e}(w||{});import x from"@antfu/eslint-config";import L from"@vitejs/plugin-react-swc";import{defineConfig as P}from"vitest/config";function M(e){return P(h({plugins:[L()],test:{include:["**/*.test.e2e.?(c|m)[jt]s?(x)"],browser:{enabled:!0,provider:"playwright",instances:[{browser:"chromium"},{browser:"firefox"},{browser:"webkit"}]}}},e))}import j from"@vitejs/plugin-react-swc";import{defineConfig as G}from"vitest/config";import k from"node:process";var U=function(e){return e.PNPM_ADD_AND_EXEC="PNPM_ADD_AND_EXEC",e.PNPM_ADD_DEV_AND_EXEC="PNPM_ADD_DEV_AND_EXEC",e.RAW="RAW",e}(U||{});import{exec as F}from"node:child_process";import q from"node:process";import*as K from"node:util";import Y from"node:process";var H=Y.env.DEBUG==="true";var B=function(e){return e.Error="error",e.Warning="warning",e}(B||{});import V from"chalk";import Q from"consola";import{GraphQLError as J}from"graphql";var W={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"}};function X(e){var t=e.message,r=e.status,n=r===void 0?W.INTERNAL_SERVER_ERROR:r,s=e.type,i=s===void 0?"graphql":s;var o;var a=(o=t!==null&&t!==void 0?t:n.MESSAGE)!==null&&o!==void 0?o:"Internal server error";throw i==="graphql"?new J(a,{extensions:{code:n.CODE}}):new Error(a)}H||(Q.level=4);function z(e){var t=V[e];return typeof t=="function"?t:V.green}var $={silent:Q.silent,level:Q.level,fatal:Q.fatal,error:Q.error,warn:Q.warn,log:Q.log,info:Q.info,success:Q.success,ready:Q.ready,start:Q.start,box:Q.box,debug:Q.debug,trace:Q.trace,verbose:Q.verbose,printBoxedLog:function e(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(t===null||t===void 0?void 0:t.length)){Q.box(V.green(e));return}t.forEach(function(e){var t=e.file,n=e.position,s=e.rule,i=e.message;Q.log("".concat(V.gray("File:")," ").concat(V.blue("".concat(t).concat(n?":".concat(n):"")))),s&&Q.log(" ".concat(z(r)("Rule:")," ").concat(s)),Q.log(" ".concat(z(r)("Message:")," ").concat(i))}),Q.box(z(r)("".concat(e," : ").concat(t.length))),Q.log(V.gray("─".repeat(40)))}};var Z={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};import ee from"node-fetch";import*as et from"node:fs";function er(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}return t.every(function(e){return et.existsSync(e)})}function en(e,t){var r=et.readFileSync(e,"utf-8");if(t===null||t===void 0?void 0:t.asJson)try{var n=JSON.parse(r);if((typeof n==="undefined"?"undefined":C(n))=="object"&&n!==null)return n;throw new Error("Parsed JSON is not an object or array")}catch(t){throw new Error("Failed to parse JSON from file: ".concat(e))}return r}function es(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var n=r.isJson,s=n===void 0?!1:n,i=s&&(typeof t==="undefined"?"undefined":C(t))=="object"?JSON.stringify(t,null,4):String(t);et.writeFileSync(e,i,"utf-8")}function ei(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var n=r.isJson,s=n===void 0?!1:n,i=s&&(typeof t==="undefined"?"undefined":C(t))=="object"?JSON.stringify(t,null,4):String(t);et.appendFileSync(e,i,"utf-8")}function eo(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}t.forEach(function(e){er(e)&&et.rmSync(e,{recursive:!0,force:!0})})}var ea={};function ec(e){if(e in ea)return ea[e];var t=eF(eq,eV);if(!er(t))return ea[e]=!1;try{var r,n;var s=en(t,{asJson:!0}),i=s.name===e,o=!!((r=s.dependencies)===null||r===void 0?void 0:r[e]),a=!!((n=s.devDependencies)===null||n===void 0?void 0:n[e]);return i||o||a?ea[e]={path:t,file:s,isCurrentProject:i,isDepend:o,isDevDepend:a}:ea[e]=!1}catch(t){return $.warn("Failed to read package.json: ".concat(t.message)),ea[e]=!1}}function eu(e){return el.apply(this,arguments)}function el(){el=i(function(e){var t,r,n,s;return b(this,function(i){switch(i.label){case 0:i.trys.push([0,3,,4]);return[4,ee("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:r=i.sent(),n=r.version;return[2,n];case 3:s=i.sent();throw $.error('Failed to fetch version for "'.concat(e,'": ').concat(s.message)),s;case 4:return[2]}})});return el.apply(this,arguments)}function ed(e,t){return ef.apply(this,arguments)}function ef(){ef=i(function(e,t){var r,n,s,i,o,a,c,u,d,f,p,E,m,g,v;return b(this,function(y){switch(y.label){case 0:y.trys.push([0,4,,5]);o=ec(e);if(!o)return[2,h({},Z)];a=o.path,c=o.file,u=o.isCurrentProject,d=o.isDepend,f=o.isDevDepend,p="0.0.0";u&&c.version?p=c.version:d&&((r=c.dependencies)===null||r===void 0?void 0:r[e])?p=(n=c.dependencies)===null||n===void 0?void 0:n[e]:f&&((s=c.devDependencies)===null||s===void 0?void 0:s[e])&&(p=(i=c.devDependencies)===null||i===void 0?void 0:i[e]);if(!u)return[3,1];g=p;return[3,3];case 1:return[4,eu(e)];case 2:g=y.sent();y.label=3;case 3:E=g,m=u||p===E;return[2,(!m&&(t===null||t===void 0?void 0:t.update)&&(d?c.dependencies=_(h({},c.dependencies||{}),l({},e,E)):f&&(c.devDependencies=_(h({},c.devDependencies||{}),l({},e,E))),$.info('Updating package "'.concat(e,'" to version ').concat(E)),es(a,c,{isJson:!0})),{isCurrentProject:u,installedPath:a,file:c,isUpToDate:m})];case 4:v=y.sent();return[2,($.error('Error checking package "'.concat(e,'": ').concat(v.message)),h({},Z))];case 5:return[2]}})});return ef.apply(this,arguments)}import ep from"node-persist";import eE from"node:os";import em from"node:process";function eg(){return em.env.CYBERSKILL_STORAGE_DIR||eF(eE.homedir(),eY)}function ev(){return eh.apply(this,arguments)}function eh(){eh=i(function(){var e;return b(this,function(t){switch(t.label){case 0:e=ep.defaultInstance;if(e)return[3,2];return[4,ep.init({dir:eg(),stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,forgiveParseErrors:!0})];case 1:e=t.sent();t.label=2;case 2:e;return[2]}})});return eh.apply(this,arguments)}var ey={get:function e(e){return i(function(){var t,r;return b(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,ev()];case 1:n.sent();return[4,ep.getItem(e)];case 2:return[2,(t=n.sent())!==null&&t!==void 0?t:null];case 3:r=n.sent();return[2,($.error('[Storage:get] Error getting key "'.concat(e,'":'),r),null)];case 4:return[2]}})})()},set:function e(e,t){return i(function(){var r;return b(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,ev()];case 1:n.sent();return[4,ep.setItem(e,t)];case 2:n.sent();return[3,4];case 3:r=n.sent();$.error('[Storage:set] Error setting key "'.concat(e,'":'),r);return[3,4];case 4:return[2]}})})()},remove:function e(e){return i(function(){var t;return b(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,ev()];case 1:r.sent();return[4,ep.removeItem(e)];case 2:r.sent();return[3,4];case 3:t=r.sent();$.error('[Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},keys:function e(){return i(function(){var e,t;return b(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,ev()];case 1:r.sent();return[4,ep.keys()];case 2:e=r.sent();return[2,Array.isArray(e)?e:($.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=r.sent();return[2,($.error("[Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return i(function(){return b(this,function(t){try{return[2,"".concat(eg()," (key: ").concat(e,")")]}catch(e){return[2,($.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var e_=K.promisify(F);function eS(e){return"error_list:".concat(e)}function eO(e){return eA.apply(this,arguments)}function eA(){eA=i(function(e){var t,r,n;return b(this,function(s){switch(s.label){case 0:if(e.length===0)return[2];t=Date.now(),r=eS(t);s.label=1;case 1:s.trys.push([1,3,,4]);return[4,ey.set(r,{errors:e,timestamp:t})];case 2:s.sent(),setTimeout(/*#__PURE__*/i(function(){var e;return b(this,function(t){switch(t.label){case 0:return[4,ey.getLogLink(r)];case 1:e=t.sent();e&&$.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})}),10);return[3,4];case 3:n=s.sent();$.error("Failed to save errors: ".concat(n.message));return[3,4];case 4:return[2]}})});return eA.apply(this,arguments)}function eN(){return eI.apply(this,arguments)}function eI(){eI=i(function(){var e,t,r;return b(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,ey.keys()];case 1:e=n.sent(),t=Array.isArray(e)?e.filter(function(e){var t;return e===null||e===void 0?void 0:(t=e.startsWith)===null||t===void 0?void 0:t.call(e,"error_list:")}):[];return[4,Promise.all(t.map(/*#__PURE__*/function(){var e=i(function(e){var t;return b(this,function(r){switch(r.label){case 0:return[4,ey.get(e)];case 1:return[2,((t=r.sent())===null||t===void 0?void 0:t.errors)||[]]}})});return function(t){return e.apply(this,arguments)}}()))];case 2:return[2,n.sent().flat()];case 3:r=n.sent();return[2,($.error("Failed to retrieve stored errors: ".concat(r.message)),[])];case 4:return[2]}})});return eI.apply(this,arguments)}function eT(){return eC.apply(this,arguments)}function eC(){eC=i(function(){var e,t,r;return b(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,ey.keys()];case 1:e=n.sent(),t=Array.isArray(e)?e.filter(function(e){var t;return e===null||e===void 0?void 0:(t=e.startsWith)===null||t===void 0?void 0:t.call(e,"error_list:")}):[];return[4,Promise.all(t.map(function(e){return ey.remove(e)}))];case 2:n.sent();return[3,4];case 3:r=n.sent();$.error("Failed to clear error lists: ".concat(r.message));return[3,4];case 4:return[2]}})});return eC.apply(this,arguments)}function eR(e){var t=[],r=[],n="",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("/"))n=e.trim();else{var a=s.exec(e)||[],c=i.exec(e)||[],u=o.exec(e)||[];a.length&&n?t.push({file:n,position:"".concat(a[1],":").concat(a[2]),type:a[3]==="error"?"error":"warning",message:a[4].trim(),rule:a[5].trim()}):c.length?t.push({file:c[1],position:"".concat(c[2],":").concat(c[3]),type:c[4]==="error"?"error":"warning",message:c[5].trim()}):u.length?t.push({file:"commitlint",type:"error",message:u[1].trim(),rule:u[2].trim()}):r.push(e.trim())}}),t.length&&eO(t),H&&r.length&&($.warn("Unmatched lines:"),r.forEach(function(e){return $.info(" ".concat(e))}))}function eD(e){try{var t=JSON.parse(e),r=[];t.forEach(function(e){var t=e.filePath,n=e.messages;n.forEach(function(e){var n=e.severity,s=e.line,i=e.column,o=e.ruleId,a=e.message;r.push({type:n===2?"error":"warning",file:t,position:"".concat(s,":").concat(i),rule:o,message:a})})}),r.length&&eO(r)}catch(t){eR(e)}}function eb(e){return ew.apply(this,arguments)}function ew(){ew=i(function(e){var t,r,n,s,i,o,a,c,u;var l=arguments;return b(this,function(d){switch(d.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:eD;r=new AbortController;q.on("SIGINT",function(){$.warn("Process interrupted. Terminating..."),r.abort(),q.exit()});d.label=1;case 1:d.trys.push([1,3,,4]);return[4,e_(e,{maxBuffer:0x6400000,signal:r.signal})];case 2:n=d.sent(),s=n.stdout,i=n.stderr;[s,i].forEach(function(e){return e&&t(e)});return[3,4];case 3:o=d.sent();a=o.stdout,c=o.stderr,u=o.message;[a,c].forEach(function(e){return e&&t(e)}),!c&&!a&&$.error("Command failed: ".concat(u));return[3,4];case 4:return[2]}})});return ew.apply(this,arguments)}function ex(e){return{raw:!0,cmd:e}}function eL(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(ta," ").concat(eK," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(ta," ").concat(ts," ").concat(e2," ").concat(e):"".concat(ta," ").concat(e1," ").concat(e)}function eP(e,t){return typeof e=="function"?eL(e(t),t):(typeof e==="undefined"?"undefined":C(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?eL(e,t):e}function eM(e){return ej.apply(this,arguments)}function ej(){ej=i(function(e){var t,r,n,s,i,o,a;var c=arguments;return b(this,function(u){switch(u.label){case 0:t=c.length>1&&c[1]!==void 0?c[1]:{};n=(r=t===null||t===void 0?void 0:t.isRemote)!==null&&r!==void 0?r:!1;if(!n)return[3,1];a=!1;return[3,3];case 1:return[4,ed(eK)];case 2:a=u.sent().isCurrentProject;u.label=3;case 3:s=a,i={isRemote:n,isCurrentProject:s},o=typeof e=="function"?e(i):e;return[2,Object.fromEntries(Object.entries(o).map(function(e){var t=I(e,2),r=t[0],n=t[1];return[r,eP(n,i)]}))]}})});return ej.apply(this,arguments)}import*as eG from"node:path";function ek(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}var n;return(n=eG).resolve.apply(n,[eq].concat(T(t)))}function eU(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}var n;return(n=eG).resolve.apply(n,T(t))}function eF(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}var n;return(n=eG).join.apply(n,T(t))}var eq=k.env.INIT_CWD||k.cwd(),eK="@cyberskill/shared",eY=".cyberskill-storage",eH="node_modules",eB="dist",eV="package.json",eQ="package-lock.json",eJ="tsconfig.json",eW=".gitignore",eX=".simple-git-hooks.json",ez="pnpm-lock.yaml",e$=".git/hooks/",eZ=".git/COMMIT_EDITMSG",e0=eF(eq,eH,eK,eB),e1="cyberskill",e2="src/nodejs/cli/index.ts",e3="eslint",e4="eslint",e5="vitest",e8="playwright",e6="vitest",e7="@commitlint/cli",e9="commitlint",te="lint-staged",tt="lint-staged",tr="typescript",tn="tsc",ts="tsx",ti="git",to="pnpm",ta="pnpm exec",tc="simple-git-hooks",tu="simple-git-hooks",tl="@eslint/config-inspector",td="eslint-config-inspector",tf="node-modules-inspector",tp="node-modules-inspector",tE={CYBERSKILL_DIRECTORY:e0,WORKING_DIRECTORY:eq,TS_CONFIG:ek(eJ),GIT_IGNORE:ek(eW),GIT_HOOK:ek(e$),GIT_COMMIT_MSG:ek(eZ),SIMPLE_GIT_HOOKS_JSON:ek(eX),PACKAGE_JSON:ek(eV),PACKAGE_LOCK_JSON:ek(eQ),PNPM_LOCK_YAML:ek(ez),NODE_MODULES:ek(eH),CYBERSKILL:{LINT_STAGED_CONFIG:ek("".concat(e0,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:ek("".concat(e0,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:ek("".concat(e0,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:ek("".concat(e0,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:ek("".concat(e0,"/react/vitest/vitest.e2e.js"))}};function tm(e){var t=e.isCurrentProject;return h({"pre-commit":tt,"commit-msg":e9},t&&{"pre-push":ex("".concat(ti," pull"))})}function tg(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++){r[n-1]=arguments[n]}var s=I(r,2),i=s[0],o=s[1],a=e==="RAW"?!0:er.apply(void 0,T(i.split(" ").map(function(e){return eF(tE.NODE_MODULES,e)})));switch(e){case"PNPM_ADD_AND_EXEC":return eP(ex("".concat(a?"":"".concat(to," add ").concat(i," && ")).concat(ta," ").concat(o)));case"PNPM_ADD_DEV_AND_EXEC":return eP(ex("".concat(a?"":"".concat(to," add -D ").concat(i," && ")).concat(ta," ").concat(o)));case"RAW":return eP(ex(i))}}var tv={SIMPLE_GIT_HOOKS:tg("PNPM_ADD_DEV_AND_EXEC",tc,tu),ESLINT_INSPECT:tg("PNPM_ADD_DEV_AND_EXEC",tl,td),NODE_MODULES_INSPECT:tg("PNPM_ADD_DEV_AND_EXEC",tf,tp),ESLINT_CHECK:tg("PNPM_ADD_DEV_AND_EXEC",e3,"".concat(e4," ").concat(tE.WORKING_DIRECTORY)),ESLINT_FIX:tg("PNPM_ADD_DEV_AND_EXEC",e3,"".concat(e4," ").concat(tE.WORKING_DIRECTORY," --fix")),TYPESCRIPT_CHECK:tg("PNPM_ADD_AND_EXEC",tr,"".concat(tn," -p ").concat(tE.TS_CONFIG," --noEmit")),CONFIGURE_GIT_HOOK:tg("RAW","".concat(ti," config core.hooksPath ").concat(tE.GIT_HOOK)),BUILD:tg("RAW","".concat(to," run build")),STAGE_BUILD_DIRECTORY:tg("RAW","".concat(ti," add ").concat(eB)),PNPM_INSTALL_STANDARD:tg("RAW","".concat(to," install")),PNPM_INSTALL_LEGACY:tg("RAW","".concat(to," install --legacy-peer-deps")),PNPM_INSTALL_FORCE:tg("RAW","".concat(to," install --force")),CYBERSKILL:{TEST_UNIT:tg("PNPM_ADD_AND_EXEC",e5,"".concat(e6," --config ").concat(tE.CYBERSKILL.UNIT_TEST_CONFIG)),TEST_E2E:tg("PNPM_ADD_AND_EXEC","".concat(e5," ").concat(e8),"".concat(e6," --config ").concat(tE.CYBERSKILL.E2E_TEST_CONFIG)),COMMIT_LINT:tg("PNPM_ADD_DEV_AND_EXEC",e7,"".concat(e9," --edit ").concat(tE.GIT_COMMIT_MSG," --config ").concat(tE.CYBERSKILL.COMMITLINT_CONFIG)),LINT_STAGED:tg("PNPM_ADD_DEV_AND_EXEC",te,"".concat(tt," --config ").concat(tE.CYBERSKILL.LINT_STAGED_CONFIG))}};function th(e){return G(h({plugins:[j()],test:{globals:!0,environment:"jsdom",pool:"vmThreads",include:["**/*.test.unit.?(c|m)[jt]s?(x)"],setupFiles:[tE.CYBERSKILL.UNIT_TEST_SETUP_CONFIG]}},e))}function ty(e){try{return JSON.parse(e),!0}catch(e){return!1}}function t_(e){return!!e&&(typeof e==="undefined"?"undefined":C(e))=="object"&&!Array.isArray(e)}function tS(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}return t.flat().reduce(function(e,t){var r=true,n=false,s=undefined;try{for(var i=Object.entries(t)[Symbol.iterator](),o;!(r=(o=i.next()).done);r=true){var a=I(o.value,2),c=a[0],u=a[1];var l=e[c];Array.isArray(u)?e[c]=Array.from(new Set(T(Array.isArray(l)?l:[]).concat(T(u)))):t_(u)?e[c]=tS(t_(l)?l:{},u):e[c]=u}}catch(e){n=true;s=e}finally{try{if(!r&&i.return!=null){i.return()}}finally{if(n){throw s}}}return e},{})}import*as tO from"globals";var tA=[{languageOptions:{globals:h({},tO.node,tO.browser)},rules:{"perfectionist/sort-imports":["error",{internalPattern:["^#.*","^@/.*"]}]},ignores:["build","dist"]}];var tN=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}return tS.apply(void 0,T(t))},tI=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}var n=tS.apply(void 0,[tA].concat(T(t))),s=n.ignores,i=S(n,["ignores"]),o=Array.isArray(s)&&s.every(function(e){return typeof e=="string"})?{ignores:s}:void 0,a=[i].concat(T(o?[o]:[]));return x.apply(void 0,[{stylistic:{semi:!0,indent:4,quotes:"single"},formatters:{css:!0,html:!0,markdown:"prettier"},yaml:!1,react:!0}].concat(T(a)))},tT=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}return M.apply(void 0,T(t))},tC=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}return th.apply(void 0,T(t))},tR={eslint:tI,commitlint:tN,"lint-staged":tN,"vitest-react-e2e":tT,"vitest-react-unit":tC};function tD(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++){r[n-1]=arguments[n]}var s=tR[e];if(!s)throw new Error("Unknown config type: ".concat(e));return s.apply(void 0,T(r))}var tb=(typeof window==="undefined"?"undefined":C(window))<"u";var tw={lint:"Check code for linting issues","lint:fix":"Fix linting issues automatically","lint:inspect":"View active ESLint configuration","lint-staged":"Run lint checks on staged files",commitlint:"Validate commit message format",setup:"Initialize project setup and dependencies",reset:"Reset the project and reinstall dependencies",inspect:"Analyze installed project dependencies","test:unit":"Run unit test suite","test:e2e":"Run end-to-end test suite"};import tx from"node:process";import{hideBin as tL}from"yargs/helpers";import tP from"yargs/yargs";var tM={name:"@cyberskill/shared",type:"module",version:"1.68.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"},"./configs":{types:"./dist/configs/index.d.ts",import:"./dist/configs/index.js",require:"./dist/configs/index.cjs"},"./configs/commitlint":{types:"./dist/configs/commitlint/index.d.ts",import:"./dist/configs/commitlint/index.js",require:"./dist/configs/commitlint/index.cjs"},"./configs/eslint":{types:"./dist/configs/eslint/index.d.ts",import:"./dist/configs/eslint/index.js",require:"./dist/configs/eslint/index.cjs"},"./configs/graphql":{types:"./dist/configs/graphql/index.d.ts",import:"./dist/configs/graphql/index.js",require:"./dist/configs/graphql/index.cjs"},"./configs/lint-staged":{types:"./dist/configs/lint-staged/index.d.ts",import:"./dist/configs/lint-staged/index.js",require:"./dist/configs/lint-staged/index.cjs"},"./configs/vitest/react/e2e":{types:"./dist/configs/vitest/react/e2e.d.ts",import:"./dist/configs/vitest/react/e2e.js",require:"./dist/configs/vitest/react/e2e.cjs"},"./configs/vitest/react/unit":{types:"./dist/configs/vitest/react/unit.d.ts",import:"./dist/configs/vitest/react/unit.js",require:"./dist/configs/vitest/react/unit.cjs"},"./constants":{types:"./dist/constants/index.d.ts",import:"./dist/constants/index.js",require:"./dist/constants/index.cjs"},"./nodejs":{types:"./dist/nodejs/index.d.ts",import:"./dist/nodejs/index.js",require:"./dist/nodejs/index.cjs"},"./nodejs/cli":{types:"./dist/nodejs/cli/index.d.ts",import:"./dist/nodejs/cli/index.js",require:"./dist/nodejs/cli/index.cjs"},"./nodejs/command":{types:"./dist/nodejs/command/index.d.ts",import:"./dist/nodejs/command/index.js",require:"./dist/nodejs/command/index.cjs"},"./nodejs/fs":{types:"./dist/nodejs/fs/index.d.ts",import:"./dist/nodejs/fs/index.js",require:"./dist/nodejs/fs/index.cjs"},"./nodejs/log":{types:"./dist/nodejs/log/index.d.ts",import:"./dist/nodejs/log/index.js",require:"./dist/nodejs/log/index.cjs"},"./nodejs/mongo":{types:"./dist/nodejs/mongo/index.d.ts",import:"./dist/nodejs/mongo/index.js",require:"./dist/nodejs/mongo/index.cjs"},"./nodejs/package":{types:"./dist/nodejs/package/index.d.ts",import:"./dist/nodejs/package/index.js",require:"./dist/nodejs/package/index.cjs"},"./nodejs/path":{types:"./dist/nodejs/path/index.d.ts",import:"./dist/nodejs/path/index.js",require:"./dist/nodejs/path/index.cjs"},"./nodejs/storage":{types:"./dist/nodejs/storage/index.d.ts",import:"./dist/nodejs/storage/index.js",require:"./dist/nodejs/storage/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/vitest":{types:"./dist/react/vitest/index.d.ts",import:"./dist/react/vitest/index.js",require:"./dist/react/vitest/index.cjs"},"./styles/reset.css":{import:"./dist/styles/reset.css",require:"./dist/styles/reset.css"},"./typescript":{types:"./dist/typescript/index.d.ts",import:"./dist/typescript/index.js",require:"./dist/typescript/index.cjs"},"./utils":{types:"./dist/utils/index.d.ts",import:"./dist/utils/index.js",require:"./dist/utils/index.cjs"}},main:"./dist/index.cjs",module:"./dist/index.js",types:"./dist/index.d.ts",bin:{cyberskill:"./dist/nodejs/cli/index.js"},files:["dist","public"],scripts:{build:"tsup",dev:"dotenv -e .env -- tsup --watch",lint:"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint","lint:fix":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint:fix","lint:inspect":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint:inspect",reset:"dotenv -e .env -- tsx src/nodejs/cli/index.ts reset",setup:"dotenv -e .env -- tsx src/nodejs/cli/index.ts setup",inspect:"dotenv -e .env -- tsx src/nodejs/cli/index.ts inspect","test:unit":"dotenv -e .env -- tsx src/nodejs/cli/index.ts test:unit","test:e2e":"dotenv -e .env -- tsx src/nodejs/cli/index.ts test:e2e",commitlint:"dotenv -e .env -- tsx src/nodejs/cli/index.ts commitlint","lint-staged":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint-staged"},dependencies:{"@antfu/eslint-config":"4.11.0","@apollo/client":"3.13.6","@eslint-react/eslint-plugin":"1.41.0","@graphql-codegen/cli":"5.0.5","@graphql-codegen/client-preset":"4.8.0","@graphql-codegen/typescript-react-apollo":"4.3.2","@microsoft/api-extractor":"7.52.3","@next/eslint-plugin-next":"15.2.4","@swc/core":"1.11.18","@testing-library/jest-dom":"6.6.3","@testing-library/react":"16.3.0","@vitejs/plugin-react-swc":"3.8.1","@vitest/browser":"3.1.1",chalk:"5.4.1",classnames:"2.5.1",consola:"3.4.2","crypto-js":"4.2.0","date-fns":"4.1.0","dotenv-cli":"8.0.0","eslint-config-next":"15.2.4","eslint-plugin-format":"1.0.1","eslint-plugin-react-hooks":"5.2.0","eslint-plugin-react-refresh":"0.4.19",globals:"16.0.0",graphql:"16.10.0","graphql-ws":"6.0.4",i18next:"24.2.3",jsdom:"26.0.0",localforage:"1.10.0","modern-normalize":"3.0.1",mongodb:"6.15.0",mongoose:"8.13.2","mongoose-aggregate-paginate-v2":"1.1.4","mongoose-paginate-v2":"1.9.0","next-intl":"4.0.2","node-fetch":"3.3.2","node-persist":"4.0.4",ora:"8.2.0",playwright:"1.51.1","postcss-modules":"6.0.1",qs:"6.14.0",react:"19.1.0","react-dom":"19.1.0","react-hot-toast":"2.5.2","react-i18next":"15.4.1","react-icons":"5.5.0",sass:"1.86.3",slugify:"1.6.6",tsup:"8.4.0",tsx:"4.19.3",typescript:"5.8.3",unorm:"1.6.0",uuid:"11.1.0",vite:"6.2.5",vitest:"3.1.1","vitest-browser-react":"0.1.1",yargs:"17.7.2"},publishConfig:{access:"public",registry:"https://registry.npmjs.org/"},devDependencies:{"@commitlint/cli":"19.8.0","@eslint/config-inspector":"1.0.2","@types/crypto-js":"4.2.2","@types/mongoose-aggregate-paginate-v2":"1.0.12","@types/node-persist":"3.1.8","@types/react":"19.1.0","@types/react-dom":"19.1.1","@types/unorm":"1.3.31","@types/uuid":"10.0.0","@types/yargs":"17.0.33",eslint:"9.24.0","lint-staged":"15.5.0","node-modules-inspector":"0.6.3","simple-git-hooks":"2.12.1"}};function tj(e,t){return tG.apply(this,arguments)}function tG(){tG=i(function(e,t){var r;return b(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);$.start("".concat(e)),H&&$.info("→ ".concat(t));return[4,eb(t)];case 1:n.sent(),$.success("".concat(e," done."));return[3,3];case 2:r=n.sent();throw $.error("".concat(e," failed: ").concat(r.message)),r;case 3:return[2]}})});return tG.apply(this,arguments)}function tk(){return tU.apply(this,arguments)}function tU(){tU=i(function(){var e;return b(this,function(t){switch(t.label){case 0:if(!er(tE.TS_CONFIG))return[3,2];return[4,tj("Performing TypeScript validation",tv.TYPESCRIPT_CHECK)];case 1:e=t.sent();return[3,3];case 2:e=$.warn("No TypeScript configuration found. Skipping type check.");t.label=3;case 3:e;return[2]}})});return tU.apply(this,arguments)}function tF(){return tq.apply(this,arguments)}function tq(){tq=i(function(){var e,t;var r=arguments;return b(this,function(n){switch(n.label){case 0:e=r.length>0&&r[0]!==void 0?r[0]:!1;if(!e)return[3,2];return[4,tj("Running ESLint with auto-fix",tv.ESLINT_FIX)];case 1:t=n.sent();return[3,4];case 2:return[4,tj("Running ESLint check",tv.ESLINT_CHECK)];case 3:t=n.sent();n.label=4;case 4:t;return[2]}})});return tq.apply(this,arguments)}function tK(e,t){if(!t.length)return;var r=e==="Errors"?"red":"yellow";$.printBoxedLog(e==="Errors"?"✖ Errors":"⚠ Warnings",t,r)}function tY(){return tH.apply(this,arguments)}function tH(){tH=i(function(){var e,t,r;return b(this,function(n){switch(n.label){case 0:return[4,eN()];case 1:e=n.sent(),t=e.filter(function(e){return e.type==="error"}),r=e.filter(function(e){return e.type==="warning"});!t.length&&!r.length?$.printBoxedLog("✔ NO ISSUES FOUND",[],"green"):(tK("Warnings",r),tK("Errors",t));return[2]}})});return tH.apply(this,arguments)}function tB(){return tV.apply(this,arguments)}function tV(){tV=i(function(){var e,t,r;return b(this,function(n){switch(n.label){case 0:return[4,eT()];case 1:n.sent();return[4,ed(eK)];case 2:e=n.sent(),t=e.isCurrentProject;if(!t)return[3,7];n.label=3;case 3:n.trys.push([3,6,,7]);return[4,tj("Building package: ".concat(eK),tv.BUILD)];case 4:n.sent();return[4,tj("Staging build artifacts",tv.STAGE_BUILD_DIRECTORY)];case 5:n.sent();return[3,7];case 6:r=n.sent();throw $.error("Error building and staging ".concat(eK,": ").concat(r.message)),r;case 7:return[4,tj("Executing lint-staged",tv.CYBERSKILL.LINT_STAGED)];case 8:n.sent(),tY();return[2]}})});return tV.apply(this,arguments)}function tQ(){return tJ.apply(this,arguments)}function tJ(){tJ=i(function(){return b(this,function(e){switch(e.label){case 0:return[4,tj("Inspecting ESLint configuration",tv.ESLINT_INSPECT)];case 1:e.sent();return[2]}})});return tJ.apply(this,arguments)}function tW(){return tX.apply(this,arguments)}function tX(){tX=i(function(){return b(this,function(e){switch(e.label){case 0:return[4,eT()];case 1:e.sent();return[4,Promise.all([tk(),tF()])];case 2:e.sent(),tY();return[2]}})});return tX.apply(this,arguments)}function tz(){return t$.apply(this,arguments)}function t$(){t$=i(function(){return b(this,function(e){switch(e.label){case 0:return[4,eT()];case 1:e.sent();return[4,Promise.all([tk(),tF(!0)])];case 2:e.sent(),tY();return[2]}})});return t$.apply(this,arguments)}function tZ(){return t0.apply(this,arguments)}function t0(){t0=i(function(){return b(this,function(e){switch(e.label){case 0:return[4,eT()];case 1:e.sent();return[4,tj("Validating commit message",tv.CYBERSKILL.COMMIT_LINT)];case 2:e.sent(),tY();return[2]}})});return t0.apply(this,arguments)}function t1(){return t2.apply(this,arguments)}function t2(){t2=i(function(){var e,t;return b(this,function(r){switch(r.label){case 0:return[4,tj("Configuring Git hooks",tv.CONFIGURE_GIT_HOOK)];case 1:r.sent(),eo(tE.GIT_HOOK);return[4,eM(tm)];case 2:e=r.sent();es(tE.SIMPLE_GIT_HOOKS_JSON,e,{isJson:!0});t="\n".concat(eX,"\n");er(tE.GIT_IGNORE)?en(tE.GIT_IGNORE).split("\n").includes(eX)||ei(tE.GIT_IGNORE,t):es(tE.GIT_IGNORE,t);return[4,tj("Setting up simple-git-hooks",tv.SIMPLE_GIT_HOOKS)];case 3:r.sent();return[2]}})});return t2.apply(this,arguments)}function t3(){return t4.apply(this,arguments)}function t4(){t4=i(function(){var e,t,r,n,s,i,o,a,c,u,l;return b(this,function(d){switch(d.label){case 0:e=[{command:tv.PNPM_INSTALL_STANDARD,message:"Installing dependencies (standard)"},{command:tv.PNPM_INSTALL_LEGACY,message:"Retrying with legacy peer dependencies"},{command:tv.PNPM_INSTALL_FORCE,message:"Retrying with force install"}];t=true,r=false,n=undefined;d.label=1;case 1:d.trys.push([1,8,9,10]);s=e[Symbol.iterator]();d.label=2;case 2:if(!!(t=(i=s.next()).done))return[3,7];o=i.value,a=o.command,c=o.message;d.label=3;case 3:d.trys.push([3,5,,6]);return[4,tj("".concat(c," using: ").concat(a),a)];case 4:d.sent();return[2];case 5:u=d.sent();$.warn("Installation attempt failed: ".concat(a)),$.error("Details: ".concat(u.message));return[3,6];case 6:t=true;return[3,2];case 7:return[3,10];case 8:l=d.sent();r=true;n=l;return[3,10];case 9:try{if(!t&&s.return!=null){s.return()}}finally{if(r){throw n}}return[7];case 10:throw new Error("All dependency installation strategies failed.")}})});return t4.apply(this,arguments)}function t5(e,t){return t8.apply(this,arguments)}function t8(){t8=i(function(e,t){var r,n,s,i,o,a,c,u,l,d,f,p;return b(this,function(E){switch(E.label){case 0:if(!er(tE.PACKAGE_JSON)){$.error("package.json not found. Aborting setup.");return[2]}E.label=1;case 1:E.trys.push([1,14,,15]);return[4,ed(e,{update:t===null||t===void 0?void 0:t.update})];case 2:r=E.sent(),n=r.isUpToDate;s=n;if(s)return[3,5];return[4,t3()];case 3:E.sent();return[4,tz()];case 4:s=E.sent();E.label=5;case 5:s;o=true,a=false,c=undefined;E.label=6;case 6:E.trys.push([6,11,12,13]);u=((i=t===null||t===void 0?void 0:t.postInstallActions)!==null&&i!==void 0?i:[])[Symbol.iterator]();E.label=7;case 7:if(!!(o=(l=u.next()).done))return[3,10];d=l.value;return[4,d()];case 8:E.sent();E.label=9;case 9:o=true;return[3,7];case 10:return[3,13];case 11:f=E.sent();a=true;c=f;return[3,13];case 12:try{if(!o&&u.return!=null){u.return()}}finally{if(a){throw c}}return[7];case 13:$.success('"'.concat(e,'" setup completed.'));return[3,15];case 14:p=E.sent();throw $.error('Failed to setup "'.concat(e,'": ').concat(p.message)),p;case 15:return[2]}})});return t8.apply(this,arguments)}function t6(){return t7.apply(this,arguments)}function t7(){t7=i(function(){return b(this,function(e){switch(e.label){case 0:return[4,t5(eK,{update:!0,postInstallActions:[t1]})];case 1:e.sent();return[2]}})});return t7.apply(this,arguments)}function t9(){return re.apply(this,arguments)}function re(){re=i(function(){return b(this,function(e){switch(e.label){case 0:eo(tE.NODE_MODULES,tE.PNPM_LOCK_YAML);return[4,t3()];case 1:e.sent();return[4,t1()];case 2:e.sent();return[2]}})});return re.apply(this,arguments)}function rt(){return rr.apply(this,arguments)}function rr(){rr=i(function(){return b(this,function(e){switch(e.label){case 0:return[4,tj("Inspecting project dependencies",tv.NODE_MODULES_INSPECT)];case 1:e.sent();return[2]}})});return rr.apply(this,arguments)}function rn(){return rs.apply(this,arguments)}function rs(){rs=i(function(){return b(this,function(e){switch(e.label){case 0:return[4,tj("Running unit tests",tv.CYBERSKILL.TEST_UNIT)];case 1:e.sent();return[2]}})});return rs.apply(this,arguments)}function ri(){return ro.apply(this,arguments)}function ro(){ro=i(function(){return b(this,function(e){switch(e.label){case 0:return[4,tj("Running end-to-end tests",tv.CYBERSKILL.TEST_E2E)];case 1:e.sent();return[2]}})});return ro.apply(this,arguments)}i(function(){var e;return b(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,tP(tL(tx.argv)).scriptName(e1).usage("$0 <command> [options]").command("lint",tw.lint,tW).command("lint:fix",tw["lint:fix"],tz).command("lint:inspect",tw["lint:inspect"],tQ).command("lint-staged",tw["lint-staged"],tB).command("commitlint",tw.commitlint,tZ).command("setup",tw.setup,t6).command("reset",tw.reset,t9).command("inspect",tw.inspect,rt).command("test:unit",tw["test:unit"],rn).command("test:e2e",tw["test:e2e"],ri).demandCommand(1,"Please specify a valid command.").strict().help().alias("h","help").alias("v","version").version(tM.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();$.error("Fatal: ".concat(e.message)),tx.exit(1);return[3,3];case 3:return[2]}})})();import{format as ra}from"date-fns";import{Document as rc}from"mongoose";import ru from"mongoose-aggregate-paginate-v2";import rl from"mongoose-paginate-v2";import{v4 as rd}from"uuid";import rf from"crypto-js";import rp from"slugify";var rE=rp.default||rp;function rm(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;var r=t||{},n=r.lower,s=n===void 0?!0:n,i=r.locale,o=i===void 0?"vi":i,a=S(r,["lower","locale"]);return rE(e,h({lower:s,locale:o},a))}function rg(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:4;return rf.SHA256(e).toString(rf.enc.Hex).slice(0,t)}var rv={isEmpty:function e(e){return e==null?!0:Array.isArray(e)?e.length===0:(typeof e==="undefined"?"undefined":C(e))=="object"?p(e,Date)?!1:Object.keys(e).length===0:typeof e=="string"?e.trim().length===0:!1}};var rh={getDateTime:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:new Date;return ra(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,r=t===void 0?"string":t;var n=r==="string"?rh.getDateTime():new Date;return{id:rd(),isDel:!1,createdAt:n,updatedAt:n}},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 r=t.method,n=t.pre,s=t.post;r&&n&&e.pre(r,n),r&&s&&e.post(r,s)})},createGenericSchema:function e(e){return new e.Schema({id:{type:String,default:rd,required:!0,unique:!0},isDel:{type:Boolean,default:!1,required:!0}},{timestamps:!0})},createSchema:function e(e){var t=e.mongoose,r=e.schema,n=e.virtuals,s=n===void 0?[]:n,i=e.standalone,o=i===void 0?!1:i;var a=new t.Schema(r,{strict:!0});return s.forEach(function(e){var t=e.name,r=e.options,n=e.get;var s=a.virtual(t,r);n&&s.get(n)}),o||a.add(rh.createGenericSchema(t)),a},createModel:function e(e){var t=e.mongoose,r=e.name,n=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(!r)throw new Error("Model name is required.");if(t.models[r])return t.models[r];var f=rh.createSchema({mongoose:t,schema:n,virtuals:u});return rh.applyPlugins(f,[i&&rl,a&&ru]),rh.applyMiddlewares(f,d),t.model(r,f)},createSlugQuery:function e(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;return _(h({},t,r&&{id:{$ne:r}}),{$or:[{slug:e},{slugHistory:e}]})},validator:{isEmpty:function e(){return /*#__PURE__*/function(){var e=i(function(e){return b(this,function(t){return[2,!rv.isEmpty(e)]})});return function(t){return e.apply(this,arguments)}}()},isUnique:function e(e){return /*#__PURE__*/function(){var t=i(function(t){var r;return b(this,function(n){switch(n.label){case 0:if(!Array.isArray(e)||e.length===0)throw new Error("Fields must be a non-empty array of strings.");r={$or:e.map(function(e){return l({},e,t)})};return[4,this.constructor.findOne(r)];case 1:return[2,!n.sent()]}})});return function(e){return t.apply(this,arguments)}}()},matchesRegex:function e(e){return /*#__PURE__*/function(){var t=i(function(t){return b(this,function(r){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)})]})});return function(e){return t.apply(this,arguments)}}()}}},ry=/*#__PURE__*/function(){"use strict";function e(t,r){a(this,e);this.collection=t.collection(r)}u(e,[{key:"createOne",value:function e(e){var t=this;return i(function(){var r,n,s;return b(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);r=h({},rh.createGenericFields(),e);n={success:!0,message:"Document created successfully"};return[4,t.collection.insertOne(r)];case 1:return[2,(n.result=i.sent(),n)];case 2:s=i.sent();return[2,{success:!1,message:s.message}];case 3:return[2]}})})()}},{key:"createMany",value:function e(e){var t=this;return i(function(){var r,n,s;return b(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);r=e.map(function(e){return h({},rh.createGenericFields(),e)});return[4,t.collection.insertMany(r)];case 1:n=i.sent();return[2,n.insertedCount===0?{success:!1,message:"No documents were inserted"}:{success:!0,message:"".concat(n.insertedCount," documents created successfully"),result:n}];case 2:s=i.sent();return[2,{success:!1,message:s.message}];case 3:return[2]}})})()}},{key:"findOne",value:function e(e){var t=this;return i(function(){var r,n;return b(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);return[4,t.collection.findOne(e)];case 1:r=s.sent();return[2,r?{success:!0,message:"Document found",result:r}:{success:!1,message:"Document not found"}];case 2:n=s.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})})()}},{key:"findAll",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};var t=this;return i(function(){var r,n;return b(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);r={success:!0,message:"Documents retrieved successfully"};return[4,t.collection.find(e).toArray()];case 1:return[2,(r.result=s.sent(),r)];case 2:n=s.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})})()}},{key:"count",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};var t=this;return i(function(){var r,n;return b(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);r={success:!0,message:"Count retrieved successfully"};return[4,t.collection.countDocuments(e)];case 1:return[2,(r.result=s.sent(),r)];case 2:n=s.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})})()}},{key:"updateOne",value:function e(e,t){var r=this;return i(function(){var n,s;return b(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);return[4,r.collection.updateOne(e,{$set:t})];case 1:n=i.sent();return[2,n.matchedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Document updated successfully",result:n}];case 2:s=i.sent();return[2,{success:!1,message:s.message}];case 3:return[2]}})})()}},{key:"updateMany",value:function e(e,t){var r=this;return i(function(){var n,s;return b(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);return[4,r.collection.updateMany(e,{$set:t})];case 1:n=i.sent();return[2,n.matchedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Documents updated successfully",result:n}];case 2:s=i.sent();return[2,{success:!1,message:s.message}];case 3:return[2]}})})()}},{key:"deleteOne",value:function e(e){var t=this;return i(function(){var r,n;return b(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);return[4,t.collection.deleteOne(e)];case 1:r=s.sent();return[2,r.deletedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Document deleted successfully",result:r}];case 2:n=s.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})})()}},{key:"deleteMany",value:function e(e){var t=this;return i(function(){var r,n;return b(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);return[4,t.collection.deleteMany(e)];case 1:r=s.sent();return[2,r.deletedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Documents deleted successfully",result:r}];case 2:n=s.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})})()}}]);return e}(),r_=/*#__PURE__*/function(){"use strict";function e(t){a(this,e);this.model=t}u(e,[{key:"getModelName",value:function e(){return this.model.modelName}},{key:"findOne",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=arguments.length>3?arguments[3]:void 0;var s=this;return i(function(){var i,o,a;return b(this,function(c){switch(c.label){case 0:c.trys.push([0,2,,3]);i=s.model.findOne(e,t,r);n&&i.populate(n);return[4,i.exec()];case 1:o=c.sent();return[2,o?{success:!0,result:o}:{success:!1,message:"No ".concat(s.getModelName()," found."),code:W.NOT_FOUND.CODE}];case 2:a=c.sent();return[2,{success:!1,message:a.message,code:W.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"findAll",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=arguments.length>3?arguments[3]:void 0;var s=this;return i(function(){var i,o,a;return b(this,function(c){switch(c.label){case 0:c.trys.push([0,2,,3]);i=s.model.find(e,t,r);n&&i.populate(n);o={success:!0};return[4,i.exec()];case 1:return[2,(o.result=c.sent(),o)];case 2:a=c.sent();return[2,{success:!1,message:a.message,code:W.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"findPaging",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var r=this;return i(function(){var n,s;return b(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);n={success:!0};return[4,r.model.paginate(e,t)];case 1:return[2,(n.result=i.sent(),n)];case 2:s=i.sent();return[2,{success:!1,message:s.message,code:W.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"findPagingAggregate",value:function e(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var r=this;return i(function(){var n,s;return b(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);n={success:!0};return[4,r.model.aggregatePaginate(r.model.aggregate(e),t)];case 1:return[2,(n.result=i.sent(),n)];case 2:s=i.sent();return[2,{success:!1,message:s.message,code:W.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"count",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};var t=this;return i(function(){var r,n;return b(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);r={success:!0};return[4,t.model.countDocuments(e)];case 1:return[2,(r.result=s.sent(),r)];case 2:n=s.sent();return[2,{success:!1,message:n.message,code:W.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"createOne",value:function e(e){var t=this;return i(function(){var r,n;return b(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);r={success:!0};return[4,t.model.create(e)];case 1:return[2,(r.result=s.sent(),r)];case 2:n=s.sent();return[2,{success:!1,message:n.message,code:W.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"createMany",value:function e(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var r=this;return i(function(){var n,s;return b(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);n={success:!0};return[4,r.model.insertMany(e,t)];case 1:return[2,(n.result=i.sent().map(function(e){return p(e,rc)?e.toObject():null}).filter(function(e){return e!==null}),n)];case 2:s=i.sent();return[2,{success:!1,message:s.message,code:W.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"updateOne",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var n=this;return i(function(){var s,i;return b(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);return[4,n.model.findOneAndUpdate(e,t,h({new:!0},r)).exec()];case 1:s=o.sent();return[2,s?{success:!0,result:s}:{success:!1,message:"Failed to update ".concat(n.getModelName(),"."),code:W.NOT_FOUND.CODE}];case 2:i=o.sent();return[2,{success:!1,message:i.message,code:W.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"updateMany",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var n=this;return i(function(){var s,i;return b(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);s={success:!0};return[4,n.model.updateMany(e,t,r).exec()];case 1:return[2,(s.result=o.sent(),s)];case 2:i=o.sent();return[2,{success:!1,message:i.message,code:W.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"deleteOne",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var r=this;return i(function(){var n,s;return b(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);return[4,r.model.findOneAndDelete(e,t).exec()];case 1:n=i.sent();return[2,n?{success:!0,result:n}:{success:!1,message:"No ".concat(r.getModelName()," found to delete."),code:W.NOT_FOUND.CODE}];case 2:s=i.sent();return[2,{success:!1,message:s.message,code:W.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"deleteMany",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var r=this;return i(function(){var n,s;return b(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);return[4,r.model.deleteMany(e,t).exec()];case 1:n=i.sent();return[2,n.deletedCount===0?{success:!1,message:"No documents found to delete.",code:W.NOT_FOUND.CODE}:{success:!0,result:n}];case 2:s=i.sent();return[2,{success:!1,message:s.message,code:W.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"createShortId",value:function e(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:4;var r=this;return i(function(){var n,s,i,o;return b(this,function(a){switch(a.label){case 0:n=new Set;s=0;a.label=1;case 1:if(!(s<10))return[3,5];i=rg(e,s+t);o=!n.has(i);if(!o)return[3,3];n.add(i);return[4,r.model.exists({shortId:i})];case 2:o=!a.sent();a.label=3;case 3:if(o)return[2,{success:!0,result:i}];a.label=4;case 4:s++;return[3,1];case 5:return[2,{success:!1,message:"Failed to create a unique shortId",code:W.INTERNAL_SERVER_ERROR.CODE}]}})})()}},{key:"createSlug",value:function e(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var n=this;return i(function(){var s,o,a,c,u,l,d,f,p,E,m;return b(this,function(g){switch(g.label){case 0:g.trys.push([0,8,,9]);s=t[e],o=/*#__PURE__*/function(){var e=i(function(e){var s,i,o;return b(this,function(a){switch(a.label){case 0:return[4,n.model.findOne(rh.createSlugQuery(e,r,t.id))];case 1:s=a.sent();if(!s)return[2,e];i=1;a.label=2;case 2:o="".concat(e,"-").concat(i);return[4,n.model.findOne(rh.createSlugQuery(o,r,t.id))];case 3:s=a.sent(),i++;a.label=4;case 4:if(s)return[3,2];a.label=5;case 5:return[2,o]}})});return function t(t){return e.apply(this,arguments)}}();if(!((typeof s==="undefined"?"undefined":C(s))=="object"))return[3,5];a={};c=[];for(u in s)c.push(u);l=0;g.label=1;case 1:if(!(l<c.length))return[3,4];d=c[l];f=rm(s[d]);return[4,o(f)];case 2:a[d]=g.sent();g.label=3;case 3:l++;return[3,1];case 4:return[2,{success:!0,result:a}];case 5:p=rm(s);E={success:!0};return[4,o(p)];case 6:return[2,(E.result=g.sent(),E)];case 7:return[3,9];case 8:m=g.sent();return[2,{success:!1,message:"Failed to create a unique slug: ".concat(m.message),code:W.INTERNAL_SERVER_ERROR.CODE}];case 9:return[2]}})})()}},{key:"aggregate",value:function e(e){var t=this;return i(function(){var r,n;return b(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);r={success:!0};return[4,t.model.aggregate(e)];case 1:return[2,(r.result=s.sent(),r)];case 2:n=s.sent();return[2,{success:!1,message:n.message,code:W.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}}]);return e}();import{Collection as rS,Db as rO}from"mongodb";import{Document as rA,Model as rN}from"mongoose";var rI=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(rO),rT=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(rA),rC=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(rN),rR=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(rS);import{ApolloClient as rD,ApolloError as rb,ApolloLink as rw,ApolloProvider as rx,from as rL,HttpLink as rP,InMemoryCache as rM,split as rj}from"@apollo/client";import{onError as rG}from"@apollo/client/link/error";import{removeTypenameFromVariables as rk}from"@apollo/client/link/remove-typename";import{GraphQLWsLink as rU}from"@apollo/client/link/subscriptions";import{getMainDefinition as rF}from"@apollo/client/utilities";import{createClient as rq}from"graphql-ws";import{useMemo as rK}from"react";import{FaInfo as rY}from"react-icons/fa6";import{use as rH}from"react";import{FaRepeat as rB}from"react-icons/fa6";import{createContext as rV}from"react";var rQ=rV(void 0);import rJ from"./react/apollo-error/apollo-error.module.scss";import{jsx as rW,jsxs as rX}from"react/jsx-runtime";function rz(){var e=rH(rQ),t=e===null||e===void 0?void 0:e.error;if(!t)return null;var r=function(e,t){return(t===null||t===void 0?void 0:t.length)?rX("div",{children:[rX("strong",{children:[e,":"]}),rW("ul",{children:t.map(function(e){return rW("li",{children:e.message},e.message)})})]}):null};return rW("div",{className:rJ["modal-backdrop"],children:rX("div",{className:rJ["modal-content"],children:[rW("button",{type:"button",className:rJ["btn-close"],onClick:e.hideError,children:"✕"}),rX("div",{className:rJ["error-title"],children:[rW("button",{type:"button",className:rJ["btn-retry"],onClick:function(){return window.location.reload()},children:rW(rB,{})})," ",t.message]}),rX("div",{className:rJ["error-details"],children:[t.networkError&&rX("pre",{className:"network",children:[rW("strong",{children:"Network Error:"})," ",t.networkError.message]}),r("GraphQL Errors",T(t.graphQLErrors)),r("Protocol Errors",T(t.protocolErrors)),r("Client Errors",T(t.clientErrors)),t.extraInfo&&rX("pre",{className:"extra",children:[rW("strong",{children:"Extra Info:"})," ",JSON.stringify(t.extraInfo,null,4)]})]})]})})}import{use as r$}from"react";function rZ(){var e=r$(rQ);if(!e)throw new Error("useApolloError must be used within ApolloErrorProvider");return e}import{useEffect as r0,useMemo as r1,useState as r2}from"react";import{jsx as r3}from"react/jsx-runtime";var r4=null;function r5(e){r4===null||r4===void 0?void 0:r4(e)}function r8(e){var t=e.children;var r=I(r2(null),2),n=r[0],s=r[1];r0(function(){r4=s},[]);var i=r1(function(){return{error:n,showError:s,hideError:function(){return s(null)}}},[n]);return r3(rQ,{value:i,children:t})}import{consola as r6}from"consola/browser";var r7={silent:r6.silent,level:r6.level,fatal:r6.fatal,error:r6.error,warn:r6.warn,log:r6.log,info:r6.info,success:r6.success,ready:r6.ready,start:r6.start,box:r6.box,debug:r6.debug,trace:r6.trace,verbose:r6.verbose};import{toast as r9,Toaster as ne}from"react-hot-toast";var nt="/graphql";import{Fragment as nr,jsx as nn,jsxs as ns}from"react/jsx-runtime";var ni=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);var e;e=o(this,t,arguments);e.count=0;return e}u(t,[{key:"request",value:function e(e,t){var r=this;var n=Date.now();return this.count+=1,t(e).map(function(t){var s=Date.now()-n,i=e.operationName||"Unnamed";return r7.info("[Apollo] #".concat(r.count,": ").concat(i," (").concat(s,"ms)")),t})}}]);return t}(rw);function no(e){var t=e||{},r=t.uri,n=t.wsUrl,s=t.customLinks,i=new ni,o=rG(function(e){var t=e.graphQLErrors,r=e.networkError,n=e.protocolErrors,s=e.operation;var i=(s===null||s===void 0?void 0:s.operationName)||"Unknown";if(t&&t.forEach(function(e){var t=e.message,r=e.locations,n=e.path;r7.error("[GraphQL error] ".concat(i,": ").concat(t,", Location: ").concat(JSON.stringify(r),", Path: ").concat(n))}),n&&n.forEach(function(e){var t=e.message,r=e.extensions;r7.error("[Protocol error]: ".concat(t,", Extensions: ").concat(JSON.stringify(r)))}),r&&r7.error("[Network error]: ".concat(r)),t||n||r){var o,a;var c=(t===null||t===void 0?void 0:(o=t[0])===null||o===void 0?void 0:o.message)||(n===null||n===void 0?void 0:(a=n[0])===null||a===void 0?void 0:a.message)||(r===null||r===void 0?void 0:r.message)||"Unexpected error",u=new rb({graphQLErrors:t||[],protocolErrors:n||[],clientErrors:[],networkError:r||null,errorMessage:c,extraInfo:{operation:s}});r9.error(function(e){return ns(nr,{children:[c,"\xa0",nn(rY,{cursor:"pointer",onClick:function(){setTimeout(function(){r5(u)},0),r9.dismiss(e.id)}})]})})}}),a=rk();r||r7.warn('[Apollo] No GraphQL URI provided — using "'.concat(nt,'" as default'));var c=new rP({uri:r!==null&&r!==void 0?r:nt,credentials:"include"}),u=n?new rU(rq({url:n})):rw.empty(),l=p(u,rw)?rj(function(e){var t=e.query;var r=rF(t);return r.kind==="OperationDefinition"&&r.operation==="subscription"},u,c):c;return l===c&&n&&r7.warn("[Apollo] WS URL is set, but subscriptions fallback to HTTP. Check your wsLink config."),[i,o,a].concat(T(s!==null&&s!==void 0?s:[]),[l])}function na(e){var t=e.isNextJS,r=e.options,n=e.children,s=e.client,i=e.provider,o=e.cache;var a=r||{},c=a.uri,u=a.wsUrl,l=a.customLinks,d=S(a,["uri","wsUrl","customLinks"]);if(typeof(s!==null&&s!==void 0?s:rD)!="function")throw new TypeError("Invalid ApolloClient provided. Ensure CustomClient is a class.");var f=i||rx,E=rK(function(){return rL(no({uri:c,wsUrl:u,customLinks:l}))},[c,u,l]),m=rK(function(){return new rD(h({link:E,cache:p(o,rM)?o:new rM},d))},[E,o,d]),g=t?nn(f,{makeClient:function(){return m},children:n}):nn(f,{client:m,children:n});return t?nn(f,{makeClient:function(){return m},children:n}):ns(nr,{children:[ns(r8,{children:[g,nn(rz,{})]}),nn(ne,{position:"top-right"})]})}import{useTranslation as nc}from"react-i18next";var nu=nc;import nl from"i18next";import{initReactI18next as nd}from"react-i18next";function nf(e){return nl.use(nd).init(e)}import np from"classnames";import nE from"./react/loading/loading.module.scss";import{jsx as nm,jsxs as ng}from"react/jsx-runtime";function nv(e){var t=e.full,r=t===void 0?!1:t,n=e.block,s=n===void 0?!1:n,i=e.className,o=i===void 0?"":i,a=e.message,c=a===void 0?"Loading":a,u=S(e,["full","block","className","message"]);function l(){return ng("div",_(h({className:nE.container},u),{children:[nm("div",{className:nE.ring}),nm("div",{className:nE.ring}),nm("div",{className:nE.ring}),nm("div",{className:nE.ring}),c&&nm("div",{className:nE.message,children:c})]}))}return r?nm("div",{className:np(nE.fullscreen,o),children:l()}):s?nm("div",{className:np(nE.block,o),children:l()}):l()}import{createContext as nh}from"react";var ny=nh(void 0);import{use as n_}from"react";function nS(){var e=n_(ny);if(!e)throw new Error("useLoading must be used within a LoadingProvider");return e}import{useCallback as nO,useMemo as nA,useState as nN}from"react";import{jsx as nI}from"react/jsx-runtime";function nT(e){var t=e.children;var r=I(nN(!1),2),n=r[0],s=r[1],i=I(nN(!1),2),o=i[0],a=i[1],c=nO(function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;s(!0),a(e)},[]),u=nO(function(){s(!1),a(!1)},[]),l=nA(function(){return{isLoading:n,isGlobalLoading:o,showLoading:c,hideLoading:u}},[n,o,c,u]);return nI(ny,{value:l,children:n?nI(nv,{full:o}):t})}import{createContext as nC}from"react";var nR=nC(void 0);import{NextIntlClientProvider as nD}from"next-intl";import{useTranslations as nb}from"next-intl";import{use as nw}from"react";function nx(){var e=nw(nR);if(!e)throw new Error("useNextIntl must be used within a NextIntlProvider");return e}var nL=nb;import{jsx as nP}from"react/jsx-runtime";function nM(e){var t=function(t){var r;var n=nx(),s=n.currentLanguage,i=t.messages,o=t.languages,a="en",c=i[(s===null||s===void 0?void 0:s.value)||a],u=(r=o.find(function(e){return e.value===(s===null||s===void 0?void 0:s.value)}))===null||r===void 0?void 0:r.timezone;return i?nP(nD,{locale:(s===null||s===void 0?void 0:s.value)||a,messages:c,timeZone:u,children:nP(e,h({},t))}):(r7.warn("Missing messages for language: ".concat((s===null||s===void 0?void 0:s.value)||a)),null)};return t.displayName="withNextIntl(".concat(e.displayName||e.name||"Component",")"),t}import{useMemo as nj}from"react";import{useCallback as nG,useEffect as nk,useState as nU}from"react";var nF={serialize:function(e){return JSON.stringify(e,function(e,t){return p(t,Date)?{__type:"Date",value:t.toISOString()}:t})},deserialize:function(e){return JSON.parse(e,function(e,t){return(t===null||t===void 0?void 0:t.__type)==="Date"?new Date(t.value):t})}};import nq from"localforage";var nK={get:function e(e){return i(function(){var t;return b(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,nq.getItem(e)];case 1:return[2,r.sent()];case 2:t=r.sent();return[2,(r7.error('[Storage:get] Error getting key "'.concat(e,'":'),t),null)];case 3:return[2]}})})()},set:function e(e,t){return i(function(){var r;return b(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,nq.setItem(e,t)];case 1:n.sent();return[3,3];case 2:r=n.sent();r7.error('[Storage:set] Error setting key "'.concat(e,'":'),r);return[3,3];case 3:return[2]}})})()},remove:function e(e){return i(function(){var t;return b(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,nq.removeItem(e)];case 1:r.sent();return[3,3];case 2:t=r.sent();r7.error('[Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,3];case 3:return[2]}})})()},keys:function e(){return i(function(){var e,t;return b(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,nq.keys()];case 1:return[2,(e=r.sent())!==null&&e!==void 0?e:[]];case 2:t=r.sent();return[2,(r7.error("[Storage:keys] Error getting keys:",t),[])];case 3:return[2]}})})()}};function nY(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:nF;var n=I(nU(t),2),s=n[0],o=n[1],a=I(nU(!1),2),c=a[0],u=a[1];nk(function(){var n=!0;return i(function(){var s,i,a,c;return b(this,function(l){switch(l.label){case 0:l.trys.push([0,6,7,8]);return[4,nK.get(e)];case 1:s=l.sent();if(!n)return[3,5];if(!(s!==null))return[3,2];i=r.deserialize(s);o(i);return[3,5];case 2:if(!(t!==void 0))return[3,4];a=r.serialize(t);return[4,nK.set(e,a)];case 3:l.sent(),o(t);return[3,5];case 4:o(void 0);l.label=5;case 5:return[3,8];case 6:c=l.sent();r7.error('Error loading value for key "'.concat(e,'":'),c),n&&o(t);return[3,8];case 7:n&&u(!0);return[7];case 8:return[2]}})})(),function(){n=!1,u(!1)}},[e,t,r]),nk(function(){if(!c)return;i(function(){var t,n;return b(this,function(i){switch(i.label){case 0:i.trys.push([0,3,,4]);if(!(s!==void 0))return[3,2];t=r.serialize(s);return[4,nK.set(e,t)];case 1:i.sent();i.label=2;case 2:return[3,4];case 3:n=i.sent();r7.error('Error saving value for key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},[s,e,r,c]);var l=nG(function(e){o(function(t){return typeof e=="function"?e(t):e})},[]),d=nG(/*#__PURE__*/i(function(){var t;return b(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,nK.remove(e)];case 1:r.sent(),o(void 0);return[3,3];case 2:t=r.sent();r7.error('Error removing key "'.concat(e,'":'),t);return[3,3];case 3:return[2]}})}),[e]);return{value:s,set:l,remove:d}}import{Fragment as nH,jsx as nB}from"react/jsx-runtime";function nV(e){var t=e.children;return nB(nH,{children:t})}var nQ=nM(nV);function nJ(e){var t=e.children,r=e.languages,n=e.messages;var s;var i=nY("lang",(s=r===null||r===void 0?void 0:r[0])!==null&&s!==void 0?s:{}),o=i.value,a=i.set,c=nj(function(){return{languages:r,currentLanguage:o,setCurrentLanguage:a}},[r,a,o]);return nB(nR,{value:c,children:nB(nQ,{languages:r,messages:n,children:t})})}import nW from"unorm";var nX={a:["\xe0","\xe1","ạ","ả","\xe3","\xe2","ầ","ấ","ậ","ẩ","ẫ","ă","ằ","ắ","ặ","ẳ","ẵ"],e:["\xe8","\xe9","ẹ","ẻ","ẽ","\xea","ề","ế","ệ","ể","ễ"],i:["\xec","\xed","ị","ỉ","ĩ"],o:["\xf2","\xf3","ọ","ỏ","\xf5","\xf4","ồ","ố","ộ","ổ","ỗ","ơ","ờ","ớ","ợ","ở","ỡ"],u:["\xf9","\xfa","ụ","ủ","ũ","ư","ừ","ứ","ự","ử","ữ"],y:["ỳ","\xfd","ỵ","ỷ","ỹ"],d:["đ"]},nz=Object.entries(nX).reduce(function(e,t){var r=I(t,2),n=r[0],s=r[1];return e[n.toUpperCase()]=s.map(function(e){return e.toUpperCase()}),e},{});function n$(e){e=nW.nfkc(e);var t=h({},nX,nz);var r=true,n=false,s=undefined;try{for(var i=Object.entries(t)[Symbol.iterator](),o;!(r=(o=i.next()).done);r=true){var a=I(o.value,2),c=a[0],u=a[1];var l="[".concat(c).concat(u.join(""),"]"),d="(".concat([c].concat(T(u)).join("|"),")");e=e.replace(new RegExp(l,"g"),d)}}catch(e){n=true;s=e}finally{try{if(!r&&i.return!=null){i.return()}}finally{if(n){throw s}}}return e}function nZ(e){return e.normalize("NFD").replace(RegExp("\\p{Diacritic}","gu"),"")}export{rz as ApolloError,rQ as ApolloErrorContext,r8 as ApolloErrorProvider,na as ApolloProvider,eB as BUILD_DIRECTORY,Z as CHECK_PACKAGE_EMPTY_RESULT,tv as COMMAND,tw as COMMAND_DESCRIPTIONS,e9 as COMMIT_LINT_CLI,e7 as COMMIT_LINT_PACKAGE_NAME,e1 as CYBERSKILL_CLI,e2 as CYBERSKILL_CLI_PATH,e0 as CYBERSKILL_DIRECTORY,eK as CYBERSKILL_PACKAGE_NAME,eY as CYBERSKILL_STORAGE,rR as C_Collection,rI as C_Db,rT as C_Document,rC as C_Model,H as DEBUG,e4 as ESLINT_CLI,td as ESLINT_INSPECT_CLI,tl as ESLINT_INSPECT_PACKAGE_NAME,e3 as ESLINT_PACKAGE_NAME,U as E_CommandType,w as E_ConfigType,B as E_IssueType,ti as GIT_CLI,eZ as GIT_COMMIT_EDITMSG,e$ as GIT_HOOK,eW as GIT_IGNORE,nt as GRAPHQL_URI_DEFAULT,tm as HOOK,tb as IS_BROWSER,tt as LINT_STAGED_CLI,te as LINT_STAGED_PACKAGE_NAME,nv as Loading,ny as LoadingContext,nT as LoadingProvider,ry as MongoController,r_ as MongooseController,eH as NODE_MODULES,tp as NODE_MODULES_INSPECT_CLI,tf as NODE_MODULES_INSPECT_PACKAGE_NAME,nR as NextIntlContext,nJ as NextIntlProvider,eV as PACKAGE_JSON,eQ as PACKAGE_LOCK_JSON,tE as PATH,e8 as PLAYWRIGHT_PACKAGE_NAME,to as PNPM_CLI,ta as PNPM_EXEC_CLI,ez as PNPM_LOCK_YAML,W as RESPONSE_STATUS,tc as SIMPLE_GIT_HOOKS_PACKAGE_NAME,tu as SIMPLE_GIT_HOOK_CLI,eX as SIMPLE_GIT_HOOK_JSON,eJ as TSCONFIG_JSON,tn as TSC_CLI,tr as TSC_PACKAGE_NAME,ts as TSX_CLI,ne as Toaster,e6 as VITEST_CLI,e5 as VITEST_PACKAGE_NAME,eq as WORKING_DIRECTORY,ru as aggregatePaginate,ei as appendFileSync,ed as checkPackage,eT as clearAllErrorLists,tS as deepMerge,eb as executeCommand,er as existsSync,eP as formatCommand,rg as generateShortId,rm as generateSlug,eu as getLatestPackageVersion,ec as getPackage,eN as getStoredErrorLists,nf as initI18next,ty as isJson,t_ as isPlainObject,eF as join,r7 as log,$ as logNodeJS,tD as mergeConfigs,rh as mongo,rl as mongoosePaginate,ex as rawCommand,en as readFileSync,n$ as regexSearchMapper,nZ as removeAccent,eU as resolve,eM as resolveCommands,ek as resolveWorkingPath,eo as rmSync,nF as serializer,r5 as showGlobalApolloError,nK as storage,ey as storageNodeJS,X as throwError,r9 as toast,rZ as useApolloError,nS as useLoading,nx as useNextIntl,nY as useStorage,nu as useTranslateI18next,nL as useTranslateNextIntl,rv as validate,M as vitestE2E,th as vitestUnit,nM as withNextIntl,es as writeFileSync};
|