intlayer-editor 5.7.2 → 5.7.3
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/client/dist/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<title>Intlayer Editor</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-CGJhAW85.js"></script>
|
|
9
9
|
<link rel="stylesheet" crossorigin href="/assets/index-DA11smeb.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "intlayer-editor",
|
|
3
|
-
"version": "5.7.
|
|
3
|
+
"version": "5.7.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Integrate the Intlayer visual editor into your Intlayer projects, enabling CMS-like content management with multilingual support.",
|
|
6
6
|
"keywords": [
|
|
@@ -74,14 +74,14 @@
|
|
|
74
74
|
"react-dom": "^19.1.0",
|
|
75
75
|
"react-router-dom": "^7.4.0",
|
|
76
76
|
"rimraf": "^6.0.1",
|
|
77
|
-
"@intlayer/
|
|
78
|
-
"@intlayer/
|
|
79
|
-
"@intlayer/
|
|
80
|
-
"
|
|
81
|
-
"@intlayer/
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
"react-intlayer": "5.7.
|
|
77
|
+
"@intlayer/core": "5.7.3",
|
|
78
|
+
"@intlayer/config": "5.7.3",
|
|
79
|
+
"@intlayer/api": "5.7.3",
|
|
80
|
+
"express-intlayer": "5.7.3",
|
|
81
|
+
"@intlayer/editor-react": "5.7.3",
|
|
82
|
+
"vite-intlayer": "5.7.3",
|
|
83
|
+
"@intlayer/design-system": "5.7.3",
|
|
84
|
+
"react-intlayer": "5.7.3"
|
|
85
85
|
},
|
|
86
86
|
"devDependencies": {
|
|
87
87
|
"@tailwindcss/vite": "^4.0.14",
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
"typescript-eslint": "^8.27.0",
|
|
104
104
|
"vite": "^6.3.5",
|
|
105
105
|
"vitest": "^3.2.2",
|
|
106
|
-
"@intlayer/backend": "5.7.
|
|
106
|
+
"@intlayer/backend": "5.7.3"
|
|
107
107
|
},
|
|
108
108
|
"peerDependencies": {
|
|
109
109
|
"@types/compression": "^1.7.5",
|
|
@@ -114,15 +114,15 @@
|
|
|
114
114
|
"react-dom": ">=16.0.0",
|
|
115
115
|
"react-router-dom": ">=6.0.0",
|
|
116
116
|
"tailwind-merge": "^3.3.0",
|
|
117
|
-
"@intlayer/core": "5.7.
|
|
118
|
-
"@intlayer/design-system": "5.7.
|
|
119
|
-
"@intlayer/config": "5.7.
|
|
120
|
-
"
|
|
121
|
-
"@intlayer/editor-react": "5.7.
|
|
122
|
-
"
|
|
123
|
-
"
|
|
124
|
-
"intlayer": "5.7.
|
|
125
|
-
"
|
|
117
|
+
"@intlayer/core": "5.7.3",
|
|
118
|
+
"@intlayer/design-system": "5.7.3",
|
|
119
|
+
"@intlayer/config": "5.7.3",
|
|
120
|
+
"@intlayer/chokidar": "5.7.3",
|
|
121
|
+
"@intlayer/editor-react": "5.7.3",
|
|
122
|
+
"react-intlayer": "5.7.3",
|
|
123
|
+
"vite-intlayer": "5.7.3",
|
|
124
|
+
"@intlayer/dictionaries-entry": "5.7.3",
|
|
125
|
+
"intlayer": "5.7.3"
|
|
126
126
|
},
|
|
127
127
|
"engines": {
|
|
128
128
|
"node": ">=14.18"
|
|
@@ -132,8 +132,11 @@
|
|
|
132
132
|
},
|
|
133
133
|
"scripts": {
|
|
134
134
|
"build": "pnpm build:client && pnpm build:server",
|
|
135
|
-
"build:
|
|
136
|
-
"build:
|
|
135
|
+
"build:ci": "pnpm build:client:ci && pnpm build:server:ci",
|
|
136
|
+
"build:client": "pnpm clean:client && pnpm build:client:ci",
|
|
137
|
+
"build:client:ci": "vite build --config ./client/vite.config.ts",
|
|
138
|
+
"build:server": "pnpm clean:server && pnpm build:server:ci",
|
|
139
|
+
"build:server:ci": "tsup \"server/src/**/*.ts\" --config ./server/tsup.config.ts --tsconfig ./server/tsconfig.json && pnpm build:types",
|
|
137
140
|
"build:types": "tsc --project ./server/tsconfig.types.json && tsc-alias --project ./server/tsconfig.types.json",
|
|
138
141
|
"clean": "pnpm clean:client && pnpm clean:server",
|
|
139
142
|
"clean:client": "rimraf ./client/dist",
|
|
@@ -143,9 +146,6 @@
|
|
|
143
146
|
"lint": "eslint . --cache",
|
|
144
147
|
"lint:fix": "eslint . --cache --fix",
|
|
145
148
|
"preview": "vite preview --config ./client/vite.config.ts",
|
|
146
|
-
"reset": "pnpm reset:client && pnpm reset:server",
|
|
147
|
-
"reset:client": "pnpm clean:client && pnpm build:client",
|
|
148
|
-
"reset:server": "pnpm clean:server && pnpm build:server",
|
|
149
149
|
"start": "node server/dist/esm/index.mjs",
|
|
150
150
|
"start:client": "vite preview --config ./client/vite.config.ts",
|
|
151
151
|
"start:server": "node --watch ./server/dist/esm/index.mjs",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var Pe=Object.defineProperty,Re=Object.defineProperties,we=Object.getOwnPropertyDescriptors,te=Object.getOwnPropertySymbols,Ee=Object.prototype.hasOwnProperty,je=Object.prototype.propertyIsEnumerable,ne=(e,t,n)=>t in e?Pe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,j=(e,t)=>{for(var n in t||(t={}))Ee.call(t,n)&&ne(e,n,t[n]);if(te)for(var n of te(t))je.call(t,n)&&ne(e,n,t[n]);return e},A=(e,t)=>Re(e,we(t)),Ae=class extends Error{constructor(e,t,n){super(t||e.toString(),{cause:n}),this.status=e,this.statusText=t,this.error=n}},Ue=async(e,t)=>{var n,r,a,l,u,s;let f=t||{};const i={onRequest:[t==null?void 0:t.onRequest],onResponse:[t==null?void 0:t.onResponse],onSuccess:[t==null?void 0:t.onSuccess],onError:[t==null?void 0:t.onError],onRetry:[t==null?void 0:t.onRetry]};if(!t||!(t!=null&&t.plugins))return{url:e,options:f,hooks:i};for(const c of(t==null?void 0:t.plugins)||[]){if(c.init){const d=await((n=c.init)==null?void 0:n.call(c,e.toString(),t));f=d.options||f,e=d.url}i.onRequest.push((r=c.hooks)==null?void 0:r.onRequest),i.onResponse.push((a=c.hooks)==null?void 0:a.onResponse),i.onSuccess.push((l=c.hooks)==null?void 0:l.onSuccess),i.onError.push((u=c.hooks)==null?void 0:u.onError),i.onRetry.push((s=c.hooks)==null?void 0:s.onRetry)}return{url:e,options:f,hooks:i}},re=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(){return this.options.delay}},ke=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(e){return Math.min(this.options.maxDelay,this.options.baseDelay*2**e)}};function Ne(e){if(typeof e=="number")return new re({type:"linear",attempts:e,delay:1e3});switch(e.type){case"linear":return new re(e);case"exponential":return new ke(e);default:throw new Error("Invalid retry strategy")}}var Me=async e=>{const t={},n=async r=>typeof r=="function"?await r():r;if(e!=null&&e.auth){if(e.auth.type==="Bearer"){const r=await n(e.auth.token);if(!r)return t;t.authorization=`Bearer ${r}`}else if(e.auth.type==="Basic"){const r=n(e.auth.username),a=n(e.auth.password);if(!r||!a)return t;t.authorization=`Basic ${btoa(`${r}:${a}`)}`}else if(e.auth.type==="Custom"){const r=n(e.auth.value);if(!r)return t;t.authorization=`${n(e.auth.prefix)} ${r}`}}return t},qe=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function Le(e){const t=e.headers.get("content-type"),n=new Set(["image/svg","application/xml","application/xhtml","application/html"]);if(!t)return"json";const r=t.split(";").shift()||"";return qe.test(r)?"json":n.has(r)||r.startsWith("text/")?"text":"blob"}function Ie(e){try{return JSON.parse(e),!0}catch{return!1}}function _e(e){if(e===void 0)return!1;const t=typeof e;return t==="string"||t==="number"||t==="boolean"||t===null?!0:t!=="object"?!1:Array.isArray(e)?!0:e.buffer?!1:e.constructor&&e.constructor.name==="Object"||typeof e.toJSON=="function"}function ie(e){try{return JSON.parse(e)}catch{return e}}function ae(e){return typeof e=="function"}function $e(e){if(e!=null&&e.customFetchImpl)return e.customFetchImpl;if(typeof globalThis<"u"&&ae(globalThis.fetch))return globalThis.fetch;if(typeof window<"u"&&ae(window.fetch))return window.fetch;throw new Error("No fetch implementation found")}async function Be(e){const t=new Headers(e==null?void 0:e.headers),n=await Me(e);for(const[r,a]of Object.entries(n||{}))t.set(r,a);if(!t.has("content-type")){const r=Ce(e==null?void 0:e.body);r&&t.set("content-type",r)}return t}function Ce(e){return _e(e)?"application/json":null}function De(e){if(!(e!=null&&e.body))return null;const t=new Headers(e==null?void 0:e.headers);if(_e(e.body)&&!t.has("content-type")){for(const[n,r]of Object.entries(e==null?void 0:e.body))r instanceof Date&&(e.body[n]=r.toISOString());return JSON.stringify(e.body)}return e.body}function Fe(e,t){var n;if(t!=null&&t.method)return t.method.toUpperCase();if(e.startsWith("@")){const r=(n=e.split("@")[1])==null?void 0:n.split("/")[0];return pe.includes(r)?r.toUpperCase():t!=null&&t.body?"POST":"GET"}return t!=null&&t.body?"POST":"GET"}function We(e,t){let n;return!(e!=null&&e.signal)&&(e!=null&&e.timeout)&&(n=setTimeout(()=>t==null?void 0:t.abort(),e==null?void 0:e.timeout)),{abortTimeout:n,clearTimeout:()=>{n&&clearTimeout(n)}}}var He=class be extends Error{constructor(t,n){super(n||JSON.stringify(t,null,2)),this.issues=t,Object.setPrototypeOf(this,be.prototype)}};async function W(e,t){let n=await e["~standard"].validate(t);if(n.issues)throw new He(n.issues);return n.value}var pe=["get","post","put","patch","delete"],Je=e=>({id:"apply-schema",name:"Apply Schema",version:"1.0.0",async init(t,n){var r,a,l,u;const s=((a=(r=e.plugins)==null?void 0:r.find(f=>{var i;return(i=f.schema)!=null&&i.config?t.startsWith(f.schema.config.baseURL||"")||t.startsWith(f.schema.config.prefix||""):!1}))==null?void 0:a.schema)||e.schema;if(s){let f=t;(l=s.config)!=null&&l.prefix&&f.startsWith(s.config.prefix)&&(f=f.replace(s.config.prefix,""),s.config.baseURL&&(t=t.replace(s.config.prefix,s.config.baseURL))),(u=s.config)!=null&&u.baseURL&&f.startsWith(s.config.baseURL)&&(f=f.replace(s.config.baseURL,""));const i=s.schema[f];if(i){let c=A(j({},n),{method:i.method,output:i.output});return n!=null&&n.disableValidation||(c=A(j({},c),{body:i.input?await W(i.input,n==null?void 0:n.body):n==null?void 0:n.body,params:i.params?await W(i.params,n==null?void 0:n.params):n==null?void 0:n.params,query:i.query?await W(i.query,n==null?void 0:n.query):n==null?void 0:n.query})),{url:t,options:c}}}return{url:t,options:n}}}),Ke=e=>{async function t(n,r){const a=A(j(j({},e),r),{plugins:[...(e==null?void 0:e.plugins)||[],Je(e||{})]});if(e!=null&&e.catchAllError)try{return await X(n,a)}catch(l){return{data:null,error:{status:500,statusText:"Fetch Error",message:"Fetch related error. Captured by catchAllError option. See error property for more details.",error:l}}}return await X(n,a)}return t};function Ve(e,t){let{baseURL:n,params:r,query:a}=t||{query:{},params:{},baseURL:""},l=e.startsWith("http")?e.split("/").slice(0,3).join("/"):n||"";if(e.startsWith("@")){const d=e.toString().split("@")[1].split("/")[0];pe.includes(d)&&(e=e.replace(`@${d}/`,"/"))}l.endsWith("/")||(l+="/");let[u,s]=e.replace(l,"").split("?");const f=new URLSearchParams(s);for(const[d,v]of Object.entries(a||{}))v!=null&&f.set(d,String(v));if(r)if(Array.isArray(r)){const d=u.split("/").filter(v=>v.startsWith(":"));for(const[v,T]of d.entries()){const R=r[v];u=u.replace(T,R)}}else for(const[d,v]of Object.entries(r))u=u.replace(`:${d}`,String(v));u=u.split("/").map(encodeURIComponent).join("/"),u.startsWith("/")&&(u=u.slice(1));let i=f.toString();return i=i.length>0?`?${i}`.replace(/\+/g,"%20"):"",l.startsWith("http")?new URL(`${u}${i}`,l):`${l}${u}${i}`}var X=async(e,t)=>{var n,r,a,l,u,s,f,i;const{hooks:c,url:d,options:v}=await Ue(e,t),T=$e(v),R=new AbortController,S=(n=v.signal)!=null?n:R.signal,o=Ve(d,v),p=De(v),g=await Be(v),_=Fe(d,v);let y=A(j({},v),{url:o,headers:g,body:p,method:_,signal:S});for(const P of c.onRequest)if(P){const O=await P(y);O instanceof Object&&(y=O)}("pipeTo"in y&&typeof y.pipeTo=="function"||typeof((r=t==null?void 0:t.body)==null?void 0:r.pipe)=="function")&&("duplex"in y||(y.duplex="half"));const{clearTimeout:b}=We(v,R);let h=await T(y.url,y);b();const w={response:h,request:y};for(const P of c.onResponse)if(P){const O=await P(A(j({},w),{response:(a=t==null?void 0:t.hookOptions)!=null&&a.cloneResponse?h.clone():h}));O instanceof Response?h=O:O instanceof Object&&(h=O.response)}if(h.ok){if(!(y.method!=="HEAD"))return{data:"",error:null};const O=Le(h),U={data:"",response:h,request:y};if(O==="json"||O==="text"){const k=await h.text(),Se=await((l=y.jsonParser)!=null?l:ie)(k);U.data=Se}else U.data=await h[O]();y!=null&&y.output&&y.output&&!y.disableValidation&&(U.data=await W(y.output,U.data));for(const k of c.onSuccess)k&&await k(A(j({},U),{response:(u=t==null?void 0:t.hookOptions)!=null&&u.cloneResponse?h.clone():h}));return t!=null&&t.throw?U.data:{data:U.data,error:null}}const L=(s=t==null?void 0:t.jsonParser)!=null?s:ie,M=await h.text(),m=Ie(M),q=m?await L(M):null,ee={response:h,responseText:M,request:y,error:A(j({},q),{status:h.status,statusText:h.statusText})};for(const P of c.onError)P&&await P(A(j({},ee),{response:(f=t==null?void 0:t.hookOptions)!=null&&f.cloneResponse?h.clone():h}));if(t!=null&&t.retry){const P=Ne(t.retry),O=(i=t.retryAttempt)!=null?i:0;if(await P.shouldAttemptRetry(O,h)){for(const k of c.onRetry)k&&await k(w);const U=P.getDelay(O);return await new Promise(k=>setTimeout(k,U)),await X(e,A(j({},t),{retryAttempt:O+1}))}}if(t!=null&&t.throw)throw new Ae(h.status,h.statusText,m?q:M);return{data:null,error:A(j({},q),{status:h.status,statusText:h.statusText})}},Ge={},Ye={};const H=Object.create(null),I=e=>{var t;return Ge||((t=globalThis.Deno)==null?void 0:t.env.toObject())||globalThis.__env__||(e?H:globalThis)},N=new Proxy(H,{get(e,t){return I()[t]??H[t]},has(e,t){const n=I();return t in n||t in H},set(e,t,n){const r=I(!0);return r[t]=n,!0},deleteProperty(e,t){if(!t)return!1;const n=I(!0);return delete n[t],!0},ownKeys(){const e=I(!0);return Object.keys(e)}});function Qe(e){return e?e!=="false":!1}const Xe=typeof process<"u"&&Ye&&"production"||"";Xe==="test"||Qe(N.TEST);class ze extends Error{constructor(t,n){super(t),this.name="BetterAuthError",this.message=t,this.cause=n,this.stack=""}}function Ze(e){try{return new URL(e).pathname!=="/"}catch{throw new ze(`Invalid base URL: ${e}. Please provide a valid base URL.`)}}function J(e,t="/api/auth"){return Ze(e)?e:(t=t.startsWith("/")?t:`/${t}`,`${e.replace(/\/+$/,"")}${t}`)}function xe(e,t,n){if(e)return J(e,t);const r=N.BETTER_AUTH_URL||N.NEXT_PUBLIC_BETTER_AUTH_URL||N.PUBLIC_BETTER_AUTH_URL||N.NUXT_PUBLIC_BETTER_AUTH_URL||N.NUXT_PUBLIC_AUTH_URL||(N.BASE_URL!=="/"?N.BASE_URL:void 0);if(r)return J(r,t);if(typeof window<"u"&&window.location)return J(window.location.origin,t)}var K={},V={},G={},E={},ue;function Te(){if(ue)return E;ue=1,Object.defineProperty(E,"__esModule",{value:!0}),E.cleanTasks=E.allTasks=E.task=E.startTask=void 0;let e=0,t=[];function n(){return e+=1,()=>{if(e-=1,e===0){let u=t;t=[];for(let s of u)s()}}}E.startTask=n;function r(u){let s=n();return u().finally(s)}E.task=r;function a(){return e===0?Promise.resolve():new Promise(u=>{t.push(u)})}E.allTasks=a;function l(){e=0}return E.cleanTasks=l,E}var se;function et(){return se||(se=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.cleanStores=e.clean=void 0,e.clean=Symbol("clean");let t=(...n)=>{throw new Error("cleanStores() can be used only during development or tests")};e.cleanStores=t}(G)),G}var oe;function Z(){return oe||(oe=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.onMount=e.STORE_UNMOUNT_DELAY=e.onBuild=e.onNotify=e.onSet=e.onStop=e.onStart=void 0;const t=0,n=1,r=2,a=3,l=4,u=5,s=6,f=10;let i=(o,p,g,_)=>(o.events=o.events||{},o.events[g+f]||(o.events[g+f]=_(y=>{o.events[g].reduceRight((b,h)=>(h(b),b),{shared:{},...y})})),o.events[g]=o.events[g]||[],o.events[g].push(p),()=>{let y=o.events[g],b=y.indexOf(p);y.splice(b,1),y.length||(delete o.events[g],o.events[g+f](),delete o.events[g+f])}),c=(o,p)=>i(o,p,t,g=>{let _=o.listen;return o.listen=y=>(!o.lc&&!o.starting&&(o.starting=!0,g(),delete o.starting),_(y)),()=>{o.listen=_}});e.onStart=c;let d=(o,p)=>i(o,p,n,g=>{let _=o.off;return o.off=()=>{g(),_()},()=>{o.off=_}});e.onStop=d;let v=(o,p)=>i(o,p,r,g=>{let _=o.set,y=o.setKey;return o.setKey&&(o.setKey=(b,h)=>{let w;if(g({abort:()=>{w=!0},changed:b,newValue:{...o.value,[b]:h}}),!w)return y(b,h)}),o.set=b=>{let h;if(g({abort:()=>{h=!0},newValue:b}),!h)return _(b)},()=>{o.set=_,o.setKey=y}});e.onSet=v;let T=(o,p)=>i(o,p,a,g=>{let _=o.notify;return o.notify=y=>{let b;if(g({abort:()=>{b=!0},changed:y}),!b)return _(y)},()=>{o.notify=_}});e.onNotify=T;let R=(o,p)=>i(o,p,l,g=>{let _=o.build;return o.build=(...y)=>{let b=_(...y);return g({store:b}),b},()=>{o.build=_}});e.onBuild=R,e.STORE_UNMOUNT_DELAY=1e3;let S=(o,p)=>i(o,_=>{let y=p(_);y&&o.events[s].push(y)},u,_=>{let y=o.listen;o.listen=h=>(!o.lc&&!o.active&&(o.active=!0,_()),y(h));let b=o.off;return o.events[s]=[],o.off=()=>{setTimeout(()=>{if(o.active&&!o.lc){o.active=!1;for(let h of o.events[s])h();o.events[s]=[],b()}},e.STORE_UNMOUNT_DELAY)},()=>{o.listen=y,o.off=b}});e.onMount=S}(V)),V}var Y={},le;function tt(){return le||(le=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.actionFor=e.action=e.lastAction=void 0;const t=Te();e.lastAction=Symbol();let n=(l,u,s,f)=>{let i={...l};i.set=(...d)=>{l[e.lastAction]=u,l.set(...d),delete l[e.lastAction]},l.setKey&&(i.setKey=(...d)=>{l[e.lastAction]=u,l.setKey(...d),delete l[e.lastAction]});let c=s(i,...f);if(c instanceof Promise){let d=(0,t.startTask)();return c.finally(d)}return c},r=(l,u,s)=>(...f)=>n(l,u,s,f);e.action=r;let a=(l,u,s)=>(f,...i)=>n(f,u,s,i);e.actionFor=a}(Y)),Y}var $={},B={},Q={},ce;function x(){return ce||(ce=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.atom=e.notifyId=void 0;let t=[];e.notifyId=0;let n=r=>{let a,l=[],u={lc:0,value:r,set(s){u.value=s,u.notify()},get(){return u.lc||u.listen(()=>{})(),u.value},notify(s){a=l;let f=!t.length;for(let i=0;i<a.length;i++)t.push(a[i],u.value,s);if(f){e.notifyId++;for(let i=0;i<t.length;i+=3)t[i](t[i+1],t[i+2]);t.length=0}},listen(s){return l===a&&(l=l.slice()),u.lc=l.push(s),()=>{l===a&&(l=l.slice());let f=l.indexOf(s);~f&&(l.splice(f,1),u.lc--,u.lc||u.off())}},subscribe(s){let f=u.listen(s);return s(u.value),f},off(){}};return u};e.atom=n}(Q)),Q}var fe;function Oe(){if(fe)return B;fe=1,Object.defineProperty(B,"__esModule",{value:!0}),B.map=void 0;const e=x();let t=(n={})=>{let r=(0,e.atom)(n);return r.setKey=function(a,l){typeof l>"u"?a in r.value&&(r.value={...r.value},delete r.value[a],r.notify(a)):r.value[a]!==l&&(r.value={...r.value,[a]:l},r.notify(a))},r};return B.map=t,B}var de;function nt(){if(de)return $;de=1,Object.defineProperty($,"__esModule",{value:!0}),$.mapTemplate=void 0;const e=Z(),t=Oe();function n(r){let a=(l,...u)=>(a.cache[l]||(a.cache[l]=a.build(l,...u)),a.cache[l]);return a.build=(l,...u)=>{let s=(0,t.map)({id:l});return(0,e.onMount)(s,()=>{let f;return r&&(f=r(s,l,...u)),()=>{delete a.cache[l],f&&f()}}),s},a.cache={},a}return $.mapTemplate=n,$}var C={},ye;function rt(){if(ye)return C;ye=1,Object.defineProperty(C,"__esModule",{value:!0}),C.listenKeys=void 0;function e(t,n,r){let a=new Set([...n,void 0]);return t.listen((l,u)=>{a.has(u)&&r(l,u)})}return C.listenKeys=e,C}var D={},he;function it(){if(he)return D;he=1,Object.defineProperty(D,"__esModule",{value:!0}),D.keepMount=void 0;let e=t=>{t.listen(()=>{})};return D.keepMount=e,D}var F={},me;function at(){if(me)return F;me=1,Object.defineProperty(F,"__esModule",{value:!0}),F.computed=void 0;const e=Z(),t=x();let n=(r,a)=>{Array.isArray(r)||(r=[r]);let l,u=[],s=()=>{let i=r.map(c=>c.get());(l!==t.notifyId||i.some((c,d)=>c!==u[d]))&&(l=t.notifyId,u=i,f.set(a(...i)))},f=(0,t.atom)();return(0,e.onMount)(f,()=>{let i=r.map(c=>c.listen(s,a));return s(),()=>{for(let c of i)c()}}),f};return F.computed=n,F}var ve;function ut(){return ve||(ve=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.map=e.atom=e.computed=e.keepMount=e.listenKeys=e.mapTemplate=e.cleanStores=e.clean=e.lastAction=e.actionFor=e.action=e.task=e.allTasks=e.startTask=e.cleanTasks=e.onSet=e.onStop=e.onBuild=e.onMount=e.onStart=e.onNotify=e.STORE_UNMOUNT_DELAY=void 0;var t=Z();Object.defineProperty(e,"STORE_UNMOUNT_DELAY",{enumerable:!0,get:function(){return t.STORE_UNMOUNT_DELAY}}),Object.defineProperty(e,"onNotify",{enumerable:!0,get:function(){return t.onNotify}}),Object.defineProperty(e,"onStart",{enumerable:!0,get:function(){return t.onStart}}),Object.defineProperty(e,"onMount",{enumerable:!0,get:function(){return t.onMount}}),Object.defineProperty(e,"onBuild",{enumerable:!0,get:function(){return t.onBuild}}),Object.defineProperty(e,"onStop",{enumerable:!0,get:function(){return t.onStop}}),Object.defineProperty(e,"onSet",{enumerable:!0,get:function(){return t.onSet}});var n=Te();Object.defineProperty(e,"cleanTasks",{enumerable:!0,get:function(){return n.cleanTasks}}),Object.defineProperty(e,"startTask",{enumerable:!0,get:function(){return n.startTask}}),Object.defineProperty(e,"allTasks",{enumerable:!0,get:function(){return n.allTasks}}),Object.defineProperty(e,"task",{enumerable:!0,get:function(){return n.task}});var r=tt();Object.defineProperty(e,"action",{enumerable:!0,get:function(){return r.action}}),Object.defineProperty(e,"actionFor",{enumerable:!0,get:function(){return r.actionFor}}),Object.defineProperty(e,"lastAction",{enumerable:!0,get:function(){return r.lastAction}});var a=et();Object.defineProperty(e,"clean",{enumerable:!0,get:function(){return a.clean}}),Object.defineProperty(e,"cleanStores",{enumerable:!0,get:function(){return a.cleanStores}});var l=nt();Object.defineProperty(e,"mapTemplate",{enumerable:!0,get:function(){return l.mapTemplate}});var u=rt();Object.defineProperty(e,"listenKeys",{enumerable:!0,get:function(){return u.listenKeys}});var s=it();Object.defineProperty(e,"keepMount",{enumerable:!0,get:function(){return s.keepMount}});var f=at();Object.defineProperty(e,"computed",{enumerable:!0,get:function(){return f.computed}});var i=x();Object.defineProperty(e,"atom",{enumerable:!0,get:function(){return i.atom}});var c=Oe();Object.defineProperty(e,"map",{enumerable:!0,get:function(){return c.map}})}(K)),K}var z=ut();const st=typeof window>"u",ot=(e,t,n,r)=>{const a=z.atom({data:null,error:null,isPending:!0,isRefetching:!1,refetch:()=>l()}),l=()=>{const s=typeof r=="function"?r({data:a.get().data,error:a.get().error,isPending:a.get().isPending}):r;return n(t,{...s,async onSuccess(f){var i;a.set({data:f.data,error:null,isPending:!1,isRefetching:!1,refetch:a.value.refetch}),await((i=s==null?void 0:s.onSuccess)==null?void 0:i.call(s,f))},async onError(f){var v,T;const{request:i}=f,c=typeof i.retry=="number"?i.retry:(v=i.retry)==null?void 0:v.attempts,d=i.retryAttempt||0;c&&d<c||(a.set({error:f.error,data:null,isPending:!1,isRefetching:!1,refetch:a.value.refetch}),await((T=s==null?void 0:s.onError)==null?void 0:T.call(s,f)))},async onRequest(f){var c;const i=a.get();a.set({isPending:i.data===null,data:i.data,error:null,isRefetching:!0,refetch:a.value.refetch}),await((c=s==null?void 0:s.onRequest)==null?void 0:c.call(s,f))}})};e=Array.isArray(e)?e:[e];let u=!1;for(const s of e)s.subscribe(()=>{st||(u?l():z.onMount(a,()=>(setTimeout(()=>{l()},0),u=!0,()=>{a.off(),s.off()})))});return a},lt={proto:/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,constructor:/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,protoShort:/"__proto__"\s*:/,constructorShort:/"constructor"\s*:/},ct=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/,ge={true:!0,false:!1,null:null,undefined:void 0,nan:Number.NaN,infinity:Number.POSITIVE_INFINITY,"-infinity":Number.NEGATIVE_INFINITY},ft=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/;function dt(e){return e instanceof Date&&!isNaN(e.getTime())}function yt(e){const t=ft.exec(e);if(!t)return null;const[,n,r,a,l,u,s,f,i,c,d]=t;let v=new Date(Date.UTC(parseInt(n,10),parseInt(r,10)-1,parseInt(a,10),parseInt(l,10),parseInt(u,10),parseInt(s,10),f?parseInt(f.padEnd(3,"0"),10):0));if(i){const T=(parseInt(c,10)*60+parseInt(d,10))*(i==="+"?-1:1);v.setUTCMinutes(v.getUTCMinutes()+T)}return dt(v)?v:null}function ht(e,t={}){const{strict:n=!1,warnings:r=!1,reviver:a,parseDates:l=!0}=t;if(typeof e!="string")return e;const u=e.trim();if(u[0]==='"'&&u.endsWith('"')&&!u.slice(1,-1).includes('"'))return u.slice(1,-1);const s=u.toLowerCase();if(s.length<=9&&s in ge)return ge[s];if(!ct.test(u)){if(n)throw new SyntaxError("[better-json] Invalid JSON");return e}if(Object.entries(lt).some(([i,c])=>{const d=c.test(u);return d&&r&&console.warn(`[better-json] Detected potential prototype pollution attempt using ${i} pattern`),d})&&n)throw new Error("[better-json] Potential prototype pollution attempt detected");try{return JSON.parse(u,(c,d)=>{if(c==="__proto__"||c==="constructor"&&d&&typeof d=="object"&&"prototype"in d){r&&console.warn(`[better-json] Dropping "${c}" key to prevent prototype pollution`);return}if(l&&typeof d=="string"){const v=yt(d);if(v)return v}return a?a(c,d):d})}catch(i){if(n)throw i;return e}}function mt(e,t={strict:!0}){return ht(e,t)}const vt={id:"redirect",name:"Redirect",hooks:{onSuccess(e){var t,n;if((t=e.data)!=null&&t.url&&((n=e.data)!=null&&n.redirect)&&typeof window<"u"&&window.location&&window.location)try{window.location.href=e.data.url}catch{}}}};function gt(e){const t=z.atom(!1);return{session:ot(t,"/get-session",e,{method:"GET"}),$sessionSignal:t}}const _t=e=>{var _,y,b,h,w,L,M;const t="credentials"in Request.prototype,n=xe(e==null?void 0:e.baseURL,e==null?void 0:e.basePath),r=((_=e==null?void 0:e.plugins)==null?void 0:_.flatMap(m=>m.fetchPlugins).filter(m=>m!==void 0))||[],a={id:"lifecycle-hooks",name:"lifecycle-hooks",hooks:{onSuccess:(y=e==null?void 0:e.fetchOptions)==null?void 0:y.onSuccess,onError:(b=e==null?void 0:e.fetchOptions)==null?void 0:b.onError,onRequest:(h=e==null?void 0:e.fetchOptions)==null?void 0:h.onRequest,onResponse:(w=e==null?void 0:e.fetchOptions)==null?void 0:w.onResponse}},{onSuccess:l,onError:u,onRequest:s,onResponse:f,...i}=(e==null?void 0:e.fetchOptions)||{},c=Ke({baseURL:n,...t?{credentials:"include"}:{},method:"GET",jsonParser(m){return m?mt(m,{strict:!1}):null},customFetchImpl:async(m,q)=>{try{return await fetch(m,q)}catch{return Response.error()}},...i,plugins:[a,...i.plugins||[],...e!=null&&e.disableDefaultFetchPlugins?[]:[vt],...r]}),{$sessionSignal:d,session:v}=gt(c),T=(e==null?void 0:e.plugins)||[];let R={},S={$sessionSignal:d,session:v},o={"/sign-out":"POST","/revoke-sessions":"POST","/revoke-other-sessions":"POST","/delete-user":"POST"};const p=[{signal:"$sessionSignal",matcher(m){return m==="/sign-out"||m==="/update-user"||m.startsWith("/sign-in")||m.startsWith("/sign-up")||m==="/delete-user"||m==="/verify-email"}}];for(const m of T)m.getAtoms&&Object.assign(S,(L=m.getAtoms)==null?void 0:L.call(m,c)),m.pathMethods&&Object.assign(o,m.pathMethods),m.atomListeners&&p.push(...m.atomListeners);const g={notify:m=>{S[m].set(!S[m].get())},listen:(m,q)=>{S[m].subscribe(q)},atoms:S};for(const m of T)m.getActions&&Object.assign(R,(M=m.getActions)==null?void 0:M.call(m,c,g,e));return{pluginsActions:R,pluginsAtoms:S,pluginPathMethods:o,atomListeners:p,$fetch:c,$store:g}};function bt(e,t,n){const r=t[e],{fetchOptions:a,query:l,...u}=n||{};return r||(a!=null&&a.method?a.method:u&&Object.keys(u).length>0?"POST":"GET")}function pt(e,t,n,r,a){function l(u=[]){return new Proxy(function(){},{get(s,f){const i=[...u,f];let c=e;for(const d of i)if(c&&typeof c=="object"&&d in c)c=c[d];else{c=void 0;break}return typeof c=="function"?c:l(i)},apply:async(s,f,i)=>{const c="/"+u.map(g=>g.replace(/[A-Z]/g,_=>`-${_.toLowerCase()}`)).join("/"),d=i[0]||{},v=i[1]||{},{query:T,fetchOptions:R,...S}=d,o={...v,...R},p=bt(c,n,d);return await t(c,{...o,body:p==="GET"?void 0:{...S,...(o==null?void 0:o.body)||{}},query:T||(o==null?void 0:o.query),method:p,async onSuccess(g){var h;await((h=o==null?void 0:o.onSuccess)==null?void 0:h.call(o,g));const _=a==null?void 0:a.find(w=>w.matcher(c));if(!_)return;const y=r[_.signal];if(!y)return;const b=y.get();setTimeout(()=>{y.set(!b)},10)}})}})}return l()}function Tt(e){return e.charAt(0).toUpperCase()+e.slice(1)}function St(e){const{pluginPathMethods:t,pluginsActions:n,pluginsAtoms:r,$fetch:a,atomListeners:l,$store:u}=_t(e);let s={};for(const[c,d]of Object.entries(r))s[`use${Tt(c)}`]=d;const f={...n,...s,$fetch:a,$store:u};return pt(f,a,t,r,l)}export{St as createAuthClient,ot as useAuthQuery};
|