@cyberskill/shared 1.62.0 → 1.64.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_tsup-dts-rollup.d.cts +103 -19
- package/dist/_tsup-dts-rollup.d.ts +103 -19
- package/dist/cli.cjs +1 -1
- package/dist/cli.js +1 -1
- package/dist/configs/graphql/graphql-codegen.cjs +1 -1
- package/dist/configs/graphql/graphql-codegen.js +1 -1
- package/dist/configs/graphql/index.cjs +1 -1
- package/dist/configs/graphql/index.js +1 -1
- package/dist/configs/index.cjs +1 -1
- package/dist/configs/index.js +1 -1
- package/dist/configs/vitest/react/unit.cjs +1 -1
- package/dist/configs/vitest/react/unit.js +1 -1
- package/dist/constants/cli.cjs +1 -0
- package/dist/constants/cli.d.cts +1 -0
- package/dist/constants/cli.d.ts +1 -0
- package/dist/constants/cli.js +1 -0
- package/dist/constants/common-nodejs.cjs +1 -0
- package/dist/constants/common-nodejs.d.cts +1 -0
- package/dist/constants/common-nodejs.d.ts +1 -0
- package/dist/constants/common-nodejs.js +1 -0
- package/dist/constants/common.cjs +1 -1
- package/dist/constants/common.d.cts +0 -1
- package/dist/constants/common.d.ts +0 -1
- package/dist/constants/common.js +1 -1
- package/dist/constants/index.cjs +1 -1
- package/dist/constants/index.d.cts +3 -1
- package/dist/constants/index.d.ts +3 -1
- package/dist/constants/index.js +1 -1
- package/dist/constants/package.cjs +1 -0
- package/dist/constants/package.d.cts +1 -0
- package/dist/constants/package.d.ts +1 -0
- package/dist/constants/package.js +1 -0
- package/dist/constants/path.cjs +1 -1
- package/dist/constants/path.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +11 -3
- package/dist/index.d.ts +11 -3
- package/dist/index.js +1 -1
- package/dist/react/apollo-client.cjs +1 -1
- package/dist/react/apollo-client.js +1 -1
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.js +1 -1
- package/dist/react/next-intl.cjs +1 -1
- package/dist/react/next-intl.js +1 -1
- package/dist/react/storage.cjs +1 -1
- package/dist/react/storage.js +1 -1
- package/dist/typescript/apollo-error.d.cts +1 -1
- package/dist/typescript/apollo-error.d.ts +1 -1
- package/dist/typescript/index.d.cts +5 -0
- package/dist/typescript/index.d.ts +5 -0
- package/dist/typescript/log.d.cts +1 -0
- package/dist/typescript/log.d.ts +1 -0
- package/dist/typescript/package.cjs +1 -0
- package/dist/typescript/package.d.cts +3 -0
- package/dist/typescript/package.d.ts +3 -0
- package/dist/typescript/package.js +0 -0
- package/dist/utils/command.cjs +1 -1
- package/dist/utils/command.js +1 -1
- package/dist/utils/index-nodejs.cjs +1 -1
- package/dist/utils/index-nodejs.d.cts +2 -2
- package/dist/utils/index-nodejs.d.ts +2 -2
- package/dist/utils/index-nodejs.js +1 -1
- package/dist/utils/index.cjs +1 -1
- package/dist/utils/index.d.cts +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -1
- package/dist/utils/log-nodejs.cjs +1 -0
- package/dist/utils/log-nodejs.d.cts +2 -0
- package/dist/utils/log-nodejs.d.ts +2 -0
- package/dist/utils/log-nodejs.js +1 -0
- package/dist/utils/log.cjs +1 -1
- package/dist/utils/log.d.cts +0 -1
- package/dist/utils/log.d.ts +0 -1
- package/dist/utils/log.js +1 -1
- package/dist/utils/package.cjs +1 -1
- package/dist/utils/package.d.cts +1 -1
- package/dist/utils/package.d.ts +1 -1
- package/dist/utils/package.js +1 -1
- package/dist/utils/path.cjs +1 -1
- package/dist/utils/path.js +1 -1
- package/dist/utils/storage-client.cjs +1 -1
- package/dist/utils/storage-client.js +1 -1
- package/dist/utils/storage-server.cjs +1 -1
- package/dist/utils/storage-server.js +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e,r){if(r==null||r>e.length)r=e.length;for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function r(e){if(Array.isArray(e))return e}function t(r){if(Array.isArray(r))return e(r)}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,r,t,n,s,o,a){try{var i=e[o](a);var c=i.value}catch(e){t(e);return}if(i.done){r(c)}else{Promise.resolve(c).then(n,s)}}function o(e){return function(){var r=this,t=arguments;return new Promise(function(n,o){var a=e.apply(r,t);function i(e){s(a,n,o,i,c,"next",e)}function c(e){s(a,n,o,i,c,"throw",e)}i(undefined)})}}function a(e,r,t){r=f(r);return A(e,T()?Reflect.construct(r,t||[],f(e).constructor):r.apply(e,t))}function i(e,r){if(!(e instanceof r)){throw new TypeError("Cannot call a class as a function")}}function c(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||false;n.configurable=true;if("value"in n)n.writable=true;Object.defineProperty(e,n.key,n)}}function u(e,r,t){if(r)c(e.prototype,r);if(t)c(e,t);return e}function l(e,r,t){if(r in e){Object.defineProperty(e,r,{value:t,enumerable:true,configurable:true,writable:true})}else{e[r]=t}return e}function f(e){f=Object.setPrototypeOf?Object.getPrototypeOf:function e(e){return e.__proto__||Object.getPrototypeOf(e)};return f(e)}function E(e,r){if(typeof r!=="function"&&r!==null){throw new TypeError("Super expression must either be null or a function")}e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:true,configurable:true}});if(r)N(e,r)}function d(e,r){if(r!=null&&typeof Symbol!=="undefined"&&r[Symbol.hasInstance]){return!!r[Symbol.hasInstance](e)}else{return e instanceof r}}function v(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function h(e,r){var t=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(t==null)return;var n=[];var s=true;var o=false;var a,i;try{for(t=t.call(e);!(s=(a=t.next()).done);s=true){n.push(a.value);if(r&&n.length===r)break}}catch(e){o=true;i=e}finally{try{if(!s&&t["return"]!=null)t["return"]()}finally{if(o)throw i}}return n}function m(){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 g(){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 p(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};var n=Object.keys(t);if(typeof Object.getOwnPropertySymbols==="function"){n=n.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))}n.forEach(function(r){l(e,r,t[r])})}return e}function _(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);if(r){n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})}t.push.apply(t,n)}return t}function S(e,r){r=r!=null?r:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(r))}else{_(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function y(e,r){if(e==null)return{};var t=O(e,r);var n,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++){n=o[s];if(r.indexOf(n)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(e,n))continue;t[n]=e[n]}}return t}function O(e,r){if(e==null)return{};var t={};var n=Object.keys(e);var s,o;for(o=0;o<n.length;o++){s=n[o];if(r.indexOf(s)>=0)continue;t[s]=e[s]}return t}function A(e,r){if(r&&(I(r)==="object"||typeof r==="function")){return r}return n(e)}function N(e,r){N=Object.setPrototypeOf||function e(e,r){e.__proto__=r;return e};return N(e,r)}function C(e,t){return r(e)||h(e,t)||D(e,t)||m()}function R(e){return t(e)||v(e)||D(e)||g()}function I(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function D(r,t){if(!r)return;if(typeof r==="string")return e(r,t);var n=Object.prototype.toString.call(r).slice(8,-1);if(n==="Object"&&r.constructor)n=r.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(r,t)}function T(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(T=function(){return!!e})()}function b(e,r){var t,n,s,o,a={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]};return o={next:i(0),"throw":i(1),"return":i(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function i(e){return function(r){return c([e,r])}}function c(o){if(t)throw new TypeError("Generator is already executing.");while(a)try{if(t=1,n&&(s=o[0]&2?n["return"]:o[0]?n["throw"]||((s=n["return"])&&s.call(n),0):n.next)&&!(s=s.call(n,o[1])).done)return s;if(n=0,s)o=[o[0]&2,s.value];switch(o[0]){case 0:case 1:s=o;break;case 4:a.label++;return{value:o[1],done:false};case 5:a.label++;n=o[1];o=[0];continue;case 7:o=a.ops.pop();a.trys.pop();continue;default:if(!(s=a.trys,s=s.length>0&&s[s.length-1])&&(o[0]===6||o[0]===2)){a=0;continue}if(o[0]===3&&(!s||o[1]>s[0]&&o[1]<s[3])){a.label=o[1];break}if(o[0]===6&&a.label<s[1]){a.label=s[1];s=o;break}if(s&&a.label<s[2]){a.label=s[2];a.ops.push(o);break}if(s[2])a.ops.pop();a.trys.pop();continue}o=r.call(e,a)}catch(e){o=[6,e];n=0}finally{t=s=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:true}}}import P from"node:process";var w=(typeof window==="undefined"?"undefined":I(window))<"u",M=P.env.DEBUG==="true";var L="/graphql";import G from"node:process";var k=function(e){return e.Error="error",e.Warning="warning",e}(k||{}),U=function(e){return e.PNPM_ADD_AND_EXEC="PNPM_ADD_AND_EXEC",e.PNPM_ADD_DEV_AND_EXEC="PNPM_ADD_DEV_AND_EXEC",e.RAW="RAW",e}(U||{});import{exec as x}from"node:child_process";import j from"node:process";import*as F from"node:util";import V from"chalk";import K from"consola";import{GraphQLError as Y}from"graphql";var Q={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 H(e){var r=e.message,t=e.status,n=t===void 0?Q.INTERNAL_SERVER_ERROR:t,s=e.type,o=s===void 0?"graphql":s;var a;var i=(a=r!==null&&r!==void 0?r:n.MESSAGE)!==null&&a!==void 0?a:"Internal server error";throw o==="graphql"?new Y(i,{extensions:{code:n.CODE}}):new Error(i)}M||(K.level=4);function B(e){var r=V[e];return typeof r=="function"?r:V.green}var q={silent:K.silent,level:K.level,fatal:K.fatal,error:K.error,warn:K.warn,log:K.log,info:K.info,success:K.success,ready:K.ready,start:K.start,box:K.box,debug:K.debug,trace:K.trace,verbose:K.verbose,printBoxedLog:function e(e,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(r===null||r===void 0?void 0:r.length)){K.box(V.green(e));return}r.forEach(function(e){var r=e.file,n=e.position,s=e.rule,o=e.message;K.log("".concat(V.gray("File:")," ").concat(V.blue("".concat(r).concat(n?":".concat(n):"")))),s&&K.log(" ".concat(B(t)("Rule:")," ").concat(s)),K.log(" ".concat(B(t)("Message:")," ").concat(o))}),K.box(B(t)("".concat(e," : ").concat(r.length))),K.log(V.gray("─".repeat(40)))}};import J from"node-fetch";import*as W from"node:fs";function X(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++){r[t]=arguments[t]}return r.every(function(e){return W.existsSync(e)})}function z(e,r){var t=W.readFileSync(e,"utf-8");if(r===null||r===void 0?void 0:r.asJson)try{var n=JSON.parse(t);if((typeof n==="undefined"?"undefined":I(n))=="object"&&n!==null)return n;throw new Error("Parsed JSON is not an object or array")}catch(r){throw new Error("Failed to parse JSON from file: ".concat(e))}return t}function $(e,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var n=t.isJson,s=n===void 0?!1:n,o=s&&(typeof r==="undefined"?"undefined":I(r))=="object"?JSON.stringify(r,null,4):String(r);W.writeFileSync(e,o,"utf-8")}function Z(e,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var n=t.isJson,s=n===void 0?!1:n,o=s&&(typeof r==="undefined"?"undefined":I(r))=="object"?JSON.stringify(r,null,4):String(r);W.appendFileSync(e,o,"utf-8")}function ee(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++){r[t]=arguments[t]}r.forEach(function(e){X(e)&&W.rmSync(e,{recursive:!0,force:!0})})}import*as er from"node:path";function et(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++){r[t]=arguments[t]}var n;return(n=er).resolve.apply(n,[eG].concat(R(r)))}function en(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++){r[t]=arguments[t]}var n;return(n=er).resolve.apply(n,R(r))}function es(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++){r[t]=arguments[t]}var n;return(n=er).join.apply(n,R(r))}import eo from"node-persist";import ea from"node:os";import ei from"node:process";function ec(){return ei.env.CYBERSKILL_STORAGE_DIR||es(ea.homedir(),eU)}function eu(){return el.apply(this,arguments)}function el(){el=o(function(){var e;return b(this,function(r){switch(r.label){case 0:e=eo.defaultInstance;if(e)return[3,2];return[4,eo.init({dir:ec(),stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,forgiveParseErrors:!0})];case 1:e=r.sent();r.label=2;case 2:e;return[2]}})});return el.apply(this,arguments)}var ef={get:function e(e){return o(function(){var r,t;return b(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,eu()];case 1:n.sent();return[4,eo.getItem(e)];case 2:return[2,(r=n.sent())!==null&&r!==void 0?r:null];case 3:t=n.sent();return[2,(q.error('[Storage:get] Error getting key "'.concat(e,'":'),t),null)];case 4:return[2]}})})()},set:function e(e,r){return o(function(){var t;return b(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,eu()];case 1:n.sent();return[4,eo.setItem(e,r)];case 2:n.sent();return[3,4];case 3:t=n.sent();q.error('[Storage:set] Error setting key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},remove:function e(e){return o(function(){var r;return b(this,function(t){switch(t.label){case 0:t.trys.push([0,3,,4]);return[4,eu()];case 1:t.sent();return[4,eo.removeItem(e)];case 2:t.sent();return[3,4];case 3:r=t.sent();q.error('[Storage:remove] Error removing key "'.concat(e,'":'),r);return[3,4];case 4:return[2]}})})()},keys:function e(){return o(function(){var e,r;return b(this,function(t){switch(t.label){case 0:t.trys.push([0,3,,4]);return[4,eu()];case 1:t.sent();return[4,eo.keys()];case 2:e=t.sent();return[2,Array.isArray(e)?e:(q.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:r=t.sent();return[2,(q.error("[Storage:keys] Error getting keys:",r),[])];case 4:return[2]}})})()},getLogLink:function e(e){return o(function(){return b(this,function(r){try{return[2,"".concat(ec()," (key: ").concat(e,")")]}catch(e){return[2,(q.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var eE=24*60*60*1e3;function ed(e){var r=es(eG,eF);if(X(r))try{var t=z(r,{asJson:!0});if(t.name===e)return{path:r,file:t,isCurrentProject:!0}}catch(e){q.warn("Failed to read local package.json: ".concat(e.message))}var n=es(eG,ex,e,eF);if(X(n))try{var s=z(n,{asJson:!0});if(s.name===e)return{path:n,file:s,isCurrentProject:!1}}catch(r){q.warn("Failed to read node_modules package.json for ".concat(e,": ").concat(r.message))}return!1}function ev(e){return eh.apply(this,arguments)}function eh(){eh=o(function(e){var r,t,n,s,o,a,i,c,u,l;var f=arguments;return b(this,function(E){switch(E.label){case 0:r=f.length>1&&f[1]!==void 0?f[1]:!1;t="npm_version:".concat(e),n="npm_metadata:".concat(e);return[4,ef.get(t)];case 1:s=E.sent();return[4,ef.get(n)];case 2:o=E.sent(),a=s&&Date.now()-s.timestamp<eE;if(!r&&a)return[2,s.version];i={};(o===null||o===void 0?void 0:o.etag)&&(i["If-None-Match"]=o.etag),(o===null||o===void 0?void 0:o.lastModified)&&(i["If-Modified-Since"]=o.lastModified);E.label=3;case 3:E.trys.push([3,8,,9]);return[4,J("https://registry.npmjs.org/".concat(e,"/latest"),{headers:i})];case 4:c=E.sent();if(c.status===304&&s)return[2,s.version];if(!c.ok)throw new Error("Failed to fetch latest version: ".concat(c.statusText));return[4,c.json()];case 5:u=E.sent().version;return[4,ef.set(t,{version:u,timestamp:Date.now()})];case 6:E.sent();return[4,ef.set(n,{etag:c.headers.get("ETag")||void 0,lastModified:c.headers.get("Last-Modified")||void 0})];case 7:return[2,(E.sent(),u)];case 8:l=E.sent();if(q.error("Error fetching latest version for ".concat(e,": ").concat(l.message)),s)return[2,(q.warn("Falling back to cached version for ".concat(e,": ").concat(s.version)),s.version)];throw l;case 9:return[2]}})});return eh.apply(this,arguments)}function em(e){return eg.apply(this,arguments)}function eg(){eg=o(function(e){var r,t,n,s,o;return b(this,function(a){switch(a.label){case 0:r={isInstalled:!1,isCurrentProject:!1,installedPath:"",installedVersion:"",latestVersion:"",file:{}};a.label=1;case 1:a.trys.push([1,6,,7]);t=ed(e);n=t;if(!n)return[3,5];r.file=t.file,r.isInstalled=!0,r.installedPath=t.path,r.installedVersion=t.file.version,r.isCurrentProject=t.isCurrentProject;if(!t.isCurrentProject)return[3,2];s=t.file.version;return[3,4];case 2:return[4,ev(e,!0)];case 3:s=a.sent();a.label=4;case 4:n=r.latestVersion=s;a.label=5;case 5:return[2,(n,r)];case 6:o=a.sent();return[2,(q.error('Error checking package "'.concat(e,'": ').concat(o.message)),r)];case 7:return[2]}})});return eg.apply(this,arguments)}var ep=F.promisify(x);function e_(e){return"error_list:".concat(e)}function eS(e){return ey.apply(this,arguments)}function ey(){ey=o(function(e){var r,t,n;return b(this,function(s){switch(s.label){case 0:if(e.length===0)return[2];r=Date.now(),t=e_(r);s.label=1;case 1:s.trys.push([1,3,,4]);return[4,ef.set(t,{errors:e,timestamp:r})];case 2:s.sent(),setTimeout(/*#__PURE__*/o(function(){var e;return b(this,function(r){switch(r.label){case 0:return[4,ef.getLogLink(t)];case 1:e=r.sent();e&&q.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})}),10);return[3,4];case 3:n=s.sent();q.error("Failed to save errors: ".concat(n.message));return[3,4];case 4:return[2]}})});return ey.apply(this,arguments)}function eO(){return eA.apply(this,arguments)}function eA(){eA=o(function(){var e,r,t;return b(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,ef.keys()];case 1:e=n.sent(),r=Array.isArray(e)?e.filter(function(e){var r;return e===null||e===void 0?void 0:(r=e.startsWith)===null||r===void 0?void 0:r.call(e,"error_list:")}):[];return[4,Promise.all(r.map(/*#__PURE__*/function(){var e=o(function(e){var r;return b(this,function(t){switch(t.label){case 0:return[4,ef.get(e)];case 1:return[2,((r=t.sent())===null||r===void 0?void 0:r.errors)||[]]}})});return function(r){return e.apply(this,arguments)}}()))];case 2:return[2,n.sent().flat()];case 3:t=n.sent();return[2,(q.error("Failed to retrieve stored errors: ".concat(t.message)),[])];case 4:return[2]}})});return eA.apply(this,arguments)}function eN(){return eC.apply(this,arguments)}function eC(){eC=o(function(){var e,r,t;return b(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,ef.keys()];case 1:e=n.sent(),r=Array.isArray(e)?e.filter(function(e){var r;return e===null||e===void 0?void 0:(r=e.startsWith)===null||r===void 0?void 0:r.call(e,"error_list:")}):[];return[4,Promise.all(r.map(function(e){return ef.remove(e)}))];case 2:n.sent();return[3,4];case 3:t=n.sent();q.error("Failed to clear error lists: ".concat(t.message));return[3,4];case 4:return[2]}})});return eC.apply(this,arguments)}function eR(e){var r=[],t=[],n="",s=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,o=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,a=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))n=e.trim();else{var i=s.exec(e)||[],c=o.exec(e)||[],u=a.exec(e)||[];i.length&&n?r.push({file:n,position:"".concat(i[1],":").concat(i[2]),type:i[3]==="error"?"error":"warning",message:i[4].trim(),rule:i[5].trim()}):c.length?r.push({file:c[1],position:"".concat(c[2],":").concat(c[3]),type:c[4]==="error"?"error":"warning",message:c[5].trim()}):u.length?r.push({file:"commitlint",type:"error",message:u[1].trim(),rule:u[2].trim()}):t.push(e.trim())}}),r.length&&eS(r),M&&t.length&&(q.warn("Unmatched lines:"),t.forEach(function(e){return q.info(" ".concat(e))}))}function eI(e){try{var r=JSON.parse(e),t=[];r.forEach(function(e){var r=e.filePath,n=e.messages;n.forEach(function(e){var n=e.severity,s=e.line,o=e.column,a=e.ruleId,i=e.message;t.push({type:n===2?"error":"warning",file:r,position:"".concat(s,":").concat(o),rule:a,message:i})})}),t.length&&eS(t)}catch(r){eR(e)}}function eD(e){return eT.apply(this,arguments)}function eT(){eT=o(function(e){var r,t,n,s,o,a,i,c,u;var l=arguments;return b(this,function(f){switch(f.label){case 0:r=l.length>1&&l[1]!==void 0?l[1]:eI;t=new AbortController;j.on("SIGINT",function(){q.warn("Process interrupted. Terminating..."),t.abort(),j.exit()});f.label=1;case 1:f.trys.push([1,3,,4]);return[4,ep(e,{maxBuffer:0x6400000,signal:t.signal})];case 2:n=f.sent(),s=n.stdout,o=n.stderr;[s,o].forEach(function(e){return e&&r(e)});return[3,4];case 3:a=f.sent();i=a.stdout,c=a.stderr,u=a.message;[i,c].forEach(function(e){return e&&r(e)}),!c&&!i&&q.error("Command failed: ".concat(u));return[3,4];case 4:return[2]}})});return eT.apply(this,arguments)}function eb(e){return{raw:!0,cmd:e}}function eP(e,r){return(r===null||r===void 0?void 0:r.isRemote)?"".concat(re," ").concat(ek," ").concat(e):(r===null||r===void 0?void 0:r.isCurrentProject)?"".concat(re," ").concat(e8," src/cli.ts ").concat(e):"".concat(re," ").concat(eW," ").concat(e)}function ew(e,r){return typeof e=="function"?eP(e(r),r):(typeof e==="undefined"?"undefined":I(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?eP(e,r):e}function eM(e){return eL.apply(this,arguments)}function eL(){eL=o(function(e){var r,t,n,s,o,a,i;var c=arguments;return b(this,function(u){switch(u.label){case 0:r=c.length>1&&c[1]!==void 0?c[1]:{};n=(t=r===null||r===void 0?void 0:r.isRemote)!==null&&t!==void 0?t:!1;if(!n)return[3,1];i=!1;return[3,3];case 1:return[4,em(ek)];case 2:i=u.sent().isCurrentProject;u.label=3;case 3:s=i,o={isRemote:n,isCurrentProject:s},a=typeof e=="function"?e(o):e;return[2,Object.fromEntries(Object.entries(a).map(function(e){var r=C(e,2),t=r[0],n=r[1];return[t,ew(n,o)]}))]}})});return eL.apply(this,arguments)}var eG=G.env.INIT_CWD||G.cwd(),ek="@cyberskill/shared",eU=".cyberskill-storage",ex="node_modules",ej="dist",eF="package.json",eV="package-lock.json",eK="tsconfig.json",eY=".gitignore",eQ=".simple-git-hooks.json",eH="pnpm-lock.yaml",eB=".git/hooks/",eq=".git/COMMIT_EDITMSG",eJ=es(eG,ex,ek,ej),eW="cyberskill",eX="eslint",ez="eslint",e$="vitest",eZ="playwright",e0="vitest",e2="@commitlint/cli",e1="commitlint",e3="lint-staged",e4="lint-staged",e5="typescript",e6="tsc",e8="tsx",e7="git",e9="pnpm",re="pnpm exec",rr="simple-git-hooks",rt="simple-git-hooks",rn="@eslint/config-inspector",rs="eslint-config-inspector",ro="node-modules-inspector",ra="node-modules-inspector",ri={CYBERSKILL_DIRECTORY:eJ,WORKING_DIRECTORY:eG,TS_CONFIG:et(eK),GIT_IGNORE:et(eY),GIT_HOOK:et(eB),GIT_COMMIT_MSG:et(eq),SIMPLE_GIT_HOOKS_JSON:et(eQ),PACKAGE_JSON:et(eF),PACKAGE_LOCK_JSON:et(eV),PNPM_LOCK_YAML:et(eH),NODE_MODULES:et(ex),CYBERSKILL:{LINT_STAGED_CONFIG:et("".concat(eJ,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:et("".concat(eJ,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:et("".concat(eJ,"/configs/vitest/react/unit.js")),UNIT_TEST_SETUP_CONFIG:et("".concat(eJ,"/configs/vitest/react/unit.setup.js")),E2E_TEST_CONFIG:et("".concat(eJ,"/configs/vitest/react/e2e.js"))}};function rc(e){var r=e.isCurrentProject;return p({"pre-commit":e4,"commit-msg":e1},r&&{"pre-push":eb("".concat(e7," pull"))})}function ru(e){for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++){t[n-1]=arguments[n]}var s=C(t,2),o=s[0],a=s[1],i=e==="RAW"?!0:X.apply(void 0,R(o.split(" ").map(function(e){return es(ri.NODE_MODULES,e)})));switch(e){case"PNPM_ADD_AND_EXEC":return ew(eb("".concat(i?"":"".concat(e9," add ").concat(o," && ")).concat(re," ").concat(a)));case"PNPM_ADD_DEV_AND_EXEC":return ew(eb("".concat(i?"":"".concat(e9," add -D ").concat(o," && ")).concat(re," ").concat(a)));case"RAW":return ew(eb(o))}}var rl={SIMPLE_GIT_HOOKS:ru("PNPM_ADD_DEV_AND_EXEC",rr,rt),ESLINT_INSPECT:ru("PNPM_ADD_DEV_AND_EXEC",rn,rs),NODE_MODULES_INSPECT:ru("PNPM_ADD_DEV_AND_EXEC",ro,ra),ESLINT_CHECK:ru("PNPM_ADD_DEV_AND_EXEC",eX,"".concat(ez," ").concat(ri.WORKING_DIRECTORY)),ESLINT_FIX:ru("PNPM_ADD_DEV_AND_EXEC",eX,"".concat(ez," ").concat(ri.WORKING_DIRECTORY," --fix")),TYPESCRIPT_CHECK:ru("PNPM_ADD_AND_EXEC",e5,"".concat(e6," -p ").concat(ri.TS_CONFIG," --noEmit")),CONFIGURE_GIT_HOOK:ru("RAW","".concat(e7," config core.hooksPath ").concat(ri.GIT_HOOK)),BUILD:ru("RAW","".concat(e9," run build")),STAGE_BUILD_DIRECTORY:ru("RAW","".concat(e7," add ").concat(ej)),PNPM_INSTALL_STANDARD:ru("RAW","".concat(e9," install")),PNPM_INSTALL_LEGACY:ru("RAW","".concat(e9," install --legacy-peer-deps")),PNPM_INSTALL_FORCE:ru("RAW","".concat(e9," install --force")),CYBERSKILL:{TEST_UNIT:ru("PNPM_ADD_AND_EXEC",e$,"".concat(e0," --config ").concat(ri.CYBERSKILL.UNIT_TEST_CONFIG)),TEST_E2E:ru("PNPM_ADD_AND_EXEC","".concat(e$," ").concat(eZ),"".concat(e0," --config ").concat(ri.CYBERSKILL.E2E_TEST_CONFIG)),COMMIT_LINT:ru("PNPM_ADD_DEV_AND_EXEC",e2,"".concat(e1," --edit ").concat(ri.GIT_COMMIT_MSG," --config ").concat(ri.CYBERSKILL.COMMITLINT_CONFIG)),LINT_STAGED:ru("PNPM_ADD_DEV_AND_EXEC",e3,"".concat(e4," --config ").concat(ri.CYBERSKILL.LINT_STAGED_CONFIG))}};import{format as rf}from"date-fns";import{Document as rE}from"mongoose";import rd from"mongoose-aggregate-paginate-v2";import rv from"mongoose-paginate-v2";import{v4 as rh}from"uuid";import rm from"crypto-js";import rg from"slugify";var rp=rg.default||rg;function r_(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",r=arguments.length>1?arguments[1]:void 0;var t=r||{},n=t.lower,s=n===void 0?!0:n,o=t.locale,a=o===void 0?"vi":o,i=y(t,["lower","locale"]);return rp(e,p({lower:s,locale:a},i))}function rS(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:4;return rm.SHA256(e).toString(rm.enc.Hex).slice(0,r)}var ry={isEmpty:function e(e){return e==null?!0:Array.isArray(e)?e.length===0:(typeof e==="undefined"?"undefined":I(e))=="object"?d(e,Date)?!1:Object.keys(e).length===0:typeof e=="string"?e.trim().length===0:!1}};var rO={getDateTime:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:new Date;return rf(e,"yyyy-MM-dd HH:mm:ss.SSS")},createGenericFields:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=e.returnDateAs,t=r===void 0?"string":r;var n=t==="string"?rO.getDateTime():new Date;return{id:rh(),isDel:!1,createdAt:n,updatedAt:n}},applyPlugins:function e(e,r){r.filter(function(e){return typeof e=="function"}).forEach(function(r){return e.plugin(r)})},applyMiddlewares:function e(e,r){r.forEach(function(r){var t=r.method,n=r.pre,s=r.post;t&&n&&e.pre(t,n),t&&s&&e.post(t,s)})},createGenericSchema:function e(e){return new e.Schema({id:{type:String,default:rh,required:!0,unique:!0},isDel:{type:Boolean,default:!1,required:!0}},{timestamps:!0})},createSchema:function e(e){var r=e.mongoose,t=e.schema,n=e.virtuals,s=n===void 0?[]:n,o=e.standalone,a=o===void 0?!1:o;var i=new r.Schema(t,{strict:!0});return s.forEach(function(e){var r=e.name,t=e.options,n=e.get;var s=i.virtual(r,t);n&&s.get(n)}),a||i.add(rO.createGenericSchema(r)),i},createModel:function e(e){var r=e.mongoose,t=e.name,n=e.schema,s=e.pagination,o=s===void 0?!1:s,a=e.aggregate,i=a===void 0?!1:a,c=e.virtuals,u=c===void 0?[]:c,l=e.middlewares,f=l===void 0?[]:l;if(!t)throw new Error("Model name is required.");if(r.models[t])return r.models[t];var E=rO.createSchema({mongoose:r,schema:n,virtuals:u});return rO.applyPlugins(E,[o&&rv,i&&rd]),rO.applyMiddlewares(E,f),r.model(t,E)},createSlugQuery:function e(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=arguments.length>2?arguments[2]:void 0;return S(p({},r,t&&{id:{$ne:t}}),{$or:[{slug:e},{slugHistory:e}]})},validator:{isEmpty:function e(){return /*#__PURE__*/function(){var e=o(function(e){return b(this,function(r){return[2,!ry.isEmpty(e)]})});return function(r){return e.apply(this,arguments)}}()},isUnique:function e(e){return /*#__PURE__*/function(){var r=o(function(r){var t;return b(this,function(n){switch(n.label){case 0:if(!Array.isArray(e)||e.length===0)throw new Error("Fields must be a non-empty array of strings.");t={$or:e.map(function(e){return l({},e,r)})};return[4,this.constructor.findOne(t)];case 1:return[2,!n.sent()]}})});return function(e){return r.apply(this,arguments)}}()},matchesRegex:function e(e){return /*#__PURE__*/function(){var r=o(function(r){return b(this,function(t){if(!Array.isArray(e)||e.some(function(e){return!d(e,RegExp)}))throw new Error("regexArray must be an array of valid RegExp objects.");return[2,e.every(function(e){return e.test(r)})]})});return function(e){return r.apply(this,arguments)}}()}}},rA=/*#__PURE__*/function(){"use strict";function e(r,t){i(this,e);this.collection=r.collection(t)}u(e,[{key:"createOne",value:function e(e){var r=this;return o(function(){var t,n,s;return b(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);t=p({},rO.createGenericFields(),e);n={success:!0,message:"Document created successfully"};return[4,r.collection.insertOne(t)];case 1:return[2,(n.result=o.sent(),n)];case 2:s=o.sent();return[2,{success:!1,message:s.message}];case 3:return[2]}})})()}},{key:"createMany",value:function e(e){var r=this;return o(function(){var t,n,s;return b(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);t=e.map(function(e){return p({},rO.createGenericFields(),e)});return[4,r.collection.insertMany(t)];case 1:n=o.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=o.sent();return[2,{success:!1,message:s.message}];case 3:return[2]}})})()}},{key:"findOne",value:function e(e){var r=this;return o(function(){var t,n;return b(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);return[4,r.collection.findOne(e)];case 1:t=s.sent();return[2,t?{success:!0,message:"Document found",result:t}:{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 r=this;return o(function(){var t,n;return b(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);t={success:!0,message:"Documents retrieved successfully"};return[4,r.collection.find(e).toArray()];case 1:return[2,(t.result=s.sent(),t)];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 r=this;return o(function(){var t,n;return b(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);t={success:!0,message:"Count retrieved successfully"};return[4,r.collection.countDocuments(e)];case 1:return[2,(t.result=s.sent(),t)];case 2:n=s.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})})()}},{key:"updateOne",value:function e(e,r){var t=this;return o(function(){var n,s;return b(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);return[4,t.collection.updateOne(e,{$set:r})];case 1:n=o.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=o.sent();return[2,{success:!1,message:s.message}];case 3:return[2]}})})()}},{key:"updateMany",value:function e(e,r){var t=this;return o(function(){var n,s;return b(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);return[4,t.collection.updateMany(e,{$set:r})];case 1:n=o.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=o.sent();return[2,{success:!1,message:s.message}];case 3:return[2]}})})()}},{key:"deleteOne",value:function e(e){var r=this;return o(function(){var t,n;return b(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);return[4,r.collection.deleteOne(e)];case 1:t=s.sent();return[2,t.deletedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Document deleted successfully",result:t}];case 2:n=s.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})})()}},{key:"deleteMany",value:function e(e){var r=this;return o(function(){var t,n;return b(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);return[4,r.collection.deleteMany(e)];case 1:t=s.sent();return[2,t.deletedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Documents deleted successfully",result:t}];case 2:n=s.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})})()}}]);return e}(),rN=/*#__PURE__*/function(){"use strict";function e(r){i(this,e);this.model=r}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]:{},r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=arguments.length>3?arguments[3]:void 0;var s=this;return o(function(){var o,a,i;return b(this,function(c){switch(c.label){case 0:c.trys.push([0,2,,3]);o=s.model.findOne(e,r,t);n&&o.populate(n);return[4,o.exec()];case 1:a=c.sent();return[2,a?{success:!0,result:a}:{success:!1,message:"No ".concat(s.getModelName()," found."),code:Q.NOT_FOUND.CODE}];case 2:i=c.sent();return[2,{success:!1,message:i.message,code:Q.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"findAll",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=arguments.length>3?arguments[3]:void 0;var s=this;return o(function(){var o,a,i;return b(this,function(c){switch(c.label){case 0:c.trys.push([0,2,,3]);o=s.model.find(e,r,t);n&&o.populate(n);a={success:!0};return[4,o.exec()];case 1:return[2,(a.result=c.sent(),a)];case 2:i=c.sent();return[2,{success:!1,message:i.message,code:Q.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"findPaging",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var t=this;return o(function(){var n,s;return b(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);n={success:!0};return[4,t.model.paginate(e,r)];case 1:return[2,(n.result=o.sent(),n)];case 2:s=o.sent();return[2,{success:!1,message:s.message,code:Q.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"findPagingAggregate",value:function e(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var t=this;return o(function(){var n,s;return b(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);n={success:!0};return[4,t.model.aggregatePaginate(t.model.aggregate(e),r)];case 1:return[2,(n.result=o.sent(),n)];case 2:s=o.sent();return[2,{success:!1,message:s.message,code:Q.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 r=this;return o(function(){var t,n;return b(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);t={success:!0};return[4,r.model.countDocuments(e)];case 1:return[2,(t.result=s.sent(),t)];case 2:n=s.sent();return[2,{success:!1,message:n.message,code:Q.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"createOne",value:function e(e){var r=this;return o(function(){var t,n;return b(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);t={success:!0};return[4,r.model.create(e)];case 1:return[2,(t.result=s.sent(),t)];case 2:n=s.sent();return[2,{success:!1,message:n.message,code:Q.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"createMany",value:function e(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var t=this;return o(function(){var n,s;return b(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);n={success:!0};return[4,t.model.insertMany(e,r)];case 1:return[2,(n.result=o.sent().map(function(e){return d(e,rE)?e.toObject():null}).filter(function(e){return e!==null}),n)];case 2:s=o.sent();return[2,{success:!1,message:s.message,code:Q.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"updateOne",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var n=this;return o(function(){var s,o;return b(this,function(a){switch(a.label){case 0:a.trys.push([0,2,,3]);return[4,n.model.findOneAndUpdate(e,r,p({new:!0},t)).exec()];case 1:s=a.sent();return[2,s?{success:!0,result:s}:{success:!1,message:"Failed to update ".concat(n.getModelName(),"."),code:Q.NOT_FOUND.CODE}];case 2:o=a.sent();return[2,{success:!1,message:o.message,code:Q.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"updateMany",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var n=this;return o(function(){var s,o;return b(this,function(a){switch(a.label){case 0:a.trys.push([0,2,,3]);s={success:!0};return[4,n.model.updateMany(e,r,t).exec()];case 1:return[2,(s.result=a.sent(),s)];case 2:o=a.sent();return[2,{success:!1,message:o.message,code:Q.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"deleteOne",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var t=this;return o(function(){var n,s;return b(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);return[4,t.model.findOneAndDelete(e,r).exec()];case 1:n=o.sent();return[2,n?{success:!0,result:n}:{success:!1,message:"No ".concat(t.getModelName()," found to delete."),code:Q.NOT_FOUND.CODE}];case 2:s=o.sent();return[2,{success:!1,message:s.message,code:Q.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"deleteMany",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var t=this;return o(function(){var n,s;return b(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);return[4,t.model.deleteMany(e,r).exec()];case 1:n=o.sent();return[2,n.deletedCount===0?{success:!1,message:"No documents found to delete.",code:Q.NOT_FOUND.CODE}:{success:!0,result:n}];case 2:s=o.sent();return[2,{success:!1,message:s.message,code:Q.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"createShortId",value:function e(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:4;var t=this;return o(function(){var n,s,o,a;return b(this,function(i){switch(i.label){case 0:n=new Set;s=0;i.label=1;case 1:if(!(s<10))return[3,5];o=rS(e,s+r);a=!n.has(o);if(!a)return[3,3];n.add(o);return[4,t.model.exists({shortId:o})];case 2:a=!i.sent();i.label=3;case 3:if(a)return[2,{success:!0,result:o}];i.label=4;case 4:s++;return[3,1];case 5:return[2,{success:!1,message:"Failed to create a unique shortId",code:Q.INTERNAL_SERVER_ERROR.CODE}]}})})()}},{key:"createSlug",value:function e(e,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var n=this;return o(function(){var s,a,i,c,u,l,f,E,d,v,h;return b(this,function(m){switch(m.label){case 0:m.trys.push([0,8,,9]);s=r[e],a=/*#__PURE__*/function(){var e=o(function(e){var s,o,a;return b(this,function(i){switch(i.label){case 0:return[4,n.model.findOne(rO.createSlugQuery(e,t,r.id))];case 1:s=i.sent();if(!s)return[2,e];o=1;i.label=2;case 2:a="".concat(e,"-").concat(o);return[4,n.model.findOne(rO.createSlugQuery(a,t,r.id))];case 3:s=i.sent(),o++;i.label=4;case 4:if(s)return[3,2];i.label=5;case 5:return[2,a]}})});return function r(r){return e.apply(this,arguments)}}();if(!((typeof s==="undefined"?"undefined":I(s))=="object"))return[3,5];i={};c=[];for(u in s)c.push(u);l=0;m.label=1;case 1:if(!(l<c.length))return[3,4];f=c[l];E=r_(s[f]);return[4,a(E)];case 2:i[f]=m.sent();m.label=3;case 3:l++;return[3,1];case 4:return[2,{success:!0,result:i}];case 5:d=r_(s);v={success:!0};return[4,a(d)];case 6:return[2,(v.result=m.sent(),v)];case 7:return[3,9];case 8:h=m.sent();return[2,{success:!1,message:"Failed to create a unique slug: ".concat(h.message),code:Q.INTERNAL_SERVER_ERROR.CODE}];case 9:return[2]}})})()}},{key:"aggregate",value:function e(e){var r=this;return o(function(){var t,n;return b(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);t={success:!0};return[4,r.model.aggregate(e)];case 1:return[2,(t.result=s.sent(),t)];case 2:n=s.sent();return[2,{success:!1,message:n.message,code:Q.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}}]);return e}();import{ApolloClient as rC,ApolloError as rR,ApolloLink as rI,ApolloProvider as rD,from as rT,HttpLink as rb,InMemoryCache as rP,split as rw}from"@apollo/client";import{onError as rM}from"@apollo/client/link/error";import{removeTypenameFromVariables as rL}from"@apollo/client/link/remove-typename";import{GraphQLWsLink as rG}from"@apollo/client/link/subscriptions";import{getMainDefinition as rk}from"@apollo/client/utilities";import{createClient as rU}from"graphql-ws";import{useMemo as rx}from"react";import{toast as rj,Toaster as rF}from"react-hot-toast";import{FaQuestion as rV}from"react-icons/fa6";import{createContext as rK,use as rY,useEffect as rQ,useMemo as rH,useState as rB}from"react";import{FaRepeat as rq}from"react-icons/fa6";import rJ from"./react/apollo-error.module.scss";import{jsx as rW,jsxs as rX}from"react/jsx-runtime";var rz=rK(void 0);function r$(){var e=rY(rz);if(!e)throw new Error("useApolloErrorViewer must be used within ApolloErrorViewerProvider");return e}var rZ=null;function r0(e){rZ=e}function r2(e){rZ&&rZ(e)}function r1(e){var r=e.children;var t=C(rB(null),2),n=t[0],s=t[1];rQ(function(){r0(s)},[]);var o=rH(function(){return{error:n,showError:s,hideError:function(){return s(null)}}},[n]);return rW(rz,{value:o,children:r})}function r3(){var e,r,t;var n=rY(rz);if(!n||!n.error)return null;var s=n.error,o=n.hideError;return rW("div",{className:rJ["modal-backdrop"],children:rX("div",{className:rJ["modal-content"],children:[rW("button",{type:"button",className:rJ["btn-close"],onClick:o,children:"✕"}),rW("div",{className:rJ["error-title"],children:s.message}),rX("div",{className:rJ["error-details"],children:[s.networkError&&rX("pre",{className:"network",children:[rW("strong",{children:"Network Error:"}),"\xa0",s.networkError.message]}),((e=s.graphQLErrors)===null||e===void 0?void 0:e.length)>0&&rX("div",{children:[rW("strong",{children:"GraphQL Errors:"}),rW("ul",{children:s.graphQLErrors.map(function(e){return rW("li",{children:e.message},e.message)})})]}),((r=s.protocolErrors)===null||r===void 0?void 0:r.length)>0&&rX("div",{children:[rW("strong",{children:"Protocol Errors:"}),rW("ul",{children:s.protocolErrors.map(function(e){return rW("li",{children:e.message},e.message)})})]}),((t=s.clientErrors)===null||t===void 0?void 0:t.length)>0&&rX("div",{children:[rW("strong",{children:"Client Errors:"}),rW("ul",{children:s.clientErrors.map(function(e){return rW("li",{children:e.message},e.message)})})]}),s.extraInfo&&rX("pre",{className:"extra",children:[rW("strong",{children:"Extra Info:"}),"\xa0",JSON.stringify(s.extraInfo,null,4)]})]}),rW("button",{type:"button",className:rJ["btn-retry"],onClick:function(){return window.location.reload()},children:rW(rq,{})})]})})}import{Fragment as r4,jsx as r5,jsxs as r6}from"react/jsx-runtime";var r8=/*#__PURE__*/function(e){"use strict";E(r,e);function r(){i(this,r);var e;e=a(this,r,arguments);e.count=0;return e}u(r,[{key:"request",value:function e(e,r){var t=this;var n=Date.now();return this.count+=1,r(e).map(function(r){var s=Date.now()-n,o=e.operationName||"Unnamed";return q.info("[Apollo] #".concat(t.count,": ").concat(o," (").concat(s,"ms)")),r})}}]);return r}(rI);function r7(e){var r=e||{},t=r.uri,n=r.wsUrl,s=r.customLinks,o=new r8,a=rM(function(e){var r=e.graphQLErrors,t=e.networkError,n=e.protocolErrors,s=e.operation;var o=(s===null||s===void 0?void 0:s.operationName)||"Unknown";if(r&&r.forEach(function(e){var r=e.message,t=e.locations,n=e.path;q.error("[GraphQL error] ".concat(o,": ").concat(r,", Location: ").concat(JSON.stringify(t),", Path: ").concat(n))}),n&&n.forEach(function(e){var r=e.message,t=e.extensions;q.error("[Protocol error]: ".concat(r,", Extensions: ").concat(JSON.stringify(t)))}),t&&q.error("[Network error]: ".concat(t)),r||n||t){var a,i;var c=(r===null||r===void 0?void 0:(a=r[0])===null||a===void 0?void 0:a.message)||(n===null||n===void 0?void 0:(i=n[0])===null||i===void 0?void 0:i.message)||(t===null||t===void 0?void 0:t.message)||"Unexpected error",u=new rR({graphQLErrors:r||[],protocolErrors:n||[],clientErrors:[],networkError:t||null,errorMessage:c,extraInfo:{operation:s}});rj.error(function(e){return r6(r4,{children:[c,"\xa0",r5(rV,{onClick:function(){setTimeout(function(){r2(u)},0),rj.dismiss(e.id)}})]})})}}),i=rL();t||q.warn('[Apollo] No GraphQL URI provided — using "'.concat(L,'" as default'));var c=new rb({uri:t!==null&&t!==void 0?t:L,credentials:"include"}),u=n?new rG(rU({url:n})):rI.empty(),l=d(u,rI)?rw(function(e){var r=e.query;var t=rk(r);return t.kind==="OperationDefinition"&&t.operation==="subscription"},u,c):c;return l===c&&n&&q.warn("[Apollo] WS URL is set, but subscriptions fallback to HTTP. Check your wsLink config."),[o,a,i].concat(R(s!==null&&s!==void 0?s:[]),[l])}function r9(e){var r=e.isNextJS,t=e.options,n=e.children,s=e.client,o=e.provider,a=e.cache;var i=t||{},c=i.uri,u=i.wsUrl,l=i.customLinks,f=y(i,["uri","wsUrl","customLinks"]);if(typeof(s!==null&&s!==void 0?s:rC)!="function")throw new TypeError("Invalid ApolloClient provided. Ensure CustomClient is a class.");var E=o||rD,v=rx(function(){return rT(r7({uri:c,wsUrl:u,customLinks:l}))},[c,u,l]),h=rx(function(){return new rC(p({link:v,cache:d(a,rP)?a:new rP},f))},[v,a,f]),m=r?r5(E,{makeClient:function(){return h},children:n}):r5(E,{client:h,children:n});return r?r5(E,{makeClient:function(){return h},children:n}):r6(r4,{children:[r6(r1,{children:[m,r5(r3,{})]}),r5(rF,{position:"top-right"})]})}import te from"classnames";import{createContext as tr,use as tt,useCallback as tn,useMemo as ts,useState as to}from"react";import ta from"./react/loading.module.scss";import{jsx as ti,jsxs as tc}from"react/jsx-runtime";var tu=tr(void 0);function tl(){var e=tt(tu);if(!e)throw new Error("useLoading must be used within a LoadingProvider");return e}function tf(e){var r=e.full,t=r===void 0?!1:r,n=e.block,s=n===void 0?!1:n,o=e.className,a=o===void 0?"":o,i=e.message,c=i===void 0?"Loading":i,u=y(e,["full","block","className","message"]);function l(){return tc("div",S(p({className:ta.container},u),{children:[ti("div",{className:ta.ring}),ti("div",{className:ta.ring}),ti("div",{className:ta.ring}),ti("div",{className:ta.ring}),c&&ti("div",{className:ta.message,children:c})]}))}return t?ti("div",{className:te(ta.fullscreen,a),children:l()}):s?ti("div",{className:te(ta.block,a),children:l()}):l()}function tE(e){var r=e.children;var t=C(to(!1),2),n=t[0],s=t[1],o=C(to(!1),2),a=o[0],i=o[1],c=tn(function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;s(!0),i(e)},[]),u=tn(function(){s(!1),i(!1)},[]),l=ts(function(){return{isLoading:n,isGlobalLoading:a,showLoading:c,hideLoading:u}},[n,a,c,u]);return ti(tu,{value:l,children:n?ti(tf,{full:a}):r})}import{NextIntlClientProvider as td,useTranslations as tv}from"next-intl";import{createContext as th,use as tm,useMemo as tg}from"react";import{useCallback as tp,useEffect as t_,useState as tS}from"react";var ty={serialize:function(e){return JSON.stringify(e,function(e,r){return d(r,Date)?{__type:"Date",value:r.toISOString()}:r})},deserialize:function(e){return JSON.parse(e,function(e,r){return(r===null||r===void 0?void 0:r.__type)==="Date"?new Date(r.value):r})}};import tO from"localforage";var tA={get:function e(e){return o(function(){var r;return b(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,tO.getItem(e)];case 1:return[2,t.sent()];case 2:r=t.sent();return[2,(q.error('[Storage:get] Error getting key "'.concat(e,'":'),r),null)];case 3:return[2]}})})()},set:function e(e,r){return o(function(){var t;return b(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,tO.setItem(e,r)];case 1:n.sent();return[3,3];case 2:t=n.sent();q.error('[Storage:set] Error setting key "'.concat(e,'":'),t);return[3,3];case 3:return[2]}})})()},remove:function e(e){return o(function(){var r;return b(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,tO.removeItem(e)];case 1:t.sent();return[3,3];case 2:r=t.sent();q.error('[Storage:remove] Error removing key "'.concat(e,'":'),r);return[3,3];case 3:return[2]}})})()},keys:function e(){return o(function(){var e,r;return b(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,tO.keys()];case 1:return[2,(e=t.sent())!==null&&e!==void 0?e:[]];case 2:r=t.sent();return[2,(q.error("[Storage:keys] Error getting keys:",r),[])];case 3:return[2]}})})()}};function tN(e,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ty;var n=C(tS(r),2),s=n[0],a=n[1],i=C(tS(!1),2),c=i[0],u=i[1];t_(function(){var n=!0;return o(function(){var s,o,i,c;return b(this,function(l){switch(l.label){case 0:l.trys.push([0,6,7,8]);return[4,tA.get(e)];case 1:s=l.sent();if(!n)return[3,5];if(!(s!==null))return[3,2];o=t.deserialize(s);a(o);return[3,5];case 2:if(!(r!==void 0))return[3,4];i=t.serialize(r);return[4,tA.set(e,i)];case 3:l.sent(),a(r);return[3,5];case 4:a(void 0);l.label=5;case 5:return[3,8];case 6:c=l.sent();q.error('Error loading value for key "'.concat(e,'":'),c),n&&a(r);return[3,8];case 7:n&&u(!0);return[7];case 8:return[2]}})})(),function(){n=!1,u(!1)}},[e,r,t]),t_(function(){if(!c)return;o(function(){var r,n;return b(this,function(o){switch(o.label){case 0:o.trys.push([0,3,,4]);if(!(s!==void 0))return[3,2];r=t.serialize(s);return[4,tA.set(e,r)];case 1:o.sent();o.label=2;case 2:return[3,4];case 3:n=o.sent();q.error('Error saving value for key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},[s,e,t,c]);var l=tp(function(e){a(function(r){return typeof e=="function"?e(r):e})},[]),f=tp(/*#__PURE__*/o(function(){var r;return b(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,tA.remove(e)];case 1:t.sent(),a(void 0);return[3,3];case 2:r=t.sent();q.error('Error removing key "'.concat(e,'":'),r);return[3,3];case 3:return[2]}})}),[e]);return{value:s,set:l,remove:f}}import{Fragment as tC,jsx as tR}from"react/jsx-runtime";var tI=th(void 0);function tD(){var e=tm(tI);if(!e)throw new Error("useNextIntl must be used within a NextIntlProvider");return e}var tT=tv;function tb(e){var r=function(r){var t;var n=tD(),s=n.currentLanguage,o=r.messages,a=r.languages,i="en",c=o[(s===null||s===void 0?void 0:s.value)||i],u=(t=a.find(function(e){return e.value===(s===null||s===void 0?void 0:s.value)}))===null||t===void 0?void 0:t.timezone;return o?tR(td,{locale:(s===null||s===void 0?void 0:s.value)||i,messages:c,timeZone:u,children:tR(e,p({},r))}):(q.warn("Missing messages for language: ".concat((s===null||s===void 0?void 0:s.value)||i)),null)};return r.displayName="withNextIntl(".concat(e.displayName||e.name||"Component",")"),r}function tP(e){var r=e.children;return tR(tC,{children:r})}var tw=tb(tP);function tM(e){var r=e.children,t=e.languages,n=e.messages;var s;var o=tN("lang",(s=t===null||t===void 0?void 0:t[0])!==null&&s!==void 0?s:{}),a=o.value,i=o.set,c=tg(function(){return{languages:t,currentLanguage:a,setCurrentLanguage:i}},[t,i,a]);return tR(tI,{value:c,children:tR(tw,{languages:t,messages:n,children:r})})}var tL=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}(tL||{});import{Collection as tG,Db as tk}from"mongodb";import{Document as tU,Model as tx}from"mongoose";var tj=/*#__PURE__*/function(e){"use strict";E(r,e);function r(){i(this,r);return a(this,r,arguments)}return r}(tk),tF=/*#__PURE__*/function(e){"use strict";E(r,e);function r(){i(this,r);return a(this,r,arguments)}return r}(tU),tV=/*#__PURE__*/function(e){"use strict";E(r,e);function r(){i(this,r);return a(this,r,arguments)}return r}(tx),tK=/*#__PURE__*/function(e){"use strict";E(r,e);function r(){i(this,r);return a(this,r,arguments)}return r}(tG);import tY from"unorm";function tQ(e){try{return JSON.parse(e),!0}catch(e){return!1}}function tH(e){return!!e&&(typeof e==="undefined"?"undefined":I(e))=="object"&&!Array.isArray(e)}function tB(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++){r[t]=arguments[t]}return r.flat().reduce(function(e,r){var t=true,n=false,s=undefined;try{for(var o=Object.entries(r)[Symbol.iterator](),a;!(t=(a=o.next()).done);t=true){var i=C(a.value,2),c=i[0],u=i[1];var l=e[c];Array.isArray(u)?e[c]=Array.from(new Set(R(Array.isArray(l)?l:[]).concat(R(u)))):tH(u)?e[c]=tB(tH(l)?l:{},u):e[c]=u}}catch(e){n=true;s=e}finally{try{if(!t&&o.return!=null){o.return()}}finally{if(n){throw s}}}return e},{})}var tq={a:["\xe0","\xe1","ạ","ả","\xe3","\xe2","ầ","ấ","ậ","ẩ","ẫ","ă","ằ","ắ","ặ","ẳ","ẵ"],e:["\xe8","\xe9","ẹ","ẻ","ẽ","\xea","ề","ế","ệ","ể","ễ"],i:["\xec","\xed","ị","ỉ","ĩ"],o:["\xf2","\xf3","ọ","ỏ","\xf5","\xf4","ồ","ố","ộ","ổ","ỗ","ơ","ờ","ớ","ợ","ở","ỡ"],u:["\xf9","\xfa","ụ","ủ","ũ","ư","ừ","ứ","ự","ử","ữ"],y:["ỳ","\xfd","ỵ","ỷ","ỹ"],d:["đ"]},tJ=Object.entries(tq).reduce(function(e,r){var t=C(r,2),n=t[0],s=t[1];return e[n.toUpperCase()]=s.map(function(e){return e.toUpperCase()}),e},{});function tW(e){e=tY.nfkc(e);var r=p({},tq,tJ);var t=true,n=false,s=undefined;try{for(var o=Object.entries(r)[Symbol.iterator](),a;!(t=(a=o.next()).done);t=true){var i=C(a.value,2),c=i[0],u=i[1];var l="[".concat(c).concat(u.join(""),"]"),f="(".concat([c].concat(R(u)).join("|"),")");e=e.replace(new RegExp(l,"g"),f)}}catch(e){n=true;s=e}finally{try{if(!t&&o.return!=null){o.return()}}finally{if(n){throw s}}}return e}function tX(e){return e.normalize("NFD").replace(RegExp("\\p{Diacritic}","gu"),"")}export{r3 as ApolloErrorViewerModal,r1 as ApolloErrorViewerProvider,r9 as ApolloProvider,ej as BUILD_DIRECTORY,rl as COMMAND,e1 as COMMIT_LINT_CLI,e2 as COMMIT_LINT_PACKAGE_NAME,eW as CYBERSKILL_CLI,eJ as CYBERSKILL_DIRECTORY,ek as CYBERSKILL_PACKAGE_NAME,eU as CYBERSKILL_STORAGE,tK as C_Collection,tj as C_Db,tF as C_Document,tV as C_Model,M as DEBUG,ez as ESLINT_CLI,rs as ESLINT_INSPECT_CLI,rn as ESLINT_INSPECT_PACKAGE_NAME,eX as ESLINT_PACKAGE_NAME,U as E_CommandType,tL as E_ConfigType,k as E_IssueType,e7 as GIT_CLI,eq as GIT_COMMIT_EDITMSG,eB as GIT_HOOK,eY as GIT_IGNORE,L as GRAPHQL_URI_DEFAULT,rc as HOOK,w as IS_BROWSER,e4 as LINT_STAGED_CLI,e3 as LINT_STAGED_PACKAGE_NAME,tf as Loading,tu as LoadingContext,tE as LoadingProvider,rA as MongoController,rN as MongooseController,ex as NODE_MODULES,ra as NODE_MODULES_INSPECT_CLI,ro as NODE_MODULES_INSPECT_PACKAGE_NAME,tI as NextIntlContext,tM as NextIntlProvider,eF as PACKAGE_JSON,eV as PACKAGE_LOCK_JSON,ri as PATH,eZ as PLAYWRIGHT_PACKAGE_NAME,e9 as PNPM_CLI,re as PNPM_EXEC_CLI,eH as PNPM_LOCK_YAML,Q as RESPONSE_STATUS,rr as SIMPLE_GIT_HOOKS_PACKAGE_NAME,rt as SIMPLE_GIT_HOOK_CLI,eQ as SIMPLE_GIT_HOOK_JSON,eK as TSCONFIG_JSON,e6 as TSC_CLI,e5 as TSC_PACKAGE_NAME,e8 as TSX_CLI,e0 as VITEST_CLI,e$ as VITEST_PACKAGE_NAME,eG as WORKING_DIRECTORY,rd as aggregatePaginate,Z as appendFileSync,em as checkPackage,eN as clearAllErrorLists,tB as deepMerge,eD as executeCommand,X as existsSync,ew as formatCommand,rS as generateShortId,r_ as generateSlug,ev as getLatestPackageVersion,ed as getPackageJson,ec as getStorageDir,eO as getStoredErrorLists,eu as initNodePersist,tQ as isJson,tH as isPlainObject,es as join,q as log,rO as mongo,rv as mongoosePaginate,eb as rawCommand,z as readFileSync,tW as regexSearchMapper,r0 as registerApolloErrorViewerCallback,tX as removeAccent,en as resolve,eM as resolveCommands,et as resolveWorkingPath,ee as rmSync,ty as serializer,r2 as showGlobalApolloError,tA as storageClient,ef as storageServer,H as throwError,r$ as useApolloErrorViewer,tl as useLoading,tD as useNextIntl,tN as useStorage,tT as useTranslateNextIntl,ry as validate,tb as withNextIntl,$ as writeFileSync};
|
|
1
|
+
function e(e,r){if(r==null||r>e.length)r=e.length;for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function r(e){if(Array.isArray(e))return e}function t(r){if(Array.isArray(r))return e(r)}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,r,t,n,s,o,a){try{var i=e[o](a);var c=i.value}catch(e){t(e);return}if(i.done){r(c)}else{Promise.resolve(c).then(n,s)}}function o(e){return function(){var r=this,t=arguments;return new Promise(function(n,o){var a=e.apply(r,t);function i(e){s(a,n,o,i,c,"next",e)}function c(e){s(a,n,o,i,c,"throw",e)}i(undefined)})}}function a(e,r,t){r=f(r);return A(e,I()?Reflect.construct(r,t||[],f(e).constructor):r.apply(e,t))}function i(e,r){if(!(e instanceof r)){throw new TypeError("Cannot call a class as a function")}}function c(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||false;n.configurable=true;if("value"in n)n.writable=true;Object.defineProperty(e,n.key,n)}}function u(e,r,t){if(r)c(e.prototype,r);if(t)c(e,t);return e}function l(e,r,t){if(r in e){Object.defineProperty(e,r,{value:t,enumerable:true,configurable:true,writable:true})}else{e[r]=t}return e}function f(e){f=Object.setPrototypeOf?Object.getPrototypeOf:function e(e){return e.__proto__||Object.getPrototypeOf(e)};return f(e)}function E(e,r){if(typeof r!=="function"&&r!==null){throw new TypeError("Super expression must either be null or a function")}e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:true,configurable:true}});if(r)N(e,r)}function d(e,r){if(r!=null&&typeof Symbol!=="undefined"&&r[Symbol.hasInstance]){return!!r[Symbol.hasInstance](e)}else{return e instanceof r}}function v(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function h(e,r){var t=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(t==null)return;var n=[];var s=true;var o=false;var a,i;try{for(t=t.call(e);!(s=(a=t.next()).done);s=true){n.push(a.value);if(r&&n.length===r)break}}catch(e){o=true;i=e}finally{try{if(!s&&t["return"]!=null)t["return"]()}finally{if(o)throw i}}return n}function m(){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 p(){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 g(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};var n=Object.keys(t);if(typeof Object.getOwnPropertySymbols==="function"){n=n.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))}n.forEach(function(r){l(e,r,t[r])})}return e}function _(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);if(r){n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})}t.push.apply(t,n)}return t}function S(e,r){r=r!=null?r:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(r))}else{_(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function y(e,r){if(e==null)return{};var t=O(e,r);var n,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++){n=o[s];if(r.indexOf(n)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(e,n))continue;t[n]=e[n]}}return t}function O(e,r){if(e==null)return{};var t={};var n=Object.keys(e);var s,o;for(o=0;o<n.length;o++){s=n[o];if(r.indexOf(s)>=0)continue;t[s]=e[s]}return t}function A(e,r){if(r&&(R(r)==="object"||typeof r==="function")){return r}return n(e)}function N(e,r){N=Object.setPrototypeOf||function e(e,r){e.__proto__=r;return e};return N(e,r)}function C(e,t){return r(e)||h(e,t)||T(e,t)||m()}function D(e){return t(e)||v(e)||T(e)||p()}function R(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function T(r,t){if(!r)return;if(typeof r==="string")return e(r,t);var n=Object.prototype.toString.call(r).slice(8,-1);if(n==="Object"&&r.constructor)n=r.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(r,t)}function I(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(I=function(){return!!e})()}function b(e,r){var t,n,s,o,a={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]};return o={next:i(0),"throw":i(1),"return":i(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function i(e){return function(r){return c([e,r])}}function c(o){if(t)throw new TypeError("Generator is already executing.");while(a)try{if(t=1,n&&(s=o[0]&2?n["return"]:o[0]?n["throw"]||((s=n["return"])&&s.call(n),0):n.next)&&!(s=s.call(n,o[1])).done)return s;if(n=0,s)o=[o[0]&2,s.value];switch(o[0]){case 0:case 1:s=o;break;case 4:a.label++;return{value:o[1],done:false};case 5:a.label++;n=o[1];o=[0];continue;case 7:o=a.ops.pop();a.trys.pop();continue;default:if(!(s=a.trys,s=s.length>0&&s[s.length-1])&&(o[0]===6||o[0]===2)){a=0;continue}if(o[0]===3&&(!s||o[1]>s[0]&&o[1]<s[3])){a.label=o[1];break}if(o[0]===6&&a.label<s[1]){a.label=s[1];s=o;break}if(s&&a.label<s[2]){a.label=s[2];a.ops.push(o);break}if(s[2])a.ops.pop();a.trys.pop();continue}o=r.call(e,a)}catch(e){o=[6,e];n=0}finally{t=s=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:true}}}var P={lint:"Check code for linting issues","lint:fix":"Fix linting issues automatically","lint:inspect":"View active ESLint configuration","lint-staged":"Run lint checks on staged files",commitlint:"Validate commit message format",setup:"Initialize project setup and dependencies",reset:"Reset the project and reinstall dependencies",inspect:"Analyze installed project dependencies","test:unit":"Run unit test suite","test:e2e":"Run end-to-end test suite"};import w from"node:process";var M=w.env.DEBUG==="true";var L=(typeof window==="undefined"?"undefined":R(window))<"u";var G="/graphql";var k={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};import U from"node:process";var x=function(e){return e.Error="error",e.Warning="warning",e}(x||{}),j=function(e){return e.PNPM_ADD_AND_EXEC="PNPM_ADD_AND_EXEC",e.PNPM_ADD_DEV_AND_EXEC="PNPM_ADD_DEV_AND_EXEC",e.RAW="RAW",e}(j||{});import{exec as F}from"node:child_process";import K from"node:process";import*as V from"node:util";import H from"chalk";import Y from"consola";import{GraphQLError as Q}from"graphql";var B={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 q(e){var r=e.message,t=e.status,n=t===void 0?B.INTERNAL_SERVER_ERROR:t,s=e.type,o=s===void 0?"graphql":s;var a;var i=(a=r!==null&&r!==void 0?r:n.MESSAGE)!==null&&a!==void 0?a:"Internal server error";throw o==="graphql"?new Q(i,{extensions:{code:n.CODE}}):new Error(i)}M||(Y.level=4);function W(e){var r=H[e];return typeof r=="function"?r:H.green}var J={silent:Y.silent,level:Y.level,fatal:Y.fatal,error:Y.error,warn:Y.warn,log:Y.log,info:Y.info,success:Y.success,ready:Y.ready,start:Y.start,box:Y.box,debug:Y.debug,trace:Y.trace,verbose:Y.verbose,printBoxedLog:function e(e,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(r===null||r===void 0?void 0:r.length)){Y.box(H.green(e));return}r.forEach(function(e){var r=e.file,n=e.position,s=e.rule,o=e.message;Y.log("".concat(H.gray("File:")," ").concat(H.blue("".concat(r).concat(n?":".concat(n):"")))),s&&Y.log(" ".concat(W(t)("Rule:")," ").concat(s)),Y.log(" ".concat(W(t)("Message:")," ").concat(o))}),Y.box(W(t)("".concat(e," : ").concat(r.length))),Y.log(H.gray("─".repeat(40)))}};import X from"node-fetch";import*as z from"node:fs";function $(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++){r[t]=arguments[t]}return r.every(function(e){return z.existsSync(e)})}function Z(e,r){var t=z.readFileSync(e,"utf-8");if(r===null||r===void 0?void 0:r.asJson)try{var n=JSON.parse(t);if((typeof n==="undefined"?"undefined":R(n))=="object"&&n!==null)return n;throw new Error("Parsed JSON is not an object or array")}catch(r){throw new Error("Failed to parse JSON from file: ".concat(e))}return t}function ee(e,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var n=t.isJson,s=n===void 0?!1:n,o=s&&(typeof r==="undefined"?"undefined":R(r))=="object"?JSON.stringify(r,null,4):String(r);z.writeFileSync(e,o,"utf-8")}function er(e,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var n=t.isJson,s=n===void 0?!1:n,o=s&&(typeof r==="undefined"?"undefined":R(r))=="object"?JSON.stringify(r,null,4):String(r);z.appendFileSync(e,o,"utf-8")}function et(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++){r[t]=arguments[t]}r.forEach(function(e){$(e)&&z.rmSync(e,{recursive:!0,force:!0})})}import*as en from"node:path";function es(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++){r[t]=arguments[t]}var n;return(n=en).resolve.apply(n,[eU].concat(D(r)))}function eo(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++){r[t]=arguments[t]}var n;return(n=en).resolve.apply(n,D(r))}function ea(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++){r[t]=arguments[t]}var n;return(n=en).join.apply(n,D(r))}var ei={};function ec(e){if(e in ei)return ei[e];var r=ea(eU,eV);if(!$(r))return ei[e]=!1;try{var t,n;var s=Z(r,{asJson:!0}),o=s.name===e,a=!!((t=s.dependencies)===null||t===void 0?void 0:t[e]),i=!!((n=s.devDependencies)===null||n===void 0?void 0:n[e]);return o||a||i?ei[e]={path:r,file:s,isCurrentProject:o,isDepend:a,isDevDepend:i}:ei[e]=!1}catch(r){return J.warn("Failed to read package.json: ".concat(r.message)),ei[e]=!1}}function eu(e){return el.apply(this,arguments)}function el(){el=o(function(e){var r,t,n,s;return b(this,function(o){switch(o.label){case 0:o.trys.push([0,3,,4]);return[4,X("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:r=o.sent();if(!r.ok)throw new Error("Failed to fetch latest version: ".concat(r.status," ").concat(r.statusText));return[4,r.json()];case 2:t=o.sent(),n=t.version;return[2,n];case 3:s=o.sent();throw J.error('Failed to fetch version for "'.concat(e,'": ').concat(s.message)),s;case 4:return[2]}})});return el.apply(this,arguments)}function ef(e,r){return eE.apply(this,arguments)}function eE(){eE=o(function(e,r){var t,n,s,o,a,i,c,u,f,E,d,v,h,m,p;return b(this,function(_){switch(_.label){case 0:_.trys.push([0,4,,5]);a=ec(e);if(!a)return[2,g({},k)];i=a.path,c=a.file,u=a.isCurrentProject,f=a.isDepend,E=a.isDevDepend,d="0.0.0";u&&c.version?d=c.version:f&&((t=c.dependencies)===null||t===void 0?void 0:t[e])?d=(n=c.dependencies)===null||n===void 0?void 0:n[e]:E&&((s=c.devDependencies)===null||s===void 0?void 0:s[e])&&(d=(o=c.devDependencies)===null||o===void 0?void 0:o[e]);if(!u)return[3,1];m=d;return[3,3];case 1:return[4,eu(e)];case 2:m=_.sent();_.label=3;case 3:v=m,h=u||d===v;return[2,(!h&&(r===null||r===void 0?void 0:r.update)&&(f?c.dependencies=S(g({},c.dependencies||{}),l({},e,v)):E&&(c.devDependencies=S(g({},c.devDependencies||{}),l({},e,v))),J.info('Updating package "'.concat(e,'" to version ').concat(v)),ee(i,c,{isJson:!0})),{isCurrentProject:u,installedPath:i,file:c,isUpToDate:h})];case 4:p=_.sent();return[2,(J.error('Error checking package "'.concat(e,'": ').concat(p.message)),g({},k))];case 5:return[2]}})});return eE.apply(this,arguments)}import ed from"node-persist";import ev from"node:os";import eh from"node:process";function em(){return eh.env.CYBERSKILL_STORAGE_DIR||ea(ev.homedir(),ej)}function ep(){return eg.apply(this,arguments)}function eg(){eg=o(function(){var e;return b(this,function(r){switch(r.label){case 0:e=ed.defaultInstance;if(e)return[3,2];return[4,ed.init({dir:em(),stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,forgiveParseErrors:!0})];case 1:e=r.sent();r.label=2;case 2:e;return[2]}})});return eg.apply(this,arguments)}var e_={get:function e(e){return o(function(){var r,t;return b(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,ep()];case 1:n.sent();return[4,ed.getItem(e)];case 2:return[2,(r=n.sent())!==null&&r!==void 0?r:null];case 3:t=n.sent();return[2,(J.error('[Storage:get] Error getting key "'.concat(e,'":'),t),null)];case 4:return[2]}})})()},set:function e(e,r){return o(function(){var t;return b(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,ep()];case 1:n.sent();return[4,ed.setItem(e,r)];case 2:n.sent();return[3,4];case 3:t=n.sent();J.error('[Storage:set] Error setting key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},remove:function e(e){return o(function(){var r;return b(this,function(t){switch(t.label){case 0:t.trys.push([0,3,,4]);return[4,ep()];case 1:t.sent();return[4,ed.removeItem(e)];case 2:t.sent();return[3,4];case 3:r=t.sent();J.error('[Storage:remove] Error removing key "'.concat(e,'":'),r);return[3,4];case 4:return[2]}})})()},keys:function e(){return o(function(){var e,r;return b(this,function(t){switch(t.label){case 0:t.trys.push([0,3,,4]);return[4,ep()];case 1:t.sent();return[4,ed.keys()];case 2:e=t.sent();return[2,Array.isArray(e)?e:(J.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:r=t.sent();return[2,(J.error("[Storage:keys] Error getting keys:",r),[])];case 4:return[2]}})})()},getLogLink:function e(e){return o(function(){return b(this,function(r){try{return[2,"".concat(em()," (key: ").concat(e,")")]}catch(e){return[2,(J.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var eS=V.promisify(F);function ey(e){return"error_list:".concat(e)}function eO(e){return eA.apply(this,arguments)}function eA(){eA=o(function(e){var r,t,n;return b(this,function(s){switch(s.label){case 0:if(e.length===0)return[2];r=Date.now(),t=ey(r);s.label=1;case 1:s.trys.push([1,3,,4]);return[4,e_.set(t,{errors:e,timestamp:r})];case 2:s.sent(),setTimeout(/*#__PURE__*/o(function(){var e;return b(this,function(r){switch(r.label){case 0:return[4,e_.getLogLink(t)];case 1:e=r.sent();e&&J.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})}),10);return[3,4];case 3:n=s.sent();J.error("Failed to save errors: ".concat(n.message));return[3,4];case 4:return[2]}})});return eA.apply(this,arguments)}function eN(){return eC.apply(this,arguments)}function eC(){eC=o(function(){var e,r,t;return b(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,e_.keys()];case 1:e=n.sent(),r=Array.isArray(e)?e.filter(function(e){var r;return e===null||e===void 0?void 0:(r=e.startsWith)===null||r===void 0?void 0:r.call(e,"error_list:")}):[];return[4,Promise.all(r.map(/*#__PURE__*/function(){var e=o(function(e){var r;return b(this,function(t){switch(t.label){case 0:return[4,e_.get(e)];case 1:return[2,((r=t.sent())===null||r===void 0?void 0:r.errors)||[]]}})});return function(r){return e.apply(this,arguments)}}()))];case 2:return[2,n.sent().flat()];case 3:t=n.sent();return[2,(J.error("Failed to retrieve stored errors: ".concat(t.message)),[])];case 4:return[2]}})});return eC.apply(this,arguments)}function eD(){return eR.apply(this,arguments)}function eR(){eR=o(function(){var e,r,t;return b(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,e_.keys()];case 1:e=n.sent(),r=Array.isArray(e)?e.filter(function(e){var r;return e===null||e===void 0?void 0:(r=e.startsWith)===null||r===void 0?void 0:r.call(e,"error_list:")}):[];return[4,Promise.all(r.map(function(e){return e_.remove(e)}))];case 2:n.sent();return[3,4];case 3:t=n.sent();J.error("Failed to clear error lists: ".concat(t.message));return[3,4];case 4:return[2]}})});return eR.apply(this,arguments)}function eT(e){var r=[],t=[],n="",s=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,o=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,a=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))n=e.trim();else{var i=s.exec(e)||[],c=o.exec(e)||[],u=a.exec(e)||[];i.length&&n?r.push({file:n,position:"".concat(i[1],":").concat(i[2]),type:i[3]==="error"?"error":"warning",message:i[4].trim(),rule:i[5].trim()}):c.length?r.push({file:c[1],position:"".concat(c[2],":").concat(c[3]),type:c[4]==="error"?"error":"warning",message:c[5].trim()}):u.length?r.push({file:"commitlint",type:"error",message:u[1].trim(),rule:u[2].trim()}):t.push(e.trim())}}),r.length&&eO(r),M&&t.length&&(J.warn("Unmatched lines:"),t.forEach(function(e){return J.info(" ".concat(e))}))}function eI(e){try{var r=JSON.parse(e),t=[];r.forEach(function(e){var r=e.filePath,n=e.messages;n.forEach(function(e){var n=e.severity,s=e.line,o=e.column,a=e.ruleId,i=e.message;t.push({type:n===2?"error":"warning",file:r,position:"".concat(s,":").concat(o),rule:a,message:i})})}),t.length&&eO(t)}catch(r){eT(e)}}function eb(e){return eP.apply(this,arguments)}function eP(){eP=o(function(e){var r,t,n,s,o,a,i,c,u;var l=arguments;return b(this,function(f){switch(f.label){case 0:r=l.length>1&&l[1]!==void 0?l[1]:eI;t=new AbortController;K.on("SIGINT",function(){J.warn("Process interrupted. Terminating..."),t.abort(),K.exit()});f.label=1;case 1:f.trys.push([1,3,,4]);return[4,eS(e,{maxBuffer:0x6400000,signal:t.signal})];case 2:n=f.sent(),s=n.stdout,o=n.stderr;[s,o].forEach(function(e){return e&&r(e)});return[3,4];case 3:a=f.sent();i=a.stdout,c=a.stderr,u=a.message;[i,c].forEach(function(e){return e&&r(e)}),!c&&!i&&J.error("Command failed: ".concat(u));return[3,4];case 4:return[2]}})});return eP.apply(this,arguments)}function ew(e){return{raw:!0,cmd:e}}function eM(e,r){return(r===null||r===void 0?void 0:r.isRemote)?"".concat(rt," ").concat(ex," ").concat(e):(r===null||r===void 0?void 0:r.isCurrentProject)?"".concat(rt," ").concat(e9," src/cli.ts ").concat(e):"".concat(rt," ").concat(ez," ").concat(e)}function eL(e,r){return typeof e=="function"?eM(e(r),r):(typeof e==="undefined"?"undefined":R(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?eM(e,r):e}function eG(e){return ek.apply(this,arguments)}function ek(){ek=o(function(e){var r,t,n,s,o,a,i;var c=arguments;return b(this,function(u){switch(u.label){case 0:r=c.length>1&&c[1]!==void 0?c[1]:{};n=(t=r===null||r===void 0?void 0:r.isRemote)!==null&&t!==void 0?t:!1;if(!n)return[3,1];i=!1;return[3,3];case 1:return[4,ef(ex)];case 2:i=u.sent().isCurrentProject;u.label=3;case 3:s=i,o={isRemote:n,isCurrentProject:s},a=typeof e=="function"?e(o):e;return[2,Object.fromEntries(Object.entries(a).map(function(e){var r=C(e,2),t=r[0],n=r[1];return[t,eL(n,o)]}))]}})});return ek.apply(this,arguments)}var eU=U.env.INIT_CWD||U.cwd(),ex="@cyberskill/shared",ej=".cyberskill-storage",eF="node_modules",eK="dist",eV="package.json",eH="package-lock.json",eY="tsconfig.json",eQ=".gitignore",eB=".simple-git-hooks.json",eq="pnpm-lock.yaml",eW=".git/hooks/",eJ=".git/COMMIT_EDITMSG",eX=ea(eU,eF,ex,eK),ez="cyberskill",e$="eslint",eZ="eslint",e0="vitest",e2="playwright",e1="vitest",e3="@commitlint/cli",e4="commitlint",e5="lint-staged",e8="lint-staged",e6="typescript",e7="tsc",e9="tsx",re="git",rr="pnpm",rt="pnpm exec",rn="simple-git-hooks",rs="simple-git-hooks",ro="@eslint/config-inspector",ra="eslint-config-inspector",ri="node-modules-inspector",rc="node-modules-inspector",ru={CYBERSKILL_DIRECTORY:eX,WORKING_DIRECTORY:eU,TS_CONFIG:es(eY),GIT_IGNORE:es(eQ),GIT_HOOK:es(eW),GIT_COMMIT_MSG:es(eJ),SIMPLE_GIT_HOOKS_JSON:es(eB),PACKAGE_JSON:es(eV),PACKAGE_LOCK_JSON:es(eH),PNPM_LOCK_YAML:es(eq),NODE_MODULES:es(eF),CYBERSKILL:{LINT_STAGED_CONFIG:es("".concat(eX,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:es("".concat(eX,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:es("".concat(eX,"/configs/vitest/react/unit.js")),UNIT_TEST_SETUP_CONFIG:es("".concat(eX,"/configs/vitest/react/unit.setup.js")),E2E_TEST_CONFIG:es("".concat(eX,"/configs/vitest/react/e2e.js"))}};function rl(e){var r=e.isCurrentProject;return g({"pre-commit":e8,"commit-msg":e4},r&&{"pre-push":ew("".concat(re," pull"))})}function rf(e){for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++){t[n-1]=arguments[n]}var s=C(t,2),o=s[0],a=s[1],i=e==="RAW"?!0:$.apply(void 0,D(o.split(" ").map(function(e){return ea(ru.NODE_MODULES,e)})));switch(e){case"PNPM_ADD_AND_EXEC":return eL(ew("".concat(i?"":"".concat(rr," add ").concat(o," && ")).concat(rt," ").concat(a)));case"PNPM_ADD_DEV_AND_EXEC":return eL(ew("".concat(i?"":"".concat(rr," add -D ").concat(o," && ")).concat(rt," ").concat(a)));case"RAW":return eL(ew(o))}}var rE={SIMPLE_GIT_HOOKS:rf("PNPM_ADD_DEV_AND_EXEC",rn,rs),ESLINT_INSPECT:rf("PNPM_ADD_DEV_AND_EXEC",ro,ra),NODE_MODULES_INSPECT:rf("PNPM_ADD_DEV_AND_EXEC",ri,rc),ESLINT_CHECK:rf("PNPM_ADD_DEV_AND_EXEC",e$,"".concat(eZ," ").concat(ru.WORKING_DIRECTORY)),ESLINT_FIX:rf("PNPM_ADD_DEV_AND_EXEC",e$,"".concat(eZ," ").concat(ru.WORKING_DIRECTORY," --fix")),TYPESCRIPT_CHECK:rf("PNPM_ADD_AND_EXEC",e6,"".concat(e7," -p ").concat(ru.TS_CONFIG," --noEmit")),CONFIGURE_GIT_HOOK:rf("RAW","".concat(re," config core.hooksPath ").concat(ru.GIT_HOOK)),BUILD:rf("RAW","".concat(rr," run build")),STAGE_BUILD_DIRECTORY:rf("RAW","".concat(re," add ").concat(eK)),PNPM_INSTALL_STANDARD:rf("RAW","".concat(rr," install")),PNPM_INSTALL_LEGACY:rf("RAW","".concat(rr," install --legacy-peer-deps")),PNPM_INSTALL_FORCE:rf("RAW","".concat(rr," install --force")),CYBERSKILL:{TEST_UNIT:rf("PNPM_ADD_AND_EXEC",e0,"".concat(e1," --config ").concat(ru.CYBERSKILL.UNIT_TEST_CONFIG)),TEST_E2E:rf("PNPM_ADD_AND_EXEC","".concat(e0," ").concat(e2),"".concat(e1," --config ").concat(ru.CYBERSKILL.E2E_TEST_CONFIG)),COMMIT_LINT:rf("PNPM_ADD_DEV_AND_EXEC",e3,"".concat(e4," --edit ").concat(ru.GIT_COMMIT_MSG," --config ").concat(ru.CYBERSKILL.COMMITLINT_CONFIG)),LINT_STAGED:rf("PNPM_ADD_DEV_AND_EXEC",e5,"".concat(e8," --config ").concat(ru.CYBERSKILL.LINT_STAGED_CONFIG))}};import{format as rd}from"date-fns";import{Document as rv}from"mongoose";import rh from"mongoose-aggregate-paginate-v2";import rm from"mongoose-paginate-v2";import{v4 as rp}from"uuid";import rg from"crypto-js";import r_ from"slugify";var rS=r_.default||r_;function ry(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",r=arguments.length>1?arguments[1]:void 0;var t=r||{},n=t.lower,s=n===void 0?!0:n,o=t.locale,a=o===void 0?"vi":o,i=y(t,["lower","locale"]);return rS(e,g({lower:s,locale:a},i))}function rO(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:4;return rg.SHA256(e).toString(rg.enc.Hex).slice(0,r)}var rA={isEmpty:function e(e){return e==null?!0:Array.isArray(e)?e.length===0:(typeof e==="undefined"?"undefined":R(e))=="object"?d(e,Date)?!1:Object.keys(e).length===0:typeof e=="string"?e.trim().length===0:!1}};var rN={getDateTime:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:new Date;return rd(e,"yyyy-MM-dd HH:mm:ss.SSS")},createGenericFields:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=e.returnDateAs,t=r===void 0?"string":r;var n=t==="string"?rN.getDateTime():new Date;return{id:rp(),isDel:!1,createdAt:n,updatedAt:n}},applyPlugins:function e(e,r){r.filter(function(e){return typeof e=="function"}).forEach(function(r){return e.plugin(r)})},applyMiddlewares:function e(e,r){r.forEach(function(r){var t=r.method,n=r.pre,s=r.post;t&&n&&e.pre(t,n),t&&s&&e.post(t,s)})},createGenericSchema:function e(e){return new e.Schema({id:{type:String,default:rp,required:!0,unique:!0},isDel:{type:Boolean,default:!1,required:!0}},{timestamps:!0})},createSchema:function e(e){var r=e.mongoose,t=e.schema,n=e.virtuals,s=n===void 0?[]:n,o=e.standalone,a=o===void 0?!1:o;var i=new r.Schema(t,{strict:!0});return s.forEach(function(e){var r=e.name,t=e.options,n=e.get;var s=i.virtual(r,t);n&&s.get(n)}),a||i.add(rN.createGenericSchema(r)),i},createModel:function e(e){var r=e.mongoose,t=e.name,n=e.schema,s=e.pagination,o=s===void 0?!1:s,a=e.aggregate,i=a===void 0?!1:a,c=e.virtuals,u=c===void 0?[]:c,l=e.middlewares,f=l===void 0?[]:l;if(!t)throw new Error("Model name is required.");if(r.models[t])return r.models[t];var E=rN.createSchema({mongoose:r,schema:n,virtuals:u});return rN.applyPlugins(E,[o&&rm,i&&rh]),rN.applyMiddlewares(E,f),r.model(t,E)},createSlugQuery:function e(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=arguments.length>2?arguments[2]:void 0;return S(g({},r,t&&{id:{$ne:t}}),{$or:[{slug:e},{slugHistory:e}]})},validator:{isEmpty:function e(){return /*#__PURE__*/function(){var e=o(function(e){return b(this,function(r){return[2,!rA.isEmpty(e)]})});return function(r){return e.apply(this,arguments)}}()},isUnique:function e(e){return /*#__PURE__*/function(){var r=o(function(r){var t;return b(this,function(n){switch(n.label){case 0:if(!Array.isArray(e)||e.length===0)throw new Error("Fields must be a non-empty array of strings.");t={$or:e.map(function(e){return l({},e,r)})};return[4,this.constructor.findOne(t)];case 1:return[2,!n.sent()]}})});return function(e){return r.apply(this,arguments)}}()},matchesRegex:function e(e){return /*#__PURE__*/function(){var r=o(function(r){return b(this,function(t){if(!Array.isArray(e)||e.some(function(e){return!d(e,RegExp)}))throw new Error("regexArray must be an array of valid RegExp objects.");return[2,e.every(function(e){return e.test(r)})]})});return function(e){return r.apply(this,arguments)}}()}}},rC=/*#__PURE__*/function(){"use strict";function e(r,t){i(this,e);this.collection=r.collection(t)}u(e,[{key:"createOne",value:function e(e){var r=this;return o(function(){var t,n,s;return b(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);t=g({},rN.createGenericFields(),e);n={success:!0,message:"Document created successfully"};return[4,r.collection.insertOne(t)];case 1:return[2,(n.result=o.sent(),n)];case 2:s=o.sent();return[2,{success:!1,message:s.message}];case 3:return[2]}})})()}},{key:"createMany",value:function e(e){var r=this;return o(function(){var t,n,s;return b(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);t=e.map(function(e){return g({},rN.createGenericFields(),e)});return[4,r.collection.insertMany(t)];case 1:n=o.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=o.sent();return[2,{success:!1,message:s.message}];case 3:return[2]}})})()}},{key:"findOne",value:function e(e){var r=this;return o(function(){var t,n;return b(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);return[4,r.collection.findOne(e)];case 1:t=s.sent();return[2,t?{success:!0,message:"Document found",result:t}:{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 r=this;return o(function(){var t,n;return b(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);t={success:!0,message:"Documents retrieved successfully"};return[4,r.collection.find(e).toArray()];case 1:return[2,(t.result=s.sent(),t)];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 r=this;return o(function(){var t,n;return b(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);t={success:!0,message:"Count retrieved successfully"};return[4,r.collection.countDocuments(e)];case 1:return[2,(t.result=s.sent(),t)];case 2:n=s.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})})()}},{key:"updateOne",value:function e(e,r){var t=this;return o(function(){var n,s;return b(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);return[4,t.collection.updateOne(e,{$set:r})];case 1:n=o.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=o.sent();return[2,{success:!1,message:s.message}];case 3:return[2]}})})()}},{key:"updateMany",value:function e(e,r){var t=this;return o(function(){var n,s;return b(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);return[4,t.collection.updateMany(e,{$set:r})];case 1:n=o.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=o.sent();return[2,{success:!1,message:s.message}];case 3:return[2]}})})()}},{key:"deleteOne",value:function e(e){var r=this;return o(function(){var t,n;return b(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);return[4,r.collection.deleteOne(e)];case 1:t=s.sent();return[2,t.deletedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Document deleted successfully",result:t}];case 2:n=s.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})})()}},{key:"deleteMany",value:function e(e){var r=this;return o(function(){var t,n;return b(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);return[4,r.collection.deleteMany(e)];case 1:t=s.sent();return[2,t.deletedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Documents deleted successfully",result:t}];case 2:n=s.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})})()}}]);return e}(),rD=/*#__PURE__*/function(){"use strict";function e(r){i(this,e);this.model=r}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]:{},r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=arguments.length>3?arguments[3]:void 0;var s=this;return o(function(){var o,a,i;return b(this,function(c){switch(c.label){case 0:c.trys.push([0,2,,3]);o=s.model.findOne(e,r,t);n&&o.populate(n);return[4,o.exec()];case 1:a=c.sent();return[2,a?{success:!0,result:a}:{success:!1,message:"No ".concat(s.getModelName()," found."),code:B.NOT_FOUND.CODE}];case 2:i=c.sent();return[2,{success:!1,message:i.message,code:B.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"findAll",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=arguments.length>3?arguments[3]:void 0;var s=this;return o(function(){var o,a,i;return b(this,function(c){switch(c.label){case 0:c.trys.push([0,2,,3]);o=s.model.find(e,r,t);n&&o.populate(n);a={success:!0};return[4,o.exec()];case 1:return[2,(a.result=c.sent(),a)];case 2:i=c.sent();return[2,{success:!1,message:i.message,code:B.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"findPaging",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var t=this;return o(function(){var n,s;return b(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);n={success:!0};return[4,t.model.paginate(e,r)];case 1:return[2,(n.result=o.sent(),n)];case 2:s=o.sent();return[2,{success:!1,message:s.message,code:B.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"findPagingAggregate",value:function e(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var t=this;return o(function(){var n,s;return b(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);n={success:!0};return[4,t.model.aggregatePaginate(t.model.aggregate(e),r)];case 1:return[2,(n.result=o.sent(),n)];case 2:s=o.sent();return[2,{success:!1,message:s.message,code:B.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 r=this;return o(function(){var t,n;return b(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);t={success:!0};return[4,r.model.countDocuments(e)];case 1:return[2,(t.result=s.sent(),t)];case 2:n=s.sent();return[2,{success:!1,message:n.message,code:B.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"createOne",value:function e(e){var r=this;return o(function(){var t,n;return b(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);t={success:!0};return[4,r.model.create(e)];case 1:return[2,(t.result=s.sent(),t)];case 2:n=s.sent();return[2,{success:!1,message:n.message,code:B.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"createMany",value:function e(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var t=this;return o(function(){var n,s;return b(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);n={success:!0};return[4,t.model.insertMany(e,r)];case 1:return[2,(n.result=o.sent().map(function(e){return d(e,rv)?e.toObject():null}).filter(function(e){return e!==null}),n)];case 2:s=o.sent();return[2,{success:!1,message:s.message,code:B.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"updateOne",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var n=this;return o(function(){var s,o;return b(this,function(a){switch(a.label){case 0:a.trys.push([0,2,,3]);return[4,n.model.findOneAndUpdate(e,r,g({new:!0},t)).exec()];case 1:s=a.sent();return[2,s?{success:!0,result:s}:{success:!1,message:"Failed to update ".concat(n.getModelName(),"."),code:B.NOT_FOUND.CODE}];case 2:o=a.sent();return[2,{success:!1,message:o.message,code:B.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"updateMany",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var n=this;return o(function(){var s,o;return b(this,function(a){switch(a.label){case 0:a.trys.push([0,2,,3]);s={success:!0};return[4,n.model.updateMany(e,r,t).exec()];case 1:return[2,(s.result=a.sent(),s)];case 2:o=a.sent();return[2,{success:!1,message:o.message,code:B.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"deleteOne",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var t=this;return o(function(){var n,s;return b(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);return[4,t.model.findOneAndDelete(e,r).exec()];case 1:n=o.sent();return[2,n?{success:!0,result:n}:{success:!1,message:"No ".concat(t.getModelName()," found to delete."),code:B.NOT_FOUND.CODE}];case 2:s=o.sent();return[2,{success:!1,message:s.message,code:B.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"deleteMany",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var t=this;return o(function(){var n,s;return b(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);return[4,t.model.deleteMany(e,r).exec()];case 1:n=o.sent();return[2,n.deletedCount===0?{success:!1,message:"No documents found to delete.",code:B.NOT_FOUND.CODE}:{success:!0,result:n}];case 2:s=o.sent();return[2,{success:!1,message:s.message,code:B.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}},{key:"createShortId",value:function e(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:4;var t=this;return o(function(){var n,s,o,a;return b(this,function(i){switch(i.label){case 0:n=new Set;s=0;i.label=1;case 1:if(!(s<10))return[3,5];o=rO(e,s+r);a=!n.has(o);if(!a)return[3,3];n.add(o);return[4,t.model.exists({shortId:o})];case 2:a=!i.sent();i.label=3;case 3:if(a)return[2,{success:!0,result:o}];i.label=4;case 4:s++;return[3,1];case 5:return[2,{success:!1,message:"Failed to create a unique shortId",code:B.INTERNAL_SERVER_ERROR.CODE}]}})})()}},{key:"createSlug",value:function e(e,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var n=this;return o(function(){var s,a,i,c,u,l,f,E,d,v,h;return b(this,function(m){switch(m.label){case 0:m.trys.push([0,8,,9]);s=r[e],a=/*#__PURE__*/function(){var e=o(function(e){var s,o,a;return b(this,function(i){switch(i.label){case 0:return[4,n.model.findOne(rN.createSlugQuery(e,t,r.id))];case 1:s=i.sent();if(!s)return[2,e];o=1;i.label=2;case 2:a="".concat(e,"-").concat(o);return[4,n.model.findOne(rN.createSlugQuery(a,t,r.id))];case 3:s=i.sent(),o++;i.label=4;case 4:if(s)return[3,2];i.label=5;case 5:return[2,a]}})});return function r(r){return e.apply(this,arguments)}}();if(!((typeof s==="undefined"?"undefined":R(s))=="object"))return[3,5];i={};c=[];for(u in s)c.push(u);l=0;m.label=1;case 1:if(!(l<c.length))return[3,4];f=c[l];E=ry(s[f]);return[4,a(E)];case 2:i[f]=m.sent();m.label=3;case 3:l++;return[3,1];case 4:return[2,{success:!0,result:i}];case 5:d=ry(s);v={success:!0};return[4,a(d)];case 6:return[2,(v.result=m.sent(),v)];case 7:return[3,9];case 8:h=m.sent();return[2,{success:!1,message:"Failed to create a unique slug: ".concat(h.message),code:B.INTERNAL_SERVER_ERROR.CODE}];case 9:return[2]}})})()}},{key:"aggregate",value:function e(e){var r=this;return o(function(){var t,n;return b(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);t={success:!0};return[4,r.model.aggregate(e)];case 1:return[2,(t.result=s.sent(),t)];case 2:n=s.sent();return[2,{success:!1,message:n.message,code:B.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})})()}}]);return e}();import{ApolloClient as rR,ApolloError as rT,ApolloLink as rI,ApolloProvider as rb,from as rP,HttpLink as rw,InMemoryCache as rM,split as rL}from"@apollo/client";import{onError as rG}from"@apollo/client/link/error";import{removeTypenameFromVariables as rk}from"@apollo/client/link/remove-typename";import{GraphQLWsLink as rU}from"@apollo/client/link/subscriptions";import{getMainDefinition as rx}from"@apollo/client/utilities";import{createClient as rj}from"graphql-ws";import{useMemo as rF}from"react";import{toast as rK,Toaster as rV}from"react-hot-toast";import{FaExpand as rH}from"react-icons/fa6";import{consola as rY}from"consola/browser";var rQ={silent:rY.silent,level:rY.level,fatal:rY.fatal,error:rY.error,warn:rY.warn,log:rY.log,info:rY.info,success:rY.success,ready:rY.ready,start:rY.start,box:rY.box,debug:rY.debug,trace:rY.trace,verbose:rY.verbose};import{createContext as rB,use as rq,useEffect as rW,useMemo as rJ,useState as rX}from"react";import{FaRepeat as rz}from"react-icons/fa6";import r$ from"./react/apollo-error.module.scss";import{jsx as rZ,jsxs as r0}from"react/jsx-runtime";var r2=rB(void 0);function r1(){var e=rq(r2);if(!e)throw new Error("useApolloErrorViewer must be used within ApolloErrorViewerProvider");return e}var r3=null;function r4(e){r3=e}function r5(e){r3&&r3(e)}function r8(e){var r=e.children;var t=C(rX(null),2),n=t[0],s=t[1];rW(function(){r4(s)},[]);var o=rJ(function(){return{error:n,showError:s,hideError:function(){return s(null)}}},[n]);return rZ(r2,{value:o,children:r})}function r6(){var e,r,t;var n=rq(r2);if(!n||!n.error)return null;var s=n.error,o=n.hideError;return rZ("div",{className:r$["modal-backdrop"],children:r0("div",{className:r$["modal-content"],children:[rZ("button",{type:"button",className:r$["btn-close"],onClick:o,children:"✕"}),rZ("div",{className:r$["error-title"],children:s.message}),r0("div",{className:r$["error-details"],children:[s.networkError&&r0("pre",{className:"network",children:[rZ("strong",{children:"Network Error:"}),"\xa0",s.networkError.message]}),((e=s.graphQLErrors)===null||e===void 0?void 0:e.length)>0&&r0("div",{children:[rZ("strong",{children:"GraphQL Errors:"}),rZ("ul",{children:s.graphQLErrors.map(function(e){return rZ("li",{children:e.message},e.message)})})]}),((r=s.protocolErrors)===null||r===void 0?void 0:r.length)>0&&r0("div",{children:[rZ("strong",{children:"Protocol Errors:"}),rZ("ul",{children:s.protocolErrors.map(function(e){return rZ("li",{children:e.message},e.message)})})]}),((t=s.clientErrors)===null||t===void 0?void 0:t.length)>0&&r0("div",{children:[rZ("strong",{children:"Client Errors:"}),rZ("ul",{children:s.clientErrors.map(function(e){return rZ("li",{children:e.message},e.message)})})]}),s.extraInfo&&r0("pre",{className:"extra",children:[rZ("strong",{children:"Extra Info:"}),"\xa0",JSON.stringify(s.extraInfo,null,4)]})]}),rZ("button",{type:"button",className:r$["btn-retry"],onClick:function(){return window.location.reload()},children:rZ(rz,{})})]})})}import{Fragment as r7,jsx as r9,jsxs as te}from"react/jsx-runtime";var tr=/*#__PURE__*/function(e){"use strict";E(r,e);function r(){i(this,r);var e;e=a(this,r,arguments);e.count=0;return e}u(r,[{key:"request",value:function e(e,r){var t=this;var n=Date.now();return this.count+=1,r(e).map(function(r){var s=Date.now()-n,o=e.operationName||"Unnamed";return rQ.info("[Apollo] #".concat(t.count,": ").concat(o," (").concat(s,"ms)")),r})}}]);return r}(rI);function tt(e){var r=e||{},t=r.uri,n=r.wsUrl,s=r.customLinks,o=new tr,a=rG(function(e){var r=e.graphQLErrors,t=e.networkError,n=e.protocolErrors,s=e.operation;var o=(s===null||s===void 0?void 0:s.operationName)||"Unknown";if(r&&r.forEach(function(e){var r=e.message,t=e.locations,n=e.path;rQ.error("[GraphQL error] ".concat(o,": ").concat(r,", Location: ").concat(JSON.stringify(t),", Path: ").concat(n))}),n&&n.forEach(function(e){var r=e.message,t=e.extensions;rQ.error("[Protocol error]: ".concat(r,", Extensions: ").concat(JSON.stringify(t)))}),t&&rQ.error("[Network error]: ".concat(t)),r||n||t){var a,i;var c=(r===null||r===void 0?void 0:(a=r[0])===null||a===void 0?void 0:a.message)||(n===null||n===void 0?void 0:(i=n[0])===null||i===void 0?void 0:i.message)||(t===null||t===void 0?void 0:t.message)||"Unexpected error",u=new rT({graphQLErrors:r||[],protocolErrors:n||[],clientErrors:[],networkError:t||null,errorMessage:c,extraInfo:{operation:s}});rK.error(function(e){return te(r7,{children:[c,"\xa0",r9(rH,{onClick:function(){setTimeout(function(){r5(u)},0),rK.dismiss(e.id)}})]})})}}),i=rk();t||rQ.warn('[Apollo] No GraphQL URI provided — using "'.concat(G,'" as default'));var c=new rw({uri:t!==null&&t!==void 0?t:G,credentials:"include"}),u=n?new rU(rj({url:n})):rI.empty(),l=d(u,rI)?rL(function(e){var r=e.query;var t=rx(r);return t.kind==="OperationDefinition"&&t.operation==="subscription"},u,c):c;return l===c&&n&&rQ.warn("[Apollo] WS URL is set, but subscriptions fallback to HTTP. Check your wsLink config."),[o,a,i].concat(D(s!==null&&s!==void 0?s:[]),[l])}function tn(e){var r=e.isNextJS,t=e.options,n=e.children,s=e.client,o=e.provider,a=e.cache;var i=t||{},c=i.uri,u=i.wsUrl,l=i.customLinks,f=y(i,["uri","wsUrl","customLinks"]);if(typeof(s!==null&&s!==void 0?s:rR)!="function")throw new TypeError("Invalid ApolloClient provided. Ensure CustomClient is a class.");var E=o||rb,v=rF(function(){return rP(tt({uri:c,wsUrl:u,customLinks:l}))},[c,u,l]),h=rF(function(){return new rR(g({link:v,cache:d(a,rM)?a:new rM},f))},[v,a,f]),m=r?r9(E,{makeClient:function(){return h},children:n}):r9(E,{client:h,children:n});return r?r9(E,{makeClient:function(){return h},children:n}):te(r7,{children:[te(r8,{children:[m,r9(r6,{})]}),r9(rV,{position:"top-right"})]})}import ts from"classnames";import{createContext as to,use as ta,useCallback as ti,useMemo as tc,useState as tu}from"react";import tl from"./react/loading.module.scss";import{jsx as tf,jsxs as tE}from"react/jsx-runtime";var td=to(void 0);function tv(){var e=ta(td);if(!e)throw new Error("useLoading must be used within a LoadingProvider");return e}function th(e){var r=e.full,t=r===void 0?!1:r,n=e.block,s=n===void 0?!1:n,o=e.className,a=o===void 0?"":o,i=e.message,c=i===void 0?"Loading":i,u=y(e,["full","block","className","message"]);function l(){return tE("div",S(g({className:tl.container},u),{children:[tf("div",{className:tl.ring}),tf("div",{className:tl.ring}),tf("div",{className:tl.ring}),tf("div",{className:tl.ring}),c&&tf("div",{className:tl.message,children:c})]}))}return t?tf("div",{className:ts(tl.fullscreen,a),children:l()}):s?tf("div",{className:ts(tl.block,a),children:l()}):l()}function tm(e){var r=e.children;var t=C(tu(!1),2),n=t[0],s=t[1],o=C(tu(!1),2),a=o[0],i=o[1],c=ti(function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;s(!0),i(e)},[]),u=ti(function(){s(!1),i(!1)},[]),l=tc(function(){return{isLoading:n,isGlobalLoading:a,showLoading:c,hideLoading:u}},[n,a,c,u]);return tf(td,{value:l,children:n?tf(th,{full:a}):r})}import{NextIntlClientProvider as tp,useTranslations as tg}from"next-intl";import{createContext as t_,use as tS,useMemo as ty}from"react";import{useCallback as tO,useEffect as tA,useState as tN}from"react";var tC={serialize:function(e){return JSON.stringify(e,function(e,r){return d(r,Date)?{__type:"Date",value:r.toISOString()}:r})},deserialize:function(e){return JSON.parse(e,function(e,r){return(r===null||r===void 0?void 0:r.__type)==="Date"?new Date(r.value):r})}};import tD from"localforage";var tR={get:function e(e){return o(function(){var r;return b(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,tD.getItem(e)];case 1:return[2,t.sent()];case 2:r=t.sent();return[2,(rQ.error('[Storage:get] Error getting key "'.concat(e,'":'),r),null)];case 3:return[2]}})})()},set:function e(e,r){return o(function(){var t;return b(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,tD.setItem(e,r)];case 1:n.sent();return[3,3];case 2:t=n.sent();rQ.error('[Storage:set] Error setting key "'.concat(e,'":'),t);return[3,3];case 3:return[2]}})})()},remove:function e(e){return o(function(){var r;return b(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,tD.removeItem(e)];case 1:t.sent();return[3,3];case 2:r=t.sent();rQ.error('[Storage:remove] Error removing key "'.concat(e,'":'),r);return[3,3];case 3:return[2]}})})()},keys:function e(){return o(function(){var e,r;return b(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,tD.keys()];case 1:return[2,(e=t.sent())!==null&&e!==void 0?e:[]];case 2:r=t.sent();return[2,(rQ.error("[Storage:keys] Error getting keys:",r),[])];case 3:return[2]}})})()}};function tT(e,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:tC;var n=C(tN(r),2),s=n[0],a=n[1],i=C(tN(!1),2),c=i[0],u=i[1];tA(function(){var n=!0;return o(function(){var s,o,i,c;return b(this,function(l){switch(l.label){case 0:l.trys.push([0,6,7,8]);return[4,tR.get(e)];case 1:s=l.sent();if(!n)return[3,5];if(!(s!==null))return[3,2];o=t.deserialize(s);a(o);return[3,5];case 2:if(!(r!==void 0))return[3,4];i=t.serialize(r);return[4,tR.set(e,i)];case 3:l.sent(),a(r);return[3,5];case 4:a(void 0);l.label=5;case 5:return[3,8];case 6:c=l.sent();rQ.error('Error loading value for key "'.concat(e,'":'),c),n&&a(r);return[3,8];case 7:n&&u(!0);return[7];case 8:return[2]}})})(),function(){n=!1,u(!1)}},[e,r,t]),tA(function(){if(!c)return;o(function(){var r,n;return b(this,function(o){switch(o.label){case 0:o.trys.push([0,3,,4]);if(!(s!==void 0))return[3,2];r=t.serialize(s);return[4,tR.set(e,r)];case 1:o.sent();o.label=2;case 2:return[3,4];case 3:n=o.sent();rQ.error('Error saving value for key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},[s,e,t,c]);var l=tO(function(e){a(function(r){return typeof e=="function"?e(r):e})},[]),f=tO(/*#__PURE__*/o(function(){var r;return b(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,tR.remove(e)];case 1:t.sent(),a(void 0);return[3,3];case 2:r=t.sent();rQ.error('Error removing key "'.concat(e,'":'),r);return[3,3];case 3:return[2]}})}),[e]);return{value:s,set:l,remove:f}}import{Fragment as tI,jsx as tb}from"react/jsx-runtime";var tP=t_(void 0);function tw(){var e=tS(tP);if(!e)throw new Error("useNextIntl must be used within a NextIntlProvider");return e}var tM=tg;function tL(e){var r=function(r){var t;var n=tw(),s=n.currentLanguage,o=r.messages,a=r.languages,i="en",c=o[(s===null||s===void 0?void 0:s.value)||i],u=(t=a.find(function(e){return e.value===(s===null||s===void 0?void 0:s.value)}))===null||t===void 0?void 0:t.timezone;return o?tb(tp,{locale:(s===null||s===void 0?void 0:s.value)||i,messages:c,timeZone:u,children:tb(e,g({},r))}):(rQ.warn("Missing messages for language: ".concat((s===null||s===void 0?void 0:s.value)||i)),null)};return r.displayName="withNextIntl(".concat(e.displayName||e.name||"Component",")"),r}function tG(e){var r=e.children;return tb(tI,{children:r})}var tk=tL(tG);function tU(e){var r=e.children,t=e.languages,n=e.messages;var s;var o=tT("lang",(s=t===null||t===void 0?void 0:t[0])!==null&&s!==void 0?s:{}),a=o.value,i=o.set,c=ty(function(){return{languages:t,currentLanguage:a,setCurrentLanguage:i}},[t,i,a]);return tb(tP,{value:c,children:tb(tk,{languages:t,messages:n,children:r})})}var tx=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}(tx||{});import{Collection as tj,Db as tF}from"mongodb";import{Document as tK,Model as tV}from"mongoose";var tH=/*#__PURE__*/function(e){"use strict";E(r,e);function r(){i(this,r);return a(this,r,arguments)}return r}(tF),tY=/*#__PURE__*/function(e){"use strict";E(r,e);function r(){i(this,r);return a(this,r,arguments)}return r}(tK),tQ=/*#__PURE__*/function(e){"use strict";E(r,e);function r(){i(this,r);return a(this,r,arguments)}return r}(tV),tB=/*#__PURE__*/function(e){"use strict";E(r,e);function r(){i(this,r);return a(this,r,arguments)}return r}(tj);import tq from"unorm";function tW(e){try{return JSON.parse(e),!0}catch(e){return!1}}function tJ(e){return!!e&&(typeof e==="undefined"?"undefined":R(e))=="object"&&!Array.isArray(e)}function tX(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++){r[t]=arguments[t]}return r.flat().reduce(function(e,r){var t=true,n=false,s=undefined;try{for(var o=Object.entries(r)[Symbol.iterator](),a;!(t=(a=o.next()).done);t=true){var i=C(a.value,2),c=i[0],u=i[1];var l=e[c];Array.isArray(u)?e[c]=Array.from(new Set(D(Array.isArray(l)?l:[]).concat(D(u)))):tJ(u)?e[c]=tX(tJ(l)?l:{},u):e[c]=u}}catch(e){n=true;s=e}finally{try{if(!t&&o.return!=null){o.return()}}finally{if(n){throw s}}}return e},{})}var tz={a:["\xe0","\xe1","ạ","ả","\xe3","\xe2","ầ","ấ","ậ","ẩ","ẫ","ă","ằ","ắ","ặ","ẳ","ẵ"],e:["\xe8","\xe9","ẹ","ẻ","ẽ","\xea","ề","ế","ệ","ể","ễ"],i:["\xec","\xed","ị","ỉ","ĩ"],o:["\xf2","\xf3","ọ","ỏ","\xf5","\xf4","ồ","ố","ộ","ổ","ỗ","ơ","ờ","ớ","ợ","ở","ỡ"],u:["\xf9","\xfa","ụ","ủ","ũ","ư","ừ","ứ","ự","ử","ữ"],y:["ỳ","\xfd","ỵ","ỷ","ỹ"],d:["đ"]},t$=Object.entries(tz).reduce(function(e,r){var t=C(r,2),n=t[0],s=t[1];return e[n.toUpperCase()]=s.map(function(e){return e.toUpperCase()}),e},{});function tZ(e){e=tq.nfkc(e);var r=g({},tz,t$);var t=true,n=false,s=undefined;try{for(var o=Object.entries(r)[Symbol.iterator](),a;!(t=(a=o.next()).done);t=true){var i=C(a.value,2),c=i[0],u=i[1];var l="[".concat(c).concat(u.join(""),"]"),f="(".concat([c].concat(D(u)).join("|"),")");e=e.replace(new RegExp(l,"g"),f)}}catch(e){n=true;s=e}finally{try{if(!t&&o.return!=null){o.return()}}finally{if(n){throw s}}}return e}function t0(e){return e.normalize("NFD").replace(RegExp("\\p{Diacritic}","gu"),"")}export{r6 as ApolloErrorViewerModal,r8 as ApolloErrorViewerProvider,tn as ApolloProvider,eK as BUILD_DIRECTORY,k as CHECK_PACKAGE_EMPTY_RESULT,rE as COMMAND,P as COMMAND_DESCRIPTIONS,e4 as COMMIT_LINT_CLI,e3 as COMMIT_LINT_PACKAGE_NAME,ez as CYBERSKILL_CLI,eX as CYBERSKILL_DIRECTORY,ex as CYBERSKILL_PACKAGE_NAME,ej as CYBERSKILL_STORAGE,tB as C_Collection,tH as C_Db,tY as C_Document,tQ as C_Model,M as DEBUG,eZ as ESLINT_CLI,ra as ESLINT_INSPECT_CLI,ro as ESLINT_INSPECT_PACKAGE_NAME,e$ as ESLINT_PACKAGE_NAME,j as E_CommandType,tx as E_ConfigType,x as E_IssueType,re as GIT_CLI,eJ as GIT_COMMIT_EDITMSG,eW as GIT_HOOK,eQ as GIT_IGNORE,G as GRAPHQL_URI_DEFAULT,rl as HOOK,L as IS_BROWSER,e8 as LINT_STAGED_CLI,e5 as LINT_STAGED_PACKAGE_NAME,th as Loading,td as LoadingContext,tm as LoadingProvider,rC as MongoController,rD as MongooseController,eF as NODE_MODULES,rc as NODE_MODULES_INSPECT_CLI,ri as NODE_MODULES_INSPECT_PACKAGE_NAME,tP as NextIntlContext,tU as NextIntlProvider,eV as PACKAGE_JSON,eH as PACKAGE_LOCK_JSON,ru as PATH,e2 as PLAYWRIGHT_PACKAGE_NAME,rr as PNPM_CLI,rt as PNPM_EXEC_CLI,eq as PNPM_LOCK_YAML,B as RESPONSE_STATUS,rn as SIMPLE_GIT_HOOKS_PACKAGE_NAME,rs as SIMPLE_GIT_HOOK_CLI,eB as SIMPLE_GIT_HOOK_JSON,eY as TSCONFIG_JSON,e7 as TSC_CLI,e6 as TSC_PACKAGE_NAME,e9 as TSX_CLI,e1 as VITEST_CLI,e0 as VITEST_PACKAGE_NAME,eU as WORKING_DIRECTORY,rh as aggregatePaginate,er as appendFileSync,ef as checkPackage,eD as clearAllErrorLists,tX as deepMerge,eb as executeCommand,$ as existsSync,eL as formatCommand,rO as generateShortId,ry as generateSlug,eu as getLatestPackageVersion,ec as getPackage,em as getStorageDir,eN as getStoredErrorLists,ep as initNodePersist,tW as isJson,tJ as isPlainObject,ea as join,rQ as log,J as logNodeJS,rN as mongo,rm as mongoosePaginate,ew as rawCommand,Z as readFileSync,tZ as regexSearchMapper,r4 as registerApolloErrorViewerCallback,t0 as removeAccent,eo as resolve,eG as resolveCommands,es as resolveWorkingPath,et as rmSync,tC as serializer,r5 as showGlobalApolloError,tR as storageClient,e_ as storageServer,q as throwError,r1 as useApolloErrorViewer,tv as useLoading,tw as useNextIntl,tT as useStorage,tM as useTranslateNextIntl,rA as validate,tL as withNextIntl,ee as writeFileSync};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function r(r,e){if(e==null||e>r.length)e=r.length;for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function e(r){if(Array.isArray(r))return r}function t(e){if(Array.isArray(e))return r(e)}function n(r){if(r===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return r}function o(r,e,t){e=c(e);return g(r,k()?Reflect.construct(e,t||[],c(r).constructor):e.apply(r,t))}function i(r,e){if(!(r instanceof e)){throw new TypeError("Cannot call a class as a function")}}function l(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||false;n.configurable=true;if("value"in n)n.writable=true;Object.defineProperty(r,n.key,n)}}function a(r,e,t){if(e)l(r.prototype,e);if(t)l(r,t);return r}function u(r,e,t){if(e in r){Object.defineProperty(r,e,{value:t,enumerable:true,configurable:true,writable:true})}else{r[e]=t}return r}function c(r){c=Object.setPrototypeOf?Object.getPrototypeOf:function r(r){return r.__proto__||Object.getPrototypeOf(r)};return c(r)}function s(r,e){if(typeof e!=="function"&&e!==null){throw new TypeError("Super expression must either be null or a function")}r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:true,configurable:true}});if(e)j(r,e)}function f(r,e){if(e!=null&&typeof Symbol!=="undefined"&&e[Symbol.hasInstance]){return!!e[Symbol.hasInstance](r)}else{return r instanceof e}}function d(r){if(typeof Symbol!=="undefined"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function p(r,e){var t=r==null?null:typeof Symbol!=="undefined"&&r[Symbol.iterator]||r["@@iterator"];if(t==null)return;var n=[];var o=true;var i=false;var l,a;try{for(t=t.call(r);!(o=(l=t.next()).done);o=true){n.push(l.value);if(e&&n.length===e)break}}catch(r){i=true;a=r}finally{try{if(!o&&t["return"]!=null)t["return"]()}finally{if(i)throw a}}return n}function v(){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 y(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function h(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};var n=Object.keys(t);if(typeof Object.getOwnPropertySymbols==="function"){n=n.concat(Object.getOwnPropertySymbols(t).filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))}n.forEach(function(e){u(r,e,t[e])})}return r}function m(r,e){if(r==null)return{};var t=b(r,e);var n,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(r);for(o=0;o<i.length;o++){n=i[o];if(e.indexOf(n)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(r,n))continue;t[n]=r[n]}}return t}function b(r,e){if(r==null)return{};var t={};var n=Object.keys(r);var o,i;for(i=0;i<n.length;i++){o=n[i];if(e.indexOf(o)>=0)continue;t[o]=r[o]}return t}function g(r,e){if(e&&(O(e)==="object"||typeof e==="function")){return e}return n(r)}function j(r,e){j=Object.setPrototypeOf||function r(r,e){r.__proto__=e;return r};return j(r,e)}function x(r,t){return e(r)||p(r,t)||E(r,t)||v()}function w(r){return t(r)||d(r)||E(r)||y()}function O(r){"@swc/helpers - typeof";return r&&typeof Symbol!=="undefined"&&r.constructor===Symbol?"symbol":typeof r}function E(e,t){if(!e)return;if(typeof e==="string")return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor)n=e.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 r(e,t)}function k(){try{var r=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(r){}return(k=function(){return!!r})()}var P=Object.create;var S=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var L=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty;var N=function(r,e){for(var t in e)S(r,t,{get:e[t],enumerable:!0})},I=function(r,e,t,n){var o=true,i=false,l=undefined;if(e&&(typeof e==="undefined"?"undefined":O(e))=="object"||typeof e=="function")try{var a=function(){var o=c.value;!C.call(r,o)&&o!==t&&S(r,o,{get:function(){return e[o]},enumerable:!(n=q(e,o))||n.enumerable})};for(var u=A(e)[Symbol.iterator](),c;!(o=(c=u.next()).done);o=true)a()}catch(r){i=true;l=r}finally{try{if(!o&&u.return!=null){u.return()}}finally{if(i){throw l}}}return r};var _=function(r,e,t){return t=r!=null?P(L(r)):{},I(e||!r||!r.__esModule?S(t,"default",{value:r,enumerable:!0}):t,r)},U=function(r){return I(S({},"__esModule",{value:!0}),r)};var M={};N(M,{ApolloProvider:function(){return rp}});module.exports=U(M);var T=require("@apollo/client"),Q=require("@apollo/client/link/error"),R=require("@apollo/client/link/remove-typename"),D=require("@apollo/client/link/subscriptions"),F=require("@apollo/client/utilities"),G=require("graphql-ws"),B=require("react"),J=require("react-hot-toast"),H=require("react-icons/fa6");var W="/graphql";var V=_(require("chalk"),1),$=_(require("consola"),1),z=require("graphql");var K=_(require("process"),1);var X=K.default.env.DEBUG==="true";X||($.default.level=4);function Y(r){var e=V.default[r];return typeof e=="function"?e:V.default.green}var Z={silent:$.default.silent,level:$.default.level,fatal:$.default.fatal,error:$.default.error,warn:$.default.warn,log:$.default.log,info:$.default.info,success:$.default.success,ready:$.default.ready,start:$.default.start,box:$.default.box,debug:$.default.debug,trace:$.default.trace,verbose:$.default.verbose,printBoxedLog:function r(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(e===null||e===void 0?void 0:e.length)){$.default.box(V.default.green(r));return}e.forEach(function(r){var e=r.file,n=r.position,o=r.rule,i=r.message;$.default.log("".concat(V.default.gray("File:")," ").concat(V.default.blue("".concat(e).concat(n?":".concat(n):"")))),o&&$.default.log(" ".concat(Y(t)("Rule:")," ").concat(o)),$.default.log(" ".concat(Y(t)("Message:")," ").concat(i))}),$.default.box(Y(t)("".concat(r," : ").concat(e.length))),$.default.log(V.default.gray("─".repeat(40)))}};var rr=require("react"),re=require("react-icons/fa6"),rt=_(require("./apollo-error.module.scss"),1),rn=require("react/jsx-runtime"),ro=(0,rr.createContext)(void 0);var ri=null;function rl(r){ri=r}function ra(r){ri&&ri(r)}function ru(r){var e=r.children;var t=x((0,rr.useState)(null),2),n=t[0],o=t[1];(0,rr.useEffect)(function(){rl(o)},[]);var i=(0,rr.useMemo)(function(){return{error:n,showError:o,hideError:function(){return o(null)}}},[n]);return(0,rn.jsx)(ro,{value:i,children:e})}function rc(){var r,e,t;var n=(0,rr.use)(ro);if(!n||!n.error)return null;var o=n.error,i=n.hideError;return(0,rn.jsx)("div",{className:rt.default["modal-backdrop"],children:(0,rn.jsxs)("div",{className:rt.default["modal-content"],children:[(0,rn.jsx)("button",{type:"button",className:rt.default["btn-close"],onClick:i,children:"✕"}),(0,rn.jsx)("div",{className:rt.default["error-title"],children:o.message}),(0,rn.jsxs)("div",{className:rt.default["error-details"],children:[o.networkError&&(0,rn.jsxs)("pre",{className:"network",children:[(0,rn.jsx)("strong",{children:"Network Error:"}),"\xa0",o.networkError.message]}),((r=o.graphQLErrors)===null||r===void 0?void 0:r.length)>0&&(0,rn.jsxs)("div",{children:[(0,rn.jsx)("strong",{children:"GraphQL Errors:"}),(0,rn.jsx)("ul",{children:o.graphQLErrors.map(function(r){return(0,rn.jsx)("li",{children:r.message},r.message)})})]}),((e=o.protocolErrors)===null||e===void 0?void 0:e.length)>0&&(0,rn.jsxs)("div",{children:[(0,rn.jsx)("strong",{children:"Protocol Errors:"}),(0,rn.jsx)("ul",{children:o.protocolErrors.map(function(r){return(0,rn.jsx)("li",{children:r.message},r.message)})})]}),((t=o.clientErrors)===null||t===void 0?void 0:t.length)>0&&(0,rn.jsxs)("div",{children:[(0,rn.jsx)("strong",{children:"Client Errors:"}),(0,rn.jsx)("ul",{children:o.clientErrors.map(function(r){return(0,rn.jsx)("li",{children:r.message},r.message)})})]}),o.extraInfo&&(0,rn.jsxs)("pre",{className:"extra",children:[(0,rn.jsx)("strong",{children:"Extra Info:"}),"\xa0",JSON.stringify(o.extraInfo,null,4)]})]}),(0,rn.jsx)("button",{type:"button",className:rt.default["btn-retry"],onClick:function(){return window.location.reload()},children:(0,rn.jsx)(re.FaRepeat,{})})]})})}var rs=require("react/jsx-runtime"),rf=/*#__PURE__*/function(r){s(e,r);function e(){i(this,e);var r;r=o(this,e,arguments);r.count=0;return r}a(e,[{key:"request",value:function r(r,e){var t=this;var n=Date.now();return this.count+=1,e(r).map(function(e){var o=Date.now()-n,i=r.operationName||"Unnamed";return Z.info("[Apollo] #".concat(t.count,": ").concat(i," (").concat(o,"ms)")),e})}}]);return e}(T.ApolloLink);function rd(r){var e=r||{},t=e.uri,n=e.wsUrl,o=e.customLinks,i=new rf,l=(0,Q.onError)(function(r){var e=r.graphQLErrors,t=r.networkError,n=r.protocolErrors,o=r.operation;var i=(o===null||o===void 0?void 0:o.operationName)||"Unknown";if(e&&e.forEach(function(r){var e=r.message,t=r.locations,n=r.path;Z.error("[GraphQL error] ".concat(i,": ").concat(e,", Location: ").concat(JSON.stringify(t),", Path: ").concat(n))}),n&&n.forEach(function(r){var e=r.message,t=r.extensions;Z.error("[Protocol error]: ".concat(e,", Extensions: ").concat(JSON.stringify(t)))}),t&&Z.error("[Network error]: ".concat(t)),e||n||t){var l,a;var u=(e===null||e===void 0?void 0:(l=e[0])===null||l===void 0?void 0:l.message)||(n===null||n===void 0?void 0:(a=n[0])===null||a===void 0?void 0:a.message)||(t===null||t===void 0?void 0:t.message)||"Unexpected error",c=new T.ApolloError({graphQLErrors:e||[],protocolErrors:n||[],clientErrors:[],networkError:t||null,errorMessage:u,extraInfo:{operation:o}});J.toast.error(function(r){return(0,rs.jsxs)(rs.Fragment,{children:[u,"\xa0",(0,rs.jsx)(H.FaQuestion,{onClick:function(){setTimeout(function(){ra(c)},0),J.toast.dismiss(r.id)}})]})})}}),a=(0,R.removeTypenameFromVariables)();t||Z.warn('[Apollo] No GraphQL URI provided — using "'.concat(W,'" as default'));var u=new T.HttpLink({uri:t!==null&&t!==void 0?t:W,credentials:"include"}),c=n?new D.GraphQLWsLink((0,G.createClient)({url:n})):T.ApolloLink.empty(),s=f(c,T.ApolloLink)?(0,T.split)(function(r){var e=r.query;var t=(0,F.getMainDefinition)(e);return t.kind==="OperationDefinition"&&t.operation==="subscription"},c,u):u;return s===u&&n&&Z.warn("[Apollo] WS URL is set, but subscriptions fallback to HTTP. Check your wsLink config."),[i,l,a].concat(w(o!==null&&o!==void 0?o:[]),[s])}function rp(r){var e=r.isNextJS,t=r.options,n=r.children,o=r.client,i=r.provider,l=r.cache;var a=t||{},u=a.uri,c=a.wsUrl,s=a.customLinks,d=m(a,["uri","wsUrl","customLinks"]);if(typeof(o!==null&&o!==void 0?o:T.ApolloClient)!="function")throw new TypeError("Invalid ApolloClient provided. Ensure CustomClient is a class.");var p=i||T.ApolloProvider,v=(0,B.useMemo)(function(){return(0,T.from)(rd({uri:u,wsUrl:c,customLinks:s}))},[u,c,s]),y=(0,B.useMemo)(function(){return new T.ApolloClient(h({link:v,cache:f(l,T.InMemoryCache)?l:new T.InMemoryCache},d))},[v,l,d]),b=e?(0,rs.jsx)(p,{makeClient:function(){return y},children:n}):(0,rs.jsx)(p,{client:y,children:n});return e?(0,rs.jsx)(p,{makeClient:function(){return y},children:n}):(0,rs.jsxs)(rs.Fragment,{children:[(0,rs.jsxs)(ru,{children:[b,(0,rs.jsx)(rc,{})]}),(0,rs.jsx)(J.Toaster,{position:"top-right"})]})}0&&(module.exports={ApolloProvider:ApolloProvider});
|
|
1
|
+
"use strict";function r(r,e){if(e==null||e>r.length)e=r.length;for(var n=0,t=new Array(e);n<e;n++)t[n]=r[n];return t}function e(r){if(Array.isArray(r))return r}function n(e){if(Array.isArray(e))return r(e)}function t(r){if(r===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return r}function o(r,e,n){e=c(e);return g(r,k()?Reflect.construct(e,n||[],c(r).constructor):e.apply(r,n))}function i(r,e){if(!(r instanceof e)){throw new TypeError("Cannot call a class as a function")}}function l(r,e){for(var n=0;n<e.length;n++){var t=e[n];t.enumerable=t.enumerable||false;t.configurable=true;if("value"in t)t.writable=true;Object.defineProperty(r,t.key,t)}}function a(r,e,n){if(e)l(r.prototype,e);if(n)l(r,n);return r}function u(r,e,n){if(e in r){Object.defineProperty(r,e,{value:n,enumerable:true,configurable:true,writable:true})}else{r[e]=n}return r}function c(r){c=Object.setPrototypeOf?Object.getPrototypeOf:function r(r){return r.__proto__||Object.getPrototypeOf(r)};return c(r)}function s(r,e){if(typeof e!=="function"&&e!==null){throw new TypeError("Super expression must either be null or a function")}r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:true,configurable:true}});if(e)j(r,e)}function f(r,e){if(e!=null&&typeof Symbol!=="undefined"&&e[Symbol.hasInstance]){return!!e[Symbol.hasInstance](r)}else{return r instanceof e}}function d(r){if(typeof Symbol!=="undefined"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function p(r,e){var n=r==null?null:typeof Symbol!=="undefined"&&r[Symbol.iterator]||r["@@iterator"];if(n==null)return;var t=[];var o=true;var i=false;var l,a;try{for(n=n.call(r);!(o=(l=n.next()).done);o=true){t.push(l.value);if(e&&t.length===e)break}}catch(r){i=true;a=r}finally{try{if(!o&&n["return"]!=null)n["return"]()}finally{if(i)throw a}}return t}function v(){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 m(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function y(r){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};var t=Object.keys(n);if(typeof Object.getOwnPropertySymbols==="function"){t=t.concat(Object.getOwnPropertySymbols(n).filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable}))}t.forEach(function(e){u(r,e,n[e])})}return r}function h(r,e){if(r==null)return{};var n=b(r,e);var t,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(r);for(o=0;o<i.length;o++){t=i[o];if(e.indexOf(t)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(r,t))continue;n[t]=r[t]}}return n}function b(r,e){if(r==null)return{};var n={};var t=Object.keys(r);var o,i;for(i=0;i<t.length;i++){o=t[i];if(e.indexOf(o)>=0)continue;n[o]=r[o]}return n}function g(r,e){if(e&&(O(e)==="object"||typeof e==="function")){return e}return t(r)}function j(r,e){j=Object.setPrototypeOf||function r(r,e){r.__proto__=e;return r};return j(r,e)}function w(r,n){return e(r)||p(r,n)||E(r,n)||v()}function x(r){return n(r)||d(r)||E(r)||m()}function O(r){"@swc/helpers - typeof";return r&&typeof Symbol!=="undefined"&&r.constructor===Symbol?"symbol":typeof r}function E(e,n){if(!e)return;if(typeof e==="string")return r(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor)t=e.constructor.name;if(t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return r(e,n)}function k(){try{var r=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(r){}return(k=function(){return!!r})()}var P=Object.create;var S=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var q=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty;var N=function(r,e){for(var n in e)S(r,n,{get:e[n],enumerable:!0})},I=function(r,e,n,t){var o=true,i=false,l=undefined;if(e&&(typeof e==="undefined"?"undefined":O(e))=="object"||typeof e=="function")try{var a=function(){var o=c.value;!C.call(r,o)&&o!==n&&S(r,o,{get:function(){return e[o]},enumerable:!(t=A(e,o))||t.enumerable})};for(var u=L(e)[Symbol.iterator](),c;!(o=(c=u.next()).done);o=true)a()}catch(r){i=true;l=r}finally{try{if(!o&&u.return!=null){u.return()}}finally{if(i){throw l}}}return r};var _=function(r,e,n){return n=r!=null?P(q(r)):{},I(e||!r||!r.__esModule?S(n,"default",{value:r,enumerable:!0}):n,r)},U=function(r){return I(S({},"__esModule",{value:!0}),r)};var M={};N(M,{ApolloProvider:function(){return ru}});module.exports=U(M);var T=require("@apollo/client"),Q=require("@apollo/client/link/error"),R=require("@apollo/client/link/remove-typename"),D=require("@apollo/client/link/subscriptions"),F=require("@apollo/client/utilities"),G=require("graphql-ws"),J=require("react"),B=require("react-hot-toast"),H=require("react-icons/fa6");var W="/graphql";var V=require("consola/browser"),$={silent:V.consola.silent,level:V.consola.level,fatal:V.consola.fatal,error:V.consola.error,warn:V.consola.warn,log:V.consola.log,info:V.consola.info,success:V.consola.success,ready:V.consola.ready,start:V.consola.start,box:V.consola.box,debug:V.consola.debug,trace:V.consola.trace,verbose:V.consola.verbose};var z=require("react"),K=require("react-icons/fa6"),X=_(require("./apollo-error.module.scss"),1),Y=require("react/jsx-runtime"),Z=(0,z.createContext)(void 0);var rr=null;function re(r){rr=r}function rn(r){rr&&rr(r)}function rt(r){var e=r.children;var n=w((0,z.useState)(null),2),t=n[0],o=n[1];(0,z.useEffect)(function(){re(o)},[]);var i=(0,z.useMemo)(function(){return{error:t,showError:o,hideError:function(){return o(null)}}},[t]);return(0,Y.jsx)(Z,{value:i,children:e})}function ro(){var r,e,n;var t=(0,z.use)(Z);if(!t||!t.error)return null;var o=t.error,i=t.hideError;return(0,Y.jsx)("div",{className:X.default["modal-backdrop"],children:(0,Y.jsxs)("div",{className:X.default["modal-content"],children:[(0,Y.jsx)("button",{type:"button",className:X.default["btn-close"],onClick:i,children:"✕"}),(0,Y.jsx)("div",{className:X.default["error-title"],children:o.message}),(0,Y.jsxs)("div",{className:X.default["error-details"],children:[o.networkError&&(0,Y.jsxs)("pre",{className:"network",children:[(0,Y.jsx)("strong",{children:"Network Error:"}),"\xa0",o.networkError.message]}),((r=o.graphQLErrors)===null||r===void 0?void 0:r.length)>0&&(0,Y.jsxs)("div",{children:[(0,Y.jsx)("strong",{children:"GraphQL Errors:"}),(0,Y.jsx)("ul",{children:o.graphQLErrors.map(function(r){return(0,Y.jsx)("li",{children:r.message},r.message)})})]}),((e=o.protocolErrors)===null||e===void 0?void 0:e.length)>0&&(0,Y.jsxs)("div",{children:[(0,Y.jsx)("strong",{children:"Protocol Errors:"}),(0,Y.jsx)("ul",{children:o.protocolErrors.map(function(r){return(0,Y.jsx)("li",{children:r.message},r.message)})})]}),((n=o.clientErrors)===null||n===void 0?void 0:n.length)>0&&(0,Y.jsxs)("div",{children:[(0,Y.jsx)("strong",{children:"Client Errors:"}),(0,Y.jsx)("ul",{children:o.clientErrors.map(function(r){return(0,Y.jsx)("li",{children:r.message},r.message)})})]}),o.extraInfo&&(0,Y.jsxs)("pre",{className:"extra",children:[(0,Y.jsx)("strong",{children:"Extra Info:"}),"\xa0",JSON.stringify(o.extraInfo,null,4)]})]}),(0,Y.jsx)("button",{type:"button",className:X.default["btn-retry"],onClick:function(){return window.location.reload()},children:(0,Y.jsx)(K.FaRepeat,{})})]})})}var ri=require("react/jsx-runtime"),rl=/*#__PURE__*/function(r){s(e,r);function e(){i(this,e);var r;r=o(this,e,arguments);r.count=0;return r}a(e,[{key:"request",value:function r(r,e){var n=this;var t=Date.now();return this.count+=1,e(r).map(function(e){var o=Date.now()-t,i=r.operationName||"Unnamed";return $.info("[Apollo] #".concat(n.count,": ").concat(i," (").concat(o,"ms)")),e})}}]);return e}(T.ApolloLink);function ra(r){var e=r||{},n=e.uri,t=e.wsUrl,o=e.customLinks,i=new rl,l=(0,Q.onError)(function(r){var e=r.graphQLErrors,n=r.networkError,t=r.protocolErrors,o=r.operation;var i=(o===null||o===void 0?void 0:o.operationName)||"Unknown";if(e&&e.forEach(function(r){var e=r.message,n=r.locations,t=r.path;$.error("[GraphQL error] ".concat(i,": ").concat(e,", Location: ").concat(JSON.stringify(n),", Path: ").concat(t))}),t&&t.forEach(function(r){var e=r.message,n=r.extensions;$.error("[Protocol error]: ".concat(e,", Extensions: ").concat(JSON.stringify(n)))}),n&&$.error("[Network error]: ".concat(n)),e||t||n){var l,a;var u=(e===null||e===void 0?void 0:(l=e[0])===null||l===void 0?void 0:l.message)||(t===null||t===void 0?void 0:(a=t[0])===null||a===void 0?void 0:a.message)||(n===null||n===void 0?void 0:n.message)||"Unexpected error",c=new T.ApolloError({graphQLErrors:e||[],protocolErrors:t||[],clientErrors:[],networkError:n||null,errorMessage:u,extraInfo:{operation:o}});B.toast.error(function(r){return(0,ri.jsxs)(ri.Fragment,{children:[u,"\xa0",(0,ri.jsx)(H.FaExpand,{onClick:function(){setTimeout(function(){rn(c)},0),B.toast.dismiss(r.id)}})]})})}}),a=(0,R.removeTypenameFromVariables)();n||$.warn('[Apollo] No GraphQL URI provided — using "'.concat(W,'" as default'));var u=new T.HttpLink({uri:n!==null&&n!==void 0?n:W,credentials:"include"}),c=t?new D.GraphQLWsLink((0,G.createClient)({url:t})):T.ApolloLink.empty(),s=f(c,T.ApolloLink)?(0,T.split)(function(r){var e=r.query;var n=(0,F.getMainDefinition)(e);return n.kind==="OperationDefinition"&&n.operation==="subscription"},c,u):u;return s===u&&t&&$.warn("[Apollo] WS URL is set, but subscriptions fallback to HTTP. Check your wsLink config."),[i,l,a].concat(x(o!==null&&o!==void 0?o:[]),[s])}function ru(r){var e=r.isNextJS,n=r.options,t=r.children,o=r.client,i=r.provider,l=r.cache;var a=n||{},u=a.uri,c=a.wsUrl,s=a.customLinks,d=h(a,["uri","wsUrl","customLinks"]);if(typeof(o!==null&&o!==void 0?o:T.ApolloClient)!="function")throw new TypeError("Invalid ApolloClient provided. Ensure CustomClient is a class.");var p=i||T.ApolloProvider,v=(0,J.useMemo)(function(){return(0,T.from)(ra({uri:u,wsUrl:c,customLinks:s}))},[u,c,s]),m=(0,J.useMemo)(function(){return new T.ApolloClient(y({link:v,cache:f(l,T.InMemoryCache)?l:new T.InMemoryCache},d))},[v,l,d]),b=e?(0,ri.jsx)(p,{makeClient:function(){return m},children:t}):(0,ri.jsx)(p,{client:m,children:t});return e?(0,ri.jsx)(p,{makeClient:function(){return m},children:t}):(0,ri.jsxs)(ri.Fragment,{children:[(0,ri.jsxs)(rt,{children:[b,(0,ri.jsx)(ro,{})]}),(0,ri.jsx)(B.Toaster,{position:"top-right"})]})}0&&(module.exports={ApolloProvider:ApolloProvider});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function r(r,e){if(e==null||e>r.length)e=r.length;for(var n=0,t=new Array(e);n<e;n++)t[n]=r[n];return t}function e(r){if(Array.isArray(r))return r}function n(e){if(Array.isArray(e))return r(e)}function t(r){if(r===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return r}function o(r,e,n){e=u(e);return g(r,x()?Reflect.construct(e,n||[],u(r).constructor):e.apply(r,n))}function i(r,e){if(!(r instanceof e)){throw new TypeError("Cannot call a class as a function")}}function a(r,e){for(var n=0;n<e.length;n++){var t=e[n];t.enumerable=t.enumerable||false;t.configurable=true;if("value"in t)t.writable=true;Object.defineProperty(r,t.key,t)}}function l(r,e,n){if(e)a(r.prototype,e);if(n)a(r,n);return r}function c(r,e,n){if(e in r){Object.defineProperty(r,e,{value:n,enumerable:true,configurable:true,writable:true})}else{r[e]=n}return r}function u(r){u=Object.setPrototypeOf?Object.getPrototypeOf:function r(r){return r.__proto__||Object.getPrototypeOf(r)};return u(r)}function s(r,e){if(typeof e!=="function"&&e!==null){throw new TypeError("Super expression must either be null or a function")}r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:true,configurable:true}});if(e)w(r,e)}function f(r,e){if(e!=null&&typeof Symbol!=="undefined"&&e[Symbol.hasInstance]){return!!e[Symbol.hasInstance](r)}else{return r instanceof e}}function p(r){if(typeof Symbol!=="undefined"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function m(r,e){var n=r==null?null:typeof Symbol!=="undefined"&&r[Symbol.iterator]||r["@@iterator"];if(n==null)return;var t=[];var o=true;var i=false;var a,l;try{for(n=n.call(r);!(o=(a=n.next()).done);o=true){t.push(a.value);if(e&&t.length===e)break}}catch(r){i=true;l=r}finally{try{if(!o&&n["return"]!=null)n["return"]()}finally{if(i)throw l}}return t}function d(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function v(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function h(r){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};var t=Object.keys(n);if(typeof Object.getOwnPropertySymbols==="function"){t=t.concat(Object.getOwnPropertySymbols(n).filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable}))}t.forEach(function(e){c(r,e,n[e])})}return r}function y(r,e){if(r==null)return{};var n=b(r,e);var t,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(r);for(o=0;o<i.length;o++){t=i[o];if(e.indexOf(t)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(r,t))continue;n[t]=r[t]}}return n}function b(r,e){if(r==null)return{};var n={};var t=Object.keys(r);var o,i;for(i=0;i<t.length;i++){o=t[i];if(e.indexOf(o)>=0)continue;n[o]=r[o]}return n}function g(r,e){if(e&&(O(e)==="object"||typeof e==="function")){return e}return t(r)}function w(r,e){w=Object.setPrototypeOf||function r(r,e){r.__proto__=e;return r};return w(r,e)}function E(r,n){return e(r)||m(r,n)||j(r,n)||d()}function k(r){return n(r)||p(r)||j(r)||v()}function O(r){"@swc/helpers - typeof";return r&&typeof Symbol!=="undefined"&&r.constructor===Symbol?"symbol":typeof r}function j(e,n){if(!e)return;if(typeof e==="string")return r(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor)t=e.constructor.name;if(t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return r(e,n)}function x(){try{var r=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(r){}return(x=function(){return!!r})()}import{ApolloClient as S,ApolloError as L,ApolloLink as A,ApolloProvider as P,from as N,HttpLink as C,InMemoryCache as I,split as U}from"@apollo/client";import{onError as _}from"@apollo/client/link/error";import{removeTypenameFromVariables as Q}from"@apollo/client/link/remove-typename";import{GraphQLWsLink as T}from"@apollo/client/link/subscriptions";import{getMainDefinition as R}from"@apollo/client/utilities";import{createClient as M}from"graphql-ws";import{useMemo as D}from"react";import{toast as G,Toaster as q}from"react-hot-toast";import{FaQuestion as F}from"react-icons/fa6";var B="/graphql";import J from"chalk";import H from"consola";import{GraphQLError as W}from"graphql";import $ from"node:process";var V=$.env.DEBUG==="true";V||(H.level=4);function z(r){var e=J[r];return typeof e=="function"?e:J.green}var K={silent:H.silent,level:H.level,fatal:H.fatal,error:H.error,warn:H.warn,log:H.log,info:H.info,success:H.success,ready:H.ready,start:H.start,box:H.box,debug:H.debug,trace:H.trace,verbose:H.verbose,printBoxedLog:function r(r,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(e===null||e===void 0?void 0:e.length)){H.box(J.green(r));return}e.forEach(function(r){var e=r.file,t=r.position,o=r.rule,i=r.message;H.log("".concat(J.gray("File:")," ").concat(J.blue("".concat(e).concat(t?":".concat(t):"")))),o&&H.log(" ".concat(z(n)("Rule:")," ").concat(o)),H.log(" ".concat(z(n)("Message:")," ").concat(i))}),H.box(z(n)("".concat(r," : ").concat(e.length))),H.log(J.gray("─".repeat(40)))}};import{createContext as X,use as Y,useEffect as Z,useMemo as rr,useState as re}from"react";import{FaRepeat as rn}from"react-icons/fa6";import rt from"./apollo-error.module.scss";import{jsx as ro,jsxs as ri}from"react/jsx-runtime";var ra=X(void 0);var rl=null;function rc(r){rl=r}function ru(r){rl&&rl(r)}function rs(r){var e=r.children;var n=E(re(null),2),t=n[0],o=n[1];Z(function(){rc(o)},[]);var i=rr(function(){return{error:t,showError:o,hideError:function(){return o(null)}}},[t]);return ro(ra,{value:i,children:e})}function rf(){var r,e,n;var t=Y(ra);if(!t||!t.error)return null;var o=t.error,i=t.hideError;return ro("div",{className:rt["modal-backdrop"],children:ri("div",{className:rt["modal-content"],children:[ro("button",{type:"button",className:rt["btn-close"],onClick:i,children:"✕"}),ro("div",{className:rt["error-title"],children:o.message}),ri("div",{className:rt["error-details"],children:[o.networkError&&ri("pre",{className:"network",children:[ro("strong",{children:"Network Error:"}),"\xa0",o.networkError.message]}),((r=o.graphQLErrors)===null||r===void 0?void 0:r.length)>0&&ri("div",{children:[ro("strong",{children:"GraphQL Errors:"}),ro("ul",{children:o.graphQLErrors.map(function(r){return ro("li",{children:r.message},r.message)})})]}),((e=o.protocolErrors)===null||e===void 0?void 0:e.length)>0&&ri("div",{children:[ro("strong",{children:"Protocol Errors:"}),ro("ul",{children:o.protocolErrors.map(function(r){return ro("li",{children:r.message},r.message)})})]}),((n=o.clientErrors)===null||n===void 0?void 0:n.length)>0&&ri("div",{children:[ro("strong",{children:"Client Errors:"}),ro("ul",{children:o.clientErrors.map(function(r){return ro("li",{children:r.message},r.message)})})]}),o.extraInfo&&ri("pre",{className:"extra",children:[ro("strong",{children:"Extra Info:"}),"\xa0",JSON.stringify(o.extraInfo,null,4)]})]}),ro("button",{type:"button",className:rt["btn-retry"],onClick:function(){return window.location.reload()},children:ro(rn,{})})]})})}import{Fragment as rp,jsx as rm,jsxs as rd}from"react/jsx-runtime";var rv=/*#__PURE__*/function(r){"use strict";s(e,r);function e(){i(this,e);var r;r=o(this,e,arguments);r.count=0;return r}l(e,[{key:"request",value:function r(r,e){var n=this;var t=Date.now();return this.count+=1,e(r).map(function(e){var o=Date.now()-t,i=r.operationName||"Unnamed";return K.info("[Apollo] #".concat(n.count,": ").concat(i," (").concat(o,"ms)")),e})}}]);return e}(A);function rh(r){var e=r||{},n=e.uri,t=e.wsUrl,o=e.customLinks,i=new rv,a=_(function(r){var e=r.graphQLErrors,n=r.networkError,t=r.protocolErrors,o=r.operation;var i=(o===null||o===void 0?void 0:o.operationName)||"Unknown";if(e&&e.forEach(function(r){var e=r.message,n=r.locations,t=r.path;K.error("[GraphQL error] ".concat(i,": ").concat(e,", Location: ").concat(JSON.stringify(n),", Path: ").concat(t))}),t&&t.forEach(function(r){var e=r.message,n=r.extensions;K.error("[Protocol error]: ".concat(e,", Extensions: ").concat(JSON.stringify(n)))}),n&&K.error("[Network error]: ".concat(n)),e||t||n){var a,l;var c=(e===null||e===void 0?void 0:(a=e[0])===null||a===void 0?void 0:a.message)||(t===null||t===void 0?void 0:(l=t[0])===null||l===void 0?void 0:l.message)||(n===null||n===void 0?void 0:n.message)||"Unexpected error",u=new L({graphQLErrors:e||[],protocolErrors:t||[],clientErrors:[],networkError:n||null,errorMessage:c,extraInfo:{operation:o}});G.error(function(r){return rd(rp,{children:[c,"\xa0",rm(F,{onClick:function(){setTimeout(function(){ru(u)},0),G.dismiss(r.id)}})]})})}}),l=Q();n||K.warn('[Apollo] No GraphQL URI provided — using "'.concat(B,'" as default'));var c=new C({uri:n!==null&&n!==void 0?n:B,credentials:"include"}),u=t?new T(M({url:t})):A.empty(),s=f(u,A)?U(function(r){var e=r.query;var n=R(e);return n.kind==="OperationDefinition"&&n.operation==="subscription"},u,c):c;return s===c&&t&&K.warn("[Apollo] WS URL is set, but subscriptions fallback to HTTP. Check your wsLink config."),[i,a,l].concat(k(o!==null&&o!==void 0?o:[]),[s])}function ry(r){var e=r.isNextJS,n=r.options,t=r.children,o=r.client,i=r.provider,a=r.cache;var l=n||{},c=l.uri,u=l.wsUrl,s=l.customLinks,p=y(l,["uri","wsUrl","customLinks"]);if(typeof(o!==null&&o!==void 0?o:S)!="function")throw new TypeError("Invalid ApolloClient provided. Ensure CustomClient is a class.");var m=i||P,d=D(function(){return N(rh({uri:c,wsUrl:u,customLinks:s}))},[c,u,s]),v=D(function(){return new S(h({link:d,cache:f(a,I)?a:new I},p))},[d,a,p]),b=e?rm(m,{makeClient:function(){return v},children:t}):rm(m,{client:v,children:t});return e?rm(m,{makeClient:function(){return v},children:t}):rd(rp,{children:[rd(rs,{children:[b,rm(rf,{})]}),rm(q,{position:"top-right"})]})}export{ry as ApolloProvider};
|
|
1
|
+
function r(r,e){if(e==null||e>r.length)e=r.length;for(var n=0,t=new Array(e);n<e;n++)t[n]=r[n];return t}function e(r){if(Array.isArray(r))return r}function n(e){if(Array.isArray(e))return r(e)}function t(r){if(r===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return r}function o(r,e,n){e=u(e);return g(r,x()?Reflect.construct(e,n||[],u(r).constructor):e.apply(r,n))}function i(r,e){if(!(r instanceof e)){throw new TypeError("Cannot call a class as a function")}}function a(r,e){for(var n=0;n<e.length;n++){var t=e[n];t.enumerable=t.enumerable||false;t.configurable=true;if("value"in t)t.writable=true;Object.defineProperty(r,t.key,t)}}function l(r,e,n){if(e)a(r.prototype,e);if(n)a(r,n);return r}function c(r,e,n){if(e in r){Object.defineProperty(r,e,{value:n,enumerable:true,configurable:true,writable:true})}else{r[e]=n}return r}function u(r){u=Object.setPrototypeOf?Object.getPrototypeOf:function r(r){return r.__proto__||Object.getPrototypeOf(r)};return u(r)}function s(r,e){if(typeof e!=="function"&&e!==null){throw new TypeError("Super expression must either be null or a function")}r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:true,configurable:true}});if(e)w(r,e)}function f(r,e){if(e!=null&&typeof Symbol!=="undefined"&&e[Symbol.hasInstance]){return!!e[Symbol.hasInstance](r)}else{return r instanceof e}}function p(r){if(typeof Symbol!=="undefined"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function m(r,e){var n=r==null?null:typeof Symbol!=="undefined"&&r[Symbol.iterator]||r["@@iterator"];if(n==null)return;var t=[];var o=true;var i=false;var a,l;try{for(n=n.call(r);!(o=(a=n.next()).done);o=true){t.push(a.value);if(e&&t.length===e)break}}catch(r){i=true;l=r}finally{try{if(!o&&n["return"]!=null)n["return"]()}finally{if(i)throw l}}return t}function d(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function v(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function h(r){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};var t=Object.keys(n);if(typeof Object.getOwnPropertySymbols==="function"){t=t.concat(Object.getOwnPropertySymbols(n).filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable}))}t.forEach(function(e){c(r,e,n[e])})}return r}function y(r,e){if(r==null)return{};var n=b(r,e);var t,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(r);for(o=0;o<i.length;o++){t=i[o];if(e.indexOf(t)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(r,t))continue;n[t]=r[t]}}return n}function b(r,e){if(r==null)return{};var n={};var t=Object.keys(r);var o,i;for(i=0;i<t.length;i++){o=t[i];if(e.indexOf(o)>=0)continue;n[o]=r[o]}return n}function g(r,e){if(e&&(O(e)==="object"||typeof e==="function")){return e}return t(r)}function w(r,e){w=Object.setPrototypeOf||function r(r,e){r.__proto__=e;return r};return w(r,e)}function E(r,n){return e(r)||m(r,n)||j(r,n)||d()}function k(r){return n(r)||p(r)||j(r)||v()}function O(r){"@swc/helpers - typeof";return r&&typeof Symbol!=="undefined"&&r.constructor===Symbol?"symbol":typeof r}function j(e,n){if(!e)return;if(typeof e==="string")return r(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor)t=e.constructor.name;if(t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return r(e,n)}function x(){try{var r=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(r){}return(x=function(){return!!r})()}import{ApolloClient as S,ApolloError as A,ApolloLink as L,ApolloProvider as P,from as N,HttpLink as C,InMemoryCache as I,split as _}from"@apollo/client";import{onError as U}from"@apollo/client/link/error";import{removeTypenameFromVariables as T}from"@apollo/client/link/remove-typename";import{GraphQLWsLink as Q}from"@apollo/client/link/subscriptions";import{getMainDefinition as R}from"@apollo/client/utilities";import{createClient as M}from"graphql-ws";import{useMemo as D}from"react";import{toast as q,Toaster as F}from"react-hot-toast";import{FaExpand as G}from"react-icons/fa6";var J="/graphql";import{consola as B}from"consola/browser";var H={silent:B.silent,level:B.level,fatal:B.fatal,error:B.error,warn:B.warn,log:B.log,info:B.info,success:B.success,ready:B.ready,start:B.start,box:B.box,debug:B.debug,trace:B.trace,verbose:B.verbose};import{createContext as V,use as W,useEffect as $,useMemo as z,useState as K}from"react";import{FaRepeat as X}from"react-icons/fa6";import Y from"./apollo-error.module.scss";import{jsx as Z,jsxs as rr}from"react/jsx-runtime";var re=V(void 0);var rn=null;function rt(r){rn=r}function ro(r){rn&&rn(r)}function ri(r){var e=r.children;var n=E(K(null),2),t=n[0],o=n[1];$(function(){rt(o)},[]);var i=z(function(){return{error:t,showError:o,hideError:function(){return o(null)}}},[t]);return Z(re,{value:i,children:e})}function ra(){var r,e,n;var t=W(re);if(!t||!t.error)return null;var o=t.error,i=t.hideError;return Z("div",{className:Y["modal-backdrop"],children:rr("div",{className:Y["modal-content"],children:[Z("button",{type:"button",className:Y["btn-close"],onClick:i,children:"✕"}),Z("div",{className:Y["error-title"],children:o.message}),rr("div",{className:Y["error-details"],children:[o.networkError&&rr("pre",{className:"network",children:[Z("strong",{children:"Network Error:"}),"\xa0",o.networkError.message]}),((r=o.graphQLErrors)===null||r===void 0?void 0:r.length)>0&&rr("div",{children:[Z("strong",{children:"GraphQL Errors:"}),Z("ul",{children:o.graphQLErrors.map(function(r){return Z("li",{children:r.message},r.message)})})]}),((e=o.protocolErrors)===null||e===void 0?void 0:e.length)>0&&rr("div",{children:[Z("strong",{children:"Protocol Errors:"}),Z("ul",{children:o.protocolErrors.map(function(r){return Z("li",{children:r.message},r.message)})})]}),((n=o.clientErrors)===null||n===void 0?void 0:n.length)>0&&rr("div",{children:[Z("strong",{children:"Client Errors:"}),Z("ul",{children:o.clientErrors.map(function(r){return Z("li",{children:r.message},r.message)})})]}),o.extraInfo&&rr("pre",{className:"extra",children:[Z("strong",{children:"Extra Info:"}),"\xa0",JSON.stringify(o.extraInfo,null,4)]})]}),Z("button",{type:"button",className:Y["btn-retry"],onClick:function(){return window.location.reload()},children:Z(X,{})})]})})}import{Fragment as rl,jsx as rc,jsxs as ru}from"react/jsx-runtime";var rs=/*#__PURE__*/function(r){"use strict";s(e,r);function e(){i(this,e);var r;r=o(this,e,arguments);r.count=0;return r}l(e,[{key:"request",value:function r(r,e){var n=this;var t=Date.now();return this.count+=1,e(r).map(function(e){var o=Date.now()-t,i=r.operationName||"Unnamed";return H.info("[Apollo] #".concat(n.count,": ").concat(i," (").concat(o,"ms)")),e})}}]);return e}(L);function rf(r){var e=r||{},n=e.uri,t=e.wsUrl,o=e.customLinks,i=new rs,a=U(function(r){var e=r.graphQLErrors,n=r.networkError,t=r.protocolErrors,o=r.operation;var i=(o===null||o===void 0?void 0:o.operationName)||"Unknown";if(e&&e.forEach(function(r){var e=r.message,n=r.locations,t=r.path;H.error("[GraphQL error] ".concat(i,": ").concat(e,", Location: ").concat(JSON.stringify(n),", Path: ").concat(t))}),t&&t.forEach(function(r){var e=r.message,n=r.extensions;H.error("[Protocol error]: ".concat(e,", Extensions: ").concat(JSON.stringify(n)))}),n&&H.error("[Network error]: ".concat(n)),e||t||n){var a,l;var c=(e===null||e===void 0?void 0:(a=e[0])===null||a===void 0?void 0:a.message)||(t===null||t===void 0?void 0:(l=t[0])===null||l===void 0?void 0:l.message)||(n===null||n===void 0?void 0:n.message)||"Unexpected error",u=new A({graphQLErrors:e||[],protocolErrors:t||[],clientErrors:[],networkError:n||null,errorMessage:c,extraInfo:{operation:o}});q.error(function(r){return ru(rl,{children:[c,"\xa0",rc(G,{onClick:function(){setTimeout(function(){ro(u)},0),q.dismiss(r.id)}})]})})}}),l=T();n||H.warn('[Apollo] No GraphQL URI provided — using "'.concat(J,'" as default'));var c=new C({uri:n!==null&&n!==void 0?n:J,credentials:"include"}),u=t?new Q(M({url:t})):L.empty(),s=f(u,L)?_(function(r){var e=r.query;var n=R(e);return n.kind==="OperationDefinition"&&n.operation==="subscription"},u,c):c;return s===c&&t&&H.warn("[Apollo] WS URL is set, but subscriptions fallback to HTTP. Check your wsLink config."),[i,a,l].concat(k(o!==null&&o!==void 0?o:[]),[s])}function rp(r){var e=r.isNextJS,n=r.options,t=r.children,o=r.client,i=r.provider,a=r.cache;var l=n||{},c=l.uri,u=l.wsUrl,s=l.customLinks,p=y(l,["uri","wsUrl","customLinks"]);if(typeof(o!==null&&o!==void 0?o:S)!="function")throw new TypeError("Invalid ApolloClient provided. Ensure CustomClient is a class.");var m=i||P,d=D(function(){return N(rf({uri:c,wsUrl:u,customLinks:s}))},[c,u,s]),v=D(function(){return new S(h({link:d,cache:f(a,I)?a:new I},p))},[d,a,p]),b=e?rc(m,{makeClient:function(){return v},children:t}):rc(m,{client:v,children:t});return e?rc(m,{makeClient:function(){return v},children:t}):ru(rl,{children:[ru(ri,{children:[b,rc(ra,{})]}),rc(F,{position:"top-right"})]})}export{rp as ApolloProvider};
|
package/dist/react/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function e(e,r){if(r==null||r>e.length)r=e.length;for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function r(e){if(Array.isArray(e))return e}function t(r){if(Array.isArray(r))return e(r)}function n(e){if(e===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return e}function o(e,r,t,n,o,i,a){try{var u=e[i](a);var l=u.value}catch(e){t(e);return}if(u.done){r(l)}else{Promise.resolve(l).then(n,o)}}function i(e){return function(){var r=this,t=arguments;return new Promise(function(n,i){var a=e.apply(r,t);function u(e){o(a,n,i,u,l,"next",e)}function l(e){o(a,n,i,u,l,"throw",e)}u(undefined)})}}function a(e,r,t){r=f(r);return E(e,L()?Reflect.construct(r,t||[],f(e).constructor):r.apply(e,t))}function u(e,r){if(!(e instanceof r)){throw new TypeError("Cannot call a class as a function")}}function l(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||false;n.configurable=true;if("value"in n)n.writable=true;Object.defineProperty(e,n.key,n)}}function c(e,r,t){if(r)l(e.prototype,r);if(t)l(e,t);return e}function s(e,r,t){if(r in e){Object.defineProperty(e,r,{value:t,enumerable:true,configurable:true,writable:true})}else{e[r]=t}return e}function f(e){f=Object.setPrototypeOf?Object.getPrototypeOf:function e(e){return e.__proto__||Object.getPrototypeOf(e)};return f(e)}function d(e,r){if(typeof r!=="function"&&r!==null){throw new TypeError("Super expression must either be null or a function")}e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:true,configurable:true}});if(r)k(e,r)}function v(e,r){if(r!=null&&typeof Symbol!=="undefined"&&r[Symbol.hasInstance]){return!!r[Symbol.hasInstance](e)}else{return e instanceof r}}function p(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function g(e,r){var t=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(t==null)return;var n=[];var o=true;var i=false;var a,u;try{for(t=t.call(e);!(o=(a=t.next()).done);o=true){n.push(a.value);if(r&&n.length===r)break}}catch(e){i=true;u=e}finally{try{if(!o&&t["return"]!=null)t["return"]()}finally{if(i)throw u}}return n}function h(){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 m(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function y(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};var n=Object.keys(t);if(typeof Object.getOwnPropertySymbols==="function"){n=n.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))}n.forEach(function(r){s(e,r,t[r])})}return e}function b(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);if(r){n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})}t.push.apply(t,n)}return t}function w(e,r){r=r!=null?r:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(r))}else{b(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function x(e,r){if(e==null)return{};var t=j(e,r);var n,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++){n=i[o];if(r.indexOf(n)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(e,n))continue;t[n]=e[n]}}return t}function j(e,r){if(e==null)return{};var t={};var n=Object.keys(e);var o,i;for(i=0;i<n.length;i++){o=n[i];if(r.indexOf(o)>=0)continue;t[o]=e[o]}return t}function E(e,r){if(r&&(P(r)==="object"||typeof r==="function")){return r}return n(e)}function k(e,r){k=Object.setPrototypeOf||function e(e,r){e.__proto__=r;return e};return k(e,r)}function O(e,t){return r(e)||g(e,t)||S(e,t)||h()}function N(e){return t(e)||p(e)||S(e)||m()}function P(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function S(r,t){if(!r)return;if(typeof r==="string")return e(r,t);var n=Object.prototype.toString.call(r).slice(8,-1);if(n==="Object"&&r.constructor)n=r.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(r,t)}function L(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(L=function(){return!!e})()}function A(e,r){var t,n,o,i,a={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),"throw":u(1),"return":u(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function u(e){return function(r){return l([e,r])}}function l(i){if(t)throw new TypeError("Generator is already executing.");while(a)try{if(t=1,n&&(o=i[0]&2?n["return"]:i[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;if(n=0,o)i=[i[0]&2,o.value];switch(i[0]){case 0:case 1:o=i;break;case 4:a.label++;return{value:i[1],done:false};case 5:a.label++;n=i[1];i=[0];continue;case 7:i=a.ops.pop();a.trys.pop();continue;default:if(!(o=a.trys,o=o.length>0&&o[o.length-1])&&(i[0]===6||i[0]===2)){a=0;continue}if(i[0]===3&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(i[0]===6&&a.label<o[1]){a.label=o[1];o=i;break}if(o&&a.label<o[2]){a.label=o[2];a.ops.push(i);break}if(o[2])a.ops.pop();a.trys.pop();continue}i=r.call(e,a)}catch(e){i=[6,e];n=0}finally{t=o=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}}var I=Object.create;var C=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var M=Object.getPrototypeOf,D=Object.prototype.hasOwnProperty;var T=function(e,r){for(var t in r)C(e,t,{get:r[t],enumerable:!0})},V=function(e,r,t,n){var o=true,i=false,a=undefined;if(r&&(typeof r==="undefined"?"undefined":P(r))=="object"||typeof r=="function")try{var u=function(){var o=c.value;!D.call(e,o)&&o!==t&&C(e,o,{get:function(){return r[o]},enumerable:!(n=q(r,o))||n.enumerable})};for(var l=_(r)[Symbol.iterator](),c;!(o=(c=l.next()).done);o=true)u()}catch(e){i=true;a=e}finally{try{if(!o&&l.return!=null){l.return()}}finally{if(i){throw a}}}return e};var U=function(e,r,t){return t=e!=null?I(M(e)):{},V(r||!e||!e.__esModule?C(t,"default",{value:e,enumerable:!0}):t,e)},G=function(e){return V(C({},"__esModule",{value:!0}),e)};var Q={};T(Q,{ApolloErrorViewerModal:function(){return eg},ApolloErrorViewerProvider:function(){return ep},ApolloProvider:function(){return eb},Loading:function(){return eN},LoadingContext:function(){return ek},LoadingProvider:function(){return eP},NextIntlContext:function(){return eD},NextIntlProvider:function(){return eR},registerApolloErrorViewerCallback:function(){return ed},showGlobalApolloError:function(){return ev},useApolloErrorViewer:function(){return es},useLoading:function(){return eO},useNextIntl:function(){return eT},useStorage:function(){return e_},useTranslateNextIntl:function(){return eV},withNextIntl:function(){return eU}});module.exports=G(Q);var R=require("@apollo/client"),F=require("@apollo/client/link/error"),z=require("@apollo/client/link/remove-typename"),J=require("@apollo/client/link/subscriptions"),B=require("@apollo/client/utilities"),H=require("graphql-ws"),W=require("react"),Z=require("react-hot-toast"),$=require("react-icons/fa6");var K="/graphql";var X=U(require("chalk"),1),Y=U(require("consola"),1),ee=require("graphql");var er=U(require("process"),1);var et=er.default.env.DEBUG==="true";et||(Y.default.level=4);function en(e){var r=X.default[e];return typeof r=="function"?r:X.default.green}var eo={silent:Y.default.silent,level:Y.default.level,fatal:Y.default.fatal,error:Y.default.error,warn:Y.default.warn,log:Y.default.log,info:Y.default.info,success:Y.default.success,ready:Y.default.ready,start:Y.default.start,box:Y.default.box,debug:Y.default.debug,trace:Y.default.trace,verbose:Y.default.verbose,printBoxedLog:function e(e,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(r===null||r===void 0?void 0:r.length)){Y.default.box(X.default.green(e));return}r.forEach(function(e){var r=e.file,n=e.position,o=e.rule,i=e.message;Y.default.log("".concat(X.default.gray("File:")," ").concat(X.default.blue("".concat(r).concat(n?":".concat(n):"")))),o&&Y.default.log(" ".concat(en(t)("Rule:")," ").concat(o)),Y.default.log(" ".concat(en(t)("Message:")," ").concat(i))}),Y.default.box(en(t)("".concat(e," : ").concat(r.length))),Y.default.log(X.default.gray("─".repeat(40)))}};var ei=require("react"),ea=require("react-icons/fa6"),eu=U(require("./apollo-error.module.scss"),1),el=require("react/jsx-runtime"),ec=(0,ei.createContext)(void 0);function es(){var e=(0,ei.use)(ec);if(!e)throw new Error("useApolloErrorViewer must be used within ApolloErrorViewerProvider");return e}var ef=null;function ed(e){ef=e}function ev(e){ef&&ef(e)}function ep(e){var r=e.children;var t=O((0,ei.useState)(null),2),n=t[0],o=t[1];(0,ei.useEffect)(function(){ed(o)},[]);var i=(0,ei.useMemo)(function(){return{error:n,showError:o,hideError:function(){return o(null)}}},[n]);return(0,el.jsx)(ec,{value:i,children:r})}function eg(){var e,r,t;var n=(0,ei.use)(ec);if(!n||!n.error)return null;var o=n.error,i=n.hideError;return(0,el.jsx)("div",{className:eu.default["modal-backdrop"],children:(0,el.jsxs)("div",{className:eu.default["modal-content"],children:[(0,el.jsx)("button",{type:"button",className:eu.default["btn-close"],onClick:i,children:"✕"}),(0,el.jsx)("div",{className:eu.default["error-title"],children:o.message}),(0,el.jsxs)("div",{className:eu.default["error-details"],children:[o.networkError&&(0,el.jsxs)("pre",{className:"network",children:[(0,el.jsx)("strong",{children:"Network Error:"}),"\xa0",o.networkError.message]}),((e=o.graphQLErrors)===null||e===void 0?void 0:e.length)>0&&(0,el.jsxs)("div",{children:[(0,el.jsx)("strong",{children:"GraphQL Errors:"}),(0,el.jsx)("ul",{children:o.graphQLErrors.map(function(e){return(0,el.jsx)("li",{children:e.message},e.message)})})]}),((r=o.protocolErrors)===null||r===void 0?void 0:r.length)>0&&(0,el.jsxs)("div",{children:[(0,el.jsx)("strong",{children:"Protocol Errors:"}),(0,el.jsx)("ul",{children:o.protocolErrors.map(function(e){return(0,el.jsx)("li",{children:e.message},e.message)})})]}),((t=o.clientErrors)===null||t===void 0?void 0:t.length)>0&&(0,el.jsxs)("div",{children:[(0,el.jsx)("strong",{children:"Client Errors:"}),(0,el.jsx)("ul",{children:o.clientErrors.map(function(e){return(0,el.jsx)("li",{children:e.message},e.message)})})]}),o.extraInfo&&(0,el.jsxs)("pre",{className:"extra",children:[(0,el.jsx)("strong",{children:"Extra Info:"}),"\xa0",JSON.stringify(o.extraInfo,null,4)]})]}),(0,el.jsx)("button",{type:"button",className:eu.default["btn-retry"],onClick:function(){return window.location.reload()},children:(0,el.jsx)(ea.FaRepeat,{})})]})})}var eh=require("react/jsx-runtime"),em=/*#__PURE__*/function(e){d(r,e);function r(){u(this,r);var e;e=a(this,r,arguments);e.count=0;return e}c(r,[{key:"request",value:function e(e,r){var t=this;var n=Date.now();return this.count+=1,r(e).map(function(r){var o=Date.now()-n,i=e.operationName||"Unnamed";return eo.info("[Apollo] #".concat(t.count,": ").concat(i," (").concat(o,"ms)")),r})}}]);return r}(R.ApolloLink);function ey(e){var r=e||{},t=r.uri,n=r.wsUrl,o=r.customLinks,i=new em,a=(0,F.onError)(function(e){var r=e.graphQLErrors,t=e.networkError,n=e.protocolErrors,o=e.operation;var i=(o===null||o===void 0?void 0:o.operationName)||"Unknown";if(r&&r.forEach(function(e){var r=e.message,t=e.locations,n=e.path;eo.error("[GraphQL error] ".concat(i,": ").concat(r,", Location: ").concat(JSON.stringify(t),", Path: ").concat(n))}),n&&n.forEach(function(e){var r=e.message,t=e.extensions;eo.error("[Protocol error]: ".concat(r,", Extensions: ").concat(JSON.stringify(t)))}),t&&eo.error("[Network error]: ".concat(t)),r||n||t){var a,u;var l=(r===null||r===void 0?void 0:(a=r[0])===null||a===void 0?void 0:a.message)||(n===null||n===void 0?void 0:(u=n[0])===null||u===void 0?void 0:u.message)||(t===null||t===void 0?void 0:t.message)||"Unexpected error",c=new R.ApolloError({graphQLErrors:r||[],protocolErrors:n||[],clientErrors:[],networkError:t||null,errorMessage:l,extraInfo:{operation:o}});Z.toast.error(function(e){return(0,eh.jsxs)(eh.Fragment,{children:[l,"\xa0",(0,eh.jsx)($.FaQuestion,{onClick:function(){setTimeout(function(){ev(c)},0),Z.toast.dismiss(e.id)}})]})})}}),u=(0,z.removeTypenameFromVariables)();t||eo.warn('[Apollo] No GraphQL URI provided — using "'.concat(K,'" as default'));var l=new R.HttpLink({uri:t!==null&&t!==void 0?t:K,credentials:"include"}),c=n?new J.GraphQLWsLink((0,H.createClient)({url:n})):R.ApolloLink.empty(),s=v(c,R.ApolloLink)?(0,R.split)(function(e){var r=e.query;var t=(0,B.getMainDefinition)(r);return t.kind==="OperationDefinition"&&t.operation==="subscription"},c,l):l;return s===l&&n&&eo.warn("[Apollo] WS URL is set, but subscriptions fallback to HTTP. Check your wsLink config."),[i,a,u].concat(N(o!==null&&o!==void 0?o:[]),[s])}function eb(e){var r=e.isNextJS,t=e.options,n=e.children,o=e.client,i=e.provider,a=e.cache;var u=t||{},l=u.uri,c=u.wsUrl,s=u.customLinks,f=x(u,["uri","wsUrl","customLinks"]);if(typeof(o!==null&&o!==void 0?o:R.ApolloClient)!="function")throw new TypeError("Invalid ApolloClient provided. Ensure CustomClient is a class.");var d=i||R.ApolloProvider,p=(0,W.useMemo)(function(){return(0,R.from)(ey({uri:l,wsUrl:c,customLinks:s}))},[l,c,s]),g=(0,W.useMemo)(function(){return new R.ApolloClient(y({link:p,cache:v(a,R.InMemoryCache)?a:new R.InMemoryCache},f))},[p,a,f]),h=r?(0,eh.jsx)(d,{makeClient:function(){return g},children:n}):(0,eh.jsx)(d,{client:g,children:n});return r?(0,eh.jsx)(d,{makeClient:function(){return g},children:n}):(0,eh.jsxs)(eh.Fragment,{children:[(0,eh.jsxs)(ep,{children:[h,(0,eh.jsx)(eg,{})]}),(0,eh.jsx)(Z.Toaster,{position:"top-right"})]})}var ew=U(require("classnames"),1),ex=require("react"),ej=U(require("./loading.module.scss"),1),eE=require("react/jsx-runtime"),ek=(0,ex.createContext)(void 0);function eO(){var e=(0,ex.use)(ek);if(!e)throw new Error("useLoading must be used within a LoadingProvider");return e}function eN(e){var r=e.full,t=r===void 0?!1:r,n=e.block,o=n===void 0?!1:n,i=e.className,a=i===void 0?"":i,u=e.message,l=u===void 0?"Loading":u,c=x(e,["full","block","className","message"]);function s(){return(0,eE.jsxs)("div",w(y({className:ej.default.container},c),{children:[(0,eE.jsx)("div",{className:ej.default.ring}),(0,eE.jsx)("div",{className:ej.default.ring}),(0,eE.jsx)("div",{className:ej.default.ring}),(0,eE.jsx)("div",{className:ej.default.ring}),l&&(0,eE.jsx)("div",{className:ej.default.message,children:l})]}))}return t?(0,eE.jsx)("div",{className:(0,ew.default)(ej.default.fullscreen,a),children:s()}):o?(0,eE.jsx)("div",{className:(0,ew.default)(ej.default.block,a),children:s()}):s()}function eP(e){var r=e.children;var t=O((0,ex.useState)(!1),2),n=t[0],o=t[1],i=O((0,ex.useState)(!1),2),a=i[0],u=i[1],l=(0,ex.useCallback)(function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;o(!0),u(e)},[]),c=(0,ex.useCallback)(function(){o(!1),u(!1)},[]),s=(0,ex.useMemo)(function(){return{isLoading:n,isGlobalLoading:a,showLoading:l,hideLoading:c}},[n,a,l,c]);return(0,eE.jsx)(ek,{value:s,children:n?(0,eE.jsx)(eN,{full:a}):r})}var eS=require("next-intl"),eL=require("react");var eA=require("react");var eI={serialize:function(e){return JSON.stringify(e,function(e,r){return v(r,Date)?{__type:"Date",value:r.toISOString()}:r})},deserialize:function(e){return JSON.parse(e,function(e,r){return(r===null||r===void 0?void 0:r.__type)==="Date"?new Date(r.value):r})}};var eC=U(require("localforage"),1);var eq={get:function e(e){return i(function(){var r;return A(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,eC.default.getItem(e)];case 1:return[2,t.sent()];case 2:r=t.sent();return[2,(eo.error('[Storage:get] Error getting key "'.concat(e,'":'),r),null)];case 3:return[2]}})})()},set:function e(e,r){return i(function(){var t;return A(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,eC.default.setItem(e,r)];case 1:n.sent();return[3,3];case 2:t=n.sent();eo.error('[Storage:set] Error setting key "'.concat(e,'":'),t);return[3,3];case 3:return[2]}})})()},remove:function e(e){return i(function(){var r;return A(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,eC.default.removeItem(e)];case 1:t.sent();return[3,3];case 2:r=t.sent();eo.error('[Storage:remove] Error removing key "'.concat(e,'":'),r);return[3,3];case 3:return[2]}})})()},keys:function e(){return i(function(){var e,r;return A(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,eC.default.keys()];case 1:return[2,(e=t.sent())!==null&&e!==void 0?e:[]];case 2:r=t.sent();return[2,(eo.error("[Storage:keys] Error getting keys:",r),[])];case 3:return[2]}})})()}};function e_(e,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:eI;var n=O((0,eA.useState)(r),2),o=n[0],a=n[1],u=O((0,eA.useState)(!1),2),l=u[0],c=u[1];(0,eA.useEffect)(function(){var n=!0;return i(function(){var o,i,u,l;return A(this,function(s){switch(s.label){case 0:s.trys.push([0,6,7,8]);return[4,eq.get(e)];case 1:o=s.sent();if(!n)return[3,5];if(!(o!==null))return[3,2];i=t.deserialize(o);a(i);return[3,5];case 2:if(!(r!==void 0))return[3,4];u=t.serialize(r);return[4,eq.set(e,u)];case 3:s.sent(),a(r);return[3,5];case 4:a(void 0);s.label=5;case 5:return[3,8];case 6:l=s.sent();eo.error('Error loading value for key "'.concat(e,'":'),l),n&&a(r);return[3,8];case 7:n&&c(!0);return[7];case 8:return[2]}})})(),function(){n=!1,c(!1)}},[e,r,t]),(0,eA.useEffect)(function(){if(!l)return;i(function(){var r,n;return A(this,function(i){switch(i.label){case 0:i.trys.push([0,3,,4]);if(!(o!==void 0))return[3,2];r=t.serialize(o);return[4,eq.set(e,r)];case 1:i.sent();i.label=2;case 2:return[3,4];case 3:n=i.sent();eo.error('Error saving value for key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},[o,e,t,l]);var s=(0,eA.useCallback)(function(e){a(function(r){return typeof e=="function"?e(r):e})},[]),f=(0,eA.useCallback)(/*#__PURE__*/i(function(){var r;return A(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,eq.remove(e)];case 1:t.sent(),a(void 0);return[3,3];case 2:r=t.sent();eo.error('Error removing key "'.concat(e,'":'),r);return[3,3];case 3:return[2]}})}),[e]);return{value:o,set:s,remove:f}}var eM=require("react/jsx-runtime"),eD=(0,eL.createContext)(void 0);function eT(){var e=(0,eL.use)(eD);if(!e)throw new Error("useNextIntl must be used within a NextIntlProvider");return e}var eV=eS.useTranslations;function eU(e){var r=function(r){var t;var n=eT(),o=n.currentLanguage,i=r.messages,a=r.languages,u="en",l=i[(o===null||o===void 0?void 0:o.value)||u],c=(t=a.find(function(e){return e.value===(o===null||o===void 0?void 0:o.value)}))===null||t===void 0?void 0:t.timezone;return i?(0,eM.jsx)(eS.NextIntlClientProvider,{locale:(o===null||o===void 0?void 0:o.value)||u,messages:l,timeZone:c,children:(0,eM.jsx)(e,y({},r))}):(eo.warn("Missing messages for language: ".concat((o===null||o===void 0?void 0:o.value)||u)),null)};return r.displayName="withNextIntl(".concat(e.displayName||e.name||"Component",")"),r}function eG(e){var r=e.children;return(0,eM.jsx)(eM.Fragment,{children:r})}var eQ=eU(eG);function eR(e){var r=e.children,t=e.languages,n=e.messages;var o;var i=e_("lang",(o=t===null||t===void 0?void 0:t[0])!==null&&o!==void 0?o:{}),a=i.value,u=i.set,l=(0,eL.useMemo)(function(){return{languages:t,currentLanguage:a,setCurrentLanguage:u}},[t,u,a]);return(0,eM.jsx)(eD,{value:l,children:(0,eM.jsx)(eQ,{languages:t,messages:n,children:r})})}0&&(module.exports={ApolloErrorViewerModal:ApolloErrorViewerModal,ApolloErrorViewerProvider:ApolloErrorViewerProvider,ApolloProvider:ApolloProvider,Loading:Loading,LoadingContext:LoadingContext,LoadingProvider:LoadingProvider,NextIntlContext:NextIntlContext,NextIntlProvider:NextIntlProvider,registerApolloErrorViewerCallback:registerApolloErrorViewerCallback,showGlobalApolloError:showGlobalApolloError,useApolloErrorViewer:useApolloErrorViewer,useLoading:useLoading,useNextIntl:useNextIntl,useStorage:useStorage,useTranslateNextIntl:useTranslateNextIntl,withNextIntl:withNextIntl});
|
|
1
|
+
"use strict";function r(r,e){if(e==null||e>r.length)e=r.length;for(var n=0,t=new Array(e);n<e;n++)t[n]=r[n];return t}function e(r){if(Array.isArray(r))return r}function n(e){if(Array.isArray(e))return r(e)}function t(r){if(r===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return r}function o(r,e,n,t,o,i,a){try{var u=r[i](a);var l=u.value}catch(r){n(r);return}if(u.done){e(l)}else{Promise.resolve(l).then(t,o)}}function i(r){return function(){var e=this,n=arguments;return new Promise(function(t,i){var a=r.apply(e,n);function u(r){o(a,t,i,u,l,"next",r)}function l(r){o(a,t,i,u,l,"throw",r)}u(undefined)})}}function a(r,e,n){e=f(e);return E(r,L()?Reflect.construct(e,n||[],f(r).constructor):e.apply(r,n))}function u(r,e){if(!(r instanceof e)){throw new TypeError("Cannot call a class as a function")}}function l(r,e){for(var n=0;n<e.length;n++){var t=e[n];t.enumerable=t.enumerable||false;t.configurable=true;if("value"in t)t.writable=true;Object.defineProperty(r,t.key,t)}}function s(r,e,n){if(e)l(r.prototype,e);if(n)l(r,n);return r}function c(r,e,n){if(e in r){Object.defineProperty(r,e,{value:n,enumerable:true,configurable:true,writable:true})}else{r[e]=n}return r}function f(r){f=Object.setPrototypeOf?Object.getPrototypeOf:function r(r){return r.__proto__||Object.getPrototypeOf(r)};return f(r)}function d(r,e){if(typeof e!=="function"&&e!==null){throw new TypeError("Super expression must either be null or a function")}r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:true,configurable:true}});if(e)O(r,e)}function v(r,e){if(e!=null&&typeof Symbol!=="undefined"&&e[Symbol.hasInstance]){return!!e[Symbol.hasInstance](r)}else{return r instanceof e}}function p(r){if(typeof Symbol!=="undefined"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function h(r,e){var n=r==null?null:typeof Symbol!=="undefined"&&r[Symbol.iterator]||r["@@iterator"];if(n==null)return;var t=[];var o=true;var i=false;var a,u;try{for(n=n.call(r);!(o=(a=n.next()).done);o=true){t.push(a.value);if(e&&t.length===e)break}}catch(r){i=true;u=r}finally{try{if(!o&&n["return"]!=null)n["return"]()}finally{if(i)throw u}}return t}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 m(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function y(r){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};var t=Object.keys(n);if(typeof Object.getOwnPropertySymbols==="function"){t=t.concat(Object.getOwnPropertySymbols(n).filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable}))}t.forEach(function(e){c(r,e,n[e])})}return r}function b(r,e){var n=Object.keys(r);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(r);if(e){t=t.filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})}n.push.apply(n,t)}return n}function w(r,e){e=e!=null?e:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(r,Object.getOwnPropertyDescriptors(e))}else{b(Object(e)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(e,n))})}return r}function x(r,e){if(r==null)return{};var n=j(r,e);var t,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(r);for(o=0;o<i.length;o++){t=i[o];if(e.indexOf(t)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(r,t))continue;n[t]=r[t]}}return n}function j(r,e){if(r==null)return{};var n={};var t=Object.keys(r);var o,i;for(i=0;i<t.length;i++){o=t[i];if(e.indexOf(o)>=0)continue;n[o]=r[o]}return n}function E(r,e){if(e&&(P(e)==="object"||typeof e==="function")){return e}return t(r)}function O(r,e){O=Object.setPrototypeOf||function r(r,e){r.__proto__=e;return r};return O(r,e)}function k(r,n){return e(r)||h(r,n)||S(r,n)||g()}function N(r){return n(r)||p(r)||S(r)||m()}function P(r){"@swc/helpers - typeof";return r&&typeof Symbol!=="undefined"&&r.constructor===Symbol?"symbol":typeof r}function S(e,n){if(!e)return;if(typeof e==="string")return r(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor)t=e.constructor.name;if(t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return r(e,n)}function L(){try{var r=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(r){}return(L=function(){return!!r})()}function A(r,e){var n,t,o,i,a={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),"throw":u(1),"return":u(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function u(r){return function(e){return l([r,e])}}function l(i){if(n)throw new TypeError("Generator is already executing.");while(a)try{if(n=1,t&&(o=i[0]&2?t["return"]:i[0]?t["throw"]||((o=t["return"])&&o.call(t),0):t.next)&&!(o=o.call(t,i[1])).done)return o;if(t=0,o)i=[i[0]&2,o.value];switch(i[0]){case 0:case 1:o=i;break;case 4:a.label++;return{value:i[1],done:false};case 5:a.label++;t=i[1];i=[0];continue;case 7:i=a.ops.pop();a.trys.pop();continue;default:if(!(o=a.trys,o=o.length>0&&o[o.length-1])&&(i[0]===6||i[0]===2)){a=0;continue}if(i[0]===3&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(i[0]===6&&a.label<o[1]){a.label=o[1];o=i;break}if(o&&a.label<o[2]){a.label=o[2];a.ops.push(i);break}if(o[2])a.ops.pop();a.trys.pop();continue}i=e.call(r,a)}catch(r){i=[6,r];t=0}finally{n=o=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}}var I=Object.create;var C=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var M=Object.getPrototypeOf,T=Object.prototype.hasOwnProperty;var V=function(r,e){for(var n in e)C(r,n,{get:e[n],enumerable:!0})},D=function(r,e,n,t){var o=true,i=false,a=undefined;if(e&&(typeof e==="undefined"?"undefined":P(e))=="object"||typeof e=="function")try{var u=function(){var o=s.value;!T.call(r,o)&&o!==n&&C(r,o,{get:function(){return e[o]},enumerable:!(t=q(e,o))||t.enumerable})};for(var l=_(e)[Symbol.iterator](),s;!(o=(s=l.next()).done);o=true)u()}catch(r){i=true;a=r}finally{try{if(!o&&l.return!=null){l.return()}}finally{if(i){throw a}}}return r};var U=function(r,e,n){return n=r!=null?I(M(r)):{},D(e||!r||!r.__esModule?C(n,"default",{value:r,enumerable:!0}):n,r)},G=function(r){return D(C({},"__esModule",{value:!0}),r)};var Q={};V(Q,{ApolloErrorViewerModal:function(){return rc},ApolloErrorViewerProvider:function(){return rs},ApolloProvider:function(){return rp},Loading:function(){return rx},LoadingContext:function(){return rb},LoadingProvider:function(){return rj},NextIntlContext:function(){return rI},NextIntlProvider:function(){return rV},registerApolloErrorViewerCallback:function(){return ru},showGlobalApolloError:function(){return rl},useApolloErrorViewer:function(){return ri},useLoading:function(){return rw},useNextIntl:function(){return rC},useStorage:function(){return rL},useTranslateNextIntl:function(){return rq},withNextIntl:function(){return r_}});module.exports=G(Q);var R=require("@apollo/client"),z=require("@apollo/client/link/error"),F=require("@apollo/client/link/remove-typename"),J=require("@apollo/client/link/subscriptions"),B=require("@apollo/client/utilities"),H=require("graphql-ws"),W=require("react"),Z=require("react-hot-toast"),$=require("react-icons/fa6");var K="/graphql";var X=require("consola/browser"),Y={silent:X.consola.silent,level:X.consola.level,fatal:X.consola.fatal,error:X.consola.error,warn:X.consola.warn,log:X.consola.log,info:X.consola.info,success:X.consola.success,ready:X.consola.ready,start:X.consola.start,box:X.consola.box,debug:X.consola.debug,trace:X.consola.trace,verbose:X.consola.verbose};var rr=require("react"),re=require("react-icons/fa6"),rn=U(require("./apollo-error.module.scss"),1),rt=require("react/jsx-runtime"),ro=(0,rr.createContext)(void 0);function ri(){var r=(0,rr.use)(ro);if(!r)throw new Error("useApolloErrorViewer must be used within ApolloErrorViewerProvider");return r}var ra=null;function ru(r){ra=r}function rl(r){ra&&ra(r)}function rs(r){var e=r.children;var n=k((0,rr.useState)(null),2),t=n[0],o=n[1];(0,rr.useEffect)(function(){ru(o)},[]);var i=(0,rr.useMemo)(function(){return{error:t,showError:o,hideError:function(){return o(null)}}},[t]);return(0,rt.jsx)(ro,{value:i,children:e})}function rc(){var r,e,n;var t=(0,rr.use)(ro);if(!t||!t.error)return null;var o=t.error,i=t.hideError;return(0,rt.jsx)("div",{className:rn.default["modal-backdrop"],children:(0,rt.jsxs)("div",{className:rn.default["modal-content"],children:[(0,rt.jsx)("button",{type:"button",className:rn.default["btn-close"],onClick:i,children:"✕"}),(0,rt.jsx)("div",{className:rn.default["error-title"],children:o.message}),(0,rt.jsxs)("div",{className:rn.default["error-details"],children:[o.networkError&&(0,rt.jsxs)("pre",{className:"network",children:[(0,rt.jsx)("strong",{children:"Network Error:"}),"\xa0",o.networkError.message]}),((r=o.graphQLErrors)===null||r===void 0?void 0:r.length)>0&&(0,rt.jsxs)("div",{children:[(0,rt.jsx)("strong",{children:"GraphQL Errors:"}),(0,rt.jsx)("ul",{children:o.graphQLErrors.map(function(r){return(0,rt.jsx)("li",{children:r.message},r.message)})})]}),((e=o.protocolErrors)===null||e===void 0?void 0:e.length)>0&&(0,rt.jsxs)("div",{children:[(0,rt.jsx)("strong",{children:"Protocol Errors:"}),(0,rt.jsx)("ul",{children:o.protocolErrors.map(function(r){return(0,rt.jsx)("li",{children:r.message},r.message)})})]}),((n=o.clientErrors)===null||n===void 0?void 0:n.length)>0&&(0,rt.jsxs)("div",{children:[(0,rt.jsx)("strong",{children:"Client Errors:"}),(0,rt.jsx)("ul",{children:o.clientErrors.map(function(r){return(0,rt.jsx)("li",{children:r.message},r.message)})})]}),o.extraInfo&&(0,rt.jsxs)("pre",{className:"extra",children:[(0,rt.jsx)("strong",{children:"Extra Info:"}),"\xa0",JSON.stringify(o.extraInfo,null,4)]})]}),(0,rt.jsx)("button",{type:"button",className:rn.default["btn-retry"],onClick:function(){return window.location.reload()},children:(0,rt.jsx)(re.FaRepeat,{})})]})})}var rf=require("react/jsx-runtime"),rd=/*#__PURE__*/function(r){d(e,r);function e(){u(this,e);var r;r=a(this,e,arguments);r.count=0;return r}s(e,[{key:"request",value:function r(r,e){var n=this;var t=Date.now();return this.count+=1,e(r).map(function(e){var o=Date.now()-t,i=r.operationName||"Unnamed";return Y.info("[Apollo] #".concat(n.count,": ").concat(i," (").concat(o,"ms)")),e})}}]);return e}(R.ApolloLink);function rv(r){var e=r||{},n=e.uri,t=e.wsUrl,o=e.customLinks,i=new rd,a=(0,z.onError)(function(r){var e=r.graphQLErrors,n=r.networkError,t=r.protocolErrors,o=r.operation;var i=(o===null||o===void 0?void 0:o.operationName)||"Unknown";if(e&&e.forEach(function(r){var e=r.message,n=r.locations,t=r.path;Y.error("[GraphQL error] ".concat(i,": ").concat(e,", Location: ").concat(JSON.stringify(n),", Path: ").concat(t))}),t&&t.forEach(function(r){var e=r.message,n=r.extensions;Y.error("[Protocol error]: ".concat(e,", Extensions: ").concat(JSON.stringify(n)))}),n&&Y.error("[Network error]: ".concat(n)),e||t||n){var a,u;var l=(e===null||e===void 0?void 0:(a=e[0])===null||a===void 0?void 0:a.message)||(t===null||t===void 0?void 0:(u=t[0])===null||u===void 0?void 0:u.message)||(n===null||n===void 0?void 0:n.message)||"Unexpected error",s=new R.ApolloError({graphQLErrors:e||[],protocolErrors:t||[],clientErrors:[],networkError:n||null,errorMessage:l,extraInfo:{operation:o}});Z.toast.error(function(r){return(0,rf.jsxs)(rf.Fragment,{children:[l,"\xa0",(0,rf.jsx)($.FaExpand,{onClick:function(){setTimeout(function(){rl(s)},0),Z.toast.dismiss(r.id)}})]})})}}),u=(0,F.removeTypenameFromVariables)();n||Y.warn('[Apollo] No GraphQL URI provided — using "'.concat(K,'" as default'));var l=new R.HttpLink({uri:n!==null&&n!==void 0?n:K,credentials:"include"}),s=t?new J.GraphQLWsLink((0,H.createClient)({url:t})):R.ApolloLink.empty(),c=v(s,R.ApolloLink)?(0,R.split)(function(r){var e=r.query;var n=(0,B.getMainDefinition)(e);return n.kind==="OperationDefinition"&&n.operation==="subscription"},s,l):l;return c===l&&t&&Y.warn("[Apollo] WS URL is set, but subscriptions fallback to HTTP. Check your wsLink config."),[i,a,u].concat(N(o!==null&&o!==void 0?o:[]),[c])}function rp(r){var e=r.isNextJS,n=r.options,t=r.children,o=r.client,i=r.provider,a=r.cache;var u=n||{},l=u.uri,s=u.wsUrl,c=u.customLinks,f=x(u,["uri","wsUrl","customLinks"]);if(typeof(o!==null&&o!==void 0?o:R.ApolloClient)!="function")throw new TypeError("Invalid ApolloClient provided. Ensure CustomClient is a class.");var d=i||R.ApolloProvider,p=(0,W.useMemo)(function(){return(0,R.from)(rv({uri:l,wsUrl:s,customLinks:c}))},[l,s,c]),h=(0,W.useMemo)(function(){return new R.ApolloClient(y({link:p,cache:v(a,R.InMemoryCache)?a:new R.InMemoryCache},f))},[p,a,f]),g=e?(0,rf.jsx)(d,{makeClient:function(){return h},children:t}):(0,rf.jsx)(d,{client:h,children:t});return e?(0,rf.jsx)(d,{makeClient:function(){return h},children:t}):(0,rf.jsxs)(rf.Fragment,{children:[(0,rf.jsxs)(rs,{children:[g,(0,rf.jsx)(rc,{})]}),(0,rf.jsx)(Z.Toaster,{position:"top-right"})]})}var rh=U(require("classnames"),1),rg=require("react"),rm=U(require("./loading.module.scss"),1),ry=require("react/jsx-runtime"),rb=(0,rg.createContext)(void 0);function rw(){var r=(0,rg.use)(rb);if(!r)throw new Error("useLoading must be used within a LoadingProvider");return r}function rx(r){var e=r.full,n=e===void 0?!1:e,t=r.block,o=t===void 0?!1:t,i=r.className,a=i===void 0?"":i,u=r.message,l=u===void 0?"Loading":u,s=x(r,["full","block","className","message"]);function c(){return(0,ry.jsxs)("div",w(y({className:rm.default.container},s),{children:[(0,ry.jsx)("div",{className:rm.default.ring}),(0,ry.jsx)("div",{className:rm.default.ring}),(0,ry.jsx)("div",{className:rm.default.ring}),(0,ry.jsx)("div",{className:rm.default.ring}),l&&(0,ry.jsx)("div",{className:rm.default.message,children:l})]}))}return n?(0,ry.jsx)("div",{className:(0,rh.default)(rm.default.fullscreen,a),children:c()}):o?(0,ry.jsx)("div",{className:(0,rh.default)(rm.default.block,a),children:c()}):c()}function rj(r){var e=r.children;var n=k((0,rg.useState)(!1),2),t=n[0],o=n[1],i=k((0,rg.useState)(!1),2),a=i[0],u=i[1],l=(0,rg.useCallback)(function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;o(!0),u(r)},[]),s=(0,rg.useCallback)(function(){o(!1),u(!1)},[]),c=(0,rg.useMemo)(function(){return{isLoading:t,isGlobalLoading:a,showLoading:l,hideLoading:s}},[t,a,l,s]);return(0,ry.jsx)(rb,{value:c,children:t?(0,ry.jsx)(rx,{full:a}):e})}var rE=require("next-intl"),rO=require("react");var rk=require("react");var rN={serialize:function(r){return JSON.stringify(r,function(r,e){return v(e,Date)?{__type:"Date",value:e.toISOString()}:e})},deserialize:function(r){return JSON.parse(r,function(r,e){return(e===null||e===void 0?void 0:e.__type)==="Date"?new Date(e.value):e})}};var rP=U(require("localforage"),1);var rS={get:function r(r){return i(function(){var e;return A(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,rP.default.getItem(r)];case 1:return[2,n.sent()];case 2:e=n.sent();return[2,(Y.error('[Storage:get] Error getting key "'.concat(r,'":'),e),null)];case 3:return[2]}})})()},set:function r(r,e){return i(function(){var n;return A(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,rP.default.setItem(r,e)];case 1:t.sent();return[3,3];case 2:n=t.sent();Y.error('[Storage:set] Error setting key "'.concat(r,'":'),n);return[3,3];case 3:return[2]}})})()},remove:function r(r){return i(function(){var e;return A(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,rP.default.removeItem(r)];case 1:n.sent();return[3,3];case 2:e=n.sent();Y.error('[Storage:remove] Error removing key "'.concat(r,'":'),e);return[3,3];case 3:return[2]}})})()},keys:function r(){return i(function(){var r,e;return A(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,rP.default.keys()];case 1:return[2,(r=n.sent())!==null&&r!==void 0?r:[]];case 2:e=n.sent();return[2,(Y.error("[Storage:keys] Error getting keys:",e),[])];case 3:return[2]}})})()}};function rL(r,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:rN;var t=k((0,rk.useState)(e),2),o=t[0],a=t[1],u=k((0,rk.useState)(!1),2),l=u[0],s=u[1];(0,rk.useEffect)(function(){var t=!0;return i(function(){var o,i,u,l;return A(this,function(c){switch(c.label){case 0:c.trys.push([0,6,7,8]);return[4,rS.get(r)];case 1:o=c.sent();if(!t)return[3,5];if(!(o!==null))return[3,2];i=n.deserialize(o);a(i);return[3,5];case 2:if(!(e!==void 0))return[3,4];u=n.serialize(e);return[4,rS.set(r,u)];case 3:c.sent(),a(e);return[3,5];case 4:a(void 0);c.label=5;case 5:return[3,8];case 6:l=c.sent();Y.error('Error loading value for key "'.concat(r,'":'),l),t&&a(e);return[3,8];case 7:t&&s(!0);return[7];case 8:return[2]}})})(),function(){t=!1,s(!1)}},[r,e,n]),(0,rk.useEffect)(function(){if(!l)return;i(function(){var e,t;return A(this,function(i){switch(i.label){case 0:i.trys.push([0,3,,4]);if(!(o!==void 0))return[3,2];e=n.serialize(o);return[4,rS.set(r,e)];case 1:i.sent();i.label=2;case 2:return[3,4];case 3:t=i.sent();Y.error('Error saving value for key "'.concat(r,'":'),t);return[3,4];case 4:return[2]}})})()},[o,r,n,l]);var c=(0,rk.useCallback)(function(r){a(function(e){return typeof r=="function"?r(e):r})},[]),f=(0,rk.useCallback)(/*#__PURE__*/i(function(){var e;return A(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,rS.remove(r)];case 1:n.sent(),a(void 0);return[3,3];case 2:e=n.sent();Y.error('Error removing key "'.concat(r,'":'),e);return[3,3];case 3:return[2]}})}),[r]);return{value:o,set:c,remove:f}}var rA=require("react/jsx-runtime"),rI=(0,rO.createContext)(void 0);function rC(){var r=(0,rO.use)(rI);if(!r)throw new Error("useNextIntl must be used within a NextIntlProvider");return r}var rq=rE.useTranslations;function r_(r){var e=function(e){var n;var t=rC(),o=t.currentLanguage,i=e.messages,a=e.languages,u="en",l=i[(o===null||o===void 0?void 0:o.value)||u],s=(n=a.find(function(r){return r.value===(o===null||o===void 0?void 0:o.value)}))===null||n===void 0?void 0:n.timezone;return i?(0,rA.jsx)(rE.NextIntlClientProvider,{locale:(o===null||o===void 0?void 0:o.value)||u,messages:l,timeZone:s,children:(0,rA.jsx)(r,y({},e))}):(Y.warn("Missing messages for language: ".concat((o===null||o===void 0?void 0:o.value)||u)),null)};return e.displayName="withNextIntl(".concat(r.displayName||r.name||"Component",")"),e}function rM(r){var e=r.children;return(0,rA.jsx)(rA.Fragment,{children:e})}var rT=r_(rM);function rV(r){var e=r.children,n=r.languages,t=r.messages;var o;var i=rL("lang",(o=n===null||n===void 0?void 0:n[0])!==null&&o!==void 0?o:{}),a=i.value,u=i.set,l=(0,rO.useMemo)(function(){return{languages:n,currentLanguage:a,setCurrentLanguage:u}},[n,u,a]);return(0,rA.jsx)(rI,{value:l,children:(0,rA.jsx)(rT,{languages:n,messages:t,children:e})})}0&&(module.exports={ApolloErrorViewerModal:ApolloErrorViewerModal,ApolloErrorViewerProvider:ApolloErrorViewerProvider,ApolloProvider:ApolloProvider,Loading:Loading,LoadingContext:LoadingContext,LoadingProvider:LoadingProvider,NextIntlContext:NextIntlContext,NextIntlProvider:NextIntlProvider,registerApolloErrorViewerCallback:registerApolloErrorViewerCallback,showGlobalApolloError:showGlobalApolloError,useApolloErrorViewer:useApolloErrorViewer,useLoading:useLoading,useNextIntl:useNextIntl,useStorage:useStorage,useTranslateNextIntl:useTranslateNextIntl,withNextIntl:withNextIntl});
|