@cyberskill/shared 1.64.0 → 1.66.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 +10 -0
- package/dist/_tsup-dts-rollup.d.ts +10 -0
- package/dist/cli.cjs +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- 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/apollo-error.cjs +1 -1
- package/dist/react/apollo-error.js +1 -1
- package/dist/react/apollo-error.module.scss +16 -16
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.js +1 -1
- package/dist/utils/index.cjs +1 -1
- package/dist/utils/index.d.cts +2 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +1 -1
- package/dist/utils/react-hot-toast.cjs +1 -0
- package/dist/utils/react-hot-toast.d.cts +2 -0
- package/dist/utils/react-hot-toast.d.ts +2 -0
- package/dist/utils/react-hot-toast.js +1 -0
- package/package.json +1 -1
package/dist/react/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
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});
|
|
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 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 m(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)||y()}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 R={};V(R,{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(R);var Q=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-icons/fa6");var $="/graphql";var K=require("consola/browser"),X={silent:K.consola.silent,level:K.consola.level,fatal:K.consola.fatal,error:K.consola.error,warn:K.consola.warn,log:K.consola.log,info:K.consola.info,success:K.consola.success,ready:K.consola.ready,start:K.consola.start,box:K.consola.box,debug:K.consola.debug,trace:K.consola.trace,verbose:K.consola.verbose};var Y=require("react-hot-toast");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===null||ra===void 0?void 0: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=(0,rr.use)(ro),e=r===null||r===void 0?void 0:r.error;if(!e)return null;var n=function(r,e){return(e===null||e===void 0?void 0:e.length)?(0,rt.jsxs)("div",{children:[(0,rt.jsxs)("strong",{children:[r,":"]}),(0,rt.jsx)("ul",{children:e.map(function(r){return(0,rt.jsx)("li",{children:r.message},r.message)})})]}):null};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:r.hideError,children:"✕"}),(0,rt.jsxs)("div",{className:rn.default["error-title"],children:[(0,rt.jsx)("button",{type:"button",className:rn.default["btn-retry"],onClick:function(){return window.location.reload()},children:(0,rt.jsx)(re.FaRepeat,{})})," ",e.message]}),(0,rt.jsxs)("div",{className:rn.default["error-details"],children:[e.networkError&&(0,rt.jsxs)("pre",{className:"network",children:[(0,rt.jsx)("strong",{children:"Network Error:"})," ",e.networkError.message]}),n("GraphQL Errors",N(e.graphQLErrors)),n("Protocol Errors",N(e.protocolErrors)),n("Client Errors",N(e.clientErrors)),e.extraInfo&&(0,rt.jsxs)("pre",{className:"extra",children:[(0,rt.jsx)("strong",{children:"Extra Info:"})," ",JSON.stringify(e.extraInfo,null,4)]})]})]})})}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 X.info("[Apollo] #".concat(n.count,": ").concat(i," (").concat(o,"ms)")),e})}}]);return e}(Q.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;X.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;X.error("[Protocol error]: ".concat(e,", Extensions: ").concat(JSON.stringify(n)))}),n&&X.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 Q.ApolloError({graphQLErrors:e||[],protocolErrors:t||[],clientErrors:[],networkError:n||null,errorMessage:l,extraInfo:{operation:o}});Y.toast.error(function(r){return(0,rf.jsxs)(rf.Fragment,{children:[l,"\xa0",(0,rf.jsx)(Z.FaInfo,{onClick:function(){setTimeout(function(){rl(s)},0),Y.toast.dismiss(r.id)}})]})})}}),u=(0,F.removeTypenameFromVariables)();n||X.warn('[Apollo] No GraphQL URI provided — using "'.concat($,'" as default'));var l=new Q.HttpLink({uri:n!==null&&n!==void 0?n:$,credentials:"include"}),s=t?new J.GraphQLWsLink((0,H.createClient)({url:t})):Q.ApolloLink.empty(),c=v(s,Q.ApolloLink)?(0,Q.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&&X.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:Q.ApolloClient)!="function")throw new TypeError("Invalid ApolloClient provided. Ensure CustomClient is a class.");var d=i||Q.ApolloProvider,p=(0,W.useMemo)(function(){return(0,Q.from)(rv({uri:l,wsUrl:s,customLinks:c}))},[l,s,c]),h=(0,W.useMemo)(function(){return new Q.ApolloClient(m({link:p,cache:v(a,Q.InMemoryCache)?a:new Q.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)(Y.Toaster,{position:"top-right"})]})}var rh=U(require("classnames"),1),rg=require("react"),ry=U(require("./loading.module.scss"),1),rm=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,rm.jsxs)("div",w(m({className:ry.default.container},s),{children:[(0,rm.jsx)("div",{className:ry.default.ring}),(0,rm.jsx)("div",{className:ry.default.ring}),(0,rm.jsx)("div",{className:ry.default.ring}),(0,rm.jsx)("div",{className:ry.default.ring}),l&&(0,rm.jsx)("div",{className:ry.default.message,children:l})]}))}return n?(0,rm.jsx)("div",{className:(0,rh.default)(ry.default.fullscreen,a),children:c()}):o?(0,rm.jsx)("div",{className:(0,rh.default)(ry.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,rm.jsx)(rb,{value:c,children:t?(0,rm.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,(X.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();X.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();X.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,(X.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();X.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();X.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();X.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,m({},e))}):(X.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});
|
package/dist/react/index.js
CHANGED
|
@@ -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,t,o,i,a){try{var s=r[i](a);var u=s.value}catch(r){n(r);return}if(s.done){e(u)}else{Promise.resolve(u).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 s(r){o(a,t,i,s,u,"next",r)}function u(r){o(a,t,i,s,u,"throw",r)}s(undefined)})}}function a(r,e,n){e=f(e);return O(r,L()?Reflect.construct(e,n||[],f(r).constructor):e.apply(r,n))}function s(r,e){if(!(r instanceof e)){throw new TypeError("Cannot call a class as a function")}}function u(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)u(r.prototype,e);if(n)u(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 v(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)x(r,e)}function d(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,s;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;s=r}finally{try{if(!o&&n["return"]!=null)n["return"]()}finally{if(i)throw s}}return t}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 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 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 E(r,e){if(r==null)return{};var n=k(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 k(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 O(r,e){if(e&&(S(e)==="object"||typeof e==="function")){return e}return t(r)}function x(r,e){x=Object.setPrototypeOf||function r(r,e){r.__proto__=e;return r};return x(r,e)}function j(r,n){return e(r)||m(r,n)||P(r,n)||h()}function N(r){return n(r)||p(r)||P(r)||g()}function S(r){"@swc/helpers - typeof";return r&&typeof Symbol!=="undefined"&&r.constructor===Symbol?"symbol":typeof r}function P(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 I(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:s(0),"throw":s(1),"return":s(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function s(r){return function(e){return u([r,e])}}function u(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}}}import{ApolloClient as C,ApolloError as A,ApolloLink as _,ApolloProvider as D,from as T,HttpLink as U,InMemoryCache as M,split as R}from"@apollo/client";import{onError as Q}from"@apollo/client/link/error";import{removeTypenameFromVariables as V}from"@apollo/client/link/remove-typename";import{GraphQLWsLink as G}from"@apollo/client/link/subscriptions";import{getMainDefinition as z}from"@apollo/client/utilities";import{createClient as J}from"graphql-ws";import{useMemo as F}from"react";import{toast as q,Toaster as B}from"react-hot-toast";import{FaExpand as H}from"react-icons/fa6";var W="/graphql";import{consola as Z}from"consola/browser";var $={silent:Z.silent,level:Z.level,fatal:Z.fatal,error:Z.error,warn:Z.warn,log:Z.log,info:Z.info,success:Z.success,ready:Z.ready,start:Z.start,box:Z.box,debug:Z.debug,trace:Z.trace,verbose:Z.verbose};import{createContext as K,use as X,useEffect as Y,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=K(void 0);function rs(){var r=X(ra);if(!r)throw new Error("useApolloErrorViewer must be used within ApolloErrorViewerProvider");return r}var ru=null;function rl(r){ru=r}function rc(r){ru&&ru(r)}function rf(r){var e=r.children;var n=j(re(null),2),t=n[0],o=n[1];Y(function(){rl(o)},[]);var i=rr(function(){return{error:t,showError:o,hideError:function(){return o(null)}}},[t]);return ro(ra,{value:i,children:e})}function rv(){var r,e,n;var t=X(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 rd,jsx as rp,jsxs as rm}from"react/jsx-runtime";var rh=/*#__PURE__*/function(r){"use strict";v(e,r);function e(){s(this,e);var r;r=a(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 $.info("[Apollo] #".concat(n.count,": ").concat(i," (").concat(o,"ms)")),e})}}]);return e}(_);function rg(r){var e=r||{},n=e.uri,t=e.wsUrl,o=e.customLinks,i=new rh,a=Q(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 a,s;var u=(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:(s=t[0])===null||s===void 0?void 0:s.message)||(n===null||n===void 0?void 0:n.message)||"Unexpected error",l=new A({graphQLErrors:e||[],protocolErrors:t||[],clientErrors:[],networkError:n||null,errorMessage:u,extraInfo:{operation:o}});q.error(function(r){return rm(rd,{children:[u,"\xa0",rp(H,{onClick:function(){setTimeout(function(){rc(l)},0),q.dismiss(r.id)}})]})})}}),s=V();n||$.warn('[Apollo] No GraphQL URI provided — using "'.concat(W,'" as default'));var u=new U({uri:n!==null&&n!==void 0?n:W,credentials:"include"}),l=t?new G(J({url:t})):_.empty(),c=d(l,_)?R(function(r){var e=r.query;var n=z(e);return n.kind==="OperationDefinition"&&n.operation==="subscription"},l,u):u;return c===u&&t&&$.warn("[Apollo] WS URL is set, but subscriptions fallback to HTTP. Check your wsLink config."),[i,a,s].concat(N(o!==null&&o!==void 0?o:[]),[c])}function ry(r){var e=r.isNextJS,n=r.options,t=r.children,o=r.client,i=r.provider,a=r.cache;var s=n||{},u=s.uri,l=s.wsUrl,c=s.customLinks,f=E(s,["uri","wsUrl","customLinks"]);if(typeof(o!==null&&o!==void 0?o:C)!="function")throw new TypeError("Invalid ApolloClient provided. Ensure CustomClient is a class.");var v=i||D,p=F(function(){return T(rg({uri:u,wsUrl:l,customLinks:c}))},[u,l,c]),m=F(function(){return new C(y({link:p,cache:d(a,M)?a:new M},f))},[p,a,f]),h=e?rp(v,{makeClient:function(){return m},children:t}):rp(v,{client:m,children:t});return e?rp(v,{makeClient:function(){return m},children:t}):rm(rd,{children:[rm(rf,{children:[h,rp(rv,{})]}),rp(B,{position:"top-right"})]})}import rb from"classnames";import{createContext as rw,use as rE,useCallback as rk,useMemo as rO,useState as rx}from"react";import rj from"./loading.module.scss";import{jsx as rN,jsxs as rS}from"react/jsx-runtime";var rP=rw(void 0);function rL(){var r=rE(rP);if(!r)throw new Error("useLoading must be used within a LoadingProvider");return r}function rI(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,s=r.message,u=s===void 0?"Loading":s,l=E(r,["full","block","className","message"]);function c(){return rS("div",w(y({className:rj.container},l),{children:[rN("div",{className:rj.ring}),rN("div",{className:rj.ring}),rN("div",{className:rj.ring}),rN("div",{className:rj.ring}),u&&rN("div",{className:rj.message,children:u})]}))}return n?rN("div",{className:rb(rj.fullscreen,a),children:c()}):o?rN("div",{className:rb(rj.block,a),children:c()}):c()}function rC(r){var e=r.children;var n=j(rx(!1),2),t=n[0],o=n[1],i=j(rx(!1),2),a=i[0],s=i[1],u=rk(function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;o(!0),s(r)},[]),l=rk(function(){o(!1),s(!1)},[]),c=rO(function(){return{isLoading:t,isGlobalLoading:a,showLoading:u,hideLoading:l}},[t,a,u,l]);return rN(rP,{value:c,children:t?rN(rI,{full:a}):e})}import{NextIntlClientProvider as rA,useTranslations as r_}from"next-intl";import{createContext as rD,use as rT,useMemo as rU}from"react";import{useCallback as rM,useEffect as rR,useState as rQ}from"react";var rV={serialize:function(r){return JSON.stringify(r,function(r,e){return d(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 rG from"localforage";var rz={get:function r(r){return i(function(){var e;return I(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,rG.getItem(r)];case 1:return[2,n.sent()];case 2:e=n.sent();return[2,($.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 I(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,rG.setItem(r,e)];case 1:t.sent();return[3,3];case 2:n=t.sent();$.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 I(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,rG.removeItem(r)];case 1:n.sent();return[3,3];case 2:e=n.sent();$.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 I(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,rG.keys()];case 1:return[2,(r=n.sent())!==null&&r!==void 0?r:[]];case 2:e=n.sent();return[2,($.error("[Storage:keys] Error getting keys:",e),[])];case 3:return[2]}})})()}};function rJ(r,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:rV;var t=j(rQ(e),2),o=t[0],a=t[1],s=j(rQ(!1),2),u=s[0],l=s[1];rR(function(){var t=!0;return i(function(){var o,i,s,u;return I(this,function(c){switch(c.label){case 0:c.trys.push([0,6,7,8]);return[4,rz.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];s=n.serialize(e);return[4,rz.set(r,s)];case 3:c.sent(),a(e);return[3,5];case 4:a(void 0);c.label=5;case 5:return[3,8];case 6:u=c.sent();$.error('Error loading value for key "'.concat(r,'":'),u),t&&a(e);return[3,8];case 7:t&&l(!0);return[7];case 8:return[2]}})})(),function(){t=!1,l(!1)}},[r,e,n]),rR(function(){if(!u)return;i(function(){var e,t;return I(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,rz.set(r,e)];case 1:i.sent();i.label=2;case 2:return[3,4];case 3:t=i.sent();$.error('Error saving value for key "'.concat(r,'":'),t);return[3,4];case 4:return[2]}})})()},[o,r,n,u]);var c=rM(function(r){a(function(e){return typeof r=="function"?r(e):r})},[]),f=rM(/*#__PURE__*/i(function(){var e;return I(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,rz.remove(r)];case 1:n.sent(),a(void 0);return[3,3];case 2:e=n.sent();$.error('Error removing key "'.concat(r,'":'),e);return[3,3];case 3:return[2]}})}),[r]);return{value:o,set:c,remove:f}}import{Fragment as rF,jsx as rq}from"react/jsx-runtime";var rB=rD(void 0);function rH(){var r=rT(rB);if(!r)throw new Error("useNextIntl must be used within a NextIntlProvider");return r}var rW=r_;function rZ(r){var e=function(e){var n;var t=rH(),o=t.currentLanguage,i=e.messages,a=e.languages,s="en",u=i[(o===null||o===void 0?void 0:o.value)||s],l=(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?rq(rA,{locale:(o===null||o===void 0?void 0:o.value)||s,messages:u,timeZone:l,children:rq(r,y({},e))}):($.warn("Missing messages for language: ".concat((o===null||o===void 0?void 0:o.value)||s)),null)};return e.displayName="withNextIntl(".concat(r.displayName||r.name||"Component",")"),e}function r$(r){var e=r.children;return rq(rF,{children:e})}var rK=rZ(r$);function rX(r){var e=r.children,n=r.languages,t=r.messages;var o;var i=rJ("lang",(o=n===null||n===void 0?void 0:n[0])!==null&&o!==void 0?o:{}),a=i.value,s=i.set,u=rU(function(){return{languages:n,currentLanguage:a,setCurrentLanguage:s}},[n,s,a]);return rq(rB,{value:u,children:rq(rK,{languages:n,messages:t,children:e})})}export{rv as ApolloErrorViewerModal,rf as ApolloErrorViewerProvider,ry as ApolloProvider,rI as Loading,rP as LoadingContext,rC as LoadingProvider,rB as NextIntlContext,rX as NextIntlProvider,rl as registerApolloErrorViewerCallback,rc as showGlobalApolloError,rs as useApolloErrorViewer,rL as useLoading,rH as useNextIntl,rJ as useStorage,rW as useTranslateNextIntl,rZ as withNextIntl};
|
|
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,t,o,a,i){try{var s=r[a](i);var u=s.value}catch(r){n(r);return}if(s.done){e(u)}else{Promise.resolve(u).then(t,o)}}function a(r){return function(){var e=this,n=arguments;return new Promise(function(t,a){var i=r.apply(e,n);function s(r){o(i,t,a,s,u,"next",r)}function u(r){o(i,t,a,s,u,"throw",r)}s(undefined)})}}function i(r,e,n){e=f(e);return O(r,L()?Reflect.construct(e,n||[],f(r).constructor):e.apply(r,n))}function s(r,e){if(!(r instanceof e)){throw new TypeError("Cannot call a class as a function")}}function u(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)u(r.prototype,e);if(n)u(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 v(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)x(r,e)}function d(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 a=false;var i,s;try{for(n=n.call(r);!(o=(i=n.next()).done);o=true){t.push(i.value);if(e&&t.length===e)break}}catch(r){a=true;s=r}finally{try{if(!o&&n["return"]!=null)n["return"]()}finally{if(a)throw s}}return t}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 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 g(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 E(r,e){if(r==null)return{};var n=k(r,e);var t,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(r);for(o=0;o<a.length;o++){t=a[o];if(e.indexOf(t)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(r,t))continue;n[t]=r[t]}}return n}function k(r,e){if(r==null)return{};var n={};var t=Object.keys(r);var o,a;for(a=0;a<t.length;a++){o=t[a];if(e.indexOf(o)>=0)continue;n[o]=r[o]}return n}function O(r,e){if(e&&(S(e)==="object"||typeof e==="function")){return e}return t(r)}function x(r,e){x=Object.setPrototypeOf||function r(r,e){r.__proto__=e;return r};return x(r,e)}function j(r,n){return e(r)||m(r,n)||P(r,n)||h()}function N(r){return n(r)||p(r)||P(r)||y()}function S(r){"@swc/helpers - typeof";return r&&typeof Symbol!=="undefined"&&r.constructor===Symbol?"symbol":typeof r}function P(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 I(r,e){var n,t,o,a,i={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]};return a={next:s(0),"throw":s(1),"return":s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(r){return function(e){return u([r,e])}}function u(a){if(n)throw new TypeError("Generator is already executing.");while(i)try{if(n=1,t&&(o=a[0]&2?t["return"]:a[0]?t["throw"]||((o=t["return"])&&o.call(t),0):t.next)&&!(o=o.call(t,a[1])).done)return o;if(t=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++;t=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];t=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}}import{ApolloClient as C,ApolloError as A,ApolloLink as _,ApolloProvider as D,from as T,HttpLink as U,InMemoryCache as M,split as R}from"@apollo/client";import{onError as G}from"@apollo/client/link/error";import{removeTypenameFromVariables as Q}from"@apollo/client/link/remove-typename";import{GraphQLWsLink as z}from"@apollo/client/link/subscriptions";import{getMainDefinition as V}from"@apollo/client/utilities";import{createClient as F}from"graphql-ws";import{useMemo as J}from"react";import{FaInfo as q}from"react-icons/fa6";var B="/graphql";import{consola as H}from"consola/browser";var W={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};import{toast as Z,Toaster as $}from"react-hot-toast";import{createContext as K,use as X,useEffect as Y,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 ra}from"react/jsx-runtime";var ri=K(void 0);function rs(){var r=X(ri);if(!r)throw new Error("useApolloErrorViewer must be used within ApolloErrorViewerProvider");return r}var ru=null;function rl(r){ru=r}function rc(r){ru===null||ru===void 0?void 0:ru(r)}function rf(r){var e=r.children;var n=j(re(null),2),t=n[0],o=n[1];Y(function(){rl(o)},[]);var a=rr(function(){return{error:t,showError:o,hideError:function(){return o(null)}}},[t]);return ro(ri,{value:a,children:e})}function rv(){var r=X(ri),e=r===null||r===void 0?void 0:r.error;if(!e)return null;var n=function(r,e){return(e===null||e===void 0?void 0:e.length)?ra("div",{children:[ra("strong",{children:[r,":"]}),ro("ul",{children:e.map(function(r){return ro("li",{children:r.message},r.message)})})]}):null};return ro("div",{className:rt["modal-backdrop"],children:ra("div",{className:rt["modal-content"],children:[ro("button",{type:"button",className:rt["btn-close"],onClick:r.hideError,children:"✕"}),ra("div",{className:rt["error-title"],children:[ro("button",{type:"button",className:rt["btn-retry"],onClick:function(){return window.location.reload()},children:ro(rn,{})})," ",e.message]}),ra("div",{className:rt["error-details"],children:[e.networkError&&ra("pre",{className:"network",children:[ro("strong",{children:"Network Error:"})," ",e.networkError.message]}),n("GraphQL Errors",N(e.graphQLErrors)),n("Protocol Errors",N(e.protocolErrors)),n("Client Errors",N(e.clientErrors)),e.extraInfo&&ra("pre",{className:"extra",children:[ro("strong",{children:"Extra Info:"})," ",JSON.stringify(e.extraInfo,null,4)]})]})]})})}import{Fragment as rd,jsx as rp,jsxs as rm}from"react/jsx-runtime";var rh=/*#__PURE__*/function(r){"use strict";v(e,r);function e(){s(this,e);var r;r=i(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,a=r.operationName||"Unnamed";return W.info("[Apollo] #".concat(n.count,": ").concat(a," (").concat(o,"ms)")),e})}}]);return e}(_);function ry(r){var e=r||{},n=e.uri,t=e.wsUrl,o=e.customLinks,a=new rh,i=G(function(r){var e=r.graphQLErrors,n=r.networkError,t=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,n=r.locations,t=r.path;W.error("[GraphQL error] ".concat(a,": ").concat(e,", Location: ").concat(JSON.stringify(n),", Path: ").concat(t))}),t&&t.forEach(function(r){var e=r.message,n=r.extensions;W.error("[Protocol error]: ".concat(e,", Extensions: ").concat(JSON.stringify(n)))}),n&&W.error("[Network error]: ".concat(n)),e||t||n){var i,s;var u=(e===null||e===void 0?void 0:(i=e[0])===null||i===void 0?void 0:i.message)||(t===null||t===void 0?void 0:(s=t[0])===null||s===void 0?void 0:s.message)||(n===null||n===void 0?void 0:n.message)||"Unexpected error",l=new A({graphQLErrors:e||[],protocolErrors:t||[],clientErrors:[],networkError:n||null,errorMessage:u,extraInfo:{operation:o}});Z.error(function(r){return rm(rd,{children:[u,"\xa0",rp(q,{onClick:function(){setTimeout(function(){rc(l)},0),Z.dismiss(r.id)}})]})})}}),s=Q();n||W.warn('[Apollo] No GraphQL URI provided — using "'.concat(B,'" as default'));var u=new U({uri:n!==null&&n!==void 0?n:B,credentials:"include"}),l=t?new z(F({url:t})):_.empty(),c=d(l,_)?R(function(r){var e=r.query;var n=V(e);return n.kind==="OperationDefinition"&&n.operation==="subscription"},l,u):u;return c===u&&t&&W.warn("[Apollo] WS URL is set, but subscriptions fallback to HTTP. Check your wsLink config."),[a,i,s].concat(N(o!==null&&o!==void 0?o:[]),[c])}function rg(r){var e=r.isNextJS,n=r.options,t=r.children,o=r.client,a=r.provider,i=r.cache;var s=n||{},u=s.uri,l=s.wsUrl,c=s.customLinks,f=E(s,["uri","wsUrl","customLinks"]);if(typeof(o!==null&&o!==void 0?o:C)!="function")throw new TypeError("Invalid ApolloClient provided. Ensure CustomClient is a class.");var v=a||D,p=J(function(){return T(ry({uri:u,wsUrl:l,customLinks:c}))},[u,l,c]),m=J(function(){return new C(g({link:p,cache:d(i,M)?i:new M},f))},[p,i,f]),h=e?rp(v,{makeClient:function(){return m},children:t}):rp(v,{client:m,children:t});return e?rp(v,{makeClient:function(){return m},children:t}):rm(rd,{children:[rm(rf,{children:[h,rp(rv,{})]}),rp($,{position:"top-right"})]})}import rb from"classnames";import{createContext as rw,use as rE,useCallback as rk,useMemo as rO,useState as rx}from"react";import rj from"./loading.module.scss";import{jsx as rN,jsxs as rS}from"react/jsx-runtime";var rP=rw(void 0);function rL(){var r=rE(rP);if(!r)throw new Error("useLoading must be used within a LoadingProvider");return r}function rI(r){var e=r.full,n=e===void 0?!1:e,t=r.block,o=t===void 0?!1:t,a=r.className,i=a===void 0?"":a,s=r.message,u=s===void 0?"Loading":s,l=E(r,["full","block","className","message"]);function c(){return rS("div",w(g({className:rj.container},l),{children:[rN("div",{className:rj.ring}),rN("div",{className:rj.ring}),rN("div",{className:rj.ring}),rN("div",{className:rj.ring}),u&&rN("div",{className:rj.message,children:u})]}))}return n?rN("div",{className:rb(rj.fullscreen,i),children:c()}):o?rN("div",{className:rb(rj.block,i),children:c()}):c()}function rC(r){var e=r.children;var n=j(rx(!1),2),t=n[0],o=n[1],a=j(rx(!1),2),i=a[0],s=a[1],u=rk(function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;o(!0),s(r)},[]),l=rk(function(){o(!1),s(!1)},[]),c=rO(function(){return{isLoading:t,isGlobalLoading:i,showLoading:u,hideLoading:l}},[t,i,u,l]);return rN(rP,{value:c,children:t?rN(rI,{full:i}):e})}import{NextIntlClientProvider as rA,useTranslations as r_}from"next-intl";import{createContext as rD,use as rT,useMemo as rU}from"react";import{useCallback as rM,useEffect as rR,useState as rG}from"react";var rQ={serialize:function(r){return JSON.stringify(r,function(r,e){return d(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 rz from"localforage";var rV={get:function r(r){return a(function(){var e;return I(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,rz.getItem(r)];case 1:return[2,n.sent()];case 2:e=n.sent();return[2,(W.error('[Storage:get] Error getting key "'.concat(r,'":'),e),null)];case 3:return[2]}})})()},set:function r(r,e){return a(function(){var n;return I(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,rz.setItem(r,e)];case 1:t.sent();return[3,3];case 2:n=t.sent();W.error('[Storage:set] Error setting key "'.concat(r,'":'),n);return[3,3];case 3:return[2]}})})()},remove:function r(r){return a(function(){var e;return I(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,rz.removeItem(r)];case 1:n.sent();return[3,3];case 2:e=n.sent();W.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 I(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,rz.keys()];case 1:return[2,(r=n.sent())!==null&&r!==void 0?r:[]];case 2:e=n.sent();return[2,(W.error("[Storage:keys] Error getting keys:",e),[])];case 3:return[2]}})})()}};function rF(r,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:rQ;var t=j(rG(e),2),o=t[0],i=t[1],s=j(rG(!1),2),u=s[0],l=s[1];rR(function(){var t=!0;return a(function(){var o,a,s,u;return I(this,function(c){switch(c.label){case 0:c.trys.push([0,6,7,8]);return[4,rV.get(r)];case 1:o=c.sent();if(!t)return[3,5];if(!(o!==null))return[3,2];a=n.deserialize(o);i(a);return[3,5];case 2:if(!(e!==void 0))return[3,4];s=n.serialize(e);return[4,rV.set(r,s)];case 3:c.sent(),i(e);return[3,5];case 4:i(void 0);c.label=5;case 5:return[3,8];case 6:u=c.sent();W.error('Error loading value for key "'.concat(r,'":'),u),t&&i(e);return[3,8];case 7:t&&l(!0);return[7];case 8:return[2]}})})(),function(){t=!1,l(!1)}},[r,e,n]),rR(function(){if(!u)return;a(function(){var e,t;return I(this,function(a){switch(a.label){case 0:a.trys.push([0,3,,4]);if(!(o!==void 0))return[3,2];e=n.serialize(o);return[4,rV.set(r,e)];case 1:a.sent();a.label=2;case 2:return[3,4];case 3:t=a.sent();W.error('Error saving value for key "'.concat(r,'":'),t);return[3,4];case 4:return[2]}})})()},[o,r,n,u]);var c=rM(function(r){i(function(e){return typeof r=="function"?r(e):r})},[]),f=rM(/*#__PURE__*/a(function(){var e;return I(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,rV.remove(r)];case 1:n.sent(),i(void 0);return[3,3];case 2:e=n.sent();W.error('Error removing key "'.concat(r,'":'),e);return[3,3];case 3:return[2]}})}),[r]);return{value:o,set:c,remove:f}}import{Fragment as rJ,jsx as rq}from"react/jsx-runtime";var rB=rD(void 0);function rH(){var r=rT(rB);if(!r)throw new Error("useNextIntl must be used within a NextIntlProvider");return r}var rW=r_;function rZ(r){var e=function(e){var n;var t=rH(),o=t.currentLanguage,a=e.messages,i=e.languages,s="en",u=a[(o===null||o===void 0?void 0:o.value)||s],l=(n=i.find(function(r){return r.value===(o===null||o===void 0?void 0:o.value)}))===null||n===void 0?void 0:n.timezone;return a?rq(rA,{locale:(o===null||o===void 0?void 0:o.value)||s,messages:u,timeZone:l,children:rq(r,g({},e))}):(W.warn("Missing messages for language: ".concat((o===null||o===void 0?void 0:o.value)||s)),null)};return e.displayName="withNextIntl(".concat(r.displayName||r.name||"Component",")"),e}function r$(r){var e=r.children;return rq(rJ,{children:e})}var rK=rZ(r$);function rX(r){var e=r.children,n=r.languages,t=r.messages;var o;var a=rF("lang",(o=n===null||n===void 0?void 0:n[0])!==null&&o!==void 0?o:{}),i=a.value,s=a.set,u=rU(function(){return{languages:n,currentLanguage:i,setCurrentLanguage:s}},[n,s,i]);return rq(rB,{value:u,children:rq(rK,{languages:n,messages:t,children:e})})}export{rv as ApolloErrorViewerModal,rf as ApolloErrorViewerProvider,rg as ApolloProvider,rI as Loading,rP as LoadingContext,rC as LoadingProvider,rB as NextIntlContext,rX as NextIntlProvider,rl as registerApolloErrorViewerCallback,rc as showGlobalApolloError,rs as useApolloErrorViewer,rL as useLoading,rH as useNextIntl,rF as useStorage,rW as useTranslateNextIntl,rZ as withNextIntl};
|
package/dist/utils/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,r,t,n,o,a,u){try{var i=e[a](u);var l=i.value}catch(e){t(e);return}if(i.done){r(l)}else{Promise.resolve(l).then(n,o)}}function o(e){return function(){var r=this,t=arguments;return new Promise(function(o,a){var u=e.apply(r,t);function i(e){n(u,o,a,i,l,"next",e)}function l(e){n(u,o,a,i,l,"throw",e)}i(undefined)})}}function a(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 u(e,r){if(r!=null&&typeof Symbol!=="undefined"&&r[Symbol.hasInstance]){return!!r[Symbol.hasInstance](e)}else{return e instanceof r}}function i(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function l(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 a=false;var u,i;try{for(t=t.call(e);!(o=(u=t.next()).done);o=true){n.push(u.value);if(r&&n.length===r)break}}catch(e){a=true;i=e}finally{try{if(!o&&t["return"]!=null)t["return"]()}finally{if(a)throw i}}return n}function c(){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 f(){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 s(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){a(e,r,t[r])})}return e}function y(e,r){if(e==null)return{};var t=v(e,r);var n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++){n=a[o];if(r.indexOf(n)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(e,n))continue;t[n]=e[n]}}return t}function v(e,r){if(e==null)return{};var t={};var n=Object.keys(e);var o,a;for(a=0;a<n.length;a++){o=n[a];if(r.indexOf(o)>=0)continue;t[o]=e[o]}return t}function d(e,t){return r(e)||l(e,t)||g(e,t)||c()}function p(e){return t(e)||i(e)||g(e)||f()}function b(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function g(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 h(e,r){var t,n,o,a,u={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]};return a={next:i(0),"throw":i(1),"return":i(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function i(e){return function(r){return l([e,r])}}function l(a){if(t)throw new TypeError("Generator is already executing.");while(u)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:u.label++;return{value:a[1],done:false};case 5:u.label++;n=a[1];a=[0];continue;case 7:a=u.ops.pop();u.trys.pop();continue;default:if(!(o=u.trys,o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){u=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(a[0]===6&&u.label<o[1]){u.label=o[1];o=a;break}if(o&&u.label<o[2]){u.label=o[2];u.ops.push(a);break}if(o[2])u.ops.pop();u.trys.pop();continue}a=r.call(e,u)}catch(e){a=[6,e];n=0}finally{t=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}}var m=Object.create;var w=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var O=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,A=Object.prototype.hasOwnProperty;var x=function(e,r){for(var t in r)w(e,t,{get:r[t],enumerable:!0})},k=function(e,r,t,n){var o=true,a=false,u=undefined;if(r&&(typeof r==="undefined"?"undefined":b(r))=="object"||typeof r=="function")try{var i=function(){var o=c.value;!A.call(e,o)&&o!==t&&w(e,o,{get:function(){return r[o]},enumerable:!(n=S(r,o))||n.enumerable})};for(var l=O(r)[Symbol.iterator](),c;!(o=(c=l.next()).done);o=true)i()}catch(e){a=true;u=e}finally{try{if(!o&&l.return!=null){l.return()}}finally{if(a){throw u}}}return e};var P=function(e,r,t){return t=e!=null?m(j(e)):{},k(r||!e||!e.__esModule?w(t,"default",{value:e,enumerable:!0}):t,e)},I=function(e){return k(w({},"__esModule",{value:!0}),e)};var E={};x(E,{deepMerge:function(){return
|
|
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,r,t,n,o,a,u){try{var i=e[a](u);var l=i.value}catch(e){t(e);return}if(i.done){r(l)}else{Promise.resolve(l).then(n,o)}}function o(e){return function(){var r=this,t=arguments;return new Promise(function(o,a){var u=e.apply(r,t);function i(e){n(u,o,a,i,l,"next",e)}function l(e){n(u,o,a,i,l,"throw",e)}i(undefined)})}}function a(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 u(e,r){if(r!=null&&typeof Symbol!=="undefined"&&r[Symbol.hasInstance]){return!!r[Symbol.hasInstance](e)}else{return e instanceof r}}function i(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function l(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 a=false;var u,i;try{for(t=t.call(e);!(o=(u=t.next()).done);o=true){n.push(u.value);if(r&&n.length===r)break}}catch(e){a=true;i=e}finally{try{if(!o&&t["return"]!=null)t["return"]()}finally{if(a)throw i}}return n}function c(){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 f(){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 s(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){a(e,r,t[r])})}return e}function y(e,r){if(e==null)return{};var t=v(e,r);var n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++){n=a[o];if(r.indexOf(n)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(e,n))continue;t[n]=e[n]}}return t}function v(e,r){if(e==null)return{};var t={};var n=Object.keys(e);var o,a;for(a=0;a<n.length;a++){o=n[a];if(r.indexOf(o)>=0)continue;t[o]=e[o]}return t}function d(e,t){return r(e)||l(e,t)||g(e,t)||c()}function p(e){return t(e)||i(e)||g(e)||f()}function b(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function g(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 h(e,r){var t,n,o,a,u={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]};return a={next:i(0),"throw":i(1),"return":i(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function i(e){return function(r){return l([e,r])}}function l(a){if(t)throw new TypeError("Generator is already executing.");while(u)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:u.label++;return{value:a[1],done:false};case 5:u.label++;n=a[1];a=[0];continue;case 7:a=u.ops.pop();u.trys.pop();continue;default:if(!(o=u.trys,o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){u=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(a[0]===6&&u.label<o[1]){u.label=o[1];o=a;break}if(o&&u.label<o[2]){u.label=o[2];u.ops.push(a);break}if(o[2])u.ops.pop();u.trys.pop();continue}a=r.call(e,u)}catch(e){a=[6,e];n=0}finally{t=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}}var m=Object.create;var w=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var O=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,A=Object.prototype.hasOwnProperty;var x=function(e,r){for(var t in r)w(e,t,{get:r[t],enumerable:!0})},k=function(e,r,t,n){var o=true,a=false,u=undefined;if(r&&(typeof r==="undefined"?"undefined":b(r))=="object"||typeof r=="function")try{var i=function(){var o=c.value;!A.call(e,o)&&o!==t&&w(e,o,{get:function(){return r[o]},enumerable:!(n=S(r,o))||n.enumerable})};for(var l=O(r)[Symbol.iterator](),c;!(o=(c=l.next()).done);o=true)i()}catch(e){a=true;u=e}finally{try{if(!o&&l.return!=null){l.return()}}finally{if(a){throw u}}}return e};var P=function(e,r,t){return t=e!=null?m(j(e)):{},k(r||!e||!e.__esModule?w(t,"default",{value:e,enumerable:!0}):t,e)},I=function(e){return k(w({},"__esModule",{value:!0}),e)};var E={};x(E,{Toaster:function(){return H.Toaster},deepMerge:function(){return T},generateShortId:function(){return Q},generateSlug:function(){return L},isJson:function(){return M},isPlainObject:function(){return _},log:function(){return U},regexSearchMapper:function(){return C},removeAccent:function(){return J},serializer:function(){return R},storageClient:function(){return G},toast:function(){return H.toast},validate:function(){return V}});module.exports=I(E);var D=P(require("unorm"),1);function M(e){try{return JSON.parse(e),!0}catch(e){return!1}}function _(e){return!!e&&(typeof e==="undefined"?"undefined":b(e))=="object"&&!Array.isArray(e)}function T(){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,o=undefined;try{for(var a=Object.entries(r)[Symbol.iterator](),u;!(t=(u=a.next()).done);t=true){var i=d(u.value,2),l=i[0],c=i[1];var f=e[l];Array.isArray(c)?e[l]=Array.from(new Set(p(Array.isArray(f)?f:[]).concat(p(c)))):_(c)?e[l]=T(_(f)?f:{},c):e[l]=c}}catch(e){n=true;o=e}finally{try{if(!t&&a.return!=null){a.return()}}finally{if(n){throw o}}}return e},{})}var q={a:["\xe0","\xe1","ạ","ả","\xe3","\xe2","ầ","ấ","ậ","ẩ","ẫ","ă","ằ","ắ","ặ","ẳ","ẵ"],e:["\xe8","\xe9","ẹ","ẻ","ẽ","\xea","ề","ế","ệ","ể","ễ"],i:["\xec","\xed","ị","ỉ","ĩ"],o:["\xf2","\xf3","ọ","ỏ","\xf5","\xf4","ồ","ố","ộ","ổ","ỗ","ơ","ờ","ớ","ợ","ở","ỡ"],u:["\xf9","\xfa","ụ","ủ","ũ","ư","ừ","ứ","ự","ử","ữ"],y:["ỳ","\xfd","ỵ","ỷ","ỹ"],d:["đ"]},z=Object.entries(q).reduce(function(e,r){var t=d(r,2),n=t[0],o=t[1];return e[n.toUpperCase()]=o.map(function(e){return e.toUpperCase()}),e},{});function C(e){e=D.default.nfkc(e);var r=s({},q,z);var t=true,n=false,o=undefined;try{for(var a=Object.entries(r)[Symbol.iterator](),u;!(t=(u=a.next()).done);t=true){var i=d(u.value,2),l=i[0],c=i[1];var f="[".concat(l).concat(c.join(""),"]"),y="(".concat([l].concat(p(c)).join("|"),")");e=e.replace(new RegExp(f,"g"),y)}}catch(e){n=true;o=e}finally{try{if(!t&&a.return!=null){a.return()}}finally{if(n){throw o}}}return e}function J(e){return e.normalize("NFD").replace(RegExp("\\p{Diacritic}","gu"),"")}var N=require("consola/browser"),U={silent:N.consola.silent,level:N.consola.level,fatal:N.consola.fatal,error:N.consola.error,warn:N.consola.warn,log:N.consola.log,info:N.consola.info,success:N.consola.success,ready:N.consola.ready,start:N.consola.start,box:N.consola.box,debug:N.consola.debug,trace:N.consola.trace,verbose:N.consola.verbose};var H=require("react-hot-toast");var R={serialize:function(e){return JSON.stringify(e,function(e,r){return u(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 F=P(require("localforage"),1);var G={get:function e(e){return o(function(){var r;return h(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,F.default.getItem(e)];case 1:return[2,t.sent()];case 2:r=t.sent();return[2,(U.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 h(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,F.default.setItem(e,r)];case 1:n.sent();return[3,3];case 2:t=n.sent();U.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 h(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,F.default.removeItem(e)];case 1:t.sent();return[3,3];case 2:r=t.sent();U.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 h(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,F.default.keys()];case 1:return[2,(e=t.sent())!==null&&e!==void 0?e:[]];case 2:r=t.sent();return[2,(U.error("[Storage:keys] Error getting keys:",r),[])];case 3:return[2]}})})()}};var $=P(require("crypto-js"),1),B=P(require("slugify"),1),K=B.default.default||B.default;function L(){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,o=n===void 0?!0:n,a=t.locale,u=a===void 0?"vi":a,i=y(t,["lower","locale"]);return K(e,s({lower:o,locale:u},i))}function Q(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:4;return $.default.SHA256(e).toString($.default.enc.Hex).slice(0,r)}var V={isEmpty:function e(e){return e==null?!0:Array.isArray(e)?e.length===0:(typeof e==="undefined"?"undefined":b(e))=="object"?u(e,Date)?!1:Object.keys(e).length===0:typeof e=="string"?e.trim().length===0:!1}};0&&(module.exports={Toaster:Toaster,deepMerge:deepMerge,generateShortId:generateShortId,generateSlug:generateSlug,isJson:isJson,isPlainObject:isPlainObject,log:log,regexSearchMapper:regexSearchMapper,removeAccent:removeAccent,serializer:serializer,storageClient:storageClient,toast:toast,validate:validate});
|
package/dist/utils/index.d.cts
CHANGED
|
@@ -4,6 +4,8 @@ export { deepMerge_alias_2 as deepMerge } from '../_tsup-dts-rollup.cjs';
|
|
|
4
4
|
export { regexSearchMapper_alias_2 as regexSearchMapper } from '../_tsup-dts-rollup.cjs';
|
|
5
5
|
export { removeAccent_alias_2 as removeAccent } from '../_tsup-dts-rollup.cjs';
|
|
6
6
|
export { log_alias_1 as log } from '../_tsup-dts-rollup.cjs';
|
|
7
|
+
export { toast_alias_1 as toast } from '../_tsup-dts-rollup.cjs';
|
|
8
|
+
export { Toaster_alias_1 as Toaster } from '../_tsup-dts-rollup.cjs';
|
|
7
9
|
export { serializer_alias_1 as serializer } from '../_tsup-dts-rollup.cjs';
|
|
8
10
|
export { storageClient_alias_1 as storageClient } from '../_tsup-dts-rollup.cjs';
|
|
9
11
|
export { generateSlug_alias_1 as generateSlug } from '../_tsup-dts-rollup.cjs';
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ export { deepMerge_alias_2 as deepMerge } from '../_tsup-dts-rollup.js';
|
|
|
4
4
|
export { regexSearchMapper_alias_2 as regexSearchMapper } from '../_tsup-dts-rollup.js';
|
|
5
5
|
export { removeAccent_alias_2 as removeAccent } from '../_tsup-dts-rollup.js';
|
|
6
6
|
export { log_alias_1 as log } from '../_tsup-dts-rollup.js';
|
|
7
|
+
export { toast_alias_1 as toast } from '../_tsup-dts-rollup.js';
|
|
8
|
+
export { Toaster_alias_1 as Toaster } from '../_tsup-dts-rollup.js';
|
|
7
9
|
export { serializer_alias_1 as serializer } from '../_tsup-dts-rollup.js';
|
|
8
10
|
export { storageClient_alias_1 as storageClient } from '../_tsup-dts-rollup.js';
|
|
9
11
|
export { generateSlug_alias_1 as generateSlug } from '../_tsup-dts-rollup.js';
|
package/dist/utils/index.js
CHANGED
|
@@ -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,e,t,n,o,a,u){try{var i=r[a](u);var l=i.value}catch(r){t(r);return}if(i.done){e(l)}else{Promise.resolve(l).then(n,o)}}function o(r){return function(){var e=this,t=arguments;return new Promise(function(o,a){var u=r.apply(e,t);function i(r){n(u,o,a,i,l,"next",r)}function l(r){n(u,o,a,i,l,"throw",r)}i(undefined)})}}function a(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 u(r,e){if(e!=null&&typeof Symbol!=="undefined"&&e[Symbol.hasInstance]){return!!e[Symbol.hasInstance](r)}else{return r instanceof e}}function i(r){if(typeof Symbol!=="undefined"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function l(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 u,i;try{for(t=t.call(r);!(o=(u=t.next()).done);o=true){n.push(u.value);if(e&&n.length===e)break}}catch(r){a=true;i=r}finally{try{if(!o&&t["return"]!=null)t["return"]()}finally{if(a)throw i}}return n}function c(){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
|
|
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,e,t,n,o,a,u){try{var i=r[a](u);var l=i.value}catch(r){t(r);return}if(i.done){e(l)}else{Promise.resolve(l).then(n,o)}}function o(r){return function(){var e=this,t=arguments;return new Promise(function(o,a){var u=r.apply(e,t);function i(r){n(u,o,a,i,l,"next",r)}function l(r){n(u,o,a,i,l,"throw",r)}i(undefined)})}}function a(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 u(r,e){if(e!=null&&typeof Symbol!=="undefined"&&e[Symbol.hasInstance]){return!!e[Symbol.hasInstance](r)}else{return r instanceof e}}function i(r){if(typeof Symbol!=="undefined"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function l(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 u,i;try{for(t=t.call(r);!(o=(u=t.next()).done);o=true){n.push(u.value);if(e&&n.length===e)break}}catch(r){a=true;i=r}finally{try{if(!o&&t["return"]!=null)t["return"]()}finally{if(a)throw i}}return n}function c(){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 s(){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 f(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){a(r,e,t[e])})}return r}function y(r,e){if(r==null)return{};var t=p(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 p(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 v(r,t){return e(r)||l(r,t)||h(r,t)||c()}function b(r){return t(r)||i(r)||h(r)||s()}function d(r){"@swc/helpers - typeof";return r&&typeof Symbol!=="undefined"&&r.constructor===Symbol?"symbol":typeof r}function h(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 m(r,e){var t,n,o,a,u={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]};return a={next:i(0),"throw":i(1),"return":i(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function i(r){return function(e){return l([r,e])}}function l(a){if(t)throw new TypeError("Generator is already executing.");while(u)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:u.label++;return{value:a[1],done:false};case 5:u.label++;n=a[1];a=[0];continue;case 7:a=u.ops.pop();u.trys.pop();continue;default:if(!(o=u.trys,o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){u=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(a[0]===6&&u.label<o[1]){u.label=o[1];o=a;break}if(o&&u.label<o[2]){u.label=o[2];u.ops.push(a);break}if(o[2])u.ops.pop();u.trys.pop();continue}a=e.call(r,u)}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 g from"unorm";function w(r){try{return JSON.parse(r),!0}catch(r){return!1}}function S(r){return!!r&&(typeof r==="undefined"?"undefined":d(r))=="object"&&!Array.isArray(r)}function O(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++){e[t]=arguments[t]}return e.flat().reduce(function(r,e){var t=true,n=false,o=undefined;try{for(var a=Object.entries(e)[Symbol.iterator](),u;!(t=(u=a.next()).done);t=true){var i=v(u.value,2),l=i[0],c=i[1];var s=r[l];Array.isArray(c)?r[l]=Array.from(new Set(b(Array.isArray(s)?s:[]).concat(b(c)))):S(c)?r[l]=O(S(s)?s:{},c):r[l]=c}}catch(r){n=true;o=r}finally{try{if(!t&&a.return!=null){a.return()}}finally{if(n){throw o}}}return r},{})}var j={a:["\xe0","\xe1","ạ","ả","\xe3","\xe2","ầ","ấ","ậ","ẩ","ẫ","ă","ằ","ắ","ặ","ẳ","ẵ"],e:["\xe8","\xe9","ẹ","ẻ","ẽ","\xea","ề","ế","ệ","ể","ễ"],i:["\xec","\xed","ị","ỉ","ĩ"],o:["\xf2","\xf3","ọ","ỏ","\xf5","\xf4","ồ","ố","ộ","ổ","ỗ","ơ","ờ","ớ","ợ","ở","ỡ"],u:["\xf9","\xfa","ụ","ủ","ũ","ư","ừ","ứ","ự","ử","ữ"],y:["ỳ","\xfd","ỵ","ỷ","ỹ"],d:["đ"]},A=Object.entries(j).reduce(function(r,e){var t=v(e,2),n=t[0],o=t[1];return r[n.toUpperCase()]=o.map(function(r){return r.toUpperCase()}),r},{});function x(r){r=g.nfkc(r);var e=f({},j,A);var t=true,n=false,o=undefined;try{for(var a=Object.entries(e)[Symbol.iterator](),u;!(t=(u=a.next()).done);t=true){var i=v(u.value,2),l=i[0],c=i[1];var s="[".concat(l).concat(c.join(""),"]"),y="(".concat([l].concat(b(c)).join("|"),")");r=r.replace(new RegExp(s,"g"),y)}}catch(r){n=true;o=r}finally{try{if(!t&&a.return!=null){a.return()}}finally{if(n){throw o}}}return r}function k(r){return r.normalize("NFD").replace(RegExp("\\p{Diacritic}","gu"),"")}import{consola as E}from"consola/browser";var I={silent:E.silent,level:E.level,fatal:E.fatal,error:E.error,warn:E.warn,log:E.log,info:E.info,success:E.success,ready:E.ready,start:E.start,box:E.box,debug:E.debug,trace:E.trace,verbose:E.verbose};import{toast as P,Toaster as D}from"react-hot-toast";var C={serialize:function(r){return JSON.stringify(r,function(r,e){return u(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 N from"localforage";var T={get:function r(r){return o(function(){var e;return m(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,N.getItem(r)];case 1:return[2,t.sent()];case 2:e=t.sent();return[2,(I.error('[Storage:get] Error getting key "'.concat(r,'":'),e),null)];case 3:return[2]}})})()},set:function r(r,e){return o(function(){var t;return m(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,N.setItem(r,e)];case 1:n.sent();return[3,3];case 2:t=n.sent();I.error('[Storage:set] Error setting key "'.concat(r,'":'),t);return[3,3];case 3:return[2]}})})()},remove:function r(r){return o(function(){var e;return m(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,N.removeItem(r)];case 1:t.sent();return[3,3];case 2:e=t.sent();I.error('[Storage:remove] Error removing key "'.concat(r,'":'),e);return[3,3];case 3:return[2]}})})()},keys:function r(){return o(function(){var r,e;return m(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,N.keys()];case 1:return[2,(r=t.sent())!==null&&r!==void 0?r:[]];case 2:e=t.sent();return[2,(I.error("[Storage:keys] Error getting keys:",e),[])];case 3:return[2]}})})()}};import _ from"crypto-js";import z from"slugify";var J=z.default||z;function U(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",e=arguments.length>1?arguments[1]:void 0;var t=e||{},n=t.lower,o=n===void 0?!0:n,a=t.locale,u=a===void 0?"vi":a,i=y(t,["lower","locale"]);return J(r,f({lower:o,locale:u},i))}function M(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:4;return _.SHA256(r).toString(_.enc.Hex).slice(0,e)}var G={isEmpty:function r(r){return r==null?!0:Array.isArray(r)?r.length===0:(typeof r==="undefined"?"undefined":d(r))=="object"?u(r,Date)?!1:Object.keys(r).length===0:typeof r=="string"?r.trim().length===0:!1}};export{D as Toaster,O as deepMerge,M as generateShortId,U as generateSlug,w as isJson,S as isPlainObject,I as log,x as regexSearchMapper,k as removeAccent,C as serializer,T as storageClient,P as toast,G as validate};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function e(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}var t=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var n=Object.getOwnPropertyNames;var o=Object.prototype.hasOwnProperty;var a=function(e,r){for(var n in r)t(e,n,{get:r[n],enumerable:!0})},u=function(a,u,f,i){var c=true,l=false,s=undefined;if(u&&(typeof u==="undefined"?"undefined":e(u))=="object"||typeof u=="function")try{var y=function(){var e=v.value;!o.call(a,e)&&e!==f&&t(a,e,{get:function(){return u[e]},enumerable:!(i=r(u,e))||i.enumerable})};for(var p=n(u)[Symbol.iterator](),v;!(c=(v=p.next()).done);c=true)y()}catch(e){l=true;s=e}finally{try{if(!c&&p.return!=null){p.return()}}finally{if(l){throw s}}}return a};var f=function(e){return u(t({},"__esModule",{value:!0}),e)};var i={};a(i,{Toaster:function(){return c.Toaster},toast:function(){return c.toast}});module.exports=f(i);var c=require("react-hot-toast");0&&(module.exports={Toaster:Toaster,toast:toast});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{toast as t,Toaster as a}from"react-hot-toast";export{a as Toaster,t as toast};
|