camox 0.43.0 → 0.45.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 (412) hide show
  1. package/bin/camox.mjs +9 -1
  2. package/dist/components/AuthGate.js +0 -6
  3. package/dist/components/DeviceSelector.js +96 -0
  4. package/dist/components/PlatformLabel.js +20 -24
  5. package/dist/core/components/lexical/HighlightNode.js +1 -1
  6. package/dist/core/components/lexical/InlineContentEditable.js +15 -19
  7. package/dist/core/components/lexical/InlineLexicalEditor.js +54 -74
  8. package/dist/core/components/lexical/InlineStylesPlugin.js +57 -41
  9. package/dist/core/components/lexical/MaxLengthPlugin.js +59 -0
  10. package/dist/core/components/lexical/SelectionBroadcaster.js +55 -56
  11. package/dist/core/components/lexical/SidebarLexicalEditor.js +327 -234
  12. package/dist/core/components/lexical/SummaryToggleGuard.js +42 -0
  13. package/dist/core/components/lexical/TextLinkPopover.js +169 -180
  14. package/dist/core/createApp.d.ts +254 -299
  15. package/dist/core/createApp.js +123 -29
  16. package/dist/core/createBlock.d.ts +5 -5
  17. package/dist/core/createBlock.js +399 -152
  18. package/dist/core/createCollection.d.ts +55 -0
  19. package/dist/core/createCollection.js +93 -0
  20. package/dist/core/createLayout.d.ts +197 -61
  21. package/dist/core/createLayout.js +114 -56
  22. package/dist/core/defineDocument.d.ts +3 -5
  23. package/dist/core/derivedRoutes.js +49 -1
  24. package/dist/core/dom.d.ts +13 -4
  25. package/dist/core/dom.js +44 -1
  26. package/dist/core/editing/BlockEditingRuntime.d.ts +16 -0
  27. package/dist/core/editing/BlockEditingRuntime.js +6 -15
  28. package/dist/core/editing/CompleteBlockEditingRuntime.js +28 -23
  29. package/dist/core/editing/createEditableBlock.d.ts +820 -565
  30. package/dist/core/editing/createEditableBlock.js +2153 -971
  31. package/dist/core/editing/referenceWrites.js +51 -0
  32. package/dist/core/editing/useLatestRecord.js +90 -0
  33. package/dist/core/hooks/useArtifactHost.js +139 -0
  34. package/dist/core/hooks/useFieldSelection.js +43 -18
  35. package/dist/core/hooks/useIsEditable.js +12 -10
  36. package/dist/core/hooks/useOverlayMessage.js +15 -19
  37. package/dist/core/lib/artifact.d.ts +21 -0
  38. package/dist/core/lib/artifact.js +154 -0
  39. package/dist/core/lib/artifactColors.js +123 -0
  40. package/dist/core/lib/artifactData.d.ts +1 -0
  41. package/dist/core/lib/artifactData.js +131 -0
  42. package/dist/core/lib/artifactHost.js +205 -0
  43. package/dist/core/lib/artifactRuntime.js +36 -0
  44. package/dist/core/lib/artifactTheme.js +57 -0
  45. package/dist/core/lib/contentType.d.ts +304 -103
  46. package/dist/core/lib/contentType.js +207 -168
  47. package/dist/core/lib/fieldTypes.js +4 -0
  48. package/dist/core/lib/iconTypes.d.ts +13 -0
  49. package/dist/core/lib/icons.d.ts +6 -0
  50. package/dist/core/lib/icons.js +126 -0
  51. package/dist/core/lib/imagePlaceholder.js +177 -0
  52. package/dist/core/lib/imageTransform.js +1 -1
  53. package/dist/core/lib/lexicalReact.d.ts +3 -1
  54. package/dist/core/lib/lexicalState.js +7 -7
  55. package/dist/core/lib/modifierFormats.js +1 -1
  56. package/dist/core/lib/previewPaused.js +9 -0
  57. package/dist/core/lib/recordScope.js +316 -0
  58. package/dist/core/lib/reference.d.ts +81 -0
  59. package/dist/core/lib/reference.js +29 -0
  60. package/dist/core/lib/textLinks.js +7 -5
  61. package/dist/core/lib/textStyles.d.ts +6 -8
  62. package/dist/core/lib/textStyles.js +5 -5
  63. package/dist/core/notFound.d.ts +7 -0
  64. package/dist/core/notFound.js +11 -0
  65. package/dist/core/pageDestinations.js +6 -3
  66. package/dist/core/recordItem.js +34 -0
  67. package/dist/core/requestContext.d.ts +26 -0
  68. package/dist/core/requestContext.js +20 -0
  69. package/dist/features/canvas/CamoxCanvas.js +1734 -0
  70. package/dist/features/canvas/CanvasBlockFrame.js +353 -0
  71. package/dist/features/canvas/CanvasBlockHeader.js +55 -0
  72. package/dist/features/canvas/CanvasLoadingScreen.js +35 -0
  73. package/dist/features/canvas/CanvasOverlays.js +254 -0
  74. package/dist/features/canvas/CanvasPageEdge.js +87 -0
  75. package/dist/features/canvas/CanvasPageFrame.js +335 -0
  76. package/dist/features/canvas/CanvasPageHeader.js +125 -0
  77. package/dist/features/canvas/CanvasPreviewPageSlot.js +103 -0
  78. package/dist/features/canvas/CanvasShelfMarker.js +255 -0
  79. package/dist/features/canvas/DerivedPagePathInput.js +238 -0
  80. package/dist/features/canvas/canvasCamera.js +229 -0
  81. package/dist/features/canvas/canvasFlight.js +104 -0
  82. package/dist/features/canvas/canvasFrameCapture.js +364 -0
  83. package/dist/features/canvas/canvasFrameDocument.js +317 -0
  84. package/dist/features/canvas/canvasFrameMode.js +53 -0
  85. package/dist/features/canvas/canvasInsertionSeams.js +44 -0
  86. package/dist/features/canvas/canvasItems.js +120 -0
  87. package/dist/features/canvas/canvasOverlayGeometry.js +240 -0
  88. package/dist/features/canvas/canvasPages.js +79 -0
  89. package/dist/features/canvas/canvasScreenSpace.js +26 -0
  90. package/dist/features/canvas/canvasSelection.js +18 -0
  91. package/dist/features/canvas/canvasStore.js +149 -0
  92. package/dist/features/canvas/canvasThumbnails.js +304 -0
  93. package/dist/features/canvas/canvasZoom.js +10 -0
  94. package/dist/features/canvas/sidebar/CanvasInspector.js +202 -0
  95. package/dist/features/canvas/sidebar/CanvasNavigator.js +226 -0
  96. package/dist/features/canvas/sidebar/CanvasSidebar.js +60 -0
  97. package/dist/features/canvas/sidebar/CanvasSidebarFrame.js +48 -0
  98. package/dist/features/canvas/sidebar/CanvasSidebarSkeleton.js +39 -0
  99. package/dist/features/canvas/sidebar/CatalogBlockInspector.js +189 -0
  100. package/dist/features/canvas/sidebar/CuratedPageInspector.js +69 -0
  101. package/dist/features/canvas/sidebar/DerivedPageInspector.js +37 -0
  102. package/dist/features/canvas/sidebar/LayoutPageBlocks.js +78 -0
  103. package/dist/features/canvas/sidebar/LayoutPageOverview.js +71 -0
  104. package/dist/features/canvas/sidebar/PageInspector.js +157 -0
  105. package/dist/features/canvas/sidebar/PageInspectorSkeleton.js +90 -0
  106. package/dist/features/canvas/sidebar/PageOverview.js +27 -0
  107. package/dist/features/canvas/sidebar/SingletonPageInspector.js +31 -0
  108. package/dist/features/canvas/useCanvasCamera.js +803 -0
  109. package/dist/features/canvas/useCanvasFrame.js +149 -0
  110. package/dist/features/canvas/useCanvasFrameInput.js +97 -0
  111. package/dist/features/canvas/useCanvasNearness.js +57 -0
  112. package/dist/features/canvas/useDiscoveredPreviewPaths.js +62 -0
  113. package/dist/features/content/CamoxContent.d.ts +2 -5
  114. package/dist/features/content/CamoxContent.js +174 -271
  115. package/dist/features/content/CollectionItemSheetContext.js +106 -0
  116. package/dist/features/content/ContentAssets.js +315 -0
  117. package/dist/features/content/ContentCollection.js +663 -0
  118. package/dist/features/content/collection-form.js +58 -0
  119. package/dist/features/content/components/AssetCard.js +101 -69
  120. package/dist/features/content/components/AssetCardSkeleton.js +4 -8
  121. package/dist/features/content/components/ContentSidebar.js +129 -18
  122. package/dist/features/content/components/ContentSidebarGroup.js +37 -0
  123. package/dist/features/content/components/DeleteCollectionItemButton.js +202 -0
  124. package/dist/features/content/components/MissingFromLocale.js +282 -0
  125. package/dist/features/content/components/UploadDropZone.js +27 -31
  126. package/dist/features/content/components/UploadProgressDrawer.js +90 -98
  127. package/dist/features/navigation/navigation.d.ts +66 -20
  128. package/dist/features/navigation/navigation.js +257 -90
  129. package/dist/features/og/defaultFonts.js +8 -8
  130. package/dist/features/og/geist-variable-ttf-base64.js +1 -1
  131. package/dist/features/og/imageResponse.d.ts +8 -0
  132. package/dist/features/og/imageResponse.js +26 -0
  133. package/dist/features/page/CuratedPageContent.js +167 -0
  134. package/dist/features/page/DerivedPageContent.js +26 -30
  135. package/dist/features/page/SharedLayoutContent.js +25 -27
  136. package/dist/features/preview/CamoxPreview.d.ts +23 -61
  137. package/dist/features/preview/CamoxPreview.js +811 -507
  138. package/dist/features/preview/EditablePageContent.js +1 -1
  139. package/dist/features/preview/EditablePageExperience.js +16 -22
  140. package/dist/features/preview/components/AddBlockDialog.js +270 -0
  141. package/dist/features/preview/components/AssetFieldEditor.js +173 -154
  142. package/dist/features/preview/components/AssetLightbox.js +194 -136
  143. package/dist/features/preview/components/AssetPickerModal.js +153 -170
  144. package/dist/features/preview/components/BlockActionsPopover.js +150 -149
  145. package/dist/features/preview/components/BlockErrorBoundary.js +8 -12
  146. package/dist/features/preview/components/BlockThumbnail.js +176 -100
  147. package/dist/features/preview/components/CanvasPreview.js +243 -0
  148. package/dist/features/preview/components/CreatePageModal.js +128 -137
  149. package/dist/features/preview/components/DebouncedFieldEditor.js +29 -33
  150. package/dist/features/preview/components/DerivedLayoutDialog.js +46 -29
  151. package/dist/features/preview/components/DrillRow.js +150 -0
  152. package/dist/features/preview/components/FieldOverlayStyles.js +33 -10
  153. package/dist/features/preview/components/FieldToolbar.js +166 -116
  154. package/dist/features/preview/components/Frame.js +108 -20
  155. package/dist/features/preview/components/IconFieldEditor.js +227 -0
  156. package/dist/features/preview/components/ItemFieldsEditor.js +238 -205
  157. package/dist/features/preview/components/LinkFieldEditor.js +135 -139
  158. package/dist/features/preview/components/Metadata.js +22 -30
  159. package/dist/features/preview/components/MobilePreviewDrawer.js +89 -108
  160. package/dist/features/preview/components/MultipleAssetFieldEditor.js +334 -246
  161. package/dist/features/preview/components/OverlayTracker.js +10 -42
  162. package/dist/features/preview/components/Overlays.js +81 -69
  163. package/dist/features/preview/components/PageInfo.js +1748 -0
  164. package/dist/features/preview/components/PageInfoSkeleton.js +51 -0
  165. package/dist/features/preview/components/PageLocationFieldset.js +112 -116
  166. package/dist/features/preview/components/PageNavigatorHeader.js +24 -0
  167. package/dist/features/preview/components/PageNicknameField.js +22 -26
  168. package/dist/features/preview/components/PagePicker.js +145 -147
  169. package/dist/features/preview/components/PageTree.js +525 -532
  170. package/dist/features/preview/components/PreviewActivation.js +28 -32
  171. package/dist/features/preview/components/PreviewPanel.js +620 -319
  172. package/dist/features/preview/components/PreviewToolbar.js +111 -340
  173. package/dist/features/preview/components/RecordCard.js +80 -0
  174. package/dist/features/preview/components/RecordCombobox.js +178 -0
  175. package/dist/features/preview/components/ReferenceFieldEditor.js +149 -0
  176. package/dist/features/preview/components/ReferenceListFieldEditor.js +432 -0
  177. package/dist/features/preview/components/RemovedBlockPlaceholder.js +95 -0
  178. package/dist/features/preview/components/RepeatableItemsList.js +125 -138
  179. package/dist/features/preview/components/SelectionEditor.js +993 -0
  180. package/dist/features/preview/components/ShikiMarkdown.js +14 -18
  181. package/dist/features/preview/components/SidebarSection.js +52 -64
  182. package/dist/features/preview/components/StudioEditingFallback.js +56 -0
  183. package/dist/features/preview/components/UnlinkAssetButton.js +104 -107
  184. package/dist/features/preview/components/blockGridNavigation.js +15 -0
  185. package/dist/features/preview/components/contentFieldSchema.js +8 -0
  186. package/dist/features/preview/components/useFieldWriter.js +200 -0
  187. package/dist/features/preview/components/useRecordView.js +383 -0
  188. package/dist/features/preview/components/useRepeatableItemActions.js +35 -37
  189. package/dist/features/preview/components/useUpdateBlockPosition.js +37 -37
  190. package/dist/features/preview/editingFrame.js +197 -0
  191. package/dist/features/preview/overlayHighlights.js +27 -0
  192. package/dist/features/preview/overlayMessages.js +72 -1
  193. package/dist/features/preview/pageRecord.js +189 -0
  194. package/dist/features/preview/previewConstants.js +6 -2
  195. package/dist/features/preview/previewPageFrame.js +95 -0
  196. package/dist/features/preview/previewPreparation.js +7 -0
  197. package/dist/features/preview/previewSelection.js +33 -59
  198. package/dist/features/preview/previewStore.js +225 -123
  199. package/dist/features/preview/referencePickerFocus.js +29 -0
  200. package/dist/features/preview/repeatableItemTargets.js +56 -0
  201. package/dist/features/preview/selectionReveal.js +21 -0
  202. package/dist/features/preview/usePreviewViewportActions.js +114 -0
  203. package/dist/features/preview/viewportContinuity.js +109 -0
  204. package/dist/features/provider/AuthenticatedCamoxProvider.js +69 -44
  205. package/dist/features/provider/CamoxProvider.d.ts +3 -6
  206. package/dist/features/provider/CamoxProvider.js +38 -50
  207. package/dist/features/provider/CoreCamoxProvider.js +71 -23
  208. package/dist/features/provider/LocalhostPreviewProvider.js +73 -73
  209. package/dist/features/provider/PreviewSignInPage.js +54 -0
  210. package/dist/features/provider/components/CamoxAppContext.js +11 -11
  211. package/dist/features/provider/components/CommandPalette.js +87 -143
  212. package/dist/features/provider/useAdminShortcuts.js +7 -11
  213. package/dist/features/routes/pageRuntime.d.ts +44 -4
  214. package/dist/features/routes/pageRuntime.js +244 -137
  215. package/dist/features/runtime/RuntimeChrome.js +117 -115
  216. package/dist/features/runtime/alternates.js +64 -0
  217. package/dist/features/runtime/analytics.d.ts +7 -0
  218. package/dist/features/runtime/analytics.js +66 -0
  219. package/dist/features/runtime/artifactSources.js +87 -0
  220. package/dist/features/runtime/editingFallback.js +20 -0
  221. package/dist/features/runtime/linkPrefetch.js +97 -0
  222. package/dist/features/runtime/livePages.js +62 -0
  223. package/dist/features/runtime/llmsTxt.js +40 -0
  224. package/dist/features/runtime/loopbackFetch.js +18 -0
  225. package/dist/features/runtime/navigationAccessibility.js +51 -0
  226. package/dist/features/runtime/navigationTarget.js +23 -2
  227. package/dist/features/runtime/pageApp.js +216 -141
  228. package/dist/features/runtime/pageBlockTypes.js +20 -0
  229. package/dist/features/runtime/pageClient.d.ts +2 -4
  230. package/dist/features/runtime/pageClient.js +18 -3
  231. package/dist/features/runtime/pageNavigation.js +254 -32
  232. package/dist/features/runtime/pageServer.d.ts +2 -4
  233. package/dist/features/runtime/pageServer.js +8 -1
  234. package/dist/features/runtime/pageViewport.js +7 -0
  235. package/dist/features/runtime/runtime.d.ts +60 -23
  236. package/dist/features/runtime/runtime.js +779 -166
  237. package/dist/features/runtime/runtimeChromeLoader.js +58 -0
  238. package/dist/features/runtime/runtimeRoutes.d.ts +19 -0
  239. package/dist/features/runtime/runtimeRoutes.js +25 -0
  240. package/dist/features/runtime/scrollRestoration.js +133 -0
  241. package/dist/features/runtime/studioApp.d.ts +4 -3
  242. package/dist/features/runtime/studioApp.js +5 -9
  243. package/dist/features/runtime/studioClient.d.ts +2 -4
  244. package/dist/features/runtime/studioClient.js +12 -3
  245. package/dist/features/runtime/studioServer.d.ts +2 -4
  246. package/dist/features/runtime/studioServer.js +6 -1
  247. package/dist/features/runtime/worker.d.ts +6 -0
  248. package/dist/features/runtime/worker.js +23 -0
  249. package/dist/features/runtime/workerRequest.js +44 -0
  250. package/dist/features/studio/CamoxStudio.d.ts +2 -6
  251. package/dist/features/studio/CamoxStudio.js +34 -49
  252. package/dist/features/studio/FollowAgentProvider.js +338 -0
  253. package/dist/features/studio/components/ChatSidebar.js +356 -0
  254. package/dist/features/studio/components/DraftsControl.js +676 -0
  255. package/dist/features/studio/components/FaviconDialog.js +318 -0
  256. package/dist/features/studio/components/LocalePicker.js +785 -0
  257. package/dist/features/studio/components/Navbar.js +123 -103
  258. package/dist/features/studio/components/ProjectMenu.js +239 -260
  259. package/dist/features/studio/components/RenameDraftDialog.js +206 -0
  260. package/dist/features/studio/components/ReviewDraftSheet.js +1472 -0
  261. package/dist/features/studio/components/ThreadComposer.js +157 -0
  262. package/dist/features/studio/components/ThreadMarkdown.js +113 -0
  263. package/dist/features/studio/components/ThreadMessages.js +270 -0
  264. package/dist/features/studio/components/UserButton.js +34 -23
  265. package/dist/features/studio/draftLabel.js +33 -0
  266. package/dist/features/studio/draftNotice.js +13 -0
  267. package/dist/features/studio/followAgent.js +250 -0
  268. package/dist/features/studio/followAgentContext.js +7 -0
  269. package/dist/features/studio/localeOptions.js +118 -0
  270. package/dist/features/studio/localeSwitch.js +19 -0
  271. package/dist/features/studio/routes.js +48 -1
  272. package/dist/features/studio/studioStore.js +64 -1
  273. package/dist/features/studio/useTheme.js +24 -27
  274. package/dist/features/vite/artifactRuntimeMinification.js +36 -0
  275. package/dist/features/vite/auth.js +1 -50
  276. package/dist/features/vite/blockBoilerplate.js +6 -5
  277. package/dist/features/vite/blockChunks.js +31 -0
  278. package/dist/features/vite/bundlerLogs.js +17 -0
  279. package/dist/features/vite/definitionsSync.js +158 -226
  280. package/dist/features/vite/devAuthentication.js +4 -16
  281. package/dist/features/vite/devSignIn.js +87 -0
  282. package/dist/features/vite/iconGeneration.js +16 -0
  283. package/dist/features/vite/layoutGeneration.js +11 -1
  284. package/dist/features/vite/publishSeededContent.js +30 -0
  285. package/dist/features/vite/routeGeneration.js +6 -7
  286. package/dist/features/vite/runtimeDev.js +80 -99
  287. package/dist/features/vite/vite.d.ts +53 -31
  288. package/dist/features/vite/vite.js +230 -116
  289. package/dist/features/vite/workerBuild.js +39 -0
  290. package/dist/hooks/use-debounced-field.js +116 -47
  291. package/dist/hooks/use-file-upload.js +114 -67
  292. package/dist/hooks/use-marquee-selection.js +32 -36
  293. package/dist/hooks/use-page-destinations.js +69 -37
  294. package/dist/lib/api-client-server.d.ts +5 -0
  295. package/dist/lib/api-client-server.js +10 -4
  296. package/dist/lib/api-client.d.ts +6 -0
  297. package/dist/lib/api-client.js +51 -16
  298. package/dist/lib/api-socket.js +17 -0
  299. package/dist/lib/auth-page-styles.js +39 -0
  300. package/dist/lib/auth.js +139 -60
  301. package/dist/lib/collection-cache.js +23 -0
  302. package/dist/lib/draft-scope.d.ts +4 -0
  303. package/dist/lib/draft-scope.js +222 -0
  304. package/dist/lib/html.js +12 -0
  305. package/dist/lib/link-pages.js +154 -0
  306. package/dist/lib/locale-path.d.ts +22 -0
  307. package/dist/lib/locale-path.js +57 -0
  308. package/dist/lib/normalized-data.js +252 -152
  309. package/dist/lib/preview-handoff.js +13 -0
  310. package/dist/lib/queries.d.ts +11 -0
  311. package/dist/lib/queries.js +71 -131
  312. package/dist/lib/studio-reads.d.ts +14 -0
  313. package/dist/lib/studio-reads.js +574 -0
  314. package/dist/lib/use-project-room.js +50 -47
  315. package/dist/lib/use-thread.js +310 -0
  316. package/dist/lib/utils.js +25 -29
  317. package/dist/lib/view-locale-context.js +22 -0
  318. package/dist/lib/view-locale.js +46 -0
  319. package/dist/package.js +5 -0
  320. package/dist/studio-overlays.css +41 -147
  321. package/dist/studio.css +2 -2
  322. package/package.json +70 -72
  323. package/skills/camox/SKILL.md +16 -5
  324. package/skills/camox/references/artifacts.md +179 -0
  325. package/skills/camox/references/block-definitions.md +98 -55
  326. package/skills/camox/references/cli-common.md +18 -6
  327. package/skills/camox/references/cli-content.md +92 -58
  328. package/skills/camox/references/cli-publishing.md +26 -0
  329. package/skills/camox/references/dom-integrations.md +27 -0
  330. package/skills/camox/references/field-styling.md +7 -7
  331. package/skills/camox/references/layout-definitions.md +16 -14
  332. package/skills/camox/references/localization.md +56 -0
  333. package/skills/camox/references/routed-layouts.md +133 -15
  334. package/skills/camox-expand/SKILL.md +69 -0
  335. package/skills/camox-expand/references/jobs.md +39 -0
  336. package/skills/camoxify/SKILL.md +38 -2
  337. package/dist/core/components/AddBlockControlBar.js +0 -78
  338. package/dist/core/hooks/useRequireDraftSource.js +0 -23
  339. package/dist/features/metadata/sitemap.d.ts +0 -8
  340. package/dist/features/metadata/sitemap.js +0 -17
  341. package/dist/features/og/imageResponse.node.d.ts +0 -12
  342. package/dist/features/og/imageResponse.node.js +0 -49
  343. package/dist/features/og/imageResponse.workerd.d.ts +0 -12
  344. package/dist/features/og/imageResponse.workerd.js +0 -40
  345. package/dist/features/page/PublishedPageContent.js +0 -205
  346. package/dist/features/page/PublishedPageExperience.js +0 -23
  347. package/dist/features/preview/DerivedPreview.js +0 -134
  348. package/dist/features/preview/commentsEnabled.js +0 -8
  349. package/dist/features/preview/components/AddBlockSidebar.js +0 -381
  350. package/dist/features/preview/components/AttachedComments.js +0 -194
  351. package/dist/features/preview/components/CommentHeader.js +0 -122
  352. package/dist/features/preview/components/CommentSidebar.js +0 -29
  353. package/dist/features/preview/components/CommentTargetQuote.js +0 -166
  354. package/dist/features/preview/components/DerivedLayoutSidebar.d.ts +0 -5
  355. package/dist/features/preview/components/DerivedLayoutSidebar.js +0 -179
  356. package/dist/features/preview/components/DerivedPageInfoSidebar.js +0 -69
  357. package/dist/features/preview/components/LeftSidebar.js +0 -68
  358. package/dist/features/preview/components/PageEditorSidebar.js +0 -563
  359. package/dist/features/preview/components/PageInfoSidebar.js +0 -1551
  360. package/dist/features/preview/components/PageNavigatorSidebar.js +0 -78
  361. package/dist/features/preview/components/PageStatusBadge.js +0 -97
  362. package/dist/features/preview/components/PeekedBlock.js +0 -217
  363. package/dist/features/preview/components/PreviewComments.js +0 -56
  364. package/dist/features/preview/components/PreviewToolbarSpacer.js +0 -43
  365. package/dist/features/preview/components/PublicationRow.js +0 -422
  366. package/dist/features/preview/components/PublishDialog.js +0 -194
  367. package/dist/features/preview/components/RightSidebar.js +0 -59
  368. package/dist/features/preview/previewCommentsStore.js +0 -115
  369. package/dist/features/preview/publication.js +0 -81
  370. package/dist/features/runtime/SharedChromeContext.js +0 -7
  371. package/dist/features/studio/components/EnvironmentMenu.js +0 -413
  372. package/dist/features/vite/appGeneration.js +0 -89
  373. package/dist/lib/view-queries.js +0 -28
  374. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/Matches.d.ts +0 -114
  375. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/RouterProvider.d.ts +0 -25
  376. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/config.d.ts +0 -1
  377. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/defer.d.ts +0 -1
  378. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/fileRoute.d.ts +0 -20
  379. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/global.d.ts +0 -8
  380. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/hash-scroll.d.ts +0 -1
  381. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/index.d.ts +0 -18
  382. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/link.d.ts +0 -161
  383. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/load-matches.d.ts +0 -6
  384. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/location.d.ts +0 -54
  385. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/lru-cache.d.ts +0 -8
  386. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/manifest.d.ts +0 -32
  387. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/new-process-route-tree.d.ts +0 -115
  388. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/not-found.d.ts +0 -1
  389. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/redirect.d.ts +0 -49
  390. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/rewrite.d.ts +0 -1
  391. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/root.d.ts +0 -6
  392. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/route.d.ts +0 -343
  393. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/routeInfo.d.ts +0 -48
  394. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/router.d.ts +0 -695
  395. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/scroll-restoration.d.ts +0 -1
  396. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/searchMiddleware.d.ts +0 -1
  397. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/searchParams.d.ts +0 -5
  398. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/ssr/serializer/RawStream.d.ts +0 -38
  399. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/ssr/serializer/seroval-plugins.d.ts +0 -1
  400. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/ssr/serializer/transformer.d.ts +0 -65
  401. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/stores.d.ts +0 -69
  402. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/structuralSharing.d.ts +0 -1
  403. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/typePrimitives.d.ts +0 -1
  404. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useLoaderData.d.ts +0 -1
  405. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useLoaderDeps.d.ts +0 -1
  406. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useNavigate.d.ts +0 -10
  407. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useParams.d.ts +0 -1
  408. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useRouteContext.d.ts +0 -1
  409. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useSearch.d.ts +0 -1
  410. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/utils.d.ts +0 -28
  411. package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/validators.d.ts +0 -49
  412. package/skills/camox/references/cli-environments.md +0 -37
@@ -0,0 +1,1748 @@
1
+ import { useProjectUuid } from "../../../lib/auth.js";
2
+ import { useNavigate } from "../../navigation/navigation.js";
3
+ import { useCamoxApp } from "../../provider/components/CamoxAppContext.js";
4
+ import { reads, useReadQuery, useStudioCache } from "../../../lib/studio-reads.js";
5
+ import { cn } from "../../../lib/utils.js";
6
+ import { UploadDropZone } from "../../content/components/UploadDropZone.js";
7
+ import { pageMutations } from "../../../lib/queries.js";
8
+ import { useDebouncedField } from "../../../hooks/use-debounced-field.js";
9
+ import { DebouncedFieldEditor } from "./DebouncedFieldEditor.js";
10
+ import { Metadata, MetadataRow, formatRelativeTime } from "./Metadata.js";
11
+ import { useLocalizedPath } from "../../../lib/view-locale.js";
12
+ import { PageNicknameField } from "./PageNicknameField.js";
13
+ import { PageInfoSkeleton } from "./PageInfoSkeleton.js";
14
+ import { PageLocationFieldset } from "./PageLocationFieldset.js";
15
+ import { ShikiMarkdown } from "./ShikiMarkdown.js";
16
+ import { c } from "react/compiler-runtime";
17
+ import * as React from "react";
18
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
19
+ import { useMutation } from "@tanstack/react-query";
20
+ import { Button } from "@camox/ui/button";
21
+ import { Input } from "@camox/ui/input";
22
+ import { Label } from "@camox/ui/label";
23
+ import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from "@camox/ui/sheet";
24
+ import { Switch } from "@camox/ui/switch";
25
+ import { useForm } from "@tanstack/react-form";
26
+ import { Globe, Info, Pencil, Trash2, Upload } from "lucide-react";
27
+ import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from "@camox/ui/dialog";
28
+ import { toast } from "@camox/ui/toaster";
29
+ import { Tooltip, TooltipContent, TooltipTrigger } from "@camox/ui/tooltip";
30
+ import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle } from "@camox/ui/alert-dialog";
31
+ import { Spinner } from "@camox/ui/spinner";
32
+ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@camox/ui/select";
33
+ import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupText } from "@camox/ui/input-group";
34
+ import { Accordion, AccordionItem, AccordionPanel } from "@camox/ui/accordion";
35
+ import { Alert, AlertDescription, AlertTitle } from "@camox/ui/alert";
36
+ import { Checkbox } from "@camox/ui/checkbox";
37
+
38
+ //#region src/features/preview/components/PageInfo.tsx
39
+ const usePageMetadataData = (pageId) => {
40
+ const $ = c(29);
41
+ const projectUuid = useProjectUuid();
42
+ const camoxApp = useCamoxApp();
43
+ let t0;
44
+ if ($[0] !== pageId) {
45
+ t0 = reads.page({ id: pageId });
46
+ $[0] = pageId;
47
+ $[1] = t0;
48
+ } else t0 = $[1];
49
+ const { data: page } = useReadQuery(t0);
50
+ let t1;
51
+ if ($[2] !== projectUuid) {
52
+ t1 = reads.project({ projectUuid });
53
+ $[2] = projectUuid;
54
+ $[3] = t1;
55
+ } else t1 = $[3];
56
+ const { data: project } = useReadQuery(t1);
57
+ let t2;
58
+ if ($[4] !== projectUuid) {
59
+ t2 = reads.pageList({ projectUuid });
60
+ $[4] = projectUuid;
61
+ $[5] = t2;
62
+ } else t2 = $[5];
63
+ const t3 = !!project;
64
+ let t4;
65
+ if ($[6] !== t3) {
66
+ t4 = { enabled: t3 };
67
+ $[6] = t3;
68
+ $[7] = t4;
69
+ } else t4 = $[7];
70
+ const { data: pages } = useReadQuery(t2, t4);
71
+ let t5;
72
+ if ($[8] !== project?.id) {
73
+ t5 = reads.layoutList({ projectId: project?.id ?? 0 });
74
+ $[8] = project?.id;
75
+ $[9] = t5;
76
+ } else t5 = $[9];
77
+ const t6 = !!project;
78
+ let t7;
79
+ if ($[10] !== t6) {
80
+ t7 = { enabled: t6 };
81
+ $[10] = t6;
82
+ $[11] = t7;
83
+ } else t7 = $[11];
84
+ const { data: allLayouts } = useReadQuery(t5, t7);
85
+ let t8;
86
+ if ($[12] !== allLayouts || $[13] !== camoxApp) {
87
+ t8 = allLayouts?.filter((layout) => camoxApp.getLayoutById(layout.layoutId)?._internal.kind === "curated");
88
+ $[12] = allLayouts;
89
+ $[13] = camoxApp;
90
+ $[14] = t8;
91
+ } else t8 = $[14];
92
+ const layouts = t8;
93
+ let pageLayoutRecord;
94
+ let t9;
95
+ if ($[15] !== allLayouts || $[16] !== camoxApp || $[17] !== page || $[18] !== project?.name) {
96
+ pageLayoutRecord = allLayouts?.find((l) => l.layoutId === page?.layoutId);
97
+ const layoutDef = pageLayoutRecord ? camoxApp.getLayoutById(pageLayoutRecord.layoutId) : void 0;
98
+ t9 = layoutDef && page ? layoutDef._internal.buildMetaTitle({
99
+ pageMetaTitle: page.metaTitle ?? "",
100
+ projectName: project?.name ?? "",
101
+ pageFullPath: page.fullPath,
102
+ data: void 0,
103
+ params: {}
104
+ }) : page?.metaTitle ?? "";
105
+ $[15] = allLayouts;
106
+ $[16] = camoxApp;
107
+ $[17] = page;
108
+ $[18] = project?.name;
109
+ $[19] = pageLayoutRecord;
110
+ $[20] = t9;
111
+ } else {
112
+ pageLayoutRecord = $[19];
113
+ t9 = $[20];
114
+ }
115
+ const metaTitle = t9;
116
+ let t10;
117
+ if ($[21] !== camoxApp || $[22] !== layouts || $[23] !== metaTitle || $[24] !== page || $[25] !== pageLayoutRecord || $[26] !== pages || $[27] !== project) {
118
+ t10 = {
119
+ page,
120
+ project,
121
+ pages,
122
+ layouts,
123
+ pageLayoutRecord,
124
+ metaTitle,
125
+ camoxApp
126
+ };
127
+ $[21] = camoxApp;
128
+ $[22] = layouts;
129
+ $[23] = metaTitle;
130
+ $[24] = page;
131
+ $[25] = pageLayoutRecord;
132
+ $[26] = pages;
133
+ $[27] = project;
134
+ $[28] = t10;
135
+ } else t10 = $[28];
136
+ return t10;
137
+ };
138
+ const PAGE_SETTINGS_ITEM = "page-settings";
139
+ const SHOW_PAGE_SETTINGS_STORAGE_KEY = "camox:studio:showPageSettings";
140
+ /** Whether the page info shows its settings, remembered across pages and sessions. */
141
+ const useShowPageSettings = () => {
142
+ const $ = c(3);
143
+ const [show, setShow] = React.useState(_temp);
144
+ let t0;
145
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
146
+ t0 = (next) => {
147
+ setShow(next);
148
+ try {
149
+ localStorage.setItem(SHOW_PAGE_SETTINGS_STORAGE_KEY, String(next));
150
+ } catch {}
151
+ };
152
+ $[0] = t0;
153
+ } else t0 = $[0];
154
+ const update = t0;
155
+ let t1;
156
+ if ($[1] !== show) {
157
+ t1 = [show, update];
158
+ $[1] = show;
159
+ $[2] = t1;
160
+ } else t1 = $[2];
161
+ return t1;
162
+ };
163
+ const PageInfo = (t0) => {
164
+ const $ = c(64);
165
+ const { pageId, scrollable: t1, aboutOnly: t2 } = t0;
166
+ const scrollable = t1 === void 0 ? true : t1;
167
+ const aboutOnly = t2 === void 0 ? false : t2;
168
+ const data = usePageMetadataData(pageId);
169
+ const { page, metaTitle } = data;
170
+ const [isStructureModalOpen, setIsStructureModalOpen] = React.useState(false);
171
+ const [isSeoSheetOpen, setIsSeoSheetOpen] = React.useState(false);
172
+ const [isMarkdownSheetOpen, setIsMarkdownSheetOpen] = React.useState(false);
173
+ const [showPageSettings, setShowPageSettings] = useShowPageSettings();
174
+ const showSettingsId = React.useId();
175
+ const settingsPanelId = React.useId();
176
+ if (!page) {
177
+ if (!aboutOnly) {
178
+ let t3;
179
+ if ($[0] !== scrollable) {
180
+ t3 = /* @__PURE__ */ jsx(PageInfoSkeleton, { scrollable });
181
+ $[0] = scrollable;
182
+ $[1] = t3;
183
+ } else t3 = $[1];
184
+ return t3;
185
+ }
186
+ let t3;
187
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
188
+ t3 = /* @__PURE__ */ jsxs("div", {
189
+ className: "text-muted-foreground flex flex-1 items-center justify-center px-2 text-sm",
190
+ children: [/* @__PURE__ */ jsx(Spinner, { className: "mr-2 size-3.5" }), " Loading page info..."]
191
+ });
192
+ $[2] = t3;
193
+ } else t3 = $[2];
194
+ return t3;
195
+ }
196
+ let t3;
197
+ if ($[3] !== data) {
198
+ t3 = /* @__PURE__ */ jsx(PageNicknameEditor, { data });
199
+ $[3] = data;
200
+ $[4] = t3;
201
+ } else t3 = $[4];
202
+ let t4;
203
+ if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
204
+ t4 = /* @__PURE__ */ jsx(Label, { children: "Page path" });
205
+ $[5] = t4;
206
+ } else t4 = $[5];
207
+ let t5;
208
+ if ($[6] !== page.fullPath) {
209
+ t5 = /* @__PURE__ */ jsx(InputGroupText, {
210
+ className: "min-w-0 flex-1 px-2 py-1.5 font-mono font-normal break-all",
211
+ children: page.fullPath
212
+ });
213
+ $[6] = page.fullPath;
214
+ $[7] = t5;
215
+ } else t5 = $[7];
216
+ let t6;
217
+ if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
218
+ t6 = () => setIsStructureModalOpen(true);
219
+ $[8] = t6;
220
+ } else t6 = $[8];
221
+ let t7;
222
+ if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
223
+ t7 = /* @__PURE__ */ jsx(InputGroupAddon, {
224
+ align: "inline-end",
225
+ children: /* @__PURE__ */ jsx(InputGroupButton, {
226
+ type: "button",
227
+ variant: "ghost",
228
+ size: "icon-xs",
229
+ onClick: t6,
230
+ "aria-label": "Edit page structure",
231
+ children: /* @__PURE__ */ jsx(Pencil, {})
232
+ })
233
+ });
234
+ $[9] = t7;
235
+ } else t7 = $[9];
236
+ let t8;
237
+ if ($[10] !== t5) {
238
+ t8 = /* @__PURE__ */ jsxs("div", {
239
+ className: "space-y-2",
240
+ children: [t4, /* @__PURE__ */ jsxs(InputGroup, {
241
+ className: "px-1",
242
+ children: [t5, t7]
243
+ })]
244
+ });
245
+ $[10] = t5;
246
+ $[11] = t8;
247
+ } else t8 = $[11];
248
+ let t9;
249
+ if ($[12] !== data) {
250
+ t9 = /* @__PURE__ */ jsx(PageLayoutSelect, { data });
251
+ $[12] = data;
252
+ $[13] = t9;
253
+ } else t9 = $[13];
254
+ let t10;
255
+ if ($[14] !== t3 || $[15] !== t8 || $[16] !== t9) {
256
+ t10 = /* @__PURE__ */ jsxs("section", {
257
+ className: "space-y-4",
258
+ children: [
259
+ t3,
260
+ t8,
261
+ t9
262
+ ]
263
+ });
264
+ $[14] = t3;
265
+ $[15] = t8;
266
+ $[16] = t9;
267
+ $[17] = t10;
268
+ } else t10 = $[17];
269
+ let t11;
270
+ if ($[18] !== page) {
271
+ t11 = /* @__PURE__ */ jsx(PageDeleteButton, { page });
272
+ $[18] = page;
273
+ $[19] = t11;
274
+ } else t11 = $[19];
275
+ let t12;
276
+ if ($[20] !== page.createdAt) {
277
+ t12 = formatRelativeTime(page.createdAt);
278
+ $[20] = page.createdAt;
279
+ $[21] = t12;
280
+ } else t12 = $[21];
281
+ let t13;
282
+ if ($[22] !== t12) {
283
+ t13 = /* @__PURE__ */ jsx(MetadataRow, {
284
+ label: "Created",
285
+ children: t12
286
+ });
287
+ $[22] = t12;
288
+ $[23] = t13;
289
+ } else t13 = $[23];
290
+ const t14 = page.createdBy ?? "Unknown";
291
+ let t15;
292
+ if ($[24] !== t14) {
293
+ t15 = /* @__PURE__ */ jsx(MetadataRow, {
294
+ label: "Created by",
295
+ children: t14
296
+ });
297
+ $[24] = t14;
298
+ $[25] = t15;
299
+ } else t15 = $[25];
300
+ let t16;
301
+ if ($[26] !== page.updatedAt) {
302
+ t16 = formatRelativeTime(page.updatedAt);
303
+ $[26] = page.updatedAt;
304
+ $[27] = t16;
305
+ } else t16 = $[27];
306
+ let t17;
307
+ if ($[28] !== t16) {
308
+ t17 = /* @__PURE__ */ jsx(MetadataRow, {
309
+ label: "Updated",
310
+ children: t16
311
+ });
312
+ $[28] = t16;
313
+ $[29] = t17;
314
+ } else t17 = $[29];
315
+ let t18;
316
+ if ($[30] !== t13 || $[31] !== t15 || $[32] !== t17) {
317
+ t18 = /* @__PURE__ */ jsxs(Metadata, { children: [
318
+ t13,
319
+ t15,
320
+ t17
321
+ ] });
322
+ $[30] = t13;
323
+ $[31] = t15;
324
+ $[32] = t17;
325
+ $[33] = t18;
326
+ } else t18 = $[33];
327
+ let t19;
328
+ if ($[34] !== t10 || $[35] !== t11 || $[36] !== t18) {
329
+ t19 = /* @__PURE__ */ jsxs(Fragment, { children: [
330
+ t10,
331
+ t11,
332
+ t18
333
+ ] });
334
+ $[34] = t10;
335
+ $[35] = t11;
336
+ $[36] = t18;
337
+ $[37] = t19;
338
+ } else t19 = $[37];
339
+ const pageSettings = t19;
340
+ const t20 = scrollable && "flex-1 overflow-auto";
341
+ let t21;
342
+ if ($[38] !== t20) {
343
+ t21 = cn("space-y-4 p-2 pt-4", t20);
344
+ $[38] = t20;
345
+ $[39] = t21;
346
+ } else t21 = $[39];
347
+ let t22;
348
+ if ($[40] !== aboutOnly || $[41] !== pageSettings || $[42] !== setShowPageSettings || $[43] !== settingsPanelId || $[44] !== showPageSettings || $[45] !== showSettingsId) {
349
+ t22 = aboutOnly ? pageSettings : /* @__PURE__ */ jsxs(Fragment, { children: [
350
+ /* @__PURE__ */ jsxs("div", {
351
+ className: "space-y-2",
352
+ children: [/* @__PURE__ */ jsx(Label, { children: "SEO" }), /* @__PURE__ */ jsx(Button, {
353
+ type: "button",
354
+ variant: "outline",
355
+ className: "w-full",
356
+ onClick: () => setIsSeoSheetOpen(true),
357
+ children: "Manage page metadata"
358
+ })]
359
+ }),
360
+ /* @__PURE__ */ jsxs("div", {
361
+ className: "space-y-2",
362
+ children: [/* @__PURE__ */ jsx(Label, { children: "GEO" }), /* @__PURE__ */ jsx(Button, {
363
+ type: "button",
364
+ variant: "outline",
365
+ className: "w-full",
366
+ onClick: () => setIsMarkdownSheetOpen(true),
367
+ children: "View page markdown"
368
+ })]
369
+ }),
370
+ /* @__PURE__ */ jsxs("div", {
371
+ className: "flex items-center gap-2",
372
+ children: [/* @__PURE__ */ jsx(Checkbox, {
373
+ id: showSettingsId,
374
+ checked: showPageSettings,
375
+ onCheckedChange: setShowPageSettings,
376
+ "aria-controls": settingsPanelId
377
+ }), /* @__PURE__ */ jsx(Label, {
378
+ htmlFor: showSettingsId,
379
+ className: "font-normal",
380
+ children: "Show page settings"
381
+ })]
382
+ }),
383
+ /* @__PURE__ */ jsx(Accordion, {
384
+ value: showPageSettings ? [PAGE_SETTINGS_ITEM] : [],
385
+ children: /* @__PURE__ */ jsx(AccordionItem, {
386
+ value: PAGE_SETTINGS_ITEM,
387
+ children: /* @__PURE__ */ jsx(AccordionPanel, {
388
+ id: settingsPanelId,
389
+ className: "-mx-1 px-1",
390
+ children: /* @__PURE__ */ jsx("div", {
391
+ className: "space-y-4",
392
+ children: pageSettings
393
+ })
394
+ })
395
+ })
396
+ })
397
+ ] });
398
+ $[40] = aboutOnly;
399
+ $[41] = pageSettings;
400
+ $[42] = setShowPageSettings;
401
+ $[43] = settingsPanelId;
402
+ $[44] = showPageSettings;
403
+ $[45] = showSettingsId;
404
+ $[46] = t22;
405
+ } else t22 = $[46];
406
+ let t23;
407
+ if ($[47] !== t21 || $[48] !== t22) {
408
+ t23 = /* @__PURE__ */ jsx("div", {
409
+ className: t21,
410
+ children: t22
411
+ });
412
+ $[47] = t21;
413
+ $[48] = t22;
414
+ $[49] = t23;
415
+ } else t23 = $[49];
416
+ let t24;
417
+ if ($[50] !== isStructureModalOpen || $[51] !== page.id) {
418
+ t24 = /* @__PURE__ */ jsx(PageStructureModal, {
419
+ open: isStructureModalOpen,
420
+ onOpenChange: setIsStructureModalOpen,
421
+ pageId: page.id
422
+ });
423
+ $[50] = isStructureModalOpen;
424
+ $[51] = page.id;
425
+ $[52] = t24;
426
+ } else t24 = $[52];
427
+ let t25;
428
+ if ($[53] !== aboutOnly || $[54] !== isMarkdownSheetOpen || $[55] !== isSeoSheetOpen || $[56] !== metaTitle || $[57] !== page.id || $[58] !== page.metaDescription) {
429
+ t25 = !aboutOnly && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(PageSeoSheet, {
430
+ open: isSeoSheetOpen,
431
+ onOpenChange: setIsSeoSheetOpen,
432
+ pageId: page.id
433
+ }), /* @__PURE__ */ jsx(PageMarkdownSheet, {
434
+ open: isMarkdownSheetOpen,
435
+ onOpenChange: setIsMarkdownSheetOpen,
436
+ pageId: page.id,
437
+ metaTitle,
438
+ metaDescription: page.metaDescription ?? ""
439
+ })] });
440
+ $[53] = aboutOnly;
441
+ $[54] = isMarkdownSheetOpen;
442
+ $[55] = isSeoSheetOpen;
443
+ $[56] = metaTitle;
444
+ $[57] = page.id;
445
+ $[58] = page.metaDescription;
446
+ $[59] = t25;
447
+ } else t25 = $[59];
448
+ let t26;
449
+ if ($[60] !== t23 || $[61] !== t24 || $[62] !== t25) {
450
+ t26 = /* @__PURE__ */ jsxs(Fragment, { children: [
451
+ t23,
452
+ t24,
453
+ t25
454
+ ] });
455
+ $[60] = t23;
456
+ $[61] = t24;
457
+ $[62] = t25;
458
+ $[63] = t26;
459
+ } else t26 = $[63];
460
+ return t26;
461
+ };
462
+ const PageDeleteButton = ({ page }) => {
463
+ const [isConfirmOpen, setIsConfirmOpen] = React.useState(false);
464
+ const deletePage = useMutation(pageMutations.delete());
465
+ const navigate = useNavigate();
466
+ const localized = useLocalizedPath();
467
+ if (page.fullPath === "/") return null;
468
+ const handleDelete = async () => {
469
+ try {
470
+ await deletePage.mutateAsync({ id: page.id });
471
+ toast.success(`Deleted ${page.nickname} page`);
472
+ await navigate({ to: localized("/") });
473
+ } catch (error) {
474
+ console.error("Failed to delete page:", error);
475
+ toast.error(`Could not delete ${page.nickname} page`);
476
+ } finally {
477
+ setIsConfirmOpen(false);
478
+ }
479
+ };
480
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
481
+ className: "space-y-2",
482
+ children: [/* @__PURE__ */ jsx(Label, { children: "Danger zone" }), /* @__PURE__ */ jsxs(Button, {
483
+ type: "button",
484
+ variant: "outline",
485
+ className: "w-full",
486
+ onClick: () => setIsConfirmOpen(true),
487
+ children: [/* @__PURE__ */ jsx(Trash2, {}), "Delete page"]
488
+ })]
489
+ }), /* @__PURE__ */ jsx(AlertDialog, {
490
+ open: isConfirmOpen,
491
+ onOpenChange: setIsConfirmOpen,
492
+ children: /* @__PURE__ */ jsxs(AlertDialogContent, { children: [/* @__PURE__ */ jsxs(AlertDialogHeader, { children: [/* @__PURE__ */ jsx(AlertDialogTitle, { children: "Delete page?" }), /* @__PURE__ */ jsxs(AlertDialogDescription, { children: [/* @__PURE__ */ jsx("strong", { children: page.nickname }), " will be deleted in this draft. Live keeps the page until the draft is published."] })] }), /* @__PURE__ */ jsxs(AlertDialogFooter, { children: [/* @__PURE__ */ jsx(AlertDialogCancel, {
493
+ variant: "outline",
494
+ size: "default",
495
+ children: "Cancel"
496
+ }), /* @__PURE__ */ jsxs(AlertDialogAction, {
497
+ variant: "destructive",
498
+ disabled: deletePage.isPending,
499
+ onClick: () => void handleDelete(),
500
+ children: [deletePage.isPending && /* @__PURE__ */ jsx(Spinner, {}), "Yes, delete this page"]
501
+ })] })] })
502
+ })] });
503
+ };
504
+ const PageNicknameEditor = (t0) => {
505
+ const $ = c(20);
506
+ const { data } = t0;
507
+ const { page } = data;
508
+ let t1;
509
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
510
+ t1 = pageMutations.update();
511
+ $[0] = t1;
512
+ } else t1 = $[0];
513
+ const updatePage = useMutation(t1);
514
+ const inputId = React.useId();
515
+ let t2;
516
+ if ($[1] !== page || $[2] !== updatePage) {
517
+ t2 = (value) => {
518
+ if (!page) return;
519
+ const nickname = value.trim();
520
+ if (nickname === page.nickname) return;
521
+ if (!nickname) {
522
+ toast.error("Page nickname is required");
523
+ return;
524
+ }
525
+ updatePage.mutate({
526
+ id: page.id,
527
+ nickname,
528
+ pathSegment: page.pathSegment,
529
+ parentPageId: page.parentPageId
530
+ }, { onError: _temp2 });
531
+ };
532
+ $[1] = page;
533
+ $[2] = updatePage;
534
+ $[3] = t2;
535
+ } else t2 = $[3];
536
+ const saveNickname = t2;
537
+ const { value: value_0, setValue, onFocus, onBlur } = useDebouncedField(page?.nickname ?? "", saveNickname);
538
+ if (!page) return null;
539
+ let t3;
540
+ if ($[4] !== inputId) {
541
+ t3 = /* @__PURE__ */ jsx(Label, {
542
+ htmlFor: inputId,
543
+ children: "Page nickname"
544
+ });
545
+ $[4] = inputId;
546
+ $[5] = t3;
547
+ } else t3 = $[5];
548
+ let t4;
549
+ if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
550
+ t4 = /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, { render: /* @__PURE__ */ jsx(Info, { className: "text-muted-foreground size-3.5" }) }), /* @__PURE__ */ jsx(TooltipContent, { children: "A short internal name. Does not affect SEO." })] });
551
+ $[6] = t4;
552
+ } else t4 = $[6];
553
+ let t5;
554
+ if ($[7] !== t3) {
555
+ t5 = /* @__PURE__ */ jsxs("div", {
556
+ className: "flex items-center gap-1.5",
557
+ children: [t3, t4]
558
+ });
559
+ $[7] = t3;
560
+ $[8] = t5;
561
+ } else t5 = $[8];
562
+ let t6;
563
+ if ($[9] !== setValue) {
564
+ t6 = (e) => setValue(e.target.value);
565
+ $[9] = setValue;
566
+ $[10] = t6;
567
+ } else t6 = $[10];
568
+ let t7;
569
+ if ($[11] !== inputId || $[12] !== onBlur || $[13] !== onFocus || $[14] !== t6 || $[15] !== value_0) {
570
+ t7 = /* @__PURE__ */ jsx(Input, {
571
+ id: inputId,
572
+ value: value_0,
573
+ onChange: t6,
574
+ onFocus,
575
+ onBlur,
576
+ placeholder: "e.g. Home, Pricing, About",
577
+ maxLength: 80
578
+ });
579
+ $[11] = inputId;
580
+ $[12] = onBlur;
581
+ $[13] = onFocus;
582
+ $[14] = t6;
583
+ $[15] = value_0;
584
+ $[16] = t7;
585
+ } else t7 = $[16];
586
+ let t8;
587
+ if ($[17] !== t5 || $[18] !== t7) {
588
+ t8 = /* @__PURE__ */ jsxs("div", {
589
+ className: "space-y-2",
590
+ children: [t5, t7]
591
+ });
592
+ $[17] = t5;
593
+ $[18] = t7;
594
+ $[19] = t8;
595
+ } else t8 = $[19];
596
+ return t8;
597
+ };
598
+ const PageLayoutSelect = (t0) => {
599
+ const $ = c(28);
600
+ const { data } = t0;
601
+ const { page, layouts, camoxApp } = data;
602
+ let t1;
603
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
604
+ t1 = pageMutations.setLayout();
605
+ $[0] = t1;
606
+ } else t1 = $[0];
607
+ const setLayout = useMutation(t1);
608
+ if (!page || !layouts || layouts.length === 0) return null;
609
+ let t2;
610
+ if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
611
+ t2 = /* @__PURE__ */ jsx(Label, { children: "Layout" });
612
+ $[1] = t2;
613
+ } else t2 = $[1];
614
+ let t3;
615
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
616
+ t3 = /* @__PURE__ */ jsxs("div", {
617
+ className: "flex items-center gap-1.5",
618
+ children: [t2, /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, { render: /* @__PURE__ */ jsx(Info, { className: "text-muted-foreground size-3.5" }) }), /* @__PURE__ */ jsx(TooltipContent, {
619
+ className: "max-w-xs",
620
+ children: "A layout wraps page content in shared structure, like navbars and footers, and controls how metadata is generated."
621
+ })] })]
622
+ });
623
+ $[2] = t3;
624
+ } else t3 = $[2];
625
+ const t4 = page.layoutId;
626
+ let t5;
627
+ if ($[3] !== page.id || $[4] !== page.layoutId || $[5] !== setLayout) {
628
+ t5 = (layoutId) => {
629
+ if (layoutId == null || layoutId === page.layoutId) return;
630
+ setLayout.mutate({
631
+ id: page.id,
632
+ layoutId
633
+ }, { onError: _temp3 });
634
+ };
635
+ $[3] = page.id;
636
+ $[4] = page.layoutId;
637
+ $[5] = setLayout;
638
+ $[6] = t5;
639
+ } else t5 = $[6];
640
+ let t6;
641
+ if ($[7] !== camoxApp || $[8] !== layouts) {
642
+ let t7;
643
+ if ($[10] !== camoxApp) {
644
+ t7 = (t) => ({
645
+ value: t.layoutId,
646
+ label: camoxApp.getLayoutById(t.layoutId)?._internal.title ?? t.layoutId
647
+ });
648
+ $[10] = camoxApp;
649
+ $[11] = t7;
650
+ } else t7 = $[11];
651
+ t6 = layouts.map(t7);
652
+ $[7] = camoxApp;
653
+ $[8] = layouts;
654
+ $[9] = t6;
655
+ } else t6 = $[9];
656
+ let t7;
657
+ if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
658
+ t7 = /* @__PURE__ */ jsx(SelectValue, { placeholder: "Select a layout" });
659
+ $[12] = t7;
660
+ } else t7 = $[12];
661
+ let t8;
662
+ if ($[13] !== setLayout.isPending) {
663
+ t8 = /* @__PURE__ */ jsx(SelectTrigger, {
664
+ disabled: setLayout.isPending,
665
+ className: "w-full",
666
+ children: t7
667
+ });
668
+ $[13] = setLayout.isPending;
669
+ $[14] = t8;
670
+ } else t8 = $[14];
671
+ let t9;
672
+ if ($[15] !== camoxApp || $[16] !== layouts) {
673
+ let t10;
674
+ if ($[18] !== camoxApp) {
675
+ t10 = (t_0) => /* @__PURE__ */ jsx(SelectItem, {
676
+ value: t_0.layoutId,
677
+ children: camoxApp.getLayoutById(t_0.layoutId)?._internal.title ?? t_0.layoutId
678
+ }, t_0.layoutId);
679
+ $[18] = camoxApp;
680
+ $[19] = t10;
681
+ } else t10 = $[19];
682
+ t9 = layouts.map(t10);
683
+ $[15] = camoxApp;
684
+ $[16] = layouts;
685
+ $[17] = t9;
686
+ } else t9 = $[17];
687
+ let t10;
688
+ if ($[20] !== t9) {
689
+ t10 = /* @__PURE__ */ jsx(SelectContent, { children: t9 });
690
+ $[20] = t9;
691
+ $[21] = t10;
692
+ } else t10 = $[21];
693
+ let t11;
694
+ if ($[22] !== page.layoutId || $[23] !== t10 || $[24] !== t5 || $[25] !== t6 || $[26] !== t8) {
695
+ t11 = /* @__PURE__ */ jsxs("div", {
696
+ className: "space-y-2",
697
+ children: [t3, /* @__PURE__ */ jsxs(Select, {
698
+ value: t4,
699
+ onValueChange: t5,
700
+ items: t6,
701
+ children: [t8, t10]
702
+ })]
703
+ });
704
+ $[22] = page.layoutId;
705
+ $[23] = t10;
706
+ $[24] = t5;
707
+ $[25] = t6;
708
+ $[26] = t8;
709
+ $[27] = t11;
710
+ } else t11 = $[27];
711
+ return t11;
712
+ };
713
+ const PageStructureModal = (t0) => {
714
+ const $ = c(18);
715
+ const { open, onOpenChange, pageId } = t0;
716
+ const data = usePageMetadataData(pageId);
717
+ const { page } = data;
718
+ let t1;
719
+ if ($[0] !== data.pages || $[1] !== pageId) {
720
+ t1 = data.pages?.find((item) => item.id === pageId)?.needsLayout ?? false;
721
+ $[0] = data.pages;
722
+ $[1] = pageId;
723
+ $[2] = t1;
724
+ } else t1 = $[2];
725
+ const needsLayout = t1;
726
+ let t2;
727
+ if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
728
+ t2 = /* @__PURE__ */ jsx(DialogTitle, { children: "Page page" });
729
+ $[3] = t2;
730
+ } else t2 = $[3];
731
+ const t3 = needsLayout ? "This page's layout is gone, so it isn't served. Move it to another layout, or delete it." : "Update the URL path for this page.";
732
+ let t4;
733
+ if ($[4] !== t3) {
734
+ t4 = /* @__PURE__ */ jsxs(DialogHeader, { children: [t2, /* @__PURE__ */ jsx(DialogDescription, { children: t3 })] });
735
+ $[4] = t3;
736
+ $[5] = t4;
737
+ } else t4 = $[5];
738
+ let t5;
739
+ if ($[6] !== data || $[7] !== needsLayout || $[8] !== onOpenChange || $[9] !== page) {
740
+ t5 = page ? /* @__PURE__ */ jsx(PageStructureEditor, {
741
+ data,
742
+ includeNickname: false,
743
+ includeLayout: needsLayout,
744
+ onSaved: () => onOpenChange(false)
745
+ }) : /* @__PURE__ */ jsxs("div", {
746
+ className: "text-muted-foreground flex items-center gap-2 py-6 text-sm",
747
+ children: [/* @__PURE__ */ jsx(Spinner, { className: "size-3.5" }), " Loading..."]
748
+ });
749
+ $[6] = data;
750
+ $[7] = needsLayout;
751
+ $[8] = onOpenChange;
752
+ $[9] = page;
753
+ $[10] = t5;
754
+ } else t5 = $[10];
755
+ let t6;
756
+ if ($[11] !== t4 || $[12] !== t5) {
757
+ t6 = /* @__PURE__ */ jsxs(DialogContent, {
758
+ className: "max-h-[90vh] overflow-y-auto sm:max-w-2xl",
759
+ children: [t4, t5]
760
+ });
761
+ $[11] = t4;
762
+ $[12] = t5;
763
+ $[13] = t6;
764
+ } else t6 = $[13];
765
+ let t7;
766
+ if ($[14] !== onOpenChange || $[15] !== open || $[16] !== t6) {
767
+ t7 = /* @__PURE__ */ jsx(Dialog, {
768
+ open,
769
+ onOpenChange,
770
+ children: t6
771
+ });
772
+ $[14] = onOpenChange;
773
+ $[15] = open;
774
+ $[16] = t6;
775
+ $[17] = t7;
776
+ } else t7 = $[17];
777
+ return t7;
778
+ };
779
+ const PageStructureEditor = (t0) => {
780
+ const $ = c(37);
781
+ const { data, includeNickname: t1, includeLayout: t2, onSaved } = t0;
782
+ const includeNickname = t1 === void 0 ? true : t1;
783
+ const includeLayout = t2 === void 0 ? true : t2;
784
+ const { page, project, pages, layouts, camoxApp } = data;
785
+ let t3;
786
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
787
+ t3 = pageMutations.update();
788
+ $[0] = t3;
789
+ } else t3 = $[0];
790
+ const updatePage = useMutation(t3);
791
+ let t4;
792
+ if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
793
+ t4 = pageMutations.setLayout();
794
+ $[1] = t4;
795
+ } else t4 = $[1];
796
+ const setLayout = useMutation(t4);
797
+ const navigate = useNavigate();
798
+ const localized = useLocalizedPath();
799
+ const t5 = page?.nickname ?? "";
800
+ const t6 = page?.pathSegment ?? "";
801
+ const t7 = page?.parentPageId ?? void 0;
802
+ const t8 = page?.layoutId ?? "";
803
+ let t9;
804
+ if ($[2] !== t5 || $[3] !== t6 || $[4] !== t7 || $[5] !== t8) {
805
+ t9 = {
806
+ nickname: t5,
807
+ pathSegment: t6,
808
+ parentPageId: t7,
809
+ layoutId: t8
810
+ };
811
+ $[2] = t5;
812
+ $[3] = t6;
813
+ $[4] = t7;
814
+ $[5] = t8;
815
+ $[6] = t9;
816
+ } else t9 = $[6];
817
+ const form = useForm({
818
+ defaultValues: t9,
819
+ onSubmit: async (values) => {
820
+ if (!page) return;
821
+ try {
822
+ const nickname = values.value.nickname.trim();
823
+ if (!nickname) {
824
+ toast.error("Page nickname is required");
825
+ return;
826
+ }
827
+ const { fullPath } = await updatePage.mutateAsync({
828
+ id: page.id,
829
+ nickname,
830
+ pathSegment: values.value.pathSegment,
831
+ parentPageId: values.value.parentPageId
832
+ });
833
+ if (includeLayout && values.value.layoutId && values.value.layoutId !== page.layoutId) await setLayout.mutateAsync({
834
+ id: page.id,
835
+ layoutId: values.value.layoutId
836
+ });
837
+ toast.success(`Updated ${nickname} page`);
838
+ form.reset();
839
+ onSaved?.();
840
+ await navigate({ to: localized(fullPath) });
841
+ } catch (t10) {
842
+ console.error("Failed to update page:", t10);
843
+ toast.error("Could not update page");
844
+ }
845
+ }
846
+ });
847
+ let t11;
848
+ if ($[7] !== form || $[8] !== page) {
849
+ t11 = () => {
850
+ if (!page) return;
851
+ form.reset({
852
+ nickname: page.nickname,
853
+ pathSegment: page.pathSegment,
854
+ parentPageId: page.parentPageId ?? void 0,
855
+ layoutId: page.layoutId ?? ""
856
+ });
857
+ };
858
+ $[7] = form;
859
+ $[8] = page;
860
+ $[9] = t11;
861
+ } else t11 = $[9];
862
+ const resetForm = React.useEffectEvent(t11);
863
+ const pageId = page?.id;
864
+ let t12;
865
+ if ($[10] !== resetForm) {
866
+ t12 = () => {
867
+ resetForm();
868
+ };
869
+ $[10] = resetForm;
870
+ $[11] = t12;
871
+ } else t12 = $[11];
872
+ let t13;
873
+ if ($[12] !== pageId) {
874
+ t13 = [pageId];
875
+ $[12] = pageId;
876
+ $[13] = t13;
877
+ } else t13 = $[13];
878
+ React.useEffect(t12, t13);
879
+ if (!page || !project) return null;
880
+ const isRootPage = page.fullPath === "/";
881
+ let t14;
882
+ if ($[14] !== form) {
883
+ t14 = (e) => {
884
+ e.preventDefault();
885
+ e.stopPropagation();
886
+ form.handleSubmit();
887
+ };
888
+ $[14] = form;
889
+ $[15] = t14;
890
+ } else t14 = $[15];
891
+ let t15;
892
+ if ($[16] !== form.Field || $[17] !== includeNickname) {
893
+ t15 = includeNickname && /* @__PURE__ */ jsx(form.Field, {
894
+ name: "nickname",
895
+ children: _temp4
896
+ });
897
+ $[16] = form.Field;
898
+ $[17] = includeNickname;
899
+ $[18] = t15;
900
+ } else t15 = $[18];
901
+ let t16;
902
+ if ($[19] !== form.Field || $[20] !== isRootPage || $[21] !== page.id || $[22] !== pages) {
903
+ t16 = isRootPage ? /* @__PURE__ */ jsxs(Alert, { children: [
904
+ /* @__PURE__ */ jsx(Info, { className: "size-4" }),
905
+ /* @__PURE__ */ jsx(AlertTitle, { children: "Homepage" }),
906
+ /* @__PURE__ */ jsx(AlertDescription, { children: "You can't change the path of the home page." })
907
+ ] }) : /* @__PURE__ */ jsx(form.Field, {
908
+ name: "parentPageId",
909
+ children: (parentField) => /* @__PURE__ */ jsx(form.Field, {
910
+ name: "pathSegment",
911
+ children: (pathField) => /* @__PURE__ */ jsx(PageLocationFieldset, {
912
+ parentPageId: parentField.state.value,
913
+ onParentPageIdChange: parentField.handleChange,
914
+ pathSegment: pathField.state.value,
915
+ onPathSegmentChange: pathField.handleChange,
916
+ pages,
917
+ excludePageId: page.id
918
+ })
919
+ })
920
+ });
921
+ $[19] = form.Field;
922
+ $[20] = isRootPage;
923
+ $[21] = page.id;
924
+ $[22] = pages;
925
+ $[23] = t16;
926
+ } else t16 = $[23];
927
+ let t17;
928
+ if ($[24] !== camoxApp || $[25] !== form.Field || $[26] !== includeLayout || $[27] !== layouts) {
929
+ t17 = includeLayout && layouts && layouts.length > 0 && /* @__PURE__ */ jsx(form.Field, {
930
+ name: "layoutId",
931
+ children: (field_0) => /* @__PURE__ */ jsxs("div", {
932
+ className: "space-y-2",
933
+ children: [/* @__PURE__ */ jsx(Label, { children: "Layout" }), /* @__PURE__ */ jsxs(Select, {
934
+ value: field_0.state.value,
935
+ onValueChange: (value) => {
936
+ if (value != null) field_0.handleChange(value);
937
+ },
938
+ items: layouts.map((t) => ({
939
+ value: t.layoutId,
940
+ label: camoxApp.getLayoutById(t.layoutId)?._internal.title ?? t.layoutId
941
+ })),
942
+ children: [/* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Select a layout" }) }), /* @__PURE__ */ jsx(SelectContent, { children: layouts.map((t_0) => /* @__PURE__ */ jsx(SelectItem, {
943
+ value: t_0.layoutId,
944
+ children: camoxApp.getLayoutById(t_0.layoutId)?._internal.title ?? t_0.layoutId
945
+ }, t_0.layoutId)) })]
946
+ })]
947
+ })
948
+ });
949
+ $[24] = camoxApp;
950
+ $[25] = form.Field;
951
+ $[26] = includeLayout;
952
+ $[27] = layouts;
953
+ $[28] = t17;
954
+ } else t17 = $[28];
955
+ let t18;
956
+ if ($[29] !== form.Subscribe) {
957
+ t18 = /* @__PURE__ */ jsx(form.Subscribe, {
958
+ selector: _temp5,
959
+ children: _temp6
960
+ });
961
+ $[29] = form.Subscribe;
962
+ $[30] = t18;
963
+ } else t18 = $[30];
964
+ let t19;
965
+ if ($[31] !== t14 || $[32] !== t15 || $[33] !== t16 || $[34] !== t17 || $[35] !== t18) {
966
+ t19 = /* @__PURE__ */ jsxs("form", {
967
+ onSubmit: t14,
968
+ className: "space-y-4",
969
+ children: [
970
+ t15,
971
+ t16,
972
+ t17,
973
+ t18
974
+ ]
975
+ });
976
+ $[31] = t14;
977
+ $[32] = t15;
978
+ $[33] = t16;
979
+ $[34] = t17;
980
+ $[35] = t18;
981
+ $[36] = t19;
982
+ } else t19 = $[36];
983
+ return t19;
984
+ };
985
+ const PageSeoSheet = (t0) => {
986
+ const $ = c(7);
987
+ const { open, onOpenChange, pageId } = t0;
988
+ let t1;
989
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
990
+ t1 = /* @__PURE__ */ jsxs(SheetHeader, {
991
+ className: "border-b",
992
+ children: [/* @__PURE__ */ jsx(SheetTitle, { children: "SEO metadata" }), /* @__PURE__ */ jsx(SheetDescription, { children: "Control how this page appears in search and social previews." })]
993
+ });
994
+ $[0] = t1;
995
+ } else t1 = $[0];
996
+ let t2;
997
+ if ($[1] !== pageId) {
998
+ t2 = /* @__PURE__ */ jsxs(SheetContent, {
999
+ side: "right",
1000
+ className: "gap-0 data-[side=right]:sm:max-w-xl",
1001
+ children: [t1, /* @__PURE__ */ jsx("div", {
1002
+ className: "flex-1 overflow-y-auto p-4",
1003
+ children: /* @__PURE__ */ jsx(PageSeoContent, { pageId })
1004
+ })]
1005
+ });
1006
+ $[1] = pageId;
1007
+ $[2] = t2;
1008
+ } else t2 = $[2];
1009
+ let t3;
1010
+ if ($[3] !== onOpenChange || $[4] !== open || $[5] !== t2) {
1011
+ t3 = /* @__PURE__ */ jsx(Sheet, {
1012
+ open,
1013
+ onOpenChange,
1014
+ children: t2
1015
+ });
1016
+ $[3] = onOpenChange;
1017
+ $[4] = open;
1018
+ $[5] = t2;
1019
+ $[6] = t3;
1020
+ } else t3 = $[6];
1021
+ return t3;
1022
+ };
1023
+ const PageSeoContent = (t0) => {
1024
+ const $ = c(5);
1025
+ const { pageId } = t0;
1026
+ const { page, metaTitle, pageLayoutRecord, project } = usePageMetadataData(pageId);
1027
+ let t1;
1028
+ if ($[0] !== metaTitle || $[1] !== page || $[2] !== pageLayoutRecord?.layoutId || $[3] !== project?.name) {
1029
+ t1 = page ? /* @__PURE__ */ jsx(PageSeoEditor, {
1030
+ page,
1031
+ metaTitle,
1032
+ layoutId: pageLayoutRecord?.layoutId,
1033
+ projectName: project?.name
1034
+ }) : /* @__PURE__ */ jsxs("div", {
1035
+ className: "text-muted-foreground flex items-center gap-2 py-6 text-sm",
1036
+ children: [/* @__PURE__ */ jsx(Spinner, { className: "size-3.5" }), " Loading..."]
1037
+ });
1038
+ $[0] = metaTitle;
1039
+ $[1] = page;
1040
+ $[2] = pageLayoutRecord?.layoutId;
1041
+ $[3] = project?.name;
1042
+ $[4] = t1;
1043
+ } else t1 = $[4];
1044
+ return t1;
1045
+ };
1046
+ const PageSeoEditor = (t0) => {
1047
+ const $ = c(40);
1048
+ const { page, metaTitle, layoutId, projectName } = t0;
1049
+ let t1;
1050
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1051
+ t1 = pageMutations.setSeo();
1052
+ $[0] = t1;
1053
+ } else t1 = $[0];
1054
+ const setSeo = useMutation(t1);
1055
+ let t2;
1056
+ if ($[1] !== page.id || $[2] !== setSeo) {
1057
+ t2 = (checked) => {
1058
+ setSeo.mutate({
1059
+ id: page.id,
1060
+ aiSeo: checked
1061
+ });
1062
+ };
1063
+ $[1] = page.id;
1064
+ $[2] = setSeo;
1065
+ $[3] = t2;
1066
+ } else t2 = $[3];
1067
+ let t3;
1068
+ if ($[4] !== page.aiSeo || $[5] !== t2) {
1069
+ t3 = /* @__PURE__ */ jsx(Switch, {
1070
+ id: "ai-seo",
1071
+ checked: page.aiSeo,
1072
+ onCheckedChange: t2
1073
+ });
1074
+ $[4] = page.aiSeo;
1075
+ $[5] = t2;
1076
+ $[6] = t3;
1077
+ } else t3 = $[6];
1078
+ let t4;
1079
+ if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
1080
+ t4 = /* @__PURE__ */ jsx(Label, {
1081
+ htmlFor: "ai-seo",
1082
+ children: "AI metadata"
1083
+ });
1084
+ $[7] = t4;
1085
+ } else t4 = $[7];
1086
+ let t5;
1087
+ if ($[8] !== t3) {
1088
+ t5 = /* @__PURE__ */ jsxs("div", {
1089
+ className: "flex items-center gap-2",
1090
+ children: [t3, t4]
1091
+ });
1092
+ $[8] = t3;
1093
+ $[9] = t5;
1094
+ } else t5 = $[9];
1095
+ const t6 = page.metaTitle ?? "";
1096
+ let t7;
1097
+ if ($[10] !== page.id || $[11] !== setSeo) {
1098
+ t7 = (value) => setSeo.mutate({
1099
+ id: page.id,
1100
+ metaTitle: value
1101
+ });
1102
+ $[10] = page.id;
1103
+ $[11] = setSeo;
1104
+ $[12] = t7;
1105
+ } else t7 = $[12];
1106
+ let t8;
1107
+ if ($[13] !== page.aiSeo || $[14] !== t6 || $[15] !== t7) {
1108
+ t8 = /* @__PURE__ */ jsx(DebouncedFieldEditor, {
1109
+ label: "Page title",
1110
+ placeholder: "Page title...",
1111
+ initialValue: t6,
1112
+ disabled: page.aiSeo,
1113
+ onSave: t7
1114
+ });
1115
+ $[13] = page.aiSeo;
1116
+ $[14] = t6;
1117
+ $[15] = t7;
1118
+ $[16] = t8;
1119
+ } else t8 = $[16];
1120
+ const t9 = page.metaDescription ?? "";
1121
+ let t10;
1122
+ if ($[17] !== page.id || $[18] !== setSeo) {
1123
+ t10 = (value_0) => setSeo.mutate({
1124
+ id: page.id,
1125
+ metaDescription: value_0
1126
+ });
1127
+ $[17] = page.id;
1128
+ $[18] = setSeo;
1129
+ $[19] = t10;
1130
+ } else t10 = $[19];
1131
+ let t11;
1132
+ if ($[20] !== page.aiSeo || $[21] !== t10 || $[22] !== t9) {
1133
+ t11 = /* @__PURE__ */ jsx(DebouncedFieldEditor, {
1134
+ label: "Page description",
1135
+ placeholder: "Page description...",
1136
+ initialValue: t9,
1137
+ disabled: page.aiSeo,
1138
+ rows: 2,
1139
+ onSave: t10
1140
+ });
1141
+ $[20] = page.aiSeo;
1142
+ $[21] = t10;
1143
+ $[22] = t9;
1144
+ $[23] = t11;
1145
+ } else t11 = $[23];
1146
+ const t12 = page.metaDescription ?? "";
1147
+ let t13;
1148
+ if ($[24] !== metaTitle || $[25] !== page || $[26] !== t12) {
1149
+ t13 = /* @__PURE__ */ jsx(SearchEnginePreview, {
1150
+ page,
1151
+ metaTitle,
1152
+ metaDescription: t12
1153
+ });
1154
+ $[24] = metaTitle;
1155
+ $[25] = page;
1156
+ $[26] = t12;
1157
+ $[27] = t13;
1158
+ } else t13 = $[27];
1159
+ const t14 = page.metaDescription ?? "";
1160
+ let t15;
1161
+ if ($[28] !== layoutId || $[29] !== metaTitle || $[30] !== page || $[31] !== projectName || $[32] !== t14) {
1162
+ t15 = /* @__PURE__ */ jsx(SocialPreviewSection, {
1163
+ page,
1164
+ metaTitle,
1165
+ metaDescription: t14,
1166
+ layoutId,
1167
+ projectName
1168
+ });
1169
+ $[28] = layoutId;
1170
+ $[29] = metaTitle;
1171
+ $[30] = page;
1172
+ $[31] = projectName;
1173
+ $[32] = t14;
1174
+ $[33] = t15;
1175
+ } else t15 = $[33];
1176
+ let t16;
1177
+ if ($[34] !== t11 || $[35] !== t13 || $[36] !== t15 || $[37] !== t5 || $[38] !== t8) {
1178
+ t16 = /* @__PURE__ */ jsxs("div", {
1179
+ className: "space-y-4",
1180
+ children: [
1181
+ t5,
1182
+ t8,
1183
+ t11,
1184
+ t13,
1185
+ t15
1186
+ ]
1187
+ });
1188
+ $[34] = t11;
1189
+ $[35] = t13;
1190
+ $[36] = t15;
1191
+ $[37] = t5;
1192
+ $[38] = t8;
1193
+ $[39] = t16;
1194
+ } else t16 = $[39];
1195
+ return t16;
1196
+ };
1197
+ const PageMarkdownSheet = (t0) => {
1198
+ const $ = c(9);
1199
+ const { open, onOpenChange, pageId, metaTitle, metaDescription } = t0;
1200
+ let t1;
1201
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1202
+ t1 = /* @__PURE__ */ jsxs(SheetHeader, {
1203
+ className: "border-b",
1204
+ children: [/* @__PURE__ */ jsx(SheetTitle, { children: "Markdown content" }), /* @__PURE__ */ jsx(SheetDescription, { children: "How your content will be served to AI agents." })]
1205
+ });
1206
+ $[0] = t1;
1207
+ } else t1 = $[0];
1208
+ let t2;
1209
+ if ($[1] !== metaDescription || $[2] !== metaTitle || $[3] !== pageId) {
1210
+ t2 = /* @__PURE__ */ jsxs(SheetContent, {
1211
+ side: "right",
1212
+ className: "gap-0 data-[side=right]:sm:max-w-2xl",
1213
+ children: [t1, /* @__PURE__ */ jsx("div", {
1214
+ className: "flex-1 overflow-y-auto p-4",
1215
+ children: /* @__PURE__ */ jsx(PageMarkdownPreview, {
1216
+ pageId,
1217
+ metaTitle,
1218
+ metaDescription
1219
+ })
1220
+ })]
1221
+ });
1222
+ $[1] = metaDescription;
1223
+ $[2] = metaTitle;
1224
+ $[3] = pageId;
1225
+ $[4] = t2;
1226
+ } else t2 = $[4];
1227
+ let t3;
1228
+ if ($[5] !== onOpenChange || $[6] !== open || $[7] !== t2) {
1229
+ t3 = /* @__PURE__ */ jsx(Sheet, {
1230
+ open,
1231
+ onOpenChange,
1232
+ children: t2
1233
+ });
1234
+ $[5] = onOpenChange;
1235
+ $[6] = open;
1236
+ $[7] = t2;
1237
+ $[8] = t3;
1238
+ } else t3 = $[8];
1239
+ return t3;
1240
+ };
1241
+ const PageMarkdownContent = (t0) => {
1242
+ const $ = c(5);
1243
+ const { pageId } = t0;
1244
+ const { page, metaTitle } = usePageMetadataData(pageId);
1245
+ if (!page) {
1246
+ let t1;
1247
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1248
+ t1 = /* @__PURE__ */ jsx(Spinner, { className: "size-4" });
1249
+ $[0] = t1;
1250
+ } else t1 = $[0];
1251
+ return t1;
1252
+ }
1253
+ const t1 = page.metaDescription ?? "";
1254
+ let t2;
1255
+ if ($[1] !== metaTitle || $[2] !== pageId || $[3] !== t1) {
1256
+ t2 = /* @__PURE__ */ jsx(PageMarkdownPreview, {
1257
+ pageId,
1258
+ metaTitle,
1259
+ metaDescription: t1
1260
+ });
1261
+ $[1] = metaTitle;
1262
+ $[2] = pageId;
1263
+ $[3] = t1;
1264
+ $[4] = t2;
1265
+ } else t2 = $[4];
1266
+ return t2;
1267
+ };
1268
+ function truncateText(text, maxLen) {
1269
+ if (text.length <= maxLen) return text;
1270
+ return text.slice(0, maxLen) + "...";
1271
+ }
1272
+ const SearchEnginePreview = (t0) => {
1273
+ const $ = c(19);
1274
+ const { page, metaTitle, metaDescription } = t0;
1275
+ const localized = useLocalizedPath();
1276
+ const origin = typeof window !== "undefined" ? window.location.origin : "";
1277
+ let t1;
1278
+ if ($[0] !== localized || $[1] !== page.fullPath) {
1279
+ t1 = localized(page.fullPath);
1280
+ $[0] = localized;
1281
+ $[1] = page.fullPath;
1282
+ $[2] = t1;
1283
+ } else t1 = $[2];
1284
+ const url = `${origin}${t1}`;
1285
+ let t2;
1286
+ if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
1287
+ t2 = /* @__PURE__ */ jsx(Label, { children: "Search engine preview" });
1288
+ $[3] = t2;
1289
+ } else t2 = $[3];
1290
+ let t3;
1291
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
1292
+ t3 = /* @__PURE__ */ jsxs("div", {
1293
+ className: "flex items-center gap-1.5",
1294
+ children: [t2, /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
1295
+ delay: 50,
1296
+ render: /* @__PURE__ */ jsx(Info, { className: "text-muted-foreground size-3.5" })
1297
+ }), /* @__PURE__ */ jsx(TooltipContent, { children: "Titles are cropped after 60 characters and descriptions after 155, like on Google Search results." })] })]
1298
+ });
1299
+ $[4] = t3;
1300
+ } else t3 = $[4];
1301
+ let t4;
1302
+ if ($[5] !== url) {
1303
+ t4 = /* @__PURE__ */ jsx("p", {
1304
+ className: "text-muted-foreground truncate text-xs",
1305
+ children: url
1306
+ });
1307
+ $[5] = url;
1308
+ $[6] = t4;
1309
+ } else t4 = $[6];
1310
+ const t5 = metaTitle || "Untitled";
1311
+ let t6;
1312
+ if ($[7] !== t5) {
1313
+ t6 = truncateText(t5, 60);
1314
+ $[7] = t5;
1315
+ $[8] = t6;
1316
+ } else t6 = $[8];
1317
+ let t7;
1318
+ if ($[9] !== t6) {
1319
+ t7 = /* @__PURE__ */ jsx("p", {
1320
+ className: "text-base font-medium text-blue-600 dark:text-blue-400",
1321
+ children: t6
1322
+ });
1323
+ $[9] = t6;
1324
+ $[10] = t7;
1325
+ } else t7 = $[10];
1326
+ const t8 = metaDescription || "No description";
1327
+ let t9;
1328
+ if ($[11] !== t8) {
1329
+ t9 = truncateText(t8, 155);
1330
+ $[11] = t8;
1331
+ $[12] = t9;
1332
+ } else t9 = $[12];
1333
+ let t10;
1334
+ if ($[13] !== t9) {
1335
+ t10 = /* @__PURE__ */ jsx("p", {
1336
+ className: "text-muted-foreground line-clamp-2 text-xs",
1337
+ children: t9
1338
+ });
1339
+ $[13] = t9;
1340
+ $[14] = t10;
1341
+ } else t10 = $[14];
1342
+ let t11;
1343
+ if ($[15] !== t10 || $[16] !== t4 || $[17] !== t7) {
1344
+ t11 = /* @__PURE__ */ jsxs("div", {
1345
+ className: "space-y-1 pt-2",
1346
+ children: [t3, /* @__PURE__ */ jsxs("div", {
1347
+ className: "border-border space-y-0.5 rounded-lg border p-3",
1348
+ children: [
1349
+ t4,
1350
+ t7,
1351
+ t10
1352
+ ]
1353
+ })]
1354
+ });
1355
+ $[15] = t10;
1356
+ $[16] = t4;
1357
+ $[17] = t7;
1358
+ $[18] = t11;
1359
+ } else t11 = $[18];
1360
+ return t11;
1361
+ };
1362
+ const SocialPreviewSection = (t0) => {
1363
+ const $ = c(68);
1364
+ const { page, metaTitle, metaDescription, layoutId, projectName } = t0;
1365
+ const studioCache = useStudioCache();
1366
+ const pageMetaTitle = page.metaTitle ?? page.pathSegment;
1367
+ let t1;
1368
+ if ($[0] !== layoutId || $[1] !== page.metaDescription || $[2] !== pageMetaTitle || $[3] !== projectName) {
1369
+ let t2;
1370
+ if ($[5] !== layoutId) {
1371
+ t2 = layoutId && { layoutId };
1372
+ $[5] = layoutId;
1373
+ $[6] = t2;
1374
+ } else t2 = $[6];
1375
+ let t3;
1376
+ if ($[7] !== page.metaDescription) {
1377
+ t3 = page.metaDescription && { description: page.metaDescription };
1378
+ $[7] = page.metaDescription;
1379
+ $[8] = t3;
1380
+ } else t3 = $[8];
1381
+ let t4;
1382
+ if ($[9] !== projectName) {
1383
+ t4 = projectName && { projectName };
1384
+ $[9] = projectName;
1385
+ $[10] = t4;
1386
+ } else t4 = $[10];
1387
+ t1 = new URLSearchParams({
1388
+ ...t2,
1389
+ title: pageMetaTitle,
1390
+ ...t3,
1391
+ ...t4
1392
+ }).toString();
1393
+ $[0] = layoutId;
1394
+ $[1] = page.metaDescription;
1395
+ $[2] = pageMetaTitle;
1396
+ $[3] = projectName;
1397
+ $[4] = t1;
1398
+ } else t1 = $[4];
1399
+ const generatedOgImage = `/og?${t1}`;
1400
+ const ogImage = page.customOgImageUrl ?? generatedOgImage;
1401
+ const localized = useLocalizedPath();
1402
+ const origin = typeof window !== "undefined" ? window.location.origin : "";
1403
+ let t2;
1404
+ if ($[11] !== localized || $[12] !== page.fullPath) {
1405
+ t2 = localized(page.fullPath);
1406
+ $[11] = localized;
1407
+ $[12] = page.fullPath;
1408
+ $[13] = t2;
1409
+ } else t2 = $[13];
1410
+ const url = `${origin}${t2}`;
1411
+ const fileInputRef = React.useRef(null);
1412
+ let t3;
1413
+ if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
1414
+ t3 = pageMutations.uploadCustomOgImage();
1415
+ $[14] = t3;
1416
+ } else t3 = $[14];
1417
+ let t4;
1418
+ if ($[15] !== page.id || $[16] !== studioCache) {
1419
+ t4 = {
1420
+ ...t3,
1421
+ onSuccess: () => {
1422
+ studioCache.invalidate(reads.page({ id: page.id }));
1423
+ },
1424
+ onError: _temp7
1425
+ };
1426
+ $[15] = page.id;
1427
+ $[16] = studioCache;
1428
+ $[17] = t4;
1429
+ } else t4 = $[17];
1430
+ const uploadCustomOgImage = useMutation(t4);
1431
+ let t5;
1432
+ if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
1433
+ t5 = pageMutations.deleteCustomOgImage();
1434
+ $[18] = t5;
1435
+ } else t5 = $[18];
1436
+ let t6;
1437
+ if ($[19] !== page.id || $[20] !== studioCache) {
1438
+ t6 = {
1439
+ ...t5,
1440
+ onSuccess: () => {
1441
+ studioCache.invalidate(reads.page({ id: page.id }));
1442
+ },
1443
+ onError: _temp8
1444
+ };
1445
+ $[19] = page.id;
1446
+ $[20] = studioCache;
1447
+ $[21] = t6;
1448
+ } else t6 = $[21];
1449
+ const deleteCustomOgImage = useMutation(t6);
1450
+ const hasCustomImage = !!page.customOgImageUrl;
1451
+ const isBusy = uploadCustomOgImage.isPending || deleteCustomOgImage.isPending;
1452
+ let t7;
1453
+ if ($[22] !== page.id || $[23] !== uploadCustomOgImage) {
1454
+ t7 = (files) => {
1455
+ const file = files[0];
1456
+ if (file) uploadCustomOgImage.mutate({
1457
+ pageId: page.id,
1458
+ file
1459
+ });
1460
+ };
1461
+ $[22] = page.id;
1462
+ $[23] = uploadCustomOgImage;
1463
+ $[24] = t7;
1464
+ } else t7 = $[24];
1465
+ const handleFiles = t7;
1466
+ let t8;
1467
+ if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
1468
+ t8 = /* @__PURE__ */ jsx(Label, { children: "Social preview" });
1469
+ $[25] = t8;
1470
+ } else t8 = $[25];
1471
+ let t9;
1472
+ if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
1473
+ t9 = () => fileInputRef.current?.click();
1474
+ $[26] = t9;
1475
+ } else t9 = $[26];
1476
+ let t10;
1477
+ if ($[27] !== uploadCustomOgImage.isPending) {
1478
+ t10 = uploadCustomOgImage.isPending ? /* @__PURE__ */ jsx(Spinner, {}) : /* @__PURE__ */ jsx(Upload, { className: "size-3.5" });
1479
+ $[27] = uploadCustomOgImage.isPending;
1480
+ $[28] = t10;
1481
+ } else t10 = $[28];
1482
+ const t11 = hasCustomImage ? "Replace custom image" : "Upload custom image";
1483
+ let t12;
1484
+ if ($[29] !== isBusy || $[30] !== t10 || $[31] !== t11) {
1485
+ t12 = /* @__PURE__ */ jsxs(Button, {
1486
+ type: "button",
1487
+ variant: "secondary",
1488
+ size: "sm",
1489
+ disabled: isBusy,
1490
+ onClick: t9,
1491
+ children: [t10, t11]
1492
+ });
1493
+ $[29] = isBusy;
1494
+ $[30] = t10;
1495
+ $[31] = t11;
1496
+ $[32] = t12;
1497
+ } else t12 = $[32];
1498
+ let t13;
1499
+ if ($[33] !== deleteCustomOgImage || $[34] !== hasCustomImage || $[35] !== isBusy || $[36] !== page.id) {
1500
+ t13 = hasCustomImage && /* @__PURE__ */ jsxs(Button, {
1501
+ type: "button",
1502
+ variant: "ghost",
1503
+ disabled: isBusy,
1504
+ onClick: () => deleteCustomOgImage.mutate({ pageId: page.id }),
1505
+ "aria-label": "Remove custom image",
1506
+ children: [
1507
+ deleteCustomOgImage.isPending ? /* @__PURE__ */ jsx(Spinner, { className: "text-muted-foreground" }) : /* @__PURE__ */ jsx(Trash2, { className: "text-muted-foreground" }),
1508
+ " ",
1509
+ "Clear"
1510
+ ]
1511
+ });
1512
+ $[33] = deleteCustomOgImage;
1513
+ $[34] = hasCustomImage;
1514
+ $[35] = isBusy;
1515
+ $[36] = page.id;
1516
+ $[37] = t13;
1517
+ } else t13 = $[37];
1518
+ let t14;
1519
+ if ($[38] !== handleFiles) {
1520
+ t14 = /* @__PURE__ */ jsx("input", {
1521
+ type: "file",
1522
+ ref: fileInputRef,
1523
+ className: "hidden",
1524
+ accept: "image/jpeg,image/png,image/gif,image/webp",
1525
+ onChange: (e) => {
1526
+ if (e.target.files) handleFiles(e.target.files);
1527
+ e.target.value = "";
1528
+ }
1529
+ });
1530
+ $[38] = handleFiles;
1531
+ $[39] = t14;
1532
+ } else t14 = $[39];
1533
+ let t15;
1534
+ if ($[40] !== t12 || $[41] !== t13 || $[42] !== t14) {
1535
+ t15 = /* @__PURE__ */ jsxs("div", {
1536
+ className: "flex items-center gap-2",
1537
+ children: [
1538
+ t12,
1539
+ t13,
1540
+ t14
1541
+ ]
1542
+ });
1543
+ $[40] = t12;
1544
+ $[41] = t13;
1545
+ $[42] = t14;
1546
+ $[43] = t15;
1547
+ } else t15 = $[43];
1548
+ const t16 = hasCustomImage ? "Drop image to replace" : "Drop image to upload";
1549
+ let t17;
1550
+ if ($[44] === Symbol.for("react.memo_cache_sentinel")) {
1551
+ t17 = { aspectRatio: "1200 / 630" };
1552
+ $[44] = t17;
1553
+ } else t17 = $[44];
1554
+ let t18;
1555
+ if ($[45] !== ogImage) {
1556
+ t18 = /* @__PURE__ */ jsx("img", {
1557
+ src: ogImage,
1558
+ alt: "",
1559
+ className: "w-full object-cover",
1560
+ style: t17
1561
+ });
1562
+ $[45] = ogImage;
1563
+ $[46] = t18;
1564
+ } else t18 = $[46];
1565
+ let t19;
1566
+ if ($[47] !== handleFiles || $[48] !== t16 || $[49] !== t18) {
1567
+ t19 = /* @__PURE__ */ jsx(UploadDropZone, {
1568
+ onDrop: handleFiles,
1569
+ label: t16,
1570
+ className: "block",
1571
+ children: t18
1572
+ });
1573
+ $[47] = handleFiles;
1574
+ $[48] = t16;
1575
+ $[49] = t18;
1576
+ $[50] = t19;
1577
+ } else t19 = $[50];
1578
+ const t20 = metaTitle || "Untitled";
1579
+ let t21;
1580
+ if ($[51] !== t20) {
1581
+ t21 = /* @__PURE__ */ jsx("p", {
1582
+ className: "text-foreground truncate text-sm font-semibold",
1583
+ children: t20
1584
+ });
1585
+ $[51] = t20;
1586
+ $[52] = t21;
1587
+ } else t21 = $[52];
1588
+ const t22 = metaDescription || "No description";
1589
+ let t23;
1590
+ if ($[53] !== t22) {
1591
+ t23 = /* @__PURE__ */ jsx("p", {
1592
+ className: "text-muted-foreground line-clamp-2 text-xs",
1593
+ children: t22
1594
+ });
1595
+ $[53] = t22;
1596
+ $[54] = t23;
1597
+ } else t23 = $[54];
1598
+ let t24;
1599
+ if ($[55] === Symbol.for("react.memo_cache_sentinel")) {
1600
+ t24 = /* @__PURE__ */ jsx(Globe, { className: "size-3 shrink-0" });
1601
+ $[55] = t24;
1602
+ } else t24 = $[55];
1603
+ let t25;
1604
+ if ($[56] !== url) {
1605
+ t25 = /* @__PURE__ */ jsx("div", {
1606
+ className: "pt-1.5",
1607
+ children: /* @__PURE__ */ jsxs("p", {
1608
+ className: "text-muted-foreground flex items-center gap-1 text-xs",
1609
+ children: [t24, /* @__PURE__ */ jsx("span", {
1610
+ className: "truncate",
1611
+ children: url
1612
+ })]
1613
+ })
1614
+ });
1615
+ $[56] = url;
1616
+ $[57] = t25;
1617
+ } else t25 = $[57];
1618
+ let t26;
1619
+ if ($[58] !== t21 || $[59] !== t23 || $[60] !== t25) {
1620
+ t26 = /* @__PURE__ */ jsxs("div", {
1621
+ className: "space-y-1.5 border-t px-3 py-2.5",
1622
+ children: [
1623
+ t21,
1624
+ t23,
1625
+ t25
1626
+ ]
1627
+ });
1628
+ $[58] = t21;
1629
+ $[59] = t23;
1630
+ $[60] = t25;
1631
+ $[61] = t26;
1632
+ } else t26 = $[61];
1633
+ let t27;
1634
+ if ($[62] !== t19 || $[63] !== t26) {
1635
+ t27 = /* @__PURE__ */ jsxs("div", {
1636
+ className: "border-border max-w-xl overflow-hidden rounded-lg border",
1637
+ children: [t19, t26]
1638
+ });
1639
+ $[62] = t19;
1640
+ $[63] = t26;
1641
+ $[64] = t27;
1642
+ } else t27 = $[64];
1643
+ let t28;
1644
+ if ($[65] !== t15 || $[66] !== t27) {
1645
+ t28 = /* @__PURE__ */ jsxs("div", {
1646
+ className: "space-y-2 pt-2",
1647
+ children: [
1648
+ t8,
1649
+ t15,
1650
+ t27
1651
+ ]
1652
+ });
1653
+ $[65] = t15;
1654
+ $[66] = t27;
1655
+ $[67] = t28;
1656
+ } else t28 = $[67];
1657
+ return t28;
1658
+ };
1659
+ const PageMarkdownPreview = (t0) => {
1660
+ const $ = c(8);
1661
+ const { pageId, metaTitle, metaDescription } = t0;
1662
+ let t1;
1663
+ if ($[0] !== pageId) {
1664
+ t1 = reads.pageMarkdown(pageId);
1665
+ $[0] = pageId;
1666
+ $[1] = t1;
1667
+ } else t1 = $[1];
1668
+ const { data: markdown } = useReadQuery(t1);
1669
+ if (markdown === void 0) {
1670
+ let t2;
1671
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
1672
+ t2 = /* @__PURE__ */ jsxs("div", {
1673
+ className: "text-muted-foreground flex items-center gap-2 py-2 text-sm",
1674
+ children: [/* @__PURE__ */ jsx(Spinner, { className: "size-3.5" }), "Loading..."]
1675
+ });
1676
+ $[2] = t2;
1677
+ } else t2 = $[2];
1678
+ return t2;
1679
+ }
1680
+ const t2 = `title: "${metaTitle}"`;
1681
+ const t3 = `description: "${metaDescription}"`;
1682
+ let frontmatterLines;
1683
+ if ($[3] !== t2 || $[4] !== t3) {
1684
+ frontmatterLines = [
1685
+ "---",
1686
+ t2,
1687
+ t3
1688
+ ];
1689
+ frontmatterLines.push("---");
1690
+ $[3] = t2;
1691
+ $[4] = t3;
1692
+ $[5] = frontmatterLines;
1693
+ } else frontmatterLines = $[5];
1694
+ const fullMarkdown = frontmatterLines.join("\n") + "\n\n" + (markdown ?? "");
1695
+ let t4;
1696
+ if ($[6] !== fullMarkdown) {
1697
+ t4 = /* @__PURE__ */ jsx(ShikiMarkdown, { code: fullMarkdown });
1698
+ $[6] = fullMarkdown;
1699
+ $[7] = t4;
1700
+ } else t4 = $[7];
1701
+ return t4;
1702
+ };
1703
+ function _temp() {
1704
+ try {
1705
+ return localStorage.getItem(SHOW_PAGE_SETTINGS_STORAGE_KEY) === "true";
1706
+ } catch {
1707
+ return false;
1708
+ }
1709
+ }
1710
+ function _temp2() {
1711
+ toast.error("Could not update page");
1712
+ }
1713
+ function _temp3() {
1714
+ toast.error("Could not update page layout");
1715
+ }
1716
+ function _temp4(field) {
1717
+ return /* @__PURE__ */ jsx(PageNicknameField, {
1718
+ value: field.state.value,
1719
+ onChange: field.handleChange
1720
+ });
1721
+ }
1722
+ function _temp5(s) {
1723
+ return {
1724
+ isSubmitting: s.isSubmitting,
1725
+ isPristine: s.isPristine
1726
+ };
1727
+ }
1728
+ function _temp6(t0) {
1729
+ const { isSubmitting, isPristine } = t0;
1730
+ return /* @__PURE__ */ jsxs(Button, {
1731
+ type: "submit",
1732
+ disabled: isSubmitting || isPristine,
1733
+ children: [
1734
+ isSubmitting && /* @__PURE__ */ jsx(Spinner, {}),
1735
+ "Save changes",
1736
+ isSubmitting && "..."
1737
+ ]
1738
+ });
1739
+ }
1740
+ function _temp7(error) {
1741
+ toast.error(error.message || "Could not upload image");
1742
+ }
1743
+ function _temp8() {
1744
+ toast.error("Could not remove image");
1745
+ }
1746
+
1747
+ //#endregion
1748
+ export { PageInfo, PageMarkdownContent, PageSeoContent };