@embedpdf/viewer-chrome 3.0.0-next.15 → 3.0.0-next.16
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.
- package/dist/{annotation-fonts-BqoLZ4Mp.js → annotation-fonts-DWjVOTP0.js} +2 -2
- package/dist/{annotation-fonts-BqoLZ4Mp.js.map → annotation-fonts-DWjVOTP0.js.map} +1 -1
- package/dist/{annotation-fonts-Dt0IQXhz.cjs → annotation-fonts-dpfVkhnq.cjs} +2 -2
- package/dist/{annotation-fonts-Dt0IQXhz.cjs.map → annotation-fonts-dpfVkhnq.cjs.map} +1 -1
- package/dist/{annotation-style-Bzvvp8-N.cjs → annotation-style-B3XKAyZ-.cjs} +3 -3
- package/dist/{annotation-style-Bzvvp8-N.cjs.map → annotation-style-B3XKAyZ-.cjs.map} +1 -1
- package/dist/{annotation-style--rPIZsuP.js → annotation-style-CXF3X47Z.js} +3 -3
- package/dist/{annotation-style--rPIZsuP.js.map → annotation-style-CXF3X47Z.js.map} +1 -1
- package/dist/{ar-DnEj5vbP.cjs → ar-B132r9bo.cjs} +93 -1
- package/dist/ar-B132r9bo.cjs.map +1 -0
- package/dist/{ar-D9XKAmDx.js → ar-BLWFJoA_.js} +93 -1
- package/dist/ar-BLWFJoA_.js.map +1 -0
- package/dist/attachments-panel-Cxln8xos.cjs +217 -0
- package/dist/attachments-panel-Cxln8xos.cjs.map +1 -0
- package/dist/attachments-panel-H1ucRbwo.js +217 -0
- package/dist/attachments-panel-H1ucRbwo.js.map +1 -0
- package/dist/chrome.cjs +21 -0
- package/dist/chrome.cjs.map +1 -1
- package/dist/chrome.js +21 -0
- package/dist/chrome.js.map +1 -1
- package/dist/{commands-BmgxhJ8B.js → commands-BkgLP3Om.js} +418 -23
- package/dist/commands-BkgLP3Om.js.map +1 -0
- package/dist/{commands-CYt4SFUX.cjs → commands-DL1gjZt7.cjs} +433 -20
- package/dist/commands-DL1gjZt7.cjs.map +1 -0
- package/dist/commands.cjs +2 -1
- package/dist/commands.d.cts +3 -1
- package/dist/commands.d.ts +3 -1
- package/dist/commands.js +2 -2
- package/dist/{comments-panel-pEcQg4Vs.cjs → comments-panel-BsnWedTh.cjs} +2 -2
- package/dist/{comments-panel-pEcQg4Vs.cjs.map → comments-panel-BsnWedTh.cjs.map} +1 -1
- package/dist/{comments-panel-MUVgLCBI.js → comments-panel-D7Eadws9.js} +2 -2
- package/dist/{comments-panel-MUVgLCBI.js.map → comments-panel-D7Eadws9.js.map} +1 -1
- package/dist/{de-Dv6zvbnd.cjs → de-7_MvFWzN.cjs} +93 -1
- package/dist/de-7_MvFWzN.cjs.map +1 -0
- package/dist/{de-Bdr4aWzm.js → de-BUhwc9-x.js} +93 -1
- package/dist/de-BUhwc9-x.js.map +1 -0
- package/dist/{dialog-B5GBisKv.js → dialog-BIb373cg.js} +3 -3
- package/dist/dialog-BIb373cg.js.map +1 -0
- package/dist/{dialog-t8F13BL_.cjs → dialog-CngKTnAM.cjs} +3 -3
- package/dist/dialog-CngKTnAM.cjs.map +1 -0
- package/dist/{es-BP09DR9w.cjs → es-DgYj-1L3.cjs} +93 -1
- package/dist/es-DgYj-1L3.cjs.map +1 -0
- package/dist/{es-BSXz5tBv.js → es-DoXTqFoO.js} +93 -1
- package/dist/es-DoXTqFoO.js.map +1 -0
- package/dist/{form-design-panel-vWWU9uB-.js → form-design-panel-CgV_5YWC.js} +3 -3
- package/dist/{form-design-panel-vWWU9uB-.js.map → form-design-panel-CgV_5YWC.js.map} +1 -1
- package/dist/{form-design-panel-B5MXTZ96.cjs → form-design-panel-D0FdmWXW.cjs} +3 -3
- package/dist/{form-design-panel-B5MXTZ96.cjs.map → form-design-panel-D0FdmWXW.cjs.map} +1 -1
- package/dist/{fr-Ckn3K9v1.js → fr-B-8NDhBA.js} +93 -1
- package/dist/fr-B-8NDhBA.js.map +1 -0
- package/dist/{fr-BBQQn7tJ.cjs → fr-C856dmQJ.cjs} +93 -1
- package/dist/fr-C856dmQJ.cjs.map +1 -0
- package/dist/{he-DRsG7bH7.cjs → he-BFTeNc4t.cjs} +93 -1
- package/dist/he-BFTeNc4t.cjs.map +1 -0
- package/dist/{he-wdGU5PkU.js → he-Dlh0fNXM.js} +93 -1
- package/dist/he-Dlh0fNXM.js.map +1 -0
- package/dist/{icons-x0Tc05bs.cjs → icons-1UfLUZ_y.cjs} +20 -1
- package/dist/icons-1UfLUZ_y.cjs.map +1 -0
- package/dist/{icons-BrK5iVL8.js → icons-7dB0Y1ct.js} +20 -1
- package/dist/icons-7dB0Y1ct.js.map +1 -0
- package/dist/index.cjs +740 -171
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -2
- package/dist/index.d.ts +16 -2
- package/dist/index.js +727 -170
- package/dist/index.js.map +1 -1
- package/dist/{it-BuP4o0xQ.cjs → it-Bef-2Yxq.cjs} +93 -1
- package/dist/it-Bef-2Yxq.cjs.map +1 -0
- package/dist/{it-Us-VmvIu.js → it-BkirG7ol.js} +93 -1
- package/dist/it-BkirG7ol.js.map +1 -0
- package/dist/{ja-Cizj0-5O.js → ja-CGEjCE-s.js} +93 -1
- package/dist/ja-CGEjCE-s.js.map +1 -0
- package/dist/{ja-DovEd6ts.cjs → ja-DNw2zqSD.cjs} +93 -1
- package/dist/ja-DNw2zqSD.cjs.map +1 -0
- package/dist/{ko-DlrXliE1.js → ko-CTkl5vMh.js} +93 -1
- package/dist/ko-CTkl5vMh.js.map +1 -0
- package/dist/{ko-B-qJEol2.cjs → ko-YHzeBqP6.cjs} +93 -1
- package/dist/ko-YHzeBqP6.cjs.map +1 -0
- package/dist/{link-editor-CSjqPnj1.cjs → link-editor-CAS7MZM2.cjs} +2 -2
- package/dist/{link-editor-CSjqPnj1.cjs.map → link-editor-CAS7MZM2.cjs.map} +1 -1
- package/dist/{link-editor-SxM1nnJU.js → link-editor-CkwtqRvb.js} +2 -2
- package/dist/{link-editor-SxM1nnJU.js.map → link-editor-CkwtqRvb.js.map} +1 -1
- package/dist/{measurement-Bs61XWbJ.js → measurement-CQdbnIrn.js} +2 -2
- package/dist/{measurement-Bs61XWbJ.js.map → measurement-CQdbnIrn.js.map} +1 -1
- package/dist/{measurement-CcCsHPOX.cjs → measurement-Cxv1Ahxx.cjs} +2 -2
- package/dist/{measurement-CcCsHPOX.cjs.map → measurement-Cxv1Ahxx.cjs.map} +1 -1
- package/dist/{nl-D3KZDDiJ.cjs → nl-BjkbaLq3.cjs} +93 -1
- package/dist/nl-BjkbaLq3.cjs.map +1 -0
- package/dist/{nl-0aF7M_0h.js → nl-Dya4sR8_.js} +93 -1
- package/dist/nl-Dya4sR8_.js.map +1 -0
- package/dist/outline-panel-BpGtBdj0.cjs +707 -0
- package/dist/outline-panel-BpGtBdj0.cjs.map +1 -0
- package/dist/outline-panel-DO5_REYw.js +707 -0
- package/dist/outline-panel-DO5_REYw.js.map +1 -0
- package/dist/outline-properties-BCa2cc0t.js +330 -0
- package/dist/outline-properties-BCa2cc0t.js.map +1 -0
- package/dist/outline-properties-DT3FIxCw.cjs +330 -0
- package/dist/outline-properties-DT3FIxCw.cjs.map +1 -0
- package/dist/{pl-DSFhAUqx.cjs → pl-CKKdVnpZ.cjs} +93 -1
- package/dist/pl-CKKdVnpZ.cjs.map +1 -0
- package/dist/{pl-BW--AaCI.js → pl-DA9b5NVg.js} +93 -1
- package/dist/pl-DA9b5NVg.js.map +1 -0
- package/dist/print-dialog-BqIrHCBh.cjs +276 -0
- package/dist/print-dialog-BqIrHCBh.cjs.map +1 -0
- package/dist/print-dialog-DvcI2m2_.js +276 -0
- package/dist/print-dialog-DvcI2m2_.js.map +1 -0
- package/dist/{pt-C5S-8MC5.cjs → pt-DLcszlzi.cjs} +93 -1
- package/dist/pt-DLcszlzi.cjs.map +1 -0
- package/dist/{pt-DIhpU5pT.js → pt-Nm8yyjbX.js} +93 -1
- package/dist/pt-Nm8yyjbX.js.map +1 -0
- package/dist/{redact-confirm-CX_SY2ZN.cjs → redact-confirm-C6EiK8yN.cjs} +2 -2
- package/dist/{redact-confirm-CX_SY2ZN.cjs.map → redact-confirm-C6EiK8yN.cjs.map} +1 -1
- package/dist/{redact-confirm-B6j36TPw.js → redact-confirm-CKuv9iN_.js} +2 -2
- package/dist/{redact-confirm-B6j36TPw.js.map → redact-confirm-CKuv9iN_.js.map} +1 -1
- package/dist/{redaction-panel-IJDshSJI.js → redaction-panel-CgNZ-pQk.js} +2 -2
- package/dist/{redaction-panel-IJDshSJI.js.map → redaction-panel-CgNZ-pQk.js.map} +1 -1
- package/dist/{redaction-panel-BmoIl-Ll.cjs → redaction-panel-ZhX0dlMi.cjs} +2 -2
- package/dist/{redaction-panel-BmoIl-Ll.cjs.map → redaction-panel-ZhX0dlMi.cjs.map} +1 -1
- package/dist/{search-panel-HfIhJm1M.js → search-panel-BE4xzWlm.js} +4 -4
- package/dist/{search-panel-HfIhJm1M.js.map → search-panel-BE4xzWlm.js.map} +1 -1
- package/dist/{search-panel-s9IoiOtv.cjs → search-panel-wcbTNG1z.cjs} +4 -4
- package/dist/{search-panel-s9IoiOtv.cjs.map → search-panel-wcbTNG1z.cjs.map} +1 -1
- package/dist/{sheet-BDsa_Sup.cjs → sheet-DTBFiwde.cjs} +30 -11
- package/dist/sheet-DTBFiwde.cjs.map +1 -0
- package/dist/{sheet-R6XDgyEf.js → sheet-DyjKfAq0.js} +25 -12
- package/dist/sheet-DyjKfAq0.js.map +1 -0
- package/dist/{sign-dialog-CgnR7akj.cjs → sign-dialog-D5WGx-Yn.cjs} +2 -2
- package/dist/{sign-dialog-CgnR7akj.cjs.map → sign-dialog-D5WGx-Yn.cjs.map} +1 -1
- package/dist/{sign-dialog-GDqCoQhA.js → sign-dialog-DerNe8qT.js} +2 -2
- package/dist/{sign-dialog-GDqCoQhA.js.map → sign-dialog-DerNe8qT.js.map} +1 -1
- package/dist/{signature-inspector-DyO313Qf.cjs → signature-inspector-Bz6TAfZM.cjs} +4 -10
- package/dist/signature-inspector-Bz6TAfZM.cjs.map +1 -0
- package/dist/{signature-inspector-okFz8do6.js → signature-inspector-CsGr9EBk.js} +4 -10
- package/dist/signature-inspector-CsGr9EBk.js.map +1 -0
- package/dist/{signature-maker-BoYa8vgA.cjs → signature-maker-D_YfBXLn.cjs} +3 -3
- package/dist/{signature-maker-BoYa8vgA.cjs.map → signature-maker-D_YfBXLn.cjs.map} +1 -1
- package/dist/{signature-maker-BhCmYyHD.js → signature-maker-Dnth4rV4.js} +3 -3
- package/dist/{signature-maker-BhCmYyHD.js.map → signature-maker-Dnth4rV4.js.map} +1 -1
- package/dist/{signatures-panel-B56PC6d9.cjs → signatures-panel-Ci_LaI1C.cjs} +4 -10
- package/dist/signatures-panel-Ci_LaI1C.cjs.map +1 -0
- package/dist/{signatures-panel-CgnFfhFm.js → signatures-panel-DZ9ywrjz.js} +4 -10
- package/dist/signatures-panel-DZ9ywrjz.js.map +1 -0
- package/dist/{stamps-panel-CDO0FPyK.js → stamps-panel-BrczStaz.js} +4 -10
- package/dist/stamps-panel-BrczStaz.js.map +1 -0
- package/dist/{stamps-panel-B9NYGayn.cjs → stamps-panel-Cv9nJBwx.cjs} +4 -10
- package/dist/stamps-panel-Cv9nJBwx.cjs.map +1 -0
- package/dist/theme-Be0OZokZ.js +97 -0
- package/dist/theme-Be0OZokZ.js.map +1 -0
- package/dist/theme-FR26JI3r.cjs +126 -0
- package/dist/theme-FR26JI3r.cjs.map +1 -0
- package/dist/{toolbar-z9od3tKl.js → toolbar-DF361xWY.js} +7 -6
- package/dist/toolbar-DF361xWY.js.map +1 -0
- package/dist/{toolbar-CJu2wKTU.cjs → toolbar-ddvpsvTb.cjs} +7 -6
- package/dist/toolbar-ddvpsvTb.cjs.map +1 -0
- package/dist/{zh-cn-CxkUUBct.js → zh-cn-BMPPkLpL.js} +93 -1
- package/dist/zh-cn-BMPPkLpL.js.map +1 -0
- package/dist/{zh-cn-3tmMeHqv.cjs → zh-cn-CZOO3p4H.cjs} +93 -1
- package/dist/zh-cn-CZOO3p4H.cjs.map +1 -0
- package/package.json +4 -4
- package/src/styles.css +8 -0
- package/dist/ar-D9XKAmDx.js.map +0 -1
- package/dist/ar-DnEj5vbP.cjs.map +0 -1
- package/dist/commands-BmgxhJ8B.js.map +0 -1
- package/dist/commands-CYt4SFUX.cjs.map +0 -1
- package/dist/de-Bdr4aWzm.js.map +0 -1
- package/dist/de-Dv6zvbnd.cjs.map +0 -1
- package/dist/dialog-B5GBisKv.js.map +0 -1
- package/dist/dialog-t8F13BL_.cjs.map +0 -1
- package/dist/es-BP09DR9w.cjs.map +0 -1
- package/dist/es-BSXz5tBv.js.map +0 -1
- package/dist/fr-BBQQn7tJ.cjs.map +0 -1
- package/dist/fr-Ckn3K9v1.js.map +0 -1
- package/dist/he-DRsG7bH7.cjs.map +0 -1
- package/dist/he-wdGU5PkU.js.map +0 -1
- package/dist/icons-BrK5iVL8.js.map +0 -1
- package/dist/icons-x0Tc05bs.cjs.map +0 -1
- package/dist/it-BuP4o0xQ.cjs.map +0 -1
- package/dist/it-Us-VmvIu.js.map +0 -1
- package/dist/ja-Cizj0-5O.js.map +0 -1
- package/dist/ja-DovEd6ts.cjs.map +0 -1
- package/dist/ko-B-qJEol2.cjs.map +0 -1
- package/dist/ko-DlrXliE1.js.map +0 -1
- package/dist/nl-0aF7M_0h.js.map +0 -1
- package/dist/nl-D3KZDDiJ.cjs.map +0 -1
- package/dist/pl-BW--AaCI.js.map +0 -1
- package/dist/pl-DSFhAUqx.cjs.map +0 -1
- package/dist/pt-C5S-8MC5.cjs.map +0 -1
- package/dist/pt-DIhpU5pT.js.map +0 -1
- package/dist/sheet-BDsa_Sup.cjs.map +0 -1
- package/dist/sheet-R6XDgyEf.js.map +0 -1
- package/dist/signature-inspector-DyO313Qf.cjs.map +0 -1
- package/dist/signature-inspector-okFz8do6.js.map +0 -1
- package/dist/signatures-panel-B56PC6d9.cjs.map +0 -1
- package/dist/signatures-panel-CgnFfhFm.js.map +0 -1
- package/dist/stamps-panel-B9NYGayn.cjs.map +0 -1
- package/dist/stamps-panel-CDO0FPyK.js.map +0 -1
- package/dist/toolbar-CJu2wKTU.cjs.map +0 -1
- package/dist/toolbar-z9od3tKl.js.map +0 -1
- package/dist/zh-cn-3tmMeHqv.cjs.map +0 -1
- package/dist/zh-cn-CxkUUBct.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands-BkgLP3Om.js","names":["selectedOf","EDITS","PDF_TYPE","selectedOf","hasSelection"],"sources":["../src/config/attachments.ts","../src/config/modes.ts","../src/config/open-files.ts","../src/config/outline.ts","../src/config/page-commands.ts","../src/config/commands.ts"],"sourcesContent":["/**\n * The attachment commands, for the attachments panel (its header, each file's menu) and the\n * strip over a selected file attachment annotation. The panel's commands act on the selected\n * file (`attachment.getSelected()`); the panel selects a file before it opens that file's menu.\n * Adding and deleting need `doc.attachments.modify` (a page's file: the annotation plugin's\n * `canDelete()`) and the `attachments.adding` feature. Saving takes a file out of the document,\n * so it goes with `documents.download` and needs `doc.download`: `readOnly` keeps it.\n */\nimport { AnnotationToken, annotationKey } from '@embedpdf/react/annotation';\nimport {\n AttachmentToken,\n type AttachedFile,\n type AttachmentCapability,\n} from '@embedpdf/react/attachment';\nimport type { CommandDef } from '@embedpdf/react/commands';\nimport { ShellToken } from '@embedpdf/react/shell';\nimport { pickFile, saveFile } from '@embedpdf/web';\n\ntype Ctx = Parameters<NonNullable<CommandDef['run']>>[0];\n\n/** The attachments panel's id in the layout. */\nexport const ATTACHMENTS_PANEL = 'attachments';\n/** The menu of a file in the attachments panel: the commands below, for that file. */\nexport const ATTACHMENT_ITEM_MENU = 'attachment-item';\n\n/** What `attachment:add` takes instead of asking: the files to attach (a drop's). */\nexport interface AttachmentAddArgs {\n readonly files?: readonly File[];\n}\n\nconst attachmentOf = (commandContext: Ctx): AttachmentCapability | null =>\n commandContext.tryGet(AttachmentToken);\n\n/** The first selected file. */\nconst selectedOf = (commandContext: Ctx): AttachedFile | null =>\n attachmentOf(commandContext)?.getSelected()[0] ?? null;\n\n/** Save a file as the browser saves a download, under its cleaned name. */\nexport async function saveAttachedFile(\n attachment: AttachmentCapability,\n file: AttachedFile,\n): Promise<void> {\n const { bytes, name, mimeType } = await attachment.download(file);\n saveFile(bytes, name, mimeType ?? undefined);\n}\n\n/** The one file attachment annotation selected on the pages, or null. */\nconst selectedAnnotationFile = (commandContext: Ctx): AttachedFile | null => {\n const selection = commandContext.tryGet(AnnotationToken)?.selection.list() ?? [];\n const [only] = selection;\n if (selection.length !== 1 || only?.subtype !== 'file-attachment') return null;\n const key = annotationKey(only.ref);\n const files = attachmentOf(commandContext)?.list() ?? [];\n return (\n files.find((file) => file.home.kind === 'page' && annotationKey(file.home.ref) === key) ?? null\n );\n};\n\n/** Saving: the right to take files out, and the feature on. */\nconst SAVES = {\n categories: ['documents.download'],\n allowed: (commandContext: Ctx) => attachmentOf(commandContext)?.canDownload() ?? true,\n notAllowedKey: 'commands.notAllowed.doc-download',\n} satisfies Partial<CommandDef>;\n\n/** Adding and deleting: the right to, and the feature on. */\nconst EDITS = {\n categories: ['attachments.adding'],\n allowed: (commandContext: Ctx) => attachmentOf(commandContext)?.canAdd() ?? true,\n notAllowedKey: 'commands.notAllowed.doc-attachments-modify',\n} satisfies Partial<CommandDef>;\n\nexport const attachmentCommands: CommandDef[] = [\n {\n // Acrobat's Add File, in its Attachments panel.\n id: 'attachment:add',\n labelKey: 'commands.attachment.add',\n icon: 'plus',\n ...EDITS,\n run: async (commandContext) => {\n const attachment = attachmentOf(commandContext);\n if (!attachment) return;\n const given = (commandContext.args as AttachmentAddArgs | undefined)?.files;\n const files = given ?? [await pickFile()].filter((file): file is File => file !== null);\n if (files.length === 0) return;\n commandContext.tryGet(ShellToken)?.open(ATTACHMENTS_PANEL);\n await attachment.add(files.map((data) => ({ data })));\n },\n },\n {\n id: 'attachment:save',\n labelKey: 'commands.attachment.save',\n icon: 'download',\n ...SAVES,\n enabled: (commandContext) => selectedOf(commandContext) !== null,\n run: async (commandContext) => {\n const attachment = attachmentOf(commandContext);\n const file = selectedOf(commandContext);\n if (attachment && file) await saveAttachedFile(attachment, file);\n },\n },\n {\n id: 'attachment:go-to',\n labelKey: 'commands.attachment.goTo',\n // No feature: going to a file is reading the document.\n visible: (commandContext) => selectedOf(commandContext)?.home.kind === 'page',\n run: (commandContext) => {\n const file = selectedOf(commandContext);\n if (file) attachmentOf(commandContext)?.reveal(file);\n },\n },\n {\n id: 'attachment:delete',\n labelKey: 'commands.attachment.delete',\n icon: 'trash',\n ...EDITS,\n allowed: (commandContext) => {\n const attachment = attachmentOf(commandContext);\n const file = selectedOf(commandContext);\n if (!attachment) return true;\n return file ? attachment.canRemove(file) : attachment.canAdd();\n },\n enabled: (commandContext) => selectedOf(commandContext) !== null,\n run: async (commandContext) => {\n const attachment = attachmentOf(commandContext);\n const file = selectedOf(commandContext);\n if (attachment && file) await attachment.remove(file);\n },\n },\n // A file's menu, opened from its row's own button or by a right-click on it.\n {\n id: 'menu:attachment-item',\n labelKey: 'commands.attachment.more',\n icon: 'dots',\n menu: ATTACHMENT_ITEM_MENU,\n categories: ['attachments'],\n },\n // Over a selected file attachment annotation: its file, saved as the panel saves it.\n {\n id: 'annotation:save-file',\n labelKey: 'commands.annotate.saveFile',\n icon: 'download',\n ...SAVES,\n visible: (commandContext) => selectedAnnotationFile(commandContext) !== null,\n run: async (commandContext) => {\n const attachment = attachmentOf(commandContext);\n const file = selectedAnnotationFile(commandContext);\n if (attachment && file) await saveAttachedFile(attachment, file);\n },\n },\n];\n","/**\n * The modes a layout brings. A mode is an exclusive shell surface tagged\n * `'mode'` (`mode:<mode>`); the bars with that `mode` show while it is open.\n * The built-in modes have commands of their own (config/commands.ts); a bar\n * with a new mode gets one here, titled by the bar's title.\n */\nimport type { LayoutData } from '@embedpdf/core-ui';\nimport { barsInMode, modeCommandOf, modesOf } from '@embedpdf/core-ui';\nimport type { CommandDef } from '@embedpdf/react/commands';\nimport { InteractionToken } from '@embedpdf/react/interaction';\nimport { ShellToken, type ShellCapability } from '@embedpdf/react/shell';\n\n/** The exclusivity tag every mode surface opens with. */\nexport const MODE_TAG = 'mode';\n\n/** The open mode's surface (`mode:<mode>`), or `null` while viewing. */\nexport function openModeSurfaceOf(shell: ShellCapability): string | null {\n return shell.listOpenSurfaces().find((surface) => surface.exclusive === MODE_TAG)?.id ?? null;\n}\n\n/** A mode, and the title of its first bar that has one. */\nexport interface ModeSpec {\n readonly mode: string;\n readonly title?: string;\n readonly titleKey?: string;\n}\n\n/** The layout's modes, in bar order, each titled by its first bar with a title. */\nexport function modeSpecsOf(data: LayoutData): ModeSpec[] {\n return modesOf(data).map((mode) => {\n const titled = barsInMode(data, mode)\n .map((barId) => data.bars![barId]!)\n .find((bar) => bar.title !== undefined || bar.titleKey !== undefined);\n return { mode, title: titled?.title, titleKey: titled?.titleKey };\n });\n}\n\n/** Whether two lists of modes are the same, title for title. */\nexport const sameModeSpecs = (left: readonly ModeSpec[], right: readonly ModeSpec[]): boolean =>\n left.length === right.length &&\n left.every(\n (spec, i) =>\n spec.mode === right[i]!.mode &&\n spec.title === right[i]!.title &&\n spec.titleKey === right[i]!.titleKey,\n );\n\n/**\n * A command for each mode that has none yet (`isTaken` says which ids do): it opens the mode,\n * or closes it when it is open, and shows the default pointer. Without a title, its tab reads\n * the mode's own name.\n */\nexport function modeCommandsFor(\n specs: readonly ModeSpec[],\n isTaken: (id: string) => boolean,\n): CommandDef[] {\n return specs\n .filter((spec) => !isTaken(modeCommandOf(spec.mode)))\n .map((spec) => {\n const id = modeCommandOf(spec.mode);\n return {\n id,\n label: spec.title ?? (spec.titleKey === undefined ? spec.mode : undefined),\n labelKey: spec.titleKey,\n run: (commandContext) => {\n const shell = commandContext.tryGet(ShellToken);\n shell?.toggle(id, { exclusive: MODE_TAG });\n commandContext.tryGet(InteractionToken)?.activateTool('pointer');\n },\n active: (commandContext) => commandContext.tryGet(ShellToken)?.isOpen(id) ?? false,\n };\n });\n}\n","/**\n * Opening a file from the user's computer: the `document:open` command, behind the document\n * menu's Open row and a PDF dropped on the viewer (`ui/drop-to-open.tsx`). It's there only while\n * the engine opens files (`documents.canOpenFiles()`), so a viewer on the cloud engine never\n * offers it, and turning off `documents.open` turns off both ways.\n */\nimport type { CommandDef } from '@embedpdf/react/commands';\nimport { DocumentsToken, type DocumentsCapability, type OpenInput } from '@embedpdf/react/runtime';\nimport { pickFile } from '@embedpdf/web';\n\nexport const OPEN_COMMAND_ID = 'document:open';\n\nconst PDF_TYPE = 'application/pdf';\n\n/** What `document:open` takes to open the files it's given, a drop's, instead of asking for one. */\nexport interface OpenFilesArgs {\n readonly files: readonly File[];\n}\n\n/** Whether a file is a PDF, by its type or, where the system gives it none, its name. */\nexport const isPdfFile = (file: File): boolean =>\n file.type === PDF_TYPE || /\\.pdf$/i.test(file.name);\n\n/**\n * Whether a drag may bring a PDF: it carries files, and one of them is a PDF or of a type the\n * browser doesn't know. Text, links and anything dragged inside the page carry no files; where\n * the browser doesn't list the files while dragging, they may be PDFs.\n */\nexport function mayCarryPdf(transfer: DataTransfer | null): boolean {\n if (!transfer || !Array.from(transfer.types).includes('Files')) return false;\n const files = Array.from(transfer.items ?? []).filter((item) => item.kind === 'file');\n return files.length === 0 || files.some((item) => item.type === PDF_TYPE || item.type === '');\n}\n\nconst givenFilesOf = (args: unknown): readonly File[] | null => {\n const files = (args as Partial<OpenFilesArgs> | undefined)?.files;\n return Array.isArray(files) ? files : null;\n};\n\n/** The file the user picks in the file dialog, as a list: empty when they close it. */\nconst pickedFiles = (): Promise<readonly File[]> =>\n pickFile({ accept: `.pdf,${PDF_TYPE}` }).then((file) => (file ? [file] : []));\n\n/**\n * Open each file as a new tab, the first one shown. Its tab is there at once, named like a `src`\n * file's (its name without `.pdf`), while the file is read; one that can't be opened says why\n * in its tab.\n */\nfunction openFiles(documents: DocumentsCapability, files: readonly File[]): void {\n documents.openAll(\n files.map((file) => ({\n name: file.name.replace(/\\.pdf$/i, '') || file.name,\n source: async (): Promise<OpenInput> => ({\n kind: 'bytes',\n bytes: new Uint8Array(await file.arrayBuffer()),\n }),\n })),\n );\n}\n\nexport const openFileCommand: CommandDef = {\n id: OPEN_COMMAND_ID,\n labelKey: 'commands.open',\n icon: 'fileImport',\n // The key reaches the viewer only while focus is inside it: elsewhere it's the page's own.\n shortcut: 'Mod+O',\n categories: ['documents.open'],\n // Where the engine opens only the documents a server holds, there is no Open, and its key\n // keeps the browser's own meaning.\n visible: (commandContext) => commandContext.tryGet(DocumentsToken)?.canOpenFiles() ?? false,\n run: async (commandContext) => {\n const documents = commandContext.tryGet(DocumentsToken);\n if (!documents) return;\n // The dialog opens before anything is awaited: a browser opens it only inside the click or\n // key that asked for it.\n const files = givenFilesOf(commandContext.args) ?? (await pickedFiles());\n openFiles(documents, files);\n },\n};\n","/**\n * The outline's commands, for the outline panel's buttons, its row menu and shortcuts. They act\n * on the selected items (`outline.getSelected()`); the panel selects a row before it opens the\n * row's menu. Changing the outline needs `doc.outline.modify` (`outline.canEdit()`) and the\n * `outline.editing` feature; expanding and collapsing changes only the view.\n */\nimport type { CommandDef } from '@embedpdf/react/commands';\nimport {\n OutlineToken,\n type OutlineCapability,\n type OutlineItem,\n type OutlineItemInput,\n} from '@embedpdf/react/outline';\nimport { ShellToken } from '@embedpdf/react/shell';\n\ntype Ctx = Parameters<NonNullable<CommandDef['run']>>[0];\n\n/** The outline panel's id in the layout. */\nexport const OUTLINE_PANEL = 'outline';\n/**\n * A request to rename an item in its row: the selected one, once it isn't the item `after`\n * names (an add selects the item it makes). The panel takes the request and closes it.\n */\nexport const OUTLINE_RENAME = 'outline-rename';\n/** The dialog that edits one item's title, look, target and open state (`props.item`). */\nexport const OUTLINE_PROPERTIES_DIALOG = 'outline-properties';\n/** The menu of a row of the outline: the commands below, for that row. */\nexport const OUTLINE_ITEM_MENU = 'outline-item';\n\nconst outlineOf = (commandContext: Ctx): OutlineCapability | null =>\n commandContext.tryGet(OutlineToken);\n\n/** The first selected item, as the outline holds it. */\nconst selectedOf = (commandContext: Ctx): OutlineItem | null => {\n const outline = outlineOf(commandContext);\n const [ref] = outline?.getSelected() ?? [];\n return ref ? (outline?.get(ref) ?? null) : null;\n};\n\nconst hasSelection = (commandContext: Ctx): boolean => selectedOf(commandContext) !== null;\n\n/** What a command that changes the outline needs: the right to, and the feature on. */\nconst EDITS = {\n categories: ['outline.editing'],\n allowed: (commandContext: Ctx) => outlineOf(commandContext)?.canEdit() ?? true,\n notAllowedKey: 'commands.notAllowed.doc-outline-modify',\n} satisfies Partial<CommandDef>;\n\n/**\n * Add an item and rename it in its row, as Acrobat's New Bookmark does: it goes to where the\n * view is, after the selected item, or at the end of the outline when none is selected.\n */\nasync function addItem(\n commandContext: Ctx,\n input: (selected: OutlineItem | null) => OutlineItemInput,\n) {\n const outline = outlineOf(commandContext);\n if (!outline) return;\n const shell = commandContext.tryGet(ShellToken);\n const selected = selectedOf(commandContext);\n shell?.open(OUTLINE_PANEL);\n shell?.open(OUTLINE_RENAME, { props: { after: selected?.ref.objectNumber ?? null } });\n try {\n await outline.create(input(selected), { select: true });\n } catch (error) {\n shell?.close(OUTLINE_RENAME);\n throw error;\n }\n}\n\nexport const outlineCommands: CommandDef[] = [\n {\n id: 'outline:add',\n labelKey: 'commands.outline.add',\n icon: 'plus',\n // Acrobat's New Bookmark.\n shortcut: 'Mod+B',\n ...EDITS,\n run: (commandContext) =>\n addItem(commandContext, (selected) =>\n selected ? { parent: selected.parent, position: { after: selected.ref } } : {},\n ),\n },\n {\n id: 'outline:add-child',\n labelKey: 'commands.outline.addChild',\n ...EDITS,\n enabled: hasSelection,\n run: (commandContext) =>\n addItem(commandContext, (selected) => (selected ? { parent: selected.ref } : {})),\n },\n {\n id: 'outline:rename',\n labelKey: 'commands.outline.rename',\n ...EDITS,\n enabled: hasSelection,\n run: (commandContext) => {\n const selected = selectedOf(commandContext);\n if (!selected) return;\n commandContext\n .tryGet(ShellToken)\n ?.open(OUTLINE_RENAME, { props: { item: selected.ref.objectNumber } });\n },\n },\n {\n id: 'outline:set-destination',\n labelKey: 'commands.outline.setDestination',\n ...EDITS,\n enabled: (commandContext) =>\n hasSelection(commandContext) && outlineOf(commandContext)?.getCurrentViewTarget() != null,\n run: async (commandContext) => {\n const outline = outlineOf(commandContext);\n const selected = selectedOf(commandContext);\n const target = outline?.getCurrentViewTarget() ?? null;\n if (outline && selected && target) await outline.update(selected.ref, { target });\n },\n },\n {\n id: 'outline:properties',\n labelKey: 'commands.outline.properties',\n ...EDITS,\n enabled: hasSelection,\n run: (commandContext) => {\n const selected = selectedOf(commandContext);\n if (!selected) return;\n commandContext.tryGet(ShellToken)?.open(OUTLINE_PROPERTIES_DIALOG, {\n exclusive: 'modal',\n props: { item: selected.ref.objectNumber },\n });\n },\n },\n {\n id: 'outline:delete',\n labelKey: 'commands.outline.delete',\n icon: 'trash',\n ...EDITS,\n enabled: hasSelection,\n run: async (commandContext) => {\n const outline = outlineOf(commandContext);\n const selected = outline?.getSelected() ?? [];\n if (outline && selected.length > 0) await outline.delete(selected);\n },\n },\n // A row's menu, opened from the row's own button or by a right-click on it.\n {\n id: 'menu:outline-item',\n labelKey: 'commands.outline.more',\n icon: 'dots',\n menu: OUTLINE_ITEM_MENU,\n ...EDITS,\n },\n {\n id: 'outline:expand-all',\n labelKey: 'commands.outline.expandAll',\n icon: 'chevronsDown',\n categories: ['outline'],\n run: (commandContext) => outlineOf(commandContext)?.expandAll(),\n },\n {\n id: 'outline:collapse-all',\n labelKey: 'commands.outline.collapseAll',\n icon: 'chevronsUp',\n categories: ['outline'],\n run: (commandContext) => outlineOf(commandContext)?.collapseAll(),\n },\n];\n","/**\n * The page commands, for the thumbnails panel (its header, each page's menu, its keys) and\n * `viewer.commands.execute()`. They act on the selected pages (`pageEdit.getSelected()`); the\n * panel selects a page before it opens that page's menu. Changing pages needs\n * `doc.pages.assemble` (`pageEdit.canEdit()`) and the `pages` feature. Extracting copies pages\n * out without changing the document, so it goes with `documents.download` and needs\n * `doc.download` (`pageEdit.canExtract()`): `readOnly` keeps it.\n *\n * Each edit is one step of the history, so the panel's header has undo and redo, and a delete\n * needs no confirm.\n */\nimport type { CommandDef } from '@embedpdf/react/commands';\nimport {\n PageEditToken,\n type PageEditCapability,\n type PagePosition,\n} from '@embedpdf/react/page-edit';\nimport { DocumentsToken, type PageRef } from '@embedpdf/react/runtime';\nimport { pickFile, saveFile } from '@embedpdf/web';\n\nimport { isPdfFile } from './open-files';\n\ntype Ctx = Parameters<NonNullable<CommandDef['run']>>[0];\n\n/** The menu of a page: the commands below, for that page and the others selected with it. */\nexport const PAGE_MENU = 'page';\n\nconst PDF_TYPE = 'application/pdf';\n\n/**\n * What the insert commands take instead of asking: where the pages go (a gap between two\n * thumbnails), and for `page:insert-file`, the PDFs to insert (a drop's).\n */\nexport interface PageInsertArgs {\n readonly position?: PagePosition;\n readonly files?: readonly File[];\n}\n\nconst pageEditOf = (commandContext: Ctx): PageEditCapability | null =>\n commandContext.tryGet(PageEditToken);\n\nconst selectedOf = (commandContext: Ctx): readonly PageRef[] =>\n pageEditOf(commandContext)?.getSelected() ?? [];\n\nconst hasSelection = (commandContext: Ctx): boolean => selectedOf(commandContext).length > 0;\n\n/** The document's pages, in display order. */\nconst pagesOf = (commandContext: Ctx) =>\n commandContext.tryGet(DocumentsToken)?.listPages(commandContext.documentId ?? undefined) ?? [];\n\nconst argsOf = (commandContext: Ctx): PageInsertArgs =>\n (commandContext.args as PageInsertArgs | undefined) ?? {};\n\n/** What a command that changes the pages needs: the right to, and the feature on. */\nconst PAGE_EDITS = {\n categories: ['pages'],\n allowed: (commandContext: Ctx) => pageEditOf(commandContext)?.canEdit() ?? true,\n notAllowedKey: 'commands.notAllowed.doc-pages-assemble',\n} satisfies Partial<CommandDef>;\n\n/**\n * Where new pages go: where the caller says, else after the selected page that comes last, else\n * at the end.\n */\nfunction insertPositionOf(commandContext: Ctx): PagePosition {\n const given = argsOf(commandContext).position;\n if (given) return given;\n const selected = new Set(selectedOf(commandContext).map((ref) => ref.objectNumber));\n const last = pagesOf(commandContext)\n .filter((page) => selected.has(page.ref.objectNumber))\n .pop();\n return last ? { after: last.ref } : 'end';\n}\n\n/** The PDFs the caller passed, else the one the user picks: empty when they close the dialog. */\nasync function filesToInsert(commandContext: Ctx): Promise<readonly File[]> {\n const given = argsOf(commandContext).files;\n if (given) return given.filter(isPdfFile);\n // The dialog opens before anything is awaited: a browser opens it only inside the click or key\n // that asked for it.\n const picked = await pickFile({ accept: `.pdf,${PDF_TYPE}` });\n return picked ? [picked] : [];\n}\n\n/** The name of a copy of some of the document's pages: the document's own name, then `-pages`. */\nfunction extractNameOf(commandContext: Ctx): string {\n const id = commandContext.documentId ?? undefined;\n const name = commandContext\n .tryGet(DocumentsToken)\n ?.get(id)\n ?.name?.replace(/\\.pdf$/i, '');\n return `${name || 'document'}-pages.pdf`;\n}\n\nconst rotate = (id: string, labelKey: string, icon: string, delta: 90 | -90): CommandDef => ({\n id,\n labelKey,\n icon,\n ...PAGE_EDITS,\n enabled: hasSelection,\n run: async (commandContext) => {\n const selected = selectedOf(commandContext);\n if (selected.length > 0) await pageEditOf(commandContext)?.rotateBy(selected, delta);\n },\n});\n\nexport const pageCommands: CommandDef[] = [\n rotate('page:rotate-clockwise', 'commands.pages.rotateClockwise', 'pageRotateClockwise', 90),\n rotate(\n 'page:rotate-counterclockwise',\n 'commands.pages.rotateCounterclockwise',\n 'pageRotateCounterClockwise',\n -90,\n ),\n {\n id: 'page:delete',\n labelKey: 'commands.pages.delete',\n icon: 'trash',\n ...PAGE_EDITS,\n // A document keeps at least one page.\n enabled: (commandContext) => {\n const count = selectedOf(commandContext).length;\n return count > 0 && count < pagesOf(commandContext).length;\n },\n run: async (commandContext) => {\n const selected = selectedOf(commandContext);\n if (selected.length > 0) await pageEditOf(commandContext)?.delete(selected);\n },\n },\n {\n id: 'page:duplicate',\n labelKey: 'commands.pages.duplicate',\n icon: 'copy',\n categories: PAGE_EDITS.categories,\n // A copy is made from the pages copied out: it needs both rights.\n allowed: (commandContext) => {\n const pageEdit = pageEditOf(commandContext);\n return pageEdit ? pageEdit.canEdit() && pageEdit.canExtract() : true;\n },\n enabled: hasSelection,\n run: async (commandContext) => {\n const pageEdit = pageEditOf(commandContext);\n const selected = selectedOf(commandContext);\n if (!pageEdit || selected.length === 0) return;\n const { pages } = await pageEdit.duplicate(selected);\n pageEdit.select(pages);\n },\n },\n {\n id: 'page:insert-blank',\n labelKey: 'commands.pages.insertBlank',\n icon: 'filePlus',\n ...PAGE_EDITS,\n run: async (commandContext) => {\n const pageEdit = pageEditOf(commandContext);\n if (!pageEdit) return;\n const { pages } = await pageEdit.insertBlank({ position: insertPositionOf(commandContext) });\n pageEdit.select(pages);\n },\n },\n {\n id: 'page:insert-file',\n labelKey: 'commands.pages.insertFile',\n icon: 'fileImport',\n ...PAGE_EDITS,\n run: async (commandContext) => {\n const pageEdit = pageEditOf(commandContext);\n if (!pageEdit) return;\n let position = insertPositionOf(commandContext);\n const files = await filesToInsert(commandContext);\n const inserted: PageRef[] = [];\n // One file after another, each after the pages of the one before it.\n for (const file of files) {\n const { pages } = await pageEdit.insertFromBytes(new Uint8Array(await file.arrayBuffer()), {\n position,\n });\n inserted.push(...pages);\n const last = pages[pages.length - 1];\n if (last) position = { after: last };\n }\n if (inserted.length > 0) pageEdit.select(inserted);\n },\n },\n {\n id: 'page:extract',\n labelKey: 'commands.pages.extract',\n icon: 'fileExport',\n categories: ['documents.download'],\n allowed: (commandContext) => pageEditOf(commandContext)?.canExtract() ?? true,\n notAllowedKey: 'commands.notAllowed.doc-download',\n enabled: hasSelection,\n run: async (commandContext) => {\n const selected = selectedOf(commandContext);\n const pageEdit = pageEditOf(commandContext);\n if (!pageEdit || selected.length === 0) return;\n const bytes = await pageEdit.extract(selected);\n saveFile(bytes, extractNameOf(commandContext), PDF_TYPE);\n },\n },\n {\n id: 'page:select-all',\n labelKey: 'commands.pages.selectAll',\n categories: PAGE_EDITS.categories,\n enabled: (commandContext) => selectedOf(commandContext).length < pagesOf(commandContext).length,\n run: (commandContext) =>\n pageEditOf(commandContext)?.select(pagesOf(commandContext).map((page) => page.ref)),\n },\n // A page's menu, opened from the page's own button, a right-click or a long-press on it.\n {\n id: 'menu:page',\n labelKey: 'commands.pages.more',\n icon: 'dots',\n menu: PAGE_MENU,\n ...PAGE_EDITS,\n },\n];\n","/**\n * The command vocabulary — the semantic layer. Every command is a pure value:\n * label key, icon, shortcut, derivations, and a `run` (or a declarative\n * surface target). Commands reach plugins through a typed\n * `commandContext.tryGet(Token)`, never by string id and cast.\n *\n * Each command names its most specific feature in `categories` (the tree in\n * `../features.ts`), so `disable` and `readOnly` turn it off, and whether the\n * session may run it in `allowed`, from the owning plugin's `can*` check\n * (docs/conventions/permissions.md), so a user who may not doesn't see it.\n * `enabled` is only for what can't run right now.\n *\n * Wiring:\n * zoom/pan/pointer/spread/scroll/rotate → real Stage / Interaction / PageEdit\n * modes → shell exclusive surfaces ('mode')\n * panels → the layout's `panel:<id>` (panels.ts)\n * menus / modals → declarative shell targets\n * annotate + shape tools → real interaction tools\n * form tools → real form plugin palette (draw-to-place)\n * insert tools → real stamp and signature panels +\n * image/attachment click-then-pick\n * history undo/redo → real History\n */\nimport { panelCommandOf } from '@embedpdf/core-ui';\nimport type { AnnotationToolInput } from '@embedpdf/react/annotation';\nimport { CommandsToken, type CommandDef, type IconAccent } from '@embedpdf/react/commands';\nimport { FormToken } from '@embedpdf/react/form';\nimport { HistoryToken } from '@embedpdf/react/history';\nimport { DocumentsToken } from '@embedpdf/react/runtime';\nimport { StageToken, ZoomMode } from '@embedpdf/react/stage';\nimport type { SpreadMode } from '@embedpdf/react/stage';\nimport { InteractionToken } from '@embedpdf/react/interaction';\nimport { ShellToken } from '@embedpdf/react/shell';\nimport { AnnotationToken } from '@embedpdf/react/annotation';\nimport { copySelection, SelectionToken, type TextRange } from '@embedpdf/react/selection';\nimport { LinkToken, type PdfLinkTarget } from '@embedpdf/react/link';\nimport { MeasurementToken } from '@embedpdf/react/measurement';\nimport { RedactionToken } from '@embedpdf/react/redaction';\nimport { StampToken } from '@embedpdf/react/stamp';\nimport { SignatureToken } from '@embedpdf/react/signature';\nimport { I18nToken } from '@embedpdf/react/i18n';\nimport { saveFile } from '@embedpdf/web';\n\nimport type { Feature } from '../features';\nimport { attachmentCommands } from './attachments';\nimport { openModeSurfaceOf } from './modes';\nimport { openFileCommand } from './open-files';\nimport { outlineCommands } from './outline';\nimport { pageCommands } from './page-commands';\n\n// ── helpers ────────────────────────────────────────────────────────────────\ntype Ctx = Parameters<NonNullable<CommandDef['run']>>[0];\n\n/** The dialog the Go to Page command opens without a page to go to (ui/go-to-page.tsx). */\nexport const GO_TO_PAGE_DIALOG = 'go-to-page';\n/** The keyboard shortcuts sheet, which `?` opens (ui/shortcuts-sheet.tsx). */\nexport const SHORTCUTS_DIALOG = 'shortcuts';\n/** The confirmation before marked areas are removed for good (ui/redact-confirm.tsx). */\nexport const REDACT_CONFIRM_DIALOG = 'redact-confirm';\n/** The Print dialog: which pages, and whether annotations print (ui/print-dialog.tsx). */\nexport const PRINT_DIALOG = 'print';\n/** The form designer's sidebar (ui/form-design-panel.tsx), which `form:design` opens. */\nexport const FORM_DESIGN_PANEL = 'form-design';\n/** Form design's resting tool, the form plugin's: widgets select, move and resize there. */\nexport const FORM_DESIGN_TOOL = 'form-edit';\n/** The form plugin's field tools, each placing a field (the Form bar's `tool:*` buttons). */\nconst FORM_FIELD_TOOLS: readonly string[] = [\n 'form-text',\n 'form-checkbox',\n 'form-radio',\n 'form-combobox',\n 'form-listbox',\n 'form-button',\n 'form-signature',\n];\n\n/**\n * Whether a tool designs a form: design's resting tool, or a field tool. Neither fills, so the\n * form lends its widgets to be selected, moved and resized.\n */\nexport const isFormDesignTool = (tool: string | null | undefined): boolean =>\n tool === FORM_DESIGN_TOOL || (tool != null && FORM_FIELD_TOOLS.includes(tool));\n\n/** Whether a form is being designed: the active tool designs it. */\nexport const isDesigningForm = (commandContext: Pick<Ctx, 'tryGet'>): boolean =>\n isFormDesignTool(commandContext.tryGet(InteractionToken)?.getActiveToolId());\n\n/** Where selection-made stamps go: the user's own library, persisted. */\nconst CUSTOM_LIBRARY_ID = 'embedpdf-custom';\n\nconst stage = (commandContext: Ctx) => commandContext.tryGet(StageToken);\nconst interaction = (commandContext: Ctx) => commandContext.tryGet(InteractionToken);\nconst anno = (commandContext: Ctx) => commandContext.tryGet(AnnotationToken);\nconst textSelection = (commandContext: Ctx) => commandContext.tryGet(SelectionToken);\n\n/**\n * Whether the session may run a command, as the plugin that owns its verb says, and the\n * sentence for when it may not (docs/conventions/permissions.md). Without the plugin there is\n * nothing to ask, and the command's own `enabled` or `visible` says it can't run.\n */\ntype Check = Pick<CommandDef, 'allowed' | 'notAllowedKey'>;\n\n/** Drawing an annotation of any kind: `annotation.canCreate()`. */\nconst CREATES_ANNOTATIONS: Check = {\n allowed: (commandContext) => anno(commandContext)?.canCreate() ?? true,\n notAllowedKey: 'commands.notAllowed.annotations-create',\n};\n/** Placing and changing form fields: `form.canDesign()`. */\nconst DESIGNS_FORMS: Check = {\n allowed: (commandContext) => commandContext.tryGet(FormToken)?.canDesign() ?? true,\n notAllowedKey: 'commands.notAllowed.doc-forms-modify',\n};\n/** Placing a stamp or a signature mark: `stamp.canPlace()`. */\nconst PLACES_STAMPS: Check = {\n allowed: (commandContext) =>\n commandContext.tryGet(StampToken)?.canPlace(commandContext.documentId ?? undefined) ?? true,\n notAllowedKey: 'commands.notAllowed.annotations-create',\n};\nconst sameTextRange = (left: TextRange | null, right: TextRange | null): boolean =>\n left === right ||\n (!!left &&\n !!right &&\n left.start.page.objectNumber === right.start.page.objectNumber &&\n left.start.index === right.start.index &&\n left.end.page.objectNumber === right.end.page.objectNumber &&\n left.end.index === right.end.index);\n\n/**\n * What a command needs to open and close the layout's panel `id`: it runs the panel's own\n * `panel:<id>` command (config/panels.ts), so it opens only what that one may, shows only while\n * the layout has the panel and `visible` says so, and is active while the panel is open.\n */\nconst togglesPanel = (id: string, visible?: (commandContext: Ctx) => boolean) => ({\n run: (commandContext: Ctx) =>\n commandContext.tryGet(CommandsToken)?.execute(panelCommandOf(id), {\n documentId: commandContext.documentId ?? undefined,\n }),\n active: (commandContext: Ctx) => commandContext.tryGet(ShellToken)?.isOpen(id) ?? false,\n visible: (commandContext: Ctx) =>\n (commandContext.tryGet(CommandsToken)?.hasCommand(panelCommandOf(id)) ?? false) &&\n (visible?.(commandContext) ?? true),\n});\n\n/** A measuring tool can run on the current page: it has a scale (`measurement.canMeasure`). */\nconst canMeasureNow = (commandContext: Ctx): boolean => {\n const page = stage(commandContext)?.getCurrentPage();\n return page != null && (commandContext.tryGet(MeasurementToken)?.canMeasure(page) ?? false);\n};\n\n// ── annotation-selection predicates (drive the floating strip's contents) ────\nconst hasAnnotationSelection = (commandContext: Ctx) =>\n (anno(commandContext)?.selection.list().length ?? 0) > 0;\n/** Whether people may change every selected annotation by hand (no turned-off feature froze it). */\nconst selectionEditable = (commandContext: Ctx): boolean => {\n const annotation = anno(commandContext);\n return (annotation?.selection.list() ?? []).every(({ ref }) => annotation!.isEditable(ref));\n};\n/** Strip items gate per subtype (comment hidden on links/widgets) through\n * one derivation over the selected DTOs, not per-command lookups. */\nconst selectionSubtypes = (commandContext: Ctx) =>\n new Set((anno(commandContext)?.selection.list() ?? []).map((annotation) => annotation.subtype));\n/**\n * The selection's `link` value: a target, `null` (linkable but none set), or\n * `undefined` when the selection cannot carry a link at all (widgets, mixed\n * link states) — the schema decides, never a subtype blocklist.\n */\n/** The selection's link target, as the annotation holds it (destinations in the file's coordinates). */\nconst selectionLink = (commandContext: Ctx): PdfLinkTarget | null | undefined => {\n const props = anno(commandContext)?.selection.getProperties();\n if (\n !props ||\n !props.properties.some((property) => property.key === 'link') ||\n props.mixed.includes('link')\n )\n return undefined;\n return (props.values.link ?? null) as PdfLinkTarget | null;\n};\n\n// ── tool icon accents: This viewer's design decision ─────────────────────────\n// A tool declares which drawing default each colored part of its glyph previews.\n// This is intentionally explicit at the command definition: property-panel order\n// does not determine icon meaning, and another viewer may make a different choice.\ntype ColorKey = 'color' | 'interiorColor' | 'fontColor';\nexport interface ToolAccentDefinition {\n primary: ColorKey;\n secondary?: ColorKey;\n}\n\n/**\n * toolId → the same icon + accent definition its toolbar button uses, recorded\n * as a side effect of the `tool()` command definitions below — one source of\n * truth, so the tool cursor (ui/tool-cursor.tsx) and the button can never\n * drift apart.\n */\nexport const TOOL_ICONS: Record<string, { icon: string; accent?: ToolAccentDefinition }> = {};\n\n// The `stamp` tool has no toolbar button of its own: it is armed by the stamps\n// panel (picking a library asset), never activated directly — so its cursor\n// skin is recorded here rather than as a side effect of a `tool()` definition.\nTOOL_ICONS['stamp'] = { icon: 'rubberStamp' };\n\nconst toolAccent = (\n commandContext: Ctx,\n toolId: string,\n accent: ToolAccentDefinition | undefined,\n): IconAccent | null => {\n if (!accent) return null;\n const anno = commandContext.tryGet(AnnotationToken);\n if (!anno) return null;\n const defaults = anno.tools.getDefaults(toolId);\n const colorOf = (key: ColorKey) => (defaults[key] as string | null | undefined) ?? undefined;\n return {\n primary: colorOf(accent.primary),\n secondary: accent.secondary ? colorOf(accent.secondary) : undefined,\n };\n};\n\n/** toolId → the feature its command belongs to, for the tools of yours that extend it. */\nconst TOOL_FEATURES: Record<string, Feature> = {};\n\n/** What a tool command belongs to and needs, and how its icon previews the tool. */\ninterface ToolOptions {\n /** Its feature, so `disable` and `readOnly` turn it off. */\n readonly feature: Feature;\n /**\n * Whether the session may use it: an authoring tool is gone without it, so a\n * button never offers a paint the owning plugin's gesture gate refuses.\n */\n readonly check?: Check;\n readonly accent?: ToolAccentDefinition;\n}\n\n/** A tool command without its label: activates a real interaction tool; active = it's the tool.\n * The icon previews the tool's current defaults — keyed by the same toolId\n * as run/active, so the accent can't drift to another tool's colors. */\nconst toolCommand = (\n id: string,\n toolId: string,\n icon: string | undefined,\n { feature, check, accent }: ToolOptions,\n): Omit<CommandDef, 'labelKey'> => {\n if (icon) TOOL_ICONS[toolId] = { icon, ...(accent ? { accent } : {}) };\n TOOL_FEATURES[toolId] = feature;\n return {\n id,\n ...(icon ? { icon } : {}),\n categories: [feature],\n ...check,\n run: (commandContext) => interaction(commandContext)?.activateTool(toolId),\n active: (commandContext) => interaction(commandContext)?.getActiveToolId() === toolId,\n enabled: (commandContext) => interaction(commandContext) != null,\n iconAccent: (commandContext) => toolAccent(commandContext, toolId, accent),\n };\n};\n\nconst tool = (\n id: string,\n toolId: string,\n labelKey: string,\n icon: string,\n options: ToolOptions,\n): CommandDef => ({ ...toolCommand(id, toolId, icon, options), labelKey });\n\n/**\n * Selected text made into a highlight, an underline or a strikeout, with the colors of the\n * tool that makes the same: shown only while there's a selection.\n */\nconst markupSelection = (\n id: string,\n toolId: string,\n labelKey: string,\n icon: string,\n feature: Feature,\n): CommandDef => ({\n id,\n labelKey,\n icon,\n categories: [feature],\n ...CREATES_ANNOTATIONS,\n visible: (commandContext) => textSelection(commandContext)?.hasSelection() ?? false,\n run: (commandContext) => anno(commandContext)?.createFromSelection(toolId),\n iconAccent: (commandContext) => toolAccent(commandContext, toolId, { primary: 'color' }),\n});\n\n/** The page number `page:go-to` was given (`args: { page }`, counted from 1), or `null`. */\nconst pageArgOf = (args: unknown): number | null => {\n const page = (args as { page?: unknown } | undefined)?.page;\n return typeof page === 'number' && Number.isFinite(page) ? Math.round(page) : null;\n};\n\n/** A fixed zoom level (fraction), e.g. 1 = 100%. */\nconst zoomLevel = (id: string, level: number, label: string): CommandDef => ({\n id,\n labelKey: label,\n run: (commandContext) => stage(commandContext)?.zoomTo({ level }),\n enabled: (commandContext) => stage(commandContext) != null,\n});\n\nconst spread = (id: string, mode: SpreadMode, labelKey: string, icon: string): CommandDef => ({\n id,\n labelKey,\n icon,\n run: (commandContext) => stage(commandContext)?.updateSettings({ spread: mode }),\n active: (commandContext) => stage(commandContext)?.getSettings().spread === mode,\n enabled: (commandContext) => stage(commandContext) != null,\n});\n\nexport const defaultCommands: CommandDef[] = [\n // ── zoom ───────────────────────────────────────────────────────────────\n {\n id: 'zoom:in',\n labelKey: 'commands.zoom.in',\n icon: 'zoomIn',\n shortcut: ['Mod+=', 'Mod+NumpadAdd'],\n run: (commandContext) => stage(commandContext)?.zoomIn(),\n enabled: (commandContext) => stage(commandContext) != null,\n },\n {\n id: 'zoom:out',\n labelKey: 'commands.zoom.out',\n icon: 'zoomOut',\n shortcut: ['Mod+-', 'Mod+NumpadSubtract'],\n run: (commandContext) => stage(commandContext)?.zoomOut(),\n enabled: (commandContext) => stage(commandContext) != null,\n },\n {\n id: 'zoom:fit-page',\n labelKey: 'commands.zoom.fitPage',\n icon: 'fitToPage',\n shortcut: 'Mod+0',\n run: (commandContext) => stage(commandContext)?.fitPage(),\n active: (commandContext) => stage(commandContext)?.getZoomMode() === ZoomMode.FitPage,\n enabled: (commandContext) => stage(commandContext) != null,\n },\n {\n id: 'zoom:fit-width',\n labelKey: 'commands.zoom.fitWidth',\n icon: 'fitToWidth',\n shortcut: 'Mod+1',\n run: (commandContext) => stage(commandContext)?.fitWidth(),\n active: (commandContext) => stage(commandContext)?.getZoomMode() === ZoomMode.FitWidth,\n enabled: (commandContext) => stage(commandContext) != null,\n },\n {\n id: 'zoom:automatic',\n labelKey: 'commands.zoom.automatic',\n run: (commandContext) => stage(commandContext)?.fitAutomatic(),\n active: (commandContext) => stage(commandContext)?.getZoomMode() === ZoomMode.Automatic,\n enabled: (commandContext) => stage(commandContext) != null,\n },\n zoomLevel('zoom:50', 0.5, 'commands.zoom.p50'),\n zoomLevel('zoom:100', 1, 'commands.zoom.p100'),\n zoomLevel('zoom:150', 1.5, 'commands.zoom.p150'),\n zoomLevel('zoom:200', 2, 'commands.zoom.p200'),\n zoomLevel('zoom:400', 4, 'commands.zoom.p400'),\n {\n id: 'menu:zoom',\n labelKey: 'commands.zoom.menu',\n icon: 'zoomIn',\n menu: 'zoom',\n },\n\n // ── pages ──────────────────────────────────────────────────────────────\n {\n id: 'page:next',\n labelKey: 'commands.page.next',\n icon: 'chevronRight',\n shortcut: 'ArrowRight',\n run: (commandContext) => stage(commandContext)?.nextPage(),\n enabled: (commandContext) => stage(commandContext)?.canGoNext() ?? false,\n },\n {\n id: 'page:previous',\n labelKey: 'commands.page.previous',\n icon: 'chevronLeft',\n shortcut: 'ArrowLeft',\n run: (commandContext) => stage(commandContext)?.previousPage(),\n enabled: (commandContext) => stage(commandContext)?.canGoPrevious() ?? false,\n },\n {\n id: 'page:first',\n labelKey: 'commands.page.first',\n shortcut: 'Home',\n run: (commandContext) => stage(commandContext)?.goToFirstPage(),\n enabled: (commandContext) => stage(commandContext)?.canGoPrevious() ?? false,\n },\n {\n id: 'page:last',\n labelKey: 'commands.page.last',\n shortcut: 'End',\n run: (commandContext) => stage(commandContext)?.goToLastPage(),\n enabled: (commandContext) => stage(commandContext)?.canGoNext() ?? false,\n },\n {\n // `execute('page:go-to', { args: { page: 3 } })` goes to page 3 (people count from 1; past\n // either end is that end); without a page it asks for one in a dialog.\n id: 'page:go-to',\n labelKey: 'commands.page.goTo',\n run: (commandContext) => {\n const view = stage(commandContext);\n if (!view) return;\n const page = pageArgOf(commandContext.args);\n if (page === null) {\n commandContext.tryGet(ShellToken)?.open(GO_TO_PAGE_DIALOG, { exclusive: 'modal' });\n return;\n }\n view.goToPage(Math.min(Math.max(page, 1), view.getPageCount()) - 1);\n },\n enabled: (commandContext) => (stage(commandContext)?.getPageCount() ?? 0) > 0,\n },\n\n // ── tools ──────────────────────────────────────────────────────────────\n {\n id: 'tool:pan',\n labelKey: 'commands.pan',\n icon: 'hand',\n run: (commandContext) => interaction(commandContext)?.activateTool('pan'),\n active: (commandContext) => interaction(commandContext)?.getActiveToolId() === 'pan',\n enabled: (commandContext) => interaction(commandContext) != null,\n },\n {\n id: 'tool:pointer',\n labelKey: 'commands.pointer',\n icon: 'pointer',\n run: (commandContext) => interaction(commandContext)?.activateTool('pointer'),\n active: (commandContext) => interaction(commandContext)?.getActiveToolId() === 'pointer',\n enabled: (commandContext) => interaction(commandContext) != null,\n },\n\n // The panels' `panel:<id>` commands come from the layout's panels (config/panels.ts).\n\n // ── menus (declarative) ─────────────────────────────────────────────────\n {\n id: 'menu:document',\n labelKey: 'commands.menu',\n icon: 'menu',\n menu: 'document',\n },\n {\n id: 'menu:view',\n labelKey: 'commands.viewControls',\n icon: 'viewSettings',\n menu: 'view',\n },\n\n // ── the outline ─────────────────────────────────────────────────────────\n ...outlineCommands,\n\n // ── the files the document carries ──────────────────────────────────────\n ...attachmentCommands,\n\n // ── the pages: rotate, move, insert, delete, copy out ───────────────────\n ...pageCommands,\n\n // ── document actions ────────────────────────────────────────────────────\n openFileCommand,\n {\n id: 'document:download',\n labelKey: 'commands.download',\n icon: 'download',\n shortcut: 'Mod+S',\n categories: ['documents.download'],\n allowed: (commandContext) => commandContext.tryGet(DocumentsToken)?.canDownload() ?? true,\n notAllowedKey: 'commands.notAllowed.doc-download',\n run: (commandContext) => {\n const id = commandContext.documentId ?? undefined;\n const documents = commandContext.tryGet(DocumentsToken);\n if (!documents) return;\n // The download runs the document's save actions itself (WillSave → read → DidSave)\n // when the actions plugin is installed, so the WillSave changes are in the bytes.\n documents\n .download(id)\n .then((bytes) => saveFile(bytes, 'document.pdf', 'application/pdf'))\n .catch((error) => console.warn('[snippet-react] download failed', error));\n },\n enabled: (commandContext) => commandContext.documentId != null,\n },\n {\n id: 'document:print',\n labelKey: 'commands.print',\n icon: 'print',\n shortcut: 'Mod+P',\n categories: ['documents.print'],\n allowed: (commandContext) => commandContext.tryGet(DocumentsToken)?.canPrint() ?? true,\n notAllowedKey: 'commands.notAllowed.doc-print',\n // The dialog chooses the pages and prepares them; its Print button opens the browser's.\n modal: PRINT_DIALOG,\n enabled: (commandContext) => commandContext.documentId != null,\n },\n {\n id: 'view:fullscreen',\n labelKey: 'commands.fullscreen',\n icon: 'externalLink',\n run: () => {\n if (document.fullscreenElement) document.exitFullscreen();\n else document.documentElement.requestFullscreen().catch(() => {});\n },\n active: () => Boolean(document.fullscreenElement),\n },\n\n // ── page settings (spread / scroll / rotate) ────────────────────────────\n spread('view:single-page', 'none', 'commands.spread.none', 'singlePage'),\n spread('view:two-pages', 'odd', 'commands.spread.odd', 'doublePage'),\n spread('view:cover-page', 'even', 'commands.spread.even', 'book2'),\n {\n id: 'view:scroll-vertical',\n labelKey: 'commands.scroll.vertical',\n icon: 'vertical',\n run: (commandContext) => stage(commandContext)?.updateSettings({ layout: 'vertical' }),\n active: (commandContext) => stage(commandContext)?.getSettings().layout === 'vertical',\n enabled: (commandContext) => stage(commandContext) != null,\n },\n {\n id: 'view:scroll-horizontal',\n labelKey: 'commands.scroll.horizontal',\n icon: 'horizontal',\n run: (commandContext) => stage(commandContext)?.updateSettings({ layout: 'horizontal' }),\n active: (commandContext) => stage(commandContext)?.getSettings().layout === 'horizontal',\n enabled: (commandContext) => stage(commandContext) != null,\n },\n // View rotation (Adobe's \"Rotate View\"): rotates how every page displays in\n // the main stage lens — non-persistent, nothing written to the PDF. The\n // permanent per-page rotation (PageEditToken.rotateBy) belongs in a\n // page-organize surface, not behind the view-settings buttons.\n {\n id: 'view:rotate-clockwise',\n labelKey: 'commands.rotate.clockwise',\n icon: 'rotateClockwise',\n run: (commandContext) => stage(commandContext)?.rotateViewBy(90),\n enabled: (commandContext) => stage(commandContext) != null,\n },\n {\n id: 'view:rotate-counterclockwise',\n labelKey: 'commands.rotate.counterclockwise',\n icon: 'rotateCounterClockwise',\n run: (commandContext) => stage(commandContext)?.rotateViewBy(-90),\n enabled: (commandContext) => stage(commandContext) != null,\n },\n\n // ── modes (shell exclusive surfaces, tag 'mode') ────────────────────────\n {\n id: 'mode:view',\n labelKey: 'commands.mode.view',\n // View = no mode bar. Close the open mode, a built-in one or one a layout's\n // bar brought, and drop to pointer.\n run: (commandContext) => {\n const shell = commandContext.tryGet(ShellToken);\n const open = shell ? openModeSurfaceOf(shell) : null;\n if (open) shell?.close(open);\n interaction(commandContext)?.activateTool('pointer');\n },\n active: (commandContext) => {\n const shell = commandContext.tryGet(ShellToken);\n return shell ? openModeSurfaceOf(shell) === null : true;\n },\n },\n modeCommand('mode:annotate', 'commands.mode.annotate', { feature: 'annotations' }),\n modeCommand('mode:shapes', 'commands.mode.shapes', { feature: 'shapes' }),\n // Stamps, images, attachments and signatures: no one feature holds them all.\n modeCommand('mode:insert', 'commands.mode.insert'),\n // Form mode opens for filling and looking; `form:design` switches design on.\n modeCommand('mode:form', 'commands.mode.form', { feature: 'forms.building' }),\n modeCommand('mode:redact', 'commands.mode.redact', { feature: 'redaction' }),\n modeCommand('mode:measure', 'commands.mode.measure', { feature: 'measurement' }),\n // ── annotate tools (real interaction tools) ─────────────────────────────\n tool('tool:highlight', 'highlight', 'commands.annotate.highlight', 'highlight', {\n feature: 'annotations.highlight',\n check: CREATES_ANNOTATIONS,\n accent: { primary: 'color' },\n }),\n tool('tool:strikeout', 'strikeout', 'commands.annotate.strikeout', 'strikethrough', {\n feature: 'annotations.markup',\n check: CREATES_ANNOTATIONS,\n accent: { primary: 'color' },\n }),\n tool('tool:underline', 'underline', 'commands.annotate.underline', 'underline', {\n feature: 'annotations.markup',\n check: CREATES_ANNOTATIONS,\n accent: { primary: 'color' },\n }),\n tool('tool:squiggly', 'squiggly', 'commands.annotate.squiggly', 'squiggly', {\n feature: 'annotations.markup',\n check: CREATES_ANNOTATIONS,\n accent: { primary: 'color' },\n }),\n tool('tool:ink', 'ink', 'commands.annotate.ink', 'pencilMarker', {\n feature: 'annotations.drawing',\n check: CREATES_ANNOTATIONS,\n accent: { primary: 'color' },\n }),\n tool('tool:ink-highlight', 'ink-highlight', 'commands.annotate.inkHighlight', 'inkHighlighter', {\n feature: 'annotations.drawing',\n check: CREATES_ANNOTATIONS,\n accent: { primary: 'color' },\n }),\n tool('tool:free-text', 'free-text', 'commands.annotate.text', 'freeText', {\n feature: 'annotations.text',\n check: CREATES_ANNOTATIONS,\n accent: { primary: 'fontColor' },\n }),\n tool('tool:insert-text', 'insert-text', 'commands.annotate.insertText', 'insertText', {\n feature: 'annotations.text',\n check: CREATES_ANNOTATIONS,\n accent: { primary: 'color' },\n }),\n tool('tool:replace-text', 'replace-text', 'commands.annotate.replaceText', 'replaceText', {\n feature: 'annotations.text',\n check: CREATES_ANNOTATIONS,\n accent: { primary: 'color' },\n }),\n tool('tool:callout', 'free-text-callout', 'commands.annotate.callout', 'callout', {\n feature: 'annotations.text',\n check: CREATES_ANNOTATIONS,\n accent: { primary: 'color', secondary: 'interiorColor' },\n }),\n // Sticky note (\"comment\") — click-to-place; the icon renders from the\n // engine-baked /AP in the tool's current color.\n tool('tool:note', 'note', 'commands.annotate.note', 'message', {\n feature: 'annotations.notes',\n check: CREATES_ANNOTATIONS,\n }),\n // Link — drag an invisible hit rectangle, then set the target in the style\n // panel's Link control (create-then-edit). While active, existing links\n // become editable rects instead of navigating.\n tool('tool:link', 'link', 'commands.annotate.link', 'link', {\n feature: 'annotations.links',\n check: CREATES_ANNOTATIONS,\n }),\n\n // ── shape tools (real interaction tools) ────────────────────────────────\n tool('tool:square', 'square', 'commands.shapes.rectangle', 'square', {\n feature: 'shapes',\n check: CREATES_ANNOTATIONS,\n accent: { primary: 'color', secondary: 'interiorColor' },\n }),\n tool('tool:circle', 'circle', 'commands.shapes.circle', 'circle', {\n feature: 'shapes',\n check: CREATES_ANNOTATIONS,\n accent: { primary: 'color', secondary: 'interiorColor' },\n }),\n tool('tool:line', 'line', 'commands.shapes.line', 'line', {\n feature: 'shapes',\n check: CREATES_ANNOTATIONS,\n accent: { primary: 'color' },\n }),\n // The arrow tool is a `line` preset (a line with an arrowhead) — registered by\n // the annotationPlugin `tools` config in viewer.tsx, activated like any other tool.\n tool('tool:arrow', 'arrow', 'commands.shapes.arrow', 'lineArrow', {\n feature: 'shapes',\n check: CREATES_ANNOTATIONS,\n accent: { primary: 'color' },\n }),\n tool('tool:polygon', 'polygon', 'commands.shapes.polygon', 'polygon', {\n feature: 'shapes',\n check: CREATES_ANNOTATIONS,\n accent: { primary: 'color', secondary: 'interiorColor' },\n }),\n tool('tool:polyline', 'polyline', 'commands.shapes.polyline', 'zigzag', {\n feature: 'shapes',\n check: CREATES_ANNOTATIONS,\n accent: { primary: 'color' },\n }),\n\n // ── insert tools (stamp/image/attachment real; signature inert) ─────────\n // Stamps open a library, they are not a file dialog: the panel lists the\n // reusable named assets the stamp plugin holds, and picking one arms the\n // annotation plugin's stamp tool with that asset's bytes (stamps-panel.tsx).\n // Arbitrary image bytes are `tool:image` below — a different gesture,\n // so a different button.\n {\n id: 'tool:stamp',\n labelKey: 'commands.insert.stamp',\n icon: 'rubberStamp',\n categories: ['stamps'],\n // Nothing the picker could place without it, as for every insert tool.\n ...PLACES_STAMPS,\n // No stamp plugin → no library to show.\n ...togglesPanel('stamps', (commandContext) => commandContext.tryGet(StampToken) != null),\n },\n // File attachment — click the spot, pick the file (the attachment provider).\n tool('tool:attachment', 'attachment', 'commands.insert.attachment', 'paperclip', {\n feature: 'attachments.adding',\n check: CREATES_ANNOTATIONS,\n }),\n // Signatures open the people panel (libraries of kind 'signatures'): pick a\n // mark → with a target field it signs (or fills) it, else it arms — a click\n // on a signature field signs, anywhere else drops a stamp (Preview).\n {\n id: 'tool:signature',\n labelKey: 'commands.insert.signature',\n icon: 'signature',\n categories: ['signatures.signing'],\n // A mark off a field is a stamp; one on a field is the field's value.\n ...PLACES_STAMPS,\n ...togglesPanel(\n 'signatures',\n (commandContext) =>\n commandContext.tryGet(StampToken) != null && commandContext.tryGet(SignatureToken) != null,\n ),\n },\n // Image — the click-then-pick placement: click the spot, the file dialog\n // opens (narrowed to rasters), the picture lands where you clicked. The\n // tool itself is a `stamp` preset registered in viewer.tsx.\n tool('tool:image', 'image', 'commands.insert.image', 'photo', {\n feature: 'stamps',\n check: CREATES_ANNOTATIONS,\n }),\n\n // ── form design ─────────────────────────────────────────────────────────\n // The switch: on, the design tool and the design sidebar (fields select, move and resize);\n // off, the pointer, where they fill again. A field tool turns design on by itself, and\n // leaving Form mode ends it (its sidebar shows only in Form mode).\n {\n id: 'form:design',\n labelKey: 'commands.form.design',\n icon: 'formDesign',\n categories: ['forms.building'],\n ...DESIGNS_FORMS,\n run: (commandContext) => {\n const tools = interaction(commandContext);\n const shell = commandContext.tryGet(ShellToken);\n if (!tools) return;\n if (isDesigningForm(commandContext)) {\n tools.activateTool('pointer');\n shell?.close(FORM_DESIGN_PANEL);\n return;\n }\n if (shell && !shell.isOpen('mode:form')) shell.open('mode:form', { exclusive: 'mode' });\n tools.activateTool(FORM_DESIGN_TOOL);\n shell?.open(FORM_DESIGN_PANEL);\n },\n active: isDesigningForm,\n enabled: (commandContext) => interaction(commandContext) != null,\n },\n\n // ── form tools (the form plugin's draw-to-place palette) ────────────────\n tool('tool:text-field', 'form-text', 'commands.form.textfield', 'formTextfield', {\n feature: 'forms.building',\n check: DESIGNS_FORMS,\n }),\n tool('tool:checkbox', 'form-checkbox', 'commands.form.checkbox', 'formCheckbox', {\n feature: 'forms.building',\n check: DESIGNS_FORMS,\n }),\n tool('tool:radio', 'form-radio', 'commands.form.radio', 'formRadio', {\n feature: 'forms.building',\n check: DESIGNS_FORMS,\n }),\n tool('tool:combo-box', 'form-combobox', 'commands.form.select', 'formSelect', {\n feature: 'forms.building',\n check: DESIGNS_FORMS,\n }),\n tool('tool:list-box', 'form-listbox', 'commands.form.listbox', 'formListbox', {\n feature: 'forms.building',\n check: DESIGNS_FORMS,\n }),\n tool('tool:button', 'form-button', 'commands.form.button', 'formButton', {\n feature: 'forms.building',\n check: DESIGNS_FORMS,\n }),\n tool('tool:signature-field', 'form-signature', 'commands.form.signature', 'signature', {\n feature: 'forms.building',\n check: DESIGNS_FORMS,\n }),\n\n // ── redaction (the toolbar arms the tool; the panel owns the destructive\n // verbs — Apply All / Clear live in the redaction sidebar) ─────────────────\n // Marks are annotations, so marking is `redaction.canMark()`.\n tool('tool:redact', 'redact', 'commands.redact.mark', 'redactArea', {\n feature: 'redaction',\n check: {\n allowed: (commandContext) => commandContext.tryGet(RedactionToken)?.canMark() ?? true,\n notAllowedKey: 'commands.notAllowed.annotations-create',\n },\n }),\n {\n id: 'redaction:apply',\n labelKey: 'commands.redact.applyAll',\n icon: 'redact',\n categories: ['redaction'],\n allowed: (commandContext) => commandContext.tryGet(RedactionToken)?.canApply() ?? true,\n // It can't be undone, so it asks first: the confirmation applies.\n modal: REDACT_CONFIRM_DIALOG,\n enabled: (commandContext) => {\n const redaction = commandContext.tryGet(RedactionToken);\n return !!redaction && redaction.getPendingCount() > 0 && !redaction.isApplying();\n },\n },\n\n // ── measurement: the tools need a calibrated page right now (`canMeasure`) ──\n {\n ...tool('tool:distance', 'distance', 'measurement.distance', 'distance', {\n feature: 'measurement',\n check: CREATES_ANNOTATIONS,\n accent: { primary: 'color' },\n }),\n enabled: canMeasureNow,\n },\n {\n ...tool('tool:perimeter', 'perimeter', 'measurement.perimeter', 'perimeter', {\n feature: 'measurement',\n check: CREATES_ANNOTATIONS,\n accent: { primary: 'color' },\n }),\n enabled: canMeasureNow,\n },\n {\n ...tool('tool:area', 'area', 'measurement.area', 'area', {\n feature: 'measurement',\n check: CREATES_ANNOTATIONS,\n accent: { primary: 'color' },\n }),\n enabled: canMeasureNow,\n },\n {\n id: 'measurement:calibrate',\n labelKey: 'measurement.calibrate',\n icon: 'calibrate',\n categories: ['measurement'],\n // Setting a page's scale changes the document.\n allowed: (commandContext) => commandContext.tryGet(MeasurementToken)?.canCalibrate() ?? true,\n notAllowedKey: 'commands.notAllowed.doc-annotate-modify',\n enabled: (commandContext) => commandContext.tryGet(MeasurementToken) != null,\n active: (commandContext) => interaction(commandContext)?.getActiveToolId() === 'calibrate',\n run: (commandContext) => commandContext.tryGet(MeasurementToken)?.startCalibration(),\n },\n\n // ── annotation selection (the floating strip's verbs) ──────────────────\n {\n id: 'annotation:cancel-creation',\n labelKey: 'commands.annotate.cancelCreation',\n // No feature: it only ends a drawing in progress. A command that's turned\n // off keeps its keys, and Escape belongs to whatever else is open.\n shortcut: 'Escape',\n enabled: (commandContext) => anno(commandContext)?.draft.get() != null,\n run: (commandContext) => anno(commandContext)?.draft.cancel(),\n },\n {\n id: 'annotation:delete',\n labelKey: 'commands.annotate.delete',\n icon: 'trash',\n // Backspace is the Delete key of a Mac keyboard.\n shortcut: ['Delete', 'Backspace'],\n categories: ['annotations'],\n // One change for the whole selection: a form widget lent to the annotation\n // plugin is deleted as the form says (its field, when every widget of it goes).\n run: (commandContext) => void anno(commandContext)?.selection.delete(),\n visible: hasAnnotationSelection,\n // Mirrors the engine's own authorization, which is per annotation (whose\n // it is), not the scope's: locked/unauthorized annotations keep the button\n // visible but disabled (the engine still enforces), and so do the ones a\n // turned-off feature froze (`isEditable`).\n enabled: (commandContext) => {\n const annotation = anno(commandContext);\n const selected = annotation?.selection.list() ?? [];\n return (\n selected.length > 0 &&\n selected.every(({ ref }) => annotation!.canDelete(ref) && annotation!.isEditable(ref))\n );\n },\n },\n {\n id: 'annotation:comment',\n labelKey: 'commands.comment',\n icon: 'comment',\n categories: ['comments'],\n // The comments panel, which shows the selected annotation's thread.\n ...togglesPanel(\n 'comments',\n (commandContext) =>\n hasAnnotationSelection(commandContext) && !selectionSubtypes(commandContext).has('widget'),\n ),\n },\n {\n id: 'annotation:style',\n labelKey: 'commands.style',\n icon: 'palette',\n categories: ['annotations'],\n // The kind table decides: no declared editable props → no style button.\n ...togglesPanel(\n 'style',\n (commandContext) =>\n (anno(commandContext)?.selection.getProperties().properties.length ?? 0) > 0,\n ),\n },\n {\n // The selection becomes a reusable stamp: the engine flattens the\n // selected appearances into one page (vector, positions kept) and the\n // stamp plugin files it under the user's own library — persisted like\n // any library, exportable as a PDF Acrobat reads.\n id: 'annotation:stamp-from-selection',\n labelKey: 'commands.annotate.stampFromSelection',\n icon: 'rubberStampPlus',\n categories: ['stamps'],\n // The stamp carries the annotations' appearances out of the document.\n allowed: (commandContext) =>\n commandContext\n .tryGet(StampToken)\n ?.canCreateFromAnnotations(commandContext.documentId ?? undefined) ?? true,\n notAllowedKey: 'commands.notAllowed.doc-download',\n run: (commandContext) => {\n const annotation = anno(commandContext);\n const stamp = commandContext.tryGet(StampToken);\n const documentId = commandContext.documentId;\n if (!annotation || !stamp || documentId == null) return;\n const dtos = annotation.selection.list();\n const page = dtos[0]?.ref.page;\n if (page === undefined) return;\n const i18n = commandContext.tryGet(I18nToken);\n const label = i18n?.t('demo.stampsCustomLabel') ?? 'Custom stamp';\n const libraryName = i18n?.t('demo.stampsCustomLibrary') ?? 'My stamps';\n const libraryId = CUSTOM_LIBRARY_ID;\n const ensureLibrary = stamp.getLibrary(libraryId)\n ? Promise.resolve(libraryId)\n : stamp\n .createLibrary(libraryName, { id: libraryId, categories: ['custom'] })\n .then(({ library }) => library.id);\n ensureLibrary\n .then((id) =>\n stamp.createAssetFromAnnotations(\n page,\n dtos.map((annotation) => annotation.ref),\n { libraryId: id, label: `${label} ${stamp.listAssets({ libraryId: id }).length + 1}` },\n { documentId },\n ),\n )\n // Open the stamps panel on the custom library, through its own command;\n // the panel reads its surface's props for its picker.\n .then(async () => {\n const shell = commandContext.tryGet(ShellToken);\n if (!shell) return;\n if (!shell.isOpen('stamps')) {\n await commandContext\n .tryGet(CommandsToken)\n ?.execute(panelCommandOf('stamps'), { documentId });\n }\n shell.updateSurfaceProps('stamps', { libraryId });\n })\n .catch((error) => console.warn('[embedpdf] stamp from selection failed', error));\n },\n // One page, no widgets (a form field is not artwork), no pending\n // redaction marks, and a library to put it in. The engine refuses hidden\n // or appearance-less annotations itself — all-or-nothing, never a stamp\n // missing a part.\n visible: (commandContext) =>\n commandContext.tryGet(StampToken) != null &&\n hasAnnotationSelection(commandContext) &&\n !selectionSubtypes(commandContext).has('widget') &&\n !selectionSubtypes(commandContext).has('redact') &&\n new Set(\n (anno(commandContext)?.selection.list() ?? []).map(\n (annotation) => annotation.ref.page.objectNumber,\n ),\n ).size === 1,\n },\n {\n id: 'annotation:group',\n labelKey: 'commands.annotate.group',\n icon: 'group',\n categories: ['annotations'],\n run: (commandContext) => void anno(commandContext)?.selection.group(),\n visible: (commandContext) =>\n (anno(commandContext)?.selection.canGroup() ?? false) && selectionEditable(commandContext),\n },\n {\n id: 'annotation:ungroup',\n labelKey: 'commands.annotate.ungroup',\n icon: 'ungroup',\n categories: ['annotations'],\n run: (commandContext) => void anno(commandContext)?.selection.ungroup(),\n visible: (commandContext) =>\n (anno(commandContext)?.selection.canUngroup() ?? false) && selectionEditable(commandContext),\n },\n\n // ── text selection (the selection strip's verbs) ────────────────────────\n {\n id: 'selection:copy',\n labelKey: 'commands.selection.copy',\n icon: 'copy',\n categories: ['text.copy'],\n // A deployment denying doc.text.copy shows no Copy at all — and with zero\n // visible commands the strip renders nothing, so there is never an empty\n // bubble. Ctrl/Cmd+C is the clipboard wiring's, which says it isn't allowed.\n allowed: (commandContext) => textSelection(commandContext)?.canCopy() ?? true,\n notAllowedKey: 'commands.notAllowed.doc-text-copy',\n visible: (commandContext) => textSelection(commandContext)?.hasSelection() ?? false,\n // Async Clipboard write inside the click's activation window; instant\n // when <SelectionClipboard>'s commit prefetch already fetched the text.\n // A successful copy consumes the selection, which also dismisses its strip.\n run: (commandContext) => {\n const selection = textSelection(commandContext);\n if (!selection) return;\n const copiedRange = selection.getRange();\n void copySelection(selection).then(\n (text) => {\n // Clipboard writes can outlive the click. Never let an older copy\n // completion clear a newer selection the user made in the meantime.\n if (text !== '' && sameTextRange(selection.getRange(), copiedRange)) selection.clear();\n },\n () => {}, // Copy failed: preserve the selection so the user can retry.\n );\n },\n },\n\n markupSelection(\n 'selection:highlight',\n 'highlight',\n 'commands.annotate.highlight',\n 'highlight',\n 'annotations.highlight',\n ),\n markupSelection(\n 'selection:underline',\n 'underline',\n 'commands.annotate.underline',\n 'underline',\n 'annotations.markup',\n ),\n markupSelection(\n 'selection:strikeout',\n 'strikeout',\n 'commands.annotate.strikeout',\n 'strikethrough',\n 'annotations.markup',\n ),\n\n // ── link strip items: Link / Go to link / Remove link ────────────────────\n {\n // Make the selection a link: opens the anchored popover (a link is a\n // verb on the selection, not a style), whose editor sets\n // the target through `selection.updateLink(target)`; the plugin's\n // reconciler materializes the attached child annotations.\n id: 'annotation:link',\n labelKey: 'commands.annotate.link',\n icon: 'link',\n categories: ['annotations.links'],\n run: (commandContext) => commandContext.tryGet(ShellToken)?.toggle('link-editor'),\n active: (commandContext) => commandContext.tryGet(ShellToken)?.isOpen('link-editor') ?? false,\n visible: (commandContext) => selectionLink(commandContext) === null,\n },\n {\n id: 'annotation:goto-link',\n labelKey: 'commands.annotate.gotoLink',\n icon: 'externalLink',\n // No feature: following a link is reading the document.\n run: (commandContext) => {\n const target = selectionLink(commandContext);\n // Following a link opens a website too, through the link layer's opener.\n if (target) commandContext.tryGet(LinkToken)?.activate(target);\n },\n visible: (commandContext) => selectionLink(commandContext) != null,\n },\n {\n id: 'annotation:remove-link',\n labelKey: 'commands.annotate.removeLink',\n icon: 'linkOff',\n categories: ['annotations.links'],\n run: (commandContext) => anno(commandContext)?.selection.updateLink(null),\n visible: (commandContext) => selectionLink(commandContext) != null,\n },\n\n // ── the keyboard ────────────────────────────────────────────────────────\n {\n // No feature: it only says which keys do what.\n id: 'help:shortcuts',\n labelKey: 'commands.shortcuts',\n shortcut: '?',\n modal: SHORTCUTS_DIALOG,\n enabled: (commandContext) => commandContext.tryGet(ShellToken) != null,\n },\n\n // ── history ──────────────────────────────────────────────────────────────\n // Focus in a text field keeps its own undo: shortcuts skip text fields.\n {\n id: 'history:undo',\n labelKey: 'commands.undo',\n icon: 'arrowBackUp',\n shortcut: 'Mod+z',\n run: (commandContext) => commandContext.tryGet(HistoryToken)?.undo(),\n enabled: (commandContext) => commandContext.tryGet(HistoryToken)?.canUndo() ?? false,\n },\n {\n id: 'history:redo',\n labelKey: 'commands.redo',\n icon: 'arrowForwardUp',\n shortcut: ['Shift+Mod+z', 'Mod+y'],\n run: (commandContext) => commandContext.tryGet(HistoryToken)?.redo(),\n enabled: (commandContext) => commandContext.tryGet(HistoryToken)?.canRedo() ?? false,\n },\n];\n\n// ── mode helpers ─────────────────────────────────────────────────────────────\n// Modes are exclusive shell surfaces tagged 'mode'; the secondary band renders\n// whichever one is open. Kept below the array to keep the list readable.\nexport const MODE_SURFACES = [\n 'mode:annotate',\n 'mode:shapes',\n 'mode:insert',\n 'mode:form',\n 'mode:redact',\n 'mode:measure',\n] as const;\n\nfunction modeCommand(\n id: (typeof MODE_SURFACES)[number],\n labelKey: string,\n { feature }: { feature?: Feature } = {},\n): CommandDef {\n return {\n id,\n labelKey,\n // The tab goes with its feature; a tab of several features stays.\n ...(feature ? { categories: [feature] } : {}),\n // A mode tab is a shell surface and a tool policy: every tab (and closing\n // one) drops back to the default pointer, where widgets are fill controls;\n // form design is `form:design`'s switch inside the Form tab.\n run: (commandContext) => {\n const shell = commandContext.tryGet(ShellToken);\n shell?.toggle(id, { exclusive: 'mode' });\n interaction(commandContext)?.activateTool('pointer');\n },\n active: (commandContext) => commandContext.tryGet(ShellToken)?.isOpen(id) ?? false,\n };\n}\n\n// ── your own tools ───────────────────────────────────────────────────────────\n\n/**\n * A `tool:<id>` command for each tool of yours (`plugins.annotation.tools`) that no command has\n * (`isTaken` says which ids do): labelled by its `meta.label`, else its id; drawn with its\n * `meta.icon`, else the icon of the tool it extends; in that tool's feature, else `annotations`.\n */\nexport function toolCommandsFor(\n tools: readonly AnnotationToolInput[],\n isTaken: (id: string) => boolean,\n): CommandDef[] {\n return tools.flatMap((input): CommandDef[] => {\n const id = `tool:${input.id}`;\n if (isTaken(id)) return [];\n const base = input.extends;\n const meta = input.meta ?? {};\n const icon = typeof meta.icon === 'string' ? meta.icon : base && TOOL_ICONS[base]?.icon;\n const command = toolCommand(id, input.id, icon || undefined, {\n feature: (base && TOOL_FEATURES[base]) || 'annotations',\n check: CREATES_ANNOTATIONS,\n ...(base && TOOL_ICONS[base]?.accent ? { accent: TOOL_ICONS[base].accent } : {}),\n });\n return [{ ...command, label: typeof meta.label === 'string' ? meta.label : input.id }];\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,MAAa,oBAAoB;;AAEjC,MAAa,uBAAuB;AAOpC,MAAM,gBAAgB,mBACpB,eAAe,OAAO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