diff --git a/assets/index-9b775582.js b/assets/index-b3bdfabd.js similarity index 99% rename from assets/index-9b775582.js rename to assets/index-b3bdfabd.js index 6b25801..1b682cd 100644 --- a/assets/index-9b775582.js +++ b/assets/index-b3bdfabd.js @@ -953,7 +953,7 @@ void main() { `+ye+"]":"[ "+ve.join(", ")+" ]":"["+ve.join(",")+"]",gap=ye,me}if(rep&&typeof rep=="object")for(ge=rep.length,ue=0;uece?`{ `+gap+ve.join(`, `+gap)+` -`+ye+"}":"{ "+ve.join(", ")+" }":"{"+ve.join(",")+"}",gap=ye,me}}function beautify(ne,oe,ce,ue){var pe;if(gap="",indent="",ue||(ue=0),typeof ue!="number")throw new Error("beaufifier: limit must be a number");if(typeof ce=="number")for(pe=0;pe+pe);return ue<-2||ue>4?jsxRuntimeExports.jsxs("span",{children:[ce,"x10",jsxRuntimeExports.jsx("sup",{style:supProps,children:ue})]}):lodashExports$1.round(ne,2)}else return ne;case"string":return`${ne}`;case"undefined":return"null";default:return oe?jsxRuntimeExports.jsx("code",{children:lodashExports$1.isNull(ne)?"null":lodashExports$1.get(ne,"constructor.name")??typeof ne}):jsxRuntimeExports.jsx("code",{style:{whiteSpace:"pre"},children:lodashExports$1.truncate(beautify$1(ne,void 0,2),{length:100})})}}function Property({label:ne,value:oe,type:ce,simple:ue}){return jsxRuntimeExports.jsxs(Flex,{width:"auto",mr:2,mb:.5,alignItems:"baseline",children:[jsxRuntimeExports.jsx(Type$2,{component:"div",variant:"body2",...ce,sx:{opacity:.54,...ce==null?void 0:ce.sx},children:ne}),jsxRuntimeExports.jsx(Space,{}),jsxRuntimeExports.jsx(Type$2,{component:"div",variant:"body2",...ce,children:renderProperty(oe,ue)??"none"})]},`${ne}::${renderProperty(oe)}`)}const COMMON_PROPS=["type"],OMIT_PROPS=[...COMMON_PROPS,"id"],ESSENTIAL_PROPS=["id"],GRAPH_PROPS=[...ESSENTIAL_PROPS,"pId"],HEURISTIC_PROPS=["f","g"],ALL_PROPS=[...OMIT_PROPS,...GRAPH_PROPS,...HEURISTIC_PROPS],sortEventKeys=ne=>lodashExports$1.chain(ne).entries().filter(([,oe])=>!lodashExports$1.isUndefined(oe)).sortBy(([oe])=>lodashExports$1.indexOf(ALL_PROPS,oe)+1||Number.MAX_SAFE_INTEGER).value();function PropertyDialog({event:ne,max:oe=10,simple:ce,variant:ue,...pe}){const me=sortEventKeys(ne);return jsxRuntimeExports.jsx(ManagedModal,{...lodashExports$1.merge({appBar:{children:jsxRuntimeExports.jsx(AppBarTitle,{children:"Event Properties"})},trigger:ge=>jsxRuntimeExports.jsxs(Button$2,{variant:"text",sx:{mx:-1,minWidth:0,width:"fit-content",color:ye=>ye.palette.text.secondary,justifyContent:"left"},onClick:ye=>{ye.stopPropagation(),ye.preventDefault(),ge(ye)},children:[me.length-oe," more"]})},pe),children:[{name:"common",props:lodashExports$1.filter(me,([ge])=>COMMON_PROPS.includes(ge))},{name:"Graph",props:lodashExports$1.filter(me,([ge])=>GRAPH_PROPS.includes(ge))},{name:"Heuristic",props:lodashExports$1.filter(me,([ge])=>HEURISTIC_PROPS.includes(ge))},{name:"other",props:lodashExports$1.filter(me,([ge])=>!ALL_PROPS.includes(ge))}].map(({name:ge,props:ye},ve)=>jsxRuntimeExports.jsxs(reactExports.Fragment,{children:[!!ve&&jsxRuntimeExports.jsx(Divider$1,{sx:{mb:1}}),jsxRuntimeExports.jsx(Type$2,{component:"div",variant:"overline",color:"text.secondary",sx:{px:3},children:lodashExports$1.startCase(ge)}),jsxRuntimeExports.jsx(Box$1,{sx:{p:1,pt:0,display:"grid",gridAutoFlow:"row",gridTemplateColumns:"repeat(2, 1fr)"},children:lodashExports$1.map(ye,([xe,_e])=>jsxRuntimeExports.jsx(ListItem$1,{sx:{py:.5},children:jsxRuntimeExports.jsx(ListItemText$1,{secondary:xe,primary:renderProperty(_e)})},`${xe}::${_e}`))},ge)]},ge))})}function PropertyList(ne){const{event:oe,variant:ce="body2",max:ue=10,simple:pe,primitives:me,...ge}=ne,ye=sortEventKeys(oe);return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsxs(Flex,{...ge,children:[lodashExports$1.chain(ye).filter(me?([,ve])=>isPrimitive(ve):lodashExports$1.constant(!0)).slice(0,ue).map(([ve,xe],_e)=>jsxRuntimeExports.jsx(Property,{label:ve,value:xe,type:{variant:ce},simple:pe},_e)).value(),ye.length>ue&&!pe&&jsxRuntimeExports.jsx(PropertyDialog,{...ne})]})})}function isPrimitive(ne){return lodashExports$1.isString(ne)||lodashExports$1.isNumber(ne)}var t$5,e$4,s$2,i$5;(function(ne){ne.HEX="HEX",ne.RGB="RGB",ne.HSL="HSL",ne.CIELab="CIELab",ne.CMYK="CMYK"})(t$5||(t$5={})),function(ne){ne.ANALOGOUS="ANALOGOUS",ne.COMPLEMENTARY="COMPLEMENTARY",ne.SPLIT_COMPLEMENTARY="SPLIT_COMPLEMENTARY",ne.TRIADIC="TRIADIC",ne.TETRADIC="TETRADIC",ne.SQUARE="SQUARE"}(e$4||(e$4={})),function(ne){ne.ADDITIVE="ADDITIVE",ne.SUBTRACTIVE="SUBTRACTIVE"}(s$2||(s$2={})),function(ne){ne.black="#000000",ne.silver="#C0C0C0",ne.gray="#808080",ne.white="#FFFFFF",ne.maroon="#800000",ne.red="#FF0000",ne.purple="#800080",ne.fuchsia="#FF00FF",ne.green="#008000",ne.lime="#00FF00",ne.olive="#808000",ne.yellow="#FFFF00",ne.navy="#000080",ne.blue="#0000FF",ne.teal="#008080",ne.aqua="#00FFFF",ne.orange="#FFA500",ne.aliceblue="#F0F8FF",ne.antiquewhite="#FAEBD7",ne.aquamarine="#7FFFD4",ne.azure="#F0FFFF",ne.beige="#F5F5DC",ne.bisque="#FFE4C4",ne.blanchedalmond="#FFEBCD",ne.blueviolet="#8A2BE2",ne.brown="#A52A2A",ne.burlywood="#DEB887",ne.cadetblue="#5F9EA0",ne.chartreuse="#7FFF00",ne.chocolate="#D2691E",ne.coral="#FF7F50",ne.cornflowerblue="#6495ED",ne.cornsilk="#FFF8DC",ne.crimson="#DC143C",ne.cyan="#00FFFF",ne.darkblue="#00008B",ne.darkcyan="#008B8B",ne.darkgoldenrod="#B8860B",ne.darkgray="#A9A9A9",ne.darkgreen="#006400",ne.darkgrey="#A9A9A9",ne.darkkhaki="#BDB76B",ne.darkmagenta="#8B008B",ne.darkolivegreen="#556B2F",ne.darkorange="#FF8C00",ne.darkorchid="#9932CC",ne.darkred="#8B0000",ne.darksalmon="#E9967A",ne.darkseagreen="#8FBC8F",ne.darkslateblue="#483D8B",ne.darkslategray="#2F4F4F",ne.darkslategrey="#2F4F4F",ne.darkturquoise="#00CED1",ne.darkviolet="#9400D3",ne.deeppink="#FF1493",ne.deepskyblue="#00BFFF",ne.dimgray="#696969",ne.dimgrey="#696969",ne.dodgerblue="#1E90FF",ne.firebrick="#B22222",ne.floralwhite="#FFFAF0",ne.forestgreen="#228B22",ne.gainsboro="#DCDCDC",ne.ghostwhite="#F8F8FF",ne.gold="#FFD700",ne.goldenrod="#DAA520",ne.greenyellow="#ADFF2F",ne.grey="#808080",ne.honeydew="#F0FFF0",ne.hotpink="#FF69B4",ne.indianred="#CD5C5C",ne.indigo="#4B0082",ne.ivory="#FFFFF0",ne.khaki="#F0E68C",ne.lavender="#E6E6FA",ne.lavenderblush="#FFF0F5",ne.lawngreen="#7CFC00",ne.lemonchiffon="#FFFACD",ne.lightblue="#ADD8E6",ne.lightcoral="#F08080",ne.lightcyan="#E0FFFF",ne.lightgoldenrodyellow="#FAFAD2",ne.lightgray="#D3D3D3",ne.lightgreen="#90EE90",ne.lightgrey="#D3D3D3",ne.lightpink="#FFB6C1",ne.lightsalmon="#FFA07A",ne.lightseagreen="#20B2AA",ne.lightskyblue="#87CEFA",ne.lightslategray="#778899",ne.lightslategrey="#778899",ne.lightsteelblue="#B0C4DE",ne.lightyellow="#FFFFE0",ne.limegreen="#32CD32",ne.linen="#FAF0E6",ne.magenta="#FF00FF",ne.mediumaquamarine="#66CDAA",ne.mediumblue="#0000CD",ne.mediumorchid="#BA55D3",ne.mediumpurple="#9370DB",ne.mediumseagreen="#3CB371",ne.mediumslateblue="#7B68EE",ne.mediumspringgreen="#00FA9A",ne.mediumturquoise="#48D1CC",ne.mediumvioletred="#C71585",ne.midnightblue="#191970",ne.mintcream="#F5FFFA",ne.mistyrose="#FFE4E1",ne.moccasin="#FFE4B5",ne.navajowhite="#FFDEAD",ne.oldlace="#FDF5E6",ne.olivedrab="#6B8E23",ne.orangered="#FF4500",ne.orchid="#DA70D6",ne.palegoldenrod="#EEE8AA",ne.palegreen="#98FB98",ne.paleturquoise="#AFEEEE",ne.palevioletred="#DB7093",ne.papayawhip="#FFEFD5",ne.peachpuff="#FFDAB9",ne.peru="#CD853F",ne.pink="#FFC0CB",ne.plum="#DDA0DD",ne.powderblue="#B0E0E6",ne.rosybrown="#BC8F8F",ne.royalblue="#4169E1",ne.saddlebrown="#8B4513",ne.salmon="#FA8072",ne.sandybrown="#F4A460",ne.seagreen="#2E8B57",ne.seashell="#FFF5EE",ne.sienna="#A0522D",ne.skyblue="#87CEEB",ne.slateblue="#6A5ACD",ne.slategray="#708090",ne.slategrey="#708090",ne.snow="#FFFAFA",ne.springgreen="#00FF7F",ne.steelblue="#4682B4",ne.tan="#D2B48C",ne.thistle="#D8BFD8",ne.tomato="#FF6347",ne.turquoise="#40E0D0",ne.violet="#EE82EE",ne.wheat="#F5DEB3",ne.whitesmoke="#F5F5F5",ne.yellowgreen="#9ACD32",ne.rebeccapurple="#663399"}(i$5||(i$5={}));const a$3=Object.keys(i$5),r$4={HEX:["R","G","B","A"],RGB:["R","G","B","A"],HSL:["H","S","L","A"],CIELab:["L","a","b","A"],CMYK:["C","M","Y","K","A"]},n$5={BGR:t$5.RGB,ABGR:t$5.RGB,HLS:t$5.HSL,AHLS:t$5.HSL,LAB:t$5.CIELab,ALAB:t$5.CIELab,CKMY:t$5.CMYK,ACKMY:t$5.CMYK};var c$3;(function(ne){ne.NUMBER="number",ne.BOOLEAN="boolean"})(c$3||(c$3={}));const o$3={[t$5.HEX]:/^#(?:([a-f\d])([a-f\d])([a-f\d])([a-f\d])?|([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?)$/i,[t$5.RGB]:/^rgba?\s*\(\s*(?:((?:\d*\.)?\d+%?)\s*,\s*((?:\d*\.)?\d+%?)\s*,\s*((?:\d*\.)?\d+%?)(?:\s*,\s*((?:\d*\.)?\d+))?|((?:\d*\.)?\d+%?)\s*((?:\d*\.)?\d+%?)\s*((?:\d*\.)?\d+%?)(?:\s*\/\s*((?:\d*\.)?\d+%?))?)\s*\)$/,[t$5.HSL]:/^hsla?\s*\(\s*(?:(-?(?:\d*\.)?\d+(?:deg|grad|rad|turn)?)\s*,\s*((?:\d*\.)?\d+)%\s*,\s*((?:\d*\.)?\d+)%(?:\s*,\s*((?:\d*\.)?\d+))?|(-?(?:\d*\.)?\d+(?:deg|grad|rad|turn)?)\s*((?:\d*\.)?\d+)%\s*((?:\d*\.)?\d+)%(?:\s*\/\s*((?:\d*\.)?\d+%?))?)\s*\)$/,[t$5.CIELab]:/^lab\s*\(\s*(?:((?:\d*\.)?\d+%?)\s*(-?(?:\d*\.)?\d+%?)\s*(-?(?:\d*\.)?\d+%?)(?:\s*\/\s*((?:\d*\.)?\d+%?))?)\s*\)$/,[t$5.CMYK]:/^(?:device-cmyk|cmyk)\s*\(\s*(?:((?:\d*\.)?\d+%?)\s*,\s*((?:\d*\.)?\d+%?)\s*,\s*((?:\d*\.)?\d+%?)\s*,\s*((?:\d*\.)?\d+%?)(?:\s*,\s*((?:\d*\.)?\d+))?|((?:\d*\.)?\d+%?)\s*((?:\d*\.)?\d+%?)\s*((?:\d*\.)?\d+%?)\s*((?:\d*\.)?\d+%?)(?:\s*\/\s*((?:\d*\.)?\d+%?))?)\s*\)$/},A$3=/^(-?(?:\d*\.)?\d+)((?:deg|grad|rad|turn)?)$/,h$6=/^(-?\d+(?:\.\d+)?|-?\.\d+)%$/,u$5=/^0x([a-f\d]{1,2})$/i,d$5=/\{(\d+)\}/g,l$5=/,( +|\d+)/g,E$2=/ +/,m$4="The provided string color doesn't have a correct format",b$4="The provided color object doesn't have the proper keys or format";var C$2,L$2,g$4;(function(ne){ne.NONE="none",ne.DEGREES="deg",ne.GRADIANS="grad",ne.RADIANS="rad",ne.TURNS="turn"})(C$2||(C$2={})),function(ne){ne.NONE="none",ne.PERCENT="percent"}(L$2||(L$2={})),function(ne){ne.DEVICE_CMYK="device-cmyk",ne.CMYK="cmyk"}(g$4||(g$4={}));const B$2={decimals:6,legacyCSS:!1,spacesAfterCommas:!1,anglesUnit:C$2.NONE,rgbUnit:L$2.NONE,labUnit:L$2.NONE,cmykUnit:L$2.PERCENT,alphaUnit:L$2.NONE,cmykFunction:g$4.DEVICE_CMYK},p$5=(ne,oe)=>Object.prototype.hasOwnProperty.call(ne,oe),H$4=ne=>+`${ne}`.replace(h$6,"$1"),F$2=ne=>h$6.test(`${ne}`)?H$4(ne):Math.min(+ne,100),R$2=ne=>(ne.length===1&&(ne+=ne),parseInt(ne,16)),S$3=ne=>{const oe=D$3(ne,0).toString(16).toUpperCase();return oe.length===1?`0x0${oe}`:`0x${oe}`},I$2=(ne,oe=!1)=>!oe&&h$6.test(ne)?Math.min(255*H$4(ne)/100,255):u$5.test(ne)?(ne.length===3&&(ne+=ne.slice(-1)),oe?D$3(ne)/255:D$3(ne)):Math.min(+ne,oe?1:255),G$2=ne=>h$6.test(ne)?f$4(125*H$4(ne)/100,-125,125):f$4(+ne,-125,125),M$3=ne=>Math.min(h$6.test(ne)?H$4(ne)/100:+ne,1),y$2=ne=>[...ne].sort().join("").toUpperCase(),D$3=(ne,oe=6)=>{const ce=Math.pow(10,oe);return Math.round(+ne*ce)/ce},f$4=(ne,oe,ce)=>Math.max(oe,Math.min(ne,ce)),O$1=ne=>{if(typeof ne=="string"){const oe=ne.match(A$3),ce=+oe[1];switch(oe[2]){case C$2.RADIANS:ne=D$3(180*ce/Math.PI);break;case C$2.TURNS:ne=D$3(360*ce);break;case C$2.GRADIANS:ne=D$3(.9*ce);break;case C$2.DEGREES:default:ne=ce}}return(ne>360||ne<0)&&(ne-=360*Math.floor(ne/360)),ne},Y$3=(ne,oe)=>{let ce;switch(oe){case C$2.RADIANS:ce=D$3((ue=>ue*Math.PI/180)(ne));break;case C$2.TURNS:ce=D$3(ne/360);break;case C$2.GRADIANS:ce=D$3(10/9*ne);break;case C$2.DEGREES:case C$2.NONE:default:ce=ne}return ce},k$6=(ne,...oe)=>{const ce=[],ue=[],pe=[],me=[],ge=[],ye=[],ve=Object.values(C$2),xe=Object.values(L$2),_e=Object.values(g$4),Se={legacyCSS:0,spacesAfterCommas:0,cmykFunction:0};for(const $e of oe)if(typeof $e=="string"){if(ce.push($e),$e.includes(",")){Se.legacyCSS++;const Re=$e.match(l$5);new Set(Re).size===1&&E$2.test(Re[0].slice(1))&&Se.spacesAfterCommas++}if($e.match(o$3.HSL)){const Re=$e.match(o$3.HSL),Ae=Re[1]||Re[5],Ie=Re[8],ke=Ae.match(A$3)[2];ue.push(ke===""?C$2.NONE:ke),ye.push(h$6.test(Ie));continue}if(o$3.RGB.test($e)){const Re=$e.match(o$3.RGB),Ae=Re[1]||Re[5],Ie=Re[2]||Re[6],ke=Re[3]||Re[7],Be=Re[8];pe.push(h$6.test(Ae)&&h$6.test(Ie)&&h$6.test(ke)),ye.push(h$6.test(Be));continue}if(o$3.CIELab.test($e)){const Re=$e.match(o$3.CIELab),Ae=Re[1],Ie=Re[2],ke=Re[3],Be=Re[4];me.push(h$6.test(Ae)&&h$6.test(Ie)&&h$6.test(ke)),ye.push(h$6.test(Be));continue}if($e.match(o$3.CMYK)){const Re=$e.match(o$3.CMYK),Ae=Re[1]||Re[6],Ie=Re[2]||Re[7],ke=Re[3]||Re[8],Be=Re[4]||Re[9],Ne=Re[10];ge.push(h$6.test(Ae)&&h$6.test(Ie)&&h$6.test(ke)&&h$6.test(Be)),$e.startsWith("cmyk")&&Se.cmykFunction++,ye.push(h$6.test(Ne))}}return{decimals:typeof ne.decimals===c$3.NUMBER?ne.decimals:B$2.decimals,legacyCSS:typeof ne.legacyCSS===c$3.BOOLEAN?ne.legacyCSS:!!(ce.length&&Se.legacyCSS===ce.length)||B$2.legacyCSS,spacesAfterCommas:typeof ne.spacesAfterCommas===c$3.BOOLEAN?ne.spacesAfterCommas:!!(ce.length&&Se.spacesAfterCommas===ce.length)||B$2.spacesAfterCommas,anglesUnit:ne.anglesUnit&&ve.includes(ne.anglesUnit)?ne.anglesUnit:new Set(ue).size===1?ue[0]:B$2.anglesUnit,rgbUnit:ne.rgbUnit&&xe.includes(ne.rgbUnit)?ne.rgbUnit:new Set(pe).size===1&&pe[0]?L$2.PERCENT:B$2.rgbUnit,labUnit:ne.labUnit&&xe.includes(ne.labUnit)?ne.labUnit:new Set(me).size===1&&me[0]?L$2.PERCENT:B$2.labUnit,cmykUnit:ne.cmykUnit&&xe.includes(ne.cmykUnit)?ne.cmykUnit:new Set(ge).size!==1||ge[0]?B$2.cmykUnit:L$2.NONE,alphaUnit:ne.alphaUnit&&xe.includes(ne.alphaUnit)?ne.alphaUnit:new Set(ye).size===1&&ye[0]?L$2.PERCENT:B$2.alphaUnit,cmykFunction:ne.cmykFunction&&_e.includes(ne.cmykFunction)?ne.cmykFunction:ge.length&&ge.length===Se.cmykFunction?g$4.CMYK:B$2.cmykFunction}},K$2=ne=>`${ne}`in s$2,X$2=[[.4360747,.3850649,.1430804],[.2225045,.7168786,.0606169],[.0139322,.0971045,.7141733]],T$2=[[3.1338561,-1.6168667,-.4906146],[-.9787684,1.9161415,.033454],[.0719453,-.2289914,1.4052427]],N$3=X$2.map(ne=>ne.reduce((oe,ce)=>oe+ce,0)),$$4=(ne,oe,ce)=>(ce<0&&(ce+=6),ce>=6&&(ce-=6),D$3(ce<1?255*((oe-ne)*ce+ne):ce<3?255*oe:ce<4?255*((oe-ne)*(4-ce)+ne):255*ne)),j$3=ne=>ne<=.04045?ne/12.92:((ne+.055)/1.055)**2.4,U$2=ne=>ne<=.0031308?12.92*ne:1.055*ne**(1/2.4)-.055,w$4=(ne,oe,ce,ue)=>{const pe=[0,0,0],me=[ne,oe,ce];return ue.forEach((ge,ye)=>{ge.forEach((ve,xe)=>{pe[ye]+=ve*me[xe]})}),pe},x$2=(ne,oe,ce)=>{oe/=100;const ue=(ce/=100)<=.5?ce*(oe+1):ce+oe-ce*oe,pe=2*ce-ue;return{R:$$4(pe,ue,(ne/=60)+2),G:$$4(pe,ue,ne),B:$$4(pe,ue,ne-2)}},v$5=(ne,oe,ce,ue=1)=>{ne/=255,oe/=255,ce/=255,ue=Math.min(ue,1);const pe=Math.max(ne,oe,ce),me=Math.min(ne,oe,ce),ge=pe-me;let ye=0,ve=0;const xe=(pe+me)/2;if(ge!==0){switch(pe){case ne:ye=(oe-ce)/ge%6;break;case oe:ye=(ce-ne)/ge+2;break;case ce:ye=(ne-oe)/ge+4}ye=D$3(60*ye),ye<0&&(ye+=360),ve=ge/(1-Math.abs(2*xe-1))}return{H:ye,S:D$3(100*ve),L:D$3(100*xe),A:ue}},V$2=(ne,oe,ce)=>{const ue=[ne/255,oe/255,ce/255].map(j$3),pe=w$4(ue[0],ue[1],ue[2],X$2),me=((ge,ye,ve)=>{const xe=$e=>$e>.008856451679035631?Math.cbrt($e):$e/.12841854934601665+.13793103448275862,_e=xe(ge/N$3[0]),Se=xe(ye/N$3[1]);return[116*Se-16,500*(_e-Se),200*(Se-xe(ve/N$3[2]))]})(pe[0],pe[1],pe[2]);return{L:me[0],a:me[1],b:me[2]}},P$1=(ne,oe,ce)=>{const ue=((me,ge,ye)=>{const ve=$e=>$e>.20689655172413793?$e**3:.12841854934601665*($e-.13793103448275862),xe=(me+16)/116,_e=ge/500,Se=ye/200;return[N$3[0]*ve(xe+_e),N$3[1]*ve(xe),N$3[2]*ve(xe-Se)]})(ne,oe,ce),pe=w$4(ue[0],ue[1],ue[2],T$2).map(U$2);return{R:f$4(255*pe[0],0,255),G:f$4(255*pe[1],0,255),B:f$4(255*pe[2],0,255)}},q$5=(ne,oe,ce,ue)=>({R:D$3(255*(1-ne)*(ue=1-ue)),G:D$3(255*(1-oe)*ue),B:D$3(255*(1-ce)*ue)}),_$3=(ne,oe,ce)=>{ne/=255,oe/=255,ce/=255;const ue=1-Math.max(ne,oe,ce),pe=1-ue,me=pe&&(pe-oe)/pe,ge=pe&&(pe-ce)/pe;return{C:D$3(100*(pe&&(pe-ne)/pe)),M:D$3(100*me),Y:D$3(100*ge),K:D$3(100*ue)}},z$3=(ne,oe)=>{if(ne<0&&(ne+=360),ne>360&&(ne-=360),ne===360||ne===0)return ne;const ce=[[0,120],[120,180],[180,240],[240,360]],ue=[[0,60],[60,120],[120,240],[240,360]],pe=oe?ue:ce;let me=0,ge=0,ye=0,ve=0;return(oe?ce:ue).find((xe,_e)=>ne>=xe[0]&&nene?", ":",",W$2=(ne,oe)=>{const ce=y$2(Object.keys(ne));return r$4[n$5[ce]].reduce((ue,pe,me)=>{const ge=ne[pe];return ge!==void 0&&ue.push(oe(ge,me)),ue},[])},J$2=(ne,oe)=>ne.replace(d$5,(ce,ue)=>`${oe[+ue-1]}`),Z$3=(ne,oe,ce=!1)=>{const{alphaUnit:ue,legacyCSS:pe,decimals:me}=oe;return ue!==L$2.PERCENT||pe&&!ce?D$3(ne,me):`${D$3(100*ne,me)}%`},tt$2={[t$5.HEX]:ne=>{const oe=W$2(ne,ue=>(pe=>{let me=D$3(pe,0).toString(16).toUpperCase();return me.length===1&&(me=`0${me}`),me})(D$3(ue))),ce=oe.length===4?"#{1}{2}{3}{4}":"#{1}{2}{3}";return J$2(ce,oe)},[t$5.RGB]:(ne,oe)=>{const{decimals:ce,legacyCSS:ue,spacesAfterCommas:pe,rgbUnit:me}=oe,ge=Q$2(pe),ye=W$2(ne,(xe,_e)=>me===L$2.PERCENT&&_e<3?`${((Se,$e)=>D$3(Se/255*100,$e))(xe,ce)}%`:_e===3?Z$3(xe,oe):D$3(xe,ce)),ve=ue?ye.length===4?`rgba({1}${ge}{2}${ge}{3}${ge}{4})`:`rgb({1}${ge}{2}${ge}{3})`:ye.length===4?"rgb({1} {2} {3} / {4})":"rgb({1} {2} {3})";return J$2(ve,ye)},[t$5.HSL]:(ne,oe)=>{const{decimals:ce,legacyCSS:ue,spacesAfterCommas:pe,anglesUnit:me}=oe,ge=Q$2(pe),ye=W$2(ne,(xe,_e)=>_e===0&&me!==C$2.NONE?`${D$3(Y$3(xe,me),ce)}${me}`:_e===3?Z$3(xe,oe):D$3(xe,ce)),ve=ue?ye.length===4?`hsla({1}${ge}{2}%${ge}{3}%${ge}{4})`:`hsl({1}${ge}{2}%${ge}{3}%)`:ye.length===4?"hsl({1} {2}% {3}% / {4})":"hsl({1} {2}% {3}%)";return J$2(ve,ye)},[t$5.CIELab]:(ne,oe)=>{const{decimals:ce,labUnit:ue}=oe,pe=W$2(ne,(ge,ye)=>{if(ye===0){const ve=D$3(F$2(ge),ce);return ue===L$2.PERCENT?`${ve}%`:`${ve}`}return ye<3?ue===L$2.PERCENT?`${((ve,xe)=>D$3(ve/125*100,xe))(ge,ce)}%`:D$3(ge,ce):Z$3(ge,oe,!0)}),me=pe.length===4?"lab({1} {2} {3} / {4})":"lab({1} {2} {3})";return J$2(me,pe)},[t$5.CMYK]:(ne,oe)=>{const{decimals:ce,legacyCSS:ue,spacesAfterCommas:pe,cmykUnit:me,cmykFunction:ge}=oe,ye=Q$2(pe),ve=W$2(ne,(_e,Se)=>me===L$2.PERCENT&&Se<4?`${D$3(_e,ce)}%`:Se===4?Z$3(_e,oe):D$3(_e/100,ce)),xe=ue?ve.length===5?`${ge}({1}${ye}{2}${ye}{3}${ye}{4}${ye}{5})`:`${ge}({1}${ye}{2}${ye}{3}${ye}{4})`:ve.length===5?`${ge}({1} {2} {3} {4} / {5})`:`${ge}({1} {2} {3} {4})`;return J$2(xe,ve)}},et$2=ne=>(typeof ne=="string"&&(ne=h$6.test(ne)?H$4(ne)/100:+ne),isNaN(+ne)||ne>1?1:D$3(ne)),st$1=(ne,oe,ce)=>oe.reduce((ue,pe)=>[...ue,{...ne,H:ce===s$2.ADDITIVE?O$1(ne.H+pe):O$1(z$3(z$3(ne.H,!1)+pe,!0))}],[{...ne}]),it$1=(ne,oe)=>st$1(ne,[30,-30],oe),at$1=(ne,oe)=>st$1(ne,[180],oe),rt$1=(ne,oe)=>st$1(ne,[150,-150],oe),nt$1=(ne,oe)=>st$1(ne,[120,-120],oe),ct$1=(ne,oe)=>st$1(ne,[60,-120,180],oe),ot$1=(ne,oe)=>st$1(ne,[90,-90,180],oe),At=ne=>typeof ne=="string"?(oe=>{let ce;if(Object.keys(t$5).some(ue=>{if(o$3[ue].test(oe))return ce=ue,!0}),!ce&&~a$3.indexOf(oe)&&(ce=t$5.HEX),!ce)throw new Error(m$4);return ce})(ne):(oe=>{let ce,ue=!1;const pe=y$2(Object.keys(oe));if(n$5[pe]&&(ce=n$5[pe]),ce&&ce===t$5.RGB){const me=Object.entries(oe).some(ye=>!u$5.test(`${ye[1]}`)),ge=Object.entries(oe).some(ye=>!(h$6.test(`${ye[1]}`)||!u$5.test(`${ye[1]}`)&&!isNaN(+ye[1])&&+ye[1]<=255));me&&ge&&(ue=!0),me||(ce=t$5.HEX)}if(!ce||ue)throw new Error(b$4);return ce})(ne),ht$1={[t$5.HEX](ne){const oe=(~a$3.indexOf(ne)?i$5[ne]:ne).match(o$3.HEX),ce={R:R$2(oe[1]||oe[5]),G:R$2(oe[2]||oe[6]),B:R$2(oe[3]||oe[7])},ue=oe[4]||oe[8];return ue!==void 0&&(ce.A=R$2(ue)/255),ce},[t$5.RGB](ne){const oe=ne.match(o$3.RGB),ce=I$2(oe[1]||oe[5]),ue=I$2(oe[2]||oe[6]),pe=I$2(oe[3]||oe[7]),me=oe[4]||oe[8],ge={R:Math.min(ce,255),G:Math.min(ue,255),B:Math.min(pe,255)};return me!==void 0&&(ge.A=et$2(me)),ge},[t$5.HSL](ne){const oe=ne.match(o$3.HSL),ce=O$1(oe[1]||oe[5]),ue=F$2(oe[2]||oe[6]),pe=F$2(oe[3]||oe[7]),me=oe[4]||oe[8],ge=x$2(ce,ue,pe);return me!==void 0&&(ge.A=et$2(me)),ge},[t$5.CIELab](ne){const oe=ne.match(o$3.CIELab),ce=F$2(oe[1]),ue=G$2(oe[2]),pe=G$2(oe[3]),me=oe[4],ge=P$1(ce,ue,pe);return me!==void 0&&(ge.A=et$2(me)),ge},[t$5.CMYK](ne){const oe=ne.match(o$3.CMYK),ce=M$3(oe[1]||oe[6]),ue=M$3(oe[2]||oe[7]),pe=M$3(oe[3]||oe[8]),me=M$3(oe[4]||oe[9]),ge=oe[5]||oe[10],ye=q$5(ce,ue,pe,me);return ge!==void 0&&(ye.A=et$2(ge)),ye}},ut$1={[t$5.HEX](ne){const oe={R:I$2(`${ne.R}`),G:I$2(`${ne.G}`),B:I$2(`${ne.B}`)};return p$5(ne,"A")&&(oe.A=Math.min(I$2(`${ne.A}`,!0),1)),oe},[t$5.RGB](ne){return this.HEX(ne)},[t$5.HSL](ne){const oe=F$2(`${ne.S}`),ce=F$2(`${ne.L}`),ue=x$2(O$1(ne.H),oe,ce);return p$5(ne,"A")&&(ue.A=et$2(ne.A)),ue},[t$5.CIELab](ne){const oe=F$2(`${ne.L}`),ce=G$2(`${ne.a}`),ue=G$2(`${ne.b}`),pe=P$1(oe,ce,ue);return p$5(ne,"A")&&(pe.A=et$2(ne.A)),pe},[t$5.CMYK](ne){const oe=M$3(`${ne.C}`),ce=M$3(`${ne.M}`),ue=M$3(`${ne.Y}`),pe=M$3(`${ne.K}`),me=q$5(oe,ce,ue,pe);return p$5(ne,"A")&&(me.A=et$2(ne.A)),me}},dt$1=(ne,oe=At(ne))=>typeof ne=="string"?ht$1[oe](ne):ut$1[oe](ne),lt={[t$5.HEX]:ne=>({R:S$3(ne.R),G:S$3(ne.G),B:S$3(ne.B)}),HEXA(ne){const oe=lt.HEX(ne);return oe.A=p$5(ne,"A")?S$3(255*ne.A):"0xFF",oe},[t$5.RGB](ne,oe){const ce=Ct(ne,oe);return p$5(ce,"A")&&delete ce.A,ce},RGBA(ne,oe){const ce=lt.RGB(ne,oe);return ce.A=p$5(ne,"A")?D$3(ne.A):1,ce},[t$5.HSL](ne,oe){const ce=v$5(ne.R,ne.G,ne.B);return delete ce.A,Lt(ce,oe)},HSLA(ne,oe){const ce=lt.HSL(ne,oe);return ce.A=p$5(ne,"A")?D$3(ne.A,oe):1,ce},[t$5.CIELab](ne,oe){const ce=V$2(ne.R,ne.G,ne.B);return gt(ce,oe)},CIELabA(ne,oe){const ce=lt.CIELab(ne,oe);return ce.A=p$5(ne,"A")?D$3(ne.A,oe):1,ce},[t$5.CMYK]:(ne,oe)=>Bt(_$3(ne.R,ne.G,ne.B),oe),CMYKA(ne,oe){const ce=lt.CMYK(ne,oe);return ce.A=p$5(ne,"A")?D$3(ne.A,oe):1,ce}},Et=(ne,oe,ce,ue)=>{const pe=At(ne),me=typeof ne=="string",ge=dt$1(ne,pe),ye=typeof ne=="string"&&p$5(ge,"A")||typeof ne!="string"&&p$5(ne,"A"),ve=v$5(ge.R,ge.G,ge.B,ge.A);ye||delete ve.A;const xe=ce?ve.L/(oe+1):(100-ve.L)/(oe+1),_e=Array(oe).fill(null).map((Se,$e)=>({...ve,L:ve.L+xe*($e+1)*(1-2*+ce)}));switch(pe){case t$5.HEX:default:return _e.map(Se=>{const $e=x$2(Se.H,Se.S,Se.L);return ye&&($e.A=Se.A),me?ye?tt$2.HEX({...$e,A:D$3(255*$e.A)}):tt$2.HEX($e):ye?lt.HEXA($e):lt.HEX($e)});case t$5.RGB:return _e.map(Se=>{const $e=x$2(Se.H,Se.S,Se.L);return ye&&($e.A=Se.A),me?tt$2.RGB($e,ue):ye?lt.RGBA($e,ue.decimals):lt.RGB($e,ue.decimals)});case t$5.HSL:return _e.map(Se=>me?tt$2.HSL(Se,ue):ye?lt.HSLA({...x$2(Se.H,Se.S,Se.L),A:Se.A},ue.decimals):lt.HSL(x$2(Se.H,Se.S,Se.L),ue.decimals));case t$5.CIELab:return _e.map(Se=>{const $e=x$2(Se.H,Se.S,Se.L);return me?tt$2.CIELab(ye?lt.CIELabA($e,ue.decimals):lt.CIELab($e,ue.decimals),ue):ye?lt.CIELabA({...$e,A:Se.A},ue.decimals):lt.CIELab($e,ue.decimals)})}},mt={buildHarmony(ne,oe,ce,ue){const pe=At(ne),me=dt$1(ne,pe),ge=v$5(me.R,me.G,me.B,me.A),ye=typeof ne=="string"&&p$5(me,"A")||typeof ne!="string"&&p$5(ne,"A"),ve=typeof ne=="string";switch(pe){case t$5.HEX:default:return ye?this.HEXA(Lt(ge,0),oe,ce,ve):this.HEX(Lt(ge,0),oe,ce,ve);case t$5.HSL:return ye?this.HSLA(ge,oe,ce,ve,ue):this.HSL(ge,oe,ce,ve,ue);case t$5.RGB:return ye?this.RGBA(ge,oe,ce,ve,ue):this.RGB(ge,oe,ce,ve,ue);case t$5.CIELab:return ye?this.CIELabA(ge,oe,ce,ve,ue):this.CIELab(ge,oe,ce,ve,ue)}},[t$5.HEX]:(ne,oe,ce,ue)=>oe(ne,ce).map(pe=>ue?tt$2.HEX(x$2(pe.H,pe.S,pe.L)):lt.HEX(x$2(pe.H,pe.S,pe.L))),HEXA:(ne,oe,ce,ue)=>oe(ne,ce).map(pe=>ue?tt$2.HEX({...x$2(pe.H,pe.S,pe.L),A:255*et$2(pe.A)}):lt.HEXA({...x$2(pe.H,pe.S,pe.L),A:et$2(pe.A)})),[t$5.RGB]:(ne,oe,ce,ue,pe)=>oe(ne,ce).map(me=>ue?tt$2.RGB(x$2(me.H,me.S,me.L),pe):lt.RGB(x$2(me.H,me.S,me.L),pe.decimals)),RGBA:(ne,oe,ce,ue,pe)=>oe(ne,ce).map(me=>ue?tt$2.RGB({...x$2(me.H,me.S,me.L),A:et$2(me.A)},pe):lt.RGBA({...x$2(me.H,me.S,me.L),A:et$2(me.A)},pe.decimals)),[t$5.HSL]:(ne,oe,ce,ue,pe)=>oe(ne,ce).map(me=>ue?tt$2.HSL({H:me.H,S:me.S,L:me.L},pe):lt.HSL(x$2(me.H,me.S,me.L),pe.decimals)),HSLA:(ne,oe,ce,ue,pe)=>oe(ne,ce).map(me=>ue?tt$2.HSL({...me,A:et$2(me.A)},pe):lt.HSLA({...x$2(me.H,me.S,me.L),A:et$2(me.A)},pe.decimals)),[t$5.CIELab]:(ne,oe,ce,ue,pe)=>oe(ne,ce).map(me=>{const ge=x$2(me.H,me.S,me.L);return ue?tt$2.CIELab(V$2(ge.R,ge.G,ge.B),pe):lt.CIELab(ge,pe.decimals)}),CIELabA:(ne,oe,ce,ue,pe)=>oe(ne,ce).map(me=>{const ge=x$2(me.H,me.S,me.L);return ue?tt$2.CIELab({...V$2(ge.R,ge.G,ge.B),A:et$2(me.A)},pe):lt.CIELabA({...ge,A:et$2(me.A)},pe.decimals)})},bt={mix(ne,oe){const ce=ne.map(ge=>{const ye=At(ge);return dt$1(ge,ye)}),ue=oe===s$2.SUBTRACTIVE?ce.map(ge=>{const ye=((ve,xe,_e)=>{const Se=Math.min(ve,xe,_e),$e=Math.min(255-ve,255-xe,255-_e),Re=ve-Se,Ae=xe-Se,Ie=_e-Se,ke=Math.min(Re,Ae),Be=Re-ke,Ne=(Ae+ke)/2,Fe=(Ie+Ae-ke)/2,Ue=Math.max(Be,Ne,Fe)/Math.max(Re,Ae,Ie),We=isNaN(Ue)||Ue===1/0||Ue<=0?1:Ue;return{R:Be/We+$e,Y:Ne/We+$e,B:Fe/We+$e}})(ge.R,ge.G,ge.B);return p$5(ge,"A")&&(ye.A=ge.A),ye}):null;function pe(ge){const ye=oe===s$2.ADDITIVE?{R:0,G:0,B:0,A:0}:{R:0,Y:0,B:0,A:0};return ge.reduce((ve,xe)=>{const _e=p$5(xe,"A")?xe.A:1,Se={R:Math.min(ve.R+xe.R*_e,255),B:Math.min(ve.B+xe.B*_e,255),A:1-(1-_e)*(1-ve.A)},$e="G"in ve?ve.G:ve.Y,Re="G"in xe?xe.G:xe.Y;return{...Se,...oe===s$2.ADDITIVE?{G:Math.min($e+Re*_e,255)}:{Y:Math.min($e+Re*_e,255)}}},ye)}let me;if(oe===s$2.ADDITIVE)me=pe(ce);else{const ge=pe(ue);me=((ye,ve,xe)=>{const _e=Math.min(ye,ve,xe),Se=Math.min(255-ye,255-ve,255-xe),$e=ye-_e,Re=ve-_e,Ae=xe-_e,Ie=Math.min(Re,Ae),ke=$e+Re-Ie,Be=Re+Ie,Ne=2*(Ae-Ie),Fe=Math.max(ke,Be,Ne)/Math.max($e,Re,Ae),Ue=isNaN(Fe)||Fe===1/0||Fe<=0?1:Fe;return{R:ke/Ue+Se,G:Be/Ue+Se,B:Ne/Ue+Se}})(ge.R,ge.Y,ge.B),me.A=ge.A}return{R:D$3(me.R),G:D$3(me.G),B:D$3(me.B),A:f$4(me.A,0,1)}},[t$5.HEX](ne,oe,ce){const ue=this.mix(ne,oe);return delete ue.A,ce?tt$2.HEX(ue):lt.HEX(ue)},HEXA(ne,oe,ce){const ue=this.mix(ne,oe);return ue.A=ce?255*et$2(ue.A):et$2(ue.A),ce?tt$2.HEX(ue):lt.HEXA(ue)},[t$5.RGB](ne,oe,ce,ue){const pe=this.mix(ne,oe);return delete pe.A,ce?tt$2.RGB(pe,ue):lt.RGB(pe,ue.decimals)},RGBA(ne,oe,ce,ue){const pe=this.mix(ne,oe);return ce?tt$2.RGB(pe,ue):lt.RGBA(pe,ue.decimals)},[t$5.HSL](ne,oe,ce,ue){const pe=this.mix(ne,oe),me=v$5(pe.R,pe.G,pe.B);return delete pe.A,delete me.A,ce?tt$2.HSL(me,ue):lt.HSL(pe,ue.decimals)},HSLA(ne,oe,ce,ue){const pe=this.mix(ne,oe),me=v$5(pe.R,pe.G,pe.B,pe.A);return ce?tt$2.HSL(me,ue):lt.HSLA(pe,ue.decimals)},[t$5.CIELab](ne,oe,ce,ue){const pe=this.mix(ne,oe),me=V$2(pe.R,pe.G,pe.B);return delete pe.A,ce?tt$2.CIELab(me,ue):lt.CIELabA(pe,ue.decimals)},CIELabA(ne,oe,ce,ue){const pe=this.mix(ne,oe),me=V$2(pe.R,pe.G,pe.B);return p$5(pe,"A")&&(me.A=pe.A),ce?tt$2.CIELab(me,ue):lt.CIELabA(pe,ue.decimals)}},Ct=(ne,oe)=>({R:D$3(ne.R,oe),G:D$3(ne.G,oe),B:D$3(ne.B,oe),...p$5(ne,"A")?{A:D$3(ne.A,oe)}:{}}),Lt=(ne,oe)=>({H:D$3(ne.H,oe),S:D$3(ne.S,oe),L:D$3(ne.L,oe),...p$5(ne,"A")?{A:D$3(ne.A,oe)}:{}}),gt=(ne,oe)=>({L:D$3(ne.L,oe),a:D$3(ne.a,oe),b:D$3(ne.b,oe)}),Bt=(ne,oe)=>({C:D$3(ne.C,oe),M:D$3(ne.M,oe),Y:D$3(ne.Y,oe),K:D$3(ne.K,oe)}),pt=(ne,oe,ce,ue)=>ue(dt$1(ne,oe),ce),Ht=(ne,oe,ce,ue,pe)=>(ce<1&&(ce=5),((ge,ye,ve)=>{const xe=ve-1,_e=(ye.R-ge.R)/xe,Se=(ye.G-ge.G)/xe,$e=(ye.B-ge.B)/xe,Re=et$2(ge.A),Ae=(et$2(ye.A)-Re)/xe;return Array(ve).fill(null).map((Ie,ke)=>ke===0?ge:ke===xe?ye:{R:D$3(ge.R+_e*ke),G:D$3(ge.G+Se*ke),B:D$3(ge.B+$e*ke),A:D$3(Re+Ae*ke)})})(dt$1(ne),dt$1(oe),ce).map(ge=>pe(ge,ue))),Ft$1=(ne,oe,ce,ue)=>({[e$4.ANALOGOUS]:mt.buildHarmony(oe,it$1,ce,ue),[e$4.COMPLEMENTARY]:mt.buildHarmony(oe,at$1,ce,ue),[e$4.SPLIT_COMPLEMENTARY]:mt.buildHarmony(oe,rt$1,ce,ue),[e$4.TRIADIC]:mt.buildHarmony(oe,nt$1,ce,ue),[e$4.TETRADIC]:mt.buildHarmony(oe,ct$1,ce,ue),[e$4.SQUARE]:mt.buildHarmony(oe,ot$1,ce,ue)})[ne];class Rt{constructor(oe,ce={}){this._options=k$6(ce,oe),this.rgb=dt$1(oe),this.updateHSL(),this.updateLab(),this.updateCMYK()}updateRGB(){this.rgb={...x$2(this.hsl.H,this.hsl.S,this.hsl.L),A:this.hsl.A}}updateRGBFromCMYK(){this.rgb={...q$5(this.cmyk.C,this.cmyk.M,this.cmyk.Y,this.cmyk.K),A:this.rgb.A}}updateRGBFromLab(){this.rgb={...P$1(this.lab.L,this.lab.a,this.lab.b),A:this.rgb.A}}updateHSL(){this.hsl=v$5(this.rgb.R,this.rgb.G,this.rgb.B,this.rgb.A)}updateLab(){this.lab={...V$2(this.rgb.R,this.rgb.G,this.rgb.B),A:this.rgb.A}}updateCMYK(){this.cmyk=_$3(this.rgb.R,this.rgb.G,this.rgb.B)}setOptions(oe={}){return this._options={...this._options,...oe},this}setH(oe){return this.hsl.H=O$1(oe),this.updateRGB(),this.updateLab(),this.updateCMYK(),this}setS(oe){return this.hsl.S=f$4(oe,0,100),this.updateRGB(),this.updateLab(),this.updateCMYK(),this}setL(oe){return this.hsl.L=f$4(oe,0,100),this.updateRGB(),this.updateLab(),this.updateCMYK(),this}setR(oe){this.rgb.R=f$4(oe,0,255),this.updateHSL(),this.updateLab(),this.updateCMYK()}setG(oe){return this.rgb.G=f$4(oe,0,255),this.updateHSL(),this.updateLab(),this.updateCMYK(),this}setB(oe){return this.rgb.B=f$4(oe,0,255),this.updateHSL(),this.updateLab(),this.updateCMYK(),this}setCIEL(oe){return this.lab.L=f$4(oe,0,100),this.updateRGBFromLab(),this.updateHSL(),this.updateCMYK(),this}setCIEa(oe){return this.lab.a=f$4(oe,-125,125),this.updateRGBFromLab(),this.updateHSL(),this.updateCMYK(),this}setCIEb(oe){return this.lab.b=f$4(oe,-125,125),this.updateRGBFromLab(),this.updateHSL(),this.updateCMYK(),this}setA(oe){return this.hsl.A=this.rgb.A=f$4(oe,0,1),this}setC(oe){return this.cmyk.C=f$4(oe,0,100),this.updateRGBFromCMYK(),this.updateHSL(),this.updateLab(),this}setM(oe){return this.cmyk.M=f$4(oe,0,100),this.updateRGBFromCMYK(),this.updateHSL(),this.updateLab(),this}setY(oe){return this.cmyk.Y=f$4(oe,0,100),this.updateRGBFromCMYK(),this.updateHSL(),this.updateLab(),this}setK(oe){return this.cmyk.K=f$4(oe,0,100),this.updateRGBFromCMYK(),this.updateHSL(),this.updateLab(),this}get options(){return this._options}get H(){return D$3(this.hsl.H,this.options.decimals)}get S(){return D$3(this.hsl.S,this.options.decimals)}get L(){return D$3(this.hsl.L,this.options.decimals)}get CIEL(){return D$3(this.lab.L,this.options.decimals)}get CIEa(){return D$3(this.lab.a,this.options.decimals)}get CIEb(){return D$3(this.lab.b,this.options.decimals)}get R(){return D$3(this.rgb.R,this.options.decimals)}get G(){return D$3(this.rgb.G,this.options.decimals)}get B(){return D$3(this.rgb.B,this.options.decimals)}get A(){return D$3(this.hsl.A,this.options.decimals)}get C(){return D$3(this.cmyk.C,this.options.decimals)}get M(){return D$3(this.cmyk.M,this.options.decimals)}get Y(){return D$3(this.cmyk.Y,this.options.decimals)}get K(){return D$3(this.cmyk.K,this.options.decimals)}get HEXObject(){return lt.HEX(this.rgb)}get HEXAObject(){return lt.HEXA(this.rgb)}get RGBObject(){return{R:this.R,G:this.G,B:this.B}}get RGBAObject(){return{...this.RGBObject,A:this.A}}get HSLObject(){return{H:this.H,S:this.S,L:this.L}}get HSLAObject(){return{...this.HSLObject,A:this.A}}get CIELabObject(){return{L:this.CIEL,a:this.CIEa,b:this.CIEb}}get CIELabAObject(){return{...this.CIELabObject,A:this.A}}get CMYKObject(){return{C:this.C,M:this.M,Y:this.Y,K:this.K}}get CMYKAObject(){return{...this.CMYKObject,A:this.A}}get HEX(){return tt$2.HEX({R:this.R,G:this.G,B:this.B})}get HEXA(){return tt$2.HEX({R:this.R,G:this.G,B:this.B,A:255*this.A})}get RGB(){return tt$2.RGB({R:this.R,G:this.G,B:this.B},this.options)}get RGBA(){return tt$2.RGB({R:this.R,G:this.G,B:this.B,A:this.A},this.options)}get HSL(){return tt$2.HSL({H:this.H,S:this.S,L:this.L},this.options)}get HSLA(){return tt$2.HSL({H:this.H,S:this.S,L:this.L,A:this.A},this.options)}get CIELab(){return tt$2.CIELab({L:this.CIEL,a:this.CIEa,b:this.CIEb},this.options)}get CIELabA(){return tt$2.CIELab({L:this.CIEL,a:this.CIEa,b:this.CIEb,A:this.A},this.options)}get CMYK(){return tt$2.CMYK({C:this.C,M:this.M,Y:this.Y,K:this.K},this.options)}get CMYKA(){return tt$2.CMYK({C:this.C,M:this.M,Y:this.Y,K:this.K,A:this.A},this.options)}static toHEXObject(oe){const ce=At(oe);return pt(oe,ce,0,lt.HEX)}static toHEX(oe){return tt$2.HEX(Rt.toHEXObject(oe))}static toHEXAObject(oe){const ce=At(oe);return pt(oe,ce,0,lt.HEXA)}static toHEXA(oe){return tt$2.HEX(Rt.toHEXAObject(oe))}static toRGBObject(oe,ce={}){const ue=At(oe);return pt(oe,ue,ce.decimals,lt.RGB)}static toRGB(oe,ce={}){const ue=At(oe),pe=k$6(ce,oe),me=pt(oe,ue,ce.decimals,lt.RGB);return tt$2.RGB(me,pe)}static toRGBAObject(oe,ce={}){const ue=At(oe);return pt(oe,ue,ce.decimals,lt.RGBA)}static toRGBA(oe,ce={}){const ue=At(oe),pe=k$6(ce,oe),me=pt(oe,ue,ce.decimals,lt.RGBA);return tt$2.RGB(me,pe)}static toHSLObject(oe,ce={}){const ue=At(oe);return pt(oe,ue,ce.decimals,lt.HSL)}static toHSL(oe,ce={}){const ue=At(oe),pe=k$6(ce,oe),me=pt(oe,ue,ce.decimals,lt.HSL);return tt$2.HSL(me,pe)}static toHSLAObject(oe,ce={}){const ue=At(oe);return pt(oe,ue,ce.decimals,lt.HSLA)}static toHSLA(oe,ce={}){const ue=At(oe),pe=k$6(ce,oe),me=pt(oe,ue,ce.decimals,lt.HSLA);return tt$2.HSL(me,pe)}static toCIELabObject(oe,ce={}){const ue=At(oe);return pt(oe,ue,ce.decimals,lt.CIELab)}static toCIELab(oe,ce={}){const ue=At(oe),pe=k$6(ce,oe),me=pt(oe,ue,ce.decimals,lt.CIELab);return tt$2.CIELab(me,pe)}static toCIELabAObject(oe,ce={}){const ue=At(oe);return pt(oe,ue,ce.decimals,lt.CIELabA)}static toCIELabA(oe,ce={}){const ue=At(oe),pe=k$6(ce,oe),me=pt(oe,ue,ce.decimals,lt.CIELabA);return tt$2.CIELab(me,pe)}static toCMYKObject(oe,ce={}){const ue=At(oe);return pt(oe,ue,ce.decimals,lt.CMYK)}static toCMYK(oe,ce={}){const ue=At(oe),pe=k$6(ce,oe),me=pt(oe,ue,ce.decimals,lt.CMYK);return tt$2.CMYK(me,pe)}static toCMYKAObject(oe,ce={}){const ue=At(oe);return pt(oe,ue,ce.decimals,lt.CMYKA)}static toCMYKA(oe,ce={}){const ue=At(oe),pe=k$6(ce,oe),me=pt(oe,ue,ce.decimals,lt.CMYKA);return tt$2.CMYK(me,pe)}static getBlendHEXObject(oe,ce,ue=5){return Ht(oe,ce,ue,0,lt.HEX)}static getBlendHEX(oe,ce,ue=5){return Rt.getBlendHEXObject(oe,ce,ue).map(pe=>tt$2.HEX(pe))}static getBlendHEXAObject(oe,ce,ue=5){return Ht(oe,ce,ue,0,lt.HEXA)}static getBlendHEXA(oe,ce,ue=5){return Rt.getBlendHEXAObject(oe,ce,ue).map(pe=>tt$2.HEX(pe))}static getBlendRGBObject(oe,ce,ue,pe){return typeof ue=="number"?Ht(oe,ce,ue,pe==null?void 0:pe.decimals,lt.RGB):Ht(oe,ce,5,ue==null?void 0:ue.decimals,lt.RGB)}static getBlendRGB(oe,ce,ue,pe){return typeof ue=="number"?Ht(oe,ce,ue,pe==null?void 0:pe.decimals,lt.RGB).map(me=>tt$2.RGB(me,k$6(pe||{},oe,ce))):Ht(oe,ce,5,ue==null?void 0:ue.decimals,lt.RGB).map(me=>tt$2.RGB(me,k$6(ue||{},oe,ce)))}static getBlendRGBAObject(oe,ce,ue,pe){return typeof ue=="number"?Ht(oe,ce,ue,pe==null?void 0:pe.decimals,lt.RGBA):Ht(oe,ce,5,ue==null?void 0:ue.decimals,lt.RGBA)}static getBlendRGBA(oe,ce,ue,pe){return typeof ue=="number"?Ht(oe,ce,ue,pe==null?void 0:pe.decimals,lt.RGBA).map(me=>tt$2.RGB(me,k$6(pe||{},oe,ce))):Ht(oe,ce,5,ue==null?void 0:ue.decimals,lt.RGBA).map(me=>tt$2.RGB(me,k$6(ue||{},oe,ce)))}static getBlendHSLObject(oe,ce,ue,pe){return Ht(oe,ce,typeof ue=="number"?ue:5,pe==null?void 0:pe.decimals,lt.HSL)}static getBlendHSL(oe,ce,ue,pe){return typeof ue=="number"?Ht(oe,ce,ue,pe==null?void 0:pe.decimals,lt.HSL).map(me=>tt$2.HSL(me,k$6(pe||{},oe,ce))):Ht(oe,ce,5,ue==null?void 0:ue.decimals,lt.HSL).map(me=>tt$2.HSL(me,k$6(ue||{},oe,ce)))}static getBlendHSLAObject(oe,ce,ue,pe){return typeof ue=="number"?Ht(oe,ce,ue,pe==null?void 0:pe.decimals,lt.HSLA):Ht(oe,ce,5,ue==null?void 0:ue.decimals,lt.HSLA)}static getBlendHSLA(oe,ce,ue,pe){return typeof ue=="number"?Ht(oe,ce,ue,pe==null?void 0:pe.decimals,lt.HSLA).map(me=>tt$2.HSL(me,k$6(pe||{},oe,ce))):Ht(oe,ce,5,ue==null?void 0:ue.decimals,lt.HSLA).map(me=>tt$2.HSL(me,k$6(ue||{},oe,ce)))}static getBlendCIELabObject(oe,ce,ue,pe){return typeof ue=="number"?Ht(oe,ce,ue,pe==null?void 0:pe.decimals,lt.CIELab):Ht(oe,ce,5,ue==null?void 0:ue.decimals,lt.CIELab)}static getBlendCIELab(oe,ce,ue,pe){return typeof ue=="number"?Ht(oe,ce,ue,pe==null?void 0:pe.decimals,lt.CIELab).map(me=>tt$2.CIELab(me,k$6(pe||{},oe,ce))):Ht(oe,ce,5,ue==null?void 0:ue.decimals,lt.CIELab).map(me=>tt$2.CIELab(me,k$6(ue||{},oe,ce)))}static getBlendCIELabAObject(oe,ce,ue,pe){return typeof ue=="number"?Ht(oe,ce,ue,pe==null?void 0:pe.decimals,lt.CIELabA):Ht(oe,ce,5,ue==null?void 0:ue.decimals,lt.CIELabA)}static getBlendCIELabA(oe,ce,ue,pe){return typeof ue=="number"?Ht(oe,ce,ue,pe==null?void 0:pe.decimals,lt.CIELabA).map(me=>tt$2.CIELab(me,k$6(pe||{},oe,ce))):Ht(oe,ce,5,ue==null?void 0:ue.decimals,lt.CIELabA).map(me=>tt$2.CIELab(me,k$6(ue||{},oe,ce)))}static getMixHEXObject(oe,ce=s$2.ADDITIVE){return bt.HEX(oe,ce,!1)}static getMixHEX(oe,ce=s$2.ADDITIVE){return bt.HEX(oe,ce,!0)}static getMixHEXAObject(oe,ce=s$2.ADDITIVE){return bt.HEXA(oe,ce,!1)}static getMixHEXA(oe,ce=s$2.ADDITIVE){return bt.HEXA(oe,ce,!0)}static getMixRGBObject(oe,ce,ue){return typeof ce=="string"?bt.RGB(oe,ce,!1,k$6(ue||{},...oe)):bt.RGB(oe,s$2.ADDITIVE,!1,k$6(ce||{},...oe))}static getMixRGB(oe,ce,ue){return typeof ce=="string"?bt.RGB(oe,ce,!0,k$6(ue||{},...oe)):bt.RGB(oe,s$2.ADDITIVE,!0,k$6(ce||{},...oe))}static getMixRGBAObject(oe,ce,ue){return typeof ce=="string"?bt.RGBA(oe,ce,!1,k$6(ue||{},...oe)):bt.RGBA(oe,s$2.ADDITIVE,!1,k$6(ce||{},...oe))}static getMixRGBA(oe,ce,ue){return typeof ce=="string"?bt.RGBA(oe,ce,!0,k$6(ue||{},...oe)):bt.RGBA(oe,s$2.ADDITIVE,!0,k$6(ce||{},...oe))}static getMixHSLObject(oe,ce,ue){return typeof ce=="string"?bt.HSL(oe,ce,!1,k$6(ue||{},...oe)):bt.HSL(oe,s$2.ADDITIVE,!1,k$6(ce||{},...oe))}static getMixHSL(oe,ce,ue){return typeof ce=="string"?bt.HSL(oe,ce,!0,k$6(ue||{},...oe)):bt.HSL(oe,s$2.ADDITIVE,!0,k$6(ce||{},...oe))}static getMixHSLAObject(oe,ce,ue){return typeof ce=="string"?bt.HSLA(oe,ce,!1,k$6(ue||{},...oe)):bt.HSLA(oe,s$2.ADDITIVE,!1,k$6(ce||{},...oe))}static getMixHSLA(oe,ce,ue){return typeof ce=="string"?bt.HSLA(oe,ce,!0,k$6(ue||{},...oe)):bt.HSLA(oe,s$2.ADDITIVE,!0,k$6(ce||{},...oe))}static getMixCIELabObject(oe,ce,ue){return typeof ce=="string"?bt.CIELab(oe,ce,!1,k$6(ue||{},...oe)):bt.CIELab(oe,s$2.ADDITIVE,!1,k$6(ce||{},...oe))}static getMixCIELab(oe,ce,ue){return typeof ce=="string"?bt.CIELab(oe,ce,!0,k$6(ue||{},...oe)):bt.CIELab(oe,s$2.ADDITIVE,!0,k$6(ce||{},...oe))}static getMixCIELabAObject(oe,ce,ue){return typeof ce=="string"?bt.CIELabA(oe,ce,!1,k$6(ue||{},...oe)):bt.CIELabA(oe,s$2.ADDITIVE,!1,k$6(ce||{},...oe))}static getMixCIELabA(oe,ce,ue){return typeof ce=="string"?bt.CIELabA(oe,ce,!0,k$6(ue||{},...oe)):bt.CIELabA(oe,s$2.ADDITIVE,!0,k$6(ce||{},...oe))}static getShades(oe,ce,ue){return typeof ce=="number"?Et(oe,ce,!0,k$6(ue||{},oe)):Et(oe,5,!0,k$6(ce||{},oe))}static getTints(oe,ce,ue){return typeof ce=="number"?Et(oe,ce,!1,k$6(ue||{},oe)):Et(oe,5,!1,k$6(ce||{},oe))}static getHarmony(oe,ce,ue,pe){return`${ce}`in e$4?Ft$1(ce,oe,K$2(ue)?ue:s$2.ADDITIVE,k$6(K$2(ue)?pe||{}:ue||{},oe)):K$2(ce)?Ft$1(e$4.COMPLEMENTARY,oe,ce,k$6(ue||{},oe)):Ft$1(e$4.COMPLEMENTARY,oe,s$2.ADDITIVE,k$6(ce||{},oe))}}function hash(ne){let oe=5381,ce=ne.length;for(;ce;)oe=oe*33^ne.charCodeAt(--ce);return oe>>>0}const tint="500";function hex(ne){return parseInt(ne.replace("#","0x"))}const searchEventAliases=lodashExports$1.thru({source:["source","start"],destination:["destination","goal","finish"],updating:["update","updating"],expanding:["expanding","expanding"],generating:["generate","generating","open","opening"],closing:["close","closing"],end:["finish","end"]},ne=>{const oe={};for(const[ce,ue]of lodashExports$1.entries(ne))for(const pe of ue)oe[pe]=ce;return oe}),colorsHex={source:green$1.A400,destination:red$1.A400,updating:orange$1[tint],expanding:deepPurple$1[tint],generating:amber$1[tint],closing:pink$1[tint],end:blue$1.A400};lodashExports$1.mapValues(colorsHex,hex);const shades=lodashExports$1.sortBy(lodashExports$1.keys(accentColors),ne=>new Rt(getShade(ne,"dark")).H);function getColorHex(ne="",oe){if(searchEventAliases[lodashExports$1.lowerCase(ne)])return colorsHex[ne];if(oe)return oe;{const ue=hash(lodashExports$1.lowerCase(ne)),pe=lodashExports$1.values(accentColors);return pe[ue%pe.length][tint]}}function inferLayerName(ne){var oe;return ne!=null&&ne.name?ne==null?void 0:ne.name:(oe=ne==null?void 0:ne.source)!=null&&oe.type?getController(ne).inferName(ne):"Untitled Layer"}let windowObject;typeof window<"u"?windowObject=window:typeof self<"u"?windowObject=self:windowObject=global;let cancelFrame=null,requestFrame=null;const TIMEOUT_DURATION=20,clearTimeoutFn=windowObject.clearTimeout,setTimeoutFn=windowObject.setTimeout,cancelAnimationFrameFn=windowObject.cancelAnimationFrame||windowObject.mozCancelAnimationFrame||windowObject.webkitCancelAnimationFrame,requestAnimationFrameFn=windowObject.requestAnimationFrame||windowObject.mozRequestAnimationFrame||windowObject.webkitRequestAnimationFrame;cancelAnimationFrameFn==null||requestAnimationFrameFn==null?(cancelFrame=clearTimeoutFn,requestFrame=function(oe){return setTimeoutFn(oe,TIMEOUT_DURATION)}):(cancelFrame=function([oe,ce]){cancelAnimationFrameFn(oe),clearTimeoutFn(ce)},requestFrame=function(oe){const ce=requestAnimationFrameFn(function(){clearTimeoutFn(ue),oe()}),ue=setTimeoutFn(function(){cancelAnimationFrameFn(ce),oe()},TIMEOUT_DURATION);return[ce,ue]});function createDetectElementResize(ne){let oe,ce,ue,pe,me,ge,ye;const ve=typeof document<"u"&&document.attachEvent;if(!ve){ge=function(Be){const Ne=Be.__resizeTriggers__,Fe=Ne.firstElementChild,Ue=Ne.lastElementChild,We=Fe.firstElementChild;Ue.scrollLeft=Ue.scrollWidth,Ue.scrollTop=Ue.scrollHeight,We.style.width=Fe.offsetWidth+1+"px",We.style.height=Fe.offsetHeight+1+"px",Fe.scrollLeft=Fe.scrollWidth,Fe.scrollTop=Fe.scrollHeight},me=function(Be){return Be.offsetWidth!==Be.__resizeLast__.width||Be.offsetHeight!==Be.__resizeLast__.height},ye=function(Be){if(Be.target.className&&typeof Be.target.className.indexOf=="function"&&Be.target.className.indexOf("contract-trigger")<0&&Be.target.className.indexOf("expand-trigger")<0)return;const Ne=this;ge(this),this.__resizeRAF__&&cancelFrame(this.__resizeRAF__),this.__resizeRAF__=requestFrame(function(){me(Ne)&&(Ne.__resizeLast__.width=Ne.offsetWidth,Ne.__resizeLast__.height=Ne.offsetHeight,Ne.__resizeListeners__.forEach(function(We){We.call(Ne,Be)}))})};let $e=!1,Re="";ue="animationstart";const Ae="Webkit Moz O ms".split(" ");let Ie="webkitAnimationStart animationstart oAnimationStart MSAnimationStart".split(" "),ke="";{const Be=document.createElement("fakeelement");if(Be.style.animationName!==void 0&&($e=!0),$e===!1){for(let Ne=0;Ne div, .contract-trigger:before { content: " "; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; z-index: -1; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }',Ae=$e.head||$e.getElementsByTagName("head")[0],Ie=$e.createElement("style");Ie.id="detectElementResize",Ie.type="text/css",ne!=null&&Ie.setAttribute("nonce",ne),Ie.styleSheet?Ie.styleSheet.cssText=Re:Ie.appendChild($e.createTextNode(Re)),Ae.appendChild(Ie)}};return{addResizeListener:function($e,Re){if(ve)$e.attachEvent("onresize",Re);else{if(!$e.__resizeTriggers__){const Ae=$e.ownerDocument,Ie=windowObject.getComputedStyle($e);Ie&&Ie.position==="static"&&($e.style.position="relative"),xe(Ae),$e.__resizeLast__={},$e.__resizeListeners__=[],($e.__resizeTriggers__=Ae.createElement("div")).className="resize-triggers";const ke=Ae.createElement("div");ke.className="expand-trigger",ke.appendChild(Ae.createElement("div"));const Be=Ae.createElement("div");Be.className="contract-trigger",$e.__resizeTriggers__.appendChild(ke),$e.__resizeTriggers__.appendChild(Be),$e.appendChild($e.__resizeTriggers__),ge($e),$e.addEventListener("scroll",ye,!0),ue&&($e.__resizeTriggers__.__animationListener__=function(Fe){Fe.animationName===ce&&ge($e)},$e.__resizeTriggers__.addEventListener(ue,$e.__resizeTriggers__.__animationListener__))}$e.__resizeListeners__.push(Re)}},removeResizeListener:function($e,Re){if(ve)$e.detachEvent("onresize",Re);else if($e.__resizeListeners__.splice($e.__resizeListeners__.indexOf(Re),1),!$e.__resizeListeners__.length){$e.removeEventListener("scroll",ye,!0),$e.__resizeTriggers__.__animationListener__&&($e.__resizeTriggers__.removeEventListener(ue,$e.__resizeTriggers__.__animationListener__),$e.__resizeTriggers__.__animationListener__=null);try{$e.__resizeTriggers__=!$e.removeChild($e.__resizeTriggers__)}catch{}}}}}class AutoSizer extends reactExports.Component{constructor(...oe){super(...oe),this.state={height:this.props.defaultHeight||0,scaledHeight:this.props.defaultHeight||0,scaledWidth:this.props.defaultWidth||0,width:this.props.defaultWidth||0},this._autoSizer=null,this._detectElementResize=null,this._parentNode=null,this._resizeObserver=null,this._timeoutId=null,this._onResize=()=>{this._timeoutId=null;const{disableHeight:ce,disableWidth:ue,onResize:pe}=this.props;if(this._parentNode){const me=window.getComputedStyle(this._parentNode)||{},ge=parseFloat(me.paddingLeft||"0"),ye=parseFloat(me.paddingRight||"0"),ve=parseFloat(me.paddingTop||"0"),xe=parseFloat(me.paddingBottom||"0"),_e=this._parentNode.getBoundingClientRect(),Se=_e.height-ve-xe,$e=_e.width-ge-ye,Re=this._parentNode.offsetHeight-ve-xe,Ae=this._parentNode.offsetWidth-ge-ye;(!ce&&(this.state.height!==Re||this.state.scaledHeight!==Se)||!ue&&(this.state.width!==Ae||this.state.scaledWidth!==$e))&&(this.setState({height:Re,width:Ae,scaledHeight:Se,scaledWidth:$e}),typeof pe=="function"&&pe({height:Re,scaledHeight:Se,scaledWidth:$e,width:Ae}))}},this._setRef=ce=>{this._autoSizer=ce}}componentDidMount(){const{nonce:oe}=this.props;this._autoSizer&&this._autoSizer.parentNode&&this._autoSizer.parentNode.ownerDocument&&this._autoSizer.parentNode.ownerDocument.defaultView&&this._autoSizer.parentNode instanceof this._autoSizer.parentNode.ownerDocument.defaultView.HTMLElement&&(this._parentNode=this._autoSizer.parentNode,this._parentNode!=null&&(typeof ResizeObserver<"u"?(this._resizeObserver=new ResizeObserver(()=>{this._timeoutId=setTimeout(this._onResize,0)}),this._resizeObserver.observe(this._parentNode)):(this._detectElementResize=createDetectElementResize(oe),this._detectElementResize.addResizeListener(this._parentNode,this._onResize)),this._onResize()))}componentWillUnmount(){this._parentNode&&(this._detectElementResize&&this._detectElementResize.removeResizeListener(this._parentNode,this._onResize),this._timeoutId!==null&&clearTimeout(this._timeoutId),this._resizeObserver&&(this._resizeObserver.observe(this._parentNode),this._resizeObserver.disconnect()))}render(){const{children:oe,defaultHeight:ce,defaultWidth:ue,disableHeight:pe=!1,disableWidth:me=!1,nonce:ge,onResize:ye,style:ve={},tagName:xe="div",..._e}=this.props,{height:Se,scaledHeight:$e,scaledWidth:Re,width:Ae}=this.state,Ie={overflow:"visible"},ke={};let Be=!1;return pe||(Se===0&&(Be=!0),Ie.height=0,ke.height=Se,ke.scaledHeight=$e),me||(Ae===0&&(Be=!0),Ie.width=0,ke.width=Ae,ke.scaledWidth=Re),reactExports.createElement(xe,{ref:this._setRef,style:{...Ie,...ve},..._e},!Be&&oe(ke))}}const treeWorkerUrl=""+new URL("tree.worker-62add194.js",import.meta.url).href;class TreeWorkerUrl extends Worker{constructor(){super(treeWorkerUrl,{type:"module"})}}const treeAsync=usingMemoizedWorkerTask(TreeWorkerUrl);function useTree(ne){return useAsync(async()=>await treeAsync(ne),[ne])}function useTreeMemo(ne,oe){const ce=reactExports.useMemo(()=>ne,oe);return useTree(ce)}const isDefined$1=ne=>!lodashExports$1.isUndefined(ne)&&!lodashExports$1.isNull(ne),divider$4=jsxRuntimeExports.jsx(Divider$1,{orientation:"vertical",flexItem:!0,sx:{m:1}});function useCache(ne,oe=!1){const[ce,ue]=reactExports.useState();return reactExports.useEffect(()=>{oe||ne&&ue(ne)},[ne,oe]),ce}const layoutModes={"directed-graph":{value:"directed-graph",name:"Directed Graph",description:"Show all edges",showAllEdges:!0},tree:{value:"tree",name:"Tree",description:"Show only edges between each node and their final parents",showAllEdges:!1}};function GraphEvents({onSelection:ne,layer:oe}){const ce=v$6(),ue=y$3();return reactExports.useEffect(()=>{ue({clickNode:pe=>{ne==null||ne({event:pe.event.original,node:pe.node})},enterNode:()=>{document.body.style.cursor="pointer"},leaveNode:()=>{document.body.style.cursor=""}})},[oe,ue,ce]),null}const SEVEN_CLASS_GNBU=["#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"];function TreeGraph({trace:ne,tree:oe,step:ce=0,layer:ue,showAllEdges:pe,trackedProperty:me}){const ge=v$6(),[ye,ve]=reactExports.useState("vertical"),xe=usePaper(),_e=useAcrylic(),Se=useTheme$1(),$e=interpolate$1([Se.palette.background.paper,Se.palette.text.primary]),Re=_$4(),Ae=reactExports.useMemo(()=>getFinalParents(ne),[ne]),Ie=reactExports.useMemo(()=>{const ke=ye==="vertical",Be=new MultiDirectedGraph;lodashExports$1.forEach(oe,Fe=>{Be.addNode(Fe.label,{x:ke?Fe.x:-Fe.y,y:ke?Fe.y:-Fe.x,label:Fe.label,size:Math.log(Fe.size)+2,color:Se.palette.action.disabledBackground})});const Ne={};return lodashExports$1.forEach(ne==null?void 0:ne.events,({id:Fe,pId:Ue})=>{Fe&&Ue&&(Ne[Fe]=Ne[Fe]??new Set,Ne[Fe].add(Ue))}),lodashExports$1.forEach(ne==null?void 0:ne.events,({id:Fe,pId:Ue})=>{if(isDefined$1(Ue)&&Be.hasNode(`${Ue}`)){const We=makeEdgeKey(Fe,Ue);!Be.hasEdge(We)&&Be.hasNode(`${Fe}`)&&Be.addDirectedEdgeWithKey(We,`${Ue}`,`${Fe}`,{label:"",color:"white",size:2,final:Ae[Fe]===Ue}),Be.hasDirectedEdge(We)&&Be.updateEdgeAttribute(We,"size",qe=>Math.log(Math.E**(qe-.5)+.5)+.5)}}),Be},[Re,ne,oe,Ae,ye]);return reactExports.useEffect(()=>{const ke=memoizee$1(We=>interpolate$1([Se.palette.background.paper,We])),Be=400,Ne=$e(.1);Ie.forEachNode(We=>{Ie.setNodeAttribute(We,"color",Ne),Ie.setNodeAttribute(We,"forceLabel",!1),Ie.setNodeAttribute(We,"label",lodashExports$1.truncate(We,{length:15}))}),Ie.forEachEdge(We=>{const qe=Ie.getEdgeAttribute(We,"final");Ie.setEdgeAttribute(We,"color",Ne),Ie.setEdgeAttribute(We,"hidden",!pe&&!qe),Ie.setEdgeAttribute(We,"forceLabel",!1),Ie.setEdgeAttribute(We,"label","")});const Fe={},Ue={};if((pe?lodashExports$1.forEach:lodashExports$1.forEachRight)(lodashExports$1.slice(ne==null?void 0:ne.events,0,ce+1),({id:We,type:qe,pId:ze},Ge)=>{const Ze=getColorHex(qe),Dt=ke(Ze)(lodashExports$1.max([1-(ce-Ge)/Be,.2]));if(Ie.hasNode(`${We}`)&&!Fe[We]){Ie.setNodeAttribute(`${We}`,"color",Dt),Ie.setNodeAttribute(`${We}`,"label",lodashExports$1.truncate(`${lodashExports$1.startCase(qe)} ${We}`,{length:15})),Ie.setNodeAttribute(`${We}`,"forceLabel",ce===Ge);const Je=makeEdgeKey(We,ze);isDefined$1(ze)&&Ie.hasNode(`${ze}`)&&Ie.hasEdge(Je)&&!Ue[Je]&&(Ie.setEdgeAttribute(Je,"forceLabel",ce===Ge),Ie.setEdgeAttribute(Je,"color",Dt),Ie.setEdgeAttribute(Je,"label",`Step ${Ge}`),Ie.setEdgeAttribute(Je,"hidden",!1),pe||(Ue[Je]=!0)),pe||(Fe[We]=!0)}}),me){const We=lodashExports$1.min(lodashExports$1.map(ne==null?void 0:ne.events,Ze=>lodashExports$1.get(Ze,me))),qe=lodashExports$1.max(lodashExports$1.map(ne==null?void 0:ne.events,Ze=>lodashExports$1.get(Ze,me))),ze=Ze=>isNaN(We)||isNaN(qe)||isNaN(Ze)?0:(Ze-We)/(qe-We),Ge=interpolate$1(SEVEN_CLASS_GNBU);lodashExports$1.forEach(lodashExports$1.slice(ne==null?void 0:ne.events,0,ce+1),Ze=>{if(Ie.hasNode(`${Ze.id}`)){const Dt=Ge(ze(lodashExports$1.get(Ze,me)));if(Ie.setNodeAttribute(`${Ze.id}`,"color",Dt),isDefined$1(Ze.pId)){const Je=makeEdgeKey(`${Ze.id}`,`${Ze.pId}`);Ie.hasDirectedEdge(Je)&&Ie.setEdgeAttribute(Je,"color",Dt)}}})}Re(Ie)},[Ie,ce,ne,pe,me,Se]),jsxRuntimeExports.jsx(Stack$1,{sx:{pt:6,position:"absolute",top:0,left:0},children:jsxRuntimeExports.jsxs(Stack$1,{direction:"row",sx:{...xe(1),..._e,alignItems:"center",height:ke=>ke.spacing(6),px:1,m:1},children:[jsxRuntimeExports.jsx(IconButtonWithTooltip,{color:"primary",onClick:()=>{var ke,Be,Ne;(Ne=(Be=(ke=ge==null?void 0:ge.getCamera)==null?void 0:ke.call(ge))==null?void 0:Be.animatedReset)==null||Ne.call(Be)},label:"Fit",icon:jsxRuntimeExports.jsx(CenterFocusWeakOutlined,{})}),divider$4,jsxRuntimeExports.jsx(IconButtonWithTooltip,{color:"primary",onClick:()=>{ve(ye==="vertical"?"horizontal":"vertical")},label:"Rotate",icon:jsxRuntimeExports.jsx(RotateIcon,{})}),divider$4,jsxRuntimeExports.jsx(MinimisedPlaybackControls,{layer:ue})]})})}function makeEdgeKey(ne,oe){return`${ne}::${oe}`}const stepsLayerGuard$2=ne=>!!getController(ne).steps;function TreePage({template:ne}){var Je,Ut,jt,Ke,an,Zt;const{key:oe,setKey:ce,layer:ue,layers:pe,allLayers:me}=useLayer(void 0,stepsLayerGuard$2),ge=useTheme$1(),{controls:ye,onChange:ve,state:xe,dragHandle:_e}=useViewTreeContext(),Se=useThrottle$1(((Je=ue==null?void 0:ue.source)==null?void 0:Je.step)??0,1e3/24),{stepTo:$e}=usePlaybackState(oe),Re=reactExports.useMemo(()=>{var en,Kt,Wt;return lodashExports$1.chain((Wt=(Kt=(en=ue==null?void 0:ue.source)==null?void 0:en.trace)==null?void 0:Kt.content)==null?void 0:Wt.events).flatMap(lodashExports$1.keys).uniq().filter(un=>un!=="type").value()},[(Ke=(jt=(Ut=ue==null?void 0:ue.source)==null?void 0:Ut.trace)==null?void 0:jt.content)==null?void 0:Ke.events]),[Ae,Ie]=reactExports.useState(""),ke=(Zt=(an=ue==null?void 0:ue.source)==null?void 0:an.trace)==null?void 0:Zt.content;reactExports.useEffect(()=>{Ie("")},[ke,Ie]);const[Be,Ne]=reactExports.useState(),[Fe,Ue]=reactExports.useState(!1),[We,qe]=reactExports.useState("tree"),ze=reactExports.useMemo(()=>{const en=lodashExports$1.filter(lodashExports$1.map(ke==null?void 0:ke.events,(Kt,Wt)=>({event:Kt,step:Wt})),Kt=>`${Kt.event.id}`===(Be==null?void 0:Be.node));return{events:en,current:lodashExports$1.findLast(en,Kt=>Kt.step<=Se)}},[Be,Se]),{result:Ge,loading:Ze}=useTreeMemo({trace:ke,mode:We},[oe,We]),Dt=reactExports.useMemo(()=>({stagePadding:8*8,allowInvalidContainer:!0,edgeLabelColor:{color:ge.palette.text.secondary},labelFont:"Inter",labelSize:14,labelDensity:.1,renderEdgeLabels:!0,edgeLabelFont:"Inter",edgeLabelSize:12,defaultDrawNodeHover:()=>{},labelColor:{color:ge.palette.text.primary},edgeLabelWeight:"500",defaultEdgeType:"arrow",edgeProgramClasses:{straight:EdgeArrowProgram$1,curvedArrow:EdgeCurvedArrowProgram}}),[ge]);return jsxRuntimeExports.jsxs(ne,{onChange:ve,stack:xe,children:[jsxRuntimeExports.jsx(ne.Key,{children:"tree"}),jsxRuntimeExports.jsx(ne.Title,{children:"Tree"}),jsxRuntimeExports.jsx(ne.Handle,{children:_e}),jsxRuntimeExports.jsx(ne.Content,{children:jsxRuntimeExports.jsx(Flex,{children:ke?Ze?jsxRuntimeExports.jsxs(Flex,{sx:{flexDirection:"column",gap:4,alignItems:"center",justifyContent:"center"},children:[jsxRuntimeExports.jsx(CircularProgress$1,{}),jsxRuntimeExports.jsx(Type$2,{component:"div",variant:"body2",sx:{px:8,maxWidth:480},children:"Generating layout"})]}):Ge!=null&&Ge.length?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(AutoSizer,{children:en=>jsxRuntimeExports.jsxs(k$7,{style:{...en,background:ge.palette.background.paper},graph:MultiDirectedGraph,settings:Dt,children:[jsxRuntimeExports.jsx(TreeGraph,{step:Se,tree:Ge,trace:ke,layer:ue,showAllEdges:layoutModes[We].showAllEdges,trackedProperty:Ae}),jsxRuntimeExports.jsx(GraphEvents,{layer:oe,onSelection:Kt=>{Ne(Kt),Ue(!0)}})]})}),jsxRuntimeExports.jsx(Menu$1,{onClose:()=>Ue(!1),anchorReference:"anchorPosition",anchorPosition:{left:(Be==null?void 0:Be.event.clientX)??0,top:(Be==null?void 0:Be.event.clientY)??0},transformOrigin:{horizontal:"left",vertical:"top"},open:Fe,children:jsxRuntimeExports.jsxs(MenuList$1,{dense:!0,sx:{p:0},children:[!!ze.current&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ListItem$1,{sx:{py:0},children:jsxRuntimeExports.jsxs(Type$2,{component:"div",color:"text.secondary",variant:"overline",children:["Step ",ze.current.step]})}),jsxRuntimeExports.jsx(Box$1,{px:2,py:1,children:jsxRuntimeExports.jsx(PropertyList,{event:ze.current.event,vertical:!0,simple:!0,primitives:!0})}),jsxRuntimeExports.jsx(Divider$1,{sx:{my:1,mx:2}})]}),jsxRuntimeExports.jsx(ListItem$1,{sx:{py:0},children:jsxRuntimeExports.jsxs(Type$2,{component:"div",color:"text.secondary",variant:"overline",children:["Events at ",Be==null?void 0:Be.node]})}),lodashExports$1.map(ze.events,(en,Kt,Wt)=>{var Xt;const un=((Xt=lodashExports$1.findLast(Wt,nn=>nn.step<=Se))==null?void 0:Xt.step)===en.step;return jsxRuntimeExports.jsxs(Stack$1,{direction:"row",children:[jsxRuntimeExports.jsx(MenuItem$1,{selected:un,sx:{height:32,flex:1,borderLeft:`4px solid ${getColorHex(en.event.type)}`},onClick:()=>{$e(en.step)},children:jsxRuntimeExports.jsx(Tooltip$1,{title:`Go to step ${en.step}`,children:jsxRuntimeExports.jsx(Box$1,{sx:{ml:-.5,pr:4},children:jsxRuntimeExports.jsx(Label$1,{primary:lodashExports$1.startCase(en.event.type),secondary:isDefined$1(en.event.pId)?`Step ${en.step}, from ${en.event.pId}`:`Step ${en.step}`})})})}),jsxRuntimeExports.jsx(Box$1,{sx:{flex:0},children:jsxRuntimeExports.jsx(PropertyDialog,{event:en.event,trigger:nn=>jsxRuntimeExports.jsx(MenuItem$1,{selected:un,onClick:nn,sx:{pr:0},children:jsxRuntimeExports.jsx(Tooltip$1,{title:"See all properties",children:jsxRuntimeExports.jsx(ListItemIcon$1,{children:jsxRuntimeExports.jsx(DataObjectOutlined,{})})})})})})]})})]})})]}):jsxRuntimeExports.jsx(Placeholder$2,{icon:jsxRuntimeExports.jsx(TreeIcon,{}),label:"Graph",secondary:`${inferLayerName(ue)} is not a graph.`}):jsxRuntimeExports.jsx(Placeholder$2,{icon:jsxRuntimeExports.jsx(TreeIcon,{}),label:"Graph",secondary:"When you load a trace that has tree-like data, you'll see it here as a decision tree."})})}),jsxRuntimeExports.jsxs(ne.Options,{children:[jsxRuntimeExports.jsx(FeaturePicker,{icon:jsxRuntimeExports.jsx(LayersIcon,{}),label:"Layer",value:oe,items:lodashExports$1.map(me,en=>({id:en.key,hidden:!lodashExports$1.find(pe,{key:en.key}),name:inferLayerName(en)})),onChange:ce,arrow:!0,ellipsis:12}),divider$4,jsxRuntimeExports.jsx(FeaturePicker,{icon:jsxRuntimeExports.jsx(ModeStandbyOutlined,{}),label:"Layout",value:We,onChange:qe,items:lodashExports$1.map(lodashExports$1.entries(layoutModes),([en,Kt])=>({id:en,...Kt})),arrow:!0}),divider$4,jsxRuntimeExports.jsx(FeaturePicker,{icon:jsxRuntimeExports.jsx(TimelineOutlined,{}),label:"Tracked Property",value:Ae,onChange:Ie,items:[{id:"",name:"Off"},...lodashExports$1.map(Re,en=>({id:en,name:`$.${en}`}))],arrow:!0})]}),jsxRuntimeExports.jsx(ne.Extras,{children:ye})]})}function getFinalParents(ne){const oe={};return lodashExports$1.forEach(ne==null?void 0:ne.events,({id:ce,pId:ue})=>{oe[ce]=ue}),oe}function SelectionMenu({selection:ne,onClose:oe}){const ce=useSelectionMenu(),ue=useCache(ne),{client:pe}=ne??{};return jsxRuntimeExports.jsx(Menu$1,{open:!!ne,anchorReference:"anchorPosition",anchorPosition:{top:(pe==null?void 0:pe.y)??0,left:(pe==null?void 0:pe.x)??0},onClose:oe,keepMounted:!0,children:jsxRuntimeExports.jsx(MenuList$1,{dense:!0,sx:{py:0},children:jsxRuntimeExports.jsx(ce,{event:ue,children:me=>{const ge=lodashExports$1.entries(me);return ge.length?lodashExports$1.chain(ge).sortBy(([,ye])=>ye.index).map(([,{items:ye,primary:ve}],xe)=>jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[!!xe&&jsxRuntimeExports.jsx(Divider$1,{sx:{my:1,mx:2}}),ve&&jsxRuntimeExports.jsx(ListItem$1,{sx:{py:0},children:jsxRuntimeExports.jsx(Type$2,{component:"div",color:"text.secondary",variant:"overline",children:ve})}),lodashExports$1.chain(ye).entries().sortBy(([,_e])=>_e.index).map(([_e,{action:Se,icon:$e,primary:Re,secondary:Ae,extras:Ie}])=>jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[!!(Se||Re||Ae)&&(Se?jsxRuntimeExports.jsxs(MenuItem$1,{onClick:()=>{Se==null||Se(),oe==null||oe()},children:[$e&&jsxRuntimeExports.jsx(ListItemIcon$1,{children:$e}),jsxRuntimeExports.jsx(ListItemText$1,{primary:Re,sx:{mr:4}}),jsxRuntimeExports.jsx(Type$2,{component:"div",variant:"body2",color:"text.secondary",children:Ae})]},_e):jsxRuntimeExports.jsxs(ListItem$1,{children:[$e&&jsxRuntimeExports.jsx(ListItemIcon$1,{children:$e}),jsxRuntimeExports.jsx(ListItemText$1,{primary:Re,sx:{mr:4}}),jsxRuntimeExports.jsx(Type$2,{component:"div",variant:"body2",color:"text.secondary",children:Ae})]},_e)),!!Ie&&Ie]})).value()]})).value():jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(ListItem$1,{children:jsxRuntimeExports.jsx(Type$2,{component:"div",children:"No info to show."})})})}})})})}const identity$1=({children:ne})=>jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:ne==null?void 0:ne({})});function useSelectionMenu(){const[{layers:ne}]=useLayers();return reactExports.useMemo(()=>lodashExports$1.chain(ne).reduce((oe,ce)=>{var pe;const ue=((pe=getController(ce))==null?void 0:pe.provideSelectionInfo)??identity$1;return({children:me,event:ge})=>jsxRuntimeExports.jsx(ue,{layer:ce.key,event:ge,children:ye=>jsxRuntimeExports.jsx(oe,{event:ge,children:ve=>me==null?void 0:me(lodashExports$1.merge(ye,ve))})})},identity$1).value(),[ne])}const TILE_RESOLUTION=128,tileSize=(ne=!1)=>(ne?.75:devicePixelRatio*2)*TILE_RESOLUTION,rendererOptions={tileSubdivision:2,workerCount:lodashExports$1.clamp(lodashExports$1.floor((navigator.hardwareConcurrency-1)/2),1,12),tileResolution:{width:tileSize(),height:tileSize()}},TraceRendererContext=reactExports.createContext({});function useRendererInstance(){return reactExports.useContext(TraceRendererContext)}function useRenderer(ne,{width:oe,height:ce}={}){const ue=useTheme$1(),[pe]=useRenderers(),me=reactExports.useRef(null),[ge,ye]=reactExports.useState(""),[ve,xe]=reactExports.useState();return reactExports.useEffect(()=>{if(me.current&&oe&&ce&&ne){const _e=lodashExports$1.find(pe,Se=>Se.renderer.meta.id===ne);if(_e)try{const Se=new _e.renderer.constructor;Se.setup({...rendererOptions,screenSize:{width:oe,height:ce},backgroundColor:ue.palette.background.paper,accentColor:ue.palette.primary.main}),me.current.append(Se.getView()),xe(Se),ye("");const $e=me.current;return()=>{try{$e.removeChild(Se.getView()),xe(void 0)}catch(Re){console.warn(Re)}finally{Se.destroy()}}}catch(Se){ye(`${_e.renderer.meta.name}: ${lodashExports$1.get(Se,"message")}`),xe(void 0)}}},[me.current,lodashExports$1.map,ne,pe,ue,ye,xe]),useDebounce(()=>{ve&&oe&&ce&&ve.setOptions({screenSize:{width:oe,height:ce}})},ue.transitions.duration.standard,[ve,oe,ce]),{instance:ve,ref:me,error:ge}}function TraceRendererCircularProgress(){const[{map:ne,specimen:oe}]=useLoading();return!!(ne||oe)&&jsxRuntimeExports.jsx(CircularProgress$1,{sx:{position:"absolute",top:ce=>ce.spacing(6+2),right:ce=>ce.spacing(2)}})}const VIEWPORT_PAGE_DESCRIPTION="When you create a layer, you'll see it visualised here.";function TraceRenderer({width:ne,height:oe,renderer:ce,rendererRef:ue,layers:pe}){const me=reactExports.useMemo(nanoid$1,[]),{instance:ge,error:ye,ref:ve}=useRenderer(ce,{width:ne,height:oe}),{playing:xe}=usePlaybackState(),[,_e]=useScreenshots(),[Se,$e]=reactExports.useState();reactExports.useEffect(()=>{if(ge){const Ae=(Ie,ke)=>{const Be=Ie;$e({client:{x:Be.clientX,y:Be.clientY},world:ke.world,info:{point:ke.world,components:ke.components}})};return ge.on("click",Ae),()=>void ge.off("click",Ae)}},[ge]);const Re=reactExports.useMemo(()=>({renderer:ge}),[ge]);return reactExports.useEffect(()=>ue==null?void 0:ue(ge),[ge,ue]),reactExports.useEffect(()=>{const Ae=async()=>{var Ie;return await((Ie=ge==null?void 0:ge.toDataUrl)==null?void 0:Ie.call(ge))};return _e(()=>({[me]:Ae})),()=>_e(()=>({[me]:void 0}))},[me,ge]),reactExports.useEffect(()=>{ge&&ge.setOptions({tileResolution:{width:tileSize(xe),height:tileSize(xe)}})},[ge,xe]),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(TraceRendererCircularProgress,{}),jsxRuntimeExports.jsx(TraceRendererContext.Provider,{value:Re,children:jsxRuntimeExports.jsx(Box$1,{sx:{width:ne,height:oe},children:pe!=null&&pe.length?jsxRuntimeExports.jsx(TrustedContent,{children:ye?jsxRuntimeExports.jsxs(Box$1,{sx:{display:"flex",flexDirection:"column",width:ne,height:oe,alignItems:"center",justifyContent:"center",color:"text.secondary"},children:[jsxRuntimeExports.jsx(DisabledIcon,{sx:{mb:2},fontSize:"large"}),ye]}):jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(Box$1,{ref:ve,children:pe.map((Ae,Ie)=>jsxRuntimeExports.jsx(RenderLayer,{index:Ie,layer:Ae},Ae.key))})})}):jsxRuntimeExports.jsx(Placeholder$2,{icon:jsxRuntimeExports.jsx(ViewportIcon,{}),label:"Viewport",width:ne,height:oe,secondary:VIEWPORT_PAGE_DESCRIPTION})})}),jsxRuntimeExports.jsx(SelectionMenu,{selection:Se,onClose:()=>$e(void 0)})]})}function NodeList({nodes:ne,start:oe=0,end:ce=(ne==null?void 0:ne.length)??0}){const{renderer:ue}=useRendererInstance();return reactExports.useEffect(()=>{if(ue&&(ne!=null&&ne.length))return ue.add(lodashExports$1.slice(ne,oe,ce).flat())},[ue,ne,oe,ce]),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{})}function NodeList2({nodes:ne}){const{renderer:oe}=useRendererInstance();return reactExports.useEffect(()=>{if(oe&&(ne!=null&&ne.length))return oe.add(ne)},[oe,ne]),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{})}function LazyNodeList({nodes:ne,end:oe}){const ue=lodashExports$1.floor((oe??0)/100)*100,pe=reactExports.useMemo(()=>lodashExports$1.slice(ne,0,ue),[ne,ue]),me=reactExports.useMemo(()=>lodashExports$1.slice(ne,ue,(oe??0)+1),[ne,ue,oe]);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[!!ue&&jsxRuntimeExports.jsx(NodeList,{nodes:pe}),me.map((ge,ye)=>jsxRuntimeExports.jsx(NodeList2,{nodes:ge},ue+ye))]})}const useEffectWhen=(ne,oe,ce)=>{const ue=usePrevious$1(ce);return reactExports.useEffect(()=>{allSame(ce,ue)||ne()},[oe])};function allSame(ne,oe){return lodashExports$1.zip(ne,oe).every(([ce,ue])=>ce===ue)}const useEffectWhenAsync=(ne,oe=[],ce=[])=>{const[ue,pe]=reactExports.useState(oe),[me,ge]=reactExports.useState(ce);return reactExports.useEffect(()=>{allSame(me,ce)||(pe(oe),ge(ce))},[oe,ce,me]),useAsyncAbortable(ne,[...ue,...me])};function useConnectionResolver(){const[ne]=useConnections();return reactExports.useCallback(oe=>lodashExports$1.find(ne,oe),[ne])}function useConnection(ne){return useConnectionResolver()({url:ne})}function useMapContent(ne){const oe=useSnackbar(),ce=useLoadingState("map"),ue=useConnectionResolver(),pe=reactExports.useMemo(()=>memoizee$1(async({source:ve,id:xe}={})=>{if(ve&&xe){const _e=ue({url:ve});if(_e){oe("Fetching map...");const Se=await _e.transport().call("features/map",{id:xe});return Se==null?void 0:Se.content}}},{normalizer:JSON.stringify}),[ue,oe]),{content:me,source:ge,id:ye}=ne??{};return useAsync(()=>ce(async()=>{if(ye)return{...ne,content:me||await pe({source:ge,id:ye})}}),[pe,me,ge,ye])}const noop$7=()=>jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{});function useMapOptions(ne){const{format:oe}=ne??{};return useAsync(async()=>{var ce,ue;return await((ue=(ce=getParser(oe))==null?void 0:ce.editor)==null?void 0:ue.call(ce,ne==null?void 0:ne.content))??noop$7},[oe,ne==null?void 0:ne.content])}function useParsedMap(ne,oe){const ce=useSnackbar(),ue=useTheme$1(),pe=useLoadingState("map"),{format:me,content:ge}=ne??{};return useAsync(()=>pe(async()=>{var ye,ve;if(me&&ge){ce("Processing map...");try{const xe=await((ve=(ye=getParser(me))==null?void 0:ye.parse)==null?void 0:ve.call(ye,ge,{color:ue.palette.text.primary,background:ue.palette.background.paper,...oe}))??{nodes:[]};return ce("Map loaded",`${xe.nodes.length} elements, ${xe.log.join(", ")}`),{...ne,...xe}}catch(xe){return console.error(xe),ce("Error parsing",lodashExports$1.get(xe,"message")),{error:lodashExports$1.get(xe,"message")}}}}),[me,ge,ue,oe])}const controller$2={key:"map",icon:jsxRuntimeExports.jsx(MapTwoTone,{}),inferName:ne=>{var oe;return(oe=ne==null?void 0:ne.source)!=null&&oe.map?`${ne.source.map.name} (${lodashExports$1.startCase(ne.source.map.format)})`:"Untitled Map"},error:ne=>{var oe,ce;return(ce=(oe=ne==null?void 0:ne.source)==null?void 0:oe.parsedMap)==null?void 0:ce.error},compress:ne=>lodashExports$1.pick(ne,["map","options"]),claimImportedFile:async ne=>lodashExports$1.keys(mapParsers).includes(ext$1(ne.name))?{claimed:!0,layer:async oe=>{oe("Opening map...");try{return{map:{...await readUploadedMap(ne,lodashExports$1.entries(mapParsers).map(([ue])=>({id:ue}))).read()}}}catch(ce){return console.error(ce),oe(`Error opening, ${lodashExports$1.get(ce,"message")}`),{map:{key:nanoid$1(),id:custom$1().id,error:lodashExports$1.get(ce,"message"),name:lodashExports$1.startCase(name$2(ne.name))}}}}}:{claimed:!1},editor:withProduce(({value:ne,produce:oe})=>{var pe,me,ge;const ce=(pe=ne==null?void 0:ne.source)==null?void 0:pe.parsedMap,{result:ue}=useMapOptions(ce);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Option,{label:"Source",content:jsxRuntimeExports.jsx(MapPicker,{value:(me=ne==null?void 0:ne.source)==null?void 0:me.map,onChange:ye=>oe(ve=>lodashExports$1.set(ve,"source.map",ye))})}),(ce==null?void 0:ce.error)&&jsxRuntimeExports.jsx(Type$2,{component:"div",variant:"body2",color:ye=>ye.palette.error.main,sx:{whiteSpace:"pre-wrap",mb:1,mt:1},children:jsxRuntimeExports.jsx("code",{children:ce==null?void 0:ce.error})}),!!ce&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Heading,{label:"Map Options"}),ue?jsxRuntimeExports.jsx(ue,{value:(ge=ne==null?void 0:ne.source)==null?void 0:ge.options,onChange:ye=>oe(ve=>{var xe;lodashExports$1.set(ve,"source.options",ye(((xe=ve.source)==null?void 0:xe.options)??{}))})}):jsxRuntimeExports.jsx(CircularProgress$1,{sx:{mt:2}})]})]})}),renderer:({layer:ne,index:oe})=>{var pe;const{nodes:ce}=((pe=ne==null?void 0:ne.source)==null?void 0:pe.parsedMap)??{},ue=reactExports.useMemo(()=>[lodashExports$1.map(ce,me=>({...me,meta:{...me.meta,sourceLayer:ne==null?void 0:ne.key,sourceLayerIndex:oe,sourceLayerAlpha:1-.01*+((ne==null?void 0:ne.transparency)??0),sourceLayerDisplayMode:(ne==null?void 0:ne.displayMode)??"source-over"}}))],[ce,oe,ne==null?void 0:ne.transparency,ne==null?void 0:ne.displayMode]);return jsxRuntimeExports.jsx(NodeList,{nodes:ue})},service:withProduce(({value:ne,produce:oe})=>{var me,ge;const{result:ce}=useMapContent((me=ne==null?void 0:ne.source)==null?void 0:me.map),{result:ue,loading:pe}=useParsedMap(ce,(ge=ne==null?void 0:ne.source)==null?void 0:ge.options);return useEffectWhen(()=>{pe||oe(ye=>{lodashExports$1.set(ye,"source.parsedMap",ue),lodashExports$1.set(ye,"viewKey",nanoid$1())})},[ue,oe,pe],[ue]),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{})}),provideSelectionInfo:({children:ne,event:oe,layer:ce})=>{const{layer:ue,setLayer:pe,layers:me}=useLayer(ce),{parsedMap:ge}=(ue==null?void 0:ue.source)??{},{point:ye,node:ve}=reactExports.useMemo(()=>{var _e,Se,$e,Re;if(ge&&oe){const Ae=(Re=($e=getParser((Se=(_e=ue==null?void 0:ue.source)==null?void 0:_e.map)==null?void 0:Se.format))==null?void 0:$e.hydrate)==null?void 0:Re.call($e,ge);if(Ae){const Ie=(oe==null?void 0:oe.world)&&Ae.snap(oe.world);if(Ie){const ke=(oe==null?void 0:oe.world)&&Ae.nodeAt(Ie);return{point:Ie,node:ke}}}}return{}},[ge,oe]),xe=reactExports.useMemo(()=>({...ue&&ye&&!lodashExports$1.isUndefined(ve)&&{[ue.key]:{primary:inferLayerName(ue),items:{point:{primary:"Point",secondary:`(${lodashExports$1.round(ye.x,2)}, ${lodashExports$1.round(ye.y,2)})`}}}}}),[ye,ve,ue,me,pe]);return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:ne==null?void 0:ne(xe)})},getSources:ne=>{var ue,pe;const oe=(ue=ne==null?void 0:ne.source)==null?void 0:ue.map,ce=(pe=ne==null?void 0:ne.source)==null?void 0:pe.parsedMap;return oe?[{id:"map",name:`${oe.name}`,language:"txt",content:ce==null?void 0:ce.content}]:[]},onEditSource:(ne,oe,ce)=>ne};function _defineProperty$2(ne,oe,ce){return oe in ne?Object.defineProperty(ne,oe,{value:ce,enumerable:!0,configurable:!0,writable:!0}):ne[oe]=ce,ne}function ownKeys$1(ne,oe){var ce=Object.keys(ne);if(Object.getOwnPropertySymbols){var ue=Object.getOwnPropertySymbols(ne);oe&&(ue=ue.filter(function(pe){return Object.getOwnPropertyDescriptor(ne,pe).enumerable})),ce.push.apply(ce,ue)}return ce}function _objectSpread2$1(ne){for(var oe=1;oe=0)&&(ce[pe]=ne[pe]);return ce}function _objectWithoutProperties(ne,oe){if(ne==null)return{};var ce=_objectWithoutPropertiesLoose(ne,oe),ue,pe;if(Object.getOwnPropertySymbols){var me=Object.getOwnPropertySymbols(ne);for(pe=0;pe=0)&&Object.prototype.propertyIsEnumerable.call(ne,ue)&&(ce[ue]=ne[ue])}return ce}function _slicedToArray$1(ne,oe){return _arrayWithHoles$1(ne)||_iterableToArrayLimit$1(ne,oe)||_unsupportedIterableToArray$1(ne,oe)||_nonIterableRest$1()}function _arrayWithHoles$1(ne){if(Array.isArray(ne))return ne}function _iterableToArrayLimit$1(ne,oe){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(ne)))){var ce=[],ue=!0,pe=!1,me=void 0;try{for(var ge=ne[Symbol.iterator](),ye;!(ue=(ye=ge.next()).done)&&(ce.push(ye.value),!(oe&&ce.length===oe));ue=!0);}catch(ve){pe=!0,me=ve}finally{try{!ue&&ge.return!=null&&ge.return()}finally{if(pe)throw me}}return ce}}function _unsupportedIterableToArray$1(ne,oe){if(ne){if(typeof ne=="string")return _arrayLikeToArray$1(ne,oe);var ce=Object.prototype.toString.call(ne).slice(8,-1);if(ce==="Object"&&ne.constructor&&(ce=ne.constructor.name),ce==="Map"||ce==="Set")return Array.from(ne);if(ce==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ce))return _arrayLikeToArray$1(ne,oe)}}function _arrayLikeToArray$1(ne,oe){(oe==null||oe>ne.length)&&(oe=ne.length);for(var ce=0,ue=new Array(oe);ce+pe);return ue<-2||ue>4?jsxRuntimeExports.jsxs("span",{children:[ce,"x10",jsxRuntimeExports.jsx("sup",{style:supProps,children:ue})]}):lodashExports$1.round(ne,2)}else return ne;case"string":return`${ne}`;case"undefined":return"null";default:return oe?jsxRuntimeExports.jsx("code",{children:lodashExports$1.isNull(ne)?"null":lodashExports$1.get(ne,"constructor.name")??typeof ne}):jsxRuntimeExports.jsx("code",{style:{whiteSpace:"pre"},children:lodashExports$1.truncate(beautify$1(ne,void 0,2),{length:100})})}}function Property({label:ne,value:oe,type:ce,simple:ue}){return jsxRuntimeExports.jsxs(Flex,{width:"auto",mr:2,mb:.5,alignItems:"baseline",children:[jsxRuntimeExports.jsx(Type$2,{component:"div",variant:"body2",...ce,sx:{opacity:.54,...ce==null?void 0:ce.sx},children:ne}),jsxRuntimeExports.jsx(Space,{}),jsxRuntimeExports.jsx(Type$2,{component:"div",variant:"body2",...ce,children:renderProperty(oe,ue)??"none"})]},`${ne}::${renderProperty(oe)}`)}const COMMON_PROPS=["type"],OMIT_PROPS=[...COMMON_PROPS,"id"],ESSENTIAL_PROPS=["id"],GRAPH_PROPS=[...ESSENTIAL_PROPS,"pId"],HEURISTIC_PROPS=["f","g"],ALL_PROPS=[...OMIT_PROPS,...GRAPH_PROPS,...HEURISTIC_PROPS],sortEventKeys=ne=>lodashExports$1.chain(ne).entries().filter(([,oe])=>!lodashExports$1.isUndefined(oe)).sortBy(([oe])=>lodashExports$1.indexOf(ALL_PROPS,oe)+1||Number.MAX_SAFE_INTEGER).value();function PropertyDialog({event:ne,max:oe=10,simple:ce,variant:ue,...pe}){const me=sortEventKeys(ne);return jsxRuntimeExports.jsx(ManagedModal,{...lodashExports$1.merge({appBar:{children:jsxRuntimeExports.jsx(AppBarTitle,{children:"Event Properties"})},trigger:ge=>jsxRuntimeExports.jsxs(Button$2,{variant:"text",sx:{mx:-1,minWidth:0,width:"fit-content",color:ye=>ye.palette.text.secondary,justifyContent:"left"},onClick:ye=>{ye.stopPropagation(),ye.preventDefault(),ge(ye)},children:[me.length-oe," more"]})},pe),children:[{name:"common",props:lodashExports$1.filter(me,([ge])=>COMMON_PROPS.includes(ge))},{name:"Graph",props:lodashExports$1.filter(me,([ge])=>GRAPH_PROPS.includes(ge))},{name:"Heuristic",props:lodashExports$1.filter(me,([ge])=>HEURISTIC_PROPS.includes(ge))},{name:"other",props:lodashExports$1.filter(me,([ge])=>!ALL_PROPS.includes(ge))}].map(({name:ge,props:ye},ve)=>jsxRuntimeExports.jsxs(reactExports.Fragment,{children:[!!ve&&jsxRuntimeExports.jsx(Divider$1,{sx:{mb:1}}),jsxRuntimeExports.jsx(Type$2,{component:"div",variant:"overline",color:"text.secondary",sx:{px:3},children:lodashExports$1.startCase(ge)}),jsxRuntimeExports.jsx(Box$1,{sx:{p:1,pt:0,display:"grid",gridAutoFlow:"row",gridTemplateColumns:"repeat(2, 1fr)"},children:lodashExports$1.map(ye,([xe,_e])=>jsxRuntimeExports.jsx(ListItem$1,{sx:{py:.5},children:jsxRuntimeExports.jsx(ListItemText$1,{secondary:xe,primary:renderProperty(_e)})},`${xe}::${_e}`))},ge)]},ge))})}function PropertyList(ne){const{event:oe,variant:ce="body2",max:ue=10,simple:pe,primitives:me,...ge}=ne,ye=sortEventKeys(oe);return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsxs(Flex,{...ge,children:[lodashExports$1.chain(ye).filter(me?([,ve])=>isPrimitive(ve):lodashExports$1.constant(!0)).slice(0,ue).map(([ve,xe],_e)=>jsxRuntimeExports.jsx(Property,{label:ve,value:xe,type:{variant:ce},simple:pe},_e)).value(),ye.length>ue&&!pe&&jsxRuntimeExports.jsx(PropertyDialog,{...ne})]})})}function isPrimitive(ne){return lodashExports$1.isString(ne)||lodashExports$1.isNumber(ne)}var t$5,e$4,s$2,i$5;(function(ne){ne.HEX="HEX",ne.RGB="RGB",ne.HSL="HSL",ne.CIELab="CIELab",ne.CMYK="CMYK"})(t$5||(t$5={})),function(ne){ne.ANALOGOUS="ANALOGOUS",ne.COMPLEMENTARY="COMPLEMENTARY",ne.SPLIT_COMPLEMENTARY="SPLIT_COMPLEMENTARY",ne.TRIADIC="TRIADIC",ne.TETRADIC="TETRADIC",ne.SQUARE="SQUARE"}(e$4||(e$4={})),function(ne){ne.ADDITIVE="ADDITIVE",ne.SUBTRACTIVE="SUBTRACTIVE"}(s$2||(s$2={})),function(ne){ne.black="#000000",ne.silver="#C0C0C0",ne.gray="#808080",ne.white="#FFFFFF",ne.maroon="#800000",ne.red="#FF0000",ne.purple="#800080",ne.fuchsia="#FF00FF",ne.green="#008000",ne.lime="#00FF00",ne.olive="#808000",ne.yellow="#FFFF00",ne.navy="#000080",ne.blue="#0000FF",ne.teal="#008080",ne.aqua="#00FFFF",ne.orange="#FFA500",ne.aliceblue="#F0F8FF",ne.antiquewhite="#FAEBD7",ne.aquamarine="#7FFFD4",ne.azure="#F0FFFF",ne.beige="#F5F5DC",ne.bisque="#FFE4C4",ne.blanchedalmond="#FFEBCD",ne.blueviolet="#8A2BE2",ne.brown="#A52A2A",ne.burlywood="#DEB887",ne.cadetblue="#5F9EA0",ne.chartreuse="#7FFF00",ne.chocolate="#D2691E",ne.coral="#FF7F50",ne.cornflowerblue="#6495ED",ne.cornsilk="#FFF8DC",ne.crimson="#DC143C",ne.cyan="#00FFFF",ne.darkblue="#00008B",ne.darkcyan="#008B8B",ne.darkgoldenrod="#B8860B",ne.darkgray="#A9A9A9",ne.darkgreen="#006400",ne.darkgrey="#A9A9A9",ne.darkkhaki="#BDB76B",ne.darkmagenta="#8B008B",ne.darkolivegreen="#556B2F",ne.darkorange="#FF8C00",ne.darkorchid="#9932CC",ne.darkred="#8B0000",ne.darksalmon="#E9967A",ne.darkseagreen="#8FBC8F",ne.darkslateblue="#483D8B",ne.darkslategray="#2F4F4F",ne.darkslategrey="#2F4F4F",ne.darkturquoise="#00CED1",ne.darkviolet="#9400D3",ne.deeppink="#FF1493",ne.deepskyblue="#00BFFF",ne.dimgray="#696969",ne.dimgrey="#696969",ne.dodgerblue="#1E90FF",ne.firebrick="#B22222",ne.floralwhite="#FFFAF0",ne.forestgreen="#228B22",ne.gainsboro="#DCDCDC",ne.ghostwhite="#F8F8FF",ne.gold="#FFD700",ne.goldenrod="#DAA520",ne.greenyellow="#ADFF2F",ne.grey="#808080",ne.honeydew="#F0FFF0",ne.hotpink="#FF69B4",ne.indianred="#CD5C5C",ne.indigo="#4B0082",ne.ivory="#FFFFF0",ne.khaki="#F0E68C",ne.lavender="#E6E6FA",ne.lavenderblush="#FFF0F5",ne.lawngreen="#7CFC00",ne.lemonchiffon="#FFFACD",ne.lightblue="#ADD8E6",ne.lightcoral="#F08080",ne.lightcyan="#E0FFFF",ne.lightgoldenrodyellow="#FAFAD2",ne.lightgray="#D3D3D3",ne.lightgreen="#90EE90",ne.lightgrey="#D3D3D3",ne.lightpink="#FFB6C1",ne.lightsalmon="#FFA07A",ne.lightseagreen="#20B2AA",ne.lightskyblue="#87CEFA",ne.lightslategray="#778899",ne.lightslategrey="#778899",ne.lightsteelblue="#B0C4DE",ne.lightyellow="#FFFFE0",ne.limegreen="#32CD32",ne.linen="#FAF0E6",ne.magenta="#FF00FF",ne.mediumaquamarine="#66CDAA",ne.mediumblue="#0000CD",ne.mediumorchid="#BA55D3",ne.mediumpurple="#9370DB",ne.mediumseagreen="#3CB371",ne.mediumslateblue="#7B68EE",ne.mediumspringgreen="#00FA9A",ne.mediumturquoise="#48D1CC",ne.mediumvioletred="#C71585",ne.midnightblue="#191970",ne.mintcream="#F5FFFA",ne.mistyrose="#FFE4E1",ne.moccasin="#FFE4B5",ne.navajowhite="#FFDEAD",ne.oldlace="#FDF5E6",ne.olivedrab="#6B8E23",ne.orangered="#FF4500",ne.orchid="#DA70D6",ne.palegoldenrod="#EEE8AA",ne.palegreen="#98FB98",ne.paleturquoise="#AFEEEE",ne.palevioletred="#DB7093",ne.papayawhip="#FFEFD5",ne.peachpuff="#FFDAB9",ne.peru="#CD853F",ne.pink="#FFC0CB",ne.plum="#DDA0DD",ne.powderblue="#B0E0E6",ne.rosybrown="#BC8F8F",ne.royalblue="#4169E1",ne.saddlebrown="#8B4513",ne.salmon="#FA8072",ne.sandybrown="#F4A460",ne.seagreen="#2E8B57",ne.seashell="#FFF5EE",ne.sienna="#A0522D",ne.skyblue="#87CEEB",ne.slateblue="#6A5ACD",ne.slategray="#708090",ne.slategrey="#708090",ne.snow="#FFFAFA",ne.springgreen="#00FF7F",ne.steelblue="#4682B4",ne.tan="#D2B48C",ne.thistle="#D8BFD8",ne.tomato="#FF6347",ne.turquoise="#40E0D0",ne.violet="#EE82EE",ne.wheat="#F5DEB3",ne.whitesmoke="#F5F5F5",ne.yellowgreen="#9ACD32",ne.rebeccapurple="#663399"}(i$5||(i$5={}));const a$3=Object.keys(i$5),r$4={HEX:["R","G","B","A"],RGB:["R","G","B","A"],HSL:["H","S","L","A"],CIELab:["L","a","b","A"],CMYK:["C","M","Y","K","A"]},n$5={BGR:t$5.RGB,ABGR:t$5.RGB,HLS:t$5.HSL,AHLS:t$5.HSL,LAB:t$5.CIELab,ALAB:t$5.CIELab,CKMY:t$5.CMYK,ACKMY:t$5.CMYK};var c$3;(function(ne){ne.NUMBER="number",ne.BOOLEAN="boolean"})(c$3||(c$3={}));const o$3={[t$5.HEX]:/^#(?:([a-f\d])([a-f\d])([a-f\d])([a-f\d])?|([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?)$/i,[t$5.RGB]:/^rgba?\s*\(\s*(?:((?:\d*\.)?\d+%?)\s*,\s*((?:\d*\.)?\d+%?)\s*,\s*((?:\d*\.)?\d+%?)(?:\s*,\s*((?:\d*\.)?\d+))?|((?:\d*\.)?\d+%?)\s*((?:\d*\.)?\d+%?)\s*((?:\d*\.)?\d+%?)(?:\s*\/\s*((?:\d*\.)?\d+%?))?)\s*\)$/,[t$5.HSL]:/^hsla?\s*\(\s*(?:(-?(?:\d*\.)?\d+(?:deg|grad|rad|turn)?)\s*,\s*((?:\d*\.)?\d+)%\s*,\s*((?:\d*\.)?\d+)%(?:\s*,\s*((?:\d*\.)?\d+))?|(-?(?:\d*\.)?\d+(?:deg|grad|rad|turn)?)\s*((?:\d*\.)?\d+)%\s*((?:\d*\.)?\d+)%(?:\s*\/\s*((?:\d*\.)?\d+%?))?)\s*\)$/,[t$5.CIELab]:/^lab\s*\(\s*(?:((?:\d*\.)?\d+%?)\s*(-?(?:\d*\.)?\d+%?)\s*(-?(?:\d*\.)?\d+%?)(?:\s*\/\s*((?:\d*\.)?\d+%?))?)\s*\)$/,[t$5.CMYK]:/^(?:device-cmyk|cmyk)\s*\(\s*(?:((?:\d*\.)?\d+%?)\s*,\s*((?:\d*\.)?\d+%?)\s*,\s*((?:\d*\.)?\d+%?)\s*,\s*((?:\d*\.)?\d+%?)(?:\s*,\s*((?:\d*\.)?\d+))?|((?:\d*\.)?\d+%?)\s*((?:\d*\.)?\d+%?)\s*((?:\d*\.)?\d+%?)\s*((?:\d*\.)?\d+%?)(?:\s*\/\s*((?:\d*\.)?\d+%?))?)\s*\)$/},A$3=/^(-?(?:\d*\.)?\d+)((?:deg|grad|rad|turn)?)$/,h$6=/^(-?\d+(?:\.\d+)?|-?\.\d+)%$/,u$5=/^0x([a-f\d]{1,2})$/i,d$5=/\{(\d+)\}/g,l$5=/,( +|\d+)/g,E$2=/ +/,m$4="The provided string color doesn't have a correct format",b$4="The provided color object doesn't have the proper keys or format";var C$2,L$2,g$4;(function(ne){ne.NONE="none",ne.DEGREES="deg",ne.GRADIANS="grad",ne.RADIANS="rad",ne.TURNS="turn"})(C$2||(C$2={})),function(ne){ne.NONE="none",ne.PERCENT="percent"}(L$2||(L$2={})),function(ne){ne.DEVICE_CMYK="device-cmyk",ne.CMYK="cmyk"}(g$4||(g$4={}));const B$2={decimals:6,legacyCSS:!1,spacesAfterCommas:!1,anglesUnit:C$2.NONE,rgbUnit:L$2.NONE,labUnit:L$2.NONE,cmykUnit:L$2.PERCENT,alphaUnit:L$2.NONE,cmykFunction:g$4.DEVICE_CMYK},p$5=(ne,oe)=>Object.prototype.hasOwnProperty.call(ne,oe),H$4=ne=>+`${ne}`.replace(h$6,"$1"),F$2=ne=>h$6.test(`${ne}`)?H$4(ne):Math.min(+ne,100),R$2=ne=>(ne.length===1&&(ne+=ne),parseInt(ne,16)),S$3=ne=>{const oe=D$3(ne,0).toString(16).toUpperCase();return oe.length===1?`0x0${oe}`:`0x${oe}`},I$2=(ne,oe=!1)=>!oe&&h$6.test(ne)?Math.min(255*H$4(ne)/100,255):u$5.test(ne)?(ne.length===3&&(ne+=ne.slice(-1)),oe?D$3(ne)/255:D$3(ne)):Math.min(+ne,oe?1:255),G$2=ne=>h$6.test(ne)?f$4(125*H$4(ne)/100,-125,125):f$4(+ne,-125,125),M$3=ne=>Math.min(h$6.test(ne)?H$4(ne)/100:+ne,1),y$2=ne=>[...ne].sort().join("").toUpperCase(),D$3=(ne,oe=6)=>{const ce=Math.pow(10,oe);return Math.round(+ne*ce)/ce},f$4=(ne,oe,ce)=>Math.max(oe,Math.min(ne,ce)),O$1=ne=>{if(typeof ne=="string"){const oe=ne.match(A$3),ce=+oe[1];switch(oe[2]){case C$2.RADIANS:ne=D$3(180*ce/Math.PI);break;case C$2.TURNS:ne=D$3(360*ce);break;case C$2.GRADIANS:ne=D$3(.9*ce);break;case C$2.DEGREES:default:ne=ce}}return(ne>360||ne<0)&&(ne-=360*Math.floor(ne/360)),ne},Y$3=(ne,oe)=>{let ce;switch(oe){case C$2.RADIANS:ce=D$3((ue=>ue*Math.PI/180)(ne));break;case C$2.TURNS:ce=D$3(ne/360);break;case C$2.GRADIANS:ce=D$3(10/9*ne);break;case C$2.DEGREES:case C$2.NONE:default:ce=ne}return ce},k$6=(ne,...oe)=>{const ce=[],ue=[],pe=[],me=[],ge=[],ye=[],ve=Object.values(C$2),xe=Object.values(L$2),_e=Object.values(g$4),Se={legacyCSS:0,spacesAfterCommas:0,cmykFunction:0};for(const $e of oe)if(typeof $e=="string"){if(ce.push($e),$e.includes(",")){Se.legacyCSS++;const Re=$e.match(l$5);new Set(Re).size===1&&E$2.test(Re[0].slice(1))&&Se.spacesAfterCommas++}if($e.match(o$3.HSL)){const Re=$e.match(o$3.HSL),Ae=Re[1]||Re[5],Ie=Re[8],ke=Ae.match(A$3)[2];ue.push(ke===""?C$2.NONE:ke),ye.push(h$6.test(Ie));continue}if(o$3.RGB.test($e)){const Re=$e.match(o$3.RGB),Ae=Re[1]||Re[5],Ie=Re[2]||Re[6],ke=Re[3]||Re[7],Be=Re[8];pe.push(h$6.test(Ae)&&h$6.test(Ie)&&h$6.test(ke)),ye.push(h$6.test(Be));continue}if(o$3.CIELab.test($e)){const Re=$e.match(o$3.CIELab),Ae=Re[1],Ie=Re[2],ke=Re[3],Be=Re[4];me.push(h$6.test(Ae)&&h$6.test(Ie)&&h$6.test(ke)),ye.push(h$6.test(Be));continue}if($e.match(o$3.CMYK)){const Re=$e.match(o$3.CMYK),Ae=Re[1]||Re[6],Ie=Re[2]||Re[7],ke=Re[3]||Re[8],Be=Re[4]||Re[9],Ne=Re[10];ge.push(h$6.test(Ae)&&h$6.test(Ie)&&h$6.test(ke)&&h$6.test(Be)),$e.startsWith("cmyk")&&Se.cmykFunction++,ye.push(h$6.test(Ne))}}return{decimals:typeof ne.decimals===c$3.NUMBER?ne.decimals:B$2.decimals,legacyCSS:typeof ne.legacyCSS===c$3.BOOLEAN?ne.legacyCSS:!!(ce.length&&Se.legacyCSS===ce.length)||B$2.legacyCSS,spacesAfterCommas:typeof ne.spacesAfterCommas===c$3.BOOLEAN?ne.spacesAfterCommas:!!(ce.length&&Se.spacesAfterCommas===ce.length)||B$2.spacesAfterCommas,anglesUnit:ne.anglesUnit&&ve.includes(ne.anglesUnit)?ne.anglesUnit:new Set(ue).size===1?ue[0]:B$2.anglesUnit,rgbUnit:ne.rgbUnit&&xe.includes(ne.rgbUnit)?ne.rgbUnit:new Set(pe).size===1&&pe[0]?L$2.PERCENT:B$2.rgbUnit,labUnit:ne.labUnit&&xe.includes(ne.labUnit)?ne.labUnit:new Set(me).size===1&&me[0]?L$2.PERCENT:B$2.labUnit,cmykUnit:ne.cmykUnit&&xe.includes(ne.cmykUnit)?ne.cmykUnit:new Set(ge).size!==1||ge[0]?B$2.cmykUnit:L$2.NONE,alphaUnit:ne.alphaUnit&&xe.includes(ne.alphaUnit)?ne.alphaUnit:new Set(ye).size===1&&ye[0]?L$2.PERCENT:B$2.alphaUnit,cmykFunction:ne.cmykFunction&&_e.includes(ne.cmykFunction)?ne.cmykFunction:ge.length&&ge.length===Se.cmykFunction?g$4.CMYK:B$2.cmykFunction}},K$2=ne=>`${ne}`in s$2,X$2=[[.4360747,.3850649,.1430804],[.2225045,.7168786,.0606169],[.0139322,.0971045,.7141733]],T$2=[[3.1338561,-1.6168667,-.4906146],[-.9787684,1.9161415,.033454],[.0719453,-.2289914,1.4052427]],N$3=X$2.map(ne=>ne.reduce((oe,ce)=>oe+ce,0)),$$4=(ne,oe,ce)=>(ce<0&&(ce+=6),ce>=6&&(ce-=6),D$3(ce<1?255*((oe-ne)*ce+ne):ce<3?255*oe:ce<4?255*((oe-ne)*(4-ce)+ne):255*ne)),j$3=ne=>ne<=.04045?ne/12.92:((ne+.055)/1.055)**2.4,U$2=ne=>ne<=.0031308?12.92*ne:1.055*ne**(1/2.4)-.055,w$4=(ne,oe,ce,ue)=>{const pe=[0,0,0],me=[ne,oe,ce];return ue.forEach((ge,ye)=>{ge.forEach((ve,xe)=>{pe[ye]+=ve*me[xe]})}),pe},x$2=(ne,oe,ce)=>{oe/=100;const ue=(ce/=100)<=.5?ce*(oe+1):ce+oe-ce*oe,pe=2*ce-ue;return{R:$$4(pe,ue,(ne/=60)+2),G:$$4(pe,ue,ne),B:$$4(pe,ue,ne-2)}},v$5=(ne,oe,ce,ue=1)=>{ne/=255,oe/=255,ce/=255,ue=Math.min(ue,1);const pe=Math.max(ne,oe,ce),me=Math.min(ne,oe,ce),ge=pe-me;let ye=0,ve=0;const xe=(pe+me)/2;if(ge!==0){switch(pe){case ne:ye=(oe-ce)/ge%6;break;case oe:ye=(ce-ne)/ge+2;break;case ce:ye=(ne-oe)/ge+4}ye=D$3(60*ye),ye<0&&(ye+=360),ve=ge/(1-Math.abs(2*xe-1))}return{H:ye,S:D$3(100*ve),L:D$3(100*xe),A:ue}},V$2=(ne,oe,ce)=>{const ue=[ne/255,oe/255,ce/255].map(j$3),pe=w$4(ue[0],ue[1],ue[2],X$2),me=((ge,ye,ve)=>{const xe=$e=>$e>.008856451679035631?Math.cbrt($e):$e/.12841854934601665+.13793103448275862,_e=xe(ge/N$3[0]),Se=xe(ye/N$3[1]);return[116*Se-16,500*(_e-Se),200*(Se-xe(ve/N$3[2]))]})(pe[0],pe[1],pe[2]);return{L:me[0],a:me[1],b:me[2]}},P$1=(ne,oe,ce)=>{const ue=((me,ge,ye)=>{const ve=$e=>$e>.20689655172413793?$e**3:.12841854934601665*($e-.13793103448275862),xe=(me+16)/116,_e=ge/500,Se=ye/200;return[N$3[0]*ve(xe+_e),N$3[1]*ve(xe),N$3[2]*ve(xe-Se)]})(ne,oe,ce),pe=w$4(ue[0],ue[1],ue[2],T$2).map(U$2);return{R:f$4(255*pe[0],0,255),G:f$4(255*pe[1],0,255),B:f$4(255*pe[2],0,255)}},q$5=(ne,oe,ce,ue)=>({R:D$3(255*(1-ne)*(ue=1-ue)),G:D$3(255*(1-oe)*ue),B:D$3(255*(1-ce)*ue)}),_$3=(ne,oe,ce)=>{ne/=255,oe/=255,ce/=255;const ue=1-Math.max(ne,oe,ce),pe=1-ue,me=pe&&(pe-oe)/pe,ge=pe&&(pe-ce)/pe;return{C:D$3(100*(pe&&(pe-ne)/pe)),M:D$3(100*me),Y:D$3(100*ge),K:D$3(100*ue)}},z$3=(ne,oe)=>{if(ne<0&&(ne+=360),ne>360&&(ne-=360),ne===360||ne===0)return ne;const ce=[[0,120],[120,180],[180,240],[240,360]],ue=[[0,60],[60,120],[120,240],[240,360]],pe=oe?ue:ce;let me=0,ge=0,ye=0,ve=0;return(oe?ce:ue).find((xe,_e)=>ne>=xe[0]&&nene?", ":",",W$2=(ne,oe)=>{const ce=y$2(Object.keys(ne));return r$4[n$5[ce]].reduce((ue,pe,me)=>{const ge=ne[pe];return ge!==void 0&&ue.push(oe(ge,me)),ue},[])},J$2=(ne,oe)=>ne.replace(d$5,(ce,ue)=>`${oe[+ue-1]}`),Z$3=(ne,oe,ce=!1)=>{const{alphaUnit:ue,legacyCSS:pe,decimals:me}=oe;return ue!==L$2.PERCENT||pe&&!ce?D$3(ne,me):`${D$3(100*ne,me)}%`},tt$2={[t$5.HEX]:ne=>{const oe=W$2(ne,ue=>(pe=>{let me=D$3(pe,0).toString(16).toUpperCase();return me.length===1&&(me=`0${me}`),me})(D$3(ue))),ce=oe.length===4?"#{1}{2}{3}{4}":"#{1}{2}{3}";return J$2(ce,oe)},[t$5.RGB]:(ne,oe)=>{const{decimals:ce,legacyCSS:ue,spacesAfterCommas:pe,rgbUnit:me}=oe,ge=Q$2(pe),ye=W$2(ne,(xe,_e)=>me===L$2.PERCENT&&_e<3?`${((Se,$e)=>D$3(Se/255*100,$e))(xe,ce)}%`:_e===3?Z$3(xe,oe):D$3(xe,ce)),ve=ue?ye.length===4?`rgba({1}${ge}{2}${ge}{3}${ge}{4})`:`rgb({1}${ge}{2}${ge}{3})`:ye.length===4?"rgb({1} {2} {3} / {4})":"rgb({1} {2} {3})";return J$2(ve,ye)},[t$5.HSL]:(ne,oe)=>{const{decimals:ce,legacyCSS:ue,spacesAfterCommas:pe,anglesUnit:me}=oe,ge=Q$2(pe),ye=W$2(ne,(xe,_e)=>_e===0&&me!==C$2.NONE?`${D$3(Y$3(xe,me),ce)}${me}`:_e===3?Z$3(xe,oe):D$3(xe,ce)),ve=ue?ye.length===4?`hsla({1}${ge}{2}%${ge}{3}%${ge}{4})`:`hsl({1}${ge}{2}%${ge}{3}%)`:ye.length===4?"hsl({1} {2}% {3}% / {4})":"hsl({1} {2}% {3}%)";return J$2(ve,ye)},[t$5.CIELab]:(ne,oe)=>{const{decimals:ce,labUnit:ue}=oe,pe=W$2(ne,(ge,ye)=>{if(ye===0){const ve=D$3(F$2(ge),ce);return ue===L$2.PERCENT?`${ve}%`:`${ve}`}return ye<3?ue===L$2.PERCENT?`${((ve,xe)=>D$3(ve/125*100,xe))(ge,ce)}%`:D$3(ge,ce):Z$3(ge,oe,!0)}),me=pe.length===4?"lab({1} {2} {3} / {4})":"lab({1} {2} {3})";return J$2(me,pe)},[t$5.CMYK]:(ne,oe)=>{const{decimals:ce,legacyCSS:ue,spacesAfterCommas:pe,cmykUnit:me,cmykFunction:ge}=oe,ye=Q$2(pe),ve=W$2(ne,(_e,Se)=>me===L$2.PERCENT&&Se<4?`${D$3(_e,ce)}%`:Se===4?Z$3(_e,oe):D$3(_e/100,ce)),xe=ue?ve.length===5?`${ge}({1}${ye}{2}${ye}{3}${ye}{4}${ye}{5})`:`${ge}({1}${ye}{2}${ye}{3}${ye}{4})`:ve.length===5?`${ge}({1} {2} {3} {4} / {5})`:`${ge}({1} {2} {3} {4})`;return J$2(xe,ve)}},et$2=ne=>(typeof ne=="string"&&(ne=h$6.test(ne)?H$4(ne)/100:+ne),isNaN(+ne)||ne>1?1:D$3(ne)),st$1=(ne,oe,ce)=>oe.reduce((ue,pe)=>[...ue,{...ne,H:ce===s$2.ADDITIVE?O$1(ne.H+pe):O$1(z$3(z$3(ne.H,!1)+pe,!0))}],[{...ne}]),it$1=(ne,oe)=>st$1(ne,[30,-30],oe),at$1=(ne,oe)=>st$1(ne,[180],oe),rt$1=(ne,oe)=>st$1(ne,[150,-150],oe),nt$1=(ne,oe)=>st$1(ne,[120,-120],oe),ct$1=(ne,oe)=>st$1(ne,[60,-120,180],oe),ot$1=(ne,oe)=>st$1(ne,[90,-90,180],oe),At=ne=>typeof ne=="string"?(oe=>{let ce;if(Object.keys(t$5).some(ue=>{if(o$3[ue].test(oe))return ce=ue,!0}),!ce&&~a$3.indexOf(oe)&&(ce=t$5.HEX),!ce)throw new Error(m$4);return ce})(ne):(oe=>{let ce,ue=!1;const pe=y$2(Object.keys(oe));if(n$5[pe]&&(ce=n$5[pe]),ce&&ce===t$5.RGB){const me=Object.entries(oe).some(ye=>!u$5.test(`${ye[1]}`)),ge=Object.entries(oe).some(ye=>!(h$6.test(`${ye[1]}`)||!u$5.test(`${ye[1]}`)&&!isNaN(+ye[1])&&+ye[1]<=255));me&&ge&&(ue=!0),me||(ce=t$5.HEX)}if(!ce||ue)throw new Error(b$4);return ce})(ne),ht$1={[t$5.HEX](ne){const oe=(~a$3.indexOf(ne)?i$5[ne]:ne).match(o$3.HEX),ce={R:R$2(oe[1]||oe[5]),G:R$2(oe[2]||oe[6]),B:R$2(oe[3]||oe[7])},ue=oe[4]||oe[8];return ue!==void 0&&(ce.A=R$2(ue)/255),ce},[t$5.RGB](ne){const oe=ne.match(o$3.RGB),ce=I$2(oe[1]||oe[5]),ue=I$2(oe[2]||oe[6]),pe=I$2(oe[3]||oe[7]),me=oe[4]||oe[8],ge={R:Math.min(ce,255),G:Math.min(ue,255),B:Math.min(pe,255)};return me!==void 0&&(ge.A=et$2(me)),ge},[t$5.HSL](ne){const oe=ne.match(o$3.HSL),ce=O$1(oe[1]||oe[5]),ue=F$2(oe[2]||oe[6]),pe=F$2(oe[3]||oe[7]),me=oe[4]||oe[8],ge=x$2(ce,ue,pe);return me!==void 0&&(ge.A=et$2(me)),ge},[t$5.CIELab](ne){const oe=ne.match(o$3.CIELab),ce=F$2(oe[1]),ue=G$2(oe[2]),pe=G$2(oe[3]),me=oe[4],ge=P$1(ce,ue,pe);return me!==void 0&&(ge.A=et$2(me)),ge},[t$5.CMYK](ne){const oe=ne.match(o$3.CMYK),ce=M$3(oe[1]||oe[6]),ue=M$3(oe[2]||oe[7]),pe=M$3(oe[3]||oe[8]),me=M$3(oe[4]||oe[9]),ge=oe[5]||oe[10],ye=q$5(ce,ue,pe,me);return ge!==void 0&&(ye.A=et$2(ge)),ye}},ut$1={[t$5.HEX](ne){const oe={R:I$2(`${ne.R}`),G:I$2(`${ne.G}`),B:I$2(`${ne.B}`)};return p$5(ne,"A")&&(oe.A=Math.min(I$2(`${ne.A}`,!0),1)),oe},[t$5.RGB](ne){return this.HEX(ne)},[t$5.HSL](ne){const oe=F$2(`${ne.S}`),ce=F$2(`${ne.L}`),ue=x$2(O$1(ne.H),oe,ce);return p$5(ne,"A")&&(ue.A=et$2(ne.A)),ue},[t$5.CIELab](ne){const oe=F$2(`${ne.L}`),ce=G$2(`${ne.a}`),ue=G$2(`${ne.b}`),pe=P$1(oe,ce,ue);return p$5(ne,"A")&&(pe.A=et$2(ne.A)),pe},[t$5.CMYK](ne){const oe=M$3(`${ne.C}`),ce=M$3(`${ne.M}`),ue=M$3(`${ne.Y}`),pe=M$3(`${ne.K}`),me=q$5(oe,ce,ue,pe);return p$5(ne,"A")&&(me.A=et$2(ne.A)),me}},dt$1=(ne,oe=At(ne))=>typeof ne=="string"?ht$1[oe](ne):ut$1[oe](ne),lt={[t$5.HEX]:ne=>({R:S$3(ne.R),G:S$3(ne.G),B:S$3(ne.B)}),HEXA(ne){const oe=lt.HEX(ne);return oe.A=p$5(ne,"A")?S$3(255*ne.A):"0xFF",oe},[t$5.RGB](ne,oe){const ce=Ct(ne,oe);return p$5(ce,"A")&&delete ce.A,ce},RGBA(ne,oe){const ce=lt.RGB(ne,oe);return ce.A=p$5(ne,"A")?D$3(ne.A):1,ce},[t$5.HSL](ne,oe){const ce=v$5(ne.R,ne.G,ne.B);return delete ce.A,Lt(ce,oe)},HSLA(ne,oe){const ce=lt.HSL(ne,oe);return ce.A=p$5(ne,"A")?D$3(ne.A,oe):1,ce},[t$5.CIELab](ne,oe){const ce=V$2(ne.R,ne.G,ne.B);return gt(ce,oe)},CIELabA(ne,oe){const ce=lt.CIELab(ne,oe);return ce.A=p$5(ne,"A")?D$3(ne.A,oe):1,ce},[t$5.CMYK]:(ne,oe)=>Bt(_$3(ne.R,ne.G,ne.B),oe),CMYKA(ne,oe){const ce=lt.CMYK(ne,oe);return ce.A=p$5(ne,"A")?D$3(ne.A,oe):1,ce}},Et=(ne,oe,ce,ue)=>{const pe=At(ne),me=typeof ne=="string",ge=dt$1(ne,pe),ye=typeof ne=="string"&&p$5(ge,"A")||typeof ne!="string"&&p$5(ne,"A"),ve=v$5(ge.R,ge.G,ge.B,ge.A);ye||delete ve.A;const xe=ce?ve.L/(oe+1):(100-ve.L)/(oe+1),_e=Array(oe).fill(null).map((Se,$e)=>({...ve,L:ve.L+xe*($e+1)*(1-2*+ce)}));switch(pe){case t$5.HEX:default:return _e.map(Se=>{const $e=x$2(Se.H,Se.S,Se.L);return ye&&($e.A=Se.A),me?ye?tt$2.HEX({...$e,A:D$3(255*$e.A)}):tt$2.HEX($e):ye?lt.HEXA($e):lt.HEX($e)});case t$5.RGB:return _e.map(Se=>{const $e=x$2(Se.H,Se.S,Se.L);return ye&&($e.A=Se.A),me?tt$2.RGB($e,ue):ye?lt.RGBA($e,ue.decimals):lt.RGB($e,ue.decimals)});case t$5.HSL:return _e.map(Se=>me?tt$2.HSL(Se,ue):ye?lt.HSLA({...x$2(Se.H,Se.S,Se.L),A:Se.A},ue.decimals):lt.HSL(x$2(Se.H,Se.S,Se.L),ue.decimals));case t$5.CIELab:return _e.map(Se=>{const $e=x$2(Se.H,Se.S,Se.L);return me?tt$2.CIELab(ye?lt.CIELabA($e,ue.decimals):lt.CIELab($e,ue.decimals),ue):ye?lt.CIELabA({...$e,A:Se.A},ue.decimals):lt.CIELab($e,ue.decimals)})}},mt={buildHarmony(ne,oe,ce,ue){const pe=At(ne),me=dt$1(ne,pe),ge=v$5(me.R,me.G,me.B,me.A),ye=typeof ne=="string"&&p$5(me,"A")||typeof ne!="string"&&p$5(ne,"A"),ve=typeof ne=="string";switch(pe){case t$5.HEX:default:return ye?this.HEXA(Lt(ge,0),oe,ce,ve):this.HEX(Lt(ge,0),oe,ce,ve);case t$5.HSL:return ye?this.HSLA(ge,oe,ce,ve,ue):this.HSL(ge,oe,ce,ve,ue);case t$5.RGB:return ye?this.RGBA(ge,oe,ce,ve,ue):this.RGB(ge,oe,ce,ve,ue);case t$5.CIELab:return ye?this.CIELabA(ge,oe,ce,ve,ue):this.CIELab(ge,oe,ce,ve,ue)}},[t$5.HEX]:(ne,oe,ce,ue)=>oe(ne,ce).map(pe=>ue?tt$2.HEX(x$2(pe.H,pe.S,pe.L)):lt.HEX(x$2(pe.H,pe.S,pe.L))),HEXA:(ne,oe,ce,ue)=>oe(ne,ce).map(pe=>ue?tt$2.HEX({...x$2(pe.H,pe.S,pe.L),A:255*et$2(pe.A)}):lt.HEXA({...x$2(pe.H,pe.S,pe.L),A:et$2(pe.A)})),[t$5.RGB]:(ne,oe,ce,ue,pe)=>oe(ne,ce).map(me=>ue?tt$2.RGB(x$2(me.H,me.S,me.L),pe):lt.RGB(x$2(me.H,me.S,me.L),pe.decimals)),RGBA:(ne,oe,ce,ue,pe)=>oe(ne,ce).map(me=>ue?tt$2.RGB({...x$2(me.H,me.S,me.L),A:et$2(me.A)},pe):lt.RGBA({...x$2(me.H,me.S,me.L),A:et$2(me.A)},pe.decimals)),[t$5.HSL]:(ne,oe,ce,ue,pe)=>oe(ne,ce).map(me=>ue?tt$2.HSL({H:me.H,S:me.S,L:me.L},pe):lt.HSL(x$2(me.H,me.S,me.L),pe.decimals)),HSLA:(ne,oe,ce,ue,pe)=>oe(ne,ce).map(me=>ue?tt$2.HSL({...me,A:et$2(me.A)},pe):lt.HSLA({...x$2(me.H,me.S,me.L),A:et$2(me.A)},pe.decimals)),[t$5.CIELab]:(ne,oe,ce,ue,pe)=>oe(ne,ce).map(me=>{const ge=x$2(me.H,me.S,me.L);return ue?tt$2.CIELab(V$2(ge.R,ge.G,ge.B),pe):lt.CIELab(ge,pe.decimals)}),CIELabA:(ne,oe,ce,ue,pe)=>oe(ne,ce).map(me=>{const ge=x$2(me.H,me.S,me.L);return ue?tt$2.CIELab({...V$2(ge.R,ge.G,ge.B),A:et$2(me.A)},pe):lt.CIELabA({...ge,A:et$2(me.A)},pe.decimals)})},bt={mix(ne,oe){const ce=ne.map(ge=>{const ye=At(ge);return dt$1(ge,ye)}),ue=oe===s$2.SUBTRACTIVE?ce.map(ge=>{const ye=((ve,xe,_e)=>{const Se=Math.min(ve,xe,_e),$e=Math.min(255-ve,255-xe,255-_e),Re=ve-Se,Ae=xe-Se,Ie=_e-Se,ke=Math.min(Re,Ae),Be=Re-ke,Ne=(Ae+ke)/2,Fe=(Ie+Ae-ke)/2,Ue=Math.max(Be,Ne,Fe)/Math.max(Re,Ae,Ie),We=isNaN(Ue)||Ue===1/0||Ue<=0?1:Ue;return{R:Be/We+$e,Y:Ne/We+$e,B:Fe/We+$e}})(ge.R,ge.G,ge.B);return p$5(ge,"A")&&(ye.A=ge.A),ye}):null;function pe(ge){const ye=oe===s$2.ADDITIVE?{R:0,G:0,B:0,A:0}:{R:0,Y:0,B:0,A:0};return ge.reduce((ve,xe)=>{const _e=p$5(xe,"A")?xe.A:1,Se={R:Math.min(ve.R+xe.R*_e,255),B:Math.min(ve.B+xe.B*_e,255),A:1-(1-_e)*(1-ve.A)},$e="G"in ve?ve.G:ve.Y,Re="G"in xe?xe.G:xe.Y;return{...Se,...oe===s$2.ADDITIVE?{G:Math.min($e+Re*_e,255)}:{Y:Math.min($e+Re*_e,255)}}},ye)}let me;if(oe===s$2.ADDITIVE)me=pe(ce);else{const ge=pe(ue);me=((ye,ve,xe)=>{const _e=Math.min(ye,ve,xe),Se=Math.min(255-ye,255-ve,255-xe),$e=ye-_e,Re=ve-_e,Ae=xe-_e,Ie=Math.min(Re,Ae),ke=$e+Re-Ie,Be=Re+Ie,Ne=2*(Ae-Ie),Fe=Math.max(ke,Be,Ne)/Math.max($e,Re,Ae),Ue=isNaN(Fe)||Fe===1/0||Fe<=0?1:Fe;return{R:ke/Ue+Se,G:Be/Ue+Se,B:Ne/Ue+Se}})(ge.R,ge.Y,ge.B),me.A=ge.A}return{R:D$3(me.R),G:D$3(me.G),B:D$3(me.B),A:f$4(me.A,0,1)}},[t$5.HEX](ne,oe,ce){const ue=this.mix(ne,oe);return delete ue.A,ce?tt$2.HEX(ue):lt.HEX(ue)},HEXA(ne,oe,ce){const ue=this.mix(ne,oe);return ue.A=ce?255*et$2(ue.A):et$2(ue.A),ce?tt$2.HEX(ue):lt.HEXA(ue)},[t$5.RGB](ne,oe,ce,ue){const pe=this.mix(ne,oe);return delete pe.A,ce?tt$2.RGB(pe,ue):lt.RGB(pe,ue.decimals)},RGBA(ne,oe,ce,ue){const pe=this.mix(ne,oe);return ce?tt$2.RGB(pe,ue):lt.RGBA(pe,ue.decimals)},[t$5.HSL](ne,oe,ce,ue){const pe=this.mix(ne,oe),me=v$5(pe.R,pe.G,pe.B);return delete pe.A,delete me.A,ce?tt$2.HSL(me,ue):lt.HSL(pe,ue.decimals)},HSLA(ne,oe,ce,ue){const pe=this.mix(ne,oe),me=v$5(pe.R,pe.G,pe.B,pe.A);return ce?tt$2.HSL(me,ue):lt.HSLA(pe,ue.decimals)},[t$5.CIELab](ne,oe,ce,ue){const pe=this.mix(ne,oe),me=V$2(pe.R,pe.G,pe.B);return delete pe.A,ce?tt$2.CIELab(me,ue):lt.CIELabA(pe,ue.decimals)},CIELabA(ne,oe,ce,ue){const pe=this.mix(ne,oe),me=V$2(pe.R,pe.G,pe.B);return p$5(pe,"A")&&(me.A=pe.A),ce?tt$2.CIELab(me,ue):lt.CIELabA(pe,ue.decimals)}},Ct=(ne,oe)=>({R:D$3(ne.R,oe),G:D$3(ne.G,oe),B:D$3(ne.B,oe),...p$5(ne,"A")?{A:D$3(ne.A,oe)}:{}}),Lt=(ne,oe)=>({H:D$3(ne.H,oe),S:D$3(ne.S,oe),L:D$3(ne.L,oe),...p$5(ne,"A")?{A:D$3(ne.A,oe)}:{}}),gt=(ne,oe)=>({L:D$3(ne.L,oe),a:D$3(ne.a,oe),b:D$3(ne.b,oe)}),Bt=(ne,oe)=>({C:D$3(ne.C,oe),M:D$3(ne.M,oe),Y:D$3(ne.Y,oe),K:D$3(ne.K,oe)}),pt=(ne,oe,ce,ue)=>ue(dt$1(ne,oe),ce),Ht=(ne,oe,ce,ue,pe)=>(ce<1&&(ce=5),((ge,ye,ve)=>{const xe=ve-1,_e=(ye.R-ge.R)/xe,Se=(ye.G-ge.G)/xe,$e=(ye.B-ge.B)/xe,Re=et$2(ge.A),Ae=(et$2(ye.A)-Re)/xe;return Array(ve).fill(null).map((Ie,ke)=>ke===0?ge:ke===xe?ye:{R:D$3(ge.R+_e*ke),G:D$3(ge.G+Se*ke),B:D$3(ge.B+$e*ke),A:D$3(Re+Ae*ke)})})(dt$1(ne),dt$1(oe),ce).map(ge=>pe(ge,ue))),Ft$1=(ne,oe,ce,ue)=>({[e$4.ANALOGOUS]:mt.buildHarmony(oe,it$1,ce,ue),[e$4.COMPLEMENTARY]:mt.buildHarmony(oe,at$1,ce,ue),[e$4.SPLIT_COMPLEMENTARY]:mt.buildHarmony(oe,rt$1,ce,ue),[e$4.TRIADIC]:mt.buildHarmony(oe,nt$1,ce,ue),[e$4.TETRADIC]:mt.buildHarmony(oe,ct$1,ce,ue),[e$4.SQUARE]:mt.buildHarmony(oe,ot$1,ce,ue)})[ne];class Rt{constructor(oe,ce={}){this._options=k$6(ce,oe),this.rgb=dt$1(oe),this.updateHSL(),this.updateLab(),this.updateCMYK()}updateRGB(){this.rgb={...x$2(this.hsl.H,this.hsl.S,this.hsl.L),A:this.hsl.A}}updateRGBFromCMYK(){this.rgb={...q$5(this.cmyk.C,this.cmyk.M,this.cmyk.Y,this.cmyk.K),A:this.rgb.A}}updateRGBFromLab(){this.rgb={...P$1(this.lab.L,this.lab.a,this.lab.b),A:this.rgb.A}}updateHSL(){this.hsl=v$5(this.rgb.R,this.rgb.G,this.rgb.B,this.rgb.A)}updateLab(){this.lab={...V$2(this.rgb.R,this.rgb.G,this.rgb.B),A:this.rgb.A}}updateCMYK(){this.cmyk=_$3(this.rgb.R,this.rgb.G,this.rgb.B)}setOptions(oe={}){return this._options={...this._options,...oe},this}setH(oe){return this.hsl.H=O$1(oe),this.updateRGB(),this.updateLab(),this.updateCMYK(),this}setS(oe){return this.hsl.S=f$4(oe,0,100),this.updateRGB(),this.updateLab(),this.updateCMYK(),this}setL(oe){return this.hsl.L=f$4(oe,0,100),this.updateRGB(),this.updateLab(),this.updateCMYK(),this}setR(oe){this.rgb.R=f$4(oe,0,255),this.updateHSL(),this.updateLab(),this.updateCMYK()}setG(oe){return this.rgb.G=f$4(oe,0,255),this.updateHSL(),this.updateLab(),this.updateCMYK(),this}setB(oe){return this.rgb.B=f$4(oe,0,255),this.updateHSL(),this.updateLab(),this.updateCMYK(),this}setCIEL(oe){return this.lab.L=f$4(oe,0,100),this.updateRGBFromLab(),this.updateHSL(),this.updateCMYK(),this}setCIEa(oe){return this.lab.a=f$4(oe,-125,125),this.updateRGBFromLab(),this.updateHSL(),this.updateCMYK(),this}setCIEb(oe){return this.lab.b=f$4(oe,-125,125),this.updateRGBFromLab(),this.updateHSL(),this.updateCMYK(),this}setA(oe){return this.hsl.A=this.rgb.A=f$4(oe,0,1),this}setC(oe){return this.cmyk.C=f$4(oe,0,100),this.updateRGBFromCMYK(),this.updateHSL(),this.updateLab(),this}setM(oe){return this.cmyk.M=f$4(oe,0,100),this.updateRGBFromCMYK(),this.updateHSL(),this.updateLab(),this}setY(oe){return this.cmyk.Y=f$4(oe,0,100),this.updateRGBFromCMYK(),this.updateHSL(),this.updateLab(),this}setK(oe){return this.cmyk.K=f$4(oe,0,100),this.updateRGBFromCMYK(),this.updateHSL(),this.updateLab(),this}get options(){return this._options}get H(){return D$3(this.hsl.H,this.options.decimals)}get S(){return D$3(this.hsl.S,this.options.decimals)}get L(){return D$3(this.hsl.L,this.options.decimals)}get CIEL(){return D$3(this.lab.L,this.options.decimals)}get CIEa(){return D$3(this.lab.a,this.options.decimals)}get CIEb(){return D$3(this.lab.b,this.options.decimals)}get R(){return D$3(this.rgb.R,this.options.decimals)}get G(){return D$3(this.rgb.G,this.options.decimals)}get B(){return D$3(this.rgb.B,this.options.decimals)}get A(){return D$3(this.hsl.A,this.options.decimals)}get C(){return D$3(this.cmyk.C,this.options.decimals)}get M(){return D$3(this.cmyk.M,this.options.decimals)}get Y(){return D$3(this.cmyk.Y,this.options.decimals)}get K(){return D$3(this.cmyk.K,this.options.decimals)}get HEXObject(){return lt.HEX(this.rgb)}get HEXAObject(){return lt.HEXA(this.rgb)}get RGBObject(){return{R:this.R,G:this.G,B:this.B}}get RGBAObject(){return{...this.RGBObject,A:this.A}}get HSLObject(){return{H:this.H,S:this.S,L:this.L}}get HSLAObject(){return{...this.HSLObject,A:this.A}}get CIELabObject(){return{L:this.CIEL,a:this.CIEa,b:this.CIEb}}get CIELabAObject(){return{...this.CIELabObject,A:this.A}}get CMYKObject(){return{C:this.C,M:this.M,Y:this.Y,K:this.K}}get CMYKAObject(){return{...this.CMYKObject,A:this.A}}get HEX(){return tt$2.HEX({R:this.R,G:this.G,B:this.B})}get HEXA(){return tt$2.HEX({R:this.R,G:this.G,B:this.B,A:255*this.A})}get RGB(){return tt$2.RGB({R:this.R,G:this.G,B:this.B},this.options)}get RGBA(){return tt$2.RGB({R:this.R,G:this.G,B:this.B,A:this.A},this.options)}get HSL(){return tt$2.HSL({H:this.H,S:this.S,L:this.L},this.options)}get HSLA(){return tt$2.HSL({H:this.H,S:this.S,L:this.L,A:this.A},this.options)}get CIELab(){return tt$2.CIELab({L:this.CIEL,a:this.CIEa,b:this.CIEb},this.options)}get CIELabA(){return tt$2.CIELab({L:this.CIEL,a:this.CIEa,b:this.CIEb,A:this.A},this.options)}get CMYK(){return tt$2.CMYK({C:this.C,M:this.M,Y:this.Y,K:this.K},this.options)}get CMYKA(){return tt$2.CMYK({C:this.C,M:this.M,Y:this.Y,K:this.K,A:this.A},this.options)}static toHEXObject(oe){const ce=At(oe);return pt(oe,ce,0,lt.HEX)}static toHEX(oe){return tt$2.HEX(Rt.toHEXObject(oe))}static toHEXAObject(oe){const ce=At(oe);return pt(oe,ce,0,lt.HEXA)}static toHEXA(oe){return tt$2.HEX(Rt.toHEXAObject(oe))}static toRGBObject(oe,ce={}){const ue=At(oe);return pt(oe,ue,ce.decimals,lt.RGB)}static toRGB(oe,ce={}){const ue=At(oe),pe=k$6(ce,oe),me=pt(oe,ue,ce.decimals,lt.RGB);return tt$2.RGB(me,pe)}static toRGBAObject(oe,ce={}){const ue=At(oe);return pt(oe,ue,ce.decimals,lt.RGBA)}static toRGBA(oe,ce={}){const ue=At(oe),pe=k$6(ce,oe),me=pt(oe,ue,ce.decimals,lt.RGBA);return tt$2.RGB(me,pe)}static toHSLObject(oe,ce={}){const ue=At(oe);return pt(oe,ue,ce.decimals,lt.HSL)}static toHSL(oe,ce={}){const ue=At(oe),pe=k$6(ce,oe),me=pt(oe,ue,ce.decimals,lt.HSL);return tt$2.HSL(me,pe)}static toHSLAObject(oe,ce={}){const ue=At(oe);return pt(oe,ue,ce.decimals,lt.HSLA)}static toHSLA(oe,ce={}){const ue=At(oe),pe=k$6(ce,oe),me=pt(oe,ue,ce.decimals,lt.HSLA);return tt$2.HSL(me,pe)}static toCIELabObject(oe,ce={}){const ue=At(oe);return pt(oe,ue,ce.decimals,lt.CIELab)}static toCIELab(oe,ce={}){const ue=At(oe),pe=k$6(ce,oe),me=pt(oe,ue,ce.decimals,lt.CIELab);return tt$2.CIELab(me,pe)}static toCIELabAObject(oe,ce={}){const ue=At(oe);return pt(oe,ue,ce.decimals,lt.CIELabA)}static toCIELabA(oe,ce={}){const ue=At(oe),pe=k$6(ce,oe),me=pt(oe,ue,ce.decimals,lt.CIELabA);return tt$2.CIELab(me,pe)}static toCMYKObject(oe,ce={}){const ue=At(oe);return pt(oe,ue,ce.decimals,lt.CMYK)}static toCMYK(oe,ce={}){const ue=At(oe),pe=k$6(ce,oe),me=pt(oe,ue,ce.decimals,lt.CMYK);return tt$2.CMYK(me,pe)}static toCMYKAObject(oe,ce={}){const ue=At(oe);return pt(oe,ue,ce.decimals,lt.CMYKA)}static toCMYKA(oe,ce={}){const ue=At(oe),pe=k$6(ce,oe),me=pt(oe,ue,ce.decimals,lt.CMYKA);return tt$2.CMYK(me,pe)}static getBlendHEXObject(oe,ce,ue=5){return Ht(oe,ce,ue,0,lt.HEX)}static getBlendHEX(oe,ce,ue=5){return Rt.getBlendHEXObject(oe,ce,ue).map(pe=>tt$2.HEX(pe))}static getBlendHEXAObject(oe,ce,ue=5){return Ht(oe,ce,ue,0,lt.HEXA)}static getBlendHEXA(oe,ce,ue=5){return Rt.getBlendHEXAObject(oe,ce,ue).map(pe=>tt$2.HEX(pe))}static getBlendRGBObject(oe,ce,ue,pe){return typeof ue=="number"?Ht(oe,ce,ue,pe==null?void 0:pe.decimals,lt.RGB):Ht(oe,ce,5,ue==null?void 0:ue.decimals,lt.RGB)}static getBlendRGB(oe,ce,ue,pe){return typeof ue=="number"?Ht(oe,ce,ue,pe==null?void 0:pe.decimals,lt.RGB).map(me=>tt$2.RGB(me,k$6(pe||{},oe,ce))):Ht(oe,ce,5,ue==null?void 0:ue.decimals,lt.RGB).map(me=>tt$2.RGB(me,k$6(ue||{},oe,ce)))}static getBlendRGBAObject(oe,ce,ue,pe){return typeof ue=="number"?Ht(oe,ce,ue,pe==null?void 0:pe.decimals,lt.RGBA):Ht(oe,ce,5,ue==null?void 0:ue.decimals,lt.RGBA)}static getBlendRGBA(oe,ce,ue,pe){return typeof ue=="number"?Ht(oe,ce,ue,pe==null?void 0:pe.decimals,lt.RGBA).map(me=>tt$2.RGB(me,k$6(pe||{},oe,ce))):Ht(oe,ce,5,ue==null?void 0:ue.decimals,lt.RGBA).map(me=>tt$2.RGB(me,k$6(ue||{},oe,ce)))}static getBlendHSLObject(oe,ce,ue,pe){return Ht(oe,ce,typeof ue=="number"?ue:5,pe==null?void 0:pe.decimals,lt.HSL)}static getBlendHSL(oe,ce,ue,pe){return typeof ue=="number"?Ht(oe,ce,ue,pe==null?void 0:pe.decimals,lt.HSL).map(me=>tt$2.HSL(me,k$6(pe||{},oe,ce))):Ht(oe,ce,5,ue==null?void 0:ue.decimals,lt.HSL).map(me=>tt$2.HSL(me,k$6(ue||{},oe,ce)))}static getBlendHSLAObject(oe,ce,ue,pe){return typeof ue=="number"?Ht(oe,ce,ue,pe==null?void 0:pe.decimals,lt.HSLA):Ht(oe,ce,5,ue==null?void 0:ue.decimals,lt.HSLA)}static getBlendHSLA(oe,ce,ue,pe){return typeof ue=="number"?Ht(oe,ce,ue,pe==null?void 0:pe.decimals,lt.HSLA).map(me=>tt$2.HSL(me,k$6(pe||{},oe,ce))):Ht(oe,ce,5,ue==null?void 0:ue.decimals,lt.HSLA).map(me=>tt$2.HSL(me,k$6(ue||{},oe,ce)))}static getBlendCIELabObject(oe,ce,ue,pe){return typeof ue=="number"?Ht(oe,ce,ue,pe==null?void 0:pe.decimals,lt.CIELab):Ht(oe,ce,5,ue==null?void 0:ue.decimals,lt.CIELab)}static getBlendCIELab(oe,ce,ue,pe){return typeof ue=="number"?Ht(oe,ce,ue,pe==null?void 0:pe.decimals,lt.CIELab).map(me=>tt$2.CIELab(me,k$6(pe||{},oe,ce))):Ht(oe,ce,5,ue==null?void 0:ue.decimals,lt.CIELab).map(me=>tt$2.CIELab(me,k$6(ue||{},oe,ce)))}static getBlendCIELabAObject(oe,ce,ue,pe){return typeof ue=="number"?Ht(oe,ce,ue,pe==null?void 0:pe.decimals,lt.CIELabA):Ht(oe,ce,5,ue==null?void 0:ue.decimals,lt.CIELabA)}static getBlendCIELabA(oe,ce,ue,pe){return typeof ue=="number"?Ht(oe,ce,ue,pe==null?void 0:pe.decimals,lt.CIELabA).map(me=>tt$2.CIELab(me,k$6(pe||{},oe,ce))):Ht(oe,ce,5,ue==null?void 0:ue.decimals,lt.CIELabA).map(me=>tt$2.CIELab(me,k$6(ue||{},oe,ce)))}static getMixHEXObject(oe,ce=s$2.ADDITIVE){return bt.HEX(oe,ce,!1)}static getMixHEX(oe,ce=s$2.ADDITIVE){return bt.HEX(oe,ce,!0)}static getMixHEXAObject(oe,ce=s$2.ADDITIVE){return bt.HEXA(oe,ce,!1)}static getMixHEXA(oe,ce=s$2.ADDITIVE){return bt.HEXA(oe,ce,!0)}static getMixRGBObject(oe,ce,ue){return typeof ce=="string"?bt.RGB(oe,ce,!1,k$6(ue||{},...oe)):bt.RGB(oe,s$2.ADDITIVE,!1,k$6(ce||{},...oe))}static getMixRGB(oe,ce,ue){return typeof ce=="string"?bt.RGB(oe,ce,!0,k$6(ue||{},...oe)):bt.RGB(oe,s$2.ADDITIVE,!0,k$6(ce||{},...oe))}static getMixRGBAObject(oe,ce,ue){return typeof ce=="string"?bt.RGBA(oe,ce,!1,k$6(ue||{},...oe)):bt.RGBA(oe,s$2.ADDITIVE,!1,k$6(ce||{},...oe))}static getMixRGBA(oe,ce,ue){return typeof ce=="string"?bt.RGBA(oe,ce,!0,k$6(ue||{},...oe)):bt.RGBA(oe,s$2.ADDITIVE,!0,k$6(ce||{},...oe))}static getMixHSLObject(oe,ce,ue){return typeof ce=="string"?bt.HSL(oe,ce,!1,k$6(ue||{},...oe)):bt.HSL(oe,s$2.ADDITIVE,!1,k$6(ce||{},...oe))}static getMixHSL(oe,ce,ue){return typeof ce=="string"?bt.HSL(oe,ce,!0,k$6(ue||{},...oe)):bt.HSL(oe,s$2.ADDITIVE,!0,k$6(ce||{},...oe))}static getMixHSLAObject(oe,ce,ue){return typeof ce=="string"?bt.HSLA(oe,ce,!1,k$6(ue||{},...oe)):bt.HSLA(oe,s$2.ADDITIVE,!1,k$6(ce||{},...oe))}static getMixHSLA(oe,ce,ue){return typeof ce=="string"?bt.HSLA(oe,ce,!0,k$6(ue||{},...oe)):bt.HSLA(oe,s$2.ADDITIVE,!0,k$6(ce||{},...oe))}static getMixCIELabObject(oe,ce,ue){return typeof ce=="string"?bt.CIELab(oe,ce,!1,k$6(ue||{},...oe)):bt.CIELab(oe,s$2.ADDITIVE,!1,k$6(ce||{},...oe))}static getMixCIELab(oe,ce,ue){return typeof ce=="string"?bt.CIELab(oe,ce,!0,k$6(ue||{},...oe)):bt.CIELab(oe,s$2.ADDITIVE,!0,k$6(ce||{},...oe))}static getMixCIELabAObject(oe,ce,ue){return typeof ce=="string"?bt.CIELabA(oe,ce,!1,k$6(ue||{},...oe)):bt.CIELabA(oe,s$2.ADDITIVE,!1,k$6(ce||{},...oe))}static getMixCIELabA(oe,ce,ue){return typeof ce=="string"?bt.CIELabA(oe,ce,!0,k$6(ue||{},...oe)):bt.CIELabA(oe,s$2.ADDITIVE,!0,k$6(ce||{},...oe))}static getShades(oe,ce,ue){return typeof ce=="number"?Et(oe,ce,!0,k$6(ue||{},oe)):Et(oe,5,!0,k$6(ce||{},oe))}static getTints(oe,ce,ue){return typeof ce=="number"?Et(oe,ce,!1,k$6(ue||{},oe)):Et(oe,5,!1,k$6(ce||{},oe))}static getHarmony(oe,ce,ue,pe){return`${ce}`in e$4?Ft$1(ce,oe,K$2(ue)?ue:s$2.ADDITIVE,k$6(K$2(ue)?pe||{}:ue||{},oe)):K$2(ce)?Ft$1(e$4.COMPLEMENTARY,oe,ce,k$6(ue||{},oe)):Ft$1(e$4.COMPLEMENTARY,oe,s$2.ADDITIVE,k$6(ce||{},oe))}}function hash(ne){let oe=5381,ce=ne.length;for(;ce;)oe=oe*33^ne.charCodeAt(--ce);return oe>>>0}const tint="500";function hex(ne){return parseInt(ne.replace("#","0x"))}const searchEventAliases=lodashExports$1.thru({source:["source","start"],destination:["destination","goal","finish"],updating:["update","updating"],expanding:["expanding","expanding"],generating:["generate","generating","open","opening"],closing:["close","closing"],end:["finish","end"]},ne=>{const oe={};for(const[ce,ue]of lodashExports$1.entries(ne))for(const pe of ue)oe[pe]=ce;return oe}),colorsHex={source:green$1.A400,destination:red$1.A400,updating:orange$1[tint],expanding:deepPurple$1[tint],generating:amber$1[tint],closing:pink$1[tint],end:blue$1.A400};lodashExports$1.mapValues(colorsHex,hex);const shades=lodashExports$1.sortBy(lodashExports$1.keys(accentColors),ne=>new Rt(getShade(ne,"dark")).H);function getColorHex(ne="",oe){const ce=searchEventAliases[lodashExports$1.lowerCase(ne)];if(ce)return colorsHex[ce];if(oe)return oe;{const ue=hash(lodashExports$1.lowerCase(ne)),pe=lodashExports$1.values(accentColors);return pe[ue%pe.length][tint]}}function inferLayerName(ne){var oe;return ne!=null&&ne.name?ne==null?void 0:ne.name:(oe=ne==null?void 0:ne.source)!=null&&oe.type?getController(ne).inferName(ne):"Untitled Layer"}let windowObject;typeof window<"u"?windowObject=window:typeof self<"u"?windowObject=self:windowObject=global;let cancelFrame=null,requestFrame=null;const TIMEOUT_DURATION=20,clearTimeoutFn=windowObject.clearTimeout,setTimeoutFn=windowObject.setTimeout,cancelAnimationFrameFn=windowObject.cancelAnimationFrame||windowObject.mozCancelAnimationFrame||windowObject.webkitCancelAnimationFrame,requestAnimationFrameFn=windowObject.requestAnimationFrame||windowObject.mozRequestAnimationFrame||windowObject.webkitRequestAnimationFrame;cancelAnimationFrameFn==null||requestAnimationFrameFn==null?(cancelFrame=clearTimeoutFn,requestFrame=function(oe){return setTimeoutFn(oe,TIMEOUT_DURATION)}):(cancelFrame=function([oe,ce]){cancelAnimationFrameFn(oe),clearTimeoutFn(ce)},requestFrame=function(oe){const ce=requestAnimationFrameFn(function(){clearTimeoutFn(ue),oe()}),ue=setTimeoutFn(function(){cancelAnimationFrameFn(ce),oe()},TIMEOUT_DURATION);return[ce,ue]});function createDetectElementResize(ne){let oe,ce,ue,pe,me,ge,ye;const ve=typeof document<"u"&&document.attachEvent;if(!ve){ge=function(Be){const Ne=Be.__resizeTriggers__,Fe=Ne.firstElementChild,Ue=Ne.lastElementChild,We=Fe.firstElementChild;Ue.scrollLeft=Ue.scrollWidth,Ue.scrollTop=Ue.scrollHeight,We.style.width=Fe.offsetWidth+1+"px",We.style.height=Fe.offsetHeight+1+"px",Fe.scrollLeft=Fe.scrollWidth,Fe.scrollTop=Fe.scrollHeight},me=function(Be){return Be.offsetWidth!==Be.__resizeLast__.width||Be.offsetHeight!==Be.__resizeLast__.height},ye=function(Be){if(Be.target.className&&typeof Be.target.className.indexOf=="function"&&Be.target.className.indexOf("contract-trigger")<0&&Be.target.className.indexOf("expand-trigger")<0)return;const Ne=this;ge(this),this.__resizeRAF__&&cancelFrame(this.__resizeRAF__),this.__resizeRAF__=requestFrame(function(){me(Ne)&&(Ne.__resizeLast__.width=Ne.offsetWidth,Ne.__resizeLast__.height=Ne.offsetHeight,Ne.__resizeListeners__.forEach(function(We){We.call(Ne,Be)}))})};let $e=!1,Re="";ue="animationstart";const Ae="Webkit Moz O ms".split(" ");let Ie="webkitAnimationStart animationstart oAnimationStart MSAnimationStart".split(" "),ke="";{const Be=document.createElement("fakeelement");if(Be.style.animationName!==void 0&&($e=!0),$e===!1){for(let Ne=0;Ne div, .contract-trigger:before { content: " "; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; z-index: -1; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }',Ae=$e.head||$e.getElementsByTagName("head")[0],Ie=$e.createElement("style");Ie.id="detectElementResize",Ie.type="text/css",ne!=null&&Ie.setAttribute("nonce",ne),Ie.styleSheet?Ie.styleSheet.cssText=Re:Ie.appendChild($e.createTextNode(Re)),Ae.appendChild(Ie)}};return{addResizeListener:function($e,Re){if(ve)$e.attachEvent("onresize",Re);else{if(!$e.__resizeTriggers__){const Ae=$e.ownerDocument,Ie=windowObject.getComputedStyle($e);Ie&&Ie.position==="static"&&($e.style.position="relative"),xe(Ae),$e.__resizeLast__={},$e.__resizeListeners__=[],($e.__resizeTriggers__=Ae.createElement("div")).className="resize-triggers";const ke=Ae.createElement("div");ke.className="expand-trigger",ke.appendChild(Ae.createElement("div"));const Be=Ae.createElement("div");Be.className="contract-trigger",$e.__resizeTriggers__.appendChild(ke),$e.__resizeTriggers__.appendChild(Be),$e.appendChild($e.__resizeTriggers__),ge($e),$e.addEventListener("scroll",ye,!0),ue&&($e.__resizeTriggers__.__animationListener__=function(Fe){Fe.animationName===ce&&ge($e)},$e.__resizeTriggers__.addEventListener(ue,$e.__resizeTriggers__.__animationListener__))}$e.__resizeListeners__.push(Re)}},removeResizeListener:function($e,Re){if(ve)$e.detachEvent("onresize",Re);else if($e.__resizeListeners__.splice($e.__resizeListeners__.indexOf(Re),1),!$e.__resizeListeners__.length){$e.removeEventListener("scroll",ye,!0),$e.__resizeTriggers__.__animationListener__&&($e.__resizeTriggers__.removeEventListener(ue,$e.__resizeTriggers__.__animationListener__),$e.__resizeTriggers__.__animationListener__=null);try{$e.__resizeTriggers__=!$e.removeChild($e.__resizeTriggers__)}catch{}}}}}class AutoSizer extends reactExports.Component{constructor(...oe){super(...oe),this.state={height:this.props.defaultHeight||0,scaledHeight:this.props.defaultHeight||0,scaledWidth:this.props.defaultWidth||0,width:this.props.defaultWidth||0},this._autoSizer=null,this._detectElementResize=null,this._parentNode=null,this._resizeObserver=null,this._timeoutId=null,this._onResize=()=>{this._timeoutId=null;const{disableHeight:ce,disableWidth:ue,onResize:pe}=this.props;if(this._parentNode){const me=window.getComputedStyle(this._parentNode)||{},ge=parseFloat(me.paddingLeft||"0"),ye=parseFloat(me.paddingRight||"0"),ve=parseFloat(me.paddingTop||"0"),xe=parseFloat(me.paddingBottom||"0"),_e=this._parentNode.getBoundingClientRect(),Se=_e.height-ve-xe,$e=_e.width-ge-ye,Re=this._parentNode.offsetHeight-ve-xe,Ae=this._parentNode.offsetWidth-ge-ye;(!ce&&(this.state.height!==Re||this.state.scaledHeight!==Se)||!ue&&(this.state.width!==Ae||this.state.scaledWidth!==$e))&&(this.setState({height:Re,width:Ae,scaledHeight:Se,scaledWidth:$e}),typeof pe=="function"&&pe({height:Re,scaledHeight:Se,scaledWidth:$e,width:Ae}))}},this._setRef=ce=>{this._autoSizer=ce}}componentDidMount(){const{nonce:oe}=this.props;this._autoSizer&&this._autoSizer.parentNode&&this._autoSizer.parentNode.ownerDocument&&this._autoSizer.parentNode.ownerDocument.defaultView&&this._autoSizer.parentNode instanceof this._autoSizer.parentNode.ownerDocument.defaultView.HTMLElement&&(this._parentNode=this._autoSizer.parentNode,this._parentNode!=null&&(typeof ResizeObserver<"u"?(this._resizeObserver=new ResizeObserver(()=>{this._timeoutId=setTimeout(this._onResize,0)}),this._resizeObserver.observe(this._parentNode)):(this._detectElementResize=createDetectElementResize(oe),this._detectElementResize.addResizeListener(this._parentNode,this._onResize)),this._onResize()))}componentWillUnmount(){this._parentNode&&(this._detectElementResize&&this._detectElementResize.removeResizeListener(this._parentNode,this._onResize),this._timeoutId!==null&&clearTimeout(this._timeoutId),this._resizeObserver&&(this._resizeObserver.observe(this._parentNode),this._resizeObserver.disconnect()))}render(){const{children:oe,defaultHeight:ce,defaultWidth:ue,disableHeight:pe=!1,disableWidth:me=!1,nonce:ge,onResize:ye,style:ve={},tagName:xe="div",..._e}=this.props,{height:Se,scaledHeight:$e,scaledWidth:Re,width:Ae}=this.state,Ie={overflow:"visible"},ke={};let Be=!1;return pe||(Se===0&&(Be=!0),Ie.height=0,ke.height=Se,ke.scaledHeight=$e),me||(Ae===0&&(Be=!0),Ie.width=0,ke.width=Ae,ke.scaledWidth=Re),reactExports.createElement(xe,{ref:this._setRef,style:{...Ie,...ve},..._e},!Be&&oe(ke))}}const treeWorkerUrl=""+new URL("tree.worker-62add194.js",import.meta.url).href;class TreeWorkerUrl extends Worker{constructor(){super(treeWorkerUrl,{type:"module"})}}const treeAsync=usingMemoizedWorkerTask(TreeWorkerUrl);function useTree(ne){return useAsync(async()=>await treeAsync(ne),[ne])}function useTreeMemo(ne,oe){const ce=reactExports.useMemo(()=>ne,oe);return useTree(ce)}const isDefined$1=ne=>!lodashExports$1.isUndefined(ne)&&!lodashExports$1.isNull(ne),divider$4=jsxRuntimeExports.jsx(Divider$1,{orientation:"vertical",flexItem:!0,sx:{m:1}});function useCache(ne,oe=!1){const[ce,ue]=reactExports.useState();return reactExports.useEffect(()=>{oe||ne&&ue(ne)},[ne,oe]),ce}const layoutModes={"directed-graph":{value:"directed-graph",name:"Directed Graph",description:"Show all edges",showAllEdges:!0},tree:{value:"tree",name:"Tree",description:"Show only edges between each node and their final parents",showAllEdges:!1}};function GraphEvents({onSelection:ne,layer:oe}){const ce=v$6(),ue=y$3();return reactExports.useEffect(()=>{ue({clickNode:pe=>{ne==null||ne({event:pe.event.original,node:pe.node})},enterNode:()=>{document.body.style.cursor="pointer"},leaveNode:()=>{document.body.style.cursor=""}})},[oe,ue,ce]),null}const SEVEN_CLASS_GNBU=["#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"];function TreeGraph({trace:ne,tree:oe,step:ce=0,layer:ue,showAllEdges:pe,trackedProperty:me}){const ge=v$6(),[ye,ve]=reactExports.useState("vertical"),xe=usePaper(),_e=useAcrylic(),Se=useTheme$1(),$e=interpolate$1([Se.palette.background.paper,Se.palette.text.primary]),Re=_$4(),Ae=reactExports.useMemo(()=>getFinalParents(ne),[ne]),Ie=reactExports.useMemo(()=>{const ke=ye==="vertical",Be=new MultiDirectedGraph;lodashExports$1.forEach(oe,Fe=>{Be.addNode(Fe.label,{x:ke?Fe.x:-Fe.y,y:ke?Fe.y:-Fe.x,label:Fe.label,size:Math.log(Fe.size)+2,color:Se.palette.action.disabledBackground})});const Ne={};return lodashExports$1.forEach(ne==null?void 0:ne.events,({id:Fe,pId:Ue})=>{Fe&&Ue&&(Ne[Fe]=Ne[Fe]??new Set,Ne[Fe].add(Ue))}),lodashExports$1.forEach(ne==null?void 0:ne.events,({id:Fe,pId:Ue})=>{if(isDefined$1(Ue)&&Be.hasNode(`${Ue}`)){const We=makeEdgeKey(Fe,Ue);!Be.hasEdge(We)&&Be.hasNode(`${Fe}`)&&Be.addDirectedEdgeWithKey(We,`${Ue}`,`${Fe}`,{label:"",color:"white",size:2,final:Ae[Fe]===Ue}),Be.hasDirectedEdge(We)&&Be.updateEdgeAttribute(We,"size",qe=>Math.log(Math.E**(qe-.5)+.5)+.5)}}),Be},[Re,ne,oe,Ae,ye]);return reactExports.useEffect(()=>{const ke=memoizee$1(We=>interpolate$1([Se.palette.background.paper,We])),Be=400,Ne=$e(.1);Ie.forEachNode(We=>{Ie.setNodeAttribute(We,"color",Ne),Ie.setNodeAttribute(We,"forceLabel",!1),Ie.setNodeAttribute(We,"label",lodashExports$1.truncate(We,{length:15}))}),Ie.forEachEdge(We=>{const qe=Ie.getEdgeAttribute(We,"final");Ie.setEdgeAttribute(We,"color",Ne),Ie.setEdgeAttribute(We,"hidden",!pe&&!qe),Ie.setEdgeAttribute(We,"forceLabel",!1),Ie.setEdgeAttribute(We,"label","")});const Fe={},Ue={};if((pe?lodashExports$1.forEach:lodashExports$1.forEachRight)(lodashExports$1.slice(ne==null?void 0:ne.events,0,ce+1),({id:We,type:qe,pId:ze},Ge)=>{const Ze=getColorHex(qe),Dt=ke(Ze)(lodashExports$1.max([1-(ce-Ge)/Be,.2]));if(Ie.hasNode(`${We}`)&&!Fe[We]){Ie.setNodeAttribute(`${We}`,"color",Dt),Ie.setNodeAttribute(`${We}`,"label",lodashExports$1.truncate(`${lodashExports$1.startCase(qe)} ${We}`,{length:15})),Ie.setNodeAttribute(`${We}`,"forceLabel",ce===Ge);const Je=makeEdgeKey(We,ze);isDefined$1(ze)&&Ie.hasNode(`${ze}`)&&Ie.hasEdge(Je)&&!Ue[Je]&&(Ie.setEdgeAttribute(Je,"forceLabel",ce===Ge),Ie.setEdgeAttribute(Je,"color",Dt),Ie.setEdgeAttribute(Je,"label",`Step ${Ge}`),Ie.setEdgeAttribute(Je,"hidden",!1),pe||(Ue[Je]=!0)),pe||(Fe[We]=!0)}}),me){const We=lodashExports$1.min(lodashExports$1.map(ne==null?void 0:ne.events,Ze=>lodashExports$1.get(Ze,me))),qe=lodashExports$1.max(lodashExports$1.map(ne==null?void 0:ne.events,Ze=>lodashExports$1.get(Ze,me))),ze=Ze=>isNaN(We)||isNaN(qe)||isNaN(Ze)?0:(Ze-We)/(qe-We),Ge=interpolate$1(SEVEN_CLASS_GNBU);lodashExports$1.forEach(lodashExports$1.slice(ne==null?void 0:ne.events,0,ce+1),Ze=>{if(Ie.hasNode(`${Ze.id}`)){const Dt=Ge(ze(lodashExports$1.get(Ze,me)));if(Ie.setNodeAttribute(`${Ze.id}`,"color",Dt),isDefined$1(Ze.pId)){const Je=makeEdgeKey(`${Ze.id}`,`${Ze.pId}`);Ie.hasDirectedEdge(Je)&&Ie.setEdgeAttribute(Je,"color",Dt)}}})}Re(Ie)},[Ie,ce,ne,pe,me,Se]),jsxRuntimeExports.jsx(Stack$1,{sx:{pt:6,position:"absolute",top:0,left:0},children:jsxRuntimeExports.jsxs(Stack$1,{direction:"row",sx:{...xe(1),..._e,alignItems:"center",height:ke=>ke.spacing(6),px:1,m:1},children:[jsxRuntimeExports.jsx(IconButtonWithTooltip,{color:"primary",onClick:()=>{var ke,Be,Ne;(Ne=(Be=(ke=ge==null?void 0:ge.getCamera)==null?void 0:ke.call(ge))==null?void 0:Be.animatedReset)==null||Ne.call(Be)},label:"Fit",icon:jsxRuntimeExports.jsx(CenterFocusWeakOutlined,{})}),divider$4,jsxRuntimeExports.jsx(IconButtonWithTooltip,{color:"primary",onClick:()=>{ve(ye==="vertical"?"horizontal":"vertical")},label:"Rotate",icon:jsxRuntimeExports.jsx(RotateIcon,{})}),divider$4,jsxRuntimeExports.jsx(MinimisedPlaybackControls,{layer:ue})]})})}function makeEdgeKey(ne,oe){return`${ne}::${oe}`}const stepsLayerGuard$2=ne=>!!getController(ne).steps;function TreePage({template:ne}){var Je,Ut,jt,Ke,an,Zt;const{key:oe,setKey:ce,layer:ue,layers:pe,allLayers:me}=useLayer(void 0,stepsLayerGuard$2),ge=useTheme$1(),{controls:ye,onChange:ve,state:xe,dragHandle:_e}=useViewTreeContext(),Se=useThrottle$1(((Je=ue==null?void 0:ue.source)==null?void 0:Je.step)??0,1e3/24),{stepTo:$e}=usePlaybackState(oe),Re=reactExports.useMemo(()=>{var en,Kt,Wt;return lodashExports$1.chain((Wt=(Kt=(en=ue==null?void 0:ue.source)==null?void 0:en.trace)==null?void 0:Kt.content)==null?void 0:Wt.events).flatMap(lodashExports$1.keys).uniq().filter(un=>un!=="type").value()},[(Ke=(jt=(Ut=ue==null?void 0:ue.source)==null?void 0:Ut.trace)==null?void 0:jt.content)==null?void 0:Ke.events]),[Ae,Ie]=reactExports.useState(""),ke=(Zt=(an=ue==null?void 0:ue.source)==null?void 0:an.trace)==null?void 0:Zt.content;reactExports.useEffect(()=>{Ie("")},[ke,Ie]);const[Be,Ne]=reactExports.useState(),[Fe,Ue]=reactExports.useState(!1),[We,qe]=reactExports.useState("tree"),ze=reactExports.useMemo(()=>{const en=lodashExports$1.filter(lodashExports$1.map(ke==null?void 0:ke.events,(Kt,Wt)=>({event:Kt,step:Wt})),Kt=>`${Kt.event.id}`===(Be==null?void 0:Be.node));return{events:en,current:lodashExports$1.findLast(en,Kt=>Kt.step<=Se)}},[Be,Se]),{result:Ge,loading:Ze}=useTreeMemo({trace:ke,mode:We},[oe,We]),Dt=reactExports.useMemo(()=>({stagePadding:8*8,allowInvalidContainer:!0,edgeLabelColor:{color:ge.palette.text.secondary},labelFont:"Inter",labelSize:14,labelDensity:.1,renderEdgeLabels:!0,edgeLabelFont:"Inter",edgeLabelSize:12,defaultDrawNodeHover:()=>{},labelColor:{color:ge.palette.text.primary},edgeLabelWeight:"500",defaultEdgeType:"arrow",edgeProgramClasses:{straight:EdgeArrowProgram$1,curvedArrow:EdgeCurvedArrowProgram}}),[ge]);return jsxRuntimeExports.jsxs(ne,{onChange:ve,stack:xe,children:[jsxRuntimeExports.jsx(ne.Key,{children:"tree"}),jsxRuntimeExports.jsx(ne.Title,{children:"Tree"}),jsxRuntimeExports.jsx(ne.Handle,{children:_e}),jsxRuntimeExports.jsx(ne.Content,{children:jsxRuntimeExports.jsx(Flex,{children:ke?Ze?jsxRuntimeExports.jsxs(Flex,{sx:{flexDirection:"column",gap:4,alignItems:"center",justifyContent:"center"},children:[jsxRuntimeExports.jsx(CircularProgress$1,{}),jsxRuntimeExports.jsx(Type$2,{component:"div",variant:"body2",sx:{px:8,maxWidth:480},children:"Generating layout"})]}):Ge!=null&&Ge.length?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(AutoSizer,{children:en=>jsxRuntimeExports.jsxs(k$7,{style:{...en,background:ge.palette.background.paper},graph:MultiDirectedGraph,settings:Dt,children:[jsxRuntimeExports.jsx(TreeGraph,{step:Se,tree:Ge,trace:ke,layer:ue,showAllEdges:layoutModes[We].showAllEdges,trackedProperty:Ae}),jsxRuntimeExports.jsx(GraphEvents,{layer:oe,onSelection:Kt=>{Ne(Kt),Ue(!0)}})]})}),jsxRuntimeExports.jsx(Menu$1,{onClose:()=>Ue(!1),anchorReference:"anchorPosition",anchorPosition:{left:(Be==null?void 0:Be.event.clientX)??0,top:(Be==null?void 0:Be.event.clientY)??0},transformOrigin:{horizontal:"left",vertical:"top"},open:Fe,children:jsxRuntimeExports.jsxs(MenuList$1,{dense:!0,sx:{p:0},children:[!!ze.current&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ListItem$1,{sx:{py:0},children:jsxRuntimeExports.jsxs(Type$2,{component:"div",color:"text.secondary",variant:"overline",children:["Step ",ze.current.step]})}),jsxRuntimeExports.jsx(Box$1,{px:2,py:1,children:jsxRuntimeExports.jsx(PropertyList,{event:ze.current.event,vertical:!0,simple:!0,primitives:!0})}),jsxRuntimeExports.jsx(Divider$1,{sx:{my:1,mx:2}})]}),jsxRuntimeExports.jsx(ListItem$1,{sx:{py:0},children:jsxRuntimeExports.jsxs(Type$2,{component:"div",color:"text.secondary",variant:"overline",children:["Events at ",Be==null?void 0:Be.node]})}),lodashExports$1.map(ze.events,(en,Kt,Wt)=>{var Xt;const un=((Xt=lodashExports$1.findLast(Wt,nn=>nn.step<=Se))==null?void 0:Xt.step)===en.step;return jsxRuntimeExports.jsxs(Stack$1,{direction:"row",children:[jsxRuntimeExports.jsx(MenuItem$1,{selected:un,sx:{height:32,flex:1,borderLeft:`4px solid ${getColorHex(en.event.type)}`},onClick:()=>{$e(en.step)},children:jsxRuntimeExports.jsx(Tooltip$1,{title:`Go to step ${en.step}`,children:jsxRuntimeExports.jsx(Box$1,{sx:{ml:-.5,pr:4},children:jsxRuntimeExports.jsx(Label$1,{primary:lodashExports$1.startCase(en.event.type),secondary:isDefined$1(en.event.pId)?`Step ${en.step}, from ${en.event.pId}`:`Step ${en.step}`})})})}),jsxRuntimeExports.jsx(Box$1,{sx:{flex:0},children:jsxRuntimeExports.jsx(PropertyDialog,{event:en.event,trigger:nn=>jsxRuntimeExports.jsx(MenuItem$1,{selected:un,onClick:nn,sx:{pr:0},children:jsxRuntimeExports.jsx(Tooltip$1,{title:"See all properties",children:jsxRuntimeExports.jsx(ListItemIcon$1,{children:jsxRuntimeExports.jsx(DataObjectOutlined,{})})})})})})]})})]})})]}):jsxRuntimeExports.jsx(Placeholder$2,{icon:jsxRuntimeExports.jsx(TreeIcon,{}),label:"Graph",secondary:`${inferLayerName(ue)} is not a graph.`}):jsxRuntimeExports.jsx(Placeholder$2,{icon:jsxRuntimeExports.jsx(TreeIcon,{}),label:"Graph",secondary:"When you load a trace that has tree-like data, you'll see it here as a decision tree."})})}),jsxRuntimeExports.jsxs(ne.Options,{children:[jsxRuntimeExports.jsx(FeaturePicker,{icon:jsxRuntimeExports.jsx(LayersIcon,{}),label:"Layer",value:oe,items:lodashExports$1.map(me,en=>({id:en.key,hidden:!lodashExports$1.find(pe,{key:en.key}),name:inferLayerName(en)})),onChange:ce,arrow:!0,ellipsis:12}),divider$4,jsxRuntimeExports.jsx(FeaturePicker,{icon:jsxRuntimeExports.jsx(ModeStandbyOutlined,{}),label:"Layout",value:We,onChange:qe,items:lodashExports$1.map(lodashExports$1.entries(layoutModes),([en,Kt])=>({id:en,...Kt})),arrow:!0}),divider$4,jsxRuntimeExports.jsx(FeaturePicker,{icon:jsxRuntimeExports.jsx(TimelineOutlined,{}),label:"Tracked Property",value:Ae,onChange:Ie,items:[{id:"",name:"Off"},...lodashExports$1.map(Re,en=>({id:en,name:`$.${en}`}))],arrow:!0})]}),jsxRuntimeExports.jsx(ne.Extras,{children:ye})]})}function getFinalParents(ne){const oe={};return lodashExports$1.forEach(ne==null?void 0:ne.events,({id:ce,pId:ue})=>{oe[ce]=ue}),oe}function SelectionMenu({selection:ne,onClose:oe}){const ce=useSelectionMenu(),ue=useCache(ne),{client:pe}=ne??{};return jsxRuntimeExports.jsx(Menu$1,{open:!!ne,anchorReference:"anchorPosition",anchorPosition:{top:(pe==null?void 0:pe.y)??0,left:(pe==null?void 0:pe.x)??0},onClose:oe,keepMounted:!0,children:jsxRuntimeExports.jsx(MenuList$1,{dense:!0,sx:{py:0},children:jsxRuntimeExports.jsx(ce,{event:ue,children:me=>{const ge=lodashExports$1.entries(me);return ge.length?lodashExports$1.chain(ge).sortBy(([,ye])=>ye.index).map(([,{items:ye,primary:ve}],xe)=>jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[!!xe&&jsxRuntimeExports.jsx(Divider$1,{sx:{my:1,mx:2}}),ve&&jsxRuntimeExports.jsx(ListItem$1,{sx:{py:0},children:jsxRuntimeExports.jsx(Type$2,{component:"div",color:"text.secondary",variant:"overline",children:ve})}),lodashExports$1.chain(ye).entries().sortBy(([,_e])=>_e.index).map(([_e,{action:Se,icon:$e,primary:Re,secondary:Ae,extras:Ie}])=>jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[!!(Se||Re||Ae)&&(Se?jsxRuntimeExports.jsxs(MenuItem$1,{onClick:()=>{Se==null||Se(),oe==null||oe()},children:[$e&&jsxRuntimeExports.jsx(ListItemIcon$1,{children:$e}),jsxRuntimeExports.jsx(ListItemText$1,{primary:Re,sx:{mr:4}}),jsxRuntimeExports.jsx(Type$2,{component:"div",variant:"body2",color:"text.secondary",children:Ae})]},_e):jsxRuntimeExports.jsxs(ListItem$1,{children:[$e&&jsxRuntimeExports.jsx(ListItemIcon$1,{children:$e}),jsxRuntimeExports.jsx(ListItemText$1,{primary:Re,sx:{mr:4}}),jsxRuntimeExports.jsx(Type$2,{component:"div",variant:"body2",color:"text.secondary",children:Ae})]},_e)),!!Ie&&Ie]})).value()]})).value():jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(ListItem$1,{children:jsxRuntimeExports.jsx(Type$2,{component:"div",children:"No info to show."})})})}})})})}const identity$1=({children:ne})=>jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:ne==null?void 0:ne({})});function useSelectionMenu(){const[{layers:ne}]=useLayers();return reactExports.useMemo(()=>lodashExports$1.chain(ne).reduce((oe,ce)=>{var pe;const ue=((pe=getController(ce))==null?void 0:pe.provideSelectionInfo)??identity$1;return({children:me,event:ge})=>jsxRuntimeExports.jsx(ue,{layer:ce.key,event:ge,children:ye=>jsxRuntimeExports.jsx(oe,{event:ge,children:ve=>me==null?void 0:me(lodashExports$1.merge(ye,ve))})})},identity$1).value(),[ne])}const TILE_RESOLUTION=128,tileSize=(ne=!1)=>(ne?.75:devicePixelRatio*2)*TILE_RESOLUTION,rendererOptions={tileSubdivision:2,workerCount:lodashExports$1.clamp(lodashExports$1.floor((navigator.hardwareConcurrency-1)/2),1,12),tileResolution:{width:tileSize(),height:tileSize()}},TraceRendererContext=reactExports.createContext({});function useRendererInstance(){return reactExports.useContext(TraceRendererContext)}function useRenderer(ne,{width:oe,height:ce}={}){const ue=useTheme$1(),[pe]=useRenderers(),me=reactExports.useRef(null),[ge,ye]=reactExports.useState(""),[ve,xe]=reactExports.useState();return reactExports.useEffect(()=>{if(me.current&&oe&&ce&&ne){const _e=lodashExports$1.find(pe,Se=>Se.renderer.meta.id===ne);if(_e)try{const Se=new _e.renderer.constructor;Se.setup({...rendererOptions,screenSize:{width:oe,height:ce},backgroundColor:ue.palette.background.paper,accentColor:ue.palette.primary.main}),me.current.append(Se.getView()),xe(Se),ye("");const $e=me.current;return()=>{try{$e.removeChild(Se.getView()),xe(void 0)}catch(Re){console.warn(Re)}finally{Se.destroy()}}}catch(Se){ye(`${_e.renderer.meta.name}: ${lodashExports$1.get(Se,"message")}`),xe(void 0)}}},[me.current,lodashExports$1.map,ne,pe,ue,ye,xe]),useDebounce(()=>{ve&&oe&&ce&&ve.setOptions({screenSize:{width:oe,height:ce}})},ue.transitions.duration.standard,[ve,oe,ce]),{instance:ve,ref:me,error:ge}}function TraceRendererCircularProgress(){const[{map:ne,specimen:oe}]=useLoading();return!!(ne||oe)&&jsxRuntimeExports.jsx(CircularProgress$1,{sx:{position:"absolute",top:ce=>ce.spacing(6+2),right:ce=>ce.spacing(2)}})}const VIEWPORT_PAGE_DESCRIPTION="When you create a layer, you'll see it visualised here.";function TraceRenderer({width:ne,height:oe,renderer:ce,rendererRef:ue,layers:pe}){const me=reactExports.useMemo(nanoid$1,[]),{instance:ge,error:ye,ref:ve}=useRenderer(ce,{width:ne,height:oe}),{playing:xe}=usePlaybackState(),[,_e]=useScreenshots(),[Se,$e]=reactExports.useState();reactExports.useEffect(()=>{if(ge){const Ae=(Ie,ke)=>{const Be=Ie;$e({client:{x:Be.clientX,y:Be.clientY},world:ke.world,info:{point:ke.world,components:ke.components}})};return ge.on("click",Ae),()=>void ge.off("click",Ae)}},[ge]);const Re=reactExports.useMemo(()=>({renderer:ge}),[ge]);return reactExports.useEffect(()=>ue==null?void 0:ue(ge),[ge,ue]),reactExports.useEffect(()=>{const Ae=async()=>{var Ie;return await((Ie=ge==null?void 0:ge.toDataUrl)==null?void 0:Ie.call(ge))};return _e(()=>({[me]:Ae})),()=>_e(()=>({[me]:void 0}))},[me,ge]),reactExports.useEffect(()=>{ge&&ge.setOptions({tileResolution:{width:tileSize(xe),height:tileSize(xe)}})},[ge,xe]),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(TraceRendererCircularProgress,{}),jsxRuntimeExports.jsx(TraceRendererContext.Provider,{value:Re,children:jsxRuntimeExports.jsx(Box$1,{sx:{width:ne,height:oe},children:pe!=null&&pe.length?jsxRuntimeExports.jsx(TrustedContent,{children:ye?jsxRuntimeExports.jsxs(Box$1,{sx:{display:"flex",flexDirection:"column",width:ne,height:oe,alignItems:"center",justifyContent:"center",color:"text.secondary"},children:[jsxRuntimeExports.jsx(DisabledIcon,{sx:{mb:2},fontSize:"large"}),ye]}):jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(Box$1,{ref:ve,children:pe.map((Ae,Ie)=>jsxRuntimeExports.jsx(RenderLayer,{index:Ie,layer:Ae},Ae.key))})})}):jsxRuntimeExports.jsx(Placeholder$2,{icon:jsxRuntimeExports.jsx(ViewportIcon,{}),label:"Viewport",width:ne,height:oe,secondary:VIEWPORT_PAGE_DESCRIPTION})})}),jsxRuntimeExports.jsx(SelectionMenu,{selection:Se,onClose:()=>$e(void 0)})]})}function NodeList({nodes:ne,start:oe=0,end:ce=(ne==null?void 0:ne.length)??0}){const{renderer:ue}=useRendererInstance();return reactExports.useEffect(()=>{if(ue&&(ne!=null&&ne.length))return ue.add(lodashExports$1.slice(ne,oe,ce).flat())},[ue,ne,oe,ce]),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{})}function NodeList2({nodes:ne}){const{renderer:oe}=useRendererInstance();return reactExports.useEffect(()=>{if(oe&&(ne!=null&&ne.length))return oe.add(ne)},[oe,ne]),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{})}function LazyNodeList({nodes:ne,end:oe}){const ue=lodashExports$1.floor((oe??0)/100)*100,pe=reactExports.useMemo(()=>lodashExports$1.slice(ne,0,ue),[ne,ue]),me=reactExports.useMemo(()=>lodashExports$1.slice(ne,ue,(oe??0)+1),[ne,ue,oe]);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[!!ue&&jsxRuntimeExports.jsx(NodeList,{nodes:pe}),me.map((ge,ye)=>jsxRuntimeExports.jsx(NodeList2,{nodes:ge},ue+ye))]})}const useEffectWhen=(ne,oe,ce)=>{const ue=usePrevious$1(ce);return reactExports.useEffect(()=>{allSame(ce,ue)||ne()},[oe])};function allSame(ne,oe){return lodashExports$1.zip(ne,oe).every(([ce,ue])=>ce===ue)}const useEffectWhenAsync=(ne,oe=[],ce=[])=>{const[ue,pe]=reactExports.useState(oe),[me,ge]=reactExports.useState(ce);return reactExports.useEffect(()=>{allSame(me,ce)||(pe(oe),ge(ce))},[oe,ce,me]),useAsyncAbortable(ne,[...ue,...me])};function useConnectionResolver(){const[ne]=useConnections();return reactExports.useCallback(oe=>lodashExports$1.find(ne,oe),[ne])}function useConnection(ne){return useConnectionResolver()({url:ne})}function useMapContent(ne){const oe=useSnackbar(),ce=useLoadingState("map"),ue=useConnectionResolver(),pe=reactExports.useMemo(()=>memoizee$1(async({source:ve,id:xe}={})=>{if(ve&&xe){const _e=ue({url:ve});if(_e){oe("Fetching map...");const Se=await _e.transport().call("features/map",{id:xe});return Se==null?void 0:Se.content}}},{normalizer:JSON.stringify}),[ue,oe]),{content:me,source:ge,id:ye}=ne??{};return useAsync(()=>ce(async()=>{if(ye)return{...ne,content:me||await pe({source:ge,id:ye})}}),[pe,me,ge,ye])}const noop$7=()=>jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{});function useMapOptions(ne){const{format:oe}=ne??{};return useAsync(async()=>{var ce,ue;return await((ue=(ce=getParser(oe))==null?void 0:ce.editor)==null?void 0:ue.call(ce,ne==null?void 0:ne.content))??noop$7},[oe,ne==null?void 0:ne.content])}function useParsedMap(ne,oe){const ce=useSnackbar(),ue=useTheme$1(),pe=useLoadingState("map"),{format:me,content:ge}=ne??{};return useAsync(()=>pe(async()=>{var ye,ve;if(me&&ge){ce("Processing map...");try{const xe=await((ve=(ye=getParser(me))==null?void 0:ye.parse)==null?void 0:ve.call(ye,ge,{color:ue.palette.text.primary,background:ue.palette.background.paper,...oe}))??{nodes:[]};return ce("Map loaded",`${xe.nodes.length} elements, ${xe.log.join(", ")}`),{...ne,...xe}}catch(xe){return console.error(xe),ce("Error parsing",lodashExports$1.get(xe,"message")),{error:lodashExports$1.get(xe,"message")}}}}),[me,ge,ue,oe])}const controller$2={key:"map",icon:jsxRuntimeExports.jsx(MapTwoTone,{}),inferName:ne=>{var oe;return(oe=ne==null?void 0:ne.source)!=null&&oe.map?`${ne.source.map.name} (${lodashExports$1.startCase(ne.source.map.format)})`:"Untitled Map"},error:ne=>{var oe,ce;return(ce=(oe=ne==null?void 0:ne.source)==null?void 0:oe.parsedMap)==null?void 0:ce.error},compress:ne=>lodashExports$1.pick(ne,["map","options"]),claimImportedFile:async ne=>lodashExports$1.keys(mapParsers).includes(ext$1(ne.name))?{claimed:!0,layer:async oe=>{oe("Opening map...");try{return{map:{...await readUploadedMap(ne,lodashExports$1.entries(mapParsers).map(([ue])=>({id:ue}))).read()}}}catch(ce){return console.error(ce),oe(`Error opening, ${lodashExports$1.get(ce,"message")}`),{map:{key:nanoid$1(),id:custom$1().id,error:lodashExports$1.get(ce,"message"),name:lodashExports$1.startCase(name$2(ne.name))}}}}}:{claimed:!1},editor:withProduce(({value:ne,produce:oe})=>{var pe,me,ge;const ce=(pe=ne==null?void 0:ne.source)==null?void 0:pe.parsedMap,{result:ue}=useMapOptions(ce);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Option,{label:"Source",content:jsxRuntimeExports.jsx(MapPicker,{value:(me=ne==null?void 0:ne.source)==null?void 0:me.map,onChange:ye=>oe(ve=>lodashExports$1.set(ve,"source.map",ye))})}),(ce==null?void 0:ce.error)&&jsxRuntimeExports.jsx(Type$2,{component:"div",variant:"body2",color:ye=>ye.palette.error.main,sx:{whiteSpace:"pre-wrap",mb:1,mt:1},children:jsxRuntimeExports.jsx("code",{children:ce==null?void 0:ce.error})}),!!ce&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Heading,{label:"Map Options"}),ue?jsxRuntimeExports.jsx(ue,{value:(ge=ne==null?void 0:ne.source)==null?void 0:ge.options,onChange:ye=>oe(ve=>{var xe;lodashExports$1.set(ve,"source.options",ye(((xe=ve.source)==null?void 0:xe.options)??{}))})}):jsxRuntimeExports.jsx(CircularProgress$1,{sx:{mt:2}})]})]})}),renderer:({layer:ne,index:oe})=>{var pe;const{nodes:ce}=((pe=ne==null?void 0:ne.source)==null?void 0:pe.parsedMap)??{},ue=reactExports.useMemo(()=>[lodashExports$1.map(ce,me=>({...me,meta:{...me.meta,sourceLayer:ne==null?void 0:ne.key,sourceLayerIndex:oe,sourceLayerAlpha:1-.01*+((ne==null?void 0:ne.transparency)??0),sourceLayerDisplayMode:(ne==null?void 0:ne.displayMode)??"source-over"}}))],[ce,oe,ne==null?void 0:ne.transparency,ne==null?void 0:ne.displayMode]);return jsxRuntimeExports.jsx(NodeList,{nodes:ue})},service:withProduce(({value:ne,produce:oe})=>{var me,ge;const{result:ce}=useMapContent((me=ne==null?void 0:ne.source)==null?void 0:me.map),{result:ue,loading:pe}=useParsedMap(ce,(ge=ne==null?void 0:ne.source)==null?void 0:ge.options);return useEffectWhen(()=>{pe||oe(ye=>{lodashExports$1.set(ye,"source.parsedMap",ue),lodashExports$1.set(ye,"viewKey",nanoid$1())})},[ue,oe,pe],[ue]),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{})}),provideSelectionInfo:({children:ne,event:oe,layer:ce})=>{const{layer:ue,setLayer:pe,layers:me}=useLayer(ce),{parsedMap:ge}=(ue==null?void 0:ue.source)??{},{point:ye,node:ve}=reactExports.useMemo(()=>{var _e,Se,$e,Re;if(ge&&oe){const Ae=(Re=($e=getParser((Se=(_e=ue==null?void 0:ue.source)==null?void 0:_e.map)==null?void 0:Se.format))==null?void 0:$e.hydrate)==null?void 0:Re.call($e,ge);if(Ae){const Ie=(oe==null?void 0:oe.world)&&Ae.snap(oe.world);if(Ie){const ke=(oe==null?void 0:oe.world)&&Ae.nodeAt(Ie);return{point:Ie,node:ke}}}}return{}},[ge,oe]),xe=reactExports.useMemo(()=>({...ue&&ye&&!lodashExports$1.isUndefined(ve)&&{[ue.key]:{primary:inferLayerName(ue),items:{point:{primary:"Point",secondary:`(${lodashExports$1.round(ye.x,2)}, ${lodashExports$1.round(ye.y,2)})`}}}}}),[ye,ve,ue,me,pe]);return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:ne==null?void 0:ne(xe)})},getSources:ne=>{var ue,pe;const oe=(ue=ne==null?void 0:ne.source)==null?void 0:ue.map,ce=(pe=ne==null?void 0:ne.source)==null?void 0:pe.parsedMap;return oe?[{id:"map",name:`${oe.name}`,language:"txt",content:ce==null?void 0:ce.content}]:[]},onEditSource:(ne,oe,ce)=>ne};function _defineProperty$2(ne,oe,ce){return oe in ne?Object.defineProperty(ne,oe,{value:ce,enumerable:!0,configurable:!0,writable:!0}):ne[oe]=ce,ne}function ownKeys$1(ne,oe){var ce=Object.keys(ne);if(Object.getOwnPropertySymbols){var ue=Object.getOwnPropertySymbols(ne);oe&&(ue=ue.filter(function(pe){return Object.getOwnPropertyDescriptor(ne,pe).enumerable})),ce.push.apply(ce,ue)}return ce}function _objectSpread2$1(ne){for(var oe=1;oe=0)&&(ce[pe]=ne[pe]);return ce}function _objectWithoutProperties(ne,oe){if(ne==null)return{};var ce=_objectWithoutPropertiesLoose(ne,oe),ue,pe;if(Object.getOwnPropertySymbols){var me=Object.getOwnPropertySymbols(ne);for(pe=0;pe=0)&&Object.prototype.propertyIsEnumerable.call(ne,ue)&&(ce[ue]=ne[ue])}return ce}function _slicedToArray$1(ne,oe){return _arrayWithHoles$1(ne)||_iterableToArrayLimit$1(ne,oe)||_unsupportedIterableToArray$1(ne,oe)||_nonIterableRest$1()}function _arrayWithHoles$1(ne){if(Array.isArray(ne))return ne}function _iterableToArrayLimit$1(ne,oe){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(ne)))){var ce=[],ue=!0,pe=!1,me=void 0;try{for(var ge=ne[Symbol.iterator](),ye;!(ue=(ye=ge.next()).done)&&(ce.push(ye.value),!(oe&&ce.length===oe));ue=!0);}catch(ve){pe=!0,me=ve}finally{try{!ue&&ge.return!=null&&ge.return()}finally{if(pe)throw me}}return ce}}function _unsupportedIterableToArray$1(ne,oe){if(ne){if(typeof ne=="string")return _arrayLikeToArray$1(ne,oe);var ce=Object.prototype.toString.call(ne).slice(8,-1);if(ce==="Object"&&ne.constructor&&(ce=ne.constructor.name),ce==="Map"||ce==="Set")return Array.from(ne);if(ce==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ce))return _arrayLikeToArray$1(ne,oe)}}function _arrayLikeToArray$1(ne,oe){(oe==null||oe>ne.length)&&(oe=ne.length);for(var ce=0,ue=new Array(oe);ce=ne.length?ne.apply(this,pe):function(){for(var ge=arguments.length,ye=new Array(ge),ve=0;ve1&&arguments[1]!==void 0?arguments[1]:{};validators$1.initial(ne),validators$1.handler(oe);var ce={current:ne},ue=curry$1(didStateUpdate)(ce,oe),pe=curry$1(updateState)(ce),me=curry$1(validators$1.changes)(ne),ge=curry$1(extractChanges)(ce);function ye(){var xe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(_e){return _e};return validators$1.selector(xe),xe(ce.current)}function ve(xe){compose$2(ue,pe,me,ge)(xe)}return[ye,ve]}function extractChanges(ne,oe){return isFunction$2(oe)?oe(ne.current):oe}function updateState(ne,oe){return ne.current=_objectSpread2(_objectSpread2({},ne.current),oe),oe}function didStateUpdate(ne,oe,ce){return isFunction$2(oe)?oe(ne.current):Object.keys(ce).forEach(function(ue){var pe;return(pe=oe[ue])===null||pe===void 0?void 0:pe.call(oe,ne.current[ue])}),ce}var index$2={create:create$2},config$1={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.43.0/min/vs"}};function curry(ne){return function oe(){for(var ce=this,ue=arguments.length,pe=new Array(ue),me=0;me=ne.length?ne.apply(this,pe):function(){for(var ge=arguments.length,ye=new Array(ge),ve=0;ve Posthoc - +