headroom-cms 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/admin/assets/AdminsPage-DYJhlQnA.js +1 -0
- package/admin/assets/AllContentPage-DShBvFru.js +1 -0
- package/admin/assets/{ApiKeysPage-FgNHZPBS.js → ApiKeysPage-DONrd-TJ.js} +1 -1
- package/admin/assets/{AuditPage-DAPpo-sj.js → AuditPage-BwhYu96L.js} +1 -1
- package/admin/assets/{BlockEditor-CZTwex-o.js → BlockEditor-C0KaZUHQ.js} +57 -57
- package/admin/assets/BlockTypeEditPage-BYJfEA6l.js +1 -0
- package/admin/assets/BlockTypesPage-Pf9u78-O.js +1 -0
- package/admin/assets/BulkActionBar-BX-t8fyM.js +1 -0
- package/admin/assets/CollectionEditPage-CQGo9Cbu.js +1 -0
- package/admin/assets/{CollectionsPage-BnCaxALz.js → CollectionsPage-D-QTkoW_.js} +1 -1
- package/admin/assets/{ContentCreatePage-CJI326o-.js → ContentCreatePage-DujNZXXj.js} +1 -1
- package/admin/assets/ContentEditPage-DyqgEoAe.js +3 -0
- package/admin/assets/ContentListPage-llAlhZTH.js +1 -0
- package/admin/assets/{CustomBlockPreview-CCssn6vF.js → CustomBlockPreview-CCiZrZhi.js} +1 -1
- package/admin/assets/FieldBuilder-B3-3MTqp.js +3 -0
- package/admin/assets/{LoginPage-Jrne8-Wr.js → LoginPage-BlJXP0GH.js} +1 -1
- package/admin/assets/MediaPage-Cad4n33B.js +1 -0
- package/admin/assets/SiteSettingsPage-xfAm3ZKQ.js +1 -0
- package/admin/assets/SitesPage-DnCiSu23.js +1 -0
- package/admin/assets/{TagsPage-BGpp0XZM.js → TagsPage-DNlaoFCE.js} +1 -1
- package/admin/assets/UsersPage-D_nOx6W9.js +1 -0
- package/admin/assets/{WebhookEditPage-BOcLe5OJ.js → WebhookEditPage-BUvLl4rY.js} +1 -1
- package/admin/assets/{WebhooksPage-Czco583Y.js → WebhooksPage-CG7WC9Bq.js} +1 -1
- package/admin/assets/{badge-0Z1nL6DI.js → badge-ChZ2DZue.js} +1 -1
- package/admin/assets/{card-D1-S-QZ6.js → card-DpNr7WTb.js} +1 -1
- package/admin/assets/check-BMpruHpO.js +1 -0
- package/admin/assets/{checkbox-BPqrj_XS.js → checkbox-VtCfoGic.js} +1 -1
- package/admin/assets/command-98iA8Va4.js +1 -0
- package/admin/assets/contentStatus-BmaiYVOm.js +1 -0
- package/admin/assets/{copy-BqH9rXYM.js → copy-fXL6Ngxi.js} +1 -1
- package/admin/assets/{core.esm-Csvubn5Q.js → core.esm-BtFZvlg0.js} +1 -1
- package/admin/assets/format-C88SDH8g.js +1 -0
- package/admin/assets/index-CwkwXbO-.js +18 -0
- package/admin/assets/index-FYfbavkE.css +1 -0
- package/admin/assets/plus-2Ds_MoqB.js +1 -0
- package/admin/assets/popover-DFInMOpa.js +1 -0
- package/admin/assets/radix-n1vDIPi6.js +51 -0
- package/admin/assets/search-DRNC6QB5.js +1 -0
- package/admin/assets/select-Cj54Wt-H.js +1 -0
- package/admin/assets/{sortable.esm-Zh-9QRSf.js → sortable.esm-BUhmZW2_.js} +1 -1
- package/admin/assets/{table-B3EHrN_H.js → table-D4rLgOKa.js} +1 -1
- package/admin/assets/{trash-2-Gny2Upn-.js → trash-2-CbbWF_O4.js} +1 -1
- package/admin/assets/use-mobile-Cvl5tIVY.js +1 -0
- package/admin/assets/useAdminResolver-B-_1f6SR.js +1 -0
- package/admin/assets/useContent-Cp41wBYR.js +1 -0
- package/admin/assets/useMedia-DjiNKMOU.js +1 -0
- package/admin/assets/{useTags-CYqbj5cK.js → useTags-BB47vbXO.js} +1 -1
- package/admin/assets/{useWebhooks-DXgtQ3aU.js → useWebhooks-DS4Ee8Wk.js} +1 -1
- package/admin/assets/workbox-window.prod.es5-BIl4cyR9.js +2 -0
- package/admin/icons/icon-180x180.png +0 -0
- package/admin/icons/icon-192x192.png +0 -0
- package/admin/icons/icon-512x512.png +0 -0
- package/admin/icons/maskable-icon-512x512.png +0 -0
- package/admin/index.html +11 -6
- package/admin/manifest.webmanifest +1 -0
- package/admin/sw.js +1 -0
- package/admin/workbox-7d58179f.js +1 -0
- package/dist/admin-site.d.ts.map +1 -1
- package/dist/admin-site.js +3 -0
- package/dist/admin-site.js.map +1 -1
- package/dist/image.d.ts.map +1 -1
- package/dist/image.js +3 -0
- package/dist/image.js.map +1 -1
- package/dist/storage.js +1 -1
- package/dist/storage.js.map +1 -1
- package/lambda/api/bootstrap +0 -0
- package/lambda/webhook-worker/bootstrap +0 -0
- package/package.json +2 -2
- package/src/admin-site.ts +3 -0
- package/src/image.ts +3 -0
- package/src/storage.ts +1 -1
- package/admin/assets/AdminsPage-CnrQqwKA.js +0 -1
- package/admin/assets/AllContentPage-ByN1h3PP.js +0 -1
- package/admin/assets/BlockTypeEditPage-Buuwbx1P.js +0 -1
- package/admin/assets/BlockTypesPage-Dj0qmsqX.js +0 -1
- package/admin/assets/BulkActionBar-BMcUBJSH.js +0 -1
- package/admin/assets/CollectionEditPage-CLgQu2HS.js +0 -1
- package/admin/assets/ContentEditPage-A4i8P2Jd.js +0 -3
- package/admin/assets/ContentListPage-Bc4mBIkB.js +0 -1
- package/admin/assets/FieldBuilder-YJGSk0nY.js +0 -3
- package/admin/assets/MediaPage-_qNXqsZg.js +0 -1
- package/admin/assets/SiteSettingsPage-CoZnavij.js +0 -1
- package/admin/assets/SitesPage-ETqFT3nO.js +0 -1
- package/admin/assets/UsersPage-CKRJpAb6.js +0 -1
- package/admin/assets/check-BGA0ADyt.js +0 -1
- package/admin/assets/command-ChD319uJ.js +0 -1
- package/admin/assets/contentStatus-DfWHjFVB.js +0 -1
- package/admin/assets/format-CZ9bpk32.js +0 -1
- package/admin/assets/index-DOqKbrpW.css +0 -1
- package/admin/assets/index-Ds50UTAc.js +0 -18
- package/admin/assets/media-url-DIg_vSyf.js +0 -1
- package/admin/assets/plus-BgHSYWJN.js +0 -1
- package/admin/assets/radix-DQ3amgxj.js +0 -51
- package/admin/assets/search-DIzcfCVh.js +0 -1
- package/admin/assets/select-CJXZv4wv.js +0 -1
- package/admin/assets/useAdminResolver-BsQc_N4z.js +0 -1
- package/admin/assets/useContent-CSobIico.js +0 -1
- package/admin/assets/useMedia-CQnmMz4N.js +0 -1
package/admin/index.html
CHANGED
|
@@ -3,14 +3,19 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
-
<
|
|
8
|
-
<
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
|
|
7
|
+
<meta name="theme-color" content="#0a0a0a" />
|
|
8
|
+
<meta name="apple-mobile-web-app-capable" content="yes" />
|
|
9
|
+
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
|
10
|
+
<meta name="apple-mobile-web-app-title" content="Headroom" />
|
|
11
|
+
<link rel="apple-touch-icon" href="/icons/icon-180x180.png" />
|
|
12
|
+
<title>Headroom CMS</title>
|
|
13
|
+
<script type="module" crossorigin src="/assets/index-CwkwXbO-.js"></script>
|
|
9
14
|
<link rel="modulepreload" crossorigin href="/assets/react-vendor-DNVhVxD7.js">
|
|
10
15
|
<link rel="modulepreload" crossorigin href="/assets/tanstack-BO6c-AOu.js">
|
|
11
|
-
<link rel="modulepreload" crossorigin href="/assets/radix-
|
|
12
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
13
|
-
|
|
16
|
+
<link rel="modulepreload" crossorigin href="/assets/radix-n1vDIPi6.js">
|
|
17
|
+
<link rel="stylesheet" crossorigin href="/assets/index-FYfbavkE.css">
|
|
18
|
+
<link rel="manifest" href="/manifest.webmanifest"></head>
|
|
14
19
|
<body>
|
|
15
20
|
<script>
|
|
16
21
|
// Polyfill Node globals required by amazon-cognito-identity-js
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name":"Headroom CMS","short_name":"Headroom","description":"Headless CMS Admin","start_url":"/","display":"standalone","background_color":"#0a0a0a","theme_color":"#0a0a0a","lang":"en","scope":"/","orientation":"any","icons":[{"src":"/icons/icon-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/icons/icon-512x512.png","sizes":"512x512","type":"image/png"},{"src":"/icons/maskable-icon-512x512.png","sizes":"512x512","type":"image/png","purpose":"maskable"}]}
|
package/admin/sw.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
if(!self.define){let s,e={};const l=(l,i)=>(l=new URL(l+".js",i).href,e[l]||new Promise(e=>{if("document"in self){const s=document.createElement("script");s.src=l,s.onload=e,document.head.appendChild(s)}else s=l,importScripts(l),e()}).then(()=>{let s=e[l];if(!s)throw new Error(`Module ${l} didn’t register its module`);return s}));self.define=(i,n)=>{const r=s||("document"in self?document.currentScript.src:"")||location.href;if(e[r])return;let u={};const o=s=>l(s,r),a={module:{uri:r},exports:u,require:o};e[r]=Promise.all(i.map(s=>a[s]||o(s))).then(s=>(n(...s),u))}}define(["./workbox-7d58179f"],function(s){"use strict";self.skipWaiting(),s.clientsClaim(),s.precacheAndRoute([{url:"vite.svg",revision:"8e3a10e157f75ada21ab742c022d5430"},{url:"index.html",revision:"c26a1e99ad36b20ccc332e80223d3e6c"},{url:"icons/maskable-icon-512x512.png",revision:"d6913dcae3805185fad0790a20eae097"},{url:"icons/icon-512x512.png",revision:"ed25f5ccf87506782ee42be66318531b"},{url:"icons/icon-192x192.png",revision:"578d0c18e97882eaae9436f3bdd3c446"},{url:"icons/icon-180x180.png",revision:"8a45d7715a9f2f3a8b929a791b4a67e1"},{url:"assets/workbox-window.prod.es5-BIl4cyR9.js",revision:null},{url:"assets/useWebhooks-DS4Ee8Wk.js",revision:null},{url:"assets/useTags-BB47vbXO.js",revision:null},{url:"assets/useMedia-DjiNKMOU.js",revision:null},{url:"assets/useDebouncedValue-Bf8UizjU.js",revision:null},{url:"assets/useContent-Cp41wBYR.js",revision:null},{url:"assets/useAdminResolver-B-_1f6SR.js",revision:null},{url:"assets/use-mobile-Cvl5tIVY.js",revision:null},{url:"assets/trash-2-CbbWF_O4.js",revision:null},{url:"assets/tanstack-BO6c-AOu.js",revision:null},{url:"assets/table-D4rLgOKa.js",revision:null},{url:"assets/sortable.esm-BUhmZW2_.js",revision:null},{url:"assets/select-Cj54Wt-H.js",revision:null},{url:"assets/search-DRNC6QB5.js",revision:null},{url:"assets/react-vendor-DNVhVxD7.js",revision:null},{url:"assets/radix-n1vDIPi6.js",revision:null},{url:"assets/popover-DFInMOpa.js",revision:null},{url:"assets/plus-2Ds_MoqB.js",revision:null},{url:"assets/native-48B9X9Wg.js",revision:null},{url:"assets/module-RjUF93sV.js",revision:null},{url:"assets/lib-BrI1UB_t.js",revision:null},{url:"assets/index-FYfbavkE.css",revision:null},{url:"assets/index-CwkwXbO-.js",revision:null},{url:"assets/format-C88SDH8g.js",revision:null},{url:"assets/core.esm-BtFZvlg0.js",revision:null},{url:"assets/copy-fXL6Ngxi.js",revision:null},{url:"assets/contentStatus-BmaiYVOm.js",revision:null},{url:"assets/command-98iA8Va4.js",revision:null},{url:"assets/checkbox-VtCfoGic.js",revision:null},{url:"assets/check-BMpruHpO.js",revision:null},{url:"assets/card-DpNr7WTb.js",revision:null},{url:"assets/badge-ChZ2DZue.js",revision:null},{url:"assets/WebhooksPage-CG7WC9Bq.js",revision:null},{url:"assets/WebhookEditPage-BUvLl4rY.js",revision:null},{url:"assets/UsersPage-D_nOx6W9.js",revision:null},{url:"assets/TagsPage-DNlaoFCE.js",revision:null},{url:"assets/SitesPage-DnCiSu23.js",revision:null},{url:"assets/SiteSettingsPage-xfAm3ZKQ.js",revision:null},{url:"assets/MediaPage-DfPQBmNf.css",revision:null},{url:"assets/MediaPage-Cad4n33B.js",revision:null},{url:"assets/LoginPage-BlJXP0GH.js",revision:null},{url:"assets/FieldBuilder-B3-3MTqp.js",revision:null},{url:"assets/CustomBlockPreview-CCiZrZhi.js",revision:null},{url:"assets/ContentListPage-llAlhZTH.js",revision:null},{url:"assets/ContentEditPage-DyqgEoAe.js",revision:null},{url:"assets/ContentCreatePage-DujNZXXj.js",revision:null},{url:"assets/CollectionsPage-D-QTkoW_.js",revision:null},{url:"assets/CollectionEditPage-CQGo9Cbu.js",revision:null},{url:"assets/BulkActionBar-BX-t8fyM.js",revision:null},{url:"assets/BlockTypesPage-Pf9u78-O.js",revision:null},{url:"assets/BlockTypeEditPage-BYJfEA6l.js",revision:null},{url:"assets/BlockEditor-Cp_wZ2xN.css",revision:null},{url:"assets/BlockEditor-C0KaZUHQ.js",revision:null},{url:"assets/AuditPage-BwhYu96L.js",revision:null},{url:"assets/ApiKeysPage-DONrd-TJ.js",revision:null},{url:"assets/AllContentPage-DShBvFru.js",revision:null},{url:"assets/AdminsPage-DYJhlQnA.js",revision:null},{url:"icons/icon-180x180.png",revision:"8a45d7715a9f2f3a8b929a791b4a67e1"},{url:"icons/icon-192x192.png",revision:"578d0c18e97882eaae9436f3bdd3c446"},{url:"icons/icon-512x512.png",revision:"ed25f5ccf87506782ee42be66318531b"},{url:"icons/maskable-icon-512x512.png",revision:"d6913dcae3805185fad0790a20eae097"},{url:"manifest.webmanifest",revision:"be12a951409033222ff660a548620488"}],{}),s.cleanupOutdatedCaches(),s.registerRoute(new s.NavigationRoute(s.createHandlerBoundToURL("index.html"),{denylist:[/^\/v1\//]})),s.registerRoute(({url:s})=>s.pathname.startsWith("/v1/admin/"),new s.NetworkFirst({cacheName:"api-cache",networkTimeoutSeconds:10,plugins:[new s.ExpirationPlugin({maxEntries:200,maxAgeSeconds:3600}),new s.CacheableResponsePlugin({statuses:[200]})]}),"GET"),s.registerRoute(({request:s})=>"image"===s.destination,new s.CacheFirst({cacheName:"media-cache",plugins:[new s.ExpirationPlugin({maxEntries:500,maxAgeSeconds:604800}),new s.CacheableResponsePlugin({statuses:[200]})]}),"GET")});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
define(["exports"],function(t){"use strict";try{self["workbox:core:7.3.0"]&&_()}catch(t){}const e=(t,...e)=>{let s=t;return e.length>0&&(s+=` :: ${JSON.stringify(e)}`),s};class s extends Error{constructor(t,s){super(e(t,s)),this.name=t,this.details=s}}try{self["workbox:routing:7.3.0"]&&_()}catch(t){}const n=t=>t&&"object"==typeof t?t:{handle:t};class i{constructor(t,e,s="GET"){this.handler=n(e),this.match=t,this.method=s}setCatchHandler(t){this.catchHandler=n(t)}}class r extends i{constructor(t,e,s){super(({url:e})=>{const s=t.exec(e.href);if(s&&(e.origin===location.origin||0===s.index))return s.slice(1)},e,s)}}class a{constructor(){this.t=new Map,this.i=new Map}get routes(){return this.t}addFetchListener(){self.addEventListener("fetch",t=>{const{request:e}=t,s=this.handleRequest({request:e,event:t});s&&t.respondWith(s)})}addCacheListener(){self.addEventListener("message",t=>{if(t.data&&"CACHE_URLS"===t.data.type){const{payload:e}=t.data,s=Promise.all(e.urlsToCache.map(e=>{"string"==typeof e&&(e=[e]);const s=new Request(...e);return this.handleRequest({request:s,event:t})}));t.waitUntil(s),t.ports&&t.ports[0]&&s.then(()=>t.ports[0].postMessage(!0))}})}handleRequest({request:t,event:e}){const s=new URL(t.url,location.href);if(!s.protocol.startsWith("http"))return;const n=s.origin===location.origin,{params:i,route:r}=this.findMatchingRoute({event:e,request:t,sameOrigin:n,url:s});let a=r&&r.handler;const o=t.method;if(!a&&this.i.has(o)&&(a=this.i.get(o)),!a)return;let c;try{c=a.handle({url:s,request:t,event:e,params:i})}catch(t){c=Promise.reject(t)}const h=r&&r.catchHandler;return c instanceof Promise&&(this.o||h)&&(c=c.catch(async n=>{if(h)try{return await h.handle({url:s,request:t,event:e,params:i})}catch(t){t instanceof Error&&(n=t)}if(this.o)return this.o.handle({url:s,request:t,event:e});throw n})),c}findMatchingRoute({url:t,sameOrigin:e,request:s,event:n}){const i=this.t.get(s.method)||[];for(const r of i){let i;const a=r.match({url:t,sameOrigin:e,request:s,event:n});if(a)return i=a,(Array.isArray(i)&&0===i.length||a.constructor===Object&&0===Object.keys(a).length||"boolean"==typeof a)&&(i=void 0),{route:r,params:i}}return{}}setDefaultHandler(t,e="GET"){this.i.set(e,n(t))}setCatchHandler(t){this.o=n(t)}registerRoute(t){this.t.has(t.method)||this.t.set(t.method,[]),this.t.get(t.method).push(t)}unregisterRoute(t){if(!this.t.has(t.method))throw new s("unregister-route-but-not-found-with-method",{method:t.method});const e=this.t.get(t.method).indexOf(t);if(!(e>-1))throw new s("unregister-route-route-not-registered");this.t.get(t.method).splice(e,1)}}let o;const c=()=>(o||(o=new a,o.addFetchListener(),o.addCacheListener()),o);function h(t,e,n){let a;if("string"==typeof t){const s=new URL(t,location.href);a=new i(({url:t})=>t.href===s.href,e,n)}else if(t instanceof RegExp)a=new r(t,e,n);else if("function"==typeof t)a=new i(t,e,n);else{if(!(t instanceof i))throw new s("unsupported-route-type",{moduleName:"workbox-routing",funcName:"registerRoute",paramName:"capture"});a=t}return c().registerRoute(a),a}const u={googleAnalytics:"googleAnalytics",precache:"precache-v2",prefix:"workbox",runtime:"runtime",suffix:"undefined"!=typeof registration?registration.scope:""},l=t=>[u.prefix,t,u.suffix].filter(t=>t&&t.length>0).join("-"),f=t=>t||l(u.precache),w=t=>t||l(u.runtime);function d(t){t.then(()=>{})}const p=new Set;function y(){return y=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var s=arguments[e];for(var n in s)({}).hasOwnProperty.call(s,n)&&(t[n]=s[n])}return t},y.apply(null,arguments)}let m,g;const R=new WeakMap,v=new WeakMap,b=new WeakMap,q=new WeakMap,D=new WeakMap;let U={get(t,e,s){if(t instanceof IDBTransaction){if("done"===e)return v.get(t);if("objectStoreNames"===e)return t.objectStoreNames||b.get(t);if("store"===e)return s.objectStoreNames[1]?void 0:s.objectStore(s.objectStoreNames[0])}return L(t[e])},set:(t,e,s)=>(t[e]=s,!0),has:(t,e)=>t instanceof IDBTransaction&&("done"===e||"store"===e)||e in t};function x(t){return t!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(g||(g=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(E(this),e),L(R.get(this))}:function(...e){return L(t.apply(E(this),e))}:function(e,...s){const n=t.call(E(this),e,...s);return b.set(n,e.sort?e.sort():[e]),L(n)}}function I(t){return"function"==typeof t?x(t):(t instanceof IDBTransaction&&function(t){if(v.has(t))return;const e=new Promise((e,s)=>{const n=()=>{t.removeEventListener("complete",i),t.removeEventListener("error",r),t.removeEventListener("abort",r)},i=()=>{e(),n()},r=()=>{s(t.error||new DOMException("AbortError","AbortError")),n()};t.addEventListener("complete",i),t.addEventListener("error",r),t.addEventListener("abort",r)});v.set(t,e)}(t),e=t,(m||(m=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some(t=>e instanceof t)?new Proxy(t,U):t);var e}function L(t){if(t instanceof IDBRequest)return function(t){const e=new Promise((e,s)=>{const n=()=>{t.removeEventListener("success",i),t.removeEventListener("error",r)},i=()=>{e(L(t.result)),n()},r=()=>{s(t.error),n()};t.addEventListener("success",i),t.addEventListener("error",r)});return e.then(e=>{e instanceof IDBCursor&&R.set(e,t)}).catch(()=>{}),D.set(e,t),e}(t);if(q.has(t))return q.get(t);const e=I(t);return e!==t&&(q.set(t,e),D.set(e,t)),e}const E=t=>D.get(t);const C=["get","getKey","getAll","getAllKeys","count"],N=["put","add","delete","clear"],O=new Map;function k(t,e){if(!(t instanceof IDBDatabase)||e in t||"string"!=typeof e)return;if(O.get(e))return O.get(e);const s=e.replace(/FromIndex$/,""),n=e!==s,i=N.includes(s);if(!(s in(n?IDBIndex:IDBObjectStore).prototype)||!i&&!C.includes(s))return;const r=async function(t,...e){const r=this.transaction(t,i?"readwrite":"readonly");let a=r.store;return n&&(a=a.index(e.shift())),(await Promise.all([a[s](...e),i&&r.done]))[0]};return O.set(e,r),r}U=(t=>y({},t,{get:(e,s,n)=>k(e,s)||t.get(e,s,n),has:(e,s)=>!!k(e,s)||t.has(e,s)}))(U);try{self["workbox:expiration:7.3.0"]&&_()}catch(t){}const B="cache-entries",T=t=>{const e=new URL(t,location.href);return e.hash="",e.href};class P{constructor(t){this.h=null,this.u=t}l(t){const e=t.createObjectStore(B,{keyPath:"id"});e.createIndex("cacheName","cacheName",{unique:!1}),e.createIndex("timestamp","timestamp",{unique:!1})}p(t){this.l(t),this.u&&function(t,{blocked:e}={}){const s=indexedDB.deleteDatabase(t);e&&s.addEventListener("blocked",t=>e(t.oldVersion,t)),L(s).then(()=>{})}(this.u)}async setTimestamp(t,e){const s={url:t=T(t),timestamp:e,cacheName:this.u,id:this.m(t)},n=(await this.getDb()).transaction(B,"readwrite",{durability:"relaxed"});await n.store.put(s),await n.done}async getTimestamp(t){const e=await this.getDb(),s=await e.get(B,this.m(t));return null==s?void 0:s.timestamp}async expireEntries(t,e){const s=await this.getDb();let n=await s.transaction(B).store.index("timestamp").openCursor(null,"prev");const i=[];let r=0;for(;n;){const s=n.value;s.cacheName===this.u&&(t&&s.timestamp<t||e&&r>=e?i.push(n.value):r++),n=await n.continue()}const a=[];for(const t of i)await s.delete(B,t.id),a.push(t.url);return a}m(t){return this.u+"|"+T(t)}async getDb(){return this.h||(this.h=await function(t,e,{blocked:s,upgrade:n,blocking:i,terminated:r}={}){const a=indexedDB.open(t,e),o=L(a);return n&&a.addEventListener("upgradeneeded",t=>{n(L(a.result),t.oldVersion,t.newVersion,L(a.transaction),t)}),s&&a.addEventListener("blocked",t=>s(t.oldVersion,t.newVersion,t)),o.then(t=>{r&&t.addEventListener("close",()=>r()),i&&t.addEventListener("versionchange",t=>i(t.oldVersion,t.newVersion,t))}).catch(()=>{}),o}("workbox-expiration",1,{upgrade:this.p.bind(this)})),this.h}}class M{constructor(t,e={}){this.R=!1,this.v=!1,this.q=e.maxEntries,this.D=e.maxAgeSeconds,this.U=e.matchOptions,this.u=t,this._=new P(t)}async expireEntries(){if(this.R)return void(this.v=!0);this.R=!0;const t=this.D?Date.now()-1e3*this.D:0,e=await this._.expireEntries(t,this.q),s=await self.caches.open(this.u);for(const t of e)await s.delete(t,this.U);this.R=!1,this.v&&(this.v=!1,d(this.expireEntries()))}async updateTimestamp(t){await this._.setTimestamp(t,Date.now())}async isURLExpired(t){if(this.D){const e=await this._.getTimestamp(t),s=Date.now()-1e3*this.D;return void 0===e||e<s}return!1}async delete(){this.v=!1,await this._.expireEntries(1/0)}}try{self["workbox:cacheable-response:7.3.0"]&&_()}catch(t){}class j{constructor(t={}){this.I=t.statuses,this.L=t.headers}isResponseCacheable(t){let e=!0;return this.I&&(e=this.I.includes(t.status)),this.L&&e&&(e=Object.keys(this.L).some(e=>t.headers.get(e)===this.L[e])),e}}try{self["workbox:strategies:7.3.0"]&&_()}catch(t){}const W={cacheWillUpdate:async({response:t})=>200===t.status||0===t.status?t:null};function S(t,e){const s=new URL(t);for(const t of e)s.searchParams.delete(t);return s.href}class K{constructor(){this.promise=new Promise((t,e)=>{this.resolve=t,this.reject=e})}}function A(t){return"string"==typeof t?new Request(t):t}class F{constructor(t,e){this.C={},Object.assign(this,e),this.event=e.event,this.N=t,this.O=new K,this.k=[],this.B=[...t.plugins],this.T=new Map;for(const t of this.B)this.T.set(t,{});this.event.waitUntil(this.O.promise)}async fetch(t){const{event:e}=this;let n=A(t);if("navigate"===n.mode&&e instanceof FetchEvent&&e.preloadResponse){const t=await e.preloadResponse;if(t)return t}const i=this.hasCallback("fetchDidFail")?n.clone():null;try{for(const t of this.iterateCallbacks("requestWillFetch"))n=await t({request:n.clone(),event:e})}catch(t){if(t instanceof Error)throw new s("plugin-error-request-will-fetch",{thrownErrorMessage:t.message})}const r=n.clone();try{let t;t=await fetch(n,"navigate"===n.mode?void 0:this.N.fetchOptions);for(const s of this.iterateCallbacks("fetchDidSucceed"))t=await s({event:e,request:r,response:t});return t}catch(t){throw i&&await this.runCallbacks("fetchDidFail",{error:t,event:e,originalRequest:i.clone(),request:r.clone()}),t}}async fetchAndCachePut(t){const e=await this.fetch(t),s=e.clone();return this.waitUntil(this.cachePut(t,s)),e}async cacheMatch(t){const e=A(t);let s;const{cacheName:n,matchOptions:i}=this.N,r=await this.getCacheKey(e,"read"),a=Object.assign(Object.assign({},i),{cacheName:n});s=await caches.match(r,a);for(const t of this.iterateCallbacks("cachedResponseWillBeUsed"))s=await t({cacheName:n,matchOptions:i,cachedResponse:s,request:r,event:this.event})||void 0;return s}async cachePut(t,e){const n=A(t);var i;await(i=0,new Promise(t=>setTimeout(t,i)));const r=await this.getCacheKey(n,"write");if(!e)throw new s("cache-put-with-no-response",{url:(a=r.url,new URL(String(a),location.href).href.replace(new RegExp(`^${location.origin}`),""))});var a;const o=await this.P(e);if(!o)return!1;const{cacheName:c,matchOptions:h}=this.N,u=await self.caches.open(c),l=this.hasCallback("cacheDidUpdate"),f=l?await async function(t,e,s,n){const i=S(e.url,s);if(e.url===i)return t.match(e,n);const r=Object.assign(Object.assign({},n),{ignoreSearch:!0}),a=await t.keys(e,r);for(const e of a)if(i===S(e.url,s))return t.match(e,n)}(u,r.clone(),["__WB_REVISION__"],h):null;try{await u.put(r,l?o.clone():o)}catch(t){if(t instanceof Error)throw"QuotaExceededError"===t.name&&await async function(){for(const t of p)await t()}(),t}for(const t of this.iterateCallbacks("cacheDidUpdate"))await t({cacheName:c,oldResponse:f,newResponse:o.clone(),request:r,event:this.event});return!0}async getCacheKey(t,e){const s=`${t.url} | ${e}`;if(!this.C[s]){let n=t;for(const t of this.iterateCallbacks("cacheKeyWillBeUsed"))n=A(await t({mode:e,request:n,event:this.event,params:this.params}));this.C[s]=n}return this.C[s]}hasCallback(t){for(const e of this.N.plugins)if(t in e)return!0;return!1}async runCallbacks(t,e){for(const s of this.iterateCallbacks(t))await s(e)}*iterateCallbacks(t){for(const e of this.N.plugins)if("function"==typeof e[t]){const s=this.T.get(e),n=n=>{const i=Object.assign(Object.assign({},n),{state:s});return e[t](i)};yield n}}waitUntil(t){return this.k.push(t),t}async doneWaiting(){for(;this.k.length;){const t=this.k.splice(0),e=(await Promise.allSettled(t)).find(t=>"rejected"===t.status);if(e)throw e.reason}}destroy(){this.O.resolve(null)}async P(t){let e=t,s=!1;for(const t of this.iterateCallbacks("cacheWillUpdate"))if(e=await t({request:this.request,response:e,event:this.event})||void 0,s=!0,!e)break;return s||e&&200!==e.status&&(e=void 0),e}}class H{constructor(t={}){this.cacheName=w(t.cacheName),this.plugins=t.plugins||[],this.fetchOptions=t.fetchOptions,this.matchOptions=t.matchOptions}handle(t){const[e]=this.handleAll(t);return e}handleAll(t){t instanceof FetchEvent&&(t={event:t,request:t.request});const e=t.event,s="string"==typeof t.request?new Request(t.request):t.request,n="params"in t?t.params:void 0,i=new F(this,{event:e,request:s,params:n}),r=this.M(i,s,e);return[r,this.j(r,i,s,e)]}async M(t,e,n){let i;await t.runCallbacks("handlerWillStart",{event:n,request:e});try{if(i=await this.W(e,t),!i||"error"===i.type)throw new s("no-response",{url:e.url})}catch(s){if(s instanceof Error)for(const r of t.iterateCallbacks("handlerDidError"))if(i=await r({error:s,event:n,request:e}),i)break;if(!i)throw s}for(const s of t.iterateCallbacks("handlerWillRespond"))i=await s({event:n,request:e,response:i});return i}async j(t,e,s,n){let i,r;try{i=await t}catch(r){}try{await e.runCallbacks("handlerDidRespond",{event:n,request:s,response:i}),await e.doneWaiting()}catch(t){t instanceof Error&&(r=t)}if(await e.runCallbacks("handlerDidComplete",{event:n,request:s,response:i,error:r}),e.destroy(),r)throw r}}function $(t,e){const s=e();return t.waitUntil(s),s}try{self["workbox:precaching:7.3.0"]&&_()}catch(t){}function G(t){if(!t)throw new s("add-to-cache-list-unexpected-type",{entry:t});if("string"==typeof t){const e=new URL(t,location.href);return{cacheKey:e.href,url:e.href}}const{revision:e,url:n}=t;if(!n)throw new s("add-to-cache-list-unexpected-type",{entry:t});if(!e){const t=new URL(n,location.href);return{cacheKey:t.href,url:t.href}}const i=new URL(n,location.href),r=new URL(n,location.href);return i.searchParams.set("__WB_REVISION__",e),{cacheKey:i.href,url:r.href}}class V{constructor(){this.updatedURLs=[],this.notUpdatedURLs=[],this.handlerWillStart=async({request:t,state:e})=>{e&&(e.originalRequest=t)},this.cachedResponseWillBeUsed=async({event:t,state:e,cachedResponse:s})=>{if("install"===t.type&&e&&e.originalRequest&&e.originalRequest instanceof Request){const t=e.originalRequest.url;s?this.notUpdatedURLs.push(t):this.updatedURLs.push(t)}return s}}}class J{constructor({precacheController:t}){this.cacheKeyWillBeUsed=async({request:t,params:e})=>{const s=(null==e?void 0:e.cacheKey)||this.S.getCacheKeyForURL(t.url);return s?new Request(s,{headers:t.headers}):t},this.S=t}}let Q,z;async function X(t,e){let n=null;if(t.url){n=new URL(t.url).origin}if(n!==self.location.origin)throw new s("cross-origin-copy-response",{origin:n});const i=t.clone(),r={headers:new Headers(i.headers),status:i.status,statusText:i.statusText},a=e?e(r):r,o=function(){if(void 0===Q){const t=new Response("");if("body"in t)try{new Response(t.body),Q=!0}catch(t){Q=!1}Q=!1}return Q}()?i.body:await i.blob();return new Response(o,a)}class Y extends H{constructor(t={}){t.cacheName=f(t.cacheName),super(t),this.K=!1!==t.fallbackToNetwork,this.plugins.push(Y.copyRedirectedCacheableResponsesPlugin)}async W(t,e){const s=await e.cacheMatch(t);return s||(e.event&&"install"===e.event.type?await this.A(t,e):await this.F(t,e))}async F(t,e){let n;const i=e.params||{};if(!this.K)throw new s("missing-precache-entry",{cacheName:this.cacheName,url:t.url});{const s=i.integrity,r=t.integrity,a=!r||r===s;n=await e.fetch(new Request(t,{integrity:"no-cors"!==t.mode?r||s:void 0})),s&&a&&"no-cors"!==t.mode&&(this.H(),await e.cachePut(t,n.clone()))}return n}async A(t,e){this.H();const n=await e.fetch(t);if(!await e.cachePut(t,n.clone()))throw new s("bad-precaching-response",{url:t.url,status:n.status});return n}H(){let t=null,e=0;for(const[s,n]of this.plugins.entries())n!==Y.copyRedirectedCacheableResponsesPlugin&&(n===Y.defaultPrecacheCacheabilityPlugin&&(t=s),n.cacheWillUpdate&&e++);0===e?this.plugins.push(Y.defaultPrecacheCacheabilityPlugin):e>1&&null!==t&&this.plugins.splice(t,1)}}Y.defaultPrecacheCacheabilityPlugin={cacheWillUpdate:async({response:t})=>!t||t.status>=400?null:t},Y.copyRedirectedCacheableResponsesPlugin={cacheWillUpdate:async({response:t})=>t.redirected?await X(t):t};class Z{constructor({cacheName:t,plugins:e=[],fallbackToNetwork:s=!0}={}){this.$=new Map,this.G=new Map,this.V=new Map,this.N=new Y({cacheName:f(t),plugins:[...e,new J({precacheController:this})],fallbackToNetwork:s}),this.install=this.install.bind(this),this.activate=this.activate.bind(this)}get strategy(){return this.N}precache(t){this.addToCacheList(t),this.J||(self.addEventListener("install",this.install),self.addEventListener("activate",this.activate),this.J=!0)}addToCacheList(t){const e=[];for(const n of t){"string"==typeof n?e.push(n):n&&void 0===n.revision&&e.push(n.url);const{cacheKey:t,url:i}=G(n),r="string"!=typeof n&&n.revision?"reload":"default";if(this.$.has(i)&&this.$.get(i)!==t)throw new s("add-to-cache-list-conflicting-entries",{firstEntry:this.$.get(i),secondEntry:t});if("string"!=typeof n&&n.integrity){if(this.V.has(t)&&this.V.get(t)!==n.integrity)throw new s("add-to-cache-list-conflicting-integrities",{url:i});this.V.set(t,n.integrity)}if(this.$.set(i,t),this.G.set(i,r),e.length>0){const t=`Workbox is precaching URLs without revision info: ${e.join(", ")}\nThis is generally NOT safe. Learn more at https://bit.ly/wb-precache`;console.warn(t)}}}install(t){return $(t,async()=>{const e=new V;this.strategy.plugins.push(e);for(const[e,s]of this.$){const n=this.V.get(s),i=this.G.get(e),r=new Request(e,{integrity:n,cache:i,credentials:"same-origin"});await Promise.all(this.strategy.handleAll({params:{cacheKey:s},request:r,event:t}))}const{updatedURLs:s,notUpdatedURLs:n}=e;return{updatedURLs:s,notUpdatedURLs:n}})}activate(t){return $(t,async()=>{const t=await self.caches.open(this.strategy.cacheName),e=await t.keys(),s=new Set(this.$.values()),n=[];for(const i of e)s.has(i.url)||(await t.delete(i),n.push(i.url));return{deletedURLs:n}})}getURLsToCacheKeys(){return this.$}getCachedURLs(){return[...this.$.keys()]}getCacheKeyForURL(t){const e=new URL(t,location.href);return this.$.get(e.href)}getIntegrityForCacheKey(t){return this.V.get(t)}async matchPrecache(t){const e=t instanceof Request?t.url:t,s=this.getCacheKeyForURL(e);if(s){return(await self.caches.open(this.strategy.cacheName)).match(s)}}createHandlerBoundToURL(t){const e=this.getCacheKeyForURL(t);if(!e)throw new s("non-precached-url",{url:t});return s=>(s.request=new Request(t),s.params=Object.assign({cacheKey:e},s.params),this.strategy.handle(s))}}const tt=()=>(z||(z=new Z),z);class et extends i{constructor(t,e){super(({request:s})=>{const n=t.getURLsToCacheKeys();for(const i of function*(t,{ignoreURLParametersMatching:e=[/^utm_/,/^fbclid$/],directoryIndex:s="index.html",cleanURLs:n=!0,urlManipulation:i}={}){const r=new URL(t,location.href);r.hash="",yield r.href;const a=function(t,e=[]){for(const s of[...t.searchParams.keys()])e.some(t=>t.test(s))&&t.searchParams.delete(s);return t}(r,e);if(yield a.href,s&&a.pathname.endsWith("/")){const t=new URL(a.href);t.pathname+=s,yield t.href}if(n){const t=new URL(a.href);t.pathname+=".html",yield t.href}if(i){const t=i({url:r});for(const e of t)yield e.href}}(s.url,e)){const e=n.get(i);if(e){return{cacheKey:e,integrity:t.getIntegrityForCacheKey(e)}}}},t.strategy)}}t.CacheFirst=class extends H{async W(t,e){let n,i=await e.cacheMatch(t);if(!i)try{i=await e.fetchAndCachePut(t)}catch(t){t instanceof Error&&(n=t)}if(!i)throw new s("no-response",{url:t.url,error:n});return i}},t.CacheableResponsePlugin=class{constructor(t){this.cacheWillUpdate=async({response:t})=>this.X.isResponseCacheable(t)?t:null,this.X=new j(t)}},t.ExpirationPlugin=class{constructor(t={}){this.cachedResponseWillBeUsed=async({event:t,request:e,cacheName:s,cachedResponse:n})=>{if(!n)return null;const i=this.Y(n),r=this.Z(s);d(r.expireEntries());const a=r.updateTimestamp(e.url);if(t)try{t.waitUntil(a)}catch(t){}return i?n:null},this.cacheDidUpdate=async({cacheName:t,request:e})=>{const s=this.Z(t);await s.updateTimestamp(e.url),await s.expireEntries()},this.tt=t,this.D=t.maxAgeSeconds,this.et=new Map,t.purgeOnQuotaError&&function(t){p.add(t)}(()=>this.deleteCacheAndMetadata())}Z(t){if(t===w())throw new s("expire-custom-caches-only");let e=this.et.get(t);return e||(e=new M(t,this.tt),this.et.set(t,e)),e}Y(t){if(!this.D)return!0;const e=this.st(t);if(null===e)return!0;return e>=Date.now()-1e3*this.D}st(t){if(!t.headers.has("date"))return null;const e=t.headers.get("date"),s=new Date(e).getTime();return isNaN(s)?null:s}async deleteCacheAndMetadata(){for(const[t,e]of this.et)await self.caches.delete(t),await e.delete();this.et=new Map}},t.NavigationRoute=class extends i{constructor(t,{allowlist:e=[/./],denylist:s=[]}={}){super(t=>this.nt(t),t),this.it=e,this.rt=s}nt({url:t,request:e}){if(e&&"navigate"!==e.mode)return!1;const s=t.pathname+t.search;for(const t of this.rt)if(t.test(s))return!1;return!!this.it.some(t=>t.test(s))}},t.NetworkFirst=class extends H{constructor(t={}){super(t),this.plugins.some(t=>"cacheWillUpdate"in t)||this.plugins.unshift(W),this.ot=t.networkTimeoutSeconds||0}async W(t,e){const n=[],i=[];let r;if(this.ot){const{id:s,promise:a}=this.ct({request:t,logs:n,handler:e});r=s,i.push(a)}const a=this.ht({timeoutId:r,request:t,logs:n,handler:e});i.push(a);const o=await e.waitUntil((async()=>await e.waitUntil(Promise.race(i))||await a)());if(!o)throw new s("no-response",{url:t.url});return o}ct({request:t,logs:e,handler:s}){let n;return{promise:new Promise(e=>{n=setTimeout(async()=>{e(await s.cacheMatch(t))},1e3*this.ot)}),id:n}}async ht({timeoutId:t,request:e,logs:s,handler:n}){let i,r;try{r=await n.fetchAndCachePut(e)}catch(t){t instanceof Error&&(i=t)}return t&&clearTimeout(t),!i&&r||(r=await n.cacheMatch(e)),r}},t.cleanupOutdatedCaches=function(){self.addEventListener("activate",t=>{const e=f();t.waitUntil((async(t,e="-precache-")=>{const s=(await self.caches.keys()).filter(s=>s.includes(e)&&s.includes(self.registration.scope)&&s!==t);return await Promise.all(s.map(t=>self.caches.delete(t))),s})(e).then(t=>{}))})},t.clientsClaim=function(){self.addEventListener("activate",()=>self.clients.claim())},t.createHandlerBoundToURL=function(t){return tt().createHandlerBoundToURL(t)},t.precacheAndRoute=function(t,e){!function(t){tt().precache(t)}(t),function(t){const e=tt();h(new et(e,t))}(e)},t.registerRoute=h});
|
package/dist/admin-site.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin-site.d.ts","sourceRoot":"","sources":["../src/admin-site.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,YAAY,CAAC;IAClB,GAAG,EAAE,YAAY,CAAC;IAClB,IAAI,EAAE,aAAa,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE;QACJ,qDAAqD;QACrD,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,MAAM,CAAC,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,cAAc,EAAE,MAAM,CAAC;KACxB,CAAC;CACH;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa;;;
|
|
1
|
+
{"version":3,"file":"admin-site.d.ts","sourceRoot":"","sources":["../src/admin-site.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,YAAY,CAAC;IAClB,GAAG,EAAE,YAAY,CAAC;IAClB,IAAI,EAAE,aAAa,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE;QACJ,qDAAqD;QACrD,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,MAAM,CAAC,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,cAAc,EAAE,MAAM,CAAC;KACxB,CAAC;CACH;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa;;;EA+EhE;AAED,MAAM,MAAM,kBAAkB,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC"}
|
package/dist/admin-site.js
CHANGED
|
@@ -19,6 +19,9 @@ export function createAdminSite(name, args) {
|
|
|
19
19
|
// Dev mode: standard StaticSite with Vite build
|
|
20
20
|
const site = new sst.aws.StaticSite(`${name}Admin`, {
|
|
21
21
|
path: args.dev.adminPath,
|
|
22
|
+
dev: {
|
|
23
|
+
command: "pnpm exec vite",
|
|
24
|
+
},
|
|
22
25
|
build: {
|
|
23
26
|
command: "pnpm build",
|
|
24
27
|
output: "dist",
|
package/dist/admin-site.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin-site.js","sourceRoot":"","sources":["../src/admin-site.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAoBxB,MAAM,UAAU,eAAe,CAAC,IAAY,EAAE,IAAmB;IAC/D,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;IAEhC,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM;QAC9B,CAAC,CAAC;YACE,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E,YAAY;KACrB,CAAC,CAAC;IAEH,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC;AACjC,CAAC"}
|
package/dist/image.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../src/image.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErD,MAAM,WAAW,SAAS;IACxB,aAAa,EAAE,gBAAgB,CAAC,eAAe,CAAC,CAAC;IACjD,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE;QACJ,qEAAqE;QACrE,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS;;;
|
|
1
|
+
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../src/image.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErD,MAAM,WAAW,SAAS;IACxB,aAAa,EAAE,gBAAgB,CAAC,eAAe,CAAC,CAAC;IACjD,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE;QACJ,qEAAqE;QACrE,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS;;;EA2CxD;AAED,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC"}
|
package/dist/image.js
CHANGED
package/dist/image.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image.js","sourceRoot":"","sources":["../src/image.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,IAAI,MAAM,MAAM,CAAC;AAY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,CAAC,GAAG,IAAI,KAAK,EAAE;QACzD,IAAI,EAAE,YAAY,CAAA,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,KAAK,MAAM;QAClD,OAAO,EAAE,oDAAoD;KAC9D,CAAC,CAAC;IAEH,OAAO;QACL,KAAK;QACL,OAAO;QACP,YAAY;QACZ,MAAM;QACN,KAAK;QACL,WAAW;QACX,UAAU;QACV,UAAU;QACV,aAAa;QACb,aAAa;QACb,GAAG;KACJ,CAAC;AACJ,CAAC"}
|
package/lambda/api/bootstrap
CHANGED
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "headroom-cms",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Headroom CMS — Serverless headless CMS for AWS, deployed with SST",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"build:all": "pnpm build:lambdas && pnpm build:admin && pnpm build:functions && pnpm build:image-lambda && pnpm build"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"sst": "^
|
|
29
|
+
"sst": "^4.0.0"
|
|
30
30
|
},
|
|
31
31
|
"license": "PolyForm-Noncommercial-1.0.0",
|
|
32
32
|
"repository": {
|
package/src/admin-site.ts
CHANGED
|
@@ -41,6 +41,9 @@ export function createAdminSite(name: string, args: AdminSiteArgs) {
|
|
|
41
41
|
// Dev mode: standard StaticSite with Vite build
|
|
42
42
|
const site = new sst.aws.StaticSite(`${name}Admin`, {
|
|
43
43
|
path: args.dev.adminPath,
|
|
44
|
+
dev: {
|
|
45
|
+
command: "pnpm exec vite",
|
|
46
|
+
},
|
|
44
47
|
build: {
|
|
45
48
|
command: "pnpm build",
|
|
46
49
|
output: "dist",
|
package/src/image.ts
CHANGED
package/src/storage.ts
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./tanstack-BO6c-AOu.js";import{u as H,r as x}from"./react-vendor-DNVhVxD7.js";import{n as L,u as q,a2 as B,a3 as _,o as z,a4 as M,a5 as V,S as y,D as G,h as $,B as l,i as J,j as K,k as Q,l as W,I as X,m as Y,s as i}from"./index-Ds50UTAc.js";import{u as Z}from"./useAdminResolver-BsQc_N4z.js";import{T as ee,a as se,b,c as p,d as ae,e as j}from"./table-B3EHrN_H.js";import{P as ie,a as te,b as ne,C as re,c as oe,d as le,e as de,f as ce,g as me}from"./command-ChD319uJ.js";import{S as ue,a as he,b as xe,c as pe,d as C}from"./select-CJXZv4wv.js";import{P as je}from"./plus-BgHSYWJN.js";import{T as ve}from"./trash-2-Gny2Upn-.js";import"./radix-DQ3amgxj.js";import"./search-DIzcfCVh.js";import"./check-BGA0ADyt.js";const fe=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],ge=L("user-plus",fe);function Re(){const{host:d}=H(),{user:N}=q(),S=B(),{data:A,isLoading:I}=_(d),{data:T}=z(),c=M(d),m=V(d),n=A?.admins??[],E=T?.items??[],r=S==="admin",v=n.map(s=>s.id),{resolve:w}=Z(v),[D,f]=x.useState(!1),[P,g]=x.useState(!1),[u,h]=x.useState("");if(I)return e.jsxs("div",{className:"space-y-2",children:[e.jsx(y,{className:"h-8 w-64"}),Array.from({length:3}).map((s,a)=>e.jsx(y,{className:"h-12 w-full"},a))]});const R=E.filter(s=>!v.includes(s.sub));async function k(s){try{await c.mutateAsync({admins:[...n,{id:s,role:"editor"}]}),i.success("Admin added"),f(!1)}catch(a){i.error("Failed to add admin",{description:a instanceof Error?a.message:void 0})}}async function U(s){if(s.preventDefault(),!!u.trim())try{const a=await m.mutateAsync({email:u.trim()});a.existed?i.success("Existing user added to site"):i.success("Invite email sent",{description:`An invite has been sent to ${a.email}`}),h(""),g(!1)}catch(a){i.error("Failed to invite user",{description:a instanceof Error?a.message:void 0})}}async function O(s){try{await c.mutateAsync({admins:n.filter(a=>a.id!==s)}),i.success("Admin removed")}catch(a){i.error("Failed to remove admin",{description:a instanceof Error?a.message:void 0})}}async function F(s,a){const o=n.map(t=>t.id===s?{...t,role:a}:t);if(!o.some(t=>t.role==="admin")){i.error("At least one admin role is required");return}try{await c.mutateAsync({admins:o}),i.success("Role updated")}catch(t){i.error("Failed to update role",{description:t instanceof Error?t.message:void 0})}}return e.jsxs("div",{children:[e.jsx("h1",{className:"mb-6 text-2xl font-semibold",children:"Admins"}),r&&e.jsxs("div",{className:"mb-6 flex gap-2",children:[e.jsxs(G,{open:P,onOpenChange:s=>{g(s),s||h("")},children:[e.jsx($,{asChild:!0,children:e.jsxs(l,{children:[e.jsx(ge,{className:"mr-2 h-4 w-4"}),"Invite by email"]})}),e.jsxs(J,{children:[e.jsxs(K,{children:[e.jsx(Q,{children:"Invite User to Site"}),e.jsx(W,{className:"sr-only",children:"Send an invite email to add a user to this site"})]}),e.jsxs("form",{onSubmit:U,className:"space-y-4",children:[e.jsx("p",{className:"text-muted-foreground text-sm",children:"Enter an email address. If the user doesn't have an account yet, they'll receive an invite email."}),e.jsx(X,{type:"email",value:u,onChange:s=>h(s.target.value),placeholder:"email@example.com",required:!0}),e.jsx(Y,{children:e.jsx(l,{type:"submit",disabled:m.isPending,children:m.isPending?"Inviting...":"Send Invite"})})]})]})]}),e.jsxs(ie,{open:D,onOpenChange:f,children:[e.jsx(te,{asChild:!0,children:e.jsxs(l,{variant:"outline",children:[e.jsx(je,{className:"mr-2 h-4 w-4"}),"Add existing user"]})}),e.jsx(ne,{className:"w-72 p-0",align:"start",children:e.jsxs(re,{children:[e.jsx(oe,{placeholder:"Search users..."}),e.jsxs(le,{children:[e.jsx(de,{children:"No users found."}),e.jsx(ce,{children:R.map(s=>e.jsx(me,{value:s.email,onSelect:()=>k(s.sub),children:s.email},s.sub))})]})]})})]})]}),n.length===0?e.jsx("p",{className:"text-muted-foreground",children:"No admins configured."}):e.jsxs(ee,{children:[e.jsx(se,{children:e.jsxs(b,{children:[e.jsx(p,{children:"Email"}),e.jsx(p,{children:"Role"}),r&&e.jsx(p,{})]})}),e.jsx(ae,{children:n.map(s=>{const a=s.id===N?.sub;return e.jsxs(b,{children:[e.jsxs(j,{className:"text-sm",children:[w(s.id),a&&e.jsx("span",{className:"ml-2 text-muted-foreground",children:"(you)"})]}),e.jsx(j,{children:r&&!a?e.jsxs(ue,{value:s.role,onValueChange:o=>F(s.id,o),children:[e.jsx(he,{className:"w-28",children:e.jsx(xe,{})}),e.jsxs(pe,{children:[e.jsx(C,{value:"admin",children:"Admin"}),e.jsx(C,{value:"editor",children:"Editor"})]})]}):e.jsx("span",{className:"text-sm capitalize",children:s.role})}),r&&e.jsx(j,{className:"text-right",children:!a&&e.jsx(l,{variant:"ghost",size:"sm",onClick:()=>O(s.id),title:"Remove from site",children:e.jsx(ve,{className:"h-4 w-4"})})})]},s.id)})})]})]})}export{Re as AdminsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as s}from"./tanstack-BO6c-AOu.js";import{u as P,e as T,r as p}from"./react-vendor-DNVhVxD7.js";import{u as U,a as I,b as D,c as L}from"./useContent-CSobIico.js";import{m as M}from"./media-url-DIg_vSyf.js";import{t as R,s as c,S as z,B as E}from"./index-Ds50UTAc.js";import{B as g}from"./badge-0Z1nL6DI.js";import{C as b}from"./checkbox-BPqrj_XS.js";import{T as H,a as F,b as S,c as o,d as V,e as r}from"./table-B3EHrN_H.js";import{f as _}from"./format-CZ9bpk32.js";import{B as q}from"./BulkActionBar-BMcUBJSH.js";import"./radix-DQ3amgxj.js";import"./check-BGA0ADyt.js";function le(){const{host:i}=P(),k=T(),{collections:C}=R(),[w,N]=p.useState(),[n,a]=p.useState(new Set),{data:d,isLoading:v}=U(i,w),m=I(i),x=D(i),f=L(i),y=new Map(C.map(e=>[e.name,e.label])),h=d?.items.map(e=>e.contentId)??[],j=h.length>0&&h.every(e=>n.has(e));function A(e){a(l=>{const t=new Set(l);return t.has(e)?t.delete(e):t.add(e),t})}function $(){a(j?new Set:new Set(h))}const B=m.isPending||x.isPending||f.isPending;return s.jsxs("div",{children:[s.jsxs("div",{className:"mb-6",children:[s.jsx("h1",{className:"text-2xl font-semibold",children:"All Content"}),s.jsx("p",{className:"text-muted-foreground text-sm",children:"Recently updated content across all collections."})]}),n.size>0&&s.jsx(q,{selectedCount:n.size,onPublish:async()=>{const e=[...n],t=(await m.mutateAsync(e)).filter(u=>u.status==="rejected").length;t?c.error(`${t} of ${e.length} failed to publish`):c.success(`${e.length} item(s) published`),a(new Set)},onUnpublish:async()=>{const e=[...n],t=(await x.mutateAsync(e)).filter(u=>u.status==="rejected").length;t?c.error(`${t} of ${e.length} failed to unpublish`):c.success(`${e.length} item(s) unpublished`),a(new Set)},onDelete:async()=>{const e=[...n],t=(await f.mutateAsync(e)).filter(u=>u.status==="rejected").length;t?c.error(`${t} of ${e.length} failed to delete`):c.success(`${e.length} item(s) deleted`),a(new Set)},onClear:()=>a(new Set),isPending:B}),v?s.jsx("div",{className:"space-y-2",children:Array.from({length:5}).map((e,l)=>s.jsx(z,{className:"h-12 w-full"},l))}):d?.items.length?s.jsxs(s.Fragment,{children:[s.jsxs(H,{children:[s.jsx(F,{children:s.jsxs(S,{children:[s.jsx(o,{className:"w-10",children:s.jsx(b,{checked:j,onCheckedChange:$,"aria-label":"Select all"})}),s.jsx(o,{children:"Title"}),s.jsx(o,{children:"Slug"}),s.jsx(o,{children:"Collection"}),s.jsx(o,{children:"Status"}),s.jsx(o,{children:"Updated"})]})}),s.jsx(V,{children:d.items.map(e=>s.jsxs(S,{className:"cursor-pointer",onClick:()=>k(`/sites/${i}/content/${e.collection}/${e.contentId}`),children:[s.jsx(r,{onClick:l=>l.stopPropagation(),children:s.jsx(b,{checked:n.has(e.contentId),onCheckedChange:()=>A(e.contentId),"aria-label":`Select ${e.title||"Untitled"}`})}),s.jsx(r,{className:"font-medium",children:s.jsxs("div",{className:"flex items-center gap-3",children:[!!e.coverUrl&&s.jsx("img",{src:M(e.coverUrl),alt:"",className:"h-8 w-8 rounded object-cover flex-shrink-0"}),s.jsx("span",{children:e.title||"Untitled"})]})}),s.jsx(r,{className:"text-muted-foreground text-sm",children:e.slug||"—"}),s.jsx(r,{children:s.jsx(g,{variant:"outline",children:y.get(e.collection)??e.collection})}),s.jsx(r,{children:s.jsx(g,{variant:e.publishedAt?"default":"secondary",children:e.publishedAt?"Published":"Draft"})}),s.jsx(r,{className:"text-muted-foreground",children:e.publishedAt?_(e.publishedAt):"—"})]},e.contentId))})]}),d.hasMore&&s.jsx("div",{className:"mt-4 flex justify-center",children:s.jsx(E,{variant:"outline",onClick:()=>N(d.cursor??void 0),children:"Load More"})})]}):s.jsx("p",{className:"text-muted-foreground",children:"No content yet."})]})}export{le as AllContentPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./tanstack-BO6c-AOu.js";import{u as A,e as H,r as o}from"./react-vendor-DNVhVxD7.js";import{L as d,I as b,O as C,Z as R,S as k,$ as U,a0 as V,a1 as Z,B as h,a as _,D as z,h as G,i as J,j as K,k as M,l as Q,m as W,s as j}from"./index-Ds50UTAc.js";import{I as X,F as Y}from"./FieldBuilder-YJGSk0nY.js";import{i as ee}from"./format-CZ9bpk32.js";import{T as ae,C as se,b as te,c as le}from"./sortable.esm-Zh-9QRSf.js";import{C as ie,a as ne,b as re,c as oe}from"./card-D1-S-QZ6.js";import{C as ce}from"./CustomBlockPreview-CCssn6vF.js";import{u as T}from"./useDebouncedValue-Bf8UizjU.js";import{b as de}from"./core.esm-Csvubn5Q.js";import{T as me}from"./trash-2-Gny2Upn-.js";import"./radix-DQ3amgxj.js";import"./select-CJXZv4wv.js";import"./check-BGA0ADyt.js";import"./checkbox-BPqrj_XS.js";import"./plus-BgHSYWJN.js";function pe({fields:s,previewTemplate:t,previewData:a,onPreviewDataChange:n,blockTypeName:c,blockTypeLabel:m,blockTypeIcon:f}){const r=T(t,300),y=T(a,300);return e.jsxs("div",{className:"space-y-4",children:[s.map(i=>e.jsxs("div",{className:"space-y-1",children:[e.jsx(d,{className:"text-xs",children:i.label}),e.jsx(b,{value:String(a[i.name]??""),onChange:v=>n({...a,[i.name]:v.target.value}),placeholder:`Sample ${i.label}...`})]},i.name)),e.jsx(C,{}),e.jsx("div",{className:"rounded-md border p-4",children:e.jsx(ce,{blockType:{name:c,label:m,icon:f,fields:s,previewTemplate:r},props:y})})]})}function Se(){const{host:s,name:t}=A(),a=t==="new",{data:n,isLoading:c}=R(s,a?"":t);return!a&&c?e.jsxs("div",{className:"space-y-4",children:[e.jsx(k,{className:"h-8 w-64"}),e.jsx(k,{className:"h-64 w-full"})]}):a?e.jsx(B,{host:s,isNew:!0}):n?e.jsx(B,{host:s,isNew:!1,blockType:n},n.name):e.jsx("p",{className:"text-muted-foreground",children:"Block type not found."})}function B({host:s,isNew:t,blockType:a}){const n=H(),c=U(s),m=V(s,a?.name??""),f=Z(s,a?.name??""),[r,y]=o.useState(a?.name??""),[i,v]=o.useState(a?.label??""),[g,D]=o.useState(a?.icon??""),[S,F]=o.useState(!t),P=new Set((a?.fields??[]).map(l=>l.name).filter(Boolean)),[p,L]=o.useState(a?.fields??[]),[u,E]=o.useState(a?.previewTemplate??""),[x,I]=o.useState(a?.previewData??{}),[O,w]=o.useState(!1);async function $(l){l.preventDefault();try{t?(await c.mutateAsync({name:r,label:i,icon:g,fields:p,previewTemplate:u||void 0,previewData:Object.keys(x).length>0?x:void 0}),j.success("Block type created"),n(`/sites/${s}/settings/block-types/${r}`)):(await m.mutateAsync({label:i,icon:g,fields:p,previewTemplate:u||void 0,previewData:Object.keys(x).length>0?x:void 0}),j.success("Block type updated"))}catch(N){j.error(t?"Failed to create":"Failed to update",{description:N instanceof Error?N.message:void 0})}}async function q(){try{await f.mutateAsync(),j.success("Block type deleted"),n(`/sites/${s}/settings/block-types`)}catch(l){j.error("Failed to delete",{description:l instanceof Error?l.message:void 0})}}return e.jsxs("div",{className:"mx-auto max-w-2xl",children:[e.jsx("h1",{className:"mb-6 text-2xl font-semibold",children:t?"New Block Type":`Edit: ${a?.label??r}`}),e.jsxs(ie,{children:[e.jsx(ne,{children:e.jsx(re,{children:"Block Type Settings"})}),e.jsx(oe,{children:e.jsxs("form",{onSubmit:$,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"name",children:"Name"}),e.jsx(X,{id:"name",value:r,onChange:y,onBlur:()=>{r&&!S&&v(ee(r))},readOnly:!t,placeholder:"e.g. hero_banner",required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"label",children:"Label"}),e.jsx(b,{id:"label",value:i,onChange:l=>{v(l.target.value),F(!0)},required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"icon",children:"Icon"}),e.jsx(b,{id:"icon",value:g,onChange:l=>D(l.target.value)})]}),e.jsx(C,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{children:"Block Fields"}),e.jsx(Y,{fields:p,onChange:L,existingFieldNames:P})]}),e.jsx(C,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"preview-template",children:"Preview Template (Liquid + Tailwind)"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Optional. Use Liquid syntax to render a preview. Block field values are available as template variables."}),e.jsx(ae,{id:"preview-template",value:u,onChange:l=>E(l.target.value),rows:6,placeholder:'<div class="p-4">{{ title }}</div>',className:"font-mono text-sm"})]}),(u||p.length>0)&&e.jsxs(se,{children:[e.jsxs(te,{className:"flex w-full items-center gap-2 text-sm font-medium",children:[e.jsx(de,{className:"h-4 w-4 transition-transform [[data-state=open]>&]:rotate-90"}),"Preview"]}),e.jsx(le,{className:"mt-2",children:e.jsx(pe,{fields:p,previewTemplate:u,previewData:x,onPreviewDataChange:I,blockTypeName:r,blockTypeLabel:i,blockTypeIcon:g})})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(h,{type:"submit",disabled:c.isPending||m.isPending,children:[(c.isPending||m.isPending)&&e.jsx(_,{className:"mr-2 h-4 w-4 animate-spin"}),t?"Create":"Save"]}),e.jsx(h,{type:"button",variant:"outline",onClick:()=>n(`/sites/${s}/settings/block-types`),children:"Cancel"})]})]})})]}),!t&&e.jsx("div",{className:"mt-6",children:e.jsxs(z,{open:O,onOpenChange:w,children:[e.jsx(G,{asChild:!0,children:e.jsxs(h,{variant:"destructive",children:[e.jsx(me,{className:"mr-2 h-4 w-4"}),"Delete Block Type"]})}),e.jsxs(J,{children:[e.jsxs(K,{children:[e.jsx(M,{children:"Delete block type?"}),e.jsx(Q,{children:"This will permanently delete this block type."})]}),e.jsxs(W,{children:[e.jsx(h,{variant:"outline",onClick:()=>w(!1),children:"Cancel"}),e.jsx(h,{variant:"destructive",onClick:q,children:"Delete"})]})]})]})})]})}export{Se as BlockTypeEditPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./tanstack-BO6c-AOu.js";import{u as m,e as d}from"./react-vendor-DNVhVxD7.js";import{Y as x,B as h,S as j}from"./index-Ds50UTAc.js";import{T as p,a as f,b as c,c as a,d as u,e as l}from"./table-B3EHrN_H.js";import{P as N}from"./plus-BgHSYWJN.js";import"./radix-DQ3amgxj.js";function w(){const{host:n}=m(),i=d(),{data:r,isLoading:o}=x(n);return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[e.jsx("h1",{className:"text-2xl font-semibold",children:"Block Types"}),e.jsxs(h,{onClick:()=>i(`/sites/${n}/settings/block-types/new`),children:[e.jsx(N,{className:"mr-2 h-4 w-4"}),"New Block Type"]})]}),o?e.jsx("div",{className:"space-y-2",children:Array.from({length:3}).map((s,t)=>e.jsx(j,{className:"h-12 w-full"},t))}):r?.items.length?e.jsxs(p,{children:[e.jsx(f,{children:e.jsxs(c,{children:[e.jsx(a,{children:"Name"}),e.jsx(a,{children:"Label"}),e.jsx(a,{children:"Icon"}),e.jsx(a,{children:"Fields"})]})}),e.jsx(u,{children:r.items.map(s=>e.jsxs(c,{className:"cursor-pointer",onClick:()=>i(`/sites/${n}/settings/block-types/${s.name}`),children:[e.jsx(l,{className:"font-mono text-sm",children:s.name}),e.jsx(l,{children:s.label}),e.jsx(l,{children:s.icon}),e.jsx(l,{className:"text-muted-foreground",children:s.fields?.length??0})]},s.name))})]}):e.jsx("p",{className:"text-muted-foreground",children:"No block types defined."})]})}export{w as BlockTypesPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./tanstack-BO6c-AOu.js";import{r as m}from"./react-vendor-DNVhVxD7.js";import{B as a,a as t,X as x,D as h,i as j,j as p,k as u,l as D,m as b}from"./index-Ds50UTAc.js";function k({selectedCount:i,onPublish:n,onUnpublish:r,onDelete:c,onClear:o,isPending:s}){const[d,l]=m.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-4 flex items-center gap-3 rounded-md border bg-muted/50 px-4 py-2",children:[e.jsxs("span",{className:"text-sm font-medium",children:[i," selected"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(a,{size:"sm",variant:"outline",onClick:n,disabled:s,children:[s&&e.jsx(t,{className:"mr-1 h-3 w-3 animate-spin"}),"Publish"]}),e.jsx(a,{size:"sm",variant:"outline",onClick:r,disabled:s,children:"Unpublish"}),e.jsx(a,{size:"sm",variant:"destructive",onClick:()=>l(!0),disabled:s,children:"Delete"})]}),e.jsx(a,{size:"sm",variant:"ghost",onClick:o,className:"ml-auto",disabled:s,children:e.jsx(x,{className:"h-4 w-4"})})]}),e.jsx(h,{open:d,onOpenChange:l,children:e.jsxs(j,{children:[e.jsxs(p,{children:[e.jsxs(u,{children:["Delete ",i," item",i!==1?"s":"","?"]}),e.jsx(D,{children:"This action cannot be undone. The selected content items will be permanently deleted."})]}),e.jsxs(b,{children:[e.jsx(a,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),e.jsxs(a,{variant:"destructive",onClick:async()=>{l(!1),await c()},disabled:s,children:[s&&e.jsx(t,{className:"mr-1 h-3 w-3 animate-spin"}),"Delete"]})]})]})})]})}export{k as B};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./tanstack-BO6c-AOu.js";import{r as c,u as X,e as Y}from"./react-vendor-DNVhVxD7.js";import{n as Z,x as ee,B as C,I as E,Q as se,S as B,t as te,R as ae,V as le,W as ne,L as f,O as T,a as ie,D as re,h as oe,i as ce,j as de,k as me,l as ue,m as xe,s as D}from"./index-Ds50UTAc.js";import{I as P,F as he}from"./FieldBuilder-YJGSk0nY.js";import{i as $,c as ge}from"./format-CZ9bpk32.js";import{C as A}from"./checkbox-BPqrj_XS.js";import{C as je,a as pe,b as fe,c as Ce}from"./card-D1-S-QZ6.js";import{C as be,G as ve,b as Se,u as Ne,a as ye,P as De,D as Ee,c as ke}from"./core.esm-Csvubn5Q.js";import{u as Fe,C as we,b as Le,c as Re,S as Ie,v as Be,a as Te}from"./sortable.esm-Zh-9QRSf.js";import{S as Oe,a as Pe,b as $e,c as Ae,d as _e}from"./select-CJXZv4wv.js";import{T as _}from"./trash-2-Gny2Upn-.js";import{P as qe}from"./plus-BgHSYWJN.js";import"./radix-DQ3amgxj.js";import"./check-BGA0ADyt.js";const Ve=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],ze=Z("arrow-right",Ve);function Ge({id:t,relationship:s,onChange:a,onRemove:d,collections:x,readOnlyName:u,defaultExpanded:g}){const[b,m]=c.useState(g??!1),[N,j]=c.useState(!!s.label),{attributes:v,listeners:r,setNodeRef:n,transform:o,transition:S}=Fe({id:t}),h={transform:be.Transform.toString(o),transition:S};function p(i){a({...s,...i})}const k=x.find(i=>i.name===s.targetCollection)?.label??s.targetCollection;return e.jsx("div",{ref:n,style:h,className:"rounded-md border bg-card",children:e.jsxs(we,{open:b,onOpenChange:m,children:[e.jsxs("div",{className:"flex items-center gap-2 p-2",children:[e.jsx("button",{type:"button",className:"cursor-grab touch-none text-muted-foreground hover:text-foreground",...v,...r,children:e.jsx(ve,{className:"h-4 w-4"})}),e.jsx(Le,{asChild:!0,children:e.jsx("button",{type:"button",className:"flex items-center",children:e.jsx(Se,{className:ee("h-4 w-4 transition-transform",b&&"rotate-90")})})}),e.jsx("span",{className:"min-w-[80px] text-sm font-mono",children:s.name||"unnamed"}),e.jsx(ze,{className:"h-3 w-3 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:k}),e.jsx("span",{className:"flex-1 truncate text-sm text-muted-foreground",children:s.label}),e.jsx(C,{type:"button",variant:"ghost",size:"sm",onClick:d,className:"text-destructive",children:e.jsx(_,{className:"h-3 w-3"})})]}),e.jsx(Re,{children:e.jsxs("div",{className:"space-y-3 border-t p-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:"Name"}),e.jsx(P,{value:s.name,onChange:i=>p({name:i}),onBlur:()=>{s.name&&!N&&p({label:$(s.name)})},readOnly:u,className:"h-8 text-sm"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:"Label"}),e.jsx(E,{value:s.label,onChange:i=>{p({label:i.target.value}),j(!0)},className:"h-8 text-sm"})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:"Target Collection"}),e.jsxs(Oe,{value:s.targetCollection,onValueChange:i=>p({targetCollection:i}),children:[e.jsx(Pe,{className:"h-8 text-sm",children:e.jsx($e,{placeholder:"Select collection..."})}),e.jsx(Ae,{children:x.map(i=>e.jsx(_e,{value:i.name,children:i.label},i.name))})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(A,{id:`${t}-multiple`,checked:s.multiple,onCheckedChange:i=>p({multiple:!!i})}),e.jsx("label",{htmlFor:`${t}-multiple`,className:"text-sm",children:"Allow multiple"})]})]})})]})})}function He({relationships:t,onChange:s,collections:a,existingRelNames:d}){const x=Ne(ye(De)),u=t.map((r,n)=>`rel-${n}`),[g,b]=c.useState(null);function m(){b(t.length),s([...t,{name:"",label:"",targetCollection:"",multiple:!1}])}function N(r,n){const o=[...t];o[r]=n,s(o)}function j(r){s(t.filter((n,o)=>o!==r))}function v(r){const{active:n,over:o}=r;if(o&&n.id!==o.id){const S=u.indexOf(String(n.id)),h=u.indexOf(String(o.id));s(Te(t,S,h))}}return e.jsx(Ee,{sensors:x,collisionDetection:ke,onDragEnd:v,children:e.jsx(Ie,{items:u,strategy:Be,children:e.jsxs("div",{className:"space-y-2",children:[t.map((r,n)=>e.jsx(Ge,{id:`rel-${n}`,relationship:r,onChange:o=>N(n,o),onRemove:()=>j(n),collections:a,readOnlyName:!!(d?.has(r.name)&&r.name),defaultExpanded:n===g},`rel-${n}`)),e.jsxs(C,{type:"button",variant:"outline",size:"sm",onClick:m,children:[e.jsx(qe,{className:"mr-2 h-3 w-3"})," Add Relationship"]})]})})})}function ns(){const{host:t,name:s}=X(),a=s==="new",{data:d,isLoading:x}=se(t,a?"":s);return!a&&x?e.jsxs("div",{className:"space-y-4",children:[e.jsx(B,{className:"h-8 w-64"}),e.jsx(B,{className:"h-64 w-full"})]}):a?e.jsx(O,{host:t,isNew:!0}):d?e.jsx(O,{host:t,isNew:!1,collection:d},d.name):e.jsx("p",{className:"text-muted-foreground",children:"Collection not found."})}function O({host:t,isNew:s,collection:a}){const d=Y(),{collections:x}=te(),u=ae(t),g=le(t,a?.name??""),b=ne(t,a?.name??""),[m,N]=c.useState(a?.name??""),[j,v]=c.useState(a?.label??""),[r,n]=c.useState(a?.labelSingular??""),[o,S]=c.useState(a?.slug??""),[h,p]=c.useState(a?.singleton??!1),[k,i]=c.useState(!s),[q,V]=c.useState(!s),[z,G]=c.useState(!s),H=new Set((a?.fields??[]).map(l=>l.name).filter(Boolean)),L=[{name:"blocks",label:"Blocks",type:"blocks",options:{}}],[F,R]=c.useState(a?.fields??(s&&!h?L:[])),[w,M]=c.useState(a?.relationships??[]),Q=new Set((a?.relationships??[]).map(l=>l.name).filter(Boolean)),[U,I]=c.useState(!1);function W(){if(!m)return;const l=$(m);k||v(l),q||n(ge(l)),z||S(m.replace(/_/g,"-"))}async function J(l){l.preventDefault();try{s?(await u.mutateAsync({name:m,label:j,labelSingular:r,slug:o,singleton:h,fields:F,relationships:w}),D.success("Collection created"),d(`/sites/${t}/settings/collections/${m}`)):(await g.mutateAsync({label:j,labelSingular:r,slug:o,singleton:h,fields:F,relationships:w}),D.success("Collection updated"))}catch(y){D.error(s?"Failed to create":"Failed to update",{description:y instanceof Error?y.message:void 0})}}async function K(){try{await b.mutateAsync(),D.success("Collection deleted"),d(`/sites/${t}/settings/collections`)}catch(l){D.error("Failed to delete",{description:l instanceof Error?l.message:void 0})}}return e.jsxs("div",{className:"mx-auto max-w-2xl",children:[e.jsx("h1",{className:"mb-6 text-2xl font-semibold",children:s?"New Collection":`Edit: ${a?.label??m}`}),e.jsxs(je,{children:[e.jsx(pe,{children:e.jsx(fe,{children:"Collection Settings"})}),e.jsx(Ce,{children:e.jsxs("form",{onSubmit:J,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"name",children:"Name"}),e.jsx(P,{id:"name",value:m,onChange:N,onBlur:W,readOnly:!s,placeholder:"e.g. blog_posts",required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"label",children:"Label"}),e.jsx(E,{id:"label",value:j,onChange:l=>{v(l.target.value),i(!0)},required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"label-singular",children:"Label Singular"}),e.jsx(E,{id:"label-singular",value:r,onChange:l=>{n(l.target.value),V(!0)},required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"slug",children:"Slug"}),e.jsx(E,{id:"slug",value:o,onChange:l=>{S(l.target.value),G(!0)},required:!0})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(A,{id:"singleton",checked:h,onCheckedChange:l=>{const y=!!l;p(y),s&&R(y?[]:L)},disabled:!s}),e.jsx(f,{htmlFor:"singleton",children:"Singleton (single entry, no list)"})]}),e.jsx(T,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{children:"Fields"}),e.jsx(he,{fields:F,onChange:R,existingFieldNames:H})]}),e.jsx(T,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{children:"Relationships"}),e.jsx(He,{relationships:w,onChange:M,collections:x,existingRelNames:Q})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(C,{type:"submit",disabled:u.isPending||g.isPending,children:[(u.isPending||g.isPending)&&e.jsx(ie,{className:"mr-2 h-4 w-4 animate-spin"}),s?"Create":"Save"]}),e.jsx(C,{type:"button",variant:"outline",onClick:()=>d(`/sites/${t}/settings/collections`),children:"Cancel"})]})]})})]}),!s&&e.jsx("div",{className:"mt-6",children:e.jsxs(re,{open:U,onOpenChange:I,children:[e.jsx(oe,{asChild:!0,children:e.jsxs(C,{variant:"destructive",children:[e.jsx(_,{className:"mr-2 h-4 w-4"}),"Delete Collection"]})}),e.jsxs(ce,{children:[e.jsxs(de,{children:[e.jsx(me,{children:"Delete collection?"}),e.jsx(ue,{children:"This will permanently delete the collection and all its content."})]}),e.jsxs(xe,{children:[e.jsx(C,{variant:"outline",onClick:()=>I(!1),children:"Cancel"}),e.jsx(C,{variant:"destructive",onClick:K,children:"Delete"})]})]})]})})]})}export{ns as CollectionEditPage};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/BlockEditor-CZTwex-o.js","assets/tanstack-BO6c-AOu.js","assets/react-vendor-DNVhVxD7.js","assets/index-Ds50UTAc.js","assets/radix-DQ3amgxj.js","assets/index-DOqKbrpW.css","assets/command-ChD319uJ.js","assets/search-DIzcfCVh.js","assets/badge-0Z1nL6DI.js","assets/media-url-DIg_vSyf.js","assets/CustomBlockPreview-CCssn6vF.js","assets/useContent-CSobIico.js","assets/useAdminResolver-BsQc_N4z.js","assets/select-CJXZv4wv.js","assets/check-BGA0ADyt.js","assets/format-CZ9bpk32.js","assets/sortable.esm-Zh-9QRSf.js","assets/core.esm-Csvubn5Q.js","assets/card-D1-S-QZ6.js","assets/useMedia-CQnmMz4N.js","assets/useTags-CYqbj5cK.js","assets/useDebouncedValue-Bf8UizjU.js","assets/plus-BgHSYWJN.js","assets/checkbox-BPqrj_XS.js","assets/trash-2-Gny2Upn-.js","assets/contentStatus-DfWHjFVB.js","assets/BlockEditor-Cp_wZ2xN.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{j as e,u as ds}from"./tanstack-BO6c-AOu.js";import{r as p,u as me,e as us,L as hs}from"./react-vendor-DNVhVxD7.js";import{f as ms,g as ft,h as ps,i as gt,j as xs,k as fs,l as gs,m as js,n as vs,o as jt}from"./useContent-CSobIico.js";import{n as vt,v as bt,w as bs,X as G,x as R,S as O,T as yt,y as Nt,z as de,A as ue,D as ke,i as Ie,j as Pe,k as De,l as Ae,I as Z,B as S,a as Y,C as Te,s as M,E as Ct,F as J,G as ys,_ as Ns,L as ce,t as Cs,J as Ss,K as ws,M as ks,N as ht,m as St,O as Is,h as Ps}from"./index-Ds50UTAc.js";import{u as Ds}from"./useAdminResolver-BsQc_N4z.js";import{c as As,e as Ts,f as Ls,g as _s,h as Ms,O as Os}from"./radix-DQ3amgxj.js";import{S as Le,a as _e,b as Me,c as Oe,d as B,e as Rs,f as Es,g as Fs}from"./select-CJXZv4wv.js";import{f as Re,a as ve}from"./format-CZ9bpk32.js";import{u as wt,S as Ee,v as Fe,a as $e,T as kt,C as It,b as Pt,c as Dt}from"./sortable.esm-Zh-9QRSf.js";import{B as ee}from"./badge-0Z1nL6DI.js";import{C as $,a as Ne,b as Ce,c as V}from"./card-D1-S-QZ6.js";import{u as $s,a as Us,b as Vs,c as Bs,U as zs,F as Hs,d as At,T as Ws,E as qs,A as Ks,e as Js,f as Gs,g as Qs,h as Ys,i as Xs,j as Zs,k as en}from"./useMedia-CQnmMz4N.js";import{u as tn}from"./useTags-CYqbj5cK.js";import{m as Ue}from"./media-url-DIg_vSyf.js";import{C as Tt,G as Lt,u as Ve,a as Be,P as ze,D as He,c as We,b as _t}from"./core.esm-Csvubn5Q.js";import{P as sn,a as nn,b as an,C as rn,c as ln,d as on,e as cn,f as dn,g as un}from"./command-ChD319uJ.js";import{u as hn}from"./useDebouncedValue-Bf8UizjU.js";import{P as qe}from"./plus-BgHSYWJN.js";import{C as mn}from"./checkbox-BPqrj_XS.js";import{T as Mt}from"./trash-2-Gny2Upn-.js";import{g as pn,a as xn,b as fn}from"./contentStatus-DfWHjFVB.js";import{C as gn}from"./check-BGA0ADyt.js";const jn=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],vn=vt("eye",jn);const bn=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],yn=vt("rotate-ccw",bn),Nn=3e3,Cn="__HEADROOM_API_URL__".replace(/\/+$/,"");function Sn(i,t,s,n){const a=ms(i,t),r=p.useRef(null),l=p.useRef(s?JSON.stringify(s):""),o=p.useRef(void 0),[u,c]=p.useState(null),[m,N]=p.useState(null),h=p.useRef(!1),x=p.useCallback(g=>{JSON.stringify(g)!==l.current&&(r.current=g,clearTimeout(o.current),o.current=window.setTimeout(()=>{if(r.current){const C=r.current,y=JSON.stringify(C);r.current=null,a.mutate(C,{onSuccess:I=>{if(h.current){h.current=!1;return}l.current=y,c(Date.now()),I?.blockId&&N(I.blockId)},onError:I=>{I instanceof bt&&I.code==="SLUG_TAKEN"&&n?.()}})}},Nn))},[a,n]),f=p.useCallback(async g=>{if(clearTimeout(o.current),r.current){const b={...r.current};g?.createVersion&&(b.createVersion=!0);const C=JSON.stringify(r.current);r.current=null;const y=await a.mutateAsync(b);l.current=C,c(Date.now()),y?.blockId&&N(y.blockId)}else if(g?.createVersion&&l.current){const C={...JSON.parse(l.current),createVersion:!0},y=await a.mutateAsync(C);c(Date.now()),y?.blockId&&N(y.blockId)}},[a]),v=p.useCallback(()=>{clearTimeout(o.current),r.current=null},[]),w=p.useCallback(g=>{l.current=JSON.stringify(g)},[]),k=p.useCallback(()=>{clearTimeout(o.current),r.current=null,h.current=!0,N(null)},[]);return p.useEffect(()=>()=>{if(clearTimeout(o.current),r.current){const g=JSON.stringify(r.current),b=bs(),C=`${Cn}/v1/admin/sites/${i}/content/${t}/draft`;fetch(C,{method:"PUT",body:g,headers:{"Content-Type":"application/json",...b?{Authorization:`Bearer ${b}`}:{}},keepalive:!0}).catch(()=>{}),r.current=null}},[i,t]),{schedule:x,flush:f,cancel:v,resetBaseline:w,discard:k,isSaving:a.isPending,lastSavedAt:u,lastSavedBlockId:m}}const be=768;function wn(){const[i,t]=p.useState(void 0);return p.useEffect(()=>{const s=window.matchMedia(`(max-width: ${be-1}px)`),n=()=>{t(window.innerWidth<be)};return s.addEventListener("change",n),t(window.innerWidth<be),()=>s.removeEventListener("change",n)},[]),!!i}function kn({...i}){return e.jsx(As,{"data-slot":"sheet",...i})}function In({...i}){return e.jsx(Ms,{"data-slot":"sheet-portal",...i})}function Pn({className:i,...t}){return e.jsx(Os,{"data-slot":"sheet-overlay",className:R("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",i),...t})}function Dn({className:i,children:t,side:s="right",showCloseButton:n=!0,...a}){return e.jsxs(In,{children:[e.jsx(Pn,{}),e.jsxs(Ts,{"data-slot":"sheet-content",className:R("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",s==="right"&&"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",s==="left"&&"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",s==="top"&&"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",s==="bottom"&&"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",i),...a,children:[t,n&&e.jsxs(Ls,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",children:[e.jsx(G,{className:"size-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function An({className:i,...t}){return e.jsx("div",{"data-slot":"sheet-header",className:R("flex flex-col gap-1.5 p-4",i),...t})}function Tn({className:i,...t}){return e.jsx(_s,{"data-slot":"sheet-title",className:R("text-foreground font-semibold",i),...t})}function Ln({lines:i}){return e.jsx("div",{className:"font-mono text-sm leading-relaxed",children:i.map((t,s)=>e.jsx("div",{style:{paddingLeft:`${t.indent*1.5}rem`},className:R("min-h-[1.5em]",t.type==="label"&&"text-muted-foreground font-semibold mt-1",t.type==="heading"&&"font-bold",t.type==="empty"&&"h-2"),children:t.text},s))})}class _n{diff(t,s,n={}){let a;typeof n=="function"?(a=n,n={}):"callback"in n&&(a=n.callback);const r=this.castInput(t,n),l=this.castInput(s,n),o=this.removeEmpty(this.tokenize(r,n)),u=this.removeEmpty(this.tokenize(l,n));return this.diffWithOptionsObj(o,u,n,a)}diffWithOptionsObj(t,s,n,a){var r;const l=g=>{if(g=this.postProcess(g,n),a){setTimeout(function(){a(g)},0);return}else return g},o=s.length,u=t.length;let c=1,m=o+u;n.maxEditLength!=null&&(m=Math.min(m,n.maxEditLength));const N=(r=n.timeout)!==null&&r!==void 0?r:1/0,h=Date.now()+N,x=[{oldPos:-1,lastComponent:void 0}];let f=this.extractCommon(x[0],s,t,0,n);if(x[0].oldPos+1>=u&&f+1>=o)return l(this.buildValues(x[0].lastComponent,s,t));let v=-1/0,w=1/0;const k=()=>{for(let g=Math.max(v,-c);g<=Math.min(w,c);g+=2){let b;const C=x[g-1],y=x[g+1];C&&(x[g-1]=void 0);let I=!1;if(y){const T=y.oldPos-g;I=y&&0<=T&&T<o}const D=C&&C.oldPos+1<u;if(!I&&!D){x[g]=void 0;continue}if(!D||I&&C.oldPos<y.oldPos?b=this.addToPath(y,!0,!1,0,n):b=this.addToPath(C,!1,!0,1,n),f=this.extractCommon(b,s,t,g,n),b.oldPos+1>=u&&f+1>=o)return l(this.buildValues(b.lastComponent,s,t))||!0;x[g]=b,b.oldPos+1>=u&&(w=Math.min(w,g-1)),f+1>=o&&(v=Math.max(v,g+1))}c++};if(a)(function g(){setTimeout(function(){if(c>m||Date.now()>h)return a(void 0);k()||g()},0)})();else for(;c<=m&&Date.now()<=h;){const g=k();if(g)return g}}addToPath(t,s,n,a,r){const l=t.lastComponent;return l&&!r.oneChangePerToken&&l.added===s&&l.removed===n?{oldPos:t.oldPos+a,lastComponent:{count:l.count+1,added:s,removed:n,previousComponent:l.previousComponent}}:{oldPos:t.oldPos+a,lastComponent:{count:1,added:s,removed:n,previousComponent:l}}}extractCommon(t,s,n,a,r){const l=s.length,o=n.length;let u=t.oldPos,c=u-a,m=0;for(;c+1<l&&u+1<o&&this.equals(n[u+1],s[c+1],r);)c++,u++,m++,r.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return m&&!r.oneChangePerToken&&(t.lastComponent={count:m,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=u,c}equals(t,s,n){return n.comparator?n.comparator(t,s):t===s||!!n.ignoreCase&&t.toLowerCase()===s.toLowerCase()}removeEmpty(t){const s=[];for(let n=0;n<t.length;n++)t[n]&&s.push(t[n]);return s}castInput(t,s){return t}tokenize(t,s){return Array.from(t)}join(t){return t.join("")}postProcess(t,s){return t}get useLongestToken(){return!1}buildValues(t,s,n){const a=[];let r;for(;t;)a.push(t),r=t.previousComponent,delete t.previousComponent,t=r;a.reverse();const l=a.length;let o=0,u=0,c=0;for(;o<l;o++){const m=a[o];if(m.removed)m.value=this.join(n.slice(c,c+m.count)),c+=m.count;else{if(!m.added&&this.useLongestToken){let N=s.slice(u,u+m.count);N=N.map(function(h,x){const f=n[c+x];return f.length>h.length?f:h}),m.value=this.join(N)}else m.value=this.join(s.slice(u,u+m.count));u+=m.count,m.added||(c+=m.count)}}return a}}class Mn extends _n{tokenize(t){return t.slice()}join(t){return t}removeEmpty(t){return t}}const On=new Mn;function Ot(i,t,s){return On.diff(i,t,s)}const Rn=5;function En({published:i,draft:t,leftLabel:s="Published",rightLabel:n="Draft"}){const a=p.useMemo(()=>Un(i,t),[i,t]),r=p.useMemo(()=>Vn(a),[a]);return a.every(l=>l.type==="unchanged")?e.jsxs("p",{className:"text-sm text-muted-foreground italic py-4",children:["No changes between ",s," and ",n," versions."]}):e.jsxs("div",{className:"font-mono text-xs leading-relaxed border rounded-md overflow-hidden",children:[e.jsxs("div",{className:"grid grid-cols-2 border-b bg-muted/50 text-muted-foreground text-[10px] font-semibold",children:[e.jsx("div",{className:"px-3 py-1.5",children:s}),e.jsx("div",{className:"px-3 py-1.5 border-l",children:n})]}),e.jsx("div",{children:r.map((l,o)=>e.jsx(Fn,{segment:l},o))})]})}function Fn({segment:i}){const[t,s]=p.useState(!1);return i.type==="collapsed"&&!t?e.jsxs("button",{onClick:()=>s(!0),className:"w-full grid grid-cols-2 text-[10px] text-muted-foreground bg-muted/30 hover:bg-muted/50 transition-colors cursor-pointer",children:[e.jsxs("div",{className:"px-3 py-1 text-center border-b",children:["... ",i.count," unchanged lines ..."]}),e.jsxs("div",{className:"px-3 py-1 text-center border-l border-b",children:["... ",i.count," unchanged lines ..."]})]}):i.type==="collapsed"?null:e.jsx(e.Fragment,{children:i.rows.map((n,a)=>e.jsx($n,{row:n},a))})}function $n({row:i}){return e.jsxs("div",{className:"grid grid-cols-2 border-b last:border-b-0",children:[e.jsx("div",{className:R("px-3 py-0.5 min-h-[1.5em]",i.type==="removed"&&"bg-red-50 dark:bg-red-950/30"),style:i.left?{paddingLeft:`calc(0.75rem + ${i.left.indent*1}rem)`}:void 0,children:e.jsx("span",{className:R(i.left?.type==="label"&&"text-muted-foreground font-semibold",i.left?.type==="heading"&&"font-bold"),children:i.left?.text??""})}),e.jsx("div",{className:R("px-3 py-0.5 min-h-[1.5em] border-l",i.type==="added"&&"bg-green-50 dark:bg-green-950/30"),style:i.right?{paddingLeft:`calc(0.75rem + ${i.right.indent*1}rem)`}:void 0,children:e.jsx("span",{className:R(i.right?.type==="label"&&"text-muted-foreground font-semibold",i.right?.type==="heading"&&"font-bold"),children:i.right?.text??""})})]})}function Un(i,t){const s=Ot(i,t,{comparator:(a,r)=>a.text===r.text&&a.indent===r.indent&&a.type===r.type}),n=[];for(const a of s)if(a.added)for(const r of a.value)n.push({type:"added",right:r});else if(a.removed)for(const r of a.value)n.push({type:"removed",left:r});else for(const r of a.value)n.push({type:"unchanged",left:r,right:r});return n}function Vn(i){const t=[];let s=[];function n(){if(s.length!==0){if(s.length>Rn){const l=s.slice(0,2),o=s.slice(-2),u=s.length-4;t.push({type:"rows",rows:l}),u>0&&t.push({type:"collapsed",count:u}),t.push({type:"rows",rows:o})}else t.push({type:"rows",rows:s});s=[]}}let a=[];function r(){a.length!==0&&(t.push({type:"rows",rows:a}),a=[])}for(const l of i)l.type==="unchanged"?(r(),s.push(l)):(n(),a.push(l));return r(),n(),t}function Se(i){switch(i.kind){case"draft":return"Draft";case"published":return"Published";case"history":return Re(i.createdAt)}}function he(i){switch(i.kind){case"draft":return"draft";case"published":return"published";case"history":return`history:${i.blockId}`}}function mt({value:i,onChange:t,isPublished:s,versions:n,exclude:a,size:r}){const l=a?he(a):null;function o(u){if(u==="draft")t({kind:"draft"});else if(u==="published")t({kind:"published"});else if(u.startsWith("history:")){const c=u.slice(8),m=n.find(N=>N.blockId===c);m&&t({kind:"history",blockId:m.blockId,createdAt:m.createdAt,title:m.title})}}return e.jsxs(Le,{value:he(i),onValueChange:o,children:[e.jsx(_e,{size:r,children:e.jsx(Me,{children:Se(i)})}),e.jsxs(Oe,{position:"popper",children:[l!=="draft"&&e.jsx(B,{value:"draft",children:"Draft"}),s&&l!=="published"&&e.jsx(B,{value:"published",children:"Published"}),n.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(Rs,{}),e.jsxs(Es,{children:[e.jsx(Fs,{children:"Version History"}),n.map(u=>{const c=`history:${u.blockId}`;return c===l?null:e.jsx(B,{value:c,children:Re(u.createdAt)},c)})]})]})]})]})}function Rt(i,t){if(t==null||t==="")return[{text:"(empty)",indent:0,type:"value"}];switch(i.type){case"text":case"url":case"email":case"date":case"number":case"select":return[{text:String(t),indent:0,type:"value"}];case"textarea":return String(t).split(`
|
|
3
|
-
`).map(s=>({text:s,indent:0,type:"value"}));case"boolean":return[{text:t?"Yes":"No",indent:0,type:"value"}];case"media":return[{text:`[Media: ${t}]`,indent:0,type:"value"}];case"blocks":return we(t);case"array":return Hn(i,t);default:return[{text:String(t),indent:0,type:"value"}]}}function X(i,t,s,n){const a=[];s&&(s.title!==void 0&&(a.push({text:"Title",indent:0,type:"label"}),a.push({text:s.title||"(empty)",indent:0,type:"value"}),a.push({text:"",indent:0,type:"empty"})),s.slug!==void 0&&(a.push({text:"Slug",indent:0,type:"label"}),a.push({text:s.slug||"(empty)",indent:0,type:"value"}),a.push({text:"",indent:0,type:"empty"})),s.snippet!==void 0&&(a.push({text:"Snippet",indent:0,type:"label"}),a.push({text:s.snippet||"(empty)",indent:0,type:"value"}),a.push({text:"",indent:0,type:"empty"})),s.tags!==void 0&&(a.push({text:"Tags",indent:0,type:"label"}),a.push({text:s.tags.length>0?s.tags.join(", "):"(empty)",indent:0,type:"value"}),a.push({text:"",indent:0,type:"empty"})));for(const r of i){a.push({text:r.label,indent:0,type:"label"});const l=Rt(r,t[r.name]);a.push(...l),a.push({text:"",indent:0,type:"empty"})}if(n&&n.defs.length>0)for(const r of n.defs){a.push({text:r.label,indent:0,type:"label"});const l=n.values[r.name]??[];l.length===0?a.push({text:"(empty)",indent:0,type:"value"}):a.push({text:l.map(o=>o.title).join(", "),indent:0,type:"value"}),a.push({text:"",indent:0,type:"empty"})}return a.length>0&&a[a.length-1].type==="empty"&&a.pop(),a}const Bn=[["bold","**","**"],["italic","_","_"],["underline","__","__"],["strike","~~","~~"],["code","`","`"]];function zn(i,t){if(!t||!i)return i;let s=i;for(const[n,a,r]of Bn)t[n]===!0&&(s=a+s+r);return s}function K(i){return Array.isArray(i)?i.map(t=>typeof t.text=="string"?zn(t.text,t.styles):t.type==="link"&&Array.isArray(t.content)?`[${K(t.content)}](${t.href??""})`:"").join(""):""}function we(i,t=0){if(!Array.isArray(i))return[{text:"(empty)",indent:0,type:"value"}];if(i.length===0)return[{text:"(empty)",indent:0,type:"value"}];const s=[];let n=0;for(const a of i){if(typeof a!="object"||a===null)continue;const r=a,l=r.type??"";switch(l!=="numberedListItem"&&(n=0),l){case"paragraph":{const o=K(r.content);s.push({text:o||"",indent:t,type:"value"});break}case"heading":{const o=r.props?.level??1,u="#".repeat(Math.min(o,6))+" ",c=K(r.content);s.push({text:u+c,indent:t,type:"heading"});break}case"bulletListItem":{const o=K(r.content);s.push({text:`- ${o}`,indent:t,type:"list-item"});break}case"numberedListItem":{n++;const o=K(r.content);s.push({text:`${n}. ${o}`,indent:t,type:"list-item"});break}case"image":case"HeadroomImage":{const o=r.props?.alt,u=r.props?.mediaId,c=o||u||"image";s.push({text:`[Image: ${c}]`,indent:t,type:"value"});break}default:{if(r.props&&typeof r.props=="object"){const o=r.props,u=Object.entries(o).filter(([c])=>!["textAlignment","level"].includes(c));if(u.length>0){s.push({text:`[${l}]`,indent:t,type:"label"});for(const[c,m]of u)m==null||m===""||(Array.isArray(m)?(s.push({text:`${c}:`,indent:t+1,type:"label"}),s.push(...we(m,t+2))):s.push({text:`${c}: ${String(m)}`,indent:t+1,type:"value"}))}else s.push({text:`[${l}]`,indent:t,type:"value"})}else{const o=K(r.content);o&&s.push({text:o,indent:t,type:"value"})}break}}Array.isArray(r.children)&&r.children.length>0&&s.push(...we(r.children,t+1))}return s}function Hn(i,t){if(!Array.isArray(t)||t.length===0)return[{text:"(empty)",indent:0,type:"value"}];const n=i.options?.itemFields??[],a=[];for(let r=0;r<t.length;r++){a.push({text:`${r+1}.`,indent:0,type:"list-item"});const l=t[r];if(n.length>0)for(const o of n){a.push({text:o.label+":",indent:1,type:"label"});const u=Rt(o,l[o.name]);a.push(...u.map(c=>({...c,indent:c.indent+1})))}else a.push({text:JSON.stringify(l,null,2),indent:1,type:"value"})}return a}function pt({ref:i,host:t,contentId:s,collectionFields:n,isSingleton:a,draftBody:r,draftMetadata:l,collectionRelationships:o,draftRelationships:u}){const c=i?.kind==="published",m=i?.kind==="history",N=m?i.blockId:null,{data:h,isLoading:x}=ft(t,s,c),{data:f,isLoading:v}=ps(t,s,m?N:null),w=p.useMemo(()=>(o??[]).map(b=>({name:b.name,label:b.label})),[o]);function k(b){if(w.length!==0)return{defs:w,values:b??{}}}const g=p.useMemo(()=>{if(!i)return[];if(i.kind==="draft")return r?X(n,r,a?void 0:l,k(u)):[];if(i.kind==="published"){if(!h)return[];const y=a?void 0:{title:h.title,slug:h.slug,snippet:h.snippet,tags:h.tags},I=h.relationships;return X(n,h.body??{},y,k(I))}if(!f)return[];const b=a?void 0:{title:f.title,slug:f.slug,snippet:f.snippet,tags:f.tags},C=f.relationships;return X(n,f.body??{},b,k(C))},[i,r,l,u,h,f,n,a,w]);return i?i.kind==="draft"?{lines:g,isLoading:!1,hasData:!!r}:i.kind==="published"?{lines:g,isLoading:x,hasData:!!h}:{lines:g,isLoading:v,hasData:!!f}:{lines:[],isLoading:!1,hasData:!1}}function Wn({open:i,onOpenChange:t,host:s,contentId:n,collectionFields:a,isSingleton:r,isPublished:l,draftBody:o,draftMetadata:u,initialVersion:c,collectionRelationships:m,draftRelationships:N}){const[h,x]=p.useState(c??{kind:"published"}),[f,v]=p.useState({kind:"draft"}),[w,k]=p.useState(i),[g,b]=p.useState(c);if((i!==w||c!==g)&&(k(i),b(c),i)){const L=c??{kind:"published"};x(L),v(L.kind==="draft"?{kind:"published"}:{kind:"draft"})}he(h)===he(f)&&(h.kind!=="draft"?v({kind:"draft"}):l&&v({kind:"published"}));const{data:C}=gt(s,n),y=C?.items??[],I={host:s,contentId:n,collectionFields:a,isSingleton:r,draftBody:o,draftMetadata:u,collectionRelationships:m,draftRelationships:N},D=pt({ref:h,...I}),T=pt({ref:f,...I}),j=D.isLoading;return e.jsx(kn,{open:i,onOpenChange:t,children:e.jsxs(Dn,{className:"sm:max-w-2xl overflow-y-auto",children:[e.jsx(An,{children:e.jsxs(Tn,{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-muted-foreground text-sm font-normal",children:"Viewing"}),e.jsx(mt,{value:h,onChange:x,isPublished:l,versions:y,size:"sm"})]})}),j&&e.jsxs("div",{className:"space-y-4 p-4",children:[e.jsx(O,{className:"h-6 w-48"}),e.jsx(O,{className:"h-4 w-full"}),e.jsx(O,{className:"h-4 w-full"}),e.jsx(O,{className:"h-4 w-2/3"})]}),!j&&!D.hasData&&e.jsx("p",{className:"p-4 text-sm text-muted-foreground",children:"No data available for this version."}),!j&&D.hasData&&e.jsx("div",{className:"p-4",children:e.jsxs(yt,{defaultValue:"changes",children:[e.jsxs(Nt,{variant:"line",className:"mb-4",children:[e.jsx(de,{value:"content",children:"Content"}),e.jsx(de,{value:"changes",children:"Changes"})]}),e.jsx(ue,{value:"content",children:e.jsx(Ln,{lines:D.lines})}),e.jsxs(ue,{value:"changes",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Compare with"}),e.jsx(mt,{value:f,onChange:v,isPublished:l,versions:y,exclude:h,size:"sm"})]}),T.isLoading?e.jsxs("div",{className:"space-y-4",children:[e.jsx(O,{className:"h-4 w-full"}),e.jsx(O,{className:"h-4 w-full"}),e.jsx(O,{className:"h-4 w-2/3"})]}):T.hasData?e.jsx(En,{published:D.lines,draft:T.lines,leftLabel:Se(h),rightLabel:Se(f)}):e.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No data available for comparison."})]})]})})]})})}function Et({open:i,onSelect:t,onClose:s,allowedTypes:n}){const{host:a}=me(),[r,l]=p.useState(""),[o,u]=p.useState("__all__"),c=p.useRef(null),m=$s(a),N=Us(a),{data:h}=Vs(a),x=h?.items??[],f=o==="__all__"?void 0:o==="__unfiled__"?"":o,{data:v,fetchNextPage:w,hasNextPage:k,isFetchingNextPage:g}=Bs(a,{folderId:f}),[b,C]=p.useState(!1),I=(v?.pages.flatMap(j=>j.items)??[]).filter(j=>n&&!n.some(A=>A.endsWith("/*")?j.mimeType.startsWith(A.slice(0,-1)):j.mimeType===A)?!1:r?j.filename.toLowerCase().includes(r.toLowerCase())||j.alt?.toLowerCase().includes(r.toLowerCase()):!0);async function D(j){C(!0);try{const{uploadUrl:L,mediaId:A}=await m.mutateAsync({filename:j.name,contentType:j.type,size:j.size});await fetch(L,{method:"PUT",body:j,headers:{"Content-Type":j.type}});const te=await N.mutateAsync({mediaId:A,filename:j.name});t(te),s()}catch(L){M.error("Upload failed",{description:L instanceof Error?L.message:void 0})}finally{C(!1)}}function T(j){return j.startsWith("image/")}return e.jsx(ke,{open:i,onOpenChange:()=>s(),children:e.jsxs(Ie,{className:"max-w-3xl",children:[e.jsxs(Pe,{children:[e.jsx(De,{children:"Select Media"}),e.jsx(Ae,{className:"sr-only",children:"Browse and select media files"})]}),e.jsxs("div",{className:"mb-4 flex justify-between gap-2",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Z,{placeholder:"Search by filename...",value:r,onChange:j=>l(j.target.value),className:"max-w-xs"}),x.length>0&&e.jsxs(Le,{value:o,onValueChange:u,children:[e.jsx(_e,{className:"w-[150px]",children:e.jsx(Me,{})}),e.jsxs(Oe,{children:[e.jsx(B,{value:"__all__",children:"All folders"}),x.map(j=>e.jsx(B,{value:j.folderId,children:j.name},j.folderId)),e.jsx(B,{value:"__unfiled__",children:"Unfiled"})]})]})]}),e.jsxs("div",{children:[e.jsx("input",{ref:c,type:"file",className:"hidden",accept:n?.join(",")??void 0,onChange:j=>j.target.files?.[0]&&D(j.target.files[0])}),e.jsxs(S,{variant:"outline",onClick:()=>c.current?.click(),disabled:b,children:[b?e.jsx(Y,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(zs,{className:"mr-2 h-4 w-4"}),"Upload New"]})]})]}),e.jsx("div",{className:"grid max-h-96 grid-cols-4 gap-3 overflow-y-auto",children:I.map(j=>e.jsxs($,{className:"cursor-pointer overflow-hidden hover:ring-2 hover:ring-primary",onClick:()=>{t(j),s()},children:[e.jsx("div",{className:"flex aspect-square items-center justify-center bg-muted",children:T(j.mimeType)?e.jsx("img",{src:Ue(j.urls?.thumb_md??j.url),alt:j.alt??j.filename,className:"h-full w-full object-cover"}):e.jsxs("div",{className:"flex flex-col items-center gap-1 p-2",children:[j.mimeType.startsWith("image/")?e.jsx(Te,{className:"h-8 w-8 text-muted-foreground"}):e.jsx(Hs,{className:"h-8 w-8 text-muted-foreground"}),e.jsx("span",{className:"max-w-full truncate text-xs text-muted-foreground",children:j.filename})]})}),e.jsx("div",{className:"p-1.5",children:e.jsx("p",{className:"truncate text-xs",children:j.filename})})]},j.mediaId))}),I.length===0&&e.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"No media found."}),k&&e.jsxs(S,{variant:"ghost",className:"mt-2 w-full",onClick:()=>w(),disabled:g,children:[g?e.jsx(Y,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Load More"]})]})})}function qn(i,t,s){const n=Ct(),a=s?.length===1?s[0]:void 0,r=new URLSearchParams;return t?(r.set("q",t),r.set("search","full")):r.set("limit","5"),a&&r.set("collection",a),ds({queryKey:["sites",i,"content-search",t,s??[]],queryFn:async()=>{const l=await n.apiFetch(`/v1/admin/sites/${i}/content?${r.toString()}`);return s&&s.length>1?{...l,items:l.items.filter(o=>s.includes(o.collection))}:l},enabled:!!i,staleTime:3e4})}function Kn({field:i,value:t,onChange:s}){const{host:n}=me(),a=i.options,r=!!a?.multiple,l=a?.collections;return r?e.jsx(Gn,{host:n,collections:l,value:t??[],onChange:s}):e.jsx(Jn,{host:n,collections:l,value:t,onChange:s})}function Jn({host:i,collections:t,value:s,onChange:n}){const[a,r]=p.useState(!1),l=s?[s.contentId]:[];function o(u){n(u),r(!1)}return e.jsx("div",{children:s?e.jsxs("div",{className:"flex items-center gap-3 rounded-md border p-2",children:[e.jsx(J,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),e.jsx("span",{className:"flex-1 truncate text-sm",children:s.title}),e.jsx(ee,{variant:"secondary",children:s.collection}),e.jsx(S,{type:"button",variant:"ghost",size:"sm",onClick:()=>n(null),children:e.jsx(G,{className:"h-3 w-3"})})]}):e.jsx(pe,{host:i,collections:t,selectedIds:l,open:a,onOpenChange:r,onSelect:o,trigger:e.jsxs(S,{type:"button",variant:"outline",children:[e.jsx(J,{className:"mr-2 h-4 w-4"}),"Select Content"]})})})}function Gn({host:i,collections:t,value:s,onChange:n}){const a=Ve(Be(ze)),[r,l]=p.useState(!1),o=s??[],u=o.map(x=>x.contentId),c=o.map(x=>x.contentId);function m(x){n([...o,x]),l(!1)}function N(x){n(o.filter((f,v)=>v!==x))}function h(x){const{active:f,over:v}=x;if(v&&f.id!==v.id){const w=o.findIndex(g=>g.contentId===String(f.id)),k=o.findIndex(g=>g.contentId===String(v.id));w!==-1&&k!==-1&&n($e(o,w,k))}}return e.jsx(He,{sensors:a,collisionDetection:We,onDragEnd:h,children:e.jsx(Ee,{items:u,strategy:Fe,children:e.jsxs("div",{className:"space-y-2",children:[o.map(x=>e.jsx(Ft,{id:x.contentId,contentRef:x,onRemove:()=>N(o.indexOf(x))},x.contentId)),e.jsx(pe,{host:i,collections:t,selectedIds:c,open:r,onOpenChange:l,onSelect:m,trigger:e.jsxs(S,{type:"button",variant:"outline",size:"sm",children:[e.jsx(qe,{className:"mr-2 h-3 w-3"}),"Add Content"]})})]})})})}function Ft({id:i,contentRef:t,onRemove:s}){const{attributes:n,listeners:a,setNodeRef:r,transform:l,transition:o}=wt({id:i}),u={transform:Tt.Transform.toString(l),transition:o};return e.jsxs("div",{ref:r,style:u,className:"flex items-center gap-2 rounded-md border p-2",children:[e.jsx("button",{type:"button",className:"cursor-grab touch-none text-muted-foreground hover:text-foreground",...n,...a,children:e.jsx(Lt,{className:"h-4 w-4"})}),e.jsx(J,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),e.jsx("span",{className:"flex-1 truncate text-sm",children:t.title}),e.jsx(ee,{variant:"secondary",children:t.collection}),e.jsx(S,{type:"button",variant:"ghost",size:"sm",onClick:s,className:"text-destructive",children:e.jsx(G,{className:"h-3 w-3"})})]})}function pe({host:i,collections:t,selectedIds:s,open:n,onOpenChange:a,onSelect:r,trigger:l}){const[o,u]=p.useState(""),c=hn(o,300),{data:m,isLoading:N}=qn(i,c,t);return e.jsxs(sn,{open:n,onOpenChange:a,children:[e.jsx(nn,{asChild:!0,children:l}),e.jsx(an,{className:"w-80 p-0",align:"start",children:e.jsxs(rn,{shouldFilter:!1,children:[e.jsx(ln,{placeholder:"Search content...",value:o,onValueChange:u}),e.jsx(on,{children:N?e.jsx("p",{className:"py-6 text-center text-sm text-muted-foreground",children:"Searching..."}):e.jsxs(e.Fragment,{children:[e.jsx(cn,{children:"No content found."}),e.jsx(dn,{heading:c.length===0?"Recent":void 0,children:m?.items.map(h=>{const x=s.includes(h.contentId);return e.jsxs(un,{value:h.contentId,disabled:x,onSelect:()=>r({contentId:h.contentId,collection:h.collection,slug:h.slug??"",title:h.title}),children:[e.jsx(J,{className:"h-4 w-4"}),e.jsx("span",{className:"flex-1 truncate",children:h.title}),e.jsx(ee,{variant:"outline",className:"text-xs",children:h.collection})]},h.contentId)})})]})})]})})]})}function Qn({relationships:i,values:t,onChange:s,host:n}){return e.jsxs($,{children:[e.jsx(Ne,{children:e.jsx(Ce,{children:"Relationships"})}),e.jsx(V,{className:"space-y-4",children:i.map(a=>a.multiple?e.jsx(Xn,{rel:a,items:t[a.name]??[],host:n,onChange:r=>s({...t,[a.name]:r})},a.name):e.jsx(Yn,{rel:a,value:t[a.name]?.[0]??null,host:n,onChange:r=>s({...t,[a.name]:r?[r]:[]})},a.name))})]})}function Yn({rel:i,value:t,host:s,onChange:n}){const[a,r]=p.useState(!1),l=t?[t.contentId]:[];return e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:i.label}),t?e.jsxs("div",{className:"flex items-center gap-3 rounded-md border p-2",children:[e.jsx(J,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),e.jsx("span",{className:"flex-1 truncate text-sm",children:t.title}),e.jsx(ee,{variant:"secondary",children:t.collection}),e.jsx(S,{type:"button",variant:"ghost",size:"sm",onClick:()=>n(null),children:e.jsx(G,{className:"h-3 w-3"})})]}):e.jsx(pe,{host:s,collections:[i.targetCollection],selectedIds:l,open:a,onOpenChange:r,onSelect:o=>{n(o),r(!1)},trigger:e.jsxs(S,{type:"button",variant:"outline",size:"sm",children:[e.jsx(J,{className:"mr-2 h-4 w-4"}),"Select ",i.label]})})]})}function Xn({rel:i,items:t,host:s,onChange:n}){const a=Ve(Be(ze)),[r,l]=p.useState(!1),o=t.map(h=>h.contentId),u=t.map(h=>h.contentId);function c(h){n([...t,h]),l(!1)}function m(h){n(t.filter((x,f)=>f!==h))}function N(h){const{active:x,over:f}=h;if(f&&x.id!==f.id){const v=t.findIndex(k=>k.contentId===String(x.id)),w=t.findIndex(k=>k.contentId===String(f.id));v!==-1&&w!==-1&&n($e(t,v,w))}}return e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:i.label}),e.jsx(He,{sensors:a,collisionDetection:We,onDragEnd:N,children:e.jsx(Ee,{items:o,strategy:Fe,children:e.jsxs("div",{className:"space-y-2",children:[t.map(h=>e.jsx(Ft,{id:h.contentId,contentRef:h,onRemove:()=>m(t.indexOf(h))},h.contentId)),e.jsx(pe,{host:s,collections:[i.targetCollection],selectedIds:u,open:r,onOpenChange:l,onSelect:c,trigger:e.jsxs(S,{type:"button",variant:"outline",size:"sm",children:[e.jsx(qe,{className:"mr-2 h-3 w-3"}),"Add ",i.label]})})]})})})]})}function ye({field:i,value:t,onChange:s}){const n=i.options;return e.jsx(Z,{value:t??"",onChange:a=>s(a.target.value),placeholder:n?.placeholder,maxLength:n?.maxLength,required:!!n?.required,type:i.type==="url"?"url":i.type==="email"?"email":"text"})}function Zn({field:i,value:t,onChange:s}){const n=i.options;return e.jsx(kt,{value:t??"",onChange:a=>s(a.target.value),placeholder:n?.placeholder,maxLength:n?.maxLength,required:!!n?.required,rows:4})}function ea({field:i,value:t,onChange:s}){const n=i.options;return e.jsx(Z,{type:"number",value:t??"",onChange:a=>s(a.target.value===""?void 0:Number(a.target.value)),min:n?.min,max:n?.max,step:n?.step,required:!!n?.required})}function ta({field:i,value:t,onChange:s}){return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(mn,{id:`field-${i.name}`,checked:!!t,onCheckedChange:n=>s(!!n)}),e.jsx("label",{htmlFor:`field-${i.name}`,className:"text-sm text-muted-foreground",children:i.label})]})}function sa({field:i,value:t,onChange:s}){const a=i.options?.choices??[];return e.jsxs(Le,{value:t??"",onValueChange:r=>s(r),children:[e.jsx(_e,{children:e.jsx(Me,{placeholder:"Select..."})}),e.jsx(Oe,{children:a.map(r=>e.jsx(B,{value:r,children:r},r))})]})}function na({field:i,value:t,onChange:s}){const{host:n}=me(),[a,r]=p.useState(!1),o=i.options?.allowedTypes,u=typeof t=="string"?t:t?.mediaId??"",{data:c}=At(n,u);return e.jsxs("div",{children:[u?e.jsxs("div",{className:"flex items-center gap-3 rounded-md border p-2 cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>r(!0),children:[c?.url&&e.jsx("img",{src:Ue(c.urls?.thumb_sm??c.url),alt:c?.filename??"",className:"h-10 w-10 rounded object-cover bg-muted"}),e.jsx("span",{className:"flex-1 truncate text-sm",children:c?.filename??"Loading..."}),e.jsx(S,{type:"button",variant:"ghost",size:"sm",onClick:m=>{m.stopPropagation(),s("")},children:e.jsx(G,{className:"h-3 w-3"})})]}):e.jsxs(S,{type:"button",variant:"outline",onClick:()=>r(!0),children:[e.jsx(Te,{className:"mr-2 h-4 w-4"}),"Select Media"]}),e.jsx(Et,{open:a,onClose:()=>r(!1),onSelect:m=>{s({mediaId:m.mediaId,url:m.url,width:m.width??0,height:m.height??0,filename:m.filename}),r(!1)},allowedTypes:o})]})}function aa({field:i,value:t,onChange:s}){const n=Ve(Be(ze)),a=t??[],l=i.options?.itemFields??[],o=a.map((h,x)=>`item-${x}`);function u(){s([...a,{}])}function c(h){s(a.filter((x,f)=>f!==h))}function m(h,x){const f=[...a];f[h]=x,s(f)}function N(h){const{active:x,over:f}=h;if(f&&x.id!==f.id){const v=o.indexOf(String(x.id)),w=o.indexOf(String(f.id));s($e(a,v,w))}}return e.jsx(He,{sensors:n,collisionDetection:We,onDragEnd:N,children:e.jsx(Ee,{items:o,strategy:Fe,children:e.jsxs("div",{className:"space-y-3",children:[a.map((h,x)=>e.jsx(ia,{id:`item-${x}`,itemFields:l,item:h,onUpdate:f=>m(x,f),onRemove:()=>c(x)},`item-${x}`)),e.jsxs(S,{type:"button",variant:"outline",size:"sm",onClick:u,children:[e.jsx(qe,{className:"mr-2 h-3 w-3"})," Add Item"]})]})})})}function ia({id:i,itemFields:t,item:s,onUpdate:n,onRemove:a}){const{attributes:r,listeners:l,setNodeRef:o,transform:u,transition:c}=wt({id:i}),m={transform:Tt.Transform.toString(u),transition:c};return e.jsx($,{ref:o,style:m,children:e.jsxs(V,{className:"flex gap-2 p-3",children:[e.jsx("button",{type:"button",className:"cursor-grab touch-none text-muted-foreground hover:text-foreground",...r,...l,children:e.jsx(Lt,{className:"h-4 w-4"})}),e.jsx("div",{className:"flex-1",children:e.jsx($t,{fields:t,values:s,onChange:n})}),e.jsx(S,{type:"button",variant:"ghost",size:"sm",onClick:a,className:"text-destructive",children:e.jsx(Mt,{className:"h-3 w-3"})})]})})}const ra=p.lazy(()=>Ns(()=>import("./BlockEditor-CZTwex-o.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]))),la=2,xt=p.createContext(0);function oa({value:i,onChange:t,compact:s=!0}){const n=p.useContext(xt),r=ys()?.blockTypes??[];return n>=la?e.jsx("div",{className:"rounded-md border border-muted p-4 text-sm text-muted-foreground",children:"Maximum nesting depth reached. Cannot embed another block editor here."}):e.jsx(xt.Provider,{value:n+1,children:e.jsx("div",{className:"rounded-md border",children:e.jsx(p.Suspense,{fallback:e.jsx(O,{className:"h-48"}),children:e.jsx(ra,{initialBlocks:i??[],onChange:t,blockTypes:r,compact:s})})})})}function $t({fields:i,values:t,onChange:s}){function n(a,r){s({...t,[a]:r})}return e.jsx("div",{className:"space-y-4",children:i.map(a=>e.jsxs("div",{className:"space-y-2",children:[a.type!=="boolean"&&e.jsx(ce,{children:a.label}),ca(a,t[a.name],r=>n(a.name,r))]},a.name))})}function ca(i,t,s){switch(i.type){case"text":case"url":case"email":return e.jsx(ye,{field:i,value:t,onChange:s});case"textarea":return e.jsx(Zn,{field:i,value:t,onChange:s});case"number":return e.jsx(ea,{field:i,value:t,onChange:s});case"boolean":return e.jsx(ta,{field:i,value:t,onChange:s});case"select":return e.jsx(sa,{field:i,value:t,onChange:s});case"media":return e.jsx(na,{field:i,value:t,onChange:s});case"content":return e.jsx(Kn,{field:i,value:t,onChange:s});case"blocks":return e.jsx(oa,{field:i,value:t,onChange:s});case"array":return e.jsx(aa,{field:i,value:t,onChange:s});case"date":return e.jsx(ye,{field:{...i,type:"text"},value:t,onChange:s});default:return e.jsx(ye,{field:i,value:t,onChange:s})}}function da(){const{host:i,collection:t,id:s}=me(),{data:n,isLoading:a}=xs(i,s);return a?e.jsxs("div",{className:"space-y-4",children:[e.jsx(O,{className:"h-8 w-64"}),e.jsx(O,{className:"h-64 w-full"})]}):n?.content?e.jsx(ua,{host:i,collection:t,contentId:s,content:n.content,draft:n.draft,publishedBlockId:n.publishedBlockId}):e.jsx("p",{className:"text-muted-foreground",children:"Content not found."})}function ua({host:i,collection:t,contentId:s,content:n,draft:a,publishedBlockId:r}){const l=us(),o=Ct(),{collections:u}=Cs(),c=fs(i,s),m=gs(i,s),N=js(i,s),h=a?{title:a.title??n.title,slug:a.slug??n.slug??"",snippet:a.snippet??n.snippet??"",tags:a.tags??n.tags??[],coverUrl:a.coverUrl??n.coverUrl??"",coverMediaId:a.coverMediaId??n.coverMediaId??"",coverWidth:a.coverWidth??n.coverWidth??0,coverHeight:a.coverHeight??n.coverHeight??0,body:a.body??{},relationships:a.relationships??{}}:void 0,[x,f]=p.useState(null),v=Sn(i,s,h,()=>{f("This slug is already in use by another item in this collection")}),{data:w}=tn(i),k=w?.map(d=>d.tag),g=u.find(d=>d.name===t),b=p.useMemo(()=>g?.fields??[],[g?.fields]),C=p.useMemo(()=>g?.relationships??[],[g?.relationships]),y=g?.singleton??!1,I=wn(),[D,T]=p.useState(a?.title??n.title),[j,L]=p.useState(a?.slug??n.slug??""),[A,te]=p.useState(a?.snippet??n.snippet??""),Ke=a?.autoSnippet??"",[z,Je]=p.useState(a?.tags??n.tags??[]),[xe,Ge]=p.useState(a?.coverUrl??n.coverUrl??""),[se,Qe]=p.useState(a?.coverMediaId??n.coverMediaId??""),[Ye,Xe]=p.useState(a?.coverWidth??n.coverWidth??0),[Ze,et]=p.useState(a?.coverHeight??n.coverHeight??0),[H,tt]=p.useState(a?.body??{}),[W,st]=p.useState(a?.relationships??{}),[Ut,Vt]=p.useState(0),[Bt,zt]=p.useState(!1),[Ht,ne]=p.useState(!1),[Wt,Q]=p.useState(!1),[qt,ae]=p.useState(null),[fe,ie]=p.useState(!1),[Kt,re]=p.useState(!1),nt=vs(i,s),{data:at}=At(i,se),U=p.useCallback(()=>({title:D,slug:j,snippet:A,tags:z,coverUrl:xe,coverMediaId:se,coverWidth:Ye,coverHeight:Ze,body:H,relationships:W}),[D,j,A,z,xe,se,Ye,Ze,H,W]);function Jt(d){T(d),setTimeout(()=>v.schedule({...U(),title:d}),0)}function Gt(d){L(d),f(null),setTimeout(()=>v.schedule({...U(),slug:d}),0)}function Qt(d){te(d),setTimeout(()=>v.schedule({...U(),snippet:d}),0)}function Yt(d){Je(d),setTimeout(()=>v.schedule({...U(),tags:d}),0)}function it(d,P,q,oe){Ge(d),Qe(P),Xe(q),et(oe),setTimeout(()=>v.schedule({...U(),coverUrl:d,coverMediaId:P,coverWidth:q,coverHeight:oe}),0)}function Xt(d){tt(d),setTimeout(()=>v.schedule({...U(),body:d}),0)}function Zt(d){st(d),setTimeout(()=>v.schedule({...U(),relationships:d}),0)}const es=v.lastSavedBlockId??a?.blockId,le=pn(n.publishedAt,n.lastPublishedAt,r,es),rt=xn(le),lt=fn(le),{data:F}=ft(i,s,!!n.publishedAt),E=p.useMemo(()=>{if(!fe||!F)return null;const d=y?void 0:{title:F.title,slug:F.slug,snippet:F.snippet,tags:F.tags},P=C.map(_=>({name:_.name,label:_.label})),q=F.relationships,oe=P.length>0?{defs:P,values:q??{}}:void 0,is=X(b,F.body??{},d,oe),rs=y?void 0:{title:D,slug:j,snippet:A,tags:z},ls=P.length>0?{defs:P,values:W}:void 0,os=X(b,H,rs,ls),cs=Ot(is,os,{comparator:(_,je)=>_.text===je.text&&_.indent===je.indent&&_.type===je.type});let dt=0,ut=0;for(const _ of cs)_.added?dt+=_.count??0:_.removed&&(ut+=_.count??0);return{added:dt,removed:ut}},[fe,F,b,C,y,D,j,A,z,H,W]);function ts(){if(n.publishedAt&&n.slug&&j!==n.slug){re(!0);return}le==="published-changes"?ie(!0):ge()}async function ge(){try{v.cancel(),await v.flush({createVersion:!0}),await c.mutateAsync(),M.success("Content published")}catch(d){if(d instanceof bt&&d.code==="SLUG_TAKEN"){f("This slug is already in use by another item in this collection"),M.error("Slug already in use",{description:"Please choose a different slug before publishing."});return}M.error("Failed to publish",{description:d instanceof Error?d.message:void 0})}}async function ss(){try{await m.mutateAsync(),Q(!1),M.success("Content unpublished")}catch(d){M.error("Failed to unpublish",{description:d instanceof Error?d.message:void 0})}}async function ns(){try{v.discard();const d=await o.apiFetch(`/v1/admin/sites/${i}/content/${s}/published`);await nt.mutateAsync();const P={title:d.title??"",slug:d.slug??"",snippet:d.snippet??"",tags:d.tags??[],coverUrl:d.coverUrl??"",coverMediaId:d.coverMediaId??"",coverWidth:d.coverWidth??0,coverHeight:d.coverHeight??0,body:d.body??{},relationships:d.relationships??{}};T(P.title),L(P.slug),te(P.snippet),Je(P.tags),Ge(P.coverUrl),Qe(P.coverMediaId),Xe(P.coverWidth),et(P.coverHeight),tt(P.body),st(P.relationships),Vt(q=>q+1),v.resetBaseline(P),M.success("Changes discarded")}catch(d){M.error("Failed to discard changes",{description:d instanceof Error?d.message:void 0})}}async function as(){try{await N.mutateAsync(),M.success("Content deleted"),l(`/sites/${i}/content/${t}`)}catch(d){M.error("Failed to delete",{description:d instanceof Error?d.message:void 0})}}const ot=e.jsx("div",{className:"space-y-6",children:b.length>0?e.jsx($t,{fields:b,values:H,onChange:Xt},Ut):e.jsx($,{children:e.jsx(V,{className:"py-8 text-center",children:e.jsxs("p",{className:"text-sm text-muted-foreground",children:["No fields defined for this collection."," ",e.jsx(hs,{to:`/sites/${i}/settings/collections/${t}`,className:"underline",children:"Configure fields"})]})})})}),ct=e.jsxs("div",{className:"space-y-6",children:[!y&&e.jsx($,{children:e.jsxs(V,{className:"space-y-4 pt-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{htmlFor:"title",children:"Title"}),e.jsx(Z,{id:"title",value:D,onChange:d=>Jt(d.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{htmlFor:"slug",children:"Slug"}),e.jsx(Z,{id:"slug",value:j,onChange:d=>Gt(d.target.value),className:x?"border-destructive":""}),x&&e.jsx("p",{className:"text-sm text-destructive",children:x})]}),e.jsxs(It,{defaultOpen:!!A,children:[e.jsxs(Pt,{className:"flex w-full items-center gap-2 text-sm font-medium",children:[e.jsx(_t,{className:"h-4 w-4 transition-transform [[data-state=open]>&]:rotate-90"}),"Snippet",e.jsx("span",{className:"text-xs text-muted-foreground",children:"(auto-generated if empty)"})]}),e.jsxs(Dt,{className:"mt-2 space-y-2",children:[e.jsx(kt,{id:"snippet",value:A,onChange:d=>Qt(d.target.value),rows:3,placeholder:"Brief summary of this content..."}),!A&&Ke&&e.jsxs("p",{className:"text-xs italic text-muted-foreground",children:["Auto-generated: ",Ke]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{children:"Cover Image"}),se?e.jsxs("div",{className:"flex items-center gap-3 rounded-md border p-2 cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>ne(!0),children:[e.jsx("img",{src:Ue(xe),alt:at?.filename??"",className:"h-10 w-10 rounded object-cover bg-muted"}),e.jsx("span",{className:"flex-1 truncate text-sm",children:at?.filename??"Loading..."}),e.jsx(S,{type:"button",variant:"ghost",size:"sm",onClick:d=>{d.stopPropagation(),it("","",0,0)},children:e.jsx(G,{className:"h-3 w-3"})})]}):e.jsxs(S,{type:"button",variant:"outline",className:"w-full",onClick:()=>ne(!0),children:[e.jsx(Te,{className:"mr-2 h-4 w-4"}),"Select Image"]}),e.jsx(Et,{open:Ht,onClose:()=>ne(!1),onSelect:d=>{it(d.url,d.mediaId,d.width??0,d.height??0),ne(!1)},allowedTypes:["image/*"]})]})]})}),!y&&e.jsxs($,{children:[e.jsx(Ne,{children:e.jsx(Ce,{children:"Tags"})}),e.jsx(V,{children:e.jsx(Ws,{tags:z,onChange:Yt,suggestions:k})})]}),C.length>0&&e.jsx(Qn,{relationships:C,values:W,onChange:Zt,host:i}),e.jsxs($,{children:[e.jsx(Ne,{children:e.jsx(Ce,{children:"Info"})}),e.jsxs(V,{className:"space-y-2 text-sm",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"Collection"}),e.jsx("span",{children:n.collection})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"ID"}),e.jsx("span",{className:"font-mono text-xs",children:n.contentId})]}),n.publishedAt?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"First published"}),e.jsx("span",{children:ve(n.publishedAt)})]}),n.lastPublishedAt&&n.lastPublishedAt!==n.publishedAt&&e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"Last published"}),e.jsx("span",{children:ve(n.lastPublishedAt)})]})]}):n.lastPublishedAt?e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"Last published"}),e.jsx("span",{children:ve(n.lastPublishedAt)})]}):null,n.publishedAt&&e.jsxs(S,{variant:"outline",size:"sm",className:"w-full mt-2",onClick:()=>{ae({kind:"published"}),Q(!0)},children:[e.jsx(vn,{className:"mr-2 h-4 w-4"}),"View published"]})]})]}),e.jsx(pa,{host:i,contentId:s,onViewVersion:d=>{ae({kind:"history",blockId:d.blockId,createdAt:d.createdAt,title:d.title}),Q(!0)}}),!y&&e.jsx(ma,{deleteOpen:Bt,setDeleteOpen:zt,onDelete:as,host:i,contentId:s})]});return e.jsxs("div",{className:"mx-auto max-w-6xl",children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h1",{className:"text-2xl font-semibold",children:y?g?.label??t:D||"Untitled"}),e.jsx(ee,{variant:rt.variant,children:rt.label}),v.isSaving&&e.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(Y,{className:"h-3 w-3 animate-spin"}),"Saving..."]}),!v.isSaving&&v.lastSavedAt&&e.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(gn,{className:"h-3 w-3"}),"Saved"]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(S,{variant:"outline",onClick:()=>v.flush({createVersion:!0}),disabled:v.isSaving,children:[v.isSaving&&e.jsx(Y,{className:"mr-2 h-4 w-4 animate-spin"}),"Save Draft"]}),lt&&e.jsxs(S,{onClick:ts,disabled:c.isPending,children:[c.isPending&&e.jsx(Y,{className:"mr-2 h-4 w-4 animate-spin"}),lt]}),n.publishedAt&&e.jsxs(Ss,{children:[e.jsx(ws,{asChild:!0,children:e.jsx(S,{variant:"outline",size:"icon",children:e.jsx(qs,{className:"h-4 w-4"})})}),e.jsxs(ks,{align:"end",children:[le==="published-changes"&&e.jsxs(ht,{onClick:ns,disabled:nt.isPending,children:[e.jsx(yn,{className:"mr-2 h-4 w-4"}),"Discard Changes"]}),e.jsx(ht,{onClick:ss,className:"text-destructive focus:text-destructive",children:"Unpublish"})]})]})]})]}),I?e.jsxs(yt,{defaultValue:"content",children:[e.jsxs(Nt,{variant:"line",className:"mb-4",children:[e.jsx(de,{value:"content",children:"Content"}),e.jsx(de,{value:"info",children:"Info"})]}),e.jsx(ue,{value:"content",children:ot}),e.jsx(ue,{value:"info",children:ct})]}):e.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[e.jsx("div",{className:"lg:col-span-2",children:ot}),e.jsx("div",{children:ct})]}),e.jsx(Wn,{open:Wt,onOpenChange:d=>{Q(d),d||ae(null)},host:i,contentId:s,collectionFields:b,isSingleton:y,isPublished:!!n.publishedAt,draftBody:H,draftMetadata:y?void 0:{title:D,slug:j,snippet:A,tags:z},initialVersion:qt,collectionRelationships:C,draftRelationships:W}),e.jsx(Ks,{open:fe,onOpenChange:ie,children:e.jsxs(Js,{children:[e.jsxs(Gs,{children:[e.jsx(Qs,{children:"Publish changes?"}),e.jsx(Ys,{children:E?e.jsxs(e.Fragment,{children:[E.added>0&&e.jsxs("span",{className:"text-green-600",children:["+",E.added," added"]}),E.added>0&&E.removed>0&&", ",E.removed>0&&e.jsxs("span",{className:"text-red-600",children:["-",E.removed," removed"]}),E.added===0&&E.removed===0&&e.jsx("span",{children:"No visible changes detected."})]}):"This will update the published version with your current changes."})]}),e.jsx("div",{className:"mb-2",children:e.jsx(S,{variant:"link",className:"p-0 h-auto text-sm",onClick:()=>{ie(!1),ae({kind:"published"}),Q(!0)},children:"View full diff"})}),e.jsxs(Xs,{children:[e.jsx(Zs,{children:"Cancel"}),e.jsx(en,{onClick:()=>{ie(!1),ge()},children:"Publish Update"})]})]})}),e.jsx(ke,{open:Kt,onOpenChange:re,children:e.jsxs(Ie,{children:[e.jsxs(Pe,{children:[e.jsx(De,{children:"Slug change detected"}),e.jsxs(Ae,{children:["You are changing the slug from “",n.slug,"” to “",j,"”. This may break external bookmarks and SEO links."]})]}),e.jsx(ha,{host:i,contentId:s}),e.jsxs(St,{children:[e.jsx(S,{variant:"outline",onClick:()=>re(!1),children:"Cancel"}),e.jsx(S,{onClick:()=>{re(!1),ge()},children:"Publish Anyway"})]})]})})]})}function ha({host:i,contentId:t}){const{data:s}=jt(i,t,!0);return!s||s.count===0?null:e.jsxs("div",{className:"rounded-md border border-yellow-500/50 bg-yellow-50 p-3 text-sm dark:bg-yellow-950/30",children:[e.jsxs("p",{className:"font-medium text-yellow-800 dark:text-yellow-200",children:["This content is referenced by ",s.count," other"," ",s.count===1?"item":"items",":"]}),e.jsxs("ul",{className:"mt-1 list-disc pl-5 text-yellow-700 dark:text-yellow-300",children:[s.items.slice(0,5).map(n=>e.jsxs("li",{children:[n.title," (",n.collection,")"]},`${n.contentId}-${n.fieldName}`)),s.items.length>5&&e.jsxs("li",{children:["and ",s.items.length-5," more..."]})]})]})}function ma({deleteOpen:i,setDeleteOpen:t,onDelete:s,host:n,contentId:a}){const{data:r}=jt(n,a,i);return e.jsxs(e.Fragment,{children:[e.jsx(Is,{}),e.jsxs(ke,{open:i,onOpenChange:t,children:[e.jsx(Ps,{asChild:!0,children:e.jsxs(S,{variant:"destructive",className:"w-full",children:[e.jsx(Mt,{className:"mr-2 h-4 w-4"}),"Delete"]})}),e.jsxs(Ie,{children:[e.jsxs(Pe,{children:[e.jsx(De,{children:"Delete content?"}),e.jsx(Ae,{children:"This action cannot be undone. The content will be permanently deleted."})]}),r&&r.count>0&&e.jsxs("div",{className:"rounded-md border border-yellow-500/50 bg-yellow-50 p-3 text-sm dark:bg-yellow-950/30",children:[e.jsxs("p",{className:"font-medium text-yellow-800 dark:text-yellow-200",children:["This content is referenced by ",r.count," other"," ",r.count===1?"item":"items",":"]}),e.jsxs("ul",{className:"mt-1 list-disc pl-5 text-yellow-700 dark:text-yellow-300",children:[r.items.slice(0,5).map(l=>e.jsxs("li",{children:[l.title," (",l.collection,")"]},`${l.contentId}-${l.fieldName}`)),r.items.length>5&&e.jsxs("li",{children:["and ",r.items.length-5," more..."]})]})]}),e.jsxs(St,{children:[e.jsx(S,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),e.jsx(S,{variant:"destructive",onClick:s,children:"Delete"})]})]})]})]})}function pa({host:i,contentId:t,onViewVersion:s}){const{data:n}=gt(i,t),[a,r]=p.useState(!1),l=n?.items??[],o=l.map(c=>c.createdBy).filter(Boolean),{resolve:u}=Ds(o);return l.length===0?null:e.jsx($,{children:e.jsx(V,{className:"pt-4",children:e.jsxs(It,{open:a,onOpenChange:r,children:[e.jsxs(Pt,{className:"flex w-full items-center gap-2 text-sm font-medium",children:[e.jsx(_t,{className:R("h-4 w-4 transition",a&&"rotate-90")}),"Version History (",l.length,")"]}),e.jsx(Dt,{className:"mt-2",children:e.jsx("div",{className:"space-y-1",children:l.map((c,m)=>e.jsxs("button",{className:"py-1 text-sm hover:bg-muted rounded px-1 -mx-1 transition-colors w-full text-left",onClick:()=>s(c),children:[e.jsx("span",{children:Re(c.createdAt)}),c.createdBy&&e.jsx("span",{className:"ml-2 text-muted-foreground",children:u(c.createdBy)}),c.title&&e.jsx("span",{className:"ml-2 text-muted-foreground",children:c.title})]},`${c.createdAt}-${m}`))})})]})})})}const Ea=Object.freeze(Object.defineProperty({__proto__:null,ContentEditPage:da},Symbol.toStringTag,{value:"Module"}));export{pe as C,$t as F,Et as M,Ea as a};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./tanstack-BO6c-AOu.js";import{u as re,e as ie,r as c}from"./react-vendor-DNVhVxD7.js";import{t as oe,B as D,s as d,I as de,X as w,S as ue,a as he}from"./index-Ds50UTAc.js";import{d as me,e as xe,a as ge,b as je,c as fe}from"./useContent-CSobIico.js";import{u as pe}from"./useTags-CYqbj5cK.js";import{u as be}from"./useDebouncedValue-Bf8UizjU.js";import{m as ve}from"./media-url-DIg_vSyf.js";import{B as p}from"./badge-0Z1nL6DI.js";import{C as Z}from"./checkbox-BPqrj_XS.js";import{S as k,a as _,b as T,c as y,d as j}from"./select-CJXZv4wv.js";import{T as Se,a as Ne,b as G,c as b,d as Ce,e as v}from"./table-B3EHrN_H.js";import{a as we}from"./format-CZ9bpk32.js";import{g as ke,a as _e}from"./contentStatus-DfWHjFVB.js";import{B as Te}from"./BulkActionBar-BMcUBJSH.js";import{P as ye}from"./plus-BgHSYWJN.js";import{S as Ae}from"./search-DIzcfCVh.js";import"./radix-DQ3amgxj.js";import"./check-BGA0ADyt.js";const V=3,Ie=[{value:"updated_desc",label:"Last updated"},{value:"updated_asc",label:"Oldest updated"},{value:"title_asc",label:"Title A–Z",requiresCollection:!0},{value:"title_desc",label:"Title Z–A",requiresCollection:!0},{value:"created_desc",label:"Newest created"},{value:"created_asc",label:"Oldest created"}],Q=[{value:"all",label:"All statuses"},{value:"draft",label:"Draft"},{value:"published",label:"Published"},{value:"changed",label:"Changed"},{value:"unpublished",label:"Unpublished"}];function Qe(){const{host:l,collection:a}=re(),S=ie(),{collections:J}=oe(),[A,I]=c.useState(""),[$,K]=c.useState("prefix"),[u,L]=c.useState(),[h,M]=c.useState(),[N,W]=c.useState("updated_desc"),[Y,O]=c.useState(),[i,m]=c.useState(new Set),x=be(A,300),r=c.useCallback(()=>O(void 0),[]),ee=c.useMemo(()=>{const s={};return x&&(s.q=x,s.search=$),u&&(s.tag=u),h&&(s.status=h),N!=="updated_desc"&&(s.sort=N),s},[x,$,u,h,N]),g=J.find(s=>s.name===a),{data:f,isLoading:se}=me(l,a,ee,Y),P=xe(l),R=ge(l),q=je(l),E=fe(l),{data:z}=pe(l),F=c.useMemo(()=>z?.map(s=>s.tag)??[],[z]);if(g?.singleton&&f?.items.length===1)return S(`/sites/${l}/content/${a}/${f.items[0].contentId}`,{replace:!0}),null;const B=f?.items,U=B?.map(s=>s.contentId)??[],H=U.length>0&&U.every(s=>i.has(s));function te(s){m(o=>{const t=new Set(o);return t.has(s)?t.delete(s):t.add(s),t})}function le(){m(H?new Set:new Set(U))}const X=!!(x||u||h),ae=!!x,ne=R.isPending||q.isPending||E.isPending;async function ce(){try{const s=await P.mutateAsync({collection:a,title:g?.label??a});d.success("Singleton content recreated"),S(`/sites/${l}/content/${a}/${s.contentId}`)}catch(s){d.error("Failed to recreate singleton",{description:s instanceof Error?s.message:void 0})}}return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[e.jsx("h1",{className:"text-2xl font-semibold",children:g?.label??a}),!g?.singleton&&e.jsxs(D,{onClick:()=>S(`/sites/${l}/content/${a}/new`),children:[e.jsx(ye,{className:"mr-2 h-4 w-4"}),"New"]})]}),i.size>0?e.jsx(Te,{selectedCount:i.size,onPublish:async()=>{const s=[...i],t=(await R.mutateAsync(s)).filter(n=>n.status==="rejected").length;t?d.error(`${t} of ${s.length} failed to publish`):d.success(`${s.length} item(s) published`),m(new Set)},onUnpublish:async()=>{const s=[...i],t=(await q.mutateAsync(s)).filter(n=>n.status==="rejected").length;t?d.error(`${t} of ${s.length} failed to unpublish`):d.success(`${s.length} item(s) unpublished`),m(new Set)},onDelete:async()=>{const s=[...i],t=(await E.mutateAsync(s)).filter(n=>n.status==="rejected").length;t?d.error(`${t} of ${s.length} failed to delete`):d.success(`${s.length} item(s) deleted`),m(new Set)},onClear:()=>m(new Set),isPending:ne}):e.jsxs("div",{className:"mb-4 flex flex-wrap items-center gap-2",children:[e.jsxs("div",{className:"relative flex items-center",children:[e.jsx(Ae,{className:"absolute left-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(de,{placeholder:"Search titles...",value:A,onChange:s=>{I(s.target.value),r()},className:"w-56 pl-8 pr-8"}),A&&e.jsx("button",{onClick:()=>{I(""),r()},className:"absolute right-2 text-muted-foreground hover:text-foreground",children:e.jsx(w,{className:"h-4 w-4"})})]}),e.jsxs(k,{value:$,onValueChange:s=>{K(s),r()},children:[e.jsx(_,{className:"w-[130px]",children:e.jsx(T,{})}),e.jsxs(y,{children:[e.jsx(j,{value:"prefix",children:"Starts with"}),e.jsx(j,{value:"full",children:"Contains"})]})]}),F.length>0&&e.jsxs(k,{value:u??"__all__",onValueChange:s=>{L(s==="__all__"?void 0:s),r()},children:[e.jsx(_,{className:"w-[140px]",children:e.jsx(T,{placeholder:"Tag"})}),e.jsxs(y,{children:[e.jsx(j,{value:"__all__",children:"All tags"}),F.map(s=>e.jsx(j,{value:s,children:s},s))]})]}),e.jsxs(k,{value:h??"all",onValueChange:s=>{M(s==="all"?void 0:s),r()},children:[e.jsx(_,{className:"w-[150px]",children:e.jsx(T,{})}),e.jsx(y,{children:Q.map(s=>e.jsx(j,{value:s.value??"all",children:s.label},s.value??"all"))})]}),e.jsx("div",{className:"ml-auto",children:e.jsxs(k,{value:N,onValueChange:s=>{W(s),r()},disabled:ae,children:[e.jsx(_,{className:"w-[170px]",children:e.jsx(T,{})}),e.jsx(y,{children:Ie.map(s=>e.jsx(j,{value:s.value,disabled:s.requiresCollection&&!a,children:s.label},s.value))})]})})]}),X&&i.size===0&&e.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-1.5",children:[x&&e.jsxs(p,{variant:"secondary",className:"gap-1",children:["Search: ",x,e.jsx("button",{onClick:()=>{I(""),r()},children:e.jsx(w,{className:"h-3 w-3"})})]}),u&&e.jsxs(p,{variant:"secondary",className:"gap-1",children:["Tag: ",u,e.jsx("button",{onClick:()=>{L(void 0),r()},children:e.jsx(w,{className:"h-3 w-3"})})]}),h&&e.jsxs(p,{variant:"secondary",className:"gap-1",children:["Status: ",Q.find(s=>s.value===h)?.label,e.jsx("button",{onClick:()=>{M(void 0),r()},children:e.jsx(w,{className:"h-3 w-3"})})]})]}),se?e.jsx("div",{className:"space-y-2",children:Array.from({length:5}).map((s,o)=>e.jsx(ue,{className:"h-12 w-full"},o))}):B?.length?e.jsxs(e.Fragment,{children:[e.jsxs(Se,{children:[e.jsx(Ne,{children:e.jsxs(G,{children:[e.jsx(b,{className:"w-10",children:e.jsx(Z,{checked:H,onCheckedChange:le,"aria-label":"Select all"})}),e.jsx(b,{children:"Title"}),e.jsx(b,{children:"Slug"}),e.jsx(b,{children:"Status"}),e.jsx(b,{children:"Updated"})]})}),e.jsx(Ce,{children:B.map(s=>{const o=ke(s.publishedAt,s.lastPublishedAt,s.publishedBlockId,s.lastDraftBlockId),t=_e(o),n=s.tags??[];return e.jsxs(G,{className:"cursor-pointer",onClick:()=>S(`/sites/${l}/content/${a}/${s.contentId}`),children:[e.jsx(v,{onClick:C=>C.stopPropagation(),children:e.jsx(Z,{checked:i.has(s.contentId),onCheckedChange:()=>te(s.contentId),"aria-label":`Select ${s.title||"Untitled"}`})}),e.jsx(v,{className:"font-medium",children:e.jsxs("div",{className:"flex items-center gap-3",children:[s.coverUrl&&e.jsx("img",{src:ve(s.coverUrl),alt:"",className:"h-8 w-8 rounded object-cover flex-shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{children:s.title||"Untitled"}),n.length>0&&e.jsxs("div",{className:"mt-0.5 flex flex-wrap gap-1",children:[n.slice(0,V).map(C=>e.jsx(p,{variant:"outline",className:"text-[10px] px-1.5 py-0 font-normal text-muted-foreground",children:C},C)),n.length>V&&e.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["+",n.length-V," more"]})]})]})]})}),e.jsx(v,{className:"text-muted-foreground text-sm",children:s.slug||"—"}),e.jsx(v,{children:e.jsx(p,{variant:t.variant,children:t.label})}),e.jsx(v,{className:"text-muted-foreground",children:s.lastDraftAt?we(s.lastDraftAt):"—"})]},s.contentId)})})]}),f?.hasMore&&e.jsx("div",{className:"mt-4 flex justify-center",children:e.jsx(D,{variant:"outline",onClick:()=>O(f.cursor??void 0),children:"Load More"})})]}):g?.singleton?e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-muted-foreground",children:"Singleton content is missing. Click below to recreate it."}),e.jsxs(D,{onClick:ce,disabled:P.isPending,children:[P.isPending&&e.jsx(he,{className:"mr-2 h-4 w-4 animate-spin"}),"Recreate ",g.label]})]}):e.jsx("p",{className:"text-muted-foreground",children:X?"No content matches the current filters.":"No content yet."})]})}export{Qe as ContentListPage};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./tanstack-BO6c-AOu.js";import{r as v}from"./react-vendor-DNVhVxD7.js";import{C as R,G as O,b as D,u as M,a as P,P as q,D as A,c as $}from"./core.esm-Csvubn5Q.js";import{T as z,u as V,C as G,b as _,c as U,S as Y,v as H,a as J}from"./sortable.esm-Zh-9QRSf.js";import{I as p,x as F,G as K,L as d,B as T}from"./index-Ds50UTAc.js";import{S as k,a as E,b as I,c as L,d as B}from"./select-CJXZv4wv.js";import{d as Q,i as W}from"./format-CZ9bpk32.js";import{C as w}from"./checkbox-BPqrj_XS.js";import{P as X}from"./plus-BgHSYWJN.js";import{T as Z}from"./trash-2-Gny2Upn-.js";function ee({value:l,onChange:a,onBlur:u,readOnly:h,className:t,...s}){const[n,x]=v.useState(!1),m=v.useRef(void 0);v.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]);const j=v.useCallback(f=>{const g=f.target.value,b=Q(g);a(b),g!==b&&g.length>0?(x(!0),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>x(!1),2e3)):x(!1)},[a]);return e.jsxs("div",{className:"space-y-1",children:[e.jsx(p,{value:l,onChange:j,onBlur:u,disabled:h,"aria-invalid":n||void 0,className:F("font-mono",t),...s}),n&&e.jsx("p",{className:"text-xs text-destructive",children:"Must start with a letter. Only lowercase letters, numbers, hyphens, and underscores."})]})}function se({type:l,options:a,onChange:u}){const h=K();function t(s,n){u({...a,[s]:n})}return e.jsxs("div",{className:"space-y-3",children:[!["boolean","blocks","array"].includes(l)&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(w,{id:"opt-required",checked:!!a.required,onCheckedChange:s=>t("required",!!s)}),e.jsx(d,{htmlFor:"opt-required",className:"text-sm",children:"Required"})]}),["text","textarea"].includes(l)&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(d,{className:"text-xs",children:"Placeholder"}),e.jsx(p,{value:a.placeholder??"",onChange:s=>t("placeholder",s.target.value),className:"h-8 text-sm"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(d,{className:"text-xs",children:"Max Length"}),e.jsx(p,{type:"number",value:a.maxLength??"",onChange:s=>t("maxLength",s.target.value?Number(s.target.value):void 0),className:"h-8 text-sm"})]})]}),l==="number"&&e.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(d,{className:"text-xs",children:"Min"}),e.jsx(p,{type:"number",value:a.min??"",onChange:s=>t("min",s.target.value?Number(s.target.value):void 0),className:"h-8 text-sm"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(d,{className:"text-xs",children:"Max"}),e.jsx(p,{type:"number",value:a.max??"",onChange:s=>t("max",s.target.value?Number(s.target.value):void 0),className:"h-8 text-sm"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(d,{className:"text-xs",children:"Step"}),e.jsx(p,{type:"number",value:a.step??"",onChange:s=>t("step",s.target.value?Number(s.target.value):void 0),className:"h-8 text-sm"})]})]}),l==="select"&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(d,{className:"text-xs",children:"Choices (one per line)"}),e.jsx(z,{value:(a.choices??[]).join(`
|
|
2
|
-
`),onChange:s=>t("choices",s.target.value.split(`
|
|
3
|
-
`).map(n=>n.trim()).filter(Boolean)),rows:4,className:"text-sm"})]}),l==="media"&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(d,{className:"text-xs",children:"Allowed Types (e.g., image/*, video/*)"}),e.jsx(p,{value:(a.allowedTypes??[]).join(", "),onChange:s=>t("allowedTypes",s.target.value.split(",").map(n=>n.trim()).filter(Boolean)),className:"h-8 text-sm"})]}),l==="content"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(d,{className:"text-xs",children:"Allowed Collections"}),h&&h.collections.length>0?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-wrap gap-x-4 gap-y-1",children:h.collections.map(s=>{const n=a.collections??[],x=n.includes(s.name);return e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(w,{id:`col-${s.name}`,checked:x,onCheckedChange:m=>{m?t("collections",[...n,s.name]):t("collections",n.filter(j=>j!==s.name))}}),e.jsx(d,{htmlFor:`col-${s.name}`,className:"text-xs font-normal",children:s.label||s.name})]},s.name)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Leave all unchecked to allow any collection"})]}):e.jsx(p,{value:(a.collections??[]).join(", "),onChange:s=>t("collections",s.target.value.split(",").map(n=>n.trim()).filter(Boolean)),placeholder:"Comma-separated, leave empty for all",className:"h-8 text-sm"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(w,{id:"opt-multiple",checked:!!a.multiple,onCheckedChange:s=>t("multiple",!!s)}),e.jsx(d,{htmlFor:"opt-multiple",className:"text-sm",children:"Allow multiple"})]})]}),l==="array"&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(d,{className:"text-xs",children:"Item Fields"}),e.jsx(te,{fields:a.itemFields??[],onChange:s=>t("itemFields",s),excludeTypes:["array"]})]})]})}const y=[{value:"text",label:"Text"},{value:"textarea",label:"Textarea"},{value:"number",label:"Number"},{value:"boolean",label:"Boolean"},{value:"select",label:"Select"},{value:"url",label:"URL"},{value:"email",label:"Email"},{value:"date",label:"Date"},{value:"media",label:"Media"},{value:"content",label:"Content"},{value:"blocks",label:"Blocks"},{value:"array",label:"Array"}];function ae({id:l,field:a,onChange:u,onRemove:h,excludeTypes:t,readOnlyName:s,defaultExpanded:n}){const[x,m]=v.useState(n??!1),[j,f]=v.useState(!!a.label),{attributes:g,listeners:b,setNodeRef:C,transform:S,transition:r}=V({id:l}),i=t?y.filter(c=>!t.includes(c.value)):y,o={transform:R.Transform.toString(S),transition:r};function N(c){u({...a,...c})}return e.jsx("div",{ref:C,style:o,className:"rounded-md border bg-card",children:e.jsxs(G,{open:x,onOpenChange:m,children:[e.jsxs("div",{className:"flex items-center gap-2 p-2",children:[e.jsx("button",{type:"button",className:"cursor-grab touch-none text-muted-foreground hover:text-foreground",...g,...b,children:e.jsx(O,{className:"h-4 w-4"})}),e.jsx(_,{asChild:!0,children:e.jsx("button",{type:"button",className:"flex items-center",children:e.jsx(D,{className:F("h-4 w-4 transition-transform",x&&"rotate-90")})})}),e.jsx("span",{className:"min-w-[80px] text-sm font-mono",children:a.name||"unnamed"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:a.type}),e.jsx("span",{className:"flex-1 truncate text-sm text-muted-foreground",children:a.label}),e.jsx(T,{type:"button",variant:"ghost",size:"sm",onClick:h,className:"text-destructive",children:e.jsx(Z,{className:"h-3 w-3"})})]}),e.jsx(U,{children:e.jsxs("div",{className:"space-y-3 border-t p-3",children:[e.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:"Name"}),e.jsx(ee,{value:a.name,onChange:c=>N({name:c}),onBlur:()=>{a.name&&!j&&N({label:W(a.name)})},readOnly:s,className:"h-8 text-sm"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:"Label"}),e.jsx(p,{value:a.label,onChange:c=>{N({label:c.target.value}),f(!0)},className:"h-8 text-sm"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:"Type"}),e.jsxs(k,{value:a.type,onValueChange:c=>N({type:c,options:{}}),children:[e.jsx(E,{className:"h-8 text-sm",children:e.jsx(I,{})}),e.jsx(L,{children:i.map(c=>e.jsx(B,{value:c.value,children:c.label},c.value))})]})]})]}),e.jsx(se,{type:a.type,options:a.options??{},onChange:c=>N({options:c})})]})})]})})}function te({fields:l,onChange:a,excludeTypes:u,existingFieldNames:h}){const t=M(P(q)),s=l.map((r,i)=>`field-${i}`),[n,x]=v.useState("text"),[m,j]=v.useState(null),f=u?y.filter(r=>!u.includes(r.value)):y;function g(){j(l.length),a([...l,{name:"",label:"",type:n,options:{}}])}function b(r,i){const o=[...l];o[r]=i,a(o)}function C(r){a(l.filter((i,o)=>o!==r))}function S(r){const{active:i,over:o}=r;if(o&&i.id!==o.id){const N=s.indexOf(String(i.id)),c=s.indexOf(String(o.id));a(J(l,N,c))}}return e.jsx(A,{sensors:t,collisionDetection:$,onDragEnd:S,children:e.jsx(Y,{items:s,strategy:H,children:e.jsxs("div",{className:"space-y-2",children:[l.map((r,i)=>e.jsx(ae,{id:`field-${i}`,field:r,onChange:o=>b(i,o),onRemove:()=>C(i),excludeTypes:u,readOnlyName:!!(h?.has(r.name)&&r.name),defaultExpanded:i===m},`field-${i}`)),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(k,{value:n,onValueChange:x,children:[e.jsx(E,{className:"h-8 w-[130px] text-sm",children:e.jsx(I,{})}),e.jsx(L,{children:f.map(r=>e.jsx(B,{value:r.value,children:r.label},r.value))})]}),e.jsxs(T,{type:"button",variant:"outline",size:"sm",onClick:g,children:[e.jsx(X,{className:"mr-2 h-3 w-3"})," Add Field"]})]})]})})})}export{te as F,ee as I};
|