@blinkk/root-cms 3.1.5 → 3.1.7

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 (120) hide show
  1. package/dist/app.js +1 -1
  2. package/dist/{chunk-MUXSUGFF.js → chunk-NIBAHWGP.js} +2 -2
  3. package/dist/{chunk-ETHWZSNM.js → chunk-PLSNGCYU.js} +196 -22
  4. package/dist/{chunk-6CTCV2PN.js → chunk-Z2CTQVYR.js} +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/client.js +1 -1
  7. package/dist/core/client.d.ts +30 -2
  8. package/dist/core/cron-schedule.d.ts +63 -0
  9. package/dist/core/plugin.d.ts +6 -1
  10. package/dist/core.js +1 -1
  11. package/dist/functions.js +2 -2
  12. package/dist/plugin.js +7 -5
  13. package/dist/richtext.js +1 -1
  14. package/dist/shared/embed-protocol.d.ts +19 -0
  15. package/dist/ui/AIPage-XPE7F5AF.js +1 -0
  16. package/dist/ui/AssetsPage-C3ZEENBO.js +1 -0
  17. package/dist/ui/CollectionPage-VQ4WJHJB.js +1 -0
  18. package/dist/ui/ComparePage-VKOXKID4.js +1 -0
  19. package/dist/ui/{DataPage-RFNGSDDN.js → DataPage-JXZ2Z3DG.js} +1 -1
  20. package/dist/ui/{DataSourcePage-U46CDIH2.js → DataSourcePage-X3NSUOTP.js} +1 -1
  21. package/dist/ui/{DocTranslationsPage-BFCM2PE3.js → DocTranslationsPage-AJGT52XQ.js} +1 -1
  22. package/dist/ui/DocumentPage-ZFD2KE3A.js +1 -0
  23. package/dist/ui/{EditDataSourcePage-NKKIF6AD.js → EditDataSourcePage-EMK3F6HD.js} +1 -1
  24. package/dist/ui/EditReleasePage-3IAERDSH.js +1 -0
  25. package/dist/ui/EmbeddedAIPage-2W5F7QFL.js +1 -0
  26. package/dist/ui/{EmbeddedDocumentPage-2CNQJTW5.js → EmbeddedDocumentPage-BESFW2YZ.js} +1 -1
  27. package/dist/ui/{ImageEditorDialog-YDKOGVJV.js → ImageEditorDialog-JDXMU2FC.js} +1 -1
  28. package/dist/ui/LogsPage-KCD4XZ2N.js +1 -0
  29. package/dist/ui/NewDataSourcePage-EZDU7HGA.js +1 -0
  30. package/dist/ui/NewReleasePage-FFTRUIP4.js +1 -0
  31. package/dist/ui/{NotFoundPage-JRYFUENW.js → NotFoundPage-JGG2NTUE.js} +1 -1
  32. package/dist/ui/{ProjectPage-2WIMWCSX.js → ProjectPage-HT5JKR33.js} +1 -1
  33. package/dist/ui/ReleasePage-OYWLGV4D.js +1 -0
  34. package/dist/ui/{ReleasesPage-AW6PICTQ.js → ReleasesPage-XEII7FBC.js} +1 -1
  35. package/dist/ui/{SettingsPage-KFLNZ356.js → SettingsPage-7GIBTPB5.js} +1 -1
  36. package/dist/ui/SidebarToolsPage-GQYTZDAC.js +1 -0
  37. package/dist/ui/{TaskPage-GZGPKIL5.js → TaskPage-SNDDYDZY.js} +1 -1
  38. package/dist/ui/TasksPage-CEVWOY67.js +1 -0
  39. package/dist/ui/{TranslationsArbPage-K272JEAA.js → TranslationsArbPage-ADRLLAIW.js} +1 -1
  40. package/dist/ui/{TranslationsEditPage-XWXPNKRQ.js → TranslationsEditPage-PSKA7K44.js} +1 -1
  41. package/dist/ui/{TranslationsPage-7KUHVTLK.js → TranslationsPage-NGCLDSK7.js} +2 -2
  42. package/dist/ui/{chunk-75NMQ3LW.js → chunk-3YBRRPAN.js} +1 -1
  43. package/dist/ui/{chunk-QLIIVG5Q.js → chunk-5F5XJPKD.js} +1 -1
  44. package/dist/ui/{chunk-7UHZS56B.js → chunk-6ZVMJXLE.js} +53 -53
  45. package/dist/ui/chunk-7OU4ERTS.js +87 -0
  46. package/dist/ui/chunk-A2JZYRE3.js +1 -0
  47. package/dist/ui/chunk-B74M7NEV.js +1 -0
  48. package/dist/ui/chunk-BLHXP3SR.js +3 -0
  49. package/dist/ui/{chunk-UJX25CXD.js → chunk-BOIY4J2R.js} +1 -1
  50. package/dist/ui/chunk-CEWU5VSJ.js +1 -0
  51. package/dist/ui/{chunk-34W6H4YG.js → chunk-CXMVFNX3.js} +1 -1
  52. package/dist/ui/{chunk-F7RQT4XN.js → chunk-EET5AS64.js} +1 -1
  53. package/dist/ui/{chunk-WASID5UU.js → chunk-GJ7ES2LA.js} +1 -1
  54. package/dist/ui/{chunk-2RRM4HEQ.js → chunk-H5JL376P.js} +1 -1
  55. package/dist/ui/{chunk-H37RXS4R.js → chunk-HKCOKHA2.js} +1 -1
  56. package/dist/ui/{chunk-5KSGCGYY.js → chunk-HUYP5U4K.js} +1 -1
  57. package/dist/ui/{chunk-NCZD5IWS.js → chunk-HWON6MV4.js} +1 -1
  58. package/dist/ui/{chunk-HXSB6YB2.js → chunk-I3H465Z6.js} +1 -1
  59. package/dist/ui/{chunk-535JU7FU.js → chunk-ILFWJKSS.js} +1 -1
  60. package/dist/ui/chunk-K7IG7PO2.js +1 -0
  61. package/dist/ui/chunk-LKTN7YVM.js +31 -0
  62. package/dist/ui/{chunk-PLYSJ7W5.js → chunk-LS2JH5QF.js} +1 -1
  63. package/dist/ui/{chunk-QFDU6FXP.js → chunk-MALK5YEV.js} +1 -1
  64. package/dist/ui/{chunk-YP6ZH3MT.js → chunk-MFRPYPCF.js} +1 -1
  65. package/dist/ui/chunk-MYPLMHFW.js +1 -0
  66. package/dist/ui/{chunk-RB23LLKL.js → chunk-OKNBFTYR.js} +1 -1
  67. package/dist/ui/{chunk-OWBT6YUM.js → chunk-P2RVKNG4.js} +1 -1
  68. package/dist/ui/{chunk-JBLSUM6W.js → chunk-P57AFOMR.js} +1 -1
  69. package/dist/ui/{chunk-HV3JJ5UT.js → chunk-PLTI4NG7.js} +1 -1
  70. package/dist/ui/chunk-PY4JH5SN.js +1 -0
  71. package/dist/ui/{chunk-44ZU5WMI.js → chunk-SBAY52SC.js} +1 -1
  72. package/dist/ui/{chunk-Y5EOMMNI.js → chunk-TCKR2BL4.js} +1 -1
  73. package/dist/ui/{chunk-WC7KMPEQ.js → chunk-TCRDGNM4.js} +1 -1
  74. package/dist/ui/chunk-TCWN5YRW.js +1 -0
  75. package/dist/ui/{chunk-DWV5J2W7.js → chunk-TZWCCNSA.js} +1 -1
  76. package/dist/ui/{chunk-2PTLQRTU.js → chunk-U5OXKKBN.js} +1 -1
  77. package/dist/ui/{chunk-XUBZH4ON.js → chunk-VZGDXWRK.js} +1 -1
  78. package/dist/ui/{chunk-IGZDFHVM.js → chunk-X3VDQDHP.js} +1 -1
  79. package/dist/ui/chunk-XBYMUPZF.js +19 -0
  80. package/dist/ui/{chunk-QRAFYIAW.js → chunk-XYXL5HSZ.js} +1 -1
  81. package/dist/ui/chunk-Y7RYSRP7.js +7 -0
  82. package/dist/ui/{chunk-WRA24P66.js.LEGAL.txt → chunk-Y7RYSRP7.js.LEGAL.txt} +1 -0
  83. package/dist/ui/chunk-YIKHJONY.js +1 -0
  84. package/dist/ui/chunk-Z2CRNO3I.js +1 -0
  85. package/dist/ui/{chunk-UCYWQEAS.js → chunk-ZD3ORGA6.js} +1 -1
  86. package/dist/ui/{chunk-YBHFGQ3Z.js → chunk-ZQDUWURP.js} +1 -1
  87. package/dist/ui/{chunk-PIJ3E47R.js → chunk-ZYSR5UIW.js} +1 -1
  88. package/dist/ui/ui.css +1 -1
  89. package/dist/ui/ui.js +1 -1
  90. package/package.json +3 -3
  91. package/dist/ui/AIPage-25WICIOT.js +0 -1
  92. package/dist/ui/AssetsPage-WKTM2J2G.js +0 -1
  93. package/dist/ui/CollectionPage-5ZOVG7IG.js +0 -1
  94. package/dist/ui/ComparePage-DDIFYYTK.js +0 -1
  95. package/dist/ui/DocumentPage-OTBXM55S.js +0 -1
  96. package/dist/ui/EditReleasePage-TKNOUT7A.js +0 -1
  97. package/dist/ui/EmbeddedAIPage-4AX7VO3T.js +0 -1
  98. package/dist/ui/LogsPage-SCECIAZH.js +0 -1
  99. package/dist/ui/NewDataSourcePage-FAOPK2RZ.js +0 -1
  100. package/dist/ui/NewReleasePage-HD6T6UV2.js +0 -1
  101. package/dist/ui/ReleasePage-GUMEMLF6.js +0 -1
  102. package/dist/ui/SidebarToolsPage-3R7BQ2F7.js +0 -1
  103. package/dist/ui/TasksPage-G3GBTV3L.js +0 -1
  104. package/dist/ui/chunk-2FQMT5AB.js +0 -3
  105. package/dist/ui/chunk-FVWSVOOY.js +0 -1
  106. package/dist/ui/chunk-GCSN3YEC.js +0 -31
  107. package/dist/ui/chunk-N5RJIILP.js +0 -1
  108. package/dist/ui/chunk-NXWYS4HG.js +0 -19
  109. package/dist/ui/chunk-OWYV43BT.js +0 -1
  110. package/dist/ui/chunk-QWB6MAPJ.js +0 -7
  111. package/dist/ui/chunk-RN4XVVWD.js +0 -1
  112. package/dist/ui/chunk-T5BJNOWE.js +0 -1
  113. package/dist/ui/chunk-TNW2GNUR.js +0 -1
  114. package/dist/ui/chunk-UPN3EMUS.js +0 -1
  115. package/dist/ui/chunk-VPZHG7JL.js +0 -81
  116. package/dist/ui/chunk-WRA24P66.js +0 -7
  117. package/dist/ui/chunk-Z3ZJJWFT.js +0 -1
  118. /package/dist/ui/{ImageEditorDialog-YDKOGVJV.js.LEGAL.txt → ImageEditorDialog-JDXMU2FC.js.LEGAL.txt} +0 -0
  119. /package/dist/ui/{chunk-7UHZS56B.js.LEGAL.txt → chunk-6ZVMJXLE.js.LEGAL.txt} +0 -0
  120. /package/dist/ui/{chunk-VPZHG7JL.js.LEGAL.txt → chunk-7OU4ERTS.js.LEGAL.txt} +0 -0
@@ -0,0 +1 @@
1
+ import{i as ve,k as Ae,p as ke}from"./chunk-CEWU5VSJ.js";import{b as ae,c as de,e as ce,j as re}from"./chunk-B74M7NEV.js";import{a as J}from"./chunk-JDW4UORS.js";import{a as A,c as P}from"./chunk-XYXL5HSZ.js";import{a as Ce,b as Te}from"./chunk-W5DOO6ID.js";import{a as Ie}from"./chunk-ZQDUWURP.js";import{b as I}from"./chunk-U5OXKKBN.js";import{a as c,b as y}from"./chunk-ZYSR5UIW.js";import{a as k}from"./chunk-HWON6MV4.js";import{A as Q,E as X,F as j,G as ee,H as oe,I as V,J as ie,K as se,L as ne,M as te,N as le}from"./chunk-ISUGBMXC.js";import{C as K}from"./chunk-XOWWPE7X.js";import{$ as Z,Ga as ue,Ja as me,Ka as fe,Ma as _e,Rb as be,V as W,Vc as xe,W as Y,a as _,c as q,da as v,fd as e,gc as $,hc as B,j as F,kb as pe,ob as ge,oc as Me,qa as p,ua as G,wb as he}from"./chunk-Y7RYSRP7.js";import{d as D}from"./chunk-KUCVLANF.js";F();var ye="AddToReleaseModal";function we(i){let s=A(),a=P();return{open:()=>{s.openContextModal(ye,{...a,title:"Add docs to a release",innerProps:i,size:"600px"})}}}function Le(i){let{innerProps:s,context:a,id:l}=i,d=A(),[o,h]=_(""),[r,b]=_(!1),[u,x]=_(!1),[g,w]=_([]),[m,R]=_(""),[M,L]=_(re()),[T,f]=_("");q(()=>{async function n(){b(!0),await I(async()=>{let E=(await de()).filter(S=>!S.publishedAt&&!S.archivedAt);w(E)}),b(!1)}n()},[]);async function z(){o==="new"?await N():o==="existing"&&await O()}async function N(){if(!M){c({title:"Missing ID",message:"Please enter a release ID.",color:"red",autoClose:5e3});return}if(!J(M)){c({title:"Invalid ID",message:"Release ID must use alphanumeric characters and dashes only.",color:"red",autoClose:5e3});return}x(!0),await I(async()=>{let n={docIds:s.docIds};T&&(n.description=T),await ae(M,n),c({title:`Release created: ${M}`,message:e("span",{children:["Created release with ",s.docIds.length," doc(s)."," ",e("a",{href:`/cms/releases/${M}`,children:"View release"})]}),autoClose:1e4}),d.closeAll()}),x(!1)}async function O(){if(!m){c({title:"No release selected",message:"Please select a release.",color:"red",autoClose:5e3});return}x(!0),await I(async()=>{let H=g.find(Pe=>Pe.id===m)?.docIds||[],E=Array.from(new Set([...H,...s.docIds])).sort();await ce(m,{docIds:E});let S=E.length-H.length;c({title:`Docs added to release: ${m}`,message:e("span",{children:["Added ",S," new doc(s) to release."," ",e("a",{href:`/cms/releases/${m}`,children:"View release"})]}),autoClose:1e4}),d.closeAll()}),x(!1)}let t=!0;return(o==="new"&&M||o==="existing"&&m)&&(t=!1),e("div",{className:"AddToReleaseModal",children:e("div",{className:"AddToReleaseModal__content",children:[e("div",{className:"AddToReleaseModal__docs",children:[e("div",{className:"AddToReleaseModal__docs__label",children:["Docs to add (",s.docIds.length,")"]}),e("div",{className:"AddToReleaseModal__docs__list",children:s.docIds.map(n=>e(ke,{docId:n,variant:"compact",statusBadges:!0},n))})]}),e("div",{className:"AddToReleaseModal__mode",children:[e("label",{className:`AddToReleaseModal__mode__option${o==="new"?" AddToReleaseModal__mode__option--selected":o?" AddToReleaseModal__mode__option--unselected":""}`,children:[e("div",{className:"AddToReleaseModal__mode__option__input",children:[e("input",{type:"radio",name:"release-mode",value:"new",checked:o==="new",onChange:()=>h("new")})," ","New release"]}),e("div",{className:"AddToReleaseModal__mode__option__help",children:"Create a new release with these docs."})]}),e("label",{className:`AddToReleaseModal__mode__option${o==="existing"?" AddToReleaseModal__mode__option--selected":o?" AddToReleaseModal__mode__option--unselected":""}`,children:[e("div",{className:"AddToReleaseModal__mode__option__input",children:[e("input",{type:"radio",name:"release-mode",value:"existing",checked:o==="existing",onChange:()=>h("existing")})," ","Existing release"]}),e("div",{className:"AddToReleaseModal__mode__option__help",children:"Add to an existing release."})]})]}),o==="new"&&e("div",{className:"AddToReleaseModal__form",children:[e("div",{className:"AddToReleaseModal__form__field",children:[e("label",{children:"Release ID"}),e("input",{type:"text",placeholder:"e.g. my-release",value:M,onInput:n=>{L(n.target.value)}})]}),e("div",{className:"AddToReleaseModal__form__field",children:[e("label",{children:"Description (optional)"}),e("textarea",{rows:2,placeholder:"Describe this release",value:T,onInput:n=>{f(n.target.value)}})]})]}),o==="existing"&&e("div",{className:"AddToReleaseModal__releases",children:r?e("div",{className:"AddToReleaseModal__releases__empty",children:e(W,{color:"gray",size:"sm"})}):g.length===0?e("div",{className:"AddToReleaseModal__releases__empty",children:"No unpublished releases found. Create a new one instead."}):g.map(n=>e("div",{className:`AddToReleaseModal__release${m===n.id?" AddToReleaseModal__release--selected":""}`,onClick:()=>R(n.id),children:[e("input",{type:"radio",name:"existing-release",checked:m===n.id,onChange:()=>R(n.id)}),e("div",{className:"AddToReleaseModal__release__info",children:[e("div",{className:"AddToReleaseModal__release__info__id",children:n.id}),n.description&&e("div",{className:"AddToReleaseModal__release__info__description",children:n.description})]}),e("div",{className:"AddToReleaseModal__release__docCount",children:[n.docIds?.length||0," doc(s)"]})]},n.id))}),e("div",{className:"AddToReleaseModal__buttons",children:[e(v,{variant:"outline",onClick:()=>a.closeModal(l),type:"button",size:"xs",color:"dark",children:"Cancel"}),e(v,{variant:"filled",size:"xs",color:"dark",disabled:t,loading:u,onClick:z,children:o==="new"?"Create release":"Add to release"})]})]})})}Le.id=ye;F();function C(i){return e("div",{className:"DocIdBadge",children:e("code",{"data-testid":"doc-id",children:i.docId})})}var Re="LockPublishingModal";function De(i){let s=A(),a=P();return{open:l=>{let d={...i,...l},o;d.unlock?o=`Unlock publishing for ${i.docId}`:d.existingLock?o=`Edit publishing lock for ${i.docId}`:o=`Lock publishing for ${i.docId}`,s.openContextModal(Re,{...a,title:o,innerProps:{...i,...l},size:"600px"})}}}function ze(i){let s=l=>l<10?"0"+l:l,a=new Date(i);return`${a.getFullYear()}-${s(a.getMonth()+1)}-${s(a.getDate())}T${s(a.getHours())}:${s(a.getMinutes())}`}function U(i){let{innerProps:s}=i;return s.unlock?e(U.Unlock,{...i}):e(U.Lock,{...i})}U.Lock=i=>{let{innerProps:s,context:a,id:l}=i,d=!!s.existingLock,[o,h]=_(s.existingLock?.reason||""),[r,b]=_(s.existingLock?.until||0),[u,x]=_(!1),[g,w]=_(!1),m=A();function R(f){return f?Math.floor(new Date(f).getTime()):0}async function M(f){f.preventDefault(),x(!0),await I(async()=>{await oe(s.docId,{reason:o,until:r}),c({title:d?"Updated!":"Locked!",message:d?`Publishing lock updated for ${s.docId}.`:`Publishing is locked for ${s.docId}.`,autoClose:1e4}),m.closeModal(l),s.onChange&&s.onChange("locked")}),x(!1)}async function L(){w(!0),await I(async()=>{await V(s.docId),c({title:"Unlocked!",message:`Publishing is unlocked for ${s.docId}.`,autoClose:1e4}),m.closeModal(l),s.onChange&&s.onChange("unlocked")}),w(!1)}return e("div",{className:"LockPublishingModal LockPublishingModal--lock",children:[e(k,{className:"LockPublishingModal__body",size:"body-sm",children:d?"Publishing is currently locked. Update the publishing lock details below, or remove the lock to re\u2011enable publishing.":"Are you sure you want to lock publishing? Content editors will not be able to publish until publishing is unlocked."}),e("form",{className:"LockPublishingModal__form",onSubmit:f=>M(f),children:[e("div",{className:"LockPublishingModal__form__section",children:e(G,{name:"reason",label:"Reason",description:"Specify a short reason so other content editors know why publishing is locked.",size:"xs",radius:0,value:o,onChange:f=>{h(f.currentTarget.value)}})}),e("div",{className:"LockPublishingModal__form__section",children:e(Z,{label:"Lock until",description:"Optional. Publishing is unlocked at the specified time. If not provided, publishing will be locked indefinitely.",size:"xs",children:e("div",{className:"DocEditor__DateTimeField",children:[e("input",{name:"until",type:"datetime-local",min:K(),defaultValue:r?ze(r):"",onChange:f=>{let N=f.target.value;b(R(N))}}),e("div",{className:"DocEditor__DateTimeField__timezone",children:["timezone: ",Intl.DateTimeFormat().resolvedOptions().timeZone]})]})})}),e("div",{className:"LockPublishingModal__buttons",children:[d&&e(v,{variant:"filled",size:"xs",color:"red",type:"button",leftIcon:e($,{size:14}),loading:g,disabled:u,onClick:()=>L(),className:"LockPublishingModal__buttons__unlock",children:"Unlock"}),e(v,{variant:"outline",onClick:()=>a.closeModal(l),type:"button",size:"xs",color:"dark",children:"Cancel"}),e(v,{variant:"filled",size:"xs",color:"dark",leftIcon:e(B,{size:14}),disabled:!o||g,type:"submit",loading:u,children:d?"Save":"Lock"})]})]})]})};U.Unlock=i=>{let{innerProps:s,context:a,id:l}=i,[d,o]=_(!1),h=A();async function r(){o(!0),await I(async()=>{await V(s.docId),c({title:"Unlocked!",message:`Publishing is unlocked for ${s.docId}.`,autoClose:1e4}),h.closeModal(l),s.onChange&&s.onChange("unlocked")})}return e("div",{className:"LockPublishingModal LockPublishingModal--unlock",children:[e(k,{className:"LockPublishingModal__body",children:"Are you sure you want to unlock publishing for the following doc? This will re-enable content editors to publish the doc."}),e(C,{docId:s.docId}),e("div",{className:"LockPublishingModal__buttons",children:[e(v,{variant:"outline",onClick:()=>a.closeModal(l),type:"button",size:"xs",color:"dark",children:"Cancel"}),e(v,{variant:"filled",size:"xs",color:"dark",leftIcon:e($,{size:14}),loading:d,onClick:()=>r(),children:"Unlock"})]})]})};U.id=Re;function Eo(i){let{roles:s}=Ie(),a=window.firebase.user.email||"",l=Te(s,a),d=Ce(s,a),o=i.docId,h=i.data||{},r=h.sys||{},b=ne(h),u=A(),x=ve({fromDocId:o,onSuccess:t=>{i.onAction&&i.onAction({action:"copy",newDocId:t})}}),g=P(),w=Ae({docId:o}),m=De({docId:o}),R=we({docIds:[o]}),M=()=>{let t=`revert-draft-${o}`,n=u.openConfirmModal({...g,title:`Discard draft edits for ${o}`,children:e(D,{children:[e(k,{size:"body-sm",weight:"semi-bold",className:"DocActionsMenu__confirmText",children:"Are you sure you want to discard draft changes for the following doc? The doc data will revert to the published version. There is no undo."}),e(C,{docId:o})]}),labels:{confirm:"Discard draft edits",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"red",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!1,onConfirm:async()=>{c({id:t,title:"Discarding draft edits",message:`Discarding draft edits of ${o}...`,loading:!0,autoClose:!1}),await j(o),y({id:t,title:"Discarded draft edits",message:`Successfully reverted ${o} back to its published version`,loading:!1,autoClose:5e3}),u.closeModal(n),i.onAction&&i.onAction({action:"revert-draft"})}})},L=()=>{let t=`unpublish-doc-${o}`,n=u.openConfirmModal({...g,title:`Unpublish ${o}`,children:e(D,{children:[e(k,{size:"body-sm",weight:"semi-bold",className:"DocActionsMenu__confirmText",children:"Are you sure you want to unpublish the following doc? There is no undo."}),e(C,{docId:o})]}),labels:{confirm:"Unpublish",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"red",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!1,onConfirm:async()=>{c({id:t,title:"Unpublishing doc",message:`Requesting unpublish of ${o}...`,loading:!0,autoClose:!1}),await X(o),y({id:t,title:"Unpublished!",message:`Successfully unpublished ${o}!`,loading:!1,autoClose:5e3}),u.closeModal(n),i.onAction&&i.onAction({action:"unpublish"})}})},T=t=>{i.onAction&&i.onAction({action:t})},f=()=>{let t=`unschedule-doc-${o}`,n=u.openConfirmModal({...g,title:`Unschedule ${o}`,children:e(D,{children:[e(k,{size:"body-sm",weight:"semi-bold",className:"DocActionsMenu__confirmText",children:"Are you sure you want to unschedule the following doc?"}),e(C,{docId:o})]}),labels:{confirm:"Unschedule",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"red",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!1,onConfirm:async()=>{c({id:t,title:"Unschedule doc",message:`Requesting unschedule of ${o}...`,loading:!0,autoClose:!1}),await ee(o),y({id:t,title:"Unscheduled!",message:`Successfully unscheduled ${o}!`,loading:!1,autoClose:5e3}),u.closeModal(n),i.onAction&&i.onAction({action:"unschedule"})}})},z=()=>{let t=`archive-doc-${o}`,n=u.openConfirmModal({...g,title:`Archive ${o}`,children:e(D,{children:[e(k,{size:"body-sm",weight:"semi-bold",className:"DocActionsMenu__confirmText",children:"Are you sure you want to archive the following doc? Archived docs are hidden from the collection list by default but can be restored later."}),e(C,{docId:o})]}),labels:{confirm:"Archive",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"red",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!1,onConfirm:async()=>{c({id:t,title:"Archiving doc",message:`Requesting archive of ${o}...`,loading:!0,autoClose:!1}),await ie(o),y({id:t,title:"Archived!",message:`Successfully archived ${o}!`,loading:!1,autoClose:5e3}),u.closeModal(n),i.onAction&&i.onAction({action:"archive"})}})},N=async()=>{let t=`unarchive-doc-${o}`;c({id:t,title:"Unarchiving doc",message:`Requesting unarchive of ${o}...`,loading:!0,autoClose:!1}),await se(o),y({id:t,title:"Unarchived!",message:`Successfully unarchived ${o}!`,loading:!1,autoClose:5e3}),i.onAction&&i.onAction({action:"unarchive"})},O=()=>{let t=`delete-doc-${o}`,n=u.openConfirmModal({...g,title:"Delete doc",children:e(D,{children:[e(k,{size:"body-sm",weight:"semi-bold",className:"DocActionsMenu__confirmText",children:"Are you sure you want to delete the following doc? There is no undo."}),e(C,{docId:o})]}),labels:{confirm:"Delete",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"red",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!1,onConfirm:async()=>{c({id:t,title:"Deleting doc",message:`Requesting deletion of ${o}...`,loading:!0,autoClose:!1}),await Q(o),y({id:t,title:"Deleted!",message:`Successfully deleted ${o}!`,loading:!1,autoClose:5e3}),u.closeModal(n),i.onDelete&&i.onDelete(),i.onAction&&i.onAction({action:"delete"})}})};return e(p,{className:"CollectionPage__collection__docsList__doc__controls__menu",position:"bottom",control:e(Y,{className:"DocEditor__ArrayField__item__header__controls__dots",children:e(he,{size:16})}),children:[!b&&e(p.Item,{icon:e(Me,{size:20}),onClick:()=>R.open(),disabled:!d,children:"Add to release"}),e(p.Item,{icon:e(be,{size:20}),onClick:()=>w.open(),children:"Version history"}),e(p.Item,{icon:e(ge,{size:20}),onClick:()=>x.open(),disabled:!l,children:"Copy"}),!b&&r.modifiedAt&&r.publishedAt&&r.modifiedAt>r.publishedAt&&e(p.Item,{icon:e(_e,{size:20}),onClick:()=>M(),disabled:!l,children:"Discard draft edits"}),!b&&r.firstPublishedAt&&e(p.Item,{icon:e(pe,{size:20}),onClick:()=>L(),disabled:!d,children:"Unpublish"}),!b&&r.scheduledAt&&e(p.Item,{icon:e(ue,{size:20}),onClick:()=>f(),disabled:!d,children:"Unschedule"}),!b&&(le(h)?e(p.Item,{icon:e($,{size:20}),onClick:()=>m.open({unlock:!0,onChange:T}),disabled:!l,children:"Unlock publishing"}):e(p.Item,{icon:e(B,{size:20}),onClick:()=>m.open({unlock:!1,onChange:T}),disabled:!l||te(h),children:"Lock publishing"})),b?e(p.Item,{icon:e(me,{size:20}),onClick:()=>N(),disabled:!l,children:"Unarchive"}):!r.publishedAt&&e(p.Item,{icon:e(fe,{size:20}),onClick:()=>z(),disabled:!l,children:"Archive"}),e(p.Item,{icon:e(xe,{size:20}),onClick:()=>O(),disabled:!l,children:"Delete"})]})}export{we as a,Le as b,C as c,De as d,U as e,Eo as f};
@@ -0,0 +1 @@
1
+ import{c as D}from"./chunk-JDW4UORS.js";import{k as j}from"./chunk-Z2CRNO3I.js";import{C as T}from"./chunk-ISUGBMXC.js";import{D as l,a as y,b,c as i,g as w,i as _,n as v,o as k,q as p,t as x,u as c,v as m,x as S}from"./chunk-XOWWPE7X.js";var B=["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"],R=["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 I="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",C="YYYYMMDD";function A(e,t){let a=t?.now??new Date,o=t?.random??Math.random,r=e.replace(/\{([^{}]+?)\}/g,(n,d)=>{let[u,g]=O(d);switch(u){case"date":return E(a,g||C);case"adjective":return z(B,o);case"noun":return z(R,o);case"random":return q(M(g,6),o);default:return n}});return D(r.toLowerCase())}function O(e){let t=e.indexOf(":");return t===-1?[e.trim(),void 0]:[e.slice(0,t).trim(),e.slice(t+1)]}function M(e,t){if(!e)return t;let a=parseInt(e,10);return Number.isFinite(a)&&a>0?a:t}function z(e,t){return e[Math.floor(t()*e.length)]}function q(e,t){let a=[];for(let o=0;o<e;o++)a.push(I.charAt(Math.floor(t()*I.length)));return a.join("")}function E(e,t){let a={YYYY:String(e.getFullYear()),YY:String(e.getFullYear()).slice(-2),MM:h(e.getMonth()+1),DD:h(e.getDate()),HH:h(e.getHours()),mm:h(e.getMinutes()),ss:h(e.getSeconds())};return t.replace(/YYYY|YY|MM|DD|HH|mm|ss/g,o=>a[o]??o)}function h(e){return e<10?`0${e}`:String(e)}var s="Releases";async function G(e,t){if(!e)throw new Error("missing data source id");let a=window.__ROOT_CTX.rootConfig.projectId,o=window.firebase.db,r=i(o,"Projects",a,s,e);await x(o,async n=>{if((await n.get(r)).exists())throw new Error(`release exists: ${e}`);await n.set(r,{...t,id:e,createdAt:m(),createdBy:window.firebase.user.email})}),l("release.create",{metadata:{releaseId:e}})}async function J(){let e=window.__ROOT_CTX.rootConfig.projectId,t=window.firebase.db,a=b(t,"Projects",e,s),o=w(a,_("createdAt","desc")),r=await k(o),n=[];return r.forEach(d=>{n.push(d.data())}),n}async function f(e){let t=window.__ROOT_CTX.rootConfig.projectId,a=window.firebase.db,o=i(a,"Projects",t,s,e),r=await v(o);return r.exists()?r.data():null}async function K(e,t){let a=window.__ROOT_CTX.rootConfig.projectId,o=window.firebase.db,r=i(o,"Projects",a,s,e);await p(r,t),l("release.save",{metadata:{releaseId:e}})}async function W(e){let t=window.__ROOT_CTX.rootConfig.projectId,a=window.firebase.db,o=i(a,"Projects",t,s,e);await p(o,{archivedAt:m(),archivedBy:window.firebase.user.email}),l("release.archive",{metadata:{releaseId:e}})}async function Q(e){let t=window.__ROOT_CTX.rootConfig.projectId,a=window.firebase.db,o=i(a,"Projects",t,s,e);await p(o,{archivedAt:c(),archivedBy:c()}),l("release.unarchive",{metadata:{releaseId:e}})}async function Z(e){let t=await f(e);if(!t)throw new Error(`release not found: ${e}`);if(t.archivedAt)throw new Error(`release is archived: ${e}`);let a=t.docIds||[],o=t.dataSourceIds||[];if(a.length===0&&o.length===0)throw new Error(`no docs or data sources to publish for release: ${e}`);let r=window.__ROOT_CTX.rootConfig.projectId,n=window.firebase.db,d=i(n,"Projects",r,s,e),u=S(n);u.update(d,{publishedAt:m(),publishedBy:window.firebase.user.email,scheduledAt:c(),scheduledBy:c()}),o.length>0&&await j(o,{batch:u,commitBatch:!1}),await T(a,{batch:u,releaseId:e,publishMessage:t.description}),console.log(`published release: ${e}`);let g={releaseId:e,docIds:a,dataSourceIds:o};t.description&&(g.publishMessage=t.description),l("release.publish",{metadata:g})}async function ee(e,t){let a=await f(e);if(!a)throw new Error(`release not found: ${e}`);if(a.archivedAt)throw new Error(`release is archived: ${e}`);typeof t=="number"&&(t=y.fromMillis(t));let o=window.__ROOT_CTX.rootConfig.projectId,r=window.firebase.db,n=i(r,"Projects",o,s,e);await p(n,{scheduledAt:t,scheduledBy:window.firebase.user.email}),l("release.publish",{metadata:{releaseId:e,scheduledAt:t.toMillis()}})}function te(){return A("{date}-{adjective}-{noun}")}async function ae(e){if(!await f(e))throw new Error(`release not found: ${e}`);let a=window.__ROOT_CTX.rootConfig.projectId,o=window.firebase.db,r=i(o,"Projects",a,s,e);await p(r,{scheduledAt:c(),scheduledBy:c()}),l("release.unschedule",{metadata:{releaseId:e}})}export{A as a,G as b,J as c,f as d,K as e,W as f,Q as g,Z as h,ee as i,te as j,ae as k};
@@ -0,0 +1,3 @@
1
+ import{a as _e}from"./chunk-ILFWJKSS.js";import{a as ce}from"./chunk-JDW4UORS.js";import{a as pe,c as he,e as fe}from"./chunk-Z2CRNO3I.js";import{c as me}from"./chunk-ATTW36EM.js";import{b as de}from"./chunk-U5OXKKBN.js";import{a as M}from"./chunk-ZYSR5UIW.js";import{d as le}from"./chunk-GJ7ES2LA.js";import{a as u,c as ne,da as se,e as oe,ea as G,fd as e,j as Te,na as E,pa as ie,ua as w,va as ue,za as v}from"./chunk-Y7RYSRP7.js";import{d as re}from"./chunk-KUCVLANF.js";Te();var N=[{min:0,max:59},{min:0,max:23},{min:1,max:31},{min:1,max:12},{min:0,max:7}];function O(t,a){let n=new Set,s=t.split(",");for(let m of s){let l=m.trim();if(!l)throw new Error(`invalid cron field: "${t}"`);let o=l,p=1;if(l.includes("/")){let[h,D]=l.split("/");if(o=h,p=Number(D),!Number.isInteger(p)||p<=0)throw new Error(`invalid cron step: "${l}"`)}let d,_;if(o==="*")d=a.min,_=a.max;else if(o.includes("-")){let[h,D]=o.split("-");d=Number(h),_=Number(D)}else d=Number(o),_=d;if(!Number.isInteger(d)||!Number.isInteger(_)||d<a.min||_>a.max||d>_)throw new Error(`invalid cron field: "${t}"`);for(let h=d;h<=_;h+=p)n.add(h)}return n}function Ce(t){let a=t.trim().split(/\s+/);if(a.length!==5)throw new Error(`invalid cron expression: "${t}" (expected 5 fields)`);let[n,s,m,l,o]=a,p=O(o,N[4]);return p.has(7)&&(p.delete(7),p.add(0)),{minute:O(n,N[0]),hour:O(s,N[1]),dayOfMonth:O(m,N[2]),month:O(l,N[3]),dayOfWeek:p,dayOfMonthRestricted:m.trim()!=="*",dayOfWeekRestricted:o.trim()!=="*"}}function Se(t){try{return Ce(t),!0}catch{return!1}}var we="Enter the URL to make the HTTP request.",Ne="Enter the URL of the Google Sheet, e.g. https://docs.google.com/spreadsheets/d/SPREADSHEET_ID/edit#gid=SHEET_ID";function ot(t){let{route:a}=le(),n=oe(null),s=_e(),[m,l]=u(!1),[o,p]=u(s.enabled?"gsheet":"http"),[d,_]=u("map"),[h,D]=u("GET"),[x,I]=u(!1),[S,k]=u("interval"),[V,z]=u(1),[Z,R]=u("hours"),[q,U]=u("09:00"),[K,H]=u("1"),[X,P]=u("09:00"),[Y,L]=u(""),[j,W]=u(B()),[J,$]=u(!1),[Q,b]=u(""),[De,ee]=u(!!t.dataSourceId),[F,te]=u(null),A="";o==="http"?A=we:o==="gsheet"&&(A=Ne);async function xe(r){await de(async()=>{let f=await he(r);if(te(f),p(f?.type||"http"),_(f?.dataFormat||"map"),f?.cron){let i=f.cron,g=i.schedule||"interval";I(i.enabled||!1),k(g),z(i.interval||1),R(i.unit||"hours"),W(i.timezone||B()),g==="daily"?U(ye(i.expression)):g==="weekly"?(P(ye(i.expression)),H(He(i.expression))):g==="custom"&&L(i.expression||""),$(i.autoPublish||!1)}else I(!1),k("interval"),z(1),R("hours"),U("09:00"),H("1"),P("09:00"),L(""),W(B()),$(!1)}),ee(!1)}ne(()=>{t.dataSourceId&&(ee(!0),xe(t.dataSourceId))},[t.dataSourceId]);async function Fe(){b("");let r=n.current;function f(c){let C=r.elements[c];return C?C.value.trim():""}let i=t.dataSourceId||f("id");if(!i){b("missing id");return}if(!ce(i)){b("id is invalid (alphanumeric characters and dashes only)");return}let g=f("url");if(!g){b("missing url");return}let y={id:i,description:f("description"),type:o,url:g,previewUrl:f("previewUrl")};if(o==="http"){if(!Oe(g)){b("invalid url");return}y.httpOptions={method:h};let c=f("httpHeaders");if(c&&(y.httpOptions.headers=Ee(c)),h==="POST"){let C=f("httpBody");C&&(y.httpOptions.body=C)}}else if(o==="gsheet"){if(!me(g)?.spreadsheetId){b("failed to parse spreadsheet url");return}y.dataFormat=d||"map"}let T={enabled:x,schedule:S,autoPublish:x&&J};if(S==="interval")T.interval=V,T.unit=Z;else{let c="";if(S==="daily"?c=Re(q):S==="weekly"?c=Ue(X,K):c=Y.trim(),x&&!Se(c)){b('invalid cron expression (expected 5 fields, e.g. "0 19 * * *")');return}T.expression=c,T.timezone=j}y.cron=T;try{te(y),l(!0),t.dataSourceId?(await fe(t.dataSourceId,y),M({title:"Saved data source",message:`Successfully updated ${i}`,autoClose:5e3}),l(!1)):(await pe(i,y),M({title:"Added data source",message:`Successfully added ${i}`,autoClose:5e3}),l(!1),a(`/cms/data/${i}`))}catch(c){console.error(c),M({title:"Failed to save data source",message:String(c),color:"red",autoClose:!1}),l(!1)}}let ae=[{value:"http",label:"HTTP"}];return(s.enabled||o==="gsheet")&&ae.push({value:"gsheet",label:"Google Sheet"}),e("form",{className:"DataSourceForm",ref:n,onSubmit:r=>{r.preventDefault(),Fe()},children:[e(ie,{visible:De}),e("div",{className:"DataSourceForm__input",children:e(v,{name:"type",label:"Type",data:ae,value:o,onChange:r=>p(r),size:"xs",radius:0,dropdownComponent:"div"})}),e(w,{className:"DataSourceForm__input",name:"id",label:"ID",description:"Unique identifier for the data source. Use alphanumeric characters and dashes only, e.g. grogus-favorite-meals",size:"xs",radius:0,value:t.dataSourceId,disabled:!!t.dataSourceId}),e(E,{className:"DataSourceForm__input",name:"description",label:"Description",description:"Optional.",size:"xs",radius:0,value:F?.description}),e(w,{className:"DataSourceForm__input",name:"url",label:"URL",description:A,size:"xs",radius:0,value:F?.url}),o==="http"&&e(re,{children:[e("div",{className:"DataSourceForm__input",children:e(v,{name:"httpMethod",label:"HTTP Request Method",data:[{value:"GET",label:"GET"},{value:"POST",label:"POST"}],value:h,onChange:r=>D(r),size:"xs",radius:0,dropdownComponent:"div"})}),e(E,{className:"DataSourceForm__input",name:"httpHeaders",label:"HTTP Request Headers",description:"Format as `HeaderName: Value`, each value on its own line.",size:"xs",radius:0,value:Me(F?.httpOptions?.headers||{})}),h==="POST"&&e(E,{className:"DataSourceForm__input",name:"httpRequestBody",label:"HTTP Request Body",size:"xs",radius:0,value:F?.httpOptions?.body})]}),o==="gsheet"&&e("div",{className:"DataSourceForm__input",children:[e(v,{name:"dataFormat",label:"Data Format",data:[{value:"map",label:"map"}],value:d,onChange:r=>_(r),size:"xs",radius:0,dropdownComponent:"div"}),d==="array"&&e("div",{className:"DataSourceForm__input__example",children:["Data is stored as an array of arrays, e.g.",e("code",{children:"[[header1, header2], [foo, bar]]"})]}),d==="map"&&e("div",{className:"DataSourceForm__input__example",children:["Data is stored as an array of maps, e.g.",e("code",{children:["[","{","header1: foo, header2: bar","}","]"]})]})]}),e("div",{className:"DataSourceForm__section",children:[e("div",{className:"DataSourceForm__section__label",children:"Sync Schedule"}),e(G,{className:"DataSourceForm__input",label:"Enable scheduled sync",checked:x,onChange:r=>I(r.currentTarget.checked),size:"xs"}),x&&e("div",{className:"DataSourceForm__cron",children:[e("div",{className:"DataSourceForm__input",children:e(v,{label:"Schedule",data:[{value:"interval",label:"Interval"},{value:"daily",label:"Daily"},{value:"weekly",label:"Weekly"},{value:"custom",label:"Custom (cron expression)"}],value:S,onChange:r=>k(r),size:"xs",radius:0,dropdownComponent:"div"})}),S==="interval"&&e("div",{className:"DataSourceForm__cron__row",children:[e("span",{children:"Run every"}),e(ue,{className:"DataSourceForm__cron__interval",value:V,onChange:r=>z(Number(r)||1),min:1,size:"xs",radius:0}),e(v,{className:"DataSourceForm__cron__unit",data:[{value:"minutes",label:"minutes"},{value:"hours",label:"hours"},{value:"days",label:"days"}],value:Z,onChange:r=>R(r),size:"xs",radius:0,dropdownComponent:"div"})]}),S==="daily"&&e("div",{className:"DataSourceForm__cron__row",children:[e("span",{children:"Run every day at"}),e("input",{type:"time",className:"DataSourceForm__cron__time",value:q,onChange:r=>U(r.target.value)})]}),S==="weekly"&&e("div",{className:"DataSourceForm__cron__row",children:[e("span",{children:"Run every"}),e(v,{className:"DataSourceForm__cron__weekday",data:Ie,value:K,onChange:r=>r&&H(r),size:"xs",radius:0,dropdownComponent:"div"}),e("span",{children:"at"}),e("input",{type:"time",className:"DataSourceForm__cron__time",value:X,onChange:r=>P(r.target.value)})]}),S==="custom"&&e("div",{className:"DataSourceForm__input",children:e(w,{label:"Cron expression",description:'Standard 5-field cron, e.g. "0 19 * * *" runs every day at 7pm, "0 17 * * 5" runs every Friday at 5pm.',placeholder:"0 19 * * *",value:Y,onChange:r=>L(r.target.value),size:"xs",radius:0})}),S!=="interval"&&e("div",{className:"DataSourceForm__input",children:e(v,{label:"Timezone",data:ke,value:j,onChange:r=>r&&W(r),searchable:!0,size:"xs",radius:0,dropdownComponent:"div"})}),e(G,{className:"DataSourceForm__input",label:"Auto-publish after sync",checked:J,onChange:r=>$(r.currentTarget.checked),size:"xs"})]})]}),e(w,{className:"DataSourceForm__input",name:"previewUrl",label:"Preview URL",description:"URL where users can preview the data source.",size:"xs",radius:0,value:F?.previewUrl}),e(se,{className:"DataSourceForm__submit",color:"blue",size:"xs",type:"submit",loading:m,children:t.buttonLabel||"Save"}),Q&&e("div",{className:"DataSourceForm__error",children:["Error: ",Q]})]})}function Oe(t){let a,n=t.startsWith("/")?"http://localhost":void 0;try{a=new URL(t,n)}catch(s){return console.error(s),!1}return a.protocol==="http:"||a.protocol==="https:"}function Ee(t){let a={};return t.split(`
2
+ `).forEach(s=>{let m=s.indexOf(":");if(m===-1)return;let l=s.slice(0,m).trim(),o=s.slice(m+1).trim();l&&o&&(a[l]=o)}),a}function Me(t){let a=[];for(let n in t){let s=t[n];a.push(`${n}: ${s}`)}return a.join(`
3
+ `)}var Ie=[{value:"0",label:"Sunday"},{value:"1",label:"Monday"},{value:"2",label:"Tuesday"},{value:"3",label:"Wednesday"},{value:"4",label:"Thursday"},{value:"5",label:"Friday"},{value:"6",label:"Saturday"}],ke=ze();function ze(){try{return Intl.supportedValuesOf("timeZone")}catch{return["UTC"]}}function B(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function be(t){let[a,n]=(t||"").split(":"),s=ge(parseInt(a,10)||0,0,23),m=ge(parseInt(n,10)||0,0,59);return[s,m]}function ge(t,a,n){return Math.max(a,Math.min(n,t))}function Re(t){let[a,n]=be(t);return`${n} ${a} * * *`}function Ue(t,a){let[n,s]=be(t);return`${s} ${n} * * ${a}`}function ye(t){let a=(t||"").trim().split(/\s+/);if(a.length<2)return"09:00";let n=ve(parseInt(a[0],10)||0);return`${ve(parseInt(a[1],10)||0)}:${n}`}function He(t){let n=(t||"").trim().split(/\s+/)[4];return n==="7"?"0":n&&/^[0-6]$/.test(n)?n:"1"}function ve(t){return String(t).padStart(2,"0")}export{ot as a};
@@ -1 +1 @@
1
- import{e as t}from"./chunk-WASID5UU.js";import{Fa as l,Ga as i}from"./chunk-WRA24P66.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-GJ7ES2LA.js";import{Fa as l,fd as i}from"./chunk-Y7RYSRP7.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};
@@ -0,0 +1 @@
1
+ import{c as Ne}from"./chunk-B74M7NEV.js";import{b as He}from"./chunk-YIKHJONY.js";import{a as Ce,b as J,c as U}from"./chunk-JDW4UORS.js";import{a as H,c as L}from"./chunk-XYXL5HSZ.js";import{b as de}from"./chunk-5MV6XVGA.js";import{a as oe}from"./chunk-LS2JH5QF.js";import{b as we}from"./chunk-U5OXKKBN.js";import{a as Z}from"./chunk-ZYSR5UIW.js";import{a as y}from"./chunk-HWON6MV4.js";import{N as Me,O as Se,P as Ie,S as le,T as ke,U as Te,b as De}from"./chunk-ISUGBMXC.js";import{b as xe,f as Pe}from"./chunk-DZYYWCHX.js";import{B as ee,z as ae}from"./chunk-XOWWPE7X.js";import{d as be,e as z}from"./chunk-GJ7ES2LA.js";import{Cb as Ae,Cc as $e,Da as ye,Fa as O,Pa as Be,V as Q,W as se,a as f,ba as Y,c as M,da as D,e as V,ea as re,fd as e,i as ge,j as $,la as _e,mc as Ve,ob as Re,ua as he,xa as E,za as ve}from"./chunk-Y7RYSRP7.js";import{d as A,j as pe,k as Je}from"./chunk-KUCVLANF.js";Je();$();var Le=pe(null);function vo(o){let[t,i]=f([]),[n,s]=f(!1),l=V("idle");function c(){l.current==="idle"&&(l.current="fetching",s(!0),Ne().then(d=>{let a=d.filter(g=>!g.publishedAt&&!g.archivedAt);i(a)}).catch(d=>{console.error("Failed to fetch pending releases:",d)}).finally(()=>{l.current="done",s(!1)}))}function m(d){return t.filter(a=>a.docIds?.includes(d))}return e(Le.Provider,{value:{releases:t,getReleasesForDoc:m,loading:n,fetchReleases:c},children:o.children})}function ze(){let o=ge(Le);if(!o)throw new Error("usePendingReleases must be used within a <PendingReleasesProvider>");let{fetchReleases:t,...i}=o;return M(()=>{t()},[]),i}var Ee="CompareDraftModal";function Oe(o){let t=null;try{t=H()}catch{t=null}let i=L();return{enabled:t!==null,open:()=>{if(!t){console.warn("useCompareDraftModal() requires a <ModalsProvider> context.");return}t.openContextModal(Ee,{...i,title:`Unpublished changes: ${o.docId}`,innerProps:o,overflow:"inside",size:"min(calc(100% - 32px), 900px)"})}}}function eo(o){let{innerProps:t}=o,i=t.docId;return e("div",{className:"CompareDraftModal",children:e(He,{className:"CompareDraftModal__diff",left:{docId:i,versionId:"published"},right:{docId:i,versionId:"draft"},showExpandButton:!0,showAiSummary:!1})})}eo.id=Ee;function F(o){let{heading:t,message:i,detail:n,user:s}=o;return e(O,{label:e("div",{className:"UserActionTooltip",children:[s&&e(oe,{email:s,size:20,withTooltip:!1}),e("div",{className:"UserActionTooltip__text",children:[t&&e("span",{className:"UserActionTooltip__heading",children:t}),e("span",{children:i}),n&&e("span",{className:"UserActionTooltip__detail",children:n}),s&&e("span",{children:["by ",s]})]})]}),position:o.position,transition:o.transition??"pop",withArrow:o.withArrow??!0,children:o.children})}function ce(o){let i=window.__ROOT_CTX.collections[o.collectionId];if(!i)throw new Error(`collection not found: ${o.collectionId}`);if(!i.url)return"";let n=i.domain||window.__ROOT_CTX.rootConfig.domain||"https://example.com",s=oo(o);return`${n}${s}`}function oo(o){let t=window.__ROOT_CTX.collections,{collectionId:i,slug:n,locale:s}=o,l=t[i];if(!l)throw new Error(`collection not found: ${i}`);if(!l.url)return"";let c=window.__ROOT_CTX.rootConfig,m=c.base||"/",d="/[base]/[path]";s&&(d=c.i18n.urlFormat||"/[locale]/[base]/[path]");let a="",g=l?.url;if(g)if(n){let _=g.replace(/\[.*slug\]/,n).replaceAll("--","/").replace(/\/+/g,"/");_==="/index"&&(_="/"),a=_}else a=g;return Ue(d,{base:m,path:a,locale:s||"",slug:n})}function Ho(o){let t=window.__ROOT_CTX.collections,{collectionId:i,slug:n,locale:s}=o,l=t[i];if(!l)throw new Error(`collection not found: ${i}`);let c=window.__ROOT_CTX.rootConfig,m=c.base||"/",d="/[base]/[path]";s&&(d=c.i18n.urlFormat||"/[locale]/[base]/[path]");let a="",g=l?.previewUrl||l?.url;if(g)if(n){let _=g.replace(/\[.*slug\]/,n).replaceAll("--","/").replace(/\/+/g,"/");_==="/index"&&(_="/"),a=_}else a=g;return Ue(d,{base:m,path:a,locale:s||"",slug:n})}function Ue(o,t){let i=o.replaceAll(/\[\[?(\.\.\.)?([\w\-_]*)\]?\]/g,(n,s,l)=>t[l]??n);return to(i,{trailingSlash:window.__ROOT_CTX.rootConfig.server.trailingSlash})}function to(o,t){return o=o.replace(/\/+/g,"/"),t?.trailingSlash===!1&&o!=="/"&&o.endsWith("/")&&(o=o.replace(/\/*$/g,"")),(o.endsWith("/index")||o.endsWith("/index/"))&&(o=o.slice(0,-6)),o.startsWith("/")||(o=`/${o}`),t?.trailingSlash&&!o.endsWith("/")&&(o=`${o}/`),o}$();$();function Fe(o){let[t,i]=f(o.collectionId||""),n=V(null),[s,l]=f(o.initialSlug||""),c=window.__ROOT_CTX.collections[t],m=[];o.collectionId&&o.collectionDisabled?m.push({value:o.collectionId,label:o.collectionId}):Object.keys(window.__ROOT_CTX.collections).forEach(u=>{m.push({value:u,label:u})});let d="",a="";if(c?.url){if(s){let u=U(s),p=c?.slugRegex;Ce(u,p)?d=ce({collectionId:t,slug:u}):a=J(u,p)}else d=ce({collectionId:t,slug:"[slug]"});d.endsWith("/index")&&(d=d.replace(/\/index$/,"/"))}function g(u){i(u),o.onChange&&o.onChange({collectionId:u,slug:s})}function _(u){l(u),o.onChange&&o.onChange({collectionId:t,slug:u})}return e("div",{className:z(o.className,"SlugInput"),children:[e("div",{className:"SlugInput__inputs",children:[e(ve,{className:"SlugInput__collection",placeholder:"Collection",size:"xs",data:m,onChange:u=>g(u),value:t,disabled:!!o.collectionDisabled}),e("div",{className:"SlugInput__divider",children:"/"}),e(he,{className:"SlugInput__slug",name:"slug",ref:n,value:s,onChange:u=>{_(u.currentTarget.value)},placeholder:"slug",autoComplete:"off",size:"xs"})]}),d&&e(y,{className:"SlugInput__urlHelp",size:"body-sm",children:d}),a&&e(y,{className:"SlugInput__slugError",size:"body-sm",children:a})]})}var Xe="CopyDocModal";function Ke(o){let t=H(),i=L();return{open:n=>{t.openContextModal(Xe,{...i,innerProps:{...o,...n}})}}}function io(o){let{innerProps:t,context:i,id:n}=o,{route:s}=be(),[l,c]=f(""),[m,d]=f(""),[a,g]=f(""),[_,u]=f(""),[p,x]=f(!1),[K,S]=f(!1),[k,T]=f({}),C=t.fromDocId,W=C.split("/")[0],N=t.fromLabel||C;M(()=>{xe({tags:[C]}).then(T)},[C]);function j(v,q){let P=U(v),w=window.__ROOT_CTX.collections[q]?.slugRegex;return P?J(P,w):""}async function te(v){if(v.preventDefault(),S(!0),u(""),!W){u("Please select a collection."),S(!1);return}if(j(m,l)){S(!1);return}let P=U(m),w=`${l}/${P}`;try{t.fields?await Ie(w,{fields:t.fields,overwrite:p}):await Se(C,w,{overwrite:p});let I=Object.keys(k);if(I.length>0){let r=I.map(h=>({hash:h,tags:[w]}));await Pe(r,{mode:"union"})}i.closeModal(n);let B=`/cms/content/${l}/${P}`;Z({title:"Copied!",message:e("div",{children:[e("div",{children:`Successfully copied ${N} to ${w}.`}),e(D,{className:"CopyDocModal__notificationButton",component:"a",href:B,size:"xs",compact:!0,variant:"default",children:"Open doc"})]}),autoClose:1e4}),t.onSuccess&&t.onSuccess(w)}catch(I){let B=String(I);u(B),B.includes("already exists")&&x(!0),S(!1);return}S(!1),s(`/cms/content/${l}/${P}`)}return e("div",{className:"CopyDocModal",children:e("form",{onSubmit:v=>te(v),children:[e("div",{className:"CopyDocModal__from",children:[e(y,{className:"CopyDocModal__from__label",size:"body",weight:"bold",children:"From:"}),e(y,{className:"CopyDocModal__from__value",size:"body-sm",children:e("code",{children:N})})]}),e("div",{className:"CopyDocModal__to",children:[e(y,{className:"CopyDocModal__to__label",size:"body",weight:"bold",children:"To:"}),e(Fe,{className:"CopyDocModal__slug",collectionId:W,onChange:v=>{c(v.collectionId),d(v.slug),g(j(v.slug,v.collectionId)),u(""),x(!1)}})]}),_&&e("div",{className:"CopyDocModal__error",children:_}),e("div",{className:"CopyDocModal__buttons",children:[e(D,{variant:"outline",onClick:()=>i.closeModal(n),type:"button",size:"xs",color:"dark",children:"Cancel"}),e(D,{variant:"filled",type:"submit",size:"xs",color:"dark",loading:K,disabled:!!a||!!_&&!p,children:p?"Overwrite?":"Submit"})]})]})})}io.id=Xe;$();var qe="VersionHistoryModal",We=50;function Ge(o){let t=null;try{t=H()}catch{t=null}let i=L();return{enabled:t!==null,open:()=>{if(!t){console.warn("useVersionHistoryModal() requires a <ModalsProvider> context.");return}t.openContextModal(qe,{...i,title:`Version history: ${o.docId}`,innerProps:o,overflow:"inside",size:"min(calc(100% - 32px), 720px)"})}}}function no(o){let{innerProps:t,context:i,id:n}=o,s=t.docId,[l,c]=f(!0),[m,d]=f(!1),[a,g]=f([]),[_,u]=f(!1),[p,x]=f([]),[K,S]=f(!1),[k,T]=f(null),C=V(null),W=Ke({fromDocId:s}),N=new Intl.DateTimeFormat("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"});async function j(){c(!0);let[r,h]=await Promise.all([le(s,{limit:We}),Te(s,"draft")]);C.current=r.lastDoc,u(r.hasMore);let b={_versionId:"draft",sys:{modifiedAt:h?.sys?.modifiedAt||{toDate:()=>new Date},modifiedBy:h?.sys?.modifiedBy||"Unknown"}};g([b,...r.versions]),x(["draft"]),c(!1)}async function te(){if(!_||m)return;d(!0);let r=await le(s,{limit:We,cursor:C.current});C.current=r.lastDoc,u(r.hasMore),g(h=>[...h,...r.versions]),d(!1)}async function v(r){await ke(s,r),Z({title:"Saved!",message:`Restored ${s} to ${N.format(r.sys.modifiedAt.toDate())}.`,autoClose:5e3}),t.onRestore&&t.onRestore({version:r})}function q(r){let h=`${s}@${r._versionId}`,b=r.sys?.modifiedAt?.toDate();if(b){let R=so(b);h=`${s}@${R}`}W.open({fields:r.fields||{},fromLabel:h,onSuccess:()=>{i.closeModal(n)}})}function P(r){p.includes(r)?x(p.filter(h=>h!==r)):p.length<2&&x([...p,r])}function w(){if(p.length!==2)return"#";let r=a.find(ne=>ne._versionId===p[0]),h=a.find(ne=>ne._versionId===p[1]);if(!r||!h)return"#";let b=a.indexOf(r),R=a.indexOf(h),me=b>R?r:h,G=b>R?h:r,ie=je(s,me._versionId),Ze=je(s,G._versionId);return`/cms/compare?left=${ie}&right=${Ze}`}M(()=>{j()},[]);let I=a.filter(r=>r._versionId==="draft"||!K?!0:r.tags?.includes("published")),B=a.some(r=>r.tags?.includes("published"));return l?e(Q,{}):e("div",{className:"VersionHistoryModal",children:[e("div",{className:"VersionHistoryModal__actions",children:[e(D,{component:p.length===2?"a":"button",variant:"filled",size:"xs",disabled:p.length!==2,href:p.length===2?w():void 0,target:p.length===2?"_blank":void 0,rightIcon:e(Be,{size:16}),children:"Compare"}),B&&e(re,{size:"xs",label:"Published versions only",checked:K,onChange:r=>S(r.currentTarget.checked)})]}),I.length===0?e(y,{className:"VersionHistoryModal__versionsEmpty",size:"body",children:[e("p",{children:"No versions found."}),e("p",{className:"VersionHistoryModal__versionsEmpty__developer",children:"For developers: Configure the Root CMS cron job to populate versions."})]}):e(A,{children:[e(ye,{className:"VersionHistoryModal__versions",children:[e("thead",{children:e("tr",{children:[e("th",{children:e("span",{className:"VersionHistoryModal__versions__selectLabel",children:"Select"})}),e("th",{children:"modified at"}),e("th",{children:"modified by"}),e("th",{children:"actions"})]})}),e("tbody",{children:I.map(r=>{let h=r._versionId==="draft",b=p.includes(r._versionId),R=!b&&p.length>=2;return e("tr",{children:[e("td",{children:e(re,{size:"xs",checked:b,disabled:R,onChange:()=>P(r._versionId),className:"VersionHistoryModal__versions__checkbox"})}),e("td",{children:e("div",{className:"VersionHistoryModal__versions__modifiedAt",children:[e(y,{size:"body-sm",className:"VersionHistoryModal__versions__modifiedAt__text",children:h?e("span",{title:"Current Draft",children:[N.format(r.sys.modifiedAt.toDate())," ","(Latest)"]}):e(A,{children:[N.format(r.sys.modifiedAt.toDate()),r.tags?.includes("published")&&e("span",{className:"VersionHistoryModal__publishedLabel",children:"(Published)"})]})}),r.publishMessage&&e(E,{withCloseButton:!0,opened:k===`${r._versionId}-message`,onClose:()=>T(null),position:"right",withArrow:!0,shadow:"md",width:320,classNames:{body:"VersionHistoryModal__popover__body",arrow:"VersionHistoryModal__popover__arrow",close:"VersionHistoryModal__popover__close"},target:e(se,{size:"xs",variant:"light",className:"VersionHistoryModal__messageIcon",onClick:()=>T(k===`${r._versionId}-message`?null:`${r._versionId}-message`),children:e(Ve,{size:18})}),children:e("div",{className:"VersionHistoryModal__message",children:r.publishMessage})}),(()=>{let G=r.tags?.find(ie=>ie.startsWith("release:"))?.replace("release:","");return G&&e(E,{withCloseButton:!0,opened:k===`${r._versionId}-release`,onClose:()=>T(null),position:"right",withArrow:!0,shadow:"md",width:320,target:e(se,{size:"xs",variant:"light",className:"VersionHistoryModal__messageIcon",onClick:()=>T(k===`${r._versionId}-release`?null:`${r._versionId}-release`),children:e($e,{size:18})}),children:e("div",{className:"VersionHistoryModal__message",children:[e("strong",{children:"Release:"})," ",G]})})})()]})}),e("td",{children:e(y,{size:"body-sm",children:r.sys.modifiedBy})}),e("td",{children:e("div",{className:"VersionHistoryModal__versions__buttons",children:!h&&e(A,{children:[e(D,{variant:"default",size:"xs",compact:!0,onClick:()=>v(r),children:"restore"}),e(D,{variant:"default",size:"xs",compact:!0,onClick:()=>q(r),leftIcon:e(Re,{size:12}),children:"copy to doc"})]})})})]},r._versionId)})})]}),_&&e("div",{className:"VersionHistoryModal__loadMore",children:e(D,{variant:"subtle",size:"xs",loading:m,onClick:te,children:"Load more versions"})})]})]})}function je(o,t){return encodeURIComponent(`${o}@${t}`).replaceAll("%2F","/").replaceAll("%40","@")}function so(o){let t=o.getFullYear(),i=String(o.getMonth()+1).padStart(2,"0"),n=String(o.getDate()).padStart(2,"0"),s=String(o.getHours()).padStart(2,"0"),l=String(o.getMinutes()).padStart(2,"0");return`${t}-${i}-${n}T${s}:${l}`}no.id=qe;$();var fe={draft:{from:"indigo",to:"cyan"},published:{from:"teal",to:"lime",deg:105},scheduled:{from:"grape",to:"pink",deg:35},locked:{from:"orange",to:"red"},archived:{from:"gray",to:"dark"},release:{from:"violet",to:"grape"}};function X(o){let{tone:t,children:i,className:n,leftSection:s,...l}=o;return e(Y,{size:"sm",variant:"gradient",gradient:fe[t],leftSection:s,classNames:{root:ro("DocStatusBadges__badge",`DocStatusBadges__badge--${t}`,n),inner:"DocStatusBadges__badge__inner",leftSection:"DocStatusBadges__badge__leftSection"},...l,children:i})}function ro(...o){return o.filter(Boolean).join(" ")}function Qe(o){let t={transition:"pop"},i=o.doc,n=i.sys,s=Ge({docId:o.docId||i.id}),l=Oe({docId:o.docId||i.id}),c=s.enabled?()=>s.open():void 0,m=!!n.publishedAt&&!!n.modifiedAt&&n.modifiedAt>n.publishedAt,d=m&&l.enabled?()=>l.open():c;return e("div",{className:"DocStatusBadges",children:[(!n.publishedAt||!n.modifiedAt||n.modifiedAt>n.publishedAt)&&e(F,{position:o.tooltipPosition,heading:m?"Unpublished changes":void 0,message:`Modified ${ue(n.modifiedAt)}`,user:n.modifiedBy,children:e(X,{tone:"draft",className:d?"DocStatusBadges__badge--clickable":void 0,style:d?{cursor:"pointer"}:void 0,role:d?"button":void 0,tabIndex:d?0:void 0,onClick:d?a=>{a.preventDefault(),a.stopPropagation(),d()}:void 0,onKeyDown:d?a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),d())}:void 0,children:"Draft"})}),!!n.publishedAt&&e(F,{position:o.tooltipPosition,message:`Published ${ue(n.publishedAt??null)}`,user:n.publishedBy,children:e(X,{tone:"published",className:c?"DocStatusBadges__badge--clickable":void 0,style:c?{cursor:"pointer"}:void 0,role:c?"button":void 0,tabIndex:c?0:void 0,onClick:c?a=>{a.preventDefault(),a.stopPropagation(),c()}:void 0,onKeyDown:c?a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),c())}:void 0,children:"Published"})}),!!n.scheduledAt&&e(F,{position:o.tooltipPosition,message:`Scheduled ${ee(n.scheduledAt)}`,user:n.scheduledBy,children:e(X,{tone:"scheduled",children:"Scheduled"})}),!o.hideReleases&&e(lo,{docId:o.docId||i.id,tooltipProps:t}),Me(i)&&e(O,{position:o.tooltipPosition,transition:"pop",withArrow:!0,width:260,wrapLines:!0,label:e(ao,{doc:i}),children:e(X,{tone:"locked",className:o.onPublishingLockClick?"DocStatusBadges__badge--clickable":void 0,style:o.onPublishingLockClick?{cursor:"pointer"}:void 0,role:o.onPublishingLockClick?"button":void 0,tabIndex:o.onPublishingLockClick?0:void 0,"aria-label":"Locked",onClick:o.onPublishingLockClick,onKeyDown:o.onPublishingLockClick?a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),o.onPublishingLockClick())}:void 0,children:"Locked"})}),!!n.archivedAt&&e(F,{position:o.tooltipPosition,message:`Archived ${ue(n.archivedAt)}`,user:n.archivedBy,children:e(X,{tone:"archived",children:"Archived"})})]})}function ao(o){let t=o.doc.sys?.publishingLocked;return t?e("div",{className:"DocStatusBadges__lockTooltip",children:[e("div",{className:"DocStatusBadges__lockTooltip__top",children:[t.lockedBy&&e(oe,{email:t.lockedBy,size:20,withTooltip:!1}),e("div",{className:"DocStatusBadges__lockTooltip__topText",children:[e("div",{className:"DocStatusBadges__lockTooltip__line",children:["Locked by ",t.lockedBy]}),t.until&&e("div",{className:"DocStatusBadges__lockTooltip__line",children:["Until ",ee(t.until)]})]})]}),t.reason&&e(A,{children:[e("div",{className:"DocStatusBadges__lockTooltip__divider"}),e("div",{className:"DocStatusBadges__lockTooltip__line",children:"Reason:"}),e("div",{className:"DocStatusBadges__lockTooltip__reason",children:t.reason})]})]}):null}function Et(o){let t=o.sys?.publishingLocked;return t?t.until?`Locked until ${ee(t.until)} by ${t.lockedBy}: "${t.reason}"`:`Locked by ${t.lockedBy}: "${t.reason}"`:""}function lo(o){let{getReleasesForDoc:t}=ze(),i=t(o.docId);if(i.length===0)return null;if(i.length>1)return e(co,{releases:i});let n=i[0];return e(O,{...o.tooltipProps,label:`In release: ${n.id}`,children:e(Y,{component:"a",href:`/cms/releases/${n.id}`,size:"sm",variant:"gradient",gradient:fe.release,classNames:{root:"DocStatusBadges__badge DocStatusBadges__badge--release DocStatusBadges__releaseBadge",inner:"DocStatusBadges__badge__inner DocStatusBadges__releaseBadge__inner"},style:{cursor:"pointer"},children:n.id})})}function co(o){let[t,i]=f(!1),n=o.releases;return e(E,{opened:t,onClose:()=>i(!1),withArrow:!0,withCloseButton:!1,position:"bottom",placement:"center",spacing:4,width:220,target:e(Y,{size:"sm",variant:"gradient",gradient:fe.release,classNames:{root:"DocStatusBadges__badge DocStatusBadges__badge--release DocStatusBadges__releaseBadge DocStatusBadges__badge--clickable",inner:"DocStatusBadges__badge__inner DocStatusBadges__releaseBadge__inner"},style:{cursor:"pointer"},role:"button",tabIndex:0,"aria-label":`${n.length} releases`,onClick:s=>{s.preventDefault(),s.stopPropagation(),i(l=>!l)},onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),i(l=>!l))},children:[n.length," releases"]}),children:e("div",{className:"DocStatusBadges__releaseList",children:[e("div",{className:"DocStatusBadges__releaseList__title",children:"In releases"}),n.map(s=>e("a",{className:"DocStatusBadges__releaseList__item",href:`/cms/releases/${s.id}`,children:s.id},s.id))]})})}function ue(o){return o?ae(o.toMillis()):ae(new Date().getTime())}function Ye(o){let{file:t,width:i,height:n,withPlaceholder:s,className:l,alt:c}=o,m=typeof t=="string"?t:t?.src;return uo(t)?e(fo,{className:l,src:m,width:i,height:n}):e(_e,{className:l,src:m,width:i,height:n,withPlaceholder:s,alt:c})}function uo(o){if(!o)return!1;if(typeof o=="string")return/\.mp4($|\?)/i.test(o);if(typeof o.mimeType=="string")return o.mimeType.toLowerCase()==="video/mp4";let t=o.src;return typeof t!="string"?!1:/\.mp4($|\?)/i.test(t)}function fo(o){return e("video",{className:o.className,src:o.src,width:o.width,height:o.height,muted:!0,playsInline:!0,preload:"metadata",style:{width:`${o.width}px`,height:`${o.height}px`,backgroundColor:"#f1f3f5",objectFit:"cover",display:"block"}})}$();function ni(o){let t=o.docId,[i,n]=f(o.doc),[s,l]=f(!o.doc);async function c(){l(!0),await we(async()=>{let x=await De(t);n(x)}),l(!1)}if(M(()=>{c()},[t]),s)return e("div",{className:z(o.className,"DocPreviewCard","DocPreviewCard--loading",o.variant&&`DocPreviewCard--${o.variant}`),children:e(Q,{color:"gray",size:"sm"})});if(!i)return e("div",{className:z(o.className,"DocPreviewCard","DocPreviewCard--notfound",o.variant&&`DocPreviewCard--${o.variant}`),children:[e("div",{className:"DocPreviewCard__notfound__icon",children:e(Ae,{size:24,stroke:1.5})}),e("div",{className:"DocPreviewCard__content",children:[e("div",{className:"DocPreviewCard__content__header",children:e("div",{className:"DocPreviewCard__content__header__docId",children:t})}),e("div",{className:"DocPreviewCard__notfound__message",children:"Doc not found (was it deleted or archived?)"})]})]});let[m]=t.split("/"),d=i.fields||{},a=window.__ROOT_CTX.collections[m];if(!a)return console.error(`could not find collection: ${m}`),e("div",{className:"DocPreviewCard",children:["Collection ",e("b",{children:m})," not found."]});let g=de(d,a.preview?.title||"meta.title"),_=de(d,a.preview?.image||"meta.image")||a.preview?.defaultImage,u="div",p={};return o.clickable&&(u="a",p.href=`/cms/content/${o.docId}`,p.target="_blank"),e(u,{className:z(o.className,"DocPreviewCard",o.variant&&`DocPreviewCard--${o.variant}`),...p,children:[e("div",{className:"DocPreviewCard__image",children:e(Ye,{file:_,width:80,height:60,withPlaceholder:!_?.src})}),e("div",{className:"DocPreviewCard__content",children:[e("div",{className:"DocPreviewCard__content__header",children:e("div",{className:"DocPreviewCard__content__header__docId",children:i.id})}),e("div",{className:"DocPreviewCard__content__title",children:g||"[UNTITLED]"}),o.statusBadges&&i&&e("div",{className:"DocPreviewCard__content__badges",children:e(Qe,{doc:i,hideReleases:o.hideReleases})})]})]})}export{vo as a,ze as b,eo as c,F as d,ce as e,oo as f,Ho as g,Fe as h,Ke as i,io as j,Ge as k,no as l,Qe as m,Et as n,Ye as o,ni as p};
@@ -1 +1 @@
1
- import{a as b,c as w}from"./chunk-QRAFYIAW.js";import{a as p}from"./chunk-PIJ3E47R.js";import{a}from"./chunk-NCZD5IWS.js";import{b as z,f as I,g as C}from"./chunk-DZYYWCHX.js";import{Fc as N,Ga as n,V as v,a as c,c as y,da as m,j as L}from"./chunk-WRA24P66.js";import{d as M}from"./chunk-KUCVLANF.js";L();var S="PruneTranslationsModal";function W(){let u=b(),o=w();return{open:r=>{u.openContextModal(S,{...o,title:`Prune unused strings from ${r.docId}`,innerProps:r,size:600})}}}function $(u){let{innerProps:o,context:r,id:f}=u,[l,h]=c(!0),[e,k]=c([]),[E,x]=c(!1);y(()=>{let s=!1;async function d(){let t=o.docId,g=await z({tags:[t]}),H=new Set(await Promise.all(o.sourceStrings.map(i=>C(i)))),T=[];for(let[i,P]of Object.entries(g))if(!H.has(i)){let _=P.tags||[];_.includes(t)&&T.push({hash:i,source:P.source||i,tags:_.filter(B=>B!==t)})}s||(k(T),h(!1))}return d().catch(t=>{console.error(t),s||h(!1)}),()=>{s=!0}},[o.docId,o.sourceStrings]);async function U(){if(e.length!==0){x(!0);try{let s=e.map(({hash:t,tags:g})=>({hash:t,tags:g}));await I(s,{mode:"replace"});let d=e.map(t=>t.hash);p({title:"Pruned translations",message:`Removed "${o.docId}" tag from ${d.length} unused translation(s).`,color:"green",autoClose:5e3}),o.onPruned?.(d),r.closeModal(f)}catch(s){console.error(s),p({title:"Error pruning translations",message:String(s),color:"red",autoClose:!1})}finally{x(!1)}}}return n("div",{className:"PruneTranslationsModal",children:[n("div",{className:"PruneTranslationsModal__description",children:n(a,{size:"body",children:["Pruning removes the ",n("strong",{children:o.docId})," tag from translation strings that are no longer referenced by this document. The translations themselves are not deleted and will remain available to other documents that still reference them."]})}),l&&n("div",{className:"PruneTranslationsModal__loading",children:[n(v,{color:"gray",size:"sm"}),n(a,{size:"body",color:"gray",children:"Scanning for unused strings\u2026"})]}),!l&&e.length===0&&n("div",{className:"PruneTranslationsModal__empty",children:n(a,{size:"body",color:"gray",children:['All translations tagged with "',o.docId,'" are still in use. Nothing to prune.']})}),!l&&e.length>0&&n(M,{children:[n(a,{size:"body",weight:"semi-bold",children:[e.length," unused string",e.length!==1?"s":""," will be untagged:"]}),n("div",{className:"PruneTranslationsModal__list",children:e.map(s=>n("div",{className:"PruneTranslationsModal__list__item",children:n(a,{size:"body-sm",children:s.source})},s.hash))})]}),n("div",{className:"PruneTranslationsModal__actions",children:[n(m,{variant:"default",size:"xs",onClick:()=>r.closeModal(f),children:"Cancel"}),n(m,{variant:"filled",size:"xs",color:"red",leftIcon:n(N,{size:14}),loading:E,disabled:l||e.length===0,onClick:U,children:["Prune ",e.length>0?e.length:""," string",e.length!==1?"s":""]})]})]})}$.id=S;export{W as a,$ as b};
1
+ import{a as b,c as w}from"./chunk-XYXL5HSZ.js";import{a as p}from"./chunk-ZYSR5UIW.js";import{a}from"./chunk-HWON6MV4.js";import{b as z,f as I,g as C}from"./chunk-DZYYWCHX.js";import{Fc as N,V as v,a as c,c as y,da as m,fd as n,j as L}from"./chunk-Y7RYSRP7.js";import{d as M}from"./chunk-KUCVLANF.js";L();var S="PruneTranslationsModal";function W(){let u=b(),o=w();return{open:r=>{u.openContextModal(S,{...o,title:`Prune unused strings from ${r.docId}`,innerProps:r,size:600})}}}function $(u){let{innerProps:o,context:r,id:f}=u,[l,h]=c(!0),[e,k]=c([]),[E,x]=c(!1);y(()=>{let s=!1;async function d(){let t=o.docId,g=await z({tags:[t]}),H=new Set(await Promise.all(o.sourceStrings.map(i=>C(i)))),T=[];for(let[i,P]of Object.entries(g))if(!H.has(i)){let _=P.tags||[];_.includes(t)&&T.push({hash:i,source:P.source||i,tags:_.filter(B=>B!==t)})}s||(k(T),h(!1))}return d().catch(t=>{console.error(t),s||h(!1)}),()=>{s=!0}},[o.docId,o.sourceStrings]);async function U(){if(e.length!==0){x(!0);try{let s=e.map(({hash:t,tags:g})=>({hash:t,tags:g}));await I(s,{mode:"replace"});let d=e.map(t=>t.hash);p({title:"Pruned translations",message:`Removed "${o.docId}" tag from ${d.length} unused translation(s).`,color:"green",autoClose:5e3}),o.onPruned?.(d),r.closeModal(f)}catch(s){console.error(s),p({title:"Error pruning translations",message:String(s),color:"red",autoClose:!1})}finally{x(!1)}}}return n("div",{className:"PruneTranslationsModal",children:[n("div",{className:"PruneTranslationsModal__description",children:n(a,{size:"body",children:["Pruning removes the ",n("strong",{children:o.docId})," tag from translation strings that are no longer referenced by this document. The translations themselves are not deleted and will remain available to other documents that still reference them."]})}),l&&n("div",{className:"PruneTranslationsModal__loading",children:[n(v,{color:"gray",size:"sm"}),n(a,{size:"body",color:"gray",children:"Scanning for unused strings\u2026"})]}),!l&&e.length===0&&n("div",{className:"PruneTranslationsModal__empty",children:n(a,{size:"body",color:"gray",children:['All translations tagged with "',o.docId,'" are still in use. Nothing to prune.']})}),!l&&e.length>0&&n(M,{children:[n(a,{size:"body",weight:"semi-bold",children:[e.length," unused string",e.length!==1?"s":""," will be untagged:"]}),n("div",{className:"PruneTranslationsModal__list",children:e.map(s=>n("div",{className:"PruneTranslationsModal__list__item",children:n(a,{size:"body-sm",children:s.source})},s.hash))})]}),n("div",{className:"PruneTranslationsModal__actions",children:[n(m,{variant:"default",size:"xs",onClick:()=>r.closeModal(f),children:"Cancel"}),n(m,{variant:"filled",size:"xs",color:"red",leftIcon:n(N,{size:14}),loading:E,disabled:l||e.length===0,onClick:U,children:["Prune ",e.length>0?e.length:""," string",e.length!==1?"s":""]})]})]})}$.id=S;export{W as a,$ as b};
@@ -1 +1 @@
1
- import{$c as r,Ga as o,Qc as c}from"./chunk-WRA24P66.js";function m(e){let a=e.size??36,t=Math.round(a*.55),n=e.className?`DataSourceIcon ${e.className}`:"DataSourceIcon";return o("div",{className:n,style:{width:`${a}px`,height:`${a}px`},children:e.type==="gsheet"?o(c,{size:t,stroke:1.5}):o(r,{size:t,stroke:1.5})})}export{m as a};
1
+ import{$c as r,Qc as c,fd as o}from"./chunk-Y7RYSRP7.js";function m(e){let a=e.size??36,t=Math.round(a*.55),n=e.className?`DataSourceIcon ${e.className}`:"DataSourceIcon";return o("div",{className:n,style:{width:`${a}px`,height:`${a}px`},children:e.type==="gsheet"?o(c,{size:t,stroke:1.5}):o(r,{size:t,stroke:1.5})})}export{m as a};
@@ -1 +1 @@
1
- import{b as j,d as B,e as a,g as O,i as U,j as q}from"./chunk-WRA24P66.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
+ import{b as j,d as B,e as a,g as O,i as U,j as q}from"./chunk-Y7RYSRP7.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{e as u}from"./chunk-WASID5UU.js";import{Ga as m,a as l,c as P,g as p,j as h,wa as f}from"./chunk-WRA24P66.js";h();function $(t,i){let{pageSize:n,resetDeps:o}=i,[s,r]=l(1),e=t.length,a=Math.max(1,Math.ceil(e/n)),g=Math.min(Math.max(s,1),a);P(()=>{r(1)},o??[]);let b=p(()=>{let c=(g-1)*n;return t.slice(c,c+n)},[t,g,n]),d=e===0?0:(g-1)*n+1,x=Math.min(g*n,e);return{page:g,setPage:r,totalPages:a,pageItems:b,totalItems:e,start:d,end:x}}function T(t){return t.total<=1?null:m("div",{className:u(t.className,"Pagination"),children:m(f,{total:t.total,value:t.page,onChange:t.onChange,size:"sm"})})}function z(t){let{start:i,end:n,total:o,noun:s,note:r}=t,e=o===1?s:`${s}s`,a;return o===0?a=`No ${s}s`:i===n?a=`Showing ${i} of ${o} ${e}`:a=`Showing ${i}\u2013${n} of ${o} ${e}`,m("div",{className:u(t.className,"Pagination__summary"),children:[a,r?` (${r})`:""]})}export{$ as a,T as b,z as c};
1
+ import{e as u}from"./chunk-GJ7ES2LA.js";import{a as l,c as P,fd as m,g as p,j as h,wa as f}from"./chunk-Y7RYSRP7.js";h();function $(t,i){let{pageSize:n,resetDeps:o}=i,[s,r]=l(1),e=t.length,a=Math.max(1,Math.ceil(e/n)),g=Math.min(Math.max(s,1),a);P(()=>{r(1)},o??[]);let b=p(()=>{let c=(g-1)*n;return t.slice(c,c+n)},[t,g,n]),d=e===0?0:(g-1)*n+1,x=Math.min(g*n,e);return{page:g,setPage:r,totalPages:a,pageItems:b,totalItems:e,start:d,end:x}}function T(t){return t.total<=1?null:m("div",{className:u(t.className,"Pagination"),children:m(f,{total:t.total,value:t.page,onChange:t.onChange,size:"sm"})})}function z(t){let{start:i,end:n,total:o,noun:s,note:r}=t,e=o===1?s:`${s}s`,a;return o===0?a=`No ${s}s`:i===n?a=`Showing ${i} of ${o} ${e}`:a=`Showing ${i}\u2013${n} of ${o} ${e}`,m("div",{className:u(t.className,"Pagination__summary"),children:[a,r?` (${r})`:""]})}export{$ as a,T as b,z as c};
@@ -1 +1 @@
1
- import{c as x,n as y}from"./chunk-XOWWPE7X.js";import{a as d,c as g,j as R}from"./chunk-WRA24P66.js";var v=3600*1e3,p=new Map,P=new Map,h=new Set;function A(e){return e.trim().toLowerCase()}function E(e){let r=p.get(e);if(r){if(Date.now()-r.fetchedAt>v){p.delete(e);return}return r}}function M(){h.forEach(e=>e())}function T(e){let r=window.firebase.db,s=window.__ROOT_CTX.rootConfig.projectId;return x(r,"Projects",s,"UserProfiles",e)}function a(e){if(!e)return null;let r=E(A(e));return r?r.value:void 0}async function U(e){if(!e)return null;let r=A(e),s=E(r);if(s)return s.value;let n=P.get(r);if(n)return n;let i=(async()=>{try{let t=await y(T(r)),l=t.exists()?t.data():null;return p.set(r,{value:l,fetchedAt:Date.now()}),M(),l}catch(t){return console.error("failed to fetch user profile:",e,t),p.set(r,{value:null,fetchedAt:Date.now()}),null}finally{P.delete(r)}})();return P.set(r,i),i}function b(e){return h.add(e),()=>{h.delete(e)}}function O(e,r){if(!(r||e||"").trim())return"?";if(r){let t=r.trim().split(/\s+/).map(l=>l.replace(/[^a-zA-Z0-9]/g,"")).filter(Boolean);if(t.length>=2)return(t[0][0]+t[1][0]).toUpperCase();if(t.length===1&&t[0].length>0)return t[0].slice(0,2).toUpperCase()}let i=(e.split("@")[0]||e).replace(/[^a-zA-Z0-9]/g,"");return i.length===0?"?":i.slice(0,2).toUpperCase()}function S(e){let r=e.trim();if(!r)return"?";let[s,n=""]=r.split("@"),t=(_(r)?n:s||r).replace(/[^a-zA-Z0-9]/g,"");return t.length===0?"?":t[0].toUpperCase()}function _(e){return e.trim().startsWith("*@")}function z(e){let r=["#1f6feb","#0e7490","#0f766e","#15803d","#9333ea","#c026d3","#db2777","#dc2626","#ea580c","#b45309"],s=0;for(let n=0;n<e.length;n++)s=s*31+e.charCodeAt(n)>>>0;return r[s%r.length]}R();function H(e){let r=e?a(e):null,[s,n]=d(r??null),[i,t]=d(!!e&&r===void 0);return g(()=>{if(!e){n(null),t(!1);return}let l=!1,o=a(e);o!==void 0?(n(o),t(!1)):(t(!0),U(e).then(f=>{l||(n(f),t(!1))}));let c=b(()=>{if(l||!e)return;let f=a(e);f!==void 0&&n(f)});return()=>{l=!0,c()}},[e]),{profile:s,loading:i}}function W(e){let r=e.filter(o=>!!o).map(o=>o.toLowerCase()),s=r.slice().sort().join(","),[n,i]=d(()=>{let o=new Map;return r.forEach(c=>{let f=a(c);f!==void 0&&o.set(c,f)}),o}),[t,l]=d(r.length>0);return g(()=>{if(r.length===0){i(new Map),l(!1);return}let o=!1;function c(){let u=new Map,w=!1;r.forEach(C=>{let m=a(C);m===void 0?w=!0:u.set(C,m)}),i(u),l(w)}c(),Promise.all(r.filter(u=>a(u)===void 0).map(u=>U(u))).then(()=>{o||c()});let f=b(()=>{o||c()});return()=>{o=!0,f()}},[s]),{profiles:n,loading:t}}export{O as a,S as b,_ as c,z as d,H as e,W as f};
1
+ import{c as x,n as y}from"./chunk-XOWWPE7X.js";import{a as d,c as g,j as R}from"./chunk-Y7RYSRP7.js";var v=3600*1e3,p=new Map,P=new Map,h=new Set;function A(e){return e.trim().toLowerCase()}function E(e){let r=p.get(e);if(r){if(Date.now()-r.fetchedAt>v){p.delete(e);return}return r}}function M(){h.forEach(e=>e())}function T(e){let r=window.firebase.db,s=window.__ROOT_CTX.rootConfig.projectId;return x(r,"Projects",s,"UserProfiles",e)}function a(e){if(!e)return null;let r=E(A(e));return r?r.value:void 0}async function U(e){if(!e)return null;let r=A(e),s=E(r);if(s)return s.value;let n=P.get(r);if(n)return n;let i=(async()=>{try{let t=await y(T(r)),l=t.exists()?t.data():null;return p.set(r,{value:l,fetchedAt:Date.now()}),M(),l}catch(t){return console.error("failed to fetch user profile:",e,t),p.set(r,{value:null,fetchedAt:Date.now()}),null}finally{P.delete(r)}})();return P.set(r,i),i}function b(e){return h.add(e),()=>{h.delete(e)}}function O(e,r){if(!(r||e||"").trim())return"?";if(r){let t=r.trim().split(/\s+/).map(l=>l.replace(/[^a-zA-Z0-9]/g,"")).filter(Boolean);if(t.length>=2)return(t[0][0]+t[1][0]).toUpperCase();if(t.length===1&&t[0].length>0)return t[0].slice(0,2).toUpperCase()}let i=(e.split("@")[0]||e).replace(/[^a-zA-Z0-9]/g,"");return i.length===0?"?":i.slice(0,2).toUpperCase()}function S(e){let r=e.trim();if(!r)return"?";let[s,n=""]=r.split("@"),t=(_(r)?n:s||r).replace(/[^a-zA-Z0-9]/g,"");return t.length===0?"?":t[0].toUpperCase()}function _(e){return e.trim().startsWith("*@")}function z(e){let r=["#1f6feb","#0e7490","#0f766e","#15803d","#9333ea","#c026d3","#db2777","#dc2626","#ea580c","#b45309"],s=0;for(let n=0;n<e.length;n++)s=s*31+e.charCodeAt(n)>>>0;return r[s%r.length]}R();function H(e){let r=e?a(e):null,[s,n]=d(r??null),[i,t]=d(!!e&&r===void 0);return g(()=>{if(!e){n(null),t(!1);return}let l=!1,o=a(e);o!==void 0?(n(o),t(!1)):(t(!0),U(e).then(f=>{l||(n(f),t(!1))}));let c=b(()=>{if(l||!e)return;let f=a(e);f!==void 0&&n(f)});return()=>{l=!0,c()}},[e]),{profile:s,loading:i}}function W(e){let r=e.filter(o=>!!o).map(o=>o.toLowerCase()),s=r.slice().sort().join(","),[n,i]=d(()=>{let o=new Map;return r.forEach(c=>{let f=a(c);f!==void 0&&o.set(c,f)}),o}),[t,l]=d(r.length>0);return g(()=>{if(r.length===0){i(new Map),l(!1);return}let o=!1;function c(){let u=new Map,w=!1;r.forEach(C=>{let m=a(C);m===void 0?w=!0:u.set(C,m)}),i(u),l(w)}c(),Promise.all(r.filter(u=>a(u)===void 0).map(u=>U(u))).then(()=>{o||c()});let f=b(()=>{o||c()});return()=>{o=!0,f()}},[s]),{profiles:n,loading:t}}export{O as a,S as b,_ as c,z as d,H as e,W as f};
@@ -1 +1 @@
1
- import{a as P}from"./chunk-535JU7FU.js";import{a as $}from"./chunk-UJX25CXD.js";import{h as w,i as A}from"./chunk-RN4XVVWD.js";import{a as C}from"./chunk-W5DOO6ID.js";import{a as B}from"./chunk-YBHFGQ3Z.js";import{a as v,b as S}from"./chunk-PIJ3E47R.js";import{a as D,z as l}from"./chunk-XOWWPE7X.js";import{Fa as c,Ga as o,a as e,c as y,da as T,j as g}from"./chunk-WRA24P66.js";g();g();function x(t){let i=k(t.timestamp),[s,a]=e(i>0?l(i,{style:"short"}):"never");return i?(y(()=>{let u=window.setInterval(()=>{a(l(i,{style:"short"}))},6e4);return()=>window.clearInterval(u)},[]),o(c,{transition:"pop",label:`${U(i)} by ${t.email}`,children:l(i,{style:"short"})})):o("div",{children:s})}function U(t){return new Date(t).toLocaleDateString("en",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function k(t){return typeof t=="number"?t:t?.toMillis?t.toMillis():0}function et(t){let i=t.dataSource,[s,a]=e(!1),[u,N]=e(t.action==="sync"?i.syncedAt:i.publishedAt),[I,L]=e(t.action==="sync"?i.syncedBy:i.publishedBy),b=P(),{roles:_}=B(),E=window.firebase.user.email||"",m=C(_,E),d=t.action==="publish",r=!!i.archivedAt;async function M(){a(!0);let p=`data-source-${t.action}-${i.id}`;v({id:p,loading:!0,title:`Running Data Source ${t.action}`,message:`Updating ${i.id}...`,autoClose:!1,disallowClose:!0});try{t.action==="sync"?(i.type==="gsheet"&&!b.isLoggedIn()&&await b.login(),await w(i.id)):t.action==="publish"&&await A(i.id),N(D.now()),L(window.firebase.user.email),a(!1),t.onAction&&t.onAction(),S({id:p,title:"Success",message:`Updated Data Source ${i.id}`,autoClose:!1})}catch(n){console.error(n);let h=n;typeof n=="object"&&n.body&&(h=String(n.body)),a(!1),S({id:p,title:`Data Source ${t.action} failed`,message:String(h),color:"red",autoClose:!1})}}let f="";return t.action==="sync"?f="Sync data to a draft state":t.action==="publish"&&(f="Publish synced data to prod"),o("div",{className:"DataSourceStatusButton",children:[o("div",{className:"DataSourceStatusButton__label",children:!s&&o(x,{timestamp:u,email:I})}),o("div",{className:"DataSourceStatusButton__button",children:o($,{label:r?"Data source is archived":"You don't have access to publish this data source",condition:r||d&&!m,children:o(c,{transition:"pop",label:f,disabled:r||d&&!m,children:o(T,{variant:"default",size:"xs",compact:!0,onClick:()=>M(),loading:s,disabled:r||d&&!m,children:t.action})})})})]})}export{et as a};
1
+ import{a as P}from"./chunk-ILFWJKSS.js";import{a as $}from"./chunk-BOIY4J2R.js";import{h as w,i as A}from"./chunk-Z2CRNO3I.js";import{a as C}from"./chunk-W5DOO6ID.js";import{a as B}from"./chunk-ZQDUWURP.js";import{a as v,b as S}from"./chunk-ZYSR5UIW.js";import{a as D,z as l}from"./chunk-XOWWPE7X.js";import{Fa as c,a as e,c as y,da as T,fd as o,j as g}from"./chunk-Y7RYSRP7.js";g();g();function x(t){let i=k(t.timestamp),[s,a]=e(i>0?l(i,{style:"short"}):"never");return i?(y(()=>{let u=window.setInterval(()=>{a(l(i,{style:"short"}))},6e4);return()=>window.clearInterval(u)},[]),o(c,{transition:"pop",label:`${U(i)} by ${t.email}`,children:l(i,{style:"short"})})):o("div",{children:s})}function U(t){return new Date(t).toLocaleDateString("en",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function k(t){return typeof t=="number"?t:t?.toMillis?t.toMillis():0}function et(t){let i=t.dataSource,[s,a]=e(!1),[u,N]=e(t.action==="sync"?i.syncedAt:i.publishedAt),[I,L]=e(t.action==="sync"?i.syncedBy:i.publishedBy),b=P(),{roles:_}=B(),E=window.firebase.user.email||"",m=C(_,E),d=t.action==="publish",r=!!i.archivedAt;async function M(){a(!0);let p=`data-source-${t.action}-${i.id}`;v({id:p,loading:!0,title:`Running Data Source ${t.action}`,message:`Updating ${i.id}...`,autoClose:!1,disallowClose:!0});try{t.action==="sync"?(i.type==="gsheet"&&!b.isLoggedIn()&&await b.login(),await w(i.id)):t.action==="publish"&&await A(i.id),N(D.now()),L(window.firebase.user.email),a(!1),t.onAction&&t.onAction(),S({id:p,title:"Success",message:`Updated Data Source ${i.id}`,autoClose:!1})}catch(n){console.error(n);let h=n;typeof n=="object"&&n.body&&(h=String(n.body)),a(!1),S({id:p,title:`Data Source ${t.action} failed`,message:String(h),color:"red",autoClose:!1})}}let f="";return t.action==="sync"?f="Sync data to a draft state":t.action==="publish"&&(f="Publish synced data to prod"),o("div",{className:"DataSourceStatusButton",children:[o("div",{className:"DataSourceStatusButton__label",children:!s&&o(x,{timestamp:u,email:I})}),o("div",{className:"DataSourceStatusButton__button",children:o($,{label:r?"Data source is archived":"You don't have access to publish this data source",condition:r||d&&!m,children:o(c,{transition:"pop",label:f,disabled:r||d&&!m,children:o(T,{variant:"default",size:"xs",compact:!0,onClick:()=>M(),loading:s,disabled:r||d&&!m,children:t.action})})})})]})}export{et as a};
@@ -1 +1 @@
1
- import{e as r}from"./chunk-WASID5UU.js";import{Ga as i}from"./chunk-WRA24P66.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-GJ7ES2LA.js";import{fd as i}from"./chunk-Y7RYSRP7.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 +1 @@
1
- import{e as n}from"./chunk-WASID5UU.js";import{Ga as t}from"./chunk-WRA24P66.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-GJ7ES2LA.js";import{fd as t}from"./chunk-Y7RYSRP7.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 +1 @@
1
- import{L as m,a,c as f,j as O}from"./chunk-WRA24P66.js";O();var G=["https://www.googleapis.com/auth/drive.file","https://www.googleapis.com/auth/spreadsheets"],P=["https://www.googleapis.com/discovery/v1/apis/drive/v3/rest","https://sheets.googleapis.com/$discovery/rest?version=v4"];function R(){let o=window.__ROOT_CTX.rootConfig.projectId,t=!!(window.__ROOT_CTX.gapi?.apiKey&&window.__ROOT_CTX.gapi?.clientId),[e,n]=a(t),[i,w]=a(0),[s,h]=m({key:`root-cms::${o}::gapi-user-consent`,defaultValue:{}});async function C(){await Promise.all([E(),b()]),n(!1)}f(()=>{t&&C()},[]);function _(r){return new Promise(v=>{let g=window.__ROOT_CTX.gapi.clientId,c=Array.from(new Set([...G,...r?.scopes||[]])),u=google.accounts.oauth2.initTokenClient({client_id:g,scope:c.join(" "),callback:async I=>{let y=l()+parseInt(I.expires_in);w(y),h({at:l(),clientId:g,scopes:c}),v()}});s&&k(s,c)?(console.log("requesting token without prompt"),u.requestAccessToken({prompt:""})):(console.log("requesting token with prompt"),u.requestAccessToken({prompt:"consent"}))})}function S(){return l()<i}function T(r){return s?.scopes?.includes(r)||!1}return{enabled:t,loading:e,isLoggedIn:S,login:_,hasScope:T}}function k(o,t){if(!o||!o.at)return!1;let e=window.__ROOT_CTX.gapi?.clientId;if(o.clientId!==e)return!1;let n=o.scopes||[];return t.every(i=>n.includes(i))}function l(){return Math.floor(new Date().getTime()/1e3)}var p=null;async function E(){return p||(p=new Promise((o,t)=>{let e=document.createElement("script");e.src="https://apis.google.com/js/api.js",e.onload=()=>{gapi.load("client",async()=>{try{await gapi.client.init({}),await Promise.all(P.map(n=>gapi.client.load(n))),console.log("gapi loaded"),o()}catch(n){console.error("Error initializing gapi:",n),t(n)}})},e.onerror=()=>{console.error("gapi script failed to load"),t(new Error("gapi script failed to load"))},document.head.appendChild(e)})),p}var d=null;async function b(){return d||(d=new Promise((o,t)=>{let e=document.createElement("script");e.src="https://accounts.google.com/gsi/client",e.onload=()=>{o()},e.onerror=()=>{console.error("gis script failed to load"),t(new Error("gis script failed to load"))},document.head.appendChild(e)})),d}export{R as a};
1
+ import{L as m,a,c as f,j as O}from"./chunk-Y7RYSRP7.js";O();var G=["https://www.googleapis.com/auth/drive.file","https://www.googleapis.com/auth/spreadsheets"],P=["https://www.googleapis.com/discovery/v1/apis/drive/v3/rest","https://sheets.googleapis.com/$discovery/rest?version=v4"];function R(){let o=window.__ROOT_CTX.rootConfig.projectId,t=!!(window.__ROOT_CTX.gapi?.apiKey&&window.__ROOT_CTX.gapi?.clientId),[e,n]=a(t),[i,w]=a(0),[s,h]=m({key:`root-cms::${o}::gapi-user-consent`,defaultValue:{}});async function C(){await Promise.all([E(),b()]),n(!1)}f(()=>{t&&C()},[]);function _(r){return new Promise(v=>{let g=window.__ROOT_CTX.gapi.clientId,c=Array.from(new Set([...G,...r?.scopes||[]])),u=google.accounts.oauth2.initTokenClient({client_id:g,scope:c.join(" "),callback:async I=>{let y=l()+parseInt(I.expires_in);w(y),h({at:l(),clientId:g,scopes:c}),v()}});s&&k(s,c)?(console.log("requesting token without prompt"),u.requestAccessToken({prompt:""})):(console.log("requesting token with prompt"),u.requestAccessToken({prompt:"consent"}))})}function S(){return l()<i}function T(r){return s?.scopes?.includes(r)||!1}return{enabled:t,loading:e,isLoggedIn:S,login:_,hasScope:T}}function k(o,t){if(!o||!o.at)return!1;let e=window.__ROOT_CTX.gapi?.clientId;if(o.clientId!==e)return!1;let n=o.scopes||[];return t.every(i=>n.includes(i))}function l(){return Math.floor(new Date().getTime()/1e3)}var p=null;async function E(){return p||(p=new Promise((o,t)=>{let e=document.createElement("script");e.src="https://apis.google.com/js/api.js",e.onload=()=>{gapi.load("client",async()=>{try{await gapi.client.init({}),await Promise.all(P.map(n=>gapi.client.load(n))),console.log("gapi loaded"),o()}catch(n){console.error("Error initializing gapi:",n),t(n)}})},e.onerror=()=>{console.error("gapi script failed to load"),t(new Error("gapi script failed to load"))},document.head.appendChild(e)})),p}var d=null;async function b(){return d||(d=new Promise((o,t)=>{let e=document.createElement("script");e.src="https://accounts.google.com/gsi/client",e.onload=()=>{o()},e.onerror=()=>{console.error("gis script failed to load"),t(new Error("gis script failed to load"))},document.head.appendChild(e)})),d}export{R as a};
@@ -0,0 +1 @@
1
+ import{z as l}from"./chunk-XOWWPE7X.js";import{Fa as s,ba as a,fd as t}from"./chunk-Y7RYSRP7.js";var d={transition:"pop"};function r(e){return{root:`DocStatusBadges__badge DocStatusBadges__badge--${e}`,inner:"DocStatusBadges__badge__inner"}}function h(e){let i=e.release;return o(i.archivedAt)?t(s,{...d,label:`Archived ${n(i.archivedAt)} by ${i.archivedBy}`,children:t(a,{size:"sm",radius:"sm",variant:"filled",classNames:r("archived"),children:"Archived"})}):o(i.scheduledAt)?t(s,{...d,label:`Scheduled ${u(i.scheduledAt)} by ${i.scheduledBy}`,wrapLines:!0,width:240,children:t(a,{size:"sm",radius:"sm",variant:"filled",classNames:r("scheduled"),children:"Scheduled"})}):o(i.publishedAt)?t(s,{...d,label:`Published ${n(i.publishedAt)} by ${i.publishedBy}`,children:t(a,{size:"sm",radius:"sm",variant:"filled",classNames:r("published"),children:"Published"})}):t(a,{size:"sm",radius:"sm",variant:"filled",classNames:r("draft"),children:"Unpublished"})}function o(e){return!!(e&&e.toMillis)}function n(e){return e?.toMillis?l(e.toMillis()):l(new Date().getTime())}function u(e){return new Date(e.toMillis()).toLocaleDateString("en",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}export{h as a};