@burger-editor/client 4.0.0-alpha.76 → 4.0.0-alpha.77

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 (44) hide show
  1. package/dist/burger-editor-root.d.ts +1 -1
  2. package/dist/client.js +10554 -10286
  3. package/dist/client.js.map +1 -1
  4. package/dist/components/block-catalog.d.ts +1 -1
  5. package/dist/components/block-menu-button.d.ts +1 -1
  6. package/dist/components/block-menu-view.d.ts +1 -1
  7. package/dist/components/block-menu.d.ts +1 -1
  8. package/dist/components/block-menu.d.ts.map +1 -1
  9. package/dist/components/block-options.d.ts +1 -1
  10. package/dist/components/draft-switcher.d.ts +1 -1
  11. package/dist/components/editable-area-view.d.ts +1 -1
  12. package/dist/components/editable-area-view.d.ts.map +1 -1
  13. package/dist/components/file-list.d.ts +1 -1
  14. package/dist/components/file-uploader.d.ts +1 -1
  15. package/dist/components/front-matter-editor.d.ts +1 -1
  16. package/dist/components/initial-insertion-button.d.ts +1 -1
  17. package/dist/components/item-editor-host.d.ts +1 -1
  18. package/dist/components/preview.d.ts +1 -1
  19. package/dist/components/table-editor.d.ts +1 -1
  20. package/dist/components/tabs.d.ts +1 -1
  21. package/dist/components/thumbnail.d.ts +1 -1
  22. package/dist/components/wysiwyg-field.d.ts +1 -1
  23. package/dist/{editable-area-view-S2Uz7pl8.js → editable-area-view-BRYT222Y.js} +174 -159
  24. package/dist/editable-area-view-BRYT222Y.js.map +1 -0
  25. package/dist/editor-dialog.d.ts +1 -1
  26. package/dist/{engine-context-D0zt6fhJ.js → engine-context-j4-LLPEh.js} +201 -74
  27. package/dist/engine-context-j4-LLPEh.js.map +1 -0
  28. package/dist/engine-context.d.ts +9 -6
  29. package/dist/engine-context.d.ts.map +1 -1
  30. package/dist/form/checkbox.d.ts +1 -1
  31. package/dist/form/fieldset.d.ts +1 -1
  32. package/dist/form/number-field.d.ts +1 -1
  33. package/dist/form/radio-group.d.ts +1 -1
  34. package/dist/form/select-field.d.ts +1 -1
  35. package/dist/form/text-area.d.ts +1 -1
  36. package/dist/form/text-field.d.ts +1 -1
  37. package/dist/root-error-boundary.d.ts +1 -1
  38. package/dist/testing/render-with-engine.d.ts +1 -1
  39. package/dist/testing.js +1 -1
  40. package/dist/ui.js +10 -10
  41. package/dist/ui.js.map +1 -1
  42. package/package.json +11 -11
  43. package/dist/editable-area-view-S2Uz7pl8.js.map +0 -1
  44. package/dist/engine-context-D0zt6fhJ.js.map +0 -1
package/dist/ui.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"ui.js","names":["__iconNode","__iconNode","__iconNode","__iconNode","__iconNode","__iconNode","__iconNode","EMPTY_RESULT","error","data","pagination","current","total","queryKey","query","selectedPath","fileType","page","filter","FileBrowserStore","getSnapshot","state","subscribe","listener","listeners","add","delete","engine","initialReadDone","Set","queries","Map","selected","uploads","canDelete","serverAPI","deleteFile","constructor","url","res","Error","invalidate","prefix","key","keys","startsWith","emit","read","isInitialRead","has","path","undefined","cached","get","getFileList","options","promise","Promise","resolve","catch","set","select","fileSize","patch","upload","file","postFile","blob","URL","createObjectURL","previous","size","uploaded","map","u","name","revokeObjectURL","#emit","#patch","stores","WeakMap","getFileBrowserStore","store","useEngine","getFileBrowserStore","useFileBrowser","$","_c","engine","t0","getExt","src","ext","split","pop","toLowerCase","isImage","includes","isVideo","isAudio","isDoc","isPpt","isXls","isPdf","IconFile","IconFileTypeDoc","IconFileTypePdf","IconFileTypePpt","IconFileTypeXls","IconHeadphones","IconVideo","useState","getExt","styles","Thumbnail","t0","$","_c","src","isLoaded","setIsLoaded","t1","file","t2","ext","isAudio","isDoc","isImage","isPdf","isPpt","isVideo","isXls","t3","thumbnail","formatByteSize","formatDate","Fragment","use","useDeferredValue","useId","useState","useSyncExternalStore","useTransition","useFileBrowser","useCommand","styles","Thumbnail","FileList","fileType","store","rootId","page","setPage","searchWord","setSearchWord","deferredFilter","isPending","startTransition","selected","subscribe","getSnapshot","uploads","myUploads","filter","u","result","read","totalPage","pagination","total","currentPage","current","files","map","fileId","name","size","timestamp","url","blob","sizes","data","f","some","paginate","nextPage","Number","isNaN","Math","min","max","rootRef","e","direction","source","value","select","dataset","deleteFile","alert","marked","text","chars","split","char","i","currentTarget","valueAsNumber","file","upload","find","path","scrollToSelected","undefined","floor","uploaded","canDelete","el","scrollIntoView","behavior","block","useId","useRef","useTransition","useFileBrowser","useCommand","styles","FileUploader","t0","$","_c","fileType","store","rootId","inputRef","startTransition","accept","t1","Symbol","for","--open-file-picker","current","showPicker","rootRef","t2","inputFile","file","files","upload","alert","name","stageFile","t3","t4","t5","uploader","useEffect","useId","useRef","useState","useSyncExternalStore","createRoot","useCommand","FrontMatterStore","getSnapshot","fields","subscribe","listener","listeners","add","delete","Set","constructor","initialData","parseInitialData","getData","toData","setFields","next","createFrontMatterEditor","options","store","originalFrontMatter","hasFrontMatter","JSON","stringify","undefined","unsubscribe","onUpdated","root","container","render","teardown","unmount","getOriginalFrontMatter","Symbol","dispose","FrontMatterEditorView","rootId","dialogId","isCollapsed","setIsCollapsed","addDialogOpen","setAddDialogOpen","jsonDrafts","setJsonDrafts","applyFields","updateFieldValue","key","value","map","f","rootRef","--fm-toggle","prev","--fm-add-field","e","source","filter","_removed","rest","onAddSubmit","preventDefault","formData","FormData","currentTarget","String","get","type","some","getDefaultValue","length","field","text","FieldInput","t0","$","_c","inputId","jsonDraft","onValueChange","onJsonDraftChange","t1","Boolean","t2","e_3","checked","t3","e_2","Number","toDateInputValue","e_1","stringifyJson","isValidJson","e_0","nextText","parse","t4","AddFieldDialog","onSubmit","onClose","dialogRef","for","dialog","current","open","showModal","t5","t6","t7","t8","t9","t10","t11","t12","t13","t14","t15","t16","t17","t18","t19","t20","t21","t22","t23","data","Object","entries","detectType","test","parsed","Date","isNaN","toISOString","split","dateValue","getTime","useEffect","useState","useSyncExternalStore","useFileBrowser","getExt","styles","Preview","t0","$","_c","path","store","dimension","setDimension","prevPath","setPrevPath","t1","file","t2","startsWith","isUploadingMode","t3","getSnapshot","uploads","subscribe","t4","find","u","blob","uploaded","total","progress","t5","t6","file_0","aborted","isImage","image","Image","src","addEventListener","width","naturalWidth","height","naturalHeight","once","isVideo","video","document","createElement","videoWidth","videoHeight","t7","img","uploading","t8","trim","t9","ext","isAudio","isDoc","isPpt","isXls","isPdf","t10","translate","t11","t12","upload","Math","round","t13","t14","meta","t15","IconArrowsTransferDown","IconRowInsertBottom","IconTrash","useId","useState","useCommand","styles","TableEditor","t0","$","_c","value","onChange","rootId","t1","th","map","_temp","rowIds","setRowIds","t2","td","i","id","String","rows","t3","next","_temp2","_temp3","_temp4","commit","rootRef","e","index","Number","source","toSpliced","crypto","randomUUID","e_0","index_0","e_1","from","to","fromRow","toRow","t6","t5","i_0","th_0","row","e_2","with","currentTarget","e_3","btn","length","t7","t4","table","row_1","row_0","useId","useRef","useCommand","styles","Tabs","current","onChange","contentId","length","createLabel","index","listId","refs","update","focus","rootRef","e","value","source","Number","onKeyDown","event","key","Math","max","min","Array","from","_","el","use","useEffect","useEffectEvent","useRef","useState","useEngine","withFallback","promise","fallback","tagged","status","resolved","Promise","resolve","value","catch","WysiwygField","t0","$","_c","onChange","itemName","commands","label","engine","t1","getContentStylesheet","contentCssPromise","contentCss","ref","initialValue","t2","el","onTransaction","t3","el_0","current","innerHTML","listener","addEventListener","removeEventListener","t4","Symbol","for","t5","el_1","t6","useEffect","useEffectEvent","useMountEffect","fn","$","_c","onMount","t0","t1","Symbol","for","useEffect","useEffectEvent","useRef","useExternalFileSelection","selected","getCurrentPath","onExternalChange","$","_c","skipNextRun","t0","current","path","handleSelectedChange","t1","t2","Checkbox","t0","$","_c","label","checked","onChange","name","disabled","describedBy","t1","e","currentTarget","t2","t3","Fieldset","t0","$","_c","legend","id","disabled","children","t1","t2","NumberField","t0","$","_c","label","value","onChange","name","min","max","step","disabled","t1","t2","Number","isFinite","t3","e","currentTarget","valueAsNumber","t4","t5","useId","RadioGroup","t0","$","_c","label","value","onChange","options","name","disabled","labelId","t1","t2","t3","option","e","currentTarget","checked","map","SelectField","t0","$","_c","label","value","onChange","options","name","disabled","t1","t2","e","currentTarget","t3","map","_temp","t4","t5","option","TextArea","t0","$","_c","label","value","onChange","name","rows","disabled","t1","t2","e","currentTarget","t3","t4","TextField","t0","$","_c","label","value","onChange","type","t1","name","disabled","placeholder","describedBy","undefined","t2","t3","e","currentTarget","t4","t5"],"sources":["../../../../node_modules/@tabler/icons-react/dist/esm/icons/IconArrowsTransferDown.mjs","../../../../node_modules/@tabler/icons-react/dist/esm/icons/IconFileTypeDoc.mjs","../../../../node_modules/@tabler/icons-react/dist/esm/icons/IconFileTypePdf.mjs","../../../../node_modules/@tabler/icons-react/dist/esm/icons/IconFileTypePpt.mjs","../../../../node_modules/@tabler/icons-react/dist/esm/icons/IconFileTypeXls.mjs","../../../../node_modules/@tabler/icons-react/dist/esm/icons/IconFile.mjs","../../../../node_modules/@tabler/icons-react/dist/esm/icons/IconHeadphones.mjs","../../../../node_modules/@tabler/icons-react/dist/esm/icons/IconVideo.mjs","../src/file-browser/store.ts","../src/file-browser/use-file-browser.ts","../src/components/file-list.module.css","../src/get-ext.ts","../src/components/thumbnail.module.css","../src/components/thumbnail.tsx","../src/components/file-list.tsx","../src/components/file-uploader.module.css","../src/components/file-uploader.tsx","../src/components/front-matter-editor.tsx","../src/components/preview.module.css","../src/components/preview.tsx","../src/components/table-editor.module.css","../src/components/table-editor.tsx","../src/components/tabs.module.css","../src/components/tabs.tsx","../src/components/wysiwyg-field.tsx","../src/use-mount-effect.ts","../src/file-browser/use-external-file-selection.ts","../src/form/checkbox.tsx","../src/form/fieldset.tsx","../src/form/number-field.tsx","../src/form/radio-group.tsx","../src/form/select-field.tsx","../src/form/text-area.tsx","../src/form/text-field.tsx"],"sourcesContent":["/**\n * @license @tabler/icons-react v3.46.0 - MIT\n *\n * This source code is licensed under the MIT license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createReactComponent from '../createReactComponent.mjs';\n\nconst __iconNode = [[\"path\", { \"d\": \"M17 3v6\", \"key\": \"svg-0\" }], [\"path\", { \"d\": \"M10 18l-3 3l-3 -3\", \"key\": \"svg-1\" }], [\"path\", { \"d\": \"M7 21v-18\", \"key\": \"svg-2\" }], [\"path\", { \"d\": \"M20 6l-3 -3l-3 3\", \"key\": \"svg-3\" }], [\"path\", { \"d\": \"M17 21v-2\", \"key\": \"svg-4\" }], [\"path\", { \"d\": \"M17 15v-2\", \"key\": \"svg-5\" }]];\nconst IconArrowsTransferDown = createReactComponent(\"outline\", \"arrows-transfer-down\", \"ArrowsTransferDown\", __iconNode);\n\nexport { __iconNode, IconArrowsTransferDown as default };\n//# sourceMappingURL=IconArrowsTransferDown.mjs.map\n","/**\n * @license @tabler/icons-react v3.46.0 - MIT\n *\n * This source code is licensed under the MIT license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createReactComponent from '../createReactComponent.mjs';\n\nconst __iconNode = [[\"path\", { \"d\": \"M14 3v4a1 1 0 0 0 1 1h4\", \"key\": \"svg-0\" }], [\"path\", { \"d\": \"M5 12v-7a2 2 0 0 1 2 -2h7l5 5v4\", \"key\": \"svg-1\" }], [\"path\", { \"d\": \"M5 15v6h1a2 2 0 0 0 2 -2v-2a2 2 0 0 0 -2 -2h-1\", \"key\": \"svg-2\" }], [\"path\", { \"d\": \"M20 16.5a1.5 1.5 0 0 0 -3 0v3a1.5 1.5 0 0 0 3 0\", \"key\": \"svg-3\" }], [\"path\", { \"d\": \"M12.5 15a1.5 1.5 0 0 1 1.5 1.5v3a1.5 1.5 0 0 1 -3 0v-3a1.5 1.5 0 0 1 1.5 -1.5\", \"key\": \"svg-4\" }]];\nconst IconFileTypeDoc = createReactComponent(\"outline\", \"file-type-doc\", \"FileTypeDoc\", __iconNode);\n\nexport { __iconNode, IconFileTypeDoc as default };\n//# sourceMappingURL=IconFileTypeDoc.mjs.map\n","/**\n * @license @tabler/icons-react v3.46.0 - MIT\n *\n * This source code is licensed under the MIT license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createReactComponent from '../createReactComponent.mjs';\n\nconst __iconNode = [[\"path\", { \"d\": \"M14 3v4a1 1 0 0 0 1 1h4\", \"key\": \"svg-0\" }], [\"path\", { \"d\": \"M5 12v-7a2 2 0 0 1 2 -2h7l5 5v4\", \"key\": \"svg-1\" }], [\"path\", { \"d\": \"M5 18h1.5a1.5 1.5 0 0 0 0 -3h-1.5v6\", \"key\": \"svg-2\" }], [\"path\", { \"d\": \"M17 18h2\", \"key\": \"svg-3\" }], [\"path\", { \"d\": \"M20 15h-3v6\", \"key\": \"svg-4\" }], [\"path\", { \"d\": \"M11 15v6h1a2 2 0 0 0 2 -2v-2a2 2 0 0 0 -2 -2h-1\", \"key\": \"svg-5\" }]];\nconst IconFileTypePdf = createReactComponent(\"outline\", \"file-type-pdf\", \"FileTypePdf\", __iconNode);\n\nexport { __iconNode, IconFileTypePdf as default };\n//# sourceMappingURL=IconFileTypePdf.mjs.map\n","/**\n * @license @tabler/icons-react v3.46.0 - MIT\n *\n * This source code is licensed under the MIT license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createReactComponent from '../createReactComponent.mjs';\n\nconst __iconNode = [[\"path\", { \"d\": \"M14 3v4a1 1 0 0 0 1 1h4\", \"key\": \"svg-0\" }], [\"path\", { \"d\": \"M14 3v4a1 1 0 0 0 1 1h4\", \"key\": \"svg-1\" }], [\"path\", { \"d\": \"M5 18h1.5a1.5 1.5 0 0 0 0 -3h-1.5v6\", \"key\": \"svg-2\" }], [\"path\", { \"d\": \"M11 18h1.5a1.5 1.5 0 0 0 0 -3h-1.5v6\", \"key\": \"svg-3\" }], [\"path\", { \"d\": \"M16.5 15h3\", \"key\": \"svg-4\" }], [\"path\", { \"d\": \"M18 15v6\", \"key\": \"svg-5\" }], [\"path\", { \"d\": \"M5 12v-7a2 2 0 0 1 2 -2h7l5 5v4\", \"key\": \"svg-6\" }]];\nconst IconFileTypePpt = createReactComponent(\"outline\", \"file-type-ppt\", \"FileTypePpt\", __iconNode);\n\nexport { __iconNode, IconFileTypePpt as default };\n//# sourceMappingURL=IconFileTypePpt.mjs.map\n","/**\n * @license @tabler/icons-react v3.46.0 - MIT\n *\n * This source code is licensed under the MIT license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createReactComponent from '../createReactComponent.mjs';\n\nconst __iconNode = [[\"path\", { \"d\": \"M14 3v4a1 1 0 0 0 1 1h4\", \"key\": \"svg-0\" }], [\"path\", { \"d\": \"M5 12v-7a2 2 0 0 1 2 -2h7l5 5v4\", \"key\": \"svg-1\" }], [\"path\", { \"d\": \"M4 15l4 6\", \"key\": \"svg-2\" }], [\"path\", { \"d\": \"M4 21l4 -6\", \"key\": \"svg-3\" }], [\"path\", { \"d\": \"M17 20.25c0 .414 .336 .75 .75 .75h1.25a1 1 0 0 0 1 -1v-1a1 1 0 0 0 -1 -1h-1a1 1 0 0 1 -1 -1v-1a1 1 0 0 1 1 -1h1.25a.75 .75 0 0 1 .75 .75\", \"key\": \"svg-4\" }], [\"path\", { \"d\": \"M11 15v6h3\", \"key\": \"svg-5\" }]];\nconst IconFileTypeXls = createReactComponent(\"outline\", \"file-type-xls\", \"FileTypeXls\", __iconNode);\n\nexport { __iconNode, IconFileTypeXls as default };\n//# sourceMappingURL=IconFileTypeXls.mjs.map\n","/**\n * @license @tabler/icons-react v3.46.0 - MIT\n *\n * This source code is licensed under the MIT license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createReactComponent from '../createReactComponent.mjs';\n\nconst __iconNode = [[\"path\", { \"d\": \"M14 3v4a1 1 0 0 0 1 1h4\", \"key\": \"svg-0\" }], [\"path\", { \"d\": \"M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2\", \"key\": \"svg-1\" }]];\nconst IconFile = createReactComponent(\"outline\", \"file\", \"File\", __iconNode);\n\nexport { __iconNode, IconFile as default };\n//# sourceMappingURL=IconFile.mjs.map\n","/**\n * @license @tabler/icons-react v3.46.0 - MIT\n *\n * This source code is licensed under the MIT license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createReactComponent from '../createReactComponent.mjs';\n\nconst __iconNode = [[\"path\", { \"d\": \"M4 15a2 2 0 0 1 2 -2h1a2 2 0 0 1 2 2v3a2 2 0 0 1 -2 2h-1a2 2 0 0 1 -2 -2l0 -3\", \"key\": \"svg-0\" }], [\"path\", { \"d\": \"M15 15a2 2 0 0 1 2 -2h1a2 2 0 0 1 2 2v3a2 2 0 0 1 -2 2h-1a2 2 0 0 1 -2 -2l0 -3\", \"key\": \"svg-1\" }], [\"path\", { \"d\": \"M4 15v-3a8 8 0 0 1 16 0v3\", \"key\": \"svg-2\" }]];\nconst IconHeadphones = createReactComponent(\"outline\", \"headphones\", \"Headphones\", __iconNode);\n\nexport { __iconNode, IconHeadphones as default };\n//# sourceMappingURL=IconHeadphones.mjs.map\n","/**\n * @license @tabler/icons-react v3.46.0 - MIT\n *\n * This source code is licensed under the MIT license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createReactComponent from '../createReactComponent.mjs';\n\nconst __iconNode = [[\"path\", { \"d\": \"M15 10l4.553 -2.276a1 1 0 0 1 1.447 .894v6.764a1 1 0 0 1 -1.447 .894l-4.553 -2.276v-4\", \"key\": \"svg-0\" }], [\"path\", { \"d\": \"M3 8a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2l0 -8\", \"key\": \"svg-1\" }]];\nconst IconVideo = createReactComponent(\"outline\", \"video\", \"Video\", __iconNode);\n\nexport { __iconNode, IconVideo as default };\n//# sourceMappingURL=IconVideo.mjs.map\n","import type {\n\tBurgerEditorEngine,\n\tFileListResult,\n\tFileType,\n\tFileRequestOptions,\n} from '@burger-editor/core';\n\n/**\n * A file currently selected for a given `FileType` inside a dialog — the\n * path the item editor should apply, plus the byte size the old\n * `file-select` component-observer payload used to carry.\n */\nexport interface SelectedFile {\n\treadonly path: string;\n\treadonly fileSize: number;\n}\n\n/**\n * One upload in flight. Kept in the store (not local component state) so\n * `FileList` and `Preview` — siblings under the same item editor — both\n * see the same synthetic \"uploading…\" row / progress bar without a\n * broadcast bus.\n */\nexport interface UploadProgress {\n\treadonly fileType: FileType;\n\treadonly blob: string;\n\treadonly uploaded: number;\n\treadonly total: number;\n}\n\nexport interface FileBrowserQuery {\n\treadonly fileType: FileType;\n\treadonly page: number;\n\treadonly filter: string;\n}\n\ninterface FileBrowserState {\n\treadonly selected: { readonly [K in FileType]?: SelectedFile };\n\treadonly uploads: readonly UploadProgress[];\n}\n\nconst EMPTY_RESULT: FileListResult = {\n\terror: false,\n\tdata: [],\n\tpagination: { current: 0, total: 1 },\n};\n\ntype Listener = () => void;\n\n/**\n * Cache key for a file-list query — used both to look up a cached\n * promise and (via its `fileType` prefix) to find every cached page for\n * a given file type on invalidation.\n *\n * `selectedPath` (present only on the very first read for a `fileType`,\n * see {@link FileBrowserStore.read}) is folded into the key so that an\n * initial read's response — which the server may have jumped to a\n * different page than the one requested, to land on the selected file —\n * never collides with a later, unrelated `{fileType, page, filter}`\n * request for the *same nominal page* opened by a different item in the\n * same engine session. Without this, a second item reusing page 0 would\n * transparently receive the first item's page-jumped response instead of\n * a real page 0.\n * @param query - The query to key\n * @param selectedPath - The `selected` path actually sent with this\n * query, if any\n */\nfunction queryKey(query: FileBrowserQuery, selectedPath: string | undefined): string {\n\treturn `${query.fileType}:${query.page}:${query.filter}:${selectedPath ?? ''}`;\n}\n\n/**\n * Per-engine file-browser state: paginated/filtered `getFileList` query\n * results (cached by query, read through `use()`), the file currently\n * selected per `FileType`, and in-flight upload progress.\n *\n * React-independent so it can be constructed once per engine and shared\n * by every component that opens onto the same file browser (`FileList`,\n * `FileUploader`, `Preview`, and the item's own `Editor`) without a\n * window-level broadcast bus — see {@link getFileBrowserStore}.\n * @example\n * ```tsx\n * const store = getFileBrowserStore(engine);\n * const result = use(store.read({ fileType: 'image', page: 0, filter: '' }));\n * const selected = useSyncExternalStore(store.subscribe, store.getSnapshot);\n * ```\n */\nexport class FileBrowserStore {\n\treadonly getSnapshot = (): FileBrowserState => this.#state;\n\n\treadonly subscribe = (listener: Listener): (() => void) => {\n\t\tthis.#listeners.add(listener);\n\t\treturn () => {\n\t\t\tthis.#listeners.delete(listener);\n\t\t};\n\t};\n\n\treadonly #engine: BurgerEditorEngine;\n\t// fileTypeごとに最初の一回だけ`selected`をサーバーへ渡すためのフラグ。\n\t// invalidate()では落とさない(アップロード/削除後の再取得のたびに\n\t// 選択中ファイルのページへ引き戻されると、そのページを見ていた\n\t// ユーザーの手動ページ送りが台無しになる)\n\treadonly #initialReadDone = new Set<FileType>();\n\treadonly #listeners = new Set<Listener>();\n\treadonly #queries = new Map<string, Promise<FileListResult>>();\n\t#state: FileBrowserState = { selected: {}, uploads: [] };\n\n\t/** Whether the engine's `serverAPI` supports deleting files. */\n\tget canDelete(): boolean {\n\t\treturn !!this.#engine.serverAPI.deleteFile;\n\t}\n\n\tconstructor(engine: BurgerEditorEngine) {\n\t\tthis.#engine = engine;\n\t}\n\n\t/**\n\t * Delete a file from the server and invalidate `fileType`'s cached\n\t * pages so the list reflects the deletion on next read.\n\t * @param fileType - The file type the file belongs to\n\t * @param url - The file's URL\n\t * @throws {Error} When the server reports the deletion failed\n\t */\n\tasync deleteFile(fileType: FileType, url: string): Promise<void> {\n\t\tconst deleteFile = this.#engine.serverAPI.deleteFile;\n\t\tif (!deleteFile) {\n\t\t\treturn;\n\t\t}\n\t\tconst res = await deleteFile(fileType, url);\n\t\tif (res.error) {\n\t\t\tthrow new Error(`Failed to delete file: ${url}`);\n\t\t}\n\t\tthis.invalidate(fileType);\n\t}\n\n\t/**\n\t * Drop every cached page for `fileType` and notify subscribers, so the\n\t * next `read()` for that type issues a fresh request (after an upload\n\t * or a delete changes the underlying list).\n\t * @param fileType - The file type whose cached pages should be dropped\n\t */\n\tinvalidate(fileType: FileType): void {\n\t\tconst prefix = `${fileType}:`;\n\t\tfor (const key of this.#queries.keys()) {\n\t\t\tif (key.startsWith(prefix)) {\n\t\t\t\tthis.#queries.delete(key);\n\t\t\t}\n\t\t}\n\t\tthis.#emit();\n\t}\n\n\t/**\n\t * Read (and cache) one page of the file list. The returned promise is\n\t * stable per `{fileType, page, filter}` plus whether this particular\n\t * read sent `selected` (see below) — safe to pass to `use()` directly\n\t * from render, repeated calls with the same query return the same\n\t * promise instead of re-suspending.\n\t *\n\t * The very first read for a given `fileType` also sends the currently\n\t * selected file's path as `selected`, so the server can jump straight\n\t * to the page that already contains it (e.g. re-opening an image item\n\t * whose file isn't on page 0) instead of always starting at `page`.\n\t * Later reads for that `fileType` (explicit pagination, search, or a\n\t * post-upload/-delete refetch via {@link invalidate}) omit it — always\n\t * including it would silently override the page the caller asked for.\n\t *\n\t * Because that jump means the response's actual page can differ from\n\t * the requested one, `selected` is folded into the cache key (see\n\t * {@link queryKey}): a later item opening the same `fileType` and\n\t * nominal page never transparently receives the first item's\n\t * page-jumped response — it misses the cache and gets a real page.\n\t * @param query - The file type, page and filter to query\n\t * @returns The (possibly still-pending, cached) file list page\n\t */\n\tread(query: FileBrowserQuery): Promise<FileListResult> {\n\t\tconst isInitialRead = !this.#initialReadDone.has(query.fileType);\n\t\tconst selectedPath = isInitialRead\n\t\t\t? this.#state.selected[query.fileType]?.path\n\t\t\t: undefined;\n\t\tconst key = queryKey(query, selectedPath);\n\t\tconst cached = this.#queries.get(key);\n\t\tif (cached) {\n\t\t\treturn cached;\n\t\t}\n\t\tthis.#initialReadDone.add(query.fileType);\n\t\tconst getFileList = this.#engine.serverAPI.getFileList;\n\t\tconst options: FileRequestOptions = {\n\t\t\tpage: query.page,\n\t\t\tfilter: query.filter,\n\t\t\tselected: selectedPath,\n\t\t};\n\t\tconst promise = getFileList\n\t\t\t? getFileList(query.fileType, options)\n\t\t\t: Promise.resolve(EMPTY_RESULT);\n\t\t// 失敗したクエリはキャッシュに残さず、再レンダーで再試行できるようにする\n\t\tpromise.catch(() => {\n\t\t\tthis.#queries.delete(key);\n\t\t});\n\t\tthis.#queries.set(key, promise);\n\t\treturn promise;\n\t}\n\n\t/**\n\t * Record the file currently selected for `fileType` — a no-op when the\n\t * path is unchanged, so callers can call this unconditionally (e.g.\n\t * every render) without causing redundant notifications.\n\t * @param fileType - The file type being selected for\n\t * @param path - The selected file's path, or `''` for \"nothing selected\"\n\t * @param fileSize - The selected file's byte size, when known\n\t */\n\tselect(fileType: FileType, path: string, fileSize = 0): void {\n\t\tconst current = this.#state.selected[fileType];\n\t\tif (current?.path === path) {\n\t\t\treturn;\n\t\t}\n\t\tthis.#patch({\n\t\t\tselected: { ...this.#state.selected, [fileType]: { path, fileSize } },\n\t\t});\n\t}\n\n\t/**\n\t * Upload a file, tracking progress in `uploads` (so `FileList` and\n\t * `Preview` can both show it) and selecting the resulting URL once the\n\t * server responds — a blob URL is selected immediately so the UI has\n\t * something to show while the upload is in flight.\n\t *\n\t * The blob URL is revoked once the upload settles. On failure the\n\t * selection is restored to what it was before the upload (empty path if\n\t * nothing was selected), so a revoked blob URL is never left selected\n\t * for the dialog to confirm.\n\t * @param fileType - The file type to upload into\n\t * @param file - The file to upload\n\t * @throws {Error} When no `postFile` API is configured, or the server\n\t * reports the upload failed\n\t */\n\tasync upload(fileType: FileType, file: File): Promise<void> {\n\t\tconst postFile = this.#engine.serverAPI.postFile;\n\t\tconst blob = URL.createObjectURL(file);\n\t\tconst previous = this.#state.selected[fileType];\n\t\tthis.select(fileType, blob, file.size);\n\t\tthis.#patch({\n\t\t\tuploads: [\n\t\t\t\t...this.#state.uploads,\n\t\t\t\t{ fileType, blob, uploaded: 0, total: file.size || 1 },\n\t\t\t],\n\t\t});\n\t\ttry {\n\t\t\tif (!postFile) {\n\t\t\t\tthrow new Error('postFile is not configured');\n\t\t\t}\n\t\t\tconst res = await postFile(fileType, file, (uploaded, total) => {\n\t\t\t\tthis.#patch({\n\t\t\t\t\tuploads: this.#state.uploads.map((u) =>\n\t\t\t\t\t\tu.blob === blob ? { ...u, uploaded, total } : u,\n\t\t\t\t\t),\n\t\t\t\t});\n\t\t\t});\n\t\t\tif (res.error) {\n\t\t\t\tthrow new Error(`Failed to upload file: ${file.name}`);\n\t\t\t}\n\t\t\tthis.invalidate(fileType);\n\t\t\tthis.select(fileType, res.uploaded.url, res.uploaded.size);\n\t\t} catch (error) {\n\t\t\t// 失敗したblob URLを選択に残すと、解放後に壊れたプレビューと無効な\n\t\t\t// pathが確定されてしまうため、アップロード前の選択へ戻す\n\t\t\tthis.select(fileType, previous?.path ?? '', previous?.fileSize);\n\t\t\tthrow error;\n\t\t} finally {\n\t\t\tthis.#patch({ uploads: this.#state.uploads.filter((u) => u.blob !== blob) });\n\t\t\t// blob URLはアップロード中のプレビュー専用。成功時は選択が実URLへ\n\t\t\t// 移っており、失敗時もこれ以上の参照元はないので、必ずここで解放する\n\t\t\tURL.revokeObjectURL(blob);\n\t\t}\n\t}\n\n\t#emit(): void {\n\t\tfor (const listener of this.#listeners) {\n\t\t\tlistener();\n\t\t}\n\t}\n\n\t#patch(patch: Partial<FileBrowserState>): void {\n\t\tthis.#state = { ...this.#state, ...patch };\n\t\tthis.#emit();\n\t}\n}\n\nconst stores = new WeakMap<BurgerEditorEngine, FileBrowserStore>();\n\n/**\n * Get (creating on first access) the `FileBrowserStore` for `engine`. One\n * store per engine, shared by every component under it — see\n * {@link FileBrowserStore}.\n * @param engine - The engine to get the store for\n * @returns That engine's file-browser store\n */\nexport function getFileBrowserStore(engine: BurgerEditorEngine): FileBrowserStore {\n\tlet store = stores.get(engine);\n\tif (!store) {\n\t\tstore = new FileBrowserStore(engine);\n\t\tstores.set(engine, store);\n\t}\n\treturn store;\n}\n","import type { FileBrowserStore } from './store.js';\n\nimport { useEngine } from '../engine-context.js';\n\nimport { getFileBrowserStore } from './store.js';\n\n/**\n * Get the current engine's `FileBrowserStore` — file-list query cache,\n * current selection and upload progress shared by `FileList`,\n * `FileUploader`, `Preview` and the item's own `Editor`.\n * @returns The engine's file-browser store\n * @example\n * ```tsx\n * const fileBrowser = useFileBrowser();\n * const selected = useSyncExternalStore(\n * \tfileBrowser.subscribe,\n * \t() => fileBrowser.getSnapshot().selected.image,\n * );\n * ```\n */\nexport function useFileBrowser(): FileBrowserStore {\n\tconst engine = useEngine();\n\treturn getFileBrowserStore(engine);\n}\n",".ctrl {\n\tdisplay: flex;\n\tgap: 2em;\n\tmargin-block-end: 1em;\n}\n\n.pagination {\n\tdisplay: flex;\n\tflex: 1 0 auto;\n\tgap: 1em;\n\talign-items: center;\n\tjustify-content: center;\n\n\tbutton {\n\t\tuser-select: none;\n\t}\n}\n\n.page {\n\tdisplay: flex;\n\tgap: 0.5em;\n\talign-items: center;\n}\n\n.list {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 0.5em;\n\tpadding: 0;\n\tmargin: 0;\n\n\tli {\n\t\tposition: relative;\n\t\tpadding: 0;\n\t\tmargin: 0;\n\t\tlist-style: none;\n\t}\n\n\tli:is(:focus-within:has(:focus-visible), :hover) .delete {\n\t\topacity: 1;\n\t}\n}\n\n.file {\n\tz-index: 0;\n\tdisplay: flex;\n\tgap: 1em;\n\talign-items: center;\n\tinline-size: 100%;\n\tpadding: 0.5em;\n\ttext-align: start;\n\tborder: none;\n\n\t> span {\n\t\tdisplay: block;\n\t}\n\n\t> span.thumbnail {\n\t\tdisplay: block;\n\t\tflex: 0 0 7em;\n\t\tinline-size: 7em;\n\t\tblock-size: 7em;\n\t}\n\n\t> span.attr {\n\t\tdisplay: grid;\n\t\tgrid-template-columns: max-content 1fr;\n\t\tgap: 0.2em 1em;\n\t\talign-items: baseline;\n\t}\n\n\t> span.attr > span:nth-child(odd)::after {\n\t\tcontent: ':';\n\t}\n}\n\n.delete {\n\tposition: absolute;\n\tinset-block-end: 0.7em;\n\tinset-inline-end: 0.7em;\n\tdisplay: block;\n\tpadding: 0.5em;\n\tfont-size: 0.8em;\n\ttext-align: center;\n\topacity: 0;\n\n\t&:hover {\n\t\t--bge-border-color: var(--bge-ui-primary-color);\n\t}\n}\n\n.file[aria-pressed='true'] + .delete {\n\t--bge-outline-color: #fff;\n\t--bge-border-color: #fff;\n\n\tcolor: #fff;\n\tbackground-color: var(--bge-ui-primary-color);\n}\n","/**\n *\n * @param src\n */\nexport function getExt(src: string) {\n\tconst ext = src.split('.').pop()?.toLowerCase() ?? '';\n\n\tconst isImage = ['jpg', 'jpeg', 'png', 'gif', 'webp', 'svg'].includes(ext);\n\tconst isVideo = ['mp4', 'webm', 'mov', 'avi'].includes(ext);\n\tconst isAudio = ['mp3', 'wav', 'm4a', 'ogg', 'flac'].includes(ext);\n\tconst isDoc = ['doc', 'docx'].includes(ext);\n\tconst isPpt = ['ppt', 'pptx'].includes(ext);\n\tconst isXls = ['xls', 'xlsx'].includes(ext);\n\tconst isPdf = ['pdf'].includes(ext);\n\n\treturn {\n\t\text,\n\t\tisImage,\n\t\tisVideo,\n\t\tisAudio,\n\t\tisDoc,\n\t\tisPpt,\n\t\tisXls,\n\t\tisPdf,\n\t};\n}\n",".thumbnail {\n\tdisplay: block;\n\tinline-size: 100%;\n\tblock-size: 100%;\n\n\timg,\n\tvideo {\n\t\tdisplay: block;\n\t\tinline-size: 100%;\n\t\tblock-size: 100%;\n\t\tobject-fit: cover;\n\t\ttransition: opacity 300ms linear;\n\t}\n\n\t&[data-loaded='false'] img {\n\t\topacity: 0;\n\t}\n\n\t&[data-loaded='true'] img {\n\t\topacity: 1;\n\t}\n}\n","import {\n\tIconFile,\n\tIconFileTypeDoc,\n\tIconFileTypePdf,\n\tIconFileTypePpt,\n\tIconFileTypeXls,\n\tIconHeadphones,\n\tIconVideo,\n} from '@tabler/icons-react';\nimport { useState } from 'react';\n\nimport { getExt } from '../get-ext.js';\n\nimport styles from './thumbnail.module.css';\n\n/**\n * File thumbnail. Renders an image/video preview or a file-type icon.\n *\n * The file type is inferred from the URL's extension (`getExt`) — the\n * URL is the only information available here, so the extension decides\n * whether the file can be previewed inline or needs a type icon.\n * @param root0\n * @param root0.src\n * @example\n * ```tsx\n * <Thumbnail src={file.url} />\n * ```\n */\nexport function Thumbnail({ src }: { readonly src: string }) {\n\tconst [isLoaded, setIsLoaded] = useState(false);\n\n\tconst file = getExt(src);\n\n\treturn (\n\t\t<span\n\t\t\tclassName={styles['thumbnail']}\n\t\t\tdata-bge-editor-ui-component=\"thumbnail\"\n\t\t\tdata-loaded={isLoaded}>\n\t\t\t{file.isImage ? (\n\t\t\t\t<img\n\t\t\t\t\tsrc={src}\n\t\t\t\t\talt=\"画像のプレビュー\"\n\t\t\t\t\tloading=\"lazy\"\n\t\t\t\t\tonLoad={() => setIsLoaded(true)}\n\t\t\t\t/>\n\t\t\t) : file.isVideo ? (\n\t\t\t\t<video controls={false} playsInline>\n\t\t\t\t\t<source src={src} type={`video/${file.ext}`} />\n\t\t\t\t\t<track kind=\"captions\" src=\"\" />\n\t\t\t\t\t<IconVideo />\n\t\t\t\t</video>\n\t\t\t) : file.isAudio ? (\n\t\t\t\t<IconHeadphones />\n\t\t\t) : file.isDoc ? (\n\t\t\t\t<IconFileTypeDoc />\n\t\t\t) : file.isPpt ? (\n\t\t\t\t<IconFileTypePpt />\n\t\t\t) : file.isXls ? (\n\t\t\t\t<IconFileTypeXls />\n\t\t\t) : file.isPdf ? (\n\t\t\t\t<IconFileTypePdf />\n\t\t\t) : (\n\t\t\t\t<IconFile />\n\t\t\t)}\n\t\t</span>\n\t);\n}\n","import type { FileType } from '@burger-editor/core';\nimport type { ReactNode } from 'react';\n\nimport { formatByteSize, formatDate } from '@burger-editor/utils';\nimport {\n\tFragment,\n\tuse,\n\tuseDeferredValue,\n\tuseId,\n\tuseState,\n\tuseSyncExternalStore,\n\tuseTransition,\n} from 'react';\n\nimport { useFileBrowser } from '../file-browser/use-file-browser.js';\nimport { useCommand } from '../use-command.js';\n\nimport styles from './file-list.module.css';\nimport { Thumbnail } from './thumbnail.js';\n\n/**\n * Paginated, searchable file list. Reads its page through `use()` against\n * the engine's `FileBrowserStore` (suspends into the dialog's Suspense\n * boundary while loading); selection and in-flight uploads come from the\n * same store, shared with `FileUploader` and the item's own `Editor`\n * instead of a broadcast bus.\n * @param root0\n * @param root0.fileType\n * @example\n * ```tsx\n * <FileUploader fileType=\"image\" />\n * <FileList fileType=\"image\" />\n * ```\n */\nexport function FileList({ fileType }: { readonly fileType: FileType }) {\n\t// store.read()はReactの外(FileBrowserStoreの内部Mapキャッシュ)が\n\t// invalidate()で更新される、意図的に不純な関数(react.devのRules of\n\t// Reactに違反する — 同じ引数でも呼び出しごとに結果が変わりうる)。\n\t// React Compilerは「同じ引数なら前回の結果を再利用してよい」と誤って\n\t// 判断し、アップロード/削除後のinvalidate()に対する再取得\n\t// (getFileListの再呼び出し)を静かにスキップしてしまう\n\t// (file-list.spec.tsxの回帰テストで実測確認済み)。この関数だけ\n\t// コンパイラの最適化対象から明示的に外す\n\t'use no memo';\n\n\tconst store = useFileBrowser();\n\tconst rootId = useId();\n\n\tconst [page, setPage] = useState(0);\n\tconst [searchWord, setSearchWord] = useState('');\n\tconst deferredFilter = useDeferredValue(searchWord);\n\tconst [isPending, startTransition] = useTransition();\n\n\tconst selected = useSyncExternalStore(\n\t\tstore.subscribe,\n\t\t() => store.getSnapshot().selected[fileType],\n\t);\n\tconst uploads = useSyncExternalStore(\n\t\tstore.subscribe,\n\t\t() => store.getSnapshot().uploads,\n\t);\n\tconst myUploads = uploads.filter((u) => u.fileType === fileType);\n\n\tconst result = use(store.read({ fileType, page, filter: deferredFilter }));\n\tconst totalPage = result.pagination.total;\n\tconst currentPage = result.pagination.current;\n\n\t// アップロード中のblob行を先頭に合成する。サーバーはまだこのファイルを\n\t// 知らないため、result.dataとは別にstoreのuploadsから直接描画する\n\tconst files = [\n\t\t// timestampは常にuploadブランチ側の表示(進捗%)のため未使用 —\n\t\t// アップロード完了行の描画には使われない\n\t\t...myUploads.map((u) => ({\n\t\t\tfileId: '',\n\t\t\tname: '',\n\t\t\tsize: 0,\n\t\t\ttimestamp: 0,\n\t\t\turl: u.blob,\n\t\t\tsizes: {},\n\t\t})),\n\t\t...result.data.filter((f) => !myUploads.some((u) => u.blob === f.url)),\n\t];\n\n\tconst paginate = (nextPage: number) => {\n\t\tnextPage = Number.isNaN(nextPage)\n\t\t\t? 0\n\t\t\t: Math.min(Math.max(0, nextPage), totalPage - 1);\n\t\tif (nextPage === currentPage) {\n\t\t\treturn;\n\t\t}\n\t\tstartTransition(() => {\n\t\t\tsetPage(nextPage);\n\t\t});\n\t};\n\n\tconst rootRef = useCommand<HTMLDivElement>({\n\t\t'--paginate': (e) => {\n\t\t\tconst direction = (e.source as HTMLButtonElement | null)?.value;\n\t\t\tpaginate(direction === 'prev' ? currentPage - 1 : currentPage + 1);\n\t\t},\n\t\t'--select-file': (e) => {\n\t\t\tconst source = e.source as HTMLButtonElement | null;\n\t\t\tif (!source) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tstore.select(fileType, source.value, Number(source.dataset['size'] ?? '0'));\n\t\t},\n\t\t'--delete-file': (e) => {\n\t\t\tconst url = (e.source as HTMLButtonElement | null)?.value;\n\t\t\tif (!url) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tstartTransition(async () => {\n\t\t\t\ttry {\n\t\t\t\t\tawait store.deleteFile(fileType, url);\n\t\t\t\t} catch {\n\t\t\t\t\talert('ファイルの削除に失敗しました。');\n\t\t\t\t}\n\t\t\t});\n\t\t},\n\t});\n\n\tconst marked = (text: string): ReactNode => {\n\t\tif (!searchWord) {\n\t\t\treturn text;\n\t\t}\n\t\tconst chars = text.split(searchWord);\n\t\treturn chars.map((char, i) => (\n\t\t\t<Fragment key={char + i}>\n\t\t\t\t{i === 0 ? null : <mark>{searchWord}</mark>}\n\t\t\t\t{char}\n\t\t\t</Fragment>\n\t\t));\n\t};\n\n\treturn (\n\t\t<div ref={rootRef} id={rootId} aria-busy={isPending}>\n\t\t\t<div className={styles['ctrl']}>\n\t\t\t\t<div className={styles['pagination']}>\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tdisabled={currentPage === 0}\n\t\t\t\t\t\tcommand=\"--paginate\"\n\t\t\t\t\t\tcommandfor={rootId}\n\t\t\t\t\t\tvalue=\"prev\">\n\t\t\t\t\t\t前へ\n\t\t\t\t\t</button>\n\t\t\t\t\t<div className={styles['page']}>\n\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t\t\t\tvalue={currentPage + 1}\n\t\t\t\t\t\t\t\tmin=\"1\"\n\t\t\t\t\t\t\t\tmax={totalPage}\n\t\t\t\t\t\t\t\tonChange={(e) => paginate(e.currentTarget.valueAsNumber - 1)}\n\t\t\t\t\t\t\t\taria-label=\"ページ番号\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t<span>/</span>\n\t\t\t\t\t\t<span>{totalPage}</span>\n\t\t\t\t\t</div>\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tdisabled={currentPage === totalPage - 1}\n\t\t\t\t\t\tcommand=\"--paginate\"\n\t\t\t\t\t\tcommandfor={rootId}\n\t\t\t\t\t\tvalue=\"next\">\n\t\t\t\t\t\t次へ\n\t\t\t\t\t</button>\n\t\t\t\t</div>\n\t\t\t\t<input\n\t\t\t\t\ttype=\"search\"\n\t\t\t\t\tplaceholder=\"検索\"\n\t\t\t\t\tvalue={searchWord}\n\t\t\t\t\tonChange={(e) => setSearchWord(e.currentTarget.value)}\n\t\t\t\t/>\n\t\t\t</div>\n\n\t\t\t<ul className={styles['list']}>\n\t\t\t\t{files.map((file) => {\n\t\t\t\t\tconst upload = myUploads.find((u) => u.blob === file.url);\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<li key={file.url}>\n\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\tref={file.url === selected?.path ? scrollToSelected : undefined}\n\t\t\t\t\t\t\t\tclassName={styles['file']}\n\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\taria-pressed={file.url === selected?.path}\n\t\t\t\t\t\t\t\tcommand=\"--select-file\"\n\t\t\t\t\t\t\t\tcommandfor={rootId}\n\t\t\t\t\t\t\t\tvalue={file.url}\n\t\t\t\t\t\t\t\tdata-size={file.size}>\n\t\t\t\t\t\t\t\t<span className={styles['thumbnail']}>\n\t\t\t\t\t\t\t\t\t<Thumbnail src={file.url} />\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t{upload ? (\n\t\t\t\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t\t\t\tアップロード中...{' '}\n\t\t\t\t\t\t\t\t\t\t<span>{Math.floor((upload.uploaded / upload.total) * 100)}%</span>\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t<span className={styles['attr']}>\n\t\t\t\t\t\t\t\t\t\t<span>ID</span>\n\t\t\t\t\t\t\t\t\t\t<span>{marked(file.fileId)}</span>\n\t\t\t\t\t\t\t\t\t\t<span>名称</span>\n\t\t\t\t\t\t\t\t\t\t<span>{marked(file.name)}</span>\n\t\t\t\t\t\t\t\t\t\t<span>更新</span>\n\t\t\t\t\t\t\t\t\t\t<span>{formatDate(file.timestamp / 1000, 'YYYY-MM-DD HH:mm')}</span>\n\t\t\t\t\t\t\t\t\t\t<span>サイズ</span>\n\t\t\t\t\t\t\t\t\t\t<span>{formatByteSize(file.size)}</span>\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t{!upload && store.canDelete ? (\n\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\tclassName={styles['delete']}\n\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\tcommand=\"--delete-file\"\n\t\t\t\t\t\t\t\t\tcommandfor={rootId}\n\t\t\t\t\t\t\t\t\tvalue={file.url}>\n\t\t\t\t\t\t\t\t\t削除\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t</li>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t</ul>\n\t\t</div>\n\t);\n}\n\n/**\n * Callback ref attached only to the currently selected file button, so the\n * list scrolls to it when the selection mounts or changes. Kept at module\n * scope for a stable identity — an inline arrow would re-attach (and\n * re-scroll) on every unrelated re-render such as upload progress updates.\n * @param el - The selected button, or null on detach\n */\nfunction scrollToSelected(el: HTMLButtonElement | null) {\n\tel?.scrollIntoView({\n\t\tbehavior: 'smooth',\n\t\tblock: 'nearest',\n\t});\n}\n",".uploader {\n\tinput[type='file'] {\n\t\tdisplay: none;\n\t}\n}\n","import type { FileType } from '@burger-editor/core';\n\nimport { useId, useRef, useTransition } from 'react';\n\nimport { useFileBrowser } from '../file-browser/use-file-browser.js';\nimport { useCommand } from '../use-command.js';\n\nimport styles from './file-uploader.module.css';\n\n/**\n * File upload control. The trigger button declares a local command and\n * the handler opens the picker via `showPicker()` — no click handlers,\n * no programmatic `click()`. The upload itself goes through the engine's\n * `FileBrowserStore`, shared with `FileList`/`Preview` so they see the\n * same progress without a broadcast bus.\n * @param root0\n * @param root0.fileType\n * @example\n * ```tsx\n * <FileUploader fileType=\"image\" />\n * ```\n */\nexport function FileUploader({ fileType }: { readonly fileType: FileType }) {\n\tconst store = useFileBrowser();\n\tconst rootId = useId();\n\tconst inputRef = useRef<HTMLInputElement>(null);\n\tconst [, startTransition] = useTransition();\n\n\tconst accept = fileType === 'image' ? 'image/*' : '*';\n\n\tconst rootRef = useCommand<HTMLDivElement>({\n\t\t'--open-file-picker': () => {\n\t\t\tinputRef.current?.showPicker();\n\t\t},\n\t});\n\n\tconst stageFile = () => {\n\t\tconst inputFile = inputRef.current;\n\t\tconst file = inputFile?.files?.[0];\n\t\tif (!file) {\n\t\t\treturn;\n\t\t}\n\n\t\tstartTransition(async () => {\n\t\t\ttry {\n\t\t\t\tawait store.upload(fileType, file);\n\t\t\t} catch {\n\t\t\t\t// onChangeからのfire-and-forget呼び出しのため、ここで\n\t\t\t\t// ユーザーに通知しないと失敗が闇に消える\n\t\t\t\talert(`ファイルのアップロードに失敗しました: ${file.name}`);\n\t\t\t}\n\t\t});\n\t};\n\n\treturn (\n\t\t<div ref={rootRef} id={rootId} className={styles['uploader']}>\n\t\t\t<input type=\"file\" ref={inputRef} onChange={stageFile} accept={accept} />\n\t\t\t<button type=\"button\" command=\"--open-file-picker\" commandfor={rootId}>\n\t\t\t\tファイルを追加アップロードする\n\t\t\t</button>\n\t\t</div>\n\t);\n}\n","/* @jsxImportSource react */\nimport type { ReactNode } from 'react';\n\nimport { useEffect, useId, useRef, useState, useSyncExternalStore } from 'react';\nimport { createRoot } from 'react-dom/client';\n\nimport { useCommand } from '../use-command.js';\n\n/**\n * Supported field types for Front Matter editor\n */\ntype FieldType = 'text' | 'number' | 'boolean' | 'date' | 'json';\n\n/**\n * Field definition for Front Matter\n */\nexport interface FieldDefinition {\n\treadonly key: string;\n\treadonly type: FieldType;\n\treadonly value: unknown;\n}\n\n/**\n * Owns the Front Matter field list — the actual data, as opposed to the\n * view's own UI-only state (collapsed, add-dialog-open, in-progress JSON\n * drafts). `createFrontMatterEditor`'s handle reads `getData()`/\n * `getSnapshot()` directly and subscribes to be notified of changes,\n * instead of a mutable closure variable updated from inside a React\n * callback — the handle has no other way to read React state from\n * outside React.\n * @example\n * ```ts\n * const store = new FrontMatterStore({ title: 'A' });\n * store.subscribe(() => console.log(store.getData()));\n * store.setFields([{ key: 'title', type: 'text', value: 'B' }]);\n * ```\n */\nexport class FrontMatterStore {\n\treadonly getSnapshot = (): readonly FieldDefinition[] => this.#fields;\n\treadonly subscribe = (listener: () => void): (() => void) => {\n\t\tthis.#listeners.add(listener);\n\t\treturn () => {\n\t\t\tthis.#listeners.delete(listener);\n\t\t};\n\t};\n\t#fields: readonly FieldDefinition[];\n\treadonly #listeners = new Set<() => void>();\n\n\tconstructor(initialData: Record<string, unknown>) {\n\t\tthis.#fields = parseInitialData(initialData);\n\t}\n\n\tgetData(): Record<string, unknown> {\n\t\treturn toData(this.#fields);\n\t}\n\n\tsetFields(next: readonly FieldDefinition[]): void {\n\t\tthis.#fields = next;\n\t\tfor (const listener of this.#listeners) {\n\t\t\tlistener();\n\t\t}\n\t}\n}\n\n/**\n * Options for the Front Matter editor\n */\nexport interface FrontMatterEditorOptions {\n\t/** Container element to render the editor */\n\treadonly container: HTMLElement;\n\t/** Initial Front Matter data */\n\treadonly initialData: Record<string, unknown>;\n\t/** Whether Front Matter originally existed */\n\treadonly hasFrontMatter: boolean;\n\t/** Callback when data changes */\n\treadonly onUpdated?: (data: Record<string, unknown>) => void;\n}\n\n/**\n * Handle returned by {@link createFrontMatterEditor}.\n */\nexport interface FrontMatterEditorHandle extends Disposable {\n\t/**\n\t * Get current Front Matter data\n\t */\n\tgetData(): Record<string, unknown>;\n\t/**\n\t * Get original Front Matter string for format preservation\n\t */\n\tgetOriginalFrontMatter(): string | undefined;\n\t/**\n\t * Unmount the editor UI.\n\t * @deprecated Use a `using` declaration (`[Symbol.dispose]`) instead.\n\t */\n\tunmount(): void;\n}\n\n/**\n * Mount the Front Matter editor (a React component) into the given\n * container.\n *\n * The field list is rendered declaratively from React state, so\n * toggling the panel or editing other fields never rebuilds the inputs\n * — focus, caret position and IME composition survive re-renders.\n * @param options - Mount target and initial data\n * @returns A handle exposing the latest data and an unmount function\n * @example\n * ```ts\n * const editor = createFrontMatterEditor({\n * \tcontainer: document.querySelector('.front-matter-editor')!,\n * \tinitialData: { title: 'ページ' },\n * \thasFrontMatter: true,\n * \tonUpdated: (data) => debouncedSave(data),\n * });\n * editor.getData(); // => { title: 'ページ' }\n * ```\n */\nexport function createFrontMatterEditor(\n\toptions: FrontMatterEditorOptions,\n): FrontMatterEditorHandle {\n\tconst store = new FrontMatterStore(options.initialData);\n\tconst originalFrontMatter = options.hasFrontMatter\n\t\t? JSON.stringify(options.initialData)\n\t\t: undefined;\n\n\t// onUpdatedはstoreの変化そのものに反応する — Reactのレンダーサイクルを\n\t// 経由するコールバックpropではなく、subscribe/getSnapshotの外部ストア\n\t// 契約だけで完結する\n\tconst unsubscribe = store.subscribe(() => {\n\t\toptions.onUpdated?.(store.getData());\n\t});\n\n\tconst root = createRoot(options.container);\n\troot.render(<FrontMatterEditorView store={store} />);\n\n\tconst teardown = () => {\n\t\tunsubscribe();\n\t\troot.unmount();\n\t};\n\n\treturn {\n\t\tgetData: () => store.getData(),\n\t\tgetOriginalFrontMatter: () => originalFrontMatter,\n\t\t// unmountと[Symbol.dispose]は同じ関数を指す — thisに依存する実装だと\n\t\t// 分割代入経由の呼び出しでthisが外れてTypeErrorになるため、\n\t\t// 共有クロージャへの参照にしている\n\t\tunmount: teardown,\n\t\t[Symbol.dispose]: teardown,\n\t};\n}\n\n/**\n * Front Matterの動的フォーム本体。フィールド一覧は`store`(唯一の\n * データソース)から読み、折りたたみ・追加ダイアログ・JSON下書きは\n * この見た目だけのUI状態としてローカルに持つ。操作は Invoker Commands\n * (`--fm-toggle` / `--fm-add-field` / `--fm-delete-field`)で受ける\n * @param root0\n * @param root0.store\n * @example\n * ```tsx\n * <FrontMatterEditorView store={new FrontMatterStore({ title: 'ページ' })} />\n * ```\n */\nexport function FrontMatterEditorView({ store }: { readonly store: FrontMatterStore }) {\n\tconst rootId = useId();\n\tconst dialogId = useId();\n\tconst fields = useSyncExternalStore(store.subscribe, store.getSnapshot);\n\tconst [isCollapsed, setIsCollapsed] = useState(false);\n\tconst [addDialogOpen, setAddDialogOpen] = useState(false);\n\t// JSONフィールドの未確定テキスト。パースに失敗している間は確定値を\n\t// 変えずに入力中の文字列を保持する(キーはフィールドkey)\n\tconst [jsonDrafts, setJsonDrafts] = useState<Record<string, string>>({});\n\n\tconst applyFields = (next: readonly FieldDefinition[]) => {\n\t\tstore.setFields(next);\n\t};\n\n\tconst updateFieldValue = (key: string, value: unknown) => {\n\t\tapplyFields(fields.map((f) => (f.key === key ? { ...f, value } : f)));\n\t};\n\n\tconst rootRef = useCommand<HTMLDivElement>({\n\t\t'--fm-toggle': () => {\n\t\t\tsetIsCollapsed((prev) => !prev);\n\t\t},\n\t\t'--fm-add-field': () => {\n\t\t\tsetAddDialogOpen(true);\n\t\t},\n\t\t'--fm-delete-field': (e) => {\n\t\t\tconst key = (e.source as HTMLButtonElement | null)?.value;\n\t\t\tif (key == null) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tapplyFields(fields.filter((f) => f.key !== key));\n\t\t\t// 未確定のJSONドラフトも削除する。残すと同名キーを再追加した\n\t\t\t// ときに古い(無効な場合もある)テキストが復活してしまう\n\t\t\tsetJsonDrafts((prev) => {\n\t\t\t\tconst { [key]: _removed, ...rest } = prev;\n\t\t\t\treturn rest;\n\t\t\t});\n\t\t},\n\t});\n\n\tconst onAddSubmit = (e: React.FormEvent<HTMLFormElement>) => {\n\t\te.preventDefault();\n\t\tconst formData = new FormData(e.currentTarget);\n\t\tconst key = String(formData.get('key') ?? '');\n\t\tconst type = formData.get('type') as FieldType;\n\n\t\t// 既存キーとの重複は黙って拒否する(値の上書き事故を防ぐ)\n\t\tif (key && !fields.some((f) => f.key === key)) {\n\t\t\tapplyFields([...fields, { key, type, value: getDefaultValue(type) }]);\n\t\t}\n\n\t\tsetAddDialogOpen(false);\n\t};\n\n\treturn (\n\t\t<div ref={rootRef} id={rootId} className=\"fm-editor\">\n\t\t\t<div className=\"fm-editor-header\">\n\t\t\t\t<button\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tclassName=\"fm-editor-toggle\"\n\t\t\t\t\taria-expanded={!isCollapsed}\n\t\t\t\t\tcommand=\"--fm-toggle\"\n\t\t\t\t\tcommandfor={rootId}>\n\t\t\t\t\t<span className=\"fm-editor-toggle-icon\">{isCollapsed ? '▶' : '▼'}</span>\n\t\t\t\t\t<span>Front Matter</span>\n\t\t\t\t</button>\n\t\t\t\t<button\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tclassName=\"fm-editor-add\"\n\t\t\t\t\ttitle=\"フィールドを追加\"\n\t\t\t\t\tcommand=\"--fm-add-field\"\n\t\t\t\t\tcommandfor={rootId}>\n\t\t\t\t\t{'+ 追加'}\n\t\t\t\t</button>\n\t\t\t</div>\n\t\t\t{isCollapsed ? null : (\n\t\t\t\t<div className=\"fm-editor-fields\">\n\t\t\t\t\t{fields.length === 0 ? (\n\t\t\t\t\t\t<div className=\"fm-editor-empty\">\n\t\t\t\t\t\t\tフィールドがありません。「+ 追加」ボタンでフィールドを追加してください。\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) : (\n\t\t\t\t\t\tfields.map((field) => (\n\t\t\t\t\t\t\t<div key={field.key} className=\"fm-editor-field\" data-type={field.type}>\n\t\t\t\t\t\t\t\t<label\n\t\t\t\t\t\t\t\t\tclassName=\"fm-editor-field-label\"\n\t\t\t\t\t\t\t\t\thtmlFor={`${rootId}-field-${field.key}`}>\n\t\t\t\t\t\t\t\t\t{field.key}\n\t\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t\t<div className=\"fm-editor-field-input\">\n\t\t\t\t\t\t\t\t\t<FieldInput\n\t\t\t\t\t\t\t\t\t\tfield={field}\n\t\t\t\t\t\t\t\t\t\tinputId={`${rootId}-field-${field.key}`}\n\t\t\t\t\t\t\t\t\t\tjsonDraft={jsonDrafts[field.key]}\n\t\t\t\t\t\t\t\t\t\tonValueChange={(value) => updateFieldValue(field.key, value)}\n\t\t\t\t\t\t\t\t\t\tonJsonDraftChange={(text) => {\n\t\t\t\t\t\t\t\t\t\t\tsetJsonDrafts((prev) => ({ ...prev, [field.key]: text }));\n\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\tclassName=\"fm-editor-field-delete\"\n\t\t\t\t\t\t\t\t\ttitle=\"フィールドを削除\"\n\t\t\t\t\t\t\t\t\tcommand=\"--fm-delete-field\"\n\t\t\t\t\t\t\t\t\tcommandfor={rootId}\n\t\t\t\t\t\t\t\t\tvalue={field.key}>\n\t\t\t\t\t\t\t\t\t×\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t))\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t)}\n\t\t\t{addDialogOpen ? (\n\t\t\t\t<AddFieldDialog\n\t\t\t\t\tdialogId={dialogId}\n\t\t\t\t\tonSubmit={onAddSubmit}\n\t\t\t\t\tonClose={() => setAddDialogOpen(false)}\n\t\t\t\t/>\n\t\t\t) : null}\n\t\t</div>\n\t);\n}\n\n/**\n * 型別のcontrolled input\n * @param root0\n * @param root0.field\n * @param root0.inputId\n * @param root0.jsonDraft\n * @param root0.onValueChange\n * @param root0.onJsonDraftChange\n */\nfunction FieldInput({\n\tfield,\n\tinputId,\n\tjsonDraft,\n\tonValueChange,\n\tonJsonDraftChange,\n}: {\n\treadonly field: FieldDefinition;\n\treadonly inputId: string;\n\treadonly jsonDraft: string | undefined;\n\treadonly onValueChange: (value: unknown) => void;\n\treadonly onJsonDraftChange: (text: string) => void;\n}): ReactNode {\n\tswitch (field.type) {\n\t\tcase 'boolean': {\n\t\t\treturn (\n\t\t\t\t<input\n\t\t\t\t\tid={inputId}\n\t\t\t\t\ttype=\"checkbox\"\n\t\t\t\t\tchecked={Boolean(field.value)}\n\t\t\t\t\tonChange={(e) => onValueChange(e.currentTarget.checked)}\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\t\tcase 'number': {\n\t\t\treturn (\n\t\t\t\t<input\n\t\t\t\t\tid={inputId}\n\t\t\t\t\ttype=\"number\"\n\t\t\t\t\tvalue={field.value == null ? '' : String(field.value)}\n\t\t\t\t\tonChange={(e) => {\n\t\t\t\t\t\tonValueChange(\n\t\t\t\t\t\t\te.currentTarget.value === '' ? null : Number(e.currentTarget.value),\n\t\t\t\t\t\t);\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\t\tcase 'date': {\n\t\t\treturn (\n\t\t\t\t<input\n\t\t\t\t\tid={inputId}\n\t\t\t\t\ttype=\"date\"\n\t\t\t\t\tvalue={toDateInputValue(field.value)}\n\t\t\t\t\tonChange={(e) => onValueChange(e.currentTarget.value)}\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\t\tcase 'json': {\n\t\t\tconst text = jsonDraft ?? stringifyJson(field.value);\n\t\t\treturn (\n\t\t\t\t<textarea\n\t\t\t\t\tid={inputId}\n\t\t\t\t\trows={3}\n\t\t\t\t\tclassName={isValidJson(text) ? undefined : 'fm-editor-error'}\n\t\t\t\t\tvalue={text}\n\t\t\t\t\tonChange={(e) => {\n\t\t\t\t\t\tconst nextText = e.currentTarget.value;\n\t\t\t\t\t\tonJsonDraftChange(nextText);\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tonValueChange(JSON.parse(nextText) as unknown);\n\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t// 不正なJSONの間は確定値を変えない(テキストは保持)\n\t\t\t\t\t\t}\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\t\tdefault: {\n\t\t\treturn (\n\t\t\t\t<input\n\t\t\t\t\tid={inputId}\n\t\t\t\t\ttype=\"text\"\n\t\t\t\t\tvalue={String(field.value ?? '')}\n\t\t\t\t\tonChange={(e) => onValueChange(e.currentTarget.value)}\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\t}\n}\n\n/**\n * フィールド追加ダイアログ。マウント時にshowModalし、close(キャンセル\n * ボタンの組み込みcloseコマンド / Escキー)でアンマウントされる\n * @param root0\n * @param root0.dialogId\n * @param root0.onSubmit\n * @param root0.onClose\n */\nfunction AddFieldDialog({\n\tdialogId,\n\tonSubmit,\n\tonClose,\n}: {\n\treadonly dialogId: string;\n\treadonly onSubmit: (e: React.FormEvent<HTMLFormElement>) => void;\n\treadonly onClose: () => void;\n}) {\n\tconst dialogRef = useRef<HTMLDialogElement>(null);\n\n\tuseEffect(() => {\n\t\tconst dialog = dialogRef.current;\n\t\tif (dialog && !dialog.open) {\n\t\t\tdialog.showModal();\n\t\t}\n\t}, []);\n\n\treturn (\n\t\t<dialog ref={dialogRef} className=\"fm-editor-dialog\" id={dialogId} onClose={onClose}>\n\t\t\t<form onSubmit={onSubmit}>\n\t\t\t\t<h3>フィールドを追加</h3>\n\t\t\t\t<div className=\"fm-editor-dialog-field\">\n\t\t\t\t\t<label htmlFor={`${dialogId}-key`}>キー名</label>\n\t\t\t\t\t<input\n\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\tid={`${dialogId}-key`}\n\t\t\t\t\t\tname=\"key\"\n\t\t\t\t\t\trequired\n\t\t\t\t\t\tplaceholder=\"例: title, author, date\"\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"fm-editor-dialog-field\">\n\t\t\t\t\t<label htmlFor={`${dialogId}-type`}>型</label>\n\t\t\t\t\t<select id={`${dialogId}-type`} name=\"type\">\n\t\t\t\t\t\t<option value=\"text\">テキスト</option>\n\t\t\t\t\t\t<option value=\"number\">数値</option>\n\t\t\t\t\t\t<option value=\"boolean\">真偽値</option>\n\t\t\t\t\t\t<option value=\"date\">日付</option>\n\t\t\t\t\t\t<option value=\"json\">JSON(配列/オブジェクト)</option>\n\t\t\t\t\t</select>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"fm-editor-dialog-actions\">\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tclassName=\"fm-editor-dialog-cancel\"\n\t\t\t\t\t\tcommand=\"close\"\n\t\t\t\t\t\tcommandfor={dialogId}>\n\t\t\t\t\t\tキャンセル\n\t\t\t\t\t</button>\n\t\t\t\t\t<button type=\"submit\" className=\"fm-editor-dialog-submit\">\n\t\t\t\t\t\t追加\n\t\t\t\t\t</button>\n\t\t\t\t</div>\n\t\t\t</form>\n\t\t</dialog>\n\t);\n}\n\n/**\n * Parse initial data and detect field types\n * @param data\n */\nfunction parseInitialData(data: Record<string, unknown>): FieldDefinition[] {\n\treturn Object.entries(data).map(([key, value]) => ({\n\t\tkey,\n\t\ttype: detectType(value),\n\t\tvalue,\n\t}));\n}\n\n/**\n * フィールド一覧をFront Matterデータへ畳み込む\n * @param fields\n */\nfunction toData(fields: readonly FieldDefinition[]): Record<string, unknown> {\n\tconst data: Record<string, unknown> = {};\n\tfor (const field of fields) {\n\t\tdata[field.key] = field.value;\n\t}\n\treturn data;\n}\n\n/**\n * Detect the type of a value\n * @param value\n */\nfunction detectType(value: unknown): FieldType {\n\tif (typeof value === 'boolean') {\n\t\treturn 'boolean';\n\t}\n\tif (typeof value === 'number') {\n\t\treturn 'number';\n\t}\n\tif (typeof value === 'string') {\n\t\t// Check if it's an ISO date string\n\t\tif (/^\\d{4}-\\d{2}-\\d{2}(?:T\\d{2}:\\d{2}:\\d{2})?/.test(value)) {\n\t\t\tconst parsed = Date.parse(value);\n\t\t\tif (!Number.isNaN(parsed)) {\n\t\t\t\treturn 'date';\n\t\t\t}\n\t\t}\n\t\treturn 'text';\n\t}\n\tif (value instanceof Date) {\n\t\treturn 'date';\n\t}\n\t// Arrays and objects\n\tif (typeof value === 'object' && value !== null) {\n\t\treturn 'json';\n\t}\n\treturn 'text';\n}\n\n/**\n * Get default value for a type\n * @param type\n */\nfunction getDefaultValue(type: FieldType): unknown {\n\tswitch (type) {\n\t\tcase 'boolean': {\n\t\t\treturn false;\n\t\t}\n\t\tcase 'number': {\n\t\t\treturn 0;\n\t\t}\n\t\tcase 'date': {\n\t\t\treturn new Date().toISOString().split('T')[0];\n\t\t}\n\t\tcase 'json': {\n\t\t\treturn [];\n\t\t}\n\t\tdefault: {\n\t\t\treturn '';\n\t\t}\n\t}\n}\n\n/**\n * `<input type=\"date\">` に渡せる `yyyy-mm-dd` へ正規化する。\n * 不正な日付は空文字(未入力)にする\n * @param value\n */\nfunction toDateInputValue(value: unknown): string {\n\tif (!value) {\n\t\treturn '';\n\t}\n\tconst dateValue = value instanceof Date ? value : new Date(String(value));\n\tif (Number.isNaN(dateValue.getTime())) {\n\t\treturn '';\n\t}\n\treturn dateValue.toISOString().split('T')[0] ?? '';\n}\n\n/**\n * @param value\n */\nfunction stringifyJson(value: unknown): string {\n\ttry {\n\t\treturn JSON.stringify(value, null, 2);\n\t} catch {\n\t\treturn String(value);\n\t}\n}\n\n/**\n * @param text\n */\nfunction isValidJson(text: string): boolean {\n\ttry {\n\t\tJSON.parse(text);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n",".img {\n\tposition: relative;\n\toverflow: hidden;\n\n\timg,\n\tvideo,\n\taudio,\n\tobject,\n\tp {\n\t\tposition: relative;\n\t\tz-index: 0;\n\t\tdisplay: block;\n\t\tinline-size: 100%;\n\t\taspect-ratio: 16 / 9;\n\t\tmargin: 0;\n\t\tobject-fit: contain;\n\t}\n\n\tp {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tjustify-content: center;\n\t\tbackground: rgb(0 0 0 / 10%);\n\t}\n\n\t&.uploading img {\n\t\tobject-fit: cover;\n\t}\n\n\t.progress {\n\t\tposition: absolute;\n\t\tinset-block-start: 0;\n\t\tz-index: 10;\n\t\tinline-size: 100%;\n\t\tblock-size: 100%;\n\t\tbackground: rgb(0 0 0 / 50%);\n\t}\n}\n\n.meta {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: 0.3em;\n\tjustify-content: center;\n\tpadding: 0;\n\tpadding-block-end: 1em;\n\tmargin: 0;\n\tmargin-block-start: 0.5em;\n\tfont-family: monospace;\n\tfont-size: calc(12 / 16 * 1em);\n\topacity: 0.7;\n\n\tli {\n\t\tdisplay: block;\n\t\tpadding: 0;\n\t\tmargin: 0;\n\t\tlist-style: none;\n\t}\n\n\t.path {\n\t\tword-break: break-all;\n\n\t\ta {\n\t\t\tcolor: inherit;\n\t\t}\n\t}\n\n\t.upload .progress {\n\t\tfont-style: italic;\n\t}\n\n\t.dimension {\n\t\t&::before {\n\t\t\tcontent: '(';\n\t\t}\n\n\t\t&::after {\n\t\t\tcontent: ')';\n\t\t}\n\t}\n}\n","import { useEffect, useState, useSyncExternalStore } from 'react';\n\nimport { useFileBrowser } from '../file-browser/use-file-browser.js';\nimport { getExt } from '../get-ext.js';\n\nimport styles from './preview.module.css';\n\n/**\n * File preview pane. The previewed path comes from the parent (lifted\n * from the item's own state); upload progress is read from the engine's\n * `FileBrowserStore`, shared with `FileList`/`FileUploader`.\n * @param root0\n * @param root0.path\n * @example\n * ```tsx\n * <Preview path={state.path ?? ''} />\n * ```\n */\nexport function Preview({ path }: { readonly path: string }) {\n\tconst store = useFileBrowser();\n\tconst [dimension, setDimension] = useState<{\n\t\treadonly width: number;\n\t\treadonly height: number;\n\t} | null>(null);\n\n\t// path変更時のリセットはeffectではなくrender中に行う\n\t// (effect内の同期setStateはカスケードレンダーを起こすため)\n\tconst [prevPath, setPrevPath] = useState(path);\n\tif (prevPath !== path) {\n\t\tsetPrevPath(path);\n\t\tsetDimension(null);\n\t}\n\n\tconst file = path ? getExt(path) : null;\n\tconst isUploadingMode = path.startsWith('blob:');\n\n\tconst uploads = useSyncExternalStore(\n\t\tstore.subscribe,\n\t\t() => store.getSnapshot().uploads,\n\t);\n\tconst progress = uploads.find((u) => u.blob === path) ?? { uploaded: 0, total: 100 };\n\n\tuseEffect(() => {\n\t\tconst file = path ? getExt(path) : null;\n\t\tlet aborted = false;\n\n\t\tif (file?.isImage) {\n\t\t\tconst image = new Image();\n\t\t\timage.src = path;\n\t\t\timage.addEventListener(\n\t\t\t\t'load',\n\t\t\t\t() => {\n\t\t\t\t\tif (!aborted) {\n\t\t\t\t\t\tsetDimension({ width: image.naturalWidth, height: image.naturalHeight });\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t{ once: true },\n\t\t\t);\n\t\t} else if (file?.isVideo) {\n\t\t\tconst video = document.createElement('video');\n\t\t\tvideo.src = path;\n\t\t\tvideo.addEventListener(\n\t\t\t\t'loadedmetadata',\n\t\t\t\t() => {\n\t\t\t\t\tif (!aborted) {\n\t\t\t\t\t\tsetDimension({ width: video.videoWidth, height: video.videoHeight });\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t{ once: true },\n\t\t\t);\n\t\t}\n\n\t\treturn () => {\n\t\t\taborted = true;\n\t\t};\n\t}, [path]);\n\n\treturn (\n\t\t<div>\n\t\t\t<div\n\t\t\t\tclassName={`${styles['img']} ${isUploadingMode ? styles['uploading'] : ''}`.trim()}>\n\t\t\t\t{file?.isImage ? (\n\t\t\t\t\t<img src={path} alt=\"画像プレビュー\" />\n\t\t\t\t) : file?.isVideo ? (\n\t\t\t\t\t<video controls playsInline>\n\t\t\t\t\t\t<source src={path} type={`video/${file.ext}`} />\n\t\t\t\t\t\t<track kind=\"captions\" src=\"\" />\n\t\t\t\t\t</video>\n\t\t\t\t) : file?.isAudio ? (\n\t\t\t\t\t<audio controls>\n\t\t\t\t\t\t<source src={path} type={`audio/${file.ext}`} />\n\t\t\t\t\t\t<track kind=\"metadata\" src=\"\" />\n\t\t\t\t\t</audio>\n\t\t\t\t) : file?.isDoc || file?.isPpt || file?.isXls || file?.isPdf ? (\n\t\t\t\t\t<object\n\t\t\t\t\t\tdata={path}\n\t\t\t\t\t\ttype={`application/${file.ext}`}\n\t\t\t\t\t\ttitle={`${file.ext}ファイルのプレビュー`}>\n\t\t\t\t\t\t<p>プレビューできません</p>\n\t\t\t\t\t</object>\n\t\t\t\t) : (\n\t\t\t\t\t<p>プレビューできません</p>\n\t\t\t\t)}\n\t\t\t\t{isUploadingMode ? (\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={styles['progress']}\n\t\t\t\t\t\tstyle={{ translate: `${(progress.uploaded / progress.total) * 100}%` }}></div>\n\t\t\t\t) : null}\n\t\t\t</div>\n\t\t\t<ul className={styles['meta']}>\n\t\t\t\t{isUploadingMode ? (\n\t\t\t\t\t<li className={styles['upload']}>\n\t\t\t\t\t\t<span>アップロード...</span>\n\t\t\t\t\t\t<span className={styles['progress']}>\n\t\t\t\t\t\t\t{Math.round((progress.uploaded / progress.total) * 100)}% (\n\t\t\t\t\t\t\t{progress.uploaded}/{progress.total})\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</li>\n\t\t\t\t) : (\n\t\t\t\t\t<li className={styles['path']}>\n\t\t\t\t\t\t<a href={path} target=\"_blank\">\n\t\t\t\t\t\t\t{path}\n\t\t\t\t\t\t</a>\n\t\t\t\t\t</li>\n\t\t\t\t)}\n\t\t\t\t{dimension ? (\n\t\t\t\t\t<li className={styles['dimension']}>\n\t\t\t\t\t\t{dimension.width}x{dimension.height}\n\t\t\t\t\t</li>\n\t\t\t\t) : null}\n\t\t\t</ul>\n\t\t</div>\n\t);\n}\n",".table {\n\tdisplay: grid;\n\tgrid-template-columns: minmax(1em, 1fr) minmax(1em, 1fr) auto;\n\tgap: 0.5em 1em;\n}\n\n.row {\n\tdisplay: grid;\n\tgrid-template-columns: subgrid;\n\tgrid-column: span 3;\n\talign-items: center;\n\n\ttextarea {\n\t\tinline-size: 100%;\n\t\tresize: vertical;\n\t}\n}\n\n.btn {\n\tul {\n\t\tdisplay: flex;\n\t\tgap: 0.3em;\n\t\tpadding: 0;\n\t\tmargin: 0;\n\t}\n\n\tli {\n\t\tpadding: 0;\n\t\tmargin: 0;\n\t\tlist-style: none;\n\t}\n}\n","import {\n\tIconArrowsTransferDown,\n\tIconRowInsertBottom,\n\tIconTrash,\n} from '@tabler/icons-react';\nimport { useId, useState } from 'react';\n\nimport { useCommand } from '../use-command.js';\n\nimport styles from './table-editor.module.css';\n\n/**\n * Row-aligned table cell text: `th[i]` and `td[i]` form one row. In the\n * table item the `td` cells hold Markdown while editing (converted\n * to/from HTML via `toEditorState`/`toItemData`); `th` cells stay plain.\n */\nexport interface TableEditorData {\n\treadonly th: readonly string[];\n\treadonly td: readonly string[];\n}\n\n/**\n * Table row editor as a fully controlled component. The table item's\n * editor owns the state; row operations are declared as local commands.\n * @param root0\n * @param root0.value\n * @param root0.onChange\n * @example\n * ```tsx\n * <TableEditor\n * \tvalue={{ th: state.th ?? [], td: state.td ?? [] }}\n * \tonChange={({ th, td }) => setState({ ...state, th: [...th], td: [...td] })}\n * />\n * ```\n */\nexport function TableEditor({\n\tvalue,\n\tonChange,\n}: {\n\treadonly value: TableEditorData;\n\treadonly onChange: (value: TableEditorData) => void;\n}) {\n\tconst rootId = useId();\n\n\t// 行の安定した識別子。配列indexをkeyにすると、並べ替え・削除のたびに\n\t// 「同じ画面位置」のDOM要素が別の行の内容へ再利用され、編集中の\n\t// textareaのフォーカス・キャレット位置が行の中身ではなく位置に\n\t// 取り残される。id付きの行として管理し、commitのたびに一緒に\n\t// スプライスすることでReactの差分更新が行の中身を正しく追従できる\n\tconst [rowIds, setRowIds] = useState<readonly string[]>(() =>\n\t\tvalue.th.map(() => crypto.randomUUID()),\n\t);\n\n\tconst rows: readonly { id: string; th: string; td: string }[] = value.th.map(\n\t\t(th, i) => ({\n\t\t\tid: rowIds[i] ?? String(i),\n\t\t\tth,\n\t\t\ttd: value.td[i] ?? '',\n\t\t}),\n\t);\n\n\tconst commit = (next: readonly { id: string; th: string; td: string }[]) => {\n\t\tsetRowIds(next.map((row) => row.id));\n\t\tonChange({\n\t\t\tth: next.map((row) => row.th),\n\t\t\ttd: next.map((row) => row.td),\n\t\t});\n\t};\n\n\tconst rootRef = useCommand<HTMLDivElement>({\n\t\t'--add-row': (e) => {\n\t\t\tconst index = Number((e.source as HTMLButtonElement | null)?.value);\n\t\t\tcommit(rows.toSpliced(index + 1, 0, { id: crypto.randomUUID(), th: '', td: '' }));\n\t\t},\n\t\t'--remove-row': (e) => {\n\t\t\tconst index = Number((e.source as HTMLButtonElement | null)?.value);\n\t\t\tcommit(rows.toSpliced(index, 1));\n\t\t},\n\t\t'--move-row-down': (e) => {\n\t\t\tconst from = Number((e.source as HTMLButtonElement | null)?.value);\n\t\t\tconst to = from + 1;\n\t\t\tconst fromRow = rows[from];\n\t\t\tconst toRow = rows[to];\n\t\t\tif (!fromRow || !toRow) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcommit(rows.toSpliced(from, 1, toRow).toSpliced(to, 1, fromRow));\n\t\t},\n\t});\n\n\treturn (\n\t\t<div className={styles['table']} ref={rootRef} id={rootId}>\n\t\t\t{rows.map(({ id, th, td }, i) => (\n\t\t\t\t<div className={styles['row']} key={id}>\n\t\t\t\t\t<div className={styles['th']}>\n\t\t\t\t\t\t<textarea\n\t\t\t\t\t\t\taria-label={`${i}行目の見出しセル`}\n\t\t\t\t\t\t\tname={`bge-th-${i}`}\n\t\t\t\t\t\t\tvalue={th}\n\t\t\t\t\t\t\tonChange={(e) => {\n\t\t\t\t\t\t\t\tcommit(rows.with(i, { id, th: e.currentTarget.value, td }));\n\t\t\t\t\t\t\t}}></textarea>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div className={styles['td']}>\n\t\t\t\t\t\t<textarea\n\t\t\t\t\t\t\taria-label={`${i}行目の内容セル`}\n\t\t\t\t\t\t\tname={`bge-td-${i}`}\n\t\t\t\t\t\t\tvalue={td}\n\t\t\t\t\t\t\tonChange={(e) => {\n\t\t\t\t\t\t\t\tcommit(rows.with(i, { id, th, td: e.currentTarget.value }));\n\t\t\t\t\t\t\t}}></textarea>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div className={styles['btn']}>\n\t\t\t\t\t\t<ul>\n\t\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\ttitle=\"下に追加\"\n\t\t\t\t\t\t\t\t\tcommand=\"--add-row\"\n\t\t\t\t\t\t\t\t\tcommandfor={rootId}\n\t\t\t\t\t\t\t\t\tvalue={i}>\n\t\t\t\t\t\t\t\t\t<IconRowInsertBottom />\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\ttitle=\"削除\"\n\t\t\t\t\t\t\t\t\tdisabled={rows.length === 1}\n\t\t\t\t\t\t\t\t\tcommand=\"--remove-row\"\n\t\t\t\t\t\t\t\t\tcommandfor={rootId}\n\t\t\t\t\t\t\t\t\tvalue={i}>\n\t\t\t\t\t\t\t\t\t<IconTrash />\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\ttitle=\"下に移動\"\n\t\t\t\t\t\t\t\t\tdisabled={i === rows.length - 1}\n\t\t\t\t\t\t\t\t\tcommand=\"--move-row-down\"\n\t\t\t\t\t\t\t\t\tcommandfor={rootId}\n\t\t\t\t\t\t\t\t\tvalue={i}>\n\t\t\t\t\t\t\t\t\t<IconArrowsTransferDown className=\"icon\" />\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t</ul>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t))}\n\t\t</div>\n\t);\n}\n",".tablist {\n\tdisplay: flex;\n\tgap: 0.5em;\n\talign-items: center;\n\tpadding-inline: var(--border-radius);\n\n\t[role='tab'] {\n\t\tposition: relative;\n\t\tborder: 1px solid var(--bge-border-color);\n\t\tborder-end-start-radius: 0;\n\t\tborder-end-end-radius: 0;\n\n\t\t&[aria-selected='true'] {\n\t\t\tborder-block-end: none;\n\n\t\t\t&::after {\n\t\t\t\tposition: absolute;\n\t\t\t\tinset-block-start: 100%;\n\t\t\t\tinset-inline-start: 50%;\n\t\t\t\tdisplay: block;\n\t\t\t\tinline-size: 1em;\n\t\t\t\tblock-size: 0.5em;\n\t\t\t\tcontent: '';\n\t\t\t\tbackground-color: var(--bge-ui-primary-color);\n\t\t\t\tclip-path: polygon(0 0, 50% 100%, 100% 0);\n\t\t\t\ttranslate: -50% 0;\n\t\t\t}\n\t\t}\n\t}\n}\n","import { useId, useRef } from 'react';\n\nimport { useCommand } from '../use-command.js';\n\nimport styles from './tabs.module.css';\n\n/**\n * Controlled tab list. Selection is lifted to the parent via\n * `current`/`onChange`; tab buttons declare a local command instead of a\n * click handler. Arrow keys move the selection. The tab panel itself is\n * rendered by the parent, which also owns its `aria-label`.\n * @param root0\n * @param root0.current\n * @param root0.onChange\n * @param root0.contentId\n * @param root0.length\n * @param root0.createLabel\n * @example\n * ```tsx\n * <Tabs current={currentIndex} onChange={setCurrentIndex} contentId=\"tab-content\" />\n * <div id=\"tab-content\" role=\"tabpanel\" aria-label={`画像${currentIndex + 1}`}>\n * \t{currentIndex === 0 ? <PcForm /> : <SpForm />}\n * </div>\n * ```\n */\nexport function Tabs({\n\tcurrent,\n\tonChange,\n\tcontentId,\n\tlength = 2,\n\tcreateLabel = (index) => `画像${index + 1}`,\n}: {\n\treadonly current: number;\n\treadonly onChange: (index: number) => void;\n\treadonly contentId: string;\n\treadonly length?: number;\n\treadonly createLabel?: (index: number) => string;\n}) {\n\tconst listId = useId();\n\tconst refs = useRef<(HTMLButtonElement | null)[]>([]);\n\n\tconst update = (index: number) => {\n\t\trefs.current[index]?.focus();\n\t\tonChange(index);\n\t};\n\n\tconst rootRef = useCommand<HTMLDivElement>({\n\t\t'--select-tab': (e) => {\n\t\t\tconst value = (e.source as HTMLButtonElement | null)?.value;\n\t\t\tupdate(Number(value));\n\t\t},\n\t});\n\n\tconst onKeyDown = (event: React.KeyboardEvent) => {\n\t\tif (event.key === 'ArrowLeft') {\n\t\t\tupdate(Math.max(0, current - 1));\n\t\t} else if (event.key === 'ArrowRight') {\n\t\t\tupdate(Math.min(length - 1, current + 1));\n\t\t}\n\t};\n\n\treturn (\n\t\t<div role=\"tablist\" ref={rootRef} id={listId} className={styles['tablist']}>\n\t\t\t{Array.from({ length }, (_, index) => (\n\t\t\t\t<button\n\t\t\t\t\tkey={index}\n\t\t\t\t\tref={(el) => {\n\t\t\t\t\t\trefs.current[index] = el;\n\t\t\t\t\t}}\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\trole=\"tab\"\n\t\t\t\t\taria-controls={contentId}\n\t\t\t\t\taria-selected={current === index}\n\t\t\t\t\ttabIndex={current === index ? 0 : -1}\n\t\t\t\t\tcommand=\"--select-tab\"\n\t\t\t\t\tcommandfor={listId}\n\t\t\t\t\tvalue={index}\n\t\t\t\t\tonKeyDown={onKeyDown}>\n\t\t\t\t\t{createLabel(index)}\n\t\t\t\t</button>\n\t\t\t))}\n\t\t</div>\n\t);\n}\n","import type { BgeWysiwygEditorElement } from '@burger-editor/custom-element';\n\nimport { use, useEffect, useEffectEvent, useRef, useState } from 'react';\n\nimport { useEngine } from '../engine-context.js';\n\ndeclare module 'react' {\n\tnamespace JSX {\n\t\tinterface IntrinsicElements {\n\t\t\t'bge-wysiwyg-editor': React.DetailedHTMLProps<\n\t\t\t\tReact.HTMLAttributes<HTMLElement>,\n\t\t\t\tHTMLElement\n\t\t\t> & {\n\t\t\t\t'item-name'?: string;\n\t\t\t\tcommands?: string;\n\t\t\t\tlabel?: string;\n\t\t\t\tname?: string;\n\t\t\t\t// プロパティとして渡す(属性ではない) — React 19はカスタム\n\t\t\t\t// 要素の既知プロパティにマッチする名前をelement[name] = value\n\t\t\t\t// で設定する\n\t\t\t\tcontentCss?: string;\n\t\t\t};\n\t\t}\n\t}\n}\n\ntype Thenable<T> = Promise<T> & {\n\tstatus?: 'fulfilled' | 'rejected';\n\tvalue?: T;\n\treason?: unknown;\n};\n\n/**\n * Wrap `promise` so a rejection resolves to `fallback` instead, without\n * breaking the `use()` cache contract (react.dev's `wrapPromise` pattern:\n * a thenable tagged with `.status`/`.value`/`.reason` lets `use()` read it\n * synchronously on the first render). `Promise.prototype.catch()` always\n * returns a fresh, untagged promise, so chaining it directly onto an\n * already-tagged thenable would silently drop that fast path. A tagged\n * `'fulfilled'` promise is returned as-is (nothing to fall back from); a\n * tagged `'rejected'` promise is converted synchronously; only a genuinely\n * untagged promise falls back to the real async `.catch()`.\n * @param promise - Source promise, optionally pre-tagged per the `use()`\n * cache contract\n * @param fallback - Value to resolve to when `promise` rejects\n */\nfunction withFallback<T>(promise: Promise<T>, fallback: T): Promise<T> {\n\tconst tagged = promise as Thenable<T>;\n\tif (tagged.status === 'fulfilled') {\n\t\treturn promise;\n\t}\n\tif (tagged.status === 'rejected') {\n\t\tconst resolved = Promise.resolve(fallback) as Thenable<T>;\n\t\tresolved.status = 'fulfilled';\n\t\tresolved.value = fallback;\n\t\treturn resolved;\n\t}\n\treturn promise.catch(() => fallback);\n}\n\n/**\n * Rich text field backed by the `<bge-wysiwyg-editor>` custom element\n * (TipTap). The element manages its own DOM; this wrapper feeds the\n * initial value and lifts edits into the editor state via the\n * `transaction` event — subscribed directly on the host element (the\n * event is dispatched with `bubbles: true` on the inner `<bge-wysiwyg>`,\n * so it reaches here without needing to query into it).\n *\n * Content CSS (so the WYSIWYG surface matches the published page's\n * styling) is fetched once per engine via `use()` — only an item whose\n * `Editor` actually renders `WysiwygField` pays for this fetch/suspend,\n * unlike hoisting it to the item-editor host for every item — and\n * passed as the `contentCss` property (React 19 sets it directly on the\n * element, replacing an imperative `el.setStyle()` call).\n * @param root0\n * @param root0.value\n * @param root0.onChange\n * @param root0.itemName\n * @param root0.commands\n * @param root0.label\n * @example\n * ```tsx\n * <WysiwygField\n * \titemName=\"wysiwyg\"\n * \tvalue={state.wysiwyg ?? ''}\n * \tonChange={(wysiwyg) => setState({ ...state, wysiwyg })}\n * />\n * ```\n */\nexport function WysiwygField({\n\tvalue,\n\tonChange,\n\titemName,\n\tcommands,\n\tlabel,\n}: {\n\treadonly value: string;\n\treadonly onChange: (value: string) => void;\n\treadonly itemName?: string;\n\treadonly commands?: string;\n\treadonly label?: string;\n}) {\n\tconst engine = useEngine();\n\t// レンダーごとに新しいPromiseを作るとuse()が「キャッシュされていない\n\t// Promise」として毎回サスペンドし直すため、このコンポーネント寿命の\n\t// 間だけ安定させる(遅延初期化のuseState)。CSS取得の失敗(ネットワーク\n\t// 不調・パス誤り等)は「見た目が多少崩れる」程度で済むべき失敗であり、\n\t// use()にrejectをそのまま投げさせるとダイアログ全体のErrorBoundaryまで\n\t// 伝播しフォーム全体が使用不能になってしまう(旧・命令的fire-and-forget\n\t// 実装からの挙動後退)ため、ここで吸収して空文字列にフォールバックする。\n\t// `.catch()`は常に新しい(タグなしの)Promiseを返すため、素朴に繋ぐと\n\t// use()キャッシュ契約(react.devのwrapPromiseパターン、.status/.value)\n\t// で既にfulfilledタグ済みのPromiseを渡された場合の同期返却パスまで\n\t// 壊してしまう — withCssFallbackはタグを見て、タグ済みならそのまま\n\t// 通し、未タグ(実運用のPromise)のときだけ実際に.catch()する\n\tconst [contentCssPromise] = useState(() =>\n\t\twithFallback(engine.getContentStylesheet(), ''),\n\t);\n\tconst contentCss = use(contentCssPromise);\n\n\tconst ref = useRef<BgeWysiwygEditorElement | null>(null);\n\tconst initialValue = useRef(value);\n\tconst onTransaction = useEffectEvent((el: BgeWysiwygEditorElement) => {\n\t\tonChange(el.value);\n\t});\n\n\t// 初期値の書き込みだけは今も命令的 — contentEditableベースのリッチ\n\t// テキストエディタをvalueで都度制御すると、入力中にカーソル位置が\n\t// 飛ぶ(Reactが明示的に警告するアンチパターン)。以降の値はTipTap\n\t// 自身が保持し、`transaction`イベント経由でこの外へ伝わる\n\tuseEffect(() => {\n\t\tconst el = ref.current;\n\t\tif (!el) {\n\t\t\treturn;\n\t\t}\n\t\t// custom element側のinnerHTMLセッターがwysiwygのvalueに転送する\n\t\tel.innerHTML = initialValue.current;\n\n\t\tconst listener = () => onTransaction(el);\n\t\tel.addEventListener('transaction', listener);\n\t\treturn () => {\n\t\t\tel.removeEventListener('transaction', listener);\n\t\t};\n\t}, []);\n\n\treturn (\n\t\t<bge-wysiwyg-editor\n\t\t\tref={(el: HTMLElement | null) => {\n\t\t\t\tref.current = el as BgeWysiwygEditorElement | null;\n\t\t\t}}\n\t\t\tcontentCss={contentCss}\n\t\t\titem-name={itemName}\n\t\t\tcommands={commands}\n\t\t\tlabel={label}\n\t\t/>\n\t);\n}\n","import { useEffect, useEffectEvent } from 'react';\n\n/**\n * Run `fn` exactly once, when the component mounts, always reading `fn`'s\n * latest closure (via `useEffectEvent`) rather than the one captured at\n * mount time.\n *\n * Exists so a mount-only effect can honestly declare `useEffect(fn, [])`\n * without an `eslint-disable-next-line react-hooks/exhaustive-deps` — that\n * suppression is also a React Compiler bailout condition for the whole\n * component containing it (see ARCHITECTURE.md's negative-knowledge note\n * on React Compiler).\n * @param fn - Called once on mount\n * @example\n * ```tsx\n * useMountEffect(() => {\n * \tfileBrowser.select(fileType, state.path ?? '', size);\n * });\n * ```\n */\nexport function useMountEffect(fn: () => void): void {\n\tconst onMount = useEffectEvent(fn);\n\tuseEffect(() => {\n\t\tonMount();\n\t}, []);\n}\n","import type { SelectedFile } from './store.js';\n\nimport { useEffect, useEffectEvent, useRef } from 'react';\n\n/**\n * React to a file becoming selected from outside the item's own `Editor`\n * (i.e. via `FileList`, in the same `FileBrowserStore` the item's own\n * `fileType` uses) — `onExternalChange` is called with the new selection.\n *\n * `selected` is shared per-engine across every item that opens onto the\n * same `fileType`, so it can still hold a *previous* item's selection at\n * the moment a new `Editor` instance mounts. This hook's first effect run\n * is always skipped for that reason — reacting to it would load that\n * stale, unrelated selection into the freshly-mounted item's own state,\n * racing the item's own mount-time `fileBrowser.select(fileType, ownPath)`\n * call (whichever one's async work — if any — finishes last wins,\n * corrupting the item with a different item's file). Callers still need\n * their own mount effect to register their own current path with the\n * store; this hook only covers reacting to *later* external changes.\n * @param selected - The `fileType`'s current selection (from\n * `useSyncExternalStore(fileBrowser.subscribe, () =>\n * fileBrowser.getSnapshot().selected[fileType])`)\n * @param getCurrentPath - Returns the item's own current path at call\n * time (a function, not a plain value, so the effect doesn't need it in\n * its dependency array and can stay `[selected]`-only)\n * @param onExternalChange - Called when `selected` changes to a path\n * different from `getCurrentPath()`, after the initial mount is skipped\n * @example\n * ```tsx\n * const selected = useSyncExternalStore(\n * \tfileBrowser.subscribe,\n * \t() => fileBrowser.getSnapshot().selected.image,\n * );\n * useExternalFileSelection(\n * \tselected,\n * \t() => state.path ?? '',\n * \t(next) => setState((prev) => ({ ...prev, path: next.path })),\n * );\n * ```\n */\nexport function useExternalFileSelection(\n\tselected: SelectedFile | undefined,\n\tgetCurrentPath: () => string,\n\tonExternalChange: (selected: SelectedFile) => void,\n): void {\n\tconst skipNextRun = useRef(true);\n\t// getCurrentPath/onExternalChangeをuseEffectEventで読むことで、依存配列を\n\t// [selected]だけの正直な形に保てる(exhaustive-depsの抑制が不要になる —\n\t// 抑制コメントの存在自体がReact Compilerの別のバイルアウト条件でもある)\n\tconst handleSelectedChange = useEffectEvent(() => {\n\t\tif (skipNextRun.current) {\n\t\t\tskipNextRun.current = false;\n\t\t\treturn;\n\t\t}\n\t\tif (!selected?.path || selected.path === getCurrentPath()) {\n\t\t\treturn;\n\t\t}\n\t\tonExternalChange(selected);\n\t});\n\n\tuseEffect(() => {\n\t\thandleSelectedChange();\n\t}, [selected]);\n}\n","import type { ReactNode } from 'react';\n\n/**\n * Controlled checkbox following the editor form markup convention\n * (`label > input + text`).\n *\n * The structure is a styling contract: `ui.css` turns\n * `label:not([for]):has(input[type='checkbox'])` into a flex row, so it\n * must be preserved.\n * @param root0\n * @param root0.label\n * @param root0.checked\n * @param root0.onChange\n * @param root0.name\n * @param root0.disabled\n * @param root0.describedBy\n * @example\n * ```tsx\n * <Checkbox\n * \tlabel={<span>横スクロール可能</span>}\n * \tname=\"bge-scrollable\"\n * \tchecked={state.scrollable ?? false}\n * \tonChange={(scrollable) => setState({ ...state, scrollable })}\n * />\n * ```\n */\nexport function Checkbox({\n\tlabel,\n\tchecked,\n\tonChange,\n\tname,\n\tdisabled,\n\tdescribedBy,\n}: {\n\treadonly label: ReactNode;\n\treadonly checked: boolean;\n\treadonly onChange: (checked: boolean) => void;\n\treadonly name?: string;\n\treadonly disabled?: boolean;\n\treadonly describedBy?: string;\n}) {\n\treturn (\n\t\t<label>\n\t\t\t<input\n\t\t\t\ttype=\"checkbox\"\n\t\t\t\tname={name}\n\t\t\t\tchecked={checked}\n\t\t\t\tdisabled={disabled}\n\t\t\t\taria-describedby={describedBy}\n\t\t\t\tonChange={(e) => onChange(e.currentTarget.checked)}\n\t\t\t/>\n\t\t\t{label}\n\t\t</label>\n\t);\n}\n","import type { ReactNode } from 'react';\n\n/**\n * Grouping fieldset following the editor form markup convention\n * (`fieldset > legend`).\n *\n * The structure is a styling contract: `ui.css` draws the group border\n * and spacing on the `fieldset` element itself, so it must be preserved.\n * @param root0\n * @param root0.legend\n * @param root0.id\n * @param root0.disabled\n * @param root0.children\n * @example\n * ```tsx\n * <Fieldset legend=\"リンク設定\" disabled={!state.useLink}>\n * \t<TextField\n * \t\tlabel=\"URL\"\n * \t\tname=\"bge-href\"\n * \t\tvalue={state.href ?? ''}\n * \t\tonChange={(href) => setState({ ...state, href })}\n * \t/>\n * </Fieldset>\n * ```\n */\nexport function Fieldset({\n\tlegend,\n\tid,\n\tdisabled,\n\tchildren,\n}: {\n\treadonly legend: string;\n\treadonly id?: string;\n\treadonly disabled?: boolean;\n\treadonly children: ReactNode;\n}) {\n\treturn (\n\t\t<fieldset id={id} disabled={disabled}>\n\t\t\t<legend>{legend}</legend>\n\t\t\t{children}\n\t\t</fieldset>\n\t);\n}\n","/**\n * Controlled numeric input following the editor form markup convention.\n *\n * The `label > span + input` structure is a styling contract: `ui.css`\n * lays out fields with structural selectors\n * (`label:not([for]) > span:has(+ input)`), so it must be preserved.\n * @param root0\n * @param root0.label\n * @param root0.value\n * @param root0.onChange\n * @param root0.name\n * @param root0.min\n * @param root0.max\n * @param root0.step\n * @param root0.disabled\n * @example\n * ```tsx\n * <NumberField\n * \tlabel=\"表示件数\"\n * \tname=\"bge-count\"\n * \tvalue={state.count ?? 1}\n * \tmin={1}\n * \tonChange={(count) => setState({ ...state, count })}\n * />\n * ```\n */\nexport function NumberField({\n\tlabel,\n\tvalue,\n\tonChange,\n\tname,\n\tmin,\n\tmax,\n\tstep,\n\tdisabled,\n}: {\n\treadonly label: string;\n\treadonly value: number;\n\treadonly onChange: (value: number) => void;\n\treadonly name?: string;\n\treadonly min?: number;\n\treadonly max?: number;\n\treadonly step?: number;\n\treadonly disabled?: boolean;\n}) {\n\treturn (\n\t\t<label>\n\t\t\t<span>{label}</span>\n\t\t\t<input\n\t\t\t\ttype=\"number\"\n\t\t\t\tname={name}\n\t\t\t\tvalue={Number.isFinite(value) ? value : ''}\n\t\t\t\tmin={min}\n\t\t\t\tmax={max}\n\t\t\t\tstep={step}\n\t\t\t\tdisabled={disabled}\n\t\t\t\tonChange={(e) => onChange(e.currentTarget.valueAsNumber)}\n\t\t\t/>\n\t\t</label>\n\t);\n}\n","import type { SelectableValue } from '@burger-editor/core';\n\nimport { useId } from 'react';\n\n/**\n * Controlled radio group following the editor form markup convention\n * (`div[role=radiogroup] > label > input + text`).\n *\n * The structure is a styling contract: `ui.css` lays out the group via\n * `[role='radiogroup'] > label` (and appends `:` to the group label), so\n * it must be preserved.\n * @param root0\n * @param root0.label\n * @param root0.value\n * @param root0.onChange\n * @param root0.options\n * @param root0.name\n * @param root0.disabled\n * @example\n * ```tsx\n * <RadioGroup\n * \tlabel=\"配置\"\n * \tname=\"bge-align\"\n * \tvalue={state.align ?? 'start'}\n * \toptions={[\n * \t\t{ value: 'start', label: '左寄せ' },\n * \t\t{ value: 'end', label: '右寄せ' },\n * \t]}\n * \tonChange={(align) => setState({ ...state, align })}\n * />\n * ```\n */\nexport function RadioGroup({\n\tlabel,\n\tvalue,\n\tonChange,\n\toptions,\n\tname,\n\tdisabled,\n}: {\n\treadonly label: string;\n\treadonly value: string;\n\treadonly onChange: (value: string) => void;\n\treadonly options: readonly SelectableValue[];\n\treadonly name?: string;\n\treadonly disabled?: boolean;\n}) {\n\tconst labelId = useId();\n\treturn (\n\t\t<div role=\"radiogroup\" aria-labelledby={labelId}>\n\t\t\t<div id={labelId}>{label}</div>\n\t\t\t{options.map((option) => (\n\t\t\t\t<label key={option.value}>\n\t\t\t\t\t<input\n\t\t\t\t\t\ttype=\"radio\"\n\t\t\t\t\t\tname={name}\n\t\t\t\t\t\tvalue={option.value}\n\t\t\t\t\t\tchecked={value === option.value}\n\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\tonChange={(e) => {\n\t\t\t\t\t\t\tif (e.currentTarget.checked) {\n\t\t\t\t\t\t\t\tonChange(option.value);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t\t{option.label}\n\t\t\t\t</label>\n\t\t\t))}\n\t\t</div>\n\t);\n}\n","import type { SelectableValue } from '@burger-editor/core';\n\n/**\n * Controlled select following the editor form markup convention\n * (`label > span + select`).\n *\n * The structure is a styling contract: `ui.css` lays out fields with\n * structural selectors (`label:not([for]) > span:has(+ select)`), so it\n * must be preserved.\n * @param root0\n * @param root0.label\n * @param root0.value\n * @param root0.onChange\n * @param root0.options\n * @param root0.name\n * @param root0.disabled\n * @example\n * ```tsx\n * <SelectField\n * \tlabel=\"種類\"\n * \tname=\"bge-kind\"\n * \tvalue={state.kind ?? 'normal'}\n * \toptions={[\n * \t\t{ value: 'normal', label: '通常' },\n * \t\t{ value: 'wide', label: 'ワイド' },\n * \t]}\n * \tonChange={(kind) => setState({ ...state, kind })}\n * />\n * ```\n */\nexport function SelectField({\n\tlabel,\n\tvalue,\n\tonChange,\n\toptions,\n\tname,\n\tdisabled,\n}: {\n\treadonly label: string;\n\treadonly value: string;\n\treadonly onChange: (value: string) => void;\n\treadonly options: readonly SelectableValue[];\n\treadonly name?: string;\n\treadonly disabled?: boolean;\n}) {\n\treturn (\n\t\t<label>\n\t\t\t<span>{label}</span>\n\t\t\t<select\n\t\t\t\tname={name}\n\t\t\t\tvalue={value}\n\t\t\t\tdisabled={disabled}\n\t\t\t\tonChange={(e) => onChange(e.currentTarget.value)}>\n\t\t\t\t{options.map((option) => (\n\t\t\t\t\t<option key={option.value} value={option.value}>\n\t\t\t\t\t\t{option.label}\n\t\t\t\t\t</option>\n\t\t\t\t))}\n\t\t\t</select>\n\t\t</label>\n\t);\n}\n","/**\n * Controlled multi-line text input following the editor form markup\n * convention.\n *\n * The `label > span + textarea` structure is a styling contract: `ui.css`\n * lays out fields with structural selectors\n * (`label:not([for]) > span:has(+ textarea)`), so it must be preserved.\n * @param root0\n * @param root0.label\n * @param root0.value\n * @param root0.onChange\n * @param root0.name\n * @param root0.rows\n * @param root0.disabled\n * @example\n * ```tsx\n * <TextArea\n * \tlabel=\"説明文\"\n * \tname=\"bge-text\"\n * \tvalue={state.text ?? ''}\n * \tonChange={(text) => setState({ ...state, text })}\n * />\n * ```\n */\nexport function TextArea({\n\tlabel,\n\tvalue,\n\tonChange,\n\tname,\n\trows,\n\tdisabled,\n}: {\n\treadonly label: string;\n\treadonly value: string;\n\treadonly onChange: (value: string) => void;\n\treadonly name?: string;\n\treadonly rows?: number;\n\treadonly disabled?: boolean;\n}) {\n\treturn (\n\t\t<label>\n\t\t\t<span>{label}</span>\n\t\t\t<textarea\n\t\t\t\tname={name}\n\t\t\t\tvalue={value}\n\t\t\t\trows={rows}\n\t\t\t\tdisabled={disabled}\n\t\t\t\tonChange={(e) => onChange(e.currentTarget.value)}\n\t\t\t/>\n\t\t</label>\n\t);\n}\n","/**\n * Controlled single-line text input following the editor form markup\n * convention (`label > span + input`).\n *\n * The structure is a styling contract: `ui.css` lays out fields with\n * structural selectors (`label:not([for]) > span:has(+ input)`) instead\n * of `for`/`id` wiring, so it must be preserved.\n * @param root0\n * @param root0.label\n * @param root0.value\n * @param root0.onChange\n * @param root0.type\n * @param root0.name\n * @param root0.disabled\n * @param root0.placeholder\n * @param root0.describedBy\n * @example\n * ```tsx\n * <TextField\n * \tlabel=\"URL\"\n * \tname=\"bge-link\"\n * \tvalue={state.href ?? ''}\n * \tonChange={(href) => setState({ ...state, href })}\n * />\n * ```\n */\nexport function TextField({\n\tlabel,\n\tvalue,\n\tonChange,\n\ttype = 'text',\n\tname,\n\tdisabled,\n\tplaceholder,\n\tdescribedBy,\n}: {\n\treadonly label: string;\n\treadonly value: string;\n\treadonly onChange: (value: string) => void;\n\treadonly type?: 'text' | 'url' | 'email';\n\treadonly name?: string;\n\treadonly disabled?: boolean;\n\treadonly placeholder?: string;\n\treadonly describedBy?: string;\n}) {\n\treturn (\n\t\t<label>\n\t\t\t<span>{label}</span>\n\t\t\t<input\n\t\t\t\ttype={type}\n\t\t\t\tname={name}\n\t\t\t\tvalue={value}\n\t\t\t\tdisabled={disabled}\n\t\t\t\tplaceholder={placeholder}\n\t\t\t\taria-describedby={describedBy}\n\t\t\t\tonChange={(e) => onChange(e.currentTarget.value)}\n\t\t\t/>\n\t\t</label>\n\t);\n}\n"],"x_google_ignoreList":[0,1,2,3,4,5,6,7],"mappings":";;;;;;;;;;;;AAUA,IAAM,yBAAyB,qBAAqB,WAAW,wBAAwB,sBAAsBA;CADzF,CAAC,QAAQ;EAAE,KAAK;EAAW,OAAO;CAAQ,CAAC;CAAG,CAAC,QAAQ;EAAE,KAAK;EAAqB,OAAO;CAAQ,CAAC;CAAG,CAAC,QAAQ;EAAE,KAAK;EAAa,OAAO;CAAQ,CAAC;CAAG,CAAC,QAAQ;EAAE,KAAK;EAAoB,OAAO;CAAQ,CAAC;CAAG,CAAC,QAAQ;EAAE,KAAK;EAAa,OAAO;CAAQ,CAAC;CAAG,CAAC,QAAQ;EAAE,KAAK;EAAa,OAAO;CAAQ,CAAC;AACjNA,CAAU;;;;;;;ACAvH,IAAM,kBAAkB,qBAAqB,WAAW,iBAAiB,eAAeC;CADpE,CAAC,QAAQ;EAAE,KAAK;EAA2B,OAAO;CAAQ,CAAC;CAAG,CAAC,QAAQ;EAAE,KAAK;EAAmC,OAAO;CAAQ,CAAC;CAAG,CAAC,QAAQ;EAAE,KAAK;EAAkD,OAAO;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,UAAA;EAQTS,MAAAC,MAAOV,SAASU,EAACC,cAAcZ,KAAM;EAACH,EAAA,KAAAI;EAAAJ,EAAA,KAAAa;CAAA,OAAAA,KAAAb,EAAA;CAAA,IAAAgB;CAAA,IAAAhB,EAAA,OAAAU,eAAAV,EAAA,OAAAQ,YAAAR,EAAA,OAAAO,QAAAP,EAAA,OAAAS,eAAAT,EAAA,OAAAa,MAAAb,EAAA,OAAAK,QAAAL,EAAA,QAAAG,OAAA;EAPjDa,KAAA,oBAAA,SAAA;GACOX;GACAE;GACCJ;GACGK;GACGC;GACKC,oBAAAA;GACR,UAAAG;EAAsC,CAAA;EAC/Cb,EAAA,KAAAU;EAAAV,EAAA,KAAAQ;EAAAR,EAAA,KAAAO;EAAAP,EAAA,KAAAS;EAAAT,EAAA,KAAAa;EAAAb,EAAA,KAAAK;EAAAL,EAAA,MAAAG;EAAAH,EAAA,MAAAgB;CAAA,OAAAA,KAAAhB,EAAA;CAAA,IAAAiB;CAAA,IAAAjB,EAAA,QAAAY,MAAAZ,EAAA,QAAAgB,IAAA;EAVHC,KAAA,qBAAA,SAAA,EAAA,UAAA,CACCL,IACAI,EASO,EAAA,CAAA;EAAAhB,EAAA,MAAAY;EAAAZ,EAAA,MAAAgB;EAAAhB,EAAA,MAAAiB;CAAA,OAAAA,KAAAjB,EAAA;CAAA,OAXRiB;AAWQ"}
1
+ {"version":3,"file":"ui.js","names":["__iconNode","__iconNode","__iconNode","__iconNode","__iconNode","__iconNode","__iconNode","EMPTY_RESULT","error","data","pagination","current","total","queryKey","query","selectedPath","fileType","page","filter","FileBrowserStore","getSnapshot","state","subscribe","listener","listeners","add","delete","engine","initialReadDone","Set","queries","Map","selected","uploads","canDelete","serverAPI","deleteFile","constructor","url","res","Error","invalidate","prefix","key","keys","startsWith","emit","read","isInitialRead","has","path","undefined","cached","get","getFileList","options","promise","Promise","resolve","catch","set","select","fileSize","patch","upload","file","postFile","blob","URL","createObjectURL","previous","size","uploaded","map","u","name","revokeObjectURL","#emit","#patch","stores","WeakMap","getFileBrowserStore","store","useEngine","getFileBrowserStore","useFileBrowser","$","_c","engine","t0","_c","thumbnail","getExt","src","ext","split","pop","toLowerCase","isImage","includes","isVideo","isAudio","isDoc","isPpt","isXls","isPdf","IconFile","IconFileTypeDoc","IconFileTypePdf","IconFileTypePpt","IconFileTypeXls","IconHeadphones","IconVideo","useState","getExt","styles","Thumbnail","t0","$","_c","src","isLoaded","setIsLoaded","t1","file","t2","ext","isAudio","isDoc","isImage","isPdf","isPpt","isVideo","isXls","t3","thumbnail","_c","styles","formatByteSize","formatDate","Fragment","use","useDeferredValue","useId","useState","useSyncExternalStore","useTransition","useFileBrowser","useCommand","styles","Thumbnail","FileList","fileType","store","rootId","page","setPage","searchWord","setSearchWord","deferredFilter","isPending","startTransition","selected","subscribe","getSnapshot","uploads","myUploads","filter","u","result","read","totalPage","pagination","total","currentPage","current","files","map","fileId","name","size","timestamp","url","blob","sizes","data","f","some","paginate","nextPage","Number","isNaN","Math","min","max","rootRef","e","direction","source","value","select","dataset","deleteFile","alert","marked","text","chars","split","char","i","currentTarget","valueAsNumber","file","upload","find","path","scrollToSelected","undefined","floor","uploaded","canDelete","el","scrollIntoView","behavior","block","styles","useId","useRef","useTransition","useFileBrowser","useCommand","styles","FileUploader","t0","$","_c","fileType","store","rootId","inputRef","startTransition","accept","t1","Symbol","for","--open-file-picker","current","showPicker","rootRef","t2","inputFile","file","files","upload","alert","name","stageFile","t3","t4","t5","uploader","_c","styles","useEffect","useId","useRef","useState","useSyncExternalStore","createRoot","useCommand","FrontMatterStore","getSnapshot","fields","subscribe","listener","listeners","add","delete","Set","constructor","initialData","parseInitialData","getData","toData","setFields","next","createFrontMatterEditor","options","store","originalFrontMatter","hasFrontMatter","JSON","stringify","undefined","unsubscribe","onUpdated","root","container","render","teardown","unmount","getOriginalFrontMatter","Symbol","dispose","FrontMatterEditorView","rootId","dialogId","isCollapsed","setIsCollapsed","addDialogOpen","setAddDialogOpen","jsonDrafts","setJsonDrafts","applyFields","updateFieldValue","key","value","map","f","rootRef","--fm-toggle","prev","--fm-add-field","e","source","filter","_removed","rest","onAddSubmit","preventDefault","formData","FormData","currentTarget","String","get","type","some","getDefaultValue","length","field","text","FieldInput","t0","$","_c","inputId","jsonDraft","onValueChange","onJsonDraftChange","t1","Boolean","t2","e_3","checked","t3","e_2","Number","toDateInputValue","e_1","stringifyJson","isValidJson","e_0","nextText","parse","t4","AddFieldDialog","onSubmit","onClose","dialogRef","for","dialog","current","open","showModal","t5","t6","t7","t8","t9","t10","t11","t12","t13","t14","t15","t16","t17","t18","t19","t20","t21","t22","t23","data","Object","entries","detectType","test","parsed","Date","isNaN","toISOString","split","dateValue","getTime","_c","useEffect","useState","useSyncExternalStore","useFileBrowser","getExt","styles","Preview","t0","$","_c","path","store","dimension","setDimension","prevPath","setPrevPath","t1","file","t2","startsWith","isUploadingMode","t3","getSnapshot","uploads","subscribe","t4","find","u","blob","uploaded","total","progress","t5","t6","file_0","aborted","isImage","image","Image","src","addEventListener","width","naturalWidth","height","naturalHeight","once","isVideo","video","document","createElement","videoWidth","videoHeight","t7","img","uploading","t8","trim","t9","ext","isAudio","isDoc","isPpt","isXls","isPdf","t10","translate","t11","t12","upload","Math","round","t13","t14","meta","t15","_c","styles","IconArrowsTransferDown","IconRowInsertBottom","IconTrash","useId","useState","useCommand","styles","TableEditor","t0","$","_c","value","onChange","rootId","t1","th","map","_temp","rowIds","setRowIds","t2","td","i","id","String","rows","t3","next","_temp2","_temp3","_temp4","commit","rootRef","e","index","Number","source","toSpliced","crypto","randomUUID","e_0","index_0","e_1","from","to","fromRow","toRow","t6","t5","i_0","th_0","row","e_2","with","currentTarget","e_3","btn","length","t7","t4","table","row_1","row_0","_c","_temp","styles","useId","useRef","useCommand","styles","Tabs","current","onChange","contentId","length","createLabel","index","listId","refs","update","focus","rootRef","e","value","source","Number","onKeyDown","event","key","Math","max","min","Array","from","_","el","styles","use","useEffect","useEffectEvent","useRef","useState","useEngine","withFallback","promise","fallback","tagged","status","resolved","Promise","resolve","value","catch","WysiwygField","t0","$","_c","onChange","itemName","commands","label","engine","t1","getContentStylesheet","contentCssPromise","contentCss","ref","initialValue","t2","el","onTransaction","t3","el_0","current","innerHTML","listener","addEventListener","removeEventListener","t4","Symbol","for","t5","el_1","t6","_c","useEffect","useEffectEvent","useMountEffect","fn","$","_c","onMount","t0","t1","Symbol","for","_c","useEffect","useEffectEvent","useRef","useExternalFileSelection","selected","getCurrentPath","onExternalChange","$","_c","skipNextRun","t0","current","path","handleSelectedChange","t1","t2","_c","Checkbox","t0","$","_c","label","checked","onChange","name","disabled","describedBy","t1","e","currentTarget","t2","t3","_c","Fieldset","t0","$","_c","legend","id","disabled","children","t1","t2","_c","NumberField","t0","$","_c","label","value","onChange","name","min","max","step","disabled","t1","t2","Number","isFinite","t3","e","currentTarget","valueAsNumber","t4","t5","_c","useId","RadioGroup","t0","$","_c","label","value","onChange","options","name","disabled","labelId","t1","t2","t3","option","e","currentTarget","checked","map","_c","SelectField","t0","$","_c","label","value","onChange","options","name","disabled","t1","t2","e","currentTarget","t3","map","_temp","t4","t5","option","_c","TextArea","t0","$","_c","label","value","onChange","name","rows","disabled","t1","t2","e","currentTarget","t3","t4","_c","TextField","t0","$","_c","label","value","onChange","type","t1","name","disabled","placeholder","describedBy","undefined","t2","t3","e","currentTarget","t4","t5","_c"],"sources":["../../../../node_modules/@tabler/icons-react/dist/esm/icons/IconArrowsTransferDown.mjs","../../../../node_modules/@tabler/icons-react/dist/esm/icons/IconFileTypeDoc.mjs","../../../../node_modules/@tabler/icons-react/dist/esm/icons/IconFileTypePdf.mjs","../../../../node_modules/@tabler/icons-react/dist/esm/icons/IconFileTypePpt.mjs","../../../../node_modules/@tabler/icons-react/dist/esm/icons/IconFileTypeXls.mjs","../../../../node_modules/@tabler/icons-react/dist/esm/icons/IconFile.mjs","../../../../node_modules/@tabler/icons-react/dist/esm/icons/IconHeadphones.mjs","../../../../node_modules/@tabler/icons-react/dist/esm/icons/IconVideo.mjs","../src/file-browser/store.ts","../src/file-browser/use-file-browser.ts","../src/components/file-list.module.css","../src/get-ext.ts","../src/components/thumbnail.module.css","../src/components/thumbnail.tsx","../src/components/file-list.tsx","../src/components/file-uploader.module.css","../src/components/file-uploader.tsx","../src/components/front-matter-editor.tsx","../src/components/preview.module.css","../src/components/preview.tsx","../src/components/table-editor.module.css","../src/components/table-editor.tsx","../src/components/tabs.module.css","../src/components/tabs.tsx","../src/components/wysiwyg-field.tsx","../src/use-mount-effect.ts","../src/file-browser/use-external-file-selection.ts","../src/form/checkbox.tsx","../src/form/fieldset.tsx","../src/form/number-field.tsx","../src/form/radio-group.tsx","../src/form/select-field.tsx","../src/form/text-area.tsx","../src/form/text-field.tsx"],"sourcesContent":["/**\n * @license @tabler/icons-react v3.48.0 - MIT\n *\n * This source code is licensed under the MIT license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createReactComponent from '../createReactComponent.mjs';\n\nconst __iconNode = [[\"path\", { \"d\": \"M17 3v6\", \"key\": \"svg-0\" }], [\"path\", { \"d\": \"M10 18l-3 3l-3 -3\", \"key\": \"svg-1\" }], [\"path\", { \"d\": \"M7 21v-18\", \"key\": \"svg-2\" }], [\"path\", { \"d\": \"M20 6l-3 -3l-3 3\", \"key\": \"svg-3\" }], [\"path\", { \"d\": \"M17 21v-2\", \"key\": \"svg-4\" }], [\"path\", { \"d\": \"M17 15v-2\", \"key\": \"svg-5\" }]];\nconst IconArrowsTransferDown = createReactComponent(\"outline\", \"arrows-transfer-down\", \"ArrowsTransferDown\", __iconNode);\n\nexport { __iconNode, IconArrowsTransferDown as default };\n//# sourceMappingURL=IconArrowsTransferDown.mjs.map\n","/**\n * @license @tabler/icons-react v3.48.0 - MIT\n *\n * This source code is licensed under the MIT license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createReactComponent from '../createReactComponent.mjs';\n\nconst __iconNode = [[\"path\", { \"d\": \"M14 3v4a1 1 0 0 0 1 1h4\", \"key\": \"svg-0\" }], [\"path\", { \"d\": \"M5 12v-7a2 2 0 0 1 2 -2h7l5 5v4\", \"key\": \"svg-1\" }], [\"path\", { \"d\": \"M5 15v6h1a2 2 0 0 0 2 -2v-2a2 2 0 0 0 -2 -2h-1\", \"key\": \"svg-2\" }], [\"path\", { \"d\": \"M20 16.5a1.5 1.5 0 0 0 -3 0v3a1.5 1.5 0 0 0 3 0\", \"key\": \"svg-3\" }], [\"path\", { \"d\": \"M12.5 15a1.5 1.5 0 0 1 1.5 1.5v3a1.5 1.5 0 0 1 -3 0v-3a1.5 1.5 0 0 1 1.5 -1.5\", \"key\": \"svg-4\" }]];\nconst IconFileTypeDoc = createReactComponent(\"outline\", \"file-type-doc\", \"FileTypeDoc\", __iconNode);\n\nexport { __iconNode, IconFileTypeDoc as default };\n//# sourceMappingURL=IconFileTypeDoc.mjs.map\n","/**\n * @license @tabler/icons-react v3.48.0 - MIT\n *\n * This source code is licensed under the MIT license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createReactComponent from '../createReactComponent.mjs';\n\nconst __iconNode = [[\"path\", { \"d\": \"M14 3v4a1 1 0 0 0 1 1h4\", \"key\": \"svg-0\" }], [\"path\", { \"d\": \"M5 12v-7a2 2 0 0 1 2 -2h7l5 5v4\", \"key\": \"svg-1\" }], [\"path\", { \"d\": \"M5 18h1.5a1.5 1.5 0 0 0 0 -3h-1.5v6\", \"key\": \"svg-2\" }], [\"path\", { \"d\": \"M17 18h2\", \"key\": \"svg-3\" }], [\"path\", { \"d\": \"M20 15h-3v6\", \"key\": \"svg-4\" }], [\"path\", { \"d\": \"M11 15v6h1a2 2 0 0 0 2 -2v-2a2 2 0 0 0 -2 -2h-1\", \"key\": \"svg-5\" }]];\nconst IconFileTypePdf = createReactComponent(\"outline\", \"file-type-pdf\", \"FileTypePdf\", __iconNode);\n\nexport { __iconNode, IconFileTypePdf as default };\n//# sourceMappingURL=IconFileTypePdf.mjs.map\n","/**\n * @license @tabler/icons-react v3.48.0 - MIT\n *\n * This source code is licensed under the MIT license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createReactComponent from '../createReactComponent.mjs';\n\nconst __iconNode = [[\"path\", { \"d\": \"M14 3v4a1 1 0 0 0 1 1h4\", \"key\": \"svg-0\" }], [\"path\", { \"d\": \"M14 3v4a1 1 0 0 0 1 1h4\", \"key\": \"svg-1\" }], [\"path\", { \"d\": \"M5 18h1.5a1.5 1.5 0 0 0 0 -3h-1.5v6\", \"key\": \"svg-2\" }], [\"path\", { \"d\": \"M11 18h1.5a1.5 1.5 0 0 0 0 -3h-1.5v6\", \"key\": \"svg-3\" }], [\"path\", { \"d\": \"M16.5 15h3\", \"key\": \"svg-4\" }], [\"path\", { \"d\": \"M18 15v6\", \"key\": \"svg-5\" }], [\"path\", { \"d\": \"M5 12v-7a2 2 0 0 1 2 -2h7l5 5v4\", \"key\": \"svg-6\" }]];\nconst IconFileTypePpt = createReactComponent(\"outline\", \"file-type-ppt\", \"FileTypePpt\", __iconNode);\n\nexport { __iconNode, IconFileTypePpt as default };\n//# sourceMappingURL=IconFileTypePpt.mjs.map\n","/**\n * @license @tabler/icons-react v3.48.0 - MIT\n *\n * This source code is licensed under the MIT license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createReactComponent from '../createReactComponent.mjs';\n\nconst __iconNode = [[\"path\", { \"d\": \"M14 3v4a1 1 0 0 0 1 1h4\", \"key\": \"svg-0\" }], [\"path\", { \"d\": \"M5 12v-7a2 2 0 0 1 2 -2h7l5 5v4\", \"key\": \"svg-1\" }], [\"path\", { \"d\": \"M4 15l4 6\", \"key\": \"svg-2\" }], [\"path\", { \"d\": \"M4 21l4 -6\", \"key\": \"svg-3\" }], [\"path\", { \"d\": \"M17 20.25c0 .414 .336 .75 .75 .75h1.25a1 1 0 0 0 1 -1v-1a1 1 0 0 0 -1 -1h-1a1 1 0 0 1 -1 -1v-1a1 1 0 0 1 1 -1h1.25a.75 .75 0 0 1 .75 .75\", \"key\": \"svg-4\" }], [\"path\", { \"d\": \"M11 15v6h3\", \"key\": \"svg-5\" }]];\nconst IconFileTypeXls = createReactComponent(\"outline\", \"file-type-xls\", \"FileTypeXls\", __iconNode);\n\nexport { __iconNode, IconFileTypeXls as default };\n//# sourceMappingURL=IconFileTypeXls.mjs.map\n","/**\n * @license @tabler/icons-react v3.48.0 - MIT\n *\n * This source code is licensed under the MIT license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createReactComponent from '../createReactComponent.mjs';\n\nconst __iconNode = [[\"path\", { \"d\": \"M14 3v4a1 1 0 0 0 1 1h4\", \"key\": \"svg-0\" }], [\"path\", { \"d\": \"M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2\", \"key\": \"svg-1\" }]];\nconst IconFile = createReactComponent(\"outline\", \"file\", \"File\", __iconNode);\n\nexport { __iconNode, IconFile as default };\n//# sourceMappingURL=IconFile.mjs.map\n","/**\n * @license @tabler/icons-react v3.48.0 - MIT\n *\n * This source code is licensed under the MIT license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createReactComponent from '../createReactComponent.mjs';\n\nconst __iconNode = [[\"path\", { \"d\": \"M4 15a2 2 0 0 1 2 -2h1a2 2 0 0 1 2 2v3a2 2 0 0 1 -2 2h-1a2 2 0 0 1 -2 -2l0 -3\", \"key\": \"svg-0\" }], [\"path\", { \"d\": \"M15 15a2 2 0 0 1 2 -2h1a2 2 0 0 1 2 2v3a2 2 0 0 1 -2 2h-1a2 2 0 0 1 -2 -2l0 -3\", \"key\": \"svg-1\" }], [\"path\", { \"d\": \"M4 15v-3a8 8 0 0 1 16 0v3\", \"key\": \"svg-2\" }]];\nconst IconHeadphones = createReactComponent(\"outline\", \"headphones\", \"Headphones\", __iconNode);\n\nexport { __iconNode, IconHeadphones as default };\n//# sourceMappingURL=IconHeadphones.mjs.map\n","/**\n * @license @tabler/icons-react v3.48.0 - MIT\n *\n * This source code is licensed under the MIT license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createReactComponent from '../createReactComponent.mjs';\n\nconst __iconNode = [[\"path\", { \"d\": \"M15 10l4.553 -2.276a1 1 0 0 1 1.447 .894v6.764a1 1 0 0 1 -1.447 .894l-4.553 -2.276v-4\", \"key\": \"svg-0\" }], [\"path\", { \"d\": \"M3 8a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2l0 -8\", \"key\": \"svg-1\" }]];\nconst IconVideo = createReactComponent(\"outline\", \"video\", \"Video\", __iconNode);\n\nexport { __iconNode, IconVideo as default };\n//# sourceMappingURL=IconVideo.mjs.map\n","import type {\n\tBurgerEditorEngine,\n\tFileListResult,\n\tFileType,\n\tFileRequestOptions,\n} from '@burger-editor/core';\n\n/**\n * A file currently selected for a given `FileType` inside a dialog — the\n * path the item editor should apply, plus the byte size the old\n * `file-select` component-observer payload used to carry.\n */\nexport interface SelectedFile {\n\treadonly path: string;\n\treadonly fileSize: number;\n}\n\n/**\n * One upload in flight. Kept in the store (not local component state) so\n * `FileList` and `Preview` — siblings under the same item editor — both\n * see the same synthetic \"uploading…\" row / progress bar without a\n * broadcast bus.\n */\nexport interface UploadProgress {\n\treadonly fileType: FileType;\n\treadonly blob: string;\n\treadonly uploaded: number;\n\treadonly total: number;\n}\n\nexport interface FileBrowserQuery {\n\treadonly fileType: FileType;\n\treadonly page: number;\n\treadonly filter: string;\n}\n\ninterface FileBrowserState {\n\treadonly selected: { readonly [K in FileType]?: SelectedFile };\n\treadonly uploads: readonly UploadProgress[];\n}\n\nconst EMPTY_RESULT: FileListResult = {\n\terror: false,\n\tdata: [],\n\tpagination: { current: 0, total: 1 },\n};\n\ntype Listener = () => void;\n\n/**\n * Cache key for a file-list query — used both to look up a cached\n * promise and (via its `fileType` prefix) to find every cached page for\n * a given file type on invalidation.\n *\n * `selectedPath` (present only on the very first read for a `fileType`,\n * see {@link FileBrowserStore.read}) is folded into the key so that an\n * initial read's response — which the server may have jumped to a\n * different page than the one requested, to land on the selected file —\n * never collides with a later, unrelated `{fileType, page, filter}`\n * request for the *same nominal page* opened by a different item in the\n * same engine session. Without this, a second item reusing page 0 would\n * transparently receive the first item's page-jumped response instead of\n * a real page 0.\n * @param query - The query to key\n * @param selectedPath - The `selected` path actually sent with this\n * query, if any\n */\nfunction queryKey(query: FileBrowserQuery, selectedPath: string | undefined): string {\n\treturn `${query.fileType}:${query.page}:${query.filter}:${selectedPath ?? ''}`;\n}\n\n/**\n * Per-engine file-browser state: paginated/filtered `getFileList` query\n * results (cached by query, read through `use()`), the file currently\n * selected per `FileType`, and in-flight upload progress.\n *\n * React-independent so it can be constructed once per engine and shared\n * by every component that opens onto the same file browser (`FileList`,\n * `FileUploader`, `Preview`, and the item's own `Editor`) without a\n * window-level broadcast bus — see {@link getFileBrowserStore}.\n * @example\n * ```tsx\n * const store = getFileBrowserStore(engine);\n * const result = use(store.read({ fileType: 'image', page: 0, filter: '' }));\n * const selected = useSyncExternalStore(store.subscribe, store.getSnapshot);\n * ```\n */\nexport class FileBrowserStore {\n\treadonly getSnapshot = (): FileBrowserState => this.#state;\n\n\treadonly subscribe = (listener: Listener): (() => void) => {\n\t\tthis.#listeners.add(listener);\n\t\treturn () => {\n\t\t\tthis.#listeners.delete(listener);\n\t\t};\n\t};\n\n\treadonly #engine: BurgerEditorEngine;\n\t// fileTypeごとに最初の一回だけ`selected`をサーバーへ渡すためのフラグ。\n\t// invalidate()では落とさない(アップロード/削除後の再取得のたびに\n\t// 選択中ファイルのページへ引き戻されると、そのページを見ていた\n\t// ユーザーの手動ページ送りが台無しになる)\n\treadonly #initialReadDone = new Set<FileType>();\n\treadonly #listeners = new Set<Listener>();\n\treadonly #queries = new Map<string, Promise<FileListResult>>();\n\t#state: FileBrowserState = { selected: {}, uploads: [] };\n\n\t/** Whether the engine's `serverAPI` supports deleting files. */\n\tget canDelete(): boolean {\n\t\treturn !!this.#engine.serverAPI.deleteFile;\n\t}\n\n\tconstructor(engine: BurgerEditorEngine) {\n\t\tthis.#engine = engine;\n\t}\n\n\t/**\n\t * Delete a file from the server and invalidate `fileType`'s cached\n\t * pages so the list reflects the deletion on next read.\n\t * @param fileType - The file type the file belongs to\n\t * @param url - The file's URL\n\t * @throws {Error} When the server reports the deletion failed\n\t */\n\tasync deleteFile(fileType: FileType, url: string): Promise<void> {\n\t\tconst deleteFile = this.#engine.serverAPI.deleteFile;\n\t\tif (!deleteFile) {\n\t\t\treturn;\n\t\t}\n\t\tconst res = await deleteFile(fileType, url);\n\t\tif (res.error) {\n\t\t\tthrow new Error(`Failed to delete file: ${url}`);\n\t\t}\n\t\tthis.invalidate(fileType);\n\t}\n\n\t/**\n\t * Drop every cached page for `fileType` and notify subscribers, so the\n\t * next `read()` for that type issues a fresh request (after an upload\n\t * or a delete changes the underlying list).\n\t * @param fileType - The file type whose cached pages should be dropped\n\t */\n\tinvalidate(fileType: FileType): void {\n\t\tconst prefix = `${fileType}:`;\n\t\tfor (const key of this.#queries.keys()) {\n\t\t\tif (key.startsWith(prefix)) {\n\t\t\t\tthis.#queries.delete(key);\n\t\t\t}\n\t\t}\n\t\tthis.#emit();\n\t}\n\n\t/**\n\t * Read (and cache) one page of the file list. The returned promise is\n\t * stable per `{fileType, page, filter}` plus whether this particular\n\t * read sent `selected` (see below) — safe to pass to `use()` directly\n\t * from render, repeated calls with the same query return the same\n\t * promise instead of re-suspending.\n\t *\n\t * The very first read for a given `fileType` also sends the currently\n\t * selected file's path as `selected`, so the server can jump straight\n\t * to the page that already contains it (e.g. re-opening an image item\n\t * whose file isn't on page 0) instead of always starting at `page`.\n\t * Later reads for that `fileType` (explicit pagination, search, or a\n\t * post-upload/-delete refetch via {@link invalidate}) omit it — always\n\t * including it would silently override the page the caller asked for.\n\t *\n\t * Because that jump means the response's actual page can differ from\n\t * the requested one, `selected` is folded into the cache key (see\n\t * {@link queryKey}): a later item opening the same `fileType` and\n\t * nominal page never transparently receives the first item's\n\t * page-jumped response — it misses the cache and gets a real page.\n\t * @param query - The file type, page and filter to query\n\t * @returns The (possibly still-pending, cached) file list page\n\t */\n\tread(query: FileBrowserQuery): Promise<FileListResult> {\n\t\tconst isInitialRead = !this.#initialReadDone.has(query.fileType);\n\t\tconst selectedPath = isInitialRead\n\t\t\t? this.#state.selected[query.fileType]?.path\n\t\t\t: undefined;\n\t\tconst key = queryKey(query, selectedPath);\n\t\tconst cached = this.#queries.get(key);\n\t\tif (cached) {\n\t\t\treturn cached;\n\t\t}\n\t\tthis.#initialReadDone.add(query.fileType);\n\t\tconst getFileList = this.#engine.serverAPI.getFileList;\n\t\tconst options: FileRequestOptions = {\n\t\t\tpage: query.page,\n\t\t\tfilter: query.filter,\n\t\t\tselected: selectedPath,\n\t\t};\n\t\tconst promise = getFileList\n\t\t\t? getFileList(query.fileType, options)\n\t\t\t: Promise.resolve(EMPTY_RESULT);\n\t\t// 失敗したクエリはキャッシュに残さず、再レンダーで再試行できるようにする\n\t\tpromise.catch(() => {\n\t\t\tthis.#queries.delete(key);\n\t\t});\n\t\tthis.#queries.set(key, promise);\n\t\treturn promise;\n\t}\n\n\t/**\n\t * Record the file currently selected for `fileType` — a no-op when the\n\t * path is unchanged, so callers can call this unconditionally (e.g.\n\t * every render) without causing redundant notifications.\n\t * @param fileType - The file type being selected for\n\t * @param path - The selected file's path, or `''` for \"nothing selected\"\n\t * @param fileSize - The selected file's byte size, when known\n\t */\n\tselect(fileType: FileType, path: string, fileSize = 0): void {\n\t\tconst current = this.#state.selected[fileType];\n\t\tif (current?.path === path) {\n\t\t\treturn;\n\t\t}\n\t\tthis.#patch({\n\t\t\tselected: { ...this.#state.selected, [fileType]: { path, fileSize } },\n\t\t});\n\t}\n\n\t/**\n\t * Upload a file, tracking progress in `uploads` (so `FileList` and\n\t * `Preview` can both show it) and selecting the resulting URL once the\n\t * server responds — a blob URL is selected immediately so the UI has\n\t * something to show while the upload is in flight.\n\t *\n\t * The blob URL is revoked once the upload settles. On failure the\n\t * selection is restored to what it was before the upload (empty path if\n\t * nothing was selected), so a revoked blob URL is never left selected\n\t * for the dialog to confirm.\n\t * @param fileType - The file type to upload into\n\t * @param file - The file to upload\n\t * @throws {Error} When no `postFile` API is configured, or the server\n\t * reports the upload failed\n\t */\n\tasync upload(fileType: FileType, file: File): Promise<void> {\n\t\tconst postFile = this.#engine.serverAPI.postFile;\n\t\tconst blob = URL.createObjectURL(file);\n\t\tconst previous = this.#state.selected[fileType];\n\t\tthis.select(fileType, blob, file.size);\n\t\tthis.#patch({\n\t\t\tuploads: [\n\t\t\t\t...this.#state.uploads,\n\t\t\t\t{ fileType, blob, uploaded: 0, total: file.size || 1 },\n\t\t\t],\n\t\t});\n\t\ttry {\n\t\t\tif (!postFile) {\n\t\t\t\tthrow new Error('postFile is not configured');\n\t\t\t}\n\t\t\tconst res = await postFile(fileType, file, (uploaded, total) => {\n\t\t\t\tthis.#patch({\n\t\t\t\t\tuploads: this.#state.uploads.map((u) =>\n\t\t\t\t\t\tu.blob === blob ? { ...u, uploaded, total } : u,\n\t\t\t\t\t),\n\t\t\t\t});\n\t\t\t});\n\t\t\tif (res.error) {\n\t\t\t\tthrow new Error(`Failed to upload file: ${file.name}`);\n\t\t\t}\n\t\t\tthis.invalidate(fileType);\n\t\t\tthis.select(fileType, res.uploaded.url, res.uploaded.size);\n\t\t} catch (error) {\n\t\t\t// 失敗したblob URLを選択に残すと、解放後に壊れたプレビューと無効な\n\t\t\t// pathが確定されてしまうため、アップロード前の選択へ戻す\n\t\t\tthis.select(fileType, previous?.path ?? '', previous?.fileSize);\n\t\t\tthrow error;\n\t\t} finally {\n\t\t\tthis.#patch({ uploads: this.#state.uploads.filter((u) => u.blob !== blob) });\n\t\t\t// blob URLはアップロード中のプレビュー専用。成功時は選択が実URLへ\n\t\t\t// 移っており、失敗時もこれ以上の参照元はないので、必ずここで解放する\n\t\t\tURL.revokeObjectURL(blob);\n\t\t}\n\t}\n\n\t#emit(): void {\n\t\tfor (const listener of this.#listeners) {\n\t\t\tlistener();\n\t\t}\n\t}\n\n\t#patch(patch: Partial<FileBrowserState>): void {\n\t\tthis.#state = { ...this.#state, ...patch };\n\t\tthis.#emit();\n\t}\n}\n\nconst stores = new WeakMap<BurgerEditorEngine, FileBrowserStore>();\n\n/**\n * Get (creating on first access) the `FileBrowserStore` for `engine`. One\n * store per engine, shared by every component under it — see\n * {@link FileBrowserStore}.\n * @param engine - The engine to get the store for\n * @returns That engine's file-browser store\n */\nexport function getFileBrowserStore(engine: BurgerEditorEngine): FileBrowserStore {\n\tlet store = stores.get(engine);\n\tif (!store) {\n\t\tstore = new FileBrowserStore(engine);\n\t\tstores.set(engine, store);\n\t}\n\treturn store;\n}\n","import type { FileBrowserStore } from './store.js';\n\nimport { useEngine } from '../engine-context.js';\n\nimport { getFileBrowserStore } from './store.js';\n\n/**\n * Get the current engine's `FileBrowserStore` — file-list query cache,\n * current selection and upload progress shared by `FileList`,\n * `FileUploader`, `Preview` and the item's own `Editor`.\n * @returns The engine's file-browser store\n * @example\n * ```tsx\n * const fileBrowser = useFileBrowser();\n * const selected = useSyncExternalStore(\n * \tfileBrowser.subscribe,\n * \t() => fileBrowser.getSnapshot().selected.image,\n * );\n * ```\n */\nexport function useFileBrowser(): FileBrowserStore {\n\tconst engine = useEngine();\n\treturn getFileBrowserStore(engine);\n}\n",".ctrl {\n\tdisplay: flex;\n\tgap: 2em;\n\tmargin-block-end: 1em;\n}\n\n.pagination {\n\tdisplay: flex;\n\tflex: 1 0 auto;\n\tgap: 1em;\n\talign-items: center;\n\tjustify-content: center;\n\n\tbutton {\n\t\tuser-select: none;\n\t}\n}\n\n.page {\n\tdisplay: flex;\n\tgap: 0.5em;\n\talign-items: center;\n}\n\n.list {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 0.5em;\n\tpadding: 0;\n\tmargin: 0;\n\n\tli {\n\t\tposition: relative;\n\t\tpadding: 0;\n\t\tmargin: 0;\n\t\tlist-style: none;\n\t}\n\n\tli:is(:focus-within:has(:focus-visible), :hover) .delete {\n\t\topacity: 1;\n\t}\n}\n\n.file {\n\tz-index: 0;\n\tdisplay: flex;\n\tgap: 1em;\n\talign-items: center;\n\tinline-size: 100%;\n\tpadding: 0.5em;\n\ttext-align: start;\n\tborder: none;\n\n\t> span {\n\t\tdisplay: block;\n\t}\n\n\t> span.thumbnail {\n\t\tdisplay: block;\n\t\tflex: 0 0 7em;\n\t\tinline-size: 7em;\n\t\tblock-size: 7em;\n\t}\n\n\t> span.attr {\n\t\tdisplay: grid;\n\t\tgrid-template-columns: max-content 1fr;\n\t\tgap: 0.2em 1em;\n\t\talign-items: baseline;\n\t}\n\n\t> span.attr > span:nth-child(odd)::after {\n\t\tcontent: ':';\n\t}\n}\n\n.delete {\n\tposition: absolute;\n\tinset-block-end: 0.7em;\n\tinset-inline-end: 0.7em;\n\tdisplay: block;\n\tpadding: 0.5em;\n\tfont-size: 0.8em;\n\ttext-align: center;\n\topacity: 0;\n\n\t&:hover {\n\t\t--bge-border-color: var(--bge-ui-primary-color);\n\t}\n}\n\n.file[aria-pressed='true'] + .delete {\n\t--bge-outline-color: #fff;\n\t--bge-border-color: #fff;\n\n\tcolor: #fff;\n\tbackground-color: var(--bge-ui-primary-color);\n}\n","/**\n *\n * @param src\n */\nexport function getExt(src: string) {\n\tconst ext = src.split('.').pop()?.toLowerCase() ?? '';\n\n\tconst isImage = ['jpg', 'jpeg', 'png', 'gif', 'webp', 'svg'].includes(ext);\n\tconst isVideo = ['mp4', 'webm', 'mov', 'avi'].includes(ext);\n\tconst isAudio = ['mp3', 'wav', 'm4a', 'ogg', 'flac'].includes(ext);\n\tconst isDoc = ['doc', 'docx'].includes(ext);\n\tconst isPpt = ['ppt', 'pptx'].includes(ext);\n\tconst isXls = ['xls', 'xlsx'].includes(ext);\n\tconst isPdf = ['pdf'].includes(ext);\n\n\treturn {\n\t\text,\n\t\tisImage,\n\t\tisVideo,\n\t\tisAudio,\n\t\tisDoc,\n\t\tisPpt,\n\t\tisXls,\n\t\tisPdf,\n\t};\n}\n",".thumbnail {\n\tdisplay: block;\n\tinline-size: 100%;\n\tblock-size: 100%;\n\n\timg,\n\tvideo {\n\t\tdisplay: block;\n\t\tinline-size: 100%;\n\t\tblock-size: 100%;\n\t\tobject-fit: cover;\n\t\ttransition: opacity 300ms linear;\n\t}\n\n\t&[data-loaded='false'] img {\n\t\topacity: 0;\n\t}\n\n\t&[data-loaded='true'] img {\n\t\topacity: 1;\n\t}\n}\n","import {\n\tIconFile,\n\tIconFileTypeDoc,\n\tIconFileTypePdf,\n\tIconFileTypePpt,\n\tIconFileTypeXls,\n\tIconHeadphones,\n\tIconVideo,\n} from '@tabler/icons-react';\nimport { useState } from 'react';\n\nimport { getExt } from '../get-ext.js';\n\nimport styles from './thumbnail.module.css';\n\n/**\n * File thumbnail. Renders an image/video preview or a file-type icon.\n *\n * The file type is inferred from the URL's extension (`getExt`) — the\n * URL is the only information available here, so the extension decides\n * whether the file can be previewed inline or needs a type icon.\n * @param root0\n * @param root0.src\n * @example\n * ```tsx\n * <Thumbnail src={file.url} />\n * ```\n */\nexport function Thumbnail({ src }: { readonly src: string }) {\n\tconst [isLoaded, setIsLoaded] = useState(false);\n\n\tconst file = getExt(src);\n\n\treturn (\n\t\t<span\n\t\t\tclassName={styles['thumbnail']}\n\t\t\tdata-bge-editor-ui-component=\"thumbnail\"\n\t\t\tdata-loaded={isLoaded}>\n\t\t\t{file.isImage ? (\n\t\t\t\t<img\n\t\t\t\t\tsrc={src}\n\t\t\t\t\talt=\"画像のプレビュー\"\n\t\t\t\t\tloading=\"lazy\"\n\t\t\t\t\tonLoad={() => setIsLoaded(true)}\n\t\t\t\t/>\n\t\t\t) : file.isVideo ? (\n\t\t\t\t<video controls={false} playsInline>\n\t\t\t\t\t<source src={src} type={`video/${file.ext}`} />\n\t\t\t\t\t<track kind=\"captions\" src=\"\" />\n\t\t\t\t\t<IconVideo />\n\t\t\t\t</video>\n\t\t\t) : file.isAudio ? (\n\t\t\t\t<IconHeadphones />\n\t\t\t) : file.isDoc ? (\n\t\t\t\t<IconFileTypeDoc />\n\t\t\t) : file.isPpt ? (\n\t\t\t\t<IconFileTypePpt />\n\t\t\t) : file.isXls ? (\n\t\t\t\t<IconFileTypeXls />\n\t\t\t) : file.isPdf ? (\n\t\t\t\t<IconFileTypePdf />\n\t\t\t) : (\n\t\t\t\t<IconFile />\n\t\t\t)}\n\t\t</span>\n\t);\n}\n","import type { FileType } from '@burger-editor/core';\nimport type { ReactNode } from 'react';\n\nimport { formatByteSize, formatDate } from '@burger-editor/utils';\nimport {\n\tFragment,\n\tuse,\n\tuseDeferredValue,\n\tuseId,\n\tuseState,\n\tuseSyncExternalStore,\n\tuseTransition,\n} from 'react';\n\nimport { useFileBrowser } from '../file-browser/use-file-browser.js';\nimport { useCommand } from '../use-command.js';\n\nimport styles from './file-list.module.css';\nimport { Thumbnail } from './thumbnail.js';\n\n/**\n * Paginated, searchable file list. Reads its page through `use()` against\n * the engine's `FileBrowserStore` (suspends into the dialog's Suspense\n * boundary while loading); selection and in-flight uploads come from the\n * same store, shared with `FileUploader` and the item's own `Editor`\n * instead of a broadcast bus.\n * @param root0\n * @param root0.fileType\n * @example\n * ```tsx\n * <FileUploader fileType=\"image\" />\n * <FileList fileType=\"image\" />\n * ```\n */\nexport function FileList({ fileType }: { readonly fileType: FileType }) {\n\t// store.read()はReactの外(FileBrowserStoreの内部Mapキャッシュ)が\n\t// invalidate()で更新される、意図的に不純な関数(react.devのRules of\n\t// Reactに違反する — 同じ引数でも呼び出しごとに結果が変わりうる)。\n\t// React Compilerは「同じ引数なら前回の結果を再利用してよい」と誤って\n\t// 判断し、アップロード/削除後のinvalidate()に対する再取得\n\t// (getFileListの再呼び出し)を静かにスキップしてしまう\n\t// (file-list.spec.tsxの回帰テストで実測確認済み)。この関数だけ\n\t// コンパイラの最適化対象から明示的に外す\n\t'use no memo';\n\n\tconst store = useFileBrowser();\n\tconst rootId = useId();\n\n\tconst [page, setPage] = useState(0);\n\tconst [searchWord, setSearchWord] = useState('');\n\tconst deferredFilter = useDeferredValue(searchWord);\n\tconst [isPending, startTransition] = useTransition();\n\n\tconst selected = useSyncExternalStore(\n\t\tstore.subscribe,\n\t\t() => store.getSnapshot().selected[fileType],\n\t);\n\tconst uploads = useSyncExternalStore(\n\t\tstore.subscribe,\n\t\t() => store.getSnapshot().uploads,\n\t);\n\tconst myUploads = uploads.filter((u) => u.fileType === fileType);\n\n\tconst result = use(store.read({ fileType, page, filter: deferredFilter }));\n\tconst totalPage = result.pagination.total;\n\tconst currentPage = result.pagination.current;\n\n\t// アップロード中のblob行を先頭に合成する。サーバーはまだこのファイルを\n\t// 知らないため、result.dataとは別にstoreのuploadsから直接描画する\n\tconst files = [\n\t\t// timestampは常にuploadブランチ側の表示(進捗%)のため未使用 —\n\t\t// アップロード完了行の描画には使われない\n\t\t...myUploads.map((u) => ({\n\t\t\tfileId: '',\n\t\t\tname: '',\n\t\t\tsize: 0,\n\t\t\ttimestamp: 0,\n\t\t\turl: u.blob,\n\t\t\tsizes: {},\n\t\t})),\n\t\t...result.data.filter((f) => !myUploads.some((u) => u.blob === f.url)),\n\t];\n\n\tconst paginate = (nextPage: number) => {\n\t\tnextPage = Number.isNaN(nextPage)\n\t\t\t? 0\n\t\t\t: Math.min(Math.max(0, nextPage), totalPage - 1);\n\t\tif (nextPage === currentPage) {\n\t\t\treturn;\n\t\t}\n\t\tstartTransition(() => {\n\t\t\tsetPage(nextPage);\n\t\t});\n\t};\n\n\tconst rootRef = useCommand<HTMLDivElement>({\n\t\t'--paginate': (e) => {\n\t\t\tconst direction = (e.source as HTMLButtonElement | null)?.value;\n\t\t\tpaginate(direction === 'prev' ? currentPage - 1 : currentPage + 1);\n\t\t},\n\t\t'--select-file': (e) => {\n\t\t\tconst source = e.source as HTMLButtonElement | null;\n\t\t\tif (!source) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tstore.select(fileType, source.value, Number(source.dataset['size'] ?? '0'));\n\t\t},\n\t\t'--delete-file': (e) => {\n\t\t\tconst url = (e.source as HTMLButtonElement | null)?.value;\n\t\t\tif (!url) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tstartTransition(async () => {\n\t\t\t\ttry {\n\t\t\t\t\tawait store.deleteFile(fileType, url);\n\t\t\t\t} catch {\n\t\t\t\t\talert('ファイルの削除に失敗しました。');\n\t\t\t\t}\n\t\t\t});\n\t\t},\n\t});\n\n\tconst marked = (text: string): ReactNode => {\n\t\tif (!searchWord) {\n\t\t\treturn text;\n\t\t}\n\t\tconst chars = text.split(searchWord);\n\t\treturn chars.map((char, i) => (\n\t\t\t<Fragment key={char + i}>\n\t\t\t\t{i === 0 ? null : <mark>{searchWord}</mark>}\n\t\t\t\t{char}\n\t\t\t</Fragment>\n\t\t));\n\t};\n\n\treturn (\n\t\t<div ref={rootRef} id={rootId} aria-busy={isPending}>\n\t\t\t<div className={styles['ctrl']}>\n\t\t\t\t<div className={styles['pagination']}>\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tdisabled={currentPage === 0}\n\t\t\t\t\t\tcommand=\"--paginate\"\n\t\t\t\t\t\tcommandfor={rootId}\n\t\t\t\t\t\tvalue=\"prev\">\n\t\t\t\t\t\t前へ\n\t\t\t\t\t</button>\n\t\t\t\t\t<div className={styles['page']}>\n\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t\t\t\tvalue={currentPage + 1}\n\t\t\t\t\t\t\t\tmin=\"1\"\n\t\t\t\t\t\t\t\tmax={totalPage}\n\t\t\t\t\t\t\t\tonChange={(e) => paginate(e.currentTarget.valueAsNumber - 1)}\n\t\t\t\t\t\t\t\taria-label=\"ページ番号\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t<span>/</span>\n\t\t\t\t\t\t<span>{totalPage}</span>\n\t\t\t\t\t</div>\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tdisabled={currentPage === totalPage - 1}\n\t\t\t\t\t\tcommand=\"--paginate\"\n\t\t\t\t\t\tcommandfor={rootId}\n\t\t\t\t\t\tvalue=\"next\">\n\t\t\t\t\t\t次へ\n\t\t\t\t\t</button>\n\t\t\t\t</div>\n\t\t\t\t<input\n\t\t\t\t\ttype=\"search\"\n\t\t\t\t\tplaceholder=\"検索\"\n\t\t\t\t\tvalue={searchWord}\n\t\t\t\t\tonChange={(e) => setSearchWord(e.currentTarget.value)}\n\t\t\t\t/>\n\t\t\t</div>\n\n\t\t\t<ul className={styles['list']}>\n\t\t\t\t{files.map((file) => {\n\t\t\t\t\tconst upload = myUploads.find((u) => u.blob === file.url);\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<li key={file.url}>\n\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\tref={file.url === selected?.path ? scrollToSelected : undefined}\n\t\t\t\t\t\t\t\tclassName={styles['file']}\n\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\taria-pressed={file.url === selected?.path}\n\t\t\t\t\t\t\t\tcommand=\"--select-file\"\n\t\t\t\t\t\t\t\tcommandfor={rootId}\n\t\t\t\t\t\t\t\tvalue={file.url}\n\t\t\t\t\t\t\t\tdata-size={file.size}>\n\t\t\t\t\t\t\t\t<span className={styles['thumbnail']}>\n\t\t\t\t\t\t\t\t\t<Thumbnail src={file.url} />\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t{upload ? (\n\t\t\t\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t\t\t\tアップロード中...{' '}\n\t\t\t\t\t\t\t\t\t\t<span>{Math.floor((upload.uploaded / upload.total) * 100)}%</span>\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t<span className={styles['attr']}>\n\t\t\t\t\t\t\t\t\t\t<span>ID</span>\n\t\t\t\t\t\t\t\t\t\t<span>{marked(file.fileId)}</span>\n\t\t\t\t\t\t\t\t\t\t<span>名称</span>\n\t\t\t\t\t\t\t\t\t\t<span>{marked(file.name)}</span>\n\t\t\t\t\t\t\t\t\t\t<span>更新</span>\n\t\t\t\t\t\t\t\t\t\t<span>{formatDate(file.timestamp / 1000, 'YYYY-MM-DD HH:mm')}</span>\n\t\t\t\t\t\t\t\t\t\t<span>サイズ</span>\n\t\t\t\t\t\t\t\t\t\t<span>{formatByteSize(file.size)}</span>\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t{!upload && store.canDelete ? (\n\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\tclassName={styles['delete']}\n\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\tcommand=\"--delete-file\"\n\t\t\t\t\t\t\t\t\tcommandfor={rootId}\n\t\t\t\t\t\t\t\t\tvalue={file.url}>\n\t\t\t\t\t\t\t\t\t削除\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t</li>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t</ul>\n\t\t</div>\n\t);\n}\n\n/**\n * Callback ref attached only to the currently selected file button, so the\n * list scrolls to it when the selection mounts or changes. Kept at module\n * scope for a stable identity — an inline arrow would re-attach (and\n * re-scroll) on every unrelated re-render such as upload progress updates.\n * @param el - The selected button, or null on detach\n */\nfunction scrollToSelected(el: HTMLButtonElement | null) {\n\tel?.scrollIntoView({\n\t\tbehavior: 'smooth',\n\t\tblock: 'nearest',\n\t});\n}\n",".uploader {\n\tinput[type='file'] {\n\t\tdisplay: none;\n\t}\n}\n","import type { FileType } from '@burger-editor/core';\n\nimport { useId, useRef, useTransition } from 'react';\n\nimport { useFileBrowser } from '../file-browser/use-file-browser.js';\nimport { useCommand } from '../use-command.js';\n\nimport styles from './file-uploader.module.css';\n\n/**\n * File upload control. The trigger button declares a local command and\n * the handler opens the picker via `showPicker()` — no click handlers,\n * no programmatic `click()`. The upload itself goes through the engine's\n * `FileBrowserStore`, shared with `FileList`/`Preview` so they see the\n * same progress without a broadcast bus.\n * @param root0\n * @param root0.fileType\n * @example\n * ```tsx\n * <FileUploader fileType=\"image\" />\n * ```\n */\nexport function FileUploader({ fileType }: { readonly fileType: FileType }) {\n\tconst store = useFileBrowser();\n\tconst rootId = useId();\n\tconst inputRef = useRef<HTMLInputElement>(null);\n\tconst [, startTransition] = useTransition();\n\n\tconst accept = fileType === 'image' ? 'image/*' : '*';\n\n\tconst rootRef = useCommand<HTMLDivElement>({\n\t\t'--open-file-picker': () => {\n\t\t\tinputRef.current?.showPicker();\n\t\t},\n\t});\n\n\tconst stageFile = () => {\n\t\tconst inputFile = inputRef.current;\n\t\tconst file = inputFile?.files?.[0];\n\t\tif (!file) {\n\t\t\treturn;\n\t\t}\n\n\t\tstartTransition(async () => {\n\t\t\ttry {\n\t\t\t\tawait store.upload(fileType, file);\n\t\t\t} catch {\n\t\t\t\t// onChangeからのfire-and-forget呼び出しのため、ここで\n\t\t\t\t// ユーザーに通知しないと失敗が闇に消える\n\t\t\t\talert(`ファイルのアップロードに失敗しました: ${file.name}`);\n\t\t\t}\n\t\t});\n\t};\n\n\treturn (\n\t\t<div ref={rootRef} id={rootId} className={styles['uploader']}>\n\t\t\t<input type=\"file\" ref={inputRef} onChange={stageFile} accept={accept} />\n\t\t\t<button type=\"button\" command=\"--open-file-picker\" commandfor={rootId}>\n\t\t\t\tファイルを追加アップロードする\n\t\t\t</button>\n\t\t</div>\n\t);\n}\n","/* @jsxImportSource react */\nimport type { ReactNode } from 'react';\n\nimport { useEffect, useId, useRef, useState, useSyncExternalStore } from 'react';\nimport { createRoot } from 'react-dom/client';\n\nimport { useCommand } from '../use-command.js';\n\n/**\n * Supported field types for Front Matter editor\n */\ntype FieldType = 'text' | 'number' | 'boolean' | 'date' | 'json';\n\n/**\n * Field definition for Front Matter\n */\nexport interface FieldDefinition {\n\treadonly key: string;\n\treadonly type: FieldType;\n\treadonly value: unknown;\n}\n\n/**\n * Owns the Front Matter field list — the actual data, as opposed to the\n * view's own UI-only state (collapsed, add-dialog-open, in-progress JSON\n * drafts). `createFrontMatterEditor`'s handle reads `getData()`/\n * `getSnapshot()` directly and subscribes to be notified of changes,\n * instead of a mutable closure variable updated from inside a React\n * callback — the handle has no other way to read React state from\n * outside React.\n * @example\n * ```ts\n * const store = new FrontMatterStore({ title: 'A' });\n * store.subscribe(() => console.log(store.getData()));\n * store.setFields([{ key: 'title', type: 'text', value: 'B' }]);\n * ```\n */\nexport class FrontMatterStore {\n\treadonly getSnapshot = (): readonly FieldDefinition[] => this.#fields;\n\treadonly subscribe = (listener: () => void): (() => void) => {\n\t\tthis.#listeners.add(listener);\n\t\treturn () => {\n\t\t\tthis.#listeners.delete(listener);\n\t\t};\n\t};\n\t#fields: readonly FieldDefinition[];\n\treadonly #listeners = new Set<() => void>();\n\n\tconstructor(initialData: Record<string, unknown>) {\n\t\tthis.#fields = parseInitialData(initialData);\n\t}\n\n\tgetData(): Record<string, unknown> {\n\t\treturn toData(this.#fields);\n\t}\n\n\tsetFields(next: readonly FieldDefinition[]): void {\n\t\tthis.#fields = next;\n\t\tfor (const listener of this.#listeners) {\n\t\t\tlistener();\n\t\t}\n\t}\n}\n\n/**\n * Options for the Front Matter editor\n */\nexport interface FrontMatterEditorOptions {\n\t/** Container element to render the editor */\n\treadonly container: HTMLElement;\n\t/** Initial Front Matter data */\n\treadonly initialData: Record<string, unknown>;\n\t/** Whether Front Matter originally existed */\n\treadonly hasFrontMatter: boolean;\n\t/** Callback when data changes */\n\treadonly onUpdated?: (data: Record<string, unknown>) => void;\n}\n\n/**\n * Handle returned by {@link createFrontMatterEditor}.\n */\nexport interface FrontMatterEditorHandle extends Disposable {\n\t/**\n\t * Get current Front Matter data\n\t */\n\tgetData(): Record<string, unknown>;\n\t/**\n\t * Get original Front Matter string for format preservation\n\t */\n\tgetOriginalFrontMatter(): string | undefined;\n\t/**\n\t * Unmount the editor UI.\n\t * @deprecated Use a `using` declaration (`[Symbol.dispose]`) instead.\n\t */\n\tunmount(): void;\n}\n\n/**\n * Mount the Front Matter editor (a React component) into the given\n * container.\n *\n * The field list is rendered declaratively from React state, so\n * toggling the panel or editing other fields never rebuilds the inputs\n * — focus, caret position and IME composition survive re-renders.\n * @param options - Mount target and initial data\n * @returns A handle exposing the latest data and an unmount function\n * @example\n * ```ts\n * const editor = createFrontMatterEditor({\n * \tcontainer: document.querySelector('.front-matter-editor')!,\n * \tinitialData: { title: 'ページ' },\n * \thasFrontMatter: true,\n * \tonUpdated: (data) => debouncedSave(data),\n * });\n * editor.getData(); // => { title: 'ページ' }\n * ```\n */\nexport function createFrontMatterEditor(\n\toptions: FrontMatterEditorOptions,\n): FrontMatterEditorHandle {\n\tconst store = new FrontMatterStore(options.initialData);\n\tconst originalFrontMatter = options.hasFrontMatter\n\t\t? JSON.stringify(options.initialData)\n\t\t: undefined;\n\n\t// onUpdatedはstoreの変化そのものに反応する — Reactのレンダーサイクルを\n\t// 経由するコールバックpropではなく、subscribe/getSnapshotの外部ストア\n\t// 契約だけで完結する\n\tconst unsubscribe = store.subscribe(() => {\n\t\toptions.onUpdated?.(store.getData());\n\t});\n\n\tconst root = createRoot(options.container);\n\troot.render(<FrontMatterEditorView store={store} />);\n\n\tconst teardown = () => {\n\t\tunsubscribe();\n\t\troot.unmount();\n\t};\n\n\treturn {\n\t\tgetData: () => store.getData(),\n\t\tgetOriginalFrontMatter: () => originalFrontMatter,\n\t\t// unmountと[Symbol.dispose]は同じ関数を指す — thisに依存する実装だと\n\t\t// 分割代入経由の呼び出しでthisが外れてTypeErrorになるため、\n\t\t// 共有クロージャへの参照にしている\n\t\tunmount: teardown,\n\t\t[Symbol.dispose]: teardown,\n\t};\n}\n\n/**\n * Front Matterの動的フォーム本体。フィールド一覧は`store`(唯一の\n * データソース)から読み、折りたたみ・追加ダイアログ・JSON下書きは\n * この見た目だけのUI状態としてローカルに持つ。操作は Invoker Commands\n * (`--fm-toggle` / `--fm-add-field` / `--fm-delete-field`)で受ける\n * @param root0\n * @param root0.store\n * @example\n * ```tsx\n * <FrontMatterEditorView store={new FrontMatterStore({ title: 'ページ' })} />\n * ```\n */\nexport function FrontMatterEditorView({ store }: { readonly store: FrontMatterStore }) {\n\tconst rootId = useId();\n\tconst dialogId = useId();\n\tconst fields = useSyncExternalStore(store.subscribe, store.getSnapshot);\n\tconst [isCollapsed, setIsCollapsed] = useState(false);\n\tconst [addDialogOpen, setAddDialogOpen] = useState(false);\n\t// JSONフィールドの未確定テキスト。パースに失敗している間は確定値を\n\t// 変えずに入力中の文字列を保持する(キーはフィールドkey)\n\tconst [jsonDrafts, setJsonDrafts] = useState<Record<string, string>>({});\n\n\tconst applyFields = (next: readonly FieldDefinition[]) => {\n\t\tstore.setFields(next);\n\t};\n\n\tconst updateFieldValue = (key: string, value: unknown) => {\n\t\tapplyFields(fields.map((f) => (f.key === key ? { ...f, value } : f)));\n\t};\n\n\tconst rootRef = useCommand<HTMLDivElement>({\n\t\t'--fm-toggle': () => {\n\t\t\tsetIsCollapsed((prev) => !prev);\n\t\t},\n\t\t'--fm-add-field': () => {\n\t\t\tsetAddDialogOpen(true);\n\t\t},\n\t\t'--fm-delete-field': (e) => {\n\t\t\tconst key = (e.source as HTMLButtonElement | null)?.value;\n\t\t\tif (key == null) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tapplyFields(fields.filter((f) => f.key !== key));\n\t\t\t// 未確定のJSONドラフトも削除する。残すと同名キーを再追加した\n\t\t\t// ときに古い(無効な場合もある)テキストが復活してしまう\n\t\t\tsetJsonDrafts((prev) => {\n\t\t\t\tconst { [key]: _removed, ...rest } = prev;\n\t\t\t\treturn rest;\n\t\t\t});\n\t\t},\n\t});\n\n\tconst onAddSubmit = (e: React.FormEvent<HTMLFormElement>) => {\n\t\te.preventDefault();\n\t\tconst formData = new FormData(e.currentTarget);\n\t\tconst key = String(formData.get('key') ?? '');\n\t\tconst type = formData.get('type') as FieldType;\n\n\t\t// 既存キーとの重複は黙って拒否する(値の上書き事故を防ぐ)\n\t\tif (key && !fields.some((f) => f.key === key)) {\n\t\t\tapplyFields([...fields, { key, type, value: getDefaultValue(type) }]);\n\t\t}\n\n\t\tsetAddDialogOpen(false);\n\t};\n\n\treturn (\n\t\t<div ref={rootRef} id={rootId} className=\"fm-editor\">\n\t\t\t<div className=\"fm-editor-header\">\n\t\t\t\t<button\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tclassName=\"fm-editor-toggle\"\n\t\t\t\t\taria-expanded={!isCollapsed}\n\t\t\t\t\tcommand=\"--fm-toggle\"\n\t\t\t\t\tcommandfor={rootId}>\n\t\t\t\t\t<span className=\"fm-editor-toggle-icon\">{isCollapsed ? '▶' : '▼'}</span>\n\t\t\t\t\t<span>Front Matter</span>\n\t\t\t\t</button>\n\t\t\t\t<button\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tclassName=\"fm-editor-add\"\n\t\t\t\t\ttitle=\"フィールドを追加\"\n\t\t\t\t\tcommand=\"--fm-add-field\"\n\t\t\t\t\tcommandfor={rootId}>\n\t\t\t\t\t{'+ 追加'}\n\t\t\t\t</button>\n\t\t\t</div>\n\t\t\t{isCollapsed ? null : (\n\t\t\t\t<div className=\"fm-editor-fields\">\n\t\t\t\t\t{fields.length === 0 ? (\n\t\t\t\t\t\t<div className=\"fm-editor-empty\">\n\t\t\t\t\t\t\tフィールドがありません。「+ 追加」ボタンでフィールドを追加してください。\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) : (\n\t\t\t\t\t\tfields.map((field) => (\n\t\t\t\t\t\t\t<div key={field.key} className=\"fm-editor-field\" data-type={field.type}>\n\t\t\t\t\t\t\t\t<label\n\t\t\t\t\t\t\t\t\tclassName=\"fm-editor-field-label\"\n\t\t\t\t\t\t\t\t\thtmlFor={`${rootId}-field-${field.key}`}>\n\t\t\t\t\t\t\t\t\t{field.key}\n\t\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t\t<div className=\"fm-editor-field-input\">\n\t\t\t\t\t\t\t\t\t<FieldInput\n\t\t\t\t\t\t\t\t\t\tfield={field}\n\t\t\t\t\t\t\t\t\t\tinputId={`${rootId}-field-${field.key}`}\n\t\t\t\t\t\t\t\t\t\tjsonDraft={jsonDrafts[field.key]}\n\t\t\t\t\t\t\t\t\t\tonValueChange={(value) => updateFieldValue(field.key, value)}\n\t\t\t\t\t\t\t\t\t\tonJsonDraftChange={(text) => {\n\t\t\t\t\t\t\t\t\t\t\tsetJsonDrafts((prev) => ({ ...prev, [field.key]: text }));\n\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\tclassName=\"fm-editor-field-delete\"\n\t\t\t\t\t\t\t\t\ttitle=\"フィールドを削除\"\n\t\t\t\t\t\t\t\t\tcommand=\"--fm-delete-field\"\n\t\t\t\t\t\t\t\t\tcommandfor={rootId}\n\t\t\t\t\t\t\t\t\tvalue={field.key}>\n\t\t\t\t\t\t\t\t\t×\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t))\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t)}\n\t\t\t{addDialogOpen ? (\n\t\t\t\t<AddFieldDialog\n\t\t\t\t\tdialogId={dialogId}\n\t\t\t\t\tonSubmit={onAddSubmit}\n\t\t\t\t\tonClose={() => setAddDialogOpen(false)}\n\t\t\t\t/>\n\t\t\t) : null}\n\t\t</div>\n\t);\n}\n\n/**\n * 型別のcontrolled input\n * @param root0\n * @param root0.field\n * @param root0.inputId\n * @param root0.jsonDraft\n * @param root0.onValueChange\n * @param root0.onJsonDraftChange\n */\nfunction FieldInput({\n\tfield,\n\tinputId,\n\tjsonDraft,\n\tonValueChange,\n\tonJsonDraftChange,\n}: {\n\treadonly field: FieldDefinition;\n\treadonly inputId: string;\n\treadonly jsonDraft: string | undefined;\n\treadonly onValueChange: (value: unknown) => void;\n\treadonly onJsonDraftChange: (text: string) => void;\n}): ReactNode {\n\tswitch (field.type) {\n\t\tcase 'boolean': {\n\t\t\treturn (\n\t\t\t\t<input\n\t\t\t\t\tid={inputId}\n\t\t\t\t\ttype=\"checkbox\"\n\t\t\t\t\tchecked={Boolean(field.value)}\n\t\t\t\t\tonChange={(e) => onValueChange(e.currentTarget.checked)}\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\t\tcase 'number': {\n\t\t\treturn (\n\t\t\t\t<input\n\t\t\t\t\tid={inputId}\n\t\t\t\t\ttype=\"number\"\n\t\t\t\t\tvalue={field.value == null ? '' : String(field.value)}\n\t\t\t\t\tonChange={(e) => {\n\t\t\t\t\t\tonValueChange(\n\t\t\t\t\t\t\te.currentTarget.value === '' ? null : Number(e.currentTarget.value),\n\t\t\t\t\t\t);\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\t\tcase 'date': {\n\t\t\treturn (\n\t\t\t\t<input\n\t\t\t\t\tid={inputId}\n\t\t\t\t\ttype=\"date\"\n\t\t\t\t\tvalue={toDateInputValue(field.value)}\n\t\t\t\t\tonChange={(e) => onValueChange(e.currentTarget.value)}\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\t\tcase 'json': {\n\t\t\tconst text = jsonDraft ?? stringifyJson(field.value);\n\t\t\treturn (\n\t\t\t\t<textarea\n\t\t\t\t\tid={inputId}\n\t\t\t\t\trows={3}\n\t\t\t\t\tclassName={isValidJson(text) ? undefined : 'fm-editor-error'}\n\t\t\t\t\tvalue={text}\n\t\t\t\t\tonChange={(e) => {\n\t\t\t\t\t\tconst nextText = e.currentTarget.value;\n\t\t\t\t\t\tonJsonDraftChange(nextText);\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tonValueChange(JSON.parse(nextText) as unknown);\n\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t// 不正なJSONの間は確定値を変えない(テキストは保持)\n\t\t\t\t\t\t}\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\t\tdefault: {\n\t\t\treturn (\n\t\t\t\t<input\n\t\t\t\t\tid={inputId}\n\t\t\t\t\ttype=\"text\"\n\t\t\t\t\tvalue={String(field.value ?? '')}\n\t\t\t\t\tonChange={(e) => onValueChange(e.currentTarget.value)}\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\t}\n}\n\n/**\n * フィールド追加ダイアログ。マウント時にshowModalし、close(キャンセル\n * ボタンの組み込みcloseコマンド / Escキー)でアンマウントされる\n * @param root0\n * @param root0.dialogId\n * @param root0.onSubmit\n * @param root0.onClose\n */\nfunction AddFieldDialog({\n\tdialogId,\n\tonSubmit,\n\tonClose,\n}: {\n\treadonly dialogId: string;\n\treadonly onSubmit: (e: React.FormEvent<HTMLFormElement>) => void;\n\treadonly onClose: () => void;\n}) {\n\tconst dialogRef = useRef<HTMLDialogElement>(null);\n\n\tuseEffect(() => {\n\t\tconst dialog = dialogRef.current;\n\t\tif (dialog && !dialog.open) {\n\t\t\tdialog.showModal();\n\t\t}\n\t}, []);\n\n\treturn (\n\t\t<dialog ref={dialogRef} className=\"fm-editor-dialog\" id={dialogId} onClose={onClose}>\n\t\t\t<form onSubmit={onSubmit}>\n\t\t\t\t<h3>フィールドを追加</h3>\n\t\t\t\t<div className=\"fm-editor-dialog-field\">\n\t\t\t\t\t<label htmlFor={`${dialogId}-key`}>キー名</label>\n\t\t\t\t\t<input\n\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\tid={`${dialogId}-key`}\n\t\t\t\t\t\tname=\"key\"\n\t\t\t\t\t\trequired\n\t\t\t\t\t\tplaceholder=\"例: title, author, date\"\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"fm-editor-dialog-field\">\n\t\t\t\t\t<label htmlFor={`${dialogId}-type`}>型</label>\n\t\t\t\t\t<select id={`${dialogId}-type`} name=\"type\">\n\t\t\t\t\t\t<option value=\"text\">テキスト</option>\n\t\t\t\t\t\t<option value=\"number\">数値</option>\n\t\t\t\t\t\t<option value=\"boolean\">真偽値</option>\n\t\t\t\t\t\t<option value=\"date\">日付</option>\n\t\t\t\t\t\t<option value=\"json\">JSON(配列/オブジェクト)</option>\n\t\t\t\t\t</select>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"fm-editor-dialog-actions\">\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tclassName=\"fm-editor-dialog-cancel\"\n\t\t\t\t\t\tcommand=\"close\"\n\t\t\t\t\t\tcommandfor={dialogId}>\n\t\t\t\t\t\tキャンセル\n\t\t\t\t\t</button>\n\t\t\t\t\t<button type=\"submit\" className=\"fm-editor-dialog-submit\">\n\t\t\t\t\t\t追加\n\t\t\t\t\t</button>\n\t\t\t\t</div>\n\t\t\t</form>\n\t\t</dialog>\n\t);\n}\n\n/**\n * Parse initial data and detect field types\n * @param data\n */\nfunction parseInitialData(data: Record<string, unknown>): FieldDefinition[] {\n\treturn Object.entries(data).map(([key, value]) => ({\n\t\tkey,\n\t\ttype: detectType(value),\n\t\tvalue,\n\t}));\n}\n\n/**\n * フィールド一覧をFront Matterデータへ畳み込む\n * @param fields\n */\nfunction toData(fields: readonly FieldDefinition[]): Record<string, unknown> {\n\tconst data: Record<string, unknown> = {};\n\tfor (const field of fields) {\n\t\tdata[field.key] = field.value;\n\t}\n\treturn data;\n}\n\n/**\n * Detect the type of a value\n * @param value\n */\nfunction detectType(value: unknown): FieldType {\n\tif (typeof value === 'boolean') {\n\t\treturn 'boolean';\n\t}\n\tif (typeof value === 'number') {\n\t\treturn 'number';\n\t}\n\tif (typeof value === 'string') {\n\t\t// Check if it's an ISO date string\n\t\tif (/^\\d{4}-\\d{2}-\\d{2}(?:T\\d{2}:\\d{2}:\\d{2})?/.test(value)) {\n\t\t\tconst parsed = Date.parse(value);\n\t\t\tif (!Number.isNaN(parsed)) {\n\t\t\t\treturn 'date';\n\t\t\t}\n\t\t}\n\t\treturn 'text';\n\t}\n\tif (value instanceof Date) {\n\t\treturn 'date';\n\t}\n\t// Arrays and objects\n\tif (typeof value === 'object' && value !== null) {\n\t\treturn 'json';\n\t}\n\treturn 'text';\n}\n\n/**\n * Get default value for a type\n * @param type\n */\nfunction getDefaultValue(type: FieldType): unknown {\n\tswitch (type) {\n\t\tcase 'boolean': {\n\t\t\treturn false;\n\t\t}\n\t\tcase 'number': {\n\t\t\treturn 0;\n\t\t}\n\t\tcase 'date': {\n\t\t\treturn new Date().toISOString().split('T')[0];\n\t\t}\n\t\tcase 'json': {\n\t\t\treturn [];\n\t\t}\n\t\tdefault: {\n\t\t\treturn '';\n\t\t}\n\t}\n}\n\n/**\n * `<input type=\"date\">` に渡せる `yyyy-mm-dd` へ正規化する。\n * 不正な日付は空文字(未入力)にする\n * @param value\n */\nfunction toDateInputValue(value: unknown): string {\n\tif (!value) {\n\t\treturn '';\n\t}\n\tconst dateValue = value instanceof Date ? value : new Date(String(value));\n\tif (Number.isNaN(dateValue.getTime())) {\n\t\treturn '';\n\t}\n\treturn dateValue.toISOString().split('T')[0] ?? '';\n}\n\n/**\n * @param value\n */\nfunction stringifyJson(value: unknown): string {\n\ttry {\n\t\treturn JSON.stringify(value, null, 2);\n\t} catch {\n\t\treturn String(value);\n\t}\n}\n\n/**\n * @param text\n */\nfunction isValidJson(text: string): boolean {\n\ttry {\n\t\tJSON.parse(text);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n",".img {\n\tposition: relative;\n\toverflow: hidden;\n\n\timg,\n\tvideo,\n\taudio,\n\tobject,\n\tp {\n\t\tposition: relative;\n\t\tz-index: 0;\n\t\tdisplay: block;\n\t\tinline-size: 100%;\n\t\taspect-ratio: 16 / 9;\n\t\tmargin: 0;\n\t\tobject-fit: contain;\n\t}\n\n\tp {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tjustify-content: center;\n\t\tbackground: rgb(0 0 0 / 10%);\n\t}\n\n\t&.uploading img {\n\t\tobject-fit: cover;\n\t}\n\n\t.progress {\n\t\tposition: absolute;\n\t\tinset-block-start: 0;\n\t\tz-index: 10;\n\t\tinline-size: 100%;\n\t\tblock-size: 100%;\n\t\tbackground: rgb(0 0 0 / 50%);\n\t}\n}\n\n.meta {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: 0.3em;\n\tjustify-content: center;\n\tpadding: 0;\n\tpadding-block-end: 1em;\n\tmargin: 0;\n\tmargin-block-start: 0.5em;\n\tfont-family: monospace;\n\tfont-size: calc(12 / 16 * 1em);\n\topacity: 0.7;\n\n\tli {\n\t\tdisplay: block;\n\t\tpadding: 0;\n\t\tmargin: 0;\n\t\tlist-style: none;\n\t}\n\n\t.path {\n\t\tword-break: break-all;\n\n\t\ta {\n\t\t\tcolor: inherit;\n\t\t}\n\t}\n\n\t.upload .progress {\n\t\tfont-style: italic;\n\t}\n\n\t.dimension {\n\t\t&::before {\n\t\t\tcontent: '(';\n\t\t}\n\n\t\t&::after {\n\t\t\tcontent: ')';\n\t\t}\n\t}\n}\n","import { useEffect, useState, useSyncExternalStore } from 'react';\n\nimport { useFileBrowser } from '../file-browser/use-file-browser.js';\nimport { getExt } from '../get-ext.js';\n\nimport styles from './preview.module.css';\n\n/**\n * File preview pane. The previewed path comes from the parent (lifted\n * from the item's own state); upload progress is read from the engine's\n * `FileBrowserStore`, shared with `FileList`/`FileUploader`.\n * @param root0\n * @param root0.path\n * @example\n * ```tsx\n * <Preview path={state.path ?? ''} />\n * ```\n */\nexport function Preview({ path }: { readonly path: string }) {\n\tconst store = useFileBrowser();\n\tconst [dimension, setDimension] = useState<{\n\t\treadonly width: number;\n\t\treadonly height: number;\n\t} | null>(null);\n\n\t// path変更時のリセットはeffectではなくrender中に行う\n\t// (effect内の同期setStateはカスケードレンダーを起こすため)\n\tconst [prevPath, setPrevPath] = useState(path);\n\tif (prevPath !== path) {\n\t\tsetPrevPath(path);\n\t\tsetDimension(null);\n\t}\n\n\tconst file = path ? getExt(path) : null;\n\tconst isUploadingMode = path.startsWith('blob:');\n\n\tconst uploads = useSyncExternalStore(\n\t\tstore.subscribe,\n\t\t() => store.getSnapshot().uploads,\n\t);\n\tconst progress = uploads.find((u) => u.blob === path) ?? { uploaded: 0, total: 100 };\n\n\tuseEffect(() => {\n\t\tconst file = path ? getExt(path) : null;\n\t\tlet aborted = false;\n\n\t\tif (file?.isImage) {\n\t\t\tconst image = new Image();\n\t\t\timage.src = path;\n\t\t\timage.addEventListener(\n\t\t\t\t'load',\n\t\t\t\t() => {\n\t\t\t\t\tif (!aborted) {\n\t\t\t\t\t\tsetDimension({ width: image.naturalWidth, height: image.naturalHeight });\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t{ once: true },\n\t\t\t);\n\t\t} else if (file?.isVideo) {\n\t\t\tconst video = document.createElement('video');\n\t\t\tvideo.src = path;\n\t\t\tvideo.addEventListener(\n\t\t\t\t'loadedmetadata',\n\t\t\t\t() => {\n\t\t\t\t\tif (!aborted) {\n\t\t\t\t\t\tsetDimension({ width: video.videoWidth, height: video.videoHeight });\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t{ once: true },\n\t\t\t);\n\t\t}\n\n\t\treturn () => {\n\t\t\taborted = true;\n\t\t};\n\t}, [path]);\n\n\treturn (\n\t\t<div>\n\t\t\t<div\n\t\t\t\tclassName={`${styles['img']} ${isUploadingMode ? styles['uploading'] : ''}`.trim()}>\n\t\t\t\t{file?.isImage ? (\n\t\t\t\t\t<img src={path} alt=\"画像プレビュー\" />\n\t\t\t\t) : file?.isVideo ? (\n\t\t\t\t\t<video controls playsInline>\n\t\t\t\t\t\t<source src={path} type={`video/${file.ext}`} />\n\t\t\t\t\t\t<track kind=\"captions\" src=\"\" />\n\t\t\t\t\t</video>\n\t\t\t\t) : file?.isAudio ? (\n\t\t\t\t\t<audio controls>\n\t\t\t\t\t\t<source src={path} type={`audio/${file.ext}`} />\n\t\t\t\t\t\t<track kind=\"metadata\" src=\"\" />\n\t\t\t\t\t</audio>\n\t\t\t\t) : file?.isDoc || file?.isPpt || file?.isXls || file?.isPdf ? (\n\t\t\t\t\t<object\n\t\t\t\t\t\tdata={path}\n\t\t\t\t\t\ttype={`application/${file.ext}`}\n\t\t\t\t\t\ttitle={`${file.ext}ファイルのプレビュー`}>\n\t\t\t\t\t\t<p>プレビューできません</p>\n\t\t\t\t\t</object>\n\t\t\t\t) : (\n\t\t\t\t\t<p>プレビューできません</p>\n\t\t\t\t)}\n\t\t\t\t{isUploadingMode ? (\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={styles['progress']}\n\t\t\t\t\t\tstyle={{ translate: `${(progress.uploaded / progress.total) * 100}%` }}></div>\n\t\t\t\t) : null}\n\t\t\t</div>\n\t\t\t<ul className={styles['meta']}>\n\t\t\t\t{isUploadingMode ? (\n\t\t\t\t\t<li className={styles['upload']}>\n\t\t\t\t\t\t<span>アップロード...</span>\n\t\t\t\t\t\t<span className={styles['progress']}>\n\t\t\t\t\t\t\t{Math.round((progress.uploaded / progress.total) * 100)}% (\n\t\t\t\t\t\t\t{progress.uploaded}/{progress.total})\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</li>\n\t\t\t\t) : (\n\t\t\t\t\t<li className={styles['path']}>\n\t\t\t\t\t\t<a href={path} target=\"_blank\">\n\t\t\t\t\t\t\t{path}\n\t\t\t\t\t\t</a>\n\t\t\t\t\t</li>\n\t\t\t\t)}\n\t\t\t\t{dimension ? (\n\t\t\t\t\t<li className={styles['dimension']}>\n\t\t\t\t\t\t{dimension.width}x{dimension.height}\n\t\t\t\t\t</li>\n\t\t\t\t) : null}\n\t\t\t</ul>\n\t\t</div>\n\t);\n}\n",".table {\n\tdisplay: grid;\n\tgrid-template-columns: minmax(1em, 1fr) minmax(1em, 1fr) auto;\n\tgap: 0.5em 1em;\n}\n\n.row {\n\tdisplay: grid;\n\tgrid-template-columns: subgrid;\n\tgrid-column: span 3;\n\talign-items: center;\n\n\ttextarea {\n\t\tinline-size: 100%;\n\t\tresize: vertical;\n\t}\n}\n\n.btn {\n\tul {\n\t\tdisplay: flex;\n\t\tgap: 0.3em;\n\t\tpadding: 0;\n\t\tmargin: 0;\n\t}\n\n\tli {\n\t\tpadding: 0;\n\t\tmargin: 0;\n\t\tlist-style: none;\n\t}\n}\n","import {\n\tIconArrowsTransferDown,\n\tIconRowInsertBottom,\n\tIconTrash,\n} from '@tabler/icons-react';\nimport { useId, useState } from 'react';\n\nimport { useCommand } from '../use-command.js';\n\nimport styles from './table-editor.module.css';\n\n/**\n * Row-aligned table cell text: `th[i]` and `td[i]` form one row. In the\n * table item the `td` cells hold Markdown while editing (converted\n * to/from HTML via `toEditorState`/`toItemData`); `th` cells stay plain.\n */\nexport interface TableEditorData {\n\treadonly th: readonly string[];\n\treadonly td: readonly string[];\n}\n\n/**\n * Table row editor as a fully controlled component. The table item's\n * editor owns the state; row operations are declared as local commands.\n * @param root0\n * @param root0.value\n * @param root0.onChange\n * @example\n * ```tsx\n * <TableEditor\n * \tvalue={{ th: state.th ?? [], td: state.td ?? [] }}\n * \tonChange={({ th, td }) => setState({ ...state, th: [...th], td: [...td] })}\n * />\n * ```\n */\nexport function TableEditor({\n\tvalue,\n\tonChange,\n}: {\n\treadonly value: TableEditorData;\n\treadonly onChange: (value: TableEditorData) => void;\n}) {\n\tconst rootId = useId();\n\n\t// 行の安定した識別子。配列indexをkeyにすると、並べ替え・削除のたびに\n\t// 「同じ画面位置」のDOM要素が別の行の内容へ再利用され、編集中の\n\t// textareaのフォーカス・キャレット位置が行の中身ではなく位置に\n\t// 取り残される。id付きの行として管理し、commitのたびに一緒に\n\t// スプライスすることでReactの差分更新が行の中身を正しく追従できる\n\tconst [rowIds, setRowIds] = useState<readonly string[]>(() =>\n\t\tvalue.th.map(() => crypto.randomUUID()),\n\t);\n\n\tconst rows: readonly { id: string; th: string; td: string }[] = value.th.map(\n\t\t(th, i) => ({\n\t\t\tid: rowIds[i] ?? String(i),\n\t\t\tth,\n\t\t\ttd: value.td[i] ?? '',\n\t\t}),\n\t);\n\n\tconst commit = (next: readonly { id: string; th: string; td: string }[]) => {\n\t\tsetRowIds(next.map((row) => row.id));\n\t\tonChange({\n\t\t\tth: next.map((row) => row.th),\n\t\t\ttd: next.map((row) => row.td),\n\t\t});\n\t};\n\n\tconst rootRef = useCommand<HTMLDivElement>({\n\t\t'--add-row': (e) => {\n\t\t\tconst index = Number((e.source as HTMLButtonElement | null)?.value);\n\t\t\tcommit(rows.toSpliced(index + 1, 0, { id: crypto.randomUUID(), th: '', td: '' }));\n\t\t},\n\t\t'--remove-row': (e) => {\n\t\t\tconst index = Number((e.source as HTMLButtonElement | null)?.value);\n\t\t\tcommit(rows.toSpliced(index, 1));\n\t\t},\n\t\t'--move-row-down': (e) => {\n\t\t\tconst from = Number((e.source as HTMLButtonElement | null)?.value);\n\t\t\tconst to = from + 1;\n\t\t\tconst fromRow = rows[from];\n\t\t\tconst toRow = rows[to];\n\t\t\tif (!fromRow || !toRow) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcommit(rows.toSpliced(from, 1, toRow).toSpliced(to, 1, fromRow));\n\t\t},\n\t});\n\n\treturn (\n\t\t<div className={styles['table']} ref={rootRef} id={rootId}>\n\t\t\t{rows.map(({ id, th, td }, i) => (\n\t\t\t\t<div className={styles['row']} key={id}>\n\t\t\t\t\t<div className={styles['th']}>\n\t\t\t\t\t\t<textarea\n\t\t\t\t\t\t\taria-label={`${i}行目の見出しセル`}\n\t\t\t\t\t\t\tname={`bge-th-${i}`}\n\t\t\t\t\t\t\tvalue={th}\n\t\t\t\t\t\t\tonChange={(e) => {\n\t\t\t\t\t\t\t\tcommit(rows.with(i, { id, th: e.currentTarget.value, td }));\n\t\t\t\t\t\t\t}}></textarea>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div className={styles['td']}>\n\t\t\t\t\t\t<textarea\n\t\t\t\t\t\t\taria-label={`${i}行目の内容セル`}\n\t\t\t\t\t\t\tname={`bge-td-${i}`}\n\t\t\t\t\t\t\tvalue={td}\n\t\t\t\t\t\t\tonChange={(e) => {\n\t\t\t\t\t\t\t\tcommit(rows.with(i, { id, th, td: e.currentTarget.value }));\n\t\t\t\t\t\t\t}}></textarea>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div className={styles['btn']}>\n\t\t\t\t\t\t<ul>\n\t\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\ttitle=\"下に追加\"\n\t\t\t\t\t\t\t\t\tcommand=\"--add-row\"\n\t\t\t\t\t\t\t\t\tcommandfor={rootId}\n\t\t\t\t\t\t\t\t\tvalue={i}>\n\t\t\t\t\t\t\t\t\t<IconRowInsertBottom />\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\ttitle=\"削除\"\n\t\t\t\t\t\t\t\t\tdisabled={rows.length === 1}\n\t\t\t\t\t\t\t\t\tcommand=\"--remove-row\"\n\t\t\t\t\t\t\t\t\tcommandfor={rootId}\n\t\t\t\t\t\t\t\t\tvalue={i}>\n\t\t\t\t\t\t\t\t\t<IconTrash />\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\ttitle=\"下に移動\"\n\t\t\t\t\t\t\t\t\tdisabled={i === rows.length - 1}\n\t\t\t\t\t\t\t\t\tcommand=\"--move-row-down\"\n\t\t\t\t\t\t\t\t\tcommandfor={rootId}\n\t\t\t\t\t\t\t\t\tvalue={i}>\n\t\t\t\t\t\t\t\t\t<IconArrowsTransferDown className=\"icon\" />\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t</ul>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t))}\n\t\t</div>\n\t);\n}\n",".tablist {\n\tdisplay: flex;\n\tgap: 0.5em;\n\talign-items: center;\n\tpadding-inline: var(--border-radius);\n\n\t[role='tab'] {\n\t\tposition: relative;\n\t\tborder: 1px solid var(--bge-border-color);\n\t\tborder-end-start-radius: 0;\n\t\tborder-end-end-radius: 0;\n\n\t\t&[aria-selected='true'] {\n\t\t\tborder-block-end: none;\n\n\t\t\t&::after {\n\t\t\t\tposition: absolute;\n\t\t\t\tinset-block-start: 100%;\n\t\t\t\tinset-inline-start: 50%;\n\t\t\t\tdisplay: block;\n\t\t\t\tinline-size: 1em;\n\t\t\t\tblock-size: 0.5em;\n\t\t\t\tcontent: '';\n\t\t\t\tbackground-color: var(--bge-ui-primary-color);\n\t\t\t\tclip-path: polygon(0 0, 50% 100%, 100% 0);\n\t\t\t\ttranslate: -50% 0;\n\t\t\t}\n\t\t}\n\t}\n}\n","import { useId, useRef } from 'react';\n\nimport { useCommand } from '../use-command.js';\n\nimport styles from './tabs.module.css';\n\n/**\n * Controlled tab list. Selection is lifted to the parent via\n * `current`/`onChange`; tab buttons declare a local command instead of a\n * click handler. Arrow keys move the selection. The tab panel itself is\n * rendered by the parent, which also owns its `aria-label`.\n * @param root0\n * @param root0.current\n * @param root0.onChange\n * @param root0.contentId\n * @param root0.length\n * @param root0.createLabel\n * @example\n * ```tsx\n * <Tabs current={currentIndex} onChange={setCurrentIndex} contentId=\"tab-content\" />\n * <div id=\"tab-content\" role=\"tabpanel\" aria-label={`画像${currentIndex + 1}`}>\n * \t{currentIndex === 0 ? <PcForm /> : <SpForm />}\n * </div>\n * ```\n */\nexport function Tabs({\n\tcurrent,\n\tonChange,\n\tcontentId,\n\tlength = 2,\n\tcreateLabel = (index) => `画像${index + 1}`,\n}: {\n\treadonly current: number;\n\treadonly onChange: (index: number) => void;\n\treadonly contentId: string;\n\treadonly length?: number;\n\treadonly createLabel?: (index: number) => string;\n}) {\n\tconst listId = useId();\n\tconst refs = useRef<(HTMLButtonElement | null)[]>([]);\n\n\tconst update = (index: number) => {\n\t\trefs.current[index]?.focus();\n\t\tonChange(index);\n\t};\n\n\tconst rootRef = useCommand<HTMLDivElement>({\n\t\t'--select-tab': (e) => {\n\t\t\tconst value = (e.source as HTMLButtonElement | null)?.value;\n\t\t\tupdate(Number(value));\n\t\t},\n\t});\n\n\tconst onKeyDown = (event: React.KeyboardEvent) => {\n\t\tif (event.key === 'ArrowLeft') {\n\t\t\tupdate(Math.max(0, current - 1));\n\t\t} else if (event.key === 'ArrowRight') {\n\t\t\tupdate(Math.min(length - 1, current + 1));\n\t\t}\n\t};\n\n\treturn (\n\t\t<div role=\"tablist\" ref={rootRef} id={listId} className={styles['tablist']}>\n\t\t\t{Array.from({ length }, (_, index) => (\n\t\t\t\t<button\n\t\t\t\t\tkey={index}\n\t\t\t\t\tref={(el) => {\n\t\t\t\t\t\trefs.current[index] = el;\n\t\t\t\t\t}}\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\trole=\"tab\"\n\t\t\t\t\taria-controls={contentId}\n\t\t\t\t\taria-selected={current === index}\n\t\t\t\t\ttabIndex={current === index ? 0 : -1}\n\t\t\t\t\tcommand=\"--select-tab\"\n\t\t\t\t\tcommandfor={listId}\n\t\t\t\t\tvalue={index}\n\t\t\t\t\tonKeyDown={onKeyDown}>\n\t\t\t\t\t{createLabel(index)}\n\t\t\t\t</button>\n\t\t\t))}\n\t\t</div>\n\t);\n}\n","import type { BgeWysiwygEditorElement } from '@burger-editor/custom-element';\n\nimport { use, useEffect, useEffectEvent, useRef, useState } from 'react';\n\nimport { useEngine } from '../engine-context.js';\n\ndeclare module 'react' {\n\tnamespace JSX {\n\t\tinterface IntrinsicElements {\n\t\t\t'bge-wysiwyg-editor': React.DetailedHTMLProps<\n\t\t\t\tReact.HTMLAttributes<HTMLElement>,\n\t\t\t\tHTMLElement\n\t\t\t> & {\n\t\t\t\t'item-name'?: string;\n\t\t\t\tcommands?: string;\n\t\t\t\tlabel?: string;\n\t\t\t\tname?: string;\n\t\t\t\t// プロパティとして渡す(属性ではない) — React 19はカスタム\n\t\t\t\t// 要素の既知プロパティにマッチする名前をelement[name] = value\n\t\t\t\t// で設定する\n\t\t\t\tcontentCss?: string;\n\t\t\t};\n\t\t}\n\t}\n}\n\ntype Thenable<T> = Promise<T> & {\n\tstatus?: 'fulfilled' | 'rejected';\n\tvalue?: T;\n\treason?: unknown;\n};\n\n/**\n * Wrap `promise` so a rejection resolves to `fallback` instead, without\n * breaking the `use()` cache contract (react.dev's `wrapPromise` pattern:\n * a thenable tagged with `.status`/`.value`/`.reason` lets `use()` read it\n * synchronously on the first render). `Promise.prototype.catch()` always\n * returns a fresh, untagged promise, so chaining it directly onto an\n * already-tagged thenable would silently drop that fast path. A tagged\n * `'fulfilled'` promise is returned as-is (nothing to fall back from); a\n * tagged `'rejected'` promise is converted synchronously; only a genuinely\n * untagged promise falls back to the real async `.catch()`.\n * @param promise - Source promise, optionally pre-tagged per the `use()`\n * cache contract\n * @param fallback - Value to resolve to when `promise` rejects\n */\nfunction withFallback<T>(promise: Promise<T>, fallback: T): Promise<T> {\n\tconst tagged = promise as Thenable<T>;\n\tif (tagged.status === 'fulfilled') {\n\t\treturn promise;\n\t}\n\tif (tagged.status === 'rejected') {\n\t\tconst resolved = Promise.resolve(fallback) as Thenable<T>;\n\t\tresolved.status = 'fulfilled';\n\t\tresolved.value = fallback;\n\t\treturn resolved;\n\t}\n\treturn promise.catch(() => fallback);\n}\n\n/**\n * Rich text field backed by the `<bge-wysiwyg-editor>` custom element\n * (TipTap). The element manages its own DOM; this wrapper feeds the\n * initial value and lifts edits into the editor state via the\n * `transaction` event — subscribed directly on the host element (the\n * event is dispatched with `bubbles: true` on the inner `<bge-wysiwyg>`,\n * so it reaches here without needing to query into it).\n *\n * Content CSS (so the WYSIWYG surface matches the published page's\n * styling) is fetched once per engine via `use()` — only an item whose\n * `Editor` actually renders `WysiwygField` pays for this fetch/suspend,\n * unlike hoisting it to the item-editor host for every item — and\n * passed as the `contentCss` property (React 19 sets it directly on the\n * element, replacing an imperative `el.setStyle()` call).\n * @param root0\n * @param root0.value\n * @param root0.onChange\n * @param root0.itemName\n * @param root0.commands\n * @param root0.label\n * @example\n * ```tsx\n * <WysiwygField\n * \titemName=\"wysiwyg\"\n * \tvalue={state.wysiwyg ?? ''}\n * \tonChange={(wysiwyg) => setState({ ...state, wysiwyg })}\n * />\n * ```\n */\nexport function WysiwygField({\n\tvalue,\n\tonChange,\n\titemName,\n\tcommands,\n\tlabel,\n}: {\n\treadonly value: string;\n\treadonly onChange: (value: string) => void;\n\treadonly itemName?: string;\n\treadonly commands?: string;\n\treadonly label?: string;\n}) {\n\tconst engine = useEngine();\n\t// レンダーごとに新しいPromiseを作るとuse()が「キャッシュされていない\n\t// Promise」として毎回サスペンドし直すため、このコンポーネント寿命の\n\t// 間だけ安定させる(遅延初期化のuseState)。CSS取得の失敗(ネットワーク\n\t// 不調・パス誤り等)は「見た目が多少崩れる」程度で済むべき失敗であり、\n\t// use()にrejectをそのまま投げさせるとダイアログ全体のErrorBoundaryまで\n\t// 伝播しフォーム全体が使用不能になってしまう(旧・命令的fire-and-forget\n\t// 実装からの挙動後退)ため、ここで吸収して空文字列にフォールバックする。\n\t// `.catch()`は常に新しい(タグなしの)Promiseを返すため、素朴に繋ぐと\n\t// use()キャッシュ契約(react.devのwrapPromiseパターン、.status/.value)\n\t// で既にfulfilledタグ済みのPromiseを渡された場合の同期返却パスまで\n\t// 壊してしまう — withCssFallbackはタグを見て、タグ済みならそのまま\n\t// 通し、未タグ(実運用のPromise)のときだけ実際に.catch()する\n\tconst [contentCssPromise] = useState(() =>\n\t\twithFallback(engine.getContentStylesheet(), ''),\n\t);\n\tconst contentCss = use(contentCssPromise);\n\n\tconst ref = useRef<BgeWysiwygEditorElement | null>(null);\n\tconst initialValue = useRef(value);\n\tconst onTransaction = useEffectEvent((el: BgeWysiwygEditorElement) => {\n\t\tonChange(el.value);\n\t});\n\n\t// 初期値の書き込みだけは今も命令的 — contentEditableベースのリッチ\n\t// テキストエディタをvalueで都度制御すると、入力中にカーソル位置が\n\t// 飛ぶ(Reactが明示的に警告するアンチパターン)。以降の値はTipTap\n\t// 自身が保持し、`transaction`イベント経由でこの外へ伝わる\n\tuseEffect(() => {\n\t\tconst el = ref.current;\n\t\tif (!el) {\n\t\t\treturn;\n\t\t}\n\t\t// custom element側のinnerHTMLセッターがwysiwygのvalueに転送する\n\t\tel.innerHTML = initialValue.current;\n\n\t\tconst listener = () => onTransaction(el);\n\t\tel.addEventListener('transaction', listener);\n\t\treturn () => {\n\t\t\tel.removeEventListener('transaction', listener);\n\t\t};\n\t}, []);\n\n\treturn (\n\t\t<bge-wysiwyg-editor\n\t\t\tref={(el: HTMLElement | null) => {\n\t\t\t\tref.current = el as BgeWysiwygEditorElement | null;\n\t\t\t}}\n\t\t\tcontentCss={contentCss}\n\t\t\titem-name={itemName}\n\t\t\tcommands={commands}\n\t\t\tlabel={label}\n\t\t/>\n\t);\n}\n","import { useEffect, useEffectEvent } from 'react';\n\n/**\n * Run `fn` exactly once, when the component mounts, always reading `fn`'s\n * latest closure (via `useEffectEvent`) rather than the one captured at\n * mount time.\n *\n * Exists so a mount-only effect can honestly declare `useEffect(fn, [])`\n * without an `eslint-disable-next-line react-hooks/exhaustive-deps` — that\n * suppression is also a React Compiler bailout condition for the whole\n * component containing it (see ARCHITECTURE.md's negative-knowledge note\n * on React Compiler).\n * @param fn - Called once on mount\n * @example\n * ```tsx\n * useMountEffect(() => {\n * \tfileBrowser.select(fileType, state.path ?? '', size);\n * });\n * ```\n */\nexport function useMountEffect(fn: () => void): void {\n\tconst onMount = useEffectEvent(fn);\n\tuseEffect(() => {\n\t\tonMount();\n\t}, []);\n}\n","import type { SelectedFile } from './store.js';\n\nimport { useEffect, useEffectEvent, useRef } from 'react';\n\n/**\n * React to a file becoming selected from outside the item's own `Editor`\n * (i.e. via `FileList`, in the same `FileBrowserStore` the item's own\n * `fileType` uses) — `onExternalChange` is called with the new selection.\n *\n * `selected` is shared per-engine across every item that opens onto the\n * same `fileType`, so it can still hold a *previous* item's selection at\n * the moment a new `Editor` instance mounts. This hook's first effect run\n * is always skipped for that reason — reacting to it would load that\n * stale, unrelated selection into the freshly-mounted item's own state,\n * racing the item's own mount-time `fileBrowser.select(fileType, ownPath)`\n * call (whichever one's async work — if any — finishes last wins,\n * corrupting the item with a different item's file). Callers still need\n * their own mount effect to register their own current path with the\n * store; this hook only covers reacting to *later* external changes.\n * @param selected - The `fileType`'s current selection (from\n * `useSyncExternalStore(fileBrowser.subscribe, () =>\n * fileBrowser.getSnapshot().selected[fileType])`)\n * @param getCurrentPath - Returns the item's own current path at call\n * time (a function, not a plain value, so the effect doesn't need it in\n * its dependency array and can stay `[selected]`-only)\n * @param onExternalChange - Called when `selected` changes to a path\n * different from `getCurrentPath()`, after the initial mount is skipped\n * @example\n * ```tsx\n * const selected = useSyncExternalStore(\n * \tfileBrowser.subscribe,\n * \t() => fileBrowser.getSnapshot().selected.image,\n * );\n * useExternalFileSelection(\n * \tselected,\n * \t() => state.path ?? '',\n * \t(next) => setState((prev) => ({ ...prev, path: next.path })),\n * );\n * ```\n */\nexport function useExternalFileSelection(\n\tselected: SelectedFile | undefined,\n\tgetCurrentPath: () => string,\n\tonExternalChange: (selected: SelectedFile) => void,\n): void {\n\tconst skipNextRun = useRef(true);\n\t// getCurrentPath/onExternalChangeをuseEffectEventで読むことで、依存配列を\n\t// [selected]だけの正直な形に保てる(exhaustive-depsの抑制が不要になる —\n\t// 抑制コメントの存在自体がReact Compilerの別のバイルアウト条件でもある)\n\tconst handleSelectedChange = useEffectEvent(() => {\n\t\tif (skipNextRun.current) {\n\t\t\tskipNextRun.current = false;\n\t\t\treturn;\n\t\t}\n\t\tif (!selected?.path || selected.path === getCurrentPath()) {\n\t\t\treturn;\n\t\t}\n\t\tonExternalChange(selected);\n\t});\n\n\tuseEffect(() => {\n\t\thandleSelectedChange();\n\t}, [selected]);\n}\n","import type { ReactNode } from 'react';\n\n/**\n * Controlled checkbox following the editor form markup convention\n * (`label > input + text`).\n *\n * The structure is a styling contract: `ui.css` turns\n * `label:not([for]):has(input[type='checkbox'])` into a flex row, so it\n * must be preserved.\n * @param root0\n * @param root0.label\n * @param root0.checked\n * @param root0.onChange\n * @param root0.name\n * @param root0.disabled\n * @param root0.describedBy\n * @example\n * ```tsx\n * <Checkbox\n * \tlabel={<span>横スクロール可能</span>}\n * \tname=\"bge-scrollable\"\n * \tchecked={state.scrollable ?? false}\n * \tonChange={(scrollable) => setState({ ...state, scrollable })}\n * />\n * ```\n */\nexport function Checkbox({\n\tlabel,\n\tchecked,\n\tonChange,\n\tname,\n\tdisabled,\n\tdescribedBy,\n}: {\n\treadonly label: ReactNode;\n\treadonly checked: boolean;\n\treadonly onChange: (checked: boolean) => void;\n\treadonly name?: string;\n\treadonly disabled?: boolean;\n\treadonly describedBy?: string;\n}) {\n\treturn (\n\t\t<label>\n\t\t\t<input\n\t\t\t\ttype=\"checkbox\"\n\t\t\t\tname={name}\n\t\t\t\tchecked={checked}\n\t\t\t\tdisabled={disabled}\n\t\t\t\taria-describedby={describedBy}\n\t\t\t\tonChange={(e) => onChange(e.currentTarget.checked)}\n\t\t\t/>\n\t\t\t{label}\n\t\t</label>\n\t);\n}\n","import type { ReactNode } from 'react';\n\n/**\n * Grouping fieldset following the editor form markup convention\n * (`fieldset > legend`).\n *\n * The structure is a styling contract: `ui.css` draws the group border\n * and spacing on the `fieldset` element itself, so it must be preserved.\n * @param root0\n * @param root0.legend\n * @param root0.id\n * @param root0.disabled\n * @param root0.children\n * @example\n * ```tsx\n * <Fieldset legend=\"リンク設定\" disabled={!state.useLink}>\n * \t<TextField\n * \t\tlabel=\"URL\"\n * \t\tname=\"bge-href\"\n * \t\tvalue={state.href ?? ''}\n * \t\tonChange={(href) => setState({ ...state, href })}\n * \t/>\n * </Fieldset>\n * ```\n */\nexport function Fieldset({\n\tlegend,\n\tid,\n\tdisabled,\n\tchildren,\n}: {\n\treadonly legend: string;\n\treadonly id?: string;\n\treadonly disabled?: boolean;\n\treadonly children: ReactNode;\n}) {\n\treturn (\n\t\t<fieldset id={id} disabled={disabled}>\n\t\t\t<legend>{legend}</legend>\n\t\t\t{children}\n\t\t</fieldset>\n\t);\n}\n","/**\n * Controlled numeric input following the editor form markup convention.\n *\n * The `label > span + input` structure is a styling contract: `ui.css`\n * lays out fields with structural selectors\n * (`label:not([for]) > span:has(+ input)`), so it must be preserved.\n * @param root0\n * @param root0.label\n * @param root0.value\n * @param root0.onChange\n * @param root0.name\n * @param root0.min\n * @param root0.max\n * @param root0.step\n * @param root0.disabled\n * @example\n * ```tsx\n * <NumberField\n * \tlabel=\"表示件数\"\n * \tname=\"bge-count\"\n * \tvalue={state.count ?? 1}\n * \tmin={1}\n * \tonChange={(count) => setState({ ...state, count })}\n * />\n * ```\n */\nexport function NumberField({\n\tlabel,\n\tvalue,\n\tonChange,\n\tname,\n\tmin,\n\tmax,\n\tstep,\n\tdisabled,\n}: {\n\treadonly label: string;\n\treadonly value: number;\n\treadonly onChange: (value: number) => void;\n\treadonly name?: string;\n\treadonly min?: number;\n\treadonly max?: number;\n\treadonly step?: number;\n\treadonly disabled?: boolean;\n}) {\n\treturn (\n\t\t<label>\n\t\t\t<span>{label}</span>\n\t\t\t<input\n\t\t\t\ttype=\"number\"\n\t\t\t\tname={name}\n\t\t\t\tvalue={Number.isFinite(value) ? value : ''}\n\t\t\t\tmin={min}\n\t\t\t\tmax={max}\n\t\t\t\tstep={step}\n\t\t\t\tdisabled={disabled}\n\t\t\t\tonChange={(e) => onChange(e.currentTarget.valueAsNumber)}\n\t\t\t/>\n\t\t</label>\n\t);\n}\n","import type { SelectableValue } from '@burger-editor/core';\n\nimport { useId } from 'react';\n\n/**\n * Controlled radio group following the editor form markup convention\n * (`div[role=radiogroup] > label > input + text`).\n *\n * The structure is a styling contract: `ui.css` lays out the group via\n * `[role='radiogroup'] > label` (and appends `:` to the group label), so\n * it must be preserved.\n * @param root0\n * @param root0.label\n * @param root0.value\n * @param root0.onChange\n * @param root0.options\n * @param root0.name\n * @param root0.disabled\n * @example\n * ```tsx\n * <RadioGroup\n * \tlabel=\"配置\"\n * \tname=\"bge-align\"\n * \tvalue={state.align ?? 'start'}\n * \toptions={[\n * \t\t{ value: 'start', label: '左寄せ' },\n * \t\t{ value: 'end', label: '右寄せ' },\n * \t]}\n * \tonChange={(align) => setState({ ...state, align })}\n * />\n * ```\n */\nexport function RadioGroup({\n\tlabel,\n\tvalue,\n\tonChange,\n\toptions,\n\tname,\n\tdisabled,\n}: {\n\treadonly label: string;\n\treadonly value: string;\n\treadonly onChange: (value: string) => void;\n\treadonly options: readonly SelectableValue[];\n\treadonly name?: string;\n\treadonly disabled?: boolean;\n}) {\n\tconst labelId = useId();\n\treturn (\n\t\t<div role=\"radiogroup\" aria-labelledby={labelId}>\n\t\t\t<div id={labelId}>{label}</div>\n\t\t\t{options.map((option) => (\n\t\t\t\t<label key={option.value}>\n\t\t\t\t\t<input\n\t\t\t\t\t\ttype=\"radio\"\n\t\t\t\t\t\tname={name}\n\t\t\t\t\t\tvalue={option.value}\n\t\t\t\t\t\tchecked={value === option.value}\n\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\tonChange={(e) => {\n\t\t\t\t\t\t\tif (e.currentTarget.checked) {\n\t\t\t\t\t\t\t\tonChange(option.value);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t\t{option.label}\n\t\t\t\t</label>\n\t\t\t))}\n\t\t</div>\n\t);\n}\n","import type { SelectableValue } from '@burger-editor/core';\n\n/**\n * Controlled select following the editor form markup convention\n * (`label > span + select`).\n *\n * The structure is a styling contract: `ui.css` lays out fields with\n * structural selectors (`label:not([for]) > span:has(+ select)`), so it\n * must be preserved.\n * @param root0\n * @param root0.label\n * @param root0.value\n * @param root0.onChange\n * @param root0.options\n * @param root0.name\n * @param root0.disabled\n * @example\n * ```tsx\n * <SelectField\n * \tlabel=\"種類\"\n * \tname=\"bge-kind\"\n * \tvalue={state.kind ?? 'normal'}\n * \toptions={[\n * \t\t{ value: 'normal', label: '通常' },\n * \t\t{ value: 'wide', label: 'ワイド' },\n * \t]}\n * \tonChange={(kind) => setState({ ...state, kind })}\n * />\n * ```\n */\nexport function SelectField({\n\tlabel,\n\tvalue,\n\tonChange,\n\toptions,\n\tname,\n\tdisabled,\n}: {\n\treadonly label: string;\n\treadonly value: string;\n\treadonly onChange: (value: string) => void;\n\treadonly options: readonly SelectableValue[];\n\treadonly name?: string;\n\treadonly disabled?: boolean;\n}) {\n\treturn (\n\t\t<label>\n\t\t\t<span>{label}</span>\n\t\t\t<select\n\t\t\t\tname={name}\n\t\t\t\tvalue={value}\n\t\t\t\tdisabled={disabled}\n\t\t\t\tonChange={(e) => onChange(e.currentTarget.value)}>\n\t\t\t\t{options.map((option) => (\n\t\t\t\t\t<option key={option.value} value={option.value}>\n\t\t\t\t\t\t{option.label}\n\t\t\t\t\t</option>\n\t\t\t\t))}\n\t\t\t</select>\n\t\t</label>\n\t);\n}\n","/**\n * Controlled multi-line text input following the editor form markup\n * convention.\n *\n * The `label > span + textarea` structure is a styling contract: `ui.css`\n * lays out fields with structural selectors\n * (`label:not([for]) > span:has(+ textarea)`), so it must be preserved.\n * @param root0\n * @param root0.label\n * @param root0.value\n * @param root0.onChange\n * @param root0.name\n * @param root0.rows\n * @param root0.disabled\n * @example\n * ```tsx\n * <TextArea\n * \tlabel=\"説明文\"\n * \tname=\"bge-text\"\n * \tvalue={state.text ?? ''}\n * \tonChange={(text) => setState({ ...state, text })}\n * />\n * ```\n */\nexport function TextArea({\n\tlabel,\n\tvalue,\n\tonChange,\n\tname,\n\trows,\n\tdisabled,\n}: {\n\treadonly label: string;\n\treadonly value: string;\n\treadonly onChange: (value: string) => void;\n\treadonly name?: string;\n\treadonly rows?: number;\n\treadonly disabled?: boolean;\n}) {\n\treturn (\n\t\t<label>\n\t\t\t<span>{label}</span>\n\t\t\t<textarea\n\t\t\t\tname={name}\n\t\t\t\tvalue={value}\n\t\t\t\trows={rows}\n\t\t\t\tdisabled={disabled}\n\t\t\t\tonChange={(e) => onChange(e.currentTarget.value)}\n\t\t\t/>\n\t\t</label>\n\t);\n}\n","/**\n * Controlled single-line text input following the editor form markup\n * convention (`label > span + input`).\n *\n * The structure is a styling contract: `ui.css` lays out fields with\n * structural selectors (`label:not([for]) > span:has(+ input)`) instead\n * of `for`/`id` wiring, so it must be preserved.\n * @param root0\n * @param root0.label\n * @param root0.value\n * @param root0.onChange\n * @param root0.type\n * @param root0.name\n * @param root0.disabled\n * @param root0.placeholder\n * @param root0.describedBy\n * @example\n * ```tsx\n * <TextField\n * \tlabel=\"URL\"\n * \tname=\"bge-link\"\n * \tvalue={state.href ?? ''}\n * \tonChange={(href) => setState({ ...state, href })}\n * />\n * ```\n */\nexport function TextField({\n\tlabel,\n\tvalue,\n\tonChange,\n\ttype = 'text',\n\tname,\n\tdisabled,\n\tplaceholder,\n\tdescribedBy,\n}: {\n\treadonly label: string;\n\treadonly value: string;\n\treadonly onChange: (value: string) => void;\n\treadonly type?: 'text' | 'url' | 'email';\n\treadonly name?: string;\n\treadonly disabled?: boolean;\n\treadonly placeholder?: string;\n\treadonly describedBy?: string;\n}) {\n\treturn (\n\t\t<label>\n\t\t\t<span>{label}</span>\n\t\t\t<input\n\t\t\t\ttype={type}\n\t\t\t\tname={name}\n\t\t\t\tvalue={value}\n\t\t\t\tdisabled={disabled}\n\t\t\t\tplaceholder={placeholder}\n\t\t\t\taria-describedby={describedBy}\n\t\t\t\tonChange={(e) => onChange(e.currentTarget.value)}\n\t\t\t/>\n\t\t</label>\n\t);\n}\n"],"ignoreList":[0,1,2,3,4,5,6,7],"mappings":";;;;;;;;;;;;AAUA,IAAM,yBAAyB,qBAAqB,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