@flexkit/studio 0.2.12 → 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 (68) 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-EKOGKEFR.js → chat-page-B2IOPTUP.js} +3 -3
  5. package/dist/{chat-page-EKOGKEFR.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-BOXFB6E6.js → chunk-C5Y6OZFR.js} +2 -2
  9. package/dist/{chunk-BOXFB6E6.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-OFJOZMCR.js → chunk-CJGP4Y5Y.js} +2 -2
  13. package/dist/{chunk-OFJOZMCR.js.map → chunk-CJGP4Y5Y.js.map} +1 -1
  14. package/dist/{chunk-C47FNPLK.js → chunk-CWJWOJRO.js} +3 -3
  15. package/dist/{chunk-C47FNPLK.js.map → chunk-CWJWOJRO.js.map} +1 -1
  16. package/dist/{chunk-2AVINVYN.js → chunk-DJPVRAFE.js} +22 -20
  17. package/dist/{chunk-7IHEL6LU.js → chunk-ETQ3Q472.js} +2 -2
  18. package/dist/{chunk-7IHEL6LU.js.map → chunk-ETQ3Q472.js.map} +1 -1
  19. package/dist/{chunk-EWBEPYML.js → chunk-KNESQOI5.js} +3 -3
  20. package/dist/{chunk-EWBEPYML.js.map → chunk-KNESQOI5.js.map} +1 -1
  21. package/dist/{chunk-QQSI7BPK.js → chunk-N53TGGN5.js} +3 -3
  22. package/dist/{chunk-QQSI7BPK.js.map → chunk-N53TGGN5.js.map} +1 -1
  23. package/dist/chunk-TOY7ZRK2.js +384 -0
  24. package/dist/chunk-TOY7ZRK2.js.map +1 -0
  25. package/dist/{chunk-F2DHCPWW.js → chunk-VPTDAFFZ.js} +2 -2
  26. package/dist/{chunk-F2DHCPWW.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-DOTORSUC.js.map → list-4NZLZRX3.js.map} +1 -1
  39. package/dist/nextjs.js +1 -1
  40. package/dist/{pages-ILAXYS2J.js → pages-7MFZAVLV.js} +4 -4
  41. package/dist/{pages-ILAXYS2J.js.map → pages-7MFZAVLV.js.map} +1 -1
  42. package/dist/{plugin-pages-RKJRHKNL.js → plugin-pages-RNB46YPQ.js} +2 -2
  43. package/dist/{plugin-pages-RKJRHKNL.js.map → plugin-pages-RNB46YPQ.js.map} +1 -1
  44. package/dist/{root-JB3NZZNZ.js → root-4XPMKRHZ.js} +5 -5
  45. package/dist/{root-JB3NZZNZ.js.map → root-4XPMKRHZ.js.map} +1 -1
  46. package/dist/{root-RE3ZNXQ3.js → root-5RDJ2HAV.js} +2 -2
  47. package/dist/{root-RE3ZNXQ3.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-76YQTZUI.js.map → root-OHZDY47O.js.map} +1 -1
  52. package/dist/{search-WUO6VWKU.js → search-OWF3LEWH.js} +2 -2
  53. package/dist/{search-WUO6VWKU.js.map → search-OWF3LEWH.js.map} +1 -1
  54. package/dist/{skills-pages-POKCFHOL.js → skills-pages-VCXZFQFD.js} +2 -2
  55. package/dist/{skills-pages-POKCFHOL.js.map → skills-pages-VCXZFQFD.js.map} +1 -1
  56. package/dist/tanstack-start.js +1 -1
  57. package/package.json +11 -7
  58. package/dist/activity-nav-button-LZESIQL2.js +0 -2
  59. package/dist/chunk-6YOVF2AD.js +0 -384
  60. package/dist/chunk-6YOVF2AD.js.map +0 -1
  61. package/dist/chunk-ACS3TGGP.js +0 -2
  62. package/dist/chunk-ACS3TGGP.js.map +0 -1
  63. package/dist/chunk-HYSTMQD7.js +0 -2
  64. package/dist/chunk-HYSTMQD7.js.map +0 -1
  65. package/dist/list-DOTORSUC.js +0 -2
  66. package/dist/root-76YQTZUI.js +0 -2
  67. package/dist/root-A4VHAEK5.js +0 -23
  68. package/dist/root-A4VHAEK5.js.map +0 -1
@@ -1,384 +0,0 @@
1
- import'./index.css';import {e}from'./chunk-P6BZ4QP7.js';import {b as b$2}from'./chunk-2DXR5NJV.js';import {b,f,c}from'./chunk-C47FNPLK.js';import {h as h$1,c as c$3}from'./chunk-TYDYAOQ7.js';import {Rc,Sc,Tc,_,$,ca,da,aa,ea,o}from'./chunk-YCCFUGWJ.js';import {c as c$2,h as h$2,i,k,l,b as b$4}from'./chunk-32ZU4MLE.js';import {e as e$1,g,h,j}from'./chunk-SZEGGBOC.js';import {a,b as b$3,c as c$1,d,e as e$2}from'./chunk-USNXQOMJ.js';import {b as b$1}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 ln=25,Ar=3,un=3,Er=["id","string"],Tr=["date","datetime","duration","time"],yt=`_id
2
- originalFilename
3
- mimeType
4
- path
5
- url
6
- size
7
- height
8
- width
9
- lqip`,kt=`_id
10
- originalFilename
11
- mimeType
12
- path
13
- url
14
- size
15
- height
16
- width`,wr=`_id
17
- path
18
- url`;function De(e){return e?R(e)==="relationship"&&e.relationship?.mode==="multiple"&&e.relationship.entity==="_asset":false}function bt(e,t){return !e||!De(e)?false:t?.name!==c.name||e.name!=="assets"}function et(e){return e?.dataType==="asset"||e?.inputType==="asset"}function cn(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 $r(e){return e.reduce((t,n,r)=>n._id?{...t,[n._id]:n.sortOrder??r}:t,{})}function ae(e){return Array.isArray(e)?e[0]??null:e??null}function Cr(e,t){return t?wr:e?yt:kt}function dn(e,t=true,n=true,r=ln,o=false){let i=t?` properties {
19
- sortOrder
20
- }
21
- `:"",s=Cr(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 fn(e){return e?.aggregate?.count?.nodes??0}function pn(e,t){let n=e[`${t}Total`];return typeof n=="number"?n:fn(e[`${t}Connection`])}function St(e,t=""){return ` ${e}Connection${t} {
34
- aggregate {
35
- count {
36
- nodes
37
- }
38
- }
39
- }
40
- `}function xr(e,t,n){return t?n==="total"?` ${e}Total
41
- `:St(e,"(where: $where)"):""}function vr(e,t,n,r=false){if(!e)return "";let o=t==="default"?"":`${t}
42
- `;if(et(e))return r?` ${e.name} {
43
- _id
44
- path
45
- url
46
- }
47
- `:` ${e.name} {
48
- ${yt}
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 Rr(e,t,n){return e?.attributes.reduce((r,o)=>{let i=t==="default"?"":`${t}
65
- `;if(et(o))return `${r}
66
- ${o.name} {
67
- ${kt}
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: ${un}, offset: 0) {
84
- ${o.relationship.field} ${a}}
85
- `}return `${r}
86
- ${o.name}
87
- `},"")??""}function _r(e){let t={};for(let n of e)t[n.name]=n;return t}function gt(e){return e?e.name==="url"?true:!(e.hidden===true||e.name==="lqip"):false}function ps(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 tt(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=te(n,e$1),d=l?.name??e$1,p=e(l),f=o==="display"?p?[p]:[]:l?.attributes??[],c=_r(f),h=`$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 A=D("global",f).filter(E=>E==="_updatedAt"?false:i==="list"?o==="display"||gt(c[E]):true).join(`
88
- `),m=Ie(f).filter(E=>i!=="list"||o==="display"||gt(c[E])),g=D(["local"],f).filter(E=>i!=="list"?true:o==="display"||gt(c[E])),S=g.reduce((E,w)=>`${E}
89
- ${w} {
90
- _id
91
- default
92
- }
93
- `,""),v=g.reduce((E,w)=>`${E}
94
- ${w} {
95
- _id
96
- default
97
- ${t}
98
- }
99
- `,""),L=t==="default"?S: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 q=m.reduce((E,w)=>`${E}
110
- ${w} {
111
- ${T}
112
- }
113
- `,""),K=f.filter(E=>R(E)==="relationship").reduce((E,w)=>{if(i==="list"&&o!=="display"&&w.hidden===true)return E;if(De(w))return `${E}
114
- ${dn(w.name,bt(w,l),i!=="list",i==="list"?Ar:ln,i==="list")}`;let j=find(propEq(w.relationship?.entity,"name"))(n);if(i==="list"){let G=e(j),Y=vr(G,t,n,true),pe=w.relationship?.mode==="single"?1:3;return `${E}
115
- ${w.name} (limit: ${pe}, offset: 0) {
116
- _id
117
- ${Y} }
118
- `}let z=Rr(j,t,n);return `${St(w.name).trim()}${E}
119
- ${w.name} (limit: 25, offset: 0) { _id ${z}}
120
- `},"");return {queryEntityName:e$1,query:`query ${k}(${h}) {
121
- `+xr(e$1,s,u)+` ${e$1}${a} {
122
- _id
123
- _updatedAt
124
- ${A} ${L} ${q} ${K}}
125
- }
126
- `}}function mn(e$1,t,n,r){let i=te(r,e$1)?.attributes??[];if(i.length===0)return {count:0,results:[]};let s=pn(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 h=ae(c[f]);return h?.[t]??h?.default}).join(", ")},l=u.map(d=>{let{_id:p}=d,f=typeof d._updatedAt=="string"?d._updatedAt:"",c=D("global",i).filter(m=>m!=="_updatedAt").reduce((m,g)=>({...m,[g]:d[g]}),{}),h=D("local",i).reduce((m,g)=>{let S=ae(d[g]);return {...m,[g]:S?.[t]?S[t]:S?.default}},{}),k=Ie(i).reduce((m,g)=>({...m,[g]:ae(d[g])}),{}),A=D(["relationship"],i).reduce((m,g)=>{let S=find(propEq(g,"name"))(i),v=S.relationship?.entity??"",L=find(propEq(v,"name"))(r),T=e(L),q=d[g];if(De(S)){let j=cn(d[`${g}Connection`]);return {...m,[g]:j}}if(!T)throw new Error(`There is an error in the schema for the relationship attribute "${g}"`);let oe=T.name,K=R(T);if(S.relationship?.mode==="multiple"){let j=Array.isArray(q)?q:[];return {...m,[g]:a(j,T)}}let E=ae(q);if(K==="global")return {...m,[g]:E?.[oe]};let w=ae(E?.[oe]);return {...m,[g]:w?.[t]??w?.default}},{});return {_id:p,...c,...h,...k,...A,_updatedAt:f}});return {count:s,results:l}}function gn(e,t,n,r){let i=te(r,e)?.attributes??[];if(i.length===0)return {count:0,results:[]};let s=pn(n,e),a=n[e].map(l=>{let d=D("global",i).reduce((h,k)=>({...h,[k]:{value:l[k],disabled:false,scope:"default",_id:""}}),{}),p=D("local",i).reduce((h,k)=>{let A=find(propEq(k,"name"))(i),m=ae(l[k]);return {...h,[k]:{value:m?Lr(m,t):null,disabled:!!(m&&m[t]===null&&R(A)==="local"&&t!=="default"),scope:t,_id:m?m._id:null}}},{}),f=Ie(i).reduce((h,k)=>({...h,[k]:{value:ae(l[k]),disabled:false,scope:"default",_id:""}}),{}),c=D(["relationship"],i).reduce((h,k)=>{let A=find(propEq(k,"name"))(i),m=l[k],g=A.relationship?.mode==="single"?ae(m):m,S=g?._id,v=fn(l[`${k}Connection`]);if(De(A)){let L=cn(l[`${k}Connection`]);return {...h,[k]:{count:v,_id:S,knownAssetSortOrders:$r(L),value:L,disabled:false,scope:t}}}return {...h,[k]:{count:v,_id:S,value:g,disabled:false,scope:t}}},{});return {...d,...p,...f,...c}});return {count:s,results:a}}function Lr(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 ms(e,t,n,r,o,i,s){let u=te(r,e),a=u?.name??e,l=u?.attributes??[],d=Fe(e);if(l.length===0)return "";let p=hn(l,i),f=yn(l,p),c=Ir(t,l,p,n),h=Mr(l,o,p),k=Fr(l,o,p),A=e,m=s?.responseFields??bn(r,e,n);return `mutation ${`Update${J(e)}`}($where: ${a}Where) {
127
- update${d}(
128
- where: $where
129
- update: {${f}${c}${h}${k}
130
- }
131
- ) {
132
- ${A} {
133
- _id
134
- ${m} }
135
- }
136
- }
137
- `}function hn(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 Ie(e){return e.filter(et).map(n=>n.name)}function yn(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=At(a.dataType,l);return n==="create"&&(d===null||d==="")?i:n==="update"?`${i}
138
- ${s}: { set: ${d} }`:`${i}
139
- ${s}: ${d}`},"")}function ht(e){return !e?._id||!e.path?"":e._id}function Mr(e,t,n){let r=pick(Ie(e),n);return toPairs(r).reduce((s,[u,a])=>{let l=ht(a.value),d=ht(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 Dr(e,t){let n=pick(Ie(e),t);return toPairs(n).reduce((i,[s,u])=>{let a=ht(u.value);return a?`${i}
160
- ${s}: {
161
- connect: [{
162
- where: {
163
- node: {
164
- _id: { eq: ${M(a)} }
165
- }
166
- }
167
- }]
168
- }`:i},"")}function Ir(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":At(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 Fr(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 h=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
- ${h}${k} ]`}if(d==="relationship"&&p?.mode==="multiple"){if(p.entity==="_asset")return `${s}${Or(u,t[u],a)}`;let f=uniq(a.relationships?.disconnect??[]).filter(Boolean),h=(a.relationships?.connect??[]).map(m=>M(m._id)).join(", "),k=f.length?` {
205
- disconnect: [
206
- ${f.map(m=>` {
207
- where: {
208
- node: {
209
- _id: { eq: ${M(m)} }
210
- }
211
- }
212
- }
213
- `).join("")} ]
214
- }
215
- `:"",A=h?` {
216
- connect: [{
217
- where: {
218
- node: {
219
- _id: { in: [${h}] }
220
- }
221
- }
222
- }]
223
- }
224
- `:"";return !k&&!A?s:`${s}
225
- ${u}: [
226
- ${k}${A} ]`}return `${s}
227
- `},"")}function Or(e,t,n){let o=(n.relationships?.connect??[]).map((c,h)=>({...c,sortOrder:c.sortOrder??h})),i=o.map(c=>c._id),s={...Pr(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 h=s[c._id];return h!==void 0&&h!==c.sortOrder}),d=Nr(u),p=Vr(a),f=Qr(l);return !d&&!p&&!f?"":`
228
- ${e}: [
229
- ${d}${p}${f} ]`}function Pr(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 Nr(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 Vr(e){return e.length===0?"":` {
237
- connect: [
238
- ${kn(e)} ]
239
- }
240
- `}function kn(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 Qr(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 At(e,t){return Tr.includes(e)?t?.toString()?M(t.toString()):null:Er.includes(e)?t==null?null:M(t.toString()):t==null||t===""?null:t.toString()}function M(e){return JSON.stringify(e)}function bn(e,t,n){let r=te(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(De(p))return `${l}${dn(d,bt(p,r))}`;let c=p?.relationship?.entity??"",k=find(propEq(c,"name"))(e)?.attributes??[],A=p?.relationship?.field??"[invalid_relationship_field_name_in_schema]",m=find(propEq(A,"name"))(k),g=R(m),S="";if(f==="single"&&(g==="global"&&(S=` ${d} {
256
- _id
257
- ${A}
258
- }
259
- `),g==="local"&&(S=` ${d} {
260
- _id
261
- ${A} {
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 q=n==="default"?"":`${n}
273
- `,oe=find(propEq(T.relationship?.entity,"name"))(e),K=find(propEq(T.relationship?.field,"name"))(oe?.attributes??[]),E=R(K)==="local"?`{
274
- _id
275
- default
276
- ${q}}
277
- `:"";if(T.relationship?.mode==="single")return `${L} ${T.name} {
278
- ${T.relationship.field} ${E}}
279
- `;if(T.relationship?.field)return `${L} ${T.name} (limit: ${un}, offset: 0) {
280
- ${T.relationship.field} ${E}}
281
- `}return et(T)?`${L} ${T.name} {
282
- ${kt}
283
- }
284
- `:`${L} ${T.name}
285
- `},"");S=St(d)+` ${d} (limit: 25, offset: 0) {
286
- ${v} }
287
- `;}return `${l}${S}`},""),a}function gs(e,t,n){let r=typeof n=="string"?[n]:[...n],o=find(propEq(e,"name"))(t),i=o?.attributes??[],s=Fe(o?.plural??""),u=Ur(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 hs(e){let t=typeof e=="string"?[e]:[...e];return t.length===1?{_id:{eq:t[0]}}:{_id:{in:t}}}function Ur(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 ys(e,t,n,r,o){let i=te(t,e),s=i?.attributes??[],u=Fe(i?.plural??"");if(s.length===0)return "";let a=hn(s,n),l=yn(s,a,"create"),d=qr(s,a,"default",r),p=Dr(s,a),f=jr(s,a),c=e,h=bn(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
- ${h} }
324
- }
325
- }
326
- `}function qr(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":At(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 jr(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 A=kn(c.map((m,g)=>({...m,sortOrder:m.sortOrder??g})));return `${i}
345
- ${s}: {
346
- connect: [
347
- ${A} ]
348
- }`}let h=c.map(A=>M(A._id)).join(", "),k=h?`connect: {
349
- where: {
350
- node: {
351
- _id: { in: [${h}] }
352
- }
353
- }
354
- }
355
- `:"";return `${i}
356
- ${s}: {
357
- ${k} }`}return `${i}
358
- `},"")}function ks({relatedEntityName:e,scope:t,schema:n}){let o=find(propEq(e,"name"))(n)?.plural??"";return o?tt(o,t,n,{selection:"list",operationName:`GetRelated${J(o)}`}):{queryEntityName:"",query:""}}function bs({attributeName:e,entityName:t,entityNamePlural:n,schema:r}){let o=te(r,n),i=find(propEq(e,"name"))(o?.attributes??[]),s=bt(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
- ${yt}
372
- }
373
- }
374
- }
375
- }
376
- }
377
- `}}var Fe=e=>e.charAt(0).toUpperCase()+e.slice(1);function J(e){let t=e.split(/[^0-9A-Za-z]+/).filter(Boolean).map(Fe).join("");return t?/^[A-Za-z_]/.test(t)?t:`Entity${t}`:"Entity"}function te(e,t){return t==="_assets"?b:find(propEq(t,"plural"))(e)}function Ss(e,t,n){if(!e||typeof e!="object")return {};let r=te(n,t);if(!r)return {};let o=`update${Fe(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=ae(u[l.name])?._id;return typeof p!="string"||p.length===0?a:{...a,[l.name]:p}},{})}function En(e){return e?"cause"in e:false}function ke(e){if(!e)return null;if(ServerError.is(e))return e;if(En(e)){let t=e.cause;if(ServerError.is(t))return t}return null}function Tn(e){if(!e||typeof e!="object")return null;let{message:t}=e;return typeof t=="string"?t:null}function be(e){if(!e)return null;try{return JSON.parse(e)}catch{return null}}function nt(e){if(!e)return null;let t=$n(e).filter(n=>!Gr(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 wn(e,t){return e?$n(e).some(n=>n.includes(`Cannot query field "${t}"`)):false}function $n(e){if(CombinedGraphQLErrors.is(e))return e.errors.filter(An).map(({message:o})=>o);let t=Tn(e);if(t&&Oe(t))return [t];let n=ke(e);if(n?.statusCode!==400)return [];let r=be(n.bodyText)??zr(n)??Hr(e);return r?Array.isArray(r.errors)?r.errors.filter(An).map(o=>o.message):typeof r.message=="string"&&Oe(r.message)?[r.message]:typeof r.error=="string"&&Oe(r.error)?[r.error]:[]:[]}function zr(e){let{result:t}=e;return !t||typeof t!="object"?null:t}function Hr(e){if(!En(e))return null;let{cause:t}=e,n=Tn(t);if(n&&Oe(n))return {message:n};if(!t||typeof t!="object")return null;let{result:r}=t;return r&&typeof r=="object"?r:null}function An(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"&&Oe(n)}function Oe(e){return e.startsWith("Cannot query field ")||e.startsWith("Unknown type ")||e.startsWith('Cannot query field "')||e.includes("GRAPHQL_VALIDATION_FAILED")}function Gr(e){return /Cannot query field "[_A-Za-z][_0-9A-Za-z]*Total" on type "Query"/.test(e)}var so=ApolloProvider,vn=createContext(void 0);function $e(){let e=useContext(vn);if(!e)throw new Error("useGraphQLError must be used within GraphQLProvider");return e}function ao(e){return new ErrorLink(({error:t})=>{let n=nt(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=ke(t);if(r?.statusCode===400){let o=be(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 lo(e,t){return from([ao(t),new HttpLink({uri:`/api/flexkit/${e}/graphql`})])}function uo(e,t){return new ApolloClient({link:lo(e??"",t),cache:new InMemoryCache({dataIdFromObject:n=>n._id?n._id:defaultDataIdFromObject(n)})})}function Ms({children:e}){let{currentProjectId:t}=f(),[n,r]=useState(null),o=useMemo(()=>({schemaErrorMessage:n,setSchemaErrorMessage:r}),[n]),i=useMemo(()=>uo(t,r),[t]);return jsx(vn.Provider,{value:o,children:jsx(so,{client:i,children:e})})}var rt=null,Et=new Set,Rn=[],Tt=new Set,wt=new Set,$t=new Set;function Ps(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 _n(e){return Tt.add(e),()=>{Tt.delete(e);}}function Ln(e){return wt.add(e),()=>{wt.delete(e);}}function Mn(e){return $t.add(e),()=>{$t.delete(e);}}function Ns(e,t,n){let r=new Set(n.filter(Boolean));if(r.size>0)for(let o of wt)o(t,r);return co(e,t)}function Vs(e,t){let n=t.filter(r=>!!r._id);if(n.length!==0)for(let r of $t)r(e,n);}function co(e,t){return Et.add(t),new Promise((n,r)=>{Rn.push({resolve:n,reject:r}),rt&&clearTimeout(rt),rt=setTimeout(()=>{let o=new Set(Et),i=Rn.splice(0);Et.clear(),rt=null,Promise.all([...Tt].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 Xs({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,h]=useState(null),k=useRef(false),A=useRef(false),m=useRef(0),g=useRef(null),S=useRef(null),v=`${e}Total`,L=te(t,e),q=r?.where===void 0&&(L?.spaces?.length??0)===0&&(c?.field!==v||c.schema!==t)?"total":"aggregate",oe=useMemo(()=>gql(tt(e,n,t,{selection:i,countMode:q,includeCount:s}).query),[e,n,t,i,q,s]),K=useMemo(()=>gql(tt(e,n,t,{selection:i,includeCount:false}).query),[e,n,t,i]),{schemaErrorMessage:E,setSchemaErrorMessage:w}=$e(),{loading:j,data:z,fetchMore:G,refetch:Y,error:pe,networkStatus:me}=useQuery(oe,{variables:r,notifyOnNetworkStatusChange:true}),ve=useRef(G),Z=useRef(Y),Re=useRef(K),ee=useRef(me),ge=useRef(r);ve.current=G,Z.current=Y,Re.current=K,ge.current=r;let _e=s&&wn(pe,v),ie=q==="total"&&_e,B=_e?void 0:pe,le=_e&&!z?.[e],he=ke(B),H=nt(B),{isProjectDisabled:je,isProjectReadOnly:Be}=(()=>{if(he?.statusCode===403){let $=be(he.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(()=>{ie&&h({field:v,schema:t});},[t,ie,v]);let ze=useCallback($=>{if(k.current||A.current)return;k.current=true,d(true);let{limit:N}=$.variables,V=m.current;ve.current({...$,query:Re.current,variables:{...ge.current,...$.variables,offset:V,limit:N}}).then(({data:se})=>{let Q=Ne({data:se,entityNamePlural:e,isForm:o,schema:t,scope:n}),y=Q.results.length;m.current=V+(y===0?0:Math.min(y,N)),a(b=>{let O=uniqBy(prop("_id"),[...b.results,...Q.results]);return O.length===b.results.length?{count:b.results.length,results:b.results}:{count:Q.count||b.count,results:O}});}).catch(se=>{console.error("Error fetching more data:",se);}).finally(()=>{k.current=false,d(false);});},[e,o,t,n]),Le=useCallback($=>{if(A.current)return Promise.resolve();let N=$?.preserve===true;return A.current=true,k.current=false,d(false),N||(g.current=null,S.current=null,m.current=0,f(true),a({count:0,results:[]})),Z.current().then(({data:V})=>{let se=JSON.stringify({entityNamePlural:e,scope:n,selection:i,includeCount:s,variables:r}),Q=Ne({data:V,entityNamePlural:e,isForm:o,schema:t,scope:n});g.current=se,S.current=null,m.current=it(r)+Q.results.length,a(Q);}).catch(V=>{console.error("Error reloading data:",V);}).finally(()=>{A.current=false,f(false);})},[e,o,t,n,i,s,r]);return useEffect(()=>{if(H){w(H);return}z&&E&&!B&&w(null);},[z,B,E,H,w]),useEffect(()=>{if(B||H||le)return;let $=JSON.stringify({entityNamePlural:e,scope:n,selection:i,includeCount:s,variables:r});if(g.current===$)return;if(j&&S.current!==$){S.current=$,m.current=0,a({count:0,results:[]});return}if(j)return;let N=Ne({data:z,entityNamePlural:e,isForm:o,schema:t,scope:n});g.current=$,S.current=null,m.current=it(r)+N.results.length,a(N);},[z,B,e,o,j,le,t,H,n,i,s,r]),useEffect(()=>{let $=ee.current;if(ee.current=me,B||H||A.current||le||$!==NetworkStatus.refetch||me!==NetworkStatus.ready||!z)return;let N=JSON.stringify({entityNamePlural:e,scope:n,selection:i,includeCount:s,variables:r}),V=Ne({data:z,entityNamePlural:e,isForm:o,schema:t,scope:n});g.current=N,S.current=null,m.current=it(r)+V.results.length,a(V);},[z,B,e,o,le,me,t,H,n,i,s,r]),useEffect(()=>{if(o)return;let $=`Get${J(e)}`,N=_n(Q=>{if(!(!Q.has($)||k.current||A.current))return Z.current().then(({data:y})=>{let b=JSON.stringify({entityNamePlural:e,scope:n,selection:i,includeCount:s,variables:r}),O=Ne({data:y,entityNamePlural:e,isForm:o,schema:t,scope:n});g.current=b,S.current=null,m.current=it(r)+O.results.length,a(O);}).catch(y=>{console.error("Error soft-refreshing entity list:",y);})}),V=Ln((Q,y)=>{Q===$&&a(b=>{let O=b.results.filter(Qt=>{let Ut=typeof Qt._id=="string"?Qt._id:void 0;return !Ut||!y.has(Ut)}),He=b.results.length-O.length;return He===0?b:{count:Math.max(0,b.count-He),results:O}});}),se=Mn((Q,y)=>{Q===$&&a(b=>go(b,y,r?.sort));});return ()=>{N(),V(),se();}},[e,o,t,n,i,s,r]),{isLoading:j&&me!==NetworkStatus.refetch||p||le,isLoadingMore:l,fetchMore:ze,reload:Le,count:u.count,data:u.results,isProjectDisabled:je,isProjectReadOnly:Be,schemaErrorMessage:E}}function it(e){let t=e?.offset;return typeof t=="number"&&Number.isFinite(t)?t:0}function Ne(e){let t=e.entityNamePlural;return e.data?.[t]?e.isForm?gn(e.entityNamePlural,e.scope,e.data,e.schema):mn(e.entityNamePlural,e.scope,e.data,e.schema):{count:0,results:[]}}function go(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:ho(i,n)}:e}function ho(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 Zs(){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 ia(){let{schemaErrorMessage:e}=$e();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 Nn({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 Co=36,xo=15,vo=2,Un=40;function Bn(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 Ro(e,t){return e??Bn(t)??Co}function ya({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:h,scrollToTopKey:k,sorting:A,toolbarComponent:m}){let g=useRef(null),{schemaErrorMessage:S}=$e(),[v,L]=useState(i??{}),[T,q]=useState({}),[oe,K]=useState([]),[E,w]=useState([]),j=A??E;useEffect(()=>{g.current?.scrollTo({top:0,left:0});},[r,k]),useEffect(()=>{if(!i)return;let y=Object.keys(v).sort().join(","),b=Object.keys(i).sort().join(",");y!==b&&L(i);},[i,v]);function z(y){if(d){d(y);return}w(y);}let G=useReactTable({data:n,columns:t,state:{sorting:j,columnVisibility:T,rowSelection:v,columnFilters:oe},initialState:{pagination:{pageSize:p??50}},enableRowSelection:true,onRowSelectionChange:se,onSortingChange:z,onColumnFiltersChange:K,onColumnVisibilityChange:q,getCoreRowModel:getCoreRowModel(),getFilteredRowModel:getFilteredRowModel(),getPaginationRowModel:getPaginationRowModel(),getSortedRowModel:getSortedRowModel(),getRowId:y=>y._id,manualFiltering:true,manualPagination:true,manualSorting:true,meta:{getRowBackground:y=>Lo(y,h,c)}}),{rows:Y}=G.getRowModel(),pe=Ro(f,e?.row),me=Bn(e?.row)!=null,ve=useVirtualizer({count:Y.length,estimateSize:()=>pe,getItemKey:y=>Y[y]?.id??y,getScrollElement:()=>g.current,overscan:xo,scrollMargin:Un}),Z=G.getVisibleLeafColumns(),Re=G.getHeaderGroups(),ee=Re.length===1,ge=useVirtualizer({horizontal:true,count:Z.length,estimateSize:y=>Z[y].getSize(),getItemKey:y=>Z[y].id,getScrollElement:()=>g.current,overscan:vo,enabled:ee}),_e=JSON.stringify(Z.map(y=>[y.id,y.getSize()]));useEffect(()=>{ge.measure();},[_e,ge]);let ie=ge.getVirtualItems(),B=ee?ie[0]?.index??0:0,le=ee?(ie[ie.length-1]?.index??-1)+1:Z.length,he=ee?ie[0]?.start??0:0,H=ee?Math.max(0,ge.getTotalSize()-(ie[ie.length-1]?.end??0)):0,je=ve.getVirtualItems(),{paddingTop:Be,paddingBottom:ze}=_o(je,ve.getTotalSize(),Un),Le=useRef(a$2),$$1=useRef(o),N=useRef(s);Le.current=a$2,$$1.current=o,N.current=s;let V=useCallback(y=>{if(!Le.current||!$$1.current||N.current)return;let b=y??g.current;b&&Nn(b)&&(N.current=true,Le.current());},[]);useEffect(()=>{V();},[V,Y.length,o,s]);function se(y){let b=Object.keys(typeof y=="function"?y(v):y);L(y),u?.(b);}function Q(y){l?.(y),V(y.currentTarget);}return S?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:[m&&m(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:Q,ref:g,children:[jsx($,{className:"fk:sticky fk:top-0 fk:z-20 fk:grid",children:Re.map(y=>jsxs(ca,{className:"fk:flex fk:w-full",children:[he>0?jsx(ut,{width:he,header:true}):null,(ee?y.headers.slice(B,le):y.headers).map((b,O)=>jsxs(da,{"aria-colindex":ee?B+O+1:void 0,className:a$1("fk:flex fk:shrink-0 fk:items-center",b.column.id==="actions"&&"fk:pl-0"),colSpan:b.colSpan,style:b.getSize()?{width:`${b.getSize().toString()}px`}:{},children:[b.isPlaceholder?null:flexRender(b.column.columnDef.header,b.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]},b.id)),H>0?jsx(ut,{width:H,header:true}):null]},y.id))}),jsx(aa,{className:"fk:grid fk:relative",children:Y.length===0?jsx(ca,{children:jsx(ea,{className:"fk:h-24 fk:text-center",colSpan:t.length,children:"No results."})}):jsxs(Fragment,{children:[Be>0?jsx(qn,{height:Be}):null,je.map(y=>{let b=Y[y.index];return jsxs(ca,{className:a$1(G.options.meta.getRowBackground(b),"fk:flex fk:w-full fk:overflow-hidden fk:transition-none",!me&&f==null&&"fk:h-9",e?.row),"data-index":y.index,"data-state":b.getIsSelected()&&"selected",style:{height:`${pe.toString()}px`},children:[he>0?jsx(ut,{width:he}):null,b.getVisibleCells().slice(B,le).map((O,He)=>jsx(ea,{className:a$1("fk:flex fk:shrink-0 fk:items-center fk:truncate",O.column.id==="actions"&&"fk:pl-1!"),"aria-colindex":B+He+1,style:{width:O.column.getSize()},children:flexRender(O.column.columnDef.cell,O.getContext())},O.id)),H>0?jsx(ut,{width:H}):null]},y.key)}),ze>0?jsx(qn,{height:ze}):null]})})]})})})]})}function _o(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 ut({width:e,header:t=false}){return jsx(t?"th":"td",{"aria-hidden":true,style:{width:e,flexShrink:0,padding:0,border:0}})}function qn({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 Lo(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 Jn=createContext([]),Xn=createContext(()=>{});function Do(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 Ea({children:e}){let[t,n]=useReducer(Do,[]);return jsx(Jn.Provider,{value:t,children:jsx(Xn.Provider,{value:n,children:e})})}function Ta(){return useContext(Jn)}function wa(){return useContext(Xn)}function Ra({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$1,{"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 Oa(){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=ke(l),{isProjectDisabled:p,isProjectReadOnly:f}=(()=>{if(d?.statusCode===403){let c=be(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 Rt({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 Lt({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 Yn=500,Jo=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);},Jo);}}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>Yn?`${e.slice(0,Yn)}\u2026`:e;return jsxs(b$3,{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 xe({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 bi=AIHighlight,Si=Placeholder,Ai=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")}}),Ei=Markdown.configure({html:true,tightLists:true,tightListClass:"tight",bulletListMarker:"-",linkify:false,breaks:false,transformPastedText:false,transformCopiedText:false}),Ti=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")}}),wi=TaskList.configure({HTMLAttributes:{class:cx("fk:not-prose fk:pl-2 ")}}),$i=TaskItem.configure({HTMLAttributes:{class:cx("fk:flex gap-2 fk:items-start fk:my-2")},nested:true}),Ci=HorizontalRule.configure({HTMLAttributes:{class:cx("mt-4 mb-6 border-t border-muted-foreground")}}),xi=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}),vi=CodeBlockLowlight.configure({lowlight:createLowlight(common)}),Ri=Youtube.configure({HTMLAttributes:{class:cx("fk:rounded-lg fk:border fk:border-muted fk:corner-squircle")},inline:false}),_i=Twitter.configure({HTMLAttributes:{class:cx("fk:not-prose")},inline:false}),Li=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}}),Mi=CharacterCount.configure(),er=[xi,Si,Ai,Ti,wi,$i,Ci,bi,vi,Ri,_i,Li,Mi,TiptapUnderline,Ei,HighlightExtension,TextStyle,Color,CustomKeymap,GlobalDragHandle];var Mt;function Pi(){let e=getSchema(er);return {schema:e,textSerializers:getTextSerializersFromSchema(e)}}function tr(e,t=100){if(!e)return "";try{let n=JSON.parse(e);return Mt??=Pi(),getText(Node.fromJSON(Mt.schema,n),{textSerializers:Mt.textSerializers}).substring(0,t)}catch{return e.substring(0,t)}}function nr({value:e}){let t=useMemo(()=>tr(e),[e]);return jsx(X,{value:t})}var rr=250,ji=25e5,re=new Map,Dt=new Map,It=new Set,or=new Map;function ct(e){if(or.has(e))return;let t=new Image;t.decoding="async",t.src=e,or.set(e,t);}function dt(e){let t=re.get(e);t&&re.set(e,{...t,lastUsedAt:Date.now()});}function Bi(){if(re.size<=rr)return;let e=Array.from(re.entries()).sort((n,r)=>n[1].lastUsedAt-r[1].lastUsedAt),t=Math.max(1,Math.ceil(rr*.1));for(let n=0;n<t&&n<e.length;n+=1){let[r,o]=e[n];re.delete(r),URL.revokeObjectURL(o.objectUrl);}}async function zi(e){if(It.has(e)){ct(e);return}if(re.has(e)){dt(e);return}let t=Dt.get(e);if(t){await t;return}let n=(async()=>{try{let r=await fetch(e,{mode:"cors",cache:"force-cache"});if(!r.ok){ct(e);return}let o=await r.blob();if(o.size>ji)return;let i=URL.createObjectURL(o);re.set(e,{objectUrl:i,byteSize:o.size,lastUsedAt:Date.now()}),Bi();}catch(r){r instanceof TypeError&&It.add(e),ct(e);}})();Dt.set(e,n),await n,Dt.delete(e);}function ir(e){let t=useMemo(()=>{if(!e)return null;let o=re.get(e);return o?(dt(e),o.objectUrl):null},[e]),[n,r]=useState(t);return useEffect(()=>{if(!e){r(null);return}if(It.has(e)){ct(e),r(null);return}let o=re.get(e);if(o){dt(e),r(o.objectUrl);return}r(null);let i=false;return zi(e).then(()=>{let s=re.get(e);s&&(i||(dt(e),r(s.objectUrl)));}),()=>{i=true;}},[e]),n}var Ft="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}){return Array.isArray(e)?jsx(Xi,{value:e}):jsx(Ji,{value:e})}function Ji({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=ir(i);return n?jsx("div",{className:"fk:z-10",children:r?jsxs(b$3,{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 ${Ft} 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 ${Ft} fk:corner-squircle`,decoding:"async",src:s})})})]}):jsxs(b$3,{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 Xi({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 ${Ft} 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 Pt({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 Ki(e){return "groupLabel"in e}function Yi(e){return e.flatMap(t=>Ki(t)?t.items:[t])}function Zi(e,t){if(!t)return e;let n=Yi(t).find(r=>String(r.value)===e);return n?n.label:e}function ur({value:e,options:t}){if(e==null)return jsx(X,{value:""});let n=String(e),r=Zi(n,t?.list);return jsx(X,{value:r})}function dr({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$4,{className:"fk:px-2.5 fk:py-0 fk:font-normal fk:text-[0.6875rem] fk:leading-4",variant:"secondary",children:t},t))})}function fr(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 pr({value:e,options:t}){let n=fr(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 ts=/\.(png|jpe?g|gif|webp|avif|svg)$/i;function mr(e){try{let{pathname:t}=new URL(e);return t.split("/").pop()||t}catch{let[t]=e.split("?");return t}}function gr(e){return e.originalFilename?e.originalFilename:e.path?e.path:e.url?mr(e.url):""}function hr(e){let t=gr(e),[n]=t.split("?"),r=n.split(".");return r.length>1?r.pop().toLowerCase():"file"}function yr(e){return e.mimeType?e.mimeType.startsWith("image/"):ts.test(gr(e))}function Vt(e,t){if(!e||!t||mr(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 is=FileIcon,kr="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 br({value:e}){let[t,n]=useState(false),r=e?.url??"";if(!e||!r&&!e.path&&!e.originalFilename)return null;if(!(yr(e)&&!!r)){let a$1=hr(e),l=defaultStyles[a$1];return jsx("div",{className:"fk:z-10",children:jsx(a,{children:jsxs(b$3,{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(is,{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=Vt(r,{width:84,height:84}),s=Vt(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$3,{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 ${kr} 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 ${kr} 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 ss=new Set(["text","number","datetime","switch","select"]);function ou({attributesSchema:e,checkboxSelect:t,actionsComponent:n,enableColumnSorting:r=false}){let[,o$1]=h$1(),i=b$2(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:Lt,date:xe,datetime:Pt,editor:nr,asset:sr,number:xe,relationship:xe,select:ur,switch:Lt,text:xe,textarea:xe,tags:dr,rating:pr,assetPreviewField:br},a=i.map(c=>{if(c.name==="_updatedAt")return null;let h=(c.inputType==="relationship"&&c.relationship?.entity==="_asset"?"asset":void 0)??c.previewType??s[c.inputType],k=u[h]??u.text;if(c.hidden===true)return null;let A=h==="tags",m=r&&c.scope==="global"&&ss.has(c.inputType);return {accessorKey:c.name,filterFn:(g,S,v)=>A?true:(Array.isArray(v)?v:[v]).includes(g.getValue(S)),header:({column:g})=>m?jsx(Rt,{column:g,title:c.label}):jsx("div",{className:"fk:flex fk:items-center",children:c.label}),cell:({row:g})=>{let S=k;return h==="select"||h==="rating"?jsx(S,{value:g.getValue(c.name),options:c.options}):h==="assetPreviewField"?jsx(S,{value:g.original}):jsx(S,{value:g.getValue(c.name)})},enableSorting:m,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(Rt,{column:c,title:"Updated At"}):jsx("div",{className:"fk:flex fk:items-center",children:"Updated At"}),cell:({row:c})=>jsx(Pt,{value:c.getValue("_updatedAt")}),enableSorting:r,enableHiding:false,meta:{label:"Updated At"},size:220},p={id:"select",cell:({row:c,table:h})=>jsx(o,{"aria-label":"Select row",checked:c.getIsSelected(),onCheckedChange:k=>{h.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:h=>{c.toggleAllPageRowsSelected(!!h);}}),cell:({row:c})=>jsx(o,{"aria-label":"Select row",checked:c.getIsSelected(),onCheckedChange:h=>{c.toggleSelected(!!h);}}),enableSorting:false,enableHiding:false,size:50};return [...t==="single"?[p]:[],...t==="multiple"?[f]:[],...n?[l]:[],...a,d]}export{wa as A,Ra as B,Oa as C,er as D,gr as E,hr as F,yr as G,Vt as H,Rt as I,ou as J,ln as a,cn as b,$r as c,ps as d,tt as e,mn as f,ms as g,gs as h,hs as i,ys as j,ks as k,bs as l,te as m,Ss as n,Ps as o,Ns as p,Vs as q,co as r,$e as s,Ms as t,Xs as u,Zs as v,ia as w,ya as x,Ea as y,Ta as z};//# sourceMappingURL=chunk-6YOVF2AD.js.map
384
- //# sourceMappingURL=chunk-6YOVF2AD.js.map