@hamster-note/notes 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +116 -0
- package/dist/fonts/KaTeX_AMS-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_AMS-Regular.woff +0 -0
- package/dist/fonts/KaTeX_AMS-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Bold.woff +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Fraktur-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_Fraktur-Bold.woff +0 -0
- package/dist/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_Fraktur-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Fraktur-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_Main-Bold.woff +0 -0
- package/dist/fonts/KaTeX_Main-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-BoldItalic.ttf +0 -0
- package/dist/fonts/KaTeX_Main-BoldItalic.woff +0 -0
- package/dist/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-Italic.ttf +0 -0
- package/dist/fonts/KaTeX_Main-Italic.woff +0 -0
- package/dist/fonts/KaTeX_Main-Italic.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Main-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Main-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Math-BoldItalic.ttf +0 -0
- package/dist/fonts/KaTeX_Math-BoldItalic.woff +0 -0
- package/dist/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
- package/dist/fonts/KaTeX_Math-Italic.ttf +0 -0
- package/dist/fonts/KaTeX_Math-Italic.woff +0 -0
- package/dist/fonts/KaTeX_Math-Italic.woff2 +0 -0
- package/dist/fonts/KaTeX_SansSerif-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_SansSerif-Bold.woff +0 -0
- package/dist/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_SansSerif-Italic.ttf +0 -0
- package/dist/fonts/KaTeX_SansSerif-Italic.woff +0 -0
- package/dist/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
- package/dist/fonts/KaTeX_SansSerif-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_SansSerif-Regular.woff +0 -0
- package/dist/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Script-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Script-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Script-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size1-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size1-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size1-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size2-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size2-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size2-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size3-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size3-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size3-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size4-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size4-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size4-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Typewriter-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Typewriter-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
- package/dist/formula.css +1 -0
- package/dist/index.cjs +289 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +30357 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/BlockActionMenu.d.ts +55 -0
- package/dist/lib/BlockActionMenu.d.ts.map +1 -0
- package/dist/lib/BlockActionMenuTypes.d.ts +23 -0
- package/dist/lib/BlockActionMenuTypes.d.ts.map +1 -0
- package/dist/lib/BottomBlockControls.d.ts +17 -0
- package/dist/lib/BottomBlockControls.d.ts.map +1 -0
- package/dist/lib/CardInspector.d.ts +10 -0
- package/dist/lib/CardInspector.d.ts.map +1 -0
- package/dist/lib/CardLinkOverlay.d.ts +13 -0
- package/dist/lib/CardLinkOverlay.d.ts.map +1 -0
- package/dist/lib/LinkMentionMenu.d.ts +9 -0
- package/dist/lib/LinkMentionMenu.d.ts.map +1 -0
- package/dist/lib/NoteBlockEditingControls.d.ts +20 -0
- package/dist/lib/NoteBlockEditingControls.d.ts.map +1 -0
- package/dist/lib/NoteBlockFocus.d.ts +15 -0
- package/dist/lib/NoteBlockFocus.d.ts.map +1 -0
- package/dist/lib/NoteCalloutBlock.d.ts +10 -0
- package/dist/lib/NoteCalloutBlock.d.ts.map +1 -0
- package/dist/lib/NoteCardBlock.d.ts +10 -0
- package/dist/lib/NoteCardBlock.d.ts.map +1 -0
- package/dist/lib/NoteChecklistBlock.d.ts +10 -0
- package/dist/lib/NoteChecklistBlock.d.ts.map +1 -0
- package/dist/lib/NoteCodeEditorBlock.d.ts +10 -0
- package/dist/lib/NoteCodeEditorBlock.d.ts.map +1 -0
- package/dist/lib/NoteCollapsibleBlock.d.ts +10 -0
- package/dist/lib/NoteCollapsibleBlock.d.ts.map +1 -0
- package/dist/lib/NoteContent.d.ts +9 -0
- package/dist/lib/NoteContent.d.ts.map +1 -0
- package/dist/lib/NoteContentBlocks.d.ts +6 -0
- package/dist/lib/NoteContentBlocks.d.ts.map +1 -0
- package/dist/lib/NoteContentEditing.d.ts +58 -0
- package/dist/lib/NoteContentEditing.d.ts.map +1 -0
- package/dist/lib/NoteDirectoryBlock.d.ts +10 -0
- package/dist/lib/NoteDirectoryBlock.d.ts.map +1 -0
- package/dist/lib/NoteDrawingBlock.d.ts +10 -0
- package/dist/lib/NoteDrawingBlock.d.ts.map +1 -0
- package/dist/lib/NoteFormulaBlock.d.ts +10 -0
- package/dist/lib/NoteFormulaBlock.d.ts.map +1 -0
- package/dist/lib/NoteListBlock.d.ts +12 -0
- package/dist/lib/NoteListBlock.d.ts.map +1 -0
- package/dist/lib/NoteParagraphBlock.d.ts +12 -0
- package/dist/lib/NoteParagraphBlock.d.ts.map +1 -0
- package/dist/lib/NotePictureBlock.d.ts +10 -0
- package/dist/lib/NotePictureBlock.d.ts.map +1 -0
- package/dist/lib/NoteQuoteBlock.d.ts +11 -0
- package/dist/lib/NoteQuoteBlock.d.ts.map +1 -0
- package/dist/lib/NoteTableBlock.d.ts +5 -0
- package/dist/lib/NoteTableBlock.d.ts.map +1 -0
- package/dist/lib/NoteTextBlockLayouts.d.ts +27 -0
- package/dist/lib/NoteTextBlockLayouts.d.ts.map +1 -0
- package/dist/lib/NoteTextBlocks.d.ts +11 -0
- package/dist/lib/NoteTextBlocks.d.ts.map +1 -0
- package/dist/lib/NoteTodoBlock.d.ts +11 -0
- package/dist/lib/NoteTodoBlock.d.ts.map +1 -0
- package/dist/lib/PictureUploadMenuItem.d.ts +9 -0
- package/dist/lib/PictureUploadMenuItem.d.ts.map +1 -0
- package/dist/lib/SelectionPopover.d.ts +28 -0
- package/dist/lib/SelectionPopover.d.ts.map +1 -0
- package/dist/lib/TableDragHandle.d.ts +15 -0
- package/dist/lib/TableDragHandle.d.ts.map +1 -0
- package/dist/lib/TableOperationMenu.d.ts +16 -0
- package/dist/lib/TableOperationMenu.d.ts.map +1 -0
- package/dist/lib/blockContainerDom.d.ts +11 -0
- package/dist/lib/blockContainerDom.d.ts.map +1 -0
- package/dist/lib/blockContainerMove.d.ts +17 -0
- package/dist/lib/blockContainerMove.d.ts.map +1 -0
- package/dist/lib/blockConversion.d.ts +57 -0
- package/dist/lib/blockConversion.d.ts.map +1 -0
- package/dist/lib/blockDowngrade.d.ts +21 -0
- package/dist/lib/blockDowngrade.d.ts.map +1 -0
- package/dist/lib/blockDragBindingKey.d.ts +3 -0
- package/dist/lib/blockDragBindingKey.d.ts.map +1 -0
- package/dist/lib/blockDragDesktop.d.ts +13 -0
- package/dist/lib/blockDragDesktop.d.ts.map +1 -0
- package/dist/lib/blockDragDom.d.ts +24 -0
- package/dist/lib/blockDragDom.d.ts.map +1 -0
- package/dist/lib/blockDragTarget.d.ts +15 -0
- package/dist/lib/blockDragTarget.d.ts.map +1 -0
- package/dist/lib/blockDragTouch.d.ts +17 -0
- package/dist/lib/blockDragTouch.d.ts.map +1 -0
- package/dist/lib/blockEditing.d.ts +36 -0
- package/dist/lib/blockEditing.d.ts.map +1 -0
- package/dist/lib/blockSourceConversion.d.ts +41 -0
- package/dist/lib/blockSourceConversion.d.ts.map +1 -0
- package/dist/lib/blockSourceInsertion.d.ts +17 -0
- package/dist/lib/blockSourceInsertion.d.ts.map +1 -0
- package/dist/lib/blockSourceMove.d.ts +39 -0
- package/dist/lib/blockSourceMove.d.ts.map +1 -0
- package/dist/lib/blockSourceOperations.d.ts +37 -0
- package/dist/lib/blockSourceOperations.d.ts.map +1 -0
- package/dist/lib/blockSourceSplit.d.ts +4 -0
- package/dist/lib/blockSourceSplit.d.ts.map +1 -0
- package/dist/lib/cardData.d.ts +6 -0
- package/dist/lib/cardData.d.ts.map +1 -0
- package/dist/lib/cardGeometry.d.ts +14 -0
- package/dist/lib/cardGeometry.d.ts.map +1 -0
- package/dist/lib/drawingData.d.ts +37 -0
- package/dist/lib/drawingData.d.ts.map +1 -0
- package/dist/lib/editableSelection.d.ts +6 -0
- package/dist/lib/editableSelection.d.ts.map +1 -0
- package/dist/lib/externalNoteDrag.d.ts +55 -0
- package/dist/lib/externalNoteDrag.d.ts.map +1 -0
- package/dist/lib/externalNoteDropTarget.d.ts +11 -0
- package/dist/lib/externalNoteDropTarget.d.ts.map +1 -0
- package/dist/lib/index.d.ts +7 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/inlineFormulaRendering.d.ts +37 -0
- package/dist/lib/inlineFormulaRendering.d.ts.map +1 -0
- package/dist/lib/inlineMarkdownShortcut.d.ts +75 -0
- package/dist/lib/inlineMarkdownShortcut.d.ts.map +1 -0
- package/dist/lib/inlineSelectionFormatting.d.ts +164 -0
- package/dist/lib/inlineSelectionFormatting.d.ts.map +1 -0
- package/dist/lib/markdownShortcut.d.ts +71 -0
- package/dist/lib/markdownShortcut.d.ts.map +1 -0
- package/dist/lib/noteAtomicMutation.d.ts +5 -0
- package/dist/lib/noteAtomicMutation.d.ts.map +1 -0
- package/dist/lib/noteBoundarySplice.d.ts +6 -0
- package/dist/lib/noteBoundarySplice.d.ts.map +1 -0
- package/dist/lib/noteClipboardBlockCodec.d.ts +4 -0
- package/dist/lib/noteClipboardBlockCodec.d.ts.map +1 -0
- package/dist/lib/noteClipboardLimits.d.ts +4 -0
- package/dist/lib/noteClipboardLimits.d.ts.map +1 -0
- package/dist/lib/noteClipboardRegionSlice.d.ts +4 -0
- package/dist/lib/noteClipboardRegionSlice.d.ts.map +1 -0
- package/dist/lib/noteClipboardSlices.d.ts +35 -0
- package/dist/lib/noteClipboardSlices.d.ts.map +1 -0
- package/dist/lib/noteContentUndoRedo.d.ts +34 -0
- package/dist/lib/noteContentUndoRedo.d.ts.map +1 -0
- package/dist/lib/noteId.d.ts +3 -0
- package/dist/lib/noteId.d.ts.map +1 -0
- package/dist/lib/noteNestedMutation.d.ts +7 -0
- package/dist/lib/noteNestedMutation.d.ts.map +1 -0
- package/dist/lib/notePointerSelection.d.ts +6 -0
- package/dist/lib/notePointerSelection.d.ts.map +1 -0
- package/dist/lib/noteRegionCodec.d.ts +9 -0
- package/dist/lib/noteRegionCodec.d.ts.map +1 -0
- package/dist/lib/noteSelectAll.d.ts +2 -0
- package/dist/lib/noteSelectAll.d.ts.map +1 -0
- package/dist/lib/noteSelectionRestore.d.ts +14 -0
- package/dist/lib/noteSelectionRestore.d.ts.map +1 -0
- package/dist/lib/noteSnapshotMutation.d.ts +8 -0
- package/dist/lib/noteSnapshotMutation.d.ts.map +1 -0
- package/dist/lib/noteStructuredClipboard.d.ts +17 -0
- package/dist/lib/noteStructuredClipboard.d.ts.map +1 -0
- package/dist/lib/noteStructuredPaste.d.ts +10 -0
- package/dist/lib/noteStructuredPaste.d.ts.map +1 -0
- package/dist/lib/noteStructuredTail.d.ts +3 -0
- package/dist/lib/noteStructuredTail.d.ts.map +1 -0
- package/dist/lib/noteTextFlow.d.ts +23 -0
- package/dist/lib/noteTextFlow.d.ts.map +1 -0
- package/dist/lib/noteTextOffset.d.ts +4 -0
- package/dist/lib/noteTextOffset.d.ts.map +1 -0
- package/dist/lib/noteTransferReplacement.d.ts +10 -0
- package/dist/lib/noteTransferReplacement.d.ts.map +1 -0
- package/dist/lib/quoteLineEditing.d.ts +5 -0
- package/dist/lib/quoteLineEditing.d.ts.map +1 -0
- package/dist/lib/restrictedHtml.d.ts +7 -0
- package/dist/lib/restrictedHtml.d.ts.map +1 -0
- package/dist/lib/syntaxHighlight.d.ts +9 -0
- package/dist/lib/syntaxHighlight.d.ts.map +1 -0
- package/dist/lib/tableDragPreview.d.ts +15 -0
- package/dist/lib/tableDragPreview.d.ts.map +1 -0
- package/dist/lib/tableDragTarget.d.ts +13 -0
- package/dist/lib/tableDragTarget.d.ts.map +1 -0
- package/dist/lib/tableEditing.d.ts +35 -0
- package/dist/lib/tableEditing.d.ts.map +1 -0
- package/dist/lib/tableKeyboardNavigation.d.ts +14 -0
- package/dist/lib/tableKeyboardNavigation.d.ts.map +1 -0
- package/dist/lib/tableMoveFocus.d.ts +11 -0
- package/dist/lib/tableMoveFocus.d.ts.map +1 -0
- package/dist/lib/test-setup.d.ts +1 -0
- package/dist/lib/test-setup.d.ts.map +1 -0
- package/dist/lib/types.d.ts +302 -0
- package/dist/lib/types.d.ts.map +1 -0
- package/dist/lib/useBlockDrag.d.ts +11 -0
- package/dist/lib/useBlockDrag.d.ts.map +1 -0
- package/dist/lib/useBlockEditing.d.ts +9 -0
- package/dist/lib/useBlockEditing.d.ts.map +1 -0
- package/dist/lib/useDraggedTouchClickSuppression.d.ts +7 -0
- package/dist/lib/useDraggedTouchClickSuppression.d.ts.map +1 -0
- package/dist/lib/useExternalNoteDrag.d.ts +15 -0
- package/dist/lib/useExternalNoteDrag.d.ts.map +1 -0
- package/dist/lib/useTableMoveFocus.d.ts +11 -0
- package/dist/lib/useTableMoveFocus.d.ts.map +1 -0
- package/dist/lib/useTableOperationMenus.d.ts +19 -0
- package/dist/lib/useTableOperationMenus.d.ts.map +1 -0
- package/dist/lib/utils.d.ts +10 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/styles.css +1 -0
- package/package.json +105 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),p=require("react"),Gr=require("react-dom"),jt=require("@system-ui-js/multi-drag");function dn({children:e,className:t,size:n="medium",type:r="button",variant:i="secondary",...a}){return u.jsx("button",{className:["hn-button",`hn-button--${i}`,`hn-button--${n}`,t].filter(Boolean).join(" "),type:r,...a,children:e})}function Z1(e){return!(e.getAttribute("aria-hidden")==="true"||e.hasAttribute("hidden"))}function Rl(e){return Array.from(e.querySelectorAll('a[href], button:not([disabled]), input:not([disabled]):not([type="hidden"]), textarea:not([disabled]), select:not([disabled]), [tabindex]')).filter(t=>Z1(t))}function J1({open:e,onClose:t,closeOnEsc:n=!0,closeOnBackdrop:r=!0,exitDuration:i=180}){let[a,s]=p.useState("closed"),o=p.useRef(null),l=p.useRef(null),d=p.useRef(null),c=p.useRef(""),f=p.useRef(!1),g=p.useId(),y=p.useId(),x=p.useMemo(()=>e?a==="closed"||a==="leaving"?"entering":a:a==="entering"||a==="open"?"leaving":a,[e,a]);p.useEffect(()=>{if(x!=="entering")return;let S=setTimeout(()=>{s("open")},180);return()=>{clearTimeout(S)}},[x]),p.useEffect(()=>{if(x!=="leaving")return;let S=setTimeout(()=>{s("closed")},i);return()=>{clearTimeout(S)}},[x,i]),p.useEffect(()=>{if(x!=="entering"&&x!=="closed")return;if(x==="entering"){let R=document.activeElement;R instanceof HTMLElement&&(d.current=R),f.current||=(c.current=document.body.style.overflow,document.body.style.overflow="hidden",!0);let L=requestAnimationFrame(()=>{let P=o.current;if(P===null)return;let B=Rl(P);B.length>0?B[0]?.focus():P.focus()});return()=>{cancelAnimationFrame(L)}}let S=d.current;S!==null&&(document.contains(S)&&S.focus(),d.current=null),f.current&&=(document.body.style.overflow=c.current,c.current="",!1)},[x]),p.useEffect(()=>()=>{f.current&&=(document.body.style.overflow=c.current,c.current="",!1)},[]);let k=p.useRef(n),w=p.useRef(r),E=p.useRef(t);return p.useLayoutEffect(()=>{k.current=n,w.current=r,E.current=t}),{phase:x,mounted:x!=="closed",dataState:x==="leaving"?"exit":x==="entering"||x==="open"?"enter":void 0,panelRef:o,backdropRef:l,titleId:g,descriptionId:y,handlePanelKeyDown:S=>{if(k.current&&S.key==="Escape"){S.preventDefault(),E.current();return}if(S.key!=="Tab")return;let R=o.current;if(R===null)return;let L=Rl(R);if(L.length===0){S.preventDefault(),R.focus();return}let P=L[0],B=L[L.length-1];if(P===void 0||B===void 0)return;let O=document.activeElement;S.shiftKey?(O===P||O===R||!R.contains(O))&&(S.preventDefault(),B.focus()):(O===B||!R.contains(O))&&(S.preventDefault(),P.focus())},handleBackdropPointerDown:S=>{w.current&&S.target===l.current&&E.current()}}}function Q1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function td({children:e,className:t,title:n,description:r,open:i,onClose:a,placement:s="right",size:o,closeOnEsc:l=!0,closeOnBackdrop:d=!0,ref:c,style:f,...g}){let{dataState:y,mounted:x,backdropRef:k,panelRef:w,titleId:E,descriptionId:S,handlePanelKeyDown:R,handleBackdropPointerDown:L}=J1({open:i,onClose:a,closeOnEsc:l,closeOnBackdrop:d});if(!x||typeof document>"u")return null;let P=["hn-drawer__panel",`hn-drawer__panel--${s}`,t].filter(Boolean).join(" "),B={...o===void 0?{}:{"--hn-drawer-size":`${String(o)}px`},...f},O=n===void 0?void 0:E,_=r===void 0?void 0:S,F=$=>{w.current=$,typeof c=="function"?c($):c!=null&&(c.current=$)};return Gr.createPortal(u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"hn-drawer__backdrop","data-state":y,onPointerDown:L,ref:k}),u.jsxs("div",{...g,"aria-describedby":_,"aria-labelledby":O,"aria-modal":"true",className:P,"data-state":y,onKeyDown:R,ref:F,role:"dialog",style:B,tabIndex:-1,children:[n===void 0?null:u.jsx("h2",{className:"hn-drawer__title",id:E,children:n}),r===void 0?null:u.jsx("p",{className:"hn-drawer__description",id:S,children:r}),u.jsx("div",{className:"hn-drawer__content",children:e})]})]}),document.body)}var ef={file:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z"}),u.jsx("path",{d:"M14 3v5h5"}),u.jsx("path",{d:"M9 13h6"}),u.jsx("path",{d:"M9 17h6"})]}),save:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M5 4h11l3 3v13a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1z"}),u.jsx("path",{d:"M8 4v5h7V4"}),u.jsx("path",{d:"M8 14h8v7H8z"})]}),study:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M12 6c-1.5-1.2-3.5-2-6-2H3v13h3c2.5 0 4.5.8 6 2 1.5-1.2 3.5-2 6-2h3V4h-3c-2.5 0-4.5.8-6 2z"}),u.jsx("path",{d:"M12 6v13"}),u.jsx("path",{d:"M5.5 8.5h3"}),u.jsx("path",{d:"M5.5 11.5h3"}),u.jsx("path",{d:"M15.5 8.5h3"}),u.jsx("path",{d:"M15.5 11.5h3"})]}),switch:u.jsxs(u.Fragment,{children:[u.jsx("rect",{height:"12",rx:"6",width:"18",x:"3",y:"6"}),u.jsx("circle",{cx:"15",cy:"12",r:"3.2"})]}),mouse:u.jsxs(u.Fragment,{children:[u.jsx("rect",{height:"16",rx:"8",width:"11",x:"6.5",y:"4"}),u.jsx("path",{d:"M12 7v4"}),u.jsx("path",{d:"M12 7a1 1 0 0 1 1 1v2a1 1 0 0 1-2 0V8a1 1 0 0 1 1-1z"})]}),line:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M5 19L19 5"}),u.jsx("circle",{cx:"5",cy:"19",r:"1.2"}),u.jsx("circle",{cx:"19",cy:"5",r:"1.2"})]}),curve:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M4 18C4 12 9 12 12 12S20 12 20 6"}),u.jsx("circle",{cx:"4",cy:"18",r:"1.2"}),u.jsx("circle",{cx:"20",cy:"6",r:"1.2"})]}),polygon:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M12 4l7 5-2.5 9h-9L5 9z"}),u.jsx("circle",{cx:"12",cy:"4",r:"1.1"}),u.jsx("circle",{cx:"19",cy:"9",r:"1.1"}),u.jsx("circle",{cx:"16.5",cy:"18",r:"1.1"}),u.jsx("circle",{cx:"7.5",cy:"18",r:"1.1"}),u.jsx("circle",{cx:"5",cy:"9",r:"1.1"})]}),lasso:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M9 6.5c3.5-2 8.5-.5 9 2.5s-2 6.5-6 6.5-7.5-2-7-5.5 2-3 4-3.5z"}),u.jsx("path",{d:"M8 15.5c.5 2.5-.5 4.5-3.5 4.5"}),u.jsx("circle",{cx:"4.5",cy:"20",r:"1.2"})]}),rectangle:u.jsx(u.Fragment,{children:u.jsx("rect",{height:"12",rx:"1.5",width:"16",x:"4",y:"6"})}),ellipse:u.jsx(u.Fragment,{children:u.jsx("ellipse",{cx:"12",cy:"12",rx:"8",ry:"6"})}),pen:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M4 20l3.5-1 11-11-2.5-2.5-11 11-1 3.5z"}),u.jsx("path",{d:"M14.5 6.5l3 3"}),u.jsx("path",{d:"M4 20l1-3.5"})]}),eraser:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M15 4l5 5-9 9H6l-2-2 9-9z"}),u.jsx("path",{d:"M9 10l5 5"}),u.jsx("path",{d:"M13 20h7"})]}),magnet:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M4 10v3a6 6 0 0 0 12 0V5a1 1 0 0 0-1-1h-3a1 1 0 0 0-1 1v8a1 1 0 0 1-2 0V5a1 1 0 0 0-1-1H5a1 1 0 0 0-1 1z"}),u.jsx("path",{d:"M11 4h4"}),u.jsx("path",{d:"M4 10h4"})]}),locate:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M12 21s-7-6.2-7-11a7 7 0 0 1 14 0c0 4.8-7 11-7 11z"}),u.jsx("circle",{cx:"12",cy:"10",r:"2.5"})]}),delete:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M4 7h16"}),u.jsx("path",{d:"M9 7V5a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2"}),u.jsx("path",{d:"M6 7l1 13a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1l1-13"}),u.jsx("path",{d:"M10 11v6"}),u.jsx("path",{d:"M14 11v6"})]}),add:u.jsxs(u.Fragment,{children:[u.jsx("circle",{cx:"12",cy:"12",r:"9"}),u.jsx("path",{d:"M12 8v8"}),u.jsx("path",{d:"M8 12h8"})]}),copy:u.jsxs(u.Fragment,{children:[u.jsx("rect",{height:"13",rx:"1.5",width:"10",x:"8",y:"8"}),u.jsx("path",{d:"M11 8V5a1 1 0 0 1 1-1h7a1 1 0 0 1 1 1v11a1 1 0 0 1-1 1h-3"}),u.jsx("path",{d:"M11 12h4"}),u.jsx("path",{d:"M11 15h4"})]}),paste:u.jsxs(u.Fragment,{children:[u.jsx("rect",{height:"15",rx:"1.5",width:"12",x:"6",y:"5"}),u.jsx("path",{d:"M9 5V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v1"}),u.jsx("path",{d:"M11 11h2"}),u.jsx("path",{d:"M11 14h2"})]}),info:u.jsxs(u.Fragment,{children:[u.jsx("circle",{cx:"12",cy:"12",r:"9"}),u.jsx("path",{d:"M12 11v5"}),u.jsx("circle",{cx:"12",cy:"8",r:"0.5",fill:"currentColor",stroke:"none"})]}),touch:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M9 11V5.5a1.5 1.5 0 0 1 3 0V11"}),u.jsx("path",{d:"M12 11v-.5a1.5 1.5 0 0 1 3 0V12"}),u.jsx("path",{d:"M15 12v-.5a1.5 1.5 0 0 1 3 0v5.5a5 5 0 0 1-5 5h-2a5 5 0 0 1-4-2l-3-4a1.5 1.5 0 0 1 2.4-1.8L9 16V9a1.5 1.5 0 0 1 0 0v2"}),u.jsx("path",{d:"M6 4.5a3 3 0 0 1 1-3"})]}),edit:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M14 5l5 5L8 21H3v-5z"}),u.jsx("path",{d:"M12 7l5 5"}),u.jsx("path",{d:"M3 21h18"})]}),keyboard:u.jsxs(u.Fragment,{children:[u.jsx("rect",{height:"12",rx:"1.5",width:"20",x:"2",y:"6"}),u.jsx("path",{d:"M6 10h0"}),u.jsx("path",{d:"M10 10h0"}),u.jsx("path",{d:"M14 10h0"}),u.jsx("path",{d:"M18 10h0"}),u.jsx("path",{d:"M6 14h12"})]}),type:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M5 6h14"}),u.jsx("path",{d:"M12 6v13"}),u.jsx("path",{d:"M9 19h6"}),u.jsx("path",{d:"M16 13l1.5 4 .3.8a2 2 0 0 0 1.7 1.2c1.2 0 2-1 2-2.2 0-.8-.4-1.6-1-2.4L18 12"})]}),handle:u.jsxs(u.Fragment,{children:[u.jsx("circle",{cx:"9",cy:"6",r:"1.4",fill:"currentColor",stroke:"none"}),u.jsx("circle",{cx:"15",cy:"6",r:"1.4",fill:"currentColor",stroke:"none"}),u.jsx("circle",{cx:"9",cy:"12",r:"1.4",fill:"currentColor",stroke:"none"}),u.jsx("circle",{cx:"15",cy:"12",r:"1.4",fill:"currentColor",stroke:"none"}),u.jsx("circle",{cx:"9",cy:"18",r:"1.4",fill:"currentColor",stroke:"none"}),u.jsx("circle",{cx:"15",cy:"18",r:"1.4",fill:"currentColor",stroke:"none"})]}),card:u.jsxs(u.Fragment,{children:[u.jsx("rect",{height:"14",rx:"2",width:"18",x:"3",y:"5"}),u.jsx("path",{d:"M3 10h18"}),u.jsx("path",{d:"M7 14h6"}),u.jsx("path",{d:"M7 17h4"})]}),search:u.jsxs(u.Fragment,{children:[u.jsx("circle",{cx:"11",cy:"11",r:"7"}),u.jsx("path",{d:"M21 21l-4.3-4.3"})]}),close:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M6 6l12 12"}),u.jsx("path",{d:"M18 6L6 18"})]}),check:u.jsx(u.Fragment,{children:u.jsx("path",{d:"M5 12.5l4.5 4.5L19 7.5"})}),"chevron-down":u.jsx(u.Fragment,{children:u.jsx("path",{d:"M6 9l6 6 6-6"})}),"chevron-up":u.jsx(u.Fragment,{children:u.jsx("path",{d:"M6 15l6-6 6 6"})}),"chevron-left":u.jsx(u.Fragment,{children:u.jsx("path",{d:"M15 6l-6 6 6 6"})}),"chevron-right":u.jsx(u.Fragment,{children:u.jsx("path",{d:"M9 6l6 6-6 6"})}),"arrow-up":u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M12 19V5"}),u.jsx("path",{d:"M6 11l6-6 6 6"})]}),"arrow-down":u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M12 5v14"}),u.jsx("path",{d:"M6 13l6 6 6-6"})]}),"arrow-left":u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M19 12H5"}),u.jsx("path",{d:"M11 6l-6 6 6 6"})]}),"arrow-right":u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M5 12h14"}),u.jsx("path",{d:"M13 6l6 6-6 6"})]}),settings:u.jsxs(u.Fragment,{children:[u.jsx("circle",{cx:"12",cy:"12",r:"3"}),u.jsx("path",{d:"M12 2.5v3"}),u.jsx("path",{d:"M12 18.5v3"}),u.jsx("path",{d:"M21.5 12h-3"}),u.jsx("path",{d:"M5.5 12h-3"}),u.jsx("path",{d:"M18.7 5.3l-2.1 2.1"}),u.jsx("path",{d:"M7.4 16.6l-2.1 2.1"}),u.jsx("path",{d:"M18.7 18.7l-2.1-2.1"}),u.jsx("path",{d:"M7.4 7.4L5.3 5.3"})]}),user:u.jsxs(u.Fragment,{children:[u.jsx("circle",{cx:"12",cy:"8",r:"4"}),u.jsx("path",{d:"M4 20c0-4 4-6 8-6s8 2 8 6"})]}),home:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M4 11l8-7 8 7"}),u.jsx("path",{d:"M6 10v9a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1v-9"}),u.jsx("path",{d:"M10 20v-5h4v5"})]}),star:u.jsx(u.Fragment,{children:u.jsx("path",{d:"M12 3.5l2.6 5.3 5.9.9-4.3 4.1 1 5.8L12 17.9l-5.2 2.6 1-5.8L3.5 9.7l5.9-.9z"})}),bookmark:u.jsx(u.Fragment,{children:u.jsx("path",{d:"M6 4h12a1 1 0 0 1 1 1v15l-7-4-7 4V5a1 1 0 0 1 1-1z"})}),link:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M9 15l6-6"}),u.jsx("path",{d:"M10.5 6.5l1-1a3.5 3.5 0 0 1 5 5l-1 1"}),u.jsx("path",{d:"M13.5 17.5l-1 1a3.5 3.5 0 0 1-5-5l1-1"})]}),image:u.jsxs(u.Fragment,{children:[u.jsx("rect",{height:"16",rx:"1.5",width:"18",x:"3",y:"4"}),u.jsx("circle",{cx:"8.5",cy:"9.5",r:"1.5"}),u.jsx("path",{d:"M4 17l5-5 4 4 3-3 4 4"})]}),calendar:u.jsxs(u.Fragment,{children:[u.jsx("rect",{height:"16",rx:"1.5",width:"18",x:"3",y:"5"}),u.jsx("path",{d:"M3 9h18"}),u.jsx("path",{d:"M8 3v4"}),u.jsx("path",{d:"M16 3v4"}),u.jsx("path",{d:"M7 13h2"}),u.jsx("path",{d:"M11 13h2"}),u.jsx("path",{d:"M15 13h2"})]}),clock:u.jsxs(u.Fragment,{children:[u.jsx("circle",{cx:"12",cy:"12",r:"9"}),u.jsx("path",{d:"M12 7v5l3.5 2"})]}),bell:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M6 17h12l-1.2-2V11a4.8 4.8 0 0 0-9.6 0v4z"}),u.jsx("path",{d:"M10 17a2 2 0 0 0 4 0"}),u.jsx("path",{d:"M12 5v1.5"})]}),download:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M12 4v10"}),u.jsx("path",{d:"M8 10l4 4 4-4"}),u.jsx("path",{d:"M4 19h16"})]}),upload:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M12 16V6"}),u.jsx("path",{d:"M8 10l4-4 4 4"}),u.jsx("path",{d:"M4 19h16"})]}),share:u.jsxs(u.Fragment,{children:[u.jsx("circle",{cx:"6",cy:"12",r:"2.5"}),u.jsx("circle",{cx:"18",cy:"6",r:"2.5"}),u.jsx("circle",{cx:"18",cy:"18",r:"2.5"}),u.jsx("path",{d:"M8.2 10.8l7.6-3.6"}),u.jsx("path",{d:"M8.2 13.2l7.6 3.6"})]}),undo:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M9 7L4 12l5 5"}),u.jsx("path",{d:"M4 12h11a5 5 0 0 1 0 10h-3"})]}),redo:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M15 7l5 5-5 5"}),u.jsx("path",{d:"M20 12H9a5 5 0 0 0 0 10h3"})]}),"zoom-in":u.jsxs(u.Fragment,{children:[u.jsx("circle",{cx:"11",cy:"11",r:"7"}),u.jsx("path",{d:"M21 21l-4.3-4.3"}),u.jsx("path",{d:"M11 8v6"}),u.jsx("path",{d:"M8 11h6"})]}),"zoom-out":u.jsxs(u.Fragment,{children:[u.jsx("circle",{cx:"11",cy:"11",r:"7"}),u.jsx("path",{d:"M21 21l-4.3-4.3"}),u.jsx("path",{d:"M8 11h6"})]}),menu:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M4 7h16"}),u.jsx("path",{d:"M4 12h16"}),u.jsx("path",{d:"M4 17h16"})]}),more:u.jsxs(u.Fragment,{children:[u.jsx("circle",{cx:"12",cy:"5",r:"1.4",fill:"currentColor",stroke:"none"}),u.jsx("circle",{cx:"12",cy:"12",r:"1.4",fill:"currentColor",stroke:"none"}),u.jsx("circle",{cx:"12",cy:"19",r:"1.4",fill:"currentColor",stroke:"none"})]}),filter:u.jsx(u.Fragment,{children:u.jsx("path",{d:"M4 5h16l-6 8v6l-4-2v-4z"})}),sort:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M8 4v16"}),u.jsx("path",{d:"M5 7l3-3 3 3"}),u.jsx("path",{d:"M11 17l-3 3-3-3"}),u.jsx("path",{d:"M14 8h6"}),u.jsx("path",{d:"M14 12h6"}),u.jsx("path",{d:"M14 16h6"})]})};function ss({label:e,name:t,className:n,...r}){return u.jsx("svg",{className:["hn-icon",`hn-icon--${t}`,n].filter(Boolean).join(" "),fill:"none",focusable:"false",height:"1em",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...e===void 0?{"aria-hidden":!0}:{"aria-label":e,role:"img"},...r,children:ef[t]})}var tf={position:"fixed",top:0,left:0,visibility:"hidden"},nf={top:"bottom",bottom:"top",left:"right",right:"left"};function rf(e){let[t,n]=e.split("-");return{side:t,align:n}}function af(e,t,n,r,i,a,s){let o=window.innerWidth,l=window.innerHeight,{side:d,align:c}=rf(r),f=k=>{switch(k){case"bottom":return e.bottom+i+n>l-s;case"top":return e.top-i-n<s;case"right":return e.right+i+t>o-s;case"left":return e.left-i-t<s}},g=d;if(f(d)){let k=nf[d];f(k)||(g=k)}let y=0,x=0;switch(g){case"bottom":y=e.bottom+i;break;case"top":y=e.top-i-n;break;case"right":x=e.right+i;break;case"left":x=e.left-i-t;break}return g==="top"||g==="bottom"?(x=c==="start"?e.left:e.right-t,x+=a):(y=c==="start"?e.top:e.bottom-n,y+=a),x=Math.min(Math.max(x,s),Math.max(s,o-t-s)),y=Math.min(Math.max(y,s),Math.max(s,l-n-s)),{left:x,top:y}}function sf({anchor:e,placement:t="bottom-start",offset:n=6,crossOffset:r=0,viewportMargin:i=8}){let a=p.useRef(null),[s,o]=p.useState(tf);return p.useLayoutEffect(()=>{if(e===null)return;let l=()=>{let c=a.current;if(c===null)return;let{left:f,top:g}=af(e.getBoundingClientRect(),c.offsetWidth,c.offsetHeight,t,n,r,i);o({position:"fixed",left:f,top:g})};l(),window.addEventListener("resize",l),window.addEventListener("scroll",l,!0);let d=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>{l()});return d?.observe(e),a.current!==null&&d?.observe(a.current),()=>{window.removeEventListener("resize",l),window.removeEventListener("scroll",l,!0),d?.disconnect()}},[e,t,n,r,i]),{floatingRef:a,style:s}}var nd=p.createContext(null);function of(e){return e==="vertical"?"horizontal":"vertical"}function lf(e,t,n){if(e===void 0)return{};let r=n?"absolute":"fixed";switch(e){case"top":return{position:r,top:t,left:"50%",transform:"translateX(-50%)"};case"bottom":return{position:r,bottom:t,left:"50%",transform:"translateX(-50%)"};case"left":return{position:r,left:t,top:"50%",transform:"translateY(-50%)"};case"right":return{position:r,right:t,top:"50%",transform:"translateY(-50%)"}}}function Is({children:e,className:t,theme:n="dark",orientation:r="horizontal",edge:i,edgeOffset:a=16,relative:s=!1,anchor:o=null,placement:l="bottom-start",anchorOffset:d=6,viewportMargin:c=8,ref:f,style:g,...y}){let x=o!==null,{floatingRef:k,style:w}=sf({anchor:o,placement:l,offset:d,viewportMargin:c}),E=["hn-popover",x?"hn-popover--floating":void 0,t].filter(Boolean).join(" "),S=x?{...w,...g}:{...lf(i,a,s),...g},R=P=>{k.current=P,typeof f=="function"?f(P):f!=null&&(f.current=P)},L=u.jsx(nd.Provider,{value:r,children:u.jsx("div",{...y,className:E,"data-theme":n,"data-orientation":r,ref:R,style:S,children:e})});return x&&typeof document<"u"?Gr.createPortal(L,document.body):L}function Ba({className:e,...t}){let n=["hn-popover__separator",e].filter(Boolean).join(" "),r=p.useContext(nd);return u.jsx("hr",{...t,"aria-orientation":of(r),className:n})}const Vt=e=>{throw new Error(`Unhandled note block: ${JSON.stringify(e)}`)},cf={info:"Info",success:"Ready",warning:"Watch"},io=[{kind:"heading",level:1,label:"H1"},{kind:"heading",level:2,label:"H2"},{kind:"heading",level:3,label:"H3"},{kind:"heading",level:4,label:"H4"},{kind:"heading",level:5,label:"H5"},{kind:"paragraph",label:"正文"},{kind:"todo",label:"Todo"},{kind:"unorderedList",label:"Unordered List"},{kind:"orderedList",label:"Ordered List"},{kind:"quote",label:"Quote"},{kind:"code",label:"Code"},{kind:"callout",label:"Callout"},{kind:"table",label:"Table"},{kind:"formula",label:"公式"},{kind:"directory",label:"目录"},{kind:"collapsible",label:"Collapsible"},{kind:"card",label:"卡片"},{kind:"drawing",label:"Drawing"}],uf=(e,t,n)=>e.kind==="heading"?t==="heading"&&n===e.level:t===e.kind,Il=e=>{switch(e.kind){case"heading":return{kind:"heading",level:e.level};case"paragraph":case"todo":case"unorderedList":case"orderedList":case"quote":case"code":case"callout":case"table":case"formula":case"directory":case"collapsible":case"card":case"drawing":return{kind:e.kind};default:return Vt(e)}},df=(e,t)=>{switch(e){case"heading":return`标题 ${t??1}`;case"paragraph":return"正文";case"todo":return"Todo";case"unorderedList":return"Unordered List";case"orderedList":return"Ordered List";case"quote":return"Quote";case"code":return"Code";case"callout":return"Callout";case"card":return"卡片";case"table":return"Table";case"formula":return"公式";case"picture":return"图片";case"drawing":return"Drawing";case"directory":return"目录";case"collapsible":return"Collapsible";case"checklist":return"Checklist";default:return Vt(e)}},hf=e=>new Promise((t,n)=>{const r=new FileReader;r.addEventListener("load",()=>{if(typeof r.result=="string"){t(r.result);return}n(new Error("Picture could not be read as a data URL."))}),r.addEventListener("error",()=>n(r.error??new Error("Picture could not be read."))),r.readAsDataURL(e)}),ff=async e=>typeof globalThis.createImageBitmap!="function"?{width:void 0,height:void 0}:globalThis.createImageBitmap(e).then(t=>{const n={width:t.width,height:t.height};return t.close(),n},()=>({width:void 0,height:void 0})),mf=({buttonRef:e,onPictureUpload:t})=>{const n=p.useRef(null),[r,i]=p.useState("idle"),a=o=>{const l=o.currentTarget,d=l.files?.[0];l.value="",d&&(i("uploading"),Promise.all([hf(d),ff(d)]).then(([c,f])=>t({base64:c,filename:d.name,...f})).catch(()=>i("failed")))},s=r==="uploading"?"上传中…":r==="failed"?"上传失败,重试":"图片";return u.jsxs(u.Fragment,{children:[u.jsx("button",{ref:e,type:"button",role:"menuitem",className:"hn-note-block-menu-item","aria-busy":r==="uploading","aria-disabled":r==="uploading",tabIndex:-1,onClick:()=>{r!=="uploading"&&n.current?.click()},children:u.jsx("span",{className:"hn-note-block-menu-item-label","aria-live":"polite","aria-atomic":"true",children:s})}),u.jsx("input",{ref:n,className:"hn-note-picture-input",type:"file",accept:"image/*",tabIndex:-1,"aria-hidden":"true",onChange:a})]})},pf=e=>e instanceof Element?e:e.parentElement,os=e=>{const n=pf(e)?.closest("[contenteditable]")??null;return n?.getAttribute("contenteditable")==="true"?n:null},rd=(e,t)=>{const n=e.querySelectorAll("[data-editable-block-id]");for(const r of n)if(r.getAttribute("data-editable-block-id")===t)return r;return null},Nl=(e,t)=>{if(!t.contains(e.startContainer)||!t.contains(e.endContainer))return!1;const n=os(e.startContainer),r=os(e.endContainer);return n!==null&&r!==null&&t.contains(n)&&t.contains(r)},gf=e=>{const t=os(e.startContainer),n=os(e.endContainer);return t!==null&&n!==null&&t!==n},vf=(e,t)=>{const n=t.contains(e.startContainer),r=t.contains(e.endContainer),i=document.createRange();if(i.selectNodeContents(t),e.compareBoundaryPoints(Range.END_TO_START,i)>0||e.compareBoundaryPoints(Range.START_TO_END,i)<0)return null;const a=document.createRange();return n||e.compareBoundaryPoints(Range.START_TO_START,i)>=0?a.setStart(e.startContainer,e.startOffset):a.setStart(t,0),r||e.compareBoundaryPoints(Range.END_TO_END,i)<=0?a.setEnd(e.endContainer,e.endOffset):a.setEnd(t,t.childNodes.length),a.collapsed?null:a},Ns=(e,t,n)=>{const r=t.querySelectorAll('[contenteditable="true"]'),i=[];for(const a of r){if(a.closest("[data-note-atomic-id]"))continue;const s=vf(e,a);s!==null&&i.push({sub:s,root:a})}for(const{sub:a,root:s}of i)n(a,s)},la=(e,t,n)=>{const r=rd(n??document,e);if(!r)return;r.focus();const i=document.createRange();i.selectNodeContents(r),i.collapse(t==="start");const a=window.getSelection();a?.removeAllRanges(),a?.addRange(i)},yf=e=>{const[t,n]=p.useState(null),r=p.useCallback((a,s)=>{setTimeout(()=>la(a,s,e.current),0)},[e]),i=p.useCallback((a,s)=>{n(o=>s?a:o===a?null:o)},[]);return{openBlockMenuId:t,requestFocus:r,handleBlockMenuOpenChange:i}},Ll=800,_r=8,Pl=6,Oa=9999,Dl=0,bf=1,xf=2,Uo="hn:block-action-menu-trigger",wf=(e,t)=>{e.dispatchEvent(new CustomEvent(Uo,{detail:t}))},Bl=({open:e,onOpenChange:t,blockId:n,kind:r,headingLevel:i,onSelect:a,onPictureUpload:s,mode:o="convert",onDelete:l,onDuplicate:d})=>{const[c,f]=p.useState({display:"none"}),[g,y]=p.useState({display:"none"}),[x,k]=p.useState(!1),w=p.useRef(null),E=p.useRef(null),S=p.useRef(null),R=p.useRef(null),L=p.useRef(null),P=p.useRef([]),B=p.useRef([]),O=p.useCallback(se=>{w.current=se},[]),_=se=>uf(se,r,i),F=(se=w.current)=>{if(!se)return{display:"none"};const Le=se.getBoundingClientRect();return window.innerWidth>Ll?{position:"fixed",top:Le.top,left:Le.right+_r,zIndex:Oa}:{position:"fixed",top:Le.bottom+_r,left:"50%",transform:"translateX(-50%)",zIndex:Oa}},$=()=>{const se=L.current;if(!se)return{display:"none"};const Le=se.getBoundingClientRect();return window.innerWidth>Ll?{position:"fixed",top:Le.top,left:Le.right+Pl,zIndex:Oa}:{position:"fixed",top:Le.bottom+Pl,left:"50%",transform:"translateX(-50%)",zIndex:Oa}},j=(se=w.current)=>{e?t(!1):(f(F(se)),t(!0))},D=p.useEffectEvent(se=>{E.current=se,j(se)});p.useEffect(()=>{const se=w.current;if(!se)return;const Le=he=>{he instanceof CustomEvent&&he.detail instanceof HTMLElement&&D(he.detail)};return se.addEventListener(Uo,Le),()=>se.removeEventListener(Uo,Le)},[]);const q=se=>{if(_(se))return;const Le=a(Il(se));t(!1),setTimeout(()=>la(Le,"end"),0)},K=()=>{if(!l)return;const se=l();t(!1),se&&setTimeout(()=>la(se,"end"),0)},fe=()=>{if(!d)return;const se=d();t(!1),se&&setTimeout(()=>la(se,"end"),0)},de=()=>{y($()),k(!0)},Ce=p.useCallback(()=>{k(!1),L.current?.focus()},[]);p.useEffect(()=>{if(!e)return;const se=S.current;if(se){const he=se.getBoundingClientRect(),Ne=Math.min(Math.max(he.top,_r),Math.max(_r,window.innerHeight-he.height-_r));Ne!==he.top&&f(Te=>({...Te,top:Ne}))}if(o==="add"){const he=window.setTimeout(()=>{S.current?.focus()},0);return()=>window.clearTimeout(he)}k(!1);const Le=window.setTimeout(()=>{P.current[Dl]?.focus()},0);return()=>window.clearTimeout(Le)},[e,o]),p.useEffect(()=>{if(!x)return;const se=R.current;if(se){const he=se.getBoundingClientRect(),Ne=Math.min(Math.max(he.top,_r),Math.max(_r,window.innerHeight-he.height-_r));Ne!==he.top&&y(Te=>({...Te,top:Ne}))}const Le=window.setTimeout(()=>{R.current?.focus()},0);return()=>window.clearTimeout(Le)},[x]),p.useEffect(()=>{if(!e)return;const se=Ne=>{const Te=Ne.target;Te&&(w.current?.contains(Te)||E.current?.contains(Te)||S.current?.contains(Te)||R.current?.contains(Te)||t(!1))},Le=Ne=>{if(Ne.key!=="Escape")return;if(Ne.stopPropagation(),x){Ce();return}t(!1);const Te=E.current;Te?.isConnected?Te.focus():w.current?.focus()},he=()=>t(!1);return document.addEventListener("mousedown",se),document.addEventListener("keydown",Le),window.addEventListener("scroll",he,!0),window.addEventListener("resize",he),()=>{document.removeEventListener("mousedown",se),document.removeEventListener("keydown",Le),window.removeEventListener("scroll",he,!0),window.removeEventListener("resize",he)}},[e,t,x,Ce]);const oe=se=>{if(se.key!=="ArrowDown"&&se.key!=="ArrowUp")return;se.preventDefault();const Le=document.activeElement instanceof HTMLButtonElement?document.activeElement:null,he=P.current,Ne=he.indexOf(Le),Te=he.length;if(Te===0)return;const et=se.key==="ArrowDown"?1:-1,Oe=Ne===-1?0:(Ne+et+Te)%Te;he[Oe]?.focus()},Ee=se=>{if(se.key!=="ArrowDown"&&se.key!=="ArrowUp")return;se.preventDefault();const Le=document.activeElement instanceof HTMLButtonElement?document.activeElement:null,he=B.current,Ne=he.indexOf(Le),Te=he.length;if(Te===0)return;const et=se.key==="ArrowDown"?1:-1,Oe=Ne===-1?0:(Ne+et+Te)%Te;he[Oe]?.focus()},ze=se=>{se.key!=="Enter"&&se.key},ge=df(r,i),We=o==="convert"?`更改区块格式,当前为${ge}`:"在当前区块下方插入新行",Pe=()=>x?u.jsxs("div",{ref:R,className:"hn-note-block-menu hn-note-block-menu-submenu",role:"menu","aria-label":"转换成",tabIndex:-1,style:g,onKeyDown:Ee,children:[io.map((se,Le)=>{const he=_(se);return u.jsxs("button",{ref:Ne=>{B.current[Le]=Ne},type:"button",role:"menuitem",className:["hn-note-block-menu-item",he?"hn-note-block-menu-item--active":""].filter(Boolean).join(" "),"aria-disabled":he,"aria-current":he?"true":void 0,tabIndex:-1,onClick:()=>q(se),children:[u.jsx("span",{className:"hn-note-block-menu-item-label",children:se.label}),he?u.jsx("span",{className:"hn-note-block-menu-check","aria-hidden":"true",children:"✓"}):null]},se.label)}),s?u.jsx(mf,{buttonRef:se=>{B.current[io.length]=se},onPictureUpload:s}):null]}):null,st=e?u.jsxs(u.Fragment,{children:[u.jsx("div",{ref:S,className:"hn-note-block-menu",role:"menu","aria-label":o==="convert"?"区块格式选项":"插入新区块类型",tabIndex:o==="add"?-1:void 0,style:c,onKeyDown:oe,children:o==="convert"?u.jsxs(u.Fragment,{children:[u.jsxs("button",{ref:se=>{P.current[Dl]=se,L.current=se},type:"button",role:"menuitem",className:"hn-note-block-menu-item hn-note-block-menu-item--has-submenu","aria-haspopup":"menu","aria-expanded":x,tabIndex:-1,onClick:de,onKeyDown:ze,children:[u.jsx("span",{className:"hn-note-block-menu-item-label",children:"转换成"}),u.jsx("span",{className:"hn-note-block-menu-submenu-arrow","aria-hidden":"true",children:"›"})]}),u.jsxs("button",{ref:se=>{P.current[bf]=se},type:"button",role:"menuitem",className:"hn-note-block-menu-item hn-note-block-menu-item--danger",tabIndex:-1,onClick:K,children:[u.jsx(ss,{name:"delete","aria-hidden":"true"}),u.jsx("span",{className:"hn-note-block-menu-item-label",children:"删除"})]}),u.jsx("button",{ref:se=>{P.current[xf]=se},type:"button",role:"menuitem",className:"hn-note-block-menu-item",tabIndex:-1,onClick:fe,children:u.jsx("span",{className:"hn-note-block-menu-item-label",children:"创建副本"})})]}):io.map((se,Le)=>u.jsx("button",{ref:he=>{P.current[Le]=he},type:"button",role:"menuitem",className:["hn-note-block-menu-item",""].filter(Boolean).join(" "),tabIndex:-1,onClick:()=>{const he=a(Il(se));t(!1),setTimeout(()=>la(he,"end"),0)},children:u.jsx("span",{className:"hn-note-block-menu-item-label",children:se.label})},se.label))}),o==="convert"?Gr.createPortal(Pe(),document.body):null]}):null;return p.useEffect(()=>{!e&&x&&k(!1)},[e,x]),p.useEffect(()=>{e||(P.current=[],B.current=[])},[e]),u.jsxs(u.Fragment,{children:[u.jsx("button",{ref:O,type:"button",className:["hn-note-block-handle",`hn-note-block-handle--${o}`,e?"hn-note-block-handle--open":""].filter(Boolean).join(" "),"aria-haspopup":"menu","aria-expanded":e,"aria-label":We,"data-block-id":n,"data-block-menu-mode":o,onClick:()=>{E.current=null,j()},children:u.jsx("span",{className:o==="convert"?"hn-note-block-handle-glyph":void 0,"aria-hidden":"true",children:o==="convert"?"⋮⋮":"+"})}),st?Gr.createPortal(st,document.body):null]})},Wo=(e,t)=>e.querySelector(`:scope > [data-block-menu-mode="${t}"]`),id=(e,t)=>{if(!(e instanceof Element)||!t.contains(e))return null;const n=e.closest(".hn-note-block");if(!n||!t.contains(n))return null;const r=Wo(n,"add"),i=Wo(n,"convert"),a=r?.getAttribute("data-block-id");return!r||!i||!a?null:{sourceId:a,addLabel:r.ariaLabel??"在当前区块下方插入新行",convertLabel:i.ariaLabel??"更改当前区块",addExpanded:r.ariaExpanded==="true",convertExpanded:i.ariaExpanded==="true"}},kf=(e,t)=>{const n=e.querySelectorAll(".hn-note-block");for(const r of n){const i=Wo(r,"add");if(t===null||i?.getAttribute("data-block-id")===t)return id(r,e)}return null},Sf=({shellRef:e,target:t})=>{const n=(r,i)=>{const a=e.current;if(!a||!t)return;const s=a.querySelectorAll(`.hn-note-body [data-block-menu-mode="${r}"]`);for(const o of s)if(o.getAttribute("data-block-id")===t.sourceId){wf(o,i);return}};return u.jsxs(u.Fragment,{children:[u.jsx(dn,{type:"button",size:"small",variant:"ghost",className:"hn-note-bottom-control","aria-haspopup":"menu","aria-expanded":t?.addExpanded??!1,"aria-label":t?.addLabel??"在当前区块下方插入新行","data-block-id":t?.sourceId,"data-block-menu-mode":"add",disabled:!t,onClick:r=>n("add",r.currentTarget),children:u.jsx(ss,{name:"add","aria-hidden":"true"})}),u.jsx(dn,{type:"button",size:"small",variant:"ghost",className:"hn-note-bottom-control","aria-haspopup":"menu","aria-expanded":t?.convertExpanded??!1,"aria-label":t?.convertLabel??"更改当前区块","data-block-id":t?.sourceId,"data-block-menu-mode":"convert",disabled:!t,onClick:r=>n("convert",r.currentTarget),children:u.jsx(ss,{name:"handle","aria-hidden":"true"})})]})},gt=()=>{const e=globalThis.crypto;if(typeof e?.randomUUID=="function")return e.randomUUID();if(!e)throw new Error("Web Crypto API is not available in this environment");const t=new Uint8Array(16);e.getRandomValues(t),t[6]=(t[6]??0)&15|64,t[8]=(t[8]??0)&63|128;const n=Array.from(t,r=>r.toString(16).padStart(2,"0"));return[n.slice(0,4).join(""),n.slice(4,6).join(""),n.slice(6,8).join(""),n.slice(8,10).join(""),n.slice(10,16).join("")].join("-")},Ef=(e,t,n,r)=>{switch(e.kind){case"todo":{if(t.kind==="todo")return e;const i=e.items[0];return{id:e.id,kind:t.kind,text:i?.text??""}}case"unorderedList":case"orderedList":return t.kind===e.kind?e:t.kind==="todo"?{id:e.id,kind:"todo",title:"",items:[{id:n??gt(),checked:!1,text:e.text}]}:{id:e.id,kind:t.kind,text:e.text};default:return t.kind==="todo"?{id:e.id,kind:"todo",title:"",items:[{id:n??gt(),checked:!1,text:r}]}:{id:e.id,kind:t.kind,text:r}}},Tf=(e,t,n)=>e.kind==="todo"&&(t.kind==="unorderedList"||t.kind==="orderedList")?e.items.map((r,i)=>({id:i===0?e.id:r.id,kind:t.kind,text:r.text})):[ad(e,t,n)],Mf=(e,t)=>{switch(t.kind){case"heading":return{id:e.id,kind:"heading",level:t.level,text:e.text};case"paragraph":return{id:e.id,kind:"paragraph",text:e.text};default:return Vt(t)}},ci=e=>e.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">"),Ol=e=>ci(e).replaceAll(`
|
|
2
|
+
`,"<br>"),Cf=(e,t)=>{switch(t){case"amp":return"&";case"lt":return"<";case"gt":return">";case"quot":return'"';case"#39":case"apos":return"'";case"nbsp":return" ";default:return t.startsWith("#x")?String.fromCodePoint(Number.parseInt(t.slice(2),16)):t.startsWith("#")?String.fromCodePoint(Number.parseInt(t.slice(1),10)):`&${t};`}},zl=e=>e.replace(/<br\s*\/?>/giu,`
|
|
3
|
+
`).replace(/<\/(?:div|p|li|blockquote|h[1-6])>/giu,`
|
|
4
|
+
`).replace(/<[^>]+>/gu,"").replace(/&([^;]+);/gu,Cf).replace(/\n{3,}/gu,`
|
|
5
|
+
|
|
6
|
+
`).trim(),Af=e=>{switch(e.kind){case"heading":case"paragraph":return e.text;case"todo":case"checklist":return[`<strong>${ci(e.title)}</strong>`,...e.items.map(t=>`${t.checked?"[x]":"[ ]"} ${t.text}`)].join("<br>");case"unorderedList":case"orderedList":return e.text;case"quote":{const t=e.author?.trim();return t?`${e.text}<br>${ci(t)}`:e.text}case"callout":return`<strong>${ci(e.title)}</strong><br>${e.text}`;case"code":{const t=e.filename?.trim(),n=t?`${t} (${e.language})`:e.language;return`<strong>${ci(n)}</strong><br>${Ol(e.code)}`}case"table":return e.rows.flatMap(t=>t.map(n=>n)).join("<br>");case"formula":return Ol(e.formula);case"picture":return ci(e.filename);case"card":return e.data.length>0?e.data.map(t=>ci(t.title)).join("<br>"):"[Cards]";case"drawing":return"[Drawing]";case"collapsible":return e.title;case"directory":return"";default:return Vt(e)}},ad=(e,t,n)=>{if(e.kind===t.kind)return e.kind!=="heading"||t.kind!=="heading"?e:Mf(e,t);const r=Af(e);switch(t.kind){case"heading":return{id:e.id,kind:"heading",level:t.level,text:r};case"paragraph":return{id:e.id,kind:"paragraph",text:r};case"todo":case"unorderedList":case"orderedList":return Ef(e,t,n,r);case"quote":return{id:e.id,kind:"quote",text:r};case"code":return{id:e.id,kind:"code",language:"text",code:zl(r)};case"callout":return{id:e.id,kind:"callout",tone:"info",title:"Note",text:r};case"table":return{id:e.id,kind:"table",rows:[[r]]};case"formula":return{id:e.id,kind:"formula",formula:zl(r)};case"directory":return{id:e.id,kind:"directory"};case"card":return{id:e.id,kind:"card",data:[]};case"drawing":return{id:e.id,kind:"drawing",data:""};case"collapsible":return{id:e.id,kind:"collapsible",title:r,collapsed:!1,blocks:[]};default:return Vt(t)}},Rf=/^(?:\s*<br>\s*)+|(?:\s*<br>\s*)+$/giu,jl=(e,t)=>{switch(e.kind){case"heading":return{id:e.id,kind:"heading",level:e.level,text:t};case"paragraph":return{id:e.id,kind:"paragraph",text:t,...e.tone===void 0?{}:{tone:e.tone}};case"unorderedList":return{id:e.id,kind:"unorderedList",text:t};case"orderedList":return{id:e.id,kind:"orderedList",text:t};default:return Vt(e)}},sd=(e,t)=>{switch(e.kind){case"heading":return{id:e.id,kind:"heading",level:e.level,text:t};case"paragraph":return{id:e.id,kind:"paragraph",text:t};case"unorderedList":return{id:e.id,kind:"unorderedList",text:t};case"orderedList":return{id:e.id,kind:"orderedList",text:t};default:return Vt(e)}},hn=e=>e.trim().replace(/\u200B/gu,"").replace(/<\s*br\s*\/?>/giu,"<br>").replace(/<\s*(?:div|p)\b[^>]*>/giu,"<br>").replace(/<\s*\/\s*(?:div|p)\s*>/giu,"").replace(Rf,""),Xr=e=>hn(e).replace(/<br>/giu,"").replace(/<[^>]*>/gu,"").replace(/ /giu," ").trim().length===0,If=({afterHtml:e,beforeHtml:t,block:n,nextId:r})=>{const i=hn(t),a=hn(e),s=jl(n,i),o=jl({...n,id:r},a);return[s,o]},Nf=({afterHtml:e,beforeHtml:t,items:n,nextId:r,sourceId:i})=>{const a=n.findIndex(l=>l.id===i);if(a<0)return n;const s=n[a];if(s===void 0)return n;const o=n.slice();return o.splice(a,1,{...s,text:hn(t)},{id:r,checked:!1,text:hn(e)}),o},Lf=(e,t)=>e.find(n=>n.kind!=="todo"?!1:n.items.some(r=>r.id===t)),Pf=(e,t,n)=>({...e,items:e.items.map(r=>r.id===t?{...r,text:n}:r)}),Df=(e,t)=>({...e,items:e.items.filter(n=>n.id!==t)}),Bf=({blocks:e,blockId:t,todoItemId:n,nextId:r,target:i})=>{const a=e.findIndex(l=>l.id===t);if(a<0)return[...e];const s=ad({id:r,kind:"paragraph",text:""},i,n),o=[...e];return o.splice(a+1,0,s),o},Of=({afterHtml:e,beforeHtml:t,blocks:n,nextId:r,sourceId:i})=>n.flatMap(a=>{switch(a.kind){case"heading":case"paragraph":{if(a.id!==i)return[a];const[s,o]=If({afterHtml:e,beforeHtml:t,block:a,nextId:r});return[sd(s,s.text),{id:o.id,kind:"paragraph",text:o.text}]}case"unorderedList":case"orderedList":return a.id!==i?[a]:[{...a,text:hn(t)},{...a,id:r,text:hn(e)}];case"todo":case"checklist":return[{...a,items:Nf({afterHtml:e,beforeHtml:t,items:a.items,nextId:r,sourceId:i})}];case"quote":return a.id!==i?[a]:[{...a,text:hn(t)},{...a,id:r,text:hn(e)}];case"callout":case"code":case"table":case"formula":case"picture":case"card":case"drawing":case"directory":return[a];case"collapsible":return[a];default:return Vt(a)}}),zf=({blocks:e,currentHtml:t,sourceId:n})=>{const r=hn(t),i=Lf(e,n);if(i)return Xr(r)?i.items.length>1?e.map(s=>s.id===i.id?Df(i,n):s):e.map(s=>s.id===i.id?{id:i.id,kind:"paragraph",text:""}:s):e.map(s=>s.id===i.id?Pf(i,n,r):s);if(!Xr(r))return e.map(s=>{if(s.id!==n)return s;switch(s.kind){case"heading":case"paragraph":return sd(s,r);case"quote":case"callout":case"unorderedList":case"orderedList":return{...s,text:r};case"code":return{...s,code:t};case"todo":case"table":case"formula":case"picture":case"card":case"drawing":case"directory":return s;case"collapsible":case"checklist":return{...s,title:r};default:return Vt(s)}});const a=e.find(s=>s.id===n);return a?.kind==="unorderedList"||a?.kind==="orderedList"?e.map(s=>s.id===n?{id:n,kind:"paragraph",text:""}:s):a?.kind==="quote"&&a.author?.trim()||a?.kind==="callout"&&a.title.trim()||a?.kind==="code"&&a.filename?.trim()?e.map(s=>s.id!==n?s:s.kind==="quote"||s.kind==="callout"?{...s,text:""}:s.kind==="code"?{...s,code:""}:s):e.length===1?[{id:n,kind:"paragraph",text:""}]:e.filter(s=>s.id!==n)};class re extends Error{constructor(t,n){var r="KaTeX parse error: "+t,i,a,s=n&&n.loc;if(s&&s.start<=s.end){var o=s.lexer.input;i=s.start,a=s.end,i===o.length?r+=" at end of input: ":r+=" at position "+(i+1)+": ";var l=o.slice(i,a).replace(/[^]/g,"$&̲"),d;i>15?d="…"+o.slice(i-15,i):d=o.slice(0,i);var c;a+15<o.length?c=o.slice(a,a+15)+"…":c=o.slice(a),r+=d+l+c}super(r),this.name="ParseError",this.position=void 0,this.length=void 0,this.rawMessage=void 0,Object.setPrototypeOf(this,re.prototype),this.position=i,i!=null&&a!=null&&(this.length=a-i),this.rawMessage=t}}var jf=/([A-Z])/g,Ff=e=>e.replace(jf,"-$1").toLowerCase(),_f={"&":"&",">":">","<":"<",'"':""","'":"'"},$f=/[&><"']/g,fn=e=>String(e).replace($f,t=>_f[t]),is=e=>e.type==="ordgroup"||e.type==="color"?e.body.length===1?is(e.body[0]):e:e.type==="font"?is(e.body):e,Hf=new Set(["mathord","textord","atom"]),Ar=e=>Hf.has(is(e).type),qf=e=>{var t=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(e);return t?t[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(t[1])?null:t[1].toLowerCase():"_relative"},Go={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format <type>"},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color <color>",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:e=>"#"+e},macros:{type:"object",cli:"-m, --macro <def>",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(e,t)=>(t.push(e),t)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:e=>Math.max(0,e),cli:"--min-rule-thickness <size>",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:e=>Math.max(0,e),cli:"-s, --max-size <n>",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:e=>Math.max(0,e),cli:"-e, --max-expand <n>",cliProcessor:e=>e==="Infinity"?1/0:parseInt(e)},globalGroup:{type:"boolean",cli:!1}};function Uf(e){if(typeof e!="string")return e.enum[0];switch(e){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{};default:throw new Error("Unexpected schema type; settings must declare an explicit default.")}}function Wf(e){if(e.default!==void 0)return e.default;var t=Array.isArray(e.type)?e.type[0]:e.type;return Uf(t)}function Gf(e,t,n,r){var i=n[t];e[t]=i!==void 0?r.processor?r.processor(i):i:Wf(r)}class C0{constructor(t){t===void 0&&(t={}),this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,t=t||{};for(var n of Object.keys(Go)){var r=Go[n];r&&Gf(this,n,t,r)}}reportNonstrict(t,n,r){var i=this.strict;if(typeof i=="function"&&(i=i(t,n,r)),!(!i||i==="ignore")){if(i===!0||i==="error")throw new re("LaTeX-incompatible input and strict mode is set to 'error': "+(n+" ["+t+"]"),r);i==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(n+" ["+t+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+i+"': "+n+" ["+t+"]"))}}useStrictBehavior(t,n,r){var i=this.strict;if(typeof i=="function")try{i=i(t,n,r)}catch{i="error"}return!i||i==="ignore"?!1:i===!0||i==="error"?!0:i==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(n+" ["+t+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+i+"': "+n+" ["+t+"]")),!1)}isTrusted(t){if("url"in t&&t.url&&!t.protocol){var n=qf(t.url);if(n==null)return!1;t.protocol=n}var r=typeof this.trust=="function"?this.trust(t):this.trust;return!!r}}class $r{constructor(t,n,r){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=t,this.size=n,this.cramped=r}sup(){return rr[Xf[this.id]]}sub(){return rr[Vf[this.id]]}fracNum(){return rr[Yf[this.id]]}fracDen(){return rr[Kf[this.id]]}cramp(){return rr[Zf[this.id]]}text(){return rr[Jf[this.id]]}isTight(){return this.size>=2}}var A0=0,ls=1,Fi=2,Er=3,pa=4,_n=5,$i=6,bn=7,rr=[new $r(A0,0,!1),new $r(ls,0,!0),new $r(Fi,1,!1),new $r(Er,1,!0),new $r(pa,2,!1),new $r(_n,2,!0),new $r($i,3,!1),new $r(bn,3,!0)],Xf=[pa,_n,pa,_n,$i,bn,$i,bn],Vf=[_n,_n,_n,_n,bn,bn,bn,bn],Yf=[Fi,Er,pa,_n,$i,bn,$i,bn],Kf=[Er,Er,_n,_n,bn,bn,bn,bn],Zf=[ls,ls,Er,Er,_n,_n,bn,bn],Jf=[A0,ls,Fi,Er,Fi,Er,Fi,Er],Ue={DISPLAY:rr[A0],TEXT:rr[Fi],SCRIPT:rr[pa],SCRIPTSCRIPT:rr[$i]},Xo=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];function Qf(e){for(var t=0;t<Xo.length;t++)for(var n=Xo[t],r=0;r<n.blocks.length;r++){var i=n.blocks[r];if(e>=i[0]&&e<=i[1])return n.name}return null}var as=[];Xo.forEach(e=>e.blocks.forEach(t=>as.push(...t)));function od(e){for(var t=0;t<as.length;t+=2)if(e>=as[t]&&e<=as[t+1])return!0;return!1}var Qt=e=>e+" "+e,Ri=80,em=function(t,n){return"M95,"+(622+t+n)+`
|
|
7
|
+
c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14
|
|
8
|
+
c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54
|
|
9
|
+
c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10
|
|
10
|
+
s173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429
|
|
11
|
+
c69,-144,104.5,-217.7,106.5,-221
|
|
12
|
+
l`+t/2.075+" -"+t+`
|
|
13
|
+
c5.3,-9.3,12,-14,20,-14
|
|
14
|
+
H400000v`+(40+t)+`H845.2724
|
|
15
|
+
s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7
|
|
16
|
+
c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z
|
|
17
|
+
M`+(834+t)+" "+n+"h400000v"+(40+t)+"h-400000z"},tm=function(t,n){return"M263,"+(601+t+n)+`c0.7,0,18,39.7,52,119
|
|
18
|
+
c34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120
|
|
19
|
+
c340,-704.7,510.7,-1060.3,512,-1067
|
|
20
|
+
l`+t/2.084+" -"+t+`
|
|
21
|
+
c4.7,-7.3,11,-11,19,-11
|
|
22
|
+
H40000v`+(40+t)+`H1012.3
|
|
23
|
+
s-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232
|
|
24
|
+
c-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1
|
|
25
|
+
s-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26
|
|
26
|
+
c-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z
|
|
27
|
+
M`+(1001+t)+" "+n+"h400000v"+(40+t)+"h-400000z"},nm=function(t,n){return"M983 "+(10+t+n)+`
|
|
28
|
+
l`+t/3.13+" -"+t+`
|
|
29
|
+
c4,-6.7,10,-10,18,-10 H400000v`+(40+t)+`
|
|
30
|
+
H1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7
|
|
31
|
+
s-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744
|
|
32
|
+
c-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30
|
|
33
|
+
c26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722
|
|
34
|
+
c56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5
|
|
35
|
+
c53.7,-170.3,84.5,-266.8,92.5,-289.5z
|
|
36
|
+
M`+(1001+t)+" "+n+"h400000v"+(40+t)+"h-400000z"},rm=function(t,n){return"M424,"+(2398+t+n)+`
|
|
37
|
+
c-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514
|
|
38
|
+
c0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20
|
|
39
|
+
s-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121
|
|
40
|
+
s209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081
|
|
41
|
+
l`+t/4.223+" -"+t+`c4,-6.7,10,-10,18,-10 H400000
|
|
42
|
+
v`+(40+t)+`H1014.6
|
|
43
|
+
s-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185
|
|
44
|
+
c-2,6,-10,9,-24,9
|
|
45
|
+
c-8,0,-12,-0.7,-12,-2z M`+(1001+t)+" "+n+`
|
|
46
|
+
h400000v`+(40+t)+"h-400000z"},im=function(t,n){return"M473,"+(2713+t+n)+`
|
|
47
|
+
c339.3,-1799.3,509.3,-2700,510,-2702 l`+t/5.298+" -"+t+`
|
|
48
|
+
c3.3,-7.3,9.3,-11,18,-11 H400000v`+(40+t)+`H1017.7
|
|
49
|
+
s-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9
|
|
50
|
+
c-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200
|
|
51
|
+
c0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26
|
|
52
|
+
s76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104,
|
|
53
|
+
606zM`+(1001+t)+" "+n+"h400000v"+(40+t)+"H1017.7z"},am=function(t){var n=t/2;return"M400000 "+t+" H0 L"+n+" 0 l65 45 L145 "+(t-80)+" H400000z"},sm=function(t,n,r){var i=r-54-n-t;return"M702 "+(t+n)+"H400000"+(40+t)+`
|
|
54
|
+
H742v`+i+`l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1
|
|
55
|
+
h-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170
|
|
56
|
+
c-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667
|
|
57
|
+
219 661 l218 661zM702 `+n+"H400000v"+(40+t)+"H742z"},om=function(t,n,r){n=1e3*n;var i="";switch(t){case"sqrtMain":i=em(n,Ri);break;case"sqrtSize1":i=tm(n,Ri);break;case"sqrtSize2":i=nm(n,Ri);break;case"sqrtSize3":i=rm(n,Ri);break;case"sqrtSize4":i=im(n,Ri);break;case"sqrtTall":i=sm(n,Ri,r)}return i},lm=function(t,n){switch(t){case"⎜":return Qt("M291 0 H417 V"+n+" H291z");case"∣":return Qt("M145 0 H188 V"+n+" H145z");case"∥":return Qt("M145 0 H188 V"+n+" H145z")+Qt("M367 0 H410 V"+n+" H367z");case"⎟":return Qt("M457 0 H583 V"+n+" H457z");case"⎢":return Qt("M319 0 H403 V"+n+" H319z");case"⎥":return Qt("M263 0 H347 V"+n+" H263z");case"⎪":return Qt("M384 0 H504 V"+n+" H384z");case"⏐":return Qt("M312 0 H355 V"+n+" H312z");case"‖":return Qt("M257 0 H300 V"+n+" H257z")+Qt("M478 0 H521 V"+n+" H478z");default:return""}},Fl={doubleleftarrow:`M262 157
|
|
58
|
+
l10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3
|
|
59
|
+
0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28
|
|
60
|
+
14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5
|
|
61
|
+
c2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5
|
|
62
|
+
157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87
|
|
63
|
+
-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7
|
|
64
|
+
-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z
|
|
65
|
+
m8 0v40h399730v-40zm0 194v40h399730v-40z`,doublerightarrow:`M399738 392l
|
|
66
|
+
-10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5
|
|
67
|
+
14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88
|
|
68
|
+
-33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68
|
|
69
|
+
-17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18
|
|
70
|
+
-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782
|
|
71
|
+
c-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3
|
|
72
|
+
-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z`,leftarrow:`M400000 241H110l3-3c68.7-52.7 113.7-120
|
|
73
|
+
135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8
|
|
74
|
+
-5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247
|
|
75
|
+
c-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208
|
|
76
|
+
490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3
|
|
77
|
+
1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202
|
|
78
|
+
l-3-3h399890zM100 241v40h399900v-40z`,leftbrace:`M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117
|
|
79
|
+
-45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7
|
|
80
|
+
5-6 9-10 13-.7 1-7.3 1-20 1H6z`,leftbraceunder:`M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13
|
|
81
|
+
35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688
|
|
82
|
+
0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7
|
|
83
|
+
-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z`,leftgroup:`M400000 80
|
|
84
|
+
H435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0
|
|
85
|
+
435 0h399565z`,leftgroupunder:`M400000 262
|
|
86
|
+
H435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219
|
|
87
|
+
435 219h399565z`,leftharpoon:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3
|
|
88
|
+
-3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5
|
|
89
|
+
-18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7
|
|
90
|
+
-196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z`,leftharpoonplus:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5
|
|
91
|
+
20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3
|
|
92
|
+
-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7
|
|
93
|
+
-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z
|
|
94
|
+
m0 0v40h400000v-40z`,leftharpoondown:`M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333
|
|
95
|
+
5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5
|
|
96
|
+
1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667
|
|
97
|
+
-152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z`,leftharpoondownplus:`M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12
|
|
98
|
+
10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7
|
|
99
|
+
-2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0
|
|
100
|
+
v40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z`,lefthook:`M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5
|
|
101
|
+
-83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3
|
|
102
|
+
-68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21
|
|
103
|
+
71.5 23h399859zM103 281v-40h399897v40z`,leftlinesegment:Qt("M40 281 V428 H0 V94 H40 V241 H400000 v40z"),leftbracketunder:Qt("M0 0 h120 V290 H399995 v120 H0z"),leftbracketover:Qt("M0 440 h120 V150 H399995 v-120 H0z"),leftmapsto:Qt("M40 281 V448H0V74H40V241H400000v40z"),leftToFrom:`M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23
|
|
104
|
+
-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8
|
|
105
|
+
c28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3
|
|
106
|
+
68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z`,longequal:Qt("M0 50 h400000 v40H0z m0 194h40000v40H0z"),midbrace:`M200428 334
|
|
107
|
+
c-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14
|
|
108
|
+
-53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7
|
|
109
|
+
311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11
|
|
110
|
+
12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z`,midbraceunder:`M199572 214
|
|
111
|
+
c100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14
|
|
112
|
+
53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3
|
|
113
|
+
11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0
|
|
114
|
+
-5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z`,oiintSize1:`M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6
|
|
115
|
+
-320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z
|
|
116
|
+
m368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8
|
|
117
|
+
60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z`,oiintSize2:`M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8
|
|
118
|
+
-451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z
|
|
119
|
+
m502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2
|
|
120
|
+
c0 110 84 276 504 276s502.4-166 502.4-276z`,oiiintSize1:`M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6
|
|
121
|
+
-480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z
|
|
122
|
+
m525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0
|
|
123
|
+
85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z`,oiiintSize2:`M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8
|
|
124
|
+
-707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z
|
|
125
|
+
m770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1
|
|
126
|
+
c0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z`,rightarrow:`M0 241v40h399891c-47.3 35.3-84 78-110 128
|
|
127
|
+
-16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20
|
|
128
|
+
11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7
|
|
129
|
+
39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85
|
|
130
|
+
-40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5
|
|
131
|
+
-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67
|
|
132
|
+
151.7 139 205zm0 0v40h399900v-40z`,rightbrace:`M400000 542l
|
|
133
|
+
-6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5
|
|
134
|
+
s-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1
|
|
135
|
+
c124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z`,rightbraceunder:`M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3
|
|
136
|
+
28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237
|
|
137
|
+
-174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z`,rightgroup:`M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0
|
|
138
|
+
3-1 3-3v-38c-76-158-257-219-435-219H0z`,rightgroupunder:`M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18
|
|
139
|
+
0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z`,rightharpoon:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3
|
|
140
|
+
-3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2
|
|
141
|
+
-10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58
|
|
142
|
+
69.2 92 94.5zm0 0v40h399900v-40z`,rightharpoonplus:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11
|
|
143
|
+
-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7
|
|
144
|
+
2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z
|
|
145
|
+
m0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z`,rightharpoondown:`M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8
|
|
146
|
+
8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5
|
|
147
|
+
-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95
|
|
148
|
+
-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z`,rightharpoondownplus:`M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8
|
|
149
|
+
15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3
|
|
150
|
+
8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3
|
|
151
|
+
-64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z
|
|
152
|
+
m0-194v40h400000v-40zm0 0v40h400000v-40z`,righthook:`M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3
|
|
153
|
+
15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0
|
|
154
|
+
-13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21
|
|
155
|
+
66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z`,rightlinesegment:Qt("M399960 241 V94 h40 V428 h-40 V281 H0 v-40z"),rightbracketunder:Qt("M399995 0 h-120 V290 H0 v120 H400000z"),rightbracketover:Qt("M399995 440 h-120 V150 H0 v-120 H399995z"),rightToFrom:`M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23
|
|
156
|
+
1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32
|
|
157
|
+
-52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142
|
|
158
|
+
-167z M100 147v40h399900v-40zM0 341v40h399900v-40z`,twoheadleftarrow:`M0 167c68 40
|
|
159
|
+
115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69
|
|
160
|
+
-70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3
|
|
161
|
+
-40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19
|
|
162
|
+
-37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101
|
|
163
|
+
10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z`,twoheadrightarrow:`M400000 167
|
|
164
|
+
c-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3
|
|
165
|
+
41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42
|
|
166
|
+
18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333
|
|
167
|
+
-19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70
|
|
168
|
+
101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z`,tilde1:`M200 55.538c-77 0-168 73.953-177 73.953-3 0-7
|
|
169
|
+
-2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0
|
|
170
|
+
114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0
|
|
171
|
+
4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128
|
|
172
|
+
-68.267.847-113-73.952-191-73.952z`,tilde2:`M344 55.266c-142 0-300.638 81.316-311.5 86.418
|
|
173
|
+
-8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9
|
|
174
|
+
31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114
|
|
175
|
+
c1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751
|
|
176
|
+
181.476 676 181.476c-149 0-189-126.21-332-126.21z`,tilde3:`M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457
|
|
177
|
+
-11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0
|
|
178
|
+
411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697
|
|
179
|
+
16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696
|
|
180
|
+
-338 0-409-156.573-744-156.573z`,tilde4:`M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345
|
|
181
|
+
-11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409
|
|
182
|
+
177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9
|
|
183
|
+
14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409
|
|
184
|
+
-175.236-744-175.236z`,vec:`M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5
|
|
185
|
+
3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11
|
|
186
|
+
10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63
|
|
187
|
+
-1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1
|
|
188
|
+
-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59
|
|
189
|
+
H213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359
|
|
190
|
+
c-16-25.333-24-45-24-59z`,widehat1:`M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22
|
|
191
|
+
c-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z`,widehat2:`M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10
|
|
192
|
+
-11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat3:`M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10
|
|
193
|
+
-11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat4:`M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10
|
|
194
|
+
-11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widecheck1:`M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1,
|
|
195
|
+
-5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z`,widecheck2:`M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
|
|
196
|
+
-11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck3:`M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
|
|
197
|
+
-11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck4:`M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
|
|
198
|
+
-11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,baraboveleftarrow:`M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202
|
|
199
|
+
c4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5
|
|
200
|
+
c-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130
|
|
201
|
+
s-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47
|
|
202
|
+
121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6
|
|
203
|
+
s2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11
|
|
204
|
+
c0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z
|
|
205
|
+
M100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z`,rightarrowabovebar:`M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32
|
|
206
|
+
-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0
|
|
207
|
+
13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39
|
|
208
|
+
-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5
|
|
209
|
+
-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5
|
|
210
|
+
-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67
|
|
211
|
+
151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z`,baraboveshortleftharpoon:`M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11
|
|
212
|
+
c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17
|
|
213
|
+
c2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21
|
|
214
|
+
c-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40
|
|
215
|
+
c-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z
|
|
216
|
+
M0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z`,rightharpoonaboveshortbar:`M0,241 l0,40c399126,0,399993,0,399993,0
|
|
217
|
+
c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,
|
|
218
|
+
-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6
|
|
219
|
+
c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z
|
|
220
|
+
M0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z`,shortbaraboveleftharpoon:`M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11
|
|
221
|
+
c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9,
|
|
222
|
+
1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7,
|
|
223
|
+
-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z
|
|
224
|
+
M93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z`,shortrightharpoonabovebar:`M53,241l0,40c398570,0,399437,0,399437,0
|
|
225
|
+
c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,
|
|
226
|
+
-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6
|
|
227
|
+
c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z
|
|
228
|
+
M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z`},cm=function(t,n){switch(t){case"lbrack":return"M403 1759 V84 H666 V0 H319 V1759 v"+n+` v1759 v84 h347 v-84
|
|
229
|
+
H403z M403 1759 V0 H319 V1759 v`+n+" v1759 v84 h84z";case"rbrack":return"M347 1759 V0 H0 V84 H263 V1759 v"+n+` v1759 H0 v84 H347z
|
|
230
|
+
M347 1759 V0 H263 V1759 v`+n+" v1759 h84z";case"vert":return"M145 15 v585 v"+n+` v585 c2.667,10,9.667,15,21,15
|
|
231
|
+
c10,0,16.667,-5,20,-15 v-585 v`+-n+` v-585 c-2.667,-10,-9.667,-15,-21,-15
|
|
232
|
+
c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+n+" v585 h43z";case"doublevert":return"M145 15 v585 v"+n+` v585 c2.667,10,9.667,15,21,15
|
|
233
|
+
c10,0,16.667,-5,20,-15 v-585 v`+-n+` v-585 c-2.667,-10,-9.667,-15,-21,-15
|
|
234
|
+
c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+n+` v585 h43z
|
|
235
|
+
M367 15 v585 v`+n+` v585 c2.667,10,9.667,15,21,15
|
|
236
|
+
c10,0,16.667,-5,20,-15 v-585 v`+-n+` v-585 c-2.667,-10,-9.667,-15,-21,-15
|
|
237
|
+
c-10,0,-16.667,5,-20,15z M410 15 H367 v585 v`+n+" v585 h43z";case"lfloor":return"M319 602 V0 H403 V602 v"+n+` v1715 h263 v84 H319z
|
|
238
|
+
MM319 602 V0 H403 V602 v`+n+" v1715 H319z";case"rfloor":return"M319 602 V0 H403 V602 v"+n+` v1799 H0 v-84 H319z
|
|
239
|
+
MM319 602 V0 H403 V602 v`+n+" v1715 H319z";case"lceil":return"M403 1759 V84 H666 V0 H319 V1759 v"+n+` v602 h84z
|
|
240
|
+
M403 1759 V0 H319 V1759 v`+n+" v602 h84z";case"rceil":return"M347 1759 V0 H0 V84 H263 V1759 v"+n+` v602 h84z
|
|
241
|
+
M347 1759 V0 h-84 V1759 v`+n+" v602 h84z";case"lparen":return`M863,9c0,-2,-2,-5,-6,-9c0,0,-17,0,-17,0c-12.7,0,-19.3,0.3,-20,1
|
|
242
|
+
c-5.3,5.3,-10.3,11,-15,17c-242.7,294.7,-395.3,682,-458,1162c-21.3,163.3,-33.3,349,
|
|
243
|
+
-36,557 l0,`+(n+84)+`c0.2,6,0,26,0,60c2,159.3,10,310.7,24,454c53.3,528,210,
|
|
244
|
+
949.7,470,1265c4.7,6,9.7,11.7,15,17c0.7,0.7,7,1,19,1c0,0,18,0,18,0c4,-4,6,-7,6,-9
|
|
245
|
+
c0,-2.7,-3.3,-8.7,-10,-18c-135.3,-192.7,-235.5,-414.3,-300.5,-665c-65,-250.7,-102.5,
|
|
246
|
+
-544.7,-112.5,-882c-2,-104,-3,-167,-3,-189
|
|
247
|
+
l0,-`+(n+92)+`c0,-162.7,5.7,-314,17,-454c20.7,-272,63.7,-513,129,-723c65.3,
|
|
248
|
+
-210,155.3,-396.3,270,-559c6.7,-9.3,10,-15.3,10,-18z`;case"rparen":return`M76,0c-16.7,0,-25,3,-25,9c0,2,2,6.3,6,13c21.3,28.7,42.3,60.3,
|
|
249
|
+
63,95c96.7,156.7,172.8,332.5,228.5,527.5c55.7,195,92.8,416.5,111.5,664.5
|
|
250
|
+
c11.3,139.3,17,290.7,17,454c0,28,1.7,43,3.3,45l0,`+(n+9)+`
|
|
251
|
+
c-3,4,-3.3,16.7,-3.3,38c0,162,-5.7,313.7,-17,455c-18.7,248,-55.8,469.3,-111.5,664
|
|
252
|
+
c-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6,11
|
|
253
|
+
c0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17
|
|
254
|
+
c242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558
|
|
255
|
+
l0,-`+(n+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
|
|
256
|
+
-470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;default:throw new Error("Unknown stretchy delimiter.")}};function um(e){return"toText"in e}class Vi{constructor(t){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=t,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(t){return this.classes.includes(t)}toNode(){for(var t=document.createDocumentFragment(),n=0;n<this.children.length;n++)t.appendChild(this.children[n].toNode());return t}toMarkup(){for(var t="",n=0;n<this.children.length;n++)t+=this.children[n].toMarkup();return t}toText(){return this.children.map(t=>{if(um(t))return t.toText();throw new Error("Expected MathDomNode with toText, got "+t.constructor.name)}).join("")}}var Vo={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:803/800,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:803/800},dm={ex:!0,em:!0,mu:!0},ld=function(t){return typeof t!="string"&&(t=t.unit),t in Vo||t in dm||t==="ex"},Ft=function(t,n){var r;if(t.unit in Vo)r=Vo[t.unit]/n.fontMetrics().ptPerEm/n.sizeMultiplier;else if(t.unit==="mu")r=n.fontMetrics().cssEmPerMu;else{var i;if(n.style.isTight()?i=n.havingStyle(n.style.text()):i=n,t.unit==="ex")r=i.fontMetrics().xHeight;else if(t.unit==="em")r=i.fontMetrics().quad;else throw new re("Invalid unit: '"+t.unit+"'");i!==n&&(r*=i.sizeMultiplier/n.sizeMultiplier)}return Math.min(t.number*r,n.maxSize)},le=function(t){return+t.toFixed(4)+"em"},Vr=function(t){return t.filter(n=>n).join(" ")},R0=function(t){var n="";for(var r of Object.keys(t)){var i=t[r];i!==void 0&&(n+=Ff(r)+":"+i+";")}return n},cd=function(t,n,r){if(this.classes=t||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=r||{},n){n.style.isTight()&&this.classes.push("mtight");var i=n.getColor();i&&(this.style.color=i)}},ud=function(t){var n=document.createElement(t);n.className=Vr(this.classes),Object.assign(n.style,this.style);for(var r of Object.keys(this.attributes))n.setAttribute(r,this.attributes[r]);for(var i=0;i<this.children.length;i++)n.appendChild(this.children[i].toNode());return n},hm=/[\s"'>/=\x00-\x1f]/,dd=function(t){var n="<"+t;this.classes.length&&(n+=' class="'+fn(Vr(this.classes))+'"');var r=R0(this.style);r&&(n+=' style="'+fn(r)+'"');for(var i of Object.keys(this.attributes)){if(hm.test(i))throw new re("Invalid attribute name '"+i+"'");n+=" "+i+'="'+fn(this.attributes[i])+'"'}n+=">";for(var a=0;a<this.children.length;a++)n+=this.children[a].toMarkup();return n+="</"+t+">",n};class Yi{constructor(t,n,r,i){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,this.italic=void 0,cd.call(this,t,r,i),this.children=n||[]}setAttribute(t,n){this.attributes[t]=n}hasClass(t){return this.classes.includes(t)}toNode(){return ud.call(this,"span")}toMarkup(){return dd.call(this,"span")}}class Ls{constructor(t,n,r,i){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,cd.call(this,n,i),this.children=r||[],this.setAttribute("href",t)}setAttribute(t,n){this.attributes[t]=n}hasClass(t){return this.classes.includes(t)}toNode(){return ud.call(this,"a")}toMarkup(){return dd.call(this,"a")}}class fm{constructor(t,n,r){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=n,this.src=t,this.classes=["mord"],this.height=0,this.depth=0,this.maxFontSize=0,this.style=r}hasClass(t){return this.classes.includes(t)}toNode(){var t=document.createElement("img");return t.src=this.src,t.alt=this.alt,t.className="mord",Object.assign(t.style,this.style),t}toMarkup(){var t='<img src="'+fn(this.src)+'"'+(' alt="'+fn(this.alt)+'"'),n=R0(this.style);return n&&(t+=' style="'+fn(n)+'"'),t+="'/>",t}}var mm={î:"ı̂",ï:"ı̈",í:"ı́",ì:"ı̀"};class Bn{constructor(t,n,r,i,a,s,o,l){this.text=void 0,this.height=void 0,this.depth=void 0,this.italic=void 0,this.skew=void 0,this.width=void 0,this.maxFontSize=void 0,this.classes=void 0,this.style=void 0,this.text=t,this.height=n||0,this.depth=r||0,this.italic=i||0,this.skew=a||0,this.width=s||0,this.classes=o||[],this.style=l||{},this.maxFontSize=0;var d=Qf(this.text.charCodeAt(0));d&&this.classes.push(d+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=mm[this.text])}hasClass(t){return this.classes.includes(t)}toNode(){var t=document.createTextNode(this.text),n=null;return this.italic>0&&(n=document.createElement("span"),n.style.marginRight=le(this.italic)),this.classes.length>0&&(n=n||document.createElement("span"),n.className=Vr(this.classes)),Object.keys(this.style).length>0&&(n=n||document.createElement("span"),Object.assign(n.style,this.style)),n?(n.appendChild(t),n):t}toMarkup(){var t=!1,n="<span";this.classes.length&&(t=!0,n+=' class="',n+=fn(Vr(this.classes)),n+='"');var r="";this.italic>0&&(r+="margin-right:"+le(this.italic)+";"),r+=R0(this.style),r&&(t=!0,n+=' style="'+fn(r)+'"');var i=fn(this.text);return t?(n+=">",n+=i,n+="</span>",n):i}}class Tr{constructor(t,n){this.children=void 0,this.attributes=void 0,this.children=t||[],this.attributes=n||{}}toNode(){var t="http://www.w3.org/2000/svg",n=document.createElementNS(t,"svg");for(var r of Object.keys(this.attributes))n.setAttribute(r,this.attributes[r]);for(var i=0;i<this.children.length;i++)n.appendChild(this.children[i].toNode());return n}toMarkup(){var t='<svg xmlns="http://www.w3.org/2000/svg"';for(var n of Object.keys(this.attributes))t+=" "+n+'="'+fn(this.attributes[n])+'"';t+=">";for(var r=0;r<this.children.length;r++)t+=this.children[r].toMarkup();return t+="</svg>",t}}class Yr{constructor(t,n){this.pathName=void 0,this.alternate=void 0,this.pathName=t,this.alternate=n}toNode(){var t="http://www.w3.org/2000/svg",n=document.createElementNS(t,"path");return this.alternate?n.setAttribute("d",this.alternate):n.setAttribute("d",Fl[this.pathName]),n}toMarkup(){return this.alternate?'<path d="'+fn(this.alternate)+'"/>':'<path d="'+fn(Fl[this.pathName])+'"/>'}}class Yo{constructor(t){this.attributes=void 0,this.attributes=t||{}}toNode(){var t="http://www.w3.org/2000/svg",n=document.createElementNS(t,"line");for(var r of Object.keys(this.attributes))n.setAttribute(r,this.attributes[r]);return n}toMarkup(){var t="<line";for(var n of Object.keys(this.attributes))t+=" "+n+'="'+fn(this.attributes[n])+'"';return t+="/>",t}}function pm(e){if(e instanceof Bn)return e;throw new Error("Expected symbolNode but got "+String(e)+".")}function gm(e){if(e instanceof Yi)return e;throw new Error("Expected span<HtmlDomNode> but got "+String(e)+".")}var vm=e=>e instanceof Yi||e instanceof Ls||e instanceof Vi,sr={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.75583,0,0,.5],8814:[.20576,.70576,0,0,.77778],8815:[.20576,.70576,0,0,.77778],8816:[.30274,.79383,0,0,.77778],8817:[.30274,.79383,0,0,.77778],8818:[.22958,.72958,0,0,.77778],8819:[.22958,.72958,0,0,.77778],8822:[.1808,.675,0,0,.77778],8823:[.1808,.675,0,0,.77778],8828:[.13667,.63667,0,0,.77778],8829:[.13667,.63667,0,0,.77778],8830:[.22958,.72958,0,0,.77778],8831:[.22958,.72958,0,0,.77778],8832:[.20576,.70576,0,0,.77778],8833:[.20576,.70576,0,0,.77778],8840:[.30274,.79383,0,0,.77778],8841:[.30274,.79383,0,0,.77778],8842:[.13597,.63597,0,0,.77778],8843:[.13597,.63597,0,0,.77778],8847:[.03517,.54986,0,0,.77778],8848:[.03517,.54986,0,0,.77778],8858:[.08198,.58198,0,0,.77778],8859:[.08198,.58198,0,0,.77778],8861:[.08198,.58198,0,0,.77778],8862:[0,.675,0,0,.77778],8863:[0,.675,0,0,.77778],8864:[0,.675,0,0,.77778],8865:[0,.675,0,0,.77778],8872:[0,.69224,0,0,.61111],8873:[0,.69224,0,0,.72222],8874:[0,.69224,0,0,.88889],8876:[0,.68889,0,0,.61111],8877:[0,.68889,0,0,.61111],8878:[0,.68889,0,0,.72222],8879:[0,.68889,0,0,.72222],8882:[.03517,.54986,0,0,.77778],8883:[.03517,.54986,0,0,.77778],8884:[.13667,.63667,0,0,.77778],8885:[.13667,.63667,0,0,.77778],8888:[0,.54986,0,0,1.11111],8890:[.19444,.43056,0,0,.55556],8891:[.19444,.69224,0,0,.61111],8892:[.19444,.69224,0,0,.61111],8901:[0,.54986,0,0,.27778],8903:[.08167,.58167,0,0,.77778],8905:[.08167,.58167,0,0,.77778],8906:[.08167,.58167,0,0,.77778],8907:[0,.69224,0,0,.77778],8908:[0,.69224,0,0,.77778],8909:[-.03598,.46402,0,0,.77778],8910:[0,.54986,0,0,.76042],8911:[0,.54986,0,0,.76042],8912:[.03517,.54986,0,0,.77778],8913:[.03517,.54986,0,0,.77778],8914:[0,.54986,0,0,.66667],8915:[0,.54986,0,0,.66667],8916:[0,.69224,0,0,.66667],8918:[.0391,.5391,0,0,.77778],8919:[.0391,.5391,0,0,.77778],8920:[.03517,.54986,0,0,1.33334],8921:[.03517,.54986,0,0,1.33334],8922:[.38569,.88569,0,0,.77778],8923:[.38569,.88569,0,0,.77778],8926:[.13667,.63667,0,0,.77778],8927:[.13667,.63667,0,0,.77778],8928:[.30274,.79383,0,0,.77778],8929:[.30274,.79383,0,0,.77778],8934:[.23222,.74111,0,0,.77778],8935:[.23222,.74111,0,0,.77778],8936:[.23222,.74111,0,0,.77778],8937:[.23222,.74111,0,0,.77778],8938:[.20576,.70576,0,0,.77778],8939:[.20576,.70576,0,0,.77778],8940:[.30274,.79383,0,0,.77778],8941:[.30274,.79383,0,0,.77778],8994:[.19444,.69224,0,0,.77778],8995:[.19444,.69224,0,0,.77778],9416:[.15559,.69224,0,0,.90222],9484:[0,.69224,0,0,.5],9488:[0,.69224,0,0,.5],9492:[0,.37788,0,0,.5],9496:[0,.37788,0,0,.5],9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:[0,.675,0,0,.77778],9633:[0,.675,0,0,.77778],9650:[0,.54986,0,0,.72222],9651:[0,.54986,0,0,.72222],9654:[.03517,.54986,0,0,.77778],9660:[0,.54986,0,0,.72222],9661:[0,.54986,0,0,.72222],9664:[.03517,.54986,0,0,.77778],9674:[.11111,.69224,0,0,.66667],9733:[.19444,.69224,0,0,.94445],10003:[0,.69224,0,0,.83334],10016:[0,.69224,0,0,.83334],10731:[.11111,.69224,0,0,.66667],10846:[.19444,.75583,0,0,.61111],10877:[.13667,.63667,0,0,.77778],10878:[.13667,.63667,0,0,.77778],10885:[.25583,.75583,0,0,.77778],10886:[.25583,.75583,0,0,.77778],10887:[.13597,.63597,0,0,.77778],10888:[.13597,.63597,0,0,.77778],10889:[.26167,.75726,0,0,.77778],10890:[.26167,.75726,0,0,.77778],10891:[.48256,.98256,0,0,.77778],10892:[.48256,.98256,0,0,.77778],10901:[.13667,.63667,0,0,.77778],10902:[.13667,.63667,0,0,.77778],10933:[.25142,.75726,0,0,.77778],10934:[.25142,.75726,0,0,.77778],10935:[.26167,.75726,0,0,.77778],10936:[.26167,.75726,0,0,.77778],10937:[.26167,.75726,0,0,.77778],10938:[.26167,.75726,0,0,.77778],10949:[.25583,.75583,0,0,.77778],10950:[.25583,.75583,0,0,.77778],10955:[.28481,.79383,0,0,.77778],10956:[.28481,.79383,0,0,.77778],57350:[.08167,.58167,0,0,.22222],57351:[.08167,.58167,0,0,.38889],57352:[.08167,.58167,0,0,.77778],57353:[0,.43056,.04028,0,.66667],57356:[.25142,.75726,0,0,.77778],57357:[.25142,.75726,0,0,.77778],57358:[.41951,.91951,0,0,.77778],57359:[.30274,.79383,0,0,.77778],57360:[.30274,.79383,0,0,.77778],57361:[.41951,.91951,0,0,.77778],57366:[.25142,.75726,0,0,.77778],57367:[.25142,.75726,0,0,.77778],57368:[.25142,.75726,0,0,.77778],57369:[.25142,.75726,0,0,.77778],57370:[.13597,.63597,0,0,.77778],57371:[.13597,.63597,0,0,.77778]},"Caligraphic-Regular":{32:[0,0,0,0,.25],65:[0,.68333,0,.19445,.79847],66:[0,.68333,.03041,.13889,.65681],67:[0,.68333,.05834,.13889,.52653],68:[0,.68333,.02778,.08334,.77139],69:[0,.68333,.08944,.11111,.52778],70:[0,.68333,.09931,.11111,.71875],71:[.09722,.68333,.0593,.11111,.59487],72:[0,.68333,.00965,.11111,.84452],73:[0,.68333,.07382,0,.54452],74:[.09722,.68333,.18472,.16667,.67778],75:[0,.68333,.01445,.05556,.76195],76:[0,.68333,0,.13889,.68972],77:[0,.68333,0,.13889,1.2009],78:[0,.68333,.14736,.08334,.82049],79:[0,.68333,.02778,.11111,.79611],80:[0,.68333,.08222,.08334,.69556],81:[.09722,.68333,0,.11111,.81667],82:[0,.68333,0,.08334,.8475],83:[0,.68333,.075,.13889,.60556],84:[0,.68333,.25417,0,.54464],85:[0,.68333,.09931,.08334,.62583],86:[0,.68333,.08222,0,.61278],87:[0,.68333,.08222,.08334,.98778],88:[0,.68333,.14643,.13889,.7133],89:[.09722,.68333,.08222,.08334,.66834],90:[0,.68333,.07944,.13889,.72473],160:[0,0,0,0,.25]},"Fraktur-Regular":{32:[0,0,0,0,.25],33:[0,.69141,0,0,.29574],34:[0,.69141,0,0,.21471],38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:[.24982,.74947,0,0,.38865],41:[.24982,.74947,0,0,.38865],42:[0,.62119,0,0,.27764],43:[.08319,.58283,0,0,.75623],44:[0,.10803,0,0,.27764],45:[.08319,.58283,0,0,.75623],46:[0,.10803,0,0,.27764],47:[.24982,.74947,0,0,.50181],48:[0,.47534,0,0,.50181],49:[0,.47534,0,0,.50181],50:[0,.47534,0,0,.50181],51:[.18906,.47534,0,0,.50181],52:[.18906,.47534,0,0,.50181],53:[.18906,.47534,0,0,.50181],54:[0,.69141,0,0,.50181],55:[.18906,.47534,0,0,.50181],56:[0,.69141,0,0,.50181],57:[.18906,.47534,0,0,.50181],58:[0,.47534,0,0,.21606],59:[.12604,.47534,0,0,.21606],61:[-.13099,.36866,0,0,.75623],63:[0,.69141,0,0,.36245],65:[0,.69141,0,0,.7176],66:[0,.69141,0,0,.88397],67:[0,.69141,0,0,.61254],68:[0,.69141,0,0,.83158],69:[0,.69141,0,0,.66278],70:[.12604,.69141,0,0,.61119],71:[0,.69141,0,0,.78539],72:[.06302,.69141,0,0,.7203],73:[0,.69141,0,0,.55448],74:[.12604,.69141,0,0,.55231],75:[0,.69141,0,0,.66845],76:[0,.69141,0,0,.66602],77:[0,.69141,0,0,1.04953],78:[0,.69141,0,0,.83212],79:[0,.69141,0,0,.82699],80:[.18906,.69141,0,0,.82753],81:[.03781,.69141,0,0,.82699],82:[0,.69141,0,0,.82807],83:[0,.69141,0,0,.82861],84:[0,.69141,0,0,.66899],85:[0,.69141,0,0,.64576],86:[0,.69141,0,0,.83131],87:[0,.69141,0,0,1.04602],88:[0,.69141,0,0,.71922],89:[.18906,.69141,0,0,.83293],90:[.12604,.69141,0,0,.60201],91:[.24982,.74947,0,0,.27764],93:[.24982,.74947,0,0,.27764],94:[0,.69141,0,0,.49965],97:[0,.47534,0,0,.50046],98:[0,.69141,0,0,.51315],99:[0,.47534,0,0,.38946],100:[0,.62119,0,0,.49857],101:[0,.47534,0,0,.40053],102:[.18906,.69141,0,0,.32626],103:[.18906,.47534,0,0,.5037],104:[.18906,.69141,0,0,.52126],105:[0,.69141,0,0,.27899],106:[0,.69141,0,0,.28088],107:[0,.69141,0,0,.38946],108:[0,.69141,0,0,.27953],109:[0,.47534,0,0,.76676],110:[0,.47534,0,0,.52666],111:[0,.47534,0,0,.48885],112:[.18906,.52396,0,0,.50046],113:[.18906,.47534,0,0,.48912],114:[0,.47534,0,0,.38919],115:[0,.47534,0,0,.44266],116:[0,.62119,0,0,.33301],117:[0,.47534,0,0,.5172],118:[0,.52396,0,0,.5118],119:[0,.52396,0,0,.77351],120:[.18906,.47534,0,0,.38865],121:[.18906,.47534,0,0,.49884],122:[.18906,.47534,0,0,.39054],160:[0,0,0,0,.25],8216:[0,.69141,0,0,.21471],8217:[0,.69141,0,0,.21471],58112:[0,.62119,0,0,.49749],58113:[0,.62119,0,0,.4983],58114:[.18906,.69141,0,0,.33328],58115:[.18906,.69141,0,0,.32923],58116:[.18906,.47534,0,0,.50343],58117:[0,.69141,0,0,.33301],58118:[0,.62119,0,0,.33409],58119:[0,.47534,0,0,.50073]},"Main-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.35],34:[0,.69444,0,0,.60278],35:[.19444,.69444,0,0,.95833],36:[.05556,.75,0,0,.575],37:[.05556,.75,0,0,.95833],38:[0,.69444,0,0,.89444],39:[0,.69444,0,0,.31944],40:[.25,.75,0,0,.44722],41:[.25,.75,0,0,.44722],42:[0,.75,0,0,.575],43:[.13333,.63333,0,0,.89444],44:[.19444,.15556,0,0,.31944],45:[0,.44444,0,0,.38333],46:[0,.15556,0,0,.31944],47:[.25,.75,0,0,.575],48:[0,.64444,0,0,.575],49:[0,.64444,0,0,.575],50:[0,.64444,0,0,.575],51:[0,.64444,0,0,.575],52:[0,.64444,0,0,.575],53:[0,.64444,0,0,.575],54:[0,.64444,0,0,.575],55:[0,.64444,0,0,.575],56:[0,.64444,0,0,.575],57:[0,.64444,0,0,.575],58:[0,.44444,0,0,.31944],59:[.19444,.44444,0,0,.31944],60:[.08556,.58556,0,0,.89444],61:[-.10889,.39111,0,0,.89444],62:[.08556,.58556,0,0,.89444],63:[0,.69444,0,0,.54305],64:[0,.69444,0,0,.89444],65:[0,.68611,0,0,.86944],66:[0,.68611,0,0,.81805],67:[0,.68611,0,0,.83055],68:[0,.68611,0,0,.88194],69:[0,.68611,0,0,.75555],70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:[0,.68611,0,0,.9],73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:[0,.68611,0,0,.69166],77:[0,.68611,0,0,1.09166],78:[0,.68611,0,0,.9],79:[0,.68611,0,0,.86388],80:[0,.68611,0,0,.78611],81:[.19444,.68611,0,0,.86388],82:[0,.68611,0,0,.8625],83:[0,.68611,0,0,.63889],84:[0,.68611,0,0,.8],85:[0,.68611,0,0,.88472],86:[0,.68611,.01597,0,.86944],87:[0,.68611,.01597,0,1.18888],88:[0,.68611,0,0,.86944],89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:[.25,.75,0,0,.31944],92:[.25,.75,0,0,.575],93:[.25,.75,0,0,.31944],94:[0,.69444,0,0,.575],95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:[0,.69444,0,0,.63889],99:[0,.44444,0,0,.51111],100:[0,.69444,0,0,.63889],101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:[0,.69444,0,0,.63889],105:[0,.69444,0,0,.31944],106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:[0,.69444,0,0,.31944],109:[0,.44444,0,0,.95833],110:[0,.44444,0,0,.63889],111:[0,.44444,0,0,.575],112:[.19444,.44444,0,0,.63889],113:[.19444,.44444,0,0,.60694],114:[0,.44444,0,0,.47361],115:[0,.44444,0,0,.45361],116:[0,.63492,0,0,.44722],117:[0,.44444,0,0,.63889],118:[0,.44444,.01597,0,.60694],119:[0,.44444,.01597,0,.83055],120:[0,.44444,0,0,.60694],121:[.19444,.44444,.01597,0,.60694],122:[0,.44444,0,0,.51111],123:[.25,.75,0,0,.575],124:[.25,.75,0,0,.31944],125:[.25,.75,0,0,.575],126:[.35,.34444,0,0,.575],160:[0,0,0,0,.25],163:[0,.69444,0,0,.86853],168:[0,.69444,0,0,.575],172:[0,.44444,0,0,.76666],176:[0,.69444,0,0,.86944],177:[.13333,.63333,0,0,.89444],184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:[.13333,.63333,0,0,.89444],216:[.04861,.73472,0,0,.89444],223:[0,.69444,0,0,.59722],230:[0,.44444,0,0,.83055],247:[.13333,.63333,0,0,.89444],248:[.09722,.54167,0,0,.575],305:[0,.44444,0,0,.31944],338:[0,.68611,0,0,1.16944],339:[0,.44444,0,0,.89444],567:[.19444,.44444,0,0,.35139],710:[0,.69444,0,0,.575],711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:[0,.69444,0,0,.575],715:[0,.69444,0,0,.575],728:[0,.69444,0,0,.575],729:[0,.69444,0,0,.31944],730:[0,.69444,0,0,.86944],732:[0,.69444,0,0,.575],733:[0,.69444,0,0,.575],915:[0,.68611,0,0,.69166],916:[0,.68611,0,0,.95833],920:[0,.68611,0,0,.89444],923:[0,.68611,0,0,.80555],926:[0,.68611,0,0,.76666],928:[0,.68611,0,0,.9],931:[0,.68611,0,0,.83055],933:[0,.68611,0,0,.89444],934:[0,.68611,0,0,.83055],936:[0,.68611,0,0,.89444],937:[0,.68611,0,0,.83055],8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:[0,.69444,0,0,.31944],8217:[0,.69444,0,0,.31944],8220:[0,.69444,0,0,.60278],8221:[0,.69444,0,0,.60278],8224:[.19444,.69444,0,0,.51111],8225:[.19444,.69444,0,0,.51111],8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:[0,.69444,0,0,.66759],8465:[0,.69444,0,0,.83055],8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:[0,.69444,0,0,.83055],8501:[0,.69444,0,0,.70277],8592:[-.10889,.39111,0,0,1.14999],8593:[.19444,.69444,0,0,.575],8594:[-.10889,.39111,0,0,1.14999],8595:[.19444,.69444,0,0,.575],8596:[-.10889,.39111,0,0,1.14999],8597:[.25,.75,0,0,.575],8598:[.19444,.69444,0,0,1.14999],8599:[.19444,.69444,0,0,1.14999],8600:[.19444,.69444,0,0,1.14999],8601:[.19444,.69444,0,0,1.14999],8636:[-.10889,.39111,0,0,1.14999],8637:[-.10889,.39111,0,0,1.14999],8640:[-.10889,.39111,0,0,1.14999],8641:[-.10889,.39111,0,0,1.14999],8656:[-.10889,.39111,0,0,1.14999],8657:[.19444,.69444,0,0,.70277],8658:[-.10889,.39111,0,0,1.14999],8659:[.19444,.69444,0,0,.70277],8660:[-.10889,.39111,0,0,1.14999],8661:[.25,.75,0,0,.70277],8704:[0,.69444,0,0,.63889],8706:[0,.69444,.06389,0,.62847],8707:[0,.69444,0,0,.63889],8709:[.05556,.75,0,0,.575],8711:[0,.68611,0,0,.95833],8712:[.08556,.58556,0,0,.76666],8715:[.08556,.58556,0,0,.76666],8722:[.13333,.63333,0,0,.89444],8723:[.13333,.63333,0,0,.89444],8725:[.25,.75,0,0,.575],8726:[.25,.75,0,0,.575],8727:[-.02778,.47222,0,0,.575],8728:[-.02639,.47361,0,0,.575],8729:[-.02639,.47361,0,0,.575],8730:[.18,.82,0,0,.95833],8733:[0,.44444,0,0,.89444],8734:[0,.44444,0,0,1.14999],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.31944],8741:[.25,.75,0,0,.575],8743:[0,.55556,0,0,.76666],8744:[0,.55556,0,0,.76666],8745:[0,.55556,0,0,.76666],8746:[0,.55556,0,0,.76666],8747:[.19444,.69444,.12778,0,.56875],8764:[-.10889,.39111,0,0,.89444],8768:[.19444,.69444,0,0,.31944],8771:[.00222,.50222,0,0,.89444],8773:[.027,.638,0,0,.894],8776:[.02444,.52444,0,0,.89444],8781:[.00222,.50222,0,0,.89444],8801:[.00222,.50222,0,0,.89444],8804:[.19667,.69667,0,0,.89444],8805:[.19667,.69667,0,0,.89444],8810:[.08556,.58556,0,0,1.14999],8811:[.08556,.58556,0,0,1.14999],8826:[.08556,.58556,0,0,.89444],8827:[.08556,.58556,0,0,.89444],8834:[.08556,.58556,0,0,.89444],8835:[.08556,.58556,0,0,.89444],8838:[.19667,.69667,0,0,.89444],8839:[.19667,.69667,0,0,.89444],8846:[0,.55556,0,0,.76666],8849:[.19667,.69667,0,0,.89444],8850:[.19667,.69667,0,0,.89444],8851:[0,.55556,0,0,.76666],8852:[0,.55556,0,0,.76666],8853:[.13333,.63333,0,0,.89444],8854:[.13333,.63333,0,0,.89444],8855:[.13333,.63333,0,0,.89444],8856:[.13333,.63333,0,0,.89444],8857:[.13333,.63333,0,0,.89444],8866:[0,.69444,0,0,.70277],8867:[0,.69444,0,0,.70277],8868:[0,.69444,0,0,.89444],8869:[0,.69444,0,0,.89444],8900:[-.02639,.47361,0,0,.575],8901:[-.02639,.47361,0,0,.31944],8902:[-.02778,.47222,0,0,.575],8968:[.25,.75,0,0,.51111],8969:[.25,.75,0,0,.51111],8970:[.25,.75,0,0,.51111],8971:[.25,.75,0,0,.51111],8994:[-.13889,.36111,0,0,1.14999],8995:[-.13889,.36111,0,0,1.14999],9651:[.19444,.69444,0,0,1.02222],9657:[-.02778,.47222,0,0,.575],9661:[.19444,.69444,0,0,1.02222],9667:[-.02778,.47222,0,0,.575],9711:[.19444,.69444,0,0,1.14999],9824:[.12963,.69444,0,0,.89444],9825:[.12963,.69444,0,0,.89444],9826:[.12963,.69444,0,0,.89444],9827:[.12963,.69444,0,0,.89444],9837:[0,.75,0,0,.44722],9838:[.19444,.69444,0,0,.44722],9839:[.19444,.69444,0,0,.44722],10216:[.25,.75,0,0,.44722],10217:[.25,.75,0,0,.44722],10815:[0,.68611,0,0,.9],10927:[.19667,.69667,0,0,.89444],10928:[.19667,.69667,0,0,.89444],57376:[.19444,.69444,0,0,0]},"Main-BoldItalic":{32:[0,0,0,0,.25],33:[0,.69444,.11417,0,.38611],34:[0,.69444,.07939,0,.62055],35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:[0,.69444,.12945,0,.35555],40:[.25,.75,.15806,0,.47333],41:[.25,.75,.03306,0,.47333],42:[0,.75,.14333,0,.59111],43:[.10333,.60333,.03306,0,.88555],44:[.19444,.14722,0,0,.35555],45:[0,.44444,.02611,0,.41444],46:[0,.14722,0,0,.35555],47:[.25,.75,.15806,0,.59111],48:[0,.64444,.13167,0,.59111],49:[0,.64444,.13167,0,.59111],50:[0,.64444,.13167,0,.59111],51:[0,.64444,.13167,0,.59111],52:[.19444,.64444,.13167,0,.59111],53:[0,.64444,.13167,0,.59111],54:[0,.64444,.13167,0,.59111],55:[.19444,.64444,.13167,0,.59111],56:[0,.64444,.13167,0,.59111],57:[0,.64444,.13167,0,.59111],58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:[0,.69444,.11472,0,.59111],64:[0,.69444,.09208,0,.88555],65:[0,.68611,0,0,.86555],66:[0,.68611,.0992,0,.81666],67:[0,.68611,.14208,0,.82666],68:[0,.68611,.09062,0,.87555],69:[0,.68611,.11431,0,.75666],70:[0,.68611,.12903,0,.72722],71:[0,.68611,.07347,0,.89527],72:[0,.68611,.17208,0,.8961],73:[0,.68611,.15681,0,.47166],74:[0,.68611,.145,0,.61055],75:[0,.68611,.14208,0,.89499],76:[0,.68611,0,0,.69777],77:[0,.68611,.17208,0,1.07277],78:[0,.68611,.17208,0,.8961],79:[0,.68611,.09062,0,.85499],80:[0,.68611,.0992,0,.78721],81:[.19444,.68611,.09062,0,.85499],82:[0,.68611,.02559,0,.85944],83:[0,.68611,.11264,0,.64999],84:[0,.68611,.12903,0,.7961],85:[0,.68611,.17208,0,.88083],86:[0,.68611,.18625,0,.86555],87:[0,.68611,.18625,0,1.15999],88:[0,.68611,.15681,0,.86555],89:[0,.68611,.19803,0,.86555],90:[0,.68611,.14208,0,.70888],91:[.25,.75,.1875,0,.35611],93:[.25,.75,.09972,0,.35611],94:[0,.69444,.06709,0,.59111],95:[.31,.13444,.09811,0,.59111],97:[0,.44444,.09426,0,.59111],98:[0,.69444,.07861,0,.53222],99:[0,.44444,.05222,0,.53222],100:[0,.69444,.10861,0,.59111],101:[0,.44444,.085,0,.53222],102:[.19444,.69444,.21778,0,.4],103:[.19444,.44444,.105,0,.53222],104:[0,.69444,.09426,0,.59111],105:[0,.69326,.11387,0,.35555],106:[.19444,.69326,.1672,0,.35555],107:[0,.69444,.11111,0,.53222],108:[0,.69444,.10861,0,.29666],109:[0,.44444,.09426,0,.94444],110:[0,.44444,.09426,0,.64999],111:[0,.44444,.07861,0,.59111],112:[.19444,.44444,.07861,0,.59111],113:[.19444,.44444,.105,0,.53222],114:[0,.44444,.11111,0,.50167],115:[0,.44444,.08167,0,.48694],116:[0,.63492,.09639,0,.385],117:[0,.44444,.09426,0,.62055],118:[0,.44444,.11111,0,.53222],119:[0,.44444,.11111,0,.76777],120:[0,.44444,.12583,0,.56055],121:[.19444,.44444,.105,0,.56166],122:[0,.44444,.13889,0,.49055],126:[.35,.34444,.11472,0,.59111],160:[0,0,0,0,.25],168:[0,.69444,.11473,0,.59111],176:[0,.69444,0,0,.94888],184:[.17014,0,0,0,.53222],198:[0,.68611,.11431,0,1.02277],216:[.04861,.73472,.09062,0,.88555],223:[.19444,.69444,.09736,0,.665],230:[0,.44444,.085,0,.82666],248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:[0,.44444,.085,0,.82666],567:[.19444,.44444,.04611,0,.385],710:[0,.69444,.06709,0,.59111],711:[0,.63194,.08271,0,.59111],713:[0,.59444,.10444,0,.59111],714:[0,.69444,.08528,0,.59111],715:[0,.69444,0,0,.59111],728:[0,.69444,.10333,0,.59111],729:[0,.69444,.12945,0,.35555],730:[0,.69444,0,0,.94888],732:[0,.69444,.11472,0,.59111],733:[0,.69444,.11472,0,.59111],915:[0,.68611,.12903,0,.69777],916:[0,.68611,0,0,.94444],920:[0,.68611,.09062,0,.88555],923:[0,.68611,0,0,.80666],926:[0,.68611,.15092,0,.76777],928:[0,.68611,.17208,0,.8961],931:[0,.68611,.11431,0,.82666],933:[0,.68611,.10778,0,.88555],934:[0,.68611,.05632,0,.82666],936:[0,.68611,.10778,0,.88555],937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:[0,.69444,.12945,0,.35555],8217:[0,.69444,.12945,0,.35555],8220:[0,.69444,.16772,0,.62055],8221:[0,.69444,.07939,0,.62055]},"Main-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.12417,0,.30667],34:[0,.69444,.06961,0,.51444],35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:[0,.69444,.12417,0,.30667],40:[.25,.75,.16194,0,.40889],41:[.25,.75,.03694,0,.40889],42:[0,.75,.14917,0,.51111],43:[.05667,.56167,.03694,0,.76666],44:[.19444,.10556,0,0,.30667],45:[0,.43056,.02826,0,.35778],46:[0,.10556,0,0,.30667],47:[.25,.75,.16194,0,.51111],48:[0,.64444,.13556,0,.51111],49:[0,.64444,.13556,0,.51111],50:[0,.64444,.13556,0,.51111],51:[0,.64444,.13556,0,.51111],52:[.19444,.64444,.13556,0,.51111],53:[0,.64444,.13556,0,.51111],54:[0,.64444,.13556,0,.51111],55:[.19444,.64444,.13556,0,.51111],56:[0,.64444,.13556,0,.51111],57:[0,.64444,.13556,0,.51111],58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:[0,.69444,.1225,0,.51111],64:[0,.69444,.09597,0,.76666],65:[0,.68333,0,0,.74333],66:[0,.68333,.10257,0,.70389],67:[0,.68333,.14528,0,.71555],68:[0,.68333,.09403,0,.755],69:[0,.68333,.12028,0,.67833],70:[0,.68333,.13305,0,.65277],71:[0,.68333,.08722,0,.77361],72:[0,.68333,.16389,0,.74333],73:[0,.68333,.15806,0,.38555],74:[0,.68333,.14028,0,.525],75:[0,.68333,.14528,0,.76888],76:[0,.68333,0,0,.62722],77:[0,.68333,.16389,0,.89666],78:[0,.68333,.16389,0,.74333],79:[0,.68333,.09403,0,.76666],80:[0,.68333,.10257,0,.67833],81:[.19444,.68333,.09403,0,.76666],82:[0,.68333,.03868,0,.72944],83:[0,.68333,.11972,0,.56222],84:[0,.68333,.13305,0,.71555],85:[0,.68333,.16389,0,.74333],86:[0,.68333,.18361,0,.74333],87:[0,.68333,.18361,0,.99888],88:[0,.68333,.15806,0,.74333],89:[0,.68333,.19383,0,.74333],90:[0,.68333,.14528,0,.61333],91:[.25,.75,.1875,0,.30667],93:[.25,.75,.10528,0,.30667],94:[0,.69444,.06646,0,.51111],95:[.31,.12056,.09208,0,.51111],97:[0,.43056,.07671,0,.51111],98:[0,.69444,.06312,0,.46],99:[0,.43056,.05653,0,.46],100:[0,.69444,.10333,0,.51111],101:[0,.43056,.07514,0,.46],102:[.19444,.69444,.21194,0,.30667],103:[.19444,.43056,.08847,0,.46],104:[0,.69444,.07671,0,.51111],105:[0,.65536,.1019,0,.30667],106:[.19444,.65536,.14467,0,.30667],107:[0,.69444,.10764,0,.46],108:[0,.69444,.10333,0,.25555],109:[0,.43056,.07671,0,.81777],110:[0,.43056,.07671,0,.56222],111:[0,.43056,.06312,0,.51111],112:[.19444,.43056,.06312,0,.51111],113:[.19444,.43056,.08847,0,.46],114:[0,.43056,.10764,0,.42166],115:[0,.43056,.08208,0,.40889],116:[0,.61508,.09486,0,.33222],117:[0,.43056,.07671,0,.53666],118:[0,.43056,.10764,0,.46],119:[0,.43056,.10764,0,.66444],120:[0,.43056,.12042,0,.46389],121:[.19444,.43056,.08847,0,.48555],122:[0,.43056,.12292,0,.40889],126:[.35,.31786,.11585,0,.51111],160:[0,0,0,0,.25],168:[0,.66786,.10474,0,.51111],176:[0,.69444,0,0,.83129],184:[.17014,0,0,0,.46],198:[0,.68333,.12028,0,.88277],216:[.04861,.73194,.09403,0,.76666],223:[.19444,.69444,.10514,0,.53666],230:[0,.43056,.07514,0,.71555],248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:[0,.43056,.07514,0,.71555],710:[0,.69444,.06646,0,.51111],711:[0,.62847,.08295,0,.51111],713:[0,.56167,.10333,0,.51111],714:[0,.69444,.09694,0,.51111],715:[0,.69444,0,0,.51111],728:[0,.69444,.10806,0,.51111],729:[0,.66786,.11752,0,.30667],730:[0,.69444,0,0,.83129],732:[0,.66786,.11585,0,.51111],733:[0,.69444,.1225,0,.51111],915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:[0,.68333,.09403,0,.76666],923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:[0,.68333,.16389,0,.74333],931:[0,.68333,.12028,0,.71555],933:[0,.68333,.11111,0,.76666],934:[0,.68333,.05986,0,.71555],936:[0,.68333,.11111,0,.76666],937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:[0,.69444,.12417,0,.30667],8217:[0,.69444,.12417,0,.30667],8220:[0,.69444,.1685,0,.51444],8221:[0,.69444,.06961,0,.51444],8463:[0,.68889,0,0,.54028]},"Main-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.27778],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.77778],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.64444,0,0,.5],49:[0,.64444,0,0,.5],50:[0,.64444,0,0,.5],51:[0,.64444,0,0,.5],52:[0,.64444,0,0,.5],53:[0,.64444,0,0,.5],54:[0,.64444,0,0,.5],55:[0,.64444,0,0,.5],56:[0,.64444,0,0,.5],57:[0,.64444,0,0,.5],58:[0,.43056,0,0,.27778],59:[.19444,.43056,0,0,.27778],60:[.0391,.5391,0,0,.77778],61:[-.13313,.36687,0,0,.77778],62:[.0391,.5391,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.77778],65:[0,.68333,0,0,.75],66:[0,.68333,0,0,.70834],67:[0,.68333,0,0,.72222],68:[0,.68333,0,0,.76389],69:[0,.68333,0,0,.68056],70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:[0,.68333,0,0,.75],73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:[0,.68333,0,0,.77778],76:[0,.68333,0,0,.625],77:[0,.68333,0,0,.91667],78:[0,.68333,0,0,.75],79:[0,.68333,0,0,.77778],80:[0,.68333,0,0,.68056],81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:[0,.68333,0,0,.72222],85:[0,.68333,0,0,.75],86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:[0,.68333,0,0,.75],89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:[.25,.75,0,0,.27778],92:[.25,.75,0,0,.5],93:[.25,.75,0,0,.27778],94:[0,.69444,0,0,.5],95:[.31,.12056,.02778,0,.5],97:[0,.43056,0,0,.5],98:[0,.69444,0,0,.55556],99:[0,.43056,0,0,.44445],100:[0,.69444,0,0,.55556],101:[0,.43056,0,0,.44445],102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:[0,.69444,0,0,.55556],105:[0,.66786,0,0,.27778],106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:[0,.69444,0,0,.27778],109:[0,.43056,0,0,.83334],110:[0,.43056,0,0,.55556],111:[0,.43056,0,0,.5],112:[.19444,.43056,0,0,.55556],113:[.19444,.43056,0,0,.52778],114:[0,.43056,0,0,.39167],115:[0,.43056,0,0,.39445],116:[0,.61508,0,0,.38889],117:[0,.43056,0,0,.55556],118:[0,.43056,.01389,0,.52778],119:[0,.43056,.01389,0,.72222],120:[0,.43056,0,0,.52778],121:[.19444,.43056,.01389,0,.52778],122:[0,.43056,0,0,.44445],123:[.25,.75,0,0,.5],124:[.25,.75,0,0,.27778],125:[.25,.75,0,0,.5],126:[.35,.31786,0,0,.5],160:[0,0,0,0,.25],163:[0,.69444,0,0,.76909],167:[.19444,.69444,0,0,.44445],168:[0,.66786,0,0,.5],172:[0,.43056,0,0,.66667],176:[0,.69444,0,0,.75],177:[.08333,.58333,0,0,.77778],182:[.19444,.69444,0,0,.61111],184:[.17014,0,0,0,.44445],198:[0,.68333,0,0,.90278],215:[.08333,.58333,0,0,.77778],216:[.04861,.73194,0,0,.77778],223:[0,.69444,0,0,.5],230:[0,.43056,0,0,.72222],247:[.08333,.58333,0,0,.77778],248:[.09722,.52778,0,0,.5],305:[0,.43056,0,0,.27778],338:[0,.68333,0,0,1.01389],339:[0,.43056,0,0,.77778],567:[.19444,.43056,0,0,.30556],710:[0,.69444,0,0,.5],711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.66786,0,0,.27778],730:[0,.69444,0,0,.75],732:[0,.66786,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.68333,0,0,.625],916:[0,.68333,0,0,.83334],920:[0,.68333,0,0,.77778],923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:[0,.68333,0,0,.75],931:[0,.68333,0,0,.72222],933:[0,.68333,0,0,.77778],934:[0,.68333,0,0,.72222],936:[0,.68333,0,0,.77778],937:[0,.68333,0,0,.72222],8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5],8224:[.19444,.69444,0,0,.44445],8225:[.19444,.69444,0,0,.44445],8230:[0,.123,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:[0,.68889,0,0,.54028],8465:[0,.69444,0,0,.72222],8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:[0,.69444,0,0,.72222],8501:[0,.69444,0,0,.61111],8592:[-.13313,.36687,0,0,1],8593:[.19444,.69444,0,0,.5],8594:[-.13313,.36687,0,0,1],8595:[.19444,.69444,0,0,.5],8596:[-.13313,.36687,0,0,1],8597:[.25,.75,0,0,.5],8598:[.19444,.69444,0,0,1],8599:[.19444,.69444,0,0,1],8600:[.19444,.69444,0,0,1],8601:[.19444,.69444,0,0,1],8614:[.011,.511,0,0,1],8617:[.011,.511,0,0,1.126],8618:[.011,.511,0,0,1.126],8636:[-.13313,.36687,0,0,1],8637:[-.13313,.36687,0,0,1],8640:[-.13313,.36687,0,0,1],8641:[-.13313,.36687,0,0,1],8652:[.011,.671,0,0,1],8656:[-.13313,.36687,0,0,1],8657:[.19444,.69444,0,0,.61111],8658:[-.13313,.36687,0,0,1],8659:[.19444,.69444,0,0,.61111],8660:[-.13313,.36687,0,0,1],8661:[.25,.75,0,0,.61111],8704:[0,.69444,0,0,.55556],8706:[0,.69444,.05556,.08334,.5309],8707:[0,.69444,0,0,.55556],8709:[.05556,.75,0,0,.5],8711:[0,.68333,0,0,.83334],8712:[.0391,.5391,0,0,.66667],8715:[.0391,.5391,0,0,.66667],8722:[.08333,.58333,0,0,.77778],8723:[.08333,.58333,0,0,.77778],8725:[.25,.75,0,0,.5],8726:[.25,.75,0,0,.5],8727:[-.03472,.46528,0,0,.5],8728:[-.05555,.44445,0,0,.5],8729:[-.05555,.44445,0,0,.5],8730:[.2,.8,0,0,.83334],8733:[0,.43056,0,0,.77778],8734:[0,.43056,0,0,1],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.27778],8741:[.25,.75,0,0,.5],8743:[0,.55556,0,0,.66667],8744:[0,.55556,0,0,.66667],8745:[0,.55556,0,0,.66667],8746:[0,.55556,0,0,.66667],8747:[.19444,.69444,.11111,0,.41667],8764:[-.13313,.36687,0,0,.77778],8768:[.19444,.69444,0,0,.27778],8771:[-.03625,.46375,0,0,.77778],8773:[-.022,.589,0,0,.778],8776:[-.01688,.48312,0,0,.77778],8781:[-.03625,.46375,0,0,.77778],8784:[-.133,.673,0,0,.778],8801:[-.03625,.46375,0,0,.77778],8804:[.13597,.63597,0,0,.77778],8805:[.13597,.63597,0,0,.77778],8810:[.0391,.5391,0,0,1],8811:[.0391,.5391,0,0,1],8826:[.0391,.5391,0,0,.77778],8827:[.0391,.5391,0,0,.77778],8834:[.0391,.5391,0,0,.77778],8835:[.0391,.5391,0,0,.77778],8838:[.13597,.63597,0,0,.77778],8839:[.13597,.63597,0,0,.77778],8846:[0,.55556,0,0,.66667],8849:[.13597,.63597,0,0,.77778],8850:[.13597,.63597,0,0,.77778],8851:[0,.55556,0,0,.66667],8852:[0,.55556,0,0,.66667],8853:[.08333,.58333,0,0,.77778],8854:[.08333,.58333,0,0,.77778],8855:[.08333,.58333,0,0,.77778],8856:[.08333,.58333,0,0,.77778],8857:[.08333,.58333,0,0,.77778],8866:[0,.69444,0,0,.61111],8867:[0,.69444,0,0,.61111],8868:[0,.69444,0,0,.77778],8869:[0,.69444,0,0,.77778],8872:[.249,.75,0,0,.867],8900:[-.05555,.44445,0,0,.5],8901:[-.05555,.44445,0,0,.27778],8902:[-.03472,.46528,0,0,.5],8904:[.005,.505,0,0,.9],8942:[.03,.903,0,0,.278],8943:[-.19,.313,0,0,1.172],8945:[-.1,.823,0,0,1.282],8968:[.25,.75,0,0,.44445],8969:[.25,.75,0,0,.44445],8970:[.25,.75,0,0,.44445],8971:[.25,.75,0,0,.44445],8994:[-.14236,.35764,0,0,1],8995:[-.14236,.35764,0,0,1],9136:[.244,.744,0,0,.412],9137:[.244,.745,0,0,.412],9651:[.19444,.69444,0,0,.88889],9657:[-.03472,.46528,0,0,.5],9661:[.19444,.69444,0,0,.88889],9667:[-.03472,.46528,0,0,.5],9711:[.19444,.69444,0,0,1],9824:[.12963,.69444,0,0,.77778],9825:[.12963,.69444,0,0,.77778],9826:[.12963,.69444,0,0,.77778],9827:[.12963,.69444,0,0,.77778],9837:[0,.75,0,0,.38889],9838:[.19444,.69444,0,0,.38889],9839:[.19444,.69444,0,0,.38889],10216:[.25,.75,0,0,.38889],10217:[.25,.75,0,0,.38889],10222:[.244,.744,0,0,.412],10223:[.244,.745,0,0,.412],10229:[.011,.511,0,0,1.609],10230:[.011,.511,0,0,1.638],10231:[.011,.511,0,0,1.859],10232:[.024,.525,0,0,1.609],10233:[.024,.525,0,0,1.638],10234:[.024,.525,0,0,1.858],10236:[.011,.511,0,0,1.638],10815:[0,.68333,0,0,.75],10927:[.13597,.63597,0,0,.77778],10928:[.13597,.63597,0,0,.77778],57376:[.19444,.69444,0,0,0]},"Math-BoldItalic":{32:[0,0,0,0,.25],48:[0,.44444,0,0,.575],49:[0,.44444,0,0,.575],50:[0,.44444,0,0,.575],51:[.19444,.44444,0,0,.575],52:[.19444,.44444,0,0,.575],53:[.19444,.44444,0,0,.575],54:[0,.64444,0,0,.575],55:[.19444,.44444,0,0,.575],56:[0,.64444,0,0,.575],57:[.19444,.44444,0,0,.575],65:[0,.68611,0,0,.86944],66:[0,.68611,.04835,0,.8664],67:[0,.68611,.06979,0,.81694],68:[0,.68611,.03194,0,.93812],69:[0,.68611,.05451,0,.81007],70:[0,.68611,.15972,0,.68889],71:[0,.68611,0,0,.88673],72:[0,.68611,.08229,0,.98229],73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:[0,.68611,0,0,.75555],77:[0,.68611,.11424,0,1.14201],78:[0,.68611,.11424,0,.95034],79:[0,.68611,.03194,0,.83666],80:[0,.68611,.15972,0,.72309],81:[.19444,.68611,0,0,.86861],82:[0,.68611,.00421,0,.87235],83:[0,.68611,.05382,0,.69271],84:[0,.68611,.15972,0,.63663],85:[0,.68611,.11424,0,.80027],86:[0,.68611,.25555,0,.67778],87:[0,.68611,.15972,0,1.09305],88:[0,.68611,.07778,0,.94722],89:[0,.68611,.25555,0,.67458],90:[0,.68611,.06979,0,.77257],97:[0,.44444,0,0,.63287],98:[0,.69444,0,0,.52083],99:[0,.44444,0,0,.51342],100:[0,.69444,0,0,.60972],101:[0,.44444,0,0,.55361],102:[.19444,.69444,.11042,0,.56806],103:[.19444,.44444,.03704,0,.5449],104:[0,.69444,0,0,.66759],105:[0,.69326,0,0,.4048],106:[.19444,.69326,.0622,0,.47083],107:[0,.69444,.01852,0,.6037],108:[0,.69444,.0088,0,.34815],109:[0,.44444,0,0,1.0324],110:[0,.44444,0,0,.71296],111:[0,.44444,0,0,.58472],112:[.19444,.44444,0,0,.60092],113:[.19444,.44444,.03704,0,.54213],114:[0,.44444,.03194,0,.5287],115:[0,.44444,0,0,.53125],116:[0,.63492,0,0,.41528],117:[0,.44444,0,0,.68102],118:[0,.44444,.03704,0,.56666],119:[0,.44444,.02778,0,.83148],120:[0,.44444,0,0,.65903],121:[.19444,.44444,.03704,0,.59028],122:[0,.44444,.04213,0,.55509],160:[0,0,0,0,.25],915:[0,.68611,.15972,0,.65694],916:[0,.68611,0,0,.95833],920:[0,.68611,.03194,0,.86722],923:[0,.68611,0,0,.80555],926:[0,.68611,.07458,0,.84125],928:[0,.68611,.08229,0,.98229],931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:[0,.68611,0,0,.76666],936:[0,.68611,.11653,0,.71402],937:[0,.68611,.04835,0,.8789],945:[0,.44444,0,0,.76064],946:[.19444,.69444,.03403,0,.65972],947:[.19444,.44444,.06389,0,.59003],948:[0,.69444,.03819,0,.52222],949:[0,.44444,0,0,.52882],950:[.19444,.69444,.06215,0,.50833],951:[.19444,.44444,.03704,0,.6],952:[0,.69444,.03194,0,.5618],953:[0,.44444,0,0,.41204],954:[0,.44444,0,0,.66759],955:[0,.69444,0,0,.67083],956:[.19444,.44444,0,0,.70787],957:[0,.44444,.06898,0,.57685],958:[.19444,.69444,.03021,0,.50833],959:[0,.44444,0,0,.58472],960:[0,.44444,.03704,0,.68241],961:[.19444,.44444,0,0,.6118],962:[.09722,.44444,.07917,0,.42361],963:[0,.44444,.03704,0,.68588],964:[0,.44444,.13472,0,.52083],965:[0,.44444,.03704,0,.63055],966:[.19444,.44444,0,0,.74722],967:[.19444,.44444,0,0,.71805],968:[.19444,.69444,.03704,0,.75833],969:[0,.44444,.03704,0,.71782],977:[0,.69444,0,0,.69155],981:[.19444,.69444,0,0,.7125],982:[0,.44444,.03194,0,.975],1009:[.19444,.44444,0,0,.6118],1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:[0,0,0,0,.25],48:[0,.43056,0,0,.5],49:[0,.43056,0,0,.5],50:[0,.43056,0,0,.5],51:[.19444,.43056,0,0,.5],52:[.19444,.43056,0,0,.5],53:[.19444,.43056,0,0,.5],54:[0,.64444,0,0,.5],55:[.19444,.43056,0,0,.5],56:[0,.64444,0,0,.5],57:[.19444,.43056,0,0,.5],65:[0,.68333,0,.13889,.75],66:[0,.68333,.05017,.08334,.75851],67:[0,.68333,.07153,.08334,.71472],68:[0,.68333,.02778,.05556,.82792],69:[0,.68333,.05764,.08334,.7382],70:[0,.68333,.13889,.08334,.64306],71:[0,.68333,0,.08334,.78625],72:[0,.68333,.08125,.05556,.83125],73:[0,.68333,.07847,.11111,.43958],74:[0,.68333,.09618,.16667,.55451],75:[0,.68333,.07153,.05556,.84931],76:[0,.68333,0,.02778,.68056],77:[0,.68333,.10903,.08334,.97014],78:[0,.68333,.10903,.08334,.80347],79:[0,.68333,.02778,.08334,.76278],80:[0,.68333,.13889,.08334,.64201],81:[.19444,.68333,0,.08334,.79056],82:[0,.68333,.00773,.08334,.75929],83:[0,.68333,.05764,.08334,.6132],84:[0,.68333,.13889,.08334,.58438],85:[0,.68333,.10903,.02778,.68278],86:[0,.68333,.22222,0,.58333],87:[0,.68333,.13889,0,.94445],88:[0,.68333,.07847,.08334,.82847],89:[0,.68333,.22222,0,.58056],90:[0,.68333,.07153,.08334,.68264],97:[0,.43056,0,0,.52859],98:[0,.69444,0,0,.42917],99:[0,.43056,0,.05556,.43276],100:[0,.69444,0,.16667,.52049],101:[0,.43056,0,.05556,.46563],102:[.19444,.69444,.10764,.16667,.48959],103:[.19444,.43056,.03588,.02778,.47697],104:[0,.69444,0,0,.57616],105:[0,.65952,0,0,.34451],106:[.19444,.65952,.05724,0,.41181],107:[0,.69444,.03148,0,.5206],108:[0,.69444,.01968,.08334,.29838],109:[0,.43056,0,0,.87801],110:[0,.43056,0,0,.60023],111:[0,.43056,0,.05556,.48472],112:[.19444,.43056,0,.08334,.50313],113:[.19444,.43056,.03588,.08334,.44641],114:[0,.43056,.02778,.05556,.45116],115:[0,.43056,0,.05556,.46875],116:[0,.61508,0,.08334,.36111],117:[0,.43056,0,.02778,.57246],118:[0,.43056,.03588,.02778,.48472],119:[0,.43056,.02691,.08334,.71592],120:[0,.43056,0,.02778,.57153],121:[.19444,.43056,.03588,.05556,.49028],122:[0,.43056,.04398,.05556,.46505],160:[0,0,0,0,.25],915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:[0,.68333,.02778,.08334,.76278],923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:[0,.68333,.08125,.05556,.83125],931:[0,.68333,.05764,.08334,.77986],933:[0,.68333,.13889,.05556,.58333],934:[0,.68333,0,.08334,.66667],936:[0,.68333,.11,.05556,.61222],937:[0,.68333,.05017,.08334,.7724],945:[0,.43056,.0037,.02778,.6397],946:[.19444,.69444,.05278,.08334,.56563],947:[.19444,.43056,.05556,0,.51773],948:[0,.69444,.03785,.05556,.44444],949:[0,.43056,0,.08334,.46632],950:[.19444,.69444,.07378,.08334,.4375],951:[.19444,.43056,.03588,.05556,.49653],952:[0,.69444,.02778,.08334,.46944],953:[0,.43056,0,.05556,.35394],954:[0,.43056,0,0,.57616],955:[0,.69444,0,0,.58334],956:[.19444,.43056,0,.02778,.60255],957:[0,.43056,.06366,.02778,.49398],958:[.19444,.69444,.04601,.11111,.4375],959:[0,.43056,0,.05556,.48472],960:[0,.43056,.03588,0,.57003],961:[.19444,.43056,0,.08334,.51702],962:[.09722,.43056,.07986,.08334,.36285],963:[0,.43056,.03588,0,.57141],964:[0,.43056,.1132,.02778,.43715],965:[0,.43056,.03588,.02778,.54028],966:[.19444,.43056,0,.08334,.65417],967:[.19444,.43056,0,.05556,.62569],968:[.19444,.69444,.03588,.11111,.65139],969:[0,.43056,.03588,0,.62245],977:[0,.69444,0,.08334,.59144],981:[.19444,.69444,0,.08334,.59583],982:[0,.43056,.02778,0,.82813],1009:[.19444,.43056,0,.08334,.51702],1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.36667],34:[0,.69444,0,0,.55834],35:[.19444,.69444,0,0,.91667],36:[.05556,.75,0,0,.55],37:[.05556,.75,0,0,1.02912],38:[0,.69444,0,0,.83056],39:[0,.69444,0,0,.30556],40:[.25,.75,0,0,.42778],41:[.25,.75,0,0,.42778],42:[0,.75,0,0,.55],43:[.11667,.61667,0,0,.85556],44:[.10556,.13056,0,0,.30556],45:[0,.45833,0,0,.36667],46:[0,.13056,0,0,.30556],47:[.25,.75,0,0,.55],48:[0,.69444,0,0,.55],49:[0,.69444,0,0,.55],50:[0,.69444,0,0,.55],51:[0,.69444,0,0,.55],52:[0,.69444,0,0,.55],53:[0,.69444,0,0,.55],54:[0,.69444,0,0,.55],55:[0,.69444,0,0,.55],56:[0,.69444,0,0,.55],57:[0,.69444,0,0,.55],58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:[0,.69444,0,0,.51945],64:[0,.69444,0,0,.73334],65:[0,.69444,0,0,.73334],66:[0,.69444,0,0,.73334],67:[0,.69444,0,0,.70278],68:[0,.69444,0,0,.79445],69:[0,.69444,0,0,.64167],70:[0,.69444,0,0,.61111],71:[0,.69444,0,0,.73334],72:[0,.69444,0,0,.79445],73:[0,.69444,0,0,.33056],74:[0,.69444,0,0,.51945],75:[0,.69444,0,0,.76389],76:[0,.69444,0,0,.58056],77:[0,.69444,0,0,.97778],78:[0,.69444,0,0,.79445],79:[0,.69444,0,0,.79445],80:[0,.69444,0,0,.70278],81:[.10556,.69444,0,0,.79445],82:[0,.69444,0,0,.70278],83:[0,.69444,0,0,.61111],84:[0,.69444,0,0,.73334],85:[0,.69444,0,0,.76389],86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:[0,.69444,0,0,.73334],89:[0,.69444,.0275,0,.73334],90:[0,.69444,0,0,.67223],91:[.25,.75,0,0,.34306],93:[.25,.75,0,0,.34306],94:[0,.69444,0,0,.55],95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:[0,.69444,0,0,.56111],99:[0,.45833,0,0,.48889],100:[0,.69444,0,0,.56111],101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:[0,.69444,0,0,.56111],105:[0,.69444,0,0,.25556],106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:[0,.69444,0,0,.25556],109:[0,.45833,0,0,.86667],110:[0,.45833,0,0,.56111],111:[0,.45833,0,0,.55],112:[.19444,.45833,0,0,.56111],113:[.19444,.45833,0,0,.56111],114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:[0,.45833,0,0,.56111],118:[0,.45833,.01528,0,.5],119:[0,.45833,.01528,0,.74445],120:[0,.45833,0,0,.5],121:[.19444,.45833,.01528,0,.5],122:[0,.45833,0,0,.47639],126:[.35,.34444,0,0,.55],160:[0,0,0,0,.25],168:[0,.69444,0,0,.55],176:[0,.69444,0,0,.73334],180:[0,.69444,0,0,.55],184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:[0,.69444,0,0,.55],711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:[0,.69444,0,0,.55],729:[0,.69444,0,0,.30556],730:[0,.69444,0,0,.73334],732:[0,.69444,0,0,.55],733:[0,.69444,0,0,.55],915:[0,.69444,0,0,.58056],916:[0,.69444,0,0,.91667],920:[0,.69444,0,0,.85556],923:[0,.69444,0,0,.67223],926:[0,.69444,0,0,.73334],928:[0,.69444,0,0,.79445],931:[0,.69444,0,0,.79445],933:[0,.69444,0,0,.85556],934:[0,.69444,0,0,.79445],936:[0,.69444,0,0,.85556],937:[0,.69444,0,0,.79445],8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:[0,.69444,0,0,.30556],8217:[0,.69444,0,0,.30556],8220:[0,.69444,0,0,.55834],8221:[0,.69444,0,0,.55834]},"SansSerif-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.05733,0,.31945],34:[0,.69444,.00316,0,.5],35:[.19444,.69444,.05087,0,.83334],36:[.05556,.75,.11156,0,.5],37:[.05556,.75,.03126,0,.83334],38:[0,.69444,.03058,0,.75834],39:[0,.69444,.07816,0,.27778],40:[.25,.75,.13164,0,.38889],41:[.25,.75,.02536,0,.38889],42:[0,.75,.11775,0,.5],43:[.08333,.58333,.02536,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,.01946,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,.13164,0,.5],48:[0,.65556,.11156,0,.5],49:[0,.65556,.11156,0,.5],50:[0,.65556,.11156,0,.5],51:[0,.65556,.11156,0,.5],52:[0,.65556,.11156,0,.5],53:[0,.65556,.11156,0,.5],54:[0,.65556,.11156,0,.5],55:[0,.65556,.11156,0,.5],56:[0,.65556,.11156,0,.5],57:[0,.65556,.11156,0,.5],58:[0,.44444,.02502,0,.27778],59:[.125,.44444,.02502,0,.27778],61:[-.13,.37,.05087,0,.77778],63:[0,.69444,.11809,0,.47222],64:[0,.69444,.07555,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,.08293,0,.66667],67:[0,.69444,.11983,0,.63889],68:[0,.69444,.07555,0,.72223],69:[0,.69444,.11983,0,.59722],70:[0,.69444,.13372,0,.56945],71:[0,.69444,.11983,0,.66667],72:[0,.69444,.08094,0,.70834],73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,.08094,0,.875],78:[0,.69444,.08094,0,.70834],79:[0,.69444,.07555,0,.73611],80:[0,.69444,.08293,0,.63889],81:[.125,.69444,.07555,0,.73611],82:[0,.69444,.08293,0,.64584],83:[0,.69444,.09205,0,.55556],84:[0,.69444,.13372,0,.68056],85:[0,.69444,.08094,0,.6875],86:[0,.69444,.1615,0,.66667],87:[0,.69444,.1615,0,.94445],88:[0,.69444,.13372,0,.66667],89:[0,.69444,.17261,0,.66667],90:[0,.69444,.11983,0,.61111],91:[.25,.75,.15942,0,.28889],93:[.25,.75,.08719,0,.28889],94:[0,.69444,.0799,0,.5],95:[.35,.09444,.08616,0,.5],97:[0,.44444,.00981,0,.48056],98:[0,.69444,.03057,0,.51667],99:[0,.44444,.08336,0,.44445],100:[0,.69444,.09483,0,.51667],101:[0,.44444,.06778,0,.44445],102:[0,.69444,.21705,0,.30556],103:[.19444,.44444,.10836,0,.5],104:[0,.69444,.01778,0,.51667],105:[0,.67937,.09718,0,.23889],106:[.19444,.67937,.09162,0,.26667],107:[0,.69444,.08336,0,.48889],108:[0,.69444,.09483,0,.23889],109:[0,.44444,.01778,0,.79445],110:[0,.44444,.01778,0,.51667],111:[0,.44444,.06613,0,.5],112:[.19444,.44444,.0389,0,.51667],113:[.19444,.44444,.04169,0,.51667],114:[0,.44444,.10836,0,.34167],115:[0,.44444,.0778,0,.38333],116:[0,.57143,.07225,0,.36111],117:[0,.44444,.04169,0,.51667],118:[0,.44444,.10836,0,.46111],119:[0,.44444,.10836,0,.68334],120:[0,.44444,.09169,0,.46111],121:[.19444,.44444,.10836,0,.46111],122:[0,.44444,.08752,0,.43472],126:[.35,.32659,.08826,0,.5],160:[0,0,0,0,.25],168:[0,.67937,.06385,0,.5],176:[0,.69444,0,0,.73752],184:[.17014,0,0,0,.44445],305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:[0,.69444,.0799,0,.5],711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:[0,.69444,.09205,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:[0,.69444,0,0,.73752],732:[0,.67659,.08826,0,.5],733:[0,.69444,.09205,0,.5],915:[0,.69444,.13372,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,.07555,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,.12816,0,.66667],928:[0,.69444,.08094,0,.70834],931:[0,.69444,.11983,0,.72222],933:[0,.69444,.09031,0,.77778],934:[0,.69444,.04603,0,.72222],936:[0,.69444,.09031,0,.77778],937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:[0,.69444,.07816,0,.27778],8217:[0,.69444,.07816,0,.27778],8220:[0,.69444,.14205,0,.5],8221:[0,.69444,.00316,0,.5]},"SansSerif-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.31945],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.75834],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,0,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.65556,0,0,.5],49:[0,.65556,0,0,.5],50:[0,.65556,0,0,.5],51:[0,.65556,0,0,.5],52:[0,.65556,0,0,.5],53:[0,.65556,0,0,.5],54:[0,.65556,0,0,.5],55:[0,.65556,0,0,.5],56:[0,.65556,0,0,.5],57:[0,.65556,0,0,.5],58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,0,0,.66667],67:[0,.69444,0,0,.63889],68:[0,.69444,0,0,.72223],69:[0,.69444,0,0,.59722],70:[0,.69444,0,0,.56945],71:[0,.69444,0,0,.66667],72:[0,.69444,0,0,.70834],73:[0,.69444,0,0,.27778],74:[0,.69444,0,0,.47222],75:[0,.69444,0,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,0,0,.875],78:[0,.69444,0,0,.70834],79:[0,.69444,0,0,.73611],80:[0,.69444,0,0,.63889],81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:[0,.69444,0,0,.55556],84:[0,.69444,0,0,.68056],85:[0,.69444,0,0,.6875],86:[0,.69444,.01389,0,.66667],87:[0,.69444,.01389,0,.94445],88:[0,.69444,0,0,.66667],89:[0,.69444,.025,0,.66667],90:[0,.69444,0,0,.61111],91:[.25,.75,0,0,.28889],93:[.25,.75,0,0,.28889],94:[0,.69444,0,0,.5],95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:[0,.69444,0,0,.51667],99:[0,.44444,0,0,.44445],100:[0,.69444,0,0,.51667],101:[0,.44444,0,0,.44445],102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:[0,.69444,0,0,.51667],105:[0,.67937,0,0,.23889],106:[.19444,.67937,0,0,.26667],107:[0,.69444,0,0,.48889],108:[0,.69444,0,0,.23889],109:[0,.44444,0,0,.79445],110:[0,.44444,0,0,.51667],111:[0,.44444,0,0,.5],112:[.19444,.44444,0,0,.51667],113:[.19444,.44444,0,0,.51667],114:[0,.44444,.01389,0,.34167],115:[0,.44444,0,0,.38333],116:[0,.57143,0,0,.36111],117:[0,.44444,0,0,.51667],118:[0,.44444,.01389,0,.46111],119:[0,.44444,.01389,0,.68334],120:[0,.44444,0,0,.46111],121:[.19444,.44444,.01389,0,.46111],122:[0,.44444,0,0,.43472],126:[.35,.32659,0,0,.5],160:[0,0,0,0,.25],168:[0,.67937,0,0,.5],176:[0,.69444,0,0,.66667],184:[.17014,0,0,0,.44445],305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:[0,.69444,0,0,.5],711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.67937,0,0,.27778],730:[0,.69444,0,0,.66667],732:[0,.67659,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.69444,0,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,0,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,0,0,.66667],928:[0,.69444,0,0,.70834],931:[0,.69444,0,0,.72222],933:[0,.69444,0,0,.77778],934:[0,.69444,0,0,.72222],936:[0,.69444,0,0,.77778],937:[0,.69444,0,0,.72222],8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5]},"Script-Regular":{32:[0,0,0,0,.25],65:[0,.7,.22925,0,.80253],66:[0,.7,.04087,0,.90757],67:[0,.7,.1689,0,.66619],68:[0,.7,.09371,0,.77443],69:[0,.7,.18583,0,.56162],70:[0,.7,.13634,0,.89544],71:[0,.7,.17322,0,.60961],72:[0,.7,.29694,0,.96919],73:[0,.7,.19189,0,.80907],74:[.27778,.7,.19189,0,1.05159],75:[0,.7,.31259,0,.91364],76:[0,.7,.19189,0,.87373],77:[0,.7,.15981,0,1.08031],78:[0,.7,.3525,0,.9015],79:[0,.7,.08078,0,.73787],80:[0,.7,.08078,0,1.01262],81:[0,.7,.03305,0,.88282],82:[0,.7,.06259,0,.85],83:[0,.7,.19189,0,.86767],84:[0,.7,.29087,0,.74697],85:[0,.7,.25815,0,.79996],86:[0,.7,.27523,0,.62204],87:[0,.7,.27523,0,.80532],88:[0,.7,.26006,0,.94445],89:[0,.7,.2939,0,.70961],90:[0,.7,.24037,0,.8212],160:[0,0,0,0,.25]},"Size1-Regular":{32:[0,0,0,0,.25],40:[.35001,.85,0,0,.45834],41:[.35001,.85,0,0,.45834],47:[.35001,.85,0,0,.57778],91:[.35001,.85,0,0,.41667],92:[.35001,.85,0,0,.57778],93:[.35001,.85,0,0,.41667],123:[.35001,.85,0,0,.58334],125:[.35001,.85,0,0,.58334],160:[0,0,0,0,.25],710:[0,.72222,0,0,.55556],732:[0,.72222,0,0,.55556],770:[0,.72222,0,0,.55556],771:[0,.72222,0,0,.55556],8214:[-99e-5,.601,0,0,.77778],8593:[1e-5,.6,0,0,.66667],8595:[1e-5,.6,0,0,.66667],8657:[1e-5,.6,0,0,.77778],8659:[1e-5,.6,0,0,.77778],8719:[.25001,.75,0,0,.94445],8720:[.25001,.75,0,0,.94445],8721:[.25001,.75,0,0,1.05556],8730:[.35001,.85,0,0,1],8739:[-.00599,.606,0,0,.33333],8741:[-.00599,.606,0,0,.55556],8747:[.30612,.805,.19445,0,.47222],8748:[.306,.805,.19445,0,.47222],8749:[.306,.805,.19445,0,.47222],8750:[.30612,.805,.19445,0,.47222],8896:[.25001,.75,0,0,.83334],8897:[.25001,.75,0,0,.83334],8898:[.25001,.75,0,0,.83334],8899:[.25001,.75,0,0,.83334],8968:[.35001,.85,0,0,.47222],8969:[.35001,.85,0,0,.47222],8970:[.35001,.85,0,0,.47222],8971:[.35001,.85,0,0,.47222],9168:[-99e-5,.601,0,0,.66667],10216:[.35001,.85,0,0,.47222],10217:[.35001,.85,0,0,.47222],10752:[.25001,.75,0,0,1.11111],10753:[.25001,.75,0,0,1.11111],10754:[.25001,.75,0,0,1.11111],10756:[.25001,.75,0,0,.83334],10758:[.25001,.75,0,0,.83334]},"Size2-Regular":{32:[0,0,0,0,.25],40:[.65002,1.15,0,0,.59722],41:[.65002,1.15,0,0,.59722],47:[.65002,1.15,0,0,.81111],91:[.65002,1.15,0,0,.47222],92:[.65002,1.15,0,0,.81111],93:[.65002,1.15,0,0,.47222],123:[.65002,1.15,0,0,.66667],125:[.65002,1.15,0,0,.66667],160:[0,0,0,0,.25],710:[0,.75,0,0,1],732:[0,.75,0,0,1],770:[0,.75,0,0,1],771:[0,.75,0,0,1],8719:[.55001,1.05,0,0,1.27778],8720:[.55001,1.05,0,0,1.27778],8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:[.86225,1.36,.44445,0,.55556],8748:[.862,1.36,.44445,0,.55556],8749:[.862,1.36,.44445,0,.55556],8750:[.86225,1.36,.44445,0,.55556],8896:[.55001,1.05,0,0,1.11111],8897:[.55001,1.05,0,0,1.11111],8898:[.55001,1.05,0,0,1.11111],8899:[.55001,1.05,0,0,1.11111],8968:[.65002,1.15,0,0,.52778],8969:[.65002,1.15,0,0,.52778],8970:[.65002,1.15,0,0,.52778],8971:[.65002,1.15,0,0,.52778],10216:[.65002,1.15,0,0,.61111],10217:[.65002,1.15,0,0,.61111],10752:[.55001,1.05,0,0,1.51112],10753:[.55001,1.05,0,0,1.51112],10754:[.55001,1.05,0,0,1.51112],10756:[.55001,1.05,0,0,1.11111],10758:[.55001,1.05,0,0,1.11111]},"Size3-Regular":{32:[0,0,0,0,.25],40:[.95003,1.45,0,0,.73611],41:[.95003,1.45,0,0,.73611],47:[.95003,1.45,0,0,1.04445],91:[.95003,1.45,0,0,.52778],92:[.95003,1.45,0,0,1.04445],93:[.95003,1.45,0,0,.52778],123:[.95003,1.45,0,0,.75],125:[.95003,1.45,0,0,.75],160:[0,0,0,0,.25],710:[0,.75,0,0,1.44445],732:[0,.75,0,0,1.44445],770:[0,.75,0,0,1.44445],771:[0,.75,0,0,1.44445],8730:[.95003,1.45,0,0,1],8968:[.95003,1.45,0,0,.58334],8969:[.95003,1.45,0,0,.58334],8970:[.95003,1.45,0,0,.58334],8971:[.95003,1.45,0,0,.58334],10216:[.95003,1.45,0,0,.75],10217:[.95003,1.45,0,0,.75]},"Size4-Regular":{32:[0,0,0,0,.25],40:[1.25003,1.75,0,0,.79167],41:[1.25003,1.75,0,0,.79167],47:[1.25003,1.75,0,0,1.27778],91:[1.25003,1.75,0,0,.58334],92:[1.25003,1.75,0,0,1.27778],93:[1.25003,1.75,0,0,.58334],123:[1.25003,1.75,0,0,.80556],125:[1.25003,1.75,0,0,.80556],160:[0,0,0,0,.25],710:[0,.825,0,0,1.8889],732:[0,.825,0,0,1.8889],770:[0,.825,0,0,1.8889],771:[0,.825,0,0,1.8889],8730:[1.25003,1.75,0,0,1],8968:[1.25003,1.75,0,0,.63889],8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},za={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[.25,.25,.25],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},_l={Å:"A",Ð:"D",Þ:"o",å:"a",ð:"d",þ:"o",А:"A",Б:"B",В:"B",Г:"F",Д:"A",Е:"E",Ж:"K",З:"3",И:"N",Й:"N",К:"K",Л:"N",М:"M",Н:"H",О:"O",П:"N",Р:"P",С:"C",Т:"T",У:"y",Ф:"O",Х:"X",Ц:"U",Ч:"h",Ш:"W",Щ:"W",Ъ:"B",Ы:"X",Ь:"B",Э:"3",Ю:"X",Я:"R",а:"a",б:"b",в:"a",г:"r",д:"y",е:"e",ж:"m",з:"e",и:"n",й:"n",к:"n",л:"n",м:"m",н:"n",о:"o",п:"n",р:"p",с:"c",т:"o",у:"y",ф:"b",х:"x",ц:"n",ч:"n",ш:"w",щ:"w",ъ:"a",ы:"m",ь:"a",э:"e",ю:"m",я:"r"};function ym(e,t){sr[e]=t}function I0(e,t,n){if(!sr[t])throw new Error("Font metrics not found for font: "+t+".");var r=e.charCodeAt(0),i=sr[t][r];if(!i&&e[0]in _l&&(r=_l[e[0]].charCodeAt(0),i=sr[t][r]),!i&&n==="text"&&od(r)&&(i=sr[t][77]),i)return{depth:i[0],height:i[1],italic:i[2],skew:i[3],width:i[4]}}var ao={};function bm(e){var t;if(e>=5?t=0:e>=3?t=1:t=2,!ao[t]){var n=ao[t]={cssEmPerMu:za.quad[t]/18};for(var r in za)za.hasOwnProperty(r)&&(n[r]=za[r][t])}return ao[t]}var Dt={math:{},text:{}};function h(e,t,n,r,i,a){Dt[e][i]={font:t,group:n,replace:r},a&&r&&(Dt[e][r]=Dt[e][i])}var m="math",V="text",v="main",T="ams",Bt="accent-token",ke="bin",xn="close",Ki="inner",Be="mathord",Yt="op-token",On="open",Ta="punct",M="rel",Rr="spacing",N="textord";h(m,v,M,"≡","\\equiv",!0);h(m,v,M,"≺","\\prec",!0);h(m,v,M,"≻","\\succ",!0);h(m,v,M,"∼","\\sim",!0);h(m,v,M,"⊥","\\perp");h(m,v,M,"⪯","\\preceq",!0);h(m,v,M,"⪰","\\succeq",!0);h(m,v,M,"≃","\\simeq",!0);h(m,v,M,"∣","\\mid",!0);h(m,v,M,"≪","\\ll",!0);h(m,v,M,"≫","\\gg",!0);h(m,v,M,"≍","\\asymp",!0);h(m,v,M,"∥","\\parallel");h(m,v,M,"⋈","\\bowtie",!0);h(m,v,M,"⌣","\\smile",!0);h(m,v,M,"⊑","\\sqsubseteq",!0);h(m,v,M,"⊒","\\sqsupseteq",!0);h(m,v,M,"≐","\\doteq",!0);h(m,v,M,"⌢","\\frown",!0);h(m,v,M,"∋","\\ni",!0);h(m,v,M,"∝","\\propto",!0);h(m,v,M,"⊢","\\vdash",!0);h(m,v,M,"⊣","\\dashv",!0);h(m,v,M,"∋","\\owns");h(m,v,Ta,".","\\ldotp");h(m,v,Ta,"⋅","\\cdotp");h(m,v,Ta,"⋅","·");h(V,v,N,"⋅","·");h(m,v,N,"#","\\#");h(V,v,N,"#","\\#");h(m,v,N,"&","\\&");h(V,v,N,"&","\\&");h(m,v,N,"ℵ","\\aleph",!0);h(m,v,N,"∀","\\forall",!0);h(m,v,N,"ℏ","\\hbar",!0);h(m,v,N,"∃","\\exists",!0);h(m,v,N,"∇","\\nabla",!0);h(m,v,N,"♭","\\flat",!0);h(m,v,N,"ℓ","\\ell",!0);h(m,v,N,"♮","\\natural",!0);h(m,v,N,"♣","\\clubsuit",!0);h(m,v,N,"℘","\\wp",!0);h(m,v,N,"♯","\\sharp",!0);h(m,v,N,"♢","\\diamondsuit",!0);h(m,v,N,"ℜ","\\Re",!0);h(m,v,N,"♡","\\heartsuit",!0);h(m,v,N,"ℑ","\\Im",!0);h(m,v,N,"♠","\\spadesuit",!0);h(m,v,N,"§","\\S",!0);h(V,v,N,"§","\\S");h(m,v,N,"¶","\\P",!0);h(V,v,N,"¶","\\P");h(m,v,N,"†","\\dag");h(V,v,N,"†","\\dag");h(V,v,N,"†","\\textdagger");h(m,v,N,"‡","\\ddag");h(V,v,N,"‡","\\ddag");h(V,v,N,"‡","\\textdaggerdbl");h(m,v,xn,"⎱","\\rmoustache",!0);h(m,v,On,"⎰","\\lmoustache",!0);h(m,v,xn,"⟯","\\rgroup",!0);h(m,v,On,"⟮","\\lgroup",!0);h(m,v,ke,"∓","\\mp",!0);h(m,v,ke,"⊖","\\ominus",!0);h(m,v,ke,"⊎","\\uplus",!0);h(m,v,ke,"⊓","\\sqcap",!0);h(m,v,ke,"∗","\\ast");h(m,v,ke,"⊔","\\sqcup",!0);h(m,v,ke,"◯","\\bigcirc",!0);h(m,v,ke,"∙","\\bullet",!0);h(m,v,ke,"‡","\\ddagger");h(m,v,ke,"≀","\\wr",!0);h(m,v,ke,"⨿","\\amalg");h(m,v,ke,"&","\\And");h(m,v,M,"⟵","\\longleftarrow",!0);h(m,v,M,"⇐","\\Leftarrow",!0);h(m,v,M,"⟸","\\Longleftarrow",!0);h(m,v,M,"⟶","\\longrightarrow",!0);h(m,v,M,"⇒","\\Rightarrow",!0);h(m,v,M,"⟹","\\Longrightarrow",!0);h(m,v,M,"↔","\\leftrightarrow",!0);h(m,v,M,"⟷","\\longleftrightarrow",!0);h(m,v,M,"⇔","\\Leftrightarrow",!0);h(m,v,M,"⟺","\\Longleftrightarrow",!0);h(m,v,M,"↦","\\mapsto",!0);h(m,v,M,"⟼","\\longmapsto",!0);h(m,v,M,"↗","\\nearrow",!0);h(m,v,M,"↩","\\hookleftarrow",!0);h(m,v,M,"↪","\\hookrightarrow",!0);h(m,v,M,"↘","\\searrow",!0);h(m,v,M,"↼","\\leftharpoonup",!0);h(m,v,M,"⇀","\\rightharpoonup",!0);h(m,v,M,"↙","\\swarrow",!0);h(m,v,M,"↽","\\leftharpoondown",!0);h(m,v,M,"⇁","\\rightharpoondown",!0);h(m,v,M,"↖","\\nwarrow",!0);h(m,v,M,"⇌","\\rightleftharpoons",!0);h(m,T,M,"≮","\\nless",!0);h(m,T,M,"","\\@nleqslant");h(m,T,M,"","\\@nleqq");h(m,T,M,"⪇","\\lneq",!0);h(m,T,M,"≨","\\lneqq",!0);h(m,T,M,"","\\@lvertneqq");h(m,T,M,"⋦","\\lnsim",!0);h(m,T,M,"⪉","\\lnapprox",!0);h(m,T,M,"⊀","\\nprec",!0);h(m,T,M,"⋠","\\npreceq",!0);h(m,T,M,"⋨","\\precnsim",!0);h(m,T,M,"⪹","\\precnapprox",!0);h(m,T,M,"≁","\\nsim",!0);h(m,T,M,"","\\@nshortmid");h(m,T,M,"∤","\\nmid",!0);h(m,T,M,"⊬","\\nvdash",!0);h(m,T,M,"⊭","\\nvDash",!0);h(m,T,M,"⋪","\\ntriangleleft");h(m,T,M,"⋬","\\ntrianglelefteq",!0);h(m,T,M,"⊊","\\subsetneq",!0);h(m,T,M,"","\\@varsubsetneq");h(m,T,M,"⫋","\\subsetneqq",!0);h(m,T,M,"","\\@varsubsetneqq");h(m,T,M,"≯","\\ngtr",!0);h(m,T,M,"","\\@ngeqslant");h(m,T,M,"","\\@ngeqq");h(m,T,M,"⪈","\\gneq",!0);h(m,T,M,"≩","\\gneqq",!0);h(m,T,M,"","\\@gvertneqq");h(m,T,M,"⋧","\\gnsim",!0);h(m,T,M,"⪊","\\gnapprox",!0);h(m,T,M,"⊁","\\nsucc",!0);h(m,T,M,"⋡","\\nsucceq",!0);h(m,T,M,"⋩","\\succnsim",!0);h(m,T,M,"⪺","\\succnapprox",!0);h(m,T,M,"≆","\\ncong",!0);h(m,T,M,"","\\@nshortparallel");h(m,T,M,"∦","\\nparallel",!0);h(m,T,M,"⊯","\\nVDash",!0);h(m,T,M,"⋫","\\ntriangleright");h(m,T,M,"⋭","\\ntrianglerighteq",!0);h(m,T,M,"","\\@nsupseteqq");h(m,T,M,"⊋","\\supsetneq",!0);h(m,T,M,"","\\@varsupsetneq");h(m,T,M,"⫌","\\supsetneqq",!0);h(m,T,M,"","\\@varsupsetneqq");h(m,T,M,"⊮","\\nVdash",!0);h(m,T,M,"⪵","\\precneqq",!0);h(m,T,M,"⪶","\\succneqq",!0);h(m,T,M,"","\\@nsubseteqq");h(m,T,ke,"⊴","\\unlhd");h(m,T,ke,"⊵","\\unrhd");h(m,T,M,"↚","\\nleftarrow",!0);h(m,T,M,"↛","\\nrightarrow",!0);h(m,T,M,"⇍","\\nLeftarrow",!0);h(m,T,M,"⇏","\\nRightarrow",!0);h(m,T,M,"↮","\\nleftrightarrow",!0);h(m,T,M,"⇎","\\nLeftrightarrow",!0);h(m,T,M,"△","\\vartriangle");h(m,T,N,"ℏ","\\hslash");h(m,T,N,"▽","\\triangledown");h(m,T,N,"◊","\\lozenge");h(m,T,N,"Ⓢ","\\circledS");h(m,T,N,"®","\\circledR");h(V,T,N,"®","\\circledR");h(m,T,N,"∡","\\measuredangle",!0);h(m,T,N,"∄","\\nexists");h(m,T,N,"℧","\\mho");h(m,T,N,"Ⅎ","\\Finv",!0);h(m,T,N,"⅁","\\Game",!0);h(m,T,N,"‵","\\backprime");h(m,T,N,"▲","\\blacktriangle");h(m,T,N,"▼","\\blacktriangledown");h(m,T,N,"■","\\blacksquare");h(m,T,N,"⧫","\\blacklozenge");h(m,T,N,"★","\\bigstar");h(m,T,N,"∢","\\sphericalangle",!0);h(m,T,N,"∁","\\complement",!0);h(m,T,N,"ð","\\eth",!0);h(V,v,N,"ð","ð");h(m,T,N,"╱","\\diagup");h(m,T,N,"╲","\\diagdown");h(m,T,N,"□","\\square");h(m,T,N,"□","\\Box");h(m,T,N,"◊","\\Diamond");h(m,T,N,"¥","\\yen",!0);h(V,T,N,"¥","\\yen",!0);h(m,T,N,"✓","\\checkmark",!0);h(V,T,N,"✓","\\checkmark");h(m,T,N,"ℶ","\\beth",!0);h(m,T,N,"ℸ","\\daleth",!0);h(m,T,N,"ℷ","\\gimel",!0);h(m,T,N,"ϝ","\\digamma",!0);h(m,T,N,"ϰ","\\varkappa");h(m,T,On,"┌","\\@ulcorner",!0);h(m,T,xn,"┐","\\@urcorner",!0);h(m,T,On,"└","\\@llcorner",!0);h(m,T,xn,"┘","\\@lrcorner",!0);h(m,T,M,"≦","\\leqq",!0);h(m,T,M,"⩽","\\leqslant",!0);h(m,T,M,"⪕","\\eqslantless",!0);h(m,T,M,"≲","\\lesssim",!0);h(m,T,M,"⪅","\\lessapprox",!0);h(m,T,M,"≊","\\approxeq",!0);h(m,T,ke,"⋖","\\lessdot");h(m,T,M,"⋘","\\lll",!0);h(m,T,M,"≶","\\lessgtr",!0);h(m,T,M,"⋚","\\lesseqgtr",!0);h(m,T,M,"⪋","\\lesseqqgtr",!0);h(m,T,M,"≑","\\doteqdot");h(m,T,M,"≓","\\risingdotseq",!0);h(m,T,M,"≒","\\fallingdotseq",!0);h(m,T,M,"∽","\\backsim",!0);h(m,T,M,"⋍","\\backsimeq",!0);h(m,T,M,"⫅","\\subseteqq",!0);h(m,T,M,"⋐","\\Subset",!0);h(m,T,M,"⊏","\\sqsubset",!0);h(m,T,M,"≼","\\preccurlyeq",!0);h(m,T,M,"⋞","\\curlyeqprec",!0);h(m,T,M,"≾","\\precsim",!0);h(m,T,M,"⪷","\\precapprox",!0);h(m,T,M,"⊲","\\vartriangleleft");h(m,T,M,"⊴","\\trianglelefteq");h(m,T,M,"⊨","\\vDash",!0);h(m,T,M,"⊪","\\Vvdash",!0);h(m,T,M,"⌣","\\smallsmile");h(m,T,M,"⌢","\\smallfrown");h(m,T,M,"≏","\\bumpeq",!0);h(m,T,M,"≎","\\Bumpeq",!0);h(m,T,M,"≧","\\geqq",!0);h(m,T,M,"⩾","\\geqslant",!0);h(m,T,M,"⪖","\\eqslantgtr",!0);h(m,T,M,"≳","\\gtrsim",!0);h(m,T,M,"⪆","\\gtrapprox",!0);h(m,T,ke,"⋗","\\gtrdot");h(m,T,M,"⋙","\\ggg",!0);h(m,T,M,"≷","\\gtrless",!0);h(m,T,M,"⋛","\\gtreqless",!0);h(m,T,M,"⪌","\\gtreqqless",!0);h(m,T,M,"≖","\\eqcirc",!0);h(m,T,M,"≗","\\circeq",!0);h(m,T,M,"≜","\\triangleq",!0);h(m,T,M,"∼","\\thicksim");h(m,T,M,"≈","\\thickapprox");h(m,T,M,"⫆","\\supseteqq",!0);h(m,T,M,"⋑","\\Supset",!0);h(m,T,M,"⊐","\\sqsupset",!0);h(m,T,M,"≽","\\succcurlyeq",!0);h(m,T,M,"⋟","\\curlyeqsucc",!0);h(m,T,M,"≿","\\succsim",!0);h(m,T,M,"⪸","\\succapprox",!0);h(m,T,M,"⊳","\\vartriangleright");h(m,T,M,"⊵","\\trianglerighteq");h(m,T,M,"⊩","\\Vdash",!0);h(m,T,M,"∣","\\shortmid");h(m,T,M,"∥","\\shortparallel");h(m,T,M,"≬","\\between",!0);h(m,T,M,"⋔","\\pitchfork",!0);h(m,T,M,"∝","\\varpropto");h(m,T,M,"◀","\\blacktriangleleft");h(m,T,M,"∴","\\therefore",!0);h(m,T,M,"∍","\\backepsilon");h(m,T,M,"▶","\\blacktriangleright");h(m,T,M,"∵","\\because",!0);h(m,T,M,"⋘","\\llless");h(m,T,M,"⋙","\\gggtr");h(m,T,ke,"⊲","\\lhd");h(m,T,ke,"⊳","\\rhd");h(m,T,M,"≂","\\eqsim",!0);h(m,v,M,"⋈","\\Join");h(m,T,M,"≑","\\Doteq",!0);h(m,T,ke,"∔","\\dotplus",!0);h(m,T,ke,"∖","\\smallsetminus");h(m,T,ke,"⋒","\\Cap",!0);h(m,T,ke,"⋓","\\Cup",!0);h(m,T,ke,"⩞","\\doublebarwedge",!0);h(m,T,ke,"⊟","\\boxminus",!0);h(m,T,ke,"⊞","\\boxplus",!0);h(m,T,ke,"⋇","\\divideontimes",!0);h(m,T,ke,"⋉","\\ltimes",!0);h(m,T,ke,"⋊","\\rtimes",!0);h(m,T,ke,"⋋","\\leftthreetimes",!0);h(m,T,ke,"⋌","\\rightthreetimes",!0);h(m,T,ke,"⋏","\\curlywedge",!0);h(m,T,ke,"⋎","\\curlyvee",!0);h(m,T,ke,"⊝","\\circleddash",!0);h(m,T,ke,"⊛","\\circledast",!0);h(m,T,ke,"⋅","\\centerdot");h(m,T,ke,"⊺","\\intercal",!0);h(m,T,ke,"⋒","\\doublecap");h(m,T,ke,"⋓","\\doublecup");h(m,T,ke,"⊠","\\boxtimes",!0);h(m,T,M,"⇢","\\dashrightarrow",!0);h(m,T,M,"⇠","\\dashleftarrow",!0);h(m,T,M,"⇇","\\leftleftarrows",!0);h(m,T,M,"⇆","\\leftrightarrows",!0);h(m,T,M,"⇚","\\Lleftarrow",!0);h(m,T,M,"↞","\\twoheadleftarrow",!0);h(m,T,M,"↢","\\leftarrowtail",!0);h(m,T,M,"↫","\\looparrowleft",!0);h(m,T,M,"⇋","\\leftrightharpoons",!0);h(m,T,M,"↶","\\curvearrowleft",!0);h(m,T,M,"↺","\\circlearrowleft",!0);h(m,T,M,"↰","\\Lsh",!0);h(m,T,M,"⇈","\\upuparrows",!0);h(m,T,M,"↿","\\upharpoonleft",!0);h(m,T,M,"⇃","\\downharpoonleft",!0);h(m,v,M,"⊶","\\origof",!0);h(m,v,M,"⊷","\\imageof",!0);h(m,T,M,"⊸","\\multimap",!0);h(m,T,M,"↭","\\leftrightsquigarrow",!0);h(m,T,M,"⇉","\\rightrightarrows",!0);h(m,T,M,"⇄","\\rightleftarrows",!0);h(m,T,M,"↠","\\twoheadrightarrow",!0);h(m,T,M,"↣","\\rightarrowtail",!0);h(m,T,M,"↬","\\looparrowright",!0);h(m,T,M,"↷","\\curvearrowright",!0);h(m,T,M,"↻","\\circlearrowright",!0);h(m,T,M,"↱","\\Rsh",!0);h(m,T,M,"⇊","\\downdownarrows",!0);h(m,T,M,"↾","\\upharpoonright",!0);h(m,T,M,"⇂","\\downharpoonright",!0);h(m,T,M,"⇝","\\rightsquigarrow",!0);h(m,T,M,"⇝","\\leadsto");h(m,T,M,"⇛","\\Rrightarrow",!0);h(m,T,M,"↾","\\restriction");h(m,v,N,"‘","`");h(m,v,N,"$","\\$");h(V,v,N,"$","\\$");h(V,v,N,"$","\\textdollar");h(m,v,N,"%","\\%");h(V,v,N,"%","\\%");h(m,v,N,"_","\\_");h(V,v,N,"_","\\_");h(V,v,N,"_","\\textunderscore");h(m,v,N,"∠","\\angle",!0);h(m,v,N,"∞","\\infty",!0);h(m,v,N,"′","\\prime");h(m,v,N,"△","\\triangle");h(m,v,N,"Γ","\\Gamma",!0);h(m,v,N,"Δ","\\Delta",!0);h(m,v,N,"Θ","\\Theta",!0);h(m,v,N,"Λ","\\Lambda",!0);h(m,v,N,"Ξ","\\Xi",!0);h(m,v,N,"Π","\\Pi",!0);h(m,v,N,"Σ","\\Sigma",!0);h(m,v,N,"Υ","\\Upsilon",!0);h(m,v,N,"Φ","\\Phi",!0);h(m,v,N,"Ψ","\\Psi",!0);h(m,v,N,"Ω","\\Omega",!0);h(m,v,N,"A","Α");h(m,v,N,"B","Β");h(m,v,N,"E","Ε");h(m,v,N,"Z","Ζ");h(m,v,N,"H","Η");h(m,v,N,"I","Ι");h(m,v,N,"K","Κ");h(m,v,N,"M","Μ");h(m,v,N,"N","Ν");h(m,v,N,"O","Ο");h(m,v,N,"P","Ρ");h(m,v,N,"T","Τ");h(m,v,N,"X","Χ");h(m,v,N,"¬","\\neg",!0);h(m,v,N,"¬","\\lnot");h(m,v,N,"⊤","\\top");h(m,v,N,"⊥","\\bot");h(m,v,N,"∅","\\emptyset");h(m,T,N,"∅","\\varnothing");h(m,v,Be,"α","\\alpha",!0);h(m,v,Be,"β","\\beta",!0);h(m,v,Be,"γ","\\gamma",!0);h(m,v,Be,"δ","\\delta",!0);h(m,v,Be,"ϵ","\\epsilon",!0);h(m,v,Be,"ζ","\\zeta",!0);h(m,v,Be,"η","\\eta",!0);h(m,v,Be,"θ","\\theta",!0);h(m,v,Be,"ι","\\iota",!0);h(m,v,Be,"κ","\\kappa",!0);h(m,v,Be,"λ","\\lambda",!0);h(m,v,Be,"μ","\\mu",!0);h(m,v,Be,"ν","\\nu",!0);h(m,v,Be,"ξ","\\xi",!0);h(m,v,Be,"ο","\\omicron",!0);h(m,v,Be,"π","\\pi",!0);h(m,v,Be,"ρ","\\rho",!0);h(m,v,Be,"σ","\\sigma",!0);h(m,v,Be,"τ","\\tau",!0);h(m,v,Be,"υ","\\upsilon",!0);h(m,v,Be,"ϕ","\\phi",!0);h(m,v,Be,"χ","\\chi",!0);h(m,v,Be,"ψ","\\psi",!0);h(m,v,Be,"ω","\\omega",!0);h(m,v,Be,"ε","\\varepsilon",!0);h(m,v,Be,"ϑ","\\vartheta",!0);h(m,v,Be,"ϖ","\\varpi",!0);h(m,v,Be,"ϱ","\\varrho",!0);h(m,v,Be,"ς","\\varsigma",!0);h(m,v,Be,"φ","\\varphi",!0);h(m,v,ke,"∗","*",!0);h(m,v,ke,"+","+");h(m,v,ke,"−","-",!0);h(m,v,ke,"⋅","\\cdot",!0);h(m,v,ke,"∘","\\circ",!0);h(m,v,ke,"÷","\\div",!0);h(m,v,ke,"±","\\pm",!0);h(m,v,ke,"×","\\times",!0);h(m,v,ke,"∩","\\cap",!0);h(m,v,ke,"∪","\\cup",!0);h(m,v,ke,"∖","\\setminus",!0);h(m,v,ke,"∧","\\land");h(m,v,ke,"∨","\\lor");h(m,v,ke,"∧","\\wedge",!0);h(m,v,ke,"∨","\\vee",!0);h(m,v,N,"√","\\surd");h(m,v,On,"⟨","\\langle",!0);h(m,v,On,"∣","\\lvert");h(m,v,On,"∥","\\lVert");h(m,v,xn,"?","?");h(m,v,xn,"!","!");h(m,v,xn,"⟩","\\rangle",!0);h(m,v,xn,"∣","\\rvert");h(m,v,xn,"∥","\\rVert");h(m,v,M,"=","=");h(m,v,M,":",":");h(m,v,M,"≈","\\approx",!0);h(m,v,M,"≅","\\cong",!0);h(m,v,M,"≥","\\ge");h(m,v,M,"≥","\\geq",!0);h(m,v,M,"←","\\gets");h(m,v,M,">","\\gt",!0);h(m,v,M,"∈","\\in",!0);h(m,v,M,"","\\@not");h(m,v,M,"⊂","\\subset",!0);h(m,v,M,"⊃","\\supset",!0);h(m,v,M,"⊆","\\subseteq",!0);h(m,v,M,"⊇","\\supseteq",!0);h(m,T,M,"⊈","\\nsubseteq",!0);h(m,T,M,"⊉","\\nsupseteq",!0);h(m,v,M,"⊨","\\models");h(m,v,M,"←","\\leftarrow",!0);h(m,v,M,"≤","\\le");h(m,v,M,"≤","\\leq",!0);h(m,v,M,"<","\\lt",!0);h(m,v,M,"→","\\rightarrow",!0);h(m,v,M,"→","\\to");h(m,T,M,"≱","\\ngeq",!0);h(m,T,M,"≰","\\nleq",!0);h(m,v,Rr," ","\\ ");h(m,v,Rr," ","\\space");h(m,v,Rr," ","\\nobreakspace");h(V,v,Rr," ","\\ ");h(V,v,Rr," "," ");h(V,v,Rr," ","\\space");h(V,v,Rr," ","\\nobreakspace");h(m,v,Rr,"","\\nobreak");h(m,v,Rr,"","\\allowbreak");h(m,v,Ta,",",",");h(m,v,Ta,";",";");h(m,T,ke,"⊼","\\barwedge",!0);h(m,T,ke,"⊻","\\veebar",!0);h(m,v,ke,"⊙","\\odot",!0);h(m,v,ke,"⊕","\\oplus",!0);h(m,v,ke,"⊗","\\otimes",!0);h(m,v,N,"∂","\\partial",!0);h(m,v,ke,"⊘","\\oslash",!0);h(m,T,ke,"⊚","\\circledcirc",!0);h(m,T,ke,"⊡","\\boxdot",!0);h(m,v,ke,"△","\\bigtriangleup");h(m,v,ke,"▽","\\bigtriangledown");h(m,v,ke,"†","\\dagger");h(m,v,ke,"⋄","\\diamond");h(m,v,ke,"⋆","\\star");h(m,v,ke,"◃","\\triangleleft");h(m,v,ke,"▹","\\triangleright");h(m,v,On,"{","\\{");h(V,v,N,"{","\\{");h(V,v,N,"{","\\textbraceleft");h(m,v,xn,"}","\\}");h(V,v,N,"}","\\}");h(V,v,N,"}","\\textbraceright");h(m,v,On,"{","\\lbrace");h(m,v,xn,"}","\\rbrace");h(m,v,On,"[","\\lbrack",!0);h(V,v,N,"[","\\lbrack",!0);h(m,v,xn,"]","\\rbrack",!0);h(V,v,N,"]","\\rbrack",!0);h(m,v,On,"(","\\lparen",!0);h(m,v,xn,")","\\rparen",!0);h(V,v,N,"<","\\textless",!0);h(V,v,N,">","\\textgreater",!0);h(m,v,On,"⌊","\\lfloor",!0);h(m,v,xn,"⌋","\\rfloor",!0);h(m,v,On,"⌈","\\lceil",!0);h(m,v,xn,"⌉","\\rceil",!0);h(m,v,N,"\\","\\backslash");h(m,v,N,"∣","|");h(m,v,N,"∣","\\vert");h(V,v,N,"|","\\textbar",!0);h(m,v,N,"∥","\\|");h(m,v,N,"∥","\\Vert");h(V,v,N,"∥","\\textbardbl");h(V,v,N,"~","\\textasciitilde");h(V,v,N,"\\","\\textbackslash");h(V,v,N,"^","\\textasciicircum");h(m,v,M,"↑","\\uparrow",!0);h(m,v,M,"⇑","\\Uparrow",!0);h(m,v,M,"↓","\\downarrow",!0);h(m,v,M,"⇓","\\Downarrow",!0);h(m,v,M,"↕","\\updownarrow",!0);h(m,v,M,"⇕","\\Updownarrow",!0);h(m,v,Yt,"∐","\\coprod");h(m,v,Yt,"⋁","\\bigvee");h(m,v,Yt,"⋀","\\bigwedge");h(m,v,Yt,"⨄","\\biguplus");h(m,v,Yt,"⋂","\\bigcap");h(m,v,Yt,"⋃","\\bigcup");h(m,v,Yt,"∫","\\int");h(m,v,Yt,"∫","\\intop");h(m,v,Yt,"∬","\\iint");h(m,v,Yt,"∭","\\iiint");h(m,v,Yt,"∏","\\prod");h(m,v,Yt,"∑","\\sum");h(m,v,Yt,"⨂","\\bigotimes");h(m,v,Yt,"⨁","\\bigoplus");h(m,v,Yt,"⨀","\\bigodot");h(m,v,Yt,"∮","\\oint");h(m,v,Yt,"∯","\\oiint");h(m,v,Yt,"∰","\\oiiint");h(m,v,Yt,"⨆","\\bigsqcup");h(m,v,Yt,"∫","\\smallint");h(V,v,Ki,"…","\\textellipsis");h(m,v,Ki,"…","\\mathellipsis");h(V,v,Ki,"…","\\ldots",!0);h(m,v,Ki,"…","\\ldots",!0);h(m,v,Ki,"⋯","\\@cdots",!0);h(m,v,Ki,"⋱","\\ddots",!0);h(m,v,N,"⋮","\\varvdots");h(V,v,N,"⋮","\\varvdots");h(m,v,Bt,"ˊ","\\acute");h(m,v,Bt,"ˋ","\\grave");h(m,v,Bt,"¨","\\ddot");h(m,v,Bt,"~","\\tilde");h(m,v,Bt,"ˉ","\\bar");h(m,v,Bt,"˘","\\breve");h(m,v,Bt,"ˇ","\\check");h(m,v,Bt,"^","\\hat");h(m,v,Bt,"⃗","\\vec");h(m,v,Bt,"˙","\\dot");h(m,v,Bt,"˚","\\mathring");h(m,v,Be,"","\\@imath");h(m,v,Be,"","\\@jmath");h(m,v,N,"ı","ı");h(m,v,N,"ȷ","ȷ");h(V,v,N,"ı","\\i",!0);h(V,v,N,"ȷ","\\j",!0);h(V,v,N,"ß","\\ss",!0);h(V,v,N,"æ","\\ae",!0);h(V,v,N,"œ","\\oe",!0);h(V,v,N,"ø","\\o",!0);h(V,v,N,"Æ","\\AE",!0);h(V,v,N,"Œ","\\OE",!0);h(V,v,N,"Ø","\\O",!0);h(V,v,Bt,"ˊ","\\'");h(V,v,Bt,"ˋ","\\`");h(V,v,Bt,"ˆ","\\^");h(V,v,Bt,"˜","\\~");h(V,v,Bt,"ˉ","\\=");h(V,v,Bt,"˘","\\u");h(V,v,Bt,"˙","\\.");h(V,v,Bt,"¸","\\c");h(V,v,Bt,"˚","\\r");h(V,v,Bt,"ˇ","\\v");h(V,v,Bt,"¨",'\\"');h(V,v,Bt,"˝","\\H");h(V,v,Bt,"◯","\\textcircled");var hd={"--":!0,"---":!0,"``":!0,"''":!0};h(V,v,N,"–","--",!0);h(V,v,N,"–","\\textendash");h(V,v,N,"—","---",!0);h(V,v,N,"—","\\textemdash");h(V,v,N,"‘","`",!0);h(V,v,N,"‘","\\textquoteleft");h(V,v,N,"’","'",!0);h(V,v,N,"’","\\textquoteright");h(V,v,N,"“","``",!0);h(V,v,N,"“","\\textquotedblleft");h(V,v,N,"”","''",!0);h(V,v,N,"”","\\textquotedblright");h(m,v,N,"°","\\degree",!0);h(V,v,N,"°","\\degree");h(V,v,N,"°","\\textdegree",!0);h(m,v,N,"£","\\pounds");h(m,v,N,"£","\\mathsterling",!0);h(V,v,N,"£","\\pounds");h(V,v,N,"£","\\textsterling",!0);h(m,T,N,"✠","\\maltese");h(V,T,N,"✠","\\maltese");var $l='0123456789/@."';for(var so=0;so<$l.length;so++){var Hl=$l.charAt(so);h(m,v,N,Hl,Hl)}var ql='0123456789!@*()-=+";:?/.,';for(var oo=0;oo<ql.length;oo++){var Ul=ql.charAt(oo);h(V,v,N,Ul,Ul)}var cs="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(var lo=0;lo<cs.length;lo++){var ja=cs.charAt(lo);h(m,v,Be,ja,ja),h(V,v,N,ja,ja)}h(m,T,N,"C","ℂ");h(V,T,N,"C","ℂ");h(m,T,N,"H","ℍ");h(V,T,N,"H","ℍ");h(m,T,N,"N","ℕ");h(V,T,N,"N","ℕ");h(m,T,N,"P","ℙ");h(V,T,N,"P","ℙ");h(m,T,N,"Q","ℚ");h(V,T,N,"Q","ℚ");h(m,T,N,"R","ℝ");h(V,T,N,"R","ℝ");h(m,T,N,"Z","ℤ");h(V,T,N,"Z","ℤ");h(m,v,Be,"h","ℎ");h(V,v,Be,"h","ℎ");var _e;for(var vn=0;vn<cs.length;vn++){var _t=cs.charAt(vn);_e=String.fromCharCode(55349,56320+vn),h(m,v,Be,_t,_e),h(V,v,N,_t,_e),_e=String.fromCharCode(55349,56372+vn),h(m,v,Be,_t,_e),h(V,v,N,_t,_e),_e=String.fromCharCode(55349,56424+vn),h(m,v,Be,_t,_e),h(V,v,N,_t,_e),_e=String.fromCharCode(55349,56580+vn),h(m,v,Be,_t,_e),h(V,v,N,_t,_e),_e=String.fromCharCode(55349,56684+vn),h(m,v,Be,_t,_e),h(V,v,N,_t,_e),_e=String.fromCharCode(55349,56736+vn),h(m,v,Be,_t,_e),h(V,v,N,_t,_e),_e=String.fromCharCode(55349,56788+vn),h(m,v,Be,_t,_e),h(V,v,N,_t,_e),_e=String.fromCharCode(55349,56840+vn),h(m,v,Be,_t,_e),h(V,v,N,_t,_e),_e=String.fromCharCode(55349,56944+vn),h(m,v,Be,_t,_e),h(V,v,N,_t,_e),vn<26&&(_e=String.fromCharCode(55349,56632+vn),h(m,v,Be,_t,_e),h(V,v,N,_t,_e),_e=String.fromCharCode(55349,56476+vn),h(m,v,Be,_t,_e),h(V,v,N,_t,_e))}_e="𝕜";h(m,v,Be,"k",_e);h(V,v,N,"k",_e);for(var oi=0;oi<10;oi++){var Hr=oi.toString();_e=String.fromCharCode(55349,57294+oi),h(m,v,Be,Hr,_e),h(V,v,N,Hr,_e),_e=String.fromCharCode(55349,57314+oi),h(m,v,Be,Hr,_e),h(V,v,N,Hr,_e),_e=String.fromCharCode(55349,57324+oi),h(m,v,Be,Hr,_e),h(V,v,N,Hr,_e),_e=String.fromCharCode(55349,57334+oi),h(m,v,Be,Hr,_e),h(V,v,N,Hr,_e)}var Ko="ÐÞþ";for(var co=0;co<Ko.length;co++){var Fa=Ko.charAt(co);h(m,v,Be,Fa,Fa),h(V,v,N,Fa,Fa)}var Zo={mathClass:"mathbf",textClass:"textbf",font:"Main-Bold"},Wl={mathClass:"mathnormal",textClass:"textit",font:"Math-Italic"},Gl={mathClass:"boldsymbol",textClass:"boldsymbol",font:"Main-BoldItalic"},xm={mathClass:"mathscr",textClass:"textscr",font:"Script-Regular"},ui={mathClass:"",textClass:"",font:""},Xl={mathClass:"mathfrak",textClass:"textfrak",font:"Fraktur-Regular"},Vl={mathClass:"mathbb",textClass:"textbb",font:"AMS-Regular"},Yl={mathClass:"mathboldfrak",textClass:"textboldfrak",font:"Fraktur-Regular"},Jo={mathClass:"mathsf",textClass:"textsf",font:"SansSerif-Regular"},Qo={mathClass:"mathboldsf",textClass:"textboldsf",font:"SansSerif-Bold"},Kl={mathClass:"mathitsf",textClass:"textitsf",font:"SansSerif-Italic"},e0={mathClass:"mathtt",textClass:"texttt",font:"Typewriter-Regular"},Zl=[Zo,Zo,Wl,Wl,Gl,Gl,xm,ui,ui,ui,Xl,Xl,Vl,Vl,Yl,Yl,Jo,Jo,Qo,Qo,Kl,Kl,ui,ui,e0,e0],wm=[Zo,ui,Jo,Qo,e0],km=e=>{var t=e.charCodeAt(0),n=e.charCodeAt(1),r=(t-55296)*1024+(n-56320)+65536;if(119808<=r&&r<120484){var i=Math.floor((r-119808)/26);return Zl[i]}else if(120782<=r&&r<=120831){var a=Math.floor((r-120782)/10);return wm[a]}else{if(r===120485||r===120486)return Zl[0];if(120486<r&&r<120782)return ui;throw new re("Unsupported character: "+e)}},Ps=function(t,n,r){if(Dt[r][t]){var i=Dt[r][t].replace;i&&(t=i)}return{value:t,metrics:I0(t,n,r)}},yn=function(t,n,r,i,a){var s=Ps(t,n,r),o=s.metrics;t=s.value;var l;if(o){var d=o.italic;(r==="text"||i&&i.font==="mathit")&&(d=0),l=new Bn(t,o.height,o.depth,d,o.skew,o.width,a)}else typeof console<"u"&&console.warn("No character metrics "+("for '"+t+"' in style '"+n+"' and mode '"+r+"'")),l=new Bn(t,0,0,0,0,0,a);if(i){l.maxFontSize=i.sizeMultiplier,i.style.isTight()&&l.classes.push("mtight");var c=i.getColor();c&&(l.style.color=c)}return l},N0=function(t,n,r,i){return i===void 0&&(i=[]),r.font==="boldsymbol"&&Ps(t,"Main-Bold",n).metrics?yn(t,"Main-Bold",n,r,i.concat(["mathbf"])):t==="\\"||Dt[n][t].font==="main"?yn(t,"Main-Regular",n,r,i):yn(t,"AMS-Regular",n,r,i.concat(["amsrm"]))},Sm=function(t,n,r){return r!=="textord"&&Ps(t,"Math-BoldItalic",n).metrics?{fontName:"Math-BoldItalic",fontClass:"boldsymbol"}:{fontName:"Main-Bold",fontClass:"mathbf"}},Ds=function(t,n){var r=t.type==="mathord"?"mathord":"textord",i=t.mode,a=t.text,s=["mord"],{font:o,fontFamily:l,fontWeight:d,fontShape:c}=n,f=i==="math"||i==="text"&&!!o,g=f?o:l,y="",x="";if(a.charCodeAt(0)===55349){var k=km(a);y=k.font,x=k[i+"Class"]}if(y)return yn(a,y,i,n,s.concat(x));if(g){var w,E;if(g==="boldsymbol"){var S=Sm(a,i,r);w=S.fontName,E=[S.fontClass]}else f?(w=t0[o].fontName,E=[o]):(w=_a(l,d,c),E=[l,d,c]);if(Ps(a,w,i).metrics)return yn(a,w,i,n,s.concat(E));if(hd.hasOwnProperty(a)&&w.slice(0,10)==="Typewriter"){for(var R=[],L=0;L<a.length;L++)R.push(yn(a[L],w,i,n,s.concat(E)));return Ir(R)}}if(r==="mathord")return yn(a,"Math-Italic",i,n,s.concat(["mathnormal"]));if(r==="textord"){var P=Dt[i][a]&&Dt[i][a].font;if(P==="ams"){var B=_a("amsrm",d,c);return yn(a,B,i,n,s.concat("amsrm",d,c))}else if(P==="main"||!P){var O=_a("textrm",d,c);return yn(a,O,i,n,s.concat(d,c))}else{var _=_a(P,d,c);return yn(a,_,i,n,s.concat(_,d,c))}}else throw new Error("unexpected type: "+r+" in makeOrd")},Em=(e,t)=>{if(Vr(e.classes)!==Vr(t.classes)||e.skew!==t.skew||e.maxFontSize!==t.maxFontSize||e.italic!==0&&e.hasClass("mathnormal"))return!1;if(e.classes.length===1){var n=e.classes[0];if(n==="mbin"||n==="mord")return!1}for(var r of Object.keys(e.style))if(e.style[r]!==t.style[r])return!1;for(var i of Object.keys(t.style))if(e.style[i]!==t.style[i])return!1;return!0},fd=e=>{for(var t=0;t<e.length-1;t++){var n=e[t],r=e[t+1];n instanceof Bn&&r instanceof Bn&&Em(n,r)&&(n.text+=r.text,n.height=Math.max(n.height,r.height),n.depth=Math.max(n.depth,r.depth),n.italic=r.italic,e.splice(t+1,1),t--)}return e},L0=function(t){for(var n=0,r=0,i=0,a=0;a<t.children.length;a++){var s=t.children[a];s.height>n&&(n=s.height),s.depth>r&&(r=s.depth),s.maxFontSize>i&&(i=s.maxFontSize)}t.height=n,t.depth=r,t.maxFontSize=i},J=function(t,n,r,i){var a=new Yi(t,n,r,i);return L0(a),a},Kr=(e,t,n,r)=>new Yi(e,t,n,r),Hi=function(t,n,r){var i=J([t],[],n);return i.height=Math.max(r||n.fontMetrics().defaultRuleThickness,n.minRuleThickness),i.style.borderBottomWidth=le(i.height),i.maxFontSize=1,i},Tm=function(t,n,r,i){var a=new Ls(t,n,r,i);return L0(a),a},Ir=function(t){var n=new Vi(t);return L0(n),n},qi=function(t,n){return t instanceof Vi?J([],[t],n):t},Mm=function(t){if(t.positionType==="individualShift"){for(var n=t.children,r=[n[0]],i=-n[0].shift-n[0].elem.depth,a=i,s=1;s<n.length;s++){var o=-n[s].shift-a-n[s].elem.depth,l=o-(n[s-1].elem.height+n[s-1].elem.depth);a=a+o,r.push({type:"kern",size:l}),r.push(n[s])}return{children:r,depth:i}}var d;if(t.positionType==="top"){for(var c=t.positionData,f=0;f<t.children.length;f++){var g=t.children[f];c-=g.type==="kern"?g.size:g.elem.height+g.elem.depth}d=c}else if(t.positionType==="bottom")d=-t.positionData;else{var y=t.children[0];if(y.type!=="elem")throw new Error('First child must have type "elem".');if(t.positionType==="shift")d=-y.elem.depth-t.positionData;else if(t.positionType==="firstBaseline")d=-y.elem.depth;else throw new Error("Invalid positionType "+t.positionType+".")}return{children:t.children,depth:d}},vt=function(t,n){for(var{children:r,depth:i}=Mm(t),a=0,s=0;s<r.length;s++){var o=r[s];if(o.type==="elem"){var l=o.elem;a=Math.max(a,l.maxFontSize,l.height)}}a+=2;var d=J(["pstrut"],[]);d.style.height=le(a);for(var c=[],f=i,g=i,y=i,x=0;x<r.length;x++){var k=r[x];if(k.type==="kern")y+=k.size;else{var w=k.elem,E=k.wrapperClasses||[],S=k.wrapperStyle||{},R=J(E,[d,w],void 0,S);R.style.top=le(-a-y-w.depth),k.marginLeft&&(R.style.marginLeft=k.marginLeft),k.marginRight&&(R.style.marginRight=k.marginRight),c.push(R),y+=w.height+w.depth}f=Math.min(f,y),g=Math.max(g,y)}var L=J(["vlist"],c);L.style.height=le(g);var P;if(f<0){var B=J([],[]),O=J(["vlist"],[B]);O.style.height=le(-f);var _=J(["vlist-s"],[new Bn("")]);P=[J(["vlist-r"],[L,_]),J(["vlist-r"],[O])]}else P=[J(["vlist-r"],[L])];var F=J(["vlist-t"],P);return P.length===2&&F.classes.push("vlist-t2"),F.height=g,F.depth=-f,F},md=(e,t)=>{var n=J(["mspace"],[],t),r=Ft(e,t);return n.style.marginRight=le(r),n},_a=(e,t,n)=>{var r,i;switch(e){case"amsrm":r="AMS";break;case"textrm":r="Main";break;case"textsf":r="SansSerif";break;case"texttt":r="Typewriter";break;default:r=e}return t==="textbf"&&n==="textit"?i="BoldItalic":t==="textbf"?i="Bold":n==="textit"?i="Italic":i="Regular",r+"-"+i},t0={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathsfit:{variant:"sans-serif-italic",fontName:"SansSerif-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},pd={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},gd=function(t,n){var[r,i,a]=pd[t],s=new Yr(r),o=new Tr([s],{width:le(i),height:le(a),style:"width:"+le(i),viewBox:"0 0 "+1e3*i+" "+1e3*a,preserveAspectRatio:"xMinYMin"}),l=Kr(["overlay"],[o],n);return l.height=a,l.style.height=le(a),l.style.width=le(i),l},zt={number:3,unit:"mu"},li={number:4,unit:"mu"},yr={number:5,unit:"mu"},Cm={mord:{mop:zt,mbin:li,mrel:yr,minner:zt},mop:{mord:zt,mop:zt,mrel:yr,minner:zt},mbin:{mord:li,mop:li,mopen:li,minner:li},mrel:{mord:yr,mop:yr,mopen:yr,minner:yr},mopen:{},mclose:{mop:zt,mbin:li,mrel:yr,minner:zt},mpunct:{mord:zt,mop:zt,mrel:yr,mopen:zt,mclose:zt,mpunct:zt,minner:zt},minner:{mord:zt,mop:zt,mbin:li,mrel:yr,mopen:zt,mpunct:zt,minner:zt}},Am={mord:{mop:zt},mop:{mord:zt,mop:zt},mbin:{},mrel:{},mopen:{},mclose:{mop:zt},mpunct:{},minner:{mop:zt}},vd={},ga={},va={};function ve(e){for(var{type:t,names:n,htmlBuilder:r,mathmlBuilder:i}=e,a=0;a<n.length;++a)vd[n[a]]=e;t&&(r&&(ga[t]=r),i&&(va[t]=i))}function bi(e){var{type:t,htmlBuilder:n,mathmlBuilder:r}=e;n&&(ga[t]=n),r&&(va[t]=r)}var us=function(t){return t.type==="ordgroup"&&t.body.length===1?t.body[0]:t},Gt=function(t){return t.type==="ordgroup"?t.body:[t]},Rm=new Set(["leftmost","mbin","mopen","mrel","mop","mpunct"]),Im=new Set(["rightmost","mrel","mclose","mpunct"]),Nm={display:Ue.DISPLAY,text:Ue.TEXT,script:Ue.SCRIPT,scriptscript:Ue.SCRIPTSCRIPT},Lm={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},nn=function(t,n,r,i){i===void 0&&(i=[null,null]);for(var a=[],s=0;s<t.length;s++){var o=yt(t[s],n);if(o instanceof Vi){var l=o.children;a.push(...l)}else a.push(o)}if(fd(a),!r)return a;var d=n;if(t.length===1){var c=t[0];c.type==="sizing"?d=n.havingSize(c.size):c.type==="styling"&&(d=n.havingStyle(Nm[c.style]))}var f=J([i[0]||"leftmost"],[],n),g=J([i[1]||"rightmost"],[],n),y=r==="root";return n0(a,(x,k)=>{var w=k.classes[0],E=x.classes[0];w==="mbin"&&Im.has(E)?k.classes[0]="mord":E==="mbin"&&Rm.has(w)&&(x.classes[0]="mord")},{node:f},g,y),n0(a,(x,k)=>{var w,E,S=i0(k),R=i0(x),L=S&&R?x.hasClass("mtight")?(w=Am[S])==null?void 0:w[R]:(E=Cm[S])==null?void 0:E[R]:null;if(L)return md(L,d)},{node:f},g,y),a},n0=function(t,n,r,i,a){i&&t.push(i);for(var s=0;s<t.length;s++){var o=t[s],l=yd(o);if(l){n0(l.children,n,r,null,a);continue}var d=!o.hasClass("mspace");if(d){var c=n(o,r.node);c&&(r.insertAfter?r.insertAfter(c):(t.unshift(c),s++))}d?r.node=o:a&&o.hasClass("newline")&&(r.node=J(["leftmost"])),r.insertAfter=(f=>g=>{t.splice(f+1,0,g),s++})(s)}i&&t.pop()},yd=function(t){return t instanceof Vi||t instanceof Ls||t instanceof Yi&&t.hasClass("enclosing")?t:null},r0=function(t,n){var r=yd(t);if(r){var i=r.children;if(i.length){if(n==="right")return r0(i[i.length-1],"right");if(n==="left")return r0(i[0],"left")}}return t},i0=function(t,n){if(!t)return null;n&&(t=r0(t,n));var r=t.classes[0];return Lm[r]||null},ya=function(t,n){var r=["nulldelimiter"].concat(t.baseSizingClasses());return J(n.concat(r))},yt=function(t,n,r){if(!t)return J();if(ga[t.type]){var i=ga[t.type](t,n);if(r&&n.size!==r.size){i=J(n.sizingClasses(r),[i],n);var a=n.sizeMultiplier/r.sizeMultiplier;i.height*=a,i.depth*=a}return i}else throw new re("Got group of unknown type: '"+t.type+"'")};function $a(e,t){var n=J(["base"],e,t),r=J(["strut"]);return r.style.height=le(n.height+n.depth),n.depth&&(r.style.verticalAlign=le(-n.depth)),n.children.unshift(r),n}function a0(e,t){var n=null;e.length===1&&e[0].type==="tag"&&(n=e[0].tag,e=e[0].body);var r=nn(e,t,"root"),i;r.length===2&&r[1].hasClass("tag")&&(i=r.pop());for(var a=[],s=[],o=0;o<r.length;o++)if(s.push(r[o]),r[o].hasClass("mbin")||r[o].hasClass("mrel")||r[o].hasClass("allowbreak")){for(var l=!1;o<r.length-1&&r[o+1].hasClass("mspace")&&!r[o+1].hasClass("newline");)o++,s.push(r[o]),r[o].hasClass("nobreak")&&(l=!0);l||(a.push($a(s,t)),s=[])}else r[o].hasClass("newline")&&(s.pop(),s.length>0&&(a.push($a(s,t)),s=[]),a.push(r[o]));s.length>0&&a.push($a(s,t));var d;n?(d=$a(nn(n,t,!0),t),d.classes=["tag"],a.push(d)):i&&a.push(i);var c=J(["katex-html"],a);if(c.setAttribute("aria-hidden","true"),d){var f=d.children[0];f.style.height=le(c.height+c.depth),c.depth&&(f.style.verticalAlign=le(-c.depth))}return c}function bd(e){return new Vi(e)}class ie{constructor(t,n,r){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=t,this.attributes={},this.children=n||[],this.classes=r||[]}setAttribute(t,n){this.attributes[t]=n}getAttribute(t){return this.attributes[t]}toNode(){var t=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&t.setAttribute(n,this.attributes[n]);this.classes.length>0&&(t.className=Vr(this.classes));for(var r=0;r<this.children.length;r++)if(this.children[r]instanceof Xt&&this.children[r+1]instanceof Xt){for(var i=this.children[r].toText()+this.children[++r].toText();this.children[r+1]instanceof Xt;)i+=this.children[++r].toText();t.appendChild(new Xt(i).toNode())}else t.appendChild(this.children[r].toNode());return t}toMarkup(){var t="<"+this.type;for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&(t+=" "+n+'="',t+=fn(this.attributes[n]),t+='"');this.classes.length>0&&(t+=' class ="'+fn(Vr(this.classes))+'"'),t+=">";for(var r=0;r<this.children.length;r++)t+=this.children[r].toMarkup();return t+="</"+this.type+">",t}toText(){return this.children.map(t=>t.toText()).join("")}}class Xt{constructor(t){this.text=void 0,this.text=t}toNode(){return document.createTextNode(this.text)}toMarkup(){return fn(this.toText())}toText(){return this.text}}class xd{constructor(t){this.width=void 0,this.character=void 0,this.width=t,t>=.05555&&t<=.05556?this.character=" ":t>=.1666&&t<=.1667?this.character=" ":t>=.2222&&t<=.2223?this.character=" ":t>=.2777&&t<=.2778?this.character=" ":t>=-.05556&&t<=-.05555?this.character=" ":t>=-.1667&&t<=-.1666?this.character=" ":t>=-.2223&&t<=-.2222?this.character=" ":t>=-.2778&&t<=-.2777?this.character=" ":this.character=null}toNode(){if(this.character)return document.createTextNode(this.character);var t=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return t.setAttribute("width",le(this.width)),t}toMarkup(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+le(this.width)+'"/>'}toText(){return this.character?this.character:" "}}var Pm=new Set(["\\imath","\\jmath"]),Dm=new Set(["mrow","mtable"]),$n=function(t,n,r){return Dt[n][t]&&Dt[n][t].replace&&t.charCodeAt(0)!==55349&&!(hd.hasOwnProperty(t)&&r&&(r.fontFamily&&r.fontFamily.slice(4,6)==="tt"||r.font&&r.font.slice(4,6)==="tt"))&&(t=Dt[n][t].replace),new Xt(t)},P0=function(t){return t.length===1?t[0]:new ie("mrow",t)},Bm={mathit:"italic",boldsymbol:e=>e.type==="textord"?"bold":"bold-italic",mathbf:"bold",mathbb:"double-struck",mathsfit:"sans-serif-italic",mathfrak:"fraktur",mathscr:"script",mathcal:"script",mathsf:"sans-serif",mathtt:"monospace"},D0=(e,t)=>{if(e.mode==="text"){if(t.fontFamily==="texttt")return"monospace";if(t.fontFamily==="textsf")return t.fontShape==="textit"&&t.fontWeight==="textbf"?"sans-serif-bold-italic":t.fontShape==="textit"?"sans-serif-italic":t.fontWeight==="textbf"?"bold-sans-serif":"sans-serif";if(t.fontShape==="textit"&&t.fontWeight==="textbf")return"bold-italic";if(t.fontShape==="textit")return"italic";if(t.fontWeight==="textbf")return"bold"}var n=t.font;if(!n||n==="mathnormal")return null;var r=e.mode,i=Bm[n];if(i)return typeof i=="function"?i(e):i;var a=e.text;if(Pm.has(a))return null;if(Dt[r][a]){var s=Dt[r][a].replace;s&&(a=s)}var o=t0[n].fontName;return I0(a,o,r)?t0[n].variant:null};function uo(e){if(!e)return!1;if(e.type==="mi"&&e.children.length===1){var t=e.children[0];return t instanceof Xt&&t.text==="."}else if(e.type==="mo"&&e.children.length===1&&e.getAttribute("separator")==="true"&&e.getAttribute("lspace")==="0em"&&e.getAttribute("rspace")==="0em"){var n=e.children[0];return n instanceof Xt&&n.text===","}else return!1}var zn=function(t,n,r){if(t.length===1){var i=Mt(t[0],n);return r&&i instanceof ie&&i.type==="mo"&&(i.setAttribute("lspace","0em"),i.setAttribute("rspace","0em")),[i]}for(var a=[],s,o=0;o<t.length;o++){var l=Mt(t[o],n);if(l instanceof ie&&s instanceof ie){if(l.type==="mtext"&&s.type==="mtext"&&l.getAttribute("mathvariant")===s.getAttribute("mathvariant")){s.children.push(...l.children);continue}else if(l.type==="mn"&&s.type==="mn"){s.children.push(...l.children);continue}else if(uo(l)&&s.type==="mn"){s.children.push(...l.children);continue}else if(l.type==="mn"&&uo(s))l.children=[...s.children,...l.children],a.pop();else if((l.type==="msup"||l.type==="msub")&&l.children.length>=1&&(s.type==="mn"||uo(s))){var d=l.children[0];d instanceof ie&&d.type==="mn"&&(d.children=[...s.children,...d.children],a.pop())}else if(s.type==="mi"&&s.children.length===1){var c=s.children[0];if(c instanceof Xt&&c.text==="̸"&&(l.type==="mo"||l.type==="mi"||l.type==="mn")){var f=l.children[0];f instanceof Xt&&f.text.length>0&&(f.text=f.text.slice(0,1)+"̸"+f.text.slice(1),a.pop())}}}a.push(l),s=l}return a},Zr=function(t,n,r){return P0(zn(t,n,r))},Mt=function(t,n){if(!t)return new ie("mrow");if(va[t.type])return va[t.type](t,n);throw new re("Got group of unknown type: '"+t.type+"'")};function Jl(e,t,n,r,i){var a=zn(e,n),s;a.length===1&&a[0]instanceof ie&&Dm.has(a[0].type)?s=a[0]:s=new ie("mrow",a);var o=new ie("annotation",[new Xt(t)]);o.setAttribute("encoding","application/x-tex");var l=new ie("semantics",[s,o]),d=new ie("math",[l]);d.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),r&&d.setAttribute("display","block");var c=i?"katex":"katex-mathml";return J([c],[d])}var Om=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],Ql=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],ec=function(t,n){return n.size<2?t:Om[t-1][n.size-1]};class kr{constructor(t){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=t.style,this.color=t.color,this.size=t.size||kr.BASESIZE,this.textSize=t.textSize||this.size,this.phantom=!!t.phantom,this.font=t.font||"",this.fontFamily=t.fontFamily||"",this.fontWeight=t.fontWeight||"",this.fontShape=t.fontShape||"",this.sizeMultiplier=Ql[this.size-1],this.maxSize=t.maxSize,this.minRuleThickness=t.minRuleThickness,this._fontMetrics=void 0}extend(t){var n={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};return Object.assign(n,t),new kr(n)}havingStyle(t){return this.style===t?this:this.extend({style:t,size:ec(this.textSize,t)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(t){return this.size===t&&this.textSize===t?this:this.extend({style:this.style.text(),size:t,textSize:t,sizeMultiplier:Ql[t-1]})}havingBaseStyle(t){t=t||this.style.text();var n=ec(kr.BASESIZE,t);return this.size===n&&this.textSize===kr.BASESIZE&&this.style===t?this:this.extend({style:t,size:n})}havingBaseSizing(){var t;switch(this.style.id){case 4:case 5:t=3;break;case 6:case 7:t=1;break;default:t=6}return this.extend({style:this.style.text(),size:t})}withColor(t){return this.extend({color:t})}withPhantom(){return this.extend({phantom:!0})}withFont(t){return this.extend({font:t})}withTextFontFamily(t){return this.extend({fontFamily:t,font:""})}withTextFontWeight(t){return this.extend({fontWeight:t,font:""})}withTextFontShape(t){return this.extend({fontShape:t,font:""})}sizingClasses(t){return t.size!==this.size?["sizing","reset-size"+t.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==kr.BASESIZE?["sizing","reset-size"+this.size,"size"+kr.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=bm(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}kr.BASESIZE=6;var wd=function(t){return new kr({style:t.displayMode?Ue.DISPLAY:Ue.TEXT,maxSize:t.maxSize,minRuleThickness:t.minRuleThickness})},kd=function(t,n){if(n.displayMode){var r=["katex-display"];n.leqno&&r.push("leqno"),n.fleqn&&r.push("fleqn"),t=J(r,[t])}return t},zm=function(t,n,r){var i=wd(r),a;if(r.output==="mathml")return Jl(t,n,i,r.displayMode,!0);if(r.output==="html"){var s=a0(t,i);a=J(["katex"],[s])}else{var o=Jl(t,n,i,r.displayMode,!1),l=a0(t,i);a=J(["katex"],[o,l])}return kd(a,r)},jm=function(t,n,r){var i=wd(r),a=a0(t,i),s=J(["katex"],[a]);return kd(s,r)},Fm={widehat:"^",widecheck:"ˇ",widetilde:"~",utilde:"~",overleftarrow:"←",underleftarrow:"←",xleftarrow:"←",overrightarrow:"→",underrightarrow:"→",xrightarrow:"→",underbrace:"⏟",overbrace:"⏞",underbracket:"⎵",overbracket:"⎴",overgroup:"⏠",undergroup:"⏡",overleftrightarrow:"↔",underleftrightarrow:"↔",xleftrightarrow:"↔",Overrightarrow:"⇒",xRightarrow:"⇒",overleftharpoon:"↼",xleftharpoonup:"↼",overrightharpoon:"⇀",xrightharpoonup:"⇀",xLeftarrow:"⇐",xLeftrightarrow:"⇔",xhookleftarrow:"↩",xhookrightarrow:"↪",xmapsto:"↦",xrightharpoondown:"⇁",xleftharpoondown:"↽",xrightleftharpoons:"⇌",xleftrightharpoons:"⇋",xtwoheadleftarrow:"↞",xtwoheadrightarrow:"↠",xlongequal:"=",xtofrom:"⇄",xrightleftarrows:"⇄",xrightequilibrium:"⇌",xleftequilibrium:"⇋","\\cdrightarrow":"→","\\cdleftarrow":"←","\\cdlongequal":"="},Bs=function(t){var n=new ie("mo",[new Xt(Fm[t.replace(/^\\/,"")])]);return n.setAttribute("stretchy","true"),n},_m={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],"\\cdlongequal":[["longequal"],3,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overbracket:[["leftbracketover","rightbracketover"],1.6,440],underbracket:[["leftbracketunder","rightbracketunder"],1.6,410],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},$m=new Set(["widehat","widecheck","widetilde","utilde"]),Os=function(t,n){function r(){var o=4e5,l=t.label.slice(1);if($m.has(l)&&"base"in t){var d=t.base.type==="ordgroup"?t.base.body.length:1,c,f,g;if(d>5)l==="widehat"||l==="widecheck"?(c=420,o=2364,g=.42,f=l+"4"):(c=312,o=2340,g=.34,f="tilde4");else{var y=[1,1,2,2,3,3][d];l==="widehat"||l==="widecheck"?(o=[0,1062,2364,2364,2364][y],c=[0,239,300,360,420][y],g=[0,.24,.3,.3,.36,.42][y],f=l+y):(o=[0,600,1033,2339,2340][y],c=[0,260,286,306,312][y],g=[0,.26,.286,.3,.306,.34][y],f="tilde"+y)}var x=new Yr(f),k=new Tr([x],{width:"100%",height:le(g),viewBox:"0 0 "+o+" "+c,preserveAspectRatio:"none"});return{span:Kr([],[k],n),minWidth:0,height:g}}else{var w=[],E=_m[l];if(!E)throw new Error('No SVG data for "'+l+'".');var[S,R,L]=E,P=L/1e3,B=S.length,O,_;if(B===1){if(E.length!==4)throw new Error('Expected 4-tuple for single-path SVG data "'+l+'".');O=["hide-tail"],_=[E[3]]}else if(B===2)O=["halfarrow-left","halfarrow-right"],_=["xMinYMin","xMaxYMin"];else if(B===3)O=["brace-left","brace-center","brace-right"],_=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support
|
|
257
|
+
`+B+" children.");for(var F=0;F<B;F++){var $=new Yr(S[F]),j=new Tr([$],{width:"400em",height:le(P),viewBox:"0 0 "+o+" "+L,preserveAspectRatio:_[F]+" slice"}),D=Kr([O[F]],[j],n);if(B===1)return{span:D,minWidth:R,height:P};D.style.height=le(P),w.push(D)}return{span:J(["stretchy"],w,n),minWidth:R,height:P}}}var{span:i,minWidth:a,height:s}=r();return i.height=s,i.style.height=le(s),a>0&&(i.style.minWidth=le(a)),i},Hm=function(t,n,r,i,a){var s,o=t.height+t.depth+r+i;if(/fbox|color|angl/.test(n)){if(s=J(["stretchy",n],[],a),n==="fbox"){var l=a.color&&a.getColor();l&&(s.style.borderColor=l)}}else{var d=[];/^[bx]cancel$/.test(n)&&d.push(new Yo({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(n)&&d.push(new Yo({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var c=new Tr(d,{width:"100%",height:le(o)});s=Kr([],[c],a)}return s.height=o,s.style.height=le(o),s},qm={bin:1,close:1,inner:1,open:1,punct:1,rel:1},Um={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1};function Wm(e){return e in qm}function Je(e,t){if(!e||e.type!==t)throw new Error("Expected node of type "+t+", but got "+(e?"node of type "+e.type:String(e)));return e}function zs(e){var t=js(e);if(!t)throw new Error("Expected node of symbol group type, but got "+(e?"node of type "+e.type:String(e)));return t}function js(e){return e&&(e.type==="atom"||Um.hasOwnProperty(e.type))?e:null}var Sd=e=>{if(e instanceof Bn)return e;if(vm(e)&&e.children.length===1)return Sd(e.children[0])},Ed=(e,t)=>{var n,r,i;e&&e.type==="supsub"?(r=Je(e.base,"accent"),n=r.base,e.base=n,i=gm(yt(e,t)),e.base=r):(r=Je(e,"accent"),n=r.base);var a=yt(n,t.havingCrampedStyle()),s=r.isShifty&&Ar(n),o=0;if(s){var l,d;o=(l=(d=Sd(a))==null?void 0:d.skew)!=null?l:0}var c=r.label==="\\c",f=c?a.height+a.depth:Math.min(a.height,t.fontMetrics().xHeight),g;if(r.isStretchy)g=Os(r,t),g=vt({positionType:"firstBaseline",children:[{type:"elem",elem:a},{type:"elem",elem:g,wrapperClasses:["svg-align"],wrapperStyle:o>0?{width:"calc(100% - "+le(2*o)+")",marginLeft:le(2*o)}:void 0}]});else{var y,x;r.label==="\\vec"?(y=gd("vec",t),x=pd.vec[1]):(y=Ds({type:"textord",mode:r.mode,text:r.label},t),y=pm(y),y.italic=0,x=y.width,c&&(f+=y.depth)),g=J(["accent-body"],[y]);var k=r.label==="\\textcircled";k&&(g.classes.push("accent-full"),f=a.height);var w=o;k||(w-=x/2),g.style.left=le(w),r.label==="\\textcircled"&&(g.style.top=".2em"),g=vt({positionType:"firstBaseline",children:[{type:"elem",elem:a},{type:"kern",size:-f},{type:"elem",elem:g}]})}var E=J(["mord","accent"],[g],t);return i?(i.children[0]=E,i.height=Math.max(E.height,i.height),i.classes[0]="mord",i):E},Gm=(e,t)=>{var n=e.isStretchy?Bs(e.label):new ie("mo",[$n(e.label,e.mode)]),r=new ie("mover",[Mt(e.base,t),n]);return r.setAttribute("accent","true"),r},Xm=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(e=>"\\"+e).join("|"));ve({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],numArgs:1,handler:(e,t)=>{var n=us(t[0]),r=!Xm.test(e.funcName),i=!r||e.funcName==="\\widehat"||e.funcName==="\\widetilde"||e.funcName==="\\widecheck";return{type:"accent",mode:e.parser.mode,label:e.funcName,isStretchy:r,isShifty:i,base:n}},htmlBuilder:Ed,mathmlBuilder:Gm});ve({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"],handler:(e,t)=>{var n=t[0],r=e.parser.mode;return r==="math"&&(e.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+e.funcName+" works only in text mode"),r="text"),{type:"accent",mode:r,label:e.funcName,isStretchy:!1,isShifty:!0,base:n}}});ve({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],numArgs:1,handler:(e,t)=>{var{parser:n,funcName:r}=e,i=t[0];return{type:"accentUnder",mode:n.mode,label:r,base:i}},htmlBuilder:(e,t)=>{var n=yt(e.base,t),r=Os(e,t),i=e.label==="\\utilde"?.12:0,a=vt({positionType:"top",positionData:n.height,children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:i},{type:"elem",elem:n}]});return J(["mord","accentunder"],[a],t)},mathmlBuilder:(e,t)=>{var n=Bs(e.label),r=new ie("munder",[Mt(e.base,t),n]);return r.setAttribute("accentunder","true"),r}});var Ha=e=>{var t=new ie("mpadded",e?[e]:[]);return t.setAttribute("width","+0.6em"),t.setAttribute("lspace","0.3em"),t};ve({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],numArgs:1,numOptionalArgs:1,handler(e,t,n){var{parser:r,funcName:i}=e;return{type:"xArrow",mode:r.mode,label:i,body:t[0],below:n[0]}},htmlBuilder(e,t){var n=t.style,r=t.havingStyle(n.sup()),i=qi(yt(e.body,r,t),t),a=e.label.slice(0,2)==="\\x"?"x":"cd";i.classes.push(a+"-arrow-pad");var s;e.below&&(r=t.havingStyle(n.sub()),s=qi(yt(e.below,r,t),t),s.classes.push(a+"-arrow-pad"));var o=Os(e,t),l=-t.fontMetrics().axisHeight+.5*o.height,d=-t.fontMetrics().axisHeight-.5*o.height-.111;(i.depth>.25||e.label==="\\xleftequilibrium")&&(d-=i.depth);var c;if(s){var f=-t.fontMetrics().axisHeight+s.height+.5*o.height+.111;c=vt({positionType:"individualShift",children:[{type:"elem",elem:i,shift:d},{type:"elem",elem:o,shift:l,wrapperClasses:["svg-align"]},{type:"elem",elem:s,shift:f}]})}else c=vt({positionType:"individualShift",children:[{type:"elem",elem:i,shift:d},{type:"elem",elem:o,shift:l,wrapperClasses:["svg-align"]}]});return J(["mrel","x-arrow"],[c],t)},mathmlBuilder(e,t){var n=Bs(e.label);n.setAttribute("minsize",e.label.charAt(0)==="x"?"1.75em":"3.0em");var r;if(e.body){var i=Ha(Mt(e.body,t));if(e.below){var a=Ha(Mt(e.below,t));r=new ie("munderover",[n,a,i])}else r=new ie("mover",[n,i])}else if(e.below){var s=Ha(Mt(e.below,t));r=new ie("munder",[n,s])}else r=Ha(),r=new ie("mover",[n,r]);return r}});function Vm(e,t){var n=nn(e.body,t,!0);return J([e.mclass],n,t)}function Ym(e,t){var n,r=zn(e.body,t);return e.mclass==="minner"?n=new ie("mpadded",r):e.mclass==="mord"?e.isCharacterBox?(n=r[0],n.type="mi"):n=new ie("mi",r):(e.isCharacterBox?(n=r[0],n.type="mo"):n=new ie("mo",r),e.mclass==="mbin"?(n.attributes.lspace="0.22em",n.attributes.rspace="0.22em"):e.mclass==="mpunct"?(n.attributes.lspace="0em",n.attributes.rspace="0.17em"):(e.mclass==="mopen"||e.mclass==="mclose")&&(n.attributes.lspace="0em",n.attributes.rspace="0em")),n}ve({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],numArgs:1,primitive:!0,handler(e,t){var{parser:n,funcName:r}=e,i=t[0];return{type:"mclass",mode:n.mode,mclass:"m"+r.slice(5),body:Gt(i),isCharacterBox:Ar(i)}},htmlBuilder:Vm,mathmlBuilder:Ym});var Fs=e=>{var t=e.type==="ordgroup"&&e.body.length?e.body[0]:e;return t.type==="atom"&&(t.family==="bin"||t.family==="rel")?"m"+t.family:"mord"};ve({type:"mclass",names:["\\@binrel"],numArgs:2,handler(e,t){var{parser:n}=e;return{type:"mclass",mode:n.mode,mclass:Fs(t[0]),body:Gt(t[1]),isCharacterBox:Ar(t[1])}}});ve({type:"mclass",names:["\\stackrel","\\overset","\\underset"],numArgs:2,handler(e,t){var{parser:n,funcName:r}=e,i=t[1],a=t[0],s;r!=="\\stackrel"?s=Fs(i):s="mrel";var o={type:"op",mode:i.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:r!=="\\stackrel",body:Gt(i)},l=r==="\\underset"?{type:"supsub",mode:a.mode,base:o,sub:a}:{type:"supsub",mode:a.mode,base:o,sup:a};return{type:"mclass",mode:n.mode,mclass:s,body:[l],isCharacterBox:Ar(l)}}});ve({type:"pmb",names:["\\pmb"],numArgs:1,allowedInText:!0,handler(e,t){var{parser:n}=e;return{type:"pmb",mode:n.mode,mclass:Fs(t[0]),body:Gt(t[0])}},htmlBuilder(e,t){var n=nn(e.body,t,!0),r=J([e.mclass],n,t);return r.style.textShadow="0.02em 0.01em 0.04px",r},mathmlBuilder(e,t){var n=zn(e.body,t),r=new ie("mstyle",n);return r.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),r}});var Km={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},tc=()=>({type:"styling",body:[],mode:"math",style:"display",resetFont:!0}),nc=e=>e.type==="textord"&&e.text==="@",Zm=(e,t)=>(e.type==="mathord"||e.type==="atom")&&e.text===t;function Jm(e,t,n){var r=Km[e];switch(r){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return n.callFunction(r,[t[0]],[t[1]]);case"\\uparrow":case"\\downarrow":{var i=n.callFunction("\\\\cdleft",[t[0]],[]),a={type:"atom",text:r,mode:"math",family:"rel"},s=n.callFunction("\\Big",[a],[]),o=n.callFunction("\\\\cdright",[t[1]],[]),l={type:"ordgroup",mode:"math",body:[i,s,o]};return n.callFunction("\\\\cdparent",[l],[])}case"\\\\cdlongequal":return n.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var d={type:"textord",text:"\\Vert",mode:"math"};return n.callFunction("\\Big",[d],[])}default:return{type:"textord",text:" ",mode:"math"}}}function Qm(e){var t=[];for(e.gullet.beginGroup(),e.gullet.macros.set("\\cr","\\\\\\relax"),e.gullet.beginGroup();;){t.push(e.parseExpression(!1,"\\\\")),e.gullet.endGroup(),e.gullet.beginGroup();var n=e.fetch().text;if(n==="&"||n==="\\\\")e.consume();else if(n==="\\end"){t[t.length-1].length===0&&t.pop();break}else throw new re("Expected \\\\ or \\cr or \\end",e.nextToken)}for(var r=[],i=[r],a=0;a<t.length;a++){for(var s=t[a],o=tc(),l=0;l<s.length;l++)if(!nc(s[l]))o.body.push(s[l]);else{r.push(o),l+=1;var d=zs(s[l]).text,c=new Array(2);if(c[0]={type:"ordgroup",mode:"math",body:[]},c[1]={type:"ordgroup",mode:"math",body:[]},!"=|.".includes(d))if("<>AV".includes(d))for(var f=0;f<2;f++){for(var g=!0,y=l+1;y<s.length;y++){if(Zm(s[y],d)){g=!1,l=y;break}if(nc(s[y]))throw new re("Missing a "+d+" character to complete a CD arrow.",s[y]);c[f].body.push(s[y])}if(g)throw new re("Missing a "+d+" character to complete a CD arrow.",s[l])}else throw new re('Expected one of "<>AV=|." after @',s[l]);var x=Jm(d,c,e),k={type:"styling",body:[x],mode:"math",style:"display",resetFont:!0};r.push(k),o=tc()}a%2===0?r.push(o):r.shift(),r=[],i.push(r)}e.gullet.endGroup(),e.gullet.endGroup();var w=new Array(i[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25});return{type:"array",mode:"math",body:i,arraystretch:1,addJot:!0,rowGaps:[null],cols:w,colSeparationType:"CD",hLinesBeforeRow:new Array(i.length+1).fill([])}}ve({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],numArgs:1,handler(e,t){var{parser:n,funcName:r}=e;return{type:"cdlabel",mode:n.mode,side:r.slice(4),label:t[0]}},htmlBuilder(e,t){var n=t.havingStyle(t.style.sup()),r=qi(yt(e.label,n,t),t);return r.classes.push("cd-label-"+e.side),r.style.bottom=le(.8-r.depth),r.height=0,r.depth=0,r},mathmlBuilder(e,t){var n=new ie("mrow",[Mt(e.label,t)]);return n=new ie("mpadded",[n]),n.setAttribute("width","0"),e.side==="left"&&n.setAttribute("lspace","-1width"),n.setAttribute("voffset","0.7em"),n=new ie("mstyle",[n]),n.setAttribute("displaystyle","false"),n.setAttribute("scriptlevel","1"),n}});ve({type:"cdlabelparent",names:["\\\\cdparent"],numArgs:1,handler(e,t){var{parser:n}=e;return{type:"cdlabelparent",mode:n.mode,fragment:t[0]}},htmlBuilder(e,t){var n=qi(yt(e.fragment,t),t);return n.classes.push("cd-vert-arrow"),n},mathmlBuilder(e,t){return new ie("mrow",[Mt(e.fragment,t)])}});ve({type:"textord",names:["\\@char"],numArgs:1,allowedInText:!0,handler(e,t){for(var{parser:n}=e,r=Je(t[0],"ordgroup"),i=r.body,a="",s=0;s<i.length;s++){var o=Je(i[s],"textord");a+=o.text}var l=parseInt(a),d;if(isNaN(l))throw new re("\\@char has non-numeric argument "+a);if(l<0||l>=1114111)throw new re("\\@char with invalid code point "+a);return l<=65535?d=String.fromCharCode(l):(l-=65536,d=String.fromCharCode((l>>10)+55296,(l&1023)+56320)),{type:"textord",mode:n.mode,text:d}}});var ep=(e,t)=>{var n=nn(e.body,t.withColor(e.color),!1);return Ir(n)},tp=(e,t)=>{var n=zn(e.body,t.withColor(e.color)),r=new ie("mstyle",n);return r.setAttribute("mathcolor",e.color),r};ve({type:"color",names:["\\textcolor"],numArgs:2,allowedInText:!0,argTypes:["color","original"],handler(e,t){var{parser:n}=e,r=Je(t[0],"color-token").color,i=t[1];return{type:"color",mode:n.mode,color:r,body:Gt(i)}},htmlBuilder:ep,mathmlBuilder:tp});ve({type:"color",names:["\\color"],numArgs:1,allowedInText:!0,argTypes:["color"],handler(e,t){var{parser:n,breakOnTokenText:r}=e,i=Je(t[0],"color-token").color;n.gullet.macros.set("\\current@color",i);var a=n.parseExpression(!0,r);return{type:"color",mode:n.mode,color:i,body:a}}});ve({type:"cr",names:["\\\\"],numArgs:0,numOptionalArgs:0,allowedInText:!0,handler(e,t,n){var{parser:r}=e,i=r.gullet.future().text==="["?r.parseSizeGroup(!0):null,a=!r.settings.displayMode||!r.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:r.mode,newLine:a,size:i&&Je(i,"size").value}},htmlBuilder(e,t){var n=J(["mspace"],[],t);return e.newLine&&(n.classes.push("newline"),e.size&&(n.style.marginTop=le(Ft(e.size,t)))),n},mathmlBuilder(e,t){var n=new ie("mspace");return e.newLine&&(n.setAttribute("linebreak","newline"),e.size&&n.setAttribute("height",le(Ft(e.size,t)))),n}});var s0={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},Td=e=>{var t=e.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(t))throw new re("Expected a control sequence",e);return t},np=e=>{var t=e.gullet.popToken();return t.text==="="&&(t=e.gullet.popToken(),t.text===" "&&(t=e.gullet.popToken())),t},Md=(e,t,n,r)=>{var i=e.gullet.macros.get(n.text);i==null&&(n.noexpand=!0,i={tokens:[n],numArgs:0,unexpandable:!e.gullet.isExpandable(n.text)}),e.gullet.macros.set(t,i,r)};ve({type:"internal",names:["\\global","\\long","\\\\globallong"],numArgs:0,allowedInText:!0,handler(e){var{parser:t,funcName:n}=e;t.consumeSpaces();var r=t.fetch();if(s0[r.text])return(n==="\\global"||n==="\\\\globallong")&&(r.text=s0[r.text]),Je(t.parseFunction(),"internal");throw new re("Invalid token after macro prefix",r)}});ve({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],numArgs:0,allowedInText:!0,primitive:!0,handler(e){var{parser:t,funcName:n}=e,r=t.gullet.popToken(),i=r.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(i))throw new re("Expected a control sequence",r);for(var a=0,s,o=[[]];t.gullet.future().text!=="{";)if(r=t.gullet.popToken(),r.text==="#"){if(t.gullet.future().text==="{"){s=t.gullet.future(),o[a].push("{");break}if(r=t.gullet.popToken(),!/^[1-9]$/.test(r.text))throw new re('Invalid argument number "'+r.text+'"');if(parseInt(r.text)!==a+1)throw new re('Argument number "'+r.text+'" out of order');a++,o.push([])}else{if(r.text==="EOF")throw new re("Expected a macro definition");o[a].push(r.text)}var{tokens:l}=t.gullet.consumeArg();return s&&l.unshift(s),(n==="\\edef"||n==="\\xdef")&&(l=t.gullet.expandTokens(l),l.reverse()),t.gullet.macros.set(i,{tokens:l,numArgs:a,delimiters:o},n===s0[n]),{type:"internal",mode:t.mode}}});ve({type:"internal",names:["\\let","\\\\globallet"],numArgs:0,allowedInText:!0,primitive:!0,handler(e){var{parser:t,funcName:n}=e,r=Td(t.gullet.popToken());t.gullet.consumeSpaces();var i=np(t);return Md(t,r,i,n==="\\\\globallet"),{type:"internal",mode:t.mode}}});ve({type:"internal",names:["\\futurelet","\\\\globalfuture"],numArgs:0,allowedInText:!0,primitive:!0,handler(e){var{parser:t,funcName:n}=e,r=Td(t.gullet.popToken()),i=t.gullet.popToken(),a=t.gullet.popToken();return Md(t,r,a,n==="\\\\globalfuture"),t.gullet.pushToken(a),t.gullet.pushToken(i),{type:"internal",mode:t.mode}}});var ca=function(t,n,r){var i=Dt.math[t]&&Dt.math[t].replace,a=I0(i||t,n,r);if(!a)throw new Error("Unsupported symbol "+t+" and font size "+n+".");return a},B0=function(t,n,r,i){var a=r.havingBaseStyle(n),s=J(i.concat(a.sizingClasses(r)),[t],r),o=a.sizeMultiplier/r.sizeMultiplier;return s.height*=o,s.depth*=o,s.maxFontSize=a.sizeMultiplier,s},Cd=function(t,n,r){var i=n.havingBaseStyle(r),a=(1-n.sizeMultiplier/i.sizeMultiplier)*n.fontMetrics().axisHeight;t.classes.push("delimcenter"),t.style.top=le(a),t.height-=a,t.depth+=a},rp=function(t,n,r,i,a,s){var o=yn(t,"Main-Regular",a,i),l=B0(o,n,i,s);return Cd(l,i,n),l},ip=function(t,n,r,i){return yn(t,"Size"+n+"-Regular",r,i)},Ad=function(t,n,r,i,a,s){var o=ip(t,n,a,i),l=B0(J(["delimsizing","size"+n],[o],i),Ue.TEXT,i,s);return r&&Cd(l,i,Ue.TEXT),l},ho=function(t,n,r){var i;n==="Size1-Regular"?i="delim-size1":i="delim-size4";var a=J(["delimsizinginner",i],[J([],[yn(t,n,r)])]);return{type:"elem",elem:a}},fo=function(t,n,r){var i=sr["Size4-Regular"][t.charCodeAt(0)]?sr["Size4-Regular"][t.charCodeAt(0)][4]:sr["Size1-Regular"][t.charCodeAt(0)][4],a=new Yr("inner",lm(t,Math.round(1e3*n))),s=new Tr([a],{width:le(i),height:le(n),style:"width:"+le(i),viewBox:"0 0 "+1e3*i+" "+Math.round(1e3*n),preserveAspectRatio:"xMinYMin"}),o=Kr([],[s],r);return o.height=n,o.style.height=le(n),o.style.width=le(i),{type:"elem",elem:o}},o0=.008,qa={type:"kern",size:-1*o0},ap=new Set(["|","\\lvert","\\rvert","\\vert"]),sp=new Set(["\\|","\\lVert","\\rVert","\\Vert"]),Rd=function(t,n,r,i,a,s){var o,l,d,c,f="",g=0;o=d=c=t,l=null;var y="Size1-Regular";t==="\\uparrow"?d=c="⏐":t==="\\Uparrow"?d=c="‖":t==="\\downarrow"?o=d="⏐":t==="\\Downarrow"?o=d="‖":t==="\\updownarrow"?(o="\\uparrow",d="⏐",c="\\downarrow"):t==="\\Updownarrow"?(o="\\Uparrow",d="‖",c="\\Downarrow"):ap.has(t)?(d="∣",f="vert",g=333):sp.has(t)?(d="∥",f="doublevert",g=556):t==="["||t==="\\lbrack"?(o="⎡",d="⎢",c="⎣",y="Size4-Regular",f="lbrack",g=667):t==="]"||t==="\\rbrack"?(o="⎤",d="⎥",c="⎦",y="Size4-Regular",f="rbrack",g=667):t==="\\lfloor"||t==="⌊"?(d=o="⎢",c="⎣",y="Size4-Regular",f="lfloor",g=667):t==="\\lceil"||t==="⌈"?(o="⎡",d=c="⎢",y="Size4-Regular",f="lceil",g=667):t==="\\rfloor"||t==="⌋"?(d=o="⎥",c="⎦",y="Size4-Regular",f="rfloor",g=667):t==="\\rceil"||t==="⌉"?(o="⎤",d=c="⎥",y="Size4-Regular",f="rceil",g=667):t==="("||t==="\\lparen"?(o="⎛",d="⎜",c="⎝",y="Size4-Regular",f="lparen",g=875):t===")"||t==="\\rparen"?(o="⎞",d="⎟",c="⎠",y="Size4-Regular",f="rparen",g=875):t==="\\{"||t==="\\lbrace"?(o="⎧",l="⎨",c="⎩",d="⎪",y="Size4-Regular"):t==="\\}"||t==="\\rbrace"?(o="⎫",l="⎬",c="⎭",d="⎪",y="Size4-Regular"):t==="\\lgroup"||t==="⟮"?(o="⎧",c="⎩",d="⎪",y="Size4-Regular"):t==="\\rgroup"||t==="⟯"?(o="⎫",c="⎭",d="⎪",y="Size4-Regular"):t==="\\lmoustache"||t==="⎰"?(o="⎧",c="⎭",d="⎪",y="Size4-Regular"):(t==="\\rmoustache"||t==="⎱")&&(o="⎫",c="⎩",d="⎪",y="Size4-Regular");var x=ca(o,y,a),k=x.height+x.depth,w=ca(d,y,a),E=w.height+w.depth,S=ca(c,y,a),R=S.height+S.depth,L=0,P=1;if(l!==null){var B=ca(l,y,a);L=B.height+B.depth,P=2}var O=k+R+L,_=Math.max(0,Math.ceil((n-O)/(P*E))),F=O+_*P*E,$=i.fontMetrics().axisHeight;r&&($*=i.sizeMultiplier);var j=F/2-$,D=[];if(f.length>0){var q=F-k-R,K=Math.round(F*1e3),fe=cm(f,Math.round(q*1e3)),de=new Yr(f,fe),Ce=le(g/1e3),oe=le(K/1e3),Ee=new Tr([de],{width:Ce,height:oe,viewBox:"0 0 "+g+" "+K}),ze=Kr([],[Ee],i);ze.height=K/1e3,ze.style.width=Ce,ze.style.height=oe,D.push({type:"elem",elem:ze})}else{if(D.push(ho(c,y,a)),D.push(qa),l===null){var ge=F-k-R+2*o0;D.push(fo(d,ge,i))}else{var We=(F-k-R-L)/2+2*o0;D.push(fo(d,We,i)),D.push(qa),D.push(ho(l,y,a)),D.push(qa),D.push(fo(d,We,i))}D.push(qa),D.push(ho(o,y,a))}var Pe=i.havingBaseStyle(Ue.TEXT),st=vt({positionType:"bottom",positionData:j,children:D});return B0(J(["delimsizing","mult"],[st],Pe),Ue.TEXT,i,s)},mo=80,po=.08,go=function(t,n,r,i,a){var s=om(t,i,r),o=new Yr(t,s),l=new Tr([o],{width:"400em",height:le(n),viewBox:"0 0 400000 "+r,preserveAspectRatio:"xMinYMin slice"});return Kr(["hide-tail"],[l],a)},op=function(t,n){var r=n.havingBaseSizing(),i=Dd("\\surd",t*r.sizeMultiplier,Pd,r),a=r.sizeMultiplier,s=Math.max(0,n.minRuleThickness-n.fontMetrics().sqrtRuleThickness),o,l,d,c,f;return i.type==="small"?(c=1e3+1e3*s+mo,t<1?a=1:t<1.4&&(a=.7),l=(1+s+po)/a,d=(1+s)/a,o=go("sqrtMain",l,c,s,n),o.style.minWidth="0.853em",f=.833/a):i.type==="large"?(c=(1e3+mo)*ha[i.size],d=(ha[i.size]+s)/a,l=(ha[i.size]+s+po)/a,o=go("sqrtSize"+i.size,l,c,s,n),o.style.minWidth="1.02em",f=1/a):(l=t+s+po,d=t+s,c=Math.floor(1e3*t+s)+mo,o=go("sqrtTall",l,c,s,n),o.style.minWidth="0.742em",f=1.056),o.height=d,o.style.height=le(l),{span:o,advanceWidth:f,ruleWidth:(n.fontMetrics().sqrtRuleThickness+s)*a}},Id=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"]),lp=new Set(["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"]),Nd=new Set(["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"]),ha=[0,1.2,1.8,2.4,3],Ld=function(t,n,r,i,a){if(t==="<"||t==="\\lt"||t==="⟨"?t="\\langle":(t===">"||t==="\\gt"||t==="⟩")&&(t="\\rangle"),Id.has(t)||Nd.has(t))return Ad(t,n,!1,r,i,a);if(lp.has(t))return Rd(t,ha[n],!1,r,i,a);throw new re("Illegal delimiter: '"+t+"'")},cp=[{type:"small",style:Ue.SCRIPTSCRIPT},{type:"small",style:Ue.SCRIPT},{type:"small",style:Ue.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],up=[{type:"small",style:Ue.SCRIPTSCRIPT},{type:"small",style:Ue.SCRIPT},{type:"small",style:Ue.TEXT},{type:"stack"}],Pd=[{type:"small",style:Ue.SCRIPTSCRIPT},{type:"small",style:Ue.SCRIPT},{type:"small",style:Ue.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],dp=function(t){if(t.type==="small")return"Main-Regular";if(t.type==="large")return"Size"+t.size+"-Regular";if(t.type==="stack")return"Size4-Regular";var n=t.type;throw new Error("Add support for delim type '"+n+"' here.")},Dd=function(t,n,r,i){for(var a=Math.min(2,3-i.style.size),s=a;s<r.length;s++){var o=r[s];if(o.type==="stack")break;var l=ca(t,dp(o),"math"),d=l.height+l.depth;if(o.type==="small"){var c=i.havingBaseStyle(o.style);d*=c.sizeMultiplier}if(d>n)return o}return r[r.length-1]},l0=function(t,n,r,i,a,s){t==="<"||t==="\\lt"||t==="⟨"?t="\\langle":(t===">"||t==="\\gt"||t==="⟩")&&(t="\\rangle");var o;Nd.has(t)?o=cp:Id.has(t)?o=Pd:o=up;var l=Dd(t,n,o,i);return l.type==="small"?rp(t,l.style,r,i,a,s):l.type==="large"?Ad(t,l.size,r,i,a,s):Rd(t,n,r,i,a,s)},vo=function(t,n,r,i,a,s){var o=i.fontMetrics().axisHeight*i.sizeMultiplier,l=901,d=5/i.fontMetrics().ptPerEm,c=Math.max(n-o,r+o),f=Math.max(c/500*l,2*c-d);return l0(t,f,!0,i,a,s)},rc={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},hp=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","<",">","\\langle","⟨","\\rangle","⟩","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."]);function ic(e){return"isMiddle"in e}function _s(e,t){var n=js(e);if(n&&hp.has(n.text))return n;throw n?new re("Invalid delimiter '"+n.text+"' after '"+t.funcName+"'",e):new re("Invalid delimiter type '"+e.type+"'",e)}ve({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],numArgs:1,argTypes:["primitive"],handler:(e,t)=>{var n=_s(t[0],e);return{type:"delimsizing",mode:e.parser.mode,size:rc[e.funcName].size,mclass:rc[e.funcName].mclass,delim:n.text}},htmlBuilder:(e,t)=>e.delim==="."?J([e.mclass]):Ld(e.delim,e.size,t,e.mode,[e.mclass]),mathmlBuilder:e=>{var t=[];e.delim!=="."&&t.push($n(e.delim,e.mode));var n=new ie("mo",t);e.mclass==="mopen"||e.mclass==="mclose"?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n.setAttribute("stretchy","true");var r=le(ha[e.size]);return n.setAttribute("minsize",r),n.setAttribute("maxsize",r),n}});function ac(e){if(!e.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}ve({type:"leftright-right",names:["\\right"],numArgs:1,primitive:!0,handler:(e,t)=>{var n=e.parser.gullet.macros.get("\\current@color");if(n&&typeof n!="string")throw new re("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:e.parser.mode,delim:_s(t[0],e).text,color:n}}});ve({type:"leftright",names:["\\left"],numArgs:1,primitive:!0,handler:(e,t)=>{var n=_s(t[0],e),r=e.parser;++r.leftrightDepth;var i=r.parseExpression(!1);--r.leftrightDepth,r.expect("\\right",!1);var a=Je(r.parseFunction(),"leftright-right");return{type:"leftright",mode:r.mode,body:i,left:n.text,right:a.delim,rightColor:a.color}},htmlBuilder:(e,t)=>{ac(e);for(var n=nn(e.body,t,!0,["mopen","mclose"]),r=0,i=0,a=!1,s=0;s<n.length;s++){var o=n[s];ic(o)?a=!0:(r=Math.max(n[s].height,r),i=Math.max(n[s].depth,i))}r*=t.sizeMultiplier,i*=t.sizeMultiplier;var l;if(e.left==="."?l=ya(t,["mopen"]):l=vo(e.left,r,i,t,e.mode,["mopen"]),n.unshift(l),a)for(var d=1;d<n.length;d++){var c=n[d];if(ic(c)){var f=c.isMiddle;n[d]=vo(f.delim,r,i,f.options,e.mode,[])}}var g;if(e.right===".")g=ya(t,["mclose"]);else{var y=e.rightColor?t.withColor(e.rightColor):t;g=vo(e.right,r,i,y,e.mode,["mclose"])}return n.push(g),J(["minner"],n,t)},mathmlBuilder:(e,t)=>{ac(e);var n=zn(e.body,t);if(e.left!=="."){var r=new ie("mo",[$n(e.left,e.mode)]);r.setAttribute("fence","true"),n.unshift(r)}if(e.right!=="."){var i=new ie("mo",[$n(e.right,e.mode)]);i.setAttribute("fence","true"),e.rightColor&&i.setAttribute("mathcolor",e.rightColor),n.push(i)}return P0(n)}});ve({type:"middle",names:["\\middle"],numArgs:1,primitive:!0,handler:(e,t)=>{var n=_s(t[0],e);if(!e.parser.leftrightDepth)throw new re("\\middle without preceding \\left",n);return{type:"middle",mode:e.parser.mode,delim:n.text}},htmlBuilder:(e,t)=>{var n;return e.delim==="."?n=ya(t,[]):(n=Ld(e.delim,1,t,e.mode,[]),n.isMiddle={delim:e.delim,options:t}),n},mathmlBuilder:(e,t)=>{var n=e.delim==="\\vert"||e.delim==="|"?$n("|","text"):$n(e.delim,e.mode),r=new ie("mo",[n]);return r.setAttribute("fence","true"),r.setAttribute("lspace","0.05em"),r.setAttribute("rspace","0.05em"),r}});var fp=(e,t)=>{var n=qi(yt(e.body,t),t),r=e.label.slice(1),i=t.sizeMultiplier,a,s,o=Ar(e.body);if(r==="sout")a=J(["stretchy","sout"]),a.height=t.fontMetrics().defaultRuleThickness/i,s=-.5*t.fontMetrics().xHeight;else if(r==="phase"){var l=Ft({number:.6,unit:"pt"},t),d=Ft({number:.35,unit:"ex"},t),c=t.havingBaseSizing();i=i/c.sizeMultiplier;var f=n.height+n.depth+l+d;n.style.paddingLeft=le(f/2+l);var g=Math.floor(1e3*f*i),y=am(g),x=new Tr([new Yr("phase",y)],{width:"400em",height:le(g/1e3),viewBox:"0 0 400000 "+g,preserveAspectRatio:"xMinYMin slice"});a=Kr(["hide-tail"],[x],t),a.style.height=le(f),s=n.depth+l+d}else{/cancel/.test(r)?o||n.classes.push("cancel-pad"):r==="angl"?n.classes.push("anglpad"):n.classes.push("boxpad");var k,w,E=0;/box/.test(r)?(E=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness),k=t.fontMetrics().fboxsep+(r==="colorbox"?0:E),w=k):r==="angl"?(E=Math.max(t.fontMetrics().defaultRuleThickness,t.minRuleThickness),k=4*E,w=Math.max(0,.25-n.depth)):(k=o?.2:0,w=k),a=Hm(n,r,k,w,t),/fbox|boxed|fcolorbox/.test(r)?(a.style.borderStyle="solid",a.style.borderWidth=le(E)):r==="angl"&&E!==.049&&(a.style.borderTopWidth=le(E),a.style.borderRightWidth=le(E)),s=n.depth+w,e.backgroundColor&&(a.style.backgroundColor=e.backgroundColor,e.borderColor&&(a.style.borderColor=e.borderColor))}var S;if(e.backgroundColor)S=vt({positionType:"individualShift",children:[{type:"elem",elem:a,shift:s},{type:"elem",elem:n,shift:0}]});else{var R=/cancel|phase/.test(r)?["svg-align"]:[];S=vt({positionType:"individualShift",children:[{type:"elem",elem:n,shift:0},{type:"elem",elem:a,shift:s,wrapperClasses:R}]})}return/cancel/.test(r)&&(S.height=n.height,S.depth=n.depth),/cancel/.test(r)&&!o?J(["mord","cancel-lap"],[S],t):J(["mord"],[S],t)},mp=(e,t)=>{var n,r=new ie(e.label.includes("colorbox")?"mpadded":"menclose",[Mt(e.body,t)]);switch(e.label){case"\\cancel":r.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":r.setAttribute("notation","downdiagonalstrike");break;case"\\phase":r.setAttribute("notation","phasorangle");break;case"\\sout":r.setAttribute("notation","horizontalstrike");break;case"\\fbox":r.setAttribute("notation","box");break;case"\\angl":r.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(n=t.fontMetrics().fboxsep*t.fontMetrics().ptPerEm,r.setAttribute("width","+"+2*n+"pt"),r.setAttribute("height","+"+2*n+"pt"),r.setAttribute("lspace",n+"pt"),r.setAttribute("voffset",n+"pt"),e.label==="\\fcolorbox"){var i=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness);r.setAttribute("style","border: "+le(i)+" solid "+e.borderColor)}break;case"\\xcancel":r.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return e.backgroundColor&&r.setAttribute("mathbackground",e.backgroundColor),r};ve({type:"enclose",names:["\\colorbox"],numArgs:2,allowedInText:!0,argTypes:["color","hbox"],handler(e,t,n){var{parser:r,funcName:i}=e,a=Je(t[0],"color-token").color,s=t[1];return{type:"enclose",mode:r.mode,label:i,backgroundColor:a,body:s}},htmlBuilder:fp,mathmlBuilder:mp});ve({type:"enclose",names:["\\fcolorbox"],numArgs:3,allowedInText:!0,argTypes:["color","color","hbox"],handler(e,t,n){var{parser:r,funcName:i}=e,a=Je(t[0],"color-token").color,s=Je(t[1],"color-token").color,o=t[2];return{type:"enclose",mode:r.mode,label:i,backgroundColor:s,borderColor:a,body:o}}});ve({type:"enclose",names:["\\fbox"],numArgs:1,argTypes:["hbox"],allowedInText:!0,handler(e,t){var{parser:n}=e;return{type:"enclose",mode:n.mode,label:"\\fbox",body:t[0]}}});ve({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\phase"],numArgs:1,handler(e,t){var{parser:n,funcName:r}=e,i=t[0];return{type:"enclose",mode:n.mode,label:r,body:i}}});ve({type:"enclose",names:["\\sout"],numArgs:1,allowedInText:!0,handler(e,t){var{parser:n,funcName:r}=e;n.mode==="math"&&n.settings.reportNonstrict("mathVsSout","LaTeX's \\sout works only in text mode");var i=t[0];return{type:"enclose",mode:n.mode,label:r,body:i}}});ve({type:"enclose",names:["\\angl"],numArgs:1,argTypes:["hbox"],allowedInText:!1,handler(e,t){var{parser:n}=e;return{type:"enclose",mode:n.mode,label:"\\angl",body:t[0]}}});var Bd={};function cr(e){for(var{type:t,names:n,props:r,handler:i,htmlBuilder:a,mathmlBuilder:s}=e,o={type:t,numArgs:r.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:i},l=0;l<n.length;++l)Bd[n[l]]=o;a&&(ga[t]=a),s&&(va[t]=s)}var Od={};function b(e,t){Od[e]=t}class An{constructor(t,n,r){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=t,this.start=n,this.end=r}static range(t,n){return n?!t||!t.loc||!n.loc||t.loc.lexer!==n.loc.lexer?null:new An(t.loc.lexer,t.loc.start,n.loc.end):t&&t.loc}}class Dn{constructor(t,n){this.text=void 0,this.loc=void 0,this.noexpand=void 0,this.treatAsRelax=void 0,this.text=t,this.loc=n}range(t,n){return new Dn(n,An.range(this,t))}}function sc(e){var t=[];e.consumeSpaces();var n=e.fetch().text;for(n==="\\relax"&&(e.consume(),e.consumeSpaces(),n=e.fetch().text);n==="\\hline"||n==="\\hdashline";)e.consume(),t.push(n==="\\hdashline"),e.consumeSpaces(),n=e.fetch().text;return t}var $s=e=>{var t=e.parser.settings;if(!t.displayMode)throw new re("{"+e.envName+"} can be used only in display mode.")},pp=new Set(["gather","gather*"]);function O0(e){if(!e.includes("ed"))return!e.includes("*")}function ti(e,t,n){var{hskipBeforeAndAfter:r,addJot:i,cols:a,arraystretch:s,colSeparationType:o,autoTag:l,singleRow:d,emptySingleRow:c,maxNumCols:f,leqno:g}=t;if(e.gullet.beginGroup(),d||e.gullet.macros.set("\\cr","\\\\\\relax"),!s){var y=e.gullet.expandMacroAsText("\\arraystretch");if(y==null)s=1;else if(s=parseFloat(y),!s||s<0)throw new re("Invalid \\arraystretch: "+y)}e.gullet.beginGroup();var x=[],k=[x],w=[],E=[],S=l!=null?[]:void 0;function R(){l&&e.gullet.macros.set("\\@eqnsw","1",!0)}function L(){S&&(e.gullet.macros.get("\\df@tag")?(S.push(e.subparse([new Dn("\\df@tag")])),e.gullet.macros.set("\\df@tag",void 0,!0)):S.push(!!l&&e.gullet.macros.get("\\@eqnsw")==="1"))}for(R(),E.push(sc(e));;){var P=e.parseExpression(!1,d?"\\end":"\\\\");e.gullet.endGroup(),e.gullet.beginGroup();var B={type:"ordgroup",mode:e.mode,body:P};n&&(B={type:"styling",mode:e.mode,style:n,resetFont:!0,body:[B]}),x.push(B);var O=e.fetch().text;if(O==="&"){if(f&&x.length===f){if(d||o)throw new re("Too many tab characters: &",e.nextToken);e.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}e.consume()}else if(O==="\\end"){L(),x.length===1&&B.type==="styling"&&B.body.length===1&&B.body[0].type==="ordgroup"&&B.body[0].body.length===0&&(k.length>1||!c)&&k.pop(),E.length<k.length+1&&E.push([]);break}else if(O==="\\\\"){e.consume();var _=void 0;e.gullet.future().text!==" "&&(_=e.parseSizeGroup(!0)),w.push(_?_.value:null),L(),E.push(sc(e)),x=[],k.push(x),R()}else throw new re("Expected & or \\\\ or \\cr or \\end",e.nextToken)}return e.gullet.endGroup(),e.gullet.endGroup(),{type:"array",mode:e.mode,addJot:i,arraystretch:s,body:k,cols:a,rowGaps:w,hskipBeforeAndAfter:r,hLinesBeforeRow:E,colSeparationType:o,tags:S,leqno:g}}function z0(e){return e.slice(0,1)==="d"?"display":"text"}var ur=function(t,n){var r,i,a=t.body.length,s=t.hLinesBeforeRow,o=0,l=new Array(a),d=[],c=Math.max(n.fontMetrics().arrayRuleWidth,n.minRuleThickness),f=1/n.fontMetrics().ptPerEm,g=5*f;if(t.colSeparationType&&t.colSeparationType==="small"){var y=n.havingStyle(Ue.SCRIPT).sizeMultiplier;g=.2778*(y/n.sizeMultiplier)}var x=t.colSeparationType==="CD"?Ft({number:3,unit:"ex"},n):12*f,k=3*f,w=t.arraystretch*x,E=.7*w,S=.3*w,R=0;function L(Ae){for(var Ye=0;Ye<Ae.length;++Ye)Ye>0&&(R+=.25),d.push({pos:R,isDashed:Ae[Ye]})}for(L(s[0]),r=0;r<t.body.length;++r){var P=t.body[r],B=E,O=S;o<P.length&&(o=P.length);var _={cells:new Array(P.length),height:0,depth:0,pos:0};for(i=0;i<P.length;++i){var F=yt(P[i],n);O<F.depth&&(O=F.depth),B<F.height&&(B=F.height),_.cells[i]=F}var $=t.rowGaps[r],j=0;$&&(j=Ft($,n),j>0&&(j+=S,O<j&&(O=j),j=0)),t.addJot&&r<t.body.length-1&&(O+=k),_.height=B,_.depth=O,R+=B,_.pos=R,R+=O+j,l[r]=_,L(s[r+1])}var D=R/2+n.fontMetrics().axisHeight,q=t.cols||[],K=[],fe,de,Ce=[];if(t.tags&&t.tags.some(Ae=>Ae))for(r=0;r<a;++r){var oe=l[r],Ee=oe.pos-D,ze=t.tags[r],ge=void 0;ze===!0?ge=J(["eqn-num"],[],n):ze===!1?ge=J([],[],n):ge=J([],nn(ze,n,!0),n),ge.depth=oe.depth,ge.height=oe.height,Ce.push({type:"elem",elem:ge,shift:Ee})}for(i=0,de=0;i<o||de<q.length;++i,++de){for(var We,Pe=q[de],st=!0;((se=Pe)==null?void 0:se.type)==="separator";){var se;if(st||(fe=J(["arraycolsep"],[]),fe.style.width=le(n.fontMetrics().doubleRuleSep),K.push(fe)),Pe.separator==="|"||Pe.separator===":"){var Le=Pe.separator==="|"?"solid":"dashed",he=J(["vertical-separator"],[],n);he.style.height=le(R),he.style.borderRightWidth=le(c),he.style.borderRightStyle=Le,he.style.margin="0 "+le(-c/2);var Ne=R-D;Ne&&(he.style.verticalAlign=le(-Ne)),K.push(he)}else throw new re("Invalid separator type: "+Pe.separator);de++,Pe=q[de],st=!1}if(!(i>=o)){var Te=void 0;if(i>0||t.hskipBeforeAndAfter){var et,Oe;Te=(et=(Oe=Pe)==null?void 0:Oe.pregap)!=null?et:g,Te!==0&&(fe=J(["arraycolsep"],[]),fe.style.width=le(Te),K.push(fe))}var Nt=[];for(r=0;r<a;++r){var Ht=l[r],dt=Ht.cells[i];if(dt){var Q=Ht.pos-D;dt.depth=Ht.depth,dt.height=Ht.height,Nt.push({type:"elem",elem:dt,shift:Q})}}var je=vt({positionType:"individualShift",children:Nt}),De=J(["col-align-"+(((We=Pe)==null?void 0:We.align)||"c")],[je]);if(K.push(De),i<o-1||t.hskipBeforeAndAfter){var I,ee;Te=(I=(ee=Pe)==null?void 0:ee.postgap)!=null?I:g,Te!==0&&(fe=J(["arraycolsep"],[]),fe.style.width=le(Te),K.push(fe))}}}var G=J(["mtable"],K);if(d.length>0){for(var A=Hi("hline",n,c),z=Hi("hdashline",n,c),X=[{type:"elem",elem:G,shift:0}];d.length>0;){var Z=d.pop(),U=Z.pos-D;Z.isDashed?X.push({type:"elem",elem:z,shift:U}):X.push({type:"elem",elem:A,shift:U})}G=vt({positionType:"individualShift",children:X})}if(Ce.length===0)return J(["mord"],[G],n);var ce=vt({positionType:"individualShift",children:Ce}),be=J(["tag"],[ce],n);return Ir([G,be])},gp={c:"center ",l:"left ",r:"right "},dr=function(t,n){for(var r=[],i=new ie("mtd",[],["mtr-glue"]),a=new ie("mtd",[],["mml-eqn-num"]),s=0;s<t.body.length;s++){for(var o=t.body[s],l=[],d=0;d<o.length;d++)l.push(new ie("mtd",[Mt(o[d],n)]));t.tags&&t.tags[s]&&(l.unshift(i),l.push(i),t.leqno?l.unshift(a):l.push(a)),r.push(new ie("mtr",l))}var c=new ie("mtable",r),f=t.arraystretch===.5?.1:.16+t.arraystretch-1+(t.addJot?.09:0);c.setAttribute("rowspacing",le(f));var g="",y="";if(t.cols&&t.cols.length>0){var x=t.cols,k="",w=!1,E=0,S=x.length;x[0].type==="separator"&&(g+="top ",E=1),x[x.length-1].type==="separator"&&(g+="bottom ",S-=1);for(var R=E;R<S;R++){var L=x[R];L.type==="align"?(y+=gp[L.align],w&&(k+="none "),w=!0):L.type==="separator"&&w&&(k+=L.separator==="|"?"solid ":"dashed ",w=!1)}c.setAttribute("columnalign",y.trim()),/[sd]/.test(k)&&c.setAttribute("columnlines",k.trim())}if(t.colSeparationType==="align"){for(var P=t.cols||[],B="",O=1;O<P.length;O++)B+=O%2?"0em ":"1em ";c.setAttribute("columnspacing",B.trim())}else t.colSeparationType==="alignat"||t.colSeparationType==="gather"?c.setAttribute("columnspacing","0em"):t.colSeparationType==="small"?c.setAttribute("columnspacing","0.2778em"):t.colSeparationType==="CD"?c.setAttribute("columnspacing","0.5em"):c.setAttribute("columnspacing","1em");var _="",F=t.hLinesBeforeRow;g+=F[0].length>0?"left ":"",g+=F[F.length-1].length>0?"right ":"";for(var $=1;$<F.length-1;$++)_+=F[$].length===0?"none ":F[$][0]?"dashed ":"solid ";return/[sd]/.test(_)&&c.setAttribute("rowlines",_.trim()),g!==""&&(c=new ie("menclose",[c]),c.setAttribute("notation",g.trim())),t.arraystretch&&t.arraystretch<1&&(c=new ie("mstyle",[c]),c.setAttribute("scriptlevel","1")),c},zd=function(t,n){t.envName.includes("ed")||$s(t);var r=[],i=t.envName==="split",a=ti(t.parser,{cols:r,addJot:!0,autoTag:i?void 0:O0(t.envName),emptySingleRow:!0,colSeparationType:t.envName.includes("at")?"alignat":"align",maxNumCols:i?2:void 0,leqno:t.parser.settings.leqno},"display"),s=0,o=0,l={type:"ordgroup",mode:t.mode,body:[]};if(n[0]&&n[0].type==="ordgroup"){for(var d="",c=0;c<n[0].body.length;c++){var f=Je(n[0].body[c],"textord");d+=f.text}s=Number(d),o=s*2}var g=!o;a.body.forEach(function(w){for(var E=1;E<w.length;E+=2){var S=Je(w[E],"styling"),R=Je(S.body[0],"ordgroup");R.body.unshift(l)}if(g)o<w.length&&(o=w.length);else{var L=w.length/2;if(s<L)throw new re("Too many math in a row: "+("expected "+s+", but got "+L),w[0])}});for(var y=0;y<o;++y){var x="r",k=0;y%2===1?x="l":y>0&&g&&(k=1),r[y]={type:"align",align:x,pregap:k,postgap:0}}return a.colSeparationType=g?"align":"alignat",a};cr({type:"array",names:["array","darray"],props:{numArgs:1},handler(e,t){var n=js(t[0]),r=n?[t[0]]:Je(t[0],"ordgroup").body,i=r.map(function(s){var o=zs(s),l=o.text;if("lcr".includes(l))return{type:"align",align:l};if(l==="|")return{type:"separator",separator:"|"};if(l===":")return{type:"separator",separator:":"};throw new re("Unknown column alignment: "+l,s)}),a={cols:i,hskipBeforeAndAfter:!0,maxNumCols:i.length};return ti(e.parser,a,z0(e.envName))},htmlBuilder:ur,mathmlBuilder:dr});cr({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(e){var t={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[e.envName.replace("*","")],n="c",r={hskipBeforeAndAfter:!1,cols:[{type:"align",align:n}]};if(e.envName.charAt(e.envName.length-1)==="*"){var i=e.parser;if(i.consumeSpaces(),i.fetch().text==="["){if(i.consume(),i.consumeSpaces(),n=i.fetch().text,!"lcr".includes(n))throw new re("Expected l or c or r",i.nextToken);i.consume(),i.consumeSpaces(),i.expect("]"),i.consume(),r.cols=[{type:"align",align:n}]}}var a=ti(e.parser,r,z0(e.envName)),s=Math.max(0,...a.body.map(o=>o.length));return a.cols=new Array(s).fill({type:"align",align:n}),t?{type:"leftright",mode:e.mode,body:[a],left:t[0],right:t[1],rightColor:void 0}:a},htmlBuilder:ur,mathmlBuilder:dr});cr({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(e){var t={arraystretch:.5},n=ti(e.parser,t,"script");return n.colSeparationType="small",n},htmlBuilder:ur,mathmlBuilder:dr});cr({type:"array",names:["subarray"],props:{numArgs:1},handler(e,t){var n=js(t[0]),r=n?[t[0]]:Je(t[0],"ordgroup").body,i=r.map(function(o){var l=zs(o),d=l.text;if("lc".includes(d))return{type:"align",align:d};throw new re("Unknown column alignment: "+d,o)});if(i.length>1)throw new re("{subarray} can contain only one column");var a={cols:i,hskipBeforeAndAfter:!1,arraystretch:.5},s=ti(e.parser,a,"script");if(s.body.length>0&&s.body[0].length>1)throw new re("{subarray} can contain only one column");return s},htmlBuilder:ur,mathmlBuilder:dr});cr({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(e){var t={arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},n=ti(e.parser,t,z0(e.envName));return{type:"leftright",mode:e.mode,body:[n],left:e.envName.includes("r")?".":"\\{",right:e.envName.includes("r")?"\\}":".",rightColor:void 0}},htmlBuilder:ur,mathmlBuilder:dr});cr({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:zd,htmlBuilder:ur,mathmlBuilder:dr});cr({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(e){pp.has(e.envName)&&$s(e);var t={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:O0(e.envName),emptySingleRow:!0,leqno:e.parser.settings.leqno};return ti(e.parser,t,"display")},htmlBuilder:ur,mathmlBuilder:dr});cr({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:zd,htmlBuilder:ur,mathmlBuilder:dr});cr({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(e){$s(e);var t={autoTag:O0(e.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:e.parser.settings.leqno};return ti(e.parser,t,"display")},htmlBuilder:ur,mathmlBuilder:dr});cr({type:"array",names:["CD"],props:{numArgs:0},handler(e){return $s(e),Qm(e.parser)},htmlBuilder:ur,mathmlBuilder:dr});b("\\nonumber","\\gdef\\@eqnsw{0}");b("\\notag","\\nonumber");ve({type:"text",names:["\\hline","\\hdashline"],numArgs:0,allowedInText:!0,allowedInMath:!0,handler(e,t){throw new re(e.funcName+" valid only within array environment")}});var oc=Bd;ve({type:"environment",names:["\\begin","\\end"],numArgs:1,argTypes:["text"],handler(e,t){var{parser:n,funcName:r}=e,i=t[0];if(i.type!=="ordgroup")throw new re("Invalid environment name",i);for(var a="",s=0;s<i.body.length;++s)a+=Je(i.body[s],"textord").text;if(r==="\\begin"){if(!oc.hasOwnProperty(a))throw new re("No such environment: "+a,i);var o=oc[a],{args:l,optArgs:d}=n.parseArguments("\\begin{"+a+"}",o),c={mode:n.mode,envName:a,parser:n},f=o.handler(c,l,d);n.expect("\\end",!1);var g=n.nextToken,y=Je(n.parseFunction(),"environment");if(y.name!==a)throw new re("Mismatch: \\begin{"+a+"} matched by \\end{"+y.name+"}",g);return f}return{type:"environment",mode:n.mode,name:a,nameGroup:i}}});var vp=(e,t)=>{var n=e.font,r=t.withFont(n);return yt(e.body,r)},yp=(e,t)=>{var n=e.font,r=t.withFont(n);return Mt(e.body,r)},lc={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak"};ve({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],numArgs:1,allowedInArgument:!0,handler:(e,t)=>{var{parser:n,funcName:r}=e,i=us(t[0]),a=r in lc?lc[r]:r;return{type:"font",mode:n.mode,font:a.slice(1),body:i}},htmlBuilder:vp,mathmlBuilder:yp});ve({type:"mclass",names:["\\boldsymbol","\\bm"],numArgs:1,handler:(e,t)=>{var{parser:n}=e,r=t[0];return{type:"mclass",mode:n.mode,mclass:Fs(r),body:[{type:"font",mode:n.mode,font:"boldsymbol",body:r}],isCharacterBox:Ar(r)}}});ve({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],numArgs:0,allowedInText:!0,handler:(e,t)=>{var{parser:n,funcName:r,breakOnTokenText:i}=e,{mode:a}=n,s=n.parseExpression(!0,i);return{type:"font",mode:a,font:"math"+r.slice(1),body:{type:"ordgroup",mode:n.mode,body:s}}}});var bp=(e,t)=>{var n=t.style,r=n.fracNum(),i=n.fracDen(),a;a=t.havingStyle(r);var s=yt(e.numer,a,t);if(e.continued){var o=8.5/t.fontMetrics().ptPerEm,l=3.5/t.fontMetrics().ptPerEm;s.height=s.height<o?o:s.height,s.depth=s.depth<l?l:s.depth}a=t.havingStyle(i);var d=yt(e.denom,a,t),c,f,g;e.hasBarLine?(e.barSize?(f=Ft(e.barSize,t),c=Hi("frac-line",t,f)):c=Hi("frac-line",t),f=c.height,g=c.height):(c=null,f=0,g=t.fontMetrics().defaultRuleThickness);var y,x,k;n.size===Ue.DISPLAY.size?(y=t.fontMetrics().num1,f>0?x=3*g:x=7*g,k=t.fontMetrics().denom1):(f>0?(y=t.fontMetrics().num2,x=g):(y=t.fontMetrics().num3,x=3*g),k=t.fontMetrics().denom2);var w;if(c){var S=t.fontMetrics().axisHeight;y-s.depth-(S+.5*f)<x&&(y+=x-(y-s.depth-(S+.5*f))),S-.5*f-(d.height-k)<x&&(k+=x-(S-.5*f-(d.height-k)));var R=-(S-.5*f);w=vt({positionType:"individualShift",children:[{type:"elem",elem:d,shift:k},{type:"elem",elem:c,shift:R},{type:"elem",elem:s,shift:-y}]})}else{var E=y-s.depth-(d.height-k);E<x&&(y+=.5*(x-E),k+=.5*(x-E)),w=vt({positionType:"individualShift",children:[{type:"elem",elem:d,shift:k},{type:"elem",elem:s,shift:-y}]})}a=t.havingStyle(n),w.height*=a.sizeMultiplier/t.sizeMultiplier,w.depth*=a.sizeMultiplier/t.sizeMultiplier;var L;n.size===Ue.DISPLAY.size?L=t.fontMetrics().delim1:n.size===Ue.SCRIPTSCRIPT.size?L=t.havingStyle(Ue.SCRIPT).fontMetrics().delim2:L=t.fontMetrics().delim2;var P,B;return e.leftDelim==null?P=ya(t,["mopen"]):P=l0(e.leftDelim,L,!0,t.havingStyle(n),e.mode,["mopen"]),e.continued?B=J([]):e.rightDelim==null?B=ya(t,["mclose"]):B=l0(e.rightDelim,L,!0,t.havingStyle(n),e.mode,["mclose"]),J(["mord"].concat(a.sizingClasses(t)),[P,J(["mfrac"],[w]),B],t)},xp=(e,t)=>{var n=new ie("mfrac",[Mt(e.numer,t),Mt(e.denom,t)]);if(!e.hasBarLine)n.setAttribute("linethickness","0px");else if(e.barSize){var r=Ft(e.barSize,t);n.setAttribute("linethickness",le(r))}if(e.leftDelim!=null||e.rightDelim!=null){var i=[];if(e.leftDelim!=null){var a=new ie("mo",[new Xt(e.leftDelim.replace("\\",""))]);a.setAttribute("fence","true"),i.push(a)}if(i.push(n),e.rightDelim!=null){var s=new ie("mo",[new Xt(e.rightDelim.replace("\\",""))]);s.setAttribute("fence","true"),i.push(s)}return P0(i)}return n},jd=(e,t)=>{if(!t)return e;var n={type:"styling",mode:e.mode,style:t,body:[e]};return n};ve({type:"genfrac",names:["\\cfrac","\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],numArgs:2,allowedInArgument:!0,handler:(e,t)=>{var{parser:n,funcName:r}=e,i=t[0],a=t[1],s,o=null,l=null;switch(r){case"\\cfrac":case"\\dfrac":case"\\frac":case"\\tfrac":s=!0;break;case"\\\\atopfrac":s=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":s=!1,o="(",l=")";break;case"\\\\bracefrac":s=!1,o="\\{",l="\\}";break;case"\\\\brackfrac":s=!1,o="[",l="]";break;default:throw new Error("Unrecognized genfrac command")}var d=r==="\\cfrac",c=null;return d||r.startsWith("\\d")?c="display":r.startsWith("\\t")&&(c="text"),jd({type:"genfrac",mode:n.mode,numer:i,denom:a,continued:d,hasBarLine:s,leftDelim:o,rightDelim:l,barSize:null},c)},htmlBuilder:bp,mathmlBuilder:xp});ve({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],numArgs:0,infix:!0,handler(e){var{parser:t,funcName:n,token:r}=e,i;switch(n){case"\\over":i="\\frac";break;case"\\choose":i="\\binom";break;case"\\atop":i="\\\\atopfrac";break;case"\\brace":i="\\\\bracefrac";break;case"\\brack":i="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:t.mode,replaceWith:i,token:r}}});var cc=["display","text","script","scriptscript"],uc=function(t){var n=null;return t.length>0&&(n=t,n=n==="."?null:n),n};ve({type:"genfrac",names:["\\genfrac"],numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"],handler(e,t){var{parser:n}=e,r=t[4],i=t[5],a=us(t[0]),s=a.type==="atom"&&a.family==="open"?uc(a.text):null,o=us(t[1]),l=o.type==="atom"&&o.family==="close"?uc(o.text):null,d=Je(t[2],"size"),c,f=null;d.isBlank?c=!0:(f=d.value,c=f.number>0);var g=null,y=t[3];if(y.type==="ordgroup"){if(y.body.length>0){var x=Je(y.body[0],"textord");g=cc[Number(x.text)]}}else y=Je(y,"textord"),g=cc[Number(y.text)];return jd({type:"genfrac",mode:n.mode,numer:r,denom:i,continued:!1,hasBarLine:c,barSize:f,leftDelim:s,rightDelim:l},g)}});ve({type:"infix",names:["\\above"],numArgs:1,argTypes:["size"],infix:!0,handler(e,t){var{parser:n,funcName:r,token:i}=e;return{type:"infix",mode:n.mode,replaceWith:"\\\\abovefrac",size:Je(t[0],"size").value,token:i}}});ve({type:"genfrac",names:["\\\\abovefrac"],numArgs:3,argTypes:["math","size","math"],handler:(e,t)=>{var{parser:n,funcName:r}=e,i=t[0],a=Je(t[1],"infix").size;if(!a)throw new Error("\\\\abovefrac expected size, but got "+String(a));var s=t[2],o=a.number>0;return{type:"genfrac",mode:n.mode,numer:i,denom:s,continued:!1,hasBarLine:o,barSize:a,leftDelim:null,rightDelim:null}}});var Fd=(e,t)=>{var n=t.style,r,i;e.type==="supsub"?(r=e.sup?yt(e.sup,t.havingStyle(n.sup()),t):yt(e.sub,t.havingStyle(n.sub()),t),i=Je(e.base,"horizBrace")):i=Je(e,"horizBrace");var a=yt(i.base,t.havingBaseStyle(Ue.DISPLAY)),s=Os(i,t),o;if(i.isOver?o=vt({positionType:"firstBaseline",children:[{type:"elem",elem:a},{type:"kern",size:.1},{type:"elem",elem:s,wrapperClasses:["svg-align"]}]}):o=vt({positionType:"bottom",positionData:a.depth+.1+s.height,children:[{type:"elem",elem:s,wrapperClasses:["svg-align"]},{type:"kern",size:.1},{type:"elem",elem:a}]}),r){var l=J(["minner",i.isOver?"mover":"munder"],[o],t);i.isOver?o=vt({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"kern",size:.2},{type:"elem",elem:r}]}):o=vt({positionType:"bottom",positionData:l.depth+.2+r.height+r.depth,children:[{type:"elem",elem:r},{type:"kern",size:.2},{type:"elem",elem:l}]})}return J(["minner",i.isOver?"mover":"munder"],[o],t)},wp=(e,t)=>{var n=Bs(e.label);return new ie(e.isOver?"mover":"munder",[Mt(e.base,t),n])};ve({type:"horizBrace",names:["\\overbrace","\\underbrace","\\overbracket","\\underbracket"],numArgs:1,handler(e,t){var{parser:n,funcName:r}=e;return{type:"horizBrace",mode:n.mode,label:r,isOver:r.includes("\\over"),base:t[0]}},htmlBuilder:Fd,mathmlBuilder:wp});ve({type:"href",names:["\\href"],numArgs:2,argTypes:["url","original"],allowedInText:!0,handler:(e,t)=>{var{parser:n}=e,r=t[1],i=Je(t[0],"url").url;return n.settings.isTrusted({command:"\\href",url:i})?{type:"href",mode:n.mode,href:i,body:Gt(r)}:n.formatUnsupportedCmd("\\href")},htmlBuilder:(e,t)=>{var n=nn(e.body,t,!1);return Tm(e.href,[],n,t)},mathmlBuilder:(e,t)=>{var n=Zr(e.body,t);return n instanceof ie||(n=new ie("mrow",[n])),n.setAttribute("href",e.href),n}});ve({type:"href",names:["\\url"],numArgs:1,argTypes:["url"],allowedInText:!0,handler:(e,t)=>{var{parser:n}=e,r=Je(t[0],"url").url;if(!n.settings.isTrusted({command:"\\url",url:r}))return n.formatUnsupportedCmd("\\url");for(var i=[],a=0;a<r.length;a++){var s=r[a];s==="~"&&(s="\\textasciitilde"),i.push({type:"textord",mode:"text",text:s})}var o={type:"text",mode:n.mode,font:"\\texttt",body:i};return{type:"href",mode:n.mode,href:r,body:Gt(o)}}});ve({type:"hbox",names:["\\hbox"],numArgs:1,argTypes:["text"],allowedInText:!0,primitive:!0,handler(e,t){var{parser:n}=e;return{type:"hbox",mode:n.mode,body:Gt(t[0])}},htmlBuilder(e,t){var n=nn(e.body,t.withFont(""),!1);return Ir(n)},mathmlBuilder(e,t){return new ie("mrow",zn(e.body,t.withFont("")))}});ve({type:"html",names:["\\htmlClass","\\htmlId","\\htmlStyle","\\htmlData"],numArgs:2,argTypes:["raw","original"],allowedInText:!0,handler:(e,t)=>{var{parser:n,funcName:r,token:i}=e,a=Je(t[0],"raw").string,s=t[1];n.settings.strict&&n.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var o,l={};switch(r){case"\\htmlClass":l.class=a,o={command:"\\htmlClass",class:a};break;case"\\htmlId":l.id=a,o={command:"\\htmlId",id:a};break;case"\\htmlStyle":l.style=a,o={command:"\\htmlStyle",style:a};break;case"\\htmlData":{for(var d=a.split(","),c=0;c<d.length;c++){var f=d[c],g=f.indexOf("=");if(g<0)throw new re("\\htmlData key/value '"+f+"' missing equals sign");var y=f.slice(0,g),x=f.slice(g+1);l["data-"+y.trim()]=x}o={command:"\\htmlData",attributes:l};break}default:throw new Error("Unrecognized html command")}return n.settings.isTrusted(o)?{type:"html",mode:n.mode,attributes:l,body:Gt(s)}:n.formatUnsupportedCmd(r)},htmlBuilder:(e,t)=>{var n=nn(e.body,t,!1),r=["enclosing"];e.attributes.class&&r.push(...e.attributes.class.trim().split(/\s+/));var i=J(r,n,t);for(var a in e.attributes)a!=="class"&&e.attributes.hasOwnProperty(a)&&i.setAttribute(a,e.attributes[a]);return i},mathmlBuilder:(e,t)=>Zr(e.body,t)});ve({type:"htmlmathml",names:["\\html@mathml"],numArgs:2,allowedInArgument:!0,allowedInText:!0,handler:(e,t)=>{var{parser:n}=e;return{type:"htmlmathml",mode:n.mode,html:Gt(t[0]),mathml:Gt(t[1])}},htmlBuilder:(e,t)=>{var n=nn(e.html,t,!1);return Ir(n)},mathmlBuilder:(e,t)=>Zr(e.mathml,t)});var yo=function(t){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(t))return{number:+t,unit:"bp"};var n=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(t);if(!n)throw new re("Invalid size: '"+t+"' in \\includegraphics");var r={number:+(n[1]+n[2]),unit:n[3]};if(!ld(r))throw new re("Invalid unit: '"+r.unit+"' in \\includegraphics.");return r};ve({type:"includegraphics",names:["\\includegraphics"],numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1,handler:(e,t,n)=>{var{parser:r}=e,i={number:0,unit:"em"},a={number:.9,unit:"em"},s={number:0,unit:"em"},o="";if(n[0])for(var l=Je(n[0],"raw").string,d=l.split(","),c=0;c<d.length;c++){var f=d[c].split("=");if(f.length===2){var g=f[1].trim();switch(f[0].trim()){case"alt":o=g;break;case"width":i=yo(g);break;case"height":a=yo(g);break;case"totalheight":s=yo(g);break;default:throw new re("Invalid key: '"+f[0]+"' in \\includegraphics.")}}}var y=Je(t[0],"url").url;return o===""&&(o=y,o=o.replace(/^.*[\\/]/,""),o=o.substring(0,o.lastIndexOf("."))),r.settings.isTrusted({command:"\\includegraphics",url:y})?{type:"includegraphics",mode:r.mode,alt:o,width:i,height:a,totalheight:s,src:y}:r.formatUnsupportedCmd("\\includegraphics")},htmlBuilder:(e,t)=>{var n=Ft(e.height,t),r=0;e.totalheight.number>0&&(r=Ft(e.totalheight,t)-n);var i=0;e.width.number>0&&(i=Ft(e.width,t));var a={height:le(n+r)};i>0&&(a.width=le(i)),r>0&&(a.verticalAlign=le(-r));var s=new fm(e.src,e.alt,a);return s.height=n,s.depth=r,s},mathmlBuilder:(e,t)=>{var n=new ie("mglyph",[]);n.setAttribute("alt",e.alt);var r=Ft(e.height,t),i=0;if(e.totalheight.number>0&&(i=Ft(e.totalheight,t)-r,n.setAttribute("valign",le(-i))),n.setAttribute("height",le(r+i)),e.width.number>0){var a=Ft(e.width,t);n.setAttribute("width",le(a))}return n.setAttribute("src",e.src),n}});ve({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0,handler(e,t){var{parser:n,funcName:r}=e,i=Je(t[0],"size");if(n.settings.strict){var a=r[1]==="m",s=i.value.unit==="mu";a?(s||n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" supports only mu units, "+("not "+i.value.unit+" units")),n.mode!=="math"&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" works only in math mode")):s&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" doesn't support mu units")}return{type:"kern",mode:n.mode,dimension:i.value}},htmlBuilder(e,t){return md(e.dimension,t)},mathmlBuilder(e,t){var n=Ft(e.dimension,t);return new xd(n)}});ve({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],numArgs:1,allowedInText:!0,handler:(e,t)=>{var{parser:n,funcName:r}=e,i=t[0];return{type:"lap",mode:n.mode,alignment:r.slice(5),body:i}},htmlBuilder:(e,t)=>{var n;e.alignment==="clap"?(n=J([],[yt(e.body,t)]),n=J(["inner"],[n],t)):n=J(["inner"],[yt(e.body,t)]);var r=J(["fix"],[]),i=J([e.alignment],[n,r],t),a=J(["strut"]);return a.style.height=le(i.height+i.depth),i.depth&&(a.style.verticalAlign=le(-i.depth)),i.children.unshift(a),i=J(["thinbox"],[i],t),J(["mord","vbox"],[i],t)},mathmlBuilder:(e,t)=>{var n=new ie("mpadded",[Mt(e.body,t)]);if(e.alignment!=="rlap"){var r=e.alignment==="llap"?"-1":"-0.5";n.setAttribute("lspace",r+"width")}return n.setAttribute("width","0px"),n}});ve({type:"styling",names:["\\(","$"],numArgs:0,allowedInText:!0,allowedInMath:!1,handler(e,t){var{funcName:n,parser:r}=e,i=r.mode;r.switchMode("math");var a=n==="\\("?"\\)":"$",s=r.parseExpression(!1,a);return r.expect(a),r.switchMode(i),{type:"styling",mode:r.mode,style:"text",resetFont:!0,body:s}}});ve({type:"text",names:["\\)","\\]"],numArgs:0,allowedInText:!0,allowedInMath:!1,handler(e,t){throw new re("Mismatched "+e.funcName)}});var dc=(e,t)=>{switch(t.style.size){case Ue.DISPLAY.size:return e.display;case Ue.TEXT.size:return e.text;case Ue.SCRIPT.size:return e.script;case Ue.SCRIPTSCRIPT.size:return e.scriptscript;default:return e.text}};ve({type:"mathchoice",names:["\\mathchoice"],numArgs:4,primitive:!0,handler:(e,t)=>{var{parser:n}=e;return{type:"mathchoice",mode:n.mode,display:Gt(t[0]),text:Gt(t[1]),script:Gt(t[2]),scriptscript:Gt(t[3])}},htmlBuilder:(e,t)=>{var n=dc(e,t),r=nn(n,t,!1);return Ir(r)},mathmlBuilder:(e,t)=>{var n=dc(e,t);return Zr(n,t)}});var _d=(e,t,n,r,i,a,s)=>{e=J([],[e]);var o=n&&Ar(n),l,d;if(t){var c=yt(t,r.havingStyle(i.sup()),r);d={elem:c,kern:Math.max(r.fontMetrics().bigOpSpacing1,r.fontMetrics().bigOpSpacing3-c.depth)}}if(n){var f=yt(n,r.havingStyle(i.sub()),r);l={elem:f,kern:Math.max(r.fontMetrics().bigOpSpacing2,r.fontMetrics().bigOpSpacing4-f.height)}}var g;if(d&&l){var y=r.fontMetrics().bigOpSpacing5+l.elem.height+l.elem.depth+l.kern+e.depth+s;g=vt({positionType:"bottom",positionData:y,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:le(-a)},{type:"kern",size:l.kern},{type:"elem",elem:e},{type:"kern",size:d.kern},{type:"elem",elem:d.elem,marginLeft:le(a)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]})}else if(l){var x=e.height-s;g=vt({positionType:"top",positionData:x,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:le(-a)},{type:"kern",size:l.kern},{type:"elem",elem:e}]})}else if(d){var k=e.depth+s;g=vt({positionType:"bottom",positionData:k,children:[{type:"elem",elem:e},{type:"kern",size:d.kern},{type:"elem",elem:d.elem,marginLeft:le(a)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]})}else return e;var w=[g];if(l&&a!==0&&!o){var E=J(["mspace"],[],r);E.style.marginRight=le(a),w.unshift(E)}return J(["mop","op-limits"],w,r)},$d=new Set(["\\smallint"]),Hd=(e,t)=>{var n,r,i=!1,a;e.type==="supsub"?(n=e.sup,r=e.sub,a=Je(e.base,"op"),i=!0):a=Je(e,"op");var s=t.style,o=!1;s.size===Ue.DISPLAY.size&&a.symbol&&!$d.has(a.name)&&(o=!0);var l,d;if(a.symbol){var c=o?"Size2-Regular":"Size1-Regular",f="";if((a.name==="\\oiint"||a.name==="\\oiiint")&&(f=a.name.slice(1),a.name=f==="oiint"?"\\iint":"\\iiint"),l=yn(a.name,c,"math",t,["mop","op-symbol",o?"large-op":"small-op"]),d=l.italic,f.length>0){var g=gd(f+"Size"+(o?"2":"1"),t);l=vt({positionType:"individualShift",children:[{type:"elem",elem:l,shift:0},{type:"elem",elem:g,shift:o?.08:0}]}),a.name="\\"+f,l.classes.unshift("mop"),l.italic=d}}else if(a.body){var y=nn(a.body,t,!0);y.length===1&&y[0]instanceof Bn?(l=y[0],l.classes[0]="mop"):l=J(["mop"],y,t)}else{for(var x=[],k=1;k<a.name.length;k++)x.push(N0(a.name[k],a.mode,t));l=J(["mop"],x,t)}var w=0,E=0;if((l instanceof Bn||a.name==="\\oiint"||a.name==="\\oiiint")&&!a.suppressBaseShift){var S;w=(l.height-l.depth)/2-t.fontMetrics().axisHeight,E=(S=l.italic)!=null?S:0}return i?_d(l,n,r,t,s,E,w):(w&&(l.style.position="relative",l.style.top=le(w)),l)},kp=(e,t)=>{var n;if(e.symbol)n=new ie("mo",[$n(e.name,e.mode)]),$d.has(e.name)&&n.setAttribute("largeop","false");else if(e.body)n=new ie("mo",zn(e.body,t));else{n=new ie("mi",[new Xt(e.name.slice(1))]);var r=new ie("mo",[$n("","text")]);e.parentIsSupSub?n=new ie("mrow",[n,r]):n=bd([n,r])}return n},Sp={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};ve({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],numArgs:0,handler:(e,t)=>{var{parser:n,funcName:r}=e,i=r;return i.length===1&&(i=Sp[i]),{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:i}},htmlBuilder:Hd,mathmlBuilder:kp});ve({type:"op",names:["\\mathop"],numArgs:1,primitive:!0,handler:(e,t)=>{var{parser:n}=e,r=t[0];return{type:"op",mode:n.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:Gt(r)}}});var Ep={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};ve({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],numArgs:0,handler(e){var{parser:t,funcName:n}=e;return{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:n}}});ve({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],numArgs:0,handler(e){var{parser:t,funcName:n}=e;return{type:"op",mode:t.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:n}}});ve({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],numArgs:0,allowedInArgument:!0,handler(e){var{parser:t,funcName:n}=e,r=n;return r.length===1&&(r=Ep[r]),{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:r}}});var qd=(e,t)=>{var n,r,i=!1,a;e.type==="supsub"?(n=e.sup,r=e.sub,a=Je(e.base,"operatorname"),i=!0):a=Je(e,"operatorname");var s;if(a.body.length>0){for(var o=a.body.map(f=>{var g="text"in f?f.text:void 0;return typeof g=="string"?{type:"textord",mode:f.mode,text:g}:f}),l=nn(o,t.withFont("mathrm"),!0),d=0;d<l.length;d++){var c=l[d];c instanceof Bn&&(c.text=c.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}s=J(["mop"],l,t)}else s=J(["mop"],[],t);return i?_d(s,n,r,t,t.style,0,0):s},Tp=(e,t)=>{for(var n=zn(e.body,t.withFont("mathrm")),r=!0,i=0;i<n.length;i++){var a=n[i];if(!(a instanceof xd))if(a instanceof ie)switch(a.type){case"mi":case"mn":case"mspace":case"mtext":break;case"mo":{var s=a.children[0];a.children.length===1&&s instanceof Xt?s.text=s.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):r=!1;break}default:r=!1}else r=!1}if(r){var o=n.map(c=>c.toText()).join("");n=[new Xt(o)]}var l=new ie("mi",n);l.setAttribute("mathvariant","normal");var d=new ie("mo",[$n("","text")]);return e.parentIsSupSub?new ie("mrow",[l,d]):bd([l,d])};ve({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],numArgs:1,handler:(e,t)=>{var{parser:n,funcName:r}=e,i=t[0];return{type:"operatorname",mode:n.mode,body:Gt(i),alwaysHandleSupSub:r==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:qd,mathmlBuilder:Tp});b("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");bi({type:"ordgroup",htmlBuilder(e,t){return e.semisimple?Ir(nn(e.body,t,!1)):J(["mord"],nn(e.body,t,!0),t)},mathmlBuilder(e,t){return Zr(e.body,t,!0)}});ve({type:"overline",names:["\\overline"],numArgs:1,handler(e,t){var{parser:n}=e,r=t[0];return{type:"overline",mode:n.mode,body:r}},htmlBuilder(e,t){var n=yt(e.body,t.havingCrampedStyle()),r=Hi("overline-line",t),i=t.fontMetrics().defaultRuleThickness,a=vt({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"kern",size:3*i},{type:"elem",elem:r},{type:"kern",size:i}]});return J(["mord","overline"],[a],t)},mathmlBuilder(e,t){var n=new ie("mo",[new Xt("‾")]);n.setAttribute("stretchy","true");var r=new ie("mover",[Mt(e.body,t),n]);return r.setAttribute("accent","true"),r}});ve({type:"phantom",names:["\\phantom"],numArgs:1,allowedInText:!0,handler:(e,t)=>{var{parser:n}=e,r=t[0];return{type:"phantom",mode:n.mode,body:Gt(r)}},htmlBuilder:(e,t)=>{var n=nn(e.body,t.withPhantom(),!1);return Ir(n)},mathmlBuilder:(e,t)=>{var n=zn(e.body,t);return new ie("mphantom",n)}});b("\\hphantom","\\smash{\\phantom{#1}}");ve({type:"vphantom",names:["\\vphantom"],numArgs:1,allowedInText:!0,handler:(e,t)=>{var{parser:n}=e,r=t[0];return{type:"vphantom",mode:n.mode,body:r}},htmlBuilder:(e,t)=>{var n=J(["inner"],[yt(e.body,t.withPhantom())]),r=J(["fix"],[]);return J(["mord","rlap"],[n,r],t)},mathmlBuilder:(e,t)=>{var n=zn(Gt(e.body),t),r=new ie("mphantom",n),i=new ie("mpadded",[r]);return i.setAttribute("width","0px"),i}});ve({type:"raisebox",names:["\\raisebox"],numArgs:2,argTypes:["size","hbox"],allowedInText:!0,handler(e,t){var{parser:n}=e,r=Je(t[0],"size").value,i=t[1];return{type:"raisebox",mode:n.mode,dy:r,body:i}},htmlBuilder(e,t){var n=yt(e.body,t),r=Ft(e.dy,t);return vt({positionType:"shift",positionData:-r,children:[{type:"elem",elem:n}]})},mathmlBuilder(e,t){var n=new ie("mpadded",[Mt(e.body,t)]),r=e.dy.number+e.dy.unit;return n.setAttribute("voffset",r),n}});ve({type:"internal",names:["\\relax"],numArgs:0,allowedInText:!0,allowedInArgument:!0,handler(e){var{parser:t}=e;return{type:"internal",mode:t.mode}}});ve({type:"rule",names:["\\rule"],numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"],handler(e,t,n){var{parser:r}=e,i=n[0],a=Je(t[0],"size"),s=Je(t[1],"size");return{type:"rule",mode:r.mode,shift:i&&Je(i,"size").value,width:a.value,height:s.value}},htmlBuilder(e,t){var n=J(["mord","rule"],[],t),r=Ft(e.width,t),i=Ft(e.height,t),a=e.shift?Ft(e.shift,t):0;return n.style.borderRightWidth=le(r),n.style.borderTopWidth=le(i),n.style.bottom=le(a),n.width=r,n.height=i+a,n.depth=-a,n.maxFontSize=i*1.125*t.sizeMultiplier,n},mathmlBuilder(e,t){var n=Ft(e.width,t),r=Ft(e.height,t),i=e.shift?Ft(e.shift,t):0,a=t.color&&t.getColor()||"black",s=new ie("mspace");s.setAttribute("mathbackground",a),s.setAttribute("width",le(n)),s.setAttribute("height",le(r));var o=new ie("mpadded",[s]);return i>=0?o.setAttribute("height",le(i)):(o.setAttribute("height",le(i)),o.setAttribute("depth",le(-i))),o.setAttribute("voffset",le(i)),o}});function Ud(e,t,n){for(var r=nn(e,t,!1),i=t.sizeMultiplier/n.sizeMultiplier,a=0;a<r.length;a++){var s=r[a].classes.indexOf("sizing");s<0?Array.prototype.push.apply(r[a].classes,t.sizingClasses(n)):r[a].classes[s+1]==="reset-size"+t.size&&(r[a].classes[s+1]="reset-size"+n.size),r[a].height*=i,r[a].depth*=i}return Ir(r)}var hc=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],Mp=(e,t)=>{var n=t.havingSize(e.size);return Ud(e.body,n,t)};ve({type:"sizing",names:hc,numArgs:0,allowedInText:!0,handler:(e,t)=>{var{breakOnTokenText:n,funcName:r,parser:i}=e,a=i.parseExpression(!1,n);return{type:"sizing",mode:i.mode,size:hc.indexOf(r)+1,body:a}},htmlBuilder:Mp,mathmlBuilder:(e,t)=>{var n=t.havingSize(e.size),r=zn(e.body,n),i=new ie("mstyle",r);return i.setAttribute("mathsize",le(n.sizeMultiplier)),i}});ve({type:"smash",names:["\\smash"],numArgs:1,numOptionalArgs:1,allowedInText:!0,handler:(e,t,n)=>{var{parser:r}=e,i=!1,a=!1,s=n[0]&&Je(n[0],"ordgroup");if(s)for(var o,l=0;l<s.body.length;++l){var d=s.body[l];if(o=zs(d).text,o==="t")i=!0;else if(o==="b")a=!0;else{i=!1,a=!1;break}}else i=!0,a=!0;var c=t[0];return{type:"smash",mode:r.mode,body:c,smashHeight:i,smashDepth:a}},htmlBuilder:(e,t)=>{var n=J([],[yt(e.body,t)]);if(!e.smashHeight&&!e.smashDepth)return n;if(e.smashHeight&&(n.height=0),e.smashDepth&&(n.depth=0),e.smashHeight&&e.smashDepth)return J(["mord","smash"],[n],t);if(n.children)for(var r=0;r<n.children.length;r++)e.smashHeight&&(n.children[r].height=0),e.smashDepth&&(n.children[r].depth=0);var i=vt({positionType:"firstBaseline",children:[{type:"elem",elem:n}]});return J(["mord"],[i],t)},mathmlBuilder:(e,t)=>{var n=new ie("mpadded",[Mt(e.body,t)]);return e.smashHeight&&n.setAttribute("height","0px"),e.smashDepth&&n.setAttribute("depth","0px"),n}});ve({type:"sqrt",names:["\\sqrt"],numArgs:1,numOptionalArgs:1,handler(e,t,n){var{parser:r}=e,i=n[0],a=t[0];return{type:"sqrt",mode:r.mode,body:a,index:i}},htmlBuilder(e,t){var n=yt(e.body,t.havingCrampedStyle());n.height===0&&(n.height=t.fontMetrics().xHeight),n=qi(n,t);var r=t.fontMetrics(),i=r.defaultRuleThickness,a=i;t.style.id<Ue.TEXT.id&&(a=t.fontMetrics().xHeight);var s=i+a/4,o=n.height+n.depth+s+i,{span:l,ruleWidth:d,advanceWidth:c}=op(o,t),f=l.height-d;f>n.height+n.depth+s&&(s=(s+f-n.height-n.depth)/2);var g=l.height-n.height-s-d;n.style.paddingLeft=le(c);var y=vt({positionType:"firstBaseline",children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:-(n.height+g)},{type:"elem",elem:l},{type:"kern",size:d}]});if(e.index){var x=t.havingStyle(Ue.SCRIPTSCRIPT),k=yt(e.index,x,t),w=.6*(y.height-y.depth),E=vt({positionType:"shift",positionData:-w,children:[{type:"elem",elem:k}]}),S=J(["root"],[E]);return J(["mord","sqrt"],[S,y],t)}else return J(["mord","sqrt"],[y],t)},mathmlBuilder(e,t){var{body:n,index:r}=e;return r?new ie("mroot",[Mt(n,t),Mt(r,t)]):new ie("msqrt",[Mt(n,t)])}});var c0={display:Ue.DISPLAY,text:Ue.TEXT,script:Ue.SCRIPT,scriptscript:Ue.SCRIPTSCRIPT};function Cp(e){return e in c0}ve({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],numArgs:0,allowedInText:!0,primitive:!0,handler(e,t){var{breakOnTokenText:n,funcName:r,parser:i}=e,a=i.parseExpression(!0,n),s=r.slice(1,r.length-5);if(!Cp(s))throw new Error("Unknown style: "+s);return{type:"styling",mode:i.mode,style:s,body:a}},htmlBuilder(e,t){var n=c0[e.style],r=t.havingStyle(n);return e.resetFont&&(r=r.withFont("")),Ud(e.body,r,t)},mathmlBuilder(e,t){var n=c0[e.style],r=t.havingStyle(n);e.resetFont&&(r=r.withFont(""));var i=zn(e.body,r),a=new ie("mstyle",i),s={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},o=s[e.style];return a.setAttribute("scriptlevel",o[0]),a.setAttribute("displaystyle",o[1]),a}});var Ap=function(t,n){var r=t.base;if(r)if(r.type==="op"){var i=r.limits&&(n.style.size===Ue.DISPLAY.size||r.alwaysHandleSupSub);return i?Hd:null}else if(r.type==="operatorname"){var a=r.alwaysHandleSupSub&&(n.style.size===Ue.DISPLAY.size||r.limits);return a?qd:null}else{if(r.type==="accent")return Ar(r.base)?Ed:null;if(r.type==="horizBrace"){var s=!t.sub;return s===r.isOver?Fd:null}else return null}else return null};bi({type:"supsub",htmlBuilder(e,t){var n=Ap(e,t);if(n)return n(e,t);var{base:r,sup:i,sub:a}=e,s=yt(r,t),o,l,d=t.fontMetrics(),c=0,f=0,g=r&&Ar(r);if(i){var y=t.havingStyle(t.style.sup());o=yt(i,y,t),g||(c=s.height-y.fontMetrics().supDrop*y.sizeMultiplier/t.sizeMultiplier)}if(a){var x=t.havingStyle(t.style.sub());l=yt(a,x,t),g||(f=s.depth+x.fontMetrics().subDrop*x.sizeMultiplier/t.sizeMultiplier)}var k;t.style===Ue.DISPLAY?k=d.sup1:t.style.cramped?k=d.sup3:k=d.sup2;var w=t.sizeMultiplier,E=le(.5/d.ptPerEm/w),S=null;if(l){var R=e.base&&e.base.type==="op"&&e.base.name&&(e.base.name==="\\oiint"||e.base.name==="\\oiiint");if(s instanceof Bn||R){var L;S=le(-((L=s.italic)!=null?L:0))}}var P;if(o&&l){c=Math.max(c,k,o.depth+.25*d.xHeight),f=Math.max(f,d.sub2);var B=d.defaultRuleThickness,O=4*B;if(c-o.depth-(l.height-f)<O){f=O-(c-o.depth)+l.height;var _=.8*d.xHeight-(c-o.depth);_>0&&(c+=_,f-=_)}var F=[{type:"elem",elem:l,shift:f,marginRight:E,marginLeft:S},{type:"elem",elem:o,shift:-c,marginRight:E}];P=vt({positionType:"individualShift",children:F})}else if(l){f=Math.max(f,d.sub1,l.height-.8*d.xHeight);var $=[{type:"elem",elem:l,marginLeft:S,marginRight:E}];P=vt({positionType:"shift",positionData:f,children:$})}else if(o)c=Math.max(c,k,o.depth+.25*d.xHeight),P=vt({positionType:"shift",positionData:-c,children:[{type:"elem",elem:o,marginRight:E}]});else throw new Error("supsub must have either sup or sub.");var j=i0(s,"right")||"mord";return J([j],[s,J(["msupsub"],[P])],t)},mathmlBuilder(e,t){var n=!1,r,i;e.base&&e.base.type==="horizBrace"&&(i=!!e.sup,i===e.base.isOver&&(n=!0,r=e.base.isOver)),e.base&&(e.base.type==="op"||e.base.type==="operatorname")&&(e.base.parentIsSupSub=!0);var a=[Mt(e.base,t)];e.sub&&a.push(Mt(e.sub,t)),e.sup&&a.push(Mt(e.sup,t));var s;if(n)s=r?"mover":"munder";else if(e.sub)if(e.sup){var d=e.base;d&&d.type==="op"&&d.limits&&t.style===Ue.DISPLAY||d&&d.type==="operatorname"&&d.alwaysHandleSupSub&&(t.style===Ue.DISPLAY||d.limits)?s="munderover":s="msubsup"}else{var l=e.base;l&&l.type==="op"&&l.limits&&(t.style===Ue.DISPLAY||l.alwaysHandleSupSub)||l&&l.type==="operatorname"&&l.alwaysHandleSupSub&&(l.limits||t.style===Ue.DISPLAY)?s="munder":s="msub"}else{var o=e.base;o&&o.type==="op"&&o.limits&&(t.style===Ue.DISPLAY||o.alwaysHandleSupSub)||o&&o.type==="operatorname"&&o.alwaysHandleSupSub&&(o.limits||t.style===Ue.DISPLAY)?s="mover":s="msup"}return new ie(s,a)}});bi({type:"atom",htmlBuilder(e,t){return N0(e.text,e.mode,t,["m"+e.family])},mathmlBuilder(e,t){var n=new ie("mo",[$n(e.text,e.mode)]);if(e.family==="bin"){var r=D0(e,t);r==="bold-italic"&&n.setAttribute("mathvariant",r)}else e.family==="punct"?n.setAttribute("separator","true"):(e.family==="open"||e.family==="close")&&n.setAttribute("stretchy","false");return n}});var Wd={mi:"italic",mn:"normal",mtext:"normal"};bi({type:"mathord",htmlBuilder(e,t){return Ds(e,t)},mathmlBuilder(e,t){var n=new ie("mi",[$n(e.text,e.mode,t)]),r=D0(e,t)||"italic";return r!==Wd[n.type]&&n.setAttribute("mathvariant",r),n}});bi({type:"textord",htmlBuilder(e,t){return Ds(e,t)},mathmlBuilder(e,t){var n=$n(e.text,e.mode,t),r=D0(e,t)||"normal",i;return e.mode==="text"?i=new ie("mtext",[n]):/[0-9]/.test(e.text)?i=new ie("mn",[n]):e.text==="\\prime"?i=new ie("mo",[n]):i=new ie("mi",[n]),r!==Wd[i.type]&&i.setAttribute("mathvariant",r),i}});var bo={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},xo={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};bi({type:"spacing",htmlBuilder(e,t){if(xo.hasOwnProperty(e.text)){var n=xo[e.text].className||"";if(e.mode==="text"){var r=Ds(e,t);return r.classes.push(n),r}else return J(["mspace",n],[N0(e.text,e.mode,t)],t)}else{if(bo.hasOwnProperty(e.text))return J(["mspace",bo[e.text]],[],t);throw new re('Unknown type of space "'+e.text+'"')}},mathmlBuilder(e,t){var n;if(xo.hasOwnProperty(e.text))n=new ie("mtext",[new Xt(" ")]);else{if(bo.hasOwnProperty(e.text))return new ie("mspace");throw new re('Unknown type of space "'+e.text+'"')}return n}});var fc=()=>{var e=new ie("mtd",[]);return e.setAttribute("width","50%"),e};bi({type:"tag",mathmlBuilder(e,t){var n=new ie("mtable",[new ie("mtr",[fc(),new ie("mtd",[Zr(e.body,t)]),fc(),new ie("mtd",[Zr(e.tag,t)])])]);return n.setAttribute("width","100%"),n}});var mc={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},pc={"\\textbf":"textbf","\\textmd":"textmd"},Rp={"\\textit":"textit","\\textup":"textup"},gc=(e,t)=>{var n=e.font;if(n){if(mc[n])return t.withTextFontFamily(mc[n]);if(pc[n])return t.withTextFontWeight(pc[n]);if(n==="\\emph")return t.fontShape==="textit"?t.withTextFontShape("textup"):t.withTextFontShape("textit")}else return t;return t.withTextFontShape(Rp[n])};ve({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0,handler(e,t){var{parser:n,funcName:r}=e,i=t[0];return{type:"text",mode:n.mode,body:Gt(i),font:r}},htmlBuilder(e,t){var n=gc(e,t),r=nn(e.body,n,!0);return J(["mord","text"],r,n)},mathmlBuilder(e,t){var n=gc(e,t);return Zr(e.body,n)}});ve({type:"underline",names:["\\underline"],numArgs:1,allowedInText:!0,handler(e,t){var{parser:n}=e;return{type:"underline",mode:n.mode,body:t[0]}},htmlBuilder(e,t){var n=yt(e.body,t),r=Hi("underline-line",t),i=t.fontMetrics().defaultRuleThickness,a=vt({positionType:"top",positionData:n.height,children:[{type:"kern",size:i},{type:"elem",elem:r},{type:"kern",size:3*i},{type:"elem",elem:n}]});return J(["mord","underline"],[a],t)},mathmlBuilder(e,t){var n=new ie("mo",[new Xt("‾")]);n.setAttribute("stretchy","true");var r=new ie("munder",[Mt(e.body,t),n]);return r.setAttribute("accentunder","true"),r}});ve({type:"vcenter",names:["\\vcenter"],numArgs:1,argTypes:["original"],allowedInText:!1,handler(e,t){var{parser:n}=e;return{type:"vcenter",mode:n.mode,body:t[0]}},htmlBuilder(e,t){var n=yt(e.body,t),r=t.fontMetrics().axisHeight,i=.5*(n.height-r-(n.depth+r));return vt({positionType:"shift",positionData:i,children:[{type:"elem",elem:n}]})},mathmlBuilder(e,t){var n=new ie("mpadded",[Mt(e.body,t)],["vcenter"]);return new ie("mrow",[n])}});ve({type:"verb",names:["\\verb"],numArgs:0,allowedInText:!0,handler(e,t,n){throw new re("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(e,t){for(var n=vc(e),r=[],i=t.havingStyle(t.style.text()),a=0;a<n.length;a++){var s=n[a];s==="~"&&(s="\\textasciitilde"),r.push(yn(s,"Typewriter-Regular",e.mode,i,["mord","texttt"]))}return J(["mord","text"].concat(i.sizingClasses(t)),fd(r),i)},mathmlBuilder(e,t){var n=new Xt(vc(e)),r=new ie("mtext",[n]);return r.setAttribute("mathvariant","monospace"),r}});var vc=e=>e.body.replace(/ /g,e.star?"␣":" "),Ur=vd,Gd=`[ \r
|
|
258
|
+
]`,Ip="\\\\[a-zA-Z@]+",Np="\\\\[^\uD800-\uDFFF]",Lp="("+Ip+")"+Gd+"*",Pp=`\\\\(
|
|
259
|
+
|[ \r ]+
|
|
260
|
+
?)[ \r ]*`,u0="[̀-ͯ]",Dp=new RegExp(u0+"+$"),Bp="("+Gd+"+)|"+(Pp+"|")+"([!-\\[\\]-‧-豈-]"+(u0+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(u0+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+Lp)+("|"+Np+")");class yc{constructor(t,n){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=t,this.settings=n,this.tokenRegex=new RegExp(Bp,"g"),this.catcodes={"%":14,"~":13}}setCatcode(t,n){this.catcodes[t]=n}lex(){var t=this.input,n=this.tokenRegex.lastIndex;if(n===t.length)return new Dn("EOF",new An(this,n,n));var r=this.tokenRegex.exec(t);if(r===null||r.index!==n)throw new re("Unexpected character: '"+t[n]+"'",new Dn(t[n],new An(this,n,n+1)));var i=r[6]||r[3]||(r[2]?"\\ ":" ");if(this.catcodes[i]===14){var a=t.indexOf(`
|
|
261
|
+
`,this.tokenRegex.lastIndex);return a===-1?(this.tokenRegex.lastIndex=t.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")):this.tokenRegex.lastIndex=a+1,this.lex()}return new Dn(i,new An(this,n,this.tokenRegex.lastIndex))}}class Op{constructor(t,n){t===void 0&&(t={}),n===void 0&&(n={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=n,this.builtins=t,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new re("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var t=this.undefStack.pop();for(var n in t)t.hasOwnProperty(n)&&(t[n]==null?delete this.current[n]:this.current[n]=t[n])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(t){return this.current.hasOwnProperty(t)||this.builtins.hasOwnProperty(t)}get(t){return this.current.hasOwnProperty(t)?this.current[t]:this.builtins[t]}set(t,n,r){if(r===void 0&&(r=!1),r){for(var i=0;i<this.undefStack.length;i++)delete this.undefStack[i][t];this.undefStack.length>0&&(this.undefStack[this.undefStack.length-1][t]=n)}else{var a=this.undefStack[this.undefStack.length-1];a&&!a.hasOwnProperty(t)&&(a[t]=this.current[t])}n==null?delete this.current[t]:this.current[t]=n}}var zp=Od;b("\\noexpand",function(e){var t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}});b("\\expandafter",function(e){var t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}});b("\\@firstoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[0],numArgs:0}});b("\\@secondoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[1],numArgs:0}});b("\\@ifnextchar",function(e){var t=e.consumeArgs(3);e.consumeSpaces();var n=e.future();return t[0].length===1&&t[0][0].text===n.text?{tokens:t[1],numArgs:0}:{tokens:t[2],numArgs:0}});b("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");b("\\TextOrMath",function(e){var t=e.consumeArgs(2);return e.mode==="text"?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}});var bc={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};b("\\char",function(e){var t=e.popToken(),n,r=0;if(t.text==="'")n=8,t=e.popToken();else if(t.text==='"')n=16,t=e.popToken();else if(t.text==="`")if(t=e.popToken(),t.text[0]==="\\")r=t.text.charCodeAt(1);else{if(t.text==="EOF")throw new re("\\char` missing argument");r=t.text.charCodeAt(0)}else n=10;if(n){if(r=bc[t.text],r==null||r>=n)throw new re("Invalid base-"+n+" digit "+t.text);for(var i;(i=bc[e.future().text])!=null&&i<n;)r*=n,r+=i,e.popToken()}return"\\@char{"+r+"}"});var j0=(e,t,n,r)=>{var i=e.consumeArg().tokens;if(i.length!==1)throw new re("\\newcommand's first argument must be a macro name");var a=i[0].text,s=e.isDefined(a);if(s&&!t)throw new re("\\newcommand{"+a+"} attempting to redefine "+(a+"; use \\renewcommand"));if(!s&&!n)throw new re("\\renewcommand{"+a+"} when command "+a+" does not yet exist; use \\newcommand");var o=0;if(i=e.consumeArg().tokens,i.length===1&&i[0].text==="["){for(var l="",d=e.expandNextToken();d.text!=="]"&&d.text!=="EOF";)l+=d.text,d=e.expandNextToken();if(!l.match(/^\s*[0-9]+\s*$/))throw new re("Invalid number of arguments: "+l);o=parseInt(l),i=e.consumeArg().tokens}return s&&r||e.macros.set(a,{tokens:i,numArgs:o}),""};b("\\newcommand",e=>j0(e,!1,!0,!1));b("\\renewcommand",e=>j0(e,!0,!1,!1));b("\\providecommand",e=>j0(e,!0,!0,!0));b("\\message",e=>{var t=e.consumeArgs(1)[0];return console.log(t.reverse().map(n=>n.text).join("")),""});b("\\errmessage",e=>{var t=e.consumeArgs(1)[0];return console.error(t.reverse().map(n=>n.text).join("")),""});b("\\show",e=>{var t=e.popToken(),n=t.text;return console.log(t,e.macros.get(n),Ur[n],Dt.math[n],Dt.text[n]),""});b("\\bgroup","{");b("\\egroup","}");b("~","\\nobreakspace");b("\\lq","`");b("\\rq","'");b("\\aa","\\r a");b("\\AA","\\r A");b("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");b("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");b("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");b("ℬ","\\mathscr{B}");b("ℰ","\\mathscr{E}");b("ℱ","\\mathscr{F}");b("ℋ","\\mathscr{H}");b("ℐ","\\mathscr{I}");b("ℒ","\\mathscr{L}");b("ℳ","\\mathscr{M}");b("ℛ","\\mathscr{R}");b("ℭ","\\mathfrak{C}");b("ℌ","\\mathfrak{H}");b("ℨ","\\mathfrak{Z}");b("\\Bbbk","\\Bbb{k}");b("\\llap","\\mathllap{\\textrm{#1}}");b("\\rlap","\\mathrlap{\\textrm{#1}}");b("\\clap","\\mathclap{\\textrm{#1}}");b("\\mathstrut","\\vphantom{(}");b("\\underbar","\\underline{\\text{#1}}");b("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}\\nobreak}{\\char"338}');b("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");b("\\ne","\\neq");b("≠","\\neq");b("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");b("∉","\\notin");b("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");b("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");b("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");b("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");b("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");b("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");b("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");b("⟂","\\perp");b("‼","\\mathclose{!\\mkern-0.8mu!}");b("∌","\\notni");b("⌜","\\ulcorner");b("⌝","\\urcorner");b("⌞","\\llcorner");b("⌟","\\lrcorner");b("©","\\copyright");b("®","\\textregistered");b("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');b("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');b("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');b("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');b("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");b("⋮","\\vdots");b("\\varGamma","\\mathit{\\Gamma}");b("\\varDelta","\\mathit{\\Delta}");b("\\varTheta","\\mathit{\\Theta}");b("\\varLambda","\\mathit{\\Lambda}");b("\\varXi","\\mathit{\\Xi}");b("\\varPi","\\mathit{\\Pi}");b("\\varSigma","\\mathit{\\Sigma}");b("\\varUpsilon","\\mathit{\\Upsilon}");b("\\varPhi","\\mathit{\\Phi}");b("\\varPsi","\\mathit{\\Psi}");b("\\varOmega","\\mathit{\\Omega}");b("\\substack","\\begin{subarray}{c}#1\\end{subarray}");b("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");b("\\boxed","\\fbox{$\\displaystyle{#1}$}");b("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");b("\\implies","\\DOTSB\\;\\Longrightarrow\\;");b("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");b("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");b("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var xc={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"},jp=new Set(["bin","rel"]);b("\\dots",function(e){var t="\\dotso",n=e.expandAfterFuture().text;return n in xc?t=xc[n]:(n.slice(0,4)==="\\not"||n in Dt.math&&jp.has(Dt.math[n].group))&&(t="\\dotsb"),t});var F0={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};b("\\dotso",function(e){var t=e.future().text;return t in F0?"\\ldots\\,":"\\ldots"});b("\\dotsc",function(e){var t=e.future().text;return t in F0&&t!==","?"\\ldots\\,":"\\ldots"});b("\\cdots",function(e){var t=e.future().text;return t in F0?"\\@cdots\\,":"\\@cdots"});b("\\dotsb","\\cdots");b("\\dotsm","\\cdots");b("\\dotsi","\\!\\cdots");b("\\dotsx","\\ldots\\,");b("\\DOTSI","\\relax");b("\\DOTSB","\\relax");b("\\DOTSX","\\relax");b("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");b("\\,","\\tmspace+{3mu}{.1667em}");b("\\thinspace","\\,");b("\\>","\\mskip{4mu}");b("\\:","\\tmspace+{4mu}{.2222em}");b("\\medspace","\\:");b("\\;","\\tmspace+{5mu}{.2777em}");b("\\thickspace","\\;");b("\\!","\\tmspace-{3mu}{.1667em}");b("\\negthinspace","\\!");b("\\negmedspace","\\tmspace-{4mu}{.2222em}");b("\\negthickspace","\\tmspace-{5mu}{.277em}");b("\\enspace","\\kern.5em ");b("\\enskip","\\hskip.5em\\relax");b("\\quad","\\hskip1em\\relax");b("\\qquad","\\hskip2em\\relax");b("\\tag","\\@ifstar\\tag@literal\\tag@paren");b("\\tag@paren","\\tag@literal{({#1})}");b("\\tag@literal",e=>{if(e.macros.get("\\df@tag"))throw new re("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});b("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");b("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");b("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");b("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");b("\\newline","\\\\\\relax");b("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var Xd=le(sr["Main-Regular"][84][1]-.7*sr["Main-Regular"][65][1]);b("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+Xd+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");b("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+Xd+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");b("\\hspace","\\@ifstar\\@hspacer\\@hspace");b("\\@hspace","\\hskip #1\\relax");b("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");b("\\ordinarycolon",":");b("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");b("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');b("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');b("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');b("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');b("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');b("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');b("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');b("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');b("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');b("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');b("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');b("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');b("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');b("∷","\\dblcolon");b("∹","\\eqcolon");b("≔","\\coloneqq");b("≕","\\eqqcolon");b("⩴","\\Coloneqq");b("\\ratio","\\vcentcolon");b("\\coloncolon","\\dblcolon");b("\\colonequals","\\coloneqq");b("\\coloncolonequals","\\Coloneqq");b("\\equalscolon","\\eqqcolon");b("\\equalscoloncolon","\\Eqqcolon");b("\\colonminus","\\coloneq");b("\\coloncolonminus","\\Coloneq");b("\\minuscolon","\\eqcolon");b("\\minuscoloncolon","\\Eqcolon");b("\\coloncolonapprox","\\Colonapprox");b("\\coloncolonsim","\\Colonsim");b("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");b("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");b("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");b("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");b("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");b("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");b("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");b("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");b("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");b("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");b("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");b("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");b("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");b("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");b("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");b("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");b("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");b("\\nleqq","\\html@mathml{\\@nleqq}{≰}");b("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");b("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");b("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");b("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");b("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");b("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");b("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");b("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");b("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");b("\\imath","\\html@mathml{\\@imath}{ı}");b("\\jmath","\\html@mathml{\\@jmath}{ȷ}");b("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");b("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");b("⟦","\\llbracket");b("⟧","\\rrbracket");b("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");b("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");b("⦃","\\lBrace");b("⦄","\\rBrace");b("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");b("⦵","\\minuso");b("\\darr","\\downarrow");b("\\dArr","\\Downarrow");b("\\Darr","\\Downarrow");b("\\lang","\\langle");b("\\rang","\\rangle");b("\\uarr","\\uparrow");b("\\uArr","\\Uparrow");b("\\Uarr","\\Uparrow");b("\\N","\\mathbb{N}");b("\\R","\\mathbb{R}");b("\\Z","\\mathbb{Z}");b("\\alef","\\aleph");b("\\alefsym","\\aleph");b("\\Alpha","\\mathrm{A}");b("\\Beta","\\mathrm{B}");b("\\bull","\\bullet");b("\\Chi","\\mathrm{X}");b("\\clubs","\\clubsuit");b("\\cnums","\\mathbb{C}");b("\\Complex","\\mathbb{C}");b("\\Dagger","\\ddagger");b("\\diamonds","\\diamondsuit");b("\\empty","\\emptyset");b("\\Epsilon","\\mathrm{E}");b("\\Eta","\\mathrm{H}");b("\\exist","\\exists");b("\\harr","\\leftrightarrow");b("\\hArr","\\Leftrightarrow");b("\\Harr","\\Leftrightarrow");b("\\hearts","\\heartsuit");b("\\image","\\Im");b("\\infin","\\infty");b("\\Iota","\\mathrm{I}");b("\\isin","\\in");b("\\Kappa","\\mathrm{K}");b("\\larr","\\leftarrow");b("\\lArr","\\Leftarrow");b("\\Larr","\\Leftarrow");b("\\lrarr","\\leftrightarrow");b("\\lrArr","\\Leftrightarrow");b("\\Lrarr","\\Leftrightarrow");b("\\Mu","\\mathrm{M}");b("\\natnums","\\mathbb{N}");b("\\Nu","\\mathrm{N}");b("\\Omicron","\\mathrm{O}");b("\\plusmn","\\pm");b("\\rarr","\\rightarrow");b("\\rArr","\\Rightarrow");b("\\Rarr","\\Rightarrow");b("\\real","\\Re");b("\\reals","\\mathbb{R}");b("\\Reals","\\mathbb{R}");b("\\Rho","\\mathrm{P}");b("\\sdot","\\cdot");b("\\sect","\\S");b("\\spades","\\spadesuit");b("\\sub","\\subset");b("\\sube","\\subseteq");b("\\supe","\\supseteq");b("\\Tau","\\mathrm{T}");b("\\thetasym","\\vartheta");b("\\weierp","\\wp");b("\\Zeta","\\mathrm{Z}");b("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");b("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");b("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");b("\\bra","\\mathinner{\\langle{#1}|}");b("\\ket","\\mathinner{|{#1}\\rangle}");b("\\braket","\\mathinner{\\langle{#1}\\rangle}");b("\\Bra","\\left\\langle#1\\right|");b("\\Ket","\\left|#1\\right\\rangle");var Vd=e=>t=>{var n=t.consumeArg().tokens,r=t.consumeArg().tokens,i=t.consumeArg().tokens,a=t.consumeArg().tokens,s=t.macros.get("|"),o=t.macros.get("\\|");t.macros.beginGroup();var l=f=>g=>{e&&(g.macros.set("|",s),i.length&&g.macros.set("\\|",o));var y=f;if(!f&&i.length){var x=g.future();x.text==="|"&&(g.popToken(),y=!0)}return{tokens:y?i:r,numArgs:0}};t.macros.set("|",l(!1)),i.length&&t.macros.set("\\|",l(!0));var d=t.consumeArg().tokens,c=t.expandTokens([...a,...d,...n]);return t.macros.endGroup(),{tokens:c.reverse(),numArgs:0}};b("\\bra@ket",Vd(!1));b("\\bra@set",Vd(!0));b("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");b("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");b("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");b("\\angln","{\\angl n}");b("\\blue","\\textcolor{##6495ed}{#1}");b("\\orange","\\textcolor{##ffa500}{#1}");b("\\pink","\\textcolor{##ff00af}{#1}");b("\\red","\\textcolor{##df0030}{#1}");b("\\green","\\textcolor{##28ae7b}{#1}");b("\\gray","\\textcolor{gray}{#1}");b("\\purple","\\textcolor{##9d38bd}{#1}");b("\\blueA","\\textcolor{##ccfaff}{#1}");b("\\blueB","\\textcolor{##80f6ff}{#1}");b("\\blueC","\\textcolor{##63d9ea}{#1}");b("\\blueD","\\textcolor{##11accd}{#1}");b("\\blueE","\\textcolor{##0c7f99}{#1}");b("\\tealA","\\textcolor{##94fff5}{#1}");b("\\tealB","\\textcolor{##26edd5}{#1}");b("\\tealC","\\textcolor{##01d1c1}{#1}");b("\\tealD","\\textcolor{##01a995}{#1}");b("\\tealE","\\textcolor{##208170}{#1}");b("\\greenA","\\textcolor{##b6ffb0}{#1}");b("\\greenB","\\textcolor{##8af281}{#1}");b("\\greenC","\\textcolor{##74cf70}{#1}");b("\\greenD","\\textcolor{##1fab54}{#1}");b("\\greenE","\\textcolor{##0d923f}{#1}");b("\\goldA","\\textcolor{##ffd0a9}{#1}");b("\\goldB","\\textcolor{##ffbb71}{#1}");b("\\goldC","\\textcolor{##ff9c39}{#1}");b("\\goldD","\\textcolor{##e07d10}{#1}");b("\\goldE","\\textcolor{##a75a05}{#1}");b("\\redA","\\textcolor{##fca9a9}{#1}");b("\\redB","\\textcolor{##ff8482}{#1}");b("\\redC","\\textcolor{##f9685d}{#1}");b("\\redD","\\textcolor{##e84d39}{#1}");b("\\redE","\\textcolor{##bc2612}{#1}");b("\\maroonA","\\textcolor{##ffbde0}{#1}");b("\\maroonB","\\textcolor{##ff92c6}{#1}");b("\\maroonC","\\textcolor{##ed5fa6}{#1}");b("\\maroonD","\\textcolor{##ca337c}{#1}");b("\\maroonE","\\textcolor{##9e034e}{#1}");b("\\purpleA","\\textcolor{##ddd7ff}{#1}");b("\\purpleB","\\textcolor{##c6b9fc}{#1}");b("\\purpleC","\\textcolor{##aa87ff}{#1}");b("\\purpleD","\\textcolor{##7854ab}{#1}");b("\\purpleE","\\textcolor{##543b78}{#1}");b("\\mintA","\\textcolor{##f5f9e8}{#1}");b("\\mintB","\\textcolor{##edf2df}{#1}");b("\\mintC","\\textcolor{##e0e5cc}{#1}");b("\\grayA","\\textcolor{##f6f7f7}{#1}");b("\\grayB","\\textcolor{##f0f1f2}{#1}");b("\\grayC","\\textcolor{##e3e5e6}{#1}");b("\\grayD","\\textcolor{##d6d8da}{#1}");b("\\grayE","\\textcolor{##babec2}{#1}");b("\\grayF","\\textcolor{##888d93}{#1}");b("\\grayG","\\textcolor{##626569}{#1}");b("\\grayH","\\textcolor{##3b3e40}{#1}");b("\\grayI","\\textcolor{##21242c}{#1}");b("\\kaBlue","\\textcolor{##314453}{#1}");b("\\kaGreen","\\textcolor{##71B307}{#1}");var Yd={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class Fp{constructor(t,n,r){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=n,this.expansionCount=0,this.feed(t),this.macros=new Op(zp,n.macros),this.mode=r,this.stack=[]}feed(t){this.lexer=new yc(t,this.settings)}switchMode(t){this.mode=t}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(t){this.stack.push(t)}pushTokens(t){this.stack.push(...t)}scanArgument(t){var n,r,i;if(t){if(this.consumeSpaces(),this.future().text!=="[")return null;n=this.popToken(),{tokens:i,end:r}=this.consumeArg(["]"])}else({tokens:i,start:n,end:r}=this.consumeArg());return this.pushToken(new Dn("EOF",r.loc)),this.pushTokens(i),new Dn("",An.range(n,r))}consumeSpaces(){for(;;){var t=this.future();if(t.text===" ")this.stack.pop();else break}}consumeArg(t){var n=[],r=t&&t.length>0;r||this.consumeSpaces();var i=this.future(),a,s=0,o=0;do{if(a=this.popToken(),n.push(a),a.text==="{")++s;else if(a.text==="}"){if(--s,s===-1)throw new re("Extra }",a)}else if(a.text==="EOF")throw new re("Unexpected end of input in a macro argument, expected '"+(t&&r?t[o]:"}")+"'",a);if(t&&r)if((s===0||s===1&&t[o]==="{")&&a.text===t[o]){if(++o,o===t.length){n.splice(-o,o);break}}else o=0}while(s!==0||r);return i.text==="{"&&n[n.length-1].text==="}"&&(n.pop(),n.shift()),n.reverse(),{tokens:n,start:i,end:a}}consumeArgs(t,n){if(n){if(n.length!==t+1)throw new re("The length of delimiters doesn't match the number of args!");for(var r=n[0],i=0;i<r.length;i++){var a=this.popToken();if(r[i]!==a.text)throw new re("Use of the macro doesn't match its definition",a)}}for(var s=[],o=0;o<t;o++)s.push(this.consumeArg(n&&n[o+1]).tokens);return s}countExpansion(t){if(this.expansionCount+=t,this.expansionCount>this.settings.maxExpand)throw new re("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(t){var n=this.popToken(),r=n.text,i=n.noexpand?null:this._getExpansion(r);if(i==null||t&&i.unexpandable){if(t&&i==null&&r[0]==="\\"&&!this.isDefined(r))throw new re("Undefined control sequence: "+r);return this.pushToken(n),!1}this.countExpansion(1);var a=i.tokens,s=this.consumeArgs(i.numArgs,i.delimiters);if(i.numArgs){a=a.slice();for(var o=a.length-1;o>=0;--o){var l=a[o];if(l.text==="#"){if(o===0)throw new re("Incomplete placeholder at end of macro body",l);if(l=a[--o],l.text==="#")a.splice(o+1,1);else if(/^[1-9]$/.test(l.text))a.splice(o,2,...s[+l.text-1]);else throw new re("Not a valid argument number",l)}}}return this.pushTokens(a),a.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var t=this.stack.pop();return t.treatAsRelax&&(t.text="\\relax"),t}}expandMacro(t){return this.macros.has(t)?this.expandTokens([new Dn(t)]):void 0}expandTokens(t){var n=[],r=this.stack.length;for(this.pushTokens(t);this.stack.length>r;)if(this.expandOnce(!0)===!1){var i=this.stack.pop();i.treatAsRelax&&(i.noexpand=!1,i.treatAsRelax=!1),n.push(i)}return this.countExpansion(n.length),n}expandMacroAsText(t){var n=this.expandMacro(t);return n&&n.map(r=>r.text).join("")}_getExpansion(t){var n=this.macros.get(t);if(n==null)return n;if(t.length===1){var r=this.lexer.catcodes[t];if(r!=null&&r!==13)return}var i=typeof n=="function"?n(this):n;if(typeof i=="string"){var a=0;if(i.includes("#"))for(var s=i.replace(/##/g,"");s.includes("#"+(a+1));)++a;for(var o=new yc(i,this.settings),l=[],d=o.lex();d.text!=="EOF";)l.push(d),d=o.lex();l.reverse();var c={tokens:l,numArgs:a};return c}return i}isDefined(t){return this.macros.has(t)||Ur.hasOwnProperty(t)||Dt.math.hasOwnProperty(t)||Dt.text.hasOwnProperty(t)||Yd.hasOwnProperty(t)}isExpandable(t){var n=this.macros.get(t);return n!=null?typeof n=="string"||typeof n=="function"||!n.unexpandable:Ur.hasOwnProperty(t)&&!Ur[t].primitive}}var wc=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,Ua=Object.freeze({"₊":"+","₋":"-","₌":"=","₍":"(","₎":")","₀":"0","₁":"1","₂":"2","₃":"3","₄":"4","₅":"5","₆":"6","₇":"7","₈":"8","₉":"9","ₐ":"a","ₑ":"e","ₕ":"h","ᵢ":"i","ⱼ":"j","ₖ":"k","ₗ":"l","ₘ":"m","ₙ":"n","ₒ":"o","ₚ":"p","ᵣ":"r","ₛ":"s","ₜ":"t","ᵤ":"u","ᵥ":"v","ₓ":"x","ᵦ":"β","ᵧ":"γ","ᵨ":"ρ","ᵩ":"ϕ","ᵪ":"χ","⁺":"+","⁻":"-","⁼":"=","⁽":"(","⁾":")","⁰":"0","¹":"1","²":"2","³":"3","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9","ᴬ":"A","ᴮ":"B","ᴰ":"D","ᴱ":"E","ᴳ":"G","ᴴ":"H","ᴵ":"I","ᴶ":"J","ᴷ":"K","ᴸ":"L","ᴹ":"M","ᴺ":"N","ᴼ":"O","ᴾ":"P","ᴿ":"R","ᵀ":"T","ᵁ":"U","ⱽ":"V","ᵂ":"W","ᵃ":"a","ᵇ":"b","ᶜ":"c","ᵈ":"d","ᵉ":"e","ᶠ":"f","ᵍ":"g",ʰ:"h","ⁱ":"i",ʲ:"j","ᵏ":"k",ˡ:"l","ᵐ":"m",ⁿ:"n","ᵒ":"o","ᵖ":"p",ʳ:"r",ˢ:"s","ᵗ":"t","ᵘ":"u","ᵛ":"v",ʷ:"w",ˣ:"x",ʸ:"y","ᶻ":"z","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),wo={"́":{text:"\\'",math:"\\acute"},"̀":{text:"\\`",math:"\\grave"},"̈":{text:'\\"',math:"\\ddot"},"̃":{text:"\\~",math:"\\tilde"},"̄":{text:"\\=",math:"\\bar"},"̆":{text:"\\u",math:"\\breve"},"̌":{text:"\\v",math:"\\check"},"̂":{text:"\\^",math:"\\hat"},"̇":{text:"\\.",math:"\\dot"},"̊":{text:"\\r",math:"\\mathring"},"̋":{text:"\\H"},"̧":{text:"\\c"}},kc={á:"á",à:"à",ä:"ä",ǟ:"ǟ",ã:"ã",ā:"ā",ă:"ă",ắ:"ắ",ằ:"ằ",ẵ:"ẵ",ǎ:"ǎ",â:"â",ấ:"ấ",ầ:"ầ",ẫ:"ẫ",ȧ:"ȧ",ǡ:"ǡ",å:"å",ǻ:"ǻ",ḃ:"ḃ",ć:"ć",ḉ:"ḉ",č:"č",ĉ:"ĉ",ċ:"ċ",ç:"ç",ď:"ď",ḋ:"ḋ",ḑ:"ḑ",é:"é",è:"è",ë:"ë",ẽ:"ẽ",ē:"ē",ḗ:"ḗ",ḕ:"ḕ",ĕ:"ĕ",ḝ:"ḝ",ě:"ě",ê:"ê",ế:"ế",ề:"ề",ễ:"ễ",ė:"ė",ȩ:"ȩ",ḟ:"ḟ",ǵ:"ǵ",ḡ:"ḡ",ğ:"ğ",ǧ:"ǧ",ĝ:"ĝ",ġ:"ġ",ģ:"ģ",ḧ:"ḧ",ȟ:"ȟ",ĥ:"ĥ",ḣ:"ḣ",ḩ:"ḩ",í:"í",ì:"ì",ï:"ï",ḯ:"ḯ",ĩ:"ĩ",ī:"ī",ĭ:"ĭ",ǐ:"ǐ",î:"î",ǰ:"ǰ",ĵ:"ĵ",ḱ:"ḱ",ǩ:"ǩ",ķ:"ķ",ĺ:"ĺ",ľ:"ľ",ļ:"ļ",ḿ:"ḿ",ṁ:"ṁ",ń:"ń",ǹ:"ǹ",ñ:"ñ",ň:"ň",ṅ:"ṅ",ņ:"ņ",ó:"ó",ò:"ò",ö:"ö",ȫ:"ȫ",õ:"õ",ṍ:"ṍ",ṏ:"ṏ",ȭ:"ȭ",ō:"ō",ṓ:"ṓ",ṑ:"ṑ",ŏ:"ŏ",ǒ:"ǒ",ô:"ô",ố:"ố",ồ:"ồ",ỗ:"ỗ",ȯ:"ȯ",ȱ:"ȱ",ő:"ő",ṕ:"ṕ",ṗ:"ṗ",ŕ:"ŕ",ř:"ř",ṙ:"ṙ",ŗ:"ŗ",ś:"ś",ṥ:"ṥ",š:"š",ṧ:"ṧ",ŝ:"ŝ",ṡ:"ṡ",ş:"ş",ẗ:"ẗ",ť:"ť",ṫ:"ṫ",ţ:"ţ",ú:"ú",ù:"ù",ü:"ü",ǘ:"ǘ",ǜ:"ǜ",ǖ:"ǖ",ǚ:"ǚ",ũ:"ũ",ṹ:"ṹ",ū:"ū",ṻ:"ṻ",ŭ:"ŭ",ǔ:"ǔ",û:"û",ů:"ů",ű:"ű",ṽ:"ṽ",ẃ:"ẃ",ẁ:"ẁ",ẅ:"ẅ",ŵ:"ŵ",ẇ:"ẇ",ẘ:"ẘ",ẍ:"ẍ",ẋ:"ẋ",ý:"ý",ỳ:"ỳ",ÿ:"ÿ",ỹ:"ỹ",ȳ:"ȳ",ŷ:"ŷ",ẏ:"ẏ",ẙ:"ẙ",ź:"ź",ž:"ž",ẑ:"ẑ",ż:"ż",Á:"Á",À:"À",Ä:"Ä",Ǟ:"Ǟ",Ã:"Ã",Ā:"Ā",Ă:"Ă",Ắ:"Ắ",Ằ:"Ằ",Ẵ:"Ẵ",Ǎ:"Ǎ",Â:"Â",Ấ:"Ấ",Ầ:"Ầ",Ẫ:"Ẫ",Ȧ:"Ȧ",Ǡ:"Ǡ",Å:"Å",Ǻ:"Ǻ",Ḃ:"Ḃ",Ć:"Ć",Ḉ:"Ḉ",Č:"Č",Ĉ:"Ĉ",Ċ:"Ċ",Ç:"Ç",Ď:"Ď",Ḋ:"Ḋ",Ḑ:"Ḑ",É:"É",È:"È",Ë:"Ë",Ẽ:"Ẽ",Ē:"Ē",Ḗ:"Ḗ",Ḕ:"Ḕ",Ĕ:"Ĕ",Ḝ:"Ḝ",Ě:"Ě",Ê:"Ê",Ế:"Ế",Ề:"Ề",Ễ:"Ễ",Ė:"Ė",Ȩ:"Ȩ",Ḟ:"Ḟ",Ǵ:"Ǵ",Ḡ:"Ḡ",Ğ:"Ğ",Ǧ:"Ǧ",Ĝ:"Ĝ",Ġ:"Ġ",Ģ:"Ģ",Ḧ:"Ḧ",Ȟ:"Ȟ",Ĥ:"Ĥ",Ḣ:"Ḣ",Ḩ:"Ḩ",Í:"Í",Ì:"Ì",Ï:"Ï",Ḯ:"Ḯ",Ĩ:"Ĩ",Ī:"Ī",Ĭ:"Ĭ",Ǐ:"Ǐ",Î:"Î",İ:"İ",Ĵ:"Ĵ",Ḱ:"Ḱ",Ǩ:"Ǩ",Ķ:"Ķ",Ĺ:"Ĺ",Ľ:"Ľ",Ļ:"Ļ",Ḿ:"Ḿ",Ṁ:"Ṁ",Ń:"Ń",Ǹ:"Ǹ",Ñ:"Ñ",Ň:"Ň",Ṅ:"Ṅ",Ņ:"Ņ",Ó:"Ó",Ò:"Ò",Ö:"Ö",Ȫ:"Ȫ",Õ:"Õ",Ṍ:"Ṍ",Ṏ:"Ṏ",Ȭ:"Ȭ",Ō:"Ō",Ṓ:"Ṓ",Ṑ:"Ṑ",Ŏ:"Ŏ",Ǒ:"Ǒ",Ô:"Ô",Ố:"Ố",Ồ:"Ồ",Ỗ:"Ỗ",Ȯ:"Ȯ",Ȱ:"Ȱ",Ő:"Ő",Ṕ:"Ṕ",Ṗ:"Ṗ",Ŕ:"Ŕ",Ř:"Ř",Ṙ:"Ṙ",Ŗ:"Ŗ",Ś:"Ś",Ṥ:"Ṥ",Š:"Š",Ṧ:"Ṧ",Ŝ:"Ŝ",Ṡ:"Ṡ",Ş:"Ş",Ť:"Ť",Ṫ:"Ṫ",Ţ:"Ţ",Ú:"Ú",Ù:"Ù",Ü:"Ü",Ǘ:"Ǘ",Ǜ:"Ǜ",Ǖ:"Ǖ",Ǚ:"Ǚ",Ũ:"Ũ",Ṹ:"Ṹ",Ū:"Ū",Ṻ:"Ṻ",Ŭ:"Ŭ",Ǔ:"Ǔ",Û:"Û",Ů:"Ů",Ű:"Ű",Ṽ:"Ṽ",Ẃ:"Ẃ",Ẁ:"Ẁ",Ẅ:"Ẅ",Ŵ:"Ŵ",Ẇ:"Ẇ",Ẍ:"Ẍ",Ẋ:"Ẋ",Ý:"Ý",Ỳ:"Ỳ",Ÿ:"Ÿ",Ỹ:"Ỹ",Ȳ:"Ȳ",Ŷ:"Ŷ",Ẏ:"Ẏ",Ź:"Ź",Ž:"Ž",Ẑ:"Ẑ",Ż:"Ż",ά:"ά",ὰ:"ὰ",ᾱ:"ᾱ",ᾰ:"ᾰ",έ:"έ",ὲ:"ὲ",ή:"ή",ὴ:"ὴ",ί:"ί",ὶ:"ὶ",ϊ:"ϊ",ΐ:"ΐ",ῒ:"ῒ",ῑ:"ῑ",ῐ:"ῐ",ό:"ό",ὸ:"ὸ",ύ:"ύ",ὺ:"ὺ",ϋ:"ϋ",ΰ:"ΰ",ῢ:"ῢ",ῡ:"ῡ",ῠ:"ῠ",ώ:"ώ",ὼ:"ὼ",Ύ:"Ύ",Ὺ:"Ὺ",Ϋ:"Ϋ",Ῡ:"Ῡ",Ῠ:"Ῠ",Ώ:"Ώ",Ὼ:"Ὼ"};class Hs{constructor(t,n){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new Fp(t,n,this.mode),this.settings=n,this.leftrightDepth=0,this.nextToken=null}expect(t,n){if(n===void 0&&(n=!0),this.fetch().text!==t)throw new re("Expected '"+t+"', got '"+this.fetch().text+"'",this.fetch());n&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(t){this.mode=t,this.gullet.switchMode(t)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var t=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),t}finally{this.gullet.endGroups()}}subparse(t){var n=this.nextToken;this.consume(),this.gullet.pushToken(new Dn("}")),this.gullet.pushTokens(t);var r=this.parseExpression(!1);return this.expect("}"),this.nextToken=n,r}parseExpression(t,n){for(var r=[];;){this.mode==="math"&&this.consumeSpaces();var i=this.fetch();if(Hs.endOfExpression.has(i.text)||n&&i.text===n||t&&Ur[i.text]&&Ur[i.text].infix)break;var a=this.parseAtom(n);if(a){if(a.type==="internal")continue}else break;r.push(a)}return this.mode==="text"&&this.formLigatures(r),this.handleInfixNodes(r)}handleInfixNodes(t){for(var n=-1,r,i=0;i<t.length;i++){var a=t[i];if(a.type==="infix"){if(n!==-1)throw new re("only one infix operator per group",a.token);n=i,r=a.replaceWith}}if(n!==-1&&r){var s,o,l=t.slice(0,n),d=t.slice(n+1);l.length===1&&l[0].type==="ordgroup"?s=l[0]:s={type:"ordgroup",mode:this.mode,body:l},d.length===1&&d[0].type==="ordgroup"?o=d[0]:o={type:"ordgroup",mode:this.mode,body:d};var c;return r==="\\\\abovefrac"?c=this.callFunction(r,[s,t[n],o],[]):c=this.callFunction(r,[s,o],[]),[c]}else return t}handleSupSubscript(t){var n=this.fetch(),r=n.text;this.consume(),this.consumeSpaces();var i;do{var a;i=this.parseGroup(t)}while(((a=i)==null?void 0:a.type)==="internal");if(!i)throw new re("Expected group after '"+r+"'",n);return i}formatUnsupportedCmd(t){for(var n=[],r=0;r<t.length;r++)n.push({type:"textord",mode:"text",text:t[r]});var i={type:"text",mode:this.mode,body:n},a={type:"color",mode:this.mode,color:this.settings.errorColor,body:[i]};return a}parseAtom(t){var n=this.parseGroup("atom",t);if(n?.type==="internal"||this.mode==="text")return n;for(var r,i;;){this.consumeSpaces();var a=this.fetch();if(a.text==="\\limits"||a.text==="\\nolimits"){if(n&&n.type==="op")n.limits=a.text==="\\limits",n.alwaysHandleSupSub=!0;else if(n&&n.type==="operatorname")n.alwaysHandleSupSub&&(n.limits=a.text==="\\limits");else throw new re("Limit controls must follow a math operator",a);this.consume()}else if(a.text==="^"){if(r)throw new re("Double superscript",a);r=this.handleSupSubscript("superscript")}else if(a.text==="_"){if(i)throw new re("Double subscript",a);i=this.handleSupSubscript("subscript")}else if(a.text==="'"){if(r)throw new re("Double superscript",a);var s={type:"textord",mode:this.mode,text:"\\prime"},o=[s];for(this.consume();this.fetch().text==="'";)o.push(s),this.consume();this.fetch().text==="^"&&o.push(this.handleSupSubscript("superscript")),r={type:"ordgroup",mode:this.mode,body:o}}else if(Ua[a.text]){var l=wc.test(a.text),d=[];for(d.push(new Dn(Ua[a.text])),this.consume();;){var c=this.fetch().text;if(!Ua[c]||wc.test(c)!==l)break;d.unshift(new Dn(Ua[c])),this.consume()}var f=this.subparse(d);l?i={type:"ordgroup",mode:"math",body:f}:r={type:"ordgroup",mode:"math",body:f}}else break}return r&&i?{type:"supsub",mode:this.mode,base:n,sup:r,sub:i}:r?{type:"supsub",mode:this.mode,base:n,sup:r}:i?{type:"supsub",mode:this.mode,base:n,sub:i}:n}parseFunction(t,n){var r=this.fetch(),i=r.text,a=Ur[i];if(!a)return null;if(this.consume(),n&&n!=="atom"&&!a.allowedInArgument)throw new re("Got function '"+i+"' with no arguments"+(n?" as "+n:""),r);if(this.mode==="text"&&!a.allowedInText)throw new re("Can't use function '"+i+"' in text mode",r);if(this.mode==="math"&&a.allowedInMath===!1)throw new re("Can't use function '"+i+"' in math mode",r);var{args:s,optArgs:o}=this.parseArguments(i,a);return this.callFunction(i,s,o,r,t)}callFunction(t,n,r,i,a){var s={funcName:t,parser:this,token:i,breakOnTokenText:a},o=Ur[t];if(o&&o.handler)return o.handler(s,n,r);throw new re("No function handler for "+t)}parseArguments(t,n){var r,i=(r=n.numOptionalArgs)!=null?r:0,a=n.numArgs+i;if(a===0)return{args:[],optArgs:[]};for(var s=[],o=[],l=0;l<a;l++){var d,c=(d=n.argTypes)==null?void 0:d[l],f=l<i;("primitive"in n&&n.primitive&&c==null||n.type==="sqrt"&&l===1&&o[0]==null)&&(c="primitive");var g=this.parseGroupOfType("argument to '"+t+"'",c,f);if(f)o.push(g);else if(g!=null)s.push(g);else throw new re("Null argument, please report this as a bug")}return{args:s,optArgs:o}}parseGroupOfType(t,n,r){switch(n){case"color":return this.parseColorGroup(r);case"size":return this.parseSizeGroup(r);case"url":return this.parseUrlGroup(r);case"math":case"text":return this.parseArgumentGroup(r,n);case"hbox":{var i=this.parseArgumentGroup(r,"text");return i!=null?{type:"styling",mode:i.mode,body:[i],style:"text",resetFont:!0}:null}case"raw":{var a=this.parseStringGroup(r);return a!=null?{type:"raw",mode:"text",string:a.text}:null}case"primitive":{if(r)throw new re("A primitive argument cannot be optional");var s=this.parseGroup(t);if(s==null)throw new re("Expected group as "+t,this.fetch());return s}case"original":case void 0:return this.parseArgumentGroup(r);default:throw new re("Unknown group type as "+t,this.fetch())}}consumeSpaces(){for(;this.fetch().text===" ";)this.consume()}parseStringGroup(t){var n=this.gullet.scanArgument(t);if(n==null)return null;for(var r="",i;(i=this.fetch()).text!=="EOF";)r+=i.text,this.consume();return this.consume(),n.text=r,n}parseRegexGroup(t,n){for(var r=this.fetch(),i=r,a="",s;(s=this.fetch()).text!=="EOF"&&t.test(a+s.text);)i=s,a+=i.text,this.consume();if(a==="")throw new re("Invalid "+n+": '"+r.text+"'",r);return r.range(i,a)}parseColorGroup(t){var n=this.parseStringGroup(t);if(n==null)return null;var r=/^(#[a-f0-9]{3,4}|#[a-f0-9]{6}|#[a-f0-9]{8}|[a-f0-9]{6}|[a-z]+)$/i.exec(n.text);if(!r)throw new re("Invalid color: '"+n.text+"'",n);var i=r[0];return/^[0-9a-f]{6}$/i.test(i)&&(i="#"+i),{type:"color-token",mode:this.mode,color:i}}parseSizeGroup(t){var n,r=!1;if(this.gullet.consumeSpaces(),!t&&this.gullet.future().text!=="{"?n=this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size"):n=this.parseStringGroup(t),!n)return null;!t&&n.text.length===0&&(n.text="0pt",r=!0);var i=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(n.text);if(!i)throw new re("Invalid size: '"+n.text+"'",n);var a={number:+(i[1]+i[2]),unit:i[3]};if(!ld(a))throw new re("Invalid unit: '"+a.unit+"'",n);return{type:"size",mode:this.mode,value:a,isBlank:r}}parseUrlGroup(t){this.gullet.lexer.setCatcode("%",13),this.gullet.lexer.setCatcode("~",12);var n=this.parseStringGroup(t);if(this.gullet.lexer.setCatcode("%",14),this.gullet.lexer.setCatcode("~",13),n==null)return null;var r=n.text.replace(/\\([#$%&~_^{}])/g,"$1");return{type:"url",mode:this.mode,url:r}}parseArgumentGroup(t,n){var r=this.gullet.scanArgument(t);if(r==null)return null;var i=this.mode;n&&this.switchMode(n),this.gullet.beginGroup();var a=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();var s={type:"ordgroup",mode:this.mode,loc:r.loc,body:a};return n&&this.switchMode(i),s}parseGroup(t,n){var r=this.fetch(),i=r.text,a;if(i==="{"||i==="\\begingroup"){this.consume();var s=i==="{"?"}":"\\endgroup";this.gullet.beginGroup();var o=this.parseExpression(!1,s),l=this.fetch();this.expect(s),this.gullet.endGroup(),a={type:"ordgroup",mode:this.mode,loc:An.range(r,l),body:o,semisimple:i==="\\begingroup"||void 0}}else if(a=this.parseFunction(n,t)||this.parseSymbol(),a==null&&i[0]==="\\"&&!Yd.hasOwnProperty(i)){if(this.settings.throwOnError)throw new re("Undefined control sequence: "+i,r);a=this.formatUnsupportedCmd(i),this.consume()}return a}formLigatures(t){for(var n=t.length-1,r=0;r<n;++r){var i=t[r];if(i.type==="textord"){var a=i.text,s=t[r+1];if(!(!s||s.type!=="textord")){if(a==="-"&&s.text==="-"){var o=t[r+2];r+1<n&&o&&o.type==="textord"&&o.text==="-"?(t.splice(r,3,{type:"textord",mode:"text",loc:An.range(i,o),text:"---"}),n-=2):(t.splice(r,2,{type:"textord",mode:"text",loc:An.range(i,s),text:"--"}),n-=1)}(a==="'"||a==="`")&&s.text===a&&(t.splice(r,2,{type:"textord",mode:"text",loc:An.range(i,s),text:a+a}),n-=1)}}}}parseSymbol(){var t=this.fetch(),n=t.text;if(/^\\verb[^a-zA-Z]/.test(n)){this.consume();var r=n.slice(5),i=r.charAt(0)==="*";if(i&&(r=r.slice(1)),r.length<2||r.charAt(0)!==r.slice(-1))throw new re(`\\verb assertion failed --
|
|
262
|
+
please report what input caused this bug`);return r=r.slice(1,-1),{type:"verb",mode:"text",body:r,star:i}}kc.hasOwnProperty(n[0])&&!Dt[this.mode][n[0]]&&(this.settings.strict&&this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Accented Unicode text character "'+n[0]+'" used in math mode',t),n=kc[n[0]]+n.slice(1));var a=Dp.exec(n);a&&(n=n.substring(0,a.index),n==="i"?n="ı":n==="j"&&(n="ȷ"));var s;if(Dt[this.mode][n]){this.settings.strict&&this.mode==="math"&&Ko.includes(n)&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+n[0]+'" used in math mode',t);var o=Dt[this.mode][n].group,l=An.range(t),d;Wm(o)?d={type:"atom",mode:this.mode,family:o,loc:l,text:n}:d={type:o,mode:this.mode,loc:l,text:n},s=d}else if(n.charCodeAt(0)>=128)this.settings.strict&&(od(n.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+n[0]+'" used in math mode',t):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+n[0]+'"'+(" ("+n.charCodeAt(0)+")"),t)),s={type:"textord",mode:"text",loc:An.range(t),text:n};else return null;if(this.consume(),a)for(var c=0;c<a[0].length;c++){var f=a[0][c];if(!wo[f])throw new re("Unknown accent ' "+f+"'",t);var g=wo[f][this.mode]||wo[f].text;if(!g)throw new re("Accent "+f+" unsupported in "+this.mode+" mode",t);s={type:"accent",mode:this.mode,loc:An.range(t),label:g,isStretchy:!1,isShifty:!0,base:s}}return s}}Hs.endOfExpression=new Set(["}","\\endgroup","\\end","\\right","&"]);var _0=function(t,n){if(!(typeof t=="string"||t instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var r=new Hs(t,n);delete r.gullet.macros.current["\\df@tag"];var i=r.parse();if(delete r.gullet.macros.current["\\current@color"],delete r.gullet.macros.current["\\color"],r.gullet.macros.get("\\df@tag")){if(!n.displayMode)throw new re("\\tag works only in display equations");i=[{type:"tag",mode:"text",body:i,tag:r.subparse([new Dn("\\df@tag")])}]}return i},Kd=function(t,n,r){n.textContent="";var i=$0(t,r).toNode();n.appendChild(i)};typeof document<"u"&&document.compatMode!=="CSS1Compat"&&(typeof console<"u"&&console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype."),Kd=function(){throw new re("KaTeX doesn't work in quirks mode.")});var _p=function(t,n){var r=$0(t,n).toMarkup();return r},$p=function(t,n){var r=new C0(n);return _0(t,r)},Zd=function(t,n,r){if(r.throwOnError||!(t instanceof re))throw t;var i=J(["katex-error"],[new Bn(n)]);return i.setAttribute("title",t.toString()),i.setAttribute("style","color:"+r.errorColor),i},$0=function(t,n){var r=new C0(n);try{var i=_0(t,r);return zm(i,t,r)}catch(a){return Zd(a,t,r)}},Hp=function(t,n){var r=new C0(n);try{var i=_0(t,r);return jm(i,t,r)}catch(a){return Zd(a,t,r)}},qp="0.17.0",Up={Span:Yi,Anchor:Ls,SymbolNode:Bn,SvgNode:Tr,PathNode:Yr,LineNode:Yo},Jd={version:qp,render:Kd,renderToString:_p,ParseError:re,SETTINGS_SCHEMA:Go,__parse:$p,__renderToDomTree:$0,__renderToHTMLTree:Hp,__setFontMetrics:ym,__defineSymbol:h,__defineFunction:ve,__defineMacro:b,__domTree:Up};const Wp=".hn-note-inline-formula[data-hn-inline-formula]";function Gp(e){e.querySelectorAll(Wp).forEach(n=>{const r=n.getAttribute("data-hn-inline-formula");r!==null&&Jd.render(r,n,{displayMode:!1,throwOnError:!1})})}function Xp({root:e,renderKey:t}){p.useLayoutEffect(()=>{if(t==null)return;const n=e.current;n&&Gp(n)},[t,e])}const Ii=Object.freeze({bold:!1,italic:!1,underline:!1,strikeThrough:!1,code:!1,formula:!1}),Ui="data-hn-inline-formula",Vp="hn-note-inline-formula",Qd=`[${Ui}]`,Sc=`strong,b,em,i,u,s,strike,del,code,font,mark,sub,sup,span[data-hn-color],${Qd}`,H0="hn-note-inline-code",eh=e=>{try{document.execCommand(e)}catch{}},qs=e=>{const t=e.parentNode;if(t!==null){for(;e.firstChild!==null;)t.insertBefore(e.firstChild,e);t.removeChild(e)}},Mr=e=>e===null?null:e instanceof HTMLElement?e:e.parentElement,Yp=(e,t)=>{const n=t.childNodes.length;if(n===0)return e.comparePoint(t,0)===0;const r=e.comparePoint(t,0),i=e.comparePoint(t,n);return r>=0&&i<=0},ko=()=>{const e={bold:!1,italic:!1,underline:!1,strikeThrough:!1,code:!1,formula:!1},t=window.getSelection();if(t!==null&&t.rangeCount>0){const n=t.getRangeAt(0);let r=Mr(n.startContainer);for(;r!==null;){const i=r.tagName;i==="STRONG"||i==="B"?e.bold=!0:i==="EM"||i==="I"?e.italic=!0:i==="U"?e.underline=!0:i==="S"||i==="STRIKE"||i==="DEL"?e.strikeThrough=!0:i==="CODE"&&(e.code=!0),r.hasAttribute(Ui)&&(e.formula=!0),r=r.parentElement}}if(typeof document.queryCommandState=="function")try{!e.bold&&document.queryCommandState("bold")&&(e.bold=!0),!e.italic&&document.queryCommandState("italic")&&(e.italic=!0),!e.underline&&document.queryCommandState("underline")&&(e.underline=!0),!e.strikeThrough&&document.queryCommandState("strikeThrough")&&(e.strikeThrough=!0),!e.code&&document.queryCommandState("insertCode")&&(e.code=!0),!e.formula&&document.queryCommandState("insertFormula")&&(e.formula=!0)}catch{}return Object.freeze(e)},Jr=(e,t,n)=>{const r=document.createRange();r.selectNodeContents(e);try{r.setEnd(t,n)}catch{return 0}return r.toString().length},Us=(e,t,n)=>{const r=window.getSelection();if(r===null)return;const i=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),a=document.createRange();let s=0,o=!1,l=!1,d=null,c=i.nextNode();for(;c!==null;){const f=c.data.length;if(!o&&t<=s+f&&(a.setStart(c,t-s),o=!0),!l&&n<=s+f){a.setEnd(c,n-s),l=!0;break}s+=f,d=c,c=i.nextNode()}if(!o||!l){if(d===null)return;o||a.setStart(d,d.data.length),l||a.setEnd(d,d.data.length)}r.removeAllRanges(),r.addRange(a)},Ec=(e,t)=>({start:Jr(e,t.startContainer,t.startOffset),end:Jr(e,t.endContainer,t.endOffset)}),Kp=(e,t,n)=>{Us(e,t,n)},th=(e,t)=>{const n=new Set,r=Mr(e.startContainer)?.closest("code");r!=null&&n.add(r);const i=Mr(e.endContainer)?.closest("code");i!=null&&n.add(i);for(const a of Array.from(t.querySelectorAll("code")))e.intersectsNode(a)&&n.add(a);return[...n]},Zp=()=>{const e=window.getSelection();if(e===null||e.rangeCount===0||e.isCollapsed)return;const t=e.getRangeAt(0),r=Mr(t.startContainer)?.closest("[data-editable-block-id]")??Mr(t.commonAncestorContainer)??document,i=th(t,r);if(i.length>0){const l={start:Jr(r,t.startContainer,t.startOffset),end:Jr(r,t.endContainer,t.endOffset)};for(const d of i)qs(d);l.end>l.start&&Us(r,l.start,l.end);return}const a=t.extractContents(),s=document.createElement("code");s.className=H0,s.appendChild(a),t.insertNode(s),e.removeAllRanges();const o=document.createRange();o.selectNodeContents(s),e.addRange(o)},Jp=e=>{const t=window.getSelection();if(t===null||t.rangeCount===0)return;const n=t.getRangeAt(0);n.deleteContents();const r=document.createElement("span");r.className=Vp,r.setAttribute(Ui,e),r.setAttribute("contenteditable","false"),r.textContent=e,n.insertNode(r),t.removeAllRanges();const i=document.createRange();i.setStartAfter(r),i.collapse(!0),t.addRange(i)},Qp=()=>{const e=window.getSelection();if(e===null||e.rangeCount===0)return;const t=e.getRangeAt(0).cloneRange(),n=Mr(t.commonAncestorContainer);if(n===null)return;const r=Array.from(n.querySelectorAll(`strong,b,em,i,u,s,strike,del,code,${Qd}`)).filter(i=>Yp(t,i));eh("removeFormat");for(const i of r)i.isConnected&&(i.hasAttribute(Ui)?i.remove():qs(i))},Wa=(e,t)=>{const r=Mr(e.commonAncestorContainer)?.closest("[data-editable-block-id]")??null;if(r===null)return!1;const i=r.getAttribute("data-editable-block-id");return i===null?!1:(t(i,r.innerHTML),!0)},e4=()=>{Zp()},Tc=(e,t,n)=>{const r=window.getSelection();if(r===null||r.rangeCount===0||r.isCollapsed)return;const i=r.getRangeAt(0).cloneRange();Ns(i,e,a=>{r.removeAllRanges(),r.addRange(a.cloneRange()),n===void 0?document.execCommand(t):document.execCommand(t,!1,n)}),r.removeAllRanges(),r.addRange(i)},t4=e=>{const t=window.getSelection();if(t===null||t.rangeCount===0||t.isCollapsed)return;const n=t.getRangeAt(0).cloneRange(),r={start:Jr(e,n.startContainer,n.startOffset),end:Jr(e,n.endContainer,n.endOffset)};Ns(n,e,(i,a)=>{const s=th(i,a);if(s.length>0){for(const d of s)qs(d);return}const o=i.extractContents(),l=document.createElement("code");l.className=H0,l.appendChild(o),i.insertNode(l)}),r.end>r.start?Us(e,r.start,r.end):(t.removeAllRanges(),t.addRange(n))},n4=e=>{const t=window.getSelection();if(t===null||t.rangeCount===0||t.isCollapsed)return;const n=t.getRangeAt(0).cloneRange(),r={start:Jr(e,n.startContainer,n.startOffset),end:Jr(e,n.endContainer,n.endOffset)};let i=0;Ns(n,e,a=>{const s=Mr(a.commonAncestorContainer)?.closest('[contenteditable="true"]'),o=new Set;for(const c of[a.startContainer,a.endContainer]){let f=Mr(c);for(;f&&f!==s;)f.matches(Sc)&&o.add(f),f=f.parentElement}const l=a.extractContents(),d=Array.from(l.querySelectorAll(Sc)).reverse();for(const c of d)c.hasAttribute(Ui)?(i+=c.textContent?.length??0,c.remove()):qs(c);a.insertNode(l);for(const c of o)c.isConnected&&c.textContent===""&&!c.hasAttribute(Ui)&&c.remove()}),Us(e,r.start,Math.max(r.start,r.end-i))},Mc=(e,t,n)=>{Ns(e,t,(r,i)=>{const a=i.getAttribute("data-editable-block-id");a!==null&&n(a,i.innerHTML)})},r4=new Set(["`","*","~"]),q0=e=>e.length>0&&e.trim()===e&&e.trim()!=="",nh=(e,t,n)=>{const r=t[0]??"",a=new RegExp(`${t.replace(/[.*~]/g,l=>`\\${l}`)}([^${r}]+)\\${r}$`).exec(e);if(a===null)return null;const s=a[1]??"";if(!q0(s))return null;const o=a.index;return{kind:n,openIndex:o,contentStart:o+t.length,contentEnd:o+t.length+s.length}},i4=e=>{const t=e.lastIndexOf("`");if(t<0)return null;const n=e.slice(t+1);return q0(n)?{kind:"code",openIndex:t,contentStart:t+1,contentEnd:e.length}:null},a4=e=>{const t=nh(e,"**","bold");if(t!==null)return t;const n=e.lastIndexOf("*");if(n<0||n>0&&e[n-1]==="*")return null;const r=e.slice(n+1);return r.includes("*")||!q0(r)?null:{kind:"italic",openIndex:n,contentStart:n+1,contentEnd:e.length}},s4=(e,t)=>r4.has(t)?t==="`"?i4(e):t==="*"?a4(e):nh(e,"~~","strike"):null,o4={code:"code",bold:"strong",italic:"em",strike:"s"},rh=(e,t)=>{let n=e.nextSibling;n instanceof Text||(n=document.createTextNode(""),e.parentNode?.insertBefore(n,e.nextSibling));const r=document.createRange();r.setStart(n,0),r.collapse(!0),t.removeAllRanges(),t.addRange(r)},l4=e=>{const t=window.getSelection();if(t===null||t.rangeCount===0||!t.isCollapsed)return null;const n=t.anchorNode;if(!(n instanceof Text))return null;const r=t.anchorOffset,i=n.parentElement;if(i===null||i.closest("code, pre, textarea, input, [contenteditable='false']")!==null)return null;const a=i.closest("[data-editable-block-id]");if(a===null)return null;const s=n.data.slice(0,r),o=s4(s,e);if(o===null)return null;const l=s.slice(o.contentStart,o.contentEnd),d=n.data.slice(r);n.data=s.slice(0,o.openIndex)+l+d;const c=document.createRange();c.setStart(n,o.openIndex),c.setEnd(n,o.openIndex+l.length);const f=document.createElement(o4[o.kind]);return o.kind==="code"&&(f.className=H0),c.surroundContents(f),rh(f,t),a},c4=e=>{const t=window.getSelection();if(t===null||t.rangeCount===0||!t.isCollapsed)return;const n=t.anchorNode;if(n===null)return;const i=(n instanceof HTMLElement?n:n.parentElement)?.closest("code, strong, em, s")??null;if(i===null||!e.contains(i))return;const a=document.createRange();a.selectNodeContents(i);try{a.setStart(n,t.anchorOffset)}catch{return}a.toString().length>0||rh(i,t)},Cc="code, strong, em, s",u4=e=>{const t=window.getSelection();if(t===null||t.rangeCount===0||!t.isCollapsed)return null;const n=t.anchorNode;if(!(n instanceof Text))return null;const r=n.parentElement;if(r===null)return null;let i=r.closest(Cc);if(i!==null){const c=document.createRange();c.selectNodeContents(i);try{c.setStart(n,t.anchorOffset)}catch{return null}if(c.toString().length>0)return null}else{if(n.data.length>0||t.anchorOffset!==0)return null;const c=n.previousSibling;i=c instanceof HTMLElement&&c.matches(Cc)?c:null}if(i===null)return null;const a=i.closest("[data-editable-block-id]");if(a===null)return null;const s=document.createRange();s.selectNodeContents(a);try{s.setStartAfter(i)}catch{return null}if(s.toString().trim().length>0)return null;const o=i.nextSibling,l=o instanceof Text?o:document.createTextNode("");l!==o&&i.parentNode?.insertBefore(l,o),l.data=e+l.data;const d=document.createRange();return d.setStart(l,1),d.collapse(!0),t.removeAllRanges(),t.addRange(d),a},ih=/^[\p{L}\p{N}_-]*$/u,ah=(e,t,n)=>{const r=t>0?e.at(t-1):void 0;return r!==void 0&&!/\s/u.test(r)?!1:ih.test(e.slice(t+1,n))},d4=e=>{const t=window.getSelection();if(!t||t.rangeCount===0||!t.isCollapsed)return null;const n=t.getRangeAt(0);if(!e.contains(n.startContainer)||!(n.startContainer instanceof Text)||n.startOffset===0)return null;const r=n.startContainer.data,i=n.startOffset-1;if(r.at(i)!=="@"||!ah(r,i,n.startOffset))return null;const a=n.cloneRange();return a.setStart(n.startContainer,n.startOffset-1),a},h4=e=>{const t=window.getSelection();if(!t||t.rangeCount===0||!t.isCollapsed)return null;const n=t.getRangeAt(0);if(!e.contains(n.startContainer)||!(n.startContainer instanceof Text)||n.startOffset===0)return null;const r=n.startContainer.data,i=n.startOffset,a=r.lastIndexOf("@",i-1);if(a===-1||!ah(r,a,i))return null;const s=n.cloneRange();return s.setStart(n.startContainer,a),s.setEnd(n.startContainer,i),s},f4=e=>{const t=d4(e);return t||h4(e)},Ac=(e,t)=>{const n=t.cloneRange();n.collapse(!1);const r=typeof n.getBoundingClientRect=="function"?n.getBoundingClientRect():e.getBoundingClientRect(),i=r.width===0&&r.height===0?e.getBoundingClientRect():r;return{anchorTop:i.top,left:Math.max(12,Math.min(i.left,window.innerWidth-272)),top:i.bottom+8}},m4=(e,t)=>{if(!(e instanceof Element))return null;const n=e.closest('[contenteditable="true"]');return n&&t.contains(n)?n:null},Rc=(e,t)=>{if(!e.editable.contains(e.triggerRange.commonAncestorContainer))return;e.triggerRange.deleteContents();const n=document.createElement("span");n.className="hn-note-link-mention",n.setAttribute("data-note-link-id",t.id),n.contentEditable="false",n.textContent=t.name;const r=document.createTextNode(" "),i=document.createDocumentFragment();i.append(n,r),e.triggerRange.insertNode(i);const a=document.createRange();a.setStartAfter(r),a.collapse(!0);const s=window.getSelection();s?.removeAllRanges(),s?.addRange(a),e.editable.focus({preventScroll:!0}),e.editable.dispatchEvent(new InputEvent("input",{bubbles:!0}))},Ic=(e,t)=>{const n=t.trim().toLowerCase();return n===""?e:e.filter(r=>r.name.toLowerCase().includes(n))},p4=({containerRef:e,links:t})=>{const[n,r]=p.useState(null),i=p.useRef(null),a=p.useRef(null);if(p.useLayoutEffect(()=>{if(!n||!i.current)return;const l=i.current.getBoundingClientRect();if(l.bottom<=window.innerHeight-12)return;const d=Math.max(12,Math.min(n.anchorTop-l.height-8,window.innerHeight-l.height-12));d!==n.top&&r(c=>c?{...c,top:d}:null)},[n]),p.useEffect(()=>{const l=e.current;if(!l){r(null);return}const d=k=>{const w=window.getSelection();if(!w||w.rangeCount===0){r(null);return}const E=w.getRangeAt(0);if(!w.isCollapsed)return;if(!k.editable.isConnected||!k.editable.contains(E.startContainer)){r(null);return}if(E.compareBoundaryPoints(Range.START_TO_START,k.triggerRange)<=0){r(null);return}const S=k.triggerRange.cloneRange();try{S.setEnd(E.startContainer,E.startOffset)}catch{r(null);return}const R=S.toString();if(!R.startsWith("@")){r(null);return}const L=R.slice(1);if(!ih.test(L)){r(null);return}r(P=>P?P.query===L?P:(P.triggerRange.setEnd(E.startContainer,E.startOffset),{...P,activeIndex:0,query:L,triggerRange:P.triggerRange}):null)},c=k=>{if(k instanceof InputEvent&&k.isComposing)return;const w=m4(k.target,l);if(!w)return;if(n){d(n);return}const E=f4(w);if(!E)return;const S=E.startContainer;if(a.current&&a.current.node===S&&a.current.offset===E.startOffset)return;const R=E.toString().slice(1);r({activeIndex:0,editable:w,query:R,triggerRange:E,...Ac(w,E)})},f=()=>{n&&d(n)},g=k=>{if(!n||!(k.target instanceof Node)||!n.editable.contains(k.target))return;if(k.key==="Escape"){k.preventDefault(),k.stopPropagation(),a.current={node:n.triggerRange.startContainer,offset:n.triggerRange.startOffset},r(null);return}const w=Ic(t,n.query);if(k.key==="ArrowDown"||k.key==="ArrowUp"){if(w.length===0)return;k.preventDefault(),k.stopPropagation();const S=k.key==="ArrowDown"?1:-1;r(R=>R?{...R,activeIndex:(R.activeIndex+S+w.length)%w.length}:null);return}if(k.key!=="Enter"||w.length===0)return;k.preventDefault(),k.stopPropagation();const E=w[n.activeIndex];E&&(Rc(n,E),a.current=null,r(null))},y=k=>{if(!n)return;const w=k.target;w instanceof Node&&n.editable.contains(w)&&(a.current=null,r(null))},x=()=>{if(n){if(!n.editable.isConnected){r(null);return}r(k=>k?{...k,...Ac(k.editable,k.triggerRange)}:null)}};return l.addEventListener("input",c),l.addEventListener("keydown",g),l.addEventListener("focusout",y),document.addEventListener("selectionchange",f),window.addEventListener("resize",x),window.addEventListener("scroll",x,!0),()=>{l.removeEventListener("input",c),l.removeEventListener("keydown",g),l.removeEventListener("focusout",y),document.removeEventListener("selectionchange",f),window.removeEventListener("resize",x),window.removeEventListener("scroll",x,!0)}},[e,t,n]),!n)return null;const s=Ic(t,n.query),o={left:n.left,top:n.top};return Gr.createPortal(u.jsx("div",{ref:i,className:"hn-note-mention-menu",role:"listbox","aria-label":"可选链接",style:o,children:s.length===0?u.jsx("div",{className:"hn-note-mention-empty",role:"presentation",children:"无匹配结果"}):s.map((l,d)=>u.jsxs("button",{type:"button",className:"hn-note-mention-option",role:"option","aria-selected":d===n.activeIndex,onPointerDown:c=>c.preventDefault(),onPointerEnter:()=>r(c=>c?{...c,activeIndex:d}:null),onClick:()=>{Rc(n,l),a.current=null,r(null)},children:[u.jsx("span",{className:"hn-note-mention-mark","aria-hidden":"true",children:"@"}),u.jsx("span",{children:l.name})]},l.id))}),document.body)},Jn=e=>e.split(/\n|<br\s*\/?>/giu),Cr=(e,t)=>t===0?e:`${e}-line-${t}`,Nc=({block:e,itemId:t,preserveMarkdownMarker:n,replace:r})=>{const i=e.items.findIndex(g=>g.id===t),a=e.items[i];if(i<0||a===void 0)return[e];const s=e.items.slice(0,i),o=e.items.slice(i+1),l=s.length===0&&o.length===0,d=`${n?"- ":""}${a.checked?"[x]":"[ ]"} ${a.text}`,c=e.title.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">"),f=r({id:a.id,kind:"paragraph",text:l?`<strong>${c}</strong><br>${d}`:d});return[...s.length>0?[{...e,items:s}]:[],...f,...o.length>0?[{...e,id:gt(),title:s.length>0?"":e.title,items:o}]:[]]},Lc=(e,t,n)=>({id:e,kind:"quote",text:t.join(`
|
|
263
|
+
`),...n===void 0?{}:{author:n}}),g4=({block:e,lineIndex:t,preserveMarkdownMarker:n,replacementId:r,replace:i})=>{const a=Jn(e.text),s=a[t];if(s===void 0)return[e];const o=a.slice(0,t),l=a.slice(t+1),d=l.length>0,c=o.length===0&&l.length===0,f=`${n?"> ":""}${s}`,g=i(c?{...e,id:r,text:f}:{id:r,kind:"paragraph",text:f});return[...o.length>0?[Lc(e.id,o,d?void 0:e.author)]:[],...g,...l.length>0?[Lc(gt(),l,e.author)]:[]]},sh=({blocks:e,preserveMarkdownMarker:t=!1,replacementId:n,source:r,replace:i})=>e.flatMap(a=>{if(a.id!==r.blockId)return[a];switch(r.kind){case"block":return i(a);case"todo-item":return a.kind==="todo"?Nc({block:a,itemId:r.itemId,preserveMarkdownMarker:t,replace:i}):[a];case"checklist-item":return a.kind==="checklist"?Nc({block:a,itemId:r.itemId,preserveMarkdownMarker:t,replace:i}):[a];case"quote-line":return a.kind==="quote"?g4({block:a,lineIndex:r.lineIndex,preserveMarkdownMarker:t,replace:i,replacementId:r.lineIndex===0?a.id:n??gt()}):[a];default:return Vt(r)}}),v4=({blocks:e,todoItemId:t,preserveMarkdownMarker:n,replacementId:r,source:i,target:a})=>sh({blocks:e,preserveMarkdownMarker:n,replacementId:r,source:i,replace:s=>Tf(s,a,t)}),y4=({blocks:e,source:t,url:n,filename:r,width:i,height:a})=>sh({blocks:e,source:t,replace:s=>[{id:s.id,kind:"picture",url:n,filename:r,...i===void 0?{}:{width:i},...a===void 0?{}:{height:a}}]}),b4=(e,t)=>{if(e.find(r=>r.id===t)?.kind==="callout")return{kind:"block",blockId:t};for(const r of e)if(r.kind==="checklist"&&r.items.some(i=>i.id===t))return{kind:"checklist-item",blockId:r.id,itemId:t}},ba=e=>({id:e,kind:"paragraph",text:""}),oh=(e,t,n)=>e.map(r=>r.id===t?n(r):r),x4=(e,t)=>({blocks:oh(e,t,()=>ba(t)),focusId:t}),w4=(e,t,n)=>{if(t.items.length===1)return{blocks:oh(e,t.id,()=>ba(t.id)),focusId:t.id};const r=t.items.findIndex(o=>o.id===n);if(r<0)return{blocks:[...e],focusId:n};const i=t.items.slice(0,r),a=t.items.slice(r+1);return{blocks:e.flatMap(o=>{if(o.id!==t.id||o.kind!=="checklist")return[o];const l=[];return i.length>0&&l.push({...o,items:i}),l.push(ba(n)),a.length>0&&l.push({...o,id:gt(),title:i.length>0?"":o.title,items:a}),l}),focusId:n}},Pc=(e,t,n)=>({id:e,kind:"quote",text:t.join(`
|
|
264
|
+
`),...n===void 0?{}:{author:n}}),k4=(e,t)=>{const n=e.find(c=>c.id===t.blockId&&c.kind==="quote");if(!n)return{blocks:[...e],focusId:t.lineId};const r=Jn(n.text);if(r[t.lineIndex]===void 0)return{blocks:[...e],focusId:t.lineId};const a=r.slice(0,t.lineIndex),s=r.slice(t.lineIndex+1),o=t.lineIndex===0?t.blockId:gt(),l=a.length===0&&s.length===0;return{blocks:e.flatMap(c=>{if(c.id!==t.blockId||c.kind!=="quote")return[c];const f=[];return l?(f.push(ba(o)),f):(a.length>0&&f.push(Pc(c.id,a,void 0)),f.push(ba(o)),s.length>0&&f.push(Pc(gt(),s,c.author)),f)}),focusId:o}},lh=({blocks:e,source:t})=>{switch(t.kind){case"block":return x4(e,t.blockId);case"todo-item":return{blocks:[...e],focusId:t.itemId};case"checklist-item":{const n=e.find(r=>r.id===t.blockId&&r.kind==="checklist");return n?w4(e,n,t.itemId):{blocks:[...e],focusId:t.itemId}}case"quote-line":return k4(e,t)}},S4=e=>e==="todo-item"?"todo":Vt(e),E4=e=>e.kind==="todo-item",T4=({blocks:e,focusId:t,nextId:n,source:r,target:i})=>E4(r)&&i.kind===S4(r.kind)?{blocks:e.map(s=>{if(s.id!==r.blockId)return s;switch(s.kind){case"todo":{if(i.kind!=="todo")return s;const o=s.items.findIndex(d=>d.id===r.itemId);if(o<0)return s;const l=s.items.slice();return l.splice(o+1,0,{id:t,checked:!1,text:""}),{...s,items:l}}default:return s}}),focusId:t}:r.kind==="quote-line"&&i.kind==="quote"?{blocks:e.map(s=>{if(s.kind!=="quote"||s.id!==r.blockId)return s;const o=Jn(s.text).slice();return r.lineIndex<0||r.lineIndex>=o.length?s:(o.splice(r.lineIndex+1,0,""),{...s,text:o.join(`
|
|
265
|
+
`)})}),focusId:Cr(r.blockId,r.lineIndex+1)}:{blocks:Bf({blocks:e,blockId:r.blockId,...i.kind==="todo"?{todoItemId:t}:{},nextId:n,target:i}),focusId:t},Dc=e=>e.flatMap(t=>{switch(t.kind){case"todo":return t.items.map(n=>n.id);case"unorderedList":case"orderedList":return[t.id];case"heading":case"paragraph":case"quote":case"code":case"callout":case"formula":case"collapsible":return[t.id];case"picture":case"card":case"drawing":case"directory":return[];case"checklist":return t.items.map(n=>n.id);case"table":return t.rows.flatMap((n,r)=>n.map((i,a)=>`${t.id}-r${r}-c${a}`));default:return Vt(t)}}),ch=({after:e,before:t,sourceId:n})=>{const r=Dc(e);if(r.includes(n))return{id:n,position:"start"};const i=Dc(t),a=i.indexOf(n),s=a>0?i[a-1]:void 0;if(s)return{id:s,position:"end"};const l=(a>=0?i[a+1]:void 0)??r[0];return l?{id:l,position:"start"}:void 0},M4=({after:e,before:t,sourceId:n})=>{const r=t.find(i=>i.kind==="todo"&&i.items.some(a=>a.id===n));return r&&e.some(i=>i.id===r.id&&i.kind==="paragraph")?{id:r.id,position:"start"}:ch({after:e,before:t,sourceId:n})},uh=e=>e.blockId,dh=e=>{const t=gt();switch(e.kind){case"heading":case"paragraph":case"unorderedList":case"orderedList":case"code":case"callout":case"table":case"formula":case"picture":case"card":case"drawing":case"directory":return{...e,id:t};case"todo":case"checklist":{const n=e.items.map(r=>({...r,id:gt()}));return{...e,id:t,items:n}}case"quote":return{...e,id:t};case"collapsible":{const n=e.blocks.map(r=>dh(r));return{...e,id:t,blocks:n}}default:return Vt(e)}},C4=({blocks:e,source:t})=>{const n=uh(t),r=e.filter(a=>a.id!==n);if(r.length===e.length)return{blocks:r,focusTarget:void 0};const i=ch({after:r,before:e,sourceId:n});return{blocks:r,focusTarget:i}},A4=({blocks:e,source:t})=>{const n=uh(t),r=e.findIndex(o=>o.id===n);if(r<0)return{blocks:[...e],focusBlockId:void 0};const i=e[r];if(i===void 0)return{blocks:[...e],focusBlockId:void 0};const a=dh(i),s=e.slice();return s.splice(r+1,0,a),{blocks:s,focusBlockId:a.id}},ds=(e,t)=>{const n=t.kind==="todo-item"?`todo-item:${t.blockId}:${t.itemId}`:t.kind==="quote-line"?`quote-line:${t.blockId}:${t.lineId}`:`block:${t.blockId}`;return`block-action:${e}:${n}`},R4=(e,t)=>{const n=document.createRange();n.selectNodeContents(e),n.setEnd(t.startContainer,t.startOffset);const r=document.createElement("div");return r.appendChild(n.cloneContents()),r.innerHTML},Zi=({ctx:e,event:t,mode:n,sourceId:r})=>{const{blocks:i,onBlocksChange:a,requestFocus:s}=e;if(!a)return;const o=t.currentTarget,l=window.getSelection(),d=i.some(k=>k.id===r&&k.kind==="callout");if(t.key==="Enter"&&n==="rich-text"&&(t.shiftKey||d)){t.preventDefault();const k=window.getSelection();if(!k||k.rangeCount===0)return;const w=k.getRangeAt(0);if(!t.currentTarget.contains(w.commonAncestorContainer))return;w.collapsed||w.deleteContents();const S=document.createElement("br");w.insertNode(S),S.nextSibling||S.after(document.createElement("br")),w.setStartAfter(S),w.collapse(!0),k.removeAllRanges(),k.addRange(w);return}if(t.key==="Enter"&&!t.shiftKey){if(t.preventDefault(),!l||l.rangeCount===0)return;const k=l.getRangeAt(0);if(!o.contains(k.commonAncestorContainer))return;k.collapsed||k.deleteContents();const w=document.createRange();w.selectNodeContents(o),w.setStart(k.endContainer,k.endOffset);const E=document.createElement("div");E.appendChild(w.extractContents());const S=gt(),R=Of({afterHtml:E.innerHTML,beforeHtml:o.innerHTML,blocks:i,nextId:S,sourceId:r});a(R),s?.(S,"start");return}if(t.key!=="Backspace"||!l||l.rangeCount===0)return;const c=l.getRangeAt(0);if(!l.isCollapsed||!o.contains(c.commonAncestorContainer))return;const f=R4(o,c);if(!Xr(f)||!Xr(o.innerHTML))return;const g=b4(i,r);if(g){t.preventDefault();const{blocks:k,focusId:w}=lh({blocks:i,source:g});a(k),s?.(w,"start");return}t.preventDefault();const y=zf({blocks:i,currentHtml:o.innerHTML,sourceId:r}),x=M4({after:y,before:i,sourceId:r});a(y),x&&s?.(x.id,x.position)},mn=(e,t,n={kind:"block",blockId:e.id})=>{if(!t.editable)return null;const r=n.kind==="todo-item"?n.itemId:n.kind==="quote-line"?n.lineId:n.blockId,i=ds("add",n),a=ds("convert",n),s=x=>x.kind==="todo",o=x=>{const k=n.kind==="quote-line"&&n.lineIndex>0?gt():r,w=s(x)?gt():k;return t.onBlocksChange?.(v4({blocks:t.blocks,...s(x)?{todoItemId:w}:{},replacementId:k,source:n,target:x})),w},l=t.onPictureUpload,d=t.onBlocksChange,c=l&&d?async({base64:x,filename:k,width:w,height:E})=>{const S=await l(x,k);d(y4({blocks:t.getBlocks(),source:n,url:S,filename:k,width:w,height:E})),t.onBlockMenuOpenChange(a,!1)}:void 0,f=x=>{const k=gt(),w=s(x)?gt():k,E=T4({blocks:t.getBlocks(),focusId:w,nextId:k,source:n,target:x});return t.onBlocksChange?.(E.blocks),E.focusId},g=()=>{const x=C4({blocks:t.getBlocks(),source:n});return t.onBlocksChange?.(x.blocks),x.focusTarget?.id},y=()=>{const x=A4({blocks:t.getBlocks(),source:n});return t.onBlocksChange?.(x.blocks),x.focusBlockId};return u.jsxs(u.Fragment,{children:[u.jsx(Bl,{mode:"add",open:t.openBlockMenuId===i,onOpenChange:x=>t.onBlockMenuOpenChange(i,x),blockId:r,kind:e.kind,...e.kind==="heading"?{headingLevel:e.level}:{},onSelect:f}),u.jsx(Bl,{mode:"convert",open:t.openBlockMenuId===a,onOpenChange:x=>t.onBlockMenuOpenChange(a,x),blockId:r,kind:e.kind,...e.kind==="heading"?{headingLevel:e.level}:{},onSelect:o,...c?{onPictureUpload:c}:{},onDelete:g,onDuplicate:y})]})},U0=e=>{if(e.nodeType===Node.TEXT_NODE)return e.textContent?.length??0;if(e instanceof HTMLBRElement)return 1;let t=0;for(const n of e.childNodes)t+=U0(n);return t},W0=e=>U0(e),xa=(e,t,n)=>{const r=document.createRange();return r.selectNodeContents(e),r.setEnd(t,n),W0(r.cloneContents())},hh=(e,t)=>{if(e.nodeType===Node.TEXT_NODE){const r=e.textContent?.length??0;return t<=r?[e,t]:null}let n=t;for(let r=0;r<e.childNodes.length;r+=1){const i=e.childNodes[r];if(!i)continue;if(i instanceof HTMLBRElement){if(n===0)return[e,r];if(n===1)return[e,r+1];n-=1;continue}const a=U0(i);if(n<=a)return hh(i,n);n-=a}return n===0?[e,e.childNodes.length]:null},Bc=(e,t)=>hh(e,t)??[e,e.childNodes.length],fh=new Set(["B","CODE","DEL","EM","I","S","STRIKE","STRONG","U"]),I4=new Set([...fh,"A","BR","MARK","SPAN","SUB","SUP","FONT"]),N4=new Set(["SPAN"]),L4=new Set(["IFRAME","NOSCRIPT","OBJECT","SCRIPT","STYLE","TEMPLATE"]),P4=new Set(["hn-note-inline-code","hn-note-inline-formula","hn-note-link-mention"]),mh=new Set(["#ef4444","#3b82f6","#22c55e","#000000","#6b7280"]),ph=e=>e.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'"),gh=e=>e.replace(/<(script|style|template|noscript|iframe|object)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,"").replace(/<br\s*\/?\s*>/gi,`
|
|
266
|
+
`).replace(/<[^>]*>/g,""),vh=e=>{const t=e.trim();return t.startsWith("#")||t.startsWith("/")||/^(https?:|mailto:|tel:)/i.test(t)||t.startsWith("hnmagic://")?t:null},D4=(e,t)=>{const n=Array.from(e.classList).filter(o=>P4.has(o)||o.startsWith("hljs-"));if(n.length>0&&t.setAttribute("class",n.join(" ")),e.tagName==="A"){const o=e.getAttribute("href"),l=o===null?null:vh(o);l!==null&&t.setAttribute("href",l)}if(e.tagName!=="SPAN")return;const r=e.getAttribute("data-hn-color");r!==null&&mh.has(r.toLowerCase())&&t.setAttribute("data-hn-color",r.toLowerCase());const i=e.getAttribute("data-hn-inline-formula"),a=e.getAttribute("data-note-link-id"),s=["data-note-drag-kind","data-note-drag-parent-id","data-note-select-id","data-note-sortable-id","id"];i!==null&&t.setAttribute("data-hn-inline-formula",i),a!==null&&t.setAttribute("data-note-link-id",a),i!==null&&e.getAttribute("contenteditable")==="false"&&t.setAttribute("contenteditable","false");for(const o of s){const l=e.getAttribute(o);l!==null&&t.setAttribute(o,l)}},d0=(e,t,n,r)=>{const i=r==="title"?fh:r==="code"?N4:I4;for(const a of Array.from(e.childNodes)){if(a.nodeType===Node.TEXT_NODE){t.appendChild(n.createTextNode(a.textContent??""));continue}if(!(a instanceof Element)||L4.has(a.tagName))continue;if(!i.has(a.tagName)){d0(a,t,n,r);continue}const s=r==="body"&&a.tagName==="FONT",o=a.getAttribute("color")?.toLowerCase()??"",l=n.createElement(s?"span":a.tagName.toLowerCase());s&&mh.has(o)&&l.setAttribute("data-hn-color",o),D4(a,l),d0(a,l,n,r),t.appendChild(l)}},G0=(e,t)=>{if(typeof DOMParser>"u")return ph(gh(e));const n=new DOMParser().parseFromString(`<body>${e}</body>`,"text/html"),r=n.createElement("div");return d0(n.body,r,n,t),r.innerHTML},gi=e=>G0(e,"title"),wt=e=>G0(e,"body"),B4=e=>G0(e,"code"),vi=e=>ph(e).replaceAll(`
|
|
267
|
+
`,"<br>"),Yn=e=>typeof DOMParser>"u"?gh(e).length:W0(new DOMParser().parseFromString(`<body>${e}</body>`,"text/html").body),h0=new WeakMap,Oc=e=>{h0.get(e)?.()},Hn=(e,t,n="body")=>{let r=null;const i=a=>{const s=n==="title"?gi(a.innerHTML):wt(a.innerHTML);s!==a.innerHTML&&(a.innerHTML=s),e(a)};return{contentEditable:!0,suppressContentEditableWarning:!0,className:t?`${t} hn-note-editable`:"hn-note-editable",spellCheck:!1,ref:a=>{r&&h0.delete(r),r=a,a&&h0.set(a,()=>i(a))},onBlur:a=>{a.relatedTarget?.closest(".hn-note-popover")||i(a.currentTarget)}}},ra=new Map,O4=500,Et=(e,t="body")=>{const n=t==="title"?gi(e):t==="code"?B4(e):wt(e),r=`${t}\0${n}`;let i=ra.get(r);if(!i){if(ra.size>=O4){const a=ra.keys().next().value;a!==void 0&&ra.delete(a)}i={dangerouslySetInnerHTML:{__html:n}},ra.set(r,i)}return i},wa=(e,t,n)=>e.map(r=>r.id!==t?r:r.kind==="heading"||r.kind==="paragraph"||r.kind==="quote"||r.kind==="callout"||r.kind==="unorderedList"||r.kind==="orderedList"?{...r,text:n}:r),z4=(e,t,n)=>e.map(r=>r.id!==t||r.kind!=="callout"?r:{...r,title:n}),j4=(e,t,n)=>e.map(r=>r.id!==t||r.kind!=="quote"?r:{...r,author:n}),F4=(e,t,n)=>e.map(r=>r.id!==t||r.kind!=="collapsible"?r:{...r,title:n}),_4=(e,t)=>e.map(n=>n.id!==t||n.kind!=="collapsible"?n:{...n,collapsed:!n.collapsed}),$4=(e,t,n)=>e.map(r=>r.id!==t||r.kind!=="code"?r:{...r,code:n}),H4=(e,t,n)=>e.map(r=>r.id!==t||r.kind!=="formula"?r:{...r,formula:n}),q4=(e,t,n)=>e.map(r=>r.id!==t||r.kind!=="drawing"?r:{...r,data:n}),U4=(e,t,n)=>e.map(r=>r.id!==t||r.kind!=="code"?r:{...r,language:n}),W4=(e,t,n)=>e.map(r=>r.id!==t||r.kind!=="code"?r:{...r,filename:n}),G4=(e,t,n)=>e.map(r=>r.id!==t||r.kind!=="todo"?r:{...r,items:r.items.map(i=>i.id===n?{...i,checked:!i.checked}:i)}),X4=(e,t,n,r)=>e.map(i=>i.id!==t||i.kind!=="todo"?i:{...i,items:i.items.map(a=>a.id===n?{...a,text:r}:a)}),V4=(e,t,n)=>e.map(r=>r.id!==t||r.kind!=="checklist"?r:{...r,items:r.items.map(i=>i.id===n?{...i,checked:!i.checked}:i)}),Y4=(e,t,n,r)=>e.map(i=>i.id!==t||i.kind!=="checklist"?i:{...i,items:i.items.map(a=>a.id===n?{...a,text:r}:a)}),K4=({block:e,item:t,ctx:n,showTitle:r})=>{const{editable:i,blocks:a,onBlocksChange:s,selectMode:o,selectedBlockId:l}=n,d=i&&s!==void 0;return u.jsxs("div",{className:["hn-note-block","hn-note-checklist-item",d?"hn-note-sortable-block":"",o?"hn-note-selectable-block":""].filter(Boolean).join(" "),id:t.id,"data-note-block-id":e.id,...d?{"data-note-sortable-id":t.id}:{},...i?{"data-note-drag-kind":"checklist-item","data-note-drag-parent-id":e.id}:{},...o?{"data-note-select-id":t.id,role:"option","aria-selected":l===t.id,tabIndex:0}:{},children:[r&&e.title?u.jsxs("div",{className:"hn-note-section-header hn-note-structured-header hn-note-checklist-title",children:[u.jsx("span",{className:"hn-note-chip",children:"Checklist"}),u.jsx("h3",{"data-note-region-id":`block:${e.id}:title`,children:e.title})]}):null,mn(e,n,{kind:"checklist-item",blockId:e.id,itemId:t.id}),u.jsxs("div",{className:"hn-note-checklist-content hn-note-checklist-item",children:[i?u.jsx("button",{type:"button","aria-label":t.checked?"标记为未完成":"标记为已完成",className:["hn-note-checkbox","hn-note-checkbox--editable",t.checked?"hn-note-checkbox--checked":""].filter(Boolean).join(" "),onClick:()=>s?.(V4(a,e.id,t.id)),children:t.checked?"●":"○"}):u.jsx("span",{"aria-hidden":"true",className:`hn-note-checkbox ${t.checked?"hn-note-checkbox--checked":""}`,children:t.checked?"●":"○"}),i?u.jsx("span",{...Hn(c=>s?.(Y4(a,e.id,t.id,c.innerHTML))),onKeyDown:c=>Zi({ctx:n,event:c,mode:"rich-text",sourceId:t.id}),"data-editable-block-id":t.id,"data-note-region-id":`block:${t.id}`,role:"textbox",tabIndex:0,...Et(t.text)}):u.jsx("span",{"data-note-region-id":`block:${t.id}`,...Et(t.text)})]})]},t.id)},yh=({block:e,ctx:t})=>{const{editable:n,onBlocksChange:r,selectMode:i,selectedBlockId:a}=t,s=n&&r!==void 0;return e.items.length===0?u.jsx("div",{className:["hn-note-block hn-note-checklist-empty",s?"hn-note-sortable-block":"",i?"hn-note-selectable-block":""].filter(Boolean).join(" "),id:e.id,"data-note-block-id":e.id,...s?{"data-note-sortable-id":e.id,"data-note-drag-kind":"block"}:{},...i?{"data-note-select-id":e.id,role:"option","aria-selected":a===e.id,tabIndex:0}:{},children:e.title?u.jsxs("div",{className:"hn-note-section-header hn-note-structured-header hn-note-checklist-title",children:[u.jsx("span",{className:"hn-note-chip",children:"Checklist"}),u.jsx("h3",{children:e.title})]}):null}):u.jsx(u.Fragment,{children:e.items.map((o,l)=>u.jsx(K4,{block:e,item:o,ctx:t,showTitle:l===0},o.id))})},Z4=({block:e,ctx:t})=>{const{editable:n,blocks:r,onBlocksChange:i}=t;return u.jsxs(u.Fragment,{children:[mn(e,t),u.jsxs("aside",{className:`hn-note-callout hn-note-callout--${e.tone}`,children:[u.jsxs("div",{className:"hn-note-callout-title-row",children:[u.jsx("span",{className:"hn-note-chip hn-note-chip--strong",children:cf[e.tone]}),n?u.jsx("strong",{...Hn(a=>i?.(z4(r,e.id,a.innerHTML))),...Et(e.title),"data-note-region-id":`block:${e.id}:title`}):u.jsx("strong",{"data-note-region-id":`block:${e.id}:title`,...Et(e.title)})]}),n?u.jsx("p",{...Hn(a=>i?.(wa(r,e.id,a.innerHTML))),onKeyDown:a=>Zi({ctx:t,event:a,mode:"rich-text",sourceId:e.id}),"data-editable-block-id":e.id,"data-note-region-id":`block:${e.id}`,...Et(e.text)}):u.jsx("p",{"data-note-region-id":`block:${e.id}`,...Et(e.text)})]})]})};var J4=Object.create,bh=Object.defineProperty,Q4=Object.getOwnPropertyDescriptor,eg=Object.getOwnPropertyNames,tg=Object.getPrototypeOf,ng=Object.prototype.hasOwnProperty,rg=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),ig=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(var i=eg(t),a=0,s=i.length,o;a<s;a++)o=i[a],!ng.call(e,o)&&o!==n&&bh(e,o,{get:(l=>t[l]).bind(null,o),enumerable:!(r=Q4(t,o))||r.enumerable});return e},ag=(e,t,n)=>(n=e==null?{}:J4(tg(e)),ig(bh(n,"default",{value:e,enumerable:!0}),e)),sg=ag(rg(((e,t)=>{(function(n,r){typeof define=="function"&&define.amd?define(r):typeof t=="object"&&t.exports?t.exports=r():n.log=r()})(e,function(){var n=function(){},r="undefined",i=typeof window!==r&&typeof window.navigator!==r&&/Trident\/|MSIE /.test(window.navigator.userAgent),a=["trace","debug","info","warn","error"],s={},o=null;function l(w,E){var S=w[E];if(typeof S.bind=="function")return S.bind(w);try{return Function.prototype.bind.call(S,w)}catch{return function(){return Function.prototype.apply.apply(S,[w,arguments])}}}function d(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function c(w){return w==="debug"&&(w="log"),typeof console===r?!1:w==="trace"&&i?d:console[w]===void 0?console.log===void 0?n:l(console,"log"):l(console,w)}function f(){for(var w=this.getLevel(),E=0;E<a.length;E++){var S=a[E];this[S]=E<w?n:this.methodFactory(S,w,this.name)}if(this.log=this.debug,typeof console===r&&w<this.levels.SILENT)return"No console available for logging"}function g(w){return function(){typeof console!==r&&(f.call(this),this[w].apply(this,arguments))}}function y(w,E,S){return c(w)||g.apply(this,arguments)}function x(w,E){var S=this,R,L,P,B="loglevel";typeof w=="string"?B+=":"+w:typeof w=="symbol"&&(B=void 0);function O(D){var q=(a[D]||"silent").toUpperCase();if(!(typeof window===r||!B)){try{window.localStorage[B]=q;return}catch{}try{window.document.cookie=encodeURIComponent(B)+"="+q+";"}catch{}}}function _(){var D;if(!(typeof window===r||!B)){try{D=window.localStorage[B]}catch{}if(typeof D===r)try{var q=window.document.cookie,K=encodeURIComponent(B),fe=q.indexOf(K+"=");fe!==-1&&(D=/^([^;]+)/.exec(q.slice(fe+K.length+1))[1])}catch{}return S.levels[D]===void 0&&(D=void 0),D}}function F(){if(!(typeof window===r||!B)){try{window.localStorage.removeItem(B)}catch{}try{window.document.cookie=encodeURIComponent(B)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function $(D){var q=D;if(typeof q=="string"&&S.levels[q.toUpperCase()]!==void 0&&(q=S.levels[q.toUpperCase()]),typeof q=="number"&&q>=0&&q<=S.levels.SILENT)return q;throw TypeError("log.setLevel() called with invalid level: "+D)}S.name=w,S.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},S.methodFactory=E||y,S.getLevel=function(){return P??L??R},S.setLevel=function(D,q){return P=$(D),q!==!1&&O(P),f.call(S)},S.setDefaultLevel=function(D){L=$(D),_()||S.setLevel(D,!1)},S.resetLevel=function(){P=null,F(),f.call(S)},S.enableAll=function(D){S.setLevel(S.levels.TRACE,D)},S.disableAll=function(D){S.setLevel(S.levels.SILENT,D)},S.rebuild=function(){if(o!==S&&(R=$(o.getLevel())),f.call(S),o===S)for(var D in s)s[D].rebuild()},R=$(o?o.getLevel():"WARN");var j=_();j!=null&&(P=$(j)),f.call(S)}o=new x,o.getLogger=function(w){if(typeof w!="symbol"&&typeof w!="string"||w==="")throw TypeError("You must supply a name when creating a logger.");var E=s[w];return E||=s[w]=new x(w,o.methodFactory),E};var k=typeof window===r?void 0:window.log;return o.noConflict=function(){return typeof window!==r&&window.log===o&&(window.log=k),o},o.getLoggers=function(){return s},o.default=o,o})}))());function zc(e){let t=e.reduce((n,r)=>({x:n.x+r.x,y:n.y+r.y}),{x:0,y:0});return{x:t.x/e.length,y:t.y/e.length}}function Ga(e,t){return Math.hypot(t.x-e.x,t.y-e.y)}function jc(e,t,n,r){let i={y:t.y-e.y,x:t.x-e.x},a={y:r.y-n.y,x:r.x-n.x};return(Math.atan2(a.y,a.x)-Math.atan2(i.y,i.x))*180/Math.PI}function og(e,t){let n=zc(t.map(i=>i.startPoint)),r=zc(t.map(i=>i.currentPoint));return{x:e.x+r.x-n.x,y:e.y+r.y-n.y}}function lg(e,t){if(e.length>=2)return jc(e[0].startPoint,e[1].startPoint,e[0].currentPoint,e[1].currentPoint);let n=e[0];return n?jc(n.startPoint,t,n.currentPoint,t):0}function cg(e,t){if(e.length>=2){let a=Ga(e[0].startPoint,e[1].startPoint),s=Ga(e[0].currentPoint,e[1].currentPoint);return a===0?1:s/a}let n=e[0];if(!n)return 1;let r=Ga(n.startPoint,t),i=Ga(n.currentPoint,t);return r===0?1:i/r}var ir;(function(e){e.Start="start",e.Move="move",e.End="end",e.Cancel="cancel"})(ir||={});var Pi;(function(e){e.Idle="idle",e.Start="start",e.Move="move",e.End="end",e.Cancel="cancel"})(Pi||={});function Xa(e){return{...e,position:{...e.position}}}var ug=class{options;pointers=new Map;initialPose;anchorCenter;constructor(t){this.options=t}reset(){this.pointers.clear(),this.initialPose=void 0,this.anchorCenter=void 0}process(t,n){let r=n.features??this.options.features;if(t.phase===ir.Start)return this.beginPointer(t,n.pose,n.anchorCenter),this.buildSnapshot(Pi.Start,n.pose);let i=this.pointers.get(t.pointerId);if(!i)return this.buildSnapshot(Pi.Idle,n.pose);this.updatePointer(i,t,n);let a=this.resolvePhase(t.phase),s=this.computePose(n.pose,r),o=this.buildSnapshot(a,s);return(t.phase===ir.End||t.phase===ir.Cancel)&&this.finishPointer(t.pointerId,s,n.anchorCenter),o}beginPointer(t,n,r){for(let i of this.pointers.values())i.startPoint={...i.currentPoint},i.startTimestamp=i.currentTimestamp;this.initialPose=Xa(n),this.anchorCenter=r,this.pointers.set(t.pointerId,{pointerId:t.pointerId,startPoint:{...t.point},currentPoint:{...t.point},startTimestamp:t.timestamp,currentTimestamp:t.timestamp,pressure:t.pressure})}updatePointer(t,n,r){t.currentPoint={...n.point},t.currentTimestamp=n.timestamp,t.pressure=n.pressure,this.initialPose||=Xa(r.pose),r.anchorCenter&&(this.anchorCenter=r.anchorCenter)}resolvePhase(t){return t===ir.Move?Pi.Move:t===ir.Cancel?Pi.Cancel:Pi.End}finishPointer(t,n,r){let i=this.pointers.get(t);if(this.pointers.delete(t),this.pointers.size>0&&i){this.initialPose=Xa(n),this.anchorCenter=r??this.anchorCenter;for(let a of this.pointers.values())a.startPoint={...a.currentPoint},a.startTimestamp=a.currentTimestamp}this.pointers.size===0&&(this.initialPose=void 0,this.anchorCenter=void 0)}computePose(t,n){let r=Xa(this.initialPose??t),i=[...this.pointers.values()];if(i.length===0)return r;if(n.drag&&(r.position=og(r.position,i)),n.rotate){let a=this.anchorCenter??{x:r.position.x+r.width/2,y:r.position.y+r.height/2};r.rotation=(this.initialPose?.rotation||0)+lg(i,a)}if(n.scale){let a=this.anchorCenter??{x:r.position.x+r.width/2,y:r.position.y+r.height/2};r.scale=(this.initialPose?.scale||1)+(cg(i,a)-1)*(this.initialPose?.scale||1)}return r}buildSnapshot(t,n){return{phase:t,pose:n,activePointers:[...this.pointers.values()].map(r=>({pointerId:r.pointerId,startPoint:{...r.startPoint},currentPoint:{...r.currentPoint},startTimestamp:r.startTimestamp,currentTimestamp:r.currentTimestamp,pressure:r.pressure}))}}},Fc=.007,_c=5e-4,$c=1e-7,dg=10;function X0(e,t){return n=>e*n-.5*t*n**2}function hg(e){let t=e.at(-1),n=e.at(-2);if(!t||!n)return;let r=Math.hypot(t.pose.position.x-n.pose.position.x,t.pose.position.y-n.pose.position.y);if(r<=1)return;let i=t.time-n.time;if(i<=0)return;let a=r/i,s=X0(a,Fc),o={x:(t.pose.position.x-n.pose.position.x)/r,y:(t.pose.position.y-n.pose.position.y)/r},l=a/Fc;return d=>{let c=s(d);if(!(d>l||c<0))return{x:t.pose.position.x+o.x*c,y:t.pose.position.y+o.y*c}}}function fg(e){let t=e.at(-1),n=e.at(-2);if(!t||!n||t.pose.rotation===void 0||n.pose.rotation===void 0)return;let r=t.pose.rotation-n.pose.rotation;if(r===0)return;let i=t.time-n.time;if(i<=0)return;let a=r/i,s=X0(a,_c),o=Math.abs(a/_c);return l=>{if(!(l>o))return(t.pose.rotation||0)+s(l)}}function mg(e){let t=e.at(-1),n=e.at(-2);if(!t||!n||t.pose.scale===void 0||n.pose.scale===void 0)return;let r=t.pose.scale-n.pose.scale;if(r===0)return;let i=t.time-n.time;if(i<=0)return;let a=r/i,s=X0(a,$c),o=Math.abs(a/$c);return l=>{let d=s(l);if(!(l>o||Math.abs(d)>dg))return(t.pose.scale||1)*(d+1)}}function pg(e){let t=hg(e),n=fg(e),r=mg(e);return i=>{let a={position:t?.(i),rotation:n?.(i),scale:r?.(i)};if(!(a.position===void 0&&a.rotation===void 0&&a.scale===void 0))return a}}function Hc(e){return Math.min(Math.max(e,0),1)}function gg(e){let t=e.pressure;if(typeof t=="number")return t;let n=e.webkitForce;return typeof n=="number"?n:void 0}function xh(e){if(e.pointerType==="mouse"){let n=e.webkitForce;return typeof n=="number"&&n>0?Hc(n):e.buttons>0?.5:void 0}let t=gg(e);return typeof t=="number"?Hc(t):void 0}function So(e,t){return{pointerId:e.pointerId,point:{x:e.clientX,y:e.clientY},phase:t,timestamp:e.timeStamp,pressure:xh(e),pointerType:e.pointerType,isPrimary:e.isPrimary}}function Va(e){let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function qc(e,t,n){let r=window.getComputedStyle(e);if(r.boxSizing==="border-box")return`${n}px`;let i=Va(t==="width"?r.paddingLeft:r.paddingTop),a=Va(t==="width"?r.paddingRight:r.paddingBottom),s=Va(t==="width"?r.borderLeftWidth:r.borderTopWidth),o=Va(t==="width"?r.borderRightWidth:r.borderBottomWidth);return`${Math.max(n-i-a-s-o,0)}px`}function wh(e,t,n){return t.exec(e)?.[1]===void 0?`${e}${n}`:e.replace(t,n)||""}function vg(e,t){Object.hasOwn(t,"position")&&t.position!==void 0&&(e.style.left=`${t.position.x}px`,e.style.top=`${t.position.y}px`)}function yg(e,t){Object.hasOwn(t,"rotation")&&t.rotation!==void 0&&(e.style.transform=wh(e.style.transform,/rotate\((-?\d+(?:\.\d+)?)deg\)/,`rotate(${t.rotation||0}deg)`))}function bg(e,t){Object.hasOwn(t,"scale")&&t.scale!==void 0&&(e.style.transform=wh(e.style.transform,/scale\((-?\d+(?:\.\d+)?)\)/,`scale(${t.scale||1})`))}function xg(e,t){(Object.hasOwn(t,"width")&&t.width!==void 0||Object.hasOwn(t,"height")&&t.height!==void 0)&&(Object.hasOwn(t,"width")&&t.width!==void 0&&(e.style.width=qc(e,"width",t.width)),Object.hasOwn(t,"height")&&t.height!==void 0&&(e.style.height=qc(e,"height",t.height)))}function wg(e){let t=e.offsetWidth,n=e.offsetHeight,r=Number(/scale\((-?\d+(?:\.\d+)?)\)/.exec(e.style.transform)?.[1])||1;return{position:{x:Number.parseFloat(e.style.left||"0"),y:Number.parseFloat(e.style.top||"0")},rotation:Number(/rotate\((-?\d+(?:\.\d+)?)deg\)/.exec(e.style.transform)?.[1])||0,width:t,height:n,scale:r}}function kg(e,t){vg(e,t),yg(e,t),bg(e,t),xg(e,t)}function Eo(e){let t=e.getBoundingClientRect();return{x:t.x+t.width/2,y:t.y+t.height/2}}var Zn;(function(e){e.Start="start",e.Move="move",e.End="end"})(Zn||={});var Sg=class{options;path=[];eventListeners=new Map;isDestroyed=!1;isMoving=!1;pointerId;constructor(t,n={}){this.options=n,this.pointerId=t.pointerId,this.record(Zn.Start,t)}record(t,n){let r={point:{x:n.clientX,y:n.clientY},timestamp:n.timeStamp,type:t,pressure:xh(n),event:n};return this.path.push(r),t===Zn.Move&&(this.isMoving=!0),this.eventListeners.get(t)?.forEach(i=>{i(r)}),t===Zn.End&&this.destroy(),r}getPath(t){return t?this.path.filter(n=>n.type===t):this.path}getLastOperation(t){return t?this.path.filter(n=>n.type===t).at(-1):this.path.at(-1)}addEventListener(t,n){let r=this.eventListeners.get(t)||[];r.push(n),this.eventListeners.set(t,r)}removeEventListener(t,n){if(!n){this.eventListeners.set(t,[]);return}this.eventListeners.set(t,(this.eventListeners.get(t)||[]).filter(r=>r!==n))}getIsMoving(){return this.isMoving}getIsDestroyed(){return this.isDestroyed}destroy(){this.isDestroyed||(this.isDestroyed=!0,this.options.onDestroy?.(this))}},xt;(function(e){e.Start="start",e.Move="move",e.End="end",e.Inertial="inertial",e.InertialEnd="inertialEnd",e.AllEnd="allEnd"})(xt||={});var Eg=class{element;options;controller;gestureFeatures;fingers=new Map;poses=[];events=new Map;currentOperationType=xt.End;isEnabled=!0;isPassive=!1;isDestroyed=!1;inertialFrameId=null;constructor(t,n={},r={drag:!0}){this.element=t,this.options=n,this.gestureFeatures=r,this.controller=new ug({features:r}),this.isPassive=!!n.passive,this.element.style.touchAction="none",this.element.addEventListener("pointerdown",this.handlePointerDown),document.addEventListener("pointermove",this.handlePointerMove),document.addEventListener("pointerup",this.handlePointerEnd),document.addEventListener("pointercancel",this.handlePointerCancel)}destroy(){this.isDestroyed=!0,this.element.removeEventListener("pointerdown",this.handlePointerDown),document.removeEventListener("pointermove",this.handlePointerMove),document.removeEventListener("pointerup",this.handlePointerEnd),document.removeEventListener("pointercancel",this.handlePointerCancel),this.inertialFrameId!==null&&(cancelAnimationFrame(this.inertialFrameId),this.inertialFrameId=null),this.fingers.clear(),this.controller.reset()}getPose(t){return this.options.getPose?.(t)||wg(t)}setPose(t,n,r){r===xt.End&&this.options.setPoseOnEnd?this.options.setPoseOnEnd(t,n):this.options.setPose?this.options.setPose(t,n):kg(t,n);let i=this.getPose(t);this.poses.push({pose:{...i,...n,position:n.position||i.position},time:Date.now()})}getGlobalPose(t){let n=this.getPose(t),r=t.getBoundingClientRect();return{...n,width:r.width,height:r.height,position:{x:r.x,y:r.y}}}resolveGestureFeatures(t){return this.gestureFeatures}addEventListener(t,n){let r=this.events.get(t)??[];r.push(n),this.events.set(t,r)}removeEventListener(t,n){if(!n){this.events.set(t,[]);return}this.events.set(t,(this.events.get(t)??[]).filter(r=>r!==n))}trigger(t,n){if(!(!this.isEnabled||this.isDestroyed))for(let r of this.events.get(t)??[])r(n??this.getFingers())}getFingers(){return[...this.fingers.values()]}getCurrentOperationType(){return this.currentOperationType}setCurrentOperationType(t){this.currentOperationType=t}setEnabled(t=!0){this.isEnabled=t}setDisabled(){this.isEnabled=!1}setPassive(t=!0){this.isPassive=t}handlePointerDown=t=>{if(!this.isEnabled||this.isPassive||t.pointerType==="mouse"&&t.button!==0)return;let n=this.options.maxFingerCount??1;if(n!==-1&&this.fingers.size>=n)return;let r=new Sg(t,{onDestroy:a=>{this.fingers.delete(a.pointerId),this.fingers.size===0&&(this.currentOperationType=xt.AllEnd,this.trigger(xt.AllEnd))}});this.fingers.set(t.pointerId,r);let i=this.getPose(this.element);this.poses.push({pose:i,time:t.timeStamp}),this.controller.process(So(t,ir.Start),{pose:i,anchorCenter:Eo(this.element),features:this.resolveGestureFeatures(this.fingers.size)}),this.currentOperationType=xt.Start,this.trigger(xt.Start),sg.default.info(`[DragBase] pointerdown, fingers: ${this.fingers.size}`)};handlePointerMove=t=>{let n=this.fingers.get(t.pointerId);if(!n||!this.isEnabled)return;n.record(Zn.Move,t);let r=this.controller.process(So(t,ir.Move),{pose:this.getPose(this.element),anchorCenter:Eo(this.element),features:this.resolveGestureFeatures(this.fingers.size)});this.currentOperationType=xt.Move,this.setPose(this.element,r.pose,xt.Move),this.trigger(xt.Move)};handlePointerEnd=t=>{this.finishPointer(t,ir.End,Zn.End)};handlePointerCancel=t=>{this.finishPointer(t,ir.Cancel,Zn.End)};finishPointer(t,n,r){let i=this.fingers.get(t.pointerId);if(!i||!this.isEnabled)return;let a=this.fingers.size;i.record(r,t);let s=this.controller.process(So(t,n),{pose:this.getPose(this.element),anchorCenter:Eo(this.element),features:this.resolveGestureFeatures(a)});this.currentOperationType=xt.End,this.setPose(this.element,s.pose,xt.End),this.trigger(xt.End),this.options.inertial&&this.fingers.size===0&&this.runInertial()}runInertial(){let t=pg(this.poses),n=Date.now(),r=()=>{if(this.isDestroyed)return;this.inertialFrameId=null;let i=t(Date.now()-n);if(!i){this.currentOperationType=xt.InertialEnd,this.trigger(xt.InertialEnd);return}this.currentOperationType=xt.Inertial,this.setPose(this.element,i,xt.Inertial),this.trigger(xt.Inertial),this.inertialFrameId=requestAnimationFrame(r)};r()}},Uc=class extends Eg{constructor(t,n){super(t,{...n,maxFingerCount:-1},{drag:!0})}},Tg;(function(e){e.Drag="drag",e.Rotate="rotate",e.Scale="scale"})(Tg||={});function kh(e){return e===void 0||e===""?void 0:e}function Mg(e){let t=new Map;for(let n of e){let r=kh(n.parent);if(r===void 0)continue;let i=t.get(r)??[];i.push(n.id),t.set(r,i)}return t}function V0(e,t){let n=Mg(e),r=[],i=new Set([t]),a=[...n.get(t)??[]];for(;a.length>0;){let s=a.shift();if(!(s===void 0||i.has(s))){i.add(s),r.push(s);for(let o of n.get(s)??[])a.push(o)}}return r}function Cg(e,t,n){let r=kh(n);return r===void 0?!1:r===t||V0(e,t).includes(r)}function Ag(e,t){return t.x>=e.x&&t.x<=e.x+e.width&&t.y>=e.y&&t.y<=e.y+e.height}function Y0(e,t,n,r){let i,a=-1/0,s=-1;for(let[o,l]of e.entries()){if(r?.has(l.id))continue;let d=l.zIndex??0,c=d>a||d===a&&o>s;Ag(l,n)&&c&&!Cg(e,t,l.id)&&(i=l.id,a=d,s=o)}return i}function Wc(e,t){let n=new Set([t,...V0(e,t)]);return new Map(e.filter(r=>n.has(r.id)).map(r=>[r.id,{x:r.x,y:r.y}]))}function Rg(e,t,n){let r;return{cards:e.map(i=>{let a=t.get(i.id);if(a===void 0)return i;let s={...i,x:a.x+n.delta.x,y:a.y+n.delta.y};return i.id===n.draggedCardId&&(r=s),s}),draggedCard:r}}function Ig(e,t,n,r){let i=e.find(f=>f.id===t);if(i===void 0)return{cards:[...e],draggedCard:void 0};let a=Y0(e,t,n,r),s;if(a===void 0){let f={...i};return delete f.parent,s=f,{cards:e.map(g=>g.id===t?f:g),draggedCard:s}}if(i.parent===a)return s=i,{cards:[...e],draggedCard:s};let o=e.find(f=>f.id===a)?.zIndex??0,l=new Set([t,...V0(e,t)]),d=e.reduce((f,g)=>l.has(g.id)?Math.min(f,g.zIndex??0):f,i.zIndex??0),c=d<=o?o+1-d:0;return{cards:e.map(f=>{if(!l.has(f.id))return f;if(f.id===t){let g={...f,parent:a,zIndex:(f.zIndex??0)+c};return s=g,g}return{...f,zIndex:(f.zIndex??0)+c}}),draggedCard:s}}function Ng(e,t,n){let r=e.find(o=>o.id===t);if(r===void 0)return[...e];let i=e.filter(o=>o.parent===t);if(i.length===0)return[...e];let a=r.width,s=r.height;for(let o of i){let l=o.x+o.width,d=o.y+o.height,c=l-r.x+n.right,f=d-r.y+n.bottom;c>a&&(a=c),f>s&&(s=f)}return a===r.width&&s===r.height?[...e]:e.map(o=>o.id===t?{...o,width:a,height:s}:o)}var Lg=[];function K0(e){return e.linkedCardIds??Lg}function Gc(e,t){return Array.from(new Set([...K0(e),t]))}function Pg(e,t,n){if(t===n)return[...e];let r=e.some(a=>a.id===t),i=e.some(a=>a.id===n);return!r||!i?[...e]:e.map(a=>a.id===t?{...a,linkedCardIds:Gc(a,n)}:a.id===n?{...a,linkedCardIds:Gc(a,t)}:a)}function Dg(e,t){let n=e.find(i=>i.id===t);if(n===void 0)return[];let r=new Map(e.map(i=>[i.id,i]));return K0(n).flatMap(i=>{let a=r.get(i);return a===void 0?[]:[a]})}function Bg(e){return`${e.fromId}\0${e.toId}`}function Og(e){let t=new Map(e.map((r,i)=>[r.id,i])),n=new Set;return e.flatMap((r,i)=>K0(r).flatMap(a=>{let s=t.get(a);if(a===r.id||s===void 0)return[];let o=i<s?{fromId:r.id,toId:a}:{fromId:a,toId:r.id},l=Bg(o);return n.has(l)?[]:(n.add(l),[o])}))}function zg(e,t){return t.x>=e.x&&t.x<=e.x+e.width&&t.y>=e.y&&t.y<=e.y+e.height}function jg({cards:e,sourceCardId:t,point:n,movingCardIds:r}){let i,a=-1/0,s=-1;for(let[o,l]of e.entries()){if(l.id===t||r?.has(l.id))continue;let d=l.zIndex??0,c=d>a||d===a&&o>s;zg(l,n)&&c&&(i=l.id,a=d,s=o)}return i}var Xc=13,Fg=50,Vc=13,_g=13;function $g(e){return e===void 0||e===""?void 0:e}function tn(e){return e.childrenLayoutMode??"arrange"}function Hg(e,t,n){if(!(e.parent!==t.parent||e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height||e.childrenLayoutMode!==t.childrenLayoutMode))return!1;let r=e.parent===void 0?void 0:n.find(a=>a.id===e.parent),i=t.parent===void 0?void 0:n.find(a=>a.id===t.parent);return t.childrenLayoutMode==="mind-map-horizontal"||r!==void 0&&tn(r)==="mind-map-horizontal"||i!==void 0&&tn(i)==="mind-map-horizontal"}function qg(e){let t=new Map;for(let n of e){let r=$g(n.parent);if(r===void 0)continue;let i=t.get(r)??[];i.push(n.id),t.set(r,i)}return t}function Ws(e,t){return e.childrenByParent.get(t)??[]}function Ug(e,t,n){return t.reduce((r,i)=>r+Eh(e,i,n),0)}function Sh(e,t,n){return t.length===0?0:Ug(e,t,n)+24*(t.length-1)}function Eh(e,t,n){let r=e.cardById.get(t);if(r===void 0||n.has(t))return 0;if(tn(r)==="free")return r.height;let i=new Set(n);i.add(t);let a=Sh(e,Ws(e,t),i);return Math.max(r.height,a)}function Wg(e,t,n){let r=e.cardById.get(t);r===void 0||r.x===n.x&&r.y===n.y||e.cardById.set(t,{...r,x:n.x,y:n.y})}function hs(e,t,n){let r=e.cardById.get(t);if(r!==void 0){Wg(e,t,{x:r.x+n.x,y:r.y+n.y});for(let i of Ws(e,t))hs(e,i,n)}}function Gg(e,t,n){let r=e.cardById.get(t);if(r===void 0)return;hs(e,t,{x:n.x-r.x,y:n.y-r.y});let i=e.cardById.get(t);i!==void 0&&tn(i)==="mind-map-horizontal"&&Z0(e,t,new Set([t]))}function Z0(e,t,n){let r=e.cardById.get(t);if(r===void 0||tn(r)==="free")return;let i=Ws(e,t);if(i.length===0)return;let a=Sh(e,i,n),s=r.y+r.height/2-a/2;for(let o of i){if(n.has(o))continue;let l=e.cardById.get(o);if(l===void 0)continue;let d=Eh(e,o,n);Gg(e,o,{x:r.x+r.width+48,y:s+d/2-l.height/2}),s+=d+24}}function Th(e,t,n){let r=e.cardById.get(t);if(r===void 0||tn(r)!=="arrange")return;let i=Ws(e,t);if(i.length===0)return;let a=r.x+Xc,s=r.y+Fg,o=r.x+r.width-Vc,l=a,d=s,c=0,f=s;for(let k of i){if(n.has(k))continue;let w=e.cardById.get(k);if(w===void 0)continue;l+w.width>o&&l>a&&(l=a,d+=c+12,c=0);let E=l,S=d,R=E-w.x,L=S-w.y;(R!==0||L!==0)&&hs(e,k,{x:R,y:L});let P=e.cardById.get(k);if(P!==void 0){let O=new Set(n);O.add(k),tn(P)==="arrange"?Th(e,k,O):tn(P)==="mind-map-horizontal"&&Z0(e,k,O)}let B=e.cardById.get(k)??w;l+B.width>o&&l>a&&(l=a,d+=c+12,c=0,hs(e,k,{x:l-B.x,y:d-B.y}),B=e.cardById.get(k)??B),l+=B.width+12,c=Math.max(c,B.height),d+c>f&&(f=d+c)}let g=f+_g-r.y,y=0;for(let k of i){let w=e.cardById.get(k);w!==void 0&&w.width>y&&(y=w.width)}let x=y+Xc+Vc;(g>r.height||x>r.width)&&e.cardById.set(t,{...r,width:Math.max(r.width,x),height:Math.max(r.height,g)})}function Qr(e){let t={cardById:new Map(e.map(n=>[n.id,n])),childrenByParent:qg(e)};for(let n of e)tn(n)==="mind-map-horizontal"&&Z0(t,n.id,new Set([n.id]));for(let n of e)tn(n)==="arrange"&&Th(t,n.id,new Set([n.id]));return e.map(n=>t.cardById.get(n.id)??n)}function Xg(e,t,n,r,i){let a=Ig(e,t,n,r),s=a.draggedCard,o=a.cards;if(s?.parent){let l=o.find(c=>c.id===s.parent),d=l===void 0?"free":tn(l);o=d==="mind-map-horizontal"?Qr(o):d==="arrange"?Qr(Vg(o,t,n)):Ng(o,s.parent,i.contentInset)}return{cards:o,draggedCard:s===void 0?void 0:o.find(l=>l.id===t)??s}}function Vg(e,t,n){let r=e.find(y=>y.id===t);if(r===void 0||r.parent===void 0)return e;let i=r.parent,a=[];for(let y of e)y.parent===i&&y.id!==t&&a.push(y.id);if(a.length===0)return e;let s=new Map(e.map(y=>[y.id,y])),o=y=>{let x=s.get(y);return x===void 0?2**53-1:x.y*1e5+x.x};a.sort((y,x)=>o(y)-o(x));let l=n.y*1e5+n.x,d=a.length;for(let[y,x]of a.entries())if(l<o(x)){d=y;break}let c=[...a.slice(0,d),t,...a.slice(d)],f=[];for(let[y,x]of e.entries())x.parent===i&&f.push(y);let g=[...e];for(let[y,x]of c.entries()){let k=f[y];if(k===void 0)break;let w=s.get(x);w!==void 0&&(g[k]=w)}return g}function Yg(e,t,n,r,i){let a=e.find(f=>f.id===t);if(a===void 0)return{cards:[...e],draggedCard:void 0};let s=a.parent===void 0?void 0:e.find(f=>f.id===a.parent),o=s===void 0?"free":tn(s),l=a.parent!==void 0&&s!==void 0&&(o==="mind-map-horizontal"||o==="arrange"),d=Y0(e,t,n,r);if(!l||d!==void 0)return Xg(e,t,n,r,i);let c=(i.dragStartPosition===void 0?48:Math.hypot(a.x-i.dragStartPosition.x,a.y-i.dragStartPosition.y))<48?Qr(e):Qr(e.map(f=>{if(f.id!==t)return f;let g={...f};return delete g.parent,g}));return{cards:c,draggedCard:c.find(f=>f.id===t)??a}}function Kg(e,t,n){let r=e.map(o=>o.id===t?{...o,width:n.width,height:n.height}:o),i=r.find(o=>o.id===t),a=i?.parent===void 0?void 0:r.find(o=>o.id===i.parent),s=i!==void 0&&(tn(i)==="mind-map-horizontal"||tn(i)==="arrange"||a!==void 0&&(tn(a)==="mind-map-horizontal"||tn(a)==="arrange"))?Qr(r):r;return{cards:s,draggedCard:s.find(o=>o.id===t)}}var Yc=5;function Zg({card:e,cards:t,cardsRef:n,onCardsChangeRef:r,isSelected:i,onSelect:a,options:s,renderCardTitle:o,renderCardContent:l,isParentCandidate:d,setParentCandidateId:c,linkMode:f,onLinkClick:g,onDraggingChange:y,isLinkSource:x,isLinkTarget:k,onLinkDragStart:w,onLinkDragMove:E,onLinkDragEnd:S}){let R=p.useRef(null),L=p.useRef(null),P=p.useRef(null),B=p.useRef(null),O=p.useRef(!1),_=p.useRef(!1),F=p.useRef(e),$=p.useRef(s),j=p.useRef(f),D=p.useRef(a),q=p.useRef(g),K=p.useRef(y),fe=p.useRef(w),de=p.useRef(E),Ce=p.useRef(S),oe=p.useRef(void 0),Ee=p.useRef(void 0),ze=p.useRef(!1),ge=p.useRef(void 0),We=s.requireSelectionToMoveResize?i:!0,Pe=p.useRef(We),st=p.useRef(!1),se=p.useRef(!1);p.useEffect(()=>{F.current=e},[e]),p.useEffect(()=>{$.current=s},[s]),p.useEffect(()=>{j.current=f},[f]),p.useEffect(()=>{D.current=a},[a]),p.useEffect(()=>{q.current=g},[g]),p.useEffect(()=>{K.current=y},[y]),p.useEffect(()=>{fe.current=w},[w]),p.useEffect(()=>{de.current=E},[E]),p.useEffect(()=>{Ce.current=S},[S]),p.useEffect(()=>{if(Pe.current=We,We){P.current?.setEnabled(),B.current?.setEnabled();return}P.current?.setDisabled(),B.current?.setDisabled()},[We]),p.useEffect(()=>{let Q=R.current;if(!Q)return;let je=new Uc(Q,{getPose:()=>{let U=F.current;return{position:{x:U.x,y:U.y},width:U.width,height:U.height,rotation:0,scale:1}}});P.current=je,Pe.current||je.setDisabled();let De=new Map,I=()=>{if(!Q)return{left:13,top:50,right:13,bottom:13};let U=Q.querySelector(".cards-card-canvas__card-content");if(!U)return{left:13,top:50,right:13,bottom:13};let ce=Q.getBoundingClientRect(),be=U.getBoundingClientRect();return{left:be.left-ce.left+12,top:be.top-ce.top+12,right:ce.right-be.right+12,bottom:ce.bottom-be.bottom+12}},ee=U=>{let ce=Ee.current,be=ce===void 0?U:{x:U.x-ce.x,y:U.y-ce.y},Ae=F.current.id;oe.current=be,ge.current=jg({cards:n.current,sourceCardId:Ae,point:be})},G=U=>{ze.current&&ee({x:U.clientX,y:U.clientY})},A=()=>{let U=F.current;Q.style.transform="",Q.style.left=`${U.x}px`,Q.style.top=`${U.y}px`};document.addEventListener("pointermove",G,!0);let z=()=>{if(_.current=!1,De=new Map,oe.current=void 0,Ee.current=void 0,ze.current=!1,ge.current=void 0,st.current=!1,se.current=!1,O.current||!Pe.current)return;let U=F.current.id,ce=F.current,be=Q.getBoundingClientRect();if(Ee.current={x:be.left-ce.x,y:be.top-ce.y},j.current){ze.current=!0,K.current?.(!0),fe.current?.(F.current.id);return}K.current?.(!0),De=Wc(n.current,U);let Ae=ce.parent===void 0?void 0:n.current.find(mt=>mt.id===ce.parent),Ye=Ae===void 0?"free":tn(Ae);st.current=ce.parent!==void 0&&Ae!==void 0&&(Ye==="mind-map-horizontal"||Ye==="arrange"),st.current&&Q.classList.add("cards-card-canvas__card--drag-pending-detach")},X=U=>{if(O.current||!Pe.current||U.length===0)return;let ce=U[0];if(!ce)return;let be=ce.getPath(Zn.Start)[0],Ae=ce.getLastOperation(Zn.Move);if(!Ae)return;let Ye=F.current.id,mt=Ee.current,sn=mt===void 0?Ae.point:{x:Ae.point.x-mt.x,y:Ae.point.y-mt.y};if(oe.current=sn,ze.current){A(),ee(Ae.point),_.current=!0;let Tt=oe.current;Tt!==void 0&&de.current?.(Tt,ge.current);return}if(!r.current||!be||De.size===0)return;let at=Ae.point.x-be.point.x,qt=Ae.point.y-be.point.y;if(st.current&&!se.current){if(Math.sqrt(at*at+qt*qt)<48){_.current=!0;return}se.current=!0,Q.classList.remove("cards-card-canvas__card--drag-pending-detach");let Tt=Qr(n.current.map(Me=>{if(Me.id!==Ye)return Me;let ct={...Me};return delete ct.parent,ct}));n.current=Tt,F.current=Tt.find(Me=>Me.id===Ye)??F.current,r.current(Tt),De=Wc(Tt,Ye)}let rn=Rg(n.current,De,{draggedCardId:Ye,delta:{x:at,y:qt}});rn.draggedCard!==void 0&&(F.current=rn.draggedCard),n.current=rn.cards;let pt=new Set(De.keys());c(Y0(rn.cards,Ye,sn,pt)),r.current(rn.cards),_.current=!0},Z=()=>{if(Q.style.transform="",ze.current){Q.classList.remove("cards-card-canvas__card--drag-pending-detach");let U=F.current.id,ce=ge.current;if(ce!==void 0&&ce!==U){let be=Pg(n.current,U,ce);n.current=be,F.current=be.find(Ae=>Ae.id===U)??F.current,r.current?.(be)}A(),window.requestAnimationFrame(A),K.current?.(!1),Ce.current?.(),De=new Map,oe.current=void 0,Ee.current=void 0,ze.current=!1,ge.current=void 0,_.current=!1;return}if(_.current&&r.current){let U=F.current.id,ce=n.current.find(Ae=>Ae.id===U),be=new Set(De.keys());if(ce!==void 0&&oe.current!==void 0){let Ae=Yg(n.current,U,oe.current,be,{contentInset:I(),dragStartPosition:De.get(U)}),Ye=Ae.cards;F.current=Ae.draggedCard??ce,n.current=Ye,r.current(Ye)}}st.current&&!se.current?(A(),window.requestAnimationFrame(()=>{A(),Q.classList.remove("cards-card-canvas__card--drag-pending-detach")})):Q.classList.remove("cards-card-canvas__card--drag-pending-detach"),c(void 0),K.current?.(!1),De=new Map,oe.current=void 0,Ee.current=void 0,$.current.selectOnMoveEnd&&_.current&&D.current?.(F.current.id),_.current=!1};return je.addEventListener(xt.Start,z),je.addEventListener(xt.Move,X),je.addEventListener(xt.AllEnd,Z),()=>{document.removeEventListener("pointermove",G,!0),je.removeEventListener(xt.Start,z),je.removeEventListener(xt.Move,X),je.removeEventListener(xt.AllEnd,Z),je.destroy(),P.current=null}},[n,r,c]),p.useEffect(()=>{let Q=L.current;if(!Q)return;let je=Z=>{Z.pointerType==="mouse"&&Z.button!==0||Pe.current&&(O.current=!0,P.current?.setDisabled())};Q.addEventListener("pointerdown",je,!0);let De=()=>{O.current=!1,Pe.current&&P.current?.setEnabled(),c(void 0)};document.addEventListener("pointerup",De,!0),document.addEventListener("pointercancel",De,!0);let I=new Uc(Q,{setPose:()=>{}});B.current=I,Pe.current||I.setDisabled();let ee=F.current.width,G=F.current.height,A=!1,z=()=>{if(!Pe.current)return;ee=F.current.width,G=F.current.height;let Z=F.current,U=Z.parent===void 0?void 0:n.current.find(ce=>ce.id===Z.parent);A=Z.parent!==void 0&&U!==void 0&&tn(U)==="mind-map-horizontal",c(void 0)},X=Z=>{if(!Pe.current||!r.current||Z.length===0)return;let U=Z[0];if(!U)return;let ce=U.getPath(Zn.Start)[0],be=U.getLastOperation(Zn.Move);if(!ce||!be)return;let Ae=be.point.x-ce.point.x,Ye=be.point.y-ce.point.y,mt=Math.max(80,ee+Ae),sn=A?Ye*2:Ye,at=Math.max(80,G+sn),qt=F.current.id,rn=Kg(n.current,qt,{width:mt,height:at}),pt=rn.cards;F.current=rn.draggedCard??F.current,n.current=pt,r.current(pt)};return I.addEventListener(xt.Start,z),I.addEventListener(xt.Move,X),I.addEventListener(xt.AllEnd,De),()=>{Q.removeEventListener("pointerdown",je,!0),document.removeEventListener("pointerup",De,!0),document.removeEventListener("pointercancel",De,!0),I.removeEventListener(xt.Start,z),I.removeEventListener(xt.Move,X),I.removeEventListener(xt.AllEnd,De),I.destroy(),B.current=null}},[n,r,c]);let Le=p.useRef(null),he=p.useRef(null),Ne=p.useRef(null),Te=p.useRef(null);p.useEffect(()=>{let Q=Le.current,je=Ne.current;if(!a||!Q&&!je)return;let De=(G,A)=>{let z=U=>{if(U.target instanceof HTMLElement&&U.target.closest(".cards-card-canvas__link-button")){A.current=null;return}if(U.button!==0){A.current=null;return}A.current={x:U.clientX,y:U.clientY}},X=()=>{A.current=null},Z=U=>{if(U.target instanceof HTMLElement&&U.target.closest(".cards-card-canvas__link-button")){A.current=null;return}let ce=A.current;if(A.current=null,ce){let be=U.clientX-ce.x,Ae=U.clientY-ce.y;if(be*be+Ae*Ae>=Yc*Yc)return}a(e.id)};return G.addEventListener("pointerdown",z),G.addEventListener("pointercancel",X),G.addEventListener("click",Z),()=>{G.removeEventListener("pointerdown",z),G.removeEventListener("pointercancel",X),G.removeEventListener("click",Z)}},I=Q?De(Q,he):void 0,ee=je?De(je,Te):void 0;return()=>{I?.(),ee?.()}},[e.id,a]);let et=Dg(t,e.id),Oe=(Q,je)=>{Q.preventDefault(),Q.stopPropagation();let De=n.current.find(I=>I.id===e.id);De!==void 0&&q.current?.(je,De),D.current?.(je.id)},Nt=Q=>{Q.stopPropagation()},Ht=Q=>{Q.stopPropagation()},dt=(Q,je)=>{if(Q.key==="Enter"||Q.key===" "){Q.preventDefault(),Q.stopPropagation();let De=n.current.find(I=>I.id===e.id);De!==void 0&&q.current?.(je,De),D.current?.(je.id)}};return u.jsxs("div",{ref:R,className:`cards-card-canvas__card${i?" cards-card-canvas__card--selected":""}${d?" cards-card-canvas__card--parent-candidate":""}${x?" cards-card-canvas__card--link-source":""}${k?" cards-card-canvas__card--link-target":""}`,"data-card-id":e.id,"data-parent-candidate":d?"true":void 0,style:{left:`${e.x}px`,top:`${e.y}px`,width:`${e.width}px`,height:`${e.height}px`,zIndex:e.zIndex},children:[u.jsx("div",{ref:Ne,className:"cards-card-canvas__card-header",style:e.titleStyle,children:o?o(e.title):e.title}),u.jsx("div",{ref:Le,className:"cards-card-canvas__card-content",style:e.contentStyle,children:l?l(e.content):e.content}),et.length>0&&u.jsx("div",{className:"cards-card-canvas__card-footer","data-card-link-footer":!0,children:et.map(Q=>u.jsxs("button",{type:"button",className:"cards-card-canvas__link-button","data-card-link-source-id":e.id,"data-card-link-target-id":Q.id,onClick:je=>Oe(je,Q),onPointerDownCapture:Nt,onPointerDown:Nt,onMouseDown:Ht,onKeyDown:je=>dt(je,Q),children:[u.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[u.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),u.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]}),u.jsx("span",{children:Q.title})]},Q.id))}),u.jsx("div",{ref:L,className:`cards-card-canvas__resize-handle${s.requireSelectionToMoveResize&&!i?" cards-card-canvas__resize-handle--hidden":""}`,"data-card-resize-handle":!0})]})}var Jg=new Set(["cards-card-canvas__card","cards-card-canvas__popover"]),Qg="data-card-canvas-popover-overlay",fs=".cards-card-canvas__popover",e2=`[${Qg}]`,t2=["dialog","grid","listbox","menu","menuitem","option","tree","treeitem"].map(e=>`[role="${e}"]`).join(", ");function f0(e){return e?.split(/\s+/).filter(Boolean)??[]}function n2(e){return Array.from(Jg).some(t=>e.classList.contains(t))}function r2(e){return e.some(t=>t instanceof HTMLElement&&n2(t))}function i2(e){return e.some(t=>t instanceof HTMLElement&&t.closest(e2)!==null)}function a2(){return document.querySelector(fs)!==null}function s2(e){return a2()?e.some(t=>t instanceof HTMLElement&&t.closest(t2)!==null):!1}function o2(e){let t=document.querySelectorAll(`${fs} [aria-controls], ${fs} [aria-owns]`);return Array.from(t).some(n=>[...f0(n.getAttribute("aria-controls")),...f0(n.getAttribute("aria-owns"))].includes(e))}function l2(e){return f0(e.getAttribute("aria-labelledby")).some(t=>document.getElementById(t)?.closest(fs)!==null)}function c2(e){return e.some(t=>t instanceof HTMLElement?t.id!==""&&o2(t.id)||l2(t):!1)}function u2(e){let t=e.composedPath();return r2(t)||i2(t)||s2(t)||c2(t)}function d2(e,t){return e.length===t.length?e.some((n,r)=>{let i=t[r];return i===void 0||n.id!==i.id||n.x!==i.x||n.y!==i.y||n.width!==i.width||n.height!==i.height}):!0}function h2(e,t){return{...e,...t}}function Kc({cards:e,onCardsChange:t,className:n="",children:r,selected:i,onSelect:a,onClearSelection:s,options:o={},renderCardTitle:l,renderCardContent:d,renderPopover:c,linkMode:f,theme:g="light",onLinkClick:y}){let x=f??!1,[k,w]=p.useState(),[E,S]=p.useState(),[R,L]=p.useState(null),P={requireSelectionToMoveResize:o.requireSelectionToMoveResize??!1,selectOnMoveEnd:o.selectOnMoveEnd??!1},B=p.useRef(t);p.useEffect(()=>{B.current=t},[t]);let O=p.useRef(e);p.useEffect(()=>{O.current=e},[e]),p.useEffect(()=>{let j=Qr(e);d2(e,j)&&B.current?.(j)},[e]);let _=p.useRef(s);p.useEffect(()=>{_.current=s},[s]),p.useEffect(()=>{if(!s||!i||i.length===0)return;let j=D=>{u2(D)||_.current?.()};return document.addEventListener("pointerdown",j),()=>{document.removeEventListener("pointerdown",j)}},[s,i]);let F=p.useMemo(()=>Og(e),[e]),$=p.useMemo(()=>e.reduce((j,D)=>Math.max(j,D.zIndex??0),0),[e]);return u.jsx("div",{className:`cards-card-canvas__wrapper ${n}`,"data-theme":g,children:u.jsxs("div",{className:"cards-card-canvas__container",children:[u.jsxs("svg",{className:"cards-card-canvas__connectors","data-card-link-connectors":!0,children:[u.jsx("title",{children:"Card Connectors"}),F.map(j=>{let D=e.find(K=>K.id===j.fromId),q=e.find(K=>K.id===j.toId);return!D||!q?null:u.jsx("line",{"data-card-link-connector":!0,x1:D.x+D.width/2,y1:D.y+D.height/2,x2:q.x+q.width/2,y2:q.y+q.height/2},`${j.fromId}-${j.toId}`)}),e.map(j=>{if(!j.parent)return null;let D=e.find(oe=>oe.id===j.parent);if(!D||tn(D)!=="mind-map-horizontal")return null;let q=D.x+D.width,K=D.y+D.height/2,fe=j.y+j.height/2,de=j.x,Ce=q+48/2;return u.jsx("path",{"data-parent-child-connector":!0,className:"cards-card-canvas__parent-child-connector",d:`M ${q} ${K} L ${Ce} ${K} L ${Ce} ${fe} L ${de} ${fe}`},`pc-${D.id}-${j.id}`)})]}),e.map(j=>{let D=!!c&&(i?.includes(j.id)??!1)&&!E;return u.jsxs(p.Fragment,{children:[u.jsx(Zg,{card:j,cards:e,cardsRef:O,onCardsChangeRef:B,isSelected:i?.includes(j.id)??!1,onSelect:a,options:P,renderCardTitle:l,renderCardContent:d,isParentCandidate:k===j.id,setParentCandidateId:w,linkMode:x,onLinkClick:y,onDraggingChange:q=>S(q?j.id:void 0),isLinkSource:R?.sourceCardId===j.id,isLinkTarget:R?.targetCardId===j.id,onLinkDragStart:q=>{let K=e.find(fe=>fe.id===q);L({sourceCardId:q,point:{x:K?K.x+K.width/2:0,y:K?K.y+K.height/2:0},targetCardId:void 0})},onLinkDragMove:(q,K)=>{L(fe=>fe===null?fe:{...fe,point:q,targetCardId:K})},onLinkDragEnd:()=>L(null)}),D&&u.jsx("div",{className:"cards-card-canvas__popover",style:{left:j.x,top:j.y+j.height+8,zIndex:$+1},children:c(j,q=>{let K=h2(j,q),fe=e.map(Ce=>Ce.id===j.id?K:Ce),de=Hg(j,K,fe)?Qr(fe):fe;t?.(de)})})]},j.id)}),r,R!==null&&(()=>{let j=e.find(K=>K.id===R.sourceCardId);if(!j)return null;let D=j.x+j.width/2,q=j.y+j.height/2;return u.jsxs(u.Fragment,{children:[u.jsx("svg",{className:"cards-card-canvas__link-drag-overlay","aria-hidden":"true",children:u.jsx("line",{className:`cards-card-canvas__link-drag-line${R.targetCardId===void 0?"":" cards-card-canvas__link-drag-line--active"}`,x1:D,y1:q,x2:R.point.x,y2:R.point.y})}),u.jsx("div",{className:"cards-card-canvas__link-drag-circle",style:{left:`${R.point.x-20}px`,top:`${R.point.y-20}px`},children:u.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[u.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),u.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})})]})})()]})})}const f2=({card:e,cards:t,onCardsChange:n})=>u.jsxs("aside",{className:"hn-note-card-inspector",children:[u.jsxs("label",{children:[u.jsx("span",{children:"卡片标题"}),u.jsx("input",{"aria-label":"卡片标题",value:e.title,onChange:r=>n(t.map(i=>i.id===e.id?{...i,title:r.currentTarget.value}:i))})]}),u.jsxs("label",{children:[u.jsx("span",{children:"卡片内容"}),u.jsx("textarea",{"aria-label":"卡片内容",value:e.content,onChange:r=>n(t.map(i=>i.id===e.id?{...i,content:r.currentTarget.value}:i))})]})]}),m2=e=>{const t=new Map(e.map(n=>[n.id,n]));return e.flatMap(n=>(n.linkedCardIds??[]).flatMap(r=>{const i=t.get(r);return i?[{source:n,target:i}]:[]}))},Zc=(e,t)=>{const n={x:e.x+e.width/2,y:e.y+e.height/2},r={x:t.x+t.width/2,y:t.y+t.height/2},i=r.x-n.x,a=r.y-n.y,s=Math.min(i===0?Number.POSITIVE_INFINITY:e.width/2/Math.abs(i),a===0?Number.POSITIVE_INFINITY:e.height/2/Math.abs(a));return Number.isFinite(s)?{x:n.x+i*s,y:n.y+a*s}:n},p2=({cards:e,editable:t,selectedLinkId:n,theme:r,onDelete:i,onSelect:a})=>u.jsx("svg",{className:"hn-note-card-links","aria-label":"卡片连线",children:m2(e).map(({source:s,target:o})=>{const l=`${s.id}:${o.id}`,d=l===n,c=Zc(s,o),f=Zc(o,s);return u.jsxs("g",{children:[u.jsx("line",{className:`hn-note-card-link${d?" hn-note-card-link--selected":""}`,x1:c.x,y1:c.y,x2:f.x,y2:f.y}),u.jsx("line",{className:"hn-note-card-link-hit-area",role:"button","aria-label":`${s.title} 到 ${o.title} 的连线`,"aria-pressed":d,tabIndex:0,x1:c.x,y1:c.y,x2:f.x,y2:f.y,onClick:()=>a(d?void 0:l),onKeyDown:g=>{g.key!=="Enter"&&g.key!==" "||(g.preventDefault(),a(d?void 0:l))}}),d&&t?u.jsx("foreignObject",{className:"hn-note-card-link-popover",x:(c.x+f.x)/2-22,y:(c.y+f.y)/2+8,width:"44",height:"44",children:u.jsx(Is,{theme:r,role:"toolbar","aria-label":"连线操作",children:u.jsx(dn,{className:"hn-note-card-link-delete",type:"button",size:"small",variant:"ghost","aria-label":"删除连线",title:"删除连线",onClick:()=>i(s.id,o.id),children:u.jsx(ss,{name:"delete","aria-hidden":"true"})})})}):null]},l)})}),m0=720,Mh=220,Jc=e=>{if(e.length===0)return{cards:[],width:m0,height:Mh,offsetX:0,offsetY:0};const t=32;let n=e[0]?.x??0,r=e[0]?.y??0,i=(e[0]?.x??0)+(e[0]?.width??0),a=(e[0]?.y??0)+(e[0]?.height??0);for(const l of e.slice(1))n=Math.min(n,l.x),r=Math.min(r,l.y),i=Math.max(i,l.x+l.width),a=Math.max(a,l.y+l.height);const s=t-n,o=t-r;return{cards:e.map(l=>({...l,x:l.x+s,y:l.y+o})),width:i-n+t*2,height:a-r+t*2,offsetX:s,offsetY:o}},g2=(e,t)=>e.map(n=>({...n,x:n.x-t.offsetX,y:n.y-t.offsetY})),v2=(e,t)=>e.map(n=>({...n,x:n.x+t.offsetX,y:n.y+t.offsetY})),y2=(e,t,n)=>e.map(r=>r.id===t&&r.kind==="card"?{...r,data:n}:r),b2=({block:e,ctx:t})=>{const[n,r]=p.useState(!1),[i,a]=p.useState(),[s,o]=p.useState(),[l,d]=p.useState(m0),[c,f]=p.useState(null),g=p.useRef(null),y=p.useMemo(()=>Jc(e.data),[e.data]),x=Math.min(l/y.width,Mh/y.height,1),k=e.data.find($=>$.id===i),w=c?v2(e.data,c):y.cards,E=p.useCallback(()=>{r(!1),a(void 0),o(void 0),f(null)},[]);p.useEffect(()=>{const $=g.current;if(!$||typeof ResizeObserver>"u")return;const j=new ResizeObserver(([D])=>{D&&D.contentRect.width>0&&d(D.contentRect.width)});return j.observe($),()=>j.disconnect()},[]),p.useEffect(()=>{t.openBlockMenuId!==null&&r(!1)},[t.openBlockMenuId]);const S=$=>{t.editable&&t.onBlocksChange?.(y2(t.getBlocks(),e.id,$))},R=$=>{c&&S(g2($,c))},L=($,j)=>{S(e.data.map(D=>D.id===$?{...D,linkedCardIds:(D.linkedCardIds??[]).filter(q=>q!==j)}:D)),o(void 0)},P=()=>{f(Jc(e.data)),r(!0)},B=$=>{$.key!=="Enter"&&$.key!==" "||($.preventDefault(),P())},O={width:y.width,height:y.height,transform:`scale(${x})`},_={"--hn-card-theme":t.themeColor??"var(--hn-theme)"},F={"--hn-drawer-size":"60vh",...t.themeColor?{"--hn-theme":t.themeColor}:{}};return u.jsxs(u.Fragment,{children:[mn(e,t),u.jsx("div",{className:"hn-note-card",children:u.jsxs("div",{ref:g,className:"hn-note-card-preview",role:"button",tabIndex:0,"aria-label":"打开卡片","aria-expanded":n,"aria-haspopup":"dialog",onClick:P,onKeyDown:B,children:[u.jsx("div",{className:"hn-note-card-preview-stage",style:O,inert:!0,children:y.cards.length>0?u.jsx("div",{className:"hn-note-card-canvas","data-theme":t.theme,style:_,children:u.jsx(Kc,{cards:y.cards,theme:t.theme})}):u.jsx("span",{className:"hn-note-card-empty",children:"空卡片画布"})}),u.jsx("span",{className:"hn-note-card-preview-hint",children:"点击打开卡片"})]})}),u.jsxs(td,{open:n,onClose:E,placement:"bottom",className:`hn-note-shell hn-note-shell--${t.theme} hn-note-card-drawer`,style:F,"aria-label":"卡片编辑器",children:[u.jsxs("header",{className:"hn-note-card-drawer-header",children:[u.jsxs("div",{children:[u.jsx("h2",{children:"卡片"}),u.jsx("p",{children:t.editable?"选择卡片后编辑内容":"查看完整卡片画布"})]}),u.jsx("button",{type:"button",onClick:E,children:"完成"})]}),u.jsxs("div",{className:`hn-note-card-drawer-body${t.editable&&k?" hn-note-card-drawer-body--with-inspector":""}`,children:[u.jsx("div",{className:"hn-note-card-drawer-canvas",children:u.jsx("div",{className:"hn-note-card-drawer-stage",style:{width:Math.max(c?.width??y.width,m0),height:Math.max(c?.height??y.height,520)},children:u.jsx("div",{className:"hn-note-card-canvas","data-theme":t.theme,style:_,children:u.jsx(Kc,{cards:w,theme:t.theme,selected:i?[i]:[],onSelect:$=>{a($),o(void 0)},onClearSelection:()=>{a(void 0),o(void 0)},...t.editable?{onCardsChange:R}:{},options:{requireSelectionToMoveResize:!0},children:u.jsx(p2,{cards:w,editable:t.editable,selectedLinkId:s,theme:t.theme,onDelete:L,onSelect:$=>{o($),a(void 0)}})})})})}),t.editable&&k?u.jsx(f2,{card:k,cards:e.data,onCardsChange:S}):null]})]})]})};var To,Qc;function x2(){if(Qc)return To;Qc=1;function e(C){return C instanceof Map?C.clear=C.delete=C.set=function(){throw new Error("map is read-only")}:C instanceof Set&&(C.add=C.clear=C.delete=function(){throw new Error("set is read-only")}),Object.freeze(C),Object.getOwnPropertyNames(C).forEach(H=>{const ae=C[H],xe=typeof ae;(xe==="object"||xe==="function")&&!Object.isFrozen(ae)&&e(ae)}),C}class t{constructor(H){H.data===void 0&&(H.data={}),this.data=H.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function n(C){return C.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function r(C,...H){const ae=Object.create(null);for(const xe in C)ae[xe]=C[xe];return H.forEach(function(xe){for(const ot in xe)ae[ot]=xe[ot]}),ae}const i="</span>",a=C=>!!C.scope,s=(C,{prefix:H})=>{if(C.startsWith("language:"))return C.replace("language:","language-");if(C.includes(".")){const ae=C.split(".");return[`${H}${ae.shift()}`,...ae.map((xe,ot)=>`${xe}${"_".repeat(ot+1)}`)].join(" ")}return`${H}${C}`};class o{constructor(H,ae){this.buffer="",this.classPrefix=ae.classPrefix,H.walk(this)}addText(H){this.buffer+=n(H)}openNode(H){if(!a(H))return;const ae=s(H.scope,{prefix:this.classPrefix});this.span(ae)}closeNode(H){a(H)&&(this.buffer+=i)}value(){return this.buffer}span(H){this.buffer+=`<span class="${H}">`}}const l=(C={})=>{const H={children:[]};return Object.assign(H,C),H};class d{constructor(){this.rootNode=l(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(H){this.top.children.push(H)}openNode(H){const ae=l({scope:H});this.add(ae),this.stack.push(ae)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(H){return this.constructor._walk(H,this.rootNode)}static _walk(H,ae){return typeof ae=="string"?H.addText(ae):ae.children&&(H.openNode(ae),ae.children.forEach(xe=>this._walk(H,xe)),H.closeNode(ae)),H}static _collapse(H){typeof H!="string"&&H.children&&(H.children.every(ae=>typeof ae=="string")?H.children=[H.children.join("")]:H.children.forEach(ae=>{d._collapse(ae)}))}}class c extends d{constructor(H){super(),this.options=H}addText(H){H!==""&&this.add(H)}startScope(H){this.openNode(H)}endScope(){this.closeNode()}__addSublanguage(H,ae){const xe=H.root;ae&&(xe.scope=`language:${ae}`),this.add(xe)}toHTML(){return new o(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function f(C){return C?typeof C=="string"?C:C.source:null}function g(C){return k("(?=",C,")")}function y(C){return k("(?:",C,")*")}function x(C){return k("(?:",C,")?")}function k(...C){return C.map(ae=>f(ae)).join("")}function w(C){const H=C[C.length-1];return typeof H=="object"&&H.constructor===Object?(C.splice(C.length-1,1),H):{}}function E(...C){return"("+(w(C).capture?"":"?:")+C.map(xe=>f(xe)).join("|")+")"}function S(C){return new RegExp(C.toString()+"|").exec("").length-1}function R(C,H){const ae=C&&C.exec(H);return ae&&ae.index===0}const L=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function P(C,{joinWith:H}){let ae=0;return C.map(xe=>{ae+=1;const ot=ae;let At=f(xe),ye="";for(;At.length>0;){const me=L.exec(At);if(!me){ye+=At;break}ye+=At.substring(0,me.index),At=At.substring(me.index+me[0].length),me[0][0]==="\\"&&me[1]?ye+="\\"+String(Number(me[1])+ot):(ye+=me[0],me[0]==="("&&ae++)}return ye}).map(xe=>`(${xe})`).join(H)}const B=/\b\B/,O="[a-zA-Z]\\w*",_="[a-zA-Z_]\\w*",F="\\b\\d+(\\.\\d+)?",$="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",j="\\b(0b[01]+)",D="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",q=(C={})=>{const H=/^#![ ]*\//;return C.binary&&(C.begin=k(H,/.*\b/,C.binary,/\b.*/)),r({scope:"meta",begin:H,end:/$/,relevance:0,"on:begin":(ae,xe)=>{ae.index!==0&&xe.ignoreMatch()}},C)},K={begin:"\\\\[\\s\\S]",relevance:0},fe={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[K]},de={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[K]},Ce={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},oe=function(C,H,ae={}){const xe=r({scope:"comment",begin:C,end:H,contains:[]},ae);xe.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const ot=E("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return xe.contains.push({begin:k(/[ ]+/,"(",ot,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),xe},Ee=oe("//","$"),ze=oe("/\\*","\\*/"),ge=oe("#","$"),We={scope:"number",begin:F,relevance:0},Pe={scope:"number",begin:$,relevance:0},st={scope:"number",begin:j,relevance:0},se={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[K,{begin:/\[/,end:/\]/,relevance:0,contains:[K]}]},Le={scope:"title",begin:O,relevance:0},he={scope:"title",begin:_,relevance:0},Ne={begin:"\\.\\s*"+_,relevance:0};var et=Object.freeze({__proto__:null,APOS_STRING_MODE:fe,BACKSLASH_ESCAPE:K,BINARY_NUMBER_MODE:st,BINARY_NUMBER_RE:j,COMMENT:oe,C_BLOCK_COMMENT_MODE:ze,C_LINE_COMMENT_MODE:Ee,C_NUMBER_MODE:Pe,C_NUMBER_RE:$,END_SAME_AS_BEGIN:function(C){return Object.assign(C,{"on:begin":(H,ae)=>{ae.data._beginMatch=H[1]},"on:end":(H,ae)=>{ae.data._beginMatch!==H[1]&&ae.ignoreMatch()}})},HASH_COMMENT_MODE:ge,IDENT_RE:O,MATCH_NOTHING_RE:B,METHOD_GUARD:Ne,NUMBER_MODE:We,NUMBER_RE:F,PHRASAL_WORDS_MODE:Ce,QUOTE_STRING_MODE:de,REGEXP_MODE:se,RE_STARTERS_RE:D,SHEBANG:q,TITLE_MODE:Le,UNDERSCORE_IDENT_RE:_,UNDERSCORE_TITLE_MODE:he});function Oe(C,H){C.input[C.index-1]==="."&&H.ignoreMatch()}function Nt(C,H){C.className!==void 0&&(C.scope=C.className,delete C.className)}function Ht(C,H){H&&C.beginKeywords&&(C.begin="\\b("+C.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",C.__beforeBegin=Oe,C.keywords=C.keywords||C.beginKeywords,delete C.beginKeywords,C.relevance===void 0&&(C.relevance=0))}function dt(C,H){Array.isArray(C.illegal)&&(C.illegal=E(...C.illegal))}function Q(C,H){if(C.match){if(C.begin||C.end)throw new Error("begin & end are not supported with match");C.begin=C.match,delete C.match}}function je(C,H){C.relevance===void 0&&(C.relevance=1)}const De=(C,H)=>{if(!C.beforeMatch)return;if(C.starts)throw new Error("beforeMatch cannot be used with starts");const ae=Object.assign({},C);Object.keys(C).forEach(xe=>{delete C[xe]}),C.keywords=ae.keywords,C.begin=k(ae.beforeMatch,g(ae.begin)),C.starts={relevance:0,contains:[Object.assign(ae,{endsParent:!0})]},C.relevance=0,delete ae.beforeMatch},I=["of","and","for","in","not","or","if","then","parent","list","value"],ee="keyword";function G(C,H,ae=ee){const xe=Object.create(null);return typeof C=="string"?ot(ae,C.split(" ")):Array.isArray(C)?ot(ae,C):Object.keys(C).forEach(function(At){Object.assign(xe,G(C[At],H,At))}),xe;function ot(At,ye){H&&(ye=ye.map(me=>me.toLowerCase())),ye.forEach(function(me){const Se=me.split("|");xe[Se[0]]=[At,A(Se[0],Se[1])]})}}function A(C,H){return H?Number(H):z(C)?0:1}function z(C){return I.includes(C.toLowerCase())}const X={},Z=C=>{console.error(C)},U=(C,...H)=>{console.log(`WARN: ${C}`,...H)},ce=(C,H)=>{X[`${C}/${H}`]||(console.log(`Deprecated as of ${C}. ${H}`),X[`${C}/${H}`]=!0)},be=new Error;function Ae(C,H,{key:ae}){let xe=0;const ot=C[ae],At={},ye={};for(let me=1;me<=H.length;me++)ye[me+xe]=ot[me],At[me+xe]=!0,xe+=S(H[me-1]);C[ae]=ye,C[ae]._emit=At,C[ae]._multi=!0}function Ye(C){if(Array.isArray(C.begin)){if(C.skip||C.excludeBegin||C.returnBegin)throw Z("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),be;if(typeof C.beginScope!="object"||C.beginScope===null)throw Z("beginScope must be object"),be;Ae(C,C.begin,{key:"beginScope"}),C.begin=P(C.begin,{joinWith:""})}}function mt(C){if(Array.isArray(C.end)){if(C.skip||C.excludeEnd||C.returnEnd)throw Z("skip, excludeEnd, returnEnd not compatible with endScope: {}"),be;if(typeof C.endScope!="object"||C.endScope===null)throw Z("endScope must be object"),be;Ae(C,C.end,{key:"endScope"}),C.end=P(C.end,{joinWith:""})}}function sn(C){C.scope&&typeof C.scope=="object"&&C.scope!==null&&(C.beginScope=C.scope,delete C.scope)}function at(C){sn(C),typeof C.beginScope=="string"&&(C.beginScope={_wrap:C.beginScope}),typeof C.endScope=="string"&&(C.endScope={_wrap:C.endScope}),Ye(C),mt(C)}function qt(C){function H(ye,me){return new RegExp(f(ye),"m"+(C.case_insensitive?"i":"")+(C.unicodeRegex?"u":"")+(me?"g":""))}class ae{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(me,Se){Se.position=this.position++,this.matchIndexes[this.matchAt]=Se,this.regexes.push([Se,me]),this.matchAt+=S(me)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const me=this.regexes.map(Se=>Se[1]);this.matcherRe=H(P(me,{joinWith:"|"}),!0),this.lastIndex=0}exec(me){this.matcherRe.lastIndex=this.lastIndex;const Se=this.matcherRe.exec(me);if(!Se)return null;const Ut=Se.findIndex((Nr,ki)=>ki>0&&Nr!==void 0),Rt=this.matchIndexes[Ut];return Se.splice(0,Ut),Object.assign(Se,Rt)}}class xe{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(me){if(this.multiRegexes[me])return this.multiRegexes[me];const Se=new ae;return this.rules.slice(me).forEach(([Ut,Rt])=>Se.addRule(Ut,Rt)),Se.compile(),this.multiRegexes[me]=Se,Se}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(me,Se){this.rules.push([me,Se]),Se.type==="begin"&&this.count++}exec(me){const Se=this.getMatcher(this.regexIndex);Se.lastIndex=this.lastIndex;let Ut=Se.exec(me);if(this.resumingScanAtSamePosition()&&!(Ut&&Ut.index===this.lastIndex)){const Rt=this.getMatcher(0);Rt.lastIndex=this.lastIndex+1,Ut=Rt.exec(me)}return Ut&&(this.regexIndex+=Ut.position+1,this.regexIndex===this.count&&this.considerAll()),Ut}}function ot(ye){const me=new xe;return ye.contains.forEach(Se=>me.addRule(Se.begin,{rule:Se,type:"begin"})),ye.terminatorEnd&&me.addRule(ye.terminatorEnd,{type:"end"}),ye.illegal&&me.addRule(ye.illegal,{type:"illegal"}),me}function At(ye,me){const Se=ye;if(ye.isCompiled)return Se;[Nt,Q,at,De].forEach(Rt=>Rt(ye,me)),C.compilerExtensions.forEach(Rt=>Rt(ye,me)),ye.__beforeBegin=null,[Ht,dt,je].forEach(Rt=>Rt(ye,me)),ye.isCompiled=!0;let Ut=null;return typeof ye.keywords=="object"&&ye.keywords.$pattern&&(ye.keywords=Object.assign({},ye.keywords),Ut=ye.keywords.$pattern,delete ye.keywords.$pattern),Ut=Ut||/\w+/,ye.keywords&&(ye.keywords=G(ye.keywords,C.case_insensitive)),Se.keywordPatternRe=H(Ut,!0),me&&(ye.begin||(ye.begin=/\B|\b/),Se.beginRe=H(Se.begin),!ye.end&&!ye.endsWithParent&&(ye.end=/\B|\b/),ye.end&&(Se.endRe=H(Se.end)),Se.terminatorEnd=f(Se.end)||"",ye.endsWithParent&&me.terminatorEnd&&(Se.terminatorEnd+=(ye.end?"|":"")+me.terminatorEnd)),ye.illegal&&(Se.illegalRe=H(ye.illegal)),ye.contains||(ye.contains=[]),ye.contains=[].concat(...ye.contains.map(function(Rt){return pt(Rt==="self"?ye:Rt)})),ye.contains.forEach(function(Rt){At(Rt,Se)}),ye.starts&&At(ye.starts,me),Se.matcher=ot(Se),Se}if(C.compilerExtensions||(C.compilerExtensions=[]),C.contains&&C.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return C.classNameAliases=r(C.classNameAliases||{}),At(C)}function rn(C){return C?C.endsWithParent||rn(C.starts):!1}function pt(C){return C.variants&&!C.cachedVariants&&(C.cachedVariants=C.variants.map(function(H){return r(C,{variants:null},H)})),C.cachedVariants?C.cachedVariants:rn(C)?r(C,{starts:C.starts?r(C.starts):null}):Object.isFrozen(C)?r(C):C}var Tt="11.11.1";class Me extends Error{constructor(H,ae){super(H),this.name="HTMLInjectionError",this.html=ae}}const ct=n,ut=r,Ge=Symbol("nomatch"),Ct=7,Lt=function(C){const H=Object.create(null),ae=Object.create(null),xe=[];let ot=!0;const At="Could not find the language '{}', did you forget to load/include a language module?",ye={disableAutodetect:!0,name:"Plain text",contains:[]};let me={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:c};function Se(te){return me.noHighlightRe.test(te)}function Ut(te){let Ie=te.className+" ";Ie+=te.parentNode?te.parentNode.className:"";const Xe=me.languageDetectRe.exec(Ie);if(Xe){const ht=on(Xe[1]);return ht||(U(At.replace("{}",Xe[1])),U("Falling back to no-highlight mode for this block.",te)),ht?Xe[1]:"no-highlight"}return Ie.split(/\s+/).find(ht=>Se(ht)||on(ht))}function Rt(te,Ie,Xe){let ht="",It="";typeof Ie=="object"?(ht=te,Xe=Ie.ignoreIllegals,It=Ie.language):(ce("10.7.0","highlight(lang, code, ...args) has been deprecated."),ce("10.7.0",`Please use highlight(code, options) instead.
|
|
268
|
+
https://github.com/highlightjs/highlight.js/issues/2277`),It=te,ht=Ie),Xe===void 0&&(Xe=!0);const ln={code:ht,language:It};er("before:highlight",ln);const cn=ln.result?ln.result:Nr(ln.language,ln.code,Xe);return cn.code=ln.code,er("after:highlight",cn),cn}function Nr(te,Ie,Xe,ht){const It=Object.create(null);function ln(ue,Re){return ue.keywords[Re]}function cn(){if(!$e.keywords){Pt.addText(kt);return}let ue=0;$e.keywordPatternRe.lastIndex=0;let Re=$e.keywordPatternRe.exec(kt),Ve="";for(;Re;){Ve+=kt.substring(ue,Re.index);const ft=Nn.case_insensitive?Re[0].toLowerCase():Re[0],Kt=ln($e,ft);if(Kt){const[kn,jr]=Kt;if(Pt.addText(Ve),Ve="",It[ft]=(It[ft]||0)+1,It[ft]<=Ct&&(zr+=jr),kn.startsWith("_"))Ve+=Re[0];else{const gn=Nn.classNameAliases[kn]||kn;pn(Re[0],gn)}}else Ve+=Re[0];ue=$e.keywordPatternRe.lastIndex,Re=$e.keywordPatternRe.exec(kt)}Ve+=kt.substring(ue),Pt.addText(Ve)}function Br(){if(kt==="")return;let ue=null;if(typeof $e.subLanguage=="string"){if(!H[$e.subLanguage]){Pt.addText(kt);return}ue=Nr($e.subLanguage,kt,!0,na[$e.subLanguage]),na[$e.subLanguage]=ue._top}else ue=Si(kt,$e.subLanguage.length?$e.subLanguage:null);$e.relevance>0&&(zr+=ue.relevance),Pt.__addSublanguage(ue._emitter,ue.language)}function un(){$e.subLanguage!=null?Br():cn(),kt=""}function pn(ue,Re){ue!==""&&(Pt.startScope(Re),Pt.addText(ue),Pt.endScope())}function ta(ue,Re){let Ve=1;const ft=Re.length-1;for(;Ve<=ft;){if(!ue._emit[Ve]){Ve++;continue}const Kt=Nn.classNameAliases[ue[Ve]]||ue[Ve],kn=Re[Ve];Kt?pn(kn,Kt):(kt=kn,cn(),kt=""),Ve++}}function Mi(ue,Re){return ue.scope&&typeof ue.scope=="string"&&Pt.openNode(Nn.classNameAliases[ue.scope]||ue.scope),ue.beginScope&&(ue.beginScope._wrap?(pn(kt,Nn.classNameAliases[ue.beginScope._wrap]||ue.beginScope._wrap),kt=""):ue.beginScope._multi&&(ta(ue.beginScope,Re),kt="")),$e=Object.create(ue,{parent:{value:$e}}),$e}function pr(ue,Re,Ve){let ft=R(ue.endRe,Ve);if(ft){if(ue["on:end"]){const Kt=new t(ue);ue["on:end"](Re,Kt),Kt.isMatchIgnored&&(ft=!1)}if(ft){for(;ue.endsParent&&ue.parent;)ue=ue.parent;return ue}}if(ue.endsWithParent)return pr(ue.parent,Re,Ve)}function ri(ue){return $e.matcher.regexIndex===0?(kt+=ue[0],1):(Ai=!0,0)}function qn(ue){const Re=ue[0],Ve=ue.rule,ft=new t(Ve),Kt=[Ve.__beforeBegin,Ve["on:begin"]];for(const kn of Kt)if(kn&&(kn(ue,ft),ft.isMatchIgnored))return ri(Re);return Ve.skip?kt+=Re:(Ve.excludeBegin&&(kt+=Re),un(),!Ve.returnBegin&&!Ve.excludeBegin&&(kt=Re)),Mi(Ve,ue),Ve.returnBegin?0:Re.length}function Ra(ue){const Re=ue[0],Ve=Ie.substring(ue.index),ft=pr($e,ue,Ve);if(!ft)return Ge;const Kt=$e;$e.endScope&&$e.endScope._wrap?(un(),pn(Re,$e.endScope._wrap)):$e.endScope&&$e.endScope._multi?(un(),ta($e.endScope,ue)):Kt.skip?kt+=Re:(Kt.returnEnd||Kt.excludeEnd||(kt+=Re),un(),Kt.excludeEnd&&(kt=Re));do $e.scope&&Pt.closeNode(),!$e.skip&&!$e.subLanguage&&(zr+=$e.relevance),$e=$e.parent;while($e!==ft.parent);return ft.starts&&Mi(ft.starts,ue),Kt.returnEnd?0:Re.length}function gr(){const ue=[];for(let Re=$e;Re!==Nn;Re=Re.parent)Re.scope&&ue.unshift(Re.scope);ue.forEach(Re=>Pt.openNode(Re))}let Or={};function Un(ue,Re){const Ve=Re&&Re[0];if(kt+=ue,Ve==null)return un(),0;if(Or.type==="begin"&&Re.type==="end"&&Or.index===Re.index&&Ve===""){if(kt+=Ie.slice(Re.index,Re.index+1),!ot){const ft=new Error(`0 width match regex (${te})`);throw ft.languageName=te,ft.badRule=Or.rule,ft}return 1}if(Or=Re,Re.type==="begin")return qn(Re);if(Re.type==="illegal"&&!Xe){const ft=new Error('Illegal lexeme "'+Ve+'" for mode "'+($e.scope||"<unnamed>")+'"');throw ft.mode=$e,ft}else if(Re.type==="end"){const ft=Ra(Re);if(ft!==Ge)return ft}if(Re.type==="illegal"&&Ve==="")return kt+=`
|
|
269
|
+
`,1;if(Ci>1e5&&Ci>Re.index*3)throw new Error("potential infinite loop, way more iterations than matches");return kt+=Ve,Ve.length}const Nn=on(te);if(!Nn)throw Z(At.replace("{}",te)),new Error('Unknown language: "'+te+'"');const Ia=qt(Nn);let ii="",$e=ht||Ia;const na={},Pt=new me.__emitter(me);gr();let kt="",zr=0,wn=0,Ci=0,Ai=!1;try{if(Nn.__emitTokens)Nn.__emitTokens(Ie,Pt);else{for($e.matcher.considerAll();;){Ci++,Ai?Ai=!1:$e.matcher.considerAll(),$e.matcher.lastIndex=wn;const ue=$e.matcher.exec(Ie);if(!ue)break;const Re=Ie.substring(wn,ue.index),Ve=Un(Re,ue);wn=ue.index+Ve}Un(Ie.substring(wn))}return Pt.finalize(),ii=Pt.toHTML(),{language:te,value:ii,relevance:zr,illegal:!1,_emitter:Pt,_top:$e}}catch(ue){if(ue.message&&ue.message.includes("Illegal"))return{language:te,value:ct(Ie),illegal:!0,relevance:0,_illegalBy:{message:ue.message,index:wn,context:Ie.slice(wn-100,wn+100),mode:ue.mode,resultSoFar:ii},_emitter:Pt};if(ot)return{language:te,value:ct(Ie),illegal:!1,relevance:0,errorRaised:ue,_emitter:Pt,_top:$e};throw ue}}function ki(te){const Ie={value:ct(te),illegal:!1,relevance:0,_top:ye,_emitter:new me.__emitter(me)};return Ie._emitter.addText(te),Ie}function Si(te,Ie){Ie=Ie||me.languages||Object.keys(H);const Xe=ki(te),ht=Ie.filter(on).filter(Dr).map(un=>Nr(un,te,!1));ht.unshift(Xe);const It=ht.sort((un,pn)=>{if(un.relevance!==pn.relevance)return pn.relevance-un.relevance;if(un.language&&pn.language){if(on(un.language).supersetOf===pn.language)return 1;if(on(pn.language).supersetOf===un.language)return-1}return 0}),[ln,cn]=It,Br=ln;return Br.secondBest=cn,Br}function Ji(te,Ie,Xe){const ht=Ie&&ae[Ie]||Xe;te.classList.add("hljs"),te.classList.add(`language-${ht}`)}function mr(te){let Ie=null;const Xe=Ut(te);if(Se(Xe))return;if(er("before:highlightElement",{el:te,language:Xe}),te.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",te);return}if(te.children.length>0&&(me.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(te)),me.throwUnescapedHTML))throw new Me("One of your code blocks includes unescaped HTML.",te.innerHTML);Ie=te;const ht=Ie.textContent,It=Xe?Rt(ht,{language:Xe,ignoreIllegals:!0}):Si(ht);te.innerHTML=It.value,te.dataset.highlighted="yes",Ji(te,Xe,It.language),te.result={language:It.language,re:It.relevance,relevance:It.relevance},It.secondBest&&(te.secondBest={language:It.secondBest.language,relevance:It.secondBest.relevance}),er("after:highlightElement",{el:te,result:It,text:ht})}function Qi(te){me=ut(me,te)}const Qs=()=>{Qn(),ce("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function Ma(){Qn(),ce("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let ni=!1;function Qn(){function te(){Qn()}if(document.readyState==="loading"){ni||window.addEventListener("DOMContentLoaded",te,!1),ni=!0;return}document.querySelectorAll(me.cssSelector).forEach(mr)}function Lr(te,Ie){let Xe=null;try{Xe=Ie(C)}catch(ht){if(Z("Language definition for '{}' could not be registered.".replace("{}",te)),ot)Z(ht);else throw ht;Xe=ye}Xe.name||(Xe.name=te),H[te]=Xe,Xe.rawDefinition=Ie.bind(null,C),Xe.aliases&&Pr(Xe.aliases,{languageName:te})}function Ei(te){delete H[te];for(const Ie of Object.keys(ae))ae[Ie]===te&&delete ae[Ie]}function Ca(){return Object.keys(H)}function on(te){return te=(te||"").toLowerCase(),H[te]||H[ae[te]]}function Pr(te,{languageName:Ie}){typeof te=="string"&&(te=[te]),te.forEach(Xe=>{ae[Xe.toLowerCase()]=Ie})}function Dr(te){const Ie=on(te);return Ie&&!Ie.disableAutodetect}function Ti(te){te["before:highlightBlock"]&&!te["before:highlightElement"]&&(te["before:highlightElement"]=Ie=>{te["before:highlightBlock"](Object.assign({block:Ie.el},Ie))}),te["after:highlightBlock"]&&!te["after:highlightElement"]&&(te["after:highlightElement"]=Ie=>{te["after:highlightBlock"](Object.assign({block:Ie.el},Ie))})}function In(te){Ti(te),xe.push(te)}function Aa(te){const Ie=xe.indexOf(te);Ie!==-1&&xe.splice(Ie,1)}function er(te,Ie){const Xe=te;xe.forEach(function(ht){ht[Xe]&&ht[Xe](Ie)})}function ea(te){return ce("10.7.0","highlightBlock will be removed entirely in v12.0"),ce("10.7.0","Please use highlightElement now."),mr(te)}Object.assign(C,{highlight:Rt,highlightAuto:Si,highlightAll:Qn,highlightElement:mr,highlightBlock:ea,configure:Qi,initHighlighting:Qs,initHighlightingOnLoad:Ma,registerLanguage:Lr,unregisterLanguage:Ei,listLanguages:Ca,getLanguage:on,registerAliases:Pr,autoDetection:Dr,inherit:ut,addPlugin:In,removePlugin:Aa}),C.debugMode=function(){ot=!1},C.safeMode=function(){ot=!0},C.versionString=Tt,C.regex={concat:k,lookahead:g,either:E,optional:x,anyNumberOfTimes:y};for(const te in et)typeof et[te]=="object"&&e(et[te]);return Object.assign(C,et),C},fr=Lt({});return fr.newInstance=()=>Lt({}),To=fr,fr.HighlightJS=fr,fr.default=fr,To}var w2=x2();const lr=Q1(w2);function k2(e){const t=e.regex,n={},r={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},r]});const i={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},a=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),s={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},o={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,i]};i.contains.push(o);const l={match:/\\"/},d={className:"string",begin:/'/,end:/'/},c={match:/\\'/},f={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,n]},g=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],y=e.SHEBANG({binary:`(${g.join("|")})`,relevance:10}),x={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},k=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],w=["true","false"],E={match:/(\/[a-z._-]+)+/},S=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],R=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],L=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],P=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:k,literal:w,built_in:[...S,...R,"set","shopt",...L,...P]},contains:[y,e.SHEBANG(),x,f,a,s,E,o,l,d,c,n]}}const S2=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),E2=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],T2=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],M2=[...E2,...T2],C2=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),A2=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),R2=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),I2=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function N2(e){const t=e.regex,n=S2(e),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},i="and or not only",a=/@-?\w[\w]*(-\w+)*/,s="[a-zA-Z-][a-zA-Z0-9_-]*",o=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[n.BLOCK_COMMENT,r,n.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+s,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+A2.join("|")+")"},{begin:":(:)?("+R2.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+I2.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...o,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...o,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:a},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:i,attribute:C2.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...o,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+M2.join("|")+")\\b"}]}}const eu="[A-Za-z$_][0-9A-Za-z$_]*",L2=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],P2=["true","false","null","undefined","NaN","Infinity"],Ch=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],Ah=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Rh=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],D2=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],B2=[].concat(Rh,Ch,Ah);function O2(e){const t=e.regex,n=(oe,{after:Ee})=>{const ze="</"+oe[0].slice(1);return oe.input.indexOf(ze,Ee)!==-1},r=eu,i={begin:"<>",end:"</>"},a=/<[A-Za-z0-9\\._:-]+\s*\/>/,s={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(oe,Ee)=>{const ze=oe[0].length+oe.index,ge=oe.input[ze];if(ge==="<"||ge===","){Ee.ignoreMatch();return}ge===">"&&(n(oe,{after:ze})||Ee.ignoreMatch());let We;const Pe=oe.input.substring(ze);if(We=Pe.match(/^\s*=/)){Ee.ignoreMatch();return}if((We=Pe.match(/^\s+extends\s+/))&&We.index===0){Ee.ignoreMatch();return}}},o={$pattern:eu,keyword:L2,literal:P2,built_in:B2,"variable.language":D2},l="[0-9](_?[0-9])*",d=`\\.(${l})`,c="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",f={className:"number",variants:[{begin:`(\\b(${c})((${d})|\\.)?|(${d}))[eE][+-]?(${l})\\b`},{begin:`\\b(${c})\\b((${d})\\b|\\.)?|(${d})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},g={className:"subst",begin:"\\$\\{",end:"\\}",keywords:o,contains:[]},y={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,g],subLanguage:"xml"}},x={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,g],subLanguage:"css"}},k={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,g],subLanguage:"graphql"}},w={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,g]},S={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},R=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,y,x,k,w,{match:/\$\d+/},f];g.contains=R.concat({begin:/\{/,end:/\}/,keywords:o,contains:["self"].concat(R)});const L=[].concat(S,g.contains),P=L.concat([{begin:/(\s*)\(/,end:/\)/,keywords:o,contains:["self"].concat(L)}]),B={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:P},O={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,"(",t.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},_={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...Ch,...Ah]}},F={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},$={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[B],illegal:/%/},j={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function D(oe){return t.concat("(?!",oe.join("|"),")")}const q={match:t.concat(/\b/,D([...Rh,"super","import"].map(oe=>`${oe}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},K={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},fe={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},B]},de="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",Ce={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(de)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[B]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:o,exports:{PARAMS_CONTAINS:P,CLASS_REFERENCE:_},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),F,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,y,x,k,w,S,{match:/\$\d+/},f,_,{scope:"attr",match:r+t.lookahead(":"),relevance:0},Ce,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[S,e.REGEXP_MODE,{className:"function",begin:de,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:P}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:a},{begin:s.begin,"on:begin":s.isTrulyOpeningTag,end:s.end}],subLanguage:"xml",contains:[{begin:s.begin,end:s.end,skip:!0,contains:["self"]}]}]},$,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[B,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},K,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[B]},q,j,O,fe,{match:/\$[(.]/}]}}function z2(e){const t={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],i={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:r},contains:[t,n,e.QUOTE_STRING_MODE,i,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}function j2(e){const t=e.regex,n={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},i={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},a={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},s={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},o=/[A-Za-z][A-Za-z0-9+.-]*/,l={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,o,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},d={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},c={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},f=e.inherit(d,{contains:[]}),g=e.inherit(c,{contains:[]});d.contains.push(g),c.contains.push(f);let y=[n,l];return[d,c,f,g].forEach(E=>{E.contains=E.contains.concat(y)}),y=y.concat(d,c),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:y},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:y}]}]},n,a,d,c,{className:"quote",begin:"^>\\s+",contains:y,end:"$"},i,r,l,s,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}const ms="[A-Za-z$_][0-9A-Za-z$_]*",Ih=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],Nh=["true","false","null","undefined","NaN","Infinity"],Lh=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],Ph=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Dh=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Bh=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Oh=[].concat(Dh,Lh,Ph);function F2(e){const t=e.regex,n=(oe,{after:Ee})=>{const ze="</"+oe[0].slice(1);return oe.input.indexOf(ze,Ee)!==-1},r=ms,i={begin:"<>",end:"</>"},a=/<[A-Za-z0-9\\._:-]+\s*\/>/,s={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(oe,Ee)=>{const ze=oe[0].length+oe.index,ge=oe.input[ze];if(ge==="<"||ge===","){Ee.ignoreMatch();return}ge===">"&&(n(oe,{after:ze})||Ee.ignoreMatch());let We;const Pe=oe.input.substring(ze);if(We=Pe.match(/^\s*=/)){Ee.ignoreMatch();return}if((We=Pe.match(/^\s+extends\s+/))&&We.index===0){Ee.ignoreMatch();return}}},o={$pattern:ms,keyword:Ih,literal:Nh,built_in:Oh,"variable.language":Bh},l="[0-9](_?[0-9])*",d=`\\.(${l})`,c="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",f={className:"number",variants:[{begin:`(\\b(${c})((${d})|\\.)?|(${d}))[eE][+-]?(${l})\\b`},{begin:`\\b(${c})\\b((${d})\\b|\\.)?|(${d})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},g={className:"subst",begin:"\\$\\{",end:"\\}",keywords:o,contains:[]},y={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,g],subLanguage:"xml"}},x={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,g],subLanguage:"css"}},k={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,g],subLanguage:"graphql"}},w={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,g]},S={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},R=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,y,x,k,w,{match:/\$\d+/},f];g.contains=R.concat({begin:/\{/,end:/\}/,keywords:o,contains:["self"].concat(R)});const L=[].concat(S,g.contains),P=L.concat([{begin:/(\s*)\(/,end:/\)/,keywords:o,contains:["self"].concat(L)}]),B={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:P},O={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,"(",t.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},_={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...Lh,...Ph]}},F={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},$={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[B],illegal:/%/},j={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function D(oe){return t.concat("(?!",oe.join("|"),")")}const q={match:t.concat(/\b/,D([...Dh,"super","import"].map(oe=>`${oe}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},K={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},fe={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},B]},de="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",Ce={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(de)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[B]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:o,exports:{PARAMS_CONTAINS:P,CLASS_REFERENCE:_},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),F,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,y,x,k,w,S,{match:/\$\d+/},f,_,{scope:"attr",match:r+t.lookahead(":"),relevance:0},Ce,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[S,e.REGEXP_MODE,{className:"function",begin:de,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:P}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:a},{begin:s.begin,"on:begin":s.isTrulyOpeningTag,end:s.end}],subLanguage:"xml",contains:[{begin:s.begin,end:s.end,skip:!0,contains:["self"]}]}]},$,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[B,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},K,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[B]},q,j,O,fe,{match:/\$[(.]/}]}}function _2(e){const t=e.regex,n=F2(e),r=ms,i=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],a={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},s={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:i},contains:[n.exports.CLASS_REFERENCE]},o={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},l=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],d={$pattern:ms,keyword:Ih.concat(l),literal:Nh,built_in:Oh.concat(i),"variable.language":Bh},c={className:"meta",begin:"@"+r},f=(k,w,E)=>{const S=k.contains.findIndex(R=>R.label===w);if(S===-1)throw new Error("can not find mode to replace");k.contains.splice(S,1,E)};Object.assign(n.keywords,d),n.exports.PARAMS_CONTAINS.push(c);const g=n.contains.find(k=>k.scope==="attr"),y=Object.assign({},g,{match:t.concat(r,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,g,y]),n.contains=n.contains.concat([c,a,s,y]),f(n,"shebang",e.SHEBANG()),f(n,"use_strict",o);const x=n.contains.find(k=>k.label==="func.def");return x.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}function $2(e){const t=e.regex,n=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,i={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},a={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},s=e.inherit(a,{begin:/\(/,end:/\)/}),o=e.inherit(e.APOS_STRING_MODE,{className:"string"}),l=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),d={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:r,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[i]},{begin:/'/,end:/'/,contains:[i]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[a,l,o,s,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[a,s,l,o]}]}]},e.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},i,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[l]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[d],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[d],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:t.concat(/</,t.lookahead(t.concat(n,t.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:d}]},{className:"tag",begin:t.concat(/<\//,t.lookahead(t.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}lr.registerLanguage("bash",k2);lr.registerLanguage("css",N2);lr.registerLanguage("javascript",O2);lr.registerLanguage("json",z2);lr.registerLanguage("markdown",j2);lr.registerLanguage("typescript",_2);lr.registerLanguage("xml",$2);const H2=e=>e.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'"),q2=()=>[...lr.listLanguages()].sort(),U2=(e,t)=>{const n=t.trim().toLowerCase();return!n||!lr.getLanguage(n)?H2(e):lr.highlight(e,{language:n,ignoreIllegals:!0}).value},W2=["text",...q2()],tu=e=>(e??"").replaceAll(`\r
|
|
270
|
+
`,`
|
|
271
|
+
`).replaceAll("\r",`
|
|
272
|
+
`),G2=({block:e,ctx:t})=>{const{editable:n,blocks:r,onBlocksChange:i}=t,[a,s]=p.useState(e.code),o=p.useRef(null),l=U2(n?a:e.code,e.language),d=e.language==="text"?"":"hljs";return p.useEffect(()=>{s(e.code)},[e.code]),u.jsxs(u.Fragment,{children:[mn(e,t),u.jsxs("section",{className:"hn-note-code-card",children:[u.jsx("div",{className:"hn-note-code-meta",children:n?u.jsxs(u.Fragment,{children:[u.jsx("select",{className:"hn-note-code-lang-select",value:e.language,"aria-label":"选择代码语言",onChange:c=>i?.(U4(r,e.id,c.target.value)),children:W2.map(c=>u.jsx("option",{value:c,children:c==="text"?"Plain Text":c},c))}),u.jsx("input",{className:"hn-note-code-filename-input",type:"text",value:e.filename??"",size:Math.max(1,(e.filename??"").length),placeholder:"filename...","aria-label":"编辑文件名",onChange:c=>i?.(W4(r,e.id,c.target.value))})]}):u.jsxs(u.Fragment,{children:[u.jsx("span",{children:e.language==="text"?"Plain Text":e.language}),e.filename?u.jsx("span",{children:e.filename}):null]})}),n?u.jsxs("div",{"aria-label":e.filename?`代码编辑器:${e.filename}`:"代码编辑器",className:"hn-note-code-editing","data-note-editor-panel":"code",role:"region",children:[u.jsx("pre",{ref:o,"aria-hidden":"true",className:"hn-note-code-highlight","data-note-region-id":`block:${e.id}`,"data-note-region-profile":"code",children:u.jsx("code",{className:d,...Et(l,"code")})}),u.jsx("textarea",{"aria-label":e.filename?`编辑代码:${e.filename}`:"编辑代码",className:"hn-note-code-editor hn-note-editable",rows:Math.max(1,a.split(`
|
|
273
|
+
`).length),spellCheck:!1,value:a,onBlur:c=>{const f=tu(c.currentTarget.value);s(f),i?.($4(t.getBlocks(),e.id,f))},onChange:c=>s(tu(c.currentTarget.value)),onScroll:c=>{const f=o.current;f&&(f.scrollLeft=c.currentTarget.scrollLeft,f.scrollTop=c.currentTarget.scrollTop)}})]}):u.jsx("pre",{className:"hn-note-code-preview","data-note-region-id":`block:${e.id}`,"data-note-region-profile":"code",children:u.jsx("code",{className:d,...Et(l,"code")})})]})]})},X2=e=>e.kind==="unorderedList",V2=(e,t)=>{const n=e.findIndex(i=>i.id===t);if(n<0)return 1;let r=0;for(let i=n-1;i>=0&&e[i]?.kind==="orderedList";i--)r++;return r+1},ps=({block:e,containerId:t,ctx:n})=>{const{blocks:r,editable:i,onBlocksChange:a,selectMode:s,selectedBlockId:o}=n,l=i&&a!==void 0,d=X2(e),c=d?"hn-note-unordered-list":"hn-note-ordered-list",f=d?"ul":"ol",g=d?void 0:V2(r,e.id);return u.jsxs("div",{className:["hn-note-block","hn-note-list-block",l?"hn-note-sortable-block":"",s?"hn-note-selectable-block":""].filter(Boolean).join(" "),id:e.id,"data-note-block-id":e.id,...t===void 0?{}:{"data-note-drag-container-id":t},...l?{"data-note-sortable-id":e.id,"data-note-drag-kind":"block"}:{},...s?{"data-note-select-id":e.id,role:"option","aria-selected":o===e.id,tabIndex:0}:{},children:[i?mn(e,n):null,u.jsx(f,{className:[c,e.text.trim().length===0?"hn-note-list-empty":""].filter(Boolean).join(" "),...g!==void 0&&g>1?{start:g}:{},children:u.jsx("li",{className:"hn-note-list-item",children:u.jsx("div",{className:"hn-note-list-item-content",children:n.editable?u.jsx("span",{...Hn(y=>a?.(wa(n.getBlocks(),e.id,y.innerHTML))),onKeyDown:y=>Zi({ctx:n,event:y,mode:"rich-text",sourceId:e.id}),"data-editable-block-id":e.id,"data-note-region-id":`block:${e.id}`,role:"textbox",tabIndex:0,...Et(e.text)}):u.jsx("span",{"data-note-region-id":`block:${e.id}`,...Et(e.text)})})})})]})},zh=(e,t,n)=>e.flatMap(r=>{if(r.id!==t||r.kind!=="quote")return[r];const i=n(r);return i===null?[]:[i]}),p0=(e,t,n,r)=>zh(e,t,i=>{const a=[...Jn(i.text)];return a[n]===void 0?i:(a[n]=hn(r),{...i,text:a.join(`
|
|
274
|
+
`)})}),Y2=(e,t,n,r,i)=>zh(e,t,a=>{const s=[...Jn(a.text)];return s[n]===void 0?a:(s.splice(n,1,hn(r),hn(i)),{...a,text:s.join(`
|
|
275
|
+
`)})}),K2=(e,t)=>{const n=document.createRange();n.selectNodeContents(e),n.setEnd(t.startContainer,t.startOffset);const r=document.createElement("div");return r.appendChild(n.cloneContents()),r.innerHTML},Z2=({block:e,ctx:t,event:n,lineIndex:r})=>{const{blocks:i,onBlocksChange:a,requestFocus:s}=t;if(!a)return;const o=n.currentTarget,l=window.getSelection();if(!l||l.rangeCount===0)return;const d=l.getRangeAt(0);if(!o.contains(d.commonAncestorContainer))return;if(n.key==="Enter"&&!n.shiftKey){n.preventDefault(),d.collapsed||d.deleteContents();const y=document.createRange();y.selectNodeContents(o),y.setStart(d.endContainer,d.endOffset);const x=document.createElement("div");x.appendChild(y.extractContents()),a(Y2(i,e.id,r,o.innerHTML,x.innerHTML)),s?.(Cr(e.id,r+1),"start");return}if(n.key==="Enter"&&n.shiftKey){Zi({ctx:t,event:n,mode:"rich-text",sourceId:e.id});return}if(n.key!=="Backspace"||!l.isCollapsed||!Xr(K2(o,d))||!Xr(o.innerHTML))return;n.preventDefault();const c={kind:"quote-line",blockId:e.id,lineId:Cr(e.id,r),lineIndex:r},{blocks:f,focusId:g}=lh({blocks:i,source:c});a(f),s?.(g,"start")},J2=({block:e,line:t,lineIndex:n,ctx:r,showAuthor:i,containerId:a})=>{const{editable:s,blocks:o,onBlocksChange:l,selectMode:d,selectedBlockId:c}=r,f=Cr(e.id,n),g=s&&l!==void 0;return u.jsxs("div",{className:["hn-note-block","hn-note-quote hn-note-quote-line",g?"hn-note-sortable-block":"",d?"hn-note-selectable-block":""].filter(Boolean).join(" "),id:f,"data-note-drag-container-id":a,...g?{"data-note-sortable-id":f,"data-note-block-id":e.id}:{},...s?{"data-note-drag-kind":"quote-line","data-note-drag-parent-id":e.id}:{},...d?{"data-note-select-id":f,role:"option","aria-selected":c===f,tabIndex:0}:{},children:[s?mn(e,r,{kind:"quote-line",blockId:e.id,lineId:f,lineIndex:n}):null,u.jsxs("div",{className:["hn-note-quote-content","hn-note-quote","hn-note-quote-line",n>0?"hn-note-quote-line--continuation":"",i?"hn-note-quote-line--final":""].filter(Boolean).join(" "),children:[s?u.jsx("p",{...Hn(y=>l?.(p0(o,e.id,n,hn(y.innerHTML)))),onKeyDown:y=>Z2({block:e,ctx:r,event:y,lineIndex:n}),"data-editable-block-id":f,"data-note-region-id":`block:${f}`,...Et(t)}):u.jsx("p",{"data-note-region-id":`block:${f}`,...Et(t)}),i&&e.author?s?u.jsx("footer",{...Hn(y=>l?.(j4(o,e.id,y.innerHTML))),...Et(e.author),"data-note-region-id":`block:${e.id}:author`}):u.jsx("footer",{"data-note-region-id":`block:${e.id}:author`,...Et(e.author)}):null]})]},f)},J0=({block:e,ctx:t,containerId:n})=>{const r=Jn(e.text);return u.jsx(u.Fragment,{children:r.map((i,a)=>u.jsx(J2,{block:e,containerId:n,line:i,lineIndex:a,ctx:t,showAuthor:a===r.length-1},Cr(e.id,a)))})},Q2=({block:e,item:t,ctx:n,showTitle:r,containerId:i})=>{const{editable:a,blocks:s,onBlocksChange:o,selectMode:l,selectedBlockId:d}=n,c=a&&o!==void 0;return u.jsxs("div",{className:["hn-note-block","hn-note-todo-item",c?"hn-note-sortable-block":"",l?"hn-note-selectable-block":""].filter(Boolean).join(" "),id:t.id,"data-note-block-id":e.id,"data-note-drag-container-id":i,...c?{"data-note-sortable-id":t.id}:{},...a?{"data-note-drag-kind":"todo-item","data-note-drag-parent-id":e.id}:{},...l?{"data-note-select-id":t.id,role:"option","aria-selected":d===t.id,tabIndex:0}:{},children:[r&&e.title?u.jsxs("div",{className:"hn-note-section-header hn-note-structured-header hn-note-todo-title",children:[u.jsx("span",{className:"hn-note-chip",children:"Todo"}),u.jsx("h3",{"data-note-region-id":`block:${e.id}:title`,children:e.title})]}):null,mn(e,n,{kind:"todo-item",blockId:e.id,itemId:t.id}),u.jsxs("div",{className:"hn-note-todo-content hn-note-todo-item",children:[a?u.jsx("button",{type:"button","aria-label":t.checked?"标记为未完成":"标记为已完成",className:["hn-note-checkbox","hn-note-checkbox--editable",t.checked?"hn-note-checkbox--checked":""].filter(Boolean).join(" "),onClick:()=>o?.(G4(s,e.id,t.id)),children:t.checked?"●":"○"}):u.jsx("span",{"aria-hidden":"true",className:`hn-note-checkbox ${t.checked?"hn-note-checkbox--checked":""}`,children:t.checked?"●":"○"}),a?u.jsx("span",{...Hn(f=>o?.(X4(s,e.id,t.id,f.innerHTML))),onKeyDown:f=>Zi({ctx:n,event:f,mode:"rich-text",sourceId:t.id}),"data-editable-block-id":t.id,"data-note-region-id":`block:${t.id}`,role:"textbox",tabIndex:0,...Et(t.text)}):u.jsx("span",{"data-note-region-id":`block:${t.id}`,...Et(t.text)})]})]},t.id)},Q0=({block:e,ctx:t,containerId:n})=>{const{editable:r,onBlocksChange:i,selectMode:a,selectedBlockId:s}=t,o=r&&i!==void 0;return e.items.length===0?u.jsxs("div",{className:["hn-note-block hn-note-todo-empty",o?"hn-note-sortable-block":"",a?"hn-note-selectable-block":""].filter(Boolean).join(" "),id:e.id,"data-note-block-id":e.id,"data-note-drag-container-id":n,...o?{"data-note-sortable-id":e.id,"data-note-drag-kind":"block"}:{},...a?{"data-note-select-id":e.id,role:"option","aria-selected":s===e.id,tabIndex:0}:{},children:[r?mn(e,t):null,e.title?u.jsxs("div",{className:"hn-note-section-header hn-note-structured-header hn-note-todo-title",children:[u.jsx("span",{className:"hn-note-chip",children:"Todo"}),u.jsx("h3",{children:e.title})]}):null]}):u.jsx(u.Fragment,{children:e.items.map((l,d)=>u.jsx(Q2,{block:e,containerId:n,item:l,ctx:t,showTitle:d===0},l.id))})},Qe="data-note-region-id",Rn="data-note-atomic-id",e5=(e,t)=>{try{return e.intersectsNode(t)}catch{return!1}},gs=e=>(e instanceof Element?e:e.parentElement)?.closest(`[${Qe}], [${Rn}]`)??null,t5=(e,t)=>{const n=document.createRange();return n.selectNode(t),e.compareBoundaryPoints(Range.START_TO_START,n)<=0&&e.compareBoundaryPoints(Range.END_TO_END,n)>=0},ia=e=>{const t=window.getSelection();if(!t||t.rangeCount===0||t.isCollapsed)return null;const n=t.getRangeAt(0);if(!e.contains(n.commonAncestorContainer))return null;const r=Array.from(e.querySelectorAll(`[${Qe}], [${Rn}]`)).filter(s=>e5(n,s)),i=gs(n.startContainer)??r[0]??null,a=gs(n.endContainer)??r[r.length-1]??null;return!i||!a?null:i===a?i.hasAttribute(Rn)&&t5(n,i)?{range:n,start:i,end:a,units:r}:null:{range:n,start:i,end:a,units:r}},n5=e=>{const t=gs(e.startContainer),n=gs(e.endContainer);if(!t||!n)return!1;const r=t.getAttribute(Qe),i=n.getAttribute(Qe);if(!r||!i)return!1;const a=s=>s==="title"?"title":s==="summary"?"summary":"body";return a(r)!==a(i)},Ya=e=>{const t=n=>{const r=n.getAttribute(Qe);return r==="title"?"title":r==="summary"?"summary":"body"};return t(e.start)!==t(e.end)},vs=(e,t,n)=>{const r=e.start.getAttribute(Qe);if(r)return r==="summary"&&n&&!n.summary?{regionId:"title",offset:Yn(n.title)}:{regionId:r,offset:xa(e.start,e.range.startContainer,e.range.startOffset)+Yn(t)};const i=e.end.getAttribute(Qe);return i?{regionId:i,offset:Yn(t)}:null},nu=(e,t,n)=>{if(n)return{html:n.html,text:n.text,internal:t};const r=document.createElement("div");return r.append(e.range.cloneContents()),{html:r.innerHTML,text:e.range.toString(),internal:t}},r5=(e,t,n)=>e.kind==="todo"?u.jsx(Q0,{block:e,containerId:t,ctx:n},e.id):e.kind==="unorderedList"||e.kind==="orderedList"?u.jsx(ps,{block:e,containerId:t,ctx:n},e.id):e.kind==="quote"?u.jsx(J0,{block:e,containerId:t,ctx:n},e.id):u.jsx("div",{className:"hn-note-block hn-note-sortable-block",id:e.id,"data-note-block-id":e.id,"data-note-drag-container-id":t,"data-note-drag-kind":"block","data-note-sortable-id":e.id,...["picture","drawing","card","directory","formula"].includes(e.kind)?{[Rn]:`block:${e.id}`}:{},children:g1(e,n)},e.id),i5=({block:e,ctx:t})=>{const{editable:n,blocks:r,onBlocksChange:i}=t,a={...t,blocks:e.blocks,getBlocks:()=>{const l=t.getBlocks().find(d=>d.id===e.id);return l&&l.kind==="collapsible"?l.blocks:e.blocks},onBlocksChange:i?o=>{const l=t.getBlocks();i(l.map(d=>d.id===e.id&&d.kind==="collapsible"?{...d,blocks:o}:d))}:void 0},s=()=>{i&&i(_4(r,e.id))};return u.jsxs(u.Fragment,{children:[mn(e,t),u.jsxs("div",{className:`hn-note-collapsible${e.collapsed?" hn-note-collapsible--collapsed":""}`,children:[u.jsxs("div",{className:"hn-note-collapsible-header",children:[u.jsx("button",{type:"button",className:"hn-note-collapsible-toggle",onClick:s,"aria-label":e.collapsed?"展开":"收起","aria-expanded":!e.collapsed,tabIndex:-1,children:u.jsx("span",{className:"hn-note-collapsible-caret","aria-hidden":"true",children:"▶"})}),n?u.jsx("div",{...Hn(o=>i?.(F4(r,e.id,o.innerHTML))),className:"hn-note-collapsible-title","data-editable-block-id":e.id,"data-note-region-id":`block:${e.id}:title`,...Et(e.title)}):u.jsx("div",{className:"hn-note-collapsible-title","data-note-region-id":`block:${e.id}:title`,...Et(e.title)})]}),!e.collapsed&&u.jsx("div",{className:"hn-note-collapsible-body","data-note-block-container-id":e.id,children:e.blocks.map(o=>r5(o,e.id,a))})]})]})},a5=({block:e,ctx:t})=>{const n=t.blocks.filter(r=>r.kind==="heading");return u.jsxs(u.Fragment,{children:[mn(e,t),u.jsxs("nav",{className:"hn-note-directory","aria-label":"目录",children:[u.jsx("strong",{className:"hn-note-directory-title",children:"目录"}),n.length===0?u.jsx("p",{className:"hn-note-directory-empty",children:"添加标题后,目录会自动生成。"}):u.jsx("ol",{className:"hn-note-directory-list",children:n.map(r=>u.jsx("li",{className:`hn-note-directory-item hn-note-directory-item--${r.level}`,children:u.jsx("a",{href:`#${r.id}`,children:Xr(r.text)?"未命名标题":u.jsx("span",{...Et(r.text)})})},r.id))})]})]})},or=1e-9,jh=8;function Wr(e,t,n){const r=n.x-t.x,i=n.y-t.y;if(r===0&&i===0){const c=e.x-t.x,f=e.y-t.y;return c*c+f*f}const a=Math.max(0,Math.min(1,((e.x-t.x)*r+(e.y-t.y)*i)/(r*r+i*i))),s=t.x+a*r,o=t.y+a*i,l=e.x-s,d=e.y-o;return l*l+d*d}function s5(e,t,n){const r=n.x-t.x,i=n.y-t.y;if(r===0&&i===0)return{x:t.x,y:t.y};const a=Math.max(0,Math.min(1,((e.x-t.x)*r+(e.y-t.y)*i)/(r*r+i*i)));return{x:t.x+a*r,y:t.y+a*i}}function Fh(e,t){const n=e.x-t.x,r=e.y-t.y;return n*n+r*r}function ei(e,t){if(t.length===0)return 1/0;if(t.length===1){const r=e.x-t[0].x,i=e.y-t[0].y;return r*r+i*i}let n=1/0;for(let r=0;r<t.length-1;r++){const i=Wr(e,t[r],t[r+1]);i<n&&(n=i)}return n}function _h(e,t,n){const r=Math.min(t.x,n.x),i=Math.max(t.x,n.x),a=Math.min(t.y,n.y),s=Math.max(t.y,n.y),o=Math.max(r,Math.min(e.x,i)),l=Math.max(a,Math.min(e.y,s)),d=e.x-o,c=e.y-l;return d*d+c*c}function o5(e,t,n){if(!el(e,t,n))return _h(e,t,n);const r=Math.min(t.x,n.x),i=Math.max(t.x,n.x),a=Math.min(t.y,n.y),s=Math.max(t.y,n.y),o=Math.min(e.x-r,i-e.x,e.y-a,s-e.y);return o*o}function el(e,t,n){const r=Math.min(t.x,n.x),i=Math.max(t.x,n.x),a=Math.min(t.y,n.y),s=Math.max(t.y,n.y);return e.x>=r&&e.x<=i&&e.y>=a&&e.y<=s}function $h(e,t,n){const r=(t.x+n.x)/2,i=(t.y+n.y)/2,a=Math.abs(n.x-t.x)/2,s=Math.abs(n.y-t.y)/2;if(a===0||s===0)return Wr(e,t,n);const o=(e.x-r)/a,l=(e.y-i)/s,d=Math.atan2(l,o),c=r+a*Math.cos(d),f=i+s*Math.sin(d),g=e.x-c,y=e.y-f;return g*g+y*y}function Hh(e,t,n){const r=(t.x+n.x)/2,i=(t.y+n.y)/2,a=Math.abs(n.x-t.x)/2,s=Math.abs(n.y-t.y)/2;if(a===0||s===0)return!1;const o=(e.x-r)/a,l=(e.y-i)/s;return o*o+l*l<=1}function qh(e,t){if(t.length<2)return ei(e,t);let n=ei(e,t);const r=Wr(e,t[t.length-1],t[0]);return r<n&&(n=r),n}const l5=24;function tl(e,t,n,r,i){const a=new Array(i+1);for(let s=0;s<=i;s++){const o=s/i,l=1-o,d=l*l*l,c=3*l*l*o,f=3*l*o*o,g=o*o*o;a[s]={x:d*e.x+c*t.x+f*n.x+g*r.x,y:d*e.y+c*t.y+f*n.y+g*r.y}}return a}function Uh(e,t){if(t.length!==4)return ei(e,t);const n=tl(t[0],t[1],t[2],t[3],l5);return ei(e,n)}function nl(e,t){if(t.length<3)return!1;let n=!1;for(let r=0,i=t.length-1;r<t.length;i=r++){const a=t[r],s=t[i];a.y>e.y!=s.y>e.y&&e.x<(s.x-a.x)*(e.y-a.y)/(s.y-a.y)+a.x&&(n=!n)}return n}function c5(e){const t=new Set;for(const n of e)t.add(`${n.x}:${n.y}`);return t.size}function Di(e){if(e.length===0)return null;let t=e[0].x,n=e[0].y,r=e[0].x,i=e[0].y;for(let a=1;a<e.length;a++){const s=e[a];t=Math.min(t,s.x),n=Math.min(n,s.y),r=Math.max(r,s.x),i=Math.max(i,s.y)}return{minX:t,minY:n,maxX:r,maxY:i}}function g0(e,t){return e===null?null:{minX:e.minX-t,minY:e.minY-t,maxX:e.maxX+t,maxY:e.maxY+t}}function Mo(e){return Number.isFinite(e.minX)&&Number.isFinite(e.minY)&&Number.isFinite(e.maxX)&&Number.isFinite(e.maxY)&&e.minX<=e.maxX&&e.minY<=e.maxY}function u5(e,t){return{minX:Math.min(e.minX,t.minX),minY:Math.min(e.minY,t.minY),maxX:Math.max(e.maxX,t.maxX),maxY:Math.max(e.maxY,t.maxY)}}function d5(e,t){return e.minX<=t.maxX&&e.maxX>=t.minX&&e.minY<=t.maxY&&e.maxY>=t.minY}function rl(e,t){const n=Math.min(e.x,t.x),r=Math.max(e.x,t.x),i=Math.min(e.y,t.y),a=Math.max(e.y,t.y);return[{x:n,y:i},{x:r,y:i},{x:r,y:a},{x:n,y:a}]}function Wh(e,t,n){const r=(e.x+t.x)/2,i=(e.y+t.y)/2,a=Math.abs(t.x-e.x)/2,s=Math.abs(t.y-e.y)/2,o=Math.max(4,Math.floor(n)),l=new Array(o);for(let d=0;d<o;d++){const c=Math.PI*2*d/o;l[d]={x:r+a*Math.cos(c),y:i+s*Math.sin(c)}}return l}function hi(e){const t=[];if(e.length<2)return t;for(let n=0;n<e.length;n++)t.push([e[n],e[(n+1)%e.length]]);return t}function fa(e){const t=[];for(let n=0;n<e.length-1;n++)t.push([e[n],e[n+1]]);return t}function ua(e,t,n){const r=(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x);return Math.abs(r)<=or?0:r>0?1:-1}function Ka(e,t,n){return Math.min(t.x,n.x)-or<=e.x&&e.x<=Math.max(t.x,n.x)+or&&Math.min(t.y,n.y)-or<=e.y&&e.y<=Math.max(t.y,n.y)+or&&ua(t,n,e)===0}function Gh(e,t,n,r){const i=ua(e,t,n),a=ua(e,t,r),s=ua(n,r,e),o=ua(n,r,t);return i!==a&&s!==o?!0:i===0&&Ka(n,e,t)||a===0&&Ka(r,e,t)||s===0&&Ka(e,n,r)||o===0&&Ka(t,n,r)}function h5(e,t,n,r){return Gh(e,t,n,r)?0:Math.min(Wr(e,n,r),Wr(t,n,r),Wr(n,e,t),Wr(r,e,t))}function Xh(e,t){const{points:n,tool:r}=e;if(n.length===0)return{samples:[],segments:[],closedShapePoints:null,bbox:null};if(r==="rect"&&n.length>=2){const a=rl(n[0],n[n.length-1]);return{samples:a,segments:hi(a),closedShapePoints:a,bbox:Di(a)}}if(r==="ellipse"&&n.length>=2){const a=Wh(n[0],n[n.length-1],t.ellipseSegments);return{samples:a,segments:hi(a),closedShapePoints:a,bbox:Di(a)}}if(r==="polygon")return{samples:[...n],segments:hi(n),closedShapePoints:n.length>=3?[...n]:null,bbox:Di(n)};if(r==="bezier"&&n.length===4){const a=tl(n[0],n[1],n[2],n[3],t.bezierSegments);return{samples:a,segments:fa(a),closedShapePoints:null,bbox:Di(a)}}const i=r==="line"&&n.length>=2?n.slice(0,2):[...n];return{samples:i,segments:fa(i),closedShapePoints:null,bbox:Di(i)}}function f5(e,t,n){return t.points.length<2?!1:t.tool==="rect"?el(e,t.points[0],t.points[t.points.length-1]):t.tool==="ellipse"?Hh(e,t.points[0],t.points[t.points.length-1]):t.tool==="polygon"?nl(e,n):!1}function Gs(e){return e.fillColor!==void 0&&e.fillColor!=="none"}function m5(e){return e==="rect"||e==="ellipse"||e==="polygon"}function v0(e){return e===0?0:typeof e=="number"&&Number.isFinite(e)&&e>=0&&e<=1?e:1}function Vh(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:1}function p5(e){return e.tool==="pen"&&e.points.some(t=>t.pressure!==void 0)}function il(e,t){const n=m5(e.tool)?t.closedFallbackWidth:t.openFallbackWidth,r=e.strokeWidth??n;return Number.isFinite(r)?Math.max(0,r):0}function g5(e,t){return il(e,t)/2}function v5(e,t,n,r){const i=il(e,r),a=Math.max(v0(t.pressure),v0(n.pressure)),s=i*a*Vh(r.pressureMultiplier);return Math.max(0,s)/2}function al(e,t){const{points:n,tool:r}=t;return n.length<2?!1:r==="rect"?el(e,n[0],n[n.length-1]):r==="ellipse"?Hh(e,n[0],n[n.length-1]):r==="polygon"?nl(e,n):!1}function ru(e,t){const{points:n,tool:r}=t;return n.length===0?1/0:r==="rect"&&n.length>=2?_h(e,n[0],n[n.length-1]):Gs(t)&&al(e,t)?0:r==="ellipse"&&n.length>=2?$h(e,n[0],n[n.length-1]):r==="polygon"&&n.length>=2?qh(e,n):r==="line"&&n.length>=2?ei(e,n):r==="bezier"?Uh(e,n):ei(e,n)}function y5(e,t){const{points:n,tool:r}=t;return n.length===0?1/0:Gs(t)&&al(e,t)?0:r==="rect"&&n.length>=2?o5(e,n[0],n[n.length-1]):r==="ellipse"&&n.length>=2?$h(e,n[0],n[n.length-1]):r==="polygon"&&n.length>=2?qh(e,n):r==="line"&&n.length>=2?ei(e,n):r==="bezier"?Uh(e,n):ei(e,n)}function b5(e,t,n){const{points:r}=t;if(r.length===0)return 1/0;if(r.length===1){const a=e.x-r[0].x,s=e.y-r[0].y,o=il(t,n)*v0(r[0].pressure)*Vh(n.pressureMultiplier);return Math.hypot(a,s)-Math.max(0,o)/2}let i=1/0;for(let a=0;a<r.length-1;a++){const s=Math.sqrt(Wr(e,r[a],r[a+1])),o=v5(t,r[a],r[a+1],n),l=s-o;l<i&&(i=l)}return i}function x5(e,t,n){return p5(t)?b5(e,t,n):Gs(t)&&al(e,t)?0:Math.sqrt(y5(e,t))-g5(t,n)}function Yh(e){return typeof e=="number"&&Number.isFinite(e)?Math.max(0,e):0}function y0(e,t,n,r){let i=r;for(let a=0;a<t.length;a++){const s=t[a],o=x5(e,s,n);(o<i.distance-or||Math.abs(o-i.distance)<=or&&a<i.strokeIndex)&&(i={stroke:s,distance:o,strokeIndex:a})}return i}function w5(e,t){const n=typeof e.radius=="number"&&Number.isFinite(e.radius)&&e.radius>0?e.radius:8,r=typeof t=="number"&&Number.isFinite(t)&&t>0?t:1;return n/r}function k5(e){const{points:t,tool:n}=e;if(t.length===0)return[];switch(n){case"pen":case"line":return t.length===1?[t[0]]:[t[0],t[t.length-1]];case"rect":return t.length>=2?rl(t[0],t[t.length-1]):[];case"ellipse":return t.length>=2?[{x:(t[0].x+t[t.length-1].x)/2,y:(t[0].y+t[t.length-1].y)/2}]:[];case"polygon":return[...t];case"bezier":return t.length===4?[t[0],t[3]]:[];case"eraser":case"lasso":return[]}}function S5(e){const{points:t,tool:n}=e;if(t.length<2)return[];switch(n){case"pen":case"line":return fa(t);case"rect":return hi(rl(t[0],t[t.length-1]));case"ellipse":return hi(Wh(t[0],t[t.length-1],64));case"polygon":return hi(t);case"bezier":return t.length===4?fa(tl(t[0],t[1],t[2],t[3],64)):fa(t);case"eraser":case"lasso":return[]}}function Kh(e,t,n,r){return n>r?e:e===null||n<e.distanceSq?{...t,distanceSq:n}:e}function E5(e,t,n){let r=null;for(const i of t)for(const a of k5(i))r=Kh(r,{canvas:{x:a.x,y:a.y},kind:"endpoint",strokeId:i.id},Fh(e,a),n);return r}function T5(e,t,n){let r=null;for(const i of t)for(const[a,s]of S5(i)){const o=s5(e,a,s);r=Kh(r,{canvas:o,kind:"line",strokeId:i.id},Fh(e,o),n)}return r}function M5(e,t,n,r){if(!n.enabled)return null;const i=w5(n,r),a=i*i;if(n.endpoints){const o=E5(e,t,a);if(o!==null)return{canvas:o.canvas,kind:o.kind,strokeId:o.strokeId}}if(!n.lines)return null;const s=T5(e,t,a);return s===null?null:{canvas:s.canvas,kind:s.kind,strokeId:s.strokeId}}function C5(e,t){return{...e,strokes:[...e.strokes,t]}}function A5(e,t){return{...e,strokes:e.strokes.filter(n=>n.id!==t)}}function R5(e,t){const n=new Set(t);return{...e,strokes:e.strokes.filter(r=>!n.has(r.id))}}function I5(e,t){return{...e,strokes:e.strokes.map(n=>n.id===t.id?t:n)}}function N5(e,t){const n=new Map(t.map(r=>[r.id,r]));return{...e,strokes:e.strokes.map(r=>n.get(r.id)??r)}}function L5(e,t,n={}){if(e.length===0||t.length===0)return null;const r={ellipseSegments:n.ellipseSegments??48,bezierSegments:n.bezierSegments??48},i=new Set(t);let a=null;for(const o of e){if(!i.has(o.id))continue;const l=Xh(o,r);if(l.bbox===null||!Mo(l.bbox))continue;const d=Math.max(0,o.strokeWidth??0)/2,c=g0(l.bbox,d);c===null||!Mo(c)||(a=a===null?c:u5(a,c))}const s=g0(a,jh);return s===null||!Mo(s)?null:s}function P5(e,t,n={}){if(e.length===0||c5(t)<3)return[];const r={ellipseSegments:n.ellipseSegments??48,bezierSegments:n.bezierSegments??48},i=[...t],a=Di(i);if(a===null)return[];const s=hi(i),o=[];for(const l of e){const d=Xh(l,r);if(d.bbox===null)continue;const c=Math.max(0,l.strokeWidth??0)/2,f=g0(d.bbox,c);if(f===null||!d5(a,f))continue;if(d.samples.some(y=>nl(y,i))){o.push(l.id);continue}if(d.closedShapePoints!==null&&Gs(l)&&i.some(y=>f5(y,l,d.closedShapePoints??[]))){o.push(l.id);continue}let g=!1;for(const[y,x]of d.segments){for(const[k,w]of s){if(Gh(y,x,k,w)){g=!0;break}if(c>0&&h5(y,x,k,w)<c*c){g=!0;break}}if(g)break}g&&o.push(l.id)}return o}function D5(e){return{...e,strokes:[]}}function B5(e,t,n){if(t.length===0)return null;let r=t[0],i=ru(e,t[0]);for(let a=1;a<t.length;a++){const s=ru(e,t[a]);s<i&&(i=s,r=t[a])}if(n!==void 0){const a=n*n;if(i>a)return null}return r}function O5(e,t,n,r){if(n.length===0)return null;const i=Math.hypot(t.x-e.x,t.y-e.y),a=Yh(r.eraserRadius),s=Math.max(.5,a/4),o=Math.max(1,Math.ceil(i/s));let l={stroke:null,distance:1/0,strokeIndex:Number.POSITIVE_INFINITY};for(let d=0;d<=o;d++){const c=o===0?0:d/o,f={x:e.x+c*(t.x-e.x),y:e.y+c*(t.y-e.y)};l=y0(f,n,r,l)}return l.distance<=a+or?l.stroke:null}function iu(e,t,n){if(e.length===0||t.length===0)return null;const r=Yh(n.eraserRadius);if(e.length===1){const s=y0(e[0],t,n,{stroke:null,distance:1/0,strokeIndex:Number.POSITIVE_INFINITY});return s.distance<=r+or?s.stroke:null}const i=Math.max(.5,r/4);let a={stroke:null,distance:1/0,strokeIndex:Number.POSITIVE_INFINITY};for(let s=0;s<e.length-1;s++){const o=e[s],l=e[s+1],d=Math.hypot(l.x-o.x,l.y-o.y),c=Math.max(1,Math.ceil(d/i));for(let f=0;f<=c;f++){const g=c===0?0:f/c,y={x:o.x+g*(l.x-o.x),y:o.y+g*(l.y-o.y)};a=y0(y,t,n,a)}}return a.distance<=r+or?a.stroke:null}const z5={strokes:[]};function j5(e={}){const{value:t,defaultValue:n,onChange:r}=e,i=t!==void 0,[a,s]=p.useState(()=>n?.strokes??[]),o=p.useRef(a),[l,d]=p.useState(null),c=p.useMemo(()=>i?t?.strokes??[]:a,[i,a,t?.strokes]),f=p.useCallback(R=>{if(i){r?.(R(t??z5));return}const L=R({strokes:o.current});o.current=L.strokes,s(L.strokes),r?.(L)},[i,r,t]),g=p.useCallback(R=>{f(L=>C5(L,R))},[f]),y=p.useCallback(R=>{f(L=>A5(L,R))},[f]),x=p.useCallback(R=>{f(L=>R5(L,R))},[f]),k=p.useCallback(R=>{f(L=>I5(L,R))},[f]),w=p.useCallback(R=>{f(L=>N5(L,R))},[f]),E=p.useCallback(()=>{f(D5)},[f]),S=p.useCallback((R,L)=>B5(R,c,L),[c]);return{strokes:c,activeStroke:l,setActiveStroke:d,addStroke:g,removeStroke:y,removeStrokes:x,updateStroke:k,updateStrokes:w,clearStrokes:E,pick:S}}function hr(e){throw new Error(`Unexpected drawing stroke variant: ${JSON.stringify(e)}`)}const F5=10;function di(e){return{phase:"idle",tool:e}}function ka(e){switch(e.phase){case"idle":return e.completedStroke!==void 0&&Bi(e.completedStroke.points,2);case"drawingPen":return Bi(e.points,2);case"drawingDragShape":return Bi([e.startPoint,e.cursorPoint],2);case"placingPolygon":return Bi(e.vertices,3);case"placingLine":return Bi(e.vertices,2);case"placingBezier":return J5(e.points);default:return hr(e)}}function _5(e,t){switch(t.type){case"TOOL_CHANGE":return e.phase==="placingLine"&&ka(e)?yi(t.tool,{tool:"line",points:e.vertices}):di(t.tool);case"BLUR":return di(e.tool);case"RESET_REQUEST":return{phase:"idle",tool:e.tool,shouldResetViewport:!0};case"KEY_DOWN":return t.key==="Escape"&&e.phase==="placingLine"?ka(e)?yi(e.tool,{tool:"line",points:e.vertices}):di(e.tool):t.key==="Escape"&&e.phase!=="idle"?di(e.tool):e;case"POINTER_CANCEL":return e.phase==="idle"?e:di(e.tool);case"SHIFT_CHANGE":return K5(e,t.held);case"POINTER_DOWN":return $5(e,t);case"POINTER_MOVE":return q5(e,t);case"POINTER_UP":return U5(e,t);default:return hr(t)}}function $5(e,t){if(e.phase==="idle")return H5(e,t);switch(e.phase){case"drawingPen":case"drawingDragShape":return e;case"placingPolygon":return W5(e,t);case"placingLine":return G5(e,t);case"placingBezier":return X5(e,t);default:return hr(e)}}function H5(e,t){if(!t.point)return e;const n=en(t.point);switch(e.tool){case"pen":return{phase:"drawingPen",tool:"pen",pointerId:t.pointerId,points:[n],cursorPoint:n,shiftHeld:!1};case"line":return t.mode==="place"?{phase:"placingLine",tool:"line",vertices:[n],cursorPoint:n,shiftHeld:!1}:{phase:"drawingDragShape",tool:"line",pointerId:t.pointerId,startPoint:n,cursorPoint:n,shiftHeld:!1};case"rect":case"ellipse":return{phase:"drawingDragShape",tool:e.tool,pointerId:t.pointerId,startPoint:n,cursorPoint:n,shiftHeld:!1};case"polygon":return{phase:"placingPolygon",tool:"polygon",vertices:[n],cursorPoint:n,shiftHeld:!1};case"bezier":return{phase:"placingBezier",tool:"bezier",creationPhase:"line",points:[n,void 0,void 0,void 0],cursorPoint:n,pointerId:t.pointerId,dragging:!0,shiftHeld:!1};case"lasso":case"eraser":return e;default:return hr(e.tool)}}function q5(e,t){switch(e.phase){case"idle":return e;case"drawingPen":{if(!Wi(e.pointerId,t.pointerId)||!t.point)return e;const n=en(t.point);return{...e,points:ys(e.points,n),cursorPoint:n}}case"drawingDragShape":return!Wi(e.pointerId,t.pointerId)||!t.point?e:{...e,cursorPoint:en(t.point)};case"placingPolygon":case"placingLine":return t.point?{...e,cursorPoint:en(t.point)}:e;case"placingBezier":return V5(e,t);default:return hr(e)}}function U5(e,t){switch(e.phase){case"idle":case"placingPolygon":case"placingLine":return e;case"placingBezier":return Y5(e,t);case"drawingPen":{if(!Wi(e.pointerId,t.pointerId))return e;const n=t.point?ys(e.points,en(t.point)):e.points;return au("pen",n,e.tool)}case"drawingDragShape":{if(!Wi(e.pointerId,t.pointerId))return e;const n=t.point?en(t.point):e.cursorPoint;return au(e.tool,[e.startPoint,n],e.tool)}default:return hr(e)}}function W5(e,t){if(t.detail===2&&ka(e))return yi(e.tool,{tool:"polygon",points:e.vertices});if(!t.point)return e;const n=en(t.point),r=e.vertices[0];return r&&Z5(r,n)<=F5&&ka(e)?yi(e.tool,{tool:"polygon",points:e.vertices}):{...e,vertices:[...e.vertices,n],cursorPoint:n}}function G5(e,t){if(t.detail===2&&ka(e)){const r=t.point?ys(e.vertices,en(t.point)):e.vertices;return yi(e.tool,{tool:"line",points:r})}if(!t.point)return e;const n=en(t.point);return{...e,vertices:ys(e.vertices,n),cursorPoint:n}}function X5(e,t){return!t.point||e.dragging?e:{...e,cursorPoint:en(t.point),pointerId:t.pointerId,dragging:!0}}function V5(e,t){return!e.dragging||!Wi(e.pointerId,t.pointerId)||!t.point?e:{...e,cursorPoint:en(t.point)}}function Y5(e,t){if(!e.dragging||!Wi(e.pointerId,t.pointerId))return e;const n=en(t.point??e.cursorPoint);if(!n)return e;switch(e.creationPhase){case"line":{const r=e.points[0];return r?{...e,creationPhase:"control1",points:[en(r),void 0,void 0,n],cursorPoint:n,pointerId:void 0,dragging:!1}:e}case"control1":{const r=e.points[0],i=e.points[3];return!r||!i?e:{...e,creationPhase:"control2",points:[en(r),n,void 0,en(i)],cursorPoint:n,pointerId:void 0,dragging:!1}}case"control2":{const r=e.points[0],i=e.points[1],a=e.points[3];return!r||!i||!a?e:yi(e.tool,{tool:"bezier",points:[en(r),en(i),n,en(a)]})}default:return hr(e.creationPhase)}}function au(e,t,n){return Bi(t,2)?yi(n,{tool:e,points:t}):di(n)}function yi(e,t){return{phase:"idle",tool:e,completedStroke:{tool:t.tool,points:t.points.map(n=>en(n))}}}function K5(e,t){switch(e.phase){case"idle":return e;case"drawingPen":case"drawingDragShape":case"placingPolygon":case"placingLine":case"placingBezier":return{...e,shiftHeld:t};default:return hr(e)}}function ys(e,t){const n=e[e.length-1];return n&&n.x===t.x&&n.y===t.y?e:[...e,t]}function Bi(e,t){return new Set(e.map(n=>`${n.x}:${n.y}`)).size>=t}function Wi(e,t){return e===void 0||t===void 0||e===t}function en(e){return e?{x:e.x,y:e.y}:void 0}function Z5(e,t){return Math.hypot(e.x-t.x,e.y-t.y)}function J5(e){return e.every(t=>t!==void 0)}const qr=2;function Q5(){return Date.now().toString(36)+Math.random().toString(36).slice(2)}function e3(e,t={},n){const r=typeof t=="string"?{strokeColor:t,strokeWidth:n}:t;return{id:Q5(),tool:e,points:[],...r,dashArray:r.dashArray?[...r.dashArray]:void 0}}function t3(e,t){const n=e.points;if(n.length>0){const r=n[n.length-1];if(r.x===t.x&&r.y===t.y)return e}return{...e,points:[...n,t]}}function n3(e){const t=e.points;if(t.length<2)return!1;const n=t[0];for(let r=1;r<t.length;r++)if(t[r].x!==n.x||t[r].y!==n.y)return!0;return!1}const Co={enabled:!0,strength:.5,density:1,velocityThreshold:.5,minSegmentLength:5,maxSegmentLength:100,maxInterpolatedPoints:10};function bs(e){return e===!1?{...Co,enabled:!1}:e===!0||e===void 0?Co:{...Co,...e}}function r3(e,t){if(!e.timestamp||!t.timestamp)return 0;const n=t.timestamp-e.timestamp;if(n<=0)return 0;const r=t.x-e.x,i=t.y-e.y;return Math.sqrt(r*r+i*i)/n}function i3(e,t,n){const r=bs(n);if(!r.enabled)return 0;const i=t.x-e.x,a=t.y-e.y,s=Math.sqrt(i*i+a*a);if(s<r.minSegmentLength)return 0;const o=r3(e,t);if(o<r.velocityThreshold)return 0;const l=Math.min(s/r.maxSegmentLength,1),d=Math.min(o/(r.velocityThreshold*4),1),c=Math.round((l+d)*r.density*3);return Math.min(c,r.maxInterpolatedPoints)}function a3(e,t,n,r,i,a=.5){const s=i*i,o=s*i,l=.5*(2*t.x+(-e.x+n.x)*i+(2*e.x-5*t.x+4*n.x-r.x)*s+(-e.x+3*t.x-3*n.x+r.x)*o),d=.5*(2*t.y+(-e.y+n.y)*i+(2*e.y-5*t.y+4*n.y-r.y)*s+(-e.y+3*t.y-3*n.y+r.y)*o),c=t.x+(n.x-t.x)*i,f=t.y+(n.y-t.y)*i,g=c+(l-c)*a,y=f+(d-f)*a;return{x:g,y}}function s3(e,t){const n=bs(t);if(!n.enabled||e.length<2)return e.map(i=>({...i}));const r=[];r.push({...e[0]});for(let i=1;i<e.length;i++){const a=e[i-1],s=e[i],o=i3(a,s,n);if(o>0){const l=e[Math.max(0,i-2)],d=a,c=s,f=e[Math.min(e.length-1,i+1)];for(let g=1;g<=o;g++){const y=g/(o+1),x=a3(l,d,c,f,y,n.strength);if(a.pressure!==void 0||s.pressure!==void 0){const k=a.pressure??1,w=s.pressure??1,E=k+(w-k)*y;r.push({...x,pressure:E})}else r.push(x)}}r.push({...s})}return r}function o3(e){if(e.length===0)return"";if(e.length===1)return`M ${e[0].x} ${e[0].y}`;if(e.length===2)return`M ${e[0].x} ${e[0].y} L ${e[1].x} ${e[1].y}`;let t=`M ${e[0].x} ${e[0].y}`;for(let s=1;s<e.length-1;s++){const o=e[s-1],l=e[s],d=e[s+1],c=o.x+(l.x-o.x)/3,f=o.y+(l.y-o.y)/3,g=l.x-(d.x-o.x)/6,y=l.y-(d.y-o.y)/6;t+=` C ${c} ${f} ${g} ${y} ${l.x} ${l.y}`}const n=e[e.length-1],r=e[e.length-2],i=r.x+(n.x-r.x)/3,a=r.y+(n.y-r.y)/3;return t+=` C ${i} ${a} ${n.x} ${n.y} ${n.x} ${n.y}`,t}function l3(e){return Number.isFinite(e)&&e>=0}function c3(e){if(!(!e||e.length===0)&&e.every(l3))return e.some(t=>t>0)?e.join(" "):void 0}function u3(e){return e!==void 0&&e!=="none"?e:"none"}function d3(e,t){const n=e.strokeWidth??t.fallbackWidth,r=t.isClosedShape===!0&&n===0,i=t.isClosedShape===!0?u3(e.fillColor):"none",a=c3(e.dashArray),s=e.dashOffset!==void 0&&Number.isFinite(e.dashOffset)?e.dashOffset:void 0;return{stroke:r?void 0:e.strokeColor??t.fallbackColor,strokeWidth:r?void 0:n,strokeDasharray:a,strokeDashoffset:s,fill:i,fillOpacity:i!=="none"?e.fillOpacity??1:void 0}}function h3(e){return e===0?0:typeof e=="number"&&Number.isFinite(e)&&e>=0&&e<=1?e:1}function f3(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:1}function m3(e){return e.tool==="pen"&&e.points.some(t=>t.pressure!==void 0)}function sl(e){const t=e[0],n=e[e.length-1];return t&&n?[t,n]:null}function xs(e){const t=sl(e);if(!t)return null;const[n,r]=t;return{x:Math.min(n.x,r.x),y:Math.min(n.y,r.y),width:Math.abs(r.x-n.x),height:Math.abs(r.y-n.y)}}function p3(e){return e.map(t=>`${t.x},${t.y}`).join(" ")}function g3(e){return e.map((t,n)=>`${n===0?"M":"L"} ${t.x} ${t.y}`).join(" ")}function v3(e){if(e.length!==4)return;const[t,n,r,i]=e;return`M ${t.x} ${t.y} C ${n.x} ${n.y} ${r.x} ${r.y} ${i.x} ${i.y}`}function Sr(e,t,n,r,i,a){return d3({...e,dashArray:e.dashArray??i.dashArray,dashOffset:e.dashOffset??i.dashOffset,fillColor:e.fillColor??i.fillColor,fillOpacity:e.fillOpacity??i.fillOpacity},{isClosedShape:a,fallbackColor:t,fallbackWidth:a?r??n:n})}function Zh(e,t,n,r,i,a,s){const o=Sr(e,t,n,r,i,!1);return m3(e)&&e.points.length>=2?e.points.slice(1).map((l,d)=>{const c=e.points[d],f=a?`active-${d}`:`${e.id}-${d}`;return u.jsx("line",{x1:c.x,y1:c.y,x2:l.x,y2:l.y,fill:o.fill,stroke:o.stroke,strokeWidth:(o.strokeWidth??n)*h3(l.pressure)*s,strokeDasharray:o.strokeDasharray,strokeDashoffset:o.strokeDashoffset,strokeLinecap:"round",strokeLinejoin:"round",opacity:a},f)}):u.jsx("path",{d:o3(e.points),fill:o.fill,stroke:o.stroke,strokeWidth:o.strokeWidth,strokeDasharray:o.strokeDasharray,strokeDashoffset:o.strokeDashoffset,strokeLinecap:"round",strokeLinejoin:"round",opacity:a},a?void 0:e.id)}function y3(e,t,n,r,i,a,s){const o=sl(e.points);if(!o)return null;const[l,d]=o;if(e.tool==="rect"){const c=xs(e.points);if(!c)return null;const f=Sr(e,t,n,r,i,!0);return u.jsx("rect",{x:c.x,y:c.y,width:c.width,height:c.height,fill:f.fill,stroke:f.stroke,strokeWidth:f.strokeWidth,strokeDasharray:f.strokeDasharray,strokeDashoffset:f.strokeDashoffset,fillOpacity:f.fillOpacity,opacity:a},a?void 0:e.id)}if(e.tool==="ellipse"){const c=xs(e.points);if(!c)return null;const f=Sr(e,t,n,r,i,!0);return u.jsx("ellipse",{cx:c.x+c.width/2,cy:c.y+c.height/2,rx:c.width/2,ry:c.height/2,fill:f.fill,stroke:f.stroke,strokeWidth:f.strokeWidth,strokeDasharray:f.strokeDasharray,strokeDashoffset:f.strokeDashoffset,fillOpacity:f.fillOpacity,opacity:a},a?void 0:e.id)}if(e.tool==="line"){const c=Sr(e,t,n,r,i,!1);return u.jsx("line",{x1:l.x,y1:l.y,x2:d.x,y2:d.y,fill:c.fill,stroke:c.stroke,strokeWidth:c.strokeWidth,strokeDasharray:c.strokeDasharray,strokeDashoffset:c.strokeDashoffset,strokeLinecap:"round",opacity:a},a?void 0:e.id)}return Zh(e,t,n,r,i,a,s)}function b3(e,t,n,r,i,a,s){const o=sl(e.points);if(!o)return null;const[l,d]=o;switch(e.tool){case"pen":return Zh(e,t,n,r,i,a,s);case"line":{const c=Sr(e,t,n,r,i,!1);return e.points.length>2?u.jsx("path",{d:g3(e.points),fill:c.fill,stroke:c.stroke,strokeWidth:c.strokeWidth,strokeDasharray:c.strokeDasharray,strokeDashoffset:c.strokeDashoffset,strokeLinecap:"round",strokeLinejoin:"round",opacity:a},a?void 0:e.id):u.jsx("line",{x1:l.x,y1:l.y,x2:d.x,y2:d.y,fill:c.fill,stroke:c.stroke,strokeWidth:c.strokeWidth,strokeDasharray:c.strokeDasharray,strokeDashoffset:c.strokeDashoffset,strokeLinecap:"round",opacity:a},a?void 0:e.id)}case"rect":{const c=xs(e.points);if(!c)return null;const f=Sr(e,t,n,r,i,!0);return u.jsx("rect",{x:c.x,y:c.y,width:c.width,height:c.height,fill:f.fill,stroke:f.stroke,strokeWidth:f.strokeWidth,strokeDasharray:f.strokeDasharray,strokeDashoffset:f.strokeDashoffset,fillOpacity:f.fillOpacity,opacity:a},a?void 0:e.id)}case"ellipse":{const c=xs(e.points);if(!c)return null;const f=Sr(e,t,n,r,i,!0);return u.jsx("ellipse",{cx:c.x+c.width/2,cy:c.y+c.height/2,rx:c.width/2,ry:c.height/2,fill:f.fill,stroke:f.stroke,strokeWidth:f.strokeWidth,strokeDasharray:f.strokeDasharray,strokeDashoffset:f.strokeDashoffset,fillOpacity:f.fillOpacity,opacity:a},a?void 0:e.id)}case"polygon":{const c=Sr(e,t,n,r,i,!0);return u.jsx("polygon",{points:p3(e.points),fill:c.fill,stroke:c.stroke,strokeWidth:c.strokeWidth,strokeDasharray:c.strokeDasharray,strokeDashoffset:c.strokeDashoffset,fillOpacity:c.fillOpacity,opacity:a},a?void 0:e.id)}case"bezier":{const c=v3(e.points);if(!c)return null;const f=Sr(e,t,n,r,i,!1);return u.jsx("path",{d:c,fill:f.fill,stroke:f.stroke,strokeWidth:f.strokeWidth,strokeDasharray:f.strokeDasharray,strokeDashoffset:f.strokeDashoffset,strokeLinecap:"round",strokeLinejoin:"round",opacity:a},a?void 0:e.id)}default:return hr(e)}}function x3(e){return"schemaVersion"in e}function Oi({stroke:e,isActive:t,fallbackColor:n,fallbackWidth:r,fallbackClosedWidth:i,fallbackDashArray:a,fallbackDashOffset:s,fallbackFillColor:o,fallbackFillOpacity:l,pressureMultiplier:d}){if(e.points.length===0)return null;const c=t?"0.7":void 0,f={dashArray:a,dashOffset:s,fillColor:o,fillOpacity:l},g=f3(d),y=x3(e)?b3(e,n,r,i,f,c,g):y3(e,n,r,i,f,c,g);return Array.isArray(y)?u.jsx(p.Fragment,{children:y}):y}function Jh(e,t){const n=e.x-t.center.x,r=e.y-t.center.y,i=Math.cos(-t.rotationRad),a=Math.sin(-t.rotationRad);return{x:n*i-r*a,y:n*a+r*i}}function Qh(e,t){const n=Math.cos(t.rotationRad),r=Math.sin(t.rotationRad),i=e.x*n-e.y*r,a=e.x*r+e.y*n;return{x:i+t.center.x,y:a+t.center.y}}function e1(e,t){const n=Jh(e,t),r=t.length/2,i=t.height/2;return Math.abs(n.x)<=r&&Math.abs(n.y)<=i}function w3(e,t,n){if(!e1(e,t))return null;const r=Jh(e,t),i=t.length/2,a={x:Math.max(-i,Math.min(i,r.x)),y:n};return Qh(a,t)}function k3(e,t){return w3(e,t,-t.height/2)}const S3=200,E3=50,T3=10;function M3(e,t){const n=Math.max(1,t?.majorSpacing??E3),r=Math.max(1,t?.minorSpacing??T3),i=t?.maxTicks??S3,a=Math.min(r,n),s=e.length/2,o=[],l=new Set,d=c=>{const f=c.toFixed(6);if(l.has(f))return!1;l.add(f);const g=Math.abs(c)%n,y=g<1e-9||Math.abs(g-n)<1e-9;let x;Math.abs(c)<1e-9?x="0":x=String(Math.round(Math.abs(c)));const k=Qh({x:c,y:0},e);return o.push({canvasPoint:k,localX:c,kind:y?"major":"minor",label:y?x:""}),!0};d(0);for(let c=a;c<=s+1e-9&&!(o.length>=i);c+=a)d(c);for(let c=-a;c>=-(s+1e-9)&&!(o.length>=i);c-=a)d(c);return o.sort((c,f)=>c.localX-f.localX),o}const C3=.25,A3=8,ws={scale:1,tx:0,ty:0};function Gi(e,t){return Number.isFinite(e)?e:t}function Xs(e){return{scale:R3(e.scale),tx:Gi(e.tx,ws.tx),ty:Gi(e.ty,ws.ty)}}function R3(e){return Number.isNaN(e)?ws.scale:Math.max(C3,Math.min(A3,e))}function I3(){return{...ws}}function N3(e){return Xs({scale:e.scale,tx:e.x,ty:e.y})}function L3(e){const t=Xs(e);return{x:t.tx,y:t.ty,scale:t.scale}}function Ni(e,t){const n=Xs(t),r=Gi(e.x,0),i=Gi(e.y,0);return{x:r*n.scale+n.tx,y:i*n.scale+n.ty}}function nr(e,t){const n=Xs(t),r=Gi(e.x,0),i=Gi(e.y,0);return{x:(r-n.tx)/n.scale,y:(i-n.ty)/n.scale}}var P3=Object.create,t1=Object.defineProperty,D3=Object.getOwnPropertyDescriptor,B3=Object.getOwnPropertyNames,O3=Object.getPrototypeOf,z3=Object.prototype.hasOwnProperty,j3=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),F3=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(var i=B3(t),a=0,s=i.length,o;a<s;a++)o=i[a],!z3.call(e,o)&&o!==n&&t1(e,o,{get:(l=>t[l]).bind(null,o),enumerable:!(r=D3(t,o))||r.enumerable});return e},_3=(e,t,n)=>(n=e==null?{}:P3(O3(e)),F3(t1(n,"default",{value:e,enumerable:!0}),e)),it=(function(e){return e.MouseWheelZoom="MouseWheelZoom",e.MouseDragPan="MouseDragPan",e.TrackpadScrollPan="TrackpadScrollPan",e.MouseWheelCtrlZoom="MouseWheelCtrlZoom",e.TouchSingleFingerPan="TouchSingleFingerPan",e.TouchTwoFingerPan="TouchTwoFingerPan",e.TouchTwoFingerZoom="TouchTwoFingerZoom",e.PenPan="PenPan",e})({}),ks=(function(e){return e.TopLeft="TopLeft",e.Center="Center",e})({}),n1=(function(e){return e.Transform="Transform",e.Scroll="Scroll",e})({}),$3=["TrackpadScrollPan","MouseWheelCtrlZoom","TouchSingleFingerPan","TouchTwoFingerZoom"],r1="pan-x pan-y",Vs=(e,t,n)=>Math.min(Math.max(e,t),n),H3=({placement:e,wrapperWidth:t,wrapperHeight:n,containerWidth:r,containerHeight:i})=>e===ks.TopLeft?{x:0,y:0,scale:1}:{x:(t-r)/2,y:(n-i)/2,scale:1},q3=({x:e,y:t,scale:n})=>`translate3d(${e}px, ${t}px, 0) scale(${n})`,U3=(e,t,n,r)=>{let i=(n-e.x)/e.scale,a=(r-e.y)/e.scale;return{x:n-i*t,y:r-a*t,scale:t}},su=(e,t,n,r)=>{let i={...e,...t};return{...i,scale:Vs(i.scale,n,r)}},Ys=(e,t,n,r)=>{let i=t.width*e.scale,a=t.height*e.scale,s=Math.min(0,n-i),o=Math.min(0,r-a);return{x:Math.min(Math.max(e.x,s),0),y:Math.min(Math.max(e.y,o),0),scale:e.scale}},ou=()=>({width:0,height:0,offsetX:0,offsetY:0,maxScrollLeft:0,maxScrollTop:0,scrollLeft:0,scrollTop:0,boundedTransform:{x:0,y:0,scale:0}}),aa=e=>Number.isFinite(e)&&e>0,Ss=e=>Number.isFinite(e)?e:0,Sa=(e,t,n,r,i)=>{if(!aa(e.width)||!aa(e.height)||!aa(t)||!aa(n)||!aa(r))return ou();let a=e.width*t,s=e.height*t;if(!Number.isFinite(a)||!Number.isFinite(s))return ou();let o=Math.max((n-a)/2,0),l=Math.max((r-s)/2,0),d=Math.max(a-n,0),c=Math.max(s-r,0),f=Ys({x:Ss(i.x),y:Ss(i.y),scale:t},e,n,r);return{width:a,height:s,offsetX:o,offsetY:l,maxScrollLeft:d,maxScrollTop:c,scrollLeft:f.x===0?0:-f.x,scrollTop:f.y===0?0:-f.y,boundedTransform:f}},i1=(e,t,n,r)=>{let i=(a,s,o,l)=>{if(![a,s,o,l].every(Number.isFinite)||s<=0||o<=0||l<=0)return a;let d=o*l;return d<=s?(s-d)/2:Math.min(Math.max(a,s-d),0)};return{x:i(e.x,n,t.width,e.scale),y:i(e.y,r,t.height,e.scale),scale:e.scale}},lu=.55,cu=(e,t,n,r)=>{if(![e,t,n,r].every(Number.isFinite)||t<=0||n<=0||r<=0)return null;let i=n*r;if(!Number.isFinite(i))return null;if(i<=t){let a=(t-i)/2;return{min:a,max:a}}return{min:t-i,max:0}},uu=(e,t,n)=>!n||n.min===n.max?t:e<n.min?n.min+(e-n.min)*lu:e>n.max?n.max+(e-n.max)*lu:e,a1=({transform:e,containerSize:t,wrapperSize:n,enabled:r})=>{let i=i1(e,t,n.width,n.height);return{elasticTransform:{x:uu(e.x,i.x,cu(e.x,n.width,t.width,e.scale)),y:uu(e.y,i.y,cu(e.y,n.height,t.height,e.scale)),scale:e.scale},targetTransform:i}},W3=(e,t,n,r)=>{let i=Sa(t,e.scale,n,r,e);return{width:i.width,height:i.height,scrollLeft:i.scrollLeft,scrollTop:i.scrollTop,boundedTransform:i.boundedTransform}},G3=(e,t,n,r,i,a)=>Sa(e,t,n,r,{x:i===0?0:-Ss(i),y:a===0?0:-Ss(a)}).boundedTransform,X3=(e,t,n,r,i)=>({x:n===0?0:-n,y:r===0?0:-r,scale:i}),s1=e=>e===void 0?500:e===0?0:!Number.isFinite(e)||e<0?500:e,V3=.01,du=(e,t,n)=>e>0?e:t<=0||!Number.isFinite(n)?0:t/Math.max(n,V3);function ol(e,t,n){let r=e.clientWidth||e.getBoundingClientRect().width,i=e.clientHeight||e.getBoundingClientRect().height,a=t.getBoundingClientRect(),s=du(t.offsetWidth,a.width,n),o=du(t.offsetHeight,a.height,n);return![r,i,s,o].every(Number.isFinite)||r<=0||i<=0||s<=0||o<=0?null:{wrapperWidth:r,wrapperHeight:i,containerWidth:s,containerHeight:o}}function ll(e,t,n){let r=ol(t,n,e.scale);return r?i1(e,{width:r.containerWidth,height:r.containerHeight},r.wrapperWidth,r.wrapperHeight):e}var Y3=_3(j3(((e,t)=>{(function(n,r){typeof define=="function"&&define.amd?define(r):typeof t=="object"&&t.exports?t.exports=r():n.log=r()})(e,function(){var n=function(){},r="undefined",i=typeof window!==r&&typeof window.navigator!==r&&/Trident\/|MSIE /.test(window.navigator.userAgent),a=["trace","debug","info","warn","error"],s={},o=null;function l(w,E){var S=w[E];if(typeof S.bind=="function")return S.bind(w);try{return Function.prototype.bind.call(S,w)}catch{return function(){return Function.prototype.apply.apply(S,[w,arguments])}}}function d(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function c(w){return w==="debug"&&(w="log"),typeof console===r?!1:w==="trace"&&i?d:console[w]===void 0?console.log===void 0?n:l(console,"log"):l(console,w)}function f(){for(var w=this.getLevel(),E=0;E<a.length;E++){var S=a[E];this[S]=E<w?n:this.methodFactory(S,w,this.name)}if(this.log=this.debug,typeof console===r&&w<this.levels.SILENT)return"No console available for logging"}function g(w){return function(){typeof console!==r&&(f.call(this),this[w].apply(this,arguments))}}function y(w,E,S){return c(w)||g.apply(this,arguments)}function x(w,E){var S=this,R,L,P,B="loglevel";typeof w=="string"?B+=":"+w:typeof w=="symbol"&&(B=void 0);function O(D){var q=(a[D]||"silent").toUpperCase();if(!(typeof window===r||!B)){try{window.localStorage[B]=q;return}catch{}try{window.document.cookie=encodeURIComponent(B)+"="+q+";"}catch{}}}function _(){var D;if(!(typeof window===r||!B)){try{D=window.localStorage[B]}catch{}if(typeof D===r)try{var q=window.document.cookie,K=encodeURIComponent(B),fe=q.indexOf(K+"=");fe!==-1&&(D=/^([^;]+)/.exec(q.slice(fe+K.length+1))[1])}catch{}return S.levels[D]===void 0&&(D=void 0),D}}function F(){if(!(typeof window===r||!B)){try{window.localStorage.removeItem(B)}catch{}try{window.document.cookie=encodeURIComponent(B)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function $(D){var q=D;if(typeof q=="string"&&S.levels[q.toUpperCase()]!==void 0&&(q=S.levels[q.toUpperCase()]),typeof q=="number"&&q>=0&&q<=S.levels.SILENT)return q;throw TypeError("log.setLevel() called with invalid level: "+D)}S.name=w,S.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},S.methodFactory=E||y,S.getLevel=function(){return P??L??R},S.setLevel=function(D,q){return P=$(D),q!==!1&&O(P),f.call(S)},S.setDefaultLevel=function(D){L=$(D),_()||S.setLevel(D,!1)},S.resetLevel=function(){P=null,F(),f.call(S)},S.enableAll=function(D){S.setLevel(S.levels.TRACE,D)},S.disableAll=function(D){S.setLevel(S.levels.SILENT,D)},S.rebuild=function(){if(o!==S&&(R=$(o.getLevel())),f.call(S),o===S)for(var D in s)s[D].rebuild()},R=$(o?o.getLevel():"WARN");var j=_();j!=null&&(P=$(j)),f.call(S)}o=new x,o.getLogger=function(w){if(typeof w!="symbol"&&typeof w!="string"||w==="")throw TypeError("You must supply a name when creating a logger.");var E=s[w];return E||=s[w]=new x(w,o.methodFactory),E};var k=typeof window===r?void 0:window.log;return o.noConflict=function(){return typeof window!==r&&window.log===o&&(window.log=k),o},o.getLoggers=function(){return s},o.default=o,o})}))());function hu(e){let t=e.reduce((n,r)=>({x:n.x+r.x,y:n.y+r.y}),{x:0,y:0});return{x:t.x/e.length,y:t.y/e.length}}function Za(e,t){return Math.hypot(t.x-e.x,t.y-e.y)}function fu(e,t,n,r){let i={y:t.y-e.y,x:t.x-e.x},a={y:r.y-n.y,x:r.x-n.x};return(Math.atan2(a.y,a.x)-Math.atan2(i.y,i.x))*180/Math.PI}function K3(e,t){let n=hu(t.map(i=>i.startPoint)),r=hu(t.map(i=>i.currentPoint));return{x:e.x+r.x-n.x,y:e.y+r.y-n.y}}function Z3(e,t){if(e.length>=2)return fu(e[0].startPoint,e[1].startPoint,e[0].currentPoint,e[1].currentPoint);let n=e[0];return n?fu(n.startPoint,t,n.currentPoint,t):0}function J3(e,t){if(e.length>=2){let a=Za(e[0].startPoint,e[1].startPoint),s=Za(e[0].currentPoint,e[1].currentPoint);return a===0?1:s/a}let n=e[0];if(!n)return 1;let r=Za(n.startPoint,t),i=Za(n.currentPoint,t);return r===0?1:i/r}var ar;(function(e){e.Start="start",e.Move="move",e.End="end",e.Cancel="cancel"})(ar||={});var zi;(function(e){e.Idle="idle",e.Start="start",e.Move="move",e.End="end",e.Cancel="cancel"})(zi||={});function Ja(e){return{...e,position:{...e.position}}}var Q3=class{options;pointers=new Map;initialPose;anchorCenter;constructor(e){this.options=e}reset(){this.pointers.clear(),this.initialPose=void 0,this.anchorCenter=void 0}process(e,t){let n=t.features??this.options.features;if(e.phase===ar.Start)return this.beginPointer(e,t.pose,t.anchorCenter),this.buildSnapshot(zi.Start,t.pose);let r=this.pointers.get(e.pointerId);if(!r)return this.buildSnapshot(zi.Idle,t.pose);this.updatePointer(r,e,t);let i=this.resolvePhase(e.phase),a=this.computePose(t.pose,n),s=this.buildSnapshot(i,a);return(e.phase===ar.End||e.phase===ar.Cancel)&&this.finishPointer(e.pointerId,a,t.anchorCenter),s}beginPointer(e,t,n){for(let r of this.pointers.values())r.startPoint={...r.currentPoint},r.startTimestamp=r.currentTimestamp;this.initialPose=Ja(t),this.anchorCenter=n,this.pointers.set(e.pointerId,{pointerId:e.pointerId,startPoint:{...e.point},currentPoint:{...e.point},startTimestamp:e.timestamp,currentTimestamp:e.timestamp,pressure:e.pressure})}updatePointer(e,t,n){e.currentPoint={...t.point},e.currentTimestamp=t.timestamp,e.pressure=t.pressure,this.initialPose||=Ja(n.pose),n.anchorCenter&&(this.anchorCenter=n.anchorCenter)}resolvePhase(e){return e===ar.Move?zi.Move:e===ar.Cancel?zi.Cancel:zi.End}finishPointer(e,t,n){let r=this.pointers.get(e);if(this.pointers.delete(e),this.pointers.size>0&&r){this.initialPose=Ja(t),this.anchorCenter=n??this.anchorCenter;for(let i of this.pointers.values())i.startPoint={...i.currentPoint},i.startTimestamp=i.currentTimestamp}this.pointers.size===0&&(this.initialPose=void 0,this.anchorCenter=void 0)}computePose(e,t){let n=Ja(this.initialPose??e),r=[...this.pointers.values()];if(r.length===0)return n;if(t.drag&&(n.position=K3(n.position,r)),t.rotate){let i=this.anchorCenter??{x:n.position.x+n.width/2,y:n.position.y+n.height/2};n.rotation=(this.initialPose?.rotation||0)+Z3(r,i)}if(t.scale){let i=this.anchorCenter??{x:n.position.x+n.width/2,y:n.position.y+n.height/2};n.scale=(this.initialPose?.scale||1)+(J3(r,i)-1)*(this.initialPose?.scale||1)}return n}buildSnapshot(e,t){return{phase:e,pose:t,activePointers:[...this.pointers.values()].map(n=>({pointerId:n.pointerId,startPoint:{...n.startPoint},currentPoint:{...n.currentPoint},startTimestamp:n.startTimestamp,currentTimestamp:n.currentTimestamp,pressure:n.pressure}))}}},mu=.007,pu=5e-4,gu=1e-7,e6=10;function cl(e,t){return n=>e*n-.5*t*n**2}function t6(e){let t=e.at(-1),n=e.at(-2);if(!t||!n)return;let r=Math.hypot(t.pose.position.x-n.pose.position.x,t.pose.position.y-n.pose.position.y);if(r<=1)return;let i=t.time-n.time;if(i<=0)return;let a=r/i,s=cl(a,mu),o={x:(t.pose.position.x-n.pose.position.x)/r,y:(t.pose.position.y-n.pose.position.y)/r},l=a/mu;return d=>{let c=s(d);if(!(d>l||c<0))return{x:t.pose.position.x+o.x*c,y:t.pose.position.y+o.y*c}}}function n6(e){let t=e.at(-1),n=e.at(-2);if(!t||!n||t.pose.rotation===void 0||n.pose.rotation===void 0)return;let r=t.pose.rotation-n.pose.rotation;if(r===0)return;let i=t.time-n.time;if(i<=0)return;let a=r/i,s=cl(a,pu),o=Math.abs(a/pu);return l=>{if(!(l>o))return(t.pose.rotation||0)+s(l)}}function r6(e){let t=e.at(-1),n=e.at(-2);if(!t||!n||t.pose.scale===void 0||n.pose.scale===void 0)return;let r=t.pose.scale-n.pose.scale;if(r===0)return;let i=t.time-n.time;if(i<=0)return;let a=r/i,s=cl(a,gu),o=Math.abs(a/gu);return l=>{let d=s(l);if(!(l>o||Math.abs(d)>e6))return(t.pose.scale||1)*(d+1)}}function i6(e){let t=t6(e),n=n6(e),r=r6(e);return i=>{let a={position:t?.(i),rotation:n?.(i),scale:r?.(i)};if(!(a.position===void 0&&a.rotation===void 0&&a.scale===void 0))return a}}function vu(e){return Math.min(Math.max(e,0),1)}function a6(e){let t=e.pressure;if(typeof t=="number")return t;let n=e.webkitForce;return typeof n=="number"?n:void 0}function o1(e){if(e.pointerType==="mouse"){let n=e.webkitForce;return typeof n=="number"&&n>0?vu(n):e.buttons>0?.5:void 0}let t=a6(e);return typeof t=="number"?vu(t):void 0}function Ao(e,t){return{pointerId:e.pointerId,point:{x:e.clientX,y:e.clientY},phase:t,timestamp:e.timeStamp,pressure:o1(e),pointerType:e.pointerType,isPrimary:e.isPrimary}}function Qa(e){let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function yu(e,t,n){let r=window.getComputedStyle(e);if(r.boxSizing==="border-box")return`${n}px`;let i=Qa(t==="width"?r.paddingLeft:r.paddingTop),a=Qa(t==="width"?r.paddingRight:r.paddingBottom),s=Qa(t==="width"?r.borderLeftWidth:r.borderTopWidth),o=Qa(t==="width"?r.borderRightWidth:r.borderBottomWidth);return`${Math.max(n-i-a-s-o,0)}px`}function l1(e,t,n){return t.exec(e)?.[1]===void 0?`${e}${n}`:e.replace(t,n)||""}function s6(e,t){Object.hasOwn(t,"position")&&t.position!==void 0&&(e.style.left=`${t.position.x}px`,e.style.top=`${t.position.y}px`)}function o6(e,t){Object.hasOwn(t,"rotation")&&t.rotation!==void 0&&(e.style.transform=l1(e.style.transform,/rotate\((-?\d+(?:\.\d+)?)deg\)/,`rotate(${t.rotation||0}deg)`))}function l6(e,t){Object.hasOwn(t,"scale")&&t.scale!==void 0&&(e.style.transform=l1(e.style.transform,/scale\((-?\d+(?:\.\d+)?)\)/,`scale(${t.scale||1})`))}function c6(e,t){(Object.hasOwn(t,"width")&&t.width!==void 0||Object.hasOwn(t,"height")&&t.height!==void 0)&&(Object.hasOwn(t,"width")&&t.width!==void 0&&(e.style.width=yu(e,"width",t.width)),Object.hasOwn(t,"height")&&t.height!==void 0&&(e.style.height=yu(e,"height",t.height)))}function u6(e){let t=e.offsetWidth,n=e.offsetHeight,r=Number(/scale\((-?\d+(?:\.\d+)?)\)/.exec(e.style.transform)?.[1])||1;return{position:{x:Number.parseFloat(e.style.left||"0"),y:Number.parseFloat(e.style.top||"0")},rotation:Number(/rotate\((-?\d+(?:\.\d+)?)deg\)/.exec(e.style.transform)?.[1])||0,width:t,height:n,scale:r}}function d6(e,t){s6(e,t),o6(e,t),l6(e,t),c6(e,t)}function Ro(e){let t=e.getBoundingClientRect();return{x:t.x+t.width/2,y:t.y+t.height/2}}var fi;(function(e){e.Start="start",e.Move="move",e.End="end"})(fi||={});var h6=class{options;path=[];eventListeners=new Map;isDestroyed=!1;isMoving=!1;pointerId;constructor(e,t={}){this.options=t,this.pointerId=e.pointerId,this.record(fi.Start,e)}record(e,t){let n={point:{x:t.clientX,y:t.clientY},timestamp:t.timeStamp,type:e,pressure:o1(t),event:t};return this.path.push(n),e===fi.Move&&(this.isMoving=!0),this.eventListeners.get(e)?.forEach(r=>{r(n)}),e===fi.End&&this.destroy(),n}getPath(e){return e?this.path.filter(t=>t.type===e):this.path}getLastOperation(e){return e?this.path.filter(t=>t.type===e).at(-1):this.path.at(-1)}addEventListener(e,t){let n=this.eventListeners.get(e)||[];n.push(t),this.eventListeners.set(e,n)}removeEventListener(e,t){if(!t){this.eventListeners.set(e,[]);return}this.eventListeners.set(e,(this.eventListeners.get(e)||[]).filter(n=>n!==t))}getIsMoving(){return this.isMoving}getIsDestroyed(){return this.isDestroyed}destroy(){this.isDestroyed||(this.isDestroyed=!0,this.options.onDestroy?.(this))}},$t;(function(e){e.Start="start",e.Move="move",e.End="end",e.Inertial="inertial",e.InertialEnd="inertialEnd",e.AllEnd="allEnd"})($t||={});var f6=class{element;options;controller;gestureFeatures;fingers=new Map;poses=[];events=new Map;currentOperationType=$t.End;isEnabled=!0;isPassive=!1;isDestroyed=!1;inertialFrameId=null;constructor(e,t={},n={drag:!0}){this.element=e,this.options=t,this.gestureFeatures=n,this.controller=new Q3({features:n}),this.isPassive=!!t.passive,this.element.style.touchAction="none",this.element.addEventListener("pointerdown",this.handlePointerDown),document.addEventListener("pointermove",this.handlePointerMove),document.addEventListener("pointerup",this.handlePointerEnd),document.addEventListener("pointercancel",this.handlePointerCancel)}destroy(){this.isDestroyed=!0,this.element.removeEventListener("pointerdown",this.handlePointerDown),document.removeEventListener("pointermove",this.handlePointerMove),document.removeEventListener("pointerup",this.handlePointerEnd),document.removeEventListener("pointercancel",this.handlePointerCancel),this.inertialFrameId!==null&&(cancelAnimationFrame(this.inertialFrameId),this.inertialFrameId=null),this.fingers.clear(),this.controller.reset()}getPose(e){return this.options.getPose?.(e)||u6(e)}setPose(e,t,n){n===$t.End&&this.options.setPoseOnEnd?this.options.setPoseOnEnd(e,t):this.options.setPose?this.options.setPose(e,t):d6(e,t);let r=this.getPose(e);this.poses.push({pose:{...r,...t,position:t.position||r.position},time:Date.now()})}getGlobalPose(e){let t=this.getPose(e),n=e.getBoundingClientRect();return{...t,width:n.width,height:n.height,position:{x:n.x,y:n.y}}}resolveGestureFeatures(e){return this.gestureFeatures}addEventListener(e,t){let n=this.events.get(e)??[];n.push(t),this.events.set(e,n)}removeEventListener(e,t){if(!t){this.events.set(e,[]);return}this.events.set(e,(this.events.get(e)??[]).filter(n=>n!==t))}trigger(e,t){if(!(!this.isEnabled||this.isDestroyed))for(let n of this.events.get(e)??[])n(t??this.getFingers())}getFingers(){return[...this.fingers.values()]}getCurrentOperationType(){return this.currentOperationType}setCurrentOperationType(e){this.currentOperationType=e}setEnabled(e=!0){this.isEnabled=e}setDisabled(){this.isEnabled=!1}setPassive(e=!0){this.isPassive=e}handlePointerDown=e=>{if(!this.isEnabled||this.isPassive||e.pointerType==="mouse"&&e.button!==0)return;let t=this.options.maxFingerCount??1;if(t!==-1&&this.fingers.size>=t)return;let n=new h6(e,{onDestroy:i=>{this.fingers.delete(i.pointerId),this.fingers.size===0&&(this.currentOperationType=$t.AllEnd,this.trigger($t.AllEnd))}});this.fingers.set(e.pointerId,n);let r=this.getPose(this.element);this.poses.push({pose:r,time:e.timeStamp}),this.controller.process(Ao(e,ar.Start),{pose:r,anchorCenter:Ro(this.element),features:this.resolveGestureFeatures(this.fingers.size)}),this.currentOperationType=$t.Start,this.trigger($t.Start),Y3.default.info(`[DragBase] pointerdown, fingers: ${this.fingers.size}`)};handlePointerMove=e=>{let t=this.fingers.get(e.pointerId);if(!t||!this.isEnabled)return;t.record(fi.Move,e);let n=this.controller.process(Ao(e,ar.Move),{pose:this.getPose(this.element),anchorCenter:Ro(this.element),features:this.resolveGestureFeatures(this.fingers.size)});this.currentOperationType=$t.Move,this.setPose(this.element,n.pose,$t.Move),this.trigger($t.Move)};handlePointerEnd=e=>{this.finishPointer(e,ar.End,fi.End)};handlePointerCancel=e=>{this.finishPointer(e,ar.Cancel,fi.End)};finishPointer(e,t,n){let r=this.fingers.get(e.pointerId);if(!r||!this.isEnabled)return;let i=this.fingers.size;r.record(n,e);let a=this.controller.process(Ao(e,t),{pose:this.getPose(this.element),anchorCenter:Ro(this.element),features:this.resolveGestureFeatures(i)});this.currentOperationType=$t.End,this.setPose(this.element,a.pose,$t.End),this.trigger($t.End),this.options.inertial&&this.fingers.size===0&&this.runInertial()}runInertial(){let e=i6(this.poses),t=Date.now(),n=()=>{if(this.isDestroyed)return;this.inertialFrameId=null;let r=e(Date.now()-t);if(!r){this.currentOperationType=$t.InertialEnd,this.trigger($t.InertialEnd);return}this.currentOperationType=$t.Inertial,this.setPose(this.element,r,$t.Inertial),this.trigger($t.Inertial),this.inertialFrameId=requestAnimationFrame(n)};n()}},Kn;(function(e){e.Drag="drag",e.Rotate="rotate",e.Scale="scale"})(Kn||={});var m6=class extends f6{activeMixinTypes;singleFingerMixinTypes;constructor(e,t={},n,r){let i=[...new Set(n)];super(e,{...t,maxFingerCount:-1},{drag:i.includes(Kn.Drag),rotate:i.includes(Kn.Rotate),scale:i.includes(Kn.Scale)}),this.activeMixinTypes=i,this.singleFingerMixinTypes=[...new Set(r??i.filter(a=>a===Kn.Drag))]}resolveGestureFeatures(e){let t=e<=1?this.singleFingerMixinTypes:this.activeMixinTypes;return{drag:t.includes(Kn.Drag),rotate:t.includes(Kn.Rotate),scale:t.includes(Kn.Scale)}}},p6=e=>{let t=1-e;return 1-t*t*t},Io=(e,t,n)=>e+(t-e)*n,g6=({from:e,to:t,duration:n=220,onUpdate:r,onComplete:i})=>{let a=null,s=!1,o=performance.now(),l=d=>{if(s)return;let c=(d-o)/n,f=c>=1?1:p6(c);if(r({x:Io(e.x,t.x,f),y:Io(e.y,t.y,f),scale:Io(e.scale,t.scale,f)}),f>=1){i?.();return}a=window.requestAnimationFrame(l)};return r(e),a=window.requestAnimationFrame(l),()=>{s=!0,a!==null&&(window.cancelAnimationFrame(a),a=null)}},c1=({settleCancelRef:e,updateTransformRef:t,endTransformRef:n,incrementElasticActive:r,decrementElasticActive:i,emitInitialUpdate:a=!0})=>{let s=!1,o=c=>{c!==s&&(s=c,c?r():i())},l=()=>{e.current?.(),e.current=null,o(!1)},d=(c,f)=>c.x===f.x&&c.y===f.y&&c.scale===f.scale;return{setElasticActive:o,cancelSettleAnimation:l,transformsMatch:d,settleElasticTransform:(c,f,g)=>{if(l(),d(c,f)){n.current(f,g);return}let y={...g,phase:"change"};o(!0),a&&t.current(c,y),e.current=g6({from:c,to:f,onUpdate(x){t.current(x,y)},onComplete(){e.current=null,o(!1),n.current(f,g)}})}}},v6=1e-6,y6=[it.MouseDragPan,it.TouchSingleFingerPan,it.TouchTwoFingerPan,it.PenPan],b6=e=>({mouseDragPan:e.includes(it.MouseDragPan),touchSingleFingerPan:e.includes(it.TouchSingleFingerPan),touchTwoFingerPan:e.includes(it.TouchTwoFingerPan),touchTwoFingerZoom:e.includes(it.TouchTwoFingerZoom),penPan:e.includes(it.PenPan)}),x6=e=>e.mouseDragPan||e.touchSingleFingerPan||e.touchTwoFingerPan||e.touchTwoFingerZoom||e.penPan,w6=e=>e.getLastOperation()?.event,k6=e=>e!==void 0,S6=(e,t)=>{let n=e.map(w6).filter(k6);if(n.some(i=>i.pointerType==="mouse"&&i.isPrimary))return t.mouseDragPan?{panSource:it.MouseDragPan}:null;if(n.some(i=>i.pointerType==="pen"))return t.penPan?{panSource:it.PenPan}:null;let r=e.length>0&&n.length===e.length&&n.every(i=>i.pointerType==="touch");if(e.length===1&&r)return t.touchSingleFingerPan?{panSource:it.TouchSingleFingerPan}:null;if(e.length>=2&&r){let i={};return t.touchTwoFingerPan&&(i.panSource=it.TouchTwoFingerPan),t.touchTwoFingerZoom&&(i.zoomSource=it.TouchTwoFingerZoom),i.panSource||i.zoomSource?i:null}return null},E6=e=>{let t=[];return(e.mouseDragPan||e.touchSingleFingerPan||e.touchTwoFingerPan||e.penPan)&&t.push(Kn.Drag),e.touchTwoFingerZoom&&t.push(Kn.Scale),t},T6=e=>e.mouseDragPan||e.touchSingleFingerPan||e.penPan?[Kn.Drag]:[],bu=(e,t,n,r)=>e?e.panSource?e.zoomSource&&(r||Math.abs(n-t)>v6)?e.zoomSource:e.panSource:e.zoomSource??null:null,xu=(e,t)=>{if(!t||e.length<2)return null;let n=t.getBoundingClientRect(),r=0,i=0,a=0;for(let s of e){let o=s.getLastOperation()?.point;if(!o)return null;r+=o.x-n.left,i+=o.y-n.top,a+=1}return a>=2?{x:r/a,y:i/a}:null};function M6(e){let{wrapperRef:t,containerRef:n,transform:r,enabledInteractions:i,minScale:a,maxScale:s,contentSize:o,beginTransform:l,updateTransform:d,endTransform:c,isReaderMode:f,containMode:g,edgeElasticScroll:y=!1,incrementElasticActive:x,decrementElasticActive:k,readerModeZoomDebounceMs:w}=e,E=p.useRef(r),S=p.useRef(a),R=p.useRef(s),L=p.useRef(o),P=p.useRef(l),B=p.useRef(d),O=p.useRef(c),_=p.useRef(f),F=p.useRef(g),$=p.useRef(y),j=p.useRef(x),D=p.useRef(k),q=p.useRef(w),K=p.useRef(null),fe=p.useRef(null),de=p.useRef(null),Ce=p.useRef(null),oe=p.useRef(null),Ee=p.useRef(!1),ze=p.useRef(!1);E.current=r,S.current=a,R.current=s,L.current=o,P.current=l,B.current=d,O.current=c,_.current=f,F.current=g,$.current=y,j.current=x,D.current=k,q.current=w;let ge=b6(i),{setElasticActive:We,cancelSettleAnimation:Pe,transformsMatch:st,settleElasticTransform:se}=p.useMemo(()=>c1({settleCancelRef:fe,updateTransformRef:B,endTransformRef:O,incrementElasticActive:()=>j.current?.(),decrementElasticActive:()=>D.current?.()}),[]);p.useEffect(()=>{(!g||!y||f)&&Pe()},[g,y,f,Pe]),p.useEffect(()=>{let Le=t.current;if(!Le||!x6(ge))return;let he=null,Ne=Le.style.touchAction,Te=()=>{K.current!==null&&(window.clearTimeout(K.current),K.current=null)},et=(A,z)=>{Te();let X=s1(q.current);if(X===0){O.current(A,z);return}K.current=window.setTimeout(()=>{O.current(A,z),K.current=null},X)},Oe=A=>{let z=A.getBoundingClientRect(),X=E.current;return{position:{x:X.x,y:X.y},width:z.width,height:z.height,scale:X.scale}},Nt=(A,z,X)=>{let Z=Oe(A),U=E.current,ce=z.position??Z.position,be=Vs(z.scale??Z.scale??U.scale,S.current,R.current),Ae=bu(de.current,Z.scale??U.scale,be,Ee.current);if(!Ae&&X==="end"&&Ce.current&&(Ae=bu(Ce.current,Z.scale??U.scale,be,Ee.current)),!Ae||_.current&&y6.includes(Ae))return;let Ye=oe.current,mt=xu(he?.getFingers()??[],t.current);if(X==="change"&&Ae===it.TouchSingleFingerPan&&ze.current||X==="change"&&Ae===it.TouchTwoFingerZoom&&Ee.current&&mt===null)return;let sn=Ae===it.TouchTwoFingerZoom&&Ye!==null&&mt!==null,at;if(sn&&Ye&&mt){let pt=Ye.startTransform,Tt=Ye.startMid,Me=(Tt.x-pt.x)/pt.scale,ct=(Tt.y-pt.y)/pt.scale;at={x:mt.x-Me*be,y:mt.y-ct*be,scale:be},Ee.current=!0}else if(X==="end"&&Ee.current)at={...E.current,scale:be};else{let pt=ce.x-Z.position.x,Tt=ce.y-Z.position.y;at={x:U.x+pt,y:U.y+Tt,scale:be}}_.current&&L.current&&t.current&&(at=Ys(at,L.current,t.current.clientWidth,t.current.clientHeight));let qt=null;if(F.current&&!_.current&&t.current&&n.current)if($.current){let pt=ol(t.current,n.current,at.scale);if(pt){let Tt=a1({transform:at,containerSize:{width:pt.containerWidth,height:pt.containerHeight},wrapperSize:{width:pt.wrapperWidth,height:pt.wrapperHeight},enabled:!0});qt=Tt.targetTransform,at=Tt.elasticTransform,We(!st(Tt.elasticTransform,Tt.targetTransform))}else We(!1)}else We(!1),at=ll(at,t.current,n.current);else We(!1);let rn={source:Ae,inputType:"pointer",phase:X};if(X==="end"){let pt={source:Ae,inputType:"pointer",phase:"end"};if(_.current&&Ae===it.TouchTwoFingerZoom){et(at,pt),I();return}if(qt&&!st(at,qt)){se(at,qt,pt),I();return}We(!1);let Tt=qt??at;E.current=Tt,O.current(Tt,pt),I();return}(!qt||st(at,qt))&&We(!1),E.current=at,B.current(at,rn)},Ht={getPose:Oe,setPose:(A,z)=>Nt(A,z,"change"),setPoseOnEnd:(A,z)=>Nt(A,z,"end"),maxFingerCount:-1,inertial:!1,passive:!1},dt=A=>{let z=de.current,X=S6(A,ge),Z=!!z?.zoomSource,U=A.length===1&&X?.panSource===it.TouchSingleFingerPan;Z&&U&&(ze.current=!0),de.current=X,X&&(Ce.current=X)},Q=A=>{if(!de.current?.zoomSource){oe.current=null;return}let z=xu(A,t.current);if(!z){oe.current=null;return}oe.current={startTransform:{...E.current},startMid:z}},je=(A=!1)=>{de.current=null,oe.current=null,A||(Ee.current=!1),ze.current=!1},De=()=>{je(!0),Te()},I=()=>{(he?.getFingers()??[]).length>0||(Ee.current=!1,Ce.current=null)};he=new m6(Le,Ht,E6(ge),T6(ge));let ee=n.current,G=A=>{A.pointerType==="mouse"&&A.stopPropagation()};return!ge.mouseDragPan&&ee&&ee.addEventListener("pointerdown",G),f&&(Le.style.touchAction=Ne&&Ne!=="none"?Ne:r1),he.addEventListener($t.Start,A=>{Pe(),Ee.current=!1,Ce.current=null,dt(A),Q(A),!_.current&&de.current?.zoomSource===it.TouchTwoFingerZoom&&P.current()}),he.addEventListener($t.Move,dt),he.addEventListener($t.End,A=>{dt(A),Q(A)}),he.addEventListener($t.AllEnd,De),()=>{de.current=null,Ce.current=null,oe.current=null,Ee.current=!1,ze.current=!1,Pe(),Te(),he?.destroy(),ee&&!ge.mouseDragPan&&ee.removeEventListener("pointerdown",G),f&&(Le.style.touchAction=Ne)}},[n,t,f,ge.mouseDragPan,ge.touchSingleFingerPan,ge.touchTwoFingerPan,ge.touchTwoFingerZoom,ge.penPan,y,We,Pe,st,se])}var C6=150,u1=.002,A6=(e,t)=>({source:e,inputType:"wheel",phase:t}),wu=(e,t,n,r,i)=>{let a=t.getBoundingClientRect(),s=e.clientX-a.left,o=e.clientY-a.top,l=Math.exp(-e.deltaY*u1);return U3(n,Vs(n.scale*l,r,i),s,o)},R6=({event:e,wrapper:t,contentSize:n,current:r,minScale:i,maxScale:a})=>{let s=t.clientWidth,o=t.clientHeight,l=t.getBoundingClientRect(),d=e.clientX-l.left,c=e.clientY-l.top,f=Sa(n,r.scale,s,o,r),g=(f.scrollLeft+d-f.offsetX)/r.scale,y=(f.scrollTop+c-f.offsetY)/r.scale,x=Math.exp(-e.deltaY*u1),k=Vs(r.scale*x,i,a),w=Sa(n,k,s,o,{x:0,y:0}),E=g*k+w.offsetX-d,S=y*k+w.offsetY-c;return G3(n,k,s,o,Math.min(Math.max(E,0),w.maxScrollLeft),Math.min(Math.max(S,0),w.maxScrollTop))};function I6(e){let t=p.useRef(e),n=p.useRef(null),r=p.useRef(null),i=p.useRef(null),a=p.useRef(null),s=p.useRef(e.incrementElasticActive),o=p.useRef(e.decrementElasticActive),l=p.useRef(e.updateTransform),d=p.useRef(e.endTransform);t.current=e,s.current=e.incrementElasticActive,o.current=e.decrementElasticActive,l.current=e.updateTransform,d.current=e.endTransform;let{setElasticActive:c,cancelSettleAnimation:f,transformsMatch:g,settleElasticTransform:y}=p.useMemo(()=>c1({settleCancelRef:a,updateTransformRef:l,endTransformRef:d,incrementElasticActive:()=>s.current?.(),decrementElasticActive:()=>o.current?.(),emitInitialUpdate:!1}),[]),x=p.useCallback(()=>{let E=r.current;if(!E)return;let S={source:E.source,inputType:"wheel",phase:"end"},R=i.current;if(i.current=null,c(!1),R&&!g(E.transform,R)){y(E.transform,R,S),r.current=null,n.current=null;return}d.current(E.transform,S),r.current=null,n.current=null},[c,y,g]),k=p.useCallback((E,S,R)=>{if(r.current={transform:E,source:S},n.current!==null&&window.clearTimeout(n.current),R===0){x();return}n.current=window.setTimeout(x,R)},[x]),w=p.useCallback(E=>{let{wrapperRef:S,containerRef:R,contentSize:L,transform:P,enabledInteractions:B,minScale:O,maxScale:_,updateTransform:F,isReaderMode:$,containMode:j,edgeElasticScroll:D,readerModeZoomDebounceMs:q}=t.current,K=S.current,fe=oe=>B.includes(oe);if($&&!E.ctrlKey&&!E.metaKey)return;let de=null,Ce=null;if(E.ctrlKey||E.metaKey?fe(it.MouseWheelCtrlZoom)&&K&&(Ce=it.MouseWheelCtrlZoom,de=$&&L?R6({event:E,wrapper:K,contentSize:L,current:P,minScale:O,maxScale:_}):wu(E,K,P,O,_)):fe(it.TrackpadScrollPan)?(Ce=it.TrackpadScrollPan,de={x:P.x-E.deltaX,y:P.y-E.deltaY,scale:P.scale}):fe(it.MouseWheelZoom)&&K&&(Ce=it.MouseWheelZoom,de=wu(E,K,P,O,_)),!(!Ce||!de)){if($&&L&&K&&(de=Ys(de,L,K.clientWidth,K.clientHeight)),f(),j&&!$&&K&&R.current)if(D){let oe=ol(K,R.current,de.scale);if(oe){let Ee=a1({transform:de,containerSize:{width:oe.containerWidth,height:oe.containerHeight},wrapperSize:{width:oe.wrapperWidth,height:oe.wrapperHeight},enabled:!0});i.current=Ee.targetTransform,de=Ee.elasticTransform,c(!g(Ee.elasticTransform,Ee.targetTransform))}else i.current=null,c(!1)}else i.current=null,c(!1),de=ll(de,K,R.current);else i.current=null,c(!1);E.preventDefault(),F(de,A6(Ce,"change")),k(de,Ce,$?s1(q):C6)}},[f,k,c]);p.useEffect(()=>{let E=t.current.wrapperRef.current;if(E)return E.addEventListener("wheel",w,{passive:!1}),()=>{E.removeEventListener("wheel",w),n.current!==null&&(window.clearTimeout(n.current),n.current=null),f()}},[f,w])}var ku=1,es=e=>typeof e=="number"&&Number.isFinite(e)&&e>0,N6=({children:e,enabledInteractions:t=$3,initialPlacement:n=ks.Center,renderMode:r,readerMode:i,containMode:a=!1,edgeElasticScroll:s=!1,readerModeZoomDebounceMs:o,lazyWillChange:l=0,contentSize:d,transform:c,defaultTransform:f,minScale:g=.25,maxScale:y=4,onTransformChange:x,onTransformChangeEnd:k,className:w,style:E,containerClassName:S,containerStyle:R,wrapperProps:L,containerProps:P})=>{let B=p.useRef(null),O=p.useRef(null),_=p.useRef(!1),F=p.useRef(null),$=c!==void 0,j=i??r===n1.Scroll,D=a===!0&&!j,q=t.includes(it.MouseDragPan),K=d?.width,fe=d?.height,[de,Ce]=p.useState(()=>su({x:0,y:0,scale:1},f,g,y)),[oe,Ee]=p.useState(0),[ze,ge]=p.useState(null),[We,Pe]=p.useState(0),st=We>0,[se,Le]=p.useState(!1),he=p.useRef(j),Ne=p.useRef(l),Te=p.useRef(null);he.current=j,Ne.current=l;let et=p.useCallback(()=>{Te.current!==null&&(window.clearTimeout(Te.current),Te.current=null)},[]),Oe=p.useCallback(()=>{Pe(Me=>Me+1)},[]),Nt=p.useCallback(()=>{Pe(Me=>Math.max(0,Me-1))},[]),Ht=p.useCallback(Me=>{if(!D)return Me;let ct=B.current,ut=O.current;return!ct||!ut?Me:ll(Me,ct,ut)},[D]);p.useLayoutEffect(()=>{if($)return;let Me=B.current,ct=O.current;if(!Me||!ct)return;let ut=Me.getBoundingClientRect(),Ge=ct.getBoundingClientRect(),Ct=Ht(su(H3({placement:n,wrapperWidth:ut.width,wrapperHeight:ut.height,containerWidth:Ge.width,containerHeight:Ge.height}),f,g,y));Ce(Ct),x&&x(Ct,{source:"initialPlacement",inputType:"programmatic",phase:"change"})},[]);let dt=$?c:de,Q=p.useMemo(()=>D&&s&&st?dt:D?Ht(dt):dt,[oe,s,D,Ht,dt,st]);p.useLayoutEffect(()=>{if(!D||j)return;let Me=B.current,ct=O.current;if(!Me||!ct)return;let ut=()=>{Ee(Ge=>Ge+1)};if(typeof ResizeObserver<"u"){let Ge=new ResizeObserver(ut);return Ge.observe(Me),Ge.observe(ct),ut(),()=>Ge.disconnect()}return ut(),window.addEventListener("resize",ut),()=>window.removeEventListener("resize",ut)},[D,j]);let je=p.useCallback((Me,ct)=>{$||Ce(Me),x&&x(Me,ct),!he.current&&es(Ne.current)&&(et(),Le(!0))},[$,x,et]),De=p.useCallback(()=>{!he.current&&es(Ne.current)&&(et(),Le(!0))},[et]),I=p.useCallback((Me,ct)=>{$||Ce(Me),k&&k(Me,ct);let ut=Ne.current;!he.current&&es(ut)&&(et(),Te.current=window.setTimeout(()=>{Te.current=null,Le(!1)},ut))},[$,k,et]),ee=p.useMemo(()=>q3(Q),[Q]),G=p.useCallback(()=>{let Me=B.current;return K!==void 0&&fe!==void 0?{width:K,height:fe}:(j&&!_.current&&(_.current=!0,console.warn("VirtualPaper: readerMode requires contentSize to compute native scroll geometry. Falling back to wrapper dimensions; scaling and scrolling may not behave as expected.")),{width:Me?.clientWidth??0,height:Me?.clientHeight??0})},[fe,K,j]);p.useLayoutEffect(()=>{if(!j)return;let Me=B.current;if(!Me)return;let ct=Me.clientWidth,ut=Me.clientHeight;ge(Ge=>Ge&&Ge.width===ct&&Ge.height===ut?Ge:{width:ct,height:ut})},[j]),p.useLayoutEffect(()=>{if(!j)return;let Me=B.current;if(!Me)return;let ct=Me.clientWidth,ut=Me.clientHeight,Ge=W3(dt,G(),ct,ut),Ct=Math.max(0,Math.round(Ge.scrollLeft)),Lt=Math.max(0,Math.round(Ge.scrollTop));(Me.scrollLeft!==Ct||Me.scrollTop!==Lt)&&(F.current={left:Ct,top:Lt}),Me.scrollLeft!==Ct&&(Me.scrollLeft=Ct),Me.scrollTop!==Lt&&(Me.scrollTop=Lt)},[G,j,dt]);let A=p.useRef(dt);p.useLayoutEffect(()=>{A.current=dt},[dt]),p.useEffect(()=>{if(!j)return;let Me=B.current;if(!Me)return;let ct=()=>{let ut=F.current;if(ut&&(F.current=null,Math.abs(Me.scrollLeft-ut.left)<=ku&&Math.abs(Me.scrollTop-ut.top)<=ku))return;let Ge=A.current,Ct=G(),Lt=Ys(X3(Ct.width*Ge.scale,Ct.height*Ge.scale,Me.scrollLeft,Me.scrollTop,Ge.scale),Ct,Me.clientWidth,Me.clientHeight);Ge.x===Lt.x&&Ge.y===Lt.y&&Ge.scale===Lt.scale||je(Lt,{source:it.TrackpadScrollPan,inputType:"wheel",phase:"change"})};return Me.addEventListener("scroll",ct,{passive:!0}),()=>Me.removeEventListener("scroll",ct)},[G,j,je]),p.useEffect(()=>()=>et(),[et]),p.useEffect(()=>{!j&&es(l)||(et(),Le(!1))},[j,l,et]);let z={position:"relative",overflow:"hidden",width:"100%",height:"100%"},X={position:"absolute",transformOrigin:"0 0",touchAction:"none"},{className:Z,style:U,...ce}=L??{},{className:be,style:Ae,...Ye}=P??{},mt=L?.["data-testid"]??"virtual-paper-wrapper",sn=P?.["data-testid"]??"virtual-paper-container",at=["virtual-paper-wrapper",w,Z].filter(Boolean).join(" "),qt=["virtual-paper-container",S,be].filter(Boolean).join(" "),rn={...z,...E,...U},pt=q?"none":"text",Tt={...X,userSelect:pt,WebkitUserSelect:pt,...R,...Ae,...se?{willChange:"transform"}:{},transform:ee,transformOrigin:"0 0"};if(M6({wrapperRef:B,containerRef:O,transform:Q,enabledInteractions:t,minScale:g,maxScale:y,contentSize:d,beginTransform:De,updateTransform:je,endTransform:I,isReaderMode:j,containMode:D,edgeElasticScroll:s,incrementElasticActive:Oe,decrementElasticActive:Nt,readerModeZoomDebounceMs:o}),I6({wrapperRef:B,containerRef:O,transform:Q,enabledInteractions:t,minScale:g,maxScale:y,contentSize:d,beginTransform:De,updateTransform:je,endTransform:I,isReaderMode:j,containMode:D,edgeElasticScroll:s,incrementElasticActive:Oe,decrementElasticActive:Nt,readerModeZoomDebounceMs:o}),j){let Me=B.current,ct=ze?.width??Me?.clientWidth??0,ut=ze?.height??Me?.clientHeight??0,Ge=Sa(G(),dt.scale,ct,ut,dt),Ct={...z,overflow:"auto",...E,...U},Lt={position:"relative",touchAction:r1,userSelect:"none",...R,...Ae,width:Ge.width,height:Ge.height,marginLeft:Ge.offsetX,marginTop:Ge.offsetY};return u.jsx("div",{...ce,ref:B,"data-testid":mt,className:at,style:Ct,children:u.jsx("div",{...Ye,ref:O,"data-testid":sn,className:qt,style:Lt,children:e})})}return u.jsx("div",{...ce,ref:B,"data-testid":mt,className:at,style:rn,children:u.jsx("div",{...Ye,ref:O,"data-testid":sn,className:qt,style:Tt,children:e})})};const d1=["trackpadScrollPan","mouseWheelCtrlZoom","touchSingleFingerPan","touchTwoFingerZoom"],L6={mouseWheelZoom:it.MouseWheelZoom,mouseDragPan:it.MouseDragPan,trackpadScrollPan:it.TrackpadScrollPan,mouseWheelCtrlZoom:it.MouseWheelCtrlZoom,touchSingleFingerPan:it.TouchSingleFingerPan,touchTwoFingerPan:it.TouchTwoFingerPan,touchTwoFingerZoom:it.TouchTwoFingerZoom,penPan:it.PenPan},P6=N6;function D6(e){return e===!0?!0:e===!1||e===void 0?!1:e.enabled!==!1}function B6(e,t,n){return{renderMode:n1.Transform,enabledInteractions:z6(e.enabledInteractions),...e.initialPlacement===void 0?{}:{initialPlacement:O6(e.initialPlacement)},...Su(e.minScale)?{minScale:e.minScale}:{},...Su(e.maxScale)?{maxScale:e.maxScale}:{},transform:L3(t),onTransformChange:r=>{n(N3(r))}}}function O6(e){switch(e){case"top-left":return ks.TopLeft;case"center":return ks.Center;case void 0:return}}function z6(e){return(e??d1).map(n=>L6[n])}function Su(e){return typeof e=="number"&&Number.isFinite(e)}const j6='button, input, textarea, select, a[href], [role="button"], [role="link"], [contenteditable="true"], [data-interactive]';function ji(e,t){return{kind:"pointer",target:e.target,pointerType:e.pointerType??(e.type==="dblclick"?"mouse":void 0),button:t??e.button,ctrlKey:e.ctrlKey,altKey:e.altKey,pointerId:e.pointerId}}function _i(e){return $6(e.input,e.isRulerEnabled,e.activeTouchPointers??1)?"ruler":h1(e.input.target)?"none":H6(e)?"virtual-paper":e.input.kind==="wheel"||!e.isDrawingEnabled?"none":W6(e.input,e.allowedDrawingInputMethods)?"drawing":"none"}function F6(){const e=new Map;return{startPointer(t){if(t.input.kind!=="pointer")return _i(t);const n=t.input.pointerId??1,r=e.get(n);if(r!==void 0)return r;const i=_i(t);return e.set(n,i),i},getPointerOwner(t){return e.get(t)??"none"},endPointer(t){const n=e.get(t)??"none";return e.delete(t),n},reset(){e.clear()}}}function _6(e){return e??d1}function h1(e){return e instanceof Element&&e.closest(j6)!==null}function $6(e,t,n){return t?e.target instanceof Element&&e.target.closest('[data-testid="drawing-ruler"]')?!0:e.kind!=="pointer"?!1:e.ctrlKey===!0||e.altKey===!0?!0:e.pointerType==="touch"&&n>=2:!1}function H6(e){if(!e.virtualPaperEnabled)return!1;const t=_6(e.virtualPaperInteractions);switch(e.input.kind){case"wheel":return q6(e.input,t);case"pointer":return U6(e.input,t,e.activeTouchPointers??1)}}function q6(e,t){return e.ctrlKey===!0||e.metaKey===!0?t.includes("mouseWheelCtrlZoom")||t.includes("mouseWheelZoom"):t.includes("trackpadScrollPan")||t.includes("mouseWheelZoom")}function U6(e,t,n){return e.pointerType==="touch"?n===1?t.includes("touchSingleFingerPan"):n>=2&&(t.includes("touchTwoFingerPan")||t.includes("touchTwoFingerZoom")):e.pointerType==="pen"?t.includes("penPan"):e.pointerType==="mouse"||e.pointerType===void 0?t.includes("mouseDragPan")&&e.button===0:!1}function W6(e,t){return e.button!==void 0&&e.button!==0?!1:e.pointerType==="pen"?t.includes("pen"):e.pointerType===void 0||e.pointerType==="touch"?t.includes("touch"):e.pointerType==="mouse"?t.includes("mouse")&&e.button===0:!1}function G6({enabled:e,options:t,viewport:n,onViewportChange:r,containerStyle:i,children:a}){return e?u.jsx(P6,{...B6(t,n,r),containerStyle:i,children:a}):u.jsx(u.Fragment,{children:a})}const ma={capture:!0};function ts(e,t,n){return n?e===t?!0:e instanceof Node?e.contains(t)||t.contains(e):!1:!1}function X6(e){return e.type.startsWith("pointer")}function V6(e){const t=r=>{if(_i(e.getInteractionOwnerOptions(ji(r)))!=="ruler")return;e.multiDragRef.current?.handlePointerDown?.(r)},n=r=>{X6(r)&&t(r)};return e.listenerTarget.addEventListener("pointerdown",n,ma),()=>{e.listenerTarget.removeEventListener("pointerdown",n,ma)}}function Eu(e){return e==="pen"||e==="line"||e==="rect"||e==="ellipse"||e==="polygon"||e==="bezier"||e==="eraser"||e==="lasso"}function f1(e){return e==="polygon"||e==="line"}function ns(e){return f1(e)||e==="bezier"}function Tu(e){return e==="rect"||e==="ellipse"||e==="polygon"}function da(e){return e==="rect"||e==="ellipse"}function Y6(e){return e==="pen"||e==="line"||e==="rect"||e==="ellipse"||e==="polygon"||e==="bezier"}function No(e){if(!da(e.tool)||e.points.length<2)return e;const t=e.points[0],n=e.points[e.points.length-1],r=n.x-t.x,i=n.y-t.y,a=Math.max(Math.abs(r),Math.abs(i));if(a===0)return e;const s=r===0?1:Math.sign(r),o=i===0?1:Math.sign(i),l={...n,x:t.x+s*a,y:t.y+o*a},d=e.points.slice(0,-1);return d.push(l),{...e,points:d}}const Lo=["touch","mouse","pen"],Po=4;function Do(){return Date.now().toString(36)+Math.random().toString(36).slice(2)}function Mu(e,t){const n=e[e.length-1];return n!==void 0&&n.x===t.x&&n.y===t.y}function K6(e){let t=0;for(let n=1;n<e.length;n++){const r=e[n-1],i=e[n];t+=Math.hypot(i.x-r.x,i.y-r.y)}return t}function Bo(e){const t=new Set,n=[];for(const r of e)t.has(r)||(t.add(r),n.push(r));return n}function Z6(e,t){return e.length!==t.length?!1:e.every((n,r)=>n===t[r])}function J6(e){return{...e,points:e.points.map(t=>({...t})),dashArray:e.dashArray?[...e.dashArray]:void 0}}function Q6(e,t,n){return{...e,points:e.points.map(r=>({...r,x:r.x+t,y:r.y+n})),dashArray:e.dashArray?[...e.dashArray]:void 0}}function Oo(e,t){return e?e.pointerType==="pen"?t.includes("pen"):e.pointerType===void 0||e.pointerType==="touch"?t.includes("touch"):e.pointerType==="mouse"?t.includes("mouse")&&e.button===0:!1:!1}function e7(e){return e===0?0:typeof e=="number"&&Number.isFinite(e)&&e>=0&&e<=1?e:1}function t7(e){const t=e?.endpoints===!0,n=e?.lines===!0,r=t||n,i=r&&typeof e?.radius=="number"&&Number.isFinite(e.radius)&&e.radius>0?e.radius:8;return{enabled:r,endpoints:t,lines:n,radius:i}}function n7(e){return"addEventListener"in e&&typeof e.addEventListener=="function"}function sa(e){return e?n7(e)?e:e.current:null}function Cu(e,t){return e instanceof Node&&t instanceof Node&&e.contains(t)}function Au(e){return e.type.startsWith("pointer")}function r7(e){return e.type==="dblclick"}const i7=p.forwardRef(function(t,n){const{tool:r,value:i,defaultValue:a,onChange:s,strokeColor:o,strokeWidth:l,dashArray:d,dashOffset:c,fillColor:f,fillOpacity:g,strokeSmoothing:y,inputMethods:x,pressure:k,samplingRate:w,cursor:E,snap:S,pressureMultiplier:R,eraserCommitMode:L,eraserTrajectory:P,testID:B,eventTarget:O,overflow:_,selectedStrokeIds:F,defaultSelectedStrokeIds:$,onSelectionChange:j,ruler:D,onRulerChange:q,virtualPaper:K}=t,fe=p.useRef(null),de=p.useRef(O),Ce=p.useRef(null),oe=p.useRef(F6()),[Ee,ze]=p.useState(()=>I3()),ge=p.useRef(Ee);ge.current=Ee;const We=p.useCallback(W=>{ze(W)},[]),Pe=p.useRef(null),[st,se]=p.useState(0),[,Le]=p.useState(0),he=D!==!1&&D!==void 0&&(D.enabled??!0),Ne=typeof D=="object"?D:{},Te=D6(K),et=typeof K=="object"?K:{};let Oe=null;if(he)if(Ne.state)Oe=Ne.state;else{if(!Pe.current){const W=Ne.defaultState??{center:{x:0,y:0},rotationRad:0,length:Ne.length??400,height:Ne.height??48};Pe.current=W}Oe=Pe.current}const Nt=p.useRef(null);Nt.current=Oe;const Ht=p.useRef(q);Ht.current=q;const dt=p.useRef(!1);p.useLayoutEffect(()=>{if(!(!he||!Oe||Ne.state||dt.current)&&Oe.center.x===0&&Oe.center.y===0&&fe.current){dt.current=!0;const W=fe.current.clientWidth,pe=fe.current.clientHeight,we={x:W/2,y:pe/2},Ke=nr(we,ge.current);Pe.current={...Oe,center:Ke},se(tt=>tt+1)}},[he,Oe,Ne.state]),p.useEffect(()=>{st>0&&q&&Pe.current&&q(Pe.current)},[st,q]),p.useEffect(()=>{const W=()=>{Ce.current?.destroy(),Ce.current=null};if(!he||!Nt.current||!fe.current){W();return}W();const pe=fe.current;let we=null,Ke=Nt.current;const tt=()=>{const ne=Ke;return ne?{position:Ni(ne.center,ge.current),rotation:ne.rotationRad,width:ne.length,height:ne.height}:{position:{x:0,y:0},rotation:0,width:0,height:0}},lt=ne=>ne>Math.PI?ne-Math.PI*2:ne<-Math.PI?ne+Math.PI*2:ne,Ot=()=>{if(!Ke)return null;const ne=Ce.current?.getFingers()??[],Ze=ne[0],Fe=ne[1],rt=Ze?.getPath()[0]?.point,Sn=Fe?.getPath()[0]?.point,En=Ze?.getLastOperation()?.point,Xn=Fe?.getLastOperation()?.point;if(!rt||!Sn||!En||!Xn)return null;const Vn=Ni(Ke.center,ge.current),tr=La=>Math.atan2(La.y-Vn.y,La.x-Vn.x),to=lt(tr(En)-tr(rt)),no=lt(tr(Xn)-tr(Sn));return Ke.rotationRad+(to+no)/2},jn=()=>{if(!Ke)return null;const Ze=(Ce.current?.getFingers()??[])[0],Fe=Ze?.getPath()[0]?.point,rt=Ze?.getLastOperation()?.point;if(!Fe||!rt)return null;const Sn=Ni(Ke.center,ge.current),En=Vn=>Math.atan2(Vn.y-Sn.y,Vn.x-Sn.x),Xn=lt(En(rt)-En(Fe));return Ke.rotationRad+Xn},Wn=(ne,Ze)=>{if(!Ke)return;let Fe=null;if(we==="grip"&&ne.position&&(Fe={...Ke,center:nr(ne.position,ge.current)}),we==="body"){const rt=Ot();if(rt===null)return;Fe={...Ke,center:ne.position?nr(ne.position,ge.current):Ke.center,rotationRad:rt}}if(we==="rotate"){const rt=jn();if(rt===null)return;Fe={...Ke,rotationRad:rt}}Fe&&(Pe.current=Fe,Ze&&Le(rt=>rt+1),Ht.current?.(Fe))},nt=new jt.Mixin(pe,{inertial:!1,getPose:tt,setPose:(ne,Ze)=>{Wn(Ze,!1)},setPoseOnEnd:(ne,Ze)=>{Wn(Ze,!0)}},[jt.MixinType.Drag,jt.MixinType.Rotate],[jt.MixinType.Drag]),Gn=()=>{if(Ke=Nt.current,!Ke){we=null;return}const[ne]=nt.getFingers(),Ze=ne?.getLastOperation()?.event,Fe=Ze?.target;if(!Ze||!(Fe instanceof Element)){we=null;return}if(_i({input:ji(Ze),isDrawingEnabled:!0,isRulerEnabled:he,virtualPaperEnabled:Te,virtualPaperInteractions:et.enabledInteractions,allowedDrawingInputMethods:Lo})!=="ruler"){we=null;return}if(Ze.pointerType==="mouse"&&(Ze.ctrlKey||Ze.metaKey||Ze.altKey)&&Fe.closest('[data-testid="drawing-ruler"]')){we=Ze.altKey?"rotate":"grip";return}if(Fe.closest('[data-testid="drawing-ruler-drag-grip"]')){we="grip";return}if(Fe.closest('[data-testid="drawing-ruler"]')){we="body";return}we=null},Ln=()=>{if(we==="grip"&&nt.getFingers().length!==1){we=null;return}if(we==="rotate"&&nt.getFingers().length!==1){we=null;return}we==="body"&&nt.getFingers().length<2},St=()=>{we=null,nt.setEnabled()};return nt.addEventListener(jt.DragOperationType.Start,Gn),nt.addEventListener(jt.DragOperationType.Move,Ln),nt.addEventListener(jt.DragOperationType.AllEnd,St),Ce.current=nt,()=>{nt.removeEventListener(jt.DragOperationType.Start,Gn),nt.removeEventListener(jt.DragOperationType.Move,Ln),nt.removeEventListener(jt.DragOperationType.AllEnd,St),Ce.current===nt&&(Ce.current=null),nt.destroy()}},[he,Te,et.enabledInteractions]);const Q=Eu(r)?r:"pen",je=r===void 0||Eu(r);de.current=O;const De=o&&o.trim()!==""?o:"black",I=typeof l=="number"&&Number.isFinite(l)&&l>=1?l:2,ee=typeof l=="number"&&Number.isFinite(l)&&l>=0?l:1,G=d?[...d]:void 0,A=typeof c=="number"&&Number.isFinite(c)?c:void 0,z=typeof g=="number"&&Number.isFinite(g)?g:void 0,X=typeof w=="number"&&Number.isFinite(w)&&w>0?w:0,Z=t7(S),U=typeof R=="number"&&Number.isFinite(R)&&R>0?R:1,ce=L==="on-release"?"on-release":"while-sliding",be=p.useMemo(()=>{const W=P?.visible??!1,pe=P?.color,we=typeof pe=="string"&&pe.trim().length>0?pe:"#ccc",Ke=P?.opacity,tt=typeof Ke=="number"&&Number.isFinite(Ke)?Math.max(0,Math.min(1,Ke)):.5,lt=P?.lineWidth,Ot=typeof lt=="number"&&Number.isFinite(lt)&<>0?lt:I;return{visible:W,color:we,opacity:tt,lineWidth:Ot}},[P,I]),Ae=p.useRef(!1),Ye=p.useRef(void 0);Ae.current||(Ae.current=!0,Ye.current=a?{strokes:a.strokes.map(W=>({...W,strokeColor:W.strokeColor??De,strokeWidth:W.strokeWidth??(Tu(W.tool)?ee:I),dashArray:W.dashArray??G,dashOffset:W.dashOffset??A,fillColor:W.fillColor??f,fillOpacity:W.fillOpacity??z}))}:void 0);const{strokes:mt,activeStroke:sn,setActiveStroke:at,addStroke:qt,removeStroke:rn,removeStrokes:pt,updateStrokes:Tt}=j5({value:i,onChange:s,defaultValue:Ye.current}),[Me,ct]=p.useState(()=>Bo($??[])),ut=F!==void 0,Ge=p.useMemo(()=>Bo(ut?F:Me),[Me,ut,F]),Ct=p.useMemo(()=>L5(mt,Ge),[mt,Ge]),Lt=p.useRef(Ge),fr=p.useRef(Ct),C=p.useRef(j),H=p.useMemo(()=>new Set(Ge),[Ge]);p.useEffect(()=>{Lt.current=Ge},[Ge]),p.useEffect(()=>{fr.current=Ct},[Ct]),C.current=j;const ae=p.useCallback(W=>{const pe=Bo(W),we=Lt.current;Z6(we,pe)||(Lt.current=pe,ut||ct(pe),C.current?.(pe))},[ut]),[xe,ot]=p.useReducer(_5,Q,di),At=p.useRef(!1),ye=p.useRef(new Map),me=p.useRef(0),Se=p.useRef(Q),Ut=p.useRef(Q),Rt=p.useRef(je),Nr=p.useRef(he),ki=p.useRef(Te),Si=p.useRef(et.enabledInteractions),Ji=p.useRef(i),mr=p.useRef(qt),Qi=p.useRef(rn),Qs=p.useRef(pt),Ma=p.useRef(Tt),ni=p.useRef(null),Qn=p.useRef(De),Lr=p.useRef(I),Ei=p.useRef(ee),Ca=p.useRef(U),on=p.useRef(G),Pr=p.useRef(A),Dr=p.useRef(f),Ti=p.useRef(z),In=p.useRef(mt),Aa=p.useRef(k),er=p.useRef(Lo),ea=p.useRef(bs(y)),te=p.useRef(Z),Ie=p.useRef(w),Xe=p.useRef([]),ht=p.useRef(0),It=p.useRef(!1),ln=p.useRef(ce),cn=p.useRef(new Set),Br=p.useRef(new Set),[un,pn]=p.useState([]),[ta,Mi]=p.useState("idle"),pr=p.useRef([]),ri=p.useRef(null),qn=p.useRef(ta),Ra=p.useCallback(()=>{pr.current=[],ri.current=null,qn.current="idle",Mi("idle"),pn(W=>W.length===0?W:[])},[]),gr=p.useRef(Ra);gr.current=Ra;const Or=p.useCallback(W=>{const pe=fe.current,we=W.target,Ke=sa(de.current);Cu(pe,we)||Cu(Ke,we)||h1(we)||qn.current!=="idle"||ri.current!==null||ae([])},[ae]),Un=p.useCallback((W,pe=1)=>({input:W,isDrawingEnabled:Rt.current,isRulerEnabled:Nr.current,virtualPaperEnabled:ki.current,virtualPaperInteractions:Si.current,allowedDrawingInputMethods:er.current,activeTouchPointers:pe}),[]),[Nn,Ia]=p.useState([]),ii=p.useRef([]),$e=p.useRef(null),na=p.useCallback(()=>{ii.current=[],$e.current=null,Br.current.clear(),Ia(W=>W.length===0?W:[])},[]),Pt=p.useRef(na);Pt.current=na;const kt=p.useCallback(W=>{ii.current.push(W),Ia(pe=>[...pe,W])},[]),zr=p.useRef(kt);zr.current=kt,Se.current=Q,Rt.current=je,Nr.current=he,ki.current=Te,Si.current=et.enabledInteractions,mr.current=qt,Qi.current=rn,Qs.current=pt,Ma.current=Tt,In.current=mt,Qn.current=De,Lr.current=I,Ei.current=ee,Ca.current=U,on.current=G,Pr.current=A,Dr.current=f,Ti.current=z,Aa.current=k,er.current=x??Lo,ea.current=bs(y),te.current=Z,Ie.current=X,ln.current=ce,qn.current=ta,p.useEffect(()=>{const W=new Set(mt.map(we=>we.id)),pe=Lt.current.filter(we=>W.has(we));ae(pe)},[ae,mt]),p.useEffect(()=>{if(!Te)return;const W=fe.current;if(!W)return;const pe=sa(O)??W;if(ts(pe,W,!0))return V6({listenerTarget:pe,multiDragRef:Ce,getInteractionOwnerOptions:Un})},[O,Un,Te]),p.useEffect(()=>{if(!(Q!=="lasso"||Ge.length===0))return document.addEventListener("pointerdown",Or),()=>{document.removeEventListener("pointerdown",Or)}},[Q,Ge.length,Or]),p.useImperativeHandle(n,()=>({deleteSelectedStrokes(){const W=Lt.current;W.length!==0&&(pt(W),ae([]))},clearSelection(){ae([])},getSelectedStrokeIds(){return[...Lt.current]}}),[ae,pt]);const wn=p.useCallback((W,pe)=>{if(!fe.current)return{x:0,y:0};const we=fe.current.getBoundingClientRect();return{x:W-we.left,y:pe-we.top}},[]),Ci=p.useCallback((W,pe,we,Ke)=>{const tt=nr(W,pe),lt=M5(tt,Ke,we,pe.scale);return lt?{screen:Ni(lt.canvas,pe),canvas:lt.canvas,result:lt}:{screen:W,canvas:tt,result:lt}},[]),Ai=p.useCallback(W=>{if(!Oe||!e1(W,Oe))return W;const pe=k3(W,Oe);return pe?{...W,x:pe.x,y:pe.y}:W},[Oe]),ue=p.useCallback((W,pe,we,Ke,tt)=>{const lt=Y6(pe)?Ci(W,we,Ke,tt).canvas:nr(W,we);return Ai(lt)},[Ai,Ci]),Re=p.useCallback(()=>{ni.current?.(),At.current=!1,me.current=0,Xe.current=[],ht.current=0,at(null)},[at]);p.useEffect(()=>{Ji.current!==i&&i!==void 0&&At.current&&Re(),Ji.current!==i&&i!==void 0&&(cn.current.clear(),Pt.current()),Ji.current=i},[Re,i]),p.useEffect(()=>{const W=fe.current;if(!W)return;const pe=sa(O)??W,we=pe instanceof Element?pe:W,Ke=ts(pe,W,Te)?ma:void 0,tt=new Map,lt=new Set,Ot=new Set,jn=new Set,Wn=cn.current;let nt=null;const Gn=()=>{nt=null};ni.current=Gn;const Ln=()=>{nt=null,At.current=!1,me.current=0,Xe.current=[],ht.current=0,at(null)},St=Y=>{if(!nt||Y.length===0)return;const qe=Se.current==="pen"&&ea.current.enabled?s3(Y,ea.current):Y;for(const Wt of qe)nt=t3(nt,Wt);const He=It.current&&da(nt.tool)?No(nt):nt;at(He)},ne=()=>{const Y=Xe.current;if(Y.length===0)return;const qe=Ie.current;if(!qe||qe<=0){St(Y),Xe.current=[];return}const He=1e3/qe,Wt=ht.current,Tn=[];let bt=Wt,an=Wt;for(const Zt of Y){const Jt=Zt.timestamp??++an;(bt===0||Jt-bt>=He)&&(Tn.push(Zt),bt=Jt)}if(Tn.length===1&&Y.length>1){const Zt=Y[Y.length-1],Jt=Tn[0];(Zt.x!==Jt.x||Zt.y!==Jt.y)&&Tn.push(Zt)}Tn.length>0&&(ht.current=bt,St(Tn)),Xe.current=[]},Ze=()=>{ne();const Y=nt;if(Y&&Y.tool!=="eraser"&&n3(Y)){const qe=It.current&&da(Y.tool)?No(Y):Y;mr.current(qe)}Ln()},Fe=()=>In.current.filter(Y=>!cn.current.has(Y.id)&&!Br.current.has(Y.id)).map(Y=>({...Y,fillColor:Y.fillColor??Dr.current})),rt=()=>Lr.current/2/ge.current.scale,Sn=()=>({eraserRadius:rt(),openFallbackWidth:Lr.current,closedFallbackWidth:Ei.current,pressureMultiplier:Ca.current}),En=Y=>{const qe=iu([Y],Fe(),Sn());return qe?qe.id:null},Xn=(Y,qe)=>{const He=O5(Y,qe,Fe(),Sn());return He?He.id:null},Vn=Y=>{const qe=new Set(Lt.current);if(qe.size===0)return null;const He=In.current.filter(Tn=>qe.has(Tn.id)),Wt=iu([Y],He,Sn());return Wt?Wt.id:null},tr=(Y,qe)=>{if(Se.current!=="lasso"||!Rt.current)return;if(!Oo(kl(qe),er.current)){gr.current();return}const He=nr(Y.point,ge.current),Wt=fr.current,Tn=Wt!==null&&He.x>=Wt.minX&&He.x<=Wt.maxX&&He.y>=Wt.minY&&He.y<=Wt.maxY;Wt!==null&&!Tn&&ae([]);const bt=Vn(He);if(Tn||Wt===null&&bt){const an=new Set(Lt.current),Zt=In.current.filter(Jt=>an.has(Jt.id)).map(J6);ri.current={pointerId:Y.pointerId,startCanvasPoint:He,originals:Zt},pr.current=[],qn.current="moving",Mi("moving"),pn(Jt=>Jt.length===0?Jt:[])}else ri.current=null,pr.current=[He],qn.current="drawing",Mi("drawing"),pn([He]);me.current=1},to=()=>qn.current==="drawing"?(ae(P5(In.current,pr.current)),gr.current(),!0):qn.current==="moving"?(gr.current(),!0):!1,no=Y=>{Y&&(ln.current==="on-release"?cn.current.add(Y):(Br.current.add(Y),Qi.current(Y)))},La=()=>{const Y=cn.current;if(Y.size!==0){for(const qe of Y)Qi.current(qe);Y.clear()}},kl=Y=>({pointerType:Y.pointerType,button:Y.button,clientX:Y.clientX,clientY:Y.clientY,timeStamp:Y.timeStamp}),Pa=Y=>({pointerId:Y.pointerId??1,point:wn(Y.clientX??0,Y.clientY??0),timestamp:Y.timeStamp??0,pointerType:Y.pointerType??"mouse",pressure:Y.pressure,isPrimary:Y.isPrimary??!0}),ro=Y=>{jn.has(Y)&&(typeof we.releasePointerCapture=="function"&&(typeof we.hasPointerCapture!="function"||we.hasPointerCapture(Y))&&we.releasePointerCapture(Y),jn.delete(Y))},U1=Y=>{typeof we.setPointerCapture=="function"&&(we.setPointerCapture(Y.pointerId),jn.add(Y.pointerId))},W1=(Y,qe,He)=>{if(!Rt.current){Ln();return}if(Se.current==="polygon"||Se.current==="bezier")return;if(!lt.has(Y.pointerId)){Ln();return}if(Se.current==="eraser"){for(let bt=me.current;bt<He.length;bt++){const an=He[bt];if(!an)continue;const Zt=nr(an.point,ge.current),Jt=ii.current,Fr=$e.current,Al=Jt[Jt.length-1]??Fr,Y1=Jt.length===0&&Fr!==null&&(Fr.x!==Zt.x||Fr.y!==Zt.y),K1=Al?Xn(Al,Zt):En(Zt);no(K1),Y1&&Fr&&zr.current(Fr),zr.current(Zt)}me.current=He.length;return}if(Se.current==="lasso"){if(qn.current==="drawing"){for(let bt=me.current;bt<He.length;bt++){const an=He[bt];if(!an)continue;const Zt=nr(an.point,ge.current);pr.current.push(Zt)}me.current=He.length,pn([...pr.current]);return}if(qn.current==="moving"){const bt=ri.current;if(!bt||bt.pointerId!==Y.pointerId)return;const an=nr(Y.point,ge.current),Zt=an.x-bt.startCanvasPoint.x,Jt=an.y-bt.startCanvasPoint.y;Ma.current(bt.originals.map(Fr=>Q6(Fr,Zt,Jt))),me.current=He.length;return}return}const Wt=He.map(bt=>ue(bt.point,Se.current,ge.current,te.current,In.current));if(Se.current==="line"&&!nt&&(He.length<2||K6(Wt)<=Po))return;if(!nt){const bt=Se.current;nt=e3(bt,{strokeColor:Qn.current,strokeWidth:Tu(bt)?Ei.current:Lr.current,dashArray:on.current,dashOffset:Pr.current,fillColor:Dr.current,fillOpacity:Ti.current}),At.current=!0,me.current=0,ht.current=0}const Tn=[];for(let bt=me.current;bt<He.length;bt++){const an=He[bt];if(!an)continue;const Jt={...Wt[bt]??ue(an.point,Se.current,ge.current,te.current,In.current),timestamp:an.timestamp||void 0};Aa.current===!0&&Se.current==="pen"&&an.pressure!==void 0&&(Jt.pressure=e7(an.pressure)),Tn.push(Jt)}Xe.current.push(...Tn),me.current=He.length,ne()},G1=Y=>{if(Se.current==="eraser"&&(La(),Pt.current()),Se.current==="lasso"&&to()){ot({type:"POINTER_UP",pointerId:Y.pointerId});return}Ze(),ns(Se.current)||ot({type:"POINTER_UP",pointerId:Y.pointerId,point:ue(Y.point,Se.current,ge.current,te.current,In.current)})},X1=Y=>{Wn.clear(),Pt.current(),gr.current(),Ln(),ot(ns(Se.current)?{type:"POINTER_CANCEL",pointerId:Y.pointerId}:{type:"POINTER_UP",pointerId:Y.pointerId})},V1=Y=>{if(Y.button!==void 0&&Y.button!==0||(Y.pointerType==="touch"&&Ot.add(Y.pointerId),oe.current.startPointer(Un(ji(Y),Ot.size))!=="drawing"))return;U1(Y);const He=Pa(Y),Wt=kl(Y);!Oo(Wt,er.current)||!Rt.current||(lt.size>0&&ln.current==="on-release"&&cn.current.clear(),lt.add(He.pointerId),tt.set(He.pointerId,[He]),Se.current==="eraser"&&Oo(Wt,er.current)&&($e.current=nr(He.point,ge.current)),tr(He,Y))},Sl=Y=>{Au(Y)&&V1(Y)},El=Y=>{const qe=Pa(Y);if(oe.current.getPointerOwner(qe.pointerId)!=="drawing")return;const He=tt.get(qe.pointerId);He&&(He.push(qe),W1(qe,Y,He))},Tl=Y=>{const qe=Pa(Y),He=ns(Se.current)?oe.current.getPointerOwner(qe.pointerId):oe.current.endPointer(qe.pointerId);ro(qe.pointerId),He==="drawing"&<.has(qe.pointerId)&&G1(qe),lt.delete(qe.pointerId),tt.delete(qe.pointerId),Y.pointerType==="touch"&&Ot.delete(Y.pointerId)},Ml=Y=>{const qe=Pa(Y),He=oe.current.endPointer(qe.pointerId);ro(qe.pointerId),He==="drawing"&<.has(qe.pointerId)&&X1(qe),lt.delete(qe.pointerId),tt.delete(qe.pointerId),Y.pointerType==="touch"&&Ot.delete(Y.pointerId)},Da=Y=>{if(Y.key!=="Shift")return;const qe=Y.type==="keydown";if(It.current!==qe&&(It.current=qe,nt&&da(nt.tool))){const He=qe?No(nt):nt;at(He)}},Cl=()=>{It.current=!1};return pe.addEventListener("pointerdown",Sl,Ke),document.addEventListener("pointermove",El),document.addEventListener("pointerup",Tl),document.addEventListener("pointercancel",Ml),window.addEventListener("keydown",Da),window.addEventListener("keyup",Da),window.addEventListener("blur",Cl),()=>{ni.current===Gn&&(ni.current=null),pe.removeEventListener("pointerdown",Sl,Ke),document.removeEventListener("pointermove",El),document.removeEventListener("pointerup",Tl),document.removeEventListener("pointercancel",Ml),window.removeEventListener("keydown",Da),window.removeEventListener("keyup",Da),window.removeEventListener("blur",Cl);for(const Y of jn)ro(Y);lt.clear(),tt.clear(),Ot.clear(),oe.current.reset(),Wn.clear(),Pt.current(),gr.current()}},[ae,O,Un,wn,ue,Te,at]),p.useEffect(()=>{const W=Ut.current;ot({type:"TOOL_CHANGE",tool:Q}),Q!=="eraser"&&(cn.current.clear(),Pt.current()),W==="lasso"&&Q!=="lasso"&&Lt.current.length>0&&ae([]),gr.current(),Ut.current=Q},[ae,Q]),p.useEffect(()=>{ln.current=ce},[ce]),p.useEffect(()=>{if(xe.phase!=="idle"||!xe.completedStroke)return;const W=xe.completedStroke;if(W.tool==="line"&&W.points.length>=2){const pe={schemaVersion:qr,id:Do(),tool:"line",points:W.points.map(we=>({x:we.x,y:we.y})),strokeColor:Qn.current,strokeWidth:Lr.current,dashArray:on.current?[...on.current]:void 0,dashOffset:Pr.current,fillColor:Dr.current,fillOpacity:Ti.current};mr.current(pe)}if(W.tool==="polygon"&&W.points.length>=3){const pe={schemaVersion:qr,id:Do(),tool:"polygon",points:W.points.map(we=>({x:we.x,y:we.y})),strokeColor:Qn.current,strokeWidth:Ei.current,dashArray:on.current?[...on.current]:void 0,dashOffset:Pr.current,fillColor:Dr.current,fillOpacity:Ti.current};mr.current(pe)}if(W.tool==="bezier"&&W.points.length===4){const pe={schemaVersion:qr,id:Do(),tool:"bezier",points:W.points.map(we=>({x:we.x,y:we.y})),strokeColor:Qn.current,strokeWidth:Lr.current,dashArray:on.current?[...on.current]:void 0,dashOffset:Pr.current};mr.current(pe)}ot({type:"TOOL_CHANGE",tool:Q})},[xe,Q]),p.useEffect(()=>{if(!ns(Q)||!je)return;const W=fe.current;if(!W)return;const pe=sa(O)??W,we=ts(pe,W,Te)?ma:void 0,Ke=(ne,Ze)=>{const Fe=wn(ne,Ze);return ue(Fe,Q,ge.current,te.current,In.current)};let tt=null;const lt=ne=>{if(ne.button!==void 0&&ne.button!==0||oe.current.startPointer(Un(ji(ne)))!=="drawing")return;const Fe=Ke(ne.clientX,ne.clientY);if(Q==="line"){tt={point:Fe,pointerId:ne.pointerId};return}ot({type:"POINTER_DOWN",point:Fe,pointerId:ne.pointerId,detail:ne.detail})},Ot=ne=>{Au(ne)&<(ne)},jn=ne=>{const Ze=oe.current.getPointerOwner(ne.pointerId);if((Ze==="none"?_i(Un(ji(ne,ne.button===void 0||ne.button===-1?0:ne.button))):Ze)!=="drawing")return;const rt=Ke(ne.clientX,ne.clientY);Q==="line"&&tt&&Math.hypot(rt.x-tt.point.x,rt.y-tt.point.y)>Po&&(tt=null),ot({type:"POINTER_MOVE",point:rt,pointerId:ne.pointerId})},Wn=ne=>{if(oe.current.endPointer(ne.pointerId)!=="drawing")return;if(Q==="bezier"){ot({type:"POINTER_UP",point:Ke(ne.clientX,ne.clientY),pointerId:ne.pointerId,detail:ne.detail});return}if(Q!=="line"||!tt)return;const Fe=Ke(ne.clientX,ne.clientY),rt=tt;tt=null,!(ne.pointerId!==void 0&&rt.pointerId!==void 0&&ne.pointerId!==rt.pointerId)&&(Math.hypot(Fe.x-rt.point.x,Fe.y-rt.point.y)>Po||ot({type:"POINTER_DOWN",point:Fe,pointerId:ne.pointerId,detail:ne.detail,mode:"place"}))},nt=ne=>{if(!f1(Q)||_i(Un(ji(ne,ne.button??0)))!=="drawing")return;tt=null;const Fe=Ke(ne.clientX,ne.clientY);ot({type:"POINTER_DOWN",point:Fe,detail:2})},Gn=ne=>{r7(ne)&&nt(ne)},Ln=ne=>{ne.key==="Escape"&&ot({type:"KEY_DOWN",key:"Escape"})},St=()=>{tt=null,ot({type:"BLUR"})};return pe.addEventListener("pointerdown",Ot,we),document.addEventListener("pointermove",jn),document.addEventListener("pointerup",Wn),pe.addEventListener("dblclick",Gn),window.addEventListener("keydown",Ln),window.addEventListener("blur",St),()=>{pe.removeEventListener("pointerdown",Ot,we),document.removeEventListener("pointermove",jn),document.removeEventListener("pointerup",Wn),pe.removeEventListener("dblclick",Gn),window.removeEventListener("keydown",Ln),window.removeEventListener("blur",St),oe.current.reset()}},[Q,O,Un,wn,ue,Te,je]);const Ve=xe.phase==="placingLine"?{schemaVersion:qr,id:"line-preview",tool:"line",points:xe.cursorPoint&&!Mu(xe.vertices,xe.cursorPoint)?[...xe.vertices,xe.cursorPoint]:[...xe.vertices],strokeColor:De,strokeWidth:I,dashArray:G?[...G]:void 0,dashOffset:A,fillColor:f,fillOpacity:z}:null,ft=xe.phase==="placingPolygon"?{schemaVersion:qr,id:"polygon-preview",tool:"polygon",points:xe.cursorPoint&&!Mu(xe.vertices,xe.cursorPoint)?[...xe.vertices,xe.cursorPoint]:[...xe.vertices],strokeColor:De,strokeWidth:ee,dashArray:G?[...G]:void 0,dashOffset:A,fillColor:f,fillOpacity:z}:null,Kt=(()=>{if(xe.phase!=="placingBezier")return null;const[W,pe,,we]=xe.points,Ke=xe.cursorPoint;let tt=[];if(xe.creationPhase==="line"&&W){const Ot=Ke??we;tt=Ot?[W,Ot]:[W]}else xe.creationPhase==="control1"&&W&&we?tt=[W,Ke??pe??we,we,we]:xe.creationPhase==="control2"&&W&&pe&&we&&(tt=[W,pe,Ke??we,we]);if(tt.length===0)return null;const lt=tt.length===4;return{schemaVersion:qr,id:"bezier-preview",tool:lt?"bezier":"line",points:tt.map(Ot=>({x:Ot.x,y:Ot.y})),strokeColor:De,strokeWidth:I,dashArray:G?[...G]:void 0,dashOffset:A}})(),kn=E!==!1,jr=E&&typeof E=="object"?E:{},gn=typeof jr.size=="number"&&Number.isFinite(jr.size)&&jr.size>0?jr.size:20,Na=jr.color??"currentColor",wl=jr.render,[ai,vr]=p.useState({visible:!1,screen:{x:0,y:0},canvas:{x:0,y:0},pointerType:"mouse"}),si=p.useRef(!1);p.useEffect(()=>{if(!kn)return;const W=fe.current;if(!W)return;const pe=sa(O)??W,we=ts(pe,W,Te)?ma:void 0,Ke=St=>St==="touch"||St==="pen"||St==="mouse"?St:"mouse",tt=(St,ne)=>{const Ze=wn(St,ne),Fe=ue(Ze,Se.current,ge.current,te.current,In.current);return{screen:Ni(Fe,ge.current),canvas:Fe}},lt=St=>{const ne=St;return{clientX:ne.clientX??0,clientY:ne.clientY??0,pointerId:ne.pointerId??1,pointerType:Ke(ne.pointerType)}},Ot=St=>{const{clientX:ne,clientY:Ze,pointerType:Fe}=lt(St),{screen:rt,canvas:Sn}=tt(ne,Ze);vr({visible:Fe!=="touch",screen:rt,canvas:Sn,pointerType:Fe})},jn=St=>{const{clientX:ne,clientY:Ze,pointerId:Fe,pointerType:rt}=lt(St);if(oe.current.getPointerOwner(Fe)==="virtual-paper"){vr(tr=>({...tr,visible:!1}));return}const{screen:En,canvas:Xn}=tt(ne,Ze);rt==="touch"&&si.current&&ye.current.set(Fe,En);const Vn=rt==="touch"?si.current&&ye.current.size<2:!0;vr({visible:Vn,screen:En,canvas:Xn,pointerType:rt})},Wn=()=>{si.current=!1,ye.current.clear(),vr(St=>({...St,visible:!1}))},nt=St=>{const ne=lt(St);if(oe.current.getPointerOwner(ne.pointerId)==="virtual-paper"){si.current=!1,ye.current.delete(ne.pointerId),vr(tr=>({...tr,visible:!1,pointerType:ne.pointerType}));return}si.current=!0;const{clientX:Fe,clientY:rt,pointerId:Sn,pointerType:En}=ne,{screen:Xn,canvas:Vn}=tt(Fe,rt);En==="touch"&&ye.current.set(Sn,Xn),vr({visible:En!=="touch"||ye.current.size<2,screen:Xn,canvas:Vn,pointerType:En})},Gn=St=>{const ne=lt(St);ye.current.delete(ne.pointerId);const Ze=ne.pointerType==="touch"?Array.from(ye.current.entries()).find(([Fe])=>Fe!==ne.pointerId)?.[1]:void 0;if(si.current=Ze!==void 0,ne.pointerType==="touch"){if(!Ze){vr(rt=>({...rt,visible:!1,pointerType:ne.pointerType}));return}const Fe=ue(Ze,Se.current,ge.current,te.current,In.current);vr({visible:!0,screen:Ni(Fe,ge.current),canvas:Fe,pointerType:ne.pointerType})}},Ln=()=>{si.current=!1,ye.current.clear(),vr(St=>({...St,visible:!1}))};return pe.addEventListener("pointerenter",Ot),pe.addEventListener("pointermove",jn),pe.addEventListener("pointerleave",Wn),pe.addEventListener("pointerdown",nt,we),pe.addEventListener("pointerup",Gn),window.addEventListener("blur",Ln),()=>{pe.removeEventListener("pointerenter",Ot),pe.removeEventListener("pointermove",jn),pe.removeEventListener("pointerleave",Wn),pe.removeEventListener("pointerdown",nt,we),pe.removeEventListener("pointerup",Gn),window.removeEventListener("blur",Ln)}},[kn,O,wn,ue,Te]);const j1=I*Ee.scale/2,F1=(da(Q)?ee:I)*Ee.scale/2,_1=Math.min(Math.max(F1,1),Math.max(1,gn/2-1)),eo={screen:ai.screen,canvas:ai.canvas,pointerType:ai.pointerType,activeTool:Q,visible:ai.visible,eraserRadius:Q==="eraser"?j1:void 0},$1=Te?void 0:`translate(${Ee.tx} ${Ee.ty}) scale(${Ee.scale})`,H1=Te?{width:"100%",height:"100%",..._!==void 0?{overflow:_}:{}}:void 0,q1=u.jsxs("svg",{"data-pressure-multiplier":String(U),style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:_},children:[u.jsx("title",{children:"Drawing surface"}),u.jsxs("g",{transform:$1,children:[mt.map(W=>u.jsx(Oi,{stroke:W,isActive:H.has(W.id),fallbackColor:De,fallbackWidth:I,fallbackClosedWidth:ee,fallbackDashArray:G,fallbackDashOffset:A,fallbackFillColor:f,fallbackFillOpacity:z,pressureMultiplier:U},W.id)),sn&&u.jsx(Oi,{stroke:sn,isActive:!0,fallbackColor:De,fallbackWidth:I,fallbackClosedWidth:ee,fallbackDashArray:G,fallbackDashOffset:A,fallbackFillColor:f,fallbackFillOpacity:z,pressureMultiplier:U}),Ve&&u.jsx(Oi,{stroke:Ve,isActive:!0,fallbackColor:De,fallbackWidth:I,fallbackClosedWidth:ee,fallbackDashArray:G,fallbackDashOffset:A,fallbackFillColor:f,fallbackFillOpacity:z,pressureMultiplier:U}),ft&&u.jsx(Oi,{stroke:ft,isActive:!0,fallbackColor:De,fallbackWidth:I,fallbackClosedWidth:ee,fallbackDashArray:G,fallbackDashOffset:A,fallbackFillColor:f,fallbackFillOpacity:z,pressureMultiplier:U}),Kt&&u.jsx(Oi,{stroke:Kt,isActive:!0,fallbackColor:De,fallbackWidth:I,fallbackClosedWidth:ee,fallbackDashArray:G,fallbackDashOffset:A,fallbackFillColor:f,fallbackFillOpacity:z,pressureMultiplier:U}),u.jsx("g",{"data-testid":"eraser-trajectory-layer",children:be.visible&&Q==="eraser"&&Nn.length>0&&u.jsx("polyline",{"data-testid":"eraser-trajectory",points:Nn.map(W=>`${W.x},${W.y}`).join(" "),stroke:be.color,strokeWidth:be.lineWidth,opacity:be.opacity,fill:"none",pointerEvents:"none",strokeLinecap:"round",strokeLinejoin:"round"})}),un.length>1&&u.jsx("polyline",{"data-testid":"lasso-preview",points:un.map(W=>`${W.x},${W.y}`).join(" "),fill:"rgba(59,130,246,0.1)",stroke:"rgb(59,130,246)",strokeWidth:2,strokeDasharray:"4 4",pointerEvents:"none"}),Q==="lasso"&&Ge.length>0&&Ct!=null&&u.jsx("rect",{"data-testid":"lasso-selection-box",x:Ct.minX,y:Ct.minY,width:Ct.maxX-Ct.minX,height:Ct.maxY-Ct.minY,fill:"rgba(59,130,246,0.2)",stroke:"rgb(59,130,246)",strokeWidth:3,strokeDasharray:"4 4",vectorEffect:"non-scaling-stroke",pointerEvents:"none","data-padding":jh}),he&&Oe&&u.jsxs("g",{"data-testid":"drawing-ruler","data-ruler-center-x":String(Oe.center.x),"data-ruler-center-y":String(Oe.center.y),"data-ruler-rotation":String(Oe.rotationRad),"data-ruler-length":String(Oe.length),"data-ruler-height":String(Oe.height),transform:`translate(${Oe.center.x} ${Oe.center.y}) rotate(${Oe.rotationRad*180/Math.PI})`,children:[u.jsx("rect",{"data-testid":"drawing-ruler-background",x:-Oe.length/2,y:-Oe.height/2,width:Oe.length,height:Oe.height,fill:Ne.backgroundColor??"#e0e0e0",fillOpacity:String(Ne.backgroundOpacity??.2)}),u.jsx("circle",{"data-testid":"drawing-ruler-drag-grip",cx:0,cy:0,r:Ne.dragGripSize??24,fill:"white",stroke:"grey",strokeWidth:2}),u.jsx("g",{className:"ruler-ticks",children:M3(Oe,{minorSpacing:Ne.minorTickSpacing??10,majorSpacing:(Ne.minorTickSpacing??10)*(Ne.majorTickEvery??5)}).map(W=>{const pe=W.localX===0;return u.jsxs("g",{transform:`translate(${W.localX} ${-Oe.height/2})`,children:[u.jsx("line",{"data-testid":pe?"drawing-ruler-center-tick":"drawing-ruler-tick",x1:0,y1:0,x2:0,y2:W.kind==="major"?20:10,stroke:"black",strokeWidth:1}),W.label&&u.jsx("text",{x:0,y:35,fontSize:12,textAnchor:"middle",fill:"black",children:W.label})]},W.localX.toFixed(6))})})]})]})]});return u.jsxs("div",{ref:fe,"data-testid":B,"data-tool":Q,"data-enabled":String(je),"data-stroke-count":mt.length,"data-active-tool":Q,"data-scale":String(Ee.scale),"data-tx":String(Ee.tx),"data-ty":String(Ee.ty),style:{width:"100%",height:"100%",minHeight:"200px",border:"1px solid #ccc",position:"relative",touchAction:"none",cursor:kn?"none":void 0},children:[u.jsx(G6,{enabled:Te,options:et,viewport:Ee,onViewportChange:We,containerStyle:H1,children:q1}),kn&&ai.visible&&u.jsx("div",{"data-crosshair-layer":!0,style:{position:"absolute",inset:0,pointerEvents:"none",overflow:"hidden"},children:u.jsx("div",{style:{position:"absolute",left:ai.screen.x,top:ai.screen.y,transform:"translate(-50%, -50%)"},children:wl?wl(eo):Q==="eraser"&&eo.eraserRadius!==void 0?(()=>{const W=eo.eraserRadius,pe=W*2+2;return u.jsxs("svg",{"data-testid":"eraser-cursor",width:pe,height:pe,viewBox:`-${W+1} -${W+1} ${pe} ${pe}`,style:{display:"block",overflow:"visible"},children:[u.jsx("title",{children:"Eraser cursor"}),u.jsx("circle",{cx:0,cy:0,r:W,fill:"none",stroke:Na,strokeWidth:1})]})})():u.jsxs("svg",{"data-crosshair":!0,width:gn,height:gn,viewBox:`0 0 ${gn} ${gn}`,style:{display:"block",overflow:"visible"},children:[u.jsx("title",{children:"Pointer crosshair"}),u.jsx("line",{x1:0,y1:gn/2,x2:gn,y2:gn/2,stroke:Na,strokeWidth:1}),u.jsx("line",{x1:gn/2,y1:0,x2:gn/2,y2:gn,stroke:Na,strokeWidth:1}),u.jsx("circle",{"data-testid":"crosshair-center-circle",cx:gn/2,cy:gn/2,r:_1,fill:"none",stroke:Na,strokeWidth:1})]})})})]})}),a7=["pen","line","rect","ellipse","polygon","bezier"];function ul(e){return typeof e=="object"&&e!==null}function s7(e){return typeof e=="string"&&a7.includes(e)}function o7(e){if(!ul(e))return null;const{x:t,y:n,pressure:r}=e;return typeof t!="number"||!Number.isFinite(t)||typeof n!="number"||!Number.isFinite(n)?null:typeof r=="number"&&Number.isFinite(r)?{x:t,y:n,pressure:r}:{x:t,y:n}}function l7(e){return Array.isArray(e)?e.flatMap(t=>{const n=o7(t);return n?[n]:[]}):[]}function c7(e){if(Array.isArray(e))return e.every(t=>typeof t=="number"&&Number.isFinite(t))?[...e]:void 0}function u7(e,t){if(typeof e.id!="string")return null;const n=c7(e.dashArray),r={schemaVersion:qr,id:e.id,points:l7(e.points),...typeof e.strokeColor=="string"?{strokeColor:e.strokeColor}:{},...typeof e.strokeWidth=="number"&&Number.isFinite(e.strokeWidth)?{strokeWidth:e.strokeWidth}:{},...n?{dashArray:n}:{},...typeof e.dashOffset=="number"&&Number.isFinite(e.dashOffset)?{dashOffset:e.dashOffset}:{},...typeof e.fillColor=="string"?{fillColor:e.fillColor}:{},...typeof e.fillOpacity=="number"&&Number.isFinite(e.fillOpacity)?{fillOpacity:e.fillOpacity}:{}};switch(t){case"pen":return{...r,tool:t};case"line":return{...r,tool:t};case"rect":return{...r,tool:t};case"ellipse":return{...r,tool:t};case"polygon":return{...r,tool:t};case"bezier":return{...r,tool:t};default:return hr(t)}}function d7(e){if(!ul(e))return null;const t=e;return s7(t.tool)?u7(t,t.tool):null}function dl(e){const t=ul(e)?e:{},n=Array.isArray(t.strokes)?t.strokes:[];return{...t,schemaVersion:qr,strokes:n.flatMap(r=>{const i=d7(r);return i?[i]:[]})}}const h7="#1e293b",m1=2,f7=e=>{const t=e.trim();if(t)try{const n=JSON.parse(t);return typeof n!="object"||n===null?void 0:dl(n)}catch{return}},m7=e=>JSON.stringify(dl(e)),p7=e=>{let t=1/0,n=1/0,r=-1/0,i=-1/0;for(const s of e){const o=(s.strokeWidth??m1)/2;for(const l of s.points)t=Math.min(t,l.x-o),n=Math.min(n,l.y-o),r=Math.max(r,l.x+o),i=Math.max(i,l.y+o)}if(!Number.isFinite(t))return;const a=1;return{minX:t-a,minY:n-a,width:r-t+a*2,height:i-n+a*2}},g7=[{tool:"pen",label:"画笔"},{tool:"line",label:"直线"},{tool:"rect",label:"矩形"},{tool:"ellipse",label:"椭圆"},{tool:"eraser",label:"橡皮"}],v7={"--hn-drawer-size":"60vh"},Ru=({value:e})=>{const t=e?p7(e.strokes):void 0;return!e||!t?u.jsx("span",{className:"hn-note-drawing-placeholder",children:"Drawing"}):u.jsx("svg",{className:"hn-note-drawing-thumbnail",viewBox:`${t.minX} ${t.minY} ${t.width} ${t.height}`,preserveAspectRatio:"xMidYMid meet",role:"img","aria-label":"画板缩略图",children:e.strokes.map(n=>u.jsx(Oi,{stroke:n,fallbackColor:h7,fallbackWidth:m1},n.id))})},y7=({block:e,ctx:t})=>{const[n,r]=p.useState(!1),[i,a]=p.useState("pen"),s=p.useRef(null),o=p.useMemo(()=>f7(e.data),[e.data]),l=()=>{r(!1)};return p.useEffect(()=>{t.openBlockMenuId!==null&&r(!1)},[t.openBlockMenuId]),u.jsxs(u.Fragment,{children:[mn(e,t),u.jsx("div",{className:"hn-note-drawing",children:t.editable?u.jsx("button",{ref:s,type:"button",className:"hn-note-drawing-preview hn-note-drawing-preview--editable","data-editable-block-id":e.id,"aria-label":"编辑画板","aria-expanded":n,"aria-haspopup":"dialog",onClick:()=>{t.onBlockMenuOpenChange(ds("convert",{kind:"block",blockId:e.id}),!1),r(!0)},children:u.jsx(Ru,{value:o})}):u.jsx("div",{className:"hn-note-drawing-preview",children:u.jsx(Ru,{value:o})})}),u.jsxs(td,{open:n,onClose:l,placement:"bottom",className:"hn-note-drawing-drawer",style:v7,"aria-label":"画板编辑器",children:[u.jsxs("div",{className:"hn-note-drawing-toolbar",role:"toolbar","aria-label":"画板工具",children:[g7.map(d=>u.jsx("button",{type:"button",className:"hn-note-drawing-tool","aria-pressed":i===d.tool,onClick:()=>a(d.tool),children:d.label},d.tool)),u.jsx("button",{type:"button",className:"hn-note-drawing-tool hn-note-drawing-close",onClick:l,children:"完成"})]}),u.jsx("div",{className:"hn-note-drawing-canvas",children:u.jsx(i7,{tool:i,value:o??b7,onChange:d=>t.onBlocksChange?.(q4(t.getBlocks(),e.id,m7(d)))})})]})]})},b7=dl(null),Iu=({formula:e})=>{const t=p.useRef(null);return p.useLayoutEffect(()=>{const n=t.current;!n||!e.trim()||Jd.render(e,n,{displayMode:!0,throwOnError:!1})},[e]),e.trim()?u.jsx("span",{ref:t,className:"hn-note-formula-rendered"}):u.jsx("span",{className:"hn-note-formula-placeholder","aria-hidden":"true",children:"f(x)"})},x7=({block:e,ctx:t})=>{const[n,r]=p.useState(null),i=p.useRef(null),a=p.useRef(null),s=p.useRef(null);return p.useEffect(()=>{if(!n)return;s.current?.focus();const o=()=>r(null),l=f=>{const g=f.target;g instanceof Node&&(a.current?.contains(g)||i.current?.contains(g)||o())},d=f=>{f.key==="Escape"&&(o(),i.current?.focus())},c=f=>{const g=f.target;g instanceof Node&&a.current?.contains(g)||o()};return document.addEventListener("pointerdown",l),document.addEventListener("keydown",d),window.addEventListener("resize",o),window.addEventListener("scroll",c,!0),()=>{document.removeEventListener("pointerdown",l),document.removeEventListener("keydown",d),window.removeEventListener("resize",o),window.removeEventListener("scroll",c,!0)}},[n]),p.useEffect(()=>{t.openBlockMenuId!==null&&r(null)},[t.openBlockMenuId]),u.jsxs(u.Fragment,{children:[mn(e,t),u.jsx("div",{className:"hn-note-formula",children:t.editable?u.jsx("button",{ref:i,type:"button",className:"hn-note-formula-preview hn-note-formula-preview--editable","data-editable-block-id":e.id,"aria-label":"编辑公式","aria-expanded":n!==null,"aria-haspopup":"dialog",onClick:o=>{t.onBlockMenuOpenChange(ds("convert",{kind:"block",blockId:e.id}),!1);const l=o.currentTarget,d=getComputedStyle(l);r({el:l,theme:d.getPropertyValue("--hn-theme"),codeFont:d.getPropertyValue("--hn-code-font")})},children:u.jsx(Iu,{formula:e.formula})}):u.jsx("div",{className:"hn-note-formula-preview",children:u.jsx(Iu,{formula:e.formula})})}),n?u.jsx(Is,{ref:a,anchor:n.el,className:"hn-note-formula-popover",style:{"--hn-theme":n.theme,"--hn-code-font":n.codeFont},role:"dialog","aria-label":"公式编辑器",children:u.jsx("textarea",{ref:s,className:"hn-note-formula-textarea",value:e.formula,rows:5,spellCheck:!1,"aria-label":"公式(LaTeX)",placeholder:"例如:E = mc^2",onChange:o=>t.onBlocksChange?.(H4(t.getBlocks(),e.id,o.target.value))})}):null]})},w7=({block:e,ctx:t})=>u.jsxs(u.Fragment,{children:[mn(e,t),u.jsx("figure",{className:"hn-note-picture",children:u.jsx("img",{src:e.url,alt:e.filename,width:e.width,height:e.height,decoding:"async"})})]});function Nu({sourceIndex:e,targetIndex:t,itemCount:n,pointerOffset:r,targetSize:i}){if(!(Number.isInteger(e)&&e>=0&&e<n&&Number.isInteger(t)&&t>=0&&t<n)||!Number.isFinite(r)||!Number.isFinite(i)||i<=0)return null;const s=r>=i/2?t+1:t,o=s>e?s-1:s;return{insertionIndex:s,destinationIndex:o}}function k7({axis:e,point:t,sourceIndex:n,table:r}){const i=document.elementFromPoint(t.x,t.y)?.closest("td[data-table-row][data-table-column]");if(i==null||i.closest("table")!==r)return null;const a=i.getBoundingClientRect(),s=Number.parseInt(i.getAttribute("data-table-row")??"",10),o=Number.parseInt(i.getAttribute("data-table-column")??"",10);switch(e){case"row":return Nu({sourceIndex:n,targetIndex:s,itemCount:r.rows.length,pointerOffset:t.y-a.top,targetSize:a.height});case"column":return Nu({sourceIndex:n,targetIndex:o,itemCount:r.rows.item(0)?.cells.length??0,pointerOffset:t.x-a.left,targetSize:a.width})}}function S7(e,t,n){const r=[];let i;switch(t){case"row":{const a=n===0?0:n-1,s=e.rows.item(a);s!==null&&r.push(...Array.from(s.cells)),i=n===0?"hn-note-table-drop-preview--row-before":"hn-note-table-drop-preview--row-after";break}case"column":{const a=n===0?0:n-1;for(const s of Array.from(e.rows)){const o=s.cells.item(a);o!==null&&r.push(o)}i=n===0?"hn-note-table-drop-preview--column-before":"hn-note-table-drop-preview--column-after";break}}for(const a of r)a.classList.add(i);return()=>{for(const a of r)a.classList.remove(i)}}const E7=4,T7=e=>({position:{x:0,y:0},width:e.offsetWidth,height:e.offsetHeight,rotation:0,scale:1}),Lu=({axis:e,className:t,index:n,label:r,symbol:i,onActivate:a,onDragStart:s,onMove:o})=>{const l=p.useRef(null),d=p.useRef(o),c=p.useRef(!1);return d.current=o,p.useEffect(()=>{const f=l.current;if(f===null)return;const g=f.closest("table");if(g===null)return;let y=null,x=n,k=!1,w=!1,E=null,S=null;const R=new jt.Drag(f,{getPose:T7,setPose:()=>{},setPoseOnEnd:()=>{}}),L=_=>{S?.(),S=null;const F=_[0];y=F?.getLastOperation()?.point??null,E=F?.pointerId??null,x=n,k=!1,w=!1},P=_=>{const F=_[0]?.getLastOperation()?.point;if(F===void 0||y===null||(Math.hypot(F.x-y.x,F.y-y.y)>=E7&&(k=!0,f.classList.add("hn-note-table-drag-handle--dragging")),!k))return;S?.(),S=null,x=n;const $=k7({axis:e,point:F,sourceIndex:n,table:g});$!==null&&(x=$.destinationIndex,S=S7(g,e,$.insertionIndex))},B=()=>{f.classList.remove("hn-note-table-drag-handle--dragging"),S?.(),S=null,k&&(w||(c.current=!0,window.setTimeout(()=>{c.current=!1},0)),!w&&x!==n&&d.current(n,x))},O=_=>{_.pointerId===E&&(w=!0,f.classList.remove("hn-note-table-drag-handle--dragging"),S?.(),S=null,x=n,E=null,y=null)};return document.addEventListener("pointercancel",O,!0),R.addEventListener(jt.DragOperationType.Start,L),R.addEventListener(jt.DragOperationType.Move,P),R.addEventListener(jt.DragOperationType.End,B),()=>{document.removeEventListener("pointercancel",O,!0),S?.(),R.destroy()}},[e,n]),u.jsx("button",{ref:l,type:"button",className:t,"aria-label":r,title:`${r},拖动移动${e==="row"?"行":"列"}`,onPointerDown:f=>s(f.currentTarget),onClick:f=>{if(c.current){c.current=!1,f.preventDefault(),f.stopPropagation();return}a(f)},children:i})},M7=({items:e,triggerRect:t,onClose:n})=>{const r=p.useRef(null),[i,a]=p.useState(null),s={position:"fixed",top:t.bottom+4,left:Math.min(t.left,window.innerWidth-180),zIndex:9999};return p.useEffect(()=>{const o=c=>{r.current&&!r.current.contains(c.target)&&n()},l=c=>{c.key==="Escape"&&n()},d=()=>n();return document.addEventListener("mousedown",o),document.addEventListener("keydown",l),window.addEventListener("scroll",d,!0),window.addEventListener("resize",d),()=>{document.removeEventListener("mousedown",o),document.removeEventListener("keydown",l),window.removeEventListener("scroll",d,!0),window.removeEventListener("resize",d)}},[n]),Gr.createPortal(u.jsx("div",{ref:r,className:"hn-note-block-menu",role:"menu",style:s,children:e.map(o=>u.jsx("button",{type:"button",role:"menuitem",className:["hn-note-block-menu-item",o.danger?"hn-note-block-menu-item--danger":""].filter(Boolean).join(" "),disabled:o.disabled,onClick:()=>{if(o.confirmationLabel&&i!==o.confirmationLabel){a(o.confirmationLabel);return}o.onClick(),n()},children:i===o.confirmationLabel?o.confirmationLabel:o.label},o.label))}),document.body)},xi=(e,t,n)=>e.flatMap(r=>{if(r.id!==t||r.kind!=="table")return[r];const i=n(r);return i===null?[]:[i]}),p1=(e,t,n)=>{if(e[t]===void 0||e[n]===void 0)return null;const r=[...e],[i]=r.splice(t,1);return i===void 0?null:(r.splice(n,0,i),r)},C7=(e,t,n,r,i)=>xi(e,t,a=>{if(a.rows[n]?.[r]===void 0)return a;const s=a.rows.map((o,l)=>l===n?o.map((d,c)=>c===r?hn(i):d):o);return{...a,rows:s}}),Pu=(e,t,n)=>xi(e,t,r=>{const i=r.rows[0]?.length??1,a=Array.from({length:i},()=>""),s=[...r.rows],o=Math.max(0,Math.min(n,s.length));return s.splice(o,0,a),{...r,rows:s}}),Du=(e,t,n)=>xi(e,t,r=>{const i=r.rows.map(a=>{const s=[...a],o=Math.max(0,Math.min(n,s.length));return s.splice(o,0,""),s});return{...r,rows:i}}),A7=(e,t,n)=>xi(e,t,r=>{if(r.rows.length<=1||r.rows[n]===void 0)return r;const i=r.rows.filter((a,s)=>s!==n);return{...r,rows:i}}),R7=(e,t,n)=>xi(e,t,r=>{if((r.rows[0]?.length??0)<=1||r.rows[0]?.[n]===void 0)return r;const a=r.rows.map(s=>s.filter((o,l)=>l!==n));return{...r,rows:a}}),I7=(e,t,n,r)=>xi(e,t,i=>{const a=p1(i.rows,n,r);return a===null?i:{...i,rows:a}}),N7=(e,t,n,r)=>xi(e,t,i=>{const a=i.rows[0]?.length??0;if(n<0||n>=a||r<0||r>=a)return i;const s=i.rows.map(o=>p1(o,n,r)??o);return{...i,rows:s}}),wr=(e,t,n)=>`${e}-r${t}-c${n}`,Bu=e=>{const t=window.getSelection();if(!t||t.rangeCount===0)return!1;const n=t.getRangeAt(0);if(!e.contains(n.commonAncestorContainer))return!1;const r=document.createRange();return r.selectNodeContents(e),r.setStart(n.endContainer,n.endOffset),r.toString()===""},Ou=e=>{const t=window.getSelection();if(!t||t.rangeCount===0)return!1;const n=t.getRangeAt(0);if(!e.contains(n.commonAncestorContainer))return!1;const r=document.createRange();return r.selectNodeContents(e),r.setEnd(n.startContainer,n.startOffset),r.toString()===""},L7=({ctx:e,event:t,block:n,row:r,col:i})=>{const{onBlocksChange:a,requestFocus:s}=e;if(!a)return;const o=t.currentTarget,l=n.rows.length,d=n.rows[0]?.length??0;if(t.key==="Enter"&&t.shiftKey){t.preventDefault();const c=window.getSelection();if(!c?.rangeCount)return;const f=c.getRangeAt(0),g=document.createElement("br"),y=document.createTextNode("");f.deleteContents(),f.insertNode(y),f.insertNode(g),f.setStartAfter(y),f.setEndAfter(y),c.removeAllRanges(),c.addRange(f);return}if(t.key==="Enter"&&!t.shiftKey){t.preventDefault();const c=r+1;c<l&&s?.(wr(n.id,c,i),"start");return}if(t.key==="ArrowRight"){if(!Bu(o))return;t.preventDefault();const c=i+1;if(c<d)s?.(wr(n.id,r,c),"start");else{const f=r+1;f<l&&s?.(wr(n.id,f,0),"start")}return}if(t.key==="ArrowLeft"){if(!Ou(o))return;t.preventDefault();const c=i-1;if(c>=0)s?.(wr(n.id,r,c),"end");else{const f=r-1;if(f>=0){const g=(n.rows[f]?.length??1)-1;s?.(wr(n.id,f,g),"end")}}return}if(t.key==="ArrowDown"){if(!Bu(o))return;t.preventDefault();const c=r+1;c<l&&s?.(wr(n.id,c,i),"start");return}if(t.key==="ArrowUp"){if(!Ou(o))return;t.preventDefault();const c=r-1;c>=0&&s?.(wr(n.id,c,i),"end")}},zu=(e,t)=>{const{sourceIndex:n,destinationIndex:r}=t;return e===n?r:n<r&&e>n&&e<=r?e-1:n>r&&e>=r&&e<n?e+1:e},P7=(e,t,n)=>{const{destinationIndex:r}=n;if(t===null)return e==="row"?{row:r,col:0}:{row:0,col:r};switch(e){case"row":return{row:zu(t.row,n),col:t.col};case"column":return{row:t.row,col:zu(t.col,n)};default:return Vt(e)}},D7=e=>{const t=document.activeElement;if(!(t instanceof HTMLElement)||!e.contains(t)||!t.matches(".hn-note-table-cell[data-editable-block-id]"))return null;const n=t.closest("[data-table-row][data-table-column]"),r=Number(n?.getAttribute("data-table-row")),i=Number(n?.getAttribute("data-table-column"));return Number.isInteger(r)&&Number.isInteger(i)?{row:r,col:i}:null},B7=(e,t)=>{const[n,r]=p.useState(null),i=p.useRef(null);return{focusedCell:n,setFocusedCell:r,captureDragStartFocus:o=>{const l=o.closest("table");i.current=l===null?null:D7(l)},moveTable:(o,l)=>{const d=P7(o,i.current,l),c=(()=>{switch(o){case"row":return I7(t.getBlocks(),e.id,l.sourceIndex,l.destinationIndex);case"column":return N7(t.getBlocks(),e.id,l.sourceIndex,l.destinationIndex);default:return Vt(o)}})();i.current=null,r(d),t.onBlocksChange?.(c),t.requestFocus?.(wr(e.id,d.row,d.col),"start")}}},O7=(e,t)=>{const{onBlocksChange:n}=t,[r,i]=p.useState(null),a=e.rows.length,s=e.rows[0]?.length??0,o=p.useCallback(()=>i(null),[]),l=p.useCallback((y,x)=>{y.preventDefault(),y.stopPropagation(),i({triggerRect:y.currentTarget.getBoundingClientRect(),items:x})},[]),d=p.useCallback((y,x)=>{l(y,[{label:"添加行",onClick:()=>n?.(Pu(t.getBlocks(),e.id,x+1))},{label:"删除行",confirmationLabel:"确认删除行",onClick:()=>n?.(A7(t.getBlocks(),e.id,x)),disabled:a<=1,danger:!0}])},[e.id,t,n,l,a]),c=p.useCallback((y,x)=>{l(y,[{label:"添加列",onClick:()=>n?.(Du(t.getBlocks(),e.id,x+1))},{label:"删除列",onClick:()=>n?.(R7(t.getBlocks(),e.id,x)),disabled:s<=1,danger:!0}])},[e.id,s,t,n,l]),f=p.useCallback((y,x)=>{l(y,[{label:"添加列",onClick:()=>n?.(Du(t.getBlocks(),e.id,x))}])},[e.id,t,n,l]),g=p.useCallback((y,x)=>{l(y,[{label:"添加行",onClick:()=>n?.(Pu(t.getBlocks(),e.id,x))}])},[e.id,t,n,l]);return{openMenu:r,closeMenu:o,openRowMenu:d,openColumnMenu:c,openColumnEdgeMenu:f,openRowEdgeMenu:g}},z7=(e,t)=>u.jsx(j7,{block:e,ctx:t},e.id),j7=({block:e,ctx:t})=>{const{editable:n,onBlocksChange:r}=t,{focusedCell:i,setFocusedCell:a,captureDragStartFocus:s,moveTable:o}=B7(e,t),l=i?.row??null,d=i?.col??null,{openMenu:c,closeMenu:f,openRowMenu:g,openColumnMenu:y,openColumnEdgeMenu:x,openRowEdgeMenu:k}=O7(e,t);return n?u.jsxs(u.Fragment,{children:[mn(e,t),u.jsx("div",{className:"hn-note-table-wrapper",children:u.jsx("table",{className:"hn-note-table",children:u.jsx("tbody",{children:e.rows.map((w,E)=>u.jsx("tr",{className:E===0?"hn-note-table-header-row":void 0,"data-note-atomic-id":`table:${e.id}:row:${E}`,children:w.map((S,R)=>u.jsxs("td",{className:E===0?"hn-note-table-header-cell":void 0,"data-table-row":E,"data-table-column":R,children:[R===0&&E===l&&u.jsx(Lu,{axis:"row",className:"hn-note-table-row-op hn-note-table-row-op--visible",index:E,label:"行操作",symbol:"⋮",onActivate:L=>g(L,E),onDragStart:s,onMove:(L,P)=>o("row",{sourceIndex:L,destinationIndex:P})}),E===0&&R===d&&u.jsx(Lu,{axis:"column",className:"hn-note-table-col-op hn-note-table-col-op--visible",index:R,label:"列操作",symbol:"⋯",onActivate:L=>y(L,R),onDragStart:s,onMove:(L,P)=>o("column",{sourceIndex:L,destinationIndex:P})}),R>0&&u.jsx("button",{type:"button",className:"hn-note-table-edge-btn hn-note-table-edge-btn--left","aria-label":"在此处添加列",onClick:L=>x(L,R),children:"+"}),u.jsx("button",{type:"button",className:"hn-note-table-edge-btn hn-note-table-edge-btn--right","aria-label":"在此处添加列",onClick:L=>x(L,R+1),children:"+"}),E>0&&u.jsx("button",{type:"button",className:"hn-note-table-edge-btn hn-note-table-edge-btn--top","aria-label":"在此处添加行",onClick:L=>k(L,E),children:"+"}),u.jsx("button",{type:"button",className:"hn-note-table-edge-btn hn-note-table-edge-btn--bottom","aria-label":"在此处添加行",onClick:L=>k(L,E+1),children:"+"}),u.jsx("div",{role:"textbox",tabIndex:0,...Hn(L=>{const P=hn(L.innerHTML);P!==S&&r?.(C7(t.getBlocks(),e.id,E,R,P))},"hn-note-table-cell"),onKeyDown:L=>L7({ctx:t,event:L,block:e,row:E,col:R}),onFocus:()=>a({row:E,col:R}),"data-editable-block-id":wr(e.id,E,R),...Et(S)})]},`cell-${E}-${R}`))},`row-${E}`))})})}),c?u.jsx(M7,{items:c.items,triggerRect:c.triggerRect,onClose:f}):null]}):u.jsx("table",{className:"hn-note-table",children:u.jsx("tbody",{children:e.rows.map((w,E)=>u.jsx("tr",{className:E===0?"hn-note-table-header-row":void 0,"data-note-atomic-id":`table:${e.id}:row:${E}`,children:w.map((S,R)=>u.jsx("td",{className:E===0?"hn-note-table-header-cell":void 0,...Et(S)},`cell-${E}-${R}`))},`row-${E}`))})})},F7=({block:e,ctx:t,actionMenu:n,editableText:r})=>{const i=`hn-note-text hn-note-text--${e.tone??"default"}`,a=e.externalItem;return u.jsxs(u.Fragment,{children:[n,a?.clickable===!0&&t.externalItemsClickable?u.jsx("span",{className:`${i} hn-note-external-item--clickable`,"data-note-external-block-id":e.id,"data-note-region-id":`block:${e.id}`,role:"link",tabIndex:0,...Et(e.text)}):t.editable?r:u.jsx("span",{className:i,"data-note-region-id":`block:${e.id}`,...Et(e.text)})]})},_7=({block:e,onInput:t,onKeyDown:n,onTextChange:r})=>u.jsx("span",{...Hn(i=>r(i.innerHTML),e.kind==="paragraph"?`hn-note-text hn-note-text--${e.tone??"default"}`:void 0),onInput:t,onKeyDown:n,"data-editable-block-id":e.id,"data-note-region-id":`block:${e.id}`,role:"textbox",tabIndex:0,...Et(e.text)}),$7=({block:e,ctx:t,actionMenu:n,editableText:r})=>{const i=`h${e.level}`;return u.jsxs(u.Fragment,{children:[e.eyebrow?u.jsx("span",{className:"hn-note-eyebrow",children:e.eyebrow}):null,n,u.jsx(i,{className:`hn-note-heading hn-note-heading--${e.level}`,children:t.editable?r:u.jsx("span",{"data-note-region-id":`block:${e.id}`,...Et(e.text)})})]})},H7=e=>e.replaceAll(" "," ").replaceAll("",""),q7=e=>{const t=H7(e);if(t.includes(`
|
|
276
|
+
`))return null;const n=/^(#{1,5}) $/.exec(t);if(n){const i=(n[1]??"").length;return i<1||i>5?null:{kind:"heading",level:i}}return t==="[] "?{kind:"checklist",checked:!1}:t==="[x] "?{kind:"checklist",checked:!0}:t==="- "?{kind:"unorderedList"}:/^\d+\. $/u.test(t)?{kind:"orderedList"}:t==="> "?{kind:"quote"}:t==="```"?{kind:"code"}:null},U7=(e,t)=>{switch(e.kind){case"heading":return{id:t,kind:"heading",level:e.level,text:""};case"quote":return{id:t,kind:"quote",text:""};case"unorderedList":return{id:t,kind:"unorderedList",text:""};case"orderedList":return{id:t,kind:"orderedList",text:""};case"code":return{id:t,kind:"code",language:"text",code:""};case"checklist":{const n=gt();return{id:t,kind:"todo",title:"",items:[{id:n,checked:e.checked,text:""}]}}}},W7=(e,t)=>{if(e.kind==="checklist"&&t.kind==="todo"){const n=t.items[0];return n?n.id:t.id}return t.id},ju=({block:e,ctx:t})=>{const r=_7({block:e,onInput:i=>{if(!t.onBlocksChange)return;const a=q7(i.currentTarget.textContent??"");if(a===null)return;i.currentTarget.textContent="";const s=U7(a,e.id),o=W7(a,s);t.onBlocksChange(t.getBlocks().map(l=>l.id===e.id?s:l)),t.requestFocus?.(o,"start")},onKeyDown:i=>Zi({ctx:t,event:i,mode:"rich-text",sourceId:e.id}),onTextChange:i=>t.onBlocksChange?.(wa(t.getBlocks(),e.id,i))});switch(e.kind){case"heading":return $7({block:e,ctx:t,actionMenu:mn(e,t),editableText:r});case"paragraph":return F7({block:e,ctx:t,actionMenu:mn(e,t),editableText:r});default:return Vt(e)}},g1=(e,t)=>{switch(e.kind){case"heading":return u.jsx(ju,{block:e,ctx:t});case"paragraph":return u.jsx(ju,{block:e,ctx:t});case"todo":return u.jsx(Q0,{block:e,ctx:t});case"unorderedList":return u.jsx(ps,{block:e,ctx:t});case"orderedList":return u.jsx(ps,{block:e,ctx:t});case"quote":return u.jsx(J0,{block:e,ctx:t});case"code":return u.jsx(G2,{block:e,ctx:t},e.id);case"callout":return u.jsx(Z4,{block:e,ctx:t});case"card":return u.jsx(b2,{block:e,ctx:t},e.id);case"table":return z7(e,t);case"formula":return u.jsx(x7,{block:e,ctx:t},e.id);case"picture":return u.jsx(w7,{block:e,ctx:t},e.id);case"drawing":return u.jsx(y7,{block:e,ctx:t},e.id);case"directory":return u.jsx(a5,{block:e,ctx:t});case"collapsible":return u.jsx(i5,{block:e,ctx:t});case"checklist":return u.jsx(yh,{block:e,ctx:t});default:return Vt(e)}};var xr=(function(e){return e.Undo="UNDO",e.Redo="REDO",e.Set="SET",e.Reset="RESET",e})(xr||{}),G7={past:[],present:null,future:[]},X7=(e,t={})=>{let{useCheckpoints:n}={useCheckpoints:!1,...t},[r,i]=p.useReducer((d,c)=>{let{past:f,present:g,future:y}=d;switch(c.type){case xr.Undo:{if(f.length===0)return d;let x=f[f.length-1];return{past:f.slice(0,f.length-1),present:x,future:[g,...y]}}case xr.Redo:{if(y.length===0)return d;let x=y[0],k=y.slice(1);return{past:[...f,g],present:x,future:k}}case xr.Set:{let x=n?!!c.historyCheckpoint:!0,{newPresent:k}=c;return k===g?d:{past:x===!1?f:[...f,g],present:k,future:[]}}case xr.Reset:{let{newPresent:x}=c;return{past:[],present:x,future:[]}}}},{...G7,present:e}),a=r.past.length!==0,s=r.future.length!==0,o=p.useCallback(()=>{a&&i({type:xr.Undo})},[a]),l=p.useCallback(()=>{s&&i({type:xr.Redo})},[s]);return[r,{set:p.useCallback((d,c=!1)=>{i({type:xr.Set,newPresent:d,historyCheckpoint:c})},[]),reset:p.useCallback(d=>i({type:xr.Reset,newPresent:d}),[]),undo:o,redo:l,canUndo:a,canRedo:s}]};const V7={undo:()=>!1,redo:()=>!1,canUndo:()=>!1,canRedo:()=>!1,resetHistory:()=>{}};function Y7(e){const[t,n]=X7(e),r=p.useRef(t.present);r.current=t.present;const i=p.useCallback(x=>{r.current=x,n.set(x)},[n]),a=p.useCallback(x=>{i({...r.current,title:x})},[i]),s=p.useCallback(x=>{i(x===void 0?{title:r.current.title,blocks:r.current.blocks}:{...r.current,summary:x})},[i]),o=p.useCallback(x=>{i({...r.current,blocks:x})},[i]),l=t.past.length>0,d=t.future.length>0,c=p.useCallback(()=>{const x=n.canUndo;return x&&n.undo(),x},[n]),f=p.useCallback(()=>{const x=n.canRedo;return x&&n.redo(),x},[n]),g=p.useCallback(x=>{n.reset(x??t.present)},[n,t.present]),y=p.useMemo(()=>({undo:()=>{const x=n.canUndo;return x&&n.undo(),x},redo:()=>{const x=n.canRedo;return x&&n.redo(),x},canUndo:()=>n.canUndo,canRedo:()=>n.canRedo,resetHistory:()=>{n.reset(t.present)}}),[n,t.present]);return{present:t.present,setTitle:a,setSummary:s,setBlocks:o,commitTransaction:i,canUndo:l,canRedo:d,undo:c,redo:f,resetHistory:g,controller:y}}const K7=["button","input","select","textarea","[data-note-editor-panel]"].join(","),Es="data-note-atomic-selected",Z7=e=>e instanceof Element?e:e.parentElement,Fu=(e,t,n)=>{const r=document.caretPositionFromPoint(t,n);if(!r||!e.contains(r.offsetNode))return null;const i=Z7(r.offsetNode),a=i?.closest(`[${Rn}]`);if(a&&e.contains(a))return{kind:"atomic",node:r.offsetNode,offset:r.offset,unit:a};const s=i?.closest(`[${Qe}]`);return!s||!e.contains(s)?null:{kind:"region",node:r.offsetNode,offset:r.offset,unit:s}},J7=e=>e instanceof Element&&e.closest(K7)===null,_u=(e,t)=>{const n=e.parentNode;if(!n)return null;const r=Array.from(n.childNodes).indexOf(e);return r<0?null:{node:n,offset:r+(t?1:0)}},Q7=(e,t)=>!!(e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING),$u=e=>{const t=window.getSelection(),n=t&&t.rangeCount>0&&!t.isCollapsed?t.getRangeAt(0):null,r=n!==null&&e.contains(n.commonAncestorContainer);for(const i of e.querySelectorAll(`[${Rn}]`)){const a=document.createRange();a.selectNode(i),r&&n.compareBoundaryPoints(Range.START_TO_START,a)<=0&&n.compareBoundaryPoints(Range.END_TO_END,a)>=0?i.setAttribute(Es,"true"):i.removeAttribute(Es)}},ev=e=>{let t=null;const n=s=>{t?.pointerId===s.pointerId&&(t=null)},r=s=>{if(s.button!==0||s.pointerType!=="mouse"||!J7(s.target)){t=null;return}const o=Fu(e,s.clientX,s.clientY);t=o?{anchor:o,pointerId:s.pointerId,bridged:!1}:null},i=s=>{if(!t||t.pointerId!==s.pointerId||(s.buttons&1)===0)return;const o=Fu(e,s.clientX,s.clientY);if(!o||!t.bridged&&o.unit===t.anchor.unit)return;const l=Q7(t.anchor.unit,o.unit),d=t.anchor.kind==="atomic"?_u(t.anchor.unit,!l):t.anchor,c=o.kind==="atomic"?_u(o.unit,l):o;!d||!c||(t.bridged=!0,s.preventDefault(),window.getSelection()?.setBaseAndExtent(d.node,d.offset,c.node,c.offset),$u(e))};e.addEventListener("pointerdown",r,!0),document.addEventListener("pointermove",i,!0),document.addEventListener("pointerup",n,!0),document.addEventListener("pointercancel",n,!0);const a=()=>$u(e);return document.addEventListener("selectionchange",a),()=>{t=null;for(const s of e.querySelectorAll(`[${Es}]`))s.removeAttribute(Es);e.removeEventListener("pointerdown",r,!0),document.removeEventListener("pointermove",i,!0),document.removeEventListener("pointerup",n,!0),document.removeEventListener("pointercancel",n,!0),document.removeEventListener("selectionchange",a)}},Xi=e=>e.getAttribute("data-note-region-profile")==="code"?"code":"rich",tv=(e,t,n)=>{const r=document.createRange();return r.selectNodeContents(e),n?r.setEnd(t.startContainer,t.startOffset):r.setStart(t.endContainer,t.endOffset),r},v1=e=>{const t=document.createElement("div");return t.append(e.cloneContents()),t.innerHTML},Fn=e=>{const t=new DOMParser().parseFromString(`<body>${e}</body>`,"text/html");for(const n of t.body.querySelectorAll("br"))n.replaceWith(t.createTextNode(`
|
|
277
|
+
`));return t.body.textContent??""},Ts=(e,t,n,r)=>{const i=tv(e,t,n);return r==="code"?i.toString():Xi(e)==="code"?vi(i.toString()):v1(i)},Hu=(e,t,n)=>{const r=document.createRange();return r.selectNodeContents(e),n?r.setStart(t.startContainer,t.startOffset):r.setEnd(t.endContainer,t.endOffset),Xi(e)==="code"?vi(r.toString()):v1(r)},hl=(e,t)=>t==="code"?Fn(e):e,zo=e=>{const t=e.getAttribute("data-note-region-id");return t==="title"||t==="summary"?gi(e.innerHTML):wt(e.innerHTML)},Li=e=>e instanceof Element&&e.closest("input, textarea, select, [data-note-editor-panel]")!==null,nv=(e,t)=>{if(e.rangeCount===0||e.isCollapsed)return!1;const n=e.getRangeAt(0),r=n.startContainer===t||t.contains(n.startContainer)?xa(t,n.startContainer,n.startOffset)===0:!1,i=n.endContainer===t||t.contains(n.endContainer)?xa(t,n.endContainer,n.endOffset)===W0(t):!1;if(r&&i)return!0;const a=document.createRange();return a.selectNodeContents(t),n.compareBoundaryPoints(Range.START_TO_START,a)<=0&&n.compareBoundaryPoints(Range.END_TO_END,a)>=0},rv=(e,t)=>{if(!(t instanceof Node))return!1;const r=(t instanceof Element?t:t.parentElement)?.closest(`[${Qe}]`),i=window.getSelection();if(!r||!i||!nv(i,r))return!1;const a=e.querySelectorAll(`[${Qe}], [${Rn}]`),s=a.item(0),o=a.item(a.length-1);if(!s||!o)return!1;const l=document.createRange();return l.setStartBefore(s),l.setEndAfter(o),i.removeAllRanges(),i.addRange(l),!0},qu=e=>(e instanceof Element?e:e.parentElement)?.closest(`[${Qe}]`)??null,br=e=>{const t=qu(e.startContainer),n=qu(e.endContainer),r=t?.getAttribute(Qe),i=n?.getAttribute(Qe);return!t||!n||!r||!i?null:{start:{regionId:r,offset:xa(t,e.startContainer,e.startOffset)},end:{regionId:i,offset:xa(n,e.endContainer,e.endOffset)}}},fl=(e,t)=>{const n=Array.from(e.querySelectorAll(`[${Qe}]`)),r=n.find(d=>d.getAttribute(Qe)===t.start.regionId),i=n.find(d=>d.getAttribute(Qe)===t.end.regionId);if(!r||!i)return null;const a=Bc(r,t.start.offset),s=Bc(i,t.end.offset),o=document.createRange();o.setStart(a[0],a[1]),o.setEnd(s[0],s[1]);const l=window.getSelection();return l?(l.removeAllRanges(),l.addRange(o),o):null},iv=(e,t)=>fl(e,{start:t,end:t}),wi=e=>{switch(e.kind){case"todo":case"checklist":return[`${e.id}:title`,...e.items.map(t=>t.id)];case"quote":return[...Jn(e.text).map((t,n)=>Cr(e.id,n)),...e.author?[`${e.id}:author`]:[]];case"callout":return[`${e.id}:title`,e.id];case"collapsible":return[`${e.id}:title`,...e.collapsed?[]:e.blocks.flatMap(wi)];case"heading":case"paragraph":case"unorderedList":case"orderedList":case"code":return[e.id];case"table":case"formula":case"picture":case"card":case"drawing":case"directory":return[]}},Ms=(e,t)=>e.findIndex(n=>wi(n).includes(t)),av=(e,t)=>{if(t===`${e.id}:author`)return{id:e.id,kind:"quote",text:e.text};const n=Jn(e.text),r=n.findIndex((i,a)=>Cr(e.id,a)===t);return r<0?e:{...e,text:n.filter((i,a)=>a!==r).join(`
|
|
278
|
+
`)}},Ks=(e,t)=>{if(!wi(e).includes(t))return e;switch(e.kind){case"todo":case"checklist":return t===`${e.id}:title`?{...e,title:""}:{...e,items:e.items.filter(n=>n.id!==t)};case"quote":return av(e,t);case"callout":return t===`${e.id}:title`?{...e,title:""}:{...e,text:""};case"collapsible":return t===`${e.id}:title`?{...e,title:""}:{...e,blocks:e.blocks.map(n=>Ks(n,t))};case"heading":case"paragraph":case"unorderedList":case"orderedList":return{...e,text:""};case"code":return{...e,code:""};case"table":case"formula":case"picture":case"card":case"drawing":case"directory":return e}},b0=(e,t,n)=>{const r=wi(e),i=r.indexOf(t),a=n?r.indexOf(n):r.length-1;if(i<0||a<i)return null;let s=e;for(let o=a;o>i;o-=1){const l=r[o];l&&(s=Ks(s,l))}return s},ml=(e,t)=>{const n=wi(e),r=n.indexOf(t);if(r<0)return e;if(r===n.length-1)return null;let i=e;for(let a=r;a>=0;a-=1){const s=n[a];s&&(i=Ks(i,s))}return i},sv=(e,t)=>{const n=wi(e),r=n.indexOf(t);if(r<0)return e;let i=e;for(let a=r-1;a>=0;a-=1){const s=n[a];s&&(i=Ks(i,s))}return i},mi=(e,t,n)=>{const r=e[e.length-1],i=n[0];return!r||!i||r.id!==i.id?[...e,...t,...n]:r.kind==="table"&&i.kind==="table"?[...e.slice(0,-1),{...r,rows:[...r.rows,...i.rows]},...n.slice(1)]:r.kind==="collapsible"&&i.kind==="collapsible"?[...e.slice(0,-1),{...r,blocks:mi(r.blocks,t,i.blocks)},...n.slice(1)]:[...e,...t,...n]},y1=(e,t)=>{for(let n=0;n<e.length;n+=1){const r=e[n];if(!r)continue;if(r.kind==="collapsible"){if(t===`${r.id}:title`)return{found:!0,blocks:[...e.slice(0,n),{...r,blocks:[]}]};const a=y1(r.blocks,t);if(a.found)return{found:!0,blocks:[...e.slice(0,n),{...r,blocks:a.blocks}]}}const i=b0(r,t);if(i)return{found:!0,blocks:[...e.slice(0,n),i]}}return{found:!1,blocks:e}},b1=(e,t)=>{for(let n=0;n<e.length;n+=1){const r=e[n];if(!r)continue;if(r.kind==="collapsible"){if(t===`${r.id}:title`)return{found:!0,blocks:e};const a=b1(r.blocks,t);if(a.found)return{found:!0,blocks:[{...r,blocks:a.blocks},...e.slice(n+1)]}}const i=ml(r,t);if(i!==r)return{found:!0,blocks:[...i?[i]:[],...e.slice(n+1)]}}return{found:!1,blocks:e}},x1=(e,t)=>{for(let n=0;n<e.length;n+=1){const r=e[n];if(r){if(r.kind==="collapsible"){if(t===`${r.id}:title`)return{found:!0,blocks:e.slice(n)};const i=x1(r.blocks,t);if(i.found)return{found:!0,blocks:[{...r,blocks:i.blocks},...e.slice(n+1)]}}if(wi(r).includes(t)){const i=sv(r,t);return{found:!0,blocks:[...i?[i]:[],...e.slice(n+1)]}}}}return{found:!1,blocks:e}},x0=(e,t)=>{const n=y1(e,t);return n.found?n.blocks:null},Uu=(e,t)=>{const n=b1(e,t);return n.found?n.blocks:null},ov=(e,t)=>{const n=x1(e,t);return n.found?n.blocks:null},w1=e=>e.kind==="picture"||e.kind==="drawing"||e.kind==="card"||e.kind==="directory"||e.kind==="formula",pl=(e,t)=>{for(let n=0;n<e.length;n+=1){const r=e[n];if(!r)continue;if(t===`block:${r.id}`&&w1(r))return{found:!0,blocks:e.slice(0,n)};const i=/^table:(.+):row:(\d+)$/.exec(t);if(r.kind==="table"&&i?.[1]===r.id){const a=Number(i[2]);return{found:Number.isInteger(a)&&a<r.rows.length,blocks:[...e.slice(0,n),...a>0?[{...r,rows:r.rows.slice(0,a)}]:[]]}}if(r.kind==="collapsible"){const a=pl(r.blocks,t);if(a.found)return{found:!0,blocks:[...e.slice(0,n),{...r,blocks:a.blocks}]}}}return{found:!1,blocks:e}},gl=(e,t)=>{for(let n=0;n<e.length;n+=1){const r=e[n];if(!r)continue;if(t===`block:${r.id}`&&w1(r))return{found:!0,blocks:e.slice(n+1)};const i=/^table:(.+):row:(\d+)$/.exec(t);if(r.kind==="table"&&i?.[1]===r.id){const a=Number(i[2]),s=r.rows.slice(a+1);return{found:Number.isInteger(a)&&a<r.rows.length,blocks:[...s.length>0?[{...r,rows:s}]:[],...e.slice(n+1)]}}if(r.kind==="collapsible"){const a=gl(r.blocks,t);if(a.found)return{found:!0,blocks:[{...r,blocks:a.blocks},...e.slice(n+1)]}}}return{found:!1,blocks:e}},Cs=(e,t)=>{if(t.startsWith("block:")){const a=e.findIndex(s=>s.id===t.slice(6));return a<0?null:[a,null]}const n=/^table:(.+):row:(\d+)$/.exec(t);if(!n)return null;const r=e.findIndex(a=>a.id===n[1]),i=Number(n[2]);return r<0||!Number.isInteger(i)?null:[r,i]},lv=(e,t,n,r)=>{const i=Cs(e,t),a=Cs(e,n);if(i&&a){const[l,d]=i,[c,f]=a;if(l===c&&d!==null&&f!==null){const g=e[l];if(!g||g.kind!=="table"||f<d)return null;const y=[...g.rows.slice(0,d),...g.rows.slice(f+1)];return[...e.slice(0,l),...r,...y.length===0?[]:[{...g,rows:y}],...e.slice(l+1)]}}const s=pl(e,t),o=gl(e,n);return s.found&&o.found?mi(s.blocks,r,o.blocks):null},w0=(e,t)=>{const n=gl(e,t);if(n.found)return n.blocks;const r=Cs(e,t);if(!r)return null;const[i,a]=r;if(a===null)return e.slice(i+1);const s=e[i];if(!s||s.kind!=="table")return null;const o=s.rows.slice(a+1);return[...o.length===0?[]:[{...s,rows:o}],...e.slice(i+1)]},k0=(e,t)=>{const n=pl(e,t);if(n.found)return n.blocks;const r=Cs(e,t);if(!r)return null;const[i,a]=r;if(a===null)return e.slice(0,i);const s=e[i];if(!s||s.kind!=="table")return null;const o=s.rows.slice(0,a);return[...e.slice(0,i),...o.length===0?[]:[{...s,rows:o}]]},pi=(e,t,n)=>e.map(r=>{if(t===`${r.id}:title`)switch(r.kind){case"todo":case"checklist":case"callout":case"collapsible":return{...r,title:n};case"heading":case"paragraph":case"unorderedList":case"orderedList":case"quote":case"code":case"table":case"formula":case"picture":case"card":case"drawing":case"directory":return r}if(t===`${r.id}:author`&&r.kind==="quote")return{...r,author:n};if(r.id===t)switch(r.kind){case"heading":case"paragraph":case"unorderedList":case"orderedList":case"callout":return{...r,text:n};case"quote":return p0([r],r.id,0,n)[0]??r;case"collapsible":return{...r,title:n};case"code":return{...r,code:n};case"todo":case"checklist":case"table":case"formula":case"picture":case"card":case"drawing":case"directory":return r}if(r.kind==="todo")return{...r,items:r.items.map(i=>i.id===t?{...i,text:n}:i)};if(r.kind==="checklist")return{...r,items:r.items.map(i=>i.id===t?{...i,text:n}:i)};if(r.kind==="quote"){const i=r.text.split(`
|
|
279
|
+
`).findIndex((a,s)=>Cr(r.id,s)===t);return i<0?r:p0([r],r.id,i,n)[0]??r}return r.kind==="collapsible"?{...r,blocks:pi(r.blocks,t,n)}:r}),cv=(e,t)=>{let n=e;for(const[r,i]of t){if(r==="title"){n={...n,title:gi(i)};continue}if(r==="summary"){n={...n,summary:gi(i)};continue}n={...n,blocks:pi(n.blocks,r.replace("block:",""),wt(i))}}return n},S0=(e,t)=>{const n=e.findIndex(s=>s.id===t);if(n>=0)return e.slice(n+1);const r=Ms(e,t);if(r<0)return e;const i=e[r];if(!i)return e;const a=ml(i,t);return[...a?[a]:[],...e.slice(r+1)]},As=(e,t,n="")=>{const r=e.start.getAttribute(Qe),i=e.end.getAttribute(Qe),a=e.start.getAttribute(Rn),s=e.end.getAttribute(Rn);if(!r&&!a||!i&&!s)return null;const o=r?e.start:e.end,l=Xi(o),d=r?Ts(e.start,e.range,!0,l):"",c=i?Ts(e.end,e.range,!1,l):"",f=`${d}${hl(n,l)}${c}`;let g=null;if(a&&i){const y=k0(t.blocks,a);if(!y)return null;const x=i.replace("block:",""),k=pi(t.blocks,x,f),w=ov(k,x);if(!w)return null;g={...t,blocks:mi(y,[],w)}}else if(r&&s){const y=r.replace("block:",""),x=pi(t.blocks,y,f),k=x0(x,y),w=w0(x,s);if(!k||!w)return null;g={...t,blocks:mi(k,[],w)}}else if(a&&s){const y=n?[{id:gt(),kind:"paragraph",text:n}]:[],x=lv(t.blocks,a,s,y);if(!x)return null;g={...t,blocks:x}}else{if(!r||!i)return null;if(r==="title")g={title:f,blocks:S0(t.blocks,i.replace("block:",""))};else if(r==="summary")g={title:t.title,summary:f,blocks:S0(t.blocks,i.replace("block:",""))};else{const y=r.replace("block:",""),x=i.replace("block:",""),k=pi(t.blocks,y,f),w=Ms(k,y),E=Ms(k,x);if(w<0||E<0)return null;if(w===E){const S=k[w];if(!S)return null;const R=b0(S,y,x);if(!R)return null;g={...t,blocks:[...k.slice(0,w),R,...k.slice(w+1)]}}else{const S=k[w],R=k[E];if(!S||!R)return null;const L=b0(S,y);if(!L)return null;const P=ml(R,x);g={...t,blocks:[...k.slice(0,w),L,...P?[P]:[],...k.slice(E+1)]}}}}return g.title||g.summary||g.blocks.length>0?g:{title:"",blocks:[{id:gt(),kind:"paragraph",text:""}]}},uv=5e6,k1=500,jo=256,dv=1e4,hv=1e5,Fo=1e6,Wu=1e5,fv=e=>typeof e=="object"&&e!==null,oa=(e,t)=>typeof e=="string"&&e.length<=t,mv=e=>{if(!fv(e))return;const{id:t,title:n,content:r,x:i,y:a,width:s,height:o,parent:l,zIndex:d,childrenLayoutMode:c,linkedCardIds:f,lock:g}=e,y=f===void 0||Array.isArray(f)&&f.length<=k1&&f.every(k=>oa(k,jo));if(oa(t,jo)&&oa(n,dv)&&oa(r,hv)&&typeof i=="number"&&Number.isFinite(i)&&Math.abs(i)<=Fo&&typeof a=="number"&&Number.isFinite(a)&&Math.abs(a)<=Fo&&typeof s=="number"&&Number.isFinite(s)&&s>0&&s<=Wu&&typeof o=="number"&&Number.isFinite(o)&&o>0&&o<=Wu&&(l===void 0||oa(l,jo))&&(d===void 0||typeof d=="number"&&Number.isFinite(d)&&Math.abs(d)<=Fo)&&(c===void 0||c==="free"||c==="mind-map-horizontal"||c==="arrange")&&(g===void 0||typeof g=="boolean")&&y)return{id:t,title:n,content:r,x:i,y:a,width:s,height:o,...l===void 0?{}:{parent:l},...d===void 0?{}:{zIndex:d},...c===void 0?{}:{childrenLayoutMode:c},...f===void 0?{}:{linkedCardIds:f},...g===void 0?{}:{lock:g}}},pv=e=>{if(!Array.isArray(e)||e.length>k1)return;const t=[];for(const n of e){const r=mv(n);if(!r)return;t.push(r)}return t},gv=e=>{if(e.length>uv)return;let t;try{t=JSON.parse(e)}catch(n){if(n instanceof SyntaxError)return;throw n}return pv(t)},vv=256,yv=256,S1=64,bv=8,xv=256,E1=1e6,wv=e=>typeof e=="object"&&e!==null,T1=e=>wv(e)?e:null,Cn=(e,t)=>{const n=e[t];return typeof n=="string"&&n.length<=E1?n:null},E0=(e,t)=>{const n=e[t];return n===void 0||typeof n=="string"&&n.length<=E1?n:null},kv=e=>{if(!Array.isArray(e)||e.length>vv)return null;const t=[];for(const n of e){const r=T1(n);if(!r)return null;const i=Cn(r,"id"),a=Cn(r,"text"),s=r.checked;if(i===null||a===null||typeof s!="boolean")return null;t.push({id:i,checked:s,text:wt(a)})}return t},Sv=(e,t,n)=>{const r=Cn(e,"text");if(r===null)return null;if(n==="paragraph"){const i=e.tone;return i!==void 0&&i!=="default"&&i!=="muted"&&i!=="accent"?null:{id:t,kind:n,text:wt(r),...i?{tone:i}:{}}}if(n==="quote"){const i=E0(e,"author");return i===null?null:{id:t,kind:n,text:wt(r),...i?{author:wt(i)}:{}}}return{id:t,kind:n,text:wt(r)}},Ev=(e,t,n,r,i)=>{if(n==="table"){const d=e.rows;if(!Array.isArray(d)||d.length>yv)return null;const c=[];for(const f of d){if(!Array.isArray(f)||f.length>S1||!f.every(g=>typeof g=="string"))return null;c.push(f.map(wt))}return{id:t,kind:n,rows:c}}const a=Cn(e,"title");if(a===null)return null;if(n==="todo"||n==="checklist"){const d=kv(e.items);return d?{id:t,kind:n,title:wt(a),items:d}:null}if(n==="callout"){const d=Cn(e,"text"),c=e.tone;return d!==null&&(c==="info"||c==="success"||c==="warning")?{id:t,kind:n,title:wt(a),text:wt(d),tone:c}:null}const s=e.collapsed,o=e.blocks;if(typeof s!="boolean"||!Array.isArray(o))return null;const l=[];for(const d of o){const c=M1(d,r+1,i);if(!c)return null;l.push(c)}return{id:t,kind:n,title:wt(a),collapsed:s,blocks:l}},M1=(e,t,n)=>{if(t>bv||n.remainingBlocks<=0)return null;n.remainingBlocks-=1;const r=T1(e);if(!r)return null;const i=Cn(r,"id"),a=Cn(r,"kind");if(i===null||a===null)return null;switch(a){case"orderedList":case"paragraph":case"quote":case"unorderedList":return Sv(r,i,a);case"callout":case"checklist":case"collapsible":case"table":case"todo":return Ev(r,i,a,t,n);case"heading":{const s=Cn(r,"text"),o=E0(r,"eyebrow"),l=r.level;return s!==null&&o!==null&&(l===1||l===2||l===3||l===4||l===5)?{id:i,kind:a,level:l,text:wt(s),...o?{eyebrow:wt(o)}:{}}:null}case"code":{const s=Cn(r,"code"),o=Cn(r,"language"),l=E0(r,"filename");return s!==null&&o!==null&&l!==null?{id:i,kind:a,code:s,language:o,...l?{filename:l}:{}}:null}case"formula":{const s=Cn(r,"formula");return s===null?null:{id:i,kind:a,formula:s}}case"picture":{const s=Cn(r,"url"),o=Cn(r,"filename"),l=r.width,d=r.height;return s===null||o===null||l!==void 0&&typeof l!="number"||d!==void 0&&typeof d!="number"?null:{id:i,kind:a,url:s,filename:o,...l===void 0?{}:{width:l},...d===void 0?{}:{height:d}}}case"card":{const s=gv(JSON.stringify(r.data));return s?{id:i,kind:a,data:s}:null}case"drawing":{const s=Cn(r,"data");return s===null?null:{id:i,kind:a,data:s}}case"directory":return{id:i,kind:a};default:return null}},Tv=e=>M1(e,0,{remainingBlocks:xv}),Mv=e=>{const t=new Map(e.map(n=>[n.id,gt()]));return e.map(n=>{const{parent:r,linkedCardIds:i,...a}=n,s=r?t.get(r):void 0;return{...a,id:t.get(n.id)??gt(),...s?{parent:s}:{},...i?{linkedCardIds:i.flatMap(o=>t.get(o)??[])}:{}}})},C1=e=>{const t=gt();switch(e.kind){case"todo":case"checklist":return{...e,id:t,items:e.items.map(n=>({...n,id:gt()}))};case"collapsible":return{...e,id:t,blocks:e.blocks.map(C1)};case"card":return{...e,id:t,data:Mv(e.data)};case"heading":case"paragraph":case"unorderedList":case"orderedList":case"quote":case"code":case"callout":case"table":case"formula":case"picture":case"drawing":case"directory":return{...e,id:t}}return Vt(e)},Pn=e=>{switch(e.kind){case"heading":case"orderedList":case"paragraph":case"unorderedList":return{kind:"rich-block",block:e};case"code":return{kind:"code-block",block:e};case"card":case"directory":case"drawing":case"formula":case"picture":return{kind:"atomic-block",block:e};case"callout":case"checklist":case"collapsible":case"quote":case"table":case"todo":return{kind:"structured-block",block:e}}},Cv=e=>e.map(t=>{switch(t.kind){case"atomic-block":case"structured-block":return C1(t.block);case"code-block":case"rich-block":return{...t.block,id:gt()};case"table-row":return{id:gt(),kind:"table",rows:[t.cells]}}return Vt(t)}),Av=e=>{const t="kind"in e?e.kind:void 0,n=Tv("block"in e?e.block:void 0);if(!n)return null;const r=Pn(n);return r.kind===t?r:null},Rv=e=>{if(typeof e!="object"||e===null)return null;if(("kind"in e?e.kind:void 0)!=="table-row")return Av(e);const n="cells"in e?e.cells:void 0;return Array.isArray(n)&&n.length<=S1&&n.every(r=>typeof r=="string")?{kind:"table-row",cells:n.map(wt)}:null},vl=(e,t)=>{if(t.kind==="code-block"){const r=document.createElement("pre"),i=document.createElement("code");i.innerHTML=vi(t.block.code),r.append(i),e.append(r);return}if(t.kind==="rich-block"){const r=document.createElement("p");r.innerHTML=wt(t.block.text),e.append(r);return}if(t.kind==="structured-block"){const r=t.block,i=document.createElement(r.kind==="quote"?"blockquote":"div");if(r.kind==="table"){const a=document.createElement("table");for(const s of r.rows){const o=a.insertRow();for(const l of s)o.insertCell().innerHTML=wt(l)}i.append(a)}else if(r.kind==="todo"||r.kind==="checklist"){const a=document.createElement("strong");a.innerHTML=wt(r.title);const s=document.createElement("ul");for(const o of r.items){const l=document.createElement("li");l.innerHTML=`${o.checked?"☑ ":"☐ "}${wt(o.text)}`,s.append(l)}i.append(a,s)}else if(r.kind==="collapsible"){const a=document.createElement("details");a.open=!r.collapsed;const s=document.createElement("summary");s.innerHTML=wt(r.title),a.append(s);for(const o of r.blocks)vl(a,Pn(o));i.append(a)}else{const a=r.kind==="callout"?r.title:r.text;i.innerHTML=wt(a),r.kind==="callout"&&i.insertAdjacentHTML("beforeend",wt(r.text)),r.kind==="quote"&&r.author&&i.insertAdjacentText("beforeend",` — ${r.author}`)}e.append(i);return}if(t.kind==="table-row"){const r=document.createElement("table"),i=r.insertRow();for(const a of t.cells)i.insertCell().innerHTML=wt(a);e.append(r);return}const n=document.createElement("div");if(t.block.kind==="picture"){const r=document.createElement("img");r.src=t.block.url,r.alt=t.block.filename,n.append(r)}else n.textContent=t.block.kind;e.append(n)},yl=e=>{if(e.kind==="table-row")return e.cells.map(Fn).join(" ");const t=e.block;switch(t.kind){case"heading":case"paragraph":case"orderedList":case"unorderedList":case"quote":return Fn(t.text);case"code":return t.code;case"todo":case"checklist":return[Fn(t.title),...t.items.map(n=>`${n.checked?"☑":"☐"} ${Fn(n.text)}`)].filter(Boolean).join(`
|
|
280
|
+
`);case"callout":return[t.title,t.text].map(Fn).filter(Boolean).join(`
|
|
281
|
+
`);case"table":return t.rows.map(n=>n.map(Fn).join(" ")).join(`
|
|
282
|
+
`);case"collapsible":return[Fn(t.title),...t.blocks.map(n=>yl(Pn(n)))].filter(Boolean).join(`
|
|
283
|
+
`);case"formula":return t.formula;case"picture":return t.filename;case"card":return"card";case"drawing":return"drawing";case"directory":return"directory"}return Vt(t)},A1=(e,t)=>{for(const n of e){const r=Iv(n,t);if(r)return r}return null},Iv=(e,t)=>{switch(e.kind){case"heading":case"paragraph":case"orderedList":case"unorderedList":case"code":return e.id===t?Pn(e):null;case"todo":case"checklist":{if(t===`${e.id}:title`)return Pn({...e,items:[]});const n=e.items.find(r=>r.id===t);return n?Pn({...e,title:"",items:[n]}):null}case"quote":{if(t===`${e.id}:author`&&e.author)return Pn({...e,text:"",author:e.author});const n=Jn(e.text),r=n.findIndex((i,a)=>Cr(e.id,a)===t);return r<0?null:Pn({id:e.id,kind:"quote",text:n[r]??""})}case"callout":return t===`${e.id}:title`?Pn({...e,text:""}):t===e.id?Pn({...e,title:""}):null;case"collapsible":return t===`${e.id}:title`?Pn({...e,blocks:[]}):e.collapsed?null:A1(e.blocks,t);case"table":case"formula":case"picture":case"card":case"drawing":case"directory":return null}},Nv=(e,t)=>A1(e,t),T0=2,Lv=2e6,Pv=256,_o=e=>{const t=e.closest("[data-note-block-id]")?.getAttribute("data-note-block-id");if(t)return t;const n=e.getAttribute(Qe);return n?.startsWith("block:")?n.slice(6).split(":")[0]??null:null},Dv=(e,t)=>{const n=t.startsWith("block:")?t.slice(6):/^table:(.+):row:\d+$/.exec(t)?.[1]??null;if(!n)return null;for(const r of e)if(r.id===n||r.kind==="collapsible"&&bl(r.blocks,n))return r.id;return null},$o=(e,t)=>{const n=e.getAttribute(Rn);if(n)return Dv(t.blocks,n);const r=e.getAttribute(Qe);if(!r?.startsWith("block:"))return null;const i=Ms(t.blocks,r.slice(6));return i<0?null:t.blocks[i]?.id??null},R1=(e,t)=>{const n=/^table:(.+):row:(\d+)$/.exec(e);if(!n)return null;const r=Number(n[2]);for(const i of t){if(i.kind==="table"&&i.id===n[1]){const a=i.rows[r];return a?{kind:"table-row",cells:a}:null}if(i.kind==="collapsible"){const a=R1(e,i.blocks);if(a)return a}}return null},bl=(e,t)=>{for(const n of e){if(n.id===t)return n;if(n.kind==="collapsible"){const r=bl(n.blocks,t);if(r)return r}}return null},Bv=(e,t)=>{if(!e.startsWith("block:"))return R1(e,t.blocks);const n=bl(t.blocks,e.slice(6));return n?Pn(n):null},Gu=(e,t)=>{const n=e.getAttribute(Rn);if(n)return Bv(n,t);const r=e.getAttribute(Qe);return r?.startsWith("block:")?Nv(t.blocks,r.slice(6)):null},Ov=(e,t)=>{const n=$o(e.start,t)??_o(e.start),r=$o(e.end,t)??_o(e.end),i=t.blocks.findIndex(s=>s.id===n),a=t.blocks.findIndex(s=>s.id===r);if(i>=0&&a>=0&&i!==a){const s=new Set;return e.units.flatMap((o,l)=>{if(o.hasAttribute(Qe)&&(l===0||l===e.units.length-1))return[];const d=$o(o,t)??_o(o),c=t.blocks.findIndex(g=>g.id===d);if(c>i&&c<a){if(!d||s.has(d))return[];s.add(d);const g=t.blocks[c],y=g?Pn(g):null;return y?[y]:[]}const f=Gu(o,t);return f?[f]:[]})}return e.units.flatMap((s,o)=>{const d=s.hasAttribute(Qe)&&(o===0||o===e.units.length-1)?null:Gu(s,t);return d?[d]:[]})},Xu=(e,t)=>{const n=e.start.hasAttribute(Qe)?Hu(e.start,e.range,!0):"",r=e.end.hasAttribute(Qe)?Hu(e.end,e.range,!1):"",i=Ov(e,t),a=document.createElement("div"),s=document.createElement("span");s.innerHTML=n,a.append(s);for(const l of i)vl(a,l);const o=document.createElement("span");return o.innerHTML=r,a.append(o),{version:T0,leadingHtml:n,trailingHtml:r,slices:i,html:a.innerHTML,text:[Fn(n),...i.map(yl),Fn(r)].filter(Boolean).join(`
|
|
284
|
+
`)}},zv=e=>Cv(e.slices),jv=e=>{if(!e||e.length>Lv)return null;try{const t=JSON.parse(e);if(!t||typeof t!="object")return null;const n="version"in t?t.version:void 0,r="leadingHtml"in t?t.leadingHtml:void 0,i="trailingHtml"in t?t.trailingHtml:void 0,a="html"in t?t.html:void 0,s="text"in t?t.text:void 0,o="slices"in t?t.slices:void 0;if(n!==T0||typeof r!="string"||typeof i!="string"||typeof a!="string"||typeof s!="string"||!Array.isArray(o)||o.length>Pv)return null;const l=o.map(Rv);if(l.some(k=>k===null))return null;const d=wt(r),c=wt(i),f=l.flatMap(k=>k??[]),g=document.createElement("div"),y=document.createElement("span");y.innerHTML=d,g.append(y);for(const k of f)vl(g,k);const x=document.createElement("span");return x.innerHTML=c,g.append(x),{version:T0,leadingHtml:d,trailingHtml:c,slices:f,html:g.innerHTML,text:[Fn(d),...f.map(yl),Fn(c)].filter(Boolean).join(`
|
|
285
|
+
`)}}catch{return null}},I1=88,Vu=8,Yu=8,Ho=e=>{const t=e.getBoundingClientRect();return{top:t.top,bottom:t.bottom,left:t.left+t.width/2,flip:t.top<I1}},Fv=e=>{const t=e.getBoundingClientRect();return{top:t.top,bottom:t.bottom,left:t.left+t.width/2,flip:t.top<I1}},_v=[{name:"红色",hex:"#ef4444"},{name:"蓝色",hex:"#3b82f6"},{name:"绿色",hex:"#22c55e"},{name:"黑色",hex:"#000000"},{name:"灰色",hex:"#6b7280"}],Ku=()=>{if(typeof document.queryCommandValue!="function")return"";try{const e=document.queryCommandValue("foreColor");return typeof e=="string"?e:""}catch{return""}},$v=({containerRef:e,allowCrossFieldFormat:t=!0,portalContainerRef:n,onMagicLinkConfigure:r,onContentChange:i,onBatchContentChange:a,onCrossRegionFormat:s,onRegionFormat:o})=>{const[l,d]=p.useState(null),[c,f]=p.useState("format"),[g,y]=p.useState(""),[x,k]=p.useState(!1),[w,E]=p.useState(""),[S,R]=p.useState(Ii),[L,P]=p.useState(""),[B,O]=p.useState(!1),[_,F]=p.useState(!1),$=!_||t,j=p.useRef(null),D=p.useRef(null),q=p.useRef(null),K=p.useRef(null),fe=p.useRef(c);fe.current=c;const de=p.useRef(null),Ce=p.useRef(null),oe=p.useRef(null);p.useEffect(()=>{const A=()=>{if(fe.current!=="format")return;const z=e.current,X=window.getSelection();if(!X||X.rangeCount===0||X.isCollapsed||!z){d(null),R(Ii),P(""),O(!1),F(!1);return}const Z=X.getRangeAt(0);if(!Nl(Z,z)){d(null),R(Ii),P(""),O(!1),F(!1);return}if(!X.toString().trim()){d(null),R(Ii),P(""),O(!1),F(!1);return}de.current=Z.cloneRange(),d(Ho(Z)),R(ko()),P(Ku()),O(gf(Z)),F(n5(Z))};return document.addEventListener("selectionchange",A),()=>document.removeEventListener("selectionchange",A)},[e]),p.useEffect(()=>{if(!l)return;const A=()=>{f("format"),y(""),E(""),k(!1),j.current=null,K.current=null,de.current=null,d(null),R(Ii),P(""),O(!1)},z=Z=>{Z.key==="Escape"&&A()};if(document.addEventListener("keydown",z),!!!n?.current){window.addEventListener("scroll",A,!0);const Z=U=>{const ce=U.target;ce instanceof Node&&(Ce.current?.contains(ce)||A())};return document.addEventListener("pointerdown",Z),()=>{window.removeEventListener("scroll",A,!0),document.removeEventListener("keydown",z),document.removeEventListener("pointerdown",Z)}}return()=>{document.removeEventListener("keydown",z)}},[l,n]),p.useEffect(()=>{c==="link"&&D.current&&D.current.focus(),c==="formula"&&q.current&&q.current.focus()},[c]),p.useEffect(()=>{const A=e.current;if(!A)return;const z=X=>{const Z=X.target;if(!(Z instanceof Element))return;const U=Z.closest("[data-hn-inline-formula]");if(!U||!A.contains(U))return;const ce=U.closest(`[${Qe}]`)?.getAttribute(Qe);ce==="title"||ce==="summary"||(K.current=U,j.current=null,E(U.getAttribute("data-hn-inline-formula")??U.textContent??""),d(Fv(U)),f("formula"))};return A.addEventListener("click",z),()=>A.removeEventListener("click",z)},[e]),p.useLayoutEffect(()=>{if(!l||n?.current)return;const A=Ce.current;if(!A)return;const z=A.getBoundingClientRect().width,X=e.current?.getBoundingClientRect(),Z=X&&X.width>0?X.left:0,U=X&&X.width>0?X.right:window.innerWidth,ce=Z+Yu+z/2,be=U-Yu-z/2,Ae=be<ce?(Z+U)/2:Math.min(Math.max(l.left,ce),be);Ae!==l.left&&d(Ye=>Ye?{...Ye,left:Ae}:null)},[l,e,n]);const Ee=()=>{if(oe.current=null,o)return;const A=e.current,z=window.getSelection();if(!A||!z||z.rangeCount===0||z.isCollapsed)return;const X=z.getRangeAt(0);oe.current=br(X)};if(p.useLayoutEffect(()=>{const A=oe.current;if(!A)return;oe.current=null;const z=e.current;if(!z)return;fl(z,A);const X=window.getSelection();X&&X.rangeCount>0&&!X.isCollapsed&&d(Ho(X.getRangeAt(0)))}),!l)return null;const ze=A=>{if(!i&&!a&&!s&&!o)return;const z=e.current,X=window.getSelection();let Z=X&&X.rangeCount>0?X.getRangeAt(0):null;if(Z===null&&(Z=de.current),Z!==null){if(o&&z){const U=A??br(Z),ce=[];for(const be of Array.from(z.querySelectorAll(`[${Qe}][contenteditable="true"]`))){if(!Z.intersectsNode(be))continue;const Ae=be.getAttribute(Qe);if(!Ae)continue;const Ye=zo(be);Ye!==be.innerHTML&&(be.innerHTML=Ye),ce.push([Ae,Ye])}ce.length>0&&o(ce,U);return}if(_&&z){if(!s)return;const U=[];for(const ce of Array.from(z.querySelectorAll(`[${Qe}][contenteditable="true"]`))){if(!Z.intersectsNode(ce))continue;const be=ce.getAttribute(Qe);be&&U.push([be,ce.innerHTML])}U.length>0&&s(U);return}if(B&&z)if(a){const U=[];Mc(Z,z,(ce,be)=>{U.push([ce,be])}),U.length>0&&a(U)}else i&&Mc(Z,z,i);else i&&Wa(Z,i)}},ge=()=>{const A=window.getSelection(),z=e.current;A&&A.rangeCount>0&&!A.isCollapsed&&z&&Nl(A.getRangeAt(0),z)?(P(Ku()),R(ko()),d(Ho(A.getRangeAt(0)))):d(null)},We=A=>{if(!$)return;const z=window.getSelection()?.rangeCount?window.getSelection()?.getRangeAt(0):null,X=z?br(z):null,Z=e.current;B&&Z?Tc(Z,"foreColor",A):document.execCommand("foreColor",!1,A),Ee(),ze(X),P(A),R(ko()),ge()},Pe=()=>{if(!$)return;const A=e.current;B&&A?n4(A):Qp();const z=window.getSelection()?.rangeCount?window.getSelection()?.getRangeAt(0):null,X=z?br(z):null;Ee(),ze(X),ge()},st=A=>{if(!$)return;const z=window.getSelection()?.rangeCount?window.getSelection()?.getRangeAt(0):null,X=z?br(z):null,Z=e.current;B&&Z?Tc(Z,A):eh(A),Ee(),ze(X),ge()},se=()=>{if(!$)return;const A=window.getSelection()?.rangeCount?window.getSelection()?.getRangeAt(0):null,z=A?br(A):null,X=e.current;B&&X?t4(X):e4(),Ee(),ze(z),ge()},Le=A=>(A instanceof Element?A:A.parentElement)?.closest(`[${Qe}]`)??null,he=A=>{const z=Le(A.startContainer),X=Le(A.endContainer);return z===X?z:null},Ne=de.current?he(de.current)?.getAttribute(Qe):null,Te=!B&&!_&&Ne!=="title"&&Ne!=="summary",et=()=>{if(!Te)return;const A=window.getSelection();A&&A.rangeCount>0&&(j.current=A.getRangeAt(0).cloneRange()),K.current=null,E(A?.toString().trim()??""),f("formula")},Oe=()=>{const A=w.trim();if(!A){Q();return}const z=K.current;if(z?.isConnected){const Ae=document.createRange();Ae.selectNode(z);const Ye=br(Ae);if(z.setAttribute("data-hn-inline-formula",A),z.textContent=A,o){const mt=z.closest(`[${Qe}]`),sn=mt?.getAttribute(Qe);mt&&sn&&o([[sn,zo(mt)]],Ye)}else i&&Wa(Ae,i);Q();return}const X=j.current;if(!X){Q();return}const Z=window.getSelection();Z&&(Z.removeAllRanges(),Z.addRange(X));const U=he(X),ce=U?.getAttribute(Qe),be=br(X);Jp(A),o&&U&&ce?o([[ce,zo(U)]],be):i&&Wa(X,i),Q()},Nt=()=>{const A=window.getSelection();A&&A.rangeCount>0&&(j.current=A.getRangeAt(0).cloneRange()),y(""),f("link")},Ht=async()=>{if(r){k(!0);try{const A=await r();y(A)}finally{k(!1)}}},dt=()=>{const A=vh(g),z=j.current;if(A===null||!z){Q();return}const X=window.getSelection();X&&(X.removeAllRanges(),X.addRange(z));const Z=br(z);if(document.execCommand("createLink",!1,A),o){const U=(z.commonAncestorContainer instanceof Element?z.commonAncestorContainer:z.commonAncestorContainer.parentElement)?.closest(`[${Qe}]`),ce=U?.getAttribute(Qe);U&&ce&&o([[ce,U.innerHTML]],Z)}else i&&Wa(z,i);Q()},Q=()=>{f("format"),y(""),E(""),k(!1),j.current=null,K.current=null,de.current=null,d(null),R(Ii),P(""),O(!1)},je=A=>{A.preventDefault(),dt()},De=A=>{A.preventDefault(),Oe()},I=l.flip?{top:l.bottom+Vu,left:l.left,transform:"translate(-50%, 0)"}:{top:l.top-Vu,left:l.left,transform:"translate(-50%, -100%)"},ee=u.jsx("div",{className:"hn-note-selection-actions",role:"group","aria-label":"文字操作",onMouseDown:A=>{c==="format"&&A.preventDefault()},children:c==="format"?u.jsxs(u.Fragment,{children:[u.jsx(dn,{size:"small",variant:S.bold?"primary":"ghost",className:"hn-note-popover-btn",onClick:()=>st("bold"),title:"粗体","aria-label":"粗体","aria-pressed":S.bold,disabled:!$,children:u.jsx("span",{className:"hn-note-popover-glyph hn-note-popover-glyph--bold",children:"B"})}),u.jsx(dn,{size:"small",variant:S.italic?"primary":"ghost",className:"hn-note-popover-btn",onClick:()=>st("italic"),title:"斜体","aria-label":"斜体","aria-pressed":S.italic,disabled:!$,children:u.jsx("span",{className:"hn-note-popover-glyph hn-note-popover-glyph--italic",children:"I"})}),u.jsx(dn,{size:"small",variant:S.underline?"primary":"ghost",className:"hn-note-popover-btn",onClick:()=>st("underline"),title:"下划线","aria-label":"下划线","aria-pressed":S.underline,disabled:!$,children:u.jsx("span",{className:"hn-note-popover-glyph hn-note-popover-glyph--underline",children:"U"})}),u.jsx(dn,{size:"small",variant:S.strikeThrough?"primary":"ghost",className:"hn-note-popover-btn",onClick:()=>st("strikeThrough"),title:"删除线","aria-label":"删除线","aria-pressed":S.strikeThrough,disabled:!$,children:u.jsx("span",{className:"hn-note-popover-glyph hn-note-popover-glyph--strikethrough",children:"S"})}),u.jsx(dn,{size:"small",variant:S.code?"primary":"ghost",className:"hn-note-popover-btn",onClick:se,title:"行内代码","aria-label":"行内代码","aria-pressed":S.code,disabled:!$,children:u.jsx("span",{className:"hn-note-popover-glyph hn-note-popover-glyph--code",children:"</>"})}),u.jsx(dn,{size:"small",variant:S.formula?"primary":"ghost",className:"hn-note-popover-btn",onClick:et,title:"行内公式","aria-label":"行内公式","aria-pressed":S.formula,disabled:!Te,children:u.jsx("span",{className:"hn-note-popover-glyph hn-note-popover-glyph--formula",children:"fx"})}),u.jsx(Ba,{className:"hn-note-popover-divider"}),_v.map(A=>u.jsx("button",{type:"button",className:`hn-note-popover-color${L===A.hex?" hn-note-popover-color--active":""}`,style:{backgroundColor:A.hex},onClick:()=>We(A.hex),title:`文字颜色:${A.name}`,"aria-label":`文字颜色:${A.name}`,"data-active":L===A.hex,disabled:!$},A.hex)),u.jsx(Ba,{className:"hn-note-popover-divider"}),u.jsx(dn,{size:"small",variant:"ghost",className:"hn-note-popover-btn hn-note-popover-btn--clear",onClick:Pe,disabled:!$,title:"清除样式","aria-label":"清除样式",children:u.jsx("span",{className:"hn-note-popover-glyph hn-note-popover-glyph--clear","aria-hidden":"true",children:u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[u.jsx("path",{d:"M4 7h16"}),u.jsx("path",{d:"M9 7l1 13"}),u.jsx("path",{d:"M15 7l-1 13"}),u.jsx("path",{d:"M5 7l1 13a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2l1-13"}),u.jsx("path",{d:"M9 7V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3"})]})})}),u.jsx(Ba,{className:"hn-note-popover-divider"}),u.jsx(dn,{size:"small",variant:"ghost",className:"hn-note-popover-btn hn-note-popover-btn--link",onClick:Nt,title:"链接","aria-label":"为选中文字添加链接",disabled:B,children:u.jsx("span",{className:"hn-note-popover-glyph hn-note-popover-glyph--link",children:u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[u.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),u.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})})})]}):c==="formula"?u.jsxs("form",{className:"hn-note-popover-link-form",onSubmit:De,children:[u.jsx("input",{ref:q,type:"text",className:"hn-note-popover-link-input",placeholder:"输入 LaTeX 公式","aria-label":"公式(LaTeX)",value:w,onChange:A=>E(A.target.value)}),u.jsx(dn,{type:"submit",size:"small",variant:"primary",className:"hn-note-popover-btn hn-note-popover-btn--confirm",disabled:!w.trim(),title:"确认","aria-label":"确认",children:"✓"}),u.jsx(dn,{size:"small",variant:"ghost",className:"hn-note-popover-btn hn-note-popover-btn--cancel",onClick:Q,title:"取消","aria-label":"取消",children:"✕"})]}):u.jsxs("form",{className:"hn-note-popover-link-form",onSubmit:je,children:[u.jsx("input",{ref:D,type:"text",className:"hn-note-popover-link-input",placeholder:"输入链接 URL","aria-label":"链接 URL",value:g,onChange:A=>y(A.target.value),disabled:x}),r?u.jsx(dn,{size:"small",variant:"primary",className:"hn-note-popover-btn hn-note-popover-btn--magic",onClick:()=>{Ht()},disabled:x,title:"魔法链接",children:x?"…":"魔法链接"}):null,u.jsx(dn,{type:"submit",size:"small",variant:"primary",className:"hn-note-popover-btn hn-note-popover-btn--confirm",disabled:!g.trim()||x,title:"确认","aria-label":"确认",children:"✓"}),u.jsx(dn,{size:"small",variant:"ghost",className:"hn-note-popover-btn hn-note-popover-btn--cancel",onClick:Q,title:"取消","aria-label":"取消",children:"✕"})]})}),G=n?.current;return n?G?Gr.createPortal(u.jsxs(u.Fragment,{children:[u.jsx(Ba,{}),ee]}),G):null:Gr.createPortal(u.jsx(Is,{ref:Ce,className:"hn-note-popover hn-note-popover--edit",style:I,role:"toolbar","aria-label":"文字操作",children:ee}),document.body)},N1=(e,t)=>{for(const n of e){if(n.kind==="code"&&n.id===t)return n;if(n.kind==="collapsible"){const r=N1(n.blocks,t);if(r)return r}}return null},Hv=(e,t,n,r,i)=>{const a=t?N1(e,t):null;return a?{...a,id:n,code:`${hl(r,"code")}${i}`}:{id:n,kind:"paragraph",text:`${r}${i}`}},qv=(e,t,n)=>{const r=e.start.getAttribute(Qe),i=e.end.getAttribute(Qe),a=e.start.getAttribute(Rn),s=e.end.getAttribute(Rn);if(!r&&!a||!i&&!s)return null;const o=r?Xi(e.start):"rich",l=r?Ts(e.start,e.range,!0,o):"",d=i?Xi(e.end):"rich",c=i?Ts(e.end,e.range,!1,d):"",f=r==="title"||r==="summary"?gi(n.leadingHtml):wt(n.leadingHtml),g=wt(n.trailingHtml),y=zv(n);if(y.length===0){const _=`${f}${g}`,F=As(e,t,_);return F?{snapshot:F,caret:vs(e,_,F)}:null}const x=hl(f,o),k=gt(),w=Hv(t.blocks,i?.replace("block:","")??null,k,g,c),E=x?[{id:gt(),kind:"paragraph",text:x}]:[];if(a&&i){const _=k0(t.blocks,a),F=Uu(t.blocks,i.replace("block:",""));return!_||!F?null:{snapshot:{...t,blocks:mi(_,[...E,...y,w],F)},caret:{regionId:`block:${k}`,offset:Yn(g)}}}if(a&&s){const _=k0(t.blocks,a),F=w0(t.blocks,s);return!_||!F?null:{snapshot:{...t,blocks:[..._,...E,...y,w,...F]},caret:{regionId:`block:${k}`,offset:Yn(g)}}}if(r&&s){const _=w0(t.blocks,s);if(!_)return null;if(r==="title")return{snapshot:{title:`${l}${x}`,blocks:[...y,w,..._]},caret:{regionId:`block:${k}`,offset:Yn(g)}};if(r==="summary")return{snapshot:{title:t.title,summary:`${l}${x}`,blocks:[...y,w,..._]},caret:{regionId:`block:${k}`,offset:Yn(g)}};const F=r.replace("block:",""),$=pi(t.blocks,F,`${l}${x}`),j=x0($,F);return j?{snapshot:{...t,blocks:mi(j,[...y,w],_)},caret:{regionId:`block:${k}`,offset:Yn(g)}}:null}if(!r||!i)return null;const S=i.replace("block:",""),R=S0(t.blocks,S);if(r==="title")return{snapshot:{title:`${l}${x}`,blocks:[...y,w,...R]},caret:{regionId:`block:${k}`,offset:Yn(g)}};if(r==="summary")return{snapshot:{title:t.title,summary:`${l}${x}`,blocks:[...y,w,...R]},caret:{regionId:`block:${k}`,offset:Yn(g)}};const L=r.replace("block:",""),P=pi(t.blocks,L,`${l}${x}`),B=x0(P,L),O=Uu(P,S);return!B||!O?null:{snapshot:{...t,blocks:mi(B,[...y,w],O)},caret:{regionId:`block:${k}`,offset:Yn(g)}}},Zu=(e,t,n)=>{const r=jv(n.getData("application/x-hamsternote-fragment+json"));if(r)return qv(e,t,r);const i=n.getData("text/plain"),a=n.getData("text/html"),s=Xi(e.start)==="code"?vi(i):a||vi(i),o=e.start.getAttribute("data-note-region-id"),l=o==="title"||o==="summary"?gi(s):wt(s),d=As(e,t,l);return d?{snapshot:d,caret:vs(e,l,d)}:null},M0=e=>e.getAttribute("data-note-block-id")??e.getAttribute("data-note-sortable-id"),Ea=e=>e.getAttribute("data-note-drag-container-id"),Zs=(e,t)=>{if(!t.classList.contains("hn-note-collapsible-body"))return!1;const n=t.getAttribute("data-note-block-container-id"),r=t.parentElement;if(n===null||!(r instanceof HTMLElement)||!r.classList.contains("hn-note-collapsible"))return!1;const i=r.parentElement;if(!(i instanceof HTMLElement)||i.getAttribute("data-note-drag-kind")!=="block"||i.getAttribute("data-note-block-id")!==n||i.closest("[data-note-sortable-id]")!==i)return!1;const a=i.parentElement;return a===e||a instanceof HTMLElement&&Zs(e,a)},Uv=(e,t)=>t===null?e:Array.from(e.querySelectorAll("[data-note-block-container-id]")).find(n=>n.getAttribute("data-note-block-container-id")===t&&Zs(e,n))??null,Js=(e,t)=>{if(t.closest("[data-note-sortable-id]")!==t)return!1;const n=t.parentElement;return n===e||n instanceof HTMLElement&&Zs(e,n)},L1=(e,t)=>{let n=0,r=e.parentElement;for(;r!==null&&r!==t;)n++,r=r.parentElement;return n},Wv=(e,t,n)=>{const r=new Map;for(const i of e.querySelectorAll("[data-note-drag-kind]")){if(!Js(e,i)||t.contains(i))continue;const a=M0(i);if(a===null)continue;const s=`${Ea(i)??""}\0${a}`,o=r.get(s);o===void 0?r.set(s,[i]):o.push(i)}return Array.from(r.values()).flatMap(i=>{const a=i[0],s=i.at(-1);if(a===void 0||s===void 0)return[];const o=M0(a);if(o===null)return[];const l=a.getBoundingClientRect(),d=s.getBoundingClientRect(),c=l.top,f=d.bottom,g=n>=c+(f-c)/2?"after":"before",y=g==="after"?s:a;return[{depth:L1(y,e),distance:n<c?c-n:n>f?n-f:0,destination:{containerId:Ea(a),placement:g,targetBlockId:o},element:y}]})},Gv=(e,t,n)=>Array.from(e.querySelectorAll("[data-note-block-container-id]")).flatMap(r=>{if(t.contains(r)||!Zs(e,r))return[];const i=r.getAttribute("data-note-block-container-id");if(i===null)return[];const a=r.getBoundingClientRect();return n<a.top||n>a.bottom?[]:[{depth:L1(r,e),distance:0,destination:{containerId:i,placement:"after",targetBlockId:null},element:r}]}),Xv=(e,t,n)=>{const r=[...Wv(e,t,n),...Gv(e,t,n)];r.sort((a,s)=>a.distance-s.distance||s.depth-a.depth);const i=r[0];return i===void 0?null:{destination:i.destination,element:i.element}},Vv=(e,t)=>{const n=Uv(e,t);if(n===null)return[];const r=new Set;return Array.from(n.children).filter(i=>{if(!(i instanceof HTMLElement)||!i.hasAttribute("data-note-sortable-id")||!Js(e,i))return!1;const a=M0(i);return a===null||r.has(a)?!1:(r.add(a),!0)})},Rs=(e,t,n)=>{if(t===null)return n(e);let r=!1;const i=e.map(a=>{if(a.kind!=="collapsible")return a;if(a.id===t){const o=n(a.blocks);return r=o.updated,o.updated?{...a,blocks:o.blocks}:a}const s=Rs(a.blocks,t,n);return s.updated?(r=!0,{...a,blocks:s.blocks}):a});return{blocks:r?i:e,updated:r}},P1=(e,t,n)=>Rs(e,t,r=>{const i=n(r);return{blocks:i,updated:i!==r}}).blocks,D1=(e,t)=>e.kind!=="collapsible"?!1:e.id===t?!0:e.blocks.some(n=>D1(n,t)),B1=(e,t)=>e.length===t.length&&e.every((n,r)=>{const i=t[r];return i===void 0||n.id!==i.id||n.kind!==i.kind?!1:n.kind!=="collapsible"||i.kind!=="collapsible"?!0:B1(n.blocks,i.blocks)}),Yv=({blocks:e,destination:t,sourceBlockId:n,sourceContainerId:r})=>{let i;const a=Rs(e,r,l=>{const d=l.findIndex(c=>c.id===n);return i=l[d],i===void 0?{blocks:l,updated:!1}:{blocks:l.filter((c,f)=>f!==d),updated:!0}});if(!a.updated||i===void 0)return e;const s=i;if(t.containerId!==null&&D1(s,t.containerId))return e;const o=Rs(a.blocks,t.containerId,l=>{const d=t.targetBlockId===null?l.length:l.findIndex(g=>g.id===t.targetBlockId);if(d<0)return{blocks:l,updated:!1};const c=t.targetBlockId===null||t.placement==="before"?d:d+1,f=l.slice();return f.splice(c,0,s),{blocks:f,updated:!0}});return o.updated&&!B1(e,o.blocks)?o.blocks:e},O1=e=>{switch(e.kind){case"todo":return[`${e.id}:${e.kind}:${e.items.map(t=>t.id).join(",")}`];case"quote":return[`${e.id}:${e.kind}:${e.text}`];case"collapsible":return[`${e.id}:${e.kind}:${e.collapsed}`,...e.blocks.flatMap(O1)];default:return[`${e.id}:${e.kind}`]}},Kv=e=>e.flatMap(O1).join("\0"),Mn={after:"hn-note-block-drop-after",before:"hn-note-block-drop-before",externalAfter:"hn-note-external-drop-after",externalBefore:"hn-note-external-drop-before",dragging:"hn-note-sortable-block--dragging"},Zv=4,Jv=500,Qv=8,e8="button, input, select, textarea, a",t8=e=>({position:{x:0,y:0},width:e.offsetWidth,height:e.offsetHeight,rotation:0,scale:1}),n8=e=>Array.from(e.children).filter(t=>t instanceof HTMLElement&&t.hasAttribute("data-note-sortable-id")),r8=e=>Array.from(e.querySelectorAll("[data-note-drag-kind]")).filter(t=>Js(e,t)),xl=e=>e.getAttribute("data-note-block-id")??e.getAttribute("data-note-sortable-id"),i8=e=>{const t=new Map;for(const n of n8(e)){const r=xl(n);if(r===null)continue;const i=t.get(r);i?i.push(n):t.set(r,[n])}return Array.from(t.values())},z1=(e,t)=>{if(t.getAttribute("data-note-drag-kind")==="block")return Vv(e,Ea(t));const n=t.parentElement;if(n===null)return[];const r=t.getAttribute("data-note-drag-kind"),i=t.getAttribute("data-note-drag-parent-id");return Array.from(n.children).filter(a=>a instanceof HTMLElement&&a.getAttribute("data-note-drag-kind")===r&&a.getAttribute("data-note-drag-parent-id")===i)},a8=e=>{const t=e.getAttribute("data-note-drag-kind");if(t==="block"){const r=xl(e);return r===null?null:{kind:t,blockId:r,containerId:Ea(e)}}const n=e.getAttribute("data-note-drag-parent-id");return n===null?null:t==="todo-item"||t==="quote-line"?{kind:t,blockId:n,containerId:Ea(e),sourceId:e.id}:null},s8=(e,t,n)=>{const r=t.closest("[data-note-sortable-id]");if(r===null)return null;const i=z1(e,t),s=(i.length>0?i:[r]).map(R=>R.getBoundingClientRect()),o=Math.min(...s.map(R=>R.top)),l=Math.max(...s.map(R=>R.bottom));if(l<=o||n>=o&&n<=l)return null;const d=i8(e);let c=d.findIndex(R=>{const L=R.at(-1);return L!==void 0&&n<=L.getBoundingClientRect().bottom});c<0&&(c=d.length-1);const f=d[c],g=f?.[0],y=f?.[f.length-1];if(g===void 0||y===void 0)return null;const x=xl(g);if(x===null)return null;const k=g.getBoundingClientRect().top,w=y.getBoundingClientRect().bottom,E=n>=k+(w-k)/2?"after":"before";return{destination:{placement:E,targetBlockId:x},element:E==="after"?y:g}},o8=({body:e,controls:t})=>{const n=[],r=[];return r8(e).forEach(i=>{const a=Array.from(i.querySelectorAll('[data-block-menu-mode="convert"]')).find(k=>k.closest("[data-note-drag-kind]")===i);if(a===void 0)return;let s=null,o=null,l=!1,d=!1;const c=new jt.Drag(a,{getPose:t8,setPose:()=>{},setPoseOnEnd:()=>{}}),f=k=>{const w=k[0];s=w?.getLastOperation()?.point??null,o=w?.pointerId??null,l=!1,d=!1},g=k=>{const w=k[0]?.getLastOperation()?.point;w===void 0||s===null||o===null||(!l&&Math.hypot(w.x-s.x,w.y-s.y)>=Zv&&(l=!0,t.begin(i,o)),l&&t.preview(w.y))},y=()=>{l&&!d&&t.suppressClick(),l&&t.finish(!d),s=null,o=null},x=k=>{k.pointerId===o&&(d=!0,l&&t.finish(!1))};document.addEventListener("pointercancel",x,!0),c.addEventListener(jt.DragOperationType.Start,f),c.addEventListener(jt.DragOperationType.Move,g),c.addEventListener(jt.DragOperationType.End,y),n.push(c),r.push(()=>{document.removeEventListener("pointercancel",x,!0)})}),()=>{r.forEach(i=>{i()}),n.forEach(i=>{i.destroy()})}},l8=({sourceIndex:e,targetIndex:t,itemCount:n,pointerOffset:r,targetSize:i})=>{if(!(Number.isInteger(e)&&e>=0&&e<n&&Number.isInteger(t)&&t>=0&&t<n)||!Number.isFinite(r)||!Number.isFinite(i)||i<=0)return null;const s=r>=i/2?t+1:t;return{destinationIndex:s>e?s-1:s,insertionIndex:s}},c8=(e,t,n)=>{if(!(Number.isInteger(t)&&t>=0&&t<e.length&&Number.isInteger(n)&&n>=0&&n<e.length)||t===n)return e;const i=e.slice(),[a]=i.splice(t,1);return a===void 0?e:(i.splice(n,0,a),i)},u8=({body:e,controls:t,enabled:n})=>{let r=null;const i=()=>{r!==null&&(window.clearTimeout(r.timer),r=null)},a=c=>{if(!n||c.pointerType!=="touch"||r!==null||t.isDragging()||!(c.target instanceof Element)||c.target.closest(e8)!==null)return;const f=c.target.closest("[data-note-drag-kind]");if(f===null||!e.contains(f)||!Js(e,f))return;const g={x:c.clientX,y:c.clientY},y=window.setTimeout(()=>{const x=r;x===null||x.pointerId!==c.pointerId||(r=null,t.begin(x.sourceElement,x.pointerId))},Jv);r={pointerId:c.pointerId,sourceElement:f,start:g,timer:y}},s=c=>{if(c.pointerType==="touch"){if(r?.pointerId===c.pointerId){Math.hypot(c.clientX-r.start.x,c.clientY-r.start.y)>Qv&&i();return}!t.isPointerActive(c.pointerId)||!t.isDragging()||(c.preventDefault(),t.clearSelection(),t.preview(c.clientY))}},o=c=>{t.isDragging()&&c.preventDefault()},l=c=>{if(c.pointerType==="touch"){if(r?.pointerId===c.pointerId){i();return}!t.isPointerActive(c.pointerId)||!t.isDragging()||(c.preventDefault(),c.type==="pointerup"&&t.suppressClick(),t.finish(c.type==="pointerup"))}},d=c=>{t.isDragging()&&c.preventDefault()};return e.addEventListener("pointerdown",a),document.addEventListener("pointermove",s,{passive:!1}),document.addEventListener("touchmove",o,{capture:!0,passive:!1}),document.addEventListener("pointerup",l),document.addEventListener("pointercancel",l),e.addEventListener("contextmenu",d),()=>{i(),e.removeEventListener("pointerdown",a),document.removeEventListener("pointermove",s),document.removeEventListener("touchmove",o,!0),document.removeEventListener("pointerup",l),document.removeEventListener("pointercancel",l),e.removeEventListener("contextmenu",d)}},Ju=(e,t)=>{const n=e.items.findIndex(o=>o.id===t),r=e.items[n];if(n<0||r===void 0)return[e];const i=e.items.slice(0,n),a=e.items.slice(n+1),s=i.length===0&&a.length===0?e.title:"";return[...i.length>0?[{...e,items:i}]:[],{id:r.id,kind:"todo",title:s,items:[r]},...a.length>0?[{...e,id:i.length>0?gt():e.id,title:i.length>0?"":e.title,items:a}]:[]]},Qu=(e,t,n)=>{const r=Jn(e.text),i=r[t];if(i===void 0)return[e];const a=r.slice(0,t),s=r.slice(t+1),o=(l,d,c)=>({id:l,kind:"quote",text:d,...c===void 0?{}:{author:c}});return[...a.length>0?[o(e.id,a.join(`
|
|
286
|
+
`))]:[],o(n,i,s.length===0?e.author:void 0),...s.length>0?[o(gt(),s.join(`
|
|
287
|
+
`),e.author)]:[]]},ed=(e,t,n)=>{if(!(Number.isInteger(t)&&t>=0&&t<e.length&&Number.isInteger(n)&&n>=0&&n<e.length)||t===n)return e;const i=e.slice(),[a]=i.splice(t,1);return a===void 0?e:(i.splice(n,0,a),i)},d8=({blocks:e,destinationIndex:t,source:n,sourceIndex:r})=>n.kind==="block"?c8(e,r,t):P1(e,n.containerId,i=>i.map(a=>{if(a.id!==n.blockId)return a;if(n.kind==="todo-item"){if(a.kind!=="todo")return a;const l=ed(a.items,r,t);return l===a.items?a:{...a,items:l}}if(a.kind!=="quote")return a;const s=Jn(a.text),o=ed(s,r,t);return o===s?a:{...a,text:o.join(`
|
|
288
|
+
`)}})),h8=({blocks:e,destination:t,source:n,sourceIndex:r})=>{if(n.containerId!==null){let d;const c=P1(e,n.containerId,y=>y.flatMap(x=>{if(x.id!==n.blockId)return[x];const k=n.kind==="todo-item"?x.kind==="todo"?Ju(x,n.sourceId):[x]:x.kind==="quote"?Qu(x,r,n.sourceId):[x];return d=k.find(w=>w.id===n.sourceId),k.filter(w=>w.id!==n.sourceId)}));if(d===void 0||c===e)return e;const f=c.findIndex(y=>y.id===t.targetBlockId);if(f<0)return e;const g=c.slice();return g.splice(t.placement==="after"?f+1:f,0,d),g}if(!e.some(d=>d.id===n.blockId))return e;const i=e.flatMap(d=>d.id!==n.blockId?[d]:n.kind==="todo-item"?d.kind!=="todo"?[d]:Ju(d,n.sourceId):d.kind!=="quote"?[d]:Qu(d,r,n.sourceId)),a=i.findIndex(d=>d.id===n.sourceId);if(a<0)return e;const s=i.slice(),[o]=s.splice(a,1);if(o===void 0)return e;const l=s.findIndex(d=>d.id===t.targetBlockId);if(t.targetBlockId===n.blockId){const d=e.findIndex(y=>y.id===n.blockId);if(d<0)return e;const c=e[d-1],f=e[d+1],g=t.placement==="before"?c===void 0?0:s.findIndex(y=>y.id===c.id)+1:f===void 0?s.length:s.findIndex(y=>y.id===f.id);return g<0?e:(s.splice(g,0,o),s)}return l<0?e:(s.splice(t.placement==="after"?l+1:l,0,o),s)},f8=e=>{const t=p.useRef(!1),n=p.useRef(null);return p.useEffect(()=>{const r=i=>{if(t.current){if(!e.current?.contains(i.target)){t.current=!1;return}t.current=!1,i.preventDefault(),i.stopPropagation()}};return document.addEventListener("click",r,!0),()=>{document.removeEventListener("click",r,!0),n.current!==null&&window.clearTimeout(n.current)}},[e]),p.useCallback(()=>{t.current=!0,n.current!==null&&window.clearTimeout(n.current),n.current=window.setTimeout(()=>{t.current=!1,n.current=null},0)},[])},m8=({bodyRef:e,blocks:t,onBlocksChange:n,touchEnabled:r})=>{const i=p.useRef(t),a=p.useRef(n),s=f8(e);i.current=t,a.current=n;const o=Kv(t),l=n!==void 0;p.useEffect(()=>{const d=e.current;if(d===null||!l)return;let c=null,f=-1,g=-1,y=null,x=null,k=null,w=null,E=[],S=null;const R=()=>{S?.classList.remove(Mn.before,Mn.after),S=null},L=()=>{const $=window.getSelection();y!==null&&$&&$.rangeCount>0&&$.removeAllRanges()},P=($,j)=>{if(c!==null)return;const D=a8($),q=z1(d,$),K=q.indexOf($);D===null||K<0||(R(),f=K,g=K,y=$,x=D,k=null,w=null,E=q,c=j,$.classList.add(Mn.dragging),L())},B=$=>{if(y===null)return;if(x?.kind==="block"){const de=Xv(d,y,$);if(de!==null){R(),w=de.destination,k=null,S=de.element,de.element.classList.add(de.destination.placement==="after"?Mn.after:Mn.before);return}}else{const de=s8(d,y,$);if(de!==null){R(),k=de.destination,w=null,S=de.element,de.element.classList.add(de.destination.placement==="after"?Mn.after:Mn.before);return}}const j=E;if(j.length===0)return;let D=j.findIndex(de=>$<=de.getBoundingClientRect().bottom);D<0&&(D=j.length-1);const q=j[D];if(q===void 0)return;const K=q.getBoundingClientRect(),fe=l8({itemCount:j.length,pointerOffset:$-K.top,sourceIndex:f,targetIndex:D,targetSize:K.height});fe!==null&&(R(),k=null,w=null,g=fe.destinationIndex,S=q,q.classList.add(fe.insertionIndex===D?Mn.before:Mn.after))},O=$=>{R(),y?.classList.remove(Mn.dragging);const j=f,D=g,q=x,K=k,fe=w;if(y=null,x=null,k=null,w=null,E=[],f=-1,g=-1,c=null,!$||q===null)return;const de=i.current,Ce=fe!==null&&q.kind==="block"?Yv({blocks:de,destination:fe,sourceBlockId:q.blockId,sourceContainerId:q.containerId}):K!==null&&q.kind!=="block"?h8({blocks:de,destination:K,source:q,sourceIndex:j}):j===D?de:d8({blocks:de,destinationIndex:D,source:q,sourceIndex:j});Ce!==de&&a.current?.(Ce.slice())},_=o8({body:d,controls:{begin:P,finish:O,preview:B,suppressClick:s}}),F=u8({body:d,enabled:r,controls:{begin:P,clearSelection:L,finish:O,isDragging:()=>y!==null,isPointerActive:$=>$===c,preview:B,suppressClick:s}});return document.addEventListener("selectionchange",L),()=>{O(!1),_(),F(),document.removeEventListener("selectionchange",L)}},[o,e,l,s,r])},p8=e=>{if(typeof e!="object"||e===null||!("id"in e)||!("content"in e)||!("clickable"in e))return;const{id:t,content:n,clickable:r}=e;if(!(typeof t!="string"||t.trim().length===0||typeof n!="string"||typeof r!="boolean"))return{id:t,content:n,clickable:r}},g8=(e,t)=>{if(!t.editable)return{ok:!1,reason:"not-editable"};if(!t.canCommit)return{ok:!1,reason:"missing-on-blocks-change"};const n=p8(e.item);if(n===void 0)return{ok:!1,reason:"invalid-item"};if(t.activeDrags.has(e.drag))return{ok:!1,reason:"drag-already-active"};const r=e.drag.getFingers().find(i=>i.pointerId===e.pointerId&&!i.getIsDestroyed()&&i.getLastOperation(jt.FingerOperationType.End)===void 0);return r===void 0?{ok:!1,reason:"missing-active-pointer"}:{ok:!0,preparation:{drag:e.drag,finger:r,item:n}}},v8=(e,t)=>({id:t,kind:"paragraph",text:vi(e.content),externalItem:e}),y8=(e,t,n)=>[...e.slice(0,n),t,...e.slice(n)],b8=(e,t,n)=>{const r=e.getBoundingClientRect();if(n.x<r.left||n.x>r.right||n.y<r.top||n.y>r.bottom)return null;const i=new Map;for(const s of e.children){if(!(s instanceof HTMLElement))continue;const o=s.getAttribute("data-note-block-id");if(o===null||!s.hasAttribute("data-note-sortable-id"))continue;const l=i.get(o);l===void 0?i.set(o,[s]):l.push(s)}for(let s=0;s<t.length;s+=1){const o=t[s];if(o===void 0)continue;const l=i.get(o.id),d=l?.[0],c=l?.at(-1);if(d===void 0||c===void 0)continue;const f=d.getBoundingClientRect().top,g=c.getBoundingClientRect().bottom;if(n.y>g&&s<t.length-1)continue;const y=n.y<f+(g-f)/2?"before":"after";return{element:y==="before"?d:c,insertionIndex:y==="before"?s:s+1,placement:y}}const a=e.querySelector(":scope > .hn-note-body-tail");return a===null?null:{element:a,insertionIndex:0,placement:"before"}},qo=(e,t)=>{e.target?.element===t?.element&&e.target?.placement===t?.placement||(e.target!==null&&e.target.element.classList.remove(e.target.placement==="before"?Mn.externalBefore:Mn.externalAfter),e.target=t,t!==null&&t.element.classList.add(t.placement==="before"?Mn.externalBefore:Mn.externalAfter))},x8=({bodyRef:e,blocks:t,canCommit:n,commitBlocks:r,editable:i})=>{const a=p.useRef({blocks:t,canCommit:n,commitBlocks:r,editable:i}),s=p.useRef(!0),o=p.useRef(new Set),l=p.useRef(new Set);p.useLayoutEffect(()=>{a.current={blocks:t,canCommit:n,commitBlocks:r,editable:i}},[t,n,r,i]);const d=p.useCallback((g,y)=>{g.settled||(g.settled=!0,g.removeListeners(),o.current.delete(g),l.current.delete(g.drag),qo(g,null),g.resolve(y))},[]),c=p.useCallback(g=>{for(const y of[...o.current])d(y,{status:"cancelled",reason:g})},[d]);p.useEffect(()=>{(!i||!n)&&c("note-became-readonly")},[n,c,i]),p.useLayoutEffect(()=>{s.current=!0;const g=o.current;return()=>{s.current=!1;for(const y of[...g])d(y,{status:"cancelled",reason:"note-unmounted"})}},[d]);const f=p.useCallback(g=>{if(!s.current)return{ok:!1,reason:"not-editable"};if(o.current.size>0)return{ok:!1,reason:"drag-already-active"};const y=g8(g,{editable:a.current.editable,canCommit:a.current.canCommit,activeDrags:l.current});if(!y.ok)return y;const{drag:x,finger:k,item:w}=y.preparation;let E=()=>{},S=()=>{};const R=new Promise((_,F)=>{E=_,S=F}),L=_=>{const F=e.current,$=F===null?null:b8(F,a.current.blocks,_);return qo(O,$),$},P=_=>{O.didMove=!0,L(_.point)},B=_=>{if(_.event?.type==="pointercancel"){d(O,{status:"cancelled",reason:"pointer-cancelled"});return}const F=O.didMove?L(_.point):null;if(F===null){d(O,{status:"cancelled",reason:"released-outside-note"});return}const $=a.current;if(!$.editable||!$.canCommit){d(O,{status:"cancelled",reason:"note-became-readonly"});return}const j=v8(w,gt()),D=y8($.blocks,j,F.insertionIndex);if(!O.settled){O.settled=!0,O.removeListeners(),o.current.delete(O),l.current.delete(O.drag),qo(O,null);try{$.commitBlocks(D),O.resolve({status:"placed",item:w,block:j})}catch(q){O.reject(q)}}},O={drag:x,finger:k,item:w,reject:S,resolve:E,removeListeners:()=>{k.removeEventListener(jt.FingerOperationType.Move,P),k.removeEventListener(jt.FingerOperationType.End,B)},didMove:!1,settled:!1,target:null};return k.addEventListener(jt.FingerOperationType.Move,P),k.addEventListener(jt.FingerOperationType.End,B),o.current.add(O),l.current.add(x),{ok:!0,session:{completion:R,cancel:()=>d(O,{status:"cancelled",reason:"cancelled-by-host"})}}},[e,d]);return p.useMemo(()=>({startExternalDrag:f}),[f])},rs=e=>JSON.stringify({title:e.title,...e.summary?{summary:e.summary}:{},blocks:e.blocks});function w8({blocks:e,links:t=[],summary:n,tagLabel:r,title:i,theme:a="light",themeColor:s,editable:o=!1,selectMode:l=!1,onTitleChange:d,onSummaryChange:c,onBlocksChange:f,onNoteTransaction:g,onBlockSelect:y,onPictureUpload:x,onMagicLinkConfigure:k,onMagicLinkClick:w,onLinkClick:E,onExternalItemClick:S,ref:R,undoRedoController:L,topPadding:P,bottomPadding:B}){const O=o&&!l,_=p.useRef(null),F=p.useRef(null),$=p.useRef(null),j=p.useRef(null),D=p.useRef(null),q=p.useRef(null),K=p.useRef(null),[fe,de]=p.useState(()=>typeof window>"u"?841:window.innerWidth),[Ce,oe]=p.useState(null),[Ee,ze]=p.useState(null),ge=p.useRef(e),We=p.useCallback((I,ee,G,A)=>{const z=A?{caret:A,snapshotKey:rs(I)}:null;return g?(D.current=z,g({snapshot:I,operation:ee}),!0):G||!f?!1:(D.current=z,f([...I.blocks]),!0)},[f,g]),Pe=p.useCallback((I,ee)=>{const G=cv({title:i,...n===void 0?{}:{summary:n},blocks:e},I),A=ee?{selection:ee,snapshotKey:rs(G)}:null;if(g){q.current=A,g({snapshot:G,operation:{kind:"format",source:"popover"}});return}const z=new Set(I.map(([Z])=>Z==="title"?"title":Z==="summary"?"summary":"body"));if(z.size!==1)return;const X=z.values().next().value;q.current=A,X==="title"?d?.(G.title):X==="summary"?c?.(G.summary??""):f?.([...G.blocks])},[e,f,g,c,d,n,i]),st=typeof navigator<"u"&&(/Android|iPhone|iPad|iPod|Mobile/i.test(navigator.userAgent)||/Macintosh/i.test(navigator.userAgent)&&navigator.maxTouchPoints>1);p.useEffect(()=>{const I=()=>de(window.innerWidth);return window.addEventListener("resize",I),()=>window.removeEventListener("resize",I)},[]),p.useEffect(()=>{const I=_.current;if(!(!I||!O))return ev(I)},[O]),p.useEffect(()=>{const I=_.current;if(!I||!O)return;const ee=G=>{if(Li(G.target))return;const A=ia(I);if(!A)return;const z=G.inputType.startsWith("delete"),X=G.inputType==="insertText"||G.inputType==="insertReplacementText"||G.inputType==="insertCompositionText",Z=G.inputType==="insertParagraph"||G.inputType==="insertLineBreak",U=X||Z;if(!z&&!U)return;G.preventDefault();const ce=Z?"<br>":X?vi(G.data??""):"",be=As(A,{title:i,...n===void 0?{}:{summary:n},blocks:e},ce);be&&We(be,{kind:U?"replace":"delete",source:"beforeinput"},Ya(A),vs(A,ce,be))};return I.addEventListener("beforeinput",ee),()=>I.removeEventListener("beforeinput",ee)},[e,We,O,n,i]),p.useLayoutEffect(()=>{ge.current=e},[e]);const se=fe>840?"4rem":"1.5rem",Le=O&&f!==void 0,he=st||fe<840,Ne={...s?{"--hn-theme":s}:{},...P?{"--hn-top-padding":`${P}px`}:{},...B?{"--hn-bottom-padding":`${B}px`}:{}},Te=L??V7,et=x8({bodyRef:F,blocks:e,editable:O,canCommit:f!==void 0,commitBlocks:I=>f?.(I)});p.useImperativeHandle(R,()=>({...Te,...et,scrollToBlock:I=>{const ee=F.current;if(!ee)return!1;const G=Array.from(ee.children).find(A=>A instanceof HTMLElement&&(A.id===I||A.getAttribute("data-note-sortable-id")===I||A.getAttribute("data-note-block-id")===I));return G?(G.scrollIntoView({behavior:"smooth",block:"center"}),G.hasAttribute("tabindex")||(G.tabIndex=-1),G.focus({preventScroll:!0}),!0):!1}}),[Te,et]);const{openBlockMenuId:Oe,requestFocus:Nt,handleBlockMenuOpenChange:Ht}=yf(_),dt=()=>{const I=e[e.length-1];if(I&&(I.kind==="paragraph"||I.kind==="heading")&&Xr(I.text)){Nt(I.id,"start");return}if(!f)return;const ee=gt();f([...e,{id:ee,kind:"paragraph",text:""}]),Nt(ee,"start")};m8({bodyRef:F,blocks:e,onBlocksChange:Le?f:void 0,touchEnabled:fe<=840}),Xp({root:F,renderKey:O?null:e}),p.useLayoutEffect(()=>{const I=q.current;if(I&&rs({title:i,...n===void 0?{}:{summary:n},blocks:e})===I.snapshotKey){const Z=_.current;Z&&fl(Z,I.selection)&&(q.current=null)}const ee=D.current;if(ee&&rs({title:i,...n===void 0?{}:{summary:n},blocks:e})===ee.snapshotKey){const Z=_.current;Z&&iv(Z,ee.caret)&&(D.current=null)}const G=j.current;if(!G)return;j.current=null;const A=_.current,z=A?rd(A,G.blockId):null;z&&(Kp(z,G.offset,G.offset),c4(z))}),p.useLayoutEffect(()=>{if(!he)return;const I=F.current;if(!I)return;if(e.length===0){ze(null);return}const ee=Oe!==null;ze(G=>{const A=kf(I,G?.sourceId??null);return!A||ee||!A.addExpanded&&!A.convertExpanded?A:{...A,addExpanded:!1,convertExpanded:!1}})},[e,Oe,he]);const Q=I=>{if(!he)return;const ee=F.current;if(!ee)return;const G=id(I,ee);G&&ze(G)},je=I=>{if(!(I instanceof Element))return!1;const ee=F.current;if(!ee)return!1;const G=Array.from(ee.children).find(z=>z instanceof HTMLElement&&z.hasAttribute("data-note-select-id")&&(z===I||z.contains(I)));if(!G)return!1;const A=G.getAttribute("data-note-select-id");return A?(oe(A),y?.(A),G.focus({preventScroll:!0}),!0):!1},De=I=>{if(!(I instanceof Element))return null;const G=I.closest("[data-note-external-block-id]")?.getAttribute("data-note-external-block-id");if(G==null)return null;const A=X=>{for(const Z of X){if(Z.id===G)return Z;if(Z.kind==="collapsible"){const U=A(Z.blocks);if(U!==void 0)return U}}},z=A(ge.current);return z?.kind==="paragraph"&&z.externalItem?.clickable===!0?z.externalItem:null};return u.jsxs(u.Fragment,{children:[u.jsxs("article",{className:`hn-note-shell hn-note-shell--${a}${st?" hn-note-shell--mobile":""}${he?" hn-note-shell--bottom-toolbar":""}`,"data-theme":a,role:l?"listbox":void 0,"aria-label":l?"Note blocks":void 0,ref:_,style:Ne,onCopy:I=>{if(Li(I.target))return;const ee=ia(I.currentTarget);if(!ee)return;const G=Xu(ee,{blocks:e}),A=nu(ee,JSON.stringify(G),G);I.preventDefault(),I.clipboardData.setData("text/html",A.html),I.clipboardData.setData("text/plain",A.text),I.clipboardData.setData("application/x-hamsternote-fragment+json",A.internal)},onCut:I=>{if(!O||Li(I.target))return;const ee=ia(I.currentTarget);if(!ee)return;I.preventDefault();const G=Xu(ee,{blocks:e}),A=nu(ee,JSON.stringify(G),G);I.clipboardData.setData("text/html",A.html),I.clipboardData.setData("text/plain",A.text),I.clipboardData.setData("application/x-hamsternote-fragment+json",A.internal);const z=As(ee,{title:i,...n===void 0?{}:{summary:n},blocks:e});z&&We(z,{kind:"cut",source:"clipboard"},Ya(ee),vs(ee,"",z))},onPaste:I=>{if(!O||Li(I.target))return;const ee=ia(I.currentTarget);if(!ee)return;I.preventDefault();const G={title:i,...n===void 0?{}:{summary:n},blocks:e},A=Zu(ee,G,I.clipboardData);A&&We(A.snapshot,{kind:"replace",source:"clipboard"},Ya(ee),A.caret)},onDrop:I=>{if(!O||Li(I.target))return;const ee=ia(I.currentTarget);if(!ee)return;I.preventDefault();const G=Zu(ee,{title:i,...n===void 0?{}:{summary:n},blocks:e},I.dataTransfer);G&&We(G.snapshot,{kind:"replace",source:"clipboard"},Ya(ee),G.caret)},onFocusCapture:I=>Q(I.target),onPointerDownCapture:I=>Q(I.target),onClickCapture:I=>{if(O&&I.target===F.current&&window.getSelection()?.isCollapsed!==!1){dt();return}if(l&&je(I.target)){I.preventDefault(),I.stopPropagation();return}const ee=De(I.target);if(ee!==null){I.preventDefault(),I.stopPropagation(),S?.(ee);return}if(!(I.target instanceof Element))return;const G=I.target.closest("a");if(G){const z=G.getAttribute("href");z?.startsWith("hnmagic://")&&(I.preventDefault(),I.stopPropagation(),w?.(z));return}const A=I.target.closest("[data-note-link-id]");if(A){const z=A.getAttribute("data-note-link-id");z&&E?.(z)}},onKeyDownCapture:I=>{if(Li(I.target))return;if(O&&I.key.toLowerCase()==="a"&&(I.ctrlKey||I.metaKey)&&rv(I.currentTarget,I.target)){I.preventDefault();return}if(O&&f&&I.key.length===1&&!I.ctrlKey&&!I.metaKey&&!I.altKey&&!I.nativeEvent.isComposing){if(K.current!==null){K.current=null;const A=u4(I.key);if(A){I.preventDefault();const z=A.getAttribute("data-editable-block-id"),X=window.getSelection();if(z&&X&&X.rangeCount>0){const Z=Ec(A,X.getRangeAt(0));j.current={blockId:z,offset:Z.start},Oc(A)}return}}if(I.key==="`"||I.key==="*"||I.key==="~"){const A=l4(I.key);if(A){I.preventDefault();const z=A.getAttribute("data-editable-block-id"),X=window.getSelection();if(z&&X&&X.rangeCount>0){const Z=Ec(A,X.getRangeAt(0));j.current={blockId:z,offset:Z.start},K.current=z,Oc(A)}}}}if(I.key!=="Enter"&&I.key!==" ")return;if(l&&je(I.target)){I.preventDefault(),I.stopPropagation();return}const ee=De(I.target);if(ee!==null){if(I.key!=="Enter")return;I.preventDefault(),I.stopPropagation(),S?.(ee);return}if(!(I.target instanceof Element))return;const G=I.target.closest("a");if(G){const A=G.getAttribute("href");A?.startsWith("hnmagic://")&&(I.preventDefault(),I.stopPropagation(),w?.(A))}},children:[u.jsxs("header",{className:"hn-note-hero",children:[r?u.jsx("span",{className:"hn-note-badge",children:r}):null,O?u.jsx("h1",{...Hn(I=>d?.(I.innerHTML),void 0,"title"),...Et(i,"title"),"data-note-region-id":"title","data-editable-block-id":"title"}):u.jsx("h1",{"data-note-region-id":"title",...Et(i,"title")}),n?O?u.jsx("p",{...Hn(I=>c?.(I.innerHTML),"hn-note-summary","title"),...Et(n,"title"),"data-note-region-id":"summary","data-editable-block-id":"summary"}):u.jsx("p",{className:"hn-note-summary","data-note-region-id":"summary",...Et(n,"title")}):null]}),u.jsxs("div",{ref:F,className:"hn-note-body",style:{"--hn-body-padding-x":se},children:[e.map(I=>{const ee={editable:O,theme:a,themeColor:s,blocks:e,getBlocks:()=>ge.current,openBlockMenuId:Oe,onBlocksChange:f,onPictureUpload:x,requestFocus:Nt,onBlockMenuOpenChange:Ht,externalItemsClickable:!l&&S!==void 0,selectMode:l,selectedBlockId:Ce};if(I.kind==="todo")return u.jsx(Q0,{block:I,ctx:ee},I.id);if(I.kind==="checklist")return u.jsx(yh,{block:I,ctx:ee},I.id);if(I.kind==="unorderedList"||I.kind==="orderedList")return u.jsx(ps,{block:I,ctx:ee},I.id);if(I.kind==="quote")return u.jsx(J0,{block:I,ctx:ee},I.id);const G=g1(I,ee);return u.jsx("div",{className:["hn-note-block",Le?"hn-note-sortable-block":"",l?"hn-note-selectable-block":""].filter(Boolean).join(" "),id:I.id,...["picture","drawing","card","directory","formula"].includes(I.kind)?{[Rn]:`block:${I.id}`}:{},...Le?{"data-note-sortable-id":I.id,"data-note-block-id":I.id,"data-note-drag-kind":"block"}:{},...l?{"data-note-select-id":I.id,role:"option","aria-selected":Ce===I.id,tabIndex:0}:{},children:G},I.id)}),O&&f?u.jsx("button",{type:"button","aria-label":"新建一行",className:"hn-note-body-tail",onClick:dt}):null]}),O&&he?u.jsx(Is,{ref:$,className:"hn-note-bottom-toolbar","data-note-bottom-bar":!0,edge:"bottom",edgeOffset:16,role:"toolbar","aria-label":"编辑操作",style:{zIndex:900},children:u.jsx(Sf,{shellRef:_,target:Ee})}):null]}),O?u.jsx(p4,{containerRef:_,links:t}):null,O&&Oe===null?u.jsx($v,{containerRef:_,allowCrossFieldFormat:!!g,portalContainerRef:he?$:void 0,onMagicLinkConfigure:k,onContentChange:(I,ee)=>{f?.(wa(e,I,ee))},onBatchContentChange:I=>{f?.(I.reduce((ee,[G,A])=>wa(ee,G,A),[...e]))},onRegionFormat:Pe}):null]})}const k8={heading:"heading",paragraph:"paragraph",todo:"todo",unorderedList:"unorderedList",orderedList:"orderedList",quote:"quote",code:"code",callout:"callout",table:"table",formula:"formula",picture:"picture",card:"card",drawing:"drawing",directory:"directory",collapsible:"collapsible",checklist:"checklist"};exports.NoteContent=w8;exports.createNoteId=gt;exports.noteBlockKinds=k8;exports.useNoteContentUndoRedo=Y7;
|
|
289
|
+
//# sourceMappingURL=index.cjs.map
|