@qumra/fanar 0.0.7 → 0.0.8

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.
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- var TEXT_SCALE=["micro","caption","ui","body","lead","base","h4","h3","h2","h1","display","hero","title","mega"];var RADIUS_SCALE=["mark","xs","sm","field","card","lg","section","full"];var SHADOW_SCALE=["raise","tip","panel","pop","modal","toast","sheet"];var CONTAINER_SCALE=["page","shell","note","lead"];var ANIMATE_SCALE=["qfade","qslide","tip","tip-up","drawer","drawer-rtl","savebar","skeleton"];var COLOR_SCALE=["surface","bg","line","hover","ink","ink2","muted","muted2","border","soft","soft2","brand-100","brand-900","brand-ink","brand","brand-hover","brand-deep","skeleton","tint","tint2","mint","amber-900","amber","amber-bg","amber-ink","amber-line","amber-hover","green","green-bg","green-bg2","green-line","green-solid","violet","violet-bg","violet-line","violet-solid","red-100","red","red-bg","red-line","danger","danger-hover","night","hero-body","hero-meta","hero-dim","hero-text","code-bg","code-plain","code-key","code-tag","code-attr","code-str","code-num","code-note","code-dim","code-line","code-chip"];var TOKENS={"--font-sans":'"Alexandria", system-ui, sans-serif',"--color-surface":"#ffffff","--color-bg":"#f7f9f9","--color-line":"#edf1f1","--color-hover":"#f2f6f6","--color-ink":"#020809","--color-ink2":"#3d4545","--color-muted":"#5f6a6a","--color-muted2":"#687373","--color-border":"#7f8c8c","--color-soft":"#eaf2f3","--color-soft2":"#dceded","--color-brand-100":"#a5c9cc","--color-brand-900":"#0a2528","--color-brand-ink":"#0f4a4e","--color-brand":"#207982","--color-brand-hover":"#1a646c","--color-brand-deep":"#0b3b3e","--color-skeleton":"#d6dcdc","--color-tint":"#f4faf8","--color-tint2":"#eff6f3","--color-mint":"#7dd3c0","--color-amber-900":"#3d2a05","--color-amber":"#f8ac33","--color-amber-bg":"#fef6e9","--color-amber-ink":"#85570f","--color-amber-line":"#fbd79a","--color-amber-hover":"#de9219","--color-green":"#1e7a45","--color-green-bg":"#f1faf4","--color-green-bg2":"#e9f6ee","--color-green-line":"#bfe6ce","--color-green-solid":"#1e7a45","--color-violet":"#4b3e8e","--color-violet-bg":"#edeaf6","--color-violet-line":"#ded8ef","--color-violet-solid":"#6d5eb8","--color-red-100":"#f3a79e","--color-red":"#8e2b20","--color-red-bg":"#fdecea","--color-red-line":"#f3c9c4","--color-danger":"#c94134","--color-danger-hover":"#a3362b","--color-night":"#0b0f12","--color-hero-body":"#bfd9d8","--color-hero-meta":"#8fb3b2","--color-hero-dim":"#5e7a79","--color-hero-text":"#d7e3e2","--color-code-bg":"#1f1f1f","--color-code-plain":"#d4d4d4","--color-code-key":"#569cd6","--color-code-tag":"#4ec9b0","--color-code-attr":"#9cdcfe","--color-code-str":"#ce9178","--color-code-num":"#b5cea8","--color-code-note":"#6a9955","--color-code-dim":"#858585","--color-code-line":"#303031","--color-code-chip":"#f4f7f7","--text-micro":"11px","--text-caption":"12px","--text-ui":"13px","--text-body":"14px","--text-lead":"15px","--text-base":"16px","--text-base--line-height":"initial","--text-h4":"17px","--text-h3":"20px","--text-h2":"24px","--text-h1":"30px","--text-display":"36px","--text-hero":"44px","--text-title":"40px","--text-mega":"54px","--container-page":"1600px","--container-shell":"1600px","--container-note":"340px","--container-lead":"520px","--radius-mark":"3px","--radius-xs":"5px","--radius-sm":"7px","--radius-field":"9px","--radius-card":"12px","--radius-lg":"14px","--radius-section":"18px","--radius-full":"999px","--shadow-raise":"0 1px 3px var(--shadow-color)","--shadow-tip":"0 6px 18px var(--shadow-color)","--shadow-panel":"0 10px 30px var(--shadow-color)","--shadow-pop":"0 18px 44px var(--shadow-color)","--shadow-modal":"0 24px 60px rgb(2 8 9 / 0.28)","--shadow-toast":"0 16px 40px rgb(2 8 9 / 0.26)","--shadow-sheet":"0 -14px 40px rgb(2 8 9 / 0.28), inset 0 1px 0 rgb(255 255 255 / 0.06)","--shadow-color":"rgb(2 8 9 / 0.14)","--animate-qfade":"qfade 0.16s ease-out","--animate-qslide":"qslidein 0.22s ease-out","--animate-tip":"tip-in 0.26s cubic-bezier(0.2, 0.8, 0.2, 1)","--animate-tip-up":"tip-up 0.3s cubic-bezier(0.2, 0.9, 0.2, 1)","--animate-drawer":"drawer-ltr 0.32s cubic-bezier(0.2, 0.9, 0.2, 1)","--animate-drawer-rtl":"drawer-rtl 0.32s cubic-bezier(0.2, 0.9, 0.2, 1)","--animate-savebar":"savebar-in 0.2s cubic-bezier(0.2, 0.8, 0.2, 1)","--animate-skeleton":"skeleton-pulse 1.6s ease-in-out infinite","--num-align":"right","--num-align-far":"left","--num-pad-right":"0.875rem","--num-pad-left":"3.5rem","--num-icon-pad-right":"2.5rem","--num-icon-pad-left":"0.875rem"};var DARK_TOKENS={"--color-surface":"#101718","--color-bg":"#0a0f10","--color-line":"#1e2829","--color-hover":"#1a2425","--color-ink":"#f2f6f6","--color-ink2":"#c7d1d1","--color-muted":"#93a0a0","--color-muted2":"#7a8787","--color-border":"#5e6b6c","--color-soft":"#12363a","--color-soft2":"#17454a","--color-brand-ink":"#7dd3c0","--color-skeleton":"#2c3232","--color-amber":"#f8ac33","--color-amber-bg":"#2b2009","--color-amber-ink":"#f5c77a","--color-amber-line":"#5c4415","--color-green":"#6ecf9a","--color-green-bg":"#0d2119","--color-green-bg2":"#102a22","--color-green-line":"#245140","--color-violet":"#b9aeea","--color-violet-bg":"#1e1a33","--color-violet-line":"#38305c","--color-red":"#f3a79e","--color-red-bg":"#2c1613","--color-red-line":"#5c2a24","--color-code-chip":"#17201f","--shadow-color":"rgb(0 0 0 / 0.55)"};import{extendTailwindMerge}from"tailwind-merge";var twMerge=extendTailwindMerge({extend:{classGroups:{"font-size":[{text:TEXT_SCALE}],rounded:[{rounded:RADIUS_SCALE}],shadow:[{shadow:SHADOW_SCALE}],"max-w":[{"max-w":CONTAINER_SCALE}],animate:[{animate:ANIMATE_SCALE}]}}});function cn(...parts){return twMerge(parts.filter(p=>typeof p==="string"&&p.length>0).join(" "))}var TONE_SOFT={neutral:"bg-hover text-muted",brand:"bg-soft text-brand-ink",amber:"bg-amber-bg text-amber-ink",green:"bg-green-bg2 text-green",red:"bg-red-bg text-red",violet:"bg-violet-bg text-violet"};var TONE_SOLID={neutral:"bg-ink2 text-surface",brand:"bg-brand text-white",amber:"bg-amber text-amber-900",green:"bg-green-solid text-white",red:"bg-danger text-white",violet:"bg-violet-solid text-white"};function toLatinDigits(s){return s.replace(/[٠-٩۰-۹٫٬]/g,c=>{const code=c.charCodeAt(0);if(code===1643)return".";if(code===1644)return"";const base=code>=1776?1776:1632;return String(code-base)})}var VARIANTS={primary:"bg-brand border-brand text-white hover:bg-brand-hover",soft:"bg-soft border-soft2 text-brand-ink hover:bg-soft2",outline:"bg-surface border-border text-ink2 hover:border-brand hover:text-brand-ink",ghost:"bg-transparent border-transparent text-ink2 hover:bg-hover",danger:"bg-danger border-danger text-white hover:bg-danger-hover",link:"bg-transparent border-transparent text-brand-ink hover:underline underline-offset-4 px-0!"};var SIZES={sm:"h-9 px-3.5 gap-1.5 text-ui rounded-sm",md:"h-11 px-4 gap-2 text-body rounded-field",lg:"h-12 px-5 gap-2 text-lead rounded-card",xl:"h-14 px-5.5 gap-4 text-h3 font-extrabold rounded-field"};function buttonClasses(variant="primary",size="md",extra){return cn("inline-flex items-center justify-center border font-bold whitespace-nowrap","cursor-pointer transition-colors duration-150 select-none","focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-brand",SIZES[size],VARIANTS[variant],extra)}import{createContext,useCallback,useContext,useSyncExternalStore}from"react";var langStore={subscribe(cb){if(typeof MutationObserver==="undefined")return()=>{};const o=new MutationObserver(cb);o.observe(document.documentElement,{attributes:true,attributeFilter:["lang"]});return()=>o.disconnect()},get:()=>typeof document==="undefined"?"ar-EG":document.documentElement.lang||"ar-EG"};var LocaleCtx=createContext(null);function useMoneyLocale(){const fromProvider=useContext(LocaleCtx);const serverSnapshot=useCallback(()=>fromProvider??"ar-EG",[fromProvider]);return useSyncExternalStore(langStore.subscribe,langStore.get,serverSnapshot)}function useMoneyLang(){return useMoneyLocale().startsWith("en")}var AR=0;var EN=1;var TEXT={close:["\u0625\u063A\u0644\u0627\u0642","Close"],select:["\u0627\u062E\u062A\u0631\u2026","Select\u2026"],search:["\u0627\u0628\u062D\u062B\u2026","Search\u2026"],searchEverything:["\u0627\u0628\u062D\u062B \u0641\u064A \u0643\u0644 \u062D\u0627\u062C\u0629\u2026","Search everything\u2026"],noResults:["\u0645\u0627\u0641\u064A\u0634 \u0646\u062A\u0627\u064A\u062C","No results"],searchOrAdd:["\u0627\u0628\u062D\u062B \u0623\u0648 \u0623\u0636\u0641\u2026","Search or add\u2026"],now:["\u0627\u0644\u0622\u0646","Now"],videoPlayer:["\u0645\u0634\u063A\u0651\u0644 \u0627\u0644\u0641\u064A\u062F\u064A\u0648","Video player"],rating:["\u0627\u0644\u062A\u0642\u064A\u064A\u0645","Rating"],activeFilters:["\u0627\u0644\u0641\u0644\u0627\u062A\u0631 \u0627\u0644\u0645\u0637\u0628\u0651\u0642\u0629:","Active filters:"],clearAll:["\u0645\u0633\u062D \u0627\u0644\u0643\u0644","Clear all"],row:["\u0635\u0641\u0651","row"],dropImages:["\u0627\u0633\u062D\u0628 \u0627\u0644\u0635\u0648\u0631 \u0647\u0646\u0627","Drop images here"],chooseFromDevice:["\u0627\u062E\u062A\u0631 \u0645\u0646 \u0627\u0644\u062C\u0647\u0627\u0632","Choose from device"],previousPeriod:["\u0627\u0644\u0641\u062A\u0631\u0629 \u0627\u0644\u0633\u0627\u0628\u0642\u0629","Previous period"],less:["\u0623\u0642\u0644","Less"],more:["\u0623\u0643\u062B\u0631","More"],totalSales:["\u0625\u062C\u0645\u0627\u0644\u064A \u0627\u0644\u0645\u0628\u064A\u0639\u0627\u062A","Total sales"],netToYou:["\u0635\u0627\u0641\u064A \u0644\u0643","Net to you"],verifiedAccount:["\u062D\u0633\u0627\u0628 \u0645\u0648\u062B\u0651\u0642","Verified account"],grabHint:["\u0639\u0646\u0635\u0631 \u0642\u0627\u0628\u0644 \u0644\u0625\u0639\u0627\u062F\u0629 \u0627\u0644\u062A\u0631\u062A\u064A\u0628. \u0627\u0636\u063A\u0637 \u0645\u0633\u0627\u0641\u0629 \u0644\u0645\u0633\u0643\u0647 \u062B\u0645 \u0627\u0644\u0623\u0633\u0647\u0645 \u0644\u062A\u062D\u0631\u064A\u0643\u0647.","Reorderable item. Press space to grab it, then the arrows to move it."],notifications:["\u0627\u0644\u0625\u0634\u0639\u0627\u0631\u0627\u062A","Notifications"],dismiss:["\u0625\u062E\u0641\u0627\u0621","Dismiss"],unread:["\u063A\u064A\u0631 \u0645\u0642\u0631\u0648\u0621","Unread"],noNotifications:["\u0645\u0641\u064A\u0634 \u0625\u0634\u0639\u0627\u0631\u0627\u062A","No notifications"],noNotificationsDesc:["\u0623\u0648\u0644 \u0645\u0627 \u064A\u062D\u0635\u0644 \u062D\u0627\u062C\u0629 \u062A\u0633\u062A\u0627\u0647\u0644\u060C \u0647\u062A\u0644\u0627\u0642\u064A\u0647\u0627 \u0647\u0646\u0627.","When something worth knowing happens, it lands here."],markAllRead:["\u062A\u0639\u0644\u064A\u0645 \u0627\u0644\u0643\u0644 \u0643\u0645\u0642\u0631\u0648\u0621","Mark all as read"],viewAllNotifications:["\u0639\u0631\u0636 \u0643\u0644 \u0627\u0644\u0625\u0634\u0639\u0627\u0631\u0627\u062A","View all notifications"],newNotifications:["\u0625\u0634\u0639\u0627\u0631\u0627\u062A \u062C\u062F\u064A\u062F\u0629","New notifications"],reloadPreview:["\u0625\u0639\u0627\u062F\u0629 \u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u0645\u0639\u0627\u064A\u0646\u0629","Reload preview"],previousMonth:["\u0627\u0644\u0634\u0647\u0631 \u0627\u0644\u0644\u064A \u0642\u0628\u0644\u0647","Previous month"],nextMonth:["\u0627\u0644\u0634\u0647\u0631 \u0627\u0644\u0644\u064A \u0628\u0639\u062F\u0647","Next month"],whatIsThisNumber:["\u0645\u0627 \u0645\u0639\u0646\u0649 \u0647\u0630\u0627 \u0627\u0644\u0631\u0642\u0645\u061F","What does this number mean?"],explainToMe:["\u0627\u0634\u0631\u062D \u0644\u064A","Explain this"],clearSearch:["\u0645\u0633\u062D \u0627\u0644\u0628\u062D\u062B","Clear search"],alerts:["\u0627\u0644\u062A\u0646\u0628\u064A\u0647\u0627\u062A","Alerts"],whatIsThisOption:["\u0645\u0627 \u0647\u0630\u0627 \u0627\u0644\u062E\u064A\u0627\u0631\u061F","What is this option?"],shouldBeHere:["\u0627\u0644\u0645\u0641\u0631\u0648\u0636 \u062A\u0643\u0648\u0646 \u0647\u0646\u0627","Should be here"],closeExplainer:["\u0625\u063A\u0644\u0627\u0642 \u0627\u0644\u0634\u0631\u062D","Close explainer"],cancelRecording:["\u0625\u0644\u063A\u0627\u0621 \u0627\u0644\u062A\u0633\u062C\u064A\u0644","Cancel recording"],sendRecording:["\u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u062A\u0633\u062C\u064A\u0644","Send recording"],attachFile:["\u0625\u0631\u0641\u0627\u0642 \u0645\u0644\u0641","Attach file"],recordVoice:["\u062A\u0633\u062C\u064A\u0644 \u0635\u0648\u062A\u064A","Record a voice note"],playbackPosition:["\u0645\u0648\u0636\u0639 \u0627\u0644\u062A\u0634\u063A\u064A\u0644","Playback position"],volume:["\u0645\u0633\u062A\u0648\u0649 \u0627\u0644\u0635\u0648\u062A","Volume"],hideSuggestions:["\u0625\u062E\u0641\u0627\u0621 \u0627\u0644\u0627\u0642\u062A\u0631\u0627\u062D\u0627\u062A","Hide suggestions"],askShehab:["\u0627\u0633\u0623\u0644 \u0634\u0647\u0627\u0628\u2026","Ask Shehab\u2026"],shehabThinking:["\u0634\u0647\u0627\u0628 \u0628\u064A\u0641\u0643\u0651\u0631\u2026","Shehab is thinking\u2026"],undo:["\u062A\u0631\u0627\u062C\u0639","Undo"],from:["\u0645\u0646","from"],tryAnotherReply:["\u062C\u0631\u0651\u0628 \u0631\u062F \u062A\u0627\u0646\u064A","Try another reply"],helpfulReply:["\u0631\u062F \u0645\u0641\u064A\u062F","Helpful reply"],unhelpfulReply:["\u0631\u062F \u0645\u0634 \u0645\u0641\u064A\u062F","Unhelpful reply"],aiDisclaimer:["\u0634\u0647\u0627\u0628 \u0645\u0645\u0643\u0646 \u064A\u063A\u0644\u0637. \u0631\u0627\u062C\u0639 \u0627\u0644\u0623\u0631\u0642\u0627\u0645 \u0642\u0628\u0644 \u0645\u0627 \u062A\u062A\u0635\u0631\u0651\u0641 \u0639\u0644\u064A\u0647\u0627.","Shehab can get things wrong. Check the numbers before acting on them."],back10:["\u0631\u062C\u0648\u0639 \u0661\u0660 \u062B\u0648\u0627\u0646\u064A","Back 10 seconds"],forward10:["\u062A\u0642\u062F\u064A\u0645 \u0661\u0660 \u062B\u0648\u0627\u0646\u064A","Forward 10 seconds"],playbackSpeed:["\u0633\u0631\u0639\u0629 \u0627\u0644\u062A\u0634\u063A\u064A\u0644","Playback speed"],arabic:["\u0627\u0644\u0639\u0631\u0628\u064A\u0629","Arabic"],seeMore:["\u0634\u0648\u0641 \u0643\u0645\u0627\u0646","See more"],pictureInPicture:["\u0646\u0627\u0641\u0630\u0629 \u0639\u0627\u0626\u0645\u0629","Picture in picture"]};function useUIText(){return useMoneyLang()?BUNDLES[EN]:BUNDLES[AR]}function build(i){const out={};for(const key of Object.keys(TEXT))out[key]=TEXT[key][i];return out}var BUNDLES=[build(AR),build(EN)];import{useEffect,useId}from"react";import{AlertTriangle,CheckCircle2,Info,X,XCircle}from"lucide-react";import{jsx,jsxs}from"react/jsx-runtime";function Sheet({open,title,onClose,action,children,closeLabel}){const ui=useUIText();useEffect(()=>{if(!open)return;function onKey(e){if(e.key==="Escape")onClose()}document.addEventListener("keydown",onKey);return()=>document.removeEventListener("keydown",onKey)},[open,onClose]);if(!open)return null;return jsxs("div",{className:"fixed inset-0 z-50 flex flex-col justify-end",role:"dialog","aria-modal":"true","aria-label":title,children:[jsx("button",{type:"button","aria-label":closeLabel??ui.close,onClick:onClose,className:"flex-1 bg-black/50 backdrop-blur-[3px] cursor-default animate-[fade-in_0.2s_ease-out]"}),jsxs("div",{className:cn("bg-surface rounded-t-section max-h-[82dvh] flex flex-col overflow-hidden shadow-sheet","animate-[sheet-up_0.26s_cubic-bezier(.22,.61,.36,1)]","pb-[env(safe-area-inset-bottom)]"),children:[jsx("button",{type:"button",onClick:onClose,"aria-label":closeLabel??ui.close,className:"shrink-0 pt-3 pb-1.5 flex justify-center cursor-grab active:cursor-grabbing",children:jsx("span",{"aria-hidden":"true",className:"h-1.5 w-11 rounded-full bg-border"})}),jsxs("div",{className:"shrink-0 flex items-center justify-between gap-3 px-5 pb-3",children:[jsx("span",{className:"text-h4 font-black tracking-tight",children:title}),jsxs("span",{className:"flex items-center gap-3",children:[action,jsx("button",{type:"button",onClick:onClose,"aria-label":closeLabel??ui.close,className:"size-9 rounded-full bg-bg flex items-center justify-center text-muted active:bg-hover active:scale-95 transition-transform cursor-pointer",children:jsx(X,{size:17,strokeWidth:2.4,"aria-hidden":"true"})})]})]}),jsx("div",{className:"flex-1 min-h-0 overflow-y-auto px-3 pb-4 flex flex-col overscroll-contain",children})]})]})}function Modal({open,title,description,onClose,footer,children,size="md",closeLabel}){const ui=useUIText();const titleId=useId();useEffect(()=>{if(!open)return;function onKey(e){if(e.key==="Escape")onClose()}document.addEventListener("keydown",onKey);return()=>document.removeEventListener("keydown",onKey)},[open,onClose]);if(!open)return null;const widths={sm:"max-w-md",md:"max-w-xl",lg:"max-w-3xl"};return jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",role:"dialog","aria-modal":"true","aria-labelledby":titleId,children:[jsx("button",{type:"button","aria-label":closeLabel??ui.close,onClick:onClose,className:"absolute inset-0 bg-black/45 backdrop-blur-[2px] cursor-default"}),jsxs("div",{className:cn("relative w-full bg-surface rounded-lg border border-line flex flex-col max-h-[85dvh] animate-qfade shadow-modal",widths[size]),children:[jsxs("header",{className:"shrink-0 flex items-start justify-between gap-4 p-5 border-b border-line",children:[jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[jsx("h2",{id:titleId,className:"text-h4 font-extrabold text-ink m-0",children:title}),description&&jsx("p",{className:"text-ui text-muted m-0",children:description})]}),jsx("button",{type:"button",onClick:onClose,"aria-label":closeLabel??ui.close,className:"shrink-0 size-8 rounded-sm flex items-center justify-center text-muted hover:bg-hover hover:text-ink transition-colors cursor-pointer",children:jsx(X,{size:17,"aria-hidden":"true"})})]}),children&&jsx("div",{className:"flex-1 min-h-0 overflow-y-auto p-5",children}),footer&&jsx("footer",{className:"shrink-0 flex items-center justify-end gap-2.5 p-5 border-t border-line",children:footer})]})]})}function Drawer({open,title,description,onClose,footer,children,bodyClassName,closeLabel}){const ui=useUIText();const titleId=useId();useEffect(()=>{if(!open)return;function onKey(e){if(e.key==="Escape")onClose()}document.addEventListener("keydown",onKey);return()=>document.removeEventListener("keydown",onKey)},[open,onClose]);if(!open)return null;return jsxs("div",{className:"fixed inset-0 z-50 flex",role:"dialog","aria-modal":"true","aria-labelledby":titleId,children:[jsx("button",{type:"button","aria-label":closeLabel??ui.close,onClick:onClose,className:"flex-1 bg-black/45 backdrop-blur-[2px] cursor-default"}),jsxs("aside",{className:"w-full sm:w-[420px] bg-surface border-s border-line flex flex-col animate-qfade",children:[jsxs("header",{className:"shrink-0 h-16 px-4 border-b border-line flex items-center justify-between gap-3",children:[jsxs("span",{className:"flex flex-col gap-0.5 min-w-0",children:[jsx("span",{id:titleId,className:"text-lead font-extrabold truncate",children:title}),description&&jsx("span",{className:"text-caption text-muted truncate",children:description})]}),jsx("button",{type:"button",onClick:onClose,"aria-label":closeLabel??ui.close,className:"shrink-0 size-8 rounded-sm flex items-center justify-center text-muted hover:bg-hover hover:text-ink transition-colors cursor-pointer",children:jsx(X,{size:17,"aria-hidden":"true"})})]}),children&&jsx("div",{className:cn("flex-1 min-h-0 overflow-y-auto",bodyClassName??"p-4"),children}),footer&&jsx("footer",{className:"shrink-0 p-4 border-t border-line flex gap-2.5",children:footer})]})]})}var ALERT_ICON={neutral:Info,brand:Info,amber:AlertTriangle,green:CheckCircle2,red:XCircle,violet:Info};var ALERT_BORDER={neutral:"border-line",brand:"border-soft2",amber:"border-amber-line",green:"border-green-line",red:"border-red-line",violet:"border-violet-line"};function Alert({tone="brand",title,children,actions}){const Icon=ALERT_ICON[tone];const urgent=tone==="red"||tone==="amber";return jsxs("div",{role:urgent?"alert":"status",className:cn("flex items-start gap-3 p-4 rounded-card border",TONE_SOFT[tone],ALERT_BORDER[tone]),children:[jsx(Icon,{size:18,strokeWidth:2,"aria-hidden":"true"}),jsxs("div",{className:"flex flex-col gap-1.5 flex-1 min-w-0",children:[title&&jsx("span",{className:"text-body font-extrabold",children:title}),children&&jsx("span",{className:"text-ui leading-[1.7] opacity-90 [text-wrap:pretty]",children}),actions&&jsx("span",{className:"flex items-center gap-2 mt-1",children:actions})]})]})}function Toast({children,action,icon}){return jsxs("div",{role:"status","aria-live":"polite",className:"flex items-center gap-3 px-4 py-3.5 rounded-card bg-brand-900 shadow-toast animate-[fade-in_0.18s_ease-out]",children:[icon??jsx(CheckCircle2,{size:17,className:"text-brand-100 shrink-0","aria-hidden":"true"}),jsx("span",{className:"text-body font-bold text-white flex-1",children}),action]})}function EmptyState({icon:Icon,title,description,action}){return jsxs("div",{className:"flex flex-col items-center justify-center gap-2.5 py-12 px-5 text-center",children:[Icon&&jsx("span",{"aria-hidden":"true",className:"size-12 rounded-card bg-hover flex items-center justify-center text-muted mb-1",children:jsx(Icon,{size:21})}),jsx("span",{className:"text-lead font-extrabold text-ink",children:title}),description&&jsx("span",{className:"text-ui leading-[1.75] text-muted max-w-note [text-wrap:pretty]",children:description}),action&&jsx("span",{className:"mt-1",children:action})]})}export{TEXT_SCALE,RADIUS_SCALE,SHADOW_SCALE,CONTAINER_SCALE,ANIMATE_SCALE,COLOR_SCALE,TOKENS,DARK_TOKENS,cn,TONE_SOFT,TONE_SOLID,toLatinDigits,buttonClasses,LocaleCtx,useMoneyLocale,useMoneyLang,useUIText,Sheet,Modal,Drawer,Alert,Toast,EmptyState};
2
+ var TEXT_SCALE=["micro","caption","ui","body","lead","base","h4","h3","h2","h1","display","hero","title","mega"];var RADIUS_SCALE=["mark","xs","sm","field","card","lg","section","full"];var SHADOW_SCALE=["raise","tip","panel","pop","modal","toast","sheet"];var CONTAINER_SCALE=["page","shell","note","lead"];var ANIMATE_SCALE=["qfade","qslide","tip","tip-up","drawer","drawer-rtl","savebar","skeleton"];var COLOR_SCALE=["surface","bg","line","hover","ink","ink2","muted","muted2","border","soft","soft2","brand-100","brand-900","brand-ink","brand","brand-hover","brand-deep","skeleton","tint","tint2","mint","amber-900","amber","amber-bg","amber-ink","amber-line","amber-hover","green","green-bg","green-bg2","green-line","green-solid","violet","violet-bg","violet-line","violet-solid","red-100","red","red-bg","red-line","danger","danger-hover","night","hero-body","hero-meta","hero-dim","hero-text","code-bg","code-plain","code-key","code-tag","code-attr","code-str","code-num","code-note","code-dim","code-line","code-chip"];var TOKENS={"--font-sans":'"Alexandria", system-ui, sans-serif',"--color-surface":"#ffffff","--color-bg":"#f7f9f9","--color-line":"#edf1f1","--color-hover":"#f2f6f6","--color-ink":"#020809","--color-ink2":"#3d4545","--color-muted":"#5f6a6a","--color-muted2":"#687373","--color-border":"#7f8c8c","--color-soft":"#eaf2f3","--color-soft2":"#dceded","--color-brand-100":"#a5c9cc","--color-brand-900":"#0a2528","--color-brand-ink":"#0f4a4e","--color-brand":"#207982","--color-brand-hover":"#1a646c","--color-brand-deep":"#0b3b3e","--color-skeleton":"#d6dcdc","--color-tint":"#f4faf8","--color-tint2":"#eff6f3","--color-mint":"#7dd3c0","--color-amber-900":"#3d2a05","--color-amber":"#f8ac33","--color-amber-bg":"#fef6e9","--color-amber-ink":"#85570f","--color-amber-line":"#fbd79a","--color-amber-hover":"#de9219","--color-green":"#1e7a45","--color-green-bg":"#f1faf4","--color-green-bg2":"#e9f6ee","--color-green-line":"#bfe6ce","--color-green-solid":"#1e7a45","--color-violet":"#4b3e8e","--color-violet-bg":"#edeaf6","--color-violet-line":"#ded8ef","--color-violet-solid":"#6d5eb8","--color-red-100":"#f3a79e","--color-red":"#8e2b20","--color-red-bg":"#fdecea","--color-red-line":"#f3c9c4","--color-danger":"#c94134","--color-danger-hover":"#a3362b","--color-night":"#0b0f12","--color-hero-body":"#bfd9d8","--color-hero-meta":"#8fb3b2","--color-hero-dim":"#5e7a79","--color-hero-text":"#d7e3e2","--color-code-bg":"#1f1f1f","--color-code-plain":"#d4d4d4","--color-code-key":"#569cd6","--color-code-tag":"#4ec9b0","--color-code-attr":"#9cdcfe","--color-code-str":"#ce9178","--color-code-num":"#b5cea8","--color-code-note":"#6a9955","--color-code-dim":"#858585","--color-code-line":"#303031","--color-code-chip":"#f4f7f7","--text-micro":"11px","--text-caption":"12px","--text-ui":"13px","--text-body":"14px","--text-lead":"15px","--text-base":"16px","--text-base--line-height":"initial","--text-h4":"17px","--text-h3":"20px","--text-h2":"24px","--text-h1":"30px","--text-display":"36px","--text-hero":"44px","--text-title":"40px","--text-mega":"54px","--container-page":"1600px","--container-shell":"1600px","--container-note":"340px","--container-lead":"520px","--radius-mark":"3px","--radius-xs":"5px","--radius-sm":"7px","--radius-field":"9px","--radius-card":"12px","--radius-lg":"14px","--radius-section":"18px","--radius-full":"999px","--shadow-raise":"0 1px 3px var(--shadow-color)","--shadow-tip":"0 6px 18px var(--shadow-color)","--shadow-panel":"0 10px 30px var(--shadow-color)","--shadow-pop":"0 18px 44px var(--shadow-color)","--shadow-modal":"0 24px 60px rgb(2 8 9 / 0.28)","--shadow-toast":"0 16px 40px rgb(2 8 9 / 0.26)","--shadow-sheet":"0 -14px 40px rgb(2 8 9 / 0.28), inset 0 1px 0 rgb(255 255 255 / 0.06)","--shadow-color":"rgb(2 8 9 / 0.14)","--animate-qfade":"qfade 0.16s ease-out","--animate-qslide":"qslidein 0.22s ease-out","--animate-tip":"tip-in 0.26s cubic-bezier(0.2, 0.8, 0.2, 1)","--animate-tip-up":"tip-up 0.3s cubic-bezier(0.2, 0.9, 0.2, 1)","--animate-drawer":"drawer-ltr 0.32s cubic-bezier(0.2, 0.9, 0.2, 1)","--animate-drawer-rtl":"drawer-rtl 0.32s cubic-bezier(0.2, 0.9, 0.2, 1)","--animate-savebar":"savebar-in 0.2s cubic-bezier(0.2, 0.8, 0.2, 1)","--animate-skeleton":"skeleton-pulse 1.6s ease-in-out infinite","--num-align":"right","--num-align-far":"left","--num-pad-right":"0.875rem","--num-pad-left":"3.5rem","--num-icon-pad-right":"2.5rem","--num-icon-pad-left":"0.875rem"};var DARK_TOKENS={"--color-surface":"#101718","--color-bg":"#0a0f10","--color-line":"#1e2829","--color-hover":"#1a2425","--color-ink":"#f2f6f6","--color-ink2":"#c7d1d1","--color-muted":"#93a0a0","--color-muted2":"#7a8787","--color-border":"#5e6b6c","--color-soft":"#12363a","--color-soft2":"#17454a","--color-brand-ink":"#7dd3c0","--color-skeleton":"#2c3232","--color-amber":"#f8ac33","--color-amber-bg":"#2b2009","--color-amber-ink":"#f5c77a","--color-amber-line":"#5c4415","--color-green":"#6ecf9a","--color-green-bg":"#0d2119","--color-green-bg2":"#102a22","--color-green-line":"#245140","--color-violet":"#b9aeea","--color-violet-bg":"#1e1a33","--color-violet-line":"#38305c","--color-red":"#f3a79e","--color-red-bg":"#2c1613","--color-red-line":"#5c2a24","--color-code-chip":"#17201f","--shadow-color":"rgb(0 0 0 / 0.55)"};import{extendTailwindMerge}from"tailwind-merge";var twMerge=extendTailwindMerge({extend:{classGroups:{"font-size":[{text:TEXT_SCALE}],rounded:[{rounded:RADIUS_SCALE}],shadow:[{shadow:SHADOW_SCALE}],"max-w":[{"max-w":CONTAINER_SCALE}],animate:[{animate:ANIMATE_SCALE}]}}});function cn(...parts){return twMerge(parts.filter(p=>typeof p==="string"&&p.length>0).join(" "))}var TONE_SOFT={neutral:"bg-hover text-muted",brand:"bg-soft text-brand-ink",amber:"bg-amber-bg text-amber-ink",green:"bg-green-bg2 text-green",red:"bg-red-bg text-red",violet:"bg-violet-bg text-violet"};var TONE_SOLID={neutral:"bg-ink2 text-surface",brand:"bg-brand text-white",amber:"bg-amber text-amber-900",green:"bg-green-solid text-white",red:"bg-danger text-white",violet:"bg-violet-solid text-white"};function toLatinDigits(s){return s.replace(/[٠-٩۰-۹٫٬]/g,c=>{const code=c.charCodeAt(0);if(code===1643)return".";if(code===1644)return"";const base=code>=1776?1776:1632;return String(code-base)})}var VARIANTS={primary:"bg-brand border-brand text-white hover:bg-brand-hover",soft:"bg-soft border-soft2 text-brand-ink hover:bg-soft2",outline:"bg-surface border-border text-ink2 hover:border-brand hover:text-brand-ink",ghost:"bg-transparent border-transparent text-ink2 hover:bg-hover",danger:"bg-danger border-danger text-white hover:bg-danger-hover",link:"bg-transparent border-transparent text-brand-ink hover:underline underline-offset-4 px-0!"};var SIZES={sm:"h-9 px-3.5 gap-1.5 text-ui rounded-sm",md:"h-11 px-4 gap-2 text-body rounded-field",lg:"h-12 px-5 gap-2 text-lead rounded-card",xl:"h-14 px-5.5 gap-4 text-h3 font-extrabold rounded-field"};function buttonClasses(variant="primary",size="md",extra){return cn("inline-flex items-center justify-center border font-bold whitespace-nowrap","cursor-pointer transition-colors duration-150 select-none","focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-brand",SIZES[size],VARIANTS[variant],extra)}import{createContext,useCallback,useContext,useSyncExternalStore}from"react";var langStore={subscribe(cb){if(typeof MutationObserver==="undefined")return()=>{};const o=new MutationObserver(cb);o.observe(document.documentElement,{attributes:true,attributeFilter:["lang"]});return()=>o.disconnect()},get:()=>typeof document==="undefined"?"ar-EG":document.documentElement.lang||"ar-EG"};var LocaleCtx=createContext(null);function useMoneyLocale(){const fromProvider=useContext(LocaleCtx);const serverSnapshot=useCallback(()=>fromProvider??"ar-EG",[fromProvider]);return useSyncExternalStore(langStore.subscribe,langStore.get,serverSnapshot)}function useMoneyLang(){return useMoneyLocale().startsWith("en")}var AR=0;var EN=1;var TEXT={close:["\u0625\u063A\u0644\u0627\u0642","Close"],select:["\u0627\u062E\u062A\u0631\u2026","Select\u2026"],search:["\u0627\u0628\u062D\u062B\u2026","Search\u2026"],searchEverything:["\u0627\u0628\u062D\u062B \u0641\u064A \u0643\u0644 \u062D\u0627\u062C\u0629\u2026","Search everything\u2026"],noResults:["\u0645\u0627\u0641\u064A\u0634 \u0646\u062A\u0627\u064A\u062C","No results"],searchOrAdd:["\u0627\u0628\u062D\u062B \u0623\u0648 \u0623\u0636\u0641\u2026","Search or add\u2026"],now:["\u0627\u0644\u0622\u0646","Now"],videoPlayer:["\u0645\u0634\u063A\u0651\u0644 \u0627\u0644\u0641\u064A\u062F\u064A\u0648","Video player"],rating:["\u0627\u0644\u062A\u0642\u064A\u064A\u0645","Rating"],activeFilters:["\u0627\u0644\u0641\u0644\u0627\u062A\u0631 \u0627\u0644\u0645\u0637\u0628\u0651\u0642\u0629:","Active filters:"],clearAll:["\u0645\u0633\u062D \u0627\u0644\u0643\u0644","Clear all"],row:["\u0635\u0641\u0651","row"],dropImages:["\u0627\u0633\u062D\u0628 \u0627\u0644\u0635\u0648\u0631 \u0647\u0646\u0627","Drop images here"],chooseFromDevice:["\u0627\u062E\u062A\u0631 \u0645\u0646 \u0627\u0644\u062C\u0647\u0627\u0632","Choose from device"],previousPeriod:["\u0627\u0644\u0641\u062A\u0631\u0629 \u0627\u0644\u0633\u0627\u0628\u0642\u0629","Previous period"],less:["\u0623\u0642\u0644","Less"],more:["\u0623\u0643\u062B\u0631","More"],totalSales:["\u0625\u062C\u0645\u0627\u0644\u064A \u0627\u0644\u0645\u0628\u064A\u0639\u0627\u062A","Total sales"],netToYou:["\u0635\u0627\u0641\u064A \u0644\u0643","Net to you"],verifiedAccount:["\u062D\u0633\u0627\u0628 \u0645\u0648\u062B\u0651\u0642","Verified account"],grabHint:["\u0639\u0646\u0635\u0631 \u0642\u0627\u0628\u0644 \u0644\u0625\u0639\u0627\u062F\u0629 \u0627\u0644\u062A\u0631\u062A\u064A\u0628. \u0627\u0636\u063A\u0637 \u0645\u0633\u0627\u0641\u0629 \u0644\u0645\u0633\u0643\u0647 \u062B\u0645 \u0627\u0644\u0623\u0633\u0647\u0645 \u0644\u062A\u062D\u0631\u064A\u0643\u0647.","Reorderable item. Press space to grab it, then the arrows to move it."],notifications:["\u0627\u0644\u0625\u0634\u0639\u0627\u0631\u0627\u062A","Notifications"],dismiss:["\u0625\u062E\u0641\u0627\u0621","Dismiss"],unread:["\u063A\u064A\u0631 \u0645\u0642\u0631\u0648\u0621","Unread"],noNotifications:["\u0645\u0641\u064A\u0634 \u0625\u0634\u0639\u0627\u0631\u0627\u062A","No notifications"],noNotificationsDesc:["\u0623\u0648\u0644 \u0645\u0627 \u064A\u062D\u0635\u0644 \u062D\u0627\u062C\u0629 \u062A\u0633\u062A\u0627\u0647\u0644\u060C \u0647\u062A\u0644\u0627\u0642\u064A\u0647\u0627 \u0647\u0646\u0627.","When something worth knowing happens, it lands here."],markAllRead:["\u062A\u0639\u0644\u064A\u0645 \u0627\u0644\u0643\u0644 \u0643\u0645\u0642\u0631\u0648\u0621","Mark all as read"],viewAllNotifications:["\u0639\u0631\u0636 \u0643\u0644 \u0627\u0644\u0625\u0634\u0639\u0627\u0631\u0627\u062A","View all notifications"],newNotifications:["\u0625\u0634\u0639\u0627\u0631\u0627\u062A \u062C\u062F\u064A\u062F\u0629","New notifications"],reloadPreview:["\u0625\u0639\u0627\u062F\u0629 \u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u0645\u0639\u0627\u064A\u0646\u0629","Reload preview"],previousMonth:["\u0627\u0644\u0634\u0647\u0631 \u0627\u0644\u0644\u064A \u0642\u0628\u0644\u0647","Previous month"],nextMonth:["\u0627\u0644\u0634\u0647\u0631 \u0627\u0644\u0644\u064A \u0628\u0639\u062F\u0647","Next month"],whatIsThisNumber:["\u0645\u0627 \u0645\u0639\u0646\u0649 \u0647\u0630\u0627 \u0627\u0644\u0631\u0642\u0645\u061F","What does this number mean?"],explainToMe:["\u0627\u0634\u0631\u062D \u0644\u064A","Explain this"],clearSearch:["\u0645\u0633\u062D \u0627\u0644\u0628\u062D\u062B","Clear search"],alerts:["\u0627\u0644\u062A\u0646\u0628\u064A\u0647\u0627\u062A","Alerts"],whatIsThisOption:["\u0645\u0627 \u0647\u0630\u0627 \u0627\u0644\u062E\u064A\u0627\u0631\u061F","What is this option?"],shouldBeHere:["\u0627\u0644\u0645\u0641\u0631\u0648\u0636 \u062A\u0643\u0648\u0646 \u0647\u0646\u0627","Should be here"],closeExplainer:["\u0625\u063A\u0644\u0627\u0642 \u0627\u0644\u0634\u0631\u062D","Close explainer"],cancelRecording:["\u0625\u0644\u063A\u0627\u0621 \u0627\u0644\u062A\u0633\u062C\u064A\u0644","Cancel recording"],sendRecording:["\u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u062A\u0633\u062C\u064A\u0644","Send recording"],attachFile:["\u0625\u0631\u0641\u0627\u0642 \u0645\u0644\u0641","Attach file"],recordVoice:["\u062A\u0633\u062C\u064A\u0644 \u0635\u0648\u062A\u064A","Record a voice note"],playbackPosition:["\u0645\u0648\u0636\u0639 \u0627\u0644\u062A\u0634\u063A\u064A\u0644","Playback position"],volume:["\u0645\u0633\u062A\u0648\u0649 \u0627\u0644\u0635\u0648\u062A","Volume"],hideSuggestions:["\u0625\u062E\u0641\u0627\u0621 \u0627\u0644\u0627\u0642\u062A\u0631\u0627\u062D\u0627\u062A","Hide suggestions"],askShehab:["\u0627\u0633\u0623\u0644 \u0634\u0647\u0627\u0628\u2026","Ask Shehab\u2026"],shehabThinking:["\u0634\u0647\u0627\u0628 \u0628\u064A\u0641\u0643\u0651\u0631\u2026","Shehab is thinking\u2026"],undo:["\u062A\u0631\u0627\u062C\u0639","Undo"],from:["\u0645\u0646","from"],tryAnotherReply:["\u062C\u0631\u0651\u0628 \u0631\u062F \u062A\u0627\u0646\u064A","Try another reply"],helpfulReply:["\u0631\u062F \u0645\u0641\u064A\u062F","Helpful reply"],unhelpfulReply:["\u0631\u062F \u0645\u0634 \u0645\u0641\u064A\u062F","Unhelpful reply"],aiDisclaimer:["\u0634\u0647\u0627\u0628 \u0645\u0645\u0643\u0646 \u064A\u063A\u0644\u0637. \u0631\u0627\u062C\u0639 \u0627\u0644\u0623\u0631\u0642\u0627\u0645 \u0642\u0628\u0644 \u0645\u0627 \u062A\u062A\u0635\u0631\u0651\u0641 \u0639\u0644\u064A\u0647\u0627.","Shehab can get things wrong. Check the numbers before acting on them."],back10:["\u0631\u062C\u0648\u0639 \u0661\u0660 \u062B\u0648\u0627\u0646\u064A","Back 10 seconds"],forward10:["\u062A\u0642\u062F\u064A\u0645 \u0661\u0660 \u062B\u0648\u0627\u0646\u064A","Forward 10 seconds"],playbackSpeed:["\u0633\u0631\u0639\u0629 \u0627\u0644\u062A\u0634\u063A\u064A\u0644","Playback speed"],arabic:["\u0627\u0644\u0639\u0631\u0628\u064A\u0629","Arabic"],seeMore:["\u0634\u0648\u0641 \u0643\u0645\u0627\u0646","See more"],pictureInPicture:["\u0646\u0627\u0641\u0630\u0629 \u0639\u0627\u0626\u0645\u0629","Picture in picture"]};function useUIText(){return useMoneyLang()?BUNDLES[EN]:BUNDLES[AR]}function build(i){const out={};for(const key of Object.keys(TEXT))out[key]=TEXT[key][i];return out}var BUNDLES=[build(AR),build(EN)];import{useEffect,useId}from"react";import{AlertTriangle,CheckCircle2,Info,X,XCircle}from"lucide-react";import{jsx,jsxs}from"react/jsx-runtime";function Sheet({open,title,onClose,action,children,closeLabel}){const ui=useUIText();useEffect(()=>{if(!open)return;function onKey(e){if(e.key==="Escape")onClose()}document.addEventListener("keydown",onKey);return()=>document.removeEventListener("keydown",onKey)},[open,onClose]);if(!open)return null;return jsxs("div",{className:"fixed inset-0 z-50 flex flex-col justify-end",role:"dialog","aria-modal":"true","aria-label":title,children:[jsx("button",{type:"button","aria-label":closeLabel??ui.close,onClick:onClose,className:"flex-1 bg-black/50 backdrop-blur-[3px] cursor-default animate-[fade-in_0.2s_ease-out]"}),jsxs("div",{className:cn("bg-surface rounded-t-section max-h-[82dvh] flex flex-col overflow-clip shadow-sheet","animate-[sheet-up_0.26s_cubic-bezier(.22,.61,.36,1)]","pb-[env(safe-area-inset-bottom)]"),children:[jsx("button",{type:"button",onClick:onClose,"aria-label":closeLabel??ui.close,className:"shrink-0 pt-3 pb-1.5 flex justify-center cursor-grab active:cursor-grabbing",children:jsx("span",{"aria-hidden":"true",className:"h-1.5 w-11 rounded-full bg-border"})}),jsxs("div",{className:"shrink-0 flex items-center justify-between gap-3 px-5 pb-3",children:[jsx("span",{className:"text-h4 font-black tracking-tight",children:title}),jsxs("span",{className:"flex items-center gap-3",children:[action,jsx("button",{type:"button",onClick:onClose,"aria-label":closeLabel??ui.close,className:"size-9 rounded-full bg-bg flex items-center justify-center text-muted active:bg-hover active:scale-95 transition-transform cursor-pointer",children:jsx(X,{size:17,strokeWidth:2.4,"aria-hidden":"true"})})]})]}),jsx("div",{className:"flex-1 min-h-0 overflow-y-auto px-3 pb-4 flex flex-col overscroll-contain",children})]})]})}function Modal({open,title,description,onClose,footer,children,size="md",closeLabel}){const ui=useUIText();const titleId=useId();useEffect(()=>{if(!open)return;function onKey(e){if(e.key==="Escape")onClose()}document.addEventListener("keydown",onKey);return()=>document.removeEventListener("keydown",onKey)},[open,onClose]);if(!open)return null;const widths={sm:"max-w-md",md:"max-w-xl",lg:"max-w-3xl"};return jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",role:"dialog","aria-modal":"true","aria-labelledby":titleId,children:[jsx("button",{type:"button","aria-label":closeLabel??ui.close,onClick:onClose,className:"absolute inset-0 bg-black/45 backdrop-blur-[2px] cursor-default"}),jsxs("div",{className:cn("relative w-full bg-surface rounded-lg border border-line flex flex-col max-h-[85dvh] animate-qfade shadow-modal",widths[size]),children:[jsxs("header",{className:"shrink-0 flex items-start justify-between gap-4 p-5 border-b border-line",children:[jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[jsx("h2",{id:titleId,className:"text-h4 font-extrabold text-ink m-0",children:title}),description&&jsx("p",{className:"text-ui text-muted m-0",children:description})]}),jsx("button",{type:"button",onClick:onClose,"aria-label":closeLabel??ui.close,className:"shrink-0 size-8 rounded-sm flex items-center justify-center text-muted hover:bg-hover hover:text-ink transition-colors cursor-pointer",children:jsx(X,{size:17,"aria-hidden":"true"})})]}),children&&jsx("div",{className:"flex-1 min-h-0 overflow-y-auto p-5",children}),footer&&jsx("footer",{className:"shrink-0 flex items-center justify-end gap-2.5 p-5 border-t border-line",children:footer})]})]})}function Drawer({open,title,description,onClose,footer,children,bodyClassName,closeLabel}){const ui=useUIText();const titleId=useId();useEffect(()=>{if(!open)return;function onKey(e){if(e.key==="Escape")onClose()}document.addEventListener("keydown",onKey);return()=>document.removeEventListener("keydown",onKey)},[open,onClose]);if(!open)return null;return jsxs("div",{className:"fixed inset-0 z-50 flex",role:"dialog","aria-modal":"true","aria-labelledby":titleId,children:[jsx("button",{type:"button","aria-label":closeLabel??ui.close,onClick:onClose,className:"flex-1 bg-black/45 backdrop-blur-[2px] cursor-default"}),jsxs("aside",{className:"w-full sm:w-[420px] bg-surface border-s border-line flex flex-col animate-qfade",children:[jsxs("header",{className:"shrink-0 h-16 px-4 border-b border-line flex items-center justify-between gap-3",children:[jsxs("span",{className:"flex flex-col gap-0.5 min-w-0",children:[jsx("span",{id:titleId,className:"text-lead font-extrabold truncate",children:title}),description&&jsx("span",{className:"text-caption text-muted truncate",children:description})]}),jsx("button",{type:"button",onClick:onClose,"aria-label":closeLabel??ui.close,className:"shrink-0 size-8 rounded-sm flex items-center justify-center text-muted hover:bg-hover hover:text-ink transition-colors cursor-pointer",children:jsx(X,{size:17,"aria-hidden":"true"})})]}),children&&jsx("div",{className:cn("flex-1 min-h-0 overflow-y-auto",bodyClassName??"p-4"),children}),footer&&jsx("footer",{className:"shrink-0 p-4 border-t border-line flex gap-2.5",children:footer})]})]})}var ALERT_ICON={neutral:Info,brand:Info,amber:AlertTriangle,green:CheckCircle2,red:XCircle,violet:Info};var ALERT_BORDER={neutral:"border-line",brand:"border-soft2",amber:"border-amber-line",green:"border-green-line",red:"border-red-line",violet:"border-violet-line"};function Alert({tone="brand",title,children,actions}){const Icon=ALERT_ICON[tone];const urgent=tone==="red"||tone==="amber";return jsxs("div",{role:urgent?"alert":"status",className:cn("flex items-start gap-3 p-4 rounded-card border",TONE_SOFT[tone],ALERT_BORDER[tone]),children:[jsx(Icon,{size:18,strokeWidth:2,"aria-hidden":"true"}),jsxs("div",{className:"flex flex-col gap-1.5 flex-1 min-w-0",children:[title&&jsx("span",{className:"text-body font-extrabold",children:title}),children&&jsx("span",{className:"text-ui leading-[1.7] opacity-90 [text-wrap:pretty]",children}),actions&&jsx("span",{className:"flex items-center gap-2 mt-1",children:actions})]})]})}function Toast({children,action,icon}){return jsxs("div",{role:"status","aria-live":"polite",className:"flex items-center gap-3 px-4 py-3.5 rounded-card bg-brand-900 shadow-toast animate-[fade-in_0.18s_ease-out]",children:[icon??jsx(CheckCircle2,{size:17,className:"text-brand-100 shrink-0","aria-hidden":"true"}),jsx("span",{className:"text-body font-bold text-white flex-1",children}),action]})}function EmptyState({icon:Icon,title,description,action}){return jsxs("div",{className:"flex flex-col items-center justify-center gap-2.5 py-12 px-5 text-center",children:[Icon&&jsx("span",{"aria-hidden":"true",className:"size-12 rounded-card bg-hover flex items-center justify-center text-muted mb-1",children:jsx(Icon,{size:21})}),jsx("span",{className:"text-lead font-extrabold text-ink",children:title}),description&&jsx("span",{className:"text-ui leading-[1.75] text-muted max-w-note [text-wrap:pretty]",children:description}),action&&jsx("span",{className:"mt-1",children:action})]})}export{TEXT_SCALE,RADIUS_SCALE,SHADOW_SCALE,CONTAINER_SCALE,ANIMATE_SCALE,COLOR_SCALE,TOKENS,DARK_TOKENS,cn,TONE_SOFT,TONE_SOLID,toLatinDigits,buttonClasses,LocaleCtx,useMoneyLocale,useMoneyLang,useUIText,Sheet,Modal,Drawer,Alert,Toast,EmptyState};
package/dist/editor.css CHANGED
@@ -125,7 +125,7 @@
125
125
  table-layout: fixed;
126
126
  width: 100%;
127
127
  margin: 1.25rem 0;
128
- overflow: hidden;
128
+ overflow: clip;
129
129
  }
130
130
 
131
131
  .qumra-tiptap th,
package/dist/editor.js CHANGED
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{Tooltip}from"./chunk-APE2XWSN.js";import{Button,Input}from"./chunk-L3NDN5GB.js";import{Modal,cn}from"./chunk-DDRJTIIP.js";import{useEffect as useEffect4,useMemo as useMemo2,useRef as useRef4}from"react";import{EditorProvider,useCurrentEditor as useCurrentEditor6}from"@tiptap/react";import StarterKit from"@tiptap/starter-kit";import{CharacterCount as CharacterCount2}from"@tiptap/extension-character-count";import{Color}from"@tiptap/extension-color";import Dropcursor from"@tiptap/extension-dropcursor";import{Highlight}from"@tiptap/extension-highlight";import Image from"@tiptap/extension-image";import Link3 from"@tiptap/extension-link";import ListItem from"@tiptap/extension-list-item";import{Placeholder}from"@tiptap/extension-placeholder";import{Table}from"@tiptap/extension-table";import{TableCell}from"@tiptap/extension-table-cell";import{TableHeader}from"@tiptap/extension-table-header";import{TableRow}from"@tiptap/extension-table-row";import TextAlign from"@tiptap/extension-text-align";import{TextStyle}from"@tiptap/extension-text-style";import Underline3 from"@tiptap/extension-underline";import ImageResize from"tiptap-extension-resize-image";import TextDirection from"tiptap-text-direction";import{useCallback,useId,useMemo,useRef}from"react";import{useCurrentEditor}from"@tiptap/react";import{BubbleMenu}from"@tiptap/react/menus";import{PluginKey}from"@tiptap/pm/state";import{Bold,Code,Highlighter,Italic,Link2,Strikethrough,Underline}from"lucide-react";import{jsx,jsxs}from"react/jsx-runtime";function BubbleButton({onClick,isActive,label,children}){return jsx("button",{type:"button",onClick,"aria-label":label,"aria-pressed":isActive,className:cn("size-7 rounded-xs inline-flex items-center justify-center cursor-pointer transition-colors",isActive?"bg-brand text-white":"text-ink2 hover:bg-hover hover:text-ink"),children})}function EditorBubbleMenu(){const{editor}=useCurrentEditor();const key=useId();const pluginKey=useMemo(()=>new PluginKey(`qumraBubble${key}`),[key]);const menuRef=useRef(null);const onShow=useCallback(()=>{const el=menuRef.current;if(el)el.style.opacity="0"},[]);const onUpdate=useCallback(()=>{const el=menuRef.current;if(el)el.style.opacity="1"},[]);const scrollTarget=useMemo(()=>{if(typeof window==="undefined")return void 0;const dom=editor?.view?.dom;let node=dom?.parentElement??null;while(node){const{overflowY}=getComputedStyle(node);if(overflowY==="auto"||overflowY==="scroll")return node;node=node.parentElement}return void 0},[editor]);if(!editor)return null;const e=editor;return jsx(BubbleMenu,{editor,pluginKey,ref:el=>{menuRef.current=el},options:{placement:"top",offset:8,...scrollTarget?{scrollTarget}:{},onShow,onUpdate},shouldShow:({editor:ed,from,to})=>{if(from===to)return false;if(ed.isActive("image")||ed.isActive("codeBlock"))return false;return true},children:jsxs("div",{className:"flex items-center gap-0.5 p-1 rounded-card border border-line bg-surface shadow-pop",children:[jsx(BubbleButton,{label:"\u0639\u0631\u064A\u0636",onClick:()=>e.chain().focus().toggleBold().run(),isActive:e.isActive("bold"),children:jsx(Bold,{size:14})}),jsx(BubbleButton,{label:"\u0645\u0627\u0626\u0644",onClick:()=>e.chain().focus().toggleItalic().run(),isActive:e.isActive("italic"),children:jsx(Italic,{size:14})}),jsx(BubbleButton,{label:"\u062A\u062D\u062A\u0647 \u062E\u0637",onClick:()=>e.chain().focus().toggleUnderline().run(),isActive:e.isActive("underline"),children:jsx(Underline,{size:14})}),jsx(BubbleButton,{label:"\u064A\u062A\u0634\u0637\u0628",onClick:()=>e.chain().focus().toggleStrike().run(),isActive:e.isActive("strike"),children:jsx(Strikethrough,{size:14})}),jsx("span",{"aria-hidden":"true",className:"w-px h-5 bg-line mx-0.5"}),jsx(BubbleButton,{label:"\u0643\u0648\u062F",onClick:()=>e.chain().focus().toggleCode().run(),isActive:e.isActive("code"),children:jsx(Code,{size:14})}),jsx(BubbleButton,{label:"\u062A\u0638\u0644\u064A\u0644",onClick:()=>e.chain().focus().toggleHighlight().run(),isActive:e.isActive("highlight"),children:jsx(Highlighter,{size:14})}),jsx("span",{"aria-hidden":"true",className:"w-px h-5 bg-line mx-0.5"}),jsx(BubbleButton,{label:"\u0631\u0627\u0628\u0637",isActive:e.isActive("link"),onClick:()=>{const previous=e.getAttributes("link").href||"";const url=window.prompt("\u0631\u0627\u0628\u0637",previous);if(url===null)return;const chain=e.chain().focus().extendMarkRange("link");if(url==="")chain.unsetLink().run();else chain.setLink({href:/^https?:\/\//i.test(url)?url:`https://${url}`}).run()},children:jsx(Link2,{size:14})})]})})}import{useEffect as useEffect2,useRef as useRef3,useState as useState4}from"react";import{useCurrentEditor as useCurrentEditor5}from"@tiptap/react";import{useEffect,useRef as useRef2,useState}from"react";import{jsx as jsx2,jsxs as jsxs2}from"react/jsx-runtime";function useDismiss(open,close){const ref=useRef2(null);useEffect(()=>{if(!open)return;function onDown(e){if(ref.current&&!ref.current.contains(e.target))close()}function onKey(e){if(e.key==="Escape")close()}document.addEventListener("mousedown",onDown);document.addEventListener("keydown",onKey);return()=>{document.removeEventListener("mousedown",onDown);document.removeEventListener("keydown",onKey)}},[open,close]);return ref}var PANEL="absolute z-50 top-[calc(100%+6px)] start-0 bg-surface border border-line rounded-card shadow-panel overflow-hidden animate-[fade-in_.14s_ease-out]";function Popover({trigger,children,width,className}){const[open,setOpen]=useState(false);const ref=useDismiss(open,()=>setOpen(false));return jsxs2("div",{ref,className:cn("relative flex",className),children:[trigger({open,toggle:()=>setOpen(v=>!v)}),open&&jsx2("div",{className:cn(PANEL,width??"w-56"),children:children({close:()=>setOpen(false)})})]})}function MenuItem({onClick,icon,children,danger,active}){return jsxs2("button",{type:"button",onClick,className:cn("w-full px-3 py-2 flex items-center gap-2.5 text-start text-ui cursor-pointer transition-colors",danger?"text-red hover:bg-red-bg":"text-ink2 hover:bg-hover",active&&"bg-soft text-brand-ink font-bold"),children:[icon,jsx2("span",{className:"flex-1 min-w-0 truncate",children})]})}function MenuSeparator(){return jsx2("span",{"aria-hidden":"true",className:"block h-px bg-line my-1"})}function ToolbarButton({onClick,isActive,disabled,tooltip,shortcut,children}){return jsx2(Tooltip,{content:jsxs2("span",{className:"flex items-center gap-2",children:[tooltip,shortcut&&jsx2("kbd",{dir:"ltr",className:"px-1 py-px rounded-xs bg-white/15 text-micro font-mono",children:shortcut})]}),children:jsx2("button",{type:"button",onClick,disabled,"aria-label":tooltip,"aria-pressed":isActive,className:cn("size-8 rounded-sm inline-flex items-center justify-center shrink-0 cursor-pointer transition-colors","focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-brand","disabled:opacity-40 disabled:cursor-not-allowed",isActive?"bg-soft text-brand-ink":"text-muted hover:bg-hover hover:text-ink"),children})})}function ToolbarGroup({children}){return jsx2("div",{className:"flex items-center gap-0.5 pe-1 me-1 border-e border-line last:border-e-0 last:pe-0 last:me-0",children})}function ColorGrid({colors,current,onPick,onClear,clearLabel,fallback}){return jsxs2("div",{className:"p-3 flex flex-col gap-2.5",children:[jsx2("div",{className:"grid grid-cols-4 gap-1.5",children:colors.map(color=>jsx2("button",{type:"button",onClick:()=>onPick(color),"aria-label":color,style:{background:color},className:cn("size-8 rounded-sm border cursor-pointer transition-transform hover:scale-110",current.toLowerCase()===color.toLowerCase()?"border-ink ring-2 ring-brand":"border-line")},color))}),jsxs2("div",{className:"flex items-center gap-2.5 pt-2.5 border-t border-line",children:[jsx2("input",{type:"color",value:current||fallback,onChange:e=>onPick(e.target.value),"aria-label":"\u0644\u0648\u0646 \u0645\u062E\u0635\u0651\u0635",className:"size-8 p-0 border-none bg-transparent cursor-pointer"}),jsx2("button",{type:"button",onClick:onClear,className:"text-caption text-muted hover:text-ink cursor-pointer transition-colors",children:clearLabel})]})]})}import{useCurrentEditor as useCurrentEditor2}from"@tiptap/react";import{AlignCenter,AlignLeft,AlignRight,Bold as BoldIcon,Code as CodeIcon,Eraser,Italic as ItalicIcon,List,ListOrdered,Minus,Quote,Redo,Strikethrough as StrikeIcon,Underline as UnderlineIcon,Undo}from"lucide-react";import{Fragment,jsx as jsx3,jsxs as jsxs3}from"react/jsx-runtime";function Bold2(){const{editor}=useCurrentEditor2();if(!editor)return null;return jsx3(ToolbarButton,{onClick:()=>editor.chain().focus().toggleBold().run(),isActive:editor.isActive("bold"),tooltip:"\u0639\u0631\u064A\u0636",shortcut:"Ctrl+B",children:jsx3(BoldIcon,{size:16})})}function Italic2(){const{editor}=useCurrentEditor2();if(!editor)return null;return jsx3(ToolbarButton,{onClick:()=>editor.chain().focus().toggleItalic().run(),isActive:editor.isActive("italic"),tooltip:"\u0645\u0627\u0626\u0644",shortcut:"Ctrl+I",children:jsx3(ItalicIcon,{size:16})})}function Underline2(){const{editor}=useCurrentEditor2();if(!editor)return null;return jsx3(ToolbarButton,{onClick:()=>editor.chain().focus().toggleUnderline().run(),isActive:editor.isActive("underline"),tooltip:"\u062A\u062D\u062A\u0647 \u062E\u0637",shortcut:"Ctrl+U",children:jsx3(UnderlineIcon,{size:16})})}function Strikethrough2(){const{editor}=useCurrentEditor2();if(!editor)return null;return jsx3(ToolbarButton,{onClick:()=>editor.chain().focus().toggleStrike().run(),isActive:editor.isActive("strike"),tooltip:"\u064A\u062A\u0634\u0637\u0628",shortcut:"Ctrl+Shift+S",children:jsx3(StrikeIcon,{size:16})})}function Code2(){const{editor}=useCurrentEditor2();if(!editor)return null;return jsx3(ToolbarButton,{onClick:()=>editor.chain().focus().toggleCode().run(),isActive:editor.isActive("code"),tooltip:"\u0643\u0648\u062F",shortcut:"Ctrl+E",children:jsx3(CodeIcon,{size:16})})}function BulletList(){const{editor}=useCurrentEditor2();if(!editor)return null;return jsx3(ToolbarButton,{onClick:()=>editor.chain().focus().toggleBulletList().run(),isActive:editor.isActive("bulletList"),tooltip:"\u0642\u0627\u0626\u0645\u0629 \u0646\u0642\u0637\u064A\u0629",shortcut:"Ctrl+Shift+8",children:jsx3(List,{size:16})})}function OrderedList(){const{editor}=useCurrentEditor2();if(!editor)return null;return jsx3(ToolbarButton,{onClick:()=>editor.chain().focus().toggleOrderedList().run(),isActive:editor.isActive("orderedList"),tooltip:"\u0642\u0627\u0626\u0645\u0629 \u0645\u0631\u0642\u0651\u0645\u0629",shortcut:"Ctrl+Shift+7",children:jsx3(ListOrdered,{size:16})})}function BlockQuote(){const{editor}=useCurrentEditor2();if(!editor)return null;return jsx3(ToolbarButton,{onClick:()=>editor.chain().focus().toggleBlockquote().run(),isActive:editor.isActive("blockquote"),tooltip:"\u0627\u0642\u062A\u0628\u0627\u0633",shortcut:"Ctrl+Shift+B",children:jsx3(Quote,{size:16})})}function HorizontalRule(){const{editor}=useCurrentEditor2();if(!editor)return null;return jsx3(ToolbarButton,{onClick:()=>editor.chain().focus().setHorizontalRule().run(),tooltip:"\u0641\u0627\u0635\u0644 \u0623\u0641\u0642\u064A",children:jsx3(Minus,{size:16})})}function ClearMarks(){const{editor}=useCurrentEditor2();if(!editor)return null;return jsx3(ToolbarButton,{onClick:()=>editor.chain().focus().unsetAllMarks().run(),tooltip:"\u0645\u0633\u062D \u0627\u0644\u062A\u0646\u0633\u064A\u0642",children:jsx3(Eraser,{size:16})})}function UndoRedo(){const{editor}=useCurrentEditor2();if(!editor)return null;return jsxs3(Fragment,{children:[jsx3(ToolbarButton,{onClick:()=>editor.chain().focus().undo().run(),disabled:!editor.can().chain().focus().undo().run(),tooltip:"\u062A\u0631\u0627\u062C\u0639",shortcut:"Ctrl+Z",children:jsx3(Undo,{size:16})}),jsx3(ToolbarButton,{onClick:()=>editor.chain().focus().redo().run(),disabled:!editor.can().chain().focus().redo().run(),tooltip:"\u0625\u0639\u0627\u062F\u0629",shortcut:"Ctrl+Y",children:jsx3(Redo,{size:16})})]})}function Alignment(){const{editor}=useCurrentEditor2();if(!editor)return null;const items=[{key:"right",tooltip:"\u0645\u062D\u0627\u0630\u0627\u0629 \u064A\u0645\u064A\u0646",Icon:AlignRight},{key:"center",tooltip:"\u062A\u0648\u0633\u064A\u0637",Icon:AlignCenter},{key:"left",tooltip:"\u0645\u062D\u0627\u0630\u0627\u0629 \u0634\u0645\u0627\u0644",Icon:AlignLeft}];return jsx3(Fragment,{children:items.map(({key,tooltip,Icon})=>jsx3(ToolbarButton,{onClick:()=>editor.chain().focus().setTextAlign(key).run(),isActive:editor.isActive({textAlign:key}),disabled:!editor.can().chain().focus().setTextAlign(key).run(),tooltip,children:jsx3(Icon,{size:16})},key))})}function CharacterCount({maxChars}){const{editor}=useCurrentEditor2();if(!editor)return null;const chars=editor.storage.characterCount?.characters()??0;const words=editor.storage.characterCount?.words()??0;const over=maxChars?chars>maxChars:false;const near=maxChars?chars>maxChars*.9:false;return jsxs3("span",{className:cn("flex items-center gap-2 text-caption select-none",over?"text-red font-bold":near?"text-amber-ink font-bold":"text-muted2"),children:[jsxs3("span",{"data-num":true,children:[chars,maxChars?`/${maxChars}`:""," \u062D\u0631\u0641"]}),jsx3("span",{"aria-hidden":"true",className:"text-line",children:"|"}),jsxs3("span",{"data-num":true,children:[words," \u0643\u0644\u0645\u0629"]})]})}import{useState as useState2}from"react";import{useCurrentEditor as useCurrentEditor3}from"@tiptap/react";import{CalendarClock,ChevronDown,Columns,Highlighter as Highlighter2,Image as ImageIcon,Link2 as Link22,Merge,Palette,Plus,Rows,Split,Table as TableIcon,Trash2}from"lucide-react";import{Fragment as Fragment2,jsx as jsx4,jsxs as jsxs4}from"react/jsx-runtime";var HEADINGS=[{level:0,label:"\u0646\u0635 \u0639\u0627\u062F\u064A",size:"text-body"},{level:1,label:"\u0639\u0646\u0648\u0627\u0646 \u0661",size:"text-h2"},{level:2,label:"\u0639\u0646\u0648\u0627\u0646 \u0662",size:"text-h3"},{level:3,label:"\u0639\u0646\u0648\u0627\u0646 \u0663",size:"text-h4"},{level:4,label:"\u0639\u0646\u0648\u0627\u0646 \u0664",size:"text-lead"},{level:5,label:"\u0639\u0646\u0648\u0627\u0646 \u0665",size:"text-body"},{level:6,label:"\u0639\u0646\u0648\u0627\u0646 \u0666",size:"text-ui"}];function HeadingSelector(){const{editor}=useCurrentEditor3();if(!editor)return null;const current=HEADINGS.find(h=>h.level===0?editor.isActive("paragraph"):editor.isActive("heading",{level:h.level}))??HEADINGS[0];return jsx4(Popover,{width:"w-48",trigger:({open,toggle})=>jsxs4("button",{type:"button",onClick:toggle,"aria-haspopup":"menu","aria-expanded":open,className:cn("h-8 px-2.5 rounded-sm inline-flex items-center gap-1.5 text-ui font-bold cursor-pointer transition-colors","focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-brand",open?"bg-soft text-brand-ink":"text-ink2 hover:bg-hover"),children:[jsx4("span",{className:"truncate max-w-24",children:current.label}),jsx4(ChevronDown,{size:14,className:cn("shrink-0 transition-transform",open&&"rotate-180")})]}),children:({close})=>jsx4("div",{role:"menu",className:"py-1",children:HEADINGS.map(h=>{const active=h.level===0?editor.isActive("paragraph"):editor.isActive("heading",{level:h.level});return jsx4("button",{type:"button",role:"menuitem",onClick:()=>{if(h.level===0)editor.chain().focus().setParagraph().run();else editor.chain().focus().toggleHeading({level:h.level}).run();close()},className:cn("w-full px-3 py-2 flex items-center justify-between gap-3 text-start cursor-pointer transition-colors",active?"bg-soft text-brand-ink":"text-ink2 hover:bg-hover"),children:jsx4("span",{className:cn(h.size,active?"font-extrabold":"font-bold"),children:h.label})},h.level)})})})}function normalizeUrl(url){const t=url.trim();if(!t)return"";if(/^(https?:\/\/|mailto:|#)/i.test(t))return t;return`https://${t}`}function Link(){const{editor}=useCurrentEditor3();const[open,setOpen]=useState2(false);const[url,setUrl]=useState2("");if(!editor)return null;function apply(){const chain=editor.chain().focus().extendMarkRange("link");if(url.trim()==="")chain.unsetLink().run();else chain.setLink({href:normalizeUrl(url)}).run();setOpen(false)}return jsxs4(Fragment2,{children:[jsx4(ToolbarButton,{onClick:()=>{setUrl(editor.getAttributes("link").href||"");setOpen(true)},isActive:editor.isActive("link"),tooltip:"\u0631\u0627\u0628\u0637",shortcut:"Ctrl+K",children:jsx4(Link22,{size:16})}),jsx4(Modal,{open,onClose:()=>setOpen(false),title:"\u0625\u0636\u0627\u0641\u0629 \u0631\u0627\u0628\u0637",description:"\u0633\u064A\u0628\u0647 \u0641\u0627\u0636\u064A \u0648\u0627\u0645\u0633\u062D \u0639\u0634\u0627\u0646 \u062A\u0634\u064A\u0644 \u0627\u0644\u0631\u0627\u0628\u0637.",size:"sm",footer:jsxs4(Fragment2,{children:[jsx4(Button,{variant:"outline",onClick:()=>setOpen(false),children:"\u0625\u0644\u063A\u0627\u0621"}),jsx4(Button,{onClick:apply,children:url.trim()?"\u0623\u0636\u0641":"\u0634\u064A\u0644 \u0627\u0644\u0631\u0627\u0628\u0637"})]}),children:jsx4(Input,{label:"\u0627\u0644\u0639\u0646\u0648\u0627\u0646",dir:"ltr",placeholder:"example.com",value:url,onChange:e=>setUrl(e.target.value),onKeyDown:e=>e.key==="Enter"&&apply()})})]})}function ImageTool({onPick}){const{editor}=useCurrentEditor3();const[open,setOpen]=useState2(false);const[src,setSrc]=useState2("");if(!editor)return null;const insert=url=>editor.chain().focus().setImage({src:url}).run();return jsxs4(Fragment2,{children:[jsx4(ToolbarButton,{onClick:()=>onPick?onPick(insert):setOpen(true),isActive:editor.isActive("image"),tooltip:"\u0635\u0648\u0631\u0629",children:jsx4(ImageIcon,{size:16})}),!onPick&&jsx4(Modal,{open,onClose:()=>setOpen(false),title:"\u0625\u062F\u0631\u0627\u062C \u0635\u0648\u0631\u0629",size:"sm",footer:jsxs4(Fragment2,{children:[jsx4(Button,{variant:"outline",onClick:()=>setOpen(false),children:"\u0625\u0644\u063A\u0627\u0621"}),jsx4(Button,{disabled:!src.trim(),onClick:()=>{insert(src.trim());setSrc("");setOpen(false)},children:"\u0623\u062F\u0631\u062C"})]}),children:jsx4(Input,{label:"\u0631\u0627\u0628\u0637 \u0627\u0644\u0635\u0648\u0631\u0629",dir:"ltr",placeholder:"https://\u2026",value:src,onChange:e=>setSrc(e.target.value),hint:"\u0648\u062A\u0642\u062F\u0631 \u0643\u0645\u0627\u0646 \u062A\u0633\u062D\u0628 \u0635\u0648\u0631\u0629 \u0648\u062A\u0641\u0644\u062A\u0647\u0627 \u062C\u0648\u0651\u0647 \u0627\u0644\u0645\u062D\u0631\u0631 \u0645\u0628\u0627\u0634\u0631\u0629\u064B."})})]})}function TableTool(){const{editor}=useCurrentEditor3();if(!editor)return null;const inTable=editor.isActive("table");return jsx4(Popover,{width:"w-56",trigger:({open,toggle})=>jsx4(ToolbarButton,{onClick:toggle,isActive:inTable||open,tooltip:"\u062C\u062F\u0648\u0644",children:jsx4(TableIcon,{size:16})}),children:({close})=>{const run=fn=>()=>{fn();close()};return jsxs4("div",{role:"menu",className:"py-1",children:[jsx4(MenuItem,{icon:jsx4(Plus,{size:14}),onClick:run(()=>editor.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:true}).run()),children:"\u0623\u062F\u0631\u062C \u062C\u062F\u0648\u0644 \u0663\xD7\u0663"}),inTable&&jsxs4(Fragment2,{children:[jsx4(MenuSeparator,{}),jsx4(MenuItem,{icon:jsx4(Rows,{size:14}),onClick:run(()=>editor.chain().focus().addRowBefore().run()),children:"\u0635\u0641 \u0642\u0628\u0644"}),jsx4(MenuItem,{icon:jsx4(Rows,{size:14}),onClick:run(()=>editor.chain().focus().addRowAfter().run()),children:"\u0635\u0641 \u0628\u0639\u062F"}),jsx4(MenuItem,{danger:true,icon:jsx4(Trash2,{size:14}),onClick:run(()=>editor.chain().focus().deleteRow().run()),children:"\u0627\u062D\u0630\u0641 \u0627\u0644\u0635\u0641"}),jsx4(MenuSeparator,{}),jsx4(MenuItem,{icon:jsx4(Columns,{size:14}),onClick:run(()=>editor.chain().focus().addColumnBefore().run()),children:"\u0639\u0645\u0648\u062F \u0642\u0628\u0644"}),jsx4(MenuItem,{icon:jsx4(Columns,{size:14}),onClick:run(()=>editor.chain().focus().addColumnAfter().run()),children:"\u0639\u0645\u0648\u062F \u0628\u0639\u062F"}),jsx4(MenuItem,{danger:true,icon:jsx4(Trash2,{size:14}),onClick:run(()=>editor.chain().focus().deleteColumn().run()),children:"\u0627\u062D\u0630\u0641 \u0627\u0644\u0639\u0645\u0648\u062F"}),jsx4(MenuSeparator,{}),jsx4(MenuItem,{icon:jsx4(Merge,{size:14}),onClick:run(()=>editor.chain().focus().mergeCells().run()),children:"\u0627\u062F\u0645\u062C \u0627\u0644\u062E\u0644\u0627\u064A\u0627"}),jsx4(MenuItem,{icon:jsx4(Split,{size:14}),onClick:run(()=>editor.chain().focus().splitCell().run()),children:"\u0627\u0642\u0633\u0645 \u0627\u0644\u062E\u0644\u064A\u0629"}),jsx4(MenuSeparator,{}),jsx4(MenuItem,{danger:true,icon:jsx4(Trash2,{size:14}),onClick:run(()=>editor.chain().focus().deleteTable().run()),children:"\u0627\u062D\u0630\u0641 \u0627\u0644\u062C\u062F\u0648\u0644"})]})]})}})}var TEXT_COLORS=["#000000","#434343","#666666","#999999","#E03131","#C2255C","#9C36B5","#6741D9","#3B5BDB","#1971C2","#0C8599","#099268","#2F9E44","#66A80F","#F08C00","#E8590C"];var HIGHLIGHT_COLORS=["#FBBF24","#F87171","#FB923C","#A78BFA","#60A5FA","#34D399","#F472B6","#2DD4BF","#FCD34D","#FCA5A5","#FDBA74","#C4B5FD","#93C5FD","#6EE7B7","#F9A8D4","#99F6E4"];function ColorTool(){const{editor}=useCurrentEditor3();if(!editor)return null;const current=editor.getAttributes("textStyle").color||"";return jsx4(Popover,{trigger:({open,toggle})=>jsx4(ToolbarButton,{onClick:toggle,isActive:open,tooltip:"\u0644\u0648\u0646 \u0627\u0644\u0646\u0635",children:jsxs4("span",{className:"flex flex-col items-center gap-0.5",children:[jsx4(Palette,{size:16,style:current?{color:current}:void 0}),jsx4("span",{"aria-hidden":"true",className:"w-4 h-0.5 rounded-full",style:{background:current||"currentColor"}})]})}),children:({close})=>jsx4(ColorGrid,{colors:TEXT_COLORS,current,fallback:"#000000",clearLabel:"\u0634\u064A\u0644 \u0627\u0644\u0644\u0648\u0646",onPick:c=>{editor.chain().focus().setColor(c).run();close()},onClear:()=>{editor.chain().focus().unsetColor().run();close()}})})}function HighlightTool(){const{editor}=useCurrentEditor3();if(!editor)return null;const current=editor.getAttributes("highlight").color||"";return jsx4(Popover,{trigger:({open,toggle})=>jsx4(ToolbarButton,{onClick:toggle,isActive:editor.isActive("highlight")||open,tooltip:"\u062A\u0638\u0644\u064A\u0644",children:jsxs4("span",{className:"flex flex-col items-center gap-0.5",children:[jsx4(Highlighter2,{size:16}),jsx4("span",{"aria-hidden":"true",className:"w-4 h-0.5 rounded-full",style:{background:current||"transparent"}})]})}),children:({close})=>jsx4(ColorGrid,{colors:HIGHLIGHT_COLORS,current,fallback:"#FBBF24",clearLabel:"\u0634\u064A\u0644 \u0627\u0644\u062A\u0638\u0644\u064A\u0644",onPick:c=>{editor.chain().focus().toggleHighlight({color:c}).run();close()},onClear:()=>{editor.chain().focus().unsetHighlight().run();close()}})})}var DATE_FORMATS=[{label:"\u0663\u0661 \u064A\u0648\u0644\u064A\u0648 \u0662\u0660\u0662\u0666",opts:{day:"numeric",month:"long",year:"numeric"}},{label:"\u0663\u0661 \u064A\u0648\u0644 \u0662\u0660\u0662\u0666",opts:{day:"numeric",month:"short",year:"numeric"}},{label:"\u0627\u0644\u062C\u0645\u0639\u0629\u060C \u0663\u0661 \u064A\u0648\u0644\u064A\u0648",opts:{weekday:"long",day:"numeric",month:"long"}},{label:"\u0662\u0660\u0662\u0666/\u0660\u0667/\u0663\u0661",opts:{year:"numeric",month:"2-digit",day:"2-digit"}},{label:"\u0660\u0662:\u0665\u0661 \u0635",opts:{hour:"2-digit",minute:"2-digit"}},{label:"\u0660\u0662:\u0665\u0661:\u0663\u0660 \u0635",opts:{hour:"2-digit",minute:"2-digit",second:"2-digit"}}];function DateTime({locale="ar-EG"}){const{editor}=useCurrentEditor3();if(!editor)return null;return jsx4(Popover,{width:"w-56",trigger:({open,toggle})=>jsx4(ToolbarButton,{onClick:toggle,isActive:open,tooltip:"\u062A\u0627\u0631\u064A\u062E \u0648\u0648\u0642\u062A",children:jsx4(CalendarClock,{size:16})}),children:({close})=>jsx4("div",{role:"menu",className:"py-1",children:DATE_FORMATS.map(f=>{const text=new Intl.DateTimeFormat(locale,f.opts).format(new Date);return jsx4(MenuItem,{onClick:()=>{editor.chain().focus().insertContent(text).run();close()},children:text},f.label)})})})}import{useCallback as useCallback2,useState as useState3}from"react";import{useCurrentEditor as useCurrentEditor4}from"@tiptap/react";import{ChevronDown as ChevronDown2,ChevronUp,Replace,Search}from"lucide-react";import{Fragment as Fragment3,jsx as jsx5,jsxs as jsxs5}from"react/jsx-runtime";function FindReplace(){const{editor}=useCurrentEditor4();const[term,setTerm]=useState3("");const[replacement,setReplacement]=useState3("");const[matches,setMatches]=useState3([]);const[index,setIndex]=useState3(0);const jump=useCallback2(m=>editor?.chain().setTextSelection(m).scrollIntoView().run(),[editor]);const find=useCallback2(value=>{if(!editor||!value.trim()){setMatches([]);setIndex(0);return}const found=[];const needle=value.toLowerCase();editor.state.doc.descendants((node,pos)=>{if(!node.isText)return;const text=node.text?.toLowerCase()??"";let at=text.indexOf(needle);while(at!==-1){found.push({from:pos+at,to:pos+at+value.length});at=text.indexOf(needle,at+1)}});setMatches(found);setIndex(0);if(found[0])jump(found[0])},[editor,jump]);if(!editor)return null;const step=by=>{if(matches.length===0)return;const next=(index+by+matches.length)%matches.length;setIndex(next);jump(matches[next])};const replaceOne=()=>{const m=matches[index];if(!m)return;editor.chain().focus().setTextSelection(m).insertContent(replacement).run();find(term)};const replaceAll=()=>{if(matches.length===0)return;const chain=editor.chain().focus();for(const m of[...matches].sort((a,b)=>b.from-a.from)){chain.setTextSelection(m).insertContent(replacement)}chain.run();find(term)};return jsx5(Popover,{width:"w-72",trigger:({open,toggle})=>jsx5(ToolbarButton,{onClick:toggle,isActive:open,tooltip:"\u0628\u062D\u062B \u0648\u0627\u0633\u062A\u0628\u062F\u0627\u0644",shortcut:"Ctrl+H",children:jsx5(Search,{size:16})}),children:()=>jsxs5("div",{className:"p-3 flex flex-col gap-2.5",children:[jsxs5("div",{className:"flex items-end gap-1.5",children:[jsx5(Input,{autoFocus:true,size:"sm",label:"\u0627\u0628\u062D\u062B \u0639\u0646",hideLabel:true,placeholder:"\u0627\u0628\u062D\u062B \u0639\u0646\u2026",value:term,wrapperClassName:"flex-1 min-w-0",onChange:e=>{setTerm(e.target.value);find(e.target.value)},onKeyDown:e=>{if(e.key!=="Enter")return;e.preventDefault();step(e.shiftKey?-1:1)}}),jsx5(Button,{size:"sm",variant:"outline",iconOnly:true,"aria-label":"\u0627\u0644\u0633\u0627\u0628\u0642",disabled:matches.length===0,onClick:()=>step(-1),icon:jsx5(ChevronUp,{size:14})}),jsx5(Button,{size:"sm",variant:"outline",iconOnly:true,"aria-label":"\u0627\u0644\u062A\u0627\u0644\u064A",disabled:matches.length===0,onClick:()=>step(1),icon:jsx5(ChevronDown2,{size:14})})]}),term.trim()&&jsx5("span",{className:"text-micro text-muted2","aria-live":"polite",children:matches.length>0?jsxs5(Fragment3,{children:[jsx5("span",{"data-num":true,children:index+1})," \u0645\u0646 ",jsx5("span",{"data-num":true,children:matches.length})]}):"\u0645\u0627\u0641\u064A\u0634 \u0646\u062A\u0627\u064A\u062C"}),jsxs5("div",{className:"flex items-end gap-1.5",children:[jsx5(Input,{size:"sm",label:"\u0627\u0633\u062A\u0628\u062F\u0644 \u0628\u0640",hideLabel:true,placeholder:"\u0627\u0633\u062A\u0628\u062F\u0644 \u0628\u0640\u2026",value:replacement,wrapperClassName:"flex-1 min-w-0",onChange:e=>setReplacement(e.target.value),onKeyDown:e=>{if(e.key==="Enter"){e.preventDefault();replaceOne()}}}),jsx5(Button,{size:"sm",variant:"outline",iconOnly:true,"aria-label":"\u0627\u0633\u062A\u0628\u062F\u0644",disabled:matches.length===0,onClick:replaceOne,icon:jsx5(Replace,{size:14})})]}),jsx5(Button,{size:"sm",variant:"soft",block:true,disabled:matches.length===0,onClick:replaceAll,children:"\u0627\u0633\u062A\u0628\u062F\u0644 \u0627\u0644\u0643\u0644"})]})})}import{jsx as jsx6,jsxs as jsxs6}from"react/jsx-runtime";function useEditorTick(){const[,setTick]=useState4(0);const{editor}=useCurrentEditor5();const raf=useRef3(0);useEffect2(()=>{if(!editor)return;const bump=()=>{cancelAnimationFrame(raf.current);raf.current=requestAnimationFrame(()=>setTick(t=>t+1))};editor.on("selectionUpdate",bump);editor.on("transaction",bump);return()=>{cancelAnimationFrame(raf.current);editor.off("selectionUpdate",bump);editor.off("transaction",bump)}},[editor])}function Toolbar({basic,onPickImage,hideImage,locale}){useEditorTick();const{editor}=useCurrentEditor5();if(!editor)return null;if(basic){return jsxs6("div",{className:"w-full border-b border-line px-1.5 py-1 flex flex-wrap items-center gap-0.5",children:[jsx6(ToolbarGroup,{children:jsx6(UndoRedo,{})}),jsx6(ToolbarGroup,{children:jsx6(HeadingSelector,{})}),jsxs6(ToolbarGroup,{children:[jsx6(Bold2,{}),jsx6(Italic2,{}),jsx6(Underline2,{})]}),jsxs6(ToolbarGroup,{children:[jsx6(BulletList,{}),jsx6(OrderedList,{})]}),jsxs6(ToolbarGroup,{children:[jsx6(Link,{}),!hideImage&&jsx6(ImageTool,{onPick:onPickImage}),jsx6(ColorTool,{})]})]})}return jsxs6("div",{className:"w-full border-b border-line px-1.5 py-1.5 flex flex-wrap items-center gap-y-1",children:[jsx6(ToolbarGroup,{children:jsx6(UndoRedo,{})}),jsx6(ToolbarGroup,{children:jsx6(HeadingSelector,{})}),jsxs6(ToolbarGroup,{children:[jsx6(Bold2,{}),jsx6(Italic2,{}),jsx6(Underline2,{}),jsx6(Strikethrough2,{})]}),jsxs6(ToolbarGroup,{children:[jsx6(BulletList,{}),jsx6(OrderedList,{}),jsx6(BlockQuote,{})]}),jsx6(ToolbarGroup,{children:jsx6(Alignment,{})}),jsxs6(ToolbarGroup,{children:[jsx6(Link,{}),!hideImage&&jsx6(ImageTool,{onPick:onPickImage}),jsx6(TableTool,{}),jsx6(DateTime,{locale})]}),jsxs6(ToolbarGroup,{children:[jsx6(ColorTool,{}),jsx6(HighlightTool,{})]}),jsxs6(ToolbarGroup,{children:[jsx6(Code2,{}),jsx6(HorizontalRule,{}),jsx6(ClearMarks,{}),jsx6(FindReplace,{})]})]})}function EditorFooter({maxChars}){return jsx6("div",{className:"border-t border-line px-3 py-1.5 flex justify-end",children:jsx6(CharacterCount,{maxChars})})}import{forwardRef,useEffect as useEffect3,useImperativeHandle,useState as useState5}from"react";import{Extension}from"@tiptap/core";import{PluginKey as PluginKey2}from"@tiptap/pm/state";import{ReactRenderer}from"@tiptap/react";import Suggestion from"@tiptap/suggestion";import{jsx as jsx7,jsxs as jsxs7}from"react/jsx-runtime";var SLASH_ITEMS=[{title:"\u0639\u0646\u0648\u0627\u0646 \u0643\u0628\u064A\u0631",hint:"H1",icon:"H1",command:({editor,range})=>editor.chain().focus().deleteRange(range).setHeading({level:1}).run()},{title:"\u0639\u0646\u0648\u0627\u0646 \u0645\u062A\u0648\u0633\u0637",hint:"H2",icon:"H2",command:({editor,range})=>editor.chain().focus().deleteRange(range).setHeading({level:2}).run()},{title:"\u0639\u0646\u0648\u0627\u0646 \u0635\u063A\u064A\u0631",hint:"H3",icon:"H3",command:({editor,range})=>editor.chain().focus().deleteRange(range).setHeading({level:3}).run()},{title:"\u0642\u0627\u0626\u0645\u0629 \u0646\u0642\u0637\u064A\u0629",icon:"\u2022",command:({editor,range})=>editor.chain().focus().deleteRange(range).toggleBulletList().run()},{title:"\u0642\u0627\u0626\u0645\u0629 \u0645\u0631\u0642\u0651\u0645\u0629",icon:"\u0661.",command:({editor,range})=>editor.chain().focus().deleteRange(range).toggleOrderedList().run()},{title:"\u0627\u0642\u062A\u0628\u0627\u0633",icon:"\u275D",command:({editor,range})=>editor.chain().focus().deleteRange(range).toggleBlockquote().run()},{title:"\u0628\u0644\u0648\u0643 \u0643\u0648\u062F",icon:"</>",command:({editor,range})=>editor.chain().focus().deleteRange(range).toggleCodeBlock().run()},{title:"\u062C\u062F\u0648\u0644",hint:"\u0663\xD7\u0663",icon:"\u229E",command:({editor,range})=>editor.chain().focus().deleteRange(range).insertTable({rows:3,cols:3,withHeaderRow:true}).run()},{title:"\u0641\u0627\u0635\u0644 \u0623\u0641\u0642\u064A",icon:"\u2500",command:({editor,range})=>editor.chain().focus().deleteRange(range).setHorizontalRule().run()}];var SlashList=forwardRef(function SlashList2({items,command},ref){const[active,setActive]=useState5(0);useEffect3(()=>setActive(0),[items]);useImperativeHandle(ref,()=>({onKeyDown:({event})=>{if(event.key==="ArrowUp"){setActive(i=>i<=0?items.length-1:i-1);return true}if(event.key==="ArrowDown"){setActive(i=>i>=items.length-1?0:i+1);return true}if(event.key==="Enter"){const item=items[active];if(item)command(item);return true}return false}}));if(items.length===0)return null;return jsx7("div",{className:"w-64 max-h-72 overflow-y-auto rounded-card border border-line bg-surface shadow-pop py-1 animate-[fade-in_.12s_ease-out]",children:items.map((item,i)=>jsxs7("button",{type:"button",onMouseEnter:()=>setActive(i),onClick:()=>command(item),className:cn("w-full px-3 py-2 flex items-center gap-3 text-start cursor-pointer transition-colors",i===active?"bg-soft text-brand-ink":"text-ink2 hover:bg-hover"),children:[jsx7("span",{"aria-hidden":"true",className:"size-7 shrink-0 rounded-sm bg-bg border border-line flex items-center justify-center text-micro font-extrabold",children:item.icon}),jsx7("span",{className:"flex-1 min-w-0 text-ui font-bold truncate",children:item.title}),item.hint&&jsx7("span",{dir:"ltr",className:"text-micro text-muted2 shrink-0",children:item.hint})]},item.title))})});var SlashCommandsPluginKey=new PluginKey2("qumraSlashCommands");var SlashCommands=Extension.create({name:"qumraSlashCommands",addOptions(){return{suggestion:{char:"/",pluginKey:SlashCommandsPluginKey,command:({editor,range,props})=>{props.command({editor,range})}}}},addProseMirrorPlugins(){return[Suggestion({editor:this.editor,...this.options.suggestion})]}});function place(el,rect){const rtl=getComputedStyle(document.documentElement).direction==="rtl";const gap=6;const{offsetHeight:h,offsetWidth:w}=el;const below=window.innerHeight-rect.bottom;const top=below<h+gap&&rect.top>h+gap?rect.top-h-gap:rect.bottom+gap;let left=rtl?rect.right-w:rect.left;left=Math.max(8,Math.min(left,window.innerWidth-w-8));el.style.top=`${top+window.scrollY}px`;el.style.left=`${left+window.scrollX}px`}function createSlashSuggestion(){return{items:({query})=>!query?SLASH_ITEMS:SLASH_ITEMS.filter(i=>i.title.includes(query)||i.icon.toLowerCase().includes(query.toLowerCase())),render:()=>{let component=null;let host=null;const reposition=clientRect=>{const rect=clientRect?.();if(host&&rect)place(host,rect)};return{onStart:props=>{component=new ReactRenderer(SlashList,{props,editor:props.editor});host=document.createElement("div");host.style.position="absolute";host.style.zIndex="60";host.appendChild(component.element);document.body.appendChild(host);reposition(props.clientRect)},onUpdate:props=>{component?.updateProps(props);reposition(props.clientRect)},onKeyDown:props=>{if(props.event.key==="Escape"){host?.remove();return true}const api=component?.ref;return api?.onKeyDown?.(props)??false},onExit:()=>{host?.remove();component?.destroy();host=null;component=null}}}}}import{jsx as jsx8,jsxs as jsxs8}from"react/jsx-runtime";function Editor({content,onChange,placeholder,maxChars,basic,disabled,onPickImage,hideImage,locale="ar-EG",className}){const extensions=useMemo2(()=>[StarterKit.configure({bulletList:{keepMarks:true,keepAttributes:false},orderedList:{keepMarks:true,keepAttributes:false}}),TextDirection.configure({types:["heading","paragraph"],defaultDirection:"rtl"}),TextAlign.configure({types:["heading","paragraph"]}),TextStyle,Color.configure({types:[TextStyle.name,ListItem.name]}),Underline3,Highlight.configure({multicolor:true}),Link3.configure({openOnClick:false,autolink:true,defaultProtocol:"https"}),Image.configure({inline:true}),ImageResize.configure(),Table.configure({resizable:true}),TableRow,TableHeader,TableCell,Placeholder.configure({placeholder:placeholder??""}),CharacterCount2.configure(maxChars?{limit:maxChars}:{}),Dropcursor.configure({color:"var(--color-brand)",width:2}),SlashCommands.configure({suggestion:createSlashSuggestion()})],[placeholder,maxChars]);const lastEmitted=useRef4("");const handleUpdate=({editor})=>{const html=editor.getHTML();if(html===lastEmitted.current)return;lastEmitted.current=html;onChange(html)};return jsx8("div",{className:cn("relative","bg-surface border border-border rounded-field","focus-within:border-brand transition-colors","[&>*:first-child]:rounded-t-field",disabled&&"opacity-60 pointer-events-none",className),children:jsxs8(EditorProvider,{immediatelyRender:false,extensions,content:content||"",onUpdate:handleUpdate,slotBefore:!disabled&&jsx8(Toolbar,{basic,onPickImage,hideImage,locale}),slotAfter:!disabled&&jsx8(EditorFooter,{maxChars}),editorProps:{attributes:{class:"qumra-tiptap",dir:"auto"},handleDrop:(view,event,_slice,moved)=>{if(moved||!event.dataTransfer?.files?.length)return false;const file=event.dataTransfer.files[0];if(!file?.type.startsWith("image/"))return false;const reader=new FileReader;reader.onload=()=>{const at=view.posAtCoords({left:event.clientX,top:event.clientY});if(!at)return;const node=view.state.schema.nodes.image.create({src:reader.result});view.dispatch(view.state.tr.insert(at.pos,node))};reader.readAsDataURL(file);return true},handlePaste:(view,event)=>{const items=event.clipboardData?.items;if(!items)return false;for(const item of Array.from(items)){if(!item.type.startsWith("image/"))continue;const file=item.getAsFile();if(!file)continue;const reader=new FileReader;reader.onload=()=>{const node=view.state.schema.nodes.image.create({src:reader.result});view.dispatch(view.state.tr.insert(view.state.selection.from,node))};reader.readAsDataURL(file);return true}return false}},children:[jsx8(EditorBubbleMenu,{}),jsx8(SyncContent,{content,disabled,lastEmitted})]})})}function SyncContent({content,disabled,lastEmitted}){const{editor}=useCurrentEditor6();useEffect4(()=>{if(!editor)return;const incoming=content||"";if(incoming!==editor.getHTML()){editor.commands.setContent(incoming,{emitUpdate:false});lastEmitted.current=editor.getHTML()}editor.setEditable(!disabled)},[content,disabled,editor,lastEmitted]);return null}export{Editor};
2
+ import{Tooltip}from"./chunk-ENHEJXVH.js";import{Button,Input}from"./chunk-VAMRF7HE.js";import{Modal,cn}from"./chunk-ZE4S6DBP.js";import{useEffect as useEffect4,useMemo as useMemo2,useRef as useRef4}from"react";import{EditorProvider,useCurrentEditor as useCurrentEditor6}from"@tiptap/react";import StarterKit from"@tiptap/starter-kit";import{CharacterCount as CharacterCount2}from"@tiptap/extension-character-count";import{Color}from"@tiptap/extension-color";import Dropcursor from"@tiptap/extension-dropcursor";import{Highlight}from"@tiptap/extension-highlight";import Image from"@tiptap/extension-image";import Link3 from"@tiptap/extension-link";import ListItem from"@tiptap/extension-list-item";import{Placeholder}from"@tiptap/extension-placeholder";import{Table}from"@tiptap/extension-table";import{TableCell}from"@tiptap/extension-table-cell";import{TableHeader}from"@tiptap/extension-table-header";import{TableRow}from"@tiptap/extension-table-row";import TextAlign from"@tiptap/extension-text-align";import{TextStyle}from"@tiptap/extension-text-style";import Underline3 from"@tiptap/extension-underline";import ImageResize from"tiptap-extension-resize-image";import TextDirection from"tiptap-text-direction";import{useCallback,useId,useMemo,useRef}from"react";import{useCurrentEditor}from"@tiptap/react";import{BubbleMenu}from"@tiptap/react/menus";import{PluginKey}from"@tiptap/pm/state";import{Bold,Code,Highlighter,Italic,Link2,Strikethrough,Underline}from"lucide-react";import{jsx,jsxs}from"react/jsx-runtime";function BubbleButton({onClick,isActive,label,children}){return jsx("button",{type:"button",onClick,"aria-label":label,"aria-pressed":isActive,className:cn("size-7 rounded-xs inline-flex items-center justify-center cursor-pointer transition-colors",isActive?"bg-brand text-white":"text-ink2 hover:bg-hover hover:text-ink"),children})}function EditorBubbleMenu(){const{editor}=useCurrentEditor();const key=useId();const pluginKey=useMemo(()=>new PluginKey(`qumraBubble${key}`),[key]);const menuRef=useRef(null);const onShow=useCallback(()=>{const el=menuRef.current;if(el)el.style.opacity="0"},[]);const onUpdate=useCallback(()=>{const el=menuRef.current;if(el)el.style.opacity="1"},[]);const scrollTarget=useMemo(()=>{if(typeof window==="undefined")return void 0;const dom=editor?.view?.dom;let node=dom?.parentElement??null;while(node){const{overflowY}=getComputedStyle(node);if(overflowY==="auto"||overflowY==="scroll")return node;node=node.parentElement}return void 0},[editor]);if(!editor)return null;const e=editor;return jsx(BubbleMenu,{editor,pluginKey,ref:el=>{menuRef.current=el},options:{placement:"top",offset:8,...scrollTarget?{scrollTarget}:{},onShow,onUpdate},shouldShow:({editor:ed,from,to})=>{if(from===to)return false;if(ed.isActive("image")||ed.isActive("codeBlock"))return false;return true},children:jsxs("div",{className:"flex items-center gap-0.5 p-1 rounded-card border border-line bg-surface shadow-pop",children:[jsx(BubbleButton,{label:"\u0639\u0631\u064A\u0636",onClick:()=>e.chain().focus().toggleBold().run(),isActive:e.isActive("bold"),children:jsx(Bold,{size:14})}),jsx(BubbleButton,{label:"\u0645\u0627\u0626\u0644",onClick:()=>e.chain().focus().toggleItalic().run(),isActive:e.isActive("italic"),children:jsx(Italic,{size:14})}),jsx(BubbleButton,{label:"\u062A\u062D\u062A\u0647 \u062E\u0637",onClick:()=>e.chain().focus().toggleUnderline().run(),isActive:e.isActive("underline"),children:jsx(Underline,{size:14})}),jsx(BubbleButton,{label:"\u064A\u062A\u0634\u0637\u0628",onClick:()=>e.chain().focus().toggleStrike().run(),isActive:e.isActive("strike"),children:jsx(Strikethrough,{size:14})}),jsx("span",{"aria-hidden":"true",className:"w-px h-5 bg-line mx-0.5"}),jsx(BubbleButton,{label:"\u0643\u0648\u062F",onClick:()=>e.chain().focus().toggleCode().run(),isActive:e.isActive("code"),children:jsx(Code,{size:14})}),jsx(BubbleButton,{label:"\u062A\u0638\u0644\u064A\u0644",onClick:()=>e.chain().focus().toggleHighlight().run(),isActive:e.isActive("highlight"),children:jsx(Highlighter,{size:14})}),jsx("span",{"aria-hidden":"true",className:"w-px h-5 bg-line mx-0.5"}),jsx(BubbleButton,{label:"\u0631\u0627\u0628\u0637",isActive:e.isActive("link"),onClick:()=>{const previous=e.getAttributes("link").href||"";const url=window.prompt("\u0631\u0627\u0628\u0637",previous);if(url===null)return;const chain=e.chain().focus().extendMarkRange("link");if(url==="")chain.unsetLink().run();else chain.setLink({href:/^https?:\/\//i.test(url)?url:`https://${url}`}).run()},children:jsx(Link2,{size:14})})]})})}import{useEffect as useEffect2,useRef as useRef3,useState as useState4}from"react";import{useCurrentEditor as useCurrentEditor5}from"@tiptap/react";import{useEffect,useRef as useRef2,useState}from"react";import{jsx as jsx2,jsxs as jsxs2}from"react/jsx-runtime";function useDismiss(open,close){const ref=useRef2(null);useEffect(()=>{if(!open)return;function onDown(e){if(ref.current&&!ref.current.contains(e.target))close()}function onKey(e){if(e.key==="Escape")close()}document.addEventListener("mousedown",onDown);document.addEventListener("keydown",onKey);return()=>{document.removeEventListener("mousedown",onDown);document.removeEventListener("keydown",onKey)}},[open,close]);return ref}var PANEL="absolute z-50 top-[calc(100%+6px)] start-0 bg-surface border border-line rounded-card shadow-panel overflow-clip animate-[fade-in_.14s_ease-out]";function Popover({trigger,children,width,className}){const[open,setOpen]=useState(false);const ref=useDismiss(open,()=>setOpen(false));return jsxs2("div",{ref,className:cn("relative flex",className),children:[trigger({open,toggle:()=>setOpen(v=>!v)}),open&&jsx2("div",{className:cn(PANEL,width??"w-56"),children:children({close:()=>setOpen(false)})})]})}function MenuItem({onClick,icon,children,danger,active}){return jsxs2("button",{type:"button",onClick,className:cn("w-full px-3 py-2 flex items-center gap-2.5 text-start text-ui cursor-pointer transition-colors",danger?"text-red hover:bg-red-bg":"text-ink2 hover:bg-hover",active&&"bg-soft text-brand-ink font-bold"),children:[icon,jsx2("span",{className:"flex-1 min-w-0 truncate",children})]})}function MenuSeparator(){return jsx2("span",{"aria-hidden":"true",className:"block h-px bg-line my-1"})}function ToolbarButton({onClick,isActive,disabled,tooltip,shortcut,children}){return jsx2(Tooltip,{content:jsxs2("span",{className:"flex items-center gap-2",children:[tooltip,shortcut&&jsx2("kbd",{dir:"ltr",className:"px-1 py-px rounded-xs bg-white/15 text-micro font-mono",children:shortcut})]}),children:jsx2("button",{type:"button",onClick,disabled,"aria-label":tooltip,"aria-pressed":isActive,className:cn("size-8 rounded-sm inline-flex items-center justify-center shrink-0 cursor-pointer transition-colors","focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-brand","disabled:opacity-40 disabled:cursor-not-allowed",isActive?"bg-soft text-brand-ink":"text-muted hover:bg-hover hover:text-ink"),children})})}function ToolbarGroup({children}){return jsx2("div",{className:"flex items-center gap-0.5 pe-1 me-1 border-e border-line last:border-e-0 last:pe-0 last:me-0",children})}function ColorGrid({colors,current,onPick,onClear,clearLabel,fallback}){return jsxs2("div",{className:"p-3 flex flex-col gap-2.5",children:[jsx2("div",{className:"grid grid-cols-4 gap-1.5",children:colors.map(color=>jsx2("button",{type:"button",onClick:()=>onPick(color),"aria-label":color,style:{background:color},className:cn("size-8 rounded-sm border cursor-pointer transition-transform hover:scale-110",current.toLowerCase()===color.toLowerCase()?"border-ink ring-2 ring-brand":"border-line")},color))}),jsxs2("div",{className:"flex items-center gap-2.5 pt-2.5 border-t border-line",children:[jsx2("input",{type:"color",value:current||fallback,onChange:e=>onPick(e.target.value),"aria-label":"\u0644\u0648\u0646 \u0645\u062E\u0635\u0651\u0635",className:"size-8 p-0 border-none bg-transparent cursor-pointer"}),jsx2("button",{type:"button",onClick:onClear,className:"text-caption text-muted hover:text-ink cursor-pointer transition-colors",children:clearLabel})]})]})}import{useCurrentEditor as useCurrentEditor2}from"@tiptap/react";import{AlignCenter,AlignLeft,AlignRight,Bold as BoldIcon,Code as CodeIcon,Eraser,Italic as ItalicIcon,List,ListOrdered,Minus,Quote,Redo,Strikethrough as StrikeIcon,Underline as UnderlineIcon,Undo}from"lucide-react";import{Fragment,jsx as jsx3,jsxs as jsxs3}from"react/jsx-runtime";function Bold2(){const{editor}=useCurrentEditor2();if(!editor)return null;return jsx3(ToolbarButton,{onClick:()=>editor.chain().focus().toggleBold().run(),isActive:editor.isActive("bold"),tooltip:"\u0639\u0631\u064A\u0636",shortcut:"Ctrl+B",children:jsx3(BoldIcon,{size:16})})}function Italic2(){const{editor}=useCurrentEditor2();if(!editor)return null;return jsx3(ToolbarButton,{onClick:()=>editor.chain().focus().toggleItalic().run(),isActive:editor.isActive("italic"),tooltip:"\u0645\u0627\u0626\u0644",shortcut:"Ctrl+I",children:jsx3(ItalicIcon,{size:16})})}function Underline2(){const{editor}=useCurrentEditor2();if(!editor)return null;return jsx3(ToolbarButton,{onClick:()=>editor.chain().focus().toggleUnderline().run(),isActive:editor.isActive("underline"),tooltip:"\u062A\u062D\u062A\u0647 \u062E\u0637",shortcut:"Ctrl+U",children:jsx3(UnderlineIcon,{size:16})})}function Strikethrough2(){const{editor}=useCurrentEditor2();if(!editor)return null;return jsx3(ToolbarButton,{onClick:()=>editor.chain().focus().toggleStrike().run(),isActive:editor.isActive("strike"),tooltip:"\u064A\u062A\u0634\u0637\u0628",shortcut:"Ctrl+Shift+S",children:jsx3(StrikeIcon,{size:16})})}function Code2(){const{editor}=useCurrentEditor2();if(!editor)return null;return jsx3(ToolbarButton,{onClick:()=>editor.chain().focus().toggleCode().run(),isActive:editor.isActive("code"),tooltip:"\u0643\u0648\u062F",shortcut:"Ctrl+E",children:jsx3(CodeIcon,{size:16})})}function BulletList(){const{editor}=useCurrentEditor2();if(!editor)return null;return jsx3(ToolbarButton,{onClick:()=>editor.chain().focus().toggleBulletList().run(),isActive:editor.isActive("bulletList"),tooltip:"\u0642\u0627\u0626\u0645\u0629 \u0646\u0642\u0637\u064A\u0629",shortcut:"Ctrl+Shift+8",children:jsx3(List,{size:16})})}function OrderedList(){const{editor}=useCurrentEditor2();if(!editor)return null;return jsx3(ToolbarButton,{onClick:()=>editor.chain().focus().toggleOrderedList().run(),isActive:editor.isActive("orderedList"),tooltip:"\u0642\u0627\u0626\u0645\u0629 \u0645\u0631\u0642\u0651\u0645\u0629",shortcut:"Ctrl+Shift+7",children:jsx3(ListOrdered,{size:16})})}function BlockQuote(){const{editor}=useCurrentEditor2();if(!editor)return null;return jsx3(ToolbarButton,{onClick:()=>editor.chain().focus().toggleBlockquote().run(),isActive:editor.isActive("blockquote"),tooltip:"\u0627\u0642\u062A\u0628\u0627\u0633",shortcut:"Ctrl+Shift+B",children:jsx3(Quote,{size:16})})}function HorizontalRule(){const{editor}=useCurrentEditor2();if(!editor)return null;return jsx3(ToolbarButton,{onClick:()=>editor.chain().focus().setHorizontalRule().run(),tooltip:"\u0641\u0627\u0635\u0644 \u0623\u0641\u0642\u064A",children:jsx3(Minus,{size:16})})}function ClearMarks(){const{editor}=useCurrentEditor2();if(!editor)return null;return jsx3(ToolbarButton,{onClick:()=>editor.chain().focus().unsetAllMarks().run(),tooltip:"\u0645\u0633\u062D \u0627\u0644\u062A\u0646\u0633\u064A\u0642",children:jsx3(Eraser,{size:16})})}function UndoRedo(){const{editor}=useCurrentEditor2();if(!editor)return null;return jsxs3(Fragment,{children:[jsx3(ToolbarButton,{onClick:()=>editor.chain().focus().undo().run(),disabled:!editor.can().chain().focus().undo().run(),tooltip:"\u062A\u0631\u0627\u062C\u0639",shortcut:"Ctrl+Z",children:jsx3(Undo,{size:16})}),jsx3(ToolbarButton,{onClick:()=>editor.chain().focus().redo().run(),disabled:!editor.can().chain().focus().redo().run(),tooltip:"\u0625\u0639\u0627\u062F\u0629",shortcut:"Ctrl+Y",children:jsx3(Redo,{size:16})})]})}function Alignment(){const{editor}=useCurrentEditor2();if(!editor)return null;const items=[{key:"right",tooltip:"\u0645\u062D\u0627\u0630\u0627\u0629 \u064A\u0645\u064A\u0646",Icon:AlignRight},{key:"center",tooltip:"\u062A\u0648\u0633\u064A\u0637",Icon:AlignCenter},{key:"left",tooltip:"\u0645\u062D\u0627\u0630\u0627\u0629 \u0634\u0645\u0627\u0644",Icon:AlignLeft}];return jsx3(Fragment,{children:items.map(({key,tooltip,Icon})=>jsx3(ToolbarButton,{onClick:()=>editor.chain().focus().setTextAlign(key).run(),isActive:editor.isActive({textAlign:key}),disabled:!editor.can().chain().focus().setTextAlign(key).run(),tooltip,children:jsx3(Icon,{size:16})},key))})}function CharacterCount({maxChars}){const{editor}=useCurrentEditor2();if(!editor)return null;const chars=editor.storage.characterCount?.characters()??0;const words=editor.storage.characterCount?.words()??0;const over=maxChars?chars>maxChars:false;const near=maxChars?chars>maxChars*.9:false;return jsxs3("span",{className:cn("flex items-center gap-2 text-caption select-none",over?"text-red font-bold":near?"text-amber-ink font-bold":"text-muted2"),children:[jsxs3("span",{"data-num":true,children:[chars,maxChars?`/${maxChars}`:""," \u062D\u0631\u0641"]}),jsx3("span",{"aria-hidden":"true",className:"text-line",children:"|"}),jsxs3("span",{"data-num":true,children:[words," \u0643\u0644\u0645\u0629"]})]})}import{useState as useState2}from"react";import{useCurrentEditor as useCurrentEditor3}from"@tiptap/react";import{CalendarClock,ChevronDown,Columns,Highlighter as Highlighter2,Image as ImageIcon,Link2 as Link22,Merge,Palette,Plus,Rows,Split,Table as TableIcon,Trash2}from"lucide-react";import{Fragment as Fragment2,jsx as jsx4,jsxs as jsxs4}from"react/jsx-runtime";var HEADINGS=[{level:0,label:"\u0646\u0635 \u0639\u0627\u062F\u064A",size:"text-body"},{level:1,label:"\u0639\u0646\u0648\u0627\u0646 \u0661",size:"text-h2"},{level:2,label:"\u0639\u0646\u0648\u0627\u0646 \u0662",size:"text-h3"},{level:3,label:"\u0639\u0646\u0648\u0627\u0646 \u0663",size:"text-h4"},{level:4,label:"\u0639\u0646\u0648\u0627\u0646 \u0664",size:"text-lead"},{level:5,label:"\u0639\u0646\u0648\u0627\u0646 \u0665",size:"text-body"},{level:6,label:"\u0639\u0646\u0648\u0627\u0646 \u0666",size:"text-ui"}];function HeadingSelector(){const{editor}=useCurrentEditor3();if(!editor)return null;const current=HEADINGS.find(h=>h.level===0?editor.isActive("paragraph"):editor.isActive("heading",{level:h.level}))??HEADINGS[0];return jsx4(Popover,{width:"w-48",trigger:({open,toggle})=>jsxs4("button",{type:"button",onClick:toggle,"aria-haspopup":"menu","aria-expanded":open,className:cn("h-8 px-2.5 rounded-sm inline-flex items-center gap-1.5 text-ui font-bold cursor-pointer transition-colors","focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-brand",open?"bg-soft text-brand-ink":"text-ink2 hover:bg-hover"),children:[jsx4("span",{className:"truncate max-w-24",children:current.label}),jsx4(ChevronDown,{size:14,className:cn("shrink-0 transition-transform",open&&"rotate-180")})]}),children:({close})=>jsx4("div",{role:"menu",className:"py-1",children:HEADINGS.map(h=>{const active=h.level===0?editor.isActive("paragraph"):editor.isActive("heading",{level:h.level});return jsx4("button",{type:"button",role:"menuitem",onClick:()=>{if(h.level===0)editor.chain().focus().setParagraph().run();else editor.chain().focus().toggleHeading({level:h.level}).run();close()},className:cn("w-full px-3 py-2 flex items-center justify-between gap-3 text-start cursor-pointer transition-colors",active?"bg-soft text-brand-ink":"text-ink2 hover:bg-hover"),children:jsx4("span",{className:cn(h.size,active?"font-extrabold":"font-bold"),children:h.label})},h.level)})})})}function normalizeUrl(url){const t=url.trim();if(!t)return"";if(/^(https?:\/\/|mailto:|#)/i.test(t))return t;return`https://${t}`}function Link(){const{editor}=useCurrentEditor3();const[open,setOpen]=useState2(false);const[url,setUrl]=useState2("");if(!editor)return null;function apply(){const chain=editor.chain().focus().extendMarkRange("link");if(url.trim()==="")chain.unsetLink().run();else chain.setLink({href:normalizeUrl(url)}).run();setOpen(false)}return jsxs4(Fragment2,{children:[jsx4(ToolbarButton,{onClick:()=>{setUrl(editor.getAttributes("link").href||"");setOpen(true)},isActive:editor.isActive("link"),tooltip:"\u0631\u0627\u0628\u0637",shortcut:"Ctrl+K",children:jsx4(Link22,{size:16})}),jsx4(Modal,{open,onClose:()=>setOpen(false),title:"\u0625\u0636\u0627\u0641\u0629 \u0631\u0627\u0628\u0637",description:"\u0633\u064A\u0628\u0647 \u0641\u0627\u0636\u064A \u0648\u0627\u0645\u0633\u062D \u0639\u0634\u0627\u0646 \u062A\u0634\u064A\u0644 \u0627\u0644\u0631\u0627\u0628\u0637.",size:"sm",footer:jsxs4(Fragment2,{children:[jsx4(Button,{variant:"outline",onClick:()=>setOpen(false),children:"\u0625\u0644\u063A\u0627\u0621"}),jsx4(Button,{onClick:apply,children:url.trim()?"\u0623\u0636\u0641":"\u0634\u064A\u0644 \u0627\u0644\u0631\u0627\u0628\u0637"})]}),children:jsx4(Input,{label:"\u0627\u0644\u0639\u0646\u0648\u0627\u0646",dir:"ltr",placeholder:"example.com",value:url,onChange:e=>setUrl(e.target.value),onKeyDown:e=>e.key==="Enter"&&apply()})})]})}function ImageTool({onPick}){const{editor}=useCurrentEditor3();const[open,setOpen]=useState2(false);const[src,setSrc]=useState2("");if(!editor)return null;const insert=url=>editor.chain().focus().setImage({src:url}).run();return jsxs4(Fragment2,{children:[jsx4(ToolbarButton,{onClick:()=>onPick?onPick(insert):setOpen(true),isActive:editor.isActive("image"),tooltip:"\u0635\u0648\u0631\u0629",children:jsx4(ImageIcon,{size:16})}),!onPick&&jsx4(Modal,{open,onClose:()=>setOpen(false),title:"\u0625\u062F\u0631\u0627\u062C \u0635\u0648\u0631\u0629",size:"sm",footer:jsxs4(Fragment2,{children:[jsx4(Button,{variant:"outline",onClick:()=>setOpen(false),children:"\u0625\u0644\u063A\u0627\u0621"}),jsx4(Button,{disabled:!src.trim(),onClick:()=>{insert(src.trim());setSrc("");setOpen(false)},children:"\u0623\u062F\u0631\u062C"})]}),children:jsx4(Input,{label:"\u0631\u0627\u0628\u0637 \u0627\u0644\u0635\u0648\u0631\u0629",dir:"ltr",placeholder:"https://\u2026",value:src,onChange:e=>setSrc(e.target.value),hint:"\u0648\u062A\u0642\u062F\u0631 \u0643\u0645\u0627\u0646 \u062A\u0633\u062D\u0628 \u0635\u0648\u0631\u0629 \u0648\u062A\u0641\u0644\u062A\u0647\u0627 \u062C\u0648\u0651\u0647 \u0627\u0644\u0645\u062D\u0631\u0631 \u0645\u0628\u0627\u0634\u0631\u0629\u064B."})})]})}function TableTool(){const{editor}=useCurrentEditor3();if(!editor)return null;const inTable=editor.isActive("table");return jsx4(Popover,{width:"w-56",trigger:({open,toggle})=>jsx4(ToolbarButton,{onClick:toggle,isActive:inTable||open,tooltip:"\u062C\u062F\u0648\u0644",children:jsx4(TableIcon,{size:16})}),children:({close})=>{const run=fn=>()=>{fn();close()};return jsxs4("div",{role:"menu",className:"py-1",children:[jsx4(MenuItem,{icon:jsx4(Plus,{size:14}),onClick:run(()=>editor.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:true}).run()),children:"\u0623\u062F\u0631\u062C \u062C\u062F\u0648\u0644 \u0663\xD7\u0663"}),inTable&&jsxs4(Fragment2,{children:[jsx4(MenuSeparator,{}),jsx4(MenuItem,{icon:jsx4(Rows,{size:14}),onClick:run(()=>editor.chain().focus().addRowBefore().run()),children:"\u0635\u0641 \u0642\u0628\u0644"}),jsx4(MenuItem,{icon:jsx4(Rows,{size:14}),onClick:run(()=>editor.chain().focus().addRowAfter().run()),children:"\u0635\u0641 \u0628\u0639\u062F"}),jsx4(MenuItem,{danger:true,icon:jsx4(Trash2,{size:14}),onClick:run(()=>editor.chain().focus().deleteRow().run()),children:"\u0627\u062D\u0630\u0641 \u0627\u0644\u0635\u0641"}),jsx4(MenuSeparator,{}),jsx4(MenuItem,{icon:jsx4(Columns,{size:14}),onClick:run(()=>editor.chain().focus().addColumnBefore().run()),children:"\u0639\u0645\u0648\u062F \u0642\u0628\u0644"}),jsx4(MenuItem,{icon:jsx4(Columns,{size:14}),onClick:run(()=>editor.chain().focus().addColumnAfter().run()),children:"\u0639\u0645\u0648\u062F \u0628\u0639\u062F"}),jsx4(MenuItem,{danger:true,icon:jsx4(Trash2,{size:14}),onClick:run(()=>editor.chain().focus().deleteColumn().run()),children:"\u0627\u062D\u0630\u0641 \u0627\u0644\u0639\u0645\u0648\u062F"}),jsx4(MenuSeparator,{}),jsx4(MenuItem,{icon:jsx4(Merge,{size:14}),onClick:run(()=>editor.chain().focus().mergeCells().run()),children:"\u0627\u062F\u0645\u062C \u0627\u0644\u062E\u0644\u0627\u064A\u0627"}),jsx4(MenuItem,{icon:jsx4(Split,{size:14}),onClick:run(()=>editor.chain().focus().splitCell().run()),children:"\u0627\u0642\u0633\u0645 \u0627\u0644\u062E\u0644\u064A\u0629"}),jsx4(MenuSeparator,{}),jsx4(MenuItem,{danger:true,icon:jsx4(Trash2,{size:14}),onClick:run(()=>editor.chain().focus().deleteTable().run()),children:"\u0627\u062D\u0630\u0641 \u0627\u0644\u062C\u062F\u0648\u0644"})]})]})}})}var TEXT_COLORS=["#000000","#434343","#666666","#999999","#E03131","#C2255C","#9C36B5","#6741D9","#3B5BDB","#1971C2","#0C8599","#099268","#2F9E44","#66A80F","#F08C00","#E8590C"];var HIGHLIGHT_COLORS=["#FBBF24","#F87171","#FB923C","#A78BFA","#60A5FA","#34D399","#F472B6","#2DD4BF","#FCD34D","#FCA5A5","#FDBA74","#C4B5FD","#93C5FD","#6EE7B7","#F9A8D4","#99F6E4"];function ColorTool(){const{editor}=useCurrentEditor3();if(!editor)return null;const current=editor.getAttributes("textStyle").color||"";return jsx4(Popover,{trigger:({open,toggle})=>jsx4(ToolbarButton,{onClick:toggle,isActive:open,tooltip:"\u0644\u0648\u0646 \u0627\u0644\u0646\u0635",children:jsxs4("span",{className:"flex flex-col items-center gap-0.5",children:[jsx4(Palette,{size:16,style:current?{color:current}:void 0}),jsx4("span",{"aria-hidden":"true",className:"w-4 h-0.5 rounded-full",style:{background:current||"currentColor"}})]})}),children:({close})=>jsx4(ColorGrid,{colors:TEXT_COLORS,current,fallback:"#000000",clearLabel:"\u0634\u064A\u0644 \u0627\u0644\u0644\u0648\u0646",onPick:c=>{editor.chain().focus().setColor(c).run();close()},onClear:()=>{editor.chain().focus().unsetColor().run();close()}})})}function HighlightTool(){const{editor}=useCurrentEditor3();if(!editor)return null;const current=editor.getAttributes("highlight").color||"";return jsx4(Popover,{trigger:({open,toggle})=>jsx4(ToolbarButton,{onClick:toggle,isActive:editor.isActive("highlight")||open,tooltip:"\u062A\u0638\u0644\u064A\u0644",children:jsxs4("span",{className:"flex flex-col items-center gap-0.5",children:[jsx4(Highlighter2,{size:16}),jsx4("span",{"aria-hidden":"true",className:"w-4 h-0.5 rounded-full",style:{background:current||"transparent"}})]})}),children:({close})=>jsx4(ColorGrid,{colors:HIGHLIGHT_COLORS,current,fallback:"#FBBF24",clearLabel:"\u0634\u064A\u0644 \u0627\u0644\u062A\u0638\u0644\u064A\u0644",onPick:c=>{editor.chain().focus().toggleHighlight({color:c}).run();close()},onClear:()=>{editor.chain().focus().unsetHighlight().run();close()}})})}var DATE_FORMATS=[{label:"\u0663\u0661 \u064A\u0648\u0644\u064A\u0648 \u0662\u0660\u0662\u0666",opts:{day:"numeric",month:"long",year:"numeric"}},{label:"\u0663\u0661 \u064A\u0648\u0644 \u0662\u0660\u0662\u0666",opts:{day:"numeric",month:"short",year:"numeric"}},{label:"\u0627\u0644\u062C\u0645\u0639\u0629\u060C \u0663\u0661 \u064A\u0648\u0644\u064A\u0648",opts:{weekday:"long",day:"numeric",month:"long"}},{label:"\u0662\u0660\u0662\u0666/\u0660\u0667/\u0663\u0661",opts:{year:"numeric",month:"2-digit",day:"2-digit"}},{label:"\u0660\u0662:\u0665\u0661 \u0635",opts:{hour:"2-digit",minute:"2-digit"}},{label:"\u0660\u0662:\u0665\u0661:\u0663\u0660 \u0635",opts:{hour:"2-digit",minute:"2-digit",second:"2-digit"}}];function DateTime({locale="ar-EG"}){const{editor}=useCurrentEditor3();if(!editor)return null;return jsx4(Popover,{width:"w-56",trigger:({open,toggle})=>jsx4(ToolbarButton,{onClick:toggle,isActive:open,tooltip:"\u062A\u0627\u0631\u064A\u062E \u0648\u0648\u0642\u062A",children:jsx4(CalendarClock,{size:16})}),children:({close})=>jsx4("div",{role:"menu",className:"py-1",children:DATE_FORMATS.map(f=>{const text=new Intl.DateTimeFormat(locale,f.opts).format(new Date);return jsx4(MenuItem,{onClick:()=>{editor.chain().focus().insertContent(text).run();close()},children:text},f.label)})})})}import{useCallback as useCallback2,useState as useState3}from"react";import{useCurrentEditor as useCurrentEditor4}from"@tiptap/react";import{ChevronDown as ChevronDown2,ChevronUp,Replace,Search}from"lucide-react";import{Fragment as Fragment3,jsx as jsx5,jsxs as jsxs5}from"react/jsx-runtime";function FindReplace(){const{editor}=useCurrentEditor4();const[term,setTerm]=useState3("");const[replacement,setReplacement]=useState3("");const[matches,setMatches]=useState3([]);const[index,setIndex]=useState3(0);const jump=useCallback2(m=>editor?.chain().setTextSelection(m).scrollIntoView().run(),[editor]);const find=useCallback2(value=>{if(!editor||!value.trim()){setMatches([]);setIndex(0);return}const found=[];const needle=value.toLowerCase();editor.state.doc.descendants((node,pos)=>{if(!node.isText)return;const text=node.text?.toLowerCase()??"";let at=text.indexOf(needle);while(at!==-1){found.push({from:pos+at,to:pos+at+value.length});at=text.indexOf(needle,at+1)}});setMatches(found);setIndex(0);if(found[0])jump(found[0])},[editor,jump]);if(!editor)return null;const step=by=>{if(matches.length===0)return;const next=(index+by+matches.length)%matches.length;setIndex(next);jump(matches[next])};const replaceOne=()=>{const m=matches[index];if(!m)return;editor.chain().focus().setTextSelection(m).insertContent(replacement).run();find(term)};const replaceAll=()=>{if(matches.length===0)return;const chain=editor.chain().focus();for(const m of[...matches].sort((a,b)=>b.from-a.from)){chain.setTextSelection(m).insertContent(replacement)}chain.run();find(term)};return jsx5(Popover,{width:"w-72",trigger:({open,toggle})=>jsx5(ToolbarButton,{onClick:toggle,isActive:open,tooltip:"\u0628\u062D\u062B \u0648\u0627\u0633\u062A\u0628\u062F\u0627\u0644",shortcut:"Ctrl+H",children:jsx5(Search,{size:16})}),children:()=>jsxs5("div",{className:"p-3 flex flex-col gap-2.5",children:[jsxs5("div",{className:"flex items-end gap-1.5",children:[jsx5(Input,{autoFocus:true,size:"sm",label:"\u0627\u0628\u062D\u062B \u0639\u0646",hideLabel:true,placeholder:"\u0627\u0628\u062D\u062B \u0639\u0646\u2026",value:term,wrapperClassName:"flex-1 min-w-0",onChange:e=>{setTerm(e.target.value);find(e.target.value)},onKeyDown:e=>{if(e.key!=="Enter")return;e.preventDefault();step(e.shiftKey?-1:1)}}),jsx5(Button,{size:"sm",variant:"outline",iconOnly:true,"aria-label":"\u0627\u0644\u0633\u0627\u0628\u0642",disabled:matches.length===0,onClick:()=>step(-1),icon:jsx5(ChevronUp,{size:14})}),jsx5(Button,{size:"sm",variant:"outline",iconOnly:true,"aria-label":"\u0627\u0644\u062A\u0627\u0644\u064A",disabled:matches.length===0,onClick:()=>step(1),icon:jsx5(ChevronDown2,{size:14})})]}),term.trim()&&jsx5("span",{className:"text-micro text-muted2","aria-live":"polite",children:matches.length>0?jsxs5(Fragment3,{children:[jsx5("span",{"data-num":true,children:index+1})," \u0645\u0646 ",jsx5("span",{"data-num":true,children:matches.length})]}):"\u0645\u0627\u0641\u064A\u0634 \u0646\u062A\u0627\u064A\u062C"}),jsxs5("div",{className:"flex items-end gap-1.5",children:[jsx5(Input,{size:"sm",label:"\u0627\u0633\u062A\u0628\u062F\u0644 \u0628\u0640",hideLabel:true,placeholder:"\u0627\u0633\u062A\u0628\u062F\u0644 \u0628\u0640\u2026",value:replacement,wrapperClassName:"flex-1 min-w-0",onChange:e=>setReplacement(e.target.value),onKeyDown:e=>{if(e.key==="Enter"){e.preventDefault();replaceOne()}}}),jsx5(Button,{size:"sm",variant:"outline",iconOnly:true,"aria-label":"\u0627\u0633\u062A\u0628\u062F\u0644",disabled:matches.length===0,onClick:replaceOne,icon:jsx5(Replace,{size:14})})]}),jsx5(Button,{size:"sm",variant:"soft",block:true,disabled:matches.length===0,onClick:replaceAll,children:"\u0627\u0633\u062A\u0628\u062F\u0644 \u0627\u0644\u0643\u0644"})]})})}import{jsx as jsx6,jsxs as jsxs6}from"react/jsx-runtime";function useEditorTick(){const[,setTick]=useState4(0);const{editor}=useCurrentEditor5();const raf=useRef3(0);useEffect2(()=>{if(!editor)return;const bump=()=>{cancelAnimationFrame(raf.current);raf.current=requestAnimationFrame(()=>setTick(t=>t+1))};editor.on("selectionUpdate",bump);editor.on("transaction",bump);return()=>{cancelAnimationFrame(raf.current);editor.off("selectionUpdate",bump);editor.off("transaction",bump)}},[editor])}function Toolbar({basic,onPickImage,hideImage,locale}){useEditorTick();const{editor}=useCurrentEditor5();if(!editor)return null;if(basic){return jsxs6("div",{className:"w-full border-b border-line px-1.5 py-1 flex flex-wrap items-center gap-0.5",children:[jsx6(ToolbarGroup,{children:jsx6(UndoRedo,{})}),jsx6(ToolbarGroup,{children:jsx6(HeadingSelector,{})}),jsxs6(ToolbarGroup,{children:[jsx6(Bold2,{}),jsx6(Italic2,{}),jsx6(Underline2,{})]}),jsxs6(ToolbarGroup,{children:[jsx6(BulletList,{}),jsx6(OrderedList,{})]}),jsxs6(ToolbarGroup,{children:[jsx6(Link,{}),!hideImage&&jsx6(ImageTool,{onPick:onPickImage}),jsx6(ColorTool,{})]})]})}return jsxs6("div",{className:"w-full border-b border-line px-1.5 py-1.5 flex flex-wrap items-center gap-y-1",children:[jsx6(ToolbarGroup,{children:jsx6(UndoRedo,{})}),jsx6(ToolbarGroup,{children:jsx6(HeadingSelector,{})}),jsxs6(ToolbarGroup,{children:[jsx6(Bold2,{}),jsx6(Italic2,{}),jsx6(Underline2,{}),jsx6(Strikethrough2,{})]}),jsxs6(ToolbarGroup,{children:[jsx6(BulletList,{}),jsx6(OrderedList,{}),jsx6(BlockQuote,{})]}),jsx6(ToolbarGroup,{children:jsx6(Alignment,{})}),jsxs6(ToolbarGroup,{children:[jsx6(Link,{}),!hideImage&&jsx6(ImageTool,{onPick:onPickImage}),jsx6(TableTool,{}),jsx6(DateTime,{locale})]}),jsxs6(ToolbarGroup,{children:[jsx6(ColorTool,{}),jsx6(HighlightTool,{})]}),jsxs6(ToolbarGroup,{children:[jsx6(Code2,{}),jsx6(HorizontalRule,{}),jsx6(ClearMarks,{}),jsx6(FindReplace,{})]})]})}function EditorFooter({maxChars}){return jsx6("div",{className:"border-t border-line px-3 py-1.5 flex justify-end",children:jsx6(CharacterCount,{maxChars})})}import{forwardRef,useEffect as useEffect3,useImperativeHandle,useState as useState5}from"react";import{Extension}from"@tiptap/core";import{PluginKey as PluginKey2}from"@tiptap/pm/state";import{ReactRenderer}from"@tiptap/react";import Suggestion from"@tiptap/suggestion";import{jsx as jsx7,jsxs as jsxs7}from"react/jsx-runtime";var SLASH_ITEMS=[{title:"\u0639\u0646\u0648\u0627\u0646 \u0643\u0628\u064A\u0631",hint:"H1",icon:"H1",command:({editor,range})=>editor.chain().focus().deleteRange(range).setHeading({level:1}).run()},{title:"\u0639\u0646\u0648\u0627\u0646 \u0645\u062A\u0648\u0633\u0637",hint:"H2",icon:"H2",command:({editor,range})=>editor.chain().focus().deleteRange(range).setHeading({level:2}).run()},{title:"\u0639\u0646\u0648\u0627\u0646 \u0635\u063A\u064A\u0631",hint:"H3",icon:"H3",command:({editor,range})=>editor.chain().focus().deleteRange(range).setHeading({level:3}).run()},{title:"\u0642\u0627\u0626\u0645\u0629 \u0646\u0642\u0637\u064A\u0629",icon:"\u2022",command:({editor,range})=>editor.chain().focus().deleteRange(range).toggleBulletList().run()},{title:"\u0642\u0627\u0626\u0645\u0629 \u0645\u0631\u0642\u0651\u0645\u0629",icon:"\u0661.",command:({editor,range})=>editor.chain().focus().deleteRange(range).toggleOrderedList().run()},{title:"\u0627\u0642\u062A\u0628\u0627\u0633",icon:"\u275D",command:({editor,range})=>editor.chain().focus().deleteRange(range).toggleBlockquote().run()},{title:"\u0628\u0644\u0648\u0643 \u0643\u0648\u062F",icon:"</>",command:({editor,range})=>editor.chain().focus().deleteRange(range).toggleCodeBlock().run()},{title:"\u062C\u062F\u0648\u0644",hint:"\u0663\xD7\u0663",icon:"\u229E",command:({editor,range})=>editor.chain().focus().deleteRange(range).insertTable({rows:3,cols:3,withHeaderRow:true}).run()},{title:"\u0641\u0627\u0635\u0644 \u0623\u0641\u0642\u064A",icon:"\u2500",command:({editor,range})=>editor.chain().focus().deleteRange(range).setHorizontalRule().run()}];var SlashList=forwardRef(function SlashList2({items,command},ref){const[active,setActive]=useState5(0);useEffect3(()=>setActive(0),[items]);useImperativeHandle(ref,()=>({onKeyDown:({event})=>{if(event.key==="ArrowUp"){setActive(i=>i<=0?items.length-1:i-1);return true}if(event.key==="ArrowDown"){setActive(i=>i>=items.length-1?0:i+1);return true}if(event.key==="Enter"){const item=items[active];if(item)command(item);return true}return false}}));if(items.length===0)return null;return jsx7("div",{className:"w-64 max-h-72 overflow-y-auto rounded-card border border-line bg-surface shadow-pop py-1 animate-[fade-in_.12s_ease-out]",children:items.map((item,i)=>jsxs7("button",{type:"button",onMouseEnter:()=>setActive(i),onClick:()=>command(item),className:cn("w-full px-3 py-2 flex items-center gap-3 text-start cursor-pointer transition-colors",i===active?"bg-soft text-brand-ink":"text-ink2 hover:bg-hover"),children:[jsx7("span",{"aria-hidden":"true",className:"size-7 shrink-0 rounded-sm bg-bg border border-line flex items-center justify-center text-micro font-extrabold",children:item.icon}),jsx7("span",{className:"flex-1 min-w-0 text-ui font-bold truncate",children:item.title}),item.hint&&jsx7("span",{dir:"ltr",className:"text-micro text-muted2 shrink-0",children:item.hint})]},item.title))})});var SlashCommandsPluginKey=new PluginKey2("qumraSlashCommands");var SlashCommands=Extension.create({name:"qumraSlashCommands",addOptions(){return{suggestion:{char:"/",pluginKey:SlashCommandsPluginKey,command:({editor,range,props})=>{props.command({editor,range})}}}},addProseMirrorPlugins(){return[Suggestion({editor:this.editor,...this.options.suggestion})]}});function place(el,rect){const rtl=getComputedStyle(document.documentElement).direction==="rtl";const gap=6;const{offsetHeight:h,offsetWidth:w}=el;const below=window.innerHeight-rect.bottom;const top=below<h+gap&&rect.top>h+gap?rect.top-h-gap:rect.bottom+gap;let left=rtl?rect.right-w:rect.left;left=Math.max(8,Math.min(left,window.innerWidth-w-8));el.style.top=`${top+window.scrollY}px`;el.style.left=`${left+window.scrollX}px`}function createSlashSuggestion(){return{items:({query})=>!query?SLASH_ITEMS:SLASH_ITEMS.filter(i=>i.title.includes(query)||i.icon.toLowerCase().includes(query.toLowerCase())),render:()=>{let component=null;let host=null;const reposition=clientRect=>{const rect=clientRect?.();if(host&&rect)place(host,rect)};return{onStart:props=>{component=new ReactRenderer(SlashList,{props,editor:props.editor});host=document.createElement("div");host.style.position="absolute";host.style.zIndex="60";host.appendChild(component.element);document.body.appendChild(host);reposition(props.clientRect)},onUpdate:props=>{component?.updateProps(props);reposition(props.clientRect)},onKeyDown:props=>{if(props.event.key==="Escape"){host?.remove();return true}const api=component?.ref;return api?.onKeyDown?.(props)??false},onExit:()=>{host?.remove();component?.destroy();host=null;component=null}}}}}import{jsx as jsx8,jsxs as jsxs8}from"react/jsx-runtime";function Editor({content,onChange,placeholder,maxChars,basic,disabled,onPickImage,hideImage,locale="ar-EG",className}){const extensions=useMemo2(()=>[StarterKit.configure({bulletList:{keepMarks:true,keepAttributes:false},orderedList:{keepMarks:true,keepAttributes:false}}),TextDirection.configure({types:["heading","paragraph"],defaultDirection:"rtl"}),TextAlign.configure({types:["heading","paragraph"]}),TextStyle,Color.configure({types:[TextStyle.name,ListItem.name]}),Underline3,Highlight.configure({multicolor:true}),Link3.configure({openOnClick:false,autolink:true,defaultProtocol:"https"}),Image.configure({inline:true}),ImageResize.configure(),Table.configure({resizable:true}),TableRow,TableHeader,TableCell,Placeholder.configure({placeholder:placeholder??""}),CharacterCount2.configure(maxChars?{limit:maxChars}:{}),Dropcursor.configure({color:"var(--color-brand)",width:2}),SlashCommands.configure({suggestion:createSlashSuggestion()})],[placeholder,maxChars]);const lastEmitted=useRef4("");const handleUpdate=({editor})=>{const html=editor.getHTML();if(html===lastEmitted.current)return;lastEmitted.current=html;onChange(html)};return jsx8("div",{className:cn("relative","bg-surface border border-border rounded-field","focus-within:border-brand transition-colors","[&>*:first-child]:rounded-t-field",disabled&&"opacity-60 pointer-events-none",className),children:jsxs8(EditorProvider,{immediatelyRender:false,extensions,content:content||"",onUpdate:handleUpdate,slotBefore:!disabled&&jsx8(Toolbar,{basic,onPickImage,hideImage,locale}),slotAfter:!disabled&&jsx8(EditorFooter,{maxChars}),editorProps:{attributes:{class:"qumra-tiptap",dir:"auto"},handleDrop:(view,event,_slice,moved)=>{if(moved||!event.dataTransfer?.files?.length)return false;const file=event.dataTransfer.files[0];if(!file?.type.startsWith("image/"))return false;const reader=new FileReader;reader.onload=()=>{const at=view.posAtCoords({left:event.clientX,top:event.clientY});if(!at)return;const node=view.state.schema.nodes.image.create({src:reader.result});view.dispatch(view.state.tr.insert(at.pos,node))};reader.readAsDataURL(file);return true},handlePaste:(view,event)=>{const items=event.clipboardData?.items;if(!items)return false;for(const item of Array.from(items)){if(!item.type.startsWith("image/"))continue;const file=item.getAsFile();if(!file)continue;const reader=new FileReader;reader.onload=()=>{const node=view.state.schema.nodes.image.create({src:reader.result});view.dispatch(view.state.tr.insert(view.state.selection.from,node))};reader.readAsDataURL(file);return true}return false}},children:[jsx8(EditorBubbleMenu,{}),jsx8(SyncContent,{content,disabled,lastEmitted})]})})}function SyncContent({content,disabled,lastEmitted}){const{editor}=useCurrentEditor6();useEffect4(()=>{if(!editor)return;const incoming=content||"";if(incoming!==editor.getHTML()){editor.commands.setContent(incoming,{emitUpdate:false});lastEmitted.current=editor.getHTML()}editor.setEditable(!disabled)},[content,disabled,editor,lastEmitted]);return null}export{Editor};
package/dist/index.d.ts CHANGED
@@ -1130,6 +1130,44 @@ declare function ToastHost({ toasts, onDismiss, closeLabel, }: {
1130
1130
  * بيظهر على المرور **وعلى التركيز** — لو ظهر على المرور بس بيبقى مخفي
1131
1131
  * تماماً عن اللي بيتنقّل بالكيبورد. والمحتوى شرح إضافي مش معلومة
1132
1132
  * أساسية، لأن اللمس مالوش «مرور».
1133
+ *
1134
+ * ── ⚠️ وبيخرج من الحاوية لا بيتحبس فيها ────────────────────────────────
1135
+ * كان `absolute` جوّه المحفِّز. ومعناها إن أيّ حاوية فوقه عندها `overflow`
1136
+ * غير `visible` بتدّي واحدة من اتنين:
1137
+ *
1138
+ * · **قصّ** — التلميحة بتتقطع عند حدّ الحاوية.
1139
+ * · **زحزحة** — الحاوية بتحسب التلميحة فيضاً، فبتتمدّد أو تطلّع
1140
+ * مُمرِّراً والمحتوى جوّاها بيتزحزح.
1141
+ *
1142
+ * والتانية أخبث: العطل بيبان في **مكان تاني** غير التلميحة. اتمسكت في
1143
+ * شريط محرّر عرضه ٨٤ بكسل — تلميحة ٢٢٠ جوّاه كانت بتكسر الشريط كلّه،
1144
+ * ومحدّش يربط ده بتولتيب.
1145
+ *
1146
+ * ومواصفة CSS بتوسّع الأذى: `overflow-y: auto` وحدها بتخلّي `overflow-x`
1147
+ * يبقى `auto` كمان. يعني أيّ عمود قابل للتمرير — وده نصّ أيّ لوحة —
1148
+ * بيبقى فخّاً.
1149
+ *
1150
+ * فالتلميحة دلوقتي بتتبعت لـ`body` بـportal وموضعها `fixed` محسوب من
1151
+ * مستطيل المحفِّز. مافيش حاوية بينهم تقصّها ولا تحسبها فيضاً.
1152
+ *
1153
+ * ── والموضع بيتكتب على الـDOM لا في حالة ────────────────────────────────
1154
+ * القياس محتاج العنصر يبقى مرسوماً، والقياس ← حالة ← رسمة تانية بيدّي
1155
+ * ومضة في مكان غلط. فالكتابة مباشرة في مرجع العنصر **قبل الرسم**، ونفس
1156
+ * نمط `useSortable` مع `--drag-y`.
1157
+ *
1158
+ * والتلميحة بتتولد مخفيّة (`visibility`) وبتبان بعد ما موضعها يتحطّ —
1159
+ * من غير كده بتومض عند `0,0` أوّل إطار.
1160
+ *
1161
+ * ── وبتتلزق في حدود الشاشة ──────────────────────────────────────────────
1162
+ * محفِّز عند حرف الشاشة بيدّي تلميحة نصّها بره. و`fixed` مابيطلّعش
1163
+ * مُمرِّراً للصفحة، فالنتيجة قصّ صامت. فالموضع بيتلزق على ٨ بكسل من كلّ
1164
+ * حرف.
1165
+ *
1166
+ * ── والوصف بيتربط بالمحفِّز نفسه ────────────────────────────────────────
1167
+ * الـportal بيقطع الجيرة في الـDOM، وقارئ الشاشة مابيعرفش إن النصّ ده
1168
+ * بتاع الزرّ ده. فالمحفِّز بياخد `aria-describedby` — و`cloneElement`
1169
+ * بتحطّها على العنصر الحقيقيّ لا على غلافه، لأن الغلاف مش هو اللي
1170
+ * بيتركّز عليه.
1133
1171
  */
1134
1172
  declare function Tooltip({ content, children, side, }: {
1135
1173
  content: ReactNode;