@cyberskill/shared 1.84.0 → 1.85.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/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,N()?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)I(e,t)}function p(e,t){if(t!=null&&typeof Symbol!=="undefined"&&t[Symbol.hasInstance]){return!!t[Symbol.hasInstance](e)}else{return e instanceof t}}function m(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function v(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 h(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function E(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 S(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 O(e,t){if(e==null)return{};var r=_(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 _(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&&(R(t)==="object"||typeof t==="function")){return t}return n(e)}function I(e,t){I=Object.setPrototypeOf||function e(e,t){e.__proto__=t;return e};return I(e,t)}function b(e,r){return t(e)||v(e,r)||T(e,r)||g()}function C(e){return r(e)||m(e)||T(e)||h()}function R(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function T(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 N(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(N=function(){return!!e})()}function w(e,t){var r,n,s,i={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},o=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return o.next=a(0),o["throw"]=a(1),o["return"]=a(2),typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(e){return function(t){return c([e,t])}}function c(a){if(r)throw new TypeError("Generator is already executing.");while(o&&(o=0,a[0]&&(i=0)),i)try{if(r=1,n&&(s=a[0]&2?n["return"]:a[0]?n["throw"]||((s=n["return"])&&s.call(n),0):n.next)&&!(s=s.call(n,a[1])).done)return s;if(n=0,s)a=[a[0]&2,s.value];switch(a[0]){case 0:case 1:s=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;n=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(s=i.trys,s=s.length>0&&s[s.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!s||a[1]>s[0]&&a[1]<s[3])){i.label=a[1];break}if(a[0]===6&&i.label<s[1]){i.label=s[1];s=a;break}if(s&&i.label<s[2]){i.label=s[2];i.ops.push(a);break}if(s[2])i.ops.pop();i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e];n=0}finally{r=s=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}}var x=Object.defineProperty;var D=function(e,t,r){return t in e?x(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r};var j=function(e,t,r){return D(e,(typeof t==="undefined"?"undefined":R(t))!="symbol"?t+"":t,r)};var L={extends:["@commitlint/config-conventional"]};var M=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}(M||{});import P from"@antfu/eslint-config";import G from"@vitejs/plugin-react-swc";import{defineConfig as k}from"vitest/config";function U(e){return k(E({plugins:[G()],test:{include:["**/*.test.e2e.?(c|m)[jt]s?(x)"],browser:{enabled:!0,provider:"playwright",instances:[{browser:"chromium"},{browser:"firefox"},{browser:"webkit"}]}}},e))}import F from"@vitejs/plugin-react-swc";import{defineConfig as q}from"vitest/config";import K from"node:process";var H=function(e){return e.CLI="CLI",e.RAW="RAW",e}(H||{});import{exec as Q}from"node:child_process";import V from"node:process";import*as Y from"node:util";import J from"node:process";var B=J.env.DEBUG==="true";var W=function(e){return e.Error="error",e.Warning="warning",e}(W||{});import z from"chalk";import $ from"consola";import{GraphQLError as X}from"graphql";var Z={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 ee(e){var t=e.message,r=e.status,n=r===void 0?Z.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 X(a,{extensions:{code:n.CODE}}):new Error(a)}B||($.level=4);function et(e){var t=z[e];return typeof t=="function"?t:z.green}var er={silent:$.silent,level:$.level,fatal:$.fatal,error:$.error,warn:$.warn,log:$.log,info:$.info,success:$.success,ready:$.ready,start:$.start,box:$.box,debug:$.debug,trace:$.trace,verbose:$.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)){$.box(z.green(e));return}t.forEach(function(e){var t=e.file,n=e.position,s=e.rule,i=e.message;$.log("".concat(z.gray("File:")," ").concat(z.blue("".concat(t).concat(n?":".concat(n):"")))),s&&$.log(" ".concat(et(r)("Rule:")," ").concat(s)),$.log(" ".concat(et(r)("Message:")," ").concat(i))}),$.box(et(r)("".concat(e," : ").concat(t.length))),$.log(z.gray("─".repeat(40)))}};var en={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};import es from"node-fetch";import*as ei from"node:fs";function eo(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}return t.every(function(e){return ei.existsSync(e)})}function ea(e,t){var r=ei.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":R(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 ec(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":R(t))=="object"?JSON.stringify(t,null,4):String(t);ei.writeFileSync(e,i,"utf-8")}function eu(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":R(t))=="object"?JSON.stringify(t,null,4):String(t);ei.appendFileSync(e,i,"utf-8")}function el(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}t.forEach(function(e){eo(e)&&ei.rmSync(e,{recursive:!0,force:!0})})}function ed(e){var t=eW(ez,e1);if(!eo(t))return!1;try{var r=ea(t,{asJson:!0}),n=r.name,s=r.dependencies,i=s===void 0?{}:s,o=r.devDependencies,a=o===void 0?{}:o,c=n===e,u=e in i,l=e in a;return c||u||l?{path:t,file:r,isCurrentProject:c,isDepend:u,isDevDepend:l}:!1}catch(e){return er.warn("Failed to read package.json: ".concat(e.message)),!1}}function ef(e){return ep.apply(this,arguments)}function ep(){ep=i(function(e){var t,r,n,s;return w(this,function(i){switch(i.label){case 0:i.trys.push([0,3,,4]);return[4,es("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 er.error('Failed to fetch version for "'.concat(e,'": ').concat(s.message)),s;case 4:return[2]}})});return ep.apply(this,arguments)}function em(e,t){return ev.apply(this,arguments)}function ev(){ev=i(function(e,t){var r,n,s,i,o,a,c,u,l,d,f,p,m,v,g,h,y,S,O,_,A;return w(this,function(I){switch(I.label){case 0:I.trys.push([0,4,,5]);r=ed(e);if(!r)return[2,E({},en)];c=r.path,u=r.file,l=r.isCurrentProject,d=r.isDepend,f=r.isDevDepend,p=(n=u.dependencies)!==null&&n!==void 0?n:{},m=(s=u.devDependencies)!==null&&s!==void 0?s:{},v=l?(i=u.version)!==null&&i!==void 0?i:"0.0.0":d?(o=p[e])!==null&&o!==void 0?o:"0.0.0":f?(a=m[e])!==null&&a!==void 0?a:"0.0.0":"0.0.0";if(!l)return[3,1];y=v;return[3,3];case 1:return[4,ef(e)];case 2:y=I.sent();I.label=3;case 3:g=y,h=l||v===g;if(!h&&(t===null||t===void 0?void 0:t.update)){;O=d?"dependencies":f?"devDependencies":null;O&&((S=u[O])===null||S===void 0?void 0:S[e])!==g&&(u[O]=(_=u[O])!==null&&_!==void 0?_:{},u[O][e]=g,ec(c,u,{isJson:!0}),er.info('Updated "'.concat(e,'" to version ').concat(g)))}return[2,{isCurrentProject:l,installedPath:c,file:u,isUpToDate:h}];case 4:A=I.sent();return[2,(er.error('Error checking package "'.concat(e,'": ').concat(A.message)),E({},en))];case 5:return[2]}})});return ev.apply(this,arguments)}function eg(){return eh.apply(this,arguments)}function eh(){eh=i(function(){var e,t,r,n,s,i,o,a,c,u,l,d;return w(this,function(f){switch(f.label){case 0:e=[{command:function(){return tT.pnpmInstallStandard()},message:"Installing dependencies (standard)"},{command:function(){return tT.pnpmInstallLegacy()},message:"Retrying with legacy peer dependencies"},{command:function(){return tT.pnpmInstallForce()},message:"Retrying with force install"}];t=true,r=false,n=undefined;f.label=1;case 1:f.trys.push([1,9,10,11]);s=e[Symbol.iterator]();f.label=2;case 2:if(!!(t=(i=s.next()).done))return[3,8];o=i.value,a=o.command,c=o.message;f.label=3;case 3:f.trys.push([3,6,,7]);return[4,a()];case 4:u=f.sent();return[4,eQ("".concat(c," using: ").concat(u),u)];case 5:f.sent();return[2];case 6:l=f.sent();er.warn("Installation attempt failed: ".concat(c)),er.error("Details: ".concat(l.message));return[3,7];case 7:t=true;return[3,2];case 8:return[3,11];case 9:d=f.sent();r=true;n=d;return[3,11];case 10:try{if(!t&&s.return!=null){s.return()}}finally{if(r){throw n}}return[7];case 11:throw new Error("All dependency installation strategies failed.")}})});return eh.apply(this,arguments)}function eE(e,t){return ey.apply(this,arguments)}function ey(){ey=i(function(e,t){var r,n,s,i,o,a,c,u,l,d,f;return w(this,function(p){switch(p.label){case 0:if(!eo(tA.PACKAGE_JSON)){er.error("package.json not found. Aborting setup.");return[2]}p.label=1;case 1:p.trys.push([1,13,,14]);r=C(new Set(e)).sort();return[4,Promise.all(r.map(function(e){return em(e,E({},(t===null||t===void 0?void 0:t.update)&&{update:t.update}))}))];case 2:n=p.sent().every(function(e){return e.isUpToDate});if(n)return[3,4];return[4,eg()];case 3:n=p.sent();p.label=4;case 4:n;i=true,o=false,a=undefined;p.label=5;case 5:p.trys.push([5,10,11,12]);c=((s=t===null||t===void 0?void 0:t.postInstallActions)!==null&&s!==void 0?s:[])[Symbol.iterator]();p.label=6;case 6:if(!!(i=(u=c.next()).done))return[3,9];l=u.value;return[4,l()];case 7:p.sent();p.label=8;case 8:i=true;return[3,6];case 9:return[3,12];case 10:d=p.sent();o=true;a=d;return[3,12];case 11:try{if(!i&&c.return!=null){c.return()}}finally{if(o){throw a}}return[7];case 12:return[3,14];case 13:f=p.sent();throw er.error('Failed to setup "'.concat(e.join(", "),'": ').concat(f.message)),f;case 14:return[2]}})});return ey.apply(this,arguments)}import eS from"node-persist";import eO from"node:os";import e_ from"node:process";function eA(){return e_.env.CYBERSKILL_STORAGE_DIR||eW(eO.homedir(),eX)}function eI(){return eb.apply(this,arguments)}function eb(){eb=i(function(){var e;return w(this,function(t){switch(t.label){case 0:e=eS.defaultInstance;if(e)return[3,2];return[4,eS.init({dir:eA(),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 eb.apply(this,arguments)}var eC={get:function e(e){return i(function(){var t,r;return w(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,eI()];case 1:n.sent();return[4,eS.getItem(e)];case 2:return[2,(t=n.sent())!==null&&t!==void 0?t:null];case 3:r=n.sent();return[2,(er.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 w(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,eI()];case 1:n.sent();return[4,eS.setItem(e,t)];case 2:n.sent();return[3,4];case 3:r=n.sent();er.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 w(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,eI()];case 1:r.sent();return[4,eS.removeItem(e)];case 2:r.sent();return[3,4];case 3:t=r.sent();er.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 w(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,eI()];case 1:r.sent();return[4,eS.keys()];case 2:e=r.sent();return[2,Array.isArray(e)?e:(er.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=r.sent();return[2,(er.error("[Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return i(function(){return w(this,function(t){try{return[2,"".concat(eA()," (key: ").concat(e,")")]}catch(e){return[2,(er.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var eR=Y.promisify(Q);function eT(e){return"error_list:".concat(e)}function eN(e){return ew.apply(this,arguments)}function ew(){ew=i(function(e){var t,r,n;return w(this,function(s){switch(s.label){case 0:if(e.length===0)return[2];t=Date.now(),r=eT(t);s.label=1;case 1:s.trys.push([1,3,,4]);return[4,eC.set(r,{errors:e,timestamp:t})];case 2:s.sent(),setTimeout(/*#__PURE__*/i(function(){var e;return w(this,function(t){switch(t.label){case 0:return[4,eC.getLogLink(r)];case 1:e=t.sent();e&&er.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})}),10);return[3,4];case 3:n=s.sent();er.error("Failed to save errors: ".concat(n.message));return[3,4];case 4:return[2]}})});return ew.apply(this,arguments)}function ex(){return eD.apply(this,arguments)}function eD(){eD=i(function(){var e,t,r;return w(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,eC.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 w(this,function(r){switch(r.label){case 0:return[4,eC.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,(er.error("Failed to retrieve stored errors: ".concat(r.message)),[])];case 4:return[2]}})});return eD.apply(this,arguments)}function ej(){return eL.apply(this,arguments)}function eL(){eL=i(function(){var e,t,r;return w(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,eC.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 eC.remove(e)}))];case 2:n.sent();return[3,4];case 3:r=n.sent();er.error("Failed to clear error lists: ".concat(r.message));return[3,4];case 4:return[2]}})});return eL.apply(this,arguments)}function eM(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,c,u,l,d;var f=s.exec(e)||[],p=i.exec(e)||[],m=o.exec(e)||[];var v,g,h,E,y,S;f.length&&n?t.push({file:n,position:"".concat(f[1],":").concat(f[2]),type:f[3]==="error"?"error":"warning",message:(v=f===null||f===void 0?void 0:(a=f[4])===null||a===void 0?void 0:a.trim())!==null&&v!==void 0?v:"",rule:(g=f===null||f===void 0?void 0:(c=f[5])===null||c===void 0?void 0:c.trim())!==null&&g!==void 0?g:""}):p.length?t.push({file:(h=p===null||p===void 0?void 0:p[1])!==null&&h!==void 0?h:"",position:"".concat(p[2],":").concat(p[3]),type:p[4]==="error"?"error":"warning",message:(E=p===null||p===void 0?void 0:(u=p[5])===null||u===void 0?void 0:u.trim())!==null&&E!==void 0?E:""}):m.length?t.push({file:"commitlint",type:"error",message:(y=m===null||m===void 0?void 0:(l=m[1])===null||l===void 0?void 0:l.trim())!==null&&y!==void 0?y:"",rule:(S=m===null||m===void 0?void 0:(d=m[2])===null||d===void 0?void 0:d.trim())!==null&&S!==void 0?S:""}):r.push(e.trim())}}),t.length&&eN(t),B&&r.length&&(er.warn("Unmatched lines:"),r.forEach(function(e){return er.info(" ".concat(e))}))}function eP(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&&eN(r)}catch(t){eM(e)}}function eG(e){return ek.apply(this,arguments)}function ek(){ek=i(function(e){var t,r,n,s,i,o,a,c,u;var l=arguments;return w(this,function(d){switch(d.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:eP;r=new AbortController;V.on("SIGINT",function(){er.warn("Process interrupted. Terminating..."),r.abort(),V.exit()});d.label=1;case 1:d.trys.push([1,3,,4]);return[4,eR(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&&er.error("Command failed: ".concat(u));return[3,4];case 4:return[2]}})});return ek.apply(this,arguments)}function eU(e){return{raw:!0,cmd:e}}function eF(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(tg," ").concat(e$," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(tg," ").concat(tp," ").concat(tt," ").concat(e):"".concat(tg," ").concat(te," ").concat(e)}function eq(e,t){return typeof e=="function"?eF(e(t),t):(typeof e==="undefined"?"undefined":R(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?eF(e,t):e}function eK(e){return eH.apply(this,arguments)}function eH(){eH=i(function(e){var t,r,n,s,i,o,a;var c=arguments;return w(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,em(e$)];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=b(e,2),r=t[0],n=t[1];return[r,eq(n,i)]}))]}})});return eH.apply(this,arguments)}function eQ(e,t){return eV.apply(this,arguments)}function eV(){eV=i(function(e,t){var r;return w(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);er.start("".concat(e)),B&&er.info("→ ".concat(t));return[4,eG(t)];case 1:n.sent(),er.success("".concat(e," done."));return[3,3];case 2:r=n.sent();throw er.error("".concat(e," failed: ").concat(r.message)),r;case 3:return[2]}})});return eV.apply(this,arguments)}import*as eY from"node:path";function eJ(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}var n;return(n=eY).resolve.apply(n,[ez].concat(C(t)))}function eB(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}var n;return(n=eY).resolve.apply(n,C(t))}function eW(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}var n;return(n=eY).join.apply(n,C(t))}var ez=K.env.INIT_CWD||K.cwd(),e$="@cyberskill/shared",eX=".cyberskill-storage",eZ="node_modules",e0="dist",e1="package.json",e2="package-lock.json",e4="tsconfig.json",e3=".gitignore",e5=".simple-git-hooks.json",e8="pnpm-lock.yaml",e6=".git/hooks/",e9=".git/COMMIT_EDITMSG",e7=eW(ez,eZ,e$,e0),te="cyberskill",tt="src/nodejs/cli/index.ts",tr="eslint",tn="eslint",ts="vitest",ti="playwright",to="vitest",ta="@commitlint/cli",tc="commitlint",tu="lint-staged",tl="lint-staged",td="typescript",tf="tsc",tp="tsx",tm="git",tv="pnpm",tg="pnpm exec",th="simple-git-hooks",tE="simple-git-hooks",ty="@eslint/config-inspector",tS="eslint-config-inspector",tO="node-modules-inspector",t_="node-modules-inspector",tA={CYBERSKILL_DIRECTORY:e7,WORKING_DIRECTORY:ez,TS_CONFIG:eJ(e4),GIT_IGNORE:eJ(e3),GIT_HOOK:eJ(e6),GIT_COMMIT_MSG:eJ(e9),SIMPLE_GIT_HOOKS_JSON:eJ(e5),PACKAGE_JSON:eJ(e1),PACKAGE_LOCK_JSON:eJ(e2),PNPM_LOCK_YAML:eJ(e8),NODE_MODULES:eJ(eZ),LINT_STAGED_CONFIG:eJ("".concat(e7,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:eJ("".concat(e7,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:eJ("".concat(e7,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:eJ("".concat(e7,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:eJ("".concat(e7,"/react/vitest/vitest.e2e.js"))};function tI(e){var t=e.isCurrentProject;return E({"pre-commit":tl,"commit-msg":tc},t&&{"pre-push":eU("".concat(tm," pull"))})}function tb(e){return tC.apply(this,arguments)}function tC(){tC=i(function(e){var t,r,n,s,i,o;var a=arguments;return w(this,function(c){switch(c.label){case 0:for(t=a.length,r=new Array(t>1?t-1:0),n=1;n<t;n++){r[n-1]=a[n]}s=b(r,2),i=s[0],o=s[1];if(!i)throw new Error("'first' argument is undefined");switch(e){case"CLI":return[3,1];case"RAW":return[3,3]}return[3,4];case 1:return[4,eE(i.split(" "),{update:!0})];case 2:return[2,(c.sent(),eq(eU("".concat(tg," ").concat(o))))];case 3:return[2,eq(eU(i))];case 4:throw new Error("Unsupported command type");case 5:return[2]}})});return tC.apply(this,arguments)}function tR(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++){r[n-1]=arguments[n]}return /*#__PURE__*/i(function(){return w(this,function(t){return[2,tb.apply(void 0,[e].concat(C(r)))]})})}var tT={simpleGitHooks:tR("CLI",th,tE),eslintInspect:tR("CLI",ty,tS),nodeModulesInspect:tR("CLI",tO,t_),eslintCheck:tR("CLI",tr,"".concat(tn," ").concat(tA.WORKING_DIRECTORY)),eslintFix:tR("CLI",tr,"".concat(tn," ").concat(tA.WORKING_DIRECTORY," --fix")),typescriptCheck:tR("CLI",td,"".concat(tf," -p ").concat(tA.TS_CONFIG," --noEmit")),configureGitHook:tR("RAW","".concat(tm," config core.hooksPath ").concat(tA.GIT_HOOK)),testUnit:tR("CLI",ts,"".concat(to," --config ").concat(tA.UNIT_TEST_CONFIG)),testE2e:tR("CLI","".concat(ts," ").concat(ti),"".concat(to," --config ").concat(tA.E2E_TEST_CONFIG)),commitLint:tR("CLI",ta,"".concat(tc," --edit ").concat(tA.GIT_COMMIT_MSG," --config ").concat(tA.COMMITLINT_CONFIG)),lintStaged:tR("CLI",tu,"".concat(tl," --config ").concat(tA.LINT_STAGED_CONFIG)),stageBuildDirectory:tR("RAW","".concat(tm," add ").concat(e0)),build:tR("RAW","".concat(tv," run build")),pnpmInstallStandard:tR("RAW","".concat(tv," install")),pnpmInstallLegacy:tR("RAW","".concat(tv," install --legacy-peer-deps")),pnpmInstallForce:tR("RAW","".concat(tv," install --force"))};function tN(e){return q(E({plugins:[F()],test:{globals:!0,environment:"jsdom",pool:"vmThreads",include:["**/*.test.unit.?(c|m)[jt]s?(x)"],setupFiles:[tA.UNIT_TEST_SETUP_CONFIG]}},e))}function tw(e){try{return JSON.parse(e),!0}catch(e){return!1}}function tx(e){return!!e&&(typeof e==="undefined"?"undefined":R(e))=="object"&&!Array.isArray(e)}function tD(){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=b(o.value,2),c=a[0],u=a[1];var l=e[c];Array.isArray(u)?e[c]=Array.from(new Set(C(Array.isArray(l)?l:[]).concat(C(u)))):tx(u)?e[c]=tD(tx(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 tj from"globals";var tL=[{languageOptions:{globals:E({},tj.node,tj.browser)},rules:{"perfectionist/sort-imports":["error",{internalPattern:["^#.*","^@/.*"]}]},ignores:["build","dist"]}];var tM=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}return tD.apply(void 0,C(t))},tP=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}var n=tD.apply(void 0,[tL].concat(C(t))),s=n.ignores,i=O(n,["ignores"]),o=Array.isArray(s)&&s.every(function(e){return typeof e=="string"})?{ignores:s}:void 0,a=[i].concat(C(o?[o]:[]));return P.apply(void 0,[{stylistic:{semi:!0,indent:4,quotes:"single"},formatters:{css:!0,html:!0,markdown:"prettier"},yaml:!1,react:!0}].concat(C(a)))},tG=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}return U.apply(void 0,C(t))},tk=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}return tN.apply(void 0,C(t))},tU={eslint:tP,commitlint:tM,"lint-staged":tM,"vitest-react-e2e":tG,"vitest-react-unit":tk};function tF(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=tU[e];if(!s)throw new Error("Unknown config type: ".concat(e));return s.apply(void 0,C(r))}import{defineConfig as tq}from"@eddeee888/gcg-typescript-resolver-files";function tK(e){var t=e.uri,r=e.from,n=e.to,s=e.target,i=s===void 0?"client":s;var o=i==="client",a=i==="server";return S(E({schema:t,ignoreNoDocuments:!0,overwrite:!0},o&&{documents:[r]}),{generates:E({},o&&l({},n,{preset:"client",config:{useTypeImports:!0}}),a&&l({},n,tq()))})}var tH={"*":["eslint --fix"]};var tQ=(typeof window==="undefined"?"undefined":R(window))<"u";import tV from"node:process";import{hideBin as tY}from"yargs/helpers";import tJ from"yargs/yargs";var tB={name:"@cyberskill/shared",type:"module",version:"1.83.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-codegen":{types:"./dist/configs/graphql-codegen/index.d.ts",import:"./dist/configs/graphql-codegen/index.js",require:"./dist/configs/graphql-codegen/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"},"./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.12.0","@apollo/client":"3.13.7","@eddeee888/gcg-typescript-resolver-files":"0.12.0","@eslint-react/eslint-plugin":"1.47.4","@graphql-codegen/cli":"5.0.5","@graphql-codegen/client-preset":"4.8.0","@microsoft/api-extractor":"7.52.3","@next/eslint-plugin-next":"15.3.0","@swc/core":"1.11.21","@testing-library/jest-dom":"6.6.3","@testing-library/react":"16.3.0","@vitejs/plugin-react-swc":"3.9.0","@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.3.0","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:"25.0.0",jsdom:"26.1.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.6",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.2","@types/react-dom":"19.1.2","@types/unorm":"1.3.31","@types/uuid":"10.0.0","@types/yargs":"17.0.33",eslint:"9.24.0","lint-staged":"15.5.1","node-modules-inspector":"0.6.6","simple-git-hooks":"2.12.1"}};function tW(){return tz.apply(this,arguments)}function tz(){tz=i(function(){var e,t;return w(this,function(r){switch(r.label){case 0:if(!eo(tA.TS_CONFIG))return[3,3];t=["Performing TypeScript validation"];return[4,tT.typescriptCheck()];case 1:return[4,eQ.apply(void 0,t.concat([r.sent()]))];case 2:e=r.sent();return[3,4];case 3:e=er.warn("No TypeScript configuration found. Skipping type check.");r.label=4;case 4:e;return[2]}})});return tz.apply(this,arguments)}function t$(){return tX.apply(this,arguments)}function tX(){tX=i(function(){var e,t,r,n;var s=arguments;return w(this,function(i){switch(i.label){case 0:e=s.length>0&&s[0]!==void 0?s[0]:!1;if(!e)return[3,3];r=["Running ESLint with auto-fix"];return[4,tT.eslintFix()];case 1:return[4,eQ.apply(void 0,r.concat([i.sent()]))];case 2:t=i.sent();return[3,6];case 3:n=["Running ESLint check"];return[4,tT.eslintCheck()];case 4:return[4,eQ.apply(void 0,n.concat([i.sent()]))];case 5:t=i.sent();i.label=6;case 6:t;return[2]}})});return tX.apply(this,arguments)}function tZ(e,t){if(!t.length)return;var r=e==="Errors"?"red":"yellow";er.printBoxedLog(e==="Errors"?"✖ Errors":"⚠ Warnings",t,r)}function t0(){return t1.apply(this,arguments)}function t1(){t1=i(function(){var e,t,r;return w(this,function(n){switch(n.label){case 0:return[4,ex()];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?er.printBoxedLog("✔ NO ISSUES FOUND",[],"green"):(tZ("Warnings",r),tZ("Errors",t));return[2]}})});return t1.apply(this,arguments)}function t2(){return t4.apply(this,arguments)}function t4(){t4=i(function(){var e,t,r,n,s,i;return w(this,function(o){switch(o.label){case 0:return[4,ej()];case 1:o.sent();return[4,em(e$)];case 2:e=o.sent(),t=e.isCurrentProject;if(!t)return[3,9];o.label=3;case 3:o.trys.push([3,8,,9]);r=["Building package: ".concat(e$)];return[4,tT.build()];case 4:return[4,eQ.apply(void 0,r.concat([o.sent()]))];case 5:o.sent();n=["Staging build artifacts"];return[4,tT.stageBuildDirectory()];case 6:return[4,eQ.apply(void 0,n.concat([o.sent()]))];case 7:o.sent();return[3,9];case 8:s=o.sent();throw er.error("Error building and staging ".concat(e$,": ").concat(s.message)),s;case 9:i=["Executing lint-staged"];return[4,tT.lintStaged()];case 10:return[4,eQ.apply(void 0,i.concat([o.sent()]))];case 11:o.sent(),t0();return[2]}})});return t4.apply(this,arguments)}function t3(){return t5.apply(this,arguments)}function t5(){t5=i(function(){var e;return w(this,function(t){switch(t.label){case 0:e=["Inspecting ESLint configuration"];return[4,tT.eslintInspect()];case 1:return[4,eQ.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return t5.apply(this,arguments)}function t8(){return t6.apply(this,arguments)}function t6(){t6=i(function(){return w(this,function(e){switch(e.label){case 0:return[4,ej()];case 1:e.sent();return[4,Promise.all([tW(),t$()])];case 2:e.sent(),t0();return[2]}})});return t6.apply(this,arguments)}function t9(){return t7.apply(this,arguments)}function t7(){t7=i(function(){return w(this,function(e){switch(e.label){case 0:return[4,ej()];case 1:e.sent();return[4,Promise.all([tW(),t$(!0)])];case 2:e.sent(),t0();return[2]}})});return t7.apply(this,arguments)}function re(){return rt.apply(this,arguments)}function rt(){rt=i(function(){var e;return w(this,function(t){switch(t.label){case 0:return[4,ej()];case 1:t.sent();e=["Validating commit message"];return[4,tT.commitLint()];case 2:return[4,eQ.apply(void 0,e.concat([t.sent()]))];case 3:t.sent(),t0();return[2]}})});return rt.apply(this,arguments)}function rr(){return rn.apply(this,arguments)}function rn(){rn=i(function(){var e,t,r,n;return w(this,function(s){switch(s.label){case 0:e=["Configuring Git hooks"];return[4,tT.configureGitHook()];case 1:return[4,eQ.apply(void 0,e.concat([s.sent()]))];case 2:s.sent(),el(tA.GIT_HOOK);return[4,eK(tI)];case 3:t=s.sent();ec(tA.SIMPLE_GIT_HOOKS_JSON,t,{isJson:!0});r="\n".concat(e5,"\n");eo(tA.GIT_IGNORE)?ea(tA.GIT_IGNORE).split("\n").includes(e5)||eu(tA.GIT_IGNORE,r):ec(tA.GIT_IGNORE,r);n=["Setting up simple-git-hooks"];return[4,tT.simpleGitHooks()];case 4:return[4,eQ.apply(void 0,n.concat([s.sent()]))];case 5:s.sent();return[2]}})});return rn.apply(this,arguments)}function rs(){return ri.apply(this,arguments)}function ri(){ri=i(function(){return w(this,function(e){switch(e.label){case 0:return[4,eE([e$],{update:!0,postInstallActions:[rr]})];case 1:e.sent();return[2]}})});return ri.apply(this,arguments)}function ro(){return ra.apply(this,arguments)}function ra(){ra=i(function(){return w(this,function(e){switch(e.label){case 0:el(tA.NODE_MODULES,tA.PNPM_LOCK_YAML);return[4,eg()];case 1:e.sent();return[4,rr()];case 2:e.sent();return[2]}})});return ra.apply(this,arguments)}function rc(){return ru.apply(this,arguments)}function ru(){ru=i(function(){var e;return w(this,function(t){switch(t.label){case 0:e=["Inspecting project dependencies"];return[4,tT.nodeModulesInspect()];case 1:return[4,eQ.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return ru.apply(this,arguments)}function rl(){return rd.apply(this,arguments)}function rd(){rd=i(function(){var e;return w(this,function(t){switch(t.label){case 0:e=["Running unit tests"];return[4,tT.testUnit()];case 1:return[4,eQ.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return rd.apply(this,arguments)}function rf(){return rp.apply(this,arguments)}function rp(){rp=i(function(){var e;return w(this,function(t){switch(t.label){case 0:e=["Running end-to-end tests"];return[4,tT.testE2e()];case 1:return[4,eQ.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return rp.apply(this,arguments)}i(function(){var e;return w(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,tJ(tY(tV.argv)).scriptName(te).usage("$0 <command> [options]").command("lint","Check code for linting issues",t8).command("lint:fix","Fix linting issues automatically",t9).command("lint:inspect","View active ESLint configuration",t3).command("lint-staged","Run lint checks on staged files",t2).command("commitlint","Validate commit message format",re).command("setup","Initialize project setup and dependencies",rs).command("reset","Reset the project and reinstall dependencies",ro).command("inspect","Analyze installed project dependencies",rc).command("test:unit","Run unit test suite",rl).command("test:e2e","Run end-to-end test suite",rf).demandCommand(1,"Please specify a valid command.").strict().help().alias("h","help").alias("v","version").version(tB.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();er.error("Fatal: ".concat(e.message)),tV.exit(1);return[3,3];case 3:return[2]}})})();import{format as rm}from"date-fns";import{Document as rv}from"mongoose";import rg from"mongoose-aggregate-paginate-v2";import rh from"mongoose-paginate-v2";import{v4 as rE}from"uuid";import ry from"crypto-js";import rS from"slugify";var rO=rS.default||rS;function r_(){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=O(r,["lower","locale"]);return rO(e,E({lower:s,locale:o},a))}function rA(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:4;return ry.SHA256(e).toString(ry.enc.Hex).slice(0,t)}var rI={isEmpty:function e(e){return e==null?!0:Array.isArray(e)?e.length===0:(typeof e==="undefined"?"undefined":R(e))=="object"?p(e,Date)?!1:Object.keys(e).length===0:typeof e=="string"?e.trim().length===0:!1}};var rb={getDateTime:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:new Date;return rm(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"?rb.getDateTime():new Date;return{id:rE(),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:rE,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(rb.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=rb.createSchema({mongoose:t,schema:n,virtuals:u});return rb.applyPlugins(f,[i&&rh,a&&rg]),rb.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 S(E({},t,r&&{id:{$ne:r}}),{$or:[{slug:e},{slugHistory:e}]})},validator:{isEmpty:function e(){return /*#__PURE__*/function(){var e=i(function(e){return w(this,function(t){return[2,!rI.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 w(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 w(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)}}()}}},rC=/*#__PURE__*/function(){"use strict";function e(t,r){a(this,e);j(this,"collection");this.collection=t.collection(r)}u(e,[{key:"createOne",value:function e(e){var t=this;return i(function(){var r,n,s;return w(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);r=E({},rb.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 w(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);r=e.map(function(e){return E({},rb.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 w(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 w(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 w(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 w(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 w(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 w(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 w(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}(),rR=/*#__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 w(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:Z.NOT_FOUND.CODE}];case 2:a=c.sent();return[2,{success:!1,message:a.message,code:Z.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 w(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:Z.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 w(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:Z.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 w(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:Z.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 w(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:Z.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"createOne",value:function e(e){var t=this;return i(function(){var r,n;return w(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:Z.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 w(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,rv)?e.toObject():null}).filter(function(e){return e!==null}),n)];case 2:s=i.sent();return[2,{success:!1,message:s.message,code:Z.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 w(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);return[4,n.model.findOneAndUpdate(e,t,E({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:Z.NOT_FOUND.CODE}];case 2:i=o.sent();return[2,{success:!1,message:i.message,code:Z.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 w(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:Z.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 w(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:Z.NOT_FOUND.CODE}];case 2:s=i.sent();return[2,{success:!1,message:s.message,code:Z.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 w(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:Z.NOT_FOUND.CODE}:{success:!0,result:n}];case 2:s=i.sent();return[2,{success:!1,message:s.message,code:Z.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 w(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=rA(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:Z.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,m,v;return w(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 w(this,function(a){switch(a.label){case 0:return[4,n.model.findOne(rb.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(rb.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":R(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=r_(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=r_(s);m={success:!0};return[4,o(p)];case 6:return[2,(m.result=g.sent(),m)];case 7:return[3,9];case 8:v=g.sent();return[2,{success:!1,message:"Failed to create a unique slug: ".concat(v.message),code:Z.INTERNAL_SERVER_ERROR.CODE}];case 9:return[2]}})})()}},{key:"aggregate",value:function e(e){var t=this;return i(function(){var r,n;return w(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:Z.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}}]);return e}();import{Collection as rT,Db as rN}from"mongodb";import{Document as rw,Model as rx}from"mongoose";var rD=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(rN),rj=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(rw),rL=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(rx),rM=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(rT);import{ApolloClient as rP,ApolloError as rG,ApolloLink as rk,ApolloProvider as rU,from as rF,HttpLink as rq,InMemoryCache as rK,split as rH}from"@apollo/client";import{onError as rQ}from"@apollo/client/link/error";import{removeTypenameFromVariables as rV}from"@apollo/client/link/remove-typename";import{GraphQLWsLink as rY}from"@apollo/client/link/subscriptions";import{getMainDefinition as rJ}from"@apollo/client/utilities";import{createClient as rB}from"graphql-ws";import{useMemo as rW}from"react";import{FaInfo as rz}from"react-icons/fa6";import{use as r$}from"react";import{FaRepeat as rX}from"react-icons/fa6";import{createContext as rZ}from"react";var r0=rZ(void 0);import r1 from"./react/apollo-error/apollo-error.module.scss";import{jsx as r2,jsxs as r4}from"react/jsx-runtime";function r3(){var e=r$(r0),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)?r4("div",{children:[r4("strong",{children:[e,":"]}),r2("ul",{children:t.map(function(e){return r2("li",{children:e.message},e.message)})})]}):null};return r2("div",{className:r1["modal-backdrop"],children:r4("div",{className:r1["modal-content"],children:[r2("button",{type:"button",className:r1["btn-close"],onClick:e.hideError,children:"✕"}),r4("div",{className:r1["error-title"],children:[r2("button",{type:"button",className:r1["btn-retry"],onClick:function(){return window.location.reload()},children:r2(rX,{})})," ",t.message]}),r4("div",{className:r1["error-details"],children:[t.networkError&&r4("pre",{className:"network",children:[r2("strong",{children:"Network Error:"})," ",t.networkError.message]}),r("GraphQL Errors",C(t.graphQLErrors)),r("Protocol Errors",C(t.protocolErrors)),r("Client Errors",C(t.clientErrors)),t.extraInfo&&r4("pre",{className:"extra",children:[r2("strong",{children:"Extra Info:"})," ",JSON.stringify(t.extraInfo,null,4)]})]})]})})}import{use as r5}from"react";function r8(){var e=r5(r0);if(!e)throw new Error("useApolloError must be used within ApolloErrorProvider");return e}import{useEffect as r6,useMemo as r9,useState as r7}from"react";var ne=null;function nt(e){ne=e}function nr(e){ne===null||ne===void 0?void 0:ne(e)}import{jsx as nn}from"react/jsx-runtime";function ns(e){var t=e.children;var r=b(r7(null),2),n=r[0],s=r[1];r6(function(){nt(s)},[]);var i=r9(function(){return{error:n,showError:s,hideError:function(){return s(null)}}},[n]);return nn(r0,{value:i,children:t})}import{consola as ni}from"consola/browser";var no={silent:ni.silent,level:ni.level,fatal:ni.fatal,error:ni.error,warn:ni.warn,log:ni.log,info:ni.info,success:ni.success,ready:ni.ready,start:ni.start,box:ni.box,debug:ni.debug,trace:ni.trace,verbose:ni.verbose};import{toast as na,Toaster as nc}from"react-hot-toast";var nu="/graphql";import{Fragment as nl,jsx as nd,jsxs as nf}from"react/jsx-runtime";var np=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);var e;e=o(this,t,arguments);j(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 no.info("[Apollo] #".concat(r.count,": ").concat(i," (").concat(s,"ms)")),t})}}]);return t}(rk);function nm(e){var t=e.uri,r=e.wsUrl,n=e.customLinks,s=new np,i=rQ(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;no.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;no.error("[Protocol error]: ".concat(t,", Extensions: ").concat(JSON.stringify(r)))}),r&&no.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 rG({graphQLErrors:t||[],protocolErrors:n||[],clientErrors:[],networkError:r||null,errorMessage:c,extraInfo:{operation:s}});na.error(function(e){return nf(nl,{children:[c,"\xa0",nd(rz,{cursor:"pointer",onClick:function(){setTimeout(function(){nr(u)},0),na.dismiss(e.id)}})]})})}}),o=rV();t||no.warn('[Apollo] No GraphQL URI provided — using "'.concat(nu,'" as default'));var a=new rq({uri:t!==null&&t!==void 0?t:nu,credentials:"include"}),c=r?new rY(rB({url:r})):rk.empty(),u=p(c,rk)?rH(function(e){var t=e.query;var r=rJ(t);return r.kind==="OperationDefinition"&&r.operation==="subscription"},c,a):a;return u===a&&r&&no.warn("[Apollo] WS URL is set, but subscriptions fallback to HTTP. Check your wsLink config."),[s,i,o].concat(C(n!==null&&n!==void 0?n:[]),[u])}function nv(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=O(a,["uri","wsUrl","customLinks"]),f=s!==null&&s!==void 0?s:rP;if(typeof f!="function")throw new TypeError("Invalid ApolloClient provided. Ensure CustomClient is a class.");var m=i||rU,v=rW(function(){return rF(nm({uri:c!==null&&c!==void 0?c:nu,wsUrl:u!==null&&u!==void 0?u:"",customLinks:l!==null&&l!==void 0?l:[]}))},[c,u,l]),g=rW(function(){return p(o,rK)?o:new rK},[o]),h=rW(function(){return new f(E({link:v,cache:g},d))},[f,v,g,d]);return nf(nl,{children:[nf(ns,{children:[t?nd(m,{makeClient:function(){return h},children:n}):nd(m,{client:h,children:n}),nd(r3,{})]}),nd(nc,{position:"top-right"})]})}import{useTranslation as ng}from"react-i18next";var nh=ng;import nE from"i18next";import{initReactI18next as ny}from"react-i18next";function nS(e){return nE.use(ny).init(e)}import nO from"classnames";import n_ from"./react/loading/loading.module.scss";import{jsx as nA,jsxs as nI}from"react/jsx-runtime";function nb(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=O(e,["full","block","className","message"]);function l(){return nI("div",S(E({className:n_.container},u),{children:[nA("div",{className:n_.ring}),nA("div",{className:n_.ring}),nA("div",{className:n_.ring}),nA("div",{className:n_.ring}),c&&nA("div",{className:n_.message,children:c})]}))}return r?nA("div",{className:nO(n_.fullscreen,o),children:l()}):s?nA("div",{className:nO(n_.block,o),children:l()}):l()}import{createContext as nC}from"react";var nR=nC(void 0);import{use as nT}from"react";function nN(){var e=nT(nR);if(!e)throw new Error("useLoading must be used within a LoadingProvider");return e}import{useCallback as nw,useMemo as nx,useState as nD}from"react";import{jsx as nj}from"react/jsx-runtime";function nL(e){var t=e.children;var r=b(nD(!1),2),n=r[0],s=r[1],i=b(nD(!1),2),o=i[0],a=i[1],c=nw(function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;s(!0),a(e)},[]),u=nw(function(){s(!1),a(!1)},[]),l=nx(function(){return{isLoading:n,isGlobalLoading:o,showLoading:c,hideLoading:u}},[n,o,c,u]);return nj(nR,{value:l,children:n?nj(nb,{full:o}):t})}import{enUS as nM}from"date-fns/locale";var nP={label:"English",value:"en",flag:"\uD83C\uDDFA\uD83C\uDDF8",adapterLocale:nM,icon:"flagpack:gb-nir",numberFormat:{code:"en-US",currency:"USD"},timezone:"America/New_York"};import{createContext as nG}from"react";var nk=nG(void 0);import{NextIntlClientProvider as nU}from"next-intl";import{useTranslations as nF}from"next-intl";import{use as nq}from"react";function nK(){var e=nq(nk);if(!e)throw new Error("useNextIntl must be used within a NextIntlProvider");return e}var nH=nF;import{jsx as nQ}from"react/jsx-runtime";function nV(e){var t=function(t){var r;var n;var s=nK(),i=s.currentLanguage,o=t.messages,a=t.languages,c="en",u=o[(i===null||i===void 0?void 0:i.value)||c],l=(n=(r=a.find(function(e){return e.value===(i===null||i===void 0?void 0:i.value)}))===null||r===void 0?void 0:r.timezone)!==null&&n!==void 0?n:nP.timezone;return o?nQ(nU,{locale:(i===null||i===void 0?void 0:i.value)||c,messages:u||null,timeZone:l,children:nQ(e,E({},t))}):(no.warn("Missing messages for language: ".concat((i===null||i===void 0?void 0:i.value)||c)),null)};return t.displayName="withNextIntl(".concat(e.displayName||e.name||"Component",")"),t}import{useMemo as nY}from"react";import{useCallback as nJ,useEffect as nB,useState as nW}from"react";var nz={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 n$ from"localforage";var nX={get:function e(e){return i(function(){var t;return w(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,n$.getItem(e)];case 1:return[2,r.sent()];case 2:t=r.sent();return[2,(no.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 w(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,n$.setItem(e,t)];case 1:n.sent();return[3,3];case 2:r=n.sent();no.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 w(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,n$.removeItem(e)];case 1:r.sent();return[3,3];case 2:t=r.sent();no.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 w(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,n$.keys()];case 1:return[2,(e=r.sent())!==null&&e!==void 0?e:[]];case 2:t=r.sent();return[2,(no.error("[Storage:keys] Error getting keys:",t),[])];case 3:return[2]}})})()}};function nZ(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:nz;var n=b(nW(t),2),s=n[0],o=n[1],a=b(nW(!1),2),c=a[0],u=a[1];nB(function(){var n=!0;return i(function(){var s,i,a,c;return w(this,function(l){switch(l.label){case 0:l.trys.push([0,6,7,8]);return[4,nX.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,nX.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();no.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]),nB(function(){if(!c)return;i(function(){var t,n;return w(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,nX.set(e,t)];case 1:i.sent();i.label=2;case 2:return[3,4];case 3:n=i.sent();no.error('Error saving value for key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},[s,e,r,c]);var l=nJ(function(e){o(function(t){return typeof e=="function"?e(t):e})},[]),d=nJ(/*#__PURE__*/i(function(){var t;return w(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,nX.remove(e)];case 1:r.sent(),o(void 0);return[3,3];case 2:t=r.sent();no.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 n0,jsx as n1}from"react/jsx-runtime";function n2(e){var t=e.children;return n1(n0,{children:t})}var n4=nV(n2);function n3(e){var t=e.children,r=e.languages,n=e.messages;var s=nZ("lang",r[0]),i=s.value,o=s.set,a=nY(function(){return{languages:r,currentLanguage:i!==null&&i!==void 0?i:nP,setCurrentLanguage:o}},[r,o,i]);return n1(nk,{value:a,children:n1(n4,{languages:r,messages:n,children:t})})}import n5 from"unorm";var n8={a:["\xe0","\xe1","ạ","ả","\xe3","\xe2","ầ","ấ","ậ","ẩ","ẫ","ă","ằ","ắ","ặ","ẳ","ẵ"],e:["\xe8","\xe9","ẹ","ẻ","ẽ","\xea","ề","ế","ệ","ể","ễ"],i:["\xec","\xed","ị","ỉ","ĩ"],o:["\xf2","\xf3","ọ","ỏ","\xf5","\xf4","ồ","ố","ộ","ổ","ỗ","ơ","ờ","ớ","ợ","ở","ỡ"],u:["\xf9","\xfa","ụ","ủ","ũ","ư","ừ","ứ","ự","ử","ữ"],y:["ỳ","\xfd","ỵ","ỷ","ỹ"],d:["đ"]},n6=Object.entries(n8).reduce(function(e,t){var r=b(t,2),n=r[0],s=r[1];return e[n.toUpperCase()]=s.map(function(e){return e.toUpperCase()}),e},{});function n9(e){e=n5.nfkc(e);var t=E({},n8,n6);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=b(o.value,2),c=a[0],u=a[1];var l="[".concat(c).concat(u.join(""),"]"),d="(".concat([c].concat(C(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 n7(e){return e.normalize("NFD").replace(RegExp("\\p{Diacritic}","gu"),"")}export{r3 as ApolloError,r0 as ApolloErrorContext,ns as ApolloErrorProvider,nv as ApolloProvider,e0 as BUILD_DIRECTORY,en as CHECK_PACKAGE_EMPTY_RESULT,tc as COMMIT_LINT_CLI,ta as COMMIT_LINT_PACKAGE_NAME,te as CYBERSKILL_CLI,tt as CYBERSKILL_CLI_PATH,e7 as CYBERSKILL_DIRECTORY,e$ as CYBERSKILL_PACKAGE_NAME,eX as CYBERSKILL_STORAGE,rM as C_Collection,rD as C_Db,rj as C_Document,rL as C_Model,B as DEBUG,tn as ESLINT_CLI,tS as ESLINT_INSPECT_CLI,ty as ESLINT_INSPECT_PACKAGE_NAME,tr as ESLINT_PACKAGE_NAME,H as E_CommandType,M as E_ConfigType,W as E_IssueType,tm as GIT_CLI,e9 as GIT_COMMIT_EDITMSG,e6 as GIT_HOOK,e3 as GIT_IGNORE,nu as GRAPHQL_URI_DEFAULT,tI as HOOK,tQ as IS_BROWSER,tl as LINT_STAGED_CLI,tu as LINT_STAGED_PACKAGE_NAME,nb as Loading,nR as LoadingContext,nL as LoadingProvider,rC as MongoController,rR as MongooseController,nP as NEXT_INTL_DEFAULT_LANGUAGE,eZ as NODE_MODULES,t_ as NODE_MODULES_INSPECT_CLI,tO as NODE_MODULES_INSPECT_PACKAGE_NAME,nk as NextIntlContext,n3 as NextIntlProvider,e1 as PACKAGE_JSON,e2 as PACKAGE_LOCK_JSON,tA as PATH,ti as PLAYWRIGHT_PACKAGE_NAME,tv as PNPM_CLI,tg as PNPM_EXEC_CLI,e8 as PNPM_LOCK_YAML,Z as RESPONSE_STATUS,th as SIMPLE_GIT_HOOKS_PACKAGE_NAME,tE as SIMPLE_GIT_HOOK_CLI,e5 as SIMPLE_GIT_HOOK_JSON,e4 as TSCONFIG_JSON,tf as TSC_CLI,td as TSC_PACKAGE_NAME,tp as TSX_CLI,nc as Toaster,to as VITEST_CLI,ts as VITEST_PACKAGE_NAME,ez as WORKING_DIRECTORY,rg as aggregatePaginate,eu as appendFileSync,em as checkPackage,ej as clearAllErrorLists,tT as command,L as commitlintConfig,tK as createGraphqlCodegenConfig,tD as deepMerge,tL as eslintConfig,eo as existsSync,eq as formatCommand,rA as generateShortId,r_ as generateSlug,ef as getLatestPackageVersion,ed as getPackage,ex as getStoredErrorLists,nS as initI18next,eg as installDependencies,tw as isJson,tx as isPlainObject,eW as join,tH as lintStagedConfig,no as log,er as logNodeJS,tF as mergeConfigs,rb as mongo,rh as mongoosePaginate,eU as rawCommand,ea as readFileSync,n9 as regexSearchMapper,n7 as removeAccent,eB as resolve,eK as resolveCommands,eJ as resolveWorkingPath,el as rmSync,eQ as runCommand,nz as serializer,nt as setGlobalApolloErrorCallback,eE as setupPackages,nr as showGlobalApolloError,nX as storage,eC as storageNodeJS,ee as throwError,na as toast,r8 as useApolloError,nN as useLoading,nK as useNextIntl,nZ as useStorage,nh as useTranslateI18next,nH as useTranslateNextIntl,rI as validate,U as vitestE2E,tN as vitestUnit,nV as withNextIntl,ec 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,N()?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)I(e,t)}function p(e,t){if(t!=null&&typeof Symbol!=="undefined"&&t[Symbol.hasInstance]){return!!t[Symbol.hasInstance](e)}else{return e instanceof t}}function m(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function v(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 h(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function E(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 S(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 O(e,t){if(e==null)return{};var r=_(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 _(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&&(R(t)==="object"||typeof t==="function")){return t}return n(e)}function I(e,t){I=Object.setPrototypeOf||function e(e,t){e.__proto__=t;return e};return I(e,t)}function b(e,r){return t(e)||v(e,r)||T(e,r)||g()}function C(e){return r(e)||m(e)||T(e)||h()}function R(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function T(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 N(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(N=function(){return!!e})()}function w(e,t){var r,n,s,i={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},o=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return o.next=a(0),o["throw"]=a(1),o["return"]=a(2),typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(e){return function(t){return c([e,t])}}function c(a){if(r)throw new TypeError("Generator is already executing.");while(o&&(o=0,a[0]&&(i=0)),i)try{if(r=1,n&&(s=a[0]&2?n["return"]:a[0]?n["throw"]||((s=n["return"])&&s.call(n),0):n.next)&&!(s=s.call(n,a[1])).done)return s;if(n=0,s)a=[a[0]&2,s.value];switch(a[0]){case 0:case 1:s=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;n=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(s=i.trys,s=s.length>0&&s[s.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!s||a[1]>s[0]&&a[1]<s[3])){i.label=a[1];break}if(a[0]===6&&i.label<s[1]){i.label=s[1];s=a;break}if(s&&i.label<s[2]){i.label=s[2];i.ops.push(a);break}if(s[2])i.ops.pop();i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e];n=0}finally{r=s=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}}var x=Object.defineProperty;var D=function(e,t,r){return t in e?x(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r};var j=function(e,t,r){return D(e,(typeof t==="undefined"?"undefined":R(t))!="symbol"?t+"":t,r)};var L={extends:["@commitlint/config-conventional"]};var M=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}(M||{});import P from"@antfu/eslint-config";import G from"@vitejs/plugin-react-swc";import{defineConfig as k}from"vitest/config";function U(e){return k(E({plugins:[G()],test:{include:["**/*.test.e2e.?(c|m)[jt]s?(x)"],browser:{enabled:!0,provider:"playwright",instances:[{browser:"chromium"},{browser:"firefox"},{browser:"webkit"}]}}},e))}import F from"@vitejs/plugin-react-swc";import{defineConfig as q}from"vitest/config";import K from"node:process";var H=function(e){return e.CLI="CLI",e.RAW="RAW",e}(H||{});import{exec as Q}from"node:child_process";import V from"node:process";import*as Y from"node:util";import J from"node:process";var B=J.env.DEBUG==="true";var W=function(e){return e.Error="error",e.Warning="warning",e}(W||{});import z from"chalk";import $ from"consola";import{GraphQLError as X}from"graphql";var Z={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 ee(e){var t=e.message,r=e.status,n=r===void 0?Z.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 X(a,{extensions:{code:n.CODE}}):new Error(a)}B||($.level=4);function et(e){var t=z[e];return typeof t=="function"?t:z.green}var er={silent:$.silent,level:$.level,fatal:$.fatal,error:$.error,warn:$.warn,log:$.log,info:$.info,success:$.success,ready:$.ready,start:$.start,box:$.box,debug:$.debug,trace:$.trace,verbose:$.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)){$.box(z.green(e));return}t.forEach(function(e){var t=e.file,n=e.position,s=e.rule,i=e.message;$.log("".concat(z.gray("File:")," ").concat(z.blue("".concat(t).concat(n?":".concat(n):"")))),s&&$.log(" ".concat(et(r)("Rule:")," ").concat(s)),$.log(" ".concat(et(r)("Message:")," ").concat(i))}),$.box(et(r)("".concat(e," : ").concat(t.length))),$.log(z.gray("─".repeat(40)))}};var en={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};import es from"node-fetch";import*as ei from"node:fs";function eo(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}return t.every(function(e){return ei.existsSync(e)})}function ea(e,t){var r=ei.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":R(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 ec(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":R(t))=="object"?JSON.stringify(t,null,4):String(t);ei.writeFileSync(e,i,"utf-8")}function eu(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":R(t))=="object"?JSON.stringify(t,null,4):String(t);ei.appendFileSync(e,i,"utf-8")}function el(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}t.forEach(function(e){eo(e)&&ei.rmSync(e,{recursive:!0,force:!0})})}function ed(e){var t=eW(ez,e1);if(!eo(t))return!1;try{var r=ea(t,{asJson:!0}),n=r.name,s=r.dependencies,i=s===void 0?{}:s,o=r.devDependencies,a=o===void 0?{}:o,c=n===e,u=e in i,l=e in a;return c||u||l?{path:t,file:r,isCurrentProject:c,isDepend:u,isDevDepend:l}:!1}catch(e){return er.warn("Failed to read package.json: ".concat(e.message)),!1}}function ef(e){return ep.apply(this,arguments)}function ep(){ep=i(function(e){var t,r,n,s;return w(this,function(i){switch(i.label){case 0:i.trys.push([0,3,,4]);return[4,es("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 er.error('Failed to fetch version for "'.concat(e,'": ').concat(s.message)),s;case 4:return[2]}})});return ep.apply(this,arguments)}function em(e,t){return ev.apply(this,arguments)}function ev(){ev=i(function(e,t){var r,n,s,i,o,a,c,u,l,d,f,p,m,v,g,h,y,S,O,_,A;return w(this,function(I){switch(I.label){case 0:I.trys.push([0,4,,5]);r=ed(e);if(!r)return[2,E({},en)];c=r.path,u=r.file,l=r.isCurrentProject,d=r.isDepend,f=r.isDevDepend,p=(n=u.dependencies)!==null&&n!==void 0?n:{},m=(s=u.devDependencies)!==null&&s!==void 0?s:{},v=l?(i=u.version)!==null&&i!==void 0?i:"0.0.0":d?(o=p[e])!==null&&o!==void 0?o:"0.0.0":f?(a=m[e])!==null&&a!==void 0?a:"0.0.0":"0.0.0";if(!l)return[3,1];y=v;return[3,3];case 1:return[4,ef(e)];case 2:y=I.sent();I.label=3;case 3:g=y,h=l||v===g;if(!h&&(t===null||t===void 0?void 0:t.update)){;O=d?"dependencies":f?"devDependencies":null;O&&((S=u[O])===null||S===void 0?void 0:S[e])!==g&&(u[O]=(_=u[O])!==null&&_!==void 0?_:{},u[O][e]=g,ec(c,u,{isJson:!0}),er.info('Updated "'.concat(e,'" to version ').concat(g)))}return[2,{isCurrentProject:l,installedPath:c,file:u,isUpToDate:h}];case 4:A=I.sent();return[2,(er.error('Error checking package "'.concat(e,'": ').concat(A.message)),E({},en))];case 5:return[2]}})});return ev.apply(this,arguments)}function eg(){return eh.apply(this,arguments)}function eh(){eh=i(function(){var e,t,r,n,s,i,o,a,c,u,l,d;return w(this,function(f){switch(f.label){case 0:e=[{command:function(){return tT.pnpmInstallStandard()},message:"Installing dependencies (standard)"},{command:function(){return tT.pnpmInstallLegacy()},message:"Retrying with legacy peer dependencies"},{command:function(){return tT.pnpmInstallForce()},message:"Retrying with force install"}];t=true,r=false,n=undefined;f.label=1;case 1:f.trys.push([1,9,10,11]);s=e[Symbol.iterator]();f.label=2;case 2:if(!!(t=(i=s.next()).done))return[3,8];o=i.value,a=o.command,c=o.message;f.label=3;case 3:f.trys.push([3,6,,7]);return[4,a()];case 4:u=f.sent();return[4,eQ("".concat(c," using: ").concat(u),u)];case 5:f.sent();return[2];case 6:l=f.sent();er.warn("Installation attempt failed: ".concat(c)),er.error("Details: ".concat(l.message));return[3,7];case 7:t=true;return[3,2];case 8:return[3,11];case 9:d=f.sent();r=true;n=d;return[3,11];case 10:try{if(!t&&s.return!=null){s.return()}}finally{if(r){throw n}}return[7];case 11:throw new Error("All dependency installation strategies failed.")}})});return eh.apply(this,arguments)}function eE(e,t){return ey.apply(this,arguments)}function ey(){ey=i(function(e,t){var r,n,s,i,o,a,c,u,l,d,f;return w(this,function(p){switch(p.label){case 0:if(!eo(tA.PACKAGE_JSON)){er.error("package.json not found. Aborting setup.");return[2]}p.label=1;case 1:p.trys.push([1,13,,14]);r=C(new Set(e)).sort();return[4,Promise.all(r.map(function(e){return em(e,E({},(t===null||t===void 0?void 0:t.update)&&{update:t.update}))}))];case 2:n=p.sent().every(function(e){return e.isUpToDate});if(n)return[3,4];return[4,eg()];case 3:n=p.sent();p.label=4;case 4:n;i=true,o=false,a=undefined;p.label=5;case 5:p.trys.push([5,10,11,12]);c=((s=t===null||t===void 0?void 0:t.postInstallActions)!==null&&s!==void 0?s:[])[Symbol.iterator]();p.label=6;case 6:if(!!(i=(u=c.next()).done))return[3,9];l=u.value;return[4,l()];case 7:p.sent();p.label=8;case 8:i=true;return[3,6];case 9:return[3,12];case 10:d=p.sent();o=true;a=d;return[3,12];case 11:try{if(!i&&c.return!=null){c.return()}}finally{if(o){throw a}}return[7];case 12:return[3,14];case 13:f=p.sent();throw er.error('Failed to setup "'.concat(e.join(", "),'": ').concat(f.message)),f;case 14:return[2]}})});return ey.apply(this,arguments)}import eS from"node-persist";import eO from"node:os";import e_ from"node:process";function eA(){return e_.env.CYBERSKILL_STORAGE_DIR||eW(eO.homedir(),eX)}function eI(){return eb.apply(this,arguments)}function eb(){eb=i(function(){var e;return w(this,function(t){switch(t.label){case 0:e=eS.defaultInstance;if(e)return[3,2];return[4,eS.init({dir:eA(),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 eb.apply(this,arguments)}var eC={get:function e(e){return i(function(){var t,r;return w(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,eI()];case 1:n.sent();return[4,eS.getItem(e)];case 2:return[2,(t=n.sent())!==null&&t!==void 0?t:null];case 3:r=n.sent();return[2,(er.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 w(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,eI()];case 1:n.sent();return[4,eS.setItem(e,t)];case 2:n.sent();return[3,4];case 3:r=n.sent();er.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 w(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,eI()];case 1:r.sent();return[4,eS.removeItem(e)];case 2:r.sent();return[3,4];case 3:t=r.sent();er.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 w(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,eI()];case 1:r.sent();return[4,eS.keys()];case 2:e=r.sent();return[2,Array.isArray(e)?e:(er.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=r.sent();return[2,(er.error("[Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return i(function(){return w(this,function(t){try{return[2,"".concat(eA()," (key: ").concat(e,")")]}catch(e){return[2,(er.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var eR=Y.promisify(Q);function eT(e){return"error_list:".concat(e)}function eN(e){return ew.apply(this,arguments)}function ew(){ew=i(function(e){var t,r,n;return w(this,function(s){switch(s.label){case 0:if(e.length===0)return[2];t=Date.now(),r=eT(t);s.label=1;case 1:s.trys.push([1,3,,4]);return[4,eC.set(r,{errors:e,timestamp:t})];case 2:s.sent(),setTimeout(/*#__PURE__*/i(function(){var e;return w(this,function(t){switch(t.label){case 0:return[4,eC.getLogLink(r)];case 1:e=t.sent();e&&er.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})}),10);return[3,4];case 3:n=s.sent();er.error("Failed to save errors: ".concat(n.message));return[3,4];case 4:return[2]}})});return ew.apply(this,arguments)}function ex(){return eD.apply(this,arguments)}function eD(){eD=i(function(){var e,t,r;return w(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,eC.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 w(this,function(r){switch(r.label){case 0:return[4,eC.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,(er.error("Failed to retrieve stored errors: ".concat(r.message)),[])];case 4:return[2]}})});return eD.apply(this,arguments)}function ej(){return eL.apply(this,arguments)}function eL(){eL=i(function(){var e,t,r;return w(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,eC.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 eC.remove(e)}))];case 2:n.sent();return[3,4];case 3:r=n.sent();er.error("Failed to clear error lists: ".concat(r.message));return[3,4];case 4:return[2]}})});return eL.apply(this,arguments)}function eM(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,c,u,l,d;var f=s.exec(e)||[],p=i.exec(e)||[],m=o.exec(e)||[];var v,g,h,E,y,S;f.length&&n?t.push({file:n,position:"".concat(f[1],":").concat(f[2]),type:f[3]==="error"?"error":"warning",message:(v=f===null||f===void 0?void 0:(a=f[4])===null||a===void 0?void 0:a.trim())!==null&&v!==void 0?v:"",rule:(g=f===null||f===void 0?void 0:(c=f[5])===null||c===void 0?void 0:c.trim())!==null&&g!==void 0?g:""}):p.length?t.push({file:(h=p===null||p===void 0?void 0:p[1])!==null&&h!==void 0?h:"",position:"".concat(p[2],":").concat(p[3]),type:p[4]==="error"?"error":"warning",message:(E=p===null||p===void 0?void 0:(u=p[5])===null||u===void 0?void 0:u.trim())!==null&&E!==void 0?E:""}):m.length?t.push({file:"commitlint",type:"error",message:(y=m===null||m===void 0?void 0:(l=m[1])===null||l===void 0?void 0:l.trim())!==null&&y!==void 0?y:"",rule:(S=m===null||m===void 0?void 0:(d=m[2])===null||d===void 0?void 0:d.trim())!==null&&S!==void 0?S:""}):r.push(e.trim())}}),t.length&&eN(t),B&&r.length&&(er.warn("Unmatched lines:"),r.forEach(function(e){return er.info(" ".concat(e))}))}function eP(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&&eN(r)}catch(t){eM(e)}}function eG(e){return ek.apply(this,arguments)}function ek(){ek=i(function(e){var t,r,n,s,i,o,a,c,u;var l=arguments;return w(this,function(d){switch(d.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:eP;r=new AbortController;V.on("SIGINT",function(){er.warn("Process interrupted. Terminating..."),r.abort(),V.exit()});d.label=1;case 1:d.trys.push([1,3,,4]);return[4,eR(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&&er.error("Command failed: ".concat(u));return[3,4];case 4:return[2]}})});return ek.apply(this,arguments)}function eU(e){return{raw:!0,cmd:e}}function eF(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(tg," ").concat(e$," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(tg," ").concat(tp," ").concat(tt," ").concat(e):"".concat(tg," ").concat(te," ").concat(e)}function eq(e,t){return typeof e=="function"?eF(e(t),t):(typeof e==="undefined"?"undefined":R(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?eF(e,t):e}function eK(e){return eH.apply(this,arguments)}function eH(){eH=i(function(e){var t,r,n,s,i,o,a;var c=arguments;return w(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,em(e$)];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=b(e,2),r=t[0],n=t[1];return[r,eq(n,i)]}))]}})});return eH.apply(this,arguments)}function eQ(e,t){return eV.apply(this,arguments)}function eV(){eV=i(function(e,t){var r;return w(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);er.start("".concat(e)),B&&er.info("→ ".concat(t));return[4,eG(t)];case 1:n.sent(),er.success("".concat(e," done."));return[3,3];case 2:r=n.sent();throw er.error("".concat(e," failed: ").concat(r.message)),r;case 3:return[2]}})});return eV.apply(this,arguments)}import*as eY from"node:path";function eJ(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}var n;return(n=eY).resolve.apply(n,[ez].concat(C(t)))}function eB(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}var n;return(n=eY).resolve.apply(n,C(t))}function eW(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}var n;return(n=eY).join.apply(n,C(t))}var ez=K.env.INIT_CWD||K.cwd(),e$="@cyberskill/shared",eX=".cyberskill-storage",eZ="node_modules",e0="dist",e1="package.json",e2="package-lock.json",e4="tsconfig.json",e3=".gitignore",e5=".simple-git-hooks.json",e8="pnpm-lock.yaml",e6=".git/hooks/",e9=".git/COMMIT_EDITMSG",e7=eW(ez,eZ,e$,e0),te="cyberskill",tt="src/nodejs/cli/index.ts",tr="eslint",tn="eslint",ts="vitest",ti="playwright",to="vitest",ta="@commitlint/cli",tc="commitlint",tu="lint-staged",tl="lint-staged",td="typescript",tf="tsc",tp="tsx",tm="git",tv="pnpm",tg="pnpm exec",th="simple-git-hooks",tE="simple-git-hooks",ty="@eslint/config-inspector",tS="eslint-config-inspector",tO="node-modules-inspector",t_="node-modules-inspector",tA={CYBERSKILL_DIRECTORY:e7,WORKING_DIRECTORY:ez,TS_CONFIG:eJ(e4),GIT_IGNORE:eJ(e3),GIT_HOOK:eJ(e6),GIT_COMMIT_MSG:eJ(e9),SIMPLE_GIT_HOOKS_JSON:eJ(e5),PACKAGE_JSON:eJ(e1),PACKAGE_LOCK_JSON:eJ(e2),PNPM_LOCK_YAML:eJ(e8),NODE_MODULES:eJ(eZ),LINT_STAGED_CONFIG:eJ("".concat(e7,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:eJ("".concat(e7,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:eJ("".concat(e7,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:eJ("".concat(e7,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:eJ("".concat(e7,"/react/vitest/vitest.e2e.js"))};function tI(e){var t=e.isCurrentProject;return E({"pre-commit":tl,"commit-msg":tc},t&&{"pre-push":eU("".concat(tm," pull"))})}function tb(e){return tC.apply(this,arguments)}function tC(){tC=i(function(e){var t,r,n,s,i,o;var a=arguments;return w(this,function(c){switch(c.label){case 0:for(t=a.length,r=new Array(t>1?t-1:0),n=1;n<t;n++){r[n-1]=a[n]}s=b(r,2),i=s[0],o=s[1];if(!i)throw new Error("'first' argument is undefined");switch(e){case"CLI":return[3,1];case"RAW":return[3,3]}return[3,4];case 1:return[4,eE(i.split(" "),{update:!0})];case 2:return[2,(c.sent(),eq(eU("".concat(tg," ").concat(o))))];case 3:return[2,eq(eU(i))];case 4:throw new Error("Unsupported command type");case 5:return[2]}})});return tC.apply(this,arguments)}function tR(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++){r[n-1]=arguments[n]}return /*#__PURE__*/i(function(){return w(this,function(t){return[2,tb.apply(void 0,[e].concat(C(r)))]})})}var tT={simpleGitHooks:tR("CLI",th,tE),eslintInspect:tR("CLI",ty,tS),nodeModulesInspect:tR("CLI",tO,t_),eslintCheck:tR("CLI",tr,"".concat(tn," ").concat(tA.WORKING_DIRECTORY)),eslintFix:tR("CLI",tr,"".concat(tn," ").concat(tA.WORKING_DIRECTORY," --fix")),typescriptCheck:tR("CLI",td,"".concat(tf," -p ").concat(tA.TS_CONFIG," --noEmit")),configureGitHook:tR("RAW","".concat(tm," config core.hooksPath ").concat(tA.GIT_HOOK)),testUnit:tR("CLI",ts,"".concat(to," --config ").concat(tA.UNIT_TEST_CONFIG)),testE2e:tR("CLI","".concat(ts," ").concat(ti),"".concat(to," --config ").concat(tA.E2E_TEST_CONFIG)),commitLint:tR("CLI",ta,"".concat(tc," --edit ").concat(tA.GIT_COMMIT_MSG," --config ").concat(tA.COMMITLINT_CONFIG)),lintStaged:tR("CLI",tu,"".concat(tl," --config ").concat(tA.LINT_STAGED_CONFIG)),stageBuildDirectory:tR("RAW","".concat(tm," add ").concat(e0)),build:tR("RAW","".concat(tv," run build")),pnpmInstallStandard:tR("RAW","".concat(tv," install")),pnpmInstallLegacy:tR("RAW","".concat(tv," install --legacy-peer-deps")),pnpmInstallForce:tR("RAW","".concat(tv," install --force"))};function tN(e){return q(E({plugins:[F()],test:{globals:!0,environment:"jsdom",pool:"vmThreads",include:["**/*.test.unit.?(c|m)[jt]s?(x)"],setupFiles:[tA.UNIT_TEST_SETUP_CONFIG]}},e))}function tw(e){try{return JSON.parse(e),!0}catch(e){return!1}}function tx(e){return!!e&&(typeof e==="undefined"?"undefined":R(e))=="object"&&!Array.isArray(e)}function tD(){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=b(o.value,2),c=a[0],u=a[1];var l=e[c];Array.isArray(u)?e[c]=Array.from(new Set(C(Array.isArray(l)?l:[]).concat(C(u)))):tx(u)?e[c]=tD(tx(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 tj from"globals";var tL=[{languageOptions:{globals:E({},tj.node,tj.browser)},rules:{"perfectionist/sort-imports":["error",{internalPattern:["^#.*","^@/.*"]}]},ignores:["build","dist"]}];var tM=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}return tD.apply(void 0,C(t))},tP=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}var n=tD.apply(void 0,[tL].concat(C(t))),s=n.ignores,i=O(n,["ignores"]),o=Array.isArray(s)&&s.every(function(e){return typeof e=="string"})?{ignores:s}:void 0,a=[i].concat(C(o?[o]:[]));return P.apply(void 0,[{stylistic:{semi:!0,indent:4,quotes:"single"},formatters:{css:!0,html:!0,markdown:"prettier"},yaml:!1,react:!0}].concat(C(a)))},tG=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}return U.apply(void 0,C(t))},tk=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}return tN.apply(void 0,C(t))},tU={eslint:tP,commitlint:tM,"lint-staged":tM,"vitest-react-e2e":tG,"vitest-react-unit":tk};function tF(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=tU[e];if(!s)throw new Error("Unknown config type: ".concat(e));return s.apply(void 0,C(r))}import{defineConfig as tq}from"@eddeee888/gcg-typescript-resolver-files";function tK(e){var t=e.uri,r=e.from,n=e.to,s=e.target,i=s===void 0?"client":s;var o=i==="client",a=i==="server";return S(E({schema:t,ignoreNoDocuments:!0,overwrite:!0},o&&{documents:[r]}),{generates:E({},o&&l({},n,{preset:"client",presetConfig:{fragmentMasking:!1,persistedDocuments:!0},config:{useTypeImports:!0}}),a&&l({},n,tq()))})}var tH={"*":["eslint --fix"]};var tQ=(typeof window==="undefined"?"undefined":R(window))<"u";import tV from"node:process";import{hideBin as tY}from"yargs/helpers";import tJ from"yargs/yargs";var tB={name:"@cyberskill/shared",type:"module",version:"1.84.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-codegen":{types:"./dist/configs/graphql-codegen/index.d.ts",import:"./dist/configs/graphql-codegen/index.js",require:"./dist/configs/graphql-codegen/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"},"./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.12.0","@apollo/client":"3.13.7","@eddeee888/gcg-typescript-resolver-files":"0.12.0","@eslint-react/eslint-plugin":"1.47.4","@graphql-codegen/cli":"5.0.5","@graphql-codegen/client-preset":"4.8.0","@microsoft/api-extractor":"7.52.3","@next/eslint-plugin-next":"15.3.0","@swc/core":"1.11.21","@testing-library/jest-dom":"6.6.3","@testing-library/react":"16.3.0","@vitejs/plugin-react-swc":"3.9.0","@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.3.0","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:"25.0.0",jsdom:"26.1.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.6",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.2","@types/react-dom":"19.1.2","@types/unorm":"1.3.31","@types/uuid":"10.0.0","@types/yargs":"17.0.33",eslint:"9.24.0","lint-staged":"15.5.1","node-modules-inspector":"0.6.6","simple-git-hooks":"2.12.1"}};function tW(){return tz.apply(this,arguments)}function tz(){tz=i(function(){var e,t;return w(this,function(r){switch(r.label){case 0:if(!eo(tA.TS_CONFIG))return[3,3];t=["Performing TypeScript validation"];return[4,tT.typescriptCheck()];case 1:return[4,eQ.apply(void 0,t.concat([r.sent()]))];case 2:e=r.sent();return[3,4];case 3:e=er.warn("No TypeScript configuration found. Skipping type check.");r.label=4;case 4:e;return[2]}})});return tz.apply(this,arguments)}function t$(){return tX.apply(this,arguments)}function tX(){tX=i(function(){var e,t,r,n;var s=arguments;return w(this,function(i){switch(i.label){case 0:e=s.length>0&&s[0]!==void 0?s[0]:!1;if(!e)return[3,3];r=["Running ESLint with auto-fix"];return[4,tT.eslintFix()];case 1:return[4,eQ.apply(void 0,r.concat([i.sent()]))];case 2:t=i.sent();return[3,6];case 3:n=["Running ESLint check"];return[4,tT.eslintCheck()];case 4:return[4,eQ.apply(void 0,n.concat([i.sent()]))];case 5:t=i.sent();i.label=6;case 6:t;return[2]}})});return tX.apply(this,arguments)}function tZ(e,t){if(!t.length)return;var r=e==="Errors"?"red":"yellow";er.printBoxedLog(e==="Errors"?"✖ Errors":"⚠ Warnings",t,r)}function t0(){return t1.apply(this,arguments)}function t1(){t1=i(function(){var e,t,r;return w(this,function(n){switch(n.label){case 0:return[4,ex()];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?er.printBoxedLog("✔ NO ISSUES FOUND",[],"green"):(tZ("Warnings",r),tZ("Errors",t));return[2]}})});return t1.apply(this,arguments)}function t2(){return t4.apply(this,arguments)}function t4(){t4=i(function(){var e,t,r,n,s,i;return w(this,function(o){switch(o.label){case 0:return[4,ej()];case 1:o.sent();return[4,em(e$)];case 2:e=o.sent(),t=e.isCurrentProject;if(!t)return[3,9];o.label=3;case 3:o.trys.push([3,8,,9]);r=["Building package: ".concat(e$)];return[4,tT.build()];case 4:return[4,eQ.apply(void 0,r.concat([o.sent()]))];case 5:o.sent();n=["Staging build artifacts"];return[4,tT.stageBuildDirectory()];case 6:return[4,eQ.apply(void 0,n.concat([o.sent()]))];case 7:o.sent();return[3,9];case 8:s=o.sent();throw er.error("Error building and staging ".concat(e$,": ").concat(s.message)),s;case 9:i=["Executing lint-staged"];return[4,tT.lintStaged()];case 10:return[4,eQ.apply(void 0,i.concat([o.sent()]))];case 11:o.sent(),t0();return[2]}})});return t4.apply(this,arguments)}function t3(){return t5.apply(this,arguments)}function t5(){t5=i(function(){var e;return w(this,function(t){switch(t.label){case 0:e=["Inspecting ESLint configuration"];return[4,tT.eslintInspect()];case 1:return[4,eQ.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return t5.apply(this,arguments)}function t8(){return t6.apply(this,arguments)}function t6(){t6=i(function(){return w(this,function(e){switch(e.label){case 0:return[4,ej()];case 1:e.sent();return[4,Promise.all([tW(),t$()])];case 2:e.sent(),t0();return[2]}})});return t6.apply(this,arguments)}function t9(){return t7.apply(this,arguments)}function t7(){t7=i(function(){return w(this,function(e){switch(e.label){case 0:return[4,ej()];case 1:e.sent();return[4,Promise.all([tW(),t$(!0)])];case 2:e.sent(),t0();return[2]}})});return t7.apply(this,arguments)}function re(){return rt.apply(this,arguments)}function rt(){rt=i(function(){var e;return w(this,function(t){switch(t.label){case 0:return[4,ej()];case 1:t.sent();e=["Validating commit message"];return[4,tT.commitLint()];case 2:return[4,eQ.apply(void 0,e.concat([t.sent()]))];case 3:t.sent(),t0();return[2]}})});return rt.apply(this,arguments)}function rr(){return rn.apply(this,arguments)}function rn(){rn=i(function(){var e,t,r,n;return w(this,function(s){switch(s.label){case 0:e=["Configuring Git hooks"];return[4,tT.configureGitHook()];case 1:return[4,eQ.apply(void 0,e.concat([s.sent()]))];case 2:s.sent(),el(tA.GIT_HOOK);return[4,eK(tI)];case 3:t=s.sent();ec(tA.SIMPLE_GIT_HOOKS_JSON,t,{isJson:!0});r="\n".concat(e5,"\n");eo(tA.GIT_IGNORE)?ea(tA.GIT_IGNORE).split("\n").includes(e5)||eu(tA.GIT_IGNORE,r):ec(tA.GIT_IGNORE,r);n=["Setting up simple-git-hooks"];return[4,tT.simpleGitHooks()];case 4:return[4,eQ.apply(void 0,n.concat([s.sent()]))];case 5:s.sent();return[2]}})});return rn.apply(this,arguments)}function rs(){return ri.apply(this,arguments)}function ri(){ri=i(function(){return w(this,function(e){switch(e.label){case 0:return[4,eE([e$],{update:!0,postInstallActions:[rr]})];case 1:e.sent();return[2]}})});return ri.apply(this,arguments)}function ro(){return ra.apply(this,arguments)}function ra(){ra=i(function(){return w(this,function(e){switch(e.label){case 0:el(tA.NODE_MODULES,tA.PNPM_LOCK_YAML);return[4,eg()];case 1:e.sent();return[4,rr()];case 2:e.sent();return[2]}})});return ra.apply(this,arguments)}function rc(){return ru.apply(this,arguments)}function ru(){ru=i(function(){var e;return w(this,function(t){switch(t.label){case 0:e=["Inspecting project dependencies"];return[4,tT.nodeModulesInspect()];case 1:return[4,eQ.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return ru.apply(this,arguments)}function rl(){return rd.apply(this,arguments)}function rd(){rd=i(function(){var e;return w(this,function(t){switch(t.label){case 0:e=["Running unit tests"];return[4,tT.testUnit()];case 1:return[4,eQ.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return rd.apply(this,arguments)}function rf(){return rp.apply(this,arguments)}function rp(){rp=i(function(){var e;return w(this,function(t){switch(t.label){case 0:e=["Running end-to-end tests"];return[4,tT.testE2e()];case 1:return[4,eQ.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return rp.apply(this,arguments)}i(function(){var e;return w(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,tJ(tY(tV.argv)).scriptName(te).usage("$0 <command> [options]").command("lint","Check code for linting issues",t8).command("lint:fix","Fix linting issues automatically",t9).command("lint:inspect","View active ESLint configuration",t3).command("lint-staged","Run lint checks on staged files",t2).command("commitlint","Validate commit message format",re).command("setup","Initialize project setup and dependencies",rs).command("reset","Reset the project and reinstall dependencies",ro).command("inspect","Analyze installed project dependencies",rc).command("test:unit","Run unit test suite",rl).command("test:e2e","Run end-to-end test suite",rf).demandCommand(1,"Please specify a valid command.").strict().help().alias("h","help").alias("v","version").version(tB.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();er.error("Fatal: ".concat(e.message)),tV.exit(1);return[3,3];case 3:return[2]}})})();import{format as rm}from"date-fns";import{Document as rv}from"mongoose";import rg from"mongoose-aggregate-paginate-v2";import rh from"mongoose-paginate-v2";import{v4 as rE}from"uuid";import ry from"crypto-js";import rS from"slugify";var rO=rS.default||rS;function r_(){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=O(r,["lower","locale"]);return rO(e,E({lower:s,locale:o},a))}function rA(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:4;return ry.SHA256(e).toString(ry.enc.Hex).slice(0,t)}var rI={isEmpty:function e(e){return e==null?!0:Array.isArray(e)?e.length===0:(typeof e==="undefined"?"undefined":R(e))=="object"?p(e,Date)?!1:Object.keys(e).length===0:typeof e=="string"?e.trim().length===0:!1}};var rb={getDateTime:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:new Date;return rm(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"?rb.getDateTime():new Date;return{id:rE(),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:rE,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(rb.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=rb.createSchema({mongoose:t,schema:n,virtuals:u});return rb.applyPlugins(f,[i&&rh,a&&rg]),rb.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 S(E({},t,r&&{id:{$ne:r}}),{$or:[{slug:e},{slugHistory:e}]})},validator:{isEmpty:function e(){return /*#__PURE__*/function(){var e=i(function(e){return w(this,function(t){return[2,!rI.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 w(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 w(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)}}()}}},rC=/*#__PURE__*/function(){"use strict";function e(t,r){a(this,e);j(this,"collection");this.collection=t.collection(r)}u(e,[{key:"createOne",value:function e(e){var t=this;return i(function(){var r,n,s;return w(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);r=E({},rb.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 w(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);r=e.map(function(e){return E({},rb.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 w(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 w(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 w(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 w(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 w(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 w(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 w(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}(),rR=/*#__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 w(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:Z.NOT_FOUND.CODE}];case 2:a=c.sent();return[2,{success:!1,message:a.message,code:Z.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 w(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:Z.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 w(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:Z.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 w(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:Z.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 w(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:Z.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"createOne",value:function e(e){var t=this;return i(function(){var r,n;return w(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:Z.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 w(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,rv)?e.toObject():null}).filter(function(e){return e!==null}),n)];case 2:s=i.sent();return[2,{success:!1,message:s.message,code:Z.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 w(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);return[4,n.model.findOneAndUpdate(e,t,E({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:Z.NOT_FOUND.CODE}];case 2:i=o.sent();return[2,{success:!1,message:i.message,code:Z.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 w(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:Z.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 w(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:Z.NOT_FOUND.CODE}];case 2:s=i.sent();return[2,{success:!1,message:s.message,code:Z.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 w(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:Z.NOT_FOUND.CODE}:{success:!0,result:n}];case 2:s=i.sent();return[2,{success:!1,message:s.message,code:Z.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 w(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=rA(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:Z.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,m,v;return w(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 w(this,function(a){switch(a.label){case 0:return[4,n.model.findOne(rb.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(rb.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":R(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=r_(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=r_(s);m={success:!0};return[4,o(p)];case 6:return[2,(m.result=g.sent(),m)];case 7:return[3,9];case 8:v=g.sent();return[2,{success:!1,message:"Failed to create a unique slug: ".concat(v.message),code:Z.INTERNAL_SERVER_ERROR.CODE}];case 9:return[2]}})})()}},{key:"aggregate",value:function e(e){var t=this;return i(function(){var r,n;return w(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:Z.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}}]);return e}();import{Collection as rT,Db as rN}from"mongodb";import{Document as rw,Model as rx}from"mongoose";var rD=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(rN),rj=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(rw),rL=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(rx),rM=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(rT);import{ApolloClient as rP,ApolloError as rG,ApolloLink as rk,ApolloProvider as rU,from as rF,HttpLink as rq,InMemoryCache as rK,split as rH}from"@apollo/client";import{onError as rQ}from"@apollo/client/link/error";import{removeTypenameFromVariables as rV}from"@apollo/client/link/remove-typename";import{GraphQLWsLink as rY}from"@apollo/client/link/subscriptions";import{getMainDefinition as rJ}from"@apollo/client/utilities";import{createClient as rB}from"graphql-ws";import{useMemo as rW}from"react";import{FaInfo as rz}from"react-icons/fa6";import{use as r$}from"react";import{FaRepeat as rX}from"react-icons/fa6";import{createContext as rZ}from"react";var r0=rZ(void 0);import r1 from"./react/apollo-error/apollo-error.module.scss";import{jsx as r2,jsxs as r4}from"react/jsx-runtime";function r3(){var e=r$(r0),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)?r4("div",{children:[r4("strong",{children:[e,":"]}),r2("ul",{children:t.map(function(e){return r2("li",{children:e.message},e.message)})})]}):null};return r2("div",{className:r1["modal-backdrop"],children:r4("div",{className:r1["modal-content"],children:[r2("button",{type:"button",className:r1["btn-close"],onClick:e.hideError,children:"✕"}),r4("div",{className:r1["error-title"],children:[r2("button",{type:"button",className:r1["btn-retry"],onClick:function(){return window.location.reload()},children:r2(rX,{})})," ",t.message]}),r4("div",{className:r1["error-details"],children:[t.networkError&&r4("pre",{className:"network",children:[r2("strong",{children:"Network Error:"})," ",t.networkError.message]}),r("GraphQL Errors",C(t.graphQLErrors)),r("Protocol Errors",C(t.protocolErrors)),r("Client Errors",C(t.clientErrors)),t.extraInfo&&r4("pre",{className:"extra",children:[r2("strong",{children:"Extra Info:"})," ",JSON.stringify(t.extraInfo,null,4)]})]})]})})}import{use as r5}from"react";function r8(){var e=r5(r0);if(!e)throw new Error("useApolloError must be used within ApolloErrorProvider");return e}import{useEffect as r6,useMemo as r9,useState as r7}from"react";var ne=null;function nt(e){ne=e}function nr(e){ne===null||ne===void 0?void 0:ne(e)}import{jsx as nn}from"react/jsx-runtime";function ns(e){var t=e.children;var r=b(r7(null),2),n=r[0],s=r[1];r6(function(){nt(s)},[]);var i=r9(function(){return{error:n,showError:s,hideError:function(){return s(null)}}},[n]);return nn(r0,{value:i,children:t})}import{consola as ni}from"consola/browser";var no={silent:ni.silent,level:ni.level,fatal:ni.fatal,error:ni.error,warn:ni.warn,log:ni.log,info:ni.info,success:ni.success,ready:ni.ready,start:ni.start,box:ni.box,debug:ni.debug,trace:ni.trace,verbose:ni.verbose};import{toast as na,Toaster as nc}from"react-hot-toast";var nu="/graphql";import{Fragment as nl,jsx as nd,jsxs as nf}from"react/jsx-runtime";var np=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);var e;e=o(this,t,arguments);j(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 no.info("[Apollo] #".concat(r.count,": ").concat(i," (").concat(s,"ms)")),t})}}]);return t}(rk);function nm(e){var t=e.uri,r=e.wsUrl,n=e.customLinks,s=new np,i=rQ(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;no.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;no.error("[Protocol error]: ".concat(t,", Extensions: ").concat(JSON.stringify(r)))}),r&&no.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 rG({graphQLErrors:t||[],protocolErrors:n||[],clientErrors:[],networkError:r||null,errorMessage:c,extraInfo:{operation:s}});na.error(function(e){return nf(nl,{children:[c,"\xa0",nd(rz,{cursor:"pointer",onClick:function(){setTimeout(function(){nr(u)},0),na.dismiss(e.id)}})]})})}}),o=rV();t||no.warn('[Apollo] No GraphQL URI provided — using "'.concat(nu,'" as default'));var a=new rq({uri:t!==null&&t!==void 0?t:nu,credentials:"include"}),c=r?new rY(rB({url:r})):rk.empty(),u=p(c,rk)?rH(function(e){var t=e.query;var r=rJ(t);return r.kind==="OperationDefinition"&&r.operation==="subscription"},c,a):a;return u===a&&r&&no.warn("[Apollo] WS URL is set, but subscriptions fallback to HTTP. Check your wsLink config."),[s,i,o].concat(C(n!==null&&n!==void 0?n:[]),[u])}function nv(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=O(a,["uri","wsUrl","customLinks"]),f=s!==null&&s!==void 0?s:rP;if(typeof f!="function")throw new TypeError("Invalid ApolloClient provided. Ensure CustomClient is a class.");var m=i||rU,v=rW(function(){return rF(nm({uri:c!==null&&c!==void 0?c:nu,wsUrl:u!==null&&u!==void 0?u:"",customLinks:l!==null&&l!==void 0?l:[]}))},[c,u,l]),g=rW(function(){return p(o,rK)?o:new rK},[o]),h=rW(function(){return new f(E({link:v,cache:g},d))},[f,v,g,d]);return nf(nl,{children:[nf(ns,{children:[t?nd(m,{makeClient:function(){return h},children:n}):nd(m,{client:h,children:n}),nd(r3,{})]}),nd(nc,{position:"top-right"})]})}import{useTranslation as ng}from"react-i18next";var nh=ng;import nE from"i18next";import{initReactI18next as ny}from"react-i18next";function nS(e){return nE.use(ny).init(e)}import nO from"classnames";import n_ from"./react/loading/loading.module.scss";import{jsx as nA,jsxs as nI}from"react/jsx-runtime";function nb(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=O(e,["full","block","className","message"]);function l(){return nI("div",S(E({className:n_.container},u),{children:[nA("div",{className:n_.ring}),nA("div",{className:n_.ring}),nA("div",{className:n_.ring}),nA("div",{className:n_.ring}),c&&nA("div",{className:n_.message,children:c})]}))}return r?nA("div",{className:nO(n_.fullscreen,o),children:l()}):s?nA("div",{className:nO(n_.block,o),children:l()}):l()}import{createContext as nC}from"react";var nR=nC(void 0);import{use as nT}from"react";function nN(){var e=nT(nR);if(!e)throw new Error("useLoading must be used within a LoadingProvider");return e}import{useCallback as nw,useMemo as nx,useState as nD}from"react";import{jsx as nj}from"react/jsx-runtime";function nL(e){var t=e.children;var r=b(nD(!1),2),n=r[0],s=r[1],i=b(nD(!1),2),o=i[0],a=i[1],c=nw(function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;s(!0),a(e)},[]),u=nw(function(){s(!1),a(!1)},[]),l=nx(function(){return{isLoading:n,isGlobalLoading:o,showLoading:c,hideLoading:u}},[n,o,c,u]);return nj(nR,{value:l,children:n?nj(nb,{full:o}):t})}import{enUS as nM}from"date-fns/locale";var nP={label:"English",value:"en",flag:"\uD83C\uDDFA\uD83C\uDDF8",adapterLocale:nM,icon:"flagpack:gb-nir",numberFormat:{code:"en-US",currency:"USD"},timezone:"America/New_York"};import{createContext as nG}from"react";var nk=nG(void 0);import{NextIntlClientProvider as nU}from"next-intl";import{useTranslations as nF}from"next-intl";import{use as nq}from"react";function nK(){var e=nq(nk);if(!e)throw new Error("useNextIntl must be used within a NextIntlProvider");return e}var nH=nF;import{jsx as nQ}from"react/jsx-runtime";function nV(e){var t=function(t){var r;var n;var s=nK(),i=s.currentLanguage,o=t.messages,a=t.languages,c="en",u=o[(i===null||i===void 0?void 0:i.value)||c],l=(n=(r=a.find(function(e){return e.value===(i===null||i===void 0?void 0:i.value)}))===null||r===void 0?void 0:r.timezone)!==null&&n!==void 0?n:nP.timezone;return o?nQ(nU,{locale:(i===null||i===void 0?void 0:i.value)||c,messages:u||null,timeZone:l,children:nQ(e,E({},t))}):(no.warn("Missing messages for language: ".concat((i===null||i===void 0?void 0:i.value)||c)),null)};return t.displayName="withNextIntl(".concat(e.displayName||e.name||"Component",")"),t}import{useMemo as nY}from"react";import{useCallback as nJ,useEffect as nB,useState as nW}from"react";var nz={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 n$ from"localforage";var nX={get:function e(e){return i(function(){var t;return w(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,n$.getItem(e)];case 1:return[2,r.sent()];case 2:t=r.sent();return[2,(no.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 w(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,n$.setItem(e,t)];case 1:n.sent();return[3,3];case 2:r=n.sent();no.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 w(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,n$.removeItem(e)];case 1:r.sent();return[3,3];case 2:t=r.sent();no.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 w(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,n$.keys()];case 1:return[2,(e=r.sent())!==null&&e!==void 0?e:[]];case 2:t=r.sent();return[2,(no.error("[Storage:keys] Error getting keys:",t),[])];case 3:return[2]}})})()}};function nZ(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:nz;var n=b(nW(t),2),s=n[0],o=n[1],a=b(nW(!1),2),c=a[0],u=a[1];nB(function(){var n=!0;return i(function(){var s,i,a,c;return w(this,function(l){switch(l.label){case 0:l.trys.push([0,6,7,8]);return[4,nX.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,nX.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();no.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]),nB(function(){if(!c)return;i(function(){var t,n;return w(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,nX.set(e,t)];case 1:i.sent();i.label=2;case 2:return[3,4];case 3:n=i.sent();no.error('Error saving value for key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},[s,e,r,c]);var l=nJ(function(e){o(function(t){return typeof e=="function"?e(t):e})},[]),d=nJ(/*#__PURE__*/i(function(){var t;return w(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,nX.remove(e)];case 1:r.sent(),o(void 0);return[3,3];case 2:t=r.sent();no.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 n0,jsx as n1}from"react/jsx-runtime";function n2(e){var t=e.children;return n1(n0,{children:t})}var n4=nV(n2);function n3(e){var t=e.children,r=e.languages,n=e.messages;var s=nZ("lang",r[0]),i=s.value,o=s.set,a=nY(function(){return{languages:r,currentLanguage:i!==null&&i!==void 0?i:nP,setCurrentLanguage:o}},[r,o,i]);return n1(nk,{value:a,children:n1(n4,{languages:r,messages:n,children:t})})}import n5 from"unorm";var n8={a:["\xe0","\xe1","ạ","ả","\xe3","\xe2","ầ","ấ","ậ","ẩ","ẫ","ă","ằ","ắ","ặ","ẳ","ẵ"],e:["\xe8","\xe9","ẹ","ẻ","ẽ","\xea","ề","ế","ệ","ể","ễ"],i:["\xec","\xed","ị","ỉ","ĩ"],o:["\xf2","\xf3","ọ","ỏ","\xf5","\xf4","ồ","ố","ộ","ổ","ỗ","ơ","ờ","ớ","ợ","ở","ỡ"],u:["\xf9","\xfa","ụ","ủ","ũ","ư","ừ","ứ","ự","ử","ữ"],y:["ỳ","\xfd","ỵ","ỷ","ỹ"],d:["đ"]},n6=Object.entries(n8).reduce(function(e,t){var r=b(t,2),n=r[0],s=r[1];return e[n.toUpperCase()]=s.map(function(e){return e.toUpperCase()}),e},{});function n9(e){e=n5.nfkc(e);var t=E({},n8,n6);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=b(o.value,2),c=a[0],u=a[1];var l="[".concat(c).concat(u.join(""),"]"),d="(".concat([c].concat(C(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 n7(e){return e.normalize("NFD").replace(RegExp("\\p{Diacritic}","gu"),"")}export{r3 as ApolloError,r0 as ApolloErrorContext,ns as ApolloErrorProvider,nv as ApolloProvider,e0 as BUILD_DIRECTORY,en as CHECK_PACKAGE_EMPTY_RESULT,tc as COMMIT_LINT_CLI,ta as COMMIT_LINT_PACKAGE_NAME,te as CYBERSKILL_CLI,tt as CYBERSKILL_CLI_PATH,e7 as CYBERSKILL_DIRECTORY,e$ as CYBERSKILL_PACKAGE_NAME,eX as CYBERSKILL_STORAGE,rM as C_Collection,rD as C_Db,rj as C_Document,rL as C_Model,B as DEBUG,tn as ESLINT_CLI,tS as ESLINT_INSPECT_CLI,ty as ESLINT_INSPECT_PACKAGE_NAME,tr as ESLINT_PACKAGE_NAME,H as E_CommandType,M as E_ConfigType,W as E_IssueType,tm as GIT_CLI,e9 as GIT_COMMIT_EDITMSG,e6 as GIT_HOOK,e3 as GIT_IGNORE,nu as GRAPHQL_URI_DEFAULT,tI as HOOK,tQ as IS_BROWSER,tl as LINT_STAGED_CLI,tu as LINT_STAGED_PACKAGE_NAME,nb as Loading,nR as LoadingContext,nL as LoadingProvider,rC as MongoController,rR as MongooseController,nP as NEXT_INTL_DEFAULT_LANGUAGE,eZ as NODE_MODULES,t_ as NODE_MODULES_INSPECT_CLI,tO as NODE_MODULES_INSPECT_PACKAGE_NAME,nk as NextIntlContext,n3 as NextIntlProvider,e1 as PACKAGE_JSON,e2 as PACKAGE_LOCK_JSON,tA as PATH,ti as PLAYWRIGHT_PACKAGE_NAME,tv as PNPM_CLI,tg as PNPM_EXEC_CLI,e8 as PNPM_LOCK_YAML,Z as RESPONSE_STATUS,th as SIMPLE_GIT_HOOKS_PACKAGE_NAME,tE as SIMPLE_GIT_HOOK_CLI,e5 as SIMPLE_GIT_HOOK_JSON,e4 as TSCONFIG_JSON,tf as TSC_CLI,td as TSC_PACKAGE_NAME,tp as TSX_CLI,nc as Toaster,to as VITEST_CLI,ts as VITEST_PACKAGE_NAME,ez as WORKING_DIRECTORY,rg as aggregatePaginate,eu as appendFileSync,em as checkPackage,ej as clearAllErrorLists,tT as command,L as commitlintConfig,tK as createGraphqlCodegenConfig,tD as deepMerge,tL as eslintConfig,eo as existsSync,eq as formatCommand,rA as generateShortId,r_ as generateSlug,ef as getLatestPackageVersion,ed as getPackage,ex as getStoredErrorLists,nS as initI18next,eg as installDependencies,tw as isJson,tx as isPlainObject,eW as join,tH as lintStagedConfig,no as log,er as logNodeJS,tF as mergeConfigs,rb as mongo,rh as mongoosePaginate,eU as rawCommand,ea as readFileSync,n9 as regexSearchMapper,n7 as removeAccent,eB as resolve,eK as resolveCommands,eJ as resolveWorkingPath,el as rmSync,eQ as runCommand,nz as serializer,nt as setGlobalApolloErrorCallback,eE as setupPackages,nr as showGlobalApolloError,nX as storage,eC as storageNodeJS,ee as throwError,na as toast,r8 as useApolloError,nN as useLoading,nK as useNextIntl,nZ as useStorage,nh as useTranslateI18next,nH as useTranslateNextIntl,rI as validate,U as vitestE2E,tN as vitestUnit,nV as withNextIntl,ec as writeFileSync};