@flexkit/studio 0.2.11 → 0.2.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/dist/activity-nav-button-RDL5GIWG.js +2 -0
  2. package/dist/{activity-nav-button-LZESIQL2.js.map → activity-nav-button-RDL5GIWG.js.map} +1 -1
  3. package/dist/astro.js +1 -1
  4. package/dist/{chat-page-3YSJP7FC.js → chat-page-B2IOPTUP.js} +3 -3
  5. package/dist/{chat-page-3YSJP7FC.js.map → chat-page-B2IOPTUP.js.map} +1 -1
  6. package/dist/chunk-APVKB4FT.js +2 -0
  7. package/dist/chunk-APVKB4FT.js.map +1 -0
  8. package/dist/{chunk-7JSGAY3E.js → chunk-C5Y6OZFR.js} +2 -2
  9. package/dist/{chunk-7JSGAY3E.js.map → chunk-C5Y6OZFR.js.map} +1 -1
  10. package/dist/chunk-CAZ6EUR2.js +2 -0
  11. package/dist/chunk-CAZ6EUR2.js.map +1 -0
  12. package/dist/{chunk-YSMRXGVX.js → chunk-CJGP4Y5Y.js} +2 -2
  13. package/dist/{chunk-YSMRXGVX.js.map → chunk-CJGP4Y5Y.js.map} +1 -1
  14. package/dist/{chunk-TPLL535V.js → chunk-CWJWOJRO.js} +3 -3
  15. package/dist/{chunk-TPLL535V.js.map → chunk-CWJWOJRO.js.map} +1 -1
  16. package/dist/{chunk-2AVINVYN.js → chunk-DJPVRAFE.js} +22 -20
  17. package/dist/{chunk-YODWX4WT.js → chunk-ETQ3Q472.js} +2 -2
  18. package/dist/{chunk-YODWX4WT.js.map → chunk-ETQ3Q472.js.map} +1 -1
  19. package/dist/{chunk-GDTOP4MU.js → chunk-KNESQOI5.js} +3 -3
  20. package/dist/{chunk-GDTOP4MU.js.map → chunk-KNESQOI5.js.map} +1 -1
  21. package/dist/chunk-N53TGGN5.js +8 -0
  22. package/dist/chunk-N53TGGN5.js.map +1 -0
  23. package/dist/chunk-TOY7ZRK2.js +384 -0
  24. package/dist/chunk-TOY7ZRK2.js.map +1 -0
  25. package/dist/{chunk-22DXYOXX.js → chunk-VPTDAFFZ.js} +2 -2
  26. package/dist/{chunk-22DXYOXX.js.map → chunk-VPTDAFFZ.js.map} +1 -1
  27. package/dist/chunk-XDLTO6VU.js +3 -0
  28. package/dist/chunk-XDLTO6VU.js.map +1 -0
  29. package/dist/chunk-ZLWYVTGO.js +2 -0
  30. package/dist/chunk-ZLWYVTGO.js.map +1 -0
  31. package/dist/electron.d.ts +103 -0
  32. package/dist/electron.js +131 -0
  33. package/dist/index.css +9 -0
  34. package/dist/index.d.ts +31 -1
  35. package/dist/index.js +9 -9
  36. package/dist/index.js.map +1 -1
  37. package/dist/list-4NZLZRX3.js +2 -0
  38. package/dist/{list-N5WCJSJC.js.map → list-4NZLZRX3.js.map} +1 -1
  39. package/dist/nextjs.js +1 -1
  40. package/dist/{pages-65QNO7ME.js → pages-7MFZAVLV.js} +4 -4
  41. package/dist/{pages-65QNO7ME.js.map → pages-7MFZAVLV.js.map} +1 -1
  42. package/dist/{plugin-pages-F5K745MZ.js → plugin-pages-RNB46YPQ.js} +2 -2
  43. package/dist/{plugin-pages-F5K745MZ.js.map → plugin-pages-RNB46YPQ.js.map} +1 -1
  44. package/dist/{root-4E3YUTQU.js → root-4XPMKRHZ.js} +5 -5
  45. package/dist/{root-4E3YUTQU.js.map → root-4XPMKRHZ.js.map} +1 -1
  46. package/dist/{root-WYRLSQPK.js → root-5RDJ2HAV.js} +2 -2
  47. package/dist/{root-WYRLSQPK.js.map → root-5RDJ2HAV.js.map} +1 -1
  48. package/dist/root-NCLIQPJA.js +23 -0
  49. package/dist/root-NCLIQPJA.js.map +1 -0
  50. package/dist/root-OHZDY47O.js +2 -0
  51. package/dist/{root-DK5C7DYH.js.map → root-OHZDY47O.js.map} +1 -1
  52. package/dist/{search-EK4XBDGL.js → search-OWF3LEWH.js} +2 -2
  53. package/dist/{search-EK4XBDGL.js.map → search-OWF3LEWH.js.map} +1 -1
  54. package/dist/{skills-pages-O35YZMMC.js → skills-pages-VCXZFQFD.js} +2 -2
  55. package/dist/{skills-pages-O35YZMMC.js.map → skills-pages-VCXZFQFD.js.map} +1 -1
  56. package/dist/tanstack-start.js +1 -1
  57. package/package.json +12 -8
  58. package/dist/activity-nav-button-LZESIQL2.js +0 -2
  59. package/dist/chunk-ACS3TGGP.js +0 -2
  60. package/dist/chunk-ACS3TGGP.js.map +0 -1
  61. package/dist/chunk-B4WSTNZ3.js +0 -8
  62. package/dist/chunk-B4WSTNZ3.js.map +0 -1
  63. package/dist/chunk-HYSTMQD7.js +0 -2
  64. package/dist/chunk-HYSTMQD7.js.map +0 -1
  65. package/dist/chunk-OI6GA6PE.js +0 -384
  66. package/dist/chunk-OI6GA6PE.js.map +0 -1
  67. package/dist/list-N5WCJSJC.js +0 -2
  68. package/dist/root-DK5C7DYH.js +0 -2
  69. package/dist/root-MMAJEVBH.js +0 -23
  70. package/dist/root-MMAJEVBH.js.map +0 -1
@@ -0,0 +1,384 @@
1
+ import'./index.css';import {e}from'./chunk-P6BZ4QP7.js';import {b as b$1}from'./chunk-CAZ6EUR2.js';import {b as b$3}from'./chunk-2DXR5NJV.js';import {b,f,c}from'./chunk-CWJWOJRO.js';import {h as h$1,c as c$3}from'./chunk-TYDYAOQ7.js';import {Rc,Sc,Tc,_,$,ca,da,aa,ea as ea$1,o}from'./chunk-YCCFUGWJ.js';import {c as c$2,h as h$2,i,k,l,b as b$5}from'./chunk-32ZU4MLE.js';import {e as e$1,g,h,j}from'./chunk-SZEGGBOC.js';import {a,b as b$4,c as c$1,d,e as e$2}from'./chunk-USNXQOMJ.js';import {b as b$2}from'./chunk-6NRQMG26.js';import {a as a$1}from'./chunk-O2QMYUPS.js';import {find,propEq,omit,pick,toPairs,uniq,uniqBy,prop,props}from'ramda';import {gql,NetworkStatus,ApolloClient,InMemoryCache,defaultDataIdFromObject,from,HttpLink}from'@apollo/client';import {ApolloProvider,useQuery,useMutation}from'@apollo/client/react';import {ErrorLink}from'@apollo/client/link/error';import {ServerError,CombinedGraphQLErrors,CombinedProtocolErrors}from'@apollo/client/errors';import {createContext,useContext,useState,useMemo,useRef,useEffect,useCallback,useReducer}from'react';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {AlertCircle,X as X$1,ChevronDown,ArrowUp,ArrowDown,Star,CircleCheck,CircleX,Check,Copy}from'lucide-react';import {useReactTable,getSortedRowModel,getPaginationRowModel,getFilteredRowModel,getCoreRowModel,flexRender}from'@tanstack/react-table';import {useVirtualizer}from'@tanstack/react-virtual';import {getText,getSchema,getTextSerializersFromSchema}from'@tiptap/core';import {Node}from'@tiptap/pm/model';import {TiptapLink,TiptapImage,UploadImagesPlugin,TaskList,TaskItem,HorizontalRule,StarterKit,CodeBlockLowlight,Youtube,Twitter,Mathematics,CharacterCount,Placeholder,AIHighlight,TiptapUnderline,HighlightExtension,TextStyle,Color,CustomKeymap,GlobalDragHandle}from'novel';import {Markdown}from'tiptap-markdown';import {cx}from'class-variance-authority';import {createLowlight,common}from'lowlight';import {defaultStyles,FileIcon}from'react-file-icon';import {isValid,format}from'date-fns';function R(e){return e.dataType==="asset"?"global":e.scope}var un=25,Er=3,cn=3,Tr=["id","string"],wr=["date","datetime","duration","time"],kt=`_id
2
+ originalFilename
3
+ mimeType
4
+ path
5
+ url
6
+ size
7
+ height
8
+ width
9
+ lqip`,bt=`_id
10
+ originalFilename
11
+ mimeType
12
+ path
13
+ url
14
+ size
15
+ height
16
+ width`,$r=`_id
17
+ path
18
+ url`;function Ie(e){return e?R(e)==="relationship"&&e.relationship?.mode==="multiple"&&e.relationship.entity==="_asset":false}function St(e,t){return !e||!Ie(e)?false:t?.name!==c.name||e.name!=="assets"}function tt(e){return e?.dataType==="asset"||e?.inputType==="asset"}function dn(e){let t=e,n=t?.edges??[],r=t?.aggregate?.count?.nodes??n.length;return n.reduce((o,i,s)=>(i.node&&o.push({...i.node,sortOrder:i.properties?.sortOrder??s,totalCount:r}),o),[]).sort((o,i)=>(o.sortOrder??Number.MAX_SAFE_INTEGER)-(i.sortOrder??Number.MAX_SAFE_INTEGER))}function Cr(e){return e.reduce((t,n,r)=>n._id?{...t,[n._id]:n.sortOrder??r}:t,{})}function le(e){return Array.isArray(e)?e[0]??null:e??null}function xr(e,t){return t?$r:e?kt:bt}function fn(e,t=true,n=true,r=un,o=false){let i=t?` properties {
19
+ sortOrder
20
+ }
21
+ `:"",s=xr(n,o),u=t?`(first: ${r}, sort: [{ edge: { sortOrder: ASC } }])`:`(first: ${r})`;return ` ${e}Connection${u} {
22
+ aggregate {
23
+ count {
24
+ nodes
25
+ }
26
+ }
27
+ edges {
28
+ `+i+` node {
29
+ ${s}
30
+ }
31
+ }
32
+ }
33
+ `}function pn(e){return e?.aggregate?.count?.nodes??0}function mn(e,t){let n=e[`${t}Total`];return typeof n=="number"?n:pn(e[`${t}Connection`])}function At(e,t=""){return ` ${e}Connection${t} {
34
+ aggregate {
35
+ count {
36
+ nodes
37
+ }
38
+ }
39
+ }
40
+ `}function vr(e,t,n){return t?n==="total"?` ${e}Total
41
+ `:At(e,"(where: $where)"):""}function Rr(e,t,n,r=false){if(!e)return "";let o=t==="default"?"":`${t}
42
+ `;if(tt(e))return r?` ${e.name} {
43
+ _id
44
+ path
45
+ url
46
+ }
47
+ `:` ${e.name} {
48
+ ${kt}
49
+ }
50
+ `;if(R(e)==="local")return ` ${e.name} {
51
+ _id
52
+ default
53
+ ${o}}
54
+ `;if(R(e)==="relationship"){let i=e.relationship?.field;if(!i)return ` ${e.name}
55
+ `;let s=find(propEq(e.relationship?.entity,"name"))(n),u=find(propEq(i,"name"))(s?.attributes??[]),a=u&&R(u)==="local"?`{
56
+ _id
57
+ default
58
+ ${o}}
59
+ `:"";return e.relationship?.mode==="single"?` ${e.name} {
60
+ ${i} ${a}}
61
+ `:` ${e.name} (limit: 3, offset: 0) {
62
+ ${i} ${a}}
63
+ `}return ` ${e.name}
64
+ `}function _r(e,t,n){return e?.attributes.reduce((r,o)=>{let i=t==="default"?"":`${t}
65
+ `;if(tt(o))return `${r}
66
+ ${o.name} {
67
+ ${bt}
68
+ }
69
+ `;if(R(o)==="local")return `${r}
70
+ ${o.name} {
71
+ _id
72
+ default
73
+ ${i}
74
+ }
75
+ `;if(R(o)==="relationship"){let s=find(propEq(o.relationship?.entity,"name"))(n),u=find(propEq(o.relationship?.field,"name"))(s?.attributes??[]),a=R(u)==="local"?`{
76
+ _id
77
+ default
78
+ ${i}}
79
+ `:"";if(o.relationship?.mode==="single")return `${r}
80
+ ${o.name} {
81
+ ${o.relationship.field} ${a}}
82
+ `;if(o.relationship?.field)return `${r}
83
+ ${o.name} (limit: ${cn}, offset: 0) {
84
+ ${o.relationship.field} ${a}}
85
+ `}return `${r}
86
+ ${o.name}
87
+ `},"")??""}function Lr(e){let t={};for(let n of e)t[n.name]=n;return t}function ht(e){return e?e.name==="url"?true:!(e.hidden===true||e.name==="lqip"):false}function ms(e,t){if(!Array.isArray(e)||e.length===0)return;let[n]=e;if(!n||typeof n!="object")return;let[r]=Object.keys(n);if(!r||["_id","_createdAt","_updatedAt"].includes(r))return;let o=t?.attributes.find(i=>i.name===r);if(!(!o||R(o)!=="global"||o.dataType==="asset"))return {NOT:{[r]:{eq:null}}}}function nt(e$1,t,n,r){let o=r?.selection??"full",i=o==="display"?"list":o,s=r?.includeCount??true,u=r?.countMode??"aggregate",a="(where: $where, limit: $limit, offset: $offset, sort: $sort)",l=re(n,e$1),d=l?.name??e$1,p=e(l),f=o==="display"?p?[p]:[]:l?.attributes??[],c=Lr(f),y=`$where: ${d}Where, $limit: Int, $offset: Int, $sort: [${d}Sort!]`,k=r?.operationName??`Get${J(e$1)}`;if(!l)throw new Error(`Entity '${d}' not found in the schema`);if(f.length===0)throw new Error(`Entity '${d}' has no attributes defined in the schema`);let S=D("global",f).filter(A=>A==="_updatedAt"?false:i==="list"?o==="display"||ht(c[A]):true).join(`
88
+ `),g=Fe(f).filter(A=>i!=="list"||o==="display"||ht(c[A])),h=D(["local"],f).filter(A=>i!=="list"?true:o==="display"||ht(c[A])),b=h.reduce((A,w)=>`${A}
89
+ ${w} {
90
+ _id
91
+ default
92
+ }
93
+ `,""),v=h.reduce((A,w)=>`${A}
94
+ ${w} {
95
+ _id
96
+ default
97
+ ${t}
98
+ }
99
+ `,""),L=t==="default"?b:v,T=`_id
100
+ path
101
+ url`;i!=="list"&&(T=`_id
102
+ originalFilename
103
+ mimeType
104
+ path
105
+ url
106
+ size
107
+ height
108
+ width
109
+ lqip`);let U=g.reduce((A,w)=>`${A}
110
+ ${w} {
111
+ ${T}
112
+ }
113
+ `,""),K=f.filter(A=>R(A)==="relationship").reduce((A,w)=>{if(i==="list"&&o!=="display"&&w.hidden===true)return A;if(Ie(w))return `${A}
114
+ ${fn(w.name,St(w,l),i!=="list",i==="list"?Er:un,i==="list")}`;let q=find(propEq(w.relationship?.entity,"name"))(n);if(i==="list"){let G=e(q),Y=Rr(G,t,n,true),me=w.relationship?.mode==="single"?1:3;return `${A}
115
+ ${w.name} (limit: ${me}, offset: 0) {
116
+ _id
117
+ ${Y} }
118
+ `}let B=_r(q,t,n);return `${At(w.name).trim()}${A}
119
+ ${w.name} (limit: 25, offset: 0) { _id ${B}}
120
+ `},"");return {queryEntityName:e$1,query:`query ${k}(${y}) {
121
+ `+vr(e$1,s,u)+` ${e$1}${a} {
122
+ _id
123
+ _updatedAt
124
+ ${S} ${L} ${U} ${K}}
125
+ }
126
+ `}}function gn(e$1,t,n,r){let i=re(r,e$1)?.attributes??[];if(i.length===0)return {count:0,results:[]};let s=mn(n,e$1),u=n[e$1],a=(d,p)=>{let f=p.name;return d.slice(0,3).map(c=>{if(R(p)!=="local")return c[f];let y=le(c[f]);return y?.[t]??y?.default}).join(", ")},l=u.map(d=>{let{_id:p}=d,f=typeof d._updatedAt=="string"?d._updatedAt:"",c=D("global",i).filter(g=>g!=="_updatedAt").reduce((g,h)=>({...g,[h]:d[h]}),{}),y=D("local",i).reduce((g,h)=>{let b=le(d[h]);return {...g,[h]:b?.[t]?b[t]:b?.default}},{}),k=Fe(i).reduce((g,h)=>({...g,[h]:le(d[h])}),{}),S=D(["relationship"],i).reduce((g,h)=>{let b=find(propEq(h,"name"))(i),v=b.relationship?.entity??"",L=find(propEq(v,"name"))(r),T=e(L),U=d[h];if(Ie(b)){let q=dn(d[`${h}Connection`]);return {...g,[h]:q}}if(!T)throw new Error(`There is an error in the schema for the relationship attribute "${h}"`);let se=T.name,K=R(T);if(b.relationship?.mode==="multiple"){let q=Array.isArray(U)?U:[];return {...g,[h]:a(q,T)}}let A=le(U);if(K==="global")return {...g,[h]:A?.[se]};let w=le(A?.[se]);return {...g,[h]:w?.[t]??w?.default}},{});return {_id:p,...c,...y,...k,...S,_updatedAt:f}});return {count:s,results:l}}function hn(e,t,n,r){let i=re(r,e)?.attributes??[];if(i.length===0)return {count:0,results:[]};let s=mn(n,e),a=n[e].map(l=>{let d=D("global",i).reduce((y,k)=>({...y,[k]:{value:l[k],disabled:false,scope:"default",_id:""}}),{}),p=D("local",i).reduce((y,k)=>{let S=find(propEq(k,"name"))(i),g=le(l[k]);return {...y,[k]:{value:g?Mr(g,t):null,disabled:!!(g&&g[t]===null&&R(S)==="local"&&t!=="default"),scope:t,_id:g?g._id:null}}},{}),f=Fe(i).reduce((y,k)=>({...y,[k]:{value:le(l[k]),disabled:false,scope:"default",_id:""}}),{}),c=D(["relationship"],i).reduce((y,k)=>{let S=find(propEq(k,"name"))(i),g=l[k],h=S.relationship?.mode==="single"?le(g):g,b=h?._id,v=pn(l[`${k}Connection`]);if(Ie(S)){let L=dn(l[`${k}Connection`]);return {...y,[k]:{count:v,_id:b,knownAssetSortOrders:Cr(L),value:L,disabled:false,scope:t}}}return {...y,[k]:{count:v,_id:b,value:h,disabled:false,scope:t}}},{});return {...d,...p,...f,...c}});return {count:s,results:a}}function Mr(e,t){return Array.isArray(e)?e.reduce((n,r)=>{if(r[t]??r.default){let o={_id:r._id,disabled:r.scope===null&&t!=="default",scope:t,value:r[t]??r.default};n.push(o);}return n},[]):e[t]??e.default??null}function gs(e,t,n,r,o,i,s){let u=re(r,e),a=u?.name??e,l=u?.attributes??[],d=Oe(e);if(l.length===0)return "";let p=yn(l,i),f=kn(l,p),c=Fr(t,l,p,n),y=Dr(l,o,p),k=Or(l,o,p),S=e,g=s?.responseFields??Sn(r,e,n);return `mutation ${`Update${J(e)}`}($where: ${a}Where) {
127
+ update${d}(
128
+ where: $where
129
+ update: {${f}${c}${y}${k}
130
+ }
131
+ ) {
132
+ ${S} {
133
+ _id
134
+ ${g} }
135
+ }
136
+ }
137
+ `}function yn(e,t){let n=e.filter(o=>o.readOnly===true).map(o=>o.name),r=omit(n,t);return pick(e.map(o=>o.name),r)}function D(e,t){return Array.isArray(e)?e.reduce((r,o)=>r.concat(D(o,t)),[]):t.filter(r=>R(r)===e&&r.inputType!=="asset").map(r=>r.name)}function Fe(e){return e.filter(tt).map(n=>n.name)}function kn(e,t,n="update"){let r=pick(D("global",e),t);return toPairs(r).reduce((i,[s,u])=>{let a=find(propEq(s,"name"))(e),l=Array.isArray(u?.value)?null:u?.value??null,d=Et(a.dataType,l);return n==="create"&&(d===null||d==="")?i:n==="update"?`${i}
138
+ ${s}: { set: ${d} }`:`${i}
139
+ ${s}: ${d}`},"")}function yt(e){return !e?._id||!e.path?"":e._id}function Dr(e,t,n){let r=pick(Fe(e),n);return toPairs(r).reduce((s,[u,a])=>{let l=yt(a.value),d=yt(t[u]?.value);if(l===d)return s;let p=d?` {
140
+ disconnect: [{
141
+ where: {
142
+ node: {
143
+ _id: { eq: ${M(d)} }
144
+ }
145
+ }
146
+ }]
147
+ }
148
+ `:"",f=l?` {
149
+ connect: [{
150
+ where: {
151
+ node: {
152
+ _id: { eq: ${M(l)} }
153
+ }
154
+ }
155
+ }]
156
+ }
157
+ `:"";return `${s}
158
+ ${u}: [
159
+ ${p}${f} ]`},"")}function Ir(e,t){let n=pick(Fe(e),t);return toPairs(n).reduce((i,[s,u])=>{let a=yt(u.value);return a?`${i}
160
+ ${s}: {
161
+ connect: [{
162
+ where: {
163
+ node: {
164
+ _id: { eq: ${M(a)} }
165
+ }
166
+ }
167
+ }]
168
+ }`:i},"")}function Fr(e,t,n,r){let o=pick(D("local",t),n);return toPairs(o).reduce((u,[a,l])=>{let d=find(propEq(a,"name"))(t),{dataType:p}=d,f=l.disabled||Array.isArray(l.value)?"null":Et(p,l.value);return l._id?`${u}
169
+ ${a}: [{
170
+ update: {
171
+ node: {
172
+ ${r}: { set: ${f} }
173
+ }
174
+ }
175
+ }]`:l.disabled||Array.isArray(l.value)||l.value===void 0||l.value===null||l.value===""||f===null||f===""?u:`${u}
176
+ ${a}: [{
177
+ create: {
178
+ node: {
179
+ _id: ${M(`${e}:${a}`)}
180
+ _type: "${p}"
181
+ ${r}: ${f}
182
+ }
183
+ }
184
+ }]`},"")}function Or(e,t,n){let r=pick(D("relationship",e),n);return toPairs(r).reduce((s,[u,a])=>{let l=find(propEq(u,"name"))(e),{inputType:d,relationship:p}=l;if(d==="relationship"&&p?.mode==="single"){let f=t[u]._id??"",c=a._id??"";if(f===c)return s;let y=f?` {
185
+ disconnect: [{
186
+ where: {
187
+ node: {
188
+ _id: { eq: ${M(f)} }
189
+ }
190
+ }
191
+ }]
192
+ }
193
+ `:"",k=c?` {
194
+ connect: [{
195
+ where: {
196
+ node: {
197
+ _id: { eq: ${M(c)} }
198
+ }
199
+ }
200
+ }]
201
+ }
202
+ `:"";return `${s}
203
+ ${u}: [
204
+ ${y}${k} ]`}if(d==="relationship"&&p?.mode==="multiple"){if(p.entity==="_asset")return `${s}${Pr(u,t[u],a)}`;let f=uniq(a.relationships?.disconnect??[]).filter(Boolean),y=(a.relationships?.connect??[]).map(g=>M(g._id)).join(", "),k=f.length?` {
205
+ disconnect: [
206
+ ${f.map(g=>` {
207
+ where: {
208
+ node: {
209
+ _id: { eq: ${M(g)} }
210
+ }
211
+ }
212
+ }
213
+ `).join("")} ]
214
+ }
215
+ `:"",S=y?` {
216
+ connect: [{
217
+ where: {
218
+ node: {
219
+ _id: { in: [${y}] }
220
+ }
221
+ }
222
+ }]
223
+ }
224
+ `:"";return !k&&!S?s:`${s}
225
+ ${u}: [
226
+ ${k}${S} ]`}return `${s}
227
+ `},"")}function Pr(e,t,n){let o=(n.relationships?.connect??[]).map((c,y)=>({...c,sortOrder:c.sortOrder??y})),i=o.map(c=>c._id),s={...Nr(t),...t?.knownAssetSortOrders??{},...n.knownAssetSortOrders??{}},u=uniq(n.relationships?.disconnect??[]).filter(c=>c&&!i.includes(c)),a=o.filter(c=>s[c._id]===void 0),l=o.filter(c=>{let y=s[c._id];return y!==void 0&&y!==c.sortOrder}),d=Vr(u),p=Qr(a),f=Ur(l);return !d&&!p&&!f?"":`
228
+ ${e}: [
229
+ ${d}${p}${f} ]`}function Nr(e){let t=e?.value;return Array.isArray(t)?t.reduce((n,r,o)=>{if(typeof r!="object"||!r||!("_id"in r))return n;let{_id:i}=r;if(typeof i!="string"||i.length===0)return n;let s="sortOrder"in r&&typeof r.sortOrder=="number"?r.sortOrder:o;return {...n,[i]:s}},{}):{}}function Vr(e){return e.length===0?"":` {
230
+ disconnect: [
231
+ ${e.reduce((n,r)=>`${n} {
232
+ where: { node: { _id: { eq: ${M(r)} } } }
233
+ }
234
+ `,"")} ]
235
+ }
236
+ `}function Qr(e){return e.length===0?"":` {
237
+ connect: [
238
+ ${bn(e)} ]
239
+ }
240
+ `}function bn(e){return e.reduce((t,n,r)=>{let o=n.sortOrder??r;return `${t} {
241
+ where: { node: { _id: { eq: ${M(n._id)} } } }
242
+ edge: { sortOrder: ${o} }
243
+ }
244
+ `},"")}function Ur(e){return e.length===0?"":e.reduce((n,r,o)=>{let i=r.sortOrder??o;return `${n} {
245
+ update: {
246
+ where: { node: { _id: { eq: ${M(r._id)} } } }
247
+ edge: { sortOrder: { set: ${i} } }
248
+ }
249
+ }
250
+ `},"")}function Et(e,t){return wr.includes(e)?t?.toString()?M(t.toString()):null:Tr.includes(e)?t==null?null:M(t.toString()):t==null||t===""?null:t.toString()}function M(e){return JSON.stringify(e)}function Sn(e,t,n){let r=re(e,t),o=r?.attributes??[],i=D("global",o),s=D("local",o),u=D("relationship",o),a=i.reduce((l,d)=>`${l}${d}
251
+ `,"");return a+=s.reduce((l,d)=>`${l} ${d} {
252
+ _id
253
+ ${n}
254
+ }
255
+ `,""),a+=u.reduce((l,d)=>{let p=find(propEq(d,"name"))(o),f=p?.relationship?.mode??"single";if(Ie(p))return `${l}${fn(d,St(p,r))}`;let c=p?.relationship?.entity??"",k=find(propEq(c,"name"))(e)?.attributes??[],S=p?.relationship?.field??"[invalid_relationship_field_name_in_schema]",g=find(propEq(S,"name"))(k),h=R(g),b="";if(f==="single"&&(h==="global"&&(b=` ${d} {
256
+ _id
257
+ ${S}
258
+ }
259
+ `),h==="local"&&(b=` ${d} {
260
+ _id
261
+ ${S} {
262
+ _id
263
+ default
264
+ ${n}
265
+ }
266
+ }
267
+ `)),f==="multiple"&&k.length){let v=k.reduce((L,T)=>{if(R(T)==="local")return `${L} ${T.name} {
268
+ _id
269
+ default
270
+ ${n}
271
+ }
272
+ `;if(R(T)==="relationship"){let U=n==="default"?"":`${n}
273
+ `,se=find(propEq(T.relationship?.entity,"name"))(e),K=find(propEq(T.relationship?.field,"name"))(se?.attributes??[]),A=R(K)==="local"?`{
274
+ _id
275
+ default
276
+ ${U}}
277
+ `:"";if(T.relationship?.mode==="single")return `${L} ${T.name} {
278
+ ${T.relationship.field} ${A}}
279
+ `;if(T.relationship?.field)return `${L} ${T.name} (limit: ${cn}, offset: 0) {
280
+ ${T.relationship.field} ${A}}
281
+ `}return tt(T)?`${L} ${T.name} {
282
+ ${bt}
283
+ }
284
+ `:`${L} ${T.name}
285
+ `},"");b=At(d)+` ${d} (limit: 25, offset: 0) {
286
+ ${v} }
287
+ `;}return `${l}${b}`},""),a}function hs(e,t,n){let r=typeof n=="string"?[n]:[...n],o=find(propEq(e,"name"))(t),i=o?.attributes??[],s=Oe(o?.plural??""),u=qr(i,r),a=`Delete${J(o?.plural??e)}`;return e==="_asset"?`mutation ${a}($where: ${e}Where) {
288
+ delete_assets(
289
+ where: $where
290
+ ) {
291
+ nodesDeleted
292
+ relationshipsDeleted
293
+ }
294
+ }
295
+ `:`mutation ${a}($where: ${e}Where) {
296
+ delete${s}(
297
+ where: $where
298
+ ${u?` delete: {
299
+ ${u}
300
+ }
301
+ `:""} ) {
302
+ nodesDeleted
303
+ relationshipsDeleted
304
+ }
305
+ }
306
+ `}function ys(e){let t=typeof e=="string"?[e]:[...e];return t.length===1?{_id:{eq:t[0]}}:{_id:{in:t}}}function qr(e,t){return D("local",e).reduce((o,i)=>{let s=t.map(a=>M(`${a}:${i}`)).join(", "),u=t.length===1?`_id: { eq: ${s} }`:`_id: { in: [${s}] }`;return `${o}
307
+ ${i}: [{
308
+ where: {
309
+ node: {
310
+ ${u}
311
+ }
312
+ }
313
+ }]`},"")}function ks(e,t,n,r,o){let i=re(t,e),s=i?.attributes??[],u=Oe(i?.plural??"");if(s.length===0)return "";let a=yn(s,n),l=kn(s,a,"create"),d=jr(s,a,"default",r),p=Ir(s,a),f=Br(s,a),c=e,y=Sn(t,c,"default");return `mutation ${`Create${J(e)}`} {
314
+ create${u}(
315
+ input: [{
316
+ _id: ${M(r)} ${l} ${d}
317
+ ${p}
318
+ ${f}
319
+ }]
320
+ ) {
321
+ ${c} {
322
+ _id
323
+ ${y} }
324
+ }
325
+ }
326
+ `}function jr(e,t,n,r){let o=pick(D("local",e),t);return toPairs(o).reduce((u,[a,l])=>{if(l?.value===void 0||l.value===null||l.value==="")return u;let d=find(propEq(a,"name"))(e),p=Array.isArray(l.value)?"null":Et(d.dataType,l.value);return `${u}
327
+ ${a}: {
328
+ create: [{
329
+ node: {
330
+ _id: ${M(`${r}:${a}`)}
331
+ _type: "${d.dataType}"
332
+ ${n}: ${p}
333
+ }
334
+ }]
335
+ }`},"")}function Br(e,t){let n=pick(D("relationship",e),t);return toPairs(n).reduce((i,[s,u])=>{let a=find(propEq(s,"name"))(e),{inputType:l,relationship:d}=a;if(l==="relationship"&&d?.mode==="single"){if(!u._id)return i;let c=`connect: [{
336
+ where: {
337
+ node: {
338
+ _id: { eq: ${M(u._id)} }
339
+ }
340
+ }
341
+ }]
342
+ `;return `${i}
343
+ ${s}: {
344
+ ${c} }`}let p=l==="relationship"&&d?.mode==="multiple",f=Array.isArray(u.relationships?.connect)&&u.relationships.connect.length>0;if(p&&f){let c=u.relationships?.connect??[];if(d?.entity==="_asset"){let S=bn(c.map((g,h)=>({...g,sortOrder:g.sortOrder??h})));return `${i}
345
+ ${s}: {
346
+ connect: [
347
+ ${S} ]
348
+ }`}let y=c.map(S=>M(S._id)).join(", "),k=y?`connect: {
349
+ where: {
350
+ node: {
351
+ _id: { in: [${y}] }
352
+ }
353
+ }
354
+ }
355
+ `:"";return `${i}
356
+ ${s}: {
357
+ ${k} }`}return `${i}
358
+ `},"")}function bs({relatedEntityName:e,scope:t,schema:n}){let o=find(propEq(e,"name"))(n)?.plural??"";return o?nt(o,t,n,{selection:"list",operationName:`GetRelated${J(o)}`}):{queryEntityName:"",query:""}}function Ss({attributeName:e,entityName:t,entityNamePlural:n,schema:r}){let o=re(r,n),i=find(propEq(e,"name"))(o?.attributes??[]),s=St(i,o),u=s?` properties {
359
+ sortOrder
360
+ }
361
+ `:"",a=s?"(first: $first, sort: [{ edge: { sortOrder: ASC } }])":"(first: $first)",l=`Get${J(t)}AssetConnection`;return {queryEntityName:n,query:`query ${l}($where: ${t}Where, $first: Int) {
362
+ ${n}(where: $where) {
363
+ ${e}Connection${a} {
364
+ aggregate {
365
+ count {
366
+ nodes
367
+ }
368
+ }
369
+ edges {
370
+ `+u+` node {
371
+ ${kt}
372
+ }
373
+ }
374
+ }
375
+ }
376
+ }
377
+ `}}var Oe=e=>e.charAt(0).toUpperCase()+e.slice(1);function J(e){let t=e.split(/[^0-9A-Za-z]+/).filter(Boolean).map(Oe).join("");return t?/^[A-Za-z_]/.test(t)?t:`Entity${t}`:"Entity"}function re(e,t){return t==="_assets"?b:find(propEq(t,"plural"))(e)}function As(e,t,n){if(!e||typeof e!="object")return {};let r=re(n,t);if(!r)return {};let o=`update${Oe(t)}`,i=e[o];if(!i||typeof i!="object")return {};let s=i[t],u=Array.isArray(s)?s[0]:void 0;return !u||typeof u!="object"?{}:r.attributes.reduce((a,l)=>{if(R(l)!=="local")return a;let p=le(u[l.name])?._id;return typeof p!="string"||p.length===0?a:{...a,[l.name]:p}},{})}function Tn(e){return e?"cause"in e:false}function be(e){if(!e)return null;if(ServerError.is(e))return e;if(Tn(e)){let t=e.cause;if(ServerError.is(t))return t}return null}function wn(e){if(!e||typeof e!="object")return null;let{message:t}=e;return typeof t=="string"?t:null}function Se(e){if(!e)return null;try{return JSON.parse(e)}catch{return null}}function rt(e){if(!e)return null;let t=Cn(e).filter(n=>!Jr(n));return t.length===0?null:["The deployed schema is out of sync with your local Flexkit schema.","Run `flexkit deploy` using the CLI to apply your latest schema changes.",...t.map(n=>`- ${n}`)].join(`
378
+ `)}function $n(e,t){return e?Cn(e).some(n=>n.includes(`Cannot query field "${t}"`)):false}function Cn(e){if(CombinedGraphQLErrors.is(e))return e.errors.filter(En).map(({message:o})=>o);let t=wn(e);if(t&&Pe(t))return [t];let n=be(e);if(n?.statusCode!==400)return [];let r=Se(n.bodyText)??Hr(n)??Gr(e);return r?Array.isArray(r.errors)?r.errors.filter(En).map(o=>o.message):typeof r.message=="string"&&Pe(r.message)?[r.message]:typeof r.error=="string"&&Pe(r.error)?[r.error]:[]:[]}function Hr(e){let{result:t}=e;return !t||typeof t!="object"?null:t}function Gr(e){if(!Tn(e))return null;let{cause:t}=e,n=wn(t);if(n&&Pe(n))return {message:n};if(!t||typeof t!="object")return null;let{result:r}=t;return r&&typeof r=="object"?r:null}function En(e){if(!e||typeof e!="object")return false;let{extensions:t,message:n}=e;return t?.code==="GRAPHQL_VALIDATION_FAILED"&&typeof n=="string"?true:typeof n=="string"&&Pe(n)}function Pe(e){return e.startsWith("Cannot query field ")||e.startsWith("Unknown type ")||e.startsWith('Cannot query field "')||e.includes("GRAPHQL_VALIDATION_FAILED")}function Jr(e){return /Cannot query field "[_A-Za-z][_0-9A-Za-z]*Total" on type "Query"/.test(e)}var ao=ApolloProvider,Rn=createContext(void 0);function Ce(){let e=useContext(Rn);if(!e)throw new Error("useGraphQLError must be used within GraphQLProvider");return e}function lo(e){return new ErrorLink(({error:t})=>{let n=rt(t);if(n){e(n);return}CombinedGraphQLErrors.is(t)?t.errors.forEach(({message:o,locations:i,path:s})=>{console.warn(`[GraphQL error]: Message: ${o}, Location: ${i}, Path: ${s}`);}):CombinedProtocolErrors.is(t)&&t.errors.forEach(({message:o,extensions:i})=>{console.warn(`[Protocol error]: Message: ${o}, Extensions: ${JSON.stringify(i)}`);});let r=be(t);if(r?.statusCode===400){let o=Se(r.bodyText),i=null;if(o&&typeof o=="object"){let{error:s,errors:u,message:a}=o;if(typeof a=="string")i=a;else if(Array.isArray(u)){let[l]=u;if(l&&typeof l.message=="string"){let{message:d}=l;i=d;}}else typeof s=="string"?i=s:i=JSON.stringify(o);}else i=r.bodyText;e(i??"There is an error in the deployed Flexkit schema. Fix flexkit.config.ts and run flexkit deploy.");}if(r){console.warn(`[Network error]: ${r.message}`);return}t&&console.warn(`[Network error]: ${t.message}`);})}function uo(e,t){return from([lo(t),new HttpLink({uri:`/api/flexkit/${e}/graphql`})])}function co(e,t){return new ApolloClient({link:uo(e??"",t),cache:new InMemoryCache({dataIdFromObject:n=>n._id?n._id:defaultDataIdFromObject(n)})})}function Ds({children:e}){let{currentProjectId:t}=f(),[n,r]=useState(null),o=useMemo(()=>({schemaErrorMessage:n,setSchemaErrorMessage:r}),[n]),i=useMemo(()=>co(t,r),[t]);return jsx(Rn.Provider,{value:o,children:jsx(ao,{client:i,children:e})})}var ot=null,Tt=new Set,_n=[],wt=new Set,$t=new Set,Ct=new Set;function Ns(e,t){if(e==="_asset"||e==="_assets")return `Get${J(b.plural)}`;let n=t.find(i=>i.plural===e),r=t.find(i=>i.name===e),o=n?.plural??r?.plural??e;return `Get${J(o)}`}function Ln(e){return wt.add(e),()=>{wt.delete(e);}}function Mn(e){return $t.add(e),()=>{$t.delete(e);}}function Dn(e){return Ct.add(e),()=>{Ct.delete(e);}}function Vs(e,t,n){let r=new Set(n.filter(Boolean));if(r.size>0)for(let o of $t)o(t,r);return fo(e,t)}function Qs(e,t){let n=t.filter(r=>!!r._id);if(n.length!==0)for(let r of Ct)r(e,n);}function fo(e,t){return Tt.add(t),new Promise((n,r)=>{_n.push({resolve:n,reject:r}),ot&&clearTimeout(ot),ot=setTimeout(()=>{let o=new Set(Tt),i=_n.splice(0);Tt.clear(),ot=null,Promise.all([...wt].map(s=>Promise.resolve(s(o)))).then(()=>{for(let{resolve:s}of i)s();}).catch(s=>{console.error("Error refreshing entity lists:",s);for(let{reject:u}of i)u(s);});},50);})}function Ws({entityNamePlural:e,schema:t,scope:n,variables:r,isForm:o,selection:i="full",includeCount:s=true}){let[u,a]=useState({count:0,results:[]}),[l,d]=useState(false),[p,f]=useState(false),[c,y]=useState(null),k=useRef(false),S=useRef(false),g=useRef(0),h=useRef(null),b=useRef(null),v=`${e}Total`,L=re(t,e),U=r?.where===void 0&&(L?.spaces?.length??0)===0&&(c?.field!==v||c.schema!==t)?"total":"aggregate",se=useMemo(()=>gql(nt(e,n,t,{selection:i,countMode:U,includeCount:s}).query),[e,n,t,i,U,s]),K=useMemo(()=>gql(nt(e,n,t,{selection:i,includeCount:false}).query),[e,n,t,i]),{schemaErrorMessage:A,setSchemaErrorMessage:w}=Ce(),{loading:q,data:B,fetchMore:G,refetch:Y,error:me,networkStatus:ge}=useQuery(se,{variables:r,notifyOnNetworkStatusChange:true}),Re=useRef(G),Z=useRef(Y),_e=useRef(K),ee=useRef(ge),he=useRef(r);Re.current=G,Z.current=Y,_e.current=K,he.current=r;let Le=s&&$n(me,v),ae=U==="total"&&Le,j=Le?void 0:me,ue=Le&&!B?.[e],ye=be(j),z=rt(j),{isProjectDisabled:Be,isProjectReadOnly:ze}=(()=>{if(ye?.statusCode===403){let $=Se(ye.bodyText);if($&&typeof $.code=="string"){if($.code==="PROJECT_PAUSED")return {isProjectDisabled:true,isProjectReadOnly:false};if($.code==="READ_ONLY_MODE")return {isProjectDisabled:false,isProjectReadOnly:true}}return {isProjectDisabled:true,isProjectReadOnly:false}}return {isProjectDisabled:false,isProjectReadOnly:false}})();useEffect(()=>{ae&&y({field:v,schema:t});},[t,ae,v]);let He=useCallback($=>{if(k.current||S.current)return;k.current=true,d(true);let{limit:P}=$.variables,N=g.current;Re.current({...$,query:_e.current,variables:{...he.current,...$.variables,offset:N,limit:P}}).then(({data:te})=>{let V=Ve({data:te,entityNamePlural:e,isForm:o,schema:t,scope:n}),H=V.results.length;g.current=N+(H===0?0:Math.min(H,P)),a(m=>{let E=uniqBy(prop("_id"),[...m.results,...V.results]);return E.length===m.results.length?{count:m.results.length,results:m.results}:{count:V.count||m.count,results:E}});}).catch(te=>{console.error("Error fetching more data:",te);}).finally(()=>{k.current=false,d(false);});},[e,o,t,n]),Me=useCallback($=>{if(S.current)return Promise.resolve();let P=$?.preserve===true;return S.current=true,k.current=false,d(false),P||(h.current=null,b.current=null,g.current=0,f(true),a({count:0,results:[]})),Z.current().then(({data:N})=>{let te=JSON.stringify({entityNamePlural:e,scope:n,selection:i,includeCount:s,variables:r}),V=Ve({data:N,entityNamePlural:e,isForm:o,schema:t,scope:n});h.current=te,b.current=null,g.current=st(r)+V.results.length,a(V);}).catch(N=>{console.error("Error reloading data:",N);}).finally(()=>{S.current=false,f(false);})},[e,o,t,n,i,s,r]);return useEffect(()=>{if(z){w(z);return}B&&A&&!j&&w(null);},[B,j,A,z,w]),useEffect(()=>{if(j||z||ue)return;let $=JSON.stringify({entityNamePlural:e,scope:n,selection:i,includeCount:s,variables:r});if(h.current===$)return;if(q&&b.current!==$){b.current=$,g.current=0,a({count:0,results:[]});return}if(q)return;let P=Ve({data:B,entityNamePlural:e,isForm:o,schema:t,scope:n});h.current=$,b.current=null,g.current=st(r)+P.results.length,a(P);},[B,j,e,o,q,ue,t,z,n,i,s,r]),useEffect(()=>{let $=ee.current;if(ee.current=ge,j||z||S.current||ue||$!==NetworkStatus.refetch||ge!==NetworkStatus.ready||!B)return;let P=JSON.stringify({entityNamePlural:e,scope:n,selection:i,includeCount:s,variables:r}),N=Ve({data:B,entityNamePlural:e,isForm:o,schema:t,scope:n});h.current=P,b.current=null,g.current=st(r)+N.results.length,a(N);},[B,j,e,o,ue,ge,t,z,n,i,s,r]),useEffect(()=>{if(o)return;let $=`Get${J(e)}`,P=Ln(V=>{if(!(!V.has($)||k.current||S.current))return Z.current().then(({data:H})=>{let m=JSON.stringify({entityNamePlural:e,scope:n,selection:i,includeCount:s,variables:r}),E=Ve({data:H,entityNamePlural:e,isForm:o,schema:t,scope:n});h.current=m,b.current=null,g.current=st(r)+E.results.length,a(E);}).catch(H=>{console.error("Error soft-refreshing entity list:",H);})}),N=Mn((V,H)=>{V===$&&a(m=>{let E=m.results.filter(Ge=>{let Ut=typeof Ge._id=="string"?Ge._id:void 0;return !Ut||!H.has(Ut)}),ne=m.results.length-E.length;return ne===0?m:{count:Math.max(0,m.count-ne),results:E}});}),te=Dn((V,H)=>{V===$&&a(m=>ho(m,H,r?.sort));});return ()=>{P(),N(),te();}},[e,o,t,n,i,s,r]),{isLoading:q&&ge!==NetworkStatus.refetch||p||ue,isLoadingMore:l,fetchMore:He,reload:Me,count:u.count,data:u.results,isProjectDisabled:Be,isProjectReadOnly:ze,schemaErrorMessage:A}}function st(e){let t=e?.offset;return typeof t=="number"&&Number.isFinite(t)?t:0}function Ve(e){let t=e.entityNamePlural;return e.data?.[t]?e.isForm?hn(e.entityNamePlural,e.scope,e.data,e.schema):gn(e.entityNamePlural,e.scope,e.data,e.schema):{count:0,results:[]}}function ho(e,t,n){let r=new Map(t.map(s=>[s._id,s])),o=false,i=e.results.map(s=>{let u=typeof s._id=="string"?s._id:void 0;if(!u)return s;let a=r.get(u);return a?(o=true,{...s,...a.attributes}):s});return o?{count:e.count,results:yo(i,n)}:e}function yo(e,t){if(!Array.isArray(t)||t.length===0)return e;let[n]=t;if(!n||typeof n!="object")return e;let[r]=Object.entries(n),[o,i]=r??[];if(!o||i!=="ASC"&&i!=="DESC")return e;let s=i==="DESC"?-1:1;return [...e].sort((u,a)=>{let l=u[o],d=a[o],p=typeof l=="string"?l:"",f=typeof d=="string"?d:"";return p.localeCompare(f)*s})}function ea(){return jsxs(Rc,{variant:"destructive",children:[jsx(AlertCircle,{className:"fk:h-4 fk:w-4"}),jsx(Sc,{children:"Project Paused"}),jsxs(Tc,{children:["This project has been paused. To troubleshoot this error, please"," ",jsx("a",{className:"fk:text-blue-500 fk:underline",href:"https://flexkit.io/docs/errors/project-paused",target:"_blank",rel:"noopener noreferrer",children:"follow these steps"}),"."]})]})}function sa(){let{schemaErrorMessage:e}=Ce();if(!e)return jsx(Fragment,{});let[t,n,...r]=e.split(`
379
+ `);return jsxs(Rc,{className:"fk:mb-4",variant:"destructive",children:[jsx(AlertCircle,{className:"fk:h-4 fk:w-4"}),jsx(Sc,{children:"Schema mismatch"}),jsxs(Tc,{children:[jsx("p",{children:t}),n?jsx("p",{className:"fk:mt-1",children:n}):null,r.length>0?jsx("ul",{className:"fk:mt-2 fk:list-disc fk:pl-4",children:r.map(o=>jsx("li",{children:o.replace(/^- /,"")},o))}):null]})]})}function Vn({scrollHeight:e,scrollTop:t,clientHeight:n}){if(n<=0)return false;let r=t>0?Math.max(600,n):1;return e-t-n<r}var xo=36,vo=15,Ro=2,qn=40;function zn(e){if(!e)return;let t=e.split(/\s+/);if(t.includes("fk:h-20"))return 80;if(t.includes("fk:h-10"))return 40;if(t.includes("fk:h-9"))return 36}function _o(e,t){return e??zn(t)??xo}function ba({classNames:e,columns:t,data:n,entityName:r,hasMore:o=false,initialSelectionState:i,isLoadingMore:s=false,onEntitySelectionChange:u,onLoadMore:a$2,onScroll:l,onSortingChange:d,pageSize:p,rowHeightEstimate:f,rowAdditionState:c,rowDeletionState:y,scrollToTopKey:k,sorting:S,toolbarComponent:g}){let h=useRef(null),{schemaErrorMessage:b}=Ce(),[v,L]=useState(i??{}),[T,U]=useState({}),[se,K]=useState([]),[A,w]=useState([]),q=S??A;useEffect(()=>{h.current?.scrollTo({top:0,left:0});},[r,k]),useEffect(()=>{if(!i)return;let m=Object.keys(v).sort().join(","),E=Object.keys(i).sort().join(",");m!==E&&L(i);},[i,v]);function B(m){if(d){d(m);return}w(m);}let G=useReactTable({data:n,columns:t,state:{sorting:q,columnVisibility:T,rowSelection:v,columnFilters:se},initialState:{pagination:{pageSize:p??50}},enableRowSelection:true,onRowSelectionChange:V,onSortingChange:B,onColumnFiltersChange:K,onColumnVisibilityChange:U,getCoreRowModel:getCoreRowModel(),getFilteredRowModel:getFilteredRowModel(),getPaginationRowModel:getPaginationRowModel(),getSortedRowModel:getSortedRowModel(),getRowId:m=>m._id,manualFiltering:true,manualPagination:true,manualSorting:true,meta:{getRowBackground:m=>Mo(m,y,c)}}),{rows:Y}=G.getRowModel(),me=_o(f,e?.row),ge=zn(e?.row)!=null,Re=useVirtualizer({count:Y.length,estimateSize:()=>me,getItemKey:m=>Y[m]?.id??m,getScrollElement:()=>h.current,overscan:vo,scrollMargin:qn}),Z=G.getVisibleLeafColumns(),_e=G.getHeaderGroups(),ee=_e.length===1,he=useVirtualizer({horizontal:true,count:Z.length,estimateSize:m=>Z[m].getSize(),getItemKey:m=>Z[m].id,getScrollElement:()=>h.current,overscan:Ro,enabled:ee}),Le=JSON.stringify(Z.map(m=>[m.id,m.getSize()]));useEffect(()=>{he.measure();},[Le,he]);let ae=he.getVirtualItems(),j=ee?ae[0]?.index??0:0,ue=ee?(ae[ae.length-1]?.index??-1)+1:Z.length,ye=ee?ae[0]?.start??0:0,z=ee?Math.max(0,he.getTotalSize()-(ae[ae.length-1]?.end??0)):0,Be=Re.getVirtualItems(),{paddingTop:ze,paddingBottom:He}=Lo(Be,Re.getTotalSize(),qn),Me=useRef(a$2),$$1=useRef(o),P=useRef(s);Me.current=a$2,$$1.current=o,P.current=s;let N=useCallback(m=>{if(!Me.current||!$$1.current||P.current)return;let E=m??h.current;E&&Vn(E)&&(P.current=true,Me.current());},[]),te=b$1();useEffect(()=>{te&&N();},[N,Y.length,o,s,te]);function V(m){let E=Object.keys(typeof m=="function"?m(v):m);L(m),u?.(E);}function H(m){l?.(m),N(m.currentTarget);}return b?jsx(Fragment,{}):jsxs("div",{className:a$1("fk:flex fk:h-full fk:min-h-0 fk:w-full fk:min-w-0 fk:flex-col fk:gap-4",e?.wrapper),children:[g&&g(G),jsx("div",{className:"fk:relative fk:min-h-0 fk:min-w-0 fk:flex-1 fk:-mb-px",children:jsx(a,{delayDuration:400,children:jsxs(_,{className:a$1("fk:grid fk:pb-20",e?.table),"aria-colcount":Z.length,style:{minWidth:G.getTotalSize()},containerClassName:e?.tableContainer,onScroll:H,ref:h,children:[jsx($,{className:"fk:sticky fk:top-0 fk:z-20 fk:grid",children:_e.map(m=>jsxs(ca,{className:"fk:flex fk:w-full",children:[ye>0?jsx(ct,{width:ye,header:true}):null,(ee?m.headers.slice(j,ue):m.headers).map((E,ne)=>jsxs(da,{"aria-colindex":ee?j+ne+1:void 0,className:a$1("fk:flex fk:shrink-0 fk:items-center",E.column.id==="actions"&&"fk:pl-0"),colSpan:E.colSpan,style:E.getSize()?{width:`${E.getSize().toString()}px`}:{},children:[E.isPlaceholder?null:flexRender(E.column.columnDef.header,E.getContext()),s?jsx("div",{"aria-hidden":true,className:"fk:pointer-events-none fk:absolute fk:top-10.25 fk:right-px fk:left-px fk:z-20 fk:h-0.5 fk:overflow-hidden fk:opacity-4",children:jsx("div",{className:"fk:animate-progress fk:h-full fk:w-full fk:bg-foreground"})}):null]},E.id)),z>0?jsx(ct,{width:z,header:true}):null]},m.id))}),jsx(aa,{className:"fk:grid fk:relative",children:Y.length===0?jsx(ca,{children:jsx(ea$1,{className:"fk:h-24 fk:text-center",colSpan:t.length,children:"No results."})}):jsxs(Fragment,{children:[ze>0?jsx(jn,{height:ze}):null,Be.map(m=>{let E=Y[m.index];return jsxs(ca,{className:a$1(G.options.meta.getRowBackground(E),"fk:flex fk:w-full fk:overflow-hidden fk:transition-none",!ge&&f==null&&"fk:h-9",e?.row),"data-index":m.index,"data-state":E.getIsSelected()&&"selected",style:{height:`${me.toString()}px`},children:[ye>0?jsx(ct,{width:ye}):null,E.getVisibleCells().slice(j,ue).map((ne,Ge)=>jsx(ea$1,{className:a$1("fk:flex fk:shrink-0 fk:items-center fk:truncate",ne.column.id==="actions"&&"fk:pl-1!"),"aria-colindex":j+Ge+1,style:{width:ne.column.getSize()},children:flexRender(ne.column.columnDef.cell,ne.getContext())},ne.id)),z>0?jsx(ct,{width:z}):null]},m.key)}),He>0?jsx(jn,{height:He}):null]})})]})})})]})}function Lo(e,t,n){if(e.length===0)return {paddingTop:0,paddingBottom:0};let r=e[0]?.start??0,o=e[e.length-1]?.end??0;return {paddingTop:Math.max(0,r-n),paddingBottom:Math.max(0,t-(o-n))}}function ct({width:e,header:t=false}){return jsx(t?"th":"td",{"aria-hidden":true,style:{width:e,flexShrink:0,padding:0,border:0}})}function jn({height:e}){return jsx("tr",{"aria-hidden":true,className:"fk:pointer-events-none fk:border-0",style:{display:"block",height:`${e.toString()}px`},children:jsx("td",{className:"fk:p-0 fk:border-0"})})}function Mo(e,t,n){return t?.includes(e.original._id)?"fk:bg-row-removed fk:hover:bg-row-removed-hover":n?.some(r=>r._id===e.original._id)?"fk:bg-row-added fk:hover:bg-row-added-hover":""}var Xn=createContext([]),Wn=createContext(()=>{});function Io(e,t){let n=t.type;switch(t._id||(t._id=Date.now().toString()),n){case "DeleteEntity":return uniqBy(props(["type","_id"]),[...e,t]);case "AddEntity":return uniqBy(props(["type","_id"]),[...e,t]);case "EditEntity":return uniqBy(props(["type","_id"]),[...e,t]);case "EditRelationship":return uniqBy(props(["type","_id"]),[...e,t]);case "AlertDialog":return uniqBy(props(["type","_id"]),[...e,t]);case "Dismiss":return e.filter(r=>r._id!==t._id);default:throw Error(`Unknown action: ${n}`)}}function wa({children:e}){let[t,n]=useReducer(Io,[]);return jsx(Xn.Provider,{value:t,children:jsx(Wn.Provider,{value:n,children:e})})}function $a(){return useContext(Xn)}function Ca(){return useContext(Wn)}function La({table:e}){let[t]=e.getState().sorting;if(!t)return null;let r=e.getColumn(t.id)?.columnDef.meta?.label??t.id,o=t.desc?"desc":"asc";return jsxs(b$2,{"aria-label":`Clear sorting by ${r}`,className:"fk:h-8 fk:px-2 fk:lg:px-3 fk:text-success fk:border-none",onClick:()=>{e.resetSorting();},size:"sm",variant:"outline",children:["Sorted by ",r," ",o,jsx(X$1,{className:"fk:ml-1 fk:h-4 fk:w-4"})]})}function Na(){let[e,t]=useState(false),[n,r]=useState(gql`
380
+ mutation updateEntity($any: Any) {
381
+ any
382
+ }
383
+ `),[o,i]=useState({}),[s,{data:u,loading:a,error:l}]=useMutation(n,o),d=be(l),{isProjectDisabled:p,isProjectReadOnly:f}=(()=>{if(d?.statusCode===403){let c=Se(d.bodyText);if(c&&typeof c.code=="string"){if(c.code==="PROJECT_PAUSED")return {isProjectDisabled:true,isProjectReadOnly:false};if(c.code==="READ_ONLY_MODE")return {isProjectDisabled:false,isProjectReadOnly:true}}return {isProjectDisabled:true,isProjectReadOnly:false}}return {isProjectDisabled:false,isProjectReadOnly:false}})();return useEffect(()=>{e&&(s(),t(false));},[e,s]),[t,r,i,{data:u,loading:a,error:l,isProjectDisabled:p,isProjectReadOnly:f}]}function _t({column:e,title:t,className:n}){if(!e.getCanSort())return jsx("div",{className:a$1("fk:flex fk:items-center",n),children:t});let r=e.getIsSorted()==="asc",o=e.getIsSorted()==="desc";return jsxs("div",{className:a$1("fk:flex fk:w-full fk:items-center fk:justify-between fk:gap-1",n),children:[jsx("span",{className:"fk:truncate",children:t}),jsxs(e$1,{children:[jsx(g,{asChild:true,children:jsx("button",{"aria-label":`Sort ${t}`,className:"fk:inline-flex fk:shrink-0 fk:items-center fk:justify-center fk:rounded-sm fk:p-0.5 fk:text-muted-foreground fk:outline-hidden fk:hover:bg-accent fk:hover:text-accent-foreground fk:focus-visible:ring-1 fk:focus-visible:ring-ring fk:corner-squircle",type:"button",children:jsx(ChevronDown,{className:"fk:h-3.5 fk:w-3.5"})})}),jsxs(h,{align:"end",className:"fk:w-44",children:[jsxs(j,{"aria-checked":r,className:a$1(r&&"fk:bg-accent fk:text-accent-foreground"),onSelect:()=>{if(r){e.clearSorting();return}e.toggleSorting(false);},role:"menuitemcheckbox",children:[jsx(ArrowUp,{className:a$1("fk:h-4 fk:w-4",r&&"fk:text-white")}),"Sort Ascending"]}),jsxs(j,{"aria-checked":o,className:a$1(o&&"fk:bg-accent fk:text-accent-foreground"),onSelect:()=>{if(o){e.clearSorting();return}e.toggleSorting(true);},role:"menuitemcheckbox",children:[jsx(ArrowDown,{className:a$1("fk:h-4 fk:w-4",o&&"fk:text-white")}),"Sort Descending"]})]})]})]})}function Mt({value:e}){return jsx("div",{className:"fk:flex fk:w-full fk:justify-center",children:e?jsx(CircleCheck,{className:"fk:w-4 fk:h-4 fk:text-emerald-500"}):jsx(CircleX,{className:"fk:w-4 fk:h-4 fk:text-muted-foreground"})})}var Zn=500,Xo=3e3;function X({value:e}){let t=useRef(null),n=useRef(null),[r,o]=useState(false),[i,s]=useState(false);useEffect(()=>()=>{n.current&&clearTimeout(n.current);},[]);function u(){let f=t.current;return f?f.scrollWidth>f.clientWidth:false}async function a(f){if(f.preventDefault(),f.stopPropagation(),!!e){try{await navigator.clipboard.writeText(e);}catch{return}o(true),s(true),n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{o(false),s(false);},Xo);}}function l(){u();}function d(f){if(!r){if(f){s(u());return}s(false);}}if(!e)return jsx("div",{className:"fk:truncate"});let p=e.length>Zn?`${e.slice(0,Zn)}\u2026`:e;return jsxs(b$4,{open:i,onOpenChange:d,children:[jsx(c$1,{asChild:true,children:jsxs("button",{"aria-label":"Copy value",className:a$1("fk:group/copyable fk:relative fk:flex fk:w-full fk:min-w-0 fk:items-center fk:rounded-sm fk:border-0 fk:bg-transparent fk:px-0.5 fk:-mx-0.5 fk:py-0.5 fk:text-left fk:text-inherit fk:font-inherit fk:corner-squircle","fk:cursor-pointer fk:transition-[transform,background-color] fk:duration-75 fk:ease-out","fk:hover:bg-muted/50 fk:active:translate-y-px fk:active:scale-[0.98] fk:active:bg-muted/70","fk:focus-visible:outline-hidden fk:focus-visible:ring-1 fk:focus-visible:ring-ring"),onClick:a,onPointerEnter:l,type:"button",children:[jsx("span",{className:"fk:min-w-0 fk:flex-1 fk:truncate fk:pr-4",ref:t,children:e}),jsx("span",{"aria-hidden":true,className:a$1("fk:pointer-events-none fk:absolute fk:right-0.5 fk:top-1/2 fk:flex fk:-translate-y-1/2 fk:items-center fk:justify-center","fk:rounded-sm fk:bg-muted/80 fk:p-0.5 fk:text-muted-foreground fk:shadow-sm fk:ring-1 fk:ring-border/60 fk:corner-squircle","fk:transition-opacity fk:duration-100",r?"fk:opacity-100 fk:text-foreground":"fk:opacity-0 fk:group-hover/copyable:opacity-100 fk:group-focus-visible/copyable:opacity-100"),children:r?jsx(Check,{className:"fk:size-3"}):jsx(Copy,{className:"fk:size-3"})})]})}),jsx(e$2,{className:"fk:max-w-xs fk:wrap-break-word",children:r?"Copied to clipboard":p})]})}function ve({value:e}){let t=typeof e=="object"||Array.isArray(e)?JSON.stringify(e):e;return t=t==="null"||t==null?"":String(t),jsx(X,{value:t})}var Si=AIHighlight,Ai=Placeholder,Ei=TiptapLink.configure({HTMLAttributes:{class:cx("fk:text-muted-foreground fk:underline fk:underline-offset-[3px] fk:hover:text-primary fk:transition-colors fk:cursor-pointer")}}),Ti=Markdown.configure({html:true,tightLists:true,tightListClass:"tight",bulletListMarker:"-",linkify:false,breaks:false,transformPastedText:false,transformCopiedText:false}),wi=TiptapImage.extend({addProseMirrorPlugins(){return [UploadImagesPlugin({imageClass:cx("fk:opacity-40 fk:rounded-lg fk:border fk:border-stone-200 fk:corner-squircle")})]}}).configure({allowBase64:true,HTMLAttributes:{class:cx("fk:rounded-lg fk:border fk:border-muted fk:corner-squircle")}}),$i=TaskList.configure({HTMLAttributes:{class:cx("fk:not-prose fk:pl-2 ")}}),Ci=TaskItem.configure({HTMLAttributes:{class:cx("fk:flex gap-2 fk:items-start fk:my-2")},nested:true}),xi=HorizontalRule.configure({HTMLAttributes:{class:cx("mt-4 mb-6 border-t border-muted-foreground")}}),vi=StarterKit.configure({bulletList:{HTMLAttributes:{class:cx("fk:list-disc fk:list-outside fk:leading-3 fk:-mt-2")}},orderedList:{HTMLAttributes:{class:cx("fk:list-decimal fk:list-outside fk:leading-3 fk:-mt-2")}},listItem:{HTMLAttributes:{class:cx("fk:leading-normal fk:-mb-2")}},blockquote:{HTMLAttributes:{class:cx("fk:border-l-4 fk:border-primary")}},codeBlock:false,code:{HTMLAttributes:{class:cx("fk:rounded-md fk:bg-muted fk:px-1.5 fk:py-1 fk:font-mono fk:font-medium fk:corner-squircle"),spellcheck:"false"}},horizontalRule:false,dropcursor:{color:"#DBEAFE",width:4},gapcursor:false}),Ri=CodeBlockLowlight.configure({lowlight:createLowlight(common)}),_i=Youtube.configure({HTMLAttributes:{class:cx("fk:rounded-lg fk:border fk:border-muted fk:corner-squircle")},inline:false}),Li=Twitter.configure({HTMLAttributes:{class:cx("fk:not-prose")},inline:false}),Mi=Mathematics.configure({HTMLAttributes:{class:cx("fk:text-foreground fk:rounded-sm fk:p-1 fk:hover:bg-muted fk:cursor-pointer fk:corner-squircle")},katexOptions:{throwOnError:false}}),Di=CharacterCount.configure(),tr=[vi,Ai,Ei,wi,$i,Ci,xi,Si,Ri,_i,Li,Mi,Di,TiptapUnderline,Ti,HighlightExtension,TextStyle,Color,CustomKeymap,GlobalDragHandle];var Dt;function Ni(){let e=getSchema(tr);return {schema:e,textSerializers:getTextSerializersFromSchema(e)}}function nr(e,t=100){if(!e)return "";try{let n=JSON.parse(e);return Dt??=Ni(),getText(Node.fromJSON(Dt.schema,n),{textSerializers:Dt.textSerializers}).substring(0,t)}catch{return e.substring(0,t)}}function rr({value:e}){let t=useMemo(()=>nr(e),[e]);return jsx(X,{value:t})}var or=250,Bi=25e5,ie=new Map,It=new Map,Ft=new Set,ir=new Map;function dt(e){if(ir.has(e))return;let t=new Image;t.decoding="async",t.src=e,ir.set(e,t);}function ft(e){let t=ie.get(e);t&&ie.set(e,{...t,lastUsedAt:Date.now()});}function zi(){if(ie.size<=or)return;let e=Array.from(ie.entries()).sort((n,r)=>n[1].lastUsedAt-r[1].lastUsedAt),t=Math.max(1,Math.ceil(or*.1));for(let n=0;n<t&&n<e.length;n+=1){let[r,o]=e[n];ie.delete(r),URL.revokeObjectURL(o.objectUrl);}}async function Hi(e){if(Ft.has(e)){dt(e);return}if(ie.has(e)){ft(e);return}let t=It.get(e);if(t){await t;return}let n=(async()=>{try{let r=await fetch(e,{mode:"cors",cache:"force-cache"});if(!r.ok){dt(e);return}let o=await r.blob();if(o.size>Bi)return;let i=URL.createObjectURL(o);ie.set(e,{objectUrl:i,byteSize:o.size,lastUsedAt:Date.now()}),zi();}catch(r){r instanceof TypeError&&Ft.add(e),dt(e);}})();It.set(e,n),await n,It.delete(e);}function sr(e){let t=useMemo(()=>{if(!e)return null;let o=ie.get(e);return o?(ft(e),o.objectUrl):null},[e]),[n,r]=useState(t);return useEffect(()=>{if(!e){r(null);return}if(Ft.has(e)){dt(e),r(null);return}let o=ie.get(e);if(o){ft(e),r(o.objectUrl);return}r(null);let i=false;return Hi(e).then(()=>{let s=ie.get(e);s&&(i||(ft(e),r(s.objectUrl)));}),()=>{i=true;}},[e]),n}var Ot="fk:bg-[#fafafa] [--asset-checker:#f0f0f0] [background-image:linear-gradient(45deg,var(--asset-checker)_25%,transparent_25%),linear-gradient(-45deg,var(--asset-checker)_25%,transparent_25%),linear-gradient(45deg,transparent_75%,var(--asset-checker)_75%),linear-gradient(-45deg,transparent_75%,var(--asset-checker)_75%)] [background-position:0_0,0_4px,4px_-4px,-4px_0px] [background-size:8px_8px] fk:dark:bg-[#222] dark:[--asset-checker:#2a2a2a]";function ar({value:e}){return Array.isArray(e)?jsx(Wi,{value:e}):jsx(Xi,{value:e})}function Xi({value:e}){let t=e?.path??"",n=!!t,r=n&&/\.(png|jpe?g|gif|webp|avif|svg)$/i.test(t),o=a=>{let[l]=a.split("?"),d=l.split(".");return d.length>1?d.pop().toLowerCase():"file"},i=n?t.endsWith(".svg")?`${c$3}${t}`:`${c$3}${t}?w=84&h=84&f=webp`:null,s=n?t.endsWith(".svg")?`${c$3}${t}`:`${c$3}${t}?w=624&h=624&f=webp`:"",u=sr(i);return n?jsx("div",{className:"fk:z-10",children:r?jsxs(b$4,{children:[jsx(c$1,{asChild:true,children:jsx("img",{alt:"asset",className:`fk:w-7 fk:h-7 fk:cursor-zoom-in fk:overflow-hidden fk:rounded-md fk:object-contain ${Ot} fk:corner-squircle`,decoding:"async",src:u??void 0})}),jsx(d,{children:jsx(e$2,{children:jsx("img",{alt:"asset",className:`fk:w-52 fk:h-52 fk:overflow-hidden fk:rounded-md fk:object-contain ${Ot} fk:corner-squircle`,decoding:"async",src:s})})})]}):jsxs(b$4,{children:[jsx(c$1,{asChild:true,children:jsx("div",{className:"fk:w-7 fk:h-7 fk:rounded-sm fk:bg-transparent fk:flex fk:items-center fk:justify-center fk:[&>svg]:h-full fk:[&>svg]:w-auto fk:corner-squircle",children:(()=>{let a=o(t),l=defaultStyles[a];return jsx(FileIcon,{extension:a,...l||{}})})()})}),jsx(d,{children:jsx(e$2,{children:jsx("div",{className:"fk:text-sm fk:text-muted-foreground",children:"Preview not available"})})})]})}):null}function Wi({value:e}){let t=e.filter(o=>!!o.path).slice(0,3),n=Math.max(e[0]?.totalCount??0,e.length);if(t.length===0)return n>0?jsx("div",{className:"fk:flex fk:items-center",children:jsx("span",{className:"fk:text-xs fk:text-muted-foreground",children:n===1?"1 asset":`${n} assets`})}):null;let r=n-t.length;return jsxs("div",{className:"fk:flex fk:items-center",children:[jsx("div",{className:"fk:flex fk:-space-x-2",children:t.map(o=>jsx("img",{alt:"asset",className:`fk:h-7 fk:w-7 fk:overflow-hidden fk:rounded-md fk:object-contain ${Ot} fk:corner-squircle`,decoding:"async",src:`${c$3}${o.path}?w=84&h=84&f=webp`},o._id))}),r>0?jsxs("span",{className:"fk:ml-2 fk:text-xs fk:text-muted-foreground",children:["+",r]}):null]})}function Nt({value:e}){if(e==null||e===""||typeof e!="string")return jsx(X,{value:""});let t=new Date(e);if(!isValid(t))return jsx(X,{value:""});let n=format(t,"MMM d, yyyy")+" at "+format(t,"HH:mm");return jsx(X,{value:n})}function Yi(e){return "groupLabel"in e}function Zi(e){return e.flatMap(t=>Yi(t)?t.items:[t])}function es(e,t){if(!t)return e;let n=Zi(t).find(r=>String(r.value)===e);return n?n.label:e}function cr({value:e,options:t}){if(e==null)return jsx(X,{value:""});let n=String(e),r=es(n,t?.list);return jsx(X,{value:r})}function fr({value:e}){return !e||!e.split(",").length?null:jsx("div",{className:"fk:flex fk:flex-wrap fk:gap-1 fk:max-w-full truncate",children:e.split(",").map(t=>jsx(b$5,{className:"fk:px-2.5 fk:py-0 fk:font-normal fk:text-[0.6875rem] fk:leading-4",variant:"secondary",children:t},t))})}function pr(e,t=5){let n=Number.isFinite(t)&&t>=1?Math.floor(t):5,r=typeof e=="string"&&e.trim()!==""?Number(e):e;if(typeof r!="number"||!Number.isFinite(r))return null;let o=Math.min(n,Math.max(0,Math.round(r)));return {filled:o,max:n,label:`${String(o)} out of ${String(n)} stars`}}function mr({value:e,options:t}){let n=pr(e,t?.max);return n?jsx("span",{"aria-label":n.label,className:"fk:inline-flex fk:items-center fk:gap-0.5",role:"img",title:n.label,children:Array.from({length:n.max},(r,o)=>jsx(Star,{"aria-hidden":true,className:o<n.filled?"fk:h-3.5 fk:w-3.5 fk:fill-amber-400 fk:text-amber-400":"fk:h-3.5 fk:w-3.5 fk:fill-transparent fk:text-muted-foreground/40",strokeWidth:1.5},o))}):jsx("span",{})}var ns=/\.(png|jpe?g|gif|webp|avif|svg)$/i;function gr(e){try{let{pathname:t}=new URL(e);return t.split("/").pop()||t}catch{let[t]=e.split("?");return t}}function hr(e){return e.originalFilename?e.originalFilename:e.path?e.path:e.url?gr(e.url):""}function yr(e){let t=hr(e),[n]=t.split("?"),r=n.split(".");return r.length>1?r.pop().toLowerCase():"file"}function kr(e){return e.mimeType?e.mimeType.startsWith("image/"):ns.test(hr(e))}function Qt(e,t){if(!e||!t||gr(e).toLowerCase().endsWith(".svg"))return e;let n=new URLSearchParams({f:"webp",h:String(t.height),w:String(t.width)}),r=e.includes("?")?"&":"?";return `${e}${r}${n.toString()}`}var ss=FileIcon,br="fk:bg-[#fafafa] [--asset-checker:#f0f0f0] [background-image:linear-gradient(45deg,var(--asset-checker)_25%,transparent_25%),linear-gradient(-45deg,var(--asset-checker)_25%,transparent_25%),linear-gradient(45deg,transparent_75%,var(--asset-checker)_75%),linear-gradient(-45deg,transparent_75%,var(--asset-checker)_75%)] [background-position:0_0,0_4px,4px_-4px,-4px_0px] [background-size:8px_8px] fk:dark:bg-[#222] dark:[--asset-checker:#2a2a2a]";function Sr({value:e}){let[t,n]=useState(false),r=e?.url??"";if(!e||!r&&!e.path&&!e.originalFilename)return null;if(!(kr(e)&&!!r)){let a$1=yr(e),l=defaultStyles[a$1];return jsx("div",{className:"fk:z-10",children:jsx(a,{children:jsxs(b$4,{children:[jsx(c$1,{asChild:true,children:jsx("div",{className:"fk:w-7 fk:h-7 fk:rounded-sm fk:bg-transparent fk:flex fk:items-center fk:justify-center fk:[&>svg]:h-full fk:[&>svg]:w-auto fk:corner-squircle",children:jsx(ss,{extension:a$1,...l||{}})})}),jsx(d,{children:jsx(e$2,{children:jsx("div",{className:"fk:text-sm fk:text-muted-foreground",children:"Preview not available"})})})]})})})}let i$1=Qt(r,{width:84,height:84}),s=Qt(r,{width:624,height:624});function u(a){a.stopPropagation(),n(true);}return jsx("div",{className:"fk:z-10",children:jsxs(a,{children:[jsxs(b$4,{children:[jsx(c$1,{asChild:true,children:jsx("img",{src:i$1,alt:"asset",className:`fk:w-12 fk:h-12 fk:cursor-zoom-in fk:overflow-hidden fk:rounded-md fk:object-contain ${br} fk:corner-squircle`,onClick:u})}),jsx(d,{children:jsx(e$2,{children:jsx("img",{src:s,alt:"asset",className:`fk:w-52 fk:h-52 fk:overflow-hidden fk:rounded-md fk:object-contain ${br} fk:corner-squircle`})})})]}),jsx(c$2,{open:t,onOpenChange:n,children:jsxs(h$2,{className:"fk:sm:max-w-4xl fk:p-3",children:[jsxs(i,{children:[jsx(k,{className:"fk:sr-only",children:"Asset preview"}),jsx(l,{className:"fk:sr-only",children:"Enlarged asset preview"})]}),jsx("img",{src:r,alt:"asset",className:"fk:max-h-[85vh] fk:w-full fk:overflow-hidden fk:rounded-md fk:object-contain fk:corner-squircle"})]})})]})})}var as=new Set(["text","number","datetime","switch","select"]);function su({attributesSchema:e,checkboxSelect:t,actionsComponent:n,enableColumnSorting:r=false}){let[,o$1]=h$1(),i=b$3(e,o$1.user?.spaces),s={datetime:"datetime",editor:"editor",asset:"asset",number:"text",relationship:"text",select:"select",switch:"boolean",text:"text",textarea:"text"},u={boolean:Mt,date:ve,datetime:Nt,editor:rr,asset:ar,number:ve,relationship:ve,select:cr,switch:Mt,text:ve,textarea:ve,tags:fr,rating:mr,assetPreviewField:Sr},a=i.map(c=>{if(c.name==="_updatedAt")return null;let y=(c.inputType==="relationship"&&c.relationship?.entity==="_asset"?"asset":void 0)??c.previewType??s[c.inputType],k=u[y]??u.text;if(c.hidden===true)return null;let S=y==="tags",g=r&&c.scope==="global"&&as.has(c.inputType);return {accessorKey:c.name,filterFn:(h,b,v)=>S?true:(Array.isArray(v)?v:[v]).includes(h.getValue(b)),header:({column:h})=>g?jsx(_t,{column:h,title:c.label}):jsx("div",{className:"fk:flex fk:items-center",children:c.label}),cell:({row:h})=>{let b=k;return y==="select"||y==="rating"?jsx(b,{value:h.getValue(c.name),options:c.options}):y==="assetPreviewField"?jsx(b,{value:h.original}):jsx(b,{value:h.getValue(c.name)})},enableSorting:g,enableHiding:true,meta:{label:c.label},size:c.options?.size??150}}).filter(c=>c!==null),l={id:"actions",cell:({row:c})=>n?n(c):null,size:80},d={accessorKey:"_updatedAt",header:({column:c})=>r?jsx(_t,{column:c,title:"Updated At"}):jsx("div",{className:"fk:flex fk:items-center",children:"Updated At"}),cell:({row:c})=>jsx(Nt,{value:c.getValue("_updatedAt")}),enableSorting:r,enableHiding:false,meta:{label:"Updated At"},size:220},p={id:"select",cell:({row:c,table:y})=>jsx(o,{"aria-label":"Select row",checked:c.getIsSelected(),onCheckedChange:k=>{y.toggleAllPageRowsSelected(false),c.toggleSelected(!!k);}}),enableSorting:false,enableHiding:false,size:50},f={id:"select",header:({table:c})=>jsx(o,{className:"fk:dark:bg-white/15","aria-label":"Select all",checked:c.getIsAllPageRowsSelected()||c.getIsSomePageRowsSelected()&&"indeterminate",onCheckedChange:y=>{c.toggleAllPageRowsSelected(!!y);}}),cell:({row:c})=>jsx(o,{"aria-label":"Select row",checked:c.getIsSelected(),onCheckedChange:y=>{c.toggleSelected(!!y);}}),enableSorting:false,enableHiding:false,size:50};return [...t==="single"?[p]:[],...t==="multiple"?[f]:[],...n?[l]:[],...a,d]}export{$a as A,Ca as B,La as C,Na as D,tr as E,hr as F,yr as G,kr as H,Qt as I,_t as J,su as K,un as a,dn as b,Cr as c,ms as d,nt as e,gn as f,gs as g,hs as h,ys as i,ks as j,bs as k,Ss as l,re as m,As as n,Ns as o,Vs as p,Qs as q,fo as r,Ce as s,Ds as t,Ws as u,ea as v,sa as w,Vn as x,ba as y,wa as z};//# sourceMappingURL=chunk-TOY7ZRK2.js.map
384
+ //# sourceMappingURL=chunk-TOY7ZRK2.js.map