@graphysdk/react-renderer 1.9.0-beta.1792582784445 → 1.9.0-beta.1792583687354

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 CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./editable.css');const l=require("./history-chords-BMfVoPuO.cjs");let u=require("@graphysdk/viz-engine"),v=require("react"),n=require("react/jsx-runtime"),Va=require("motion/react"),J=require("zustand/react/shallow"),Y=require("@vanilla-extract/dynamic"),U=require("clsx");U=l.__toESM(U,1);let ne=require("lodash-es"),le=require("@floating-ui/react-dom"),Et=require("react-dom"),Mt=require("@base-ui/react/direction-provider"),ar=require("@tiptap/core"),Wa=require("@tiptap/extension-bold"),Ee=require("@tiptap/extension-document"),$a=require("@tiptap/extension-hard-break"),Ua=require("@tiptap/extension-heading"),qa=require("@tiptap/extension-italic"),Ka=require("@tiptap/extension-link"),Xa=require("@tiptap/extension-text"),Za=require("@tiptap/extension-text-align"),Me=require("@tiptap/extension-text-style"),Ya=require("@tiptap/extension-underline"),He=require("@tiptap/extensions"),ir=require("@tiptap/extension-paragraph"),Ve=require("@tiptap/react"),Q=require("@base-ui/react/toolbar"),q=require("@base-ui/react/tooltip"),H=require("@base-ui/react/popover"),nn=require("react-colorful"),rn=require("@base-ui/react/number-field"),sr=require("@base-ui/react/radio"),lr=require("@base-ui/react/radio-group"),Z=require("@base-ui/react/select"),ce=require("@base-ui/react/slider"),on=require("@base-ui/react/switch"),Ja=require("@base-ui/react/input"),F=require("@base-ui/react/menu"),Qa=require("@base-ui/react/toggle"),te=require("@base-ui/react"),ue=require("@base-ui/react/accordion"),ei=require("@base-ui/react/separator");var ti={save:"حفظ",cancel:"إلغاء",confirm:"تأكيد",delete:"حذف",confirmDelete:e=>`هل أنت متأكد من رغبتك في حذف ${e.item}؟`,abbreviations:{thousands:"ألف",millions:"مليون",billions:"مليار"}},ni={title:"محرر Graphy",description:"قم بتحرير المحتوى الخاص بك هنا",graphTypes:{column:"أعمدة",columnStacked:"أعمدة مكدسة",columnStackedFill:"أعمدة مكدسة 100%",bar:"شريطي",barStacked:"أشرطة مكدسة",barStackedFill:"أشرطة مكدسة 100%",line:"خطي",area:"مساحة",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:"سمك العمود",widths:{narrow:"ضيق",regular:"عادي",wide:"عريض"},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:"منقط"},lineWidths:{thin:"رفيع",medium:"متوسط",thick:"سميك"}},graphOptions:{sortBars:"ترتيب من الأعلى ← الأدنى",showPoints:"إظهار النقاط",lineFill:"تعبئة تحت الخط",smoothLines:"خطوط ناعمة",curves:{smooth:"ناعم",linear:"مستقيم"},stackTotals:"مجاميع المكدس",dataLabels:"تسميات البيانات",showPercentages:"إظهار النسب المئوية",categoryLabels:"تسميات الفئات"},legendSection:{title:"وسيلة الإيضاح",auto:"تلقائي",top:"أعلى",bottom:"أسفل",left:"يسار",right:"يمين",none:"بدون",alignLabel:"المحاذاة",align:{auto:"تلقائي",center:"الوسط"},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:"مخصص"},sizes:{small:"صغير",medium:"متوسط",large:"كبير"}},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:"العنوان",titlePlaceholder:"إضافة عنوان",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:"التمييز"},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:"الرسم البياني",selection:"التحديد",thisBar:"هذا الشريط",thisPoint:"هذه النقطة",thisBubble:"هذه الفقاعة",thisSlice:"هذه الشريحة",allOf:e=>`كل ${e.name}`,all:"الكل",titledValue:e=>`${e.title}: ${e.value}`,groupAtBand:e=>`${e.group}, ${e.band}`,hide:"إخفاء",show:"إظهار",legendPlaces:{topStart:"أعلى اليسار",topCenter:"أعلى الوسط",topEnd:"أعلى اليمين",left:"اليسار",right:"اليمين",bottomStart:"أسفل اليسار",bottomCenter:"أسفل الوسط",bottomEnd:"أسفل اليمين"},fillColor:"لون التعبئة",lineColor:"لون الخط",palette:"لوحة الألوان",themePalette:"السمة",chartType:"النوع",customChartType:"مخصص",arrange:"الترتيب",arrangements:{grouped:"مجمعة",stacked:"مكدسة",filled:"100%",lines:"خطوط فقط"}},accessibility:{toggleSection:e=>`تبديل قسم ${e.title}`},graphyDefaults:{themeOptions:{light:"فاتح",dark:"داكن"}}},ri={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})`}}}},oi={common:ti,editor:ni,graph:ri},ai={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"}},ii={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",area:"Area",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",widths:{narrow:"Narrow",regular:"Regular",wide:"Wide"},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"},lineWidths:{thin:"Thin",medium:"Medium",thick:"Thick"}},graphOptions:{sortBars:"Sort high → low",showPoints:"Show points",lineFill:"Fill under line",smoothLines:"Smooth lines",curves:{smooth:"Smooth",linear:"Straight"},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",center:"Center"},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"},sizes:{small:"Small",medium:"Medium",large:"Large"}},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",titlePlaceholder:"Add 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"},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",selection:"Selection",thisBar:"This bar",thisPoint:"This point",thisBubble:"This bubble",thisSlice:"This slice",allOf:e=>`All of ${e.name}`,all:"All",titledValue:e=>`${e.title}: ${e.value}`,groupAtBand:e=>`${e.group}, ${e.band}`,hide:"Hide",show:"Show",legendPlaces:{topStart:"Top left",topCenter:"Top center",topEnd:"Top right",left:"Left",right:"Right",bottomStart:"Bottom left",bottomCenter:"Bottom center",bottomEnd:"Bottom right"},fillColor:"Fill color",lineColor:"Line color",palette:"Palette",themePalette:"Theme",chartType:"Type",customChartType:"Custom",arrange:"Arrange",arrangements:{grouped:"Grouped",stacked:"Stacked",filled:"100%",lines:"Lines only"}},accessibility:{toggleSection:e=>`Toggle ${e.title} section`},graphyDefaults:{themeOptions:{light:"Light",dark:"Dark"}}},si={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})`}}}},li={common:ai,editor:ii,graph:si},ci={colorPanel:{backgroundSection:{gray:"Gray"},borderType:{gray:"Gray"}},highlighting:{highlightStyle:{gray:"Gray"}}},di={editor:ci},ui={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"}},hi={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",area:"Área",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",widths:{narrow:"Estreita",regular:"Normal",wide:"Larga"},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"},lineWidths:{thin:"Fina",medium:"Média",thick:"Espessa"}},graphOptions:{sortBars:"Ordenar maior → menor",showPoints:"Mostrar pontos",lineFill:"Preencher sob a linha",smoothLines:"Linhas suaves",curves:{smooth:"Suave",linear:"Reta"},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",center:"Centro"},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"},sizes:{small:"Pequeno",medium:"Médio",large:"Grande"}},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",titlePlaceholder:"Adicionar 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"},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",selection:"Seleção",thisBar:"Esta barra",thisPoint:"Este ponto",thisBubble:"Esta bolha",thisSlice:"Esta fatia",allOf:e=>`Tudo em ${e.name}`,all:"Tudo",titledValue:e=>`${e.title}: ${e.value}`,groupAtBand:e=>`${e.group}, ${e.band}`,hide:"Ocultar",show:"Mostrar",legendPlaces:{topStart:"Topo à esquerda",topCenter:"Topo ao centro",topEnd:"Topo à direita",left:"Esquerda",right:"Direita",bottomStart:"Fundo à esquerda",bottomCenter:"Fundo ao centro",bottomEnd:"Fundo à direita"},fillColor:"Cor de preenchimento",lineColor:"Cor da linha",palette:"Paleta",themePalette:"Tema",chartType:"Tipo",customChartType:"Personalizado",arrange:"Disposição",arrangements:{grouped:"Agrupado",stacked:"Sobreposto",filled:"100%",lines:"Apenas linhas"}},accessibility:{toggleSection:e=>`Alternar secção ${e.title}`},graphyDefaults:{themeOptions:{light:"Claro",dark:"Escuro"}}},pi={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})`}}}},mi={common:ui,editor:hi,graph:pi},gi={"en-GB":li,"en-US":di,ar:oi,"pt-PT":mi},vi=[gi,l.dictionaries],Rt=({children:e,...t})=>(0,n.jsx)(l.IntlProvider,{dictionaries:vi,...t,children:(0,n.jsx)(xi,{children:e})}),xi=({children:e})=>(0,n.jsx)(Mt.DirectionProvider,{direction:l.useTextDirection(),children:e}),fi="data-variant",cr=ir.Paragraph.extend({addAttributes(){return{variant:{default:null,parseHTML:e=>e.getAttribute("data-variant")??null,renderHTML:e=>e.variant?{[fi]:e.variant}:{}}}}}),bi=ar.Extension.create({name:"preventBackspaceAcrossTitleBoundary",addOptions(){return{showTitle:!0}},addKeyboardShortcuts(){return{Backspace:({editor:e})=>{if(!this.options.showTitle)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}}}}),Ot=()=>[Xa.Text,He.UndoRedo,Ua.Heading.configure({levels:[1,2,3]}),Wa.Bold,qa.Italic,Ya.Underline,Za.TextAlign.configure({types:["heading","paragraph"]}),Ka.Link.configure({openOnClick:!1,autolink:!0}),Me.TextStyle,Me.Color,$a.HardBreak],Si=({titlePlaceholder:e,subtitlePlaceholder:t,showTitle:r,showSubtitle:o})=>[Ci({showTitle:r,showSubtitle:o}),cr,...Ot(),Me.FontFamily,bi.configure({showTitle:r}),He.Placeholder.configure({showOnlyCurrent:!1,placeholder:({pos:a,editor:i})=>{if(r&&a===0)return e;const s=r?i.state.doc.firstChild?.nodeSize??-1:0;return o&&a===s?t:""}})],yi=({placeholder:e})=>[Ee.Document,cr,...Ot(),Me.FontFamily,He.Placeholder.configure({showOnlyCurrent:!1,placeholder:({pos:t})=>t===0?e:""})],Ci=({showTitle:e,showSubtitle:t})=>e&&t?Ee.Document.extend({content:"block{2,}"}):Ee.Document,ji={accent:"var(--graphy-editor-accent, var(--graphy-editor-default-accent))",surface:"var(--graphy-editor-surface, var(--graphy-editor-default-surface))",text:"var(--graphy-editor-text, var(--graphy-editor-default-text))",textSecondary:"color-mix(in srgb, transparent, var(--graphy-editor-text, var(--graphy-editor-default-text)) 70%)",textDisabled:"color-mix(in srgb, transparent, var(--graphy-editor-text, var(--graphy-editor-default-text)) 50%)",sunken:"color-mix(in srgb, var(--graphy-editor-surface, var(--graphy-editor-default-surface)), var(--graphy-editor-text, var(--graphy-editor-default-text)) 5%)",raised:"color-mix(in srgb, var(--graphy-editor-surface, var(--graphy-editor-default-surface)), var(--graphy-editor-text, var(--graphy-editor-default-text)) 7%)",border:"var(--graphy-editor-border, color-mix(in srgb, transparent, var(--graphy-editor-text, var(--graphy-editor-default-text)) 12%))",fontFamily:"var(--graphy-editor-font-family, var(--graphy-font-family))",borderStrong:"color-mix(in srgb, transparent, var(--graphy-editor-text, var(--graphy-editor-default-text)) 50%)",focus:"color-mix(in srgb, transparent, var(--graphy-editor-text, var(--graphy-editor-default-text)) 55.00000000000001%)",focusWidth:"2px",shadow:"var(--graphy-editor-default-shadow)"},dr=(0,v.createContext)(null),ur=({labelId:e,controlId:t,children:r})=>{const o=(0,v.useMemo)(()=>{let a=null;return{labelId:e,controlId:t,claimControlId:i=>(a??=i,a===i)}},[e,t]);return(0,n.jsx)(dr.Provider,{value:o,children:r})},ee=({id:e,ariaLabel:t,ariaLabelledBy:r},o=!0)=>{const a=(0,v.useContext)(dr),i=(0,v.useId)(),[s]=(0,v.useState)(()=>o?a?.claimControlId(i)??!1:!1),c=e??(s?a?.controlId:void 0),d=r??(t===void 0?a?.labelId:void 0);return{...c!==void 0&&{id:c},...t!==void 0&&{"aria-label":t},...d!==void 0&&{"aria-labelledby":d}}},wi="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))",hr="_14ty2ng0",an="_14ty2ng1",Ti="_14ty2ng2",Ai="_14ty2ng3",pr="_14ty2ng4";var mr="transparent",gr=e=>e==="transparent"?{background:wi,border:`1px solid ${l.vars.border100}`}:{background:e,border:`1px solid ${ji.border}`},vr=({title:e,colors:t,value:r,onChange:o,trailing:a,clearable:i=!1,disabled:s,id:c,ariaLabel:d,ariaLabelledBy:h})=>{const p=l.useI18n(),m=ee({id:c,ariaLabel:d,ariaLabelledBy:h},!1),g=a!==void 0||i,f=x=>(0,n.jsx)("button",{type:"button","aria-label":x==="transparent"?p("graph.colorDropdown.transparent"):x,className:Ai,"data-active":xr(x,r),disabled:s,onMouseDown:b=>b.preventDefault(),onClick:()=>o(x),children:(0,n.jsx)("span",{className:pr,style:gr(x)})},x);return(0,n.jsxs)("div",{className:hr,children:[e!==void 0&&(0,n.jsx)("div",{className:"_14ty2ng1",children:e}),(0,n.jsxs)("div",{className:Ti,...m,children:[t.map(f),g&&(0,n.jsxs)("span",{className:"_14ty2ng5",children:[(0,n.jsx)("span",{className:"_14ty2ng6","aria-hidden":"true"}),a,i&&f("transparent")]})]})]})},xr=(e,t)=>t!==null&&e.toLowerCase()===t.toLowerCase();var ki={default:"woi4bh5 woi4bh4",tile:"woi4bh6 woi4bh4",icon:"woi4bh7 woi4bh4"},fr=({label:e,icon:t,onClick:r,variant:o="default",expanded:a,disabled:i,ariaLabel:s,ariaLabelledBy:c,id:d})=>{const h=ee({id:d,ariaLabel:s,ariaLabelledBy:c}),p=o==="tile";return(0,n.jsxs)("button",{type:"button",className:ki[o],disabled:i,"aria-expanded":a,onClick:r,...h,children:[t!==void 0&&(0,n.jsx)("span",{className:(0,U.default)("woi4bh0",o==="icon"&&"woi4bh3"),children:t}),e!==void 0&&(0,n.jsx)("span",{className:p?"woi4bh2":"woi4bh1",children:e})]})},Pi="data-graphy-chart-chrome",Li="data-graphy-chart-menu",_t={[Li]:""},We=e=>({[Pi]:e}),Ie=(e,t)=>e instanceof Element&&e.closest(`[data-graphy-chart-chrome="${CSS.escape(t)}"]`)!==null,br=e=>e instanceof Element&&e.closest("[data-graphy-chart-menu]")!==null,ht=e=>e instanceof Element&&e.closest("[data-graphy-chart-chrome]")!==null,Sr=(e,t,r)=>r!==null&&(0,u.isPointWithinEditMenuTrigger)({x:e.clientX-t.x,y:e.clientY-t.y},r),pe=(e,t,r)=>e instanceof Node&&(t.contains(e)||Ie(e,r)),Ii="cml7ha0",yr=(0,v.createContext)(null),Ei=({children:e})=>{const{chartId:t}=l.useGraphContext(),[r]=(0,v.useState)(l.resolvePortalContainer),[o,a]=(0,v.useState)(null);return r===null?null:(0,n.jsxs)(n.Fragment,{children:[(0,Et.createPortal)((0,n.jsx)("div",{ref:a,className:Ii,...We(t)}),r),(0,n.jsx)(yr.Provider,{value:o,children:e})]})},se=()=>(0,v.useContext)(yr),Mi="_178jeit0",Ri="_178jeit1 _14ty2ng3",Oi="_178jeit2 _14ty2ng4",_i="_178jeit3",Ni="_178jeit4",Di="_178jeit5",Fi="_178jeit6",Bi="_178jeit7",zi={side:"flip",align:"shift",fallbackAxisSide:"end"},Cr=({value:e,onChange:t,onCommit:r,popupAttributes:o,variant:a="default"})=>{const i=l.useI18n(),s=se(),[c,d]=(0,v.useState)(!1),h=g=>{d(g),g||r?.()},p=e!==null&&l.isValidCssColor(e)?e:"#000000",m=l.isHex(p)?p.toUpperCase():"#000000";return(0,n.jsxs)(H.Popover.Root,{open:c,onOpenChange:h,children:[a==="chip"?(0,n.jsx)(H.Popover.Trigger,{className:Ri,onMouseDown:g=>g.preventDefault(),"aria-label":i("graph.colorDropdown.pickCustom"),children:(0,n.jsx)("span",{className:Oi})}):(0,n.jsxs)("div",{className:hr,children:[(0,n.jsx)("div",{className:an,children:i("graph.colorDropdown.custom")}),(0,n.jsxs)(H.Popover.Trigger,{className:_i,onMouseDown:g=>g.preventDefault(),"aria-label":i("graph.colorDropdown.pickCustom"),children:[(0,n.jsx)("span",{className:pr,style:gr(p)}),(0,n.jsx)("span",{className:Ni,children:m})]})]}),(0,n.jsx)(H.Popover.Portal,{container:s??l.resolvePortalContainer(),children:(0,n.jsx)(l.PortalThemeProvider,{children:(0,n.jsx)(H.Popover.Positioner,{side:"right",align:"start",sideOffset:18,collisionAvoidance:zi,collisionPadding:12,disableAnchorTracking:a==="chip",className:Mi,children:(0,n.jsxs)(H.Popover.Popup,{className:Di,onMouseDown:g=>g.preventDefault(),...o,children:[(0,n.jsx)("div",{className:an,children:i("graph.colorDropdown.pickColor")}),(0,n.jsx)(nn.HexColorPicker,{color:m,onChange:t,className:Fi}),(0,n.jsx)(nn.HexColorInput,{color:m,onChange:t,prefixed:!0,className:Bi,onMouseDown:g=>g.stopPropagation()})]})})})})]})},Nt=(0,v.createContext)(null),B=()=>{const e=(0,v.useContext)(Nt);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},jr=({children:e,onKeyDown:t,...r})=>{const o=(0,v.useContext)(Nt),a=i=>{if(t?.(i),!o||i.defaultPrevented)return;const s=l.resolveHistoryStep(i.nativeEvent);s&&(i.preventDefault(),s==="undo"?o.undo():o.redo())};return(0,n.jsx)("div",{onKeyDown:a,...r,children:e})},wr="keyboard",$e=e=>{const t=(0,v.useRef)(!1),r=(0,v.useRef)(!1),o=()=>{t.current=!1,r.current&&(r.current=!1,e?.())};return{commitAfterChange:()=>{if(t.current){r.current=!0;return}e?.()},commitUnlessHeldKey:a=>{if(a){r.current=!0;return}e?.()},gestureHandlers:{onKeyDown:()=>{t.current=!0},onKeyUp:o,onBlur:a=>{a.relatedTarget instanceof Node&&a.currentTarget.contains(a.relatedTarget)||o()}}}},Gi="eh8dvc0",Hi="eh8dvc1 uz3g760",Vi="eh8dvc2 uz3g761";var Tr=({value:e,onChange:t,onCommit:r,min:o,max:a,step:i,placeholder:s,prefix:c,suffix:d,disabled:h,hasError:p,ariaLabel:m,ariaLabelledBy:g,id:f})=>{const x=ee({id:f,ariaLabel:m,ariaLabelledBy:g}),{commitUnlessHeldKey:b,gestureHandlers:S}=$e(r);return(0,n.jsx)(rn.NumberField.Root,{className:Gi,value:e,onValueChange:j=>t(j),onValueCommitted:(j,L)=>{b(L.reason===wr)},min:o,max:a,step:i,disabled:h,children:(0,n.jsxs)(jr,{className:Hi,"data-error":p===!0,"data-disabled":h===!0?"":void 0,children:[c!==void 0&&(0,n.jsx)("span",{className:"eh8dvc3",children:c}),(0,n.jsx)(rn.NumberField.Input,{className:Vi,placeholder:s,...S,"aria-invalid":p===!0?!0:void 0,...x}),d!==void 0&&(0,n.jsx)("span",{className:"eh8dvc3",children:d})]})})},Dt=({children:e})=>{const{themeValues:t}=l.useThemeContext();return(0,n.jsx)(l.PortalThemeProvider,{style:(0,v.useMemo)(()=>(0,Y.assignInlineVars)({[l.vars.fontFamily]:t.fontFamily,[l.vars.textScale]:t.textScale}),[t]),children:e})};var Ar="srewh00",Wi="srewh01",$i={pointer:null,focus:null,last:"pointer"},kr=(0,v.createContext)({hovered:!1,dismissed:!1,reachedTooltipId:null,reach:()=>{},release:()=>{},dismiss:()=>{}}),pt=({className:e,children:t})=>{const[r,o]=(0,v.useState)(!1),[a,i]=(0,v.useState)(!1),[s,c]=(0,v.useState)($i),d=(0,v.useCallback)((x,b)=>{i(!1),c(S=>({...S,[b]:x,last:b}))},[]),h=(0,v.useCallback)((x,b)=>{c(S=>S[b]===x?{...S,[b]:null}:S)},[]),p=(0,v.useCallback)(()=>i(!0),[]),m=Ui(s),g=(0,v.useMemo)(()=>({hovered:r,dismissed:a,reachedTooltipId:m,reach:d,release:h,dismiss:p}),[r,a,m,d,h,p]),f=x=>{x.pointerType!=="touch"&&(o(!0),i(!1))};return(0,n.jsx)("div",{className:e,onPointerEnter:f,onPointerLeave:()=>o(!1),children:(0,n.jsx)(kr.Provider,{value:g,children:t})})},Ue=({label:e,checked:t=!1,children:r})=>{const{hovered:o,dismissed:a,reachedTooltipId:i,reach:s,release:c,dismiss:d}=(0,v.useContext)(kr),h=(0,v.useId)(),[p,m]=(0,v.useState)(!1),g=o?!a&&(i===h||t&&i===null):p;(0,v.useEffect)(()=>()=>{c(h,"pointer"),c(h,"focus")},[h,c]);const f=(x,b)=>{b.reason==="escape-key"&&(d(),b.allowPropagation()),m(x)};return(0,n.jsxs)(q.Tooltip.Root,{open:g,onOpenChange:f,disableHoverablePopup:!0,children:[(0,n.jsx)(q.Tooltip.Trigger,{render:r,"aria-label":e,onPointerEnter:x=>x.pointerType!=="touch"&&s(h,"pointer"),onPointerLeave:()=>c(h,"pointer"),onFocus:()=>s(h,"focus"),onBlur:()=>c(h,"focus")}),(0,n.jsx)(q.Tooltip.Portal,{container:l.resolvePortalContainer(),children:(0,n.jsx)(Dt,{children:(0,n.jsx)(q.Tooltip.Positioner,{sideOffset:6,className:Wi,children:(0,n.jsx)(q.Tooltip.Popup,{className:Ar,children:e})})})})]})},Ui=({pointer:e,focus:t,last:r})=>r==="focus"?t??e:e??t,qi="_1b7s5f0",ae={1:"_1b7s5f1",2:"_1b7s5f2",3:"_1b7s5f3",4:"_1b7s5f4",5:"_1b7s5f5",6:"_1b7s5f6"},Ki="_1b7s5f7";var Xi=6,Pr=({options:e,value:t,onChange:r,onCommit:o,columns:a,itemLayout:i="tile",disabled:s,ariaLabel:c,ariaLabelledBy:d,id:h})=>{const p=ee({id:h,ariaLabel:c,ariaLabelledBy:d}),m=i==="tile",g=i==="swatch",f=i==="icon",x=i==="track",{commitAfterChange:b,gestureHandlers:S}=$e(o);return(0,n.jsx)(lr.RadioGroup,{className:(0,U.default)(qi,Zi(a??e.length),f&&"_1b7s5f9",x&&"_1b7s5fb"),value:t,onValueChange:j=>{r(j),b()},...S,disabled:s,...p,children:e.map(j=>{const L=(0,n.jsxs)(sr.Radio.Root,{value:j.value,disabled:j.disabled,className:(0,U.default)(Ki,g&&"_1b7s5f8",f&&"_1b7s5fa",x&&"_1b7s5fc"),style:{gridRow:j.gridRow,gridColumn:j.gridColumn},"aria-label":m?void 0:j.label,children:[j.icon,m&&(0,n.jsx)("span",{className:"_1b7s5fd",children:j.label})]},j.value);return!g&&!f?L:(0,n.jsx)(Ue,{label:j.label,checked:f&&j.value===t,children:L},j.value)})})},Zi=e=>{switch(Math.min(Math.max(Math.round(e),1),Xi)){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]}},Lr=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"})})}),ge=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"})})}),Yi="_1g5x15w0 uz3g760",Ji="_1g5x15w1",Qi="_1g5x15w2",sn="_1g5x15w3",es="_1g5x15w4",ts="_1g5x15w5",ns="_1g5x15w6",rs="_1g5x15w7";var Ir=({options:e,value:t,onChange:r,placeholder:o,disabled:a,hasError:i,ariaLabel:s,ariaLabelledBy:c,id:d})=>{const h=ee({id:d,ariaLabel:s,ariaLabelledBy:c}),p=se();return(0,n.jsxs)(Z.Select.Root,{value:t,onValueChange:m=>m!==null&&r(m),disabled:a,items:e.map(m=>({value:m.value,label:m.label})),children:[(0,n.jsxs)(Z.Select.Trigger,{className:Yi,"data-error":i===!0,...h,children:[(0,n.jsx)(Z.Select.Value,{className:Ji,children:m=>os(e,m,o)}),(0,n.jsx)(Z.Select.Icon,{className:sn,children:(0,n.jsx)(ge,{size:"sm"})})]}),(0,n.jsx)(Z.Select.Portal,{container:p??l.resolvePortalContainer(),children:(0,n.jsx)(l.PortalThemeProvider,{children:(0,n.jsx)(Z.Select.Positioner,{className:es,sideOffset:4,alignItemWithTrigger:!1,children:(0,n.jsx)(Z.Select.Popup,{className:ts,children:e.map(m=>(0,n.jsxs)(Z.Select.Item,{value:m.value,disabled:m.disabled,className:ns,children:[m.icon,(0,n.jsxs)("span",{className:rs,children:[(0,n.jsx)(Z.Select.ItemText,{children:m.label}),m.description!==void 0&&(0,n.jsx)("span",{className:"_1g5x15w8",children:m.description})]}),(0,n.jsx)(Z.Select.ItemIndicator,{className:sn,children:(0,n.jsx)(Lr,{size:"sm"})})]},m.value))})})})})]})},os=(e,t,r)=>t===null?(0,n.jsx)("span",{className:Qi,children:r}):as(e,t),as=(e,t)=>e.find(r=>r.value===t)?.label??t,is="vod76w0",ss="vod76w1",ls="vod76w2",cs="vod76w3",ds="vod76w4",us="vod76w5";var Er=({value:e,onChange:t,onCommit:r,min:o,max:a,step:i,suffix:s,formatValue:c,showValue:d=!0,disabled:h,ariaLabel:p,ariaLabelledBy:m})=>{const g=ee({ariaLabel:p,ariaLabelledBy:m},!1),f=hs(e,s,c),{commitUnlessHeldKey:x,gestureHandlers:b}=$e(r);return(0,n.jsxs)("div",{className:is,children:[(0,n.jsx)(ce.Slider.Root,{className:ss,value:e,onValueChange:S=>t(S),onValueCommitted:(S,j)=>{x(j.reason===wr)},min:o,max:a,step:i,disabled:h,children:(0,n.jsx)(ce.Slider.Control,{className:ls,children:(0,n.jsxs)(ce.Slider.Track,{className:cs,children:[(0,n.jsx)(ce.Slider.Indicator,{className:ds}),(0,n.jsx)(ce.Slider.Thumb,{className:us,...b,...g})]})})}),d&&(0,n.jsx)("span",{className:"vod76w6",children:f})]})},hs=(e,t,r)=>r!==void 0?r(e):`${e}${t??""}`,ps="_1hyrlw60",ms="_1hyrlw61",Mr=({checked:e,onChange:t,disabled:r,ariaLabel:o,ariaLabelledBy:a,id:i})=>{const s=ee({id:i,ariaLabel:o,ariaLabelledBy:a});return(0,n.jsx)(on.Switch.Root,{checked:e,onCheckedChange:c=>t(c),disabled:r,className:ps,...s,children:(0,n.jsx)(on.Switch.Thumb,{className:ms})})},gs="uz3g761",vs="tpcnun0 uz3g760",Rr=({value:e,onChange:t,onCommit:r,placeholder:o,disabled:a,hasError:i,ariaLabel:s,ariaLabelledBy:c,id:d})=>{const h=ee({id:d,ariaLabel:s,ariaLabelledBy:c});return(0,n.jsx)(jr,{className:vs,"data-error":i===!0,children:(0,n.jsx)(Ja.Input,{className:gs,value:e,onValueChange:p=>t(p),onBlur:r,placeholder:o,disabled:a,"aria-invalid":i===!0?!0:void 0,...h})})},xs="cnu9yl0",fs="cnu9yl1";var Ft=({options:e,value:t,onChange:r,onCommit:o,itemLayout:a="inline",hasEqualWidths:i=!1,disabled:s,ariaLabel:c,ariaLabelledBy:d,id:h})=>{const p=ee({id:h,ariaLabel:c,ariaLabelledBy:d}),m=a==="stacked",{commitAfterChange:g,gestureHandlers:f}=$e(o);return(0,n.jsx)(lr.RadioGroup,{className:xs,value:t,onValueChange:x=>{r(x),g()},...f,disabled:s,...p,children:e.map(x=>{const b=bs(x,m),S=(0,n.jsxs)(sr.Radio.Root,{value:x.value,disabled:x.disabled,className:(0,U.default)(fs,m&&"cnu9yl3",i&&"cnu9yl2"),"aria-label":b,children:[x.icon,Or(x,m)&&(0,n.jsx)("span",{className:"cnu9yl4",children:x.label})]},x.value);return b===void 0?S:(0,n.jsx)(Ue,{label:b,checked:x.value===t,children:S},x.value)})})},Or=(e,t)=>e.icon===void 0||t,bs=(e,t)=>{if(!Or(e,t))return e.label},Ss={ToggleGroup:Ft,Switch:Mr,Slider:Er,RadioGrid:Pr,Button:fr,TextField:Rr,NumberField:Tr,Select:Ir,ColorSwatches:vr,CustomColor:Cr},mt=(0,v.createContext)(Ss),_r=({controls:e,children:t})=>{const r=(0,v.useContext)(mt),o=(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,ColorSwatches:e?.ColorSwatches??r.ColorSwatches,CustomColor:e?.CustomColor??r.CustomColor}),[r,e?.ToggleGroup,e?.Switch,e?.Slider,e?.RadioGrid,e?.Button,e?.TextField,e?.NumberField,e?.Select,e?.ColorSwatches,e?.CustomColor]);return(0,n.jsx)(mt.Provider,{value:o,children:t})},O=()=>(0,v.useContext)(mt);var ys="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))",Cs="d0bl00";var js="d0bl03",ws="d0bl04",Ts=.01,gt=l.CANVAS_COLOR_KEYS.map(e=>l.vars[e]),As=Object.fromEntries(l.CANVAS_COLOR_KEYS.map(e=>[l.vars[e],e])),ks=e=>gt.some(t=>t.toLowerCase()===e.toLowerCase()),Ps=({color:e,onChange:t,open:r,onOpenChange:o,children:a,label:i,popupAttributes:s,opacity:c,onOpacityChange:d,hasTransparentOption:h=!1})=>{const p=l.useI18n(),{ColorSwatches:m,Slider:g}=O(),f=Es(),x=h?[mr,...gt]:gt,b=S=>{t(S),o(!1)};return(0,n.jsxs)(H.Popover.Root,{open:r,onOpenChange:o,children:[(0,n.jsx)(H.Popover.Trigger,{render:(0,n.jsx)(Q.Toolbar.Button,{}),"aria-label":i??p("graph.toolbar.color.label"),className:Cs,onMouseDown:S=>S.preventDefault(),children:a??(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:js,children:(0,n.jsxs)(H.Popover.Popup,{className:ws,onMouseDown:S=>S.preventDefault(),...s,children:[(0,n.jsx)(m,{title:p("graph.colorDropdown.colors"),colors:x,value:e,onChange:b}),f.length>0&&(0,n.jsx)(m,{title:p("graph.colorDropdown.chartColors"),colors:f,value:e,onChange:b}),(0,n.jsx)(Is,{value:e,onChange:t,popupAttributes:s}),c!==void 0&&d!==void 0&&(0,n.jsxs)("div",{className:"_14ty2ng0",children:[(0,n.jsx)("div",{className:"_14ty2ng1",children:p("graph.colorDropdown.opacity")}),(0,n.jsx)(g,{value:c,onChange:d,min:0,max:1,step:Ts,showValue:!1,ariaLabel:p("graph.colorDropdown.opacity")})]})]})})})})]})},Ls=(e,t)=>{if(l.isHex(e))return e;const r=As[e];return r===void 0?e:t[r]},Is=({value:e,onChange:t,popupAttributes:r})=>{const{CustomColor:o}=O(),{themeValues:a}=l.useThemeContext();return(0,n.jsx)(o,{value:e===null?null:Ls(e,a),onChange:t,popupAttributes:r})},Es=()=>{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 o=e.map(r);typeof o=="string"&&t.add(o)}return[...t]},[e])},Ms="l9kff0",Rs="l9kff1",Os="l9kff2",_s="xn24px0",Ns="xn24px1",Ds="xn24px2",Fs=({children:e,popupAttributes:t})=>(0,n.jsx)(F.Menu.Portal,{container:l.resolvePortalContainer(),children:(0,n.jsx)(l.PortalThemeProvider,{children:(0,n.jsx)(F.Menu.Positioner,{side:"bottom",align:"start",sideOffset:6,className:_s,children:(0,n.jsx)(F.Menu.Popup,{className:Ns,onMouseDown:r=>r.preventDefault(),...t,children:e})})})}),Bs=({children:e,selected:t=!1,disabled:r=!1,onClick:o})=>(0,n.jsx)(F.Menu.Item,{className:Ds,"data-selected":t,disabled:r,onClick:o,children:e}),zs=({className:e,...t})=>(0,n.jsx)(q.Tooltip.Provider,{children:(0,n.jsx)(Q.Toolbar.Root,{...t,className:(0,U.default)(Ms,e)})}),Gs=({className:e,...t})=>(0,n.jsx)(Q.Toolbar.Group,{...t,className:(0,U.default)(Rs,e)}),Hs=({className:e,...t})=>(0,n.jsx)(Q.Toolbar.Separator,{...t,className:(0,U.default)(Os,e)}),Vs=({children:e})=>{const t=l.resolvePortalContainer();return t===null?null:(0,Et.createPortal)((0,n.jsx)(l.PortalThemeProvider,{children:e}),t)},G={Portal:Vs,Root:zs,Group:Gs,Separator:Hs,Button:Q.Toolbar.Button,ColorPicker:Ps,MenuPopup:Fs,MenuItem:Bs},Ws="'Noto Serif', Georgia, 'Times New Roman', serif, 'Apple Color Emoji', 'NotoColorEmoji'",$s=`'Aeonik', 'Aeonik Fallback', ${l.DEFAULT_FONT_FAMILY}`,Us="'PT Mono', 'Courier New', monospace, 'Apple Color Emoji', 'NotoColorEmoji'",qs="'Intruding Cat', cursive, 'Apple Color Emoji', 'NotoColorEmoji'",vt=[{id:"modern",label:"Modern",preview:"Aa",fontFamily:l.DEFAULT_FONT_FAMILY},{id:"fresh",label:"Fresh",preview:"Aa",fontFamily:$s},{id:"timeless",label:"Timeless",preview:"Aa",fontFamily:Ws},{id:"technical",label:"Technical",preview:"00",fontFamily:Us},{id:"fineliner",label:"Fineliner",preview:"Aa",fontFamily:qs}],Ks=e=>e?vt.find(t=>t.fontFamily===e)??null:null,Nr="_70l3rt0",Dr="_70l3rt1",Fr="_70l3rt3",Br="_70l3rt4",zr="_70l3rt5",Xs=({editor:e,currentFontFamily:t,open:r,onOpenChange:o})=>{const a=l.useI18n(),i=Ks(t)??vt[0],s=c=>{e.chain().focus().setFontFamily(c.fontFamily).run()};return(0,n.jsxs)(F.Menu.Root,{open:r,onOpenChange:o,children:[(0,n.jsxs)(F.Menu.Trigger,{render:(0,n.jsx)(Q.Toolbar.Button,{}),"aria-label":a("graph.toolbar.font.ariaLabel"),className:Nr,onMouseDown:c=>c.preventDefault(),children:[(0,n.jsx)("span",{className:Dr,style:{fontFamily:i?.fontFamily},children:i?.preview}),(0,n.jsx)(ge,{size:"sm"})]}),(0,n.jsx)(F.Menu.Portal,{container:l.resolvePortalContainer(),children:(0,n.jsx)(l.PortalThemeProvider,{children:(0,n.jsx)(F.Menu.Positioner,{side:"bottom",align:"start",sideOffset:6,className:Fr,children:(0,n.jsx)(F.Menu.Popup,{className:Br,onMouseDown:c=>c.preventDefault(),children:vt.map(c=>(0,n.jsx)(F.Menu.Item,{className:zr,"data-selected":c.id===i?.id,onClick:()=>s(c),children:(0,n.jsx)("span",{style:{fontFamily:c.fontFamily},children:c.label})},c.id))})})})})]})},Gr={id:"text",translationKey:"graph.toolbar.heading.text",previewFont:l.vars.fontTextEditorBody},ln=[{id:"caption",translationKey:"graph.toolbar.heading.caption",previewFont:l.vars.fontTextEditorH6},Gr,{id:"h3",translationKey:"graph.toolbar.heading.heading3",previewFont:l.vars.fontTextEditorH3},{id:"h2",translationKey:"graph.toolbar.heading.heading2",previewFont:l.vars.fontTextEditorH2},{id:"h1",translationKey:"graph.toolbar.heading.heading1",previewFont:l.vars.fontTextEditorH1}],Zs=({editor:e,activeStyle:t,open:r,onOpenChange:o})=>{const a=l.useI18n(),i=ln.find(s=>s.id===t)??Gr;return(0,n.jsxs)(F.Menu.Root,{open:r,onOpenChange:o,children:[(0,n.jsxs)(F.Menu.Trigger,{render:(0,n.jsx)(Q.Toolbar.Button,{}),"aria-label":a("graph.toolbar.heading.ariaLabel"),className:Nr,onMouseDown:s=>s.preventDefault(),children:[(0,n.jsx)("span",{className:Dr,children:a(i.translationKey)}),(0,n.jsx)(ge,{size:"sm"})]}),(0,n.jsx)(F.Menu.Portal,{container:l.resolvePortalContainer(),children:(0,n.jsx)(l.PortalThemeProvider,{children:(0,n.jsx)(F.Menu.Positioner,{side:"bottom",align:"start",sideOffset:6,className:Fr,children:(0,n.jsx)(F.Menu.Popup,{className:Br,onMouseDown:s=>s.preventDefault(),children:ln.map(s=>(0,n.jsx)(F.Menu.Item,{className:zr,"data-selected":s.id===i.id,onClick:()=>Ys(e,s.id),children:(0,n.jsx)(Js,{font:s.previewFont,children:a(s.translationKey)})},s.id))})})})})]})},Ys=(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()}},Js=({font:e,children:t})=>(0,n.jsx)("span",{style:{font:e,margin:0},children:t}),Qs=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"})]})}),el=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"})]})}),tl=e=>!e.content||e.content.length===0?!0:e.content.every(t=>!t.content||t.content.length===0),nl=e=>{const{$from:t}=e.state.selection,r=t.parent.textContent,o=t.parentOffset,a=t.start();let i=o;for(;i>0&&cn(r[i-1]);)i-=1;let s=o;for(;s<r.length&&cn(r[s]);)s+=1;return{from:a+i,to:a+s}},cn=e=>e!==void 0&&/\S/.test(e),rl="fop13s0",ol="fop13s1",al="fop13s2",il="fop13s3",dn="fop13s4",sl=({editor:e,currentUrl:t,active:r,open:o,onOpenChange:a})=>{const i=l.useI18n(),[s,c]=(0,v.useState)(""),d=(0,v.useRef)(null);(0,v.useEffect)(()=>{o&&c(t??"")},[o,t]);const h=()=>{ll(e,s),a(!1)},p=()=>{c(""),a(!1)},m=f=>{c(f.target.value)},g=f=>{f.key==="Enter"&&(f.preventDefault(),h())};return(0,n.jsxs)(H.Popover.Root,{open:o,onOpenChange:a,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:rl,onMouseDown:f=>f.preventDefault(),children:(0,n.jsx)(Qs,{})}),(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:ol,children:(0,n.jsxs)(H.Popover.Popup,{className:al,initialFocus:d,onMouseDown:f=>f.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:il,onMouseDown:f=>f.stopPropagation(),onChange:m,onKeyDown:g}),(0,n.jsx)("button",{type:"button","aria-label":i("common.cancel"),className:dn,onClick:p,children:(0,n.jsx)(el,{})}),(0,n.jsx)("button",{type:"button","aria-label":i("graph.toolbar.link.apply"),className:dn,onClick:h,children:(0,n.jsx)(Lr,{})})]})})})})]})},ll=(e,t)=>{const r=t.trim(),{selection:o}=e.state;if(!r){e.chain().focus().extendMarkRange("link").unsetLink().run();return}if(!o.empty){e.chain().focus().setLink({href:r}).run();return}if(e.isActive("link")){e.chain().focus().extendMarkRange("link").setLink({href:r}).run();return}const a=nl(e);e.chain().focus().setTextSelection(a).setLink({href:r}).run()},Hr=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"})]})}),Vr=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"})]})}),Wr=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"})]})}),cl="_1d66w570",dl="_1d66w571",ie=({label:e,active:t,onToggle:r,children:o})=>{const a=i=>i.preventDefault();return(0,n.jsxs)(q.Tooltip.Root,{children:[(0,n.jsx)(q.Tooltip.Trigger,{render:(0,n.jsx)(Qa.Toggle,{render:(0,n.jsx)(Q.Toolbar.Button,{}),pressed:t,onPressedChange:()=>r()}),"aria-label":e,className:cl,onMouseDown:a,children:o}),(0,n.jsx)(q.Tooltip.Portal,{container:l.resolvePortalContainer(),children:(0,n.jsx)(Dt,{children:(0,n.jsx)(q.Tooltip.Positioner,{sideOffset:6,className:dl,children:(0,n.jsx)(q.Tooltip.Popup,{className:Ar,children:e})})})})]})},ul=({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"),active:t==="left",onToggle:()=>e.chain().focus().setTextAlign("left").run(),children:(0,n.jsx)(Wr,{})}),(0,n.jsx)(ie,{label:r("graph.toolbar.textAlign.center"),active:t==="center",onToggle:()=>e.chain().focus().setTextAlign("center").run(),children:(0,n.jsx)(Hr,{})}),(0,n.jsx)(ie,{label:r("graph.toolbar.textAlign.right"),active:t==="right",onToggle:()=>e.chain().focus().setTextAlign("right").run(),children:(0,n.jsx)(Vr,{})})]})},hl="_1u34vl40",pl=({editor:e})=>({bold:e?.isActive("bold")??!1,italic:e?.isActive("italic")??!1,underlined:e?.isActive("underline")??!1,linked:e?.isActive("link")??!1,linkUrl:e?.getAttributes("link").href??null,color:e?.getAttributes("textStyle").color??null,fontFamily:e?.getAttributes("textStyle").fontFamily??null,fontSize:ml(e),textAlign:gl(e)}),ml=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",gl=e=>e?e.isActive({textAlign:"center"})?"center":e.isActive({textAlign:"right"})?"right":"left":"left",vl=8,xl=8,fl=({editor:e})=>{const t=l.useI18n(),[r,o]=(0,v.useState)(!1),[a,i]=(0,v.useState)(null),s=a!==null,c=f=>x=>{i(x?f:null)},{refs:d,floatingStyles:h}=(0,le.useFloating)({placement:"top-start",strategy:"fixed",middleware:[(0,le.offset)(vl),(0,le.flip)(),(0,le.shift)({padding:xl})],whileElementsMounted:le.autoUpdate}),p=(0,v.useRef)(null),m=(0,Ve.useEditorState)({editor:e,selector:pl}),g=(0,v.useCallback)(f=>{p.current=f,d.setFloating(f)},[d]);return(0,v.useEffect)(()=>{e&&d.setReference(e.view.dom)},[e,d]),(0,v.useEffect)(()=>{if(!e)return;const f=()=>o(!0),x=({event:b})=>{const{relatedTarget:S,currentTarget:j}=b,L=S instanceof Node&&p.current?.contains(S),A=S instanceof Node&&j instanceof Node&&j.contains(S);!L&&!A&&o(!1)};return e.on("focus",f),e.on("blur",x),()=>{e.off("focus",f),e.off("blur",x)}},[e]),!e||!r&&!s?null:(0,n.jsx)(G.Portal,{children:(0,n.jsxs)(G.Root,{ref:g,className:hl,style:h,children:[(0,n.jsxs)(G.Group,{children:[(0,n.jsx)(G.ColorPicker,{color:m?.color??null,onChange:f=>e.chain().setColor(f).run(),open:a==="color",onOpenChange:c("color")}),(0,n.jsx)(Xs,{editor:e,currentFontFamily:m?.fontFamily??null,open:a==="fontFamily",onOpenChange:c("fontFamily")})]}),(0,n.jsx)(G.Separator,{}),(0,n.jsx)(G.Group,{children:(0,n.jsx)(Zs,{editor:e,activeStyle:m?.fontSize??"text",open:a==="fontSize",onOpenChange:c("fontSize")})}),(0,n.jsx)(G.Separator,{}),(0,n.jsxs)(G.Group,{children:[(0,n.jsx)(ie,{label:t("graph.toolbar.formatting.bold"),active:m?.bold??!1,onToggle:()=>e.chain().focus().toggleBold().run(),children:(0,n.jsx)("strong",{children:"B"})}),(0,n.jsx)(ie,{label:t("graph.toolbar.formatting.italic"),active:m?.italic??!1,onToggle:()=>e.chain().focus().toggleItalic().run(),children:(0,n.jsx)("em",{children:"I"})}),(0,n.jsx)(ie,{label:t("graph.toolbar.formatting.underline"),active:m?.underlined??!1,onToggle:()=>e.chain().focus().toggleUnderline().run(),children:(0,n.jsx)("u",{children:"U"})})]}),(0,n.jsx)(G.Separator,{}),(0,n.jsx)(G.Group,{children:(0,n.jsx)(ul,{editor:e,activeAlignment:m?.textAlign})}),(0,n.jsx)(G.Separator,{}),(0,n.jsx)(G.Group,{children:(0,n.jsx)(sl,{editor:e,currentUrl:m?.linkUrl??null,active:m?.linked??!1,open:a==="link",onOpenChange:c("link")})})]})})},bl="_1uy50v30",$r=({editor:e,ariaLabel:t})=>(0,n.jsxs)("div",{className:bl,children:[(0,n.jsx)(fl,{editor:e}),(0,n.jsx)(Ve.EditorContent,{editor:e,"aria-label":t})]}),Sl=200,Bt=({content:e,extensions:t,editable:r,onUpdate:o,updateDebounceMs:a=Sl})=>{const i=(0,v.useRef)(un(e)),s=(0,v.useRef)(i.current),c=l.useDebouncedCallback(h=>{s.current=h,o?.(h)},a),d=(0,Ve.useEditor)({extensions:t,content:i.current,editable:r,immediatelyRender:!1,onUpdate:({editor:h})=>{const p=h.getJSON();if(tt(s.current,p))return c.cancel();c.run(p)}});return(0,v.useEffect)(()=>{d?.setEditable(r)},[d,r]),(0,v.useEffect)(()=>{if(!d)return;const h=un(e);tt(s.current,h)||(s.current=h,!tt(d.getJSON(),h)&&(c.cancel(),yl(d,h)))},[d,e,c]),(0,v.useEffect)(()=>()=>c.flush(),[c]),d},un=e=>e===null?{type:"doc",content:[]}:typeof e=="string"?{type:"doc",content:[{type:"paragraph",content:e?[{type:"text",text:e}]:[]}]}:e,yl=(e,t)=>{const{from:r,to:o}=e.state.selection;e.commands.setContent(t,{emitUpdate:!1});const a=e.state.doc.content.size;e.commands.setTextSelection({from:Math.min(r,a),to:Math.min(o,a)})},tt=(e,t)=>JSON.stringify(Re(e))===JSON.stringify(Re(t)),Re=e=>Array.isArray(e)?e.map(Re):e===null||typeof e!="object"?e:Object.fromEntries(Object.entries(e).map(([t,r])=>[t,Re(r)]).filter(([,t])=>!Cl(t)).sort(([t],[r])=>String(t).localeCompare(String(r)))),Cl=e=>e==null||typeof e=="object"&&Object.keys(e).length===0,jl=({caption:e,captionStyle:t})=>{const{dispatch:r}=l.useGraphCommands(),o=Bt({content:e,extensions:(0,v.useMemo)(()=>yi({placeholder:"Add caption"}),[]),editable:!0,onUpdate:a=>{const i=tl(a)?null:a;r(new u.SetContentCaptionCommand({caption:i}))}});return(0,n.jsx)("div",{"data-testid":"caption-editor",style:l.toHtmlTextCss(t),children:(0,n.jsx)($r,{editor:o,ariaLabel:"Chart caption"})})},wl=e=>[Ee.Document,ir.Paragraph,...Ot(),Al,He.Placeholder.configure({showOnlyCurrent:!1,placeholder:({pos:t})=>t===0?e:""})],Tl=({annotation:e})=>{const t=l.useI18n(),{dispatch:r}=l.useGraphCommands(),o=l.useEditorStore(),a=(0,v.useMemo)(()=>wl(t("graph.annotations.text.placeholder")),[t]),i=Bt({content:e.content,extensions:a,editable:!0,onUpdate:s=>{r(new u.UpdateAnnotationCommand({kind:"text",id:e.id,patch:{content:s}}))}});return(0,v.useEffect)(()=>{const{setCaretEditor:s}=o.getState();return s(i),()=>s(null)},[i,o]),(0,v.useEffect)(()=>{i?.commands.focus("end",{scrollIntoView:!1})},[i]),(0,n.jsx)(Ve.EditorContent,{"aria-label":t("graph.annotations.text.editLabel"),className:l.editor,editor:i,"data-testid":"text-annotation-editor"})},hn=e=>{const t=l.resolveRichTextFontFamily(e);return t===void 0?{}:{style:`font-family: ${t}`}},Al=ar.Extension.create({name:"annotationTextStyleAttributes",addGlobalAttributes(){return[{types:["textStyle"],attributes:{fontFamily:{default:null,renderHTML:e=>hn(e.fontFamily)},font:{default:null,renderHTML:e=>hn(e.font)},fontSize:{default:null,renderHTML:e=>typeof e.fontSize=="number"&&Number.isFinite(e.fontSize)?{style:`font-size: calc(${e.fontSize}px * ${l.vars.textScale})`}:{}}}}]}}),kl=3,Pl=({title:e,showTitle:t,subtitle:r,showSubtitle:o})=>{const a=[];return t&&a.push({type:"heading",attrs:{level:kl},content:Il(e)}),o&&a.push(...El(r)),{type:"doc",content:a}},Ll=e=>{const[t,...r]=e.content??[];return{title:Ml(t?.content??[]),subtitle:Rl(r)}},zt=e=>({type:e.type??"text",...e.content!==void 0?{content:e.content.map(zt)}:{},...e.text!==void 0?{text:e.text}:{},...e.marks!==void 0?{marks:e.marks}:{},...e.attrs!==void 0?{attrs:e.attrs}:{}}),Il=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??[],El=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(pn):[pn(e)],pn=e=>e.type==="paragraph"?e:{type:"paragraph",content:e.content??[e]},Ml=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(zt)}},Rl=e=>{const t=e.filter(o=>(o.content??[]).length>0);if(t.length===0)return null;const[r]=t;if(r&&t.length===1&&r.type==="paragraph"){const o=r.content??[],[a]=o;if(a&&o.length===1&&a.type==="text"&&(!a.marks||a.marks.length===0))return a.text??null}return{type:"doc",content:t.map(zt)}},Ol="uwf6lt0",_l={fontFamily:"var(--uwf6lt1)",fontSize:"var(--uwf6lt2)",fontWeight:"var(--uwf6lt3)",fontStyle:"var(--uwf6lt4)",letterSpacing:"var(--uwf6lt5)",lineHeight:"var(--uwf6lt6)",textColor:"var(--uwf6lt7)",textTransform:"var(--uwf6lt8)",textDecoration:"var(--uwf6lt9)",textShadow:"var(--uwf6lta)",textOutline:"var(--uwf6ltb)"},Nl={fontFamily:"var(--uwf6ltc)",fontSize:"var(--uwf6ltd)",fontWeight:"var(--uwf6lte)",fontStyle:"var(--uwf6ltf)",letterSpacing:"var(--uwf6ltg)",lineHeight:"var(--uwf6lth)",textColor:"var(--uwf6lti)",textTransform:"var(--uwf6ltj)",textDecoration:"var(--uwf6ltk)",textShadow:"var(--uwf6ltl)",textOutline:"var(--uwf6ltm)"},Dl=({title:e,showTitle:t,showSubtitle:r,subtitle:o,headingStyle:a,subtitleStyle:i})=>{const{dispatch:s}=l.useGraphCommands(),c=(0,v.useMemo)(()=>Si({titlePlaceholder:"Untitled",subtitlePlaceholder:"Untitled",showTitle:t,showSubtitle:r}),[t,r]),d=Bt({content:(0,v.useMemo)(()=>Pl({title:e,showTitle:t,subtitle:o,showSubtitle:r}),[e,t,o,r]),extensions:c,editable:!0,onUpdate:h=>{const p=Ll(h);t&&s(new u.SetContentTitleCommand({title:p.title})),r&&s(new u.SetContentSubtitleCommand({subtitle:p.subtitle}))}});return(0,n.jsx)("div",{className:Ol,"data-testid":"title-editor",style:{...l.assignTextStyleVars(_l,a),...l.assignTextStyleVars(Nl,i)},children:(0,n.jsx)($r,{editor:d,ariaLabel:"Chart title and subtitle"})})},Fl={Title:Dl,Caption:jl,TextAnnotation:Tl},Bl="_10igzta0",zl=({rect:e,zIndex:t,container:r,boxRef:o,children:a,...i})=>r===null?null:(0,Et.createPortal)((0,n.jsx)("div",{...i,ref:o,className:Bl,style:{transform:`translate(${e.left}px, ${e.top}px)`,width:e.width,height:e.height,zIndex:t},children:a}),r),Ur=(e,t)=>{const{offsetWidth:r}=e;return r<=0||t<=0?1:t/r},qr=e=>Ur(e,e.getBoundingClientRect().width),mn=(e,t)=>{const{offsetWidth:r,offsetHeight:o}=e;return r<=0||o<=0?t:{width:r,height:o}},ve=e=>e.offset+e.strokeWidth,gn="http://www.w3.org/2000/svg",vn=new WeakMap,Gl=(e,t)=>{const r=Hl(e);r.setAttribute("d",t);const{x:o,y:a,width:i,height:s}=r.getBBox();return{x:o,y:a,width:i,height:s}},Hl=e=>{const t=vn.get(e);if(t?.isConnected)return t;const r=e.createElementNS(gn,"svg");r.setAttribute("aria-hidden","true"),r.style.cssText="position:absolute;width:0;height:0;overflow:hidden;visibility:hidden;pointer-events:none";const o=e.createElementNS(gn,"path");return r.append(o),e.body.append(r),vn.set(e,o),o},Vl=(e,t)=>{const{panelRect:r,look:o,readGridLineWidth:a,measurePathBox:i}=t,s=ve(o);switch(e.kind){case"observations":return nt([...e.parts,...e.vertex===null?[]:[e.vertex]].flatMap(c=>Wl(c,i)).map(c=>({...c,x:c.x+r.x,y:c.y+r.y})),s);case"guide":return nt(e.shapes.map(c=>c.kind==="box"?c.rect:l.growRect(Ul(c),a(c.axis)/2)),s);case"graph":return nt([{x:0,y:0,...e.frameSize}],-o.offset);default:return e}},Wl=(e,t)=>e.kind==="boxes"?e.boxes:$l(e.shapes,t),$l=(e,t)=>{const r=[],o=new Map;for(const a of e){if(a.kind==="dots"){r.push(...a.centers.map(c=>l.growRect({...c,width:0,height:0},a.size/2)));continue}if(a.pathData==="")continue;const i=a.kind==="stroke"?a.width/2:0;if(!a.pathData.trimStart().startsWith("M")){r.push(l.growRect(t(a.pathData),i));continue}const s=o.get(i)??[];s.push(a.pathData),o.set(i,s)}for(const[a,i]of o)r.push(l.growRect(t(i.join("")),a));return r},Ul=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}}},nt=(e,t)=>{const r=e.filter(({width:o,height:a})=>o>0||a>0);return r.length===0?null:l.growRect((0,u.getBoundingRect)(r),t)};var ql=(e,{coordSystem:t,panelRect:r})=>{if(e.kind!=="observations")return null;const o=e.vertex===null?e.parts:[...e.parts,e.vertex],a=o.reduce((s,c)=>Math.max(s,c.rows.length),0),i=a===1&&e.vertex===null;return a===0||i||a>1e3?null:o.flatMap(s=>Kl(s,t,r).map(c=>({...c,x:c.x+r.x,y:c.y+r.y})))},Kl=(e,t,r)=>(0,u.measureObservationsBoxes)({layer:{...e.layer,data:e.layer.data.take(e.rows)},coordSystem:t,panelSize:r,radialExtent:"outerEnd"}),Xl=.5,Zl={top:e=>-e.y,right:e=>e.x+e.width,bottom:e=>e.y+e.height,left:e=>-e.x},Yl=(e,t,r)=>e===null||!Jl(e)?{top:xt(t),right:ft(t),bottom:xt(t),left:ft(t)}:{top:Ce(e,t,"top",r),right:Ce(e,t,"right",r),bottom:Ce(e,t,"bottom",r),left:Ce(e,t,"left",r)},Ce=(e,t,r,o)=>{const a=Zl[r],i=r==="left"||r==="right",s=x=>i?x.y:x.x,c=x=>i?x.y+x.height:x.x+x.width;let d=-1/0;for(const x of e)d=Math.max(d,a(x));const h=d-Math.max(o,Xl);let p=1/0,m=-1/0;for(const x of e)a(x)<h||(p=Math.min(p,s(x)),m=Math.max(m,c(x)));const g=i?ft(t):xt(t),f={from:(0,ne.clamp)(p-o,g.from,g.to),to:(0,ne.clamp)(m+o,g.from,g.to)};return f.from<f.to?f:g},Jl=e=>{const[t]=e;return t!==void 0&&e.some(r=>!l.areRectsEqual(r,t))},xt=e=>({from:e.x,to:e.x+e.width}),ft=e=>({from:e.y,to:e.y+e.height}),Ql=(e,{frameElement:t,panelRect:r,look:o})=>{const a=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,x=Vl(h,{panelRect:r,look:o,readGridLineWidth:j=>l.readGridLineStyle(i,j).strokeWidth,measurePathBox:j=>{const L=m.get(j)??Gl(t.ownerDocument,j);return g.set(j,L),L}});if(c.current=g,x===null){a.getState().setSelectedOutline(null);return}const b=Yl(ql(h,{coordSystem:s,panelRect:r}),x,ve(o)),S=qr(t);a.getState().setSelectedOutline({target:d,frame:x,frameSpans:b,frameScale:S})},[a,i,s,d,h,t,r,o]);const p=e!==null;(0,v.useLayoutEffect)(()=>p?()=>a.getState().setSelectedOutline(null):void 0,[a,p])},Gt="var(--_10d2ycx0)",ec="_10d2ycx1",tc="_10d2ycx2",xn=({pathData:e,animateTransitions:t,source:r,...o})=>t?(0,n.jsx)(nc,{pathData:e,source:r,...o}):(0,n.jsx)("path",{d:e,...o}),nc=({pathData:e,source:t,...r})=>{const o=l.useSvgPathMorph(e,l.DEFAULT_SPRING_TRANSITION,t);return(0,n.jsx)(Va.motion.path,{d:o,...r})},rc="var(--n5vlnq0)",oc="data-edit-outline-stroke",Kr=e=>({[oc]:"",style:(0,Y.assignInlineVars)({[rc]:`${e}px`})}),ac=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 18 18",...e,children:(0,n.jsx)("path",{d:"M4 3v12M4 6h12M4 10h10M4 14h8",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round"})}),ic=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 18 18",...e,children:(0,n.jsx)("path",{d:"M14 3v12M2 6h12M4 10h10M6 14h8",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round"})}),sc=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 18 18",...e,children:(0,n.jsx)("path",{d:"M2 14 16 4",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round"})}),lc=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 18 18",...e,children:(0,n.jsx)("path",{d:"M2 14C2.5 7 6.1 5.5 16 4",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round"})}),cc=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 18 18",...e,children:(0,n.jsx)("path",{d:"M2 8h14M2 8v3M16 8v3",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round"})}),dc=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 18 18",...e,children:(0,n.jsx)("path",{d:"M2 8h14M3 8v3M7.3 8v3M11.6 8v3M15 8v3",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round"})}),fn={stack:"pr583x0",grid:"pr583x1"},bn="pr583x2",uc={plain:"pr583x4 pr583x3",withIcon:"pr583x5 pr583x3"},k=({label:e,layout:t="grid",icon:r,children:o})=>{const a=(0,v.useId)(),i=(0,v.useId)();return e===void 0?(0,n.jsx)(pt,{className:fn[t],children:(0,n.jsx)("div",{className:bn,children:o})}):(0,n.jsxs)(pt,{className:fn[t],children:[(0,n.jsxs)("label",{id:a,htmlFor:i,className:uc[r===void 0?"plain":"withIcon"],children:[r!==void 0&&(0,n.jsx)("span",{"aria-hidden":"true",children:r}),e]}),(0,n.jsx)("div",{className:bn,children:(0,n.jsx)(ur,{labelId:a,controlId:i,children:o})})]})},Xr=({target:e})=>{const t=l.useGraphHandle();return t===null?null:(0,n.jsx)(hc,{graph:t,axis:e.axis})};Xr.hasRows=(e,{scene:t})=>t.coordSystem.type!=="polar";var hc=({graph:e,axis:t})=>{const r=l.useHandleScene(e),o=l.useI18n(),{NumberField:a,TextField:i,ToggleGroup:s}=O(),c=r?.guides.axes.find(P=>P.scaleAestheticKey===t);if((0,v.useEffect)(()=>()=>e.commands.commit(),[e.commands]),r===null||c?.geometry!=="linear")return null;const d=!c.visible,h=r.scales[t]?.spec.scaleType,p=h==="continuous"||h==="datetime",m=r.guides.legends.drawn.some(P=>P.position==="left"||P.position==="right"),g=t!=="x"&&h==="continuous"&&(c.position==="left"||c.position==="right")&&!m,f=t==="x"?void 0:r.scales[t]?.spec,x=f?.scaleType==="continuous"?f:void 0,b=x!==void 0&&(c.position==="left"||c.position==="right")&&!(0,u.isZeroAnchoredAxis)(r,t),S=x?.transform==="log"?"log":"linear",j=b&&x.transform!=="log",L=x?.domainMin??null,A=x!==void 0&&(c.position==="left"||c.position==="right")&&x.transform!=="log",w=x?.domainMax??null,I=c.label??o("editor.axesPanel.controls.titlePlaceholder"),T=P=>{const N=P===""?null:P,V=t==="ySecondary"?{axis:t,label:N}:{axis:t,label:N};e.commands.dispatch(new u.SetAxisLabelCommand(V),{transient:!0})};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(k,{label:o("editor.axesPanel.controls.title"),children:(0,n.jsx)(i,{value:r.config.axes[t]?.label??"",placeholder:I,onChange:T,onCommit:e.commands.commit,disabled:d})}),p&&(0,n.jsx)(k,{label:o("editor.axesPanel.controls.labels"),children:(0,n.jsx)(s,{value:c.tickMode,disabled:d,options:[{value:"auto",label:o("editor.axesPanel.labelMode.auto"),icon:(0,n.jsx)(dc,{})},{value:"edges",label:o("editor.axesPanel.labelMode.edges"),icon:(0,n.jsx)(cc,{})}],onChange:P=>{const N=P==="edges"?"edges":"auto";e.commands.dispatch(new u.SetAxisTickModeCommand({axis:t,tickMode:N,keepSecondaryAxis:!0}))}})}),g&&(0,n.jsx)(k,{label:o("editor.axesPanel.controls.position"),children:(0,n.jsx)(s,{value:c.position,disabled:d,options:[{value:"left",label:o("editor.axesPanel.position.left"),icon:(0,n.jsx)(ac,{})},{value:"right",label:o("editor.axesPanel.position.right"),icon:(0,n.jsx)(ic,{})}],onChange:P=>{if(P!=="left"&&P!=="right")return;const N=t==="y"?P:P==="left"?"right":"left";e.commands.dispatch(new u.SetAxisPositionCommand({axis:"y",position:N}))}})}),b&&(0,n.jsx)(k,{label:o("editor.axesPanel.controls.scale"),children:(0,n.jsx)(s,{value:S,disabled:d,options:[{value:"linear",label:o("editor.axesPanel.scale.auto"),icon:(0,n.jsx)(sc,{})},{value:"log",label:o("editor.axesPanel.scale.log"),icon:(0,n.jsx)(lc,{})}],onChange:P=>{e.commands.dispatch(new u.SetScaleTransformCommand({scaledAesthetic:t,transform:P==="log"?"log":"linear"}))}})}),j&&(0,n.jsx)(k,{label:o("editor.axesPanel.controls.startFrom"),children:(0,n.jsx)(a,{value:L,placeholder:o("editor.axesPanel.startFrom.auto"),disabled:d,onChange:P=>{e.commands.dispatch(new u.SetScaleDomainCommand({scaledAesthetic:t,domainMin:P}),{transient:!0})},onCommit:e.commands.commit})}),A&&(0,n.jsx)(k,{label:o("editor.axesPanel.controls.endAt"),children:(0,n.jsx)(a,{value:w,placeholder:o("editor.axesPanel.endAt.auto"),disabled:d,onChange:P=>{e.commands.dispatch(new u.SetScaleDomainCommand({scaledAesthetic:t,domainMax:P}),{transient:!0})},onCommit:e.commands.commit})})]})},pc={narrow:3,regular:6,wide:11},mc=({barWidth:e,...t})=>{const r=pc[e];return(0,n.jsx)(l.Icon,{viewBox:"0 0 18 18",...t,children:(0,n.jsx)("rect",{x:(18-r)/2,y:3,width:r,height:12,fill:"currentColor"})})},gc=6,xe=({target:e})=>{const{commands:t}=l.useGraphContext(),{ColorSwatches:r,CustomColor:o}=O(),a=l.useI18n(),i=l.useStyleReaderTree(),s=l.useSceneSelector(m=>m),c=Zr(e,s),d=(0,u.readColorChoices)(s.scales.color).slice(0,gc);(0,v.useEffect)(()=>()=>t.commit(),[t]);const h=(0,v.useMemo)(()=>(0,u.readObservationsColor)({readers:i,layers:s.layers,target:e,parsingLocale:s.config.parsingLocale}),[i,s.config.parsingLocale,s.layers,e]);if(c===null)return null;const p=(m,g)=>{t.dispatch(new u.SetObservationsColorCommand({target:e,color:m}),g?{transient:!0}:void 0)};return(0,n.jsx)(k,{label:c[0]?.property==="stroke"?a("editor.overlayMenu.lineColor"):a("editor.overlayMenu.fillColor"),layout:"stack",children:(0,n.jsx)(r,{colors:vc(d,h),value:h,onChange:m=>p(m,!1),trailing:(0,n.jsx)(o,{variant:"chip",value:h,onChange:m=>p(m,!0),onCommit:()=>t.commit()})})})};xe.hasRows=(e,{scene:t})=>Zr(e,t)!==null;var Zr=(e,t)=>(0,u.findLayerById)(t.layers,e.layerId)===void 0?null:(0,u.readObservationsColorRoute)(t.spec,e),vc=(e,t)=>t===null||e.some(r=>xr(r,t))?e:[...e,t],rt=[{name:"narrow",width:.4},{name:"regular",width:.7},{name:"wide",width:.95}],Yr=({target:e})=>{const t=l.useSceneSelector(g=>g),r=l.useGraphCommands(),o=l.useI18n(),{ToggleGroup:a}=O(),i=(0,u.findLayerById)(t.spec.layers,e.layerId),s=(0,u.isLayerSpecOf)(i,"bar")?i:null,c=t.coordSystem.type==="polar"&&t.coordSystem.bandAxis===null,d=g=>{const f=rt.find(({name:x})=>x===g);f!==void 0&&r.dispatch(new u.SetBarWidthCommand({layerId:e.layerId,width:f.width}))},h=rt.map(({name:g})=>({value:g,label:o(`editor.graphPanel.barSection.widths.${g}`),icon:(0,n.jsx)(mc,{barWidth:g})})),p=s===null?null:(0,u.resolveBarBandFraction)(s.params,t.coordSystem.type),m=rt.find(({width:g})=>g===p)?.name??"";return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(xe,{target:e}),s!==null&&!c?(0,n.jsx)(k,{label:o("editor.graphPanel.barSection.thickness"),children:(0,n.jsx)(a,{value:m,options:h,onChange:d})}):null]})};Yr.hasRows=xe.hasRows;var xc={smooth:"M2 13C6 13 7 5 10 5s4 6 6 6",linear:"M2 13l5-8 4 6 5-4"},fc=({curve:e,...t})=>(0,n.jsx)(l.Icon,{viewBox:"0 0 18 18",...t,children:(0,n.jsx)("path",{d:xc[e],stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round",strokeLinejoin:"round"})}),bc={gap:"M2 12l4-5M12 10l4-4",connect:"M2 12l4-5M6 7l6 3M12 10l4-4",zero:"M2 12l4-5v7h6V10l4-4"},Sc=({missingValues:e,...t})=>(0,n.jsx)(l.Icon,{viewBox:"0 0 18 18",...t,children:(0,n.jsx)("path",{d:bc[e],stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round",strokeLinejoin:"round"})}),yc={supportsDataLabels:!1,supportsPercentages:!1,supportsStackTotals:!1,supportsCategoryLabels:!1},Jr=(e,t,r)=>{if(!r.hasCapability(e.geom,t))return yc;const{showDataLabels:o}=e.dataLabels,a=e.geom==="bar",i=t==="polar";return{supportsDataLabels:!0,supportsPercentages:o&&r.hasPercentageFormat(e,t),supportsStackTotals:a&&!i&&e.position==="stack",supportsCategoryLabels:a&&i&&e.position==="fill"&&o}},Qr=(e,t)=>{switch(t){case"gap":return e("editor.graphPanel.treatEmptyValues.leaveGap.label");case"zero":return e("editor.graphPanel.treatEmptyValues.fillZero.label");case"connect":return e("editor.graphPanel.treatEmptyValues.connectGaps.label");default:return t}};var bt=["gap","zero","connect"],Ht=(e,t,r)=>{const o=(0,u.findLayerById)(e.spec.layers,r);if(!(0,u.isLayerSpecOf)(o,"line","area"))return null;const a=e.coordSystem.type==="polar",i=(0,u.buildLayerStyleAddress)(o.geom,o.id),s=(0,u.readStyleCoord)(e.spec),c=e.spec.styles.overrides,d=(0,u.combineKindStyleDeclarations)(c,i,s),h=(0,u.combineKindStyleDeclarations)((0,u.readStyleRulesBeneath)(c,i,s),i,s),p=typeof d?.strokeWidth=="number"?d.strokeWidth:null,m=Cc(o,e.spec.layers),g=a?[]:wc(o),f=g.length>1,x=o.geom==="line"&&!a,b=x?Ac(e,t,o):0;return{layerId:o.id,showPoints:m!==void 0&&jc(e,t,m.id),pointLayerId:m?.id??null,showFill:x?b>0:null,drawnFillAlpha:b,smooth:a?null:o.params.curve==="smooth",widthMode:p===null?"auto":"custom",hasUnderlyingStrokeWidth:h?.strokeWidth!==void 0,strokeWidth:p??Tc(e,t,o)??u.DEFAULT_STROKE_WIDTH_PX,missingValues:f?o.params.missingValues:null,missingValueOptions:f?g:[]}},Cc=(e,t)=>(0,u.filterLayersByGeoms)(t,"point").find(r=>(0,u.isCompanionLayer)(r,[e])),jc=(e,t,r)=>{const o=(0,u.findLayerById)(e.layers,r);if(o?.geom!=="point")return!1;const a=t.geom.point(o);return o.data.findFirst(i=>a.get("size",i)>0)!==null},wc=e=>{const t=["gap","zero"];return e.position!=="stack"&&e.position!=="fill"&&t.push("connect"),e.geom==="area"?t.filter(r=>r!=="gap"):t},Tc=(e,t,r)=>{const o=(0,u.findLayerById)(e.layers,r.id);if(o?.geom==="line")return t.geom.line(o).get("strokeWidth");if(o?.geom==="area")return t.geom.area(o).get("strokeWidth")},Ac=(e,t,r)=>{const o=(0,u.findLayerById)(e.layers,r.id);return o?.geom==="line"?t.geom.line(o).get("fillAlpha")??0:0},kc=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.8",d:"M0 11 5.5 5.5 10.5 9 16 4v12H0z"}),(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.3",d:"M0 11 5.5 5.5 10.5 9 16 4V0H0z"})]}),Pc=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:"3.5",y:"12.5",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"2.3",y:"9.5",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"4.5",x:"4.267",y:"11.5",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"3.3",x:"4.267",y:"7.5",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"2.5",x:"8.533",y:"13.5",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"1.8",x:"8.533",y:"11",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"4",x:"12.8",y:"12",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"2.8",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"})]})]}),eo=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"})]})]})}),Lc=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"})]}),Ic=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"})]})}),Ec=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"})]})}),Mc=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"})]})}),Rc=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"})]}),Oc=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"})]}),_c=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"})]}),Nc=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"})]})]}),Dc=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"})]})}),Fc=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"})]})}),Bc=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"})]}),zc=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"})]})}),Gc=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"})]}),Hc=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"})]})}),Vc=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"})}),Wc=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"})]})}),$c=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"})]})}),Uc=.55,qc=.15,me=[{name:"column",icon:Rc,summary:{coordType:"cartesian",geom:"bar",position:"dodge"}},{name:"columnStacked",icon:_c,summary:{coordType:"cartesian",geom:"bar",position:"stack"}},{name:"columnStackedFill",icon:Oc,summary:{coordType:"cartesian",geom:"bar",position:"fill"}},{name:"bar",icon:Ic,summary:{coordType:"flip",geom:"bar",position:"dodge"}},{name:"barStacked",icon:Mc,summary:{coordType:"flip",geom:"bar",position:"stack"}},{name:"barStackedFill",icon:Ec,summary:{coordType:"flip",geom:"bar",position:"fill"}},{name:"line",icon:eo,summary:{coordType:"cartesian",geom:"line",position:"identity"}},{name:"areaStacked",icon:Lc,summary:{coordType:"cartesian",geom:"area",position:"stack"}},{name:"combo",icon:Nc,summary:{coordType:"cartesian",comboType:"grouped-bars"}},{name:"scatter",icon:$c,summary:{coordType:"cartesian",geom:"point",position:"identity"}},{name:"pie",icon:Bc,summary:{coordType:"polar",geom:"bar",position:"fill",theta:"y",innerRadius:0}},{name:"donut",icon:Dc,summary:{coordType:"polar",geom:"bar",position:"fill",theta:"y",innerRadius:Uc}},{name:"radialBar",icon:Hc,summary:{coordType:"polar",geom:"bar",position:"stack",theta:"y",innerRadius:qc}},{name:"rose",icon:Vc,summary:{coordType:"polar",geom:"bar",position:"dodge",theta:"x",innerRadius:0}},{name:"roseStacked",icon:Wc,summary:{coordType:"polar",geom:"bar",position:"stack",theta:"x",innerRadius:0}},{name:"radar",icon:zc,summary:{coordType:"polar",geom:"line",position:"identity",theta:"x",innerRadius:0}},{name:"radarFilled",icon:Gc,summary:{coordType:"polar",geom:"area",position:"identity",theta:"x",innerRadius:0}},{name:"heatmap",icon:Fc,summary:{coordType:"cartesian",geom:"tile",position:"identity"}}],Kc=.05,to=(e,t)=>(0,u.isComboChartType)(e)?(0,u.canBecomeCombo)(t):e.geom==="tile"?(0,u.canBecomeHeatmap)(t):!0,Oe=e=>e===null?null:me.find(t=>Xc(t.summary,e))??null,no=(e,t)=>t===null||(0,u.isComboChartType)(e)?e:e.position==="dodge"&&ro(t)?{...e,position:"identity"}:e.coordType!=="polar"||!_e(e.innerRadius)||t.coordType!=="polar"||!_e(t.innerRadius)?e:{...e,innerRadius:t.innerRadius},ro=e=>!(0,u.isComboChartType)(e)&&e.geom==="bar"&&e.position==="identity",Xc=(e,t)=>{if((0,u.isComboChartType)(e)||(0,u.isComboChartType)(t))return(0,u.isComboChartType)(e)&&(0,u.isComboChartType)(t);const r=e.position===t.position||e.position==="dodge"&&ro(t);return e.coordType!==t.coordType||e.geom!==t.geom||!r?!1:e.coordType!=="polar"||t.coordType!=="polar"?!0:e.theta===t.theta&&_e(e.innerRadius)===_e(t.innerRadius)},_e=e=>e>=Kc;var Zc="_1hrfeju1",Yc=[{summary:{coordType:"cartesian",geom:"area",position:"fill"},icon:kc},{summary:{coordType:"cartesian",comboType:"stacked-bars"},icon:Pc},{summary:{coordType:"cartesian",comboType:"lines"},icon:eo}],Jc=[["column","column"],["bar","bar"],["line","line"],["area","areaStacked"],["combo","combo"],["scatter","scatter"],["pie","pie"],["donut","donut"],["heatmap","heatmap"]],Qc=4,ed={dodge:"grouped",identity:"grouped",stack:"stacked",fill:"filled"},td={"grouped-bars":"grouped","stacked-bars":"stacked",lines:"lines"},nd=()=>{const e=l.useSceneSelector(T=>T.spec),t=l.useSceneSelector(({layers:T})=>T.some(P=>(0,u.hasMultipleGroups)(P.data,P.mapping))),r=l.useGraphCommands(),o=l.useI18n(),{Button:a,RadioGrid:i}=O(),[s,c]=(0,v.useState)(!1),d=(0,v.useRef)(null);(0,v.useEffect)(()=>{if(!s)return;const T=({target:P,detail:N})=>{N>0&&od(P)&&d.current?.contains(P)&&c(!1)};return document.addEventListener("click",T),()=>document.removeEventListener("click",T)},[s]);const h=(0,u.readChartType)(e);if(h===null)return null;const p=ad(h),m=Ne(h),g=Oe(h),f=p??g,x=o(f===null?"editor.overlayMenu.customChartType":`editor.graphTypes.${f.name}`),b=(p===void 0?g:yn(p,m))?.icon,S=p!==void 0&&p.arrangements.length>1,j=S&&(t||p.name==="combo"),L=()=>c(!s),A=({summary:T})=>{r.dispatch(new u.SetChartTypeCommand(no(T,h)),{transient:!0})},w=T=>{const P=Sn.find(N=>N.name===T);P!==void 0&&A(yn(P,S?m:null))},I=Sn.map(({name:T,arrangements:[P]})=>({value:T,label:o(`editor.graphTypes.${T}`),icon:(0,n.jsx)(P.icon,{size:"md"}),disabled:!to(P.summary,e)}));return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(k,{label:o("editor.overlayMenu.chartType"),children:b===void 0?(0,n.jsx)(a,{label:x,expanded:s,onClick:L}):(0,n.jsx)(a,{variant:"icon",icon:(0,n.jsx)(b,{size:"sm"}),ariaLabel:x,expanded:s,onClick:L})}),s&&(0,n.jsx)(k,{layout:"stack",children:(0,n.jsx)("div",{ref:d,className:"_1hrfeju0",children:(0,n.jsx)(i,{options:I,value:p?.name??"",onChange:w,onCommit:r.commit,columns:Qc,itemLayout:"swatch",ariaLabel:o("editor.overlayMenu.chartType")})})}),j&&(0,n.jsx)(rd,{type:p,arrangement:m,onPick:A,onCommit:r.commit})]})},oo=(e,t)=>(0,u.isComboChartType)(e)||(0,u.isComboChartType)(t)?(0,u.isComboChartType)(e)&&(0,u.isComboChartType)(t):e.coordType==="polar"?Oe(e)===Oe(t):e.coordType===t.coordType&&e.geom===t.geom,ao=Jc.flatMap(([e,t])=>{const r=me.find(o=>o.name===t);return r===void 0?[]:[{name:e,arrangements:[r,...[...me,...Yc].filter(o=>o!==r&&oo(r.summary,o.summary))]}]}),Sn=ao.filter(({name:e})=>e!=="combo"),rd=({type:e,arrangement:t,onPick:r,onCommit:o})=>{const a=l.useI18n(),{ToggleGroup:i}=O(),s=e.arrangements.map(({summary:d,icon:h})=>{const p=Ne(d);return{value:p,label:a(`editor.overlayMenu.arrangements.${p}`),icon:(0,n.jsx)(h,{size:"sm"})}}),c=d=>{const h=e.arrangements.find(({summary:p})=>Ne(p)===d);h!==void 0&&r(h)};return(0,n.jsx)(k,{label:a("editor.overlayMenu.arrange"),children:(0,n.jsx)("div",{className:Zc,children:(0,n.jsx)(i,{options:s,value:t,onChange:c,onCommit:o})})})},od=e=>e instanceof Element&&e.closest('[role="radio"]:not([aria-disabled="true"])')!==null,Ne=e=>(0,u.isComboChartType)(e)?td[e.comboType]:ed[e.position],yn=(e,t)=>e.arrangements.find(({summary:r})=>Ne(r)===t)??e.arrangements[0],ad=e=>ao.find(({arrangements:[t]})=>oo(t.summary,e)),io=({lineStyle:e,...t})=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 18 18",...t,children:[e==="solid"&&(0,n.jsx)("path",{d:"M2 9h14",stroke:"currentColor",strokeWidth:2}),e==="dashed"&&(0,n.jsx)("path",{d:"M1 9h4m2 0h4m2 0h4",stroke:"currentColor",strokeWidth:2}),e==="dotted"&&(0,n.jsxs)("g",{fill:"currentColor",children:[(0,n.jsx)("circle",{cx:2.4,cy:9,r:1.4}),(0,n.jsx)("circle",{cx:9,cy:9,r:1.4}),(0,n.jsx)("circle",{cx:15.6,cy:9,r:1.4})]})]}),so=({lineWidth:e,...t})=>(0,n.jsx)(l.Icon,{viewBox:"0 0 18 18",...t,children:(0,n.jsx)("path",{d:"M2 9h14",stroke:"currentColor",strokeWidth:e})}),id={small:2,medium:3.8,large:5.6},sd=({pointSize:e,...t})=>(0,n.jsx)(l.Icon,{viewBox:"0 0 18 18",...t,children:(0,n.jsx)("circle",{cx:9,cy:9,r:id[e],fill:"currentColor"})}),Cn=["solid","dashed","dotted"],ot=[{name:"thin",widthPx:1},{name:"medium",widthPx:2},{name:"thick",widthPx:4}],at=[{name:"small",sizePx:6},{name:"medium",sizePx:8},{name:"large",sizePx:10}],lo=({widthPx:e,onChange:t})=>{const r=l.useI18n(),{ToggleGroup:o}=O(),a=i=>{const s=ot.find(({name:c})=>c===i);s!==void 0&&t(s.widthPx)};return(0,n.jsx)(k,{label:r("editor.graphPanel.lineThickness.label"),children:(0,n.jsx)(o,{value:ot.find(i=>i.widthPx===e)?.name??"",options:ot.map(({name:i,widthPx:s})=>({value:i,label:r(`editor.graphPanel.gridSection.lineWidths.${i}`),icon:(0,n.jsx)(so,{lineWidth:s})})),onChange:a})})},co=({lineStyle:e,onChange:t})=>{const r=l.useI18n(),{ToggleGroup:o}=O(),a=i=>{const s=Cn.find(c=>c===i);s!==void 0&&t(s)};return(0,n.jsx)(k,{label:r("editor.fineTunePanel.lineStyleSection.title"),children:(0,n.jsx)(o,{value:e??"",options:Cn.map(i=>({value:i,label:r(`editor.graphPanel.gridSection.lineStyles.${i}`),icon:(0,n.jsx)(io,{lineStyle:i})})),onChange:a})})},uo=({sizePx:e,onChange:t})=>{const r=l.useI18n(),{ToggleGroup:o}=O(),a=i=>{const s=at.find(({name:c})=>c===i);s!==void 0&&t(s.sizePx)};return(0,n.jsx)(k,{label:r("editor.graphPanel.pointSize.label"),children:(0,n.jsx)(o,{value:at.find(i=>i.sizePx===e)?.name??"",options:at.map(({name:i})=>({value:i,label:r(`editor.graphPanel.pointSize.sizes.${i}`),icon:(0,n.jsx)(sd,{pointSize:i})})),onChange:a})})},ho=(0,v.createContext)({}),ld=ho.Provider,cd=()=>(0,v.useContext)(ho),dd="_1m2a0t20",St="theme",ud=3,je=14,jn=9,hd=()=>{const e=l.useSceneSelector(p=>p.scales.color),t=cd(),r=l.useGraphCommands(),o=l.useI18n(),{RadioGrid:a}=O();if(Object.keys(t).length===0||e?.kind!=="visual"||e.spec.scaleType!=="discrete"||e.defaultPalette===void 0)return null;const{defaultPalette:i,spec:s}=e,c=Object.entries(t),d=[{value:St,label:o("editor.overlayMenu.themePalette"),icon:(0,n.jsx)(wn,{colors:i})},...c.map(([p,m])=>({value:yt(p),label:p,icon:(0,n.jsx)(wn,{colors:m})}))],h=p=>{const m=c.find(([f])=>yt(f)===p);if(p!==St&&m===void 0)return;const g=m===void 0?null:[...m[1]];r.dispatch(new u.SetScaleRangeCommand({scaledAesthetic:"color",range:g}),{transient:!0})};return(0,n.jsx)(k,{label:o("editor.overlayMenu.palette"),layout:"stack",children:(0,n.jsx)(a,{options:d,value:pd(s.range,c),onChange:h,onCommit:r.commit,columns:4,itemLayout:"track"})})},yt=e=>`preset:${e}`,pd=(e,t)=>{if(e===null)return St;const r=t.find(([,o])=>(0,ne.isEqual)(o,e));return r===void 0?"":yt(r[0])},wn=({colors:e})=>{const t=e.slice(0,ud),r=je/2,o=je+(t.length-1)*jn;return(0,n.jsx)("svg",{width:o,height:je,viewBox:`0 0 ${o} ${je}`,"aria-hidden":"true",children:t.map((a,i)=>(0,n.jsx)("circle",{className:dd,cx:r+i*jn,cy:r,r:r-.5,fill:a},i)).reverse()})},Tn=["smooth","linear"],po=()=>{const e=l.useSceneSelector(C=>C),t=l.useStyleReaderTree(),r=l.useDataLabelPlacementResolver(),o=l.useGraphCommands(),a=l.useI18n(),{Switch:i,ToggleGroup:s}=O(),c=mo(e.layers,e.coordSystem.type,r),d=C=>c.filter(({support:y})=>C(y)).map(({layer:y})=>y),h=md(e,t),p=h.filter(C=>C.smooth!==null),m=h.filter(C=>C.missingValues!==null&&C.missingValueOptions.length>1),g=bt.filter(C=>m.some(y=>y.missingValueOptions.includes(C))),f=fd(p),x=bd(m),b=C=>{o.dispatch(new u.SequenceCommand({commands:h.map(y=>new u.ToggleLinePointsCommand({layerId:y.layerId,showPoints:C}))}))},S=C=>{const y=Tn.find(M=>M===C);y!==void 0&&o.dispatch(new u.SequenceCommand({commands:p.map(M=>new u.SetLineCurveCommand({layerId:M.layerId,curve:y}))}))},j=C=>{const y=bt.find(D=>D===C);if(y===void 0)return;const M=m.filter(D=>D.missingValueOptions.includes(y)).map(D=>new u.SetLineMissingValuesCommand({layerId:D.layerId,missingValues:y}));M.length!==0&&o.dispatch(new u.SequenceCommand({commands:M}))},L=h.filter(C=>C.showFill!==null),A=h.filter(C=>C.showPoints),w=gd(e,t,h),I=L.some(C=>vd(e,C)),T=C=>{C.length>0&&o.dispatch(new u.SequenceCommand({commands:C}))},P=C=>{T(h.map(y=>new u.SetLineStyleCommand({layerId:y.layerId,strokeWidth:C})))},N=C=>{T(h.map(y=>new u.SetLineStyleCommand({layerId:y.layerId,lineStyle:C})))},V=C=>{T(L.map(y=>new u.SetLineStyleCommand({layerId:y.layerId,showFill:C,drawnFillAlpha:y.drawnFillAlpha})))},R=C=>{T(A.flatMap(({pointLayerId:y})=>y===null?[]:[new u.SetPointSizeCommand({layerId:y,size:C})]))};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(nd,{}),(0,n.jsx)(we,{label:a("editor.graphPanel.graphOptions.dataLabels"),layers:d(C=>C.supportsDataLabels),isOn:C=>C.showDataLabels,buildCommand:(C,y)=>new u.ToggleDataLabelsCommand({layerId:C,showDataLabels:y})}),(0,n.jsx)(we,{label:a("editor.graphPanel.graphOptions.showPercentages"),layers:d(C=>C.supportsPercentages),isOn:C=>C.format==="percentage",buildCommand:(C,y)=>new u.SetDataLabelsFormatCommand({layerId:C,format:y?"percentage":"absolute"})}),(0,n.jsx)(we,{label:a("editor.graphPanel.graphOptions.stackTotals"),layers:d(C=>C.supportsStackTotals),isOn:C=>C.showStackTotals,buildCommand:(C,y)=>new u.ToggleStackTotalsCommand({layerId:C,showStackTotals:y})}),(0,n.jsx)(we,{label:a("editor.graphPanel.graphOptions.categoryLabels"),layers:d(C=>C.supportsCategoryLabels),isOn:C=>C.showCategoryLabels,buildCommand:(C,y)=>new u.ToggleCategoryLabelsCommand({layerId:C,showCategoryLabels:y})}),p.length>0&&(0,n.jsx)(k,{label:a("editor.graphPanel.graphOptions.smoothLines"),children:(0,n.jsx)(s,{value:f,options:Tn.map(C=>({value:C,label:a(`editor.graphPanel.graphOptions.curves.${C}`),icon:(0,n.jsx)(fc,{curve:C})})),onChange:S})}),g.length>1&&(0,n.jsx)(k,{label:a("editor.fineTunePanel.detailSection.missingValues"),children:(0,n.jsx)(s,{value:x,options:g.map(C=>({value:C,label:Qr(a,C),icon:(0,n.jsx)(Sc,{missingValues:C})})),onChange:j})}),h.length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(lo,{widthPx:it(w.map(C=>C.strokeWidth)),onChange:P}),(0,n.jsx)(co,{lineStyle:it(w.map(C=>C.lineStyle)),onChange:N})]}),L.length>0&&(0,n.jsx)(k,{label:a("editor.graphPanel.graphOptions.lineFill"),children:(0,n.jsx)(i,{checked:I,onChange:V})}),h.length>0&&(0,n.jsx)(k,{label:a("editor.graphPanel.graphOptions.showPoints"),children:(0,n.jsx)(i,{checked:A.length>0,onChange:b})}),A.length>0&&(0,n.jsx)(uo,{sizePx:it(xd(e,t,A)),onChange:R}),(0,n.jsx)(hd,{})]})};po.hasRows=(e,{scene:t,dataLabelPlacement:r})=>(0,u.readChartType)(t.spec)!==null||mo(t.layers,t.coordSystem.type,r).some(({support:o})=>o.supportsDataLabels)||t.spec.layers.some(o=>o.interactive&&(0,u.isLayerSpecOf)(o,"line","area"));var mo=(e,t,r)=>e.filter(o=>o.interactive).map(o=>({layer:o,support:Jr(o,t,r)})),md=(e,t)=>{const r=[];for(const o of e.spec.layers){if(!o.interactive)continue;const a=Ht(e,t,o.id);a!==null&&r.push(a)}return r},gd=(e,t,r)=>r.flatMap(o=>{const a=(0,u.findLayerById)(e.layers,o.layerId);if(a?.geom==="line"){const s=t.geom.line(a);return Array.from(a.data,c=>({strokeWidth:s.get("strokeWidth",c),lineStyle:(0,u.toDashPreset)(s.get("dashArray",c))}))}if(a?.geom!=="area")return[];const i=t.geom.area(a);return Array.from(a.data,s=>({strokeWidth:i.get("strokeWidth",s),lineStyle:(0,u.toDashPreset)(i.get("dashArray",s))}))}),vd=(e,t)=>{if(t.showFill===!0)return!0;const r=(0,u.buildLayerStyleAddress)("line",t.layerId),o=(0,u.readStyleCoord)(e.spec);return e.spec.styles.overrides.some(a=>!(0,u.isGeomStyleRule)(a)||a.when?.where===void 0?!1:(0,u.createStyleRuleMatcher)({...r,when:a.when},o)(a)&&"fillAlpha"in a.declarations&&(a.declarations.fillAlpha??0)>0)},xd=(e,t,r)=>r.flatMap(o=>{const a=o.pointLayerId===null?void 0:(0,u.findLayerById)(e.layers,o.pointLayerId);if(a?.geom!=="point")return[];const i=t.geom.point(a);return Array.from(a.data,s=>i.get("size",s)).filter(s=>s>0)}),it=e=>{const[t]=e;return t!==void 0&&e.every(r=>r===t)?t:null},fd=e=>e.every(t=>t.smooth===!0)?"smooth":e.every(t=>t.smooth!==!0)?"linear":"",bd=e=>{const[t,...r]=e,o=t?.missingValues??null;return o===null?"":r.every(a=>a.missingValues===o)?o:""},we=({label:e,layers:t,isOn:r,buildCommand:o})=>{const a=l.useGraphCommands(),{Switch:i}=O();if(t.length===0)return null;const s=c=>{a.dispatch(new u.SequenceCommand({commands:t.map(d=>o(d.id,c))}))};return(0,n.jsx)(k,{label:e,children:(0,n.jsx)(i,{checked:t.some(c=>r(c.dataLabels)),onChange:s})})},Sd=(e,t)=>{const r=(0,u.findLayerById)(t.layers,e);if(r===void 0)return null;const o=(0,u.findLayerById)(t.spec.layers,e),a=o===void 0?null:(0,u.findHostLayer)(o,t.spec.layers),i=a!==null&&a.id!==r.id?a:r;return{geom:i.geom,coord:t.spec.coords.coordType,position:i.position}},he=(e,t)=>{for(const r of e){const o=t(r);if(o!==void 0)return o}return null},yd=({geom:e,coord:t,position:r},o)=>he(o,a=>{const i=An(a.layers,e)?.[t]?.[r];return i!==void 0?i:An(a.geoms,e)}),An=(e,t)=>e!==void 0&&Object.hasOwn(e,t)?e[t]:void 0,De=["solid","dashed","dotted"];var go=e=>e.scaleAestheticKey==="x"||e.scaleAestheticKey==="y",vo=(e,t)=>{const r=e.guides.axes.filter(go);if(r.length===0)return null;const o=t.gridLine.y().resolve();return{axes:r,stylable:e.coordSystem.type!=="polar",lineStyle:(0,u.toDashPreset)(o.dashArray),strokeWidth:o.strokeWidth}},Cd=(e,t)=>{if(e==="both")return t.axes.every(o=>!o.showGrid);const r=t.axes.find(o=>o.scaleAestheticKey===e);return r===void 0||!r.showGrid},xo=(e,t="both")=>new u.SetGridLineStyleCommand({axis:t,lineStyle:e}),fo=(e,t="both")=>new u.SetGridLineStyleCommand({axis:t,strokeWidth:e}),st=[{name:"thin",widthPx:1},{name:"medium",widthPx:2},{name:"thick",widthPx:4}],bo=({target:e})=>{const t=l.useSceneSelector(S=>S),r=l.useStyleReaderTree(),o=vo(t,r),a=l.useI18n(),i=l.useGraphCommands(),{ToggleGroup:s}=O();if(o===null||!o.stylable)return null;const c=e.axis==="both"?"y":e.axis,d=r.gridLine[c]().resolve(),h=(0,u.toDashPreset)(d.dashArray),p=Cd(e.axis,o),m=De.map(S=>({value:S,label:a(`editor.graphPanel.gridSection.lineStyles.${S}`),icon:(0,n.jsx)(io,{lineStyle:S})})),g=st.map(({name:S,widthPx:j})=>({value:S,label:a(`editor.graphPanel.gridSection.lineWidths.${S}`),icon:(0,n.jsx)(so,{lineWidth:j})})),f=st.find(({widthPx:S})=>S===d.strokeWidth)?.name??"",x=S=>{const j=De.find(L=>L===S);j!==void 0&&i.dispatch(xo(j,e.axis))},b=S=>{const j=st.find(({name:L})=>L===S);j!==void 0&&i.dispatch(fo(j.widthPx,e.axis))};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(k,{label:a("editor.graphPanel.gridSection.gridStyle"),children:(0,n.jsx)(s,{value:h,options:m,onChange:x,disabled:p})}),(0,n.jsx)(k,{label:a("editor.graphPanel.gridSection.gridThickness"),children:(0,n.jsx)(s,{value:f,options:g,onChange:b,disabled:p})})]})};bo.hasRows=(e,{scene:t})=>{if(t.coordSystem.type==="polar")return!1;const r=t.guides.axes.filter(go);return r.length===0?!1:e.axis==="both"?!0:r.some(o=>o.scaleAestheticKey===e.axis)};var kn=[{position:"top",align:"start",gridRow:1,gridColumn:1},{position:"top",align:"center",gridRow:1,gridColumn:2},{position:"top",align:"end",gridRow:1,gridColumn:3},{position:"right",align:"center",gridRow:2,gridColumn:3},{position:"bottom",align:"end",gridRow:3,gridColumn:3},{position:"bottom",align:"center",gridRow:3,gridColumn:2},{position:"bottom",align:"start",gridRow:3,gridColumn:1},{position:"left",align:"center",gridRow:2,gridColumn:1}],jd={start:"Start",center:"Center",end:"End"},wd=()=>{const e=l.useSceneSelector(d=>d.guides.legends.drawn[0]),t=l.useGraphCommands(),r=l.useI18n(),{RadioGrid:o}=O(),a=e===void 0,i=a?"":lt(e),s=kn.map(d=>{const h=lt(d);return{value:h,label:r(`editor.overlayMenu.legendPlaces.${h}`),icon:(0,n.jsx)(l.ArrowIcon,{title:"",size:"xs",style:{transform:`rotate(${Td(d)}deg)`}}),gridRow:d.gridRow,gridColumn:d.gridColumn}}),c=d=>{const h=kn.find(p=>lt(p)===d);h!==void 0&&t.dispatch(new u.SetLegendPlacementCommand({position:h.position,align:h.align}),{transient:!0})};return(0,n.jsx)(k,{label:r("editor.axesPanel.controls.position"),children:(0,n.jsx)(Mt.DirectionProvider,{direction:"ltr",children:(0,n.jsx)("div",{dir:"ltr",children:(0,n.jsx)(o,{options:s,value:i,onChange:c,onCommit:t.commit,columns:3,itemLayout:"icon",disabled:a})})})})},lt=({position:e,align:t})=>e==="left"||e==="right"?e:`${e}${jd[t]}`,Td=({gridRow:e,gridColumn:t})=>Math.atan2(t-2,2-e)*180/Math.PI,Ct=({target:e})=>{const t=l.useGraphHandle();return t===null?null:(0,n.jsx)(Ad,{graph:t,target:e})};Ct.hasRows=(e,{scene:t})=>e.scope==="series"&&So(t,e.layerId)!==null;var Ad=({graph:e,target:t})=>{const r=l.useHandleScene(e),o=l.useStyleReaderTree(),a=l.useI18n(),{Switch:i}=O(),s=r===null?null:So(r,t.layerId),c=r===null||s===null?null:Ht(r,o,s.id);if(r===null||s===null||c===null)return null;const d=Ed(r,t),h=d===void 0?{}:{where:d},p=d===void 0||s.geom!=="line"?void 0:Id(r,c.layerId,d),m=p===void 0?c.showFill:p>0,g=d===void 0?null:kd(r,s.geom,c.layerId,d),f=d===void 0?c.strokeWidth:g??Pd(r,o,t)??c.strokeWidth,x=c.pointLayerId===null?null:Ld(r,o,c.pointLayerId,d),b=x!==null&&x>0,S=T=>{e.commands.dispatch(new u.ToggleLinePointsCommand({layerId:c.layerId,showPoints:T,...h}))},j=T=>{e.commands.dispatch(new u.SetLineStyleCommand({layerId:c.layerId,showFill:T,drawnFillAlpha:c.drawnFillAlpha,...h}))},L=T=>{e.commands.dispatch(new u.SetLineStyleCommand({layerId:c.layerId,strokeWidth:T,...h}))},A=T=>{c.pointLayerId!==null&&e.commands.dispatch(new u.SetPointSizeCommand({layerId:c.pointLayerId,size:T,...h}))},w=T=>{e.commands.dispatch(new u.SetLineStyleCommand({layerId:c.layerId,lineStyle:T,...h}))},I=(0,u.readObservationsColorRoute)(r.spec,t)?.some(T=>T.geomKind==="line"||T.geomKind==="area")===!0;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(xe,{target:t}),(0,n.jsx)(lo,{widthPx:f,onChange:L}),I&&(0,n.jsx)(co,{lineStyle:Md(r,o,t),onChange:w}),c.showFill!==null&&(0,n.jsx)(k,{label:a("editor.graphPanel.graphOptions.lineFill"),children:(0,n.jsx)(i,{checked:m===!0,onChange:j})}),(0,n.jsx)(k,{label:a("editor.graphPanel.graphOptions.showPoints"),children:(0,n.jsx)(i,{checked:b,onChange:S})}),b&&(0,n.jsx)(uo,{sizePx:x,onChange:A})]})},kd=(e,t,r,o)=>{const a=(t==="line"?(0,u.findKindStyleDeclarations)(e.spec.styles.overrides,{...(0,u.buildLayerStyleAddress)("line",r),when:{where:o}},(0,u.readStyleCoord)(e.spec)):(0,u.findKindStyleDeclarations)(e.spec.styles.overrides,{...(0,u.buildLayerStyleAddress)("area",r),when:{where:o}},(0,u.readStyleCoord)(e.spec)))?.strokeWidth;return typeof a=="number"?a:null},Pd=(e,t,r)=>{const o=(0,u.findLayerById)(e.layers,r.layerId),a=o===void 0?void 0:(0,u.findHostLayer)(o,e.layers);if(a?.geom!=="line"&&a?.geom!=="area")return null;const[i]=(0,u.resolveObservationsTarget)({layer:a,target:r,parsingLocale:e.config.parsingLocale}),s=i===void 0?void 0:a.data.getAt(i)??void 0,c=a.geom==="line"?t.geom.line(a).get("strokeWidth",s):t.geom.area(a).get("strokeWidth",s);return typeof c=="number"?c:null},Ld=(e,t,r,o)=>{const a=o===void 0?void 0:(0,u.findKindStyleDeclarations)(e.spec.styles.overrides,{...(0,u.buildLayerStyleAddress)("point",r),when:{where:o}},(0,u.readStyleCoord)(e.spec))?.size;if(typeof a=="number")return a;const i=(0,u.findLayerById)(e.layers,r);return i?.geom==="point"?t.geom.point(i).get("size"):u.DEFAULT_POINT_SIZE_PX},Id=(e,t,r)=>{const o=(0,u.findKindStyleDeclarations)(e.spec.styles.overrides,{...(0,u.buildLayerStyleAddress)("line",t),when:{where:r}},(0,u.readStyleCoord)(e.spec))?.fillAlpha;return typeof o=="number"?o:void 0},Ed=(e,t)=>(0,u.readObservationsColorRoute)(e.spec,t)?.find(r=>r.geomKind==="line"||r.geomKind==="area")?.where,Md=(e,t,r)=>{const o=(0,u.findLayerById)(e.layers,r.layerId),a=o===void 0?void 0:(0,u.findHostLayer)(o,e.layers);if(a?.geom!=="line"&&a?.geom!=="area")return"solid";const[i]=(0,u.resolveObservationsTarget)({layer:a,target:r,parsingLocale:e.config.parsingLocale}),s=i===void 0?null:a.data.getAt(i);return(0,u.toDashPreset)(a.geom==="line"?t.geom.line(a).get("dashArray",s??void 0):t.geom.area(a).get("dashArray",s??void 0))},So=(e,t)=>{const r=(0,u.findLayerById)(e.spec.layers,t);if(r===void 0)return null;const o=(0,u.findHostLayer)(r,e.spec.layers);return(0,u.isLayerSpecOf)(o,"line","area")?o:null},yo={geoms:{point:xe,line:Ct,area:Ct,bar:Yr,rule:null,tile:null},legend:wd,axis:Xr,grid:bo,graph:po},Vt=(0,v.createContext)([yo]),Rd=({editMenus:e,children:t})=>{const r=(0,v.useMemo)(()=>[e??{},yo],[e]);return(0,n.jsx)(Vt.Provider,{value:r,children:t})},Od=e=>{const t=(0,v.useContext)(Vt),r=l.useSceneSelector(a=>a),o=l.useDataLabelPlacementResolver();return(0,v.useMemo)(()=>e===null?null:Co(e,t,{scene:r,dataLabelPlacement:o}),[e,t,r,o])},_d=()=>{const e=(0,v.useContext)(Vt),{store:t}=l.useGraphContext(),r=l.useDataLabelPlacementResolver();return(0,v.useCallback)(o=>Co(o,e,{scene:t.getState().scene,dataLabelPlacement:r})!==null,[e,t,r])},Co=(e,t,r)=>{switch(e.kind){case"observations":{const o=Sd(e.layerId,r.scene),a=o===null?null:yd(o,t);return a===null||a.hasRows?.(e,r)===!1?null:(0,n.jsx)(a,{target:e})}case"legend":{const o=he(t,a=>a.legend);return o===null||o.hasRows?.(e,r)===!1?null:(0,n.jsx)(o,{target:e})}case"axis":{const o=he(t,a=>a.axis);return o===null||o.hasRows?.(e,r)===!1?null:(0,n.jsx)(o,{target:e})}case"grid":{const o=he(t,a=>a.grid);return o===null||o.hasRows?.(e,r)===!1?null:(0,n.jsx)(o,{target:e})}case"graph":{const o=he(t,a=>a.graph);return o===null||o.hasRows?.(e,r)===!1?null:(0,n.jsx)(o,{target:e})}default:return e}},jo=(e,t)=>{const{config:r,guides:o}=t;switch(e.kind){case"legend":{const{position:a}=r.legend,i=a==="none";return{hidden:i,hide:new u.SetLegendPositionCommand({position:"none"}),show:new u.SetLegendPositionCommand({position:i?"auto":a})}}case"axis":{const{axis:a}=e,i=a==="ySecondary"?o.axes.find(s=>s.scaleAestheticKey==="ySecondary")?.visible:r.axes[a].visible;return i===void 0?null:{hidden:!i,hide:new u.SetAxisVisibilityCommand({axis:a,visible:!1,keepSecondaryAxis:!0}),show:new u.SetAxisVisibilityCommand({axis:a,visible:!0,keepSecondaryAxis:!0})}}case"grid":{const{axis:a}=e;if(a==="both")return null;const{visible:i}=r.axes[a].grid,s=i===!1;return{hidden:s,hide:new u.SetGridVisibilityCommand({axis:a,visible:!1}),show:new u.SetGridVisibilityCommand({axis:a,visible:s?!0:i})}}case"observations":case"graph":return null;default:return e}},qe=()=>{const e=_d(),{store:t}=l.useGraphContext();return(0,v.useCallback)(r=>e(r)||jo(r,t.getState().scene)!==null,[e,t])};var Pn=(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,u.areEditTargetsEqual)(e.target,t.target):e.kind==="graph"&&t.kind==="graph"},Nd=(e,t)=>{const r=Math.max(e.width,8),o=Math.max(e.height,8),a=Math.max(0,e.x+e.width/2-r/2),i=Math.max(0,e.y+e.height/2-o/2),s=Math.min(t.width,e.x+e.width/2+r/2),c=Math.min(t.height,e.y+e.height/2+o/2);return{x:a,y:i,width:Math.max(0,s-a),height:Math.max(0,c-i)}},Dd=[],Fd=e=>{const{layers:t,parsingLocale:r}=l.useSceneSelector((0,J.useShallow)(g=>({layers:g.layers,parsingLocale:g.config.parsingLocale}))),o=l.useEditorState(g=>g.editTargetUnderPointer),a=o?.kind==="observations"?o.observations:null,i=a===null?void 0:(0,u.findLayerById)(t,a.layerId),s=a?.target.scope??null,c=a===null||i===void 0?null:(0,u.readRowScopeKey)(i,a.target.scope,a.observationIndex),d=(0,v.useMemo)(()=>i===void 0||s===null||c===null?null:Bd(t,i,s,c),[t,i,s,c]),h=(0,v.useMemo)(()=>d!==null&&e!==null&&Pn(d,e),[d,e]),p=qe(),m=a!==null&&i!==void 0&&zd(a,i,r,p)?a.observationIndex:null;return(0,v.useMemo)(()=>{switch(o?.kind){case"observations":{const g=d?.parts[0];if(d===null||g===void 0)return null;const f=m===null?null:{layer:g.layer,rows:[m]};return h?f===null?null:{...d,parts:Dd,vertex:f}:{...d,vertex:f}}case"axis":case"legend":case"grid":{const g={kind:"guide",key:(0,u.readEditTargetKey)(o.target),target:o.target};return e!==null&&Pn(g,e)?null:g}default:return null}},[o,d,h,m,e])},Bd=(e,t,r,o)=>{const a=[{layer:t,rows:(0,u.readRowsAtScopeKey)(t,r,o)}];for(const i of(0,u.findCompanionLayers)(t,e)){const s=(0,u.readCompanionRowsAtScopeKey)(i,t,r,o);s.length>0&&a.push({layer:i,rows:s})}return{kind:"observations",key:JSON.stringify([t.id,r,o]),layerId:t.id,scope:r,parts:a,vertex:null}},zd=({observationIndex:e,target:t,onObservation:r},o,a,i)=>{if(!r||t.scope!=="series")return!1;const s=(0,u.buildObservationsTarget)({layer:o,observationIndex:e,scope:"data-point",parsingLocale:a});return s!==null&&i(s)},Gd=({frameElement:e,target:t,coordType:r,legendDisplays:o})=>{const a=e.getBoundingClientRect(),i=[...e.querySelectorAll(Hd(t))],s=c=>{const d=c.getBoundingClientRect();return{x:d.left-a.left,y:d.top-a.top,width:d.width,height:d.height}};switch(t.kind){case"axis":{const c=i.map(s);return r==="polar"||c.length===0?ct(c):ct([(0,u.getBoundingRect)(c)])}case"legend":return ct([...Vd(i.filter(c=>!Wd(c)))].flatMap(([c,d])=>o[c]==="direct"?d.map(s):[(0,u.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?[$d(c,s(c),h)]:[]})}},Hd=e=>{const t=`[${l.EDIT_TARGET_KIND_ATTRIBUTE}="${e.kind}"]`;return e.kind!=="axis"?t:`${t}[${l.EDIT_TARGET_AXIS_ATTRIBUTE}="${e.axis}"]`},Vd=e=>{const t=new Map;for(const r of e){const o=l.readLegendItemAddress(r);o!==null&&t.set(o.legendIndex,[...t.get(o.legendIndex)??[],r])}return t},Wd=e=>e.closest(l.LEGEND_OVERFLOW_CONTROL_SELECTOR)!==null,ct=e=>e.map(t=>({kind:"box",rect:t})),$d=(e,{x:t,y:r,width:o,height:a},i)=>e.querySelector("circle")!==null?{kind:"ring",axis:i,center:{x:t+o/2,y:r+a/2},radius:o/2}:o<1||a<1?o<a?{kind:"line",axis:i,from:{x:t+o/2,y:r},to:{x:t+o/2,y:r+a}}:{kind:"line",axis:i,from:{x:t,y:r+a/2},to:{x:t+o,y:r+a/2}}:Ud(e.querySelector("line"))?{kind:"line",axis:i,from:{x:t,y:r},to:{x:t+o,y:r+a}}:{kind:"line",axis:i,from:{x:t,y:r+a},to:{x:t+o,y:r}},Ud=e=>{const t=r=>Number(e?.getAttribute(r)??0);return(t("x2")-t("x1"))*(t("y2")-t("y1"))>=0},qd=[],Kd=(e,{frameElement:t,frameSize:r,panelRect:o,animateTransitions:a})=>{const i=l.useSceneSelector(b=>b.coordSystem),s=l.useGeomRendererResolver(),c=l.useGeomReaderTree(),d=Zd(e.kind==="guide"?e.target:null,{frameElement:t,frameSize:r}),h=Xd(t,r),p=(0,v.useMemo)(()=>({coordSystem:i,panelRect:o,resolveRenderer:s,geomReaders:c}),[i,o,s,c]),m=e.kind==="observations"?e.parts:null,g=e.kind==="observations"?e.vertex:null,f=(0,v.useMemo)(()=>m?.map(b=>Ln(b,p,a))??qd,[m,p,a]),x=(0,v.useMemo)(()=>g===null?null:Ln(g,p,!1),[g,p]);return(0,v.useMemo)(()=>{switch(e.kind){case"observations":return{kind:"observations",parts:f,vertex:x};case"guide":return{kind:"guide",target:e.target,shapes:d};case"graph":return{kind:"graph",frameSize:h}}},[e,f,x,d,h])},Xd=(e,t)=>{const[r,o]=(0,v.useState)(()=>mn(e,t));return(0,v.useLayoutEffect)(()=>{o(a=>{const i=mn(e,{width:t.width,height:t.height});return a.width===i.width&&a.height===i.height?a:i})},[e,t.width,t.height]),r},Ln=({layer:e,rows:t},{coordSystem:r,panelRect:o,resolveRenderer:a,geomReaders:i},s)=>{const c={...e,data:e.data.take(t)},d=a(e.geom,r.type);return d?.getEditOutlineShapes===void 0?{kind:"boxes",layer:e,rows:t,boxes:(0,u.measureObservationsBoxes)({layer:c,coordSystem:r,panelSize:o}).map(h=>Nd(h,o))}:{kind:"declared",layer:e,rows:t,shapes:d.getEditOutlineShapes({layer:c,sourceLayer:e,coordSystem:r,panelRect:o,styleReaders:i(e),animateTransitions:s})}},Zd=(e,{frameElement:t,frameSize:r})=>{const o=l.useSceneSelector(p=>p.coordSystem.type),a=l.useSceneSelector((0,J.useShallow)(p=>p.guides.legends.drawn.map(m=>m.display))),i=l.useSceneSelector(p=>e===null?null:p),[s,c]=(0,v.useState)([]),d=l.useLatestRef(e),h=(0,v.useRef)(!1);return(0,v.useLayoutEffect)(()=>{const p=d.current;if(p===null)return;const m=()=>{const g=Gd({frameElement:t,target:p,coordType:o,legendDisplays:a}),f=qr(t);c(g.map(x=>Yd(x,1/f)))};if(h.current){const g=requestAnimationFrame(m);return()=>cancelAnimationFrame(g)}h.current=!0,m()},[t,d,o,a,i,r.width,r.height]),s},Yd=(e,t)=>{switch(e.kind){case"box":{const{x:r,y:o,width:a,height:i}=e.rect;return{kind:"box",rect:{x:r*t,y:o*t,width:a*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}}},Jd=()=>{const e=l.useGraphSelection()[0]??null,{layers:t,parsingLocale:r}=l.useSceneSelector((0,J.useShallow)(o=>({layers:o.layers,parsingLocale:o.config.parsingLocale})));return(0,v.useMemo)(()=>e===null?null:Qd(e,t,r),[e,t,r])},Qd=(e,t,r)=>{switch(e.kind){case"observations":{const o=eu(e,t,r);return o===null?null:{outlined:o,target:e}}case"legend":case"axis":case"grid":return{outlined:{kind:"guide",key:(0,u.readEditTargetKey)(e),target:e},target:e};case"graph":return{outlined:{kind:"graph",key:"graph"},target:e};default:return null}},eu=(e,t,r)=>{const o=(0,u.findLayerById)(t,e.layerId);if(o===void 0)return null;const a=(0,u.resolveObservationsTarget)({layer:o,target:e,parsingLocale:r});if(a.length===0)return null;const i=[{layer:o,rows:a}];for(const s of(0,u.findCompanionLayers)(o,t)){const c=(0,u.resolveObservationsTarget)({layer:s,host:o,target:e,parsingLocale:r});c.length>0&&i.push({layer:s,rows:c})}return{kind:"observations",key:(0,u.readEditTargetKey)(e),layerId:e.layerId,scope:e.scope,parts:i,vertex:null}},tu=["x","y"],nu=(0,v.memo)(function({frameElement:t,frameSize:r,panelRect:o,animateTransitions:a}){const i=l.useResolvedStyle(u.resolveEditOutlineStyle,l.useStyleReaderTree()),s=Jd(),c=Fd(s?.outlined??null);if(s===null&&c===null)return null;const d={frameElement:t,frameSize:r,panelRect:o,animateTransitions:a};return(0,n.jsxs)("svg",{className:ec,width:r.width,height:r.height,"aria-hidden":!0,"data-testid":"edit-outline",children:[c!==null&&(0,n.jsx)(In,{part:"hover",target:c,look:i.hover,...d},c.key),s!==null&&(0,n.jsx)(In,{part:"selected",target:s.outlined,editTarget:s.target,look:i.selected,...d},s.outlined.key)]})}),In=({part:e,target:t,editTarget:r,look:o,frameSize:a,panelRect:i,frameElement:s,animateTransitions:c})=>{const d=(0,v.useId)(),h=`${d}-shapes`,p=`${d}-hole`,m=Kd(t,{frameElement:s,frameSize:a,panelRect:i,animateTransitions:c});return Ql(r===void 0?null:{target:r,outline:m},{frameElement:s,panelRect:i,look:o}),(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:tc,children:(0,n.jsx)(lu,{outline:m,look:o,panelRect:i})}),(0,n.jsxs)("mask",{id:p,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:ru(o.offset)})]})]}),(0,n.jsxs)("g",{mask:`url(#${p})`,"data-testid":`edit-outline-${e}-ring`,children:[(0,n.jsx)("use",{href:`#${h}`,style:ou(o)}),(0,n.jsx)("use",{href:`#${h}`,style:au(o)})]}),t.kind==="observations"&&(0,n.jsx)(mu,{target:t,look:o,panelRect:i})]})},ru=e=>({fill:"black",stroke:"black",strokeLinecap:"round",...(0,Y.assignInlineVars)({[Gt]:`${2*e}px`})}),ou=e=>({fill:"none",stroke:e.haloColor??l.vars.graphBackground,strokeLinecap:"round",opacity:e.haloAlpha,...(0,Y.assignInlineVars)({[Gt]:`${2*ve(e)}px`})}),au=e=>{const t=(0,u.toStrokeDasharray)(e.dashArray,e.strokeWidth);return{fill:"none",stroke:e.stroke,strokeDasharray:t,strokeLinecap:t===void 0?"round":"butt",opacity:e.strokeAlpha,...(0,Y.assignInlineVars)({[Gt]:`${2*ve(e)}px`})}},iu=({dashArray:e,strokeWidth:t})=>{if((0,u.toStrokeDasharray)(e,t)===void 0)return;const r=(e.length%2===0?1:2)*e.reduce((o,a)=>o+a*t,0);return r>0?r:void 0},wo=(e,t,r=1)=>{if(!(t===void 0||e<=0))return r*Math.max(1,Math.round(2*Math.PI*e/t))*t},su=(e,t,r)=>{const o=r.offset+ve(r);return l.buildRoundedRectPath(l.growRect({x:0,y:0,...e},-o),Math.max(0,t-o))},lu=({outline:e,look:t,panelRect:r})=>{const o=l.useStyleReaderTree().graph().get("cornerRadius"),{cornerRadius:a}=t,i=iu(t);switch(e.kind){case"observations":return(0,n.jsxs)("g",{transform:`translate(${r.x} ${r.y})`,children:[e.parts.map(s=>(0,n.jsx)(En,{part:s,borderRadius:a,dashPeriod:i},s.layer.id)),e.vertex!==null&&(0,n.jsx)(En,{part:e.vertex,borderRadius:a,dashPeriod:i},`vertex-${e.vertex.rows.join()}`)]});case"guide":return(0,n.jsx)(uu,{target:e.target,shapes:e.shapes,borderRadius:a,dashPeriod:i});case"graph":return(0,n.jsx)("path",{d:su(e.frameSize,o,t)})}},En=(0,v.memo)(function({part:t,borderRadius:r,dashPeriod:o}){return t.kind==="boxes"?(0,n.jsx)(du,{boxes:t.boxes,borderRadius:r}):(0,n.jsx)(cu,{shapes:t.shapes,layer:t.layer,dashPeriod:o})}),cu=({shapes:e,layer:t,dashPeriod:r})=>e.map((o,a)=>{const i=o.kind==="dots"||o.key===void 0?String(a):`${o.kind}:${o.key}`;switch(o.kind){case"region":return o.pathData===""?null:(0,n.jsx)(xn,{pathData:o.pathData,fillRule:o.fillRule,animateTransitions:o.animateTransitions??!1,source:t,"data-geom":t.geom},i);case"stroke":return o.pathData===""?null:(0,n.jsx)(xn,{pathData:o.pathData,animateTransitions:o.animateTransitions??!1,source:t,"data-geom":t.geom,...Kr(o.width)},i);case"dots":return o.centers.length===0?null:(0,n.jsx)("path",{d:l.buildCirclesPath(o.centers,o.size/2),pathLength:wo(o.size/2,r,o.centers.length),"data-geom":t.geom},i)}}),du=({boxes:e,borderRadius:t})=>{const r=e.map(o=>l.buildRoundedRectPath(o,t)).join("");return r===""?null:(0,n.jsx)("path",{d:r,"data-testid":"edit-outline-boxes"})},uu=({target:e,shapes:t,borderRadius:r,dashPeriod:o})=>{const a=l.useStyleReaderTree();if(e.kind==="grid")return tu.map(s=>{const c=Kr(l.readGridLineStyle(a,s).strokeWidth),d=t.map(p=>hu(p,s)).join(""),h=t.filter(p=>p.kind==="ring"&&p.axis===s);return(0,n.jsxs)(v.Fragment,{children:[d!==""&&(0,n.jsx)("path",{d,...c}),h.map((p,m)=>(0,n.jsx)("path",{d:pu(p),pathLength:wo(p.radius,o),...c},m))]},s)});const i=t.map(s=>s.kind==="box"?l.buildRoundedRectPath(s.rect,r):"").join("");return i===""?null:(0,n.jsx)("path",{d:i})},hu=(e,t)=>e.kind==="line"&&e.axis===t?`M${e.from.x},${e.from.y}L${e.to.x},${e.to.y}`:"",pu=({center:e,radius:t})=>{const r=`${e.x},${e.y-t}`;return`M${r}A${t},${t} 0 0 1 ${`${e.x},${e.y+t}`}A${t},${t} 0 0 1 ${r}`},mu=({target:e,look:t,panelRect:r})=>{const o=l.useSceneSelector(s=>s.coordSystem),a=e.parts[0];if(e.scope!=="x-value"||a===void 0||a.layer.highlight?.strategy!=="overlay-anchor")return null;const i=gu(a);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(o,i,r),stroke:t.stroke,strokeOpacity:t.strokeAlpha,strokeWidth:t.strokeWidth,strokeDasharray:"4 3",strokeLinecap:"round","data-testid":"edit-outline-band-guide"})})},gu=({layer:e,rows:t})=>{for(const r of t){const o=e.data.getAt(r),a=o===null?null:(0,u.getXBand)(o),i=o===null?null:(0,u.getYBand)(o);if(a!==null&&i!==null)return{x:a,y:i}}return null},vu="kwvn4c0",xu="kwvn4c1",To=(e,t)=>({contextElement:e,getBoundingClientRect:()=>{const r=e.getBoundingClientRect(),o=Ur(e,r.width);return new DOMRect(r.left+t.x*o,r.top+t.y*o,t.width*o,t.height*o)}}),fu=({side:e,boundary:t,spans:r,anchor:o,rightToLeft:a})=>{if(!bu(e))return 0;const i=r[e];if(e==="left"||e==="right")return Mn(i.from-t.y,o.height,t.height);const s=a?t.x+t.width-i.to:i.from-t.x;return Mn(s,o.width,t.width)},Ao=()=>{const[e,t]=(0,v.useState)(!1);return(0,v.useEffect)(()=>{t(!0)},[]),e},bu=e=>l.SIDE_KEYS.some(t=>t===e),Mn=(e,t,r)=>r===0?0:e*t/r,Su={x:8,y:8},yu={side:"flip",align:"shift",fallbackAxisSide:"end"},Cu=({frameElement:e,boundary:t,spans:r,clearance:o=Su,onEscape:a,children:i})=>{const s=se(),c=Ao(),[d,h]=(0,v.useState)(null),p=(0,v.useRef)(null),m=(0,v.useCallback)(w=>{p.current=w,h(w)},[]),g=(0,v.useRef)(null);(0,v.useLayoutEffect)(()=>()=>{d?.contains(document.activeElement)&&e.focus({preventScroll:!0})},[d,e]);const{x:f,y:x,width:b,height:S}=t,j=(0,v.useMemo)(()=>({box:{x:f,y:x,width:b,height:S},spans:r}),[f,x,b,S,r]),L=(0,v.useMemo)(()=>To(e,j.box),[e,j]),A=(w,I)=>{w||(I.cancel(),I.reason==="escape-key"&&a())};return(0,n.jsx)(H.Popover.Root,{open:c,modal:!1,onOpenChange:A,children:(0,n.jsx)(H.Popover.Portal,{container:s,children:(0,n.jsx)(Dt,{children:(0,n.jsx)(H.Popover.Positioner,{ref:g,anchor:L,side:"right",align:"start",sideOffset:({side:w})=>w==="top"||w==="bottom"?o.y:o.x,alignOffset:({side:w,anchor:I})=>fu({side:w,boundary:j.box,spans:j.spans,anchor:I,rightToLeft:ju(g.current)}),collisionAvoidance:yu,sticky:!0,className:vu,..._t,children:(0,n.jsx)(H.Popover.Popup,{ref:m,className:xu,initialFocus:p,finalFocus:!1,"data-testid":"anchored-popover",children:i})})})})})},ju=e=>e!==null&&getComputedStyle(e).direction==="rtl",ko=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"})]}),Po=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"})]}),Lo=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"})]}),Wt=e=>(0,v.useMemo)(()=>{if(e===null)return{options:[],findValue:()=>{}};const{parsingLocale:t,numberFormat:r}=e.config,o=e.guides.colorGroups.map(a=>{const i=(0,u.createValueFormatter)({valueFormat:a.valueFormat,locale:t,numberFormat:r}),s=a.value instanceof Date?a.value.getTime():a.value;return{value:s,option:{value:String(s),label:a.label??i(a.value)}}});return{options:o.map(({option:a})=>a),findValue:a=>o.find(i=>i.option.value===a)?.value}},[e]),wu=({scene:e,layer:t,observation:r,groupOptions:o,locale:a,t:i})=>{const s=jt(e,t,r,o);return{"data-point":i(Pu(e,t)),"x-value":i("editor.overlayMenu.allOf",{name:Io(e,t,r,a)}),series:s===null?i("editor.overlayMenu.all"):i("editor.overlayMenu.allOf",{name:s})}},Tu=({scene:e,layer:t,observation:r,groupOptions:o,locale:a,t:i},s)=>{const c=(0,u.getGroupVariables)(t.data,t.mapping),d=Io(e,t,r,a);switch(s){case"data-point":{const h=c.length===0?null:jt(e,t,r,o),p=Au(h,d,i);return{whole:p,value:p}}case"x-value":return Rn((0,u.findAxisGuide)(e.guides,"x")?.label??null,d,i);case"series":{const h=jt(e,t,r,o)??i("editor.overlayMenu.all");return Rn(ku(e,c),h,i)}default:return s}},Au=(e,t,r)=>e===null?t:t===""?e:r("editor.overlayMenu.groupAtBand",{group:e,band:t}),Rn=(e,t,r)=>({whole:e===null||e===""?t:r("editor.overlayMenu.titledValue",{title:e,value:t}),value:t}),ku=(e,t)=>{const[r,...o]=t;return r===void 0||o.length>0?null:e.guides.variableLabels[r]??null},Pu=(e,t)=>{switch(t.geom){case"bar":return e.coordSystem.type==="polar"&&e.coordSystem.bandAxis===null?"editor.overlayMenu.thisSlice":"editor.overlayMenu.thisBar";case"point":return(0,u.readVariableName)(t.mapping.size)===null?"editor.overlayMenu.thisPoint":"editor.overlayMenu.thisBubble";default:return"editor.overlayMenu.thisPoint"}},Io=(e,t,r,o)=>{const a=(0,u.findAxisGuide)(e.guides,"x");return(0,u.createValueFormatter)({valueFormat:a===null?{type:"text"}:(0,u.resolveLayerAxisValueFormat)(a,t.id),locale:o,numberFormat:e.config.numberFormat})((0,u.createXValueReader)(t.data,t.mapping)(r),r)},jt=(e,t,r,o)=>{const a=(0,u.getGroupVariables)(t.data,t.mapping);return a.length===0?Lu(e,t):a.map(i=>Iu(r[i]??null,o)).join(", ")},Lu=(e,t)=>{const r=(0,u.readVariableName)(t.mapping.y),o=r===null?void 0:e.guides.variableLabels[r];return o===void 0||o===""?null:o},Iu=(e,t)=>{const r=String(e instanceof Date?e.getTime():e);return t.options.find(o=>o.value===r)?.label??r},Eu={"data-point":ko,"x-value":Po,series:Lo},Mu=()=>{const{selectionStore:e}=l.useGraphContext(),t=l.useEditorStore(),r=l.useI18n(),o=l.useGraphLocale(),a=l.useSceneSelector(S=>S),i=Wt(a),s=l.useEditorState(S=>S.pressedObservation),c=qe(),d=(0,v.useMemo)(()=>Ru({scene:a,pressed:s,groupOptions:i,locale:o,t:r,hasOverlayMenu:c}),[a,s,i,o,r,c]);if(d===null)return null;const{layer:h,levels:p,names:m}=d,{observationIndex:g,selectedFor:f}=d.pressed,x=p.map(S=>{const j=Eu[S];return{value:S,label:m[S],icon:(0,n.jsx)(j,{})}}),b=S=>{const j=p.find(w=>w===S),{parsingLocale:L}=a.config,A=j===void 0?null:(0,u.buildObservationsTarget)({layer:h,observationIndex:g,scope:j,parsingLocale:L});A!==null&&(t.getState().setPressedObservation({...d.pressed,selectedFor:A}),e.getState().setSelection([A]))};return(0,n.jsx)(Ft,{value:f.scope,options:x,onChange:b,ariaLabel:r("editor.overlayMenu.selection")})},Ru=({scene:e,pressed:t,groupOptions:r,locale:o,t:a,hasOverlayMenu:i})=>{const s=t===null?null:l.findPressedObservation(t,e.layers,e.config.parsingLocale);if(t===null||s===null)return null;const{layer:c,observation:d}=s,{observationIndex:h,selectedFor:p}=t,{parsingLocale:m}=e.config,g=(0,u.readReachableLevels)({layer:c,observationIndex:h,parsingLocale:m,scales:e.scales}).filter(f=>{const x=(0,u.buildObservationsTarget)({layer:c,observationIndex:h,scope:f,parsingLocale:m});return x!==null&&i(x)});return g.length<2||!g.includes(p.scope)?null:{pressed:t,layer:c,levels:g,names:wu({scene:e,layer:c,observation:d,groupOptions:r,locale:o,t:a})}},Ou=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:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"}),(0,n.jsx)("circle",{cx:"12",cy:"12",r:"3"})]})}),_u=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.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"}),(0,n.jsx)("path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242"}),(0,n.jsx)("path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"}),(0,n.jsx)("path",{d:"m2 2 20 20"})]})}),Nu="_1de58rm0",Du=({target:e})=>{const t=l.useI18n(),r=l.useGraphCommands(),o=l.useSceneSelector(f=>f),[a,i]=(0,v.useState)(null),s=jo(e,o);if(s===null)return null;const{hidden:c,hide:d,show:h}=s,p=()=>{if(c){r.dispatch(a??h);return}i(h),r.dispatch(d)},m=t(c?"editor.overlayMenu.show":"editor.overlayMenu.hide"),g=c?_u:Ou;return(0,n.jsx)(Ue,{label:m,children:(0,n.jsx)("button",{type:"button",className:Nu,onClick:p,children:(0,n.jsx)(g,{title:""})})})},Fu="_1xgvyvc0",Bu="_1xgvyvc1",zu="_1xgvyvc2",Gu="_1xgvyvc3",Hu=(e,t)=>{switch(e.kind){case"observations":return Vu(e.scope,t);case"legend":case"axis":case"grid":return Wu(e.kind,t);case"graph":return t("editor.overlayMenu.chart");default:return e}},Vu=(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}},Wu=(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}},$u=({target:e})=>{const t=l.useI18n(),r=l.useGraphLocale(),o=l.useSceneSelector(s=>s),a=Wt(o),i=(0,v.useMemo)(()=>qu({target:e,scene:o,groupOptions:a,locale:r,t}),[e,o,a,r,t]);return(0,n.jsx)(Uu,{title:i})},Uu=({title:e})=>{const t=(0,v.useRef)(null),r=(0,v.useRef)(null),[o,a]=(0,v.useState)(!1),i=(0,v.useCallback)(()=>{const d=t.current,h=r.current;d===null||h===null||a(h.offsetWidth>d.clientWidth)},[]);(0,v.useLayoutEffect)(i,[i,e.whole]);const{setElement:s}=l.useResizeObserver({onResize:i}),c=(0,v.useCallback)(d=>{t.current=d,s(d)},[s]);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(H.Popover.Title,{ref:c,className:zu,"data-testid":"overlay-menu-title",children:o?e.value:e.whole}),(0,n.jsx)("span",{ref:r,className:Gu,"aria-hidden":!0,children:e.whole})]})},qu=({target:e,scene:t,groupOptions:r,locale:o,t:a})=>{const i=Hu(e,a),s={whole:i,value:i};if(e.kind!=="observations")return s;const c=(0,u.findLayerById)(t.layers,e.layerId);if(c===void 0)return s;const[d]=(0,u.resolveObservationsTarget)({layer:c,target:e,parsingLocale:t.config.parsingLocale}),h=d===void 0?null:c.data.getAt(d);return h===null?s:Tu({scene:t,layer:c,observation:h,groupOptions:r,locale:o,t:a},e.scope)},Ku=({frameElement:e})=>{const{selectionStore:t}=l.useGraphContext(),r=Xu(l.useEditorState(c=>c.selectedOutline)),o=Od(r?.target??null),a=qe();if(r===null||!a(r.target))return null;const i=()=>{t.getState().clearSelection()},s=(0,u.readEditTargetKey)(r.target);return(0,n.jsxs)(Cu,{frameElement:e,boundary:r.frame,spans:r.frameSpans,onEscape:i,children:[(0,n.jsxs)(pt,{className:Fu,children:[(0,n.jsxs)("div",{className:Bu,children:[(0,n.jsx)($u,{target:r.target}),(0,n.jsx)(Du,{target:r.target},s)]}),r.target.kind==="observations"&&(0,n.jsx)(Mu,{})]}),(0,n.jsx)(v.Fragment,{children:o},s)]})},Xu=e=>{const t=l.useGraphSelection(),[r,o]=(0,v.useState)(e),a=r!==null&&(0,u.areEditTargetsEqual)(t[0]??null,r.target),i=e??(a?r:null);return i!==r&&o(i),i},Zu=({frameRect:e})=>{const{targetBoundaryStore:t}=l.useGraphContext(),r=l.useEditorState(s=>s.selectedOutline),{left:o,top:a}=e,i=(0,v.useMemo)(()=>{if(r===null)return null;const{frame:s,frameSpans:c,frameScale:d}=r;return{frame:s,client:{x:o+s.x*d,y:a+s.y*d,width:s.width*d,height:s.height*d},frameSpans:c,clientSpans:{top:Te(c.top,o,d),right:Te(c.right,a,d),bottom:Te(c.bottom,o,d),left:Te(c.left,a,d)}}},[r,o,a]);return(0,v.useLayoutEffect)(()=>{t.getState().setBoundary(i)},[t,i]),(0,v.useLayoutEffect)(()=>()=>t.getState().setBoundary(null),[t]),null},Te=(e,t,r)=>({from:t+e.from*r,to:t+e.to*r}),Eo=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 Mo="efjmb40",Ro="efjmb41",re="efjmb42",oe="efjmb43",Yu="efjmb44",Ju="efjmb45",Qu=new Set(["item-press","escape-key","outside-press","close-press","sibling-open","trigger-press"]),$t=({label:e,icon:t,onOpened:r,children:o})=>{const a=se(),[i,s]=(0,v.useState)(!1),c=(d,h)=>{d?(s(!0),r?.()):Qu.has(h.reason)&&s(!1)};return(0,n.jsxs)(te.Menu.SubmenuRoot,{open:i,onOpenChange:c,children:[(0,n.jsx)(eh,{label:e,icon:t}),(0,n.jsx)(te.Menu.Portal,{container:a,children:(0,n.jsx)(l.PortalThemeProvider,{children:(0,n.jsx)(te.Menu.Positioner,{side:"inline-end",align:"start",sideOffset:4,className:Mo,..._t,children:(0,n.jsx)(te.Menu.Popup,{className:Ro,children:o})})})})]})},eh=({label:e,icon:t})=>(0,n.jsxs)(te.Menu.SubmenuTrigger,{className:re,openOnHover:!1,children:[t,(0,n.jsx)("span",{className:oe,children:e}),(0,n.jsx)("span",{className:Ju,children:(0,n.jsx)(ge,{size:"sm"})})]}),th="_1qe7q450",nh="_1qe7q451",rh="_1qe7q452",oh=({label:e,placeholder:t,addLabel:r,at:o,onRequestClose:a})=>{const i=(0,v.useRef)(null),[s,c]=(0,v.useState)(""),{dispatch:d}=l.useGraphCommands(),h=s.trim(),p=()=>{h.length!==0&&(d(new u.AddAnnotationCommand({kind:"comment",annotation:{at:o,content:ah(h)}})),a())},m=x=>{x.key==="Enter"&&(x.preventDefault(),p()),x.key!=="Escape"&&x.stopPropagation()},g=x=>{c(x.target.value)},f=()=>{requestAnimationFrame(()=>i.current?.focus())};return(0,n.jsx)($t,{label:e,icon:(0,n.jsx)(Eo,{}),onOpened:f,children:(0,n.jsxs)("div",{className:th,children:[(0,n.jsx)("input",{ref:i,className:nh,value:s,placeholder:t,onChange:g,onKeyDown:m}),(0,n.jsx)("button",{type:"button",className:rh,disabled:h.length===0,onClick:p,children:r})]})})},ah=e=>({type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e}]}]}),ih=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"})}),sh="relative-difference",lh=({label:e,layer:t,at:r,onRequestClose:o})=>{const{dispatch:a}=l.useGraphCommands(),i=l.useSceneSelector(d=>d.coordSystem),s=(0,v.useMemo)(()=>(0,u.inferDifferenceArrowEndpoints)({layer:t,at:r,coordSystem:i}),[t,r,i]);if(s===null)return null;const c=()=>{a(new u.AddAnnotationCommand({kind:"differenceArrow",annotation:{...u.DIFFERENCE_ARROW_DEFAULTS,...s,label:sh}})),o()};return(0,n.jsxs)(F.Menu.Item,{className:re,onClick:c,children:[(0,n.jsx)(ih,{}),(0,n.jsx)("span",{className:oe,children:e})]})};function ch(e,t){if(e.type==="polar"&&!dh(t))return[{scope:"series",labelKey:"pieSlice"}];const r=(0,u.hasMultipleGroups)(t.data,t.mapping);switch(t.geom){case"bar":{const o=[{scope:"data-point",labelKey:"bar"}];if(r){const a=t.position==="stack"||t.position==="fill";o.push({scope:"x-value",labelKey:a?"barStack":"barGroup"}),o.push({scope:"series",labelKey:"barSeries"})}return o}case"line":case"area":{const o=[{scope:"data-point",labelKey:"linePoint"}];return r&&o.push({scope:"series",labelKey:"lineSeries"}),o}case"point":{const o=[{scope:"data-point",labelKey:"scatterPoint"}];return r&&o.push({scope:"series",labelKey:"scatterSeries"}),o}default:return[]}}var dh=e=>{const t=(0,u.readVariableName)(e.mapping.x);return t!==null&&t!==u.CONSTANT_VARIABLES.x},uh=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"})]}),hh=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"})]}),ph=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"})]}),mh=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"})]}),gh=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)"})]}),vh=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)"})]}),xh={bar:ko,barGroup:Po,barStack:uh,barSeries:Lo,linePoint:hh,lineSeries:ph,scatterPoint:gh,scatterSeries:vh,pieSlice:mh},Oo=({labelKey:e})=>{const t=xh[e];return(0,n.jsx)(t,{})},_o=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"})]}),fh=({label:e,options:t,onSelect:r})=>{const o=l.useI18n();return(0,n.jsx)($t,{label:e,icon:(0,n.jsx)(_o,{}),children:t.map(a=>(0,n.jsxs)(te.Menu.Item,{className:re,onClick:()=>r(a.scope),children:[(0,n.jsx)(Oo,{labelKey:a.labelKey}),(0,n.jsx)("span",{className:oe,children:o(`graph.annotations.highlights.labels.${a.labelKey}`)})]},a.scope))})},bh=({label:e,layer:t,observation:r,highlights:o,onRequestClose:a})=>{const i=l.useI18n(),{dispatch:s}=l.useGraphCommands(),c=l.useSceneSelector(f=>f.coordSystem),d=(0,v.useMemo)(()=>(0,u.buildObservationPredicate)(t,r),[t,r]),h=(0,v.useMemo)(()=>ch(c,t),[c,t]),p=(0,v.useMemo)(()=>{const f=new Set(o.map(x=>x.scope));return h.filter(x=>!f.has(x.scope))},[h,o]),[m]=p;if(d===null||m===void 0)return null;const g=f=>{s(new u.AddHighlightCommand({predicate:d,scope:f,layerId:t.id})),a()};if(p.length===1){const f=h.length===1?e:i("graph.annotations.baseMenu.highlightWithLabel",{label:i(`graph.annotations.highlights.labels.${m.labelKey}`)});return(0,n.jsxs)(te.Menu.Item,{className:re,onClick:()=>g(m.scope),children:[(0,n.jsx)(Oo,{labelKey:m.labelKey}),(0,n.jsx)("span",{className:oe,children:f})]})}return(0,n.jsx)(fh,{label:e,options:p,onSelect:g})},Sh="_1aafi1g0",yh="_1aafi1g1",No=({children:e})=>(0,n.jsxs)("span",{className:Sh,"aria-hidden":"true",children:[e,(0,n.jsx)("span",{className:yh})]}),Ch=({label:e,highlights:t,onRequestClose:r})=>{const{dispatch:o}=l.useGraphCommands(),a=t.at(-1);if(a===void 0)return null;const i=()=>{o(new u.RemoveHighlightCommand({id:a.id})),r()};return(0,n.jsxs)(F.Menu.Item,{className:re,onClick:i,children:[(0,n.jsx)(No,{children:(0,n.jsx)(_o,{})}),(0,n.jsx)("span",{className:oe,children:e})]})},jh=(e,t)=>{const r=l.useSceneSelector(a=>a.spec.highlights),o=l.useSceneSelector(a=>a.config.parsingLocale);return(0,v.useMemo)(()=>(0,u.findHighlightsAtObservation)({layer:e,highlights:r,observation:t,parsingLocale:o}),[e,r,t,o])},Do=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"})]}),wh=({label:e,at:t,onRequestClose:r})=>{const{dispatch:o}=l.useGraphCommands(),a=()=>{o(new u.AddAnnotationCommand({kind:"pinnedNumber",annotation:{at:t}})),r()};return(0,n.jsxs)(F.Menu.Item,{className:re,onClick:a,children:[(0,n.jsx)(Do,{}),(0,n.jsx)("span",{className:oe,children:e})]})},Fo=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"})]}),Bo={pinnedNumber:{icon:Do,labelKey:"graph.annotations.baseMenu.unpinNumber"},comment:{icon:Eo,labelKey:"graph.annotations.baseMenu.removeAnnotation"},sticker:{icon:Fo,labelKey:"graph.annotations.baseMenu.removeSticker"},image:null},Th=e=>(0,u.isObservationAttachmentKind)(e.kind)&&Bo[e.kind]!==null,Ah=({attachment:e,onRequestClose:t})=>{const r=l.useI18n(),{dispatch:o}=l.useGraphCommands(),{icon:a,labelKey:i}=Bo[e.kind],s=()=>{o(new u.RemoveAnnotationCommand({id:e.annotation.id})),t()};return(0,n.jsxs)(F.Menu.Item,{className:re,onClick:s,children:[(0,n.jsx)(No,{children:(0,n.jsx)(a,{})}),(0,n.jsx)("span",{className:oe,children:r(i)})]})},kh="ceeojg0",Ph="ceeojg1",Lh="ceeojg2",Ih=({label:e,at:t,onRequestClose:r})=>{const{dispatch:o}=l.useGraphCommands(),a=i=>{o(new u.AddAnnotationCommand({kind:"sticker",annotation:{at:{anchorType:"observation",...t},sticker:i}})),r()};return(0,n.jsx)($t,{label:e,icon:(0,n.jsx)(Fo,{}),children:(0,n.jsx)("div",{className:kh,children:Object.entries(l.STICKER_ASSETS).map(([i,s])=>(0,n.jsx)(te.Menu.Item,{className:Ph,"aria-label":i,onClick:()=>a(i),children:(0,n.jsx)("img",{className:Lh,src:s.src,alt:i})},i))})})},Eh=({interaction:e,frameElement:t,panelRect:r})=>{const o=l.useEditorStore(),a=l.useEditorState(d=>d.menuTrigger);if(e.kind!=="menu"||a===null)return null;const i=()=>{o.getState().releaseInteraction("menu")},{center:s,radius:c}=a;return(0,n.jsx)(Mh,{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})},Mh=({frameElement:e,trigger:t,layer:r,at:o,observation:a,onClose:i})=>{const s=l.useI18n(),c=se(),d=l.useSceneSelector(w=>w.spec.annotations),h=l.useSceneSelector(w=>w.config.parsingLocale),p=Ao(),{x:m,y:g,width:f,height:x}=t,b=(0,v.useMemo)(()=>To(e,{x:m,y:g,width:f,height:x}),[e,m,g,f,x]),S=(0,u.findObservationAttachment)(d,o,(0,v.useMemo)(()=>(0,u.createObservationAnchorParser)(r,h),[r,h])),j=S!==null&&Th(S)?S:null,L=jh(r,a),A=(w,I)=>{!w&&Rh(I.reason)&&i()};return(0,n.jsx)(F.Menu.Root,{open:p,modal:!1,onOpenChange:A,children:(0,n.jsx)(F.Menu.Portal,{container:c,children:(0,n.jsx)(l.PortalThemeProvider,{children:(0,n.jsx)(F.Menu.Positioner,{anchor:b,side:"right",align:"start",sideOffset:8,className:Mo,..._t,children:(0,n.jsxs)(F.Menu.Popup,{className:Ro,"data-testid":"observation-menu",children:[j!==null&&(0,n.jsx)(Ah,{attachment:j,onRequestClose:i}),(0,n.jsx)(Ch,{label:s("graph.annotations.baseMenu.removeHighlight"),highlights:L,onRequestClose:i}),(0,n.jsx)(F.Menu.Separator,{className:Yu}),j===null&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(wh,{label:s("graph.annotations.baseMenu.pinNumber"),at:o,onRequestClose:i}),(0,n.jsx)(oh,{label:s("graph.annotations.baseMenu.annotate"),placeholder:s("graph.annotations.textMenu.placeholder"),addLabel:s("graph.annotations.textMenu.addButton"),at:o,onRequestClose:i}),(0,n.jsx)(Ih,{label:s("graph.annotations.baseMenu.addSticker"),at:o,onRequestClose:i})]}),r.highlight!==null&&(0,n.jsx)(bh,{label:s("graph.annotations.baseMenu.highlight"),layer:r,observation:a,highlights:L,onRequestClose:i}),(0,n.jsx)(lh,{label:s("graph.annotations.baseMenu.differenceArrow"),layer:r,at:o,onRequestClose:i})]})})})})})},Rh=e=>e==="outside-press"||e==="escape-key"||e==="item-press",Ut="l8tsqe0",zo=["start","end"],Go=({anchor:e,point:t,delta:r})=>{const o={x:On(t.x,r.x),y:On(1-t.y,r.y)};return{anchor:{...e,x:e.x+o.x,y:e.y+o.y},point:{x:t.x+o.x,y:t.y-o.y}}},qt=(e,t)=>({...e,[t.endpoint]:{...e[t.endpoint],...t.point}}),Ho=(e,t)=>e.x===t.x&&e.y===t.y,Oh=(e,t)=>{const r=(0,u.projectAnchorToPanel)(e,t);return{x:t.x+r.x,y:t.y+r.y}},_h=(e,t,r)=>{const o=(0,u.projectAnchorToPanel)(e,r),a=(0,u.projectAnchorToPanel)(t,r);return{x:Math.min(o.x,a.x),y:Math.min(o.y,a.y),width:Math.abs(a.x-o.x),height:Math.abs(a.y-o.y)}},On=(e,t)=>!Number.isFinite(t)||!Number.isFinite(e)?0:(0,ne.clamp)(t,Math.min(-e,0),Math.max(1-e,0)),Nh=({panelRect:e})=>{const t=l.useEditorState(c=>l.readStanding(c,"arrow-endpoint-drag")),r=l.useResolvedAnnotations(e).arrows,o=l.useStyleReaderTree();if(t===null)return null;const a=r.find(c=>c.id===t.annotationId);if(a===void 0)return null;const i=(0,u.resolveArrowAnnotationStyle)(o,a.id),s=(0,u.computeArrow)({arrow:qt(a,t),style:i,panelWidth:e.width,panelHeight:e.height});return s===null?null:(0,n.jsx)("svg",{"aria-hidden":"true",className:Ut,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,addressable:!1})})},fe=()=>{const e=l.useGraphSelection();return wt(e)},wt=e=>{if(e.length!==1)return null;const[t]=e;return t?.kind==="annotation"?t.id:null},Dh=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"})]})}),Vo=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"})]})}),Fh=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"})]})}),Wo=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"})]})}),Ke=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"})]})}),Bh="var(--pvjfpx0)",zh="var(--pvjfpx1)",Gh="pvjfpx2",Hh="pvjfpx3",Vh="pvjfpx4",Wh="pvjfpx6 pvjfpx5",$h="pvjfpx7 pvjfpx6 pvjfpx5",Uh="pvjfpx8 pvjfpx5",de=8,qh=({anchorBox:e,panelRect:t,frameWidth:r,frameHeight:o})=>{const a=t.y+e.y,i=a+e.height,s=a-8-36,c=i+8,d=(0,ne.clamp)(s>=de?s:c,de,o-de-36),h=de;return{top:d,left:h,available:Math.max(0,r-de*2),centre:t.x+e.x+e.width/2-h}},Kh=({anchorBox:e,panelRect:t,frameWidth:r,frameHeight:o,label:a,testId:i,children:s})=>{const{chartId:c}=l.useGraphContext(),d=qh({anchorBox:e,panelRect:t,frameWidth:r,frameHeight:o});return(0,n.jsx)("div",{className:Gh,style:{top:d.top,left:d.left,width:d.available},children:(0,n.jsx)(G.Root,{"aria-label":a,className:Hh,"data-testid":i,...We(c),style:(0,Y.assignInlineVars)({[Bh]:`${d.centre}px`,[zh]:`${d.available}px`}),children:s})})},Xh=({label:e,trigger:t,open:r,onOpenChange:o,disabled:a=!1,children:i})=>{const{chartId:s}=l.useGraphContext();return(0,n.jsxs)(F.Menu.Root,{open:r,modal:!1,onOpenChange:o,children:[(0,n.jsxs)(F.Menu.Trigger,{render:(0,n.jsx)(G.Button,{}),"aria-label":e,className:Uh,disabled:a,onMouseDown:c=>c.preventDefault(),children:[t,(0,n.jsx)(ge,{size:"sm"})]}),(0,n.jsx)(G.MenuPopup,{popupAttributes:We(s),children:i})]})},Zh=e=>{const{chartId:t}=l.useGraphContext();return(0,n.jsx)(G.ColorPicker,{...e,popupAttributes:We(t)})},Yh=({color:e,opacity:t})=>(0,n.jsx)("span",{className:Vh,style:{background:e,opacity:t}}),Jh=({label:e,onClick:t,children:r})=>(0,n.jsx)(G.Button,{"aria-label":e,className:Wh,onClick:t,children:r}),Qh=({label:e,pressed:t,onClick:r,children:o})=>(0,n.jsx)(G.Button,{"aria-label":e,"aria-pressed":t,className:$h,onClick:r,children:o}),_={Root:Kh,Dropdown:Xh,MenuItem:G.MenuItem,ColorPicker:Zh,Swatch:Yh,IconButton:Jh,ToggleButton:Qh,Button:G.Button,Separator:G.Separator},e0={kind:"chrome-popup"},Xe=()=>{const{commands:e}=l.useGraphContext(),t=l.useEditorStore(),[r,o]=(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(e0),()=>s("chrome-popup")},[t,r]);const a=()=>{o(null),e.commit()};return{bind:i=>({open:r===i,onOpenChange:s=>s?o(i):a()}),close:a}},t0=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"})]})}),n0=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"})]})}),r0=e=>(0,n.jsx)(l.Icon,{...e,children:(0,n.jsx)("path",{d:"M5 19 19 5",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round"})}),o0=[{value:u.ARROW_STROKE_WIDTHS_PX.thin,key:"graph.annotations.arrowToolbar.thickness.thin"},{value:u.ARROW_STROKE_WIDTHS_PX.medium,key:"graph.annotations.arrowToolbar.thickness.medium"},{value:u.ARROW_STROKE_WIDTHS_PX.thick,key:"graph.annotations.arrowToolbar.thickness.thick"}],_n=[{value:"line-arrow",key:"graph.annotations.arrowToolbar.arrowhead.lineArrow",Icon:Vo},{value:"none",key:"graph.annotations.arrowToolbar.arrowhead.none",Icon:l.MinusIcon}],Nn=[{value:"solid",key:"graph.annotations.arrowToolbar.lineStyle.solid",Icon:r0},{value:"dashed",key:"graph.annotations.arrowToolbar.lineStyle.dashed",Icon:t0},{value:"dotted",key:"graph.annotations.arrowToolbar.lineStyle.dotted",Icon:n0}],a0=(e,t)=>e.find(r=>r.value===t)??e[0];var i0=({arrow:e,arrowBox:t,panelRect:r,frameWidth:o,frameHeight:a,frameElement:i})=>{const s=l.useI18n(),{commands:c}=l.useGraphContext(),d=l.useSceneSelector(C=>C.spec.styles.overrides),h=l.useSceneSelector(C=>(0,u.readStyleCoord)(C.spec)),p=Xe(),m=(0,u.resolveArrowAnnotationStyle)(l.useStyleReaderTree(),e.id),g=a0(Nn,(0,u.toDashPreset)(m.dashArray)),f=m.outline.strokeWidth>0||m.outline.shadow!=="none",x=(0,v.useMemo)(()=>({target:"annotation",kind:"arrow",annotation:e.id}),[e.id]),b=(0,v.useMemo)(()=>({...x,part:"outline"}),[x]),S=(C,y)=>{const M=(0,u.findStyleRule)(d,{select:x},h)?.declarations??{};c.dispatch(new u.SetStyleRuleCommand({list:"overrides",rule:{select:x,declarations:{...M,...C}}}),y)},j=C=>{const y=(0,u.findStyleRule)(d,{select:b},h)?.declarations??{};c.dispatch(new u.SetStyleRuleCommand({list:"overrides",rule:{select:b,declarations:{...y,...C}}}))},L=C=>{S(C),p.close()},A=C=>{c.dispatch(new u.UpdateAnnotationCommand({kind:"arrow",id:e.id,patch:C})),p.close()},w=()=>{c.dispatch(new u.RemoveAnnotationCommand({id:e.id})),i.focus({preventScroll:!0})},I=C=>S({stroke:C},{transient:!0}),T=C=>L({strokeWidth:C}),P=C=>A({startArrowheadStyle:C}),N=C=>L({dashArray:u.DASH_PRESETS.arrow[C]}),V=C=>A({endArrowheadStyle:C}),R=()=>j(f?{strokeWidth:0,shadow:"none"}:u.ARROW_STICKER_DECLARATIONS);return(0,n.jsxs)(_.Root,{anchorBox:t,panelRect:r,frameWidth:o,frameHeight:a,label:s("graph.annotations.arrowToolbar.label"),testId:"arrow-toolbar",children:[(0,n.jsx)(_.ColorPicker,{color:m.stroke,label:s("graph.annotations.arrowToolbar.color"),onChange:I,...p.bind("color"),children:(0,n.jsx)(_.Swatch,{color:m.stroke})}),(0,n.jsx)(_.Dropdown,{label:s("graph.annotations.arrowToolbar.thickness.ariaLabel"),trigger:(0,n.jsx)(Wo,{size:"sm",title:""}),...p.bind("thickness"),children:(0,n.jsx)(Ae,{options:o0,current:m.strokeWidth,onPick:T})}),(0,n.jsx)(_.Dropdown,{label:s("graph.annotations.arrowToolbar.startArrowhead"),trigger:(0,n.jsx)(Dh,{size:"sm",title:""}),...p.bind("startArrowhead"),children:(0,n.jsx)(Ae,{options:_n,current:e.startArrowheadStyle,onPick:P})}),(0,n.jsx)(_.Dropdown,{label:s("graph.annotations.arrowToolbar.lineStyle.ariaLabel"),trigger:g?.Icon!==void 0&&(0,n.jsx)(g.Icon,{size:"sm",title:""}),...p.bind("lineStyle"),children:(0,n.jsx)(Ae,{options:Nn,current:(0,u.toDashPreset)(m.dashArray),onPick:N})}),(0,n.jsx)(_.Dropdown,{label:s("graph.annotations.arrowToolbar.endArrowhead"),trigger:(0,n.jsx)(Vo,{size:"sm",title:""}),...p.bind("endArrowhead"),children:(0,n.jsx)(Ae,{options:_n,current:e.endArrowheadStyle,onPick:V})}),(0,n.jsx)(_.ToggleButton,{label:s("graph.annotations.arrowToolbar.sticker"),pressed:f,onClick:R,children:(0,n.jsx)(Fh,{size:"sm",title:""})}),(0,n.jsx)(_.Separator,{}),(0,n.jsx)(_.IconButton,{label:s("graph.annotations.arrowToolbar.remove"),onClick:w,children:(0,n.jsx)(Ke,{size:"sm",title:""})})]})},Ae=({options:e,current:t,onPick:r})=>{const o=l.useI18n(),a=i=>()=>r(i);return(0,n.jsx)(n.Fragment,{children:e.map(i=>(0,n.jsxs)(_.MenuItem,{selected:i.value===t,onClick:a(i.value),children:[(0,n.jsx)("span",{children:o(i.key)}),i.Icon!==void 0&&(0,n.jsx)("span",{className:"_112xh5c0",children:(0,n.jsx)(i.Icon,{size:"sm",title:""})})]},String(i.value)))})},s0="_1me29t10",K=(e,t)=>t>0?e/t:0,Ze=(e,t,r)=>({x:K(t.x-e.x,r.width),y:K(t.y-e.y,r.height)}),l0=e=>e.x!==0||e.y!==0,$o=(e,t)=>({x:e.x*t.width,y:e.y*t.height});var c0=(e,t)=>Math.hypot(t.x-e.x,t.y-e.y)>=3,be=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 o={x:t.clientX,y:t.clientY};if(!this.hasPublished&&!this.isDragConfirmed(this.params.press,o))return;const a=this.resolvePreview(o);a!==null&&(r.claimInteraction(a),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 c0(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)}},Fe=(e,t,r)=>{const o=e.arrows.find(i=>i.id===t);if(o===void 0)return null;const a=o[r];return a.anchorType==="panel"?a:null},Uo=(e,t)=>e==="start"?{start:t}:{end:t},d0=class extends be{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:o,readInputs:a}=this.params,{annotations:i,arrow:s,panelRect:c}=a(),d=Fe(i,t,r);return d===null?null:{kind:"arrow-endpoint-drag",annotationId:t,endpoint:r,...Go({anchor:d,point:s[r],delta:Ze(o,e,c)})}}commit({anchor:e}){const{annotationId:t,endpoint:r,dispatch:o,readInputs:a}=this.params,i=Fe(a().annotations,t,r);i===null||Ho(i,e)||o(new u.UpdateAnnotationCommand({kind:"arrow",id:t,patch:Uo(r,e)}))}},u0=({annotationId:e,arrow:t,panelRect:r})=>{const{commands:o}=l.useGraphContext(),a=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 d0({handle:d.currentTarget,pointerId:d.pointerId,annotationId:e,endpoint:c,press:{x:d.clientX,y:d.clientY},readInputs:()=>i.current,editorStore:a,dispatch:o.dispatch,onSettled:()=>{s.current=null}}),s.current.start()}}}),[e,i,a,o])},h0=[" ","Enter"],Dn=4,p0=({annotationId:e,arrow:t,panelRect:r})=>{const{commands:o}=l.useGraphContext(),a=l.useEditorStore(),i=l.useSceneSelector(d=>d.spec.annotations),s=l.useLatestRef(i),c=l.useLatestRef(o.dispatch);return(0,v.useEffect)(()=>()=>{for(const d of zo)Fn({editorStore:a,annotationId:e,endpoint:d,annotations:s.current,dispatch:c.current})},[a,e,s,c]),(0,v.useCallback)(d=>({onKeyDown:h=>{if(h.altKey||h.ctrlKey||h.metaKey||h.shiftKey)return;const p=a.getState(),m=l.readDraggedArrowEndpointFor(l.readStanding(p,"arrow-endpoint-drag"),e,d);if(h0.includes(h.key)){if(h.preventDefault(),h.repeat)return;if(m!==null){Fn({editorStore:a,annotationId:e,endpoint:d,annotations:i,dispatch:o.dispatch});return}const f=Fe(i,e,d);if(f===null)return;p.claimInteraction({kind:"arrow-endpoint-drag",annotationId:e,endpoint:d,anchor:f,point:t[d]});return}if(m===null)return;const g=m0(h.key,r);g!==null&&(h.preventDefault(),p.claimInteraction({kind:"arrow-endpoint-drag",annotationId:e,endpoint:d,...Go({anchor:m.anchor,point:m.point,delta:g})}))}}),[e,i,t,r,a,o])},Fn=({editorStore:e,annotationId:t,endpoint:r,annotations:o,dispatch:a})=>{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=Fe(o,t,r);c===null||Ho(c,s.anchor)||a(new u.UpdateAnnotationCommand({kind:"arrow",id:t,patch:Uo(r,s.anchor)}))},m0=(e,t)=>{const r=K(Dn,t.width),o=K(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:-o};case"ArrowDown":return{x:0,y:o};default:return null}},g0=e=>{const t=fe(),r=f0(t),o=b0(e.panelRect,t),a=S0(t);if(r===null||o===null)return null;const i=a.dragged===null?o:qt(o,a.dragged);return(0,n.jsx)(v0,{arrow:r,committed:o,painted:i,settled:a.dragged===null&&!a.moving,moving:a.moving,...e})},v0=({arrow:e,committed:t,painted:r,settled:o,moving:a,panelRect:i,frameRect:s,frameElement:c})=>{const d=l.useI18n(),h=u0({annotationId:e.id,arrow:t,panelRect:i}),p=p0({annotationId:e.id,arrow:t,panelRect:i});return(0,n.jsxs)("div",{"data-testid":"arrow-selection","data-annotation-id":e.id,children:[o&&(0,n.jsx)(i0,{arrow:e,arrowBox:_h(t.start,t.end,i),panelRect:i,frameWidth:s.width,frameHeight:s.height,frameElement:c}),!a&&zo.filter(m=>e[m].anchorType==="panel").map(m=>(0,n.jsx)(x0,{endpoint:m,point:Oh(r[m],i),label:d(`graph.annotations.arrowToolbar.moveEndpoint.${m}`),dragHandlers:h(m),keyboardHandlers:p(m)},m))]})},x0=({endpoint:e,point:t,label:r,dragHandlers:o,keyboardHandlers:a})=>(0,n.jsx)("div",{"aria-label":r,className:s0,"data-testid":"arrow-endpoint-handle","data-endpoint":e,role:"button",style:{left:t.x,top:t.y},tabIndex:0,...o,...a}),f0=e=>{const t=l.useSceneSelector(r=>r.spec.annotations.arrows);return e===null?null:t.find(r=>r.id===e)??null},b0=(e,t)=>{const r=l.useResolvedAnnotations(e).arrows;return t===null?null:r.find(o=>o.id===t)??null},S0=e=>l.useEditorState((0,J.useShallow)(t=>{if(e===null)return{dragged:null,moving:!1};const r=l.readStanding(t,"arrow-endpoint-drag");return{dragged:r?.annotationId===e?r:null,moving:l.readMovedAnnotationFor(l.readStanding(t,"move-drag"),e)!==null}})),y0=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"})]})}),C0="q7gcrz0",j0="q7gcrz1",w0="q7gcrz2";var T0=["absolute-difference","relative-difference","proportion"],Bn=["absolute-difference","relative-difference"],A0=["relative-difference","proportion"],k0={"absolute-difference":"graph.annotations.differenceArrowToolbar.labelKind.absoluteDifference","relative-difference":"graph.annotations.differenceArrowToolbar.labelKind.relativeDifference",proportion:"graph.annotations.differenceArrowToolbar.labelKind.proportion"},P0=e=>{const{formattingLocale:t}=l.useGraphContext(),r=l.useSceneSelector(a=>a.config.parsingLocale),o=t??r;return(0,v.useMemo)(()=>{const a=(0,u.areEndpointsComparable)(e.start,e.end);return T0.filter(i=>a||!Bn.includes(i)||i===e.label).map(i=>({kind:i,key:k0[i],preview:(0,u.formatDifferenceLabel)({locale:o,kind:i,startValue:e.start.measurementValue,endValue:e.end.measurementValue,valueFormat:e.start.valueFormat}),pickable:a||!Bn.includes(i),suspect:A0.includes(i)&&e.start.measurementValue===0}))},[e,o])},zn=[{id:"small",key:"graph.annotations.differenceArrowToolbar.size.small"},{id:"medium",key:"graph.annotations.differenceArrowToolbar.size.medium"},{id:"large",key:"graph.annotations.differenceArrowToolbar.size.large"}],L0=({arrow:e,color:t,labelBox:r,panelRect:o,frameWidth:a,frameHeight:i,frameElement:s})=>{const c=l.useI18n(),{commands:d}=l.useGraphContext(),h=l.useSceneSelector(y=>y.spec.styles.overrides),p=l.useSceneSelector(y=>(0,u.readStyleCoord)(y.spec)),m=Xe(),g=P0(e),f=(0,u.resolveDifferenceArrowAnnotationStyle)(l.useStyleReaderTree(),e.id),x=(0,v.useMemo)(()=>({target:"annotation",kind:"differenceArrow",annotation:e.id}),[e.id]),b=(0,v.useMemo)(()=>({...x,part:"label"}),[x]),S=g.find(y=>y.kind===e.label),j=g.some(y=>y.pickable&&y.kind!==e.label),L=zn.find(y=>u.DIFFERENCE_ARROW_SIZE_DECLARATIONS[y.id].arrow.strokeWidth===f.strokeWidth),A=(y,M)=>{d.dispatch(new u.UpdateAnnotationCommand({kind:"differenceArrow",id:e.id,patch:y}),M)},w=y=>({...(0,u.findStyleRule)(h,{select:x},p)?.declarations,...y}),I=y=>({...(0,u.findStyleRule)(h,{select:b},p)?.declarations,...y}),T=y=>{A(y),m.close()},P=()=>{d.dispatch(new u.RemoveAnnotationCommand({id:e.id})),s.focus({preventScroll:!0})},N=y=>d.dispatch(new u.SetStyleRuleCommand({list:"overrides",rule:{select:x,declarations:w({stroke:y})}}),{transient:!0}),V=()=>A({start:e.end.anchor,end:e.start.anchor}),R=y=>()=>T({label:y}),C=y=>()=>{const M=u.DIFFERENCE_ARROW_SIZE_DECLARATIONS[y];d.dispatch(new u.SetDifferenceArrowStyleCommand({annotationId:e.id,arrow:w(M.arrow),label:I(M.label)})),m.close()};return(0,n.jsxs)(_.Root,{anchorBox:r,panelRect:o,frameWidth:a,frameHeight:i,label:c("graph.annotations.differenceArrowToolbar.label"),testId:"difference-arrow-toolbar",children:[(0,n.jsx)(_.Dropdown,{label:c("graph.annotations.differenceArrowToolbar.labelKind.ariaLabel"),trigger:(0,n.jsx)(I0,{option:S}),disabled:!j,...m.bind("labelKind"),children:g.map(y=>(0,n.jsxs)(_.MenuItem,{selected:y.kind===e.label,disabled:!y.pickable,onClick:R(y.kind),children:[(0,n.jsx)("span",{children:c(y.key)}),(y.suspect||!y.pickable)&&(0,n.jsx)("span",{"aria-label":c(y.pickable?"graph.annotations.differenceArrowToolbar.labelKind.suspectValue":"graph.annotations.differenceArrowToolbar.labelKind.incomparableEnds"),className:"q7gcrz3",role:"img",children:"⚠"}),(0,n.jsx)("span",{className:w0,children:y.preview})]},y.kind))}),(0,n.jsx)(_.Separator,{}),(0,n.jsx)(_.ColorPicker,{color:t,label:c("graph.annotations.differenceArrowToolbar.color"),onChange:N,...m.bind("color"),children:(0,n.jsx)(_.Swatch,{color:t})}),(0,n.jsx)(_.Dropdown,{label:c("graph.annotations.differenceArrowToolbar.size.ariaLabel"),trigger:L===void 0?"":c(L.key),...m.bind("size"),children:zn.map(y=>(0,n.jsx)(_.MenuItem,{selected:y.id===L?.id,onClick:C(y.id),children:c(y.key)},y.id))}),(0,n.jsx)(_.Separator,{}),(0,n.jsx)(_.IconButton,{label:c("graph.annotations.differenceArrowToolbar.swap"),onClick:V,children:(0,n.jsx)(y0,{size:"sm",title:""})}),(0,n.jsx)(_.IconButton,{label:c("graph.annotations.differenceArrowToolbar.remove"),onClick:P,children:(0,n.jsx)(Ke,{size:"sm",title:""})})]})},I0=({option:e})=>{const t=l.useI18n();return e===void 0?null:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:j0,children:t(e.key)}),(0,n.jsxs)("span",{className:C0,children:["(",e.preview,")"]})]})},E0="var(--ydgo3h0)";var M0="ydgo3h1",R0="ydgo3h2",O0="ydgo3h3",_0=({clientPoint:e,panelOrigin:t,panelRect:r,engine:o,layers:a,coordSystem:i,resolver:s,fixedAnchor:c,align:d})=>{const h=N0({x:e.x-t.x,y:e.y-t.y},r),{primary:p}=o.query((0,u.toPanelCursor)(h,r));if(p===null)return null;const m=a.find(f=>f.id===p.layerId);if(m===void 0)return null;const g=(0,u.resolveObservationPoint)({resolver:s,layer:m,observation:p.observation,observationIndex:(0,u.readObservationIndex)(p),coordSystem:i,align:d});return g===null||(0,u.areAnchorsEqual)(g.anchor,c)?null:g},N0=(e,t)=>({x:Math.max(0,Math.min(e.x,t.width)),y:Math.max(0,Math.min(e.y,t.height))}),qo=e=>e==="start"?"end":"start",Ko=({dispatch:e,arrow:t,endpoint:r,anchor:o})=>{(0,u.areAnchorsEqual)(o,t[r].anchor)||e(new u.UpdateAnnotationCommand({kind:"differenceArrow",id:t.id,patch:{[r]:o}}))},D0=class extends be{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:o,anchorResolver:a}=this.params,{arrow:i,panelOrigin:s,panelRect:c,layers:d,coordSystem:h}=r(),p=_0({clientPoint:e,panelOrigin:s,panelRect:c,engine:o,layers:d,coordSystem:h,resolver:a,fixedAnchor:i[qo(t)].anchor,align:i[t].anchor.align});return p===null?null:{kind:"difference-arrow-endpoint-drag",annotationId:i.id,endpoint:t,point:p}}commit({point:e,endpoint:t}){const{dispatch:r,readInputs:o}=this.params;Ko({dispatch:r,arrow:o().arrow,endpoint:t,anchor:e.anchor})}},F0=({arrow:e,panelOrigin:t,panelRect:r})=>{const{commands:o,anchorResolver:a}=l.useGraphContext(),{engine:i}=l.useHoverContext(),s=l.useEditorStore(),c=l.useLatestRef({arrow:e,panelOrigin:t,panelRect:r,...l.useSceneSelector((0,J.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:p=>{if(p.button===0&&d.current===null){try{p.currentTarget.setPointerCapture(p.pointerId)}catch{return}p.currentTarget.focus({preventScroll:!0}),p.preventDefault(),d.current=new D0({handle:p.currentTarget,pointerId:p.pointerId,press:{x:p.clientX,y:p.clientY},endpoint:h,readInputs:()=>c.current,editorStore:s,engine:i,anchorResolver:a,dispatch:o.dispatch,onSettled:()=>{d.current=null}}),d.current.start()}}}),[c,s,i,a,o])},B0=[" ","Enter"],z0=({arrow:e})=>{const{commands:t,anchorResolver:r}=l.useGraphContext(),o=l.useEditorStore(),{layers:a,coordSystem:i,mainAxis:s}=l.useSceneSelector((0,J.useShallow)(d=>({layers:d.layers,coordSystem:d.coordSystem,mainAxis:(0,u.readMainAxis)(d.coordSystem)}))),c=e.id;return(0,v.useEffect)(()=>()=>{const d=o.getState();l.readStanding(d,"difference-arrow-endpoint-drag")?.annotationId===c&&d.releaseInteraction("difference-arrow-endpoint-drag")},[o,c]),(0,v.useCallback)(d=>({onKeyDown:h=>{if(h.altKey||h.ctrlKey||h.metaKey||h.shiftKey)return;const p=o.getState(),m=l.readDraggedDifferenceArrowEndpointFor(l.readStanding(p,"difference-arrow-endpoint-drag"),e.id,d);if(B0.includes(h.key)){if(h.preventDefault(),h.repeat)return;if(m===null)return p.claimInteraction({kind:"difference-arrow-endpoint-drag",annotationId:e.id,endpoint:d,point:e[d]});p.releaseInteraction("difference-arrow-endpoint-drag"),Ko({dispatch:t.dispatch,arrow:e,endpoint:d,anchor:m.point.anchor});return}if(m===null)return;const g=G0(h.key,s);if(g===null)return;h.preventDefault();const f=H0({arrow:e,endpoint:d,from:m.point.anchor,move:g,layers:a,coordSystem:i,resolver:r});f!==null&&p.claimInteraction({kind:"difference-arrow-endpoint-drag",annotationId:e.id,endpoint:d,point:f})}}),[e,o,t,r,a,i,s])},G0=(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}},H0=({arrow:e,endpoint:t,from:r,move:o,layers:a,coordSystem:i,resolver:s})=>{const c=a.find(p=>p.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,u.stepDifferenceArrowEndpoint)({layer:c,from:r,partner:e[qo(t)].anchor,axis:o.axis,step:o.step,getObservationPoint:(p,m)=>(0,u.resolveObservationPoint)({resolver:s,layer:c,observation:p,observationIndex:m,coordSystem:i,align:h,measurement:d})})?.point??null},V0=e=>{const t=fe();return t===null?null:(0,n.jsx)(W0,{annotationId:t,...e})},W0=({annotationId:e,...t})=>{const r=l.useDifferenceArrowGeometries(),o=(0,v.useMemo)(()=>r.find(a=>a.id===e),[r,e]);return o===void 0?null:(0,n.jsx)($0,{committedArrow:o.committedArrow,color:o.color,labelCornerRadius:o.style.label.cornerRadius,committedLabelBox:o.committedLabelBox,labelBox:o.labelBox,start:o.start,end:o.end,dragging:o.dragging,...t})},$0=({committedArrow:e,color:t,labelCornerRadius:r,committedLabelBox:o,labelBox:a,start:i,end:s,panelRect:c,panelOrigin:d,frameRect:h,frameElement:p,dragging:m})=>{const g=F0({arrow:e,panelOrigin:d,panelRect:c}),f=z0({arrow:e}),x=l.useStyleReaderTree().editOutline.selected().resolve().stroke;return(0,n.jsxs)("div",{"data-testid":"difference-arrow-selection",style:(0,Y.assignInlineVars)({[E0]:x}),children:[!m&&(0,n.jsx)(L0,{arrow:e,color:t,labelBox:o,panelRect:c,frameWidth:h.width,frameHeight:h.height,frameElement:p}),(0,n.jsx)("div",{"aria-hidden":"true",className:O0,"data-testid":"difference-arrow-selection-label",style:{left:c.x+a.x-2,top:c.y+a.y-2,width:a.width+4,height:a.height+4,borderRadius:l.toBorderRadiusCss(r,2)}}),(0,n.jsx)(Gn,{endpoint:"start",point:i,panelRect:c,dragHandlers:g("start"),keyboardHandlers:f("start")}),(0,n.jsx)(Gn,{endpoint:"end",point:s,panelRect:c,dragHandlers:g("end"),keyboardHandlers:f("end")})]})},Gn=({endpoint:e,point:t,panelRect:r,dragHandlers:o,keyboardHandlers:a})=>(0,n.jsx)("div",{className:M0,"data-testid":"difference-arrow-selection-handle","data-endpoint":e,role:"button",style:{left:r.x+t.x,top:r.y+t.y},tabIndex:0,...o,...a,children:(0,n.jsx)("span",{"aria-hidden":"true",className:R0})}),Tt=({start:e,extent:t,moveStartEdge:r,delta:o,minExtent:a})=>{if(!Number.isFinite(o))return{start:e,extent:t};const i=e+t,s=Math.min(a,t);if(r){const h=Math.min(0,e),p=Math.min(Math.max(1,e),i-s),m=(0,ne.clamp)(e+o,h,p);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,ne.clamp)(i+o,c,d)-e}},U0=["top-left","top-right","bottom-right","bottom-left"];var Xo=({width:e,height:t})=>({x:K(16,e),y:K(16,t)}),q0=(e,t)=>({x:Jo(t)?e.x:e.x+e.width,y:Qo(t)?e.y:e.y+e.height}),Kt=e=>({x:e.x,y:1-e.y-e.height,width:e.width,height:e.height}),Zo=({region:e,corner:t,delta:r,minSize:o})=>{const a=Tt({start:e.x,extent:e.width,moveStartEdge:Jo(t),delta:r.x,minExtent:o.x}),i=Tt({start:e.y,extent:e.height,moveStartEdge:Qo(t),delta:r.y,minExtent:o.y});return{anchorType:"panel",x:a.start,y:i.start,width:a.extent,height:i.extent}},Yo=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,Jo=e=>e==="top-left"||e==="bottom-left",Qo=e=>e==="top-left"||e==="top-right",ea=(e,t,r,o)=>{const a=e.textAnnotations.find(i=>i.id===t);return a===void 0?null:l.measureTextAnnotationBox(l.previewResizedText(a,r),o)},K0="var(--_1ee8fau0)";var X0={hovered:"_1ee8fau2 _1ee8fau1",selected:"_1ee8fau3 _1ee8fau1"},Z0={hovered:"_1ee8fau5 _1ee8fau4",selected:"_1ee8fau6 _1ee8fau4"},Y0=({panelRect:e})=>{const t=l.useResolvedAnnotations(e),r=l.useMeasuredBoxes(),o=l.useStyleReaderTree(),a=fe(),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),p=(0,v.useMemo)(()=>({panel:{width:e.width,height:e.height},measuredBoxes:r,readers:o}),[e.width,e.height,r,o]),m=Hn(t,a,p),g=Hn(t,h===a?null:h,p),f=b=>{if(s?.annotationId===b.id){const S=t.shapes.find(j=>j.id===b.id);return S===void 0?b.geometry:l.measureShapeRegion(Kt(s.region),o.annotation.shape(S.id).get("strokeWidth"),p.panel)}if(c?.annotationId===b.id){const S=t.arrows.find(j=>j.id===b.id);return S===void 0?b.geometry:l.measureArrowEnds(qt(S,c),p.panel)??b.geometry}return d?.annotationId===b.id?ea(t,b.id,d,p)??b.geometry:b.geometry},x=b=>{if(i?.annotationId!==b)return e;const S=$o(i.translation,e);return{x:e.x+S.x,y:e.y+S.y}};return(0,n.jsxs)(n.Fragment,{children:[g!==null&&(0,n.jsx)(Vn,{annotationId:g.id,geometry:f(g),state:"hovered",origin:x(g.id)}),m!==null&&(0,n.jsx)(Vn,{annotationId:m.id,geometry:f(m),state:"selected",origin:x(m.id)})]})},Hn=(e,t,r)=>{if(t===null)return null;const o=l.resolveAnnotationChromeGeometry(e,t,r);return o===null?null:{id:t,geometry:o}},Vn=({annotationId:e,geometry:t,state:r,origin:o})=>{const a=l.useStyleReaderTree().editOutline.selected().resolve().stroke,i=(0,Y.assignInlineVars)({[K0]:a});return t.shape==="segment"?(0,n.jsxs)("div",{"aria-hidden":"true","data-testid":"annotation-chrome","data-annotation-id":e,"data-state":r,style:i,children:[(0,n.jsx)(Wn,{point:t.start,state:r,origin:o}),(0,n.jsx)(Wn,{point:t.end,state:r,origin:o})]}):(0,n.jsx)("div",{"aria-hidden":"true",className:X0[r],"data-testid":"annotation-chrome","data-annotation-id":e,"data-state":r,style:{...i,left:o.x+t.rect.x-2,top:o.y+t.rect.y-2,width:t.rect.width+4,height:t.rect.height+4}})},Wn=({point:e,state:t,origin:r})=>(0,n.jsx)("span",{className:Z0[t],style:{left:r.x+e.x,top:r.y+e.y}}),J0=({panelRect:e})=>{const t=l.useEditorState(a=>l.readStanding(a,"move-drag")),r=l.useResolvedAnnotations(e);if(t===null)return null;const o=$o(t.translation,e);return(0,n.jsx)("svg",{"aria-hidden":"true",className:Ut,width:e.width,height:e.height,style:{left:e.x+o.x,top:e.y+o.y},"data-testid":"annotation-preview","data-annotation-id":t.annotationId,children:tp(r,t.annotationId,e)})},Q0=({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})},ke=(e,t,r)=>{const o=e.find(a=>a.id===t);return o===void 0?null:r(o)},ep={text:(e,t,r)=>ke(e.textAnnotations,t,o=>(0,n.jsx)(Q0,{annotation:o,panel:r})),shape:(e,t,r)=>ke(e.shapes,t,o=>(0,n.jsx)(rp,{shape:o,panelSize:r})),image:(e,t,r)=>ke(e.images,t,o=>(0,n.jsx)(op,{image:o,panelSize:r})),arrow:(e,t,r)=>ke(e.arrows,t,o=>(0,n.jsx)(np,{arrow:o,panelSize:r}))},tp=(e,t,r)=>{for(const o of Object.values(ep)){const a=o(e,t,r);if(a!==null)return a}return null},np=({arrow:e,panelSize:t})=>{const r=(0,u.resolveArrowAnnotationStyle)(l.useStyleReaderTree(),e.id),o=(0,u.computeArrow)({arrow:e,style:r,panelWidth:t.width,panelHeight:t.height});return o===null?null:(0,n.jsx)(l.ArrowAnnotation,{computed:o,style:r,addressable:!1})},rp=({shape:e,panelSize:t})=>(0,n.jsx)(l.ShapeAnnotation,{shape:e,style:l.useStyleReaderTree().annotation.shape(e.id).resolve(),panel:t}),op=({image:e,panelSize:t})=>(0,n.jsx)(l.ImageAnnotation,{image:e,panel:t,style:l.useStyleReaderTree().annotation.image(e.id).resolve()}),ap=({panelRect:e})=>{const t=l.useEditorState(i=>l.readStanding(i,"shape-resize-drag")),r=l.useResolvedAnnotations(e).shapes,o=l.useStyleReaderTree();if(t===null)return null;const a=r.find(i=>i.id===t.annotationId);return a===void 0?null:(0,n.jsx)("svg",{"aria-hidden":"true",className:Ut,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:{...a,region:Kt(t.region)},style:o.annotation.shape(a.id).resolve(),panel:e})})},ip="var(--o49ib40)",sp={sm:"o49ib41",md:"o49ib42"},lp={horizontal:"o49ib43",diagonalDown:"o49ib44",diagonalUp:"o49ib45"},ta=({point:e,label:t,pull:r,size:o,attributes:a,dragHandlers:i,keyboardHandlers:s})=>{const c=l.useStyleReaderTree().editOutline.selected().resolve().stroke;return(0,n.jsx)("div",{"aria-label":t,className:lp[r],role:"button",style:{left:e.x,top:e.y,...(0,Y.assignInlineVars)({[ip]:c})},tabIndex:0,...a,...i,...s,children:(0,n.jsx)("span",{"aria-hidden":"true",className:sp[o]})})},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"}],cp=e=>[...At].reverse().find(t=>t.width<=e)??At[0],dp=({shape:e,shapeBox:t,panelRect:r,frameWidth:o,frameHeight:a,frameElement:i})=>{const s=l.useI18n(),{commands:c}=l.useGraphContext(),d=l.useSceneSelector(A=>A.spec.styles.overrides),h=l.useSceneSelector(A=>(0,u.readStyleCoord)(A.spec)),p=Xe(),m=l.useStyleReaderTree().annotation.shape(e.id).resolve(),g=cp(m.strokeWidth),f=(0,v.useMemo)(()=>({target:"annotation",kind:"shape",annotation:e.id}),[e.id]),x=(A,w)=>{const I=(0,u.findStyleRule)(d,{select:f},h)?.declarations??{};c.dispatch(new u.SetStyleRuleCommand({list:"overrides",rule:{select:f,declarations:{...I,...A}}}),w)},b=()=>{c.dispatch(new u.RemoveAnnotationCommand({id:e.id})),i.focus({preventScroll:!0})},S=A=>x({fill:A},{transient:!0}),j=A=>x({fillAlpha:A},{transient:!0}),L=A=>()=>{x({strokeWidth:A}),p.close()};return(0,n.jsxs)(_.Root,{anchorBox:t,panelRect:r,frameWidth:o,frameHeight:a,label:s("graph.annotations.shapeToolbar.label"),testId:"shape-toolbar",children:[(0,n.jsx)(_.ColorPicker,{color:(0,u.toPaintColor)(m.fill),label:s("graph.annotations.shapeToolbar.color"),onChange:S,opacity:m.fillAlpha,onOpacityChange:j,...p.bind("color"),children:(0,n.jsx)(_.Swatch,{color:(0,u.toPaintColor)(m.fill),opacity:m.fillAlpha})}),(0,n.jsx)(_.Dropdown,{label:s("graph.annotations.shapeToolbar.border.ariaLabel"),trigger:(0,n.jsx)(Wo,{size:"sm",title:""}),...p.bind("border"),children:At.map(A=>(0,n.jsx)(_.MenuItem,{selected:A.width===g?.width,onClick:L(A.width),children:s(A.key)},A.width))}),(0,n.jsx)(_.Separator,{}),(0,n.jsx)(_.IconButton,{label:s("graph.annotations.shapeToolbar.remove"),onClick:b,children:(0,n.jsx)(Ke,{size:"sm",title:""})})]})},na=e=>{const t=l.useLatestRef(e),r=(0,v.useRef)(null);return(0,v.useEffect)(()=>()=>r.current?.finish(!1),[]),(0,v.useCallback)(o=>({onPointerDown:a=>{if(a.button!==0||r.current!==null)return;try{a.currentTarget.setPointerCapture(a.pointerId)}catch{return}a.currentTarget.focus({preventScroll:!0}),a.preventDefault();const i=t.current(o,{handle:a.currentTarget,pointerId:a.pointerId,press:{x:a.clientX,y:a.clientY},onSettled:()=>{r.current=null}});r.current=i,i.start()}}),[t])},Be=(e,t)=>{const r=e.shapes.find(o=>o.id===t);return r===void 0||r.region.anchorType!=="panel"?null:r.region},up=class extends be{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:o,readInputs:a}=this.params,{annotations:i,panelRect:s}=a(),c=Be(i,t);return c===null?null:{kind:"shape-resize-drag",annotationId:t,region:Zo({region:c,corner:r,delta:Ze(o,e,s),minSize:Xo(s)})}}commit({region:e}){const{annotationId:t,dispatch:r,readInputs:o}=this.params,a=Be(o().annotations,t);a===null||Yo(a,e)||r(new u.UpdateAnnotationCommand({kind:"shape",id:t,patch:{region:e}}))}},hp=({annotationId:e,panelRect:t})=>{const{commands:r}=l.useGraphContext(),o=l.useEditorStore(),a=l.useLatestRef({annotations:l.useSceneSelector(i=>i.spec.annotations),panelRect:t});return na((i,s)=>new up({...s,annotationId:e,corner:i,readInputs:()=>a.current,editorStore:o,dispatch:r.dispatch}))},pp=[" ","Enter"],ra=e=>{const t=l.useEditorStore(),r=l.useLatestRef(e);return(0,v.useEffect)(()=>()=>$n(t,r.current),[t,r]),(0,v.useCallback)(o=>({onKeyDown:a=>{if(a.altKey||a.ctrlKey||a.metaKey||a.shiftKey)return;const i=t.getState(),s=r.current.readHeld();if(pp.includes(a.key)){if(a.preventDefault(),a.repeat)return;if(s!==null){$n(t,r.current);return}const d=r.current.claim(o);if(d===null)return;i.claimInteraction(d);return}if(s===null)return;const c=r.current.step(s,o,a.key);c!==null&&(a.preventDefault(),i.claimInteraction(c))}}),[t,r])},$n=(e,t)=>{const r=t.readHeld();r!==null&&(e.getState().releaseInteraction(r.kind),t.commit(r))},Un=4,mp=({annotationId:e,panelRect:t})=>{const{commands:r}=l.useGraphContext(),o=l.useEditorStore(),a=l.useSceneSelector(i=>i.spec.annotations);return ra({readHeld:()=>l.readResizedShapeFor(l.readStanding(o.getState(),"shape-resize-drag"),e),claim:()=>{const i=Be(a,e);return i===null?null:{kind:"shape-resize-drag",annotationId:e,region:i}},step:(i,s,c)=>{const d=gp(c,t);return d===null?null:{kind:"shape-resize-drag",annotationId:e,region:Zo({region:i.region,corner:s,delta:d,minSize:Xo(t)})}},commit:({region:i})=>{const s=Be(a,e);s===null||Yo(s,i)||r.dispatch(new u.UpdateAnnotationCommand({kind:"shape",id:e,patch:{region:i}}))}})},gp=(e,t)=>{const r=K(Un,t.width),o=K(Un,t.height);switch(e){case"ArrowLeft":return{x:-r,y:0};case"ArrowRight":return{x:r,y:0};case"ArrowUp":return{x:0,y:-o};case"ArrowDown":return{x:0,y:o};default:return null}},vp={"top-left":"diagonalDown","bottom-right":"diagonalDown","top-right":"diagonalUp","bottom-left":"diagonalUp"},xp=e=>{const t=fe(),r=bp(t),o=Sp(t);if(r===null)return null;const a=o.resizedRegion??(r.region.anchorType==="panel"?r.region:null);return a===null?null:(0,n.jsx)(fp,{shape:r,region:a,settled:o.resizedRegion===null&&!o.moving,moving:o.moving,...e})},fp=({shape:e,region:t,settled:r,moving:o,panelRect:a,frameRect:i,frameElement:s})=>{const c=l.useI18n(),d=hp({annotationId:e.id,panelRect:a}),h=mp({annotationId:e.id,panelRect:a}),p=l.useStyleReaderTree().annotation.shape(e.id).resolve(),{rect:m}=l.measureShapeRegion(Kt(t),p.strokeWidth,a);return(0,n.jsxs)("div",{"data-testid":"shape-selection","data-annotation-id":e.id,children:[r&&(0,n.jsx)(dp,{shape:e,shapeBox:m,panelRect:a,frameWidth:i.width,frameHeight:i.height,frameElement:s}),!o&&U0.map(g=>{const f=q0(m,g);return(0,n.jsx)(ta,{point:{x:a.x+f.x,y:a.y+f.y},label:c(`graph.annotations.shapeToolbar.resize.${g}`),pull:vp[g],size:"md",attributes:{"data-testid":"shape-resize-handle","data-corner":g},dragHandlers:d(g),keyboardHandlers:h(g)},g)})]})},bp=e=>{const t=l.useSceneSelector(r=>r.spec.annotations.shapes);return e===null?null:t.find(r=>r.id===e)??null},Sp=e=>l.useEditorState((0,J.useShallow)(t=>e===null?{resizedRegion:null,moving:!1}:{resizedRegion:l.readResizedShapeFor(l.readStanding(t,"shape-resize-drag"),e)?.region??null,moving:l.readMovedAnnotationFor(l.readStanding(t,"move-drag"),e)!==null})),yp=({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 ze="textStyle",oa=new Set(["paragraph","heading"]),Cp=e=>{const t=aa(e),r=Pp(e);return{color:Pe(t.map(o=>Lp(dt(o)?.color))),font:Pe(t.map(o=>kp(dt(o)))),fontSize:Pe(t.map(o=>Ip(dt(o)?.fontSize))),alignment:Pe(r.map(o=>Ep(o.attrs?.textAlign)))}},jp=(e,t)=>Xt(e,r=>r.type==="text"?Ap(r,t):r),wp=e=>aa(e).length>0,Tp=(e,t)=>Xt(e,r=>oa.has(r.type??"")?{...r,attrs:{...r.attrs,textAlign:t}}:r),Xt=(e,t)=>t(e.content===void 0?e:{...e,content:e.content.map(r=>Xt(r,t))}),Ap=(e,t)=>{const r=e.marks??[],o=r.find(i=>i.type===ze),a={type:ze,attrs:{...o?.attrs,...t}};return{...e,marks:o===void 0?[...r,a]:r.map(i=>i===o?a:i)}},dt=e=>e.marks?.find(t=>t.type===ze)?.attrs,kp=e=>l.readRichTextFontId(e?.font)??l.readRichTextFontId(e?.fontFamily),aa=e=>Zt(e,t=>t.type==="text"),Pp=e=>Zt(e,t=>oa.has(t.type??"")),Zt=(e,t)=>[...t(e)?[e]:[],...(e.content??[]).flatMap(r=>Zt(r,t))],Pe=e=>{const[t,...r]=e;return t===void 0?null:r.every(o=>o===t)?t:null},Lp=e=>typeof e=="string"&&e.length>0?e:void 0,Ip=e=>typeof e=="number"&&Number.isFinite(e)?e:void 0,Ep=e=>e==="left"||e==="center"||e==="right"?e:void 0;var ia=[{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})),Mp=e=>ia.find(t=>t.id===(e??"modern"))??null;var sa=[{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"}],Rp=e=>sa.find(t=>t.size===(e??15))??null,Op=e=>`${e}px`,_p=[{alignment:"left",Icon:Wr},{alignment:"center",Icon:Hr},{alignment:"right",Icon:Vr}],Np=({annotation:e,textBox:t,panelRect:r,frameWidth:o,frameHeight:a,frameElement:i})=>{const s=l.useI18n(),{commands:c}=l.useGraphContext(),d=l.useSceneSelector(y=>y.spec.styles.overrides),h=l.useSceneSelector(y=>(0,u.readStyleCoord)(y.spec)),p=l.useEditorStore(),m=Xe(),g=l.useStyleReaderTree().annotation.text(e.id).resolve(),f=Cp(e.content),x=Mp(f.font),b=Rp(f.fontSize),S=f.color??g.textColor,j=(0,v.useMemo)(()=>({target:"annotation",kind:"text",annotation:e.id}),[e.id]),L=(y,M)=>{const D=(0,u.findStyleRule)(d,{select:j},h)?.declarations??{};c.dispatch(new u.SetStyleRuleCommand({list:"overrides",rule:{select:j,declarations:{...D,...y}}}),M)},A=(y,M)=>{c.dispatch(new u.UpdateAnnotationCommand({kind:"text",id:e.id,patch:y}),M)},w=()=>p.getState().caret?.editor?.getJSON()??e.content,I=(y,M)=>{const D=w(),$=p.getState().caret?.editor??null;if($!==null&&!wp(D)){$.chain().focus().setMark(ze,y).run();return}A({content:jp(D,y)},M)},T=()=>{c.dispatch(new u.RemoveAnnotationCommand({id:e.id})),i.focus({preventScroll:!0})},P=y=>L(Dp(y),{transient:!0}),N=y=>I({color:y},{transient:!0}),V=y=>()=>{I({font:y}),m.close()},R=y=>()=>{I({fontSize:y}),m.close()},C=y=>A({content:Tp(w(),y)});return(0,n.jsxs)(_.Root,{anchorBox:t,panelRect:r,frameWidth:o,frameHeight:a,label:s("graph.annotations.textToolbar.label"),testId:"text-toolbar",children:[(0,n.jsx)(_.ColorPicker,{color:(0,u.toPaintColor)(g.fill),label:s("graph.annotations.textToolbar.background"),hasTransparentOption:!0,onChange:P,...m.bind("background"),children:(0,n.jsx)(_.Swatch,{color:g.fill==="transparent"?ys:(0,u.toPaintColor)(g.fill)})}),(0,n.jsx)(_.ColorPicker,{color:S,label:s("graph.annotations.textToolbar.color"),onChange:N,...m.bind("color"),children:(0,n.jsx)(yp,{size:"sm",textColor:S,title:""})}),(0,n.jsx)(_.Dropdown,{label:s("graph.annotations.textToolbar.font.ariaLabel"),trigger:(0,n.jsx)("span",{style:{fontFamily:x?.fontFamily},children:"Aa"}),...m.bind("font"),children:ia.map(y=>(0,n.jsx)(_.MenuItem,{selected:y.id===x?.id,onClick:V(y.id),children:(0,n.jsx)("span",{style:{fontFamily:y.fontFamily},children:s(y.key)})},y.id))}),(0,n.jsx)(_.Dropdown,{label:s("graph.annotations.textToolbar.fontSize.ariaLabel"),trigger:b===null?"":s(b.key),...m.bind("fontSize"),children:sa.map(y=>(0,n.jsx)(_.MenuItem,{selected:y.size===b?.size,onClick:R(y.size),children:(0,n.jsx)("span",{style:{fontSize:Op(y.size)},children:s(y.key)})},y.size))}),(0,n.jsx)(_.Separator,{}),(0,n.jsx)(Fp,{current:f.alignment??"center",onPick:C}),(0,n.jsx)(_.Separator,{}),(0,n.jsx)(_.IconButton,{label:s("graph.annotations.textToolbar.remove"),onClick:T,children:(0,n.jsx)(Ke,{size:"sm",title:""})})]})},Dp=e=>e==="transparent"?{fill:mr}:{fill:e,fillAlpha:ks(e)?u.TEXT_ANNOTATION_FADE_ALPHA:1},Fp=({current:e,onPick:t})=>{const r=l.useI18n(),o=a=>()=>t(a);return(0,n.jsx)(n.Fragment,{children:_p.map(a=>(0,n.jsx)(_.ToggleButton,{label:r(`graph.annotations.textToolbar.align.${a.alignment}`),pressed:a.alignment===e,onClick:o(a.alignment),children:(0,n.jsx)(a.Icon,{size:"sm",title:""})},a.alignment))})},Bp=["left","right"];var la=({width:e})=>K(60,e),zp=(e,t)=>({x:t==="left"?e.x:e.x+e.width,y:e.y+e.height/2}),ca=({at:e,width:t,align:r,edge:o,delta:a,minWidth:i,panelWidth:s})=>{if(a===0)return{at:e,width:t,shift:0};const c=(0,u.alignUnitFractions)(r).x,d=Gp(e.offset,s),h=Tt({start:e.x+d-c*t,extent:t,moveStartEdge:o==="left",delta:a,minExtent:i}),p=h.start+c*h.extent-d;return{at:{...e,x:p},width:h.extent,shift:p-e.x}},da=(e,t)=>e.at.x===t.at.x&&e.width===t.width,Gp=(e,t)=>e?.x===void 0?0:e.unit==="px"?K(e.x,t):e.x,Ge=(e,t)=>{const r=e.textAnnotations.find(o=>o.id===t);return r===void 0||r.at.anchorType!=="panel"?null:{at:r.at,width:r.width,align:r.align}},Hp=class extends be{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:o,readInputs:a}=this.params,{annotations:i,panelRect:s}=a(),c=Ge(i,t);if(c===null)return null;const d=Ze(o,e,s).x;return{kind:"text-resize-drag",annotationId:t,delta:d,...ca({...c,edge:r,delta:d,minWidth:la(s),panelWidth:s.width})}}commit(e){const{annotationId:t,dispatch:r,readInputs:o}=this.params,a=Ge(o().annotations,t);a===null||da(a,e)||r(new u.UpdateAnnotationCommand({kind:"text",id:t,patch:{at:e.at,width:e.width}}))}},Vp=({annotationId:e,panelRect:t})=>{const{commands:r}=l.useGraphContext(),o=l.useEditorStore(),a=l.useLatestRef({annotations:l.useSceneSelector(i=>i.spec.annotations),panelRect:t});return na((i,s)=>new Hp({...s,annotationId:e,edge:i,readInputs:()=>a.current,editorStore:o,dispatch:r.dispatch}))},Wp=4,$p=({annotationId:e,panelRect:t})=>{const{commands:r}=l.useGraphContext(),o=l.useEditorStore(),a=l.useSceneSelector(s=>s.spec.annotations),i=(s,c)=>{const d=Ge(a,e);return d===null?null:{kind:"text-resize-drag",annotationId:e,delta:c,...ca({...d,edge:s,delta:c,minWidth:la(t),panelWidth:t.width})}};return ra({readHeld:()=>l.readResizedTextFor(l.readStanding(o.getState(),"text-resize-drag"),e),claim:s=>i(s,0),step:(s,c,d)=>{const h=Up(d,t);return h===null?null:i(c,s.delta+h)},commit:s=>{const c=Ge(a,e);c===null||da(c,s)||r.dispatch(new u.UpdateAnnotationCommand({kind:"text",id:e,patch:{at:s.at,width:s.width}}))}})},Up=(e,t)=>{const r=K(Wp,t.width);switch(e){case"ArrowLeft":return-r;case"ArrowRight":return r;default:return null}},qp=e=>{const t=fe(),r=Xp(t),o=Zp(t),a=l.useEditorState(s=>s.caret?.annotationId===t),i=Yp(e.panelRect,t,o.resized);return r===null||i===null?null:(0,n.jsx)(Kp,{annotation:r,textBox:i,settled:o.resized===null&&!o.moving,moving:o.moving,resizable:r.at.anchorType==="panel",hasCaret:a,...e})},Kp=({annotation:e,textBox:t,settled:r,moving:o,resizable:a,hasCaret:i,panelRect:s,frameRect:c,frameElement:d})=>{const h=l.useI18n(),p=Vp({annotationId:e.id,panelRect:s}),m=$p({annotationId:e.id,panelRect:s});return(0,n.jsxs)("div",{"data-testid":"text-selection","data-annotation-id":e.id,children:[r&&(0,n.jsx)(Np,{annotation:e,textBox:t,panelRect:s,frameWidth:c.width,frameHeight:c.height,frameElement:d}),a&&!o&&!i&&Bp.map(g=>{const f=zp(t,g);return(0,n.jsx)(ta,{point:{x:s.x+f.x,y:s.y+f.y},label:h(`graph.annotations.textToolbar.resize.${g}`),pull:"horizontal",size:"sm",attributes:{"data-testid":"text-resize-handle","data-edge":g},dragHandlers:p(g),keyboardHandlers:m(g)},g)})]})},Xp=e=>{const t=l.useSceneSelector(r=>r.spec.annotations.textAnnotations);return e===null?null:t.find(r=>r.id===e)??null},Zp=e=>l.useEditorState((0,J.useShallow)(t=>e===null?{resized:null,moving:!1}:{resized:l.readResizedTextFor(l.readStanding(t,"text-resize-drag"),e),moving:l.readMovedAnnotationFor(l.readStanding(t,"move-drag"),e)!==null})),Yp=(e,t,r)=>{const o=l.useResolvedAnnotations(e),a=l.useMeasuredBoxes(),i=l.useStyleReaderTree(),s=(0,v.useMemo)(()=>({panel:{width:e.width,height:e.height},measuredBoxes:a,readers:i}),[e.width,e.height,a,i]);return t===null?null:ea(o,t,r,s)?.rect??null},Jp=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"})]})}),Qp="var(--_1tyillx0)",e1="var(--_1tyillx1)",t1={rest:.5,hovered:.75,open:1};var n1="_1tyillx2",r1={rest:"_1tyillx3",hovered:"_1tyillx4",open:"_1tyillx5"},o1="_1tyillx6",a1={closed:"_1tyillx7",open:"_1tyillx8"},i1=({interaction:e,panelRect:t})=>{const r=l.useEditorStore(),o=l.useStyleReaderTree().editOutline.selected().resolve().stroke,a=e.kind==="trigger"||e.kind==="menu"?e.anchor:null,i=s1(e),s=(0,v.useMemo)(()=>{if(a===null)return null;const c=(0,u.projectAnchorToPanel)(a.position,t);return{center:c,radius:19*t1[i],target:{kind:"observation",cursor:(0,u.toPanelCursor)(c,t)}}},[a,t,i]);return(0,v.useEffect)(()=>{r.getState().setMenuTrigger(s)},[r,s]),(0,v.useEffect)(()=>()=>r.getState().setMenuTrigger(null),[r]),a===null||s===null?null:(0,n.jsx)("div",{"aria-hidden":"true","data-testid":"observation-menu-trigger","data-state":i,className:(0,U.default)(n1,r1[i]),style:{left:t.x+s.center.x,top:t.y+s.center.y,...(0,Y.assignInlineVars)({[Qp]:a.color,[e1]:o})},children:(0,n.jsx)("span",{className:(0,U.default)(o1,a1[i==="open"?"open":"closed"]),children:(0,n.jsx)(Jp,{size:"lg"})})})},s1=e=>e.kind==="menu"?"open":e.kind==="trigger"&&e.engaged?"hovered":"rest",l1='button:not([disabled]):not([tabindex="-1"]), [tabindex]:not([tabindex="-1"])',c1=(e,t)=>{const{chartId:r}=l.useGraphContext(),o=l.useEditorStore();(0,v.useEffect)(()=>{if(t===null)return;const a=i=>{if(i.key!=="Tab"||i.defaultPrevented||!pe(i.target,e,r)||br(i.target)||o.getState().standingInteraction?.kind==="chrome-popup")return;const s=[...t.querySelectorAll(l1)];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",a),()=>document.removeEventListener("keydown",a)},[e,t,r,o])},d1=(e,t)=>typeof document.elementsFromPoint=="function"?document.elementsFromPoint(e,t):[],ua=(e,t,r)=>l.readStampedEditTargetInStack(d1(e,t),r),u1=e=>{const{selectionStore:t,chartId:r}=l.useGraphContext(),o=l.useEditorStore();(0,v.useEffect)(()=>{let a=null;const i=d=>{const{caret:h}=o.getState(),p=h===null?null:ua(d.clientX,d.clientY,e);p?.kind==="annotation"&&p.target.id===h?.annotationId||e.focus({preventScroll:!0})},s=d=>{const{selection:h,clearSelection:p}=t.getState();h.length!==0&&(pe(d.target,e,r)||p())},c=d=>{t.getState().selection.length!==0&&pe(d.target,e,r)&&d.relatedTarget===null&&(a!==null&&cancelAnimationFrame(a),a=requestAnimationFrame(()=>{a=null,document.hasFocus()&&(pe(document.activeElement,e,r)||t.getState().clearSelection())}))};return e.addEventListener("pointerdown",i),document.addEventListener("focusin",s),document.addEventListener("focusout",c),()=>{a!==null&&cancelAnimationFrame(a),e.removeEventListener("pointerdown",i),document.removeEventListener("focusin",s),document.removeEventListener("focusout",c)}},[o,t,e,r])},h1=(e,t)=>{switch(e.kind){case"legend":{const r=t.legends[e.part.legendIndex],o=r?.items[e.part.itemIndex];if(r===void 0||o===void 0)return null;const a=p1(r,o.layerId,t.layers);return a===null?null:(0,u.buildObservationsTargetAtValue)({layer:a.layer,scope:"series",variable:a.variable,value:o.value,parsingLocale:t.parsingLocale})}case"axis":{const r=e.part;if(r===null||e.target.axis!=="x")return null;const o=t.formattedAxes.find(i=>i.scaleAestheticKey==="x");if(o===void 0||o.bandwidth===void 0)return null;const a=o.ticks[r.tickIndex];return a===void 0?null:v1(t.layers,a.value,t.parsingLocale)}case"annotation":case"grid":return null}},p1=(e,t,r)=>{const o=t===void 0?r:r.filter(a=>a.id===t);for(const a of e.aesthetics){const i=m1(o,a);if(i!==null)return i}return null},m1=(e,t)=>{for(const r of e){const o=(0,u.readVariableName)(r.mapping[t]);if(o!==null&&g1(r,o))return{layer:r,variable:o}}return null},g1=(e,t)=>e.data.hasVariable(t)&&e.data.getType(t)==="categorical",v1=(e,t,r)=>{let o=null;for(const a of e){if(!a.interactive)continue;const i=(0,u.readScopeXVariable)(a.mapping);if(i===null)continue;const s=(0,u.buildObservationsTargetAtValue)({layer:a,scope:"x-value",variable:i,value:t,parsingLocale:r});if(s!==null){if(o!==null)return null;o=s}}return o},x1=({hover:e,layers:t,scales:r,parsingLocale:o})=>{const{primary:a,intersection:i}=e;if(a===null)return null;const s=(0,u.findLayerById)(t,a.layerId);if(s===void 0)return null;const c=(0,u.readObservationIndex)(a),d=i?.intersects!==!1,h=(0,u.readBroadestObservationsScope)(s),p=d||!(0,u.hasMainAxisBand)(r)?[h]:["x-value",h];for(const m of p){const g=(0,u.buildObservationsTarget)({layer:s,observationIndex:c,scope:m,parsingLocale:o});if(g!==null)return{layerId:s.id,observationIndex:c,onObservation:d,target:g}}return null},f1=(e,t,r)=>{if(!e.onObservation||e.target.scope!=="series")return null;const o=(0,u.findLayerById)(t,e.layerId);return o===void 0?null:(0,u.buildObservationsTarget)({layer:o,observationIndex:e.observationIndex,scope:"data-point",parsingLocale:r})},ha=(e,t)=>{const{target:r,clientX:o,clientY:a}=e,{frameElement:i,captureRect:s,menuTrigger:c,panelOrigin:d,resolvesObservations:h,scene:p}=t,m=c!==null&&(0,u.isPointWithinEditMenuTrigger)({x:o-d.x,y:a-d.y},c);if(!(r instanceof Element&&i.contains(r)))return{targetAtPoint:l.resolveEditTargetAtPoint({overMenuTrigger:m,stamped:qn(!1,!1,e,t),observations:null}),hover:null};const g=s!==null&&r===s,f=g&&h?b1(s):null,x=f===null?null:y1(e,f,t),b=x===null?null:x1({hover:x,layers:p.layers,scales:p.scales,parsingLocale:p.config.parsingLocale}),S=b!==null&&t.hasOverlayMenu(b.target)?b:null,j=l.resolveEditTargetAtPoint({overMenuTrigger:m,stamped:qn(g,S!==null,e,t),observations:S});return{targetAtPoint:j,hover:j?.kind==="observations"?x:null}},b1=e=>{const t=e.getBoundingClientRect();return t.width>0&&t.height>0?t:null},qn=(e,t,r,{paintsAnnotations:o,resolvesGuides:a,frameElement:i,scene:s,hasOverlayMenu:c})=>{if(!o&&s.coordSystem.type==="cartesian"&&e&&t)return null;const d=e||o?ua(r.clientX,r.clientY,i):S1(r.target,i);return d===null?null:(d.kind==="annotation"?o:a&&c(d.target))?d:null},S1=(e,t)=>e instanceof Element?l.readStampedEditTargetInStack([e],t):null,y1=(e,t,r)=>{const o=(0,u.toPanelCursor)({x:e.clientX-t.left,y:e.clientY-t.top},t);return r.engine.query(o,{tolerance:r.tolerance,viewport:t,includeAttached:!0})},C1=class extends be{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:o}=this.params,{annotations:a,panelRect:i}=o(),s=(0,u.findAnnotation)(a,t);if(s===null)return null;const c=(0,u.clampAnnotationTranslation)(s,Ze(r,e,i));return c===null?null:{kind:"move-drag",annotationId:t,translation:c}}commit({translation:e}){const{annotationId:t,dispatch:r}=this.params;l0(e)&&r(new u.MoveAnnotationCommand({id:t,translation:e}))}},j1=(e,{canSelectGraph:t,withinFrame:r,caretAnnotationId:o})=>{switch(e?.kind){case"annotation":return e.target.id===o?{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 w1(e.observations);case"menu-trigger":case void 0:break}return t&&r?{kind:"select-graph",target:{kind:"graph"}}:{kind:"clear"}},w1=({target:e,observationIndex:t,onObservation:r})=>e.scope==="x-value"?{kind:"select-band",target:e}:{kind:"select-observations",target:e,observationIndex:r?t:null},T1=(e,t,r,o,a)=>{const{commands:i,selectionStore:s,store:c}=l.useGraphContext(),d=l.useEditorStore(),h=l.useSceneSelector(S=>S.spec.annotations),p=l.MODE_SURFACES[l.useGraphMode()],m=l.useLatestRef(p.graphPress),g=l.useLatestRef({annotations:h,panelRect:r}),f=l.useLatestRef(t),x=l.useLatestRef(a),b=(0,v.useRef)(null);(0,v.useEffect)(()=>()=>b.current?.finish(!1),[]),(0,v.useEffect)(()=>s.subscribe(({selection:S})=>{const j=d.getState().pressedObservation,[L,...A]=S,w=L!==void 0&&A.length===0&&j!==null&&(0,u.areEditTargetsEqual)(L,j.selectedFor);j!==null&&!w&&d.getState().setPressedObservation(null)}),[d,s]),(0,v.useEffect)(()=>{const S=T=>ha({target:T.target,clientX:T.clientX,clientY:T.clientY},o()).targetAtPoint,j=T=>{if(!(T.target instanceof Element))return!1;const P=T.target.closest(l.LEGEND_OVERFLOW_CONTROL_SELECTOR);return P!==null&&e.contains(P)&&l.readStampedEditTargetInStack([T.target],e)===null},L=(T,P)=>{if(b.current!==null||!l.canMoveAnnotationOnCanvas(g.current.annotations,P.id))return;try{e.setPointerCapture(T.pointerId)}catch{return}T.preventDefault();const N=new C1({handle:e,pointerId:T.pointerId,annotationId:P.id,press:{x:T.clientX,y:T.clientY},readInputs:()=>g.current,editorStore:d,dispatch:i.dispatch,onSettled:()=>{b.current=null}});b.current=N,N.start()},A=(T,P)=>{const N=s.getState(),{layers:V,config:R}=c.getState().scene,C=P.kind==="select-observations"&&P.observationIndex!==null?l.readPressedObservation(P.observationIndex,V,P.target,R.parsingLocale):null;switch(d.getState().setPressedObservation(C),P.kind){case"select-annotation":N.setSelection([P.target]),L(T,P.target);return;case"select-observations":case"select-band":case"select-guide":case"select-graph":N.setSelection([P.target]);return;case"clear":N.clearSelection();return;default:throw new u.InternalError({message:`No press outcome for: ${JSON.stringify(P)}`})}},w=T=>{if(T.button!==0||ht(T.target)||Sr(T,f.current,d.getState().menuTrigger)||j(T)||l.isOnLiveGeomMark(T.target,e))return;const P=j1(S(T),{canSelectGraph:m.current&&o().hasOverlayMenu({kind:"graph"}),withinFrame:T.target instanceof Node&&e.contains(T.target),caretAnnotationId:d.getState().caret?.annotationId??null});P.kind!=="keep-caret"&&(d.getState().setCaret(null),A(T,P))},I=T=>{if(ht(T.target)||j(T)||l.isOnLiveGeomMark(T.target,e))return;const P=S(T),{layers:N,guides:V,config:R}=c.getState().scene,{hasOverlayMenu:C}=o(),y=s.getState(),M=d.getState();switch(P?.kind){case"observations":{const{observations:D}=P,$=f1(D,N,R.parsingLocale);if($===null||!C($))return;const{observationIndex:et}=D;M.setPressedObservation({observationIndex:et,predicate:$.predicate,selectedFor:$}),y.setSelection([$]);return}case"axis":case"legend":{const D=h1(P,{layers:N,legends:V.legends.drawn,formattedAxes:x.current,parsingLocale:R.parsingLocale});if(D===null||!C(D))return;y.setSelection([D]);return}case"annotation":{const{target:D}=P;if(!g.current.annotations.textAnnotations.some($=>$.id===D.id))return;y.setSelection([D]),M.setCaret(D.id);return}case"grid":case"menu-trigger":case void 0:return}};return document.addEventListener("pointerdown",w),document.addEventListener("dblclick",I),()=>{document.removeEventListener("pointerdown",w),document.removeEventListener("dblclick",I)}},[e,d,s,c,i,g,f,x,m,o])},A1=e=>{const{selectionStore:t,commands:r,chartId:o}=l.useGraphContext(),a=l.useEditorStore(),i=l.useLatestRef(l.useSceneSelector(p=>p.spec.annotations.textAnnotations)),{annotations:s}=l.MODE_SURFACES[l.useGraphMode()],c=(0,v.useCallback)(p=>{const{selection:m}=t.getState(),g=s?wt(m):null;g!==null&&(p.preventDefault(),r.dispatch(new u.RemoveAnnotationCommand({id:g})),e.focus({preventScroll:!0}))},[e,r,t,s]),d=(0,v.useCallback)(p=>{if(Ie(p.target,o))return;const m=s?wt(t.getState().selection):null;m!==null&&i.current.some(g=>g.id===m)&&(p.preventDefault(),a.getState().setCaret(m))},[a,t,i,o,s]),h=(0,v.useCallback)(p=>{const m=a.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 Ie(p.target,o)?e.focus({preventScroll:!0}):t.getState().clearSelection()},[a,t,e,o]);(0,v.useEffect)(()=>{const p=m=>{if(!pe(m.target,e,o)||br(m.target))return;const g=k1(m.target),f=a.getState().caret!==null&&!Ie(m.target,o);if(!(g&&!f))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",p),()=>document.removeEventListener("keydown",p)},[e,c,d,h,o,a])},k1=e=>e instanceof HTMLElement&&(e.isContentEditable||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement),P1=(e,t)=>{const r=l.useEditorStore(),{store:o}=l.useGraphContext(),{engine:a,overlayRef:i}=l.useHoverContext(),s=l.useLatestRef(t),{annotations:c,observationsPress:d,guidePress:h,tolerance:p}=l.MODE_SURFACES[l.useGraphMode()],m=l.useIsIntroWaitingForView(),g=qe(),f=d&&!m;return(0,v.useCallback)(()=>({frameElement:e,captureRect:i.current,panelOrigin:s.current,menuTrigger:r.getState().menuTrigger,resolvesGuides:h,paintsAnnotations:c,resolvesObservations:f,engine:a,tolerance:p??void 0,scene:o.getState().scene,hasOverlayMenu:g}),[g,e,i,s,r,h,c,f,a,p,o])},L1=()=>{const e=l.MODE_SURFACES[l.useGraphMode()].observationMenu,t=l.useHoverState(s=>e?s.hover.primary:null),{layers:r,coordSystem:o}=l.useSceneSelector((0,J.useShallow)(s=>({layers:s.layers,coordSystem:s.coordSystem}))),{anchorResolver:a}=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=a.resolve(s.geom,t.observation,{coordSystem:o,position:s.position,purpose:"pin"});if(c===null)return null;const d=(0,u.createObservationAnchorBuilder)(s)(t.observation);return d===null?null:{position:c,color:(0,u.readGeomColor)({geom:i},s,t.observation)??u.DEFAULT_GEOM_COLOR,layer:s,at:d,observation:t.observation}},[t,r,o,a,i])},I1={kind:"idle"},pa=()=>{const e=l.useEditorState(o=>o.standingInteraction),t=l.useEditorState(o=>o.editTargetUnderPointer?.kind==="menu-trigger"),r=L1();return(0,v.useMemo)(()=>e!==null?e:r===null?I1:{kind:"trigger",anchor:r,engaged:t},[e,r,t])},E1=(e,t)=>e.x>=0&&e.x<=t.width&&e.y>=0&&e.y<=t.height,M1=(e,t,r)=>{const o=l.useEditorStore(),{selectionStore:a}=l.useGraphContext(),{store:i,engine:s}=l.useHoverContext(),c=l.useLatestRef(e),d=l.useLatestRef(t),h=l.useLatestRef(r);(0,v.useEffect)(()=>{const p=b=>Sr(b,d.current,o.getState().menuTrigger),m=b=>{if(p(b)||a.getState().selection.length>0)return;const S=h.current,j=d.current,L={x:b.clientX-j.x,y:b.clientY-j.y},A=E1(L,S)?s.query((0,u.toPanelCursor)(L,S)):u.RESTING_HOVER_STATE;i.getState().setHoverState(A)};let g=!1;const f=()=>{g=c.current.kind==="menu"},x=b=>{if(ht(b.target))return;const{claimInteraction:S,releaseInteraction:j}=o.getState();if(!p(b)||g){j("menu"),g&&m(b);return}const L=c.current;L.kind==="trigger"&&S({kind:"menu",anchor:L.anchor})};return document.addEventListener("pointerdown",f,!0),document.addEventListener("click",x),()=>{document.removeEventListener("pointerdown",f,!0),document.removeEventListener("click",x)}},[o,a,c,i,s,d,h])},R1=(e,t,r)=>{const o=l.useEditorStore(),{store:a}=l.useGraphContext(),{store:i}=l.useHoverContext(),s=l.useLatestRef(t),c=l.MODE_SURFACES[l.useGraphMode()].observationsPress;(0,v.useEffect)(()=>(i.getState().setEditorOwnsQuery(c),()=>i.getState().setEditorOwnsQuery(!1)),[i,c]),(0,v.useEffect)(()=>{let d=null,h=null,p=!1;const m=w=>{if(!c)return;const I=i.getState();I.suspendsHover||w===null&&I.hover.primary===null||I.setHoverState(w??u.RESTING_HOVER_STATE)},g=()=>{if(d=null,h===null)return;const w=o.getState();if(Le(w.standingInteraction)){const P=w.menuTrigger!==null&&(0,u.isPointWithinEditMenuTrigger)({x:h.clientX-s.current.x,y:h.clientY-s.current.y},w.menuTrigger),N=w.editTargetUnderPointer;P?w.setEditTargetUnderPointer({kind:"menu-trigger"}):N?.kind==="menu-trigger"&&w.setEditTargetUnderPointer(null);return}if(p&&(p=!1,h={...h,target:O1(h)}),l.isOnLiveGeomMark(h.target,e)){w.setEditTargetUnderPointer(null);return}const{targetAtPoint:I,hover:T}=ha(h,r());w.setEditTargetUnderPointer(I),m(T)},f=()=>{d===null&&(d=requestAnimationFrame(g))},x=()=>{h!==null&&(p=!0,f())},b=()=>{o.getState().setEditTargetUnderPointer(null),m(null)},S=w=>{h={target:w.target,clientX:w.clientX,clientY:w.clientY},p=!1,f()},j=()=>{h=null,d!==null&&(cancelAnimationFrame(d),d=null),b()},L=o.subscribe((w,I)=>{Le(I.standingInteraction)&&!Le(w.standingInteraction)&&x()}),A=a.subscribe((w,I)=>{w.scene!==I.scene&&(Le(o.getState().standingInteraction)||x())});return e.addEventListener("pointermove",S),e.addEventListener("pointerleave",j),()=>{d!==null&&cancelAnimationFrame(d),L(),A(),e.removeEventListener("pointermove",S),e.removeEventListener("pointerleave",j),b()}},[e,o,a,i,s,c,r])},O1=e=>typeof document.elementFromPoint=="function"?document.elementFromPoint(e.clientX,e.clientY):e.target,Le=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}},Kn="editor",Xn=[],_1=(e,t,r,o,a)=>{const i=pa(),{store:s}=l.useHoverContext(),c=l.useGraphSelection().length>0,d=l.MODE_SURFACES[l.useGraphMode()].holdsHoverWhileSelected,h=l.useEditorState(x=>x.menuTrigger),p=i.kind==="menu",m=(0,v.useMemo)(()=>h===null?Xn:[(0,u.buildEditMenuTriggerRegion)(h)],[h]),g=P1(e,t);R1(e,t,g),T1(e,t,r,g,a),M1(i,t,r),u1(e),A1(e),c1(e,o),(0,v.useEffect)(()=>(s.getState().publishPointerRegions(Kn,m),()=>s.getState().publishPointerRegions(Kn,Xn)),[s,m]);const f=p||c&&d;(0,v.useEffect)(()=>(s.getState().setSuspendsHover(f),()=>s.getState().setSuspendsHover(!1)),[s,f]),(0,v.useEffect)(()=>{if(!c||!d)return;const x=s.getState();x.setHoverState(u.RESTING_HOVER_STATE),x.setTooltipAnchor(null)},[s,c,d])},N1=({frameElement:e,panelRect:t,formattedAxes:r,animateTransitions:o})=>{const{measureRef:a,screenRect:i}=l.useElementScreenRect(),{selectionStore:s}=l.useGraphContext(),c=l.useEditorStore(),d=l.useEditorState(m=>m.caret?.annotationId??null),h=l.useGraphMode(),p=(0,v.useRef)(h);return(0,v.useEffect)(()=>(a(e),()=>a(null)),[a,e]),(0,v.useEffect)(()=>()=>{const m=c.getState();m.releaseInteraction("menu"),m.setCaret(null),m.setPressedObservation(null)},[c]),(0,v.useEffect)(()=>{if(p.current===h)return;p.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)(Ei,{children:[d!==null&&(0,n.jsx)(D1,{annotationId:d,panelRect:t}),(0,n.jsx)(F1,{frameElement:e,frameRect:i,panelRect:t,formattedAxes:r,animateTransitions:o})]})},D1=({annotationId:e,panelRect:t})=>{const r=l.useEditorStore(),{textAnnotations:o}=l.useResolvedAnnotations(t);return(0,v.useEffect)(()=>{o.some(({id:a})=>a===e)||r.getState().setCaret(null)},[e,o,r]),null},F1=({frameElement:e,frameRect:t,panelRect:r,formattedAxes:o,animateTransitions:a})=>{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 _1(e,i,r,s,o),(0,n.jsx)(B1,{frameElement:e,frameRect:t,panelOrigin:i,panelRect:r,boxRef:c,animateTransitions:a})},B1=({frameElement:e,frameRect:t,panelOrigin:r,panelRect:o,boxRef:a,animateTransitions:i})=>{const s=se(),c=pa(),{annotations:d,editOutline:h,overlayMenu:p}=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)(nu,{frameElement:e,frameSize:m,panelRect:o,animateTransitions:i}),(0,n.jsx)(Zu,{frameRect:t})]}),(0,n.jsx)(zl,{rect:t,zIndex:l.Z_INDEX.editorOverlay,container:s,"data-testid":"editor-overlay",boxRef:a,children:(0,n.jsxs)(l.PortalThemeProvider,{children:[d&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(V0,{panelRect:o,panelOrigin:r,frameRect:t,frameElement:e}),(0,n.jsx)(xp,{panelRect:o,frameRect:t,frameElement:e}),(0,n.jsx)(g0,{panelRect:o,frameRect:t,frameElement:e}),(0,n.jsx)(qp,{panelRect:o,frameRect:t,frameElement:e}),(0,n.jsx)(J0,{panelRect:o}),(0,n.jsx)(ap,{panelRect:o}),(0,n.jsx)(Nh,{panelRect:o}),(0,n.jsx)(Y0,{panelRect:o})]}),(0,n.jsx)(i1,{interaction:c,panelRect:o}),(0,n.jsx)(Eh,{interaction:c,frameElement:e,panelRect:o}),p&&(0,n.jsx)(Ku,{frameElement:e})]})})]})},z1={},G1=({slots:e,mode:t,palettePresets:r=z1,editMenus:o,...a})=>(0,n.jsx)(Rt,{locale:l.useGraphLocale(),children:(0,n.jsx)(Rd,{editMenus:o,children:(0,n.jsx)(l.EditorProvider,{children:(0,n.jsx)(ld,{value:r,children:(0,n.jsx)(l.InlineEditorsProvider,{editors:Fl,children:(0,n.jsx)(l.GraphRendererBody,{slots:(0,v.useMemo)(()=>({EditorSurface:N1,...e}),[e]),mode:t,...a})})})})})}),H1="_12lhx9e0",ma=({children:e})=>(0,n.jsx)("div",{className:H1,children:e}),V1="_139ohwv0",W=({children:e})=>(0,n.jsx)("div",{className:V1,children:e}),ga=(0,v.createContext)(null),W1=ga.Provider,va=()=>{const e=(0,v.useContext)(ga);if(!e)throw new Error("A section must be rendered inside <EditorPanel.Root>.");return e},$1="_1jlczkt0",xa="data-graphy-editor-panel",U1={List:W,Grid:ma};function q1(e){if(e===void 0)return!1;const t=e.split(/\s+/);return t.includes("_1ii3bsb0")||t.includes("_1ii3bsb1")}var K1=()=>()=>{},X1=e=>{const t=(0,v.useSyncExternalStore)(e?.store.subscribe??K1,()=>e?.store.getState().scene.config.parsingLocale);return e?.formattingLocale??t},Z1=e=>{const t=(0,v.useContext)(l.GraphContext),r=X1(t),o=l.useHasI18n(),a=l.useHasThemeContext();let i=(0,n.jsx)(Y1,{...e});return!a&&t&&(i=(0,n.jsx)(l.ThemeProvider,{colorScheme:t.colorScheme,children:i})),o||(i=(0,n.jsx)(Rt,{locale:r,children:i})),i},Yt={Root:Z1,Controls:U1},Y1=({handle:e,children:t,controls:r,defaultExpandedSection:o=void 0,className:a})=>{const i=l.useGraphHandle(e),{themeClass:s,inlineVarsStyle:c}=l.useThemeContext(),[d,h]=(0,v.useState)(()=>o?[o]:[]),p=(0,v.useMemo)(()=>({expandSection:m=>h([m]),collapseAllSections:()=>h([])}),[]);return(0,n.jsx)(Nt.Provider,{value:i,children:(0,n.jsx)(_r,{controls:r,children:(0,n.jsx)(W1,{value:p,children:(0,n.jsx)(ue.Accordion.Root,{[xa]:"",className:(0,U.default)($1,a,{[s]:!q1(a)}),style:c,value:d,onValueChange:m=>h(m),children:t})})})})},J1="_2m7wuq0",Q1=()=>(0,n.jsx)(ei.Separator,{className:J1}),em=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",Qt="_40zvwv1",tm="_40zvwv2",fa="_40zvwv3",nm="_40zvwv4 _40zvwv3";var rm="_40zvwv6";var om="_40zvwv8",z=({title:e,layout:t="fixed",preview:r,accessory:o,onOpenChange:a,children:i})=>t==="collapsible"?(0,n.jsx)(im,{title:e,preview:r,accessory:o,onOpenChange:a,children:i}):t==="inline"&&r===void 0?(0,n.jsx)(am,{title:e,accessory:o,children:i}):(0,n.jsxs)("div",{className:Jt,children:[(0,n.jsxs)("div",{className:Qt,children:[(0,n.jsx)("span",{className:fa,children:e}),r!==void 0&&(0,n.jsx)("span",{className:"_40zvwv5",children:r}),o!==void 0&&(0,n.jsx)("span",{className:"_40zvwv7",children:o})]}),(0,n.jsx)("div",{children:i})]}),am=({title:e,accessory:t,children:r})=>{const o=(0,v.useId)(),a=(0,v.useId)();return(0,n.jsx)("div",{className:Jt,children:(0,n.jsxs)("div",{className:Qt,children:[(0,n.jsx)("label",{id:o,htmlFor:a,className:nm,children:e}),(0,n.jsx)("span",{className:rm,children:(0,n.jsx)(ur,{labelId:o,controlId:a,children:r})}),t!==void 0&&(0,n.jsx)("span",{className:"_40zvwv7",children:t})]})})},im=({title:e,preview:t,accessory:r,onOpenChange:o,children:a})=>{const i=l.useI18n();return(0,n.jsxs)(ue.Accordion.Item,{value:e,className:Jt,onOpenChange:o,children:[(0,n.jsxs)(ue.Accordion.Header,{className:Qt,render:(0,n.jsx)("div",{}),children:[(0,n.jsx)(ue.Accordion.Trigger,{className:tm,"aria-label":i("editor.accessibility.toggleSection",{title:e})}),(0,n.jsx)("span",{className:fa,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:om,children:(0,n.jsx)(em,{size:"sm"})})]}),(0,n.jsx)(ue.Accordion.Panel,{children:(0,n.jsx)("div",{children:a})})]})},ba=({title:e,checked:t,onToggle:r,disabled:o,preview:a,children:i})=>{const{expandSection:s,collapseAllSections:c}=va(),{Switch:d}=O(),h=m=>{r(m),m?s(e):c()},p=m=>{m&&!t&&o!==!0&&r(!0)};return(0,n.jsx)(z,{title:e,layout:"collapsible",preview:a,onOpenChange:p,accessory:(0,n.jsx)(d,{checked:t,onChange:h,disabled:o,ariaLabel:e}),children:i})},sm={horizontal:["bottom","top"],vertical:["left","right"]},lm={left:"editor.axesPanel.position.left",right:"editor.axesPanel.position.right",top:"editor.axesPanel.position.top",bottom:"editor.axesPanel.position.bottom"},cm={x:"editor.axesPanel.mainAxisSection.xAxis",y:"editor.axesPanel.mainAxisSection.yAxis"},kt=({axis:e,title:t,layout:r="collapsible",preview:o})=>{const a=B(),i=l.useHandleScene(a),s=l.useI18n(),{NumberField:c,Switch:d,TextField:h,ToggleGroup:p}=O();if(!i)return null;const m=i.coordSystem.type==="polar"?i.coordSystem.axisMapping[e].geometry:"linear",g=i.config.axes[e],f=i.scales[e],x=f?.spec,b=x?.scaleType==="continuous"?x:void 0;if(m==="circular"||m==="radial"&&b===void 0)return null;const S=x!==void 0&&"reverse"in x?x:void 0,j=x?.scaleType==="continuous"||x?.scaleType==="datetime",L=b!==void 0&&(0,u.isZeroAnchoredAxis)(i,e),A=b?.transform==="log",w=b?.domainMax??null,I=dm(b),T=(E,X)=>E.map(ye=>({value:ye,label:X(ye)})),P=i.guides.axes.find(E=>E.scaleAestheticKey===e)?.position,N=sm[P==="bottom"||P==="top"||P===void 0&&e==="x"?"horizontal":"vertical"],V=e==="y"?(0,u.readComboLineLayerId)(i.spec):null,R=V===null?void 0:(0,u.findLayerById)(i.spec.layers,V),C=i.guides.legends.drawn.some(E=>N.some(X=>X===E.position)),y=N.map(E=>({value:E,label:s(lm[E])})),M=T(["auto","edges"],E=>s(E==="edges"?"editor.axesPanel.labelMode.edges":"editor.axesPanel.labelMode.auto")),D=T(["linear","log"],E=>s(E==="log"?"editor.axesPanel.scale.log":"editor.axesPanel.scale.auto")),$=T(["auto","zero","custom"],E=>s(E==="zero"?"editor.axesPanel.startFrom.zero":E==="custom"?"editor.axesPanel.startFrom.custom":"editor.axesPanel.startFrom.auto")),et=T(["auto","custom"],E=>s(E==="custom"?"editor.axesPanel.endAt.custom":"editor.axesPanel.endAt.auto")),La=T(["no","yes"],E=>s(E==="yes"?"editor.axesPanel.yesNo.yes":"editor.axesPanel.yesNo.no")),Ia=T(["single","double"],E=>s(E==="double"?"editor.axesPanel.axisCount.double":"editor.axesPanel.axisCount.single")),Ea=E=>{a.commands.dispatch(new u.SetAxisVisibilityCommand({axis:e,visible:E}))},Ma=E=>{a.commands.dispatch(new u.SetAxisLabelCommand({axis:e,label:E===""?null:E}),{transient:!0})},Ra=E=>{a.commands.dispatch(new u.SetAxisTicksVisibilityCommand({axis:e,visible:E}))},Oa=E=>{a.commands.dispatch(new u.SetAxisTickModeCommand({axis:e,tickMode:E==="edges"?"edges":"auto"}))},_a=E=>{a.commands.dispatch(new u.SetScaleReverseCommand({scaledAesthetic:e,reverse:E==="yes"}))},Na=E=>{a.commands.dispatch(new u.SetScaleTransformCommand({scaledAesthetic:e,transform:E==="log"?"log":"linear"}))},tn=E=>{a.commands.dispatch(new u.SetScaleDomainCommand({scaledAesthetic:e,...E}),{transient:!0})},Da=E=>{E!==null&&tn({domainMin:E})},Fa=E=>{E!==null&&tn({domainMax:E})},Ba=E=>{const X=E==="auto"?null:E==="zero"?0:Zn(f?.domain,"start");a.commands.dispatch(new u.SetScaleDomainCommand({scaledAesthetic:e,domainMin:X}))},za=E=>{const X=E==="custom"?Zn(f?.domain,"end"):null;a.commands.dispatch(new u.SetScaleDomainCommand({scaledAesthetic:e,domainMax:X}))},Ga=E=>{R!==void 0&&a.commands.dispatch(new u.SetLayerYScaleTypeCommand({layerId:R.id,yScaleType:E==="double"?"secondary":"primary"}))},Ha=E=>{const X=N.find(ye=>ye===E);X&&a.commands.dispatch(new u.SetAxisPositionCommand({axis:e,position:X}))};return(0,n.jsx)(z,{title:t??s(cm[e]),layout:r,preview:o,children:(0,n.jsxs)(W,{children:[(0,n.jsx)(k,{label:s("editor.axesPanel.controls.visible"),children:(0,n.jsx)(d,{checked:g.visible,onChange:Ea})}),R!==void 0&&(0,n.jsx)(k,{label:s("editor.axesPanel.controls.numberOfAxes"),children:(0,n.jsx)(p,{value:R.yScaleType==="secondary"?"double":"single",options:Ia,onChange:Ga})}),m==="linear"&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(k,{label:s("editor.axesPanel.controls.title"),children:(0,n.jsx)(h,{value:g.label??"",onChange:Ma,onCommit:a.commands.commit})}),(0,n.jsx)(k,{label:s("editor.axesPanel.controls.ticks"),children:(0,n.jsx)(d,{checked:g.ticks.visible,onChange:Ra})})]}),j&&(0,n.jsx)(k,{label:s("editor.axesPanel.controls.labels"),children:(0,n.jsx)(p,{value:g.ticks.mode,options:M,onChange:Oa})}),b&&m==="linear"&&!C&&(0,n.jsx)(k,{label:s("editor.axesPanel.controls.position"),children:(0,n.jsx)(p,{value:P??g.position,options:y,onChange:Ha})}),S!==void 0&&(0,n.jsx)(k,{label:s("editor.axesPanel.controls.reverse"),children:(0,n.jsx)(p,{value:S.reverse===!0?"yes":"no",options:La,onChange:_a})}),b&&!L&&(0,n.jsx)(k,{label:s("editor.axesPanel.controls.scale"),children:(0,n.jsx)(p,{value:A?"log":"linear",options:D,onChange:Na})}),b&&!A&&(0,n.jsxs)(n.Fragment,{children:[!L&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(k,{label:s("editor.axesPanel.controls.startFrom"),children:(0,n.jsx)(p,{value:I,options:$,onChange:Ba})}),I!=="auto"&&(0,n.jsx)(k,{label:s("editor.axesPanel.controls.value"),children:(0,n.jsx)(c,{value:b.domainMin??null,onChange:Da,onCommit:a.commands.commit})})]}),(0,n.jsx)(k,{label:s("editor.axesPanel.controls.endAt"),children:(0,n.jsx)(p,{value:w===null?"auto":"custom",options:et,onChange:za})}),w!==null&&(0,n.jsx)(k,{label:s("editor.axesPanel.controls.value"),children:(0,n.jsx)(c,{value:w,onChange:Fa,onCommit:a.commands.commit})})]})]})})},dm=e=>{const t=e?.domainMin??null;return t===null?"auto":t===0?"zero":"custom"},Zn=(e,t)=>{const r=t==="start"?e?.[0]:e?.[e.length-1];return typeof r=="number"?r:0},en=({value:e,onChange:t})=>{const r=B(),o=l.useI18n(),{TextField:a}=O(),i=e!==null&&typeof e!="string",s=c=>t(c===""?null:c);return(0,n.jsx)(k,{label:o("editor.elementsPanel.contentValue"),children:(0,n.jsx)(a,{value:typeof e=="string"?e:"",onChange:s,onCommit:r.commands.commit,disabled:i})})},Sa=({title:e,layout:t="collapsible",preview:r})=>{const o=B(),a=l.useHandleScene(o),i=l.useI18n(),{Switch:s}=O();if(!a)return null;const c=a.config.content,d=p=>{o.commands.dispatch(new u.ToggleContentVisibilityCommand({part:"caption",visible:p}))},h=p=>{o.commands.dispatch(new u.SetContentCaptionCommand({caption:p}),{transient:!0})};return(0,n.jsx)(z,{title:e??i("editor.elementsPanel.footerSection.caption"),layout:t,preview:r,children:(0,n.jsxs)(W,{children:[(0,n.jsx)(k,{label:i("editor.elementsPanel.contentVisible"),children:(0,n.jsx)(s,{checked:c.showCaption,onChange:d})}),(0,n.jsx)(en,{value:c.caption,onChange:h})]})})},Yn=/^[a-z][a-z\d+.-]*:/i,um={},ya=({title:e,layout:t="collapsible",preview:r})=>{const o=B(),a=l.useHandleScene(o),i=l.useI18n(),{Switch:s}=O();if(!a)return null;const c=a.config.content,d=h=>{o.commands.dispatch(new u.ToggleContentVisibilityCommand({part:"source",visible:h}))};return(0,n.jsx)(z,{title:e??i("editor.elementsPanel.sourceSection.title"),layout:t,preview:r,children:(0,n.jsxs)(W,{children:[(0,n.jsx)(k,{label:i("editor.elementsPanel.contentVisible"),children:(0,n.jsx)(s,{checked:c.showSource,onChange:d})}),(0,n.jsx)(hm,{source:c.source??um})]})})},hm=({source:e})=>{const t=B(),r=l.useI18n(),{TextField:o}=O(),a=d=>{const h=(d.label??"")!==""||(d.url??"")!=="";t.commands.dispatch(new u.SetContentSourceCommand({source:h?d:null}),{transient:!0})},i=()=>{const d=e.url??"";d!==""&&!Yn.test(d)&&a({...e,url:`https://${d}`}),t.commands.commit()},s=d=>a({...e,url:d}),c=d=>a({...e,label:d});return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(k,{label:r("editor.elementsPanel.sourceSection.url"),children:(0,n.jsx)(o,{value:e.url??"",onChange:s,onCommit:i,hasError:Yn.test(e.url??"")&&!(0,u.isSafeUrl)(e.url)})}),(0,n.jsx)(k,{label:r("editor.elementsPanel.sourceSection.name"),children:(0,n.jsx)(o,{value:e.label??"",onChange:c,onCommit:t.commands.commit})})]})},Ca=({title:e,layout:t="collapsible",preview:r})=>{const o=B(),a=l.useHandleScene(o),i=l.useI18n(),{Switch:s}=O();if(!a)return null;const c=a.config.content,d=p=>{o.commands.dispatch(new u.ToggleContentVisibilityCommand({part:"subtitle",visible:p}))},h=p=>{o.commands.dispatch(new u.SetContentSubtitleCommand({subtitle:p}),{transient:!0})};return(0,n.jsx)(z,{title:e??i("editor.elementsPanel.headerSection.subtitle"),layout:t,preview:r,children:(0,n.jsxs)(W,{children:[(0,n.jsx)(k,{label:i("editor.elementsPanel.contentVisible"),children:(0,n.jsx)(s,{checked:c.showSubtitle,onChange:d})}),(0,n.jsx)(en,{value:c.subtitle,onChange:h})]})})},Se=e=>{const{colorScheme:t}=l.useThemeContext(),r=(0,v.useMemo)(()=>(0,u.createStyleResolver)({colorScheme:t}),[t]);return(0,v.useMemo)(()=>e===null?null:r.readers(e),[e,r])},ja=(e,t,r)=>{const o=Se(e);return(0,v.useMemo)(()=>{if(o===null||e===null||t===null)return null;const a=(0,u.findLayerById)(e.layers,t);return a===void 0?null:o.geom[r](a)},[o,e,t,r])},Pt=[.8,1,1.2,1.4,1.6,1.8,2,2.5,3,4],pm=Pt.length/2,mm={select:{target:"graph"}},wa=({title:e,layout:t="collapsible",preview:r})=>{const o=B(),a=l.useHandleScene(o),i=l.useI18n(),{RadioGrid:s}=O(),c=Se(a);if(!a||!c)return null;const d=c.graph().get("textScale"),h=g=>i("editor.elementsPanel.textSizeSection.scaleFormat",{value:`${g}`}),p=Pt.map(g=>({value:`${g}`,label:h(g)})),m=g=>{const f=Pt.find(b=>`${b}`===g);if(f===void 0)return;const x=(0,u.findStyleRule)(a.spec.styles.overrides,mm,(0,u.readStyleCoord)(a.spec))?.declarations??{};o.commands.dispatch(new u.SetStyleRuleCommand({list:"overrides",rule:{select:{target:"graph"},declarations:{...x,textScale:f}}}))};return(0,n.jsx)(z,{title:e??i("editor.elementsPanel.textSizeSection.title"),layout:t,preview:r??h(d),children:(0,n.jsx)(s,{value:`${d}`,options:p,columns:pm,onChange:m,ariaLabel:i("editor.elementsPanel.textSizeSection.title")})})},Ta=({title:e,layout:t="collapsible",preview:r})=>{const o=B(),a=l.useHandleScene(o),i=l.useI18n(),{Switch:s}=O();if(!a)return null;const c=a.config.content,d=p=>{o.commands.dispatch(new u.ToggleContentVisibilityCommand({part:"title",visible:p}))},h=p=>{o.commands.dispatch(new u.SetContentTitleCommand({title:p}),{transient:!0})};return(0,n.jsx)(z,{title:e??i("editor.elementsPanel.headerSection.toggleTitle"),layout:t,preview:r,children:(0,n.jsxs)(W,{children:[(0,n.jsx)(k,{label:i("editor.elementsPanel.contentVisible"),children:(0,n.jsx)(s,{checked:c.showTitle,onChange:d})}),(0,n.jsx)(en,{value:c.title,onChange:h})]})})},gm=({children:e,...t})=>(0,n.jsx)(Yt.Root,{...t,children:e??(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Ta,{}),(0,n.jsx)(Ca,{}),(0,n.jsx)(Sa,{}),(0,n.jsx)(ya,{}),(0,n.jsx)(wa,{})]})}),vm=({children:e,...t})=>(0,n.jsx)(Yt.Root,{...t,children:e??(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(kt,{axis:"x"}),(0,n.jsx)(kt,{axis:"y"})]})}),Ye=e=>`${e}px`,Aa=e=>`${Math.round(e*100)}%`,xm=e=>`${e}°`,fm=24,bm={select:{target:"graph"}},Jn=["dim","desaturate"],Sm=({title:e,layout:t="collapsible",preview:r})=>{const o=B(),a=l.useHandleScene(o),i=l.useI18n(),{Slider:s,ToggleGroup:c}=O(),d=Se(a);if(!a||!d)return null;const h=d.graph().get("cornerRadius"),p=(0,u.readHighlightDimStyle)(a.spec),m=Jn.map(x=>({value:x,label:i(x==="dim"?"editor.highlighting.highlightStyle.tint":"editor.highlighting.highlightStyle.gray")})),g=x=>{const b=(0,u.findStyleRule)(a.spec.styles.overrides,bm,(0,u.readStyleCoord)(a.spec))?.declarations??{};o.commands.dispatch(new u.SetStyleRuleCommand({list:"overrides",rule:{select:{target:"graph"},declarations:{...b,cornerRadius:x}}}),{transient:!0})},f=x=>{const b=Jn.find(S=>S===x);b&&o.commands.dispatch(new u.SetHighlightDimStyleCommand({dimStyle:b}))};return(0,n.jsx)(z,{title:e??i("editor.colorPanel.appearanceSection.title"),layout:t,preview:r,children:(0,n.jsxs)(W,{children:[(0,n.jsx)(k,{label:i("editor.colorPanel.borderSection.cornerRadius"),children:(0,n.jsx)(s,{value:h,min:0,max:fm,step:1,formatValue:Ye,onChange:g,onCommit:o.commands.commit})}),(0,n.jsx)(k,{label:i("editor.colorPanel.appearanceSection.highlightStyle"),children:(0,n.jsx)(c,{value:p,options:m,onChange:f})})]})})},ym=.05,Cm=({title:e,layout:t="collapsible",preview:r})=>{const o=B(),a=l.useHandleScene(o),i=l.useI18n(),{Slider:s,ToggleGroup:c}=O(),d=a?(0,u.findLayerByGeom)(a.spec.layers,"bar"):void 0,h=ja(a,d?.id??null,"bar");if(!a||!d||a.coordSystem.type==="polar"&&a.coordSystem.bandAxis===null)return null;const p=b=>{o.commands.dispatch(new u.SetBarWidthCommand({layerId:d.id,width:b}),{transient:!0})},m=b=>{const S=u.BORDER_RADIUS_TOKENS.find(j=>j===b);S&&o.commands.dispatch(new u.SetBarCornerRadiusCommand({layerId:d.id,cornerRadius:S}))},g=u.BORDER_RADIUS_TOKENS.map(b=>({value:b,label:i(`editor.graphPanel.barSection.roundingOptions.${b}`)})),f=(0,u.resolveBarBandFraction)(d.params,a.coordSystem.type),x=h?.get("cornerRadius")??u.DEFAULT_BAR_CORNER_RADIUS;return(0,n.jsx)(z,{title:e??i("editor.graphPanel.barSection.title"),layout:t,preview:r,children:(0,n.jsxs)(W,{children:[(0,n.jsx)(k,{label:i("editor.graphPanel.barSection.thickness"),children:(0,n.jsx)(s,{value:f,min:u.MIN_BAR_WIDTH_FRACTION,max:u.MAX_BAR_WIDTH_FRACTION,step:ym,formatValue:Aa,onChange:p,onCommit:o.commands.commit})}),(0,n.jsx)(k,{label:i("editor.graphPanel.barSection.rounding"),layout:"stack",children:(0,n.jsx)(c,{value:typeof x=="string"?x:"",options:g,onChange:m})})]})})},Je=({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"})]})})]})},Qe="qdaoth0",jm=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 31 33",...e,children:[(0,n.jsx)(Je,{children:(0,n.jsx)("path",{className:Qe,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"})]}),wm=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 32 32",...e,children:(0,n.jsxs)(Je,{children:[(0,n.jsx)("path",{className:Qe,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"})]})}),Tm=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 32 33",...e,children:[(0,n.jsx)(Je,{children:(0,n.jsx)("path",{className:Qe,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"})]}),Am=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 32 33",...e,children:[(0,n.jsx)(Je,{children:(0,n.jsx)("path",{className:Qe,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"})]}),km={x:.5,y:.5},Pm=.2,Lm={x:.375,y:.25,width:.25,height:.5},Im={zOrder:"background"},Em={x:.4,y:.6},Mm={x:.6,y:.4},Rm="relative-difference",Om=({title:e,layout:t="collapsible",preview:r})=>{const o=B(),a=l.useHandleScene(o),i=l.useI18n(),{Button:s}=O();if(!a)return null;const c=()=>{o.commands.dispatch(new u.AddAnnotationCommand({kind:"text",annotation:{...u.TEXT_ANNOTATION_DEFAULTS,content:_m(i("editor.annotatePanel.callOutSection.text")),at:{anchorType:"panel",...km},width:Pm}}))},d=()=>{o.commands.dispatch(new u.AddAnnotationCommand({kind:"arrow",annotation:{...u.ARROW_DEFAULTS,start:{anchorType:"panel",...Em},end:{anchorType:"panel",...Mm}}}))},h=()=>{o.commands.dispatch(new u.AddAnnotationCommand({kind:"shape",annotation:{...u.SHAPE_DEFAULTS,...Im,region:{anchorType:"panel",...Lm}}}))},p=()=>{const g=(0,u.inferDefaultDifferenceArrowEndpoints)(a);g!==null&&o.commands.dispatch(new u.AddAnnotationCommand({kind:"differenceArrow",annotation:{...u.DIFFERENCE_ARROW_DEFAULTS,...g,label:Rm}}))},m=a.coordSystem.type==="cartesian";return(0,n.jsx)(z,{title:e??i("editor.annotatePanel.callOutSection.title"),layout:t,preview:r,children:(0,n.jsxs)(ma,{children:[(0,n.jsx)(s,{variant:"tile",icon:(0,n.jsx)(Am,{size:"xl"}),label:i("editor.annotatePanel.callOutSection.text"),onClick:c}),(0,n.jsx)(s,{variant:"tile",icon:(0,n.jsx)(jm,{size:"xl"}),label:i("editor.annotatePanel.callOutSection.arrow"),onClick:d}),(0,n.jsx)(s,{variant:"tile",icon:(0,n.jsx)(wm,{size:"xl"}),label:i("editor.annotatePanel.callOutSection.box"),onClick:h}),m&&(0,n.jsx)(s,{variant:"tile",icon:(0,n.jsx)(Tm,{size:"xl"}),label:i("editor.annotatePanel.callOutSection.difference"),onClick:p})]})})},_m=e=>({type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e}]}]}),Nm=({title:e,layout:t="collapsible",preview:r})=>{const o=B(),a=l.useHandleScene(o),i=l.useI18n(),{ToggleGroup:s}=O();if(!a)return null;const c=(0,u.readChartType)(a.spec);if(c===null||!(0,u.isComboChartType)(c))return null;const d=u.COMBO_TYPES.map(p=>({value:p,label:i(`editor.graphPanel.comboSection.types.${p}`)})),h=p=>{const m=u.COMBO_TYPES.find(g=>g===p);m&&o.commands.dispatch(new u.SetChartTypeCommand({coordType:"cartesian",comboType:m}))};return(0,n.jsx)(z,{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")})})},Dm=.1,Fm=20,Bm=({title:e,preview:t})=>{const r=B(),o=l.useHandleScene(r),a=l.useI18n(),{NumberField:i,TextField:s}=O();if(!o||o.coordSystem.type==="polar")return null;const c=(0,u.findGoalLineLayer)(o.spec.layers),d=e??a("editor.annotationsPanel.goalSection.title"),h=(0,u.readConstantValue)(c?.mapping.y),p=typeof h=="number"?h:null,m=x=>{const b=new u.ToggleGoalLineCommand({showGoalLine:x,value:zm(o),...c!==void 0&&{layerId:c.id}});r.commands.dispatch(b)},g=x=>{if(c===void 0)return;const b=new u.SetRuleLabelCommand({layerId:c.id,label:x===""?null:x});r.commands.dispatch(b,{transient:!0})},f=x=>{if(c===void 0||x===null)return;const b=new u.SetRuleValueCommand({layerId:c.id,value:x});r.commands.dispatch(b,{transient:!0})};return(0,n.jsx)(ba,{title:d,preview:t,checked:c!==void 0,onToggle:m,children:(0,n.jsxs)(W,{children:[(0,n.jsx)(k,{label:a("editor.annotationsPanel.goalSection.labelControl"),children:(0,n.jsx)(s,{value:c?.params.label??"",placeholder:a("editor.annotationsPanel.goalSection.labelPlaceholder"),onChange:g,onCommit:r.commands.commit,ariaLabel:a("editor.annotationsPanel.goalSection.labelAriaLabel")})}),(0,n.jsx)(k,{label:a("editor.annotationsPanel.goalSection.valueControl"),children:(0,n.jsx)(i,{value:p,placeholder:a("editor.powerUpPanel.valueInput.numberPlaceholder"),onChange:f,onCommit:r.commands.commit,ariaLabel:a("editor.annotationsPanel.goalSection.valueAriaLabel")})})]})})},zm=e=>{const t=(e.scales.y?.domain??[]).filter(s=>typeof s=="number");if(t.length===0)return 0;const r=Math.max(...t),o=r-Math.min(...t),a=o>0?o:Math.abs(r);if(a===0)return 0;const i=Math.min(Fm,Math.max(0,1-Math.floor(Math.log10(a))));return Number((r+a*Dm).toFixed(i))},Gm=({layerId:e,title:t,layout:r="collapsible",preview:o})=>{const a=B(),i=l.useHandleScene(a),s=l.useI18n(),{Switch:c}=O();if(!i)return null;const d=e===void 0?i.layers[0]:(0,u.findLayerById)(i.layers,e);if(!d)return null;const{showDataLabels:h,format:p,showStackTotals:m,showCategoryLabels:g}=d.dataLabels,f=Jr(d,i.coordSystem.type,{hasCapability:a.canPlaceDataLabels,hasPercentageFormat:a.canFormatDataLabelsAsPercentages});if(!f.supportsDataLabels)return null;const x=L=>{const A=new u.ToggleDataLabelsCommand({layerId:d.id,showDataLabels:L});a.commands.dispatch(A)},b=L=>{const A=new u.SetDataLabelsFormatCommand({layerId:d.id,format:L?"percentage":"absolute"});a.commands.dispatch(A)},S=L=>{const A=new u.ToggleStackTotalsCommand({layerId:d.id,showStackTotals:L});a.commands.dispatch(A)},j=L=>{const A=new u.ToggleCategoryLabelsCommand({layerId:d.id,showCategoryLabels:L});a.commands.dispatch(A)};return(0,n.jsx)(z,{title:t??s("editor.graphPanel.graphOptionsSection.title"),layout:r,preview:o,children:(0,n.jsxs)(W,{children:[(0,n.jsx)(k,{label:s("editor.graphPanel.graphOptions.dataLabels"),children:(0,n.jsx)(c,{checked:h,onChange:x})}),f.supportsPercentages&&(0,n.jsx)(k,{label:s("editor.graphPanel.graphOptions.showPercentages"),children:(0,n.jsx)(c,{checked:p==="percentage",onChange:b})}),f.supportsStackTotals&&(0,n.jsx)(k,{label:s("editor.graphPanel.graphOptions.stackTotals"),children:(0,n.jsx)(c,{checked:m,onChange:S})}),f.supportsCategoryLabels&&(0,n.jsx)(k,{label:s("editor.graphPanel.graphOptions.categoryLabels"),children:(0,n.jsx)(c,{checked:g,onChange:j})})]})})},Hm=3,Vm=({title:e,layout:t="collapsible",preview:r})=>{const o=B(),a=l.useHandleScene(o),i=l.useI18n(),{RadioGrid:s}=O(),c=(0,v.useMemo)(()=>me.map(({name:m,icon:g,summary:f})=>({value:m,label:i(`editor.graphTypes.${m}`),icon:(0,n.jsx)(g,{size:"md"}),disabled:!to(f,a?.spec)})),[i,a]);if(!a)return null;const d=(0,u.readChartType)(a.spec),h=Oe(d),p=m=>{const g=me.find(f=>f.name===m);g&&o.commands.dispatch(new u.SetChartTypeCommand(no(g.summary,d)))};return(0,n.jsx)(z,{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:Hm,onChange:p,ariaLabel:i("editor.graphPanel.graphTypeSection.title")})})},Wm=({title:e,layout:t="collapsible",preview:r})=>{const o=B(),a=l.useHandleScene(o),i=l.useI18n(),{Slider:s,Switch:c,ToggleGroup:d}=O(),h=Se(a),p=a!==null&&h!==null?vo(a,h):null;if(p===null)return null;const m=p.axes.some(S=>S.showGrid),g=De.map(S=>({value:S,label:i(`editor.graphPanel.gridSection.lineStyles.${S}`)})),f=S=>j=>{o.commands.dispatch(new u.SetGridVisibilityCommand({axis:S,visible:j}))},x=S=>{const j=De.find(L=>L===S);j!==void 0&&o.commands.dispatch(xo(j))},b=S=>{o.commands.dispatch(fo(S),{transient:!0})};return(0,n.jsx)(z,{title:e??i("editor.graphPanel.gridSection.title"),layout:t,preview:r,children:(0,n.jsxs)(W,{children:[p.axes.map(S=>(0,n.jsx)(k,{label:i($m(S)),children:(0,n.jsx)(c,{checked:S.showGrid,onChange:f(S.scaleAestheticKey)})},S.scaleAestheticKey)),p.stylable&&m&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(k,{label:i("editor.graphPanel.gridSection.gridStyle"),children:(0,n.jsx)(d,{value:p.lineStyle,options:g,onChange:x})}),(0,n.jsx)(k,{label:i("editor.graphPanel.gridSection.gridThickness"),children:(0,n.jsx)(s,{value:p.strokeWidth,min:0,max:8,step:.5,formatValue:Ye,onChange:b,onCommit:o.commands.commit})})]})]})})},$m=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",Um="total",ka=["total","average","current"],qm=["total"],Qn=["previous","first"],er=["auto","small","medium","large"],Km=({title:e,layout:t="collapsible",preview:r})=>{const o=B(),a=l.useHandleScene(o),i=l.useI18n(),{Switch:s,ToggleGroup:c}=O();if(!a)return null;const d=a.config.headline,h=d.show!=="none",p=a.coordSystem,m=p.type==="polar",g=p.type==="polar"&&p.innerRadius>0,f=a.layers.some(R=>R.summary.grandTotal!==void 0);if(m&&!f)return null;const x=m?qm:ka,b=a.guides.headline,S=b?.kind==="perGroup"&&b.items.some(R=>R.comparison!==null),j=x.map(R=>({value:R,label:i(`editor.graphPanel.headlineNumberSection.metrics.${R}`)})),L=Qn.map(R=>({value:R,label:i(`editor.graphPanel.headlineNumberSection.comparison.${R}`)})),A=er.map(R=>({value:R,label:i(R==="auto"?"editor.graphPanel.numberFormat.options.auto":`editor.graphPanel.headlineNumberSize.sizes.${R}`)})),w=[{value:"above",label:i("editor.graphPanel.headlineNumberSection.position.above")},{value:"center",label:i("editor.graphPanel.headlineNumberSection.position.center")}],I=R=>{o.commands.dispatch(new u.SetHeadlineShowCommand({show:R?Um:"none"}))},T=R=>{const C=x.find(y=>y===R);C&&o.commands.dispatch(new u.SetHeadlineShowCommand({show:C}))},P=R=>{const C=Qn.find(y=>y===R);C&&o.commands.dispatch(new u.SetHeadlineCompareWithCommand({compareWith:C}))},N=R=>{const C=er.find(y=>y===R);C&&o.commands.dispatch(new u.SetHeadlineSizeCommand({size:C}))},V=R=>{o.commands.dispatch(new u.SetHeadlinePositionCommand({position:R==="center"?"center":"above"}))};return(0,n.jsx)(z,{title:e??i("editor.graphPanel.headlineNumberSection.title"),layout:t,preview:r??Xm(i,d.show),children:(0,n.jsxs)(W,{children:[(0,n.jsx)(k,{label:i("editor.graphPanel.headlineNumberSection.toggle"),children:(0,n.jsx)(s,{checked:h,onChange:I})}),h&&(0,n.jsxs)(n.Fragment,{children:[j.length>1&&(0,n.jsx)(k,{label:i("editor.graphPanel.headlineNumberSection.metricLabel"),layout:"stack",children:(0,n.jsx)(c,{value:d.show,options:j,onChange:T})}),S&&(0,n.jsx)(k,{label:i("editor.graphPanel.headlineNumberSection.compareWithLabel"),layout:"stack",children:(0,n.jsx)(c,{value:(0,u.resolveComparisonBasis)(d.compareWith),options:L,onChange:P})}),(0,n.jsx)(k,{label:i("editor.graphPanel.headlineNumberSize.sizeLabel"),children:(0,n.jsx)(c,{value:d.size,options:A,onChange:N})}),g&&(0,n.jsx)(k,{label:i("editor.axesPanel.controls.position"),children:(0,n.jsx)(c,{value:d.position,options:w,onChange:V})})]})]})})},Xm=(e,t)=>{const r=ka.find(o=>o===t);return r&&e(`editor.graphPanel.headlineNumberSection.metrics.${r}`)};var ut=["top","bottom","left","right","none"],tr=["auto","start","center","end"],Zm={row:{start:"left",end:"right"},column:{start:"top",end:"bottom"}},nr=["auto","pill","direct"],Ym=({positions:e,title:t,layout:r="collapsible",preview:o})=>{const a=B(),i=l.useHandleScene(a),s=l.useI18n(),{ToggleGroup:c}=O(),d=l.useTextDirection();if(!i)return null;const h=i.config.legend.position,p=e??ut,m=i.guides.legends.drawn[0],g=(0,u.canAnchorDirectLabels)({legendPosition:i.guides.legends.position,coordSystem:i.coordSystem,layers:i.layers}),f=i.guides.headline?.kind==="perGroup",x=i.guides.colorGroups.length>0;if(h==="auto"&&m===void 0&&!g&&(f||!x))return null;const b=m?.position??"none",S=h==="auto"?b:h,j=ut.filter(M=>M===S||p.includes(M)).map(M=>({value:M,label:s(`editor.graphPanel.legendSection.${M}`)})),L=M=>{const D=ut.find($=>$===M);D&&a.commands.dispatch(new u.SetLegendPositionCommand({position:D}))},A=M=>{const D=tr.find($=>$===M);D&&a.commands.dispatch(new u.SetLegendAlignCommand({align:D}))},w=M=>{const D=nr.find($=>$===M);D&&a.commands.dispatch(new u.SetLegendDisplayCommand({display:D}))},I=m?.position==="left"||m?.position==="right"?"column":"row",T=I==="row"?"ltr":d,P=M=>s(M==="start"||M==="end"?`editor.graphPanel.legendSection.${Zm[I][M]}`:`editor.graphPanel.legendSection.align.${M}`),N=tr.map(M=>({value:M,label:P(M)})),V=nr.map(M=>({value:M,label:s(`editor.graphPanel.legendSection.display.${M}`)})),R=t??s("editor.graphPanel.legendSection.title"),C=j.find(M=>M.value===S)?.label,y=m!==void 0;return(0,n.jsx)(z,{title:R,layout:r,preview:o??C,children:(0,n.jsxs)(W,{children:[(0,n.jsx)(k,{label:s("editor.axesPanel.controls.position"),layout:"stack",children:(0,n.jsx)(c,{value:S,options:j,onChange:L})}),y&&(0,n.jsx)(k,{label:s("editor.graphPanel.legendSection.alignLabel"),layout:"stack",children:(0,n.jsx)(Mt.DirectionProvider,{direction:T,children:(0,n.jsx)("div",{dir:T,className:"_1v6dqrh0",children:(0,n.jsx)(c,{value:i.config.legend.align,options:N,onChange:A})})})}),g&&(0,n.jsx)(k,{label:s("editor.graphPanel.legendSection.displayLabel"),layout:"stack",children:(0,n.jsx)(c,{value:i.config.legend.display,options:V,onChange:w})})]})})},Jm=1,Qm=20,eg=.5,Pa=({layerId:e})=>{const t=B(),r=l.useHandleScene(t),{Slider:o}=O(),a=ja(r,e,"point");if(!r)return null;const i=(0,u.findLayerById)(r.layers,e)?.data?.findFirst(d=>(a?.get("size",d)??0)>0)??void 0,s=a?.get("size",i)??u.DEFAULT_POINT_SIZE_PX,c=d=>{const h=new u.SetPointSizeCommand({layerId:e,size:d});t.commands.dispatch(h,{transient:!0})};return(0,n.jsx)(o,{value:s,min:Jm,max:Qm,step:eg,formatValue:Ye,onChange:c,onCommit:t.commands.commit})},tg=({title:e,layout:t="collapsible",preview:r})=>{const o=B(),a=l.useHandleScene(o),i=l.useI18n(),{Select:s,Slider:c,Switch:d,ToggleGroup:h}=O(),p=Se(a),m=(0,u.findLayerByGeom)(a?.spec.layers??[],"line","area"),g=a&&p&&m?Ht(a,p,m.id):null;if(!a||!g)return null;const f=g.missingValueOptions.map(I=>({value:I,label:Qr(i,I)})),x=[{value:"auto",label:i("editor.graphPanel.numberFormat.options.auto"),disabled:g.hasUnderlyingStrokeWidth},{value:"custom",label:i("editor.graphPanel.numberFormat.options.custom")}],b=I=>{o.commands.dispatch(new u.ToggleLinePointsCommand({layerId:g.layerId,showPoints:I}))},S=I=>{o.commands.dispatch(new u.SetLineStyleCommand({layerId:g.layerId,showFill:I,drawnFillAlpha:g.drawnFillAlpha}))},j=I=>{o.commands.dispatch(new u.SetLineCurveCommand({layerId:g.layerId,curve:I?"smooth":"linear"}))},L=I=>{o.commands.dispatch(new u.SetLineStyleCommand({layerId:g.layerId,strokeWidth:I==="custom"?g.strokeWidth:null}))},A=I=>{o.commands.dispatch(new u.SetLineStyleCommand({layerId:g.layerId,strokeWidth:I}),{transient:!0})},w=I=>{const T=bt.find(P=>P===I);T&&o.commands.dispatch(new u.SetLineMissingValuesCommand({layerId:g.layerId,missingValues:T}))};return(0,n.jsx)(z,{title:e??i("editor.fineTunePanel.lineStyleSection.title"),layout:t,preview:r,children:(0,n.jsxs)(W,{children:[(0,n.jsx)(k,{label:i("editor.graphPanel.graphOptions.showPoints"),children:(0,n.jsx)(d,{checked:g.showPoints,onChange:b})}),g.pointLayerId&&(0,n.jsx)(k,{label:i("editor.graphPanel.pointSize.label"),children:(0,n.jsx)(Pa,{layerId:g.pointLayerId})}),g.showFill!==null&&(0,n.jsx)(k,{label:i("editor.graphPanel.graphOptions.lineFill"),children:(0,n.jsx)(d,{checked:g.showFill,onChange:S})}),g.smooth!==null&&(0,n.jsx)(k,{label:i("editor.graphPanel.graphOptions.smoothLines"),children:(0,n.jsx)(d,{checked:g.smooth,onChange:j})}),(0,n.jsx)(k,{label:i("editor.graphPanel.lineThickness.label"),children:(0,n.jsx)(h,{value:g.widthMode,options:x,onChange:L})}),g.widthMode==="custom"&&(0,n.jsx)(k,{label:i("editor.graphPanel.numberFormat.valueLabel"),children:(0,n.jsx)(c,{value:g.strokeWidth,min:1,max:10,step:.1,formatValue:Ye,onChange:A,onCommit:o.commands.commit})}),g.missingValues!==null&&(0,n.jsx)(k,{label:i("editor.fineTunePanel.detailSection.missingValues"),children:(0,n.jsx)(s,{value:g.missingValues,options:f,onChange:w})})]})})},Lt="\0none",ng=["x","y","color","size","label"],rg={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"},og=({title:e,layout:t="collapsible"})=>{const r=B(),o=l.useHandleScene(r),a=l.useI18n(),{Select:i}=O(),s=a("editor.graphPanel.mappingSection.none"),c=o?.spec,d=(0,v.useMemo)(()=>c===void 0?[]:(0,u.readMappableAesthetics)(c,ng).map(({aesthetic:h,variables:p,required:m})=>{const g=(0,u.readMappedVariable)(c.mapping,h);return{aesthetic:h,label:a(rg[h]),value:g??(m?null:Lt),options:ag(p,g,m?null:s),chooseColumn:f=>{r.commands.dispatch(new u.SetMappingCommand({aesthetic:h,variable:f===Lt?null:f}))}}}),[c,a,s,r]);return o?(0,n.jsx)(z,{title:e??a("editor.graphPanel.mappingSection.title"),layout:t,children:(0,n.jsx)(W,{children:d.map(({aesthetic:h,label:p,value:m,options:g,chooseColumn:f})=>(0,n.jsx)(k,{label:p,children:(0,n.jsx)(i,{value:m,options:g,placeholder:s,onChange:f})},h))})}):null},ag=(e,t,r)=>{const o=t!==null&&!e.includes(t)?[t,...e]:e;return[...r===null?[]:[{value:Lt,label:r}],...o.map(a=>({value:a,label:a}))]},ig="k",sg=2,lg=0,cg=5,It=[{value:"k",labelKey:"thousands"},{value:"m",labelKey:"millions"},{value:"b",labelKey:"billions"}],dg=["auto","none"],ug=({title:e,layout:t="collapsible",preview:r})=>{const o=B(),a=l.useHandleScene(o),i=l.useI18n(),{NumberField:s,ToggleGroup:c}=O();if(!a)return null;const{abbreviation:d,decimals:h}=a.config.numberFormat,p=hg(d)!==void 0,m=h!=="auto",g=A=>A.map(w=>({value:w,label:i(`editor.graphPanel.numberFormat.options.${w}`)})),f=It.map(({value:A,labelKey:w})=>({value:A,label:i(`common.abbreviations.${w}`)})),x=A=>{o.commands.dispatch(new u.SetNumberFormatAbbreviationCommand({abbreviation:A}))},b=A=>{const w=dg.find(I=>I===A);x(w??ig)},S=A=>{const w=It.find(I=>I.value===A);w&&x(w.value)},j=A=>{o.commands.dispatch(new u.SetNumberFormatDecimalsCommand({decimals:A==="custom"?sg:"auto"}))},L=A=>{A!==null&&o.commands.dispatch(new u.SetNumberFormatDecimalsCommand({decimals:A}),{transient:!0})};return(0,n.jsx)(z,{title:e??i("editor.graphPanel.numberFormatSection.title"),layout:t,preview:r,children:(0,n.jsxs)(W,{children:[(0,n.jsx)(k,{label:i("editor.graphPanel.numberFormat.abbreviationLabel"),children:(0,n.jsx)(c,{value:p?"custom":d,options:g(["auto","none","custom"]),onChange:b})}),p&&(0,n.jsx)(k,{label:i("editor.graphPanel.numberFormat.valueLabel"),children:(0,n.jsx)(c,{value:d,options:f,onChange:S})}),(0,n.jsx)(k,{label:i("editor.graphPanel.numberFormat.decimalPlacesLabel"),children:(0,n.jsx)(c,{value:m?"custom":"auto",options:g(["auto","custom"]),onChange:j})}),m&&(0,n.jsx)(k,{label:i("editor.graphPanel.numberFormat.valueLabel"),children:(0,n.jsx)(s,{value:h,min:lg,max:cg,onChange:L,onCommit:o.commands.commit})})]})})},hg=e=>It.find(t=>t.value===e),pg=({title:e,layout:t="collapsible",preview:r})=>{const o=l.useHandleScene(B()),a=l.useI18n();if(!o)return null;const i=mg(o.spec.layers);return i?(0,n.jsx)(z,{title:e??a("editor.graphPanel.pointSize.label"),layout:t,preview:r,children:(0,n.jsx)(W,{children:(0,n.jsx)(k,{label:a("editor.graphPanel.numberFormat.valueLabel"),children:(0,n.jsx)(Pa,{layerId:i.id})})})}):null},mg=e=>{const t=(0,u.filterLayersByGeoms)(e,"line","area");return(0,u.filterLayersByGeoms)(e,"point").find(r=>!(0,u.isCompanionLayer)(r,t))},gg=.9,vg=360,xg=.05,fg=15,bg=({title:e,layout:t="collapsible",preview:r})=>{const o=B(),a=l.useHandleScene(o),i=l.useI18n(),{Slider:s}=O();if(!a||a.spec.coords.coordType!=="polar")return null;const{innerRadius:c,startAngle:d}=a.spec.coords.params,h=m=>{o.commands.dispatch(new u.SetPolarInnerRadiusCommand({innerRadius:m}),{transient:!0})},p=m=>{o.commands.dispatch(new u.SetPolarStartAngleCommand({startAngle:m}),{transient:!0})};return(0,n.jsx)(z,{title:e??i("editor.graphPanel.polarSection.title"),layout:t,preview:r,children:(0,n.jsxs)(W,{children:[(0,n.jsx)(k,{label:i("editor.graphPanel.polarSection.innerRadius"),children:(0,n.jsx)(s,{value:c,min:0,max:gg,step:xg,formatValue:Aa,onChange:h,onCommit:o.commands.commit})}),(0,n.jsx)(k,{label:i("editor.graphPanel.polarSection.startAngle"),children:(0,n.jsx)(s,{value:d,min:0,max:vg-1,step:fg,formatValue:xm,onChange:p,onCommit:o.commands.commit})})]})})},Sg=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"})]}),rr=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"})]}),or=["linear","exponential","quadratic","polynomial","logarithmic","power","loess"],yg="linear",Cg=({title:e,layout:t="collapsible",preview:r})=>{const o=B(),a=l.useHandleScene(o),i=l.useI18n(),{Select:s,Switch:c}=O(),{options:d,findValue:h}=Wt(a);if(!a||a.coordSystem.type==="polar")return null;const p=(0,u.findTrendLineLayer)(a.spec.layers),m=(0,u.findAverageLineLayer)(a.spec.layers),g=p?.stat.type==="smooth"?p.stat.method:yg,f=jg(m),x=or.map(w=>({value:w,label:i(`editor.annotationsPanel.trendType.options.${w}`)})),b=(w,I={})=>{const T=p??m,P=new u.SetStatLineCommand({line:w,...I,...T!==void 0&&{layerId:T.id},label:i("editor.annotationsPanel.trendsAndAveragesSection.average")});o.commands.dispatch(P)},S=w=>b(w?"trend":"none",{method:g}),j=w=>b(w?"average":"none",{group:f??h(d[0]?.value??"")}),L=w=>{const I=or.find(T=>T===w);I!==void 0&&b("trend",{method:I})},A=w=>{const I=w===null?void 0:h(w);I!==void 0&&b("average",{group:I})};return(0,n.jsx)(z,{title:e??i("editor.annotationsPanel.trendsAndAveragesSection.title"),layout:t,preview:r??(0,n.jsx)(rr,{size:"lg"}),children:(0,n.jsxs)(W,{children:[(0,n.jsx)(k,{label:i("editor.annotationsPanel.trendsAndAveragesSection.trend"),icon:(0,n.jsx)(rr,{size:"lg"}),children:(0,n.jsx)(c,{checked:p!==void 0,onChange:S})}),p!==void 0&&(0,n.jsx)(k,{label:i("editor.annotationsPanel.trendType.label"),children:(0,n.jsx)(s,{value:g,options:x,onChange:L,placeholder:i("editor.annotationsPanel.trendType.placeholder")})}),(0,n.jsx)(k,{label:i("editor.annotationsPanel.trendsAndAveragesSection.average"),icon:(0,n.jsx)(Sg,{size:"lg"}),children:(0,n.jsx)(c,{checked:m!==void 0,onChange:j})}),m!==void 0&&d.length>0&&(0,n.jsx)(k,{label:i("editor.annotationsPanel.averageLineSeries.label"),children:(0,n.jsx)(s,{value:f===void 0?null:String(f),options:d,onChange:A,placeholder:i("editor.annotationsPanel.averageLineSeries.placeholder"),ariaLabel:i("editor.annotationsPanel.averageLineSeries.ariaLabel")})})]})})},jg=e=>{const t=e?.transforms.find(r=>r.transformType==="filter")?.options.value;return t instanceof Date?t.getTime():t};exports.AppearanceSection=Sm;exports.AxesPanel=vm;exports.AxisSection=kt;exports.BarSection=Cm;exports.Button=fr;exports.CalloutsSection=Om;exports.CaptionSection=Sa;exports.ColorSwatches=vr;exports.ComboSection=Nm;exports.ControlRegistryProvider=_r;exports.ControlTooltip=Ue;exports.CustomColor=Cr;exports.EditableGraphRenderer=G1;exports.EditorPanel=Yt;exports.ElementsPanel=gm;exports.GoalSection=Bm;exports.GraphOptionsSection=Gm;exports.GraphTypeSection=Vm;exports.GridSection=Wm;exports.HeadlineSection=Km;exports.IntlProvider=Rt;exports.LegendSection=Ym;exports.LineSection=tg;exports.MappingSection=og;exports.NumberField=Tr;exports.NumberFormatSection=ug;exports.PANEL_ROOT_ATTRIBUTE=xa;exports.PointSection=pg;exports.PolarSection=bg;exports.RadioGrid=Pr;exports.Row=k;exports.Section=z;exports.Select=Ir;exports.Separator=Q1;exports.Slider=Er;exports.SourceSection=ya;exports.SubtitleSection=Ca;exports.Switch=Mr;exports.TextField=Rr;exports.TextSizeSection=wa;exports.TitleSection=Ta;exports.ToggleGroup=Ft;exports.ToggledSection=ba;exports.TrendsAndAveragesSection=Cg;exports.useControls=O;exports.usePanelExpansion=va;exports.usePanelGraph=B;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./editable.css');const l=require("./history-chords-D5hYPFmS.cjs");let u=require("@graphysdk/viz-engine"),v=require("react"),n=require("react/jsx-runtime"),Va=require("motion/react"),J=require("zustand/react/shallow"),Y=require("@vanilla-extract/dynamic"),U=require("clsx");U=l.__toESM(U,1);let ne=require("lodash-es"),le=require("@floating-ui/react-dom"),Et=require("react-dom"),Mt=require("@base-ui/react/direction-provider"),ar=require("@tiptap/core"),Wa=require("@tiptap/extension-bold"),Ee=require("@tiptap/extension-document"),$a=require("@tiptap/extension-hard-break"),Ua=require("@tiptap/extension-heading"),qa=require("@tiptap/extension-italic"),Ka=require("@tiptap/extension-link"),Xa=require("@tiptap/extension-text"),Za=require("@tiptap/extension-text-align"),Me=require("@tiptap/extension-text-style"),Ya=require("@tiptap/extension-underline"),He=require("@tiptap/extensions"),ir=require("@tiptap/extension-paragraph"),Ve=require("@tiptap/react"),Q=require("@base-ui/react/toolbar"),q=require("@base-ui/react/tooltip"),H=require("@base-ui/react/popover"),nn=require("react-colorful"),rn=require("@base-ui/react/number-field"),sr=require("@base-ui/react/radio"),lr=require("@base-ui/react/radio-group"),Z=require("@base-ui/react/select"),ce=require("@base-ui/react/slider"),on=require("@base-ui/react/switch"),Ja=require("@base-ui/react/input"),F=require("@base-ui/react/menu"),Qa=require("@base-ui/react/toggle"),te=require("@base-ui/react"),ue=require("@base-ui/react/accordion"),ei=require("@base-ui/react/separator");var ti={save:"حفظ",cancel:"إلغاء",confirm:"تأكيد",delete:"حذف",confirmDelete:e=>`هل أنت متأكد من رغبتك في حذف ${e.item}؟`,abbreviations:{thousands:"ألف",millions:"مليون",billions:"مليار"}},ni={title:"محرر Graphy",description:"قم بتحرير المحتوى الخاص بك هنا",graphTypes:{column:"أعمدة",columnStacked:"أعمدة مكدسة",columnStackedFill:"أعمدة مكدسة 100%",bar:"شريطي",barStacked:"أشرطة مكدسة",barStackedFill:"أشرطة مكدسة 100%",line:"خطي",area:"مساحة",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:"سمك العمود",widths:{narrow:"ضيق",regular:"عادي",wide:"عريض"},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:"منقط"},lineWidths:{thin:"رفيع",medium:"متوسط",thick:"سميك"}},graphOptions:{sortBars:"ترتيب من الأعلى ← الأدنى",showPoints:"إظهار النقاط",lineFill:"تعبئة تحت الخط",smoothLines:"خطوط ناعمة",curves:{smooth:"ناعم",linear:"مستقيم"},stackTotals:"مجاميع المكدس",dataLabels:"تسميات البيانات",showPercentages:"إظهار النسب المئوية",categoryLabels:"تسميات الفئات"},legendSection:{title:"وسيلة الإيضاح",auto:"تلقائي",top:"أعلى",bottom:"أسفل",left:"يسار",right:"يمين",none:"بدون",alignLabel:"المحاذاة",align:{auto:"تلقائي",center:"الوسط"},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:"مخصص"},sizes:{small:"صغير",medium:"متوسط",large:"كبير"}},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:"العنوان",titlePlaceholder:"إضافة عنوان",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:"التمييز"},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:"الرسم البياني",selection:"التحديد",thisBar:"هذا الشريط",thisPoint:"هذه النقطة",thisBubble:"هذه الفقاعة",thisSlice:"هذه الشريحة",allOf:e=>`كل ${e.name}`,all:"الكل",titledValue:e=>`${e.title}: ${e.value}`,groupAtBand:e=>`${e.group}, ${e.band}`,hide:"إخفاء",show:"إظهار",legendPlaces:{topStart:"أعلى اليسار",topCenter:"أعلى الوسط",topEnd:"أعلى اليمين",left:"اليسار",right:"اليمين",bottomStart:"أسفل اليسار",bottomCenter:"أسفل الوسط",bottomEnd:"أسفل اليمين"},fillColor:"لون التعبئة",lineColor:"لون الخط",palette:"لوحة الألوان",themePalette:"السمة",chartType:"النوع",customChartType:"مخصص",arrange:"الترتيب",arrangements:{grouped:"مجمعة",stacked:"مكدسة",filled:"100%",lines:"خطوط فقط"}},accessibility:{toggleSection:e=>`تبديل قسم ${e.title}`},graphyDefaults:{themeOptions:{light:"فاتح",dark:"داكن"}}},ri={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})`}}}},oi={common:ti,editor:ni,graph:ri},ai={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"}},ii={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",area:"Area",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",widths:{narrow:"Narrow",regular:"Regular",wide:"Wide"},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"},lineWidths:{thin:"Thin",medium:"Medium",thick:"Thick"}},graphOptions:{sortBars:"Sort high → low",showPoints:"Show points",lineFill:"Fill under line",smoothLines:"Smooth lines",curves:{smooth:"Smooth",linear:"Straight"},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",center:"Center"},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"},sizes:{small:"Small",medium:"Medium",large:"Large"}},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",titlePlaceholder:"Add 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"},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",selection:"Selection",thisBar:"This bar",thisPoint:"This point",thisBubble:"This bubble",thisSlice:"This slice",allOf:e=>`All of ${e.name}`,all:"All",titledValue:e=>`${e.title}: ${e.value}`,groupAtBand:e=>`${e.group}, ${e.band}`,hide:"Hide",show:"Show",legendPlaces:{topStart:"Top left",topCenter:"Top center",topEnd:"Top right",left:"Left",right:"Right",bottomStart:"Bottom left",bottomCenter:"Bottom center",bottomEnd:"Bottom right"},fillColor:"Fill color",lineColor:"Line color",palette:"Palette",themePalette:"Theme",chartType:"Type",customChartType:"Custom",arrange:"Arrange",arrangements:{grouped:"Grouped",stacked:"Stacked",filled:"100%",lines:"Lines only"}},accessibility:{toggleSection:e=>`Toggle ${e.title} section`},graphyDefaults:{themeOptions:{light:"Light",dark:"Dark"}}},si={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})`}}}},li={common:ai,editor:ii,graph:si},ci={colorPanel:{backgroundSection:{gray:"Gray"},borderType:{gray:"Gray"}},highlighting:{highlightStyle:{gray:"Gray"}}},di={editor:ci},ui={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"}},hi={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",area:"Área",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",widths:{narrow:"Estreita",regular:"Normal",wide:"Larga"},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"},lineWidths:{thin:"Fina",medium:"Média",thick:"Espessa"}},graphOptions:{sortBars:"Ordenar maior → menor",showPoints:"Mostrar pontos",lineFill:"Preencher sob a linha",smoothLines:"Linhas suaves",curves:{smooth:"Suave",linear:"Reta"},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",center:"Centro"},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"},sizes:{small:"Pequeno",medium:"Médio",large:"Grande"}},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",titlePlaceholder:"Adicionar 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"},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",selection:"Seleção",thisBar:"Esta barra",thisPoint:"Este ponto",thisBubble:"Esta bolha",thisSlice:"Esta fatia",allOf:e=>`Tudo em ${e.name}`,all:"Tudo",titledValue:e=>`${e.title}: ${e.value}`,groupAtBand:e=>`${e.group}, ${e.band}`,hide:"Ocultar",show:"Mostrar",legendPlaces:{topStart:"Topo à esquerda",topCenter:"Topo ao centro",topEnd:"Topo à direita",left:"Esquerda",right:"Direita",bottomStart:"Fundo à esquerda",bottomCenter:"Fundo ao centro",bottomEnd:"Fundo à direita"},fillColor:"Cor de preenchimento",lineColor:"Cor da linha",palette:"Paleta",themePalette:"Tema",chartType:"Tipo",customChartType:"Personalizado",arrange:"Disposição",arrangements:{grouped:"Agrupado",stacked:"Sobreposto",filled:"100%",lines:"Apenas linhas"}},accessibility:{toggleSection:e=>`Alternar secção ${e.title}`},graphyDefaults:{themeOptions:{light:"Claro",dark:"Escuro"}}},pi={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})`}}}},mi={common:ui,editor:hi,graph:pi},gi={"en-GB":li,"en-US":di,ar:oi,"pt-PT":mi},vi=[gi,l.dictionaries],Rt=({children:e,...t})=>(0,n.jsx)(l.IntlProvider,{dictionaries:vi,...t,children:(0,n.jsx)(xi,{children:e})}),xi=({children:e})=>(0,n.jsx)(Mt.DirectionProvider,{direction:l.useTextDirection(),children:e}),fi="data-variant",cr=ir.Paragraph.extend({addAttributes(){return{variant:{default:null,parseHTML:e=>e.getAttribute("data-variant")??null,renderHTML:e=>e.variant?{[fi]:e.variant}:{}}}}}),bi=ar.Extension.create({name:"preventBackspaceAcrossTitleBoundary",addOptions(){return{showTitle:!0}},addKeyboardShortcuts(){return{Backspace:({editor:e})=>{if(!this.options.showTitle)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}}}}),Ot=()=>[Xa.Text,He.UndoRedo,Ua.Heading.configure({levels:[1,2,3]}),Wa.Bold,qa.Italic,Ya.Underline,Za.TextAlign.configure({types:["heading","paragraph"]}),Ka.Link.configure({openOnClick:!1,autolink:!0}),Me.TextStyle,Me.Color,$a.HardBreak],Si=({titlePlaceholder:e,subtitlePlaceholder:t,showTitle:r,showSubtitle:o})=>[Ci({showTitle:r,showSubtitle:o}),cr,...Ot(),Me.FontFamily,bi.configure({showTitle:r}),He.Placeholder.configure({showOnlyCurrent:!1,placeholder:({pos:a,editor:i})=>{if(r&&a===0)return e;const s=r?i.state.doc.firstChild?.nodeSize??-1:0;return o&&a===s?t:""}})],yi=({placeholder:e})=>[Ee.Document,cr,...Ot(),Me.FontFamily,He.Placeholder.configure({showOnlyCurrent:!1,placeholder:({pos:t})=>t===0?e:""})],Ci=({showTitle:e,showSubtitle:t})=>e&&t?Ee.Document.extend({content:"block{2,}"}):Ee.Document,ji={accent:"var(--graphy-editor-accent, var(--graphy-editor-default-accent))",surface:"var(--graphy-editor-surface, var(--graphy-editor-default-surface))",text:"var(--graphy-editor-text, var(--graphy-editor-default-text))",textSecondary:"color-mix(in srgb, transparent, var(--graphy-editor-text, var(--graphy-editor-default-text)) 70%)",textDisabled:"color-mix(in srgb, transparent, var(--graphy-editor-text, var(--graphy-editor-default-text)) 50%)",sunken:"color-mix(in srgb, var(--graphy-editor-surface, var(--graphy-editor-default-surface)), var(--graphy-editor-text, var(--graphy-editor-default-text)) 5%)",raised:"color-mix(in srgb, var(--graphy-editor-surface, var(--graphy-editor-default-surface)), var(--graphy-editor-text, var(--graphy-editor-default-text)) 7%)",border:"var(--graphy-editor-border, color-mix(in srgb, transparent, var(--graphy-editor-text, var(--graphy-editor-default-text)) 12%))",fontFamily:"var(--graphy-editor-font-family, var(--graphy-font-family))",borderStrong:"color-mix(in srgb, transparent, var(--graphy-editor-text, var(--graphy-editor-default-text)) 50%)",focus:"color-mix(in srgb, transparent, var(--graphy-editor-text, var(--graphy-editor-default-text)) 55.00000000000001%)",focusWidth:"2px",shadow:"var(--graphy-editor-default-shadow)"},dr=(0,v.createContext)(null),ur=({labelId:e,controlId:t,children:r})=>{const o=(0,v.useMemo)(()=>{let a=null;return{labelId:e,controlId:t,claimControlId:i=>(a??=i,a===i)}},[e,t]);return(0,n.jsx)(dr.Provider,{value:o,children:r})},ee=({id:e,ariaLabel:t,ariaLabelledBy:r},o=!0)=>{const a=(0,v.useContext)(dr),i=(0,v.useId)(),[s]=(0,v.useState)(()=>o?a?.claimControlId(i)??!1:!1),c=e??(s?a?.controlId:void 0),d=r??(t===void 0?a?.labelId:void 0);return{...c!==void 0&&{id:c},...t!==void 0&&{"aria-label":t},...d!==void 0&&{"aria-labelledby":d}}},wi="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))",hr="_14ty2ng0",an="_14ty2ng1",Ti="_14ty2ng2",Ai="_14ty2ng3",pr="_14ty2ng4";var mr="transparent",gr=e=>e==="transparent"?{background:wi,border:`1px solid ${l.vars.border100}`}:{background:e,border:`1px solid ${ji.border}`},vr=({title:e,colors:t,value:r,onChange:o,trailing:a,clearable:i=!1,disabled:s,id:c,ariaLabel:d,ariaLabelledBy:h})=>{const p=l.useI18n(),m=ee({id:c,ariaLabel:d,ariaLabelledBy:h},!1),g=a!==void 0||i,f=x=>(0,n.jsx)("button",{type:"button","aria-label":x==="transparent"?p("graph.colorDropdown.transparent"):x,className:Ai,"data-active":xr(x,r),disabled:s,onMouseDown:b=>b.preventDefault(),onClick:()=>o(x),children:(0,n.jsx)("span",{className:pr,style:gr(x)})},x);return(0,n.jsxs)("div",{className:hr,children:[e!==void 0&&(0,n.jsx)("div",{className:"_14ty2ng1",children:e}),(0,n.jsxs)("div",{className:Ti,...m,children:[t.map(f),g&&(0,n.jsxs)("span",{className:"_14ty2ng5",children:[(0,n.jsx)("span",{className:"_14ty2ng6","aria-hidden":"true"}),a,i&&f("transparent")]})]})]})},xr=(e,t)=>t!==null&&e.toLowerCase()===t.toLowerCase();var ki={default:"woi4bh5 woi4bh4",tile:"woi4bh6 woi4bh4",icon:"woi4bh7 woi4bh4"},fr=({label:e,icon:t,onClick:r,variant:o="default",expanded:a,disabled:i,ariaLabel:s,ariaLabelledBy:c,id:d})=>{const h=ee({id:d,ariaLabel:s,ariaLabelledBy:c}),p=o==="tile";return(0,n.jsxs)("button",{type:"button",className:ki[o],disabled:i,"aria-expanded":a,onClick:r,...h,children:[t!==void 0&&(0,n.jsx)("span",{className:(0,U.default)("woi4bh0",o==="icon"&&"woi4bh3"),children:t}),e!==void 0&&(0,n.jsx)("span",{className:p?"woi4bh2":"woi4bh1",children:e})]})},Pi="data-graphy-chart-chrome",Li="data-graphy-chart-menu",_t={[Li]:""},We=e=>({[Pi]:e}),Ie=(e,t)=>e instanceof Element&&e.closest(`[data-graphy-chart-chrome="${CSS.escape(t)}"]`)!==null,br=e=>e instanceof Element&&e.closest("[data-graphy-chart-menu]")!==null,ht=e=>e instanceof Element&&e.closest("[data-graphy-chart-chrome]")!==null,Sr=(e,t,r)=>r!==null&&(0,u.isPointWithinEditMenuTrigger)({x:e.clientX-t.x,y:e.clientY-t.y},r),pe=(e,t,r)=>e instanceof Node&&(t.contains(e)||Ie(e,r)),Ii="cml7ha0",yr=(0,v.createContext)(null),Ei=({children:e})=>{const{chartId:t}=l.useGraphContext(),[r]=(0,v.useState)(l.resolvePortalContainer),[o,a]=(0,v.useState)(null);return r===null?null:(0,n.jsxs)(n.Fragment,{children:[(0,Et.createPortal)((0,n.jsx)("div",{ref:a,className:Ii,...We(t)}),r),(0,n.jsx)(yr.Provider,{value:o,children:e})]})},se=()=>(0,v.useContext)(yr),Mi="_178jeit0",Ri="_178jeit1 _14ty2ng3",Oi="_178jeit2 _14ty2ng4",_i="_178jeit3",Ni="_178jeit4",Di="_178jeit5",Fi="_178jeit6",Bi="_178jeit7",zi={side:"flip",align:"shift",fallbackAxisSide:"end"},Cr=({value:e,onChange:t,onCommit:r,popupAttributes:o,variant:a="default"})=>{const i=l.useI18n(),s=se(),[c,d]=(0,v.useState)(!1),h=g=>{d(g),g||r?.()},p=e!==null&&l.isValidCssColor(e)?e:"#000000",m=l.isHex(p)?p.toUpperCase():"#000000";return(0,n.jsxs)(H.Popover.Root,{open:c,onOpenChange:h,children:[a==="chip"?(0,n.jsx)(H.Popover.Trigger,{className:Ri,onMouseDown:g=>g.preventDefault(),"aria-label":i("graph.colorDropdown.pickCustom"),children:(0,n.jsx)("span",{className:Oi})}):(0,n.jsxs)("div",{className:hr,children:[(0,n.jsx)("div",{className:an,children:i("graph.colorDropdown.custom")}),(0,n.jsxs)(H.Popover.Trigger,{className:_i,onMouseDown:g=>g.preventDefault(),"aria-label":i("graph.colorDropdown.pickCustom"),children:[(0,n.jsx)("span",{className:pr,style:gr(p)}),(0,n.jsx)("span",{className:Ni,children:m})]})]}),(0,n.jsx)(H.Popover.Portal,{container:s??l.resolvePortalContainer(),children:(0,n.jsx)(l.PortalThemeProvider,{children:(0,n.jsx)(H.Popover.Positioner,{side:"right",align:"start",sideOffset:18,collisionAvoidance:zi,collisionPadding:12,disableAnchorTracking:a==="chip",className:Mi,children:(0,n.jsxs)(H.Popover.Popup,{className:Di,onMouseDown:g=>g.preventDefault(),...o,children:[(0,n.jsx)("div",{className:an,children:i("graph.colorDropdown.pickColor")}),(0,n.jsx)(nn.HexColorPicker,{color:m,onChange:t,className:Fi}),(0,n.jsx)(nn.HexColorInput,{color:m,onChange:t,prefixed:!0,className:Bi,onMouseDown:g=>g.stopPropagation()})]})})})})]})},Nt=(0,v.createContext)(null),B=()=>{const e=(0,v.useContext)(Nt);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},jr=({children:e,onKeyDown:t,...r})=>{const o=(0,v.useContext)(Nt),a=i=>{if(t?.(i),!o||i.defaultPrevented)return;const s=l.resolveHistoryStep(i.nativeEvent);s&&(i.preventDefault(),s==="undo"?o.undo():o.redo())};return(0,n.jsx)("div",{onKeyDown:a,...r,children:e})},wr="keyboard",$e=e=>{const t=(0,v.useRef)(!1),r=(0,v.useRef)(!1),o=()=>{t.current=!1,r.current&&(r.current=!1,e?.())};return{commitAfterChange:()=>{if(t.current){r.current=!0;return}e?.()},commitUnlessHeldKey:a=>{if(a){r.current=!0;return}e?.()},gestureHandlers:{onKeyDown:()=>{t.current=!0},onKeyUp:o,onBlur:a=>{a.relatedTarget instanceof Node&&a.currentTarget.contains(a.relatedTarget)||o()}}}},Gi="eh8dvc0",Hi="eh8dvc1 uz3g760",Vi="eh8dvc2 uz3g761";var Tr=({value:e,onChange:t,onCommit:r,min:o,max:a,step:i,placeholder:s,prefix:c,suffix:d,disabled:h,hasError:p,ariaLabel:m,ariaLabelledBy:g,id:f})=>{const x=ee({id:f,ariaLabel:m,ariaLabelledBy:g}),{commitUnlessHeldKey:b,gestureHandlers:S}=$e(r);return(0,n.jsx)(rn.NumberField.Root,{className:Gi,value:e,onValueChange:j=>t(j),onValueCommitted:(j,L)=>{b(L.reason===wr)},min:o,max:a,step:i,disabled:h,children:(0,n.jsxs)(jr,{className:Hi,"data-error":p===!0,"data-disabled":h===!0?"":void 0,children:[c!==void 0&&(0,n.jsx)("span",{className:"eh8dvc3",children:c}),(0,n.jsx)(rn.NumberField.Input,{className:Vi,placeholder:s,...S,"aria-invalid":p===!0?!0:void 0,...x}),d!==void 0&&(0,n.jsx)("span",{className:"eh8dvc3",children:d})]})})},Dt=({children:e})=>{const{themeValues:t}=l.useThemeContext();return(0,n.jsx)(l.PortalThemeProvider,{style:(0,v.useMemo)(()=>(0,Y.assignInlineVars)({[l.vars.fontFamily]:t.fontFamily,[l.vars.textScale]:t.textScale}),[t]),children:e})};var Ar="srewh00",Wi="srewh01",$i={pointer:null,focus:null,last:"pointer"},kr=(0,v.createContext)({hovered:!1,dismissed:!1,reachedTooltipId:null,reach:()=>{},release:()=>{},dismiss:()=>{}}),pt=({className:e,children:t})=>{const[r,o]=(0,v.useState)(!1),[a,i]=(0,v.useState)(!1),[s,c]=(0,v.useState)($i),d=(0,v.useCallback)((x,b)=>{i(!1),c(S=>({...S,[b]:x,last:b}))},[]),h=(0,v.useCallback)((x,b)=>{c(S=>S[b]===x?{...S,[b]:null}:S)},[]),p=(0,v.useCallback)(()=>i(!0),[]),m=Ui(s),g=(0,v.useMemo)(()=>({hovered:r,dismissed:a,reachedTooltipId:m,reach:d,release:h,dismiss:p}),[r,a,m,d,h,p]),f=x=>{x.pointerType!=="touch"&&(o(!0),i(!1))};return(0,n.jsx)("div",{className:e,onPointerEnter:f,onPointerLeave:()=>o(!1),children:(0,n.jsx)(kr.Provider,{value:g,children:t})})},Ue=({label:e,checked:t=!1,children:r})=>{const{hovered:o,dismissed:a,reachedTooltipId:i,reach:s,release:c,dismiss:d}=(0,v.useContext)(kr),h=(0,v.useId)(),[p,m]=(0,v.useState)(!1),g=o?!a&&(i===h||t&&i===null):p;(0,v.useEffect)(()=>()=>{c(h,"pointer"),c(h,"focus")},[h,c]);const f=(x,b)=>{b.reason==="escape-key"&&(d(),b.allowPropagation()),m(x)};return(0,n.jsxs)(q.Tooltip.Root,{open:g,onOpenChange:f,disableHoverablePopup:!0,children:[(0,n.jsx)(q.Tooltip.Trigger,{render:r,"aria-label":e,onPointerEnter:x=>x.pointerType!=="touch"&&s(h,"pointer"),onPointerLeave:()=>c(h,"pointer"),onFocus:()=>s(h,"focus"),onBlur:()=>c(h,"focus")}),(0,n.jsx)(q.Tooltip.Portal,{container:l.resolvePortalContainer(),children:(0,n.jsx)(Dt,{children:(0,n.jsx)(q.Tooltip.Positioner,{sideOffset:6,className:Wi,children:(0,n.jsx)(q.Tooltip.Popup,{className:Ar,children:e})})})})]})},Ui=({pointer:e,focus:t,last:r})=>r==="focus"?t??e:e??t,qi="_1b7s5f0",ae={1:"_1b7s5f1",2:"_1b7s5f2",3:"_1b7s5f3",4:"_1b7s5f4",5:"_1b7s5f5",6:"_1b7s5f6"},Ki="_1b7s5f7";var Xi=6,Pr=({options:e,value:t,onChange:r,onCommit:o,columns:a,itemLayout:i="tile",disabled:s,ariaLabel:c,ariaLabelledBy:d,id:h})=>{const p=ee({id:h,ariaLabel:c,ariaLabelledBy:d}),m=i==="tile",g=i==="swatch",f=i==="icon",x=i==="track",{commitAfterChange:b,gestureHandlers:S}=$e(o);return(0,n.jsx)(lr.RadioGroup,{className:(0,U.default)(qi,Zi(a??e.length),f&&"_1b7s5f9",x&&"_1b7s5fb"),value:t,onValueChange:j=>{r(j),b()},...S,disabled:s,...p,children:e.map(j=>{const L=(0,n.jsxs)(sr.Radio.Root,{value:j.value,disabled:j.disabled,className:(0,U.default)(Ki,g&&"_1b7s5f8",f&&"_1b7s5fa",x&&"_1b7s5fc"),style:{gridRow:j.gridRow,gridColumn:j.gridColumn},"aria-label":m?void 0:j.label,children:[j.icon,m&&(0,n.jsx)("span",{className:"_1b7s5fd",children:j.label})]},j.value);return!g&&!f?L:(0,n.jsx)(Ue,{label:j.label,checked:f&&j.value===t,children:L},j.value)})})},Zi=e=>{switch(Math.min(Math.max(Math.round(e),1),Xi)){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]}},Lr=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"})})}),ge=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"})})}),Yi="_1g5x15w0 uz3g760",Ji="_1g5x15w1",Qi="_1g5x15w2",sn="_1g5x15w3",es="_1g5x15w4",ts="_1g5x15w5",ns="_1g5x15w6",rs="_1g5x15w7";var Ir=({options:e,value:t,onChange:r,placeholder:o,disabled:a,hasError:i,ariaLabel:s,ariaLabelledBy:c,id:d})=>{const h=ee({id:d,ariaLabel:s,ariaLabelledBy:c}),p=se();return(0,n.jsxs)(Z.Select.Root,{value:t,onValueChange:m=>m!==null&&r(m),disabled:a,items:e.map(m=>({value:m.value,label:m.label})),children:[(0,n.jsxs)(Z.Select.Trigger,{className:Yi,"data-error":i===!0,...h,children:[(0,n.jsx)(Z.Select.Value,{className:Ji,children:m=>os(e,m,o)}),(0,n.jsx)(Z.Select.Icon,{className:sn,children:(0,n.jsx)(ge,{size:"sm"})})]}),(0,n.jsx)(Z.Select.Portal,{container:p??l.resolvePortalContainer(),children:(0,n.jsx)(l.PortalThemeProvider,{children:(0,n.jsx)(Z.Select.Positioner,{className:es,sideOffset:4,alignItemWithTrigger:!1,children:(0,n.jsx)(Z.Select.Popup,{className:ts,children:e.map(m=>(0,n.jsxs)(Z.Select.Item,{value:m.value,disabled:m.disabled,className:ns,children:[m.icon,(0,n.jsxs)("span",{className:rs,children:[(0,n.jsx)(Z.Select.ItemText,{children:m.label}),m.description!==void 0&&(0,n.jsx)("span",{className:"_1g5x15w8",children:m.description})]}),(0,n.jsx)(Z.Select.ItemIndicator,{className:sn,children:(0,n.jsx)(Lr,{size:"sm"})})]},m.value))})})})})]})},os=(e,t,r)=>t===null?(0,n.jsx)("span",{className:Qi,children:r}):as(e,t),as=(e,t)=>e.find(r=>r.value===t)?.label??t,is="vod76w0",ss="vod76w1",ls="vod76w2",cs="vod76w3",ds="vod76w4",us="vod76w5";var Er=({value:e,onChange:t,onCommit:r,min:o,max:a,step:i,suffix:s,formatValue:c,showValue:d=!0,disabled:h,ariaLabel:p,ariaLabelledBy:m})=>{const g=ee({ariaLabel:p,ariaLabelledBy:m},!1),f=hs(e,s,c),{commitUnlessHeldKey:x,gestureHandlers:b}=$e(r);return(0,n.jsxs)("div",{className:is,children:[(0,n.jsx)(ce.Slider.Root,{className:ss,value:e,onValueChange:S=>t(S),onValueCommitted:(S,j)=>{x(j.reason===wr)},min:o,max:a,step:i,disabled:h,children:(0,n.jsx)(ce.Slider.Control,{className:ls,children:(0,n.jsxs)(ce.Slider.Track,{className:cs,children:[(0,n.jsx)(ce.Slider.Indicator,{className:ds}),(0,n.jsx)(ce.Slider.Thumb,{className:us,...b,...g})]})})}),d&&(0,n.jsx)("span",{className:"vod76w6",children:f})]})},hs=(e,t,r)=>r!==void 0?r(e):`${e}${t??""}`,ps="_1hyrlw60",ms="_1hyrlw61",Mr=({checked:e,onChange:t,disabled:r,ariaLabel:o,ariaLabelledBy:a,id:i})=>{const s=ee({id:i,ariaLabel:o,ariaLabelledBy:a});return(0,n.jsx)(on.Switch.Root,{checked:e,onCheckedChange:c=>t(c),disabled:r,className:ps,...s,children:(0,n.jsx)(on.Switch.Thumb,{className:ms})})},gs="uz3g761",vs="tpcnun0 uz3g760",Rr=({value:e,onChange:t,onCommit:r,placeholder:o,disabled:a,hasError:i,ariaLabel:s,ariaLabelledBy:c,id:d})=>{const h=ee({id:d,ariaLabel:s,ariaLabelledBy:c});return(0,n.jsx)(jr,{className:vs,"data-error":i===!0,children:(0,n.jsx)(Ja.Input,{className:gs,value:e,onValueChange:p=>t(p),onBlur:r,placeholder:o,disabled:a,"aria-invalid":i===!0?!0:void 0,...h})})},xs="cnu9yl0",fs="cnu9yl1";var Ft=({options:e,value:t,onChange:r,onCommit:o,itemLayout:a="inline",hasEqualWidths:i=!1,disabled:s,ariaLabel:c,ariaLabelledBy:d,id:h})=>{const p=ee({id:h,ariaLabel:c,ariaLabelledBy:d}),m=a==="stacked",{commitAfterChange:g,gestureHandlers:f}=$e(o);return(0,n.jsx)(lr.RadioGroup,{className:xs,value:t,onValueChange:x=>{r(x),g()},...f,disabled:s,...p,children:e.map(x=>{const b=bs(x,m),S=(0,n.jsxs)(sr.Radio.Root,{value:x.value,disabled:x.disabled,className:(0,U.default)(fs,m&&"cnu9yl3",i&&"cnu9yl2"),"aria-label":b,children:[x.icon,Or(x,m)&&(0,n.jsx)("span",{className:"cnu9yl4",children:x.label})]},x.value);return b===void 0?S:(0,n.jsx)(Ue,{label:b,checked:x.value===t,children:S},x.value)})})},Or=(e,t)=>e.icon===void 0||t,bs=(e,t)=>{if(!Or(e,t))return e.label},Ss={ToggleGroup:Ft,Switch:Mr,Slider:Er,RadioGrid:Pr,Button:fr,TextField:Rr,NumberField:Tr,Select:Ir,ColorSwatches:vr,CustomColor:Cr},mt=(0,v.createContext)(Ss),_r=({controls:e,children:t})=>{const r=(0,v.useContext)(mt),o=(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,ColorSwatches:e?.ColorSwatches??r.ColorSwatches,CustomColor:e?.CustomColor??r.CustomColor}),[r,e?.ToggleGroup,e?.Switch,e?.Slider,e?.RadioGrid,e?.Button,e?.TextField,e?.NumberField,e?.Select,e?.ColorSwatches,e?.CustomColor]);return(0,n.jsx)(mt.Provider,{value:o,children:t})},O=()=>(0,v.useContext)(mt);var ys="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))",Cs="d0bl00";var js="d0bl03",ws="d0bl04",Ts=.01,gt=l.CANVAS_COLOR_KEYS.map(e=>l.vars[e]),As=Object.fromEntries(l.CANVAS_COLOR_KEYS.map(e=>[l.vars[e],e])),ks=e=>gt.some(t=>t.toLowerCase()===e.toLowerCase()),Ps=({color:e,onChange:t,open:r,onOpenChange:o,children:a,label:i,popupAttributes:s,opacity:c,onOpacityChange:d,hasTransparentOption:h=!1})=>{const p=l.useI18n(),{ColorSwatches:m,Slider:g}=O(),f=Es(),x=h?[mr,...gt]:gt,b=S=>{t(S),o(!1)};return(0,n.jsxs)(H.Popover.Root,{open:r,onOpenChange:o,children:[(0,n.jsx)(H.Popover.Trigger,{render:(0,n.jsx)(Q.Toolbar.Button,{}),"aria-label":i??p("graph.toolbar.color.label"),className:Cs,onMouseDown:S=>S.preventDefault(),children:a??(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:js,children:(0,n.jsxs)(H.Popover.Popup,{className:ws,onMouseDown:S=>S.preventDefault(),...s,children:[(0,n.jsx)(m,{title:p("graph.colorDropdown.colors"),colors:x,value:e,onChange:b}),f.length>0&&(0,n.jsx)(m,{title:p("graph.colorDropdown.chartColors"),colors:f,value:e,onChange:b}),(0,n.jsx)(Is,{value:e,onChange:t,popupAttributes:s}),c!==void 0&&d!==void 0&&(0,n.jsxs)("div",{className:"_14ty2ng0",children:[(0,n.jsx)("div",{className:"_14ty2ng1",children:p("graph.colorDropdown.opacity")}),(0,n.jsx)(g,{value:c,onChange:d,min:0,max:1,step:Ts,showValue:!1,ariaLabel:p("graph.colorDropdown.opacity")})]})]})})})})]})},Ls=(e,t)=>{if(l.isHex(e))return e;const r=As[e];return r===void 0?e:t[r]},Is=({value:e,onChange:t,popupAttributes:r})=>{const{CustomColor:o}=O(),{themeValues:a}=l.useThemeContext();return(0,n.jsx)(o,{value:e===null?null:Ls(e,a),onChange:t,popupAttributes:r})},Es=()=>{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 o=e.map(r);typeof o=="string"&&t.add(o)}return[...t]},[e])},Ms="l9kff0",Rs="l9kff1",Os="l9kff2",_s="xn24px0",Ns="xn24px1",Ds="xn24px2",Fs=({children:e,popupAttributes:t})=>(0,n.jsx)(F.Menu.Portal,{container:l.resolvePortalContainer(),children:(0,n.jsx)(l.PortalThemeProvider,{children:(0,n.jsx)(F.Menu.Positioner,{side:"bottom",align:"start",sideOffset:6,className:_s,children:(0,n.jsx)(F.Menu.Popup,{className:Ns,onMouseDown:r=>r.preventDefault(),...t,children:e})})})}),Bs=({children:e,selected:t=!1,disabled:r=!1,onClick:o})=>(0,n.jsx)(F.Menu.Item,{className:Ds,"data-selected":t,disabled:r,onClick:o,children:e}),zs=({className:e,...t})=>(0,n.jsx)(q.Tooltip.Provider,{children:(0,n.jsx)(Q.Toolbar.Root,{...t,className:(0,U.default)(Ms,e)})}),Gs=({className:e,...t})=>(0,n.jsx)(Q.Toolbar.Group,{...t,className:(0,U.default)(Rs,e)}),Hs=({className:e,...t})=>(0,n.jsx)(Q.Toolbar.Separator,{...t,className:(0,U.default)(Os,e)}),Vs=({children:e})=>{const t=l.resolvePortalContainer();return t===null?null:(0,Et.createPortal)((0,n.jsx)(l.PortalThemeProvider,{children:e}),t)},G={Portal:Vs,Root:zs,Group:Gs,Separator:Hs,Button:Q.Toolbar.Button,ColorPicker:Ps,MenuPopup:Fs,MenuItem:Bs},Ws="'Noto Serif', Georgia, 'Times New Roman', serif, 'Apple Color Emoji', 'NotoColorEmoji'",$s=`'Aeonik', 'Aeonik Fallback', ${l.DEFAULT_FONT_FAMILY}`,Us="'PT Mono', 'Courier New', monospace, 'Apple Color Emoji', 'NotoColorEmoji'",qs="'Intruding Cat', cursive, 'Apple Color Emoji', 'NotoColorEmoji'",vt=[{id:"modern",label:"Modern",preview:"Aa",fontFamily:l.DEFAULT_FONT_FAMILY},{id:"fresh",label:"Fresh",preview:"Aa",fontFamily:$s},{id:"timeless",label:"Timeless",preview:"Aa",fontFamily:Ws},{id:"technical",label:"Technical",preview:"00",fontFamily:Us},{id:"fineliner",label:"Fineliner",preview:"Aa",fontFamily:qs}],Ks=e=>e?vt.find(t=>t.fontFamily===e)??null:null,Nr="_70l3rt0",Dr="_70l3rt1",Fr="_70l3rt3",Br="_70l3rt4",zr="_70l3rt5",Xs=({editor:e,currentFontFamily:t,open:r,onOpenChange:o})=>{const a=l.useI18n(),i=Ks(t)??vt[0],s=c=>{e.chain().focus().setFontFamily(c.fontFamily).run()};return(0,n.jsxs)(F.Menu.Root,{open:r,onOpenChange:o,children:[(0,n.jsxs)(F.Menu.Trigger,{render:(0,n.jsx)(Q.Toolbar.Button,{}),"aria-label":a("graph.toolbar.font.ariaLabel"),className:Nr,onMouseDown:c=>c.preventDefault(),children:[(0,n.jsx)("span",{className:Dr,style:{fontFamily:i?.fontFamily},children:i?.preview}),(0,n.jsx)(ge,{size:"sm"})]}),(0,n.jsx)(F.Menu.Portal,{container:l.resolvePortalContainer(),children:(0,n.jsx)(l.PortalThemeProvider,{children:(0,n.jsx)(F.Menu.Positioner,{side:"bottom",align:"start",sideOffset:6,className:Fr,children:(0,n.jsx)(F.Menu.Popup,{className:Br,onMouseDown:c=>c.preventDefault(),children:vt.map(c=>(0,n.jsx)(F.Menu.Item,{className:zr,"data-selected":c.id===i?.id,onClick:()=>s(c),children:(0,n.jsx)("span",{style:{fontFamily:c.fontFamily},children:c.label})},c.id))})})})})]})},Gr={id:"text",translationKey:"graph.toolbar.heading.text",previewFont:l.vars.fontTextEditorBody},ln=[{id:"caption",translationKey:"graph.toolbar.heading.caption",previewFont:l.vars.fontTextEditorH6},Gr,{id:"h3",translationKey:"graph.toolbar.heading.heading3",previewFont:l.vars.fontTextEditorH3},{id:"h2",translationKey:"graph.toolbar.heading.heading2",previewFont:l.vars.fontTextEditorH2},{id:"h1",translationKey:"graph.toolbar.heading.heading1",previewFont:l.vars.fontTextEditorH1}],Zs=({editor:e,activeStyle:t,open:r,onOpenChange:o})=>{const a=l.useI18n(),i=ln.find(s=>s.id===t)??Gr;return(0,n.jsxs)(F.Menu.Root,{open:r,onOpenChange:o,children:[(0,n.jsxs)(F.Menu.Trigger,{render:(0,n.jsx)(Q.Toolbar.Button,{}),"aria-label":a("graph.toolbar.heading.ariaLabel"),className:Nr,onMouseDown:s=>s.preventDefault(),children:[(0,n.jsx)("span",{className:Dr,children:a(i.translationKey)}),(0,n.jsx)(ge,{size:"sm"})]}),(0,n.jsx)(F.Menu.Portal,{container:l.resolvePortalContainer(),children:(0,n.jsx)(l.PortalThemeProvider,{children:(0,n.jsx)(F.Menu.Positioner,{side:"bottom",align:"start",sideOffset:6,className:Fr,children:(0,n.jsx)(F.Menu.Popup,{className:Br,onMouseDown:s=>s.preventDefault(),children:ln.map(s=>(0,n.jsx)(F.Menu.Item,{className:zr,"data-selected":s.id===i.id,onClick:()=>Ys(e,s.id),children:(0,n.jsx)(Js,{font:s.previewFont,children:a(s.translationKey)})},s.id))})})})})]})},Ys=(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()}},Js=({font:e,children:t})=>(0,n.jsx)("span",{style:{font:e,margin:0},children:t}),Qs=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"})]})}),el=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"})]})}),tl=e=>!e.content||e.content.length===0?!0:e.content.every(t=>!t.content||t.content.length===0),nl=e=>{const{$from:t}=e.state.selection,r=t.parent.textContent,o=t.parentOffset,a=t.start();let i=o;for(;i>0&&cn(r[i-1]);)i-=1;let s=o;for(;s<r.length&&cn(r[s]);)s+=1;return{from:a+i,to:a+s}},cn=e=>e!==void 0&&/\S/.test(e),rl="fop13s0",ol="fop13s1",al="fop13s2",il="fop13s3",dn="fop13s4",sl=({editor:e,currentUrl:t,active:r,open:o,onOpenChange:a})=>{const i=l.useI18n(),[s,c]=(0,v.useState)(""),d=(0,v.useRef)(null);(0,v.useEffect)(()=>{o&&c(t??"")},[o,t]);const h=()=>{ll(e,s),a(!1)},p=()=>{c(""),a(!1)},m=f=>{c(f.target.value)},g=f=>{f.key==="Enter"&&(f.preventDefault(),h())};return(0,n.jsxs)(H.Popover.Root,{open:o,onOpenChange:a,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:rl,onMouseDown:f=>f.preventDefault(),children:(0,n.jsx)(Qs,{})}),(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:ol,children:(0,n.jsxs)(H.Popover.Popup,{className:al,initialFocus:d,onMouseDown:f=>f.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:il,onMouseDown:f=>f.stopPropagation(),onChange:m,onKeyDown:g}),(0,n.jsx)("button",{type:"button","aria-label":i("common.cancel"),className:dn,onClick:p,children:(0,n.jsx)(el,{})}),(0,n.jsx)("button",{type:"button","aria-label":i("graph.toolbar.link.apply"),className:dn,onClick:h,children:(0,n.jsx)(Lr,{})})]})})})})]})},ll=(e,t)=>{const r=t.trim(),{selection:o}=e.state;if(!r){e.chain().focus().extendMarkRange("link").unsetLink().run();return}if(!o.empty){e.chain().focus().setLink({href:r}).run();return}if(e.isActive("link")){e.chain().focus().extendMarkRange("link").setLink({href:r}).run();return}const a=nl(e);e.chain().focus().setTextSelection(a).setLink({href:r}).run()},Hr=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"})]})}),Vr=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"})]})}),Wr=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"})]})}),cl="_1d66w570",dl="_1d66w571",ie=({label:e,active:t,onToggle:r,children:o})=>{const a=i=>i.preventDefault();return(0,n.jsxs)(q.Tooltip.Root,{children:[(0,n.jsx)(q.Tooltip.Trigger,{render:(0,n.jsx)(Qa.Toggle,{render:(0,n.jsx)(Q.Toolbar.Button,{}),pressed:t,onPressedChange:()=>r()}),"aria-label":e,className:cl,onMouseDown:a,children:o}),(0,n.jsx)(q.Tooltip.Portal,{container:l.resolvePortalContainer(),children:(0,n.jsx)(Dt,{children:(0,n.jsx)(q.Tooltip.Positioner,{sideOffset:6,className:dl,children:(0,n.jsx)(q.Tooltip.Popup,{className:Ar,children:e})})})})]})},ul=({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"),active:t==="left",onToggle:()=>e.chain().focus().setTextAlign("left").run(),children:(0,n.jsx)(Wr,{})}),(0,n.jsx)(ie,{label:r("graph.toolbar.textAlign.center"),active:t==="center",onToggle:()=>e.chain().focus().setTextAlign("center").run(),children:(0,n.jsx)(Hr,{})}),(0,n.jsx)(ie,{label:r("graph.toolbar.textAlign.right"),active:t==="right",onToggle:()=>e.chain().focus().setTextAlign("right").run(),children:(0,n.jsx)(Vr,{})})]})},hl="_1u34vl40",pl=({editor:e})=>({bold:e?.isActive("bold")??!1,italic:e?.isActive("italic")??!1,underlined:e?.isActive("underline")??!1,linked:e?.isActive("link")??!1,linkUrl:e?.getAttributes("link").href??null,color:e?.getAttributes("textStyle").color??null,fontFamily:e?.getAttributes("textStyle").fontFamily??null,fontSize:ml(e),textAlign:gl(e)}),ml=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",gl=e=>e?e.isActive({textAlign:"center"})?"center":e.isActive({textAlign:"right"})?"right":"left":"left",vl=8,xl=8,fl=({editor:e})=>{const t=l.useI18n(),[r,o]=(0,v.useState)(!1),[a,i]=(0,v.useState)(null),s=a!==null,c=f=>x=>{i(x?f:null)},{refs:d,floatingStyles:h}=(0,le.useFloating)({placement:"top-start",strategy:"fixed",middleware:[(0,le.offset)(vl),(0,le.flip)(),(0,le.shift)({padding:xl})],whileElementsMounted:le.autoUpdate}),p=(0,v.useRef)(null),m=(0,Ve.useEditorState)({editor:e,selector:pl}),g=(0,v.useCallback)(f=>{p.current=f,d.setFloating(f)},[d]);return(0,v.useEffect)(()=>{e&&d.setReference(e.view.dom)},[e,d]),(0,v.useEffect)(()=>{if(!e)return;const f=()=>o(!0),x=({event:b})=>{const{relatedTarget:S,currentTarget:j}=b,L=S instanceof Node&&p.current?.contains(S),A=S instanceof Node&&j instanceof Node&&j.contains(S);!L&&!A&&o(!1)};return e.on("focus",f),e.on("blur",x),()=>{e.off("focus",f),e.off("blur",x)}},[e]),!e||!r&&!s?null:(0,n.jsx)(G.Portal,{children:(0,n.jsxs)(G.Root,{ref:g,className:hl,style:h,children:[(0,n.jsxs)(G.Group,{children:[(0,n.jsx)(G.ColorPicker,{color:m?.color??null,onChange:f=>e.chain().setColor(f).run(),open:a==="color",onOpenChange:c("color")}),(0,n.jsx)(Xs,{editor:e,currentFontFamily:m?.fontFamily??null,open:a==="fontFamily",onOpenChange:c("fontFamily")})]}),(0,n.jsx)(G.Separator,{}),(0,n.jsx)(G.Group,{children:(0,n.jsx)(Zs,{editor:e,activeStyle:m?.fontSize??"text",open:a==="fontSize",onOpenChange:c("fontSize")})}),(0,n.jsx)(G.Separator,{}),(0,n.jsxs)(G.Group,{children:[(0,n.jsx)(ie,{label:t("graph.toolbar.formatting.bold"),active:m?.bold??!1,onToggle:()=>e.chain().focus().toggleBold().run(),children:(0,n.jsx)("strong",{children:"B"})}),(0,n.jsx)(ie,{label:t("graph.toolbar.formatting.italic"),active:m?.italic??!1,onToggle:()=>e.chain().focus().toggleItalic().run(),children:(0,n.jsx)("em",{children:"I"})}),(0,n.jsx)(ie,{label:t("graph.toolbar.formatting.underline"),active:m?.underlined??!1,onToggle:()=>e.chain().focus().toggleUnderline().run(),children:(0,n.jsx)("u",{children:"U"})})]}),(0,n.jsx)(G.Separator,{}),(0,n.jsx)(G.Group,{children:(0,n.jsx)(ul,{editor:e,activeAlignment:m?.textAlign})}),(0,n.jsx)(G.Separator,{}),(0,n.jsx)(G.Group,{children:(0,n.jsx)(sl,{editor:e,currentUrl:m?.linkUrl??null,active:m?.linked??!1,open:a==="link",onOpenChange:c("link")})})]})})},bl="_1uy50v30",$r=({editor:e,ariaLabel:t})=>(0,n.jsxs)("div",{className:bl,children:[(0,n.jsx)(fl,{editor:e}),(0,n.jsx)(Ve.EditorContent,{editor:e,"aria-label":t})]}),Sl=200,Bt=({content:e,extensions:t,editable:r,onUpdate:o,updateDebounceMs:a=Sl})=>{const i=(0,v.useRef)(un(e)),s=(0,v.useRef)(i.current),c=l.useDebouncedCallback(h=>{s.current=h,o?.(h)},a),d=(0,Ve.useEditor)({extensions:t,content:i.current,editable:r,immediatelyRender:!1,onUpdate:({editor:h})=>{const p=h.getJSON();if(tt(s.current,p))return c.cancel();c.run(p)}});return(0,v.useEffect)(()=>{d?.setEditable(r)},[d,r]),(0,v.useEffect)(()=>{if(!d)return;const h=un(e);tt(s.current,h)||(s.current=h,!tt(d.getJSON(),h)&&(c.cancel(),yl(d,h)))},[d,e,c]),(0,v.useEffect)(()=>()=>c.flush(),[c]),d},un=e=>e===null?{type:"doc",content:[]}:typeof e=="string"?{type:"doc",content:[{type:"paragraph",content:e?[{type:"text",text:e}]:[]}]}:e,yl=(e,t)=>{const{from:r,to:o}=e.state.selection;e.commands.setContent(t,{emitUpdate:!1});const a=e.state.doc.content.size;e.commands.setTextSelection({from:Math.min(r,a),to:Math.min(o,a)})},tt=(e,t)=>JSON.stringify(Re(e))===JSON.stringify(Re(t)),Re=e=>Array.isArray(e)?e.map(Re):e===null||typeof e!="object"?e:Object.fromEntries(Object.entries(e).map(([t,r])=>[t,Re(r)]).filter(([,t])=>!Cl(t)).sort(([t],[r])=>String(t).localeCompare(String(r)))),Cl=e=>e==null||typeof e=="object"&&Object.keys(e).length===0,jl=({caption:e,captionStyle:t})=>{const{dispatch:r}=l.useGraphCommands(),o=Bt({content:e,extensions:(0,v.useMemo)(()=>yi({placeholder:"Add caption"}),[]),editable:!0,onUpdate:a=>{const i=tl(a)?null:a;r(new u.SetContentCaptionCommand({caption:i}))}});return(0,n.jsx)("div",{"data-testid":"caption-editor",style:l.toHtmlTextCss(t),children:(0,n.jsx)($r,{editor:o,ariaLabel:"Chart caption"})})},wl=e=>[Ee.Document,ir.Paragraph,...Ot(),Al,He.Placeholder.configure({showOnlyCurrent:!1,placeholder:({pos:t})=>t===0?e:""})],Tl=({annotation:e})=>{const t=l.useI18n(),{dispatch:r}=l.useGraphCommands(),o=l.useEditorStore(),a=(0,v.useMemo)(()=>wl(t("graph.annotations.text.placeholder")),[t]),i=Bt({content:e.content,extensions:a,editable:!0,onUpdate:s=>{r(new u.UpdateAnnotationCommand({kind:"text",id:e.id,patch:{content:s}}))}});return(0,v.useEffect)(()=>{const{setCaretEditor:s}=o.getState();return s(i),()=>s(null)},[i,o]),(0,v.useEffect)(()=>{i?.commands.focus("end",{scrollIntoView:!1})},[i]),(0,n.jsx)(Ve.EditorContent,{"aria-label":t("graph.annotations.text.editLabel"),className:l.editor,editor:i,"data-testid":"text-annotation-editor"})},hn=e=>{const t=l.resolveRichTextFontFamily(e);return t===void 0?{}:{style:`font-family: ${t}`}},Al=ar.Extension.create({name:"annotationTextStyleAttributes",addGlobalAttributes(){return[{types:["textStyle"],attributes:{fontFamily:{default:null,renderHTML:e=>hn(e.fontFamily)},font:{default:null,renderHTML:e=>hn(e.font)},fontSize:{default:null,renderHTML:e=>typeof e.fontSize=="number"&&Number.isFinite(e.fontSize)?{style:`font-size: calc(${e.fontSize}px * ${l.vars.textScale})`}:{}}}}]}}),kl=3,Pl=({title:e,showTitle:t,subtitle:r,showSubtitle:o})=>{const a=[];return t&&a.push({type:"heading",attrs:{level:kl},content:Il(e)}),o&&a.push(...El(r)),{type:"doc",content:a}},Ll=e=>{const[t,...r]=e.content??[];return{title:Ml(t?.content??[]),subtitle:Rl(r)}},zt=e=>({type:e.type??"text",...e.content!==void 0?{content:e.content.map(zt)}:{},...e.text!==void 0?{text:e.text}:{},...e.marks!==void 0?{marks:e.marks}:{},...e.attrs!==void 0?{attrs:e.attrs}:{}}),Il=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??[],El=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(pn):[pn(e)],pn=e=>e.type==="paragraph"?e:{type:"paragraph",content:e.content??[e]},Ml=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(zt)}},Rl=e=>{const t=e.filter(o=>(o.content??[]).length>0);if(t.length===0)return null;const[r]=t;if(r&&t.length===1&&r.type==="paragraph"){const o=r.content??[],[a]=o;if(a&&o.length===1&&a.type==="text"&&(!a.marks||a.marks.length===0))return a.text??null}return{type:"doc",content:t.map(zt)}},Ol="uwf6lt0",_l={fontFamily:"var(--uwf6lt1)",fontSize:"var(--uwf6lt2)",fontWeight:"var(--uwf6lt3)",fontStyle:"var(--uwf6lt4)",letterSpacing:"var(--uwf6lt5)",lineHeight:"var(--uwf6lt6)",textColor:"var(--uwf6lt7)",textTransform:"var(--uwf6lt8)",textDecoration:"var(--uwf6lt9)",textShadow:"var(--uwf6lta)",textOutline:"var(--uwf6ltb)"},Nl={fontFamily:"var(--uwf6ltc)",fontSize:"var(--uwf6ltd)",fontWeight:"var(--uwf6lte)",fontStyle:"var(--uwf6ltf)",letterSpacing:"var(--uwf6ltg)",lineHeight:"var(--uwf6lth)",textColor:"var(--uwf6lti)",textTransform:"var(--uwf6ltj)",textDecoration:"var(--uwf6ltk)",textShadow:"var(--uwf6ltl)",textOutline:"var(--uwf6ltm)"},Dl=({title:e,showTitle:t,showSubtitle:r,subtitle:o,headingStyle:a,subtitleStyle:i})=>{const{dispatch:s}=l.useGraphCommands(),c=(0,v.useMemo)(()=>Si({titlePlaceholder:"Untitled",subtitlePlaceholder:"Untitled",showTitle:t,showSubtitle:r}),[t,r]),d=Bt({content:(0,v.useMemo)(()=>Pl({title:e,showTitle:t,subtitle:o,showSubtitle:r}),[e,t,o,r]),extensions:c,editable:!0,onUpdate:h=>{const p=Ll(h);t&&s(new u.SetContentTitleCommand({title:p.title})),r&&s(new u.SetContentSubtitleCommand({subtitle:p.subtitle}))}});return(0,n.jsx)("div",{className:Ol,"data-testid":"title-editor",style:{...l.assignTextStyleVars(_l,a),...l.assignTextStyleVars(Nl,i)},children:(0,n.jsx)($r,{editor:d,ariaLabel:"Chart title and subtitle"})})},Fl={Title:Dl,Caption:jl,TextAnnotation:Tl},Bl="_10igzta0",zl=({rect:e,zIndex:t,container:r,boxRef:o,children:a,...i})=>r===null?null:(0,Et.createPortal)((0,n.jsx)("div",{...i,ref:o,className:Bl,style:{transform:`translate(${e.left}px, ${e.top}px)`,width:e.width,height:e.height,zIndex:t},children:a}),r),Ur=(e,t)=>{const{offsetWidth:r}=e;return r<=0||t<=0?1:t/r},qr=e=>Ur(e,e.getBoundingClientRect().width),mn=(e,t)=>{const{offsetWidth:r,offsetHeight:o}=e;return r<=0||o<=0?t:{width:r,height:o}},ve=e=>e.offset+e.strokeWidth,gn="http://www.w3.org/2000/svg",vn=new WeakMap,Gl=(e,t)=>{const r=Hl(e);r.setAttribute("d",t);const{x:o,y:a,width:i,height:s}=r.getBBox();return{x:o,y:a,width:i,height:s}},Hl=e=>{const t=vn.get(e);if(t?.isConnected)return t;const r=e.createElementNS(gn,"svg");r.setAttribute("aria-hidden","true"),r.style.cssText="position:absolute;width:0;height:0;overflow:hidden;visibility:hidden;pointer-events:none";const o=e.createElementNS(gn,"path");return r.append(o),e.body.append(r),vn.set(e,o),o},Vl=(e,t)=>{const{panelRect:r,look:o,readGridLineWidth:a,measurePathBox:i}=t,s=ve(o);switch(e.kind){case"observations":return nt([...e.parts,...e.vertex===null?[]:[e.vertex]].flatMap(c=>Wl(c,i)).map(c=>({...c,x:c.x+r.x,y:c.y+r.y})),s);case"guide":return nt(e.shapes.map(c=>c.kind==="box"?c.rect:l.growRect(Ul(c),a(c.axis)/2)),s);case"graph":return nt([{x:0,y:0,...e.frameSize}],-o.offset);default:return e}},Wl=(e,t)=>e.kind==="boxes"?e.boxes:$l(e.shapes,t),$l=(e,t)=>{const r=[],o=new Map;for(const a of e){if(a.kind==="dots"){r.push(...a.centers.map(c=>l.growRect({...c,width:0,height:0},a.size/2)));continue}if(a.pathData==="")continue;const i=a.kind==="stroke"?a.width/2:0;if(!a.pathData.trimStart().startsWith("M")){r.push(l.growRect(t(a.pathData),i));continue}const s=o.get(i)??[];s.push(a.pathData),o.set(i,s)}for(const[a,i]of o)r.push(l.growRect(t(i.join("")),a));return r},Ul=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}}},nt=(e,t)=>{const r=e.filter(({width:o,height:a})=>o>0||a>0);return r.length===0?null:l.growRect((0,u.getBoundingRect)(r),t)};var ql=(e,{coordSystem:t,panelRect:r})=>{if(e.kind!=="observations")return null;const o=e.vertex===null?e.parts:[...e.parts,e.vertex],a=o.reduce((s,c)=>Math.max(s,c.rows.length),0),i=a===1&&e.vertex===null;return a===0||i||a>1e3?null:o.flatMap(s=>Kl(s,t,r).map(c=>({...c,x:c.x+r.x,y:c.y+r.y})))},Kl=(e,t,r)=>(0,u.measureObservationsBoxes)({layer:{...e.layer,data:e.layer.data.take(e.rows)},coordSystem:t,panelSize:r,radialExtent:"outerEnd"}),Xl=.5,Zl={top:e=>-e.y,right:e=>e.x+e.width,bottom:e=>e.y+e.height,left:e=>-e.x},Yl=(e,t,r)=>e===null||!Jl(e)?{top:xt(t),right:ft(t),bottom:xt(t),left:ft(t)}:{top:Ce(e,t,"top",r),right:Ce(e,t,"right",r),bottom:Ce(e,t,"bottom",r),left:Ce(e,t,"left",r)},Ce=(e,t,r,o)=>{const a=Zl[r],i=r==="left"||r==="right",s=x=>i?x.y:x.x,c=x=>i?x.y+x.height:x.x+x.width;let d=-1/0;for(const x of e)d=Math.max(d,a(x));const h=d-Math.max(o,Xl);let p=1/0,m=-1/0;for(const x of e)a(x)<h||(p=Math.min(p,s(x)),m=Math.max(m,c(x)));const g=i?ft(t):xt(t),f={from:(0,ne.clamp)(p-o,g.from,g.to),to:(0,ne.clamp)(m+o,g.from,g.to)};return f.from<f.to?f:g},Jl=e=>{const[t]=e;return t!==void 0&&e.some(r=>!l.areRectsEqual(r,t))},xt=e=>({from:e.x,to:e.x+e.width}),ft=e=>({from:e.y,to:e.y+e.height}),Ql=(e,{frameElement:t,panelRect:r,look:o})=>{const a=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,x=Vl(h,{panelRect:r,look:o,readGridLineWidth:j=>l.readGridLineStyle(i,j).strokeWidth,measurePathBox:j=>{const L=m.get(j)??Gl(t.ownerDocument,j);return g.set(j,L),L}});if(c.current=g,x===null){a.getState().setSelectedOutline(null);return}const b=Yl(ql(h,{coordSystem:s,panelRect:r}),x,ve(o)),S=qr(t);a.getState().setSelectedOutline({target:d,frame:x,frameSpans:b,frameScale:S})},[a,i,s,d,h,t,r,o]);const p=e!==null;(0,v.useLayoutEffect)(()=>p?()=>a.getState().setSelectedOutline(null):void 0,[a,p])},Gt="var(--_10d2ycx0)",ec="_10d2ycx1",tc="_10d2ycx2",xn=({pathData:e,animateTransitions:t,source:r,...o})=>t?(0,n.jsx)(nc,{pathData:e,source:r,...o}):(0,n.jsx)("path",{d:e,...o}),nc=({pathData:e,source:t,...r})=>{const o=l.useSvgPathMorph(e,l.DEFAULT_SPRING_TRANSITION,t);return(0,n.jsx)(Va.motion.path,{d:o,...r})},rc="var(--n5vlnq0)",oc="data-edit-outline-stroke",Kr=e=>({[oc]:"",style:(0,Y.assignInlineVars)({[rc]:`${e}px`})}),ac=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 18 18",...e,children:(0,n.jsx)("path",{d:"M4 3v12M4 6h12M4 10h10M4 14h8",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round"})}),ic=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 18 18",...e,children:(0,n.jsx)("path",{d:"M14 3v12M2 6h12M4 10h10M6 14h8",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round"})}),sc=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 18 18",...e,children:(0,n.jsx)("path",{d:"M2 14 16 4",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round"})}),lc=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 18 18",...e,children:(0,n.jsx)("path",{d:"M2 14C2.5 7 6.1 5.5 16 4",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round"})}),cc=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 18 18",...e,children:(0,n.jsx)("path",{d:"M2 8h14M2 8v3M16 8v3",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round"})}),dc=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 18 18",...e,children:(0,n.jsx)("path",{d:"M2 8h14M3 8v3M7.3 8v3M11.6 8v3M15 8v3",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round"})}),fn={stack:"pr583x0",grid:"pr583x1"},bn="pr583x2",uc={plain:"pr583x4 pr583x3",withIcon:"pr583x5 pr583x3"},k=({label:e,layout:t="grid",icon:r,children:o})=>{const a=(0,v.useId)(),i=(0,v.useId)();return e===void 0?(0,n.jsx)(pt,{className:fn[t],children:(0,n.jsx)("div",{className:bn,children:o})}):(0,n.jsxs)(pt,{className:fn[t],children:[(0,n.jsxs)("label",{id:a,htmlFor:i,className:uc[r===void 0?"plain":"withIcon"],children:[r!==void 0&&(0,n.jsx)("span",{"aria-hidden":"true",children:r}),e]}),(0,n.jsx)("div",{className:bn,children:(0,n.jsx)(ur,{labelId:a,controlId:i,children:o})})]})},Xr=({target:e})=>{const t=l.useGraphHandle();return t===null?null:(0,n.jsx)(hc,{graph:t,axis:e.axis})};Xr.hasRows=(e,{scene:t})=>t.coordSystem.type!=="polar";var hc=({graph:e,axis:t})=>{const r=l.useHandleScene(e),o=l.useI18n(),{NumberField:a,TextField:i,ToggleGroup:s}=O(),c=r?.guides.axes.find(P=>P.scaleAestheticKey===t);if((0,v.useEffect)(()=>()=>e.commands.commit(),[e.commands]),r===null||c?.geometry!=="linear")return null;const d=!c.visible,h=r.scales[t]?.spec.scaleType,p=h==="continuous"||h==="datetime",m=r.guides.legends.drawn.some(P=>P.position==="left"||P.position==="right"),g=t!=="x"&&h==="continuous"&&(c.position==="left"||c.position==="right")&&!m,f=t==="x"?void 0:r.scales[t]?.spec,x=f?.scaleType==="continuous"?f:void 0,b=x!==void 0&&(c.position==="left"||c.position==="right")&&!(0,u.isZeroAnchoredAxis)(r,t),S=x?.transform==="log"?"log":"linear",j=b&&x.transform!=="log",L=x?.domainMin??null,A=x!==void 0&&(c.position==="left"||c.position==="right")&&x.transform!=="log",w=x?.domainMax??null,I=c.label??o("editor.axesPanel.controls.titlePlaceholder"),T=P=>{const N=P===""?null:P,V=t==="ySecondary"?{axis:t,label:N}:{axis:t,label:N};e.commands.dispatch(new u.SetAxisLabelCommand(V),{transient:!0})};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(k,{label:o("editor.axesPanel.controls.title"),children:(0,n.jsx)(i,{value:r.config.axes[t]?.label??"",placeholder:I,onChange:T,onCommit:e.commands.commit,disabled:d})}),p&&(0,n.jsx)(k,{label:o("editor.axesPanel.controls.labels"),children:(0,n.jsx)(s,{value:c.tickMode,disabled:d,options:[{value:"auto",label:o("editor.axesPanel.labelMode.auto"),icon:(0,n.jsx)(dc,{})},{value:"edges",label:o("editor.axesPanel.labelMode.edges"),icon:(0,n.jsx)(cc,{})}],onChange:P=>{const N=P==="edges"?"edges":"auto";e.commands.dispatch(new u.SetAxisTickModeCommand({axis:t,tickMode:N,keepSecondaryAxis:!0}))}})}),g&&(0,n.jsx)(k,{label:o("editor.axesPanel.controls.position"),children:(0,n.jsx)(s,{value:c.position,disabled:d,options:[{value:"left",label:o("editor.axesPanel.position.left"),icon:(0,n.jsx)(ac,{})},{value:"right",label:o("editor.axesPanel.position.right"),icon:(0,n.jsx)(ic,{})}],onChange:P=>{if(P!=="left"&&P!=="right")return;const N=t==="y"?P:P==="left"?"right":"left";e.commands.dispatch(new u.SetAxisPositionCommand({axis:"y",position:N}))}})}),b&&(0,n.jsx)(k,{label:o("editor.axesPanel.controls.scale"),children:(0,n.jsx)(s,{value:S,disabled:d,options:[{value:"linear",label:o("editor.axesPanel.scale.auto"),icon:(0,n.jsx)(sc,{})},{value:"log",label:o("editor.axesPanel.scale.log"),icon:(0,n.jsx)(lc,{})}],onChange:P=>{e.commands.dispatch(new u.SetScaleTransformCommand({scaledAesthetic:t,transform:P==="log"?"log":"linear"}))}})}),j&&(0,n.jsx)(k,{label:o("editor.axesPanel.controls.startFrom"),children:(0,n.jsx)(a,{value:L,placeholder:o("editor.axesPanel.startFrom.auto"),disabled:d,onChange:P=>{e.commands.dispatch(new u.SetScaleDomainCommand({scaledAesthetic:t,domainMin:P}),{transient:!0})},onCommit:e.commands.commit})}),A&&(0,n.jsx)(k,{label:o("editor.axesPanel.controls.endAt"),children:(0,n.jsx)(a,{value:w,placeholder:o("editor.axesPanel.endAt.auto"),disabled:d,onChange:P=>{e.commands.dispatch(new u.SetScaleDomainCommand({scaledAesthetic:t,domainMax:P}),{transient:!0})},onCommit:e.commands.commit})})]})},pc={narrow:3,regular:6,wide:11},mc=({barWidth:e,...t})=>{const r=pc[e];return(0,n.jsx)(l.Icon,{viewBox:"0 0 18 18",...t,children:(0,n.jsx)("rect",{x:(18-r)/2,y:3,width:r,height:12,fill:"currentColor"})})},gc=6,xe=({target:e})=>{const{commands:t}=l.useGraphContext(),{ColorSwatches:r,CustomColor:o}=O(),a=l.useI18n(),i=l.useStyleReaderTree(),s=l.useSceneSelector(m=>m),c=Zr(e,s),d=(0,u.readColorChoices)(s.scales.color).slice(0,gc);(0,v.useEffect)(()=>()=>t.commit(),[t]);const h=(0,v.useMemo)(()=>(0,u.readObservationsColor)({readers:i,layers:s.layers,target:e,parsingLocale:s.config.parsingLocale}),[i,s.config.parsingLocale,s.layers,e]);if(c===null)return null;const p=(m,g)=>{t.dispatch(new u.SetObservationsColorCommand({target:e,color:m}),g?{transient:!0}:void 0)};return(0,n.jsx)(k,{label:c[0]?.property==="stroke"?a("editor.overlayMenu.lineColor"):a("editor.overlayMenu.fillColor"),layout:"stack",children:(0,n.jsx)(r,{colors:vc(d,h),value:h,onChange:m=>p(m,!1),trailing:(0,n.jsx)(o,{variant:"chip",value:h,onChange:m=>p(m,!0),onCommit:()=>t.commit()})})})};xe.hasRows=(e,{scene:t})=>Zr(e,t)!==null;var Zr=(e,t)=>(0,u.findLayerById)(t.layers,e.layerId)===void 0?null:(0,u.readObservationsColorRoute)(t.spec,e),vc=(e,t)=>t===null||e.some(r=>xr(r,t))?e:[...e,t],rt=[{name:"narrow",width:.4},{name:"regular",width:.7},{name:"wide",width:.95}],Yr=({target:e})=>{const t=l.useSceneSelector(g=>g),r=l.useGraphCommands(),o=l.useI18n(),{ToggleGroup:a}=O(),i=(0,u.findLayerById)(t.spec.layers,e.layerId),s=(0,u.isLayerSpecOf)(i,"bar")?i:null,c=t.coordSystem.type==="polar"&&t.coordSystem.bandAxis===null,d=g=>{const f=rt.find(({name:x})=>x===g);f!==void 0&&r.dispatch(new u.SetBarWidthCommand({layerId:e.layerId,width:f.width}))},h=rt.map(({name:g})=>({value:g,label:o(`editor.graphPanel.barSection.widths.${g}`),icon:(0,n.jsx)(mc,{barWidth:g})})),p=s===null?null:(0,u.resolveBarBandFraction)(s.params,t.coordSystem.type),m=rt.find(({width:g})=>g===p)?.name??"";return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(xe,{target:e}),s!==null&&!c?(0,n.jsx)(k,{label:o("editor.graphPanel.barSection.thickness"),children:(0,n.jsx)(a,{value:m,options:h,onChange:d})}):null]})};Yr.hasRows=xe.hasRows;var xc={smooth:"M2 13C6 13 7 5 10 5s4 6 6 6",linear:"M2 13l5-8 4 6 5-4"},fc=({curve:e,...t})=>(0,n.jsx)(l.Icon,{viewBox:"0 0 18 18",...t,children:(0,n.jsx)("path",{d:xc[e],stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round",strokeLinejoin:"round"})}),bc={gap:"M2 12l4-5M12 10l4-4",connect:"M2 12l4-5M6 7l6 3M12 10l4-4",zero:"M2 12l4-5v7h6V10l4-4"},Sc=({missingValues:e,...t})=>(0,n.jsx)(l.Icon,{viewBox:"0 0 18 18",...t,children:(0,n.jsx)("path",{d:bc[e],stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round",strokeLinejoin:"round"})}),yc={supportsDataLabels:!1,supportsPercentages:!1,supportsStackTotals:!1,supportsCategoryLabels:!1},Jr=(e,t,r)=>{if(!r.hasCapability(e.geom,t))return yc;const{showDataLabels:o}=e.dataLabels,a=e.geom==="bar",i=t==="polar";return{supportsDataLabels:!0,supportsPercentages:o&&r.hasPercentageFormat(e,t),supportsStackTotals:a&&!i&&e.position==="stack",supportsCategoryLabels:a&&i&&e.position==="fill"&&o}},Qr=(e,t)=>{switch(t){case"gap":return e("editor.graphPanel.treatEmptyValues.leaveGap.label");case"zero":return e("editor.graphPanel.treatEmptyValues.fillZero.label");case"connect":return e("editor.graphPanel.treatEmptyValues.connectGaps.label");default:return t}};var bt=["gap","zero","connect"],Ht=(e,t,r)=>{const o=(0,u.findLayerById)(e.spec.layers,r);if(!(0,u.isLayerSpecOf)(o,"line","area"))return null;const a=e.coordSystem.type==="polar",i=(0,u.buildLayerStyleAddress)(o.geom,o.id),s=(0,u.readStyleCoord)(e.spec),c=e.spec.styles.overrides,d=(0,u.combineKindStyleDeclarations)(c,i,s),h=(0,u.combineKindStyleDeclarations)((0,u.readStyleRulesBeneath)(c,i,s),i,s),p=typeof d?.strokeWidth=="number"?d.strokeWidth:null,m=Cc(o,e.spec.layers),g=a?[]:wc(o),f=g.length>1,x=o.geom==="line"&&!a,b=x?Ac(e,t,o):0;return{layerId:o.id,showPoints:m!==void 0&&jc(e,t,m.id),pointLayerId:m?.id??null,showFill:x?b>0:null,drawnFillAlpha:b,smooth:a?null:o.params.curve==="smooth",widthMode:p===null?"auto":"custom",hasUnderlyingStrokeWidth:h?.strokeWidth!==void 0,strokeWidth:p??Tc(e,t,o)??u.DEFAULT_STROKE_WIDTH_PX,missingValues:f?o.params.missingValues:null,missingValueOptions:f?g:[]}},Cc=(e,t)=>(0,u.filterLayersByGeoms)(t,"point").find(r=>(0,u.isCompanionLayer)(r,[e])),jc=(e,t,r)=>{const o=(0,u.findLayerById)(e.layers,r);if(o?.geom!=="point")return!1;const a=t.geom.point(o);return o.data.findFirst(i=>a.get("size",i)>0)!==null},wc=e=>{const t=["gap","zero"];return e.position!=="stack"&&e.position!=="fill"&&t.push("connect"),e.geom==="area"?t.filter(r=>r!=="gap"):t},Tc=(e,t,r)=>{const o=(0,u.findLayerById)(e.layers,r.id);if(o?.geom==="line")return t.geom.line(o).get("strokeWidth");if(o?.geom==="area")return t.geom.area(o).get("strokeWidth")},Ac=(e,t,r)=>{const o=(0,u.findLayerById)(e.layers,r.id);return o?.geom==="line"?t.geom.line(o).get("fillAlpha")??0:0},kc=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.8",d:"M0 11 5.5 5.5 10.5 9 16 4v12H0z"}),(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.3",d:"M0 11 5.5 5.5 10.5 9 16 4V0H0z"})]}),Pc=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:"3.5",y:"12.5",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"2.3",y:"9.5",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"4.5",x:"4.267",y:"11.5",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"3.3",x:"4.267",y:"7.5",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"2.5",x:"8.533",y:"13.5",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"1.8",x:"8.533",y:"11",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"4",x:"12.8",y:"12",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"2.8",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"})]})]}),eo=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"})]})]})}),Lc=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"})]}),Ic=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"})]})}),Ec=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"})]})}),Mc=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"})]})}),Rc=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"})]}),Oc=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"})]}),_c=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"})]}),Nc=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"})]})]}),Dc=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"})]})}),Fc=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"})]})}),Bc=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"})]}),zc=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"})]})}),Gc=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"})]}),Hc=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"})]})}),Vc=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"})}),Wc=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"})]})}),$c=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"})]})}),Uc=.55,qc=.15,me=[{name:"column",icon:Rc,summary:{coordType:"cartesian",geom:"bar",position:"dodge"}},{name:"columnStacked",icon:_c,summary:{coordType:"cartesian",geom:"bar",position:"stack"}},{name:"columnStackedFill",icon:Oc,summary:{coordType:"cartesian",geom:"bar",position:"fill"}},{name:"bar",icon:Ic,summary:{coordType:"flip",geom:"bar",position:"dodge"}},{name:"barStacked",icon:Mc,summary:{coordType:"flip",geom:"bar",position:"stack"}},{name:"barStackedFill",icon:Ec,summary:{coordType:"flip",geom:"bar",position:"fill"}},{name:"line",icon:eo,summary:{coordType:"cartesian",geom:"line",position:"identity"}},{name:"areaStacked",icon:Lc,summary:{coordType:"cartesian",geom:"area",position:"stack"}},{name:"combo",icon:Nc,summary:{coordType:"cartesian",comboType:"grouped-bars"}},{name:"scatter",icon:$c,summary:{coordType:"cartesian",geom:"point",position:"identity"}},{name:"pie",icon:Bc,summary:{coordType:"polar",geom:"bar",position:"fill",theta:"y",innerRadius:0}},{name:"donut",icon:Dc,summary:{coordType:"polar",geom:"bar",position:"fill",theta:"y",innerRadius:Uc}},{name:"radialBar",icon:Hc,summary:{coordType:"polar",geom:"bar",position:"stack",theta:"y",innerRadius:qc}},{name:"rose",icon:Vc,summary:{coordType:"polar",geom:"bar",position:"dodge",theta:"x",innerRadius:0}},{name:"roseStacked",icon:Wc,summary:{coordType:"polar",geom:"bar",position:"stack",theta:"x",innerRadius:0}},{name:"radar",icon:zc,summary:{coordType:"polar",geom:"line",position:"identity",theta:"x",innerRadius:0}},{name:"radarFilled",icon:Gc,summary:{coordType:"polar",geom:"area",position:"identity",theta:"x",innerRadius:0}},{name:"heatmap",icon:Fc,summary:{coordType:"cartesian",geom:"tile",position:"identity"}}],Kc=.05,to=(e,t)=>(0,u.isComboChartType)(e)?(0,u.canBecomeCombo)(t):e.geom==="tile"?(0,u.canBecomeHeatmap)(t):!0,Oe=e=>e===null?null:me.find(t=>Xc(t.summary,e))??null,no=(e,t)=>t===null||(0,u.isComboChartType)(e)?e:e.position==="dodge"&&ro(t)?{...e,position:"identity"}:e.coordType!=="polar"||!_e(e.innerRadius)||t.coordType!=="polar"||!_e(t.innerRadius)?e:{...e,innerRadius:t.innerRadius},ro=e=>!(0,u.isComboChartType)(e)&&e.geom==="bar"&&e.position==="identity",Xc=(e,t)=>{if((0,u.isComboChartType)(e)||(0,u.isComboChartType)(t))return(0,u.isComboChartType)(e)&&(0,u.isComboChartType)(t);const r=e.position===t.position||e.position==="dodge"&&ro(t);return e.coordType!==t.coordType||e.geom!==t.geom||!r?!1:e.coordType!=="polar"||t.coordType!=="polar"?!0:e.theta===t.theta&&_e(e.innerRadius)===_e(t.innerRadius)},_e=e=>e>=Kc;var Zc="_1hrfeju1",Yc=[{summary:{coordType:"cartesian",geom:"area",position:"fill"},icon:kc},{summary:{coordType:"cartesian",comboType:"stacked-bars"},icon:Pc},{summary:{coordType:"cartesian",comboType:"lines"},icon:eo}],Jc=[["column","column"],["bar","bar"],["line","line"],["area","areaStacked"],["combo","combo"],["scatter","scatter"],["pie","pie"],["donut","donut"],["heatmap","heatmap"]],Qc=4,ed={dodge:"grouped",identity:"grouped",stack:"stacked",fill:"filled"},td={"grouped-bars":"grouped","stacked-bars":"stacked",lines:"lines"},nd=()=>{const e=l.useSceneSelector(T=>T.spec),t=l.useSceneSelector(({layers:T})=>T.some(P=>(0,u.hasMultipleGroups)(P.data,P.mapping))),r=l.useGraphCommands(),o=l.useI18n(),{Button:a,RadioGrid:i}=O(),[s,c]=(0,v.useState)(!1),d=(0,v.useRef)(null);(0,v.useEffect)(()=>{if(!s)return;const T=({target:P,detail:N})=>{N>0&&od(P)&&d.current?.contains(P)&&c(!1)};return document.addEventListener("click",T),()=>document.removeEventListener("click",T)},[s]);const h=(0,u.readChartType)(e);if(h===null)return null;const p=ad(h),m=Ne(h),g=Oe(h),f=p??g,x=o(f===null?"editor.overlayMenu.customChartType":`editor.graphTypes.${f.name}`),b=(p===void 0?g:yn(p,m))?.icon,S=p!==void 0&&p.arrangements.length>1,j=S&&(t||p.name==="combo"),L=()=>c(!s),A=({summary:T})=>{r.dispatch(new u.SetChartTypeCommand(no(T,h)),{transient:!0})},w=T=>{const P=Sn.find(N=>N.name===T);P!==void 0&&A(yn(P,S?m:null))},I=Sn.map(({name:T,arrangements:[P]})=>({value:T,label:o(`editor.graphTypes.${T}`),icon:(0,n.jsx)(P.icon,{size:"md"}),disabled:!to(P.summary,e)}));return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(k,{label:o("editor.overlayMenu.chartType"),children:b===void 0?(0,n.jsx)(a,{label:x,expanded:s,onClick:L}):(0,n.jsx)(a,{variant:"icon",icon:(0,n.jsx)(b,{size:"sm"}),ariaLabel:x,expanded:s,onClick:L})}),s&&(0,n.jsx)(k,{layout:"stack",children:(0,n.jsx)("div",{ref:d,className:"_1hrfeju0",children:(0,n.jsx)(i,{options:I,value:p?.name??"",onChange:w,onCommit:r.commit,columns:Qc,itemLayout:"swatch",ariaLabel:o("editor.overlayMenu.chartType")})})}),j&&(0,n.jsx)(rd,{type:p,arrangement:m,onPick:A,onCommit:r.commit})]})},oo=(e,t)=>(0,u.isComboChartType)(e)||(0,u.isComboChartType)(t)?(0,u.isComboChartType)(e)&&(0,u.isComboChartType)(t):e.coordType==="polar"?Oe(e)===Oe(t):e.coordType===t.coordType&&e.geom===t.geom,ao=Jc.flatMap(([e,t])=>{const r=me.find(o=>o.name===t);return r===void 0?[]:[{name:e,arrangements:[r,...[...me,...Yc].filter(o=>o!==r&&oo(r.summary,o.summary))]}]}),Sn=ao.filter(({name:e})=>e!=="combo"),rd=({type:e,arrangement:t,onPick:r,onCommit:o})=>{const a=l.useI18n(),{ToggleGroup:i}=O(),s=e.arrangements.map(({summary:d,icon:h})=>{const p=Ne(d);return{value:p,label:a(`editor.overlayMenu.arrangements.${p}`),icon:(0,n.jsx)(h,{size:"sm"})}}),c=d=>{const h=e.arrangements.find(({summary:p})=>Ne(p)===d);h!==void 0&&r(h)};return(0,n.jsx)(k,{label:a("editor.overlayMenu.arrange"),children:(0,n.jsx)("div",{className:Zc,children:(0,n.jsx)(i,{options:s,value:t,onChange:c,onCommit:o})})})},od=e=>e instanceof Element&&e.closest('[role="radio"]:not([aria-disabled="true"])')!==null,Ne=e=>(0,u.isComboChartType)(e)?td[e.comboType]:ed[e.position],yn=(e,t)=>e.arrangements.find(({summary:r})=>Ne(r)===t)??e.arrangements[0],ad=e=>ao.find(({arrangements:[t]})=>oo(t.summary,e)),io=({lineStyle:e,...t})=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 18 18",...t,children:[e==="solid"&&(0,n.jsx)("path",{d:"M2 9h14",stroke:"currentColor",strokeWidth:2}),e==="dashed"&&(0,n.jsx)("path",{d:"M1 9h4m2 0h4m2 0h4",stroke:"currentColor",strokeWidth:2}),e==="dotted"&&(0,n.jsxs)("g",{fill:"currentColor",children:[(0,n.jsx)("circle",{cx:2.4,cy:9,r:1.4}),(0,n.jsx)("circle",{cx:9,cy:9,r:1.4}),(0,n.jsx)("circle",{cx:15.6,cy:9,r:1.4})]})]}),so=({lineWidth:e,...t})=>(0,n.jsx)(l.Icon,{viewBox:"0 0 18 18",...t,children:(0,n.jsx)("path",{d:"M2 9h14",stroke:"currentColor",strokeWidth:e})}),id={small:2,medium:3.8,large:5.6},sd=({pointSize:e,...t})=>(0,n.jsx)(l.Icon,{viewBox:"0 0 18 18",...t,children:(0,n.jsx)("circle",{cx:9,cy:9,r:id[e],fill:"currentColor"})}),Cn=["solid","dashed","dotted"],ot=[{name:"thin",widthPx:1},{name:"medium",widthPx:2},{name:"thick",widthPx:4}],at=[{name:"small",sizePx:6},{name:"medium",sizePx:8},{name:"large",sizePx:10}],lo=({widthPx:e,onChange:t})=>{const r=l.useI18n(),{ToggleGroup:o}=O(),a=i=>{const s=ot.find(({name:c})=>c===i);s!==void 0&&t(s.widthPx)};return(0,n.jsx)(k,{label:r("editor.graphPanel.lineThickness.label"),children:(0,n.jsx)(o,{value:ot.find(i=>i.widthPx===e)?.name??"",options:ot.map(({name:i,widthPx:s})=>({value:i,label:r(`editor.graphPanel.gridSection.lineWidths.${i}`),icon:(0,n.jsx)(so,{lineWidth:s})})),onChange:a})})},co=({lineStyle:e,onChange:t})=>{const r=l.useI18n(),{ToggleGroup:o}=O(),a=i=>{const s=Cn.find(c=>c===i);s!==void 0&&t(s)};return(0,n.jsx)(k,{label:r("editor.fineTunePanel.lineStyleSection.title"),children:(0,n.jsx)(o,{value:e??"",options:Cn.map(i=>({value:i,label:r(`editor.graphPanel.gridSection.lineStyles.${i}`),icon:(0,n.jsx)(io,{lineStyle:i})})),onChange:a})})},uo=({sizePx:e,onChange:t})=>{const r=l.useI18n(),{ToggleGroup:o}=O(),a=i=>{const s=at.find(({name:c})=>c===i);s!==void 0&&t(s.sizePx)};return(0,n.jsx)(k,{label:r("editor.graphPanel.pointSize.label"),children:(0,n.jsx)(o,{value:at.find(i=>i.sizePx===e)?.name??"",options:at.map(({name:i})=>({value:i,label:r(`editor.graphPanel.pointSize.sizes.${i}`),icon:(0,n.jsx)(sd,{pointSize:i})})),onChange:a})})},ho=(0,v.createContext)({}),ld=ho.Provider,cd=()=>(0,v.useContext)(ho),dd="_1m2a0t20",St="theme",ud=3,je=14,jn=9,hd=()=>{const e=l.useSceneSelector(p=>p.scales.color),t=cd(),r=l.useGraphCommands(),o=l.useI18n(),{RadioGrid:a}=O();if(Object.keys(t).length===0||e?.kind!=="visual"||e.spec.scaleType!=="discrete"||e.defaultPalette===void 0)return null;const{defaultPalette:i,spec:s}=e,c=Object.entries(t),d=[{value:St,label:o("editor.overlayMenu.themePalette"),icon:(0,n.jsx)(wn,{colors:i})},...c.map(([p,m])=>({value:yt(p),label:p,icon:(0,n.jsx)(wn,{colors:m})}))],h=p=>{const m=c.find(([f])=>yt(f)===p);if(p!==St&&m===void 0)return;const g=m===void 0?null:[...m[1]];r.dispatch(new u.SetScaleRangeCommand({scaledAesthetic:"color",range:g}),{transient:!0})};return(0,n.jsx)(k,{label:o("editor.overlayMenu.palette"),layout:"stack",children:(0,n.jsx)(a,{options:d,value:pd(s.range,c),onChange:h,onCommit:r.commit,columns:4,itemLayout:"track"})})},yt=e=>`preset:${e}`,pd=(e,t)=>{if(e===null)return St;const r=t.find(([,o])=>(0,ne.isEqual)(o,e));return r===void 0?"":yt(r[0])},wn=({colors:e})=>{const t=e.slice(0,ud),r=je/2,o=je+(t.length-1)*jn;return(0,n.jsx)("svg",{width:o,height:je,viewBox:`0 0 ${o} ${je}`,"aria-hidden":"true",children:t.map((a,i)=>(0,n.jsx)("circle",{className:dd,cx:r+i*jn,cy:r,r:r-.5,fill:a},i)).reverse()})},Tn=["smooth","linear"],po=()=>{const e=l.useSceneSelector(C=>C),t=l.useStyleReaderTree(),r=l.useDataLabelPlacementResolver(),o=l.useGraphCommands(),a=l.useI18n(),{Switch:i,ToggleGroup:s}=O(),c=mo(e.layers,e.coordSystem.type,r),d=C=>c.filter(({support:y})=>C(y)).map(({layer:y})=>y),h=md(e,t),p=h.filter(C=>C.smooth!==null),m=h.filter(C=>C.missingValues!==null&&C.missingValueOptions.length>1),g=bt.filter(C=>m.some(y=>y.missingValueOptions.includes(C))),f=fd(p),x=bd(m),b=C=>{o.dispatch(new u.SequenceCommand({commands:h.map(y=>new u.ToggleLinePointsCommand({layerId:y.layerId,showPoints:C}))}))},S=C=>{const y=Tn.find(M=>M===C);y!==void 0&&o.dispatch(new u.SequenceCommand({commands:p.map(M=>new u.SetLineCurveCommand({layerId:M.layerId,curve:y}))}))},j=C=>{const y=bt.find(D=>D===C);if(y===void 0)return;const M=m.filter(D=>D.missingValueOptions.includes(y)).map(D=>new u.SetLineMissingValuesCommand({layerId:D.layerId,missingValues:y}));M.length!==0&&o.dispatch(new u.SequenceCommand({commands:M}))},L=h.filter(C=>C.showFill!==null),A=h.filter(C=>C.showPoints),w=gd(e,t,h),I=L.some(C=>vd(e,C)),T=C=>{C.length>0&&o.dispatch(new u.SequenceCommand({commands:C}))},P=C=>{T(h.map(y=>new u.SetLineStyleCommand({layerId:y.layerId,strokeWidth:C})))},N=C=>{T(h.map(y=>new u.SetLineStyleCommand({layerId:y.layerId,lineStyle:C})))},V=C=>{T(L.map(y=>new u.SetLineStyleCommand({layerId:y.layerId,showFill:C,drawnFillAlpha:y.drawnFillAlpha})))},R=C=>{T(A.flatMap(({pointLayerId:y})=>y===null?[]:[new u.SetPointSizeCommand({layerId:y,size:C})]))};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(nd,{}),(0,n.jsx)(we,{label:a("editor.graphPanel.graphOptions.dataLabels"),layers:d(C=>C.supportsDataLabels),isOn:C=>C.showDataLabels,buildCommand:(C,y)=>new u.ToggleDataLabelsCommand({layerId:C,showDataLabels:y})}),(0,n.jsx)(we,{label:a("editor.graphPanel.graphOptions.showPercentages"),layers:d(C=>C.supportsPercentages),isOn:C=>C.format==="percentage",buildCommand:(C,y)=>new u.SetDataLabelsFormatCommand({layerId:C,format:y?"percentage":"absolute"})}),(0,n.jsx)(we,{label:a("editor.graphPanel.graphOptions.stackTotals"),layers:d(C=>C.supportsStackTotals),isOn:C=>C.showStackTotals,buildCommand:(C,y)=>new u.ToggleStackTotalsCommand({layerId:C,showStackTotals:y})}),(0,n.jsx)(we,{label:a("editor.graphPanel.graphOptions.categoryLabels"),layers:d(C=>C.supportsCategoryLabels),isOn:C=>C.showCategoryLabels,buildCommand:(C,y)=>new u.ToggleCategoryLabelsCommand({layerId:C,showCategoryLabels:y})}),p.length>0&&(0,n.jsx)(k,{label:a("editor.graphPanel.graphOptions.smoothLines"),children:(0,n.jsx)(s,{value:f,options:Tn.map(C=>({value:C,label:a(`editor.graphPanel.graphOptions.curves.${C}`),icon:(0,n.jsx)(fc,{curve:C})})),onChange:S})}),g.length>1&&(0,n.jsx)(k,{label:a("editor.fineTunePanel.detailSection.missingValues"),children:(0,n.jsx)(s,{value:x,options:g.map(C=>({value:C,label:Qr(a,C),icon:(0,n.jsx)(Sc,{missingValues:C})})),onChange:j})}),h.length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(lo,{widthPx:it(w.map(C=>C.strokeWidth)),onChange:P}),(0,n.jsx)(co,{lineStyle:it(w.map(C=>C.lineStyle)),onChange:N})]}),L.length>0&&(0,n.jsx)(k,{label:a("editor.graphPanel.graphOptions.lineFill"),children:(0,n.jsx)(i,{checked:I,onChange:V})}),h.length>0&&(0,n.jsx)(k,{label:a("editor.graphPanel.graphOptions.showPoints"),children:(0,n.jsx)(i,{checked:A.length>0,onChange:b})}),A.length>0&&(0,n.jsx)(uo,{sizePx:it(xd(e,t,A)),onChange:R}),(0,n.jsx)(hd,{})]})};po.hasRows=(e,{scene:t,dataLabelPlacement:r})=>(0,u.readChartType)(t.spec)!==null||mo(t.layers,t.coordSystem.type,r).some(({support:o})=>o.supportsDataLabels)||t.spec.layers.some(o=>o.interactive&&(0,u.isLayerSpecOf)(o,"line","area"));var mo=(e,t,r)=>e.filter(o=>o.interactive).map(o=>({layer:o,support:Jr(o,t,r)})),md=(e,t)=>{const r=[];for(const o of e.spec.layers){if(!o.interactive)continue;const a=Ht(e,t,o.id);a!==null&&r.push(a)}return r},gd=(e,t,r)=>r.flatMap(o=>{const a=(0,u.findLayerById)(e.layers,o.layerId);if(a?.geom==="line"){const s=t.geom.line(a);return Array.from(a.data,c=>({strokeWidth:s.get("strokeWidth",c),lineStyle:(0,u.toDashPreset)(s.get("dashArray",c))}))}if(a?.geom!=="area")return[];const i=t.geom.area(a);return Array.from(a.data,s=>({strokeWidth:i.get("strokeWidth",s),lineStyle:(0,u.toDashPreset)(i.get("dashArray",s))}))}),vd=(e,t)=>{if(t.showFill===!0)return!0;const r=(0,u.buildLayerStyleAddress)("line",t.layerId),o=(0,u.readStyleCoord)(e.spec);return e.spec.styles.overrides.some(a=>!(0,u.isGeomStyleRule)(a)||a.when?.where===void 0?!1:(0,u.createStyleRuleMatcher)({...r,when:a.when},o)(a)&&"fillAlpha"in a.declarations&&(a.declarations.fillAlpha??0)>0)},xd=(e,t,r)=>r.flatMap(o=>{const a=o.pointLayerId===null?void 0:(0,u.findLayerById)(e.layers,o.pointLayerId);if(a?.geom!=="point")return[];const i=t.geom.point(a);return Array.from(a.data,s=>i.get("size",s)).filter(s=>s>0)}),it=e=>{const[t]=e;return t!==void 0&&e.every(r=>r===t)?t:null},fd=e=>e.every(t=>t.smooth===!0)?"smooth":e.every(t=>t.smooth!==!0)?"linear":"",bd=e=>{const[t,...r]=e,o=t?.missingValues??null;return o===null?"":r.every(a=>a.missingValues===o)?o:""},we=({label:e,layers:t,isOn:r,buildCommand:o})=>{const a=l.useGraphCommands(),{Switch:i}=O();if(t.length===0)return null;const s=c=>{a.dispatch(new u.SequenceCommand({commands:t.map(d=>o(d.id,c))}))};return(0,n.jsx)(k,{label:e,children:(0,n.jsx)(i,{checked:t.some(c=>r(c.dataLabels)),onChange:s})})},Sd=(e,t)=>{const r=(0,u.findLayerById)(t.layers,e);if(r===void 0)return null;const o=(0,u.findLayerById)(t.spec.layers,e),a=o===void 0?null:(0,u.findHostLayer)(o,t.spec.layers),i=a!==null&&a.id!==r.id?a:r;return{geom:i.geom,coord:t.spec.coords.coordType,position:i.position}},he=(e,t)=>{for(const r of e){const o=t(r);if(o!==void 0)return o}return null},yd=({geom:e,coord:t,position:r},o)=>he(o,a=>{const i=An(a.layers,e)?.[t]?.[r];return i!==void 0?i:An(a.geoms,e)}),An=(e,t)=>e!==void 0&&Object.hasOwn(e,t)?e[t]:void 0,De=["solid","dashed","dotted"];var go=e=>e.scaleAestheticKey==="x"||e.scaleAestheticKey==="y",vo=(e,t)=>{const r=e.guides.axes.filter(go);if(r.length===0)return null;const o=t.gridLine.y().resolve();return{axes:r,stylable:e.coordSystem.type!=="polar",lineStyle:(0,u.toDashPreset)(o.dashArray),strokeWidth:o.strokeWidth}},Cd=(e,t)=>{if(e==="both")return t.axes.every(o=>!o.showGrid);const r=t.axes.find(o=>o.scaleAestheticKey===e);return r===void 0||!r.showGrid},xo=(e,t="both")=>new u.SetGridLineStyleCommand({axis:t,lineStyle:e}),fo=(e,t="both")=>new u.SetGridLineStyleCommand({axis:t,strokeWidth:e}),st=[{name:"thin",widthPx:1},{name:"medium",widthPx:2},{name:"thick",widthPx:4}],bo=({target:e})=>{const t=l.useSceneSelector(S=>S),r=l.useStyleReaderTree(),o=vo(t,r),a=l.useI18n(),i=l.useGraphCommands(),{ToggleGroup:s}=O();if(o===null||!o.stylable)return null;const c=e.axis==="both"?"y":e.axis,d=r.gridLine[c]().resolve(),h=(0,u.toDashPreset)(d.dashArray),p=Cd(e.axis,o),m=De.map(S=>({value:S,label:a(`editor.graphPanel.gridSection.lineStyles.${S}`),icon:(0,n.jsx)(io,{lineStyle:S})})),g=st.map(({name:S,widthPx:j})=>({value:S,label:a(`editor.graphPanel.gridSection.lineWidths.${S}`),icon:(0,n.jsx)(so,{lineWidth:j})})),f=st.find(({widthPx:S})=>S===d.strokeWidth)?.name??"",x=S=>{const j=De.find(L=>L===S);j!==void 0&&i.dispatch(xo(j,e.axis))},b=S=>{const j=st.find(({name:L})=>L===S);j!==void 0&&i.dispatch(fo(j.widthPx,e.axis))};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(k,{label:a("editor.graphPanel.gridSection.gridStyle"),children:(0,n.jsx)(s,{value:h,options:m,onChange:x,disabled:p})}),(0,n.jsx)(k,{label:a("editor.graphPanel.gridSection.gridThickness"),children:(0,n.jsx)(s,{value:f,options:g,onChange:b,disabled:p})})]})};bo.hasRows=(e,{scene:t})=>{if(t.coordSystem.type==="polar")return!1;const r=t.guides.axes.filter(go);return r.length===0?!1:e.axis==="both"?!0:r.some(o=>o.scaleAestheticKey===e.axis)};var kn=[{position:"top",align:"start",gridRow:1,gridColumn:1},{position:"top",align:"center",gridRow:1,gridColumn:2},{position:"top",align:"end",gridRow:1,gridColumn:3},{position:"right",align:"center",gridRow:2,gridColumn:3},{position:"bottom",align:"end",gridRow:3,gridColumn:3},{position:"bottom",align:"center",gridRow:3,gridColumn:2},{position:"bottom",align:"start",gridRow:3,gridColumn:1},{position:"left",align:"center",gridRow:2,gridColumn:1}],jd={start:"Start",center:"Center",end:"End"},wd=()=>{const e=l.useSceneSelector(d=>d.guides.legends.drawn[0]),t=l.useGraphCommands(),r=l.useI18n(),{RadioGrid:o}=O(),a=e===void 0,i=a?"":lt(e),s=kn.map(d=>{const h=lt(d);return{value:h,label:r(`editor.overlayMenu.legendPlaces.${h}`),icon:(0,n.jsx)(l.ArrowIcon,{title:"",size:"xs",style:{transform:`rotate(${Td(d)}deg)`}}),gridRow:d.gridRow,gridColumn:d.gridColumn}}),c=d=>{const h=kn.find(p=>lt(p)===d);h!==void 0&&t.dispatch(new u.SetLegendPlacementCommand({position:h.position,align:h.align}),{transient:!0})};return(0,n.jsx)(k,{label:r("editor.axesPanel.controls.position"),children:(0,n.jsx)(Mt.DirectionProvider,{direction:"ltr",children:(0,n.jsx)("div",{dir:"ltr",children:(0,n.jsx)(o,{options:s,value:i,onChange:c,onCommit:t.commit,columns:3,itemLayout:"icon",disabled:a})})})})},lt=({position:e,align:t})=>e==="left"||e==="right"?e:`${e}${jd[t]}`,Td=({gridRow:e,gridColumn:t})=>Math.atan2(t-2,2-e)*180/Math.PI,Ct=({target:e})=>{const t=l.useGraphHandle();return t===null?null:(0,n.jsx)(Ad,{graph:t,target:e})};Ct.hasRows=(e,{scene:t})=>e.scope==="series"&&So(t,e.layerId)!==null;var Ad=({graph:e,target:t})=>{const r=l.useHandleScene(e),o=l.useStyleReaderTree(),a=l.useI18n(),{Switch:i}=O(),s=r===null?null:So(r,t.layerId),c=r===null||s===null?null:Ht(r,o,s.id);if(r===null||s===null||c===null)return null;const d=Ed(r,t),h=d===void 0?{}:{where:d},p=d===void 0||s.geom!=="line"?void 0:Id(r,c.layerId,d),m=p===void 0?c.showFill:p>0,g=d===void 0?null:kd(r,s.geom,c.layerId,d),f=d===void 0?c.strokeWidth:g??Pd(r,o,t)??c.strokeWidth,x=c.pointLayerId===null?null:Ld(r,o,c.pointLayerId,d),b=x!==null&&x>0,S=T=>{e.commands.dispatch(new u.ToggleLinePointsCommand({layerId:c.layerId,showPoints:T,...h}))},j=T=>{e.commands.dispatch(new u.SetLineStyleCommand({layerId:c.layerId,showFill:T,drawnFillAlpha:c.drawnFillAlpha,...h}))},L=T=>{e.commands.dispatch(new u.SetLineStyleCommand({layerId:c.layerId,strokeWidth:T,...h}))},A=T=>{c.pointLayerId!==null&&e.commands.dispatch(new u.SetPointSizeCommand({layerId:c.pointLayerId,size:T,...h}))},w=T=>{e.commands.dispatch(new u.SetLineStyleCommand({layerId:c.layerId,lineStyle:T,...h}))},I=(0,u.readObservationsColorRoute)(r.spec,t)?.some(T=>T.geomKind==="line"||T.geomKind==="area")===!0;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(xe,{target:t}),(0,n.jsx)(lo,{widthPx:f,onChange:L}),I&&(0,n.jsx)(co,{lineStyle:Md(r,o,t),onChange:w}),c.showFill!==null&&(0,n.jsx)(k,{label:a("editor.graphPanel.graphOptions.lineFill"),children:(0,n.jsx)(i,{checked:m===!0,onChange:j})}),(0,n.jsx)(k,{label:a("editor.graphPanel.graphOptions.showPoints"),children:(0,n.jsx)(i,{checked:b,onChange:S})}),b&&(0,n.jsx)(uo,{sizePx:x,onChange:A})]})},kd=(e,t,r,o)=>{const a=(t==="line"?(0,u.findKindStyleDeclarations)(e.spec.styles.overrides,{...(0,u.buildLayerStyleAddress)("line",r),when:{where:o}},(0,u.readStyleCoord)(e.spec)):(0,u.findKindStyleDeclarations)(e.spec.styles.overrides,{...(0,u.buildLayerStyleAddress)("area",r),when:{where:o}},(0,u.readStyleCoord)(e.spec)))?.strokeWidth;return typeof a=="number"?a:null},Pd=(e,t,r)=>{const o=(0,u.findLayerById)(e.layers,r.layerId),a=o===void 0?void 0:(0,u.findHostLayer)(o,e.layers);if(a?.geom!=="line"&&a?.geom!=="area")return null;const[i]=(0,u.resolveObservationsTarget)({layer:a,target:r,parsingLocale:e.config.parsingLocale}),s=i===void 0?void 0:a.data.getAt(i)??void 0,c=a.geom==="line"?t.geom.line(a).get("strokeWidth",s):t.geom.area(a).get("strokeWidth",s);return typeof c=="number"?c:null},Ld=(e,t,r,o)=>{const a=o===void 0?void 0:(0,u.findKindStyleDeclarations)(e.spec.styles.overrides,{...(0,u.buildLayerStyleAddress)("point",r),when:{where:o}},(0,u.readStyleCoord)(e.spec))?.size;if(typeof a=="number")return a;const i=(0,u.findLayerById)(e.layers,r);return i?.geom==="point"?t.geom.point(i).get("size"):u.DEFAULT_POINT_SIZE_PX},Id=(e,t,r)=>{const o=(0,u.findKindStyleDeclarations)(e.spec.styles.overrides,{...(0,u.buildLayerStyleAddress)("line",t),when:{where:r}},(0,u.readStyleCoord)(e.spec))?.fillAlpha;return typeof o=="number"?o:void 0},Ed=(e,t)=>(0,u.readObservationsColorRoute)(e.spec,t)?.find(r=>r.geomKind==="line"||r.geomKind==="area")?.where,Md=(e,t,r)=>{const o=(0,u.findLayerById)(e.layers,r.layerId),a=o===void 0?void 0:(0,u.findHostLayer)(o,e.layers);if(a?.geom!=="line"&&a?.geom!=="area")return"solid";const[i]=(0,u.resolveObservationsTarget)({layer:a,target:r,parsingLocale:e.config.parsingLocale}),s=i===void 0?null:a.data.getAt(i);return(0,u.toDashPreset)(a.geom==="line"?t.geom.line(a).get("dashArray",s??void 0):t.geom.area(a).get("dashArray",s??void 0))},So=(e,t)=>{const r=(0,u.findLayerById)(e.spec.layers,t);if(r===void 0)return null;const o=(0,u.findHostLayer)(r,e.spec.layers);return(0,u.isLayerSpecOf)(o,"line","area")?o:null},yo={geoms:{point:xe,line:Ct,area:Ct,bar:Yr,rule:null,tile:null},legend:wd,axis:Xr,grid:bo,graph:po},Vt=(0,v.createContext)([yo]),Rd=({editMenus:e,children:t})=>{const r=(0,v.useMemo)(()=>[e??{},yo],[e]);return(0,n.jsx)(Vt.Provider,{value:r,children:t})},Od=e=>{const t=(0,v.useContext)(Vt),r=l.useSceneSelector(a=>a),o=l.useDataLabelPlacementResolver();return(0,v.useMemo)(()=>e===null?null:Co(e,t,{scene:r,dataLabelPlacement:o}),[e,t,r,o])},_d=()=>{const e=(0,v.useContext)(Vt),{store:t}=l.useGraphContext(),r=l.useDataLabelPlacementResolver();return(0,v.useCallback)(o=>Co(o,e,{scene:t.getState().scene,dataLabelPlacement:r})!==null,[e,t,r])},Co=(e,t,r)=>{switch(e.kind){case"observations":{const o=Sd(e.layerId,r.scene),a=o===null?null:yd(o,t);return a===null||a.hasRows?.(e,r)===!1?null:(0,n.jsx)(a,{target:e})}case"legend":{const o=he(t,a=>a.legend);return o===null||o.hasRows?.(e,r)===!1?null:(0,n.jsx)(o,{target:e})}case"axis":{const o=he(t,a=>a.axis);return o===null||o.hasRows?.(e,r)===!1?null:(0,n.jsx)(o,{target:e})}case"grid":{const o=he(t,a=>a.grid);return o===null||o.hasRows?.(e,r)===!1?null:(0,n.jsx)(o,{target:e})}case"graph":{const o=he(t,a=>a.graph);return o===null||o.hasRows?.(e,r)===!1?null:(0,n.jsx)(o,{target:e})}default:return e}},jo=(e,t)=>{const{config:r,guides:o}=t;switch(e.kind){case"legend":{const{position:a}=r.legend,i=a==="none";return{hidden:i,hide:new u.SetLegendPositionCommand({position:"none"}),show:new u.SetLegendPositionCommand({position:i?"auto":a})}}case"axis":{const{axis:a}=e,i=a==="ySecondary"?o.axes.find(s=>s.scaleAestheticKey==="ySecondary")?.visible:r.axes[a].visible;return i===void 0?null:{hidden:!i,hide:new u.SetAxisVisibilityCommand({axis:a,visible:!1,keepSecondaryAxis:!0}),show:new u.SetAxisVisibilityCommand({axis:a,visible:!0,keepSecondaryAxis:!0})}}case"grid":{const{axis:a}=e;if(a==="both")return null;const{visible:i}=r.axes[a].grid,s=i===!1;return{hidden:s,hide:new u.SetGridVisibilityCommand({axis:a,visible:!1}),show:new u.SetGridVisibilityCommand({axis:a,visible:s?!0:i})}}case"observations":case"graph":return null;default:return e}},qe=()=>{const e=_d(),{store:t}=l.useGraphContext();return(0,v.useCallback)(r=>e(r)||jo(r,t.getState().scene)!==null,[e,t])};var Pn=(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,u.areEditTargetsEqual)(e.target,t.target):e.kind==="graph"&&t.kind==="graph"},Nd=(e,t)=>{const r=Math.max(e.width,8),o=Math.max(e.height,8),a=Math.max(0,e.x+e.width/2-r/2),i=Math.max(0,e.y+e.height/2-o/2),s=Math.min(t.width,e.x+e.width/2+r/2),c=Math.min(t.height,e.y+e.height/2+o/2);return{x:a,y:i,width:Math.max(0,s-a),height:Math.max(0,c-i)}},Dd=[],Fd=e=>{const{layers:t,parsingLocale:r}=l.useSceneSelector((0,J.useShallow)(g=>({layers:g.layers,parsingLocale:g.config.parsingLocale}))),o=l.useEditorState(g=>g.editTargetUnderPointer),a=o?.kind==="observations"?o.observations:null,i=a===null?void 0:(0,u.findLayerById)(t,a.layerId),s=a?.target.scope??null,c=a===null||i===void 0?null:(0,u.readRowScopeKey)(i,a.target.scope,a.observationIndex),d=(0,v.useMemo)(()=>i===void 0||s===null||c===null?null:Bd(t,i,s,c),[t,i,s,c]),h=(0,v.useMemo)(()=>d!==null&&e!==null&&Pn(d,e),[d,e]),p=qe(),m=a!==null&&i!==void 0&&zd(a,i,r,p)?a.observationIndex:null;return(0,v.useMemo)(()=>{switch(o?.kind){case"observations":{const g=d?.parts[0];if(d===null||g===void 0)return null;const f=m===null?null:{layer:g.layer,rows:[m]};return h?f===null?null:{...d,parts:Dd,vertex:f}:{...d,vertex:f}}case"axis":case"legend":case"grid":{const g={kind:"guide",key:(0,u.readEditTargetKey)(o.target),target:o.target};return e!==null&&Pn(g,e)?null:g}default:return null}},[o,d,h,m,e])},Bd=(e,t,r,o)=>{const a=[{layer:t,rows:(0,u.readRowsAtScopeKey)(t,r,o)}];for(const i of(0,u.findCompanionLayers)(t,e)){const s=(0,u.readCompanionRowsAtScopeKey)(i,t,r,o);s.length>0&&a.push({layer:i,rows:s})}return{kind:"observations",key:JSON.stringify([t.id,r,o]),layerId:t.id,scope:r,parts:a,vertex:null}},zd=({observationIndex:e,target:t,onObservation:r},o,a,i)=>{if(!r||t.scope!=="series")return!1;const s=(0,u.buildObservationsTarget)({layer:o,observationIndex:e,scope:"data-point",parsingLocale:a});return s!==null&&i(s)},Gd=({frameElement:e,target:t,coordType:r,legendDisplays:o})=>{const a=e.getBoundingClientRect(),i=[...e.querySelectorAll(Hd(t))],s=c=>{const d=c.getBoundingClientRect();return{x:d.left-a.left,y:d.top-a.top,width:d.width,height:d.height}};switch(t.kind){case"axis":{const c=i.map(s);return r==="polar"||c.length===0?ct(c):ct([(0,u.getBoundingRect)(c)])}case"legend":return ct([...Vd(i.filter(c=>!Wd(c)))].flatMap(([c,d])=>o[c]==="direct"?d.map(s):[(0,u.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?[$d(c,s(c),h)]:[]})}},Hd=e=>{const t=`[${l.EDIT_TARGET_KIND_ATTRIBUTE}="${e.kind}"]`;return e.kind!=="axis"?t:`${t}[${l.EDIT_TARGET_AXIS_ATTRIBUTE}="${e.axis}"]`},Vd=e=>{const t=new Map;for(const r of e){const o=l.readLegendItemAddress(r);o!==null&&t.set(o.legendIndex,[...t.get(o.legendIndex)??[],r])}return t},Wd=e=>e.closest(l.LEGEND_OVERFLOW_CONTROL_SELECTOR)!==null,ct=e=>e.map(t=>({kind:"box",rect:t})),$d=(e,{x:t,y:r,width:o,height:a},i)=>e.querySelector("circle")!==null?{kind:"ring",axis:i,center:{x:t+o/2,y:r+a/2},radius:o/2}:o<1||a<1?o<a?{kind:"line",axis:i,from:{x:t+o/2,y:r},to:{x:t+o/2,y:r+a}}:{kind:"line",axis:i,from:{x:t,y:r+a/2},to:{x:t+o,y:r+a/2}}:Ud(e.querySelector("line"))?{kind:"line",axis:i,from:{x:t,y:r},to:{x:t+o,y:r+a}}:{kind:"line",axis:i,from:{x:t,y:r+a},to:{x:t+o,y:r}},Ud=e=>{const t=r=>Number(e?.getAttribute(r)??0);return(t("x2")-t("x1"))*(t("y2")-t("y1"))>=0},qd=[],Kd=(e,{frameElement:t,frameSize:r,panelRect:o,animateTransitions:a})=>{const i=l.useSceneSelector(b=>b.coordSystem),s=l.useGeomRendererResolver(),c=l.useGeomReaderTree(),d=Zd(e.kind==="guide"?e.target:null,{frameElement:t,frameSize:r}),h=Xd(t,r),p=(0,v.useMemo)(()=>({coordSystem:i,panelRect:o,resolveRenderer:s,geomReaders:c}),[i,o,s,c]),m=e.kind==="observations"?e.parts:null,g=e.kind==="observations"?e.vertex:null,f=(0,v.useMemo)(()=>m?.map(b=>Ln(b,p,a))??qd,[m,p,a]),x=(0,v.useMemo)(()=>g===null?null:Ln(g,p,!1),[g,p]);return(0,v.useMemo)(()=>{switch(e.kind){case"observations":return{kind:"observations",parts:f,vertex:x};case"guide":return{kind:"guide",target:e.target,shapes:d};case"graph":return{kind:"graph",frameSize:h}}},[e,f,x,d,h])},Xd=(e,t)=>{const[r,o]=(0,v.useState)(()=>mn(e,t));return(0,v.useLayoutEffect)(()=>{o(a=>{const i=mn(e,{width:t.width,height:t.height});return a.width===i.width&&a.height===i.height?a:i})},[e,t.width,t.height]),r},Ln=({layer:e,rows:t},{coordSystem:r,panelRect:o,resolveRenderer:a,geomReaders:i},s)=>{const c={...e,data:e.data.take(t)},d=a(e.geom,r.type);return d?.getEditOutlineShapes===void 0?{kind:"boxes",layer:e,rows:t,boxes:(0,u.measureObservationsBoxes)({layer:c,coordSystem:r,panelSize:o}).map(h=>Nd(h,o))}:{kind:"declared",layer:e,rows:t,shapes:d.getEditOutlineShapes({layer:c,sourceLayer:e,coordSystem:r,panelRect:o,styleReaders:i(e),animateTransitions:s})}},Zd=(e,{frameElement:t,frameSize:r})=>{const o=l.useSceneSelector(p=>p.coordSystem.type),a=l.useSceneSelector((0,J.useShallow)(p=>p.guides.legends.drawn.map(m=>m.display))),i=l.useSceneSelector(p=>e===null?null:p),[s,c]=(0,v.useState)([]),d=l.useLatestRef(e),h=(0,v.useRef)(!1);return(0,v.useLayoutEffect)(()=>{const p=d.current;if(p===null)return;const m=()=>{const g=Gd({frameElement:t,target:p,coordType:o,legendDisplays:a}),f=qr(t);c(g.map(x=>Yd(x,1/f)))};if(h.current){const g=requestAnimationFrame(m);return()=>cancelAnimationFrame(g)}h.current=!0,m()},[t,d,o,a,i,r.width,r.height]),s},Yd=(e,t)=>{switch(e.kind){case"box":{const{x:r,y:o,width:a,height:i}=e.rect;return{kind:"box",rect:{x:r*t,y:o*t,width:a*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}}},Jd=()=>{const e=l.useGraphSelection()[0]??null,{layers:t,parsingLocale:r}=l.useSceneSelector((0,J.useShallow)(o=>({layers:o.layers,parsingLocale:o.config.parsingLocale})));return(0,v.useMemo)(()=>e===null?null:Qd(e,t,r),[e,t,r])},Qd=(e,t,r)=>{switch(e.kind){case"observations":{const o=eu(e,t,r);return o===null?null:{outlined:o,target:e}}case"legend":case"axis":case"grid":return{outlined:{kind:"guide",key:(0,u.readEditTargetKey)(e),target:e},target:e};case"graph":return{outlined:{kind:"graph",key:"graph"},target:e};default:return null}},eu=(e,t,r)=>{const o=(0,u.findLayerById)(t,e.layerId);if(o===void 0)return null;const a=(0,u.resolveObservationsTarget)({layer:o,target:e,parsingLocale:r});if(a.length===0)return null;const i=[{layer:o,rows:a}];for(const s of(0,u.findCompanionLayers)(o,t)){const c=(0,u.resolveObservationsTarget)({layer:s,host:o,target:e,parsingLocale:r});c.length>0&&i.push({layer:s,rows:c})}return{kind:"observations",key:(0,u.readEditTargetKey)(e),layerId:e.layerId,scope:e.scope,parts:i,vertex:null}},tu=["x","y"],nu=(0,v.memo)(function({frameElement:t,frameSize:r,panelRect:o,animateTransitions:a}){const i=l.useResolvedStyle(u.resolveEditOutlineStyle,l.useStyleReaderTree()),s=Jd(),c=Fd(s?.outlined??null);if(s===null&&c===null)return null;const d={frameElement:t,frameSize:r,panelRect:o,animateTransitions:a};return(0,n.jsxs)("svg",{className:ec,width:r.width,height:r.height,"aria-hidden":!0,"data-testid":"edit-outline",children:[c!==null&&(0,n.jsx)(In,{part:"hover",target:c,look:i.hover,...d},c.key),s!==null&&(0,n.jsx)(In,{part:"selected",target:s.outlined,editTarget:s.target,look:i.selected,...d},s.outlined.key)]})}),In=({part:e,target:t,editTarget:r,look:o,frameSize:a,panelRect:i,frameElement:s,animateTransitions:c})=>{const d=(0,v.useId)(),h=`${d}-shapes`,p=`${d}-hole`,m=Kd(t,{frameElement:s,frameSize:a,panelRect:i,animateTransitions:c});return Ql(r===void 0?null:{target:r,outline:m},{frameElement:s,panelRect:i,look:o}),(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:tc,children:(0,n.jsx)(lu,{outline:m,look:o,panelRect:i})}),(0,n.jsxs)("mask",{id:p,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:ru(o.offset)})]})]}),(0,n.jsxs)("g",{mask:`url(#${p})`,"data-testid":`edit-outline-${e}-ring`,children:[(0,n.jsx)("use",{href:`#${h}`,style:ou(o)}),(0,n.jsx)("use",{href:`#${h}`,style:au(o)})]}),t.kind==="observations"&&(0,n.jsx)(mu,{target:t,look:o,panelRect:i})]})},ru=e=>({fill:"black",stroke:"black",strokeLinecap:"round",...(0,Y.assignInlineVars)({[Gt]:`${2*e}px`})}),ou=e=>({fill:"none",stroke:e.haloColor??l.vars.graphBackground,strokeLinecap:"round",opacity:e.haloAlpha,...(0,Y.assignInlineVars)({[Gt]:`${2*ve(e)}px`})}),au=e=>{const t=(0,u.toStrokeDasharray)(e.dashArray,e.strokeWidth);return{fill:"none",stroke:e.stroke,strokeDasharray:t,strokeLinecap:t===void 0?"round":"butt",opacity:e.strokeAlpha,...(0,Y.assignInlineVars)({[Gt]:`${2*ve(e)}px`})}},iu=({dashArray:e,strokeWidth:t})=>{if((0,u.toStrokeDasharray)(e,t)===void 0)return;const r=(e.length%2===0?1:2)*e.reduce((o,a)=>o+a*t,0);return r>0?r:void 0},wo=(e,t,r=1)=>{if(!(t===void 0||e<=0))return r*Math.max(1,Math.round(2*Math.PI*e/t))*t},su=(e,t,r)=>{const o=r.offset+ve(r);return l.buildRoundedRectPath(l.growRect({x:0,y:0,...e},-o),Math.max(0,t-o))},lu=({outline:e,look:t,panelRect:r})=>{const o=l.useStyleReaderTree().graph().get("cornerRadius"),{cornerRadius:a}=t,i=iu(t);switch(e.kind){case"observations":return(0,n.jsxs)("g",{transform:`translate(${r.x} ${r.y})`,children:[e.parts.map(s=>(0,n.jsx)(En,{part:s,borderRadius:a,dashPeriod:i},s.layer.id)),e.vertex!==null&&(0,n.jsx)(En,{part:e.vertex,borderRadius:a,dashPeriod:i},`vertex-${e.vertex.rows.join()}`)]});case"guide":return(0,n.jsx)(uu,{target:e.target,shapes:e.shapes,borderRadius:a,dashPeriod:i});case"graph":return(0,n.jsx)("path",{d:su(e.frameSize,o,t)})}},En=(0,v.memo)(function({part:t,borderRadius:r,dashPeriod:o}){return t.kind==="boxes"?(0,n.jsx)(du,{boxes:t.boxes,borderRadius:r}):(0,n.jsx)(cu,{shapes:t.shapes,layer:t.layer,dashPeriod:o})}),cu=({shapes:e,layer:t,dashPeriod:r})=>e.map((o,a)=>{const i=o.kind==="dots"||o.key===void 0?String(a):`${o.kind}:${o.key}`;switch(o.kind){case"region":return o.pathData===""?null:(0,n.jsx)(xn,{pathData:o.pathData,fillRule:o.fillRule,animateTransitions:o.animateTransitions??!1,source:t,"data-geom":t.geom},i);case"stroke":return o.pathData===""?null:(0,n.jsx)(xn,{pathData:o.pathData,animateTransitions:o.animateTransitions??!1,source:t,"data-geom":t.geom,...Kr(o.width)},i);case"dots":return o.centers.length===0?null:(0,n.jsx)("path",{d:l.buildCirclesPath(o.centers,o.size/2),pathLength:wo(o.size/2,r,o.centers.length),"data-geom":t.geom},i)}}),du=({boxes:e,borderRadius:t})=>{const r=e.map(o=>l.buildRoundedRectPath(o,t)).join("");return r===""?null:(0,n.jsx)("path",{d:r,"data-testid":"edit-outline-boxes"})},uu=({target:e,shapes:t,borderRadius:r,dashPeriod:o})=>{const a=l.useStyleReaderTree();if(e.kind==="grid")return tu.map(s=>{const c=Kr(l.readGridLineStyle(a,s).strokeWidth),d=t.map(p=>hu(p,s)).join(""),h=t.filter(p=>p.kind==="ring"&&p.axis===s);return(0,n.jsxs)(v.Fragment,{children:[d!==""&&(0,n.jsx)("path",{d,...c}),h.map((p,m)=>(0,n.jsx)("path",{d:pu(p),pathLength:wo(p.radius,o),...c},m))]},s)});const i=t.map(s=>s.kind==="box"?l.buildRoundedRectPath(s.rect,r):"").join("");return i===""?null:(0,n.jsx)("path",{d:i})},hu=(e,t)=>e.kind==="line"&&e.axis===t?`M${e.from.x},${e.from.y}L${e.to.x},${e.to.y}`:"",pu=({center:e,radius:t})=>{const r=`${e.x},${e.y-t}`;return`M${r}A${t},${t} 0 0 1 ${`${e.x},${e.y+t}`}A${t},${t} 0 0 1 ${r}`},mu=({target:e,look:t,panelRect:r})=>{const o=l.useSceneSelector(s=>s.coordSystem),a=e.parts[0];if(e.scope!=="x-value"||a===void 0||a.layer.highlight?.strategy!=="overlay-anchor")return null;const i=gu(a);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(o,i,r),stroke:t.stroke,strokeOpacity:t.strokeAlpha,strokeWidth:t.strokeWidth,strokeDasharray:"4 3",strokeLinecap:"round","data-testid":"edit-outline-band-guide"})})},gu=({layer:e,rows:t})=>{for(const r of t){const o=e.data.getAt(r),a=o===null?null:(0,u.getXBand)(o),i=o===null?null:(0,u.getYBand)(o);if(a!==null&&i!==null)return{x:a,y:i}}return null},vu="kwvn4c0",xu="kwvn4c1",To=(e,t)=>({contextElement:e,getBoundingClientRect:()=>{const r=e.getBoundingClientRect(),o=Ur(e,r.width);return new DOMRect(r.left+t.x*o,r.top+t.y*o,t.width*o,t.height*o)}}),fu=({side:e,boundary:t,spans:r,anchor:o,rightToLeft:a})=>{if(!bu(e))return 0;const i=r[e];if(e==="left"||e==="right")return Mn(i.from-t.y,o.height,t.height);const s=a?t.x+t.width-i.to:i.from-t.x;return Mn(s,o.width,t.width)},Ao=()=>{const[e,t]=(0,v.useState)(!1);return(0,v.useEffect)(()=>{t(!0)},[]),e},bu=e=>l.SIDE_KEYS.some(t=>t===e),Mn=(e,t,r)=>r===0?0:e*t/r,Su={x:8,y:8},yu={side:"flip",align:"shift",fallbackAxisSide:"end"},Cu=({frameElement:e,boundary:t,spans:r,clearance:o=Su,onEscape:a,children:i})=>{const s=se(),c=Ao(),[d,h]=(0,v.useState)(null),p=(0,v.useRef)(null),m=(0,v.useCallback)(w=>{p.current=w,h(w)},[]),g=(0,v.useRef)(null);(0,v.useLayoutEffect)(()=>()=>{d?.contains(document.activeElement)&&e.focus({preventScroll:!0})},[d,e]);const{x:f,y:x,width:b,height:S}=t,j=(0,v.useMemo)(()=>({box:{x:f,y:x,width:b,height:S},spans:r}),[f,x,b,S,r]),L=(0,v.useMemo)(()=>To(e,j.box),[e,j]),A=(w,I)=>{w||(I.cancel(),I.reason==="escape-key"&&a())};return(0,n.jsx)(H.Popover.Root,{open:c,modal:!1,onOpenChange:A,children:(0,n.jsx)(H.Popover.Portal,{container:s,children:(0,n.jsx)(Dt,{children:(0,n.jsx)(H.Popover.Positioner,{ref:g,anchor:L,side:"right",align:"start",sideOffset:({side:w})=>w==="top"||w==="bottom"?o.y:o.x,alignOffset:({side:w,anchor:I})=>fu({side:w,boundary:j.box,spans:j.spans,anchor:I,rightToLeft:ju(g.current)}),collisionAvoidance:yu,sticky:!0,className:vu,..._t,children:(0,n.jsx)(H.Popover.Popup,{ref:m,className:xu,initialFocus:p,finalFocus:!1,"data-testid":"anchored-popover",children:i})})})})})},ju=e=>e!==null&&getComputedStyle(e).direction==="rtl",ko=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"})]}),Po=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"})]}),Lo=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"})]}),Wt=e=>(0,v.useMemo)(()=>{if(e===null)return{options:[],findValue:()=>{}};const{parsingLocale:t,numberFormat:r}=e.config,o=e.guides.colorGroups.map(a=>{const i=(0,u.createValueFormatter)({valueFormat:a.valueFormat,locale:t,numberFormat:r}),s=a.value instanceof Date?a.value.getTime():a.value;return{value:s,option:{value:String(s),label:a.label??i(a.value)}}});return{options:o.map(({option:a})=>a),findValue:a=>o.find(i=>i.option.value===a)?.value}},[e]),wu=({scene:e,layer:t,observation:r,groupOptions:o,locale:a,t:i})=>{const s=jt(e,t,r,o);return{"data-point":i(Pu(e,t)),"x-value":i("editor.overlayMenu.allOf",{name:Io(e,t,r,a)}),series:s===null?i("editor.overlayMenu.all"):i("editor.overlayMenu.allOf",{name:s})}},Tu=({scene:e,layer:t,observation:r,groupOptions:o,locale:a,t:i},s)=>{const c=(0,u.getGroupVariables)(t.data,t.mapping),d=Io(e,t,r,a);switch(s){case"data-point":{const h=c.length===0?null:jt(e,t,r,o),p=Au(h,d,i);return{whole:p,value:p}}case"x-value":return Rn((0,u.findAxisGuide)(e.guides,"x")?.label??null,d,i);case"series":{const h=jt(e,t,r,o)??i("editor.overlayMenu.all");return Rn(ku(e,c),h,i)}default:return s}},Au=(e,t,r)=>e===null?t:t===""?e:r("editor.overlayMenu.groupAtBand",{group:e,band:t}),Rn=(e,t,r)=>({whole:e===null||e===""?t:r("editor.overlayMenu.titledValue",{title:e,value:t}),value:t}),ku=(e,t)=>{const[r,...o]=t;return r===void 0||o.length>0?null:e.guides.variableLabels[r]??null},Pu=(e,t)=>{switch(t.geom){case"bar":return e.coordSystem.type==="polar"&&e.coordSystem.bandAxis===null?"editor.overlayMenu.thisSlice":"editor.overlayMenu.thisBar";case"point":return(0,u.readVariableName)(t.mapping.size)===null?"editor.overlayMenu.thisPoint":"editor.overlayMenu.thisBubble";default:return"editor.overlayMenu.thisPoint"}},Io=(e,t,r,o)=>{const a=(0,u.findAxisGuide)(e.guides,"x");return(0,u.createValueFormatter)({valueFormat:a===null?{type:"text"}:(0,u.resolveLayerAxisValueFormat)(a,t.id),locale:o,numberFormat:e.config.numberFormat})((0,u.createXValueReader)(t.data,t.mapping)(r),r)},jt=(e,t,r,o)=>{const a=(0,u.getGroupVariables)(t.data,t.mapping);return a.length===0?Lu(e,t):a.map(i=>Iu(r[i]??null,o)).join(", ")},Lu=(e,t)=>{const r=(0,u.readVariableName)(t.mapping.y),o=r===null?void 0:e.guides.variableLabels[r];return o===void 0||o===""?null:o},Iu=(e,t)=>{const r=String(e instanceof Date?e.getTime():e);return t.options.find(o=>o.value===r)?.label??r},Eu={"data-point":ko,"x-value":Po,series:Lo},Mu=()=>{const{selectionStore:e}=l.useGraphContext(),t=l.useEditorStore(),r=l.useI18n(),o=l.useGraphLocale(),a=l.useSceneSelector(S=>S),i=Wt(a),s=l.useEditorState(S=>S.pressedObservation),c=qe(),d=(0,v.useMemo)(()=>Ru({scene:a,pressed:s,groupOptions:i,locale:o,t:r,hasOverlayMenu:c}),[a,s,i,o,r,c]);if(d===null)return null;const{layer:h,levels:p,names:m}=d,{observationIndex:g,selectedFor:f}=d.pressed,x=p.map(S=>{const j=Eu[S];return{value:S,label:m[S],icon:(0,n.jsx)(j,{})}}),b=S=>{const j=p.find(w=>w===S),{parsingLocale:L}=a.config,A=j===void 0?null:(0,u.buildObservationsTarget)({layer:h,observationIndex:g,scope:j,parsingLocale:L});A!==null&&(t.getState().setPressedObservation({...d.pressed,selectedFor:A}),e.getState().setSelection([A]))};return(0,n.jsx)(Ft,{value:f.scope,options:x,onChange:b,ariaLabel:r("editor.overlayMenu.selection")})},Ru=({scene:e,pressed:t,groupOptions:r,locale:o,t:a,hasOverlayMenu:i})=>{const s=t===null?null:l.findPressedObservation(t,e.layers,e.config.parsingLocale);if(t===null||s===null)return null;const{layer:c,observation:d}=s,{observationIndex:h,selectedFor:p}=t,{parsingLocale:m}=e.config,g=(0,u.readReachableLevels)({layer:c,observationIndex:h,parsingLocale:m,scales:e.scales}).filter(f=>{const x=(0,u.buildObservationsTarget)({layer:c,observationIndex:h,scope:f,parsingLocale:m});return x!==null&&i(x)});return g.length<2||!g.includes(p.scope)?null:{pressed:t,layer:c,levels:g,names:wu({scene:e,layer:c,observation:d,groupOptions:r,locale:o,t:a})}},Ou=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:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"}),(0,n.jsx)("circle",{cx:"12",cy:"12",r:"3"})]})}),_u=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.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"}),(0,n.jsx)("path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242"}),(0,n.jsx)("path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"}),(0,n.jsx)("path",{d:"m2 2 20 20"})]})}),Nu="_1de58rm0",Du=({target:e})=>{const t=l.useI18n(),r=l.useGraphCommands(),o=l.useSceneSelector(f=>f),[a,i]=(0,v.useState)(null),s=jo(e,o);if(s===null)return null;const{hidden:c,hide:d,show:h}=s,p=()=>{if(c){r.dispatch(a??h);return}i(h),r.dispatch(d)},m=t(c?"editor.overlayMenu.show":"editor.overlayMenu.hide"),g=c?_u:Ou;return(0,n.jsx)(Ue,{label:m,children:(0,n.jsx)("button",{type:"button",className:Nu,onClick:p,children:(0,n.jsx)(g,{title:""})})})},Fu="_1xgvyvc0",Bu="_1xgvyvc1",zu="_1xgvyvc2",Gu="_1xgvyvc3",Hu=(e,t)=>{switch(e.kind){case"observations":return Vu(e.scope,t);case"legend":case"axis":case"grid":return Wu(e.kind,t);case"graph":return t("editor.overlayMenu.chart");default:return e}},Vu=(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}},Wu=(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}},$u=({target:e})=>{const t=l.useI18n(),r=l.useGraphLocale(),o=l.useSceneSelector(s=>s),a=Wt(o),i=(0,v.useMemo)(()=>qu({target:e,scene:o,groupOptions:a,locale:r,t}),[e,o,a,r,t]);return(0,n.jsx)(Uu,{title:i})},Uu=({title:e})=>{const t=(0,v.useRef)(null),r=(0,v.useRef)(null),[o,a]=(0,v.useState)(!1),i=(0,v.useCallback)(()=>{const d=t.current,h=r.current;d===null||h===null||a(h.offsetWidth>d.clientWidth)},[]);(0,v.useLayoutEffect)(i,[i,e.whole]);const{setElement:s}=l.useResizeObserver({onResize:i}),c=(0,v.useCallback)(d=>{t.current=d,s(d)},[s]);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(H.Popover.Title,{ref:c,className:zu,"data-testid":"overlay-menu-title",children:o?e.value:e.whole}),(0,n.jsx)("span",{ref:r,className:Gu,"aria-hidden":!0,children:e.whole})]})},qu=({target:e,scene:t,groupOptions:r,locale:o,t:a})=>{const i=Hu(e,a),s={whole:i,value:i};if(e.kind!=="observations")return s;const c=(0,u.findLayerById)(t.layers,e.layerId);if(c===void 0)return s;const[d]=(0,u.resolveObservationsTarget)({layer:c,target:e,parsingLocale:t.config.parsingLocale}),h=d===void 0?null:c.data.getAt(d);return h===null?s:Tu({scene:t,layer:c,observation:h,groupOptions:r,locale:o,t:a},e.scope)},Ku=({frameElement:e})=>{const{selectionStore:t}=l.useGraphContext(),r=Xu(l.useEditorState(c=>c.selectedOutline)),o=Od(r?.target??null),a=qe();if(r===null||!a(r.target))return null;const i=()=>{t.getState().clearSelection()},s=(0,u.readEditTargetKey)(r.target);return(0,n.jsxs)(Cu,{frameElement:e,boundary:r.frame,spans:r.frameSpans,onEscape:i,children:[(0,n.jsxs)(pt,{className:Fu,children:[(0,n.jsxs)("div",{className:Bu,children:[(0,n.jsx)($u,{target:r.target}),(0,n.jsx)(Du,{target:r.target},s)]}),r.target.kind==="observations"&&(0,n.jsx)(Mu,{})]}),(0,n.jsx)(v.Fragment,{children:o},s)]})},Xu=e=>{const t=l.useGraphSelection(),[r,o]=(0,v.useState)(e),a=r!==null&&(0,u.areEditTargetsEqual)(t[0]??null,r.target),i=e??(a?r:null);return i!==r&&o(i),i},Zu=({frameRect:e})=>{const{targetBoundaryStore:t}=l.useGraphContext(),r=l.useEditorState(s=>s.selectedOutline),{left:o,top:a}=e,i=(0,v.useMemo)(()=>{if(r===null)return null;const{frame:s,frameSpans:c,frameScale:d}=r;return{frame:s,client:{x:o+s.x*d,y:a+s.y*d,width:s.width*d,height:s.height*d},frameSpans:c,clientSpans:{top:Te(c.top,o,d),right:Te(c.right,a,d),bottom:Te(c.bottom,o,d),left:Te(c.left,a,d)}}},[r,o,a]);return(0,v.useLayoutEffect)(()=>{t.getState().setBoundary(i)},[t,i]),(0,v.useLayoutEffect)(()=>()=>t.getState().setBoundary(null),[t]),null},Te=(e,t,r)=>({from:t+e.from*r,to:t+e.to*r}),Eo=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 Mo="efjmb40",Ro="efjmb41",re="efjmb42",oe="efjmb43",Yu="efjmb44",Ju="efjmb45",Qu=new Set(["item-press","escape-key","outside-press","close-press","sibling-open","trigger-press"]),$t=({label:e,icon:t,onOpened:r,children:o})=>{const a=se(),[i,s]=(0,v.useState)(!1),c=(d,h)=>{d?(s(!0),r?.()):Qu.has(h.reason)&&s(!1)};return(0,n.jsxs)(te.Menu.SubmenuRoot,{open:i,onOpenChange:c,children:[(0,n.jsx)(eh,{label:e,icon:t}),(0,n.jsx)(te.Menu.Portal,{container:a,children:(0,n.jsx)(l.PortalThemeProvider,{children:(0,n.jsx)(te.Menu.Positioner,{side:"inline-end",align:"start",sideOffset:4,className:Mo,..._t,children:(0,n.jsx)(te.Menu.Popup,{className:Ro,children:o})})})})]})},eh=({label:e,icon:t})=>(0,n.jsxs)(te.Menu.SubmenuTrigger,{className:re,openOnHover:!1,children:[t,(0,n.jsx)("span",{className:oe,children:e}),(0,n.jsx)("span",{className:Ju,children:(0,n.jsx)(ge,{size:"sm"})})]}),th="_1qe7q450",nh="_1qe7q451",rh="_1qe7q452",oh=({label:e,placeholder:t,addLabel:r,at:o,onRequestClose:a})=>{const i=(0,v.useRef)(null),[s,c]=(0,v.useState)(""),{dispatch:d}=l.useGraphCommands(),h=s.trim(),p=()=>{h.length!==0&&(d(new u.AddAnnotationCommand({kind:"comment",annotation:{at:o,content:ah(h)}})),a())},m=x=>{x.key==="Enter"&&(x.preventDefault(),p()),x.key!=="Escape"&&x.stopPropagation()},g=x=>{c(x.target.value)},f=()=>{requestAnimationFrame(()=>i.current?.focus())};return(0,n.jsx)($t,{label:e,icon:(0,n.jsx)(Eo,{}),onOpened:f,children:(0,n.jsxs)("div",{className:th,children:[(0,n.jsx)("input",{ref:i,className:nh,value:s,placeholder:t,onChange:g,onKeyDown:m}),(0,n.jsx)("button",{type:"button",className:rh,disabled:h.length===0,onClick:p,children:r})]})})},ah=e=>({type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e}]}]}),ih=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"})}),sh="relative-difference",lh=({label:e,layer:t,at:r,onRequestClose:o})=>{const{dispatch:a}=l.useGraphCommands(),i=l.useSceneSelector(d=>d.coordSystem),s=(0,v.useMemo)(()=>(0,u.inferDifferenceArrowEndpoints)({layer:t,at:r,coordSystem:i}),[t,r,i]);if(s===null)return null;const c=()=>{a(new u.AddAnnotationCommand({kind:"differenceArrow",annotation:{...u.DIFFERENCE_ARROW_DEFAULTS,...s,label:sh}})),o()};return(0,n.jsxs)(F.Menu.Item,{className:re,onClick:c,children:[(0,n.jsx)(ih,{}),(0,n.jsx)("span",{className:oe,children:e})]})};function ch(e,t){if(e.type==="polar"&&!dh(t))return[{scope:"series",labelKey:"pieSlice"}];const r=(0,u.hasMultipleGroups)(t.data,t.mapping);switch(t.geom){case"bar":{const o=[{scope:"data-point",labelKey:"bar"}];if(r){const a=t.position==="stack"||t.position==="fill";o.push({scope:"x-value",labelKey:a?"barStack":"barGroup"}),o.push({scope:"series",labelKey:"barSeries"})}return o}case"line":case"area":{const o=[{scope:"data-point",labelKey:"linePoint"}];return r&&o.push({scope:"series",labelKey:"lineSeries"}),o}case"point":{const o=[{scope:"data-point",labelKey:"scatterPoint"}];return r&&o.push({scope:"series",labelKey:"scatterSeries"}),o}default:return[]}}var dh=e=>{const t=(0,u.readVariableName)(e.mapping.x);return t!==null&&t!==u.CONSTANT_VARIABLES.x},uh=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"})]}),hh=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"})]}),ph=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"})]}),mh=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"})]}),gh=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)"})]}),vh=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)"})]}),xh={bar:ko,barGroup:Po,barStack:uh,barSeries:Lo,linePoint:hh,lineSeries:ph,scatterPoint:gh,scatterSeries:vh,pieSlice:mh},Oo=({labelKey:e})=>{const t=xh[e];return(0,n.jsx)(t,{})},_o=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"})]}),fh=({label:e,options:t,onSelect:r})=>{const o=l.useI18n();return(0,n.jsx)($t,{label:e,icon:(0,n.jsx)(_o,{}),children:t.map(a=>(0,n.jsxs)(te.Menu.Item,{className:re,onClick:()=>r(a.scope),children:[(0,n.jsx)(Oo,{labelKey:a.labelKey}),(0,n.jsx)("span",{className:oe,children:o(`graph.annotations.highlights.labels.${a.labelKey}`)})]},a.scope))})},bh=({label:e,layer:t,observation:r,highlights:o,onRequestClose:a})=>{const i=l.useI18n(),{dispatch:s}=l.useGraphCommands(),c=l.useSceneSelector(f=>f.coordSystem),d=(0,v.useMemo)(()=>(0,u.buildObservationPredicate)(t,r),[t,r]),h=(0,v.useMemo)(()=>ch(c,t),[c,t]),p=(0,v.useMemo)(()=>{const f=new Set(o.map(x=>x.scope));return h.filter(x=>!f.has(x.scope))},[h,o]),[m]=p;if(d===null||m===void 0)return null;const g=f=>{s(new u.AddHighlightCommand({predicate:d,scope:f,layerId:t.id})),a()};if(p.length===1){const f=h.length===1?e:i("graph.annotations.baseMenu.highlightWithLabel",{label:i(`graph.annotations.highlights.labels.${m.labelKey}`)});return(0,n.jsxs)(te.Menu.Item,{className:re,onClick:()=>g(m.scope),children:[(0,n.jsx)(Oo,{labelKey:m.labelKey}),(0,n.jsx)("span",{className:oe,children:f})]})}return(0,n.jsx)(fh,{label:e,options:p,onSelect:g})},Sh="_1aafi1g0",yh="_1aafi1g1",No=({children:e})=>(0,n.jsxs)("span",{className:Sh,"aria-hidden":"true",children:[e,(0,n.jsx)("span",{className:yh})]}),Ch=({label:e,highlights:t,onRequestClose:r})=>{const{dispatch:o}=l.useGraphCommands(),a=t.at(-1);if(a===void 0)return null;const i=()=>{o(new u.RemoveHighlightCommand({id:a.id})),r()};return(0,n.jsxs)(F.Menu.Item,{className:re,onClick:i,children:[(0,n.jsx)(No,{children:(0,n.jsx)(_o,{})}),(0,n.jsx)("span",{className:oe,children:e})]})},jh=(e,t)=>{const r=l.useSceneSelector(a=>a.spec.highlights),o=l.useSceneSelector(a=>a.config.parsingLocale);return(0,v.useMemo)(()=>(0,u.findHighlightsAtObservation)({layer:e,highlights:r,observation:t,parsingLocale:o}),[e,r,t,o])},Do=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"})]}),wh=({label:e,at:t,onRequestClose:r})=>{const{dispatch:o}=l.useGraphCommands(),a=()=>{o(new u.AddAnnotationCommand({kind:"pinnedNumber",annotation:{at:t}})),r()};return(0,n.jsxs)(F.Menu.Item,{className:re,onClick:a,children:[(0,n.jsx)(Do,{}),(0,n.jsx)("span",{className:oe,children:e})]})},Fo=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"})]}),Bo={pinnedNumber:{icon:Do,labelKey:"graph.annotations.baseMenu.unpinNumber"},comment:{icon:Eo,labelKey:"graph.annotations.baseMenu.removeAnnotation"},sticker:{icon:Fo,labelKey:"graph.annotations.baseMenu.removeSticker"},image:null},Th=e=>(0,u.isObservationAttachmentKind)(e.kind)&&Bo[e.kind]!==null,Ah=({attachment:e,onRequestClose:t})=>{const r=l.useI18n(),{dispatch:o}=l.useGraphCommands(),{icon:a,labelKey:i}=Bo[e.kind],s=()=>{o(new u.RemoveAnnotationCommand({id:e.annotation.id})),t()};return(0,n.jsxs)(F.Menu.Item,{className:re,onClick:s,children:[(0,n.jsx)(No,{children:(0,n.jsx)(a,{})}),(0,n.jsx)("span",{className:oe,children:r(i)})]})},kh="ceeojg0",Ph="ceeojg1",Lh="ceeojg2",Ih=({label:e,at:t,onRequestClose:r})=>{const{dispatch:o}=l.useGraphCommands(),a=i=>{o(new u.AddAnnotationCommand({kind:"sticker",annotation:{at:{anchorType:"observation",...t},sticker:i}})),r()};return(0,n.jsx)($t,{label:e,icon:(0,n.jsx)(Fo,{}),children:(0,n.jsx)("div",{className:kh,children:Object.entries(l.STICKER_ASSETS).map(([i,s])=>(0,n.jsx)(te.Menu.Item,{className:Ph,"aria-label":i,onClick:()=>a(i),children:(0,n.jsx)("img",{className:Lh,src:s.src,alt:i})},i))})})},Eh=({interaction:e,frameElement:t,panelRect:r})=>{const o=l.useEditorStore(),a=l.useEditorState(d=>d.menuTrigger);if(e.kind!=="menu"||a===null)return null;const i=()=>{o.getState().releaseInteraction("menu")},{center:s,radius:c}=a;return(0,n.jsx)(Mh,{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})},Mh=({frameElement:e,trigger:t,layer:r,at:o,observation:a,onClose:i})=>{const s=l.useI18n(),c=se(),d=l.useSceneSelector(w=>w.spec.annotations),h=l.useSceneSelector(w=>w.config.parsingLocale),p=Ao(),{x:m,y:g,width:f,height:x}=t,b=(0,v.useMemo)(()=>To(e,{x:m,y:g,width:f,height:x}),[e,m,g,f,x]),S=(0,u.findObservationAttachment)(d,o,(0,v.useMemo)(()=>(0,u.createObservationAnchorParser)(r,h),[r,h])),j=S!==null&&Th(S)?S:null,L=jh(r,a),A=(w,I)=>{!w&&Rh(I.reason)&&i()};return(0,n.jsx)(F.Menu.Root,{open:p,modal:!1,onOpenChange:A,children:(0,n.jsx)(F.Menu.Portal,{container:c,children:(0,n.jsx)(l.PortalThemeProvider,{children:(0,n.jsx)(F.Menu.Positioner,{anchor:b,side:"right",align:"start",sideOffset:8,className:Mo,..._t,children:(0,n.jsxs)(F.Menu.Popup,{className:Ro,"data-testid":"observation-menu",children:[j!==null&&(0,n.jsx)(Ah,{attachment:j,onRequestClose:i}),(0,n.jsx)(Ch,{label:s("graph.annotations.baseMenu.removeHighlight"),highlights:L,onRequestClose:i}),(0,n.jsx)(F.Menu.Separator,{className:Yu}),j===null&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(wh,{label:s("graph.annotations.baseMenu.pinNumber"),at:o,onRequestClose:i}),(0,n.jsx)(oh,{label:s("graph.annotations.baseMenu.annotate"),placeholder:s("graph.annotations.textMenu.placeholder"),addLabel:s("graph.annotations.textMenu.addButton"),at:o,onRequestClose:i}),(0,n.jsx)(Ih,{label:s("graph.annotations.baseMenu.addSticker"),at:o,onRequestClose:i})]}),r.highlight!==null&&(0,n.jsx)(bh,{label:s("graph.annotations.baseMenu.highlight"),layer:r,observation:a,highlights:L,onRequestClose:i}),(0,n.jsx)(lh,{label:s("graph.annotations.baseMenu.differenceArrow"),layer:r,at:o,onRequestClose:i})]})})})})})},Rh=e=>e==="outside-press"||e==="escape-key"||e==="item-press",Ut="l8tsqe0",zo=["start","end"],Go=({anchor:e,point:t,delta:r})=>{const o={x:On(t.x,r.x),y:On(1-t.y,r.y)};return{anchor:{...e,x:e.x+o.x,y:e.y+o.y},point:{x:t.x+o.x,y:t.y-o.y}}},qt=(e,t)=>({...e,[t.endpoint]:{...e[t.endpoint],...t.point}}),Ho=(e,t)=>e.x===t.x&&e.y===t.y,Oh=(e,t)=>{const r=(0,u.projectAnchorToPanel)(e,t);return{x:t.x+r.x,y:t.y+r.y}},_h=(e,t,r)=>{const o=(0,u.projectAnchorToPanel)(e,r),a=(0,u.projectAnchorToPanel)(t,r);return{x:Math.min(o.x,a.x),y:Math.min(o.y,a.y),width:Math.abs(a.x-o.x),height:Math.abs(a.y-o.y)}},On=(e,t)=>!Number.isFinite(t)||!Number.isFinite(e)?0:(0,ne.clamp)(t,Math.min(-e,0),Math.max(1-e,0)),Nh=({panelRect:e})=>{const t=l.useEditorState(c=>l.readStanding(c,"arrow-endpoint-drag")),r=l.useResolvedAnnotations(e).arrows,o=l.useStyleReaderTree();if(t===null)return null;const a=r.find(c=>c.id===t.annotationId);if(a===void 0)return null;const i=(0,u.resolveArrowAnnotationStyle)(o,a.id),s=(0,u.computeArrow)({arrow:qt(a,t),style:i,panelWidth:e.width,panelHeight:e.height});return s===null?null:(0,n.jsx)("svg",{"aria-hidden":"true",className:Ut,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,addressable:!1})})},fe=()=>{const e=l.useGraphSelection();return wt(e)},wt=e=>{if(e.length!==1)return null;const[t]=e;return t?.kind==="annotation"?t.id:null},Dh=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"})]})}),Vo=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"})]})}),Fh=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"})]})}),Wo=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"})]})}),Ke=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"})]})}),Bh="var(--pvjfpx0)",zh="var(--pvjfpx1)",Gh="pvjfpx2",Hh="pvjfpx3",Vh="pvjfpx4",Wh="pvjfpx6 pvjfpx5",$h="pvjfpx7 pvjfpx6 pvjfpx5",Uh="pvjfpx8 pvjfpx5",de=8,qh=({anchorBox:e,panelRect:t,frameWidth:r,frameHeight:o})=>{const a=t.y+e.y,i=a+e.height,s=a-8-36,c=i+8,d=(0,ne.clamp)(s>=de?s:c,de,o-de-36),h=de;return{top:d,left:h,available:Math.max(0,r-de*2),centre:t.x+e.x+e.width/2-h}},Kh=({anchorBox:e,panelRect:t,frameWidth:r,frameHeight:o,label:a,testId:i,children:s})=>{const{chartId:c}=l.useGraphContext(),d=qh({anchorBox:e,panelRect:t,frameWidth:r,frameHeight:o});return(0,n.jsx)("div",{className:Gh,style:{top:d.top,left:d.left,width:d.available},children:(0,n.jsx)(G.Root,{"aria-label":a,className:Hh,"data-testid":i,...We(c),style:(0,Y.assignInlineVars)({[Bh]:`${d.centre}px`,[zh]:`${d.available}px`}),children:s})})},Xh=({label:e,trigger:t,open:r,onOpenChange:o,disabled:a=!1,children:i})=>{const{chartId:s}=l.useGraphContext();return(0,n.jsxs)(F.Menu.Root,{open:r,modal:!1,onOpenChange:o,children:[(0,n.jsxs)(F.Menu.Trigger,{render:(0,n.jsx)(G.Button,{}),"aria-label":e,className:Uh,disabled:a,onMouseDown:c=>c.preventDefault(),children:[t,(0,n.jsx)(ge,{size:"sm"})]}),(0,n.jsx)(G.MenuPopup,{popupAttributes:We(s),children:i})]})},Zh=e=>{const{chartId:t}=l.useGraphContext();return(0,n.jsx)(G.ColorPicker,{...e,popupAttributes:We(t)})},Yh=({color:e,opacity:t})=>(0,n.jsx)("span",{className:Vh,style:{background:e,opacity:t}}),Jh=({label:e,onClick:t,children:r})=>(0,n.jsx)(G.Button,{"aria-label":e,className:Wh,onClick:t,children:r}),Qh=({label:e,pressed:t,onClick:r,children:o})=>(0,n.jsx)(G.Button,{"aria-label":e,"aria-pressed":t,className:$h,onClick:r,children:o}),_={Root:Kh,Dropdown:Xh,MenuItem:G.MenuItem,ColorPicker:Zh,Swatch:Yh,IconButton:Jh,ToggleButton:Qh,Button:G.Button,Separator:G.Separator},e0={kind:"chrome-popup"},Xe=()=>{const{commands:e}=l.useGraphContext(),t=l.useEditorStore(),[r,o]=(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(e0),()=>s("chrome-popup")},[t,r]);const a=()=>{o(null),e.commit()};return{bind:i=>({open:r===i,onOpenChange:s=>s?o(i):a()}),close:a}},t0=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"})]})}),n0=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"})]})}),r0=e=>(0,n.jsx)(l.Icon,{...e,children:(0,n.jsx)("path",{d:"M5 19 19 5",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round"})}),o0=[{value:u.ARROW_STROKE_WIDTHS_PX.thin,key:"graph.annotations.arrowToolbar.thickness.thin"},{value:u.ARROW_STROKE_WIDTHS_PX.medium,key:"graph.annotations.arrowToolbar.thickness.medium"},{value:u.ARROW_STROKE_WIDTHS_PX.thick,key:"graph.annotations.arrowToolbar.thickness.thick"}],_n=[{value:"line-arrow",key:"graph.annotations.arrowToolbar.arrowhead.lineArrow",Icon:Vo},{value:"none",key:"graph.annotations.arrowToolbar.arrowhead.none",Icon:l.MinusIcon}],Nn=[{value:"solid",key:"graph.annotations.arrowToolbar.lineStyle.solid",Icon:r0},{value:"dashed",key:"graph.annotations.arrowToolbar.lineStyle.dashed",Icon:t0},{value:"dotted",key:"graph.annotations.arrowToolbar.lineStyle.dotted",Icon:n0}],a0=(e,t)=>e.find(r=>r.value===t)??e[0];var i0=({arrow:e,arrowBox:t,panelRect:r,frameWidth:o,frameHeight:a,frameElement:i})=>{const s=l.useI18n(),{commands:c}=l.useGraphContext(),d=l.useSceneSelector(C=>C.spec.styles.overrides),h=l.useSceneSelector(C=>(0,u.readStyleCoord)(C.spec)),p=Xe(),m=(0,u.resolveArrowAnnotationStyle)(l.useStyleReaderTree(),e.id),g=a0(Nn,(0,u.toDashPreset)(m.dashArray)),f=m.outline.strokeWidth>0||m.outline.shadow!=="none",x=(0,v.useMemo)(()=>({target:"annotation",kind:"arrow",annotation:e.id}),[e.id]),b=(0,v.useMemo)(()=>({...x,part:"outline"}),[x]),S=(C,y)=>{const M=(0,u.findStyleRule)(d,{select:x},h)?.declarations??{};c.dispatch(new u.SetStyleRuleCommand({list:"overrides",rule:{select:x,declarations:{...M,...C}}}),y)},j=C=>{const y=(0,u.findStyleRule)(d,{select:b},h)?.declarations??{};c.dispatch(new u.SetStyleRuleCommand({list:"overrides",rule:{select:b,declarations:{...y,...C}}}))},L=C=>{S(C),p.close()},A=C=>{c.dispatch(new u.UpdateAnnotationCommand({kind:"arrow",id:e.id,patch:C})),p.close()},w=()=>{c.dispatch(new u.RemoveAnnotationCommand({id:e.id})),i.focus({preventScroll:!0})},I=C=>S({stroke:C},{transient:!0}),T=C=>L({strokeWidth:C}),P=C=>A({startArrowheadStyle:C}),N=C=>L({dashArray:u.DASH_PRESETS.arrow[C]}),V=C=>A({endArrowheadStyle:C}),R=()=>j(f?{strokeWidth:0,shadow:"none"}:u.ARROW_STICKER_DECLARATIONS);return(0,n.jsxs)(_.Root,{anchorBox:t,panelRect:r,frameWidth:o,frameHeight:a,label:s("graph.annotations.arrowToolbar.label"),testId:"arrow-toolbar",children:[(0,n.jsx)(_.ColorPicker,{color:m.stroke,label:s("graph.annotations.arrowToolbar.color"),onChange:I,...p.bind("color"),children:(0,n.jsx)(_.Swatch,{color:m.stroke})}),(0,n.jsx)(_.Dropdown,{label:s("graph.annotations.arrowToolbar.thickness.ariaLabel"),trigger:(0,n.jsx)(Wo,{size:"sm",title:""}),...p.bind("thickness"),children:(0,n.jsx)(Ae,{options:o0,current:m.strokeWidth,onPick:T})}),(0,n.jsx)(_.Dropdown,{label:s("graph.annotations.arrowToolbar.startArrowhead"),trigger:(0,n.jsx)(Dh,{size:"sm",title:""}),...p.bind("startArrowhead"),children:(0,n.jsx)(Ae,{options:_n,current:e.startArrowheadStyle,onPick:P})}),(0,n.jsx)(_.Dropdown,{label:s("graph.annotations.arrowToolbar.lineStyle.ariaLabel"),trigger:g?.Icon!==void 0&&(0,n.jsx)(g.Icon,{size:"sm",title:""}),...p.bind("lineStyle"),children:(0,n.jsx)(Ae,{options:Nn,current:(0,u.toDashPreset)(m.dashArray),onPick:N})}),(0,n.jsx)(_.Dropdown,{label:s("graph.annotations.arrowToolbar.endArrowhead"),trigger:(0,n.jsx)(Vo,{size:"sm",title:""}),...p.bind("endArrowhead"),children:(0,n.jsx)(Ae,{options:_n,current:e.endArrowheadStyle,onPick:V})}),(0,n.jsx)(_.ToggleButton,{label:s("graph.annotations.arrowToolbar.sticker"),pressed:f,onClick:R,children:(0,n.jsx)(Fh,{size:"sm",title:""})}),(0,n.jsx)(_.Separator,{}),(0,n.jsx)(_.IconButton,{label:s("graph.annotations.arrowToolbar.remove"),onClick:w,children:(0,n.jsx)(Ke,{size:"sm",title:""})})]})},Ae=({options:e,current:t,onPick:r})=>{const o=l.useI18n(),a=i=>()=>r(i);return(0,n.jsx)(n.Fragment,{children:e.map(i=>(0,n.jsxs)(_.MenuItem,{selected:i.value===t,onClick:a(i.value),children:[(0,n.jsx)("span",{children:o(i.key)}),i.Icon!==void 0&&(0,n.jsx)("span",{className:"_112xh5c0",children:(0,n.jsx)(i.Icon,{size:"sm",title:""})})]},String(i.value)))})},s0="_1me29t10",K=(e,t)=>t>0?e/t:0,Ze=(e,t,r)=>({x:K(t.x-e.x,r.width),y:K(t.y-e.y,r.height)}),l0=e=>e.x!==0||e.y!==0,$o=(e,t)=>({x:e.x*t.width,y:e.y*t.height});var c0=(e,t)=>Math.hypot(t.x-e.x,t.y-e.y)>=3,be=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 o={x:t.clientX,y:t.clientY};if(!this.hasPublished&&!this.isDragConfirmed(this.params.press,o))return;const a=this.resolvePreview(o);a!==null&&(r.claimInteraction(a),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 c0(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)}},Fe=(e,t,r)=>{const o=e.arrows.find(i=>i.id===t);if(o===void 0)return null;const a=o[r];return a.anchorType==="panel"?a:null},Uo=(e,t)=>e==="start"?{start:t}:{end:t},d0=class extends be{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:o,readInputs:a}=this.params,{annotations:i,arrow:s,panelRect:c}=a(),d=Fe(i,t,r);return d===null?null:{kind:"arrow-endpoint-drag",annotationId:t,endpoint:r,...Go({anchor:d,point:s[r],delta:Ze(o,e,c)})}}commit({anchor:e}){const{annotationId:t,endpoint:r,dispatch:o,readInputs:a}=this.params,i=Fe(a().annotations,t,r);i===null||Ho(i,e)||o(new u.UpdateAnnotationCommand({kind:"arrow",id:t,patch:Uo(r,e)}))}},u0=({annotationId:e,arrow:t,panelRect:r})=>{const{commands:o}=l.useGraphContext(),a=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 d0({handle:d.currentTarget,pointerId:d.pointerId,annotationId:e,endpoint:c,press:{x:d.clientX,y:d.clientY},readInputs:()=>i.current,editorStore:a,dispatch:o.dispatch,onSettled:()=>{s.current=null}}),s.current.start()}}}),[e,i,a,o])},h0=[" ","Enter"],Dn=4,p0=({annotationId:e,arrow:t,panelRect:r})=>{const{commands:o}=l.useGraphContext(),a=l.useEditorStore(),i=l.useSceneSelector(d=>d.spec.annotations),s=l.useLatestRef(i),c=l.useLatestRef(o.dispatch);return(0,v.useEffect)(()=>()=>{for(const d of zo)Fn({editorStore:a,annotationId:e,endpoint:d,annotations:s.current,dispatch:c.current})},[a,e,s,c]),(0,v.useCallback)(d=>({onKeyDown:h=>{if(h.altKey||h.ctrlKey||h.metaKey||h.shiftKey)return;const p=a.getState(),m=l.readDraggedArrowEndpointFor(l.readStanding(p,"arrow-endpoint-drag"),e,d);if(h0.includes(h.key)){if(h.preventDefault(),h.repeat)return;if(m!==null){Fn({editorStore:a,annotationId:e,endpoint:d,annotations:i,dispatch:o.dispatch});return}const f=Fe(i,e,d);if(f===null)return;p.claimInteraction({kind:"arrow-endpoint-drag",annotationId:e,endpoint:d,anchor:f,point:t[d]});return}if(m===null)return;const g=m0(h.key,r);g!==null&&(h.preventDefault(),p.claimInteraction({kind:"arrow-endpoint-drag",annotationId:e,endpoint:d,...Go({anchor:m.anchor,point:m.point,delta:g})}))}}),[e,i,t,r,a,o])},Fn=({editorStore:e,annotationId:t,endpoint:r,annotations:o,dispatch:a})=>{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=Fe(o,t,r);c===null||Ho(c,s.anchor)||a(new u.UpdateAnnotationCommand({kind:"arrow",id:t,patch:Uo(r,s.anchor)}))},m0=(e,t)=>{const r=K(Dn,t.width),o=K(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:-o};case"ArrowDown":return{x:0,y:o};default:return null}},g0=e=>{const t=fe(),r=f0(t),o=b0(e.panelRect,t),a=S0(t);if(r===null||o===null)return null;const i=a.dragged===null?o:qt(o,a.dragged);return(0,n.jsx)(v0,{arrow:r,committed:o,painted:i,settled:a.dragged===null&&!a.moving,moving:a.moving,...e})},v0=({arrow:e,committed:t,painted:r,settled:o,moving:a,panelRect:i,frameRect:s,frameElement:c})=>{const d=l.useI18n(),h=u0({annotationId:e.id,arrow:t,panelRect:i}),p=p0({annotationId:e.id,arrow:t,panelRect:i});return(0,n.jsxs)("div",{"data-testid":"arrow-selection","data-annotation-id":e.id,children:[o&&(0,n.jsx)(i0,{arrow:e,arrowBox:_h(t.start,t.end,i),panelRect:i,frameWidth:s.width,frameHeight:s.height,frameElement:c}),!a&&zo.filter(m=>e[m].anchorType==="panel").map(m=>(0,n.jsx)(x0,{endpoint:m,point:Oh(r[m],i),label:d(`graph.annotations.arrowToolbar.moveEndpoint.${m}`),dragHandlers:h(m),keyboardHandlers:p(m)},m))]})},x0=({endpoint:e,point:t,label:r,dragHandlers:o,keyboardHandlers:a})=>(0,n.jsx)("div",{"aria-label":r,className:s0,"data-testid":"arrow-endpoint-handle","data-endpoint":e,role:"button",style:{left:t.x,top:t.y},tabIndex:0,...o,...a}),f0=e=>{const t=l.useSceneSelector(r=>r.spec.annotations.arrows);return e===null?null:t.find(r=>r.id===e)??null},b0=(e,t)=>{const r=l.useResolvedAnnotations(e).arrows;return t===null?null:r.find(o=>o.id===t)??null},S0=e=>l.useEditorState((0,J.useShallow)(t=>{if(e===null)return{dragged:null,moving:!1};const r=l.readStanding(t,"arrow-endpoint-drag");return{dragged:r?.annotationId===e?r:null,moving:l.readMovedAnnotationFor(l.readStanding(t,"move-drag"),e)!==null}})),y0=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"})]})}),C0="q7gcrz0",j0="q7gcrz1",w0="q7gcrz2";var T0=["absolute-difference","relative-difference","proportion"],Bn=["absolute-difference","relative-difference"],A0=["relative-difference","proportion"],k0={"absolute-difference":"graph.annotations.differenceArrowToolbar.labelKind.absoluteDifference","relative-difference":"graph.annotations.differenceArrowToolbar.labelKind.relativeDifference",proportion:"graph.annotations.differenceArrowToolbar.labelKind.proportion"},P0=e=>{const{formattingLocale:t}=l.useGraphContext(),r=l.useSceneSelector(a=>a.config.parsingLocale),o=t??r;return(0,v.useMemo)(()=>{const a=(0,u.areEndpointsComparable)(e.start,e.end);return T0.filter(i=>a||!Bn.includes(i)||i===e.label).map(i=>({kind:i,key:k0[i],preview:(0,u.formatDifferenceLabel)({locale:o,kind:i,startValue:e.start.measurementValue,endValue:e.end.measurementValue,valueFormat:e.start.valueFormat}),pickable:a||!Bn.includes(i),suspect:A0.includes(i)&&e.start.measurementValue===0}))},[e,o])},zn=[{id:"small",key:"graph.annotations.differenceArrowToolbar.size.small"},{id:"medium",key:"graph.annotations.differenceArrowToolbar.size.medium"},{id:"large",key:"graph.annotations.differenceArrowToolbar.size.large"}],L0=({arrow:e,color:t,labelBox:r,panelRect:o,frameWidth:a,frameHeight:i,frameElement:s})=>{const c=l.useI18n(),{commands:d}=l.useGraphContext(),h=l.useSceneSelector(y=>y.spec.styles.overrides),p=l.useSceneSelector(y=>(0,u.readStyleCoord)(y.spec)),m=Xe(),g=P0(e),f=(0,u.resolveDifferenceArrowAnnotationStyle)(l.useStyleReaderTree(),e.id),x=(0,v.useMemo)(()=>({target:"annotation",kind:"differenceArrow",annotation:e.id}),[e.id]),b=(0,v.useMemo)(()=>({...x,part:"label"}),[x]),S=g.find(y=>y.kind===e.label),j=g.some(y=>y.pickable&&y.kind!==e.label),L=zn.find(y=>u.DIFFERENCE_ARROW_SIZE_DECLARATIONS[y.id].arrow.strokeWidth===f.strokeWidth),A=(y,M)=>{d.dispatch(new u.UpdateAnnotationCommand({kind:"differenceArrow",id:e.id,patch:y}),M)},w=y=>({...(0,u.findStyleRule)(h,{select:x},p)?.declarations,...y}),I=y=>({...(0,u.findStyleRule)(h,{select:b},p)?.declarations,...y}),T=y=>{A(y),m.close()},P=()=>{d.dispatch(new u.RemoveAnnotationCommand({id:e.id})),s.focus({preventScroll:!0})},N=y=>d.dispatch(new u.SetStyleRuleCommand({list:"overrides",rule:{select:x,declarations:w({stroke:y})}}),{transient:!0}),V=()=>A({start:e.end.anchor,end:e.start.anchor}),R=y=>()=>T({label:y}),C=y=>()=>{const M=u.DIFFERENCE_ARROW_SIZE_DECLARATIONS[y];d.dispatch(new u.SetDifferenceArrowStyleCommand({annotationId:e.id,arrow:w(M.arrow),label:I(M.label)})),m.close()};return(0,n.jsxs)(_.Root,{anchorBox:r,panelRect:o,frameWidth:a,frameHeight:i,label:c("graph.annotations.differenceArrowToolbar.label"),testId:"difference-arrow-toolbar",children:[(0,n.jsx)(_.Dropdown,{label:c("graph.annotations.differenceArrowToolbar.labelKind.ariaLabel"),trigger:(0,n.jsx)(I0,{option:S}),disabled:!j,...m.bind("labelKind"),children:g.map(y=>(0,n.jsxs)(_.MenuItem,{selected:y.kind===e.label,disabled:!y.pickable,onClick:R(y.kind),children:[(0,n.jsx)("span",{children:c(y.key)}),(y.suspect||!y.pickable)&&(0,n.jsx)("span",{"aria-label":c(y.pickable?"graph.annotations.differenceArrowToolbar.labelKind.suspectValue":"graph.annotations.differenceArrowToolbar.labelKind.incomparableEnds"),className:"q7gcrz3",role:"img",children:"⚠"}),(0,n.jsx)("span",{className:w0,children:y.preview})]},y.kind))}),(0,n.jsx)(_.Separator,{}),(0,n.jsx)(_.ColorPicker,{color:t,label:c("graph.annotations.differenceArrowToolbar.color"),onChange:N,...m.bind("color"),children:(0,n.jsx)(_.Swatch,{color:t})}),(0,n.jsx)(_.Dropdown,{label:c("graph.annotations.differenceArrowToolbar.size.ariaLabel"),trigger:L===void 0?"":c(L.key),...m.bind("size"),children:zn.map(y=>(0,n.jsx)(_.MenuItem,{selected:y.id===L?.id,onClick:C(y.id),children:c(y.key)},y.id))}),(0,n.jsx)(_.Separator,{}),(0,n.jsx)(_.IconButton,{label:c("graph.annotations.differenceArrowToolbar.swap"),onClick:V,children:(0,n.jsx)(y0,{size:"sm",title:""})}),(0,n.jsx)(_.IconButton,{label:c("graph.annotations.differenceArrowToolbar.remove"),onClick:P,children:(0,n.jsx)(Ke,{size:"sm",title:""})})]})},I0=({option:e})=>{const t=l.useI18n();return e===void 0?null:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:j0,children:t(e.key)}),(0,n.jsxs)("span",{className:C0,children:["(",e.preview,")"]})]})},E0="var(--ydgo3h0)";var M0="ydgo3h1",R0="ydgo3h2",O0="ydgo3h3",_0=({clientPoint:e,panelOrigin:t,panelRect:r,engine:o,layers:a,coordSystem:i,resolver:s,fixedAnchor:c,align:d})=>{const h=N0({x:e.x-t.x,y:e.y-t.y},r),{primary:p}=o.query((0,u.toPanelCursor)(h,r));if(p===null)return null;const m=a.find(f=>f.id===p.layerId);if(m===void 0)return null;const g=(0,u.resolveObservationPoint)({resolver:s,layer:m,observation:p.observation,observationIndex:(0,u.readObservationIndex)(p),coordSystem:i,align:d});return g===null||(0,u.areAnchorsEqual)(g.anchor,c)?null:g},N0=(e,t)=>({x:Math.max(0,Math.min(e.x,t.width)),y:Math.max(0,Math.min(e.y,t.height))}),qo=e=>e==="start"?"end":"start",Ko=({dispatch:e,arrow:t,endpoint:r,anchor:o})=>{(0,u.areAnchorsEqual)(o,t[r].anchor)||e(new u.UpdateAnnotationCommand({kind:"differenceArrow",id:t.id,patch:{[r]:o}}))},D0=class extends be{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:o,anchorResolver:a}=this.params,{arrow:i,panelOrigin:s,panelRect:c,layers:d,coordSystem:h}=r(),p=_0({clientPoint:e,panelOrigin:s,panelRect:c,engine:o,layers:d,coordSystem:h,resolver:a,fixedAnchor:i[qo(t)].anchor,align:i[t].anchor.align});return p===null?null:{kind:"difference-arrow-endpoint-drag",annotationId:i.id,endpoint:t,point:p}}commit({point:e,endpoint:t}){const{dispatch:r,readInputs:o}=this.params;Ko({dispatch:r,arrow:o().arrow,endpoint:t,anchor:e.anchor})}},F0=({arrow:e,panelOrigin:t,panelRect:r})=>{const{commands:o,anchorResolver:a}=l.useGraphContext(),{engine:i}=l.useHoverContext(),s=l.useEditorStore(),c=l.useLatestRef({arrow:e,panelOrigin:t,panelRect:r,...l.useSceneSelector((0,J.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:p=>{if(p.button===0&&d.current===null){try{p.currentTarget.setPointerCapture(p.pointerId)}catch{return}p.currentTarget.focus({preventScroll:!0}),p.preventDefault(),d.current=new D0({handle:p.currentTarget,pointerId:p.pointerId,press:{x:p.clientX,y:p.clientY},endpoint:h,readInputs:()=>c.current,editorStore:s,engine:i,anchorResolver:a,dispatch:o.dispatch,onSettled:()=>{d.current=null}}),d.current.start()}}}),[c,s,i,a,o])},B0=[" ","Enter"],z0=({arrow:e})=>{const{commands:t,anchorResolver:r}=l.useGraphContext(),o=l.useEditorStore(),{layers:a,coordSystem:i,mainAxis:s}=l.useSceneSelector((0,J.useShallow)(d=>({layers:d.layers,coordSystem:d.coordSystem,mainAxis:(0,u.readMainAxis)(d.coordSystem)}))),c=e.id;return(0,v.useEffect)(()=>()=>{const d=o.getState();l.readStanding(d,"difference-arrow-endpoint-drag")?.annotationId===c&&d.releaseInteraction("difference-arrow-endpoint-drag")},[o,c]),(0,v.useCallback)(d=>({onKeyDown:h=>{if(h.altKey||h.ctrlKey||h.metaKey||h.shiftKey)return;const p=o.getState(),m=l.readDraggedDifferenceArrowEndpointFor(l.readStanding(p,"difference-arrow-endpoint-drag"),e.id,d);if(B0.includes(h.key)){if(h.preventDefault(),h.repeat)return;if(m===null)return p.claimInteraction({kind:"difference-arrow-endpoint-drag",annotationId:e.id,endpoint:d,point:e[d]});p.releaseInteraction("difference-arrow-endpoint-drag"),Ko({dispatch:t.dispatch,arrow:e,endpoint:d,anchor:m.point.anchor});return}if(m===null)return;const g=G0(h.key,s);if(g===null)return;h.preventDefault();const f=H0({arrow:e,endpoint:d,from:m.point.anchor,move:g,layers:a,coordSystem:i,resolver:r});f!==null&&p.claimInteraction({kind:"difference-arrow-endpoint-drag",annotationId:e.id,endpoint:d,point:f})}}),[e,o,t,r,a,i,s])},G0=(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}},H0=({arrow:e,endpoint:t,from:r,move:o,layers:a,coordSystem:i,resolver:s})=>{const c=a.find(p=>p.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,u.stepDifferenceArrowEndpoint)({layer:c,from:r,partner:e[qo(t)].anchor,axis:o.axis,step:o.step,getObservationPoint:(p,m)=>(0,u.resolveObservationPoint)({resolver:s,layer:c,observation:p,observationIndex:m,coordSystem:i,align:h,measurement:d})})?.point??null},V0=e=>{const t=fe();return t===null?null:(0,n.jsx)(W0,{annotationId:t,...e})},W0=({annotationId:e,...t})=>{const r=l.useDifferenceArrowGeometries(),o=(0,v.useMemo)(()=>r.find(a=>a.id===e),[r,e]);return o===void 0?null:(0,n.jsx)($0,{committedArrow:o.committedArrow,color:o.color,labelCornerRadius:o.style.label.cornerRadius,committedLabelBox:o.committedLabelBox,labelBox:o.labelBox,start:o.start,end:o.end,dragging:o.dragging,...t})},$0=({committedArrow:e,color:t,labelCornerRadius:r,committedLabelBox:o,labelBox:a,start:i,end:s,panelRect:c,panelOrigin:d,frameRect:h,frameElement:p,dragging:m})=>{const g=F0({arrow:e,panelOrigin:d,panelRect:c}),f=z0({arrow:e}),x=l.useStyleReaderTree().editOutline.selected().resolve().stroke;return(0,n.jsxs)("div",{"data-testid":"difference-arrow-selection",style:(0,Y.assignInlineVars)({[E0]:x}),children:[!m&&(0,n.jsx)(L0,{arrow:e,color:t,labelBox:o,panelRect:c,frameWidth:h.width,frameHeight:h.height,frameElement:p}),(0,n.jsx)("div",{"aria-hidden":"true",className:O0,"data-testid":"difference-arrow-selection-label",style:{left:c.x+a.x-2,top:c.y+a.y-2,width:a.width+4,height:a.height+4,borderRadius:l.toBorderRadiusCss(r,2)}}),(0,n.jsx)(Gn,{endpoint:"start",point:i,panelRect:c,dragHandlers:g("start"),keyboardHandlers:f("start")}),(0,n.jsx)(Gn,{endpoint:"end",point:s,panelRect:c,dragHandlers:g("end"),keyboardHandlers:f("end")})]})},Gn=({endpoint:e,point:t,panelRect:r,dragHandlers:o,keyboardHandlers:a})=>(0,n.jsx)("div",{className:M0,"data-testid":"difference-arrow-selection-handle","data-endpoint":e,role:"button",style:{left:r.x+t.x,top:r.y+t.y},tabIndex:0,...o,...a,children:(0,n.jsx)("span",{"aria-hidden":"true",className:R0})}),Tt=({start:e,extent:t,moveStartEdge:r,delta:o,minExtent:a})=>{if(!Number.isFinite(o))return{start:e,extent:t};const i=e+t,s=Math.min(a,t);if(r){const h=Math.min(0,e),p=Math.min(Math.max(1,e),i-s),m=(0,ne.clamp)(e+o,h,p);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,ne.clamp)(i+o,c,d)-e}},U0=["top-left","top-right","bottom-right","bottom-left"];var Xo=({width:e,height:t})=>({x:K(16,e),y:K(16,t)}),q0=(e,t)=>({x:Jo(t)?e.x:e.x+e.width,y:Qo(t)?e.y:e.y+e.height}),Kt=e=>({x:e.x,y:1-e.y-e.height,width:e.width,height:e.height}),Zo=({region:e,corner:t,delta:r,minSize:o})=>{const a=Tt({start:e.x,extent:e.width,moveStartEdge:Jo(t),delta:r.x,minExtent:o.x}),i=Tt({start:e.y,extent:e.height,moveStartEdge:Qo(t),delta:r.y,minExtent:o.y});return{anchorType:"panel",x:a.start,y:i.start,width:a.extent,height:i.extent}},Yo=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,Jo=e=>e==="top-left"||e==="bottom-left",Qo=e=>e==="top-left"||e==="top-right",ea=(e,t,r,o)=>{const a=e.textAnnotations.find(i=>i.id===t);return a===void 0?null:l.measureTextAnnotationBox(l.previewResizedText(a,r),o)},K0="var(--_1ee8fau0)";var X0={hovered:"_1ee8fau2 _1ee8fau1",selected:"_1ee8fau3 _1ee8fau1"},Z0={hovered:"_1ee8fau5 _1ee8fau4",selected:"_1ee8fau6 _1ee8fau4"},Y0=({panelRect:e})=>{const t=l.useResolvedAnnotations(e),r=l.useMeasuredBoxes(),o=l.useStyleReaderTree(),a=fe(),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),p=(0,v.useMemo)(()=>({panel:{width:e.width,height:e.height},measuredBoxes:r,readers:o}),[e.width,e.height,r,o]),m=Hn(t,a,p),g=Hn(t,h===a?null:h,p),f=b=>{if(s?.annotationId===b.id){const S=t.shapes.find(j=>j.id===b.id);return S===void 0?b.geometry:l.measureShapeRegion(Kt(s.region),o.annotation.shape(S.id).get("strokeWidth"),p.panel)}if(c?.annotationId===b.id){const S=t.arrows.find(j=>j.id===b.id);return S===void 0?b.geometry:l.measureArrowEnds(qt(S,c),p.panel)??b.geometry}return d?.annotationId===b.id?ea(t,b.id,d,p)??b.geometry:b.geometry},x=b=>{if(i?.annotationId!==b)return e;const S=$o(i.translation,e);return{x:e.x+S.x,y:e.y+S.y}};return(0,n.jsxs)(n.Fragment,{children:[g!==null&&(0,n.jsx)(Vn,{annotationId:g.id,geometry:f(g),state:"hovered",origin:x(g.id)}),m!==null&&(0,n.jsx)(Vn,{annotationId:m.id,geometry:f(m),state:"selected",origin:x(m.id)})]})},Hn=(e,t,r)=>{if(t===null)return null;const o=l.resolveAnnotationChromeGeometry(e,t,r);return o===null?null:{id:t,geometry:o}},Vn=({annotationId:e,geometry:t,state:r,origin:o})=>{const a=l.useStyleReaderTree().editOutline.selected().resolve().stroke,i=(0,Y.assignInlineVars)({[K0]:a});return t.shape==="segment"?(0,n.jsxs)("div",{"aria-hidden":"true","data-testid":"annotation-chrome","data-annotation-id":e,"data-state":r,style:i,children:[(0,n.jsx)(Wn,{point:t.start,state:r,origin:o}),(0,n.jsx)(Wn,{point:t.end,state:r,origin:o})]}):(0,n.jsx)("div",{"aria-hidden":"true",className:X0[r],"data-testid":"annotation-chrome","data-annotation-id":e,"data-state":r,style:{...i,left:o.x+t.rect.x-2,top:o.y+t.rect.y-2,width:t.rect.width+4,height:t.rect.height+4}})},Wn=({point:e,state:t,origin:r})=>(0,n.jsx)("span",{className:Z0[t],style:{left:r.x+e.x,top:r.y+e.y}}),J0=({panelRect:e})=>{const t=l.useEditorState(a=>l.readStanding(a,"move-drag")),r=l.useResolvedAnnotations(e);if(t===null)return null;const o=$o(t.translation,e);return(0,n.jsx)("svg",{"aria-hidden":"true",className:Ut,width:e.width,height:e.height,style:{left:e.x+o.x,top:e.y+o.y},"data-testid":"annotation-preview","data-annotation-id":t.annotationId,children:tp(r,t.annotationId,e)})},Q0=({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})},ke=(e,t,r)=>{const o=e.find(a=>a.id===t);return o===void 0?null:r(o)},ep={text:(e,t,r)=>ke(e.textAnnotations,t,o=>(0,n.jsx)(Q0,{annotation:o,panel:r})),shape:(e,t,r)=>ke(e.shapes,t,o=>(0,n.jsx)(rp,{shape:o,panelSize:r})),image:(e,t,r)=>ke(e.images,t,o=>(0,n.jsx)(op,{image:o,panelSize:r})),arrow:(e,t,r)=>ke(e.arrows,t,o=>(0,n.jsx)(np,{arrow:o,panelSize:r}))},tp=(e,t,r)=>{for(const o of Object.values(ep)){const a=o(e,t,r);if(a!==null)return a}return null},np=({arrow:e,panelSize:t})=>{const r=(0,u.resolveArrowAnnotationStyle)(l.useStyleReaderTree(),e.id),o=(0,u.computeArrow)({arrow:e,style:r,panelWidth:t.width,panelHeight:t.height});return o===null?null:(0,n.jsx)(l.ArrowAnnotation,{computed:o,style:r,addressable:!1})},rp=({shape:e,panelSize:t})=>(0,n.jsx)(l.ShapeAnnotation,{shape:e,style:l.useStyleReaderTree().annotation.shape(e.id).resolve(),panel:t}),op=({image:e,panelSize:t})=>(0,n.jsx)(l.ImageAnnotation,{image:e,panel:t,style:l.useStyleReaderTree().annotation.image(e.id).resolve()}),ap=({panelRect:e})=>{const t=l.useEditorState(i=>l.readStanding(i,"shape-resize-drag")),r=l.useResolvedAnnotations(e).shapes,o=l.useStyleReaderTree();if(t===null)return null;const a=r.find(i=>i.id===t.annotationId);return a===void 0?null:(0,n.jsx)("svg",{"aria-hidden":"true",className:Ut,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:{...a,region:Kt(t.region)},style:o.annotation.shape(a.id).resolve(),panel:e})})},ip="var(--o49ib40)",sp={sm:"o49ib41",md:"o49ib42"},lp={horizontal:"o49ib43",diagonalDown:"o49ib44",diagonalUp:"o49ib45"},ta=({point:e,label:t,pull:r,size:o,attributes:a,dragHandlers:i,keyboardHandlers:s})=>{const c=l.useStyleReaderTree().editOutline.selected().resolve().stroke;return(0,n.jsx)("div",{"aria-label":t,className:lp[r],role:"button",style:{left:e.x,top:e.y,...(0,Y.assignInlineVars)({[ip]:c})},tabIndex:0,...a,...i,...s,children:(0,n.jsx)("span",{"aria-hidden":"true",className:sp[o]})})},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"}],cp=e=>[...At].reverse().find(t=>t.width<=e)??At[0],dp=({shape:e,shapeBox:t,panelRect:r,frameWidth:o,frameHeight:a,frameElement:i})=>{const s=l.useI18n(),{commands:c}=l.useGraphContext(),d=l.useSceneSelector(A=>A.spec.styles.overrides),h=l.useSceneSelector(A=>(0,u.readStyleCoord)(A.spec)),p=Xe(),m=l.useStyleReaderTree().annotation.shape(e.id).resolve(),g=cp(m.strokeWidth),f=(0,v.useMemo)(()=>({target:"annotation",kind:"shape",annotation:e.id}),[e.id]),x=(A,w)=>{const I=(0,u.findStyleRule)(d,{select:f},h)?.declarations??{};c.dispatch(new u.SetStyleRuleCommand({list:"overrides",rule:{select:f,declarations:{...I,...A}}}),w)},b=()=>{c.dispatch(new u.RemoveAnnotationCommand({id:e.id})),i.focus({preventScroll:!0})},S=A=>x({fill:A},{transient:!0}),j=A=>x({fillAlpha:A},{transient:!0}),L=A=>()=>{x({strokeWidth:A}),p.close()};return(0,n.jsxs)(_.Root,{anchorBox:t,panelRect:r,frameWidth:o,frameHeight:a,label:s("graph.annotations.shapeToolbar.label"),testId:"shape-toolbar",children:[(0,n.jsx)(_.ColorPicker,{color:(0,u.toPaintColor)(m.fill),label:s("graph.annotations.shapeToolbar.color"),onChange:S,opacity:m.fillAlpha,onOpacityChange:j,...p.bind("color"),children:(0,n.jsx)(_.Swatch,{color:(0,u.toPaintColor)(m.fill),opacity:m.fillAlpha})}),(0,n.jsx)(_.Dropdown,{label:s("graph.annotations.shapeToolbar.border.ariaLabel"),trigger:(0,n.jsx)(Wo,{size:"sm",title:""}),...p.bind("border"),children:At.map(A=>(0,n.jsx)(_.MenuItem,{selected:A.width===g?.width,onClick:L(A.width),children:s(A.key)},A.width))}),(0,n.jsx)(_.Separator,{}),(0,n.jsx)(_.IconButton,{label:s("graph.annotations.shapeToolbar.remove"),onClick:b,children:(0,n.jsx)(Ke,{size:"sm",title:""})})]})},na=e=>{const t=l.useLatestRef(e),r=(0,v.useRef)(null);return(0,v.useEffect)(()=>()=>r.current?.finish(!1),[]),(0,v.useCallback)(o=>({onPointerDown:a=>{if(a.button!==0||r.current!==null)return;try{a.currentTarget.setPointerCapture(a.pointerId)}catch{return}a.currentTarget.focus({preventScroll:!0}),a.preventDefault();const i=t.current(o,{handle:a.currentTarget,pointerId:a.pointerId,press:{x:a.clientX,y:a.clientY},onSettled:()=>{r.current=null}});r.current=i,i.start()}}),[t])},Be=(e,t)=>{const r=e.shapes.find(o=>o.id===t);return r===void 0||r.region.anchorType!=="panel"?null:r.region},up=class extends be{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:o,readInputs:a}=this.params,{annotations:i,panelRect:s}=a(),c=Be(i,t);return c===null?null:{kind:"shape-resize-drag",annotationId:t,region:Zo({region:c,corner:r,delta:Ze(o,e,s),minSize:Xo(s)})}}commit({region:e}){const{annotationId:t,dispatch:r,readInputs:o}=this.params,a=Be(o().annotations,t);a===null||Yo(a,e)||r(new u.UpdateAnnotationCommand({kind:"shape",id:t,patch:{region:e}}))}},hp=({annotationId:e,panelRect:t})=>{const{commands:r}=l.useGraphContext(),o=l.useEditorStore(),a=l.useLatestRef({annotations:l.useSceneSelector(i=>i.spec.annotations),panelRect:t});return na((i,s)=>new up({...s,annotationId:e,corner:i,readInputs:()=>a.current,editorStore:o,dispatch:r.dispatch}))},pp=[" ","Enter"],ra=e=>{const t=l.useEditorStore(),r=l.useLatestRef(e);return(0,v.useEffect)(()=>()=>$n(t,r.current),[t,r]),(0,v.useCallback)(o=>({onKeyDown:a=>{if(a.altKey||a.ctrlKey||a.metaKey||a.shiftKey)return;const i=t.getState(),s=r.current.readHeld();if(pp.includes(a.key)){if(a.preventDefault(),a.repeat)return;if(s!==null){$n(t,r.current);return}const d=r.current.claim(o);if(d===null)return;i.claimInteraction(d);return}if(s===null)return;const c=r.current.step(s,o,a.key);c!==null&&(a.preventDefault(),i.claimInteraction(c))}}),[t,r])},$n=(e,t)=>{const r=t.readHeld();r!==null&&(e.getState().releaseInteraction(r.kind),t.commit(r))},Un=4,mp=({annotationId:e,panelRect:t})=>{const{commands:r}=l.useGraphContext(),o=l.useEditorStore(),a=l.useSceneSelector(i=>i.spec.annotations);return ra({readHeld:()=>l.readResizedShapeFor(l.readStanding(o.getState(),"shape-resize-drag"),e),claim:()=>{const i=Be(a,e);return i===null?null:{kind:"shape-resize-drag",annotationId:e,region:i}},step:(i,s,c)=>{const d=gp(c,t);return d===null?null:{kind:"shape-resize-drag",annotationId:e,region:Zo({region:i.region,corner:s,delta:d,minSize:Xo(t)})}},commit:({region:i})=>{const s=Be(a,e);s===null||Yo(s,i)||r.dispatch(new u.UpdateAnnotationCommand({kind:"shape",id:e,patch:{region:i}}))}})},gp=(e,t)=>{const r=K(Un,t.width),o=K(Un,t.height);switch(e){case"ArrowLeft":return{x:-r,y:0};case"ArrowRight":return{x:r,y:0};case"ArrowUp":return{x:0,y:-o};case"ArrowDown":return{x:0,y:o};default:return null}},vp={"top-left":"diagonalDown","bottom-right":"diagonalDown","top-right":"diagonalUp","bottom-left":"diagonalUp"},xp=e=>{const t=fe(),r=bp(t),o=Sp(t);if(r===null)return null;const a=o.resizedRegion??(r.region.anchorType==="panel"?r.region:null);return a===null?null:(0,n.jsx)(fp,{shape:r,region:a,settled:o.resizedRegion===null&&!o.moving,moving:o.moving,...e})},fp=({shape:e,region:t,settled:r,moving:o,panelRect:a,frameRect:i,frameElement:s})=>{const c=l.useI18n(),d=hp({annotationId:e.id,panelRect:a}),h=mp({annotationId:e.id,panelRect:a}),p=l.useStyleReaderTree().annotation.shape(e.id).resolve(),{rect:m}=l.measureShapeRegion(Kt(t),p.strokeWidth,a);return(0,n.jsxs)("div",{"data-testid":"shape-selection","data-annotation-id":e.id,children:[r&&(0,n.jsx)(dp,{shape:e,shapeBox:m,panelRect:a,frameWidth:i.width,frameHeight:i.height,frameElement:s}),!o&&U0.map(g=>{const f=q0(m,g);return(0,n.jsx)(ta,{point:{x:a.x+f.x,y:a.y+f.y},label:c(`graph.annotations.shapeToolbar.resize.${g}`),pull:vp[g],size:"md",attributes:{"data-testid":"shape-resize-handle","data-corner":g},dragHandlers:d(g),keyboardHandlers:h(g)},g)})]})},bp=e=>{const t=l.useSceneSelector(r=>r.spec.annotations.shapes);return e===null?null:t.find(r=>r.id===e)??null},Sp=e=>l.useEditorState((0,J.useShallow)(t=>e===null?{resizedRegion:null,moving:!1}:{resizedRegion:l.readResizedShapeFor(l.readStanding(t,"shape-resize-drag"),e)?.region??null,moving:l.readMovedAnnotationFor(l.readStanding(t,"move-drag"),e)!==null})),yp=({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 ze="textStyle",oa=new Set(["paragraph","heading"]),Cp=e=>{const t=aa(e),r=Pp(e);return{color:Pe(t.map(o=>Lp(dt(o)?.color))),font:Pe(t.map(o=>kp(dt(o)))),fontSize:Pe(t.map(o=>Ip(dt(o)?.fontSize))),alignment:Pe(r.map(o=>Ep(o.attrs?.textAlign)))}},jp=(e,t)=>Xt(e,r=>r.type==="text"?Ap(r,t):r),wp=e=>aa(e).length>0,Tp=(e,t)=>Xt(e,r=>oa.has(r.type??"")?{...r,attrs:{...r.attrs,textAlign:t}}:r),Xt=(e,t)=>t(e.content===void 0?e:{...e,content:e.content.map(r=>Xt(r,t))}),Ap=(e,t)=>{const r=e.marks??[],o=r.find(i=>i.type===ze),a={type:ze,attrs:{...o?.attrs,...t}};return{...e,marks:o===void 0?[...r,a]:r.map(i=>i===o?a:i)}},dt=e=>e.marks?.find(t=>t.type===ze)?.attrs,kp=e=>l.readRichTextFontId(e?.font)??l.readRichTextFontId(e?.fontFamily),aa=e=>Zt(e,t=>t.type==="text"),Pp=e=>Zt(e,t=>oa.has(t.type??"")),Zt=(e,t)=>[...t(e)?[e]:[],...(e.content??[]).flatMap(r=>Zt(r,t))],Pe=e=>{const[t,...r]=e;return t===void 0?null:r.every(o=>o===t)?t:null},Lp=e=>typeof e=="string"&&e.length>0?e:void 0,Ip=e=>typeof e=="number"&&Number.isFinite(e)?e:void 0,Ep=e=>e==="left"||e==="center"||e==="right"?e:void 0;var ia=[{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})),Mp=e=>ia.find(t=>t.id===(e??"modern"))??null;var sa=[{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"}],Rp=e=>sa.find(t=>t.size===(e??15))??null,Op=e=>`${e}px`,_p=[{alignment:"left",Icon:Wr},{alignment:"center",Icon:Hr},{alignment:"right",Icon:Vr}],Np=({annotation:e,textBox:t,panelRect:r,frameWidth:o,frameHeight:a,frameElement:i})=>{const s=l.useI18n(),{commands:c}=l.useGraphContext(),d=l.useSceneSelector(y=>y.spec.styles.overrides),h=l.useSceneSelector(y=>(0,u.readStyleCoord)(y.spec)),p=l.useEditorStore(),m=Xe(),g=l.useStyleReaderTree().annotation.text(e.id).resolve(),f=Cp(e.content),x=Mp(f.font),b=Rp(f.fontSize),S=f.color??g.textColor,j=(0,v.useMemo)(()=>({target:"annotation",kind:"text",annotation:e.id}),[e.id]),L=(y,M)=>{const D=(0,u.findStyleRule)(d,{select:j},h)?.declarations??{};c.dispatch(new u.SetStyleRuleCommand({list:"overrides",rule:{select:j,declarations:{...D,...y}}}),M)},A=(y,M)=>{c.dispatch(new u.UpdateAnnotationCommand({kind:"text",id:e.id,patch:y}),M)},w=()=>p.getState().caret?.editor?.getJSON()??e.content,I=(y,M)=>{const D=w(),$=p.getState().caret?.editor??null;if($!==null&&!wp(D)){$.chain().focus().setMark(ze,y).run();return}A({content:jp(D,y)},M)},T=()=>{c.dispatch(new u.RemoveAnnotationCommand({id:e.id})),i.focus({preventScroll:!0})},P=y=>L(Dp(y),{transient:!0}),N=y=>I({color:y},{transient:!0}),V=y=>()=>{I({font:y}),m.close()},R=y=>()=>{I({fontSize:y}),m.close()},C=y=>A({content:Tp(w(),y)});return(0,n.jsxs)(_.Root,{anchorBox:t,panelRect:r,frameWidth:o,frameHeight:a,label:s("graph.annotations.textToolbar.label"),testId:"text-toolbar",children:[(0,n.jsx)(_.ColorPicker,{color:(0,u.toPaintColor)(g.fill),label:s("graph.annotations.textToolbar.background"),hasTransparentOption:!0,onChange:P,...m.bind("background"),children:(0,n.jsx)(_.Swatch,{color:g.fill==="transparent"?ys:(0,u.toPaintColor)(g.fill)})}),(0,n.jsx)(_.ColorPicker,{color:S,label:s("graph.annotations.textToolbar.color"),onChange:N,...m.bind("color"),children:(0,n.jsx)(yp,{size:"sm",textColor:S,title:""})}),(0,n.jsx)(_.Dropdown,{label:s("graph.annotations.textToolbar.font.ariaLabel"),trigger:(0,n.jsx)("span",{style:{fontFamily:x?.fontFamily},children:"Aa"}),...m.bind("font"),children:ia.map(y=>(0,n.jsx)(_.MenuItem,{selected:y.id===x?.id,onClick:V(y.id),children:(0,n.jsx)("span",{style:{fontFamily:y.fontFamily},children:s(y.key)})},y.id))}),(0,n.jsx)(_.Dropdown,{label:s("graph.annotations.textToolbar.fontSize.ariaLabel"),trigger:b===null?"":s(b.key),...m.bind("fontSize"),children:sa.map(y=>(0,n.jsx)(_.MenuItem,{selected:y.size===b?.size,onClick:R(y.size),children:(0,n.jsx)("span",{style:{fontSize:Op(y.size)},children:s(y.key)})},y.size))}),(0,n.jsx)(_.Separator,{}),(0,n.jsx)(Fp,{current:f.alignment??"center",onPick:C}),(0,n.jsx)(_.Separator,{}),(0,n.jsx)(_.IconButton,{label:s("graph.annotations.textToolbar.remove"),onClick:T,children:(0,n.jsx)(Ke,{size:"sm",title:""})})]})},Dp=e=>e==="transparent"?{fill:mr}:{fill:e,fillAlpha:ks(e)?u.TEXT_ANNOTATION_FADE_ALPHA:1},Fp=({current:e,onPick:t})=>{const r=l.useI18n(),o=a=>()=>t(a);return(0,n.jsx)(n.Fragment,{children:_p.map(a=>(0,n.jsx)(_.ToggleButton,{label:r(`graph.annotations.textToolbar.align.${a.alignment}`),pressed:a.alignment===e,onClick:o(a.alignment),children:(0,n.jsx)(a.Icon,{size:"sm",title:""})},a.alignment))})},Bp=["left","right"];var la=({width:e})=>K(60,e),zp=(e,t)=>({x:t==="left"?e.x:e.x+e.width,y:e.y+e.height/2}),ca=({at:e,width:t,align:r,edge:o,delta:a,minWidth:i,panelWidth:s})=>{if(a===0)return{at:e,width:t,shift:0};const c=(0,u.alignUnitFractions)(r).x,d=Gp(e.offset,s),h=Tt({start:e.x+d-c*t,extent:t,moveStartEdge:o==="left",delta:a,minExtent:i}),p=h.start+c*h.extent-d;return{at:{...e,x:p},width:h.extent,shift:p-e.x}},da=(e,t)=>e.at.x===t.at.x&&e.width===t.width,Gp=(e,t)=>e?.x===void 0?0:e.unit==="px"?K(e.x,t):e.x,Ge=(e,t)=>{const r=e.textAnnotations.find(o=>o.id===t);return r===void 0||r.at.anchorType!=="panel"?null:{at:r.at,width:r.width,align:r.align}},Hp=class extends be{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:o,readInputs:a}=this.params,{annotations:i,panelRect:s}=a(),c=Ge(i,t);if(c===null)return null;const d=Ze(o,e,s).x;return{kind:"text-resize-drag",annotationId:t,delta:d,...ca({...c,edge:r,delta:d,minWidth:la(s),panelWidth:s.width})}}commit(e){const{annotationId:t,dispatch:r,readInputs:o}=this.params,a=Ge(o().annotations,t);a===null||da(a,e)||r(new u.UpdateAnnotationCommand({kind:"text",id:t,patch:{at:e.at,width:e.width}}))}},Vp=({annotationId:e,panelRect:t})=>{const{commands:r}=l.useGraphContext(),o=l.useEditorStore(),a=l.useLatestRef({annotations:l.useSceneSelector(i=>i.spec.annotations),panelRect:t});return na((i,s)=>new Hp({...s,annotationId:e,edge:i,readInputs:()=>a.current,editorStore:o,dispatch:r.dispatch}))},Wp=4,$p=({annotationId:e,panelRect:t})=>{const{commands:r}=l.useGraphContext(),o=l.useEditorStore(),a=l.useSceneSelector(s=>s.spec.annotations),i=(s,c)=>{const d=Ge(a,e);return d===null?null:{kind:"text-resize-drag",annotationId:e,delta:c,...ca({...d,edge:s,delta:c,minWidth:la(t),panelWidth:t.width})}};return ra({readHeld:()=>l.readResizedTextFor(l.readStanding(o.getState(),"text-resize-drag"),e),claim:s=>i(s,0),step:(s,c,d)=>{const h=Up(d,t);return h===null?null:i(c,s.delta+h)},commit:s=>{const c=Ge(a,e);c===null||da(c,s)||r.dispatch(new u.UpdateAnnotationCommand({kind:"text",id:e,patch:{at:s.at,width:s.width}}))}})},Up=(e,t)=>{const r=K(Wp,t.width);switch(e){case"ArrowLeft":return-r;case"ArrowRight":return r;default:return null}},qp=e=>{const t=fe(),r=Xp(t),o=Zp(t),a=l.useEditorState(s=>s.caret?.annotationId===t),i=Yp(e.panelRect,t,o.resized);return r===null||i===null?null:(0,n.jsx)(Kp,{annotation:r,textBox:i,settled:o.resized===null&&!o.moving,moving:o.moving,resizable:r.at.anchorType==="panel",hasCaret:a,...e})},Kp=({annotation:e,textBox:t,settled:r,moving:o,resizable:a,hasCaret:i,panelRect:s,frameRect:c,frameElement:d})=>{const h=l.useI18n(),p=Vp({annotationId:e.id,panelRect:s}),m=$p({annotationId:e.id,panelRect:s});return(0,n.jsxs)("div",{"data-testid":"text-selection","data-annotation-id":e.id,children:[r&&(0,n.jsx)(Np,{annotation:e,textBox:t,panelRect:s,frameWidth:c.width,frameHeight:c.height,frameElement:d}),a&&!o&&!i&&Bp.map(g=>{const f=zp(t,g);return(0,n.jsx)(ta,{point:{x:s.x+f.x,y:s.y+f.y},label:h(`graph.annotations.textToolbar.resize.${g}`),pull:"horizontal",size:"sm",attributes:{"data-testid":"text-resize-handle","data-edge":g},dragHandlers:p(g),keyboardHandlers:m(g)},g)})]})},Xp=e=>{const t=l.useSceneSelector(r=>r.spec.annotations.textAnnotations);return e===null?null:t.find(r=>r.id===e)??null},Zp=e=>l.useEditorState((0,J.useShallow)(t=>e===null?{resized:null,moving:!1}:{resized:l.readResizedTextFor(l.readStanding(t,"text-resize-drag"),e),moving:l.readMovedAnnotationFor(l.readStanding(t,"move-drag"),e)!==null})),Yp=(e,t,r)=>{const o=l.useResolvedAnnotations(e),a=l.useMeasuredBoxes(),i=l.useStyleReaderTree(),s=(0,v.useMemo)(()=>({panel:{width:e.width,height:e.height},measuredBoxes:a,readers:i}),[e.width,e.height,a,i]);return t===null?null:ea(o,t,r,s)?.rect??null},Jp=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"})]})}),Qp="var(--_1tyillx0)",e1="var(--_1tyillx1)",t1={rest:.5,hovered:.75,open:1};var n1="_1tyillx2",r1={rest:"_1tyillx3",hovered:"_1tyillx4",open:"_1tyillx5"},o1="_1tyillx6",a1={closed:"_1tyillx7",open:"_1tyillx8"},i1=({interaction:e,panelRect:t})=>{const r=l.useEditorStore(),o=l.useStyleReaderTree().editOutline.selected().resolve().stroke,a=e.kind==="trigger"||e.kind==="menu"?e.anchor:null,i=s1(e),s=(0,v.useMemo)(()=>{if(a===null)return null;const c=(0,u.projectAnchorToPanel)(a.position,t);return{center:c,radius:19*t1[i],target:{kind:"observation",cursor:(0,u.toPanelCursor)(c,t)}}},[a,t,i]);return(0,v.useEffect)(()=>{r.getState().setMenuTrigger(s)},[r,s]),(0,v.useEffect)(()=>()=>r.getState().setMenuTrigger(null),[r]),a===null||s===null?null:(0,n.jsx)("div",{"aria-hidden":"true","data-testid":"observation-menu-trigger","data-state":i,className:(0,U.default)(n1,r1[i]),style:{left:t.x+s.center.x,top:t.y+s.center.y,...(0,Y.assignInlineVars)({[Qp]:a.color,[e1]:o})},children:(0,n.jsx)("span",{className:(0,U.default)(o1,a1[i==="open"?"open":"closed"]),children:(0,n.jsx)(Jp,{size:"lg"})})})},s1=e=>e.kind==="menu"?"open":e.kind==="trigger"&&e.engaged?"hovered":"rest",l1='button:not([disabled]):not([tabindex="-1"]), [tabindex]:not([tabindex="-1"])',c1=(e,t)=>{const{chartId:r}=l.useGraphContext(),o=l.useEditorStore();(0,v.useEffect)(()=>{if(t===null)return;const a=i=>{if(i.key!=="Tab"||i.defaultPrevented||!pe(i.target,e,r)||br(i.target)||o.getState().standingInteraction?.kind==="chrome-popup")return;const s=[...t.querySelectorAll(l1)];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",a),()=>document.removeEventListener("keydown",a)},[e,t,r,o])},d1=(e,t)=>typeof document.elementsFromPoint=="function"?document.elementsFromPoint(e,t):[],ua=(e,t,r)=>l.readStampedEditTargetInStack(d1(e,t),r),u1=e=>{const{selectionStore:t,chartId:r}=l.useGraphContext(),o=l.useEditorStore();(0,v.useEffect)(()=>{let a=null;const i=d=>{const{caret:h}=o.getState(),p=h===null?null:ua(d.clientX,d.clientY,e);p?.kind==="annotation"&&p.target.id===h?.annotationId||e.focus({preventScroll:!0})},s=d=>{const{selection:h,clearSelection:p}=t.getState();h.length!==0&&(pe(d.target,e,r)||p())},c=d=>{t.getState().selection.length!==0&&pe(d.target,e,r)&&d.relatedTarget===null&&(a!==null&&cancelAnimationFrame(a),a=requestAnimationFrame(()=>{a=null,document.hasFocus()&&(pe(document.activeElement,e,r)||t.getState().clearSelection())}))};return e.addEventListener("pointerdown",i),document.addEventListener("focusin",s),document.addEventListener("focusout",c),()=>{a!==null&&cancelAnimationFrame(a),e.removeEventListener("pointerdown",i),document.removeEventListener("focusin",s),document.removeEventListener("focusout",c)}},[o,t,e,r])},h1=(e,t)=>{switch(e.kind){case"legend":{const r=t.legends[e.part.legendIndex],o=r?.items[e.part.itemIndex];if(r===void 0||o===void 0)return null;const a=p1(r,o.layerId,t.layers);return a===null?null:(0,u.buildObservationsTargetAtValue)({layer:a.layer,scope:"series",variable:a.variable,value:o.value,parsingLocale:t.parsingLocale})}case"axis":{const r=e.part;if(r===null||e.target.axis!=="x")return null;const o=t.formattedAxes.find(i=>i.scaleAestheticKey==="x");if(o===void 0||o.bandwidth===void 0)return null;const a=o.ticks[r.tickIndex];return a===void 0?null:v1(t.layers,a.value,t.parsingLocale)}case"annotation":case"grid":return null}},p1=(e,t,r)=>{const o=t===void 0?r:r.filter(a=>a.id===t);for(const a of e.aesthetics){const i=m1(o,a);if(i!==null)return i}return null},m1=(e,t)=>{for(const r of e){const o=(0,u.readVariableName)(r.mapping[t]);if(o!==null&&g1(r,o))return{layer:r,variable:o}}return null},g1=(e,t)=>e.data.hasVariable(t)&&e.data.getType(t)==="categorical",v1=(e,t,r)=>{let o=null;for(const a of e){if(!a.interactive)continue;const i=(0,u.readScopeXVariable)(a.mapping);if(i===null)continue;const s=(0,u.buildObservationsTargetAtValue)({layer:a,scope:"x-value",variable:i,value:t,parsingLocale:r});if(s!==null){if(o!==null)return null;o=s}}return o},x1=({hover:e,layers:t,scales:r,parsingLocale:o})=>{const{primary:a,intersection:i}=e;if(a===null)return null;const s=(0,u.findLayerById)(t,a.layerId);if(s===void 0)return null;const c=(0,u.readObservationIndex)(a),d=i?.intersects!==!1,h=(0,u.readBroadestObservationsScope)(s),p=d||!(0,u.hasMainAxisBand)(r)?[h]:["x-value",h];for(const m of p){const g=(0,u.buildObservationsTarget)({layer:s,observationIndex:c,scope:m,parsingLocale:o});if(g!==null)return{layerId:s.id,observationIndex:c,onObservation:d,target:g}}return null},f1=(e,t,r)=>{if(!e.onObservation||e.target.scope!=="series")return null;const o=(0,u.findLayerById)(t,e.layerId);return o===void 0?null:(0,u.buildObservationsTarget)({layer:o,observationIndex:e.observationIndex,scope:"data-point",parsingLocale:r})},ha=(e,t)=>{const{target:r,clientX:o,clientY:a}=e,{frameElement:i,captureRect:s,menuTrigger:c,panelOrigin:d,resolvesObservations:h,scene:p}=t,m=c!==null&&(0,u.isPointWithinEditMenuTrigger)({x:o-d.x,y:a-d.y},c);if(!(r instanceof Element&&i.contains(r)))return{targetAtPoint:l.resolveEditTargetAtPoint({overMenuTrigger:m,stamped:qn(!1,!1,e,t),observations:null}),hover:null};const g=s!==null&&r===s,f=g&&h?b1(s):null,x=f===null?null:y1(e,f,t),b=x===null?null:x1({hover:x,layers:p.layers,scales:p.scales,parsingLocale:p.config.parsingLocale}),S=b!==null&&t.hasOverlayMenu(b.target)?b:null,j=l.resolveEditTargetAtPoint({overMenuTrigger:m,stamped:qn(g,S!==null,e,t),observations:S});return{targetAtPoint:j,hover:j?.kind==="observations"?x:null}},b1=e=>{const t=e.getBoundingClientRect();return t.width>0&&t.height>0?t:null},qn=(e,t,r,{paintsAnnotations:o,resolvesGuides:a,frameElement:i,scene:s,hasOverlayMenu:c})=>{if(!o&&s.coordSystem.type==="cartesian"&&e&&t)return null;const d=e||o?ua(r.clientX,r.clientY,i):S1(r.target,i);return d===null?null:(d.kind==="annotation"?o:a&&c(d.target))?d:null},S1=(e,t)=>e instanceof Element?l.readStampedEditTargetInStack([e],t):null,y1=(e,t,r)=>{const o=(0,u.toPanelCursor)({x:e.clientX-t.left,y:e.clientY-t.top},t);return r.engine.query(o,{tolerance:r.tolerance,viewport:t,includeAttached:!0})},C1=class extends be{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:o}=this.params,{annotations:a,panelRect:i}=o(),s=(0,u.findAnnotation)(a,t);if(s===null)return null;const c=(0,u.clampAnnotationTranslation)(s,Ze(r,e,i));return c===null?null:{kind:"move-drag",annotationId:t,translation:c}}commit({translation:e}){const{annotationId:t,dispatch:r}=this.params;l0(e)&&r(new u.MoveAnnotationCommand({id:t,translation:e}))}},j1=(e,{canSelectGraph:t,withinFrame:r,caretAnnotationId:o})=>{switch(e?.kind){case"annotation":return e.target.id===o?{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 w1(e.observations);case"menu-trigger":case void 0:break}return t&&r?{kind:"select-graph",target:{kind:"graph"}}:{kind:"clear"}},w1=({target:e,observationIndex:t,onObservation:r})=>e.scope==="x-value"?{kind:"select-band",target:e}:{kind:"select-observations",target:e,observationIndex:r?t:null},T1=(e,t,r,o,a)=>{const{commands:i,selectionStore:s,store:c}=l.useGraphContext(),d=l.useEditorStore(),h=l.useSceneSelector(S=>S.spec.annotations),p=l.MODE_SURFACES[l.useGraphMode()],m=l.useLatestRef(p.graphPress),g=l.useLatestRef({annotations:h,panelRect:r}),f=l.useLatestRef(t),x=l.useLatestRef(a),b=(0,v.useRef)(null);(0,v.useEffect)(()=>()=>b.current?.finish(!1),[]),(0,v.useEffect)(()=>s.subscribe(({selection:S})=>{const j=d.getState().pressedObservation,[L,...A]=S,w=L!==void 0&&A.length===0&&j!==null&&(0,u.areEditTargetsEqual)(L,j.selectedFor);j!==null&&!w&&d.getState().setPressedObservation(null)}),[d,s]),(0,v.useEffect)(()=>{const S=T=>ha({target:T.target,clientX:T.clientX,clientY:T.clientY},o()).targetAtPoint,j=T=>{if(!(T.target instanceof Element))return!1;const P=T.target.closest(l.LEGEND_OVERFLOW_CONTROL_SELECTOR);return P!==null&&e.contains(P)&&l.readStampedEditTargetInStack([T.target],e)===null},L=(T,P)=>{if(b.current!==null||!l.canMoveAnnotationOnCanvas(g.current.annotations,P.id))return;try{e.setPointerCapture(T.pointerId)}catch{return}T.preventDefault();const N=new C1({handle:e,pointerId:T.pointerId,annotationId:P.id,press:{x:T.clientX,y:T.clientY},readInputs:()=>g.current,editorStore:d,dispatch:i.dispatch,onSettled:()=>{b.current=null}});b.current=N,N.start()},A=(T,P)=>{const N=s.getState(),{layers:V,config:R}=c.getState().scene,C=P.kind==="select-observations"&&P.observationIndex!==null?l.readPressedObservation(P.observationIndex,V,P.target,R.parsingLocale):null;switch(d.getState().setPressedObservation(C),P.kind){case"select-annotation":N.setSelection([P.target]),L(T,P.target);return;case"select-observations":case"select-band":case"select-guide":case"select-graph":N.setSelection([P.target]);return;case"clear":N.clearSelection();return;default:throw new u.InternalError({message:`No press outcome for: ${JSON.stringify(P)}`})}},w=T=>{if(T.button!==0||ht(T.target)||Sr(T,f.current,d.getState().menuTrigger)||j(T)||l.isOnLiveGeomMark(T.target,e))return;const P=j1(S(T),{canSelectGraph:m.current&&o().hasOverlayMenu({kind:"graph"}),withinFrame:T.target instanceof Node&&e.contains(T.target),caretAnnotationId:d.getState().caret?.annotationId??null});P.kind!=="keep-caret"&&(d.getState().setCaret(null),A(T,P))},I=T=>{if(ht(T.target)||j(T)||l.isOnLiveGeomMark(T.target,e))return;const P=S(T),{layers:N,guides:V,config:R}=c.getState().scene,{hasOverlayMenu:C}=o(),y=s.getState(),M=d.getState();switch(P?.kind){case"observations":{const{observations:D}=P,$=f1(D,N,R.parsingLocale);if($===null||!C($))return;const{observationIndex:et}=D;M.setPressedObservation({observationIndex:et,predicate:$.predicate,selectedFor:$}),y.setSelection([$]);return}case"axis":case"legend":{const D=h1(P,{layers:N,legends:V.legends.drawn,formattedAxes:x.current,parsingLocale:R.parsingLocale});if(D===null||!C(D))return;y.setSelection([D]);return}case"annotation":{const{target:D}=P;if(!g.current.annotations.textAnnotations.some($=>$.id===D.id))return;y.setSelection([D]),M.setCaret(D.id);return}case"grid":case"menu-trigger":case void 0:return}};return document.addEventListener("pointerdown",w),document.addEventListener("dblclick",I),()=>{document.removeEventListener("pointerdown",w),document.removeEventListener("dblclick",I)}},[e,d,s,c,i,g,f,x,m,o])},A1=e=>{const{selectionStore:t,commands:r,chartId:o}=l.useGraphContext(),a=l.useEditorStore(),i=l.useLatestRef(l.useSceneSelector(p=>p.spec.annotations.textAnnotations)),{annotations:s}=l.MODE_SURFACES[l.useGraphMode()],c=(0,v.useCallback)(p=>{const{selection:m}=t.getState(),g=s?wt(m):null;g!==null&&(p.preventDefault(),r.dispatch(new u.RemoveAnnotationCommand({id:g})),e.focus({preventScroll:!0}))},[e,r,t,s]),d=(0,v.useCallback)(p=>{if(Ie(p.target,o))return;const m=s?wt(t.getState().selection):null;m!==null&&i.current.some(g=>g.id===m)&&(p.preventDefault(),a.getState().setCaret(m))},[a,t,i,o,s]),h=(0,v.useCallback)(p=>{const m=a.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 Ie(p.target,o)?e.focus({preventScroll:!0}):t.getState().clearSelection()},[a,t,e,o]);(0,v.useEffect)(()=>{const p=m=>{if(!pe(m.target,e,o)||br(m.target))return;const g=k1(m.target),f=a.getState().caret!==null&&!Ie(m.target,o);if(!(g&&!f))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",p),()=>document.removeEventListener("keydown",p)},[e,c,d,h,o,a])},k1=e=>e instanceof HTMLElement&&(e.isContentEditable||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement),P1=(e,t)=>{const r=l.useEditorStore(),{store:o}=l.useGraphContext(),{engine:a,overlayRef:i}=l.useHoverContext(),s=l.useLatestRef(t),{annotations:c,observationsPress:d,guidePress:h,tolerance:p}=l.MODE_SURFACES[l.useGraphMode()],m=l.useIsIntroWaitingForView(),g=qe(),f=d&&!m;return(0,v.useCallback)(()=>({frameElement:e,captureRect:i.current,panelOrigin:s.current,menuTrigger:r.getState().menuTrigger,resolvesGuides:h,paintsAnnotations:c,resolvesObservations:f,engine:a,tolerance:p??void 0,scene:o.getState().scene,hasOverlayMenu:g}),[g,e,i,s,r,h,c,f,a,p,o])},L1=()=>{const e=l.MODE_SURFACES[l.useGraphMode()].observationMenu,t=l.useHoverState(s=>e?s.hover.primary:null),{layers:r,coordSystem:o}=l.useSceneSelector((0,J.useShallow)(s=>({layers:s.layers,coordSystem:s.coordSystem}))),{anchorResolver:a}=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=a.resolve(s.geom,t.observation,{coordSystem:o,position:s.position,purpose:"pin"});if(c===null)return null;const d=(0,u.createObservationAnchorBuilder)(s)(t.observation);return d===null?null:{position:c,color:(0,u.readGeomColor)({geom:i},s,t.observation)??u.DEFAULT_GEOM_COLOR,layer:s,at:d,observation:t.observation}},[t,r,o,a,i])},I1={kind:"idle"},pa=()=>{const e=l.useEditorState(o=>o.standingInteraction),t=l.useEditorState(o=>o.editTargetUnderPointer?.kind==="menu-trigger"),r=L1();return(0,v.useMemo)(()=>e!==null?e:r===null?I1:{kind:"trigger",anchor:r,engaged:t},[e,r,t])},E1=(e,t)=>e.x>=0&&e.x<=t.width&&e.y>=0&&e.y<=t.height,M1=(e,t,r)=>{const o=l.useEditorStore(),{selectionStore:a}=l.useGraphContext(),{store:i,engine:s}=l.useHoverContext(),c=l.useLatestRef(e),d=l.useLatestRef(t),h=l.useLatestRef(r);(0,v.useEffect)(()=>{const p=b=>Sr(b,d.current,o.getState().menuTrigger),m=b=>{if(p(b)||a.getState().selection.length>0)return;const S=h.current,j=d.current,L={x:b.clientX-j.x,y:b.clientY-j.y},A=E1(L,S)?s.query((0,u.toPanelCursor)(L,S)):u.RESTING_HOVER_STATE;i.getState().setHoverState(A)};let g=!1;const f=()=>{g=c.current.kind==="menu"},x=b=>{if(ht(b.target))return;const{claimInteraction:S,releaseInteraction:j}=o.getState();if(!p(b)||g){j("menu"),g&&m(b);return}const L=c.current;L.kind==="trigger"&&S({kind:"menu",anchor:L.anchor})};return document.addEventListener("pointerdown",f,!0),document.addEventListener("click",x),()=>{document.removeEventListener("pointerdown",f,!0),document.removeEventListener("click",x)}},[o,a,c,i,s,d,h])},R1=(e,t,r)=>{const o=l.useEditorStore(),{store:a}=l.useGraphContext(),{store:i}=l.useHoverContext(),s=l.useLatestRef(t),c=l.MODE_SURFACES[l.useGraphMode()].observationsPress;(0,v.useEffect)(()=>(i.getState().setEditorOwnsQuery(c),()=>i.getState().setEditorOwnsQuery(!1)),[i,c]),(0,v.useEffect)(()=>{let d=null,h=null,p=!1;const m=w=>{if(!c)return;const I=i.getState();I.suspendsHover||w===null&&I.hover.primary===null||I.setHoverState(w??u.RESTING_HOVER_STATE)},g=()=>{if(d=null,h===null)return;const w=o.getState();if(Le(w.standingInteraction)){const P=w.menuTrigger!==null&&(0,u.isPointWithinEditMenuTrigger)({x:h.clientX-s.current.x,y:h.clientY-s.current.y},w.menuTrigger),N=w.editTargetUnderPointer;P?w.setEditTargetUnderPointer({kind:"menu-trigger"}):N?.kind==="menu-trigger"&&w.setEditTargetUnderPointer(null);return}if(p&&(p=!1,h={...h,target:O1(h)}),l.isOnLiveGeomMark(h.target,e)){w.setEditTargetUnderPointer(null);return}const{targetAtPoint:I,hover:T}=ha(h,r());w.setEditTargetUnderPointer(I),m(T)},f=()=>{d===null&&(d=requestAnimationFrame(g))},x=()=>{h!==null&&(p=!0,f())},b=()=>{o.getState().setEditTargetUnderPointer(null),m(null)},S=w=>{h={target:w.target,clientX:w.clientX,clientY:w.clientY},p=!1,f()},j=()=>{h=null,d!==null&&(cancelAnimationFrame(d),d=null),b()},L=o.subscribe((w,I)=>{Le(I.standingInteraction)&&!Le(w.standingInteraction)&&x()}),A=a.subscribe((w,I)=>{w.scene!==I.scene&&(Le(o.getState().standingInteraction)||x())});return e.addEventListener("pointermove",S),e.addEventListener("pointerleave",j),()=>{d!==null&&cancelAnimationFrame(d),L(),A(),e.removeEventListener("pointermove",S),e.removeEventListener("pointerleave",j),b()}},[e,o,a,i,s,c,r])},O1=e=>typeof document.elementFromPoint=="function"?document.elementFromPoint(e.clientX,e.clientY):e.target,Le=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}},Kn="editor",Xn=[],_1=(e,t,r,o,a)=>{const i=pa(),{store:s}=l.useHoverContext(),c=l.useGraphSelection().length>0,d=l.MODE_SURFACES[l.useGraphMode()].holdsHoverWhileSelected,h=l.useEditorState(x=>x.menuTrigger),p=i.kind==="menu",m=(0,v.useMemo)(()=>h===null?Xn:[(0,u.buildEditMenuTriggerRegion)(h)],[h]),g=P1(e,t);R1(e,t,g),T1(e,t,r,g,a),M1(i,t,r),u1(e),A1(e),c1(e,o),(0,v.useEffect)(()=>(s.getState().publishPointerRegions(Kn,m),()=>s.getState().publishPointerRegions(Kn,Xn)),[s,m]);const f=p||c&&d;(0,v.useEffect)(()=>(s.getState().setSuspendsHover(f),()=>s.getState().setSuspendsHover(!1)),[s,f]),(0,v.useEffect)(()=>{if(!c||!d)return;const x=s.getState();x.setHoverState(u.RESTING_HOVER_STATE),x.setTooltipAnchor(null)},[s,c,d])},N1=({frameElement:e,panelRect:t,formattedAxes:r,animateTransitions:o})=>{const{measureRef:a,screenRect:i}=l.useElementScreenRect(),{selectionStore:s}=l.useGraphContext(),c=l.useEditorStore(),d=l.useEditorState(m=>m.caret?.annotationId??null),h=l.useGraphMode(),p=(0,v.useRef)(h);return(0,v.useEffect)(()=>(a(e),()=>a(null)),[a,e]),(0,v.useEffect)(()=>()=>{const m=c.getState();m.releaseInteraction("menu"),m.setCaret(null),m.setPressedObservation(null)},[c]),(0,v.useEffect)(()=>{if(p.current===h)return;p.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)(Ei,{children:[d!==null&&(0,n.jsx)(D1,{annotationId:d,panelRect:t}),(0,n.jsx)(F1,{frameElement:e,frameRect:i,panelRect:t,formattedAxes:r,animateTransitions:o})]})},D1=({annotationId:e,panelRect:t})=>{const r=l.useEditorStore(),{textAnnotations:o}=l.useResolvedAnnotations(t);return(0,v.useEffect)(()=>{o.some(({id:a})=>a===e)||r.getState().setCaret(null)},[e,o,r]),null},F1=({frameElement:e,frameRect:t,panelRect:r,formattedAxes:o,animateTransitions:a})=>{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 _1(e,i,r,s,o),(0,n.jsx)(B1,{frameElement:e,frameRect:t,panelOrigin:i,panelRect:r,boxRef:c,animateTransitions:a})},B1=({frameElement:e,frameRect:t,panelOrigin:r,panelRect:o,boxRef:a,animateTransitions:i})=>{const s=se(),c=pa(),{annotations:d,editOutline:h,overlayMenu:p}=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)(nu,{frameElement:e,frameSize:m,panelRect:o,animateTransitions:i}),(0,n.jsx)(Zu,{frameRect:t})]}),(0,n.jsx)(zl,{rect:t,zIndex:l.Z_INDEX.editorOverlay,container:s,"data-testid":"editor-overlay",boxRef:a,children:(0,n.jsxs)(l.PortalThemeProvider,{children:[d&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(V0,{panelRect:o,panelOrigin:r,frameRect:t,frameElement:e}),(0,n.jsx)(xp,{panelRect:o,frameRect:t,frameElement:e}),(0,n.jsx)(g0,{panelRect:o,frameRect:t,frameElement:e}),(0,n.jsx)(qp,{panelRect:o,frameRect:t,frameElement:e}),(0,n.jsx)(J0,{panelRect:o}),(0,n.jsx)(ap,{panelRect:o}),(0,n.jsx)(Nh,{panelRect:o}),(0,n.jsx)(Y0,{panelRect:o})]}),(0,n.jsx)(i1,{interaction:c,panelRect:o}),(0,n.jsx)(Eh,{interaction:c,frameElement:e,panelRect:o}),p&&(0,n.jsx)(Ku,{frameElement:e})]})})]})},z1={},G1=({slots:e,mode:t,palettePresets:r=z1,editMenus:o,...a})=>(0,n.jsx)(Rt,{locale:l.useGraphLocale(),children:(0,n.jsx)(Rd,{editMenus:o,children:(0,n.jsx)(l.EditorProvider,{children:(0,n.jsx)(ld,{value:r,children:(0,n.jsx)(l.InlineEditorsProvider,{editors:Fl,children:(0,n.jsx)(l.GraphRendererBody,{slots:(0,v.useMemo)(()=>({EditorSurface:N1,...e}),[e]),mode:t,...a})})})})})}),H1="_12lhx9e0",ma=({children:e})=>(0,n.jsx)("div",{className:H1,children:e}),V1="_139ohwv0",W=({children:e})=>(0,n.jsx)("div",{className:V1,children:e}),ga=(0,v.createContext)(null),W1=ga.Provider,va=()=>{const e=(0,v.useContext)(ga);if(!e)throw new Error("A section must be rendered inside <EditorPanel.Root>.");return e},$1="_1jlczkt0",xa="data-graphy-editor-panel",U1={List:W,Grid:ma};function q1(e){if(e===void 0)return!1;const t=e.split(/\s+/);return t.includes("_1ii3bsb0")||t.includes("_1ii3bsb1")}var K1=()=>()=>{},X1=e=>{const t=(0,v.useSyncExternalStore)(e?.store.subscribe??K1,()=>e?.store.getState().scene.config.parsingLocale);return e?.formattingLocale??t},Z1=e=>{const t=(0,v.useContext)(l.GraphContext),r=X1(t),o=l.useHasI18n(),a=l.useHasThemeContext();let i=(0,n.jsx)(Y1,{...e});return!a&&t&&(i=(0,n.jsx)(l.ThemeProvider,{colorScheme:t.colorScheme,children:i})),o||(i=(0,n.jsx)(Rt,{locale:r,children:i})),i},Yt={Root:Z1,Controls:U1},Y1=({handle:e,children:t,controls:r,defaultExpandedSection:o=void 0,className:a})=>{const i=l.useGraphHandle(e),{themeClass:s,inlineVarsStyle:c}=l.useThemeContext(),[d,h]=(0,v.useState)(()=>o?[o]:[]),p=(0,v.useMemo)(()=>({expandSection:m=>h([m]),collapseAllSections:()=>h([])}),[]);return(0,n.jsx)(Nt.Provider,{value:i,children:(0,n.jsx)(_r,{controls:r,children:(0,n.jsx)(W1,{value:p,children:(0,n.jsx)(ue.Accordion.Root,{[xa]:"",className:(0,U.default)($1,a,{[s]:!q1(a)}),style:c,value:d,onValueChange:m=>h(m),children:t})})})})},J1="_2m7wuq0",Q1=()=>(0,n.jsx)(ei.Separator,{className:J1}),em=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",Qt="_40zvwv1",tm="_40zvwv2",fa="_40zvwv3",nm="_40zvwv4 _40zvwv3";var rm="_40zvwv6";var om="_40zvwv8",z=({title:e,layout:t="fixed",preview:r,accessory:o,onOpenChange:a,children:i})=>t==="collapsible"?(0,n.jsx)(im,{title:e,preview:r,accessory:o,onOpenChange:a,children:i}):t==="inline"&&r===void 0?(0,n.jsx)(am,{title:e,accessory:o,children:i}):(0,n.jsxs)("div",{className:Jt,children:[(0,n.jsxs)("div",{className:Qt,children:[(0,n.jsx)("span",{className:fa,children:e}),r!==void 0&&(0,n.jsx)("span",{className:"_40zvwv5",children:r}),o!==void 0&&(0,n.jsx)("span",{className:"_40zvwv7",children:o})]}),(0,n.jsx)("div",{children:i})]}),am=({title:e,accessory:t,children:r})=>{const o=(0,v.useId)(),a=(0,v.useId)();return(0,n.jsx)("div",{className:Jt,children:(0,n.jsxs)("div",{className:Qt,children:[(0,n.jsx)("label",{id:o,htmlFor:a,className:nm,children:e}),(0,n.jsx)("span",{className:rm,children:(0,n.jsx)(ur,{labelId:o,controlId:a,children:r})}),t!==void 0&&(0,n.jsx)("span",{className:"_40zvwv7",children:t})]})})},im=({title:e,preview:t,accessory:r,onOpenChange:o,children:a})=>{const i=l.useI18n();return(0,n.jsxs)(ue.Accordion.Item,{value:e,className:Jt,onOpenChange:o,children:[(0,n.jsxs)(ue.Accordion.Header,{className:Qt,render:(0,n.jsx)("div",{}),children:[(0,n.jsx)(ue.Accordion.Trigger,{className:tm,"aria-label":i("editor.accessibility.toggleSection",{title:e})}),(0,n.jsx)("span",{className:fa,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:om,children:(0,n.jsx)(em,{size:"sm"})})]}),(0,n.jsx)(ue.Accordion.Panel,{children:(0,n.jsx)("div",{children:a})})]})},ba=({title:e,checked:t,onToggle:r,disabled:o,preview:a,children:i})=>{const{expandSection:s,collapseAllSections:c}=va(),{Switch:d}=O(),h=m=>{r(m),m?s(e):c()},p=m=>{m&&!t&&o!==!0&&r(!0)};return(0,n.jsx)(z,{title:e,layout:"collapsible",preview:a,onOpenChange:p,accessory:(0,n.jsx)(d,{checked:t,onChange:h,disabled:o,ariaLabel:e}),children:i})},sm={horizontal:["bottom","top"],vertical:["left","right"]},lm={left:"editor.axesPanel.position.left",right:"editor.axesPanel.position.right",top:"editor.axesPanel.position.top",bottom:"editor.axesPanel.position.bottom"},cm={x:"editor.axesPanel.mainAxisSection.xAxis",y:"editor.axesPanel.mainAxisSection.yAxis"},kt=({axis:e,title:t,layout:r="collapsible",preview:o})=>{const a=B(),i=l.useHandleScene(a),s=l.useI18n(),{NumberField:c,Switch:d,TextField:h,ToggleGroup:p}=O();if(!i)return null;const m=i.coordSystem.type==="polar"?i.coordSystem.axisMapping[e].geometry:"linear",g=i.config.axes[e],f=i.scales[e],x=f?.spec,b=x?.scaleType==="continuous"?x:void 0;if(m==="circular"||m==="radial"&&b===void 0)return null;const S=x!==void 0&&"reverse"in x?x:void 0,j=x?.scaleType==="continuous"||x?.scaleType==="datetime",L=b!==void 0&&(0,u.isZeroAnchoredAxis)(i,e),A=b?.transform==="log",w=b?.domainMax??null,I=dm(b),T=(E,X)=>E.map(ye=>({value:ye,label:X(ye)})),P=i.guides.axes.find(E=>E.scaleAestheticKey===e)?.position,N=sm[P==="bottom"||P==="top"||P===void 0&&e==="x"?"horizontal":"vertical"],V=e==="y"?(0,u.readComboLineLayerId)(i.spec):null,R=V===null?void 0:(0,u.findLayerById)(i.spec.layers,V),C=i.guides.legends.drawn.some(E=>N.some(X=>X===E.position)),y=N.map(E=>({value:E,label:s(lm[E])})),M=T(["auto","edges"],E=>s(E==="edges"?"editor.axesPanel.labelMode.edges":"editor.axesPanel.labelMode.auto")),D=T(["linear","log"],E=>s(E==="log"?"editor.axesPanel.scale.log":"editor.axesPanel.scale.auto")),$=T(["auto","zero","custom"],E=>s(E==="zero"?"editor.axesPanel.startFrom.zero":E==="custom"?"editor.axesPanel.startFrom.custom":"editor.axesPanel.startFrom.auto")),et=T(["auto","custom"],E=>s(E==="custom"?"editor.axesPanel.endAt.custom":"editor.axesPanel.endAt.auto")),La=T(["no","yes"],E=>s(E==="yes"?"editor.axesPanel.yesNo.yes":"editor.axesPanel.yesNo.no")),Ia=T(["single","double"],E=>s(E==="double"?"editor.axesPanel.axisCount.double":"editor.axesPanel.axisCount.single")),Ea=E=>{a.commands.dispatch(new u.SetAxisVisibilityCommand({axis:e,visible:E}))},Ma=E=>{a.commands.dispatch(new u.SetAxisLabelCommand({axis:e,label:E===""?null:E}),{transient:!0})},Ra=E=>{a.commands.dispatch(new u.SetAxisTicksVisibilityCommand({axis:e,visible:E}))},Oa=E=>{a.commands.dispatch(new u.SetAxisTickModeCommand({axis:e,tickMode:E==="edges"?"edges":"auto"}))},_a=E=>{a.commands.dispatch(new u.SetScaleReverseCommand({scaledAesthetic:e,reverse:E==="yes"}))},Na=E=>{a.commands.dispatch(new u.SetScaleTransformCommand({scaledAesthetic:e,transform:E==="log"?"log":"linear"}))},tn=E=>{a.commands.dispatch(new u.SetScaleDomainCommand({scaledAesthetic:e,...E}),{transient:!0})},Da=E=>{E!==null&&tn({domainMin:E})},Fa=E=>{E!==null&&tn({domainMax:E})},Ba=E=>{const X=E==="auto"?null:E==="zero"?0:Zn(f?.domain,"start");a.commands.dispatch(new u.SetScaleDomainCommand({scaledAesthetic:e,domainMin:X}))},za=E=>{const X=E==="custom"?Zn(f?.domain,"end"):null;a.commands.dispatch(new u.SetScaleDomainCommand({scaledAesthetic:e,domainMax:X}))},Ga=E=>{R!==void 0&&a.commands.dispatch(new u.SetLayerYScaleTypeCommand({layerId:R.id,yScaleType:E==="double"?"secondary":"primary"}))},Ha=E=>{const X=N.find(ye=>ye===E);X&&a.commands.dispatch(new u.SetAxisPositionCommand({axis:e,position:X}))};return(0,n.jsx)(z,{title:t??s(cm[e]),layout:r,preview:o,children:(0,n.jsxs)(W,{children:[(0,n.jsx)(k,{label:s("editor.axesPanel.controls.visible"),children:(0,n.jsx)(d,{checked:g.visible,onChange:Ea})}),R!==void 0&&(0,n.jsx)(k,{label:s("editor.axesPanel.controls.numberOfAxes"),children:(0,n.jsx)(p,{value:R.yScaleType==="secondary"?"double":"single",options:Ia,onChange:Ga})}),m==="linear"&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(k,{label:s("editor.axesPanel.controls.title"),children:(0,n.jsx)(h,{value:g.label??"",onChange:Ma,onCommit:a.commands.commit})}),(0,n.jsx)(k,{label:s("editor.axesPanel.controls.ticks"),children:(0,n.jsx)(d,{checked:g.ticks.visible,onChange:Ra})})]}),j&&(0,n.jsx)(k,{label:s("editor.axesPanel.controls.labels"),children:(0,n.jsx)(p,{value:g.ticks.mode,options:M,onChange:Oa})}),b&&m==="linear"&&!C&&(0,n.jsx)(k,{label:s("editor.axesPanel.controls.position"),children:(0,n.jsx)(p,{value:P??g.position,options:y,onChange:Ha})}),S!==void 0&&(0,n.jsx)(k,{label:s("editor.axesPanel.controls.reverse"),children:(0,n.jsx)(p,{value:S.reverse===!0?"yes":"no",options:La,onChange:_a})}),b&&!L&&(0,n.jsx)(k,{label:s("editor.axesPanel.controls.scale"),children:(0,n.jsx)(p,{value:A?"log":"linear",options:D,onChange:Na})}),b&&!A&&(0,n.jsxs)(n.Fragment,{children:[!L&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(k,{label:s("editor.axesPanel.controls.startFrom"),children:(0,n.jsx)(p,{value:I,options:$,onChange:Ba})}),I!=="auto"&&(0,n.jsx)(k,{label:s("editor.axesPanel.controls.value"),children:(0,n.jsx)(c,{value:b.domainMin??null,onChange:Da,onCommit:a.commands.commit})})]}),(0,n.jsx)(k,{label:s("editor.axesPanel.controls.endAt"),children:(0,n.jsx)(p,{value:w===null?"auto":"custom",options:et,onChange:za})}),w!==null&&(0,n.jsx)(k,{label:s("editor.axesPanel.controls.value"),children:(0,n.jsx)(c,{value:w,onChange:Fa,onCommit:a.commands.commit})})]})]})})},dm=e=>{const t=e?.domainMin??null;return t===null?"auto":t===0?"zero":"custom"},Zn=(e,t)=>{const r=t==="start"?e?.[0]:e?.[e.length-1];return typeof r=="number"?r:0},en=({value:e,onChange:t})=>{const r=B(),o=l.useI18n(),{TextField:a}=O(),i=e!==null&&typeof e!="string",s=c=>t(c===""?null:c);return(0,n.jsx)(k,{label:o("editor.elementsPanel.contentValue"),children:(0,n.jsx)(a,{value:typeof e=="string"?e:"",onChange:s,onCommit:r.commands.commit,disabled:i})})},Sa=({title:e,layout:t="collapsible",preview:r})=>{const o=B(),a=l.useHandleScene(o),i=l.useI18n(),{Switch:s}=O();if(!a)return null;const c=a.config.content,d=p=>{o.commands.dispatch(new u.ToggleContentVisibilityCommand({part:"caption",visible:p}))},h=p=>{o.commands.dispatch(new u.SetContentCaptionCommand({caption:p}),{transient:!0})};return(0,n.jsx)(z,{title:e??i("editor.elementsPanel.footerSection.caption"),layout:t,preview:r,children:(0,n.jsxs)(W,{children:[(0,n.jsx)(k,{label:i("editor.elementsPanel.contentVisible"),children:(0,n.jsx)(s,{checked:c.showCaption,onChange:d})}),(0,n.jsx)(en,{value:c.caption,onChange:h})]})})},Yn=/^[a-z][a-z\d+.-]*:/i,um={},ya=({title:e,layout:t="collapsible",preview:r})=>{const o=B(),a=l.useHandleScene(o),i=l.useI18n(),{Switch:s}=O();if(!a)return null;const c=a.config.content,d=h=>{o.commands.dispatch(new u.ToggleContentVisibilityCommand({part:"source",visible:h}))};return(0,n.jsx)(z,{title:e??i("editor.elementsPanel.sourceSection.title"),layout:t,preview:r,children:(0,n.jsxs)(W,{children:[(0,n.jsx)(k,{label:i("editor.elementsPanel.contentVisible"),children:(0,n.jsx)(s,{checked:c.showSource,onChange:d})}),(0,n.jsx)(hm,{source:c.source??um})]})})},hm=({source:e})=>{const t=B(),r=l.useI18n(),{TextField:o}=O(),a=d=>{const h=(d.label??"")!==""||(d.url??"")!=="";t.commands.dispatch(new u.SetContentSourceCommand({source:h?d:null}),{transient:!0})},i=()=>{const d=e.url??"";d!==""&&!Yn.test(d)&&a({...e,url:`https://${d}`}),t.commands.commit()},s=d=>a({...e,url:d}),c=d=>a({...e,label:d});return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(k,{label:r("editor.elementsPanel.sourceSection.url"),children:(0,n.jsx)(o,{value:e.url??"",onChange:s,onCommit:i,hasError:Yn.test(e.url??"")&&!(0,u.isSafeUrl)(e.url)})}),(0,n.jsx)(k,{label:r("editor.elementsPanel.sourceSection.name"),children:(0,n.jsx)(o,{value:e.label??"",onChange:c,onCommit:t.commands.commit})})]})},Ca=({title:e,layout:t="collapsible",preview:r})=>{const o=B(),a=l.useHandleScene(o),i=l.useI18n(),{Switch:s}=O();if(!a)return null;const c=a.config.content,d=p=>{o.commands.dispatch(new u.ToggleContentVisibilityCommand({part:"subtitle",visible:p}))},h=p=>{o.commands.dispatch(new u.SetContentSubtitleCommand({subtitle:p}),{transient:!0})};return(0,n.jsx)(z,{title:e??i("editor.elementsPanel.headerSection.subtitle"),layout:t,preview:r,children:(0,n.jsxs)(W,{children:[(0,n.jsx)(k,{label:i("editor.elementsPanel.contentVisible"),children:(0,n.jsx)(s,{checked:c.showSubtitle,onChange:d})}),(0,n.jsx)(en,{value:c.subtitle,onChange:h})]})})},Se=e=>{const{colorScheme:t}=l.useThemeContext(),r=(0,v.useMemo)(()=>(0,u.createStyleResolver)({colorScheme:t}),[t]);return(0,v.useMemo)(()=>e===null?null:r.readers(e),[e,r])},ja=(e,t,r)=>{const o=Se(e);return(0,v.useMemo)(()=>{if(o===null||e===null||t===null)return null;const a=(0,u.findLayerById)(e.layers,t);return a===void 0?null:o.geom[r](a)},[o,e,t,r])},Pt=[.8,1,1.2,1.4,1.6,1.8,2,2.5,3,4],pm=Pt.length/2,mm={select:{target:"graph"}},wa=({title:e,layout:t="collapsible",preview:r})=>{const o=B(),a=l.useHandleScene(o),i=l.useI18n(),{RadioGrid:s}=O(),c=Se(a);if(!a||!c)return null;const d=c.graph().get("textScale"),h=g=>i("editor.elementsPanel.textSizeSection.scaleFormat",{value:`${g}`}),p=Pt.map(g=>({value:`${g}`,label:h(g)})),m=g=>{const f=Pt.find(b=>`${b}`===g);if(f===void 0)return;const x=(0,u.findStyleRule)(a.spec.styles.overrides,mm,(0,u.readStyleCoord)(a.spec))?.declarations??{};o.commands.dispatch(new u.SetStyleRuleCommand({list:"overrides",rule:{select:{target:"graph"},declarations:{...x,textScale:f}}}))};return(0,n.jsx)(z,{title:e??i("editor.elementsPanel.textSizeSection.title"),layout:t,preview:r??h(d),children:(0,n.jsx)(s,{value:`${d}`,options:p,columns:pm,onChange:m,ariaLabel:i("editor.elementsPanel.textSizeSection.title")})})},Ta=({title:e,layout:t="collapsible",preview:r})=>{const o=B(),a=l.useHandleScene(o),i=l.useI18n(),{Switch:s}=O();if(!a)return null;const c=a.config.content,d=p=>{o.commands.dispatch(new u.ToggleContentVisibilityCommand({part:"title",visible:p}))},h=p=>{o.commands.dispatch(new u.SetContentTitleCommand({title:p}),{transient:!0})};return(0,n.jsx)(z,{title:e??i("editor.elementsPanel.headerSection.toggleTitle"),layout:t,preview:r,children:(0,n.jsxs)(W,{children:[(0,n.jsx)(k,{label:i("editor.elementsPanel.contentVisible"),children:(0,n.jsx)(s,{checked:c.showTitle,onChange:d})}),(0,n.jsx)(en,{value:c.title,onChange:h})]})})},gm=({children:e,...t})=>(0,n.jsx)(Yt.Root,{...t,children:e??(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Ta,{}),(0,n.jsx)(Ca,{}),(0,n.jsx)(Sa,{}),(0,n.jsx)(ya,{}),(0,n.jsx)(wa,{})]})}),vm=({children:e,...t})=>(0,n.jsx)(Yt.Root,{...t,children:e??(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(kt,{axis:"x"}),(0,n.jsx)(kt,{axis:"y"})]})}),Ye=e=>`${e}px`,Aa=e=>`${Math.round(e*100)}%`,xm=e=>`${e}°`,fm=24,bm={select:{target:"graph"}},Jn=["dim","desaturate"],Sm=({title:e,layout:t="collapsible",preview:r})=>{const o=B(),a=l.useHandleScene(o),i=l.useI18n(),{Slider:s,ToggleGroup:c}=O(),d=Se(a);if(!a||!d)return null;const h=d.graph().get("cornerRadius"),p=(0,u.readHighlightDimStyle)(a.spec),m=Jn.map(x=>({value:x,label:i(x==="dim"?"editor.highlighting.highlightStyle.tint":"editor.highlighting.highlightStyle.gray")})),g=x=>{const b=(0,u.findStyleRule)(a.spec.styles.overrides,bm,(0,u.readStyleCoord)(a.spec))?.declarations??{};o.commands.dispatch(new u.SetStyleRuleCommand({list:"overrides",rule:{select:{target:"graph"},declarations:{...b,cornerRadius:x}}}),{transient:!0})},f=x=>{const b=Jn.find(S=>S===x);b&&o.commands.dispatch(new u.SetHighlightDimStyleCommand({dimStyle:b}))};return(0,n.jsx)(z,{title:e??i("editor.colorPanel.appearanceSection.title"),layout:t,preview:r,children:(0,n.jsxs)(W,{children:[(0,n.jsx)(k,{label:i("editor.colorPanel.borderSection.cornerRadius"),children:(0,n.jsx)(s,{value:h,min:0,max:fm,step:1,formatValue:Ye,onChange:g,onCommit:o.commands.commit})}),(0,n.jsx)(k,{label:i("editor.colorPanel.appearanceSection.highlightStyle"),children:(0,n.jsx)(c,{value:p,options:m,onChange:f})})]})})},ym=.05,Cm=({title:e,layout:t="collapsible",preview:r})=>{const o=B(),a=l.useHandleScene(o),i=l.useI18n(),{Slider:s,ToggleGroup:c}=O(),d=a?(0,u.findLayerByGeom)(a.spec.layers,"bar"):void 0,h=ja(a,d?.id??null,"bar");if(!a||!d||a.coordSystem.type==="polar"&&a.coordSystem.bandAxis===null)return null;const p=b=>{o.commands.dispatch(new u.SetBarWidthCommand({layerId:d.id,width:b}),{transient:!0})},m=b=>{const S=u.BORDER_RADIUS_TOKENS.find(j=>j===b);S&&o.commands.dispatch(new u.SetBarCornerRadiusCommand({layerId:d.id,cornerRadius:S}))},g=u.BORDER_RADIUS_TOKENS.map(b=>({value:b,label:i(`editor.graphPanel.barSection.roundingOptions.${b}`)})),f=(0,u.resolveBarBandFraction)(d.params,a.coordSystem.type),x=h?.get("cornerRadius")??u.DEFAULT_BAR_CORNER_RADIUS;return(0,n.jsx)(z,{title:e??i("editor.graphPanel.barSection.title"),layout:t,preview:r,children:(0,n.jsxs)(W,{children:[(0,n.jsx)(k,{label:i("editor.graphPanel.barSection.thickness"),children:(0,n.jsx)(s,{value:f,min:u.MIN_BAR_WIDTH_FRACTION,max:u.MAX_BAR_WIDTH_FRACTION,step:ym,formatValue:Aa,onChange:p,onCommit:o.commands.commit})}),(0,n.jsx)(k,{label:i("editor.graphPanel.barSection.rounding"),layout:"stack",children:(0,n.jsx)(c,{value:typeof x=="string"?x:"",options:g,onChange:m})})]})})},Je=({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"})]})})]})},Qe="qdaoth0",jm=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 31 33",...e,children:[(0,n.jsx)(Je,{children:(0,n.jsx)("path",{className:Qe,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"})]}),wm=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 32 32",...e,children:(0,n.jsxs)(Je,{children:[(0,n.jsx)("path",{className:Qe,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"})]})}),Tm=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 32 33",...e,children:[(0,n.jsx)(Je,{children:(0,n.jsx)("path",{className:Qe,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"})]}),Am=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 32 33",...e,children:[(0,n.jsx)(Je,{children:(0,n.jsx)("path",{className:Qe,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"})]}),km={x:.5,y:.5},Pm=.2,Lm={x:.375,y:.25,width:.25,height:.5},Im={zOrder:"background"},Em={x:.4,y:.6},Mm={x:.6,y:.4},Rm="relative-difference",Om=({title:e,layout:t="collapsible",preview:r})=>{const o=B(),a=l.useHandleScene(o),i=l.useI18n(),{Button:s}=O();if(!a)return null;const c=()=>{o.commands.dispatch(new u.AddAnnotationCommand({kind:"text",annotation:{...u.TEXT_ANNOTATION_DEFAULTS,content:_m(i("editor.annotatePanel.callOutSection.text")),at:{anchorType:"panel",...km},width:Pm}}))},d=()=>{o.commands.dispatch(new u.AddAnnotationCommand({kind:"arrow",annotation:{...u.ARROW_DEFAULTS,start:{anchorType:"panel",...Em},end:{anchorType:"panel",...Mm}}}))},h=()=>{o.commands.dispatch(new u.AddAnnotationCommand({kind:"shape",annotation:{...u.SHAPE_DEFAULTS,...Im,region:{anchorType:"panel",...Lm}}}))},p=()=>{const g=(0,u.inferDefaultDifferenceArrowEndpoints)(a);g!==null&&o.commands.dispatch(new u.AddAnnotationCommand({kind:"differenceArrow",annotation:{...u.DIFFERENCE_ARROW_DEFAULTS,...g,label:Rm}}))},m=a.coordSystem.type==="cartesian";return(0,n.jsx)(z,{title:e??i("editor.annotatePanel.callOutSection.title"),layout:t,preview:r,children:(0,n.jsxs)(ma,{children:[(0,n.jsx)(s,{variant:"tile",icon:(0,n.jsx)(Am,{size:"xl"}),label:i("editor.annotatePanel.callOutSection.text"),onClick:c}),(0,n.jsx)(s,{variant:"tile",icon:(0,n.jsx)(jm,{size:"xl"}),label:i("editor.annotatePanel.callOutSection.arrow"),onClick:d}),(0,n.jsx)(s,{variant:"tile",icon:(0,n.jsx)(wm,{size:"xl"}),label:i("editor.annotatePanel.callOutSection.box"),onClick:h}),m&&(0,n.jsx)(s,{variant:"tile",icon:(0,n.jsx)(Tm,{size:"xl"}),label:i("editor.annotatePanel.callOutSection.difference"),onClick:p})]})})},_m=e=>({type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e}]}]}),Nm=({title:e,layout:t="collapsible",preview:r})=>{const o=B(),a=l.useHandleScene(o),i=l.useI18n(),{ToggleGroup:s}=O();if(!a)return null;const c=(0,u.readChartType)(a.spec);if(c===null||!(0,u.isComboChartType)(c))return null;const d=u.COMBO_TYPES.map(p=>({value:p,label:i(`editor.graphPanel.comboSection.types.${p}`)})),h=p=>{const m=u.COMBO_TYPES.find(g=>g===p);m&&o.commands.dispatch(new u.SetChartTypeCommand({coordType:"cartesian",comboType:m}))};return(0,n.jsx)(z,{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")})})},Dm=.1,Fm=20,Bm=({title:e,preview:t})=>{const r=B(),o=l.useHandleScene(r),a=l.useI18n(),{NumberField:i,TextField:s}=O();if(!o||o.coordSystem.type==="polar")return null;const c=(0,u.findGoalLineLayer)(o.spec.layers),d=e??a("editor.annotationsPanel.goalSection.title"),h=(0,u.readConstantValue)(c?.mapping.y),p=typeof h=="number"?h:null,m=x=>{const b=new u.ToggleGoalLineCommand({showGoalLine:x,value:zm(o),...c!==void 0&&{layerId:c.id}});r.commands.dispatch(b)},g=x=>{if(c===void 0)return;const b=new u.SetRuleLabelCommand({layerId:c.id,label:x===""?null:x});r.commands.dispatch(b,{transient:!0})},f=x=>{if(c===void 0||x===null)return;const b=new u.SetRuleValueCommand({layerId:c.id,value:x});r.commands.dispatch(b,{transient:!0})};return(0,n.jsx)(ba,{title:d,preview:t,checked:c!==void 0,onToggle:m,children:(0,n.jsxs)(W,{children:[(0,n.jsx)(k,{label:a("editor.annotationsPanel.goalSection.labelControl"),children:(0,n.jsx)(s,{value:c?.params.label??"",placeholder:a("editor.annotationsPanel.goalSection.labelPlaceholder"),onChange:g,onCommit:r.commands.commit,ariaLabel:a("editor.annotationsPanel.goalSection.labelAriaLabel")})}),(0,n.jsx)(k,{label:a("editor.annotationsPanel.goalSection.valueControl"),children:(0,n.jsx)(i,{value:p,placeholder:a("editor.powerUpPanel.valueInput.numberPlaceholder"),onChange:f,onCommit:r.commands.commit,ariaLabel:a("editor.annotationsPanel.goalSection.valueAriaLabel")})})]})})},zm=e=>{const t=(e.scales.y?.domain??[]).filter(s=>typeof s=="number");if(t.length===0)return 0;const r=Math.max(...t),o=r-Math.min(...t),a=o>0?o:Math.abs(r);if(a===0)return 0;const i=Math.min(Fm,Math.max(0,1-Math.floor(Math.log10(a))));return Number((r+a*Dm).toFixed(i))},Gm=({layerId:e,title:t,layout:r="collapsible",preview:o})=>{const a=B(),i=l.useHandleScene(a),s=l.useI18n(),{Switch:c}=O();if(!i)return null;const d=e===void 0?i.layers[0]:(0,u.findLayerById)(i.layers,e);if(!d)return null;const{showDataLabels:h,format:p,showStackTotals:m,showCategoryLabels:g}=d.dataLabels,f=Jr(d,i.coordSystem.type,{hasCapability:a.canPlaceDataLabels,hasPercentageFormat:a.canFormatDataLabelsAsPercentages});if(!f.supportsDataLabels)return null;const x=L=>{const A=new u.ToggleDataLabelsCommand({layerId:d.id,showDataLabels:L});a.commands.dispatch(A)},b=L=>{const A=new u.SetDataLabelsFormatCommand({layerId:d.id,format:L?"percentage":"absolute"});a.commands.dispatch(A)},S=L=>{const A=new u.ToggleStackTotalsCommand({layerId:d.id,showStackTotals:L});a.commands.dispatch(A)},j=L=>{const A=new u.ToggleCategoryLabelsCommand({layerId:d.id,showCategoryLabels:L});a.commands.dispatch(A)};return(0,n.jsx)(z,{title:t??s("editor.graphPanel.graphOptionsSection.title"),layout:r,preview:o,children:(0,n.jsxs)(W,{children:[(0,n.jsx)(k,{label:s("editor.graphPanel.graphOptions.dataLabels"),children:(0,n.jsx)(c,{checked:h,onChange:x})}),f.supportsPercentages&&(0,n.jsx)(k,{label:s("editor.graphPanel.graphOptions.showPercentages"),children:(0,n.jsx)(c,{checked:p==="percentage",onChange:b})}),f.supportsStackTotals&&(0,n.jsx)(k,{label:s("editor.graphPanel.graphOptions.stackTotals"),children:(0,n.jsx)(c,{checked:m,onChange:S})}),f.supportsCategoryLabels&&(0,n.jsx)(k,{label:s("editor.graphPanel.graphOptions.categoryLabels"),children:(0,n.jsx)(c,{checked:g,onChange:j})})]})})},Hm=3,Vm=({title:e,layout:t="collapsible",preview:r})=>{const o=B(),a=l.useHandleScene(o),i=l.useI18n(),{RadioGrid:s}=O(),c=(0,v.useMemo)(()=>me.map(({name:m,icon:g,summary:f})=>({value:m,label:i(`editor.graphTypes.${m}`),icon:(0,n.jsx)(g,{size:"md"}),disabled:!to(f,a?.spec)})),[i,a]);if(!a)return null;const d=(0,u.readChartType)(a.spec),h=Oe(d),p=m=>{const g=me.find(f=>f.name===m);g&&o.commands.dispatch(new u.SetChartTypeCommand(no(g.summary,d)))};return(0,n.jsx)(z,{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:Hm,onChange:p,ariaLabel:i("editor.graphPanel.graphTypeSection.title")})})},Wm=({title:e,layout:t="collapsible",preview:r})=>{const o=B(),a=l.useHandleScene(o),i=l.useI18n(),{Slider:s,Switch:c,ToggleGroup:d}=O(),h=Se(a),p=a!==null&&h!==null?vo(a,h):null;if(p===null)return null;const m=p.axes.some(S=>S.showGrid),g=De.map(S=>({value:S,label:i(`editor.graphPanel.gridSection.lineStyles.${S}`)})),f=S=>j=>{o.commands.dispatch(new u.SetGridVisibilityCommand({axis:S,visible:j}))},x=S=>{const j=De.find(L=>L===S);j!==void 0&&o.commands.dispatch(xo(j))},b=S=>{o.commands.dispatch(fo(S),{transient:!0})};return(0,n.jsx)(z,{title:e??i("editor.graphPanel.gridSection.title"),layout:t,preview:r,children:(0,n.jsxs)(W,{children:[p.axes.map(S=>(0,n.jsx)(k,{label:i($m(S)),children:(0,n.jsx)(c,{checked:S.showGrid,onChange:f(S.scaleAestheticKey)})},S.scaleAestheticKey)),p.stylable&&m&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(k,{label:i("editor.graphPanel.gridSection.gridStyle"),children:(0,n.jsx)(d,{value:p.lineStyle,options:g,onChange:x})}),(0,n.jsx)(k,{label:i("editor.graphPanel.gridSection.gridThickness"),children:(0,n.jsx)(s,{value:p.strokeWidth,min:0,max:8,step:.5,formatValue:Ye,onChange:b,onCommit:o.commands.commit})})]})]})})},$m=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",Um="total",ka=["total","average","current"],qm=["total"],Qn=["previous","first"],er=["auto","small","medium","large"],Km=({title:e,layout:t="collapsible",preview:r})=>{const o=B(),a=l.useHandleScene(o),i=l.useI18n(),{Switch:s,ToggleGroup:c}=O();if(!a)return null;const d=a.config.headline,h=d.show!=="none",p=a.coordSystem,m=p.type==="polar",g=p.type==="polar"&&p.innerRadius>0,f=a.layers.some(R=>R.summary.grandTotal!==void 0);if(m&&!f)return null;const x=m?qm:ka,b=a.guides.headline,S=b?.kind==="perGroup"&&b.items.some(R=>R.comparison!==null),j=x.map(R=>({value:R,label:i(`editor.graphPanel.headlineNumberSection.metrics.${R}`)})),L=Qn.map(R=>({value:R,label:i(`editor.graphPanel.headlineNumberSection.comparison.${R}`)})),A=er.map(R=>({value:R,label:i(R==="auto"?"editor.graphPanel.numberFormat.options.auto":`editor.graphPanel.headlineNumberSize.sizes.${R}`)})),w=[{value:"above",label:i("editor.graphPanel.headlineNumberSection.position.above")},{value:"center",label:i("editor.graphPanel.headlineNumberSection.position.center")}],I=R=>{o.commands.dispatch(new u.SetHeadlineShowCommand({show:R?Um:"none"}))},T=R=>{const C=x.find(y=>y===R);C&&o.commands.dispatch(new u.SetHeadlineShowCommand({show:C}))},P=R=>{const C=Qn.find(y=>y===R);C&&o.commands.dispatch(new u.SetHeadlineCompareWithCommand({compareWith:C}))},N=R=>{const C=er.find(y=>y===R);C&&o.commands.dispatch(new u.SetHeadlineSizeCommand({size:C}))},V=R=>{o.commands.dispatch(new u.SetHeadlinePositionCommand({position:R==="center"?"center":"above"}))};return(0,n.jsx)(z,{title:e??i("editor.graphPanel.headlineNumberSection.title"),layout:t,preview:r??Xm(i,d.show),children:(0,n.jsxs)(W,{children:[(0,n.jsx)(k,{label:i("editor.graphPanel.headlineNumberSection.toggle"),children:(0,n.jsx)(s,{checked:h,onChange:I})}),h&&(0,n.jsxs)(n.Fragment,{children:[j.length>1&&(0,n.jsx)(k,{label:i("editor.graphPanel.headlineNumberSection.metricLabel"),layout:"stack",children:(0,n.jsx)(c,{value:d.show,options:j,onChange:T})}),S&&(0,n.jsx)(k,{label:i("editor.graphPanel.headlineNumberSection.compareWithLabel"),layout:"stack",children:(0,n.jsx)(c,{value:(0,u.resolveComparisonBasis)(d.compareWith),options:L,onChange:P})}),(0,n.jsx)(k,{label:i("editor.graphPanel.headlineNumberSize.sizeLabel"),children:(0,n.jsx)(c,{value:d.size,options:A,onChange:N})}),g&&(0,n.jsx)(k,{label:i("editor.axesPanel.controls.position"),children:(0,n.jsx)(c,{value:d.position,options:w,onChange:V})})]})]})})},Xm=(e,t)=>{const r=ka.find(o=>o===t);return r&&e(`editor.graphPanel.headlineNumberSection.metrics.${r}`)};var ut=["top","bottom","left","right","none"],tr=["auto","start","center","end"],Zm={row:{start:"left",end:"right"},column:{start:"top",end:"bottom"}},nr=["auto","pill","direct"],Ym=({positions:e,title:t,layout:r="collapsible",preview:o})=>{const a=B(),i=l.useHandleScene(a),s=l.useI18n(),{ToggleGroup:c}=O(),d=l.useTextDirection();if(!i)return null;const h=i.config.legend.position,p=e??ut,m=i.guides.legends.drawn[0],g=(0,u.canAnchorDirectLabels)({legendPosition:i.guides.legends.position,coordSystem:i.coordSystem,layers:i.layers}),f=i.guides.headline?.kind==="perGroup",x=i.guides.colorGroups.length>0;if(h==="auto"&&m===void 0&&!g&&(f||!x))return null;const b=m?.position??"none",S=h==="auto"?b:h,j=ut.filter(M=>M===S||p.includes(M)).map(M=>({value:M,label:s(`editor.graphPanel.legendSection.${M}`)})),L=M=>{const D=ut.find($=>$===M);D&&a.commands.dispatch(new u.SetLegendPositionCommand({position:D}))},A=M=>{const D=tr.find($=>$===M);D&&a.commands.dispatch(new u.SetLegendAlignCommand({align:D}))},w=M=>{const D=nr.find($=>$===M);D&&a.commands.dispatch(new u.SetLegendDisplayCommand({display:D}))},I=m?.position==="left"||m?.position==="right"?"column":"row",T=I==="row"?"ltr":d,P=M=>s(M==="start"||M==="end"?`editor.graphPanel.legendSection.${Zm[I][M]}`:`editor.graphPanel.legendSection.align.${M}`),N=tr.map(M=>({value:M,label:P(M)})),V=nr.map(M=>({value:M,label:s(`editor.graphPanel.legendSection.display.${M}`)})),R=t??s("editor.graphPanel.legendSection.title"),C=j.find(M=>M.value===S)?.label,y=m!==void 0;return(0,n.jsx)(z,{title:R,layout:r,preview:o??C,children:(0,n.jsxs)(W,{children:[(0,n.jsx)(k,{label:s("editor.axesPanel.controls.position"),layout:"stack",children:(0,n.jsx)(c,{value:S,options:j,onChange:L})}),y&&(0,n.jsx)(k,{label:s("editor.graphPanel.legendSection.alignLabel"),layout:"stack",children:(0,n.jsx)(Mt.DirectionProvider,{direction:T,children:(0,n.jsx)("div",{dir:T,className:"_1v6dqrh0",children:(0,n.jsx)(c,{value:i.config.legend.align,options:N,onChange:A})})})}),g&&(0,n.jsx)(k,{label:s("editor.graphPanel.legendSection.displayLabel"),layout:"stack",children:(0,n.jsx)(c,{value:i.config.legend.display,options:V,onChange:w})})]})})},Jm=1,Qm=20,eg=.5,Pa=({layerId:e})=>{const t=B(),r=l.useHandleScene(t),{Slider:o}=O(),a=ja(r,e,"point");if(!r)return null;const i=(0,u.findLayerById)(r.layers,e)?.data?.findFirst(d=>(a?.get("size",d)??0)>0)??void 0,s=a?.get("size",i)??u.DEFAULT_POINT_SIZE_PX,c=d=>{const h=new u.SetPointSizeCommand({layerId:e,size:d});t.commands.dispatch(h,{transient:!0})};return(0,n.jsx)(o,{value:s,min:Jm,max:Qm,step:eg,formatValue:Ye,onChange:c,onCommit:t.commands.commit})},tg=({title:e,layout:t="collapsible",preview:r})=>{const o=B(),a=l.useHandleScene(o),i=l.useI18n(),{Select:s,Slider:c,Switch:d,ToggleGroup:h}=O(),p=Se(a),m=(0,u.findLayerByGeom)(a?.spec.layers??[],"line","area"),g=a&&p&&m?Ht(a,p,m.id):null;if(!a||!g)return null;const f=g.missingValueOptions.map(I=>({value:I,label:Qr(i,I)})),x=[{value:"auto",label:i("editor.graphPanel.numberFormat.options.auto"),disabled:g.hasUnderlyingStrokeWidth},{value:"custom",label:i("editor.graphPanel.numberFormat.options.custom")}],b=I=>{o.commands.dispatch(new u.ToggleLinePointsCommand({layerId:g.layerId,showPoints:I}))},S=I=>{o.commands.dispatch(new u.SetLineStyleCommand({layerId:g.layerId,showFill:I,drawnFillAlpha:g.drawnFillAlpha}))},j=I=>{o.commands.dispatch(new u.SetLineCurveCommand({layerId:g.layerId,curve:I?"smooth":"linear"}))},L=I=>{o.commands.dispatch(new u.SetLineStyleCommand({layerId:g.layerId,strokeWidth:I==="custom"?g.strokeWidth:null}))},A=I=>{o.commands.dispatch(new u.SetLineStyleCommand({layerId:g.layerId,strokeWidth:I}),{transient:!0})},w=I=>{const T=bt.find(P=>P===I);T&&o.commands.dispatch(new u.SetLineMissingValuesCommand({layerId:g.layerId,missingValues:T}))};return(0,n.jsx)(z,{title:e??i("editor.fineTunePanel.lineStyleSection.title"),layout:t,preview:r,children:(0,n.jsxs)(W,{children:[(0,n.jsx)(k,{label:i("editor.graphPanel.graphOptions.showPoints"),children:(0,n.jsx)(d,{checked:g.showPoints,onChange:b})}),g.pointLayerId&&(0,n.jsx)(k,{label:i("editor.graphPanel.pointSize.label"),children:(0,n.jsx)(Pa,{layerId:g.pointLayerId})}),g.showFill!==null&&(0,n.jsx)(k,{label:i("editor.graphPanel.graphOptions.lineFill"),children:(0,n.jsx)(d,{checked:g.showFill,onChange:S})}),g.smooth!==null&&(0,n.jsx)(k,{label:i("editor.graphPanel.graphOptions.smoothLines"),children:(0,n.jsx)(d,{checked:g.smooth,onChange:j})}),(0,n.jsx)(k,{label:i("editor.graphPanel.lineThickness.label"),children:(0,n.jsx)(h,{value:g.widthMode,options:x,onChange:L})}),g.widthMode==="custom"&&(0,n.jsx)(k,{label:i("editor.graphPanel.numberFormat.valueLabel"),children:(0,n.jsx)(c,{value:g.strokeWidth,min:1,max:10,step:.1,formatValue:Ye,onChange:A,onCommit:o.commands.commit})}),g.missingValues!==null&&(0,n.jsx)(k,{label:i("editor.fineTunePanel.detailSection.missingValues"),children:(0,n.jsx)(s,{value:g.missingValues,options:f,onChange:w})})]})})},Lt="\0none",ng=["x","y","color","size","label"],rg={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"},og=({title:e,layout:t="collapsible"})=>{const r=B(),o=l.useHandleScene(r),a=l.useI18n(),{Select:i}=O(),s=a("editor.graphPanel.mappingSection.none"),c=o?.spec,d=(0,v.useMemo)(()=>c===void 0?[]:(0,u.readMappableAesthetics)(c,ng).map(({aesthetic:h,variables:p,required:m})=>{const g=(0,u.readMappedVariable)(c.mapping,h);return{aesthetic:h,label:a(rg[h]),value:g??(m?null:Lt),options:ag(p,g,m?null:s),chooseColumn:f=>{r.commands.dispatch(new u.SetMappingCommand({aesthetic:h,variable:f===Lt?null:f}))}}}),[c,a,s,r]);return o?(0,n.jsx)(z,{title:e??a("editor.graphPanel.mappingSection.title"),layout:t,children:(0,n.jsx)(W,{children:d.map(({aesthetic:h,label:p,value:m,options:g,chooseColumn:f})=>(0,n.jsx)(k,{label:p,children:(0,n.jsx)(i,{value:m,options:g,placeholder:s,onChange:f})},h))})}):null},ag=(e,t,r)=>{const o=t!==null&&!e.includes(t)?[t,...e]:e;return[...r===null?[]:[{value:Lt,label:r}],...o.map(a=>({value:a,label:a}))]},ig="k",sg=2,lg=0,cg=5,It=[{value:"k",labelKey:"thousands"},{value:"m",labelKey:"millions"},{value:"b",labelKey:"billions"}],dg=["auto","none"],ug=({title:e,layout:t="collapsible",preview:r})=>{const o=B(),a=l.useHandleScene(o),i=l.useI18n(),{NumberField:s,ToggleGroup:c}=O();if(!a)return null;const{abbreviation:d,decimals:h}=a.config.numberFormat,p=hg(d)!==void 0,m=h!=="auto",g=A=>A.map(w=>({value:w,label:i(`editor.graphPanel.numberFormat.options.${w}`)})),f=It.map(({value:A,labelKey:w})=>({value:A,label:i(`common.abbreviations.${w}`)})),x=A=>{o.commands.dispatch(new u.SetNumberFormatAbbreviationCommand({abbreviation:A}))},b=A=>{const w=dg.find(I=>I===A);x(w??ig)},S=A=>{const w=It.find(I=>I.value===A);w&&x(w.value)},j=A=>{o.commands.dispatch(new u.SetNumberFormatDecimalsCommand({decimals:A==="custom"?sg:"auto"}))},L=A=>{A!==null&&o.commands.dispatch(new u.SetNumberFormatDecimalsCommand({decimals:A}),{transient:!0})};return(0,n.jsx)(z,{title:e??i("editor.graphPanel.numberFormatSection.title"),layout:t,preview:r,children:(0,n.jsxs)(W,{children:[(0,n.jsx)(k,{label:i("editor.graphPanel.numberFormat.abbreviationLabel"),children:(0,n.jsx)(c,{value:p?"custom":d,options:g(["auto","none","custom"]),onChange:b})}),p&&(0,n.jsx)(k,{label:i("editor.graphPanel.numberFormat.valueLabel"),children:(0,n.jsx)(c,{value:d,options:f,onChange:S})}),(0,n.jsx)(k,{label:i("editor.graphPanel.numberFormat.decimalPlacesLabel"),children:(0,n.jsx)(c,{value:m?"custom":"auto",options:g(["auto","custom"]),onChange:j})}),m&&(0,n.jsx)(k,{label:i("editor.graphPanel.numberFormat.valueLabel"),children:(0,n.jsx)(s,{value:h,min:lg,max:cg,onChange:L,onCommit:o.commands.commit})})]})})},hg=e=>It.find(t=>t.value===e),pg=({title:e,layout:t="collapsible",preview:r})=>{const o=l.useHandleScene(B()),a=l.useI18n();if(!o)return null;const i=mg(o.spec.layers);return i?(0,n.jsx)(z,{title:e??a("editor.graphPanel.pointSize.label"),layout:t,preview:r,children:(0,n.jsx)(W,{children:(0,n.jsx)(k,{label:a("editor.graphPanel.numberFormat.valueLabel"),children:(0,n.jsx)(Pa,{layerId:i.id})})})}):null},mg=e=>{const t=(0,u.filterLayersByGeoms)(e,"line","area");return(0,u.filterLayersByGeoms)(e,"point").find(r=>!(0,u.isCompanionLayer)(r,t))},gg=.9,vg=360,xg=.05,fg=15,bg=({title:e,layout:t="collapsible",preview:r})=>{const o=B(),a=l.useHandleScene(o),i=l.useI18n(),{Slider:s}=O();if(!a||a.spec.coords.coordType!=="polar")return null;const{innerRadius:c,startAngle:d}=a.spec.coords.params,h=m=>{o.commands.dispatch(new u.SetPolarInnerRadiusCommand({innerRadius:m}),{transient:!0})},p=m=>{o.commands.dispatch(new u.SetPolarStartAngleCommand({startAngle:m}),{transient:!0})};return(0,n.jsx)(z,{title:e??i("editor.graphPanel.polarSection.title"),layout:t,preview:r,children:(0,n.jsxs)(W,{children:[(0,n.jsx)(k,{label:i("editor.graphPanel.polarSection.innerRadius"),children:(0,n.jsx)(s,{value:c,min:0,max:gg,step:xg,formatValue:Aa,onChange:h,onCommit:o.commands.commit})}),(0,n.jsx)(k,{label:i("editor.graphPanel.polarSection.startAngle"),children:(0,n.jsx)(s,{value:d,min:0,max:vg-1,step:fg,formatValue:xm,onChange:p,onCommit:o.commands.commit})})]})})},Sg=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"})]}),rr=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"})]}),or=["linear","exponential","quadratic","polynomial","logarithmic","power","loess"],yg="linear",Cg=({title:e,layout:t="collapsible",preview:r})=>{const o=B(),a=l.useHandleScene(o),i=l.useI18n(),{Select:s,Switch:c}=O(),{options:d,findValue:h}=Wt(a);if(!a||a.coordSystem.type==="polar")return null;const p=(0,u.findTrendLineLayer)(a.spec.layers),m=(0,u.findAverageLineLayer)(a.spec.layers),g=p?.stat.type==="smooth"?p.stat.method:yg,f=jg(m),x=or.map(w=>({value:w,label:i(`editor.annotationsPanel.trendType.options.${w}`)})),b=(w,I={})=>{const T=p??m,P=new u.SetStatLineCommand({line:w,...I,...T!==void 0&&{layerId:T.id},label:i("editor.annotationsPanel.trendsAndAveragesSection.average")});o.commands.dispatch(P)},S=w=>b(w?"trend":"none",{method:g}),j=w=>b(w?"average":"none",{group:f??h(d[0]?.value??"")}),L=w=>{const I=or.find(T=>T===w);I!==void 0&&b("trend",{method:I})},A=w=>{const I=w===null?void 0:h(w);I!==void 0&&b("average",{group:I})};return(0,n.jsx)(z,{title:e??i("editor.annotationsPanel.trendsAndAveragesSection.title"),layout:t,preview:r??(0,n.jsx)(rr,{size:"lg"}),children:(0,n.jsxs)(W,{children:[(0,n.jsx)(k,{label:i("editor.annotationsPanel.trendsAndAveragesSection.trend"),icon:(0,n.jsx)(rr,{size:"lg"}),children:(0,n.jsx)(c,{checked:p!==void 0,onChange:S})}),p!==void 0&&(0,n.jsx)(k,{label:i("editor.annotationsPanel.trendType.label"),children:(0,n.jsx)(s,{value:g,options:x,onChange:L,placeholder:i("editor.annotationsPanel.trendType.placeholder")})}),(0,n.jsx)(k,{label:i("editor.annotationsPanel.trendsAndAveragesSection.average"),icon:(0,n.jsx)(Sg,{size:"lg"}),children:(0,n.jsx)(c,{checked:m!==void 0,onChange:j})}),m!==void 0&&d.length>0&&(0,n.jsx)(k,{label:i("editor.annotationsPanel.averageLineSeries.label"),children:(0,n.jsx)(s,{value:f===void 0?null:String(f),options:d,onChange:A,placeholder:i("editor.annotationsPanel.averageLineSeries.placeholder"),ariaLabel:i("editor.annotationsPanel.averageLineSeries.ariaLabel")})})]})})},jg=e=>{const t=e?.transforms.find(r=>r.transformType==="filter")?.options.value;return t instanceof Date?t.getTime():t};exports.AppearanceSection=Sm;exports.AxesPanel=vm;exports.AxisSection=kt;exports.BarSection=Cm;exports.Button=fr;exports.CalloutsSection=Om;exports.CaptionSection=Sa;exports.ColorSwatches=vr;exports.ComboSection=Nm;exports.ControlRegistryProvider=_r;exports.ControlTooltip=Ue;exports.CustomColor=Cr;exports.EditableGraphRenderer=G1;exports.EditorPanel=Yt;exports.ElementsPanel=gm;exports.GoalSection=Bm;exports.GraphOptionsSection=Gm;exports.GraphTypeSection=Vm;exports.GridSection=Wm;exports.HeadlineSection=Km;exports.IntlProvider=Rt;exports.LegendSection=Ym;exports.LineSection=tg;exports.MappingSection=og;exports.NumberField=Tr;exports.NumberFormatSection=ug;exports.PANEL_ROOT_ATTRIBUTE=xa;exports.PointSection=pg;exports.PolarSection=bg;exports.RadioGrid=Pr;exports.Row=k;exports.Section=z;exports.Select=Ir;exports.Separator=Q1;exports.Slider=Er;exports.SourceSection=ya;exports.SubtitleSection=Ca;exports.Switch=Mr;exports.TextField=Rr;exports.TextSizeSection=wa;exports.TitleSection=Ta;exports.ToggleGroup=Ft;exports.ToggledSection=ba;exports.TrendsAndAveragesSection=Cg;exports.useControls=O;exports.usePanelExpansion=va;exports.usePanelGraph=B;