astronaut-cms 0.0.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +84 -3
  3. package/dist/admin/THIRD_PARTY_LICENSES.md +7598 -0
  4. package/dist/admin/assets/assistant-DkS355co.js +201 -0
  5. package/dist/admin/assets/badge-BXsOvOPX.js +1 -0
  6. package/dist/admin/assets/changes-Ba0G_GN1.js +1 -0
  7. package/dist/admin/assets/client-VKp75fDU.js +5 -0
  8. package/dist/admin/assets/clsx-DB0hHKMi.js +1 -0
  9. package/dist/admin/assets/collapsible-B6P_J0Bg.js +1 -0
  10. package/dist/admin/assets/collapsible-item-UaoJaaPw.js +1 -0
  11. package/dist/admin/assets/collections._collection-BE1enDCq.js +1 -0
  12. package/dist/admin/assets/collections._collection._entry-D3UksnCo.js +52 -0
  13. package/dist/admin/assets/collections._collection.index-BN5d8UIY.js +1 -0
  14. package/dist/admin/assets/component-lookup-CUCiK8Xh.js +4 -0
  15. package/dist/admin/assets/config-Pm_BHLNT.js +1 -0
  16. package/dist/admin/assets/copy-DezZzPMV.js +1 -0
  17. package/dist/admin/assets/css-BGIxQoYs.js +1 -0
  18. package/dist/admin/assets/css-DgaLhXQH.js +1 -0
  19. package/dist/admin/assets/diff-woXpYk--.js +1 -0
  20. package/dist/admin/assets/dist-DzkcSBZl.js +1 -0
  21. package/dist/admin/assets/dist-UbA1s2kM.js +1 -0
  22. package/dist/admin/assets/docx-BctAmX91.js +56 -0
  23. package/dist/admin/assets/editor-FGqMznBK.js +2 -0
  24. package/dist/admin/assets/empty-DSBYiI_7.js +1 -0
  25. package/dist/admin/assets/entry-link-CQLN2Zpf.js +158 -0
  26. package/dist/admin/assets/error-banner-yskeRXe8.js +159 -0
  27. package/dist/admin/assets/errors-DkJ5E_ak.js +1 -0
  28. package/dist/admin/assets/field-BDK5tt3J.js +41 -0
  29. package/dist/admin/assets/field-schema-CacrjSYw.js +1 -0
  30. package/dist/admin/assets/file-text-BzBif8ui.js +1 -0
  31. package/dist/admin/assets/github-dark-C-LZuMrd.js +1 -0
  32. package/dist/admin/assets/github-light-EUqPIrTm.js +1 -0
  33. package/dist/admin/assets/highlighted-body-JLMTFACH-CIQujGv2.js +1 -0
  34. package/dist/admin/assets/html-CvFb5cGI.js +1 -0
  35. package/dist/admin/assets/javascript-BzbQS41l.js +1 -0
  36. package/dist/admin/assets/javascript-CpIGwZ_Y.js +1 -0
  37. package/dist/admin/assets/json-qhed-kSA.js +1 -0
  38. package/dist/admin/assets/jsx-Bz0zcwM4.js +1 -0
  39. package/dist/admin/assets/lib-CMURo-7A.js +21 -0
  40. package/dist/admin/assets/library-Cr3f75Es.js +1 -0
  41. package/dist/admin/assets/list-skeleton-BdTNfVXs.js +1 -0
  42. package/dist/admin/assets/markdown-BYOwaDjH.js +1 -0
  43. package/dist/admin/assets/matchContext-Bq5Es9aD.js +2 -0
  44. package/dist/admin/assets/media-browser-9-CPTCks.js +1 -0
  45. package/dist/admin/assets/media._library-BfFaEZLR.js +1 -0
  46. package/dist/admin/assets/mermaid-WFAXDIZX-CJ3hhA0i.js +1 -0
  47. package/dist/admin/assets/page-header-B4nvAsVA.js +1 -0
  48. package/dist/admin/assets/pdf-DgessaF0.js +106 -0
  49. package/dist/admin/assets/python-gzcpVVnB.js +1 -0
  50. package/dist/admin/assets/react-kbcsfQYH.js +1 -0
  51. package/dist/admin/assets/rolldown-runtime-BWaJ3C7D.js +1 -0
  52. package/dist/admin/assets/routes-CBt04sNR.js +1 -0
  53. package/dist/admin/assets/routes-D7tEdYGV.js +1 -0
  54. package/dist/admin/assets/save-actions-Cz0TkpcP.js +32 -0
  55. package/dist/admin/assets/select-Bv2EoLhN.js +1 -0
  56. package/dist/admin/assets/separator-DlYj_PoQ.js +3 -0
  57. package/dist/admin/assets/shell-DBEiq06l.js +1 -0
  58. package/dist/admin/assets/shellscript-CLZ0U2zV.js +1 -0
  59. package/dist/admin/assets/skeleton-CKiqTaRh.js +1 -0
  60. package/dist/admin/assets/sql-CEbI0hMM.js +1 -0
  61. package/dist/admin/assets/syntax-BAXqRKRO.js +8 -0
  62. package/dist/admin/assets/toggle-Y2UpJZyU.js +1 -0
  63. package/dist/admin/assets/toml-BPTmHmyx.js +1 -0
  64. package/dist/admin/assets/tsx-udAQXfEw.js +1 -0
  65. package/dist/admin/assets/typescript-bsJCZSQ-.js +1 -0
  66. package/dist/admin/assets/ui.module.css-WaO_77ml.js +56 -0
  67. package/dist/admin/assets/use-entries-B2lsaiK9.js +1 -0
  68. package/dist/admin/assets/useSelector-CWr3iU9K.js +1 -0
  69. package/dist/admin/assets/yaml-rwi0_p6S.js +1 -0
  70. package/dist/admin/assets/zwitch-Wwuax-dJ.js +1 -0
  71. package/dist/admin/bootstrap.d.ts +1 -0
  72. package/dist/admin/bootstrap.js +1 -0
  73. package/dist/admin/editor.d.ts +57 -0
  74. package/dist/admin/editor.js +1 -0
  75. package/dist/server/assets.d.ts +2 -0
  76. package/dist/server/assets.js +30 -0
  77. package/dist/server/chunks/anchors-DuZ1fokt.js +86 -0
  78. package/dist/server/chunks/auth-DJP9ryVd.js +44 -0
  79. package/dist/server/chunks/cms-markers-CUqrOnfA.js +78 -0
  80. package/dist/server/chunks/component-lookup-DAFg_Qg8.js +128 -0
  81. package/dist/server/chunks/config-WQqG4mNH.d.ts +193 -0
  82. package/dist/server/chunks/digest-BYzWNJea.js +753 -0
  83. package/dist/server/chunks/entry-checks-CKMag1G4.js +608 -0
  84. package/dist/server/chunks/field-schema-CfdN75jT.js +48 -0
  85. package/dist/server/chunks/http-BnsNh57m.d.ts +35 -0
  86. package/dist/server/chunks/i18n-BPmx7ESy.d.ts +15 -0
  87. package/dist/server/chunks/index-CYbkNvu5.d.ts +22 -0
  88. package/dist/server/chunks/media-BhqUVVYY.js +223 -0
  89. package/dist/server/chunks/paths-CEW9fvg8.js +17 -0
  90. package/dist/server/chunks/paths-Dztx2eUw.js +13 -0
  91. package/dist/server/chunks/types-DOR5XaJO.js +397 -0
  92. package/dist/server/chunks/types-Dkx4Xovf.d.ts +359 -0
  93. package/dist/server/chunks/types-DwA-C6Br.d.ts +266 -0
  94. package/dist/server/chunks/user-config-DoypbpQf.js +283 -0
  95. package/dist/server/chunks/xml-D8qPILJU.js +81 -0
  96. package/dist/server/config.d.ts +3 -0
  97. package/dist/server/config.js +18 -0
  98. package/dist/server/content.d.ts +48 -0
  99. package/dist/server/content.js +89 -0
  100. package/dist/server/endpoint.d.ts +11 -0
  101. package/dist/server/endpoint.js +2712 -0
  102. package/dist/server/integration.d.ts +7 -0
  103. package/dist/server/integration.js +1174 -0
  104. package/dist/server/internal.d.ts +65 -0
  105. package/dist/server/internal.js +30 -0
  106. package/dist/server/server-local.d.ts +453 -0
  107. package/dist/server/server-local.js +336 -0
  108. package/dist/styles/THIRD_PARTY_LICENSES.md +193 -0
  109. package/dist/styles/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
  110. package/dist/styles/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
  111. package/dist/styles/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
  112. package/dist/styles/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
  113. package/dist/styles/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
  114. package/dist/styles/styles.css +3 -0
  115. package/package.json +151 -5
  116. package/src/astro/Image.astro +28 -0
  117. package/src/astro/Video.astro +44 -0
  118. package/src/astro/admin.astro +137 -0
  119. package/src/astro/licenses.ts +5 -0
@@ -0,0 +1 @@
1
+ import{J as e,Q as t,X as n,Y as r,g as i,x as a}from"./error-banner-yskeRXe8.js";import{useRef as o}from"react";var s=e=>r({queryKey:a.entries(e),queryFn:()=>i(`listEntries`,{collection:e})}),c=(e,t)=>r({queryKey:a.entry(e,t),queryFn:()=>i(`getEntry`,{collection:e,id:t})}),l=e=>r({queryKey:a.fileLayout(e),queryFn:()=>i(`getFileLayout`,{collection:e})});function u(e){return n({...s(e),enabled:!!e})}function d(e,t,r){return n({...c(e,t),enabled:(r?.enabled??!0)&&!!e&&!!t})}function f(n,r){let s=t(),c=o(!1),l=e({mutationFn:e=>i(`saveEntry`,{collection:n,id:r,entry:e}),onSuccess:({version:e},t)=>{s.setQueryData(a.entry(n,r),n=>n&&{...n,data:t.data,body:t.body,format:t.format,...e&&{version:e}})},onSettled:()=>{c.current=!1}}),u=(e,t)=>{c.current||(c.current=!0,l.mutate(e,t))};return{...l,mutate:u}}function p(t){return e({mutationFn:({id:e,expectedVersion:n})=>i(`deleteEntry`,{collection:t,id:e,expectedVersion:n})})}function m(t){return e({mutationFn:({oldId:e,newId:n,expectedVersion:r})=>i(`renameEntry`,{collection:t,id:e,newId:n,expectedVersion:r})})}function h(t){return e({mutationFn:({sourceId:e,newId:n})=>i(`duplicateEntry`,{collection:t,id:e,newId:n})})}function g(e){return n({...l(e),enabled:!!e})}function _(t){return e({mutationFn:({ids:e,expectedVersion:n})=>i(`reorderEntries`,{collection:t,ids:e,expectedVersion:n})})}var v=3e4;function y(){return n({queryKey:a.branchStatus,queryFn:()=>i(`getStatus`,{}),staleTime:v})}var b=r({queryKey:a.changes,queryFn:()=>i(`getChanges`,{}),staleTime:v});function x(){return n(b)}function S(){return e({mutationFn:e=>i(`publish`,{digest:e})})}function C(){return e({mutationFn:()=>i(`update`,{})})}function w(){return e({mutationFn:()=>i(`discard`,{})})}export{C as _,y as a,w as c,d,g as f,f as g,_ as h,l as i,h as l,m,s as n,x as o,S as p,c as r,p as s,b as t,u};
@@ -0,0 +1 @@
1
+ import{t as e}from"./rolldown-runtime-BWaJ3C7D.js";import{D as t,O as n}from"./matchContext-Bq5Es9aD.js";import{useCallback as r}from"react";var i=/* @__PURE__ */ e((e=>{var r=n(),i=t();function a(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var o=typeof Object.is==`function`?Object.is:a,s=i.useSyncExternalStore,c=r.useRef,l=r.useEffect,u=r.useMemo,d=r.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var a=c(null);if(a.current===null){var f={hasValue:!1,value:null};a.current=f}else f=a.current;a=u(function(){function e(e){if(!a){if(a=!0,s=e,e=r(e),i!==void 0&&f.hasValue){var t=f.value;if(i(t,e))return c=t}return c=e}if(t=c,o(s,e))return t;var n=r(e);return i!==void 0&&i(t,n)?(s=e,t):(s=e,c=n)}var a=!1,s,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,i]);var p=s(e,a[0],a[1]);return l(function(){f.hasValue=!0,f.value=p},[p]),d(p),p}})),a=/* @__PURE__ */ e((e=>{process.env.NODE_ENV!==`production`&&(function(){function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart==`function`&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var i=n(),a=t(),o=typeof Object.is==`function`?Object.is:r,s=a.useSyncExternalStore,c=i.useRef,l=i.useEffect,u=i.useMemo,d=i.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var a=c(null);if(a.current===null){var f={hasValue:!1,value:null};a.current=f}else f=a.current;a=u(function(){function e(e){if(!a){if(a=!0,s=e,e=r(e),i!==void 0&&f.hasValue){var t=f.value;if(i(t,e))return c=t}return c=e}if(t=c,o(s,e))return t;var n=r(e);return i!==void 0&&i(t,n)?(s=e,t):(s=e,c=n)}var a=!1,s,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,i]);var p=s(e,a[0],a[1]);return l(function(){f.hasValue=!0,f.value=p},[p]),d(p),p},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop==`function`&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()})),o=(/* @__PURE__ */ e(((e,t)=>{t.exports=process.env.NODE_ENV===`production`?i():a()})))();function s(e,t){return e===t}function c(e,t=e=>e,n){let i=n?.compare??s,a=r(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),c=r(()=>e.get(),[e]);return(0,o.useSyncExternalStoreWithSelector)(a,c,c,t,i)}export{c as t};
@@ -0,0 +1 @@
1
+ var e=[Object.freeze(JSON.parse(`{"displayName":"YAML","fileTypes":["yaml","yml","rviz","reek","clang-format","yaml-tmlanguage","syntax","sublime-syntax"],"firstLineMatch":"^%YAML( ?1.\\\\d+)?","name":"yaml","patterns":[{"include":"#comment"},{"include":"#property"},{"include":"#directive"},{"match":"^---","name":"entity.other.document.begin.yaml"},{"match":"^\\\\.{3}","name":"entity.other.document.end.yaml"},{"include":"#node"}],"repository":{"block-collection":{"patterns":[{"include":"#block-sequence"},{"include":"#block-mapping"}]},"block-mapping":{"patterns":[{"include":"#block-pair"}]},"block-node":{"patterns":[{"include":"#prototype"},{"include":"#block-scalar"},{"include":"#block-collection"},{"include":"#flow-scalar-plain-out"},{"include":"#flow-node"}]},"block-pair":{"patterns":[{"begin":"\\\\?","beginCaptures":{"1":{"name":"punctuation.definition.key-value.begin.yaml"}},"end":"(?=\\\\?)|^ *(:)|(:)","endCaptures":{"1":{"name":"punctuation.separator.key-value.mapping.yaml"},"2":{"name":"invalid.illegal.expected-newline.yaml"}},"name":"meta.block-mapping.yaml","patterns":[{"include":"#block-node"}]},{"begin":"(?=(?:[^-\\\\]!\\"#%\\\\&'*,:>?@\\\\[\`{|}\\\\s]|[-:?]\\\\S)([^:\\\\s]|:\\\\S|\\\\s+(?![#\\\\s]))*\\\\s*:(\\\\s|$))","end":"(?=\\\\s*$|\\\\s+#|\\\\s*:(\\\\s|$))","patterns":[{"include":"#flow-scalar-plain-out-implicit-type"},{"begin":"[^-\\\\]!\\"#%\\\\&'*,:>?@\\\\[\`{|}\\\\s]|[-:?]\\\\S","beginCaptures":{"0":{"name":"entity.name.tag.yaml"}},"contentName":"entity.name.tag.yaml","end":"(?=\\\\s*$|\\\\s+#|\\\\s*:(\\\\s|$))","name":"string.unquoted.plain.out.yaml"}]},{"match":":(?=\\\\s|$)","name":"punctuation.separator.key-value.mapping.yaml"}]},"block-scalar":{"begin":"(?:(\\\\|)|(>))([1-9])?([-+])?(.*\\\\n?)","beginCaptures":{"1":{"name":"keyword.control.flow.block-scalar.literal.yaml"},"2":{"name":"keyword.control.flow.block-scalar.folded.yaml"},"3":{"name":"constant.numeric.indentation-indicator.yaml"},"4":{"name":"storage.modifier.chomping-indicator.yaml"},"5":{"patterns":[{"include":"#comment"},{"match":".+","name":"invalid.illegal.expected-comment-or-newline.yaml"}]}},"end":"^(?=\\\\S)|(?!\\\\G)","patterns":[{"begin":"^( +)(?! )","end":"^(?!\\\\1|\\\\s*$)","name":"string.unquoted.block.yaml"}]},"block-sequence":{"match":"(-)(?!\\\\S)","name":"punctuation.definition.block.sequence.item.yaml"},"comment":{"begin":"(?:^([\\\\t ]*)|[\\\\t ]+)(?=#\\\\p{print}*$)","beginCaptures":{"1":{"name":"punctuation.whitespace.comment.leading.yaml"}},"end":"(?!\\\\G)","patterns":[{"begin":"#","beginCaptures":{"0":{"name":"punctuation.definition.comment.yaml"}},"end":"\\\\n","name":"comment.line.number-sign.yaml"}]},"directive":{"begin":"^%","beginCaptures":{"0":{"name":"punctuation.definition.directive.begin.yaml"}},"end":"(?=$|[\\\\t ]+($|#))","name":"meta.directive.yaml","patterns":[{"captures":{"1":{"name":"keyword.other.directive.yaml.yaml"},"2":{"name":"constant.numeric.yaml-version.yaml"}},"match":"\\\\G(YAML)[\\\\t ]+(\\\\d+\\\\.\\\\d+)"},{"captures":{"1":{"name":"keyword.other.directive.tag.yaml"},"2":{"name":"storage.type.tag-handle.yaml"},"3":{"name":"support.type.tag-prefix.yaml"}},"match":"\\\\G(TAG)(?:[\\\\t ]+(!(?:[-0-9A-Za-z]*!)?)(?:[\\\\t ]+(!(?:%\\\\h{2}|[]!#$\\\\&-;=?-\\\\[_a-z~])*|(?![]!,\\\\[{}])(?:%\\\\h{2}|[]!#$\\\\&-;=?-\\\\[_a-z~])+))?)?"},{"captures":{"1":{"name":"support.other.directive.reserved.yaml"},"2":{"name":"string.unquoted.directive-name.yaml"},"3":{"name":"string.unquoted.directive-parameter.yaml"}},"match":"\\\\G(\\\\w+)(?:[\\\\t ]+(\\\\w+)(?:[\\\\t ]+(\\\\w+))?)?"},{"match":"\\\\S+","name":"invalid.illegal.unrecognized.yaml"}]},"flow-alias":{"captures":{"1":{"name":"keyword.control.flow.alias.yaml"},"2":{"name":"punctuation.definition.alias.yaml"},"3":{"name":"variable.other.alias.yaml"},"4":{"name":"invalid.illegal.character.anchor.yaml"}},"match":"((\\\\*))([^],/\\\\[{}\\\\s]+)([^],}\\\\s]\\\\S*)?"},"flow-collection":{"patterns":[{"include":"#flow-sequence"},{"include":"#flow-mapping"}]},"flow-mapping":{"begin":"\\\\{","beginCaptures":{"0":{"name":"punctuation.definition.mapping.begin.yaml"}},"end":"}","endCaptures":{"0":{"name":"punctuation.definition.mapping.end.yaml"}},"name":"meta.flow-mapping.yaml","patterns":[{"include":"#prototype"},{"match":",","name":"punctuation.separator.mapping.yaml"},{"include":"#flow-pair"}]},"flow-node":{"patterns":[{"include":"#prototype"},{"include":"#flow-alias"},{"include":"#flow-collection"},{"include":"#flow-scalar"}]},"flow-pair":{"patterns":[{"begin":"\\\\?","beginCaptures":{"0":{"name":"punctuation.definition.key-value.begin.yaml"}},"end":"(?=[],}])","name":"meta.flow-pair.explicit.yaml","patterns":[{"include":"#prototype"},{"include":"#flow-pair"},{"include":"#flow-node"},{"begin":":(?=\\\\s|$|[],\\\\[{}])","beginCaptures":{"0":{"name":"punctuation.separator.key-value.mapping.yaml"}},"end":"(?=[],}])","patterns":[{"include":"#flow-value"}]}]},{"begin":"(?=(?:[^-\\\\]!\\"#%\\\\&'*,:>?@\\\\[\`{|}\\\\s]|[-:?][^],\\\\[{}\\\\s])([^],:\\\\[{}\\\\s]|:[^],\\\\[{}\\\\s]|\\\\s+(?![#\\\\s]))*\\\\s*:(\\\\s|$))","end":"(?=\\\\s*$|\\\\s+#|\\\\s*:(\\\\s|$)|\\\\s*:[],\\\\[{}]|\\\\s*[],\\\\[{}])","name":"meta.flow-pair.key.yaml","patterns":[{"include":"#flow-scalar-plain-in-implicit-type"},{"begin":"[^-\\\\]!\\"#%\\\\&'*,:>?@\\\\[\`{|}\\\\s]|[-:?][^],\\\\[{}\\\\s]","beginCaptures":{"0":{"name":"entity.name.tag.yaml"}},"contentName":"entity.name.tag.yaml","end":"(?=\\\\s*$|\\\\s+#|\\\\s*:(\\\\s|$)|\\\\s*:[],\\\\[{}]|\\\\s*[],\\\\[{}])","name":"string.unquoted.plain.in.yaml"}]},{"include":"#flow-node"},{"begin":":(?=\\\\s|$|[],\\\\[{}])","captures":{"0":{"name":"punctuation.separator.key-value.mapping.yaml"}},"end":"(?=[],}])","name":"meta.flow-pair.yaml","patterns":[{"include":"#flow-value"}]}]},"flow-scalar":{"patterns":[{"include":"#flow-scalar-double-quoted"},{"include":"#flow-scalar-single-quoted"},{"include":"#flow-scalar-plain-in"}]},"flow-scalar-double-quoted":{"begin":"\\"","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.yaml"}},"end":"\\"","endCaptures":{"0":{"name":"punctuation.definition.string.end.yaml"}},"name":"string.quoted.double.yaml","patterns":[{"match":"\\\\\\\\([ \\"/0LN\\\\\\\\_abefnprtv]|x\\\\d\\\\d|u\\\\d{4}|U\\\\d{8})","name":"constant.character.escape.yaml"},{"match":"\\\\\\\\\\\\n","name":"constant.character.escape.double-quoted.newline.yaml"}]},"flow-scalar-plain-in":{"patterns":[{"include":"#flow-scalar-plain-in-implicit-type"},{"begin":"[^-\\\\]!\\"#%\\\\&'*,:>?@\\\\[\`{|}\\\\s]|[-:?][^],\\\\[{}\\\\s]","end":"(?=\\\\s*$|\\\\s+#|\\\\s*:(\\\\s|$)|\\\\s*:[],\\\\[{}]|\\\\s*[],\\\\[{}])","name":"string.unquoted.plain.in.yaml"}]},"flow-scalar-plain-in-implicit-type":{"patterns":[{"captures":{"1":{"name":"constant.language.null.yaml"},"2":{"name":"constant.language.boolean.yaml"},"3":{"name":"constant.numeric.integer.yaml"},"4":{"name":"constant.numeric.float.yaml"},"5":{"name":"constant.other.timestamp.yaml"},"6":{"name":"constant.language.value.yaml"},"7":{"name":"constant.language.merge.yaml"}},"match":"(?:(null|Null|NULL|~)|([Yy]|yes|Yes|YES|[Nn]|no|No|NO|true|True|TRUE|false|False|FALSE|on|On|ON|off|Off|OFF)|([-+]?0b[01_]+|[-+]?0[0-7_]+|[-+]?(?:0|[1-9][0-9_]*)|[-+]?0x[_\\\\h]+|[-+]?[1-9][0-9_]*(?::[0-5]?[0-9])+)|([-+]?(?:[0-9][0-9_]*)?\\\\.[.0-9]*(?:[Ee][-+][0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\\\.[0-9_]*|[-+]?\\\\.(?:inf|Inf|INF)|\\\\.(?:nan|NaN|NAN))|(\\\\d{4}-\\\\d{2}-\\\\d{2}|\\\\d{4}-\\\\d{1,2}-\\\\d{1,2}(?:[Tt]|[\\\\t ]+)\\\\d{1,2}:\\\\d{2}:\\\\d{2}(?:\\\\.\\\\d*)?(?:[\\\\t ]*Z|[-+]\\\\d{1,2}(?::\\\\d{1,2})?)?)|(=)|(<<))(?=\\\\s*$|\\\\s+#|\\\\s*:(\\\\s|$)|\\\\s*:[],\\\\[{}]|\\\\s*[],\\\\[{}])"}]},"flow-scalar-plain-out":{"patterns":[{"include":"#flow-scalar-plain-out-implicit-type"},{"begin":"[^-\\\\]!\\"#%\\\\&'*,:>?@\\\\[\`{|}\\\\s]|[-:?]\\\\S","end":"(?=\\\\s*$|\\\\s+#|\\\\s*:(\\\\s|$))","name":"string.unquoted.plain.out.yaml"}]},"flow-scalar-plain-out-implicit-type":{"patterns":[{"captures":{"1":{"name":"constant.language.null.yaml"},"2":{"name":"constant.language.boolean.yaml"},"3":{"name":"constant.numeric.integer.yaml"},"4":{"name":"constant.numeric.float.yaml"},"5":{"name":"constant.other.timestamp.yaml"},"6":{"name":"constant.language.value.yaml"},"7":{"name":"constant.language.merge.yaml"}},"match":"(?:(null|Null|NULL|~)|([Yy]|yes|Yes|YES|[Nn]|no|No|NO|true|True|TRUE|false|False|FALSE|on|On|ON|off|Off|OFF)|([-+]?0b[01_]+|[-+]?0[0-7_]+|[-+]?(?:0|[1-9][0-9_]*)|[-+]?0x[_\\\\h]+|[-+]?[1-9][0-9_]*(?::[0-5]?[0-9])+)|([-+]?(?:[0-9][0-9_]*)?\\\\.[.0-9]*(?:[Ee][-+][0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\\\.[0-9_]*|[-+]?\\\\.(?:inf|Inf|INF)|\\\\.(?:nan|NaN|NAN))|(\\\\d{4}-\\\\d{2}-\\\\d{2}|\\\\d{4}-\\\\d{1,2}-\\\\d{1,2}(?:[Tt]|[\\\\t ]+)\\\\d{1,2}:\\\\d{2}:\\\\d{2}(?:\\\\.\\\\d*)?(?:[\\\\t ]*Z|[-+]\\\\d{1,2}(?::\\\\d{1,2})?)?)|(=)|(<<))(?=\\\\s*$|\\\\s+#|\\\\s*:(\\\\s|$))"}]},"flow-scalar-single-quoted":{"begin":"'","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.yaml"}},"end":"'(?!')","endCaptures":{"0":{"name":"punctuation.definition.string.end.yaml"}},"name":"string.quoted.single.yaml","patterns":[{"match":"''","name":"constant.character.escape.single-quoted.yaml"}]},"flow-sequence":{"begin":"\\\\[","beginCaptures":{"0":{"name":"punctuation.definition.sequence.begin.yaml"}},"end":"]","endCaptures":{"0":{"name":"punctuation.definition.sequence.end.yaml"}},"name":"meta.flow-sequence.yaml","patterns":[{"include":"#prototype"},{"match":",","name":"punctuation.separator.sequence.yaml"},{"include":"#flow-pair"},{"include":"#flow-node"}]},"flow-value":{"patterns":[{"begin":"\\\\G(?![],}])","end":"(?=[],}])","name":"meta.flow-pair.value.yaml","patterns":[{"include":"#flow-node"}]}]},"node":{"patterns":[{"include":"#block-node"}]},"property":{"begin":"(?=[!\\\\&])","end":"(?!\\\\G)","name":"meta.property.yaml","patterns":[{"captures":{"1":{"name":"keyword.control.property.anchor.yaml"},"2":{"name":"punctuation.definition.anchor.yaml"},"3":{"name":"entity.name.type.anchor.yaml"},"4":{"name":"invalid.illegal.character.anchor.yaml"}},"match":"\\\\G((&))([^],/\\\\[{}\\\\s]+)(\\\\S+)?"},{"match":"\\\\G!(?:<(?:%\\\\h{2}|[]!#$\\\\&-;=?-\\\\[_a-z~])+>|(?:[-0-9A-Za-z]*!)?(?:%\\\\h{2}|[#$\\\\&-+\\\\--;=?-Z_a-z~])+|)(?=[\\\\t ]|$)","name":"storage.type.tag-handle.yaml"},{"match":"\\\\S+","name":"invalid.illegal.tag-handle.yaml"}]},"prototype":{"patterns":[{"include":"#comment"},{"include":"#property"}]}},"scopeName":"source.yaml","aliases":["yml"]}`))];export{e as default};
@@ -0,0 +1 @@
1
+ function e(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}var t=/* @__PURE__ */ `AElig.AMP.Aacute.Acirc.Agrave.Aring.Atilde.Auml.COPY.Ccedil.ETH.Eacute.Ecirc.Egrave.Euml.GT.Iacute.Icirc.Igrave.Iuml.LT.Ntilde.Oacute.Ocirc.Ograve.Oslash.Otilde.Ouml.QUOT.REG.THORN.Uacute.Ucirc.Ugrave.Uuml.Yacute.aacute.acirc.acute.aelig.agrave.amp.aring.atilde.auml.brvbar.ccedil.cedil.cent.copy.curren.deg.divide.eacute.ecirc.egrave.eth.euml.frac12.frac14.frac34.gt.iacute.icirc.iexcl.igrave.iquest.iuml.laquo.lt.macr.micro.middot.nbsp.not.ntilde.oacute.ocirc.ograve.ordf.ordm.oslash.otilde.ouml.para.plusmn.pound.quot.raquo.reg.sect.shy.sup1.sup2.sup3.szlig.thorn.times.uacute.ucirc.ugrave.uml.uuml.yacute.yen.yuml`.split(`.`),n=/["&'<>`]/g,r=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,i=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,a=/[|\\{}()[\]^$+*?.]/g,o=/* @__PURE__ */ new WeakMap;function s(e,t){return e=e.replace(t.subset?c(t.subset):n,o),t.subset||t.escapeOnly?e:e.replace(r,a).replace(i,o);function a(e,n,r){return t.format((e.charCodeAt(0)-55296)*1024+e.charCodeAt(1)-56320+65536,r.charCodeAt(n+2),t)}function o(e,n,r){return t.format(e.charCodeAt(0),r.charCodeAt(n+1),t)}}function c(e){let t=o.get(e);return t||(t=l(e),o.set(e,t)),t}function l(e){let t=[],n=-1;for(;++n<e.length;)t.push(e[n].replace(a,`\\$&`));return RegExp(`(?:`+t.join(`|`)+`)`,`g`)}var u=/[\dA-Fa-f]/;function d(e,t,n){let r=`&#x`+e.toString(16).toUpperCase();return n&&t&&!u.test(String.fromCharCode(t))?r:r+`;`}var f=/\d/;function p(e,t,n){let r=`&#`+String(e);return n&&t&&!f.test(String.fromCharCode(t))?r:r+`;`}var m={nbsp:`\xA0`,iexcl:`¡`,cent:`¢`,pound:`£`,curren:`¤`,yen:`¥`,brvbar:`¦`,sect:`§`,uml:`¨`,copy:`©`,ordf:`ª`,laquo:`«`,not:`¬`,shy:`­`,reg:`®`,macr:`¯`,deg:`°`,plusmn:`±`,sup2:`²`,sup3:`³`,acute:`´`,micro:`µ`,para:`¶`,middot:`·`,cedil:`¸`,sup1:`¹`,ordm:`º`,raquo:`»`,frac14:`¼`,frac12:`½`,frac34:`¾`,iquest:`¿`,Agrave:`À`,Aacute:`Á`,Acirc:`Â`,Atilde:`Ã`,Auml:`Ä`,Aring:`Å`,AElig:`Æ`,Ccedil:`Ç`,Egrave:`È`,Eacute:`É`,Ecirc:`Ê`,Euml:`Ë`,Igrave:`Ì`,Iacute:`Í`,Icirc:`Î`,Iuml:`Ï`,ETH:`Ð`,Ntilde:`Ñ`,Ograve:`Ò`,Oacute:`Ó`,Ocirc:`Ô`,Otilde:`Õ`,Ouml:`Ö`,times:`×`,Oslash:`Ø`,Ugrave:`Ù`,Uacute:`Ú`,Ucirc:`Û`,Uuml:`Ü`,Yacute:`Ý`,THORN:`Þ`,szlig:`ß`,agrave:`à`,aacute:`á`,acirc:`â`,atilde:`ã`,auml:`ä`,aring:`å`,aelig:`æ`,ccedil:`ç`,egrave:`è`,eacute:`é`,ecirc:`ê`,euml:`ë`,igrave:`ì`,iacute:`í`,icirc:`î`,iuml:`ï`,eth:`ð`,ntilde:`ñ`,ograve:`ò`,oacute:`ó`,ocirc:`ô`,otilde:`õ`,ouml:`ö`,divide:`÷`,oslash:`ø`,ugrave:`ù`,uacute:`ú`,ucirc:`û`,uuml:`ü`,yacute:`ý`,thorn:`þ`,yuml:`ÿ`,fnof:`ƒ`,Alpha:`Α`,Beta:`Β`,Gamma:`Γ`,Delta:`Δ`,Epsilon:`Ε`,Zeta:`Ζ`,Eta:`Η`,Theta:`Θ`,Iota:`Ι`,Kappa:`Κ`,Lambda:`Λ`,Mu:`Μ`,Nu:`Ν`,Xi:`Ξ`,Omicron:`Ο`,Pi:`Π`,Rho:`Ρ`,Sigma:`Σ`,Tau:`Τ`,Upsilon:`Υ`,Phi:`Φ`,Chi:`Χ`,Psi:`Ψ`,Omega:`Ω`,alpha:`α`,beta:`β`,gamma:`γ`,delta:`δ`,epsilon:`ε`,zeta:`ζ`,eta:`η`,theta:`θ`,iota:`ι`,kappa:`κ`,lambda:`λ`,mu:`μ`,nu:`ν`,xi:`ξ`,omicron:`ο`,pi:`π`,rho:`ρ`,sigmaf:`ς`,sigma:`σ`,tau:`τ`,upsilon:`υ`,phi:`φ`,chi:`χ`,psi:`ψ`,omega:`ω`,thetasym:`ϑ`,upsih:`ϒ`,piv:`ϖ`,bull:`•`,hellip:`…`,prime:`′`,Prime:`″`,oline:`‾`,frasl:`⁄`,weierp:`℘`,image:`ℑ`,real:`ℜ`,trade:`™`,alefsym:`ℵ`,larr:`←`,uarr:`↑`,rarr:`→`,darr:`↓`,harr:`↔`,crarr:`↵`,lArr:`⇐`,uArr:`⇑`,rArr:`⇒`,dArr:`⇓`,hArr:`⇔`,forall:`∀`,part:`∂`,exist:`∃`,empty:`∅`,nabla:`∇`,isin:`∈`,notin:`∉`,ni:`∋`,prod:`∏`,sum:`∑`,minus:`−`,lowast:`∗`,radic:`√`,prop:`∝`,infin:`∞`,ang:`∠`,and:`∧`,or:`∨`,cap:`∩`,cup:`∪`,int:`∫`,there4:`∴`,sim:`∼`,cong:`≅`,asymp:`≈`,ne:`≠`,equiv:`≡`,le:`≤`,ge:`≥`,sub:`⊂`,sup:`⊃`,nsub:`⊄`,sube:`⊆`,supe:`⊇`,oplus:`⊕`,otimes:`⊗`,perp:`⊥`,sdot:`⋅`,lceil:`⌈`,rceil:`⌉`,lfloor:`⌊`,rfloor:`⌋`,lang:`〈`,rang:`〉`,loz:`◊`,spades:`♠`,clubs:`♣`,hearts:`♥`,diams:`♦`,quot:`"`,amp:`&`,lt:`<`,gt:`>`,OElig:`Œ`,oelig:`œ`,Scaron:`Š`,scaron:`š`,Yuml:`Ÿ`,circ:`ˆ`,tilde:`˜`,ensp:` `,emsp:` `,thinsp:` `,zwnj:`‌`,zwj:`‍`,lrm:`‎`,rlm:`‏`,ndash:`–`,mdash:`—`,lsquo:`‘`,rsquo:`’`,sbquo:`‚`,ldquo:`“`,rdquo:`”`,bdquo:`„`,dagger:`†`,Dagger:`‡`,permil:`‰`,lsaquo:`‹`,rsaquo:`›`,euro:`€`},h=[`cent`,`copy`,`divide`,`gt`,`lt`,`not`,`para`,`times`],g={}.hasOwnProperty,_={},v;for(v in m)g.call(m,v)&&(_[m[v]]=v);var y=/[^\dA-Za-z]/;function b(e,n,r,i){let a=String.fromCharCode(e);if(g.call(_,a)){let e=_[a],o=`&`+e;return r&&t.includes(e)&&!h.includes(e)&&(!i||n&&n!==61&&y.test(String.fromCharCode(n)))?o:o+`;`}return``}function x(e,t,n){let r=d(e,t,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=b(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){let i=p(e,t,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return i&&(!n.useShortestReferences||i.length<r.length)?i:r}function S(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function C(e,t){return s(e,Object.assign({format:x},t))}function w(e,t){return s(e,Object.assign({format:S},t))}var T={}.hasOwnProperty;function E(e,t){let n=t||{};function r(t,...n){let i=r.invalid,a=r.handlers;if(t&&T.call(t,e)){let n=String(t[e]);i=T.call(a,n)?a[n]:r.unknown}if(i)return i.call(this,t,...n)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}export{e as a,t as i,C as n,w as r,E as t};
@@ -0,0 +1 @@
1
+ export {}
@@ -0,0 +1 @@
1
+ import{f as e,n as t,s as n,t as r}from"./assets/routes-D7tEdYGV.js";import{n as i}from"./assets/config-Pm_BHLNT.js";import{t as a}from"./assets/errors-DkJ5E_ak.js";var o=document.getElementById(n),s=document.getElementById(`astronaut-cms-signin`);function c(e,t){let n=s?.querySelector(`a`),r=s?.querySelector(`p`);n&&(n.href=e),r&&t&&(r.textContent=t,r.hidden=!1),s&&(s.hidden=!1)}async function l(){if(!o)return;let n=await r(t(e),{headers:{accept:`application/json`}});if(!n.ok)throw Error(`The CMS did not answer (${n.status}).`);let a=await n.json(),s=a.error??new URLSearchParams(window.location.search).get(`error`);if(!a.config){if(a.autoLogin&&!s){window.location.replace(a.loginUrl);return}c(a.loginUrl,s??void 0);return}i(a.config),document.documentElement.lang=a.config.locale;let{mount:l}=await import(`./assets/client-VKp75fDU.js`);l(o)}l().catch(e=>{c(``,a(e,`The CMS failed to load.`))});
@@ -0,0 +1,57 @@
1
+ import { ReactElement, ReactNode } from "react";
2
+ import { RootContent } from "mdast";
3
+ /** `name="value"`, or `name={expression}` with the expression as source text. */
4
+ interface MdxJsxAttribute {
5
+ type: "mdxJsxAttribute";
6
+ name: string;
7
+ value?: string | {
8
+ type: "mdxJsxAttributeValueExpression";
9
+ value: string;
10
+ } | null;
11
+ }
12
+ /** `{...expression}`, as source text. */
13
+ interface MdxJsxExpressionAttribute {
14
+ type: "mdxJsxExpressionAttribute";
15
+ value: string;
16
+ }
17
+ /** The MDX element a component is written as. */
18
+ interface MdxJsxElement {
19
+ type: "mdxJsxFlowElement" | "mdxJsxTextElement";
20
+ name: string | null;
21
+ attributes: (MdxJsxAttribute | MdxJsxExpressionAttribute)[];
22
+ children: RootContent[];
23
+ }
24
+ /** The props a custom editor is rendered with. */
25
+ interface JsxEditorProps {
26
+ /** The element being edited. */
27
+ mdastNode: MdxJsxElement;
28
+ /** The component the element renders. */
29
+ descriptor: {
30
+ name: string | null;
31
+ kind: "flow" | "text";
32
+ hasChildren?: boolean;
33
+ };
34
+ }
35
+ /** A component's own editor in the admin, in place of the generated form. */
36
+ type JsxEditor = (props: JsxEditorProps) => ReactNode;
37
+ interface NestedLexicalEditorProps {
38
+ /** The part of the element to edit, usually its `children`. */
39
+ getContent: (node: MdxJsxElement) => RootContent[];
40
+ /** The element with the edited content put back. */
41
+ getUpdatedMdastNode: (node: MdxJsxElement, content: RootContent[]) => MdxJsxElement;
42
+ /** Whether the content is blocks (paragraphs, lists) rather than inline text. */
43
+ block?: boolean;
44
+ }
45
+ /** The runtime exports of `astronaut-cms/editor`. */
46
+ interface EditorExports {
47
+ /** A rich-text editor for content nested inside the element, such as its children. */
48
+ NestedLexicalEditor: (props: NestedLexicalEditorProps) => ReactElement;
49
+ /** Merges fields into the element being edited. */
50
+ useMdastNodeUpdater: () => (node: Partial<MdxJsxElement>) => void;
51
+ /** Removes the element being edited from the document. */
52
+ useLexicalNodeRemove: () => () => void;
53
+ }
54
+ export declare const NestedLexicalEditor: EditorExports["NestedLexicalEditor"];
55
+ export declare const useMdastNodeUpdater: EditorExports["useMdastNodeUpdater"];
56
+ export declare const useLexicalNodeRemove: EditorExports["useLexicalNodeRemove"];
57
+ export type { EditorExports, JsxEditor, JsxEditorProps, MdxJsxAttribute, MdxJsxElement, MdxJsxExpressionAttribute, NestedLexicalEditorProps };
@@ -0,0 +1 @@
1
+ export{t as NestedLexicalEditor,n as useLexicalNodeRemove,r as useMdastNodeUpdater}from"./assets/editor-FGqMznBK.js";
@@ -0,0 +1,2 @@
1
+ import { i as resolveImage, n as ResolvedImage, r as resolveFile, t as MediaRegistry } from "./chunks/index-CYbkNvu5.js";
2
+ export { MediaRegistry, ResolvedImage, resolveFile, resolveImage };
@@ -0,0 +1,30 @@
1
+ import { m as mediaPath, x as assetKey } from "./chunks/media-BhqUVVYY.js";
2
+ import { join } from "pathe";
3
+ import { files, images, media } from "virtual:astronaut-cms/assets";
4
+ // src/assets/index.ts
5
+ /**
6
+ * The one place the libraries are told apart, so a new one is added here rather
7
+ * than in every exported resolver. A repository asset is loaded through the map,
8
+ * and an object-store URL passes through, or, for a dev run whose store is the
9
+ * working tree, becomes the file there, loaded through the map like any other.
10
+ */
11
+ async function resolve$1(map, kind, ref, base) {
12
+ const location = mediaPath(ref, media, base);
13
+ if (location?.library !== "s3") return load(map, kind, assetKey(ref, base));
14
+ const directory = media.s3?.directory;
15
+ return directory == null ? ref : load(map, kind, join("/", directory, location.path));
16
+ }
17
+ function load(map, kind, key) {
18
+ const loader = map[key];
19
+ if (!loader) throw new Error(`CMS ${kind} not found: ${key}`);
20
+ return loader();
21
+ }
22
+ /**
23
+ * Resolve an asset reference to optimized image metadata, or, for an
24
+ * object-store file, to the URL the image is served under. Absolute paths need
25
+ * no `base`, relative paths resolve against `base` (e.g. `entry.filePath`).
26
+ */
27
+ var resolveImage = async (path, base) => await resolve$1(images, "image", path, base);
28
+ /** Resolve an asset path to a file URL. See {@link resolveImage} for base semantics. */
29
+ var resolveFile = async (path, base) => resolve$1(files, "file", path, base);
30
+ export { resolveFile, resolveImage };
@@ -0,0 +1,86 @@
1
+ import { d as diagnostic } from "./field-schema-CfdN75jT.js";
2
+ // src/shared/links.ts
3
+ var LINK_PROTOCOLS = [
4
+ "http:",
5
+ "https:",
6
+ "mailto:",
7
+ "tel:"
8
+ ];
9
+ var NAVIGABLE_PROTOCOLS = /* @__PURE__ */ new Set([
10
+ ...LINK_PROTOCOLS,
11
+ "javascript:",
12
+ "vbscript:",
13
+ "data:",
14
+ "blob:",
15
+ "file:",
16
+ "ftp:",
17
+ "ws:",
18
+ "wss:"
19
+ ]);
20
+ var BASE = new URL("https://relative.invalid/");
21
+ var LINK_KINDS = "relative, http, https, mailto or tel URL";
22
+ var LINK_MESSAGE = `Expected a ${LINK_KINDS}.`;
23
+ var LINK_DESCRIPTION = `A ${LINK_KINDS}.`;
24
+ var PLAIN_TEXT_MESSAGE = "Plain text may not be a link. Declare the field with link() to hold a URL.";
25
+ var resolve = (value) => URL.parse(value, BASE);
26
+ /** Whether a value declared as a link points somewhere a visitor may follow. */
27
+ function isAllowedLink(value) {
28
+ const url = resolve(value);
29
+ return url !== null && LINK_PROTOCOLS.includes(url.protocol);
30
+ }
31
+ /** Limits a string schema to the links a visitor may follow. */
32
+ function allowedLinks(schema) {
33
+ return schema.refine(isAllowedLink, LINK_MESSAGE);
34
+ }
35
+ /**
36
+ * Whether plain text would act as a link if rendered as an `href`: it resolves
37
+ * off the page, to a scheme a browser acts on or to another host. Prose that
38
+ * merely contains a colon ("ISBN:978", "Update: new pricing") does not.
39
+ */
40
+ function isLinkLike(value) {
41
+ if (!/:|[\\/]{2}/.test(value.replace(/[\t\n\r]/g, ""))) return false;
42
+ const url = resolve(value);
43
+ return url !== null && !url.href.startsWith(BASE.href) && NAVIGABLE_PROTOCOLS.has(url.protocol);
44
+ }
45
+ /** Whether any string inside a value of unknown shape acts as a link. */
46
+ function containsLink(value) {
47
+ if (typeof value === "string") return isLinkLike(value);
48
+ if (Array.isArray(value)) return value.some(containsLink);
49
+ if (value && typeof value === "object") return Object.values(value).some(containsLink);
50
+ return false;
51
+ }
52
+ // src/shared/anchors.ts
53
+ var ANCHOR_MESSAGE = "Expected an anchor id without # or spaces, such as contact.";
54
+ var ANCHOR_DESCRIPTION = "An element id, which a link in the same entry targets as #id.";
55
+ /** Whether a value can be an element id that a link reaches as `#value`. */
56
+ var isAnchor = (value) => /^[^\s#]+$/.test(value);
57
+ /** Limits a string schema to anchor ids. */
58
+ function anchorIds(schema) {
59
+ return schema.refine(isAnchor, ANCHOR_MESSAGE);
60
+ }
61
+ var IMPLICIT_FRAGMENTS = /* @__PURE__ */ new Set(["", "top"]);
62
+ function fragment(link) {
63
+ if (!link.startsWith("#")) return null;
64
+ try {
65
+ return decodeURIComponent(link.slice(1));
66
+ } catch {
67
+ return link.slice(1);
68
+ }
69
+ }
70
+ /**
71
+ * Every link to `#id` among an entry's leaves that names none of its anchors,
72
+ * and every anchor defined twice, which leaves a link to it ambiguous.
73
+ */
74
+ function checkAnchors(leaves) {
75
+ const anchors = leaves.filter((leaf) => leaf.kind === "anchor");
76
+ const ids = new Set(anchors.map((anchor) => anchor.value));
77
+ const known = ids.size ? `The anchors of this entry are ${[...ids].map((id) => `#${id}`).join(", ")}.` : "This entry defines no anchors. A prop that renders an id has to be declared with anchor().";
78
+ const duplicates = anchors.filter((anchor, index) => anchors.findIndex((other) => other.value === anchor.value) !== index).map((anchor) => diagnostic(`defines the anchor "${anchor.value}" again, which has to be unique on the page.`, anchor.path));
79
+ const dead = leaves.flatMap((leaf) => {
80
+ const id = leaf.kind === "link" ? fragment(leaf.value) : null;
81
+ if (id === null || IMPLICIT_FRAGMENTS.has(id.toLowerCase()) || ids.has(id)) return [];
82
+ return diagnostic(`links to "#${id}", which no anchor of this entry defines. ${known}`, leaf.path);
83
+ });
84
+ return [...duplicates, ...dead];
85
+ }
86
+ export { LINK_MESSAGE as a, containsLink as c, LINK_DESCRIPTION as i, isAllowedLink as l, anchorIds as n, PLAIN_TEXT_MESSAGE as o, checkAnchors as r, allowedLinks as s, ANCHOR_DESCRIPTION as t, isLinkLike as u };
@@ -0,0 +1,44 @@
1
+ // src/shared/auth.ts
2
+ /**
3
+ * Who issued the session. `local` is `astro dev` against the working tree, which
4
+ * has no provider and therefore no sign-in at all.
5
+ */
6
+ var PROVIDERS = [
7
+ "github",
8
+ "gitlab",
9
+ "local"
10
+ ];
11
+ /** The element the shell renders and the admin mounts into, carrying the site's routing. */
12
+ var ADMIN_ROOT_ID = "astronaut-cms-root";
13
+ /** Root-relative prefix of everything the CMS serves. Astro prepends the site `base`. */
14
+ var CMS_BASE = "/_astronaut-cms";
15
+ /** Root-relative base of the CMS API. */
16
+ var API_BASE = `${CMS_BASE}/api`;
17
+ /** Injected-route pattern covering every CMS API path (see `server/endpoint.ts`). */
18
+ var API_PATTERN = `${API_BASE}/[...path]`;
19
+ var API_LOGIN = `${API_BASE}/login`;
20
+ var API_CALLBACK = `${API_BASE}/callback`;
21
+ /** Root-relative path of the notices of the packages the admin bundles. */
22
+ var LICENSES_PATH = `${CMS_BASE}/THIRD_PARTY_LICENSES.txt`;
23
+ /**
24
+ * Optional. The session cookie's key is derived from the OAuth client secret by
25
+ * default, which every deployment already holds, so nothing has to be generated
26
+ * or seeded. Set this to key sessions off something else instead, to expire
27
+ * them without touching the OAuth app, or to share one session across services.
28
+ */
29
+ var SESSION_SECRET_ENV = "ASTRONAUT_CMS_SESSION_SECRET";
30
+ /** The OAuth client secret of the configured GitHub App or GitLab application. */
31
+ var GITHUB_CLIENT_SECRET_ENV = "ASTRONAUT_CMS_GITHUB_CLIENT_SECRET";
32
+ var GITLAB_CLIENT_SECRET_ENV = "ASTRONAUT_CMS_GITLAB_CLIENT_SECRET";
33
+ /**
34
+ * Set by Cloudflare Access on every request it lets through. Its presence means
35
+ * the editor has already signed in to the identity provider in front of this
36
+ * site, which is why the admin starts the provider redirect itself instead of
37
+ * showing a sign-in button.
38
+ *
39
+ * Deliberately not verified: it is read as a hint about what to render, never as
40
+ * a permission. Forging it buys nothing, because the redirect it triggers still
41
+ * has to complete a real OAuth exchange.
42
+ */
43
+ var CF_ACCESS_HEADER = "cf-access-jwt-assertion";
44
+ export { API_PATTERN as a, GITLAB_CLIENT_SECRET_ENV as c, SESSION_SECRET_ENV as d, API_LOGIN as i, LICENSES_PATH as l, API_BASE as n, CF_ACCESS_HEADER as o, API_CALLBACK as r, GITHUB_CLIENT_SECRET_ENV as s, ADMIN_ROOT_ID as t, PROVIDERS as u };
@@ -0,0 +1,78 @@
1
+ import { a as CMS_LOCALIZED, i as CMS_LINK, n as CMS_FILE, o as CMS_REFERENCE, r as CMS_IMAGE, t as CMS_ANCHOR } from "./field-schema-CfdN75jT.js";
2
+ import { n as anchorIds, s as allowedLinks } from "./anchors-DuZ1fokt.js";
3
+ import { z } from "zod";
4
+ // src/shared/cms-markers.ts
5
+ /**
6
+ * The single source of the CMS asset/reference marker factories. A marker is a
7
+ * Zod string tagged with one of the `CMS_*` meta keys from `field-schema.ts`,
8
+ * which `zodToFieldSchema` reads back to produce an image/file/reference field.
9
+ *
10
+ * Used by the public `astronaut-cms/config` helpers (`file`/`link`/`anchor`), the
11
+ * `astro:content` stub (`reference`), and the content-config schema helper bag.
12
+ *
13
+ * In a `content.config.ts` `repoImageMarker` stands in for astro's own schema
14
+ * helper while the integration reads the config in Node: astro's `image()` is
15
+ * what the real build runs, and the marker is only how the admin learns the field
16
+ * takes a repository image. In a `cms.config.ts` the markers are the real thing,
17
+ * since astro has no say over an MDX component's props.
18
+ */
19
+ /** Astro's collection `image()` as the admin reads it: an image in the repository library alone. */
20
+ var repoImageMarker = () => z.string().meta({ [CMS_IMAGE]: "repo" });
21
+ /**
22
+ * A collection image field that takes a file from either media library: an
23
+ * object-store URL as it is, or anything else through astro's own `image()`,
24
+ * which imports a repository file as ever. Typed as what arrives, so rendering a
25
+ * URL where only `ImageMetadata` is handled is a compile error rather than a
26
+ * failed build. The URL is left to astro, which optimizes it as a remote image,
27
+ * and whether it names a library file is checked when content is written.
28
+ *
29
+ * @example
30
+ * ```ts
31
+ * schema: ({ image }) => z.object({ cover: libraryImage(image) })
32
+ * ```
33
+ */
34
+ function libraryImage(image) {
35
+ return z.union([z.url(), image()]).meta({ [CMS_IMAGE]: true });
36
+ }
37
+ /** A Zod string naming a file in the media library, resolved to a bundled URL. */
38
+ var fileMarker = () => z.string().meta({ [CMS_FILE]: true });
39
+ /**
40
+ * A Zod string holding a URL: relative, http, https, mailto or tel. The only
41
+ * field a URL may be written into, since plain text is refused as one. The check
42
+ * is part of the schema itself, so the site's own content validation enforces it
43
+ * too, not only the CMS.
44
+ */
45
+ var linkMarker = () => allowedLinks(z.string()).meta({ [CMS_LINK]: true });
46
+ /**
47
+ * A Zod string holding an element id that the component or layout renders, such
48
+ * as a section's `id`. Declaring it is what lets a `#id` link in the same entry
49
+ * be checked, since the CMS cannot tell which prop ends up as an id otherwise.
50
+ */
51
+ var anchorMarker = () => anchorIds(z.string()).meta({ [CMS_ANCHOR]: true });
52
+ /**
53
+ * One value per content language, such as a translated title in an otherwise
54
+ * language-neutral entry. Stored as `{ de: "…", en: "…" }` and read with
55
+ * `pickLocale` from `astronaut-cms/content`. The admin edits it in a tab per
56
+ * language, and the default language is required, which the build and every
57
+ * save check, since only the CMS knows the site's languages.
58
+ */
59
+ var localizedMarker = (schema) => z.record(z.string(), schema).meta({ [CMS_LOCALIZED]: true });
60
+ /** A Zod string that references an entry id in another collection. */
61
+ var referenceMarker = (collection) => z.string().meta({ [CMS_REFERENCE]: collection });
62
+ /**
63
+ * What a component's props function is handed, mirroring the `({ image })` bag
64
+ * astro gives a collection schema. Handing them in rather than exporting them is
65
+ * what keeps an `image()` meant for a component prop out of a `content.config.ts`,
66
+ * where astro's own helper is the only one that resolves.
67
+ */
68
+ function schemaHelpers(resolveImage) {
69
+ return {
70
+ image: () => z.string().pipe(z.transform((path) => resolveImage(path)).meta({ [CMS_IMAGE]: true })),
71
+ file: fileMarker,
72
+ link: linkMarker,
73
+ anchor: anchorMarker,
74
+ localized: localizedMarker,
75
+ reference: referenceMarker
76
+ };
77
+ }
78
+ export { localizedMarker as a, schemaHelpers as c, linkMarker as i, fileMarker as n, referenceMarker as o, libraryImage as r, repoImageMarker as s, anchorMarker as t };
@@ -0,0 +1,128 @@
1
+ // src/shared/http.ts
2
+ /**
3
+ * What every CMS-owned response and every CMS-owned request body has in common,
4
+ * so no injected route has to restate it.
5
+ */
6
+ /**
7
+ * Hardening headers carried by every response the CMS serves. `nosniff` keeps a
8
+ * body from being interpreted as something other than the type it declares, and
9
+ * `no-referrer` keeps repository, entry and media paths out of the `Referer` of
10
+ * everything the admin reaches. The cross-origin policies keep other sites from
11
+ * embedding what the CMS serves or holding a handle on the admin's window, which
12
+ * the admin needs neither of, since it opens nothing it talks back to.
13
+ *
14
+ * Deliberately no `Permissions-Policy`: WebMCP is gated by the `tools` feature,
15
+ * which is allowed for a document's own origin only while nothing says
16
+ * otherwise. Adding a policy here has to name `tools=(self)`, or the admin's
17
+ * tool registration starts failing with `NotAllowedError`.
18
+ */
19
+ var HARDENING_HEADERS = {
20
+ "x-content-type-options": "nosniff",
21
+ "referrer-policy": "no-referrer",
22
+ "cross-origin-resource-policy": "same-origin",
23
+ "cross-origin-opener-policy": "same-origin"
24
+ };
25
+ /**
26
+ * Marks a request that is about to change content, for the dev server's reload
27
+ * suppression. Set by the admin rather than inferred from the method, because
28
+ * every operation is a POST and only the caller knows which one it is sending.
29
+ */
30
+ var WRITE_HEADER = "x-astronaut-cms-write";
31
+ /** Thrown by {@link readBody} when a request body exceeds a route's limit. */
32
+ var BodyTooLargeError = class extends Error {
33
+ constructor(maxBytes) {
34
+ super(`Request body is larger than the ${maxBytes} byte limit for this endpoint.`);
35
+ this.name = "BodyTooLargeError";
36
+ }
37
+ };
38
+ /**
39
+ * The body as it arrives, refusing anything over `maxBytes`. A route that
40
+ * forwards a body to a paid upstream, spends a secret on it, or holds it in a
41
+ * serverless instance's memory cannot let the caller choose its size, and
42
+ * `content-length` is only a claim, so the stream is measured as it is read and
43
+ * abandoned the moment it goes over.
44
+ *
45
+ * Yields the chunks rather than a body, so the two readers below each build the
46
+ * shape they want without either paying for the other's.
47
+ */
48
+ async function* chunks(request, maxBytes) {
49
+ const declared = Number(request.headers.get("content-length"));
50
+ if (Number.isFinite(declared) && declared > maxBytes) throw new BodyTooLargeError(maxBytes);
51
+ let size = 0;
52
+ for await (const value of request.body ?? []) {
53
+ size += value.length;
54
+ if (size > maxBytes) throw new BodyTooLargeError(maxBytes);
55
+ yield value;
56
+ }
57
+ }
58
+ /** The body as bytes, for an upload. */
59
+ async function readBytes(request, maxBytes) {
60
+ return new Blob(await Array.fromAsync(chunks(request, maxBytes))).bytes();
61
+ }
62
+ /**
63
+ * The body as text, for the routes whose bodies are JSON. Decoded as it arrives,
64
+ * so a multi-byte character split across two chunks survives and the bytes are
65
+ * never held twice.
66
+ */
67
+ async function readBody(request, maxBytes) {
68
+ const decoder = new TextDecoder();
69
+ let text = "";
70
+ for await (const chunk of chunks(request, maxBytes)) text += decoder.decode(chunk, { stream: true });
71
+ return text + decoder.decode();
72
+ }
73
+ /**
74
+ * A single `bytes=` range, which is all a media element asks for. Anything else
75
+ * reads as no range at all, and is answered with the whole file, exactly as a
76
+ * server that ignores the header would.
77
+ */
78
+ function parseByteRange(header) {
79
+ const { start, end } = header?.match(/^bytes=(?<start>\d*)-(?<end>\d*)$/)?.groups ?? {};
80
+ if (!start && !end) return null;
81
+ return {
82
+ start: start ? Number(start) : void 0,
83
+ end: end ? Number(end) : void 0
84
+ };
85
+ }
86
+ /** The header a range is forwarded upstream with. Inverse of {@link parseByteRange}. */
87
+ var rangeHeader = ({ start, end }) => `bytes=${start ?? ""}-${end ?? ""}`;
88
+ /** Settles a range against the size of the file it addresses. */
89
+ function partialContent({ start, end }, size) {
90
+ const [first, last] = start === void 0 ? [Math.max(size - (end ?? 0), 0), size - 1] : [start, Math.min(end ?? size - 1, size - 1)];
91
+ if (first > last || first >= size) return {
92
+ status: 416,
93
+ contentRange: `bytes */${size}`
94
+ };
95
+ return {
96
+ status: 206,
97
+ contentRange: `bytes ${first}-${last}/${size}`,
98
+ span: {
99
+ start: first,
100
+ end: last
101
+ }
102
+ };
103
+ }
104
+ // src/shared/component-lookup.ts
105
+ /**
106
+ * Every component in the tree with its name, nested child sets included. Generic
107
+ * over the definition so the admin gets its full `ClientComponentDef` back, the
108
+ * build the structural shape it walks with, and the site its live definitions.
109
+ */
110
+ function* componentEntries(tree) {
111
+ for (const [name, def] of Object.entries(tree)) {
112
+ yield [name, def];
113
+ if (typeof def.children === "object") yield* componentEntries(def.children);
114
+ }
115
+ }
116
+ /** Finds a component by name anywhere in the tree, including nested child sets. */
117
+ function findComponent(name, tree) {
118
+ return componentEntries(tree).find(([key]) => key === name)?.[1];
119
+ }
120
+ /**
121
+ * The components written directly inside one: its declared children, the
122
+ * top-level ones inside markdown children, and none inside a leaf.
123
+ */
124
+ function childComponents(def, topLevel) {
125
+ if (def.children === void 0) return {};
126
+ return def.children === "markdown" ? topLevel : def.children;
127
+ }
128
+ export { HARDENING_HEADERS as a, partialContent as c, readBytes as d, BodyTooLargeError as i, rangeHeader as l, componentEntries as n, WRITE_HEADER as o, findComponent as r, parseByteRange as s, childComponents as t, readBody as u };