@cyberskill/shared 1.70.0 → 1.71.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/_tsup-dts-rollup.d.cts +12 -3
  2. package/dist/_tsup-dts-rollup.d.ts +12 -3
  3. package/dist/configs/index.cjs +1 -1
  4. package/dist/configs/index.d.cts +5 -0
  5. package/dist/configs/index.d.ts +5 -0
  6. package/dist/configs/index.js +1 -1
  7. package/dist/index.cjs +1 -1
  8. package/dist/index.d.cts +5 -2
  9. package/dist/index.d.ts +5 -2
  10. package/dist/index.js +1 -1
  11. package/dist/nodejs/cli/cli.util.cjs +1 -1
  12. package/dist/nodejs/cli/cli.util.js +1 -1
  13. package/dist/nodejs/cli/index.cjs +1 -1
  14. package/dist/nodejs/cli/index.js +1 -1
  15. package/dist/nodejs/index.cjs +1 -1
  16. package/dist/nodejs/index.js +1 -1
  17. package/dist/react/index.cjs +1 -1
  18. package/dist/react/index.d.cts +0 -2
  19. package/dist/react/index.d.ts +0 -2
  20. package/dist/react/index.js +1 -1
  21. package/package.json +6 -6
  22. /package/dist/{react → configs}/graphql-codegen/graphql-codegen.type.cjs +0 -0
  23. /package/dist/{react → configs}/graphql-codegen/graphql-codegen.type.d.cts +0 -0
  24. /package/dist/{react → configs}/graphql-codegen/graphql-codegen.type.d.ts +0 -0
  25. /package/dist/{react → configs}/graphql-codegen/graphql-codegen.type.js +0 -0
  26. /package/dist/{react → configs}/graphql-codegen/graphql-codegen.util.cjs +0 -0
  27. /package/dist/{react → configs}/graphql-codegen/graphql-codegen.util.d.cts +0 -0
  28. /package/dist/{react → configs}/graphql-codegen/graphql-codegen.util.d.ts +0 -0
  29. /package/dist/{react → configs}/graphql-codegen/graphql-codegen.util.js +0 -0
  30. /package/dist/{react → configs}/graphql-codegen/index.cjs +0 -0
  31. /package/dist/{react → configs}/graphql-codegen/index.d.cts +0 -0
  32. /package/dist/{react → configs}/graphql-codegen/index.d.ts +0 -0
  33. /package/dist/{react → configs}/graphql-codegen/index.js +0 -0
@@ -1 +1 @@
1
- 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,n,o,i,a){try{var c=r[i](a);var s=c.value}catch(r){t(r);return}if(c.done){e(s)}else{Promise.resolve(s).then(n,o)}}function i(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function c(r){o(a,n,i,c,s,"next",r)}function s(r){o(a,n,i,c,s,"throw",r)}c(undefined)})}}function a(r,e,t){e=f(e);return N(r,D()?Reflect.construct(e,t||[],f(r).constructor):e.apply(r,t))}function c(r,e){if(!(r instanceof e)){throw new TypeError("Cannot call a class as a function")}}function s(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 l(r,e,t){if(e)s(r.prototype,e);if(t)s(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 f(r){f=Object.setPrototypeOf?Object.getPrototypeOf:function r(r){return r.__proto__||Object.getPrototypeOf(r)};return f(r)}function p(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)I(r,e)}function m(r,e){if(e!=null&&typeof Symbol!=="undefined"&&e[Symbol.hasInstance]){return!!e[Symbol.hasInstance](r)}else{return r instanceof e}}function v(r){if(typeof Symbol!=="undefined"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function d(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 a,c;try{for(t=t.call(r);!(o=(a=t.next()).done);o=true){n.push(a.value);if(e&&n.length===e)break}}catch(r){i=true;c=r}finally{try{if(!o&&t["return"]!=null)t["return"]()}finally{if(i)throw c}}return n}function g(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function h(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function y(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 E(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);if(e){n=n.filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})}t.push.apply(t,n)}return t}function b(r,e){e=e!=null?e:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(r,Object.getOwnPropertyDescriptors(e))}else{E(Object(e)).forEach(function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(e,t))})}return r}function _(r,e){if(r==null)return{};var t=w(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 w(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 N(r,e){if(e&&(S(e)==="object"||typeof e==="function")){return e}return n(r)}function I(r,e){I=Object.setPrototypeOf||function r(r,e){r.__proto__=e;return r};return I(r,e)}function O(r,t){return e(r)||d(r,t)||T(r,t)||g()}function C(r){return t(r)||v(r)||T(r)||h()}function S(r){"@swc/helpers - typeof";return r&&typeof Symbol!=="undefined"&&r.constructor===Symbol?"symbol":typeof r}function T(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 D(){try{var r=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(r){}return(D=function(){return!!r})()}function P(r,e){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:c(0),"throw":c(1),"return":c(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function c(r){return function(e){return s([r,e])}}function s(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=e.call(r,a)}catch(r){i=[6,r];n=0}finally{t=o=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}}import{ApolloClient as A,ApolloError as L,ApolloLink as k,ApolloProvider as x,from as j,HttpLink as M,InMemoryCache as R,split as G}from"@apollo/client";import{onError as F}from"@apollo/client/link/error";import{removeTypenameFromVariables as U}from"@apollo/client/link/remove-typename";import{GraphQLWsLink as K}from"@apollo/client/link/subscriptions";import{getMainDefinition as W}from"@apollo/client/utilities";import{createClient as Y}from"graphql-ws";import{useMemo as X}from"react";import{FaInfo as B}from"react-icons/fa6";import{use as H}from"react";import{FaRepeat as J}from"react-icons/fa6";import{createContext as Q}from"react";var V=Q(void 0);import q from"./apollo-error/apollo-error.module.scss";import{jsx as z,jsxs as Z}from"react/jsx-runtime";function $(){var r=H(V),e=r===null||r===void 0?void 0:r.error;if(!e)return null;var t=function(r,e){return(e===null||e===void 0?void 0:e.length)?Z("div",{children:[Z("strong",{children:[r,":"]}),z("ul",{children:e.map(function(r){return z("li",{children:r.message},r.message)})})]}):null};return z("div",{className:q["modal-backdrop"],children:Z("div",{className:q["modal-content"],children:[z("button",{type:"button",className:q["btn-close"],onClick:r.hideError,children:"✕"}),Z("div",{className:q["error-title"],children:[z("button",{type:"button",className:q["btn-retry"],onClick:function(){return window.location.reload()},children:z(J,{})})," ",e.message]}),Z("div",{className:q["error-details"],children:[e.networkError&&Z("pre",{className:"network",children:[z("strong",{children:"Network Error:"})," ",e.networkError.message]}),t("GraphQL Errors",C(e.graphQLErrors)),t("Protocol Errors",C(e.protocolErrors)),t("Client Errors",C(e.clientErrors)),e.extraInfo&&Z("pre",{className:"extra",children:[z("strong",{children:"Extra Info:"})," ",JSON.stringify(e.extraInfo,null,4)]})]})]})})}import{use as rr}from"react";function re(){var r=rr(V);if(!r)throw new Error("useApolloError must be used within ApolloErrorProvider");return r}import{useEffect as rt,useMemo as rn,useState as ro}from"react";import{jsx as ri}from"react/jsx-runtime";var ra=null;function rc(r){ra===null||ra===void 0?void 0:ra(r)}function rs(r){var e=r.children;var t=O(ro(null),2),n=t[0],o=t[1];rt(function(){ra=o},[]);var i=rn(function(){return{error:n,showError:o,hideError:function(){return o(null)}}},[n]);return ri(V,{value:i,children:e})}import{consola as rl}from"consola/browser";var ru={silent:rl.silent,level:rl.level,fatal:rl.fatal,error:rl.error,warn:rl.warn,log:rl.log,info:rl.info,success:rl.success,ready:rl.ready,start:rl.start,box:rl.box,debug:rl.debug,trace:rl.trace,verbose:rl.verbose};import{toast as rf,Toaster as rp}from"react-hot-toast";var rm="/graphql";import{Fragment as rv,jsx as rd,jsxs as rg}from"react/jsx-runtime";var rh=/*#__PURE__*/function(r){"use strict";p(e,r);function e(){c(this,e);var r;r=a(this,e,arguments);r.count=0;return r}l(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 ru.info("[Apollo] #".concat(t.count,": ").concat(i," (").concat(o,"ms)")),e})}}]);return e}(k);function ry(r){var e=r||{},t=e.uri,n=e.wsUrl,o=e.customLinks,i=new rh,a=F(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;ru.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;ru.error("[Protocol error]: ".concat(e,", Extensions: ").concat(JSON.stringify(t)))}),t&&ru.error("[Network error]: ".concat(t)),e||n||t){var a,c;var s=(e===null||e===void 0?void 0:(a=e[0])===null||a===void 0?void 0:a.message)||(n===null||n===void 0?void 0:(c=n[0])===null||c===void 0?void 0:c.message)||(t===null||t===void 0?void 0:t.message)||"Unexpected error",l=new L({graphQLErrors:e||[],protocolErrors:n||[],clientErrors:[],networkError:t||null,errorMessage:s,extraInfo:{operation:o}});rf.error(function(r){return rg(rv,{children:[s,"\xa0",rd(B,{cursor:"pointer",onClick:function(){setTimeout(function(){rc(l)},0),rf.dismiss(r.id)}})]})})}}),c=U();t||ru.warn('[Apollo] No GraphQL URI provided — using "'.concat(rm,'" as default'));var s=new M({uri:t!==null&&t!==void 0?t:rm,credentials:"include"}),l=n?new K(Y({url:n})):k.empty(),u=m(l,k)?G(function(r){var e=r.query;var t=W(e);return t.kind==="OperationDefinition"&&t.operation==="subscription"},l,s):s;return u===s&&n&&ru.warn("[Apollo] WS URL is set, but subscriptions fallback to HTTP. Check your wsLink config."),[i,a,c].concat(C(o!==null&&o!==void 0?o:[]),[u])}function rE(r){var e=r.isNextJS,t=r.options,n=r.children,o=r.client,i=r.provider,a=r.cache;var c=t||{},s=c.uri,l=c.wsUrl,u=c.customLinks,f=_(c,["uri","wsUrl","customLinks"]);if(typeof(o!==null&&o!==void 0?o:A)!="function")throw new TypeError("Invalid ApolloClient provided. Ensure CustomClient is a class.");var p=i||x,v=X(function(){return j(ry({uri:s,wsUrl:l,customLinks:u}))},[s,l,u]),d=X(function(){return new A(y({link:v,cache:m(a,R)?a:new R},f))},[v,a,f]),g=e?rd(p,{makeClient:function(){return d},children:n}):rd(p,{client:d,children:n});return e?rd(p,{makeClient:function(){return d},children:n}):rg(rv,{children:[rg(rs,{children:[g,rd($,{})]}),rd(rp,{position:"top-right"})]})}import rb from"node:process";import{exec as r_}from"node:child_process";import*as rw from"node:util";import rN from"node:process";var rI=rN.env.DEBUG==="true";import rO from"chalk";import rC from"consola";import{GraphQLError as rS}from"graphql";rI||(rC.level=4);function rT(r){var e=rO[r];return typeof e=="function"?e:rO.green}var rD={silent:rC.silent,level:rC.level,fatal:rC.fatal,error:rC.error,warn:rC.warn,log:rC.log,info:rC.info,success:rC.success,ready:rC.ready,start:rC.start,box:rC.box,debug:rC.debug,trace:rC.trace,verbose:rC.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)){rC.box(rO.green(r));return}e.forEach(function(r){var e=r.file,n=r.position,o=r.rule,i=r.message;rC.log("".concat(rO.gray("File:")," ").concat(rO.blue("".concat(e).concat(n?":".concat(n):"")))),o&&rC.log(" ".concat(rT(t)("Rule:")," ").concat(o)),rC.log(" ".concat(rT(t)("Message:")," ").concat(i))}),rC.box(rT(t)("".concat(r," : ").concat(e.length))),rC.log(rO.gray("─".repeat(40)))}};import rP from"node-fetch";import*as rA from"node:fs";function rL(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++){e[t]=arguments[t]}return e.every(function(r){return rA.existsSync(r)})}import rk from"node-persist";var rx=rw.promisify(r_);function rj(r){return{raw:!0,cmd:r}}function rM(r,e){return(e===null||e===void 0?void 0:e.isRemote)?"".concat(ea," ").concat(rW," ").concat(r):(e===null||e===void 0?void 0:e.isCurrentProject)?"".concat(ea," ").concat(en," ").concat(r1," ").concat(r):"".concat(ea," ").concat(r0," ").concat(r)}function rR(r,e){return typeof r=="function"?rM(r(e),e):(typeof r==="undefined"?"undefined":S(r))=="object"&&(r===null||r===void 0?void 0:r.raw)===!0?r.cmd:typeof r=="string"?rM(r,e):r}import*as rG from"node:path";function rF(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++){e[t]=arguments[t]}var n;return(n=rG).resolve.apply(n,[rK].concat(C(e)))}function rU(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++){e[t]=arguments[t]}var n;return(n=rG).join.apply(n,C(e))}var rK=rb.env.INIT_CWD||rb.cwd(),rW="@cyberskill/shared";var rY="node_modules",rX="dist",rB="package.json",rH="package-lock.json",rJ="tsconfig.json",rQ=".gitignore",rV=".simple-git-hooks.json",rq="pnpm-lock.yaml",rz=".git/hooks/",rZ=".git/COMMIT_EDITMSG",r$=rU(rK,rY,rW,rX),r0="cyberskill",r1="src/nodejs/cli/index.ts",r2="eslint",r3="eslint",r4="vitest",r8="playwright",r6="vitest",r5="@commitlint/cli",r7="commitlint",r9="lint-staged",er="lint-staged",ee="typescript",et="tsc",en="tsx",eo="git",ei="pnpm",ea="pnpm exec",ec="simple-git-hooks",es="simple-git-hooks",el="@eslint/config-inspector",eu="eslint-config-inspector",ef="node-modules-inspector",ep="node-modules-inspector",em={CYBERSKILL_DIRECTORY:r$,WORKING_DIRECTORY:rK,TS_CONFIG:rF(rJ),GIT_IGNORE:rF(rQ),GIT_HOOK:rF(rz),GIT_COMMIT_MSG:rF(rZ),SIMPLE_GIT_HOOKS_JSON:rF(rV),PACKAGE_JSON:rF(rB),PACKAGE_LOCK_JSON:rF(rH),PNPM_LOCK_YAML:rF(rq),NODE_MODULES:rF(rY),CYBERSKILL:{LINT_STAGED_CONFIG:rF("".concat(r$,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:rF("".concat(r$,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:rF("".concat(r$,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:rF("".concat(r$,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:rF("".concat(r$,"/react/vitest/vitest.e2e.js"))}};function ev(r){for(var e=arguments.length,t=new Array(e>1?e-1:0),n=1;n<e;n++){t[n-1]=arguments[n]}var o=O(t,2),i=o[0],a=o[1],c=r==="RAW"?!0:rL.apply(void 0,C(i.split(" ").map(function(r){return rU(em.NODE_MODULES,r)})));switch(r){case"PNPM_ADD_AND_EXEC":return rR(rj("".concat(c?"":"".concat(ei," add ").concat(i," && ")).concat(ea," ").concat(a)));case"PNPM_ADD_DEV_AND_EXEC":return rR(rj("".concat(c?"":"".concat(ei," add -D ").concat(i," && ")).concat(ea," ").concat(a)));case"RAW":return rR(rj(i))}}var ed={SIMPLE_GIT_HOOKS:ev("PNPM_ADD_DEV_AND_EXEC",ec,es),ESLINT_INSPECT:ev("PNPM_ADD_DEV_AND_EXEC",el,eu),NODE_MODULES_INSPECT:ev("PNPM_ADD_DEV_AND_EXEC",ef,ep),ESLINT_CHECK:ev("PNPM_ADD_DEV_AND_EXEC",r2,"".concat(r3," ").concat(em.WORKING_DIRECTORY)),ESLINT_FIX:ev("PNPM_ADD_DEV_AND_EXEC",r2,"".concat(r3," ").concat(em.WORKING_DIRECTORY," --fix")),TYPESCRIPT_CHECK:ev("PNPM_ADD_AND_EXEC",ee,"".concat(et," -p ").concat(em.TS_CONFIG," --noEmit")),CONFIGURE_GIT_HOOK:ev("RAW","".concat(eo," config core.hooksPath ").concat(em.GIT_HOOK)),BUILD:ev("RAW","".concat(ei," run build")),STAGE_BUILD_DIRECTORY:ev("RAW","".concat(eo," add ").concat(rX)),PNPM_INSTALL_STANDARD:ev("RAW","".concat(ei," install")),PNPM_INSTALL_LEGACY:ev("RAW","".concat(ei," install --legacy-peer-deps")),PNPM_INSTALL_FORCE:ev("RAW","".concat(ei," install --force")),CYBERSKILL:{TEST_UNIT:ev("PNPM_ADD_AND_EXEC",r4,"".concat(r6," --config ").concat(em.CYBERSKILL.UNIT_TEST_CONFIG)),TEST_E2E:ev("PNPM_ADD_AND_EXEC","".concat(r4," ").concat(r8),"".concat(r6," --config ").concat(em.CYBERSKILL.E2E_TEST_CONFIG)),COMMIT_LINT:ev("PNPM_ADD_DEV_AND_EXEC",r5,"".concat(r7," --edit ").concat(em.GIT_COMMIT_MSG," --config ").concat(em.CYBERSKILL.COMMITLINT_CONFIG)),LINT_STAGED:ev("PNPM_ADD_DEV_AND_EXEC",r9,"".concat(er," --config ").concat(em.CYBERSKILL.LINT_STAGED_CONFIG))}};function eg(r){var e=r.uri,t=r.from,n=r.to,o=r.withComponent,i=r.withHOC,a=r.withHooks,c=r.withMutationFn,s=r.withRefetchFn,l=r.federation;var f=y({},o&&{withComponent:o},i&&{withHOC:i},a&&{withHooks:a},c&&{withMutationFn:c},s&&{withRefetchFn:s},l&&{config:{federation:!0}});return{schema:e,documents:[t],generates:u({},n,y({plugins:["typescript","typescript-operations","typescript-react-apollo"]},Object.keys(f).length>0&&{config:f})),hooks:{afterAllFileWrite:[ed.ESLINT_FIX]}}}import{useTranslation as eh}from"react-i18next";var ey=eh;import eE from"i18next";import{initReactI18next as eb}from"react-i18next";function e_(r){return eE.use(eb).init(r)}import ew from"classnames";import eN from"./loading/loading.module.scss";import{jsx as eI,jsxs as eO}from"react/jsx-runtime";function eC(r){var e=r.full,t=e===void 0?!1:e,n=r.block,o=n===void 0?!1:n,i=r.className,a=i===void 0?"":i,c=r.message,s=c===void 0?"Loading":c,l=_(r,["full","block","className","message"]);function u(){return eO("div",b(y({className:eN.container},l),{children:[eI("div",{className:eN.ring}),eI("div",{className:eN.ring}),eI("div",{className:eN.ring}),eI("div",{className:eN.ring}),s&&eI("div",{className:eN.message,children:s})]}))}return t?eI("div",{className:ew(eN.fullscreen,a),children:u()}):o?eI("div",{className:ew(eN.block,a),children:u()}):u()}import{createContext as eS}from"react";var eT=eS(void 0);import{use as eD}from"react";function eP(){var r=eD(eT);if(!r)throw new Error("useLoading must be used within a LoadingProvider");return r}import{useCallback as eA,useMemo as eL,useState as ek}from"react";import{jsx as ex}from"react/jsx-runtime";function ej(r){var e=r.children;var t=O(ek(!1),2),n=t[0],o=t[1],i=O(ek(!1),2),a=i[0],c=i[1],s=eA(function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;o(!0),c(r)},[]),l=eA(function(){o(!1),c(!1)},[]),u=eL(function(){return{isLoading:n,isGlobalLoading:a,showLoading:s,hideLoading:l}},[n,a,s,l]);return ex(eT,{value:u,children:n?ex(eC,{full:a}):e})}import{createContext as eM}from"react";var eR=eM(void 0);import{NextIntlClientProvider as eG}from"next-intl";import{useTranslations as eF}from"next-intl";import{use as eU}from"react";function eK(){var r=eU(eR);if(!r)throw new Error("useNextIntl must be used within a NextIntlProvider");return r}var eW=eF;import{jsx as eY}from"react/jsx-runtime";function eX(r){var e=function(e){var t;var n=eK(),o=n.currentLanguage,i=e.messages,a=e.languages,c="en",s=i[(o===null||o===void 0?void 0:o.value)||c],l=(t=a.find(function(r){return r.value===(o===null||o===void 0?void 0:o.value)}))===null||t===void 0?void 0:t.timezone;return i?eY(eG,{locale:(o===null||o===void 0?void 0:o.value)||c,messages:s,timeZone:l,children:eY(r,y({},e))}):(ru.warn("Missing messages for language: ".concat((o===null||o===void 0?void 0:o.value)||c)),null)};return e.displayName="withNextIntl(".concat(r.displayName||r.name||"Component",")"),e}import{useMemo as eB}from"react";import{useCallback as eH,useEffect as eJ,useState as eQ}from"react";var eV={serialize:function(r){return JSON.stringify(r,function(r,e){return m(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})}};import eq from"localforage";var ez={get:function r(r){return i(function(){var e;return P(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,eq.getItem(r)];case 1:return[2,t.sent()];case 2:e=t.sent();return[2,(ru.error('[Storage:get] Error getting key "'.concat(r,'":'),e),null)];case 3:return[2]}})})()},set:function r(r,e){return i(function(){var t;return P(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,eq.setItem(r,e)];case 1:n.sent();return[3,3];case 2:t=n.sent();ru.error('[Storage:set] Error setting key "'.concat(r,'":'),t);return[3,3];case 3:return[2]}})})()},remove:function r(r){return i(function(){var e;return P(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,eq.removeItem(r)];case 1:t.sent();return[3,3];case 2:e=t.sent();ru.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 P(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,eq.keys()];case 1:return[2,(r=t.sent())!==null&&r!==void 0?r:[]];case 2:e=t.sent();return[2,(ru.error("[Storage:keys] Error getting keys:",e),[])];case 3:return[2]}})})()}};function eZ(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:eV;var n=O(eQ(e),2),o=n[0],a=n[1],c=O(eQ(!1),2),s=c[0],l=c[1];eJ(function(){var n=!0;return i(function(){var o,i,c,s;return P(this,function(u){switch(u.label){case 0:u.trys.push([0,6,7,8]);return[4,ez.get(r)];case 1:o=u.sent();if(!n)return[3,5];if(!(o!==null))return[3,2];i=t.deserialize(o);a(i);return[3,5];case 2:if(!(e!==void 0))return[3,4];c=t.serialize(e);return[4,ez.set(r,c)];case 3:u.sent(),a(e);return[3,5];case 4:a(void 0);u.label=5;case 5:return[3,8];case 6:s=u.sent();ru.error('Error loading value for key "'.concat(r,'":'),s),n&&a(e);return[3,8];case 7:n&&l(!0);return[7];case 8:return[2]}})})(),function(){n=!1,l(!1)}},[r,e,t]),eJ(function(){if(!s)return;i(function(){var e,n;return P(this,function(i){switch(i.label){case 0:i.trys.push([0,3,,4]);if(!(o!==void 0))return[3,2];e=t.serialize(o);return[4,ez.set(r,e)];case 1:i.sent();i.label=2;case 2:return[3,4];case 3:n=i.sent();ru.error('Error saving value for key "'.concat(r,'":'),n);return[3,4];case 4:return[2]}})})()},[o,r,t,s]);var u=eH(function(r){a(function(e){return typeof r=="function"?r(e):r})},[]),f=eH(/*#__PURE__*/i(function(){var e;return P(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,ez.remove(r)];case 1:t.sent(),a(void 0);return[3,3];case 2:e=t.sent();ru.error('Error removing key "'.concat(r,'":'),e);return[3,3];case 3:return[2]}})}),[r]);return{value:o,set:u,remove:f}}import{Fragment as e$,jsx as e0}from"react/jsx-runtime";function e1(r){var e=r.children;return e0(e$,{children:e})}var e2=eX(e1);function e3(r){var e=r.children,t=r.languages,n=r.messages;var o;var i=eZ("lang",(o=t===null||t===void 0?void 0:t[0])!==null&&o!==void 0?o:{}),a=i.value,c=i.set,s=eB(function(){return{languages:t,currentLanguage:a,setCurrentLanguage:c}},[t,c,a]);return e0(eR,{value:s,children:e0(e2,{languages:t,messages:n,children:e})})}import e4 from"@vitejs/plugin-react-swc";import{defineConfig as e8}from"vitest/config";function e6(r){return e8(y({plugins:[e4()],test:{include:["**/*.test.e2e.?(c|m)[jt]s?(x)"],browser:{enabled:!0,provider:"playwright",instances:[{browser:"chromium"},{browser:"firefox"},{browser:"webkit"}]}}},r))}import e5 from"@vitejs/plugin-react-swc";import{defineConfig as e7}from"vitest/config";function e9(r){return e7(y({plugins:[e5()],test:{globals:!0,environment:"jsdom",pool:"vmThreads",include:["**/*.test.unit.?(c|m)[jt]s?(x)"],setupFiles:[em.CYBERSKILL.UNIT_TEST_SETUP_CONFIG]}},r))}export{$ as ApolloError,V as ApolloErrorContext,rs as ApolloErrorProvider,rE as ApolloProvider,rm as GRAPHQL_URI_DEFAULT,eC as Loading,eT as LoadingContext,ej as LoadingProvider,eR as NextIntlContext,e3 as NextIntlProvider,rp as Toaster,eg as createGraphqlCodegenConfig,e_ as initI18next,ru as log,rc as showGlobalApolloError,ez as storage,rf as toast,re as useApolloError,eP as useLoading,eK as useNextIntl,eZ as useStorage,ey as useTranslateI18next,eW as useTranslateNextIntl,e6 as vitestE2E,e9 as vitestUnit,eX as withNextIntl};
1
+ 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,n,o,a,i){try{var c=r[a](i);var s=c.value}catch(r){t(r);return}if(c.done){e(s)}else{Promise.resolve(s).then(n,o)}}function a(r){return function(){var e=this,t=arguments;return new Promise(function(n,a){var i=r.apply(e,t);function c(r){o(i,n,a,c,s,"next",r)}function s(r){o(i,n,a,c,s,"throw",r)}c(undefined)})}}function i(r,e,t){e=f(e);return w(r,P()?Reflect.construct(e,t||[],f(r).constructor):e.apply(r,t))}function c(r,e){if(!(r instanceof e)){throw new TypeError("Cannot call a class as a function")}}function s(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 l(r,e,t){if(e)s(r.prototype,e);if(t)s(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 f(r){f=Object.setPrototypeOf?Object.getPrototypeOf:function r(r){return r.__proto__||Object.getPrototypeOf(r)};return f(r)}function p(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)I(r,e)}function m(r,e){if(e!=null&&typeof Symbol!=="undefined"&&e[Symbol.hasInstance]){return!!e[Symbol.hasInstance](r)}else{return r instanceof e}}function v(r){if(typeof Symbol!=="undefined"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function d(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 a=false;var i,c;try{for(t=t.call(r);!(o=(i=t.next()).done);o=true){n.push(i.value);if(e&&n.length===e)break}}catch(r){a=true;c=r}finally{try{if(!o&&t["return"]!=null)t["return"]()}finally{if(a)throw c}}return n}function g(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function h(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function y(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 E(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);if(e){n=n.filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})}t.push.apply(t,n)}return t}function b(r,e){e=e!=null?e:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(r,Object.getOwnPropertyDescriptors(e))}else{E(Object(e)).forEach(function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(e,t))})}return r}function _(r,e){if(r==null)return{};var t=N(r,e);var n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(r);for(o=0;o<a.length;o++){n=a[o];if(e.indexOf(n)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(r,n))continue;t[n]=r[n]}}return t}function N(r,e){if(r==null)return{};var t={};var n=Object.keys(r);var o,a;for(a=0;a<n.length;a++){o=n[a];if(e.indexOf(o)>=0)continue;t[o]=r[o]}return t}function w(r,e){if(e&&(C(e)==="object"||typeof e==="function")){return e}return n(r)}function I(r,e){I=Object.setPrototypeOf||function r(r,e){r.__proto__=e;return r};return I(r,e)}function O(r,t){return e(r)||d(r,t)||T(r,t)||g()}function S(r){return t(r)||v(r)||T(r)||h()}function C(r){"@swc/helpers - typeof";return r&&typeof Symbol!=="undefined"&&r.constructor===Symbol?"symbol":typeof r}function T(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 P(){try{var r=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(r){}return(P=function(){return!!r})()}function D(r,e){var t,n,o,a,i={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]};return a={next:c(0),"throw":c(1),"return":c(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function c(r){return function(e){return s([r,e])}}function s(a){if(t)throw new TypeError("Generator is already executing.");while(i)try{if(t=1,n&&(o=a[0]&2?n["return"]:a[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;if(n=0,o)a=[a[0]&2,o.value];switch(a[0]){case 0:case 1:o=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;n=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(o=i.trys,o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(a[0]===6&&i.label<o[1]){i.label=o[1];o=a;break}if(o&&i.label<o[2]){i.label=o[2];i.ops.push(a);break}if(o[2])i.ops.pop();i.trys.pop();continue}a=e.call(r,i)}catch(r){a=[6,r];n=0}finally{t=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}}import{ApolloClient as A,ApolloError as L,ApolloLink as x,ApolloProvider as k,from as j,HttpLink as M,InMemoryCache as R,split as G}from"@apollo/client";import{onError as U}from"@apollo/client/link/error";import{removeTypenameFromVariables as F}from"@apollo/client/link/remove-typename";import{GraphQLWsLink as K}from"@apollo/client/link/subscriptions";import{getMainDefinition as Y}from"@apollo/client/utilities";import{createClient as B}from"graphql-ws";import{useMemo as W}from"react";import{FaInfo as X}from"react-icons/fa6";import{use as H}from"react";import{FaRepeat as Q}from"react-icons/fa6";import{createContext as J}from"react";var V=J(void 0);import z from"./apollo-error/apollo-error.module.scss";import{jsx as q,jsxs as Z}from"react/jsx-runtime";function $(){var r=H(V),e=r===null||r===void 0?void 0:r.error;if(!e)return null;var t=function(r,e){return(e===null||e===void 0?void 0:e.length)?Z("div",{children:[Z("strong",{children:[r,":"]}),q("ul",{children:e.map(function(r){return q("li",{children:r.message},r.message)})})]}):null};return q("div",{className:z["modal-backdrop"],children:Z("div",{className:z["modal-content"],children:[q("button",{type:"button",className:z["btn-close"],onClick:r.hideError,children:"✕"}),Z("div",{className:z["error-title"],children:[q("button",{type:"button",className:z["btn-retry"],onClick:function(){return window.location.reload()},children:q(Q,{})})," ",e.message]}),Z("div",{className:z["error-details"],children:[e.networkError&&Z("pre",{className:"network",children:[q("strong",{children:"Network Error:"})," ",e.networkError.message]}),t("GraphQL Errors",S(e.graphQLErrors)),t("Protocol Errors",S(e.protocolErrors)),t("Client Errors",S(e.clientErrors)),e.extraInfo&&Z("pre",{className:"extra",children:[q("strong",{children:"Extra Info:"})," ",JSON.stringify(e.extraInfo,null,4)]})]})]})})}import{use as rr}from"react";function re(){var r=rr(V);if(!r)throw new Error("useApolloError must be used within ApolloErrorProvider");return r}import{useEffect as rt,useMemo as rn,useState as ro}from"react";import{jsx as ra}from"react/jsx-runtime";var ri=null;function rc(r){ri===null||ri===void 0?void 0:ri(r)}function rs(r){var e=r.children;var t=O(ro(null),2),n=t[0],o=t[1];rt(function(){ri=o},[]);var a=rn(function(){return{error:n,showError:o,hideError:function(){return o(null)}}},[n]);return ra(V,{value:a,children:e})}import{consola as rl}from"consola/browser";var ru={silent:rl.silent,level:rl.level,fatal:rl.fatal,error:rl.error,warn:rl.warn,log:rl.log,info:rl.info,success:rl.success,ready:rl.ready,start:rl.start,box:rl.box,debug:rl.debug,trace:rl.trace,verbose:rl.verbose};import{toast as rf,Toaster as rp}from"react-hot-toast";var rm="/graphql";import{Fragment as rv,jsx as rd,jsxs as rg}from"react/jsx-runtime";var rh=/*#__PURE__*/function(r){"use strict";p(e,r);function e(){c(this,e);var r;r=i(this,e,arguments);r.count=0;return r}l(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,a=r.operationName||"Unnamed";return ru.info("[Apollo] #".concat(t.count,": ").concat(a," (").concat(o,"ms)")),e})}}]);return e}(x);function ry(r){var e=r||{},t=e.uri,n=e.wsUrl,o=e.customLinks,a=new rh,i=U(function(r){var e=r.graphQLErrors,t=r.networkError,n=r.protocolErrors,o=r.operation;var a=(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;ru.error("[GraphQL error] ".concat(a,": ").concat(e,", Location: ").concat(JSON.stringify(t),", Path: ").concat(n))}),n&&n.forEach(function(r){var e=r.message,t=r.extensions;ru.error("[Protocol error]: ".concat(e,", Extensions: ").concat(JSON.stringify(t)))}),t&&ru.error("[Network error]: ".concat(t)),e||n||t){var i,c;var s=(e===null||e===void 0?void 0:(i=e[0])===null||i===void 0?void 0:i.message)||(n===null||n===void 0?void 0:(c=n[0])===null||c===void 0?void 0:c.message)||(t===null||t===void 0?void 0:t.message)||"Unexpected error",l=new L({graphQLErrors:e||[],protocolErrors:n||[],clientErrors:[],networkError:t||null,errorMessage:s,extraInfo:{operation:o}});rf.error(function(r){return rg(rv,{children:[s,"\xa0",rd(X,{cursor:"pointer",onClick:function(){setTimeout(function(){rc(l)},0),rf.dismiss(r.id)}})]})})}}),c=F();t||ru.warn('[Apollo] No GraphQL URI provided — using "'.concat(rm,'" as default'));var s=new M({uri:t!==null&&t!==void 0?t:rm,credentials:"include"}),l=n?new K(B({url:n})):x.empty(),u=m(l,x)?G(function(r){var e=r.query;var t=Y(e);return t.kind==="OperationDefinition"&&t.operation==="subscription"},l,s):s;return u===s&&n&&ru.warn("[Apollo] WS URL is set, but subscriptions fallback to HTTP. Check your wsLink config."),[a,i,c].concat(S(o!==null&&o!==void 0?o:[]),[u])}function rE(r){var e=r.isNextJS,t=r.options,n=r.children,o=r.client,a=r.provider,i=r.cache;var c=t||{},s=c.uri,l=c.wsUrl,u=c.customLinks,f=_(c,["uri","wsUrl","customLinks"]);if(typeof(o!==null&&o!==void 0?o:A)!="function")throw new TypeError("Invalid ApolloClient provided. Ensure CustomClient is a class.");var p=a||k,v=W(function(){return j(ry({uri:s,wsUrl:l,customLinks:u}))},[s,l,u]),d=W(function(){return new A(y({link:v,cache:m(i,R)?i:new R},f))},[v,i,f]),g=e?rd(p,{makeClient:function(){return d},children:n}):rd(p,{client:d,children:n});return e?rd(p,{makeClient:function(){return d},children:n}):rg(rv,{children:[rg(rs,{children:[g,rd($,{})]}),rd(rp,{position:"top-right"})]})}import{useTranslation as rb}from"react-i18next";var r_=rb;import rN from"i18next";import{initReactI18next as rw}from"react-i18next";function rI(r){return rN.use(rw).init(r)}import rO from"classnames";import rS from"./loading/loading.module.scss";import{jsx as rC,jsxs as rT}from"react/jsx-runtime";function rP(r){var e=r.full,t=e===void 0?!1:e,n=r.block,o=n===void 0?!1:n,a=r.className,i=a===void 0?"":a,c=r.message,s=c===void 0?"Loading":c,l=_(r,["full","block","className","message"]);function u(){return rT("div",b(y({className:rS.container},l),{children:[rC("div",{className:rS.ring}),rC("div",{className:rS.ring}),rC("div",{className:rS.ring}),rC("div",{className:rS.ring}),s&&rC("div",{className:rS.message,children:s})]}))}return t?rC("div",{className:rO(rS.fullscreen,i),children:u()}):o?rC("div",{className:rO(rS.block,i),children:u()}):u()}import{createContext as rD}from"react";var rA=rD(void 0);import{use as rL}from"react";function rx(){var r=rL(rA);if(!r)throw new Error("useLoading must be used within a LoadingProvider");return r}import{useCallback as rk,useMemo as rj,useState as rM}from"react";import{jsx as rR}from"react/jsx-runtime";function rG(r){var e=r.children;var t=O(rM(!1),2),n=t[0],o=t[1],a=O(rM(!1),2),i=a[0],c=a[1],s=rk(function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;o(!0),c(r)},[]),l=rk(function(){o(!1),c(!1)},[]),u=rj(function(){return{isLoading:n,isGlobalLoading:i,showLoading:s,hideLoading:l}},[n,i,s,l]);return rR(rA,{value:u,children:n?rR(rP,{full:i}):e})}import{createContext as rU}from"react";var rF=rU(void 0);import{NextIntlClientProvider as rK}from"next-intl";import{useTranslations as rY}from"next-intl";import{use as rB}from"react";function rW(){var r=rB(rF);if(!r)throw new Error("useNextIntl must be used within a NextIntlProvider");return r}var rX=rY;import{jsx as rH}from"react/jsx-runtime";function rQ(r){var e=function(e){var t;var n=rW(),o=n.currentLanguage,a=e.messages,i=e.languages,c="en",s=a[(o===null||o===void 0?void 0:o.value)||c],l=(t=i.find(function(r){return r.value===(o===null||o===void 0?void 0:o.value)}))===null||t===void 0?void 0:t.timezone;return a?rH(rK,{locale:(o===null||o===void 0?void 0:o.value)||c,messages:s,timeZone:l,children:rH(r,y({},e))}):(ru.warn("Missing messages for language: ".concat((o===null||o===void 0?void 0:o.value)||c)),null)};return e.displayName="withNextIntl(".concat(r.displayName||r.name||"Component",")"),e}import{useMemo as rJ}from"react";import{useCallback as rV,useEffect as rz,useState as rq}from"react";var rZ={serialize:function(r){return JSON.stringify(r,function(r,e){return m(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})}};import r$ from"localforage";var r0={get:function r(r){return a(function(){var e;return D(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,r$.getItem(r)];case 1:return[2,t.sent()];case 2:e=t.sent();return[2,(ru.error('[Storage:get] Error getting key "'.concat(r,'":'),e),null)];case 3:return[2]}})})()},set:function r(r,e){return a(function(){var t;return D(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,r$.setItem(r,e)];case 1:n.sent();return[3,3];case 2:t=n.sent();ru.error('[Storage:set] Error setting key "'.concat(r,'":'),t);return[3,3];case 3:return[2]}})})()},remove:function r(r){return a(function(){var e;return D(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,r$.removeItem(r)];case 1:t.sent();return[3,3];case 2:e=t.sent();ru.error('[Storage:remove] Error removing key "'.concat(r,'":'),e);return[3,3];case 3:return[2]}})})()},keys:function r(){return a(function(){var r,e;return D(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,r$.keys()];case 1:return[2,(r=t.sent())!==null&&r!==void 0?r:[]];case 2:e=t.sent();return[2,(ru.error("[Storage:keys] Error getting keys:",e),[])];case 3:return[2]}})})()}};function r1(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:rZ;var n=O(rq(e),2),o=n[0],i=n[1],c=O(rq(!1),2),s=c[0],l=c[1];rz(function(){var n=!0;return a(function(){var o,a,c,s;return D(this,function(u){switch(u.label){case 0:u.trys.push([0,6,7,8]);return[4,r0.get(r)];case 1:o=u.sent();if(!n)return[3,5];if(!(o!==null))return[3,2];a=t.deserialize(o);i(a);return[3,5];case 2:if(!(e!==void 0))return[3,4];c=t.serialize(e);return[4,r0.set(r,c)];case 3:u.sent(),i(e);return[3,5];case 4:i(void 0);u.label=5;case 5:return[3,8];case 6:s=u.sent();ru.error('Error loading value for key "'.concat(r,'":'),s),n&&i(e);return[3,8];case 7:n&&l(!0);return[7];case 8:return[2]}})})(),function(){n=!1,l(!1)}},[r,e,t]),rz(function(){if(!s)return;a(function(){var e,n;return D(this,function(a){switch(a.label){case 0:a.trys.push([0,3,,4]);if(!(o!==void 0))return[3,2];e=t.serialize(o);return[4,r0.set(r,e)];case 1:a.sent();a.label=2;case 2:return[3,4];case 3:n=a.sent();ru.error('Error saving value for key "'.concat(r,'":'),n);return[3,4];case 4:return[2]}})})()},[o,r,t,s]);var u=rV(function(r){i(function(e){return typeof r=="function"?r(e):r})},[]),f=rV(/*#__PURE__*/a(function(){var e;return D(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,r0.remove(r)];case 1:t.sent(),i(void 0);return[3,3];case 2:e=t.sent();ru.error('Error removing key "'.concat(r,'":'),e);return[3,3];case 3:return[2]}})}),[r]);return{value:o,set:u,remove:f}}import{Fragment as r2,jsx as r3}from"react/jsx-runtime";function r4(r){var e=r.children;return r3(r2,{children:e})}var r8=rQ(r4);function r6(r){var e=r.children,t=r.languages,n=r.messages;var o;var a=r1("lang",(o=t===null||t===void 0?void 0:t[0])!==null&&o!==void 0?o:{}),i=a.value,c=a.set,s=rJ(function(){return{languages:t,currentLanguage:i,setCurrentLanguage:c}},[t,c,i]);return r3(rF,{value:s,children:r3(r8,{languages:t,messages:n,children:e})})}import r5 from"@vitejs/plugin-react-swc";import{defineConfig as r7}from"vitest/config";function r9(r){return r7(y({plugins:[r5()],test:{include:["**/*.test.e2e.?(c|m)[jt]s?(x)"],browser:{enabled:!0,provider:"playwright",instances:[{browser:"chromium"},{browser:"firefox"},{browser:"webkit"}]}}},r))}import er from"@vitejs/plugin-react-swc";import{defineConfig as ee}from"vitest/config";import et from"node:process";import{exec as en}from"node:child_process";import*as eo from"node:util";import ea from"node:process";var ei=ea.env.DEBUG==="true";import ec from"chalk";import es from"consola";import{GraphQLError as el}from"graphql";ei||(es.level=4);function eu(r){var e=ec[r];return typeof e=="function"?e:ec.green}var ef={silent:es.silent,level:es.level,fatal:es.fatal,error:es.error,warn:es.warn,log:es.log,info:es.info,success:es.success,ready:es.ready,start:es.start,box:es.box,debug:es.debug,trace:es.trace,verbose:es.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)){es.box(ec.green(r));return}e.forEach(function(r){var e=r.file,n=r.position,o=r.rule,a=r.message;es.log("".concat(ec.gray("File:")," ").concat(ec.blue("".concat(e).concat(n?":".concat(n):"")))),o&&es.log(" ".concat(eu(t)("Rule:")," ").concat(o)),es.log(" ".concat(eu(t)("Message:")," ").concat(a))}),es.box(eu(t)("".concat(r," : ").concat(e.length))),es.log(ec.gray("─".repeat(40)))}};import ep from"node-fetch";import*as em from"node:fs";function ev(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++){e[t]=arguments[t]}return e.every(function(r){return em.existsSync(r)})}import ed from"node-persist";var eg=eo.promisify(en);function eh(r){return{raw:!0,cmd:r}}function ey(r,e){return(e===null||e===void 0?void 0:e.isRemote)?"".concat(eZ," ").concat(eI," ").concat(r):(e===null||e===void 0?void 0:e.isCurrentProject)?"".concat(eZ," ").concat(eV," ").concat(eR," ").concat(r):"".concat(eZ," ").concat(eM," ").concat(r)}function eE(r,e){return typeof r=="function"?ey(r(e),e):(typeof r==="undefined"?"undefined":C(r))=="object"&&(r===null||r===void 0?void 0:r.raw)===!0?r.cmd:typeof r=="string"?ey(r,e):r}import*as eb from"node:path";function e_(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++){e[t]=arguments[t]}var n;return(n=eb).resolve.apply(n,[ew].concat(S(e)))}function eN(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++){e[t]=arguments[t]}var n;return(n=eb).join.apply(n,S(e))}var ew=et.env.INIT_CWD||et.cwd(),eI="@cyberskill/shared";var eO="node_modules",eS="dist",eC="package.json",eT="package-lock.json",eP="tsconfig.json",eD=".gitignore",eA=".simple-git-hooks.json",eL="pnpm-lock.yaml",ex=".git/hooks/",ek=".git/COMMIT_EDITMSG",ej=eN(ew,eO,eI,eS),eM="cyberskill",eR="src/nodejs/cli/index.ts",eG="eslint",eU="eslint",eF="vitest",eK="playwright",eY="vitest",eB="@commitlint/cli",eW="commitlint",eX="lint-staged",eH="lint-staged",eQ="typescript",eJ="tsc",eV="tsx",ez="git",eq="pnpm",eZ="pnpm exec",e$="simple-git-hooks",e0="simple-git-hooks",e1="@eslint/config-inspector",e2="eslint-config-inspector",e3="node-modules-inspector",e4="node-modules-inspector",e8={CYBERSKILL_DIRECTORY:ej,WORKING_DIRECTORY:ew,TS_CONFIG:e_(eP),GIT_IGNORE:e_(eD),GIT_HOOK:e_(ex),GIT_COMMIT_MSG:e_(ek),SIMPLE_GIT_HOOKS_JSON:e_(eA),PACKAGE_JSON:e_(eC),PACKAGE_LOCK_JSON:e_(eT),PNPM_LOCK_YAML:e_(eL),NODE_MODULES:e_(eO),CYBERSKILL:{LINT_STAGED_CONFIG:e_("".concat(ej,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:e_("".concat(ej,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:e_("".concat(ej,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:e_("".concat(ej,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:e_("".concat(ej,"/react/vitest/vitest.e2e.js"))}};function e6(r){for(var e=arguments.length,t=new Array(e>1?e-1:0),n=1;n<e;n++){t[n-1]=arguments[n]}var o=O(t,2),a=o[0],i=o[1],c=r==="RAW"?!0:ev.apply(void 0,S(a.split(" ").map(function(r){return eN(e8.NODE_MODULES,r)})));switch(r){case"PNPM_ADD_AND_EXEC":return eE(eh("".concat(c?"":"".concat(eq," add ").concat(a," && ")).concat(eZ," ").concat(i)));case"PNPM_ADD_DEV_AND_EXEC":return eE(eh("".concat(c?"":"".concat(eq," add -D ").concat(a," && ")).concat(eZ," ").concat(i)));case"RAW":return eE(eh(a))}}var e5={SIMPLE_GIT_HOOKS:e6("PNPM_ADD_DEV_AND_EXEC",e$,e0),ESLINT_INSPECT:e6("PNPM_ADD_DEV_AND_EXEC",e1,e2),NODE_MODULES_INSPECT:e6("PNPM_ADD_DEV_AND_EXEC",e3,e4),ESLINT_CHECK:e6("PNPM_ADD_DEV_AND_EXEC",eG,"".concat(eU," ").concat(e8.WORKING_DIRECTORY)),ESLINT_FIX:e6("PNPM_ADD_DEV_AND_EXEC",eG,"".concat(eU," ").concat(e8.WORKING_DIRECTORY," --fix")),TYPESCRIPT_CHECK:e6("PNPM_ADD_AND_EXEC",eQ,"".concat(eJ," -p ").concat(e8.TS_CONFIG," --noEmit")),CONFIGURE_GIT_HOOK:e6("RAW","".concat(ez," config core.hooksPath ").concat(e8.GIT_HOOK)),BUILD:e6("RAW","".concat(eq," run build")),STAGE_BUILD_DIRECTORY:e6("RAW","".concat(ez," add ").concat(eS)),PNPM_INSTALL_STANDARD:e6("RAW","".concat(eq," install")),PNPM_INSTALL_LEGACY:e6("RAW","".concat(eq," install --legacy-peer-deps")),PNPM_INSTALL_FORCE:e6("RAW","".concat(eq," install --force")),CYBERSKILL:{TEST_UNIT:e6("PNPM_ADD_AND_EXEC",eF,"".concat(eY," --config ").concat(e8.CYBERSKILL.UNIT_TEST_CONFIG)),TEST_E2E:e6("PNPM_ADD_AND_EXEC","".concat(eF," ").concat(eK),"".concat(eY," --config ").concat(e8.CYBERSKILL.E2E_TEST_CONFIG)),COMMIT_LINT:e6("PNPM_ADD_DEV_AND_EXEC",eB,"".concat(eW," --edit ").concat(e8.GIT_COMMIT_MSG," --config ").concat(e8.CYBERSKILL.COMMITLINT_CONFIG)),LINT_STAGED:e6("PNPM_ADD_DEV_AND_EXEC",eX,"".concat(eH," --config ").concat(e8.CYBERSKILL.LINT_STAGED_CONFIG))}};function e7(r){return ee(y({plugins:[er()],test:{globals:!0,environment:"jsdom",pool:"vmThreads",include:["**/*.test.unit.?(c|m)[jt]s?(x)"],setupFiles:[e8.CYBERSKILL.UNIT_TEST_SETUP_CONFIG]}},r))}export{$ as ApolloError,V as ApolloErrorContext,rs as ApolloErrorProvider,rE as ApolloProvider,rm as GRAPHQL_URI_DEFAULT,rP as Loading,rA as LoadingContext,rG as LoadingProvider,rF as NextIntlContext,r6 as NextIntlProvider,rp as Toaster,rI as initI18next,ru as log,rc as showGlobalApolloError,r0 as storage,rf as toast,re as useApolloError,rx as useLoading,rW as useNextIntl,r1 as useStorage,r_ as useTranslateI18next,rX as useTranslateNextIntl,r9 as vitestE2E,e7 as vitestUnit,rQ as withNextIntl};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cyberskill/shared",
3
3
  "type": "module",
4
- "version": "1.70.0",
4
+ "version": "1.71.0",
5
5
  "description": "CyberSkill Shared",
6
6
  "author": "Stephen Cheng",
7
7
  "license": "MIT",
@@ -34,6 +34,11 @@
34
34
  "import": "./dist/configs/eslint/index.js",
35
35
  "require": "./dist/configs/eslint/index.cjs"
36
36
  },
37
+ "./configs/graphql-codegen": {
38
+ "types": "./dist/configs/graphql-codegen/index.d.ts",
39
+ "import": "./dist/configs/graphql-codegen/index.js",
40
+ "require": "./dist/configs/graphql-codegen/index.cjs"
41
+ },
37
42
  "./configs/lint-staged": {
38
43
  "types": "./dist/configs/lint-staged/index.d.ts",
39
44
  "import": "./dist/configs/lint-staged/index.js",
@@ -114,11 +119,6 @@
114
119
  "import": "./dist/react/apollo-error/index.js",
115
120
  "require": "./dist/react/apollo-error/index.cjs"
116
121
  },
117
- "./react/graphql-codegen": {
118
- "types": "./dist/react/graphql-codegen/index.d.ts",
119
- "import": "./dist/react/graphql-codegen/index.js",
120
- "require": "./dist/react/graphql-codegen/index.cjs"
121
- },
122
122
  "./react/i18next": {
123
123
  "types": "./dist/react/i18next/index.d.ts",
124
124
  "import": "./dist/react/i18next/index.js",