@blinkk/root-cms 3.1.1 → 3.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/dist/app.js +1 -1
  2. package/dist/{chunk-GXV4UQ6Z.js → chunk-4G7S2LJH.js} +2 -2
  3. package/dist/core/plugin.d.ts +1 -1
  4. package/dist/core/translations.d.ts +19 -4
  5. package/dist/plugin.js +34 -4
  6. package/dist/shared/translation-languages.d.ts +67 -0
  7. package/dist/ui/AIPage-VOTAEVJE.js +1 -0
  8. package/dist/ui/AssetsPage-EWGRMRPJ.js +1 -0
  9. package/dist/ui/{CollectionPage-CU3VDEXA.js → CollectionPage-N5JIAUDS.js} +1 -1
  10. package/dist/ui/ComparePage-JDPVU2VA.js +1 -0
  11. package/dist/ui/{DataPage-XIXFKXDN.js → DataPage-37D4CMLZ.js} +1 -1
  12. package/dist/ui/{DataSourcePage-ORIEQH3Y.js → DataSourcePage-LX5ASYQN.js} +1 -1
  13. package/dist/ui/DocTranslationsPage-V5M4KB7X.js +1 -0
  14. package/dist/ui/DocumentPage-SURTQJPG.js +1 -0
  15. package/dist/ui/{EditDataSourcePage-HIGZZQJC.js → EditDataSourcePage-O7DOV5LX.js} +1 -1
  16. package/dist/ui/{EditReleasePage-KUHBU2HQ.js → EditReleasePage-NDYTKGXY.js} +1 -1
  17. package/dist/ui/{EmbeddedAIPage-CJWZE5FC.js → EmbeddedAIPage-RJOUIPF2.js} +1 -1
  18. package/dist/ui/EmbeddedDocumentPage-SLEULNNI.js +1 -0
  19. package/dist/ui/LogsPage-ZGBP3I35.js +1 -0
  20. package/dist/ui/{NewDataSourcePage-7TUUE6ZL.js → NewDataSourcePage-GQONTMP4.js} +1 -1
  21. package/dist/ui/NewReleasePage-7ZKXHDTD.js +1 -0
  22. package/dist/ui/{NotFoundPage-AW6UC6II.js → NotFoundPage-WXEZQZK6.js} +1 -1
  23. package/dist/ui/ProjectPage-F7W7X6YO.js +1 -0
  24. package/dist/ui/{ReleasePage-W2R3DIFX.js → ReleasePage-ZKMNYPML.js} +1 -1
  25. package/dist/ui/{ReleasesPage-HBBUGE7D.js → ReleasesPage-JHCE6AEJ.js} +1 -1
  26. package/dist/ui/SettingsPage-MWCPZPGE.js +1 -0
  27. package/dist/ui/SidebarToolsPage-API53RRR.js +1 -0
  28. package/dist/ui/TaskPage-73NLAR4J.js +1 -0
  29. package/dist/ui/TasksPage-IKPW2OQO.js +1 -0
  30. package/dist/ui/{TranslationsArbPage-AJLM5VSD.js → TranslationsArbPage-QVN66DIW.js} +1 -1
  31. package/dist/ui/TranslationsEditPage-ZOELF5PK.js +1 -0
  32. package/dist/ui/{TranslationsPage-HPYAJQ4Q.js → TranslationsPage-NGGZB4L6.js} +32 -32
  33. package/dist/ui/{chunk-3T4ZWQR4.js → chunk-2EPQJUGM.js} +1 -1
  34. package/dist/ui/{chunk-2KSMCQ6H.js → chunk-2RAVKX2Z.js} +1 -1
  35. package/dist/ui/{chunk-B6M55OFE.js → chunk-4FGASIIX.js} +1 -1
  36. package/dist/ui/chunk-AAHM6RYJ.js +1 -0
  37. package/dist/ui/{chunk-OXVYTSIZ.js → chunk-BOER3EAW.js} +1 -1
  38. package/dist/ui/{chunk-GU24U5RM.js → chunk-BT2NTAW2.js} +1 -1
  39. package/dist/ui/chunk-BUNR5EU3.js +1 -0
  40. package/dist/ui/{chunk-O5P3CPJ4.js → chunk-BW2MKGNP.js} +1 -1
  41. package/dist/ui/chunk-C2BLMTPR.js +3 -0
  42. package/dist/ui/{chunk-RAXWL656.js → chunk-DIFPCF7I.js} +1 -1
  43. package/dist/ui/{chunk-R6B3W5AJ.js → chunk-DS27MO63.js} +1 -1
  44. package/dist/ui/{chunk-MZTOPPWQ.js → chunk-ENQKSLGJ.js} +1 -1
  45. package/dist/ui/chunk-FXIR2RBE.js +1 -0
  46. package/dist/ui/chunk-G5ZZDHWA.js +1 -0
  47. package/dist/ui/{chunk-76ZGLKLT.js → chunk-GT5EQSEX.js} +1 -1
  48. package/dist/ui/{chunk-AZCGXQTL.js → chunk-IOR72US3.js} +1 -1
  49. package/dist/ui/{chunk-XT5FNJCX.js → chunk-MSYTAJBV.js} +1 -1
  50. package/dist/ui/{chunk-E76ECIOX.js → chunk-NJMNOITA.js} +1 -1
  51. package/dist/ui/chunk-NSI5JSVV.js +1 -0
  52. package/dist/ui/{chunk-OWQL5DVE.js → chunk-PPYM4O5N.js} +1 -1
  53. package/dist/ui/{chunk-WKF7CSWS.js → chunk-QF3GPZTI.js} +1 -1
  54. package/dist/ui/{chunk-TDUBSLEC.js → chunk-T77VOWHP.js} +1 -1
  55. package/dist/ui/chunk-TOGLZDK3.js +1 -0
  56. package/dist/ui/{chunk-V4CTOC6E.js → chunk-TPJCPCRR.js} +1 -1
  57. package/dist/ui/{chunk-GQ5IRK43.js → chunk-TVYAZN2Q.js} +1 -1
  58. package/dist/ui/chunk-UPDL6UXI.js +1 -0
  59. package/dist/ui/{chunk-764W6634.js → chunk-VPHBKJ3I.js} +1 -1
  60. package/dist/ui/{chunk-U7PWJV6F.js → chunk-W6LP22IK.js} +1 -1
  61. package/dist/ui/{chunk-WXT7LTQM.js → chunk-WYJJZTCI.js} +1 -1
  62. package/dist/ui/chunk-Y3MCFLQU.js +141 -0
  63. package/dist/ui/chunk-YUU6LWQK.js +1 -0
  64. package/dist/ui/chunk-Z6DBYLIM.js +1 -0
  65. package/dist/ui/chunk-ZMS6NIGG.js +1 -0
  66. package/dist/ui/ui.css +1 -1
  67. package/dist/ui/ui.js +1 -1
  68. package/package.json +3 -3
  69. package/dist/ui/AIPage-EL6DQYII.js +0 -1
  70. package/dist/ui/AssetsPage-5S6PNMF6.js +0 -1
  71. package/dist/ui/ComparePage-FTZLYO2O.js +0 -1
  72. package/dist/ui/DocTranslationsPage-4OVBIPSG.js +0 -1
  73. package/dist/ui/DocumentPage-3JPFJF3E.js +0 -1
  74. package/dist/ui/EmbeddedDocumentPage-6XQHYIAO.js +0 -1
  75. package/dist/ui/LogsPage-4DVGYXZY.js +0 -1
  76. package/dist/ui/NewReleasePage-6UT36HDW.js +0 -1
  77. package/dist/ui/ProjectPage-US5FJGFK.js +0 -1
  78. package/dist/ui/SettingsPage-7JQQILUV.js +0 -1
  79. package/dist/ui/SidebarToolsPage-MIYXKHF2.js +0 -1
  80. package/dist/ui/TaskPage-JYUQEGRB.js +0 -1
  81. package/dist/ui/TasksPage-4VFQF243.js +0 -1
  82. package/dist/ui/TranslationsEditPage-RTTGTIGI.js +0 -1
  83. package/dist/ui/chunk-5AVRMJVW.js +0 -1
  84. package/dist/ui/chunk-FFHV5S6A.js +0 -1
  85. package/dist/ui/chunk-FSVNOZ6F.js +0 -1
  86. package/dist/ui/chunk-GDXNSFLE.js +0 -1
  87. package/dist/ui/chunk-M3T56ZRP.js +0 -1
  88. package/dist/ui/chunk-MXGHX55S.js +0 -141
  89. package/dist/ui/chunk-QEE7XS6O.js +0 -1
  90. package/dist/ui/chunk-SRX7EWL4.js +0 -1
  91. package/dist/ui/chunk-TFB3VGWP.js +0 -1
  92. package/dist/ui/chunk-YLSRRNSE.js +0 -1
  93. package/dist/ui/chunk-ZN2Y5OUF.js +0 -3
  94. /package/dist/ui/{chunk-E76ECIOX.js.LEGAL.txt → chunk-NJMNOITA.js.LEGAL.txt} +0 -0
  95. /package/dist/ui/{chunk-MXGHX55S.js.LEGAL.txt → chunk-Y3MCFLQU.js.LEGAL.txt} +0 -0
@@ -1,4 +1,4 @@
1
- import{f as k}from"./chunk-5MV6XVGA.js";import{f as b}from"./chunk-YLSRRNSE.js";import{Ga as a,a as M,c as y,e as z,g as P,j as O}from"./chunk-LROR6N3B.js";var L=class{diff(e,o,n={}){let i;typeof n=="function"?(i=n,n={}):"callback"in n&&(i=n.callback);let l=this.castInput(e,n),c=this.castInput(o,n),h=this.removeEmpty(this.tokenize(l,n)),r=this.removeEmpty(this.tokenize(c,n));return this.diffWithOptionsObj(h,r,n,i)}diffWithOptionsObj(e,o,n,i){var l;let c=t=>{if(t=this.postProcess(t,n),i){setTimeout(function(){i(t)},0);return}else return t},h=o.length,r=e.length,s=1,f=h+r;n.maxEditLength!=null&&(f=Math.min(f,n.maxEditLength));let m=(l=n.timeout)!==null&&l!==void 0?l:1/0,g=Date.now()+m,d=[{oldPos:-1,lastComponent:void 0}],u=this.extractCommon(d[0],o,e,0,n);if(d[0].oldPos+1>=r&&u+1>=h)return c(this.buildValues(d[0].lastComponent,o,e));let x=-1/0,p=1/0,_=()=>{for(let t=Math.max(x,-s);t<=Math.min(p,s);t+=2){let C,w=d[t-1],D=d[t+1];w&&(d[t-1]=void 0);let J=!1;if(D){let I=D.oldPos-t;J=D&&0<=I&&I<h}let T=w&&w.oldPos+1<r;if(!J&&!T){d[t]=void 0;continue}if(!T||J&&w.oldPos<D.oldPos?C=this.addToPath(D,!0,!1,0,n):C=this.addToPath(w,!1,!0,1,n),u=this.extractCommon(C,o,e,t,n),C.oldPos+1>=r&&u+1>=h)return c(this.buildValues(C.lastComponent,o,e))||!0;d[t]=C,C.oldPos+1>=r&&(p=Math.min(p,t-1)),u+1>=h&&(x=Math.max(x,t+1))}s++};if(i)(function t(){setTimeout(function(){if(s>f||Date.now()>g)return i(void 0);_()||t()},0)})();else for(;s<=f&&Date.now()<=g;){let t=_();if(t)return t}}addToPath(e,o,n,i,l){let c=e.lastComponent;return c&&!l.oneChangePerToken&&c.added===o&&c.removed===n?{oldPos:e.oldPos+i,lastComponent:{count:c.count+1,added:o,removed:n,previousComponent:c.previousComponent}}:{oldPos:e.oldPos+i,lastComponent:{count:1,added:o,removed:n,previousComponent:c}}}extractCommon(e,o,n,i,l){let c=o.length,h=n.length,r=e.oldPos,s=r-i,f=0;for(;s+1<c&&r+1<h&&this.equals(n[r+1],o[s+1],l);)s++,r++,f++,l.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return f&&!l.oneChangePerToken&&(e.lastComponent={count:f,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=r,s}equals(e,o,n){return n.comparator?n.comparator(e,o):e===o||!!n.ignoreCase&&e.toLowerCase()===o.toLowerCase()}removeEmpty(e){let o=[];for(let n=0;n<e.length;n++)e[n]&&o.push(e[n]);return o}castInput(e,o){return e}tokenize(e,o){return Array.from(e)}join(e){return e.join("")}postProcess(e,o){return e}get useLongestToken(){return!1}buildValues(e,o,n){let i=[],l;for(;e;)i.push(e),l=e.previousComponent,delete e.previousComponent,e=l;i.reverse();let c=i.length,h=0,r=0,s=0;for(;h<c;h++){let f=i[h];if(f.removed)f.value=this.join(n.slice(s,s+f.count)),s+=f.count;else{if(!f.added&&this.useLongestToken){let m=o.slice(r,r+f.count);m=m.map(function(g,d){let u=n[s+d];return u.length>g.length?u:g}),f.value=this.join(m)}else f.value=this.join(o.slice(r,r+f.count));r+=f.count,f.added||(s+=f.count)}}return i}};var N=class extends L{constructor(){super(...arguments),this.tokenize=A}equals(e,o,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
1
+ import{f as k}from"./chunk-5MV6XVGA.js";import{e as b}from"./chunk-BUNR5EU3.js";import{Ga as a,a as M,c as y,e as z,g as P,j as O}from"./chunk-LROR6N3B.js";var L=class{diff(e,o,n={}){let i;typeof n=="function"?(i=n,n={}):"callback"in n&&(i=n.callback);let l=this.castInput(e,n),c=this.castInput(o,n),h=this.removeEmpty(this.tokenize(l,n)),r=this.removeEmpty(this.tokenize(c,n));return this.diffWithOptionsObj(h,r,n,i)}diffWithOptionsObj(e,o,n,i){var l;let c=t=>{if(t=this.postProcess(t,n),i){setTimeout(function(){i(t)},0);return}else return t},h=o.length,r=e.length,s=1,f=h+r;n.maxEditLength!=null&&(f=Math.min(f,n.maxEditLength));let m=(l=n.timeout)!==null&&l!==void 0?l:1/0,g=Date.now()+m,d=[{oldPos:-1,lastComponent:void 0}],u=this.extractCommon(d[0],o,e,0,n);if(d[0].oldPos+1>=r&&u+1>=h)return c(this.buildValues(d[0].lastComponent,o,e));let x=-1/0,p=1/0,_=()=>{for(let t=Math.max(x,-s);t<=Math.min(p,s);t+=2){let C,w=d[t-1],D=d[t+1];w&&(d[t-1]=void 0);let J=!1;if(D){let I=D.oldPos-t;J=D&&0<=I&&I<h}let T=w&&w.oldPos+1<r;if(!J&&!T){d[t]=void 0;continue}if(!T||J&&w.oldPos<D.oldPos?C=this.addToPath(D,!0,!1,0,n):C=this.addToPath(w,!1,!0,1,n),u=this.extractCommon(C,o,e,t,n),C.oldPos+1>=r&&u+1>=h)return c(this.buildValues(C.lastComponent,o,e))||!0;d[t]=C,C.oldPos+1>=r&&(p=Math.min(p,t-1)),u+1>=h&&(x=Math.max(x,t+1))}s++};if(i)(function t(){setTimeout(function(){if(s>f||Date.now()>g)return i(void 0);_()||t()},0)})();else for(;s<=f&&Date.now()<=g;){let t=_();if(t)return t}}addToPath(e,o,n,i,l){let c=e.lastComponent;return c&&!l.oneChangePerToken&&c.added===o&&c.removed===n?{oldPos:e.oldPos+i,lastComponent:{count:c.count+1,added:o,removed:n,previousComponent:c.previousComponent}}:{oldPos:e.oldPos+i,lastComponent:{count:1,added:o,removed:n,previousComponent:c}}}extractCommon(e,o,n,i,l){let c=o.length,h=n.length,r=e.oldPos,s=r-i,f=0;for(;s+1<c&&r+1<h&&this.equals(n[r+1],o[s+1],l);)s++,r++,f++,l.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return f&&!l.oneChangePerToken&&(e.lastComponent={count:f,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=r,s}equals(e,o,n){return n.comparator?n.comparator(e,o):e===o||!!n.ignoreCase&&e.toLowerCase()===o.toLowerCase()}removeEmpty(e){let o=[];for(let n=0;n<e.length;n++)e[n]&&o.push(e[n]);return o}castInput(e,o){return e}tokenize(e,o){return Array.from(e)}join(e){return e.join("")}postProcess(e,o){return e}get useLongestToken(){return!1}buildValues(e,o,n){let i=[],l;for(;e;)i.push(e),l=e.previousComponent,delete e.previousComponent,e=l;i.reverse();let c=i.length,h=0,r=0,s=0;for(;h<c;h++){let f=i[h];if(f.removed)f.value=this.join(n.slice(s,s+f.count)),s+=f.count;else{if(!f.added&&this.useLongestToken){let m=o.slice(r,r+f.count);m=m.map(function(g,d){let u=n[s+d];return u.length>g.length?u:g}),f.value=this.join(m)}else f.value=this.join(o.slice(r,r+f.count));r+=f.count,f.added||(s+=f.count)}}return i}};var N=class extends L{constructor(){super(...arguments),this.tokenize=A}equals(e,o,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
2
2
  `))&&(e=e.trim()),(!n.newlineIsToken||!o.includes(`
3
3
  `))&&(o=o.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
4
4
  `)&&(e=e.slice(0,-1)),o.endsWith(`
@@ -1,4 +1,4 @@
1
- import{a as pt,b as ht,c as ut,d as tt}from"./chunk-HO3W4RVG.js";import{a as dt}from"./chunk-3T4ZWQR4.js";import{a as mt,c as Z}from"./chunk-E76ECIOX.js";import{b as ct,d as _t}from"./chunk-344GZOGG.js";import{f as K}from"./chunk-5MV6XVGA.js";import{d as at,f as M}from"./chunk-YLSRRNSE.js";import{$a as Y,Dc as st,Fa as O,Ga as t,Rc as lt,V,W as E,Yc as B,Za as q,_a as X,a as p,ba as J,c as k,da as S,e as N,g as ot,gc as G,h as T,j as At,lb as it,lc as Q,mc as rt,qa as $,xc as j}from"./chunk-LROR6N3B.js";import{d as et}from"./chunk-KUCVLANF.js";import{h as nt}from"./chunk-7SK47HHZ.js";At();function ft(o){let{size:e=14}=o,a=e*3.57,i=e*2;return t("div",{className:"BouncingLoader",style:{"--dot-size":`${e}px`,width:`${a}px`,height:`${i}px`}})}var W=[{id:"read",label:"Read only",description:"Inspect CMS content without planning or applying writes."},{id:"approve",label:"Ask before writing",description:"Read freely, then pause for approval before draft edits."},{id:"auto",label:"Auto-apply draft edits",description:"Apply draft-only writes without approval in this chat."}],It="root-cms.ai.executionMode",vt="root-cms.ai.selectedModel";function bt(o){return W.some(e=>e.id===o)}function Rt(){if(typeof window>"u")return"approve";try{let o=window.localStorage.getItem(It);if(bt(o))return o}catch(o){console.error("failed to read AI execution mode preference",o)}return"approve"}function yt(o){if(typeof window>"u")return null;try{let e=window.localStorage.getItem(vt);if(e&&o.some(a=>a.id===e))return e}catch(e){console.error("failed to read AI model preference",e)}return null}function wt(o){if(!(typeof window>"u"))try{window.localStorage.setItem(vt,o)}catch(e){console.error("failed to save AI model preference",e)}}function kt(o){if(!(typeof window>"u"))try{window.localStorage.setItem(It,o)}catch(e){console.error("failed to save AI execution mode preference",e)}}var U="";function Ie(o){let[e,a]=p(null),[i,m]=p("");k(()=>{let r=!0;return fetch("/cms/api/ai.config",{credentials:"include"}).then(async l=>{let g=await l.json();r&&a(g)}).catch(l=>{r&&m(String(l))}),()=>{r=!1}},[]);let h=!!e?.enabled&&(e.models?.length||0)>0;return t("div",{className:M("RootAIChat",`RootAIChat--${o.variant}`),children:!e&&!i?t("div",{className:"RootAIChat__loading",children:t(V,{size:"md",color:"gray"})}):h?t(Mt,{variant:o.variant,config:e,initialChatId:o.variant==="panel"?void 0:o.initialChatId,docContext:o.docContext,onClose:o.onClose}):t(Nt,{error:i,onClose:o.onClose})})}function Nt(o){return t("div",{className:"RootAIChat__notEnabled",children:[o.onClose&&t(E,{className:"RootAIChat__notEnabled__close",onClick:o.onClose,title:"Close",children:t(B,{size:16})}),t("div",{className:"RootAIChat__notEnabled__icon",children:t(j,{size:36})}),t("div",{className:"RootAIChat__notEnabled__title",children:"Root AI is not configured for this project."}),t("div",{className:"RootAIChat__notEnabled__body",children:["Add an ",t("code",{children:"ai.models"})," entry to ",t("code",{children:"cmsPlugin()"})," in"," ",t("code",{children:"root.config.ts"}),"."]}),o.error&&t("pre",{className:"RootAIChat__notEnabled__error",children:o.error})]})}function Mt(o){let e=o.variant==="panel",{route:a}=at(),i=o.config.models||[],m=()=>yt(i)||o.config.defaultModel||i[0]?.id||"",[h,r]=p(m),[l,g]=p(Rt),[u,I]=p(o.initialChatId||U),[P,y]=p(o.initialChatId||U),[D,s]=p([]),[f,x]=p([]),[v,w]=p(0),z=async()=>{if(!e)try{let R=await(await fetch("/cms/api/ai.chats.list",{method:"POST",credentials:"include",headers:{"content-type":"application/json"},body:JSON.stringify({})})).json();R.success&&x(R.chats||[])}catch(d){console.error("failed to load chat list",d)}};k(()=>{z(),!e&&o.initialChatId&&n(o.initialChatId)},[]),k(()=>{kt(l)},[l]);let n=async d=>{try{let b=await(await fetch("/cms/api/ai.chats.get",{method:"POST",credentials:"include",headers:{"content-type":"application/json"},body:JSON.stringify({id:d})})).json();if(!b.success)return;I(d),y(d),s(b.chat.messages||[]),b.chat.modelId&&i.find(F=>F.id===b.chat.modelId)&&r(b.chat.modelId),w(L=>L+1)}catch(R){console.error("failed to load chat",R)}},_=()=>{r(m()),I(U),y(U),s([]),w(d=>d+1),e||a("/cms/ai")},c=async d=>{if(d!==P)try{let b=await(await fetch("/cms/api/ai.chats.get",{method:"POST",credentials:"include",headers:{"content-type":"application/json"},body:JSON.stringify({id:d})})).json();if(!b.success)return;I(d),y(d),s(b.chat.messages||[]),b.chat.modelId&&i.find(F=>F.id===b.chat.modelId)&&r(b.chat.modelId),w(L=>L+1),e||a(`/cms/ai/chat/${d}`)}catch(R){console.error("failed to load chat",R)}},C=async d=>{try{await fetch("/cms/api/ai.chats.delete",{method:"POST",credentials:"include",headers:{"content-type":"application/json"},body:JSON.stringify({id:d})}),P===d&&_(),z()}catch(R){console.error("failed to delete chat",R)}},A=i.find(d=>d.id===h)||i[0],H=d=>{r(d),wt(d)};return t("div",{className:"RootAIChat__layout",children:[!e&&t(Tt,{chats:f,activeChatId:P,onSelect:c,onNew:_,onDelete:C}),t("div",{className:"RootAIChat__main",children:[e&&t(Pt,{onNewChat:_,onClose:o.onClose}),t(zt,{initialChatId:u,model:A,initialMessages:D,executionMode:l,models:i,selectedModel:A,docContext:o.docContext,onSelectModel:H,onSelectExecutionMode:g,onChatPersisted:d=>{y(d),z(),e||window.history.replaceState(null,"",`/cms/ai/chat/${d}`)}},v)]})]})}function Pt(o){return t("div",{className:"RootAIChat__panelHeader",children:[t("div",{className:"RootAIChat__panelHeader__title",children:[t(j,{size:14}),t("span",{children:"Root AI"})]}),t("div",{className:"RootAIChat__panelHeader__actions",children:[t(O,{label:"New chat",children:t(E,{size:"xs",onClick:o.onNewChat,children:t(G,{size:14})})}),o.onClose&&t(O,{label:"Close (\u2318 + i)",children:t(E,{size:"xs",onClick:o.onClose,children:t(B,{size:14})})})]})]})}function Tt(o){return t("aside",{className:"RootAIChat__sidebar",children:[t("button",{type:"button",className:"RootAIChat__sidebar__newButton",onClick:o.onNew,children:[t(G,{size:18}),t("span",{children:"New chat"})]}),t("div",{className:"RootAIChat__sidebar__list",children:[o.chats.length===0&&t("div",{className:"RootAIChat__sidebar__empty",children:"No chats yet."}),o.chats.map(e=>t("div",{className:M("RootAIChat__sidebar__item",e.id===o.activeChatId&&"RootAIChat__sidebar__item--active"),onClick:()=>o.onSelect(e.id),children:[t("div",{className:"RootAIChat__sidebar__item__title",title:e.title||"Untitled chat",children:e.title||"Untitled chat"}),t("button",{type:"button",className:"RootAIChat__sidebar__item__delete",title:"Delete chat",onClick:a=>{a.stopPropagation(),window.confirm("Delete this chat?")&&o.onDelete(e.id)},children:t(lt,{size:14})})]},e.id))]})]})}function Et(o){let e=W.find(a=>a.id===o.executionMode)||W[0];return t("div",{className:"RootAIChat__options",children:[t($,{control:t(S,{type:"button",className:"RootAIChat__modePicker",variant:"subtle",color:"dark",size:"xs",compact:!0,leftIcon:t(rt,{size:16}),children:e.label}),children:W.map(a=>t($.Item,{onClick:()=>o.onSelectExecutionMode(a.id),children:t("div",{className:"RootAIChat__modePicker__option",children:[t("div",{className:"RootAIChat__modePicker__option__label",children:a.label}),t("div",{className:"RootAIChat__modePicker__option__description",children:a.description})]})},a.id))}),t($,{control:t(S,{type:"button",className:"RootAIChat__modelPicker",variant:"subtle",color:"dark",size:"xs",compact:!0,leftIcon:t(j,{size:16}),children:o.selectedModel?.label||"Select model"}),children:o.models.map(a=>t($.Item,{onClick:()=>o.onSelectModel(a.id),children:t("div",{className:"RootAIChat__modelPicker__option",children:[t("div",{className:"RootAIChat__modelPicker__option__label",children:a.label}),a.description&&t("div",{className:"RootAIChat__modelPicker__option__description",children:a.description})]})},a.id))})]})}function zt(o){let[e]=p(()=>o.initialChatId||Gt()),a=N(o.model?.id);a.current=o.model?.id;let i=N(o.executionMode);i.current=o.executionMode;let m=N(o.docContext);m.current=o.docContext;let[h,r]=p({}),l=N({});k(()=>()=>{for(let n of Object.values(l.current))n("reject");l.current={}},[]);let g=T((n,_,c,C)=>new Promise(A=>{l.current[n]=A,r(H=>({...H,[n]:{toolCallId:n,toolName:_,input:c,preview:C,status:"pending"}}))}),[]),u=T(n=>{r(_=>{let c=_[n];return c?{..._,[n]:{...c,status:"executing"}}:_}),l.current[n]?.("approve"),delete l.current[n]},[]),I=T(n=>{r(_=>{let c={..._};return delete c[n],c}),l.current[n]?.("reject"),delete l.current[n]},[]),P=T(async n=>{if(!ht(n.toolName))return await tt(n.toolName,n.input);let _=i.current;if(_==="read")return{success:!1,error:"WRITE_BLOCKED_BY_MODE",message:"The current execution mode is read only. Do not call write tools."};let c;try{c=await ut(n.toolName,n.input)}catch(C){return{success:!1,error:"PREVIEW_FAILED",message:C?.message||String(C)}}if(c.error)return{success:!1,error:c.error,message:c.summary,errors:c.errors,hint:c.hint};if(_==="approve"&&await g(n.toolCallId,n.toolName,n.input,c)==="reject")return{success:!1,error:"USER_REJECTED",message:"The user rejected this draft change. Do not retry unless they ask for a revised version."};try{return await tt(n.toolName,n.input)}finally{r(C=>{if(!C[n.toolCallId])return C;let A={...C};return delete A[n.toolCallId],A})}},[g]),y=ot(()=>new ct({api:"/cms/api/ai.chat",credentials:"include",prepareSendMessagesRequest:({messages:n})=>({body:{message:n.at(-1),chatId:e,modelId:a.current,executionMode:i.current,docId:m.current?.docId}})}),[e]),{messages:D,sendMessage:s,status:f,error:x,stop:v,addToolOutput:w}=pt({id:e,messages:o.initialMessages,transport:y,sendAutomaticallyWhen:_t,onToolCall:async({toolCall:n})=>{let _=await P(n);w({tool:n.toolName,toolCallId:n.toolCallId,output:_})},onFinish:()=>{o.onChatPersisted(e)}}),z=f==="streaming"||f==="submitted";return t(et,{children:[t(St,{messages:D,isStreaming:z,emptyMessage:o.model?void 0:"Select a model to start.",toolApprovals:{approvals:h,onApprove:u,onReject:I}}),x&&t("div",{className:"RootAIChat__error",children:[t("strong",{children:"Error:"})," ",x.message]}),t(Vt,{disabled:!o.model,canAttach:o.model?.capabilities.attachments??!1,isStreaming:z,onStop:v,controls:t(Et,{models:o.models,selectedModel:o.selectedModel,onSelectModel:o.onSelectModel,executionMode:o.executionMode,onSelectExecutionMode:o.onSelectExecutionMode}),onSend:(n,_)=>{if(!n&&_.length===0)return;let c=Jt(_),C=[n,c.text].filter(Boolean).join(`
1
+ import{a as pt,b as ht,c as ut,d as tt}from"./chunk-HO3W4RVG.js";import{a as dt}from"./chunk-2EPQJUGM.js";import{a as mt,c as Z}from"./chunk-NJMNOITA.js";import{b as ct,d as _t}from"./chunk-344GZOGG.js";import{f as K}from"./chunk-5MV6XVGA.js";import{d as at,e as M}from"./chunk-BUNR5EU3.js";import{$a as Y,Dc as st,Fa as O,Ga as t,Rc as lt,V,W as E,Yc as B,Za as q,_a as X,a as p,ba as J,c as k,da as S,e as N,g as ot,gc as G,h as T,j as At,lb as it,lc as Q,mc as rt,qa as $,xc as j}from"./chunk-LROR6N3B.js";import{d as et}from"./chunk-KUCVLANF.js";import{h as nt}from"./chunk-7SK47HHZ.js";At();function ft(o){let{size:e=14}=o,a=e*3.57,i=e*2;return t("div",{className:"BouncingLoader",style:{"--dot-size":`${e}px`,width:`${a}px`,height:`${i}px`}})}var W=[{id:"read",label:"Read only",description:"Inspect CMS content without planning or applying writes."},{id:"approve",label:"Ask before writing",description:"Read freely, then pause for approval before draft edits."},{id:"auto",label:"Auto-apply draft edits",description:"Apply draft-only writes without approval in this chat."}],It="root-cms.ai.executionMode",vt="root-cms.ai.selectedModel";function bt(o){return W.some(e=>e.id===o)}function Rt(){if(typeof window>"u")return"approve";try{let o=window.localStorage.getItem(It);if(bt(o))return o}catch(o){console.error("failed to read AI execution mode preference",o)}return"approve"}function yt(o){if(typeof window>"u")return null;try{let e=window.localStorage.getItem(vt);if(e&&o.some(a=>a.id===e))return e}catch(e){console.error("failed to read AI model preference",e)}return null}function wt(o){if(!(typeof window>"u"))try{window.localStorage.setItem(vt,o)}catch(e){console.error("failed to save AI model preference",e)}}function kt(o){if(!(typeof window>"u"))try{window.localStorage.setItem(It,o)}catch(e){console.error("failed to save AI execution mode preference",e)}}var U="";function Ie(o){let[e,a]=p(null),[i,m]=p("");k(()=>{let r=!0;return fetch("/cms/api/ai.config",{credentials:"include"}).then(async l=>{let g=await l.json();r&&a(g)}).catch(l=>{r&&m(String(l))}),()=>{r=!1}},[]);let h=!!e?.enabled&&(e.models?.length||0)>0;return t("div",{className:M("RootAIChat",`RootAIChat--${o.variant}`),children:!e&&!i?t("div",{className:"RootAIChat__loading",children:t(V,{size:"md",color:"gray"})}):h?t(Mt,{variant:o.variant,config:e,initialChatId:o.variant==="panel"?void 0:o.initialChatId,docContext:o.docContext,onClose:o.onClose}):t(Nt,{error:i,onClose:o.onClose})})}function Nt(o){return t("div",{className:"RootAIChat__notEnabled",children:[o.onClose&&t(E,{className:"RootAIChat__notEnabled__close",onClick:o.onClose,title:"Close",children:t(B,{size:16})}),t("div",{className:"RootAIChat__notEnabled__icon",children:t(j,{size:36})}),t("div",{className:"RootAIChat__notEnabled__title",children:"Root AI is not configured for this project."}),t("div",{className:"RootAIChat__notEnabled__body",children:["Add an ",t("code",{children:"ai.models"})," entry to ",t("code",{children:"cmsPlugin()"})," in"," ",t("code",{children:"root.config.ts"}),"."]}),o.error&&t("pre",{className:"RootAIChat__notEnabled__error",children:o.error})]})}function Mt(o){let e=o.variant==="panel",{route:a}=at(),i=o.config.models||[],m=()=>yt(i)||o.config.defaultModel||i[0]?.id||"",[h,r]=p(m),[l,g]=p(Rt),[u,I]=p(o.initialChatId||U),[P,y]=p(o.initialChatId||U),[D,s]=p([]),[f,x]=p([]),[v,w]=p(0),z=async()=>{if(!e)try{let R=await(await fetch("/cms/api/ai.chats.list",{method:"POST",credentials:"include",headers:{"content-type":"application/json"},body:JSON.stringify({})})).json();R.success&&x(R.chats||[])}catch(d){console.error("failed to load chat list",d)}};k(()=>{z(),!e&&o.initialChatId&&n(o.initialChatId)},[]),k(()=>{kt(l)},[l]);let n=async d=>{try{let b=await(await fetch("/cms/api/ai.chats.get",{method:"POST",credentials:"include",headers:{"content-type":"application/json"},body:JSON.stringify({id:d})})).json();if(!b.success)return;I(d),y(d),s(b.chat.messages||[]),b.chat.modelId&&i.find(F=>F.id===b.chat.modelId)&&r(b.chat.modelId),w(L=>L+1)}catch(R){console.error("failed to load chat",R)}},_=()=>{r(m()),I(U),y(U),s([]),w(d=>d+1),e||a("/cms/ai")},c=async d=>{if(d!==P)try{let b=await(await fetch("/cms/api/ai.chats.get",{method:"POST",credentials:"include",headers:{"content-type":"application/json"},body:JSON.stringify({id:d})})).json();if(!b.success)return;I(d),y(d),s(b.chat.messages||[]),b.chat.modelId&&i.find(F=>F.id===b.chat.modelId)&&r(b.chat.modelId),w(L=>L+1),e||a(`/cms/ai/chat/${d}`)}catch(R){console.error("failed to load chat",R)}},C=async d=>{try{await fetch("/cms/api/ai.chats.delete",{method:"POST",credentials:"include",headers:{"content-type":"application/json"},body:JSON.stringify({id:d})}),P===d&&_(),z()}catch(R){console.error("failed to delete chat",R)}},A=i.find(d=>d.id===h)||i[0],H=d=>{r(d),wt(d)};return t("div",{className:"RootAIChat__layout",children:[!e&&t(Tt,{chats:f,activeChatId:P,onSelect:c,onNew:_,onDelete:C}),t("div",{className:"RootAIChat__main",children:[e&&t(Pt,{onNewChat:_,onClose:o.onClose}),t(zt,{initialChatId:u,model:A,initialMessages:D,executionMode:l,models:i,selectedModel:A,docContext:o.docContext,onSelectModel:H,onSelectExecutionMode:g,onChatPersisted:d=>{y(d),z(),e||window.history.replaceState(null,"",`/cms/ai/chat/${d}`)}},v)]})]})}function Pt(o){return t("div",{className:"RootAIChat__panelHeader",children:[t("div",{className:"RootAIChat__panelHeader__title",children:[t(j,{size:14}),t("span",{children:"Root AI"})]}),t("div",{className:"RootAIChat__panelHeader__actions",children:[t(O,{label:"New chat",children:t(E,{size:"xs",onClick:o.onNewChat,children:t(G,{size:14})})}),o.onClose&&t(O,{label:"Close (\u2318 + i)",children:t(E,{size:"xs",onClick:o.onClose,children:t(B,{size:14})})})]})]})}function Tt(o){return t("aside",{className:"RootAIChat__sidebar",children:[t("button",{type:"button",className:"RootAIChat__sidebar__newButton",onClick:o.onNew,children:[t(G,{size:18}),t("span",{children:"New chat"})]}),t("div",{className:"RootAIChat__sidebar__list",children:[o.chats.length===0&&t("div",{className:"RootAIChat__sidebar__empty",children:"No chats yet."}),o.chats.map(e=>t("div",{className:M("RootAIChat__sidebar__item",e.id===o.activeChatId&&"RootAIChat__sidebar__item--active"),onClick:()=>o.onSelect(e.id),children:[t("div",{className:"RootAIChat__sidebar__item__title",title:e.title||"Untitled chat",children:e.title||"Untitled chat"}),t("button",{type:"button",className:"RootAIChat__sidebar__item__delete",title:"Delete chat",onClick:a=>{a.stopPropagation(),window.confirm("Delete this chat?")&&o.onDelete(e.id)},children:t(lt,{size:14})})]},e.id))]})]})}function Et(o){let e=W.find(a=>a.id===o.executionMode)||W[0];return t("div",{className:"RootAIChat__options",children:[t($,{control:t(S,{type:"button",className:"RootAIChat__modePicker",variant:"subtle",color:"dark",size:"xs",compact:!0,leftIcon:t(rt,{size:16}),children:e.label}),children:W.map(a=>t($.Item,{onClick:()=>o.onSelectExecutionMode(a.id),children:t("div",{className:"RootAIChat__modePicker__option",children:[t("div",{className:"RootAIChat__modePicker__option__label",children:a.label}),t("div",{className:"RootAIChat__modePicker__option__description",children:a.description})]})},a.id))}),t($,{control:t(S,{type:"button",className:"RootAIChat__modelPicker",variant:"subtle",color:"dark",size:"xs",compact:!0,leftIcon:t(j,{size:16}),children:o.selectedModel?.label||"Select model"}),children:o.models.map(a=>t($.Item,{onClick:()=>o.onSelectModel(a.id),children:t("div",{className:"RootAIChat__modelPicker__option",children:[t("div",{className:"RootAIChat__modelPicker__option__label",children:a.label}),a.description&&t("div",{className:"RootAIChat__modelPicker__option__description",children:a.description})]})},a.id))})]})}function zt(o){let[e]=p(()=>o.initialChatId||Gt()),a=N(o.model?.id);a.current=o.model?.id;let i=N(o.executionMode);i.current=o.executionMode;let m=N(o.docContext);m.current=o.docContext;let[h,r]=p({}),l=N({});k(()=>()=>{for(let n of Object.values(l.current))n("reject");l.current={}},[]);let g=T((n,_,c,C)=>new Promise(A=>{l.current[n]=A,r(H=>({...H,[n]:{toolCallId:n,toolName:_,input:c,preview:C,status:"pending"}}))}),[]),u=T(n=>{r(_=>{let c=_[n];return c?{..._,[n]:{...c,status:"executing"}}:_}),l.current[n]?.("approve"),delete l.current[n]},[]),I=T(n=>{r(_=>{let c={..._};return delete c[n],c}),l.current[n]?.("reject"),delete l.current[n]},[]),P=T(async n=>{if(!ht(n.toolName))return await tt(n.toolName,n.input);let _=i.current;if(_==="read")return{success:!1,error:"WRITE_BLOCKED_BY_MODE",message:"The current execution mode is read only. Do not call write tools."};let c;try{c=await ut(n.toolName,n.input)}catch(C){return{success:!1,error:"PREVIEW_FAILED",message:C?.message||String(C)}}if(c.error)return{success:!1,error:c.error,message:c.summary,errors:c.errors,hint:c.hint};if(_==="approve"&&await g(n.toolCallId,n.toolName,n.input,c)==="reject")return{success:!1,error:"USER_REJECTED",message:"The user rejected this draft change. Do not retry unless they ask for a revised version."};try{return await tt(n.toolName,n.input)}finally{r(C=>{if(!C[n.toolCallId])return C;let A={...C};return delete A[n.toolCallId],A})}},[g]),y=ot(()=>new ct({api:"/cms/api/ai.chat",credentials:"include",prepareSendMessagesRequest:({messages:n})=>({body:{message:n.at(-1),chatId:e,modelId:a.current,executionMode:i.current,docId:m.current?.docId}})}),[e]),{messages:D,sendMessage:s,status:f,error:x,stop:v,addToolOutput:w}=pt({id:e,messages:o.initialMessages,transport:y,sendAutomaticallyWhen:_t,onToolCall:async({toolCall:n})=>{let _=await P(n);w({tool:n.toolName,toolCallId:n.toolCallId,output:_})},onFinish:()=>{o.onChatPersisted(e)}}),z=f==="streaming"||f==="submitted";return t(et,{children:[t(St,{messages:D,isStreaming:z,emptyMessage:o.model?void 0:"Select a model to start.",toolApprovals:{approvals:h,onApprove:u,onReject:I}}),x&&t("div",{className:"RootAIChat__error",children:[t("strong",{children:"Error:"})," ",x.message]}),t(Vt,{disabled:!o.model,canAttach:o.model?.capabilities.attachments??!1,isStreaming:z,onStop:v,controls:t(Et,{models:o.models,selectedModel:o.selectedModel,onSelectModel:o.onSelectModel,executionMode:o.executionMode,onSelectExecutionMode:o.onSelectExecutionMode}),onSend:(n,_)=>{if(!n&&_.length===0)return;let c=Jt(_),C=[n,c.text].filter(Boolean).join(`
2
2
 
3
3
  `);s({text:C,files:c.files.map(A=>({type:"file",mediaType:A.mediaType,url:A.url,filename:A.filename}))})}})]})}function St(o){let e=N(null);return k(()=>{let a=e.current;a&&(a.scrollTop=a.scrollHeight)},[o.messages]),o.messages.length===0?t("div",{className:"RootAIChat__transcript RootAIChat__transcript--empty",ref:e,children:t("div",{className:"RootAIChat__welcome",children:[t("div",{className:"RootAIChat__welcome__icon",children:t(j,{size:36})}),t("div",{className:"RootAIChat__welcome__title",children:"Root AI"}),t("div",{className:"RootAIChat__welcome__body",children:o.emptyMessage||"What are we going to get done today?"})]})}):t("div",{className:"RootAIChat__transcript",ref:e,children:t("div",{className:"RootAIChat__transcript__inner",children:[o.messages.map(a=>t(jt,{message:a,toolApprovals:o.toolApprovals},a.id)),o.isStreaming&&t("div",{className:"RootAIChat__streamingIndicator",children:t(ft,{size:6})})]})})}function jt(o){let e=o.message,a=e.role==="user",i=a?"You":"Root AI",m=a?window.firebase.user?.photoURL:null,[h,r]=p(!1),l=T(()=>(e.parts||[]).filter(u=>u.type==="text"&&u.text).map(u=>u.text).join(`
4
4
 
@@ -1 +1 @@
1
- import{a as C}from"./chunk-FJLNXXE3.js";import{f as p}from"./chunk-YLSRRNSE.js";import{Fb as u,Ga as o,U as _,g,j as b}from"./chunk-LROR6N3B.js";b();function m(s){let e={},t=[],r={};if(Object.entries(s).forEach(([n,i])=>{e[n]={id:n,name:i.name||n,description:i.description,isGroup:!1,collection:i,children:[]}}),Object.entries(s).forEach(([n,i])=>{let c=e[n],d=i.group||"Content";d?(r[d]||(r[d]={id:`group:${d}`,name:d,isGroup:!0,children:[]}),r[d].children.push(c)):t.push(c)}),Object.keys(r).length>0&&t.length>0){let n={id:"group:Content",name:"Content",isGroup:!0,children:t},i=Object.values(r).sort((c,d)=>c.name.localeCompare(d.name));return[n,...i]}Object.values(r).forEach(n=>{t.push(n)});let l=n=>{n.sort((i,c)=>i.name.localeCompare(c.name)),n.forEach(i=>{i.children.length>0&&l(i.children)})};return l(t),t}function O(s){let{collections:e,activeCollectionId:t,projectId:r}=s,[a,l]=C(`root-cms::${r}::closed_groups`,[]),n=g(()=>m(e),[]),i=(c,d)=>{d?l(a.filter(v=>v!==c)):a.includes(c)||l([...a,c])};return o("div",{className:p(s.className,"CollectionTree"),children:[n.map(c=>o(h,{node:c,depth:0,activeCollectionId:t,closedGroups:a,onAccordionChange:i},c.id)),n.length===0&&o("div",{className:"CollectionTree__collections__empty",children:"No collections match your query."})]})}function h(s){let{node:e,depth:t,activeCollectionId:r,closedGroups:a,onAccordionChange:l}=s,n=e.children.length>0;return e.isGroup?n?o(f,{node:e,depth:t,activeCollectionId:r,closedGroups:a,onAccordionChange:l,label:o("div",{className:"CollectionTree__group__label",children:o("span",{children:e.name})})}):o("div",{className:"CollectionTree__group-empty",style:{paddingLeft:`${t*16}px`},children:[o(u,{size:20,strokeWidth:"1.75"}),o("span",{children:e.name})]}):n?o(f,{node:e,depth:t,activeCollectionId:r,closedGroups:a,onAccordionChange:l,label:o("div",{className:"CollectionTree__collection__label",children:o("a",{className:p("CollectionTree__collection-link",e.id===r&&"active"),href:`/cms/content/${e.id}`,onClick:i=>i.stopPropagation(),children:e.name})})}):o("a",{className:p("CollectionTree__collection",e.id===r&&"active"),href:`/cms/content/${e.id}`,children:[o("div",{className:"CollectionTree__collection__icon",children:o(u,{size:20,strokeWidth:"1.75"})}),o("div",{className:"CollectionTree__collection__content",children:[o("div",{className:"CollectionTree__collection__name",children:e.name}),e.description&&o("div",{className:"CollectionTree__collection__desc",children:e.description})]})]})}function f(s){let{node:e,depth:t,label:r,activeCollectionId:a,closedGroups:l,onAccordionChange:n}=s,i=!l.includes(e.id);return o("div",{className:"CollectionTree__accordion",children:o(_,{iconPosition:"left",initialItem:i?0:-1,offsetIcon:!1,onChange:()=>n(e.id,!i),children:o(_.Item,{label:r,children:o("div",{className:"CollectionTree__accordion__children",children:e.children.map(c=>o(h,{node:c,depth:t+1,activeCollectionId:a,closedGroups:l,onAccordionChange:n},c.id))})})})})}export{O as a};
1
+ import{a as C}from"./chunk-FJLNXXE3.js";import{e as p}from"./chunk-BUNR5EU3.js";import{Fb as u,Ga as o,U as _,g,j as b}from"./chunk-LROR6N3B.js";b();function m(s){let e={},t=[],r={};if(Object.entries(s).forEach(([n,i])=>{e[n]={id:n,name:i.name||n,description:i.description,isGroup:!1,collection:i,children:[]}}),Object.entries(s).forEach(([n,i])=>{let c=e[n],d=i.group||"Content";d?(r[d]||(r[d]={id:`group:${d}`,name:d,isGroup:!0,children:[]}),r[d].children.push(c)):t.push(c)}),Object.keys(r).length>0&&t.length>0){let n={id:"group:Content",name:"Content",isGroup:!0,children:t},i=Object.values(r).sort((c,d)=>c.name.localeCompare(d.name));return[n,...i]}Object.values(r).forEach(n=>{t.push(n)});let l=n=>{n.sort((i,c)=>i.name.localeCompare(c.name)),n.forEach(i=>{i.children.length>0&&l(i.children)})};return l(t),t}function O(s){let{collections:e,activeCollectionId:t,projectId:r}=s,[a,l]=C(`root-cms::${r}::closed_groups`,[]),n=g(()=>m(e),[]),i=(c,d)=>{d?l(a.filter(v=>v!==c)):a.includes(c)||l([...a,c])};return o("div",{className:p(s.className,"CollectionTree"),children:[n.map(c=>o(h,{node:c,depth:0,activeCollectionId:t,closedGroups:a,onAccordionChange:i},c.id)),n.length===0&&o("div",{className:"CollectionTree__collections__empty",children:"No collections match your query."})]})}function h(s){let{node:e,depth:t,activeCollectionId:r,closedGroups:a,onAccordionChange:l}=s,n=e.children.length>0;return e.isGroup?n?o(f,{node:e,depth:t,activeCollectionId:r,closedGroups:a,onAccordionChange:l,label:o("div",{className:"CollectionTree__group__label",children:o("span",{children:e.name})})}):o("div",{className:"CollectionTree__group-empty",style:{paddingLeft:`${t*16}px`},children:[o(u,{size:20,strokeWidth:"1.75"}),o("span",{children:e.name})]}):n?o(f,{node:e,depth:t,activeCollectionId:r,closedGroups:a,onAccordionChange:l,label:o("div",{className:"CollectionTree__collection__label",children:o("a",{className:p("CollectionTree__collection-link",e.id===r&&"active"),href:`/cms/content/${e.id}`,onClick:i=>i.stopPropagation(),children:e.name})})}):o("a",{className:p("CollectionTree__collection",e.id===r&&"active"),href:`/cms/content/${e.id}`,children:[o("div",{className:"CollectionTree__collection__icon",children:o(u,{size:20,strokeWidth:"1.75"})}),o("div",{className:"CollectionTree__collection__content",children:[o("div",{className:"CollectionTree__collection__name",children:e.name}),e.description&&o("div",{className:"CollectionTree__collection__desc",children:e.description})]})]})}function f(s){let{node:e,depth:t,label:r,activeCollectionId:a,closedGroups:l,onAccordionChange:n}=s,i=!l.includes(e.id);return o("div",{className:"CollectionTree__accordion",children:o(_,{iconPosition:"left",initialItem:i?0:-1,offsetIcon:!1,onChange:()=>n(e.id,!i),children:o(_.Item,{label:r,children:o("div",{className:"CollectionTree__accordion__children",children:e.children.map(c=>o(h,{node:c,depth:t+1,activeCollectionId:a,closedGroups:l,onAccordionChange:n},c.id))})})})})}export{O as a};
@@ -0,0 +1 @@
1
+ function e(){return!!(window.__ROOT_CTX.ai||window.__ROOT_CTX.experiments?.ai)}function n(){return!!(window.__ROOT_CTX.ai?.imageGenerationEnabled||window.__ROOT_CTX.experiments?.ai)}export{e as a,n as b};
@@ -1 +1 @@
1
- import{a as h}from"./chunk-YDO2EDVY.js";import{a as x}from"./chunk-5MV6XVGA.js";import{g as y}from"./chunk-ZN2Y5OUF.js";import{c as f,n as g}from"./chunk-VD6G5NV4.js";async function b(e){let t=window.firebase.db,r=window.__ROOT_CTX.rootConfig.projectId,[o,a]=e.split("/",2),i=await h(o),n=f(t,"Projects",r,"Collections",o,"Drafts",a),c=(await g(n)).data()||{},p=new Set;return m(p,i.fields,c.fields||{},i.types||{}),Array.from(p)}async function C(e){let t=window.firebase.db,r=window.__ROOT_CTX.rootConfig.projectId,[o,a]=e.split("/",2),i=await h(o),n=f(t,"Projects",r,"Collections",o,"Drafts",a),c=(await g(n)).data()||{},p=new Map;return d(p,i.fields,c.fields||{},i.types||{}),p}function m(e,t,r,o={}){t.forEach(a=>{if(!a.id)return;let i=r[a.id],n=`@${a.id}`,s=r[n];s?.translate===!1||s?.disableTranslations||R(e,a,i,o,s)})}function d(e,t,r,o={}){t.forEach(a=>{if(!a.id)return;let i=r[a.id],n=`@${a.id}`,s=r[n];if(s?.translate===!1||s?.disableTranslations)return;let c=s?.description;S(e,a,i,o,c,s)})}function R(e,t,r,o={},a){if(!r)return;function i(n){let s=y(n);s&&e.add(s)}if(t.type==="object")m(e,t.fields||[],r,o);else if(t.type==="array"){let n=r._array||[];for(let s of n)R(e,t.of,r[s],o)}else if(t.type==="string"||t.type==="select")t.translate&&i(r);else if(t.type==="image")t.translate&&r&&r.alt&&t.alt!==!1&&a?.alt!==!1&&i(r.alt);else if(t.type==="multiselect"){if(t.translate&&Array.isArray(r))for(let n of r)i(n)}else if(t.type==="oneof"){let n=t.types||[],s;typeof n[0]=="string"?n.includes(r._type)&&(s=o[r._type]):s=n.find(c=>c.name===r._type),s&&m(e,s.fields||[],r,o)}else t.type==="richtext"?t.translate&&T(e,r):console.log(`extract: ignoring field, id=${t.id}, type=${t.type}`)}function S(e,t,r,o={},a,i){if(!r)return;function n(s){let c=y(s);if(c){let p=e.get(c);(!p||!p.description)&&e.set(c,{description:a})}}if(t.type==="object")d(e,t.fields||[],r,o);else if(t.type==="array"){let s=r._array||[];for(let c of s)S(e,t.of,r[c],o,a)}else if(t.type==="string"||t.type==="select")t.translate&&n(r);else if(t.type==="image")t.translate&&r&&r.alt&&t.alt!==!1&&i?.alt!==!1&&n(r.alt);else if(t.type==="multiselect"){if(t.translate&&Array.isArray(r))for(let s of r)n(s)}else if(t.type==="oneof"){let s=t.types||[],c;typeof s[0]=="string"?s.includes(r._type)&&(c=o[r._type]):c=s.find(p=>p.name===r._type),c&&d(e,c.fields||[],r,o)}else if(t.type==="richtext"&&t.translate){let s=new Set;T(s,r),s.forEach(c=>n(c))}}function T(e,t){(t?.blocks||[]).forEach(o=>{l(e,o)})}function l(e,t){if(!t?.type)return;function r(n){if(!n)return;let s=y(n);s&&e.add(s)}function o(n){n&&Object.values(n).forEach(s=>{a(s)})}function a(n){if(typeof n=="string"){r(n);return}if(Array.isArray(n)){n.forEach(s=>a(s));return}x(n)&&Object.values(n).forEach(s=>a(s))}function i(n){n&&n.forEach(s=>{r(s.content),o(s.components),i(s.items)})}t.type==="heading"||t.type==="paragraph"?(r(t.data?.text),o(t.data?.components)):t.type==="orderedList"||t.type==="unorderedList"?i(t.data?.items):t.type==="html"?r(t.data?.html):t.type==="table"&&(t.data?.rows||[]).forEach(s=>{(s.cells||[]).forEach(p=>{(p.blocks||[]).forEach(w=>{l(e,w)})})})}export{b as a,C as b,R as c};
1
+ import{a as h}from"./chunk-YDO2EDVY.js";import{a as x}from"./chunk-5MV6XVGA.js";import{h as y}from"./chunk-C2BLMTPR.js";import{c as f,n as g}from"./chunk-VD6G5NV4.js";async function b(e){let t=window.firebase.db,r=window.__ROOT_CTX.rootConfig.projectId,[o,a]=e.split("/",2),i=await h(o),n=f(t,"Projects",r,"Collections",o,"Drafts",a),c=(await g(n)).data()||{},p=new Set;return m(p,i.fields,c.fields||{},i.types||{}),Array.from(p)}async function C(e){let t=window.firebase.db,r=window.__ROOT_CTX.rootConfig.projectId,[o,a]=e.split("/",2),i=await h(o),n=f(t,"Projects",r,"Collections",o,"Drafts",a),c=(await g(n)).data()||{},p=new Map;return d(p,i.fields,c.fields||{},i.types||{}),p}function m(e,t,r,o={}){t.forEach(a=>{if(!a.id)return;let i=r[a.id],n=`@${a.id}`,s=r[n];s?.translate===!1||s?.disableTranslations||R(e,a,i,o,s)})}function d(e,t,r,o={}){t.forEach(a=>{if(!a.id)return;let i=r[a.id],n=`@${a.id}`,s=r[n];if(s?.translate===!1||s?.disableTranslations)return;let c=s?.description;S(e,a,i,o,c,s)})}function R(e,t,r,o={},a){if(!r)return;function i(n){let s=y(n);s&&e.add(s)}if(t.type==="object")m(e,t.fields||[],r,o);else if(t.type==="array"){let n=r._array||[];for(let s of n)R(e,t.of,r[s],o)}else if(t.type==="string"||t.type==="select")t.translate&&i(r);else if(t.type==="image")t.translate&&r&&r.alt&&t.alt!==!1&&a?.alt!==!1&&i(r.alt);else if(t.type==="multiselect"){if(t.translate&&Array.isArray(r))for(let n of r)i(n)}else if(t.type==="oneof"){let n=t.types||[],s;typeof n[0]=="string"?n.includes(r._type)&&(s=o[r._type]):s=n.find(c=>c.name===r._type),s&&m(e,s.fields||[],r,o)}else t.type==="richtext"?t.translate&&T(e,r):console.log(`extract: ignoring field, id=${t.id}, type=${t.type}`)}function S(e,t,r,o={},a,i){if(!r)return;function n(s){let c=y(s);if(c){let p=e.get(c);(!p||!p.description)&&e.set(c,{description:a})}}if(t.type==="object")d(e,t.fields||[],r,o);else if(t.type==="array"){let s=r._array||[];for(let c of s)S(e,t.of,r[c],o,a)}else if(t.type==="string"||t.type==="select")t.translate&&n(r);else if(t.type==="image")t.translate&&r&&r.alt&&t.alt!==!1&&i?.alt!==!1&&n(r.alt);else if(t.type==="multiselect"){if(t.translate&&Array.isArray(r))for(let s of r)n(s)}else if(t.type==="oneof"){let s=t.types||[],c;typeof s[0]=="string"?s.includes(r._type)&&(c=o[r._type]):c=s.find(p=>p.name===r._type),c&&d(e,c.fields||[],r,o)}else if(t.type==="richtext"&&t.translate){let s=new Set;T(s,r),s.forEach(c=>n(c))}}function T(e,t){(t?.blocks||[]).forEach(o=>{l(e,o)})}function l(e,t){if(!t?.type)return;function r(n){if(!n)return;let s=y(n);s&&e.add(s)}function o(n){n&&Object.values(n).forEach(s=>{a(s)})}function a(n){if(typeof n=="string"){r(n);return}if(Array.isArray(n)){n.forEach(s=>a(s));return}x(n)&&Object.values(n).forEach(s=>a(s))}function i(n){n&&n.forEach(s=>{r(s.content),o(s.components),i(s.items)})}t.type==="heading"||t.type==="paragraph"?(r(t.data?.text),o(t.data?.components)):t.type==="orderedList"||t.type==="unorderedList"?i(t.data?.items):t.type==="html"?r(t.data?.html):t.type==="table"&&(t.data?.rows||[]).forEach(s=>{(s.cells||[]).forEach(p=>{(p.blocks||[]).forEach(w=>{l(e,w)})})})}export{b as a,C as b,R as c};
@@ -1 +1 @@
1
- import{i as M}from"./chunk-AZCGXQTL.js";import{a as n,c as _}from"./chunk-HARRKJFZ.js";import{b as h}from"./chunk-J5E457OI.js";import{a as u}from"./chunk-QHJOTXYB.js";import{e as f}from"./chunk-KRNQ6L35.js";import{a as m}from"./chunk-VD6G5NV4.js";import{Ga as e,a as i,da as d,e as c,j as I}from"./chunk-LROR6N3B.js";I();var S="ScheduleReleaseModal";function F(l){let t=n(),a=_();return{open:()=>{t.openContextModal(S,{...a,title:`Schedule release: ${l.releaseId}`,innerProps:l})}}}function T(l){let{innerProps:t,context:a,id:g}=l,[s,x]=i(""),[R,r]=i(!1),v=c(null),b=n();async function w(){r(!0),await h(async()=>{let o=Math.floor(new Date(s).getTime());if(Math.floor(new Date().getTime())>=o)throw new Error("bad datetime, please choose a date in the future");let y=m.fromMillis(o);await M(t.releaseId,o),u({title:"Scheduled!",message:`Release ${t.releaseId} will go live ${s}.`,autoClose:1e4}),b.closeAll(),t.onScheduled&&t.onScheduled(y)}),r(!1)}return e("div",{className:"ScheduleReleaseModal",children:e("div",{className:"ScheduleReleaseModal__content",children:e("form",{className:"ScheduleReleaseModal__form",onSubmit:o=>{o.preventDefault(),w()},children:[e("div",{className:"ScheduleReleaseModal__form__description",children:"Content in the release will go live at the datetime specified below."}),e("div",{className:"ScheduleReleaseModal__form__dateInput",children:[e("input",{ref:v,type:"datetime-local",value:s,min:f(),onChange:o=>{let p=o.target;x(p.value)}}),e("div",{className:"ScheduleReleaseModal__form__dateInput__help",children:["timezone: ",Intl.DateTimeFormat().resolvedOptions().timeZone]})]}),e("div",{className:"ScheduleReleaseModal__form__buttons",children:[e(d,{variant:"outline",onClick:()=>a.closeModal(g),type:"button",size:"xs",color:"dark",children:"Cancel"}),e(d,{variant:"filled",size:"xs",color:"dark",loading:R,type:"submit",children:"Schedule"})]})]})})})}T.id=S;export{F as a,T as b};
1
+ import{i as M}from"./chunk-IOR72US3.js";import{a as n,c as _}from"./chunk-HARRKJFZ.js";import{b as h}from"./chunk-J5E457OI.js";import{a as u}from"./chunk-QHJOTXYB.js";import{e as f}from"./chunk-KRNQ6L35.js";import{a as m}from"./chunk-VD6G5NV4.js";import{Ga as e,a as i,da as d,e as c,j as I}from"./chunk-LROR6N3B.js";I();var S="ScheduleReleaseModal";function F(l){let t=n(),a=_();return{open:()=>{t.openContextModal(S,{...a,title:`Schedule release: ${l.releaseId}`,innerProps:l})}}}function T(l){let{innerProps:t,context:a,id:g}=l,[s,x]=i(""),[R,r]=i(!1),v=c(null),b=n();async function w(){r(!0),await h(async()=>{let o=Math.floor(new Date(s).getTime());if(Math.floor(new Date().getTime())>=o)throw new Error("bad datetime, please choose a date in the future");let y=m.fromMillis(o);await M(t.releaseId,o),u({title:"Scheduled!",message:`Release ${t.releaseId} will go live ${s}.`,autoClose:1e4}),b.closeAll(),t.onScheduled&&t.onScheduled(y)}),r(!1)}return e("div",{className:"ScheduleReleaseModal",children:e("div",{className:"ScheduleReleaseModal__content",children:e("form",{className:"ScheduleReleaseModal__form",onSubmit:o=>{o.preventDefault(),w()},children:[e("div",{className:"ScheduleReleaseModal__form__description",children:"Content in the release will go live at the datetime specified below."}),e("div",{className:"ScheduleReleaseModal__form__dateInput",children:[e("input",{ref:v,type:"datetime-local",value:s,min:f(),onChange:o=>{let p=o.target;x(p.value)}}),e("div",{className:"ScheduleReleaseModal__form__dateInput__help",children:["timezone: ",Intl.DateTimeFormat().resolvedOptions().timeZone]})]}),e("div",{className:"ScheduleReleaseModal__form__buttons",children:[e(d,{variant:"outline",onClick:()=>a.closeModal(g),type:"button",size:"xs",color:"dark",children:"Cancel"}),e(d,{variant:"filled",size:"xs",color:"dark",loading:R,type:"submit",children:"Schedule"})]})]})})})}T.id=S;export{F as a,T as b};
@@ -0,0 +1 @@
1
+ import{b as j,d as B,e as a,g as O,i as U,j as q}from"./chunk-LROR6N3B.js";import{a as g,b as p,f as K,i as k,j as D,k as M}from"./chunk-KUCVLANF.js";M();q();var d,R;function Z(e){return!R||(typeof R=="string"?e.startsWith(R):R.test(e))}function N(e,t){let n="";if(d=void 0,t&&t.type==="click"){if(t.ctrlKey||t.metaKey||t.altKey||t.shiftKey||t.button!==0)return e;let r=t.composedPath().find(c=>c.nodeName=="A"&&c.href),o=r&&r.getAttribute("href");if(!r||r.origin!=location.origin||/^#/.test(o)||!/^(_?self)?$/i.test(r.target)||!Z(o)||r.download)return e;d=!0,t.preventDefault(),n=r.href.replace(location.origin,"")}else t&&t.url?(d=!t.replace,n=t.url):n=location.pathname+location.search;return d===!0?history.pushState(null,"",n):d===!1&&history.replaceState(null,"",n),n}var V=(e,t,n={})=>{e=e.split("/").filter(Boolean),t=(t||"").split("/").filter(Boolean),n.params||(n.params={});for(let r=0,o,c;r<Math.max(e.length,t.length);r++){let[,s,f,l]=(t[r]||"").match(/^(:?)(.*?)([+*?]?)$/);if(o=e[r],!(!s&&f==o)){if(!s&&o&&l=="*"){n.rest="/"+e.slice(r).map(decodeURIComponent).join("/");break}if(!s||!o&&l!="?"&&l!="*")return;if(c=l=="+"||l=="*",c?o=e.slice(r).map(decodeURIComponent).join("/")||void 0:o&&(o=decodeURIComponent(o)),n.params[f]=o,f in n||(n[f]=o),c)break}}return n};function E(e){let[t,n]=j(N,e.url||location.pathname+location.search);e.scope&&(R=e.scope);let r=d===!0,o=O(()=>{let c=new URL(t,location.origin),s=c.pathname.replace(/\/+$/g,"")||"/";return{url:t,path:s,query:Object.fromEntries(c.searchParams),route:(f,l)=>n({url:f,replace:l}),wasPush:r}},[t]);return B(()=>(addEventListener("click",n),addEventListener("popstate",n),()=>{removeEventListener("click",n),removeEventListener("popstate",n)}),[]),p(E.ctx.Provider,{value:o},e.children)}var ee=Promise.resolve();function $(e){let[t,n]=j(u=>u+1,0),{url:r,query:o,wasPush:c,path:s}=T();if(!r)throw new Error("preact-iso's <Router> must be used within a <LocationProvider>, see: https://github.com/preactjs/preact-iso#locationprovider");let{rest:f=s,params:l={}}=U(H),S=a(!1),z=a(s),C=a(0),i=a(),_=a(),h=a(),b=a(!1),P=a();P.current=!1;let A,I,m;K(e.children).some(u=>{if(V(f,u.props.path,m={...u.props,path:f,query:o,params:Object.assign({},l),rest:""}))return A=k(u,m);u.props.default&&(I=k(u,m))});let v=A||I,Y=i.current&&i.current.__u&x&&i.current.__u&L,F=i.current&&i.current.__h,G=O(()=>{_.current=i.current,i.current=p(H.Provider,{value:m},v);let u=_.current&&_.current.props.children;return!u||!v||v.type!==u.type||v.props.component!==u.props.component?(this.__v&&this.__v.__k&&this.__v.__k.reverse(),C.current++,!0):!1},[r,JSON.stringify(m)]);Y?(i.current.__u|=x,i.current.__u|=L):F&&(i.current.__h=!0);let Q=_.current;return _.current=null,this.__c=(u,y)=>{P.current=!0,_.current=Q,e.onLoadStart&&e.onLoadStart(r),S.current=!0;let X=C.current;u.then(()=>{X===C.current&&(_.current=null,i.current&&(y.__h&&(i.current.__h=y.__h),y.__u&L&&(i.current.__u|=L),y.__u&x&&(i.current.__u|=x)),ee.then(n))})},B(()=>{let u=this.__v&&this.__v.__e;if(P.current){!b.current&&!h.current&&(h.current=u);return}!b.current&&h.current&&(h.current!==u&&h.current.remove(),h.current=null),b.current=!0,z.current!==s&&(c&&scrollTo(0,0),e.onRouteChange&&e.onRouteChange(r),z.current=s),e.onLoadEnd&&S.current&&e.onLoadEnd(r),S.current=!1},[s,c,t]),G?[p(w,{r:i}),p(w,{r:_})]:p(w,{r:i})}var x=32,L=128,w=({r:e})=>e.current;$.Provider=E;E.ctx=D({});var H=D({}),te=e=>p(e.component,e),T=()=>U(E.ctx);M();q();var J=g.__b;g.__b=e=>{e.type&&e.type._forwarded&&e.ref&&(e.props.ref=e.ref,e.ref=null),J&&J(e)};var W=g.__e;g.__e=(e,t,n)=>{if(e&&e.then){let r=t;for(;r=r.__;)if(r.__c&&r.__c.__c)return t.__e==null&&(t.__c.__z=[n.__e],t.__e=n.__e,t.__k=n.__k),t.__k||(t.__k=[]),r.__c.__c(e,t)}W&&W(e,t,n)};M();function ve(...e){return e.filter(t=>!!t).join(" ")||void 0}export{E as a,$ as b,te as c,T as d,ve as e};
@@ -1 +1 @@
1
- import{f as r}from"./chunk-YLSRRNSE.js";import{Ga as i}from"./chunk-LROR6N3B.js";function f(n){let{className:a,as:l,size:t,weight:e,color:o,children:s,...x}=n;return i(l||"div",{...x,className:r(a,"text",t&&`size:${t}`,e&&`weight:${e}`,o&&`color:${o}`),children:s})}export{f as a};
1
+ import{e as r}from"./chunk-BUNR5EU3.js";import{Ga as i}from"./chunk-LROR6N3B.js";function f(n){let{className:a,as:l,size:t,weight:e,color:o,children:s,...x}=n;return i(l||"div",{...x,className:r(a,"text",t&&`size:${t}`,e&&`weight:${e}`,o&&`color:${o}`),children:s})}export{f as a};
@@ -0,0 +1,3 @@
1
+ import{a as b,f as R}from"./chunk-KRNQ6L35.js";import{b as m,c as l,f as y,g as f,h as T,n as x,o as L,q as _,w,x as h}from"./chunk-VD6G5NV4.js";function d(n,o){let t=n.translationLanguages||{},a=String(o).toLowerCase();for(let[r,s]of Object.entries(t))if(r.toLowerCase()===a)return s;return o}function O(n,o){let t=[];for(let a of o){let r=d(n,a);t.includes(r)||t.push(r)}return t}function C(n,o){let t=n.locales||["en"],a=String(o).toLowerCase(),r=[];for(let s of t)(String(s).toLowerCase()===a||d(n,s).toLowerCase()===a)&&r.push(s);return r}function I(n,o,t){for(let a of C(n,t)){let r=o[a];if(typeof r=="string"&&r)return r}return""}function j(){let n=window.__ROOT_CTX.rootConfig.projectId,o=window.firebase.db;return m(o,"Projects",n,"Translations")}async function D(n){let o=j(),t=n?.tags?f(o,T("tags","array-contains-any",n.tags)):f(o),a=await L(t),r={};return a.forEach(s=>{let e=s.id;r[e]=s.data()}),r}async function G(n){let o=Array.from(new Set(n)).filter(Boolean),t={};if(o.length===0)return t;let a=j(),r=30,s=[];for(let e=0;e<o.length;e+=r)s.push(o.slice(e,e+r));return await Promise.all(s.map(async e=>{let i=f(a,T(y(),"in",e));(await L(i)).forEach(c=>{t[c.id]=c.data()})})),t}async function N(n){let o=window.__ROOT_CTX.rootConfig.projectId,t=window.firebase.db,a=l(t,"Projects",o,"Translations",n);return(await x(a)).data()}async function K(n,o){let t=window.__ROOT_CTX.rootConfig.projectId,a=window.firebase.db,r=l(a,"Projects",t,"Translations",n),s={};for(let e in o){if(e==="tags"){s.tags=o.tags;continue}for(let i of X(e))s[i]=o[e]}console.log("updating translations: ",s),await _(r,s),R("translations.save",{metadata:{hash:n},throttle:5*b.minute,throttleId:n})}async function W(n,o){let t=o?.mode??"replace",a=window.__ROOT_CTX.rootConfig.projectId,r=window.firebase.db,s=500;for(let e=0;e<n.length;e+=s){let i=h(r);n.slice(e,e+s).forEach(({hash:c,tags:u})=>{let g=l(r,"Projects",a,"Translations",c);t==="union"?i.update(g,{tags:w(...u)}):i.update(g,{tags:u})}),await i.commit()}}async function M(n){return k(E(n))}async function k(n){let t=new TextEncoder().encode(n),a=await crypto.subtle.digest("SHA-1",t);return Array.from(new Uint8Array(a)).map(e=>e.toString(16).padStart(2,"0")).join("")}function E(n){return String(n).trim().split(`
2
+ `).map(t=>q(t)).join(`
3
+ `)}function q(n){return String(n).trimEnd().replace(/&nbsp;$/,"")}var S=new Map;function H(n){let o=S.get(n);if(o)return o;let t=n.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*").replace(/\?/g,"."),a=new RegExp(`^${t}$`,"i");return S.set(n,a),a}function Z(n){return(window.__ROOT_CTX.excludeLocalesFromTranslations||[]).some(t=>H(t).test(n))}function J(n){let t=(window.__ROOT_CTX.rootConfig.i18n||{}).locales||["en"];for(let a of t)if(String(a).toLowerCase()===n.toLowerCase())return a;return null}function Q(n){let o=window.__ROOT_CTX.rootConfig.i18n||{};return d(o,n)}function V(n){let o=window.__ROOT_CTX.rootConfig.i18n||{};return O(o,n)}function X(n){let o=window.__ROOT_CTX.rootConfig.i18n||{};return C(o,n)}function Y(n,o){let t=window.__ROOT_CTX.rootConfig.i18n||{};return I(t,n,o)}async function nn(n,o){let t=window.__ROOT_CTX.rootConfig.projectId,a=window.firebase.db,r=500,s=await Promise.all(n.map(async e=>({hash:await M(e.source),locales:e.locales,source:e.source})));for(let e=0;e<s.length;e+=r){let i=h(a),p=s.slice(e,e+r);for(let c of p){let u=l(a,"Projects",t,"Translations",c.hash),g={source:c.source};for(let[F,P]of Object.entries(c.locales))for(let A of X(F))g[A]=E(P);o?.tags?.length&&(g.tags=w(...o.tags)),i.set(u,g,{merge:!0})}await i.commit()}R("translations.batch_save",{metadata:{count:n.length}})}export{j as a,D as b,G as c,N as d,K as e,W as f,M as g,E as h,Z as i,J as j,Q as k,V as l,X as m,Y as n,nn as o};
@@ -1 +1 @@
1
- import{e as z,j as I}from"./chunk-OWQL5DVE.js";import{c as N,e as L}from"./chunk-R6B3W5AJ.js";import{a as C}from"./chunk-FJLNXXE3.js";import{a as w,c as y}from"./chunk-HARRKJFZ.js";import{b as v}from"./chunk-5MV6XVGA.js";import{Cc as B,Ga as e,V as P,a as g,da as p,g as M,j as x,ua as S,za as f}from"./chunk-LROR6N3B.js";x();x();function O(o,t){return M(()=>{if(!t.trim())return o;let l=t.toLowerCase();return o.filter(c=>{let[a,u]=c.id.split("/"),r=c.fields||{},n=window.__ROOT_CTX.collections[a],s=v(r,n.preview?.title||"meta.title")||"";return c.id.toLowerCase().includes(l)||s.toLowerCase().includes(l)||u.toLowerCase().includes(l)})},[o,t])}var h="DocPickerModal";function ee(){let o=w(),t=y();return{open:l=>{o.openContextModal(h,{...t,innerProps:l,size:"700px",overflow:"inside"})},close:()=>{o.closeModal(h)}}}function k(o){let{innerProps:t}=o,l=Object.keys(window.__ROOT_CTX.collections);t.collections?.length&&(l=l.filter(i=>t.collections?.includes(i)));let c=[{value:"",label:"Select"}];l.forEach(i=>{c.push({value:i,label:i})});let[a,u]=C("DocPickerModal.lastSelectedCollection",""),r=()=>t.initialCollection?t.initialCollection:a&&l.includes(a)?a:l.length===1?l[0]:"",[n,D]=g(r()),s=i=>{D(i),u(i)};function m(i){t.multiSelect&&t.onChangeMulti?t.onChangeMulti(i.id,!0):t.onChange&&t.onChange(i.id)}function b(i){t.multiSelect&&t.onChangeMulti&&t.onChangeMulti(i.id,!1)}return e("div",{className:"DocPickerModal",children:[l.length===0&&e("div",{className:"DocPickerModal__noCollections",children:"No collections matching schema field definition."}),l.length>0&&e(k.DocsList,{collection:n,onDocSelected:m,onDocUnselected:b,onCollectionChange:s,multiSelect:t.multiSelect,selectedDocIds:t.selectedDocIds,options:{enableSearch:t.enableSearch??!0,enableSort:t.enableSort??!0,enableCreate:t.enableCreate??!0,enableStatusBadges:t.enableStatusBadges??!0,showCollectionSelect:l.length>1,collectionSelectValue:n,collectionSelectOptions:c}})]})}k.DocsList=o=>{let[t,l]=g(""),[c,a]=C(`root::DocPickerModal:${o.collection}:sortBy`,"modifiedAt"),[u,r]=g(!1),[n,D,s]=z(o.collection||"",{orderBy:c}),m=O(s,t),b=[{value:"modifiedAt",label:"Last Modified"},{value:"slug",label:"A-Z"},{value:"slugDesc",label:"Z-A"},{value:"newest",label:"Newest"},{value:"oldest",label:"Oldest"}],i=o.selectedDocIds||[],d=o.options||{};return e("div",{className:"DocPickerModal__DocsList",children:[e("div",{className:"DocPickerModal__DocsList__stickyHeader",children:[d.showCollectionSelect&&e("div",{className:"DocPickerModal__collection__select",children:[e("div",{className:"DocPickerModal__collection__select__label",children:"Content Type:"}),e(f,{data:d.collectionSelectOptions||[],value:d.collectionSelectValue,placeholder:"Select",onChange:_=>{o.onCollectionChange?.(_||"")},size:"xs",radius:0,searchable:!0,autoFocus:!0,dropdownComponent:"div"}),d.collectionSelectValue&&e(p,{variant:"outline",color:"dark",size:"xs",onClick:()=>r(!0),children:"New"})]}),d.enableSearch&&d.collectionSelectValue&&e("div",{className:"DocPickerModal__DocsList__controls",children:[e(S,{placeholder:"Search documents...",value:t,onChange:_=>l(_.target.value),icon:e(B,{size:16}),size:"xs",className:"DocPickerModal__DocsList__controls__search"}),d.enableSort&&e(f,{data:b,value:c,onChange:_=>a(_||"modifiedAt"),size:"xs",className:"DocPickerModal__DocsList__controls__sort"})]}),!n&&s.length>0&&e("div",{className:"DocPickerModal__DocsList__count",children:["Showing ",m.length," of ",s.length," documents"]})]}),e("div",{className:"DocPickerModal__DocsList__docsContainer",children:o.collection?n?e("div",{className:"DocPickerModal__DocsList__loading",children:e(P,{color:"gray",size:"xl"})}):m.length===0?e("div",{className:"DocPickerModal__DocsList__empty",children:s.length===0?"Collection is empty.":"No documents match your search."}):e("div",{className:"DocPickerModal__DocsList__docs",children:m.map(_=>e(k.DocCard,{doc:_,onDocSelected:o.onDocSelected,onDocUnselected:o.onDocUnselected,multiSelect:o.multiSelect,selected:i.includes(_.id),enableStatusBadges:d.enableStatusBadges},_.id))}):e("div",{className:"DocPickerModal__DocsList__empty",children:"Select a content type to view documents"})}),d.collectionSelectValue&&e(I,{collection:d.collectionSelectValue,opened:u,skipNavigation:!0,onClose:()=>{r(!1),D()}})]})};k.DocCard=o=>{let[t,l]=g(!!o.selected),c=o.doc,[a,u]=c.id.split("/"),r=c.fields||{},n=window.__ROOT_CTX.collections[a],D=`/cms/content/${a}/${u}`,s=v(r,n.preview?.title||"meta.title"),m=v(r,n.preview?.image||"meta.image")||n.preview?.defaultImage;return e("div",{className:"DocPickerModal__DocCard",children:[e("div",{className:"DocPickerModal__DocCard__image",onClick:()=>window.open(D,"_blank"),children:e(L,{file:m,width:120,height:90,withPlaceholder:!m?.src})}),e("div",{className:"DocPickerModal__DocCard__content",children:[e("div",{className:"DocPickerModal__DocCard__content__header",children:e("div",{className:"DocPickerModal__DocCard__content__header__docId",onClick:()=>window.open(D,"_blank"),children:c.id})}),e("div",{className:"DocPickerModal__DocCard__content__title",children:e("div",{className:"DocPickerModal__DocCard__content__link",onClick:()=>window.open(D,"_blank"),children:s||"[UNTITLED]"})}),o.enableStatusBadges&&e("div",{className:"DocPickerModal__DocCard__content__badges",children:e(N,{doc:c})})]}),e("div",{className:"DocPickerModal__DocCard__controls",children:e("div",{className:"DocPickerModal__DocCard__controls__buttons",children:o.multiSelect?t?e(p,{variant:"light",color:"blue",size:"xs",onClick:()=>{l(!1),o.onDocUnselected(o.doc)},children:"Unselect"}):e(p,{variant:"filled",color:"blue",size:"xs",onClick:()=>{l(!0),o.onDocSelected(o.doc)},children:"Select"}):e(p,{color:"blue",size:"xs",onClick:()=>o.onDocSelected(o.doc),children:"Select"})})})]})};k.id=h;export{ee as a,k as b};
1
+ import{e as z,j as I}from"./chunk-PPYM4O5N.js";import{c as N,e as L}from"./chunk-DS27MO63.js";import{a as C}from"./chunk-FJLNXXE3.js";import{a as w,c as y}from"./chunk-HARRKJFZ.js";import{b as v}from"./chunk-5MV6XVGA.js";import{Cc as B,Ga as e,V as P,a as g,da as p,g as M,j as x,ua as S,za as f}from"./chunk-LROR6N3B.js";x();x();function O(o,t){return M(()=>{if(!t.trim())return o;let l=t.toLowerCase();return o.filter(c=>{let[a,u]=c.id.split("/"),r=c.fields||{},n=window.__ROOT_CTX.collections[a],s=v(r,n.preview?.title||"meta.title")||"";return c.id.toLowerCase().includes(l)||s.toLowerCase().includes(l)||u.toLowerCase().includes(l)})},[o,t])}var h="DocPickerModal";function ee(){let o=w(),t=y();return{open:l=>{o.openContextModal(h,{...t,innerProps:l,size:"700px",overflow:"inside"})},close:()=>{o.closeModal(h)}}}function k(o){let{innerProps:t}=o,l=Object.keys(window.__ROOT_CTX.collections);t.collections?.length&&(l=l.filter(i=>t.collections?.includes(i)));let c=[{value:"",label:"Select"}];l.forEach(i=>{c.push({value:i,label:i})});let[a,u]=C("DocPickerModal.lastSelectedCollection",""),r=()=>t.initialCollection?t.initialCollection:a&&l.includes(a)?a:l.length===1?l[0]:"",[n,D]=g(r()),s=i=>{D(i),u(i)};function m(i){t.multiSelect&&t.onChangeMulti?t.onChangeMulti(i.id,!0):t.onChange&&t.onChange(i.id)}function b(i){t.multiSelect&&t.onChangeMulti&&t.onChangeMulti(i.id,!1)}return e("div",{className:"DocPickerModal",children:[l.length===0&&e("div",{className:"DocPickerModal__noCollections",children:"No collections matching schema field definition."}),l.length>0&&e(k.DocsList,{collection:n,onDocSelected:m,onDocUnselected:b,onCollectionChange:s,multiSelect:t.multiSelect,selectedDocIds:t.selectedDocIds,options:{enableSearch:t.enableSearch??!0,enableSort:t.enableSort??!0,enableCreate:t.enableCreate??!0,enableStatusBadges:t.enableStatusBadges??!0,showCollectionSelect:l.length>1,collectionSelectValue:n,collectionSelectOptions:c}})]})}k.DocsList=o=>{let[t,l]=g(""),[c,a]=C(`root::DocPickerModal:${o.collection}:sortBy`,"modifiedAt"),[u,r]=g(!1),[n,D,s]=z(o.collection||"",{orderBy:c}),m=O(s,t),b=[{value:"modifiedAt",label:"Last Modified"},{value:"slug",label:"A-Z"},{value:"slugDesc",label:"Z-A"},{value:"newest",label:"Newest"},{value:"oldest",label:"Oldest"}],i=o.selectedDocIds||[],d=o.options||{};return e("div",{className:"DocPickerModal__DocsList",children:[e("div",{className:"DocPickerModal__DocsList__stickyHeader",children:[d.showCollectionSelect&&e("div",{className:"DocPickerModal__collection__select",children:[e("div",{className:"DocPickerModal__collection__select__label",children:"Content Type:"}),e(f,{data:d.collectionSelectOptions||[],value:d.collectionSelectValue,placeholder:"Select",onChange:_=>{o.onCollectionChange?.(_||"")},size:"xs",radius:0,searchable:!0,autoFocus:!0,dropdownComponent:"div"}),d.collectionSelectValue&&e(p,{variant:"outline",color:"dark",size:"xs",onClick:()=>r(!0),children:"New"})]}),d.enableSearch&&d.collectionSelectValue&&e("div",{className:"DocPickerModal__DocsList__controls",children:[e(S,{placeholder:"Search documents...",value:t,onChange:_=>l(_.target.value),icon:e(B,{size:16}),size:"xs",className:"DocPickerModal__DocsList__controls__search"}),d.enableSort&&e(f,{data:b,value:c,onChange:_=>a(_||"modifiedAt"),size:"xs",className:"DocPickerModal__DocsList__controls__sort"})]}),!n&&s.length>0&&e("div",{className:"DocPickerModal__DocsList__count",children:["Showing ",m.length," of ",s.length," documents"]})]}),e("div",{className:"DocPickerModal__DocsList__docsContainer",children:o.collection?n?e("div",{className:"DocPickerModal__DocsList__loading",children:e(P,{color:"gray",size:"xl"})}):m.length===0?e("div",{className:"DocPickerModal__DocsList__empty",children:s.length===0?"Collection is empty.":"No documents match your search."}):e("div",{className:"DocPickerModal__DocsList__docs",children:m.map(_=>e(k.DocCard,{doc:_,onDocSelected:o.onDocSelected,onDocUnselected:o.onDocUnselected,multiSelect:o.multiSelect,selected:i.includes(_.id),enableStatusBadges:d.enableStatusBadges},_.id))}):e("div",{className:"DocPickerModal__DocsList__empty",children:"Select a content type to view documents"})}),d.collectionSelectValue&&e(I,{collection:d.collectionSelectValue,opened:u,skipNavigation:!0,onClose:()=>{r(!1),D()}})]})};k.DocCard=o=>{let[t,l]=g(!!o.selected),c=o.doc,[a,u]=c.id.split("/"),r=c.fields||{},n=window.__ROOT_CTX.collections[a],D=`/cms/content/${a}/${u}`,s=v(r,n.preview?.title||"meta.title"),m=v(r,n.preview?.image||"meta.image")||n.preview?.defaultImage;return e("div",{className:"DocPickerModal__DocCard",children:[e("div",{className:"DocPickerModal__DocCard__image",onClick:()=>window.open(D,"_blank"),children:e(L,{file:m,width:120,height:90,withPlaceholder:!m?.src})}),e("div",{className:"DocPickerModal__DocCard__content",children:[e("div",{className:"DocPickerModal__DocCard__content__header",children:e("div",{className:"DocPickerModal__DocCard__content__header__docId",onClick:()=>window.open(D,"_blank"),children:c.id})}),e("div",{className:"DocPickerModal__DocCard__content__title",children:e("div",{className:"DocPickerModal__DocCard__content__link",onClick:()=>window.open(D,"_blank"),children:s||"[UNTITLED]"})}),o.enableStatusBadges&&e("div",{className:"DocPickerModal__DocCard__content__badges",children:e(N,{doc:c})})]}),e("div",{className:"DocPickerModal__DocCard__controls",children:e("div",{className:"DocPickerModal__DocCard__controls__buttons",children:o.multiSelect?t?e(p,{variant:"light",color:"blue",size:"xs",onClick:()=>{l(!1),o.onDocUnselected(o.doc)},children:"Unselect"}):e(p,{variant:"filled",color:"blue",size:"xs",onClick:()=>{l(!0),o.onDocSelected(o.doc)},children:"Select"}):e(p,{color:"blue",size:"xs",onClick:()=>o.onDocSelected(o.doc),children:"Select"})})})]})};k.id=h;export{ee as a,k as b};
@@ -1 +1 @@
1
- import{c as F}from"./chunk-AZCGXQTL.js";import{b as P}from"./chunk-5MV6XVGA.js";import{N as T,b as S}from"./chunk-TFB3VGWP.js";import{b as $}from"./chunk-J5E457OI.js";import{b as p,d as b}from"./chunk-KRNQ6L35.js";import{f as w}from"./chunk-YLSRRNSE.js";import{Fa as g,Ga as t,V as N,a as f,ba as l,c as h,e as k,i as R,j as B,la as I}from"./chunk-LROR6N3B.js";import{d as y,j as x,k as M}from"./chunk-KUCVLANF.js";M();B();var L=x(null);function W(e){let[i,n]=f([]),[o,a]=f(!1),r=k("idle");function u(){r.current==="idle"&&(r.current="fetching",a(!0),F().then(s=>{let c=s.filter(m=>!m.publishedAt&&!m.archivedAt);n(c)}).catch(s=>{console.error("Failed to fetch pending releases:",s)}).finally(()=>{r.current="done",a(!1)}))}function d(s){return i.filter(c=>c.docIds?.includes(s))}return t(L.Provider,{value:{releases:i,getReleasesForDoc:d,loading:o,fetchReleases:u},children:e.children})}function A(){let e=R(L);if(!e)throw new Error("usePendingReleases must be used within a <PendingReleasesProvider>");let{fetchReleases:i,...n}=e;return h(()=>{i()},[]),n}function z(e){let i={transition:"pop"},n=e.doc,o=n.sys;return t("div",{className:"DocStatusBadges",children:[(!o.publishedAt||!o.modifiedAt||o.modifiedAt>o.publishedAt)&&t(g,{...i,label:`Modified ${_(o.modifiedAt)} by ${o.modifiedBy}`,children:t(l,{size:"xs",variant:"gradient",gradient:{from:"indigo",to:"cyan"},children:"Draft"})}),!!o.publishedAt&&t(g,{...i,label:`Published ${_(o.publishedAt)} by ${o.publishedBy}`,children:t(l,{size:"xs",variant:"gradient",gradient:{from:"teal",to:"lime",deg:105},children:"Published"})}),!!o.scheduledAt&&t(g,{...i,label:`Scheduled ${b(o.scheduledAt)} by ${o.scheduledBy}`,children:t(l,{size:"xs",variant:"gradient",gradient:{from:"grape",to:"pink",deg:35},children:"Scheduled"})}),!e.hideReleases&&t(K,{docId:e.docId||n.id,tooltipProps:i}),T(n)&&t(g,{...i,label:O(n),children:t(l,{size:"xs",variant:"gradient",gradient:{from:"orange",to:"red"},className:e.onPublishingLockClick?"DocStatusBadges__badge--clickable":void 0,style:e.onPublishingLockClick?{cursor:"pointer"}:void 0,role:e.onPublishingLockClick?"button":void 0,tabIndex:e.onPublishingLockClick?0:void 0,onClick:e.onPublishingLockClick,onKeyDown:e.onPublishingLockClick?a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),e.onPublishingLockClick())}:void 0,children:"Locked"})}),!!o.archivedAt&&t(g,{...i,label:`Archived ${_(o.archivedAt)} by ${o.archivedBy}`,children:t(l,{size:"xs",variant:"gradient",gradient:{from:"gray",to:"dark"},children:"Archived"})})]})}function O(e){let i=e.sys?.publishingLocked;return i?i.until?`Locked until ${b(i.until)} by ${i.lockedBy}: "${i.reason}"`:`Locked by ${i.lockedBy}: "${i.reason}"`:""}function K(e){let{getReleasesForDoc:i}=A(),n=i(e.docId);return n.length===0?null:t(y,{children:n.map(o=>t(g,{...e.tooltipProps,label:`In release: ${o.id}`,children:t(l,{component:"a",href:`/cms/releases/${o.id}`,size:"xs",variant:"gradient",gradient:{from:"violet",to:"grape"},style:{cursor:"pointer"},children:o.id})},o.id))})}function _(e){return e?p(e.toMillis()):p(new Date().getTime())}function E(e){let{file:i,width:n,height:o,withPlaceholder:a,className:r,alt:u}=e,d=typeof i=="string"?i:i?.src;return U(i)?t(X,{className:r,src:d,width:n,height:o}):t(I,{className:r,src:d,width:n,height:o,withPlaceholder:a,alt:u})}function U(e){if(!e)return!1;if(typeof e=="string")return/\.mp4($|\?)/i.test(e);if(typeof e.mimeType=="string")return e.mimeType.toLowerCase()==="video/mp4";let i=e.src;return typeof i!="string"?!1:/\.mp4($|\?)/i.test(i)}function X(e){return t("video",{className:e.className,src:e.src,width:e.width,height:e.height,muted:!0,playsInline:!0,preload:"metadata",style:{width:`${e.width}px`,height:`${e.height}px`,backgroundColor:"#f1f3f5",objectFit:"cover",display:"block"}})}B();function De(e){let i=e.docId,[n,o]=f(e.doc),[a,r]=f(!e.doc);async function u(){r(!0),await $(async()=>{let V=await S(i);o(V)}),r(!1)}if(h(()=>{u()},[i]),a)return t("div",{className:w(e.className,"DocPreviewCard","DocPreviewCard--loading",e.variant&&`DocPreviewCard--${e.variant}`),children:t(N,{color:"gray",size:"sm"})});if(!n)return;let[d]=i.split("/"),s=n.fields||{},c=window.__ROOT_CTX.collections[d];if(!c)return console.error(`could not find collection: ${d}`),t("div",{className:"DocPreviewCard",children:["Collection ",t("b",{children:d})," not found."]});let m=P(s,c.preview?.title||"meta.title"),C=P(s,c.preview?.image||"meta.image")||c.preview?.defaultImage,D="div",v={};return e.clickable&&(D="a",v.href=`/cms/content/${e.docId}`,v.target="_blank"),t(D,{className:w(e.className,"DocPreviewCard",e.variant&&`DocPreviewCard--${e.variant}`),...v,children:[t("div",{className:"DocPreviewCard__image",children:t(E,{file:C,width:80,height:60,withPlaceholder:!C?.src})}),t("div",{className:"DocPreviewCard__content",children:[t("div",{className:"DocPreviewCard__content__header",children:t("div",{className:"DocPreviewCard__content__header__docId",children:n.id})}),t("div",{className:"DocPreviewCard__content__title",children:m||"[UNTITLED]"}),e.statusBadges&&n&&t("div",{className:"DocPreviewCard__content__badges",children:t(z,{doc:n,hideReleases:e.hideReleases})})]})]})}export{W as a,A as b,z as c,O as d,E as e,De as f};
1
+ import{c as F}from"./chunk-IOR72US3.js";import{b as P}from"./chunk-5MV6XVGA.js";import{N as T,b as S}from"./chunk-Z6DBYLIM.js";import{b as $}from"./chunk-J5E457OI.js";import{b as p,d as b}from"./chunk-KRNQ6L35.js";import{e as w}from"./chunk-BUNR5EU3.js";import{Fa as g,Ga as t,V as N,a as f,ba as l,c as h,e as k,i as R,j as B,la as I}from"./chunk-LROR6N3B.js";import{d as y,j as x,k as M}from"./chunk-KUCVLANF.js";M();B();var L=x(null);function W(e){let[i,n]=f([]),[o,a]=f(!1),r=k("idle");function u(){r.current==="idle"&&(r.current="fetching",a(!0),F().then(s=>{let c=s.filter(m=>!m.publishedAt&&!m.archivedAt);n(c)}).catch(s=>{console.error("Failed to fetch pending releases:",s)}).finally(()=>{r.current="done",a(!1)}))}function d(s){return i.filter(c=>c.docIds?.includes(s))}return t(L.Provider,{value:{releases:i,getReleasesForDoc:d,loading:o,fetchReleases:u},children:e.children})}function A(){let e=R(L);if(!e)throw new Error("usePendingReleases must be used within a <PendingReleasesProvider>");let{fetchReleases:i,...n}=e;return h(()=>{i()},[]),n}function z(e){let i={transition:"pop"},n=e.doc,o=n.sys;return t("div",{className:"DocStatusBadges",children:[(!o.publishedAt||!o.modifiedAt||o.modifiedAt>o.publishedAt)&&t(g,{...i,label:`Modified ${_(o.modifiedAt)} by ${o.modifiedBy}`,children:t(l,{size:"xs",variant:"gradient",gradient:{from:"indigo",to:"cyan"},children:"Draft"})}),!!o.publishedAt&&t(g,{...i,label:`Published ${_(o.publishedAt)} by ${o.publishedBy}`,children:t(l,{size:"xs",variant:"gradient",gradient:{from:"teal",to:"lime",deg:105},children:"Published"})}),!!o.scheduledAt&&t(g,{...i,label:`Scheduled ${b(o.scheduledAt)} by ${o.scheduledBy}`,children:t(l,{size:"xs",variant:"gradient",gradient:{from:"grape",to:"pink",deg:35},children:"Scheduled"})}),!e.hideReleases&&t(K,{docId:e.docId||n.id,tooltipProps:i}),T(n)&&t(g,{...i,label:O(n),children:t(l,{size:"xs",variant:"gradient",gradient:{from:"orange",to:"red"},className:e.onPublishingLockClick?"DocStatusBadges__badge--clickable":void 0,style:e.onPublishingLockClick?{cursor:"pointer"}:void 0,role:e.onPublishingLockClick?"button":void 0,tabIndex:e.onPublishingLockClick?0:void 0,onClick:e.onPublishingLockClick,onKeyDown:e.onPublishingLockClick?a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),e.onPublishingLockClick())}:void 0,children:"Locked"})}),!!o.archivedAt&&t(g,{...i,label:`Archived ${_(o.archivedAt)} by ${o.archivedBy}`,children:t(l,{size:"xs",variant:"gradient",gradient:{from:"gray",to:"dark"},children:"Archived"})})]})}function O(e){let i=e.sys?.publishingLocked;return i?i.until?`Locked until ${b(i.until)} by ${i.lockedBy}: "${i.reason}"`:`Locked by ${i.lockedBy}: "${i.reason}"`:""}function K(e){let{getReleasesForDoc:i}=A(),n=i(e.docId);return n.length===0?null:t(y,{children:n.map(o=>t(g,{...e.tooltipProps,label:`In release: ${o.id}`,children:t(l,{component:"a",href:`/cms/releases/${o.id}`,size:"xs",variant:"gradient",gradient:{from:"violet",to:"grape"},style:{cursor:"pointer"},children:o.id})},o.id))})}function _(e){return e?p(e.toMillis()):p(new Date().getTime())}function E(e){let{file:i,width:n,height:o,withPlaceholder:a,className:r,alt:u}=e,d=typeof i=="string"?i:i?.src;return U(i)?t(X,{className:r,src:d,width:n,height:o}):t(I,{className:r,src:d,width:n,height:o,withPlaceholder:a,alt:u})}function U(e){if(!e)return!1;if(typeof e=="string")return/\.mp4($|\?)/i.test(e);if(typeof e.mimeType=="string")return e.mimeType.toLowerCase()==="video/mp4";let i=e.src;return typeof i!="string"?!1:/\.mp4($|\?)/i.test(i)}function X(e){return t("video",{className:e.className,src:e.src,width:e.width,height:e.height,muted:!0,playsInline:!0,preload:"metadata",style:{width:`${e.width}px`,height:`${e.height}px`,backgroundColor:"#f1f3f5",objectFit:"cover",display:"block"}})}B();function De(e){let i=e.docId,[n,o]=f(e.doc),[a,r]=f(!e.doc);async function u(){r(!0),await $(async()=>{let V=await S(i);o(V)}),r(!1)}if(h(()=>{u()},[i]),a)return t("div",{className:w(e.className,"DocPreviewCard","DocPreviewCard--loading",e.variant&&`DocPreviewCard--${e.variant}`),children:t(N,{color:"gray",size:"sm"})});if(!n)return;let[d]=i.split("/"),s=n.fields||{},c=window.__ROOT_CTX.collections[d];if(!c)return console.error(`could not find collection: ${d}`),t("div",{className:"DocPreviewCard",children:["Collection ",t("b",{children:d})," not found."]});let m=P(s,c.preview?.title||"meta.title"),C=P(s,c.preview?.image||"meta.image")||c.preview?.defaultImage,D="div",v={};return e.clickable&&(D="a",v.href=`/cms/content/${e.docId}`,v.target="_blank"),t(D,{className:w(e.className,"DocPreviewCard",e.variant&&`DocPreviewCard--${e.variant}`),...v,children:[t("div",{className:"DocPreviewCard__image",children:t(E,{file:C,width:80,height:60,withPlaceholder:!C?.src})}),t("div",{className:"DocPreviewCard__content",children:[t("div",{className:"DocPreviewCard__content__header",children:t("div",{className:"DocPreviewCard__content__header__docId",children:n.id})}),t("div",{className:"DocPreviewCard__content__title",children:m||"[UNTITLED]"}),e.statusBadges&&n&&t("div",{className:"DocPreviewCard__content__badges",children:t(z,{doc:n,hideReleases:e.hideReleases})})]})]})}export{W as a,A as b,z as c,O as d,E as e,De as f};
@@ -1 +1 @@
1
- import{a as p,d as U,e as g}from"./chunk-CAY5NM4Z.js";import{f as u}from"./chunk-YLSRRNSE.js";import{Fa as d,Ga as t,a as f,aa as v,j as x}from"./chunk-LROR6N3B.js";import{d as c}from"./chunk-KUCVLANF.js";x();function A(e){let a=e.size||30,l=e.withTooltip!==!1,{profile:_}=g(e.profile===void 0?e.email:null),s=e.profile!==void 0?e.profile:_,r=s?.email||e.email||"",i=s?.displayName||"",o=s?.photoURL||"",[n,h]=f(!1),m=t(v,{className:u("UserAvatar",e.inactive&&"UserAvatar--inactive",e.className),src:!n&&o?o:void 0,alt:i||r,size:a,radius:"xl",style:!o||n?{backgroundColor:U(r||i||"?"),color:"#fff",fontWeight:600,fontSize:Math.max(10,Math.round(a*.4))}:void 0,imageProps:{onError:()=>h(!0)},children:!o||n?p(r,i):null});return l?t(A.Tooltip,{email:r,displayName:i,children:m}):m}A.Tooltip=function(a){if(!a.email&&!a.displayName)return t(c,{children:a.children});let l=t("div",{className:"UserAvatar__tooltip",children:[a.displayName&&t("div",{className:"UserAvatar__tooltip__name",children:a.displayName}),a.email&&t("div",{className:"UserAvatar__tooltip__email",children:a.email})]});return t(d,{label:l,position:"bottom",withArrow:!0,transition:"pop",children:a.children})};export{A as a};
1
+ import{a as p,d as U,e as g}from"./chunk-CAY5NM4Z.js";import{e as u}from"./chunk-BUNR5EU3.js";import{Fa as d,Ga as t,a as f,aa as v,j as x}from"./chunk-LROR6N3B.js";import{d as c}from"./chunk-KUCVLANF.js";x();function A(e){let a=e.size||30,l=e.withTooltip!==!1,{profile:_}=g(e.profile===void 0?e.email:null),s=e.profile!==void 0?e.profile:_,r=s?.email||e.email||"",i=s?.displayName||"",o=s?.photoURL||"",[n,h]=f(!1),m=t(v,{className:u("UserAvatar",e.inactive&&"UserAvatar--inactive",e.className),src:!n&&o?o:void 0,alt:i||r,size:a,radius:"xl",style:!o||n?{backgroundColor:U(r||i||"?"),color:"#fff",fontWeight:600,fontSize:Math.max(10,Math.round(a*.4))}:void 0,imageProps:{onError:()=>h(!0)},children:!o||n?p(r,i):null});return l?t(A.Tooltip,{email:r,displayName:i,children:m}):m}A.Tooltip=function(a){if(!a.email&&!a.displayName)return t(c,{children:a.children});let l=t("div",{className:"UserAvatar__tooltip",children:[a.displayName&&t("div",{className:"UserAvatar__tooltip__name",children:a.displayName}),a.email&&t("div",{className:"UserAvatar__tooltip__email",children:a.email})]});return t(d,{label:l,position:"bottom",withArrow:!0,transition:"pop",children:a.children})};export{A as a};
@@ -0,0 +1 @@
1
+ import{a as Vt}from"./chunk-AAHM6RYJ.js";import{d as Y,e as N}from"./chunk-BUNR5EU3.js";import{C as dt,Cc as zt,D as j,E as ut,Fa as Et,Fb as Bt,Fc as Wt,G as U,Ga as r,H as mt,I as gt,K as ft,O as ht,Ob as It,P as _t,Q as vt,S as Q,T as yt,Tb as Tt,Y as S,Ya as Pt,Z as bt,_ as Ct,a as x,aa as xt,c as O,e as pt,ec as Mt,fa as wt,fb as At,ha as St,ia as kt,j as je,ja as Lt,ka as Ot,ob as Nt,pc as Dt,qa as Z,ua as jt,v as n,xc as Ht,y as w,yc as Rt}from"./chunk-LROR6N3B.js";import{d as V,j as ct}from"./chunk-KUCVLANF.js";var tt={name:"@blinkk/root-cms",version:"3.1.3",author:"s@blinkk.com",license:"MIT",engines:{node:">=22.0.0"},repository:{type:"git",url:"git+https://github.com/blinkk/rootjs.git",directory:"packages/root-cms"},files:["dist/**/*"],bin:{"root-cms":"./bin/root-cms.js"},type:"module",module:"./dist/core.js",types:"./dist/core/core.d.ts",exports:{".":{types:"./dist/core/core.d.ts",import:"./dist/core.js"},"./browser-client":{types:"./dist/browser-client/browser-client.d.ts",import:"./dist/browser-client.js"},"./client":{types:"./dist/core/client.d.ts",import:"./dist/client.js"},"./core":{types:"./dist/core/core.d.ts",import:"./dist/core.js"},"./functions":{types:"./dist/core/functions.d.ts",import:"./dist/functions.js"},"./plugin":{types:"./dist/core/plugin.d.ts",import:"./dist/plugin.js"},"./project":{types:"./dist/core/project.d.ts",import:"./dist/project.js"},"./richtext":{types:"./dist/core/richtext.d.ts",import:"./dist/richtext.js"}},scripts:{build:'rm -rf dist && concurrently -n "core,signin,ui" npm:build:core npm:build:signin npm:build:ui',"build:core":"node ../../scripts/build-esbuild.mjs ./esbuild.config.json","build:ui":"pnpm build:ui:bundle && pnpm build:ui:clean","build:ui:bundle":"esbuild ui/ui.tsx --bundle --minify --alias:react=@preact/compat --alias:react-dom=@preact/compat --tsconfig=ui/tsconfig.json --outdir=dist/ui --legal-comments=external --splitting --format=esm","build:ui:clean":"rm -f dist/ui/*-*.css","build:signin":"esbuild signin/signin.tsx --bundle --minify --tsconfig=signin/tsconfig.json --outdir=dist/ui --legal-comments=external",dev:'rm -rf dist && concurrently -k -n "core,ui" npm:dev:core npm:dev:signin npm:dev:ui',"dev:core":"pnpm build:core --watch","dev:signin":"pnpm build:signin --watch","dev:ui":"pnpm build:ui:bundle --watch",test:"pnpm build && firebase emulators:exec 'vitest run --exclude=**/*.visual.test.tsx'","test:visual":"vitest run --config=vitest.config.visual.ts","test:watch":"pnpm build && firebase emulators:exec 'vitest'"},dependencies:{"@ag-grid-community/client-side-row-model":"32.3.9","@ag-grid-community/core":"32.3.9","@ag-grid-community/react":"32.3.9","@ag-grid-community/styles":"32.3.9","@ai-sdk/anthropic":"3.0.74","@ai-sdk/google":"3.0.67","@ai-sdk/openai":"3.0.60","@ai-sdk/openai-compatible":"2.0.46","@ai-sdk/react":"3.0.177","@google-cloud/firestore":"7.11.3","@hello-pangea/dnd":"18.0.1","@mantine/spotlight":"4.2.12","@types/cli-progress":"3.11.6",ai:"6.0.175","body-parser":"1.20.2","cli-progress":"3.12.0",commander:"11.0.0","csv-parse":"5.5.2","csv-stringify":"6.4.4","date-fns":"4.1.0","date-fns-tz":"3.2.0",diff:"8.0.2","dts-dom":"3.7.0","fnv-plus":"1.3.1",jsonwebtoken:"9.0.2",kleur:"4.1.5",minisearch:"7.2.0","sanitize-html":"2.13.1",sirv:"2.0.3","tiny-glob":"0.2.9",zod:"4.4.3"},"//":"NOTE(stevenle): due to compat issues with mantine and preact, mantine is pinned to v4.2.12",devDependencies:{"@babel/core":"7.17.9","@blinkk/root":"workspace:*","@editorjs/editorjs":"2.30.8","@editorjs/header":"2.8.8","@editorjs/image":"2.10.2","@editorjs/list":"2.0.6","@editorjs/nested-list":"1.4.3","@editorjs/raw":"2.5.1","@editorjs/table":"2.4.4","@editorjs/underline":"1.2.1","@emotion/react":"11.10.5","@firebase/app-compat":"0.5.2","@firebase/app-types":"0.9.3","@firebase/rules-unit-testing":"5.0.0","@lexical/code":"0.33.1","@lexical/html":"0.33.1","@lexical/link":"0.33.1","@lexical/list":"0.33.1","@lexical/markdown":"0.33.1","@lexical/react":"0.33.1","@lexical/rich-text":"0.33.1","@lexical/selection":"0.33.1","@lexical/table":"0.33.1","@lexical/utils":"0.33.1","@mantine/core":"4.2.12","@mantine/hooks":"4.2.12","@mantine/modals":"4.2.12","@mantine/notifications":"4.2.12","@preact/compat":"18.3.1","@tabler/icons-preact":"3.35.0","@testing-library/preact":"3.2.4","@testing-library/user-event":"14.6.1","@types/body-parser":"1.19.3","@types/fnv-plus":"1.3.2","@types/gapi":"0.0.47","@types/gapi.client.drive-v3":"0.0.4","@types/gapi.client.sheets-v4":"0.0.4","@types/google.accounts":"0.0.14","@types/jsonwebtoken":"9.0.1","@types/node":"24.3.1","@types/sanitize-html":"2.13.0","@vitest/browser":"4.1.8","@vitest/browser-playwright":"4.1.8",concurrently:"7.6.0",esbuild:"0.28.0",firebase:"12.2.1","firebase-admin":"13.5.0","firebase-functions":"6.4.0","firebase-tools":"14.15.2","highlight.js":"11.6.0",jsdom:"27.2.0","json-diff-kit":"1.0.29",lexical:"0.33.1",marked:"9.1.1","mdast-util-from-markdown":"2.0.1","mdast-util-gfm":"3.0.0","micromark-extension-gfm":"3.0.0",playwright:"1.60.0",preact:"10.27.1","preact-iso":"2.11.1","preact-render-to-string":"6.6.7",react:"npm:@preact/compat@18.3.1","react-dom":"npm:@preact/compat@18.3.1","react-easy-crop":"5.5.6","react-json-view-compare":"2.0.2",typescript:"6.0.3",vite:"8.0.13",vitest:"4.1.6",yjs:"13.6.27"},peerDependencies:{"@blinkk/root":"3.1.3","firebase-admin":">=11","firebase-functions":">=4"},peerDependenciesMeta:{"firebase-functions":{optional:!0}}};function Ut(){return r("svg",{width:"100",height:"23",viewBox:"0 0 100 23",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[r("g",{"clip-path":"url(#clip0_1_318)",children:[r("path",{d:"M7.82998 5.01802C3.12925 5.6479 0.833937 18.1194 2.62578 19.6731C5.64773 22.2934 16.6441 14.1722 15.6786 9.46913C15.3009 6.61371 11.2717 4.28377 7.82998 5.01802Z",fill:"black"}),r("path",{d:"M13.9782 0.720147C12.6553 0.896474 12.0093 4.38767 12.5136 4.8226C13.364 5.55611 16.4587 3.28271 16.187 1.96616C16.0807 1.16683 14.9468 0.514607 13.9782 0.720147Z",fill:"black"}),r("path",{d:"M92.7383 17.6275C90.9681 17.6275 89.3816 17.0263 88.3796 16.0744C87.9955 15.7237 87.8953 15.3396 88.246 14.9555L88.8305 14.2541C89.1645 13.87 89.5486 13.7865 89.9327 14.1205C90.6007 14.6883 91.7029 15.1726 92.5713 15.1726C93.5232 15.1726 94.1244 14.8219 94.1244 14.2875C94.1244 13.5193 93.2059 13.4358 91.9868 13.0684C90.417 12.6008 88.5132 11.7324 88.5132 9.64493C88.5132 7.70773 90.25 6.37173 92.7383 6.37173C94.2413 6.37173 95.5272 6.87273 96.4123 7.57413C96.8131 7.90813 96.9467 8.27553 96.596 8.67633L96.0282 9.37773C95.7109 9.76183 95.3435 9.82863 94.926 9.51133C94.3916 9.09383 93.6568 8.69303 92.7884 8.69303C92.0202 8.69303 91.5192 9.01033 91.5192 9.51133C91.5192 10.1292 92.3041 10.4131 93.1224 10.6636C94.9761 11.2314 97.1304 11.8326 97.1304 14.2708C97.1304 16.4585 95.1264 17.6275 92.7383 17.6275Z",fill:"black"}),r("path",{d:"M87.0008 16.6756C87.0843 17.1766 86.8171 17.4271 86.2994 17.4271H85.097C84.596 17.4271 84.3789 17.1766 84.3121 16.6756L83.7443 11.9161L81.757 16.7424C81.5399 17.2434 81.1892 17.5106 80.6882 17.5106H80.5212C80.0202 17.5106 79.6695 17.2434 79.4524 16.7424L77.4651 11.8994L76.8973 16.6756C76.8472 17.1766 76.6301 17.4271 76.1291 17.4271H74.7263C74.2086 17.4271 73.9414 17.1766 74.0082 16.6756L75.4945 7.24013C75.5613 6.75583 75.8786 6.48863 76.3796 6.48863H76.5466C77.0476 6.48863 77.3315 6.75583 77.5486 7.24013L80.6047 13.8032L83.4938 7.24013C83.7109 6.75583 84.0115 6.48863 84.4958 6.48863H84.6795C85.1638 6.48863 85.4811 6.75583 85.5646 7.24013L87.0008 16.6756Z",fill:"black"}),r("path",{d:"M68.6496 17.6275C65.3096 17.6275 62.7211 15.2227 62.7211 11.9996C62.7211 8.77653 65.3096 6.37173 68.683 6.37173C70.3029 6.37173 71.7558 6.97293 72.7745 7.99163C73.1419 8.34233 73.1419 8.77653 72.7745 9.09383L71.9228 9.81193C71.5554 10.1292 71.2047 10.1125 70.8206 9.79523C70.2361 9.31093 69.5013 9.01033 68.683 9.01033C67.013 9.01033 65.7104 10.2628 65.7104 11.9996C65.7104 13.7364 67.013 14.9889 68.683 14.9889C69.5013 14.9889 70.2528 14.6883 70.8206 14.204C71.2047 13.8867 71.5554 13.87 71.9228 14.1873L72.7745 14.9054C73.1419 15.2227 73.1419 15.6569 72.7745 16.0076C71.7558 17.0263 70.3029 17.6275 68.6496 17.6275Z",fill:"black"}),r("path",{d:"M58.575 16.2915C58.7587 16.6923 58.4581 16.8927 58.241 17.0597C57.7233 17.4271 56.9384 17.6442 56.1201 17.6442C54.4501 17.6442 52.8469 16.6923 52.8469 14.4044V11.0978H52.1121C51.6111 11.0978 51.3439 10.8139 51.3439 10.3296V9.76183C51.3439 9.26083 51.6111 8.99363 52.1121 8.99363H52.8469V7.05643C52.8469 6.57213 53.1308 6.38843 53.6151 6.28823L54.9511 6.05443C55.4521 5.95423 55.7193 6.30493 55.7193 6.80593V8.99363H57.3726C57.8569 8.99363 58.1408 9.26083 58.1408 9.76183V10.3296C58.1408 10.8139 57.8569 11.0978 57.3726 11.0978H55.7193V14.1038C55.7193 14.9221 56.1368 15.1893 56.6545 15.1893C56.905 15.1893 57.1555 15.0724 57.3392 14.9555C57.7567 14.6883 57.9571 14.8887 58.1074 15.206L58.575 16.2915Z",fill:"black"}),r("path",{d:"M46.2592 17.6442C43.5538 17.6442 41.5999 15.7738 41.5999 13.2521C41.5999 10.7304 43.5538 8.86003 46.2592 8.86003C48.9646 8.86003 50.9185 10.7304 50.9185 13.2521C50.9185 15.7738 48.9646 17.6442 46.2592 17.6442ZM46.2592 15.1726C47.3113 15.1726 48.0628 14.3543 48.0628 13.2521C48.0628 12.1499 47.3113 11.3316 46.2592 11.3316C45.2071 11.3316 44.4389 12.1499 44.4389 13.2521C44.4389 14.3543 45.2071 15.1726 46.2592 15.1726Z",fill:"black"}),r("path",{d:"M36.052 17.6442C33.3466 17.6442 31.3927 15.7738 31.3927 13.2521C31.3927 10.7304 33.3466 8.86003 36.052 8.86003C38.7574 8.86003 40.7113 10.7304 40.7113 13.2521C40.7113 15.7738 38.7574 17.6442 36.052 17.6442ZM36.052 15.1726C37.1041 15.1726 37.8556 14.3543 37.8556 13.2521C37.8556 12.1499 37.1041 11.3316 36.052 11.3316C34.9999 11.3316 34.2317 12.1499 34.2317 13.2521C34.2317 14.3543 34.9999 15.1726 36.052 15.1726Z",fill:"black"}),r("path",{d:"M28.7099 13.0851L30.6805 16.6422C30.9644 17.1599 30.6638 17.4271 30.1628 17.4271H28.4594C27.9417 17.4271 27.8081 17.1766 27.5242 16.6589L25.7707 13.4859H24.6351V16.6422C24.6351 17.1432 24.3512 17.4271 23.8502 17.4271H22.4808C21.9798 17.4271 21.6959 17.1432 21.6959 16.6422V7.35703C21.6959 6.85603 21.9798 6.57213 22.4808 6.57213H26.5222C29.3111 6.57213 30.8141 7.92483 30.8141 10.1125C30.8141 11.5654 29.9791 12.5841 28.7099 13.0851ZM24.6351 8.96023V11.5153H26.4721C27.2236 11.5153 27.8248 11.0644 27.8248 10.2628C27.8248 9.44453 27.2236 8.96023 26.4721 8.96023H24.6351Z",fill:"black"})]}),r("defs",{children:r("clipPath",{id:"clip0_1_318",children:r("rect",{width:"99",height:"22",fill:"white",transform:"translate(0.0175781 0.177246)"})})})]})}w();var Qt=ct(null);w();w();var Pe=Object.defineProperty,Ae=Object.defineProperties,Ne=Object.getOwnPropertyDescriptors,Zt=Object.getOwnPropertySymbols,Be=Object.prototype.hasOwnProperty,Ie=Object.prototype.propertyIsEnumerable,Gt=(t,e,o)=>e in t?Pe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,Te=(t,e)=>{for(var o in e||(e={}))Be.call(e,o)&&Gt(t,o,e[o]);if(Zt)for(var o of Zt(e))Ie.call(e,o)&&Gt(t,o,e[o]);return t},Me=(t,e)=>Ae(t,Ne(e));function De(t){return Me(Te({},t),{id:t.id||ft()})}function He(t){let e=[];return t.reduceRight((o,i)=>(e.includes(i.id)||(e.push(i.id),o.push(i)),o),[]).reverse()}function G(t){return He(t.map(e=>De(e)))}function Ft(t,e){let[o,i]=x(G(typeof t=="function"?t(e):t));return O(()=>{typeof t=="function"&&i(G(t(e)))},[e]),[o,{registerActions:s=>i(a=>G([...a,...s])),updateActions:s=>i(G(typeof s=="function"?s(e):s)),removeActions:s=>i(a=>a.filter(d=>!s.includes(d.id))),triggerAction:s=>{var a;let d=o.find(g=>g.id===s);(a=d?.onTrigger)==null||a.call(d,d)}}]}function Re(t,e){return t===null?[]:Array.isArray(t)?t.map(o=>[o,e]):[[t,e]]}function Kt(t,e){_t(Re(t,e))}w();w();var ze=j((t,{radius:e})=>({action:{position:"relative",display:"block",width:"100%",padding:"10px 12px",borderRadius:t.fn.radius(e)},actionHovered:{backgroundColor:t.colorScheme==="dark"?t.colors.dark[4]:t.colors.gray[1]},actionIcon:{color:t.colorScheme==="dark"?t.colors.dark[2]:t.colors.gray[6]},actionBody:{flex:1}})),$t=ze;var We=Object.defineProperty,F=Object.getOwnPropertySymbols,qt=Object.prototype.hasOwnProperty,Jt=Object.prototype.propertyIsEnumerable,Xt=(t,e,o)=>e in t?We(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,Ve=(t,e)=>{for(var o in e||(e={}))qt.call(e,o)&&Xt(t,o,e[o]);if(F)for(var o of F(e))Jt.call(e,o)&&Xt(t,o,e[o]);return t},Ue=(t,e)=>{var o={};for(var i in t)qt.call(t,i)&&e.indexOf(i)<0&&(o[i]=t[i]);if(t!=null&&F)for(var i of F(t))e.indexOf(i)<0&&Jt.call(t,i)&&(o[i]=t[i]);return o};function et(t){var e=t,{action:o,styles:i,classNames:l,hovered:c,onTrigger:m,highlightQuery:_,highlightColor:s,query:a,radius:d}=e,g=Ue(e,["action","styles","classNames","hovered","onTrigger","highlightQuery","highlightColor","query","radius"]);let{classes:u,cx:h}=$t({radius:d},{styles:i,classNames:l,name:"Spotlight"});return n.createElement(Q,Ve({className:h(u.action,{[u.actionHovered]:c}),tabIndex:-1,onMouseDown:b=>b.preventDefault(),onClick:m},g),n.createElement(wt,{noWrap:!0},o.icon&&n.createElement(yt,{className:u.actionIcon},o.icon),n.createElement("div",{className:u.actionBody},n.createElement(Ot,{highlightColor:s,highlight:_?a:null},o.title),o.description&&n.createElement(S,{color:"dimmed",size:"xs"},o.description))))}et.displayName="@mantine/spotlight/DefaultAction";w();var Qe=j(t=>({nothingFound:{},actions:{padding:t.spacing.xs/2,borderTop:`1px solid ${t.colorScheme==="dark"?t.colors.dark[4]:t.colors.gray[2]}`},actionsGroup:{textTransform:"uppercase",fontSize:t.spacing.xs,fontWeight:700,padding:"10px 12px",paddingBottom:0,paddingTop:15}})),Yt=Qe;function ot({actions:t,styles:e,classNames:o,actionComponent:i,hovered:l,onActionHover:c,onActionTrigger:m,query:_,nothingFoundMessage:s,highlightQuery:a,highlightColor:d,radius:g}){let{classes:u}=Yt(null,{classNames:o,styles:e,name:"Spotlight"}),h=t.map(v=>v.type==="item"?n.createElement(i,{query:_,key:v.item.id,action:v.item,hovered:v.index===l,onMouseEnter:()=>c(v.index),classNames:o,styles:e,radius:g,onTrigger:()=>m(v.item),highlightQuery:a,highlightColor:d}):n.createElement(S,{className:u.actionsGroup,color:"dimmed",key:v.label},v.label)),b=h.length>0||!!s&&_.trim().length>0;return n.createElement(n.Fragment,null,b&&n.createElement("div",{className:u.actions},h.length>0?h:n.createElement(S,{color:"dimmed",className:u.nothingFound,align:"center",size:"lg",py:"md"},s)))}ot.displayName="@mantine/spotlight/ActionsList";function Ze(t){return Array.isArray(t)?t.map(e=>e.trim()).join(",").toLowerCase().trim():typeof t=="string"?t.toLowerCase().trim():""}function te(t,e){let o=t.trim().toLowerCase(),i=[[],[]];return e.forEach(l=>{var c,m;(c=l.title)!=null&&c.toLowerCase().includes(o)?i[0].push(l):((m=l.description)!=null&&m.toLowerCase().includes(o)||Ze(l.keywords).includes(o))&&i[1].push(l)}),i.flat()}var Ge=Object.defineProperty,Fe=Object.defineProperties,Ke=Object.getOwnPropertyDescriptors,ee=Object.getOwnPropertySymbols,$e=Object.prototype.hasOwnProperty,Xe=Object.prototype.propertyIsEnumerable,oe=(t,e,o)=>e in t?Ge(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,re=(t,e)=>{for(var o in e||(e={}))$e.call(e,o)&&oe(t,o,e[o]);if(ee)for(var o of ee(e))Xe.call(e,o)&&oe(t,o,e[o]);return t},ie=(t,e)=>Fe(t,Ke(e)),qe=j((t,{centered:e,maxWidth:o,topOffset:i,radius:l})=>({root:ie(re({},t.fn.cover()),{position:"fixed"}),spotlight:{position:"relative",zIndex:2,backgroundColor:t.colorScheme==="dark"?t.colors.dark[6]:t.white,borderRadius:t.fn.radius(l),width:"100%",maxWidth:o,overflow:"hidden",marginLeft:"calc(var(--removed-scroll-width, 0px) * -1)"},overlay:ie(re({},t.fn.cover()),{position:"fixed"}),inner:{height:"100vh",display:"flex",flexDirection:"column",paddingTop:e?t.spacing.md:i,justifyContent:e?"center":"flex-start",alignItems:"center"},searchInput:{border:0,borderBottomRightRadius:0,borderBottomLeftRadius:0,backgroundColor:t.colorScheme==="dark"?t.colors.dark[6]:t.white}})),ne=qe;var Je=Object.defineProperty,K=Object.getOwnPropertySymbols,se=Object.prototype.hasOwnProperty,le=Object.prototype.propertyIsEnumerable,ae=(t,e,o)=>e in t?Je(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,Ye=(t,e)=>{for(var o in e||(e={}))se.call(e,o)&&ae(t,o,e[o]);if(K)for(var o of K(e))le.call(e,o)&&ae(t,o,e[o]);return t},to=(t,e)=>{var o={};for(var i in t)se.call(t,i)&&e.indexOf(i)<0&&(o[i]=t[i]);if(t!=null&&K)for(var i of K(t))e.indexOf(i)<0&&le.call(t,i)&&(o[i]=t[i]);return o};function rt(t){var e=t,{query:o,onQueryChange:i,actions:l,onClose:c,opened:m,withinPortal:_,transition:s="pop",transitionDuration:a,classNames:d,styles:g,overlayColor:u="#000",overlayOpacity:h=.25,overlayBlur:b=3,shadow:v="md",radius:E="sm",centered:X=!1,closeOnActionTrigger:B=!0,highlightQuery:I=!1,highlightColor:T,maxWidth:M=600,topOffset:D=120,className:q,searchPlaceholder:H,searchIcon:R,filter:fe=te,nothingFoundMessage:he,limit:_e=10,actionComponent:ve=et,actionsWrapperComponent:ye="div",zIndex:be=dt("modal")}=e,Ce=to(e,["query","onQueryChange","actions","onClose","opened","withinPortal","transition","transitionDuration","classNames","styles","overlayColor","overlayOpacity","overlayBlur","shadow","radius","centered","closeOnActionTrigger","highlightQuery","highlightColor","maxWidth","topOffset","className","searchPlaceholder","searchIcon","filter","nothingFoundMessage","limit","actionComponent","actionsWrapperComponent","zIndex"]);let[z,k]=x(-1),[xe,at]=x(!1),{classes:P,cx:we}=ne({centered:X,maxWidth:M,topOffset:D,radius:E},{classNames:d,styles:g,name:"Spotlight"}),[,st]=ht(),Se=gt(m),J=()=>k(-1),W=()=>{J(),c()};mt({transitionDuration:0,opened:m});let ke=fe(o,l).slice(0,_e),lt=ut(ke).items,L=lt.map(f=>f.type==="item"?f.item:void 0).filter(f=>f);U(()=>{L.length-1<z&&k(L.length-1)},[L.length]);let Le=f=>{var A;if(!xe)switch(f.code){case"ArrowDown":{f.preventDefault(),k(y=>y<L.length-1?y+1:0);break}case"ArrowUp":{f.preventDefault(),k(y=>y>0?y-1:L.length-1);break}case"Enter":{f.preventDefault();let y=L[z];(A=y?.onTrigger)==null||A.call(y,y),B&&y?.onTrigger&&W();break}case"Escape":f.preventDefault(),W()}},Oe=f=>{i(f.currentTarget.value),z===-1&&k(0)};return n.createElement(St,{withinPortal:_,zIndex:be},n.createElement(kt,{onExited:()=>st(!1),onEntered:()=>st(!0),mounted:m,transitions:{spotlight:{duration:a,transition:s,timingFunction:"ease"},overlay:{duration:a/2,transition:"fade",timingFunction:"ease"}}},f=>n.createElement("div",Ye({className:we(P.root,q)},Ce),n.createElement("div",{className:P.inner,ref:Se},n.createElement(bt,{style:f.spotlight,className:P.spotlight,shadow:v,radius:E,onMouseLeave:J},n.createElement(jt,{value:o,onChange:Oe,onKeyDown:Le,onCompositionStart:()=>at(!0),onCompositionEnd:()=>at(!1),classNames:{input:P.searchInput},size:"lg",placeholder:H,icon:R,onMouseEnter:J,autoComplete:"chrome-please-just-do-not-show-it-thanks"}),n.createElement(ye,null,n.createElement(ot,{highlightQuery:I,highlightColor:T,actions:lt,actionComponent:ve,hovered:z,query:o,nothingFoundMessage:he,onActionHover:k,onActionTrigger:A=>{A.onTrigger(A),B&&W()},styles:g,classNames:d,radius:E}))),n.createElement("div",{style:f.overlay},n.createElement(Lt,{className:P.overlay,zIndex:1,onMouseDown:W,color:u,opacity:h,blur:b}))))))}rt.displayName="@mantine/spotlight/Spotlight";w();var it={open:"mantine:open-spotlight",close:"mantine:close-spotlight",toggle:"mantine:toggle-spotlight",triggerAction:"mantine:trigger-spotlight-action",registerActions:"mantine:register-spotlight-actions",removeActions:"mantine:remove-spotlight-actions"};function eo(t,e){return new CustomEvent(t,{detail:e})}function nt(){window.dispatchEvent(eo(it.open))}function ce(t){let e={registerActions:o=>t.registerActions(o.detail),removeActions:o=>t.removeActions(o.detail),triggerAction:o=>t.triggerAction(o.detail),open:t.openSpotlight,close:t.closeSpotlight,toggle:t.toggleSpotlight};O(()=>(Object.keys(e).forEach(o=>{window.addEventListener(it[o],e[o])}),()=>{Object.keys(e).forEach(o=>{window.removeEventListener(it[o],e[o])})}),[])}var oo=Object.defineProperty,$=Object.getOwnPropertySymbols,de=Object.prototype.hasOwnProperty,ue=Object.prototype.propertyIsEnumerable,pe=(t,e,o)=>e in t?oo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,ro=(t,e)=>{for(var o in e||(e={}))de.call(e,o)&&pe(t,o,e[o]);if($)for(var o of $(e))ue.call(e,o)&&pe(t,o,e[o]);return t},io=(t,e)=>{var o={};for(var i in t)de.call(t,i)&&e.indexOf(i)<0&&(o[i]=t[i]);if(t!=null&&$)for(var i of $(t))e.indexOf(i)<0&&ue.call(t,i)&&(o[i]=t[i]);return o};function me(t){var e=t,{actions:o,children:i,shortcut:l="mod + K",onSpotlightClose:c,onSpotlightOpen:m,onQueryChange:_,cleanQueryOnClose:s=!0,transitionDuration:a=150}=e,d=io(e,["actions","children","shortcut","onSpotlightClose","onSpotlightOpen","onQueryChange","cleanQueryOnClose","transitionDuration"]);let g=pt(-1),[u,h]=x(""),[b,{registerActions:v,updateActions:E,removeActions:X,triggerAction:B}]=Ft(o,u);U(()=>{E(o)},[o]);let I=R=>{h(R),_?.(R)},[T,{open:M,close:D,toggle:q}]=vt(!1,{onClose:()=>{c?.(),s&&(g.current=window.setTimeout(()=>{I("")},a))},onOpen:()=>{m?.(),window.clearTimeout(g.current)}}),H={openSpotlight:M,closeSpotlight:D,toggleSpotlight:q,registerActions:v,removeActions:X,triggerAction:B,opened:T,actions:b,query:u};return Kt(l,M),ce(H),n.createElement(Qt.Provider,{value:H},n.createElement(rt,ro({actions:b,onClose:D,opened:T,query:u,onQueryChange:I,transitionDuration:a},d)),i)}me.displayName="@mantine/spotlight/SpotlightProvider";je();function ge(t){let[e,o]=x(!1);O(()=>{let l=navigator.userAgentData?.platform??navigator.platform;o(/mac/i.test(l||""))},[]);let i=()=>{nt()};return r("button",{type:"button",className:N("SearchBar",t.className),onClick:i,"aria-label":"Open search",children:[r(zt,{className:"SearchBar__icon",size:16,stroke:1.5}),r("span",{className:"SearchBar__placeholder",children:"Search"}),r("span",{className:"SearchBar__shortcut","aria-hidden":"true",children:e?"\u2318 + K":"Ctrl + K"})]})}var C="1.5";function p(t){return r("div",{className:"Layout",children:[r(p.Top,{}),r(p.Side,{}),r(p.Main,{...t,children:t.children}),r(p.Bottom,{})]})}function no(t){let o=t.split("?")[0].replace(/\/+$/g,"").split("/").filter(Boolean);return o.length===4&&o[0]==="cms"&&o[1]==="content"}p.Top=()=>{let t=window.__ROOT_CTX.rootConfig,e=t.projectName||t.projectId,o=t.minimalBranding,{url:i}=Y(),l=!no(i);return r("div",{className:"Layout__top",children:[o?r(V,{children:[r("a",{className:"Layout__top__logo",href:"/cms",children:e}),r("a",{className:"Layout__top__version",href:"https://github.com/blinkk/rootjs/blob/main/packages/root-cms/CHANGELOG.md",target:"_blank",rel:"noreferrer noopener",children:["v",tt.version]})]}):r(V,{children:[r("a",{className:"Layout__top__logo",href:"/cms",children:r(Ut,{})}),r("a",{className:"Layout__top__version",href:"https://github.com/blinkk/rootjs/blob/main/packages/root-cms/CHANGELOG.md",target:"_blank",rel:"noreferrer noopener",children:["v",tt.version]}),r("div",{className:"Layout__top__project",children:e})]}),l&&r("div",{className:"Layout__top__search",children:r(ge,{})})]})};p.Side=()=>{let{url:t}=Y(),e=t.replace(/\/*$/g,""),o=window.firebase.user,i=window.__ROOT_CTX.sidebar?.tools,l=new Set(window.__ROOT_CTX.sidebar?.hiddenBuiltInTools||[]),c=s=>l.has(s),m=window.__ROOT_CTX.experiments||{},_=async()=>{await window.firebase.auth.signOut(),window.location.href="/cms/login"};return r("div",{className:"Layout__side",children:[r("div",{className:"Layout__side__buttons",children:[!c("home")&&r(p.SideButton,{label:"Home",url:"/cms",active:e==="/cms",children:r(It,{stroke:C})}),!c("content")&&r(p.SideButton,{label:"Content",url:"/cms/content",active:e.startsWith("/cms/content"),children:r(Bt,{stroke:C})}),m.taskManager&&r(p.SideButton,{label:"Tasks",url:"/cms/tasks",active:e.startsWith("/cms/tasks"),children:r(At,{stroke:C})}),!c("releases")&&r(p.SideButton,{label:"Releases",url:"/cms/releases",active:e.startsWith("/cms/releases"),children:r(Rt,{stroke:C})}),!c("data")&&r(p.SideButton,{label:"Data",url:"/cms/data",active:e.startsWith("/cms/data"),children:r(Nt,{stroke:C})}),!c("assets")&&r(p.SideButton,{label:"Asset Library",url:"/cms/assets",active:e.startsWith("/cms/assets"),children:r(Dt,{stroke:C})}),!c("translations")&&r(p.SideButton,{label:"Translations",url:"/cms/translations",active:e.startsWith("/cms/translations"),children:r(Tt,{stroke:C})}),Vt()&&!c("ai")&&r(p.SideButton,{label:"Root AI",url:"/cms/ai",active:e.startsWith("/cms/ai"),children:r(Ht,{stroke:C})}),i&&r(V,{children:[r("div",{className:"Layout__side__divider"}),Object.entries(i).map(([s,a])=>{let d=a.cmsUrl?.startsWith("/cms/")?a.cmsUrl:void 0,g=a.externalUrl,u=g??d??`/cms/tools/${s}`,h=g?void 0:u.replace(/\/*$/g,""),b=!g&&!!h&&(e===h||e.startsWith(`${h}/`));return r(p.SideButton,{className:"Layout__side__tool",label:a.label||"",url:u,active:b,external:!!g,children:a.icon?r("img",{className:"Layout__side__tool__icon",src:a.icon,alt:a.label||""}):r(Pt,{stroke:C})},s)}),r("div",{className:"Layout__side__divider"})]}),!c("settings")&&r(p.SideButton,{label:"Settings",url:"/cms/settings",active:e.startsWith("/cms/settings"),children:r(Wt,{stroke:C})})]}),r("div",{className:"Layout__side__user",children:r(Z,{shadow:"md",position:"right",control:r(Q,{children:r(xt,{src:o.photoURL,alt:o.email,size:30,radius:"xl"})}),children:[r(Z.Label,{children:r(S,{size:"xs",color:"dimmed",truncate:!0,children:["Signed in as ",o.email]})}),r(Ct,{}),r(Z.Item,{color:"red",icon:r(Mt,{style:{width:14,height:14}}),onClick:_,children:"Sign out"})]})})]})};p.SideButton=t=>r(Et,{className:N("Layout__side__button",t.className),label:t.label,position:"right",withArrow:!0,children:r("a",{className:N(t.active&&"active"),href:t.url,target:t.external?"_blank":void 0,rel:t.external?"noreferrer noopener":void 0,children:t.children})});p.Main=t=>r("div",{className:"Layout__main",children:t.children});p.Bottom=()=>r("div",{className:"Layout__bottom"});export{me as a,p as b};
@@ -0,0 +1 @@
1
+ import{a as mt,b as ut,c as gt}from"./chunk-UPDL6UXI.js";import{a as pt}from"./chunk-ENQKSLGJ.js";import{g as oe,h as Ke,i as Me,j as Ze,k as Je,l as Qe,m as Ye,n as et,o as tt,p as st,q as ce,r as ot,s as Fe,t as at,u as me,y as _e,z as fe}from"./chunk-Z6DBYLIM.js";import{a as ft}from"./chunk-W5DOO6ID.js";import{a as _t}from"./chunk-NSOTG64N.js";import{b as M}from"./chunk-J5E457OI.js";import{a as A,b as He,c as Oe}from"./chunk-QHJOTXYB.js";import{b as Ve,d as Ce}from"./chunk-KRNQ6L35.js";import{e as ue}from"./chunk-BUNR5EU3.js";import{$a as Ne,Ab as he,Cc as dt,Da as re,Db as it,Eb as ve,Fa as Ge,Fb as ze,Ga as e,Pb as rt,Rc as W,Uc as ct,V as te,W as se,a as i,c as U,da as g,ea as G,g as $e,j as Le,lb as ge,mc as Ie,na as je,qa as k,ra as S,tb as De,ua as H,vb as pe,wb as lt,zb as nt}from"./chunk-LROR6N3B.js";import{d as C}from"./chunk-KUCVLANF.js";import{g as We,h as de,k as D,l as O,m as ke,n as V,o as Xe,p as qe}from"./chunk-7SK47HHZ.js";Le();Le();function ht(t){let o=t.file||{},a=o.src||"",l=o.filename||a,r={"--asset-thumb-size":`${t.size}px`};if(a&&O(l))return e("div",{className:"AssetBrowser__thumb",style:r,children:e("img",{src:Te(o,t.size*2),alt:o.alt||"",loading:"lazy"})});if(a&&V(l))return e("div",{className:"AssetBrowser__thumb",style:r,children:e("video",{src:a,muted:!0,playsInline:!0,preload:"metadata"})});let m=D(l);return e("div",{className:"AssetBrowser__thumb",style:r,children:m&&m.length<=4?e("div",{className:"AssetBrowser__thumb__ext",children:m}):e(he,{size:20,stroke:"1.5"})})}function Te(t,o){let a=t?.src||"";return a.startsWith(We)&&o?`${a}=s${o}`:a}function we(t){let o=t?.src||"";ke(o)&&(o=o.split("=")[0]+"=s0"),navigator.clipboard.writeText(o).then(()=>{A({message:"Copied URL to clipboard.",autoClose:2e3})})}function be(t){let o=t?.src||"";if(o)if(ke(o)){let a=document.createElement("a");a.href=qe(o),t.filename&&(a.download=t.filename),document.body.appendChild(a),a.click(),document.body.removeChild(a)}else window.open(o,"_blank")}function vt(t){let[o,a]=i(t.asset),[l,r]=i(t.asset.file?.alt||""),[m,d]=i(!1),[x,v]=i(!1),[f,B]=i(null),[w,F]=i(null),n=o.file||{},u=n.filename||o.name,N=O(u),R=V(u),X=l!==(n.alt||""),q=n.altDisabled===!0;U(()=>{_e(o.id).then(c=>F(c)).catch(c=>{console.error("failed to fetch asset usage:",c),F([])})},[o.id]);async function z(c,b){let p=await fe(c,{previousFile:b});p.failedDocIds.length>0?A({title:"Some docs failed to update",message:`Failed to update: ${p.failedDocIds.join(", ")}. Re-save the asset to retry.`,color:"red",autoClose:!1}):p.updatedDocIds.length>0&&A({message:`Updated ${p.updatedDocIds.length} doc(s) that use this asset.`,color:"green"})}async function K(){d(!0),await M(async()=>{let c={...n},b=await at(o,l);a(b),t.onChanged(b),await z(b,c)}),d(!1)}function E(){let c=document.createElement("input");c.type="file",c.onchange=()=>{let b=c.files?.[0];if(!b)return;let p=D(u),y=D(b.name);if(p&&y&&p!==y){B(b);return}$(b)},c.click(),c.remove()}async function $(c){B(null),d(!0),await M(async()=>{let b={...n},p=await de(c),y=await ot(o,p);a(y),r(y.file?.alt||""),t.onChanged(y),await z(y,b)}),d(!1)}async function P(c){d(!0),await M(async()=>{let b={...n},p=await me(o,c);a(p),r(p.file?.alt||""),t.onChanged(p),await z(p,b)}),d(!1)}async function Z(){d(!0),await M(async()=>{await ce(o),A({message:`Deleted "${o.name}".`,color:"green"}),t.onDeleted()}),d(!1)}return e(S,{className:"AssetBrowser__detailsModal",opened:!0,onClose:t.onClose,title:o.name,size:720,overflow:"outside",centered:!0,children:e("div",{className:"AssetBrowser__details",children:[e("div",{className:"AssetBrowser__details__preview",children:N?e("img",{src:Te(n,800),alt:n.alt||"",style:n.canvasBgColor==="dark"?{background:"#000"}:{}}):R?e("video",{src:n.src,controls:!0,muted:!0,preload:"metadata"}):e("div",{className:"AssetBrowser__details__preview__placeholder",children:[e(he,{size:48,stroke:"1"}),e("div",{children:u})]})}),e(re,{className:"AssetBrowser__details__table",verticalSpacing:"xs",fontSize:"xs",children:e("tbody",{children:[e("tr",{children:[e("td",{children:e("b",{children:"Filename"})}),e("td",{children:u})]}),!!(n.width&&n.height)&&e("tr",{children:[e("td",{children:e("b",{children:"Dimensions"})}),e("td",{children:[n.width,"x",n.height]})]}),o.createdAt&&e("tr",{children:[e("td",{children:e("b",{children:"Uploaded"})}),e("td",{children:[Ce(o.createdAt),o.createdBy&&e(C,{children:[" by ",o.createdBy]})]})]}),o.modifiedAt&&e("tr",{children:[e("td",{children:e("b",{children:"Modified"})}),e("td",{children:[Ce(o.modifiedAt),o.modifiedBy&&e(C,{children:[" by ",o.modifiedBy]})]})]}),e("tr",{children:[e("td",{children:e("b",{children:"URL"})}),e("td",{children:e("div",{className:"AssetBrowser__details__url",children:[e(H,{readOnly:!0,value:n.src||"",size:"xs",radius:"xs",onClick:c=>c.target.select(),styles:{root:{flex:1,minWidth:0}}}),e(Ge,{label:"Copy URL",transition:"pop",children:e(se,{size:"sm",onClick:()=>we(n),children:e(ge,{size:16})})})]})})]})]})}),(N||R)&&e("div",{className:"AssetBrowser__details__alt",children:[q?e("div",{className:"AssetBrowser__details__alt__disabledNote",children:"Alt text is disabled for this asset. Docs that use it hide the alt text input and render no alt text."}):e(C,{children:[e(je,{label:"Alt text",description:"Used as the default alt text when the asset is selected in a doc. Updating it syncs docs that use this asset.",autosize:!0,minRows:1,size:"xs",value:l,disabled:!t.canManage||m,onChange:c=>r(c.currentTarget.value)}),t.canManage&&X&&e(g,{size:"xs",color:"dark",mt:8,loading:m,onClick:()=>K(),children:"Save alt text"})]}),t.canManage&&e(G,{className:"AssetBrowser__details__alt__disableCheckbox",label:"Disable alt text (e.g. decorative images)",size:"xs",mt:8,checked:q,disabled:m,onChange:c=>P(c.currentTarget.checked)})]}),e("div",{className:"AssetBrowser__details__usage",children:[e("div",{className:"AssetBrowser__details__usage__title",children:"Used in"}),w===null?e(te,{color:"gray",size:"sm"}):w.length===0?e("div",{className:"AssetBrowser__details__usage__empty",children:"No docs use this asset."}):e("div",{className:"AssetBrowser__details__usage__list",children:w.map(c=>e("a",{className:"AssetBrowser__details__usage__doc",href:`/cms/content/${c.id}`,target:"_blank",rel:"noreferrer",children:[e("span",{children:c.id}),e(lt,{size:14})]},c.id))})]}),e("div",{className:"AssetBrowser__details__buttons",children:[e(g,{variant:"default",size:"xs",leftIcon:e(pe,{size:14}),onClick:()=>be(n),children:"Download"}),t.canManage&&e(C,{children:[e(g,{variant:"default",size:"xs",leftIcon:e(nt,{size:14}),loading:m,onClick:()=>E(),children:"Replace file"}),e(g,{className:"AssetBrowser__details__buttons__delete",color:"red",variant:"filled",size:"xs",leftIcon:e(W,{size:14}),disabled:m,onClick:()=>v(!0),children:"Delete"})]})]}),f&&e("div",{className:"AssetBrowser__details__confirmReplace",children:[e("div",{children:["The new file has a different type (",e("b",{children:[".",D(u)]})," ","\u2192 ",e("b",{children:[".",D(f.name)]}),"). Replacing will change the asset's file extension and serving URL",Fe(o.name,D(f.name))!==o.name&&e(C,{children:[", and the asset will be renamed to"," ",e("b",{children:Fe(o.name,D(f.name))})]}),". Docs that use this asset will be updated."]}),e("div",{className:"AssetBrowser__details__confirmReplace__buttons",children:[e(g,{variant:"default",size:"xs",onClick:()=>B(null),disabled:m,children:"Cancel"}),e(g,{color:"dark",size:"xs",loading:m,onClick:()=>$(f),children:"Replace"})]})]}),x&&e("div",{className:"AssetBrowser__details__confirmDelete",children:[e("div",{children:["Delete ",e("b",{children:o.name})," from the asset library?",w&&w.length>0&&e(C,{children:[" ","This asset is used in ",w.length," doc(s); those docs keep their copy of the file but will no longer receive updates."]})]}),e("div",{className:"AssetBrowser__details__confirmDelete__buttons",children:[e(g,{variant:"default",size:"xs",onClick:()=>v(!1),disabled:m,children:"Cancel"}),e(g,{color:"red",size:"xs",loading:m,onClick:()=>Z(),children:"Delete"})]})]})]})})}var Mt=100;function Ue(t){let[o,a]=i(t.folder??t.initialFolder??""),l=t.folder??o,[r,m]=i([]),[d,x]=i(!0),[v,f]=i(""),[B,w]=i(!1),[F,n]=i(!1),[u,N]=i(null),[R,X]=i(!1),[q,z]=i(null),[K,E]=i(null),[$,P]=i(null),[Z,c]=i(null),[b,p]=i(null),[y,ae]=i(new Map),{roles:At}=_t(),xt=window.firebase.user.email||"",J=ft(At,xt),Q=v.trim().length>0;function L(s){a(s),f(""),t.onFolderChange&&t.onFolderChange(s)}async function I(s){x(!0),N(null),ae(new Map),await M(async()=>{let _=await Me(s);m(_)}),x(!1)}U(()=>{I(l)},[l]),U(()=>{if(!Q||u!==null)return;let s=!1;return(async()=>{let _=[];await M(async()=>{_=await Ze(l)}),s||N(_)})(),()=>{s=!0}},[Q,u,l]);let Ae=t.mode==="manage"?t.initialAssetId:"";U(()=>{Ae&&M(async()=>{let s=await Qe(Ae);s&&s.type==="file"&&(L(s.parent),p(s))})},[Ae]);let Se=$e(()=>{let s=v.trim().toLowerCase(),_=s?u||[]:r;return t.mode==="pick"&&(_=_.filter(h=>h.type==="folder"||Xe(h.file?.filename||h.name,t.accept))),s&&(_=_.filter(h=>h.name.toLowerCase().includes(s))),_},[r,u,v,t.mode,t.accept]),T=mt(Se,{pageSize:Mt,resetDeps:[l,v]}),j=T.pageItems;async function Ee(s){if(s.length===0||F)return;let _="asset-browser-upload";n(!0),A({id:_,message:`Uploading ${s.length} file(s)...`,loading:!0,autoClose:!1,disallowClose:!0});let h=[],Be=[];for(let ne=0;ne<s.length;ne++){let ie=s[ne];He({id:_,message:`Uploading ${ie.name} (${ne+1} of ${s.length})...`,loading:!0,autoClose:!1,disallowClose:!0});try{let ye=await de(ie),kt=await et({parent:l,file:ye});h.push(kt)}catch(ye){console.error(`failed to upload ${ie.name}:`,ye),Be.push(ie.name)}}Oe(_),n(!1),Be.length>0?A({title:"Upload failed",message:`Failed to upload: ${Be.join(", ")}`,color:"red",autoClose:!1}):A({message:`Uploaded ${h.length} file(s).`,color:"green"}),await I(l),t.mode==="pick"&&h.length===1&&s.length===1&&t.onPickFile&&t.onPickFile(h[0])}function Bt(){let s=document.createElement("input");s.type="file",s.multiple=!0,t.mode==="pick"&&t.accept&&t.accept.length>0&&(s.accept=t.accept.join(",")),s.onchange=()=>{Ee(Array.from(s.files||[]))},s.click(),s.remove()}function yt(s){t.onPickFile&&t.onPickFile(s)}let Y=J,le=t.mode==="manage"&&J,ee=Array.from(y.values()),Pe=ee.filter(s=>s.type==="file"&&!s.file?.altDisabled&&(O(s.file?.filename||s.name)||V(s.file?.filename||s.name))),xe=j.length>0&&j.every(s=>y.has(s.id));function Re(s){ae(_=>{let h=new Map(_);return h.has(s.id)?h.delete(s.id):h.set(s.id,s),h})}function Ct(){ae(s=>{let _=new Map(s);return xe?j.forEach(h=>_.delete(h.id)):j.forEach(h=>_.set(h.id,h)),_})}return e("div",{className:ue("AssetBrowser",t.className,`AssetBrowser--${t.mode}`),children:[e("div",{className:"AssetBrowser__toolbar",children:[e(Ue.Breadcrumbs,{folder:l,onNavigate:L}),e("div",{className:"AssetBrowser__toolbar__actions",children:[e(H,{className:"AssetBrowser__toolbar__filter",placeholder:"Search by name",size:"xs",icon:e(dt,{size:14}),value:v,onChange:s=>f(s.currentTarget.value)}),Y&&t.mode==="manage"&&e(g,{variant:"default",size:"xs",leftIcon:e(it,{size:16}),onClick:()=>X(!0),children:"New folder"}),Y&&e(g,{color:"dark",size:"xs",leftIcon:e(ct,{size:16}),loading:F,onClick:()=>Bt(),children:"Upload"})]})]}),le&&ee.length>0&&e("div",{className:"AssetBrowser__selectionBar",children:[e("div",{className:"AssetBrowser__selectionBar__count",children:[ee.length," selected"]}),e("div",{className:"AssetBrowser__selectionBar__actions",children:[e(g,{variant:"default",size:"xs",leftIcon:e(ve,{size:14}),onClick:()=>E(ee),children:"Move"}),Pe.length>0&&e(g,{variant:"default",size:"xs",onClick:()=>c(Pe),children:"Disable alt text"}),e(g,{color:"red",size:"xs",leftIcon:e(W,{size:14}),onClick:()=>P(ee),children:"Delete"}),e(g,{variant:"subtle",color:"gray",size:"xs",onClick:()=>ae(new Map),children:"Clear"})]})]}),e("div",{className:ue("AssetBrowser__listing",B&&"dragging"),onDragOver:s=>{Y&&(s.preventDefault(),w(!0))},onDragLeave:s=>{s.preventDefault(),w(!1)},onDrop:s=>{s.preventDefault(),w(!1),Y&&Ee(Array.from(s.dataTransfer?.files||[]))},children:d||Q&&u===null?e("div",{className:"AssetBrowser__loading",children:e(te,{color:"gray",size:"lg"})}):Se.length===0?e("div",{className:"AssetBrowser__empty","data-testid":"asset-browser-empty",children:v?e("div",{children:['No assets match "',v,'" in this folder or its subfolders.']}):e(C,{children:[e("div",{children:"This folder is empty."}),Y&&e("div",{className:"AssetBrowser__empty__hint",children:'Drop files here or click "Upload" to add assets.'})]})}):e(re,{className:"AssetBrowser__table",verticalSpacing:"xs",fontSize:"xs",highlightOnHover:!0,children:[e("thead",{children:e("tr",{children:[le&&e("th",{className:"AssetBrowser__table__checkboxCol",children:e(G,{size:"xs","aria-label":"Select all",checked:xe,indeterminate:!xe&&j.some(s=>y.has(s.id)),onChange:()=>Ct()})}),e("th",{children:"name"}),e("th",{className:"AssetBrowser__table__modifiedCol",children:"modified"}),e("th",{className:"AssetBrowser__table__actionsCol"})]})}),e("tbody",{children:j.map(s=>s.type==="folder"?e("tr",{className:"AssetBrowser__row AssetBrowser__row--folder",onClick:()=>L(oe(s.parent,s.name)),children:[le&&e("td",{className:"AssetBrowser__checkboxCell",onClick:_=>_.stopPropagation(),children:e(G,{size:"xs","aria-label":`Select ${s.name}`,checked:y.has(s.id),onChange:()=>Re(s)})}),e("td",{children:e("div",{className:"AssetBrowser__nameCell",children:[e("div",{className:"AssetBrowser__thumb",children:e(ze,{size:24,stroke:"1.5"})}),e("div",{className:"AssetBrowser__nameCell__text",children:[e("div",{className:"AssetBrowser__nameCell__name",children:s.name}),e(wt,{asset:s,folder:l,searching:Q,onNavigate:L})]})]})}),e("td",{children:e(bt,{asset:s})}),e("td",{onClick:_=>_.stopPropagation(),children:e("div",{className:"AssetBrowser__actionsCell",children:t.mode==="manage"&&J&&e(k,{shadow:"sm",position:"bottom",placement:"end",control:e(se,{size:"sm",children:e(De,{size:16})}),children:[e(k.Item,{icon:e(Ie,{size:14}),onClick:()=>z(s),children:"Rename"}),e(k.Item,{icon:e(ve,{size:14}),onClick:()=>E([s]),children:"Move"}),e(k.Item,{color:"red",icon:e(W,{size:14}),onClick:()=>P([s]),children:"Delete"})]})})})]},s.id):e("tr",{className:"AssetBrowser__row AssetBrowser__row--file",onClick:()=>{t.mode==="pick"?yt(s):p(s)},children:[le&&e("td",{className:"AssetBrowser__checkboxCell",onClick:_=>_.stopPropagation(),children:e(G,{size:"xs","aria-label":`Select ${s.name}`,checked:y.has(s.id),onChange:()=>Re(s)})}),e("td",{children:e("div",{className:"AssetBrowser__nameCell",children:[e(ht,{file:s.file,size:36}),e("div",{className:"AssetBrowser__nameCell__text",children:[e("div",{className:"AssetBrowser__nameCell__name",children:[s.name,!!(s.file?.width&&s.file?.height)&&e("span",{className:"AssetBrowser__nameCell__dimens",children:[" ","(",s.file.width,"x",s.file.height,")"]})]}),e(wt,{asset:s,folder:l,searching:Q,onNavigate:L})]})]})}),e("td",{children:e(bt,{asset:s})}),e("td",{onClick:_=>_.stopPropagation(),children:e("div",{className:"AssetBrowser__actionsCell",children:t.mode!=="pick"&&e(Ft,{asset:s,canManage:J,onDetails:()=>p(s),onRename:()=>z(s),onMove:()=>E([s]),onDelete:()=>P([s])})})})]},s.id))})]})}),T.totalPages>1&&e("div",{className:"AssetBrowser__footer",children:[e(gt,{start:T.start,end:T.end,total:T.totalItems,noun:"asset"}),e(ut,{total:T.totalPages,page:T.page,onChange:T.setPage})]}),e(Nt,{opened:R,parent:l,onClose:()=>X(!1),onCreated:s=>{X(!1),L(oe(l,s))}}),q&&e(Dt,{asset:q,onClose:()=>z(null),onRenamed:()=>{z(null),I(l)}}),K&&K.length>0&&e(zt,{assets:K,onClose:()=>E(null),onMoved:()=>{E(null),I(l)}}),$&&$.length>0&&e(Tt,{assets:$,onClose:()=>P(null),onDeleted:()=>{P(null),I(l)}}),Z&&Z.length>0&&e(Ut,{assets:Z,onClose:()=>c(null),onDone:()=>{c(null),I(l)}}),b&&e(vt,{asset:b,canManage:J,onClose:()=>p(null),onChanged:()=>I(l),onDeleted:()=>{p(null),I(l)}})]})}Ue.Breadcrumbs=t=>{let o=Ke(t.folder),a=[{label:"Assets",path:""}];return o.forEach((l,r)=>{a.push({label:l,path:o.slice(0,r+1).join("/")})}),e("div",{className:"AssetBrowser__breadcrumbs",children:a.map((l,r)=>e("div",{className:"AssetBrowser__breadcrumbs__crumb",children:[r>0&&e(Ne,{className:"AssetBrowser__breadcrumbs__divider",size:14}),e("button",{className:ue("AssetBrowser__breadcrumbs__link",r===a.length-1&&"active"),disabled:r===a.length-1,onClick:()=>t.onNavigate(l.path),children:l.label})]},l.path))})};function Ft(t){let o=t.asset;return e(k,{shadow:"sm",position:"bottom",placement:"end",control:e(se,{size:"sm",children:e(De,{size:16})}),children:[e(k.Item,{icon:e(rt,{size:14}),onClick:t.onDetails,children:"Details"}),e(k.Item,{icon:e(ge,{size:14}),onClick:()=>we(o.file),children:"Copy URL"}),e(k.Item,{icon:e(pe,{size:14}),onClick:()=>be(o.file),children:"Download"}),t.canManage&&e(C,{children:[e(k.Item,{icon:e(Ie,{size:14}),onClick:t.onRename,children:"Rename"}),e(k.Item,{icon:e(ve,{size:14}),onClick:t.onMove,children:"Move"}),e(k.Item,{color:"red",icon:e(W,{size:14}),onClick:t.onDelete,children:"Delete"})]})]})}function wt(t){let o=t.asset;return!t.searching||o.parent===t.folder?null:e("button",{className:"AssetBrowser__nameCell__path",title:"Go to folder",onClick:a=>{a.stopPropagation(),t.onNavigate(o.parent)},children:["in ",Je(o.parent,t.folder)]})}function bt(t){let o=t.asset.modifiedAt||t.asset.createdAt,a=t.asset.modifiedBy||t.asset.createdBy||"",l=o&&typeof o.toMillis=="function"?o.toMillis():0;return e("div",{className:"AssetBrowser__modifiedCell",children:[a&&e(pt,{email:a,size:20}),e("span",{children:l?Ve(l):"\u2014"})]})}function Nt(t){let[o,a]=i(""),[l,r]=i(!1);async function m(){r(!0),await M(async()=>{let d=await Ye(t.parent,o);a(""),t.onCreated(d.name)}),r(!1)}return e(S,{opened:t.opened,onClose:t.onClose,title:"New folder",size:"sm",centered:!0,children:e("form",{className:"AssetBrowser__modalForm",onSubmit:d=>{d.preventDefault(),m()},children:[e(H,{"data-autofocus":!0,placeholder:"Folder name",value:o,onChange:d=>a(d.currentTarget.value)}),e(g,{type:"submit",color:"dark",loading:l,disabled:!o,children:"Create"})]})})}function Dt(t){let[o,a]=i(t.asset.name),[l,r]=i(!1);async function m(){r(!0),await M(async()=>{await tt(t.asset,o),t.onRenamed()}),r(!1)}return e(S,{opened:!0,onClose:t.onClose,title:`Rename ${t.asset.type}`,size:"sm",centered:!0,children:e("form",{className:"AssetBrowser__modalForm",onSubmit:d=>{d.preventDefault(),m()},children:[e(H,{"data-autofocus":!0,value:o,onChange:d=>a(d.currentTarget.value)}),e(g,{type:"submit",color:"dark",loading:l,disabled:!o,children:"Rename"})]})})}function zt(t){let o=t.assets,[a,l]=i(o[0]?.parent||""),[r,m]=i([]),[d,x]=i(!0),[v,f]=i(!1);U(()=>{x(!0),M(async()=>{let n=await Me(a);m(n.filter(u=>u.type==="folder"))}).then(()=>x(!1))},[a]);let B=o.filter(n=>n.type==="folder").map(n=>oe(n.parent,n.name));function w(n){return B.some(u=>n===u||n.startsWith(`${u}/`))}async function F(){f(!0);let n=[],u=0;for(let N of o)try{await st(N,a),u+=1}catch(R){console.error(`failed to move ${N.name}:`,R),n.push(N.name)}f(!1),n.length>0&&A({title:"Move failed",message:`Failed to move: ${n.join(", ")}`,color:"red",autoClose:!1}),u>0&&A({message:o.length===1?`Moved "${o[0].name}" to ${a||"Assets"}.`:`Moved ${u} item(s) to ${a||"Assets"}.`,color:"green"}),t.onMoved()}return e(S,{opened:!0,onClose:t.onClose,title:o.length===1?`Move "${o[0].name}"`:`Move ${o.length} items`,size:"md",centered:!0,children:e("div",{className:"AssetBrowser__moveModal",children:[e(Ue.Breadcrumbs,{folder:a,onNavigate:l}),e("div",{className:"AssetBrowser__moveModal__folders",children:d?e(te,{color:"gray",size:"sm"}):r.length===0?e("div",{className:"AssetBrowser__moveModal__empty",children:"No subfolders."}):r.map(n=>{let u=oe(n.parent,n.name);return e("button",{className:"AssetBrowser__moveModal__folder",disabled:w(u),onClick:()=>l(u),children:[e(ze,{size:16,stroke:"1.5"}),e("span",{children:n.name}),e(Ne,{size:14})]},n.id)})}),e(g,{color:"dark",fullWidth:!0,loading:v,disabled:o.every(n=>n.parent===a),onClick:()=>F(),children:"Move here"})]})})}var It=20;function Tt(t){let o=t.assets,[a,l]=i(!1),[r,m]=i(null),d=o.filter(f=>f.type==="file"),x=o.some(f=>f.type==="folder");U(()=>{d.length===0||d.length>It||Promise.all(d.map(f=>_e(f.id))).then(f=>{let B=new Set(f.flat().map(w=>w.id));m(B.size)}).catch(()=>m(null))},[o.map(f=>f.id).join(",")]);async function v(){l(!0);let f=[],B=0;for(let w of o)try{await ce(w),B+=1}catch(F){console.error(`failed to delete ${w.name}:`,F),f.push(w.name)}l(!1),f.length>0&&A({title:"Delete failed",message:`Failed to delete: ${f.join(", ")}. Note that folders must be empty before they can be deleted.`,color:"red",autoClose:!1}),B>0&&A({message:o.length===1?`Deleted "${o[0].name}".`:`Deleted ${B} item(s).`,color:"green"}),t.onDeleted()}return e(S,{opened:!0,onClose:t.onClose,title:o.length===1?`Delete ${o[0].type}?`:`Delete ${o.length} items?`,size:"sm",centered:!0,children:e("div",{className:"AssetBrowser__deleteModal",children:[e("div",{className:"AssetBrowser__deleteModal__text",children:["Are you sure you want to delete"," ",o.length===1?e("b",{children:o[0].name}):e("b",{children:[o.length," items"]})," ","from the asset manager?",d.length>0&&e(C,{children:[" ","The underlying files are not deleted from GCS, and docs that currently use the assets keep their copy of the files."]}),x&&e(C,{children:" Folders must be empty before they can be deleted."})]}),r!==null&&r>0&&e("div",{className:"AssetBrowser__deleteModal__warning",children:[o.length===1?"This asset is":"These assets are"," ","currently used in ",r," doc(s). Those docs will no longer receive updates when the asset changes."]}),e("div",{className:"AssetBrowser__deleteModal__buttons",children:[e(g,{variant:"default",onClick:t.onClose,disabled:a,children:"Cancel"}),e(g,{color:"red",loading:a,onClick:()=>v(),children:"Delete"})]})]})})}function Ut(t){let o=t.assets,[a,l]=i(!1);async function r(){l(!0);let m=[],d=0;for(let x of o)try{let v=x.file,f=await me(x,!0);await fe(f,{previousFile:v}),d+=1}catch(v){console.error(`failed to disable alt text for ${x.name}:`,v),m.push(x.name)}l(!1),m.length>0&&A({title:"Failed to disable alt text",message:`Failed to update: ${m.join(", ")}`,color:"red",autoClose:!1}),d>0&&A({message:`Disabled alt text for ${d} file(s).`,color:"green"}),t.onDone()}return e(S,{opened:!0,onClose:t.onClose,title:"Disable alt text?",size:"sm",centered:!0,children:e("div",{className:"AssetBrowser__deleteModal",children:[e("div",{className:"AssetBrowser__deleteModal__text",children:["Disable alt text for ",e("b",{children:[o.length," file(s)"]}),"? The alt text input is hidden in docs that use these assets and their embedded alt text is cleared. Alt text can be re-enabled per asset from its details."]}),e("div",{className:"AssetBrowser__deleteModal__buttons",children:[e(g,{variant:"default",onClick:t.onClose,disabled:a,children:"Cancel"}),e(g,{color:"dark",loading:a,onClick:()=>r(),children:"Disable alt text"})]})]})})}export{Ue as a};
@@ -1 +1 @@
1
- import{f as t}from"./chunk-YLSRRNSE.js";import{Fa as l,Ga as i}from"./chunk-LROR6N3B.js";import{d as n}from"./chunk-KUCVLANF.js";function c(o){return o.condition?i(l,{label:o.label,children:i("div",{className:t(o.className,"ConditionalTooltip"),style:o.style,children:i("div",{className:"ConditionalTooltip__content",children:o.children})})}):i(n,{children:o.children})}export{c as a};
1
+ import{e as t}from"./chunk-BUNR5EU3.js";import{Fa as l,Ga as i}from"./chunk-LROR6N3B.js";import{d as n}from"./chunk-KUCVLANF.js";function c(o){return o.condition?i(l,{label:o.label,children:i("div",{className:t(o.className,"ConditionalTooltip"),style:o.style,children:i("div",{className:"ConditionalTooltip__content",children:o.children})})}):i(n,{children:o.children})}export{c as a};
@@ -1 +1 @@
1
- import{k as z}from"./chunk-D3UIZHRK.js";import{c as T}from"./chunk-JDW4UORS.js";import{C as _}from"./chunk-TFB3VGWP.js";import{f as l}from"./chunk-KRNQ6L35.js";import{a as f,b as w,c as s,g as b,i as k,n as v,o as j,q as u,t as R,u as c,v as y,x as I}from"./chunk-VD6G5NV4.js";var O=["agile","airy","alert","amber","amused","ancient","aqua","arctic","astral","autumn","avid","azure","balmy","beige","big","bitter","black","blazing","blissful","blooming","blue","bold","bouncy","brainy","brave","breezy","bright","brisk","broad","bronze","brown","bubbly","busy","calm","candid","careful","caring","charming","cheerful","cherry","chilly","chipper","classic","clean","clear","clever","cloudy","coastal","cobalt","cold","cool","copper","coral","cosmic","cosy","cozy","crafty","creamy","crimson","crisp","cuddly","curious","dandy","dapper","daring","dark","dawn","dazzling","dear","deep","deft","delicate","dewy","dizzy","dotted","dreamy","driven","dry","dusky","dusty","eager","early","earnest","earthy","eastern","easy","ebony","elated","electric","elegant","emerald","empty","epic","even","every","faint","fair","falling","famous","fancy","fast","feisty","festive","fierce","fiery","fine","firm","flat","floral","flowing","fluffy","foggy","fond","forest","fragrant","fresh","friendly","frisky","frosty","funky","funny","fuzzy","gallant","gentle","giant","gilded","glad","gleaming","glossy","glowing","gold","golden","good","graceful","grand","grassy","gray","green","groovy","gusty","handy","happy","hardy","hazy","hearty","heavy","helpful","heroic","hidden","high","holy","honest","honeyed","hopeful","humble","humming","hushed","icy","ideal","idle","indigo","inky","iron","ivory","jade","jaunty","jazzy","jolly","jovial","joyful","jubilant","juicy","jumpy","keen","kind","kindly","lacy","late","lazy","leafy","lemon","light","limber","lime","linen","little","lively","lone","long","loud","lovely","loyal","lucid","lucky","luminous","lunar","lush","magenta","magic","majestic","mango","marble","maritime","maroon","massive","mauve","mellow","merry","mighty","mild","milky","mindful","minty","misty","mocha","modest","morning","mossy","muddy","mysterious","mythic","narrow","navy","neat","neon","new","nimble","noble","noisy","noon","northern","nosy","nutty","oaken","oceanic","odd","old","olive","onyx","opal","open","orange","orderly","pale","pastel","patient","peaceful","peach","peachy","pearly","pebbly","peppy","perky","pink","placid","plain","playful","pleasant","plucky","plum","plush","polar","polite","prime","pristine","proud","pure","purple","quaint","quick","quiet","quirky","radiant","rapid","rare","raven","ready","red","regal","restless","rich","rolling","rosy","rough","round","royal","ruby","rugged","rumbling","russet","rustic","sable","safe","sage","salty","sandy","sapphire","savvy","scarlet","scenic","secret","sepia","serene","shaggy","sharp","shimmering","shiny","short","shrewd","shy","silent","silky","silly","silver","simple","sleek","sleepy","slim","slow","small","smart","smoky","smooth","snappy","snowy","soaring","soft","solar","solid","southern","sparkly","speedy","spicy","spiffy","spotted","spry","square","starry","steady","steel","stellar","sticky","still","stony","stormy","striped","strong","sturdy","subtle","sunlit","sunny","super","supreme","swank","sweet","swift","tame","tan","tangy","tart","teal","tender","thin","thirsty","thriving","tidal","tidy","tiny","tireless","toasty","topaz","tough","tranquil","trim","tropical","true","twinkly","umber","upbeat","urban","useful","valiant","vast","velvet","verdant","vernal","vibrant","vintage","violet","vivid","wandering","warm","watchful","wavy","wee","western","whimsical","whispering","white","wholesome","wild","winding","windy","winter","wintry","wise","witty","wondrous","woody","wool","yellow","young","youthful","zany","zealous","zen","zesty","zippy"],A=["acorn","almond","alpaca","anchor","antler","apple","apricot","arrow","aspen","aurora","autumn","avocado","badger","bagel","bamboo","banana","basil","bay","bayou","beach","bear","bee","beetle","bell","berry","birch","bird","biscuit","bison","blossom","bluff","boat","bobcat","bonfire","book","boot","bottle","boulder","branch","brass","breeze","bridge","brook","broom","brunch","bubble","bucket","bud","buffalo","bug","bunny","burrow","butter","button","cabin","cactus","cake","camel","canary","candle","canyon","cape","caravan","cardinal","carrot","cascade","cashew","castle","cat","cave","cedar","chair","cherry","chestnut","chickpea","chime","cinnamon","citadel","cliff","cloud","clove","clover","cocoa","comet","compass","condor","cookie","coral","cottage","cotton","cove","coyote","crane","crayon","creek","cricket","crocus","crow","crumpet","crystal","cup","cupcake","currant","cypress","daffodil","dahlia","daisy","dawn","deer","delta","desert","dew","diamond","dingo","dock","dogwood","dolphin","donut","dove","dragon","drift","drizzle","drum","duck","dumpling","dune","eagle","echo","eclipse","eel","egg","elder","elephant","elk","ember","ermine","estuary","evergreen","falcon","fawn","feather","fennel","fern","ferret","field","fig","finch","fir","firefly","fish","fjord","flame","flamingo","flask","flax","fleece","flicker","flower","flute","fog","forest","fossil","fountain","fox","frog","frost","galaxy","garden","gazelle","gecko","gem","geyser","ginger","glacier","glade","glen","globe","glow","goat","goose","gorge","gourd","granite","grape","grass","grotto","grove","gull","hammock","harbor","hare","harp","harvest","hat","hawk","haystack","hazel","hearth","heather","hedge","heron","hibiscus","hickory","hill","hollow","honey","horizon","horse","hummingbird","ibis","iceberg","icicle","inlet","iris","island","ivy","jackal","jacket","jade","jaguar","jam","jar","jasmine","jay","jelly","jetty","juniper","kayak","kelp","kestrel","kettle","key","kingfisher","kite","kitten","kiwi","knoll","koala","ladybug","lagoon","lake","lamp","lantern","lark","lava","lavender","leaf","ledge","lemon","lemur","leopard","lichen","lighthouse","lilac","lily","lime","lion","llama","lobster","log","loon","lotus","lynx","lyric","magnet","manatee","mango","mangrove","maple","marble","marigold","marlin","marsh","meadow","melody","melon","mermaid","mesa","meteor","minnow","mint","mirage","mist","mitten","mole","monkey","moon","moose","morel","mosaic","moss","moth","mountain","mouse","muffin","mushroom","mussel","narwhal","nautilus","nectar","needle","nest","nettle","newt","nightingale","nimbus","noodle","north","note","nutmeg","oak","oasis","oats","ocean","ocelot","octopus","olive","onion","opal","orange","orca","orchid","oriole","osprey","otter","owl","oyster","paddle","palm","panda","pansy","panther","papaya","paper","parrot","parsley","partridge","pasture","path","peach","peacock","pear","pebble","pecan","pelican","penguin","peony","pepper","petal","petunia","pheasant","phoenix","pie","pigeon","pine","pineapple","pistachio","planet","plateau","plover","plum","pond","pony","poppy","porpoise","pouch","prairie","pretzel","primrose","puffin","pumpkin","quail","quartz","queen","quill","quince","quokka","rabbit","raccoon","radish","rain","rainbow","rapids","raspberry","raven","redwood","reef","reel","reindeer","rhino","ribbon","ridge","river","road","robin","rock","rooster","rose","rosemary","rowan","rye","saffron","sage","salmon","sand","sapphire","satellite","savanna","scallop","scarf","sea","seagull","seal","seed","sequoia","sesame","shark","shell","shore","shrimp","silk","silo","sky","skylark","sleet","snail","snake","snow","sock","sorbet","spark","sparrow","spider","spire","spoon","spring","sprout","spruce","squirrel","star","starfish","starling","stone","stork","storm","stream","summer","sun","sundial","sunflower","swan","swift","sycamore","tadpole","tamarind","tangerine","tea","teal","tern","terrace","thicket","thistle","thrush","thunder","tide","tiger","timber","toad","toffee","tooth","topaz","tortoise","totem","toucan","tower","tractor","trail","tree","trout","truffle","tugboat","tulip","tundra","turnip","turtle","twig","twilight","umbrella","unicorn","urchin","valley","vanilla","vine","violet","vista","volcano","voyage","vulture","wagon","walnut","walrus","wasp","water","waterfall","wave","whale","wharf","wheat","whisker","wildcat","wildflower","willow","wind","window","winter","wisteria","wolf","wombat","wood","wren","yak","yam","yarrow","yew","yucca","zebra","zephyr","zinnia","zucchini"];var x="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",S="YYYYMMDD";function D(e,r){let a=r?.now??new Date,o=r?.random??Math.random,t=e.replace(/\{([^{}]+?)\}/g,(n,d)=>{let[p,g]=q(d);switch(p){case"date":return E(a,g||S);case"adjective":return C(O,o);case"noun":return C(A,o);case"random":return M(Y(g,6),o);default:return n}});return T(t.toLowerCase())}function q(e){let r=e.indexOf(":");return r===-1?[e.trim(),void 0]:[e.slice(0,r).trim(),e.slice(r+1)]}function Y(e,r){if(!e)return r;let a=parseInt(e,10);return Number.isFinite(a)&&a>0?a:r}function C(e,r){return e[Math.floor(r()*e.length)]}function M(e,r){let a=[];for(let o=0;o<e;o++)a.push(x.charAt(Math.floor(r()*x.length)));return a.join("")}function E(e,r){let a={YYYY:String(e.getFullYear()),YY:String(e.getFullYear()).slice(-2),MM:m(e.getMonth()+1),DD:m(e.getDate()),HH:m(e.getHours()),mm:m(e.getMinutes()),ss:m(e.getSeconds())};return r.replace(/YYYY|YY|MM|DD|HH|mm|ss/g,o=>a[o]??o)}function m(e){return e<10?`0${e}`:String(e)}var i="Releases";async function V(e,r){if(!e)throw new Error("missing data source id");let a=window.__ROOT_CTX.rootConfig.projectId,o=window.firebase.db,t=s(o,"Projects",a,i,e);await R(o,async n=>{if((await n.get(t)).exists())throw new Error(`release exists: ${e}`);await n.set(t,{...r,id:e,createdAt:y(),createdBy:window.firebase.user.email})}),l("release.create",{metadata:{releaseId:e}})}async function G(){let e=window.__ROOT_CTX.rootConfig.projectId,r=window.firebase.db,a=w(r,"Projects",e,i),o=b(a,k("createdAt","desc")),t=await j(o),n=[];return t.forEach(d=>{n.push(d.data())}),n}async function h(e){let r=window.__ROOT_CTX.rootConfig.projectId,a=window.firebase.db,o=s(a,"Projects",r,i,e),t=await v(o);return t.exists()?t.data():null}async function K(e,r){let a=window.__ROOT_CTX.rootConfig.projectId,o=window.firebase.db,t=s(o,"Projects",a,i,e);await u(t,r),l("release.save",{metadata:{releaseId:e}})}async function Q(e){let r=window.__ROOT_CTX.rootConfig.projectId,a=window.firebase.db,o=s(a,"Projects",r,i,e);await u(o,{archivedAt:y(),archivedBy:window.firebase.user.email}),l("release.archive",{metadata:{releaseId:e}})}async function W(e){let r=window.__ROOT_CTX.rootConfig.projectId,a=window.firebase.db,o=s(a,"Projects",r,i,e);await u(o,{archivedAt:c(),archivedBy:c()}),l("release.unarchive",{metadata:{releaseId:e}})}async function Z(e){let r=await h(e);if(!r)throw new Error(`release not found: ${e}`);if(r.archivedAt)throw new Error(`release is archived: ${e}`);let a=r.docIds||[],o=r.dataSourceIds||[];if(a.length===0&&o.length===0)throw new Error(`no docs or data sources to publish for release: ${e}`);let t=window.__ROOT_CTX.rootConfig.projectId,n=window.firebase.db,d=s(n,"Projects",t,i,e),p=I(n);p.update(d,{publishedAt:y(),publishedBy:window.firebase.user.email,scheduledAt:c(),scheduledBy:c()}),o.length>0&&await z(o,{batch:p,commitBatch:!1}),await _(a,{batch:p,releaseId:e,publishMessage:r.description}),console.log(`published release: ${e}`);let g={releaseId:e,docIds:a,dataSourceIds:o};r.description&&(g.publishMessage=r.description),l("release.publish",{metadata:g})}async function ee(e,r){let a=await h(e);if(!a)throw new Error(`release not found: ${e}`);if(a.archivedAt)throw new Error(`release is archived: ${e}`);typeof r=="number"&&(r=f.fromMillis(r));let o=window.__ROOT_CTX.rootConfig.projectId,t=window.firebase.db,n=s(t,"Projects",o,i,e);await u(n,{scheduledAt:r,scheduledBy:window.firebase.user.email}),l("release.publish",{metadata:{releaseId:e,scheduledAt:r.toMillis()}})}function re(){return D("{date}-{adjective}-{noun}")}async function ae(e){if(!await h(e))throw new Error(`release not found: ${e}`);let a=window.__ROOT_CTX.rootConfig.projectId,o=window.firebase.db,t=s(o,"Projects",a,i,e);await u(t,{scheduledAt:c(),scheduledBy:c()}),l("release.unschedule",{metadata:{releaseId:e}})}export{D as a,V as b,G as c,h as d,K as e,Q as f,W as g,Z as h,ee as i,re as j,ae as k};
1
+ import{k as z}from"./chunk-D3UIZHRK.js";import{c as T}from"./chunk-JDW4UORS.js";import{C as _}from"./chunk-Z6DBYLIM.js";import{f as l}from"./chunk-KRNQ6L35.js";import{a as f,b as w,c as s,g as b,i as k,n as v,o as j,q as u,t as R,u as c,v as y,x as I}from"./chunk-VD6G5NV4.js";var O=["agile","airy","alert","amber","amused","ancient","aqua","arctic","astral","autumn","avid","azure","balmy","beige","big","bitter","black","blazing","blissful","blooming","blue","bold","bouncy","brainy","brave","breezy","bright","brisk","broad","bronze","brown","bubbly","busy","calm","candid","careful","caring","charming","cheerful","cherry","chilly","chipper","classic","clean","clear","clever","cloudy","coastal","cobalt","cold","cool","copper","coral","cosmic","cosy","cozy","crafty","creamy","crimson","crisp","cuddly","curious","dandy","dapper","daring","dark","dawn","dazzling","dear","deep","deft","delicate","dewy","dizzy","dotted","dreamy","driven","dry","dusky","dusty","eager","early","earnest","earthy","eastern","easy","ebony","elated","electric","elegant","emerald","empty","epic","even","every","faint","fair","falling","famous","fancy","fast","feisty","festive","fierce","fiery","fine","firm","flat","floral","flowing","fluffy","foggy","fond","forest","fragrant","fresh","friendly","frisky","frosty","funky","funny","fuzzy","gallant","gentle","giant","gilded","glad","gleaming","glossy","glowing","gold","golden","good","graceful","grand","grassy","gray","green","groovy","gusty","handy","happy","hardy","hazy","hearty","heavy","helpful","heroic","hidden","high","holy","honest","honeyed","hopeful","humble","humming","hushed","icy","ideal","idle","indigo","inky","iron","ivory","jade","jaunty","jazzy","jolly","jovial","joyful","jubilant","juicy","jumpy","keen","kind","kindly","lacy","late","lazy","leafy","lemon","light","limber","lime","linen","little","lively","lone","long","loud","lovely","loyal","lucid","lucky","luminous","lunar","lush","magenta","magic","majestic","mango","marble","maritime","maroon","massive","mauve","mellow","merry","mighty","mild","milky","mindful","minty","misty","mocha","modest","morning","mossy","muddy","mysterious","mythic","narrow","navy","neat","neon","new","nimble","noble","noisy","noon","northern","nosy","nutty","oaken","oceanic","odd","old","olive","onyx","opal","open","orange","orderly","pale","pastel","patient","peaceful","peach","peachy","pearly","pebbly","peppy","perky","pink","placid","plain","playful","pleasant","plucky","plum","plush","polar","polite","prime","pristine","proud","pure","purple","quaint","quick","quiet","quirky","radiant","rapid","rare","raven","ready","red","regal","restless","rich","rolling","rosy","rough","round","royal","ruby","rugged","rumbling","russet","rustic","sable","safe","sage","salty","sandy","sapphire","savvy","scarlet","scenic","secret","sepia","serene","shaggy","sharp","shimmering","shiny","short","shrewd","shy","silent","silky","silly","silver","simple","sleek","sleepy","slim","slow","small","smart","smoky","smooth","snappy","snowy","soaring","soft","solar","solid","southern","sparkly","speedy","spicy","spiffy","spotted","spry","square","starry","steady","steel","stellar","sticky","still","stony","stormy","striped","strong","sturdy","subtle","sunlit","sunny","super","supreme","swank","sweet","swift","tame","tan","tangy","tart","teal","tender","thin","thirsty","thriving","tidal","tidy","tiny","tireless","toasty","topaz","tough","tranquil","trim","tropical","true","twinkly","umber","upbeat","urban","useful","valiant","vast","velvet","verdant","vernal","vibrant","vintage","violet","vivid","wandering","warm","watchful","wavy","wee","western","whimsical","whispering","white","wholesome","wild","winding","windy","winter","wintry","wise","witty","wondrous","woody","wool","yellow","young","youthful","zany","zealous","zen","zesty","zippy"],A=["acorn","almond","alpaca","anchor","antler","apple","apricot","arrow","aspen","aurora","autumn","avocado","badger","bagel","bamboo","banana","basil","bay","bayou","beach","bear","bee","beetle","bell","berry","birch","bird","biscuit","bison","blossom","bluff","boat","bobcat","bonfire","book","boot","bottle","boulder","branch","brass","breeze","bridge","brook","broom","brunch","bubble","bucket","bud","buffalo","bug","bunny","burrow","butter","button","cabin","cactus","cake","camel","canary","candle","canyon","cape","caravan","cardinal","carrot","cascade","cashew","castle","cat","cave","cedar","chair","cherry","chestnut","chickpea","chime","cinnamon","citadel","cliff","cloud","clove","clover","cocoa","comet","compass","condor","cookie","coral","cottage","cotton","cove","coyote","crane","crayon","creek","cricket","crocus","crow","crumpet","crystal","cup","cupcake","currant","cypress","daffodil","dahlia","daisy","dawn","deer","delta","desert","dew","diamond","dingo","dock","dogwood","dolphin","donut","dove","dragon","drift","drizzle","drum","duck","dumpling","dune","eagle","echo","eclipse","eel","egg","elder","elephant","elk","ember","ermine","estuary","evergreen","falcon","fawn","feather","fennel","fern","ferret","field","fig","finch","fir","firefly","fish","fjord","flame","flamingo","flask","flax","fleece","flicker","flower","flute","fog","forest","fossil","fountain","fox","frog","frost","galaxy","garden","gazelle","gecko","gem","geyser","ginger","glacier","glade","glen","globe","glow","goat","goose","gorge","gourd","granite","grape","grass","grotto","grove","gull","hammock","harbor","hare","harp","harvest","hat","hawk","haystack","hazel","hearth","heather","hedge","heron","hibiscus","hickory","hill","hollow","honey","horizon","horse","hummingbird","ibis","iceberg","icicle","inlet","iris","island","ivy","jackal","jacket","jade","jaguar","jam","jar","jasmine","jay","jelly","jetty","juniper","kayak","kelp","kestrel","kettle","key","kingfisher","kite","kitten","kiwi","knoll","koala","ladybug","lagoon","lake","lamp","lantern","lark","lava","lavender","leaf","ledge","lemon","lemur","leopard","lichen","lighthouse","lilac","lily","lime","lion","llama","lobster","log","loon","lotus","lynx","lyric","magnet","manatee","mango","mangrove","maple","marble","marigold","marlin","marsh","meadow","melody","melon","mermaid","mesa","meteor","minnow","mint","mirage","mist","mitten","mole","monkey","moon","moose","morel","mosaic","moss","moth","mountain","mouse","muffin","mushroom","mussel","narwhal","nautilus","nectar","needle","nest","nettle","newt","nightingale","nimbus","noodle","north","note","nutmeg","oak","oasis","oats","ocean","ocelot","octopus","olive","onion","opal","orange","orca","orchid","oriole","osprey","otter","owl","oyster","paddle","palm","panda","pansy","panther","papaya","paper","parrot","parsley","partridge","pasture","path","peach","peacock","pear","pebble","pecan","pelican","penguin","peony","pepper","petal","petunia","pheasant","phoenix","pie","pigeon","pine","pineapple","pistachio","planet","plateau","plover","plum","pond","pony","poppy","porpoise","pouch","prairie","pretzel","primrose","puffin","pumpkin","quail","quartz","queen","quill","quince","quokka","rabbit","raccoon","radish","rain","rainbow","rapids","raspberry","raven","redwood","reef","reel","reindeer","rhino","ribbon","ridge","river","road","robin","rock","rooster","rose","rosemary","rowan","rye","saffron","sage","salmon","sand","sapphire","satellite","savanna","scallop","scarf","sea","seagull","seal","seed","sequoia","sesame","shark","shell","shore","shrimp","silk","silo","sky","skylark","sleet","snail","snake","snow","sock","sorbet","spark","sparrow","spider","spire","spoon","spring","sprout","spruce","squirrel","star","starfish","starling","stone","stork","storm","stream","summer","sun","sundial","sunflower","swan","swift","sycamore","tadpole","tamarind","tangerine","tea","teal","tern","terrace","thicket","thistle","thrush","thunder","tide","tiger","timber","toad","toffee","tooth","topaz","tortoise","totem","toucan","tower","tractor","trail","tree","trout","truffle","tugboat","tulip","tundra","turnip","turtle","twig","twilight","umbrella","unicorn","urchin","valley","vanilla","vine","violet","vista","volcano","voyage","vulture","wagon","walnut","walrus","wasp","water","waterfall","wave","whale","wharf","wheat","whisker","wildcat","wildflower","willow","wind","window","winter","wisteria","wolf","wombat","wood","wren","yak","yam","yarrow","yew","yucca","zebra","zephyr","zinnia","zucchini"];var x="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",S="YYYYMMDD";function D(e,r){let a=r?.now??new Date,o=r?.random??Math.random,t=e.replace(/\{([^{}]+?)\}/g,(n,d)=>{let[p,g]=q(d);switch(p){case"date":return E(a,g||S);case"adjective":return C(O,o);case"noun":return C(A,o);case"random":return M(Y(g,6),o);default:return n}});return T(t.toLowerCase())}function q(e){let r=e.indexOf(":");return r===-1?[e.trim(),void 0]:[e.slice(0,r).trim(),e.slice(r+1)]}function Y(e,r){if(!e)return r;let a=parseInt(e,10);return Number.isFinite(a)&&a>0?a:r}function C(e,r){return e[Math.floor(r()*e.length)]}function M(e,r){let a=[];for(let o=0;o<e;o++)a.push(x.charAt(Math.floor(r()*x.length)));return a.join("")}function E(e,r){let a={YYYY:String(e.getFullYear()),YY:String(e.getFullYear()).slice(-2),MM:m(e.getMonth()+1),DD:m(e.getDate()),HH:m(e.getHours()),mm:m(e.getMinutes()),ss:m(e.getSeconds())};return r.replace(/YYYY|YY|MM|DD|HH|mm|ss/g,o=>a[o]??o)}function m(e){return e<10?`0${e}`:String(e)}var i="Releases";async function V(e,r){if(!e)throw new Error("missing data source id");let a=window.__ROOT_CTX.rootConfig.projectId,o=window.firebase.db,t=s(o,"Projects",a,i,e);await R(o,async n=>{if((await n.get(t)).exists())throw new Error(`release exists: ${e}`);await n.set(t,{...r,id:e,createdAt:y(),createdBy:window.firebase.user.email})}),l("release.create",{metadata:{releaseId:e}})}async function G(){let e=window.__ROOT_CTX.rootConfig.projectId,r=window.firebase.db,a=w(r,"Projects",e,i),o=b(a,k("createdAt","desc")),t=await j(o),n=[];return t.forEach(d=>{n.push(d.data())}),n}async function h(e){let r=window.__ROOT_CTX.rootConfig.projectId,a=window.firebase.db,o=s(a,"Projects",r,i,e),t=await v(o);return t.exists()?t.data():null}async function K(e,r){let a=window.__ROOT_CTX.rootConfig.projectId,o=window.firebase.db,t=s(o,"Projects",a,i,e);await u(t,r),l("release.save",{metadata:{releaseId:e}})}async function Q(e){let r=window.__ROOT_CTX.rootConfig.projectId,a=window.firebase.db,o=s(a,"Projects",r,i,e);await u(o,{archivedAt:y(),archivedBy:window.firebase.user.email}),l("release.archive",{metadata:{releaseId:e}})}async function W(e){let r=window.__ROOT_CTX.rootConfig.projectId,a=window.firebase.db,o=s(a,"Projects",r,i,e);await u(o,{archivedAt:c(),archivedBy:c()}),l("release.unarchive",{metadata:{releaseId:e}})}async function Z(e){let r=await h(e);if(!r)throw new Error(`release not found: ${e}`);if(r.archivedAt)throw new Error(`release is archived: ${e}`);let a=r.docIds||[],o=r.dataSourceIds||[];if(a.length===0&&o.length===0)throw new Error(`no docs or data sources to publish for release: ${e}`);let t=window.__ROOT_CTX.rootConfig.projectId,n=window.firebase.db,d=s(n,"Projects",t,i,e),p=I(n);p.update(d,{publishedAt:y(),publishedBy:window.firebase.user.email,scheduledAt:c(),scheduledBy:c()}),o.length>0&&await z(o,{batch:p,commitBatch:!1}),await _(a,{batch:p,releaseId:e,publishMessage:r.description}),console.log(`published release: ${e}`);let g={releaseId:e,docIds:a,dataSourceIds:o};r.description&&(g.publishMessage=r.description),l("release.publish",{metadata:g})}async function ee(e,r){let a=await h(e);if(!a)throw new Error(`release not found: ${e}`);if(a.archivedAt)throw new Error(`release is archived: ${e}`);typeof r=="number"&&(r=f.fromMillis(r));let o=window.__ROOT_CTX.rootConfig.projectId,t=window.firebase.db,n=s(t,"Projects",o,i,e);await u(n,{scheduledAt:r,scheduledBy:window.firebase.user.email}),l("release.publish",{metadata:{releaseId:e,scheduledAt:r.toMillis()}})}function re(){return D("{date}-{adjective}-{noun}")}async function ae(e){if(!await h(e))throw new Error(`release not found: ${e}`);let a=window.__ROOT_CTX.rootConfig.projectId,o=window.firebase.db,t=s(o,"Projects",a,i,e);await u(t,{scheduledAt:c(),scheduledBy:c()}),l("release.unschedule",{metadata:{releaseId:e}})}export{D as a,V as b,G as c,h as d,K as e,Q as f,W as g,Z as h,ee as i,re as j,ae as k};
@@ -1 +1 @@
1
- import{f as n}from"./chunk-YLSRRNSE.js";import{Ga as t}from"./chunk-LROR6N3B.js";function f(a){let{className:r,as:h,size:e,weight:o,color:i,children:g,...s}=a;return t(h||"h2",{...s,className:n(r,"heading",e&&`size:${e}`,o&&`weight:${o}`,i&&`color:${i}`),children:g})}export{f as a};
1
+ import{e as n}from"./chunk-BUNR5EU3.js";import{Ga as t}from"./chunk-LROR6N3B.js";function f(a){let{className:r,as:h,size:e,weight:o,color:i,children:g,...s}=a;return t(h||"h2",{...s,className:n(r,"heading",e&&`size:${e}`,o&&`weight:${o}`,i&&`color:${i}`),children:g})}export{f as a};