@objectstack/console 12.5.0 → 12.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/dist/assets/{AdapterProvider-qwVfmAEk.js → AdapterProvider-BmqhWHIU.js} +1 -1
  2. package/dist/assets/{ApiConsolePage-V6XcLsX4.js → ApiConsolePage-1bt8j6wO.js} +1 -1
  3. package/dist/assets/{AppDocsIndex-C4IIeN6V.js → AppDocsIndex-Bn1CdcNi.js} +1 -1
  4. package/dist/assets/{AppManagementPage-WCLo2V17.js → AppManagementPage-CeZ7gA3p.js} +1 -1
  5. package/dist/assets/{ConsoleFloatingChatbot-mf-pVd3G.js → ConsoleFloatingChatbot-CO_DukxV.js} +1 -1
  6. package/dist/assets/{DashboardView-CPFt6TBZ.js → DashboardView-CnKtk1aW.js} +1 -1
  7. package/dist/assets/{DashboardWidgetInspector-DknOds9r.js → DashboardWidgetInspector-CYPIrTyy.js} +1 -1
  8. package/dist/assets/{FlowRunsPage-QMVLQvu7.js → FlowRunsPage-DQy0C86b.js} +1 -1
  9. package/dist/assets/{InterfaceListPage-Dbt7lZbl.js → InterfaceListPage-B_B_Fttt.js} +1 -1
  10. package/dist/assets/{MarketplacePackagePage-CiRyU-vK.js → MarketplacePackagePage-DWvYmWIA.js} +1 -1
  11. package/dist/assets/{MetadataProvider-DKJsxrNu.js → MetadataProvider-Cm9vi7AZ.js} +1 -1
  12. package/dist/assets/{ObjectDataPage-CAJf6Pu3.js → ObjectDataPage-DeFtGZ6x.js} +1 -1
  13. package/dist/assets/{PageView-GYrk78oW.js → PageView-BQS9pq2N.js} +1 -1
  14. package/dist/assets/{PublicFormsPage-DmpEEcq4.js → PublicFormsPage-BsrJk1W2.js} +1 -1
  15. package/dist/assets/{RecordFormPage-DadWkJyX.js → RecordFormPage-CBPvAXGe.js} +1 -1
  16. package/dist/assets/{ReportDefaultInspector-CJGXWwWN.js → ReportDefaultInspector-ah_Be1RZ.js} +1 -1
  17. package/dist/assets/{ReportView-CIZjxMSJ.js → ReportView-D5Hifbvj.js} +1 -1
  18. package/dist/assets/{SearchResultsPage-BPDjxMw8.js → SearchResultsPage-24ufpv2l.js} +1 -1
  19. package/dist/assets/{SystemHubPage-2aGKeHcn.js → SystemHubPage-B8o4-NXd.js} +1 -1
  20. package/dist/assets/data-adapter-CdxWNPpK.js +7 -0
  21. package/dist/assets/{index-PrzZHiAk.js → index-Bp2ZvXdP.js} +1 -1
  22. package/dist/assets/{metadata-admin-CleGXds3.js → metadata-admin-BveAqpPs.js} +1 -1
  23. package/dist/assets/{src-BBieSqPB.js → src--WewDM7z.js} +1 -1
  24. package/dist/assets/{useMetadata-Ily0JuNR.js → useMetadata-DO66YueM.js} +1 -1
  25. package/dist/assets/{useOpenRecordList-tyj2_1bm.js → useOpenRecordList-DsTb016S.js} +1 -1
  26. package/dist/assets/{useReconcileOnError-_XnUvYJA.js → useReconcileOnError-DMumPfoY.js} +1 -1
  27. package/dist/index.html +1 -1
  28. package/package.json +1 -1
  29. package/dist/assets/data-adapter-Bm8GGtft.js +0 -7
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{d as t,f as n,r,y as i}from"./vendor-react-BGDDiZfJ.js";import{I as a}from"./framework-B3O15Lsq.js";import{n as o}from"./data-adapter-Bm8GGtft.js";import{i as s}from"./plugin-form-FeZEoC2R.js";import{a as c,o as l}from"./assistantBus-BFk4fCbM.js";var u=e(i(),1),d=r(),f=(0,u.createContext)(!1),p=`preview`,m=`draft`;function h(e){return new URLSearchParams(e).get(p)===m}var g=!1;function _(){g=!0}function v({force:e,children:r}){let i=t(),a=n(),o=(0,u.useMemo)(()=>h(i.search),[i.search]),[s,c]=(0,u.useState)(o);return(0,u.useEffect)(()=>{if(o){c(!0),g=!1;return}if(!s)return;if(g){g=!1,c(!1);return}let e=new URLSearchParams(i.search);e.set(p,m),a(`${i.pathname}?${e.toString()}${i.hash}`,{replace:!0})},[o,s,i.pathname,i.search,i.hash,a]),(0,d.jsx)(f.Provider,{value:e??(o||s),children:r})}function y(){return(0,u.useContext)(f)}var b=300*1e3,x=[`app`,`view`],S={apps:`app`,objects:`object`,dashboards:`dashboard`,reports:`report`,pages:`page`},C=`objectui:metadata:`;function w(){try{let e=import.meta;if(e&&e.env&&typeof e.env.MODE==`string`)return e.env.MODE!==`production`}catch{}return!1}var T=w();function E(...e){T&&console.debug(`[MetadataProvider]`,...e)}function D(e){return Array.isArray(e)?e:e&&typeof e==`object`&&`items`in e&&Array.isArray(e.items)?e.items:[]}function O(e){return e==null?null:typeof e==`object`&&`item`in e?e.item??null:e}function k(e){return!!e&&typeof e==`object`&&`name`in e&&typeof e.name==`string`}function A(e){return!!e&&typeof e==`object`&&!!e.viewKind&&!!e.object}function j(e,t){if(!e.length||!t.length)return e;let n={},r=new Set;for(let e of t)A(e)&&r.add(e.object);for(let e of t){if(A(e)){let t=n[e.object]||={listViews:{},formViews:{}},r=e.name||`${e.object}.${e.viewKind}`,i=e.config&&typeof e.config==`object`?e.config:{},a={...i,name:r,label:e.label??i.label,isDefault:!!e.isDefault};e.viewKind===`form`?(t.formViews[r]=a,(e.isDefault||!t.form)&&(t.form=a)):(t.listViews[r]=a,e.isDefault&&(t.primary=a));continue}let t=e?.name||e?.list?.data?.object||e?.form?.data?.object;if(!t||r.has(t))continue;let i=n[t]||={listViews:{},formViews:{}};if(e.list){i.primary=e.list;let t=e.list.name||`list`;i.listViews[t]=e.list}if(e.form&&(i.form=e.form),e.listViews&&typeof e.listViews==`object`)for(let[t,n]of Object.entries(e.listViews))i.listViews[t]=n;if(e.formViews&&typeof e.formViews==`object`)for(let[t,n]of Object.entries(e.formViews))i.formViews[t]=n}return e.map(e=>{let t=n[e.name];if(!t)return e;let r=e.listViews||e.list_views||{},i=e.formViews||e.form_views||{},a={...e,listViews:{...t.listViews,...r}};return(Object.keys(t.formViews).length||Object.keys(i).length)&&(a.formViews={...t.formViews,...i}),t.primary&&!e.list&&(a.list=t.primary),t.form&&!e.form&&(a.form=t.form),a})}function M(e){if(!e?.length)return e;let t={};for(let n of e){let e=n?.fields;if(!e)continue;let r=Array.isArray(e)?e.map(e=>[e?.name,e]):Object.entries(e);for(let[e,i]of r){let r=i;if(!e||!r?.inlineEdit||r.type!==`master_detail`&&r.type!==`lookup`)continue;let a=r.reference;a&&(t[a]||=[]).push({childObject:n.name,relationshipField:e,inlineMode:s(n,r.inlineEdit,{relationshipField:e}),...r.inlineTitle?{title:r.inlineTitle}:{},...Array.isArray(r.inlineColumns)?{columns:r.inlineColumns}:{},...typeof r.inlineAmountField==`string`?{amountField:r.inlineAmountField}:{}})}}return Object.keys(t).length?e.map(e=>{let n=t[e.name];if(!n?.length)return e;let r={...e.form||{type:`simple`}},i=Array.isArray(r.subforms)?r.subforms:[],a=new Set(i.map(e=>e.childObject));r.subforms=[...n.filter(e=>!a.has(e.childObject)),...i];let o={...e,form:r};return e.formViews?.default&&(o.formViews={...e.formViews,default:{...e.formViews.default,subforms:r.subforms}}),o}):e}function N(){return{status:`idle`,items:[],byName:new Map,error:null,fetchedAt:0,promise:null}}function P(e){if(typeof sessionStorage>`u`)return null;try{let t=sessionStorage.getItem(C+e);if(!t)return null;let n=JSON.parse(t);return Array.isArray(n)?n:null}catch{return null}}function F(e,t){if(!(typeof sessionStorage>`u`))try{sessionStorage.setItem(C+e,JSON.stringify(t))}catch{}}function I({children:e,adapter:t,ttlMs:n=b}){let r=(0,u.useRef)(new Map),i=(0,u.useRef)(new Map),s=(0,u.useRef)(t);s.current=t;let f=y(),p=(0,u.useMemo)(()=>f?new o({baseUrl:``,previewDrafts:!0}):null,[f]),m=(0,u.useRef)(p);m.current=p;let[h,g]=(0,u.useState)(0),_=(0,u.useCallback)(()=>{typeof queueMicrotask==`function`?queueMicrotask(()=>g(e=>e+1)):Promise.resolve().then(()=>g(e=>e+1))},[]);(0,u.useEffect)(()=>{r.current.clear(),i.current.clear(),_()},[f,_]);let v=(0,u.useCallback)(e=>{let t=r.current.get(e);return t||(t=N(),r.current.set(e,t)),t},[]),C=(0,u.useCallback)(e=>{let t=v(e);if(t.promise)return t.promise;if(t.status===`ready`&&Date.now()-t.fetchedAt<n)return E(`cache hit (fresh) type=${e} items=${t.items.length}`),Promise.resolve(t.items);let r=Date.now();t.status=`loading`,t.error=null;let i=m.current,a=(i?i.list(e):s.current.getClient().meta.getItems(e)).then(n=>{let a=D(n);t.items=a,t.status=`ready`,t.error=null,t.fetchedAt=Date.now(),t.promise=null,t.byName.clear();for(let e of a)k(e)&&t.byName.set(e.name,e);return e===`app`&&!i&&F(e,a),E(`fetched type=${e} items=${a.length} in ${Date.now()-r}ms`),_(),a}).catch(n=>{let r=n instanceof Error?n:Error(String(n));return t.status=`error`,t.error=r,t.promise=null,E(`fetch failed type=${e}`,r),_(),[]});return t.promise=a,a},[_,v,n]),w=(0,u.useCallback)((e,t)=>{let n=v(e);if(n.byName.has(t))return E(`item cache hit type=${e} name=${t}`),Promise.resolve(n.byName.get(t)??null);let r=i.current.get(e);r||(r=new Map,i.current.set(e,r));let a=r.get(t);if(a)return a;let o=Date.now(),c=m.current,l=(c?c.get(e,t):s.current.getClient().meta.getItem(e,t)).then(i=>{let a=O(i);return a&&n.byName.set(t,a),E(`fetched item type=${e} name=${t} in ${Date.now()-o}ms`),r.delete(t),a}).catch(n=>(r.delete(t),E(`fetch item failed type=${e} name=${t}`,n),null));return r.set(t,l),l},[v]),T=(0,u.useCallback)(async e=>{if(e){let t=v(e);t.fetchedAt=0,t.byName.clear(),await C(e);return}let t=Array.from(r.current.keys()).filter(e=>r.current.get(e).status!==`idle`);await Promise.all(t.map(e=>{let t=r.current.get(e);return t.fetchedAt=0,t.byName.clear(),C(e)}))},[C,v]),A=(0,u.useCallback)((e,t)=>{let n=r.current.get(e);n&&(t?(n.byName.delete(t),n.items=n.items.filter(e=>e?.name!==t),E(`invalidated type=${e} name=${t}`)):(n.status=`idle`,n.items=[],n.byName.clear(),n.error=null,n.fetchedAt=0,E(`invalidated type=${e}`)),_())},[_]);(0,u.useEffect)(()=>{if(f)return c(({type:e})=>{A(e)})},[f,A]),(0,u.useEffect)(()=>l(()=>{try{s.current?.clearCache?.()}catch{}T()}),[T]);let[I,L]=(0,u.useState)(!0),[R,z]=(0,u.useState)(null);(0,u.useEffect)(()=>{let e=!1,t=f?null:P(`app`);if(t){let e=v(`app`);e.items=t,e.status=`ready`,e.fetchedAt=0;for(let n of t)k(n)&&e.byName.set(n.name,n);_(),L(!1)}return(async()=>{for(let t of x)try{await C(t),e||z(null)}catch(t){e||z(t instanceof Error?t:Error(String(t)))}e||L(!1)})(),()=>{e=!0}},[t,C,v,_,f]);let B=(0,u.useMemo)(()=>{let e=e=>{let t=v(e);return t.status===`idle`&&C(e),t.items};return{apps:v(`app`).items,get objects(){let t=e(S.objects),n=e(`view`);return M(n.length?j(t,n):t)},get dashboards(){return e(S.dashboards)},get reports(){return e(S.reports)},get pages(){return e(S.pages)},loading:I,error:R??v(`app`).error,refresh:T,invalidate:A,ensureType:C,getItem:w,getItemsByType:t=>e(t),getTypeStatus:e=>v(e).status}},[h,I,R,C,w,v,T,A]);return(0,d.jsx)(a.Provider,{value:B,children:e})}export{y as a,_ as i,p as n,v as r,I as t};
1
+ import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{d as t,f as n,r,y as i}from"./vendor-react-BGDDiZfJ.js";import{I as a}from"./framework-B3O15Lsq.js";import{n as o}from"./data-adapter-CdxWNPpK.js";import{i as s}from"./plugin-form-FeZEoC2R.js";import{a as c,o as l}from"./assistantBus-BFk4fCbM.js";var u=e(i(),1),d=r(),f=(0,u.createContext)(!1),p=`preview`,m=`draft`;function h(e){return new URLSearchParams(e).get(p)===m}var g=!1;function _(){g=!0}function v({force:e,children:r}){let i=t(),a=n(),o=(0,u.useMemo)(()=>h(i.search),[i.search]),[s,c]=(0,u.useState)(o);return(0,u.useEffect)(()=>{if(o){c(!0),g=!1;return}if(!s)return;if(g){g=!1,c(!1);return}let e=new URLSearchParams(i.search);e.set(p,m),a(`${i.pathname}?${e.toString()}${i.hash}`,{replace:!0})},[o,s,i.pathname,i.search,i.hash,a]),(0,d.jsx)(f.Provider,{value:e??(o||s),children:r})}function y(){return(0,u.useContext)(f)}var b=300*1e3,x=[`app`,`view`],S={apps:`app`,objects:`object`,dashboards:`dashboard`,reports:`report`,pages:`page`},C=`objectui:metadata:`;function w(){try{let e=import.meta;if(e&&e.env&&typeof e.env.MODE==`string`)return e.env.MODE!==`production`}catch{}return!1}var T=w();function E(...e){T&&console.debug(`[MetadataProvider]`,...e)}function D(e){return Array.isArray(e)?e:e&&typeof e==`object`&&`items`in e&&Array.isArray(e.items)?e.items:[]}function O(e){return e==null?null:typeof e==`object`&&`item`in e?e.item??null:e}function k(e){return!!e&&typeof e==`object`&&`name`in e&&typeof e.name==`string`}function A(e){return!!e&&typeof e==`object`&&!!e.viewKind&&!!e.object}function j(e,t){if(!e.length||!t.length)return e;let n={},r=new Set;for(let e of t)A(e)&&r.add(e.object);for(let e of t){if(A(e)){let t=n[e.object]||={listViews:{},formViews:{}},r=e.name||`${e.object}.${e.viewKind}`,i=e.config&&typeof e.config==`object`?e.config:{},a={...i,name:r,label:e.label??i.label,isDefault:!!e.isDefault};e.viewKind===`form`?(t.formViews[r]=a,(e.isDefault||!t.form)&&(t.form=a)):(t.listViews[r]=a,e.isDefault&&(t.primary=a));continue}let t=e?.name||e?.list?.data?.object||e?.form?.data?.object;if(!t||r.has(t))continue;let i=n[t]||={listViews:{},formViews:{}};if(e.list){i.primary=e.list;let t=e.list.name||`list`;i.listViews[t]=e.list}if(e.form&&(i.form=e.form),e.listViews&&typeof e.listViews==`object`)for(let[t,n]of Object.entries(e.listViews))i.listViews[t]=n;if(e.formViews&&typeof e.formViews==`object`)for(let[t,n]of Object.entries(e.formViews))i.formViews[t]=n}return e.map(e=>{let t=n[e.name];if(!t)return e;let r=e.listViews||e.list_views||{},i=e.formViews||e.form_views||{},a={...e,listViews:{...t.listViews,...r}};return(Object.keys(t.formViews).length||Object.keys(i).length)&&(a.formViews={...t.formViews,...i}),t.primary&&!e.list&&(a.list=t.primary),t.form&&!e.form&&(a.form=t.form),a})}function M(e){if(!e?.length)return e;let t={};for(let n of e){let e=n?.fields;if(!e)continue;let r=Array.isArray(e)?e.map(e=>[e?.name,e]):Object.entries(e);for(let[e,i]of r){let r=i;if(!e||!r?.inlineEdit||r.type!==`master_detail`&&r.type!==`lookup`)continue;let a=r.reference;a&&(t[a]||=[]).push({childObject:n.name,relationshipField:e,inlineMode:s(n,r.inlineEdit,{relationshipField:e}),...r.inlineTitle?{title:r.inlineTitle}:{},...Array.isArray(r.inlineColumns)?{columns:r.inlineColumns}:{},...typeof r.inlineAmountField==`string`?{amountField:r.inlineAmountField}:{}})}}return Object.keys(t).length?e.map(e=>{let n=t[e.name];if(!n?.length)return e;let r={...e.form||{type:`simple`}},i=Array.isArray(r.subforms)?r.subforms:[],a=new Set(i.map(e=>e.childObject));r.subforms=[...n.filter(e=>!a.has(e.childObject)),...i];let o={...e,form:r};return e.formViews?.default&&(o.formViews={...e.formViews,default:{...e.formViews.default,subforms:r.subforms}}),o}):e}function N(){return{status:`idle`,items:[],byName:new Map,error:null,fetchedAt:0,promise:null}}function P(e){if(typeof sessionStorage>`u`)return null;try{let t=sessionStorage.getItem(C+e);if(!t)return null;let n=JSON.parse(t);return Array.isArray(n)?n:null}catch{return null}}function F(e,t){if(!(typeof sessionStorage>`u`))try{sessionStorage.setItem(C+e,JSON.stringify(t))}catch{}}function I({children:e,adapter:t,ttlMs:n=b}){let r=(0,u.useRef)(new Map),i=(0,u.useRef)(new Map),s=(0,u.useRef)(t);s.current=t;let f=y(),p=(0,u.useMemo)(()=>f?new o({baseUrl:``,previewDrafts:!0}):null,[f]),m=(0,u.useRef)(p);m.current=p;let[h,g]=(0,u.useState)(0),_=(0,u.useCallback)(()=>{typeof queueMicrotask==`function`?queueMicrotask(()=>g(e=>e+1)):Promise.resolve().then(()=>g(e=>e+1))},[]);(0,u.useEffect)(()=>{r.current.clear(),i.current.clear(),_()},[f,_]);let v=(0,u.useCallback)(e=>{let t=r.current.get(e);return t||(t=N(),r.current.set(e,t)),t},[]),C=(0,u.useCallback)(e=>{let t=v(e);if(t.promise)return t.promise;if(t.status===`ready`&&Date.now()-t.fetchedAt<n)return E(`cache hit (fresh) type=${e} items=${t.items.length}`),Promise.resolve(t.items);let r=Date.now();t.status=`loading`,t.error=null;let i=m.current,a=(i?i.list(e):s.current.getClient().meta.getItems(e)).then(n=>{let a=D(n);t.items=a,t.status=`ready`,t.error=null,t.fetchedAt=Date.now(),t.promise=null,t.byName.clear();for(let e of a)k(e)&&t.byName.set(e.name,e);return e===`app`&&!i&&F(e,a),E(`fetched type=${e} items=${a.length} in ${Date.now()-r}ms`),_(),a}).catch(n=>{let r=n instanceof Error?n:Error(String(n));return t.status=`error`,t.error=r,t.promise=null,E(`fetch failed type=${e}`,r),_(),[]});return t.promise=a,a},[_,v,n]),w=(0,u.useCallback)((e,t)=>{let n=v(e);if(n.byName.has(t))return E(`item cache hit type=${e} name=${t}`),Promise.resolve(n.byName.get(t)??null);let r=i.current.get(e);r||(r=new Map,i.current.set(e,r));let a=r.get(t);if(a)return a;let o=Date.now(),c=m.current,l=(c?c.get(e,t):s.current.getClient().meta.getItem(e,t)).then(i=>{let a=O(i);return a&&n.byName.set(t,a),E(`fetched item type=${e} name=${t} in ${Date.now()-o}ms`),r.delete(t),a}).catch(n=>(r.delete(t),E(`fetch item failed type=${e} name=${t}`,n),null));return r.set(t,l),l},[v]),T=(0,u.useCallback)(async e=>{if(e){let t=v(e);t.fetchedAt=0,t.byName.clear(),await C(e);return}let t=Array.from(r.current.keys()).filter(e=>r.current.get(e).status!==`idle`);await Promise.all(t.map(e=>{let t=r.current.get(e);return t.fetchedAt=0,t.byName.clear(),C(e)}))},[C,v]),A=(0,u.useCallback)((e,t)=>{let n=r.current.get(e);n&&(t?(n.byName.delete(t),n.items=n.items.filter(e=>e?.name!==t),E(`invalidated type=${e} name=${t}`)):(n.status=`idle`,n.items=[],n.byName.clear(),n.error=null,n.fetchedAt=0,E(`invalidated type=${e}`)),_())},[_]);(0,u.useEffect)(()=>{if(f)return c(({type:e})=>{A(e)})},[f,A]),(0,u.useEffect)(()=>l(()=>{try{s.current?.clearCache?.()}catch{}T()}),[T]);let[I,L]=(0,u.useState)(!0),[R,z]=(0,u.useState)(null);(0,u.useEffect)(()=>{let e=!1,t=f?null:P(`app`);if(t){let e=v(`app`);e.items=t,e.status=`ready`,e.fetchedAt=0;for(let n of t)k(n)&&e.byName.set(n.name,n);_(),L(!1)}return(async()=>{for(let t of x)try{await C(t),e||z(null)}catch(t){e||z(t instanceof Error?t:Error(String(t)))}e||L(!1)})(),()=>{e=!0}},[t,C,v,_,f]);let B=(0,u.useMemo)(()=>{let e=e=>{let t=v(e);return t.status===`idle`&&C(e),t.items};return{apps:v(`app`).items,get objects(){let t=e(S.objects),n=e(`view`);return M(n.length?j(t,n):t)},get dashboards(){return e(S.dashboards)},get reports(){return e(S.reports)},get pages(){return e(S.pages)},loading:I,error:R??v(`app`).error,refresh:T,invalidate:A,ensureType:C,getItem:w,getItemsByType:t=>e(t),getTypeStatus:e=>v(e).status}},[h,I,R,C,w,v,T,A]);return(0,d.jsx)(a.Provider,{value:B,children:e})}export{y as a,_ as i,p as n,v as r,I as t};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{f as t,h as n,m as r,r as i,y as a}from"./vendor-react-BGDDiZfJ.js";import{d as ee,f as o,n as s,t as c}from"./infrastructure-Bcx6-8du.js";import{l,q as u}from"./framework-B3O15Lsq.js";import{Fc as te,G as d,J as f,Or as ne,Ra as re,V as ie,W as p,Yi as ae,ji as oe,ns as m,xr as h}from"./ui-components-rkvkkTxO.js";import{t as se}from"./RecordDetailView-CzR6BAUv.js";import{r as g}from"./useMetadata-Ily0JuNR.js";import{t as _}from"./getIcon-B5xaQx5N.js";import{n as v,t as y}from"./CreateViewDialog-CMNLzv6j.js";import{a as b,i as x,n as ce,o as le,r as ue,s as de}from"./InterfaceListPage-Dbt7lZbl.js";import{l as fe}from"./plugins-views-CibWNUsP.js";import{t as pe}from"./runtime-metadata-persistence-D1KKivGr.js";var S=e(a(),1),C=i();function w(e){let t=[];return e.forEach((e,n)=>{let r=/^filter\[(.+)\]$/.exec(n);r&&r[1]&&e!==``&&t.push([r[1],`=`,e])}),t}var T=new Set([`select`,`multiselect`,`radio`,`enum`,`boolean`]),E=4;function D({dataSource:e,objects:i}){let{appName:a,objectName:D}=r(),{t:O}=l(),{objectLabel:k,fieldLabel:A}=te(),j=t(),[M,N]=n(),{can:P}=s(),{canRead:F}=c(D??``),{user:I}=o(),L=ee(),R=g(),[z,B]=S.useState(!1),V=S.useMemo(()=>(i||[]).find(e=>e.name===D),[i,D]),[me]=S.useState(()=>de(new URLSearchParams(window.location.search))),he=S.useCallback(e=>{N(t=>le(t,e),{replace:!0})},[N]),H=Array.from(M.entries()).filter(([e])=>e.startsWith(`filter[`)).map(([e,t])=>`${e}=${t}`).join(`&`),U=S.useMemo(()=>{let e=w(new URLSearchParams(H)),t=e.filter(([e])=>F(e));if(t.length<e.length){let t=e.filter(([e])=>!F(e)).map(([e])=>e);console.warn(`[ObjectDataPage] Dropped URL filter(s) on unreadable field(s): ${t.join(`, `)}`)}return t.map(([e,t,n])=>n===`{current_user_id}`?[e,t,I?.id??n]:[e,t,n])},[H,F,I?.id]),ge=S.useCallback(e=>{N(t=>{let n=new URLSearchParams(t);return n.delete(`filter[${e}]`),n})},[N]),W=S.useMemo(()=>ue(V).filter(e=>F(e)),[V,F]),G=S.useMemo(()=>{let e=V?.fields;if(!e||typeof e!=`object`)return;let t=Object.entries(e).filter(([e,t])=>t&&!t.hidden&&T.has(t.type)&&F(e)).slice(0,E).map(([e])=>({field:e}));return t.length>0?{element:`dropdown`,fields:t}:void 0},[V,F]),K=S.useCallback(e=>`/apps/${a}/${D}/record/${encodeURIComponent(String(e))}`,[a,D]),q=u({navigation:{mode:`drawer`},objectName:D??``,onNavigate:e=>j(K(e))}),J=M.get(`recordId`),_e=S.useCallback((e,t)=>{let n=e?.id??e?._id;if(t&&(t.metaKey||t.ctrlKey||t.button===1)&&n!=null){window.open(K(n),`_blank`);return}n!=null&&N(e=>{let t=new URLSearchParams(e);return t.set(`recordId`,String(n)),t})},[K,N]),ve=S.useCallback(()=>{N(e=>{let t=new URLSearchParams(e);return t.delete(`recordId`),t})},[N]);S.useEffect(()=>{J&&!q.isOpen?q.open({id:J}):!J&&q.isOpen&&q.close()},[J]);let Y=S.useMemo(()=>b(V),[V]),X=S.useMemo(()=>ce(V),[V]),Z=S.useMemo(()=>x(V),[V]),Q=S.useMemo(()=>{let e=[`grid`];return Y&&e.push(`kanban`),X&&e.push(`calendar`),Z&&e.push(`gallery`),e},[Y,X,Z]),$=S.useMemo(()=>{if(V)return{type:`list-view`,objectName:V.name,viewType:`grid`,fields:W,...U.length?{filters:U}:{},kanban:Y,calendar:X,gallery:Z,userFilters:G,appearance:{allowedVisualizations:Q},showViewSwitcher:Q.length>1,showSearch:!0,showSort:!0,showFilters:!0,showGroup:!0,showHideFields:!0,showDensity:!0,showRecordCount:!0}},[V,W,U,Y,X,Z,G,Q]),ye=S.useCallback(async e=>{try{let t={...e,columns:Array.isArray(e.columns)&&e.columns.length>0?e.columns:W,...U.length?{filter:U}:{}},n=await pe(`view`,String(e?.name??e?.id??``),t,{metadataClient:R});n&&j(`../view/${n}`,{relative:`path`})}catch(e){console.error(`[ObjectDataPage] Failed to save view:`,e)}},[W,U,R,j]);return V?P(V.name,`read`)?(0,C.jsxs)(`div`,{className:`h-full flex flex-col bg-background min-w-0 overflow-hidden`,"data-testid":`object-data-page`,children:[(0,C.jsx)(`div`,{className:`hidden sm:block`,children:(0,C.jsx)(v,{title:(0,C.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,C.jsx)(`span`,{className:`truncate`,children:k(V)}),(0,C.jsx)(`span`,{className:`rounded border px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground`,children:O(`console.objectData.badge`,{defaultValue:`Data`})})]}),description:O(`console.objectData.description`,{defaultValue:`URL-defined data slice — not bound to any saved view.`}),icon:S.createElement(_(V?.icon),{className:`h-4 w-4`}),actions:(0,C.jsxs)(C.Fragment,{children:[P(V.name,`create`)&&(0,C.jsxs)(h,{size:`sm`,onClick:()=>j(`../new`,{relative:`path`}),className:`shadow-none gap-1.5 h-8 sm:h-9`,"data-testid":`object-data-new-button`,children:[(0,C.jsx)(ae,{className:`h-4 w-4`}),(0,C.jsx)(`span`,{className:`hidden sm:inline`,children:O(`console.objectView.new`)})]}),L&&(0,C.jsxs)(h,{size:`sm`,variant:`outline`,onClick:()=>B(!0),className:`shadow-none gap-1.5 h-8 sm:h-9`,"data-testid":`object-data-save-as-view`,children:[(0,C.jsx)(oe,{className:`h-4 w-4`}),(0,C.jsx)(`span`,{className:`hidden sm:inline`,children:O(`console.objectData.saveAsView`,{defaultValue:`Save as view`})})]})]})})}),U.length>0&&(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 border-b px-3 sm:px-4 py-2 shrink-0`,"data-testid":`object-data-filter-chips`,children:[(0,C.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:O(`console.objectData.filteredBy`,{defaultValue:`Filtered by`})}),U.map(([e,,t])=>(0,C.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border bg-muted/40 px-2 py-0.5 text-xs`,children:[(0,C.jsx)(`span`,{className:`font-medium`,children:A(V.name,e,e)}),(0,C.jsxs)(`span`,{className:`text-muted-foreground`,children:[`= `,String(t)]}),(0,C.jsx)(`button`,{type:`button`,onClick:()=>ge(e),className:`ml-0.5 rounded-full hover:bg-muted p-0.5`,"aria-label":O(`console.objectData.removeFilter`,{defaultValue:`Remove filter {{field}}`,field:e}),"data-testid":`object-data-remove-filter-${e}`,children:(0,C.jsx)(ne,{className:`h-3 w-3`})})]},e))]}),(0,C.jsx)(`div`,{className:`flex-1 min-h-0 overflow-auto`,children:$&&(0,C.jsx)(fe,{schema:$,dataSource:e,userFilterSelections:me,onUserFilterSelectionsChange:he,onRowClick:_e})}),q.isOverlay&&(0,C.jsx)(ie,{...q,setIsOpen:e=>{e||ve()},title:k(V),children:t=>(0,C.jsx)(se,{objectNameOverride:V.name,recordIdOverride:String(t?.id??t?._id??J??``),embedded:!0,dataSource:e,objects:i,onEdit:()=>{}})}),L&&(0,C.jsx)(y,{open:z,onOpenChange:B,onCreate:ye,objectDef:V})]}):(0,C.jsx)(`div`,{className:`h-full flex items-center justify-center p-8`,"data-testid":`object-data-403`,children:(0,C.jsxs)(p,{children:[(0,C.jsx)(`div`,{className:`mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted`,children:(0,C.jsx)(re,{className:`h-6 w-6 text-muted-foreground`})}),(0,C.jsx)(f,{children:O(`console.objectData.noAccessTitle`,{defaultValue:`Access denied`})}),(0,C.jsx)(d,{children:O(`console.objectData.noAccess`,{defaultValue:`You do not have permission to view this data.`})})]})}):(0,C.jsx)(`div`,{className:`h-full flex items-center justify-center p-8`,children:(0,C.jsxs)(p,{children:[(0,C.jsx)(`div`,{className:`mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted`,children:(0,C.jsx)(m,{className:`h-6 w-6 text-muted-foreground`})}),(0,C.jsx)(f,{children:O(`console.objectView.objectNotFound`)}),(0,C.jsx)(d,{children:O(`console.objectView.objectNotFoundDescription`,{objectName:D})})]})})}export{D as ObjectDataPage};
1
+ import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{f as t,h as n,m as r,r as i,y as a}from"./vendor-react-BGDDiZfJ.js";import{d as ee,f as o,n as s,t as c}from"./infrastructure-Bcx6-8du.js";import{l,q as u}from"./framework-B3O15Lsq.js";import{Fc as te,G as d,J as f,Or as ne,Ra as re,V as ie,W as p,Yi as ae,ji as oe,ns as m,xr as h}from"./ui-components-rkvkkTxO.js";import{t as se}from"./RecordDetailView-CzR6BAUv.js";import{r as g}from"./useMetadata-DO66YueM.js";import{t as _}from"./getIcon-B5xaQx5N.js";import{n as v,t as y}from"./CreateViewDialog-CMNLzv6j.js";import{a as b,i as x,n as ce,o as le,r as ue,s as de}from"./InterfaceListPage-B_B_Fttt.js";import{l as fe}from"./plugins-views-CibWNUsP.js";import{t as pe}from"./runtime-metadata-persistence-D1KKivGr.js";var S=e(a(),1),C=i();function w(e){let t=[];return e.forEach((e,n)=>{let r=/^filter\[(.+)\]$/.exec(n);r&&r[1]&&e!==``&&t.push([r[1],`=`,e])}),t}var T=new Set([`select`,`multiselect`,`radio`,`enum`,`boolean`]),E=4;function D({dataSource:e,objects:i}){let{appName:a,objectName:D}=r(),{t:O}=l(),{objectLabel:k,fieldLabel:A}=te(),j=t(),[M,N]=n(),{can:P}=s(),{canRead:F}=c(D??``),{user:I}=o(),L=ee(),R=g(),[z,B]=S.useState(!1),V=S.useMemo(()=>(i||[]).find(e=>e.name===D),[i,D]),[me]=S.useState(()=>de(new URLSearchParams(window.location.search))),he=S.useCallback(e=>{N(t=>le(t,e),{replace:!0})},[N]),H=Array.from(M.entries()).filter(([e])=>e.startsWith(`filter[`)).map(([e,t])=>`${e}=${t}`).join(`&`),U=S.useMemo(()=>{let e=w(new URLSearchParams(H)),t=e.filter(([e])=>F(e));if(t.length<e.length){let t=e.filter(([e])=>!F(e)).map(([e])=>e);console.warn(`[ObjectDataPage] Dropped URL filter(s) on unreadable field(s): ${t.join(`, `)}`)}return t.map(([e,t,n])=>n===`{current_user_id}`?[e,t,I?.id??n]:[e,t,n])},[H,F,I?.id]),ge=S.useCallback(e=>{N(t=>{let n=new URLSearchParams(t);return n.delete(`filter[${e}]`),n})},[N]),W=S.useMemo(()=>ue(V).filter(e=>F(e)),[V,F]),G=S.useMemo(()=>{let e=V?.fields;if(!e||typeof e!=`object`)return;let t=Object.entries(e).filter(([e,t])=>t&&!t.hidden&&T.has(t.type)&&F(e)).slice(0,E).map(([e])=>({field:e}));return t.length>0?{element:`dropdown`,fields:t}:void 0},[V,F]),K=S.useCallback(e=>`/apps/${a}/${D}/record/${encodeURIComponent(String(e))}`,[a,D]),q=u({navigation:{mode:`drawer`},objectName:D??``,onNavigate:e=>j(K(e))}),J=M.get(`recordId`),_e=S.useCallback((e,t)=>{let n=e?.id??e?._id;if(t&&(t.metaKey||t.ctrlKey||t.button===1)&&n!=null){window.open(K(n),`_blank`);return}n!=null&&N(e=>{let t=new URLSearchParams(e);return t.set(`recordId`,String(n)),t})},[K,N]),ve=S.useCallback(()=>{N(e=>{let t=new URLSearchParams(e);return t.delete(`recordId`),t})},[N]);S.useEffect(()=>{J&&!q.isOpen?q.open({id:J}):!J&&q.isOpen&&q.close()},[J]);let Y=S.useMemo(()=>b(V),[V]),X=S.useMemo(()=>ce(V),[V]),Z=S.useMemo(()=>x(V),[V]),Q=S.useMemo(()=>{let e=[`grid`];return Y&&e.push(`kanban`),X&&e.push(`calendar`),Z&&e.push(`gallery`),e},[Y,X,Z]),$=S.useMemo(()=>{if(V)return{type:`list-view`,objectName:V.name,viewType:`grid`,fields:W,...U.length?{filters:U}:{},kanban:Y,calendar:X,gallery:Z,userFilters:G,appearance:{allowedVisualizations:Q},showViewSwitcher:Q.length>1,showSearch:!0,showSort:!0,showFilters:!0,showGroup:!0,showHideFields:!0,showDensity:!0,showRecordCount:!0}},[V,W,U,Y,X,Z,G,Q]),ye=S.useCallback(async e=>{try{let t={...e,columns:Array.isArray(e.columns)&&e.columns.length>0?e.columns:W,...U.length?{filter:U}:{}},n=await pe(`view`,String(e?.name??e?.id??``),t,{metadataClient:R});n&&j(`../view/${n}`,{relative:`path`})}catch(e){console.error(`[ObjectDataPage] Failed to save view:`,e)}},[W,U,R,j]);return V?P(V.name,`read`)?(0,C.jsxs)(`div`,{className:`h-full flex flex-col bg-background min-w-0 overflow-hidden`,"data-testid":`object-data-page`,children:[(0,C.jsx)(`div`,{className:`hidden sm:block`,children:(0,C.jsx)(v,{title:(0,C.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,C.jsx)(`span`,{className:`truncate`,children:k(V)}),(0,C.jsx)(`span`,{className:`rounded border px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground`,children:O(`console.objectData.badge`,{defaultValue:`Data`})})]}),description:O(`console.objectData.description`,{defaultValue:`URL-defined data slice — not bound to any saved view.`}),icon:S.createElement(_(V?.icon),{className:`h-4 w-4`}),actions:(0,C.jsxs)(C.Fragment,{children:[P(V.name,`create`)&&(0,C.jsxs)(h,{size:`sm`,onClick:()=>j(`../new`,{relative:`path`}),className:`shadow-none gap-1.5 h-8 sm:h-9`,"data-testid":`object-data-new-button`,children:[(0,C.jsx)(ae,{className:`h-4 w-4`}),(0,C.jsx)(`span`,{className:`hidden sm:inline`,children:O(`console.objectView.new`)})]}),L&&(0,C.jsxs)(h,{size:`sm`,variant:`outline`,onClick:()=>B(!0),className:`shadow-none gap-1.5 h-8 sm:h-9`,"data-testid":`object-data-save-as-view`,children:[(0,C.jsx)(oe,{className:`h-4 w-4`}),(0,C.jsx)(`span`,{className:`hidden sm:inline`,children:O(`console.objectData.saveAsView`,{defaultValue:`Save as view`})})]})]})})}),U.length>0&&(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 border-b px-3 sm:px-4 py-2 shrink-0`,"data-testid":`object-data-filter-chips`,children:[(0,C.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:O(`console.objectData.filteredBy`,{defaultValue:`Filtered by`})}),U.map(([e,,t])=>(0,C.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border bg-muted/40 px-2 py-0.5 text-xs`,children:[(0,C.jsx)(`span`,{className:`font-medium`,children:A(V.name,e,e)}),(0,C.jsxs)(`span`,{className:`text-muted-foreground`,children:[`= `,String(t)]}),(0,C.jsx)(`button`,{type:`button`,onClick:()=>ge(e),className:`ml-0.5 rounded-full hover:bg-muted p-0.5`,"aria-label":O(`console.objectData.removeFilter`,{defaultValue:`Remove filter {{field}}`,field:e}),"data-testid":`object-data-remove-filter-${e}`,children:(0,C.jsx)(ne,{className:`h-3 w-3`})})]},e))]}),(0,C.jsx)(`div`,{className:`flex-1 min-h-0 overflow-auto`,children:$&&(0,C.jsx)(fe,{schema:$,dataSource:e,userFilterSelections:me,onUserFilterSelectionsChange:he,onRowClick:_e})}),q.isOverlay&&(0,C.jsx)(ie,{...q,setIsOpen:e=>{e||ve()},title:k(V),children:t=>(0,C.jsx)(se,{objectNameOverride:V.name,recordIdOverride:String(t?.id??t?._id??J??``),embedded:!0,dataSource:e,objects:i,onEdit:()=>{}})}),L&&(0,C.jsx)(y,{open:z,onOpenChange:B,onCreate:ye,objectDef:V})]}):(0,C.jsx)(`div`,{className:`h-full flex items-center justify-center p-8`,"data-testid":`object-data-403`,children:(0,C.jsxs)(p,{children:[(0,C.jsx)(`div`,{className:`mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted`,children:(0,C.jsx)(re,{className:`h-6 w-6 text-muted-foreground`})}),(0,C.jsx)(f,{children:O(`console.objectData.noAccessTitle`,{defaultValue:`Access denied`})}),(0,C.jsx)(d,{children:O(`console.objectData.noAccess`,{defaultValue:`You do not have permission to view this data.`})})]})}):(0,C.jsx)(`div`,{className:`h-full flex items-center justify-center p-8`,children:(0,C.jsxs)(p,{children:[(0,C.jsx)(`div`,{className:`mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted`,children:(0,C.jsx)(m,{className:`h-6 w-6 text-muted-foreground`})}),(0,C.jsx)(f,{children:O(`console.objectView.objectNotFound`)}),(0,C.jsx)(d,{children:O(`console.objectView.objectNotFoundDescription`,{objectName:D})})]})})}export{D as ObjectDataPage};
@@ -1 +1 @@
1
- import{o as e,r as t}from"./rolldown-runtime-DAXXjFlN.js";import{d as n,f as r,h as i,m as a,r as o,y as s}from"./vendor-react-BGDDiZfJ.js";import{d as c,f as l,m as u,n as d}from"./infrastructure-Bcx6-8du.js";import{H as f,L as p,R as m,Y as h,b as g,l as _}from"./framework-B3O15Lsq.js";import{B as v,Fc as y,Fo as b,G as x,J as S,W as C,_r as w,fr as T,gr as E,hr as D,mr as O,na as k,vr as A,xr as j,yr as M}from"./ui-components-rkvkkTxO.js";import{r as N}from"./vendor-ui-utils-BzQBRdq3.js";import"./MetadataProvider-DKJsxrNu.js";import{r as P}from"./ExpressionProvider-ODpzkcN3.js";import{c as ee,i as te,l as ne,r as re,u as ie}from"./RecordDetailView-CzR6BAUv.js";import{n as F,r as I,t as L}from"./MetadataInspector-RvnQ-QOT.js";import{t as R}from"./InterfaceListPage-Dbt7lZbl.js";var z=e(s(),1),B=o();function V(e,t){if(/^https?:\/\//i.test(e)||e.startsWith(`mailto:`))return{href:e,external:!e.startsWith(`mailto:`)};let n=(t||``).replace(/\/+$/,``);return{href:`${n}${e}`,external:!!n}}function H({cta:e,apiBase:t,primary:n,onNavigate:r}){let{href:i,external:a}=V(e.url,t);return(0,B.jsx)(j,{asChild:!0,variant:n?`default`:`outline`,size:`sm`,children:(0,B.jsx)(`a`,{href:i,onClick:r,...a?{target:`_blank`,rel:`noopener noreferrer`}:{},"data-testid":`entitlement-cta-${n?`primary`:`secondary`}`,children:e.label})})}function ae({state:e,apiBase:t,onOpenChange:n}){let r=e.spec;return(0,B.jsx)(T,{open:e.open,onOpenChange:e=>{e||n(!1)},children:(0,B.jsxs)(D,{"data-testid":`environment-entitlement-dialog`,children:[(0,B.jsxs)(A,{children:[(0,B.jsx)(M,{children:r?.title}),(0,B.jsx)(E,{children:r?.message})]}),(0,B.jsxs)(w,{children:[(0,B.jsx)(O,{children:`Close`}),r?.secondaryCta&&(0,B.jsx)(H,{cta:r.secondaryCta,apiBase:t,primary:!1,onNavigate:()=>n(!1)}),r?.cta&&(0,B.jsx)(H,{cta:r.cta,apiBase:t,primary:!0,onNavigate:()=>n(!1)})]})]})})}var U=new Set([`DEV_ENV_PLAN_LOCKED`,`DEV_ENV_LIMIT`,`PRODUCTION_ENV_LIMIT`]);function W(e){return typeof e==`string`&&U.has(e)}var G=`/settings/billing`;function oe(e){let t=e?.code;if(!W(t))return null;let n=typeof e?.error==`string`&&e.error?e.error:typeof e?.message==`string`?e.message:``,r=typeof e?.upgrade_url==`string`&&e.upgrade_url?e.upgrade_url:G,i=typeof e?.contact_url==`string`&&e.contact_url?e.contact_url:``;return t===`PRODUCTION_ENV_LIMIT`?{code:t,title:`You already have your production environment`,message:n||`Each organization includes exactly one production environment. Create a separate organization for another, or contact us about an Enterprise arrangement.`,cta:i?{label:`Contact sales`,url:i}:void 0}:{code:t,title:t===`DEV_ENV_PLAN_LOCKED`?`Development environments are a paid feature`:`Development environment limit reached`,message:n||(t===`DEV_ENV_PLAN_LOCKED`?`Your free plan includes one production environment. Upgrade to add development environments — build in dev, then publish to production.`:`Capacity scales with AI seats. Add an AI seat, or archive an unused development environment to free one up.`),cta:{label:`Upgrade plan`,url:r}}}function K(e){return e.hasProductionEnv?e.canCreateDevelopmentEnv===!1?`upgrade_for_development`:`add_development`:`setup_production`}function q(e){return{code:`DEV_ENV_PLAN_LOCKED`,title:`Development environments are a paid feature`,message:`${e.plan&&e.plan!==`free`?`your ${e.plan} plan`:`your free plan`} includes one production environment. Upgrade to add development environments — build in dev, then publish to production.`,cta:{label:`Upgrade plan`,url:e.upgradeUrl||`/settings/billing`}}}var J=/^\s*\{\{\s*page\.([A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*)\s*\}\}\s*$/;function Y(e,t){let n=t;for(let t of e.split(`.`)){if(n==null)return;n=n[t]}return n}function se(e,t){if(!e.includes(`{{`))return e;let n=e.match(J);if(n){let e=Y(n[1],t);return e===void 0?``:e}return e.replace(/\{\{\s*page\.([A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*)\s*\}\}/g,(e,n)=>{let r=Y(n,t);return r==null?``:String(r)})}function X(e,t){if(typeof e==`string`)return se(e,t);if(Array.isArray(e))return e.map(e=>X(e,t));if(e&&typeof e==`object`){let n={};for(let[r,i]of Object.entries(e))n[r]=X(i,t);return n}return e}function Z(e,t){return t?X(e,t):e}var ce={id:`current-user`,name:`Demo User`,isPlatformAdmin:!1};function Q(e){let t=e.locations;return Array.isArray(t)?t.some(e=>e===`list_item`||e===`record_header`||e===`record_more`||e===`record_section`):!1}function $(e){let{dataSource:t,objects:n,objectName:i,onRefresh:a}=e,o=r(),{user:s,activeOrganization:c}=l(),{systemPermissions:f}=d(),{fieldLabel:p,fieldOptionLabel:m,actionParamText:h,actionParamOptionLabel:_,actionDescription:v}=y(),b=(0,z.useMemo)(()=>i?n?.find(e=>e.name===i):void 0,[n,i]),x=i||b?.name,S=(0,z.useCallback)(()=>{a?.()},[a]),C=g({dataSource:t,onUndo:()=>{S(),N.success(`Change undone`)}}),[w,T]=(0,z.useState)({open:!1,message:``}),[E,D]=(0,z.useState)({open:!1,params:[]}),[O,k]=(0,z.useState)({open:!1}),[A,j]=(0,z.useState)(null),[M,P]=(0,z.useState)({open:!1}),F=(0,z.useRef)(new Set),I=(0,z.useCallback)((e,t)=>new Promise(n=>{k({open:!0,spec:e,data:t,resolve:n})}),[]),L=(0,z.useCallback)((e,t)=>new Promise(n=>{T({open:!0,message:e,options:t,resolve:n})}),[]),R=(0,z.useCallback)((e,t)=>new Promise(r=>{let a=t?.params&&!Array.isArray(t.params)?t.params._rowRecord:void 0,o=re(e,{objectName:i||b?.name||``,objects:n||[],fieldLabel:p,fieldOptionLabel:m,row:a}),s=i||b?.name,c=o.map(e=>({...e,label:h(s,t?.name,e.name,`label`,e.label)??e.label,placeholder:h(s,t?.name,e.name,`placeholder`,e.placeholder)??e.placeholder,helpText:h(s,t?.name,e.name,`helpText`,e.helpText)??e.helpText,options:Array.isArray(e.options)?e.options.map(n=>({...n,label:_(s,t?.name,e.name,n.value,n.label)})):e.options}));D({open:!0,params:c,title:t?.label||t?.title,description:v(s,t?.name,t?.description),resolve:r})}),[i,b,n,p,m,h,_]),V=s?{id:s.id,name:s.name,avatar:s.image,isPlatformAdmin:s?.isPlatformAdmin??!1,systemPermissions:f??[]}:{...ce,systemPermissions:f??[]},H=(0,z.useCallback)((e,t)=>{if(t?.type===`error`){N.error(e);return}if(t?.undo){N.success(e,{duration:t.duration,action:{label:t.undo.label||`Undo`,onClick:()=>{C.undo()}}});return}N.success(e,{duration:t?.duration})},[C]),U=(0,z.useCallback)((e,t)=>{t?.external||t?.newTab?window.open(e,`_blank`,`noopener,noreferrer`):o(e)},[o]),W=(0,z.useMemo)(()=>u(),[]),G=(0,z.useCallback)(e=>{P({open:!0,spec:e})},[]),K=(0,z.useCallback)(async(e,n)=>{try{let r=e.target||e.name,i=e.params||{},a=typeof r==`string`?r:``;if(a.startsWith(`/`)||/^https?:\/\//i.test(a)){let t={...i},r=t._rowRecord;delete t._rowRecord;let o=n?.pageVariables??void 0,s=Z(t,o),l=a;r&&/\{[a-z_][a-z0-9_]*\}/i.test(l)&&(l=l.replace(/\{([a-z_][a-z0-9_]*)\}/gi,(e,t)=>{let n=r[t];return n==null?``:encodeURIComponent(String(n))}));let u=l.startsWith(`http`)?l:`${l}`,d=e.bodyShape&&typeof e.bodyShape==`object`&&e.bodyShape.wrap?e.bodyShape.wrap:void 0,f=d?{[d]:s}:{...s};if(r&&e.recordIdParam){let t=r[e.recordIdField||`id`];t!=null&&(f[e.recordIdParam]=t)}/\/api\/v1\/auth\//.test(l)&&!f.organizationId&&c?.id&&(f.organizationId=c.id),e.bodyExtra&&typeof e.bodyExtra==`object`&&Object.assign(f,Z(e.bodyExtra,o));let p=(e.method||`POST`).toUpperCase(),m={method:p,headers:{"Content-Type":`application/json`},credentials:`include`};p!==`GET`&&p!==`DELETE`&&(m.body=JSON.stringify(f));let h=await W(u,m);if(!h.ok){let e=null;try{e=await h.json()}catch{}let t=oe(e);return t?(G(t),{success:!1}):{success:!1,error:e?.error||e?.message||`HTTP ${h.status}`}}let g=await h.json().catch(()=>({}));return e.refreshAfter!==!1&&S(),{success:!0,data:g,reload:e.refreshAfter!==!1}}let o=e.objectName||x,s=i._rowRecord,l={...i};delete l._rowRecord;let u=l.recordId??s?.[e.recordIdField||`id`];delete l.recordId,e.bodyExtra&&typeof e.bodyExtra==`object`&&Object.assign(l,e.bodyExtra),o&&typeof t?.execute==`function`?await t.execute(o,r,l):o&&u&&Object.keys(l).length>0&&typeof t?.update==`function`&&await t.update(o,u,l);let d;if(e.undoable&&o&&u&&s&&Object.keys(l).length>0&&typeof t?.update==`function`){let t={};for(let e of Object.keys(l))t[e]=s[e]??null;d={id:`undo-${o}-${u}-${Date.now()}`,type:`update`,objectName:o,recordId:String(u),timestamp:Date.now(),description:e.label||`Undo ${o}`,undoData:t,redoData:{...l}}}let f=e.refreshAfter!==!1;return f&&S(),{success:!0,reload:f,undo:d}}catch(e){return{success:!1,error:e.message}}},[t,x,W,c,S,G]),q=(0,z.useCallback)(async(e,t)=>{let n=e.target||e.name;if(!n)return{success:!1,error:`No flow target provided for flow action`};try{let r={...e.params||{}},i=r._rowRecord;delete r._rowRecord;let a=r.recordId??i?.id;if(a==null){let n=Array.isArray(t?.selectedRecords)?t.selectedRecords:[];if(n.length===1)a=n[0]?.id;else if(n.length>1)return{success:!1,error:`This flow runs on a single record — select exactly one row.`};else if(Q(e))return{success:!1,error:`This flow runs on a single record — select a row first.`}}a!=null&&r.recordId==null&&(r.recordId=a);let o=await W(`/api/v1/automation/${encodeURIComponent(n)}/trigger`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({recordId:a,objectName:e.objectName||x,params:r})}),s=await o.json().catch(()=>null);if(!o.ok||s&&s.success===!1)return{success:!1,error:s?.error||`Flow "${n}" failed (HTTP ${o.status})`};let c=s?.data??{};if(c.status===`paused`&&c.screen)return j({flowName:n,runId:c.runId,screen:c.screen}),{success:!0,silent:!0};let l=e.refreshAfter!==!1;return l&&S(),{success:!0,data:s?.data,reload:l}}catch(e){return{success:!1,error:e.message}}},[W,x,S]),J=(0,z.useCallback)(async(e,t)=>{let n=e.target||e.name;if(!n)return{success:!1,error:`No action target provided`};let r=e.params&&!Array.isArray(e.params)?{...e.params}:{},i=r._rowRecord;delete r._rowRecord;let a=e.recordIdField||`id`,o=r.recordId??i?.[a];if(o==null){let n=Array.isArray(t?.selectedRecords)?t.selectedRecords:[];if(n.length===1)o=n[0]?.[a];else if(n.length>1)return{success:!1,error:`This action runs on a single record — select exactly one row.`};else if(Q(e))return{success:!1,error:`This action runs on a single record — select a row first.`}}let s=`${n}:${o??``}`;if(F.current.has(s))return{success:!1,error:`Action already in progress`};F.current.add(s);let c=null;if(e.opensInNewTab)try{c=window.open(`about:blank`,`_blank`),c&&(c.document.write(`<!doctype html><meta charset="utf-8"><title>正在打开… Opening…</title><body style="margin:0;font-family:system-ui,sans-serif;display:flex;flex-direction:column;align-items:center;justify-content:center;height:100vh;gap:16px;color:#4b5563"><div style="width:28px;height:28px;border:3px solid #e5e7eb;border-top-color:#6366f1;border-radius:50%;animation:s .8s linear infinite"></div><div>正在为你打开环境…</div><style>@keyframes s{to{transform:rotate(360deg)}}</style></body>`),c.document.close())}catch{c=null}try{let t=typeof e.newTabUrl==`string`?e.newTabUrl:``;if(e.opensInNewTab&&t){if(o==null){if(c)try{c.close()}catch{}return{success:!1,error:`This action runs on a single record — no record id available.`}}let n=`${window.location.origin}${t.replace(`{recordId}`,encodeURIComponent(String(o)))}`;if(c)try{c.location.href=n}catch{try{c.close()}catch{}window.location.href=n}else{let e=null;try{e=window.open(n,`_blank`)}catch{e=null}e||N(`浏览器拦截了弹窗 / Popup blocked`,{description:`点击在新标签页打开环境`,action:{label:`打开环境`,onClick:()=>{try{window.open(n,`_blank`)}catch{window.location.href=n}}},duration:1e4})}return e.refreshAfter===!0&&S(),{success:!0}}let i=e.objectName||x||`global`,a=await W(`/api/v1/actions/${encodeURIComponent(i)}/${encodeURIComponent(n)}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({recordId:o,params:r})}),s=await a.json().catch(()=>null);if(!a.ok||s&&s.success===!1){let e=s?.error||`Action "${n}" failed (HTTP ${a.status})`;if(c)try{c.close()}catch{}return{success:!1,error:e}}let l=e.refreshAfter!==!1;l&&S();let u=s?.data,d=u&&typeof u==`object`&&typeof u.redirectUrl==`string`?u.redirectUrl:null;if(d)if(c)try{c.location.href=d}catch{try{c.close()}catch{}window.location.href=d}else{let e=null;try{e=window.open(d,`_blank`)}catch{e=null}e||N(`浏览器拦截了弹窗 / Popup blocked`,{description:`点击在新标签页打开环境`,action:{label:`打开环境`,onClick:()=>{try{window.open(d,`_blank`)}catch{window.location.href=d}}},duration:1e4})}else if(c)try{c.close()}catch{}return{success:!0,data:u,reload:l}}catch(e){if(c)try{c.close()}catch{}return{success:!1,error:e.message}}finally{F.current.delete(s)}},[W,x,S]);return{confirmHandler:L,toastHandler:H,navigateHandler:U,paramCollectionHandler:R,resultDialogHandler:I,apiHandler:K,flowHandler:q,serverActionHandler:J,authFetch:W,openEntitlementDialog:G,actionProviderProps:(0,z.useMemo)(()=>({context:{...i?{objectName:i}:{},user:V,apiBase:``,activeOrganization:c?{id:c.id,slug:c.slug,name:c.name}:null},onConfirm:L,onToast:H,onNavigate:U,onParamCollection:R,onResultDialog:I,handlers:{api:K,flow:q,script:J,modal:J}}),[i,V,c,L,H,U,R,I,K,q,J]),dialogs:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(ie,{state:w,onOpenChange:e=>{e||T({open:!1,message:``})}}),(0,B.jsx)(ne,{state:E,onOpenChange:e=>{e||D({open:!1,params:[]})}}),(0,B.jsx)(ee,{state:O,onAcknowledge:()=>{O.resolve?.(),k({open:!1})}}),(0,B.jsx)(te,{state:A,authFetch:W,baseUrl:``,dataSource:t,objects:n,onClose:()=>j(null),onComplete:()=>{j(null),S()}}),(0,B.jsx)(ae,{state:M,apiBase:``,onOpenChange:e=>{e||P({open:!1})}})]})}}function le({children:e,...t}){let n=$(t);return(0,B.jsxs)(f,{...n.actionProviderProps,children:[e,n.dialogs]})}var ue=t({PageView:()=>de});function de(){let{t:e}=_(),{pageName:t}=a(),[o]=i(),{showDebug:s}=F(),l=r(),u=n(),d=c(),{pages:f,objects:g,getTypeStatus:y}=m(),{app:w}=P(),T=p(),[E,D]=(0,z.useState)(0),O=I(f,t,w?._packageId);if(!O){let n=y?.(`page`);return n===`idle`||n===`loading`?(0,B.jsx)(`div`,{className:`h-full flex items-center justify-center p-8`,"data-testid":`page-loading`,children:(0,B.jsx)(v,{className:`h-5 w-5 text-muted-foreground`})}):(0,B.jsx)(`div`,{className:`h-full flex items-center justify-center p-8`,children:(0,B.jsxs)(C,{children:[(0,B.jsx)(`div`,{className:`mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted`,children:(0,B.jsx)(b,{className:`h-6 w-6 text-muted-foreground`})}),(0,B.jsx)(S,{children:e(`empty.pageNotFound`)}),(0,B.jsx)(x,{children:e(`empty.pageNotFoundDescription`,{name:t})})]})})}let A=Object.fromEntries(o.entries()),j=u.pathname.match(/\/apps\/([^/]+)/)?.[1],M=d&&!!j&&!!t;return(0,B.jsx)(le,{dataSource:T,objects:g,onRefresh:()=>D(e=>e+1),children:(0,B.jsxs)(`div`,{className:`flex flex-row h-full w-full overflow-hidden relative`,children:[(0,B.jsxs)(`div`,{className:`flex-1 overflow-auto h-full relative`,children:[M&&(0,B.jsx)(`button`,{type:`button`,onClick:()=>{M&&l(`/apps/${j}/metadata/page/${encodeURIComponent(t)}`)},className:`absolute right-3 top-3 z-30 inline-flex h-7 w-7 items-center justify-center rounded-md border border-input bg-background/90 text-muted-foreground shadow-sm backdrop-blur hover:bg-accent hover:text-accent-foreground`,"data-testid":`page-edit-in-studio-button`,title:e(`common.editInStudio`,{defaultValue:`Edit in studio`}),"aria-label":e(`common.editInStudio`,{defaultValue:`Edit in studio`}),children:(0,B.jsx)(k,{className:`h-3.5 w-3.5`})}),O.interfaceConfig?.source?(0,B.jsx)(R,{page:O,reserveEditAffordance:M},E):(0,B.jsx)(h,{schema:{...O,type:O.type||`page`,context:{...O.context,params:A,refreshKey:E}}},E)]}),(0,B.jsx)(L,{open:s,sections:[{title:`Page Configuration`,data:O}]})]})})}export{q as a,K as i,$ as n,G as r,ue as t};
1
+ import{o as e,r as t}from"./rolldown-runtime-DAXXjFlN.js";import{d as n,f as r,h as i,m as a,r as o,y as s}from"./vendor-react-BGDDiZfJ.js";import{d as c,f as l,m as u,n as d}from"./infrastructure-Bcx6-8du.js";import{H as f,L as p,R as m,Y as h,b as g,l as _}from"./framework-B3O15Lsq.js";import{B as v,Fc as y,Fo as b,G as x,J as S,W as C,_r as w,fr as T,gr as E,hr as D,mr as O,na as k,vr as A,xr as j,yr as M}from"./ui-components-rkvkkTxO.js";import{r as N}from"./vendor-ui-utils-BzQBRdq3.js";import"./MetadataProvider-Cm9vi7AZ.js";import{r as P}from"./ExpressionProvider-ODpzkcN3.js";import{c as ee,i as te,l as ne,r as re,u as ie}from"./RecordDetailView-CzR6BAUv.js";import{n as F,r as I,t as L}from"./MetadataInspector-RvnQ-QOT.js";import{t as R}from"./InterfaceListPage-B_B_Fttt.js";var z=e(s(),1),B=o();function V(e,t){if(/^https?:\/\//i.test(e)||e.startsWith(`mailto:`))return{href:e,external:!e.startsWith(`mailto:`)};let n=(t||``).replace(/\/+$/,``);return{href:`${n}${e}`,external:!!n}}function H({cta:e,apiBase:t,primary:n,onNavigate:r}){let{href:i,external:a}=V(e.url,t);return(0,B.jsx)(j,{asChild:!0,variant:n?`default`:`outline`,size:`sm`,children:(0,B.jsx)(`a`,{href:i,onClick:r,...a?{target:`_blank`,rel:`noopener noreferrer`}:{},"data-testid":`entitlement-cta-${n?`primary`:`secondary`}`,children:e.label})})}function ae({state:e,apiBase:t,onOpenChange:n}){let r=e.spec;return(0,B.jsx)(T,{open:e.open,onOpenChange:e=>{e||n(!1)},children:(0,B.jsxs)(D,{"data-testid":`environment-entitlement-dialog`,children:[(0,B.jsxs)(A,{children:[(0,B.jsx)(M,{children:r?.title}),(0,B.jsx)(E,{children:r?.message})]}),(0,B.jsxs)(w,{children:[(0,B.jsx)(O,{children:`Close`}),r?.secondaryCta&&(0,B.jsx)(H,{cta:r.secondaryCta,apiBase:t,primary:!1,onNavigate:()=>n(!1)}),r?.cta&&(0,B.jsx)(H,{cta:r.cta,apiBase:t,primary:!0,onNavigate:()=>n(!1)})]})]})})}var U=new Set([`DEV_ENV_PLAN_LOCKED`,`DEV_ENV_LIMIT`,`PRODUCTION_ENV_LIMIT`]);function W(e){return typeof e==`string`&&U.has(e)}var G=`/settings/billing`;function oe(e){let t=e?.code;if(!W(t))return null;let n=typeof e?.error==`string`&&e.error?e.error:typeof e?.message==`string`?e.message:``,r=typeof e?.upgrade_url==`string`&&e.upgrade_url?e.upgrade_url:G,i=typeof e?.contact_url==`string`&&e.contact_url?e.contact_url:``;return t===`PRODUCTION_ENV_LIMIT`?{code:t,title:`You already have your production environment`,message:n||`Each organization includes exactly one production environment. Create a separate organization for another, or contact us about an Enterprise arrangement.`,cta:i?{label:`Contact sales`,url:i}:void 0}:{code:t,title:t===`DEV_ENV_PLAN_LOCKED`?`Development environments are a paid feature`:`Development environment limit reached`,message:n||(t===`DEV_ENV_PLAN_LOCKED`?`Your free plan includes one production environment. Upgrade to add development environments — build in dev, then publish to production.`:`Capacity scales with AI seats. Add an AI seat, or archive an unused development environment to free one up.`),cta:{label:`Upgrade plan`,url:r}}}function K(e){return e.hasProductionEnv?e.canCreateDevelopmentEnv===!1?`upgrade_for_development`:`add_development`:`setup_production`}function q(e){return{code:`DEV_ENV_PLAN_LOCKED`,title:`Development environments are a paid feature`,message:`${e.plan&&e.plan!==`free`?`your ${e.plan} plan`:`your free plan`} includes one production environment. Upgrade to add development environments — build in dev, then publish to production.`,cta:{label:`Upgrade plan`,url:e.upgradeUrl||`/settings/billing`}}}var J=/^\s*\{\{\s*page\.([A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*)\s*\}\}\s*$/;function Y(e,t){let n=t;for(let t of e.split(`.`)){if(n==null)return;n=n[t]}return n}function se(e,t){if(!e.includes(`{{`))return e;let n=e.match(J);if(n){let e=Y(n[1],t);return e===void 0?``:e}return e.replace(/\{\{\s*page\.([A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*)\s*\}\}/g,(e,n)=>{let r=Y(n,t);return r==null?``:String(r)})}function X(e,t){if(typeof e==`string`)return se(e,t);if(Array.isArray(e))return e.map(e=>X(e,t));if(e&&typeof e==`object`){let n={};for(let[r,i]of Object.entries(e))n[r]=X(i,t);return n}return e}function Z(e,t){return t?X(e,t):e}var ce={id:`current-user`,name:`Demo User`,isPlatformAdmin:!1};function Q(e){let t=e.locations;return Array.isArray(t)?t.some(e=>e===`list_item`||e===`record_header`||e===`record_more`||e===`record_section`):!1}function $(e){let{dataSource:t,objects:n,objectName:i,onRefresh:a}=e,o=r(),{user:s,activeOrganization:c}=l(),{systemPermissions:f}=d(),{fieldLabel:p,fieldOptionLabel:m,actionParamText:h,actionParamOptionLabel:_,actionDescription:v}=y(),b=(0,z.useMemo)(()=>i?n?.find(e=>e.name===i):void 0,[n,i]),x=i||b?.name,S=(0,z.useCallback)(()=>{a?.()},[a]),C=g({dataSource:t,onUndo:()=>{S(),N.success(`Change undone`)}}),[w,T]=(0,z.useState)({open:!1,message:``}),[E,D]=(0,z.useState)({open:!1,params:[]}),[O,k]=(0,z.useState)({open:!1}),[A,j]=(0,z.useState)(null),[M,P]=(0,z.useState)({open:!1}),F=(0,z.useRef)(new Set),I=(0,z.useCallback)((e,t)=>new Promise(n=>{k({open:!0,spec:e,data:t,resolve:n})}),[]),L=(0,z.useCallback)((e,t)=>new Promise(n=>{T({open:!0,message:e,options:t,resolve:n})}),[]),R=(0,z.useCallback)((e,t)=>new Promise(r=>{let a=t?.params&&!Array.isArray(t.params)?t.params._rowRecord:void 0,o=re(e,{objectName:i||b?.name||``,objects:n||[],fieldLabel:p,fieldOptionLabel:m,row:a}),s=i||b?.name,c=o.map(e=>({...e,label:h(s,t?.name,e.name,`label`,e.label)??e.label,placeholder:h(s,t?.name,e.name,`placeholder`,e.placeholder)??e.placeholder,helpText:h(s,t?.name,e.name,`helpText`,e.helpText)??e.helpText,options:Array.isArray(e.options)?e.options.map(n=>({...n,label:_(s,t?.name,e.name,n.value,n.label)})):e.options}));D({open:!0,params:c,title:t?.label||t?.title,description:v(s,t?.name,t?.description),resolve:r})}),[i,b,n,p,m,h,_]),V=s?{id:s.id,name:s.name,avatar:s.image,isPlatformAdmin:s?.isPlatformAdmin??!1,systemPermissions:f??[]}:{...ce,systemPermissions:f??[]},H=(0,z.useCallback)((e,t)=>{if(t?.type===`error`){N.error(e);return}if(t?.undo){N.success(e,{duration:t.duration,action:{label:t.undo.label||`Undo`,onClick:()=>{C.undo()}}});return}N.success(e,{duration:t?.duration})},[C]),U=(0,z.useCallback)((e,t)=>{t?.external||t?.newTab?window.open(e,`_blank`,`noopener,noreferrer`):o(e)},[o]),W=(0,z.useMemo)(()=>u(),[]),G=(0,z.useCallback)(e=>{P({open:!0,spec:e})},[]),K=(0,z.useCallback)(async(e,n)=>{try{let r=e.target||e.name,i=e.params||{},a=typeof r==`string`?r:``;if(a.startsWith(`/`)||/^https?:\/\//i.test(a)){let t={...i},r=t._rowRecord;delete t._rowRecord;let o=n?.pageVariables??void 0,s=Z(t,o),l=a;r&&/\{[a-z_][a-z0-9_]*\}/i.test(l)&&(l=l.replace(/\{([a-z_][a-z0-9_]*)\}/gi,(e,t)=>{let n=r[t];return n==null?``:encodeURIComponent(String(n))}));let u=l.startsWith(`http`)?l:`${l}`,d=e.bodyShape&&typeof e.bodyShape==`object`&&e.bodyShape.wrap?e.bodyShape.wrap:void 0,f=d?{[d]:s}:{...s};if(r&&e.recordIdParam){let t=r[e.recordIdField||`id`];t!=null&&(f[e.recordIdParam]=t)}/\/api\/v1\/auth\//.test(l)&&!f.organizationId&&c?.id&&(f.organizationId=c.id),e.bodyExtra&&typeof e.bodyExtra==`object`&&Object.assign(f,Z(e.bodyExtra,o));let p=(e.method||`POST`).toUpperCase(),m={method:p,headers:{"Content-Type":`application/json`},credentials:`include`};p!==`GET`&&p!==`DELETE`&&(m.body=JSON.stringify(f));let h=await W(u,m);if(!h.ok){let e=null;try{e=await h.json()}catch{}let t=oe(e);return t?(G(t),{success:!1}):{success:!1,error:e?.error||e?.message||`HTTP ${h.status}`}}let g=await h.json().catch(()=>({}));return e.refreshAfter!==!1&&S(),{success:!0,data:g,reload:e.refreshAfter!==!1}}let o=e.objectName||x,s=i._rowRecord,l={...i};delete l._rowRecord;let u=l.recordId??s?.[e.recordIdField||`id`];delete l.recordId,e.bodyExtra&&typeof e.bodyExtra==`object`&&Object.assign(l,e.bodyExtra),o&&typeof t?.execute==`function`?await t.execute(o,r,l):o&&u&&Object.keys(l).length>0&&typeof t?.update==`function`&&await t.update(o,u,l);let d;if(e.undoable&&o&&u&&s&&Object.keys(l).length>0&&typeof t?.update==`function`){let t={};for(let e of Object.keys(l))t[e]=s[e]??null;d={id:`undo-${o}-${u}-${Date.now()}`,type:`update`,objectName:o,recordId:String(u),timestamp:Date.now(),description:e.label||`Undo ${o}`,undoData:t,redoData:{...l}}}let f=e.refreshAfter!==!1;return f&&S(),{success:!0,reload:f,undo:d}}catch(e){return{success:!1,error:e.message}}},[t,x,W,c,S,G]),q=(0,z.useCallback)(async(e,t)=>{let n=e.target||e.name;if(!n)return{success:!1,error:`No flow target provided for flow action`};try{let r={...e.params||{}},i=r._rowRecord;delete r._rowRecord;let a=r.recordId??i?.id;if(a==null){let n=Array.isArray(t?.selectedRecords)?t.selectedRecords:[];if(n.length===1)a=n[0]?.id;else if(n.length>1)return{success:!1,error:`This flow runs on a single record — select exactly one row.`};else if(Q(e))return{success:!1,error:`This flow runs on a single record — select a row first.`}}a!=null&&r.recordId==null&&(r.recordId=a);let o=await W(`/api/v1/automation/${encodeURIComponent(n)}/trigger`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({recordId:a,objectName:e.objectName||x,params:r})}),s=await o.json().catch(()=>null);if(!o.ok||s&&s.success===!1)return{success:!1,error:s?.error||`Flow "${n}" failed (HTTP ${o.status})`};let c=s?.data??{};if(c.status===`paused`&&c.screen)return j({flowName:n,runId:c.runId,screen:c.screen}),{success:!0,silent:!0};let l=e.refreshAfter!==!1;return l&&S(),{success:!0,data:s?.data,reload:l}}catch(e){return{success:!1,error:e.message}}},[W,x,S]),J=(0,z.useCallback)(async(e,t)=>{let n=e.target||e.name;if(!n)return{success:!1,error:`No action target provided`};let r=e.params&&!Array.isArray(e.params)?{...e.params}:{},i=r._rowRecord;delete r._rowRecord;let a=e.recordIdField||`id`,o=r.recordId??i?.[a];if(o==null){let n=Array.isArray(t?.selectedRecords)?t.selectedRecords:[];if(n.length===1)o=n[0]?.[a];else if(n.length>1)return{success:!1,error:`This action runs on a single record — select exactly one row.`};else if(Q(e))return{success:!1,error:`This action runs on a single record — select a row first.`}}let s=`${n}:${o??``}`;if(F.current.has(s))return{success:!1,error:`Action already in progress`};F.current.add(s);let c=null;if(e.opensInNewTab)try{c=window.open(`about:blank`,`_blank`),c&&(c.document.write(`<!doctype html><meta charset="utf-8"><title>正在打开… Opening…</title><body style="margin:0;font-family:system-ui,sans-serif;display:flex;flex-direction:column;align-items:center;justify-content:center;height:100vh;gap:16px;color:#4b5563"><div style="width:28px;height:28px;border:3px solid #e5e7eb;border-top-color:#6366f1;border-radius:50%;animation:s .8s linear infinite"></div><div>正在为你打开环境…</div><style>@keyframes s{to{transform:rotate(360deg)}}</style></body>`),c.document.close())}catch{c=null}try{let t=typeof e.newTabUrl==`string`?e.newTabUrl:``;if(e.opensInNewTab&&t){if(o==null){if(c)try{c.close()}catch{}return{success:!1,error:`This action runs on a single record — no record id available.`}}let n=`${window.location.origin}${t.replace(`{recordId}`,encodeURIComponent(String(o)))}`;if(c)try{c.location.href=n}catch{try{c.close()}catch{}window.location.href=n}else{let e=null;try{e=window.open(n,`_blank`)}catch{e=null}e||N(`浏览器拦截了弹窗 / Popup blocked`,{description:`点击在新标签页打开环境`,action:{label:`打开环境`,onClick:()=>{try{window.open(n,`_blank`)}catch{window.location.href=n}}},duration:1e4})}return e.refreshAfter===!0&&S(),{success:!0}}let i=e.objectName||x||`global`,a=await W(`/api/v1/actions/${encodeURIComponent(i)}/${encodeURIComponent(n)}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({recordId:o,params:r})}),s=await a.json().catch(()=>null);if(!a.ok||s&&s.success===!1){let e=s?.error||`Action "${n}" failed (HTTP ${a.status})`;if(c)try{c.close()}catch{}return{success:!1,error:e}}let l=e.refreshAfter!==!1;l&&S();let u=s?.data,d=u&&typeof u==`object`&&typeof u.redirectUrl==`string`?u.redirectUrl:null;if(d)if(c)try{c.location.href=d}catch{try{c.close()}catch{}window.location.href=d}else{let e=null;try{e=window.open(d,`_blank`)}catch{e=null}e||N(`浏览器拦截了弹窗 / Popup blocked`,{description:`点击在新标签页打开环境`,action:{label:`打开环境`,onClick:()=>{try{window.open(d,`_blank`)}catch{window.location.href=d}}},duration:1e4})}else if(c)try{c.close()}catch{}return{success:!0,data:u,reload:l}}catch(e){if(c)try{c.close()}catch{}return{success:!1,error:e.message}}finally{F.current.delete(s)}},[W,x,S]);return{confirmHandler:L,toastHandler:H,navigateHandler:U,paramCollectionHandler:R,resultDialogHandler:I,apiHandler:K,flowHandler:q,serverActionHandler:J,authFetch:W,openEntitlementDialog:G,actionProviderProps:(0,z.useMemo)(()=>({context:{...i?{objectName:i}:{},user:V,apiBase:``,activeOrganization:c?{id:c.id,slug:c.slug,name:c.name}:null},onConfirm:L,onToast:H,onNavigate:U,onParamCollection:R,onResultDialog:I,handlers:{api:K,flow:q,script:J,modal:J}}),[i,V,c,L,H,U,R,I,K,q,J]),dialogs:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(ie,{state:w,onOpenChange:e=>{e||T({open:!1,message:``})}}),(0,B.jsx)(ne,{state:E,onOpenChange:e=>{e||D({open:!1,params:[]})}}),(0,B.jsx)(ee,{state:O,onAcknowledge:()=>{O.resolve?.(),k({open:!1})}}),(0,B.jsx)(te,{state:A,authFetch:W,baseUrl:``,dataSource:t,objects:n,onClose:()=>j(null),onComplete:()=>{j(null),S()}}),(0,B.jsx)(ae,{state:M,apiBase:``,onOpenChange:e=>{e||P({open:!1})}})]})}}function le({children:e,...t}){let n=$(t);return(0,B.jsxs)(f,{...n.actionProviderProps,children:[e,n.dialogs]})}var ue=t({PageView:()=>de});function de(){let{t:e}=_(),{pageName:t}=a(),[o]=i(),{showDebug:s}=F(),l=r(),u=n(),d=c(),{pages:f,objects:g,getTypeStatus:y}=m(),{app:w}=P(),T=p(),[E,D]=(0,z.useState)(0),O=I(f,t,w?._packageId);if(!O){let n=y?.(`page`);return n===`idle`||n===`loading`?(0,B.jsx)(`div`,{className:`h-full flex items-center justify-center p-8`,"data-testid":`page-loading`,children:(0,B.jsx)(v,{className:`h-5 w-5 text-muted-foreground`})}):(0,B.jsx)(`div`,{className:`h-full flex items-center justify-center p-8`,children:(0,B.jsxs)(C,{children:[(0,B.jsx)(`div`,{className:`mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted`,children:(0,B.jsx)(b,{className:`h-6 w-6 text-muted-foreground`})}),(0,B.jsx)(S,{children:e(`empty.pageNotFound`)}),(0,B.jsx)(x,{children:e(`empty.pageNotFoundDescription`,{name:t})})]})})}let A=Object.fromEntries(o.entries()),j=u.pathname.match(/\/apps\/([^/]+)/)?.[1],M=d&&!!j&&!!t;return(0,B.jsx)(le,{dataSource:T,objects:g,onRefresh:()=>D(e=>e+1),children:(0,B.jsxs)(`div`,{className:`flex flex-row h-full w-full overflow-hidden relative`,children:[(0,B.jsxs)(`div`,{className:`flex-1 overflow-auto h-full relative`,children:[M&&(0,B.jsx)(`button`,{type:`button`,onClick:()=>{M&&l(`/apps/${j}/metadata/page/${encodeURIComponent(t)}`)},className:`absolute right-3 top-3 z-30 inline-flex h-7 w-7 items-center justify-center rounded-md border border-input bg-background/90 text-muted-foreground shadow-sm backdrop-blur hover:bg-accent hover:text-accent-foreground`,"data-testid":`page-edit-in-studio-button`,title:e(`common.editInStudio`,{defaultValue:`Edit in studio`}),"aria-label":e(`common.editInStudio`,{defaultValue:`Edit in studio`}),children:(0,B.jsx)(k,{className:`h-3.5 w-3.5`})}),O.interfaceConfig?.source?(0,B.jsx)(R,{page:O,reserveEditAffordance:M},E):(0,B.jsx)(h,{schema:{...O,type:O.type||`page`,context:{...O.context,params:A,refreshKey:E}}},E)]}),(0,B.jsx)(L,{open:s,sections:[{title:`Page Configuration`,data:O}]})]})})}export{q as a,K as i,$ as n,G as r,ue as t};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{r as t,y as n}from"./vendor-react-BGDDiZfJ.js";import{L as r}from"./framework-B3O15Lsq.js";import{$n as i,Ei as a,Gn as o,Jn as s,Jo as ee,Ka as te,Kn as c,Un as l,Vi as ne,Wi as re,Wn as u,Yi as ie,_t as d,ar as ae,cs as oe,dn as f,ds as se,er as ce,ft as le,gt as ue,ht as p,mt as m,nr as de,pt as fe,qn as h,rr as pe,sn as g,tr as me,xr as _}from"./ui-components-rkvkkTxO.js";import{r as v}from"./vendor-ui-utils-BzQBRdq3.js";import"./src-BBieSqPB.js";var y=e(n(),1),b=t();function he(e){return e?e.replace(/^\/+/,``).match(/^forms\/([^/?#]+)/i)?.[1]??null:null}function x(e){return e.trim().toLowerCase().replace(/[^a-z0-9-_]+/g,`-`).replace(/^-+|-+$/g,``)}function S(){let e=r()?.getClient?.(),[t,n]=(0,y.useState)([]),[S,ge]=(0,y.useState)([]),[C,w]=(0,y.useState)(!0),[T,E]=(0,y.useState)(null),[_e,D]=(0,y.useState)(!1),[O,k]=(0,y.useState)(``),[A,j]=(0,y.useState)(``),[M,N]=(0,y.useState)(!1),[ve,P]=(0,y.useState)(!1),[F,I]=(0,y.useState)(null),[L,R]=(0,y.useState)(``),[z,B]=(0,y.useState)(`thank-you`),[V,H]=(0,y.useState)(``),[U,W]=(0,y.useState)(``),[G,K]=(0,y.useState)(``),[q,J]=(0,y.useState)(!1),Y=async()=>{if(!e?.meta?.getItems){E(`meta.getItems is not available on this client`),w(!1);return}w(!0),E(null);try{let t=await e.meta.getItems(`view`),r=Array.isArray(t)?t:Array.isArray(t?.items)?t.items:Array.isArray(t?.value)?t.value:[],i=[],a=[];for(let e of r){let t=e?.spec??e;if(!(t?.sections||t?.groups||t?.form||t?.type===`simple`||t?.type===`tabbed`||t?.type===`wizard`||t?.viewType===`form`))continue;let n=t?.sharing,r=n?.publicLink,o=he(r);n?.allowAnonymous&&o&&r?i.push({name:t?.name??e?.name,label:t?.label,object:t?.object,slug:o,publicLink:r,updatedAt:e?.updatedAt??e?.updated_at,spec:t}):a.push({name:t?.name??e?.name,label:t?.label,object:t?.object,spec:t})}n(i),ge(a)}catch(e){E(e?.message??String(e))}finally{w(!1)}};(0,y.useEffect)(()=>{Y()},[]);let ye=typeof window<`u`?window.location.origin:``,X=e=>`${ye}/console/f/${e}`,Z=e=>`<iframe src="${X(e)}" width="100%" height="640" frameborder="0" style="border:0;"></iframe>`,be=e=>`<iframe\n src={\`${X(e)}\`}\n title="Public form"\n style={{ width: '100%', height: 640, border: 0 }}\n/>`,Q=async(e,t)=>{try{await navigator.clipboard.writeText(t),v.success(`Copied ${e}`)}catch{v.error(`Clipboard unavailable`)}},xe=async()=>{if(!O||!A)return;let t=S.find(e=>e.name===O);if(!t)return;let n=x(A);if(!n){v.error(`Invalid slug`);return}let r={...t.spec,sharing:{...t.spec.sharing??{},enabled:!0,allowAnonymous:!0,publicLink:`/forms/${n}`}};N(!0);try{await e.meta.saveItem(`view`,t.name,r),v.success(`Published ${t.name}`),D(!1),k(``),j(``),await Y()}catch(e){v.error(`Publish failed: ${e?.message??e}`)}finally{N(!1)}},Se=e=>{I(e),R(e.slug);let t=e.spec?.submitBehavior,n=t?.kind??`thank-you`;B(n),H(t?.title??``),W(t?.message??``),K(t?.url??``),P(!0)},Ce=async()=>{if(!F)return;let t=x(L);if(!t){v.error(`Invalid slug`);return}let n;switch(z){case`thank-you`:n={kind:`thank-you`},V&&(n.title=V),U&&(n.message=U);break;case`redirect`:if(!G){v.error(`Redirect URL is required`);return}n={kind:`redirect`,url:G};break;case`continue`:case`next-record`:n={kind:z};break}let r={...F.spec,sharing:{...F.spec.sharing??{},enabled:!0,allowAnonymous:!0,publicLink:`/forms/${t}`},submitBehavior:n};J(!0);try{await e.meta.saveItem(`view`,F.name,r),v.success(`Saved ${F.name}`),P(!1),I(null),await Y()}catch(e){v.error(`Save failed: ${e?.message??e}`)}finally{J(!1)}},$=t.length>0;return(0,b.jsxs)(`div`,{className:`flex flex-1 flex-col gap-4 p-4 md:p-6 overflow-auto`,children:[(0,b.jsxs)(i,{children:[(0,b.jsxs)(de,{className:`flex flex-row items-start justify-between gap-4 space-y-0`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(pe,{className:`flex items-center gap-2`,children:[(0,b.jsx)(re,{className:`h-4 w-4`}),`Public Forms`]}),(0,b.jsx)(me,{children:`Forms anyone can fill out — no login required. Publish a form to get a shareable link; submissions land directly in the bound object.`})]}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsxs)(_,{variant:`default`,size:`sm`,onClick:()=>D(!0),disabled:S.length===0,title:S.length===0?`No non-public FormViews available`:`Publish a FormView`,children:[(0,b.jsx)(ie,{className:`h-3.5 w-3.5`}),(0,b.jsx)(`span`,{className:`ml-1.5`,children:`Publish form…`})]}),(0,b.jsxs)(_,{variant:`outline`,size:`sm`,onClick:Y,disabled:C,children:[(0,b.jsx)(ne,{className:`h-3.5 w-3.5 ${C?`animate-spin`:``}`}),(0,b.jsx)(`span`,{className:`ml-1.5`,children:`Refresh`})]})]})]}),(0,b.jsxs)(ce,{children:[T&&(0,b.jsx)(`div`,{className:`mb-3 rounded-md border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive`,children:T}),!C&&!$&&(0,b.jsxs)(`div`,{className:`rounded-md border border-dashed p-6 text-center text-sm text-muted-foreground`,children:[(0,b.jsx)(`p`,{className:`font-medium text-foreground`,children:`No public forms yet`}),(0,b.jsxs)(`p`,{className:`mt-1`,children:[`Click `,(0,b.jsx)(`strong`,{children:`Publish form…`}),` above to share an existing form, or build a new one in Views & Apps and mark it public.`]})]}),$&&(0,b.jsxs)(le,{children:[(0,b.jsx)(ue,{children:(0,b.jsxs)(d,{children:[(0,b.jsx)(p,{children:`Name`}),(0,b.jsx)(p,{children:`Object`}),(0,b.jsx)(p,{children:`Slug`}),(0,b.jsx)(p,{children:`Public URL`}),(0,b.jsx)(p,{className:`text-right`,children:`Actions`})]})}),(0,b.jsx)(fe,{children:t.map(e=>{let t=X(e.slug);return(0,b.jsxs)(d,{children:[(0,b.jsx)(m,{children:(0,b.jsxs)(`div`,{className:`flex flex-col`,children:[(0,b.jsx)(`span`,{className:`font-medium`,children:e.label??e.name}),(0,b.jsx)(`code`,{className:`text-xs text-muted-foreground`,children:e.name})]})}),(0,b.jsx)(m,{children:e.object?(0,b.jsx)(ae,{variant:`secondary`,children:e.object}):(0,b.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,b.jsx)(m,{children:(0,b.jsx)(`code`,{className:`text-xs`,children:e.slug})}),(0,b.jsx)(m,{children:(0,b.jsxs)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 text-xs text-primary underline-offset-2 hover:underline`,children:[t,(0,b.jsx)(ee,{className:`h-3 w-3`})]})}),(0,b.jsx)(m,{className:`text-right`,children:(0,b.jsxs)(`div`,{className:`inline-flex gap-1`,children:[(0,b.jsx)(_,{variant:`ghost`,size:`sm`,title:`Copy URL`,onClick:()=>Q(`URL`,t),children:(0,b.jsx)(te,{className:`h-3.5 w-3.5`})}),(0,b.jsx)(_,{variant:`ghost`,size:`sm`,title:`Copy <iframe> embed`,onClick:()=>Q(`iframe snippet`,Z(e.slug)),children:(0,b.jsx)(se,{className:`h-3.5 w-3.5`})}),(0,b.jsx)(_,{variant:`ghost`,size:`sm`,title:`Copy React snippet`,onClick:()=>Q(`React snippet`,be(e.slug)),children:(0,b.jsx)(oe,{className:`h-3.5 w-3.5`})}),(0,b.jsx)(_,{variant:`ghost`,size:`sm`,title:`Edit sharing & post-submit behavior`,onClick:()=>Se(e),children:(0,b.jsx)(a,{className:`h-3.5 w-3.5`})})]})})]},e.name)})})]})]})]}),(0,b.jsx)(l,{open:_e,onOpenChange:D,children:(0,b.jsxs)(u,{className:`sm:max-w-md`,children:[(0,b.jsxs)(h,{children:[(0,b.jsx)(s,{children:`Publish a FormView`}),(0,b.jsxs)(o,{children:[`Pick an existing FormView and turn it into a public form by enabling `,(0,b.jsx)(`code`,{className:`text-xs`,children:`sharing.allowAnonymous`}),` `,`and setting `,(0,b.jsx)(`code`,{className:`text-xs`,children:`publicLink`}),`.`]})]}),(0,b.jsxs)(`div`,{className:`space-y-3`,children:[(0,b.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,b.jsx)(f,{htmlFor:`publish-view`,children:`FormView`}),(0,b.jsxs)(`select`,{id:`publish-view`,className:`flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm`,value:O,onChange:e=>k(e.target.value),children:[(0,b.jsx)(`option`,{value:``,children:`— Select a FormView —`}),S.map(e=>(0,b.jsxs)(`option`,{value:e.name,children:[e.label??e.name,` (`,e.name,`) `,e.object?`· ${e.object}`:``]},e.name))]})]}),(0,b.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,b.jsx)(f,{htmlFor:`publish-slug`,children:`URL slug`}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`span`,{className:`text-xs text-muted-foreground whitespace-nowrap`,children:`/console/f/`}),(0,b.jsx)(g,{id:`publish-slug`,placeholder:`contact-us`,value:A,onChange:e=>j(e.target.value)})]}),(0,b.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Lowercase letters, digits, dashes and underscores only.`})]})]}),(0,b.jsxs)(c,{children:[(0,b.jsx)(_,{variant:`ghost`,onClick:()=>D(!1),disabled:M,children:`Cancel`}),(0,b.jsx)(_,{onClick:xe,disabled:M||!O||!A,children:M?`Publishing…`:`Publish`})]})]})}),(0,b.jsx)(l,{open:ve,onOpenChange:P,children:(0,b.jsxs)(u,{className:`sm:max-w-lg`,children:[(0,b.jsxs)(h,{children:[(0,b.jsx)(s,{children:F?`Edit ${F.label??F.name}`:`Edit form`}),(0,b.jsx)(o,{children:`Configure the public URL and what happens after submit.`})]}),(0,b.jsxs)(`div`,{className:`space-y-3`,children:[(0,b.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,b.jsx)(f,{htmlFor:`edit-slug`,children:`URL slug`}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`span`,{className:`text-xs text-muted-foreground whitespace-nowrap`,children:`/console/f/`}),(0,b.jsx)(g,{id:`edit-slug`,value:L,onChange:e=>R(e.target.value)})]})]}),(0,b.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,b.jsx)(f,{htmlFor:`edit-behavior`,children:`After submit`}),(0,b.jsxs)(`select`,{id:`edit-behavior`,className:`flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm`,value:z,onChange:e=>B(e.target.value),children:[(0,b.jsx)(`option`,{value:`thank-you`,children:`Show a thank-you panel`}),(0,b.jsx)(`option`,{value:`redirect`,children:`Redirect to a URL`}),(0,b.jsx)(`option`,{value:`continue`,children:`Reset for another response`}),(0,b.jsx)(`option`,{value:`next-record`,children:`Advance to next record (internal queues)`})]})]}),z===`thank-you`&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,b.jsx)(f,{htmlFor:`edit-tytitle`,children:`Title`}),(0,b.jsx)(g,{id:`edit-tytitle`,placeholder:`Thanks!`,value:V,onChange:e=>H(e.target.value)})]}),(0,b.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,b.jsx)(f,{htmlFor:`edit-tymsg`,children:`Message`}),(0,b.jsx)(g,{id:`edit-tymsg`,placeholder:`Your submission has been received.`,value:U,onChange:e=>W(e.target.value)})]})]}),z===`redirect`&&(0,b.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,b.jsx)(f,{htmlFor:`edit-url`,children:`Redirect URL`}),(0,b.jsx)(g,{id:`edit-url`,type:`url`,placeholder:`https://example.com/thanks`,value:G,onChange:e=>K(e.target.value)})]})]}),(0,b.jsxs)(c,{children:[(0,b.jsx)(_,{variant:`ghost`,onClick:()=>P(!1),disabled:q,children:`Cancel`}),(0,b.jsx)(_,{onClick:Ce,disabled:q||!L,children:q?`Saving…`:`Save`})]})]})})]})}export{S as PublicFormsPage};
1
+ import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{r as t,y as n}from"./vendor-react-BGDDiZfJ.js";import{L as r}from"./framework-B3O15Lsq.js";import{$n as i,Ei as a,Gn as o,Jn as s,Jo as ee,Ka as te,Kn as c,Un as l,Vi as ne,Wi as re,Wn as u,Yi as ie,_t as d,ar as ae,cs as oe,dn as f,ds as se,er as ce,ft as le,gt as ue,ht as p,mt as m,nr as de,pt as fe,qn as h,rr as pe,sn as g,tr as me,xr as _}from"./ui-components-rkvkkTxO.js";import{r as v}from"./vendor-ui-utils-BzQBRdq3.js";import"./src--WewDM7z.js";var y=e(n(),1),b=t();function he(e){return e?e.replace(/^\/+/,``).match(/^forms\/([^/?#]+)/i)?.[1]??null:null}function x(e){return e.trim().toLowerCase().replace(/[^a-z0-9-_]+/g,`-`).replace(/^-+|-+$/g,``)}function S(){let e=r()?.getClient?.(),[t,n]=(0,y.useState)([]),[S,ge]=(0,y.useState)([]),[C,w]=(0,y.useState)(!0),[T,E]=(0,y.useState)(null),[_e,D]=(0,y.useState)(!1),[O,k]=(0,y.useState)(``),[A,j]=(0,y.useState)(``),[M,N]=(0,y.useState)(!1),[ve,P]=(0,y.useState)(!1),[F,I]=(0,y.useState)(null),[L,R]=(0,y.useState)(``),[z,B]=(0,y.useState)(`thank-you`),[V,H]=(0,y.useState)(``),[U,W]=(0,y.useState)(``),[G,K]=(0,y.useState)(``),[q,J]=(0,y.useState)(!1),Y=async()=>{if(!e?.meta?.getItems){E(`meta.getItems is not available on this client`),w(!1);return}w(!0),E(null);try{let t=await e.meta.getItems(`view`),r=Array.isArray(t)?t:Array.isArray(t?.items)?t.items:Array.isArray(t?.value)?t.value:[],i=[],a=[];for(let e of r){let t=e?.spec??e;if(!(t?.sections||t?.groups||t?.form||t?.type===`simple`||t?.type===`tabbed`||t?.type===`wizard`||t?.viewType===`form`))continue;let n=t?.sharing,r=n?.publicLink,o=he(r);n?.allowAnonymous&&o&&r?i.push({name:t?.name??e?.name,label:t?.label,object:t?.object,slug:o,publicLink:r,updatedAt:e?.updatedAt??e?.updated_at,spec:t}):a.push({name:t?.name??e?.name,label:t?.label,object:t?.object,spec:t})}n(i),ge(a)}catch(e){E(e?.message??String(e))}finally{w(!1)}};(0,y.useEffect)(()=>{Y()},[]);let ye=typeof window<`u`?window.location.origin:``,X=e=>`${ye}/console/f/${e}`,Z=e=>`<iframe src="${X(e)}" width="100%" height="640" frameborder="0" style="border:0;"></iframe>`,be=e=>`<iframe\n src={\`${X(e)}\`}\n title="Public form"\n style={{ width: '100%', height: 640, border: 0 }}\n/>`,Q=async(e,t)=>{try{await navigator.clipboard.writeText(t),v.success(`Copied ${e}`)}catch{v.error(`Clipboard unavailable`)}},xe=async()=>{if(!O||!A)return;let t=S.find(e=>e.name===O);if(!t)return;let n=x(A);if(!n){v.error(`Invalid slug`);return}let r={...t.spec,sharing:{...t.spec.sharing??{},enabled:!0,allowAnonymous:!0,publicLink:`/forms/${n}`}};N(!0);try{await e.meta.saveItem(`view`,t.name,r),v.success(`Published ${t.name}`),D(!1),k(``),j(``),await Y()}catch(e){v.error(`Publish failed: ${e?.message??e}`)}finally{N(!1)}},Se=e=>{I(e),R(e.slug);let t=e.spec?.submitBehavior,n=t?.kind??`thank-you`;B(n),H(t?.title??``),W(t?.message??``),K(t?.url??``),P(!0)},Ce=async()=>{if(!F)return;let t=x(L);if(!t){v.error(`Invalid slug`);return}let n;switch(z){case`thank-you`:n={kind:`thank-you`},V&&(n.title=V),U&&(n.message=U);break;case`redirect`:if(!G){v.error(`Redirect URL is required`);return}n={kind:`redirect`,url:G};break;case`continue`:case`next-record`:n={kind:z};break}let r={...F.spec,sharing:{...F.spec.sharing??{},enabled:!0,allowAnonymous:!0,publicLink:`/forms/${t}`},submitBehavior:n};J(!0);try{await e.meta.saveItem(`view`,F.name,r),v.success(`Saved ${F.name}`),P(!1),I(null),await Y()}catch(e){v.error(`Save failed: ${e?.message??e}`)}finally{J(!1)}},$=t.length>0;return(0,b.jsxs)(`div`,{className:`flex flex-1 flex-col gap-4 p-4 md:p-6 overflow-auto`,children:[(0,b.jsxs)(i,{children:[(0,b.jsxs)(de,{className:`flex flex-row items-start justify-between gap-4 space-y-0`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(pe,{className:`flex items-center gap-2`,children:[(0,b.jsx)(re,{className:`h-4 w-4`}),`Public Forms`]}),(0,b.jsx)(me,{children:`Forms anyone can fill out — no login required. Publish a form to get a shareable link; submissions land directly in the bound object.`})]}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsxs)(_,{variant:`default`,size:`sm`,onClick:()=>D(!0),disabled:S.length===0,title:S.length===0?`No non-public FormViews available`:`Publish a FormView`,children:[(0,b.jsx)(ie,{className:`h-3.5 w-3.5`}),(0,b.jsx)(`span`,{className:`ml-1.5`,children:`Publish form…`})]}),(0,b.jsxs)(_,{variant:`outline`,size:`sm`,onClick:Y,disabled:C,children:[(0,b.jsx)(ne,{className:`h-3.5 w-3.5 ${C?`animate-spin`:``}`}),(0,b.jsx)(`span`,{className:`ml-1.5`,children:`Refresh`})]})]})]}),(0,b.jsxs)(ce,{children:[T&&(0,b.jsx)(`div`,{className:`mb-3 rounded-md border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive`,children:T}),!C&&!$&&(0,b.jsxs)(`div`,{className:`rounded-md border border-dashed p-6 text-center text-sm text-muted-foreground`,children:[(0,b.jsx)(`p`,{className:`font-medium text-foreground`,children:`No public forms yet`}),(0,b.jsxs)(`p`,{className:`mt-1`,children:[`Click `,(0,b.jsx)(`strong`,{children:`Publish form…`}),` above to share an existing form, or build a new one in Views & Apps and mark it public.`]})]}),$&&(0,b.jsxs)(le,{children:[(0,b.jsx)(ue,{children:(0,b.jsxs)(d,{children:[(0,b.jsx)(p,{children:`Name`}),(0,b.jsx)(p,{children:`Object`}),(0,b.jsx)(p,{children:`Slug`}),(0,b.jsx)(p,{children:`Public URL`}),(0,b.jsx)(p,{className:`text-right`,children:`Actions`})]})}),(0,b.jsx)(fe,{children:t.map(e=>{let t=X(e.slug);return(0,b.jsxs)(d,{children:[(0,b.jsx)(m,{children:(0,b.jsxs)(`div`,{className:`flex flex-col`,children:[(0,b.jsx)(`span`,{className:`font-medium`,children:e.label??e.name}),(0,b.jsx)(`code`,{className:`text-xs text-muted-foreground`,children:e.name})]})}),(0,b.jsx)(m,{children:e.object?(0,b.jsx)(ae,{variant:`secondary`,children:e.object}):(0,b.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,b.jsx)(m,{children:(0,b.jsx)(`code`,{className:`text-xs`,children:e.slug})}),(0,b.jsx)(m,{children:(0,b.jsxs)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 text-xs text-primary underline-offset-2 hover:underline`,children:[t,(0,b.jsx)(ee,{className:`h-3 w-3`})]})}),(0,b.jsx)(m,{className:`text-right`,children:(0,b.jsxs)(`div`,{className:`inline-flex gap-1`,children:[(0,b.jsx)(_,{variant:`ghost`,size:`sm`,title:`Copy URL`,onClick:()=>Q(`URL`,t),children:(0,b.jsx)(te,{className:`h-3.5 w-3.5`})}),(0,b.jsx)(_,{variant:`ghost`,size:`sm`,title:`Copy <iframe> embed`,onClick:()=>Q(`iframe snippet`,Z(e.slug)),children:(0,b.jsx)(se,{className:`h-3.5 w-3.5`})}),(0,b.jsx)(_,{variant:`ghost`,size:`sm`,title:`Copy React snippet`,onClick:()=>Q(`React snippet`,be(e.slug)),children:(0,b.jsx)(oe,{className:`h-3.5 w-3.5`})}),(0,b.jsx)(_,{variant:`ghost`,size:`sm`,title:`Edit sharing & post-submit behavior`,onClick:()=>Se(e),children:(0,b.jsx)(a,{className:`h-3.5 w-3.5`})})]})})]},e.name)})})]})]})]}),(0,b.jsx)(l,{open:_e,onOpenChange:D,children:(0,b.jsxs)(u,{className:`sm:max-w-md`,children:[(0,b.jsxs)(h,{children:[(0,b.jsx)(s,{children:`Publish a FormView`}),(0,b.jsxs)(o,{children:[`Pick an existing FormView and turn it into a public form by enabling `,(0,b.jsx)(`code`,{className:`text-xs`,children:`sharing.allowAnonymous`}),` `,`and setting `,(0,b.jsx)(`code`,{className:`text-xs`,children:`publicLink`}),`.`]})]}),(0,b.jsxs)(`div`,{className:`space-y-3`,children:[(0,b.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,b.jsx)(f,{htmlFor:`publish-view`,children:`FormView`}),(0,b.jsxs)(`select`,{id:`publish-view`,className:`flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm`,value:O,onChange:e=>k(e.target.value),children:[(0,b.jsx)(`option`,{value:``,children:`— Select a FormView —`}),S.map(e=>(0,b.jsxs)(`option`,{value:e.name,children:[e.label??e.name,` (`,e.name,`) `,e.object?`· ${e.object}`:``]},e.name))]})]}),(0,b.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,b.jsx)(f,{htmlFor:`publish-slug`,children:`URL slug`}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`span`,{className:`text-xs text-muted-foreground whitespace-nowrap`,children:`/console/f/`}),(0,b.jsx)(g,{id:`publish-slug`,placeholder:`contact-us`,value:A,onChange:e=>j(e.target.value)})]}),(0,b.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Lowercase letters, digits, dashes and underscores only.`})]})]}),(0,b.jsxs)(c,{children:[(0,b.jsx)(_,{variant:`ghost`,onClick:()=>D(!1),disabled:M,children:`Cancel`}),(0,b.jsx)(_,{onClick:xe,disabled:M||!O||!A,children:M?`Publishing…`:`Publish`})]})]})}),(0,b.jsx)(l,{open:ve,onOpenChange:P,children:(0,b.jsxs)(u,{className:`sm:max-w-lg`,children:[(0,b.jsxs)(h,{children:[(0,b.jsx)(s,{children:F?`Edit ${F.label??F.name}`:`Edit form`}),(0,b.jsx)(o,{children:`Configure the public URL and what happens after submit.`})]}),(0,b.jsxs)(`div`,{className:`space-y-3`,children:[(0,b.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,b.jsx)(f,{htmlFor:`edit-slug`,children:`URL slug`}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`span`,{className:`text-xs text-muted-foreground whitespace-nowrap`,children:`/console/f/`}),(0,b.jsx)(g,{id:`edit-slug`,value:L,onChange:e=>R(e.target.value)})]})]}),(0,b.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,b.jsx)(f,{htmlFor:`edit-behavior`,children:`After submit`}),(0,b.jsxs)(`select`,{id:`edit-behavior`,className:`flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm`,value:z,onChange:e=>B(e.target.value),children:[(0,b.jsx)(`option`,{value:`thank-you`,children:`Show a thank-you panel`}),(0,b.jsx)(`option`,{value:`redirect`,children:`Redirect to a URL`}),(0,b.jsx)(`option`,{value:`continue`,children:`Reset for another response`}),(0,b.jsx)(`option`,{value:`next-record`,children:`Advance to next record (internal queues)`})]})]}),z===`thank-you`&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,b.jsx)(f,{htmlFor:`edit-tytitle`,children:`Title`}),(0,b.jsx)(g,{id:`edit-tytitle`,placeholder:`Thanks!`,value:V,onChange:e=>H(e.target.value)})]}),(0,b.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,b.jsx)(f,{htmlFor:`edit-tymsg`,children:`Message`}),(0,b.jsx)(g,{id:`edit-tymsg`,placeholder:`Your submission has been received.`,value:U,onChange:e=>W(e.target.value)})]})]}),z===`redirect`&&(0,b.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,b.jsx)(f,{htmlFor:`edit-url`,children:`Redirect URL`}),(0,b.jsx)(g,{id:`edit-url`,type:`url`,placeholder:`https://example.com/thanks`,value:G,onChange:e=>K(e.target.value)})]})]}),(0,b.jsxs)(c,{children:[(0,b.jsx)(_,{variant:`ghost`,onClick:()=>P(!1),disabled:q,children:`Cancel`}),(0,b.jsx)(_,{onClick:Ce,disabled:q||!L,children:q?`Saving…`:`Save`})]})]})})]})}export{S as PublicFormsPage};
@@ -1 +1 @@
1
- import{o as e,r as t}from"./rolldown-runtime-DAXXjFlN.js";import{a as n,f as r,h as i,m as a,r as o,y as s}from"./vendor-react-BGDDiZfJ.js";import{f as c}from"./infrastructure-Bcx6-8du.js";import{L as l,R as u,Vt as d,l as f}from"./framework-B3O15Lsq.js";import{Cc as p,Fc as m,G as h,J as g,W as _,ns as v,xr as y}from"./ui-components-rkvkkTxO.js";import{r as b}from"./vendor-ui-utils-BzQBRdq3.js";import"./AdapterProvider-qwVfmAEk.js";import{t as x}from"./plugin-form-FeZEoC2R.js";import"./MetadataProvider-DKJsxrNu.js";import{n as S,t as C}from"./ExpressionProvider-ODpzkcN3.js";import{t as w}from"./ManagedByBadge-BGSB7vGi.js";import{t as T}from"./skeletons-CzC0fiXD.js";var E=t({RecordFormPage:()=>k}),D=e(s(),1),O=o();function k({mode:e}){let{appName:t,objectName:o,recordId:s}=a(),E=r(),[k]=i(),A=l(),{objects:j,loading:M}=u(),{t:N}=f(),{objectLabel:P}=m(),{user:F,getAuthConfig:I}=c(),[L,R]=(0,D.useState)({});(0,D.useEffect)(()=>{let e=!1;return I().then(t=>{e||R(t?.features??{})}).catch(()=>{}),()=>{e=!0}},[I]);let z=(0,D.useMemo)(()=>{if(e!==`create`)return;let t=[];for(let[e,n]of k.entries())e&&n&&t.push([e,n]);return t.length>0?Object.fromEntries(t):void 0},[e,k.toString()]),B=(0,D.useMemo)(()=>j.find(e=>e.name===o),[j,o]),V=`/apps/${t}`,H=`${V}/${o}`,U=e===`edit`&&s?`${V}/${o}/record/${encodeURIComponent(s)}`:H,W=(0,D.useCallback)(()=>{typeof window<`u`&&window.history.length>1?E(-1):E(U,{replace:!0})},[E,U]),G=B?P(B):o??``,K=e===`create`?N(`form.createTitle`,{object:G,defaultValue:`New ${G}`}):N(`form.editTitle`,{object:G,defaultValue:`Edit ${G}`}),q=(0,D.useCallback)(()=>{b.success(e===`create`?N(`form.createSuccess`,{object:G,defaultValue:`${G} created successfully`}):N(`form.updateSuccess`,{object:G,defaultValue:`${G} updated successfully`})),W()},[e,N,G,W]),J=(0,D.useCallback)(()=>{W()},[W]),Y=(0,D.useMemo)(()=>F?{name:F.name,email:F.email,role:F.role??`user`}:{name:`Anonymous`,email:``,role:`guest`},[F]),X=(0,D.useMemo)(()=>new d({user:Y,app:{name:t},data:{}}),[Y,t]),Z=(0,D.useMemo)(()=>B?.fields?Array.isArray(B.fields)?B.fields.filter(e=>typeof e==`string`?!0:S(e.visible,X)).map(e=>typeof e==`string`?e:e.name):Object.entries(B.fields).filter(([,e])=>S(e.visible,X)).map(([e])=>e):[],[B,X]);if(M)return(0,O.jsx)(T,{});if(!B)return(0,O.jsx)(`div`,{className:`flex h-full items-center justify-center p-4`,children:(0,O.jsxs)(_,{children:[(0,O.jsx)(`div`,{className:`mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted`,children:(0,O.jsx)(v,{className:`h-6 w-6 text-muted-foreground`})}),(0,O.jsx)(g,{children:N(`empty.objectNotFound`)}),(0,O.jsx)(h,{children:N(`empty.objectNotFoundDescription`,{name:o})}),(0,O.jsx)(`div`,{className:`mt-4`,children:(0,O.jsxs)(y,{variant:`outline`,onClick:()=>E(V),children:[(0,O.jsx)(p,{className:`mr-2 h-4 w-4`}),N(`empty.back`)]})})]})});let Q=B.form??B.formViews?.default??{},$=[`tabbed`,`wizard`,`split`].includes(Q.type)?Q.type:`simple`,ee=Array.isArray(Q.sections)&&Q.sections.length>0?{sections:Q.sections,defaultTab:Q.defaultTab,tabPosition:Q.tabPosition,allowSkip:Q.allowSkip,showStepIndicator:Q.showStepIndicator,splitDirection:Q.splitDirection,splitSize:Q.splitSize,splitResizable:Q.splitResizable}:{};return(0,O.jsx)(C,{user:Y,app:{name:t},data:{},features:L,children:(0,O.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden bg-background`,"data-testid":`record-form-page`,"data-mode":e,children:[(0,O.jsxs)(`header`,{className:`sticky top-0 z-10 flex items-center gap-3 border-b bg-background px-4 py-3 sm:px-6`,children:[(0,O.jsx)(y,{variant:`ghost`,size:`sm`,onClick:W,"data-testid":`record-form-page-back`,"aria-label":N(`common.back`,{defaultValue:`Back`}),children:(0,O.jsx)(p,{className:`h-4 w-4`})}),(0,O.jsxs)(`nav`,{"aria-label":`Breadcrumb`,className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,O.jsx)(n,{to:H,className:`hover:text-foreground transition-colors`,children:G}),(0,O.jsx)(`span`,{"aria-hidden":`true`,children:`/`}),(0,O.jsx)(`span`,{className:`text-foreground font-medium`,"data-testid":`record-form-page-title`,children:K}),(0,O.jsx)(w,{managedBy:B?.managedBy,className:`ml-1`})]})]}),(0,O.jsx)(`div`,{className:`flex-1 overflow-auto p-4 sm:p-6`,children:(0,O.jsx)(`div`,{className:`mx-auto max-w-4xl`,children:(0,O.jsx)(x,{schema:{type:`object-form`,formType:$,...ee,objectName:B.name,mode:e,recordId:e===`edit`?s:void 0,...z&&{initialValues:z},title:K,description:e===`create`?N(`form.createDescription`,{object:G,defaultValue:`Create a new ${G}.`}):N(`form.editDescription`,{object:G,defaultValue:`Edit this ${G}.`}),layout:`vertical`,fields:Z,subforms:B.form?.subforms??B.formViews?.default?.subforms,onSuccess:q,onCancel:J,showSubmit:!0,showCancel:!0,submitText:N(`form.saveRecord`,{defaultValue:`Save`}),cancelText:N(`common.cancel`,{defaultValue:`Cancel`})},dataSource:A??void 0},`${e}:${o}:${s??`new`}`)})})]})})}export{E as t};
1
+ import{o as e,r as t}from"./rolldown-runtime-DAXXjFlN.js";import{a as n,f as r,h as i,m as a,r as o,y as s}from"./vendor-react-BGDDiZfJ.js";import{f as c}from"./infrastructure-Bcx6-8du.js";import{L as l,R as u,Vt as d,l as f}from"./framework-B3O15Lsq.js";import{Cc as p,Fc as m,G as h,J as g,W as _,ns as v,xr as y}from"./ui-components-rkvkkTxO.js";import{r as b}from"./vendor-ui-utils-BzQBRdq3.js";import"./AdapterProvider-BmqhWHIU.js";import{t as x}from"./plugin-form-FeZEoC2R.js";import"./MetadataProvider-Cm9vi7AZ.js";import{n as S,t as C}from"./ExpressionProvider-ODpzkcN3.js";import{t as w}from"./ManagedByBadge-BGSB7vGi.js";import{t as T}from"./skeletons-CzC0fiXD.js";var E=t({RecordFormPage:()=>k}),D=e(s(),1),O=o();function k({mode:e}){let{appName:t,objectName:o,recordId:s}=a(),E=r(),[k]=i(),A=l(),{objects:j,loading:M}=u(),{t:N}=f(),{objectLabel:P}=m(),{user:F,getAuthConfig:I}=c(),[L,R]=(0,D.useState)({});(0,D.useEffect)(()=>{let e=!1;return I().then(t=>{e||R(t?.features??{})}).catch(()=>{}),()=>{e=!0}},[I]);let z=(0,D.useMemo)(()=>{if(e!==`create`)return;let t=[];for(let[e,n]of k.entries())e&&n&&t.push([e,n]);return t.length>0?Object.fromEntries(t):void 0},[e,k.toString()]),B=(0,D.useMemo)(()=>j.find(e=>e.name===o),[j,o]),V=`/apps/${t}`,H=`${V}/${o}`,U=e===`edit`&&s?`${V}/${o}/record/${encodeURIComponent(s)}`:H,W=(0,D.useCallback)(()=>{typeof window<`u`&&window.history.length>1?E(-1):E(U,{replace:!0})},[E,U]),G=B?P(B):o??``,K=e===`create`?N(`form.createTitle`,{object:G,defaultValue:`New ${G}`}):N(`form.editTitle`,{object:G,defaultValue:`Edit ${G}`}),q=(0,D.useCallback)(()=>{b.success(e===`create`?N(`form.createSuccess`,{object:G,defaultValue:`${G} created successfully`}):N(`form.updateSuccess`,{object:G,defaultValue:`${G} updated successfully`})),W()},[e,N,G,W]),J=(0,D.useCallback)(()=>{W()},[W]),Y=(0,D.useMemo)(()=>F?{name:F.name,email:F.email,role:F.role??`user`}:{name:`Anonymous`,email:``,role:`guest`},[F]),X=(0,D.useMemo)(()=>new d({user:Y,app:{name:t},data:{}}),[Y,t]),Z=(0,D.useMemo)(()=>B?.fields?Array.isArray(B.fields)?B.fields.filter(e=>typeof e==`string`?!0:S(e.visible,X)).map(e=>typeof e==`string`?e:e.name):Object.entries(B.fields).filter(([,e])=>S(e.visible,X)).map(([e])=>e):[],[B,X]);if(M)return(0,O.jsx)(T,{});if(!B)return(0,O.jsx)(`div`,{className:`flex h-full items-center justify-center p-4`,children:(0,O.jsxs)(_,{children:[(0,O.jsx)(`div`,{className:`mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted`,children:(0,O.jsx)(v,{className:`h-6 w-6 text-muted-foreground`})}),(0,O.jsx)(g,{children:N(`empty.objectNotFound`)}),(0,O.jsx)(h,{children:N(`empty.objectNotFoundDescription`,{name:o})}),(0,O.jsx)(`div`,{className:`mt-4`,children:(0,O.jsxs)(y,{variant:`outline`,onClick:()=>E(V),children:[(0,O.jsx)(p,{className:`mr-2 h-4 w-4`}),N(`empty.back`)]})})]})});let Q=B.form??B.formViews?.default??{},$=[`tabbed`,`wizard`,`split`].includes(Q.type)?Q.type:`simple`,ee=Array.isArray(Q.sections)&&Q.sections.length>0?{sections:Q.sections,defaultTab:Q.defaultTab,tabPosition:Q.tabPosition,allowSkip:Q.allowSkip,showStepIndicator:Q.showStepIndicator,splitDirection:Q.splitDirection,splitSize:Q.splitSize,splitResizable:Q.splitResizable}:{};return(0,O.jsx)(C,{user:Y,app:{name:t},data:{},features:L,children:(0,O.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden bg-background`,"data-testid":`record-form-page`,"data-mode":e,children:[(0,O.jsxs)(`header`,{className:`sticky top-0 z-10 flex items-center gap-3 border-b bg-background px-4 py-3 sm:px-6`,children:[(0,O.jsx)(y,{variant:`ghost`,size:`sm`,onClick:W,"data-testid":`record-form-page-back`,"aria-label":N(`common.back`,{defaultValue:`Back`}),children:(0,O.jsx)(p,{className:`h-4 w-4`})}),(0,O.jsxs)(`nav`,{"aria-label":`Breadcrumb`,className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,O.jsx)(n,{to:H,className:`hover:text-foreground transition-colors`,children:G}),(0,O.jsx)(`span`,{"aria-hidden":`true`,children:`/`}),(0,O.jsx)(`span`,{className:`text-foreground font-medium`,"data-testid":`record-form-page-title`,children:K}),(0,O.jsx)(w,{managedBy:B?.managedBy,className:`ml-1`})]})]}),(0,O.jsx)(`div`,{className:`flex-1 overflow-auto p-4 sm:p-6`,children:(0,O.jsx)(`div`,{className:`mx-auto max-w-4xl`,children:(0,O.jsx)(x,{schema:{type:`object-form`,formType:$,...ee,objectName:B.name,mode:e,recordId:e===`edit`?s:void 0,...z&&{initialValues:z},title:K,description:e===`create`?N(`form.createDescription`,{object:G,defaultValue:`Create a new ${G}.`}):N(`form.editDescription`,{object:G,defaultValue:`Edit this ${G}.`}),layout:`vertical`,fields:Z,subforms:B.form?.subforms??B.formViews?.default?.subforms,onSuccess:q,onCancel:J,showSubmit:!0,showCancel:!0,submitText:N(`form.saveRecord`,{defaultValue:`Save`}),cancelText:N(`common.cancel`,{defaultValue:`Cancel`})},dataSource:A??void 0},`${e}:${o}:${s??`new`}`)})})]})})}export{E as t};
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ui-components-BL3SEdAz.css"])))=>i.map(i=>d[i]);
2
- import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{g as t,r as n,y as r}from"./vendor-react-BGDDiZfJ.js";import{l as i}from"./framework-B3O15Lsq.js";import{U as a,b as o,g as s}from"./vendor-objectstack-Bw0HRuFa.js";import{$s as c,Ar as l,As as u,Bs as d,Cs as f,Ei as p,Fo as m,Gi as h,Ha as g,Hs as _,Is as v,Jn as y,Jt as b,Ka as x,Ko as S,Kt as C,Na as w,Oi as T,Or as E,Pa as ee,Pr as D,Q as O,Qr as k,Ra as A,Ua as j,Un as M,Ur as te,Wa as ne,Wn as re,Wo as ie,Xn as ae,Xt as N,Yi as P,Yn as oe,Yr as se,Yt as F,Zn as ce,Zs as le,_i as ue,an as de,ar as fe,ci as pe,ct as me,dn as I,ds as he,dt as ge,ea as _e,ec as ve,es as ye,fo as be,fs as xe,gc as Se,go as Ce,gs as we,hc as Te,hi as Ee,ia as De,in as Oe,it as ke,kc as Ae,lt as je,ma as Me,nt as Ne,oc as Pe,on as Fe,ot as Ie,pi as Le,qn as Re,qo as ze,qr as L,qt as R,ra as Be,sn as z,so as Ve,st as He,ta as Ue,ti as We,ut as Ge,va as Ke,vc as qe,vo as Je,vt as Ye,wc as Xe,xr as B,ya as Ze,yi as Qe,zi as $e,zs as et}from"./ui-components-rkvkkTxO.js";import{r as tt}from"./useMetadata-Ily0JuNR.js";var V=e(r(),1),H=n();function nt(e){return Array.isArray(e)?{shape:`array`,entries:e.map((e,t)=>{let{name:n,...r}=e??{};return{name:typeof n==`string`&&n?n:`field_${t+1}`,def:r}})}:e&&typeof e==`object`?{shape:`record`,entries:Object.entries(e).map(([e,t])=>({name:e,def:{...t??{}}}))}:{shape:`record`,entries:[]}}function rt(e){if(e.shape===`array`)return e.entries.map(e=>({name:e.name,...e.def}));let t={};for(let n of e.entries)t[n.name]=n.def;return t}function it(e,t){return e.entries.findIndex(e=>e.name===t)}function at(e,t,n){let r={type:t,label:n??ot(e)};return(t===`select`||t===`multiselect`||t===`radio`||t===`checkboxes`)&&(r.options=[]),{name:e,def:r}}function ot(e){return e?e.split(`_`).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `):``}function st(e){let t=e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`_`).replace(/^_+|_+$/g,``).replace(/_{2,}/g,`_`);return t?/^[a-z_]/.test(t)?t:`f_${t}`:`field`}function ct(e){let t=e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`_`).replace(/^_+/g,``).replace(/_{2,}/g,`_`);return t?/^[a-z_]/.test(t)?t:`f_${t}`:``}function lt(e){return Array.isArray(e)?e.filter(e=>!!e&&typeof e==`object`).map(e=>({key:typeof e.key==`string`?e.key:``,label:typeof e.label==`string`?e.label:``})).filter(e=>e.key):[]}function ut(e,t){let n=/[a-z0-9]/i.test(e)?st(e):`group`;if(!t.includes(n))return n;let r=2;for(;t.includes(`${n}_${r}`);)r+=1;return`${n}_${r}`}function dt(e,t){let n=t.trim()||`New section`,r=ut(n,e.map(e=>e.key));return[...e,{key:r,label:n}]}function ft(e,t,n){let r=n.trim();return r?e.map(e=>e.key===t?{...e,label:r}:e):e}function pt(e,t){return e.filter(e=>e.key!==t)}function mt(e,t,n){let r=e.findIndex(e=>e.key===t);if(r<0)return e;let i=r+n;return i<0||i>=e.length?e:gt(e,r,i)}function ht(e,t){return{shape:e.shape,entries:e.entries.map(e=>e.def.group===t?{name:e.name,def:{...e.def,group:void 0}}:e)}}function gt(e,t,n){let r=e.slice(),[i]=r.splice(t,1);return r.splice(n,0,i),r}function _t(e,t,n){let r=Array.isArray(t)?t.filter(e=>typeof e?.key==`string`):[],i=new Map;for(let e of r)i.set(e.key,{key:e.key,label:String(e.label??e.key),entries:[]});let a=new Set(r.map(e=>e.key));for(let t of e.entries){let e=typeof t.def.group==`string`?t.def.group:null;e&&a.has(e)?i.get(e).entries.push(t):(i.has(null)||i.set(null,{key:null,label:`Ungrouped`,entries:[]}),i.get(null).entries.push(t))}let o=!!n?.includeEmptyDeclared;return Array.from(i.values()).filter(e=>e.entries.length>0||o&&e.key!==null)}function vt(e,t){return e===t?!0:JSON.stringify(e??null)===JSON.stringify(t??null)}function yt(e,t){let n=new Set([...Object.keys(e),...Object.keys(t)]),r=[];for(let i of n)vt(e[i],t[i])||r.push(i);return r.sort()}function bt(e,t){let n=nt(e),r=nt(t),i=new Map(n.entries.map(e=>[e.name,e])),a=new Set(r.entries.map(e=>e.name)),o={},s=0,c=0;for(let e of r.entries){let t=i.get(e.name);if(!t){o[e.name]={name:e.name,status:`added`,changedKeys:[]},s+=1;continue}let n=yt(t.def,e.def);n.length?(o[e.name]={name:e.name,status:`changed`,changedKeys:n},c+=1):o[e.name]={name:e.name,status:`unchanged`,changedKeys:[]}}let l=n.entries.filter(e=>!a.has(e.name));return{byName:o,removed:l,counts:{added:s,changed:c,removed:l.length}}}function xt({kindLabel:e,title:t,onClose:n,closeLabel:r=`Close`,children:i,footer:a,headerActions:o,hideClose:s}){return(0,H.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-2 border-b px-4 py-2.5`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(fe,{variant:`secondary`,className:`text-[10px] uppercase tracking-wider`,children:e}),(0,H.jsx)(`div`,{className:`mt-1 truncate text-sm font-medium`,title:t,children:t})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[o,!s&&(0,H.jsx)(B,{variant:`ghost`,size:`sm`,onClick:n,"aria-label":r,className:`h-7 w-7 p-0`,children:(0,H.jsx)(E,{className:`h-4 w-4`})})]})]}),(0,H.jsx)(`div`,{className:`flex-1 overflow-auto px-4 py-3 space-y-3`,children:i}),a&&(0,H.jsx)(`div`,{className:`border-t px-4 py-2.5`,children:a})]})}function St({index:e,total:t,onMove:n,upLabel:r=`Move up`,downLabel:i=`Move down`,disabled:a}){if(t<=1||e<0)return null;let o=!a&&e>0,s=!a&&e<t-1;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(B,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0`,onClick:()=>o&&n(e-1),disabled:!o,"aria-label":r,title:r,children:(0,H.jsx)(qe,{className:`h-4 w-4`})}),(0,H.jsx)(B,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0`,onClick:()=>s&&n(e+1),disabled:!s,"aria-label":i,title:i,children:(0,H.jsx)(Xe,{className:`h-4 w-4`})})]})}function U({label:e,value:t,onCommit:n,onBlur:r,placeholder:i,disabled:a,mono:o,testId:s}){return(0,H.jsxs)(`div`,{className:`space-y-1`,children:[(0,H.jsx)(I,{className:`text-xs text-muted-foreground`,children:e}),(0,H.jsx)(z,{value:t,onChange:e=>n(e.target.value),onBlur:e=>r?.(e.target.value),placeholder:i,disabled:a,"data-testid":s,className:Ae(`h-8 text-sm`,o&&`font-mono`)})]})}function Ct({label:e,value:t,onCommit:n,placeholder:r,disabled:i}){return(0,H.jsxs)(`div`,{className:`space-y-1`,children:[(0,H.jsx)(I,{className:`text-xs text-muted-foreground`,children:e}),(0,H.jsx)(z,{type:`number`,value:t??``,onChange:e=>{let t=e.target.value;n(t===``?void 0:Number(t))},placeholder:r,disabled:i,className:`h-8 text-sm`})]})}function W({label:e,value:t,options:n,onCommit:r,placeholder:i=`—`,disabled:a}){let o=e=>e===``?wt:e,s=e=>e===wt?``:e;return(0,H.jsxs)(`div`,{className:`space-y-1`,children:[(0,H.jsx)(I,{className:`text-xs text-muted-foreground`,children:e}),(0,H.jsxs)(C,{value:o(t??``),onValueChange:e=>r(s(e)),disabled:a,children:[(0,H.jsx)(F,{className:`h-8 text-sm`,children:(0,H.jsx)(N,{placeholder:i})}),(0,H.jsx)(R,{children:n.map(e=>(0,H.jsx)(b,{value:o(e.value),children:e.label},e.value))})]})]})}var wt=`__inspector_select_none__`;function Tt({label:e,value:t,onCommit:n,disabled:r}){return(0,H.jsxs)(`label`,{className:`flex items-center gap-2 text-xs cursor-pointer select-none`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:t,disabled:r,onChange:e=>n(e.target.checked),className:`h-3.5 w-3.5`}),(0,H.jsx)(`span`,{children:e})]})}function Et({label:e,onClick:t,disabled:n}){return(0,H.jsxs)(B,{variant:`outline`,size:`sm`,onClick:t,disabled:n,className:`w-full gap-1.5 text-muted-foreground hover:border-destructive/40 hover:bg-destructive/5 hover:text-destructive`,children:[(0,H.jsx)(L,{className:`h-3.5 w-3.5`}),e]})}function Dt({message:e}){return(0,H.jsx)(`div`,{className:`text-xs italic text-muted-foreground p-4 text-center`,children:e})}function Ot(e,t,n){let r=Array.isArray(e)?[...e]:[];return n===null?r.splice(t,1):r[t]=n,r}function kt(e,t){let n=Array.isArray(e)?[...e]:[];return n.push(t),n}function At(e,t,n){let r=Array.isArray(e)?[...e]:[];if(t<0||t>=r.length)return r;let i=Math.max(0,Math.min(r.length-1,n));if(i===t)return r;let[a]=r.splice(t,1);return r.splice(i,0,a),r}function jt(e,t){let n=new Set(t.filter(e=>typeof e==`string`));for(let t=1;t<1e4;t++){let r=`${e}_${t}`;if(!n.has(r))return r}return`${e}_${Date.now()}`}function Mt(e,t){if(e==null)return!0;let n=typeof e==`string`?e:e.source;if(!n)return!0;try{return Nt(n.trim(),t)}catch{return!0}}function Nt(e,t){let n=Pt(e,`||`);if(n.length>1)return n.some(e=>Nt(e.trim(),t));let r=Pt(e,`&&`);if(r.length>1)return r.every(e=>Nt(e.trim(),t));if(e.startsWith(`!`))return!Nt(e.slice(1).trim(),t);let i=e.match(/^(.+?)\s+in\s+(\[.*\])$/);if(i){let e=Ft(i[1].trim(),t),n=It(i[2]);return Array.isArray(n)&&n.includes(e)}let a=e.match(/^(.+?)\s*(==|!=)\s*(.+)$/);if(a){let e=Ft(a[1].trim(),t),n=It(a[3].trim()),r=e=>e==null,i=r(e)&&r(n)?!0:e===n;return a[2]===`==`?i:!i}return!!Ft(e,t)}function Pt(e,t){let n=[],r=0,i=null,a=``;for(let o=0;o<e.length;o++){let s=e[o];if(i){a+=s,s===i&&e[o-1]!==`\\`&&(i=null);continue}if(s===`'`||s===`"`){i=s,a+=s;continue}if(s===`(`||s===`[`?r++:(s===`)`||s===`]`)&&r--,r===0&&e.slice(o,o+t.length)===t&&e[o+t.length]!==`=`){n.push(a),a=``,o+=t.length-1;continue}a+=s}return a&&n.push(a),n}function Ft(e,t){if(/^['"]/.test(e)||/^-?\d/.test(e)||e===`true`||e===`false`||e===`null`)return It(e);let n=e.split(`.`),r=t;for(let e of n){if(r==null)return;r=r[e]}return r}function It(e){let t=e.trim();if(t===`true`)return!0;if(t===`false`)return!1;if(t===`null`)return null;if(/^-?\d+(\.\d+)?$/.test(t))return Number(t);if(t.startsWith(`'`)&&t.endsWith(`'`)||t.startsWith(`"`)&&t.endsWith(`"`))return t.slice(1,-1);if(t.startsWith(`[`)&&t.endsWith(`]`))try{let e=t.replace(/'([^']*)'/g,(e,t)=>JSON.stringify(t));return JSON.parse(e)}catch{return[]}return t}var Lt={object:`Object`,field:`Field`,trigger:`Trigger`,validation:`Validation Rule`,hook:`Hook`,view:`View`,page:`Page`,dashboard:`Dashboard`,app:`Application`,action:`Action`,report:`Report`,flow:`Flow`,approval:`Approval Process`,datasource:`Datasource`,translation:`Translation`,router:`Router`,function:`Function`,service:`Service`,email_template:`Email Template`,book:`Documentation Book`,permission:`Permission Set`,profile:`Profile`,role:`Role`,agent:`AI Agent`,tool:`AI Tool`,skill:`AI Skill`,package:`Package`,data:`Dataset`,job:`Background Job`,api:`API Endpoint`,connector:`Connector`,mapping:`Field Mapping`,policy:`Policy`,webhook:`Webhook`,theme:`Theme`,sharing_rule:`Sharing Rule`,analytics_cube:`Analytics Cube`},Rt={object:`对象`,field:`字段`,trigger:`触发器`,validation:`校验规则`,hook:`钩子`,view:`视图`,page:`页面`,dashboard:`仪表板`,app:`应用`,action:`操作`,report:`报表`,flow:`流程`,approval:`审批流程`,datasource:`数据源`,translation:`翻译`,router:`路由`,function:`函数`,service:`服务`,email_template:`邮件模板`,book:`文档手册`,permission:`权限集`,profile:`配置文件`,role:`角色`,agent:`AI 智能体`,tool:`AI 工具`,skill:`AI 技能`,package:`包`,data:`数据集`,job:`后台任务`,api:`API 端点`,connector:`连接器`,mapping:`字段映射`,policy:`策略`,webhook:`Webhook 回调`,theme:`主题`,sharing_rule:`共享规则`,analytics_cube:`分析立方体`},zt={data:`Data`,ui:`UI`,automation:`Automation`,ai:`AI`,system:`System`,platform:`Platform`,identity:`Identity`,security:`Security`,other:`Other`},Bt={data:`数据`,ui:`界面`,automation:`自动化`,ai:`AI`,system:`系统`,platform:`平台`,identity:`身份`,security:`安全`,other:`其他`},Vt={"engine.directory.title":`All Metadata Types`,"engine.directory.description":`The platform protocol exposes {count} metadata types ({writable} writable at runtime). Click any tile to browse, override, or create instances.`,"engine.directory.search":`Search metadata types…`,"engine.directory.writableOnly":`Writable only`,"engine.directory.quickFind":`Quick Find`,"engine.directory.noMatches":`No matches`,"engine.directory.noMatchesHint":`Adjust your search or filters to see more metadata types.`,"engine.directory.loading":`Loading metadata types…`,"engine.directory.loadFailed":`Failed to load metadata types`,"engine.directory.all":`All`,"engine.directory.diagnosticsLink":`View all issues ({count})`,"engine.directory.invalidTooltip":`{count} invalid item(s) — click to fix`,"engine.directory.warnTooltip":`{count} item(s) with warnings`,"engine.directory.itemCountTooltip":`{count} item(s) of this type`,"engine.directory.allPackages":`All packages`,"engine.directory.packageFilter":`Package`,"engine.home.greetingMorning":`Good morning`,"engine.home.greetingAfternoon":`Good afternoon`,"engine.home.greetingEvening":`Good evening`,"engine.home.subtitle":`Your control center for modeling data, designing experiences, and automating the platform.`,"engine.home.statTypes":`Metadata types`,"engine.home.statWritable":`Runtime-writable`,"engine.home.statPackages":`Packages`,"engine.home.statIssues":`Open issues`,"engine.home.allHealthy":`All healthy`,"engine.home.allHealthyHint":`No validation issues across your metadata.`,"engine.home.issuesHint":`{count} item(s) need attention.`,"engine.home.explore":`Explore`,"engine.home.exploreHint":`Jump into any domain of the platform.`,"engine.home.quickActions":`Quick actions`,"engine.home.quickActionsHint":`Create new metadata in one click.`,"engine.home.newItem":`New {label}`,"engine.home.recent":`Recently viewed`,"engine.home.recentEmpty":`Nothing here yet — items you open will appear for quick access.`,"engine.home.browseAll":`Browse all metadata`,"engine.home.openDiagnostics":`Review diagnostics`,"engine.home.viewDomain":`View`,"engine.home.typesLower":`types`,"engine.home.loading":`Loading your workspace…`,"engine.diagnostics.title":`Metadata Diagnostics`,"engine.diagnostics.description":`Every metadata item that failed load-time validation, grouped by type. Errors block features that depend on the item; warnings are advisory.`,"engine.diagnostics.back":`Back to metadata`,"engine.diagnostics.refresh":`Refresh`,"engine.diagnostics.loading":`Scanning metadata…`,"engine.diagnostics.loadFailed":`Failed to load diagnostics: {error}`,"engine.diagnostics.summary":`{count} issue(s) across {items} items in {types} types`,"engine.diagnostics.cleanTitle":`All clear`,"engine.diagnostics.cleanHint":`Scanned {items} item(s) across {types} type(s) — no issues found.`,"engine.diagnostics.severity.error":`Errors`,"engine.diagnostics.severity.warning":`Errors + Warnings`,"engine.diagnostics.col.name":`Item`,"engine.diagnostics.col.issues":`Issues`,"engine.diagnostics.errorN":`{count} error(s)`,"engine.diagnostics.warnN":`{count} warning(s)`,"engine.diagnostics.more":`+{count} more…`,"engine.list.create":`New`,"engine.list.refresh":`Refresh`,"engine.list.search":`Search name, label, description…`,"engine.list.empty":`No items yet.`,"engine.list.items":`Items`,"engine.list.filtered":`Filtered`,"engine.list.invalid":`Invalid`,"engine.list.warnings":`Warnings`,"engine.list.invalidTitle":`Invalid metadata`,"engine.list.invalidCount":`{count} validation error(s):`,"engine.list.warnTitle":`Metadata warnings`,"engine.list.warnCount":`{count} warning(s):`,"engine.list.allSources":`All sources`,"engine.list.allPackages":`All packages`,"engine.package.writableRequired":`Pick or create a writable base (package) first — this item cannot be authored into a read-only code package.`,"engine.list.packageFilter":`Package`,"engine.list.source.artifact":`Artifact`,"engine.list.source.runtime":`Runtime`,"engine.list.source.artifactDesc":`Shipped by code package`,"engine.list.source.runtimeDesc":`Authored at runtime`,"engine.list.col.name":`Name`,"engine.list.col.label":`Label`,"engine.list.col.source":`Source`,"engine.list.col.object":`Object`,"engine.list.col.type":`Type`,"engine.list.col.description":`Description`,"engine.list.emptyType":`No {type} items registered`,"engine.list.emptyQuery":`No matches for "{query}"`,"engine.list.createHint":`Click "New" above to create the first {type}.`,"engine.list.readOnlyHint":`This type is read-only — instances are defined by code artifacts in packages.`,"engine.edit.save":`Save`,"engine.edit.publish":`Publish`,"engine.edit.publishBlockedDirty":`Save first, then publish.`,"engine.edit.discardDraft":`Discard draft`,"engine.edit.discardDraftConfirm":`Discard the pending draft for {type}/{name}?`,"engine.edit.draftPending":`Pending changes — save lives in a draft. Click Publish to release.`,"engine.edit.rollback":`Rollback to this version`,"engine.edit.rollbackConfirm":`Restore version {version}? This writes the historical body back as the current published overlay.`,"engine.edit.reset":`Reset overlay`,"engine.edit.resetConfirm":`Reset overlay for {type}/{name}?`,"engine.edit.delete":`Delete`,"engine.edit.deleteConfirm":`Delete {type}/{name}? This cannot be undone.`,"engine.edit.lockFull":`This item is locked and cannot be edited or deleted.`,"engine.edit.lockNoOverlay":`This item is locked and cannot be edited.`,"engine.edit.lockNoDelete":`This item is locked and cannot be deleted.`,"engine.edit.history":`History`,"engine.edit.auditTab":`Audit log`,"engine.edit.auditCount":`events`,"engine.edit.auditEmptyTitle":`No audit events yet`,"engine.edit.auditEmptyDescription":`No save, publish, rollback, delete or reset attempts have been recorded for this item. Once someone tries to change it (allowed or denied), the attempt will appear here.`,"engine.edit.auditColTime":`Time`,"engine.edit.auditColActor":`Actor`,"engine.edit.auditColOperation":`Operation`,"engine.edit.auditColOutcome":`Outcome`,"engine.edit.auditColLock":`Lock`,"engine.edit.auditColNote":`Note`,"engine.edit.refresh":`Refresh`,"engine.edit.layers":`Layers`,"engine.layers.code":`Code`,"engine.layers.overlay":`Overlay`,"engine.layers.effective":`Effective`,"engine.layers.diff":`Diff`,"engine.layers.diff.field":`Field`,"engine.layers.diff.code":`Code (artifact)`,"engine.layers.diff.effective":`Effective`,"engine.layers.diff.status":`Status`,"engine.layers.diff.unchanged":`unchanged`,"engine.layers.diff.modified":`modified`,"engine.layers.diff.added":`added`,"engine.layers.diff.removed":`removed`,"engine.layers.diff.showUnchanged":`Show unchanged`,"engine.layers.diff.noChanges":`Overlay matches the code value — no field-level differences.`,"engine.layers.diff.noBaseline":`No code-level artifact to compare against. All fields are runtime-authored.`,"engine.layers.diff.summary":`{modified} modified · {added} added · {removed} removed`,"engine.edit.overlaidCount":`{count} overlaid`,"engine.edit.noOverlay":`no overlay`,"engine.edit.references":`References`,"engine.edit.form":`Form`,"engine.edit.edit":`Edit`,"engine.edit.editOverlay":`Edit overlay`,"engine.edit.createNew":`Create new`,"engine.edit.detail":`Detail`,"engine.edit.preview":`Preview`,"engine.edit.designer":`Designer`,"engine.edit.related":`Related`,"engine.edit.hideInspector":`Hide inspector`,"engine.edit.showInspector":`Show inspector`,"engine.edit.noChanges":`No changes to save`,"engine.edit.inspector":`Inspector`,"engine.edit.inspector.properties":`Properties`,"engine.edit.inspector.source":`Source`,"engine.edit.fullscreen":`Fullscreen`,"engine.edit.exitFullscreen":`Exit fullscreen`,"engine.edit.designMode":`Design`,"engine.edit.previewMode":`Preview`,"engine.inspector.widget.kind":`Widget`,"engine.inspector.widget.close":`Close widget`,"engine.inspector.widget.title":`Title`,"engine.inspector.widget.type":`Type`,"engine.inspector.widget.object":`Data Source (Object)`,"engine.inspector.widget.valueField":`Value Field`,"engine.inspector.widget.categoryField":`Category Field`,"engine.inspector.widget.aggregate":`Aggregate`,"engine.inspector.widget.color":`Color Variant`,"engine.inspector.widget.width":`Width`,"engine.inspector.widget.height":`Height`,"engine.inspector.widget.remove":`Remove widget`,"engine.inspector.widget.datasetSection":`Dataset binding`,"engine.inspector.widget.dataset":`Dataset`,"engine.inspector.widget.datasetPlaceholder":`e.g. sales_pipeline`,"engine.inspector.widget.datasetHint":`Bind a governed dataset. When set, it takes precedence over the inline object query above and the widget renders via the dataset (consistent, cross-object, RLS-enforced).`,"engine.inspector.widget.dimensions":`Dimensions`,"engine.inspector.widget.dimensionsPlaceholder":`e.g. stage, region (comma-separated)`,"engine.inspector.widget.dimensionsHint":`Dataset dimension names to group by. Leave empty for a single-value KPI metric.`,"engine.inspector.widget.values":`Values (measures)`,"engine.inspector.widget.valuesPlaceholder":`e.g. revenue, deal_count (comma-separated)`,"engine.inspector.widget.valuesHint":`Dataset measure names to show.`,"engine.inspector.flowNode.kind":`Node`,"engine.inspector.flowNode.close":`Close node`,"engine.inspector.flowNode.id":`ID`,"engine.inspector.flowNode.label":`Label`,"engine.inspector.flowNode.type":`Node Type`,"engine.inspector.flowNode.description":`Description`,"engine.inspector.flowNode.configuration":`Configuration`,"engine.inspector.flowNode.config":`Config (JSON)`,"engine.inspector.flowNode.advanced":`Advanced (JSON)`,"engine.inspector.flowNode.advancedHint":`Optional custom keys not covered by the form above — most flows don’t need this.`,"engine.inspector.flowNode.noConfig":`No configuration needed for this node type.`,"engine.inspector.flowNode.kv.add":`Add entry`,"engine.inspector.flowNode.kv.key":`Key`,"engine.inspector.flowNode.kv.value":`Value`,"engine.inspector.flowNode.kv.remove":`Remove entry`,"engine.inspector.flowNode.kv.empty":`No entries yet.`,"engine.inspector.flowNode.list.add":`Add item`,"engine.inspector.flowNode.list.item":`Value`,"engine.inspector.flowNode.list.remove":`Remove item`,"engine.inspector.flowNode.list.empty":`No items yet.`,"engine.inspector.flowNode.remove":`Remove node`,"engine.inspector.flowEdge.kind":`Connection`,"engine.inspector.flowEdge.close":`Close connection`,"engine.inspector.flowEdge.missing":`This connection no longer exists.`,"engine.inspector.flowEdge.source":`From`,"engine.inspector.flowEdge.target":`To`,"engine.inspector.flowEdge.routing":`Routing`,"engine.inspector.flowEdge.branch":`Branch`,"engine.inspector.flowEdge.label":`Branch label`,"engine.inspector.flowEdge.labelHint":`e.g. approve / reject`,"engine.inspector.flowEdge.condition":`Condition`,"engine.inspector.flowEdge.conditionHint":`CEL expression — taken when it evaluates true`,"engine.inspector.flowEdge.isDefault":`Default branch (else)`,"engine.inspector.flowEdge.hint":`The engine follows this connection when its branch label is selected or its condition is met. The default branch is taken when no other matches.`,"engine.inspector.flowEdge.remove":`Remove connection`,"engine.inspector.flowEdge.approvalBranch":`Approval branch`,"engine.inspector.flowEdge.branchApprove":`Approve`,"engine.inspector.flowEdge.branchReject":`Reject`,"engine.inspector.flowEdge.branchRevise":`Revise — send back`,"engine.inspector.flowEdge.branchCustom":`— Custom —`,"engine.inspector.flowEdge.connection":`Connection`,"engine.inspector.flowEdge.type":`Type`,"engine.inspector.flowEdge.typeDefault":`Normal`,"engine.inspector.flowEdge.typeConditional":`Conditional`,"engine.inspector.flowEdge.typeFault":`Fault (error path)`,"engine.inspector.flowEdge.typeBack":`Back-edge (revise loop)`,"engine.inspector.flowEdge.backHint":`A back-edge re-enters an earlier node to close a loop (e.g. an approval revise loop). It is traversed normally at run time but excluded from cycle validation.`,"engine.inspector.workflowAction.kind":`Action`,"engine.inspector.workflowAction.close":`Close action`,"engine.inspector.workflowAction.type":`Action Type`,"engine.inspector.workflowAction.name":`Name`,"engine.inspector.workflowAction.config":`Config (JSON)`,"engine.inspector.workflowAction.remove":`Remove action`,"engine.inspector.appNav.kind":`Nav Item`,"engine.inspector.appNav.close":`Close nav item`,"engine.inspector.appNav.label":`Label`,"engine.inspector.appNav.icon":`Icon`,"engine.inspector.appNav.remove":`Remove nav item`,"engine.inspector.appNav.typeField":`Type`,"engine.inspector.appNav.type.object":`Object`,"engine.inspector.appNav.type.page":`Page`,"engine.inspector.appNav.type.dashboard":`Dashboard`,"engine.inspector.appNav.type.report":`Report`,"engine.inspector.appNav.type.url":`Link (URL)`,"engine.inspector.appNav.type.group":`Group`,"engine.inspector.appNav.object":`Object`,"engine.inspector.appNav.targetMode":`Landing`,"engine.inspector.appNav.mode.default":`Default view (workspace)`,"engine.inspector.appNav.mode.view":`Named view`,"engine.inspector.appNav.mode.record":`Record deep-link`,"engine.inspector.appNav.mode.filters":`Filtered slice (/data)`,"engine.inspector.appNav.view":`View`,"engine.inspector.appNav.recordId":`Record ID`,"engine.inspector.appNav.recordIdHint":`Supports {current_user_id} and {current_org_id} template variables.`,"engine.inspector.appNav.recordMode":`Open mode`,"engine.inspector.appNav.recordModeView":`View`,"engine.inspector.appNav.recordModeEdit":`Edit`,"engine.inspector.appNav.filters":`URL filters`,"engine.inspector.appNav.filtersField":`Field`,"engine.inspector.appNav.filtersValue":`Value`,"engine.inspector.appNav.filtersAdd":`Add condition`,"engine.inspector.appNav.filtersRemove":`Remove condition`,"engine.inspector.appNav.filtersHint":`One-off slice carried in the URL — promote it to a named view when it becomes curated and reused.`,"engine.inspector.appNav.url":`URL`,"engine.inspector.appNav.urlTarget":`Open in`,"engine.inspector.appNav.urlTargetSelf":`Same tab`,"engine.inspector.appNav.urlTargetBlank":`New tab`,"engine.inspector.appNav.preview":`Resolved link`,"engine.inspector.viewColumn.kind":`Column`,"engine.inspector.viewColumn.close":`Close column`,"engine.inspector.viewColumn.header":`Header`,"engine.inspector.viewColumn.accessorKey":`Field key`,"engine.inspector.viewColumn.width":`Width`,"engine.inspector.viewColumn.align":`Align`,"engine.inspector.viewColumn.sortable":`Sortable`,"engine.inspector.viewColumn.filterable":`Filterable`,"engine.inspector.viewColumn.remove":`Remove column`,"engine.inspector.viewColumn.outlineLabel":`Columns`,"engine.inspector.view.kind":`View`,"engine.inspector.view.close":`Close`,"engine.inspector.view.label":`Label`,"engine.inspector.view.labelPlaceholder":`e.g. All Leads`,"engine.inspector.view.type":`View type`,"engine.inspector.view.object":`Object`,"engine.inspector.view.objectPlaceholder":`e.g. crm_lead`,"engine.inspector.view.noSchema":`Spec schema unavailable — basic properties only.`,"engine.inspector.view.type.grid":`Table / List`,"engine.inspector.view.type.kanban":`Kanban`,"engine.inspector.view.type.calendar":`Calendar`,"engine.inspector.view.type.gallery":`Gallery`,"engine.inspector.view.type.gantt":`Gantt`,"engine.inspector.view.type.timeline":`Timeline`,"engine.inspector.view.type.map":`Map`,"engine.inspector.view.type.chart":`Chart`,"engine.inspector.pageBlock.kind":`Block`,"engine.inspector.pageBlock.close":`Close block`,"engine.inspector.pageBlock.type":`Type`,"engine.inspector.pageBlock.id":`ID`,"engine.inspector.pageBlock.className":`Class names`,"engine.inspector.pageBlock.hidden":`Hidden (CEL)`,"engine.inspector.pageBlock.properties":`Properties`,"engine.inspector.pageBlock.advanced":`Advanced`,"engine.inspector.pageBlock.remove":`Remove block`,"engine.inspector.pageBlock.outlineLabel":`Blocks`,"engine.inspector.report.kind":`Report`,"engine.inspector.report.close":`Close report`,"engine.inspector.report.name":`Name`,"engine.inspector.report.nameHint":`snake_case identifier (cannot change after create)`,"engine.inspector.report.namePlaceholder":`e.g. pipeline_by_stage`,"engine.inspector.report.label":`Label`,"engine.inspector.report.labelPlaceholder":`e.g. Pipeline by Stage`,"engine.inspector.report.type":`Report type`,"engine.inspector.report.type.tabular":`Tabular`,"engine.inspector.report.type.summary":`Summary`,"engine.inspector.report.type.matrix":`Matrix`,"engine.inspector.report.type.joined":`Joined`,"engine.inspector.report.dataset":`Dataset`,"engine.inspector.report.datasetPlaceholder":`e.g. sales_metrics`,"engine.inspector.report.values":`Values (measures)`,"engine.inspector.report.valuesEmpty":`No measures yet. Add one from the dataset below.`,"engine.inspector.report.rows":`Rows (dimensions)`,"engine.inspector.report.rowsEmpty":`No dimensions yet. Add one from the dataset below.`,"engine.inspector.report.columnsAcross":`Columns (across dimensions)`,"engine.inspector.report.columnsAcrossEmpty":`No across dimensions yet — the matrix pivots rows × columns.`,"engine.inspector.report.chart":`Chart`,"engine.inspector.report.chartType":`Chart type`,"engine.inspector.report.chartNone":`None (table only)`,"engine.inspector.report.chartTitle":`Chart title`,"engine.inspector.report.chartX":`X-Axis (dimension)`,"engine.inspector.report.chartY":`Y-Axis (measure)`,"engine.inspector.report.noSchema":`Spec schema unavailable — basic properties only.`,"engine.inspector.moreFields":`More fields`,"engine.inspector.action.kind":`Action`,"engine.inspector.action.close":`Close action`,"engine.inspector.dashboard.kind":`Dashboard`,"engine.inspector.dashboard.close":`Close dashboard`,"engine.inspector.dashboard.label":`Label`,"engine.inspector.dashboard.labelPlaceholder":`e.g. Sales Overview`,"engine.inspector.dashboard.description":`Description`,"engine.inspector.dashboard.descriptionPlaceholder":`Optional summary shown in the header`,"engine.inspector.dashboard.widgets":`Widgets`,"engine.inspector.dashboard.widgetsEmpty":`No widgets yet. Add one below.`,"engine.inspector.dashboard.removeWidget":`Remove widget`,"engine.inspector.dashboard.noSchema":`Spec schema unavailable — basic properties only.`,"engine.inspector.add.widget":`Add widget`,"engine.inspector.add.block":`Add block`,"engine.inspector.add.node":`Add node`,"engine.inspector.add.step":`Add step`,"engine.inspector.add.action":`Add action`,"engine.inspector.add.nav":`Add nav item`,"engine.inspector.reorder.up":`Move up`,"engine.inspector.reorder.down":`Move down`,"engine.edit.overlay":`overlay`,"engine.edit.readOnlyBanner":`Viewing in read-only mode. Click {edit} to make changes.`,"engine.edit.readOnlyTypeBanner":`This metadata type is read-only for safety: it ships executable code or sensitive configuration and cannot be overlaid at runtime. Edit the source in your package and redeploy. To override this lock (use with caution), set {flag} to include {type}, or flip {override} in the registry.`,"engine.edit.artifactLockedBanner":`This {type} is provided by an installed package, so it is read-only at runtime. To change it, edit it in its source package and republish — or create a new {type} from scratch.`,"engine.badge.createOnly":`create-only`,"engine.repeater.empty":`No items. Click + to add.`,"engine.badge.writable":`writable`,"engine.badge.readOnly":`read-only`,"engine.edit.readOnly":`Read-only (runtime overrides disabled).`,"engine.edit.loading":`Loading`,"engine.edit.bespokeDesigner":`Designer`,"engine.edit.readOnlyHint":`Read-only — this metadata type does not allow runtime overrides. Edit the source in the package and redeploy.`,"engine.edit.unsaved":`Unsaved`,"engine.edit.unsavedHint":`You have unsaved changes.`,"engine.edit.diagnostics.title":`This metadata does not match the spec — {count} validation error(s).`,"engine.edit.diagnostics.warnTitle":`{count} warning(s) — review recommended.`,"engine.edit.diagnostics.more":`+{count} more…`,"engine.edit.loadFailed":`Failed to load {type}/{name}: {message}`,"engine.edit.unsavedLeaveConfirm":`You have unsaved changes. Leave this page anyway?`,"engine.edit.saving":`Saving…`,"engine.edit.savedAt":`Saved {time}`,"engine.edit.autoSaveOn":`Auto-save is on — click to disable`,"engine.edit.autoSaveOff":`Auto-save is off — click to enable`,"engine.edit.autoSavingShortly":`Auto-saving…`,"engine.edit.destructive":`Destructive change`,"engine.edit.destructiveHint":`The change would break existing references. Review the issues and confirm to force-save.`,"engine.edit.forceSave":`Force save`,"engine.cancel":`Cancel`,"engine.form.select":`Select...`,"engine.form.selectEllipsis":`Select…`,"engine.form.add":`Add`,"engine.form.addItem":`Add item`,"engine.form.addRow":`Add row`,"engine.form.remove":`Remove`,"engine.form.removeRow":`Remove row`,"engine.form.dragToReorder":`Drag to reorder`,"engine.form.arrayPlaceholder":`comma, separated, values`,"engine.form.loadingObjects":`Loading objects…`,"engine.form.noObjects":`object_name (no objects detected)`,"engine.form.selectObject":`Select object…`,"engine.form.selectObjectDots":`Select object...`,"engine.form.addObjects":`Add objects...`,"engine.form.loadingFields":`Loading fields…`,"engine.form.selectObjectFirst":`(Select an object first)`,"engine.form.selectField":`Select field…`,"engine.form.selectFieldDots":`Select field...`,"engine.form.addFields":`Add fields...`,"engine.form.noObjectBound":`No object bound`,"engine.form.none":`— None —`,"engine.form.notInObject":`(not in object)`,"engine.form.searchIcons":`Search icons…`,"engine.form.chooseIcon":`Choose an icon`,"engine.form.iconsTruncated":`Showing the first {shown} of {total} — type to narrow.`,"engine.form.noMatchingIcons":`No matching icons.`,"engine.form.keep":`Keep`,"engine.form.addField":`Add field…`,"engine.form.addFieldPlain":`Add field`,"engine.form.searchFields":`Search fields…`,"engine.form.allFieldsAdded":`All fields added`,"engine.form.noObjectFields":`No object fields ({error}).`,"engine.form.noMatchingFields":`No matching fields.`,"engine.form.noFieldsOnObject":`No fields on this object.`,"engine.form.added":`Added`,"engine.form.tagsPlaceholder":`Type and press Enter…`,"engine.form.noRows":`No rows. Click + to add.`,"engine.form.masterDetailSchemaError":`master-detail widget requires items.properties on the JSON schema (or an anyOf branch that has them).`,"engine.form.missingField":`Field {field} declared in form layout but missing from schema. Skipping.`,"engine.form.fallbackJson":`widget {widget} — falling back to JSON until a custom renderer is registered.`,"engine.form.keyRequired":`Key is required`,"engine.form.keyExists":`Key "{key}" already exists`,"engine.form.keyPattern":`Key must match {pattern}`,"engine.form.invalidJson":`Invalid JSON`,"engine.form.rootJsonObject":`Root must be a JSON object`,"engine.validation.invalid":`Invalid input`,"engine.validation.pattern":`Invalid string: must match pattern {pattern}`,"engine.validation.expectedStringUndefined":`Required text value`,"engine.validation.expectedType":`Invalid type: expected {expected}, received {received}`,"engine.validation.invalidOption":`Invalid option: expected one of {options}`,"engine.validation.failed":`Validation failed ({count} issues).`,"engine.validation.failedOne":`Validation failed (1 issue).`,"engine.validation.nameRequired":`A name is required.`,"engine.embedded.saved":`Saved.`,"engine.embedded.readOnlyParent":`The parent type is read-only — saving will still attempt a PUT and may be refused by the server.`,"engine.embedded.saveIntoParent":`Save into {parentType}`,"engine.embedded.saveNoPath":`Cannot save: this item has no embeddedPath registered.`,"engine.embedded.noSchema":`No form schema is registered for {type}. Edit the raw JSON below; saving will splice it back into {target}.`,"engine.embedded.readOnly":`Read-only`,"engine.embedded.noPathHint":`No embedded path registered — cannot determine where to write this item back.`,"engine.packages.title":`Packages`,"engine.packages.description":`Author, publish, and manage the packages installed in this environment.`,"engine.packages.refresh":`Refresh`,"engine.packages.import":`Import`,"engine.packages.importing":`Importing…`,"engine.packages.new":`New Package`,"engine.packages.search":`Search packages…`,"engine.packages.showPlatform":`Show platform packages ({count})`,"engine.packages.empty":`No packages`,"engine.packages.emptyCreate":`Create your first package to start authoring metadata.`,"engine.packages.emptyFiltered":`No packages match your filters.`,"engine.packages.loadFailed":`Failed to load packages`,"engine.packages.col.name":`Name`,"engine.packages.col.version":`Version`,"engine.packages.col.scope":`Scope`,"engine.packages.col.status":`Status`,"engine.packages.scope.project":`Read-only · code`,"engine.packages.scope.system":`System`,"engine.packages.scope.cloud":`Cloud`,"engine.packages.scope.writable":`Writable`,"engine.packages.status.enabled":`Enabled`,"engine.packages.status.disabled":`Disabled`,"engine.packages.import.invalidJson":`Selected file is not valid JSON.`,"engine.packages.import.invalidPackage":`Invalid package file: missing "id" or "name".`,"engine.packages.import.success":`Imported "{id}". Refresh the app switcher to use it.`,"engine.packages.import.failed":`Import failed`,"engine.packages.create.title":`New Package`,"engine.packages.create.description":`Create a project-scoped package to author and publish your own metadata. The id should be reverse-domain (e.g. {example}).`,"engine.packages.create.id":`Package ID`,"engine.packages.create.idInvalid":`Use letters, numbers, dot, dash or underscore (2–255 chars).`,"engine.packages.create.name":`Display name`,"engine.packages.create.version":`Version`,"engine.packages.create.versionInvalid":`Use semantic version, e.g. 0.1.0`,"engine.packages.create.creating":`Creating…`,"engine.packages.create.submit":`Create package`,"engine.packages.create.failed":`Failed to create package`,"engine.packages.detail.type":`Type`,"engine.packages.detail.description":`Description`,"engine.packages.detail.browseMetadata":`Browse this package's metadata`,"engine.packages.detail.pendingChanges":`Pending changes`,"engine.packages.detail.pendingHint":`Drafted, not yet published. Publish the whole app, or review each below.`,"engine.packages.detail.publishApp":`Publish app ({count})`,"engine.packages.detail.discardChanges":`Discard changes ({count})`,"engine.packages.detail.kernelReadOnly":`This is a platform kernel package. Authoring actions are disabled.`,"engine.packages.detail.actions":`Actions`,"engine.packages.detail.edit":`Edit`,"engine.packages.edit.title":`Edit package`,"engine.packages.edit.save":`Save changes`,"engine.packages.edit.saving":`Saving…`,"engine.packages.edit.saved":`Package updated`,"engine.packages.edit.failed":`Failed to update package`,"engine.packages.detail.publish":`Publish`,"engine.packages.detail.publishing":`Publishing…`,"engine.packages.detail.revert":`Revert`,"engine.packages.detail.enable":`Enable`,"engine.packages.detail.disable":`Disable`,"engine.packages.detail.export":`Export`,"engine.packages.detail.exporting":`Exporting…`,"engine.packages.detail.deleteApp":`Delete app`,"engine.packages.detail.deleting":`Deleting…`,"engine.packages.detail.discarding":`Discarding…`,"engine.packages.detail.actionFailed":`Action failed`,"engine.packages.detail.publishBlocked":`Publish blocked by {count} validation error(s).`,"engine.packages.detail.nothingToPublish":`Nothing to publish.`,"engine.packages.detail.published":`Package published.`,"engine.packages.detail.publishDraftsPartial":`Published {published}; {failed} failed.`,"engine.packages.detail.publishDraftsOk":`App published — all drafts are now live.`,"engine.packages.detail.reverted":`Reverted to last published state.`,"engine.packages.detail.discardDraftsPartial":`Discarded {discarded}; {failed} failed.`,"engine.packages.detail.discardDraftsOk":`All pending changes discarded — back to the published version.`,"engine.packages.detail.deleteConfirm":`Delete "{name}" and all its data?
2
+ import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{g as t,r as n,y as r}from"./vendor-react-BGDDiZfJ.js";import{l as i}from"./framework-B3O15Lsq.js";import{U as a,b as o,g as s}from"./vendor-objectstack-Bw0HRuFa.js";import{$s as c,Ar as l,As as u,Bs as d,Cs as f,Ei as p,Fo as m,Gi as h,Ha as g,Hs as _,Is as v,Jn as y,Jt as b,Ka as x,Ko as S,Kt as C,Na as w,Oi as T,Or as E,Pa as ee,Pr as D,Q as O,Qr as k,Ra as A,Ua as j,Un as M,Ur as te,Wa as ne,Wn as re,Wo as ie,Xn as ae,Xt as N,Yi as P,Yn as oe,Yr as se,Yt as F,Zn as ce,Zs as le,_i as ue,an as de,ar as fe,ci as pe,ct as me,dn as I,ds as he,dt as ge,ea as _e,ec as ve,es as ye,fo as be,fs as xe,gc as Se,go as Ce,gs as we,hc as Te,hi as Ee,ia as De,in as Oe,it as ke,kc as Ae,lt as je,ma as Me,nt as Ne,oc as Pe,on as Fe,ot as Ie,pi as Le,qn as Re,qo as ze,qr as L,qt as R,ra as Be,sn as z,so as Ve,st as He,ta as Ue,ti as We,ut as Ge,va as Ke,vc as qe,vo as Je,vt as Ye,wc as Xe,xr as B,ya as Ze,yi as Qe,zi as $e,zs as et}from"./ui-components-rkvkkTxO.js";import{r as tt}from"./useMetadata-DO66YueM.js";var V=e(r(),1),H=n();function nt(e){return Array.isArray(e)?{shape:`array`,entries:e.map((e,t)=>{let{name:n,...r}=e??{};return{name:typeof n==`string`&&n?n:`field_${t+1}`,def:r}})}:e&&typeof e==`object`?{shape:`record`,entries:Object.entries(e).map(([e,t])=>({name:e,def:{...t??{}}}))}:{shape:`record`,entries:[]}}function rt(e){if(e.shape===`array`)return e.entries.map(e=>({name:e.name,...e.def}));let t={};for(let n of e.entries)t[n.name]=n.def;return t}function it(e,t){return e.entries.findIndex(e=>e.name===t)}function at(e,t,n){let r={type:t,label:n??ot(e)};return(t===`select`||t===`multiselect`||t===`radio`||t===`checkboxes`)&&(r.options=[]),{name:e,def:r}}function ot(e){return e?e.split(`_`).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `):``}function st(e){let t=e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`_`).replace(/^_+|_+$/g,``).replace(/_{2,}/g,`_`);return t?/^[a-z_]/.test(t)?t:`f_${t}`:`field`}function ct(e){let t=e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`_`).replace(/^_+/g,``).replace(/_{2,}/g,`_`);return t?/^[a-z_]/.test(t)?t:`f_${t}`:``}function lt(e){return Array.isArray(e)?e.filter(e=>!!e&&typeof e==`object`).map(e=>({key:typeof e.key==`string`?e.key:``,label:typeof e.label==`string`?e.label:``})).filter(e=>e.key):[]}function ut(e,t){let n=/[a-z0-9]/i.test(e)?st(e):`group`;if(!t.includes(n))return n;let r=2;for(;t.includes(`${n}_${r}`);)r+=1;return`${n}_${r}`}function dt(e,t){let n=t.trim()||`New section`,r=ut(n,e.map(e=>e.key));return[...e,{key:r,label:n}]}function ft(e,t,n){let r=n.trim();return r?e.map(e=>e.key===t?{...e,label:r}:e):e}function pt(e,t){return e.filter(e=>e.key!==t)}function mt(e,t,n){let r=e.findIndex(e=>e.key===t);if(r<0)return e;let i=r+n;return i<0||i>=e.length?e:gt(e,r,i)}function ht(e,t){return{shape:e.shape,entries:e.entries.map(e=>e.def.group===t?{name:e.name,def:{...e.def,group:void 0}}:e)}}function gt(e,t,n){let r=e.slice(),[i]=r.splice(t,1);return r.splice(n,0,i),r}function _t(e,t,n){let r=Array.isArray(t)?t.filter(e=>typeof e?.key==`string`):[],i=new Map;for(let e of r)i.set(e.key,{key:e.key,label:String(e.label??e.key),entries:[]});let a=new Set(r.map(e=>e.key));for(let t of e.entries){let e=typeof t.def.group==`string`?t.def.group:null;e&&a.has(e)?i.get(e).entries.push(t):(i.has(null)||i.set(null,{key:null,label:`Ungrouped`,entries:[]}),i.get(null).entries.push(t))}let o=!!n?.includeEmptyDeclared;return Array.from(i.values()).filter(e=>e.entries.length>0||o&&e.key!==null)}function vt(e,t){return e===t?!0:JSON.stringify(e??null)===JSON.stringify(t??null)}function yt(e,t){let n=new Set([...Object.keys(e),...Object.keys(t)]),r=[];for(let i of n)vt(e[i],t[i])||r.push(i);return r.sort()}function bt(e,t){let n=nt(e),r=nt(t),i=new Map(n.entries.map(e=>[e.name,e])),a=new Set(r.entries.map(e=>e.name)),o={},s=0,c=0;for(let e of r.entries){let t=i.get(e.name);if(!t){o[e.name]={name:e.name,status:`added`,changedKeys:[]},s+=1;continue}let n=yt(t.def,e.def);n.length?(o[e.name]={name:e.name,status:`changed`,changedKeys:n},c+=1):o[e.name]={name:e.name,status:`unchanged`,changedKeys:[]}}let l=n.entries.filter(e=>!a.has(e.name));return{byName:o,removed:l,counts:{added:s,changed:c,removed:l.length}}}function xt({kindLabel:e,title:t,onClose:n,closeLabel:r=`Close`,children:i,footer:a,headerActions:o,hideClose:s}){return(0,H.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-2 border-b px-4 py-2.5`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(fe,{variant:`secondary`,className:`text-[10px] uppercase tracking-wider`,children:e}),(0,H.jsx)(`div`,{className:`mt-1 truncate text-sm font-medium`,title:t,children:t})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[o,!s&&(0,H.jsx)(B,{variant:`ghost`,size:`sm`,onClick:n,"aria-label":r,className:`h-7 w-7 p-0`,children:(0,H.jsx)(E,{className:`h-4 w-4`})})]})]}),(0,H.jsx)(`div`,{className:`flex-1 overflow-auto px-4 py-3 space-y-3`,children:i}),a&&(0,H.jsx)(`div`,{className:`border-t px-4 py-2.5`,children:a})]})}function St({index:e,total:t,onMove:n,upLabel:r=`Move up`,downLabel:i=`Move down`,disabled:a}){if(t<=1||e<0)return null;let o=!a&&e>0,s=!a&&e<t-1;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(B,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0`,onClick:()=>o&&n(e-1),disabled:!o,"aria-label":r,title:r,children:(0,H.jsx)(qe,{className:`h-4 w-4`})}),(0,H.jsx)(B,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0`,onClick:()=>s&&n(e+1),disabled:!s,"aria-label":i,title:i,children:(0,H.jsx)(Xe,{className:`h-4 w-4`})})]})}function U({label:e,value:t,onCommit:n,onBlur:r,placeholder:i,disabled:a,mono:o,testId:s}){return(0,H.jsxs)(`div`,{className:`space-y-1`,children:[(0,H.jsx)(I,{className:`text-xs text-muted-foreground`,children:e}),(0,H.jsx)(z,{value:t,onChange:e=>n(e.target.value),onBlur:e=>r?.(e.target.value),placeholder:i,disabled:a,"data-testid":s,className:Ae(`h-8 text-sm`,o&&`font-mono`)})]})}function Ct({label:e,value:t,onCommit:n,placeholder:r,disabled:i}){return(0,H.jsxs)(`div`,{className:`space-y-1`,children:[(0,H.jsx)(I,{className:`text-xs text-muted-foreground`,children:e}),(0,H.jsx)(z,{type:`number`,value:t??``,onChange:e=>{let t=e.target.value;n(t===``?void 0:Number(t))},placeholder:r,disabled:i,className:`h-8 text-sm`})]})}function W({label:e,value:t,options:n,onCommit:r,placeholder:i=`—`,disabled:a}){let o=e=>e===``?wt:e,s=e=>e===wt?``:e;return(0,H.jsxs)(`div`,{className:`space-y-1`,children:[(0,H.jsx)(I,{className:`text-xs text-muted-foreground`,children:e}),(0,H.jsxs)(C,{value:o(t??``),onValueChange:e=>r(s(e)),disabled:a,children:[(0,H.jsx)(F,{className:`h-8 text-sm`,children:(0,H.jsx)(N,{placeholder:i})}),(0,H.jsx)(R,{children:n.map(e=>(0,H.jsx)(b,{value:o(e.value),children:e.label},e.value))})]})]})}var wt=`__inspector_select_none__`;function Tt({label:e,value:t,onCommit:n,disabled:r}){return(0,H.jsxs)(`label`,{className:`flex items-center gap-2 text-xs cursor-pointer select-none`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:t,disabled:r,onChange:e=>n(e.target.checked),className:`h-3.5 w-3.5`}),(0,H.jsx)(`span`,{children:e})]})}function Et({label:e,onClick:t,disabled:n}){return(0,H.jsxs)(B,{variant:`outline`,size:`sm`,onClick:t,disabled:n,className:`w-full gap-1.5 text-muted-foreground hover:border-destructive/40 hover:bg-destructive/5 hover:text-destructive`,children:[(0,H.jsx)(L,{className:`h-3.5 w-3.5`}),e]})}function Dt({message:e}){return(0,H.jsx)(`div`,{className:`text-xs italic text-muted-foreground p-4 text-center`,children:e})}function Ot(e,t,n){let r=Array.isArray(e)?[...e]:[];return n===null?r.splice(t,1):r[t]=n,r}function kt(e,t){let n=Array.isArray(e)?[...e]:[];return n.push(t),n}function At(e,t,n){let r=Array.isArray(e)?[...e]:[];if(t<0||t>=r.length)return r;let i=Math.max(0,Math.min(r.length-1,n));if(i===t)return r;let[a]=r.splice(t,1);return r.splice(i,0,a),r}function jt(e,t){let n=new Set(t.filter(e=>typeof e==`string`));for(let t=1;t<1e4;t++){let r=`${e}_${t}`;if(!n.has(r))return r}return`${e}_${Date.now()}`}function Mt(e,t){if(e==null)return!0;let n=typeof e==`string`?e:e.source;if(!n)return!0;try{return Nt(n.trim(),t)}catch{return!0}}function Nt(e,t){let n=Pt(e,`||`);if(n.length>1)return n.some(e=>Nt(e.trim(),t));let r=Pt(e,`&&`);if(r.length>1)return r.every(e=>Nt(e.trim(),t));if(e.startsWith(`!`))return!Nt(e.slice(1).trim(),t);let i=e.match(/^(.+?)\s+in\s+(\[.*\])$/);if(i){let e=Ft(i[1].trim(),t),n=It(i[2]);return Array.isArray(n)&&n.includes(e)}let a=e.match(/^(.+?)\s*(==|!=)\s*(.+)$/);if(a){let e=Ft(a[1].trim(),t),n=It(a[3].trim()),r=e=>e==null,i=r(e)&&r(n)?!0:e===n;return a[2]===`==`?i:!i}return!!Ft(e,t)}function Pt(e,t){let n=[],r=0,i=null,a=``;for(let o=0;o<e.length;o++){let s=e[o];if(i){a+=s,s===i&&e[o-1]!==`\\`&&(i=null);continue}if(s===`'`||s===`"`){i=s,a+=s;continue}if(s===`(`||s===`[`?r++:(s===`)`||s===`]`)&&r--,r===0&&e.slice(o,o+t.length)===t&&e[o+t.length]!==`=`){n.push(a),a=``,o+=t.length-1;continue}a+=s}return a&&n.push(a),n}function Ft(e,t){if(/^['"]/.test(e)||/^-?\d/.test(e)||e===`true`||e===`false`||e===`null`)return It(e);let n=e.split(`.`),r=t;for(let e of n){if(r==null)return;r=r[e]}return r}function It(e){let t=e.trim();if(t===`true`)return!0;if(t===`false`)return!1;if(t===`null`)return null;if(/^-?\d+(\.\d+)?$/.test(t))return Number(t);if(t.startsWith(`'`)&&t.endsWith(`'`)||t.startsWith(`"`)&&t.endsWith(`"`))return t.slice(1,-1);if(t.startsWith(`[`)&&t.endsWith(`]`))try{let e=t.replace(/'([^']*)'/g,(e,t)=>JSON.stringify(t));return JSON.parse(e)}catch{return[]}return t}var Lt={object:`Object`,field:`Field`,trigger:`Trigger`,validation:`Validation Rule`,hook:`Hook`,view:`View`,page:`Page`,dashboard:`Dashboard`,app:`Application`,action:`Action`,report:`Report`,flow:`Flow`,approval:`Approval Process`,datasource:`Datasource`,translation:`Translation`,router:`Router`,function:`Function`,service:`Service`,email_template:`Email Template`,book:`Documentation Book`,permission:`Permission Set`,profile:`Profile`,role:`Role`,agent:`AI Agent`,tool:`AI Tool`,skill:`AI Skill`,package:`Package`,data:`Dataset`,job:`Background Job`,api:`API Endpoint`,connector:`Connector`,mapping:`Field Mapping`,policy:`Policy`,webhook:`Webhook`,theme:`Theme`,sharing_rule:`Sharing Rule`,analytics_cube:`Analytics Cube`},Rt={object:`对象`,field:`字段`,trigger:`触发器`,validation:`校验规则`,hook:`钩子`,view:`视图`,page:`页面`,dashboard:`仪表板`,app:`应用`,action:`操作`,report:`报表`,flow:`流程`,approval:`审批流程`,datasource:`数据源`,translation:`翻译`,router:`路由`,function:`函数`,service:`服务`,email_template:`邮件模板`,book:`文档手册`,permission:`权限集`,profile:`配置文件`,role:`角色`,agent:`AI 智能体`,tool:`AI 工具`,skill:`AI 技能`,package:`包`,data:`数据集`,job:`后台任务`,api:`API 端点`,connector:`连接器`,mapping:`字段映射`,policy:`策略`,webhook:`Webhook 回调`,theme:`主题`,sharing_rule:`共享规则`,analytics_cube:`分析立方体`},zt={data:`Data`,ui:`UI`,automation:`Automation`,ai:`AI`,system:`System`,platform:`Platform`,identity:`Identity`,security:`Security`,other:`Other`},Bt={data:`数据`,ui:`界面`,automation:`自动化`,ai:`AI`,system:`系统`,platform:`平台`,identity:`身份`,security:`安全`,other:`其他`},Vt={"engine.directory.title":`All Metadata Types`,"engine.directory.description":`The platform protocol exposes {count} metadata types ({writable} writable at runtime). Click any tile to browse, override, or create instances.`,"engine.directory.search":`Search metadata types…`,"engine.directory.writableOnly":`Writable only`,"engine.directory.quickFind":`Quick Find`,"engine.directory.noMatches":`No matches`,"engine.directory.noMatchesHint":`Adjust your search or filters to see more metadata types.`,"engine.directory.loading":`Loading metadata types…`,"engine.directory.loadFailed":`Failed to load metadata types`,"engine.directory.all":`All`,"engine.directory.diagnosticsLink":`View all issues ({count})`,"engine.directory.invalidTooltip":`{count} invalid item(s) — click to fix`,"engine.directory.warnTooltip":`{count} item(s) with warnings`,"engine.directory.itemCountTooltip":`{count} item(s) of this type`,"engine.directory.allPackages":`All packages`,"engine.directory.packageFilter":`Package`,"engine.home.greetingMorning":`Good morning`,"engine.home.greetingAfternoon":`Good afternoon`,"engine.home.greetingEvening":`Good evening`,"engine.home.subtitle":`Your control center for modeling data, designing experiences, and automating the platform.`,"engine.home.statTypes":`Metadata types`,"engine.home.statWritable":`Runtime-writable`,"engine.home.statPackages":`Packages`,"engine.home.statIssues":`Open issues`,"engine.home.allHealthy":`All healthy`,"engine.home.allHealthyHint":`No validation issues across your metadata.`,"engine.home.issuesHint":`{count} item(s) need attention.`,"engine.home.explore":`Explore`,"engine.home.exploreHint":`Jump into any domain of the platform.`,"engine.home.quickActions":`Quick actions`,"engine.home.quickActionsHint":`Create new metadata in one click.`,"engine.home.newItem":`New {label}`,"engine.home.recent":`Recently viewed`,"engine.home.recentEmpty":`Nothing here yet — items you open will appear for quick access.`,"engine.home.browseAll":`Browse all metadata`,"engine.home.openDiagnostics":`Review diagnostics`,"engine.home.viewDomain":`View`,"engine.home.typesLower":`types`,"engine.home.loading":`Loading your workspace…`,"engine.diagnostics.title":`Metadata Diagnostics`,"engine.diagnostics.description":`Every metadata item that failed load-time validation, grouped by type. Errors block features that depend on the item; warnings are advisory.`,"engine.diagnostics.back":`Back to metadata`,"engine.diagnostics.refresh":`Refresh`,"engine.diagnostics.loading":`Scanning metadata…`,"engine.diagnostics.loadFailed":`Failed to load diagnostics: {error}`,"engine.diagnostics.summary":`{count} issue(s) across {items} items in {types} types`,"engine.diagnostics.cleanTitle":`All clear`,"engine.diagnostics.cleanHint":`Scanned {items} item(s) across {types} type(s) — no issues found.`,"engine.diagnostics.severity.error":`Errors`,"engine.diagnostics.severity.warning":`Errors + Warnings`,"engine.diagnostics.col.name":`Item`,"engine.diagnostics.col.issues":`Issues`,"engine.diagnostics.errorN":`{count} error(s)`,"engine.diagnostics.warnN":`{count} warning(s)`,"engine.diagnostics.more":`+{count} more…`,"engine.list.create":`New`,"engine.list.refresh":`Refresh`,"engine.list.search":`Search name, label, description…`,"engine.list.empty":`No items yet.`,"engine.list.items":`Items`,"engine.list.filtered":`Filtered`,"engine.list.invalid":`Invalid`,"engine.list.warnings":`Warnings`,"engine.list.invalidTitle":`Invalid metadata`,"engine.list.invalidCount":`{count} validation error(s):`,"engine.list.warnTitle":`Metadata warnings`,"engine.list.warnCount":`{count} warning(s):`,"engine.list.allSources":`All sources`,"engine.list.allPackages":`All packages`,"engine.package.writableRequired":`Pick or create a writable base (package) first — this item cannot be authored into a read-only code package.`,"engine.list.packageFilter":`Package`,"engine.list.source.artifact":`Artifact`,"engine.list.source.runtime":`Runtime`,"engine.list.source.artifactDesc":`Shipped by code package`,"engine.list.source.runtimeDesc":`Authored at runtime`,"engine.list.col.name":`Name`,"engine.list.col.label":`Label`,"engine.list.col.source":`Source`,"engine.list.col.object":`Object`,"engine.list.col.type":`Type`,"engine.list.col.description":`Description`,"engine.list.emptyType":`No {type} items registered`,"engine.list.emptyQuery":`No matches for "{query}"`,"engine.list.createHint":`Click "New" above to create the first {type}.`,"engine.list.readOnlyHint":`This type is read-only — instances are defined by code artifacts in packages.`,"engine.edit.save":`Save`,"engine.edit.publish":`Publish`,"engine.edit.publishBlockedDirty":`Save first, then publish.`,"engine.edit.discardDraft":`Discard draft`,"engine.edit.discardDraftConfirm":`Discard the pending draft for {type}/{name}?`,"engine.edit.draftPending":`Pending changes — save lives in a draft. Click Publish to release.`,"engine.edit.rollback":`Rollback to this version`,"engine.edit.rollbackConfirm":`Restore version {version}? This writes the historical body back as the current published overlay.`,"engine.edit.reset":`Reset overlay`,"engine.edit.resetConfirm":`Reset overlay for {type}/{name}?`,"engine.edit.delete":`Delete`,"engine.edit.deleteConfirm":`Delete {type}/{name}? This cannot be undone.`,"engine.edit.lockFull":`This item is locked and cannot be edited or deleted.`,"engine.edit.lockNoOverlay":`This item is locked and cannot be edited.`,"engine.edit.lockNoDelete":`This item is locked and cannot be deleted.`,"engine.edit.history":`History`,"engine.edit.auditTab":`Audit log`,"engine.edit.auditCount":`events`,"engine.edit.auditEmptyTitle":`No audit events yet`,"engine.edit.auditEmptyDescription":`No save, publish, rollback, delete or reset attempts have been recorded for this item. Once someone tries to change it (allowed or denied), the attempt will appear here.`,"engine.edit.auditColTime":`Time`,"engine.edit.auditColActor":`Actor`,"engine.edit.auditColOperation":`Operation`,"engine.edit.auditColOutcome":`Outcome`,"engine.edit.auditColLock":`Lock`,"engine.edit.auditColNote":`Note`,"engine.edit.refresh":`Refresh`,"engine.edit.layers":`Layers`,"engine.layers.code":`Code`,"engine.layers.overlay":`Overlay`,"engine.layers.effective":`Effective`,"engine.layers.diff":`Diff`,"engine.layers.diff.field":`Field`,"engine.layers.diff.code":`Code (artifact)`,"engine.layers.diff.effective":`Effective`,"engine.layers.diff.status":`Status`,"engine.layers.diff.unchanged":`unchanged`,"engine.layers.diff.modified":`modified`,"engine.layers.diff.added":`added`,"engine.layers.diff.removed":`removed`,"engine.layers.diff.showUnchanged":`Show unchanged`,"engine.layers.diff.noChanges":`Overlay matches the code value — no field-level differences.`,"engine.layers.diff.noBaseline":`No code-level artifact to compare against. All fields are runtime-authored.`,"engine.layers.diff.summary":`{modified} modified · {added} added · {removed} removed`,"engine.edit.overlaidCount":`{count} overlaid`,"engine.edit.noOverlay":`no overlay`,"engine.edit.references":`References`,"engine.edit.form":`Form`,"engine.edit.edit":`Edit`,"engine.edit.editOverlay":`Edit overlay`,"engine.edit.createNew":`Create new`,"engine.edit.detail":`Detail`,"engine.edit.preview":`Preview`,"engine.edit.designer":`Designer`,"engine.edit.related":`Related`,"engine.edit.hideInspector":`Hide inspector`,"engine.edit.showInspector":`Show inspector`,"engine.edit.noChanges":`No changes to save`,"engine.edit.inspector":`Inspector`,"engine.edit.inspector.properties":`Properties`,"engine.edit.inspector.source":`Source`,"engine.edit.fullscreen":`Fullscreen`,"engine.edit.exitFullscreen":`Exit fullscreen`,"engine.edit.designMode":`Design`,"engine.edit.previewMode":`Preview`,"engine.inspector.widget.kind":`Widget`,"engine.inspector.widget.close":`Close widget`,"engine.inspector.widget.title":`Title`,"engine.inspector.widget.type":`Type`,"engine.inspector.widget.object":`Data Source (Object)`,"engine.inspector.widget.valueField":`Value Field`,"engine.inspector.widget.categoryField":`Category Field`,"engine.inspector.widget.aggregate":`Aggregate`,"engine.inspector.widget.color":`Color Variant`,"engine.inspector.widget.width":`Width`,"engine.inspector.widget.height":`Height`,"engine.inspector.widget.remove":`Remove widget`,"engine.inspector.widget.datasetSection":`Dataset binding`,"engine.inspector.widget.dataset":`Dataset`,"engine.inspector.widget.datasetPlaceholder":`e.g. sales_pipeline`,"engine.inspector.widget.datasetHint":`Bind a governed dataset. When set, it takes precedence over the inline object query above and the widget renders via the dataset (consistent, cross-object, RLS-enforced).`,"engine.inspector.widget.dimensions":`Dimensions`,"engine.inspector.widget.dimensionsPlaceholder":`e.g. stage, region (comma-separated)`,"engine.inspector.widget.dimensionsHint":`Dataset dimension names to group by. Leave empty for a single-value KPI metric.`,"engine.inspector.widget.values":`Values (measures)`,"engine.inspector.widget.valuesPlaceholder":`e.g. revenue, deal_count (comma-separated)`,"engine.inspector.widget.valuesHint":`Dataset measure names to show.`,"engine.inspector.flowNode.kind":`Node`,"engine.inspector.flowNode.close":`Close node`,"engine.inspector.flowNode.id":`ID`,"engine.inspector.flowNode.label":`Label`,"engine.inspector.flowNode.type":`Node Type`,"engine.inspector.flowNode.description":`Description`,"engine.inspector.flowNode.configuration":`Configuration`,"engine.inspector.flowNode.config":`Config (JSON)`,"engine.inspector.flowNode.advanced":`Advanced (JSON)`,"engine.inspector.flowNode.advancedHint":`Optional custom keys not covered by the form above — most flows don’t need this.`,"engine.inspector.flowNode.noConfig":`No configuration needed for this node type.`,"engine.inspector.flowNode.kv.add":`Add entry`,"engine.inspector.flowNode.kv.key":`Key`,"engine.inspector.flowNode.kv.value":`Value`,"engine.inspector.flowNode.kv.remove":`Remove entry`,"engine.inspector.flowNode.kv.empty":`No entries yet.`,"engine.inspector.flowNode.list.add":`Add item`,"engine.inspector.flowNode.list.item":`Value`,"engine.inspector.flowNode.list.remove":`Remove item`,"engine.inspector.flowNode.list.empty":`No items yet.`,"engine.inspector.flowNode.remove":`Remove node`,"engine.inspector.flowEdge.kind":`Connection`,"engine.inspector.flowEdge.close":`Close connection`,"engine.inspector.flowEdge.missing":`This connection no longer exists.`,"engine.inspector.flowEdge.source":`From`,"engine.inspector.flowEdge.target":`To`,"engine.inspector.flowEdge.routing":`Routing`,"engine.inspector.flowEdge.branch":`Branch`,"engine.inspector.flowEdge.label":`Branch label`,"engine.inspector.flowEdge.labelHint":`e.g. approve / reject`,"engine.inspector.flowEdge.condition":`Condition`,"engine.inspector.flowEdge.conditionHint":`CEL expression — taken when it evaluates true`,"engine.inspector.flowEdge.isDefault":`Default branch (else)`,"engine.inspector.flowEdge.hint":`The engine follows this connection when its branch label is selected or its condition is met. The default branch is taken when no other matches.`,"engine.inspector.flowEdge.remove":`Remove connection`,"engine.inspector.flowEdge.approvalBranch":`Approval branch`,"engine.inspector.flowEdge.branchApprove":`Approve`,"engine.inspector.flowEdge.branchReject":`Reject`,"engine.inspector.flowEdge.branchRevise":`Revise — send back`,"engine.inspector.flowEdge.branchCustom":`— Custom —`,"engine.inspector.flowEdge.connection":`Connection`,"engine.inspector.flowEdge.type":`Type`,"engine.inspector.flowEdge.typeDefault":`Normal`,"engine.inspector.flowEdge.typeConditional":`Conditional`,"engine.inspector.flowEdge.typeFault":`Fault (error path)`,"engine.inspector.flowEdge.typeBack":`Back-edge (revise loop)`,"engine.inspector.flowEdge.backHint":`A back-edge re-enters an earlier node to close a loop (e.g. an approval revise loop). It is traversed normally at run time but excluded from cycle validation.`,"engine.inspector.workflowAction.kind":`Action`,"engine.inspector.workflowAction.close":`Close action`,"engine.inspector.workflowAction.type":`Action Type`,"engine.inspector.workflowAction.name":`Name`,"engine.inspector.workflowAction.config":`Config (JSON)`,"engine.inspector.workflowAction.remove":`Remove action`,"engine.inspector.appNav.kind":`Nav Item`,"engine.inspector.appNav.close":`Close nav item`,"engine.inspector.appNav.label":`Label`,"engine.inspector.appNav.icon":`Icon`,"engine.inspector.appNav.remove":`Remove nav item`,"engine.inspector.appNav.typeField":`Type`,"engine.inspector.appNav.type.object":`Object`,"engine.inspector.appNav.type.page":`Page`,"engine.inspector.appNav.type.dashboard":`Dashboard`,"engine.inspector.appNav.type.report":`Report`,"engine.inspector.appNav.type.url":`Link (URL)`,"engine.inspector.appNav.type.group":`Group`,"engine.inspector.appNav.object":`Object`,"engine.inspector.appNav.targetMode":`Landing`,"engine.inspector.appNav.mode.default":`Default view (workspace)`,"engine.inspector.appNav.mode.view":`Named view`,"engine.inspector.appNav.mode.record":`Record deep-link`,"engine.inspector.appNav.mode.filters":`Filtered slice (/data)`,"engine.inspector.appNav.view":`View`,"engine.inspector.appNav.recordId":`Record ID`,"engine.inspector.appNav.recordIdHint":`Supports {current_user_id} and {current_org_id} template variables.`,"engine.inspector.appNav.recordMode":`Open mode`,"engine.inspector.appNav.recordModeView":`View`,"engine.inspector.appNav.recordModeEdit":`Edit`,"engine.inspector.appNav.filters":`URL filters`,"engine.inspector.appNav.filtersField":`Field`,"engine.inspector.appNav.filtersValue":`Value`,"engine.inspector.appNav.filtersAdd":`Add condition`,"engine.inspector.appNav.filtersRemove":`Remove condition`,"engine.inspector.appNav.filtersHint":`One-off slice carried in the URL — promote it to a named view when it becomes curated and reused.`,"engine.inspector.appNav.url":`URL`,"engine.inspector.appNav.urlTarget":`Open in`,"engine.inspector.appNav.urlTargetSelf":`Same tab`,"engine.inspector.appNav.urlTargetBlank":`New tab`,"engine.inspector.appNav.preview":`Resolved link`,"engine.inspector.viewColumn.kind":`Column`,"engine.inspector.viewColumn.close":`Close column`,"engine.inspector.viewColumn.header":`Header`,"engine.inspector.viewColumn.accessorKey":`Field key`,"engine.inspector.viewColumn.width":`Width`,"engine.inspector.viewColumn.align":`Align`,"engine.inspector.viewColumn.sortable":`Sortable`,"engine.inspector.viewColumn.filterable":`Filterable`,"engine.inspector.viewColumn.remove":`Remove column`,"engine.inspector.viewColumn.outlineLabel":`Columns`,"engine.inspector.view.kind":`View`,"engine.inspector.view.close":`Close`,"engine.inspector.view.label":`Label`,"engine.inspector.view.labelPlaceholder":`e.g. All Leads`,"engine.inspector.view.type":`View type`,"engine.inspector.view.object":`Object`,"engine.inspector.view.objectPlaceholder":`e.g. crm_lead`,"engine.inspector.view.noSchema":`Spec schema unavailable — basic properties only.`,"engine.inspector.view.type.grid":`Table / List`,"engine.inspector.view.type.kanban":`Kanban`,"engine.inspector.view.type.calendar":`Calendar`,"engine.inspector.view.type.gallery":`Gallery`,"engine.inspector.view.type.gantt":`Gantt`,"engine.inspector.view.type.timeline":`Timeline`,"engine.inspector.view.type.map":`Map`,"engine.inspector.view.type.chart":`Chart`,"engine.inspector.pageBlock.kind":`Block`,"engine.inspector.pageBlock.close":`Close block`,"engine.inspector.pageBlock.type":`Type`,"engine.inspector.pageBlock.id":`ID`,"engine.inspector.pageBlock.className":`Class names`,"engine.inspector.pageBlock.hidden":`Hidden (CEL)`,"engine.inspector.pageBlock.properties":`Properties`,"engine.inspector.pageBlock.advanced":`Advanced`,"engine.inspector.pageBlock.remove":`Remove block`,"engine.inspector.pageBlock.outlineLabel":`Blocks`,"engine.inspector.report.kind":`Report`,"engine.inspector.report.close":`Close report`,"engine.inspector.report.name":`Name`,"engine.inspector.report.nameHint":`snake_case identifier (cannot change after create)`,"engine.inspector.report.namePlaceholder":`e.g. pipeline_by_stage`,"engine.inspector.report.label":`Label`,"engine.inspector.report.labelPlaceholder":`e.g. Pipeline by Stage`,"engine.inspector.report.type":`Report type`,"engine.inspector.report.type.tabular":`Tabular`,"engine.inspector.report.type.summary":`Summary`,"engine.inspector.report.type.matrix":`Matrix`,"engine.inspector.report.type.joined":`Joined`,"engine.inspector.report.dataset":`Dataset`,"engine.inspector.report.datasetPlaceholder":`e.g. sales_metrics`,"engine.inspector.report.values":`Values (measures)`,"engine.inspector.report.valuesEmpty":`No measures yet. Add one from the dataset below.`,"engine.inspector.report.rows":`Rows (dimensions)`,"engine.inspector.report.rowsEmpty":`No dimensions yet. Add one from the dataset below.`,"engine.inspector.report.columnsAcross":`Columns (across dimensions)`,"engine.inspector.report.columnsAcrossEmpty":`No across dimensions yet — the matrix pivots rows × columns.`,"engine.inspector.report.chart":`Chart`,"engine.inspector.report.chartType":`Chart type`,"engine.inspector.report.chartNone":`None (table only)`,"engine.inspector.report.chartTitle":`Chart title`,"engine.inspector.report.chartX":`X-Axis (dimension)`,"engine.inspector.report.chartY":`Y-Axis (measure)`,"engine.inspector.report.noSchema":`Spec schema unavailable — basic properties only.`,"engine.inspector.moreFields":`More fields`,"engine.inspector.action.kind":`Action`,"engine.inspector.action.close":`Close action`,"engine.inspector.dashboard.kind":`Dashboard`,"engine.inspector.dashboard.close":`Close dashboard`,"engine.inspector.dashboard.label":`Label`,"engine.inspector.dashboard.labelPlaceholder":`e.g. Sales Overview`,"engine.inspector.dashboard.description":`Description`,"engine.inspector.dashboard.descriptionPlaceholder":`Optional summary shown in the header`,"engine.inspector.dashboard.widgets":`Widgets`,"engine.inspector.dashboard.widgetsEmpty":`No widgets yet. Add one below.`,"engine.inspector.dashboard.removeWidget":`Remove widget`,"engine.inspector.dashboard.noSchema":`Spec schema unavailable — basic properties only.`,"engine.inspector.add.widget":`Add widget`,"engine.inspector.add.block":`Add block`,"engine.inspector.add.node":`Add node`,"engine.inspector.add.step":`Add step`,"engine.inspector.add.action":`Add action`,"engine.inspector.add.nav":`Add nav item`,"engine.inspector.reorder.up":`Move up`,"engine.inspector.reorder.down":`Move down`,"engine.edit.overlay":`overlay`,"engine.edit.readOnlyBanner":`Viewing in read-only mode. Click {edit} to make changes.`,"engine.edit.readOnlyTypeBanner":`This metadata type is read-only for safety: it ships executable code or sensitive configuration and cannot be overlaid at runtime. Edit the source in your package and redeploy. To override this lock (use with caution), set {flag} to include {type}, or flip {override} in the registry.`,"engine.edit.artifactLockedBanner":`This {type} is provided by an installed package, so it is read-only at runtime. To change it, edit it in its source package and republish — or create a new {type} from scratch.`,"engine.badge.createOnly":`create-only`,"engine.repeater.empty":`No items. Click + to add.`,"engine.badge.writable":`writable`,"engine.badge.readOnly":`read-only`,"engine.edit.readOnly":`Read-only (runtime overrides disabled).`,"engine.edit.loading":`Loading`,"engine.edit.bespokeDesigner":`Designer`,"engine.edit.readOnlyHint":`Read-only — this metadata type does not allow runtime overrides. Edit the source in the package and redeploy.`,"engine.edit.unsaved":`Unsaved`,"engine.edit.unsavedHint":`You have unsaved changes.`,"engine.edit.diagnostics.title":`This metadata does not match the spec — {count} validation error(s).`,"engine.edit.diagnostics.warnTitle":`{count} warning(s) — review recommended.`,"engine.edit.diagnostics.more":`+{count} more…`,"engine.edit.loadFailed":`Failed to load {type}/{name}: {message}`,"engine.edit.unsavedLeaveConfirm":`You have unsaved changes. Leave this page anyway?`,"engine.edit.saving":`Saving…`,"engine.edit.savedAt":`Saved {time}`,"engine.edit.autoSaveOn":`Auto-save is on — click to disable`,"engine.edit.autoSaveOff":`Auto-save is off — click to enable`,"engine.edit.autoSavingShortly":`Auto-saving…`,"engine.edit.destructive":`Destructive change`,"engine.edit.destructiveHint":`The change would break existing references. Review the issues and confirm to force-save.`,"engine.edit.forceSave":`Force save`,"engine.cancel":`Cancel`,"engine.form.select":`Select...`,"engine.form.selectEllipsis":`Select…`,"engine.form.add":`Add`,"engine.form.addItem":`Add item`,"engine.form.addRow":`Add row`,"engine.form.remove":`Remove`,"engine.form.removeRow":`Remove row`,"engine.form.dragToReorder":`Drag to reorder`,"engine.form.arrayPlaceholder":`comma, separated, values`,"engine.form.loadingObjects":`Loading objects…`,"engine.form.noObjects":`object_name (no objects detected)`,"engine.form.selectObject":`Select object…`,"engine.form.selectObjectDots":`Select object...`,"engine.form.addObjects":`Add objects...`,"engine.form.loadingFields":`Loading fields…`,"engine.form.selectObjectFirst":`(Select an object first)`,"engine.form.selectField":`Select field…`,"engine.form.selectFieldDots":`Select field...`,"engine.form.addFields":`Add fields...`,"engine.form.noObjectBound":`No object bound`,"engine.form.none":`— None —`,"engine.form.notInObject":`(not in object)`,"engine.form.searchIcons":`Search icons…`,"engine.form.chooseIcon":`Choose an icon`,"engine.form.iconsTruncated":`Showing the first {shown} of {total} — type to narrow.`,"engine.form.noMatchingIcons":`No matching icons.`,"engine.form.keep":`Keep`,"engine.form.addField":`Add field…`,"engine.form.addFieldPlain":`Add field`,"engine.form.searchFields":`Search fields…`,"engine.form.allFieldsAdded":`All fields added`,"engine.form.noObjectFields":`No object fields ({error}).`,"engine.form.noMatchingFields":`No matching fields.`,"engine.form.noFieldsOnObject":`No fields on this object.`,"engine.form.added":`Added`,"engine.form.tagsPlaceholder":`Type and press Enter…`,"engine.form.noRows":`No rows. Click + to add.`,"engine.form.masterDetailSchemaError":`master-detail widget requires items.properties on the JSON schema (or an anyOf branch that has them).`,"engine.form.missingField":`Field {field} declared in form layout but missing from schema. Skipping.`,"engine.form.fallbackJson":`widget {widget} — falling back to JSON until a custom renderer is registered.`,"engine.form.keyRequired":`Key is required`,"engine.form.keyExists":`Key "{key}" already exists`,"engine.form.keyPattern":`Key must match {pattern}`,"engine.form.invalidJson":`Invalid JSON`,"engine.form.rootJsonObject":`Root must be a JSON object`,"engine.validation.invalid":`Invalid input`,"engine.validation.pattern":`Invalid string: must match pattern {pattern}`,"engine.validation.expectedStringUndefined":`Required text value`,"engine.validation.expectedType":`Invalid type: expected {expected}, received {received}`,"engine.validation.invalidOption":`Invalid option: expected one of {options}`,"engine.validation.failed":`Validation failed ({count} issues).`,"engine.validation.failedOne":`Validation failed (1 issue).`,"engine.validation.nameRequired":`A name is required.`,"engine.embedded.saved":`Saved.`,"engine.embedded.readOnlyParent":`The parent type is read-only — saving will still attempt a PUT and may be refused by the server.`,"engine.embedded.saveIntoParent":`Save into {parentType}`,"engine.embedded.saveNoPath":`Cannot save: this item has no embeddedPath registered.`,"engine.embedded.noSchema":`No form schema is registered for {type}. Edit the raw JSON below; saving will splice it back into {target}.`,"engine.embedded.readOnly":`Read-only`,"engine.embedded.noPathHint":`No embedded path registered — cannot determine where to write this item back.`,"engine.packages.title":`Packages`,"engine.packages.description":`Author, publish, and manage the packages installed in this environment.`,"engine.packages.refresh":`Refresh`,"engine.packages.import":`Import`,"engine.packages.importing":`Importing…`,"engine.packages.new":`New Package`,"engine.packages.search":`Search packages…`,"engine.packages.showPlatform":`Show platform packages ({count})`,"engine.packages.empty":`No packages`,"engine.packages.emptyCreate":`Create your first package to start authoring metadata.`,"engine.packages.emptyFiltered":`No packages match your filters.`,"engine.packages.loadFailed":`Failed to load packages`,"engine.packages.col.name":`Name`,"engine.packages.col.version":`Version`,"engine.packages.col.scope":`Scope`,"engine.packages.col.status":`Status`,"engine.packages.scope.project":`Read-only · code`,"engine.packages.scope.system":`System`,"engine.packages.scope.cloud":`Cloud`,"engine.packages.scope.writable":`Writable`,"engine.packages.status.enabled":`Enabled`,"engine.packages.status.disabled":`Disabled`,"engine.packages.import.invalidJson":`Selected file is not valid JSON.`,"engine.packages.import.invalidPackage":`Invalid package file: missing "id" or "name".`,"engine.packages.import.success":`Imported "{id}". Refresh the app switcher to use it.`,"engine.packages.import.failed":`Import failed`,"engine.packages.create.title":`New Package`,"engine.packages.create.description":`Create a project-scoped package to author and publish your own metadata. The id should be reverse-domain (e.g. {example}).`,"engine.packages.create.id":`Package ID`,"engine.packages.create.idInvalid":`Use letters, numbers, dot, dash or underscore (2–255 chars).`,"engine.packages.create.name":`Display name`,"engine.packages.create.version":`Version`,"engine.packages.create.versionInvalid":`Use semantic version, e.g. 0.1.0`,"engine.packages.create.creating":`Creating…`,"engine.packages.create.submit":`Create package`,"engine.packages.create.failed":`Failed to create package`,"engine.packages.detail.type":`Type`,"engine.packages.detail.description":`Description`,"engine.packages.detail.browseMetadata":`Browse this package's metadata`,"engine.packages.detail.pendingChanges":`Pending changes`,"engine.packages.detail.pendingHint":`Drafted, not yet published. Publish the whole app, or review each below.`,"engine.packages.detail.publishApp":`Publish app ({count})`,"engine.packages.detail.discardChanges":`Discard changes ({count})`,"engine.packages.detail.kernelReadOnly":`This is a platform kernel package. Authoring actions are disabled.`,"engine.packages.detail.actions":`Actions`,"engine.packages.detail.edit":`Edit`,"engine.packages.edit.title":`Edit package`,"engine.packages.edit.save":`Save changes`,"engine.packages.edit.saving":`Saving…`,"engine.packages.edit.saved":`Package updated`,"engine.packages.edit.failed":`Failed to update package`,"engine.packages.detail.publish":`Publish`,"engine.packages.detail.publishing":`Publishing…`,"engine.packages.detail.revert":`Revert`,"engine.packages.detail.enable":`Enable`,"engine.packages.detail.disable":`Disable`,"engine.packages.detail.export":`Export`,"engine.packages.detail.exporting":`Exporting…`,"engine.packages.detail.deleteApp":`Delete app`,"engine.packages.detail.deleting":`Deleting…`,"engine.packages.detail.discarding":`Discarding…`,"engine.packages.detail.actionFailed":`Action failed`,"engine.packages.detail.publishBlocked":`Publish blocked by {count} validation error(s).`,"engine.packages.detail.nothingToPublish":`Nothing to publish.`,"engine.packages.detail.published":`Package published.`,"engine.packages.detail.publishDraftsPartial":`Published {published}; {failed} failed.`,"engine.packages.detail.publishDraftsOk":`App published — all drafts are now live.`,"engine.packages.detail.reverted":`Reverted to last published state.`,"engine.packages.detail.discardDraftsPartial":`Discarded {discarded}; {failed} failed.`,"engine.packages.detail.discardDraftsOk":`All pending changes discarded — back to the published version.`,"engine.packages.detail.deleteConfirm":`Delete "{name}" and all its data?
3
3
 
4
4
  This removes every object, view, dashboard and app in the package AND drops the database tables those objects created. This cannot be undone.`,"engine.packages.detail.deleteFailed":`Delete failed`,"engine.packages.detail.disabled":`Package disabled.`,"engine.packages.detail.enabled":`Package enabled.`,"engine.packages.detail.exported":`Package exported.`,"engine.packages.detail.duplicate":`Duplicate`,"engine.packages.detail.duplicating":`Duplicating…`,"engine.packages.detail.duplicatePrompt":`New package id for the duplicate (a fresh writable base):`,"engine.packages.detail.duplicated":`Package duplicated into a new base.`,"engine.packages.detail.adoptOrphans":`Adopt loose items`,"engine.packages.detail.adopting":`Adopting…`,"engine.packages.detail.adoptConfirm":`Move all package-less (loose) metadata in this environment INTO "{name}"? This rebinds orphaned items to this base.`,"engine.packages.detail.adopted":`Loose items adopted into this base.`,"engine.packages.detail.deleteKeepData":`Delete the DATA too?
5
5
 
@@ -1,2 +1,2 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ui-components-BL3SEdAz.css"])))=>i.map(i=>d[i]);
2
- import{o as e,r as t}from"./rolldown-runtime-DAXXjFlN.js";import{g as n,m as r,r as i,y as a}from"./vendor-react-BGDDiZfJ.js";import{d as o}from"./infrastructure-Bcx6-8du.js";import{E as s,L as c,R as l,l as u}from"./framework-B3O15Lsq.js";import{G as d,J as f,Or as p,W as m,Zs as h,na as g,xr as _,za as v}from"./ui-components-rkvkkTxO.js";import"./AdapterProvider-qwVfmAEk.js";import"./MetadataProvider-DKJsxrNu.js";import{r as y}from"./ExpressionProvider-ODpzkcN3.js";import{r as b}from"./useMetadata-Ily0JuNR.js";import{n as x,v as S}from"./ReportDefaultInspector-CJGXWwWN.js";import{n as C,r as w,t as T}from"./MetadataInspector-RvnQ-QOT.js";import{r as ee}from"./runtime-metadata-persistence-D1KKivGr.js";import{n as E,t as D}from"./useOpenRecordList-tyj2_1bm.js";import{r as O}from"./plugin-dashboard-CRFZp7gC.js";var k=e(a(),1),A=i();function j({open:e,onClose:t,config:n,onSave:r,onFieldChange:i,name:a,metadataClient:o,onAfterChange:s}){let{t:c}=u(),l=(0,k.useMemo)(()=>S(),[]),[d,f]=(0,k.useState)(!1),m=(0,k.useMemo)(()=>({...n??{}}),[n]),[h,g]=(0,k.useState)(m),v=(0,k.useRef)(h),y=(0,k.useRef)(m);y.current!==m&&(y.current=m,v.current=m,g(m),f(!1));let b=(0,k.useCallback)(e=>{let t={...v.current,...e};if(v.current=t,g(t),f(!0),i)for(let[n,r]of Object.entries(e))i(n,r,t)},[i]),C=(0,k.useCallback)(()=>{r(v.current),f(!1),t()},[r,t]),w=(0,k.useCallback)(e=>{let t={...e};v.current=t,g(t),f(!1)},[]),T=(0,k.useCallback)(()=>{t()},[t]);return e?(0,A.jsxs)(`aside`,{className:`hidden sm:flex w-[440px] shrink-0 flex-col border-l bg-background h-full`,"data-testid":`report-config-panel`,role:`complementary`,"aria-label":c(`report.editor.title`,{defaultValue:`Edit report`}),children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b px-4 py-2.5 shrink-0`,children:[(0,A.jsx)(`div`,{className:`text-sm font-medium truncate`,children:c(`report.editor.title`,{defaultValue:`Edit report`})}),(0,A.jsx)(_,{variant:`ghost`,size:`sm`,onClick:t,className:`h-7 w-7 p-0`,"aria-label":c(`common.close`,{defaultValue:`Close`}),"data-testid":`report-config-close`,children:(0,A.jsx)(p,{className:`h-4 w-4`})})]}),(0,A.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:(0,A.jsx)(x,{type:`report`,name:typeof h.name==`string`?h.name:``,draft:h,readOnly:!1,locale:l,onPatch:b})}),(0,A.jsxs)(`div`,{"data-testid":`report-config-footer`,className:`flex items-center justify-end gap-2 border-t px-4 py-2.5 shrink-0`,children:[(0,A.jsx)(E,{type:`report`,name:a,metadataClient:o,dirty:d,onResume:w,onAfterChange:s}),(0,A.jsx)(_,{variant:`ghost`,size:`sm`,onClick:T,"data-testid":`report-config-discard`,children:c(`common.cancel`,{defaultValue:`Cancel`})}),(0,A.jsx)(_,{size:`sm`,onClick:C,"data-testid":`report-config-save`,children:c(`common.save`,{defaultValue:`Save`})})]})]}):null}var M=t({ReportView:()=>P}),N=(0,k.lazy)(()=>n(()=>import(`./plugin-report-BKD6SOp5.js`).then(e=>e.t).then(e=>({default:e.ReportViewer})),__vite__mapDeps([0]),import.meta.url)),te=(0,k.lazy)(()=>n(()=>import(`./plugin-report-BKD6SOp5.js`).then(e=>e.t).then(e=>({default:e.ReportRenderer})),__vite__mapDeps([0]),import.meta.url)),ne=[{value:`month`,label:`Month`,type:`text`},{value:`revenue`,label:`Revenue`,type:`number`},{value:`count`,label:`Count`,type:`number`},{value:`region`,label:`Region`,type:`text`},{value:`product`,label:`Product`,type:`text`},{value:`source`,label:`Lead Source`,type:`text`},{value:`stage`,label:`Stage`,type:`text`},{value:`amount`,label:`Amount`,type:`number`}];function P({dataSource:e}){let{t}=u(),{reportName:n}=r(),{showDebug:i}=C();c();let a=b(),p=o(),[_,x]=(0,k.useState)(!1),[S,E]=(0,k.useState)(0),{reports:M,objects:P,loading:F,refresh:I}=l(),{app:L}=y(),R=w(M,n,L?._packageId),[z,re]=(0,k.useState)(R),[B,V]=(0,k.useState)(null),[H,U]=(0,k.useState)([]),[W,G]=(0,k.useState)(!1),K=D(),[q,J]=(0,k.useState)(null),Y=(0,k.useCallback)(e=>{if(!e||!P?.length)return;let t=P.find(t=>t.name===e);if(!t?.fields)return;let n=t.fields;return Array.isArray(n)?n.map(e=>typeof e==`string`?{value:e,label:e,type:`text`}:{value:e.name,label:e.label||e.name,type:e.type||`text`}):Object.entries(n).map(([e,t])=>({value:e,label:t.label||e,type:t.type||`text`}))},[P]),ie=(0,k.useCallback)(async({dataset:e,groupKey:t,object:n,objectFilter:r})=>{try{let i=Object.values(t).filter(e=>e!=null).map(e=>String(e)).join(` / `)||String(z?.label??z?.name??`Details`);if(n&&r){J({object:n,filter:r,title:i});return}let o=await a.get(`dataset`,e),s=typeof o?.object==`string`?o.object:void 0;if(!s)return;let c=Array.isArray(o?.dimensions)?o.dimensions:[],l=new Map(c.filter(e=>e?.name).map(e=>[e.name,e])),u=P?.find(e=>e.name===s)?.fields,d=e=>{if(Array.isArray(u))return u.find(t=>t?.name===e);if(u&&typeof u==`object`)return u[e]},f={};for(let[e,n]of Object.entries(t)){if(n==null)continue;let t=l.get(e);if(t?.dateGranularity)continue;let r=t?.field||e,i=d(r);if(i?.type===`lookup`||i?.type===`master_detail`)continue;let a=n;if(Array.isArray(i?.options)){let e=i.options.find(e=>e?.label===n||e?.value===n);e&&e.value!=null&&(a=e.value)}f[r]=a}J({object:s,filter:f,title:i})}catch(e){console.warn(`ReportView: drill failed`,e)}},[a,P,z]),ae=(0,k.useMemo)(()=>{let e=B||z,t=e?.objectName||e?.dataSource?.object||e?.dataSource?.resource;return Y(t)??ne},[B,z,Y]),X=(0,k.useCallback)(async e=>{try{a&&(await ee(`report`,n,e,{metadataClient:a}),I().catch(()=>{}))}catch(e){console.warn(`[ReportView] Auto-save failed:`,e)}},[a,n,I]),oe=(0,k.useCallback)(()=>{V(z),x(!0),E(e=>e+1)},[z]),se=(0,k.useCallback)(()=>{x(!1)},[]),ce=(0,k.useMemo)(()=>B||z,[S]),le=(0,k.useCallback)(e=>{V(e),X(e),E(e=>e+1)},[X]),ue=(0,k.useCallback)((e,t)=>{V(n=>({...n,[e]:t}))},[]);(0,k.useEffect)(()=>{re(R)},[R]),(0,k.useEffect)(()=>{_||V(null)},[R]);let Z=B||z,Q=(0,k.useMemo)(()=>JSON.stringify(Z?.filters),[Z?.filters]),de=(0,k.useMemo)(()=>JSON.stringify(Z?.dataSource),[Z?.dataSource]),fe=(0,k.useMemo)(()=>JSON.stringify(Z?.data),[Z?.data]);if((0,k.useEffect)(()=>{if(!Z||!e){U([]);return}if(Z.data&&Array.isArray(Z.data)){U(Z.data);return}if(Z.dataSource){(async()=>{G(!0);try{let t=Z.dataSource.object||Z.dataSource.resource;if(!t){console.warn(`ReportView: dataSource missing object/resource property`),U([]);return}let n=await e.find(t,{$filter:Z.dataSource.filter,$orderby:Z.dataSource.sort,$top:Z.dataSource.limit});U(n.data||[])}catch(e){console.error(`ReportView: Failed to load data from dataSource`,e),U([])}finally{G(!1)}})();return}if(Z.objectName){(async()=>{G(!0);try{let t=await e.find(Z.objectName,{$filter:Z.filters,$orderby:Z.sort,$top:Z.limit||100});U(t.data||[])}catch(e){console.error(`ReportView: Failed to load data from objectName`,e),U([])}finally{G(!1)}})();return}U([])},[Z?.objectName,Z?.limit,Q,de,fe,e]),F)return(0,A.jsx)(`div`,{className:`h-full flex items-center justify-center p-8`,children:(0,A.jsx)(v,{className:`h-8 w-8 animate-spin text-muted-foreground`})});if(!R||!z)return!F&&!R?(0,A.jsx)(`div`,{className:`h-full flex items-center justify-center p-8`,children:(0,A.jsxs)(m,{children:[(0,A.jsx)(`div`,{className:`mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted`,children:(0,A.jsx)(h,{className:`h-6 w-6 text-muted-foreground`})}),(0,A.jsx)(f,{children:t(`empty.reportNotFound`)}),(0,A.jsx)(d,{children:t(`empty.reportNotFoundDescription`,{name:n})})]})}):(0,A.jsx)(`div`,{className:`h-full flex items-center justify-center p-8`,children:(0,A.jsx)(v,{className:`h-8 w-8 animate-spin text-muted-foreground`})});let pe=e=>{let t={...e};!t.title&&t.label&&(t.title=t.label);let n=t.objectName||t.dataSource?.object||t.dataSource?.resource,r=n?P?.find(e=>e.name===n):null,i=Array.isArray(r?.fields)?r.fields:r?.fields?Object.entries(r.fields).map(([e,t])=>({name:e,...t})):[],a={};for(let e of i)e&&e.name&&(a[e.name]=e);let o=e=>{let t=e.name||e.field,n=t?a[t]:void 0;if(!n)return e;let r={...e};if(r.type===void 0&&n.type!==void 0&&(r.type=n.type),r.options===void 0&&Array.isArray(n.options)&&(r.options=n.options),r.referenceTo===void 0){let e=n.referenceTo||n.reference?.to||n.target;e&&(r.referenceTo=e)}return r.label===void 0&&n.label&&(r.label=n.label),r};if(!t.fields&&Array.isArray(t.columns)?t.fields=t.columns.map(e=>{let t=o(e);return{name:t.field||t.name,label:t.label,type:t.type,options:t.options,referenceTo:t.referenceTo,format:t.format,renderAs:t.renderAs,colorMap:t.colorMap,...t.aggregate?{aggregation:t.aggregate,showInSummary:!0}:{}}}):Array.isArray(t.fields)&&(t.fields=t.fields.map(o)),t.fields&&Array.isArray(t.fields)&&t.fields.length>0){let n=t.fields.some(e=>e.showInSummary||e.aggregation),r=t.type||t.reportType||`tabular`,i=[];(r===`summary`||n)&&i.push({type:`summary`,title:`Key Metrics`}),i.push({type:`table`,title:`Details`,columns:t.fields.map(e=>({name:e.name,label:e.label,type:e.type,options:e.options,referenceTo:e.referenceTo,format:e.format,renderAs:e.renderAs,colorMap:e.colorMap}))});let a=t.chart||t.chartConfig,o=a?.type||a?.chartType;if(o){let e=a.xAxis||a.xAxisField,t=a.yAxis||a.yAxisFields?.[0];i.push({type:`chart`,title:`Chart`,chart:{type:`chart`,chartType:o,xAxisField:e,yAxisFields:t?[t]:a.yAxisFields}})}if(Array.isArray(e.sections)){let t=e.sections.filter(e=>e.type===`chart`&&!o);i.push(...t)}t.sections=i}else t.sections||=[];return t},$=B||z,me=!!($&&(typeof $.dataset==`string`||$.type===`joined`&&Array.isArray($.blocks)&&$.blocks.some(e=>typeof e?.dataset==`string`)))||!!($&&$.objectName&&($.type===`matrix`||$.type===`joined`||$.type===`summary`||$.type===`tabular`||$.type===void 0||Array.isArray($.groupingsAcross)&&$.groupingsAcross.length>0||Array.isArray($.columns))),he={type:`report-viewer`,report:pe($),data:H,showToolbar:!0,allowExport:!0,loading:W};return(0,A.jsxs)(s,{value:{openRecordList:K},children:[(0,A.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden bg-background`,children:[(0,A.jsxs)(`div`,{className:`flex flex-col sm:flex-row justify-between sm:items-center gap-3 sm:gap-4 p-4 sm:p-6 border-b shrink-0`,children:[(0,A.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,A.jsx)(`h1`,{className:`text-lg sm:text-xl md:text-2xl font-bold tracking-tight truncate`,children:$.title||$.label||`Report Viewer`}),$.description&&(0,A.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1 line-clamp-2`,children:$.description})]}),(0,A.jsx)(`div`,{className:`shrink-0 flex items-center gap-1.5`,children:p&&(0,A.jsxs)(`button`,{type:`button`,onClick:oe,className:`inline-flex items-center gap-1.5 rounded-md border border-input bg-background px-2.5 py-1.5 text-xs font-medium text-muted-foreground shadow-sm hover:bg-accent hover:text-accent-foreground`,"data-testid":`report-edit-button`,children:[(0,A.jsx)(g,{className:`h-3.5 w-3.5`}),t(`common.edit`)]})})]}),(0,A.jsxs)(`div`,{className:`flex-1 overflow-hidden flex flex-col sm:flex-row relative`,children:[(0,A.jsx)(`div`,{className:`flex-1 min-w-0 overflow-auto p-4 sm:p-6 lg:p-8 bg-muted/5`,children:(0,A.jsx)(`div`,{className:`w-full shadow-sm border rounded-lg sm:rounded-xl bg-background overflow-hidden min-h-150`,children:(0,A.jsx)(k.Suspense,{fallback:(0,A.jsx)(`div`,{className:`p-8 text-sm text-muted-foreground`,children:t(`common.loading`,{defaultValue:`Loading…`})}),children:me?(0,A.jsx)(`div`,{className:`p-4 sm:p-6`,children:(0,A.jsx)(te,{schema:$,dataSource:e,rows:H,onDrill:ie})}):(0,A.jsx)(N,{schema:he})})})}),(0,A.jsx)(j,{open:_&&p,onClose:se,config:ce,onSave:le,onFieldChange:ue,availableFields:ae,getFieldsForObject:Y,name:n,metadataClient:a,onAfterChange:()=>I().catch(()=>{})}),(0,A.jsx)(T,{open:i,sections:[{title:`Report Configuration`,data:$}]})]})]}),(0,A.jsx)(O,{open:!!q,onClose:()=>J(null),title:q?.title??``,objectName:q?.object??``,filter:q?.filter,dataSource:e})]})}export{M as t};
2
+ import{o as e,r as t}from"./rolldown-runtime-DAXXjFlN.js";import{g as n,m as r,r as i,y as a}from"./vendor-react-BGDDiZfJ.js";import{d as o}from"./infrastructure-Bcx6-8du.js";import{E as s,L as c,R as l,l as u}from"./framework-B3O15Lsq.js";import{G as d,J as f,Or as p,W as m,Zs as h,na as g,xr as _,za as v}from"./ui-components-rkvkkTxO.js";import"./AdapterProvider-BmqhWHIU.js";import"./MetadataProvider-Cm9vi7AZ.js";import{r as y}from"./ExpressionProvider-ODpzkcN3.js";import{r as b}from"./useMetadata-DO66YueM.js";import{n as x,v as S}from"./ReportDefaultInspector-ah_Be1RZ.js";import{n as C,r as w,t as T}from"./MetadataInspector-RvnQ-QOT.js";import{r as ee}from"./runtime-metadata-persistence-D1KKivGr.js";import{n as E,t as D}from"./useOpenRecordList-DsTb016S.js";import{r as O}from"./plugin-dashboard-CRFZp7gC.js";var k=e(a(),1),A=i();function j({open:e,onClose:t,config:n,onSave:r,onFieldChange:i,name:a,metadataClient:o,onAfterChange:s}){let{t:c}=u(),l=(0,k.useMemo)(()=>S(),[]),[d,f]=(0,k.useState)(!1),m=(0,k.useMemo)(()=>({...n??{}}),[n]),[h,g]=(0,k.useState)(m),v=(0,k.useRef)(h),y=(0,k.useRef)(m);y.current!==m&&(y.current=m,v.current=m,g(m),f(!1));let b=(0,k.useCallback)(e=>{let t={...v.current,...e};if(v.current=t,g(t),f(!0),i)for(let[n,r]of Object.entries(e))i(n,r,t)},[i]),C=(0,k.useCallback)(()=>{r(v.current),f(!1),t()},[r,t]),w=(0,k.useCallback)(e=>{let t={...e};v.current=t,g(t),f(!1)},[]),T=(0,k.useCallback)(()=>{t()},[t]);return e?(0,A.jsxs)(`aside`,{className:`hidden sm:flex w-[440px] shrink-0 flex-col border-l bg-background h-full`,"data-testid":`report-config-panel`,role:`complementary`,"aria-label":c(`report.editor.title`,{defaultValue:`Edit report`}),children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b px-4 py-2.5 shrink-0`,children:[(0,A.jsx)(`div`,{className:`text-sm font-medium truncate`,children:c(`report.editor.title`,{defaultValue:`Edit report`})}),(0,A.jsx)(_,{variant:`ghost`,size:`sm`,onClick:t,className:`h-7 w-7 p-0`,"aria-label":c(`common.close`,{defaultValue:`Close`}),"data-testid":`report-config-close`,children:(0,A.jsx)(p,{className:`h-4 w-4`})})]}),(0,A.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:(0,A.jsx)(x,{type:`report`,name:typeof h.name==`string`?h.name:``,draft:h,readOnly:!1,locale:l,onPatch:b})}),(0,A.jsxs)(`div`,{"data-testid":`report-config-footer`,className:`flex items-center justify-end gap-2 border-t px-4 py-2.5 shrink-0`,children:[(0,A.jsx)(E,{type:`report`,name:a,metadataClient:o,dirty:d,onResume:w,onAfterChange:s}),(0,A.jsx)(_,{variant:`ghost`,size:`sm`,onClick:T,"data-testid":`report-config-discard`,children:c(`common.cancel`,{defaultValue:`Cancel`})}),(0,A.jsx)(_,{size:`sm`,onClick:C,"data-testid":`report-config-save`,children:c(`common.save`,{defaultValue:`Save`})})]})]}):null}var M=t({ReportView:()=>P}),N=(0,k.lazy)(()=>n(()=>import(`./plugin-report-BKD6SOp5.js`).then(e=>e.t).then(e=>({default:e.ReportViewer})),__vite__mapDeps([0]),import.meta.url)),te=(0,k.lazy)(()=>n(()=>import(`./plugin-report-BKD6SOp5.js`).then(e=>e.t).then(e=>({default:e.ReportRenderer})),__vite__mapDeps([0]),import.meta.url)),ne=[{value:`month`,label:`Month`,type:`text`},{value:`revenue`,label:`Revenue`,type:`number`},{value:`count`,label:`Count`,type:`number`},{value:`region`,label:`Region`,type:`text`},{value:`product`,label:`Product`,type:`text`},{value:`source`,label:`Lead Source`,type:`text`},{value:`stage`,label:`Stage`,type:`text`},{value:`amount`,label:`Amount`,type:`number`}];function P({dataSource:e}){let{t}=u(),{reportName:n}=r(),{showDebug:i}=C();c();let a=b(),p=o(),[_,x]=(0,k.useState)(!1),[S,E]=(0,k.useState)(0),{reports:M,objects:P,loading:F,refresh:I}=l(),{app:L}=y(),R=w(M,n,L?._packageId),[z,re]=(0,k.useState)(R),[B,V]=(0,k.useState)(null),[H,U]=(0,k.useState)([]),[W,G]=(0,k.useState)(!1),K=D(),[q,J]=(0,k.useState)(null),Y=(0,k.useCallback)(e=>{if(!e||!P?.length)return;let t=P.find(t=>t.name===e);if(!t?.fields)return;let n=t.fields;return Array.isArray(n)?n.map(e=>typeof e==`string`?{value:e,label:e,type:`text`}:{value:e.name,label:e.label||e.name,type:e.type||`text`}):Object.entries(n).map(([e,t])=>({value:e,label:t.label||e,type:t.type||`text`}))},[P]),ie=(0,k.useCallback)(async({dataset:e,groupKey:t,object:n,objectFilter:r})=>{try{let i=Object.values(t).filter(e=>e!=null).map(e=>String(e)).join(` / `)||String(z?.label??z?.name??`Details`);if(n&&r){J({object:n,filter:r,title:i});return}let o=await a.get(`dataset`,e),s=typeof o?.object==`string`?o.object:void 0;if(!s)return;let c=Array.isArray(o?.dimensions)?o.dimensions:[],l=new Map(c.filter(e=>e?.name).map(e=>[e.name,e])),u=P?.find(e=>e.name===s)?.fields,d=e=>{if(Array.isArray(u))return u.find(t=>t?.name===e);if(u&&typeof u==`object`)return u[e]},f={};for(let[e,n]of Object.entries(t)){if(n==null)continue;let t=l.get(e);if(t?.dateGranularity)continue;let r=t?.field||e,i=d(r);if(i?.type===`lookup`||i?.type===`master_detail`)continue;let a=n;if(Array.isArray(i?.options)){let e=i.options.find(e=>e?.label===n||e?.value===n);e&&e.value!=null&&(a=e.value)}f[r]=a}J({object:s,filter:f,title:i})}catch(e){console.warn(`ReportView: drill failed`,e)}},[a,P,z]),ae=(0,k.useMemo)(()=>{let e=B||z,t=e?.objectName||e?.dataSource?.object||e?.dataSource?.resource;return Y(t)??ne},[B,z,Y]),X=(0,k.useCallback)(async e=>{try{a&&(await ee(`report`,n,e,{metadataClient:a}),I().catch(()=>{}))}catch(e){console.warn(`[ReportView] Auto-save failed:`,e)}},[a,n,I]),oe=(0,k.useCallback)(()=>{V(z),x(!0),E(e=>e+1)},[z]),se=(0,k.useCallback)(()=>{x(!1)},[]),ce=(0,k.useMemo)(()=>B||z,[S]),le=(0,k.useCallback)(e=>{V(e),X(e),E(e=>e+1)},[X]),ue=(0,k.useCallback)((e,t)=>{V(n=>({...n,[e]:t}))},[]);(0,k.useEffect)(()=>{re(R)},[R]),(0,k.useEffect)(()=>{_||V(null)},[R]);let Z=B||z,Q=(0,k.useMemo)(()=>JSON.stringify(Z?.filters),[Z?.filters]),de=(0,k.useMemo)(()=>JSON.stringify(Z?.dataSource),[Z?.dataSource]),fe=(0,k.useMemo)(()=>JSON.stringify(Z?.data),[Z?.data]);if((0,k.useEffect)(()=>{if(!Z||!e){U([]);return}if(Z.data&&Array.isArray(Z.data)){U(Z.data);return}if(Z.dataSource){(async()=>{G(!0);try{let t=Z.dataSource.object||Z.dataSource.resource;if(!t){console.warn(`ReportView: dataSource missing object/resource property`),U([]);return}let n=await e.find(t,{$filter:Z.dataSource.filter,$orderby:Z.dataSource.sort,$top:Z.dataSource.limit});U(n.data||[])}catch(e){console.error(`ReportView: Failed to load data from dataSource`,e),U([])}finally{G(!1)}})();return}if(Z.objectName){(async()=>{G(!0);try{let t=await e.find(Z.objectName,{$filter:Z.filters,$orderby:Z.sort,$top:Z.limit||100});U(t.data||[])}catch(e){console.error(`ReportView: Failed to load data from objectName`,e),U([])}finally{G(!1)}})();return}U([])},[Z?.objectName,Z?.limit,Q,de,fe,e]),F)return(0,A.jsx)(`div`,{className:`h-full flex items-center justify-center p-8`,children:(0,A.jsx)(v,{className:`h-8 w-8 animate-spin text-muted-foreground`})});if(!R||!z)return!F&&!R?(0,A.jsx)(`div`,{className:`h-full flex items-center justify-center p-8`,children:(0,A.jsxs)(m,{children:[(0,A.jsx)(`div`,{className:`mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted`,children:(0,A.jsx)(h,{className:`h-6 w-6 text-muted-foreground`})}),(0,A.jsx)(f,{children:t(`empty.reportNotFound`)}),(0,A.jsx)(d,{children:t(`empty.reportNotFoundDescription`,{name:n})})]})}):(0,A.jsx)(`div`,{className:`h-full flex items-center justify-center p-8`,children:(0,A.jsx)(v,{className:`h-8 w-8 animate-spin text-muted-foreground`})});let pe=e=>{let t={...e};!t.title&&t.label&&(t.title=t.label);let n=t.objectName||t.dataSource?.object||t.dataSource?.resource,r=n?P?.find(e=>e.name===n):null,i=Array.isArray(r?.fields)?r.fields:r?.fields?Object.entries(r.fields).map(([e,t])=>({name:e,...t})):[],a={};for(let e of i)e&&e.name&&(a[e.name]=e);let o=e=>{let t=e.name||e.field,n=t?a[t]:void 0;if(!n)return e;let r={...e};if(r.type===void 0&&n.type!==void 0&&(r.type=n.type),r.options===void 0&&Array.isArray(n.options)&&(r.options=n.options),r.referenceTo===void 0){let e=n.referenceTo||n.reference?.to||n.target;e&&(r.referenceTo=e)}return r.label===void 0&&n.label&&(r.label=n.label),r};if(!t.fields&&Array.isArray(t.columns)?t.fields=t.columns.map(e=>{let t=o(e);return{name:t.field||t.name,label:t.label,type:t.type,options:t.options,referenceTo:t.referenceTo,format:t.format,renderAs:t.renderAs,colorMap:t.colorMap,...t.aggregate?{aggregation:t.aggregate,showInSummary:!0}:{}}}):Array.isArray(t.fields)&&(t.fields=t.fields.map(o)),t.fields&&Array.isArray(t.fields)&&t.fields.length>0){let n=t.fields.some(e=>e.showInSummary||e.aggregation),r=t.type||t.reportType||`tabular`,i=[];(r===`summary`||n)&&i.push({type:`summary`,title:`Key Metrics`}),i.push({type:`table`,title:`Details`,columns:t.fields.map(e=>({name:e.name,label:e.label,type:e.type,options:e.options,referenceTo:e.referenceTo,format:e.format,renderAs:e.renderAs,colorMap:e.colorMap}))});let a=t.chart||t.chartConfig,o=a?.type||a?.chartType;if(o){let e=a.xAxis||a.xAxisField,t=a.yAxis||a.yAxisFields?.[0];i.push({type:`chart`,title:`Chart`,chart:{type:`chart`,chartType:o,xAxisField:e,yAxisFields:t?[t]:a.yAxisFields}})}if(Array.isArray(e.sections)){let t=e.sections.filter(e=>e.type===`chart`&&!o);i.push(...t)}t.sections=i}else t.sections||=[];return t},$=B||z,me=!!($&&(typeof $.dataset==`string`||$.type===`joined`&&Array.isArray($.blocks)&&$.blocks.some(e=>typeof e?.dataset==`string`)))||!!($&&$.objectName&&($.type===`matrix`||$.type===`joined`||$.type===`summary`||$.type===`tabular`||$.type===void 0||Array.isArray($.groupingsAcross)&&$.groupingsAcross.length>0||Array.isArray($.columns))),he={type:`report-viewer`,report:pe($),data:H,showToolbar:!0,allowExport:!0,loading:W};return(0,A.jsxs)(s,{value:{openRecordList:K},children:[(0,A.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden bg-background`,children:[(0,A.jsxs)(`div`,{className:`flex flex-col sm:flex-row justify-between sm:items-center gap-3 sm:gap-4 p-4 sm:p-6 border-b shrink-0`,children:[(0,A.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,A.jsx)(`h1`,{className:`text-lg sm:text-xl md:text-2xl font-bold tracking-tight truncate`,children:$.title||$.label||`Report Viewer`}),$.description&&(0,A.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1 line-clamp-2`,children:$.description})]}),(0,A.jsx)(`div`,{className:`shrink-0 flex items-center gap-1.5`,children:p&&(0,A.jsxs)(`button`,{type:`button`,onClick:oe,className:`inline-flex items-center gap-1.5 rounded-md border border-input bg-background px-2.5 py-1.5 text-xs font-medium text-muted-foreground shadow-sm hover:bg-accent hover:text-accent-foreground`,"data-testid":`report-edit-button`,children:[(0,A.jsx)(g,{className:`h-3.5 w-3.5`}),t(`common.edit`)]})})]}),(0,A.jsxs)(`div`,{className:`flex-1 overflow-hidden flex flex-col sm:flex-row relative`,children:[(0,A.jsx)(`div`,{className:`flex-1 min-w-0 overflow-auto p-4 sm:p-6 lg:p-8 bg-muted/5`,children:(0,A.jsx)(`div`,{className:`w-full shadow-sm border rounded-lg sm:rounded-xl bg-background overflow-hidden min-h-150`,children:(0,A.jsx)(k.Suspense,{fallback:(0,A.jsx)(`div`,{className:`p-8 text-sm text-muted-foreground`,children:t(`common.loading`,{defaultValue:`Loading…`})}),children:me?(0,A.jsx)(`div`,{className:`p-4 sm:p-6`,children:(0,A.jsx)(te,{schema:$,dataSource:e,rows:H,onDrill:ie})}):(0,A.jsx)(N,{schema:he})})})}),(0,A.jsx)(j,{open:_&&p,onClose:se,config:ce,onSave:le,onFieldChange:ue,availableFields:ae,getFieldsForObject:Y,name:n,metadataClient:a,onAfterChange:()=>I().catch(()=>{})}),(0,A.jsx)(T,{open:i,sections:[{title:`Report Configuration`,data:$}]})]})]}),(0,A.jsx)(O,{open:!!q,onClose:()=>J(null),title:q?.title??``,objectName:q?.object??``,filter:q?.filter,dataSource:e})]})}export{M as t};
@@ -1 +1 @@
1
- import{o as e,r as t}from"./rolldown-runtime-DAXXjFlN.js";import{a as n,h as r,m as i,r as a,y as o}from"./vendor-react-BGDDiZfJ.js";import{f as s}from"./infrastructure-Bcx6-8du.js";import{R as c,l}from"./framework-B3O15Lsq.js";import{$n as u,Cc as d,Fo as f,Oi as p,Xa as m,Zs as h,ar as g,er as _,ns as v,sn as y}from"./ui-components-rkvkkTxO.js";import"./MetadataProvider-DKJsxrNu.js";import{n as b}from"./ui-layout-CAjjF5_S.js";import{r as x}from"./appRoute-CbCiASix.js";var S=t({SearchResultsPage:()=>O}),C=e(o(),1),w=a();function T(e){let t=[];for(let n of e)n.type===`group`&&n.children?t.push(...T(n.children)):t.push(n);return t}var E={object:v,dashboard:m,page:f,report:h},D={object:`bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200`,dashboard:`bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200`,page:`bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200`,report:`bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200`};function O(){let{t:e}=l(),{appName:t}=i(),[a,o]=r(),[f,m]=(0,C.useState)(a.get(`q`)||``),{apps:h}=c(),S=h||[],O=x(S,t)||S[0],k=`/apps/${t}`,{user:A}=s(),j=(0,C.useMemo)(()=>{if(!O)return[];let e=T(O.navigation||[]),t={currentUserId:A?.id??null};return e.map(e=>{let{href:n}=b(e,k,t);return{id:e.id,label:e.label||e.objectName||e.dashboardName||e.pageName||e.reportName||``,href:n,type:e.type,description:e.description}}).filter(e=>e.href!==`#`)},[O,k,A?.id]),M=(0,C.useMemo)(()=>{if(!f.trim())return j;let e=f.toLowerCase();return j.filter(t=>t.label.toLowerCase().includes(e)||t.type.toLowerCase().includes(e)||t.description&&t.description.toLowerCase().includes(e))},[j,f]),N=e=>{m(e),o(e?{q:e}:{})},P=(0,C.useMemo)(()=>{let e={};for(let t of M)(e[t.type]||=[]).push(t);return e},[M]);return(0,w.jsxs)(`div`,{className:`flex flex-col gap-6 p-4 sm:p-6 max-w-4xl mx-auto`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,w.jsxs)(n,{to:k,className:`flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground transition-colors`,children:[(0,w.jsx)(d,{className:`h-4 w-4`}),e(`search.back`)]}),(0,w.jsx)(`h1`,{className:`text-xl font-semibold`,children:e(`search.title`)})]}),(0,w.jsxs)(`div`,{className:`relative`,children:[(0,w.jsx)(`label`,{htmlFor:`search-results-input`,className:`sr-only`,children:e(`search.placeholder`)}),(0,w.jsx)(p,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`,"aria-hidden":`true`}),(0,w.jsx)(y,{id:`search-results-input`,value:f,onChange:e=>N(e.target.value),placeholder:e(`search.placeholder`),className:`pl-10 h-11 text-base`,autoFocus:!0})]}),(0,w.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:f.trim()?e(M.length===1?`search.resultsCount`:`search.resultsCountPlural`,{count:M.length,query:f}):e(`search.itemsAvailable`,{count:j.length})}),M.length===0?(0,w.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 text-center`,children:[(0,w.jsx)(p,{className:`h-12 w-12 text-muted-foreground/30 mb-4`}),(0,w.jsx)(`p`,{className:`text-lg font-medium text-muted-foreground`,children:e(`search.noResults`)}),(0,w.jsx)(`p`,{className:`text-sm text-muted-foreground/80 mt-1`,children:e(`search.noResultsHint`)})]}):(0,w.jsx)(`div`,{className:`space-y-6`,children:Object.entries(P).map(([t,r])=>{let i=E[t]||v,a=`search.type${t.charAt(0).toUpperCase()}${t.slice(1)}s`;return`${t.charAt(0).toUpperCase()}${t.slice(1)}`,(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`h2`,{className:`text-sm font-medium text-muted-foreground mb-2 flex items-center gap-1.5`,children:[(0,w.jsx)(i,{className:`h-4 w-4`}),e(a),(0,w.jsx)(g,{variant:`secondary`,className:`ml-1 text-xs`,children:r.length})]}),(0,w.jsx)(`div`,{className:`grid gap-2`,children:r.map(t=>{let r=E[t.type]||v,i=`search.badge${t.type.charAt(0).toUpperCase()}${t.type.slice(1)}`;return(0,w.jsx)(n,{to:t.href,className:`rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,children:(0,w.jsx)(u,{className:`hover:bg-accent/50 transition-colors cursor-pointer`,children:(0,w.jsxs)(_,{className:`flex items-center gap-3 p-3`,children:[(0,w.jsx)(`div`,{className:`flex h-8 w-8 items-center justify-center rounded ${D[t.type]||``}`,children:(0,w.jsx)(r,{className:`h-4 w-4`})}),(0,w.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,w.jsx)(`p`,{className:`text-sm font-medium truncate`,children:t.label}),t.description&&(0,w.jsx)(`p`,{className:`text-xs text-muted-foreground truncate`,children:t.description})]}),(0,w.jsx)(g,{variant:`outline`,className:`text-xs shrink-0`,children:e(i)})]})})},t.id)})})]},t)})})]})}export{S as t};
1
+ import{o as e,r as t}from"./rolldown-runtime-DAXXjFlN.js";import{a as n,h as r,m as i,r as a,y as o}from"./vendor-react-BGDDiZfJ.js";import{f as s}from"./infrastructure-Bcx6-8du.js";import{R as c,l}from"./framework-B3O15Lsq.js";import{$n as u,Cc as d,Fo as f,Oi as p,Xa as m,Zs as h,ar as g,er as _,ns as v,sn as y}from"./ui-components-rkvkkTxO.js";import"./MetadataProvider-Cm9vi7AZ.js";import{n as b}from"./ui-layout-CAjjF5_S.js";import{r as x}from"./appRoute-CbCiASix.js";var S=t({SearchResultsPage:()=>O}),C=e(o(),1),w=a();function T(e){let t=[];for(let n of e)n.type===`group`&&n.children?t.push(...T(n.children)):t.push(n);return t}var E={object:v,dashboard:m,page:f,report:h},D={object:`bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200`,dashboard:`bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200`,page:`bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200`,report:`bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200`};function O(){let{t:e}=l(),{appName:t}=i(),[a,o]=r(),[f,m]=(0,C.useState)(a.get(`q`)||``),{apps:h}=c(),S=h||[],O=x(S,t)||S[0],k=`/apps/${t}`,{user:A}=s(),j=(0,C.useMemo)(()=>{if(!O)return[];let e=T(O.navigation||[]),t={currentUserId:A?.id??null};return e.map(e=>{let{href:n}=b(e,k,t);return{id:e.id,label:e.label||e.objectName||e.dashboardName||e.pageName||e.reportName||``,href:n,type:e.type,description:e.description}}).filter(e=>e.href!==`#`)},[O,k,A?.id]),M=(0,C.useMemo)(()=>{if(!f.trim())return j;let e=f.toLowerCase();return j.filter(t=>t.label.toLowerCase().includes(e)||t.type.toLowerCase().includes(e)||t.description&&t.description.toLowerCase().includes(e))},[j,f]),N=e=>{m(e),o(e?{q:e}:{})},P=(0,C.useMemo)(()=>{let e={};for(let t of M)(e[t.type]||=[]).push(t);return e},[M]);return(0,w.jsxs)(`div`,{className:`flex flex-col gap-6 p-4 sm:p-6 max-w-4xl mx-auto`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,w.jsxs)(n,{to:k,className:`flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground transition-colors`,children:[(0,w.jsx)(d,{className:`h-4 w-4`}),e(`search.back`)]}),(0,w.jsx)(`h1`,{className:`text-xl font-semibold`,children:e(`search.title`)})]}),(0,w.jsxs)(`div`,{className:`relative`,children:[(0,w.jsx)(`label`,{htmlFor:`search-results-input`,className:`sr-only`,children:e(`search.placeholder`)}),(0,w.jsx)(p,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`,"aria-hidden":`true`}),(0,w.jsx)(y,{id:`search-results-input`,value:f,onChange:e=>N(e.target.value),placeholder:e(`search.placeholder`),className:`pl-10 h-11 text-base`,autoFocus:!0})]}),(0,w.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:f.trim()?e(M.length===1?`search.resultsCount`:`search.resultsCountPlural`,{count:M.length,query:f}):e(`search.itemsAvailable`,{count:j.length})}),M.length===0?(0,w.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 text-center`,children:[(0,w.jsx)(p,{className:`h-12 w-12 text-muted-foreground/30 mb-4`}),(0,w.jsx)(`p`,{className:`text-lg font-medium text-muted-foreground`,children:e(`search.noResults`)}),(0,w.jsx)(`p`,{className:`text-sm text-muted-foreground/80 mt-1`,children:e(`search.noResultsHint`)})]}):(0,w.jsx)(`div`,{className:`space-y-6`,children:Object.entries(P).map(([t,r])=>{let i=E[t]||v,a=`search.type${t.charAt(0).toUpperCase()}${t.slice(1)}s`;return`${t.charAt(0).toUpperCase()}${t.slice(1)}`,(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`h2`,{className:`text-sm font-medium text-muted-foreground mb-2 flex items-center gap-1.5`,children:[(0,w.jsx)(i,{className:`h-4 w-4`}),e(a),(0,w.jsx)(g,{variant:`secondary`,className:`ml-1 text-xs`,children:r.length})]}),(0,w.jsx)(`div`,{className:`grid gap-2`,children:r.map(t=>{let r=E[t.type]||v,i=`search.badge${t.type.charAt(0).toUpperCase()}${t.type.slice(1)}`;return(0,w.jsx)(n,{to:t.href,className:`rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,children:(0,w.jsx)(u,{className:`hover:bg-accent/50 transition-colors cursor-pointer`,children:(0,w.jsxs)(_,{className:`flex items-center gap-3 p-3`,children:[(0,w.jsx)(`div`,{className:`flex h-8 w-8 items-center justify-center rounded ${D[t.type]||``}`,children:(0,w.jsx)(r,{className:`h-4 w-4`})}),(0,w.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,w.jsx)(`p`,{className:`text-sm font-medium truncate`,children:t.label}),t.description&&(0,w.jsx)(`p`,{className:`text-xs text-muted-foreground truncate`,children:t.description})]}),(0,w.jsx)(g,{variant:`outline`,className:`text-xs shrink-0`,children:e(i)})]})})},t.id)})})]},t)})})]})}export{S as t};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{f as t,m as n,r,y as i}from"./vendor-react-BGDDiZfJ.js";import{d as a}from"./infrastructure-Bcx6-8du.js";import{L as o}from"./framework-B3O15Lsq.js";import{$n as s,Ir as c,Lr as l,Ti as u,Ya as d,ar as f,bi as p,cc as m,ei as h,eo as g,er as _,ki as v,nr as y,ns as b,oc as x,oi as S,rr as C,tc as w,tr as T,za as E}from"./ui-components-rkvkkTxO.js";import"./src-BBieSqPB.js";var D=e(i(),1),O=r();function k(){let e=t(),{appName:r}=n(),i=r?`/apps/${r}`:``,k=o(),A=a(),[j,M]=(0,D.useState)({users:null,orgs:null,roles:null,permissions:null,auditLogs:null}),[N,P]=(0,D.useState)(!0),F=(0,D.useCallback)(async()=>{if(k){P(!0);try{let[e,t,n,r,i]=await Promise.all([k.find(`sys_user`).catch(()=>({data:[]})),k.find(`sys_org`).catch(()=>({data:[]})),k.find(`sys_role`).catch(()=>({data:[]})),k.find(`sys_permission`).catch(()=>({data:[]})),k.find(`sys_audit_log`).catch(()=>({data:[]}))]);M({users:e.data?.length??0,orgs:t.data?.length??0,roles:n.data?.length??0,permissions:r.data?.length??0,auditLogs:i.data?.length??0})}catch{}finally{P(!1)}}},[k]);(0,D.useEffect)(()=>{F()},[F]);let I=[{title:`Applications`,description:`Manage all configured applications`,icon:d,href:`${i}/system/apps`,countLabel:``,count:null},{title:`Metadata`,description:`Browse and edit every metadata type the platform exposes`,icon:b,href:`${i}/component/metadata/directory`,countLabel:``,count:null},{title:`Datasources`,description:`Connect external databases and sync their tables in as objects`,icon:x,href:`${i}/component/metadata/resource?type=datasource`,countLabel:``,count:null}],L=[{title:`Users`,description:`Manage system users and accounts`,icon:c,href:`${i}/system/users`,countLabel:`users`,count:j.users},{title:`Organizations`,description:`Manage organizations and teams`,icon:w,href:`${i}/system/organizations`,countLabel:`organizations`,count:j.orgs},{title:`Roles`,description:`Configure roles and access levels`,icon:p,href:`${i}/system/roles`,countLabel:`roles`,count:j.roles},{title:`Permissions`,description:`Manage permission rules and assignments`,icon:g,href:`${i}/system/permissions`,countLabel:`permissions`,count:j.permissions},{title:`Audit Log`,description:`View system activity and changes`,icon:v,href:`${i}/system/audit-log`,countLabel:`entries`,count:j.auditLogs},{title:`AI Approvals`,description:`Review actions AI agents propose before they execute`,icon:m,href:`${i}/system/ai-approvals`,countLabel:``,count:null},{title:`App Marketplace`,description:`Browse and install approved apps from the ObjectStack catalog`,icon:S,href:`${i}/system/marketplace`,countLabel:``,count:null,adminOnly:!0},{title:`Settings`,description:`Configure mail, branding, feature flags, and more`,icon:u,href:`${i}/system/settings`,countLabel:``,count:null},{title:`Developer`,description:`API console, flow runs, and public form management`,icon:h,href:`${i}/developer`,countLabel:``,count:null},{title:`Profile`,description:`View and edit your account settings`,icon:l,href:`${i}/system/profile`,countLabel:``,count:null}],R=[...I,...L].filter(e=>!e.adminOnly||A);return(0,O.jsxs)(`div`,{className:`flex flex-col gap-6 p-4 sm:p-6`,children:[(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsx)(`h1`,{className:`text-xl sm:text-2xl font-bold tracking-tight`,children:`System Settings`}),(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Manage applications, users, roles, permissions, and system configuration`})]}),N&&(0,O.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,role:`status`,"aria-live":`polite`,children:[(0,O.jsx)(E,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),`Loading statistics...`]}),(0,O.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:R.map(t=>{let n=t.icon;return(0,O.jsxs)(s,{className:`cursor-pointer transition-colors hover:bg-accent/50`,onClick:()=>e(t.href),"data-testid":`hub-card-${t.title.toLowerCase().replace(/\s+/g,`-`)}`,role:`link`,tabIndex:0,"aria-label":`${t.title}: ${t.description}`,onKeyDown:n=>{(n.key===`Enter`||n.key===` `)&&(n.preventDefault(),e(t.href))},children:[(0,O.jsxs)(y,{className:`flex flex-row items-center gap-3 pb-2`,children:[(0,O.jsx)(`div`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary`,children:(0,O.jsx)(n,{className:`h-5 w-5`})}),(0,O.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,O.jsx)(C,{className:`text-base`,children:t.title}),(0,O.jsx)(T,{className:`text-xs`,children:t.description})]})]}),(0,O.jsx)(_,{className:`pt-0`,children:t.count!==null&&(0,O.jsxs)(f,{variant:`secondary`,children:[t.count,` `,t.countLabel]})})]},t.title)})})]})}export{k as SystemHubPage};
1
+ import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{f as t,m as n,r,y as i}from"./vendor-react-BGDDiZfJ.js";import{d as a}from"./infrastructure-Bcx6-8du.js";import{L as o}from"./framework-B3O15Lsq.js";import{$n as s,Ir as c,Lr as l,Ti as u,Ya as d,ar as f,bi as p,cc as m,ei as h,eo as g,er as _,ki as v,nr as y,ns as b,oc as x,oi as S,rr as C,tc as w,tr as T,za as E}from"./ui-components-rkvkkTxO.js";import"./src--WewDM7z.js";var D=e(i(),1),O=r();function k(){let e=t(),{appName:r}=n(),i=r?`/apps/${r}`:``,k=o(),A=a(),[j,M]=(0,D.useState)({users:null,orgs:null,roles:null,permissions:null,auditLogs:null}),[N,P]=(0,D.useState)(!0),F=(0,D.useCallback)(async()=>{if(k){P(!0);try{let[e,t,n,r,i]=await Promise.all([k.find(`sys_user`).catch(()=>({data:[]})),k.find(`sys_org`).catch(()=>({data:[]})),k.find(`sys_role`).catch(()=>({data:[]})),k.find(`sys_permission`).catch(()=>({data:[]})),k.find(`sys_audit_log`).catch(()=>({data:[]}))]);M({users:e.data?.length??0,orgs:t.data?.length??0,roles:n.data?.length??0,permissions:r.data?.length??0,auditLogs:i.data?.length??0})}catch{}finally{P(!1)}}},[k]);(0,D.useEffect)(()=>{F()},[F]);let I=[{title:`Applications`,description:`Manage all configured applications`,icon:d,href:`${i}/system/apps`,countLabel:``,count:null},{title:`Metadata`,description:`Browse and edit every metadata type the platform exposes`,icon:b,href:`${i}/component/metadata/directory`,countLabel:``,count:null},{title:`Datasources`,description:`Connect external databases and sync their tables in as objects`,icon:x,href:`${i}/component/metadata/resource?type=datasource`,countLabel:``,count:null}],L=[{title:`Users`,description:`Manage system users and accounts`,icon:c,href:`${i}/system/users`,countLabel:`users`,count:j.users},{title:`Organizations`,description:`Manage organizations and teams`,icon:w,href:`${i}/system/organizations`,countLabel:`organizations`,count:j.orgs},{title:`Roles`,description:`Configure roles and access levels`,icon:p,href:`${i}/system/roles`,countLabel:`roles`,count:j.roles},{title:`Permissions`,description:`Manage permission rules and assignments`,icon:g,href:`${i}/system/permissions`,countLabel:`permissions`,count:j.permissions},{title:`Audit Log`,description:`View system activity and changes`,icon:v,href:`${i}/system/audit-log`,countLabel:`entries`,count:j.auditLogs},{title:`AI Approvals`,description:`Review actions AI agents propose before they execute`,icon:m,href:`${i}/system/ai-approvals`,countLabel:``,count:null},{title:`App Marketplace`,description:`Browse and install approved apps from the ObjectStack catalog`,icon:S,href:`${i}/system/marketplace`,countLabel:``,count:null,adminOnly:!0},{title:`Settings`,description:`Configure mail, branding, feature flags, and more`,icon:u,href:`${i}/system/settings`,countLabel:``,count:null},{title:`Developer`,description:`API console, flow runs, and public form management`,icon:h,href:`${i}/developer`,countLabel:``,count:null},{title:`Profile`,description:`View and edit your account settings`,icon:l,href:`${i}/system/profile`,countLabel:``,count:null}],R=[...I,...L].filter(e=>!e.adminOnly||A);return(0,O.jsxs)(`div`,{className:`flex flex-col gap-6 p-4 sm:p-6`,children:[(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsx)(`h1`,{className:`text-xl sm:text-2xl font-bold tracking-tight`,children:`System Settings`}),(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Manage applications, users, roles, permissions, and system configuration`})]}),N&&(0,O.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,role:`status`,"aria-live":`polite`,children:[(0,O.jsx)(E,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),`Loading statistics...`]}),(0,O.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:R.map(t=>{let n=t.icon;return(0,O.jsxs)(s,{className:`cursor-pointer transition-colors hover:bg-accent/50`,onClick:()=>e(t.href),"data-testid":`hub-card-${t.title.toLowerCase().replace(/\s+/g,`-`)}`,role:`link`,tabIndex:0,"aria-label":`${t.title}: ${t.description}`,onKeyDown:n=>{(n.key===`Enter`||n.key===` `)&&(n.preventDefault(),e(t.href))},children:[(0,O.jsxs)(y,{className:`flex flex-row items-center gap-3 pb-2`,children:[(0,O.jsx)(`div`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary`,children:(0,O.jsx)(n,{className:`h-5 w-5`})}),(0,O.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,O.jsx)(C,{className:`text-base`,children:t.title}),(0,O.jsx)(T,{className:`text-xs`,children:t.description})]})]}),(0,O.jsx)(_,{className:`pt-0`,children:t.count!==null&&(0,O.jsxs)(f,{variant:`secondary`,children:[t.count,` `,t.countLabel]})})]},t.title)})})]})}export{k as SystemHubPage};