@graphysdk/react-renderer 1.9.0-beta.1790592001943 → 1.9.0-beta.1790595344171
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/editable.cjs +1 -1
- package/dist/editable.mjs +1954 -1882
- package/dist/{use-target-boundary-Dbdlvyoe.js → history-chords-CjbRWpM3.js} +1439 -1443
- package/dist/history-chords-D8wpot3Q.cjs +2 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +129 -126
- package/package.json +2 -2
- package/dist/use-target-boundary-C8p4kyWR.cjs +0 -2
- /package/dist/{use-target-boundary.css → history-chords.css} +0 -0
package/dist/editable.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./editable.css');const l=require("./use-target-boundary-C8p4kyWR.cjs"),$=require("./theme.contract.css-DKDKSByt.cjs");let p=require("@graphysdk/viz-engine"),v=require("react"),n=require("react/jsx-runtime"),Ea=require("motion/react"),Y=require("zustand/react/shallow"),Ie=require("@vanilla-extract/dynamic"),Tn=require("react-dom"),U=require("clsx");U=l.__toESM(U,1);let se=require("@floating-ui/react-dom"),An=require("@tiptap/core"),Ma=require("@tiptap/extension-bold"),Ce=require("@tiptap/extension-document"),Ra=require("@tiptap/extension-hard-break"),Oa=require("@tiptap/extension-heading"),_a=require("@tiptap/extension-italic"),Na=require("@tiptap/extension-link"),Da=require("@tiptap/extension-text"),Fa=require("@tiptap/extension-text-align"),je=require("@tiptap/extension-text-style"),za=require("@tiptap/extension-underline"),Ee=require("@tiptap/extensions"),kn=require("@tiptap/extension-paragraph"),Me=require("@tiptap/react"),J=require("@base-ui/react/toolbar"),oe=require("@base-ui/react/tooltip"),H=require("@base-ui/react/popover"),Pt=require("react-colorful"),X=require("@base-ui/react/slider"),_=require("@base-ui/react/menu"),Ba=require("@base-ui/react/toggle"),ee=require("lodash-es/clamp");ee=l.__toESM(ee,1);let Q=require("@base-ui/react"),ce=require("@base-ui/react/accordion"),Lt=require("@base-ui/react/number-field"),Pn=require("@base-ui/react/radio"),Ln=require("@base-ui/react/radio-group"),K=require("@base-ui/react/select"),It=require("@base-ui/react/switch"),Ha=require("@base-ui/react/input");var Ga={save:"حفظ",cancel:"إلغاء",confirm:"تأكيد",delete:"حذف",confirmDelete:e=>`هل أنت متأكد من رغبتك في حذف ${e.item}؟`,abbreviations:{thousands:"ألف",millions:"مليون",billions:"مليار"}},Va={title:"محرر Graphy",description:"قم بتحرير المحتوى الخاص بك هنا",graphTypes:{column:"أعمدة",columnStacked:"أعمدة مكدسة",columnStackedFill:"أعمدة مكدسة 100%",bar:"شريطي",barStacked:"أشرطة مكدسة",barStackedFill:"أشرطة مكدسة 100%",line:"خطي",areaStacked:"مساحة مكدسة",pie:"دائري",donut:"حلقي",radar:"راداري",radarFilled:"راداري معبأ",scatter:"نقطي",bubble:"فقاعي",funnel:"قمعي",combo:"مركب",heatmap:"خريطة حرارية",waterfall:"شلالي",mekko:"ميكو",table:"جدول"},sizePanel:{toolbarButton:"الحجم",presetsSection:{title:"إعدادات مسبقة"},customSizeSection:{title:"حجم مخصص"},presets:{googleSlides:"Google Slides / PowerPoint",webEmail:"ويب / بريد إلكتروني",linkedIn:"منشور LinkedIn",instagram:"منشور Instagram",tiktok:"TikTok / قصة Instagram",twitter:"X (Twitter)",mobile:"جوال"},inputs:{unitLabel:"بكسل"},validation:{maxSizeError:e=>`≤ ${e.max} بكسل`,minSizeError:e=>`≥ ${e.min} بكسل`}},graphPanel:{toolbarButton:"الرسم البياني",graphTypeSection:{title:"نوع الرسم البياني"},mappingSection:{title:"البيانات",x:"المحور السيني",y:"القيمة",color:"اللون",size:"الحجم",label:"التسمية",none:"بلا"},comboSection:{title:"مظهر الرسم البياني المركب",types:{"grouped-bars":"أعمدة مجمعة","stacked-bars":"أعمدة مكدسة",lines:"خطوط فقط"}},polarSection:{title:"قطبي",innerRadius:"نصف القطر الداخلي",startAngle:"زاوية البداية"},barSection:{title:"الأعمدة",thickness:"سمك العمود",rounding:"التدوير",roundingOptions:{none:"بلا",xs:"XS",sm:"S",md:"M",lg:"L",xl:"XL",full:"كامل"}},graphOptionsSection:{title:"خيارات الرسم البياني"},gridSection:{title:"الشبكة",horizontalGridLines:"خطوط أفقية",verticalGridLines:"خطوط رأسية",rings:"حلقات",spokes:"أشعة",gridStyle:"نمط الشبكة",gridThickness:"سمك الشبكة",lineStyles:{solid:"متصل",dashed:"متقطع",dotted:"منقط"}},graphOptions:{sortBars:"ترتيب من الأعلى ← الأدنى",showPoints:"إظهار النقاط",lineFill:"تعبئة تحت الخط",smoothLines:"خطوط ناعمة",stackTotals:"مجاميع المكدس",dataLabels:"تسميات البيانات",showPercentages:"إظهار النسب المئوية",categoryLabels:"تسميات الفئات"},legendSection:{title:"وسيلة الإيضاح",auto:"تلقائي",top:"أعلى",bottom:"أسفل",left:"يسار",right:"يمين",none:"بدون",alignLabel:"المحاذاة",align:{auto:"تلقائي",start:"البداية",center:"الوسط",end:"النهاية"},displayLabel:"النمط",display:{auto:"تلقائي",pill:"شارات",direct:"على الرسم"}},numberFormatSection:{title:"تنسيق الأرقام"},numberFormat:{abbreviationLabel:"الاختصار",valueLabel:"القيمة",decimalPlacesLabel:"المنازل العشرية",options:{auto:"تلقائي",custom:"مخصص",none:"بدون"}},headlineNumberSize:{sizeLabel:"الحجم",valueLabel:"القيمة",sizes:{small:"ص",medium:"م",large:"ك"}},lineThickness:{label:"سمك الخط"},pointSize:{label:"حجم النقطة",options:{auto:"تلقائي",custom:"مخصص"}},headlineNumberSection:{title:"الرقم الرئيسي",toggle:"مرئي",metricLabel:"المقياس",compareWithLabel:"مقارنة مع",metrics:{total:"المجموع",average:"المتوسط",current:"الأخير",conversion:"التحويل",left:"يسار"},comparison:{first:"الأول",previous:"السابق"},position:{above:"أعلى",center:"وسط"}},treatEmptyValues:{leaveGap:{label:"ترك فجوة في الرسم البياني",description:"يترك فاصلاً مرئياً في الخط حيث تكون البيانات مفقودة"},fillZero:{label:"ملء بالصفر",description:"يعرض نقاط البيانات المفقودة كصفر"},connectGaps:{label:"الاتصال عبر الفجوات",description:"يربط الخط بين النقاط المتاحة، متخطياً الفجوة"}},comboChartAppearance:{title:"مظهر الرسم البياني المركب",groupedBars:"أشرطة مجمعة",stackedBars:"أشرطة مكدسة",linesOnly:"خطوط فقط"}},axesPanel:{toolbarButton:"المحاور",mainAxisSection:{yAxis:"المحور الصادي",xAxis:"المحور السيني"},crossAxisSection:{xAxis:"المحور السيني",yAxis:"المحور الصادي"},controls:{title:"العنوان",visible:"مرئي",ticks:"العلامات",labels:"التسميات",position:"الموضع",scale:"المقياس",startFrom:"البدء من",endAt:"الانتهاء عند",value:"القيمة",numberOfAxes:"عدد المحاور",reverse:"عكس"},labelMode:{auto:"تلقائي",edges:"الحواف"},scale:{auto:"تلقائي",log:"لوغاريتمي"},startFrom:{auto:"تلقائي",zero:"صفر",custom:"مخصص"},endAt:{auto:"تلقائي",custom:"مخصص"},axisCount:{single:"مفرد",double:"مزدوج"},position:{left:"يسار",right:"يمين",top:"أعلى",bottom:"أسفل"},yesNo:{yes:"نعم",no:"لا"}},colorPanel:{toolbarButton:"اللون",themeSection:{title:"السمة"},appearanceSection:{title:"المظهر",highlightStyle:"التمييز"},paletteSection:{title:"لوحة الألوان",colorScheme:"نظام الألوان",colors:"الألوان",colorPalettes:"لوحات الألوان"},paletteMode:{preset:"مسبق",brand:"العلامة التجارية",freestyle:"حر"},paletteThemes:{colorful:"ملون",pastel:"باستيل",neon:"نيون"},backgroundSection:{title:"الخلفية",black:"أسود",white:"أبيض",gray:"رمادي",tint:"صبغة",custom:"مخصص",none:"بدون"},borderSection:{title:"الحدود",borderColor:"لون الحدود",thickness:"السمك",cornerRadius:"نصف قطر الزاوية"},borderType:{solid:"صلب",gradient:"متدرج",gray:"رمادي",preset:"مسبق",custom:"مخصص",none:"بدون"},presetGradients:{lilac:"ليلكي",neonPink:"وردي نيون",blackberry:"توت أسود",sun:"شمس",iceland:"آيسلندا",sunset:"غروب",ultraviolet:"فوق بنفسجي",purple:"أرجواني",iceCream:"آيس كريم",mint:"نعناع",cool:"بارد",fresh:"منعش"}},designPanel:{toolbarButton:"التصميم",defaultExpanded:"لوحة الألوان"},annotatePanel:{toolbarButton:"التعليقات",callOutSection:{title:"وسائل الشرح",text:"نص",arrow:"سهم",box:"مربع",difference:"الفرق"},highlightSection:{title:"التمييز",button:"تمييز",colorLabel:"لون التمييز"}},annotationsPanel:{toolbarButton:"التعليقات",freeformSection:{title:"حر",text:"نص",arrow:"سهم",box:"مربع",difference:"فرق"},goalSection:{title:"الهدف",labelControl:"التسمية",labelPlaceholder:"الهدف",labelAriaLabel:"تسمية الهدف المخصصة",valueControl:"قيمة الهدف",valueAriaLabel:"قيمة الهدف",byDate:"حسب التاريخ",xAxisValue:"قيمة المحور السيني",optional:"(اختياري)"},trendsAndAveragesSection:{title:"الاتجاهات والمتوسطات",trend:"الاتجاه",average:"المتوسط"},trendType:{label:"نوع الاتجاه",placeholder:"نوع الاتجاه",options:{linear:"خطي",exponential:"أسي",quadratic:"تربيعي",polynomial:"متعدد الحدود",logarithmic:"لوغاريتمي",power:"قوة",loess:"لويس"}},averageLineSeries:{label:"سلسلة خط المتوسط",placeholder:"اختر السلسلة",ariaLabel:"قائمة منسدلة للسلسلة لخط المتوسط"},highlightSection:{title:"التمييز",button:"تمييز",fadeColorLabel:"لون التلاشي"},titleAndSubtitleSection:{title:"العنوان والعنوان الفرعي",toggleTitle:"العنوان",subtitle:"العنوان الفرعي"},captionAndSourceSection:{title:"التسمية التوضيحية والمصدر",caption:"التسمية التوضيحية",source:"المصدر",url:"الرابط",name:"الاسم"}},elementsPanel:{contentVisible:"مرئي",contentValue:"القيمة",toolbarButton:"العناصر",headerSection:{title:"الرأس",toggleTitle:"العنوان",subtitle:"العنوان الفرعي"},footerSection:{title:"التذييل",caption:"التسمية التوضيحية",source:"المصدر",url:"الرابط",name:"الاسم"},textSizeSection:{title:"حجم النص",scaleFormat:e=>`${e.value}x`},fontSection:{title:"الخط"},sourceSection:{title:"المصدر",url:"الرابط",name:"الاسم"}},powerUpPanel:{toolbarButton:"التحسينات",goalSection:{title:"الهدف",toggle:"الهدف",labelControl:"التسمية",labelPlaceholder:"الهدف",labelAriaLabel:"تسمية الهدف المخصصة",valueControl:"قيمة الهدف",byDate:"حسب التاريخ",xAxisValue:"قيمة المحور السيني",optional:" (اختياري)",xAxisReferenceAriaLabel:"قيمة مرجعية للمحور السيني",anyXAxisValue:"أي قيمة للمحور السيني",selectValuePlaceholder:"اختر القيمة"},trendSection:{title:"الاتجاه",toggle:"الاتجاه"},averageSection:{title:"المتوسط",toggle:"المتوسط",seriesLabel:"سلسلة خط المتوسط",seriesPlaceholder:"اختر السلسلة",seriesAriaLabel:"قائمة منسدلة للسلسلة لخط المتوسط"},trendType:{label:"نوع الاتجاه",placeholder:"نوع الاتجاه",options:{linear:"خطي",exponential:"أسي",quadratic:"تربيعي",polynomial:"متعدد الحدود",logarithmic:"لوغاريتمي",power:"قوة",loess:"لويس"}},valueInput:{percentagePlaceholder:"النسبة المئوية",numberPlaceholder:"الرقم",percentageSymbol:"٪"}},highlighting:{modeHelper:{title:"وضع التمييز",hover:"مرر",toHighlight:"للتمييز",anyElement:"أي عنصر",escToExit:"للخروج",esc:"ESC"},emptyState:"لا تتوفر خيارات تمييز",deleteAriaLabel:"حذف التمييز",highlightStyle:{tint:"صبغة",gray:"رمادي"}},fineTunePanel:{toolbarButton:"الضبط الدقيق",detailSection:{title:"التفاصيل",missingValues:"القيم المفقودة"},lineStyleSection:{title:"نمط الخط",lineCurve:"انحناء الخط",sharp:"حاد",smooth:"ناعم"}},customThemeEditor:{patternDropdownAriaLabel:"قائمة منسدلة للنمط للسلسلة",patterns:{solid:"صلب",pattern:"نمط",dotted:"منقط",dashed:"متقطع",hatched:"مظلل"},heatmapColorLabel:"اللون"},overlayMenu:{observation:"مشاهدة",group:"مجموعة",band:"نطاق",axis:"المحور",legend:"وسيلة الإيضاح",gridLines:"خطوط الشبكة",chart:"الرسم البياني"},accessibility:{toggleSection:e=>`تبديل قسم ${e.title}`},graphyDefaults:{themeOptions:{light:"فاتح",dark:"داكن"}}},$a={titleEditor:{titlePlaceholder:"بدون عنوان",subtitlePlaceholder:"إضافة عنوان فرعي"},toolbar:{formatting:{bold:"عريض",italic:"مائل",underline:"تحته خط",link:"رابط"},link:{ariaLabel:"إنشاء رابط",placeholder:"اكتب أو الصق رابطاً...",submit:"إرسال",urlLabel:"عنوان الرابط",apply:"تطبيق الرابط"},font:{label:"الخط",ariaLabel:"عائلة الخط"},heading:{label:"مستوى العنوان",ariaLabel:"نمط النص",text:"نص",caption:"تسمية توضيحية",heading1:"عنوان 1",heading2:"عنوان 2",heading3:"عنوان 3"},textAlign:{left:"محاذاة لليسار",center:"توسيط",right:"محاذاة لليمين"},color:{label:"لون النص"}},colorDropdown:{colors:"الألوان",chartColors:"ألوان الرسم البياني",custom:"مخصص",opacity:"الشفافية",transparent:"شفاف",pickCustom:"اختيار لون مخصص",pickColor:"اختيار لون"},annotations:{differenceArrowToolbar:{label:"خيارات سهم الفرق",labelKind:{ariaLabel:"التسمية",absoluteDifference:"التغير المطلق",relativeDifference:"التغير المئوي",proportion:"النسبة",suspectValue:"تقسم هذه القيمة على أساس يساوي صفرًا.",incomparableEnds:"يقيس الطرفان كميتين مختلفتين، لذا لا معنى للفرق بينهما."},color:"لون السهم",size:{ariaLabel:"الحجم",small:"صغير",medium:"متوسط",large:"كبير"},swap:"عكس الاتجاه",remove:"إزالة السهم"},shapeToolbar:{label:"خيارات الشكل",color:"لون الشكل",border:{ariaLabel:"الحد",none:"بلا",thin:"رفيع (2 بكسل)",medium:"متوسط (8 بكسل)",thick:"سميك (16 بكسل)"},remove:"إزالة الشكل",resize:{"top-left":"تغيير الحجم من الزاوية العلوية اليسرى","top-right":"تغيير الحجم من الزاوية العلوية اليمنى","bottom-right":"تغيير الحجم من الزاوية السفلية اليمنى","bottom-left":"تغيير الحجم من الزاوية السفلية اليسرى"}},arrowToolbar:{label:"خيارات السهم",color:"لون السهم",thickness:{ariaLabel:"السماكة",thin:"رفيع",medium:"متوسط",thick:"سميك"},startArrowhead:"بداية السهم",endArrowhead:"نهاية السهم",arrowhead:{lineArrow:"رأس سهم",none:"بلا"},lineStyle:{ariaLabel:"نمط الخط",solid:"متصل",dashed:"متقطع",dotted:"منقّط"},sticker:"تأثير الملصق",remove:"إزالة السهم",moveEndpoint:{start:"تحريك بداية السهم",end:"تحريك نهاية السهم"}},textToolbar:{label:"خيارات النص",background:"لون الخلفية",color:"لون النص",font:{ariaLabel:"الخط",modern:"عصري",fresh:"منعش",timeless:"كلاسيكي",technical:"تقني",fineliner:"قلم رفيع"},fontSize:{ariaLabel:"حجم الخط",small:"صغير",medium:"متوسط",large:"كبير",extraLarge:"كبير جدًا",huge:"ضخم"},align:{left:"محاذاة إلى اليسار",center:"محاذاة إلى الوسط",right:"محاذاة إلى اليمين"},remove:"إزالة النص",resize:{left:"تغيير الحجم من اليسار",right:"تغيير الحجم من اليمين"}},text:{editLabel:"تحرير النص",placeholder:"اكتب شيئًا"},baseMenu:{pinNumber:"تثبيت الرقم",unpinNumber:"إلغاء تثبيت الرقم",annotate:"تعليق",removeAnnotation:"إزالة التعليق",highlight:"تمييز",highlightWithLabel:e=>`تمييز ${e.label}`,removeHighlight:"إزالة التمييز",differenceArrow:"سهم الفرق",addSticker:"إضافة ملصق",removeSticker:"إزالة الملصق"},textMenu:{title:"تعليق",placeholder:"إضافة تعليق",addButton:"إضافة"},highlights:{menuTitle:"تمييز",labels:{bar:"شريط",barGroup:"مجموعة",barStack:"مكدس",barSeries:"سلسلة",line:"خط",linePoint:"نقطة",lineSeries:"سلسلة",scatterPoint:"نقطة",scatterSeries:"سلسلة",pieSlice:"شريحة",pointOrBar:"نقطة / شريط",lineOrSeries:"خط / سلسلة"}},stickerMenu:{title:"إضافة ملصق"},delete:"حذف",arrow:{thickness:{label:"السمك",thin:"رفيع",medium:"متوسط",thick:"سميك"},arrowhead:{startPoint:"نقطة البداية",endPoint:"نقطة النهاية",lineArrow:"سهم الخط",none:"بدون"},lineStyle:{label:"نمط الخط",solid:"صلب",dotted:"منقط"},stickerEffect:"تأثير الملصق",toolbarAriaLabel:"شريط أدوات السهم الحر",editorAriaLabel:"محرر السهم"},differenceArrow:{type:{proportion:"النسبة",difference:({absoluteDifference:e})=>`الفرق (${e})`,increase:({absoluteDifference:e})=>`الزيادة (${e})`,decrease:({absoluteDifference:e})=>`النقصان (${e})`,percentageChange:({percentageChange:e})=>`تغيير النسبة المئوية (${e})`,percentIncrease:({percentageChange:e})=>`زيادة النسبة المئوية (${e})`,percentDecrease:({percentageChange:e})=>`نقصان النسبة المئوية (${e})`},size:{label:"الحجم",small:"صغير",medium:"متوسط",large:"كبير"},flipArrow:"عكس السهم",color:"اللون",toolbarAriaLabel:"شريط أدوات سهم الفرق",editorAriaLabel:"محرر سهم الفرق"},shape:{color:"اللون",border:{label:"الحدود",none:"بدون",thin:({value:e})=>`رفيع (${e})`,medium:({value:e})=>`متوسط (${e})`,thick:({value:e})=>`سميك (${e})`}}}},Ua={common:Ga,editor:Va,graph:$a},Wa={save:"Save",cancel:"Cancel",confirm:"Confirm",delete:"Delete",confirmDelete:e=>`Are you sure you want to delete ${e.item}?`,abbreviations:{thousands:"k",millions:"m",billions:"b"}},qa={title:"Graphy Editor",description:"Edit your content here",graphTypes:{column:"Column",columnStacked:"Stacked column",columnStackedFill:"100% stacked column",bar:"Bar",barStacked:"Stacked bar",barStackedFill:"100% stacked bar",line:"Line",areaStacked:"Stacked area",pie:"Pie",donut:"Donut",radialBar:"Radial bar",rose:"Rose",roseStacked:"Stacked rose",radar:"Radar",radarFilled:"Filled radar",scatter:"Scatter",bubble:"Bubble",funnel:"Funnel",combo:"Combo",heatmap:"Heatmap",waterfall:"Waterfall",mekko:"Mekko",table:"Table"},sizePanel:{toolbarButton:"Size",presetsSection:{title:"Presets"},customSizeSection:{title:"Custom size"},presets:{googleSlides:"Google Slides / PowerPoint",webEmail:"Web / email",linkedIn:"LinkedIn post",instagram:"Instagram post",tiktok:"TikTok / Instagram story",twitter:"X (Twitter)",mobile:"Mobile"},inputs:{unitLabel:"px"},validation:{maxSizeError:e=>`≤ ${e.max}px`,minSizeError:e=>`≥ ${e.min}px`}},graphPanel:{toolbarButton:"Graph",graphTypeSection:{title:"Graph type"},mappingSection:{title:"Data",x:"X-axis",y:"Value",color:"Colour",size:"Size",label:"Label",none:"None"},comboSection:{title:"Combo chart appearance",types:{"grouped-bars":"Grouped bars","stacked-bars":"Stacked bars",lines:"Lines only"}},polarSection:{title:"Polar",innerRadius:"Inner radius",startAngle:"Start angle"},barSection:{title:"Bars",thickness:"Bar thickness",rounding:"Rounding",roundingOptions:{none:"None",xs:"XS",sm:"S",md:"M",lg:"L",xl:"XL",full:"Full"}},graphOptionsSection:{title:"Graph options"},gridSection:{title:"Grid",horizontalGridLines:"Horizontal lines",verticalGridLines:"Vertical lines",rings:"Rings",spokes:"Spokes",gridStyle:"Grid style",gridThickness:"Grid thickness",lineStyles:{solid:"Solid",dashed:"Dashed",dotted:"Dotted"}},graphOptions:{sortBars:"Sort high → low",showPoints:"Show points",lineFill:"Fill under line",smoothLines:"Smooth lines",stackTotals:"Stack totals",dataLabels:"Data labels",showPercentages:"Show percentages",categoryLabels:"Category labels"},legendSection:{title:"Legend",auto:"Auto",top:"Top",bottom:"Bottom",left:"Left",right:"Right",none:"None",alignLabel:"Alignment",align:{auto:"Auto",start:"Start",center:"Center",end:"End"},displayLabel:"Style",display:{auto:"Auto",pill:"Pills",direct:"Direct"}},numberFormatSection:{title:"Number format"},numberFormat:{abbreviationLabel:"Abbreviation",valueLabel:"Value",decimalPlacesLabel:"Decimal places",options:{auto:"Auto",custom:"Custom",none:"None"}},headlineNumberSize:{sizeLabel:"Size",valueLabel:"Value",sizes:{small:"S",medium:"M",large:"L"}},lineThickness:{label:"Line thickness"},pointSize:{label:"Point size",options:{auto:"Auto",custom:"Custom"}},headlineNumberSection:{title:"Headline number",toggle:"Visible",metricLabel:"Metric",compareWithLabel:"Compare with",metrics:{total:"Total",average:"Avg.",current:"Last",conversion:"Conversion",left:"Left"},comparison:{first:"First",previous:"Previous"},position:{above:"Above",center:"Center"}},treatEmptyValues:{leaveGap:{label:"Leave gap in chart",description:"Leaves a visible break in the line where data is missing"},fillZero:{label:"Fill with zero",description:"Displays missing data points as zero"},connectGaps:{label:"Connect across gaps",description:"Joins the line between available points, skipping the gap"}},comboChartAppearance:{title:"Combo chart appearance",groupedBars:"Grouped bars",stackedBars:"Stacked bars",linesOnly:"Lines only"}},axesPanel:{toolbarButton:"Axes",mainAxisSection:{yAxis:"Y-axis",xAxis:"X-axis"},crossAxisSection:{xAxis:"X-axis",yAxis:"Y-axis"},controls:{title:"Title",visible:"Visible",ticks:"Ticks",labels:"Labels",position:"Position",scale:"Scale",startFrom:"Start from",endAt:"End at",value:"Value",numberOfAxes:"Number of axes",reverse:"Reverse"},labelMode:{auto:"Auto",edges:"Edges"},scale:{auto:"Auto",log:"Log"},startFrom:{auto:"Auto",zero:"Zero",custom:"Custom"},endAt:{auto:"Auto",custom:"Custom"},axisCount:{single:"Single",double:"Double"},position:{left:"Left",right:"Right",top:"Top",bottom:"Bottom"},yesNo:{yes:"Yes",no:"No"}},colorPanel:{toolbarButton:"Color",themeSection:{title:"Theme"},appearanceSection:{title:"Appearance",highlightStyle:"Highlight"},paletteSection:{title:"Palette",colorScheme:"Color scheme",colors:"Colors",colorPalettes:"Color palettes"},paletteMode:{preset:"Preset",freestyle:"Freestyle"},paletteThemes:{colorful:"Colorful",pastel:"Pastel",neon:"Neon"},backgroundSection:{title:"Background",black:"Black",white:"White",gray:"Grey",tint:"Tint",custom:"Custom",none:"None"},borderSection:{title:"Border",borderColor:"Border color",thickness:"Thickness",cornerRadius:"Corner radius"},borderType:{solid:"Solid",gradient:"Gradient",gray:"Grey",preset:"Preset",custom:"Custom",none:"None"},presetGradients:{lilac:"Lilac",neonPink:"Neon Pink",blackberry:"Blackberry",sun:"Sun",iceland:"Iceland",sunset:"Sunset",ultraviolet:"Ultraviolet",purple:"Purple",iceCream:"Ice Cream",mint:"Mint",cool:"Cool",fresh:"Fresh"}},designPanel:{toolbarButton:"Design",defaultExpanded:"Palette"},annotatePanel:{toolbarButton:"Annotate",callOutSection:{title:"Callouts",text:"Text",arrow:"Arrow",box:"Box",difference:"Difference"},highlightSection:{title:"Highlight",button:"Highlight",colorLabel:"Highlight color"}},annotationsPanel:{toolbarButton:"Annotate",freeformSection:{title:"Freeform",text:"Text",arrow:"Arrow",box:"Box",difference:"Difference"},goalSection:{title:"Goal",labelControl:"Label",labelPlaceholder:"Goal",labelAriaLabel:"Custom goal label",valueControl:"Goal value",valueAriaLabel:"Goal value",byDate:"By date",xAxisValue:"X-axis value",optional:"(optional)"},trendsAndAveragesSection:{title:"Trends and Averages",trend:"Trend",average:"Average"},trendType:{label:"Trend type",placeholder:"Trend type",options:{linear:"Linear",exponential:"Exponential",quadratic:"Quadratic",polynomial:"Polynomial",logarithmic:"Logarithmic",power:"Power",loess:"Loess"}},averageLineSeries:{label:"Average line series",placeholder:"Select series",ariaLabel:"Series dropdown for average line"},highlightSection:{title:"Highlight",button:"Highlight",fadeColorLabel:"Fade color"},titleAndSubtitleSection:{title:"Title & Subtitle",toggleTitle:"Title",subtitle:"Subtitle"},captionAndSourceSection:{title:"Caption & Source",caption:"Caption",source:"Source",url:"URL",name:"Name"}},elementsPanel:{contentVisible:"Visible",contentValue:"Value",toolbarButton:"Elements",headerSection:{title:"Header",toggleTitle:"Title",subtitle:"Subtitle"},footerSection:{title:"Footer",caption:"Caption",source:"Source",url:"URL",name:"Name"},textSizeSection:{title:"Text size",scaleFormat:e=>`${e.value}x`},fontSection:{title:"Font"},sourceSection:{title:"Source",url:"URL",name:"Name"}},powerUpPanel:{toolbarButton:"Power-ups",goalSection:{title:"Goal",toggle:"Goal",labelControl:"Label",labelPlaceholder:"Goal",labelAriaLabel:"Custom goal label",valueControl:"Goal value",byDate:"By date",xAxisValue:"X-axis value",optional:" (optional)",xAxisReferenceAriaLabel:"X-axis reference value",anyXAxisValue:"Any x-axis value",selectValuePlaceholder:"Select value"},trendSection:{title:"Trend",toggle:"Trend"},averageSection:{title:"Average",toggle:"Average",seriesLabel:"Average line series",seriesPlaceholder:"Select series",seriesAriaLabel:"Series dropdown for average line"},trendType:{label:"Trend type",placeholder:"Trend type",options:{linear:"Linear",exponential:"Exponential",quadratic:"Quadratic",polynomial:"Polynomial",logarithmic:"Logarithmic",power:"Power",loess:"Loess"}},valueInput:{percentagePlaceholder:"Percentage",numberPlaceholder:"Number",percentageSymbol:"%"}},highlighting:{modeHelper:{title:"Highlight mode",hover:"Hover",toHighlight:"to highlight",anyElement:"any element",escToExit:"to exit",esc:"ESC"},emptyState:"No highlight options available",deleteAriaLabel:"Delete highlight",highlightStyle:{tint:"Tint",gray:"Grey"}},fineTunePanel:{toolbarButton:"Fine tune",detailSection:{title:"Detail",missingValues:"Missing values"},lineStyleSection:{title:"Line style",lineCurve:"Line curve",sharp:"Sharp",smooth:"Smooth"}},customThemeEditor:{patternDropdownAriaLabel:"Pattern dropdown for series",patterns:{solid:"Solid",pattern:"Pattern",dotted:"Dotted",dashed:"Dashed",hatched:"Hatched"},heatmapColorLabel:"Color"},overlayMenu:{observation:"Observation",group:"Group",band:"Band",axis:"Axis",legend:"Legend",gridLines:"Grid lines",chart:"Chart"},accessibility:{toggleSection:e=>`Toggle ${e.title} section`},graphyDefaults:{themeOptions:{light:"Light",dark:"Dark"}}},Ka={titleEditor:{titlePlaceholder:"Untitled",subtitlePlaceholder:"Add a subtitle"},toolbar:{formatting:{bold:"Bold",italic:"Italic",underline:"Underline",link:"Link"},link:{ariaLabel:"Create link",placeholder:"Type or paste a link...",submit:"Submit",urlLabel:"Link URL",apply:"Apply link"},font:{label:"Font",ariaLabel:"Font family"},heading:{label:"Heading level",ariaLabel:"Text style",text:"Text",caption:"Caption",heading1:"Heading 1",heading2:"Heading 2",heading3:"Heading 3"},textAlign:{left:"Align left",center:"Align center",right:"Align right"},color:{label:"Text color"}},colorDropdown:{colors:"Colors",chartColors:"Chart colors",custom:"Custom",opacity:"Opacity",transparent:"Transparent",pickCustom:"Pick custom color",pickColor:"Pick color"},annotations:{differenceArrowToolbar:{label:"Difference arrow options",labelKind:{ariaLabel:"Label",absoluteDifference:"Absolute change",relativeDifference:"Percentage change",proportion:"Proportion",suspectValue:"This value divides by a baseline of zero.",incomparableEnds:"The two ends measure different quantities, so a difference between them has no meaning."},color:"Arrow colour",size:{ariaLabel:"Size",small:"Small",medium:"Medium",large:"Large"},swap:"Swap direction",remove:"Remove arrow"},shapeToolbar:{label:"Shape options",color:"Shape colour",border:{ariaLabel:"Border",none:"None",thin:"Thin (2px)",medium:"Medium (8px)",thick:"Thick (16px)"},remove:"Remove shape",resize:{"top-left":"Resize from the top left","top-right":"Resize from the top right","bottom-right":"Resize from the bottom right","bottom-left":"Resize from the bottom left"}},arrowToolbar:{label:"Arrow options",color:"Arrow colour",thickness:{ariaLabel:"Thickness",thin:"Thin",medium:"Medium",thick:"Thick"},startArrowhead:"Start of the arrow",endArrowhead:"End of the arrow",arrowhead:{lineArrow:"Line arrow",none:"None"},lineStyle:{ariaLabel:"Line style",solid:"Solid",dashed:"Dashed",dotted:"Dotted"},sticker:"Sticker effect",remove:"Remove arrow",moveEndpoint:{start:"Move the start of the arrow",end:"Move the end of the arrow"}},textToolbar:{label:"Text options",background:"Background colour",color:"Text colour",font:{ariaLabel:"Font",modern:"Modern",fresh:"Fresh",timeless:"Timeless",technical:"Technical",fineliner:"Fineliner"},fontSize:{ariaLabel:"Font size",small:"Small",medium:"Medium",large:"Large",extraLarge:"Extra Large",huge:"Huge"},align:{left:"Align left",center:"Align centre",right:"Align right"},remove:"Remove text",resize:{left:"Resize from the left",right:"Resize from the right"}},text:{editLabel:"Edit text",placeholder:"Type something"},baseMenu:{pinNumber:"Pin number",unpinNumber:"Unpin number",annotate:"Annotate",removeAnnotation:"Remove annotation",highlight:"Highlight",highlightWithLabel:e=>`Highlight ${e.label}`,removeHighlight:"Remove highlight",differenceArrow:"Difference arrow",addSticker:"Add sticker",removeSticker:"Remove sticker"},textMenu:{title:"Annotate",placeholder:"Add a comment",addButton:"Add"},highlights:{menuTitle:"Highlight",labels:{bar:"bar",barGroup:"group",barStack:"stack",barSeries:"series",line:"line",linePoint:"point",lineSeries:"series",scatterPoint:"point",scatterSeries:"series",pieSlice:"slice",pointOrBar:"point / bar",lineOrSeries:"line / series"}},stickerMenu:{title:"Add sticker"},delete:"Delete",arrow:{thickness:{label:"Thickness",thin:"Thin",medium:"Medium",thick:"Thick"},arrowhead:{startPoint:"Start point",endPoint:"End point",lineArrow:"Line arrow",none:"None"},lineStyle:{label:"Line style",solid:"Solid",dotted:"Dotted"},stickerEffect:"Sticker effect",toolbarAriaLabel:"Free-form arrow toolbar",editorAriaLabel:"Arrow editor"},differenceArrow:{type:{proportion:"Proportion",difference:({absoluteDifference:e})=>`Difference (${e})`,increase:({absoluteDifference:e})=>`Increase (${e})`,decrease:({absoluteDifference:e})=>`Decrease (${e})`,percentageChange:({percentageChange:e})=>`Percentage change (${e})`,percentIncrease:({percentageChange:e})=>`Percent increase (${e})`,percentDecrease:({percentageChange:e})=>`Percent decrease (${e})`},size:{label:"Size",small:"Small",medium:"Medium",large:"Large"},flipArrow:"Flip arrow",color:"Color",toolbarAriaLabel:"Difference arrow toolbar",editorAriaLabel:"Difference arrow editor"},shape:{color:"Color",border:{label:"Border",none:"None",thin:({value:e})=>`Thin (${e})`,medium:({value:e})=>`Medium (${e})`,thick:({value:e})=>`Thick (${e})`}}}},Xa={common:Wa,editor:qa,graph:Ka},Za={colorPanel:{backgroundSection:{gray:"Gray"},borderType:{gray:"Gray"}},highlighting:{highlightStyle:{gray:"Gray"}}},Ya={editor:Za},Ja={save:"Guardar",cancel:"Cancelar",confirm:"Confirmar",delete:"Eliminar",confirmDelete:e=>`Tem a certeza que deseja eliminar ${e.item}?`,abbreviations:{thousands:"mil",millions:"M",billions:"MM"}},Qa={title:"Editor Graphy",description:"Edite o seu conteúdo aqui",graphTypes:{column:"Colunas",columnStacked:"Colunas sobrepostas",columnStackedFill:"100% Colunas sobrepostas",bar:"Barras",barStacked:"Barras sobrepostas",barStackedFill:"100% Barras sobrepostas",line:"Linha",areaStacked:"Área sobreposta",pie:"Circular",donut:"Donut",radialBar:"Barras radiais",radar:"Radar",radarFilled:"Radar preenchido",scatter:"Dispersão",bubble:"Bolhas",funnel:"Funil",combo:"Combinado",heatmap:"Mapa de Calor",waterfall:"Cascata",mekko:"Mekko",table:"Tabela"},sizePanel:{toolbarButton:"Tamanho",presetsSection:{title:"Predefinições"},customSizeSection:{title:"Tamanho personalizado"},presets:{googleSlides:"Google Slides / PowerPoint",webEmail:"Web / email",linkedIn:"Publicação LinkedIn",instagram:"Publicação Instagram",tiktok:"TikTok / Instagram story",twitter:"X (Twitter)",mobile:"Móvel"},inputs:{unitLabel:"px"},validation:{maxSizeError:e=>`≤ ${e.max}px`,minSizeError:e=>`≥ ${e.min}px`}},graphPanel:{toolbarButton:"Gráfico",graphTypeSection:{title:"Tipo de gráfico"},mappingSection:{title:"Dados",x:"Eixo X",y:"Valor",color:"Cor",size:"Tamanho",label:"Etiqueta",none:"Nenhum"},comboSection:{title:"Aspeto do gráfico combinado",types:{"grouped-bars":"Barras agrupadas","stacked-bars":"Barras empilhadas",lines:"Apenas linhas"}},polarSection:{title:"Polar",innerRadius:"Raio interno",startAngle:"Ângulo inicial"},barSection:{title:"Barras",thickness:"Espessura da barra",rounding:"Arredondamento",roundingOptions:{none:"Nenhum",xs:"XS",sm:"S",md:"M",lg:"L",xl:"XL",full:"Total"}},graphOptionsSection:{title:"Opções do gráfico"},gridSection:{title:"Grelha",horizontalGridLines:"Linhas horizontais",verticalGridLines:"Linhas verticais",rings:"Anéis",spokes:"Raios",gridStyle:"Estilo da grelha",gridThickness:"Espessura da grelha",lineStyles:{solid:"Sólida",dashed:"Tracejada",dotted:"Pontilhada"}},graphOptions:{sortBars:"Ordenar maior → menor",showPoints:"Mostrar pontos",lineFill:"Preencher sob a linha",smoothLines:"Linhas suaves",stackTotals:"Totais sobrepostos",dataLabels:"Etiquetas de dados",showPercentages:"Mostrar percentagens",categoryLabels:"Etiquetas de categorias"},legendSection:{title:"Legenda",auto:"Automático",top:"Topo",bottom:"Fundo",left:"Esquerda",right:"Direita",none:"Nenhuma",alignLabel:"Alinhamento",align:{auto:"Automático",start:"Início",center:"Centro",end:"Fim"},displayLabel:"Estilo",display:{auto:"Automático",pill:"Etiquetas",direct:"No gráfico"}},numberFormatSection:{title:"Formato numérico"},numberFormat:{abbreviationLabel:"Abreviação",valueLabel:"Valor",decimalPlacesLabel:"Casas decimais",options:{auto:"Automático",custom:"Personalizado",none:"Nenhum"}},headlineNumberSize:{sizeLabel:"Tamanho",valueLabel:"Valor",sizes:{small:"P",medium:"M",large:"G"}},lineThickness:{label:"Espessura da linha"},pointSize:{label:"Tamanho do ponto",options:{auto:"Automático",custom:"Personalizado"}},headlineNumberSection:{title:"Número destaque",toggle:"Visível",metricLabel:"Métrica",compareWithLabel:"Comparar com",metrics:{total:"Total",average:"Média",current:"Último",conversion:"Conversão",left:"Esquerda"},comparison:{first:"Primeiro",previous:"Anterior"},position:{above:"Acima",center:"Centro"}},treatEmptyValues:{leaveGap:{label:"Deixar espaço no gráfico",description:"Deixa uma quebra visível na linha onde faltam dados"},fillZero:{label:"Preencher com zero",description:"Exibe pontos de dados em falta como zero"},connectGaps:{label:"Ligar através dos espaços",description:"Une a linha entre pontos disponíveis, ignorando o espaço"}},comboChartAppearance:{title:"Aparência do gráfico combinado",groupedBars:"Barras agrupadas",stackedBars:"Barras sobrepostas",linesOnly:"Apenas linhas"}},axesPanel:{toolbarButton:"Eixos",mainAxisSection:{yAxis:"Eixo Y",xAxis:"Eixo X"},crossAxisSection:{xAxis:"Eixo X",yAxis:"Eixo Y"},controls:{title:"Título",visible:"Visível",ticks:"Marcas",labels:"Etiquetas",position:"Posição",scale:"Escala",startFrom:"Iniciar de",endAt:"Terminar em",value:"Valor",numberOfAxes:"Número de eixos",reverse:"Inverter"},labelMode:{auto:"Automático",edges:"Extremos"},scale:{auto:"Automático",log:"Logarítmico"},startFrom:{auto:"Automático",zero:"Zero",custom:"Personalizado"},endAt:{auto:"Automático",custom:"Personalizado"},axisCount:{single:"Único",double:"Duplo"},position:{left:"Esquerda",right:"Direita",top:"Topo",bottom:"Fundo"},yesNo:{yes:"Sim",no:"Não"}},colorPanel:{toolbarButton:"Cor",themeSection:{title:"Tema"},appearanceSection:{title:"Aparência",highlightStyle:"Destaque"},paletteSection:{title:"Paleta",colorScheme:"Esquema de cores",colors:"Cores",colorPalettes:"Paletas de cores"},paletteMode:{preset:"Predefinido",brand:"Marca",freestyle:"Livre"},paletteThemes:{colorful:"Colorido",pastel:"Pastel",neon:"Néon"},backgroundSection:{title:"Fundo",black:"Preto",white:"Branco",gray:"Cinzento",tint:"Tonalidade",custom:"Personalizado",none:"Nenhum"},borderSection:{title:"Contorno",borderColor:"Cor do contorno",thickness:"Espessura",cornerRadius:"Raio dos cantos"},borderType:{solid:"Sólido",gradient:"Gradiente",gray:"Cinzento",preset:"Predefinido",custom:"Personalizado",none:"Nenhum"},presetGradients:{lilac:"Lilás",neonPink:"Rosa Néon",blackberry:"Amora",sun:"Sol",iceland:"Islândia",sunset:"Pôr do Sol",ultraviolet:"Ultravioleta",purple:"Roxo",iceCream:"Gelado",mint:"Menta",cool:"Frio",fresh:"Fresco"}},designPanel:{toolbarButton:"Design",defaultExpanded:"Paleta"},annotatePanel:{toolbarButton:"Anotar",callOutSection:{title:"Destaques",text:"Texto",arrow:"Seta",box:"Caixa",difference:"Diferença"},highlightSection:{title:"Realce",button:"Realçar",colorLabel:"Cor do realce"}},annotationsPanel:{toolbarButton:"Anotar",freeformSection:{title:"Forma livre",text:"Texto",arrow:"Seta",box:"Caixa",difference:"Diferença"},goalSection:{title:"Objetivo",labelControl:"Etiqueta",labelPlaceholder:"Objetivo",labelAriaLabel:"Etiqueta de objetivo personalizada",valueControl:"Valor do objetivo",valueAriaLabel:"Valor do objetivo",byDate:"Por data",xAxisValue:"Valor do eixo X",optional:"(opcional)"},trendsAndAveragesSection:{title:"Tendências e Médias",trend:"Tendência",average:"Média"},trendType:{label:"Tipo de tendência",placeholder:"Tipo de tendência",options:{linear:"Linear",exponential:"Exponencial",quadratic:"Quadrática",polynomial:"Polinomial",logarithmic:"Logarítmica",power:"Potência",loess:"Loess"}},averageLineSeries:{label:"Série da linha de média",placeholder:"Selecionar série",ariaLabel:"Dropdown de séries para linha de média"},highlightSection:{title:"Realce",button:"Realçar",fadeColorLabel:"Cor de esmaecimento"},titleAndSubtitleSection:{title:"Título e Subtítulo",toggleTitle:"Título",subtitle:"Subtítulo"},captionAndSourceSection:{title:"Legenda e Fonte",caption:"Legenda",source:"Fonte",url:"URL",name:"Nome"}},elementsPanel:{contentVisible:"Visível",contentValue:"Valor",toolbarButton:"Elementos",headerSection:{title:"Cabeçalho",toggleTitle:"Título",subtitle:"Subtítulo"},footerSection:{title:"Rodapé",caption:"Legenda",source:"Fonte",url:"URL",name:"Nome"},textSizeSection:{title:"Tamanho do texto",scaleFormat:e=>`${e.value}x`},fontSection:{title:"Tipo de letra"},sourceSection:{title:"Fonte",url:"URL",name:"Nome"}},powerUpPanel:{toolbarButton:"Extras",goalSection:{title:"Objetivo",toggle:"Objetivo",labelControl:"Etiqueta",labelPlaceholder:"Objetivo",labelAriaLabel:"Etiqueta de objetivo personalizada",valueControl:"Valor do objetivo",byDate:"Por data",xAxisValue:"Valor do eixo X",optional:" (opcional)",xAxisReferenceAriaLabel:"Valor de referência do eixo X",anyXAxisValue:"Qualquer valor do eixo X",selectValuePlaceholder:"Selecionar valor"},trendSection:{title:"Tendência",toggle:"Tendência"},averageSection:{title:"Média",toggle:"Média",seriesLabel:"Série da linha de média",seriesPlaceholder:"Selecionar série",seriesAriaLabel:"Dropdown de séries para linha de média"},trendType:{label:"Tipo de tendência",placeholder:"Tipo de tendência",options:{linear:"Linear",exponential:"Exponencial",quadratic:"Quadrática",polynomial:"Polinomial",logarithmic:"Logarítmica",power:"Potência",loess:"Loess"}},valueInput:{percentagePlaceholder:"Percentagem",numberPlaceholder:"Número",percentageSymbol:"%"}},highlighting:{modeHelper:{title:"Modo de realce",hover:"Passe",toHighlight:"para realçar",anyElement:"qualquer elemento",escToExit:"para sair",esc:"ESC"},emptyState:"Sem opções de realce disponíveis",deleteAriaLabel:"Eliminar realce",highlightStyle:{tint:"Tonalidade",gray:"Cinzento"}},fineTunePanel:{toolbarButton:"Ajuste fino",detailSection:{title:"Detalhe",missingValues:"Valores em falta"},lineStyleSection:{title:"Estilo de linha",lineCurve:"Curva da linha",sharp:"Angulosa",smooth:"Suave"}},customThemeEditor:{patternDropdownAriaLabel:"Dropdown de padrões para série",patterns:{solid:"Sólido",pattern:"Padrão",dotted:"Pontilhado",dashed:"Tracejado",hatched:"Hachurado"},heatmapColorLabel:"Cor"},overlayMenu:{observation:"Observação",group:"Grupo",band:"Banda",axis:"Eixo",legend:"Legenda",gridLines:"Linhas de grelha",chart:"Gráfico"},accessibility:{toggleSection:e=>`Alternar secção ${e.title}`},graphyDefaults:{themeOptions:{light:"Claro",dark:"Escuro"}}},eo={titleEditor:{titlePlaceholder:"Sem título",subtitlePlaceholder:"Adicionar subtítulo"},toolbar:{formatting:{bold:"Negrito",italic:"Itálico",underline:"Sublinhado",link:"Ligação"},link:{ariaLabel:"Criar ligação",placeholder:"Escreva ou cole uma ligação...",submit:"Submeter",urlLabel:"URL da ligação",apply:"Aplicar ligação"},font:{label:"Tipo de letra",ariaLabel:"Família do tipo de letra"},heading:{label:"Nível de título",ariaLabel:"Estilo de texto",text:"Texto",caption:"Legenda",heading1:"Título 1",heading2:"Título 2",heading3:"Título 3"},textAlign:{left:"Alinhar à esquerda",center:"Alinhar ao centro",right:"Alinhar à direita"},color:{label:"Cor do texto"}},colorDropdown:{colors:"Cores",chartColors:"Cores do gráfico",custom:"Personalizado",opacity:"Opacidade",transparent:"Transparente",pickCustom:"Escolher cor personalizada",pickColor:"Escolher cor"},annotations:{differenceArrowToolbar:{label:"Opções da seta de diferença",labelKind:{ariaLabel:"Etiqueta",absoluteDifference:"Variação absoluta",relativeDifference:"Variação percentual",proportion:"Proporção",suspectValue:"Este valor divide por uma base igual a zero.",incomparableEnds:"As duas pontas medem quantidades diferentes, pelo que a diferença entre elas não tem significado."},color:"Cor da seta",size:{ariaLabel:"Tamanho",small:"Pequeno",medium:"Médio",large:"Grande"},swap:"Inverter sentido",remove:"Remover seta"},shapeToolbar:{label:"Opções da forma",color:"Cor da forma",border:{ariaLabel:"Contorno",none:"Nenhum",thin:"Fino (2px)",medium:"Médio (8px)",thick:"Espesso (16px)"},remove:"Remover forma",resize:{"top-left":"Redimensionar a partir do canto superior esquerdo","top-right":"Redimensionar a partir do canto superior direito","bottom-right":"Redimensionar a partir do canto inferior direito","bottom-left":"Redimensionar a partir do canto inferior esquerdo"}},arrowToolbar:{label:"Opções da seta",color:"Cor da seta",thickness:{ariaLabel:"Espessura",thin:"Fina",medium:"Média",thick:"Espessa"},startArrowhead:"Início da seta",endArrowhead:"Fim da seta",arrowhead:{lineArrow:"Ponta de seta",none:"Nenhuma"},lineStyle:{ariaLabel:"Estilo da linha",solid:"Sólida",dashed:"Tracejada",dotted:"Pontilhada"},sticker:"Efeito autocolante",remove:"Remover seta",moveEndpoint:{start:"Mover o início da seta",end:"Mover o fim da seta"}},textToolbar:{label:"Opções do texto",background:"Cor de fundo",color:"Cor do texto",font:{ariaLabel:"Tipo de letra",modern:"Moderno",fresh:"Fresco",timeless:"Intemporal",technical:"Técnico",fineliner:"Caneta fina"},fontSize:{ariaLabel:"Tamanho da letra",small:"Pequeno",medium:"Médio",large:"Grande",extraLarge:"Muito grande",huge:"Enorme"},align:{left:"Alinhar à esquerda",center:"Alinhar ao centro",right:"Alinhar à direita"},remove:"Remover texto",resize:{left:"Redimensionar a partir da esquerda",right:"Redimensionar a partir da direita"}},text:{editLabel:"Editar texto",placeholder:"Escreva algo"},baseMenu:{pinNumber:"Fixar número",unpinNumber:"Desafixar número",annotate:"Anotar",removeAnnotation:"Remover anotação",highlight:"Realçar",highlightWithLabel:e=>`Realçar ${e.label}`,removeHighlight:"Remover realce",differenceArrow:"Seta de diferença",addSticker:"Adicionar autocolante",removeSticker:"Remover autocolante"},textMenu:{title:"Anotar",placeholder:"Adicionar comentário",addButton:"Adicionar"},highlights:{menuTitle:"Realçar",labels:{bar:"Barra",barGroup:"Grupo",barStack:"Pilha",barSeries:"Série",line:"Linha",linePoint:"Ponto",lineSeries:"Série",scatterPoint:"Ponto",scatterSeries:"Série",pieSlice:"Fatia",pointOrBar:"Ponto / barra",lineOrSeries:"Linha / série"}},stickerMenu:{title:"Adicionar autocolante"},delete:"Eliminar",arrow:{thickness:{label:"Espessura",thin:"Fina",medium:"Média",thick:"Grossa"},arrowhead:{startPoint:"Ponto inicial",endPoint:"Ponto final",lineArrow:"Seta de linha",none:"Nenhuma"},lineStyle:{label:"Estilo de linha",solid:"Sólida",dotted:"Pontilhada"},stickerEffect:"Efeito de autocolante",toolbarAriaLabel:"Barra de ferramentas de seta livre",editorAriaLabel:"Editor de seta"},differenceArrow:{type:{proportion:"Proporção",difference:({absoluteDifference:e})=>`Diferença (${e})`,increase:({absoluteDifference:e})=>`Aumento (${e})`,decrease:({absoluteDifference:e})=>`Diminuição (${e})`,percentageChange:({percentageChange:e})=>`Variação percentual (${e})`,percentIncrease:({percentageChange:e})=>`Aumento percentual (${e})`,percentDecrease:({percentageChange:e})=>`Diminuição percentual (${e})`},size:{label:"Tamanho",small:"Pequeno",medium:"Médio",large:"Grande"},flipArrow:"Inverter seta",color:"Cor",toolbarAriaLabel:"Barra de ferramentas de seta de diferença",editorAriaLabel:"Editor de seta de diferença"},shape:{color:"Cor",border:{label:"Contorno",none:"Nenhum",thin:({value:e})=>`Fino (${e})`,medium:({value:e})=>`Médio (${e})`,thick:({value:e})=>`Grosso (${e})`}}}},to={common:Ja,editor:Qa,graph:eo},no={"en-GB":Xa,"en-US":Ya,ar:Ua,"pt-PT":to},ro=[no,l.dictionaries],In=({children:e,...t})=>(0,n.jsx)(l.IntlProvider,{dictionaries:ro,...t,children:e}),ao="data-variant",En=kn.Paragraph.extend({addAttributes(){return{variant:{default:null,parseHTML:e=>e.getAttribute("data-variant")??null,renderHTML:e=>e.variant?{[ao]:e.variant}:{}}}}}),oo=An.Extension.create({name:"preventBackspaceAcrossTitleBoundary",addOptions(){return{isTitleVisible:!0}},addKeyboardShortcuts(){return{Backspace:({editor:e})=>{if(!this.options.isTitleVisible)return!1;const{selection:t}=e.state;if(!t.empty)return!1;const{$from:r}=t;return r.depth!==1||r.parentOffset!==0?!1:r.index(0)===1}}}}),ut=()=>[Da.Text,Ee.UndoRedo,Oa.Heading.configure({levels:[1,2,3]}),Ma.Bold,_a.Italic,za.Underline,Fa.TextAlign.configure({types:["heading","paragraph"]}),Na.Link.configure({openOnClick:!1,autolink:!0}),je.TextStyle,je.Color,Ra.HardBreak],io=({titlePlaceholder:e,subtitlePlaceholder:t,isTitleVisible:r,isSubtitleVisible:a})=>[lo({isTitleVisible:r,isSubtitleVisible:a}),En,...ut(),je.FontFamily,oo.configure({isTitleVisible:r}),Ee.Placeholder.configure({showOnlyCurrent:!1,placeholder:({pos:o,editor:i})=>{if(r&&o===0)return e;const s=r?i.state.doc.firstChild?.nodeSize??-1:0;return a&&o===s?t:""}})],so=({placeholder:e})=>[Ce.Document,En,...ut(),je.FontFamily,Ee.Placeholder.configure({showOnlyCurrent:!1,placeholder:({pos:t})=>t===0?e:""})],lo=({isTitleVisible:e,isSubtitleVisible:t})=>e&&t?Ce.Document.extend({content:"block{2,}"}):Ce.Document,Mn="linear-gradient(to top right, transparent calc(50% - 1px), var(--graphy-alert) calc(50% - 1px), var(--graphy-alert) calc(50% + 1px), transparent calc(50% + 1px))",co="d0bl00";var Rn="d0bl03",uo="d0bl04",On="d0bl05",Xe="d0bl06",ho="d0bl07",po="d0bl08",_n="d0bl09",mo="d0bl0a",go="d0bl0b",xo="d0bl0c",vo="d0bl0d",fo="d0bl0e",bo="owf1yg0",So="owf1yg1",yo="owf1yg2",Co="owf1yg3",jo="owf1yg4",wo=.01,To=({value:e,onChange:t,label:r})=>(0,n.jsx)(X.Slider.Root,{className:bo,value:e,onValueChange:a=>t(a),min:0,max:1,step:wo,children:(0,n.jsx)(X.Slider.Control,{className:So,children:(0,n.jsxs)(X.Slider.Track,{className:yo,children:[(0,n.jsx)(X.Slider.Indicator,{className:Co}),(0,n.jsx)(X.Slider.Thumb,{className:jo,"aria-label":r})]})})}),Nn="transparent",Ze=$.CANVAS_COLOR_KEYS.map(e=>$.vars[e]),Ao=Object.fromEntries($.CANVAS_COLOR_KEYS.map(e=>[$.vars[e],e])),ko=e=>Ze.some(t=>Fn(t,e)),Po=({color:e,onChange:t,isOpen:r,onOpenChange:a,children:o,label:i,popupAttributes:s,opacity:c,onOpacityChange:d,hasTransparentOption:h=!1})=>{const u=l.useI18n(),m=Io(),g=h?[Nn,...Ze]:Ze,x=f=>{t(f),a(!1)};return(0,n.jsxs)(H.Popover.Root,{open:r,onOpenChange:a,children:[(0,n.jsx)(H.Popover.Trigger,{render:(0,n.jsx)(J.Toolbar.Button,{}),"aria-label":i??u("graph.toolbar.color.label"),className:co,onMouseDown:f=>f.preventDefault(),children:o??(0,n.jsx)("span",{className:"d0bl01",style:{background:e??"transparent"}})}),(0,n.jsx)(H.Popover.Portal,{container:l.resolvePortalContainer(),children:(0,n.jsx)(l.PortalThemeProvider,{children:(0,n.jsx)(H.Popover.Positioner,{sideOffset:6,align:"start",className:Rn,children:(0,n.jsxs)(H.Popover.Popup,{className:uo,onMouseDown:f=>f.preventDefault(),...s,children:[(0,n.jsx)(Et,{title:u("graph.colorDropdown.colors"),colors:g,currentColor:e,onPick:x}),m.length>0&&(0,n.jsx)(Et,{title:u("graph.colorDropdown.chartColors"),colors:m,currentColor:e,onPick:x}),(0,n.jsx)(Lo,{value:e??"#000000",onChange:t,popupAttributes:s}),c!==void 0&&d!==void 0&&(0,n.jsxs)("div",{className:"d0bl05",children:[(0,n.jsx)("div",{className:"d0bl06",children:u("graph.colorDropdown.opacity")}),(0,n.jsx)(To,{value:c,onChange:d,label:u("graph.colorDropdown.opacity")})]})]})})})})]})},Et=({title:e,colors:t,currentColor:r,onPick:a})=>{const o=l.useI18n();return(0,n.jsxs)("div",{className:On,children:[(0,n.jsx)("div",{className:Xe,children:e}),(0,n.jsx)("div",{className:ho,children:t.map(i=>(0,n.jsx)("button",{type:"button","aria-label":i==="transparent"?o("graph.colorDropdown.transparent"):i,className:po,"data-active":Fn(i,r),onMouseDown:s=>s.preventDefault(),onClick:()=>a(i),children:(0,n.jsx)("span",{className:_n,style:Dn(i)})},i))})]})},Lo=({value:e,onChange:t,popupAttributes:r})=>{const a=l.useI18n(),[o,i]=(0,v.useState)(!1),s=l.isValidCssColor(e)?e:"#000000",c=Eo(s);return(0,n.jsxs)(H.Popover.Root,{open:o,onOpenChange:i,children:[(0,n.jsxs)("div",{className:On,children:[(0,n.jsx)("div",{className:Xe,children:a("graph.colorDropdown.custom")}),(0,n.jsxs)(H.Popover.Trigger,{className:mo,onMouseDown:d=>d.preventDefault(),"aria-label":a("graph.colorDropdown.pickCustom"),children:[(0,n.jsx)("span",{className:_n,style:Dn(s)}),(0,n.jsx)("span",{className:go,children:c})]})]}),(0,n.jsx)(H.Popover.Portal,{container:l.resolvePortalContainer(),children:(0,n.jsx)(l.PortalThemeProvider,{children:(0,n.jsx)(H.Popover.Positioner,{side:"right",align:"start",sideOffset:18,className:Rn,children:(0,n.jsxs)(H.Popover.Popup,{className:xo,onMouseDown:d=>d.preventDefault(),...r,children:[(0,n.jsx)("div",{className:Xe,children:a("graph.colorDropdown.pickColor")}),(0,n.jsx)(Pt.HexColorPicker,{color:c,onChange:t,className:vo}),(0,n.jsx)(Pt.HexColorInput,{color:c,onChange:t,prefixed:!0,className:fo,onMouseDown:d=>d.stopPropagation()})]})})})})]})},Io=()=>{const e=l.useSceneSelector(t=>t.scales.color);return(0,v.useMemo)(()=>{if(!e||e.kind!=="visual")return[];const t=new Set;for(const r of e.domain){const a=e.map(r);typeof a=="string"&&t.add(a)}return[...t]},[e])},Dn=e=>e==="transparent"?{background:Mn,border:`1px solid ${$.vars.border100}`}:{background:e,border:`1px solid ${l.darkenCss(e,.1)}`},Eo=e=>{const{themeValues:t}=l.useThemeContext();if(l.isHex(e))return e.toUpperCase();const r=Ao[e];return r?t[r].toUpperCase():"#000000"},Fn=(e,t)=>t===null?!1:e.toLowerCase()===t.toLowerCase(),Mo="l9kff0",Ro="l9kff1",Oo="l9kff2",_o="xn24px0",No="xn24px1",Do="xn24px2",Fo=({children:e,popupAttributes:t})=>(0,n.jsx)(_.Menu.Portal,{container:l.resolvePortalContainer(),children:(0,n.jsx)(l.PortalThemeProvider,{children:(0,n.jsx)(_.Menu.Positioner,{side:"bottom",align:"start",sideOffset:6,className:_o,children:(0,n.jsx)(_.Menu.Popup,{className:No,onMouseDown:r=>r.preventDefault(),...t,children:e})})})}),zo=({children:e,isSelected:t=!1,isDisabled:r=!1,onClick:a})=>(0,n.jsx)(_.Menu.Item,{className:Do,"data-selected":t,disabled:r,onClick:a,children:e}),Bo=({className:e,...t})=>(0,n.jsx)(oe.Tooltip.Provider,{children:(0,n.jsx)(J.Toolbar.Root,{...t,className:(0,U.default)(Mo,e)})}),Ho=({className:e,...t})=>(0,n.jsx)(J.Toolbar.Group,{...t,className:(0,U.default)(Ro,e)}),Go=({className:e,...t})=>(0,n.jsx)(J.Toolbar.Separator,{...t,className:(0,U.default)(Oo,e)}),Vo=({children:e})=>{const t=l.resolvePortalContainer();return t===null?null:(0,Tn.createPortal)((0,n.jsx)(l.PortalThemeProvider,{children:e}),t)},B={Portal:Vo,Root:Bo,Group:Ho,Separator:Go,Button:J.Toolbar.Button,ColorPicker:Po,MenuPopup:Fo,MenuItem:zo},ue=e=>(0,n.jsx)(l.Icon,{...e,children:(0,n.jsx)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:(0,n.jsx)("path",{d:"m6 9 6 6 6-6"})})}),$o="'Noto Serif', Georgia, 'Times New Roman', serif, 'Apple Color Emoji', 'NotoColorEmoji'",Uo=`'Aeonik', 'Aeonik Fallback', ${l.DEFAULT_FONT_FAMILY}`,Wo="'PT Mono', 'Courier New', monospace, 'Apple Color Emoji', 'NotoColorEmoji'",qo="'Intruding Cat', cursive, 'Apple Color Emoji', 'NotoColorEmoji'",Ye=[{id:"modern",label:"Modern",preview:"Aa",fontFamily:l.DEFAULT_FONT_FAMILY},{id:"fresh",label:"Fresh",preview:"Aa",fontFamily:Uo},{id:"timeless",label:"Timeless",preview:"Aa",fontFamily:$o},{id:"technical",label:"Technical",preview:"00",fontFamily:Wo},{id:"fineliner",label:"Fineliner",preview:"Aa",fontFamily:qo}],Ko=e=>e?Ye.find(t=>t.fontFamily===e)??null:null,zn="_70l3rt0",Bn="_70l3rt1",Hn="_70l3rt3",Gn="_70l3rt4",Vn="_70l3rt5",Xo=({editor:e,currentFontFamily:t,isOpen:r,onOpenChange:a})=>{const o=l.useI18n(),i=Ko(t)??Ye[0],s=c=>{e.chain().focus().setFontFamily(c.fontFamily).run()};return(0,n.jsxs)(_.Menu.Root,{open:r,onOpenChange:a,children:[(0,n.jsxs)(_.Menu.Trigger,{render:(0,n.jsx)(J.Toolbar.Button,{}),"aria-label":o("graph.toolbar.font.ariaLabel"),className:zn,onMouseDown:c=>c.preventDefault(),children:[(0,n.jsx)("span",{className:Bn,style:{fontFamily:i?.fontFamily},children:i?.preview}),(0,n.jsx)(ue,{size:"sm"})]}),(0,n.jsx)(_.Menu.Portal,{container:l.resolvePortalContainer(),children:(0,n.jsx)(l.PortalThemeProvider,{children:(0,n.jsx)(_.Menu.Positioner,{side:"bottom",align:"start",sideOffset:6,className:Hn,children:(0,n.jsx)(_.Menu.Popup,{className:Gn,onMouseDown:c=>c.preventDefault(),children:Ye.map(c=>(0,n.jsx)(_.Menu.Item,{className:Vn,"data-selected":c.id===i?.id,onClick:()=>s(c),children:(0,n.jsx)("span",{style:{fontFamily:c.fontFamily},children:c.label})},c.id))})})})})]})},$n={id:"text",translationKey:"graph.toolbar.heading.text",previewFont:$.vars.fontTextEditorBody},Mt=[{id:"caption",translationKey:"graph.toolbar.heading.caption",previewFont:$.vars.fontTextEditorH6},$n,{id:"h3",translationKey:"graph.toolbar.heading.heading3",previewFont:$.vars.fontTextEditorH3},{id:"h2",translationKey:"graph.toolbar.heading.heading2",previewFont:$.vars.fontTextEditorH2},{id:"h1",translationKey:"graph.toolbar.heading.heading1",previewFont:$.vars.fontTextEditorH1}],Zo=({editor:e,activeStyle:t,isOpen:r,onOpenChange:a})=>{const o=l.useI18n(),i=Mt.find(s=>s.id===t)??$n;return(0,n.jsxs)(_.Menu.Root,{open:r,onOpenChange:a,children:[(0,n.jsxs)(_.Menu.Trigger,{render:(0,n.jsx)(J.Toolbar.Button,{}),"aria-label":o("graph.toolbar.heading.ariaLabel"),className:zn,onMouseDown:s=>s.preventDefault(),children:[(0,n.jsx)("span",{className:Bn,children:o(i.translationKey)}),(0,n.jsx)(ue,{size:"sm"})]}),(0,n.jsx)(_.Menu.Portal,{container:l.resolvePortalContainer(),children:(0,n.jsx)(l.PortalThemeProvider,{children:(0,n.jsx)(_.Menu.Positioner,{side:"bottom",align:"start",sideOffset:6,className:Hn,children:(0,n.jsx)(_.Menu.Popup,{className:Gn,onMouseDown:s=>s.preventDefault(),children:Mt.map(s=>(0,n.jsx)(_.Menu.Item,{className:Vn,"data-selected":s.id===i.id,onClick:()=>Yo(e,s.id),children:(0,n.jsx)(Jo,{font:s.previewFont,children:o(s.translationKey)})},s.id))})})})})]})},Yo=(e,t)=>{switch(t){case"caption":e.chain().focus().setNode("paragraph",{variant:"caption"}).run();return;case"text":e.chain().focus().setNode("paragraph",{variant:null}).run();return;case"h1":e.chain().focus().setHeading({level:1}).run();return;case"h2":e.chain().focus().setHeading({level:2}).run();return;case"h3":e.chain().focus().setHeading({level:3}).run()}},Jo=({font:e,children:t})=>(0,n.jsx)("span",{style:{font:e,margin:0},children:t}),Un=e=>(0,n.jsx)(l.Icon,{...e,children:(0,n.jsx)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:(0,n.jsx)("path",{d:"M20 6 9 17l-5-5"})})}),Qo=e=>(0,n.jsx)(l.Icon,{...e,children:(0,n.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),(0,n.jsx)("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})}),ei=e=>(0,n.jsx)(l.Icon,{...e,children:(0,n.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"M18 6 6 18"}),(0,n.jsx)("path",{d:"m6 6 12 12"})]})}),ti=e=>!e.content||e.content.length===0?!0:e.content.every(t=>!t.content||t.content.length===0),ni=e=>{const{$from:t}=e.state.selection,r=t.parent.textContent,a=t.parentOffset,o=t.start();let i=a;for(;i>0&&Rt(r[i-1]);)i-=1;let s=a;for(;s<r.length&&Rt(r[s]);)s+=1;return{from:o+i,to:o+s}},Rt=e=>e!==void 0&&/\S/.test(e),ri="fop13s0",ai="fop13s1",oi="fop13s2",ii="fop13s3",Ot="fop13s4",si=({editor:e,currentUrl:t,isActive:r,isOpen:a,onOpenChange:o})=>{const i=l.useI18n(),[s,c]=(0,v.useState)(""),d=(0,v.useRef)(null);(0,v.useEffect)(()=>{a&&c(t??"")},[a,t]);const h=()=>{li(e,s),o(!1)},u=()=>{c(""),o(!1)},m=x=>{c(x.target.value)},g=x=>{x.key==="Enter"&&(x.preventDefault(),h())};return(0,n.jsxs)(H.Popover.Root,{open:a,onOpenChange:o,children:[(0,n.jsx)(H.Popover.Trigger,{render:(0,n.jsx)(J.Toolbar.Button,{}),"aria-label":i("graph.toolbar.formatting.link"),"data-active":r,className:ri,onMouseDown:x=>x.preventDefault(),children:(0,n.jsx)(Qo,{})}),(0,n.jsx)(H.Popover.Portal,{container:l.resolvePortalContainer(),children:(0,n.jsx)(l.PortalThemeProvider,{children:(0,n.jsx)(H.Popover.Positioner,{sideOffset:6,align:"end",className:ai,children:(0,n.jsxs)(H.Popover.Popup,{className:oi,initialFocus:d,onMouseDown:x=>x.preventDefault(),children:[(0,n.jsx)("input",{ref:d,type:"url",value:s,placeholder:i("graph.toolbar.link.placeholder"),"aria-label":i("graph.toolbar.link.urlLabel"),className:ii,onMouseDown:x=>x.stopPropagation(),onChange:m,onKeyDown:g}),(0,n.jsx)("button",{type:"button","aria-label":i("common.cancel"),className:Ot,onClick:u,children:(0,n.jsx)(ei,{})}),(0,n.jsx)("button",{type:"button","aria-label":i("graph.toolbar.link.apply"),className:Ot,onClick:h,children:(0,n.jsx)(Un,{})})]})})})})]})},li=(e,t)=>{const r=t.trim(),{selection:a}=e.state;if(!r){e.chain().focus().extendMarkRange("link").unsetLink().run();return}if(!a.empty){e.chain().focus().setLink({href:r}).run();return}if(e.isActive("link")){e.chain().focus().extendMarkRange("link").setLink({href:r}).run();return}const o=ni(e);e.chain().focus().setTextSelection(o).setLink({href:r}).run()},Wn=e=>(0,n.jsx)(l.Icon,{...e,children:(0,n.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"M21 5H3"}),(0,n.jsx)("path",{d:"M17 12H7"}),(0,n.jsx)("path",{d:"M19 19H5"})]})}),qn=e=>(0,n.jsx)(l.Icon,{...e,children:(0,n.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"M21 5H3"}),(0,n.jsx)("path",{d:"M21 12H9"}),(0,n.jsx)("path",{d:"M21 19H7"})]})}),Kn=e=>(0,n.jsx)(l.Icon,{...e,children:(0,n.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"M21 5H3"}),(0,n.jsx)("path",{d:"M15 12H3"}),(0,n.jsx)("path",{d:"M17 19H3"})]})}),ci="_1d66w570",di="_1d66w571",ui=6,ie=({label:e,isActive:t,onToggle:r,children:a})=>{const o=i=>i.preventDefault();return(0,n.jsxs)(oe.Tooltip.Root,{children:[(0,n.jsx)(oe.Tooltip.Trigger,{render:(0,n.jsx)(Ba.Toggle,{render:(0,n.jsx)(J.Toolbar.Button,{}),pressed:t,onPressedChange:()=>r()}),"aria-label":e,className:ci,onMouseDown:o,children:a}),(0,n.jsx)(oe.Tooltip.Portal,{container:l.resolvePortalContainer(),children:(0,n.jsx)(l.PortalThemeProvider,{children:(0,n.jsx)(oe.Tooltip.Positioner,{sideOffset:ui,children:(0,n.jsx)(oe.Tooltip.Popup,{className:di,children:e})})})})]})},hi=({editor:e,activeAlignment:t="left"})=>{const r=l.useI18n();return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(ie,{label:r("graph.toolbar.textAlign.left"),isActive:t==="left",onToggle:()=>e.chain().focus().setTextAlign("left").run(),children:(0,n.jsx)(Kn,{})}),(0,n.jsx)(ie,{label:r("graph.toolbar.textAlign.center"),isActive:t==="center",onToggle:()=>e.chain().focus().setTextAlign("center").run(),children:(0,n.jsx)(Wn,{})}),(0,n.jsx)(ie,{label:r("graph.toolbar.textAlign.right"),isActive:t==="right",onToggle:()=>e.chain().focus().setTextAlign("right").run(),children:(0,n.jsx)(qn,{})})]})},pi="_1u34vl40",mi=({editor:e})=>({isBold:e?.isActive("bold")??!1,isItalic:e?.isActive("italic")??!1,isUnderline:e?.isActive("underline")??!1,isLink:e?.isActive("link")??!1,linkUrl:e?.getAttributes("link").href??null,color:e?.getAttributes("textStyle").color??null,fontFamily:e?.getAttributes("textStyle").fontFamily??null,fontSize:gi(e),textAlign:xi(e)}),gi=e=>e?e.isActive("heading",{level:1})?"h1":e.isActive("heading",{level:2})?"h2":e.isActive("heading",{level:3})?"h3":e.isActive("paragraph",{variant:"caption"})?"caption":"text":"text",xi=e=>e?e.isActive({textAlign:"center"})?"center":e.isActive({textAlign:"right"})?"right":"left":"left",vi=8,fi=8,bi=({editor:e})=>{const t=l.useI18n(),[r,a]=(0,v.useState)(!1),[o,i]=(0,v.useState)(null),s=o!==null,c=x=>f=>{i(f?x:null)},{refs:d,floatingStyles:h}=(0,se.useFloating)({placement:"top-start",strategy:"fixed",middleware:[(0,se.offset)(vi),(0,se.flip)(),(0,se.shift)({padding:fi})],whileElementsMounted:se.autoUpdate}),u=(0,v.useRef)(null),m=(0,Me.useEditorState)({editor:e,selector:mi}),g=(0,v.useCallback)(x=>{u.current=x,d.setFloating(x)},[d]);return(0,v.useEffect)(()=>{e&&d.setReference(e.view.dom)},[e,d]),(0,v.useEffect)(()=>{if(!e)return;const x=()=>a(!0),f=({event:b})=>{const{relatedTarget:w,currentTarget:T}=b,y=w instanceof Node&&u.current?.contains(w),k=w instanceof Node&&T instanceof Node&&T.contains(w);!y&&!k&&a(!1)};return e.on("focus",x),e.on("blur",f),()=>{e.off("focus",x),e.off("blur",f)}},[e]),!e||!r&&!s?null:(0,n.jsx)(B.Portal,{children:(0,n.jsxs)(B.Root,{ref:g,className:pi,style:h,children:[(0,n.jsxs)(B.Group,{children:[(0,n.jsx)(B.ColorPicker,{color:m?.color??null,onChange:x=>e.chain().setColor(x).run(),isOpen:o==="color",onOpenChange:c("color")}),(0,n.jsx)(Xo,{editor:e,currentFontFamily:m?.fontFamily??null,isOpen:o==="fontFamily",onOpenChange:c("fontFamily")})]}),(0,n.jsx)(B.Separator,{}),(0,n.jsx)(B.Group,{children:(0,n.jsx)(Zo,{editor:e,activeStyle:m?.fontSize??"text",isOpen:o==="fontSize",onOpenChange:c("fontSize")})}),(0,n.jsx)(B.Separator,{}),(0,n.jsxs)(B.Group,{children:[(0,n.jsx)(ie,{label:t("graph.toolbar.formatting.bold"),isActive:m?.isBold??!1,onToggle:()=>e.chain().focus().toggleBold().run(),children:(0,n.jsx)("strong",{children:"B"})}),(0,n.jsx)(ie,{label:t("graph.toolbar.formatting.italic"),isActive:m?.isItalic??!1,onToggle:()=>e.chain().focus().toggleItalic().run(),children:(0,n.jsx)("em",{children:"I"})}),(0,n.jsx)(ie,{label:t("graph.toolbar.formatting.underline"),isActive:m?.isUnderline??!1,onToggle:()=>e.chain().focus().toggleUnderline().run(),children:(0,n.jsx)("u",{children:"U"})})]}),(0,n.jsx)(B.Separator,{}),(0,n.jsx)(B.Group,{children:(0,n.jsx)(hi,{editor:e,activeAlignment:m?.textAlign})}),(0,n.jsx)(B.Separator,{}),(0,n.jsx)(B.Group,{children:(0,n.jsx)(si,{editor:e,currentUrl:m?.linkUrl??null,isActive:m?.isLink??!1,isOpen:o==="link",onOpenChange:c("link")})})]})})},Si="_1uy50v30",Xn=({editor:e,ariaLabel:t})=>(0,n.jsxs)("div",{className:Si,children:[(0,n.jsx)(bi,{editor:e}),(0,n.jsx)(Me.EditorContent,{editor:e,"aria-label":t})]}),yi=200,ht=({content:e,extensions:t,isEditable:r,onUpdate:a,updateDebounceMs:o=yi})=>{const i=(0,v.useRef)(_t(e)),s=(0,v.useRef)(i.current),c=l.useDebouncedCallback(h=>{s.current=h,a?.(h)},o),d=(0,Me.useEditor)({extensions:t,content:i.current,editable:r,immediatelyRender:!1,onUpdate:({editor:h})=>{const u=h.getJSON();if($e(s.current,u))return c.cancel();c.run(u)}});return(0,v.useEffect)(()=>{d?.setEditable(r)},[d,r]),(0,v.useEffect)(()=>{if(!d)return;const h=_t(e);$e(s.current,h)||(s.current=h,!$e(d.getJSON(),h)&&(c.cancel(),Ci(d,h)))},[d,e,c]),(0,v.useEffect)(()=>()=>c.flush(),[c]),d},_t=e=>e===null?{type:"doc",content:[]}:typeof e=="string"?{type:"doc",content:[{type:"paragraph",content:e?[{type:"text",text:e}]:[]}]}:e,Ci=(e,t)=>{const{from:r,to:a}=e.state.selection;e.commands.setContent(t,{emitUpdate:!1});const o=e.state.doc.content.size;e.commands.setTextSelection({from:Math.min(r,o),to:Math.min(a,o)})},$e=(e,t)=>JSON.stringify(we(e))===JSON.stringify(we(t)),we=e=>Array.isArray(e)?e.map(we):e===null||typeof e!="object"?e:Object.fromEntries(Object.entries(e).map(([t,r])=>[t,we(r)]).filter(([,t])=>!ji(t)).sort(([t],[r])=>String(t).localeCompare(String(r)))),ji=e=>e==null||typeof e=="object"&&Object.keys(e).length===0,wi=({caption:e,captionStyle:t})=>{const{dispatch:r}=l.useGraphCommands(),a=ht({content:e,extensions:(0,v.useMemo)(()=>so({placeholder:"Add caption"}),[]),isEditable:!0,onUpdate:o=>{const i=ti(o)?null:o;r(new p.SetContentCaptionCommand({caption:i}))}});return(0,n.jsx)("div",{"data-testid":"caption-editor",style:l.toHtmlTextCss(t),children:(0,n.jsx)(Xn,{editor:a,ariaLabel:"Chart caption"})})},Ti=e=>[Ce.Document,kn.Paragraph,...ut(),ki,Ee.Placeholder.configure({showOnlyCurrent:!1,placeholder:({pos:t})=>t===0?e:""})],Ai=({annotation:e})=>{const t=l.useI18n(),{dispatch:r}=l.useGraphCommands(),a=l.useEditorStore(),o=(0,v.useMemo)(()=>Ti(t("graph.annotations.text.placeholder")),[t]),i=ht({content:e.content,extensions:o,isEditable:!0,onUpdate:s=>{r(new p.UpdateAnnotationCommand({kind:"text",id:e.id,patch:{content:s}}))}});return(0,v.useEffect)(()=>{const{setCaretEditor:s}=a.getState();return s(i),()=>s(null)},[i,a]),(0,v.useEffect)(()=>{i?.commands.focus("end",{scrollIntoView:!1})},[i]),(0,n.jsx)(Me.EditorContent,{"aria-label":t("graph.annotations.text.editLabel"),className:l.editor,editor:i,"data-testid":"text-annotation-editor"})},Nt=e=>{const t=l.resolveRichTextFontFamily(e);return t===void 0?{}:{style:`font-family: ${t}`}},ki=An.Extension.create({name:"annotationTextStyleAttributes",addGlobalAttributes(){return[{types:["textStyle"],attributes:{fontFamily:{default:null,renderHTML:e=>Nt(e.fontFamily)},font:{default:null,renderHTML:e=>Nt(e.font)},fontSize:{default:null,renderHTML:e=>typeof e.fontSize=="number"&&Number.isFinite(e.fontSize)?{style:`font-size: calc(${e.fontSize}px * ${$.vars.textScale})`}:{}}}}]}}),Pi=3,Li=({title:e,isTitleVisible:t,subtitle:r,isSubtitleVisible:a})=>{const o=[];return t&&o.push({type:"heading",attrs:{level:Pi},content:Ei(e)}),a&&o.push(...Mi(r)),{type:"doc",content:o}},Ii=e=>{const[t,...r]=e.content??[];return{title:Ri(t?.content??[]),subtitle:Oi(r)}},pt=e=>({type:e.type??"text",...e.content!==void 0?{content:e.content.map(pt)}:{},...e.text!==void 0?{text:e.text}:{},...e.marks!==void 0?{marks:e.marks}:{},...e.attrs!==void 0?{attrs:e.attrs}:{}}),Ei=e=>e===null?[]:typeof e=="string"?e===""?[]:[{type:"text",text:e}]:e.type==="doc"&&e.content?e.content.flatMap(t=>t.content??[]):e.type==="text"||e.type==="hardBreak"?[e]:e.content??[],Mi=e=>e===null?[{type:"paragraph"}]:typeof e=="string"?e===""?[{type:"paragraph"}]:[{type:"paragraph",content:[{type:"text",text:e}]}]:e.type==="doc"&&e.content?e.content.length===0?[{type:"paragraph"}]:e.content.map(Dt):[Dt(e)],Dt=e=>e.type==="paragraph"?e:{type:"paragraph",content:e.content??[e]},Ri=e=>{if(e.length===0)return null;const[t]=e;return t&&e.length===1&&t.type==="text"&&(!t.marks||t.marks.length===0)?t.text??null:{type:"paragraph",content:e.map(pt)}},Oi=e=>{const t=e.filter(a=>(a.content??[]).length>0);if(t.length===0)return null;const[r]=t;if(r&&t.length===1&&r.type==="paragraph"){const a=r.content??[],[o]=a;if(o&&a.length===1&&o.type==="text"&&(!o.marks||o.marks.length===0))return o.text??null}return{type:"doc",content:t.map(pt)}},_i={fontFamily:"var(--uwf6lt0)",fontSize:"var(--uwf6lt1)",fontWeight:"var(--uwf6lt2)",lineHeight:"var(--uwf6lt3)",textColor:"var(--uwf6lt4)"},Ni="uwf6lt5",Di=({title:e,isTitleVisible:t,isSubtitleVisible:r,subtitle:a,headingStyle:o,subtitleStyle:i})=>{const{dispatch:s}=l.useGraphCommands(),c=(0,v.useMemo)(()=>io({titlePlaceholder:"Untitled",subtitlePlaceholder:"Untitled",isTitleVisible:t,isSubtitleVisible:r}),[t,r]),d=ht({content:(0,v.useMemo)(()=>Li({title:e,isTitleVisible:t,subtitle:a,isSubtitleVisible:r}),[e,t,a,r]),extensions:c,isEditable:!0,onUpdate:h=>{const u=Ii(h);t&&s(new p.SetContentTitleCommand({title:u.title})),r&&s(new p.SetContentSubtitleCommand({subtitle:u.subtitle}))}});return(0,n.jsx)("div",{className:Ni,"data-testid":"title-editor",style:{...l.toHtmlTextCss(o),...l.assignTextStyleVars(_i,i)},children:(0,n.jsx)(Xn,{editor:d,ariaLabel:"Chart title and subtitle"})})},Fi={Title:Di,Caption:wi,TextAnnotation:Ai},Zn=(e,t)=>{const{offsetWidth:r}=e;return r<=0||t<=0?1:t/r},Yn=e=>Zn(e,e.getBoundingClientRect().width),Ft=(e,t)=>{const{offsetWidth:r,offsetHeight:a}=e;return r<=0||a<=0?t:{width:r,height:a}},Re=e=>e.offset+e.strokeWidth,zt="http://www.w3.org/2000/svg",Bt=new WeakMap,zi=(e,t)=>{const r=Bi(e);r.setAttribute("d",t);const{x:a,y:o,width:i,height:s}=r.getBBox();return{x:a,y:o,width:i,height:s}},Bi=e=>{const t=Bt.get(e);if(t?.isConnected)return t;const r=e.createElementNS(zt,"svg");r.setAttribute("aria-hidden","true"),r.style.cssText="position:absolute;width:0;height:0;overflow:hidden;visibility:hidden;pointer-events:none";const a=e.createElementNS(zt,"path");return r.append(a),e.body.append(r),Bt.set(e,a),a},Hi=(e,t)=>{const{panelRect:r,look:a,readGridLineWidth:o,measurePathBox:i}=t,s=Re(a);switch(e.kind){case"observations":return Ue([...e.parts,...e.vertex===null?[]:[e.vertex]].flatMap(c=>Gi(c,i)).map(c=>({...c,x:c.x+r.x,y:c.y+r.y})),s);case"guide":return Ue(e.shapes.map(c=>c.kind==="box"?c.rect:l.growRect($i(c),o(c.axis)/2)),s);case"graph":return Ue([{x:0,y:0,...e.frameSize}],-a.offset);default:return e}},Gi=(e,t)=>e.kind==="boxes"?e.boxes:Vi(e.shapes,t),Vi=(e,t)=>{const r=[],a=new Map;for(const o of e){if(o.kind==="dots"){r.push(...o.centers.map(c=>l.growRect({...c,width:0,height:0},o.size/2)));continue}if(o.pathData==="")continue;const i=o.kind==="stroke"?o.width/2:0;if(!o.pathData.trimStart().startsWith("M")){r.push(l.growRect(t(o.pathData),i));continue}const s=a.get(i)??[];s.push(o.pathData),a.set(i,s)}for(const[o,i]of a)r.push(l.growRect(t(i.join("")),o));return r},$i=e=>{switch(e.kind){case"line":return{x:Math.min(e.from.x,e.to.x),y:Math.min(e.from.y,e.to.y),width:Math.abs(e.to.x-e.from.x),height:Math.abs(e.to.y-e.from.y)};case"ring":return{x:e.center.x-e.radius,y:e.center.y-e.radius,width:e.radius*2,height:e.radius*2}}},Ue=(e,t)=>{const r=e.filter(({width:a,height:o})=>a>0||o>0);return r.length===0?null:l.growRect((0,p.getBoundingRect)(r),t)};var Ui=(e,{coordSystem:t,panelRect:r})=>{if(e.kind!=="observations")return null;const a=e.vertex===null?e.parts:[...e.parts,e.vertex],o=a.reduce((s,c)=>Math.max(s,c.rows.length),0),i=o===1&&e.vertex===null;return o===0||i||o>1e3?null:a.flatMap(s=>Wi(s,t,r).map(c=>({...c,x:c.x+r.x,y:c.y+r.y})))},Wi=(e,t,r)=>(0,p.measureObservationsBoxes)({layer:{...e.layer,data:e.layer.data.take(e.rows)},coordSystem:t,panelSize:r,radialExtent:"outerEnd"}),qi=.5,Ki={top:e=>-e.y,right:e=>e.x+e.width,bottom:e=>e.y+e.height,left:e=>-e.x},Xi=(e,t,r)=>e===null||!Zi(e)?{top:Je(t),right:Qe(t),bottom:Je(t),left:Qe(t)}:{top:ge(e,t,"top",r),right:ge(e,t,"right",r),bottom:ge(e,t,"bottom",r),left:ge(e,t,"left",r)},ge=(e,t,r,a)=>{const o=Ki[r],i=r==="left"||r==="right",s=f=>i?f.y:f.x,c=f=>i?f.y+f.height:f.x+f.width;let d=-1/0;for(const f of e)d=Math.max(d,o(f));const h=d-Math.max(a,qi);let u=1/0,m=-1/0;for(const f of e)o(f)<h||(u=Math.min(u,s(f)),m=Math.max(m,c(f)));const g=i?Qe(t):Je(t),x={from:(0,ee.default)(u-a,g.from,g.to),to:(0,ee.default)(m+a,g.from,g.to)};return x.from<x.to?x:g},Zi=e=>{const[t]=e;return t!==void 0&&e.some(r=>!l.areRectsEqual(r,t))},Je=e=>({from:e.x,to:e.x+e.width}),Qe=e=>({from:e.y,to:e.y+e.height}),Yi=(e,{frameElement:t,panelRect:r,look:a})=>{const o=l.useEditorStore(),i=l.useStyleReaderTree(),s=l.useSceneSelector(m=>m.coordSystem),c=(0,v.useRef)(new Map),d=e?.target??null,h=e?.outline??null;(0,v.useLayoutEffect)(()=>{if(d===null||h===null)return;const m=c.current,g=new Map,f=Hi(h,{panelRect:r,look:a,readGridLineWidth:T=>l.readGridLineStyle(i,T).strokeWidth,measurePathBox:T=>{const y=m.get(T)??zi(t.ownerDocument,T);return g.set(T,y),y}});if(c.current=g,f===null){o.getState().setSelectedOutline(null);return}const b=Xi(Ui(h,{coordSystem:s,panelRect:r}),f,Re(a)),w=Yn(t);o.getState().setSelectedOutline({target:d,frame:f,frameSpans:b,frameScale:w})},[o,i,s,d,h,t,r,a]);const u=e!==null;(0,v.useLayoutEffect)(()=>u?()=>o.getState().setSelectedOutline(null):void 0,[o,u])},Ji="var(--_10d2ycx0)",Qi="_10d2ycx1",es="_10d2ycx2",Ht=({pathData:e,shouldAnimateTransitions:t,source:r,...a})=>t?(0,n.jsx)(ts,{pathData:e,source:r,...a}):(0,n.jsx)("path",{d:e,...a}),ts=({pathData:e,source:t,...r})=>{const a=l.useSvgPathMorph(e,l.DEFAULT_SPRING_TRANSITION,t);return(0,n.jsx)(Ea.motion.path,{d:a,...r})},ns="var(--n5vlnq0)",rs="data-edit-outline-stroke",et=e=>({[rs]:"",style:(0,Ie.assignInlineVars)({[ns]:`${e}px`})});var Gt=(e,t)=>{if(e.kind==="observations"&&t.kind==="observations"){if(e.layerId!==t.layerId||e.scope!==t.scope)return!1;const r=e.parts[0]?.rows[0];return r!==void 0&&(t.parts[0]?.rows.includes(r)??!1)}return e.kind==="guide"&&t.kind==="guide"?(0,p.areEditTargetsEqual)(e.target,t.target):e.kind==="graph"&&t.kind==="graph"},as=(e,t)=>{const r=Math.max(e.width,8),a=Math.max(e.height,8),o=Math.max(0,e.x+e.width/2-r/2),i=Math.max(0,e.y+e.height/2-a/2),s=Math.min(t.width,e.x+e.width/2+r/2),c=Math.min(t.height,e.y+e.height/2+a/2);return{x:o,y:i,width:Math.max(0,s-o),height:Math.max(0,c-i)}},os=[],is=e=>{const{layers:t,parsingLocale:r}=l.useSceneSelector((0,Y.useShallow)(m=>({layers:m.layers,parsingLocale:m.config.parsingLocale}))),a=l.useEditorState(m=>m.editTargetUnderPointer),o=a?.kind==="observations"?a.observations:null,i=o===null?void 0:(0,p.findLayerById)(t,o.layerId),s=o?.target.scope??null,c=o===null||i===void 0?null:(0,p.readRowScopeKey)(i,o.target.scope,o.observationIndex),d=(0,v.useMemo)(()=>i===void 0||s===null||c===null?null:ss(t,i,s,c),[t,i,s,c]),h=(0,v.useMemo)(()=>d!==null&&e!==null&&Gt(d,e),[d,e]),u=o!==null&&i!==void 0&&ls(o,i,r)?o.observationIndex:null;return(0,v.useMemo)(()=>{switch(a?.kind){case"observations":{const m=d?.parts[0];if(d===null||m===void 0)return null;const g=u===null?null:{layer:m.layer,rows:[u]};return h?g===null?null:{...d,parts:os,vertex:g}:{...d,vertex:g}}case"axis":case"legend":case"grid":{const m={kind:"guide",key:(0,p.readEditTargetKey)(a.target),target:a.target};return e!==null&&Gt(m,e)?null:m}default:return null}},[a,d,h,u,e])},ss=(e,t,r,a)=>{const o=[{layer:t,rows:(0,p.readRowsAtScopeKey)(t,r,a)}];for(const i of(0,p.findCompanionLayers)(t,e)){const s=(0,p.readCompanionRowsAtScopeKey)(i,t,r,a);s.length>0&&o.push({layer:i,rows:s})}return{kind:"observations",key:JSON.stringify([t.id,r,a]),layerId:t.id,scope:r,parts:o,vertex:null}},ls=({observationIndex:e,target:t,isOnObservation:r},a,o)=>r&&t.scope==="series"&&(0,p.buildObservationsTarget)({layer:a,observationIndex:e,scope:"data-point",parsingLocale:o})!==null,cs=({frameElement:e,target:t,coordType:r,legendDisplays:a})=>{const o=e.getBoundingClientRect(),i=[...e.querySelectorAll(ds(t))],s=c=>{const d=c.getBoundingClientRect();return{x:d.left-o.left,y:d.top-o.top,width:d.width,height:d.height}};switch(t.kind){case"axis":{const c=i.map(s);return r==="polar"||c.length===0?We(c):We([(0,p.getBoundingRect)(c)])}case"legend":return We([...us(i.filter(c=>!hs(c)))].flatMap(([c,d])=>a[c]==="direct"?d.map(s):[(0,p.getBoundingRect)(d.map(s))]));case"grid":return i.flatMap(c=>{const d=l.readStampedEditTargetInStack([c],e);if(d?.kind!=="grid"||d.target.axis==="both")return[];const{axis:h}=d.target;return t.axis==="both"||h===t.axis?[ps(c,s(c),h)]:[]})}},ds=e=>{const t=`[${l.EDIT_TARGET_KIND_ATTRIBUTE}="${e.kind}"]`;return e.kind!=="axis"?t:`${t}[${l.EDIT_TARGET_AXIS_ATTRIBUTE}="${e.axis}"]`},us=e=>{const t=new Map;for(const r of e){const a=l.readLegendItemAddress(r);a!==null&&t.set(a.legendIndex,[...t.get(a.legendIndex)??[],r])}return t},hs=e=>e.closest(l.LEGEND_OVERFLOW_CONTROL_SELECTOR)!==null,We=e=>e.map(t=>({kind:"box",rect:t})),ps=(e,{x:t,y:r,width:a,height:o},i)=>e.querySelector("circle")!==null?{kind:"ring",axis:i,center:{x:t+a/2,y:r+o/2},radius:a/2}:a<1||o<1?a<o?{kind:"line",axis:i,from:{x:t+a/2,y:r},to:{x:t+a/2,y:r+o}}:{kind:"line",axis:i,from:{x:t,y:r+o/2},to:{x:t+a,y:r+o/2}}:ms(e.querySelector("line"))?{kind:"line",axis:i,from:{x:t,y:r},to:{x:t+a,y:r+o}}:{kind:"line",axis:i,from:{x:t,y:r+o},to:{x:t+a,y:r}},ms=e=>{const t=r=>Number(e?.getAttribute(r)??0);return(t("x2")-t("x1"))*(t("y2")-t("y1"))>=0},gs=[],xs=(e,{frameElement:t,frameSize:r,panelRect:a,shouldAnimateTransitions:o})=>{const i=l.useSceneSelector(b=>b.coordSystem),s=l.useGeomRendererResolver(),c=l.useGeomReaderTree(),d=fs(e.kind==="guide"?e.target:null,{frameElement:t,frameSize:r}),h=vs(t,r),u=(0,v.useMemo)(()=>({coordSystem:i,panelRect:a,resolveRenderer:s,geomReaders:c}),[i,a,s,c]),m=e.kind==="observations"?e.parts:null,g=e.kind==="observations"?e.vertex:null,x=(0,v.useMemo)(()=>m?.map(b=>Vt(b,u,o))??gs,[m,u,o]),f=(0,v.useMemo)(()=>g===null?null:Vt(g,u,!1),[g,u]);return(0,v.useMemo)(()=>{switch(e.kind){case"observations":return{kind:"observations",parts:x,vertex:f};case"guide":return{kind:"guide",target:e.target,shapes:d};case"graph":return{kind:"graph",frameSize:h}}},[e,x,f,d,h])},vs=(e,t)=>{const[r,a]=(0,v.useState)(()=>Ft(e,t));return(0,v.useLayoutEffect)(()=>{a(o=>{const i=Ft(e,{width:t.width,height:t.height});return o.width===i.width&&o.height===i.height?o:i})},[e,t.width,t.height]),r},Vt=({layer:e,rows:t},{coordSystem:r,panelRect:a,resolveRenderer:o,geomReaders:i},s)=>{const c={...e,data:e.data.take(t)},d=o(e.geom,r.type);return d?.getEditOutlineShapes===void 0?{kind:"boxes",layer:e,rows:t,boxes:(0,p.measureObservationsBoxes)({layer:c,coordSystem:r,panelSize:a}).map(h=>as(h,a))}:{kind:"declared",layer:e,rows:t,shapes:d.getEditOutlineShapes({layer:c,sourceLayer:e,coordSystem:r,panelRect:a,styleReaders:i(e),shouldAnimateTransitions:s})}},fs=(e,{frameElement:t,frameSize:r})=>{const a=l.useSceneSelector(u=>u.coordSystem.type),o=l.useSceneSelector((0,Y.useShallow)(u=>u.guides.legends.drawn.map(m=>m.display))),i=l.useSceneSelector(u=>e===null?null:u),[s,c]=(0,v.useState)([]),d=l.useLatestRef(e),h=(0,v.useRef)(!1);return(0,v.useLayoutEffect)(()=>{const u=d.current;if(u===null)return;const m=()=>{const g=cs({frameElement:t,target:u,coordType:a,legendDisplays:o}),x=Yn(t);c(g.map(f=>bs(f,1/x)))};if(h.current){const g=requestAnimationFrame(m);return()=>cancelAnimationFrame(g)}h.current=!0,m()},[t,d,a,o,i,r.width,r.height]),s},bs=(e,t)=>{switch(e.kind){case"box":{const{x:r,y:a,width:o,height:i}=e.rect;return{kind:"box",rect:{x:r*t,y:a*t,width:o*t,height:i*t}}}case"line":return{...e,from:{x:e.from.x*t,y:e.from.y*t},to:{x:e.to.x*t,y:e.to.y*t}};case"ring":return{...e,center:{x:e.center.x*t,y:e.center.y*t},radius:e.radius*t}}},Ss=()=>{const e=l.useGraphSelection()[0]??null,{layers:t,parsingLocale:r}=l.useSceneSelector((0,Y.useShallow)(a=>({layers:a.layers,parsingLocale:a.config.parsingLocale})));return(0,v.useMemo)(()=>e===null?null:ys(e,t,r),[e,t,r])},ys=(e,t,r)=>{switch(e.kind){case"observations":return Cs(e,t,r);case"legend":case"axis":case"grid":return{kind:"guide",key:(0,p.readEditTargetKey)(e),target:e};case"graph":return{kind:"graph",key:"graph"};default:return null}},Cs=(e,t,r)=>{const a=(0,p.findLayerById)(t,e.layerId);if(a===void 0)return null;const o=(0,p.resolveObservationsTarget)({layer:a,target:e,parsingLocale:r});if(o.length===0)return null;const i=[{layer:a,rows:o}];for(const s of(0,p.findCompanionLayers)(a,t)){const c=(0,p.resolveObservationsTarget)({layer:s,host:a,target:e,parsingLocale:r});c.length>0&&i.push({layer:s,rows:c})}return{kind:"observations",key:(0,p.readEditTargetKey)(e),layerId:e.layerId,scope:e.scope,parts:i,vertex:null}},js=["x","y"],ws=(0,v.memo)(function({frameElement:t,frameSize:r,panelRect:a,shouldAnimateTransitions:o}){const i=l.useResolvedStyle(p.resolveEditOutlineStyle,l.useStyleReaderTree()),s=Ss(),c=is(s);if(s===null&&c===null)return null;const d={frameElement:t,frameSize:r,panelRect:a,shouldAnimateTransitions:o};return(0,n.jsxs)("svg",{className:Qi,width:r.width,height:r.height,"aria-hidden":!0,"data-testid":"edit-outline",children:[c!==null&&(0,n.jsx)($t,{part:"hover",target:c,look:i.hover,...d},c.key),s!==null&&(0,n.jsx)($t,{part:"selected",target:s,look:i.selected,...d},s.key)]})}),$t=({part:e,target:t,look:r,frameSize:a,panelRect:o,frameElement:i,shouldAnimateTransitions:s})=>{const c=(0,v.useId)(),d=`${c}-shapes`,h=`${c}-hole`,u=xs(t,{frameElement:i,frameSize:a,panelRect:o,shouldAnimateTransitions:s});return Yi(e==="selected"?{target:t,outline:u}:null,{frameElement:i,panelRect:o,look:r}),(0,n.jsxs)("g",{"data-edit-outline":e,"data-testid":`edit-outline-${e}`,children:[(0,n.jsxs)("defs",{children:[(0,n.jsx)("g",{id:d,className:es,children:(0,n.jsx)(As,{outline:u,look:r,panelRect:o})}),(0,n.jsxs)("mask",{id:h,maskUnits:"userSpaceOnUse",x:"-100%",y:"-100%",width:"300%",height:"300%",children:[(0,n.jsx)("rect",{x:"-100%",y:"-100%",width:"300%",height:"300%",fill:"white"}),(0,n.jsx)("use",{href:`#${d}`,style:Ut("black",r.offset)})]})]}),(0,n.jsx)("use",{href:`#${d}`,mask:`url(#${h})`,style:Ut(r.stroke,Re(r)),"data-testid":`edit-outline-${e}-ring`}),t.kind==="observations"&&(0,n.jsx)(Es,{target:t,look:r,panelRect:o})]})},Ut=(e,t)=>({fill:e,stroke:e,...(0,Ie.assignInlineVars)({[Ji]:`${2*t}px`})}),Ts=(e,t,r)=>{const a=r.offset+Re(r);return l.buildRoundedRectPath(l.growRect({x:0,y:0,...e},-a),Math.max(0,t-a))},As=({outline:e,look:t,panelRect:r})=>{const a=l.useStyleReaderTree().graph().get("cornerRadius"),{cornerRadius:o}=t;switch(e.kind){case"observations":return(0,n.jsxs)("g",{transform:`translate(${r.x} ${r.y})`,children:[e.parts.map(i=>(0,n.jsx)(Wt,{part:i,borderRadius:o},i.layer.id)),e.vertex!==null&&(0,n.jsx)(Wt,{part:e.vertex,borderRadius:o},`vertex-${e.vertex.rows.join()}`)]});case"guide":return(0,n.jsx)(Ls,{target:e.target,shapes:e.shapes,borderRadius:o});case"graph":return(0,n.jsx)("path",{d:Ts(e.frameSize,a,t)})}},Wt=(0,v.memo)(function({part:t,borderRadius:r}){return t.kind==="boxes"?(0,n.jsx)(Ps,{boxes:t.boxes,borderRadius:r}):(0,n.jsx)(ks,{shapes:t.shapes,layer:t.layer})}),ks=({shapes:e,layer:t})=>e.map((r,a)=>{const o=r.kind==="dots"||r.key===void 0?String(a):`${r.kind}:${r.key}`;switch(r.kind){case"region":return r.pathData===""?null:(0,n.jsx)(Ht,{pathData:r.pathData,fillRule:r.fillRule,shouldAnimateTransitions:r.shouldAnimateTransitions??!1,source:t,"data-geom":t.geom},o);case"stroke":return r.pathData===""?null:(0,n.jsx)(Ht,{pathData:r.pathData,shouldAnimateTransitions:r.shouldAnimateTransitions??!1,source:t,"data-geom":t.geom,...et(r.width)},o);case"dots":return r.centers.length===0?null:(0,n.jsx)("path",{d:l.buildDotsPath(r.centers),"data-geom":t.geom,...et(r.size)},o)}}),Ps=({boxes:e,borderRadius:t})=>{const r=e.map(a=>l.buildRoundedRectPath(a,t)).join("");return r===""?null:(0,n.jsx)("path",{d:r,"data-testid":"edit-outline-boxes"})},Ls=({target:e,shapes:t,borderRadius:r})=>{const a=l.useStyleReaderTree();if(e.kind==="grid")return js.map(i=>{const s=t.map(c=>Is(c,i)).join("");return s===""?null:(0,n.jsx)("path",{d:s,...et(l.readGridLineStyle(a,i).strokeWidth)},i)});const o=t.map(i=>i.kind==="box"?l.buildRoundedRectPath(i.rect,r):"").join("");return o===""?null:(0,n.jsx)("path",{d:o})},Is=(e,t)=>{if(e.kind==="box"||e.axis!==t)return"";switch(e.kind){case"line":return`M${e.from.x},${e.from.y}L${e.to.x},${e.to.y}`;case"ring":{const{center:r,radius:a}=e,o=`${r.x},${r.y-a}`;return`M${o}A${a},${a} 0 0 1 ${`${r.x},${r.y+a}`}A${a},${a} 0 0 1 ${o}`}}},Es=({target:e,look:t,panelRect:r})=>{const a=l.useSceneSelector(s=>s.coordSystem),o=e.parts[0];if(e.scope!=="x-value"||o===void 0||o.layer.highlight?.strategy!=="overlay-anchor")return null;const i=Ms(o);return i===null?null:(0,n.jsx)("svg",{x:r.x,y:r.y,width:r.width,height:r.height,overflow:"visible",children:(0,n.jsx)("line",{...l.readCrosshairLine(a,i,r),stroke:t.stroke,strokeWidth:t.strokeWidth,strokeDasharray:"4 3",strokeLinecap:"round","data-testid":"edit-outline-band-guide"})})},Ms=({layer:e,rows:t})=>{for(const r of t){const a=e.data.getAt(r),o=a===null?null:(0,p.getX)(a),i=a===null?null:(0,p.getY)(a);if(o!==null&&i!==null)return{x:o,y:i}}return null},Rs="data-graphy-chart-chrome",Os="data-graphy-chart-menu",mt={[Os]:""},Oe=e=>({[Rs]:e}),ye=(e,t)=>e instanceof Element&&e.closest(`[data-graphy-chart-chrome="${CSS.escape(t)}"]`)!==null,Jn=e=>e instanceof Element&&e.closest("[data-graphy-chart-menu]")!==null,tt=e=>e instanceof Element&&e.closest("[data-graphy-chart-chrome]")!==null,Qn=(e,t,r)=>r!==null&&(0,p.isPointWithinEditMenuTrigger)({x:e.clientX-t.x,y:e.clientY-t.y},r),de=(e,t,r)=>e instanceof Node&&(t.contains(e)||ye(e,r)),_s="cml7ha0",er=(0,v.createContext)(null),Ns=({children:e})=>{const{chartId:t}=l.useGraphContext(),[r]=(0,v.useState)(l.resolvePortalContainer),[a,o]=(0,v.useState)(null);return r===null?null:(0,n.jsxs)(n.Fragment,{children:[(0,Tn.createPortal)((0,n.jsx)("div",{ref:o,className:_s,...Oe(t)}),r),(0,n.jsx)(er.Provider,{value:a,children:e})]})},_e=()=>(0,v.useContext)(er),Ds="kwvn4c0",Fs="kwvn4c1",tr=(e,t)=>({contextElement:e,getBoundingClientRect:()=>{const r=e.getBoundingClientRect(),a=Zn(e,r.width);return new DOMRect(r.left+t.x*a,r.top+t.y*a,t.width*a,t.height*a)}}),zs=({side:e,boundary:t,spans:r,anchor:a,isRightToLeft:o})=>{if(!Bs(e))return 0;const i=r[e];if(e==="left"||e==="right")return qt(i.from-t.y,a.height,t.height);const s=o?t.x+t.width-i.to:i.from-t.x;return qt(s,a.width,t.width)},nr=()=>{const[e,t]=(0,v.useState)(!1);return(0,v.useEffect)(()=>{t(!0)},[]),e},Bs=e=>l.SIDE_KEYS.some(t=>t===e),qt=(e,t,r)=>r===0?0:e*t/r,Hs={x:8,y:8},Gs={side:"flip",align:"shift",fallbackAxisSide:"end"},Vs=({frameElement:e,boundary:t,spans:r,clearance:a=Hs,onEscape:o,children:i})=>{const s=_e(),c=nr(),[d,h]=(0,v.useState)(null),u=(0,v.useRef)(null);(0,v.useLayoutEffect)(()=>()=>{d?.contains(document.activeElement)&&e.focus({preventScroll:!0})},[d,e]);const{x:m,y:g,width:x,height:f}=t,b=(0,v.useMemo)(()=>({box:{x:m,y:g,width:x,height:f},spans:r}),[m,g,x,f,r]),w=(0,v.useMemo)(()=>tr(e,b.box),[e,b]),T=(y,k)=>{y||(k.cancel(),k.reason==="escape-key"&&o())};return(0,n.jsx)(H.Popover.Root,{open:c,modal:!1,onOpenChange:T,children:(0,n.jsx)(H.Popover.Portal,{container:s,children:(0,n.jsx)(l.PortalThemeProvider,{children:(0,n.jsx)(H.Popover.Positioner,{ref:u,anchor:w,side:"right",align:"start",sideOffset:({side:y})=>y==="top"||y==="bottom"?a.y:a.x,alignOffset:({side:y,anchor:k})=>zs({side:y,boundary:b.box,spans:b.spans,anchor:k,isRightToLeft:$s(u.current)}),collisionAvoidance:Gs,sticky:!0,className:Ds,...mt,children:(0,n.jsx)(H.Popover.Popup,{ref:h,className:Fs,finalFocus:!1,"data-testid":"anchored-popover",children:i})})})})})},$s=e=>e!==null&&getComputedStyle(e).direction==="rtl",Us="_1xgvyvc0",Ws=(e,t)=>{switch(e.kind){case"observations":return qs(e.scope,t);case"guide":return Ks(e.target.kind,t);case"graph":return t("editor.overlayMenu.chart");default:return e}},qs=(e,t)=>{switch(e){case"data-point":return t("editor.overlayMenu.observation");case"series":return t("editor.overlayMenu.group");case"x-value":return t("editor.overlayMenu.band");default:return e}},Ks=(e,t)=>{switch(e){case"axis":return t("editor.overlayMenu.axis");case"legend":return t("editor.overlayMenu.legend");case"grid":return t("editor.overlayMenu.gridLines");default:return e}},Xs=({frameElement:e})=>{const t=l.useI18n(),{selectionStore:r}=l.useGraphContext(),a=l.useEditorState(s=>s.selectedOutline===null?null:Ws(s.selectedOutline.target,t)),o=l.useTargetBoundary();if(a===null||o===null)return null;const i=()=>{r.getState().clearSelection()};return(0,n.jsx)(Vs,{frameElement:e,boundary:o.frame,spans:o.frameSpans,onEscape:i,children:(0,n.jsx)(H.Popover.Title,{className:Us,"data-testid":"overlay-menu-title",children:a})})},Zs=({frameRect:e})=>{const{targetBoundaryStore:t}=l.useGraphContext(),r=l.useEditorState(s=>s.selectedOutline),{left:a,top:o}=e,i=(0,v.useMemo)(()=>{if(r===null)return null;const{frame:s,frameSpans:c,frameScale:d}=r;return{frame:s,client:{x:a+s.x*d,y:o+s.y*d,width:s.width*d,height:s.height*d},frameSpans:c,clientSpans:{top:xe(c.top,a,d),right:xe(c.right,o,d),bottom:xe(c.bottom,a,d),left:xe(c.left,o,d)}}},[r,a,o]);return(0,v.useLayoutEffect)(()=>{t.getState().setBoundary(i)},[t,i]),(0,v.useLayoutEffect)(()=>()=>t.getState().setBoundary(null),[t]),null},xe=(e,t,r)=>({from:t+e.from*r,to:t+e.to*r}),rr=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("path",{fill:"currentColor",fillOpacity:".8",d:"M2.333 3h11.334v8.667c-2 0-4 .333-5.667 2.333-2-2-3.667-2.333-5.667-2.333z",opacity:".12"}),(0,n.jsx)("path",{fill:"currentColor",fillOpacity:".8",fillRule:"evenodd",d:"M3.325 3.156a.836.836 0 0 0-.836.836v6.832c0 .462.375.836.836.836h2.131a.5.5 0 0 1 .352.145L8 13.975l2.193-2.17a.5.5 0 0 1 .352-.145h2.13a.84.84 0 0 0 .836-.836V3.992a.84.84 0 0 0-.836-.836zm-1.836.836c0-1.014.822-1.836 1.836-1.836h9.35c1.015 0 1.836.825 1.836 1.836v6.832a1.84 1.84 0 0 1-1.836 1.836H10.75l-2.398 2.374a.5.5 0 0 1-.704 0L5.25 12.66H3.325a1.836 1.836 0 0 1-1.836-1.836z",clipRule:"evenodd"}),(0,n.jsx)("path",{fill:"currentColor",fillOpacity:".8",fillRule:"evenodd",d:"M8 4.505a.5.5 0 0 1 .5.5v2.172h2.171a.5.5 0 0 1 0 1H8.5v2.171a.5.5 0 0 1-1 0V8.177H5.329a.5.5 0 0 1 0-1H7.5V5.005a.5.5 0 0 1 .5-.5",clipRule:"evenodd"})]});var ar="efjmb40",or="efjmb41",ne="efjmb42",re="efjmb43",Ys="efjmb44",Js="efjmb45",Qs=new Set(["item-press","escape-key","outside-press","close-press","sibling-open","trigger-press"]),gt=({label:e,icon:t,onOpened:r,children:a})=>{const o=_e(),[i,s]=(0,v.useState)(!1),c=(d,h)=>{d?(s(!0),r?.()):Qs.has(h.reason)&&s(!1)};return(0,n.jsxs)(Q.Menu.SubmenuRoot,{open:i,onOpenChange:c,children:[(0,n.jsx)(el,{label:e,icon:t}),(0,n.jsx)(Q.Menu.Portal,{container:o,children:(0,n.jsx)(l.PortalThemeProvider,{children:(0,n.jsx)(Q.Menu.Positioner,{side:"right",align:"start",sideOffset:4,className:ar,...mt,children:(0,n.jsx)(Q.Menu.Popup,{className:or,children:a})})})})]})},el=({label:e,icon:t})=>(0,n.jsxs)(Q.Menu.SubmenuTrigger,{className:ne,openOnHover:!1,children:[t,(0,n.jsx)("span",{className:re,children:e}),(0,n.jsx)("span",{className:Js,children:(0,n.jsx)(ue,{size:"sm"})})]}),tl="_1qe7q450",nl="_1qe7q451",rl="_1qe7q452",al=({label:e,placeholder:t,addLabel:r,at:a,onRequestClose:o})=>{const i=(0,v.useRef)(null),[s,c]=(0,v.useState)(""),{dispatch:d}=l.useGraphCommands(),h=s.trim(),u=()=>{h.length!==0&&(d(new p.AddAnnotationCommand({kind:"comment",annotation:{at:a,content:ol(h)}})),o())},m=f=>{f.key==="Enter"&&(f.preventDefault(),u()),f.key!=="Escape"&&f.stopPropagation()},g=f=>{c(f.target.value)},x=()=>{requestAnimationFrame(()=>i.current?.focus())};return(0,n.jsx)(gt,{label:e,icon:(0,n.jsx)(rr,{}),onOpened:x,children:(0,n.jsxs)("div",{className:tl,children:[(0,n.jsx)("input",{ref:i,className:nl,value:s,placeholder:t,onChange:g,onKeyDown:m}),(0,n.jsx)("button",{type:"button",className:rl,disabled:h.length===0,onClick:u,children:r})]})})},ol=e=>({type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e}]}]}),il=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 15 14",...e,children:(0,n.jsx)("path",{d:"M14.0146 5.20703C14.2118 5.40459 14.2121 5.72447 14.0146 5.92187L12.3291 7.6084C12.2343 7.70313 12.1047 7.75579 11.9707 7.75586C11.8369 7.75573 11.708 7.70291 11.6133 7.6084L9.92773 5.92187C9.73024 5.72438 9.73031 5.40457 9.92773 5.20703C10.1253 5.0095 10.445 5.0095 10.6426 5.20703L11.4658 6.03027L11.4658 1.68652L7.75586 1.68652L7.75586 12.6455C7.75563 12.9246 7.5291 13.1512 7.25 13.1514L2.5293 13.1514C2.2501 13.1514 2.02367 12.9247 2.02344 12.6455L2.02344 5.00781C0.868958 4.77348 0.000106647 3.7528 -1.10559e-07 2.5293C-4.95071e-08 1.13259 1.13261 9.74645e-05 2.5293 -5.23256e-07C3.92588 0.000220668 5.05859 1.13267 5.05859 2.5293C5.05849 3.75251 4.1892 4.77219 3.03516 5.00684L3.03516 12.1396L6.74414 12.1396L6.74414 1.18066C6.74414 0.901394 6.97076 0.674939 7.25 0.674804L11.9707 0.674805C12.2499 0.674939 12.4766 0.901394 12.4766 1.18066L12.4766 6.03027L13.2998 5.20703C13.4973 5.0095 13.8171 5.0095 14.0146 5.20703ZM4.04687 2.5293C4.04687 1.69137 3.36717 1.01194 2.5293 1.01172C1.69132 1.01182 1.01172 1.6913 1.01172 2.5293C1.01184 3.36719 1.6914 4.04678 2.5293 4.04687C3.36709 4.04665 4.04675 3.36712 4.04687 2.5293ZM14.5 11.2969C14.4998 12.6935 13.3673 13.8262 11.9707 13.8262C10.5742 13.826 9.4416 12.6934 9.44141 11.2969C9.44141 9.90018 10.574 8.7677 11.9707 8.76758C13.3675 8.76758 14.5 9.90011 14.5 11.2969ZM13.4883 11.2969C13.4883 10.4588 12.8088 9.7793 11.9707 9.7793C11.1327 9.77942 10.4531 10.4589 10.4531 11.2969C10.4533 12.1347 11.1329 12.8143 11.9707 12.8145C12.8086 12.8145 13.4881 12.1348 13.4883 11.2969Z",fill:"currentColor",fillOpacity:"0.8"})}),sl="relative-difference",ll=({label:e,layer:t,at:r,onRequestClose:a})=>{const{dispatch:o}=l.useGraphCommands(),i=l.useSceneSelector(d=>d.coordSystem),s=(0,v.useMemo)(()=>(0,p.inferDifferenceArrowEndpoints)({layer:t,at:r,coordSystem:i}),[t,r,i]);if(s===null)return null;const c=()=>{o(new p.AddAnnotationCommand({kind:"differenceArrow",annotation:{...p.DIFFERENCE_ARROW_DEFAULTS,...s,label:sl}})),a()};return(0,n.jsxs)(_.Menu.Item,{className:ne,onClick:c,children:[(0,n.jsx)(il,{}),(0,n.jsx)("span",{className:re,children:e})]})};function cl(e,t){if(e.type==="polar"&&!dl(t))return[{scope:"series",labelKey:"pieSlice"}];const r=(0,p.hasMultipleGroups)(t.data,t.mapping);switch(t.geom){case"bar":{const a=[{scope:"data-point",labelKey:"bar"}];if(r){const o=t.position==="stack"||t.position==="fill";a.push({scope:"x-value",labelKey:o?"barStack":"barGroup"}),a.push({scope:"series",labelKey:"barSeries"})}return a}case"line":case"area":{const a=[{scope:"data-point",labelKey:"linePoint"}];return r&&a.push({scope:"series",labelKey:"lineSeries"}),a}case"point":{const a=[{scope:"data-point",labelKey:"scatterPoint"}];return r&&a.push({scope:"series",labelKey:"scatterSeries"}),a}default:return[]}}var dl=e=>{const t=(0,p.readVariableName)(e.mapping.x);return t!==null&&t!==p.CONSTANT_VARIABLES.x},ul=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("rect",{width:"3.2",height:"7.704",y:"8.296",fill:"currentColor",fillOpacity:"0.3",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"4.741",x:"8.533",y:"11.259",fill:"currentColor",fillOpacity:"0.3",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"11.259",x:"4.267",y:"4.741",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"16",x:"12.8",fill:"currentColor",fillOpacity:"0.3",rx:".533"})]}),hl=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("rect",{width:"3.2",height:"7.704",y:"8.296",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"4.741",x:"8.533",y:"11.259",fill:"currentColor",fillOpacity:"0.3",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"11.259",x:"4.267",y:"4.741",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"16",x:"12.8",fill:"currentColor",fillOpacity:"0.3",rx:".533"})]}),pl=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("rect",{width:"3.2",height:"7.704",y:"8.296",fill:"currentColor",fillOpacity:"0.3",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"4.741",x:"8.533",y:"11.259",fill:"currentColor",fillOpacity:"0.3",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"11.259",x:"4.267",y:"4.741",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"16",x:"12.8",fill:"currentColor",fillOpacity:".8",rx:".533"})]}),ml=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.3",d:"M0 13.037h4.267v2.445a.52.52 0 0 1-.519.518H.518A.52.52 0 0 1 0 15.482zM0 7.037c0-.286.232-.518.519-.518h3.23c.286 0 .518.232.518.518v5.408H0z"}),(0,n.jsx)("path",{fill:"currentColor",fillOpacity:".8",d:"M5.867 7.704h4.266v7.778a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.518-.518zM5.867 7.111h4.266V4.074a.52.52 0 0 0-.518-.518h-3.23a.52.52 0 0 0-.518.518z"}),(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.3",d:"M11.733 10.074H16v5.408a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.519-.518zM11.733 9.481H16V.52A.52.52 0 0 0 15.482 0h-3.23a.52.52 0 0 0-.519.519z"})]}),gl=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:".8",strokeWidth:"1.163",d:"m-1.618 15.96 9.118-5.3 11 2.34"}),(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.6",stroke:"currentColor",strokeOpacity:"0.3",d:"M8 13a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z"}),(0,n.jsx)("rect",{width:"9.795",height:"6",x:"3",y:"2",fill:"currentColor",fillOpacity:"0.3",rx:"1.513"}),(0,n.jsx)("path",{fill:"currentColor",fillOpacity:".8",d:"M5.29 6.62a1.3 1.3 0 0 1-.424-.075 1 1 0 0 1-.373-.244 1.2 1.2 0 0 1-.262-.45 2.1 2.1 0 0 1-.096-.699q0-.389.082-.693.083-.304.238-.514a1.05 1.05 0 0 1 .374-.322q.22-.11.492-.11.285 0 .505.112a.973.973 0 0 1 .526.744h-.54a.5.5 0 0 0-.17-.277.5.5 0 0 0-.321-.105.54.54 0 0 0-.485.273q-.168.273-.17.75h.021a.8.8 0 0 1 .188-.223.92.92 0 0 1 .569-.195.91.91 0 0 1 .813.477q.125.222.123.509 0 .297-.136.536a1 1 0 0 1-.383.372 1.15 1.15 0 0 1-.571.134m-.003-.443a.54.54 0 0 0 .288-.078.57.57 0 0 0 .2-.211.6.6 0 0 0 .073-.299.6.6 0 0 0-.07-.294.54.54 0 0 0-.484-.285.55.55 0 0 0-.403.173.596.596 0 0 0 .108.914.53.53 0 0 0 .288.08M6.88 6.579v-.396l1.05-1.03q.15-.15.25-.27a1 1 0 0 0 .151-.229.6.6 0 0 0 .05-.236.432.432 0 0 0-.244-.405.6.6 0 0 0-.258-.056q-.15 0-.261.062a.43.43 0 0 0-.175.173.56.56 0 0 0-.06.267H6.86q0-.288.132-.5a.9.9 0 0 1 .362-.33q.231-.117.532-.117.303 0 .534.114.23.114.358.312a.8.8 0 0 1 .128.452.9.9 0 0 1-.065.334q-.065.164-.229.363-.162.2-.456.483l-.522.53v.021h1.318v.458zM10.57 6.62a1.3 1.3 0 0 1-.423-.075 1 1 0 0 1-.373-.244 1.2 1.2 0 0 1-.263-.45 2.1 2.1 0 0 1-.096-.699q0-.389.083-.693t.238-.514a1.05 1.05 0 0 1 .374-.322q.219-.11.492-.11.285 0 .505.112a.973.973 0 0 1 .526.744h-.54a.5.5 0 0 0-.17-.277.5.5 0 0 0-.322-.105.54.54 0 0 0-.484.273q-.168.273-.17.75h.02a.8.8 0 0 1 .188-.223.92.92 0 0 1 .569-.195.91.91 0 0 1 .814.477q.125.222.123.509 0 .297-.136.536a1 1 0 0 1-.383.372 1.15 1.15 0 0 1-.572.134m-.002-.443a.54.54 0 0 0 .288-.078.57.57 0 0 0 .2-.211.6.6 0 0 0 .073-.299.6.6 0 0 0-.071-.294.54.54 0 0 0-.483-.285.54.54 0 0 0-.403.173.597.597 0 0 0 .107.914.53.53 0 0 0 .289.08"})]}),xl=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("path",{stroke:"currentColor",strokeOpacity:"0.8",strokeLinecap:"round",strokeLinejoin:"bevel",strokeWidth:".993",d:"M1.5 12 6 6.5l4 3.5 4-5.5"}),(0,n.jsx)("circle",{cx:"1.493",cy:"11.993",r:".993",fill:"currentColor",fillOpacity:"0.8"}),(0,n.jsx)("circle",{cx:"5.993",cy:"6.493",r:".993",fill:"currentColor",fillOpacity:"0.8"}),(0,n.jsx)("circle",{cx:"9.993",cy:"9.993",r:".993",fill:"currentColor",fillOpacity:"0.8"}),(0,n.jsx)("circle",{cx:"13.993",cy:"4.493",r:".993",fill:"currentColor",fillOpacity:"0.8"})]}),vl=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("rect",{width:"16",height:"16",fill:"currentColor",fillOpacity:"0.3",rx:"8"}),(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.8",d:"m7.999 16 .412-.01A8 8 0 0 0 8 0z"}),(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.6",d:"M15.999 8a8 8 0 0 1-7.588 7.989l-.412.01V8z"})]}),fl=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 3.598 7.215)"}),(0,n.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 6.681 11.327)"}),(0,n.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 9.251 7.215)"}),(0,n.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:".8",rx:"1.028",transform:"matrix(-1 0 0 1 10.28 2.59)"}),(0,n.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 13.877 6.187)"}),(0,n.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 2.056 12.869)"}),(0,n.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 15.933 .533)"})]}),bl=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:".8",rx:"1.028",transform:"matrix(-1 0 0 1 3.598 7.215)"}),(0,n.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:".8",rx:"1.028",transform:"matrix(-1 0 0 1 6.681 11.327)"}),(0,n.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 9.251 7.215)"}),(0,n.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:".8",rx:"1.028",transform:"matrix(-1 0 0 1 10.28 2.59)"}),(0,n.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 13.877 6.187)"}),(0,n.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 2.056 12.869)"}),(0,n.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 15.933 .533)"})]}),Sl={bar:ul,barGroup:hl,barStack:ml,barSeries:pl,linePoint:gl,lineSeries:xl,scatterPoint:fl,scatterSeries:bl,pieSlice:vl},ir=({labelKey:e})=>{const t=Sl[e];return(0,n.jsx)(t,{})},sr=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("path",{opacity:"0.12",d:"M15 4.66667L12.3333 2L2.33334 12L5.00001 14.6667L15 4.66667Z",fill:"currentColor",fillOpacity:"0.8"}),(0,n.jsx)("path",{d:"M5.01683 15.3331C4.84407 15.3343 4.67292 15.2997 4.51421 15.2314C4.3555 15.1632 4.21268 15.0627 4.09476 14.9365L3.88656 14.7283L3.62877 14.8968L3.19253 15.3331H0L2.24072 13.0923L2.03251 12.8445C1.89423 12.7191 1.78392 12.566 1.70875 12.3952C1.63359 12.2244 1.59526 12.0396 1.59626 11.853C1.59579 11.6818 1.63078 11.5124 1.69904 11.3554C1.76729 11.1984 1.86733 11.0573 1.99285 10.9409L11.2036 1.73012C11.3215 1.60384 11.4643 1.5034 11.623 1.43514C11.7817 1.36688 11.9529 1.33228 12.1257 1.33353C12.2969 1.33245 12.4665 1.36716 12.6236 1.43546C12.7807 1.50375 12.9218 1.60412 13.0378 1.73012L15.1496 3.92126C15.2748 4.03899 15.3745 4.1811 15.4427 4.33882C15.5108 4.49654 15.546 4.66655 15.546 4.83837C15.546 5.01019 15.5108 5.1802 15.4427 5.33792C15.3745 5.49564 15.2748 5.63774 15.1496 5.75548L5.93889 14.9662C5.81806 15.0866 5.67403 15.1812 5.51552 15.2443C5.35702 15.3074 5.18736 15.3376 5.01683 15.3331ZM2.48858 11.9125L5.01683 14.4407L9.47843 9.97913L6.95019 7.4608L2.48858 11.9125ZM7.68388 6.72712L10.2022 9.24544L14.644 4.80367L12.1257 2.28534L7.68388 6.72712Z",fill:"currentColor",fillOpacity:"0.8"})]}),yl=({label:e,options:t,onSelect:r})=>{const a=l.useI18n();return(0,n.jsx)(gt,{label:e,icon:(0,n.jsx)(sr,{}),children:t.map(o=>(0,n.jsxs)(Q.Menu.Item,{className:ne,onClick:()=>r(o.scope),children:[(0,n.jsx)(ir,{labelKey:o.labelKey}),(0,n.jsx)("span",{className:re,children:a(`graph.annotations.highlights.labels.${o.labelKey}`)})]},o.scope))})},Cl=({label:e,layer:t,observation:r,highlights:a,onRequestClose:o})=>{const i=l.useI18n(),{dispatch:s}=l.useGraphCommands(),c=l.useSceneSelector(x=>x.coordSystem),d=(0,v.useMemo)(()=>(0,p.buildObservationPredicate)(t,r),[t,r]),h=(0,v.useMemo)(()=>cl(c,t),[c,t]),u=(0,v.useMemo)(()=>{const x=new Set(a.map(f=>f.scope));return h.filter(f=>!x.has(f.scope))},[h,a]),[m]=u;if(d===null||m===void 0)return null;const g=x=>{s(new p.AddHighlightCommand({predicate:d,scope:x,layerId:t.id})),o()};if(u.length===1){const x=h.length===1?e:i("graph.annotations.baseMenu.highlightWithLabel",{label:i(`graph.annotations.highlights.labels.${m.labelKey}`)});return(0,n.jsxs)(Q.Menu.Item,{className:ne,onClick:()=>g(m.scope),children:[(0,n.jsx)(ir,{labelKey:m.labelKey}),(0,n.jsx)("span",{className:re,children:x})]})}return(0,n.jsx)(yl,{label:e,options:u,onSelect:g})},jl="_1aafi1g0",wl="_1aafi1g1",lr=({children:e})=>(0,n.jsxs)("span",{className:jl,"aria-hidden":"true",children:[e,(0,n.jsx)("span",{className:wl})]}),Tl=({label:e,highlights:t,onRequestClose:r})=>{const{dispatch:a}=l.useGraphCommands(),o=t.at(-1);if(o===void 0)return null;const i=()=>{a(new p.RemoveHighlightCommand({id:o.id})),r()};return(0,n.jsxs)(_.Menu.Item,{className:ne,onClick:i,children:[(0,n.jsx)(lr,{children:(0,n.jsx)(sr,{})}),(0,n.jsx)("span",{className:re,children:e})]})},Al=(e,t)=>{const r=l.useSceneSelector(o=>o.spec.highlights),a=l.useSceneSelector(o=>o.config.parsingLocale);return(0,v.useMemo)(()=>(0,p.findHighlightsAtObservation)({layer:e,highlights:r,observation:t,parsingLocale:a}),[e,r,t,a])},cr=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("path",{opacity:"0.12",d:"M13.5948 4.29016C13.8724 6.22367 12.5301 8.01618 10.5966 8.29384C8.66309 8.57151 6.87058 7.22918 6.59292 5.29567C6.31525 3.36216 7.65758 1.56965 9.59109 1.29198C11.5246 1.01432 13.3171 2.35665 13.5948 4.29016Z",fill:"currentColor",fillOpacity:"0.8"}),(0,n.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.71886 3.51052C6.25611 1.3626 8.43287 0.0568985 10.5808 0.594151C12.7287 1.1314 14.0344 3.30817 13.4972 5.45609C13.0316 7.31748 11.3347 8.54637 9.49237 8.49145L7.50898 12.492C7.46485 12.581 7.40179 12.6548 7.32702 12.7108C7.20005 12.8073 7.03703 12.8532 6.87248 12.8303C6.80957 12.822 6.74697 12.8038 6.68687 12.7749C6.39369 12.6342 6.26689 12.2915 6.3923 11.9963L7.63393 7.97371C6.10249 7.10872 5.27136 5.29962 5.71886 3.51052ZM10.2785 1.80253C8.79799 1.4322 7.29756 2.33222 6.92723 3.81277C6.55691 5.29332 7.45692 6.79375 8.93747 7.16408C10.418 7.5344 11.9185 6.63439 12.2888 5.15384C12.6591 3.67329 11.7591 2.17285 10.2785 1.80253Z",fill:"currentColor",fillOpacity:"0.8"}),(0,n.jsx)("path",{d:"M5.42977 11.1572C5.70072 11.104 5.8772 10.8411 5.82393 10.5702C5.77067 10.2992 5.50784 10.1227 5.23688 10.176C4.31848 10.3565 3.57421 10.6423 3.04695 11.0266C2.51409 11.4149 2.16666 11.936 2.16666 12.557C2.16666 13.0322 2.41215 13.4327 2.74425 13.7433C3.07553 14.0531 3.52776 14.3091 4.04484 14.5137C5.08193 14.9239 6.48048 15.1666 7.99999 15.1666C9.5195 15.1666 10.9181 14.9239 11.9551 14.5137C12.4722 14.3091 12.9244 14.0531 13.2557 13.7433C13.5878 13.4327 13.8333 13.0322 13.8333 12.557C13.8333 11.936 13.4859 11.4149 12.953 11.0266C12.4258 10.6423 11.6815 10.3565 10.7631 10.176C10.4921 10.1227 10.2293 10.2992 10.176 10.5702C10.1228 10.8411 10.2993 11.104 10.5702 11.1572C11.4079 11.3219 11.997 11.5672 12.364 11.8347C12.7255 12.0981 12.8333 12.3496 12.8333 12.557C12.8333 12.6643 12.7803 12.8187 12.5727 13.013C12.3642 13.2079 12.0354 13.4065 11.5873 13.5838C10.6941 13.9371 9.426 14.1666 7.99999 14.1666C6.57398 14.1666 5.30586 13.9371 4.41267 13.5838C3.9646 13.4065 3.63578 13.2079 3.4273 13.013C3.21964 12.8187 3.16666 12.6643 3.16666 12.557C3.16666 12.3496 3.2745 12.0981 3.63595 11.8347C4.00299 11.5672 4.59206 11.3219 5.42977 11.1572Z",fill:"currentColor",fillOpacity:"0.8"})]}),kl=({label:e,at:t,onRequestClose:r})=>{const{dispatch:a}=l.useGraphCommands(),o=()=>{a(new p.AddAnnotationCommand({kind:"pinnedNumber",annotation:{at:t}})),r()};return(0,n.jsxs)(_.Menu.Item,{className:ne,onClick:o,children:[(0,n.jsx)(cr,{}),(0,n.jsx)("span",{className:re,children:e})]})},dr=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("path",{opacity:"0.12",d:"M1.33334 8.00016C1.33334 4.31826 4.31811 1.3335 8.00001 1.3335C11.6819 1.3335 14.6667 4.31826 14.6667 8.00016C14.6667 11.6821 11.6819 14.6668 8.00001 14.6668C4.31811 14.6668 1.33334 11.6821 1.33334 8.00016Z",fill:"currentColor",fillOpacity:"0.8"}),(0,n.jsx)("path",{d:"M5.7328 9.69963C5.56696 9.47884 5.25352 9.43429 5.03273 9.60013C4.81193 9.76598 4.76739 10.0794 4.93323 10.3002C5.63175 11.2302 6.74548 11.8333 7.99993 11.8333C9.25438 11.8333 10.3681 11.2302 11.0666 10.3002C11.2325 10.0794 11.1879 9.76598 10.9671 9.60013C10.7463 9.43429 10.4329 9.47884 10.2671 9.69963C9.74929 10.3889 8.92657 10.8333 7.99993 10.8333C7.07329 10.8333 6.25057 10.3889 5.7328 9.69963Z",fill:"currentColor",fillOpacity:"0.8"}),(0,n.jsx)("path",{d:"M6.66668 6.66658C6.66668 7.03478 6.3682 7.33325 6.00001 7.33325C5.63182 7.33325 5.33334 7.03478 5.33334 6.66658C5.33334 6.29839 5.63182 5.99992 6.00001 5.99992C6.3682 5.99992 6.66668 6.29839 6.66668 6.66658Z",fill:"currentColor",fillOpacity:"0.8"}),(0,n.jsx)("path",{d:"M10 7.33325C10.3682 7.33325 10.6667 7.03478 10.6667 6.66658C10.6667 6.29839 10.3682 5.99992 10 5.99992C9.63182 5.99992 9.33334 6.29839 9.33334 6.66658C9.33334 7.03478 9.63182 7.33325 10 7.33325Z",fill:"currentColor",fillOpacity:"0.8"}),(0,n.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.00001 0.833252C4.04197 0.833252 0.833344 4.04188 0.833344 7.99992C0.833344 11.958 4.04197 15.1666 8.00001 15.1666C11.9581 15.1666 15.1667 11.958 15.1667 7.99992C15.1667 4.04188 11.9581 0.833252 8.00001 0.833252ZM14.1667 7.99992C14.1667 11.4057 11.4058 14.1666 8.00001 14.1666C4.59425 14.1666 1.83334 11.4057 1.83334 7.99992C1.83334 4.59416 4.59425 1.83325 8.00001 1.83325C11.4058 1.83325 14.1667 4.59416 14.1667 7.99992Z",fill:"currentColor",fillOpacity:"0.8"})]}),ur={pinnedNumber:{icon:cr,labelKey:"graph.annotations.baseMenu.unpinNumber"},comment:{icon:rr,labelKey:"graph.annotations.baseMenu.removeAnnotation"},sticker:{icon:dr,labelKey:"graph.annotations.baseMenu.removeSticker"},image:null},Pl=e=>(0,p.isObservationAttachmentKind)(e.kind)&&ur[e.kind]!==null,Ll=({attachment:e,onRequestClose:t})=>{const r=l.useI18n(),{dispatch:a}=l.useGraphCommands(),{icon:o,labelKey:i}=ur[e.kind],s=()=>{a(new p.RemoveAnnotationCommand({id:e.annotation.id})),t()};return(0,n.jsxs)(_.Menu.Item,{className:ne,onClick:s,children:[(0,n.jsx)(lr,{children:(0,n.jsx)(o,{})}),(0,n.jsx)("span",{className:re,children:r(i)})]})},Il="ceeojg0",El="ceeojg1",Ml="ceeojg2",Rl=({label:e,at:t,onRequestClose:r})=>{const{dispatch:a}=l.useGraphCommands(),o=i=>{a(new p.AddAnnotationCommand({kind:"sticker",annotation:{at:{anchorType:"observation",...t},sticker:i}})),r()};return(0,n.jsx)(gt,{label:e,icon:(0,n.jsx)(dr,{}),children:(0,n.jsx)("div",{className:Il,children:Object.entries(l.STICKER_ASSETS).map(([i,s])=>(0,n.jsx)(Q.Menu.Item,{className:El,"aria-label":i,onClick:()=>o(i),children:(0,n.jsx)("img",{className:Ml,src:s.src,alt:i})},i))})})},Ol=({interaction:e,frameElement:t,panelRect:r})=>{const a=l.useEditorStore(),o=l.useEditorState(d=>d.menuTrigger);if(e.kind!=="menu"||o===null)return null;const i=()=>{a.getState().releaseInteraction("menu")},{center:s,radius:c}=o;return(0,n.jsx)(_l,{frameElement:t,trigger:{x:r.x+s.x-c,y:r.y+s.y-c,width:c*2,height:c*2},layer:e.anchor.layer,at:e.anchor.at,observation:e.anchor.observation,onClose:i})},_l=({frameElement:e,trigger:t,layer:r,at:a,observation:o,onClose:i})=>{const s=l.useI18n(),c=_e(),d=l.useSceneSelector(j=>j.spec.annotations),h=l.useSceneSelector(j=>j.config.parsingLocale),u=nr(),{x:m,y:g,width:x,height:f}=t,b=(0,v.useMemo)(()=>tr(e,{x:m,y:g,width:x,height:f}),[e,m,g,x,f]),w=(0,p.findObservationAttachment)(d,a,(0,v.useMemo)(()=>(0,p.createObservationAnchorParser)(r,h),[r,h])),T=w!==null&&Pl(w)?w:null,y=Al(r,o),k=(j,I)=>{!j&&Nl(I.reason)&&i()};return(0,n.jsx)(_.Menu.Root,{open:u,modal:!1,onOpenChange:k,children:(0,n.jsx)(_.Menu.Portal,{container:c,children:(0,n.jsx)(l.PortalThemeProvider,{children:(0,n.jsx)(_.Menu.Positioner,{anchor:b,side:"right",align:"start",sideOffset:8,className:ar,...mt,children:(0,n.jsxs)(_.Menu.Popup,{className:or,"data-testid":"observation-menu",children:[T!==null&&(0,n.jsx)(Ll,{attachment:T,onRequestClose:i}),(0,n.jsx)(Tl,{label:s("graph.annotations.baseMenu.removeHighlight"),highlights:y,onRequestClose:i}),(0,n.jsx)(_.Menu.Separator,{className:Ys}),T===null&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(kl,{label:s("graph.annotations.baseMenu.pinNumber"),at:a,onRequestClose:i}),(0,n.jsx)(al,{label:s("graph.annotations.baseMenu.annotate"),placeholder:s("graph.annotations.textMenu.placeholder"),addLabel:s("graph.annotations.textMenu.addButton"),at:a,onRequestClose:i}),(0,n.jsx)(Rl,{label:s("graph.annotations.baseMenu.addSticker"),at:a,onRequestClose:i})]}),r.highlight!==null&&(0,n.jsx)(Cl,{label:s("graph.annotations.baseMenu.highlight"),layer:r,observation:o,highlights:y,onRequestClose:i}),(0,n.jsx)(ll,{label:s("graph.annotations.baseMenu.differenceArrow"),layer:r,at:a,onRequestClose:i})]})})})})})},Nl=e=>e==="outside-press"||e==="escape-key"||e==="item-press",xt="l8tsqe0",hr=["start","end"],pr=({anchor:e,point:t,delta:r})=>{const a={x:Kt(t.x,r.x),y:Kt(1-t.y,r.y)};return{anchor:{...e,x:e.x+a.x,y:e.y+a.y},point:{x:t.x+a.x,y:t.y-a.y}}},vt=(e,t)=>({...e,[t.endpoint]:{...e[t.endpoint],...t.point}}),mr=(e,t)=>e.x===t.x&&e.y===t.y,Dl=(e,t)=>{const r=(0,p.projectAnchorToPanel)(e,t);return{x:t.x+r.x,y:t.y+r.y}},Fl=(e,t,r)=>{const a=(0,p.projectAnchorToPanel)(e,r),o=(0,p.projectAnchorToPanel)(t,r);return{x:Math.min(a.x,o.x),y:Math.min(a.y,o.y),width:Math.abs(o.x-a.x),height:Math.abs(o.y-a.y)}},Kt=(e,t)=>!Number.isFinite(t)||!Number.isFinite(e)?0:(0,ee.default)(t,Math.min(-e,0),Math.max(1-e,0)),zl=({panelRect:e})=>{const t=l.useEditorState(c=>l.readStanding(c,"arrow-endpoint-drag")),r=l.useResolvedAnnotations(e).arrows,a=l.useStyleReaderTree();if(t===null)return null;const o=r.find(c=>c.id===t.annotationId);if(o===void 0)return null;const i=(0,p.resolveArrowAnnotationStyle)(a,o.id),s=(0,p.computeArrow)({arrow:vt(o,t),style:i,panelWidth:e.width,panelHeight:e.height});return s===null?null:(0,n.jsx)("svg",{"aria-hidden":"true",className:xt,width:e.width,height:e.height,style:{left:e.x,top:e.y},"data-testid":"arrow-endpoint-preview","data-annotation-id":t.annotationId,children:(0,n.jsx)(l.ArrowAnnotation,{computed:s,style:i,isAddressable:!1})})},he=()=>{const e=l.useGraphSelection();return nt(e)},nt=e=>{if(e.length!==1)return null;const[t]=e;return t?.kind==="annotation"?t.id:null},Bl=e=>(0,n.jsx)(l.Icon,{...e,children:(0,n.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"m12 19-7-7 7-7"}),(0,n.jsx)("path",{d:"M19 12H5"})]})}),gr=e=>(0,n.jsx)(l.Icon,{...e,children:(0,n.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"M5 12h14"}),(0,n.jsx)("path",{d:"m12 5 7 7-7 7"})]})}),Hl=e=>(0,n.jsx)(l.Icon,{...e,children:(0,n.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"M7 17 17 7"}),(0,n.jsx)("path",{d:"M7 7h10v10"})]})}),xr=e=>(0,n.jsx)(l.Icon,{...e,children:(0,n.jsxs)("g",{fill:"currentColor",children:[(0,n.jsx)("rect",{x:"3",y:"5",width:"18",height:"1.5",rx:"0.75"}),(0,n.jsx)("rect",{x:"3",y:"10",width:"18",height:"3",rx:"1.5"}),(0,n.jsx)("rect",{x:"3",y:"16.5",width:"18",height:"4.5",rx:"2.25"})]})}),Ne=e=>(0,n.jsx)(l.Icon,{...e,children:(0,n.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"M4 7h16"}),(0,n.jsx)("path",{d:"M10 11v6M14 11v6"}),(0,n.jsx)("path",{d:"M6 7l1 12a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2l1-12"}),(0,n.jsx)("path",{d:"M9 7V5a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2"})]})}),Gl="var(--pvjfpx0)",Vl="var(--pvjfpx1)",$l="pvjfpx2",Ul="pvjfpx3",Wl="pvjfpx4",ql="pvjfpx6 pvjfpx5",Kl="pvjfpx7 pvjfpx6 pvjfpx5",Xl="pvjfpx8 pvjfpx5",le=8,Zl=({anchorBox:e,panelRect:t,frameWidth:r,frameHeight:a})=>{const o=t.y+e.y,i=o+e.height,s=o-8-36,c=i+8,d=(0,ee.default)(s>=le?s:c,le,a-le-36),h=le;return{top:d,left:h,available:Math.max(0,r-le*2),centre:t.x+e.x+e.width/2-h}},Yl=({anchorBox:e,panelRect:t,frameWidth:r,frameHeight:a,label:o,testId:i,children:s})=>{const{chartId:c}=l.useGraphContext(),d=Zl({anchorBox:e,panelRect:t,frameWidth:r,frameHeight:a});return(0,n.jsx)("div",{className:$l,style:{top:d.top,left:d.left,width:d.available},children:(0,n.jsx)(B.Root,{"aria-label":o,className:Ul,"data-testid":i,...Oe(c),style:(0,Ie.assignInlineVars)({[Gl]:`${d.centre}px`,[Vl]:`${d.available}px`}),children:s})})},Jl=({label:e,trigger:t,isOpen:r,onOpenChange:a,isDisabled:o=!1,children:i})=>{const{chartId:s}=l.useGraphContext();return(0,n.jsxs)(_.Menu.Root,{open:r,modal:!1,onOpenChange:a,children:[(0,n.jsxs)(_.Menu.Trigger,{render:(0,n.jsx)(B.Button,{}),"aria-label":e,className:Xl,disabled:o,onMouseDown:c=>c.preventDefault(),children:[t,(0,n.jsx)(ue,{size:"sm"})]}),(0,n.jsx)(B.MenuPopup,{popupAttributes:Oe(s),children:i})]})},Ql=e=>{const{chartId:t}=l.useGraphContext();return(0,n.jsx)(B.ColorPicker,{...e,popupAttributes:Oe(t)})},ec=({color:e,opacity:t})=>(0,n.jsx)("span",{className:Wl,style:{background:e,opacity:t}}),tc=({label:e,onClick:t,children:r})=>(0,n.jsx)(B.Button,{"aria-label":e,className:ql,onClick:t,children:r}),nc=({label:e,isPressed:t,onClick:r,children:a})=>(0,n.jsx)(B.Button,{"aria-label":e,"aria-pressed":t,className:Kl,onClick:r,children:a}),R={Root:Yl,Dropdown:Jl,MenuItem:B.MenuItem,ColorPicker:Ql,Swatch:ec,IconButton:tc,ToggleButton:nc,Button:B.Button,Separator:B.Separator},rc={kind:"chrome-popup"},De=()=>{const{commands:e}=l.useGraphContext(),t=l.useEditorStore(),[r,a]=(0,v.useState)(null);(0,v.useEffect)(()=>()=>e.commit(),[e]),(0,v.useEffect)(()=>{const{claimInteraction:i,releaseInteraction:s}=t.getState();return r===null?s("chrome-popup"):i(rc),()=>s("chrome-popup")},[t,r]);const o=()=>{a(null),e.commit()};return{bind:i=>({isOpen:r===i,onOpenChange:s=>s?a(i):o()}),close:o}},ac=e=>(0,n.jsx)(l.Icon,{...e,children:(0,n.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",children:[(0,n.jsx)("path",{d:"M5 19 8 16"}),(0,n.jsx)("path",{d:"M10.5 13.5 13.5 10.5"}),(0,n.jsx)("path",{d:"M16 8 19 5"})]})}),oc=e=>(0,n.jsx)(l.Icon,{...e,children:(0,n.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",children:[(0,n.jsx)("path",{d:"M5 19h0"}),(0,n.jsx)("path",{d:"M8.5 15.5h0"}),(0,n.jsx)("path",{d:"M12 12h0"}),(0,n.jsx)("path",{d:"M15.5 8.5h0"}),(0,n.jsx)("path",{d:"M19 5h0"})]})}),ic=e=>(0,n.jsx)(l.Icon,{...e,children:(0,n.jsx)("path",{d:"M5 19 19 5",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round"})}),sc=[{value:p.ARROW_STROKE_WIDTHS_PX.thin,key:"graph.annotations.arrowToolbar.thickness.thin"},{value:p.ARROW_STROKE_WIDTHS_PX.medium,key:"graph.annotations.arrowToolbar.thickness.medium"},{value:p.ARROW_STROKE_WIDTHS_PX.thick,key:"graph.annotations.arrowToolbar.thickness.thick"}],Xt=[{value:"line-arrow",key:"graph.annotations.arrowToolbar.arrowhead.lineArrow",Icon:gr},{value:"none",key:"graph.annotations.arrowToolbar.arrowhead.none",Icon:l.MinusIcon}],Zt=[{value:"solid",key:"graph.annotations.arrowToolbar.lineStyle.solid",Icon:ic},{value:"dashed",key:"graph.annotations.arrowToolbar.lineStyle.dashed",Icon:ac},{value:"dotted",key:"graph.annotations.arrowToolbar.lineStyle.dotted",Icon:oc}],lc=(e,t)=>e.find(r=>r.value===t)??e[0];var cc=({arrow:e,arrowBox:t,panelRect:r,frameWidth:a,frameHeight:o,frameElement:i})=>{const s=l.useI18n(),{commands:c}=l.useGraphContext(),d=l.useSceneSelector(C=>C.spec.styles.overrides),h=De(),u=(0,p.resolveArrowAnnotationStyle)(l.useStyleReaderTree(),e.id),m=lc(Zt,(0,p.toDashPreset)(u.dashArray)),g=u.outline.strokeWidth>0||u.outline.shadow!=="none",x=(0,v.useMemo)(()=>({target:"annotation",kind:"arrow",annotation:e.id}),[e.id]),f=(0,v.useMemo)(()=>({...x,part:"outline"}),[x]),b=(C,S)=>{const z=(0,p.findStyleRule)(d,{select:x})?.declarations??{};c.dispatch(new p.SetStyleRuleCommand({list:"overrides",rule:{select:x,declarations:{...z,...C}}}),S)},w=C=>{const S=(0,p.findStyleRule)(d,{select:f})?.declarations??{};c.dispatch(new p.SetStyleRuleCommand({list:"overrides",rule:{select:f,declarations:{...S,...C}}}))},T=C=>{b(C),h.close()},y=C=>{c.dispatch(new p.UpdateAnnotationCommand({kind:"arrow",id:e.id,patch:C})),h.close()},k=()=>{c.dispatch(new p.RemoveAnnotationCommand({id:e.id})),i.focus({preventScroll:!0})},j=C=>b({stroke:C},{transient:!0}),I=C=>T({strokeWidth:C}),P=C=>y({startArrowheadStyle:C}),E=C=>T({dashArray:p.DASH_PRESETS.arrow[C]}),O=C=>y({endArrowheadStyle:C}),M=()=>w(g?{strokeWidth:0,shadow:"none"}:p.ARROW_STICKER_DECLARATIONS);return(0,n.jsxs)(R.Root,{anchorBox:t,panelRect:r,frameWidth:a,frameHeight:o,label:s("graph.annotations.arrowToolbar.label"),testId:"arrow-toolbar",children:[(0,n.jsx)(R.ColorPicker,{color:u.stroke,label:s("graph.annotations.arrowToolbar.color"),onChange:j,...h.bind("color"),children:(0,n.jsx)(R.Swatch,{color:u.stroke})}),(0,n.jsx)(R.Dropdown,{label:s("graph.annotations.arrowToolbar.thickness.ariaLabel"),trigger:(0,n.jsx)(xr,{size:"sm",title:""}),...h.bind("thickness"),children:(0,n.jsx)(ve,{options:sc,current:u.strokeWidth,onPick:I})}),(0,n.jsx)(R.Dropdown,{label:s("graph.annotations.arrowToolbar.startArrowhead"),trigger:(0,n.jsx)(Bl,{size:"sm",title:""}),...h.bind("startArrowhead"),children:(0,n.jsx)(ve,{options:Xt,current:e.startArrowheadStyle,onPick:P})}),(0,n.jsx)(R.Dropdown,{label:s("graph.annotations.arrowToolbar.lineStyle.ariaLabel"),trigger:m?.Icon!==void 0&&(0,n.jsx)(m.Icon,{size:"sm",title:""}),...h.bind("lineStyle"),children:(0,n.jsx)(ve,{options:Zt,current:(0,p.toDashPreset)(u.dashArray),onPick:E})}),(0,n.jsx)(R.Dropdown,{label:s("graph.annotations.arrowToolbar.endArrowhead"),trigger:(0,n.jsx)(gr,{size:"sm",title:""}),...h.bind("endArrowhead"),children:(0,n.jsx)(ve,{options:Xt,current:e.endArrowheadStyle,onPick:O})}),(0,n.jsx)(R.ToggleButton,{label:s("graph.annotations.arrowToolbar.sticker"),isPressed:g,onClick:M,children:(0,n.jsx)(Hl,{size:"sm",title:""})}),(0,n.jsx)(R.Separator,{}),(0,n.jsx)(R.IconButton,{label:s("graph.annotations.arrowToolbar.remove"),onClick:k,children:(0,n.jsx)(Ne,{size:"sm",title:""})})]})},ve=({options:e,current:t,onPick:r})=>{const a=l.useI18n(),o=i=>()=>r(i);return(0,n.jsx)(n.Fragment,{children:e.map(i=>(0,n.jsxs)(R.MenuItem,{isSelected:i.value===t,onClick:o(i.value),children:[(0,n.jsx)("span",{children:a(i.key)}),i.Icon!==void 0&&(0,n.jsx)("span",{className:"_112xh5c0",children:(0,n.jsx)(i.Icon,{size:"sm",title:""})})]},String(i.value)))})},dc="_1me29t10",W=(e,t)=>t>0?e/t:0,Fe=(e,t,r)=>({x:W(t.x-e.x,r.width),y:W(t.y-e.y,r.height)}),uc=e=>e.x!==0||e.y!==0,vr=(e,t)=>({x:e.x*t.width,y:e.y*t.height});var hc=(e,t)=>Math.hypot(t.x-e.x,t.y-e.y)>=3,pe=class{constructor(e){this.params=e,this.listeners=new AbortController,this.pendingEvent=null,this.scheduledFrame=null,this.hasMoved=!1,this.hasPublished=!1,this.handleMove=t=>{t.pointerId===this.params.pointerId&&(this.pendingEvent=t,this.hasMoved=!0,this.scheduledFrame===null&&(this.scheduledFrame=requestAnimationFrame(this.runFrame)))},this.handleUp=t=>{t.pointerId===this.params.pointerId&&(this.pendingEvent=t,this.finish(!0))},this.handleLost=t=>{t.pointerId===this.params.pointerId&&this.finish(!1)},this.runFrame=()=>{this.scheduledFrame=null;const t=this.pendingEvent;if(this.pendingEvent=null,t===null)return;const r=this.params.editorStore.getState();if(this.hasPublished&&this.readOwn(r)===null)return;const a={x:t.clientX,y:t.clientY};if(!this.hasPublished&&!this.isDragConfirmed(this.params.press,a))return;const o=this.resolvePreview(a);o!==null&&(r.claimInteraction(o),this.hasPublished=!0)}}start(){const{handle:e}=this.params,{signal:t}=this.listeners;e.addEventListener("pointermove",this.handleMove,{signal:t}),e.addEventListener("pointerup",this.handleUp,{signal:t}),e.addEventListener("lostpointercapture",this.handleLost,{signal:t})}finish(e){this.params.onSettled(),this.listeners.abort(),this.cancelFrame();try{e&&this.hasMoved&&this.runFrame()}finally{this.settle(e)}}isDragConfirmed(e,t){return hc(e,t)}settle(e){this.pendingEvent=null;const t=this.params.editorStore.getState(),r=this.readOwn(t);r!==null&&t.releaseInteraction(this.kind),!(!e||r===null)&&this.commit(r)}cancelFrame(){this.scheduledFrame!==null&&(cancelAnimationFrame(this.scheduledFrame),this.scheduledFrame=null)}},Te=(e,t,r)=>{const a=e.arrows.find(i=>i.id===t);if(a===void 0)return null;const o=a[r];return o.anchorType==="panel"?o:null},fr=(e,t)=>e==="start"?{start:t}:{end:t},pc=class extends pe{constructor(...e){super(...e),this.kind="arrow-endpoint-drag"}readOwn(e){const{annotationId:t,endpoint:r}=this.params;return l.readDraggedArrowEndpointFor(l.readStanding(e,"arrow-endpoint-drag"),t,r)}resolvePreview(e){const{annotationId:t,endpoint:r,press:a,readInputs:o}=this.params,{annotations:i,arrow:s,panelRect:c}=o(),d=Te(i,t,r);return d===null?null:{kind:"arrow-endpoint-drag",annotationId:t,endpoint:r,...pr({anchor:d,point:s[r],delta:Fe(a,e,c)})}}commit({anchor:e}){const{annotationId:t,endpoint:r,dispatch:a,readInputs:o}=this.params,i=Te(o().annotations,t,r);i===null||mr(i,e)||a(new p.UpdateAnnotationCommand({kind:"arrow",id:t,patch:fr(r,e)}))}},mc=({annotationId:e,arrow:t,panelRect:r})=>{const{commands:a}=l.useGraphContext(),o=l.useEditorStore(),i=l.useLatestRef({annotations:l.useSceneSelector(c=>c.spec.annotations),arrow:t,panelRect:r}),s=(0,v.useRef)(null);return(0,v.useEffect)(()=>()=>s.current?.finish(!1),[]),(0,v.useCallback)(c=>({onPointerDown:d=>{if(d.button===0&&s.current===null){try{d.currentTarget.setPointerCapture(d.pointerId)}catch{return}d.currentTarget.focus({preventScroll:!0}),d.preventDefault(),s.current=new pc({handle:d.currentTarget,pointerId:d.pointerId,annotationId:e,endpoint:c,press:{x:d.clientX,y:d.clientY},readInputs:()=>i.current,editorStore:o,dispatch:a.dispatch,onSettled:()=>{s.current=null}}),s.current.start()}}}),[e,i,o,a])},gc=[" ","Enter"],Yt=4,xc=({annotationId:e,arrow:t,panelRect:r})=>{const{commands:a}=l.useGraphContext(),o=l.useEditorStore(),i=l.useSceneSelector(d=>d.spec.annotations),s=l.useLatestRef(i),c=l.useLatestRef(a.dispatch);return(0,v.useEffect)(()=>()=>{for(const d of hr)Jt({editorStore:o,annotationId:e,endpoint:d,annotations:s.current,dispatch:c.current})},[o,e,s,c]),(0,v.useCallback)(d=>({onKeyDown:h=>{if(h.altKey||h.ctrlKey||h.metaKey||h.shiftKey)return;const u=o.getState(),m=l.readDraggedArrowEndpointFor(l.readStanding(u,"arrow-endpoint-drag"),e,d);if(gc.includes(h.key)){if(h.preventDefault(),h.repeat)return;if(m!==null){Jt({editorStore:o,annotationId:e,endpoint:d,annotations:i,dispatch:a.dispatch});return}const x=Te(i,e,d);if(x===null)return;u.claimInteraction({kind:"arrow-endpoint-drag",annotationId:e,endpoint:d,anchor:x,point:t[d]});return}if(m===null)return;const g=vc(h.key,r);g!==null&&(h.preventDefault(),u.claimInteraction({kind:"arrow-endpoint-drag",annotationId:e,endpoint:d,...pr({anchor:m.anchor,point:m.point,delta:g})}))}}),[e,i,t,r,o,a])},Jt=({editorStore:e,annotationId:t,endpoint:r,annotations:a,dispatch:o})=>{const i=e.getState(),s=l.readDraggedArrowEndpointFor(l.readStanding(i,"arrow-endpoint-drag"),t,r);if(s===null)return;i.releaseInteraction("arrow-endpoint-drag");const c=Te(a,t,r);c===null||mr(c,s.anchor)||o(new p.UpdateAnnotationCommand({kind:"arrow",id:t,patch:fr(r,s.anchor)}))},vc=(e,t)=>{const r=W(Yt,t.width),a=W(Yt,t.height);switch(e){case"ArrowLeft":return{x:-r,y:0};case"ArrowRight":return{x:r,y:0};case"ArrowUp":return{x:0,y:-a};case"ArrowDown":return{x:0,y:a};default:return null}},fc=e=>{const t=he(),r=yc(t),a=Cc(e.panelRect,t),o=jc(t);if(r===null||a===null)return null;const i=o.dragged===null?a:vt(a,o.dragged);return(0,n.jsx)(bc,{arrow:r,committed:a,painted:i,isSettled:o.dragged===null&&!o.isMoved,isMoved:o.isMoved,...e})},bc=({arrow:e,committed:t,painted:r,isSettled:a,isMoved:o,panelRect:i,frameRect:s,frameElement:c})=>{const d=l.useI18n(),h=mc({annotationId:e.id,arrow:t,panelRect:i}),u=xc({annotationId:e.id,arrow:t,panelRect:i});return(0,n.jsxs)("div",{"data-testid":"arrow-selection","data-annotation-id":e.id,children:[a&&(0,n.jsx)(cc,{arrow:e,arrowBox:Fl(t.start,t.end,i),panelRect:i,frameWidth:s.width,frameHeight:s.height,frameElement:c}),!o&&hr.filter(m=>e[m].anchorType==="panel").map(m=>(0,n.jsx)(Sc,{endpoint:m,point:Dl(r[m],i),label:d(`graph.annotations.arrowToolbar.moveEndpoint.${m}`),dragHandlers:h(m),keyboardHandlers:u(m)},m))]})},Sc=({endpoint:e,point:t,label:r,dragHandlers:a,keyboardHandlers:o})=>(0,n.jsx)("div",{"aria-label":r,className:dc,"data-testid":"arrow-endpoint-handle","data-endpoint":e,role:"button",style:{left:t.x,top:t.y},tabIndex:0,...a,...o}),yc=e=>{const t=l.useSceneSelector(r=>r.spec.annotations.arrows);return e===null?null:t.find(r=>r.id===e)??null},Cc=(e,t)=>{const r=l.useResolvedAnnotations(e).arrows;return t===null?null:r.find(a=>a.id===t)??null},jc=e=>l.useEditorState((0,Y.useShallow)(t=>{if(e===null)return{dragged:null,isMoved:!1};const r=l.readStanding(t,"arrow-endpoint-drag");return{dragged:r?.annotationId===e?r:null,isMoved:l.readMovedAnnotationFor(l.readStanding(t,"move-drag"),e)!==null}})),wc=e=>(0,n.jsx)(l.Icon,{...e,children:(0,n.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"M4 9h16m-4-4 4 4"}),(0,n.jsx)("path",{d:"M20 15H4m4 4-4-4"})]})}),Tc="q7gcrz0",Ac="q7gcrz1",kc="q7gcrz2";var Pc=["absolute-difference","relative-difference","proportion"],Qt=["absolute-difference","relative-difference"],Lc=["relative-difference","proportion"],Ic={"absolute-difference":"graph.annotations.differenceArrowToolbar.labelKind.absoluteDifference","relative-difference":"graph.annotations.differenceArrowToolbar.labelKind.relativeDifference",proportion:"graph.annotations.differenceArrowToolbar.labelKind.proportion"},Ec=e=>{const{formattingLocale:t}=l.useGraphContext(),r=l.useSceneSelector(o=>o.config.parsingLocale),a=t??r;return(0,v.useMemo)(()=>{const o=(0,p.areEndpointsComparable)(e.start,e.end);return Pc.filter(i=>o||!Qt.includes(i)||i===e.label).map(i=>({kind:i,key:Ic[i],preview:(0,p.formatDifferenceLabel)({locale:a,kind:i,startValue:e.start.measurementValue,endValue:e.end.measurementValue,valueFormat:e.start.valueFormat}),isPickable:o||!Qt.includes(i),isSuspect:Lc.includes(i)&&e.start.measurementValue===0}))},[e,a])},en=[{id:"small",key:"graph.annotations.differenceArrowToolbar.size.small"},{id:"medium",key:"graph.annotations.differenceArrowToolbar.size.medium"},{id:"large",key:"graph.annotations.differenceArrowToolbar.size.large"}],Mc=({arrow:e,color:t,labelBox:r,panelRect:a,frameWidth:o,frameHeight:i,frameElement:s})=>{const c=l.useI18n(),{commands:d}=l.useGraphContext(),h=l.useSceneSelector(S=>S.spec.styles.overrides),u=De(),m=Ec(e),g=(0,p.resolveDifferenceArrowAnnotationStyle)(l.useStyleReaderTree(),e.id),x=(0,v.useMemo)(()=>({target:"annotation",kind:"differenceArrow",annotation:e.id}),[e.id]),f=(0,v.useMemo)(()=>({...x,part:"label"}),[x]),b=m.find(S=>S.kind===e.label),w=m.some(S=>S.isPickable&&S.kind!==e.label),T=en.find(S=>p.DIFFERENCE_ARROW_SIZE_DECLARATIONS[S.id].arrow.strokeWidth===g.strokeWidth),y=(S,z)=>{d.dispatch(new p.UpdateAnnotationCommand({kind:"differenceArrow",id:e.id,patch:S}),z)},k=S=>({...(0,p.findStyleRule)(h,{select:x})?.declarations,...S}),j=S=>({...(0,p.findStyleRule)(h,{select:f})?.declarations,...S}),I=S=>{y(S),u.close()},P=()=>{d.dispatch(new p.RemoveAnnotationCommand({id:e.id})),s.focus({preventScroll:!0})},E=S=>d.dispatch(new p.SetStyleRuleCommand({list:"overrides",rule:{select:x,declarations:k({stroke:S})}}),{transient:!0}),O=()=>y({start:e.end.anchor,end:e.start.anchor}),M=S=>()=>I({label:S}),C=S=>()=>{const z=p.DIFFERENCE_ARROW_SIZE_DECLARATIONS[S];d.dispatch(new p.SetDifferenceArrowStyleCommand({annotationId:e.id,arrow:k(z.arrow),label:j(z.label)})),u.close()};return(0,n.jsxs)(R.Root,{anchorBox:r,panelRect:a,frameWidth:o,frameHeight:i,label:c("graph.annotations.differenceArrowToolbar.label"),testId:"difference-arrow-toolbar",children:[(0,n.jsx)(R.Dropdown,{label:c("graph.annotations.differenceArrowToolbar.labelKind.ariaLabel"),trigger:(0,n.jsx)(Rc,{option:b}),isDisabled:!w,...u.bind("labelKind"),children:m.map(S=>(0,n.jsxs)(R.MenuItem,{isSelected:S.kind===e.label,isDisabled:!S.isPickable,onClick:M(S.kind),children:[(0,n.jsx)("span",{children:c(S.key)}),(S.isSuspect||!S.isPickable)&&(0,n.jsx)("span",{"aria-label":c(S.isPickable?"graph.annotations.differenceArrowToolbar.labelKind.suspectValue":"graph.annotations.differenceArrowToolbar.labelKind.incomparableEnds"),className:"q7gcrz3",role:"img",children:"⚠"}),(0,n.jsx)("span",{className:kc,children:S.preview})]},S.kind))}),(0,n.jsx)(R.Separator,{}),(0,n.jsx)(R.ColorPicker,{color:t,label:c("graph.annotations.differenceArrowToolbar.color"),onChange:E,...u.bind("color"),children:(0,n.jsx)(R.Swatch,{color:t})}),(0,n.jsx)(R.Dropdown,{label:c("graph.annotations.differenceArrowToolbar.size.ariaLabel"),trigger:T===void 0?"":c(T.key),...u.bind("size"),children:en.map(S=>(0,n.jsx)(R.MenuItem,{isSelected:S.id===T?.id,onClick:C(S.id),children:c(S.key)},S.id))}),(0,n.jsx)(R.Separator,{}),(0,n.jsx)(R.IconButton,{label:c("graph.annotations.differenceArrowToolbar.swap"),onClick:O,children:(0,n.jsx)(wc,{size:"sm",title:""})}),(0,n.jsx)(R.IconButton,{label:c("graph.annotations.differenceArrowToolbar.remove"),onClick:P,children:(0,n.jsx)(Ne,{size:"sm",title:""})})]})},Rc=({option:e})=>{const t=l.useI18n();return e===void 0?null:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:Ac,children:t(e.key)}),(0,n.jsxs)("span",{className:Tc,children:["(",e.preview,")"]})]})};var Oc="ydgo3h0",_c="ydgo3h1",Nc="ydgo3h2",Dc=({clientPoint:e,panelOrigin:t,panelRect:r,engine:a,layers:o,coordSystem:i,resolver:s,fixedAnchor:c,align:d})=>{const h=Fc({x:e.x-t.x,y:e.y-t.y},r),{primary:u}=a.query((0,p.toPanelCursor)(h,r));if(u===null)return null;const m=o.find(x=>x.id===u.layerId);if(m===void 0)return null;const g=(0,p.resolveObservationPoint)({resolver:s,layer:m,observation:u.observation,observationIndex:(0,p.readObservationIndex)(u),coordSystem:i,align:d});return g===null||(0,p.areAnchorsEqual)(g.anchor,c)?null:g},Fc=(e,t)=>({x:Math.max(0,Math.min(e.x,t.width)),y:Math.max(0,Math.min(e.y,t.height))}),br=e=>e==="start"?"end":"start",Sr=({dispatch:e,arrow:t,endpoint:r,anchor:a})=>{(0,p.areAnchorsEqual)(a,t[r].anchor)||e(new p.UpdateAnnotationCommand({kind:"differenceArrow",id:t.id,patch:{[r]:a}}))},zc=class extends pe{constructor(...e){super(...e),this.kind="difference-arrow-endpoint-drag"}isDragConfirmed(){return!0}readOwn(e){const{endpoint:t,readInputs:r}=this.params;return l.readDraggedDifferenceArrowEndpointFor(l.readStanding(e,"difference-arrow-endpoint-drag"),r().arrow.id,t)}resolvePreview(e){const{endpoint:t,readInputs:r,engine:a,anchorResolver:o}=this.params,{arrow:i,panelOrigin:s,panelRect:c,layers:d,coordSystem:h}=r(),u=Dc({clientPoint:e,panelOrigin:s,panelRect:c,engine:a,layers:d,coordSystem:h,resolver:o,fixedAnchor:i[br(t)].anchor,align:i[t].anchor.align});return u===null?null:{kind:"difference-arrow-endpoint-drag",annotationId:i.id,endpoint:t,point:u}}commit({point:e,endpoint:t}){const{dispatch:r,readInputs:a}=this.params;Sr({dispatch:r,arrow:a().arrow,endpoint:t,anchor:e.anchor})}},Bc=({arrow:e,panelOrigin:t,panelRect:r})=>{const{commands:a,anchorResolver:o}=l.useGraphContext(),{engine:i}=l.useHoverContext(),s=l.useEditorStore(),c=l.useLatestRef({arrow:e,panelOrigin:t,panelRect:r,...l.useSceneSelector((0,Y.useShallow)(h=>({layers:h.layers,coordSystem:h.coordSystem})))}),d=(0,v.useRef)(null);return(0,v.useEffect)(()=>()=>d.current?.finish(!1),[]),(0,v.useCallback)(h=>({onPointerDown:u=>{if(u.button===0&&d.current===null){try{u.currentTarget.setPointerCapture(u.pointerId)}catch{return}u.currentTarget.focus({preventScroll:!0}),u.preventDefault(),d.current=new zc({handle:u.currentTarget,pointerId:u.pointerId,press:{x:u.clientX,y:u.clientY},endpoint:h,readInputs:()=>c.current,editorStore:s,engine:i,anchorResolver:o,dispatch:a.dispatch,onSettled:()=>{d.current=null}}),d.current.start()}}}),[c,s,i,o,a])},Hc=[" ","Enter"],Gc=({arrow:e})=>{const{commands:t,anchorResolver:r}=l.useGraphContext(),a=l.useEditorStore(),{layers:o,coordSystem:i,mainAxis:s}=l.useSceneSelector((0,Y.useShallow)(d=>({layers:d.layers,coordSystem:d.coordSystem,mainAxis:(0,p.readMainAxis)(d.coordSystem)}))),c=e.id;return(0,v.useEffect)(()=>()=>{const d=a.getState();l.readStanding(d,"difference-arrow-endpoint-drag")?.annotationId===c&&d.releaseInteraction("difference-arrow-endpoint-drag")},[a,c]),(0,v.useCallback)(d=>({onKeyDown:h=>{if(h.altKey||h.ctrlKey||h.metaKey||h.shiftKey)return;const u=a.getState(),m=l.readDraggedDifferenceArrowEndpointFor(l.readStanding(u,"difference-arrow-endpoint-drag"),e.id,d);if(Hc.includes(h.key)){if(h.preventDefault(),h.repeat)return;if(m===null)return u.claimInteraction({kind:"difference-arrow-endpoint-drag",annotationId:e.id,endpoint:d,point:e[d]});u.releaseInteraction("difference-arrow-endpoint-drag"),Sr({dispatch:t.dispatch,arrow:e,endpoint:d,anchor:m.point.anchor});return}if(m===null)return;const g=Vc(h.key,s);if(g===null)return;h.preventDefault();const x=$c({arrow:e,endpoint:d,from:m.point.anchor,move:g,layers:o,coordSystem:i,resolver:r});x!==null&&u.claimInteraction({kind:"difference-arrow-endpoint-drag",annotationId:e.id,endpoint:d,point:x})}}),[e,a,t,r,o,i,s])},Vc=(e,t)=>{const r=e==="ArrowUp"||e==="ArrowDown";return!r&&!(e==="ArrowLeft"||e==="ArrowRight")?null:{axis:t==="x"===r?"cross":"main",step:e==="ArrowDown"||e==="ArrowRight"?1:-1}},$c=({arrow:e,endpoint:t,from:r,move:a,layers:o,coordSystem:i,resolver:s})=>{const c=o.find(u=>u.id===r.layerId);if(c===void 0)return null;const d=s.createLayerMeasurement(c);if(d===null)return null;const{align:h}=e[t].anchor;return(0,p.stepDifferenceArrowEndpoint)({layer:c,from:r,partner:e[br(t)].anchor,axis:a.axis,step:a.step,getObservationPoint:(u,m)=>(0,p.resolveObservationPoint)({resolver:s,layer:c,observation:u,observationIndex:m,coordSystem:i,align:h,measurement:d})})?.point??null},Uc=e=>{const t=he();return t===null?null:(0,n.jsx)(Wc,{annotationId:t,...e})},Wc=({annotationId:e,...t})=>{const r=l.useDifferenceArrowGeometries(),a=(0,v.useMemo)(()=>r.find(o=>o.id===e),[r,e]);return a===void 0?null:(0,n.jsx)(qc,{committedArrow:a.committedArrow,color:a.color,labelCornerRadius:a.style.label.cornerRadius,committedLabelBox:a.committedLabelBox,labelBox:a.labelBox,start:a.start,end:a.end,isDragged:a.isDragged,...t})},qc=({committedArrow:e,color:t,labelCornerRadius:r,committedLabelBox:a,labelBox:o,start:i,end:s,panelRect:c,panelOrigin:d,frameRect:h,frameElement:u,isDragged:m})=>{const g=Bc({arrow:e,panelOrigin:d,panelRect:c}),x=Gc({arrow:e});return(0,n.jsxs)("div",{"data-testid":"difference-arrow-selection",children:[!m&&(0,n.jsx)(Mc,{arrow:e,color:t,labelBox:a,panelRect:c,frameWidth:h.width,frameHeight:h.height,frameElement:u}),(0,n.jsx)("div",{"aria-hidden":"true",className:Nc,"data-testid":"difference-arrow-selection-label",style:{left:c.x+o.x-2,top:c.y+o.y-2,width:o.width+4,height:o.height+4,borderRadius:l.toBorderRadiusCss(r,2)}}),(0,n.jsx)(tn,{endpoint:"start",point:i,panelRect:c,dragHandlers:g("start"),keyboardHandlers:x("start")}),(0,n.jsx)(tn,{endpoint:"end",point:s,panelRect:c,dragHandlers:g("end"),keyboardHandlers:x("end")})]})},tn=({endpoint:e,point:t,panelRect:r,dragHandlers:a,keyboardHandlers:o})=>(0,n.jsx)("div",{className:Oc,"data-testid":"difference-arrow-selection-handle","data-endpoint":e,role:"button",style:{left:r.x+t.x,top:r.y+t.y},tabIndex:0,...a,...o,children:(0,n.jsx)("span",{"aria-hidden":"true",className:_c})}),rt=({start:e,extent:t,isStartMoving:r,delta:a,minExtent:o})=>{if(!Number.isFinite(a))return{start:e,extent:t};const i=e+t,s=Math.min(o,t);if(r){const h=Math.min(0,e),u=Math.min(Math.max(1,e),i-s),m=(0,ee.default)(e+a,h,u);return{start:m,extent:i-m}}const c=Math.max(Math.min(0,i),e+s),d=Math.max(1,i);return{start:e,extent:(0,ee.default)(i+a,c,d)-e}},Kc=["top-left","top-right","bottom-right","bottom-left"];var yr=({width:e,height:t})=>({x:W(16,e),y:W(16,t)}),Xc=(e,t)=>({x:wr(t)?e.x:e.x+e.width,y:Tr(t)?e.y:e.y+e.height}),ft=e=>({x:e.x,y:1-e.y-e.height,width:e.width,height:e.height}),Cr=({region:e,corner:t,delta:r,minSize:a})=>{const o=rt({start:e.x,extent:e.width,isStartMoving:wr(t),delta:r.x,minExtent:a.x}),i=rt({start:e.y,extent:e.height,isStartMoving:Tr(t),delta:r.y,minExtent:a.y});return{anchorType:"panel",x:o.start,y:i.start,width:o.extent,height:i.extent}},jr=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,wr=e=>e==="top-left"||e==="bottom-left",Tr=e=>e==="top-left"||e==="top-right",Ar=(e,t,r,a)=>{const o=e.textAnnotations.find(i=>i.id===t);return o===void 0?null:l.measureTextAnnotationBox(l.previewResizedText(o,r),a)};var Zc={hovered:"_1ee8fau1 _1ee8fau0",selected:"_1ee8fau2 _1ee8fau0"},Yc={hovered:"_1ee8fau4 _1ee8fau3",selected:"_1ee8fau5 _1ee8fau3"},Jc=({panelRect:e})=>{const t=l.useResolvedAnnotations(e),r=l.useMeasuredBoxes(),a=l.useStyleReaderTree(),o=he(),i=l.useEditorState(b=>l.readStanding(b,"move-drag")),s=l.useEditorState(b=>l.readStanding(b,"shape-resize-drag")),c=l.useEditorState(b=>l.readStanding(b,"arrow-endpoint-drag")),d=l.useEditorState(b=>l.readStanding(b,"text-resize-drag")),h=l.useEditorState(l.readAnnotationUnderPointer),u=(0,v.useMemo)(()=>({panel:{width:e.width,height:e.height},measuredBoxes:r,readers:a}),[e.width,e.height,r,a]),m=nn(t,o,u),g=nn(t,h===o?null:h,u),x=b=>{if(s?.annotationId===b.id){const w=t.shapes.find(T=>T.id===b.id);return w===void 0?b.geometry:l.measureShapeRegion(ft(s.region),a.annotation.shape(w.id).get("strokeWidth"),u.panel)}if(c?.annotationId===b.id){const w=t.arrows.find(T=>T.id===b.id);return w===void 0?b.geometry:l.measureArrowEnds(vt(w,c),u.panel)??b.geometry}return d?.annotationId===b.id?Ar(t,b.id,d,u)??b.geometry:b.geometry},f=b=>{if(i?.annotationId!==b)return e;const w=vr(i.translation,e);return{x:e.x+w.x,y:e.y+w.y}};return(0,n.jsxs)(n.Fragment,{children:[g!==null&&(0,n.jsx)(rn,{annotationId:g.id,geometry:x(g),state:"hovered",origin:f(g.id)}),m!==null&&(0,n.jsx)(rn,{annotationId:m.id,geometry:x(m),state:"selected",origin:f(m.id)})]})},nn=(e,t,r)=>{if(t===null)return null;const a=l.resolveAnnotationChromeGeometry(e,t,r);return a===null?null:{id:t,geometry:a}},rn=({annotationId:e,geometry:t,state:r,origin:a})=>t.shape==="segment"?(0,n.jsxs)("div",{"aria-hidden":"true","data-testid":"annotation-chrome","data-annotation-id":e,"data-state":r,children:[(0,n.jsx)(an,{point:t.start,state:r,origin:a}),(0,n.jsx)(an,{point:t.end,state:r,origin:a})]}):(0,n.jsx)("div",{"aria-hidden":"true",className:Zc[r],"data-testid":"annotation-chrome","data-annotation-id":e,"data-state":r,style:{left:a.x+t.rect.x-2,top:a.y+t.rect.y-2,width:t.rect.width+4,height:t.rect.height+4}}),an=({point:e,state:t,origin:r})=>(0,n.jsx)("span",{className:Yc[t],style:{left:r.x+e.x,top:r.y+e.y}}),Qc=({panelRect:e})=>{const t=l.useEditorState(o=>l.readStanding(o,"move-drag")),r=l.useResolvedAnnotations(e);if(t===null)return null;const a=vr(t.translation,e);return(0,n.jsx)("svg",{"aria-hidden":"true",className:xt,width:e.width,height:e.height,style:{left:e.x+a.x,top:e.y+a.y},"data-testid":"annotation-preview","data-annotation-id":t.annotationId,children:nd(r,t.annotationId,e)})},ed=({annotation:e,panel:t})=>{const r=l.useMeasuredBoxRef(e.id);return(0,n.jsx)(l.TextAnnotation,{annotation:e,panel:t,style:l.useStyleReaderTree().annotation.text(e.id).resolve(),blockRef:r})},fe=(e,t,r)=>{const a=e.find(o=>o.id===t);return a===void 0?null:r(a)},td={text:(e,t,r)=>fe(e.textAnnotations,t,a=>(0,n.jsx)(ed,{annotation:a,panel:r})),shape:(e,t,r)=>fe(e.shapes,t,a=>(0,n.jsx)(ad,{shape:a,panelSize:r})),image:(e,t,r)=>fe(e.images,t,a=>(0,n.jsx)(od,{image:a,panelSize:r})),arrow:(e,t,r)=>fe(e.arrows,t,a=>(0,n.jsx)(rd,{arrow:a,panelSize:r}))},nd=(e,t,r)=>{for(const a of Object.values(td)){const o=a(e,t,r);if(o!==null)return o}return null},rd=({arrow:e,panelSize:t})=>{const r=(0,p.resolveArrowAnnotationStyle)(l.useStyleReaderTree(),e.id),a=(0,p.computeArrow)({arrow:e,style:r,panelWidth:t.width,panelHeight:t.height});return a===null?null:(0,n.jsx)(l.ArrowAnnotation,{computed:a,style:r,isAddressable:!1})},ad=({shape:e,panelSize:t})=>(0,n.jsx)(l.ShapeAnnotation,{shape:e,style:l.useStyleReaderTree().annotation.shape(e.id).resolve(),panel:t}),od=({image:e,panelSize:t})=>(0,n.jsx)(l.ImageAnnotation,{image:e,panel:t,style:l.useStyleReaderTree().annotation.image(e.id).resolve()}),id=({panelRect:e})=>{const t=l.useEditorState(i=>l.readStanding(i,"shape-resize-drag")),r=l.useResolvedAnnotations(e).shapes,a=l.useStyleReaderTree();if(t===null)return null;const o=r.find(i=>i.id===t.annotationId);return o===void 0?null:(0,n.jsx)("svg",{"aria-hidden":"true",className:xt,width:e.width,height:e.height,style:{left:e.x,top:e.y},"data-testid":"shape-resize-preview","data-annotation-id":t.annotationId,children:(0,n.jsx)(l.ShapeAnnotation,{shape:{...o,region:ft(t.region)},style:a.annotation.shape(o.id).resolve(),panel:e})})},sd={sm:"o49ib40",md:"o49ib41"},ld={horizontal:"o49ib42",diagonalDown:"o49ib43",diagonalUp:"o49ib44"},kr=({point:e,label:t,pull:r,size:a,attributes:o,dragHandlers:i,keyboardHandlers:s})=>(0,n.jsx)("div",{"aria-label":t,className:ld[r],role:"button",style:{left:e.x,top:e.y},tabIndex:0,...o,...i,...s,children:(0,n.jsx)("span",{"aria-hidden":"true",className:sd[a]})}),at=[{width:0,key:"graph.annotations.shapeToolbar.border.none"},{width:2,key:"graph.annotations.shapeToolbar.border.thin"},{width:8,key:"graph.annotations.shapeToolbar.border.medium"},{width:16,key:"graph.annotations.shapeToolbar.border.thick"}],cd=e=>[...at].reverse().find(t=>t.width<=e)??at[0],dd=({shape:e,shapeBox:t,panelRect:r,frameWidth:a,frameHeight:o,frameElement:i})=>{const s=l.useI18n(),{commands:c}=l.useGraphContext(),d=l.useSceneSelector(y=>y.spec.styles.overrides),h=De(),u=l.useStyleReaderTree().annotation.shape(e.id).resolve(),m=cd(u.strokeWidth),g=(0,v.useMemo)(()=>({target:"annotation",kind:"shape",annotation:e.id}),[e.id]),x=(y,k)=>{const j=(0,p.findStyleRule)(d,{select:g})?.declarations??{};c.dispatch(new p.SetStyleRuleCommand({list:"overrides",rule:{select:g,declarations:{...j,...y}}}),k)},f=()=>{c.dispatch(new p.RemoveAnnotationCommand({id:e.id})),i.focus({preventScroll:!0})},b=y=>x({fill:y},{transient:!0}),w=y=>x({fillAlpha:y},{transient:!0}),T=y=>()=>{x({strokeWidth:y}),h.close()};return(0,n.jsxs)(R.Root,{anchorBox:t,panelRect:r,frameWidth:a,frameHeight:o,label:s("graph.annotations.shapeToolbar.label"),testId:"shape-toolbar",children:[(0,n.jsx)(R.ColorPicker,{color:(0,p.toPaintColor)(u.fill),label:s("graph.annotations.shapeToolbar.color"),onChange:b,opacity:u.fillAlpha,onOpacityChange:w,...h.bind("color"),children:(0,n.jsx)(R.Swatch,{color:(0,p.toPaintColor)(u.fill),opacity:u.fillAlpha})}),(0,n.jsx)(R.Dropdown,{label:s("graph.annotations.shapeToolbar.border.ariaLabel"),trigger:(0,n.jsx)(xr,{size:"sm",title:""}),...h.bind("border"),children:at.map(y=>(0,n.jsx)(R.MenuItem,{isSelected:y.width===m?.width,onClick:T(y.width),children:s(y.key)},y.width))}),(0,n.jsx)(R.Separator,{}),(0,n.jsx)(R.IconButton,{label:s("graph.annotations.shapeToolbar.remove"),onClick:f,children:(0,n.jsx)(Ne,{size:"sm",title:""})})]})},Pr=e=>{const t=l.useLatestRef(e),r=(0,v.useRef)(null);return(0,v.useEffect)(()=>()=>r.current?.finish(!1),[]),(0,v.useCallback)(a=>({onPointerDown:o=>{if(o.button!==0||r.current!==null)return;try{o.currentTarget.setPointerCapture(o.pointerId)}catch{return}o.currentTarget.focus({preventScroll:!0}),o.preventDefault();const i=t.current(a,{handle:o.currentTarget,pointerId:o.pointerId,press:{x:o.clientX,y:o.clientY},onSettled:()=>{r.current=null}});r.current=i,i.start()}}),[t])},Ae=(e,t)=>{const r=e.shapes.find(a=>a.id===t);return r===void 0||r.region.anchorType!=="panel"?null:r.region},ud=class extends pe{constructor(...e){super(...e),this.kind="shape-resize-drag"}readOwn(e){return l.readResizedShapeFor(l.readStanding(e,"shape-resize-drag"),this.params.annotationId)}resolvePreview(e){const{annotationId:t,corner:r,press:a,readInputs:o}=this.params,{annotations:i,panelRect:s}=o(),c=Ae(i,t);return c===null?null:{kind:"shape-resize-drag",annotationId:t,region:Cr({region:c,corner:r,delta:Fe(a,e,s),minSize:yr(s)})}}commit({region:e}){const{annotationId:t,dispatch:r,readInputs:a}=this.params,o=Ae(a().annotations,t);o===null||jr(o,e)||r(new p.UpdateAnnotationCommand({kind:"shape",id:t,patch:{region:e}}))}},hd=({annotationId:e,panelRect:t})=>{const{commands:r}=l.useGraphContext(),a=l.useEditorStore(),o=l.useLatestRef({annotations:l.useSceneSelector(i=>i.spec.annotations),panelRect:t});return Pr((i,s)=>new ud({...s,annotationId:e,corner:i,readInputs:()=>o.current,editorStore:a,dispatch:r.dispatch}))},pd=[" ","Enter"],Lr=e=>{const t=l.useEditorStore(),r=l.useLatestRef(e);return(0,v.useEffect)(()=>()=>on(t,r.current),[t,r]),(0,v.useCallback)(a=>({onKeyDown:o=>{if(o.altKey||o.ctrlKey||o.metaKey||o.shiftKey)return;const i=t.getState(),s=r.current.readHeld();if(pd.includes(o.key)){if(o.preventDefault(),o.repeat)return;if(s!==null){on(t,r.current);return}const d=r.current.claim(a);if(d===null)return;i.claimInteraction(d);return}if(s===null)return;const c=r.current.step(s,a,o.key);c!==null&&(o.preventDefault(),i.claimInteraction(c))}}),[t,r])},on=(e,t)=>{const r=t.readHeld();r!==null&&(e.getState().releaseInteraction(r.kind),t.commit(r))},sn=4,md=({annotationId:e,panelRect:t})=>{const{commands:r}=l.useGraphContext(),a=l.useEditorStore(),o=l.useSceneSelector(i=>i.spec.annotations);return Lr({readHeld:()=>l.readResizedShapeFor(l.readStanding(a.getState(),"shape-resize-drag"),e),claim:()=>{const i=Ae(o,e);return i===null?null:{kind:"shape-resize-drag",annotationId:e,region:i}},step:(i,s,c)=>{const d=gd(c,t);return d===null?null:{kind:"shape-resize-drag",annotationId:e,region:Cr({region:i.region,corner:s,delta:d,minSize:yr(t)})}},commit:({region:i})=>{const s=Ae(o,e);s===null||jr(s,i)||r.dispatch(new p.UpdateAnnotationCommand({kind:"shape",id:e,patch:{region:i}}))}})},gd=(e,t)=>{const r=W(sn,t.width),a=W(sn,t.height);switch(e){case"ArrowLeft":return{x:-r,y:0};case"ArrowRight":return{x:r,y:0};case"ArrowUp":return{x:0,y:-a};case"ArrowDown":return{x:0,y:a};default:return null}},xd={"top-left":"diagonalDown","bottom-right":"diagonalDown","top-right":"diagonalUp","bottom-left":"diagonalUp"},vd=e=>{const t=he(),r=bd(t),a=Sd(t);if(r===null)return null;const o=a.resizedRegion??(r.region.anchorType==="panel"?r.region:null);return o===null?null:(0,n.jsx)(fd,{shape:r,region:o,isSettled:a.resizedRegion===null&&!a.isMoved,isMoved:a.isMoved,...e})},fd=({shape:e,region:t,isSettled:r,isMoved:a,panelRect:o,frameRect:i,frameElement:s})=>{const c=l.useI18n(),d=hd({annotationId:e.id,panelRect:o}),h=md({annotationId:e.id,panelRect:o}),u=l.useStyleReaderTree().annotation.shape(e.id).resolve(),{rect:m}=l.measureShapeRegion(ft(t),u.strokeWidth,o);return(0,n.jsxs)("div",{"data-testid":"shape-selection","data-annotation-id":e.id,children:[r&&(0,n.jsx)(dd,{shape:e,shapeBox:m,panelRect:o,frameWidth:i.width,frameHeight:i.height,frameElement:s}),!a&&Kc.map(g=>{const x=Xc(m,g);return(0,n.jsx)(kr,{point:{x:o.x+x.x,y:o.y+x.y},label:c(`graph.annotations.shapeToolbar.resize.${g}`),pull:xd[g],size:"md",attributes:{"data-testid":"shape-resize-handle","data-corner":g},dragHandlers:d(g),keyboardHandlers:h(g)},g)})]})},bd=e=>{const t=l.useSceneSelector(r=>r.spec.annotations.shapes);return e===null?null:t.find(r=>r.id===e)??null},Sd=e=>l.useEditorState((0,Y.useShallow)(t=>e===null?{resizedRegion:null,isMoved:!1}:{resizedRegion:l.readResizedShapeFor(l.readStanding(t,"shape-resize-drag"),e)?.region??null,isMoved:l.readMovedAnnotationFor(l.readStanding(t,"move-drag"),e)!==null})),yd=({textColor:e,...t})=>(0,n.jsxs)(l.Icon,{...t,children:[(0,n.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",children:[(0,n.jsx)("path",{d:"M6 4h12"}),(0,n.jsx)("path",{d:"M12 4v12"})]}),(0,n.jsx)("path",{d:"M5 20h14",stroke:e??"currentColor",strokeWidth:3,strokeLinecap:"round"})]});var ke="textStyle",Ir=new Set(["paragraph","heading"]),Cd=e=>{const t=Er(e),r=Pd(e);return{color:be(t.map(a=>Ld(qe(a)?.color))),font:be(t.map(a=>kd(qe(a)))),fontSize:be(t.map(a=>Id(qe(a)?.fontSize))),alignment:be(r.map(a=>Ed(a.attrs?.textAlign)))}},jd=(e,t)=>bt(e,r=>r.type==="text"?Ad(r,t):r),wd=e=>Er(e).length>0,Td=(e,t)=>bt(e,r=>Ir.has(r.type??"")?{...r,attrs:{...r.attrs,textAlign:t}}:r),bt=(e,t)=>t(e.content===void 0?e:{...e,content:e.content.map(r=>bt(r,t))}),Ad=(e,t)=>{const r=e.marks??[],a=r.find(i=>i.type===ke),o={type:ke,attrs:{...a?.attrs,...t}};return{...e,marks:a===void 0?[...r,o]:r.map(i=>i===a?o:i)}},qe=e=>e.marks?.find(t=>t.type===ke)?.attrs,kd=e=>l.readRichTextFontId(e?.font)??l.readRichTextFontId(e?.fontFamily),Er=e=>St(e,t=>t.type==="text"),Pd=e=>St(e,t=>Ir.has(t.type??"")),St=(e,t)=>[...t(e)?[e]:[],...(e.content??[]).flatMap(r=>St(r,t))],be=e=>{const[t,...r]=e;return t===void 0?null:r.every(a=>a===t)?t:null},Ld=e=>typeof e=="string"&&e.length>0?e:void 0,Id=e=>typeof e=="number"&&Number.isFinite(e)?e:void 0,Ed=e=>e==="left"||e==="center"||e==="right"?e:void 0;var Mr=[{id:"modern",key:"graph.annotations.textToolbar.font.modern"},{id:"fresh",key:"graph.annotations.textToolbar.font.fresh"},{id:"timeless",key:"graph.annotations.textToolbar.font.timeless"},{id:"technical",key:"graph.annotations.textToolbar.font.technical"},{id:"fineliner",key:"graph.annotations.textToolbar.font.fineliner"}].map(({id:e,key:t})=>({id:e,key:t,fontFamily:l.RICH_TEXT_FONT_FAMILIES[e]??e})),Md=e=>Mr.find(t=>t.id===(e??"modern"))??null;var Rr=[{size:12,key:"graph.annotations.textToolbar.fontSize.small"},{size:15,key:"graph.annotations.textToolbar.fontSize.medium"},{size:18,key:"graph.annotations.textToolbar.fontSize.large"},{size:24,key:"graph.annotations.textToolbar.fontSize.extraLarge"},{size:30,key:"graph.annotations.textToolbar.fontSize.huge"}],Rd=e=>Rr.find(t=>t.size===(e??15))??null,Od=e=>`${e}px`,_d=[{alignment:"left",Icon:Kn},{alignment:"center",Icon:Wn},{alignment:"right",Icon:qn}],Nd=({annotation:e,textBox:t,panelRect:r,frameWidth:a,frameHeight:o,frameElement:i})=>{const s=l.useI18n(),{commands:c}=l.useGraphContext(),d=l.useSceneSelector(S=>S.spec.styles.overrides),h=l.useEditorStore(),u=De(),m=l.useStyleReaderTree().annotation.text(e.id).resolve(),g=Cd(e.content),x=Md(g.font),f=Rd(g.fontSize),b=g.color??m.textColor,w=(0,v.useMemo)(()=>({target:"annotation",kind:"text",annotation:e.id}),[e.id]),T=(S,z)=>{const V=(0,p.findStyleRule)(d,{select:w})?.declarations??{};c.dispatch(new p.SetStyleRuleCommand({list:"overrides",rule:{select:w,declarations:{...V,...S}}}),z)},y=(S,z)=>{c.dispatch(new p.UpdateAnnotationCommand({kind:"text",id:e.id,patch:S}),z)},k=()=>h.getState().caret?.editor?.getJSON()??e.content,j=(S,z)=>{const V=k(),Z=h.getState().caret?.editor??null;if(Z!==null&&!wd(V)){Z.chain().focus().setMark(ke,S).run();return}y({content:jd(V,S)},z)},I=()=>{c.dispatch(new p.RemoveAnnotationCommand({id:e.id})),i.focus({preventScroll:!0})},P=S=>T(Dd(S),{transient:!0}),E=S=>j({color:S},{transient:!0}),O=S=>()=>{j({font:S}),u.close()},M=S=>()=>{j({fontSize:S}),u.close()},C=S=>y({content:Td(k(),S)});return(0,n.jsxs)(R.Root,{anchorBox:t,panelRect:r,frameWidth:a,frameHeight:o,label:s("graph.annotations.textToolbar.label"),testId:"text-toolbar",children:[(0,n.jsx)(R.ColorPicker,{color:(0,p.toPaintColor)(m.fill),label:s("graph.annotations.textToolbar.background"),hasTransparentOption:!0,onChange:P,...u.bind("background"),children:(0,n.jsx)(R.Swatch,{color:m.fill==="transparent"?Mn:(0,p.toPaintColor)(m.fill)})}),(0,n.jsx)(R.ColorPicker,{color:b,label:s("graph.annotations.textToolbar.color"),onChange:E,...u.bind("color"),children:(0,n.jsx)(yd,{size:"sm",textColor:b,title:""})}),(0,n.jsx)(R.Dropdown,{label:s("graph.annotations.textToolbar.font.ariaLabel"),trigger:(0,n.jsx)("span",{style:{fontFamily:x?.fontFamily},children:"Aa"}),...u.bind("font"),children:Mr.map(S=>(0,n.jsx)(R.MenuItem,{isSelected:S.id===x?.id,onClick:O(S.id),children:(0,n.jsx)("span",{style:{fontFamily:S.fontFamily},children:s(S.key)})},S.id))}),(0,n.jsx)(R.Dropdown,{label:s("graph.annotations.textToolbar.fontSize.ariaLabel"),trigger:f===null?"":s(f.key),...u.bind("fontSize"),children:Rr.map(S=>(0,n.jsx)(R.MenuItem,{isSelected:S.size===f?.size,onClick:M(S.size),children:(0,n.jsx)("span",{style:{fontSize:Od(S.size)},children:s(S.key)})},S.size))}),(0,n.jsx)(R.Separator,{}),(0,n.jsx)(Fd,{current:g.alignment??"center",onPick:C}),(0,n.jsx)(R.Separator,{}),(0,n.jsx)(R.IconButton,{label:s("graph.annotations.textToolbar.remove"),onClick:I,children:(0,n.jsx)(Ne,{size:"sm",title:""})})]})},Dd=e=>e==="transparent"?{fill:Nn}:{fill:e,fillAlpha:ko(e)?p.TEXT_ANNOTATION_FADE_ALPHA:1},Fd=({current:e,onPick:t})=>{const r=l.useI18n(),a=o=>()=>t(o);return(0,n.jsx)(n.Fragment,{children:_d.map(o=>(0,n.jsx)(R.ToggleButton,{label:r(`graph.annotations.textToolbar.align.${o.alignment}`),isPressed:o.alignment===e,onClick:a(o.alignment),children:(0,n.jsx)(o.Icon,{size:"sm",title:""})},o.alignment))})},zd=["left","right"];var Or=({width:e})=>W(60,e),Bd=(e,t)=>({x:t==="left"?e.x:e.x+e.width,y:e.y+e.height/2}),_r=({at:e,width:t,align:r,edge:a,delta:o,minWidth:i,panelWidth:s})=>{if(o===0)return{at:e,width:t,shift:0};const c=(0,p.alignUnitFractions)(r).x,d=Hd(e.offset,s),h=rt({start:e.x+d-c*t,extent:t,isStartMoving:a==="left",delta:o,minExtent:i}),u=h.start+c*h.extent-d;return{at:{...e,x:u},width:h.extent,shift:u-e.x}},Nr=(e,t)=>e.at.x===t.at.x&&e.width===t.width,Hd=(e,t)=>e?.x===void 0?0:e.unit==="px"?W(e.x,t):e.x,Pe=(e,t)=>{const r=e.textAnnotations.find(a=>a.id===t);return r===void 0||r.at.anchorType!=="panel"?null:{at:r.at,width:r.width,align:r.align}},Gd=class extends pe{constructor(...e){super(...e),this.kind="text-resize-drag"}readOwn(e){return l.readResizedTextFor(l.readStanding(e,"text-resize-drag"),this.params.annotationId)}resolvePreview(e){const{annotationId:t,edge:r,press:a,readInputs:o}=this.params,{annotations:i,panelRect:s}=o(),c=Pe(i,t);if(c===null)return null;const d=Fe(a,e,s).x;return{kind:"text-resize-drag",annotationId:t,delta:d,..._r({...c,edge:r,delta:d,minWidth:Or(s),panelWidth:s.width})}}commit(e){const{annotationId:t,dispatch:r,readInputs:a}=this.params,o=Pe(a().annotations,t);o===null||Nr(o,e)||r(new p.UpdateAnnotationCommand({kind:"text",id:t,patch:{at:e.at,width:e.width}}))}},Vd=({annotationId:e,panelRect:t})=>{const{commands:r}=l.useGraphContext(),a=l.useEditorStore(),o=l.useLatestRef({annotations:l.useSceneSelector(i=>i.spec.annotations),panelRect:t});return Pr((i,s)=>new Gd({...s,annotationId:e,edge:i,readInputs:()=>o.current,editorStore:a,dispatch:r.dispatch}))},$d=4,Ud=({annotationId:e,panelRect:t})=>{const{commands:r}=l.useGraphContext(),a=l.useEditorStore(),o=l.useSceneSelector(s=>s.spec.annotations),i=(s,c)=>{const d=Pe(o,e);return d===null?null:{kind:"text-resize-drag",annotationId:e,delta:c,..._r({...d,edge:s,delta:c,minWidth:Or(t),panelWidth:t.width})}};return Lr({readHeld:()=>l.readResizedTextFor(l.readStanding(a.getState(),"text-resize-drag"),e),claim:s=>i(s,0),step:(s,c,d)=>{const h=Wd(d,t);return h===null?null:i(c,s.delta+h)},commit:s=>{const c=Pe(o,e);c===null||Nr(c,s)||r.dispatch(new p.UpdateAnnotationCommand({kind:"text",id:e,patch:{at:s.at,width:s.width}}))}})},Wd=(e,t)=>{const r=W($d,t.width);switch(e){case"ArrowLeft":return-r;case"ArrowRight":return r;default:return null}},qd=e=>{const t=he(),r=Xd(t),a=Zd(t),o=l.useEditorState(s=>s.caret?.annotationId===t),i=Yd(e.panelRect,t,a.resized);return r===null||i===null?null:(0,n.jsx)(Kd,{annotation:r,textBox:i,isSettled:a.resized===null&&!a.isMoved,isMoved:a.isMoved,isResizable:r.at.anchorType==="panel",hasCaret:o,...e})},Kd=({annotation:e,textBox:t,isSettled:r,isMoved:a,isResizable:o,hasCaret:i,panelRect:s,frameRect:c,frameElement:d})=>{const h=l.useI18n(),u=Vd({annotationId:e.id,panelRect:s}),m=Ud({annotationId:e.id,panelRect:s});return(0,n.jsxs)("div",{"data-testid":"text-selection","data-annotation-id":e.id,children:[r&&(0,n.jsx)(Nd,{annotation:e,textBox:t,panelRect:s,frameWidth:c.width,frameHeight:c.height,frameElement:d}),o&&!a&&!i&&zd.map(g=>{const x=Bd(t,g);return(0,n.jsx)(kr,{point:{x:s.x+x.x,y:s.y+x.y},label:h(`graph.annotations.textToolbar.resize.${g}`),pull:"horizontal",size:"sm",attributes:{"data-testid":"text-resize-handle","data-edge":g},dragHandlers:u(g),keyboardHandlers:m(g)},g)})]})},Xd=e=>{const t=l.useSceneSelector(r=>r.spec.annotations.textAnnotations);return e===null?null:t.find(r=>r.id===e)??null},Zd=e=>l.useEditorState((0,Y.useShallow)(t=>e===null?{resized:null,isMoved:!1}:{resized:l.readResizedTextFor(l.readStanding(t,"text-resize-drag"),e),isMoved:l.readMovedAnnotationFor(l.readStanding(t,"move-drag"),e)!==null})),Yd=(e,t,r)=>{const a=l.useResolvedAnnotations(e),o=l.useMeasuredBoxes(),i=l.useStyleReaderTree(),s=(0,v.useMemo)(()=>({panel:{width:e.width,height:e.height},measuredBoxes:o,readers:i}),[e.width,e.height,o,i]);return t===null?null:Ar(a,t,r,s)?.rect??null},Jd=e=>(0,n.jsx)(l.Icon,{...e,children:(0,n.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"M12 5v14"}),(0,n.jsx)("path",{d:"M5 12h14"})]})}),Qd="var(--_1tyillx0)",eu={rest:.5,hovered:.75,open:1};var tu="_1tyillx1",nu={rest:"_1tyillx2",hovered:"_1tyillx3",open:"_1tyillx4"},ru="_1tyillx5",au={closed:"_1tyillx6",open:"_1tyillx7"},ou=({interaction:e,panelRect:t})=>{const r=l.useEditorStore(),a=e.kind==="trigger"||e.kind==="menu"?e.anchor:null,o=iu(e),i=(0,v.useMemo)(()=>{if(a===null)return null;const s=(0,p.projectAnchorToPanel)(a.position,t);return{center:s,radius:19*eu[o],target:{kind:"observation",cursor:(0,p.toPanelCursor)(s,t)}}},[a,t,o]);return(0,v.useEffect)(()=>{r.getState().setMenuTrigger(i)},[r,i]),(0,v.useEffect)(()=>()=>r.getState().setMenuTrigger(null),[r]),a===null||i===null?null:(0,n.jsx)("div",{"aria-hidden":"true","data-testid":"observation-menu-trigger","data-state":o,className:(0,U.default)(tu,nu[o]),style:{left:t.x+i.center.x,top:t.y+i.center.y,...(0,Ie.assignInlineVars)({[Qd]:a.color})},children:(0,n.jsx)("span",{className:(0,U.default)(ru,au[o==="open"?"open":"closed"]),children:(0,n.jsx)(Jd,{size:"lg"})})})},iu=e=>e.kind==="menu"?"open":e.kind==="trigger"&&e.isEngaged?"hovered":"rest",su='button:not([disabled]):not([tabindex="-1"]), [tabindex]:not([tabindex="-1"])',lu=(e,t)=>{const{chartId:r}=l.useGraphContext(),a=l.useEditorStore();(0,v.useEffect)(()=>{if(t===null)return;const o=i=>{if(i.key!=="Tab"||i.defaultPrevented||!de(i.target,e,r)||Jn(i.target)||a.getState().standingInteraction?.kind==="chrome-popup")return;const s=[...t.querySelectorAll(su)];if(s.length===0)return;i.preventDefault();const c=s.findIndex(d=>d===document.activeElement);s[c===-1?i.shiftKey?s.length-1:0:(c+(i.shiftKey?-1:1)+s.length)%s.length]?.focus()};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[e,t,r,a])},cu=(e,t)=>typeof document.elementsFromPoint=="function"?document.elementsFromPoint(e,t):[],Dr=(e,t,r)=>l.readStampedEditTargetInStack(cu(e,t),r),du=e=>{const{selectionStore:t,chartId:r}=l.useGraphContext(),a=l.useEditorStore();(0,v.useEffect)(()=>{let o=null;const i=d=>{const{caret:h}=a.getState(),u=h===null?null:Dr(d.clientX,d.clientY,e);u?.kind==="annotation"&&u.target.id===h?.annotationId||e.focus({preventScroll:!0})},s=d=>{const{selection:h,clearSelection:u}=t.getState();h.length!==0&&(de(d.target,e,r)||u())},c=d=>{t.getState().selection.length!==0&&de(d.target,e,r)&&d.relatedTarget===null&&(o!==null&&cancelAnimationFrame(o),o=requestAnimationFrame(()=>{o=null,document.hasFocus()&&(de(document.activeElement,e,r)||t.getState().clearSelection())}))};return e.addEventListener("pointerdown",i),document.addEventListener("focusin",s),document.addEventListener("focusout",c),()=>{o!==null&&cancelAnimationFrame(o),e.removeEventListener("pointerdown",i),document.removeEventListener("focusin",s),document.removeEventListener("focusout",c)}},[a,t,e,r])},uu=(e,t)=>{switch(e.kind){case"legend":{const r=t.legends[e.part.legendIndex],a=r?.items[e.part.itemIndex];if(r===void 0||a===void 0)return null;const o=hu(r,a.layerId,t.layers);return o===null?null:(0,p.buildObservationsTargetAtValue)({layer:o.layer,scope:"series",variable:o.variable,value:a.value,parsingLocale:t.parsingLocale})}case"axis":{const r=e.part;if(r===null||e.target.axis!=="x")return null;const a=t.formattedAxes.find(i=>i.scaleAestheticKey==="x");if(a===void 0||a.bandwidth===void 0)return null;const o=a.ticks[r.tickIndex];return o===void 0?null:gu(t.layers,o.value,t.parsingLocale)}case"annotation":case"grid":return null}},hu=(e,t,r)=>{const a=t===void 0?r:r.filter(o=>o.id===t);for(const o of e.aesthetics){const i=pu(a,o);if(i!==null)return i}return null},pu=(e,t)=>{for(const r of e){const a=(0,p.readVariableName)(r.mapping[t]);if(a!==null&&mu(r,a))return{layer:r,variable:a}}return null},mu=(e,t)=>e.data.hasVariable(t)&&e.data.getType(t)==="categorical",gu=(e,t,r)=>{let a=null;for(const o of e){if(!o.interactive)continue;const i=(0,p.readScopeXVariable)(o.mapping);if(i===null)continue;const s=(0,p.buildObservationsTargetAtValue)({layer:o,scope:"x-value",variable:i,value:t,parsingLocale:r});if(s!==null){if(a!==null)return null;a=s}}return a},xu=new Set(["discrete","datetime"]),vu=({hover:e,layers:t,scales:r,parsingLocale:a})=>{const{primary:o,intersection:i}=e;if(o===null)return null;const s=(0,p.findLayerById)(t,o.layerId);if(s===void 0)return null;const c=(0,p.readObservationIndex)(o),d=i?.intersects!==!1,h=(0,p.readBroadestObservationsScope)(s),u=d||!bu(r)?[h]:["x-value",h];for(const m of u){const g=(0,p.buildObservationsTarget)({layer:s,observationIndex:c,scope:m,parsingLocale:a});if(g!==null)return{layerId:s.id,observationIndex:c,isOnObservation:d,target:g}}return null},fu=(e,t,r)=>{if(!e.isOnObservation||e.target.scope!=="series")return null;const a=(0,p.findLayerById)(t,e.layerId);return a===void 0?null:(0,p.buildObservationsTarget)({layer:a,observationIndex:e.observationIndex,scope:"data-point",parsingLocale:r})},bu=e=>{const t=e.x;return t?.kind!=="position"?!1:xu.has(t.spec.scaleType)},Fr=(e,t)=>{const{target:r,clientX:a,clientY:o}=e,{frameElement:i,captureRect:s,menuTrigger:c,panelOrigin:d,resolvesObservations:h,scene:u}=t,m=c!==null&&(0,p.isPointWithinEditMenuTrigger)({x:a-d.x,y:o-d.y},c);if(!(r instanceof Element&&i.contains(r)))return{targetAtPoint:l.resolveEditTargetAtPoint({isMenuTrigger:m,stamped:ln(!1,!1,e,t),observations:null}),hover:null};const g=s!==null&&r===s,x=g&&h?Su(s):null,f=x===null?null:Cu(e,x,t),b=f===null?null:vu({hover:f,layers:u.layers,scales:u.scales,parsingLocale:u.config.parsingLocale}),w=l.resolveEditTargetAtPoint({isMenuTrigger:m,stamped:ln(g,b!==null,e,t),observations:b});return{targetAtPoint:w,hover:w?.kind==="observations"?f:null}},Su=e=>{const t=e.getBoundingClientRect();return t.width>0&&t.height>0?t:null},ln=(e,t,r,{paintsAnnotations:a,resolvesGuides:o,frameElement:i,scene:s})=>{if(!a&&s.coordSystem.type==="cartesian"&&e&&t)return null;const c=e||a?Dr(r.clientX,r.clientY,i):yu(r.target,i);return c===null?null:(c.kind==="annotation"?a:o)?c:null},yu=(e,t)=>e instanceof Element?l.readStampedEditTargetInStack([e],t):null,Cu=(e,t,r)=>{const a={x:e.clientX-t.left,y:e.clientY-t.top};return r.engine.query((0,p.toPanelCursor)(a,t),r.tolerance,t)},ju=class extends pe{constructor(...e){super(...e),this.kind="move-drag"}readOwn(e){return l.readMovedAnnotationFor(l.readStanding(e,"move-drag"),this.params.annotationId)}resolvePreview(e){const{annotationId:t,press:r,readInputs:a}=this.params,{annotations:o,panelRect:i}=a(),s=(0,p.findAnnotation)(o,t);if(s===null)return null;const c=(0,p.clampAnnotationTranslation)(s,Fe(r,e,i));return c===null?null:{kind:"move-drag",annotationId:t,translation:c}}commit({translation:e}){const{annotationId:t,dispatch:r}=this.params;uc(e)&&r(new p.MoveAnnotationCommand({id:t,translation:e}))}},wu=(e,{canSelectGraph:t,isWithinFrame:r,caretAnnotationId:a})=>{switch(e?.kind){case"annotation":return e.target.id===a?{kind:"keep-caret"}:{kind:"select-annotation",target:e.target};case"axis":case"legend":case"grid":return{kind:"select-guide",target:e.target};case"observations":return Tu(e.observations);case"menu-trigger":case void 0:break}return t&&r?{kind:"select-graph",target:{kind:"graph"}}:{kind:"clear"}},Tu=({target:e})=>e.scope==="x-value"?{kind:"select-band",target:e}:{kind:"select-observations",target:e},Au=(e,t,r,a,o)=>{const{commands:i,selectionStore:s,store:c}=l.useGraphContext(),d=l.useEditorStore(),h=l.useSceneSelector(w=>w.spec.annotations),u=l.MODE_SURFACES[l.useGraphMode()],m=l.useLatestRef(u.graphPress),g=l.useLatestRef({annotations:h,panelRect:r}),x=l.useLatestRef(t),f=l.useLatestRef(o),b=(0,v.useRef)(null);(0,v.useEffect)(()=>()=>b.current?.finish(!1),[]),(0,v.useEffect)(()=>{const w=P=>Fr({target:P.target,clientX:P.clientX,clientY:P.clientY},a()).targetAtPoint,T=P=>{if(!(P.target instanceof Element))return!1;const E=P.target.closest(l.LEGEND_OVERFLOW_CONTROL_SELECTOR);return E!==null&&e.contains(E)&&l.readStampedEditTargetInStack([P.target],e)===null},y=(P,E)=>{if(b.current!==null||!l.canMoveAnnotationOnCanvas(g.current.annotations,E.id))return;try{e.setPointerCapture(P.pointerId)}catch{return}P.preventDefault();const O=new ju({handle:e,pointerId:P.pointerId,annotationId:E.id,press:{x:P.clientX,y:P.clientY},readInputs:()=>g.current,editorStore:d,dispatch:i.dispatch,onSettled:()=>{b.current=null}});b.current=O,O.start()},k=(P,E)=>{const O=s.getState();switch(E.kind){case"select-annotation":O.setSelection([E.target]),y(P,E.target);return;case"select-observations":case"select-band":case"select-guide":case"select-graph":O.setSelection([E.target]);return;case"clear":O.clearSelection();return;default:throw new p.InternalError({message:`No press outcome for: ${JSON.stringify(E)}`})}},j=P=>{if(P.button!==0||tt(P.target)||Qn(P,x.current,d.getState().menuTrigger)||T(P))return;const E=wu(w(P),{canSelectGraph:m.current,isWithinFrame:P.target instanceof Node&&e.contains(P.target),caretAnnotationId:d.getState().caret?.annotationId??null});E.kind!=="keep-caret"&&(d.getState().setCaret(null),k(P,E))},I=P=>{if(tt(P.target)||T(P))return;const E=w(P),{layers:O,guides:M,config:C}=c.getState().scene,S=s.getState(),z=d.getState();switch(E?.kind){case"observations":{const{observations:V}=E,Z=fu(V,O,C.parsingLocale);if(Z===null)return;S.setSelection([Z]);return}case"axis":case"legend":{const V=uu(E,{layers:O,legends:M.legends.drawn,formattedAxes:f.current,parsingLocale:C.parsingLocale});if(V===null)return;S.setSelection([V]);return}case"annotation":{const{target:V}=E;if(!g.current.annotations.textAnnotations.some(Z=>Z.id===V.id))return;S.setSelection([V]),z.setCaret(V.id);return}case"grid":case"menu-trigger":case void 0:return}};return document.addEventListener("pointerdown",j),document.addEventListener("dblclick",I),()=>{document.removeEventListener("pointerdown",j),document.removeEventListener("dblclick",I)}},[e,d,s,c,i,g,x,f,m,a])},ku=e=>{const{selectionStore:t,commands:r,chartId:a}=l.useGraphContext(),o=l.useEditorStore(),i=l.useLatestRef(l.useSceneSelector(u=>u.spec.annotations.textAnnotations)),{annotations:s}=l.MODE_SURFACES[l.useGraphMode()],c=(0,v.useCallback)(u=>{const{selection:m}=t.getState(),g=s?nt(m):null;g!==null&&(u.preventDefault(),r.dispatch(new p.RemoveAnnotationCommand({id:g})),e.focus({preventScroll:!0}))},[e,r,t,s]),d=(0,v.useCallback)(u=>{if(ye(u.target,a))return;const m=s?nt(t.getState().selection):null;m!==null&&i.current.some(g=>g.id===m)&&(u.preventDefault(),o.getState().setCaret(m))},[o,t,i,a,s]),h=(0,v.useCallback)(u=>{const m=o.getState(),g=m.standingInteraction?.kind;if(g!==void 0){g!=="chrome-popup"&&m.releaseInteraction(g);return}if(m.caret!==null){m.setCaret(null),e.focus({preventScroll:!0});return}return ye(u.target,a)?e.focus({preventScroll:!0}):t.getState().clearSelection()},[o,t,e,a]);(0,v.useEffect)(()=>{const u=m=>{if(!de(m.target,e,a)||Jn(m.target))return;const g=Pu(m.target),x=o.getState().caret!==null&&!ye(m.target,a);if(!(g&&!x))switch(m.key){case"Escape":return h(m);case"Enter":return g?void 0:d(m);case"Delete":case"Backspace":return g?void 0:c(m);default:return}};return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[e,c,d,h,a,o])},Pu=e=>e instanceof HTMLElement&&(e.isContentEditable||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement),Lu=(e,t)=>{const r=l.useEditorStore(),{store:a}=l.useGraphContext(),{engine:o,overlayRef:i}=l.useHoverContext(),s=l.useLatestRef(t),{annotations:c,observationsPress:d,guidePress:h,tolerance:u}=l.MODE_SURFACES[l.useGraphMode()];return(0,v.useCallback)(()=>({frameElement:e,captureRect:i.current,panelOrigin:s.current,menuTrigger:r.getState().menuTrigger,resolvesGuides:h,paintsAnnotations:c,resolvesObservations:d,engine:o,tolerance:u??void 0,scene:a.getState().scene}),[e,i,s,r,h,c,d,o,u,a])},Iu=()=>{const e=l.MODE_SURFACES[l.useGraphMode()].observationMenu,t=l.useHoverState(s=>e?s.hover.primary:null),{layers:r,coordSystem:a}=l.useSceneSelector((0,Y.useShallow)(s=>({layers:s.layers,coordSystem:s.coordSystem}))),{anchorResolver:o}=l.useGraphContext(),i=l.useGeomReaderTree();return(0,v.useMemo)(()=>{if(t===null)return null;const s=r.find(h=>h.id===t.layerId);if(s===void 0)return null;const c=o.resolve(s.geom,t.observation,{coordSystem:a,position:s.position,purpose:"pin"});if(c===null)return null;const d=(0,p.createObservationAnchorBuilder)(s)(t.observation);return d===null?null:{position:c,color:(0,p.readGeomColor)({geom:i},s,t.observation)??p.DEFAULT_GEOM_COLOR,layer:s,at:d,observation:t.observation}},[t,r,a,o,i])},Eu={kind:"idle"},zr=()=>{const e=l.useEditorState(a=>a.standingInteraction),t=l.useEditorState(a=>a.editTargetUnderPointer?.kind==="menu-trigger"),r=Iu();return(0,v.useMemo)(()=>e!==null?e:r===null?Eu:{kind:"trigger",anchor:r,isEngaged:t},[e,r,t])},Mu=(e,t)=>e.x>=0&&e.x<=t.width&&e.y>=0&&e.y<=t.height,Ru=(e,t,r)=>{const a=l.useEditorStore(),{selectionStore:o}=l.useGraphContext(),{store:i,engine:s}=l.useHoverContext(),c=l.useLatestRef(e),d=l.useLatestRef(t),h=l.useLatestRef(r);(0,v.useEffect)(()=>{const u=b=>Qn(b,d.current,a.getState().menuTrigger),m=b=>{if(u(b)||o.getState().selection.length>0)return;const w=h.current,T=d.current,y={x:b.clientX-T.x,y:b.clientY-T.y},k=Mu(y,w)?s.query((0,p.toPanelCursor)(y,w)):p.RESTING_HOVER_STATE;i.getState().setHoverState(k)};let g=!1;const x=()=>{g=c.current.kind==="menu"},f=b=>{if(tt(b.target))return;const{claimInteraction:w,releaseInteraction:T}=a.getState();if(!u(b)||g){T("menu"),g&&m(b);return}const y=c.current;y.kind==="trigger"&&w({kind:"menu",anchor:y.anchor})};return document.addEventListener("pointerdown",x,!0),document.addEventListener("click",f),()=>{document.removeEventListener("pointerdown",x,!0),document.removeEventListener("click",f)}},[a,o,c,i,s,d,h])},Ou=(e,t,r)=>{const a=l.useEditorStore(),{store:o}=l.useGraphContext(),{store:i}=l.useHoverContext(),s=l.useLatestRef(t),c=l.MODE_SURFACES[l.useGraphMode()].observationsPress;(0,v.useEffect)(()=>(i.getState().setQueryOwnedByEditor(c),()=>i.getState().setQueryOwnedByEditor(!1)),[i,c]),(0,v.useEffect)(()=>{let d=null,h=null,u=!1;const m=j=>{if(!c)return;const I=i.getState();I.isPointerSuspended||j===null&&I.hover.primary===null||I.setHoverState(j??p.RESTING_HOVER_STATE)},g=()=>{if(d=null,h===null)return;const j=a.getState();if(Se(j.standingInteraction)){const E=j.menuTrigger!==null&&(0,p.isPointWithinEditMenuTrigger)({x:h.clientX-s.current.x,y:h.clientY-s.current.y},j.menuTrigger),O=j.editTargetUnderPointer;E?j.setEditTargetUnderPointer({kind:"menu-trigger"}):O?.kind==="menu-trigger"&&j.setEditTargetUnderPointer(null);return}u&&(u=!1,h={...h,target:_u(h)});const{targetAtPoint:I,hover:P}=Fr(h,r());j.setEditTargetUnderPointer(I),m(P)},x=()=>{d===null&&(d=requestAnimationFrame(g))},f=()=>{h!==null&&(u=!0,x())},b=()=>{a.getState().setEditTargetUnderPointer(null),m(null)},w=j=>{h={target:j.target,clientX:j.clientX,clientY:j.clientY},u=!1,x()},T=()=>{h=null,d!==null&&(cancelAnimationFrame(d),d=null),b()},y=a.subscribe((j,I)=>{Se(I.standingInteraction)&&!Se(j.standingInteraction)&&f()}),k=o.subscribe((j,I)=>{j.scene!==I.scene&&(Se(a.getState().standingInteraction)||f())});return e.addEventListener("pointermove",w),e.addEventListener("pointerleave",T),()=>{d!==null&&cancelAnimationFrame(d),y(),k(),e.removeEventListener("pointermove",w),e.removeEventListener("pointerleave",T),b()}},[e,a,o,i,s,c,r])},_u=e=>typeof document.elementFromPoint=="function"?document.elementFromPoint(e.clientX,e.clientY):e.target,Se=e=>{if(e===null)return!1;switch(e.kind){case"menu":case"move-drag":case"shape-resize-drag":case"difference-arrow-endpoint-drag":case"arrow-endpoint-drag":case"text-resize-drag":return!0;case"chrome-popup":return!1}},cn="editor",dn=[],Nu=(e,t,r,a,o)=>{const i=zr(),{store:s}=l.useHoverContext(),c=l.useGraphSelection().length>0,d=l.MODE_SURFACES[l.useGraphMode()].holdsHoverWhileSelected,h=l.useEditorState(f=>f.menuTrigger),u=i.kind==="menu",m=(0,v.useMemo)(()=>h===null?dn:[(0,p.buildEditMenuTriggerRegion)(h)],[h]),g=Lu(e,t);Ou(e,t,g),Au(e,t,r,g,o),Ru(i,t,r),du(e),ku(e),lu(e,a),(0,v.useEffect)(()=>(s.getState().publishPointerRegions(cn,m),()=>s.getState().publishPointerRegions(cn,dn)),[s,m]);const x=u||c&&d;(0,v.useEffect)(()=>(s.getState().setPointerSuspended(x),()=>s.getState().setPointerSuspended(!1)),[s,x]),(0,v.useEffect)(()=>{if(!c||!d)return;const f=s.getState();f.setHoverState(p.RESTING_HOVER_STATE),f.setTooltipAnchor(null)},[s,c,d])},Du=({frameElement:e,panelRect:t,formattedAxes:r,shouldAnimateTransitions:a})=>{const{measureRef:o,screenRect:i}=l.useElementScreenRect(),{selectionStore:s}=l.useGraphContext(),c=l.useEditorStore(),d=l.useEditorState(m=>m.caret?.annotationId??null),h=l.useGraphMode(),u=(0,v.useRef)(h);return(0,v.useEffect)(()=>(o(e),()=>o(null)),[o,e]),(0,v.useEffect)(()=>()=>{const m=c.getState();m.releaseInteraction("menu"),m.setCaret(null)},[c]),(0,v.useEffect)(()=>{if(u.current===h)return;u.current=h;const m=c.getState();m.releaseInteraction("menu"),m.setCaret(null),m.setEditTargetUnderPointer(null),s.getState().clearSelection()},[h,c,s]),i===null?null:(0,n.jsxs)(Ns,{children:[d!==null&&(0,n.jsx)(Fu,{annotationId:d,panelRect:t}),(0,n.jsx)(zu,{frameElement:e,frameRect:i,panelRect:t,formattedAxes:r,shouldAnimateTransitions:a})]})},Fu=({annotationId:e,panelRect:t})=>{const r=l.useEditorStore(),{textAnnotations:a}=l.useResolvedAnnotations(t);return(0,v.useEffect)(()=>{a.some(({id:o})=>o===e)||r.getState().setCaret(null)},[e,a,r]),null},zu=({frameElement:e,frameRect:t,panelRect:r,formattedAxes:a,shouldAnimateTransitions:o})=>{const i=(0,v.useMemo)(()=>({x:t.left+r.x,y:t.top+r.y}),[t.left,t.top,r.x,r.y]),[s,c]=(0,v.useState)(null);return Nu(e,i,r,s,a),(0,n.jsx)(Bu,{frameElement:e,frameRect:t,panelOrigin:i,panelRect:r,boxRef:c,shouldAnimateTransitions:o})},Bu=({frameElement:e,frameRect:t,panelOrigin:r,panelRect:a,boxRef:o,shouldAnimateTransitions:i})=>{const s=_e(),c=zr(),{annotations:d,editOutline:h,overlayMenu:u}=l.MODE_SURFACES[l.useGraphMode()],m=(0,v.useMemo)(()=>({width:t.width,height:t.height}),[t.width,t.height]);return(0,n.jsxs)(n.Fragment,{children:[h&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(ws,{frameElement:e,frameSize:m,panelRect:a,shouldAnimateTransitions:i}),(0,n.jsx)(Zs,{frameRect:t})]}),(0,n.jsx)(l.OverlayPortal,{rect:t,zIndex:l.Z_INDEX.editorOverlay,container:s,"data-testid":"editor-overlay",boxRef:o,children:(0,n.jsxs)(l.PortalThemeProvider,{children:[d&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Uc,{panelRect:a,panelOrigin:r,frameRect:t,frameElement:e}),(0,n.jsx)(vd,{panelRect:a,frameRect:t,frameElement:e}),(0,n.jsx)(fc,{panelRect:a,frameRect:t,frameElement:e}),(0,n.jsx)(qd,{panelRect:a,frameRect:t,frameElement:e}),(0,n.jsx)(Qc,{panelRect:a}),(0,n.jsx)(id,{panelRect:a}),(0,n.jsx)(zl,{panelRect:a}),(0,n.jsx)(Jc,{panelRect:a})]}),(0,n.jsx)(ou,{interaction:c,panelRect:a}),(0,n.jsx)(Ol,{interaction:c,frameElement:e,panelRect:a}),u&&(0,n.jsx)(Xs,{frameElement:e})]})})]})},Hu=({slots:e,mode:t,...r})=>(0,n.jsx)(In,{locale:l.useGraphLocale(),children:(0,n.jsx)(l.EditorProvider,{children:(0,n.jsx)(l.InlineEditorsProvider,{editors:Fi,children:(0,n.jsx)(l.GraphRendererBody,{slots:(0,v.useMemo)(()=>({EditorSurface:Du,...e}),[e]),mode:t,...r})})})}),Br=(0,v.createContext)(null),Hr=({labelId:e,controlId:t,children:r})=>{const a=(0,v.useMemo)(()=>{let o=null;return{labelId:e,controlId:t,claimControlId:i=>(o??=i,o===i)}},[e,t]);return(0,n.jsx)(Br.Provider,{value:a,children:r})},te=({id:e,ariaLabel:t,ariaLabelledBy:r},a=!0)=>{const o=(0,v.useContext)(Br),i=(0,v.useId)(),[s]=(0,v.useState)(()=>a?o?.claimControlId(i)??!1:!1),c=e??(s?o?.controlId:void 0),d=r??(t===void 0?o?.labelId:void 0);return{...c!==void 0&&{id:c},...t!==void 0&&{"aria-label":t},...d!==void 0&&{"aria-labelledby":d}}};var Gu={default:"woi4bh4 woi4bh3",tile:"woi4bh5 woi4bh3"},Gr=({label:e,icon:t,onClick:r,variant:a="default",isDisabled:o,ariaLabel:i,ariaLabelledBy:s,id:c})=>{const d=te({id:c,ariaLabel:i,ariaLabelledBy:s}),h=a==="tile";return(0,n.jsxs)("button",{type:"button",className:Gu[a],disabled:o,onClick:r,...d,children:[t!==void 0&&(0,n.jsx)("span",{className:"woi4bh0",children:t}),e!==void 0&&(0,n.jsx)("span",{className:h?"woi4bh2":"woi4bh1",children:e})]})},yt=(0,v.createContext)(null),N=()=>{const e=(0,v.useContext)(yt);if(!e)throw new Error("An editing section must sit inside an <EditorPanel.Root> bound to a graph — pass it a `handle`, or render the panel inside a <GraphProvider>.");return e},Vr=({children:e,onKeyDown:t,...r})=>{const a=(0,v.useContext)(yt),o=i=>{if(t?.(i),!a||i.defaultPrevented)return;const s=l.resolveHistoryStep(i.nativeEvent);s&&(i.preventDefault(),s==="undo"?a.undo():a.redo())};return(0,n.jsx)("div",{onKeyDown:o,...r,children:e})},$r="keyboard",ze=e=>{const t=(0,v.useRef)(!1),r=(0,v.useRef)(!1),a=()=>{t.current=!1,r.current&&(r.current=!1,e?.())};return{commitAfterChange:()=>{if(t.current){r.current=!0;return}e?.()},commitUnlessHeldKey:o=>{if(o){r.current=!0;return}e?.()},gestureHandlers:{onKeyDown:()=>{t.current=!0},onKeyUp:a,onBlur:o=>{o.relatedTarget instanceof Node&&o.currentTarget.contains(o.relatedTarget)||a()}}}},Vu="eh8dvc0",$u="eh8dvc1 uz3g760",Uu="eh8dvc2 uz3g761";var Ur=({value:e,onChange:t,onCommit:r,min:a,max:o,step:i,placeholder:s,prefix:c,suffix:d,isDisabled:h,hasError:u,ariaLabel:m,ariaLabelledBy:g,id:x})=>{const f=te({id:x,ariaLabel:m,ariaLabelledBy:g}),{commitUnlessHeldKey:b,gestureHandlers:w}=ze(r);return(0,n.jsx)(Lt.NumberField.Root,{className:Vu,value:e,onValueChange:T=>t(T),onValueCommitted:(T,y)=>{b(y.reason===$r)},min:a,max:o,step:i,disabled:h,children:(0,n.jsxs)(Vr,{className:$u,"data-error":u===!0,"data-disabled":h===!0?"":void 0,children:[c!==void 0&&(0,n.jsx)("span",{className:"eh8dvc3",children:c}),(0,n.jsx)(Lt.NumberField.Input,{className:Uu,placeholder:s,...w,"aria-invalid":u===!0?!0:void 0,...f}),d!==void 0&&(0,n.jsx)("span",{className:"eh8dvc3",children:d})]})})},Wu="_1b7s5f0",ae={1:"_1b7s5f1",2:"_1b7s5f2",3:"_1b7s5f3",4:"_1b7s5f4",5:"_1b7s5f5",6:"_1b7s5f6"},qu="_1b7s5f7";var Ku=6,Wr=({options:e,value:t,onChange:r,onCommit:a,columns:o,itemLayout:i="tile",isDisabled:s,ariaLabel:c,ariaLabelledBy:d,id:h})=>{const u=te({id:h,ariaLabel:c,ariaLabelledBy:d}),m=i==="swatch",{commitAfterChange:g,gestureHandlers:x}=ze(a);return(0,n.jsx)(Ln.RadioGroup,{className:(0,U.default)(Wu,Xu(o??e.length)),value:t,onValueChange:f=>{r(f),g()},...x,disabled:s,...u,children:e.map(f=>(0,n.jsxs)(Pn.Radio.Root,{value:f.value,disabled:f.isDisabled,className:(0,U.default)(qu,m&&"_1b7s5f8"),"aria-label":m?f.label:void 0,children:[f.icon,!m&&(0,n.jsx)("span",{className:"_1b7s5f9",children:f.label})]},f.value))})},Xu=e=>{switch(Math.min(Math.max(Math.round(e),1),Ku)){case 1:return ae[1];case 2:return ae[2];case 3:return ae[3];case 4:return ae[4];case 5:return ae[5];default:return ae[6]}},Zu="_1g5x15w0 uz3g760",Yu="_1g5x15w1",Ju="_1g5x15w2",un="_1g5x15w3",Qu="_1g5x15w4",e0="_1g5x15w5",t0="_1g5x15w6",n0="_1g5x15w7";var qr=({options:e,value:t,onChange:r,placeholder:a,isDisabled:o,hasError:i,ariaLabel:s,ariaLabelledBy:c,id:d})=>{const h=te({id:d,ariaLabel:s,ariaLabelledBy:c});return(0,n.jsxs)(K.Select.Root,{value:t,onValueChange:u=>u!==null&&r(u),disabled:o,items:e.map(u=>({value:u.value,label:u.label})),children:[(0,n.jsxs)(K.Select.Trigger,{className:Zu,"data-error":i===!0,...h,children:[(0,n.jsx)(K.Select.Value,{className:Yu,children:u=>r0(e,u,a)}),(0,n.jsx)(K.Select.Icon,{className:un,children:(0,n.jsx)(ue,{size:"sm"})})]}),(0,n.jsx)(K.Select.Portal,{container:l.resolvePortalContainer(),children:(0,n.jsx)(l.PortalThemeProvider,{children:(0,n.jsx)(K.Select.Positioner,{className:Qu,sideOffset:4,alignItemWithTrigger:!1,children:(0,n.jsx)(K.Select.Popup,{className:e0,children:e.map(u=>(0,n.jsxs)(K.Select.Item,{value:u.value,disabled:u.isDisabled,className:t0,children:[u.icon,(0,n.jsxs)("span",{className:n0,children:[(0,n.jsx)(K.Select.ItemText,{children:u.label}),u.description!==void 0&&(0,n.jsx)("span",{className:"_1g5x15w8",children:u.description})]}),(0,n.jsx)(K.Select.ItemIndicator,{className:un,children:(0,n.jsx)(Un,{size:"sm"})})]},u.value))})})})})]})},r0=(e,t,r)=>t===null?(0,n.jsx)("span",{className:Ju,children:r}):a0(e,t),a0=(e,t)=>e.find(r=>r.value===t)?.label??t,o0="vod76w0",i0="vod76w1",s0="vod76w2",l0="vod76w3",c0="vod76w4",d0="vod76w5";var Kr=({value:e,onChange:t,onCommit:r,min:a,max:o,step:i,suffix:s,formatValue:c,isDisabled:d,ariaLabel:h,ariaLabelledBy:u})=>{const m=te({ariaLabel:h,ariaLabelledBy:u},!1),g=u0(e,s,c),{commitUnlessHeldKey:x,gestureHandlers:f}=ze(r);return(0,n.jsxs)("div",{className:o0,children:[(0,n.jsx)(X.Slider.Root,{className:i0,value:e,onValueChange:b=>t(b),onValueCommitted:(b,w)=>{x(w.reason===$r)},min:a,max:o,step:i,disabled:d,children:(0,n.jsx)(X.Slider.Control,{className:s0,children:(0,n.jsxs)(X.Slider.Track,{className:l0,children:[(0,n.jsx)(X.Slider.Indicator,{className:c0}),(0,n.jsx)(X.Slider.Thumb,{className:d0,...f,...m})]})})}),g!==null&&(0,n.jsx)("span",{className:"vod76w6",children:g})]})},u0=(e,t,r)=>r!==void 0?r(e):t!==void 0?`${e}${t}`:null,h0="_1hyrlw60",p0="_1hyrlw61",Xr=({isChecked:e,onChange:t,isDisabled:r,ariaLabel:a,ariaLabelledBy:o,id:i})=>{const s=te({id:i,ariaLabel:a,ariaLabelledBy:o});return(0,n.jsx)(It.Switch.Root,{checked:e,onCheckedChange:c=>t(c),disabled:r,className:h0,...s,children:(0,n.jsx)(It.Switch.Thumb,{className:p0})})},m0="uz3g761",g0="tpcnun0 uz3g760",Zr=({value:e,onChange:t,onCommit:r,placeholder:a,isDisabled:o,hasError:i,ariaLabel:s,ariaLabelledBy:c,id:d})=>{const h=te({id:d,ariaLabel:s,ariaLabelledBy:c});return(0,n.jsx)(Vr,{className:g0,"data-error":i===!0,children:(0,n.jsx)(Ha.Input,{className:m0,value:e,onValueChange:u=>t(u),onBlur:r,placeholder:a,disabled:o,"aria-invalid":i===!0?!0:void 0,...h})})},x0="cnu9yl0",v0="cnu9yl1";var Yr=({options:e,value:t,onChange:r,onCommit:a,itemLayout:o="inline",isDisabled:i,ariaLabel:s,ariaLabelledBy:c,id:d})=>{const h=te({id:d,ariaLabel:s,ariaLabelledBy:c}),u=o==="stacked",{commitAfterChange:m,gestureHandlers:g}=ze(a);return(0,n.jsx)(Ln.RadioGroup,{className:x0,value:t,onValueChange:x=>{r(x),m()},...g,disabled:i,...h,children:e.map(x=>(0,n.jsxs)(Pn.Radio.Root,{value:x.value,disabled:x.isDisabled,className:(0,U.default)(v0,u&&"cnu9yl2"),"aria-label":f0(x,u),children:[x.icon,Jr(x,u)&&(0,n.jsx)("span",{className:"cnu9yl3",children:x.label})]},x.value))})},Jr=(e,t)=>e.icon===void 0||t,f0=(e,t)=>{if(!Jr(e,t))return e.label},b0={ToggleGroup:Yr,Switch:Xr,Slider:Kr,RadioGrid:Wr,Button:Gr,TextField:Zr,NumberField:Ur,Select:qr},ot=(0,v.createContext)(b0),Qr=({controls:e,children:t})=>{const r=(0,v.useContext)(ot),a=(0,v.useMemo)(()=>({ToggleGroup:e?.ToggleGroup??r.ToggleGroup,Switch:e?.Switch??r.Switch,Slider:e?.Slider??r.Slider,RadioGrid:e?.RadioGrid??r.RadioGrid,Button:e?.Button??r.Button,TextField:e?.TextField??r.TextField,NumberField:e?.NumberField??r.NumberField,Select:e?.Select??r.Select}),[r,e?.ToggleGroup,e?.Switch,e?.Slider,e?.RadioGrid,e?.Button,e?.TextField,e?.NumberField,e?.Select]);return(0,n.jsx)(ot.Provider,{value:a,children:t})},D=()=>(0,v.useContext)(ot),S0="_12lhx9e0",ea=({children:e})=>(0,n.jsx)("div",{className:S0,children:e}),y0="_139ohwv0",G=({children:e})=>(0,n.jsx)("div",{className:y0,children:e}),ta=(0,v.createContext)(null),C0=ta.Provider,na=()=>{const e=(0,v.useContext)(ta);if(!e)throw new Error("A section must be rendered inside <EditorPanel.Root>.");return e},j0="_1jlczkt0",ra="data-graphy-editor-panel",w0={List:G,Grid:ea};function T0(e){if(e===void 0)return!1;const t=e.split(/\s+/);return t.includes("_1ii3bsb0")||t.includes("_1ii3bsb1")}var A0=({handle:e,children:t,controls:r,defaultExpandedSection:a=void 0,className:o})=>{const i=l.useGraphHandle(e),{themeClass:s,inlineVarsStyle:c}=l.useThemeContext(),[d,h]=(0,v.useState)(()=>a?[a]:[]),u=(0,v.useMemo)(()=>({expandSection:m=>h([m]),collapseAllSections:()=>h([])}),[]);return(0,n.jsx)(yt.Provider,{value:i,children:(0,n.jsx)(Qr,{controls:r,children:(0,n.jsx)(C0,{value:u,children:(0,n.jsx)(ce.Accordion.Root,{[ra]:"",className:(0,U.default)(j0,o,{[s]:!T0(o)}),style:c,value:d,onValueChange:m=>h(m),children:t})})})})},Ct={Root:A0,Controls:w0},hn={stack:"pr583x0",grid:"pr583x1"},pn="pr583x2",k0={plain:"pr583x4 pr583x3",withIcon:"pr583x5 pr583x3"},A=({label:e,layout:t="grid",icon:r,children:a})=>{const o=(0,v.useId)(),i=(0,v.useId)();return e===void 0?(0,n.jsx)("div",{className:hn[t],children:(0,n.jsx)("div",{className:pn,children:a})}):(0,n.jsxs)("div",{className:hn[t],children:[(0,n.jsxs)("label",{id:o,htmlFor:i,className:k0[r===void 0?"plain":"withIcon"],children:[r!==void 0&&(0,n.jsx)("span",{"aria-hidden":"true",children:r}),e]}),(0,n.jsx)("div",{className:pn,children:(0,n.jsx)(Hr,{labelId:o,controlId:i,children:a})})]})},P0=e=>(0,n.jsx)(l.Icon,{...e,children:(0,n.jsx)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:(0,n.jsx)("path",{d:"m9 6 6 6-6 6"})})}),jt="_40zvwv0",wt="_40zvwv1",L0="_40zvwv2",aa="_40zvwv3",I0="_40zvwv4 _40zvwv3";var E0="_40zvwv6";var M0="_40zvwv8",F=({title:e,layout:t="fixed",preview:r,accessory:a,onOpenChange:o,children:i})=>t==="collapsible"?(0,n.jsx)(O0,{title:e,preview:r,accessory:a,onOpenChange:o,children:i}):t==="inline"&&r===void 0?(0,n.jsx)(R0,{title:e,accessory:a,children:i}):(0,n.jsxs)("div",{className:jt,children:[(0,n.jsxs)("div",{className:wt,children:[(0,n.jsx)("span",{className:aa,children:e}),r!==void 0&&(0,n.jsx)("span",{className:"_40zvwv5",children:r}),a!==void 0&&(0,n.jsx)("span",{className:"_40zvwv7",children:a})]}),(0,n.jsx)("div",{children:i})]}),R0=({title:e,accessory:t,children:r})=>{const a=(0,v.useId)(),o=(0,v.useId)();return(0,n.jsx)("div",{className:jt,children:(0,n.jsxs)("div",{className:wt,children:[(0,n.jsx)("label",{id:a,htmlFor:o,className:I0,children:e}),(0,n.jsx)("span",{className:E0,children:(0,n.jsx)(Hr,{labelId:a,controlId:o,children:r})}),t!==void 0&&(0,n.jsx)("span",{className:"_40zvwv7",children:t})]})})},O0=({title:e,preview:t,accessory:r,onOpenChange:a,children:o})=>{const i=l.useI18n();return(0,n.jsxs)(ce.Accordion.Item,{value:e,className:jt,onOpenChange:a,children:[(0,n.jsxs)(ce.Accordion.Header,{className:wt,render:(0,n.jsx)("div",{}),children:[(0,n.jsx)(ce.Accordion.Trigger,{className:L0,"aria-label":i("editor.accessibility.toggleSection",{title:e})}),(0,n.jsx)("span",{className:aa,children:e}),t!==void 0&&(0,n.jsx)("span",{className:"_40zvwv5",children:t}),r!==void 0&&(0,n.jsx)("span",{className:"_40zvwv7",children:r}),(0,n.jsx)("span",{className:M0,children:(0,n.jsx)(P0,{size:"sm"})})]}),(0,n.jsx)(ce.Accordion.Panel,{children:(0,n.jsx)("div",{children:o})})]})},oa=({title:e,isChecked:t,onToggle:r,isDisabled:a,preview:o,children:i})=>{const{expandSection:s,collapseAllSections:c}=na(),{Switch:d}=D(),h=m=>{r(m),m?s(e):c()},u=m=>{m&&!t&&a!==!0&&r(!0)};return(0,n.jsx)(F,{title:e,layout:"collapsible",preview:o,onOpenChange:u,accessory:(0,n.jsx)(d,{isChecked:t,onChange:h,isDisabled:a,ariaLabel:e}),children:i})},_0={horizontal:["bottom","top"],vertical:["left","right"]},N0={left:"editor.axesPanel.position.left",right:"editor.axesPanel.position.right",top:"editor.axesPanel.position.top",bottom:"editor.axesPanel.position.bottom"},D0={x:"editor.axesPanel.mainAxisSection.xAxis",y:"editor.axesPanel.mainAxisSection.yAxis"},it=({axis:e,title:t,layout:r="collapsible",preview:a})=>{const o=N(),i=l.useHandleScene(o),s=l.useI18n(),{NumberField:c,Switch:d,TextField:h,ToggleGroup:u}=D();if(!i)return null;const m=i.coordSystem.type==="polar"?i.coordSystem.axisMapping[e].geometry:"linear",g=i.config.axes[e],x=i.scales[e],f=x?.spec,b=f?.scaleType==="continuous"?f:void 0;if(m==="circular"||m==="radial"&&b===void 0)return null;const w=f!==void 0&&"reverse"in f?f:void 0,T=f?.scaleType==="continuous"||f?.scaleType==="datetime",y=b!==void 0&&(0,p.isZeroAnchoredAxis)(i,e),k=b?.transform==="log",j=b?.domainMax??null,I=F0(b),P=(L,q)=>L.map(me=>({value:me,label:q(me)})),E=i.guides.axes.find(L=>L.scaleAestheticKey===e)?.position,O=_0[E==="bottom"||E==="top"||E===void 0&&e==="x"?"horizontal":"vertical"],M=e==="y"?(0,p.readComboLineLayerId)(i.spec):null,C=M===null?void 0:(0,p.findLayerById)(i.spec.layers,M),S=i.guides.legends.drawn.some(L=>O.some(q=>q===L.position)),z=O.map(L=>({value:L,label:s(N0[L])})),V=P(["auto","edges"],L=>s(L==="edges"?"editor.axesPanel.labelMode.edges":"editor.axesPanel.labelMode.auto")),Z=P(["linear","log"],L=>s(L==="log"?"editor.axesPanel.scale.log":"editor.axesPanel.scale.auto")),ga=P(["auto","zero","custom"],L=>s(L==="zero"?"editor.axesPanel.startFrom.zero":L==="custom"?"editor.axesPanel.startFrom.custom":"editor.axesPanel.startFrom.auto")),xa=P(["auto","custom"],L=>s(L==="custom"?"editor.axesPanel.endAt.custom":"editor.axesPanel.endAt.auto")),va=P(["no","yes"],L=>s(L==="yes"?"editor.axesPanel.yesNo.yes":"editor.axesPanel.yesNo.no")),fa=P(["single","double"],L=>s(L==="double"?"editor.axesPanel.axisCount.double":"editor.axesPanel.axisCount.single")),ba=L=>{o.commands.dispatch(new p.SetAxisVisibilityCommand({axis:e,isVisible:L}))},Sa=L=>{o.commands.dispatch(new p.SetAxisLabelCommand({axis:e,label:L===""?null:L}),{transient:!0})},ya=L=>{o.commands.dispatch(new p.SetAxisTicksVisibilityCommand({axis:e,isVisible:L}))},Ca=L=>{o.commands.dispatch(new p.SetAxisTickModeCommand({axis:e,tickMode:L==="edges"?"edges":"auto"}))},ja=L=>{o.commands.dispatch(new p.SetScaleReverseCommand({scaledAesthetic:e,reverse:L==="yes"}))},wa=L=>{o.commands.dispatch(new p.SetScaleTransformCommand({scaledAesthetic:e,transform:L==="log"?"log":"linear"}))},kt=L=>{o.commands.dispatch(new p.SetScaleDomainCommand({scaledAesthetic:e,...L}),{transient:!0})},Ta=L=>{L!==null&&kt({domainMin:L})},Aa=L=>{L!==null&&kt({domainMax:L})},ka=L=>{const q=L==="auto"?null:L==="zero"?0:mn(x?.domain,"start");o.commands.dispatch(new p.SetScaleDomainCommand({scaledAesthetic:e,domainMin:q}))},Pa=L=>{const q=L==="custom"?mn(x?.domain,"end"):null;o.commands.dispatch(new p.SetScaleDomainCommand({scaledAesthetic:e,domainMax:q}))},La=L=>{C!==void 0&&o.commands.dispatch(new p.SetLayerYScaleTypeCommand({layerId:C.id,yScaleType:L==="double"?"secondary":"primary"}))},Ia=L=>{const q=O.find(me=>me===L);q&&o.commands.dispatch(new p.SetAxisPositionCommand({axis:e,position:q}))};return(0,n.jsx)(F,{title:t??s(D0[e]),layout:r,preview:a,children:(0,n.jsxs)(G,{children:[(0,n.jsx)(A,{label:s("editor.axesPanel.controls.visible"),children:(0,n.jsx)(d,{isChecked:g.isVisible,onChange:ba})}),C!==void 0&&(0,n.jsx)(A,{label:s("editor.axesPanel.controls.numberOfAxes"),children:(0,n.jsx)(u,{value:C.yScaleType==="secondary"?"double":"single",options:fa,onChange:La})}),m==="linear"&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(A,{label:s("editor.axesPanel.controls.title"),children:(0,n.jsx)(h,{value:g.label??"",onChange:Sa,onCommit:o.commands.commit})}),(0,n.jsx)(A,{label:s("editor.axesPanel.controls.ticks"),children:(0,n.jsx)(d,{isChecked:g.ticks.isVisible,onChange:ya})})]}),T&&(0,n.jsx)(A,{label:s("editor.axesPanel.controls.labels"),children:(0,n.jsx)(u,{value:g.ticks.mode,options:V,onChange:Ca})}),b&&m==="linear"&&!S&&(0,n.jsx)(A,{label:s("editor.axesPanel.controls.position"),children:(0,n.jsx)(u,{value:E??g.position,options:z,onChange:Ia})}),w!==void 0&&(0,n.jsx)(A,{label:s("editor.axesPanel.controls.reverse"),children:(0,n.jsx)(u,{value:w.reverse===!0?"yes":"no",options:va,onChange:ja})}),b&&!y&&(0,n.jsx)(A,{label:s("editor.axesPanel.controls.scale"),children:(0,n.jsx)(u,{value:k?"log":"linear",options:Z,onChange:wa})}),b&&!k&&(0,n.jsxs)(n.Fragment,{children:[!y&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(A,{label:s("editor.axesPanel.controls.startFrom"),children:(0,n.jsx)(u,{value:I,options:ga,onChange:ka})}),I!=="auto"&&(0,n.jsx)(A,{label:s("editor.axesPanel.controls.value"),children:(0,n.jsx)(c,{value:b.domainMin??null,onChange:Ta,onCommit:o.commands.commit})})]}),(0,n.jsx)(A,{label:s("editor.axesPanel.controls.endAt"),children:(0,n.jsx)(u,{value:j===null?"auto":"custom",options:xa,onChange:Pa})}),j!==null&&(0,n.jsx)(A,{label:s("editor.axesPanel.controls.value"),children:(0,n.jsx)(c,{value:j,onChange:Aa,onCommit:o.commands.commit})})]})]})})},F0=e=>{const t=e?.domainMin??null;return t===null?"auto":t===0?"zero":"custom"},mn=(e,t)=>{const r=t==="start"?e?.[0]:e?.[e.length-1];return typeof r=="number"?r:0},Tt=({value:e,onChange:t})=>{const r=N(),a=l.useI18n(),{TextField:o}=D(),i=e!==null&&typeof e!="string",s=c=>t(c===""?null:c);return(0,n.jsx)(A,{label:a("editor.elementsPanel.contentValue"),children:(0,n.jsx)(o,{value:typeof e=="string"?e:"",onChange:s,onCommit:r.commands.commit,isDisabled:i})})},ia=({title:e,layout:t="collapsible",preview:r})=>{const a=N(),o=l.useHandleScene(a),i=l.useI18n(),{Switch:s}=D();if(!o)return null;const c=o.config.content,d=u=>{a.commands.dispatch(new p.ToggleContentVisibilityCommand({part:"caption",isVisible:u}))},h=u=>{a.commands.dispatch(new p.SetContentCaptionCommand({caption:u}),{transient:!0})};return(0,n.jsx)(F,{title:e??i("editor.elementsPanel.footerSection.caption"),layout:t,preview:r,children:(0,n.jsxs)(G,{children:[(0,n.jsx)(A,{label:i("editor.elementsPanel.contentVisible"),children:(0,n.jsx)(s,{isChecked:c.isCaptionVisible,onChange:d})}),(0,n.jsx)(Tt,{value:c.caption,onChange:h})]})})},gn=/^[a-z][a-z\d+.-]*:/i,z0={},sa=({title:e,layout:t="collapsible",preview:r})=>{const a=N(),o=l.useHandleScene(a),i=l.useI18n(),{Switch:s}=D();if(!o)return null;const c=o.config.content,d=h=>{a.commands.dispatch(new p.ToggleContentVisibilityCommand({part:"source",isVisible:h}))};return(0,n.jsx)(F,{title:e??i("editor.elementsPanel.sourceSection.title"),layout:t,preview:r,children:(0,n.jsxs)(G,{children:[(0,n.jsx)(A,{label:i("editor.elementsPanel.contentVisible"),children:(0,n.jsx)(s,{isChecked:c.isSourceVisible,onChange:d})}),(0,n.jsx)(B0,{source:c.source??z0})]})})},B0=({source:e})=>{const t=N(),r=l.useI18n(),{TextField:a}=D(),o=d=>{const h=(d.label??"")!==""||(d.url??"")!=="";t.commands.dispatch(new p.SetContentSourceCommand({source:h?d:null}),{transient:!0})},i=()=>{const d=e.url??"";d!==""&&!gn.test(d)&&o({...e,url:`https://${d}`}),t.commands.commit()},s=d=>o({...e,url:d}),c=d=>o({...e,label:d});return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(A,{label:r("editor.elementsPanel.sourceSection.url"),children:(0,n.jsx)(a,{value:e.url??"",onChange:s,onCommit:i,hasError:gn.test(e.url??"")&&!(0,p.isSafeUrl)(e.url)})}),(0,n.jsx)(A,{label:r("editor.elementsPanel.sourceSection.name"),children:(0,n.jsx)(a,{value:e.label??"",onChange:c,onCommit:t.commands.commit})})]})},la=({title:e,layout:t="collapsible",preview:r})=>{const a=N(),o=l.useHandleScene(a),i=l.useI18n(),{Switch:s}=D();if(!o)return null;const c=o.config.content,d=u=>{a.commands.dispatch(new p.ToggleContentVisibilityCommand({part:"subtitle",isVisible:u}))},h=u=>{a.commands.dispatch(new p.SetContentSubtitleCommand({subtitle:u}),{transient:!0})};return(0,n.jsx)(F,{title:e??i("editor.elementsPanel.headerSection.subtitle"),layout:t,preview:r,children:(0,n.jsxs)(G,{children:[(0,n.jsx)(A,{label:i("editor.elementsPanel.contentVisible"),children:(0,n.jsx)(s,{isChecked:c.isSubtitleVisible,onChange:d})}),(0,n.jsx)(Tt,{value:c.subtitle,onChange:h})]})})},Be=e=>{const{colorScheme:t}=l.useThemeContext(),r=(0,v.useMemo)(()=>(0,p.createStyleResolver)({colorScheme:t}),[t]);return(0,v.useMemo)(()=>e===null?null:r.readers(e),[e,r])},At=(e,t,r)=>{const a=Be(e);return(0,v.useMemo)(()=>{if(a===null||e===null||t===null)return null;const o=(0,p.findLayerById)(e.layers,t);return o===void 0?null:a.geom[r](o)},[a,e,t,r])},st=[.8,1,1.2,1.4,1.6,1.8,2,2.5,3,4],H0=st.length/2,G0={select:{target:"graph"}},ca=({title:e,layout:t="collapsible",preview:r})=>{const a=N(),o=l.useHandleScene(a),i=l.useI18n(),{RadioGrid:s}=D(),c=Be(o);if(!o||!c)return null;const d=c.graph().get("textScale"),h=g=>i("editor.elementsPanel.textSizeSection.scaleFormat",{value:`${g}`}),u=st.map(g=>({value:`${g}`,label:h(g)})),m=g=>{const x=st.find(b=>`${b}`===g);if(x===void 0)return;const f=(0,p.findStyleRule)(o.spec.styles.overrides,G0)?.declarations??{};a.commands.dispatch(new p.SetStyleRuleCommand({list:"overrides",rule:{select:{target:"graph"},declarations:{...f,textScale:x}}}))};return(0,n.jsx)(F,{title:e??i("editor.elementsPanel.textSizeSection.title"),layout:t,preview:r??h(d),children:(0,n.jsx)(s,{value:`${d}`,options:u,columns:H0,onChange:m,ariaLabel:i("editor.elementsPanel.textSizeSection.title")})})},da=({title:e,layout:t="collapsible",preview:r})=>{const a=N(),o=l.useHandleScene(a),i=l.useI18n(),{Switch:s}=D();if(!o)return null;const c=o.config.content,d=u=>{a.commands.dispatch(new p.ToggleContentVisibilityCommand({part:"title",isVisible:u}))},h=u=>{a.commands.dispatch(new p.SetContentTitleCommand({title:u}),{transient:!0})};return(0,n.jsx)(F,{title:e??i("editor.elementsPanel.headerSection.toggleTitle"),layout:t,preview:r,children:(0,n.jsxs)(G,{children:[(0,n.jsx)(A,{label:i("editor.elementsPanel.contentVisible"),children:(0,n.jsx)(s,{isChecked:c.isTitleVisible,onChange:d})}),(0,n.jsx)(Tt,{value:c.title,onChange:h})]})})},V0=({children:e,...t})=>(0,n.jsx)(Ct.Root,{...t,children:e??(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(da,{}),(0,n.jsx)(la,{}),(0,n.jsx)(ia,{}),(0,n.jsx)(sa,{}),(0,n.jsx)(ca,{})]})}),$0=({children:e,...t})=>(0,n.jsx)(Ct.Root,{...t,children:e??(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(it,{axis:"x"}),(0,n.jsx)(it,{axis:"y"})]})}),He=e=>`${e}px`,ua=e=>`${Math.round(e*100)}%`,U0=e=>`${e}°`,W0=24,q0={select:{target:"graph"}},xn=["dim","desaturate"],K0=({title:e,layout:t="collapsible",preview:r})=>{const a=N(),o=l.useHandleScene(a),i=l.useI18n(),{Slider:s,ToggleGroup:c}=D(),d=Be(o);if(!o||!d)return null;const h=d.graph().get("cornerRadius"),u=(0,p.readHighlightDimStyle)(o.spec),m=xn.map(f=>({value:f,label:i(f==="dim"?"editor.highlighting.highlightStyle.tint":"editor.highlighting.highlightStyle.gray")})),g=f=>{const b=(0,p.findStyleRule)(o.spec.styles.overrides,q0)?.declarations??{};a.commands.dispatch(new p.SetStyleRuleCommand({list:"overrides",rule:{select:{target:"graph"},declarations:{...b,cornerRadius:f}}}),{transient:!0})},x=f=>{const b=xn.find(w=>w===f);b&&a.commands.dispatch(new p.SetHighlightDimStyleCommand({dimStyle:b}))};return(0,n.jsx)(F,{title:e??i("editor.colorPanel.appearanceSection.title"),layout:t,preview:r,children:(0,n.jsxs)(G,{children:[(0,n.jsx)(A,{label:i("editor.colorPanel.borderSection.cornerRadius"),children:(0,n.jsx)(s,{value:h,min:0,max:W0,step:1,formatValue:He,onChange:g,onCommit:a.commands.commit})}),(0,n.jsx)(A,{label:i("editor.colorPanel.appearanceSection.highlightStyle"),children:(0,n.jsx)(c,{value:u,options:m,onChange:x})})]})})},X0=.05,Z0=({title:e,layout:t="collapsible",preview:r})=>{const a=N(),o=l.useHandleScene(a),i=l.useI18n(),{Slider:s,ToggleGroup:c}=D(),d=o?(0,p.findLayerByGeom)(o.spec.layers,"bar"):void 0,h=At(o,d?.id??null,"bar");if(!o||!d||o.coordSystem.type==="polar"&&o.coordSystem.bandAxis===null)return null;const u=b=>{a.commands.dispatch(new p.SetBarWidthCommand({layerId:d.id,width:b}),{transient:!0})},m=b=>{const w=p.BORDER_RADIUS_TOKENS.find(T=>T===b);w&&a.commands.dispatch(new p.SetBarCornerRadiusCommand({layerId:d.id,cornerRadius:w}))},g=p.BORDER_RADIUS_TOKENS.map(b=>({value:b,label:i(`editor.graphPanel.barSection.roundingOptions.${b}`)})),x=(0,p.resolveBarBandFraction)(d.params,o.coordSystem.type),f=h?.get("cornerRadius")??p.DEFAULT_BAR_CORNER_RADIUS;return(0,n.jsx)(F,{title:e??i("editor.graphPanel.barSection.title"),layout:t,preview:r,children:(0,n.jsxs)(G,{children:[(0,n.jsx)(A,{label:i("editor.graphPanel.barSection.thickness"),children:(0,n.jsx)(s,{value:x,min:p.MIN_BAR_WIDTH_FRACTION,max:p.MAX_BAR_WIDTH_FRACTION,step:X0,formatValue:ua,onChange:u,onCommit:a.commands.commit})}),(0,n.jsx)(A,{label:i("editor.graphPanel.barSection.rounding"),layout:"stack",children:(0,n.jsx)(c,{value:typeof f=="string"?f:"",options:g,onChange:m})})]})})},Ge=({children:e})=>{const t=(0,v.useId)();return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("g",{filter:`url(#${t})`,children:e}),(0,n.jsx)("defs",{children:(0,n.jsxs)("filter",{id:t,x:"-20%",y:"-20%",width:"140%",height:"140%",children:[(0,n.jsx)("feDropShadow",{dx:"0",dy:"0",stdDeviation:"0.586",floodColor:"#0F0F18",floodOpacity:"0.12"}),(0,n.jsx)("feDropShadow",{dx:"0",dy:"1.172",stdDeviation:"0.586",floodColor:"#0E0E34",floodOpacity:"0.16"})]})})]})},Ve="qdaoth0",Y0=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 31 33",...e,children:[(0,n.jsx)(Ge,{children:(0,n.jsx)("path",{className:Ve,fillRule:"evenodd",clipRule:"evenodd",d:"M25.7417 6.23664C25.7417 6.09417 25.7076 5.95967 25.6471 5.84086C25.5633 5.67624 25.4288 5.54173 25.2641 5.4579C25.1453 5.39739 25.0108 5.36328 24.8684 5.36328H12.0591C11.5767 5.36328 11.1857 5.7543 11.1857 6.23664C11.1857 6.71899 11.5767 7.11 12.0591 7.11H22.7599L5.61908 24.2508C5.27801 24.5919 5.27801 25.1448 5.61908 25.4859C5.96015 25.827 6.51313 25.827 6.8542 25.4859L23.995 8.34513V19.0459C23.995 19.5283 24.386 19.9193 24.8684 19.9193C25.3507 19.9193 25.7417 19.5283 25.7417 19.0459V6.23664ZM20.995 15.5878V19.0459C20.995 21.1851 22.7292 22.9193 24.8684 22.9193C27.0076 22.9193 28.7417 21.1851 28.7417 19.0459V6.23664C28.7417 4.09744 27.0076 2.36328 24.8684 2.36328H12.0591C9.91985 2.36328 8.18569 4.09744 8.18569 6.23664C8.18569 8.37584 9.91985 10.11 12.0591 10.11H15.5172L3.49777 22.1295C1.98512 23.6421 1.98513 26.0946 3.49776 27.6072C5.0104 29.1199 7.46288 29.1199 8.97552 27.6072L20.995 15.5878Z"})}),(0,n.jsx)("path",{fill:"currentColor",d:"M12.0591 7.11C11.5767 7.11 11.1857 6.71899 11.1857 6.23664C11.1857 5.7543 11.5767 5.36328 12.0591 5.36328H24.8684C25.3507 5.36328 25.7417 5.7543 25.7417 6.23664V19.0459C25.7417 19.5283 25.3507 19.9193 24.8684 19.9193C24.386 19.9193 23.995 19.5283 23.995 19.0459V8.34512L6.8542 25.4859C6.51313 25.827 5.96015 25.827 5.61908 25.4859C5.27801 25.1448 5.27801 24.5919 5.61908 24.2508L22.7599 7.11H12.0591Z"})]}),J0=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 32 32",...e,children:(0,n.jsxs)(Ge,{children:[(0,n.jsx)("path",{className:Ve,d:"M11 21H21V11H11V21ZM29 23C29 26.3137 26.3137 29 23 29H9C5.68629 29 3 26.3137 3 23V9C3 5.68629 5.68629 3 9 3H23C26.3137 3 29 5.68629 29 9V23Z"}),(0,n.jsx)("path",{fill:"currentColor",d:"M24.25 9C24.25 8.30964 23.6904 7.75 23 7.75H9C8.30964 7.75 7.75 8.30964 7.75 9V23C7.75 23.6904 8.30964 24.25 9 24.25H23C23.6904 24.25 24.25 23.6904 24.25 23V9ZM25.75 23C25.75 24.5188 24.5188 25.75 23 25.75H9C7.48122 25.75 6.25 24.5188 6.25 23V9C6.25 7.48122 7.48122 6.25 9 6.25H23C24.5188 6.25 25.75 7.48122 25.75 9V23Z"})]})}),Q0=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 32 33",...e,children:[(0,n.jsx)(Ge,{children:(0,n.jsx)("path",{className:Ve,fillRule:"evenodd",clipRule:"evenodd",d:"M4.89961 14.7968C3.08522 13.5116 1.89961 11.3966 1.89961 9.00039C1.89961 5.07917 5.07839 1.90039 8.99961 1.90039C10.7798 1.90039 12.4069 2.55553 13.6531 3.63785C14.3179 3.17306 15.1269 2.90039 15.9996 2.90039L22.9996 2.90039C25.264 2.90039 27.0996 4.73602 27.0996 7.00039L27.0996 9.7243C27.5717 9.92414 28.014 10.2165 28.3987 10.6013C29.9999 12.2024 29.9999 14.7984 28.3987 16.3995L27.9182 16.8801C29.2628 18.172 30.0996 19.9885 30.0996 22.0004C30.0996 25.9216 26.9208 29.1004 22.9996 29.1004C21.2195 29.1004 19.5923 28.4453 18.3461 27.3629C17.6813 27.8277 16.8723 28.1004 15.9996 28.1004L8.99961 28.1004C6.73524 28.1004 4.89961 26.2648 4.89961 24.0004L4.89961 14.7968Z"})}),(0,n.jsx)("path",{fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",d:"M25.25 22C25.25 20.7574 24.2426 19.75 23 19.75C21.7574 19.75 20.75 20.7574 20.75 22C20.75 23.2426 21.7574 24.25 23 24.25C24.2426 24.25 25.25 23.2426 25.25 22ZM23 18.25C25.0711 18.25 26.75 19.9289 26.75 22C26.75 24.0711 25.0711 25.75 23 25.75C20.9289 25.75 19.25 24.0711 19.25 22C19.25 19.9289 20.9289 18.25 23 18.25ZM11.25 9C11.25 7.75736 10.2426 6.75 9 6.75C7.75736 6.75 6.75 7.75736 6.75 9C6.75 10.2426 7.75736 11.25 9 11.25C10.2426 11.25 11.25 10.2426 11.25 9ZM9.75 12.675C11.4617 12.3275 12.75 10.8142 12.75 9C12.75 6.92893 11.0711 5.25 9 5.25C6.92893 5.25 5.25 6.92893 5.25 9C5.25 10.8142 6.53832 12.3275 8.25 12.675L8.25 24C8.25 24.4142 8.58579 24.75 9 24.75L16 24.75C16.4142 24.75 16.75 24.4142 16.75 24L16.75 7.75L22.25 7.75L22.25 14.1893L21.0303 12.9697C20.7374 12.6768 20.2626 12.6768 19.9697 12.9697C19.6768 13.2626 19.6768 13.7374 19.9697 14.0303L22.4697 16.5303C22.7626 16.8232 23.2374 16.8232 23.5303 16.5303L26.0303 14.0303C26.3232 13.7374 26.3232 13.2626 26.0303 12.9697C25.7374 12.6768 25.2626 12.6768 24.9697 12.9697L23.75 14.1893L23.75 7C23.75 6.58579 23.4142 6.25 23 6.25L16 6.25C15.5858 6.25 15.25 6.58579 15.25 7L15.25 23.25L9.75 23.25L9.75 12.675Z"})]}),eh=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 32 33",...e,children:[(0,n.jsx)(Ge,{children:(0,n.jsx)("path",{className:Ve,d:"M20.7271 2C21.4372 2 21.7114 2.00463 22.0841 2.03504C22.8228 2.0954 23.4839 2.25122 24.1592 2.59527C25.1865 3.1188 26.0219 3.9541 26.5458 4.98208C26.8896 5.65706 27.0454 6.31812 27.1057 7.05672C27.1301 7.35469 27.1379 7.58979 27.14 8.03558L27.1408 9.10155C27.1408 11.2114 25.4304 12.922 23.3205 12.922C21.4083 12.922 19.8243 11.5172 19.5441 9.68336L19.538 9.64H18.39V21.687L20.0392 21.6877C22.149 21.6877 23.8595 23.398 23.8595 25.508C23.8595 27.6178 22.149 29.3283 20.0392 29.3283H9.10159C6.99169 29.3283 5.28127 27.6178 5.28127 25.508C5.28127 23.398 6.99172 21.6877 9.10159 21.6877L10.75 21.687V9.64H9.601L9.59661 9.68334C9.32609 11.4539 7.84018 12.8246 6.01692 12.917L5.82032 12.922C3.71035 12.922 2 11.2114 2 9.10155V8.41371C2 7.70349 2.00463 7.42929 2.03504 7.05674C2.09538 6.31803 2.25122 5.65681 2.59521 4.98173C3.11877 3.95419 3.95418 3.11876 4.98174 2.5952C5.65683 2.25122 6.31798 2.09539 7.057 2.03501C7.42935 2.00463 7.70354 2 8.41371 2H20.7271Z"})}),(0,n.jsx)("path",{fill:"currentColor",d:"M8.41371 5H20.7271C21.1595 5 21.5325 5 21.8398 5.02507C22.1641 5.05157 22.4867 5.11007 22.7971 5.26822C23.2601 5.50416 23.6366 5.88064 23.8726 6.3437C24.0307 6.65409 24.0892 6.97666 24.1157 7.30097C24.1408 7.60823 24.1408 7.98127 24.1408 8.41369V9.10155C24.1408 9.55465 23.7735 9.92195 23.3205 9.92195C22.8674 9.92195 22.5001 9.55465 22.5001 9.10155V8.44533C22.5001 7.97237 22.4995 7.66699 22.4805 7.43457C22.4623 7.21172 22.4314 7.12909 22.4107 7.08853C22.3321 6.93418 22.2066 6.80869 22.0522 6.73004C22.0117 6.70938 21.9291 6.67847 21.7062 6.66026C21.4738 6.64127 21.1684 6.64063 20.6954 6.64063H15.3907V24.6877H20.0392C20.4922 24.6877 20.8595 25.0549 20.8595 25.508C20.8595 25.961 20.4922 26.3283 20.0392 26.3283H9.10159C8.64854 26.3283 8.28127 25.961 8.28127 25.508C8.28127 25.0549 8.64854 24.6877 9.10159 24.6877H13.7501V6.64063H8.44533C7.97238 6.64063 7.66699 6.64127 7.43457 6.66026C7.21172 6.67847 7.1291 6.70938 7.08854 6.73004C6.93418 6.80869 6.80869 6.93418 6.73004 7.08853C6.70938 7.12909 6.67847 7.21172 6.66026 7.43457C6.64127 7.66699 6.64063 7.97237 6.64063 8.44533V9.10155C6.64063 9.55465 6.27337 9.92195 5.82032 9.92195C5.36727 9.92195 5 9.55465 5 9.10155V8.41371C5 7.98128 5 7.60823 5.02508 7.30097C5.05157 6.97666 5.11007 6.65409 5.26823 6.3437C5.50417 5.88064 5.88064 5.50416 6.3437 5.26822C6.65409 5.11007 6.97666 5.05157 7.30097 5.02507C7.60824 5 7.98129 5 8.41371 5Z"})]}),th={x:.5,y:.5},nh=.2,rh={x:.375,y:.25,width:.25,height:.5},ah={zOrder:"background"},oh={x:.4,y:.6},ih={x:.6,y:.4},sh="relative-difference",lh=({title:e,layout:t="collapsible",preview:r})=>{const a=N(),o=l.useHandleScene(a),i=l.useI18n(),{Button:s}=D();if(!o)return null;const c=()=>{a.commands.dispatch(new p.AddAnnotationCommand({kind:"text",annotation:{...p.TEXT_ANNOTATION_DEFAULTS,content:ch(i("editor.annotatePanel.callOutSection.text")),at:{anchorType:"panel",...th},width:nh}}))},d=()=>{a.commands.dispatch(new p.AddAnnotationCommand({kind:"arrow",annotation:{...p.ARROW_DEFAULTS,start:{anchorType:"panel",...oh},end:{anchorType:"panel",...ih}}}))},h=()=>{a.commands.dispatch(new p.AddAnnotationCommand({kind:"shape",annotation:{...p.SHAPE_DEFAULTS,...ah,region:{anchorType:"panel",...rh}}}))},u=()=>{const g=(0,p.inferDefaultDifferenceArrowEndpoints)(o);g!==null&&a.commands.dispatch(new p.AddAnnotationCommand({kind:"differenceArrow",annotation:{...p.DIFFERENCE_ARROW_DEFAULTS,...g,label:sh}}))},m=o.coordSystem.type==="cartesian";return(0,n.jsx)(F,{title:e??i("editor.annotatePanel.callOutSection.title"),layout:t,preview:r,children:(0,n.jsxs)(ea,{children:[(0,n.jsx)(s,{variant:"tile",icon:(0,n.jsx)(eh,{size:"xl"}),label:i("editor.annotatePanel.callOutSection.text"),onClick:c}),(0,n.jsx)(s,{variant:"tile",icon:(0,n.jsx)(Y0,{size:"xl"}),label:i("editor.annotatePanel.callOutSection.arrow"),onClick:d}),(0,n.jsx)(s,{variant:"tile",icon:(0,n.jsx)(J0,{size:"xl"}),label:i("editor.annotatePanel.callOutSection.box"),onClick:h}),m&&(0,n.jsx)(s,{variant:"tile",icon:(0,n.jsx)(Q0,{size:"xl"}),label:i("editor.annotatePanel.callOutSection.difference"),onClick:u})]})})},ch=e=>({type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e}]}]}),dh=({title:e,layout:t="collapsible",preview:r})=>{const a=N(),o=l.useHandleScene(a),i=l.useI18n(),{ToggleGroup:s}=D();if(!o)return null;const c=(0,p.readChartType)(o.spec);if(c===null||!(0,p.isComboChartType)(c))return null;const d=p.COMBO_TYPES.map(u=>({value:u,label:i(`editor.graphPanel.comboSection.types.${u}`)})),h=u=>{const m=p.COMBO_TYPES.find(g=>g===u);m&&a.commands.dispatch(new p.SetChartTypeCommand({coordType:"cartesian",comboType:m}))};return(0,n.jsx)(F,{title:e??i("editor.graphPanel.comboSection.title"),layout:t,preview:r??i(`editor.graphPanel.comboSection.types.${c.comboType}`),children:(0,n.jsx)(s,{value:c.comboType,options:d,onChange:h,ariaLabel:i("editor.graphPanel.comboSection.title")})})},uh=.1,hh=20,ph=({title:e,preview:t})=>{const r=N(),a=l.useHandleScene(r),o=l.useI18n(),{NumberField:i,TextField:s}=D();if(!a||a.coordSystem.type==="polar")return null;const c=(0,p.findGoalLineLayer)(a.spec.layers),d=e??o("editor.annotationsPanel.goalSection.title"),h=(0,p.readConstantValue)(c?.mapping.y),u=typeof h=="number"?h:null,m=f=>{const b=new p.ToggleGoalLineCommand({showGoalLine:f,value:mh(a),...c!==void 0&&{layerId:c.id}});r.commands.dispatch(b)},g=f=>{if(c===void 0)return;const b=new p.SetRuleLabelCommand({layerId:c.id,label:f===""?null:f});r.commands.dispatch(b,{transient:!0})},x=f=>{if(c===void 0||f===null)return;const b=new p.SetRuleValueCommand({layerId:c.id,value:f});r.commands.dispatch(b,{transient:!0})};return(0,n.jsx)(oa,{title:d,preview:t,isChecked:c!==void 0,onToggle:m,children:(0,n.jsxs)(G,{children:[(0,n.jsx)(A,{label:o("editor.annotationsPanel.goalSection.labelControl"),children:(0,n.jsx)(s,{value:c?.params.label??"",placeholder:o("editor.annotationsPanel.goalSection.labelPlaceholder"),onChange:g,onCommit:r.commands.commit,ariaLabel:o("editor.annotationsPanel.goalSection.labelAriaLabel")})}),(0,n.jsx)(A,{label:o("editor.annotationsPanel.goalSection.valueControl"),children:(0,n.jsx)(i,{value:u,placeholder:o("editor.powerUpPanel.valueInput.numberPlaceholder"),onChange:x,onCommit:r.commands.commit,ariaLabel:o("editor.annotationsPanel.goalSection.valueAriaLabel")})})]})})},mh=e=>{const t=(e.scales.y?.domain??[]).filter(s=>typeof s=="number");if(t.length===0)return 0;const r=Math.max(...t),a=r-Math.min(...t),o=a>0?a:Math.abs(r);if(o===0)return 0;const i=Math.min(hh,Math.max(0,1-Math.floor(Math.log10(o))));return Number((r+o*uh).toFixed(i))},gh=({layerId:e,title:t,layout:r="collapsible",preview:a})=>{const o=N(),i=l.useHandleScene(o),s=l.useI18n(),{Switch:c}=D();if(!i)return null;const d=e===void 0?i.spec.layers[0]:(0,p.findLayerById)(i.spec.layers,e);if(!d)return null;const{showDataLabels:h,format:u,showStackTotals:m,showCategoryLabels:g}=d.dataLabels,x=i.coordSystem.type,f=x==="polar",b=d.geom==="bar",w=b&&!f&&d.position==="stack",T=b&&(!f||h),y=(0,p.findLayerById)(i.layers,d.id),k=y!==void 0&&o.canFormatDataLabelsAsPercentages(y,x);if(!o.canPlaceDataLabels(d.geom,x))return null;const j=O=>{const M=new p.ToggleDataLabelsCommand({layerId:d.id,showDataLabels:O});o.commands.dispatch(M)},I=O=>{const M=new p.SetDataLabelsFormatCommand({layerId:d.id,format:O?"percentage":"absolute"});o.commands.dispatch(M)},P=O=>{const M=new p.ToggleStackTotalsCommand({layerId:d.id,showStackTotals:O});o.commands.dispatch(M)},E=O=>{const M=new p.ToggleCategoryLabelsCommand({layerId:d.id,showCategoryLabels:O});o.commands.dispatch(M)};return(0,n.jsx)(F,{title:t??s("editor.graphPanel.graphOptionsSection.title"),layout:r,preview:a,children:(0,n.jsxs)(G,{children:[(0,n.jsx)(A,{label:s("editor.graphPanel.graphOptions.dataLabels"),children:(0,n.jsx)(c,{isChecked:h,onChange:j})}),h&&k&&(0,n.jsx)(A,{label:s("editor.graphPanel.graphOptions.showPercentages"),children:(0,n.jsx)(c,{isChecked:u==="percentage",onChange:I})}),w&&(0,n.jsx)(A,{label:s("editor.graphPanel.graphOptions.stackTotals"),children:(0,n.jsx)(c,{isChecked:m,onChange:P})}),T&&(0,n.jsx)(A,{label:s("editor.graphPanel.graphOptions.categoryLabels"),children:(0,n.jsx)(c,{isChecked:g,onChange:E})})]})})},xh=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.8",d:"M10.394 12.734 5.63 7.652 0 13.822V16h16V8.741z"}),(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.3",d:"M5.744 5.565 0 11.826V8l5.744-6.957 4.718 2.087L16 0v6.957l-5.538 4z"})]}),vh=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 16 16",...e,children:(0,n.jsxs)("g",{transform:"rotate(90 8 8)",children:[(0,n.jsx)("rect",{width:"3.2",height:"7.704",y:"8.296",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"11.259",x:"4.267",y:"4.741",fill:"currentColor",fillOpacity:"0.3",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"4.741",x:"8.533",y:"11.259",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"16",x:"12.8",fill:"currentColor",fillOpacity:"0.3",rx:".533"})]})}),fh=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 16 16",...e,children:(0,n.jsxs)("g",{transform:"rotate(90 8 8)",children:[(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.8",d:"M0 13.037h4.267v2.445a.52.52 0 0 1-.519.518H.518A.52.52 0 0 1 0 15.482zM5.867 7.704h4.266v7.778a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.518-.518zM11.733 10.074H16v5.408a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.519-.518z"}),(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.3",d:"M0 12.445h4.267V.52A.52.52 0 0 0 3.748 0H.518A.52.52 0 0 0 0 .519zM5.867 7.111h4.266V.52A.52.52 0 0 0 9.615 0h-3.23a.52.52 0 0 0-.518.519zM11.733 9.481H16V.52A.52.52 0 0 0 15.482 0h-3.23a.52.52 0 0 0-.519.519z"})]})}),bh=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 16 16",...e,children:(0,n.jsxs)("g",{transform:"rotate(90 8 8)",children:[(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.8",d:"M0 13.037h4.267v2.445a.52.52 0 0 1-.519.518H.518A.52.52 0 0 1 0 15.482zM5.867 7.704h4.266v7.778a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.518-.518zM11.733 10.074H16v5.408a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.519-.518z"}),(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.3",d:"M0 7.037c0-.286.232-.518.519-.518h3.23c.286 0 .518.232.518.518v5.408H0zM5.867 7.111h4.266V4.074a.52.52 0 0 0-.518-.518h-3.23a.52.52 0 0 0-.518.518zM11.733 9.481H16V.52A.52.52 0 0 0 15.482 0h-3.23a.52.52 0 0 0-.519.519z"})]})}),Sh=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("rect",{width:"3.2",height:"7.704",y:"8.296",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"11.259",x:"4.267",y:"4.741",fill:"currentColor",fillOpacity:"0.3",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"4.741",x:"8.533",y:"11.259",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"16",x:"12.8",fill:"currentColor",fillOpacity:"0.3",rx:".533"})]}),yh=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.8",d:"M0 13.037h4.267v2.445a.52.52 0 0 1-.519.518H.518A.52.52 0 0 1 0 15.482zM5.867 7.704h4.266v7.778a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.518-.518zM11.733 10.074H16v5.408a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.519-.518z"}),(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.3",d:"M0 12.445h4.267V.52A.52.52 0 0 0 3.748 0H.518A.52.52 0 0 0 0 .519zM5.867 7.111h4.266V.52A.52.52 0 0 0 9.615 0h-3.23a.52.52 0 0 0-.518.519zM11.733 9.481H16V.52A.52.52 0 0 0 15.482 0h-3.23a.52.52 0 0 0-.519.519z"})]}),Ch=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.8",d:"M0 13.037h4.267v2.445a.52.52 0 0 1-.519.518H.518A.52.52 0 0 1 0 15.482zM5.867 7.704h4.266v7.778a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.518-.518zM11.733 10.074H16v5.408a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.519-.518z"}),(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.3",d:"M0 7.037c0-.286.232-.518.519-.518h3.23c.286 0 .518.232.518.518v5.408H0zM5.867 7.111h4.266V4.074a.52.52 0 0 0-.518-.518h-3.23a.52.52 0 0 0-.518.518zM11.733 9.481H16V.52A.52.52 0 0 0 15.482 0h-3.23a.52.52 0 0 0-.519.519z"})]}),jh=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsxs)("g",{fill:"currentColor",fillOpacity:"0.3",children:[(0,n.jsx)("rect",{width:"3.2",height:"6.5",y:"9.5",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"8.5",x:"4.267",y:"7.5",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"5",x:"8.533",y:"11",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"7.5",x:"12.8",y:"8.5",rx:".533"})]}),(0,n.jsxs)("g",{fill:"currentColor",fillOpacity:"0.8",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:"0.8",strokeWidth:".993",children:[(0,n.jsx)("path",{fill:"none",d:"M1.6 6.2 5.867 3.6l4.266 3.8 4.267-3"}),(0,n.jsx)("circle",{cx:"1.6",cy:"6.2",r:".9",stroke:"none"}),(0,n.jsx)("circle",{cx:"5.867",cy:"3.6",r:".9",stroke:"none"}),(0,n.jsx)("circle",{cx:"10.133",cy:"7.4",r:".9",stroke:"none"}),(0,n.jsx)("circle",{cx:"14.4",cy:"4.4",r:".9",stroke:"none"})]})]}),wh=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 16 16",...e,children:(0,n.jsxs)("g",{fill:"none",stroke:"currentColor",strokeWidth:"5",transform:"rotate(-90 8 8)",children:[(0,n.jsx)("circle",{cx:"8",cy:"8",r:"5.5",pathLength:"100",strokeOpacity:"0.3"}),(0,n.jsx)("circle",{cx:"8",cy:"8",r:"5.5",pathLength:"100",strokeOpacity:"0.6",strokeDasharray:"25 100"}),(0,n.jsx)("circle",{cx:"8",cy:"8",r:"5.5",pathLength:"100",strokeOpacity:"0.8",strokeDasharray:"25 100",strokeDashoffset:"-25"})]})}),Th=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 16 16",...e,children:(0,n.jsxs)("g",{fill:"currentColor",children:[(0,n.jsx)("rect",{width:"4.267",height:"4.267",y:"0.533",fillOpacity:"0.3",rx:".533"}),(0,n.jsx)("rect",{width:"4.267",height:"4.267",x:"5.867",y:"0.533",fillOpacity:"0.55",rx:".533"}),(0,n.jsx)("rect",{width:"4.267",height:"4.267",x:"11.733",y:"0.533",fillOpacity:"0.2",rx:".533"}),(0,n.jsx)("rect",{width:"4.267",height:"4.267",y:"5.867",fillOpacity:"0.55",rx:".533"}),(0,n.jsx)("rect",{width:"4.267",height:"4.267",x:"5.867",y:"5.867",fillOpacity:"0.9",rx:".533"}),(0,n.jsx)("rect",{width:"4.267",height:"4.267",x:"11.733",y:"5.867",fillOpacity:"0.45",rx:".533"}),(0,n.jsx)("rect",{width:"4.267",height:"4.267",y:"11.2",fillOpacity:"0.2",rx:".533"}),(0,n.jsx)("rect",{width:"4.267",height:"4.267",x:"5.867",y:"11.2",fillOpacity:"0.45",rx:".533"}),(0,n.jsx)("rect",{width:"4.267",height:"4.267",x:"11.733",y:"11.2",fillOpacity:"0.75",rx:".533"})]})}),Ah=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 16 16",...e,children:(0,n.jsxs)("g",{fill:"currentColor",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:".993",children:[(0,n.jsxs)("g",{fillOpacity:"0.3",strokeOpacity:"0.3",children:[(0,n.jsx)("path",{fill:"none",d:"M1.4 12.2 6 6.4l4.2 1.2 4.4-4.2"}),(0,n.jsx)("circle",{cx:"1.4",cy:"12.2",r:".9",stroke:"none"}),(0,n.jsx)("circle",{cx:"6",cy:"6.4",r:".9",stroke:"none"}),(0,n.jsx)("circle",{cx:"10.2",cy:"7.6",r:".9",stroke:"none"}),(0,n.jsx)("circle",{cx:"14.6",cy:"3.4",r:".9",stroke:"none"})]}),(0,n.jsxs)("g",{fillOpacity:"0.8",strokeOpacity:"0.8",children:[(0,n.jsx)("path",{fill:"none",d:"M1.4 5.6 6 11.4l4.2-1.2 4.4 1.2"}),(0,n.jsx)("circle",{cx:"1.4",cy:"5.6",r:".9",stroke:"none"}),(0,n.jsx)("circle",{cx:"6",cy:"11.4",r:".9",stroke:"none"}),(0,n.jsx)("circle",{cx:"10.2",cy:"10.2",r:".9",stroke:"none"}),(0,n.jsx)("circle",{cx:"14.6",cy:"11.4",r:".9",stroke:"none"})]})]})}),kh=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("rect",{width:"16",height:"16",fill:"currentColor",fillOpacity:"0.3",rx:"8"}),(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.6",d:"m7.999 16 .412-.01A8 8 0 0 0 8 0z"}),(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.8",d:"M15.999 8a8 8 0 0 1-7.588 7.989l-.412.01V8z"})]}),Ph=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 16 16",...e,children:(0,n.jsxs)("g",{fill:"none",stroke:"currentColor",strokeLinejoin:"round",children:[(0,n.jsx)("polygon",{points:"8,0.5 15.13,5.68 12.41,14.07 3.59,14.07 0.87,5.68",strokeOpacity:"0.3",strokeWidth:".8"}),(0,n.jsx)("polygon",{points:"8,2.5 14.66,5.84 10.06,10.83 4.47,12.85 3.72,6.61",strokeOpacity:"0.8",strokeWidth:"1.2"})]})}),Lh=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("polygon",{points:"8,0.5 15.13,5.68 12.41,14.07 3.59,14.07 0.87,5.68",fill:"none",stroke:"currentColor",strokeLinejoin:"round",strokeOpacity:"0.3",strokeWidth:".8"}),(0,n.jsx)("polygon",{points:"8,2.5 14.66,5.84 10.06,10.83 4.47,12.85 3.72,6.61",fill:"currentColor",fillOpacity:"0.6"})]}),Ih=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 16 16",...e,children:(0,n.jsxs)("g",{fill:"none",stroke:"currentColor",strokeWidth:"1.5",transform:"rotate(-90 8 8)",children:[(0,n.jsxs)("g",{strokeOpacity:"0.2",children:[(0,n.jsx)("circle",{cx:"8",cy:"8",r:"6.6"}),(0,n.jsx)("circle",{cx:"8",cy:"8",r:"4.4"}),(0,n.jsx)("circle",{cx:"8",cy:"8",r:"2.2"})]}),(0,n.jsx)("circle",{cx:"8",cy:"8",r:"6.6",pathLength:"100",strokeDasharray:"72 100",strokeOpacity:"0.8"}),(0,n.jsx)("circle",{cx:"8",cy:"8",r:"4.4",pathLength:"100",strokeDasharray:"52 100",strokeOpacity:"0.6"}),(0,n.jsx)("circle",{cx:"8",cy:"8",r:"2.2",pathLength:"100",strokeDasharray:"34 100",strokeOpacity:"0.45"})]})}),Eh=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 16 16",...e,children:(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.75",d:"M8.4 7.31 8.4 1.01A7 7 0 0 1 13.85 4.16ZM8.8 8 13.64 5.2A6.3 6.3 0 0 1 13.64 10.8ZM8.4 8.69 12.64 11.14A5.6 5.6 0 0 1 8.4 13.59ZM7.6 8.69 7.6 12.78A4.8 4.8 0 0 1 4.06 10.74ZM7.2 8 4.27 9.69A4.1 4.1 0 0 1 4.27 6.31ZM7.6 7.31 5.19 5.92A3.5 3.5 0 0 1 7.6 4.52Z"})}),Mh=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 16 16",...e,children:(0,n.jsxs)("g",{fill:"currentColor",children:[(0,n.jsx)("path",{fillOpacity:"0.35",d:"M8.4 3.82 8.4 1.01A7 7 0 0 1 13.85 4.16L11.42 5.56A4.2 4.2 0 0 0 8.4 3.82ZM11.46 6.47 13.64 5.2A6.3 6.3 0 0 1 13.64 10.8L11.46 9.53A3.78 3.78 0 0 0 11.46 6.47ZM10.69 10.01 12.64 11.14A5.6 5.6 0 0 1 8.4 13.59L8.4 11.34A3.36 3.36 0 0 0 10.69 10.01ZM7.6 10.85 7.6 12.78A4.8 4.8 0 0 1 4.06 10.74L5.73 9.77A2.88 2.88 0 0 0 7.6 10.85ZM5.7 8.87 4.27 9.69A4.1 4.1 0 0 1 4.27 6.31L5.7 7.13A2.46 2.46 0 0 0 5.7 8.87ZM6.41 6.62 5.19 5.92A3.5 3.5 0 0 1 7.6 4.52L7.6 5.94A2.1 2.1 0 0 0 6.41 6.62Z"}),(0,n.jsx)("path",{fillOpacity:"0.9",d:"M8.4 7.31 8.4 3.82A4.2 4.2 0 0 1 11.42 5.56ZM8.8 8 11.46 6.47A3.78 3.78 0 0 1 11.46 9.53ZM8.4 8.69 10.69 10.01A3.36 3.36 0 0 1 8.4 11.34ZM7.6 8.69 7.6 10.85A2.88 2.88 0 0 1 5.73 9.77ZM7.2 8 5.7 8.87A2.46 2.46 0 0 1 5.7 7.13ZM7.6 7.31 6.41 6.62A2.1 2.1 0 0 1 7.6 5.94Z"})]})}),Rh=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 16 16",...e,children:(0,n.jsxs)("g",{fill:"currentColor",fillOpacity:"0.8",children:[(0,n.jsx)("circle",{cx:"1.028",cy:"13.897",r:"1.028"}),(0,n.jsx)("circle",{cx:"2.57",cy:"8.243",r:"1.028"}),(0,n.jsx)("circle",{cx:"5.653",cy:"12.355",r:"1.028"}),(0,n.jsx)("circle",{cx:"8.223",cy:"8.243",r:"1.028"}),(0,n.jsx)("circle",{cx:"9.252",cy:"3.618",r:"1.028"}),(0,n.jsx)("circle",{cx:"12.849",cy:"7.215",r:"1.028"}),(0,n.jsx)("circle",{cx:"14.905",cy:"1.561",r:"1.028"})]})}),Oh=.55,_h=.15,lt=[{name:"column",icon:Sh,summary:{coordType:"cartesian",geom:"bar",position:"dodge"}},{name:"columnStacked",icon:Ch,summary:{coordType:"cartesian",geom:"bar",position:"stack"}},{name:"columnStackedFill",icon:yh,summary:{coordType:"cartesian",geom:"bar",position:"fill"}},{name:"bar",icon:vh,summary:{coordType:"flip",geom:"bar",position:"dodge"}},{name:"barStacked",icon:bh,summary:{coordType:"flip",geom:"bar",position:"stack"}},{name:"barStackedFill",icon:fh,summary:{coordType:"flip",geom:"bar",position:"fill"}},{name:"line",icon:Ah,summary:{coordType:"cartesian",geom:"line",position:"identity"}},{name:"areaStacked",icon:xh,summary:{coordType:"cartesian",geom:"area",position:"stack"}},{name:"combo",icon:jh,summary:{coordType:"cartesian",comboType:"grouped-bars"}},{name:"scatter",icon:Rh,summary:{coordType:"cartesian",geom:"point",position:"identity"}},{name:"pie",icon:kh,summary:{coordType:"polar",geom:"bar",position:"fill",theta:"y",innerRadius:0}},{name:"donut",icon:wh,summary:{coordType:"polar",geom:"bar",position:"fill",theta:"y",innerRadius:Oh}},{name:"radialBar",icon:Ih,summary:{coordType:"polar",geom:"bar",position:"stack",theta:"y",innerRadius:_h}},{name:"rose",icon:Eh,summary:{coordType:"polar",geom:"bar",position:"dodge",theta:"x",innerRadius:0}},{name:"roseStacked",icon:Mh,summary:{coordType:"polar",geom:"bar",position:"stack",theta:"x",innerRadius:0}},{name:"radar",icon:Ph,summary:{coordType:"polar",geom:"line",position:"identity",theta:"x",innerRadius:0}},{name:"radarFilled",icon:Lh,summary:{coordType:"polar",geom:"area",position:"identity",theta:"x",innerRadius:0}},{name:"heatmap",icon:Th,summary:{coordType:"cartesian",geom:"tile",position:"identity"}}],Nh=.05,Dh=e=>e===null?null:lt.find(t=>zh(t.summary,e))??null,Fh=(e,t)=>{const{summary:r}=e;return t===null||(0,p.isComboChartType)(r)?r:r.position==="dodge"&&ha(t)?{...r,position:"identity"}:r.coordType!=="polar"||!Le(r.innerRadius)||t.coordType!=="polar"||!Le(t.innerRadius)?r:{...r,innerRadius:t.innerRadius}},ha=e=>!(0,p.isComboChartType)(e)&&e.geom==="bar"&&e.position==="identity",zh=(e,t)=>{if((0,p.isComboChartType)(e)||(0,p.isComboChartType)(t))return(0,p.isComboChartType)(e)&&(0,p.isComboChartType)(t);const r=e.position===t.position||e.position==="dodge"&&ha(t);return e.coordType!==t.coordType||e.geom!==t.geom||!r?!1:e.coordType!=="polar"||t.coordType!=="polar"?!0:e.theta===t.theta&&Le(e.innerRadius)===Le(t.innerRadius)},Le=e=>e>=Nh,Bh=3,Hh=({title:e,layout:t="collapsible",preview:r})=>{const a=N(),o=l.useHandleScene(a),i=l.useI18n(),{RadioGrid:s}=D(),c=(0,v.useMemo)(()=>lt.map(({name:m,icon:g})=>({value:m,label:i(`editor.graphTypes.${m}`),icon:(0,n.jsx)(g,{size:"md"}),isDisabled:m==="combo"&&!(0,p.canBecomeCombo)(o?.spec)||m==="heatmap"&&!(0,p.canBecomeHeatmap)(o?.spec)})),[i,o]);if(!o)return null;const d=(0,p.readChartType)(o.spec),h=Dh(d),u=m=>{const g=lt.find(x=>x.name===m);g&&a.commands.dispatch(new p.SetChartTypeCommand(Fh(g,d)))};return(0,n.jsx)(F,{title:e??i("editor.graphPanel.graphTypeSection.title"),layout:t,preview:r??(h===null?void 0:i(`editor.graphTypes.${h.name}`)),children:(0,n.jsx)(s,{value:h?.name??"",options:c,columns:Bh,onChange:u,ariaLabel:i("editor.graphPanel.graphTypeSection.title")})})},vn=["solid","dashed","dotted"],Gh=8,Vh=0,$h=({title:e,layout:t="collapsible",preview:r})=>{const a=N(),o=l.useHandleScene(a),i=l.useI18n(),{Slider:s,Switch:c,ToggleGroup:d}=D(),h=Be(o);if(!o||!h)return null;const u=o.guides.axes.filter(Uh);if(u.length===0)return null;const m=o.coordSystem.type!=="polar",g=u.some(y=>y.gridVisible),x=h.gridLine.y().resolve(),f=vn.map(y=>({value:y,label:i(`editor.graphPanel.gridSection.lineStyles.${y}`)})),b=y=>k=>{a.commands.dispatch(new p.SetGridVisibilityCommand({axis:y,isVisible:k}))},w=y=>{const k=vn.find(j=>j===y);k&&a.commands.dispatch(new p.SetGridLineStyleCommand({axis:"both",lineStyle:k}))},T=y=>{a.commands.dispatch(new p.SetGridLineWidthCommand({axis:"both",lineWidth:y}),{transient:!0})};return(0,n.jsx)(F,{title:e??i("editor.graphPanel.gridSection.title"),layout:t,preview:r,children:(0,n.jsxs)(G,{children:[u.map(y=>(0,n.jsx)(A,{label:i(Wh(y)),children:(0,n.jsx)(c,{isChecked:y.gridVisible,onChange:b(y.scaleAestheticKey)})},y.scaleAestheticKey)),m&&g&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(A,{label:i("editor.graphPanel.gridSection.gridStyle"),children:(0,n.jsx)(d,{value:(0,p.toDashPreset)(x.dashArray),options:f,onChange:w})}),(0,n.jsx)(A,{label:i("editor.graphPanel.gridSection.gridThickness"),children:(0,n.jsx)(s,{value:x.strokeWidth,min:Vh,max:Gh,step:.5,formatValue:He,onChange:T,onCommit:a.commands.commit})})]})]})})},Uh=e=>e.scaleAestheticKey==="x"||e.scaleAestheticKey==="y",Wh=e=>e.geometry==="radial"?"editor.graphPanel.gridSection.rings":e.geometry==="circular"?"editor.graphPanel.gridSection.spokes":e.scaleAestheticKey==="x"?"editor.graphPanel.gridSection.verticalGridLines":"editor.graphPanel.gridSection.horizontalGridLines",qh="total",pa=["total","average","current"],Kh=["total"],fn=["previous","first"],bn=["auto","small","medium","large"],Xh=({title:e,layout:t="collapsible",preview:r})=>{const a=N(),o=l.useHandleScene(a),i=l.useI18n(),{Switch:s,ToggleGroup:c}=D();if(!o)return null;const d=o.config.headline,h=d.show!=="none",u=o.coordSystem,m=u.type==="polar",g=u.type==="polar"&&u.innerRadius>0,x=o.layers.some(C=>C.summary.grandTotal!==void 0);if(m&&!x)return null;const f=m?Kh:pa,b=o.guides.headline,w=b?.kind==="perGroup"&&b.items.some(C=>C.comparison!==null),T=f.map(C=>({value:C,label:i(`editor.graphPanel.headlineNumberSection.metrics.${C}`)})),y=fn.map(C=>({value:C,label:i(`editor.graphPanel.headlineNumberSection.comparison.${C}`)})),k=bn.map(C=>({value:C,label:i(C==="auto"?"editor.graphPanel.numberFormat.options.auto":`editor.graphPanel.headlineNumberSize.sizes.${C}`)})),j=[{value:"above",label:i("editor.graphPanel.headlineNumberSection.position.above")},{value:"center",label:i("editor.graphPanel.headlineNumberSection.position.center")}],I=C=>{a.commands.dispatch(new p.SetHeadlineShowCommand({show:C?qh:"none"}))},P=C=>{const S=f.find(z=>z===C);S&&a.commands.dispatch(new p.SetHeadlineShowCommand({show:S}))},E=C=>{const S=fn.find(z=>z===C);S&&a.commands.dispatch(new p.SetHeadlineCompareWithCommand({compareWith:S}))},O=C=>{const S=bn.find(z=>z===C);S&&a.commands.dispatch(new p.SetHeadlineSizeCommand({size:S}))},M=C=>{a.commands.dispatch(new p.SetHeadlinePositionCommand({position:C==="center"?"center":"above"}))};return(0,n.jsx)(F,{title:e??i("editor.graphPanel.headlineNumberSection.title"),layout:t,preview:r??Zh(i,d.show),children:(0,n.jsxs)(G,{children:[(0,n.jsx)(A,{label:i("editor.graphPanel.headlineNumberSection.toggle"),children:(0,n.jsx)(s,{isChecked:h,onChange:I})}),h&&(0,n.jsxs)(n.Fragment,{children:[T.length>1&&(0,n.jsx)(A,{label:i("editor.graphPanel.headlineNumberSection.metricLabel"),layout:"stack",children:(0,n.jsx)(c,{value:d.show,options:T,onChange:P})}),w&&(0,n.jsx)(A,{label:i("editor.graphPanel.headlineNumberSection.compareWithLabel"),layout:"stack",children:(0,n.jsx)(c,{value:(0,p.resolveComparisonBasis)(d.compareWith),options:y,onChange:E})}),(0,n.jsx)(A,{label:i("editor.graphPanel.headlineNumberSize.sizeLabel"),children:(0,n.jsx)(c,{value:d.size,options:k,onChange:O})}),g&&(0,n.jsx)(A,{label:i("editor.axesPanel.controls.position"),children:(0,n.jsx)(c,{value:d.position,options:j,onChange:M})})]})]})})},Zh=(e,t)=>{const r=pa.find(a=>a===t);return r&&e(`editor.graphPanel.headlineNumberSection.metrics.${r}`)},Ke=["top","bottom","left","right","none"],Sn=["auto","start","center","end"],yn=["auto","pill","direct"],Yh=({positions:e,title:t,layout:r="collapsible",preview:a})=>{const o=N(),i=l.useHandleScene(o),s=l.useI18n(),{ToggleGroup:c}=D();if(!i)return null;const d=i.config.legend.position,h=e??Ke,u=i.guides.legends.drawn[0],m=(0,p.canAnchorDirectLabels)({legendPosition:i.guides.legends.position,coordSystem:i.coordSystem,layers:i.layers}),g=i.guides.headline?.kind==="perGroup",x=i.guides.colorGroups.length>0;if(d==="auto"&&u===void 0&&!m&&(g||!x))return null;const f=u?.position??"none",b=d==="auto"?f:d,w=Ke.filter(M=>M===b||h.includes(M)).map(M=>({value:M,label:s(`editor.graphPanel.legendSection.${M}`)})),T=M=>{const C=Ke.find(S=>S===M);C&&o.commands.dispatch(new p.SetLegendPositionCommand({position:C}))},y=M=>{const C=Sn.find(S=>S===M);C&&o.commands.dispatch(new p.SetLegendAlignCommand({align:C}))},k=M=>{const C=yn.find(S=>S===M);C&&o.commands.dispatch(new p.SetLegendDisplayCommand({display:C}))},j=Sn.map(M=>({value:M,label:s(`editor.graphPanel.legendSection.align.${M}`)})),I=yn.map(M=>({value:M,label:s(`editor.graphPanel.legendSection.display.${M}`)})),P=t??s("editor.graphPanel.legendSection.title"),E=w.find(M=>M.value===b)?.label,O=u!==void 0;return(0,n.jsx)(F,{title:P,layout:r,preview:a??E,children:(0,n.jsxs)(G,{children:[(0,n.jsx)(A,{label:s("editor.axesPanel.controls.position"),layout:"stack",children:(0,n.jsx)(c,{value:b,options:w,onChange:T})}),O&&(0,n.jsx)(A,{label:s("editor.graphPanel.legendSection.alignLabel"),layout:"stack",children:(0,n.jsx)(c,{value:i.config.legend.align,options:j,onChange:y})}),m&&(0,n.jsx)(A,{label:s("editor.graphPanel.legendSection.displayLabel"),layout:"stack",children:(0,n.jsx)(c,{value:i.config.legend.display,options:I,onChange:k})})]})})},Jh=1,Qh=20,e1=.5,ma=({layerId:e})=>{const t=N(),r=l.useHandleScene(t),{Slider:a}=D(),o=At(r,e,"point");if(!r)return null;const i=s=>{const c=new p.SetPointSizeCommand({layerId:e,size:s});t.commands.dispatch(c,{transient:!0})};return(0,n.jsx)(a,{value:o?.get("size")??p.DEFAULT_POINT_SIZE_PX,min:Jh,max:Qh,step:e1,formatValue:He,onChange:i,onCommit:t.commands.commit})},t1=1,n1=10,r1=.1,a1=["gap","zero","connect"],o1=({title:e,layout:t="collapsible",preview:r})=>{const a=N(),o=l.useHandleScene(a),i=l.useI18n(),{Select:s,Slider:c,Switch:d,ToggleGroup:h}=D(),u=o?.spec.layers??[],m=(0,p.findLayerByGeom)(u,"line","area"),g=At(o,m?.id??null,"line");if(!o||!m)return null;const x=o.coordSystem.type==="polar",f=l1(i,m),b=s1(m,u),w=Cn(o.spec,m.geom,"strokeWidth",m.id),T=typeof w=="number",y=m.geom==="line"?m:void 0,k=[{value:"auto",label:i("editor.graphPanel.numberFormat.options.auto")},{value:"custom",label:i("editor.graphPanel.numberFormat.options.custom")}],j=C=>{a.commands.dispatch(new p.ToggleLinePointsCommand({layerId:m.id,showPoints:C}))},I=C=>{y&&a.commands.dispatch(new p.ToggleLineFillCommand({layerId:y.id,showFill:C}))},P=C=>{a.commands.dispatch(new p.SetLineCurveCommand({layerId:m.id,curve:C?"smooth":"linear"}))},E=C=>{const S=g?.get("strokeWidth")??p.DEFAULT_STROKE_WIDTH_PX;a.commands.dispatch(new p.SetLineWidthCommand({layerId:m.id,lineWidth:C==="custom"?S:null}))},O=C=>{a.commands.dispatch(new p.SetLineWidthCommand({layerId:m.id,lineWidth:C}),{transient:!0})},M=C=>{const S=i1(C);S&&a.commands.dispatch(new p.SetLineMissingValuesCommand({layerId:m.id,missingValues:S}))};return(0,n.jsx)(F,{title:e??i("editor.fineTunePanel.lineStyleSection.title"),layout:t,preview:r,children:(0,n.jsxs)(G,{children:[(0,n.jsx)(A,{label:i("editor.graphPanel.graphOptions.showPoints"),children:(0,n.jsx)(d,{isChecked:b!==void 0,onChange:j})}),b&&(0,n.jsx)(A,{label:i("editor.graphPanel.pointSize.label"),children:(0,n.jsx)(ma,{layerId:b.id})}),y&&!x&&(0,n.jsx)(A,{label:i("editor.graphPanel.graphOptions.lineFill"),children:(0,n.jsx)(d,{isChecked:Cn(o.spec,"line","fillAlpha",y.id)!==void 0,onChange:I})}),!x&&(0,n.jsx)(A,{label:i("editor.graphPanel.graphOptions.smoothLines"),children:(0,n.jsx)(d,{isChecked:m.params.curve==="smooth",onChange:P})}),(0,n.jsx)(A,{label:i("editor.graphPanel.lineThickness.label"),children:(0,n.jsx)(h,{value:T?"custom":"auto",options:k,onChange:E})}),T&&(0,n.jsx)(A,{label:i("editor.graphPanel.numberFormat.valueLabel"),children:(0,n.jsx)(c,{value:w,min:t1,max:n1,step:r1,formatValue:He,onChange:O,onCommit:a.commands.commit})}),!x&&f.length>1&&(0,n.jsx)(A,{label:i("editor.fineTunePanel.detailSection.missingValues"),children:(0,n.jsx)(s,{value:m.params.missingValues,options:f,onChange:M})})]})})},i1=e=>a1.find(t=>t===e),Cn=(e,t,r,a)=>(0,p.findKindStyleDeclarations)(e.styles.overrides,(0,p.buildLayerStyleAddress)(t,a))?.[r],s1=(e,t)=>(0,p.filterLayersByGeoms)(t,"point").find(r=>(0,p.isCompanionLayer)(r,[e])),l1=(e,t)=>{const r=[{value:"gap",label:e("editor.graphPanel.treatEmptyValues.leaveGap.label")},{value:"zero",label:e("editor.graphPanel.treatEmptyValues.fillZero.label")}];return t.position!=="stack"&&t.position!=="fill"&&r.push({value:"connect",label:e("editor.graphPanel.treatEmptyValues.connectGaps.label")}),t.geom==="area"?r.filter(a=>a.value!=="gap"):r},ct="\0none",c1=["x","y","color","size","label"],d1={x:"editor.graphPanel.mappingSection.x",y:"editor.graphPanel.mappingSection.y",color:"editor.graphPanel.mappingSection.color",size:"editor.graphPanel.mappingSection.size",label:"editor.graphPanel.mappingSection.label"},u1=({title:e,layout:t="collapsible"})=>{const r=N(),a=l.useHandleScene(r),o=l.useI18n(),{Select:i}=D(),s=o("editor.graphPanel.mappingSection.none"),c=a?.spec,d=(0,v.useMemo)(()=>c===void 0?[]:(0,p.readMappableAesthetics)(c,c1).map(({aesthetic:h,variables:u,isRequired:m})=>{const g=(0,p.readMappedVariable)(c.mapping,h);return{aesthetic:h,label:o(d1[h]),value:g??(m?null:ct),options:h1(u,g,m?null:s),chooseColumn:x=>{r.commands.dispatch(new p.SetMappingCommand({aesthetic:h,variable:x===ct?null:x}))}}}),[c,o,s,r]);return a?(0,n.jsx)(F,{title:e??o("editor.graphPanel.mappingSection.title"),layout:t,children:(0,n.jsx)(G,{children:d.map(({aesthetic:h,label:u,value:m,options:g,chooseColumn:x})=>(0,n.jsx)(A,{label:u,children:(0,n.jsx)(i,{value:m,options:g,placeholder:s,onChange:x})},h))})}):null},h1=(e,t,r)=>{const a=t!==null&&!e.includes(t)?[t,...e]:e;return[...r===null?[]:[{value:ct,label:r}],...a.map(o=>({value:o,label:o}))]},p1="k",m1=2,g1=0,x1=5,dt=[{value:"k",labelKey:"thousands"},{value:"m",labelKey:"millions"},{value:"b",labelKey:"billions"}],v1=["auto","none"],f1=({title:e,layout:t="collapsible",preview:r})=>{const a=N(),o=l.useHandleScene(a),i=l.useI18n(),{NumberField:s,ToggleGroup:c}=D();if(!o)return null;const{abbreviation:d,decimals:h}=o.config.numberFormat,u=b1(d)!==void 0,m=h!=="auto",g=k=>k.map(j=>({value:j,label:i(`editor.graphPanel.numberFormat.options.${j}`)})),x=dt.map(({value:k,labelKey:j})=>({value:k,label:i(`common.abbreviations.${j}`)})),f=k=>{a.commands.dispatch(new p.SetNumberFormatAbbreviationCommand({abbreviation:k}))},b=k=>{const j=v1.find(I=>I===k);f(j??p1)},w=k=>{const j=dt.find(I=>I.value===k);j&&f(j.value)},T=k=>{a.commands.dispatch(new p.SetNumberFormatDecimalsCommand({decimals:k==="custom"?m1:"auto"}))},y=k=>{k!==null&&a.commands.dispatch(new p.SetNumberFormatDecimalsCommand({decimals:k}),{transient:!0})};return(0,n.jsx)(F,{title:e??i("editor.graphPanel.numberFormatSection.title"),layout:t,preview:r,children:(0,n.jsxs)(G,{children:[(0,n.jsx)(A,{label:i("editor.graphPanel.numberFormat.abbreviationLabel"),children:(0,n.jsx)(c,{value:u?"custom":d,options:g(["auto","none","custom"]),onChange:b})}),u&&(0,n.jsx)(A,{label:i("editor.graphPanel.numberFormat.valueLabel"),children:(0,n.jsx)(c,{value:d,options:x,onChange:w})}),(0,n.jsx)(A,{label:i("editor.graphPanel.numberFormat.decimalPlacesLabel"),children:(0,n.jsx)(c,{value:m?"custom":"auto",options:g(["auto","custom"]),onChange:T})}),m&&(0,n.jsx)(A,{label:i("editor.graphPanel.numberFormat.valueLabel"),children:(0,n.jsx)(s,{value:h,min:g1,max:x1,onChange:y,onCommit:a.commands.commit})})]})})},b1=e=>dt.find(t=>t.value===e),S1=({title:e,layout:t="collapsible",preview:r})=>{const a=l.useHandleScene(N()),o=l.useI18n();if(!a)return null;const i=y1(a.spec.layers);return i?(0,n.jsx)(F,{title:e??o("editor.graphPanel.pointSize.label"),layout:t,preview:r,children:(0,n.jsx)(G,{children:(0,n.jsx)(A,{label:o("editor.graphPanel.numberFormat.valueLabel"),children:(0,n.jsx)(ma,{layerId:i.id})})})}):null},y1=e=>{const t=(0,p.filterLayersByGeoms)(e,"line","area");return(0,p.filterLayersByGeoms)(e,"point").find(r=>!(0,p.isCompanionLayer)(r,t))},C1=.9,j1=360,w1=.05,T1=15,A1=({title:e,layout:t="collapsible",preview:r})=>{const a=N(),o=l.useHandleScene(a),i=l.useI18n(),{Slider:s}=D();if(!o||o.spec.coords.coordType!=="polar")return null;const{innerRadius:c,startAngle:d}=o.spec.coords.params,h=m=>{a.commands.dispatch(new p.SetPolarInnerRadiusCommand({innerRadius:m}),{transient:!0})},u=m=>{a.commands.dispatch(new p.SetPolarStartAngleCommand({startAngle:m}),{transient:!0})};return(0,n.jsx)(F,{title:e??i("editor.graphPanel.polarSection.title"),layout:t,preview:r,children:(0,n.jsxs)(G,{children:[(0,n.jsx)(A,{label:i("editor.graphPanel.polarSection.innerRadius"),children:(0,n.jsx)(s,{value:c,min:0,max:C1,step:w1,formatValue:ua,onChange:h,onCommit:a.commands.commit})}),(0,n.jsx)(A,{label:i("editor.graphPanel.polarSection.startAngle"),children:(0,n.jsx)(s,{value:d,min:0,max:j1-1,step:T1,formatValue:U0,onChange:u,onCommit:a.commands.commit})})]})})},k1=e=>(0,n.jsxs)(l.Icon,{...e,children:[(0,n.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",opacity:"0.12",d:"M2 10C2 7.19974 2 5.79961 2.54497 4.73005C3.02433 3.78924 3.78924 3.02433 4.73005 2.54497C5.79961 2 7.19974 2 10 2H14C16.8003 2 18.2004 2 19.27 2.54497C20.2108 3.02433 20.9757 3.78924 21.455 4.73005C22 5.79961 22 7.19974 22 10V14C22 16.8003 22 18.2004 21.455 19.27C20.9757 20.2108 20.2108 20.9757 19.27 21.455C18.2004 22 16.8003 22 14 22H10C7.19974 22 5.79961 22 4.73005 21.455C3.78924 20.9757 3.02433 20.2108 2.54497 19.27C2 18.2004 2 16.8003 2 14V10Z",fill:"currentColor"}),(0,n.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.96644 1.25C8.59472 1.25 7.51929 1.24999 6.65494 1.32061C5.77479 1.39252 5.04768 1.54138 4.38955 1.87671C3.30762 2.42798 2.42798 3.30762 1.87671 4.38955C1.54138 5.04768 1.39252 5.77479 1.32061 6.65494C1.24999 7.51929 1.25 8.59472 1.25 9.96644V14.0336C1.25 15.4053 1.24999 16.4807 1.32061 17.3451C1.39252 18.2252 1.54138 18.9523 1.87671 19.6104C2.42798 20.6924 3.30762 21.572 4.38955 22.1233C5.04768 22.4586 5.77479 22.6075 6.65494 22.6794C7.51927 22.75 8.59469 22.75 9.96637 22.75H14.0336C15.4053 22.75 16.4807 22.75 17.3451 22.6794C18.2252 22.6075 18.9523 22.4586 19.6104 22.1233C20.6924 21.572 21.572 20.6924 22.1233 19.6104C22.4586 18.9523 22.6075 18.2252 22.6794 17.3451C22.75 16.4807 22.75 15.4053 22.75 14.0336V9.96642C22.75 8.59473 22.75 7.51927 22.6794 6.65494C22.6075 5.77479 22.4586 5.04768 22.1233 4.38955C21.572 3.30762 20.6924 2.42798 19.6104 1.87671C18.9523 1.54138 18.2252 1.39252 17.3451 1.32061C16.4807 1.24999 15.4053 1.25 14.0336 1.25H9.96644ZM5.07054 3.21322C5.48197 3.00359 5.9897 2.87996 6.77708 2.81563C7.57322 2.75058 8.58749 2.75 10 2.75H14C15.4125 2.75 16.4268 2.75058 17.2229 2.81563C18.0103 2.87996 18.518 3.00359 18.9295 3.21322C19.7291 3.62068 20.3793 4.27085 20.7868 5.07054C20.9964 5.48197 21.12 5.9897 21.1844 6.77708C21.2494 7.57322 21.25 8.58749 21.25 10V14C21.25 15.4125 21.2494 16.4268 21.1844 17.2229C21.12 18.0103 20.9964 18.518 20.7868 18.9295C20.3793 19.7291 19.7291 20.3793 18.9295 20.7868C18.518 20.9964 18.0103 21.12 17.2229 21.1844C16.4268 21.2494 15.4125 21.25 14 21.25H10C8.58749 21.25 7.57322 21.2494 6.77708 21.1844C5.9897 21.12 5.48197 20.9964 5.07054 20.7868C4.27085 20.3793 3.62068 19.7291 3.21322 18.9295C3.00359 18.518 2.87996 18.0103 2.81563 17.2229C2.75058 16.4268 2.75 15.4125 2.75 14V10C2.75 8.58749 2.75058 7.57322 2.81563 6.77708C2.87996 5.9897 3.00359 5.48197 3.21322 5.07054C3.62068 4.27085 4.27085 3.62068 5.07054 3.21322Z",fill:"currentColor"}),(0,n.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19.4796 12.2222L17.6085 12.2291L17.6029 10.7291L19.474 10.7222L19.4796 12.2222ZM15.3662 12.2375L13.124 12.2459L13.1184 10.7459L15.3606 10.7375L15.3662 12.2375ZM10.8817 12.2542L8.63945 12.2626L8.63386 10.7626L10.8761 10.7542L10.8817 12.2542ZM6.39719 12.2709L4.52607 12.2779L4.52048 10.7779L6.3916 10.7709L6.39719 12.2709Z",fill:"currentColor"})]}),jn=e=>(0,n.jsxs)(l.Icon,{...e,children:[(0,n.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",opacity:"0.12",d:"M2 10C2 7.19974 2 5.79961 2.54497 4.73005C3.02433 3.78924 3.78924 3.02433 4.73005 2.54497C5.79961 2 7.19974 2 10 2H14C16.8003 2 18.2004 2 19.27 2.54497C20.2108 3.02433 20.9757 3.78924 21.455 4.73005C22 5.79961 22 7.19974 22 10V14C22 16.8003 22 18.2004 21.455 19.27C20.9757 20.2108 20.2108 20.9757 19.27 21.455C18.2004 22 16.8003 22 14 22H10C7.19974 22 5.79961 22 4.73005 21.455C3.78924 20.9757 3.02433 20.2108 2.54497 19.27C2 18.2004 2 16.8003 2 14V10Z",fill:"currentColor"}),(0,n.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.96644 1.25C8.59472 1.25 7.51929 1.24999 6.65494 1.32061C5.77479 1.39252 5.04768 1.54138 4.38955 1.87671C3.30762 2.42798 2.42798 3.30762 1.87671 4.38955C1.54138 5.04768 1.39252 5.77479 1.32061 6.65494C1.24999 7.51929 1.25 8.59472 1.25 9.96644V14.0336C1.25 15.4053 1.24999 16.4807 1.32061 17.3451C1.39252 18.2252 1.54138 18.9523 1.87671 19.6104C2.42798 20.6924 3.30762 21.572 4.38955 22.1233C5.04768 22.4586 5.77479 22.6075 6.65494 22.6794C7.51927 22.75 8.59469 22.75 9.96637 22.75H14.0336C15.4053 22.75 16.4807 22.75 17.3451 22.6794C18.2252 22.6075 18.9523 22.4586 19.6104 22.1233C20.6924 21.572 21.572 20.6924 22.1233 19.6104C22.4586 18.9523 22.6075 18.2252 22.6794 17.3451C22.75 16.4807 22.75 15.4053 22.75 14.0336V9.96642C22.75 8.59473 22.75 7.51927 22.6794 6.65494C22.6075 5.77479 22.4586 5.04768 22.1233 4.38955C21.572 3.30762 20.6924 2.42798 19.6104 1.87671C18.9523 1.54138 18.2252 1.39252 17.3451 1.32061C16.4807 1.24999 15.4053 1.25 14.0336 1.25H9.96644ZM5.07054 3.21322C5.48197 3.00359 5.9897 2.87996 6.77708 2.81563C7.57322 2.75058 8.58749 2.75 10 2.75H14C15.4125 2.75 16.4268 2.75058 17.2229 2.81563C18.0103 2.87996 18.518 3.00359 18.9295 3.21322C19.7291 3.62068 20.3793 4.27085 20.7868 5.07054C20.9964 5.48197 21.12 5.9897 21.1844 6.77708C21.2494 7.57322 21.25 8.58749 21.25 10V14C21.25 15.4125 21.2494 16.4268 21.1844 17.2229C21.12 18.0103 20.9964 18.518 20.7868 18.9295C20.3793 19.7291 19.7291 20.3793 18.9295 20.7868C18.518 20.9964 18.0103 21.12 17.2229 21.1844C16.4268 21.2494 15.4125 21.25 14 21.25H10C8.58749 21.25 7.57322 21.2494 6.77708 21.1844C5.9897 21.12 5.48197 20.9964 5.07054 20.7868C4.27085 20.3793 3.62068 19.7291 3.21322 18.9295C3.00359 18.518 2.87996 18.0103 2.81563 17.2229C2.75058 16.4268 2.75 15.4125 2.75 14V10C2.75 8.58749 2.75058 7.57322 2.81563 6.77708C2.87996 5.9897 3.00359 5.48197 3.21322 5.07054C3.62068 4.27085 4.27085 3.62068 5.07054 3.21322Z",fill:"currentColor"}),(0,n.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.6749 8.04877L17.1069 9.06975L16.2884 7.81273L17.8564 6.79175L18.6749 8.04877ZM15.2278 10.2932L13.3488 11.5167L12.5303 10.2597L14.4093 9.03622L15.2278 10.2932ZM11.4697 12.7402L9.59064 13.9637L8.77217 12.7067L10.6512 11.4832L11.4697 12.7402ZM7.71158 15.1872L6.14354 16.2082L5.32507 14.9511L6.89311 13.9302L7.71158 15.1872Z",fill:"currentColor"})]}),P1=e=>(0,v.useMemo)(()=>{if(e===null)return{options:[],findValue:()=>{}};const{parsingLocale:t,numberFormat:r}=e.config,a=e.guides.colorGroups.map(o=>{const i=(0,p.createValueFormatter)({valueFormat:o.valueFormat,locale:t,numberFormat:r}),s=o.value instanceof Date?o.value.getTime():o.value;return{value:s,option:{value:String(s),label:o.label??i(o.value)}}});return{options:a.map(({option:o})=>o),findValue:o=>a.find(i=>i.option.value===o)?.value}},[e]),wn=["linear","exponential","quadratic","polynomial","logarithmic","power","loess"],L1="linear",I1=({title:e,layout:t="collapsible",preview:r})=>{const a=N(),o=l.useHandleScene(a),i=l.useI18n(),{Select:s,Switch:c}=D(),{options:d,findValue:h}=P1(o);if(!o||o.coordSystem.type==="polar")return null;const u=(0,p.findTrendLineLayer)(o.spec.layers),m=(0,p.findAverageLineLayer)(o.spec.layers),g=u?.stat.type==="smooth"?u.stat.method:L1,x=E1(m),f=wn.map(j=>({value:j,label:i(`editor.annotationsPanel.trendType.options.${j}`)})),b=(j,I={})=>{const P=u??m,E=new p.SetStatLineCommand({line:j,...I,...P!==void 0&&{layerId:P.id},label:i("editor.annotationsPanel.trendsAndAveragesSection.average")});a.commands.dispatch(E)},w=j=>b(j?"trend":"none",{method:g}),T=j=>b(j?"average":"none",{group:x??h(d[0]?.value??"")}),y=j=>{const I=wn.find(P=>P===j);I!==void 0&&b("trend",{method:I})},k=j=>{const I=j===null?void 0:h(j);I!==void 0&&b("average",{group:I})};return(0,n.jsx)(F,{title:e??i("editor.annotationsPanel.trendsAndAveragesSection.title"),layout:t,preview:r??(0,n.jsx)(jn,{size:"lg"}),children:(0,n.jsxs)(G,{children:[(0,n.jsx)(A,{label:i("editor.annotationsPanel.trendsAndAveragesSection.trend"),icon:(0,n.jsx)(jn,{size:"lg"}),children:(0,n.jsx)(c,{isChecked:u!==void 0,onChange:w})}),u!==void 0&&(0,n.jsx)(A,{label:i("editor.annotationsPanel.trendType.label"),children:(0,n.jsx)(s,{value:g,options:f,onChange:y,placeholder:i("editor.annotationsPanel.trendType.placeholder")})}),(0,n.jsx)(A,{label:i("editor.annotationsPanel.trendsAndAveragesSection.average"),icon:(0,n.jsx)(k1,{size:"lg"}),children:(0,n.jsx)(c,{isChecked:m!==void 0,onChange:T})}),m!==void 0&&d.length>0&&(0,n.jsx)(A,{label:i("editor.annotationsPanel.averageLineSeries.label"),children:(0,n.jsx)(s,{value:x===void 0?null:String(x),options:d,onChange:k,placeholder:i("editor.annotationsPanel.averageLineSeries.placeholder"),ariaLabel:i("editor.annotationsPanel.averageLineSeries.ariaLabel")})})]})})},E1=e=>{const t=e?.transforms.find(r=>r.transformType==="filter")?.options.value;return t instanceof Date?t.getTime():t};exports.AppearanceSection=K0;exports.AxesPanel=$0;exports.AxisSection=it;exports.BarSection=Z0;exports.Button=Gr;exports.CalloutsSection=lh;exports.CaptionSection=ia;exports.ComboSection=dh;exports.ControlRegistryProvider=Qr;exports.EditableGraphRenderer=Hu;exports.EditorPanel=Ct;exports.ElementsPanel=V0;exports.GoalSection=ph;exports.GraphOptionsSection=gh;exports.GraphTypeSection=Hh;exports.GridSection=$h;exports.HeadlineSection=Xh;exports.IntlProvider=In;exports.LegendSection=Yh;exports.LineSection=o1;exports.MappingSection=u1;exports.NumberField=Ur;exports.NumberFormatSection=f1;exports.PANEL_ROOT_ATTRIBUTE=ra;exports.PointSection=S1;exports.PolarSection=A1;exports.RadioGrid=Wr;exports.Row=A;exports.Section=F;exports.Select=qr;exports.Slider=Kr;exports.SourceSection=sa;exports.SubtitleSection=la;exports.Switch=Xr;exports.TextField=Zr;exports.TextSizeSection=ca;exports.TitleSection=da;exports.ToggleGroup=Yr;exports.ToggledSection=oa;exports.TrendsAndAveragesSection=I1;exports.useControls=D;exports.usePanelExpansion=na;exports.usePanelGraph=N;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./editable.css');const l=require("./history-chords-D8wpot3Q.cjs"),$=require("./theme.contract.css-DKDKSByt.cjs");let p=require("@graphysdk/viz-engine"),v=require("react"),n=require("react/jsx-runtime"),Oa=require("motion/react"),Y=require("zustand/react/shallow"),Me=require("@vanilla-extract/dynamic"),Pn=require("react-dom"),U=require("clsx");U=l.__toESM(U,1);let le=require("@floating-ui/react-dom"),Ln=require("@tiptap/core"),_a=require("@tiptap/extension-bold"),we=require("@tiptap/extension-document"),Na=require("@tiptap/extension-hard-break"),Da=require("@tiptap/extension-heading"),Fa=require("@tiptap/extension-italic"),za=require("@tiptap/extension-link"),Ba=require("@tiptap/extension-text"),Ha=require("@tiptap/extension-text-align"),Te=require("@tiptap/extension-text-style"),Ga=require("@tiptap/extension-underline"),Re=require("@tiptap/extensions"),In=require("@tiptap/extension-paragraph"),Oe=require("@tiptap/react"),Q=require("@base-ui/react/toolbar"),ie=require("@base-ui/react/tooltip"),H=require("@base-ui/react/popover"),It=require("react-colorful"),Z=require("@base-ui/react/slider"),_=require("@base-ui/react/menu"),Va=require("@base-ui/react/toggle"),te=require("lodash-es/clamp");te=l.__toESM(te,1);let ee=require("@base-ui/react"),de=require("@base-ui/react/accordion"),Et=require("@base-ui/react/number-field"),En=require("@base-ui/react/radio"),Mn=require("@base-ui/react/radio-group"),K=require("@base-ui/react/select"),Mt=require("@base-ui/react/switch"),$a=require("@base-ui/react/input");var Ua={save:"حفظ",cancel:"إلغاء",confirm:"تأكيد",delete:"حذف",confirmDelete:e=>`هل أنت متأكد من رغبتك في حذف ${e.item}؟`,abbreviations:{thousands:"ألف",millions:"مليون",billions:"مليار"}},Wa={title:"محرر Graphy",description:"قم بتحرير المحتوى الخاص بك هنا",graphTypes:{column:"أعمدة",columnStacked:"أعمدة مكدسة",columnStackedFill:"أعمدة مكدسة 100%",bar:"شريطي",barStacked:"أشرطة مكدسة",barStackedFill:"أشرطة مكدسة 100%",line:"خطي",areaStacked:"مساحة مكدسة",pie:"دائري",donut:"حلقي",radar:"راداري",radarFilled:"راداري معبأ",scatter:"نقطي",bubble:"فقاعي",funnel:"قمعي",combo:"مركب",heatmap:"خريطة حرارية",waterfall:"شلالي",mekko:"ميكو",table:"جدول"},sizePanel:{toolbarButton:"الحجم",presetsSection:{title:"إعدادات مسبقة"},customSizeSection:{title:"حجم مخصص"},presets:{googleSlides:"Google Slides / PowerPoint",webEmail:"ويب / بريد إلكتروني",linkedIn:"منشور LinkedIn",instagram:"منشور Instagram",tiktok:"TikTok / قصة Instagram",twitter:"X (Twitter)",mobile:"جوال"},inputs:{unitLabel:"بكسل"},validation:{maxSizeError:e=>`≤ ${e.max} بكسل`,minSizeError:e=>`≥ ${e.min} بكسل`}},graphPanel:{toolbarButton:"الرسم البياني",graphTypeSection:{title:"نوع الرسم البياني"},mappingSection:{title:"البيانات",x:"المحور السيني",y:"القيمة",color:"اللون",size:"الحجم",label:"التسمية",none:"بلا"},comboSection:{title:"مظهر الرسم البياني المركب",types:{"grouped-bars":"أعمدة مجمعة","stacked-bars":"أعمدة مكدسة",lines:"خطوط فقط"}},polarSection:{title:"قطبي",innerRadius:"نصف القطر الداخلي",startAngle:"زاوية البداية"},barSection:{title:"الأعمدة",thickness:"سمك العمود",rounding:"التدوير",roundingOptions:{none:"بلا",xs:"XS",sm:"S",md:"M",lg:"L",xl:"XL",full:"كامل"}},graphOptionsSection:{title:"خيارات الرسم البياني"},gridSection:{title:"الشبكة",horizontalGridLines:"خطوط أفقية",verticalGridLines:"خطوط رأسية",rings:"حلقات",spokes:"أشعة",gridStyle:"نمط الشبكة",gridThickness:"سمك الشبكة",lineStyles:{solid:"متصل",dashed:"متقطع",dotted:"منقط"}},graphOptions:{sortBars:"ترتيب من الأعلى ← الأدنى",showPoints:"إظهار النقاط",lineFill:"تعبئة تحت الخط",smoothLines:"خطوط ناعمة",stackTotals:"مجاميع المكدس",dataLabels:"تسميات البيانات",showPercentages:"إظهار النسب المئوية",categoryLabels:"تسميات الفئات"},legendSection:{title:"وسيلة الإيضاح",auto:"تلقائي",top:"أعلى",bottom:"أسفل",left:"يسار",right:"يمين",none:"بدون",alignLabel:"المحاذاة",align:{auto:"تلقائي",start:"البداية",center:"الوسط",end:"النهاية"},displayLabel:"النمط",display:{auto:"تلقائي",pill:"شارات",direct:"على الرسم"}},numberFormatSection:{title:"تنسيق الأرقام"},numberFormat:{abbreviationLabel:"الاختصار",valueLabel:"القيمة",decimalPlacesLabel:"المنازل العشرية",options:{auto:"تلقائي",custom:"مخصص",none:"بدون"}},headlineNumberSize:{sizeLabel:"الحجم",valueLabel:"القيمة",sizes:{small:"ص",medium:"م",large:"ك"}},lineThickness:{label:"سمك الخط"},pointSize:{label:"حجم النقطة",options:{auto:"تلقائي",custom:"مخصص"}},headlineNumberSection:{title:"الرقم الرئيسي",toggle:"مرئي",metricLabel:"المقياس",compareWithLabel:"مقارنة مع",metrics:{total:"المجموع",average:"المتوسط",current:"الأخير",conversion:"التحويل",left:"يسار"},comparison:{first:"الأول",previous:"السابق"},position:{above:"أعلى",center:"وسط"}},treatEmptyValues:{leaveGap:{label:"ترك فجوة في الرسم البياني",description:"يترك فاصلاً مرئياً في الخط حيث تكون البيانات مفقودة"},fillZero:{label:"ملء بالصفر",description:"يعرض نقاط البيانات المفقودة كصفر"},connectGaps:{label:"الاتصال عبر الفجوات",description:"يربط الخط بين النقاط المتاحة، متخطياً الفجوة"}},comboChartAppearance:{title:"مظهر الرسم البياني المركب",groupedBars:"أشرطة مجمعة",stackedBars:"أشرطة مكدسة",linesOnly:"خطوط فقط"}},axesPanel:{toolbarButton:"المحاور",mainAxisSection:{yAxis:"المحور الصادي",xAxis:"المحور السيني"},crossAxisSection:{xAxis:"المحور السيني",yAxis:"المحور الصادي"},controls:{title:"العنوان",visible:"مرئي",ticks:"العلامات",labels:"التسميات",position:"الموضع",scale:"المقياس",startFrom:"البدء من",endAt:"الانتهاء عند",value:"القيمة",numberOfAxes:"عدد المحاور",reverse:"عكس"},labelMode:{auto:"تلقائي",edges:"الحواف"},scale:{auto:"تلقائي",log:"لوغاريتمي"},startFrom:{auto:"تلقائي",zero:"صفر",custom:"مخصص"},endAt:{auto:"تلقائي",custom:"مخصص"},axisCount:{single:"مفرد",double:"مزدوج"},position:{left:"يسار",right:"يمين",top:"أعلى",bottom:"أسفل"},yesNo:{yes:"نعم",no:"لا"}},colorPanel:{toolbarButton:"اللون",themeSection:{title:"السمة"},appearanceSection:{title:"المظهر",highlightStyle:"التمييز"},paletteSection:{title:"لوحة الألوان",colorScheme:"نظام الألوان",colors:"الألوان",colorPalettes:"لوحات الألوان"},paletteMode:{preset:"مسبق",brand:"العلامة التجارية",freestyle:"حر"},paletteThemes:{colorful:"ملون",pastel:"باستيل",neon:"نيون"},backgroundSection:{title:"الخلفية",black:"أسود",white:"أبيض",gray:"رمادي",tint:"صبغة",custom:"مخصص",none:"بدون"},borderSection:{title:"الحدود",borderColor:"لون الحدود",thickness:"السمك",cornerRadius:"نصف قطر الزاوية"},borderType:{solid:"صلب",gradient:"متدرج",gray:"رمادي",preset:"مسبق",custom:"مخصص",none:"بدون"},presetGradients:{lilac:"ليلكي",neonPink:"وردي نيون",blackberry:"توت أسود",sun:"شمس",iceland:"آيسلندا",sunset:"غروب",ultraviolet:"فوق بنفسجي",purple:"أرجواني",iceCream:"آيس كريم",mint:"نعناع",cool:"بارد",fresh:"منعش"}},designPanel:{toolbarButton:"التصميم",defaultExpanded:"لوحة الألوان"},annotatePanel:{toolbarButton:"التعليقات",callOutSection:{title:"وسائل الشرح",text:"نص",arrow:"سهم",box:"مربع",difference:"الفرق"},highlightSection:{title:"التمييز",button:"تمييز",colorLabel:"لون التمييز"}},annotationsPanel:{toolbarButton:"التعليقات",freeformSection:{title:"حر",text:"نص",arrow:"سهم",box:"مربع",difference:"فرق"},goalSection:{title:"الهدف",labelControl:"التسمية",labelPlaceholder:"الهدف",labelAriaLabel:"تسمية الهدف المخصصة",valueControl:"قيمة الهدف",valueAriaLabel:"قيمة الهدف",byDate:"حسب التاريخ",xAxisValue:"قيمة المحور السيني",optional:"(اختياري)"},trendsAndAveragesSection:{title:"الاتجاهات والمتوسطات",trend:"الاتجاه",average:"المتوسط"},trendType:{label:"نوع الاتجاه",placeholder:"نوع الاتجاه",options:{linear:"خطي",exponential:"أسي",quadratic:"تربيعي",polynomial:"متعدد الحدود",logarithmic:"لوغاريتمي",power:"قوة",loess:"لويس"}},averageLineSeries:{label:"سلسلة خط المتوسط",placeholder:"اختر السلسلة",ariaLabel:"قائمة منسدلة للسلسلة لخط المتوسط"},highlightSection:{title:"التمييز",button:"تمييز",fadeColorLabel:"لون التلاشي"},titleAndSubtitleSection:{title:"العنوان والعنوان الفرعي",toggleTitle:"العنوان",subtitle:"العنوان الفرعي"},captionAndSourceSection:{title:"التسمية التوضيحية والمصدر",caption:"التسمية التوضيحية",source:"المصدر",url:"الرابط",name:"الاسم"}},elementsPanel:{contentVisible:"مرئي",contentValue:"القيمة",toolbarButton:"العناصر",headerSection:{title:"الرأس",toggleTitle:"العنوان",subtitle:"العنوان الفرعي"},footerSection:{title:"التذييل",caption:"التسمية التوضيحية",source:"المصدر",url:"الرابط",name:"الاسم"},textSizeSection:{title:"حجم النص",scaleFormat:e=>`${e.value}x`},fontSection:{title:"الخط"},sourceSection:{title:"المصدر",url:"الرابط",name:"الاسم"}},powerUpPanel:{toolbarButton:"التحسينات",goalSection:{title:"الهدف",toggle:"الهدف",labelControl:"التسمية",labelPlaceholder:"الهدف",labelAriaLabel:"تسمية الهدف المخصصة",valueControl:"قيمة الهدف",byDate:"حسب التاريخ",xAxisValue:"قيمة المحور السيني",optional:" (اختياري)",xAxisReferenceAriaLabel:"قيمة مرجعية للمحور السيني",anyXAxisValue:"أي قيمة للمحور السيني",selectValuePlaceholder:"اختر القيمة"},trendSection:{title:"الاتجاه",toggle:"الاتجاه"},averageSection:{title:"المتوسط",toggle:"المتوسط",seriesLabel:"سلسلة خط المتوسط",seriesPlaceholder:"اختر السلسلة",seriesAriaLabel:"قائمة منسدلة للسلسلة لخط المتوسط"},trendType:{label:"نوع الاتجاه",placeholder:"نوع الاتجاه",options:{linear:"خطي",exponential:"أسي",quadratic:"تربيعي",polynomial:"متعدد الحدود",logarithmic:"لوغاريتمي",power:"قوة",loess:"لويس"}},valueInput:{percentagePlaceholder:"النسبة المئوية",numberPlaceholder:"الرقم",percentageSymbol:"٪"}},highlighting:{modeHelper:{title:"وضع التمييز",hover:"مرر",toHighlight:"للتمييز",anyElement:"أي عنصر",escToExit:"للخروج",esc:"ESC"},emptyState:"لا تتوفر خيارات تمييز",deleteAriaLabel:"حذف التمييز",highlightStyle:{tint:"صبغة",gray:"رمادي"}},fineTunePanel:{toolbarButton:"الضبط الدقيق",detailSection:{title:"التفاصيل",missingValues:"القيم المفقودة"},lineStyleSection:{title:"نمط الخط",lineCurve:"انحناء الخط",sharp:"حاد",smooth:"ناعم"}},customThemeEditor:{patternDropdownAriaLabel:"قائمة منسدلة للنمط للسلسلة",patterns:{solid:"صلب",pattern:"نمط",dotted:"منقط",dashed:"متقطع",hatched:"مظلل"},heatmapColorLabel:"اللون"},overlayMenu:{observation:"مشاهدة",group:"مجموعة",band:"نطاق",axis:"المحور",legend:"وسيلة الإيضاح",gridLines:"خطوط الشبكة",chart:"الرسم البياني"},accessibility:{toggleSection:e=>`تبديل قسم ${e.title}`},graphyDefaults:{themeOptions:{light:"فاتح",dark:"داكن"}}},qa={titleEditor:{titlePlaceholder:"بدون عنوان",subtitlePlaceholder:"إضافة عنوان فرعي"},toolbar:{formatting:{bold:"عريض",italic:"مائل",underline:"تحته خط",link:"رابط"},link:{ariaLabel:"إنشاء رابط",placeholder:"اكتب أو الصق رابطاً...",submit:"إرسال",urlLabel:"عنوان الرابط",apply:"تطبيق الرابط"},font:{label:"الخط",ariaLabel:"عائلة الخط"},heading:{label:"مستوى العنوان",ariaLabel:"نمط النص",text:"نص",caption:"تسمية توضيحية",heading1:"عنوان 1",heading2:"عنوان 2",heading3:"عنوان 3"},textAlign:{left:"محاذاة لليسار",center:"توسيط",right:"محاذاة لليمين"},color:{label:"لون النص"}},colorDropdown:{colors:"الألوان",chartColors:"ألوان الرسم البياني",custom:"مخصص",opacity:"الشفافية",transparent:"شفاف",pickCustom:"اختيار لون مخصص",pickColor:"اختيار لون"},annotations:{differenceArrowToolbar:{label:"خيارات سهم الفرق",labelKind:{ariaLabel:"التسمية",absoluteDifference:"التغير المطلق",relativeDifference:"التغير المئوي",proportion:"النسبة",suspectValue:"تقسم هذه القيمة على أساس يساوي صفرًا.",incomparableEnds:"يقيس الطرفان كميتين مختلفتين، لذا لا معنى للفرق بينهما."},color:"لون السهم",size:{ariaLabel:"الحجم",small:"صغير",medium:"متوسط",large:"كبير"},swap:"عكس الاتجاه",remove:"إزالة السهم"},shapeToolbar:{label:"خيارات الشكل",color:"لون الشكل",border:{ariaLabel:"الحد",none:"بلا",thin:"رفيع (2 بكسل)",medium:"متوسط (8 بكسل)",thick:"سميك (16 بكسل)"},remove:"إزالة الشكل",resize:{"top-left":"تغيير الحجم من الزاوية العلوية اليسرى","top-right":"تغيير الحجم من الزاوية العلوية اليمنى","bottom-right":"تغيير الحجم من الزاوية السفلية اليمنى","bottom-left":"تغيير الحجم من الزاوية السفلية اليسرى"}},arrowToolbar:{label:"خيارات السهم",color:"لون السهم",thickness:{ariaLabel:"السماكة",thin:"رفيع",medium:"متوسط",thick:"سميك"},startArrowhead:"بداية السهم",endArrowhead:"نهاية السهم",arrowhead:{lineArrow:"رأس سهم",none:"بلا"},lineStyle:{ariaLabel:"نمط الخط",solid:"متصل",dashed:"متقطع",dotted:"منقّط"},sticker:"تأثير الملصق",remove:"إزالة السهم",moveEndpoint:{start:"تحريك بداية السهم",end:"تحريك نهاية السهم"}},textToolbar:{label:"خيارات النص",background:"لون الخلفية",color:"لون النص",font:{ariaLabel:"الخط",modern:"عصري",fresh:"منعش",timeless:"كلاسيكي",technical:"تقني",fineliner:"قلم رفيع"},fontSize:{ariaLabel:"حجم الخط",small:"صغير",medium:"متوسط",large:"كبير",extraLarge:"كبير جدًا",huge:"ضخم"},align:{left:"محاذاة إلى اليسار",center:"محاذاة إلى الوسط",right:"محاذاة إلى اليمين"},remove:"إزالة النص",resize:{left:"تغيير الحجم من اليسار",right:"تغيير الحجم من اليمين"}},text:{editLabel:"تحرير النص",placeholder:"اكتب شيئًا"},baseMenu:{pinNumber:"تثبيت الرقم",unpinNumber:"إلغاء تثبيت الرقم",annotate:"تعليق",removeAnnotation:"إزالة التعليق",highlight:"تمييز",highlightWithLabel:e=>`تمييز ${e.label}`,removeHighlight:"إزالة التمييز",differenceArrow:"سهم الفرق",addSticker:"إضافة ملصق",removeSticker:"إزالة الملصق"},textMenu:{title:"تعليق",placeholder:"إضافة تعليق",addButton:"إضافة"},highlights:{menuTitle:"تمييز",labels:{bar:"شريط",barGroup:"مجموعة",barStack:"مكدس",barSeries:"سلسلة",line:"خط",linePoint:"نقطة",lineSeries:"سلسلة",scatterPoint:"نقطة",scatterSeries:"سلسلة",pieSlice:"شريحة",pointOrBar:"نقطة / شريط",lineOrSeries:"خط / سلسلة"}},stickerMenu:{title:"إضافة ملصق"},delete:"حذف",arrow:{thickness:{label:"السمك",thin:"رفيع",medium:"متوسط",thick:"سميك"},arrowhead:{startPoint:"نقطة البداية",endPoint:"نقطة النهاية",lineArrow:"سهم الخط",none:"بدون"},lineStyle:{label:"نمط الخط",solid:"صلب",dotted:"منقط"},stickerEffect:"تأثير الملصق",toolbarAriaLabel:"شريط أدوات السهم الحر",editorAriaLabel:"محرر السهم"},differenceArrow:{type:{proportion:"النسبة",difference:({absoluteDifference:e})=>`الفرق (${e})`,increase:({absoluteDifference:e})=>`الزيادة (${e})`,decrease:({absoluteDifference:e})=>`النقصان (${e})`,percentageChange:({percentageChange:e})=>`تغيير النسبة المئوية (${e})`,percentIncrease:({percentageChange:e})=>`زيادة النسبة المئوية (${e})`,percentDecrease:({percentageChange:e})=>`نقصان النسبة المئوية (${e})`},size:{label:"الحجم",small:"صغير",medium:"متوسط",large:"كبير"},flipArrow:"عكس السهم",color:"اللون",toolbarAriaLabel:"شريط أدوات سهم الفرق",editorAriaLabel:"محرر سهم الفرق"},shape:{color:"اللون",border:{label:"الحدود",none:"بدون",thin:({value:e})=>`رفيع (${e})`,medium:({value:e})=>`متوسط (${e})`,thick:({value:e})=>`سميك (${e})`}}}},Ka={common:Ua,editor:Wa,graph:qa},Xa={save:"Save",cancel:"Cancel",confirm:"Confirm",delete:"Delete",confirmDelete:e=>`Are you sure you want to delete ${e.item}?`,abbreviations:{thousands:"k",millions:"m",billions:"b"}},Za={title:"Graphy Editor",description:"Edit your content here",graphTypes:{column:"Column",columnStacked:"Stacked column",columnStackedFill:"100% stacked column",bar:"Bar",barStacked:"Stacked bar",barStackedFill:"100% stacked bar",line:"Line",areaStacked:"Stacked area",pie:"Pie",donut:"Donut",radialBar:"Radial bar",rose:"Rose",roseStacked:"Stacked rose",radar:"Radar",radarFilled:"Filled radar",scatter:"Scatter",bubble:"Bubble",funnel:"Funnel",combo:"Combo",heatmap:"Heatmap",waterfall:"Waterfall",mekko:"Mekko",table:"Table"},sizePanel:{toolbarButton:"Size",presetsSection:{title:"Presets"},customSizeSection:{title:"Custom size"},presets:{googleSlides:"Google Slides / PowerPoint",webEmail:"Web / email",linkedIn:"LinkedIn post",instagram:"Instagram post",tiktok:"TikTok / Instagram story",twitter:"X (Twitter)",mobile:"Mobile"},inputs:{unitLabel:"px"},validation:{maxSizeError:e=>`≤ ${e.max}px`,minSizeError:e=>`≥ ${e.min}px`}},graphPanel:{toolbarButton:"Graph",graphTypeSection:{title:"Graph type"},mappingSection:{title:"Data",x:"X-axis",y:"Value",color:"Colour",size:"Size",label:"Label",none:"None"},comboSection:{title:"Combo chart appearance",types:{"grouped-bars":"Grouped bars","stacked-bars":"Stacked bars",lines:"Lines only"}},polarSection:{title:"Polar",innerRadius:"Inner radius",startAngle:"Start angle"},barSection:{title:"Bars",thickness:"Bar thickness",rounding:"Rounding",roundingOptions:{none:"None",xs:"XS",sm:"S",md:"M",lg:"L",xl:"XL",full:"Full"}},graphOptionsSection:{title:"Graph options"},gridSection:{title:"Grid",horizontalGridLines:"Horizontal lines",verticalGridLines:"Vertical lines",rings:"Rings",spokes:"Spokes",gridStyle:"Grid style",gridThickness:"Grid thickness",lineStyles:{solid:"Solid",dashed:"Dashed",dotted:"Dotted"}},graphOptions:{sortBars:"Sort high → low",showPoints:"Show points",lineFill:"Fill under line",smoothLines:"Smooth lines",stackTotals:"Stack totals",dataLabels:"Data labels",showPercentages:"Show percentages",categoryLabels:"Category labels"},legendSection:{title:"Legend",auto:"Auto",top:"Top",bottom:"Bottom",left:"Left",right:"Right",none:"None",alignLabel:"Alignment",align:{auto:"Auto",start:"Start",center:"Center",end:"End"},displayLabel:"Style",display:{auto:"Auto",pill:"Pills",direct:"Direct"}},numberFormatSection:{title:"Number format"},numberFormat:{abbreviationLabel:"Abbreviation",valueLabel:"Value",decimalPlacesLabel:"Decimal places",options:{auto:"Auto",custom:"Custom",none:"None"}},headlineNumberSize:{sizeLabel:"Size",valueLabel:"Value",sizes:{small:"S",medium:"M",large:"L"}},lineThickness:{label:"Line thickness"},pointSize:{label:"Point size",options:{auto:"Auto",custom:"Custom"}},headlineNumberSection:{title:"Headline number",toggle:"Visible",metricLabel:"Metric",compareWithLabel:"Compare with",metrics:{total:"Total",average:"Avg.",current:"Last",conversion:"Conversion",left:"Left"},comparison:{first:"First",previous:"Previous"},position:{above:"Above",center:"Center"}},treatEmptyValues:{leaveGap:{label:"Leave gap in chart",description:"Leaves a visible break in the line where data is missing"},fillZero:{label:"Fill with zero",description:"Displays missing data points as zero"},connectGaps:{label:"Connect across gaps",description:"Joins the line between available points, skipping the gap"}},comboChartAppearance:{title:"Combo chart appearance",groupedBars:"Grouped bars",stackedBars:"Stacked bars",linesOnly:"Lines only"}},axesPanel:{toolbarButton:"Axes",mainAxisSection:{yAxis:"Y-axis",xAxis:"X-axis"},crossAxisSection:{xAxis:"X-axis",yAxis:"Y-axis"},controls:{title:"Title",visible:"Visible",ticks:"Ticks",labels:"Labels",position:"Position",scale:"Scale",startFrom:"Start from",endAt:"End at",value:"Value",numberOfAxes:"Number of axes",reverse:"Reverse"},labelMode:{auto:"Auto",edges:"Edges"},scale:{auto:"Auto",log:"Log"},startFrom:{auto:"Auto",zero:"Zero",custom:"Custom"},endAt:{auto:"Auto",custom:"Custom"},axisCount:{single:"Single",double:"Double"},position:{left:"Left",right:"Right",top:"Top",bottom:"Bottom"},yesNo:{yes:"Yes",no:"No"}},colorPanel:{toolbarButton:"Color",themeSection:{title:"Theme"},appearanceSection:{title:"Appearance",highlightStyle:"Highlight"},paletteSection:{title:"Palette",colorScheme:"Color scheme",colors:"Colors",colorPalettes:"Color palettes"},paletteMode:{preset:"Preset",freestyle:"Freestyle"},paletteThemes:{colorful:"Colorful",pastel:"Pastel",neon:"Neon"},backgroundSection:{title:"Background",black:"Black",white:"White",gray:"Grey",tint:"Tint",custom:"Custom",none:"None"},borderSection:{title:"Border",borderColor:"Border color",thickness:"Thickness",cornerRadius:"Corner radius"},borderType:{solid:"Solid",gradient:"Gradient",gray:"Grey",preset:"Preset",custom:"Custom",none:"None"},presetGradients:{lilac:"Lilac",neonPink:"Neon Pink",blackberry:"Blackberry",sun:"Sun",iceland:"Iceland",sunset:"Sunset",ultraviolet:"Ultraviolet",purple:"Purple",iceCream:"Ice Cream",mint:"Mint",cool:"Cool",fresh:"Fresh"}},designPanel:{toolbarButton:"Design",defaultExpanded:"Palette"},annotatePanel:{toolbarButton:"Annotate",callOutSection:{title:"Callouts",text:"Text",arrow:"Arrow",box:"Box",difference:"Difference"},highlightSection:{title:"Highlight",button:"Highlight",colorLabel:"Highlight color"}},annotationsPanel:{toolbarButton:"Annotate",freeformSection:{title:"Freeform",text:"Text",arrow:"Arrow",box:"Box",difference:"Difference"},goalSection:{title:"Goal",labelControl:"Label",labelPlaceholder:"Goal",labelAriaLabel:"Custom goal label",valueControl:"Goal value",valueAriaLabel:"Goal value",byDate:"By date",xAxisValue:"X-axis value",optional:"(optional)"},trendsAndAveragesSection:{title:"Trends and Averages",trend:"Trend",average:"Average"},trendType:{label:"Trend type",placeholder:"Trend type",options:{linear:"Linear",exponential:"Exponential",quadratic:"Quadratic",polynomial:"Polynomial",logarithmic:"Logarithmic",power:"Power",loess:"Loess"}},averageLineSeries:{label:"Average line series",placeholder:"Select series",ariaLabel:"Series dropdown for average line"},highlightSection:{title:"Highlight",button:"Highlight",fadeColorLabel:"Fade color"},titleAndSubtitleSection:{title:"Title & Subtitle",toggleTitle:"Title",subtitle:"Subtitle"},captionAndSourceSection:{title:"Caption & Source",caption:"Caption",source:"Source",url:"URL",name:"Name"}},elementsPanel:{contentVisible:"Visible",contentValue:"Value",toolbarButton:"Elements",headerSection:{title:"Header",toggleTitle:"Title",subtitle:"Subtitle"},footerSection:{title:"Footer",caption:"Caption",source:"Source",url:"URL",name:"Name"},textSizeSection:{title:"Text size",scaleFormat:e=>`${e.value}x`},fontSection:{title:"Font"},sourceSection:{title:"Source",url:"URL",name:"Name"}},powerUpPanel:{toolbarButton:"Power-ups",goalSection:{title:"Goal",toggle:"Goal",labelControl:"Label",labelPlaceholder:"Goal",labelAriaLabel:"Custom goal label",valueControl:"Goal value",byDate:"By date",xAxisValue:"X-axis value",optional:" (optional)",xAxisReferenceAriaLabel:"X-axis reference value",anyXAxisValue:"Any x-axis value",selectValuePlaceholder:"Select value"},trendSection:{title:"Trend",toggle:"Trend"},averageSection:{title:"Average",toggle:"Average",seriesLabel:"Average line series",seriesPlaceholder:"Select series",seriesAriaLabel:"Series dropdown for average line"},trendType:{label:"Trend type",placeholder:"Trend type",options:{linear:"Linear",exponential:"Exponential",quadratic:"Quadratic",polynomial:"Polynomial",logarithmic:"Logarithmic",power:"Power",loess:"Loess"}},valueInput:{percentagePlaceholder:"Percentage",numberPlaceholder:"Number",percentageSymbol:"%"}},highlighting:{modeHelper:{title:"Highlight mode",hover:"Hover",toHighlight:"to highlight",anyElement:"any element",escToExit:"to exit",esc:"ESC"},emptyState:"No highlight options available",deleteAriaLabel:"Delete highlight",highlightStyle:{tint:"Tint",gray:"Grey"}},fineTunePanel:{toolbarButton:"Fine tune",detailSection:{title:"Detail",missingValues:"Missing values"},lineStyleSection:{title:"Line style",lineCurve:"Line curve",sharp:"Sharp",smooth:"Smooth"}},customThemeEditor:{patternDropdownAriaLabel:"Pattern dropdown for series",patterns:{solid:"Solid",pattern:"Pattern",dotted:"Dotted",dashed:"Dashed",hatched:"Hatched"},heatmapColorLabel:"Color"},overlayMenu:{observation:"Observation",group:"Group",band:"Band",axis:"Axis",legend:"Legend",gridLines:"Grid lines",chart:"Chart"},accessibility:{toggleSection:e=>`Toggle ${e.title} section`},graphyDefaults:{themeOptions:{light:"Light",dark:"Dark"}}},Ya={titleEditor:{titlePlaceholder:"Untitled",subtitlePlaceholder:"Add a subtitle"},toolbar:{formatting:{bold:"Bold",italic:"Italic",underline:"Underline",link:"Link"},link:{ariaLabel:"Create link",placeholder:"Type or paste a link...",submit:"Submit",urlLabel:"Link URL",apply:"Apply link"},font:{label:"Font",ariaLabel:"Font family"},heading:{label:"Heading level",ariaLabel:"Text style",text:"Text",caption:"Caption",heading1:"Heading 1",heading2:"Heading 2",heading3:"Heading 3"},textAlign:{left:"Align left",center:"Align center",right:"Align right"},color:{label:"Text color"}},colorDropdown:{colors:"Colors",chartColors:"Chart colors",custom:"Custom",opacity:"Opacity",transparent:"Transparent",pickCustom:"Pick custom color",pickColor:"Pick color"},annotations:{differenceArrowToolbar:{label:"Difference arrow options",labelKind:{ariaLabel:"Label",absoluteDifference:"Absolute change",relativeDifference:"Percentage change",proportion:"Proportion",suspectValue:"This value divides by a baseline of zero.",incomparableEnds:"The two ends measure different quantities, so a difference between them has no meaning."},color:"Arrow colour",size:{ariaLabel:"Size",small:"Small",medium:"Medium",large:"Large"},swap:"Swap direction",remove:"Remove arrow"},shapeToolbar:{label:"Shape options",color:"Shape colour",border:{ariaLabel:"Border",none:"None",thin:"Thin (2px)",medium:"Medium (8px)",thick:"Thick (16px)"},remove:"Remove shape",resize:{"top-left":"Resize from the top left","top-right":"Resize from the top right","bottom-right":"Resize from the bottom right","bottom-left":"Resize from the bottom left"}},arrowToolbar:{label:"Arrow options",color:"Arrow colour",thickness:{ariaLabel:"Thickness",thin:"Thin",medium:"Medium",thick:"Thick"},startArrowhead:"Start of the arrow",endArrowhead:"End of the arrow",arrowhead:{lineArrow:"Line arrow",none:"None"},lineStyle:{ariaLabel:"Line style",solid:"Solid",dashed:"Dashed",dotted:"Dotted"},sticker:"Sticker effect",remove:"Remove arrow",moveEndpoint:{start:"Move the start of the arrow",end:"Move the end of the arrow"}},textToolbar:{label:"Text options",background:"Background colour",color:"Text colour",font:{ariaLabel:"Font",modern:"Modern",fresh:"Fresh",timeless:"Timeless",technical:"Technical",fineliner:"Fineliner"},fontSize:{ariaLabel:"Font size",small:"Small",medium:"Medium",large:"Large",extraLarge:"Extra Large",huge:"Huge"},align:{left:"Align left",center:"Align centre",right:"Align right"},remove:"Remove text",resize:{left:"Resize from the left",right:"Resize from the right"}},text:{editLabel:"Edit text",placeholder:"Type something"},baseMenu:{pinNumber:"Pin number",unpinNumber:"Unpin number",annotate:"Annotate",removeAnnotation:"Remove annotation",highlight:"Highlight",highlightWithLabel:e=>`Highlight ${e.label}`,removeHighlight:"Remove highlight",differenceArrow:"Difference arrow",addSticker:"Add sticker",removeSticker:"Remove sticker"},textMenu:{title:"Annotate",placeholder:"Add a comment",addButton:"Add"},highlights:{menuTitle:"Highlight",labels:{bar:"bar",barGroup:"group",barStack:"stack",barSeries:"series",line:"line",linePoint:"point",lineSeries:"series",scatterPoint:"point",scatterSeries:"series",pieSlice:"slice",pointOrBar:"point / bar",lineOrSeries:"line / series"}},stickerMenu:{title:"Add sticker"},delete:"Delete",arrow:{thickness:{label:"Thickness",thin:"Thin",medium:"Medium",thick:"Thick"},arrowhead:{startPoint:"Start point",endPoint:"End point",lineArrow:"Line arrow",none:"None"},lineStyle:{label:"Line style",solid:"Solid",dotted:"Dotted"},stickerEffect:"Sticker effect",toolbarAriaLabel:"Free-form arrow toolbar",editorAriaLabel:"Arrow editor"},differenceArrow:{type:{proportion:"Proportion",difference:({absoluteDifference:e})=>`Difference (${e})`,increase:({absoluteDifference:e})=>`Increase (${e})`,decrease:({absoluteDifference:e})=>`Decrease (${e})`,percentageChange:({percentageChange:e})=>`Percentage change (${e})`,percentIncrease:({percentageChange:e})=>`Percent increase (${e})`,percentDecrease:({percentageChange:e})=>`Percent decrease (${e})`},size:{label:"Size",small:"Small",medium:"Medium",large:"Large"},flipArrow:"Flip arrow",color:"Color",toolbarAriaLabel:"Difference arrow toolbar",editorAriaLabel:"Difference arrow editor"},shape:{color:"Color",border:{label:"Border",none:"None",thin:({value:e})=>`Thin (${e})`,medium:({value:e})=>`Medium (${e})`,thick:({value:e})=>`Thick (${e})`}}}},Ja={common:Xa,editor:Za,graph:Ya},Qa={colorPanel:{backgroundSection:{gray:"Gray"},borderType:{gray:"Gray"}},highlighting:{highlightStyle:{gray:"Gray"}}},eo={editor:Qa},to={save:"Guardar",cancel:"Cancelar",confirm:"Confirmar",delete:"Eliminar",confirmDelete:e=>`Tem a certeza que deseja eliminar ${e.item}?`,abbreviations:{thousands:"mil",millions:"M",billions:"MM"}},no={title:"Editor Graphy",description:"Edite o seu conteúdo aqui",graphTypes:{column:"Colunas",columnStacked:"Colunas sobrepostas",columnStackedFill:"100% Colunas sobrepostas",bar:"Barras",barStacked:"Barras sobrepostas",barStackedFill:"100% Barras sobrepostas",line:"Linha",areaStacked:"Área sobreposta",pie:"Circular",donut:"Donut",radialBar:"Barras radiais",radar:"Radar",radarFilled:"Radar preenchido",scatter:"Dispersão",bubble:"Bolhas",funnel:"Funil",combo:"Combinado",heatmap:"Mapa de Calor",waterfall:"Cascata",mekko:"Mekko",table:"Tabela"},sizePanel:{toolbarButton:"Tamanho",presetsSection:{title:"Predefinições"},customSizeSection:{title:"Tamanho personalizado"},presets:{googleSlides:"Google Slides / PowerPoint",webEmail:"Web / email",linkedIn:"Publicação LinkedIn",instagram:"Publicação Instagram",tiktok:"TikTok / Instagram story",twitter:"X (Twitter)",mobile:"Móvel"},inputs:{unitLabel:"px"},validation:{maxSizeError:e=>`≤ ${e.max}px`,minSizeError:e=>`≥ ${e.min}px`}},graphPanel:{toolbarButton:"Gráfico",graphTypeSection:{title:"Tipo de gráfico"},mappingSection:{title:"Dados",x:"Eixo X",y:"Valor",color:"Cor",size:"Tamanho",label:"Etiqueta",none:"Nenhum"},comboSection:{title:"Aspeto do gráfico combinado",types:{"grouped-bars":"Barras agrupadas","stacked-bars":"Barras empilhadas",lines:"Apenas linhas"}},polarSection:{title:"Polar",innerRadius:"Raio interno",startAngle:"Ângulo inicial"},barSection:{title:"Barras",thickness:"Espessura da barra",rounding:"Arredondamento",roundingOptions:{none:"Nenhum",xs:"XS",sm:"S",md:"M",lg:"L",xl:"XL",full:"Total"}},graphOptionsSection:{title:"Opções do gráfico"},gridSection:{title:"Grelha",horizontalGridLines:"Linhas horizontais",verticalGridLines:"Linhas verticais",rings:"Anéis",spokes:"Raios",gridStyle:"Estilo da grelha",gridThickness:"Espessura da grelha",lineStyles:{solid:"Sólida",dashed:"Tracejada",dotted:"Pontilhada"}},graphOptions:{sortBars:"Ordenar maior → menor",showPoints:"Mostrar pontos",lineFill:"Preencher sob a linha",smoothLines:"Linhas suaves",stackTotals:"Totais sobrepostos",dataLabels:"Etiquetas de dados",showPercentages:"Mostrar percentagens",categoryLabels:"Etiquetas de categorias"},legendSection:{title:"Legenda",auto:"Automático",top:"Topo",bottom:"Fundo",left:"Esquerda",right:"Direita",none:"Nenhuma",alignLabel:"Alinhamento",align:{auto:"Automático",start:"Início",center:"Centro",end:"Fim"},displayLabel:"Estilo",display:{auto:"Automático",pill:"Etiquetas",direct:"No gráfico"}},numberFormatSection:{title:"Formato numérico"},numberFormat:{abbreviationLabel:"Abreviação",valueLabel:"Valor",decimalPlacesLabel:"Casas decimais",options:{auto:"Automático",custom:"Personalizado",none:"Nenhum"}},headlineNumberSize:{sizeLabel:"Tamanho",valueLabel:"Valor",sizes:{small:"P",medium:"M",large:"G"}},lineThickness:{label:"Espessura da linha"},pointSize:{label:"Tamanho do ponto",options:{auto:"Automático",custom:"Personalizado"}},headlineNumberSection:{title:"Número destaque",toggle:"Visível",metricLabel:"Métrica",compareWithLabel:"Comparar com",metrics:{total:"Total",average:"Média",current:"Último",conversion:"Conversão",left:"Esquerda"},comparison:{first:"Primeiro",previous:"Anterior"},position:{above:"Acima",center:"Centro"}},treatEmptyValues:{leaveGap:{label:"Deixar espaço no gráfico",description:"Deixa uma quebra visível na linha onde faltam dados"},fillZero:{label:"Preencher com zero",description:"Exibe pontos de dados em falta como zero"},connectGaps:{label:"Ligar através dos espaços",description:"Une a linha entre pontos disponíveis, ignorando o espaço"}},comboChartAppearance:{title:"Aparência do gráfico combinado",groupedBars:"Barras agrupadas",stackedBars:"Barras sobrepostas",linesOnly:"Apenas linhas"}},axesPanel:{toolbarButton:"Eixos",mainAxisSection:{yAxis:"Eixo Y",xAxis:"Eixo X"},crossAxisSection:{xAxis:"Eixo X",yAxis:"Eixo Y"},controls:{title:"Título",visible:"Visível",ticks:"Marcas",labels:"Etiquetas",position:"Posição",scale:"Escala",startFrom:"Iniciar de",endAt:"Terminar em",value:"Valor",numberOfAxes:"Número de eixos",reverse:"Inverter"},labelMode:{auto:"Automático",edges:"Extremos"},scale:{auto:"Automático",log:"Logarítmico"},startFrom:{auto:"Automático",zero:"Zero",custom:"Personalizado"},endAt:{auto:"Automático",custom:"Personalizado"},axisCount:{single:"Único",double:"Duplo"},position:{left:"Esquerda",right:"Direita",top:"Topo",bottom:"Fundo"},yesNo:{yes:"Sim",no:"Não"}},colorPanel:{toolbarButton:"Cor",themeSection:{title:"Tema"},appearanceSection:{title:"Aparência",highlightStyle:"Destaque"},paletteSection:{title:"Paleta",colorScheme:"Esquema de cores",colors:"Cores",colorPalettes:"Paletas de cores"},paletteMode:{preset:"Predefinido",brand:"Marca",freestyle:"Livre"},paletteThemes:{colorful:"Colorido",pastel:"Pastel",neon:"Néon"},backgroundSection:{title:"Fundo",black:"Preto",white:"Branco",gray:"Cinzento",tint:"Tonalidade",custom:"Personalizado",none:"Nenhum"},borderSection:{title:"Contorno",borderColor:"Cor do contorno",thickness:"Espessura",cornerRadius:"Raio dos cantos"},borderType:{solid:"Sólido",gradient:"Gradiente",gray:"Cinzento",preset:"Predefinido",custom:"Personalizado",none:"Nenhum"},presetGradients:{lilac:"Lilás",neonPink:"Rosa Néon",blackberry:"Amora",sun:"Sol",iceland:"Islândia",sunset:"Pôr do Sol",ultraviolet:"Ultravioleta",purple:"Roxo",iceCream:"Gelado",mint:"Menta",cool:"Frio",fresh:"Fresco"}},designPanel:{toolbarButton:"Design",defaultExpanded:"Paleta"},annotatePanel:{toolbarButton:"Anotar",callOutSection:{title:"Destaques",text:"Texto",arrow:"Seta",box:"Caixa",difference:"Diferença"},highlightSection:{title:"Realce",button:"Realçar",colorLabel:"Cor do realce"}},annotationsPanel:{toolbarButton:"Anotar",freeformSection:{title:"Forma livre",text:"Texto",arrow:"Seta",box:"Caixa",difference:"Diferença"},goalSection:{title:"Objetivo",labelControl:"Etiqueta",labelPlaceholder:"Objetivo",labelAriaLabel:"Etiqueta de objetivo personalizada",valueControl:"Valor do objetivo",valueAriaLabel:"Valor do objetivo",byDate:"Por data",xAxisValue:"Valor do eixo X",optional:"(opcional)"},trendsAndAveragesSection:{title:"Tendências e Médias",trend:"Tendência",average:"Média"},trendType:{label:"Tipo de tendência",placeholder:"Tipo de tendência",options:{linear:"Linear",exponential:"Exponencial",quadratic:"Quadrática",polynomial:"Polinomial",logarithmic:"Logarítmica",power:"Potência",loess:"Loess"}},averageLineSeries:{label:"Série da linha de média",placeholder:"Selecionar série",ariaLabel:"Dropdown de séries para linha de média"},highlightSection:{title:"Realce",button:"Realçar",fadeColorLabel:"Cor de esmaecimento"},titleAndSubtitleSection:{title:"Título e Subtítulo",toggleTitle:"Título",subtitle:"Subtítulo"},captionAndSourceSection:{title:"Legenda e Fonte",caption:"Legenda",source:"Fonte",url:"URL",name:"Nome"}},elementsPanel:{contentVisible:"Visível",contentValue:"Valor",toolbarButton:"Elementos",headerSection:{title:"Cabeçalho",toggleTitle:"Título",subtitle:"Subtítulo"},footerSection:{title:"Rodapé",caption:"Legenda",source:"Fonte",url:"URL",name:"Nome"},textSizeSection:{title:"Tamanho do texto",scaleFormat:e=>`${e.value}x`},fontSection:{title:"Tipo de letra"},sourceSection:{title:"Fonte",url:"URL",name:"Nome"}},powerUpPanel:{toolbarButton:"Extras",goalSection:{title:"Objetivo",toggle:"Objetivo",labelControl:"Etiqueta",labelPlaceholder:"Objetivo",labelAriaLabel:"Etiqueta de objetivo personalizada",valueControl:"Valor do objetivo",byDate:"Por data",xAxisValue:"Valor do eixo X",optional:" (opcional)",xAxisReferenceAriaLabel:"Valor de referência do eixo X",anyXAxisValue:"Qualquer valor do eixo X",selectValuePlaceholder:"Selecionar valor"},trendSection:{title:"Tendência",toggle:"Tendência"},averageSection:{title:"Média",toggle:"Média",seriesLabel:"Série da linha de média",seriesPlaceholder:"Selecionar série",seriesAriaLabel:"Dropdown de séries para linha de média"},trendType:{label:"Tipo de tendência",placeholder:"Tipo de tendência",options:{linear:"Linear",exponential:"Exponencial",quadratic:"Quadrática",polynomial:"Polinomial",logarithmic:"Logarítmica",power:"Potência",loess:"Loess"}},valueInput:{percentagePlaceholder:"Percentagem",numberPlaceholder:"Número",percentageSymbol:"%"}},highlighting:{modeHelper:{title:"Modo de realce",hover:"Passe",toHighlight:"para realçar",anyElement:"qualquer elemento",escToExit:"para sair",esc:"ESC"},emptyState:"Sem opções de realce disponíveis",deleteAriaLabel:"Eliminar realce",highlightStyle:{tint:"Tonalidade",gray:"Cinzento"}},fineTunePanel:{toolbarButton:"Ajuste fino",detailSection:{title:"Detalhe",missingValues:"Valores em falta"},lineStyleSection:{title:"Estilo de linha",lineCurve:"Curva da linha",sharp:"Angulosa",smooth:"Suave"}},customThemeEditor:{patternDropdownAriaLabel:"Dropdown de padrões para série",patterns:{solid:"Sólido",pattern:"Padrão",dotted:"Pontilhado",dashed:"Tracejado",hatched:"Hachurado"},heatmapColorLabel:"Cor"},overlayMenu:{observation:"Observação",group:"Grupo",band:"Banda",axis:"Eixo",legend:"Legenda",gridLines:"Linhas de grelha",chart:"Gráfico"},accessibility:{toggleSection:e=>`Alternar secção ${e.title}`},graphyDefaults:{themeOptions:{light:"Claro",dark:"Escuro"}}},ro={titleEditor:{titlePlaceholder:"Sem título",subtitlePlaceholder:"Adicionar subtítulo"},toolbar:{formatting:{bold:"Negrito",italic:"Itálico",underline:"Sublinhado",link:"Ligação"},link:{ariaLabel:"Criar ligação",placeholder:"Escreva ou cole uma ligação...",submit:"Submeter",urlLabel:"URL da ligação",apply:"Aplicar ligação"},font:{label:"Tipo de letra",ariaLabel:"Família do tipo de letra"},heading:{label:"Nível de título",ariaLabel:"Estilo de texto",text:"Texto",caption:"Legenda",heading1:"Título 1",heading2:"Título 2",heading3:"Título 3"},textAlign:{left:"Alinhar à esquerda",center:"Alinhar ao centro",right:"Alinhar à direita"},color:{label:"Cor do texto"}},colorDropdown:{colors:"Cores",chartColors:"Cores do gráfico",custom:"Personalizado",opacity:"Opacidade",transparent:"Transparente",pickCustom:"Escolher cor personalizada",pickColor:"Escolher cor"},annotations:{differenceArrowToolbar:{label:"Opções da seta de diferença",labelKind:{ariaLabel:"Etiqueta",absoluteDifference:"Variação absoluta",relativeDifference:"Variação percentual",proportion:"Proporção",suspectValue:"Este valor divide por uma base igual a zero.",incomparableEnds:"As duas pontas medem quantidades diferentes, pelo que a diferença entre elas não tem significado."},color:"Cor da seta",size:{ariaLabel:"Tamanho",small:"Pequeno",medium:"Médio",large:"Grande"},swap:"Inverter sentido",remove:"Remover seta"},shapeToolbar:{label:"Opções da forma",color:"Cor da forma",border:{ariaLabel:"Contorno",none:"Nenhum",thin:"Fino (2px)",medium:"Médio (8px)",thick:"Espesso (16px)"},remove:"Remover forma",resize:{"top-left":"Redimensionar a partir do canto superior esquerdo","top-right":"Redimensionar a partir do canto superior direito","bottom-right":"Redimensionar a partir do canto inferior direito","bottom-left":"Redimensionar a partir do canto inferior esquerdo"}},arrowToolbar:{label:"Opções da seta",color:"Cor da seta",thickness:{ariaLabel:"Espessura",thin:"Fina",medium:"Média",thick:"Espessa"},startArrowhead:"Início da seta",endArrowhead:"Fim da seta",arrowhead:{lineArrow:"Ponta de seta",none:"Nenhuma"},lineStyle:{ariaLabel:"Estilo da linha",solid:"Sólida",dashed:"Tracejada",dotted:"Pontilhada"},sticker:"Efeito autocolante",remove:"Remover seta",moveEndpoint:{start:"Mover o início da seta",end:"Mover o fim da seta"}},textToolbar:{label:"Opções do texto",background:"Cor de fundo",color:"Cor do texto",font:{ariaLabel:"Tipo de letra",modern:"Moderno",fresh:"Fresco",timeless:"Intemporal",technical:"Técnico",fineliner:"Caneta fina"},fontSize:{ariaLabel:"Tamanho da letra",small:"Pequeno",medium:"Médio",large:"Grande",extraLarge:"Muito grande",huge:"Enorme"},align:{left:"Alinhar à esquerda",center:"Alinhar ao centro",right:"Alinhar à direita"},remove:"Remover texto",resize:{left:"Redimensionar a partir da esquerda",right:"Redimensionar a partir da direita"}},text:{editLabel:"Editar texto",placeholder:"Escreva algo"},baseMenu:{pinNumber:"Fixar número",unpinNumber:"Desafixar número",annotate:"Anotar",removeAnnotation:"Remover anotação",highlight:"Realçar",highlightWithLabel:e=>`Realçar ${e.label}`,removeHighlight:"Remover realce",differenceArrow:"Seta de diferença",addSticker:"Adicionar autocolante",removeSticker:"Remover autocolante"},textMenu:{title:"Anotar",placeholder:"Adicionar comentário",addButton:"Adicionar"},highlights:{menuTitle:"Realçar",labels:{bar:"Barra",barGroup:"Grupo",barStack:"Pilha",barSeries:"Série",line:"Linha",linePoint:"Ponto",lineSeries:"Série",scatterPoint:"Ponto",scatterSeries:"Série",pieSlice:"Fatia",pointOrBar:"Ponto / barra",lineOrSeries:"Linha / série"}},stickerMenu:{title:"Adicionar autocolante"},delete:"Eliminar",arrow:{thickness:{label:"Espessura",thin:"Fina",medium:"Média",thick:"Grossa"},arrowhead:{startPoint:"Ponto inicial",endPoint:"Ponto final",lineArrow:"Seta de linha",none:"Nenhuma"},lineStyle:{label:"Estilo de linha",solid:"Sólida",dotted:"Pontilhada"},stickerEffect:"Efeito de autocolante",toolbarAriaLabel:"Barra de ferramentas de seta livre",editorAriaLabel:"Editor de seta"},differenceArrow:{type:{proportion:"Proporção",difference:({absoluteDifference:e})=>`Diferença (${e})`,increase:({absoluteDifference:e})=>`Aumento (${e})`,decrease:({absoluteDifference:e})=>`Diminuição (${e})`,percentageChange:({percentageChange:e})=>`Variação percentual (${e})`,percentIncrease:({percentageChange:e})=>`Aumento percentual (${e})`,percentDecrease:({percentageChange:e})=>`Diminuição percentual (${e})`},size:{label:"Tamanho",small:"Pequeno",medium:"Médio",large:"Grande"},flipArrow:"Inverter seta",color:"Cor",toolbarAriaLabel:"Barra de ferramentas de seta de diferença",editorAriaLabel:"Editor de seta de diferença"},shape:{color:"Cor",border:{label:"Contorno",none:"Nenhum",thin:({value:e})=>`Fino (${e})`,medium:({value:e})=>`Médio (${e})`,thick:({value:e})=>`Grosso (${e})`}}}},ao={common:to,editor:no,graph:ro},oo={"en-GB":Ja,"en-US":eo,ar:Ka,"pt-PT":ao},io=[oo,l.dictionaries],Rn=({children:e,...t})=>(0,n.jsx)(l.IntlProvider,{dictionaries:io,...t,children:e}),so="data-variant",On=In.Paragraph.extend({addAttributes(){return{variant:{default:null,parseHTML:e=>e.getAttribute("data-variant")??null,renderHTML:e=>e.variant?{[so]:e.variant}:{}}}}}),lo=Ln.Extension.create({name:"preventBackspaceAcrossTitleBoundary",addOptions(){return{isTitleVisible:!0}},addKeyboardShortcuts(){return{Backspace:({editor:e})=>{if(!this.options.isTitleVisible)return!1;const{selection:t}=e.state;if(!t.empty)return!1;const{$from:r}=t;return r.depth!==1||r.parentOffset!==0?!1:r.index(0)===1}}}}),pt=()=>[Ba.Text,Re.UndoRedo,Da.Heading.configure({levels:[1,2,3]}),_a.Bold,Fa.Italic,Ga.Underline,Ha.TextAlign.configure({types:["heading","paragraph"]}),za.Link.configure({openOnClick:!1,autolink:!0}),Te.TextStyle,Te.Color,Na.HardBreak],co=({titlePlaceholder:e,subtitlePlaceholder:t,isTitleVisible:r,isSubtitleVisible:a})=>[ho({isTitleVisible:r,isSubtitleVisible:a}),On,...pt(),Te.FontFamily,lo.configure({isTitleVisible:r}),Re.Placeholder.configure({showOnlyCurrent:!1,placeholder:({pos:o,editor:i})=>{if(r&&o===0)return e;const s=r?i.state.doc.firstChild?.nodeSize??-1:0;return a&&o===s?t:""}})],uo=({placeholder:e})=>[we.Document,On,...pt(),Te.FontFamily,Re.Placeholder.configure({showOnlyCurrent:!1,placeholder:({pos:t})=>t===0?e:""})],ho=({isTitleVisible:e,isSubtitleVisible:t})=>e&&t?we.Document.extend({content:"block{2,}"}):we.Document,_n="linear-gradient(to top right, transparent calc(50% - 1px), var(--graphy-alert) calc(50% - 1px), var(--graphy-alert) calc(50% + 1px), transparent calc(50% + 1px))",po="d0bl00";var Nn="d0bl03",mo="d0bl04",Dn="d0bl05",Ye="d0bl06",go="d0bl07",xo="d0bl08",Fn="d0bl09",vo="d0bl0a",fo="d0bl0b",bo="d0bl0c",So="d0bl0d",yo="d0bl0e",Co="owf1yg0",jo="owf1yg1",wo="owf1yg2",To="owf1yg3",Ao="owf1yg4",ko=.01,Po=({value:e,onChange:t,label:r})=>(0,n.jsx)(Z.Slider.Root,{className:Co,value:e,onValueChange:a=>t(a),min:0,max:1,step:ko,children:(0,n.jsx)(Z.Slider.Control,{className:jo,children:(0,n.jsxs)(Z.Slider.Track,{className:wo,children:[(0,n.jsx)(Z.Slider.Indicator,{className:To}),(0,n.jsx)(Z.Slider.Thumb,{className:Ao,"aria-label":r})]})})}),zn="transparent",Je=$.CANVAS_COLOR_KEYS.map(e=>$.vars[e]),Lo=Object.fromEntries($.CANVAS_COLOR_KEYS.map(e=>[$.vars[e],e])),Io=e=>Je.some(t=>Hn(t,e)),Eo=({color:e,onChange:t,isOpen:r,onOpenChange:a,children:o,label:i,popupAttributes:s,opacity:c,onOpacityChange:d,hasTransparentOption:h=!1})=>{const u=l.useI18n(),m=Ro(),g=h?[zn,...Je]:Je,x=f=>{t(f),a(!1)};return(0,n.jsxs)(H.Popover.Root,{open:r,onOpenChange:a,children:[(0,n.jsx)(H.Popover.Trigger,{render:(0,n.jsx)(Q.Toolbar.Button,{}),"aria-label":i??u("graph.toolbar.color.label"),className:po,onMouseDown:f=>f.preventDefault(),children:o??(0,n.jsx)("span",{className:"d0bl01",style:{background:e??"transparent"}})}),(0,n.jsx)(H.Popover.Portal,{container:l.resolvePortalContainer(),children:(0,n.jsx)(l.PortalThemeProvider,{children:(0,n.jsx)(H.Popover.Positioner,{sideOffset:6,align:"start",className:Nn,children:(0,n.jsxs)(H.Popover.Popup,{className:mo,onMouseDown:f=>f.preventDefault(),...s,children:[(0,n.jsx)(Rt,{title:u("graph.colorDropdown.colors"),colors:g,currentColor:e,onPick:x}),m.length>0&&(0,n.jsx)(Rt,{title:u("graph.colorDropdown.chartColors"),colors:m,currentColor:e,onPick:x}),(0,n.jsx)(Mo,{value:e??"#000000",onChange:t,popupAttributes:s}),c!==void 0&&d!==void 0&&(0,n.jsxs)("div",{className:"d0bl05",children:[(0,n.jsx)("div",{className:"d0bl06",children:u("graph.colorDropdown.opacity")}),(0,n.jsx)(Po,{value:c,onChange:d,label:u("graph.colorDropdown.opacity")})]})]})})})})]})},Rt=({title:e,colors:t,currentColor:r,onPick:a})=>{const o=l.useI18n();return(0,n.jsxs)("div",{className:Dn,children:[(0,n.jsx)("div",{className:Ye,children:e}),(0,n.jsx)("div",{className:go,children:t.map(i=>(0,n.jsx)("button",{type:"button","aria-label":i==="transparent"?o("graph.colorDropdown.transparent"):i,className:xo,"data-active":Hn(i,r),onMouseDown:s=>s.preventDefault(),onClick:()=>a(i),children:(0,n.jsx)("span",{className:Fn,style:Bn(i)})},i))})]})},Mo=({value:e,onChange:t,popupAttributes:r})=>{const a=l.useI18n(),[o,i]=(0,v.useState)(!1),s=l.isValidCssColor(e)?e:"#000000",c=Oo(s);return(0,n.jsxs)(H.Popover.Root,{open:o,onOpenChange:i,children:[(0,n.jsxs)("div",{className:Dn,children:[(0,n.jsx)("div",{className:Ye,children:a("graph.colorDropdown.custom")}),(0,n.jsxs)(H.Popover.Trigger,{className:vo,onMouseDown:d=>d.preventDefault(),"aria-label":a("graph.colorDropdown.pickCustom"),children:[(0,n.jsx)("span",{className:Fn,style:Bn(s)}),(0,n.jsx)("span",{className:fo,children:c})]})]}),(0,n.jsx)(H.Popover.Portal,{container:l.resolvePortalContainer(),children:(0,n.jsx)(l.PortalThemeProvider,{children:(0,n.jsx)(H.Popover.Positioner,{side:"right",align:"start",sideOffset:18,className:Nn,children:(0,n.jsxs)(H.Popover.Popup,{className:bo,onMouseDown:d=>d.preventDefault(),...r,children:[(0,n.jsx)("div",{className:Ye,children:a("graph.colorDropdown.pickColor")}),(0,n.jsx)(It.HexColorPicker,{color:c,onChange:t,className:So}),(0,n.jsx)(It.HexColorInput,{color:c,onChange:t,prefixed:!0,className:yo,onMouseDown:d=>d.stopPropagation()})]})})})})]})},Ro=()=>{const e=l.useSceneSelector(t=>t.scales.color);return(0,v.useMemo)(()=>{if(!e||e.kind!=="visual")return[];const t=new Set;for(const r of e.domain){const a=e.map(r);typeof a=="string"&&t.add(a)}return[...t]},[e])},Bn=e=>e==="transparent"?{background:_n,border:`1px solid ${$.vars.border100}`}:{background:e,border:`1px solid ${l.darkenCss(e,.1)}`},Oo=e=>{const{themeValues:t}=l.useThemeContext();if(l.isHex(e))return e.toUpperCase();const r=Lo[e];return r?t[r].toUpperCase():"#000000"},Hn=(e,t)=>t===null?!1:e.toLowerCase()===t.toLowerCase(),_o="l9kff0",No="l9kff1",Do="l9kff2",Fo="xn24px0",zo="xn24px1",Bo="xn24px2",Ho=({children:e,popupAttributes:t})=>(0,n.jsx)(_.Menu.Portal,{container:l.resolvePortalContainer(),children:(0,n.jsx)(l.PortalThemeProvider,{children:(0,n.jsx)(_.Menu.Positioner,{side:"bottom",align:"start",sideOffset:6,className:Fo,children:(0,n.jsx)(_.Menu.Popup,{className:zo,onMouseDown:r=>r.preventDefault(),...t,children:e})})})}),Go=({children:e,isSelected:t=!1,isDisabled:r=!1,onClick:a})=>(0,n.jsx)(_.Menu.Item,{className:Bo,"data-selected":t,disabled:r,onClick:a,children:e}),Vo=({className:e,...t})=>(0,n.jsx)(ie.Tooltip.Provider,{children:(0,n.jsx)(Q.Toolbar.Root,{...t,className:(0,U.default)(_o,e)})}),$o=({className:e,...t})=>(0,n.jsx)(Q.Toolbar.Group,{...t,className:(0,U.default)(No,e)}),Uo=({className:e,...t})=>(0,n.jsx)(Q.Toolbar.Separator,{...t,className:(0,U.default)(Do,e)}),Wo=({children:e})=>{const t=l.resolvePortalContainer();return t===null?null:(0,Pn.createPortal)((0,n.jsx)(l.PortalThemeProvider,{children:e}),t)},B={Portal:Wo,Root:Vo,Group:$o,Separator:Uo,Button:Q.Toolbar.Button,ColorPicker:Eo,MenuPopup:Ho,MenuItem:Go},pe=e=>(0,n.jsx)(l.Icon,{...e,children:(0,n.jsx)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:(0,n.jsx)("path",{d:"m6 9 6 6 6-6"})})}),qo="'Noto Serif', Georgia, 'Times New Roman', serif, 'Apple Color Emoji', 'NotoColorEmoji'",Ko=`'Aeonik', 'Aeonik Fallback', ${l.DEFAULT_FONT_FAMILY}`,Xo="'PT Mono', 'Courier New', monospace, 'Apple Color Emoji', 'NotoColorEmoji'",Zo="'Intruding Cat', cursive, 'Apple Color Emoji', 'NotoColorEmoji'",Qe=[{id:"modern",label:"Modern",preview:"Aa",fontFamily:l.DEFAULT_FONT_FAMILY},{id:"fresh",label:"Fresh",preview:"Aa",fontFamily:Ko},{id:"timeless",label:"Timeless",preview:"Aa",fontFamily:qo},{id:"technical",label:"Technical",preview:"00",fontFamily:Xo},{id:"fineliner",label:"Fineliner",preview:"Aa",fontFamily:Zo}],Yo=e=>e?Qe.find(t=>t.fontFamily===e)??null:null,Gn="_70l3rt0",Vn="_70l3rt1",$n="_70l3rt3",Un="_70l3rt4",Wn="_70l3rt5",Jo=({editor:e,currentFontFamily:t,isOpen:r,onOpenChange:a})=>{const o=l.useI18n(),i=Yo(t)??Qe[0],s=c=>{e.chain().focus().setFontFamily(c.fontFamily).run()};return(0,n.jsxs)(_.Menu.Root,{open:r,onOpenChange:a,children:[(0,n.jsxs)(_.Menu.Trigger,{render:(0,n.jsx)(Q.Toolbar.Button,{}),"aria-label":o("graph.toolbar.font.ariaLabel"),className:Gn,onMouseDown:c=>c.preventDefault(),children:[(0,n.jsx)("span",{className:Vn,style:{fontFamily:i?.fontFamily},children:i?.preview}),(0,n.jsx)(pe,{size:"sm"})]}),(0,n.jsx)(_.Menu.Portal,{container:l.resolvePortalContainer(),children:(0,n.jsx)(l.PortalThemeProvider,{children:(0,n.jsx)(_.Menu.Positioner,{side:"bottom",align:"start",sideOffset:6,className:$n,children:(0,n.jsx)(_.Menu.Popup,{className:Un,onMouseDown:c=>c.preventDefault(),children:Qe.map(c=>(0,n.jsx)(_.Menu.Item,{className:Wn,"data-selected":c.id===i?.id,onClick:()=>s(c),children:(0,n.jsx)("span",{style:{fontFamily:c.fontFamily},children:c.label})},c.id))})})})})]})},qn={id:"text",translationKey:"graph.toolbar.heading.text",previewFont:$.vars.fontTextEditorBody},Ot=[{id:"caption",translationKey:"graph.toolbar.heading.caption",previewFont:$.vars.fontTextEditorH6},qn,{id:"h3",translationKey:"graph.toolbar.heading.heading3",previewFont:$.vars.fontTextEditorH3},{id:"h2",translationKey:"graph.toolbar.heading.heading2",previewFont:$.vars.fontTextEditorH2},{id:"h1",translationKey:"graph.toolbar.heading.heading1",previewFont:$.vars.fontTextEditorH1}],Qo=({editor:e,activeStyle:t,isOpen:r,onOpenChange:a})=>{const o=l.useI18n(),i=Ot.find(s=>s.id===t)??qn;return(0,n.jsxs)(_.Menu.Root,{open:r,onOpenChange:a,children:[(0,n.jsxs)(_.Menu.Trigger,{render:(0,n.jsx)(Q.Toolbar.Button,{}),"aria-label":o("graph.toolbar.heading.ariaLabel"),className:Gn,onMouseDown:s=>s.preventDefault(),children:[(0,n.jsx)("span",{className:Vn,children:o(i.translationKey)}),(0,n.jsx)(pe,{size:"sm"})]}),(0,n.jsx)(_.Menu.Portal,{container:l.resolvePortalContainer(),children:(0,n.jsx)(l.PortalThemeProvider,{children:(0,n.jsx)(_.Menu.Positioner,{side:"bottom",align:"start",sideOffset:6,className:$n,children:(0,n.jsx)(_.Menu.Popup,{className:Un,onMouseDown:s=>s.preventDefault(),children:Ot.map(s=>(0,n.jsx)(_.Menu.Item,{className:Wn,"data-selected":s.id===i.id,onClick:()=>ei(e,s.id),children:(0,n.jsx)(ti,{font:s.previewFont,children:o(s.translationKey)})},s.id))})})})})]})},ei=(e,t)=>{switch(t){case"caption":e.chain().focus().setNode("paragraph",{variant:"caption"}).run();return;case"text":e.chain().focus().setNode("paragraph",{variant:null}).run();return;case"h1":e.chain().focus().setHeading({level:1}).run();return;case"h2":e.chain().focus().setHeading({level:2}).run();return;case"h3":e.chain().focus().setHeading({level:3}).run()}},ti=({font:e,children:t})=>(0,n.jsx)("span",{style:{font:e,margin:0},children:t}),Kn=e=>(0,n.jsx)(l.Icon,{...e,children:(0,n.jsx)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:(0,n.jsx)("path",{d:"M20 6 9 17l-5-5"})})}),ni=e=>(0,n.jsx)(l.Icon,{...e,children:(0,n.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),(0,n.jsx)("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})}),ri=e=>(0,n.jsx)(l.Icon,{...e,children:(0,n.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"M18 6 6 18"}),(0,n.jsx)("path",{d:"m6 6 12 12"})]})}),ai=e=>!e.content||e.content.length===0?!0:e.content.every(t=>!t.content||t.content.length===0),oi=e=>{const{$from:t}=e.state.selection,r=t.parent.textContent,a=t.parentOffset,o=t.start();let i=a;for(;i>0&&_t(r[i-1]);)i-=1;let s=a;for(;s<r.length&&_t(r[s]);)s+=1;return{from:o+i,to:o+s}},_t=e=>e!==void 0&&/\S/.test(e),ii="fop13s0",si="fop13s1",li="fop13s2",ci="fop13s3",Nt="fop13s4",di=({editor:e,currentUrl:t,isActive:r,isOpen:a,onOpenChange:o})=>{const i=l.useI18n(),[s,c]=(0,v.useState)(""),d=(0,v.useRef)(null);(0,v.useEffect)(()=>{a&&c(t??"")},[a,t]);const h=()=>{ui(e,s),o(!1)},u=()=>{c(""),o(!1)},m=x=>{c(x.target.value)},g=x=>{x.key==="Enter"&&(x.preventDefault(),h())};return(0,n.jsxs)(H.Popover.Root,{open:a,onOpenChange:o,children:[(0,n.jsx)(H.Popover.Trigger,{render:(0,n.jsx)(Q.Toolbar.Button,{}),"aria-label":i("graph.toolbar.formatting.link"),"data-active":r,className:ii,onMouseDown:x=>x.preventDefault(),children:(0,n.jsx)(ni,{})}),(0,n.jsx)(H.Popover.Portal,{container:l.resolvePortalContainer(),children:(0,n.jsx)(l.PortalThemeProvider,{children:(0,n.jsx)(H.Popover.Positioner,{sideOffset:6,align:"end",className:si,children:(0,n.jsxs)(H.Popover.Popup,{className:li,initialFocus:d,onMouseDown:x=>x.preventDefault(),children:[(0,n.jsx)("input",{ref:d,type:"url",value:s,placeholder:i("graph.toolbar.link.placeholder"),"aria-label":i("graph.toolbar.link.urlLabel"),className:ci,onMouseDown:x=>x.stopPropagation(),onChange:m,onKeyDown:g}),(0,n.jsx)("button",{type:"button","aria-label":i("common.cancel"),className:Nt,onClick:u,children:(0,n.jsx)(ri,{})}),(0,n.jsx)("button",{type:"button","aria-label":i("graph.toolbar.link.apply"),className:Nt,onClick:h,children:(0,n.jsx)(Kn,{})})]})})})})]})},ui=(e,t)=>{const r=t.trim(),{selection:a}=e.state;if(!r){e.chain().focus().extendMarkRange("link").unsetLink().run();return}if(!a.empty){e.chain().focus().setLink({href:r}).run();return}if(e.isActive("link")){e.chain().focus().extendMarkRange("link").setLink({href:r}).run();return}const o=oi(e);e.chain().focus().setTextSelection(o).setLink({href:r}).run()},Xn=e=>(0,n.jsx)(l.Icon,{...e,children:(0,n.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"M21 5H3"}),(0,n.jsx)("path",{d:"M17 12H7"}),(0,n.jsx)("path",{d:"M19 19H5"})]})}),Zn=e=>(0,n.jsx)(l.Icon,{...e,children:(0,n.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"M21 5H3"}),(0,n.jsx)("path",{d:"M21 12H9"}),(0,n.jsx)("path",{d:"M21 19H7"})]})}),Yn=e=>(0,n.jsx)(l.Icon,{...e,children:(0,n.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"M21 5H3"}),(0,n.jsx)("path",{d:"M15 12H3"}),(0,n.jsx)("path",{d:"M17 19H3"})]})}),hi="_1d66w570",pi="_1d66w571",mi=6,se=({label:e,isActive:t,onToggle:r,children:a})=>{const o=i=>i.preventDefault();return(0,n.jsxs)(ie.Tooltip.Root,{children:[(0,n.jsx)(ie.Tooltip.Trigger,{render:(0,n.jsx)(Va.Toggle,{render:(0,n.jsx)(Q.Toolbar.Button,{}),pressed:t,onPressedChange:()=>r()}),"aria-label":e,className:hi,onMouseDown:o,children:a}),(0,n.jsx)(ie.Tooltip.Portal,{container:l.resolvePortalContainer(),children:(0,n.jsx)(l.PortalThemeProvider,{children:(0,n.jsx)(ie.Tooltip.Positioner,{sideOffset:mi,children:(0,n.jsx)(ie.Tooltip.Popup,{className:pi,children:e})})})})]})},gi=({editor:e,activeAlignment:t="left"})=>{const r=l.useI18n();return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(se,{label:r("graph.toolbar.textAlign.left"),isActive:t==="left",onToggle:()=>e.chain().focus().setTextAlign("left").run(),children:(0,n.jsx)(Yn,{})}),(0,n.jsx)(se,{label:r("graph.toolbar.textAlign.center"),isActive:t==="center",onToggle:()=>e.chain().focus().setTextAlign("center").run(),children:(0,n.jsx)(Xn,{})}),(0,n.jsx)(se,{label:r("graph.toolbar.textAlign.right"),isActive:t==="right",onToggle:()=>e.chain().focus().setTextAlign("right").run(),children:(0,n.jsx)(Zn,{})})]})},xi="_1u34vl40",vi=({editor:e})=>({isBold:e?.isActive("bold")??!1,isItalic:e?.isActive("italic")??!1,isUnderline:e?.isActive("underline")??!1,isLink:e?.isActive("link")??!1,linkUrl:e?.getAttributes("link").href??null,color:e?.getAttributes("textStyle").color??null,fontFamily:e?.getAttributes("textStyle").fontFamily??null,fontSize:fi(e),textAlign:bi(e)}),fi=e=>e?e.isActive("heading",{level:1})?"h1":e.isActive("heading",{level:2})?"h2":e.isActive("heading",{level:3})?"h3":e.isActive("paragraph",{variant:"caption"})?"caption":"text":"text",bi=e=>e?e.isActive({textAlign:"center"})?"center":e.isActive({textAlign:"right"})?"right":"left":"left",Si=8,yi=8,Ci=({editor:e})=>{const t=l.useI18n(),[r,a]=(0,v.useState)(!1),[o,i]=(0,v.useState)(null),s=o!==null,c=x=>f=>{i(f?x:null)},{refs:d,floatingStyles:h}=(0,le.useFloating)({placement:"top-start",strategy:"fixed",middleware:[(0,le.offset)(Si),(0,le.flip)(),(0,le.shift)({padding:yi})],whileElementsMounted:le.autoUpdate}),u=(0,v.useRef)(null),m=(0,Oe.useEditorState)({editor:e,selector:vi}),g=(0,v.useCallback)(x=>{u.current=x,d.setFloating(x)},[d]);return(0,v.useEffect)(()=>{e&&d.setReference(e.view.dom)},[e,d]),(0,v.useEffect)(()=>{if(!e)return;const x=()=>a(!0),f=({event:b})=>{const{relatedTarget:w,currentTarget:T}=b,y=w instanceof Node&&u.current?.contains(w),k=w instanceof Node&&T instanceof Node&&T.contains(w);!y&&!k&&a(!1)};return e.on("focus",x),e.on("blur",f),()=>{e.off("focus",x),e.off("blur",f)}},[e]),!e||!r&&!s?null:(0,n.jsx)(B.Portal,{children:(0,n.jsxs)(B.Root,{ref:g,className:xi,style:h,children:[(0,n.jsxs)(B.Group,{children:[(0,n.jsx)(B.ColorPicker,{color:m?.color??null,onChange:x=>e.chain().setColor(x).run(),isOpen:o==="color",onOpenChange:c("color")}),(0,n.jsx)(Jo,{editor:e,currentFontFamily:m?.fontFamily??null,isOpen:o==="fontFamily",onOpenChange:c("fontFamily")})]}),(0,n.jsx)(B.Separator,{}),(0,n.jsx)(B.Group,{children:(0,n.jsx)(Qo,{editor:e,activeStyle:m?.fontSize??"text",isOpen:o==="fontSize",onOpenChange:c("fontSize")})}),(0,n.jsx)(B.Separator,{}),(0,n.jsxs)(B.Group,{children:[(0,n.jsx)(se,{label:t("graph.toolbar.formatting.bold"),isActive:m?.isBold??!1,onToggle:()=>e.chain().focus().toggleBold().run(),children:(0,n.jsx)("strong",{children:"B"})}),(0,n.jsx)(se,{label:t("graph.toolbar.formatting.italic"),isActive:m?.isItalic??!1,onToggle:()=>e.chain().focus().toggleItalic().run(),children:(0,n.jsx)("em",{children:"I"})}),(0,n.jsx)(se,{label:t("graph.toolbar.formatting.underline"),isActive:m?.isUnderline??!1,onToggle:()=>e.chain().focus().toggleUnderline().run(),children:(0,n.jsx)("u",{children:"U"})})]}),(0,n.jsx)(B.Separator,{}),(0,n.jsx)(B.Group,{children:(0,n.jsx)(gi,{editor:e,activeAlignment:m?.textAlign})}),(0,n.jsx)(B.Separator,{}),(0,n.jsx)(B.Group,{children:(0,n.jsx)(di,{editor:e,currentUrl:m?.linkUrl??null,isActive:m?.isLink??!1,isOpen:o==="link",onOpenChange:c("link")})})]})})},ji="_1uy50v30",Jn=({editor:e,ariaLabel:t})=>(0,n.jsxs)("div",{className:ji,children:[(0,n.jsx)(Ci,{editor:e}),(0,n.jsx)(Oe.EditorContent,{editor:e,"aria-label":t})]}),wi=200,mt=({content:e,extensions:t,isEditable:r,onUpdate:a,updateDebounceMs:o=wi})=>{const i=(0,v.useRef)(Dt(e)),s=(0,v.useRef)(i.current),c=l.useDebouncedCallback(h=>{s.current=h,a?.(h)},o),d=(0,Oe.useEditor)({extensions:t,content:i.current,editable:r,immediatelyRender:!1,onUpdate:({editor:h})=>{const u=h.getJSON();if(We(s.current,u))return c.cancel();c.run(u)}});return(0,v.useEffect)(()=>{d?.setEditable(r)},[d,r]),(0,v.useEffect)(()=>{if(!d)return;const h=Dt(e);We(s.current,h)||(s.current=h,!We(d.getJSON(),h)&&(c.cancel(),Ti(d,h)))},[d,e,c]),(0,v.useEffect)(()=>()=>c.flush(),[c]),d},Dt=e=>e===null?{type:"doc",content:[]}:typeof e=="string"?{type:"doc",content:[{type:"paragraph",content:e?[{type:"text",text:e}]:[]}]}:e,Ti=(e,t)=>{const{from:r,to:a}=e.state.selection;e.commands.setContent(t,{emitUpdate:!1});const o=e.state.doc.content.size;e.commands.setTextSelection({from:Math.min(r,o),to:Math.min(a,o)})},We=(e,t)=>JSON.stringify(Ae(e))===JSON.stringify(Ae(t)),Ae=e=>Array.isArray(e)?e.map(Ae):e===null||typeof e!="object"?e:Object.fromEntries(Object.entries(e).map(([t,r])=>[t,Ae(r)]).filter(([,t])=>!Ai(t)).sort(([t],[r])=>String(t).localeCompare(String(r)))),Ai=e=>e==null||typeof e=="object"&&Object.keys(e).length===0,ki=({caption:e,captionStyle:t})=>{const{dispatch:r}=l.useGraphCommands(),a=mt({content:e,extensions:(0,v.useMemo)(()=>uo({placeholder:"Add caption"}),[]),isEditable:!0,onUpdate:o=>{const i=ai(o)?null:o;r(new p.SetContentCaptionCommand({caption:i}))}});return(0,n.jsx)("div",{"data-testid":"caption-editor",style:l.toHtmlTextCss(t),children:(0,n.jsx)(Jn,{editor:a,ariaLabel:"Chart caption"})})},Pi=e=>[we.Document,In.Paragraph,...pt(),Ii,Re.Placeholder.configure({showOnlyCurrent:!1,placeholder:({pos:t})=>t===0?e:""})],Li=({annotation:e})=>{const t=l.useI18n(),{dispatch:r}=l.useGraphCommands(),a=l.useEditorStore(),o=(0,v.useMemo)(()=>Pi(t("graph.annotations.text.placeholder")),[t]),i=mt({content:e.content,extensions:o,isEditable:!0,onUpdate:s=>{r(new p.UpdateAnnotationCommand({kind:"text",id:e.id,patch:{content:s}}))}});return(0,v.useEffect)(()=>{const{setCaretEditor:s}=a.getState();return s(i),()=>s(null)},[i,a]),(0,v.useEffect)(()=>{i?.commands.focus("end",{scrollIntoView:!1})},[i]),(0,n.jsx)(Oe.EditorContent,{"aria-label":t("graph.annotations.text.editLabel"),className:l.editor,editor:i,"data-testid":"text-annotation-editor"})},Ft=e=>{const t=l.resolveRichTextFontFamily(e);return t===void 0?{}:{style:`font-family: ${t}`}},Ii=Ln.Extension.create({name:"annotationTextStyleAttributes",addGlobalAttributes(){return[{types:["textStyle"],attributes:{fontFamily:{default:null,renderHTML:e=>Ft(e.fontFamily)},font:{default:null,renderHTML:e=>Ft(e.font)},fontSize:{default:null,renderHTML:e=>typeof e.fontSize=="number"&&Number.isFinite(e.fontSize)?{style:`font-size: calc(${e.fontSize}px * ${$.vars.textScale})`}:{}}}}]}}),Ei=3,Mi=({title:e,isTitleVisible:t,subtitle:r,isSubtitleVisible:a})=>{const o=[];return t&&o.push({type:"heading",attrs:{level:Ei},content:Oi(e)}),a&&o.push(..._i(r)),{type:"doc",content:o}},Ri=e=>{const[t,...r]=e.content??[];return{title:Ni(t?.content??[]),subtitle:Di(r)}},gt=e=>({type:e.type??"text",...e.content!==void 0?{content:e.content.map(gt)}:{},...e.text!==void 0?{text:e.text}:{},...e.marks!==void 0?{marks:e.marks}:{},...e.attrs!==void 0?{attrs:e.attrs}:{}}),Oi=e=>e===null?[]:typeof e=="string"?e===""?[]:[{type:"text",text:e}]:e.type==="doc"&&e.content?e.content.flatMap(t=>t.content??[]):e.type==="text"||e.type==="hardBreak"?[e]:e.content??[],_i=e=>e===null?[{type:"paragraph"}]:typeof e=="string"?e===""?[{type:"paragraph"}]:[{type:"paragraph",content:[{type:"text",text:e}]}]:e.type==="doc"&&e.content?e.content.length===0?[{type:"paragraph"}]:e.content.map(zt):[zt(e)],zt=e=>e.type==="paragraph"?e:{type:"paragraph",content:e.content??[e]},Ni=e=>{if(e.length===0)return null;const[t]=e;return t&&e.length===1&&t.type==="text"&&(!t.marks||t.marks.length===0)?t.text??null:{type:"paragraph",content:e.map(gt)}},Di=e=>{const t=e.filter(a=>(a.content??[]).length>0);if(t.length===0)return null;const[r]=t;if(r&&t.length===1&&r.type==="paragraph"){const a=r.content??[],[o]=a;if(o&&a.length===1&&o.type==="text"&&(!o.marks||o.marks.length===0))return o.text??null}return{type:"doc",content:t.map(gt)}},Fi={fontFamily:"var(--uwf6lt0)",fontSize:"var(--uwf6lt1)",fontWeight:"var(--uwf6lt2)",lineHeight:"var(--uwf6lt3)",textColor:"var(--uwf6lt4)"},zi="uwf6lt5",Bi=({title:e,isTitleVisible:t,isSubtitleVisible:r,subtitle:a,headingStyle:o,subtitleStyle:i})=>{const{dispatch:s}=l.useGraphCommands(),c=(0,v.useMemo)(()=>co({titlePlaceholder:"Untitled",subtitlePlaceholder:"Untitled",isTitleVisible:t,isSubtitleVisible:r}),[t,r]),d=mt({content:(0,v.useMemo)(()=>Mi({title:e,isTitleVisible:t,subtitle:a,isSubtitleVisible:r}),[e,t,a,r]),extensions:c,isEditable:!0,onUpdate:h=>{const u=Ri(h);t&&s(new p.SetContentTitleCommand({title:u.title})),r&&s(new p.SetContentSubtitleCommand({subtitle:u.subtitle}))}});return(0,n.jsx)("div",{className:zi,"data-testid":"title-editor",style:{...l.toHtmlTextCss(o),...l.assignTextStyleVars(Fi,i)},children:(0,n.jsx)(Jn,{editor:d,ariaLabel:"Chart title and subtitle"})})},Hi={Title:Bi,Caption:ki,TextAnnotation:Li},Qn=(e,t)=>{const{offsetWidth:r}=e;return r<=0||t<=0?1:t/r},er=e=>Qn(e,e.getBoundingClientRect().width),Bt=(e,t)=>{const{offsetWidth:r,offsetHeight:a}=e;return r<=0||a<=0?t:{width:r,height:a}},_e=e=>e.offset+e.strokeWidth,Ht="http://www.w3.org/2000/svg",Gt=new WeakMap,Gi=(e,t)=>{const r=Vi(e);r.setAttribute("d",t);const{x:a,y:o,width:i,height:s}=r.getBBox();return{x:a,y:o,width:i,height:s}},Vi=e=>{const t=Gt.get(e);if(t?.isConnected)return t;const r=e.createElementNS(Ht,"svg");r.setAttribute("aria-hidden","true"),r.style.cssText="position:absolute;width:0;height:0;overflow:hidden;visibility:hidden;pointer-events:none";const a=e.createElementNS(Ht,"path");return r.append(a),e.body.append(r),Gt.set(e,a),a},$i=(e,t)=>{const{panelRect:r,look:a,readGridLineWidth:o,measurePathBox:i}=t,s=_e(a);switch(e.kind){case"observations":return qe([...e.parts,...e.vertex===null?[]:[e.vertex]].flatMap(c=>Ui(c,i)).map(c=>({...c,x:c.x+r.x,y:c.y+r.y})),s);case"guide":return qe(e.shapes.map(c=>c.kind==="box"?c.rect:l.growRect(qi(c),o(c.axis)/2)),s);case"graph":return qe([{x:0,y:0,...e.frameSize}],-a.offset);default:return e}},Ui=(e,t)=>e.kind==="boxes"?e.boxes:Wi(e.shapes,t),Wi=(e,t)=>{const r=[],a=new Map;for(const o of e){if(o.kind==="dots"){r.push(...o.centers.map(c=>l.growRect({...c,width:0,height:0},o.size/2)));continue}if(o.pathData==="")continue;const i=o.kind==="stroke"?o.width/2:0;if(!o.pathData.trimStart().startsWith("M")){r.push(l.growRect(t(o.pathData),i));continue}const s=a.get(i)??[];s.push(o.pathData),a.set(i,s)}for(const[o,i]of a)r.push(l.growRect(t(i.join("")),o));return r},qi=e=>{switch(e.kind){case"line":return{x:Math.min(e.from.x,e.to.x),y:Math.min(e.from.y,e.to.y),width:Math.abs(e.to.x-e.from.x),height:Math.abs(e.to.y-e.from.y)};case"ring":return{x:e.center.x-e.radius,y:e.center.y-e.radius,width:e.radius*2,height:e.radius*2}}},qe=(e,t)=>{const r=e.filter(({width:a,height:o})=>a>0||o>0);return r.length===0?null:l.growRect((0,p.getBoundingRect)(r),t)};var Ki=(e,{coordSystem:t,panelRect:r})=>{if(e.kind!=="observations")return null;const a=e.vertex===null?e.parts:[...e.parts,e.vertex],o=a.reduce((s,c)=>Math.max(s,c.rows.length),0),i=o===1&&e.vertex===null;return o===0||i||o>1e3?null:a.flatMap(s=>Xi(s,t,r).map(c=>({...c,x:c.x+r.x,y:c.y+r.y})))},Xi=(e,t,r)=>(0,p.measureObservationsBoxes)({layer:{...e.layer,data:e.layer.data.take(e.rows)},coordSystem:t,panelSize:r,radialExtent:"outerEnd"}),Zi=.5,Yi={top:e=>-e.y,right:e=>e.x+e.width,bottom:e=>e.y+e.height,left:e=>-e.x},Ji=(e,t,r)=>e===null||!Qi(e)?{top:et(t),right:tt(t),bottom:et(t),left:tt(t)}:{top:ve(e,t,"top",r),right:ve(e,t,"right",r),bottom:ve(e,t,"bottom",r),left:ve(e,t,"left",r)},ve=(e,t,r,a)=>{const o=Yi[r],i=r==="left"||r==="right",s=f=>i?f.y:f.x,c=f=>i?f.y+f.height:f.x+f.width;let d=-1/0;for(const f of e)d=Math.max(d,o(f));const h=d-Math.max(a,Zi);let u=1/0,m=-1/0;for(const f of e)o(f)<h||(u=Math.min(u,s(f)),m=Math.max(m,c(f)));const g=i?tt(t):et(t),x={from:(0,te.default)(u-a,g.from,g.to),to:(0,te.default)(m+a,g.from,g.to)};return x.from<x.to?x:g},Qi=e=>{const[t]=e;return t!==void 0&&e.some(r=>!l.areRectsEqual(r,t))},et=e=>({from:e.x,to:e.x+e.width}),tt=e=>({from:e.y,to:e.y+e.height}),es=(e,{frameElement:t,panelRect:r,look:a})=>{const o=l.useEditorStore(),i=l.useStyleReaderTree(),s=l.useSceneSelector(m=>m.coordSystem),c=(0,v.useRef)(new Map),d=e?.target??null,h=e?.outline??null;(0,v.useLayoutEffect)(()=>{if(d===null||h===null)return;const m=c.current,g=new Map,f=$i(h,{panelRect:r,look:a,readGridLineWidth:T=>l.readGridLineStyle(i,T).strokeWidth,measurePathBox:T=>{const y=m.get(T)??Gi(t.ownerDocument,T);return g.set(T,y),y}});if(c.current=g,f===null){o.getState().setSelectedOutline(null);return}const b=Ji(Ki(h,{coordSystem:s,panelRect:r}),f,_e(a)),w=er(t);o.getState().setSelectedOutline({target:d,frame:f,frameSpans:b,frameScale:w})},[o,i,s,d,h,t,r,a]);const u=e!==null;(0,v.useLayoutEffect)(()=>u?()=>o.getState().setSelectedOutline(null):void 0,[o,u])},ts="var(--_10d2ycx0)",ns="_10d2ycx1",rs="_10d2ycx2",Vt=({pathData:e,shouldAnimateTransitions:t,source:r,...a})=>t?(0,n.jsx)(as,{pathData:e,source:r,...a}):(0,n.jsx)("path",{d:e,...a}),as=({pathData:e,source:t,...r})=>{const a=l.useSvgPathMorph(e,l.DEFAULT_SPRING_TRANSITION,t);return(0,n.jsx)(Oa.motion.path,{d:a,...r})},os="var(--n5vlnq0)",is="data-edit-outline-stroke",nt=e=>({[is]:"",style:(0,Me.assignInlineVars)({[os]:`${e}px`})});var $t=(e,t)=>{if(e.kind==="observations"&&t.kind==="observations"){if(e.layerId!==t.layerId||e.scope!==t.scope)return!1;const r=e.parts[0]?.rows[0];return r!==void 0&&(t.parts[0]?.rows.includes(r)??!1)}return e.kind==="guide"&&t.kind==="guide"?(0,p.areEditTargetsEqual)(e.target,t.target):e.kind==="graph"&&t.kind==="graph"},ss=(e,t)=>{const r=Math.max(e.width,8),a=Math.max(e.height,8),o=Math.max(0,e.x+e.width/2-r/2),i=Math.max(0,e.y+e.height/2-a/2),s=Math.min(t.width,e.x+e.width/2+r/2),c=Math.min(t.height,e.y+e.height/2+a/2);return{x:o,y:i,width:Math.max(0,s-o),height:Math.max(0,c-i)}},ls=[],cs=e=>{const{layers:t,parsingLocale:r}=l.useSceneSelector((0,Y.useShallow)(m=>({layers:m.layers,parsingLocale:m.config.parsingLocale}))),a=l.useEditorState(m=>m.editTargetUnderPointer),o=a?.kind==="observations"?a.observations:null,i=o===null?void 0:(0,p.findLayerById)(t,o.layerId),s=o?.target.scope??null,c=o===null||i===void 0?null:(0,p.readRowScopeKey)(i,o.target.scope,o.observationIndex),d=(0,v.useMemo)(()=>i===void 0||s===null||c===null?null:ds(t,i,s,c),[t,i,s,c]),h=(0,v.useMemo)(()=>d!==null&&e!==null&&$t(d,e),[d,e]),u=o!==null&&i!==void 0&&us(o,i,r)?o.observationIndex:null;return(0,v.useMemo)(()=>{switch(a?.kind){case"observations":{const m=d?.parts[0];if(d===null||m===void 0)return null;const g=u===null?null:{layer:m.layer,rows:[u]};return h?g===null?null:{...d,parts:ls,vertex:g}:{...d,vertex:g}}case"axis":case"legend":case"grid":{const m={kind:"guide",key:(0,p.readEditTargetKey)(a.target),target:a.target};return e!==null&&$t(m,e)?null:m}default:return null}},[a,d,h,u,e])},ds=(e,t,r,a)=>{const o=[{layer:t,rows:(0,p.readRowsAtScopeKey)(t,r,a)}];for(const i of(0,p.findCompanionLayers)(t,e)){const s=(0,p.readCompanionRowsAtScopeKey)(i,t,r,a);s.length>0&&o.push({layer:i,rows:s})}return{kind:"observations",key:JSON.stringify([t.id,r,a]),layerId:t.id,scope:r,parts:o,vertex:null}},us=({observationIndex:e,target:t,isOnObservation:r},a,o)=>r&&t.scope==="series"&&(0,p.buildObservationsTarget)({layer:a,observationIndex:e,scope:"data-point",parsingLocale:o})!==null,hs=({frameElement:e,target:t,coordType:r,legendDisplays:a})=>{const o=e.getBoundingClientRect(),i=[...e.querySelectorAll(ps(t))],s=c=>{const d=c.getBoundingClientRect();return{x:d.left-o.left,y:d.top-o.top,width:d.width,height:d.height}};switch(t.kind){case"axis":{const c=i.map(s);return r==="polar"||c.length===0?Ke(c):Ke([(0,p.getBoundingRect)(c)])}case"legend":return Ke([...ms(i.filter(c=>!gs(c)))].flatMap(([c,d])=>a[c]==="direct"?d.map(s):[(0,p.getBoundingRect)(d.map(s))]));case"grid":return i.flatMap(c=>{const d=l.readStampedEditTargetInStack([c],e);if(d?.kind!=="grid"||d.target.axis==="both")return[];const{axis:h}=d.target;return t.axis==="both"||h===t.axis?[xs(c,s(c),h)]:[]})}},ps=e=>{const t=`[${l.EDIT_TARGET_KIND_ATTRIBUTE}="${e.kind}"]`;return e.kind!=="axis"?t:`${t}[${l.EDIT_TARGET_AXIS_ATTRIBUTE}="${e.axis}"]`},ms=e=>{const t=new Map;for(const r of e){const a=l.readLegendItemAddress(r);a!==null&&t.set(a.legendIndex,[...t.get(a.legendIndex)??[],r])}return t},gs=e=>e.closest(l.LEGEND_OVERFLOW_CONTROL_SELECTOR)!==null,Ke=e=>e.map(t=>({kind:"box",rect:t})),xs=(e,{x:t,y:r,width:a,height:o},i)=>e.querySelector("circle")!==null?{kind:"ring",axis:i,center:{x:t+a/2,y:r+o/2},radius:a/2}:a<1||o<1?a<o?{kind:"line",axis:i,from:{x:t+a/2,y:r},to:{x:t+a/2,y:r+o}}:{kind:"line",axis:i,from:{x:t,y:r+o/2},to:{x:t+a,y:r+o/2}}:vs(e.querySelector("line"))?{kind:"line",axis:i,from:{x:t,y:r},to:{x:t+a,y:r+o}}:{kind:"line",axis:i,from:{x:t,y:r+o},to:{x:t+a,y:r}},vs=e=>{const t=r=>Number(e?.getAttribute(r)??0);return(t("x2")-t("x1"))*(t("y2")-t("y1"))>=0},fs=[],bs=(e,{frameElement:t,frameSize:r,panelRect:a,shouldAnimateTransitions:o})=>{const i=l.useSceneSelector(b=>b.coordSystem),s=l.useGeomRendererResolver(),c=l.useGeomReaderTree(),d=ys(e.kind==="guide"?e.target:null,{frameElement:t,frameSize:r}),h=Ss(t,r),u=(0,v.useMemo)(()=>({coordSystem:i,panelRect:a,resolveRenderer:s,geomReaders:c}),[i,a,s,c]),m=e.kind==="observations"?e.parts:null,g=e.kind==="observations"?e.vertex:null,x=(0,v.useMemo)(()=>m?.map(b=>Ut(b,u,o))??fs,[m,u,o]),f=(0,v.useMemo)(()=>g===null?null:Ut(g,u,!1),[g,u]);return(0,v.useMemo)(()=>{switch(e.kind){case"observations":return{kind:"observations",parts:x,vertex:f};case"guide":return{kind:"guide",target:e.target,shapes:d};case"graph":return{kind:"graph",frameSize:h}}},[e,x,f,d,h])},Ss=(e,t)=>{const[r,a]=(0,v.useState)(()=>Bt(e,t));return(0,v.useLayoutEffect)(()=>{a(o=>{const i=Bt(e,{width:t.width,height:t.height});return o.width===i.width&&o.height===i.height?o:i})},[e,t.width,t.height]),r},Ut=({layer:e,rows:t},{coordSystem:r,panelRect:a,resolveRenderer:o,geomReaders:i},s)=>{const c={...e,data:e.data.take(t)},d=o(e.geom,r.type);return d?.getEditOutlineShapes===void 0?{kind:"boxes",layer:e,rows:t,boxes:(0,p.measureObservationsBoxes)({layer:c,coordSystem:r,panelSize:a}).map(h=>ss(h,a))}:{kind:"declared",layer:e,rows:t,shapes:d.getEditOutlineShapes({layer:c,sourceLayer:e,coordSystem:r,panelRect:a,styleReaders:i(e),shouldAnimateTransitions:s})}},ys=(e,{frameElement:t,frameSize:r})=>{const a=l.useSceneSelector(u=>u.coordSystem.type),o=l.useSceneSelector((0,Y.useShallow)(u=>u.guides.legends.drawn.map(m=>m.display))),i=l.useSceneSelector(u=>e===null?null:u),[s,c]=(0,v.useState)([]),d=l.useLatestRef(e),h=(0,v.useRef)(!1);return(0,v.useLayoutEffect)(()=>{const u=d.current;if(u===null)return;const m=()=>{const g=hs({frameElement:t,target:u,coordType:a,legendDisplays:o}),x=er(t);c(g.map(f=>Cs(f,1/x)))};if(h.current){const g=requestAnimationFrame(m);return()=>cancelAnimationFrame(g)}h.current=!0,m()},[t,d,a,o,i,r.width,r.height]),s},Cs=(e,t)=>{switch(e.kind){case"box":{const{x:r,y:a,width:o,height:i}=e.rect;return{kind:"box",rect:{x:r*t,y:a*t,width:o*t,height:i*t}}}case"line":return{...e,from:{x:e.from.x*t,y:e.from.y*t},to:{x:e.to.x*t,y:e.to.y*t}};case"ring":return{...e,center:{x:e.center.x*t,y:e.center.y*t},radius:e.radius*t}}},js=()=>{const e=l.useGraphSelection()[0]??null,{layers:t,parsingLocale:r}=l.useSceneSelector((0,Y.useShallow)(a=>({layers:a.layers,parsingLocale:a.config.parsingLocale})));return(0,v.useMemo)(()=>e===null?null:ws(e,t,r),[e,t,r])},ws=(e,t,r)=>{switch(e.kind){case"observations":{const a=Ts(e,t,r);return a===null?null:{outlined:a,target:e}}case"legend":case"axis":case"grid":return{outlined:{kind:"guide",key:(0,p.readEditTargetKey)(e),target:e},target:e};case"graph":return{outlined:{kind:"graph",key:"graph"},target:e};default:return null}},Ts=(e,t,r)=>{const a=(0,p.findLayerById)(t,e.layerId);if(a===void 0)return null;const o=(0,p.resolveObservationsTarget)({layer:a,target:e,parsingLocale:r});if(o.length===0)return null;const i=[{layer:a,rows:o}];for(const s of(0,p.findCompanionLayers)(a,t)){const c=(0,p.resolveObservationsTarget)({layer:s,host:a,target:e,parsingLocale:r});c.length>0&&i.push({layer:s,rows:c})}return{kind:"observations",key:(0,p.readEditTargetKey)(e),layerId:e.layerId,scope:e.scope,parts:i,vertex:null}},As=["x","y"],ks=(0,v.memo)(function({frameElement:t,frameSize:r,panelRect:a,shouldAnimateTransitions:o}){const i=l.useResolvedStyle(p.resolveEditOutlineStyle,l.useStyleReaderTree()),s=js(),c=cs(s?.outlined??null);if(s===null&&c===null)return null;const d={frameElement:t,frameSize:r,panelRect:a,shouldAnimateTransitions:o};return(0,n.jsxs)("svg",{className:ns,width:r.width,height:r.height,"aria-hidden":!0,"data-testid":"edit-outline",children:[c!==null&&(0,n.jsx)(Wt,{part:"hover",target:c,look:i.hover,...d},c.key),s!==null&&(0,n.jsx)(Wt,{part:"selected",target:s.outlined,editTarget:s.target,look:i.selected,...d},s.outlined.key)]})}),Wt=({part:e,target:t,editTarget:r,look:a,frameSize:o,panelRect:i,frameElement:s,shouldAnimateTransitions:c})=>{const d=(0,v.useId)(),h=`${d}-shapes`,u=`${d}-hole`,m=bs(t,{frameElement:s,frameSize:o,panelRect:i,shouldAnimateTransitions:c});return es(r===void 0?null:{target:r,outline:m},{frameElement:s,panelRect:i,look:a}),(0,n.jsxs)("g",{"data-edit-outline":e,"data-testid":`edit-outline-${e}`,children:[(0,n.jsxs)("defs",{children:[(0,n.jsx)("g",{id:h,className:rs,children:(0,n.jsx)(Ls,{outline:m,look:a,panelRect:i})}),(0,n.jsxs)("mask",{id:u,maskUnits:"userSpaceOnUse",x:"-100%",y:"-100%",width:"300%",height:"300%",children:[(0,n.jsx)("rect",{x:"-100%",y:"-100%",width:"300%",height:"300%",fill:"white"}),(0,n.jsx)("use",{href:`#${h}`,style:qt("black",a.offset)})]})]}),(0,n.jsx)("use",{href:`#${h}`,mask:`url(#${u})`,style:qt(a.stroke,_e(a)),"data-testid":`edit-outline-${e}-ring`}),t.kind==="observations"&&(0,n.jsx)(Os,{target:t,look:a,panelRect:i})]})},qt=(e,t)=>({fill:e,stroke:e,...(0,Me.assignInlineVars)({[ts]:`${2*t}px`})}),Ps=(e,t,r)=>{const a=r.offset+_e(r);return l.buildRoundedRectPath(l.growRect({x:0,y:0,...e},-a),Math.max(0,t-a))},Ls=({outline:e,look:t,panelRect:r})=>{const a=l.useStyleReaderTree().graph().get("cornerRadius"),{cornerRadius:o}=t;switch(e.kind){case"observations":return(0,n.jsxs)("g",{transform:`translate(${r.x} ${r.y})`,children:[e.parts.map(i=>(0,n.jsx)(Kt,{part:i,borderRadius:o},i.layer.id)),e.vertex!==null&&(0,n.jsx)(Kt,{part:e.vertex,borderRadius:o},`vertex-${e.vertex.rows.join()}`)]});case"guide":return(0,n.jsx)(Ms,{target:e.target,shapes:e.shapes,borderRadius:o});case"graph":return(0,n.jsx)("path",{d:Ps(e.frameSize,a,t)})}},Kt=(0,v.memo)(function({part:t,borderRadius:r}){return t.kind==="boxes"?(0,n.jsx)(Es,{boxes:t.boxes,borderRadius:r}):(0,n.jsx)(Is,{shapes:t.shapes,layer:t.layer})}),Is=({shapes:e,layer:t})=>e.map((r,a)=>{const o=r.kind==="dots"||r.key===void 0?String(a):`${r.kind}:${r.key}`;switch(r.kind){case"region":return r.pathData===""?null:(0,n.jsx)(Vt,{pathData:r.pathData,fillRule:r.fillRule,shouldAnimateTransitions:r.shouldAnimateTransitions??!1,source:t,"data-geom":t.geom},o);case"stroke":return r.pathData===""?null:(0,n.jsx)(Vt,{pathData:r.pathData,shouldAnimateTransitions:r.shouldAnimateTransitions??!1,source:t,"data-geom":t.geom,...nt(r.width)},o);case"dots":return r.centers.length===0?null:(0,n.jsx)("path",{d:l.buildDotsPath(r.centers),"data-geom":t.geom,...nt(r.size)},o)}}),Es=({boxes:e,borderRadius:t})=>{const r=e.map(a=>l.buildRoundedRectPath(a,t)).join("");return r===""?null:(0,n.jsx)("path",{d:r,"data-testid":"edit-outline-boxes"})},Ms=({target:e,shapes:t,borderRadius:r})=>{const a=l.useStyleReaderTree();if(e.kind==="grid")return As.map(i=>{const s=t.map(c=>Rs(c,i)).join("");return s===""?null:(0,n.jsx)("path",{d:s,...nt(l.readGridLineStyle(a,i).strokeWidth)},i)});const o=t.map(i=>i.kind==="box"?l.buildRoundedRectPath(i.rect,r):"").join("");return o===""?null:(0,n.jsx)("path",{d:o})},Rs=(e,t)=>{if(e.kind==="box"||e.axis!==t)return"";switch(e.kind){case"line":return`M${e.from.x},${e.from.y}L${e.to.x},${e.to.y}`;case"ring":{const{center:r,radius:a}=e,o=`${r.x},${r.y-a}`;return`M${o}A${a},${a} 0 0 1 ${`${r.x},${r.y+a}`}A${a},${a} 0 0 1 ${o}`}}},Os=({target:e,look:t,panelRect:r})=>{const a=l.useSceneSelector(s=>s.coordSystem),o=e.parts[0];if(e.scope!=="x-value"||o===void 0||o.layer.highlight?.strategy!=="overlay-anchor")return null;const i=_s(o);return i===null?null:(0,n.jsx)("svg",{x:r.x,y:r.y,width:r.width,height:r.height,overflow:"visible",children:(0,n.jsx)("line",{...l.readCrosshairLine(a,i,r),stroke:t.stroke,strokeWidth:t.strokeWidth,strokeDasharray:"4 3",strokeLinecap:"round","data-testid":"edit-outline-band-guide"})})},_s=({layer:e,rows:t})=>{for(const r of t){const a=e.data.getAt(r),o=a===null?null:(0,p.getX)(a),i=a===null?null:(0,p.getY)(a);if(o!==null&&i!==null)return{x:o,y:i}}return null},Ns="data-graphy-chart-chrome",Ds="data-graphy-chart-menu",xt={[Ds]:""},Ne=e=>({[Ns]:e}),je=(e,t)=>e instanceof Element&&e.closest(`[data-graphy-chart-chrome="${CSS.escape(t)}"]`)!==null,tr=e=>e instanceof Element&&e.closest("[data-graphy-chart-menu]")!==null,rt=e=>e instanceof Element&&e.closest("[data-graphy-chart-chrome]")!==null,nr=(e,t,r)=>r!==null&&(0,p.isPointWithinEditMenuTrigger)({x:e.clientX-t.x,y:e.clientY-t.y},r),he=(e,t,r)=>e instanceof Node&&(t.contains(e)||je(e,r)),Fs="cml7ha0",rr=(0,v.createContext)(null),zs=({children:e})=>{const{chartId:t}=l.useGraphContext(),[r]=(0,v.useState)(l.resolvePortalContainer),[a,o]=(0,v.useState)(null);return r===null?null:(0,n.jsxs)(n.Fragment,{children:[(0,Pn.createPortal)((0,n.jsx)("div",{ref:o,className:Fs,...Ne(t)}),r),(0,n.jsx)(rr.Provider,{value:a,children:e})]})},De=()=>(0,v.useContext)(rr),Bs="kwvn4c0",Hs="kwvn4c1",ar=(e,t)=>({contextElement:e,getBoundingClientRect:()=>{const r=e.getBoundingClientRect(),a=Qn(e,r.width);return new DOMRect(r.left+t.x*a,r.top+t.y*a,t.width*a,t.height*a)}}),Gs=({side:e,boundary:t,spans:r,anchor:a,isRightToLeft:o})=>{if(!Vs(e))return 0;const i=r[e];if(e==="left"||e==="right")return Xt(i.from-t.y,a.height,t.height);const s=o?t.x+t.width-i.to:i.from-t.x;return Xt(s,a.width,t.width)},or=()=>{const[e,t]=(0,v.useState)(!1);return(0,v.useEffect)(()=>{t(!0)},[]),e},Vs=e=>l.SIDE_KEYS.some(t=>t===e),Xt=(e,t,r)=>r===0?0:e*t/r,$s={x:8,y:8},Us={side:"flip",align:"shift",fallbackAxisSide:"end"},Ws=({frameElement:e,boundary:t,spans:r,clearance:a=$s,onEscape:o,children:i})=>{const s=De(),c=or(),[d,h]=(0,v.useState)(null),u=(0,v.useRef)(null);(0,v.useLayoutEffect)(()=>()=>{d?.contains(document.activeElement)&&e.focus({preventScroll:!0})},[d,e]);const{x:m,y:g,width:x,height:f}=t,b=(0,v.useMemo)(()=>({box:{x:m,y:g,width:x,height:f},spans:r}),[m,g,x,f,r]),w=(0,v.useMemo)(()=>ar(e,b.box),[e,b]),T=(y,k)=>{y||(k.cancel(),k.reason==="escape-key"&&o())};return(0,n.jsx)(H.Popover.Root,{open:c,modal:!1,onOpenChange:T,children:(0,n.jsx)(H.Popover.Portal,{container:s,children:(0,n.jsx)(l.PortalThemeProvider,{children:(0,n.jsx)(H.Popover.Positioner,{ref:u,anchor:w,side:"right",align:"start",sideOffset:({side:y})=>y==="top"||y==="bottom"?a.y:a.x,alignOffset:({side:y,anchor:k})=>Gs({side:y,boundary:b.box,spans:b.spans,anchor:k,isRightToLeft:qs(u.current)}),collisionAvoidance:Us,sticky:!0,className:Bs,...xt,children:(0,n.jsx)(H.Popover.Popup,{ref:h,className:Hs,finalFocus:!1,"data-testid":"anchored-popover",children:i})})})})})},qs=e=>e!==null&&getComputedStyle(e).direction==="rtl",Ks=(e,t)=>{const r=(0,p.findLayerById)(t.layers,e);if(r===void 0)return null;const{geom:a,position:o}=Zs(r,t.layers)??r;return{geom:a,coord:t.spec.coords.coordType,position:o}},ue=(e,t)=>{for(const r of e){const a=t(r);if(a!==void 0)return a}return null},Xs=({geom:e,coord:t,position:r},a)=>ue(a,o=>{const i=Zt(o.layers,e)?.[t]?.[r];return i!==void 0?i:Zt(o.geoms,e)}),Zs=(e,t)=>t.find(r=>r.interactive&&(0,p.isCompanionLayer)(e,[r])),Zt=(e,t)=>e!==void 0&&Object.hasOwn(e,t)?e[t]:void 0,Ys=e=>{const t=(0,v.useContext)(Qs),r=e?.kind==="observations"?e.layerId:null,a=l.useSceneSelector((0,Y.useShallow)(o=>r===null?null:Ks(r,o)));if(e===null)return null;switch(e.kind){case"observations":{const o=a===null?null:Xs(a,t);return o===null?null:(0,n.jsx)(o,{target:e})}case"legend":{const o=ue(t,i=>i.legend);return o===null?null:(0,n.jsx)(o,{target:e})}case"axis":{const o=ue(t,i=>i.axis);return o===null?null:(0,n.jsx)(o,{target:e})}case"grid":{const o=ue(t,i=>i.grid);return o===null?null:(0,n.jsx)(o,{target:e})}case"graph":{const o=ue(t,i=>i.graph);return o===null?null:(0,n.jsx)(o,{target:e})}default:return e}},X=()=>null,Js={geoms:{point:X,line:X,area:X,bar:X,rule:X,tile:X},legend:X,axis:X,grid:X,graph:X},Qs=(0,v.createContext)([Js]),el="_1xgvyvc0",tl=(e,t)=>{switch(e.kind){case"observations":return nl(e.scope,t);case"legend":case"axis":case"grid":return rl(e.kind,t);case"graph":return t("editor.overlayMenu.chart");default:return e}},nl=(e,t)=>{switch(e){case"data-point":return t("editor.overlayMenu.observation");case"series":return t("editor.overlayMenu.group");case"x-value":return t("editor.overlayMenu.band");default:return e}},rl=(e,t)=>{switch(e){case"axis":return t("editor.overlayMenu.axis");case"legend":return t("editor.overlayMenu.legend");case"grid":return t("editor.overlayMenu.gridLines");default:return e}},al=({frameElement:e})=>{const t=l.useI18n(),{selectionStore:r}=l.useGraphContext(),a=l.useEditorState(s=>s.selectedOutline),o=Ys(a?.target??null);if(a===null||o===null)return null;const i=()=>{r.getState().clearSelection()};return(0,n.jsxs)(Ws,{frameElement:e,boundary:a.frame,spans:a.frameSpans,onEscape:i,children:[(0,n.jsx)(H.Popover.Title,{className:el,"data-testid":"overlay-menu-title",children:tl(a.target,t)}),(0,n.jsx)(v.Fragment,{children:o},(0,p.readEditTargetKey)(a.target))]})},ol=({frameRect:e})=>{const{targetBoundaryStore:t}=l.useGraphContext(),r=l.useEditorState(s=>s.selectedOutline),{left:a,top:o}=e,i=(0,v.useMemo)(()=>{if(r===null)return null;const{frame:s,frameSpans:c,frameScale:d}=r;return{frame:s,client:{x:a+s.x*d,y:o+s.y*d,width:s.width*d,height:s.height*d},frameSpans:c,clientSpans:{top:fe(c.top,a,d),right:fe(c.right,o,d),bottom:fe(c.bottom,a,d),left:fe(c.left,o,d)}}},[r,a,o]);return(0,v.useLayoutEffect)(()=>{t.getState().setBoundary(i)},[t,i]),(0,v.useLayoutEffect)(()=>()=>t.getState().setBoundary(null),[t]),null},fe=(e,t,r)=>({from:t+e.from*r,to:t+e.to*r}),ir=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("path",{fill:"currentColor",fillOpacity:".8",d:"M2.333 3h11.334v8.667c-2 0-4 .333-5.667 2.333-2-2-3.667-2.333-5.667-2.333z",opacity:".12"}),(0,n.jsx)("path",{fill:"currentColor",fillOpacity:".8",fillRule:"evenodd",d:"M3.325 3.156a.836.836 0 0 0-.836.836v6.832c0 .462.375.836.836.836h2.131a.5.5 0 0 1 .352.145L8 13.975l2.193-2.17a.5.5 0 0 1 .352-.145h2.13a.84.84 0 0 0 .836-.836V3.992a.84.84 0 0 0-.836-.836zm-1.836.836c0-1.014.822-1.836 1.836-1.836h9.35c1.015 0 1.836.825 1.836 1.836v6.832a1.84 1.84 0 0 1-1.836 1.836H10.75l-2.398 2.374a.5.5 0 0 1-.704 0L5.25 12.66H3.325a1.836 1.836 0 0 1-1.836-1.836z",clipRule:"evenodd"}),(0,n.jsx)("path",{fill:"currentColor",fillOpacity:".8",fillRule:"evenodd",d:"M8 4.505a.5.5 0 0 1 .5.5v2.172h2.171a.5.5 0 0 1 0 1H8.5v2.171a.5.5 0 0 1-1 0V8.177H5.329a.5.5 0 0 1 0-1H7.5V5.005a.5.5 0 0 1 .5-.5",clipRule:"evenodd"})]});var sr="efjmb40",lr="efjmb41",re="efjmb42",ae="efjmb43",il="efjmb44",sl="efjmb45",ll=new Set(["item-press","escape-key","outside-press","close-press","sibling-open","trigger-press"]),vt=({label:e,icon:t,onOpened:r,children:a})=>{const o=De(),[i,s]=(0,v.useState)(!1),c=(d,h)=>{d?(s(!0),r?.()):ll.has(h.reason)&&s(!1)};return(0,n.jsxs)(ee.Menu.SubmenuRoot,{open:i,onOpenChange:c,children:[(0,n.jsx)(cl,{label:e,icon:t}),(0,n.jsx)(ee.Menu.Portal,{container:o,children:(0,n.jsx)(l.PortalThemeProvider,{children:(0,n.jsx)(ee.Menu.Positioner,{side:"right",align:"start",sideOffset:4,className:sr,...xt,children:(0,n.jsx)(ee.Menu.Popup,{className:lr,children:a})})})})]})},cl=({label:e,icon:t})=>(0,n.jsxs)(ee.Menu.SubmenuTrigger,{className:re,openOnHover:!1,children:[t,(0,n.jsx)("span",{className:ae,children:e}),(0,n.jsx)("span",{className:sl,children:(0,n.jsx)(pe,{size:"sm"})})]}),dl="_1qe7q450",ul="_1qe7q451",hl="_1qe7q452",pl=({label:e,placeholder:t,addLabel:r,at:a,onRequestClose:o})=>{const i=(0,v.useRef)(null),[s,c]=(0,v.useState)(""),{dispatch:d}=l.useGraphCommands(),h=s.trim(),u=()=>{h.length!==0&&(d(new p.AddAnnotationCommand({kind:"comment",annotation:{at:a,content:ml(h)}})),o())},m=f=>{f.key==="Enter"&&(f.preventDefault(),u()),f.key!=="Escape"&&f.stopPropagation()},g=f=>{c(f.target.value)},x=()=>{requestAnimationFrame(()=>i.current?.focus())};return(0,n.jsx)(vt,{label:e,icon:(0,n.jsx)(ir,{}),onOpened:x,children:(0,n.jsxs)("div",{className:dl,children:[(0,n.jsx)("input",{ref:i,className:ul,value:s,placeholder:t,onChange:g,onKeyDown:m}),(0,n.jsx)("button",{type:"button",className:hl,disabled:h.length===0,onClick:u,children:r})]})})},ml=e=>({type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e}]}]}),gl=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 15 14",...e,children:(0,n.jsx)("path",{d:"M14.0146 5.20703C14.2118 5.40459 14.2121 5.72447 14.0146 5.92187L12.3291 7.6084C12.2343 7.70313 12.1047 7.75579 11.9707 7.75586C11.8369 7.75573 11.708 7.70291 11.6133 7.6084L9.92773 5.92187C9.73024 5.72438 9.73031 5.40457 9.92773 5.20703C10.1253 5.0095 10.445 5.0095 10.6426 5.20703L11.4658 6.03027L11.4658 1.68652L7.75586 1.68652L7.75586 12.6455C7.75563 12.9246 7.5291 13.1512 7.25 13.1514L2.5293 13.1514C2.2501 13.1514 2.02367 12.9247 2.02344 12.6455L2.02344 5.00781C0.868958 4.77348 0.000106647 3.7528 -1.10559e-07 2.5293C-4.95071e-08 1.13259 1.13261 9.74645e-05 2.5293 -5.23256e-07C3.92588 0.000220668 5.05859 1.13267 5.05859 2.5293C5.05849 3.75251 4.1892 4.77219 3.03516 5.00684L3.03516 12.1396L6.74414 12.1396L6.74414 1.18066C6.74414 0.901394 6.97076 0.674939 7.25 0.674804L11.9707 0.674805C12.2499 0.674939 12.4766 0.901394 12.4766 1.18066L12.4766 6.03027L13.2998 5.20703C13.4973 5.0095 13.8171 5.0095 14.0146 5.20703ZM4.04687 2.5293C4.04687 1.69137 3.36717 1.01194 2.5293 1.01172C1.69132 1.01182 1.01172 1.6913 1.01172 2.5293C1.01184 3.36719 1.6914 4.04678 2.5293 4.04687C3.36709 4.04665 4.04675 3.36712 4.04687 2.5293ZM14.5 11.2969C14.4998 12.6935 13.3673 13.8262 11.9707 13.8262C10.5742 13.826 9.4416 12.6934 9.44141 11.2969C9.44141 9.90018 10.574 8.7677 11.9707 8.76758C13.3675 8.76758 14.5 9.90011 14.5 11.2969ZM13.4883 11.2969C13.4883 10.4588 12.8088 9.7793 11.9707 9.7793C11.1327 9.77942 10.4531 10.4589 10.4531 11.2969C10.4533 12.1347 11.1329 12.8143 11.9707 12.8145C12.8086 12.8145 13.4881 12.1348 13.4883 11.2969Z",fill:"currentColor",fillOpacity:"0.8"})}),xl="relative-difference",vl=({label:e,layer:t,at:r,onRequestClose:a})=>{const{dispatch:o}=l.useGraphCommands(),i=l.useSceneSelector(d=>d.coordSystem),s=(0,v.useMemo)(()=>(0,p.inferDifferenceArrowEndpoints)({layer:t,at:r,coordSystem:i}),[t,r,i]);if(s===null)return null;const c=()=>{o(new p.AddAnnotationCommand({kind:"differenceArrow",annotation:{...p.DIFFERENCE_ARROW_DEFAULTS,...s,label:xl}})),a()};return(0,n.jsxs)(_.Menu.Item,{className:re,onClick:c,children:[(0,n.jsx)(gl,{}),(0,n.jsx)("span",{className:ae,children:e})]})};function fl(e,t){if(e.type==="polar"&&!bl(t))return[{scope:"series",labelKey:"pieSlice"}];const r=(0,p.hasMultipleGroups)(t.data,t.mapping);switch(t.geom){case"bar":{const a=[{scope:"data-point",labelKey:"bar"}];if(r){const o=t.position==="stack"||t.position==="fill";a.push({scope:"x-value",labelKey:o?"barStack":"barGroup"}),a.push({scope:"series",labelKey:"barSeries"})}return a}case"line":case"area":{const a=[{scope:"data-point",labelKey:"linePoint"}];return r&&a.push({scope:"series",labelKey:"lineSeries"}),a}case"point":{const a=[{scope:"data-point",labelKey:"scatterPoint"}];return r&&a.push({scope:"series",labelKey:"scatterSeries"}),a}default:return[]}}var bl=e=>{const t=(0,p.readVariableName)(e.mapping.x);return t!==null&&t!==p.CONSTANT_VARIABLES.x},Sl=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("rect",{width:"3.2",height:"7.704",y:"8.296",fill:"currentColor",fillOpacity:"0.3",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"4.741",x:"8.533",y:"11.259",fill:"currentColor",fillOpacity:"0.3",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"11.259",x:"4.267",y:"4.741",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"16",x:"12.8",fill:"currentColor",fillOpacity:"0.3",rx:".533"})]}),yl=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("rect",{width:"3.2",height:"7.704",y:"8.296",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"4.741",x:"8.533",y:"11.259",fill:"currentColor",fillOpacity:"0.3",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"11.259",x:"4.267",y:"4.741",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"16",x:"12.8",fill:"currentColor",fillOpacity:"0.3",rx:".533"})]}),Cl=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("rect",{width:"3.2",height:"7.704",y:"8.296",fill:"currentColor",fillOpacity:"0.3",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"4.741",x:"8.533",y:"11.259",fill:"currentColor",fillOpacity:"0.3",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"11.259",x:"4.267",y:"4.741",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"16",x:"12.8",fill:"currentColor",fillOpacity:".8",rx:".533"})]}),jl=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.3",d:"M0 13.037h4.267v2.445a.52.52 0 0 1-.519.518H.518A.52.52 0 0 1 0 15.482zM0 7.037c0-.286.232-.518.519-.518h3.23c.286 0 .518.232.518.518v5.408H0z"}),(0,n.jsx)("path",{fill:"currentColor",fillOpacity:".8",d:"M5.867 7.704h4.266v7.778a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.518-.518zM5.867 7.111h4.266V4.074a.52.52 0 0 0-.518-.518h-3.23a.52.52 0 0 0-.518.518z"}),(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.3",d:"M11.733 10.074H16v5.408a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.519-.518zM11.733 9.481H16V.52A.52.52 0 0 0 15.482 0h-3.23a.52.52 0 0 0-.519.519z"})]}),wl=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:".8",strokeWidth:"1.163",d:"m-1.618 15.96 9.118-5.3 11 2.34"}),(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.6",stroke:"currentColor",strokeOpacity:"0.3",d:"M8 13a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z"}),(0,n.jsx)("rect",{width:"9.795",height:"6",x:"3",y:"2",fill:"currentColor",fillOpacity:"0.3",rx:"1.513"}),(0,n.jsx)("path",{fill:"currentColor",fillOpacity:".8",d:"M5.29 6.62a1.3 1.3 0 0 1-.424-.075 1 1 0 0 1-.373-.244 1.2 1.2 0 0 1-.262-.45 2.1 2.1 0 0 1-.096-.699q0-.389.082-.693.083-.304.238-.514a1.05 1.05 0 0 1 .374-.322q.22-.11.492-.11.285 0 .505.112a.973.973 0 0 1 .526.744h-.54a.5.5 0 0 0-.17-.277.5.5 0 0 0-.321-.105.54.54 0 0 0-.485.273q-.168.273-.17.75h.021a.8.8 0 0 1 .188-.223.92.92 0 0 1 .569-.195.91.91 0 0 1 .813.477q.125.222.123.509 0 .297-.136.536a1 1 0 0 1-.383.372 1.15 1.15 0 0 1-.571.134m-.003-.443a.54.54 0 0 0 .288-.078.57.57 0 0 0 .2-.211.6.6 0 0 0 .073-.299.6.6 0 0 0-.07-.294.54.54 0 0 0-.484-.285.55.55 0 0 0-.403.173.596.596 0 0 0 .108.914.53.53 0 0 0 .288.08M6.88 6.579v-.396l1.05-1.03q.15-.15.25-.27a1 1 0 0 0 .151-.229.6.6 0 0 0 .05-.236.432.432 0 0 0-.244-.405.6.6 0 0 0-.258-.056q-.15 0-.261.062a.43.43 0 0 0-.175.173.56.56 0 0 0-.06.267H6.86q0-.288.132-.5a.9.9 0 0 1 .362-.33q.231-.117.532-.117.303 0 .534.114.23.114.358.312a.8.8 0 0 1 .128.452.9.9 0 0 1-.065.334q-.065.164-.229.363-.162.2-.456.483l-.522.53v.021h1.318v.458zM10.57 6.62a1.3 1.3 0 0 1-.423-.075 1 1 0 0 1-.373-.244 1.2 1.2 0 0 1-.263-.45 2.1 2.1 0 0 1-.096-.699q0-.389.083-.693t.238-.514a1.05 1.05 0 0 1 .374-.322q.219-.11.492-.11.285 0 .505.112a.973.973 0 0 1 .526.744h-.54a.5.5 0 0 0-.17-.277.5.5 0 0 0-.322-.105.54.54 0 0 0-.484.273q-.168.273-.17.75h.02a.8.8 0 0 1 .188-.223.92.92 0 0 1 .569-.195.91.91 0 0 1 .814.477q.125.222.123.509 0 .297-.136.536a1 1 0 0 1-.383.372 1.15 1.15 0 0 1-.572.134m-.002-.443a.54.54 0 0 0 .288-.078.57.57 0 0 0 .2-.211.6.6 0 0 0 .073-.299.6.6 0 0 0-.071-.294.54.54 0 0 0-.483-.285.54.54 0 0 0-.403.173.597.597 0 0 0 .107.914.53.53 0 0 0 .289.08"})]}),Tl=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("path",{stroke:"currentColor",strokeOpacity:"0.8",strokeLinecap:"round",strokeLinejoin:"bevel",strokeWidth:".993",d:"M1.5 12 6 6.5l4 3.5 4-5.5"}),(0,n.jsx)("circle",{cx:"1.493",cy:"11.993",r:".993",fill:"currentColor",fillOpacity:"0.8"}),(0,n.jsx)("circle",{cx:"5.993",cy:"6.493",r:".993",fill:"currentColor",fillOpacity:"0.8"}),(0,n.jsx)("circle",{cx:"9.993",cy:"9.993",r:".993",fill:"currentColor",fillOpacity:"0.8"}),(0,n.jsx)("circle",{cx:"13.993",cy:"4.493",r:".993",fill:"currentColor",fillOpacity:"0.8"})]}),Al=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("rect",{width:"16",height:"16",fill:"currentColor",fillOpacity:"0.3",rx:"8"}),(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.8",d:"m7.999 16 .412-.01A8 8 0 0 0 8 0z"}),(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.6",d:"M15.999 8a8 8 0 0 1-7.588 7.989l-.412.01V8z"})]}),kl=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 3.598 7.215)"}),(0,n.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 6.681 11.327)"}),(0,n.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 9.251 7.215)"}),(0,n.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:".8",rx:"1.028",transform:"matrix(-1 0 0 1 10.28 2.59)"}),(0,n.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 13.877 6.187)"}),(0,n.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 2.056 12.869)"}),(0,n.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 15.933 .533)"})]}),Pl=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:".8",rx:"1.028",transform:"matrix(-1 0 0 1 3.598 7.215)"}),(0,n.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:".8",rx:"1.028",transform:"matrix(-1 0 0 1 6.681 11.327)"}),(0,n.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 9.251 7.215)"}),(0,n.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:".8",rx:"1.028",transform:"matrix(-1 0 0 1 10.28 2.59)"}),(0,n.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 13.877 6.187)"}),(0,n.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 2.056 12.869)"}),(0,n.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 15.933 .533)"})]}),Ll={bar:Sl,barGroup:yl,barStack:jl,barSeries:Cl,linePoint:wl,lineSeries:Tl,scatterPoint:kl,scatterSeries:Pl,pieSlice:Al},cr=({labelKey:e})=>{const t=Ll[e];return(0,n.jsx)(t,{})},dr=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("path",{opacity:"0.12",d:"M15 4.66667L12.3333 2L2.33334 12L5.00001 14.6667L15 4.66667Z",fill:"currentColor",fillOpacity:"0.8"}),(0,n.jsx)("path",{d:"M5.01683 15.3331C4.84407 15.3343 4.67292 15.2997 4.51421 15.2314C4.3555 15.1632 4.21268 15.0627 4.09476 14.9365L3.88656 14.7283L3.62877 14.8968L3.19253 15.3331H0L2.24072 13.0923L2.03251 12.8445C1.89423 12.7191 1.78392 12.566 1.70875 12.3952C1.63359 12.2244 1.59526 12.0396 1.59626 11.853C1.59579 11.6818 1.63078 11.5124 1.69904 11.3554C1.76729 11.1984 1.86733 11.0573 1.99285 10.9409L11.2036 1.73012C11.3215 1.60384 11.4643 1.5034 11.623 1.43514C11.7817 1.36688 11.9529 1.33228 12.1257 1.33353C12.2969 1.33245 12.4665 1.36716 12.6236 1.43546C12.7807 1.50375 12.9218 1.60412 13.0378 1.73012L15.1496 3.92126C15.2748 4.03899 15.3745 4.1811 15.4427 4.33882C15.5108 4.49654 15.546 4.66655 15.546 4.83837C15.546 5.01019 15.5108 5.1802 15.4427 5.33792C15.3745 5.49564 15.2748 5.63774 15.1496 5.75548L5.93889 14.9662C5.81806 15.0866 5.67403 15.1812 5.51552 15.2443C5.35702 15.3074 5.18736 15.3376 5.01683 15.3331ZM2.48858 11.9125L5.01683 14.4407L9.47843 9.97913L6.95019 7.4608L2.48858 11.9125ZM7.68388 6.72712L10.2022 9.24544L14.644 4.80367L12.1257 2.28534L7.68388 6.72712Z",fill:"currentColor",fillOpacity:"0.8"})]}),Il=({label:e,options:t,onSelect:r})=>{const a=l.useI18n();return(0,n.jsx)(vt,{label:e,icon:(0,n.jsx)(dr,{}),children:t.map(o=>(0,n.jsxs)(ee.Menu.Item,{className:re,onClick:()=>r(o.scope),children:[(0,n.jsx)(cr,{labelKey:o.labelKey}),(0,n.jsx)("span",{className:ae,children:a(`graph.annotations.highlights.labels.${o.labelKey}`)})]},o.scope))})},El=({label:e,layer:t,observation:r,highlights:a,onRequestClose:o})=>{const i=l.useI18n(),{dispatch:s}=l.useGraphCommands(),c=l.useSceneSelector(x=>x.coordSystem),d=(0,v.useMemo)(()=>(0,p.buildObservationPredicate)(t,r),[t,r]),h=(0,v.useMemo)(()=>fl(c,t),[c,t]),u=(0,v.useMemo)(()=>{const x=new Set(a.map(f=>f.scope));return h.filter(f=>!x.has(f.scope))},[h,a]),[m]=u;if(d===null||m===void 0)return null;const g=x=>{s(new p.AddHighlightCommand({predicate:d,scope:x,layerId:t.id})),o()};if(u.length===1){const x=h.length===1?e:i("graph.annotations.baseMenu.highlightWithLabel",{label:i(`graph.annotations.highlights.labels.${m.labelKey}`)});return(0,n.jsxs)(ee.Menu.Item,{className:re,onClick:()=>g(m.scope),children:[(0,n.jsx)(cr,{labelKey:m.labelKey}),(0,n.jsx)("span",{className:ae,children:x})]})}return(0,n.jsx)(Il,{label:e,options:u,onSelect:g})},Ml="_1aafi1g0",Rl="_1aafi1g1",ur=({children:e})=>(0,n.jsxs)("span",{className:Ml,"aria-hidden":"true",children:[e,(0,n.jsx)("span",{className:Rl})]}),Ol=({label:e,highlights:t,onRequestClose:r})=>{const{dispatch:a}=l.useGraphCommands(),o=t.at(-1);if(o===void 0)return null;const i=()=>{a(new p.RemoveHighlightCommand({id:o.id})),r()};return(0,n.jsxs)(_.Menu.Item,{className:re,onClick:i,children:[(0,n.jsx)(ur,{children:(0,n.jsx)(dr,{})}),(0,n.jsx)("span",{className:ae,children:e})]})},_l=(e,t)=>{const r=l.useSceneSelector(o=>o.spec.highlights),a=l.useSceneSelector(o=>o.config.parsingLocale);return(0,v.useMemo)(()=>(0,p.findHighlightsAtObservation)({layer:e,highlights:r,observation:t,parsingLocale:a}),[e,r,t,a])},hr=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("path",{opacity:"0.12",d:"M13.5948 4.29016C13.8724 6.22367 12.5301 8.01618 10.5966 8.29384C8.66309 8.57151 6.87058 7.22918 6.59292 5.29567C6.31525 3.36216 7.65758 1.56965 9.59109 1.29198C11.5246 1.01432 13.3171 2.35665 13.5948 4.29016Z",fill:"currentColor",fillOpacity:"0.8"}),(0,n.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.71886 3.51052C6.25611 1.3626 8.43287 0.0568985 10.5808 0.594151C12.7287 1.1314 14.0344 3.30817 13.4972 5.45609C13.0316 7.31748 11.3347 8.54637 9.49237 8.49145L7.50898 12.492C7.46485 12.581 7.40179 12.6548 7.32702 12.7108C7.20005 12.8073 7.03703 12.8532 6.87248 12.8303C6.80957 12.822 6.74697 12.8038 6.68687 12.7749C6.39369 12.6342 6.26689 12.2915 6.3923 11.9963L7.63393 7.97371C6.10249 7.10872 5.27136 5.29962 5.71886 3.51052ZM10.2785 1.80253C8.79799 1.4322 7.29756 2.33222 6.92723 3.81277C6.55691 5.29332 7.45692 6.79375 8.93747 7.16408C10.418 7.5344 11.9185 6.63439 12.2888 5.15384C12.6591 3.67329 11.7591 2.17285 10.2785 1.80253Z",fill:"currentColor",fillOpacity:"0.8"}),(0,n.jsx)("path",{d:"M5.42977 11.1572C5.70072 11.104 5.8772 10.8411 5.82393 10.5702C5.77067 10.2992 5.50784 10.1227 5.23688 10.176C4.31848 10.3565 3.57421 10.6423 3.04695 11.0266C2.51409 11.4149 2.16666 11.936 2.16666 12.557C2.16666 13.0322 2.41215 13.4327 2.74425 13.7433C3.07553 14.0531 3.52776 14.3091 4.04484 14.5137C5.08193 14.9239 6.48048 15.1666 7.99999 15.1666C9.5195 15.1666 10.9181 14.9239 11.9551 14.5137C12.4722 14.3091 12.9244 14.0531 13.2557 13.7433C13.5878 13.4327 13.8333 13.0322 13.8333 12.557C13.8333 11.936 13.4859 11.4149 12.953 11.0266C12.4258 10.6423 11.6815 10.3565 10.7631 10.176C10.4921 10.1227 10.2293 10.2992 10.176 10.5702C10.1228 10.8411 10.2993 11.104 10.5702 11.1572C11.4079 11.3219 11.997 11.5672 12.364 11.8347C12.7255 12.0981 12.8333 12.3496 12.8333 12.557C12.8333 12.6643 12.7803 12.8187 12.5727 13.013C12.3642 13.2079 12.0354 13.4065 11.5873 13.5838C10.6941 13.9371 9.426 14.1666 7.99999 14.1666C6.57398 14.1666 5.30586 13.9371 4.41267 13.5838C3.9646 13.4065 3.63578 13.2079 3.4273 13.013C3.21964 12.8187 3.16666 12.6643 3.16666 12.557C3.16666 12.3496 3.2745 12.0981 3.63595 11.8347C4.00299 11.5672 4.59206 11.3219 5.42977 11.1572Z",fill:"currentColor",fillOpacity:"0.8"})]}),Nl=({label:e,at:t,onRequestClose:r})=>{const{dispatch:a}=l.useGraphCommands(),o=()=>{a(new p.AddAnnotationCommand({kind:"pinnedNumber",annotation:{at:t}})),r()};return(0,n.jsxs)(_.Menu.Item,{className:re,onClick:o,children:[(0,n.jsx)(hr,{}),(0,n.jsx)("span",{className:ae,children:e})]})},pr=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("path",{opacity:"0.12",d:"M1.33334 8.00016C1.33334 4.31826 4.31811 1.3335 8.00001 1.3335C11.6819 1.3335 14.6667 4.31826 14.6667 8.00016C14.6667 11.6821 11.6819 14.6668 8.00001 14.6668C4.31811 14.6668 1.33334 11.6821 1.33334 8.00016Z",fill:"currentColor",fillOpacity:"0.8"}),(0,n.jsx)("path",{d:"M5.7328 9.69963C5.56696 9.47884 5.25352 9.43429 5.03273 9.60013C4.81193 9.76598 4.76739 10.0794 4.93323 10.3002C5.63175 11.2302 6.74548 11.8333 7.99993 11.8333C9.25438 11.8333 10.3681 11.2302 11.0666 10.3002C11.2325 10.0794 11.1879 9.76598 10.9671 9.60013C10.7463 9.43429 10.4329 9.47884 10.2671 9.69963C9.74929 10.3889 8.92657 10.8333 7.99993 10.8333C7.07329 10.8333 6.25057 10.3889 5.7328 9.69963Z",fill:"currentColor",fillOpacity:"0.8"}),(0,n.jsx)("path",{d:"M6.66668 6.66658C6.66668 7.03478 6.3682 7.33325 6.00001 7.33325C5.63182 7.33325 5.33334 7.03478 5.33334 6.66658C5.33334 6.29839 5.63182 5.99992 6.00001 5.99992C6.3682 5.99992 6.66668 6.29839 6.66668 6.66658Z",fill:"currentColor",fillOpacity:"0.8"}),(0,n.jsx)("path",{d:"M10 7.33325C10.3682 7.33325 10.6667 7.03478 10.6667 6.66658C10.6667 6.29839 10.3682 5.99992 10 5.99992C9.63182 5.99992 9.33334 6.29839 9.33334 6.66658C9.33334 7.03478 9.63182 7.33325 10 7.33325Z",fill:"currentColor",fillOpacity:"0.8"}),(0,n.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.00001 0.833252C4.04197 0.833252 0.833344 4.04188 0.833344 7.99992C0.833344 11.958 4.04197 15.1666 8.00001 15.1666C11.9581 15.1666 15.1667 11.958 15.1667 7.99992C15.1667 4.04188 11.9581 0.833252 8.00001 0.833252ZM14.1667 7.99992C14.1667 11.4057 11.4058 14.1666 8.00001 14.1666C4.59425 14.1666 1.83334 11.4057 1.83334 7.99992C1.83334 4.59416 4.59425 1.83325 8.00001 1.83325C11.4058 1.83325 14.1667 4.59416 14.1667 7.99992Z",fill:"currentColor",fillOpacity:"0.8"})]}),mr={pinnedNumber:{icon:hr,labelKey:"graph.annotations.baseMenu.unpinNumber"},comment:{icon:ir,labelKey:"graph.annotations.baseMenu.removeAnnotation"},sticker:{icon:pr,labelKey:"graph.annotations.baseMenu.removeSticker"},image:null},Dl=e=>(0,p.isObservationAttachmentKind)(e.kind)&&mr[e.kind]!==null,Fl=({attachment:e,onRequestClose:t})=>{const r=l.useI18n(),{dispatch:a}=l.useGraphCommands(),{icon:o,labelKey:i}=mr[e.kind],s=()=>{a(new p.RemoveAnnotationCommand({id:e.annotation.id})),t()};return(0,n.jsxs)(_.Menu.Item,{className:re,onClick:s,children:[(0,n.jsx)(ur,{children:(0,n.jsx)(o,{})}),(0,n.jsx)("span",{className:ae,children:r(i)})]})},zl="ceeojg0",Bl="ceeojg1",Hl="ceeojg2",Gl=({label:e,at:t,onRequestClose:r})=>{const{dispatch:a}=l.useGraphCommands(),o=i=>{a(new p.AddAnnotationCommand({kind:"sticker",annotation:{at:{anchorType:"observation",...t},sticker:i}})),r()};return(0,n.jsx)(vt,{label:e,icon:(0,n.jsx)(pr,{}),children:(0,n.jsx)("div",{className:zl,children:Object.entries(l.STICKER_ASSETS).map(([i,s])=>(0,n.jsx)(ee.Menu.Item,{className:Bl,"aria-label":i,onClick:()=>o(i),children:(0,n.jsx)("img",{className:Hl,src:s.src,alt:i})},i))})})},Vl=({interaction:e,frameElement:t,panelRect:r})=>{const a=l.useEditorStore(),o=l.useEditorState(d=>d.menuTrigger);if(e.kind!=="menu"||o===null)return null;const i=()=>{a.getState().releaseInteraction("menu")},{center:s,radius:c}=o;return(0,n.jsx)($l,{frameElement:t,trigger:{x:r.x+s.x-c,y:r.y+s.y-c,width:c*2,height:c*2},layer:e.anchor.layer,at:e.anchor.at,observation:e.anchor.observation,onClose:i})},$l=({frameElement:e,trigger:t,layer:r,at:a,observation:o,onClose:i})=>{const s=l.useI18n(),c=De(),d=l.useSceneSelector(j=>j.spec.annotations),h=l.useSceneSelector(j=>j.config.parsingLocale),u=or(),{x:m,y:g,width:x,height:f}=t,b=(0,v.useMemo)(()=>ar(e,{x:m,y:g,width:x,height:f}),[e,m,g,x,f]),w=(0,p.findObservationAttachment)(d,a,(0,v.useMemo)(()=>(0,p.createObservationAnchorParser)(r,h),[r,h])),T=w!==null&&Dl(w)?w:null,y=_l(r,o),k=(j,I)=>{!j&&Ul(I.reason)&&i()};return(0,n.jsx)(_.Menu.Root,{open:u,modal:!1,onOpenChange:k,children:(0,n.jsx)(_.Menu.Portal,{container:c,children:(0,n.jsx)(l.PortalThemeProvider,{children:(0,n.jsx)(_.Menu.Positioner,{anchor:b,side:"right",align:"start",sideOffset:8,className:sr,...xt,children:(0,n.jsxs)(_.Menu.Popup,{className:lr,"data-testid":"observation-menu",children:[T!==null&&(0,n.jsx)(Fl,{attachment:T,onRequestClose:i}),(0,n.jsx)(Ol,{label:s("graph.annotations.baseMenu.removeHighlight"),highlights:y,onRequestClose:i}),(0,n.jsx)(_.Menu.Separator,{className:il}),T===null&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Nl,{label:s("graph.annotations.baseMenu.pinNumber"),at:a,onRequestClose:i}),(0,n.jsx)(pl,{label:s("graph.annotations.baseMenu.annotate"),placeholder:s("graph.annotations.textMenu.placeholder"),addLabel:s("graph.annotations.textMenu.addButton"),at:a,onRequestClose:i}),(0,n.jsx)(Gl,{label:s("graph.annotations.baseMenu.addSticker"),at:a,onRequestClose:i})]}),r.highlight!==null&&(0,n.jsx)(El,{label:s("graph.annotations.baseMenu.highlight"),layer:r,observation:o,highlights:y,onRequestClose:i}),(0,n.jsx)(vl,{label:s("graph.annotations.baseMenu.differenceArrow"),layer:r,at:a,onRequestClose:i})]})})})})})},Ul=e=>e==="outside-press"||e==="escape-key"||e==="item-press",ft="l8tsqe0",gr=["start","end"],xr=({anchor:e,point:t,delta:r})=>{const a={x:Yt(t.x,r.x),y:Yt(1-t.y,r.y)};return{anchor:{...e,x:e.x+a.x,y:e.y+a.y},point:{x:t.x+a.x,y:t.y-a.y}}},bt=(e,t)=>({...e,[t.endpoint]:{...e[t.endpoint],...t.point}}),vr=(e,t)=>e.x===t.x&&e.y===t.y,Wl=(e,t)=>{const r=(0,p.projectAnchorToPanel)(e,t);return{x:t.x+r.x,y:t.y+r.y}},ql=(e,t,r)=>{const a=(0,p.projectAnchorToPanel)(e,r),o=(0,p.projectAnchorToPanel)(t,r);return{x:Math.min(a.x,o.x),y:Math.min(a.y,o.y),width:Math.abs(o.x-a.x),height:Math.abs(o.y-a.y)}},Yt=(e,t)=>!Number.isFinite(t)||!Number.isFinite(e)?0:(0,te.default)(t,Math.min(-e,0),Math.max(1-e,0)),Kl=({panelRect:e})=>{const t=l.useEditorState(c=>l.readStanding(c,"arrow-endpoint-drag")),r=l.useResolvedAnnotations(e).arrows,a=l.useStyleReaderTree();if(t===null)return null;const o=r.find(c=>c.id===t.annotationId);if(o===void 0)return null;const i=(0,p.resolveArrowAnnotationStyle)(a,o.id),s=(0,p.computeArrow)({arrow:bt(o,t),style:i,panelWidth:e.width,panelHeight:e.height});return s===null?null:(0,n.jsx)("svg",{"aria-hidden":"true",className:ft,width:e.width,height:e.height,style:{left:e.x,top:e.y},"data-testid":"arrow-endpoint-preview","data-annotation-id":t.annotationId,children:(0,n.jsx)(l.ArrowAnnotation,{computed:s,style:i,isAddressable:!1})})},me=()=>{const e=l.useGraphSelection();return at(e)},at=e=>{if(e.length!==1)return null;const[t]=e;return t?.kind==="annotation"?t.id:null},Xl=e=>(0,n.jsx)(l.Icon,{...e,children:(0,n.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"m12 19-7-7 7-7"}),(0,n.jsx)("path",{d:"M19 12H5"})]})}),fr=e=>(0,n.jsx)(l.Icon,{...e,children:(0,n.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"M5 12h14"}),(0,n.jsx)("path",{d:"m12 5 7 7-7 7"})]})}),Zl=e=>(0,n.jsx)(l.Icon,{...e,children:(0,n.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"M7 17 17 7"}),(0,n.jsx)("path",{d:"M7 7h10v10"})]})}),br=e=>(0,n.jsx)(l.Icon,{...e,children:(0,n.jsxs)("g",{fill:"currentColor",children:[(0,n.jsx)("rect",{x:"3",y:"5",width:"18",height:"1.5",rx:"0.75"}),(0,n.jsx)("rect",{x:"3",y:"10",width:"18",height:"3",rx:"1.5"}),(0,n.jsx)("rect",{x:"3",y:"16.5",width:"18",height:"4.5",rx:"2.25"})]})}),Fe=e=>(0,n.jsx)(l.Icon,{...e,children:(0,n.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"M4 7h16"}),(0,n.jsx)("path",{d:"M10 11v6M14 11v6"}),(0,n.jsx)("path",{d:"M6 7l1 12a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2l1-12"}),(0,n.jsx)("path",{d:"M9 7V5a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2"})]})}),Yl="var(--pvjfpx0)",Jl="var(--pvjfpx1)",Ql="pvjfpx2",ec="pvjfpx3",tc="pvjfpx4",nc="pvjfpx6 pvjfpx5",rc="pvjfpx7 pvjfpx6 pvjfpx5",ac="pvjfpx8 pvjfpx5",ce=8,oc=({anchorBox:e,panelRect:t,frameWidth:r,frameHeight:a})=>{const o=t.y+e.y,i=o+e.height,s=o-8-36,c=i+8,d=(0,te.default)(s>=ce?s:c,ce,a-ce-36),h=ce;return{top:d,left:h,available:Math.max(0,r-ce*2),centre:t.x+e.x+e.width/2-h}},ic=({anchorBox:e,panelRect:t,frameWidth:r,frameHeight:a,label:o,testId:i,children:s})=>{const{chartId:c}=l.useGraphContext(),d=oc({anchorBox:e,panelRect:t,frameWidth:r,frameHeight:a});return(0,n.jsx)("div",{className:Ql,style:{top:d.top,left:d.left,width:d.available},children:(0,n.jsx)(B.Root,{"aria-label":o,className:ec,"data-testid":i,...Ne(c),style:(0,Me.assignInlineVars)({[Yl]:`${d.centre}px`,[Jl]:`${d.available}px`}),children:s})})},sc=({label:e,trigger:t,isOpen:r,onOpenChange:a,isDisabled:o=!1,children:i})=>{const{chartId:s}=l.useGraphContext();return(0,n.jsxs)(_.Menu.Root,{open:r,modal:!1,onOpenChange:a,children:[(0,n.jsxs)(_.Menu.Trigger,{render:(0,n.jsx)(B.Button,{}),"aria-label":e,className:ac,disabled:o,onMouseDown:c=>c.preventDefault(),children:[t,(0,n.jsx)(pe,{size:"sm"})]}),(0,n.jsx)(B.MenuPopup,{popupAttributes:Ne(s),children:i})]})},lc=e=>{const{chartId:t}=l.useGraphContext();return(0,n.jsx)(B.ColorPicker,{...e,popupAttributes:Ne(t)})},cc=({color:e,opacity:t})=>(0,n.jsx)("span",{className:tc,style:{background:e,opacity:t}}),dc=({label:e,onClick:t,children:r})=>(0,n.jsx)(B.Button,{"aria-label":e,className:nc,onClick:t,children:r}),uc=({label:e,isPressed:t,onClick:r,children:a})=>(0,n.jsx)(B.Button,{"aria-label":e,"aria-pressed":t,className:rc,onClick:r,children:a}),R={Root:ic,Dropdown:sc,MenuItem:B.MenuItem,ColorPicker:lc,Swatch:cc,IconButton:dc,ToggleButton:uc,Button:B.Button,Separator:B.Separator},hc={kind:"chrome-popup"},ze=()=>{const{commands:e}=l.useGraphContext(),t=l.useEditorStore(),[r,a]=(0,v.useState)(null);(0,v.useEffect)(()=>()=>e.commit(),[e]),(0,v.useEffect)(()=>{const{claimInteraction:i,releaseInteraction:s}=t.getState();return r===null?s("chrome-popup"):i(hc),()=>s("chrome-popup")},[t,r]);const o=()=>{a(null),e.commit()};return{bind:i=>({isOpen:r===i,onOpenChange:s=>s?a(i):o()}),close:o}},pc=e=>(0,n.jsx)(l.Icon,{...e,children:(0,n.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",children:[(0,n.jsx)("path",{d:"M5 19 8 16"}),(0,n.jsx)("path",{d:"M10.5 13.5 13.5 10.5"}),(0,n.jsx)("path",{d:"M16 8 19 5"})]})}),mc=e=>(0,n.jsx)(l.Icon,{...e,children:(0,n.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",children:[(0,n.jsx)("path",{d:"M5 19h0"}),(0,n.jsx)("path",{d:"M8.5 15.5h0"}),(0,n.jsx)("path",{d:"M12 12h0"}),(0,n.jsx)("path",{d:"M15.5 8.5h0"}),(0,n.jsx)("path",{d:"M19 5h0"})]})}),gc=e=>(0,n.jsx)(l.Icon,{...e,children:(0,n.jsx)("path",{d:"M5 19 19 5",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round"})}),xc=[{value:p.ARROW_STROKE_WIDTHS_PX.thin,key:"graph.annotations.arrowToolbar.thickness.thin"},{value:p.ARROW_STROKE_WIDTHS_PX.medium,key:"graph.annotations.arrowToolbar.thickness.medium"},{value:p.ARROW_STROKE_WIDTHS_PX.thick,key:"graph.annotations.arrowToolbar.thickness.thick"}],Jt=[{value:"line-arrow",key:"graph.annotations.arrowToolbar.arrowhead.lineArrow",Icon:fr},{value:"none",key:"graph.annotations.arrowToolbar.arrowhead.none",Icon:l.MinusIcon}],Qt=[{value:"solid",key:"graph.annotations.arrowToolbar.lineStyle.solid",Icon:gc},{value:"dashed",key:"graph.annotations.arrowToolbar.lineStyle.dashed",Icon:pc},{value:"dotted",key:"graph.annotations.arrowToolbar.lineStyle.dotted",Icon:mc}],vc=(e,t)=>e.find(r=>r.value===t)??e[0];var fc=({arrow:e,arrowBox:t,panelRect:r,frameWidth:a,frameHeight:o,frameElement:i})=>{const s=l.useI18n(),{commands:c}=l.useGraphContext(),d=l.useSceneSelector(C=>C.spec.styles.overrides),h=ze(),u=(0,p.resolveArrowAnnotationStyle)(l.useStyleReaderTree(),e.id),m=vc(Qt,(0,p.toDashPreset)(u.dashArray)),g=u.outline.strokeWidth>0||u.outline.shadow!=="none",x=(0,v.useMemo)(()=>({target:"annotation",kind:"arrow",annotation:e.id}),[e.id]),f=(0,v.useMemo)(()=>({...x,part:"outline"}),[x]),b=(C,S)=>{const z=(0,p.findStyleRule)(d,{select:x})?.declarations??{};c.dispatch(new p.SetStyleRuleCommand({list:"overrides",rule:{select:x,declarations:{...z,...C}}}),S)},w=C=>{const S=(0,p.findStyleRule)(d,{select:f})?.declarations??{};c.dispatch(new p.SetStyleRuleCommand({list:"overrides",rule:{select:f,declarations:{...S,...C}}}))},T=C=>{b(C),h.close()},y=C=>{c.dispatch(new p.UpdateAnnotationCommand({kind:"arrow",id:e.id,patch:C})),h.close()},k=()=>{c.dispatch(new p.RemoveAnnotationCommand({id:e.id})),i.focus({preventScroll:!0})},j=C=>b({stroke:C},{transient:!0}),I=C=>T({strokeWidth:C}),P=C=>y({startArrowheadStyle:C}),E=C=>T({dashArray:p.DASH_PRESETS.arrow[C]}),O=C=>y({endArrowheadStyle:C}),M=()=>w(g?{strokeWidth:0,shadow:"none"}:p.ARROW_STICKER_DECLARATIONS);return(0,n.jsxs)(R.Root,{anchorBox:t,panelRect:r,frameWidth:a,frameHeight:o,label:s("graph.annotations.arrowToolbar.label"),testId:"arrow-toolbar",children:[(0,n.jsx)(R.ColorPicker,{color:u.stroke,label:s("graph.annotations.arrowToolbar.color"),onChange:j,...h.bind("color"),children:(0,n.jsx)(R.Swatch,{color:u.stroke})}),(0,n.jsx)(R.Dropdown,{label:s("graph.annotations.arrowToolbar.thickness.ariaLabel"),trigger:(0,n.jsx)(br,{size:"sm",title:""}),...h.bind("thickness"),children:(0,n.jsx)(be,{options:xc,current:u.strokeWidth,onPick:I})}),(0,n.jsx)(R.Dropdown,{label:s("graph.annotations.arrowToolbar.startArrowhead"),trigger:(0,n.jsx)(Xl,{size:"sm",title:""}),...h.bind("startArrowhead"),children:(0,n.jsx)(be,{options:Jt,current:e.startArrowheadStyle,onPick:P})}),(0,n.jsx)(R.Dropdown,{label:s("graph.annotations.arrowToolbar.lineStyle.ariaLabel"),trigger:m?.Icon!==void 0&&(0,n.jsx)(m.Icon,{size:"sm",title:""}),...h.bind("lineStyle"),children:(0,n.jsx)(be,{options:Qt,current:(0,p.toDashPreset)(u.dashArray),onPick:E})}),(0,n.jsx)(R.Dropdown,{label:s("graph.annotations.arrowToolbar.endArrowhead"),trigger:(0,n.jsx)(fr,{size:"sm",title:""}),...h.bind("endArrowhead"),children:(0,n.jsx)(be,{options:Jt,current:e.endArrowheadStyle,onPick:O})}),(0,n.jsx)(R.ToggleButton,{label:s("graph.annotations.arrowToolbar.sticker"),isPressed:g,onClick:M,children:(0,n.jsx)(Zl,{size:"sm",title:""})}),(0,n.jsx)(R.Separator,{}),(0,n.jsx)(R.IconButton,{label:s("graph.annotations.arrowToolbar.remove"),onClick:k,children:(0,n.jsx)(Fe,{size:"sm",title:""})})]})},be=({options:e,current:t,onPick:r})=>{const a=l.useI18n(),o=i=>()=>r(i);return(0,n.jsx)(n.Fragment,{children:e.map(i=>(0,n.jsxs)(R.MenuItem,{isSelected:i.value===t,onClick:o(i.value),children:[(0,n.jsx)("span",{children:a(i.key)}),i.Icon!==void 0&&(0,n.jsx)("span",{className:"_112xh5c0",children:(0,n.jsx)(i.Icon,{size:"sm",title:""})})]},String(i.value)))})},bc="_1me29t10",W=(e,t)=>t>0?e/t:0,Be=(e,t,r)=>({x:W(t.x-e.x,r.width),y:W(t.y-e.y,r.height)}),Sc=e=>e.x!==0||e.y!==0,Sr=(e,t)=>({x:e.x*t.width,y:e.y*t.height});var yc=(e,t)=>Math.hypot(t.x-e.x,t.y-e.y)>=3,ge=class{constructor(e){this.params=e,this.listeners=new AbortController,this.pendingEvent=null,this.scheduledFrame=null,this.hasMoved=!1,this.hasPublished=!1,this.handleMove=t=>{t.pointerId===this.params.pointerId&&(this.pendingEvent=t,this.hasMoved=!0,this.scheduledFrame===null&&(this.scheduledFrame=requestAnimationFrame(this.runFrame)))},this.handleUp=t=>{t.pointerId===this.params.pointerId&&(this.pendingEvent=t,this.finish(!0))},this.handleLost=t=>{t.pointerId===this.params.pointerId&&this.finish(!1)},this.runFrame=()=>{this.scheduledFrame=null;const t=this.pendingEvent;if(this.pendingEvent=null,t===null)return;const r=this.params.editorStore.getState();if(this.hasPublished&&this.readOwn(r)===null)return;const a={x:t.clientX,y:t.clientY};if(!this.hasPublished&&!this.isDragConfirmed(this.params.press,a))return;const o=this.resolvePreview(a);o!==null&&(r.claimInteraction(o),this.hasPublished=!0)}}start(){const{handle:e}=this.params,{signal:t}=this.listeners;e.addEventListener("pointermove",this.handleMove,{signal:t}),e.addEventListener("pointerup",this.handleUp,{signal:t}),e.addEventListener("lostpointercapture",this.handleLost,{signal:t})}finish(e){this.params.onSettled(),this.listeners.abort(),this.cancelFrame();try{e&&this.hasMoved&&this.runFrame()}finally{this.settle(e)}}isDragConfirmed(e,t){return yc(e,t)}settle(e){this.pendingEvent=null;const t=this.params.editorStore.getState(),r=this.readOwn(t);r!==null&&t.releaseInteraction(this.kind),!(!e||r===null)&&this.commit(r)}cancelFrame(){this.scheduledFrame!==null&&(cancelAnimationFrame(this.scheduledFrame),this.scheduledFrame=null)}},ke=(e,t,r)=>{const a=e.arrows.find(i=>i.id===t);if(a===void 0)return null;const o=a[r];return o.anchorType==="panel"?o:null},yr=(e,t)=>e==="start"?{start:t}:{end:t},Cc=class extends ge{constructor(...e){super(...e),this.kind="arrow-endpoint-drag"}readOwn(e){const{annotationId:t,endpoint:r}=this.params;return l.readDraggedArrowEndpointFor(l.readStanding(e,"arrow-endpoint-drag"),t,r)}resolvePreview(e){const{annotationId:t,endpoint:r,press:a,readInputs:o}=this.params,{annotations:i,arrow:s,panelRect:c}=o(),d=ke(i,t,r);return d===null?null:{kind:"arrow-endpoint-drag",annotationId:t,endpoint:r,...xr({anchor:d,point:s[r],delta:Be(a,e,c)})}}commit({anchor:e}){const{annotationId:t,endpoint:r,dispatch:a,readInputs:o}=this.params,i=ke(o().annotations,t,r);i===null||vr(i,e)||a(new p.UpdateAnnotationCommand({kind:"arrow",id:t,patch:yr(r,e)}))}},jc=({annotationId:e,arrow:t,panelRect:r})=>{const{commands:a}=l.useGraphContext(),o=l.useEditorStore(),i=l.useLatestRef({annotations:l.useSceneSelector(c=>c.spec.annotations),arrow:t,panelRect:r}),s=(0,v.useRef)(null);return(0,v.useEffect)(()=>()=>s.current?.finish(!1),[]),(0,v.useCallback)(c=>({onPointerDown:d=>{if(d.button===0&&s.current===null){try{d.currentTarget.setPointerCapture(d.pointerId)}catch{return}d.currentTarget.focus({preventScroll:!0}),d.preventDefault(),s.current=new Cc({handle:d.currentTarget,pointerId:d.pointerId,annotationId:e,endpoint:c,press:{x:d.clientX,y:d.clientY},readInputs:()=>i.current,editorStore:o,dispatch:a.dispatch,onSettled:()=>{s.current=null}}),s.current.start()}}}),[e,i,o,a])},wc=[" ","Enter"],en=4,Tc=({annotationId:e,arrow:t,panelRect:r})=>{const{commands:a}=l.useGraphContext(),o=l.useEditorStore(),i=l.useSceneSelector(d=>d.spec.annotations),s=l.useLatestRef(i),c=l.useLatestRef(a.dispatch);return(0,v.useEffect)(()=>()=>{for(const d of gr)tn({editorStore:o,annotationId:e,endpoint:d,annotations:s.current,dispatch:c.current})},[o,e,s,c]),(0,v.useCallback)(d=>({onKeyDown:h=>{if(h.altKey||h.ctrlKey||h.metaKey||h.shiftKey)return;const u=o.getState(),m=l.readDraggedArrowEndpointFor(l.readStanding(u,"arrow-endpoint-drag"),e,d);if(wc.includes(h.key)){if(h.preventDefault(),h.repeat)return;if(m!==null){tn({editorStore:o,annotationId:e,endpoint:d,annotations:i,dispatch:a.dispatch});return}const x=ke(i,e,d);if(x===null)return;u.claimInteraction({kind:"arrow-endpoint-drag",annotationId:e,endpoint:d,anchor:x,point:t[d]});return}if(m===null)return;const g=Ac(h.key,r);g!==null&&(h.preventDefault(),u.claimInteraction({kind:"arrow-endpoint-drag",annotationId:e,endpoint:d,...xr({anchor:m.anchor,point:m.point,delta:g})}))}}),[e,i,t,r,o,a])},tn=({editorStore:e,annotationId:t,endpoint:r,annotations:a,dispatch:o})=>{const i=e.getState(),s=l.readDraggedArrowEndpointFor(l.readStanding(i,"arrow-endpoint-drag"),t,r);if(s===null)return;i.releaseInteraction("arrow-endpoint-drag");const c=ke(a,t,r);c===null||vr(c,s.anchor)||o(new p.UpdateAnnotationCommand({kind:"arrow",id:t,patch:yr(r,s.anchor)}))},Ac=(e,t)=>{const r=W(en,t.width),a=W(en,t.height);switch(e){case"ArrowLeft":return{x:-r,y:0};case"ArrowRight":return{x:r,y:0};case"ArrowUp":return{x:0,y:-a};case"ArrowDown":return{x:0,y:a};default:return null}},kc=e=>{const t=me(),r=Ic(t),a=Ec(e.panelRect,t),o=Mc(t);if(r===null||a===null)return null;const i=o.dragged===null?a:bt(a,o.dragged);return(0,n.jsx)(Pc,{arrow:r,committed:a,painted:i,isSettled:o.dragged===null&&!o.isMoved,isMoved:o.isMoved,...e})},Pc=({arrow:e,committed:t,painted:r,isSettled:a,isMoved:o,panelRect:i,frameRect:s,frameElement:c})=>{const d=l.useI18n(),h=jc({annotationId:e.id,arrow:t,panelRect:i}),u=Tc({annotationId:e.id,arrow:t,panelRect:i});return(0,n.jsxs)("div",{"data-testid":"arrow-selection","data-annotation-id":e.id,children:[a&&(0,n.jsx)(fc,{arrow:e,arrowBox:ql(t.start,t.end,i),panelRect:i,frameWidth:s.width,frameHeight:s.height,frameElement:c}),!o&&gr.filter(m=>e[m].anchorType==="panel").map(m=>(0,n.jsx)(Lc,{endpoint:m,point:Wl(r[m],i),label:d(`graph.annotations.arrowToolbar.moveEndpoint.${m}`),dragHandlers:h(m),keyboardHandlers:u(m)},m))]})},Lc=({endpoint:e,point:t,label:r,dragHandlers:a,keyboardHandlers:o})=>(0,n.jsx)("div",{"aria-label":r,className:bc,"data-testid":"arrow-endpoint-handle","data-endpoint":e,role:"button",style:{left:t.x,top:t.y},tabIndex:0,...a,...o}),Ic=e=>{const t=l.useSceneSelector(r=>r.spec.annotations.arrows);return e===null?null:t.find(r=>r.id===e)??null},Ec=(e,t)=>{const r=l.useResolvedAnnotations(e).arrows;return t===null?null:r.find(a=>a.id===t)??null},Mc=e=>l.useEditorState((0,Y.useShallow)(t=>{if(e===null)return{dragged:null,isMoved:!1};const r=l.readStanding(t,"arrow-endpoint-drag");return{dragged:r?.annotationId===e?r:null,isMoved:l.readMovedAnnotationFor(l.readStanding(t,"move-drag"),e)!==null}})),Rc=e=>(0,n.jsx)(l.Icon,{...e,children:(0,n.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"M4 9h16m-4-4 4 4"}),(0,n.jsx)("path",{d:"M20 15H4m4 4-4-4"})]})}),Oc="q7gcrz0",_c="q7gcrz1",Nc="q7gcrz2";var Dc=["absolute-difference","relative-difference","proportion"],nn=["absolute-difference","relative-difference"],Fc=["relative-difference","proportion"],zc={"absolute-difference":"graph.annotations.differenceArrowToolbar.labelKind.absoluteDifference","relative-difference":"graph.annotations.differenceArrowToolbar.labelKind.relativeDifference",proportion:"graph.annotations.differenceArrowToolbar.labelKind.proportion"},Bc=e=>{const{formattingLocale:t}=l.useGraphContext(),r=l.useSceneSelector(o=>o.config.parsingLocale),a=t??r;return(0,v.useMemo)(()=>{const o=(0,p.areEndpointsComparable)(e.start,e.end);return Dc.filter(i=>o||!nn.includes(i)||i===e.label).map(i=>({kind:i,key:zc[i],preview:(0,p.formatDifferenceLabel)({locale:a,kind:i,startValue:e.start.measurementValue,endValue:e.end.measurementValue,valueFormat:e.start.valueFormat}),isPickable:o||!nn.includes(i),isSuspect:Fc.includes(i)&&e.start.measurementValue===0}))},[e,a])},rn=[{id:"small",key:"graph.annotations.differenceArrowToolbar.size.small"},{id:"medium",key:"graph.annotations.differenceArrowToolbar.size.medium"},{id:"large",key:"graph.annotations.differenceArrowToolbar.size.large"}],Hc=({arrow:e,color:t,labelBox:r,panelRect:a,frameWidth:o,frameHeight:i,frameElement:s})=>{const c=l.useI18n(),{commands:d}=l.useGraphContext(),h=l.useSceneSelector(S=>S.spec.styles.overrides),u=ze(),m=Bc(e),g=(0,p.resolveDifferenceArrowAnnotationStyle)(l.useStyleReaderTree(),e.id),x=(0,v.useMemo)(()=>({target:"annotation",kind:"differenceArrow",annotation:e.id}),[e.id]),f=(0,v.useMemo)(()=>({...x,part:"label"}),[x]),b=m.find(S=>S.kind===e.label),w=m.some(S=>S.isPickable&&S.kind!==e.label),T=rn.find(S=>p.DIFFERENCE_ARROW_SIZE_DECLARATIONS[S.id].arrow.strokeWidth===g.strokeWidth),y=(S,z)=>{d.dispatch(new p.UpdateAnnotationCommand({kind:"differenceArrow",id:e.id,patch:S}),z)},k=S=>({...(0,p.findStyleRule)(h,{select:x})?.declarations,...S}),j=S=>({...(0,p.findStyleRule)(h,{select:f})?.declarations,...S}),I=S=>{y(S),u.close()},P=()=>{d.dispatch(new p.RemoveAnnotationCommand({id:e.id})),s.focus({preventScroll:!0})},E=S=>d.dispatch(new p.SetStyleRuleCommand({list:"overrides",rule:{select:x,declarations:k({stroke:S})}}),{transient:!0}),O=()=>y({start:e.end.anchor,end:e.start.anchor}),M=S=>()=>I({label:S}),C=S=>()=>{const z=p.DIFFERENCE_ARROW_SIZE_DECLARATIONS[S];d.dispatch(new p.SetDifferenceArrowStyleCommand({annotationId:e.id,arrow:k(z.arrow),label:j(z.label)})),u.close()};return(0,n.jsxs)(R.Root,{anchorBox:r,panelRect:a,frameWidth:o,frameHeight:i,label:c("graph.annotations.differenceArrowToolbar.label"),testId:"difference-arrow-toolbar",children:[(0,n.jsx)(R.Dropdown,{label:c("graph.annotations.differenceArrowToolbar.labelKind.ariaLabel"),trigger:(0,n.jsx)(Gc,{option:b}),isDisabled:!w,...u.bind("labelKind"),children:m.map(S=>(0,n.jsxs)(R.MenuItem,{isSelected:S.kind===e.label,isDisabled:!S.isPickable,onClick:M(S.kind),children:[(0,n.jsx)("span",{children:c(S.key)}),(S.isSuspect||!S.isPickable)&&(0,n.jsx)("span",{"aria-label":c(S.isPickable?"graph.annotations.differenceArrowToolbar.labelKind.suspectValue":"graph.annotations.differenceArrowToolbar.labelKind.incomparableEnds"),className:"q7gcrz3",role:"img",children:"⚠"}),(0,n.jsx)("span",{className:Nc,children:S.preview})]},S.kind))}),(0,n.jsx)(R.Separator,{}),(0,n.jsx)(R.ColorPicker,{color:t,label:c("graph.annotations.differenceArrowToolbar.color"),onChange:E,...u.bind("color"),children:(0,n.jsx)(R.Swatch,{color:t})}),(0,n.jsx)(R.Dropdown,{label:c("graph.annotations.differenceArrowToolbar.size.ariaLabel"),trigger:T===void 0?"":c(T.key),...u.bind("size"),children:rn.map(S=>(0,n.jsx)(R.MenuItem,{isSelected:S.id===T?.id,onClick:C(S.id),children:c(S.key)},S.id))}),(0,n.jsx)(R.Separator,{}),(0,n.jsx)(R.IconButton,{label:c("graph.annotations.differenceArrowToolbar.swap"),onClick:O,children:(0,n.jsx)(Rc,{size:"sm",title:""})}),(0,n.jsx)(R.IconButton,{label:c("graph.annotations.differenceArrowToolbar.remove"),onClick:P,children:(0,n.jsx)(Fe,{size:"sm",title:""})})]})},Gc=({option:e})=>{const t=l.useI18n();return e===void 0?null:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:_c,children:t(e.key)}),(0,n.jsxs)("span",{className:Oc,children:["(",e.preview,")"]})]})};var Vc="ydgo3h0",$c="ydgo3h1",Uc="ydgo3h2",Wc=({clientPoint:e,panelOrigin:t,panelRect:r,engine:a,layers:o,coordSystem:i,resolver:s,fixedAnchor:c,align:d})=>{const h=qc({x:e.x-t.x,y:e.y-t.y},r),{primary:u}=a.query((0,p.toPanelCursor)(h,r));if(u===null)return null;const m=o.find(x=>x.id===u.layerId);if(m===void 0)return null;const g=(0,p.resolveObservationPoint)({resolver:s,layer:m,observation:u.observation,observationIndex:(0,p.readObservationIndex)(u),coordSystem:i,align:d});return g===null||(0,p.areAnchorsEqual)(g.anchor,c)?null:g},qc=(e,t)=>({x:Math.max(0,Math.min(e.x,t.width)),y:Math.max(0,Math.min(e.y,t.height))}),Cr=e=>e==="start"?"end":"start",jr=({dispatch:e,arrow:t,endpoint:r,anchor:a})=>{(0,p.areAnchorsEqual)(a,t[r].anchor)||e(new p.UpdateAnnotationCommand({kind:"differenceArrow",id:t.id,patch:{[r]:a}}))},Kc=class extends ge{constructor(...e){super(...e),this.kind="difference-arrow-endpoint-drag"}isDragConfirmed(){return!0}readOwn(e){const{endpoint:t,readInputs:r}=this.params;return l.readDraggedDifferenceArrowEndpointFor(l.readStanding(e,"difference-arrow-endpoint-drag"),r().arrow.id,t)}resolvePreview(e){const{endpoint:t,readInputs:r,engine:a,anchorResolver:o}=this.params,{arrow:i,panelOrigin:s,panelRect:c,layers:d,coordSystem:h}=r(),u=Wc({clientPoint:e,panelOrigin:s,panelRect:c,engine:a,layers:d,coordSystem:h,resolver:o,fixedAnchor:i[Cr(t)].anchor,align:i[t].anchor.align});return u===null?null:{kind:"difference-arrow-endpoint-drag",annotationId:i.id,endpoint:t,point:u}}commit({point:e,endpoint:t}){const{dispatch:r,readInputs:a}=this.params;jr({dispatch:r,arrow:a().arrow,endpoint:t,anchor:e.anchor})}},Xc=({arrow:e,panelOrigin:t,panelRect:r})=>{const{commands:a,anchorResolver:o}=l.useGraphContext(),{engine:i}=l.useHoverContext(),s=l.useEditorStore(),c=l.useLatestRef({arrow:e,panelOrigin:t,panelRect:r,...l.useSceneSelector((0,Y.useShallow)(h=>({layers:h.layers,coordSystem:h.coordSystem})))}),d=(0,v.useRef)(null);return(0,v.useEffect)(()=>()=>d.current?.finish(!1),[]),(0,v.useCallback)(h=>({onPointerDown:u=>{if(u.button===0&&d.current===null){try{u.currentTarget.setPointerCapture(u.pointerId)}catch{return}u.currentTarget.focus({preventScroll:!0}),u.preventDefault(),d.current=new Kc({handle:u.currentTarget,pointerId:u.pointerId,press:{x:u.clientX,y:u.clientY},endpoint:h,readInputs:()=>c.current,editorStore:s,engine:i,anchorResolver:o,dispatch:a.dispatch,onSettled:()=>{d.current=null}}),d.current.start()}}}),[c,s,i,o,a])},Zc=[" ","Enter"],Yc=({arrow:e})=>{const{commands:t,anchorResolver:r}=l.useGraphContext(),a=l.useEditorStore(),{layers:o,coordSystem:i,mainAxis:s}=l.useSceneSelector((0,Y.useShallow)(d=>({layers:d.layers,coordSystem:d.coordSystem,mainAxis:(0,p.readMainAxis)(d.coordSystem)}))),c=e.id;return(0,v.useEffect)(()=>()=>{const d=a.getState();l.readStanding(d,"difference-arrow-endpoint-drag")?.annotationId===c&&d.releaseInteraction("difference-arrow-endpoint-drag")},[a,c]),(0,v.useCallback)(d=>({onKeyDown:h=>{if(h.altKey||h.ctrlKey||h.metaKey||h.shiftKey)return;const u=a.getState(),m=l.readDraggedDifferenceArrowEndpointFor(l.readStanding(u,"difference-arrow-endpoint-drag"),e.id,d);if(Zc.includes(h.key)){if(h.preventDefault(),h.repeat)return;if(m===null)return u.claimInteraction({kind:"difference-arrow-endpoint-drag",annotationId:e.id,endpoint:d,point:e[d]});u.releaseInteraction("difference-arrow-endpoint-drag"),jr({dispatch:t.dispatch,arrow:e,endpoint:d,anchor:m.point.anchor});return}if(m===null)return;const g=Jc(h.key,s);if(g===null)return;h.preventDefault();const x=Qc({arrow:e,endpoint:d,from:m.point.anchor,move:g,layers:o,coordSystem:i,resolver:r});x!==null&&u.claimInteraction({kind:"difference-arrow-endpoint-drag",annotationId:e.id,endpoint:d,point:x})}}),[e,a,t,r,o,i,s])},Jc=(e,t)=>{const r=e==="ArrowUp"||e==="ArrowDown";return!r&&!(e==="ArrowLeft"||e==="ArrowRight")?null:{axis:t==="x"===r?"cross":"main",step:e==="ArrowDown"||e==="ArrowRight"?1:-1}},Qc=({arrow:e,endpoint:t,from:r,move:a,layers:o,coordSystem:i,resolver:s})=>{const c=o.find(u=>u.id===r.layerId);if(c===void 0)return null;const d=s.createLayerMeasurement(c);if(d===null)return null;const{align:h}=e[t].anchor;return(0,p.stepDifferenceArrowEndpoint)({layer:c,from:r,partner:e[Cr(t)].anchor,axis:a.axis,step:a.step,getObservationPoint:(u,m)=>(0,p.resolveObservationPoint)({resolver:s,layer:c,observation:u,observationIndex:m,coordSystem:i,align:h,measurement:d})})?.point??null},ed=e=>{const t=me();return t===null?null:(0,n.jsx)(td,{annotationId:t,...e})},td=({annotationId:e,...t})=>{const r=l.useDifferenceArrowGeometries(),a=(0,v.useMemo)(()=>r.find(o=>o.id===e),[r,e]);return a===void 0?null:(0,n.jsx)(nd,{committedArrow:a.committedArrow,color:a.color,labelCornerRadius:a.style.label.cornerRadius,committedLabelBox:a.committedLabelBox,labelBox:a.labelBox,start:a.start,end:a.end,isDragged:a.isDragged,...t})},nd=({committedArrow:e,color:t,labelCornerRadius:r,committedLabelBox:a,labelBox:o,start:i,end:s,panelRect:c,panelOrigin:d,frameRect:h,frameElement:u,isDragged:m})=>{const g=Xc({arrow:e,panelOrigin:d,panelRect:c}),x=Yc({arrow:e});return(0,n.jsxs)("div",{"data-testid":"difference-arrow-selection",children:[!m&&(0,n.jsx)(Hc,{arrow:e,color:t,labelBox:a,panelRect:c,frameWidth:h.width,frameHeight:h.height,frameElement:u}),(0,n.jsx)("div",{"aria-hidden":"true",className:Uc,"data-testid":"difference-arrow-selection-label",style:{left:c.x+o.x-2,top:c.y+o.y-2,width:o.width+4,height:o.height+4,borderRadius:l.toBorderRadiusCss(r,2)}}),(0,n.jsx)(an,{endpoint:"start",point:i,panelRect:c,dragHandlers:g("start"),keyboardHandlers:x("start")}),(0,n.jsx)(an,{endpoint:"end",point:s,panelRect:c,dragHandlers:g("end"),keyboardHandlers:x("end")})]})},an=({endpoint:e,point:t,panelRect:r,dragHandlers:a,keyboardHandlers:o})=>(0,n.jsx)("div",{className:Vc,"data-testid":"difference-arrow-selection-handle","data-endpoint":e,role:"button",style:{left:r.x+t.x,top:r.y+t.y},tabIndex:0,...a,...o,children:(0,n.jsx)("span",{"aria-hidden":"true",className:$c})}),ot=({start:e,extent:t,isStartMoving:r,delta:a,minExtent:o})=>{if(!Number.isFinite(a))return{start:e,extent:t};const i=e+t,s=Math.min(o,t);if(r){const h=Math.min(0,e),u=Math.min(Math.max(1,e),i-s),m=(0,te.default)(e+a,h,u);return{start:m,extent:i-m}}const c=Math.max(Math.min(0,i),e+s),d=Math.max(1,i);return{start:e,extent:(0,te.default)(i+a,c,d)-e}},rd=["top-left","top-right","bottom-right","bottom-left"];var wr=({width:e,height:t})=>({x:W(16,e),y:W(16,t)}),ad=(e,t)=>({x:kr(t)?e.x:e.x+e.width,y:Pr(t)?e.y:e.y+e.height}),St=e=>({x:e.x,y:1-e.y-e.height,width:e.width,height:e.height}),Tr=({region:e,corner:t,delta:r,minSize:a})=>{const o=ot({start:e.x,extent:e.width,isStartMoving:kr(t),delta:r.x,minExtent:a.x}),i=ot({start:e.y,extent:e.height,isStartMoving:Pr(t),delta:r.y,minExtent:a.y});return{anchorType:"panel",x:o.start,y:i.start,width:o.extent,height:i.extent}},Ar=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,kr=e=>e==="top-left"||e==="bottom-left",Pr=e=>e==="top-left"||e==="top-right",Lr=(e,t,r,a)=>{const o=e.textAnnotations.find(i=>i.id===t);return o===void 0?null:l.measureTextAnnotationBox(l.previewResizedText(o,r),a)};var od={hovered:"_1ee8fau1 _1ee8fau0",selected:"_1ee8fau2 _1ee8fau0"},id={hovered:"_1ee8fau4 _1ee8fau3",selected:"_1ee8fau5 _1ee8fau3"},sd=({panelRect:e})=>{const t=l.useResolvedAnnotations(e),r=l.useMeasuredBoxes(),a=l.useStyleReaderTree(),o=me(),i=l.useEditorState(b=>l.readStanding(b,"move-drag")),s=l.useEditorState(b=>l.readStanding(b,"shape-resize-drag")),c=l.useEditorState(b=>l.readStanding(b,"arrow-endpoint-drag")),d=l.useEditorState(b=>l.readStanding(b,"text-resize-drag")),h=l.useEditorState(l.readAnnotationUnderPointer),u=(0,v.useMemo)(()=>({panel:{width:e.width,height:e.height},measuredBoxes:r,readers:a}),[e.width,e.height,r,a]),m=on(t,o,u),g=on(t,h===o?null:h,u),x=b=>{if(s?.annotationId===b.id){const w=t.shapes.find(T=>T.id===b.id);return w===void 0?b.geometry:l.measureShapeRegion(St(s.region),a.annotation.shape(w.id).get("strokeWidth"),u.panel)}if(c?.annotationId===b.id){const w=t.arrows.find(T=>T.id===b.id);return w===void 0?b.geometry:l.measureArrowEnds(bt(w,c),u.panel)??b.geometry}return d?.annotationId===b.id?Lr(t,b.id,d,u)??b.geometry:b.geometry},f=b=>{if(i?.annotationId!==b)return e;const w=Sr(i.translation,e);return{x:e.x+w.x,y:e.y+w.y}};return(0,n.jsxs)(n.Fragment,{children:[g!==null&&(0,n.jsx)(sn,{annotationId:g.id,geometry:x(g),state:"hovered",origin:f(g.id)}),m!==null&&(0,n.jsx)(sn,{annotationId:m.id,geometry:x(m),state:"selected",origin:f(m.id)})]})},on=(e,t,r)=>{if(t===null)return null;const a=l.resolveAnnotationChromeGeometry(e,t,r);return a===null?null:{id:t,geometry:a}},sn=({annotationId:e,geometry:t,state:r,origin:a})=>t.shape==="segment"?(0,n.jsxs)("div",{"aria-hidden":"true","data-testid":"annotation-chrome","data-annotation-id":e,"data-state":r,children:[(0,n.jsx)(ln,{point:t.start,state:r,origin:a}),(0,n.jsx)(ln,{point:t.end,state:r,origin:a})]}):(0,n.jsx)("div",{"aria-hidden":"true",className:od[r],"data-testid":"annotation-chrome","data-annotation-id":e,"data-state":r,style:{left:a.x+t.rect.x-2,top:a.y+t.rect.y-2,width:t.rect.width+4,height:t.rect.height+4}}),ln=({point:e,state:t,origin:r})=>(0,n.jsx)("span",{className:id[t],style:{left:r.x+e.x,top:r.y+e.y}}),ld=({panelRect:e})=>{const t=l.useEditorState(o=>l.readStanding(o,"move-drag")),r=l.useResolvedAnnotations(e);if(t===null)return null;const a=Sr(t.translation,e);return(0,n.jsx)("svg",{"aria-hidden":"true",className:ft,width:e.width,height:e.height,style:{left:e.x+a.x,top:e.y+a.y},"data-testid":"annotation-preview","data-annotation-id":t.annotationId,children:ud(r,t.annotationId,e)})},cd=({annotation:e,panel:t})=>{const r=l.useMeasuredBoxRef(e.id);return(0,n.jsx)(l.TextAnnotation,{annotation:e,panel:t,style:l.useStyleReaderTree().annotation.text(e.id).resolve(),blockRef:r})},Se=(e,t,r)=>{const a=e.find(o=>o.id===t);return a===void 0?null:r(a)},dd={text:(e,t,r)=>Se(e.textAnnotations,t,a=>(0,n.jsx)(cd,{annotation:a,panel:r})),shape:(e,t,r)=>Se(e.shapes,t,a=>(0,n.jsx)(pd,{shape:a,panelSize:r})),image:(e,t,r)=>Se(e.images,t,a=>(0,n.jsx)(md,{image:a,panelSize:r})),arrow:(e,t,r)=>Se(e.arrows,t,a=>(0,n.jsx)(hd,{arrow:a,panelSize:r}))},ud=(e,t,r)=>{for(const a of Object.values(dd)){const o=a(e,t,r);if(o!==null)return o}return null},hd=({arrow:e,panelSize:t})=>{const r=(0,p.resolveArrowAnnotationStyle)(l.useStyleReaderTree(),e.id),a=(0,p.computeArrow)({arrow:e,style:r,panelWidth:t.width,panelHeight:t.height});return a===null?null:(0,n.jsx)(l.ArrowAnnotation,{computed:a,style:r,isAddressable:!1})},pd=({shape:e,panelSize:t})=>(0,n.jsx)(l.ShapeAnnotation,{shape:e,style:l.useStyleReaderTree().annotation.shape(e.id).resolve(),panel:t}),md=({image:e,panelSize:t})=>(0,n.jsx)(l.ImageAnnotation,{image:e,panel:t,style:l.useStyleReaderTree().annotation.image(e.id).resolve()}),gd=({panelRect:e})=>{const t=l.useEditorState(i=>l.readStanding(i,"shape-resize-drag")),r=l.useResolvedAnnotations(e).shapes,a=l.useStyleReaderTree();if(t===null)return null;const o=r.find(i=>i.id===t.annotationId);return o===void 0?null:(0,n.jsx)("svg",{"aria-hidden":"true",className:ft,width:e.width,height:e.height,style:{left:e.x,top:e.y},"data-testid":"shape-resize-preview","data-annotation-id":t.annotationId,children:(0,n.jsx)(l.ShapeAnnotation,{shape:{...o,region:St(t.region)},style:a.annotation.shape(o.id).resolve(),panel:e})})},xd={sm:"o49ib40",md:"o49ib41"},vd={horizontal:"o49ib42",diagonalDown:"o49ib43",diagonalUp:"o49ib44"},Ir=({point:e,label:t,pull:r,size:a,attributes:o,dragHandlers:i,keyboardHandlers:s})=>(0,n.jsx)("div",{"aria-label":t,className:vd[r],role:"button",style:{left:e.x,top:e.y},tabIndex:0,...o,...i,...s,children:(0,n.jsx)("span",{"aria-hidden":"true",className:xd[a]})}),it=[{width:0,key:"graph.annotations.shapeToolbar.border.none"},{width:2,key:"graph.annotations.shapeToolbar.border.thin"},{width:8,key:"graph.annotations.shapeToolbar.border.medium"},{width:16,key:"graph.annotations.shapeToolbar.border.thick"}],fd=e=>[...it].reverse().find(t=>t.width<=e)??it[0],bd=({shape:e,shapeBox:t,panelRect:r,frameWidth:a,frameHeight:o,frameElement:i})=>{const s=l.useI18n(),{commands:c}=l.useGraphContext(),d=l.useSceneSelector(y=>y.spec.styles.overrides),h=ze(),u=l.useStyleReaderTree().annotation.shape(e.id).resolve(),m=fd(u.strokeWidth),g=(0,v.useMemo)(()=>({target:"annotation",kind:"shape",annotation:e.id}),[e.id]),x=(y,k)=>{const j=(0,p.findStyleRule)(d,{select:g})?.declarations??{};c.dispatch(new p.SetStyleRuleCommand({list:"overrides",rule:{select:g,declarations:{...j,...y}}}),k)},f=()=>{c.dispatch(new p.RemoveAnnotationCommand({id:e.id})),i.focus({preventScroll:!0})},b=y=>x({fill:y},{transient:!0}),w=y=>x({fillAlpha:y},{transient:!0}),T=y=>()=>{x({strokeWidth:y}),h.close()};return(0,n.jsxs)(R.Root,{anchorBox:t,panelRect:r,frameWidth:a,frameHeight:o,label:s("graph.annotations.shapeToolbar.label"),testId:"shape-toolbar",children:[(0,n.jsx)(R.ColorPicker,{color:(0,p.toPaintColor)(u.fill),label:s("graph.annotations.shapeToolbar.color"),onChange:b,opacity:u.fillAlpha,onOpacityChange:w,...h.bind("color"),children:(0,n.jsx)(R.Swatch,{color:(0,p.toPaintColor)(u.fill),opacity:u.fillAlpha})}),(0,n.jsx)(R.Dropdown,{label:s("graph.annotations.shapeToolbar.border.ariaLabel"),trigger:(0,n.jsx)(br,{size:"sm",title:""}),...h.bind("border"),children:it.map(y=>(0,n.jsx)(R.MenuItem,{isSelected:y.width===m?.width,onClick:T(y.width),children:s(y.key)},y.width))}),(0,n.jsx)(R.Separator,{}),(0,n.jsx)(R.IconButton,{label:s("graph.annotations.shapeToolbar.remove"),onClick:f,children:(0,n.jsx)(Fe,{size:"sm",title:""})})]})},Er=e=>{const t=l.useLatestRef(e),r=(0,v.useRef)(null);return(0,v.useEffect)(()=>()=>r.current?.finish(!1),[]),(0,v.useCallback)(a=>({onPointerDown:o=>{if(o.button!==0||r.current!==null)return;try{o.currentTarget.setPointerCapture(o.pointerId)}catch{return}o.currentTarget.focus({preventScroll:!0}),o.preventDefault();const i=t.current(a,{handle:o.currentTarget,pointerId:o.pointerId,press:{x:o.clientX,y:o.clientY},onSettled:()=>{r.current=null}});r.current=i,i.start()}}),[t])},Pe=(e,t)=>{const r=e.shapes.find(a=>a.id===t);return r===void 0||r.region.anchorType!=="panel"?null:r.region},Sd=class extends ge{constructor(...e){super(...e),this.kind="shape-resize-drag"}readOwn(e){return l.readResizedShapeFor(l.readStanding(e,"shape-resize-drag"),this.params.annotationId)}resolvePreview(e){const{annotationId:t,corner:r,press:a,readInputs:o}=this.params,{annotations:i,panelRect:s}=o(),c=Pe(i,t);return c===null?null:{kind:"shape-resize-drag",annotationId:t,region:Tr({region:c,corner:r,delta:Be(a,e,s),minSize:wr(s)})}}commit({region:e}){const{annotationId:t,dispatch:r,readInputs:a}=this.params,o=Pe(a().annotations,t);o===null||Ar(o,e)||r(new p.UpdateAnnotationCommand({kind:"shape",id:t,patch:{region:e}}))}},yd=({annotationId:e,panelRect:t})=>{const{commands:r}=l.useGraphContext(),a=l.useEditorStore(),o=l.useLatestRef({annotations:l.useSceneSelector(i=>i.spec.annotations),panelRect:t});return Er((i,s)=>new Sd({...s,annotationId:e,corner:i,readInputs:()=>o.current,editorStore:a,dispatch:r.dispatch}))},Cd=[" ","Enter"],Mr=e=>{const t=l.useEditorStore(),r=l.useLatestRef(e);return(0,v.useEffect)(()=>()=>cn(t,r.current),[t,r]),(0,v.useCallback)(a=>({onKeyDown:o=>{if(o.altKey||o.ctrlKey||o.metaKey||o.shiftKey)return;const i=t.getState(),s=r.current.readHeld();if(Cd.includes(o.key)){if(o.preventDefault(),o.repeat)return;if(s!==null){cn(t,r.current);return}const d=r.current.claim(a);if(d===null)return;i.claimInteraction(d);return}if(s===null)return;const c=r.current.step(s,a,o.key);c!==null&&(o.preventDefault(),i.claimInteraction(c))}}),[t,r])},cn=(e,t)=>{const r=t.readHeld();r!==null&&(e.getState().releaseInteraction(r.kind),t.commit(r))},dn=4,jd=({annotationId:e,panelRect:t})=>{const{commands:r}=l.useGraphContext(),a=l.useEditorStore(),o=l.useSceneSelector(i=>i.spec.annotations);return Mr({readHeld:()=>l.readResizedShapeFor(l.readStanding(a.getState(),"shape-resize-drag"),e),claim:()=>{const i=Pe(o,e);return i===null?null:{kind:"shape-resize-drag",annotationId:e,region:i}},step:(i,s,c)=>{const d=wd(c,t);return d===null?null:{kind:"shape-resize-drag",annotationId:e,region:Tr({region:i.region,corner:s,delta:d,minSize:wr(t)})}},commit:({region:i})=>{const s=Pe(o,e);s===null||Ar(s,i)||r.dispatch(new p.UpdateAnnotationCommand({kind:"shape",id:e,patch:{region:i}}))}})},wd=(e,t)=>{const r=W(dn,t.width),a=W(dn,t.height);switch(e){case"ArrowLeft":return{x:-r,y:0};case"ArrowRight":return{x:r,y:0};case"ArrowUp":return{x:0,y:-a};case"ArrowDown":return{x:0,y:a};default:return null}},Td={"top-left":"diagonalDown","bottom-right":"diagonalDown","top-right":"diagonalUp","bottom-left":"diagonalUp"},Ad=e=>{const t=me(),r=Pd(t),a=Ld(t);if(r===null)return null;const o=a.resizedRegion??(r.region.anchorType==="panel"?r.region:null);return o===null?null:(0,n.jsx)(kd,{shape:r,region:o,isSettled:a.resizedRegion===null&&!a.isMoved,isMoved:a.isMoved,...e})},kd=({shape:e,region:t,isSettled:r,isMoved:a,panelRect:o,frameRect:i,frameElement:s})=>{const c=l.useI18n(),d=yd({annotationId:e.id,panelRect:o}),h=jd({annotationId:e.id,panelRect:o}),u=l.useStyleReaderTree().annotation.shape(e.id).resolve(),{rect:m}=l.measureShapeRegion(St(t),u.strokeWidth,o);return(0,n.jsxs)("div",{"data-testid":"shape-selection","data-annotation-id":e.id,children:[r&&(0,n.jsx)(bd,{shape:e,shapeBox:m,panelRect:o,frameWidth:i.width,frameHeight:i.height,frameElement:s}),!a&&rd.map(g=>{const x=ad(m,g);return(0,n.jsx)(Ir,{point:{x:o.x+x.x,y:o.y+x.y},label:c(`graph.annotations.shapeToolbar.resize.${g}`),pull:Td[g],size:"md",attributes:{"data-testid":"shape-resize-handle","data-corner":g},dragHandlers:d(g),keyboardHandlers:h(g)},g)})]})},Pd=e=>{const t=l.useSceneSelector(r=>r.spec.annotations.shapes);return e===null?null:t.find(r=>r.id===e)??null},Ld=e=>l.useEditorState((0,Y.useShallow)(t=>e===null?{resizedRegion:null,isMoved:!1}:{resizedRegion:l.readResizedShapeFor(l.readStanding(t,"shape-resize-drag"),e)?.region??null,isMoved:l.readMovedAnnotationFor(l.readStanding(t,"move-drag"),e)!==null})),Id=({textColor:e,...t})=>(0,n.jsxs)(l.Icon,{...t,children:[(0,n.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",children:[(0,n.jsx)("path",{d:"M6 4h12"}),(0,n.jsx)("path",{d:"M12 4v12"})]}),(0,n.jsx)("path",{d:"M5 20h14",stroke:e??"currentColor",strokeWidth:3,strokeLinecap:"round"})]});var Le="textStyle",Rr=new Set(["paragraph","heading"]),Ed=e=>{const t=Or(e),r=Dd(e);return{color:ye(t.map(a=>Fd(Xe(a)?.color))),font:ye(t.map(a=>Nd(Xe(a)))),fontSize:ye(t.map(a=>zd(Xe(a)?.fontSize))),alignment:ye(r.map(a=>Bd(a.attrs?.textAlign)))}},Md=(e,t)=>yt(e,r=>r.type==="text"?_d(r,t):r),Rd=e=>Or(e).length>0,Od=(e,t)=>yt(e,r=>Rr.has(r.type??"")?{...r,attrs:{...r.attrs,textAlign:t}}:r),yt=(e,t)=>t(e.content===void 0?e:{...e,content:e.content.map(r=>yt(r,t))}),_d=(e,t)=>{const r=e.marks??[],a=r.find(i=>i.type===Le),o={type:Le,attrs:{...a?.attrs,...t}};return{...e,marks:a===void 0?[...r,o]:r.map(i=>i===a?o:i)}},Xe=e=>e.marks?.find(t=>t.type===Le)?.attrs,Nd=e=>l.readRichTextFontId(e?.font)??l.readRichTextFontId(e?.fontFamily),Or=e=>Ct(e,t=>t.type==="text"),Dd=e=>Ct(e,t=>Rr.has(t.type??"")),Ct=(e,t)=>[...t(e)?[e]:[],...(e.content??[]).flatMap(r=>Ct(r,t))],ye=e=>{const[t,...r]=e;return t===void 0?null:r.every(a=>a===t)?t:null},Fd=e=>typeof e=="string"&&e.length>0?e:void 0,zd=e=>typeof e=="number"&&Number.isFinite(e)?e:void 0,Bd=e=>e==="left"||e==="center"||e==="right"?e:void 0;var _r=[{id:"modern",key:"graph.annotations.textToolbar.font.modern"},{id:"fresh",key:"graph.annotations.textToolbar.font.fresh"},{id:"timeless",key:"graph.annotations.textToolbar.font.timeless"},{id:"technical",key:"graph.annotations.textToolbar.font.technical"},{id:"fineliner",key:"graph.annotations.textToolbar.font.fineliner"}].map(({id:e,key:t})=>({id:e,key:t,fontFamily:l.RICH_TEXT_FONT_FAMILIES[e]??e})),Hd=e=>_r.find(t=>t.id===(e??"modern"))??null;var Nr=[{size:12,key:"graph.annotations.textToolbar.fontSize.small"},{size:15,key:"graph.annotations.textToolbar.fontSize.medium"},{size:18,key:"graph.annotations.textToolbar.fontSize.large"},{size:24,key:"graph.annotations.textToolbar.fontSize.extraLarge"},{size:30,key:"graph.annotations.textToolbar.fontSize.huge"}],Gd=e=>Nr.find(t=>t.size===(e??15))??null,Vd=e=>`${e}px`,$d=[{alignment:"left",Icon:Yn},{alignment:"center",Icon:Xn},{alignment:"right",Icon:Zn}],Ud=({annotation:e,textBox:t,panelRect:r,frameWidth:a,frameHeight:o,frameElement:i})=>{const s=l.useI18n(),{commands:c}=l.useGraphContext(),d=l.useSceneSelector(S=>S.spec.styles.overrides),h=l.useEditorStore(),u=ze(),m=l.useStyleReaderTree().annotation.text(e.id).resolve(),g=Ed(e.content),x=Hd(g.font),f=Gd(g.fontSize),b=g.color??m.textColor,w=(0,v.useMemo)(()=>({target:"annotation",kind:"text",annotation:e.id}),[e.id]),T=(S,z)=>{const V=(0,p.findStyleRule)(d,{select:w})?.declarations??{};c.dispatch(new p.SetStyleRuleCommand({list:"overrides",rule:{select:w,declarations:{...V,...S}}}),z)},y=(S,z)=>{c.dispatch(new p.UpdateAnnotationCommand({kind:"text",id:e.id,patch:S}),z)},k=()=>h.getState().caret?.editor?.getJSON()??e.content,j=(S,z)=>{const V=k(),J=h.getState().caret?.editor??null;if(J!==null&&!Rd(V)){J.chain().focus().setMark(Le,S).run();return}y({content:Md(V,S)},z)},I=()=>{c.dispatch(new p.RemoveAnnotationCommand({id:e.id})),i.focus({preventScroll:!0})},P=S=>T(Wd(S),{transient:!0}),E=S=>j({color:S},{transient:!0}),O=S=>()=>{j({font:S}),u.close()},M=S=>()=>{j({fontSize:S}),u.close()},C=S=>y({content:Od(k(),S)});return(0,n.jsxs)(R.Root,{anchorBox:t,panelRect:r,frameWidth:a,frameHeight:o,label:s("graph.annotations.textToolbar.label"),testId:"text-toolbar",children:[(0,n.jsx)(R.ColorPicker,{color:(0,p.toPaintColor)(m.fill),label:s("graph.annotations.textToolbar.background"),hasTransparentOption:!0,onChange:P,...u.bind("background"),children:(0,n.jsx)(R.Swatch,{color:m.fill==="transparent"?_n:(0,p.toPaintColor)(m.fill)})}),(0,n.jsx)(R.ColorPicker,{color:b,label:s("graph.annotations.textToolbar.color"),onChange:E,...u.bind("color"),children:(0,n.jsx)(Id,{size:"sm",textColor:b,title:""})}),(0,n.jsx)(R.Dropdown,{label:s("graph.annotations.textToolbar.font.ariaLabel"),trigger:(0,n.jsx)("span",{style:{fontFamily:x?.fontFamily},children:"Aa"}),...u.bind("font"),children:_r.map(S=>(0,n.jsx)(R.MenuItem,{isSelected:S.id===x?.id,onClick:O(S.id),children:(0,n.jsx)("span",{style:{fontFamily:S.fontFamily},children:s(S.key)})},S.id))}),(0,n.jsx)(R.Dropdown,{label:s("graph.annotations.textToolbar.fontSize.ariaLabel"),trigger:f===null?"":s(f.key),...u.bind("fontSize"),children:Nr.map(S=>(0,n.jsx)(R.MenuItem,{isSelected:S.size===f?.size,onClick:M(S.size),children:(0,n.jsx)("span",{style:{fontSize:Vd(S.size)},children:s(S.key)})},S.size))}),(0,n.jsx)(R.Separator,{}),(0,n.jsx)(qd,{current:g.alignment??"center",onPick:C}),(0,n.jsx)(R.Separator,{}),(0,n.jsx)(R.IconButton,{label:s("graph.annotations.textToolbar.remove"),onClick:I,children:(0,n.jsx)(Fe,{size:"sm",title:""})})]})},Wd=e=>e==="transparent"?{fill:zn}:{fill:e,fillAlpha:Io(e)?p.TEXT_ANNOTATION_FADE_ALPHA:1},qd=({current:e,onPick:t})=>{const r=l.useI18n(),a=o=>()=>t(o);return(0,n.jsx)(n.Fragment,{children:$d.map(o=>(0,n.jsx)(R.ToggleButton,{label:r(`graph.annotations.textToolbar.align.${o.alignment}`),isPressed:o.alignment===e,onClick:a(o.alignment),children:(0,n.jsx)(o.Icon,{size:"sm",title:""})},o.alignment))})},Kd=["left","right"];var Dr=({width:e})=>W(60,e),Xd=(e,t)=>({x:t==="left"?e.x:e.x+e.width,y:e.y+e.height/2}),Fr=({at:e,width:t,align:r,edge:a,delta:o,minWidth:i,panelWidth:s})=>{if(o===0)return{at:e,width:t,shift:0};const c=(0,p.alignUnitFractions)(r).x,d=Zd(e.offset,s),h=ot({start:e.x+d-c*t,extent:t,isStartMoving:a==="left",delta:o,minExtent:i}),u=h.start+c*h.extent-d;return{at:{...e,x:u},width:h.extent,shift:u-e.x}},zr=(e,t)=>e.at.x===t.at.x&&e.width===t.width,Zd=(e,t)=>e?.x===void 0?0:e.unit==="px"?W(e.x,t):e.x,Ie=(e,t)=>{const r=e.textAnnotations.find(a=>a.id===t);return r===void 0||r.at.anchorType!=="panel"?null:{at:r.at,width:r.width,align:r.align}},Yd=class extends ge{constructor(...e){super(...e),this.kind="text-resize-drag"}readOwn(e){return l.readResizedTextFor(l.readStanding(e,"text-resize-drag"),this.params.annotationId)}resolvePreview(e){const{annotationId:t,edge:r,press:a,readInputs:o}=this.params,{annotations:i,panelRect:s}=o(),c=Ie(i,t);if(c===null)return null;const d=Be(a,e,s).x;return{kind:"text-resize-drag",annotationId:t,delta:d,...Fr({...c,edge:r,delta:d,minWidth:Dr(s),panelWidth:s.width})}}commit(e){const{annotationId:t,dispatch:r,readInputs:a}=this.params,o=Ie(a().annotations,t);o===null||zr(o,e)||r(new p.UpdateAnnotationCommand({kind:"text",id:t,patch:{at:e.at,width:e.width}}))}},Jd=({annotationId:e,panelRect:t})=>{const{commands:r}=l.useGraphContext(),a=l.useEditorStore(),o=l.useLatestRef({annotations:l.useSceneSelector(i=>i.spec.annotations),panelRect:t});return Er((i,s)=>new Yd({...s,annotationId:e,edge:i,readInputs:()=>o.current,editorStore:a,dispatch:r.dispatch}))},Qd=4,eu=({annotationId:e,panelRect:t})=>{const{commands:r}=l.useGraphContext(),a=l.useEditorStore(),o=l.useSceneSelector(s=>s.spec.annotations),i=(s,c)=>{const d=Ie(o,e);return d===null?null:{kind:"text-resize-drag",annotationId:e,delta:c,...Fr({...d,edge:s,delta:c,minWidth:Dr(t),panelWidth:t.width})}};return Mr({readHeld:()=>l.readResizedTextFor(l.readStanding(a.getState(),"text-resize-drag"),e),claim:s=>i(s,0),step:(s,c,d)=>{const h=tu(d,t);return h===null?null:i(c,s.delta+h)},commit:s=>{const c=Ie(o,e);c===null||zr(c,s)||r.dispatch(new p.UpdateAnnotationCommand({kind:"text",id:e,patch:{at:s.at,width:s.width}}))}})},tu=(e,t)=>{const r=W(Qd,t.width);switch(e){case"ArrowLeft":return-r;case"ArrowRight":return r;default:return null}},nu=e=>{const t=me(),r=au(t),a=ou(t),o=l.useEditorState(s=>s.caret?.annotationId===t),i=iu(e.panelRect,t,a.resized);return r===null||i===null?null:(0,n.jsx)(ru,{annotation:r,textBox:i,isSettled:a.resized===null&&!a.isMoved,isMoved:a.isMoved,isResizable:r.at.anchorType==="panel",hasCaret:o,...e})},ru=({annotation:e,textBox:t,isSettled:r,isMoved:a,isResizable:o,hasCaret:i,panelRect:s,frameRect:c,frameElement:d})=>{const h=l.useI18n(),u=Jd({annotationId:e.id,panelRect:s}),m=eu({annotationId:e.id,panelRect:s});return(0,n.jsxs)("div",{"data-testid":"text-selection","data-annotation-id":e.id,children:[r&&(0,n.jsx)(Ud,{annotation:e,textBox:t,panelRect:s,frameWidth:c.width,frameHeight:c.height,frameElement:d}),o&&!a&&!i&&Kd.map(g=>{const x=Xd(t,g);return(0,n.jsx)(Ir,{point:{x:s.x+x.x,y:s.y+x.y},label:h(`graph.annotations.textToolbar.resize.${g}`),pull:"horizontal",size:"sm",attributes:{"data-testid":"text-resize-handle","data-edge":g},dragHandlers:u(g),keyboardHandlers:m(g)},g)})]})},au=e=>{const t=l.useSceneSelector(r=>r.spec.annotations.textAnnotations);return e===null?null:t.find(r=>r.id===e)??null},ou=e=>l.useEditorState((0,Y.useShallow)(t=>e===null?{resized:null,isMoved:!1}:{resized:l.readResizedTextFor(l.readStanding(t,"text-resize-drag"),e),isMoved:l.readMovedAnnotationFor(l.readStanding(t,"move-drag"),e)!==null})),iu=(e,t,r)=>{const a=l.useResolvedAnnotations(e),o=l.useMeasuredBoxes(),i=l.useStyleReaderTree(),s=(0,v.useMemo)(()=>({panel:{width:e.width,height:e.height},measuredBoxes:o,readers:i}),[e.width,e.height,o,i]);return t===null?null:Lr(a,t,r,s)?.rect??null},su=e=>(0,n.jsx)(l.Icon,{...e,children:(0,n.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"M12 5v14"}),(0,n.jsx)("path",{d:"M5 12h14"})]})}),lu="var(--_1tyillx0)",cu={rest:.5,hovered:.75,open:1};var du="_1tyillx1",uu={rest:"_1tyillx2",hovered:"_1tyillx3",open:"_1tyillx4"},hu="_1tyillx5",pu={closed:"_1tyillx6",open:"_1tyillx7"},mu=({interaction:e,panelRect:t})=>{const r=l.useEditorStore(),a=e.kind==="trigger"||e.kind==="menu"?e.anchor:null,o=gu(e),i=(0,v.useMemo)(()=>{if(a===null)return null;const s=(0,p.projectAnchorToPanel)(a.position,t);return{center:s,radius:19*cu[o],target:{kind:"observation",cursor:(0,p.toPanelCursor)(s,t)}}},[a,t,o]);return(0,v.useEffect)(()=>{r.getState().setMenuTrigger(i)},[r,i]),(0,v.useEffect)(()=>()=>r.getState().setMenuTrigger(null),[r]),a===null||i===null?null:(0,n.jsx)("div",{"aria-hidden":"true","data-testid":"observation-menu-trigger","data-state":o,className:(0,U.default)(du,uu[o]),style:{left:t.x+i.center.x,top:t.y+i.center.y,...(0,Me.assignInlineVars)({[lu]:a.color})},children:(0,n.jsx)("span",{className:(0,U.default)(hu,pu[o==="open"?"open":"closed"]),children:(0,n.jsx)(su,{size:"lg"})})})},gu=e=>e.kind==="menu"?"open":e.kind==="trigger"&&e.isEngaged?"hovered":"rest",xu='button:not([disabled]):not([tabindex="-1"]), [tabindex]:not([tabindex="-1"])',vu=(e,t)=>{const{chartId:r}=l.useGraphContext(),a=l.useEditorStore();(0,v.useEffect)(()=>{if(t===null)return;const o=i=>{if(i.key!=="Tab"||i.defaultPrevented||!he(i.target,e,r)||tr(i.target)||a.getState().standingInteraction?.kind==="chrome-popup")return;const s=[...t.querySelectorAll(xu)];if(s.length===0)return;i.preventDefault();const c=s.findIndex(d=>d===document.activeElement);s[c===-1?i.shiftKey?s.length-1:0:(c+(i.shiftKey?-1:1)+s.length)%s.length]?.focus()};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[e,t,r,a])},fu=(e,t)=>typeof document.elementsFromPoint=="function"?document.elementsFromPoint(e,t):[],Br=(e,t,r)=>l.readStampedEditTargetInStack(fu(e,t),r),bu=e=>{const{selectionStore:t,chartId:r}=l.useGraphContext(),a=l.useEditorStore();(0,v.useEffect)(()=>{let o=null;const i=d=>{const{caret:h}=a.getState(),u=h===null?null:Br(d.clientX,d.clientY,e);u?.kind==="annotation"&&u.target.id===h?.annotationId||e.focus({preventScroll:!0})},s=d=>{const{selection:h,clearSelection:u}=t.getState();h.length!==0&&(he(d.target,e,r)||u())},c=d=>{t.getState().selection.length!==0&&he(d.target,e,r)&&d.relatedTarget===null&&(o!==null&&cancelAnimationFrame(o),o=requestAnimationFrame(()=>{o=null,document.hasFocus()&&(he(document.activeElement,e,r)||t.getState().clearSelection())}))};return e.addEventListener("pointerdown",i),document.addEventListener("focusin",s),document.addEventListener("focusout",c),()=>{o!==null&&cancelAnimationFrame(o),e.removeEventListener("pointerdown",i),document.removeEventListener("focusin",s),document.removeEventListener("focusout",c)}},[a,t,e,r])},Su=(e,t)=>{switch(e.kind){case"legend":{const r=t.legends[e.part.legendIndex],a=r?.items[e.part.itemIndex];if(r===void 0||a===void 0)return null;const o=yu(r,a.layerId,t.layers);return o===null?null:(0,p.buildObservationsTargetAtValue)({layer:o.layer,scope:"series",variable:o.variable,value:a.value,parsingLocale:t.parsingLocale})}case"axis":{const r=e.part;if(r===null||e.target.axis!=="x")return null;const a=t.formattedAxes.find(i=>i.scaleAestheticKey==="x");if(a===void 0||a.bandwidth===void 0)return null;const o=a.ticks[r.tickIndex];return o===void 0?null:wu(t.layers,o.value,t.parsingLocale)}case"annotation":case"grid":return null}},yu=(e,t,r)=>{const a=t===void 0?r:r.filter(o=>o.id===t);for(const o of e.aesthetics){const i=Cu(a,o);if(i!==null)return i}return null},Cu=(e,t)=>{for(const r of e){const a=(0,p.readVariableName)(r.mapping[t]);if(a!==null&&ju(r,a))return{layer:r,variable:a}}return null},ju=(e,t)=>e.data.hasVariable(t)&&e.data.getType(t)==="categorical",wu=(e,t,r)=>{let a=null;for(const o of e){if(!o.interactive)continue;const i=(0,p.readScopeXVariable)(o.mapping);if(i===null)continue;const s=(0,p.buildObservationsTargetAtValue)({layer:o,scope:"x-value",variable:i,value:t,parsingLocale:r});if(s!==null){if(a!==null)return null;a=s}}return a},Tu=new Set(["discrete","datetime"]),Au=({hover:e,layers:t,scales:r,parsingLocale:a})=>{const{primary:o,intersection:i}=e;if(o===null)return null;const s=(0,p.findLayerById)(t,o.layerId);if(s===void 0)return null;const c=(0,p.readObservationIndex)(o),d=i?.intersects!==!1,h=(0,p.readBroadestObservationsScope)(s),u=d||!Pu(r)?[h]:["x-value",h];for(const m of u){const g=(0,p.buildObservationsTarget)({layer:s,observationIndex:c,scope:m,parsingLocale:a});if(g!==null)return{layerId:s.id,observationIndex:c,isOnObservation:d,target:g}}return null},ku=(e,t,r)=>{if(!e.isOnObservation||e.target.scope!=="series")return null;const a=(0,p.findLayerById)(t,e.layerId);return a===void 0?null:(0,p.buildObservationsTarget)({layer:a,observationIndex:e.observationIndex,scope:"data-point",parsingLocale:r})},Pu=e=>{const t=e.x;return t?.kind!=="position"?!1:Tu.has(t.spec.scaleType)},Hr=(e,t)=>{const{target:r,clientX:a,clientY:o}=e,{frameElement:i,captureRect:s,menuTrigger:c,panelOrigin:d,resolvesObservations:h,scene:u}=t,m=c!==null&&(0,p.isPointWithinEditMenuTrigger)({x:a-d.x,y:o-d.y},c);if(!(r instanceof Element&&i.contains(r)))return{targetAtPoint:l.resolveEditTargetAtPoint({isMenuTrigger:m,stamped:un(!1,!1,e,t),observations:null}),hover:null};const g=s!==null&&r===s,x=g&&h?Lu(s):null,f=x===null?null:Eu(e,x,t),b=f===null?null:Au({hover:f,layers:u.layers,scales:u.scales,parsingLocale:u.config.parsingLocale}),w=l.resolveEditTargetAtPoint({isMenuTrigger:m,stamped:un(g,b!==null,e,t),observations:b});return{targetAtPoint:w,hover:w?.kind==="observations"?f:null}},Lu=e=>{const t=e.getBoundingClientRect();return t.width>0&&t.height>0?t:null},un=(e,t,r,{paintsAnnotations:a,resolvesGuides:o,frameElement:i,scene:s})=>{if(!a&&s.coordSystem.type==="cartesian"&&e&&t)return null;const c=e||a?Br(r.clientX,r.clientY,i):Iu(r.target,i);return c===null?null:(c.kind==="annotation"?a:o)?c:null},Iu=(e,t)=>e instanceof Element?l.readStampedEditTargetInStack([e],t):null,Eu=(e,t,r)=>{const a={x:e.clientX-t.left,y:e.clientY-t.top};return r.engine.query((0,p.toPanelCursor)(a,t),r.tolerance,t)},Mu=class extends ge{constructor(...e){super(...e),this.kind="move-drag"}readOwn(e){return l.readMovedAnnotationFor(l.readStanding(e,"move-drag"),this.params.annotationId)}resolvePreview(e){const{annotationId:t,press:r,readInputs:a}=this.params,{annotations:o,panelRect:i}=a(),s=(0,p.findAnnotation)(o,t);if(s===null)return null;const c=(0,p.clampAnnotationTranslation)(s,Be(r,e,i));return c===null?null:{kind:"move-drag",annotationId:t,translation:c}}commit({translation:e}){const{annotationId:t,dispatch:r}=this.params;Sc(e)&&r(new p.MoveAnnotationCommand({id:t,translation:e}))}},Ru=(e,{canSelectGraph:t,isWithinFrame:r,caretAnnotationId:a})=>{switch(e?.kind){case"annotation":return e.target.id===a?{kind:"keep-caret"}:{kind:"select-annotation",target:e.target};case"axis":case"legend":case"grid":return{kind:"select-guide",target:e.target};case"observations":return Ou(e.observations);case"menu-trigger":case void 0:break}return t&&r?{kind:"select-graph",target:{kind:"graph"}}:{kind:"clear"}},Ou=({target:e})=>e.scope==="x-value"?{kind:"select-band",target:e}:{kind:"select-observations",target:e},_u=(e,t,r,a,o)=>{const{commands:i,selectionStore:s,store:c}=l.useGraphContext(),d=l.useEditorStore(),h=l.useSceneSelector(w=>w.spec.annotations),u=l.MODE_SURFACES[l.useGraphMode()],m=l.useLatestRef(u.graphPress),g=l.useLatestRef({annotations:h,panelRect:r}),x=l.useLatestRef(t),f=l.useLatestRef(o),b=(0,v.useRef)(null);(0,v.useEffect)(()=>()=>b.current?.finish(!1),[]),(0,v.useEffect)(()=>{const w=P=>Hr({target:P.target,clientX:P.clientX,clientY:P.clientY},a()).targetAtPoint,T=P=>{if(!(P.target instanceof Element))return!1;const E=P.target.closest(l.LEGEND_OVERFLOW_CONTROL_SELECTOR);return E!==null&&e.contains(E)&&l.readStampedEditTargetInStack([P.target],e)===null},y=(P,E)=>{if(b.current!==null||!l.canMoveAnnotationOnCanvas(g.current.annotations,E.id))return;try{e.setPointerCapture(P.pointerId)}catch{return}P.preventDefault();const O=new Mu({handle:e,pointerId:P.pointerId,annotationId:E.id,press:{x:P.clientX,y:P.clientY},readInputs:()=>g.current,editorStore:d,dispatch:i.dispatch,onSettled:()=>{b.current=null}});b.current=O,O.start()},k=(P,E)=>{const O=s.getState();switch(E.kind){case"select-annotation":O.setSelection([E.target]),y(P,E.target);return;case"select-observations":case"select-band":case"select-guide":case"select-graph":O.setSelection([E.target]);return;case"clear":O.clearSelection();return;default:throw new p.InternalError({message:`No press outcome for: ${JSON.stringify(E)}`})}},j=P=>{if(P.button!==0||rt(P.target)||nr(P,x.current,d.getState().menuTrigger)||T(P))return;const E=Ru(w(P),{canSelectGraph:m.current,isWithinFrame:P.target instanceof Node&&e.contains(P.target),caretAnnotationId:d.getState().caret?.annotationId??null});E.kind!=="keep-caret"&&(d.getState().setCaret(null),k(P,E))},I=P=>{if(rt(P.target)||T(P))return;const E=w(P),{layers:O,guides:M,config:C}=c.getState().scene,S=s.getState(),z=d.getState();switch(E?.kind){case"observations":{const{observations:V}=E,J=ku(V,O,C.parsingLocale);if(J===null)return;S.setSelection([J]);return}case"axis":case"legend":{const V=Su(E,{layers:O,legends:M.legends.drawn,formattedAxes:f.current,parsingLocale:C.parsingLocale});if(V===null)return;S.setSelection([V]);return}case"annotation":{const{target:V}=E;if(!g.current.annotations.textAnnotations.some(J=>J.id===V.id))return;S.setSelection([V]),z.setCaret(V.id);return}case"grid":case"menu-trigger":case void 0:return}};return document.addEventListener("pointerdown",j),document.addEventListener("dblclick",I),()=>{document.removeEventListener("pointerdown",j),document.removeEventListener("dblclick",I)}},[e,d,s,c,i,g,x,f,m,a])},Nu=e=>{const{selectionStore:t,commands:r,chartId:a}=l.useGraphContext(),o=l.useEditorStore(),i=l.useLatestRef(l.useSceneSelector(u=>u.spec.annotations.textAnnotations)),{annotations:s}=l.MODE_SURFACES[l.useGraphMode()],c=(0,v.useCallback)(u=>{const{selection:m}=t.getState(),g=s?at(m):null;g!==null&&(u.preventDefault(),r.dispatch(new p.RemoveAnnotationCommand({id:g})),e.focus({preventScroll:!0}))},[e,r,t,s]),d=(0,v.useCallback)(u=>{if(je(u.target,a))return;const m=s?at(t.getState().selection):null;m!==null&&i.current.some(g=>g.id===m)&&(u.preventDefault(),o.getState().setCaret(m))},[o,t,i,a,s]),h=(0,v.useCallback)(u=>{const m=o.getState(),g=m.standingInteraction?.kind;if(g!==void 0){g!=="chrome-popup"&&m.releaseInteraction(g);return}if(m.caret!==null){m.setCaret(null),e.focus({preventScroll:!0});return}return je(u.target,a)?e.focus({preventScroll:!0}):t.getState().clearSelection()},[o,t,e,a]);(0,v.useEffect)(()=>{const u=m=>{if(!he(m.target,e,a)||tr(m.target))return;const g=Du(m.target),x=o.getState().caret!==null&&!je(m.target,a);if(!(g&&!x))switch(m.key){case"Escape":return h(m);case"Enter":return g?void 0:d(m);case"Delete":case"Backspace":return g?void 0:c(m);default:return}};return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[e,c,d,h,a,o])},Du=e=>e instanceof HTMLElement&&(e.isContentEditable||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement),Fu=(e,t)=>{const r=l.useEditorStore(),{store:a}=l.useGraphContext(),{engine:o,overlayRef:i}=l.useHoverContext(),s=l.useLatestRef(t),{annotations:c,observationsPress:d,guidePress:h,tolerance:u}=l.MODE_SURFACES[l.useGraphMode()];return(0,v.useCallback)(()=>({frameElement:e,captureRect:i.current,panelOrigin:s.current,menuTrigger:r.getState().menuTrigger,resolvesGuides:h,paintsAnnotations:c,resolvesObservations:d,engine:o,tolerance:u??void 0,scene:a.getState().scene}),[e,i,s,r,h,c,d,o,u,a])},zu=()=>{const e=l.MODE_SURFACES[l.useGraphMode()].observationMenu,t=l.useHoverState(s=>e?s.hover.primary:null),{layers:r,coordSystem:a}=l.useSceneSelector((0,Y.useShallow)(s=>({layers:s.layers,coordSystem:s.coordSystem}))),{anchorResolver:o}=l.useGraphContext(),i=l.useGeomReaderTree();return(0,v.useMemo)(()=>{if(t===null)return null;const s=r.find(h=>h.id===t.layerId);if(s===void 0)return null;const c=o.resolve(s.geom,t.observation,{coordSystem:a,position:s.position,purpose:"pin"});if(c===null)return null;const d=(0,p.createObservationAnchorBuilder)(s)(t.observation);return d===null?null:{position:c,color:(0,p.readGeomColor)({geom:i},s,t.observation)??p.DEFAULT_GEOM_COLOR,layer:s,at:d,observation:t.observation}},[t,r,a,o,i])},Bu={kind:"idle"},Gr=()=>{const e=l.useEditorState(a=>a.standingInteraction),t=l.useEditorState(a=>a.editTargetUnderPointer?.kind==="menu-trigger"),r=zu();return(0,v.useMemo)(()=>e!==null?e:r===null?Bu:{kind:"trigger",anchor:r,isEngaged:t},[e,r,t])},Hu=(e,t)=>e.x>=0&&e.x<=t.width&&e.y>=0&&e.y<=t.height,Gu=(e,t,r)=>{const a=l.useEditorStore(),{selectionStore:o}=l.useGraphContext(),{store:i,engine:s}=l.useHoverContext(),c=l.useLatestRef(e),d=l.useLatestRef(t),h=l.useLatestRef(r);(0,v.useEffect)(()=>{const u=b=>nr(b,d.current,a.getState().menuTrigger),m=b=>{if(u(b)||o.getState().selection.length>0)return;const w=h.current,T=d.current,y={x:b.clientX-T.x,y:b.clientY-T.y},k=Hu(y,w)?s.query((0,p.toPanelCursor)(y,w)):p.RESTING_HOVER_STATE;i.getState().setHoverState(k)};let g=!1;const x=()=>{g=c.current.kind==="menu"},f=b=>{if(rt(b.target))return;const{claimInteraction:w,releaseInteraction:T}=a.getState();if(!u(b)||g){T("menu"),g&&m(b);return}const y=c.current;y.kind==="trigger"&&w({kind:"menu",anchor:y.anchor})};return document.addEventListener("pointerdown",x,!0),document.addEventListener("click",f),()=>{document.removeEventListener("pointerdown",x,!0),document.removeEventListener("click",f)}},[a,o,c,i,s,d,h])},Vu=(e,t,r)=>{const a=l.useEditorStore(),{store:o}=l.useGraphContext(),{store:i}=l.useHoverContext(),s=l.useLatestRef(t),c=l.MODE_SURFACES[l.useGraphMode()].observationsPress;(0,v.useEffect)(()=>(i.getState().setQueryOwnedByEditor(c),()=>i.getState().setQueryOwnedByEditor(!1)),[i,c]),(0,v.useEffect)(()=>{let d=null,h=null,u=!1;const m=j=>{if(!c)return;const I=i.getState();I.isPointerSuspended||j===null&&I.hover.primary===null||I.setHoverState(j??p.RESTING_HOVER_STATE)},g=()=>{if(d=null,h===null)return;const j=a.getState();if(Ce(j.standingInteraction)){const E=j.menuTrigger!==null&&(0,p.isPointWithinEditMenuTrigger)({x:h.clientX-s.current.x,y:h.clientY-s.current.y},j.menuTrigger),O=j.editTargetUnderPointer;E?j.setEditTargetUnderPointer({kind:"menu-trigger"}):O?.kind==="menu-trigger"&&j.setEditTargetUnderPointer(null);return}u&&(u=!1,h={...h,target:$u(h)});const{targetAtPoint:I,hover:P}=Hr(h,r());j.setEditTargetUnderPointer(I),m(P)},x=()=>{d===null&&(d=requestAnimationFrame(g))},f=()=>{h!==null&&(u=!0,x())},b=()=>{a.getState().setEditTargetUnderPointer(null),m(null)},w=j=>{h={target:j.target,clientX:j.clientX,clientY:j.clientY},u=!1,x()},T=()=>{h=null,d!==null&&(cancelAnimationFrame(d),d=null),b()},y=a.subscribe((j,I)=>{Ce(I.standingInteraction)&&!Ce(j.standingInteraction)&&f()}),k=o.subscribe((j,I)=>{j.scene!==I.scene&&(Ce(a.getState().standingInteraction)||f())});return e.addEventListener("pointermove",w),e.addEventListener("pointerleave",T),()=>{d!==null&&cancelAnimationFrame(d),y(),k(),e.removeEventListener("pointermove",w),e.removeEventListener("pointerleave",T),b()}},[e,a,o,i,s,c,r])},$u=e=>typeof document.elementFromPoint=="function"?document.elementFromPoint(e.clientX,e.clientY):e.target,Ce=e=>{if(e===null)return!1;switch(e.kind){case"menu":case"move-drag":case"shape-resize-drag":case"difference-arrow-endpoint-drag":case"arrow-endpoint-drag":case"text-resize-drag":return!0;case"chrome-popup":return!1}},hn="editor",pn=[],Uu=(e,t,r,a,o)=>{const i=Gr(),{store:s}=l.useHoverContext(),c=l.useGraphSelection().length>0,d=l.MODE_SURFACES[l.useGraphMode()].holdsHoverWhileSelected,h=l.useEditorState(f=>f.menuTrigger),u=i.kind==="menu",m=(0,v.useMemo)(()=>h===null?pn:[(0,p.buildEditMenuTriggerRegion)(h)],[h]),g=Fu(e,t);Vu(e,t,g),_u(e,t,r,g,o),Gu(i,t,r),bu(e),Nu(e),vu(e,a),(0,v.useEffect)(()=>(s.getState().publishPointerRegions(hn,m),()=>s.getState().publishPointerRegions(hn,pn)),[s,m]);const x=u||c&&d;(0,v.useEffect)(()=>(s.getState().setPointerSuspended(x),()=>s.getState().setPointerSuspended(!1)),[s,x]),(0,v.useEffect)(()=>{if(!c||!d)return;const f=s.getState();f.setHoverState(p.RESTING_HOVER_STATE),f.setTooltipAnchor(null)},[s,c,d])},Wu=({frameElement:e,panelRect:t,formattedAxes:r,shouldAnimateTransitions:a})=>{const{measureRef:o,screenRect:i}=l.useElementScreenRect(),{selectionStore:s}=l.useGraphContext(),c=l.useEditorStore(),d=l.useEditorState(m=>m.caret?.annotationId??null),h=l.useGraphMode(),u=(0,v.useRef)(h);return(0,v.useEffect)(()=>(o(e),()=>o(null)),[o,e]),(0,v.useEffect)(()=>()=>{const m=c.getState();m.releaseInteraction("menu"),m.setCaret(null)},[c]),(0,v.useEffect)(()=>{if(u.current===h)return;u.current=h;const m=c.getState();m.releaseInteraction("menu"),m.setCaret(null),m.setEditTargetUnderPointer(null),s.getState().clearSelection()},[h,c,s]),i===null?null:(0,n.jsxs)(zs,{children:[d!==null&&(0,n.jsx)(qu,{annotationId:d,panelRect:t}),(0,n.jsx)(Ku,{frameElement:e,frameRect:i,panelRect:t,formattedAxes:r,shouldAnimateTransitions:a})]})},qu=({annotationId:e,panelRect:t})=>{const r=l.useEditorStore(),{textAnnotations:a}=l.useResolvedAnnotations(t);return(0,v.useEffect)(()=>{a.some(({id:o})=>o===e)||r.getState().setCaret(null)},[e,a,r]),null},Ku=({frameElement:e,frameRect:t,panelRect:r,formattedAxes:a,shouldAnimateTransitions:o})=>{const i=(0,v.useMemo)(()=>({x:t.left+r.x,y:t.top+r.y}),[t.left,t.top,r.x,r.y]),[s,c]=(0,v.useState)(null);return Uu(e,i,r,s,a),(0,n.jsx)(Xu,{frameElement:e,frameRect:t,panelOrigin:i,panelRect:r,boxRef:c,shouldAnimateTransitions:o})},Xu=({frameElement:e,frameRect:t,panelOrigin:r,panelRect:a,boxRef:o,shouldAnimateTransitions:i})=>{const s=De(),c=Gr(),{annotations:d,editOutline:h,overlayMenu:u}=l.MODE_SURFACES[l.useGraphMode()],m=(0,v.useMemo)(()=>({width:t.width,height:t.height}),[t.width,t.height]);return(0,n.jsxs)(n.Fragment,{children:[h&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(ks,{frameElement:e,frameSize:m,panelRect:a,shouldAnimateTransitions:i}),(0,n.jsx)(ol,{frameRect:t})]}),(0,n.jsx)(l.OverlayPortal,{rect:t,zIndex:l.Z_INDEX.editorOverlay,container:s,"data-testid":"editor-overlay",boxRef:o,children:(0,n.jsxs)(l.PortalThemeProvider,{children:[d&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(ed,{panelRect:a,panelOrigin:r,frameRect:t,frameElement:e}),(0,n.jsx)(Ad,{panelRect:a,frameRect:t,frameElement:e}),(0,n.jsx)(kc,{panelRect:a,frameRect:t,frameElement:e}),(0,n.jsx)(nu,{panelRect:a,frameRect:t,frameElement:e}),(0,n.jsx)(ld,{panelRect:a}),(0,n.jsx)(gd,{panelRect:a}),(0,n.jsx)(Kl,{panelRect:a}),(0,n.jsx)(sd,{panelRect:a})]}),(0,n.jsx)(mu,{interaction:c,panelRect:a}),(0,n.jsx)(Vl,{interaction:c,frameElement:e,panelRect:a}),u&&(0,n.jsx)(al,{frameElement:e})]})})]})},Zu=({slots:e,mode:t,...r})=>(0,n.jsx)(Rn,{locale:l.useGraphLocale(),children:(0,n.jsx)(l.EditorProvider,{children:(0,n.jsx)(l.InlineEditorsProvider,{editors:Hi,children:(0,n.jsx)(l.GraphRendererBody,{slots:(0,v.useMemo)(()=>({EditorSurface:Wu,...e}),[e]),mode:t,...r})})})}),Vr=(0,v.createContext)(null),$r=({labelId:e,controlId:t,children:r})=>{const a=(0,v.useMemo)(()=>{let o=null;return{labelId:e,controlId:t,claimControlId:i=>(o??=i,o===i)}},[e,t]);return(0,n.jsx)(Vr.Provider,{value:a,children:r})},ne=({id:e,ariaLabel:t,ariaLabelledBy:r},a=!0)=>{const o=(0,v.useContext)(Vr),i=(0,v.useId)(),[s]=(0,v.useState)(()=>a?o?.claimControlId(i)??!1:!1),c=e??(s?o?.controlId:void 0),d=r??(t===void 0?o?.labelId:void 0);return{...c!==void 0&&{id:c},...t!==void 0&&{"aria-label":t},...d!==void 0&&{"aria-labelledby":d}}};var Yu={default:"woi4bh4 woi4bh3",tile:"woi4bh5 woi4bh3"},Ur=({label:e,icon:t,onClick:r,variant:a="default",isDisabled:o,ariaLabel:i,ariaLabelledBy:s,id:c})=>{const d=ne({id:c,ariaLabel:i,ariaLabelledBy:s}),h=a==="tile";return(0,n.jsxs)("button",{type:"button",className:Yu[a],disabled:o,onClick:r,...d,children:[t!==void 0&&(0,n.jsx)("span",{className:"woi4bh0",children:t}),e!==void 0&&(0,n.jsx)("span",{className:h?"woi4bh2":"woi4bh1",children:e})]})},jt=(0,v.createContext)(null),N=()=>{const e=(0,v.useContext)(jt);if(!e)throw new Error("An editing section must sit inside an <EditorPanel.Root> bound to a graph — pass it a `handle`, or render the panel inside a <GraphProvider>.");return e},Wr=({children:e,onKeyDown:t,...r})=>{const a=(0,v.useContext)(jt),o=i=>{if(t?.(i),!a||i.defaultPrevented)return;const s=l.resolveHistoryStep(i.nativeEvent);s&&(i.preventDefault(),s==="undo"?a.undo():a.redo())};return(0,n.jsx)("div",{onKeyDown:o,...r,children:e})},qr="keyboard",He=e=>{const t=(0,v.useRef)(!1),r=(0,v.useRef)(!1),a=()=>{t.current=!1,r.current&&(r.current=!1,e?.())};return{commitAfterChange:()=>{if(t.current){r.current=!0;return}e?.()},commitUnlessHeldKey:o=>{if(o){r.current=!0;return}e?.()},gestureHandlers:{onKeyDown:()=>{t.current=!0},onKeyUp:a,onBlur:o=>{o.relatedTarget instanceof Node&&o.currentTarget.contains(o.relatedTarget)||a()}}}},Ju="eh8dvc0",Qu="eh8dvc1 uz3g760",e0="eh8dvc2 uz3g761";var Kr=({value:e,onChange:t,onCommit:r,min:a,max:o,step:i,placeholder:s,prefix:c,suffix:d,isDisabled:h,hasError:u,ariaLabel:m,ariaLabelledBy:g,id:x})=>{const f=ne({id:x,ariaLabel:m,ariaLabelledBy:g}),{commitUnlessHeldKey:b,gestureHandlers:w}=He(r);return(0,n.jsx)(Et.NumberField.Root,{className:Ju,value:e,onValueChange:T=>t(T),onValueCommitted:(T,y)=>{b(y.reason===qr)},min:a,max:o,step:i,disabled:h,children:(0,n.jsxs)(Wr,{className:Qu,"data-error":u===!0,"data-disabled":h===!0?"":void 0,children:[c!==void 0&&(0,n.jsx)("span",{className:"eh8dvc3",children:c}),(0,n.jsx)(Et.NumberField.Input,{className:e0,placeholder:s,...w,"aria-invalid":u===!0?!0:void 0,...f}),d!==void 0&&(0,n.jsx)("span",{className:"eh8dvc3",children:d})]})})},t0="_1b7s5f0",oe={1:"_1b7s5f1",2:"_1b7s5f2",3:"_1b7s5f3",4:"_1b7s5f4",5:"_1b7s5f5",6:"_1b7s5f6"},n0="_1b7s5f7";var r0=6,Xr=({options:e,value:t,onChange:r,onCommit:a,columns:o,itemLayout:i="tile",isDisabled:s,ariaLabel:c,ariaLabelledBy:d,id:h})=>{const u=ne({id:h,ariaLabel:c,ariaLabelledBy:d}),m=i==="swatch",{commitAfterChange:g,gestureHandlers:x}=He(a);return(0,n.jsx)(Mn.RadioGroup,{className:(0,U.default)(t0,a0(o??e.length)),value:t,onValueChange:f=>{r(f),g()},...x,disabled:s,...u,children:e.map(f=>(0,n.jsxs)(En.Radio.Root,{value:f.value,disabled:f.isDisabled,className:(0,U.default)(n0,m&&"_1b7s5f8"),"aria-label":m?f.label:void 0,children:[f.icon,!m&&(0,n.jsx)("span",{className:"_1b7s5f9",children:f.label})]},f.value))})},a0=e=>{switch(Math.min(Math.max(Math.round(e),1),r0)){case 1:return oe[1];case 2:return oe[2];case 3:return oe[3];case 4:return oe[4];case 5:return oe[5];default:return oe[6]}},o0="_1g5x15w0 uz3g760",i0="_1g5x15w1",s0="_1g5x15w2",mn="_1g5x15w3",l0="_1g5x15w4",c0="_1g5x15w5",d0="_1g5x15w6",u0="_1g5x15w7";var Zr=({options:e,value:t,onChange:r,placeholder:a,isDisabled:o,hasError:i,ariaLabel:s,ariaLabelledBy:c,id:d})=>{const h=ne({id:d,ariaLabel:s,ariaLabelledBy:c});return(0,n.jsxs)(K.Select.Root,{value:t,onValueChange:u=>u!==null&&r(u),disabled:o,items:e.map(u=>({value:u.value,label:u.label})),children:[(0,n.jsxs)(K.Select.Trigger,{className:o0,"data-error":i===!0,...h,children:[(0,n.jsx)(K.Select.Value,{className:i0,children:u=>h0(e,u,a)}),(0,n.jsx)(K.Select.Icon,{className:mn,children:(0,n.jsx)(pe,{size:"sm"})})]}),(0,n.jsx)(K.Select.Portal,{container:l.resolvePortalContainer(),children:(0,n.jsx)(l.PortalThemeProvider,{children:(0,n.jsx)(K.Select.Positioner,{className:l0,sideOffset:4,alignItemWithTrigger:!1,children:(0,n.jsx)(K.Select.Popup,{className:c0,children:e.map(u=>(0,n.jsxs)(K.Select.Item,{value:u.value,disabled:u.isDisabled,className:d0,children:[u.icon,(0,n.jsxs)("span",{className:u0,children:[(0,n.jsx)(K.Select.ItemText,{children:u.label}),u.description!==void 0&&(0,n.jsx)("span",{className:"_1g5x15w8",children:u.description})]}),(0,n.jsx)(K.Select.ItemIndicator,{className:mn,children:(0,n.jsx)(Kn,{size:"sm"})})]},u.value))})})})})]})},h0=(e,t,r)=>t===null?(0,n.jsx)("span",{className:s0,children:r}):p0(e,t),p0=(e,t)=>e.find(r=>r.value===t)?.label??t,m0="vod76w0",g0="vod76w1",x0="vod76w2",v0="vod76w3",f0="vod76w4",b0="vod76w5";var Yr=({value:e,onChange:t,onCommit:r,min:a,max:o,step:i,suffix:s,formatValue:c,isDisabled:d,ariaLabel:h,ariaLabelledBy:u})=>{const m=ne({ariaLabel:h,ariaLabelledBy:u},!1),g=S0(e,s,c),{commitUnlessHeldKey:x,gestureHandlers:f}=He(r);return(0,n.jsxs)("div",{className:m0,children:[(0,n.jsx)(Z.Slider.Root,{className:g0,value:e,onValueChange:b=>t(b),onValueCommitted:(b,w)=>{x(w.reason===qr)},min:a,max:o,step:i,disabled:d,children:(0,n.jsx)(Z.Slider.Control,{className:x0,children:(0,n.jsxs)(Z.Slider.Track,{className:v0,children:[(0,n.jsx)(Z.Slider.Indicator,{className:f0}),(0,n.jsx)(Z.Slider.Thumb,{className:b0,...f,...m})]})})}),g!==null&&(0,n.jsx)("span",{className:"vod76w6",children:g})]})},S0=(e,t,r)=>r!==void 0?r(e):t!==void 0?`${e}${t}`:null,y0="_1hyrlw60",C0="_1hyrlw61",Jr=({isChecked:e,onChange:t,isDisabled:r,ariaLabel:a,ariaLabelledBy:o,id:i})=>{const s=ne({id:i,ariaLabel:a,ariaLabelledBy:o});return(0,n.jsx)(Mt.Switch.Root,{checked:e,onCheckedChange:c=>t(c),disabled:r,className:y0,...s,children:(0,n.jsx)(Mt.Switch.Thumb,{className:C0})})},j0="uz3g761",w0="tpcnun0 uz3g760",Qr=({value:e,onChange:t,onCommit:r,placeholder:a,isDisabled:o,hasError:i,ariaLabel:s,ariaLabelledBy:c,id:d})=>{const h=ne({id:d,ariaLabel:s,ariaLabelledBy:c});return(0,n.jsx)(Wr,{className:w0,"data-error":i===!0,children:(0,n.jsx)($a.Input,{className:j0,value:e,onValueChange:u=>t(u),onBlur:r,placeholder:a,disabled:o,"aria-invalid":i===!0?!0:void 0,...h})})},T0="cnu9yl0",A0="cnu9yl1";var ea=({options:e,value:t,onChange:r,onCommit:a,itemLayout:o="inline",isDisabled:i,ariaLabel:s,ariaLabelledBy:c,id:d})=>{const h=ne({id:d,ariaLabel:s,ariaLabelledBy:c}),u=o==="stacked",{commitAfterChange:m,gestureHandlers:g}=He(a);return(0,n.jsx)(Mn.RadioGroup,{className:T0,value:t,onValueChange:x=>{r(x),m()},...g,disabled:i,...h,children:e.map(x=>(0,n.jsxs)(En.Radio.Root,{value:x.value,disabled:x.isDisabled,className:(0,U.default)(A0,u&&"cnu9yl2"),"aria-label":k0(x,u),children:[x.icon,ta(x,u)&&(0,n.jsx)("span",{className:"cnu9yl3",children:x.label})]},x.value))})},ta=(e,t)=>e.icon===void 0||t,k0=(e,t)=>{if(!ta(e,t))return e.label},P0={ToggleGroup:ea,Switch:Jr,Slider:Yr,RadioGrid:Xr,Button:Ur,TextField:Qr,NumberField:Kr,Select:Zr},st=(0,v.createContext)(P0),na=({controls:e,children:t})=>{const r=(0,v.useContext)(st),a=(0,v.useMemo)(()=>({ToggleGroup:e?.ToggleGroup??r.ToggleGroup,Switch:e?.Switch??r.Switch,Slider:e?.Slider??r.Slider,RadioGrid:e?.RadioGrid??r.RadioGrid,Button:e?.Button??r.Button,TextField:e?.TextField??r.TextField,NumberField:e?.NumberField??r.NumberField,Select:e?.Select??r.Select}),[r,e?.ToggleGroup,e?.Switch,e?.Slider,e?.RadioGrid,e?.Button,e?.TextField,e?.NumberField,e?.Select]);return(0,n.jsx)(st.Provider,{value:a,children:t})},D=()=>(0,v.useContext)(st),L0="_12lhx9e0",ra=({children:e})=>(0,n.jsx)("div",{className:L0,children:e}),I0="_139ohwv0",G=({children:e})=>(0,n.jsx)("div",{className:I0,children:e}),aa=(0,v.createContext)(null),E0=aa.Provider,oa=()=>{const e=(0,v.useContext)(aa);if(!e)throw new Error("A section must be rendered inside <EditorPanel.Root>.");return e},M0="_1jlczkt0",ia="data-graphy-editor-panel",R0={List:G,Grid:ra};function O0(e){if(e===void 0)return!1;const t=e.split(/\s+/);return t.includes("_1ii3bsb0")||t.includes("_1ii3bsb1")}var _0=({handle:e,children:t,controls:r,defaultExpandedSection:a=void 0,className:o})=>{const i=l.useGraphHandle(e),{themeClass:s,inlineVarsStyle:c}=l.useThemeContext(),[d,h]=(0,v.useState)(()=>a?[a]:[]),u=(0,v.useMemo)(()=>({expandSection:m=>h([m]),collapseAllSections:()=>h([])}),[]);return(0,n.jsx)(jt.Provider,{value:i,children:(0,n.jsx)(na,{controls:r,children:(0,n.jsx)(E0,{value:u,children:(0,n.jsx)(de.Accordion.Root,{[ia]:"",className:(0,U.default)(M0,o,{[s]:!O0(o)}),style:c,value:d,onValueChange:m=>h(m),children:t})})})})},wt={Root:_0,Controls:R0},gn={stack:"pr583x0",grid:"pr583x1"},xn="pr583x2",N0={plain:"pr583x4 pr583x3",withIcon:"pr583x5 pr583x3"},A=({label:e,layout:t="grid",icon:r,children:a})=>{const o=(0,v.useId)(),i=(0,v.useId)();return e===void 0?(0,n.jsx)("div",{className:gn[t],children:(0,n.jsx)("div",{className:xn,children:a})}):(0,n.jsxs)("div",{className:gn[t],children:[(0,n.jsxs)("label",{id:o,htmlFor:i,className:N0[r===void 0?"plain":"withIcon"],children:[r!==void 0&&(0,n.jsx)("span",{"aria-hidden":"true",children:r}),e]}),(0,n.jsx)("div",{className:xn,children:(0,n.jsx)($r,{labelId:o,controlId:i,children:a})})]})},D0=e=>(0,n.jsx)(l.Icon,{...e,children:(0,n.jsx)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:(0,n.jsx)("path",{d:"m9 6 6 6-6 6"})})}),Tt="_40zvwv0",At="_40zvwv1",F0="_40zvwv2",sa="_40zvwv3",z0="_40zvwv4 _40zvwv3";var B0="_40zvwv6";var H0="_40zvwv8",F=({title:e,layout:t="fixed",preview:r,accessory:a,onOpenChange:o,children:i})=>t==="collapsible"?(0,n.jsx)(V0,{title:e,preview:r,accessory:a,onOpenChange:o,children:i}):t==="inline"&&r===void 0?(0,n.jsx)(G0,{title:e,accessory:a,children:i}):(0,n.jsxs)("div",{className:Tt,children:[(0,n.jsxs)("div",{className:At,children:[(0,n.jsx)("span",{className:sa,children:e}),r!==void 0&&(0,n.jsx)("span",{className:"_40zvwv5",children:r}),a!==void 0&&(0,n.jsx)("span",{className:"_40zvwv7",children:a})]}),(0,n.jsx)("div",{children:i})]}),G0=({title:e,accessory:t,children:r})=>{const a=(0,v.useId)(),o=(0,v.useId)();return(0,n.jsx)("div",{className:Tt,children:(0,n.jsxs)("div",{className:At,children:[(0,n.jsx)("label",{id:a,htmlFor:o,className:z0,children:e}),(0,n.jsx)("span",{className:B0,children:(0,n.jsx)($r,{labelId:a,controlId:o,children:r})}),t!==void 0&&(0,n.jsx)("span",{className:"_40zvwv7",children:t})]})})},V0=({title:e,preview:t,accessory:r,onOpenChange:a,children:o})=>{const i=l.useI18n();return(0,n.jsxs)(de.Accordion.Item,{value:e,className:Tt,onOpenChange:a,children:[(0,n.jsxs)(de.Accordion.Header,{className:At,render:(0,n.jsx)("div",{}),children:[(0,n.jsx)(de.Accordion.Trigger,{className:F0,"aria-label":i("editor.accessibility.toggleSection",{title:e})}),(0,n.jsx)("span",{className:sa,children:e}),t!==void 0&&(0,n.jsx)("span",{className:"_40zvwv5",children:t}),r!==void 0&&(0,n.jsx)("span",{className:"_40zvwv7",children:r}),(0,n.jsx)("span",{className:H0,children:(0,n.jsx)(D0,{size:"sm"})})]}),(0,n.jsx)(de.Accordion.Panel,{children:(0,n.jsx)("div",{children:o})})]})},la=({title:e,isChecked:t,onToggle:r,isDisabled:a,preview:o,children:i})=>{const{expandSection:s,collapseAllSections:c}=oa(),{Switch:d}=D(),h=m=>{r(m),m?s(e):c()},u=m=>{m&&!t&&a!==!0&&r(!0)};return(0,n.jsx)(F,{title:e,layout:"collapsible",preview:o,onOpenChange:u,accessory:(0,n.jsx)(d,{isChecked:t,onChange:h,isDisabled:a,ariaLabel:e}),children:i})},$0={horizontal:["bottom","top"],vertical:["left","right"]},U0={left:"editor.axesPanel.position.left",right:"editor.axesPanel.position.right",top:"editor.axesPanel.position.top",bottom:"editor.axesPanel.position.bottom"},W0={x:"editor.axesPanel.mainAxisSection.xAxis",y:"editor.axesPanel.mainAxisSection.yAxis"},lt=({axis:e,title:t,layout:r="collapsible",preview:a})=>{const o=N(),i=l.useHandleScene(o),s=l.useI18n(),{NumberField:c,Switch:d,TextField:h,ToggleGroup:u}=D();if(!i)return null;const m=i.coordSystem.type==="polar"?i.coordSystem.axisMapping[e].geometry:"linear",g=i.config.axes[e],x=i.scales[e],f=x?.spec,b=f?.scaleType==="continuous"?f:void 0;if(m==="circular"||m==="radial"&&b===void 0)return null;const w=f!==void 0&&"reverse"in f?f:void 0,T=f?.scaleType==="continuous"||f?.scaleType==="datetime",y=b!==void 0&&(0,p.isZeroAnchoredAxis)(i,e),k=b?.transform==="log",j=b?.domainMax??null,I=q0(b),P=(L,q)=>L.map(xe=>({value:xe,label:q(xe)})),E=i.guides.axes.find(L=>L.scaleAestheticKey===e)?.position,O=$0[E==="bottom"||E==="top"||E===void 0&&e==="x"?"horizontal":"vertical"],M=e==="y"?(0,p.readComboLineLayerId)(i.spec):null,C=M===null?void 0:(0,p.findLayerById)(i.spec.layers,M),S=i.guides.legends.drawn.some(L=>O.some(q=>q===L.position)),z=O.map(L=>({value:L,label:s(U0[L])})),V=P(["auto","edges"],L=>s(L==="edges"?"editor.axesPanel.labelMode.edges":"editor.axesPanel.labelMode.auto")),J=P(["linear","log"],L=>s(L==="log"?"editor.axesPanel.scale.log":"editor.axesPanel.scale.auto")),fa=P(["auto","zero","custom"],L=>s(L==="zero"?"editor.axesPanel.startFrom.zero":L==="custom"?"editor.axesPanel.startFrom.custom":"editor.axesPanel.startFrom.auto")),ba=P(["auto","custom"],L=>s(L==="custom"?"editor.axesPanel.endAt.custom":"editor.axesPanel.endAt.auto")),Sa=P(["no","yes"],L=>s(L==="yes"?"editor.axesPanel.yesNo.yes":"editor.axesPanel.yesNo.no")),ya=P(["single","double"],L=>s(L==="double"?"editor.axesPanel.axisCount.double":"editor.axesPanel.axisCount.single")),Ca=L=>{o.commands.dispatch(new p.SetAxisVisibilityCommand({axis:e,isVisible:L}))},ja=L=>{o.commands.dispatch(new p.SetAxisLabelCommand({axis:e,label:L===""?null:L}),{transient:!0})},wa=L=>{o.commands.dispatch(new p.SetAxisTicksVisibilityCommand({axis:e,isVisible:L}))},Ta=L=>{o.commands.dispatch(new p.SetAxisTickModeCommand({axis:e,tickMode:L==="edges"?"edges":"auto"}))},Aa=L=>{o.commands.dispatch(new p.SetScaleReverseCommand({scaledAesthetic:e,reverse:L==="yes"}))},ka=L=>{o.commands.dispatch(new p.SetScaleTransformCommand({scaledAesthetic:e,transform:L==="log"?"log":"linear"}))},Lt=L=>{o.commands.dispatch(new p.SetScaleDomainCommand({scaledAesthetic:e,...L}),{transient:!0})},Pa=L=>{L!==null&&Lt({domainMin:L})},La=L=>{L!==null&&Lt({domainMax:L})},Ia=L=>{const q=L==="auto"?null:L==="zero"?0:vn(x?.domain,"start");o.commands.dispatch(new p.SetScaleDomainCommand({scaledAesthetic:e,domainMin:q}))},Ea=L=>{const q=L==="custom"?vn(x?.domain,"end"):null;o.commands.dispatch(new p.SetScaleDomainCommand({scaledAesthetic:e,domainMax:q}))},Ma=L=>{C!==void 0&&o.commands.dispatch(new p.SetLayerYScaleTypeCommand({layerId:C.id,yScaleType:L==="double"?"secondary":"primary"}))},Ra=L=>{const q=O.find(xe=>xe===L);q&&o.commands.dispatch(new p.SetAxisPositionCommand({axis:e,position:q}))};return(0,n.jsx)(F,{title:t??s(W0[e]),layout:r,preview:a,children:(0,n.jsxs)(G,{children:[(0,n.jsx)(A,{label:s("editor.axesPanel.controls.visible"),children:(0,n.jsx)(d,{isChecked:g.isVisible,onChange:Ca})}),C!==void 0&&(0,n.jsx)(A,{label:s("editor.axesPanel.controls.numberOfAxes"),children:(0,n.jsx)(u,{value:C.yScaleType==="secondary"?"double":"single",options:ya,onChange:Ma})}),m==="linear"&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(A,{label:s("editor.axesPanel.controls.title"),children:(0,n.jsx)(h,{value:g.label??"",onChange:ja,onCommit:o.commands.commit})}),(0,n.jsx)(A,{label:s("editor.axesPanel.controls.ticks"),children:(0,n.jsx)(d,{isChecked:g.ticks.isVisible,onChange:wa})})]}),T&&(0,n.jsx)(A,{label:s("editor.axesPanel.controls.labels"),children:(0,n.jsx)(u,{value:g.ticks.mode,options:V,onChange:Ta})}),b&&m==="linear"&&!S&&(0,n.jsx)(A,{label:s("editor.axesPanel.controls.position"),children:(0,n.jsx)(u,{value:E??g.position,options:z,onChange:Ra})}),w!==void 0&&(0,n.jsx)(A,{label:s("editor.axesPanel.controls.reverse"),children:(0,n.jsx)(u,{value:w.reverse===!0?"yes":"no",options:Sa,onChange:Aa})}),b&&!y&&(0,n.jsx)(A,{label:s("editor.axesPanel.controls.scale"),children:(0,n.jsx)(u,{value:k?"log":"linear",options:J,onChange:ka})}),b&&!k&&(0,n.jsxs)(n.Fragment,{children:[!y&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(A,{label:s("editor.axesPanel.controls.startFrom"),children:(0,n.jsx)(u,{value:I,options:fa,onChange:Ia})}),I!=="auto"&&(0,n.jsx)(A,{label:s("editor.axesPanel.controls.value"),children:(0,n.jsx)(c,{value:b.domainMin??null,onChange:Pa,onCommit:o.commands.commit})})]}),(0,n.jsx)(A,{label:s("editor.axesPanel.controls.endAt"),children:(0,n.jsx)(u,{value:j===null?"auto":"custom",options:ba,onChange:Ea})}),j!==null&&(0,n.jsx)(A,{label:s("editor.axesPanel.controls.value"),children:(0,n.jsx)(c,{value:j,onChange:La,onCommit:o.commands.commit})})]})]})})},q0=e=>{const t=e?.domainMin??null;return t===null?"auto":t===0?"zero":"custom"},vn=(e,t)=>{const r=t==="start"?e?.[0]:e?.[e.length-1];return typeof r=="number"?r:0},kt=({value:e,onChange:t})=>{const r=N(),a=l.useI18n(),{TextField:o}=D(),i=e!==null&&typeof e!="string",s=c=>t(c===""?null:c);return(0,n.jsx)(A,{label:a("editor.elementsPanel.contentValue"),children:(0,n.jsx)(o,{value:typeof e=="string"?e:"",onChange:s,onCommit:r.commands.commit,isDisabled:i})})},ca=({title:e,layout:t="collapsible",preview:r})=>{const a=N(),o=l.useHandleScene(a),i=l.useI18n(),{Switch:s}=D();if(!o)return null;const c=o.config.content,d=u=>{a.commands.dispatch(new p.ToggleContentVisibilityCommand({part:"caption",isVisible:u}))},h=u=>{a.commands.dispatch(new p.SetContentCaptionCommand({caption:u}),{transient:!0})};return(0,n.jsx)(F,{title:e??i("editor.elementsPanel.footerSection.caption"),layout:t,preview:r,children:(0,n.jsxs)(G,{children:[(0,n.jsx)(A,{label:i("editor.elementsPanel.contentVisible"),children:(0,n.jsx)(s,{isChecked:c.isCaptionVisible,onChange:d})}),(0,n.jsx)(kt,{value:c.caption,onChange:h})]})})},fn=/^[a-z][a-z\d+.-]*:/i,K0={},da=({title:e,layout:t="collapsible",preview:r})=>{const a=N(),o=l.useHandleScene(a),i=l.useI18n(),{Switch:s}=D();if(!o)return null;const c=o.config.content,d=h=>{a.commands.dispatch(new p.ToggleContentVisibilityCommand({part:"source",isVisible:h}))};return(0,n.jsx)(F,{title:e??i("editor.elementsPanel.sourceSection.title"),layout:t,preview:r,children:(0,n.jsxs)(G,{children:[(0,n.jsx)(A,{label:i("editor.elementsPanel.contentVisible"),children:(0,n.jsx)(s,{isChecked:c.isSourceVisible,onChange:d})}),(0,n.jsx)(X0,{source:c.source??K0})]})})},X0=({source:e})=>{const t=N(),r=l.useI18n(),{TextField:a}=D(),o=d=>{const h=(d.label??"")!==""||(d.url??"")!=="";t.commands.dispatch(new p.SetContentSourceCommand({source:h?d:null}),{transient:!0})},i=()=>{const d=e.url??"";d!==""&&!fn.test(d)&&o({...e,url:`https://${d}`}),t.commands.commit()},s=d=>o({...e,url:d}),c=d=>o({...e,label:d});return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(A,{label:r("editor.elementsPanel.sourceSection.url"),children:(0,n.jsx)(a,{value:e.url??"",onChange:s,onCommit:i,hasError:fn.test(e.url??"")&&!(0,p.isSafeUrl)(e.url)})}),(0,n.jsx)(A,{label:r("editor.elementsPanel.sourceSection.name"),children:(0,n.jsx)(a,{value:e.label??"",onChange:c,onCommit:t.commands.commit})})]})},ua=({title:e,layout:t="collapsible",preview:r})=>{const a=N(),o=l.useHandleScene(a),i=l.useI18n(),{Switch:s}=D();if(!o)return null;const c=o.config.content,d=u=>{a.commands.dispatch(new p.ToggleContentVisibilityCommand({part:"subtitle",isVisible:u}))},h=u=>{a.commands.dispatch(new p.SetContentSubtitleCommand({subtitle:u}),{transient:!0})};return(0,n.jsx)(F,{title:e??i("editor.elementsPanel.headerSection.subtitle"),layout:t,preview:r,children:(0,n.jsxs)(G,{children:[(0,n.jsx)(A,{label:i("editor.elementsPanel.contentVisible"),children:(0,n.jsx)(s,{isChecked:c.isSubtitleVisible,onChange:d})}),(0,n.jsx)(kt,{value:c.subtitle,onChange:h})]})})},Ge=e=>{const{colorScheme:t}=l.useThemeContext(),r=(0,v.useMemo)(()=>(0,p.createStyleResolver)({colorScheme:t}),[t]);return(0,v.useMemo)(()=>e===null?null:r.readers(e),[e,r])},Pt=(e,t,r)=>{const a=Ge(e);return(0,v.useMemo)(()=>{if(a===null||e===null||t===null)return null;const o=(0,p.findLayerById)(e.layers,t);return o===void 0?null:a.geom[r](o)},[a,e,t,r])},ct=[.8,1,1.2,1.4,1.6,1.8,2,2.5,3,4],Z0=ct.length/2,Y0={select:{target:"graph"}},ha=({title:e,layout:t="collapsible",preview:r})=>{const a=N(),o=l.useHandleScene(a),i=l.useI18n(),{RadioGrid:s}=D(),c=Ge(o);if(!o||!c)return null;const d=c.graph().get("textScale"),h=g=>i("editor.elementsPanel.textSizeSection.scaleFormat",{value:`${g}`}),u=ct.map(g=>({value:`${g}`,label:h(g)})),m=g=>{const x=ct.find(b=>`${b}`===g);if(x===void 0)return;const f=(0,p.findStyleRule)(o.spec.styles.overrides,Y0)?.declarations??{};a.commands.dispatch(new p.SetStyleRuleCommand({list:"overrides",rule:{select:{target:"graph"},declarations:{...f,textScale:x}}}))};return(0,n.jsx)(F,{title:e??i("editor.elementsPanel.textSizeSection.title"),layout:t,preview:r??h(d),children:(0,n.jsx)(s,{value:`${d}`,options:u,columns:Z0,onChange:m,ariaLabel:i("editor.elementsPanel.textSizeSection.title")})})},pa=({title:e,layout:t="collapsible",preview:r})=>{const a=N(),o=l.useHandleScene(a),i=l.useI18n(),{Switch:s}=D();if(!o)return null;const c=o.config.content,d=u=>{a.commands.dispatch(new p.ToggleContentVisibilityCommand({part:"title",isVisible:u}))},h=u=>{a.commands.dispatch(new p.SetContentTitleCommand({title:u}),{transient:!0})};return(0,n.jsx)(F,{title:e??i("editor.elementsPanel.headerSection.toggleTitle"),layout:t,preview:r,children:(0,n.jsxs)(G,{children:[(0,n.jsx)(A,{label:i("editor.elementsPanel.contentVisible"),children:(0,n.jsx)(s,{isChecked:c.isTitleVisible,onChange:d})}),(0,n.jsx)(kt,{value:c.title,onChange:h})]})})},J0=({children:e,...t})=>(0,n.jsx)(wt.Root,{...t,children:e??(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(pa,{}),(0,n.jsx)(ua,{}),(0,n.jsx)(ca,{}),(0,n.jsx)(da,{}),(0,n.jsx)(ha,{})]})}),Q0=({children:e,...t})=>(0,n.jsx)(wt.Root,{...t,children:e??(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(lt,{axis:"x"}),(0,n.jsx)(lt,{axis:"y"})]})}),Ve=e=>`${e}px`,ma=e=>`${Math.round(e*100)}%`,eh=e=>`${e}°`,th=24,nh={select:{target:"graph"}},bn=["dim","desaturate"],rh=({title:e,layout:t="collapsible",preview:r})=>{const a=N(),o=l.useHandleScene(a),i=l.useI18n(),{Slider:s,ToggleGroup:c}=D(),d=Ge(o);if(!o||!d)return null;const h=d.graph().get("cornerRadius"),u=(0,p.readHighlightDimStyle)(o.spec),m=bn.map(f=>({value:f,label:i(f==="dim"?"editor.highlighting.highlightStyle.tint":"editor.highlighting.highlightStyle.gray")})),g=f=>{const b=(0,p.findStyleRule)(o.spec.styles.overrides,nh)?.declarations??{};a.commands.dispatch(new p.SetStyleRuleCommand({list:"overrides",rule:{select:{target:"graph"},declarations:{...b,cornerRadius:f}}}),{transient:!0})},x=f=>{const b=bn.find(w=>w===f);b&&a.commands.dispatch(new p.SetHighlightDimStyleCommand({dimStyle:b}))};return(0,n.jsx)(F,{title:e??i("editor.colorPanel.appearanceSection.title"),layout:t,preview:r,children:(0,n.jsxs)(G,{children:[(0,n.jsx)(A,{label:i("editor.colorPanel.borderSection.cornerRadius"),children:(0,n.jsx)(s,{value:h,min:0,max:th,step:1,formatValue:Ve,onChange:g,onCommit:a.commands.commit})}),(0,n.jsx)(A,{label:i("editor.colorPanel.appearanceSection.highlightStyle"),children:(0,n.jsx)(c,{value:u,options:m,onChange:x})})]})})},ah=.05,oh=({title:e,layout:t="collapsible",preview:r})=>{const a=N(),o=l.useHandleScene(a),i=l.useI18n(),{Slider:s,ToggleGroup:c}=D(),d=o?(0,p.findLayerByGeom)(o.spec.layers,"bar"):void 0,h=Pt(o,d?.id??null,"bar");if(!o||!d||o.coordSystem.type==="polar"&&o.coordSystem.bandAxis===null)return null;const u=b=>{a.commands.dispatch(new p.SetBarWidthCommand({layerId:d.id,width:b}),{transient:!0})},m=b=>{const w=p.BORDER_RADIUS_TOKENS.find(T=>T===b);w&&a.commands.dispatch(new p.SetBarCornerRadiusCommand({layerId:d.id,cornerRadius:w}))},g=p.BORDER_RADIUS_TOKENS.map(b=>({value:b,label:i(`editor.graphPanel.barSection.roundingOptions.${b}`)})),x=(0,p.resolveBarBandFraction)(d.params,o.coordSystem.type),f=h?.get("cornerRadius")??p.DEFAULT_BAR_CORNER_RADIUS;return(0,n.jsx)(F,{title:e??i("editor.graphPanel.barSection.title"),layout:t,preview:r,children:(0,n.jsxs)(G,{children:[(0,n.jsx)(A,{label:i("editor.graphPanel.barSection.thickness"),children:(0,n.jsx)(s,{value:x,min:p.MIN_BAR_WIDTH_FRACTION,max:p.MAX_BAR_WIDTH_FRACTION,step:ah,formatValue:ma,onChange:u,onCommit:a.commands.commit})}),(0,n.jsx)(A,{label:i("editor.graphPanel.barSection.rounding"),layout:"stack",children:(0,n.jsx)(c,{value:typeof f=="string"?f:"",options:g,onChange:m})})]})})},$e=({children:e})=>{const t=(0,v.useId)();return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("g",{filter:`url(#${t})`,children:e}),(0,n.jsx)("defs",{children:(0,n.jsxs)("filter",{id:t,x:"-20%",y:"-20%",width:"140%",height:"140%",children:[(0,n.jsx)("feDropShadow",{dx:"0",dy:"0",stdDeviation:"0.586",floodColor:"#0F0F18",floodOpacity:"0.12"}),(0,n.jsx)("feDropShadow",{dx:"0",dy:"1.172",stdDeviation:"0.586",floodColor:"#0E0E34",floodOpacity:"0.16"})]})})]})},Ue="qdaoth0",ih=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 31 33",...e,children:[(0,n.jsx)($e,{children:(0,n.jsx)("path",{className:Ue,fillRule:"evenodd",clipRule:"evenodd",d:"M25.7417 6.23664C25.7417 6.09417 25.7076 5.95967 25.6471 5.84086C25.5633 5.67624 25.4288 5.54173 25.2641 5.4579C25.1453 5.39739 25.0108 5.36328 24.8684 5.36328H12.0591C11.5767 5.36328 11.1857 5.7543 11.1857 6.23664C11.1857 6.71899 11.5767 7.11 12.0591 7.11H22.7599L5.61908 24.2508C5.27801 24.5919 5.27801 25.1448 5.61908 25.4859C5.96015 25.827 6.51313 25.827 6.8542 25.4859L23.995 8.34513V19.0459C23.995 19.5283 24.386 19.9193 24.8684 19.9193C25.3507 19.9193 25.7417 19.5283 25.7417 19.0459V6.23664ZM20.995 15.5878V19.0459C20.995 21.1851 22.7292 22.9193 24.8684 22.9193C27.0076 22.9193 28.7417 21.1851 28.7417 19.0459V6.23664C28.7417 4.09744 27.0076 2.36328 24.8684 2.36328H12.0591C9.91985 2.36328 8.18569 4.09744 8.18569 6.23664C8.18569 8.37584 9.91985 10.11 12.0591 10.11H15.5172L3.49777 22.1295C1.98512 23.6421 1.98513 26.0946 3.49776 27.6072C5.0104 29.1199 7.46288 29.1199 8.97552 27.6072L20.995 15.5878Z"})}),(0,n.jsx)("path",{fill:"currentColor",d:"M12.0591 7.11C11.5767 7.11 11.1857 6.71899 11.1857 6.23664C11.1857 5.7543 11.5767 5.36328 12.0591 5.36328H24.8684C25.3507 5.36328 25.7417 5.7543 25.7417 6.23664V19.0459C25.7417 19.5283 25.3507 19.9193 24.8684 19.9193C24.386 19.9193 23.995 19.5283 23.995 19.0459V8.34512L6.8542 25.4859C6.51313 25.827 5.96015 25.827 5.61908 25.4859C5.27801 25.1448 5.27801 24.5919 5.61908 24.2508L22.7599 7.11H12.0591Z"})]}),sh=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 32 32",...e,children:(0,n.jsxs)($e,{children:[(0,n.jsx)("path",{className:Ue,d:"M11 21H21V11H11V21ZM29 23C29 26.3137 26.3137 29 23 29H9C5.68629 29 3 26.3137 3 23V9C3 5.68629 5.68629 3 9 3H23C26.3137 3 29 5.68629 29 9V23Z"}),(0,n.jsx)("path",{fill:"currentColor",d:"M24.25 9C24.25 8.30964 23.6904 7.75 23 7.75H9C8.30964 7.75 7.75 8.30964 7.75 9V23C7.75 23.6904 8.30964 24.25 9 24.25H23C23.6904 24.25 24.25 23.6904 24.25 23V9ZM25.75 23C25.75 24.5188 24.5188 25.75 23 25.75H9C7.48122 25.75 6.25 24.5188 6.25 23V9C6.25 7.48122 7.48122 6.25 9 6.25H23C24.5188 6.25 25.75 7.48122 25.75 9V23Z"})]})}),lh=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 32 33",...e,children:[(0,n.jsx)($e,{children:(0,n.jsx)("path",{className:Ue,fillRule:"evenodd",clipRule:"evenodd",d:"M4.89961 14.7968C3.08522 13.5116 1.89961 11.3966 1.89961 9.00039C1.89961 5.07917 5.07839 1.90039 8.99961 1.90039C10.7798 1.90039 12.4069 2.55553 13.6531 3.63785C14.3179 3.17306 15.1269 2.90039 15.9996 2.90039L22.9996 2.90039C25.264 2.90039 27.0996 4.73602 27.0996 7.00039L27.0996 9.7243C27.5717 9.92414 28.014 10.2165 28.3987 10.6013C29.9999 12.2024 29.9999 14.7984 28.3987 16.3995L27.9182 16.8801C29.2628 18.172 30.0996 19.9885 30.0996 22.0004C30.0996 25.9216 26.9208 29.1004 22.9996 29.1004C21.2195 29.1004 19.5923 28.4453 18.3461 27.3629C17.6813 27.8277 16.8723 28.1004 15.9996 28.1004L8.99961 28.1004C6.73524 28.1004 4.89961 26.2648 4.89961 24.0004L4.89961 14.7968Z"})}),(0,n.jsx)("path",{fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",d:"M25.25 22C25.25 20.7574 24.2426 19.75 23 19.75C21.7574 19.75 20.75 20.7574 20.75 22C20.75 23.2426 21.7574 24.25 23 24.25C24.2426 24.25 25.25 23.2426 25.25 22ZM23 18.25C25.0711 18.25 26.75 19.9289 26.75 22C26.75 24.0711 25.0711 25.75 23 25.75C20.9289 25.75 19.25 24.0711 19.25 22C19.25 19.9289 20.9289 18.25 23 18.25ZM11.25 9C11.25 7.75736 10.2426 6.75 9 6.75C7.75736 6.75 6.75 7.75736 6.75 9C6.75 10.2426 7.75736 11.25 9 11.25C10.2426 11.25 11.25 10.2426 11.25 9ZM9.75 12.675C11.4617 12.3275 12.75 10.8142 12.75 9C12.75 6.92893 11.0711 5.25 9 5.25C6.92893 5.25 5.25 6.92893 5.25 9C5.25 10.8142 6.53832 12.3275 8.25 12.675L8.25 24C8.25 24.4142 8.58579 24.75 9 24.75L16 24.75C16.4142 24.75 16.75 24.4142 16.75 24L16.75 7.75L22.25 7.75L22.25 14.1893L21.0303 12.9697C20.7374 12.6768 20.2626 12.6768 19.9697 12.9697C19.6768 13.2626 19.6768 13.7374 19.9697 14.0303L22.4697 16.5303C22.7626 16.8232 23.2374 16.8232 23.5303 16.5303L26.0303 14.0303C26.3232 13.7374 26.3232 13.2626 26.0303 12.9697C25.7374 12.6768 25.2626 12.6768 24.9697 12.9697L23.75 14.1893L23.75 7C23.75 6.58579 23.4142 6.25 23 6.25L16 6.25C15.5858 6.25 15.25 6.58579 15.25 7L15.25 23.25L9.75 23.25L9.75 12.675Z"})]}),ch=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 32 33",...e,children:[(0,n.jsx)($e,{children:(0,n.jsx)("path",{className:Ue,d:"M20.7271 2C21.4372 2 21.7114 2.00463 22.0841 2.03504C22.8228 2.0954 23.4839 2.25122 24.1592 2.59527C25.1865 3.1188 26.0219 3.9541 26.5458 4.98208C26.8896 5.65706 27.0454 6.31812 27.1057 7.05672C27.1301 7.35469 27.1379 7.58979 27.14 8.03558L27.1408 9.10155C27.1408 11.2114 25.4304 12.922 23.3205 12.922C21.4083 12.922 19.8243 11.5172 19.5441 9.68336L19.538 9.64H18.39V21.687L20.0392 21.6877C22.149 21.6877 23.8595 23.398 23.8595 25.508C23.8595 27.6178 22.149 29.3283 20.0392 29.3283H9.10159C6.99169 29.3283 5.28127 27.6178 5.28127 25.508C5.28127 23.398 6.99172 21.6877 9.10159 21.6877L10.75 21.687V9.64H9.601L9.59661 9.68334C9.32609 11.4539 7.84018 12.8246 6.01692 12.917L5.82032 12.922C3.71035 12.922 2 11.2114 2 9.10155V8.41371C2 7.70349 2.00463 7.42929 2.03504 7.05674C2.09538 6.31803 2.25122 5.65681 2.59521 4.98173C3.11877 3.95419 3.95418 3.11876 4.98174 2.5952C5.65683 2.25122 6.31798 2.09539 7.057 2.03501C7.42935 2.00463 7.70354 2 8.41371 2H20.7271Z"})}),(0,n.jsx)("path",{fill:"currentColor",d:"M8.41371 5H20.7271C21.1595 5 21.5325 5 21.8398 5.02507C22.1641 5.05157 22.4867 5.11007 22.7971 5.26822C23.2601 5.50416 23.6366 5.88064 23.8726 6.3437C24.0307 6.65409 24.0892 6.97666 24.1157 7.30097C24.1408 7.60823 24.1408 7.98127 24.1408 8.41369V9.10155C24.1408 9.55465 23.7735 9.92195 23.3205 9.92195C22.8674 9.92195 22.5001 9.55465 22.5001 9.10155V8.44533C22.5001 7.97237 22.4995 7.66699 22.4805 7.43457C22.4623 7.21172 22.4314 7.12909 22.4107 7.08853C22.3321 6.93418 22.2066 6.80869 22.0522 6.73004C22.0117 6.70938 21.9291 6.67847 21.7062 6.66026C21.4738 6.64127 21.1684 6.64063 20.6954 6.64063H15.3907V24.6877H20.0392C20.4922 24.6877 20.8595 25.0549 20.8595 25.508C20.8595 25.961 20.4922 26.3283 20.0392 26.3283H9.10159C8.64854 26.3283 8.28127 25.961 8.28127 25.508C8.28127 25.0549 8.64854 24.6877 9.10159 24.6877H13.7501V6.64063H8.44533C7.97238 6.64063 7.66699 6.64127 7.43457 6.66026C7.21172 6.67847 7.1291 6.70938 7.08854 6.73004C6.93418 6.80869 6.80869 6.93418 6.73004 7.08853C6.70938 7.12909 6.67847 7.21172 6.66026 7.43457C6.64127 7.66699 6.64063 7.97237 6.64063 8.44533V9.10155C6.64063 9.55465 6.27337 9.92195 5.82032 9.92195C5.36727 9.92195 5 9.55465 5 9.10155V8.41371C5 7.98128 5 7.60823 5.02508 7.30097C5.05157 6.97666 5.11007 6.65409 5.26823 6.3437C5.50417 5.88064 5.88064 5.50416 6.3437 5.26822C6.65409 5.11007 6.97666 5.05157 7.30097 5.02507C7.60824 5 7.98129 5 8.41371 5Z"})]}),dh={x:.5,y:.5},uh=.2,hh={x:.375,y:.25,width:.25,height:.5},ph={zOrder:"background"},mh={x:.4,y:.6},gh={x:.6,y:.4},xh="relative-difference",vh=({title:e,layout:t="collapsible",preview:r})=>{const a=N(),o=l.useHandleScene(a),i=l.useI18n(),{Button:s}=D();if(!o)return null;const c=()=>{a.commands.dispatch(new p.AddAnnotationCommand({kind:"text",annotation:{...p.TEXT_ANNOTATION_DEFAULTS,content:fh(i("editor.annotatePanel.callOutSection.text")),at:{anchorType:"panel",...dh},width:uh}}))},d=()=>{a.commands.dispatch(new p.AddAnnotationCommand({kind:"arrow",annotation:{...p.ARROW_DEFAULTS,start:{anchorType:"panel",...mh},end:{anchorType:"panel",...gh}}}))},h=()=>{a.commands.dispatch(new p.AddAnnotationCommand({kind:"shape",annotation:{...p.SHAPE_DEFAULTS,...ph,region:{anchorType:"panel",...hh}}}))},u=()=>{const g=(0,p.inferDefaultDifferenceArrowEndpoints)(o);g!==null&&a.commands.dispatch(new p.AddAnnotationCommand({kind:"differenceArrow",annotation:{...p.DIFFERENCE_ARROW_DEFAULTS,...g,label:xh}}))},m=o.coordSystem.type==="cartesian";return(0,n.jsx)(F,{title:e??i("editor.annotatePanel.callOutSection.title"),layout:t,preview:r,children:(0,n.jsxs)(ra,{children:[(0,n.jsx)(s,{variant:"tile",icon:(0,n.jsx)(ch,{size:"xl"}),label:i("editor.annotatePanel.callOutSection.text"),onClick:c}),(0,n.jsx)(s,{variant:"tile",icon:(0,n.jsx)(ih,{size:"xl"}),label:i("editor.annotatePanel.callOutSection.arrow"),onClick:d}),(0,n.jsx)(s,{variant:"tile",icon:(0,n.jsx)(sh,{size:"xl"}),label:i("editor.annotatePanel.callOutSection.box"),onClick:h}),m&&(0,n.jsx)(s,{variant:"tile",icon:(0,n.jsx)(lh,{size:"xl"}),label:i("editor.annotatePanel.callOutSection.difference"),onClick:u})]})})},fh=e=>({type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e}]}]}),bh=({title:e,layout:t="collapsible",preview:r})=>{const a=N(),o=l.useHandleScene(a),i=l.useI18n(),{ToggleGroup:s}=D();if(!o)return null;const c=(0,p.readChartType)(o.spec);if(c===null||!(0,p.isComboChartType)(c))return null;const d=p.COMBO_TYPES.map(u=>({value:u,label:i(`editor.graphPanel.comboSection.types.${u}`)})),h=u=>{const m=p.COMBO_TYPES.find(g=>g===u);m&&a.commands.dispatch(new p.SetChartTypeCommand({coordType:"cartesian",comboType:m}))};return(0,n.jsx)(F,{title:e??i("editor.graphPanel.comboSection.title"),layout:t,preview:r??i(`editor.graphPanel.comboSection.types.${c.comboType}`),children:(0,n.jsx)(s,{value:c.comboType,options:d,onChange:h,ariaLabel:i("editor.graphPanel.comboSection.title")})})},Sh=.1,yh=20,Ch=({title:e,preview:t})=>{const r=N(),a=l.useHandleScene(r),o=l.useI18n(),{NumberField:i,TextField:s}=D();if(!a||a.coordSystem.type==="polar")return null;const c=(0,p.findGoalLineLayer)(a.spec.layers),d=e??o("editor.annotationsPanel.goalSection.title"),h=(0,p.readConstantValue)(c?.mapping.y),u=typeof h=="number"?h:null,m=f=>{const b=new p.ToggleGoalLineCommand({showGoalLine:f,value:jh(a),...c!==void 0&&{layerId:c.id}});r.commands.dispatch(b)},g=f=>{if(c===void 0)return;const b=new p.SetRuleLabelCommand({layerId:c.id,label:f===""?null:f});r.commands.dispatch(b,{transient:!0})},x=f=>{if(c===void 0||f===null)return;const b=new p.SetRuleValueCommand({layerId:c.id,value:f});r.commands.dispatch(b,{transient:!0})};return(0,n.jsx)(la,{title:d,preview:t,isChecked:c!==void 0,onToggle:m,children:(0,n.jsxs)(G,{children:[(0,n.jsx)(A,{label:o("editor.annotationsPanel.goalSection.labelControl"),children:(0,n.jsx)(s,{value:c?.params.label??"",placeholder:o("editor.annotationsPanel.goalSection.labelPlaceholder"),onChange:g,onCommit:r.commands.commit,ariaLabel:o("editor.annotationsPanel.goalSection.labelAriaLabel")})}),(0,n.jsx)(A,{label:o("editor.annotationsPanel.goalSection.valueControl"),children:(0,n.jsx)(i,{value:u,placeholder:o("editor.powerUpPanel.valueInput.numberPlaceholder"),onChange:x,onCommit:r.commands.commit,ariaLabel:o("editor.annotationsPanel.goalSection.valueAriaLabel")})})]})})},jh=e=>{const t=(e.scales.y?.domain??[]).filter(s=>typeof s=="number");if(t.length===0)return 0;const r=Math.max(...t),a=r-Math.min(...t),o=a>0?a:Math.abs(r);if(o===0)return 0;const i=Math.min(yh,Math.max(0,1-Math.floor(Math.log10(o))));return Number((r+o*Sh).toFixed(i))},wh=({layerId:e,title:t,layout:r="collapsible",preview:a})=>{const o=N(),i=l.useHandleScene(o),s=l.useI18n(),{Switch:c}=D();if(!i)return null;const d=e===void 0?i.spec.layers[0]:(0,p.findLayerById)(i.spec.layers,e);if(!d)return null;const{showDataLabels:h,format:u,showStackTotals:m,showCategoryLabels:g}=d.dataLabels,x=i.coordSystem.type,f=x==="polar",b=d.geom==="bar",w=b&&!f&&d.position==="stack",T=b&&(!f||h),y=(0,p.findLayerById)(i.layers,d.id),k=y!==void 0&&o.canFormatDataLabelsAsPercentages(y,x);if(!o.canPlaceDataLabels(d.geom,x))return null;const j=O=>{const M=new p.ToggleDataLabelsCommand({layerId:d.id,showDataLabels:O});o.commands.dispatch(M)},I=O=>{const M=new p.SetDataLabelsFormatCommand({layerId:d.id,format:O?"percentage":"absolute"});o.commands.dispatch(M)},P=O=>{const M=new p.ToggleStackTotalsCommand({layerId:d.id,showStackTotals:O});o.commands.dispatch(M)},E=O=>{const M=new p.ToggleCategoryLabelsCommand({layerId:d.id,showCategoryLabels:O});o.commands.dispatch(M)};return(0,n.jsx)(F,{title:t??s("editor.graphPanel.graphOptionsSection.title"),layout:r,preview:a,children:(0,n.jsxs)(G,{children:[(0,n.jsx)(A,{label:s("editor.graphPanel.graphOptions.dataLabels"),children:(0,n.jsx)(c,{isChecked:h,onChange:j})}),h&&k&&(0,n.jsx)(A,{label:s("editor.graphPanel.graphOptions.showPercentages"),children:(0,n.jsx)(c,{isChecked:u==="percentage",onChange:I})}),w&&(0,n.jsx)(A,{label:s("editor.graphPanel.graphOptions.stackTotals"),children:(0,n.jsx)(c,{isChecked:m,onChange:P})}),T&&(0,n.jsx)(A,{label:s("editor.graphPanel.graphOptions.categoryLabels"),children:(0,n.jsx)(c,{isChecked:g,onChange:E})})]})})},Th=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.8",d:"M10.394 12.734 5.63 7.652 0 13.822V16h16V8.741z"}),(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.3",d:"M5.744 5.565 0 11.826V8l5.744-6.957 4.718 2.087L16 0v6.957l-5.538 4z"})]}),Ah=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 16 16",...e,children:(0,n.jsxs)("g",{transform:"rotate(90 8 8)",children:[(0,n.jsx)("rect",{width:"3.2",height:"7.704",y:"8.296",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"11.259",x:"4.267",y:"4.741",fill:"currentColor",fillOpacity:"0.3",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"4.741",x:"8.533",y:"11.259",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"16",x:"12.8",fill:"currentColor",fillOpacity:"0.3",rx:".533"})]})}),kh=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 16 16",...e,children:(0,n.jsxs)("g",{transform:"rotate(90 8 8)",children:[(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.8",d:"M0 13.037h4.267v2.445a.52.52 0 0 1-.519.518H.518A.52.52 0 0 1 0 15.482zM5.867 7.704h4.266v7.778a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.518-.518zM11.733 10.074H16v5.408a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.519-.518z"}),(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.3",d:"M0 12.445h4.267V.52A.52.52 0 0 0 3.748 0H.518A.52.52 0 0 0 0 .519zM5.867 7.111h4.266V.52A.52.52 0 0 0 9.615 0h-3.23a.52.52 0 0 0-.518.519zM11.733 9.481H16V.52A.52.52 0 0 0 15.482 0h-3.23a.52.52 0 0 0-.519.519z"})]})}),Ph=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 16 16",...e,children:(0,n.jsxs)("g",{transform:"rotate(90 8 8)",children:[(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.8",d:"M0 13.037h4.267v2.445a.52.52 0 0 1-.519.518H.518A.52.52 0 0 1 0 15.482zM5.867 7.704h4.266v7.778a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.518-.518zM11.733 10.074H16v5.408a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.519-.518z"}),(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.3",d:"M0 7.037c0-.286.232-.518.519-.518h3.23c.286 0 .518.232.518.518v5.408H0zM5.867 7.111h4.266V4.074a.52.52 0 0 0-.518-.518h-3.23a.52.52 0 0 0-.518.518zM11.733 9.481H16V.52A.52.52 0 0 0 15.482 0h-3.23a.52.52 0 0 0-.519.519z"})]})}),Lh=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("rect",{width:"3.2",height:"7.704",y:"8.296",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"11.259",x:"4.267",y:"4.741",fill:"currentColor",fillOpacity:"0.3",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"4.741",x:"8.533",y:"11.259",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"16",x:"12.8",fill:"currentColor",fillOpacity:"0.3",rx:".533"})]}),Ih=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.8",d:"M0 13.037h4.267v2.445a.52.52 0 0 1-.519.518H.518A.52.52 0 0 1 0 15.482zM5.867 7.704h4.266v7.778a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.518-.518zM11.733 10.074H16v5.408a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.519-.518z"}),(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.3",d:"M0 12.445h4.267V.52A.52.52 0 0 0 3.748 0H.518A.52.52 0 0 0 0 .519zM5.867 7.111h4.266V.52A.52.52 0 0 0 9.615 0h-3.23a.52.52 0 0 0-.518.519zM11.733 9.481H16V.52A.52.52 0 0 0 15.482 0h-3.23a.52.52 0 0 0-.519.519z"})]}),Eh=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.8",d:"M0 13.037h4.267v2.445a.52.52 0 0 1-.519.518H.518A.52.52 0 0 1 0 15.482zM5.867 7.704h4.266v7.778a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.518-.518zM11.733 10.074H16v5.408a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.519-.518z"}),(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.3",d:"M0 7.037c0-.286.232-.518.519-.518h3.23c.286 0 .518.232.518.518v5.408H0zM5.867 7.111h4.266V4.074a.52.52 0 0 0-.518-.518h-3.23a.52.52 0 0 0-.518.518zM11.733 9.481H16V.52A.52.52 0 0 0 15.482 0h-3.23a.52.52 0 0 0-.519.519z"})]}),Mh=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsxs)("g",{fill:"currentColor",fillOpacity:"0.3",children:[(0,n.jsx)("rect",{width:"3.2",height:"6.5",y:"9.5",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"8.5",x:"4.267",y:"7.5",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"5",x:"8.533",y:"11",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"7.5",x:"12.8",y:"8.5",rx:".533"})]}),(0,n.jsxs)("g",{fill:"currentColor",fillOpacity:"0.8",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:"0.8",strokeWidth:".993",children:[(0,n.jsx)("path",{fill:"none",d:"M1.6 6.2 5.867 3.6l4.266 3.8 4.267-3"}),(0,n.jsx)("circle",{cx:"1.6",cy:"6.2",r:".9",stroke:"none"}),(0,n.jsx)("circle",{cx:"5.867",cy:"3.6",r:".9",stroke:"none"}),(0,n.jsx)("circle",{cx:"10.133",cy:"7.4",r:".9",stroke:"none"}),(0,n.jsx)("circle",{cx:"14.4",cy:"4.4",r:".9",stroke:"none"})]})]}),Rh=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 16 16",...e,children:(0,n.jsxs)("g",{fill:"none",stroke:"currentColor",strokeWidth:"5",transform:"rotate(-90 8 8)",children:[(0,n.jsx)("circle",{cx:"8",cy:"8",r:"5.5",pathLength:"100",strokeOpacity:"0.3"}),(0,n.jsx)("circle",{cx:"8",cy:"8",r:"5.5",pathLength:"100",strokeOpacity:"0.6",strokeDasharray:"25 100"}),(0,n.jsx)("circle",{cx:"8",cy:"8",r:"5.5",pathLength:"100",strokeOpacity:"0.8",strokeDasharray:"25 100",strokeDashoffset:"-25"})]})}),Oh=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 16 16",...e,children:(0,n.jsxs)("g",{fill:"currentColor",children:[(0,n.jsx)("rect",{width:"4.267",height:"4.267",y:"0.533",fillOpacity:"0.3",rx:".533"}),(0,n.jsx)("rect",{width:"4.267",height:"4.267",x:"5.867",y:"0.533",fillOpacity:"0.55",rx:".533"}),(0,n.jsx)("rect",{width:"4.267",height:"4.267",x:"11.733",y:"0.533",fillOpacity:"0.2",rx:".533"}),(0,n.jsx)("rect",{width:"4.267",height:"4.267",y:"5.867",fillOpacity:"0.55",rx:".533"}),(0,n.jsx)("rect",{width:"4.267",height:"4.267",x:"5.867",y:"5.867",fillOpacity:"0.9",rx:".533"}),(0,n.jsx)("rect",{width:"4.267",height:"4.267",x:"11.733",y:"5.867",fillOpacity:"0.45",rx:".533"}),(0,n.jsx)("rect",{width:"4.267",height:"4.267",y:"11.2",fillOpacity:"0.2",rx:".533"}),(0,n.jsx)("rect",{width:"4.267",height:"4.267",x:"5.867",y:"11.2",fillOpacity:"0.45",rx:".533"}),(0,n.jsx)("rect",{width:"4.267",height:"4.267",x:"11.733",y:"11.2",fillOpacity:"0.75",rx:".533"})]})}),_h=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 16 16",...e,children:(0,n.jsxs)("g",{fill:"currentColor",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:".993",children:[(0,n.jsxs)("g",{fillOpacity:"0.3",strokeOpacity:"0.3",children:[(0,n.jsx)("path",{fill:"none",d:"M1.4 12.2 6 6.4l4.2 1.2 4.4-4.2"}),(0,n.jsx)("circle",{cx:"1.4",cy:"12.2",r:".9",stroke:"none"}),(0,n.jsx)("circle",{cx:"6",cy:"6.4",r:".9",stroke:"none"}),(0,n.jsx)("circle",{cx:"10.2",cy:"7.6",r:".9",stroke:"none"}),(0,n.jsx)("circle",{cx:"14.6",cy:"3.4",r:".9",stroke:"none"})]}),(0,n.jsxs)("g",{fillOpacity:"0.8",strokeOpacity:"0.8",children:[(0,n.jsx)("path",{fill:"none",d:"M1.4 5.6 6 11.4l4.2-1.2 4.4 1.2"}),(0,n.jsx)("circle",{cx:"1.4",cy:"5.6",r:".9",stroke:"none"}),(0,n.jsx)("circle",{cx:"6",cy:"11.4",r:".9",stroke:"none"}),(0,n.jsx)("circle",{cx:"10.2",cy:"10.2",r:".9",stroke:"none"}),(0,n.jsx)("circle",{cx:"14.6",cy:"11.4",r:".9",stroke:"none"})]})]})}),Nh=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("rect",{width:"16",height:"16",fill:"currentColor",fillOpacity:"0.3",rx:"8"}),(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.6",d:"m7.999 16 .412-.01A8 8 0 0 0 8 0z"}),(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.8",d:"M15.999 8a8 8 0 0 1-7.588 7.989l-.412.01V8z"})]}),Dh=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 16 16",...e,children:(0,n.jsxs)("g",{fill:"none",stroke:"currentColor",strokeLinejoin:"round",children:[(0,n.jsx)("polygon",{points:"8,0.5 15.13,5.68 12.41,14.07 3.59,14.07 0.87,5.68",strokeOpacity:"0.3",strokeWidth:".8"}),(0,n.jsx)("polygon",{points:"8,2.5 14.66,5.84 10.06,10.83 4.47,12.85 3.72,6.61",strokeOpacity:"0.8",strokeWidth:"1.2"})]})}),Fh=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("polygon",{points:"8,0.5 15.13,5.68 12.41,14.07 3.59,14.07 0.87,5.68",fill:"none",stroke:"currentColor",strokeLinejoin:"round",strokeOpacity:"0.3",strokeWidth:".8"}),(0,n.jsx)("polygon",{points:"8,2.5 14.66,5.84 10.06,10.83 4.47,12.85 3.72,6.61",fill:"currentColor",fillOpacity:"0.6"})]}),zh=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 16 16",...e,children:(0,n.jsxs)("g",{fill:"none",stroke:"currentColor",strokeWidth:"1.5",transform:"rotate(-90 8 8)",children:[(0,n.jsxs)("g",{strokeOpacity:"0.2",children:[(0,n.jsx)("circle",{cx:"8",cy:"8",r:"6.6"}),(0,n.jsx)("circle",{cx:"8",cy:"8",r:"4.4"}),(0,n.jsx)("circle",{cx:"8",cy:"8",r:"2.2"})]}),(0,n.jsx)("circle",{cx:"8",cy:"8",r:"6.6",pathLength:"100",strokeDasharray:"72 100",strokeOpacity:"0.8"}),(0,n.jsx)("circle",{cx:"8",cy:"8",r:"4.4",pathLength:"100",strokeDasharray:"52 100",strokeOpacity:"0.6"}),(0,n.jsx)("circle",{cx:"8",cy:"8",r:"2.2",pathLength:"100",strokeDasharray:"34 100",strokeOpacity:"0.45"})]})}),Bh=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 16 16",...e,children:(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.75",d:"M8.4 7.31 8.4 1.01A7 7 0 0 1 13.85 4.16ZM8.8 8 13.64 5.2A6.3 6.3 0 0 1 13.64 10.8ZM8.4 8.69 12.64 11.14A5.6 5.6 0 0 1 8.4 13.59ZM7.6 8.69 7.6 12.78A4.8 4.8 0 0 1 4.06 10.74ZM7.2 8 4.27 9.69A4.1 4.1 0 0 1 4.27 6.31ZM7.6 7.31 5.19 5.92A3.5 3.5 0 0 1 7.6 4.52Z"})}),Hh=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 16 16",...e,children:(0,n.jsxs)("g",{fill:"currentColor",children:[(0,n.jsx)("path",{fillOpacity:"0.35",d:"M8.4 3.82 8.4 1.01A7 7 0 0 1 13.85 4.16L11.42 5.56A4.2 4.2 0 0 0 8.4 3.82ZM11.46 6.47 13.64 5.2A6.3 6.3 0 0 1 13.64 10.8L11.46 9.53A3.78 3.78 0 0 0 11.46 6.47ZM10.69 10.01 12.64 11.14A5.6 5.6 0 0 1 8.4 13.59L8.4 11.34A3.36 3.36 0 0 0 10.69 10.01ZM7.6 10.85 7.6 12.78A4.8 4.8 0 0 1 4.06 10.74L5.73 9.77A2.88 2.88 0 0 0 7.6 10.85ZM5.7 8.87 4.27 9.69A4.1 4.1 0 0 1 4.27 6.31L5.7 7.13A2.46 2.46 0 0 0 5.7 8.87ZM6.41 6.62 5.19 5.92A3.5 3.5 0 0 1 7.6 4.52L7.6 5.94A2.1 2.1 0 0 0 6.41 6.62Z"}),(0,n.jsx)("path",{fillOpacity:"0.9",d:"M8.4 7.31 8.4 3.82A4.2 4.2 0 0 1 11.42 5.56ZM8.8 8 11.46 6.47A3.78 3.78 0 0 1 11.46 9.53ZM8.4 8.69 10.69 10.01A3.36 3.36 0 0 1 8.4 11.34ZM7.6 8.69 7.6 10.85A2.88 2.88 0 0 1 5.73 9.77ZM7.2 8 5.7 8.87A2.46 2.46 0 0 1 5.7 7.13ZM7.6 7.31 6.41 6.62A2.1 2.1 0 0 1 7.6 5.94Z"})]})}),Gh=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 16 16",...e,children:(0,n.jsxs)("g",{fill:"currentColor",fillOpacity:"0.8",children:[(0,n.jsx)("circle",{cx:"1.028",cy:"13.897",r:"1.028"}),(0,n.jsx)("circle",{cx:"2.57",cy:"8.243",r:"1.028"}),(0,n.jsx)("circle",{cx:"5.653",cy:"12.355",r:"1.028"}),(0,n.jsx)("circle",{cx:"8.223",cy:"8.243",r:"1.028"}),(0,n.jsx)("circle",{cx:"9.252",cy:"3.618",r:"1.028"}),(0,n.jsx)("circle",{cx:"12.849",cy:"7.215",r:"1.028"}),(0,n.jsx)("circle",{cx:"14.905",cy:"1.561",r:"1.028"})]})}),Vh=.55,$h=.15,dt=[{name:"column",icon:Lh,summary:{coordType:"cartesian",geom:"bar",position:"dodge"}},{name:"columnStacked",icon:Eh,summary:{coordType:"cartesian",geom:"bar",position:"stack"}},{name:"columnStackedFill",icon:Ih,summary:{coordType:"cartesian",geom:"bar",position:"fill"}},{name:"bar",icon:Ah,summary:{coordType:"flip",geom:"bar",position:"dodge"}},{name:"barStacked",icon:Ph,summary:{coordType:"flip",geom:"bar",position:"stack"}},{name:"barStackedFill",icon:kh,summary:{coordType:"flip",geom:"bar",position:"fill"}},{name:"line",icon:_h,summary:{coordType:"cartesian",geom:"line",position:"identity"}},{name:"areaStacked",icon:Th,summary:{coordType:"cartesian",geom:"area",position:"stack"}},{name:"combo",icon:Mh,summary:{coordType:"cartesian",comboType:"grouped-bars"}},{name:"scatter",icon:Gh,summary:{coordType:"cartesian",geom:"point",position:"identity"}},{name:"pie",icon:Nh,summary:{coordType:"polar",geom:"bar",position:"fill",theta:"y",innerRadius:0}},{name:"donut",icon:Rh,summary:{coordType:"polar",geom:"bar",position:"fill",theta:"y",innerRadius:Vh}},{name:"radialBar",icon:zh,summary:{coordType:"polar",geom:"bar",position:"stack",theta:"y",innerRadius:$h}},{name:"rose",icon:Bh,summary:{coordType:"polar",geom:"bar",position:"dodge",theta:"x",innerRadius:0}},{name:"roseStacked",icon:Hh,summary:{coordType:"polar",geom:"bar",position:"stack",theta:"x",innerRadius:0}},{name:"radar",icon:Dh,summary:{coordType:"polar",geom:"line",position:"identity",theta:"x",innerRadius:0}},{name:"radarFilled",icon:Fh,summary:{coordType:"polar",geom:"area",position:"identity",theta:"x",innerRadius:0}},{name:"heatmap",icon:Oh,summary:{coordType:"cartesian",geom:"tile",position:"identity"}}],Uh=.05,Wh=e=>e===null?null:dt.find(t=>Kh(t.summary,e))??null,qh=(e,t)=>{const{summary:r}=e;return t===null||(0,p.isComboChartType)(r)?r:r.position==="dodge"&&ga(t)?{...r,position:"identity"}:r.coordType!=="polar"||!Ee(r.innerRadius)||t.coordType!=="polar"||!Ee(t.innerRadius)?r:{...r,innerRadius:t.innerRadius}},ga=e=>!(0,p.isComboChartType)(e)&&e.geom==="bar"&&e.position==="identity",Kh=(e,t)=>{if((0,p.isComboChartType)(e)||(0,p.isComboChartType)(t))return(0,p.isComboChartType)(e)&&(0,p.isComboChartType)(t);const r=e.position===t.position||e.position==="dodge"&&ga(t);return e.coordType!==t.coordType||e.geom!==t.geom||!r?!1:e.coordType!=="polar"||t.coordType!=="polar"?!0:e.theta===t.theta&&Ee(e.innerRadius)===Ee(t.innerRadius)},Ee=e=>e>=Uh,Xh=3,Zh=({title:e,layout:t="collapsible",preview:r})=>{const a=N(),o=l.useHandleScene(a),i=l.useI18n(),{RadioGrid:s}=D(),c=(0,v.useMemo)(()=>dt.map(({name:m,icon:g})=>({value:m,label:i(`editor.graphTypes.${m}`),icon:(0,n.jsx)(g,{size:"md"}),isDisabled:m==="combo"&&!(0,p.canBecomeCombo)(o?.spec)||m==="heatmap"&&!(0,p.canBecomeHeatmap)(o?.spec)})),[i,o]);if(!o)return null;const d=(0,p.readChartType)(o.spec),h=Wh(d),u=m=>{const g=dt.find(x=>x.name===m);g&&a.commands.dispatch(new p.SetChartTypeCommand(qh(g,d)))};return(0,n.jsx)(F,{title:e??i("editor.graphPanel.graphTypeSection.title"),layout:t,preview:r??(h===null?void 0:i(`editor.graphTypes.${h.name}`)),children:(0,n.jsx)(s,{value:h?.name??"",options:c,columns:Xh,onChange:u,ariaLabel:i("editor.graphPanel.graphTypeSection.title")})})},Sn=["solid","dashed","dotted"],Yh=8,Jh=0,Qh=({title:e,layout:t="collapsible",preview:r})=>{const a=N(),o=l.useHandleScene(a),i=l.useI18n(),{Slider:s,Switch:c,ToggleGroup:d}=D(),h=Ge(o);if(!o||!h)return null;const u=o.guides.axes.filter(e1);if(u.length===0)return null;const m=o.coordSystem.type!=="polar",g=u.some(y=>y.gridVisible),x=h.gridLine.y().resolve(),f=Sn.map(y=>({value:y,label:i(`editor.graphPanel.gridSection.lineStyles.${y}`)})),b=y=>k=>{a.commands.dispatch(new p.SetGridVisibilityCommand({axis:y,isVisible:k}))},w=y=>{const k=Sn.find(j=>j===y);k&&a.commands.dispatch(new p.SetGridLineStyleCommand({axis:"both",lineStyle:k}))},T=y=>{a.commands.dispatch(new p.SetGridLineWidthCommand({axis:"both",lineWidth:y}),{transient:!0})};return(0,n.jsx)(F,{title:e??i("editor.graphPanel.gridSection.title"),layout:t,preview:r,children:(0,n.jsxs)(G,{children:[u.map(y=>(0,n.jsx)(A,{label:i(t1(y)),children:(0,n.jsx)(c,{isChecked:y.gridVisible,onChange:b(y.scaleAestheticKey)})},y.scaleAestheticKey)),m&&g&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(A,{label:i("editor.graphPanel.gridSection.gridStyle"),children:(0,n.jsx)(d,{value:(0,p.toDashPreset)(x.dashArray),options:f,onChange:w})}),(0,n.jsx)(A,{label:i("editor.graphPanel.gridSection.gridThickness"),children:(0,n.jsx)(s,{value:x.strokeWidth,min:Jh,max:Yh,step:.5,formatValue:Ve,onChange:T,onCommit:a.commands.commit})})]})]})})},e1=e=>e.scaleAestheticKey==="x"||e.scaleAestheticKey==="y",t1=e=>e.geometry==="radial"?"editor.graphPanel.gridSection.rings":e.geometry==="circular"?"editor.graphPanel.gridSection.spokes":e.scaleAestheticKey==="x"?"editor.graphPanel.gridSection.verticalGridLines":"editor.graphPanel.gridSection.horizontalGridLines",n1="total",xa=["total","average","current"],r1=["total"],yn=["previous","first"],Cn=["auto","small","medium","large"],a1=({title:e,layout:t="collapsible",preview:r})=>{const a=N(),o=l.useHandleScene(a),i=l.useI18n(),{Switch:s,ToggleGroup:c}=D();if(!o)return null;const d=o.config.headline,h=d.show!=="none",u=o.coordSystem,m=u.type==="polar",g=u.type==="polar"&&u.innerRadius>0,x=o.layers.some(C=>C.summary.grandTotal!==void 0);if(m&&!x)return null;const f=m?r1:xa,b=o.guides.headline,w=b?.kind==="perGroup"&&b.items.some(C=>C.comparison!==null),T=f.map(C=>({value:C,label:i(`editor.graphPanel.headlineNumberSection.metrics.${C}`)})),y=yn.map(C=>({value:C,label:i(`editor.graphPanel.headlineNumberSection.comparison.${C}`)})),k=Cn.map(C=>({value:C,label:i(C==="auto"?"editor.graphPanel.numberFormat.options.auto":`editor.graphPanel.headlineNumberSize.sizes.${C}`)})),j=[{value:"above",label:i("editor.graphPanel.headlineNumberSection.position.above")},{value:"center",label:i("editor.graphPanel.headlineNumberSection.position.center")}],I=C=>{a.commands.dispatch(new p.SetHeadlineShowCommand({show:C?n1:"none"}))},P=C=>{const S=f.find(z=>z===C);S&&a.commands.dispatch(new p.SetHeadlineShowCommand({show:S}))},E=C=>{const S=yn.find(z=>z===C);S&&a.commands.dispatch(new p.SetHeadlineCompareWithCommand({compareWith:S}))},O=C=>{const S=Cn.find(z=>z===C);S&&a.commands.dispatch(new p.SetHeadlineSizeCommand({size:S}))},M=C=>{a.commands.dispatch(new p.SetHeadlinePositionCommand({position:C==="center"?"center":"above"}))};return(0,n.jsx)(F,{title:e??i("editor.graphPanel.headlineNumberSection.title"),layout:t,preview:r??o1(i,d.show),children:(0,n.jsxs)(G,{children:[(0,n.jsx)(A,{label:i("editor.graphPanel.headlineNumberSection.toggle"),children:(0,n.jsx)(s,{isChecked:h,onChange:I})}),h&&(0,n.jsxs)(n.Fragment,{children:[T.length>1&&(0,n.jsx)(A,{label:i("editor.graphPanel.headlineNumberSection.metricLabel"),layout:"stack",children:(0,n.jsx)(c,{value:d.show,options:T,onChange:P})}),w&&(0,n.jsx)(A,{label:i("editor.graphPanel.headlineNumberSection.compareWithLabel"),layout:"stack",children:(0,n.jsx)(c,{value:(0,p.resolveComparisonBasis)(d.compareWith),options:y,onChange:E})}),(0,n.jsx)(A,{label:i("editor.graphPanel.headlineNumberSize.sizeLabel"),children:(0,n.jsx)(c,{value:d.size,options:k,onChange:O})}),g&&(0,n.jsx)(A,{label:i("editor.axesPanel.controls.position"),children:(0,n.jsx)(c,{value:d.position,options:j,onChange:M})})]})]})})},o1=(e,t)=>{const r=xa.find(a=>a===t);return r&&e(`editor.graphPanel.headlineNumberSection.metrics.${r}`)},Ze=["top","bottom","left","right","none"],jn=["auto","start","center","end"],wn=["auto","pill","direct"],i1=({positions:e,title:t,layout:r="collapsible",preview:a})=>{const o=N(),i=l.useHandleScene(o),s=l.useI18n(),{ToggleGroup:c}=D();if(!i)return null;const d=i.config.legend.position,h=e??Ze,u=i.guides.legends.drawn[0],m=(0,p.canAnchorDirectLabels)({legendPosition:i.guides.legends.position,coordSystem:i.coordSystem,layers:i.layers}),g=i.guides.headline?.kind==="perGroup",x=i.guides.colorGroups.length>0;if(d==="auto"&&u===void 0&&!m&&(g||!x))return null;const f=u?.position??"none",b=d==="auto"?f:d,w=Ze.filter(M=>M===b||h.includes(M)).map(M=>({value:M,label:s(`editor.graphPanel.legendSection.${M}`)})),T=M=>{const C=Ze.find(S=>S===M);C&&o.commands.dispatch(new p.SetLegendPositionCommand({position:C}))},y=M=>{const C=jn.find(S=>S===M);C&&o.commands.dispatch(new p.SetLegendAlignCommand({align:C}))},k=M=>{const C=wn.find(S=>S===M);C&&o.commands.dispatch(new p.SetLegendDisplayCommand({display:C}))},j=jn.map(M=>({value:M,label:s(`editor.graphPanel.legendSection.align.${M}`)})),I=wn.map(M=>({value:M,label:s(`editor.graphPanel.legendSection.display.${M}`)})),P=t??s("editor.graphPanel.legendSection.title"),E=w.find(M=>M.value===b)?.label,O=u!==void 0;return(0,n.jsx)(F,{title:P,layout:r,preview:a??E,children:(0,n.jsxs)(G,{children:[(0,n.jsx)(A,{label:s("editor.axesPanel.controls.position"),layout:"stack",children:(0,n.jsx)(c,{value:b,options:w,onChange:T})}),O&&(0,n.jsx)(A,{label:s("editor.graphPanel.legendSection.alignLabel"),layout:"stack",children:(0,n.jsx)(c,{value:i.config.legend.align,options:j,onChange:y})}),m&&(0,n.jsx)(A,{label:s("editor.graphPanel.legendSection.displayLabel"),layout:"stack",children:(0,n.jsx)(c,{value:i.config.legend.display,options:I,onChange:k})})]})})},s1=1,l1=20,c1=.5,va=({layerId:e})=>{const t=N(),r=l.useHandleScene(t),{Slider:a}=D(),o=Pt(r,e,"point");if(!r)return null;const i=s=>{const c=new p.SetPointSizeCommand({layerId:e,size:s});t.commands.dispatch(c,{transient:!0})};return(0,n.jsx)(a,{value:o?.get("size")??p.DEFAULT_POINT_SIZE_PX,min:s1,max:l1,step:c1,formatValue:Ve,onChange:i,onCommit:t.commands.commit})},d1=1,u1=10,h1=.1,p1=["gap","zero","connect"],m1=({title:e,layout:t="collapsible",preview:r})=>{const a=N(),o=l.useHandleScene(a),i=l.useI18n(),{Select:s,Slider:c,Switch:d,ToggleGroup:h}=D(),u=o?.spec.layers??[],m=(0,p.findLayerByGeom)(u,"line","area"),g=Pt(o,m?.id??null,"line");if(!o||!m)return null;const x=o.coordSystem.type==="polar",f=v1(i,m),b=x1(m,u),w=Tn(o.spec,m.geom,"strokeWidth",m.id),T=typeof w=="number",y=m.geom==="line"?m:void 0,k=[{value:"auto",label:i("editor.graphPanel.numberFormat.options.auto")},{value:"custom",label:i("editor.graphPanel.numberFormat.options.custom")}],j=C=>{a.commands.dispatch(new p.ToggleLinePointsCommand({layerId:m.id,showPoints:C}))},I=C=>{y&&a.commands.dispatch(new p.ToggleLineFillCommand({layerId:y.id,showFill:C}))},P=C=>{a.commands.dispatch(new p.SetLineCurveCommand({layerId:m.id,curve:C?"smooth":"linear"}))},E=C=>{const S=g?.get("strokeWidth")??p.DEFAULT_STROKE_WIDTH_PX;a.commands.dispatch(new p.SetLineWidthCommand({layerId:m.id,lineWidth:C==="custom"?S:null}))},O=C=>{a.commands.dispatch(new p.SetLineWidthCommand({layerId:m.id,lineWidth:C}),{transient:!0})},M=C=>{const S=g1(C);S&&a.commands.dispatch(new p.SetLineMissingValuesCommand({layerId:m.id,missingValues:S}))};return(0,n.jsx)(F,{title:e??i("editor.fineTunePanel.lineStyleSection.title"),layout:t,preview:r,children:(0,n.jsxs)(G,{children:[(0,n.jsx)(A,{label:i("editor.graphPanel.graphOptions.showPoints"),children:(0,n.jsx)(d,{isChecked:b!==void 0,onChange:j})}),b&&(0,n.jsx)(A,{label:i("editor.graphPanel.pointSize.label"),children:(0,n.jsx)(va,{layerId:b.id})}),y&&!x&&(0,n.jsx)(A,{label:i("editor.graphPanel.graphOptions.lineFill"),children:(0,n.jsx)(d,{isChecked:Tn(o.spec,"line","fillAlpha",y.id)!==void 0,onChange:I})}),!x&&(0,n.jsx)(A,{label:i("editor.graphPanel.graphOptions.smoothLines"),children:(0,n.jsx)(d,{isChecked:m.params.curve==="smooth",onChange:P})}),(0,n.jsx)(A,{label:i("editor.graphPanel.lineThickness.label"),children:(0,n.jsx)(h,{value:T?"custom":"auto",options:k,onChange:E})}),T&&(0,n.jsx)(A,{label:i("editor.graphPanel.numberFormat.valueLabel"),children:(0,n.jsx)(c,{value:w,min:d1,max:u1,step:h1,formatValue:Ve,onChange:O,onCommit:a.commands.commit})}),!x&&f.length>1&&(0,n.jsx)(A,{label:i("editor.fineTunePanel.detailSection.missingValues"),children:(0,n.jsx)(s,{value:m.params.missingValues,options:f,onChange:M})})]})})},g1=e=>p1.find(t=>t===e),Tn=(e,t,r,a)=>(0,p.findKindStyleDeclarations)(e.styles.overrides,(0,p.buildLayerStyleAddress)(t,a))?.[r],x1=(e,t)=>(0,p.filterLayersByGeoms)(t,"point").find(r=>(0,p.isCompanionLayer)(r,[e])),v1=(e,t)=>{const r=[{value:"gap",label:e("editor.graphPanel.treatEmptyValues.leaveGap.label")},{value:"zero",label:e("editor.graphPanel.treatEmptyValues.fillZero.label")}];return t.position!=="stack"&&t.position!=="fill"&&r.push({value:"connect",label:e("editor.graphPanel.treatEmptyValues.connectGaps.label")}),t.geom==="area"?r.filter(a=>a.value!=="gap"):r},ut="\0none",f1=["x","y","color","size","label"],b1={x:"editor.graphPanel.mappingSection.x",y:"editor.graphPanel.mappingSection.y",color:"editor.graphPanel.mappingSection.color",size:"editor.graphPanel.mappingSection.size",label:"editor.graphPanel.mappingSection.label"},S1=({title:e,layout:t="collapsible"})=>{const r=N(),a=l.useHandleScene(r),o=l.useI18n(),{Select:i}=D(),s=o("editor.graphPanel.mappingSection.none"),c=a?.spec,d=(0,v.useMemo)(()=>c===void 0?[]:(0,p.readMappableAesthetics)(c,f1).map(({aesthetic:h,variables:u,isRequired:m})=>{const g=(0,p.readMappedVariable)(c.mapping,h);return{aesthetic:h,label:o(b1[h]),value:g??(m?null:ut),options:y1(u,g,m?null:s),chooseColumn:x=>{r.commands.dispatch(new p.SetMappingCommand({aesthetic:h,variable:x===ut?null:x}))}}}),[c,o,s,r]);return a?(0,n.jsx)(F,{title:e??o("editor.graphPanel.mappingSection.title"),layout:t,children:(0,n.jsx)(G,{children:d.map(({aesthetic:h,label:u,value:m,options:g,chooseColumn:x})=>(0,n.jsx)(A,{label:u,children:(0,n.jsx)(i,{value:m,options:g,placeholder:s,onChange:x})},h))})}):null},y1=(e,t,r)=>{const a=t!==null&&!e.includes(t)?[t,...e]:e;return[...r===null?[]:[{value:ut,label:r}],...a.map(o=>({value:o,label:o}))]},C1="k",j1=2,w1=0,T1=5,ht=[{value:"k",labelKey:"thousands"},{value:"m",labelKey:"millions"},{value:"b",labelKey:"billions"}],A1=["auto","none"],k1=({title:e,layout:t="collapsible",preview:r})=>{const a=N(),o=l.useHandleScene(a),i=l.useI18n(),{NumberField:s,ToggleGroup:c}=D();if(!o)return null;const{abbreviation:d,decimals:h}=o.config.numberFormat,u=P1(d)!==void 0,m=h!=="auto",g=k=>k.map(j=>({value:j,label:i(`editor.graphPanel.numberFormat.options.${j}`)})),x=ht.map(({value:k,labelKey:j})=>({value:k,label:i(`common.abbreviations.${j}`)})),f=k=>{a.commands.dispatch(new p.SetNumberFormatAbbreviationCommand({abbreviation:k}))},b=k=>{const j=A1.find(I=>I===k);f(j??C1)},w=k=>{const j=ht.find(I=>I.value===k);j&&f(j.value)},T=k=>{a.commands.dispatch(new p.SetNumberFormatDecimalsCommand({decimals:k==="custom"?j1:"auto"}))},y=k=>{k!==null&&a.commands.dispatch(new p.SetNumberFormatDecimalsCommand({decimals:k}),{transient:!0})};return(0,n.jsx)(F,{title:e??i("editor.graphPanel.numberFormatSection.title"),layout:t,preview:r,children:(0,n.jsxs)(G,{children:[(0,n.jsx)(A,{label:i("editor.graphPanel.numberFormat.abbreviationLabel"),children:(0,n.jsx)(c,{value:u?"custom":d,options:g(["auto","none","custom"]),onChange:b})}),u&&(0,n.jsx)(A,{label:i("editor.graphPanel.numberFormat.valueLabel"),children:(0,n.jsx)(c,{value:d,options:x,onChange:w})}),(0,n.jsx)(A,{label:i("editor.graphPanel.numberFormat.decimalPlacesLabel"),children:(0,n.jsx)(c,{value:m?"custom":"auto",options:g(["auto","custom"]),onChange:T})}),m&&(0,n.jsx)(A,{label:i("editor.graphPanel.numberFormat.valueLabel"),children:(0,n.jsx)(s,{value:h,min:w1,max:T1,onChange:y,onCommit:a.commands.commit})})]})})},P1=e=>ht.find(t=>t.value===e),L1=({title:e,layout:t="collapsible",preview:r})=>{const a=l.useHandleScene(N()),o=l.useI18n();if(!a)return null;const i=I1(a.spec.layers);return i?(0,n.jsx)(F,{title:e??o("editor.graphPanel.pointSize.label"),layout:t,preview:r,children:(0,n.jsx)(G,{children:(0,n.jsx)(A,{label:o("editor.graphPanel.numberFormat.valueLabel"),children:(0,n.jsx)(va,{layerId:i.id})})})}):null},I1=e=>{const t=(0,p.filterLayersByGeoms)(e,"line","area");return(0,p.filterLayersByGeoms)(e,"point").find(r=>!(0,p.isCompanionLayer)(r,t))},E1=.9,M1=360,R1=.05,O1=15,_1=({title:e,layout:t="collapsible",preview:r})=>{const a=N(),o=l.useHandleScene(a),i=l.useI18n(),{Slider:s}=D();if(!o||o.spec.coords.coordType!=="polar")return null;const{innerRadius:c,startAngle:d}=o.spec.coords.params,h=m=>{a.commands.dispatch(new p.SetPolarInnerRadiusCommand({innerRadius:m}),{transient:!0})},u=m=>{a.commands.dispatch(new p.SetPolarStartAngleCommand({startAngle:m}),{transient:!0})};return(0,n.jsx)(F,{title:e??i("editor.graphPanel.polarSection.title"),layout:t,preview:r,children:(0,n.jsxs)(G,{children:[(0,n.jsx)(A,{label:i("editor.graphPanel.polarSection.innerRadius"),children:(0,n.jsx)(s,{value:c,min:0,max:E1,step:R1,formatValue:ma,onChange:h,onCommit:a.commands.commit})}),(0,n.jsx)(A,{label:i("editor.graphPanel.polarSection.startAngle"),children:(0,n.jsx)(s,{value:d,min:0,max:M1-1,step:O1,formatValue:eh,onChange:u,onCommit:a.commands.commit})})]})})},N1=e=>(0,n.jsxs)(l.Icon,{...e,children:[(0,n.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",opacity:"0.12",d:"M2 10C2 7.19974 2 5.79961 2.54497 4.73005C3.02433 3.78924 3.78924 3.02433 4.73005 2.54497C5.79961 2 7.19974 2 10 2H14C16.8003 2 18.2004 2 19.27 2.54497C20.2108 3.02433 20.9757 3.78924 21.455 4.73005C22 5.79961 22 7.19974 22 10V14C22 16.8003 22 18.2004 21.455 19.27C20.9757 20.2108 20.2108 20.9757 19.27 21.455C18.2004 22 16.8003 22 14 22H10C7.19974 22 5.79961 22 4.73005 21.455C3.78924 20.9757 3.02433 20.2108 2.54497 19.27C2 18.2004 2 16.8003 2 14V10Z",fill:"currentColor"}),(0,n.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.96644 1.25C8.59472 1.25 7.51929 1.24999 6.65494 1.32061C5.77479 1.39252 5.04768 1.54138 4.38955 1.87671C3.30762 2.42798 2.42798 3.30762 1.87671 4.38955C1.54138 5.04768 1.39252 5.77479 1.32061 6.65494C1.24999 7.51929 1.25 8.59472 1.25 9.96644V14.0336C1.25 15.4053 1.24999 16.4807 1.32061 17.3451C1.39252 18.2252 1.54138 18.9523 1.87671 19.6104C2.42798 20.6924 3.30762 21.572 4.38955 22.1233C5.04768 22.4586 5.77479 22.6075 6.65494 22.6794C7.51927 22.75 8.59469 22.75 9.96637 22.75H14.0336C15.4053 22.75 16.4807 22.75 17.3451 22.6794C18.2252 22.6075 18.9523 22.4586 19.6104 22.1233C20.6924 21.572 21.572 20.6924 22.1233 19.6104C22.4586 18.9523 22.6075 18.2252 22.6794 17.3451C22.75 16.4807 22.75 15.4053 22.75 14.0336V9.96642C22.75 8.59473 22.75 7.51927 22.6794 6.65494C22.6075 5.77479 22.4586 5.04768 22.1233 4.38955C21.572 3.30762 20.6924 2.42798 19.6104 1.87671C18.9523 1.54138 18.2252 1.39252 17.3451 1.32061C16.4807 1.24999 15.4053 1.25 14.0336 1.25H9.96644ZM5.07054 3.21322C5.48197 3.00359 5.9897 2.87996 6.77708 2.81563C7.57322 2.75058 8.58749 2.75 10 2.75H14C15.4125 2.75 16.4268 2.75058 17.2229 2.81563C18.0103 2.87996 18.518 3.00359 18.9295 3.21322C19.7291 3.62068 20.3793 4.27085 20.7868 5.07054C20.9964 5.48197 21.12 5.9897 21.1844 6.77708C21.2494 7.57322 21.25 8.58749 21.25 10V14C21.25 15.4125 21.2494 16.4268 21.1844 17.2229C21.12 18.0103 20.9964 18.518 20.7868 18.9295C20.3793 19.7291 19.7291 20.3793 18.9295 20.7868C18.518 20.9964 18.0103 21.12 17.2229 21.1844C16.4268 21.2494 15.4125 21.25 14 21.25H10C8.58749 21.25 7.57322 21.2494 6.77708 21.1844C5.9897 21.12 5.48197 20.9964 5.07054 20.7868C4.27085 20.3793 3.62068 19.7291 3.21322 18.9295C3.00359 18.518 2.87996 18.0103 2.81563 17.2229C2.75058 16.4268 2.75 15.4125 2.75 14V10C2.75 8.58749 2.75058 7.57322 2.81563 6.77708C2.87996 5.9897 3.00359 5.48197 3.21322 5.07054C3.62068 4.27085 4.27085 3.62068 5.07054 3.21322Z",fill:"currentColor"}),(0,n.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19.4796 12.2222L17.6085 12.2291L17.6029 10.7291L19.474 10.7222L19.4796 12.2222ZM15.3662 12.2375L13.124 12.2459L13.1184 10.7459L15.3606 10.7375L15.3662 12.2375ZM10.8817 12.2542L8.63945 12.2626L8.63386 10.7626L10.8761 10.7542L10.8817 12.2542ZM6.39719 12.2709L4.52607 12.2779L4.52048 10.7779L6.3916 10.7709L6.39719 12.2709Z",fill:"currentColor"})]}),An=e=>(0,n.jsxs)(l.Icon,{...e,children:[(0,n.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",opacity:"0.12",d:"M2 10C2 7.19974 2 5.79961 2.54497 4.73005C3.02433 3.78924 3.78924 3.02433 4.73005 2.54497C5.79961 2 7.19974 2 10 2H14C16.8003 2 18.2004 2 19.27 2.54497C20.2108 3.02433 20.9757 3.78924 21.455 4.73005C22 5.79961 22 7.19974 22 10V14C22 16.8003 22 18.2004 21.455 19.27C20.9757 20.2108 20.2108 20.9757 19.27 21.455C18.2004 22 16.8003 22 14 22H10C7.19974 22 5.79961 22 4.73005 21.455C3.78924 20.9757 3.02433 20.2108 2.54497 19.27C2 18.2004 2 16.8003 2 14V10Z",fill:"currentColor"}),(0,n.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.96644 1.25C8.59472 1.25 7.51929 1.24999 6.65494 1.32061C5.77479 1.39252 5.04768 1.54138 4.38955 1.87671C3.30762 2.42798 2.42798 3.30762 1.87671 4.38955C1.54138 5.04768 1.39252 5.77479 1.32061 6.65494C1.24999 7.51929 1.25 8.59472 1.25 9.96644V14.0336C1.25 15.4053 1.24999 16.4807 1.32061 17.3451C1.39252 18.2252 1.54138 18.9523 1.87671 19.6104C2.42798 20.6924 3.30762 21.572 4.38955 22.1233C5.04768 22.4586 5.77479 22.6075 6.65494 22.6794C7.51927 22.75 8.59469 22.75 9.96637 22.75H14.0336C15.4053 22.75 16.4807 22.75 17.3451 22.6794C18.2252 22.6075 18.9523 22.4586 19.6104 22.1233C20.6924 21.572 21.572 20.6924 22.1233 19.6104C22.4586 18.9523 22.6075 18.2252 22.6794 17.3451C22.75 16.4807 22.75 15.4053 22.75 14.0336V9.96642C22.75 8.59473 22.75 7.51927 22.6794 6.65494C22.6075 5.77479 22.4586 5.04768 22.1233 4.38955C21.572 3.30762 20.6924 2.42798 19.6104 1.87671C18.9523 1.54138 18.2252 1.39252 17.3451 1.32061C16.4807 1.24999 15.4053 1.25 14.0336 1.25H9.96644ZM5.07054 3.21322C5.48197 3.00359 5.9897 2.87996 6.77708 2.81563C7.57322 2.75058 8.58749 2.75 10 2.75H14C15.4125 2.75 16.4268 2.75058 17.2229 2.81563C18.0103 2.87996 18.518 3.00359 18.9295 3.21322C19.7291 3.62068 20.3793 4.27085 20.7868 5.07054C20.9964 5.48197 21.12 5.9897 21.1844 6.77708C21.2494 7.57322 21.25 8.58749 21.25 10V14C21.25 15.4125 21.2494 16.4268 21.1844 17.2229C21.12 18.0103 20.9964 18.518 20.7868 18.9295C20.3793 19.7291 19.7291 20.3793 18.9295 20.7868C18.518 20.9964 18.0103 21.12 17.2229 21.1844C16.4268 21.2494 15.4125 21.25 14 21.25H10C8.58749 21.25 7.57322 21.2494 6.77708 21.1844C5.9897 21.12 5.48197 20.9964 5.07054 20.7868C4.27085 20.3793 3.62068 19.7291 3.21322 18.9295C3.00359 18.518 2.87996 18.0103 2.81563 17.2229C2.75058 16.4268 2.75 15.4125 2.75 14V10C2.75 8.58749 2.75058 7.57322 2.81563 6.77708C2.87996 5.9897 3.00359 5.48197 3.21322 5.07054C3.62068 4.27085 4.27085 3.62068 5.07054 3.21322Z",fill:"currentColor"}),(0,n.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.6749 8.04877L17.1069 9.06975L16.2884 7.81273L17.8564 6.79175L18.6749 8.04877ZM15.2278 10.2932L13.3488 11.5167L12.5303 10.2597L14.4093 9.03622L15.2278 10.2932ZM11.4697 12.7402L9.59064 13.9637L8.77217 12.7067L10.6512 11.4832L11.4697 12.7402ZM7.71158 15.1872L6.14354 16.2082L5.32507 14.9511L6.89311 13.9302L7.71158 15.1872Z",fill:"currentColor"})]}),D1=e=>(0,v.useMemo)(()=>{if(e===null)return{options:[],findValue:()=>{}};const{parsingLocale:t,numberFormat:r}=e.config,a=e.guides.colorGroups.map(o=>{const i=(0,p.createValueFormatter)({valueFormat:o.valueFormat,locale:t,numberFormat:r}),s=o.value instanceof Date?o.value.getTime():o.value;return{value:s,option:{value:String(s),label:o.label??i(o.value)}}});return{options:a.map(({option:o})=>o),findValue:o=>a.find(i=>i.option.value===o)?.value}},[e]),kn=["linear","exponential","quadratic","polynomial","logarithmic","power","loess"],F1="linear",z1=({title:e,layout:t="collapsible",preview:r})=>{const a=N(),o=l.useHandleScene(a),i=l.useI18n(),{Select:s,Switch:c}=D(),{options:d,findValue:h}=D1(o);if(!o||o.coordSystem.type==="polar")return null;const u=(0,p.findTrendLineLayer)(o.spec.layers),m=(0,p.findAverageLineLayer)(o.spec.layers),g=u?.stat.type==="smooth"?u.stat.method:F1,x=B1(m),f=kn.map(j=>({value:j,label:i(`editor.annotationsPanel.trendType.options.${j}`)})),b=(j,I={})=>{const P=u??m,E=new p.SetStatLineCommand({line:j,...I,...P!==void 0&&{layerId:P.id},label:i("editor.annotationsPanel.trendsAndAveragesSection.average")});a.commands.dispatch(E)},w=j=>b(j?"trend":"none",{method:g}),T=j=>b(j?"average":"none",{group:x??h(d[0]?.value??"")}),y=j=>{const I=kn.find(P=>P===j);I!==void 0&&b("trend",{method:I})},k=j=>{const I=j===null?void 0:h(j);I!==void 0&&b("average",{group:I})};return(0,n.jsx)(F,{title:e??i("editor.annotationsPanel.trendsAndAveragesSection.title"),layout:t,preview:r??(0,n.jsx)(An,{size:"lg"}),children:(0,n.jsxs)(G,{children:[(0,n.jsx)(A,{label:i("editor.annotationsPanel.trendsAndAveragesSection.trend"),icon:(0,n.jsx)(An,{size:"lg"}),children:(0,n.jsx)(c,{isChecked:u!==void 0,onChange:w})}),u!==void 0&&(0,n.jsx)(A,{label:i("editor.annotationsPanel.trendType.label"),children:(0,n.jsx)(s,{value:g,options:f,onChange:y,placeholder:i("editor.annotationsPanel.trendType.placeholder")})}),(0,n.jsx)(A,{label:i("editor.annotationsPanel.trendsAndAveragesSection.average"),icon:(0,n.jsx)(N1,{size:"lg"}),children:(0,n.jsx)(c,{isChecked:m!==void 0,onChange:T})}),m!==void 0&&d.length>0&&(0,n.jsx)(A,{label:i("editor.annotationsPanel.averageLineSeries.label"),children:(0,n.jsx)(s,{value:x===void 0?null:String(x),options:d,onChange:k,placeholder:i("editor.annotationsPanel.averageLineSeries.placeholder"),ariaLabel:i("editor.annotationsPanel.averageLineSeries.ariaLabel")})})]})})},B1=e=>{const t=e?.transforms.find(r=>r.transformType==="filter")?.options.value;return t instanceof Date?t.getTime():t};exports.AppearanceSection=rh;exports.AxesPanel=Q0;exports.AxisSection=lt;exports.BarSection=oh;exports.Button=Ur;exports.CalloutsSection=vh;exports.CaptionSection=ca;exports.ComboSection=bh;exports.ControlRegistryProvider=na;exports.EditableGraphRenderer=Zu;exports.EditorPanel=wt;exports.ElementsPanel=J0;exports.GoalSection=Ch;exports.GraphOptionsSection=wh;exports.GraphTypeSection=Zh;exports.GridSection=Qh;exports.HeadlineSection=a1;exports.IntlProvider=Rn;exports.LegendSection=i1;exports.LineSection=m1;exports.MappingSection=S1;exports.NumberField=Kr;exports.NumberFormatSection=k1;exports.PANEL_ROOT_ATTRIBUTE=ia;exports.PointSection=L1;exports.PolarSection=_1;exports.RadioGrid=Xr;exports.Row=A;exports.Section=F;exports.Select=Zr;exports.Slider=Yr;exports.SourceSection=da;exports.SubtitleSection=ua;exports.Switch=Jr;exports.TextField=Qr;exports.TextSizeSection=ha;exports.TitleSection=pa;exports.ToggleGroup=ea;exports.ToggledSection=la;exports.TrendsAndAveragesSection=z1;exports.useControls=D;exports.usePanelExpansion=oa;exports.usePanelGraph=N;
|