@restio/ui 0.0.7-SNAPSHOT → 0.0.8-SNAPSHOT

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -70,7 +70,7 @@ Take a look at the reducer(s) handling this action type: ${d.type}.
70
70
  C${i},${r} ${s},${o} ${a},${o}
71
71
  `,fill:`none`,stroke:`#333`,strokeWidth:c,strokeOpacity:`0.2`},I(l)))}var Lz=e=>{var{link:t,nodes:n,left:r,top:i,i:a,linkContent:o,linkCurvature:s}=e,{sy:c,ty:l,dy:u}=t,d=n[t.source],f=n[t.target];if(!(d==null||f==null)){var p=d.x+d.dx+r,m=f.x+r,h=mz(p,m),g=h(s),_=h(1-s);return uz({sourceX:p,targetX:m,sourceY:d.y+c+u/2+i,targetY:f.y+l+u/2+i,sourceControlX:g,targetControlX:_,sourceRelativeY:c,targetRelativeY:l,linkWidth:u,index:a,payload:uz(uz({},t),{},{source:d,target:f})},ie(o))}};function Rz(e){var{graphicalItemId:t,props:n,i:r,linkContent:i,onMouseEnter:a,onMouseLeave:o,onClick:s,dataKey:c}=e,l=Mz(n),d=`link-${r}`,f=V();return u.createElement(L,{onMouseEnter:e=>{f(DC({activeIndex:d,activeDataKey:c,activeCoordinate:l,activeGraphicalItemId:t})),a(n,e)},onMouseLeave:e=>{f(OC()),o(n,e)},onClick:e=>{f(AC({activeIndex:d,activeDataKey:c,activeCoordinate:l,activeGraphicalItemId:t})),s(n,e)}},Iz(i,n))}function zz(e){var{graphicalItemId:t,modifiedLinks:n,links:r,linkContent:i,onMouseEnter:a,onMouseLeave:o,onClick:s,dataKey:c}=e;return u.createElement(L,{className:`recharts-sankey-links`,key:`recharts-sankey-links`},r.map((e,r)=>{var l=n[r];return l==null?null:u.createElement(Rz,{graphicalItemId:t,key:`link-${e.source}-${e.target}-${e.value}`,props:l,linkContent:i,i:r,onMouseEnter:a,onMouseLeave:o,onClick:s,dataKey:c})}))}function Bz(e,t){return u.isValidElement(e)?u.cloneElement(e,t):typeof e==`function`?e(t):u.createElement(yp,oz({className:`recharts-sankey-node`,fill:`#0088fe`,fillOpacity:`0.8`},I(t)))}var Vz=e=>{var{node:t,nodeContent:n,top:r,left:i,i:a}=e,{x:o,y:s,dx:c,dy:l}=t;return uz(uz({},ie(n)),{},{x:o+i,y:s+r,width:c,height:l,index:a,payload:t})};function Hz(e){var{graphicalItemId:t,props:n,nodeContent:r,i,onMouseEnter:a,onMouseLeave:o,onClick:s,dataKey:c}=e,l=V(),d=jz(n),f=`node-${i}`;return u.createElement(L,{onMouseEnter:e=>{l(DC({activeIndex:f,activeDataKey:c,activeCoordinate:d,activeGraphicalItemId:t})),a(n,e)},onMouseLeave:e=>{l(OC()),o(n,e)},onClick:e=>{l(AC({activeIndex:f,activeDataKey:c,activeCoordinate:d,activeGraphicalItemId:t})),s(n,e)}},Bz(r,n))}function Uz(e){var{graphicalItemId:t,modifiedNodes:n,nodeContent:r,onMouseEnter:i,onMouseLeave:a,onClick:o,dataKey:s}=e;return u.createElement(L,{className:`recharts-sankey-nodes`,key:`recharts-sankey-nodes`},n.map((e,n)=>u.createElement(Hz,{graphicalItemId:t,key:`node-${e.index}-${e.x}-${e.y}`,props:e,nodeContent:r,i:n,onMouseEnter:i,onMouseLeave:a,onClick:o,dataKey:s})))}var Wz=uz({align:`justify`,dataKey:`value`,iterations:32,linkCurvature:.5,margin:{top:5,right:5,bottom:5,left:5},nameKey:`name`,nodePadding:10,nodeWidth:10,sort:!0,verticalAlign:`justify`},IL);function Gz(e){var{className:t,style:n,children:r,id:i}=e,a=sz(e,az),{link:o,dataKey:s,node:c,onMouseEnter:l,onMouseLeave:d,onClick:f,data:p,iterations:m,nodeWidth:h,nodePadding:g,sort:_,linkCurvature:v,margin:y,verticalAlign:b,align:x}=e,S=I(a),C=pl(),w=ml(),{links:T,modifiedLinks:E,modifiedNodes:D}=(0,u.useMemo)(()=>{if(!p||!C||!w||C<=0||w<=0)return{nodes:[],links:[],modifiedLinks:[],modifiedNodes:[]};var e=Az({data:p,width:C-(y.left??0)-(y.right??0),height:w-(y.top??0)-(y.bottom??0),iterations:m,nodeWidth:h,nodePadding:g,sort:_,verticalAlign:b,align:x}),t=y.top||0,n=y.left||0,r=e.links.map((r,i)=>Lz({link:r,nodes:e.nodes,i,top:t,left:n,linkContent:o,linkCurvature:v})).filter(dn),i=e.nodes.map((e,r)=>Vz({node:e,nodeContent:c,i:r,top:t,left:n}));return{nodes:e.nodes,links:e.links,modifiedLinks:r,modifiedNodes:i}},[p,C,w,y,m,h,g,_,o,c,v,x,b]),O=(0,u.useCallback)((e,t,n)=>{l&&l(e,t,n)},[l]),k=(0,u.useCallback)((e,t,n)=>{d&&d(e,t,n)},[d]),A=(0,u.useCallback)((e,t,n)=>{f&&f(e,t,n)},[f]);return!Rs(C)||!Rs(w)||!p||!p.links||!p.nodes?null:u.createElement(u.Fragment,null,u.createElement(Fj,{computedData:{links:E,nodes:D}}),u.createElement(de,oz({},S,{width:C,height:w}),r,u.createElement(zz,{graphicalItemId:i,links:T,modifiedLinks:E,linkContent:o,dataKey:s,onMouseEnter:(e,t)=>O(e,`link`,t),onMouseLeave:(e,t)=>k(e,`link`,t),onClick:(e,t)=>A(e,`link`,t)}),u.createElement(Uz,{graphicalItemId:i,modifiedNodes:D,nodeContent:c,dataKey:s,onMouseEnter:(e,t)=>O(e,`node`,t),onMouseLeave:(e,t)=>k(e,`node`,t),onClick:(e,t)=>A(e,`node`,t)})))}function Kz(e){var t=Rn(e,Wz),{width:n,height:r,style:i,className:a,id:o,throttleDelay:s,throttledEvents:c}=t,[l,d]=(0,u.useState)(null);return u.createElement(HL,{preloadedState:{options:Pz},reduxStoreName:a??`Sankey`},u.createElement(bl,{width:n,height:r}),u.createElement(xl,{margin:t.margin}),u.createElement(KL,{throttleDelay:s,throttledEvents:c}),u.createElement(_R,{className:a,style:i,width:n,height:r,responsive:!1,ref:e=>{e&&!l&&d(e)},onMouseEnter:void 0,onMouseLeave:void 0,onClick:void 0,onMouseMove:void 0,onMouseDown:void 0,onMouseUp:void 0,onContextMenu:void 0,onDoubleClick:void 0,onTouchStart:void 0,onTouchMove:void 0,onTouchEnd:void 0},u.createElement(qT.Provider,{value:l},u.createElement(Yk,{id:o,type:`sankey`},e=>u.createElement(u.Fragment,null,u.createElement(Fz,{dataKey:t.dataKey,nameKey:t.nameKey,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,data:t.data,id:e}),u.createElement(Gz,oz({},t,{id:e})))))))}Kz.displayName=`Sankey`;var qz=[`item`],Jz=(0,u.forwardRef)((e,t)=>u.createElement(kR,{chartName:`ScatterChart`,defaultTooltipEventType:`item`,validateTooltipEventTypes:qz,tooltipPayloadSearcher:$T,categoricalChartProps:e,ref:t})),Yz=[`axis`],Xz=(0,u.forwardRef)((e,t)=>u.createElement(kR,{chartName:`AreaChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:Yz,tooltipPayloadSearcher:$T,categoricalChartProps:e,ref:t})),Zz={"rst-graph-container":`_rst-graph-container_1wei2_1`};function Qz({type:e,data:t,xKey:n,yKey:r,layout:i=`horizontal`,showGrid:a=!0,showTooltip:o=!0,showLegend:s=!0,gridStyle:c=`3 3`,strokeColor:l=`#4F46E5`,fillColor:u=`#82ca9d`,width:d=`100%`,height:f=300,margin:p={top:20,right:30,left:20,bottom:5}}){let m={container:` ${Zz[`rst-graph-container`]}`};switch(e){case`line`:return(0,h.jsx)(cl,{width:d,height:f,className:m.container,children:(0,h.jsxs)(jR,{layout:i,data:t,margin:p,children:[a&&(0,h.jsx)(iN,{strokeDasharray:c,fill:`var(--rst-backgroundColor-default)`}),(0,h.jsx)(II,{type:i===`vertical`?`number`:`category`,dataKey:i===`vertical`?void 0:n}),(0,h.jsx)(ZI,{type:i===`vertical`?`category`:`number`,dataKey:i===`vertical`?n:void 0}),o&&(0,h.jsx)(AE,{}),s&&(0,h.jsx)(cd,{}),(0,h.jsx)(eP,{dataKey:r,stroke:l})]})});case`bar`:return(0,h.jsx)(cl,{width:d,height:f,children:(0,h.jsxs)(NR,{data:t,margin:p,children:[a&&(0,h.jsx)(iN,{strokeDasharray:c}),(0,h.jsx)(II,{dataKey:n}),(0,h.jsx)(ZI,{}),o&&(0,h.jsx)(AE,{}),s&&(0,h.jsx)(cd,{}),(0,h.jsx)(zF,{dataKey:r,fill:u})]})});case`pie`:return(0,h.jsx)(cl,{width:d,height:f,children:(0,h.jsxs)($R,{children:[o&&(0,h.jsx)(AE,{}),s&&(0,h.jsx)(cd,{}),(0,h.jsx)(IA,{data:t,dataKey:r,nameKey:n,fill:u,cx:`50%`,cy:`50%`,outerRadius:100,label:!0})]})});default:return null}}var $z={"rst-kbd":`_rst-kbd_17zhl_1`},eB=()=>{if(typeof window>`u`)return`other`;let e=window.navigator.userAgent.toLowerCase();return e.includes(`mac`)?`mac`:e.includes(`win`)?`windows`:e.includes(`linux`)?`linux`:`other`},tB=e=>({Control:`ctrl`,Meta:`ctrl`,Alt:`alt`,Shift:`shift`," ":`space`,ArrowUp:`up`,ArrowDown:`down`,ArrowLeft:`left`,ArrowRight:`right`})[e]||e.toLowerCase(),nB=e=>{let t=eB();return e.map(e=>{switch(e.toLowerCase()){case`ctrl`:return t===`mac`?`cmd`:`ctrl`;case`alt`:return t===`mac`?`option`:`alt`;case`shift`:return`shift`;case`space`:return`space`;case`up`:case`down`:case`left`:case`right`:return`arrow ${e}`;case`escape`:return`esc`;case`enter`:return t===`mac`?`return`:`enter`;default:return e}})},rB=e=>eB()===`mac`?{cmd:`⌘`,ctrl:`⌃`,option:`⌥`,alt:`⌥`,shift:`⇧`,enter:`↩`,return:`↩`,esc:`⎋`,escape:`⎋`,space:`␣`,tab:`⇥`,"arrow up":`↑`,"arrow down":`↓`,"arrow left":`←`,"arrow right":`→`}[e.toLowerCase()]||e:{ctrl:`Ctrl`,alt:`Alt`,shift:`Shift`,enter:`Enter`,esc:`Esc`,escape:`Esc`,space:`Space`,tab:`Tab`}[e.toLowerCase()]||e.charAt(0).toUpperCase()+e.slice(1),iB=e=>e.split(`+`).map(e=>e.trim().toLowerCase()).map(e=>{switch(e){case`cmd`:case`command`:case`meta`:return`ctrl`;case`option`:return`alt`;case`return`:return`enter`;case`esc`:return`escape`;default:return e}}).join(`+`),aB=({children:e,className:t,...n})=>{let r=[$z[`rst-kbd`],t].filter(Boolean).join(` `),i=typeof e==`string`?rB(e):e;return(0,h.jsx)(`kbd`,{className:r,...n,children:(0,h.jsx)(T,{variant:`caption`,children:i})})},oB={"rst-avatar":`_rst-avatar_vy8dt_2`,"rst-avatar-small":`_rst-avatar-small_vy8dt_15`,"rst-avatar-default":`_rst-avatar-default_vy8dt_20`,"rst-avatar-large":`_rst-avatar-large_vy8dt_25`},sB=({src:e,size:t=`default`,className:n,...r})=>(0,h.jsx)(`div`,{className:[oB[`rst-avatar`],oB[`rst-avatar-${t}`],n].filter(Boolean).join(` `),...r,children:(0,h.jsx)(b,{src:e||`user`})}),cB={},lB=d.default.createContext(cB);function uB(e){let t=d.default.useContext(lB);return d.default.useMemo(function(){return typeof e==`function`?e(t):{...t,...e}},[t,e])}function dB(e){let t;return t=e.disableParentContext?typeof e.components==`function`?e.components(cB):e.components||cB:uB(e.components),d.default.createElement(lB.Provider,{value:t},e.children)}function fB(e){return e.toLowerCase().trim().replace(/\s+/g,`-`).replace(/[^\w-]+/g,``).replace(/--+/g,`-`).replace(/^-+|-+$/g,``)}var pB=Object.create,mB=Object.defineProperty,hB=Object.defineProperties,gB=Object.getOwnPropertyDescriptor,_B=Object.getOwnPropertyDescriptors,vB=Object.getOwnPropertyNames,yB=Object.getOwnPropertySymbols,bB=Object.getPrototypeOf,xB=Object.prototype.hasOwnProperty,SB=Object.prototype.propertyIsEnumerable,CB=(e,t,n)=>t in e?mB(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,wB=(e,t)=>{for(var n in t||={})xB.call(t,n)&&CB(e,n,t[n]);if(yB)for(var n of yB(t))SB.call(t,n)&&CB(e,n,t[n]);return e},TB=(e,t)=>hB(e,_B(t)),EB=(e,t)=>{var n={};for(var r in e)xB.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&yB)for(var r of yB(e))t.indexOf(r)<0&&SB.call(e,r)&&(n[r]=e[r]);return n},DB=(e,t)=>function(){return t||(0,e[vB(e)[0]])((t={exports:{}}).exports,t),t.exports},OB=(e,t)=>{for(var n in t)mB(e,n,{get:t[n],enumerable:!0})},kB=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let i of vB(t))!xB.call(e,i)&&i!==n&&mB(e,i,{get:()=>t[i],enumerable:!(r=gB(t,i))||r.enumerable});return e},Y=((e,t,n)=>(n=e==null?{}:pB(bB(e)),kB(t||!e||!e.__esModule?mB(n,`default`,{value:e,enumerable:!0}):n,e)))(DB({"../../node_modules/.pnpm/prismjs@1.29.0_patch_hash=vrxx3pzkik6jpmgpayxfjunetu/node_modules/prismjs/prism.js"(e,t){var n=function(){var e=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,t=0,n={},r={util:{encode:function e(t){return t instanceof i?new i(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/\u00a0/g,` `)},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,`__id`,{value:++t}),e.__id},clone:function e(t,n){n||={};var i,a;switch(r.util.type(t)){case`Object`:if(a=r.util.objId(t),n[a])return n[a];for(var o in i={},n[a]=i,t)t.hasOwnProperty(o)&&(i[o]=e(t[o],n));return i;case`Array`:return a=r.util.objId(t),n[a]?n[a]:(i=[],n[a]=i,t.forEach(function(t,r){i[r]=e(t,n)}),i);default:return t}},getLanguage:function(t){for(;t;){var n=e.exec(t.className);if(n)return n[1].toLowerCase();t=t.parentElement}return`none`},setLanguage:function(t,n){t.className=t.className.replace(RegExp(e,`gi`),``),t.classList.add(`language-`+n)},isActive:function(e,t,n){for(var r=`no-`+t;e;){var i=e.classList;if(i.contains(t))return!0;if(i.contains(r))return!1;e=e.parentElement}return!!n}},languages:{plain:n,plaintext:n,text:n,txt:n,extend:function(e,t){var n=r.util.clone(r.languages[e]);for(var i in t)n[i]=t[i];return n},insertBefore:function(e,t,n,i){i||=r.languages;var a=i[e],o={};for(var s in a)if(a.hasOwnProperty(s)){if(s==t)for(var c in n)n.hasOwnProperty(c)&&(o[c]=n[c]);n.hasOwnProperty(s)||(o[s]=a[s])}var l=i[e];return i[e]=o,r.languages.DFS(r.languages,function(t,n){n===l&&t!=e&&(this[t]=o)}),o},DFS:function e(t,n,i,a){a||={};var o=r.util.objId;for(var s in t)if(t.hasOwnProperty(s)){n.call(t,s,t[s],i||s);var c=t[s],l=r.util.type(c);l===`Object`&&!a[o(c)]?(a[o(c)]=!0,e(c,n,null,a)):l===`Array`&&!a[o(c)]&&(a[o(c)]=!0,e(c,n,s,a))}}},plugins:{},highlight:function(e,t,n){var a={code:e,grammar:t,language:n};if(r.hooks.run(`before-tokenize`,a),!a.grammar)throw Error(`The language "`+a.language+`" has no grammar.`);return a.tokens=r.tokenize(a.code,a.grammar),r.hooks.run(`after-tokenize`,a),i.stringify(r.util.encode(a.tokens),a.language)},tokenize:function(e,t){var n=t.rest;if(n){for(var r in n)t[r]=n[r];delete t.rest}var i=new s;return c(i,i.head,e),o(e,i,t,i.head,0),u(i)},hooks:{all:{},add:function(e,t){var n=r.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=r.hooks.all[e];if(!(!n||!n.length))for(var i=0,a;a=n[i++];)a(t)}},Token:i};function i(e,t,n,r){this.type=e,this.content=t,this.alias=n,this.length=(r||``).length|0}i.stringify=function e(t,n){if(typeof t==`string`)return t;if(Array.isArray(t)){var i=``;return t.forEach(function(t){i+=e(t,n)}),i}var a={type:t.type,content:e(t.content,n),tag:`span`,classes:[`token`,t.type],attributes:{},language:n},o=t.alias;o&&(Array.isArray(o)?Array.prototype.push.apply(a.classes,o):a.classes.push(o)),r.hooks.run(`wrap`,a);var s=``;for(var c in a.attributes)s+=` `+c+`="`+(a.attributes[c]||``).replace(/"/g,`&quot;`)+`"`;return`<`+a.tag+` class="`+a.classes.join(` `)+`"`+s+`>`+a.content+`</`+a.tag+`>`};function a(e,t,n,r){e.lastIndex=t;var i=e.exec(n);if(i&&r&&i[1]){var a=i[1].length;i.index+=a,i[0]=i[0].slice(a)}return i}function o(e,t,n,s,u,d){for(var f in n)if(!(!n.hasOwnProperty(f)||!n[f])){var p=n[f];p=Array.isArray(p)?p:[p];for(var m=0;m<p.length;++m){if(d&&d.cause==f+`,`+m)return;var h=p[m],g=h.inside,_=!!h.lookbehind,v=!!h.greedy,y=h.alias;if(v&&!h.pattern.global){var b=h.pattern.toString().match(/[imsuy]*$/)[0];h.pattern=RegExp(h.pattern.source,b+`g`)}for(var x=h.pattern||h,S=s.next,C=u;S!==t.tail&&!(d&&C>=d.reach);C+=S.value.length,S=S.next){var w=S.value;if(t.length>e.length)return;if(!(w instanceof i)){var T=1,E;if(v){if(E=a(x,C,e,_),!E||E.index>=e.length)break;var D=E.index,O=E.index+E[0].length,k=C;for(k+=S.value.length;D>=k;)S=S.next,k+=S.value.length;if(k-=S.value.length,C=k,S.value instanceof i)continue;for(var A=S;A!==t.tail&&(k<O||typeof A.value==`string`);A=A.next)T++,k+=A.value.length;T--,w=e.slice(C,k),E.index-=C}else if(E=a(x,0,w,_),!E)continue;var D=E.index,j=E[0],M=w.slice(0,D),N=w.slice(D+j.length),P=C+w.length;d&&P>d.reach&&(d.reach=P);var F=S.prev;M&&(F=c(t,F,M),C+=M.length),l(t,F,T);var ee=new i(f,g?r.tokenize(j,g):j,y,j);if(S=c(t,F,ee),N&&c(t,S,N),T>1){var te={cause:f+`,`+m,reach:P};o(e,t,n,S.prev,C,te),d&&te.reach>d.reach&&(d.reach=te.reach)}}}}}}function s(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function c(e,t,n){var r=t.next,i={value:n,prev:t,next:r};return t.next=i,r.prev=i,e.length++,i}function l(e,t,n){for(var r=t.next,i=0;i<n&&r!==e.tail;i++)r=r.next;t.next=r,r.prev=t,e.length-=i}function u(e){for(var t=[],n=e.head.next;n!==e.tail;)t.push(n.value),n=n.next;return t}return r}();t.exports=n,n.default=n}})());Y.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:`attr-equals`},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:`named-entity`},/&#x?[\da-f]{1,8};/i]},Y.languages.markup.tag.inside[`attr-value`].inside.entity=Y.languages.markup.entity,Y.languages.markup.doctype.inside[`internal-subset`].inside=Y.languages.markup,Y.hooks.add(`wrap`,function(e){e.type===`entity`&&(e.attributes.title=e.content.replace(/&amp;/,`&`))}),Object.defineProperty(Y.languages.markup.tag,`addInlined`,{value:function(e,t){var n={},n=(n[`language-`+t]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:Y.languages[t]},n.cdata=/^<!\[CDATA\[|\]\]>$/i,{"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:n}}),t=(n[`language-`+t]={pattern:/[\s\S]+/,inside:Y.languages[t]},{});t[e]={pattern:RegExp(`(<__[^>]*>)(?:<!\\[CDATA\\[(?:[^\\]]|\\](?!\\]>))*\\]\\]>|(?!<!\\[CDATA\\[)[\\s\\S])*?(?=<\\/__>)`.replace(/__/g,function(){return e}),`i`),lookbehind:!0,greedy:!0,inside:n},Y.languages.insertBefore(`markup`,`cdata`,t)}}),Object.defineProperty(Y.languages.markup.tag,`addAttribute`,{value:function(e,t){Y.languages.markup.tag.inside[`special-attr`].push({pattern:RegExp(`(^|["'\\s])(?:`+e+`)\\s*=\\s*(?:"[^"]*"|'[^']*'|[^\\s'">=]+(?=[\\s>]))`,`i`),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,`language-`+t],inside:Y.languages[t]},punctuation:[{pattern:/^=/,alias:`attr-equals`},/"|'/]}}}})}}),Y.languages.html=Y.languages.markup,Y.languages.mathml=Y.languages.markup,Y.languages.svg=Y.languages.markup,Y.languages.xml=Y.languages.extend(`markup`,{}),Y.languages.ssml=Y.languages.xml,Y.languages.atom=Y.languages.xml,Y.languages.rss=Y.languages.xml,function(e){var t={pattern:/\\[\\(){}[\]^$+*?|.]/,alias:`escape`},n=/\\(?:x[\da-fA-F]{2}|u[\da-fA-F]{4}|u\{[\da-fA-F]+\}|0[0-7]{0,2}|[123][0-7]{2}|c[a-zA-Z]|.)/,r=`(?:[^\\\\-]|`+n.source+`)`,r=RegExp(r+`-`+r),i={pattern:/(<|')[^<>']+(?=[>']$)/,lookbehind:!0,alias:`variable`};e.languages.regex={"char-class":{pattern:/((?:^|[^\\])(?:\\\\)*)\[(?:[^\\\]]|\\[\s\S])*\]/,lookbehind:!0,inside:{"char-class-negation":{pattern:/(^\[)\^/,lookbehind:!0,alias:`operator`},"char-class-punctuation":{pattern:/^\[|\]$/,alias:`punctuation`},range:{pattern:r,inside:{escape:n,"range-punctuation":{pattern:/-/,alias:`operator`}}},"special-escape":t,"char-set":{pattern:/\\[wsd]|\\p\{[^{}]+\}/i,alias:`class-name`},escape:n}},"special-escape":t,"char-set":{pattern:/\.|\\[wsd]|\\p\{[^{}]+\}/i,alias:`class-name`},backreference:[{pattern:/\\(?![123][0-7]{2})[1-9]/,alias:`keyword`},{pattern:/\\k<[^<>']+>/,alias:`keyword`,inside:{"group-name":i}}],anchor:{pattern:/[$^]|\\[ABbGZz]/,alias:`function`},escape:n,group:[{pattern:/\((?:\?(?:<[^<>']+>|'[^<>']+'|[>:]|<?[=!]|[idmnsuxU]+(?:-[idmnsuxU]+)?:?))?/,alias:`punctuation`,inside:{"group-name":i}},{pattern:/\)/,alias:`punctuation`}],quantifier:{pattern:/(?:[+*?]|\{\d+(?:,\d*)?\})[?+]?/,alias:`number`},alternation:{pattern:/\|/,alias:`keyword`}}}(Y),Y.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},Y.languages.javascript=Y.languages.extend(`clike`,{"class-name":[Y.languages.clike[`class-name`],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(`(^|[^\\w$])(?:NaN|Infinity|0[bB][01]+(?:_[01]+)*n?|0[oO][0-7]+(?:_[0-7]+)*n?|0[xX][\\dA-Fa-f]+(?:_[\\dA-Fa-f]+)*n?|\\d+(?:_\\d+)*n|(?:\\d+(?:_\\d+)*(?:\\.(?:\\d+(?:_\\d+)*)?)?|\\.\\d+(?:_\\d+)*)(?:[Ee][+-]?\\d+(?:_\\d+)*)?)(?![\\w$])`),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),Y.languages.javascript[`class-name`][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,Y.languages.insertBefore(`javascript`,`keyword`,{regex:{pattern:RegExp(`((?:^|[^$\\w\\xA0-\\uFFFF."'\\])\\s]|\\b(?:return|yield))\\s*)\\/(?:(?:\\[(?:[^\\]\\\\\\r\\n]|\\\\.)*\\]|\\\\.|[^/\\\\\\[\\r\\n])+\\/[dgimyus]{0,7}|(?:\\[(?:[^[\\]\\\\\\r\\n]|\\\\.|\\[(?:[^[\\]\\\\\\r\\n]|\\\\.|\\[(?:[^[\\]\\\\\\r\\n]|\\\\.)*\\])*\\])*\\]|\\\\.|[^/\\\\\\[\\r\\n])+\\/[dgimyus]{0,7}v[dgimyus]{0,7})(?=(?:\\s|\\/\\*(?:[^*]|\\*(?!\\/))*\\*\\/)*(?:$|[\\r\\n,.;:})\\]]|\\/\\/))`),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:`language-regex`,inside:Y.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:`function`},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Y.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Y.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Y.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Y.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),Y.languages.insertBefore(`javascript`,`string`,{hashbang:{pattern:/^#!.*/,greedy:!0,alias:`comment`},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:`string`},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:`punctuation`},rest:Y.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:`property`}}),Y.languages.insertBefore(`javascript`,`operator`,{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:`property`}}),Y.languages.markup&&(Y.languages.markup.tag.addInlined(`script`,`javascript`),Y.languages.markup.tag.addAttribute(`on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)`,`javascript`)),Y.languages.js=Y.languages.javascript,Y.languages.actionscript=Y.languages.extend(`javascript`,{keyword:/\b(?:as|break|case|catch|class|const|default|delete|do|dynamic|each|else|extends|final|finally|for|function|get|if|implements|import|in|include|instanceof|interface|internal|is|namespace|native|new|null|override|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|use|var|void|while|with)\b/,operator:/\+\+|--|(?:[+\-*\/%^]|&&?|\|\|?|<<?|>>?>?|[!=]=?)=?|[~?@]/}),Y.languages.actionscript[`class-name`].alias=`function`,delete Y.languages.actionscript.parameter,delete Y.languages.actionscript[`literal-property`],Y.languages.markup&&Y.languages.insertBefore(`actionscript`,`string`,{xml:{pattern:/(^|[^.])<\/?\w+(?:\s+[^\s>\/=]+=("|')(?:\\[\s\S]|(?!\2)[^\\])*\2)*\s*\/?>/,lookbehind:!0,inside:Y.languages.markup}}),function(e){var t=/#(?!\{).+/,n={pattern:/#\{[^}]+\}/,alias:`variable`};e.languages.coffeescript=e.languages.extend(`javascript`,{comment:t,string:[{pattern:/'(?:\\[\s\S]|[^\\'])*'/,greedy:!0},{pattern:/"(?:\\[\s\S]|[^\\"])*"/,greedy:!0,inside:{interpolation:n}}],keyword:/\b(?:and|break|by|catch|class|continue|debugger|delete|do|each|else|extend|extends|false|finally|for|if|in|instanceof|is|isnt|let|loop|namespace|new|no|not|null|of|off|on|or|own|return|super|switch|then|this|throw|true|try|typeof|undefined|unless|until|when|while|window|with|yes|yield)\b/,"class-member":{pattern:/@(?!\d)\w+/,alias:`variable`}}),e.languages.insertBefore(`coffeescript`,`comment`,{"multiline-comment":{pattern:/###[\s\S]+?###/,alias:`comment`},"block-regex":{pattern:/\/{3}[\s\S]*?\/{3}/,alias:`regex`,inside:{comment:t,interpolation:n}}}),e.languages.insertBefore(`coffeescript`,`string`,{"inline-javascript":{pattern:/`(?:\\[\s\S]|[^\\`])*`/,inside:{delimiter:{pattern:/^`|`$/,alias:`punctuation`},script:{pattern:/[\s\S]+/,alias:`language-javascript`,inside:e.languages.javascript}}},"multiline-string":[{pattern:/'''[\s\S]*?'''/,greedy:!0,alias:`string`},{pattern:/"""[\s\S]*?"""/,greedy:!0,alias:`string`,inside:{interpolation:n}}]}),e.languages.insertBefore(`coffeescript`,`keyword`,{property:/(?!\d)\w+(?=\s*:(?!:))/}),delete e.languages.coffeescript[`template-string`],e.languages.coffee=e.languages.coffeescript}(Y),function(e){var t=e.languages.javadoclike={parameter:{pattern:/(^[\t ]*(?:\/{3}|\*|\/\*\*)\s*@(?:arg|arguments|param)\s+)\w+/m,lookbehind:!0},keyword:{pattern:/(^[\t ]*(?:\/{3}|\*|\/\*\*)\s*|\{)@[a-z][a-zA-Z-]+\b/m,lookbehind:!0},punctuation:/[{}]/};Object.defineProperty(t,`addSupport`,{value:function(t,n){(t=typeof t==`string`?[t]:t).forEach(function(t){var r=function(e){e.inside||={},e.inside.rest=n},i=`doc-comment`;if(a=e.languages[t]){var a,o=a[i];if((o||=(a=e.languages.insertBefore(t,`comment`,{"doc-comment":{pattern:/(^|[^\\])\/\*\*[^/][\s\S]*?(?:\*\/|$)/,lookbehind:!0,alias:`comment`}}))[i])instanceof RegExp&&(o=a[i]={pattern:o}),Array.isArray(o))for(var s=0,c=o.length;s<c;s++)o[s]instanceof RegExp&&(o[s]={pattern:o[s]}),r(o[s]);else r(o)}})}}),t.addSupport([`java`,`javascript`,`php`],t)}(Y),function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/,t=(e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp(`@[\\w-](?:[^;{\\s"']|\\s+(?!\\s)|`+t.source+`)*?(?:;|(?=\\s*\\{))`),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:`selector`},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp(`\\burl\\((?:`+t.source+`|(?:[^\\\\\\r\\n()"']|\\\\[\\s\\S])*)\\)`,`i`),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp(`^`+t.source+`$`),alias:`url`}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+t.source+`)*(?=\\s*\\{)`),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css,e.languages.markup);t&&(t.tag.addInlined(`style`,`css`),t.tag.addAttribute(`style`,`css`))}(Y),function(e){var t=/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,t=(e.languages.css.selector={pattern:e.languages.css.selector.pattern,lookbehind:!0,inside:t={"pseudo-element":/:(?:after|before|first-letter|first-line|selection)|::[-\w]+/,"pseudo-class":/:[-\w]+/,class:/\.[-\w]+/,id:/#[-\w]+/,attribute:{pattern:RegExp(`\\[(?:[^[\\]"']|`+t.source+`)*\\]`),greedy:!0,inside:{punctuation:/^\[|\]$/,"case-sensitivity":{pattern:/(\s)[si]$/i,lookbehind:!0,alias:`keyword`},namespace:{pattern:/^(\s*)(?:(?!\s)[-*\w\xA0-\uFFFF])*\|(?!=)/,lookbehind:!0,inside:{punctuation:/\|$/}},"attr-name":{pattern:/^(\s*)(?:(?!\s)[-\w\xA0-\uFFFF])+/,lookbehind:!0},"attr-value":[t,{pattern:/(=\s*)(?:(?!\s)[-\w\xA0-\uFFFF])+(?=\s*$)/,lookbehind:!0}],operator:/[|~*^$]?=/}},"n-th":[{pattern:/(\(\s*)[+-]?\d*[\dn](?:\s*[+-]\s*\d+)?(?=\s*\))/,lookbehind:!0,inside:{number:/[\dn]+/,operator:/[+-]/}},{pattern:/(\(\s*)(?:even|odd)(?=\s*\))/i,lookbehind:!0}],combinator:/>|\+|~|\|\|/,punctuation:/[(),]/}},e.languages.css.atrule.inside[`selector-function-argument`].inside=t,e.languages.insertBefore(`css`,`property`,{variable:{pattern:/(^|[^-\w\xA0-\uFFFF])--(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*/i,lookbehind:!0}}),{pattern:/(\b\d+)(?:%|[a-z]+(?![\w-]))/,lookbehind:!0}),n={pattern:/(^|[^\w.-])-?(?:\d+(?:\.\d+)?|\.\d+)/,lookbehind:!0};e.languages.insertBefore(`css`,`function`,{operator:{pattern:/(\s)[+\-*\/](?=\s)/,lookbehind:!0},hexcode:{pattern:/\B#[\da-f]{3,8}\b/i,alias:`color`},color:[{pattern:/(^|[^\w-])(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|RebeccaPurple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)(?![\w-])/i,lookbehind:!0},{pattern:/\b(?:hsl|rgb)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:hsl|rgb)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i,inside:{unit:t,number:n,function:/[\w-]+(?=\()/,punctuation:/[(),]/}}],entity:/\\[\da-f]{1,8}/i,unit:t,number:n})}(Y),function(e){var t=/[*&][^\s[\]{},]+/,n=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,r=`(?:`+n.source+`(?:[ ]+`+t.source+`)?|`+t.source+`(?:[ ]+`+n.source+`)?)`,i=`(?:[^\\s\\x00-\\x08\\x0e-\\x1f!"#%&'*,\\-:>?@[\\]\`{|}\\x7f-\\x84\\x86-\\x9f\\ud800-\\udfff\\ufffe\\uffff]|[?:-]<PLAIN>)(?:[ \\t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*`.replace(/<PLAIN>/g,function(){return`[^\\s\\x00-\\x08\\x0e-\\x1f,[\\]{}\\x7f-\\x84\\x86-\\x9f\\ud800-\\udfff\\ufffe\\uffff]`}),a=`"(?:[^"\\\\\\r\\n]|\\\\.)*"|'(?:[^'\\\\\\r\\n]|\\\\.)*'`;function o(e,t){t=(t||``).replace(/m/g,``)+`m`;var n=`([:\\-,[{]\\s*(?:\\s<<prop>>[ \\t]+)?)(?:<<value>>)(?=[ \\t]*(?:$|,|\\]|\\}|(?:[\\r\\n]\\s*)?#))`.replace(/<<prop>>/g,function(){return r}).replace(/<<value>>/g,function(){return e});return RegExp(n,t)}e.languages.yaml={scalar:{pattern:RegExp(`([\\-:]\\s*(?:\\s<<prop>>[ \\t]+)?[|>])[ \\t]*(?:((?:\\r?\\n|\\r)[ \\t]+)\\S[^\\r\\n]*(?:\\2[^\\r\\n]+)*)`.replace(/<<prop>>/g,function(){return r})),lookbehind:!0,alias:`string`},comment:/#.*/,key:{pattern:RegExp(`((?:^|[:\\-,[{\\r\\n?])[ \\t]*(?:<<prop>>[ \\t]+)?)<<key>>(?=\\s*:\\s)`.replace(/<<prop>>/g,function(){return r}).replace(/<<key>>/g,function(){return`(?:`+i+`|`+a+`)`})),lookbehind:!0,greedy:!0,alias:`atrule`},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:`important`},datetime:{pattern:o(`\\d{4}-\\d\\d?-\\d\\d?(?:[tT]|[ \\t]+)\\d\\d?:\\d{2}:\\d{2}(?:\\.\\d*)?(?:[ \\t]*(?:Z|[-+]\\d\\d?(?::\\d{2})?))?|\\d{4}-\\d{2}-\\d{2}|\\d\\d?:\\d{2}(?::\\d{2}(?:\\.\\d*)?)?`),lookbehind:!0,alias:`number`},boolean:{pattern:o(`false|true`,`i`),lookbehind:!0,alias:`important`},null:{pattern:o(`null|~`,`i`),lookbehind:!0,alias:`important`},string:{pattern:o(a),lookbehind:!0,greedy:!0},number:{pattern:o(`[+-]?(?:0x[\\da-f]+|0o[0-7]+|(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:e[+-]?\\d+)?|\\.inf|\\.nan)`,`i`),lookbehind:!0},tag:n,important:t,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},e.languages.yml=e.languages.yaml}(Y),function(e){var t=`(?:\\\\.|[^\\\\\\n\\r]|(?:\\n|\\r\\n?)(?![\\r\\n]))`;function n(e){return e=e.replace(/<inner>/g,function(){return t}),RegExp(`((?:^|[^\\\\])(?:\\\\{2})*)(?:`+e+`)`)}var r="(?:\\\\.|``(?:[^`\\r\\n]|`(?!`))+``|`[^`\\r\\n]+`|[^\\\\|\\r\\n`])+",i=`\\|?__(?:\\|__)+\\|?(?:(?:\\n|\\r\\n?)|(?![\\s\\S]))`.replace(/__/g,function(){return r}),a=`\\|?[ \\t]*:?-{3,}:?[ \\t]*(?:\\|[ \\t]*:?-{3,}:?[ \\t]*)+\\|?(?:\\n|\\r\\n?)`,o=(e.languages.markdown=e.languages.extend(`markup`,{}),e.languages.insertBefore(`markdown`,`prolog`,{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:[`yaml`,`language-yaml`],inside:e.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:`punctuation`},table:{pattern:RegExp(`^`+i+a+`(?:`+i+`)*`,`m`),inside:{"table-data-rows":{pattern:RegExp(`^(`+i+a+`)(?:`+i+`)*$`),lookbehind:!0,inside:{"table-data":{pattern:RegExp(r),inside:e.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp(`^(`+i+`)`+a+`$`),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp(`^`+i+`$`),inside:{"table-header":{pattern:RegExp(r),alias:`important`,inside:e.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:`keyword`},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:`important`,inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:`important`,inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:`punctuation`},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:`punctuation`},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:`url`},bold:{pattern:n(`\\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\\b|\\*\\*(?:(?!\\*)<inner>|\\*(?:(?!\\*)<inner>)+\\*)+\\*\\*`),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:n(`\\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\\b|\\*(?:(?!\\*)<inner>|\\*\\*(?:(?!\\*)<inner>)+\\*\\*)+\\*`),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:n(`(~~?)(?:(?!~)<inner>)+\\2`),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:[`code`,`keyword`]},url:{pattern:n(`!?\\[(?:(?!\\])<inner>)+\\](?:\\([^\\s)]+(?:[\\t ]+"(?:\\\\.|[^"\\\\])*")?\\)|[ \\t]?\\[(?:(?!\\])<inner>)+\\])`),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),[`url`,`bold`,`italic`,`strike`].forEach(function(t){[`url`,`bold`,`italic`,`strike`,`code-snippet`].forEach(function(n){t!==n&&(e.languages.markdown[t].inside.content.inside[n]=e.languages.markdown[n])})}),e.hooks.add(`after-tokenize`,function(e){e.language!==`markdown`&&e.language!==`md`||function e(t){if(t&&typeof t!=`string`)for(var n=0,r=t.length;n<r;n++){var i,a=t[n];a.type===`code`?(i=a.content[1],a=a.content[3],i&&a&&i.type===`code-language`&&a.type===`code-block`&&typeof i.content==`string`&&(i=i.content.replace(/\b#/g,`sharp`).replace(/\b\+\+/g,`pp`),i=`language-`+(i=(/[a-z][\w-]*/i.exec(i)||[``])[0].toLowerCase()),a.alias?typeof a.alias==`string`?a.alias=[a.alias,i]:a.alias.push(i):a.alias=[i])):e(a.content)}}(e.tokens)}),e.hooks.add(`wrap`,function(t){if(t.type===`code-block`){for(var n=``,r=0,i=t.classes.length;r<i;r++){var a=t.classes[r],a=/language-(.+)/.exec(a);if(a){n=a[1];break}}var l,u=e.languages[n];u?t.content=e.highlight(function(e){return e=e.replace(o,``),e=e.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,function(e,t){var n;return(t=t.toLowerCase())[0]===`#`?(n=t[1]===`x`?parseInt(t.slice(2),16):Number(t.slice(1)),c(n)):s[t]||e})}(t.content),u,n):n&&n!==`none`&&e.plugins.autoloader&&(l=`md-`+new Date().valueOf()+`-`+Math.floor(0x2386f26fc10000*Math.random()),t.attributes.id=l,e.plugins.autoloader.loadLanguages(n,function(){var t=document.getElementById(l);t&&(t.innerHTML=e.highlight(t.textContent,e.languages[n],n))}))}}),RegExp(e.languages.markup.tag.pattern.source,`gi`)),s={amp:`&`,lt:`<`,gt:`>`,quot:`"`},c=String.fromCodePoint||String.fromCharCode;e.languages.md=e.languages.markdown}(Y),Y.languages.graphql={comment:/#.*/,description:{pattern:/(?:"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*")(?=\s*[a-z_])/i,greedy:!0,alias:`string`,inside:{"language-markdown":{pattern:/(^"(?:"")?)(?!\1)[\s\S]+(?=\1$)/,lookbehind:!0,inside:Y.languages.markdown}}},string:{pattern:/"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*"/,greedy:!0},number:/(?:\B-|\b)\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,boolean:/\b(?:false|true)\b/,variable:/\$[a-z_]\w*/i,directive:{pattern:/@[a-z_]\w*/i,alias:`function`},"attr-name":{pattern:/\b[a-z_]\w*(?=\s*(?:\((?:[^()"]|"(?:\\.|[^\\"\r\n])*")*\))?:)/i,greedy:!0},"atom-input":{pattern:/\b[A-Z]\w*Input\b/,alias:`class-name`},scalar:/\b(?:Boolean|Float|ID|Int|String)\b/,constant:/\b[A-Z][A-Z_\d]*\b/,"class-name":{pattern:/(\b(?:enum|implements|interface|on|scalar|type|union)\s+|&\s*|:\s*|\[)[A-Z_]\w*/,lookbehind:!0},fragment:{pattern:/(\bfragment\s+|\.{3}\s*(?!on\b))[a-zA-Z_]\w*/,lookbehind:!0,alias:`function`},"definition-mutation":{pattern:/(\bmutation\s+)[a-zA-Z_]\w*/,lookbehind:!0,alias:`function`},"definition-query":{pattern:/(\bquery\s+)[a-zA-Z_]\w*/,lookbehind:!0,alias:`function`},keyword:/\b(?:directive|enum|extend|fragment|implements|input|interface|mutation|on|query|repeatable|scalar|schema|subscription|type|union)\b/,operator:/[!=|&]|\.{3}/,"property-query":/\w+(?=\s*\()/,object:/\w+(?=\s*\{)/,punctuation:/[!(){}\[\]:=,]/,property:/\w+/},Y.hooks.add(`after-tokenize`,function(e){if(e.language===`graphql`)for(var t=e.tokens.filter(function(e){return typeof e!=`string`&&e.type!==`comment`&&e.type!==`scalar`}),n=0;n<t.length;){var r=t[n++];if(r.type===`keyword`&&r.content===`mutation`){var i=[];if(d([`definition-mutation`,`punctuation`])&&u(1).content===`(`){n+=2;var a=f(/^\($/,/^\)$/);if(a===-1)continue;for(;n<a;n++){var o=u(0);o.type===`variable`&&(p(o,`variable-input`),i.push(o.content))}n=a+1}if(d([`punctuation`,`property-query`])&&u(0).content===`{`&&(n++,p(u(0),`property-mutation`),0<i.length)){var s=f(/^\{$/,/^\}$/);if(s!==-1)for(var c=n;c<s;c++){var l=t[c];l.type===`variable`&&0<=i.indexOf(l.content)&&p(l,`variable-input`)}}}}function u(e){return t[n+e]}function d(e,t){t||=0;for(var n=0;n<e.length;n++){var r=u(n+t);if(!r||r.type!==e[n])return}return 1}function f(e,r){for(var i=1,a=n;a<t.length;a++){var o=t[a],s=o.content;if(o.type===`punctuation`&&typeof s==`string`){if(e.test(s))i++;else if(r.test(s)&&--i===0)return a}}return-1}function p(e,t){var n=e.alias;n?Array.isArray(n)||(e.alias=n=[n]):e.alias=n=[],n.push(t)}}),Y.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/},function(e){var t=e.languages.javascript[`template-string`],n=t.pattern.source,r=t.inside.interpolation,i=r.inside[`interpolation-punctuation`],a=r.pattern.source;function o(t,r){if(e.languages[t])return{pattern:RegExp(`((?:`+r+`)\\s*)`+n),lookbehind:!0,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:`string`},"embedded-code":{pattern:/[\s\S]+/,alias:t}}}}function s(t,n,r){return t={code:t,grammar:n,language:r},e.hooks.run(`before-tokenize`,t),t.tokens=e.tokenize(t.code,t.grammar),e.hooks.run(`after-tokenize`,t),t.tokens}function c(t,n,o){var c=e.tokenize(t,{interpolation:{pattern:RegExp(a),lookbehind:!0}}),l=0,u={},c=s(c.map(function(e){if(typeof e==`string`)return e;for(var n,r,e=e.content;t.indexOf((r=l++,n=`___`+o.toUpperCase()+`_`+r+`___`))!==-1;);return u[n]=e,n}).join(``),n,o),d=Object.keys(u);return l=0,function t(n){for(var a=0;a<n.length;a++){if(l>=d.length)return;var o,c,f,p,m,h,g,_=n[a];typeof _==`string`||typeof _.content==`string`?(o=d[l],(g=(h=typeof _==`string`?_:_.content).indexOf(o))!==-1&&(++l,c=h.substring(0,g),m=u[o],f=void 0,(p={})[`interpolation-punctuation`]=i,(p=e.tokenize(m,p)).length===3&&((f=[1,1]).push.apply(f,s(p[1],e.languages.javascript,`javascript`)),p.splice.apply(p,f)),f=new e.Token(`interpolation`,p,r.alias,m),p=h.substring(g+o.length),m=[],c&&m.push(c),m.push(f),p&&(t(h=[p]),m.push.apply(m,h)),typeof _==`string`?(n.splice.apply(n,[a,1].concat(m)),a+=m.length-1):_.content=m)):(g=_.content,t(Array.isArray(g)?g:[g]))}}(c),new e.Token(o,c,`language-`+o,t)}e.languages.javascript[`template-string`]=[o(`css`,`\\b(?:styled(?:\\([^)]*\\))?(?:\\s*\\.\\s*\\w+(?:\\([^)]*\\))*)*|css(?:\\s*\\.\\s*(?:global|resolve))?|createGlobalStyle|keyframes)`),o(`html`,`\\bhtml|\\.\\s*(?:inner|outer)HTML\\s*\\+?=`),o(`svg`,`\\bsvg`),o(`markdown`,`\\b(?:markdown|md)`),o(`graphql`,`\\b(?:gql|graphql(?:\\s*\\.\\s*experimental)?)`),o(`sql`,`\\bsql`),t].filter(Boolean);var l={javascript:!0,js:!0,typescript:!0,ts:!0,jsx:!0,tsx:!0};function u(e){return typeof e==`string`?e:Array.isArray(e)?e.map(u).join(``):u(e.content)}e.hooks.add(`after-tokenize`,function(t){t.language in l&&function t(n){for(var r=0,i=n.length;r<i;r++){var a,o,s,l=n[r];typeof l!=`string`&&(a=l.content,Array.isArray(a)?l.type===`template-string`?(l=a[1],a.length===3&&typeof l!=`string`&&l.type===`embedded-code`&&(o=u(l),l=l.alias,l=Array.isArray(l)?l[0]:l,s=e.languages[l])&&(a[1]=c(o,s,l))):t(a):typeof a!=`string`&&t([a]))}}(t.tokens)})}(Y),function(e){e.languages.typescript=e.languages.extend(`javascript`,{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),e.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete e.languages.typescript.parameter,delete e.languages.typescript[`literal-property`];var t=e.languages.extend(`typescript`,{});delete t[`class-name`],e.languages.typescript[`class-name`].inside=t,e.languages.insertBefore(`typescript`,`function`,{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:`operator`},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:`class-name`,inside:t}}}}),e.languages.ts=e.languages.typescript}(Y),function(e){var t=e.languages.javascript,n=`\\{(?:[^{}]|\\{(?:[^{}]|\\{[^{}]*\\})*\\})+\\}`,r=`(@(?:arg|argument|param|property)\\s+(?:`+n+`\\s+)?)`;e.languages.jsdoc=e.languages.extend(`javadoclike`,{parameter:{pattern:RegExp(r+`(?:(?!\\s)[$\\w\\xA0-\\uFFFF.])+(?=\\s|$)`),lookbehind:!0,inside:{punctuation:/\./}}}),e.languages.insertBefore(`jsdoc`,`keyword`,{"optional-parameter":{pattern:RegExp(r+`\\[(?:(?!\\s)[$\\w\\xA0-\\uFFFF.])+(?:=[^[\\]]+)?\\](?=\\s|$)`),lookbehind:!0,inside:{parameter:{pattern:/(^\[)[$\w\xA0-\uFFFF\.]+/,lookbehind:!0,inside:{punctuation:/\./}},code:{pattern:/(=)[\s\S]*(?=\]$)/,lookbehind:!0,inside:t,alias:`language-javascript`},punctuation:/[=[\]]/}},"class-name":[{pattern:RegExp(`(@(?:augments|class|extends|interface|memberof!?|template|this|typedef)\\s+(?:<TYPE>\\s+)?)[A-Z]\\w*(?:\\.[A-Z]\\w*)*`.replace(/<TYPE>/g,function(){return n})),lookbehind:!0,inside:{punctuation:/\./}},{pattern:RegExp(`(@[a-z]+\\s+)`+n),lookbehind:!0,inside:{string:t.string,number:t.number,boolean:t.boolean,keyword:e.languages.typescript.keyword,operator:/=>|\.\.\.|[&|?:*]/,punctuation:/[.,;=<>{}()[\]]/}}],example:{pattern:/(@example\s+(?!\s))(?:[^@\s]|\s+(?!\s))+?(?=\s*(?:\*\s*)?(?:@\w|\*\/))/,lookbehind:!0,inside:{code:{pattern:/^([\t ]*(?:\*\s*)?)\S.*$/m,lookbehind:!0,inside:t,alias:`language-javascript`}}}}),e.languages.javadoclike.addSupport(`javascript`,e.languages.jsdoc)}(Y),function(e){e.languages.flow=e.languages.extend(`javascript`,{}),e.languages.insertBefore(`flow`,`keyword`,{type:[{pattern:/\b(?:[Bb]oolean|Function|[Nn]umber|[Ss]tring|[Ss]ymbol|any|mixed|null|void)\b/,alias:`class-name`}]}),e.languages.flow[`function-variable`].pattern=/(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=\s*(?:function\b|(?:\([^()]*\)(?:\s*:\s*\w+)?|(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/i,delete e.languages.flow.parameter,e.languages.insertBefore(`flow`,`operator`,{"flow-punctuation":{pattern:/\{\||\|\}/,alias:`punctuation`}}),Array.isArray(e.languages.flow.keyword)||(e.languages.flow.keyword=[e.languages.flow.keyword]),e.languages.flow.keyword.unshift({pattern:/(^|[^$]\b)(?:Class|declare|opaque|type)\b(?!\$)/,lookbehind:!0},{pattern:/(^|[^$]\B)\$(?:Diff|Enum|Exact|Keys|ObjMap|PropertyType|Record|Shape|Subtype|Supertype|await)\b(?!\$)/,lookbehind:!0})}(Y),Y.languages.n4js=Y.languages.extend(`javascript`,{keyword:/\b(?:Array|any|boolean|break|case|catch|class|const|constructor|continue|debugger|declare|default|delete|do|else|enum|export|extends|false|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|module|new|null|number|package|private|protected|public|return|set|static|string|super|switch|this|throw|true|try|typeof|var|void|while|with|yield)\b/}),Y.languages.insertBefore(`n4js`,`constant`,{annotation:{pattern:/@+\w+/,alias:`operator`}}),Y.languages.n4jsd=Y.languages.n4js,function(e){function t(e,t){return RegExp(e.replace(/<ID>/g,function(){return`(?!\\s)[_$a-zA-Z\\xA0-\\uFFFF](?:(?!\\s)[$\\w\\xA0-\\uFFFF])*`}),t)}e.languages.insertBefore(`javascript`,`function-variable`,{"method-variable":{pattern:RegExp(`(\\.\\s*)`+e.languages.javascript[`function-variable`].pattern.source),lookbehind:!0,alias:[`function-variable`,`method`,`function`,`property-access`]}}),e.languages.insertBefore(`javascript`,`function`,{method:{pattern:RegExp(`(\\.\\s*)`+e.languages.javascript.function.source),lookbehind:!0,alias:[`function`,`property-access`]}}),e.languages.insertBefore(`javascript`,`constant`,{"known-class-name":[{pattern:/\b(?:(?:Float(?:32|64)|(?:Int|Uint)(?:8|16|32)|Uint8Clamped)?Array|ArrayBuffer|BigInt|Boolean|DataView|Date|Error|Function|Intl|JSON|(?:Weak)?(?:Map|Set)|Math|Number|Object|Promise|Proxy|Reflect|RegExp|String|Symbol|WebAssembly)\b/,alias:`class-name`},{pattern:/\b(?:[A-Z]\w*)Error\b/,alias:`class-name`}]}),e.languages.insertBefore(`javascript`,`keyword`,{imports:{pattern:t(`(\\bimport\\b\\s*)(?:<ID>(?:\\s*,\\s*(?:\\*\\s*as\\s+<ID>|\\{[^{}]*\\}))?|\\*\\s*as\\s+<ID>|\\{[^{}]*\\})(?=\\s*\\bfrom\\b)`),lookbehind:!0,inside:e.languages.javascript},exports:{pattern:t(`(\\bexport\\b\\s*)(?:\\*(?:\\s*as\\s+<ID>)?(?=\\s*\\bfrom\\b)|\\{[^{}]*\\})`),lookbehind:!0,inside:e.languages.javascript}}),e.languages.javascript.keyword.unshift({pattern:/\b(?:as|default|export|from|import)\b/,alias:`module`},{pattern:/\b(?:await|break|catch|continue|do|else|finally|for|if|return|switch|throw|try|while|yield)\b/,alias:`control-flow`},{pattern:/\bnull\b/,alias:[`null`,`nil`]},{pattern:/\bundefined\b/,alias:`nil`}),e.languages.insertBefore(`javascript`,`operator`,{spread:{pattern:/\.{3}/,alias:`operator`},arrow:{pattern:/=>/,alias:`operator`}}),e.languages.insertBefore(`javascript`,`punctuation`,{"property-access":{pattern:t(`(\\.\\s*)#?<ID>`),lookbehind:!0},"maybe-class-name":{pattern:/(^|[^$\w\xA0-\uFFFF])[A-Z][$\w\xA0-\uFFFF]+/,lookbehind:!0},dom:{pattern:/\b(?:document|(?:local|session)Storage|location|navigator|performance|window)\b/,alias:`variable`},console:{pattern:/\bconsole(?=\s*\.)/,alias:`class-name`}});for(var n=[`function`,`function-variable`,`method`,`method-variable`,`property-access`],r=0;r<n.length;r++){var i=n[r],a=e.languages.javascript[i],i=(a=e.util.type(a)===`RegExp`?e.languages.javascript[i]={pattern:a}:a).inside||{};(a.inside=i)[`maybe-class-name`]=/^[A-Z][\s\S]*/}}(Y),function(e){var t=e.util.clone(e.languages.javascript),n=`(?:\\s|\\/\\/.*(?!.)|\\/\\*(?:[^*]|\\*(?!\\/))\\*\\/)`,r=`(?:\\{(?:\\{(?:\\{[^{}]*\\}|[^{}])*\\}|[^{}])*\\})`,i=`(?:\\{<S>*\\.{3}(?:[^{}]|<BRACES>)*\\})`;function a(e,t){return e=e.replace(/<S>/g,function(){return n}).replace(/<BRACES>/g,function(){return r}).replace(/<SPREAD>/g,function(){return i}),RegExp(e,t)}i=a(i).source,e.languages.jsx=e.languages.extend(`markup`,t),e.languages.jsx.tag.pattern=a(`<\\/?(?:[\\w.:-]+(?:<S>+(?:[\\w.:$-]+(?:=(?:"(?:\\\\[\\s\\S]|[^\\\\"])*"|'(?:\\\\[\\s\\S]|[^\\\\'])*'|[^\\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\\/?)?>`),e.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,e.languages.jsx.tag.inside[`attr-value`].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,e.languages.jsx.tag.inside.tag.inside[`class-name`]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,e.languages.jsx.tag.inside.comment=t.comment,e.languages.insertBefore(`inside`,`attr-name`,{spread:{pattern:a(`<SPREAD>`),inside:e.languages.jsx}},e.languages.jsx.tag),e.languages.insertBefore(`inside`,`special-attr`,{script:{pattern:a(`=<BRACES>`),alias:`language-javascript`,inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:`punctuation`},rest:e.languages.jsx}}},e.languages.jsx.tag);function o(t){for(var n=[],r=0;r<t.length;r++){var i=t[r],a=!1;typeof i!=`string`&&(i.type===`tag`&&i.content[0]&&i.content[0].type===`tag`?i.content[0].content[0].content===`</`?0<n.length&&n[n.length-1].tagName===s(i.content[0].content[1])&&n.pop():i.content[i.content.length-1].content!==`/>`&&n.push({tagName:s(i.content[0].content[1]),openedBraces:0}):0<n.length&&i.type===`punctuation`&&i.content===`{`?n[n.length-1].openedBraces++:0<n.length&&0<n[n.length-1].openedBraces&&i.type===`punctuation`&&i.content===`}`?n[n.length-1].openedBraces--:a=!0),(a||typeof i==`string`)&&0<n.length&&n[n.length-1].openedBraces===0&&(a=s(i),r<t.length-1&&(typeof t[r+1]==`string`||t[r+1].type===`plain-text`)&&(a+=s(t[r+1]),t.splice(r+1,1)),0<r&&(typeof t[r-1]==`string`||t[r-1].type===`plain-text`)&&(a=s(t[r-1])+a,t.splice(r-1,1),r--),t[r]=new e.Token(`plain-text`,a,null,a)),i.content&&typeof i.content!=`string`&&o(i.content)}}var s=function(e){return e?typeof e==`string`?e:typeof e.content==`string`?e.content:e.content.map(s).join(``):``};e.hooks.add(`after-tokenize`,function(e){e.language!==`jsx`&&e.language!==`tsx`||o(e.tokens)})}(Y),function(e){var t=e.util.clone(e.languages.typescript),t=(e.languages.tsx=e.languages.extend(`jsx`,t),delete e.languages.tsx.parameter,delete e.languages.tsx[`literal-property`],e.languages.tsx.tag);t.pattern=RegExp(`(^|[^\\w$]|(?=<\\/))(?:`+t.pattern.source+`)`,t.pattern.flags),t.lookbehind=!0}(Y),Y.languages.swift={comment:{pattern:/(^|[^\\:])(?:\/\/.*|\/\*(?:[^/*]|\/(?!\*)|\*(?!\/)|\/\*(?:[^*]|\*(?!\/))*\*\/)*\*\/)/,lookbehind:!0,greedy:!0},"string-literal":[{pattern:RegExp(`(^|[^"#])(?:"(?:\\\\(?:\\((?:[^()]|\\([^()]*\\))*\\)|\\r\\n|[^(])|[^\\\\\\r\\n"])*"|"""(?:\\\\(?:\\((?:[^()]|\\([^()]*\\))*\\)|[^(])|[^\\\\"]|"(?!""))*""")(?!["#])`),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\\($/,alias:`punctuation`},punctuation:/\\(?=[\r\n])/,string:/[\s\S]+/}},{pattern:RegExp(`(^|[^"#])(#+)(?:"(?:\\\\(?:#+\\((?:[^()]|\\([^()]*\\))*\\)|\\r\\n|[^#])|[^\\\\\\r\\n])*?"|"""(?:\\\\(?:#+\\((?:[^()]|\\([^()]*\\))*\\)|[^#])|[^\\\\])*?""")\\2`),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\#+\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\#+\($/,alias:`punctuation`},string:/[\s\S]+/}}],directive:{pattern:RegExp(`#(?:(?:elseif|if)\\b(?:[ ]*(?:![ \\t]*)?(?:\\b\\w+\\b(?:[ \\t]*\\((?:[^()]|\\([^()]*\\))*\\))?|\\((?:[^()]|\\([^()]*\\))*\\))(?:[ \\t]*(?:&&|\\|\\|))?)+|(?:else|endif)\\b)`),alias:`property`,inside:{"directive-name":/^#\w+/,boolean:/\b(?:false|true)\b/,number:/\b\d+(?:\.\d+)*\b/,operator:/!|&&|\|\||[<>]=?/,punctuation:/[(),]/}},literal:{pattern:/#(?:colorLiteral|column|dsohandle|file(?:ID|Literal|Path)?|function|imageLiteral|line)\b/,alias:`constant`},"other-directive":{pattern:/#\w+\b/,alias:`property`},attribute:{pattern:/@\w+/,alias:`atrule`},"function-definition":{pattern:/(\bfunc\s+)\w+/,lookbehind:!0,alias:`function`},label:{pattern:/\b(break|continue)\s+\w+|\b[a-zA-Z_]\w*(?=\s*:\s*(?:for|repeat|while)\b)/,lookbehind:!0,alias:`important`},keyword:/\b(?:Any|Protocol|Self|Type|actor|as|assignment|associatedtype|associativity|async|await|break|case|catch|class|continue|convenience|default|defer|deinit|didSet|do|dynamic|else|enum|extension|fallthrough|fileprivate|final|for|func|get|guard|higherThan|if|import|in|indirect|infix|init|inout|internal|is|isolated|lazy|left|let|lowerThan|mutating|none|nonisolated|nonmutating|open|operator|optional|override|postfix|precedencegroup|prefix|private|protocol|public|repeat|required|rethrows|return|right|safe|self|set|some|static|struct|subscript|super|switch|throw|throws|try|typealias|unowned|unsafe|var|weak|where|while|willSet)\b/,boolean:/\b(?:false|true)\b/,nil:{pattern:/\bnil\b/,alias:`constant`},"short-argument":/\$\d+\b/,omit:{pattern:/\b_\b/,alias:`keyword`},number:/\b(?:[\d_]+(?:\.[\de_]+)?|0x[a-f0-9_]+(?:\.[a-f0-9p_]+)?|0b[01_]+|0o[0-7_]+)\b/i,"class-name":/\b[A-Z](?:[A-Z_\d]*[a-z]\w*)?\b/,function:/\b[a-z_]\w*(?=\s*\()/i,constant:/\b(?:[A-Z_]{2,}|k[A-Z][A-Za-z_]+)\b/,operator:/[-+*/%=!<>&|^~?]+|\.[.\-+*/%=!<>&|^~?]+/,punctuation:/[{}[\]();,.:\\]/},Y.languages.swift[`string-literal`].forEach(function(e){e.inside.interpolation.inside=Y.languages.swift}),function(e){e.languages.kotlin=e.languages.extend(`clike`,{keyword:{pattern:/(^|[^.])\b(?:abstract|actual|annotation|as|break|by|catch|class|companion|const|constructor|continue|crossinline|data|do|dynamic|else|enum|expect|external|final|finally|for|fun|get|if|import|in|infix|init|inline|inner|interface|internal|is|lateinit|noinline|null|object|open|operator|out|override|package|private|protected|public|reified|return|sealed|set|super|suspend|tailrec|this|throw|to|try|typealias|val|var|vararg|when|where|while)\b/,lookbehind:!0},function:[{pattern:/(?:`[^\r\n`]+`|\b\w+)(?=\s*\()/,greedy:!0},{pattern:/(\.)(?:`[^\r\n`]+`|\w+)(?=\s*\{)/,lookbehind:!0,greedy:!0}],number:/\b(?:0[xX][\da-fA-F]+(?:_[\da-fA-F]+)*|0[bB][01]+(?:_[01]+)*|\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?[fFL]?)\b/,operator:/\+[+=]?|-[-=>]?|==?=?|!(?:!|==?)?|[\/*%<>]=?|[?:]:?|\.\.|&&|\|\||\b(?:and|inv|or|shl|shr|ushr|xor)\b/}),delete e.languages.kotlin[`class-name`];var t={"interpolation-punctuation":{pattern:/^\$\{?|\}$/,alias:`punctuation`},expression:{pattern:/[\s\S]+/,inside:e.languages.kotlin}};e.languages.insertBefore(`kotlin`,`string`,{"string-literal":[{pattern:/"""(?:[^$]|\$(?:(?!\{)|\{[^{}]*\}))*?"""/,alias:`multiline`,inside:{interpolation:{pattern:/\$(?:[a-z_]\w*|\{[^{}]*\})/i,inside:t},string:/[\s\S]+/}},{pattern:/"(?:[^"\\\r\n$]|\\.|\$(?:(?!\{)|\{[^{}]*\}))*"/,alias:`singleline`,inside:{interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$(?:[a-z_]\w*|\{[^{}]*\})/i,lookbehind:!0,inside:t},string:/[\s\S]+/}}],char:{pattern:/'(?:[^'\\\r\n]|\\(?:.|u[a-fA-F0-9]{0,4}))'/,greedy:!0}}),delete e.languages.kotlin.string,e.languages.insertBefore(`kotlin`,`keyword`,{annotation:{pattern:/\B@(?:\w+:)?(?:[A-Z]\w*|\[[^\]]+\])/,alias:`builtin`}}),e.languages.insertBefore(`kotlin`,`function`,{label:{pattern:/\b\w+@|@\w+\b/,alias:`symbol`}}),e.languages.kt=e.languages.kotlin,e.languages.kts=e.languages.kotlin}(Y),Y.languages.c=Y.languages.extend(`clike`,{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/}),Y.languages.insertBefore(`c`,`string`,{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}}),Y.languages.insertBefore(`c`,`string`,{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:`property`,inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},Y.languages.c.string],char:Y.languages.c.char,comment:Y.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:`function`}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:`keyword`},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:Y.languages.c}}}}),Y.languages.insertBefore(`c`,`function`,{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/}),delete Y.languages.c.boolean,Y.languages.objectivec=Y.languages.extend(`c`,{string:{pattern:/@?"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},keyword:/\b(?:asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|in|inline|int|long|register|return|self|short|signed|sizeof|static|struct|super|switch|typedef|typeof|union|unsigned|void|volatile|while)\b|(?:@interface|@end|@implementation|@protocol|@class|@public|@protected|@private|@property|@try|@catch|@finally|@throw|@synthesize|@dynamic|@selector)\b/,operator:/-[->]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|\|?|[~^%?*\/@]/}),delete Y.languages.objectivec[`class-name`],Y.languages.objc=Y.languages.objectivec,Y.languages.reason=Y.languages.extend(`clike`,{string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^\\\r\n"])*"/,greedy:!0},"class-name":/\b[A-Z]\w*/,keyword:/\b(?:and|as|assert|begin|class|constraint|do|done|downto|else|end|exception|external|for|fun|function|functor|if|in|include|inherit|initializer|lazy|let|method|module|mutable|new|nonrec|object|of|open|or|private|rec|sig|struct|switch|then|to|try|type|val|virtual|when|while|with)\b/,operator:/\.{3}|:[:=]|\|>|->|=(?:==?|>)?|<=?|>=?|[|^?'#!~`]|[+\-*\/]\.?|\b(?:asr|land|lor|lsl|lsr|lxor|mod)\b/}),Y.languages.insertBefore(`reason`,`class-name`,{char:{pattern:/'(?:\\x[\da-f]{2}|\\o[0-3][0-7][0-7]|\\\d{3}|\\.|[^'\\\r\n])'/,greedy:!0},constructor:/\b[A-Z]\w*\b(?!\s*\.)/,label:{pattern:/\b[a-z]\w*(?=::)/,alias:`symbol`}}),delete Y.languages.reason.function,function(e){for(var t=`\\/\\*(?:[^*/]|\\*(?!\\/)|\\/(?!\\*)|<self>)*\\*\\/`,n=0;n<2;n++)t=t.replace(/<self>/g,function(){return t});t=t.replace(/<self>/g,function(){return`[^\\s\\S]`}),e.languages.rust={comment:[{pattern:RegExp(`(^|[^\\\\])`+t),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:`attr-name`,inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:`punctuation`},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:`symbol`},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:`punctuation`},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:`function`},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:`class-name`},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:`namespace`},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:`namespace`,inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:`property`},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/},e.languages.rust[`closure-params`].inside.rest=e.languages.rust,e.languages.rust.attribute.inside.string=e.languages.rust.string}(Y),Y.languages.go=Y.languages.extend(`clike`,{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/}),Y.languages.insertBefore(`go`,`string`,{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}}),delete Y.languages.go[`class-name`],function(e){var t=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,n=`\\b(?!<keyword>)\\w+(?:\\s*\\.\\s*\\w+)*\\b`.replace(/<keyword>/g,function(){return t.source});e.languages.cpp=e.languages.extend(`c`,{"class-name":[{pattern:RegExp(`(\\b(?:class|concept|enum|struct|typename)\\s+)(?!<keyword>)\\w+`.replace(/<keyword>/g,function(){return t.source})),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:t,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),e.languages.insertBefore(`cpp`,`string`,{module:{pattern:RegExp(`(\\b(?:import|module)\\s+)(?:"(?:\\\\(?:\\r\\n|[\\s\\S])|[^"\\\\\\r\\n])*"|<[^<>\\r\\n]*>|`+`<mod-name>(?:\\s*:\\s*<mod-name>)?|:\\s*<mod-name>`.replace(/<mod-name>/g,function(){return n})+`)`),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:`string`,greedy:!0}}),e.languages.insertBefore(`cpp`,`keyword`,{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:`class-name`,inside:e.languages.cpp}}}}),e.languages.insertBefore(`cpp`,`operator`,{"double-colon":{pattern:/::/,alias:`punctuation`}}),e.languages.insertBefore(`cpp`,`class-name`,{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:e.languages.extend(`cpp`,{})}}),e.languages.insertBefore(`inside`,`double-colon`,{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},e.languages.cpp[`base-clause`])}(Y),Y.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:`punctuation`},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:`string`},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:[`annotation`,`punctuation`],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},Y.languages.python[`string-interpolation`].inside.interpolation.inside.rest=Y.languages.python,Y.languages.py=Y.languages.python,Y.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:`keyword`}},Y.languages.webmanifest=Y.languages.json;var AB={};OB(AB,{dracula:()=>jB,duotoneDark:()=>MB,duotoneLight:()=>NB,github:()=>PB,gruvboxMaterialDark:()=>XB,gruvboxMaterialLight:()=>ZB,jettwaveDark:()=>KB,jettwaveLight:()=>qB,nightOwl:()=>FB,nightOwlLight:()=>IB,oceanicNext:()=>RB,okaidia:()=>zB,oneDark:()=>JB,oneLight:()=>YB,palenight:()=>BB,shadesOfPurple:()=>VB,synthwave84:()=>HB,ultramin:()=>UB,vsDark:()=>WB,vsLight:()=>GB});var jB={plain:{color:`#F8F8F2`,backgroundColor:`#282A36`},styles:[{types:[`prolog`,`constant`,`builtin`],style:{color:`rgb(189, 147, 249)`}},{types:[`inserted`,`function`],style:{color:`rgb(80, 250, 123)`}},{types:[`deleted`],style:{color:`rgb(255, 85, 85)`}},{types:[`changed`],style:{color:`rgb(255, 184, 108)`}},{types:[`punctuation`,`symbol`],style:{color:`rgb(248, 248, 242)`}},{types:[`string`,`char`,`tag`,`selector`],style:{color:`rgb(255, 121, 198)`}},{types:[`keyword`,`variable`],style:{color:`rgb(189, 147, 249)`,fontStyle:`italic`}},{types:[`comment`],style:{color:`rgb(98, 114, 164)`}},{types:[`attr-name`],style:{color:`rgb(241, 250, 140)`}}]},MB={plain:{backgroundColor:`#2a2734`,color:`#9a86fd`},styles:[{types:[`comment`,`prolog`,`doctype`,`cdata`,`punctuation`],style:{color:`#6c6783`}},{types:[`namespace`],style:{opacity:.7}},{types:[`tag`,`operator`,`number`],style:{color:`#e09142`}},{types:[`property`,`function`],style:{color:`#9a86fd`}},{types:[`tag-id`,`selector`,`atrule-id`],style:{color:`#eeebff`}},{types:[`attr-name`],style:{color:`#c4b9fe`}},{types:[`boolean`,`string`,`entity`,`url`,`attr-value`,`keyword`,`control`,`directive`,`unit`,`statement`,`regex`,`atrule`,`placeholder`,`variable`],style:{color:`#ffcc99`}},{types:[`deleted`],style:{textDecorationLine:`line-through`}},{types:[`inserted`],style:{textDecorationLine:`underline`}},{types:[`italic`],style:{fontStyle:`italic`}},{types:[`important`,`bold`],style:{fontWeight:`bold`}},{types:[`important`],style:{color:`#c4b9fe`}}]},NB={plain:{backgroundColor:`#faf8f5`,color:`#728fcb`},styles:[{types:[`comment`,`prolog`,`doctype`,`cdata`,`punctuation`],style:{color:`#b6ad9a`}},{types:[`namespace`],style:{opacity:.7}},{types:[`tag`,`operator`,`number`],style:{color:`#063289`}},{types:[`property`,`function`],style:{color:`#b29762`}},{types:[`tag-id`,`selector`,`atrule-id`],style:{color:`#2d2006`}},{types:[`attr-name`],style:{color:`#896724`}},{types:[`boolean`,`string`,`entity`,`url`,`attr-value`,`keyword`,`control`,`directive`,`unit`,`statement`,`regex`,`atrule`],style:{color:`#728fcb`}},{types:[`placeholder`,`variable`],style:{color:`#93abdc`}},{types:[`deleted`],style:{textDecorationLine:`line-through`}},{types:[`inserted`],style:{textDecorationLine:`underline`}},{types:[`italic`],style:{fontStyle:`italic`}},{types:[`important`,`bold`],style:{fontWeight:`bold`}},{types:[`important`],style:{color:`#896724`}}]},PB={plain:{color:`#393A34`,backgroundColor:`#f6f8fa`},styles:[{types:[`comment`,`prolog`,`doctype`,`cdata`],style:{color:`#999988`,fontStyle:`italic`}},{types:[`namespace`],style:{opacity:.7}},{types:[`string`,`attr-value`],style:{color:`#e3116c`}},{types:[`punctuation`,`operator`],style:{color:`#393A34`}},{types:[`entity`,`url`,`symbol`,`number`,`boolean`,`variable`,`constant`,`property`,`regex`,`inserted`],style:{color:`#36acaa`}},{types:[`atrule`,`keyword`,`attr-name`,`selector`],style:{color:`#00a4db`}},{types:[`function`,`deleted`,`tag`],style:{color:`#d73a49`}},{types:[`function-variable`],style:{color:`#6f42c1`}},{types:[`tag`,`selector`,`keyword`],style:{color:`#00009f`}}]},FB={plain:{color:`#d6deeb`,backgroundColor:`#011627`},styles:[{types:[`changed`],style:{color:`rgb(162, 191, 252)`,fontStyle:`italic`}},{types:[`deleted`],style:{color:`rgba(239, 83, 80, 0.56)`,fontStyle:`italic`}},{types:[`inserted`,`attr-name`],style:{color:`rgb(173, 219, 103)`,fontStyle:`italic`}},{types:[`comment`],style:{color:`rgb(99, 119, 119)`,fontStyle:`italic`}},{types:[`string`,`url`],style:{color:`rgb(173, 219, 103)`}},{types:[`variable`],style:{color:`rgb(214, 222, 235)`}},{types:[`number`],style:{color:`rgb(247, 140, 108)`}},{types:[`builtin`,`char`,`constant`,`function`],style:{color:`rgb(130, 170, 255)`}},{types:[`punctuation`],style:{color:`rgb(199, 146, 234)`}},{types:[`selector`,`doctype`],style:{color:`rgb(199, 146, 234)`,fontStyle:`italic`}},{types:[`class-name`],style:{color:`rgb(255, 203, 139)`}},{types:[`tag`,`operator`,`keyword`],style:{color:`rgb(127, 219, 202)`}},{types:[`boolean`],style:{color:`rgb(255, 88, 116)`}},{types:[`property`],style:{color:`rgb(128, 203, 196)`}},{types:[`namespace`],style:{color:`rgb(178, 204, 214)`}}]},IB={plain:{color:`#403f53`,backgroundColor:`#FBFBFB`},styles:[{types:[`changed`],style:{color:`rgb(162, 191, 252)`,fontStyle:`italic`}},{types:[`deleted`],style:{color:`rgba(239, 83, 80, 0.56)`,fontStyle:`italic`}},{types:[`inserted`,`attr-name`],style:{color:`rgb(72, 118, 214)`,fontStyle:`italic`}},{types:[`comment`],style:{color:`rgb(152, 159, 177)`,fontStyle:`italic`}},{types:[`string`,`builtin`,`char`,`constant`,`url`],style:{color:`rgb(72, 118, 214)`}},{types:[`variable`],style:{color:`rgb(201, 103, 101)`}},{types:[`number`],style:{color:`rgb(170, 9, 130)`}},{types:[`punctuation`],style:{color:`rgb(153, 76, 195)`}},{types:[`function`,`selector`,`doctype`],style:{color:`rgb(153, 76, 195)`,fontStyle:`italic`}},{types:[`class-name`],style:{color:`rgb(17, 17, 17)`}},{types:[`tag`],style:{color:`rgb(153, 76, 195)`}},{types:[`operator`,`property`,`keyword`,`namespace`],style:{color:`rgb(12, 150, 155)`}},{types:[`boolean`],style:{color:`rgb(188, 84, 84)`}}]},LB={char:`#D8DEE9`,comment:`#999999`,keyword:`#c5a5c5`,primitive:`#5a9bcf`,string:`#8dc891`,variable:`#d7deea`,boolean:`#ff8b50`,punctuation:`#5FB3B3`,tag:`#fc929e`,function:`#79b6f2`,className:`#FAC863`,method:`#6699CC`,operator:`#fc929e`},RB={plain:{backgroundColor:`#282c34`,color:`#ffffff`},styles:[{types:[`attr-name`],style:{color:LB.keyword}},{types:[`attr-value`],style:{color:LB.string}},{types:[`comment`,`block-comment`,`prolog`,`doctype`,`cdata`,`shebang`],style:{color:LB.comment}},{types:[`property`,`number`,`function-name`,`constant`,`symbol`,`deleted`],style:{color:LB.primitive}},{types:[`boolean`],style:{color:LB.boolean}},{types:[`tag`],style:{color:LB.tag}},{types:[`string`],style:{color:LB.string}},{types:[`punctuation`],style:{color:LB.string}},{types:[`selector`,`char`,`builtin`,`inserted`],style:{color:LB.char}},{types:[`function`],style:{color:LB.function}},{types:[`operator`,`entity`,`url`,`variable`],style:{color:LB.variable}},{types:[`keyword`],style:{color:LB.keyword}},{types:[`atrule`,`class-name`],style:{color:LB.className}},{types:[`important`],style:{fontWeight:`400`}},{types:[`bold`],style:{fontWeight:`bold`}},{types:[`italic`],style:{fontStyle:`italic`}},{types:[`namespace`],style:{opacity:.7}}]},zB={plain:{color:`#f8f8f2`,backgroundColor:`#272822`},styles:[{types:[`changed`],style:{color:`rgb(162, 191, 252)`,fontStyle:`italic`}},{types:[`deleted`],style:{color:`#f92672`,fontStyle:`italic`}},{types:[`inserted`],style:{color:`rgb(173, 219, 103)`,fontStyle:`italic`}},{types:[`comment`],style:{color:`#8292a2`,fontStyle:`italic`}},{types:[`string`,`url`],style:{color:`#a6e22e`}},{types:[`variable`],style:{color:`#f8f8f2`}},{types:[`number`],style:{color:`#ae81ff`}},{types:[`builtin`,`char`,`constant`,`function`,`class-name`],style:{color:`#e6db74`}},{types:[`punctuation`],style:{color:`#f8f8f2`}},{types:[`selector`,`doctype`],style:{color:`#a6e22e`,fontStyle:`italic`}},{types:[`tag`,`operator`,`keyword`],style:{color:`#66d9ef`}},{types:[`boolean`],style:{color:`#ae81ff`}},{types:[`namespace`],style:{color:`rgb(178, 204, 214)`,opacity:.7}},{types:[`tag`,`property`],style:{color:`#f92672`}},{types:[`attr-name`],style:{color:`#a6e22e !important`}},{types:[`doctype`],style:{color:`#8292a2`}},{types:[`rule`],style:{color:`#e6db74`}}]},BB={plain:{color:`#bfc7d5`,backgroundColor:`#292d3e`},styles:[{types:[`comment`],style:{color:`rgb(105, 112, 152)`,fontStyle:`italic`}},{types:[`string`,`inserted`],style:{color:`rgb(195, 232, 141)`}},{types:[`number`],style:{color:`rgb(247, 140, 108)`}},{types:[`builtin`,`char`,`constant`,`function`],style:{color:`rgb(130, 170, 255)`}},{types:[`punctuation`,`selector`],style:{color:`rgb(199, 146, 234)`}},{types:[`variable`],style:{color:`rgb(191, 199, 213)`}},{types:[`class-name`,`attr-name`],style:{color:`rgb(255, 203, 107)`}},{types:[`tag`,`deleted`],style:{color:`rgb(255, 85, 114)`}},{types:[`operator`],style:{color:`rgb(137, 221, 255)`}},{types:[`boolean`],style:{color:`rgb(255, 88, 116)`}},{types:[`keyword`],style:{fontStyle:`italic`}},{types:[`doctype`],style:{color:`rgb(199, 146, 234)`,fontStyle:`italic`}},{types:[`namespace`],style:{color:`rgb(178, 204, 214)`}},{types:[`url`],style:{color:`rgb(221, 221, 221)`}}]},VB={plain:{color:`#9EFEFF`,backgroundColor:`#2D2A55`},styles:[{types:[`changed`],style:{color:`rgb(255, 238, 128)`}},{types:[`deleted`],style:{color:`rgba(239, 83, 80, 0.56)`}},{types:[`inserted`],style:{color:`rgb(173, 219, 103)`}},{types:[`comment`],style:{color:`rgb(179, 98, 255)`,fontStyle:`italic`}},{types:[`punctuation`],style:{color:`rgb(255, 255, 255)`}},{types:[`constant`],style:{color:`rgb(255, 98, 140)`}},{types:[`string`,`url`],style:{color:`rgb(165, 255, 144)`}},{types:[`variable`],style:{color:`rgb(255, 238, 128)`}},{types:[`number`,`boolean`],style:{color:`rgb(255, 98, 140)`}},{types:[`attr-name`],style:{color:`rgb(255, 180, 84)`}},{types:[`keyword`,`operator`,`property`,`namespace`,`tag`,`selector`,`doctype`],style:{color:`rgb(255, 157, 0)`}},{types:[`builtin`,`char`,`constant`,`function`,`class-name`],style:{color:`rgb(250, 208, 0)`}}]},HB={plain:{backgroundColor:`linear-gradient(to bottom, #2a2139 75%, #34294f)`,backgroundImage:`#34294f`,color:`#f92aad`,textShadow:`0 0 2px #100c0f, 0 0 5px #dc078e33, 0 0 10px #fff3`},styles:[{types:[`comment`,`block-comment`,`prolog`,`doctype`,`cdata`],style:{color:`#495495`,fontStyle:`italic`}},{types:[`punctuation`],style:{color:`#ccc`}},{types:[`tag`,`attr-name`,`namespace`,`number`,`unit`,`hexcode`,`deleted`],style:{color:`#e2777a`}},{types:[`property`,`selector`],style:{color:`#72f1b8`,textShadow:`0 0 2px #100c0f, 0 0 10px #257c5575, 0 0 35px #21272475`}},{types:[`function-name`],style:{color:`#6196cc`}},{types:[`boolean`,`selector-id`,`function`],style:{color:`#fdfdfd`,textShadow:`0 0 2px #001716, 0 0 3px #03edf975, 0 0 5px #03edf975, 0 0 8px #03edf975`}},{types:[`class-name`,`maybe-class-name`,`builtin`],style:{color:`#fff5f6`,textShadow:`0 0 2px #000, 0 0 10px #fc1f2c75, 0 0 5px #fc1f2c75, 0 0 25px #fc1f2c75`}},{types:[`constant`,`symbol`],style:{color:`#f92aad`,textShadow:`0 0 2px #100c0f, 0 0 5px #dc078e33, 0 0 10px #fff3`}},{types:[`important`,`atrule`,`keyword`,`selector-class`],style:{color:`#f4eee4`,textShadow:`0 0 2px #393a33, 0 0 8px #f39f0575, 0 0 2px #f39f0575`}},{types:[`string`,`char`,`attr-value`,`regex`,`variable`],style:{color:`#f87c32`}},{types:[`parameter`],style:{fontStyle:`italic`}},{types:[`entity`,`url`],style:{color:`#67cdcc`}},{types:[`operator`],style:{color:`ffffffee`}},{types:[`important`,`bold`],style:{fontWeight:`bold`}},{types:[`italic`],style:{fontStyle:`italic`}},{types:[`entity`],style:{cursor:`help`}},{types:[`inserted`],style:{color:`green`}}]},UB={plain:{color:`#282a2e`,backgroundColor:`#ffffff`},styles:[{types:[`comment`],style:{color:`rgb(197, 200, 198)`}},{types:[`string`,`number`,`builtin`,`variable`],style:{color:`rgb(150, 152, 150)`}},{types:[`class-name`,`function`,`tag`,`attr-name`],style:{color:`rgb(40, 42, 46)`}}]},WB={plain:{color:`#9CDCFE`,backgroundColor:`#1E1E1E`},styles:[{types:[`prolog`],style:{color:`rgb(0, 0, 128)`}},{types:[`comment`],style:{color:`rgb(106, 153, 85)`}},{types:[`builtin`,`changed`,`keyword`,`interpolation-punctuation`],style:{color:`rgb(86, 156, 214)`}},{types:[`number`,`inserted`],style:{color:`rgb(181, 206, 168)`}},{types:[`constant`],style:{color:`rgb(100, 102, 149)`}},{types:[`attr-name`,`variable`],style:{color:`rgb(156, 220, 254)`}},{types:[`deleted`,`string`,`attr-value`,`template-punctuation`],style:{color:`rgb(206, 145, 120)`}},{types:[`selector`],style:{color:`rgb(215, 186, 125)`}},{types:[`tag`],style:{color:`rgb(78, 201, 176)`}},{types:[`tag`],languages:[`markup`],style:{color:`rgb(86, 156, 214)`}},{types:[`punctuation`,`operator`],style:{color:`rgb(212, 212, 212)`}},{types:[`punctuation`],languages:[`markup`],style:{color:`#808080`}},{types:[`function`],style:{color:`rgb(220, 220, 170)`}},{types:[`class-name`],style:{color:`rgb(78, 201, 176)`}},{types:[`char`],style:{color:`rgb(209, 105, 105)`}}]},GB={plain:{color:`#000000`,backgroundColor:`#ffffff`},styles:[{types:[`comment`],style:{color:`rgb(0, 128, 0)`}},{types:[`builtin`],style:{color:`rgb(0, 112, 193)`}},{types:[`number`,`variable`,`inserted`],style:{color:`rgb(9, 134, 88)`}},{types:[`operator`],style:{color:`rgb(0, 0, 0)`}},{types:[`constant`,`char`],style:{color:`rgb(129, 31, 63)`}},{types:[`tag`],style:{color:`rgb(128, 0, 0)`}},{types:[`attr-name`],style:{color:`rgb(255, 0, 0)`}},{types:[`deleted`,`string`],style:{color:`rgb(163, 21, 21)`}},{types:[`changed`,`punctuation`],style:{color:`rgb(4, 81, 165)`}},{types:[`function`,`keyword`],style:{color:`rgb(0, 0, 255)`}},{types:[`class-name`],style:{color:`rgb(38, 127, 153)`}}]},KB={plain:{color:`#f8fafc`,backgroundColor:`#011627`},styles:[{types:[`prolog`],style:{color:`#000080`}},{types:[`comment`],style:{color:`#6A9955`}},{types:[`builtin`,`changed`,`keyword`,`interpolation-punctuation`],style:{color:`#569CD6`}},{types:[`number`,`inserted`],style:{color:`#B5CEA8`}},{types:[`constant`],style:{color:`#f8fafc`}},{types:[`attr-name`,`variable`],style:{color:`#9CDCFE`}},{types:[`deleted`,`string`,`attr-value`,`template-punctuation`],style:{color:`#cbd5e1`}},{types:[`selector`],style:{color:`#D7BA7D`}},{types:[`tag`],style:{color:`#0ea5e9`}},{types:[`tag`],languages:[`markup`],style:{color:`#0ea5e9`}},{types:[`punctuation`,`operator`],style:{color:`#D4D4D4`}},{types:[`punctuation`],languages:[`markup`],style:{color:`#808080`}},{types:[`function`],style:{color:`#7dd3fc`}},{types:[`class-name`],style:{color:`#0ea5e9`}},{types:[`char`],style:{color:`#D16969`}}]},qB={plain:{color:`#0f172a`,backgroundColor:`#f1f5f9`},styles:[{types:[`prolog`],style:{color:`#000080`}},{types:[`comment`],style:{color:`#6A9955`}},{types:[`builtin`,`changed`,`keyword`,`interpolation-punctuation`],style:{color:`#0c4a6e`}},{types:[`number`,`inserted`],style:{color:`#B5CEA8`}},{types:[`constant`],style:{color:`#0f172a`}},{types:[`attr-name`,`variable`],style:{color:`#0c4a6e`}},{types:[`deleted`,`string`,`attr-value`,`template-punctuation`],style:{color:`#64748b`}},{types:[`selector`],style:{color:`#D7BA7D`}},{types:[`tag`],style:{color:`#0ea5e9`}},{types:[`tag`],languages:[`markup`],style:{color:`#0ea5e9`}},{types:[`punctuation`,`operator`],style:{color:`#475569`}},{types:[`punctuation`],languages:[`markup`],style:{color:`#808080`}},{types:[`function`],style:{color:`#0e7490`}},{types:[`class-name`],style:{color:`#0ea5e9`}},{types:[`char`],style:{color:`#D16969`}}]},JB={plain:{backgroundColor:`hsl(220, 13%, 18%)`,color:`hsl(220, 14%, 71%)`,textShadow:`0 1px rgba(0, 0, 0, 0.3)`},styles:[{types:[`comment`,`prolog`,`cdata`],style:{color:`hsl(220, 10%, 40%)`}},{types:[`doctype`,`punctuation`,`entity`],style:{color:`hsl(220, 14%, 71%)`}},{types:[`attr-name`,`class-name`,`maybe-class-name`,`boolean`,`constant`,`number`,`atrule`],style:{color:`hsl(29, 54%, 61%)`}},{types:[`keyword`],style:{color:`hsl(286, 60%, 67%)`}},{types:[`property`,`tag`,`symbol`,`deleted`,`important`],style:{color:`hsl(355, 65%, 65%)`}},{types:[`selector`,`string`,`char`,`builtin`,`inserted`,`regex`,`attr-value`],style:{color:`hsl(95, 38%, 62%)`}},{types:[`variable`,`operator`,`function`],style:{color:`hsl(207, 82%, 66%)`}},{types:[`url`],style:{color:`hsl(187, 47%, 55%)`}},{types:[`deleted`],style:{textDecorationLine:`line-through`}},{types:[`inserted`],style:{textDecorationLine:`underline`}},{types:[`italic`],style:{fontStyle:`italic`}},{types:[`important`,`bold`],style:{fontWeight:`bold`}},{types:[`important`],style:{color:`hsl(220, 14%, 71%)`}}]},YB={plain:{backgroundColor:`hsl(230, 1%, 98%)`,color:`hsl(230, 8%, 24%)`},styles:[{types:[`comment`,`prolog`,`cdata`],style:{color:`hsl(230, 4%, 64%)`}},{types:[`doctype`,`punctuation`,`entity`],style:{color:`hsl(230, 8%, 24%)`}},{types:[`attr-name`,`class-name`,`boolean`,`constant`,`number`,`atrule`],style:{color:`hsl(35, 99%, 36%)`}},{types:[`keyword`],style:{color:`hsl(301, 63%, 40%)`}},{types:[`property`,`tag`,`symbol`,`deleted`,`important`],style:{color:`hsl(5, 74%, 59%)`}},{types:[`selector`,`string`,`char`,`builtin`,`inserted`,`regex`,`attr-value`,`punctuation`],style:{color:`hsl(119, 34%, 47%)`}},{types:[`variable`,`operator`,`function`],style:{color:`hsl(221, 87%, 60%)`}},{types:[`url`],style:{color:`hsl(198, 99%, 37%)`}},{types:[`deleted`],style:{textDecorationLine:`line-through`}},{types:[`inserted`],style:{textDecorationLine:`underline`}},{types:[`italic`],style:{fontStyle:`italic`}},{types:[`important`,`bold`],style:{fontWeight:`bold`}},{types:[`important`],style:{color:`hsl(230, 8%, 24%)`}}]},XB={plain:{color:`#ebdbb2`,backgroundColor:`#292828`},styles:[{types:[`imports`,`class-name`,`maybe-class-name`,`constant`,`doctype`,`builtin`,`function`],style:{color:`#d8a657`}},{types:[`property-access`],style:{color:`#7daea3`}},{types:[`tag`],style:{color:`#e78a4e`}},{types:[`attr-name`,`char`,`url`,`regex`],style:{color:`#a9b665`}},{types:[`attr-value`,`string`],style:{color:`#89b482`}},{types:[`comment`,`prolog`,`cdata`,`operator`,`inserted`],style:{color:`#a89984`}},{types:[`delimiter`,`boolean`,`keyword`,`selector`,`important`,`atrule`,`property`,`variable`,`deleted`],style:{color:`#ea6962`}},{types:[`entity`,`number`,`symbol`],style:{color:`#d3869b`}}]},ZB={plain:{color:`#654735`,backgroundColor:`#f9f5d7`},styles:[{types:[`delimiter`,`boolean`,`keyword`,`selector`,`important`,`atrule`,`property`,`variable`,`deleted`],style:{color:`#af2528`}},{types:[`imports`,`class-name`,`maybe-class-name`,`constant`,`doctype`,`builtin`],style:{color:`#b4730e`}},{types:[`string`,`attr-value`],style:{color:`#477a5b`}},{types:[`property-access`],style:{color:`#266b79`}},{types:[`function`,`attr-name`,`char`,`url`],style:{color:`#72761e`}},{types:[`tag`],style:{color:`#b94c07`}},{types:[`comment`,`prolog`,`cdata`,`operator`,`inserted`],style:{color:`#a89984`}},{types:[`entity`,`number`,`symbol`],style:{color:`#924f79`}}]},QB=e=>(0,d.useCallback)(t=>{var n=t,{className:r,style:i,line:a}=n;let o=TB(wB({},EB(n,[`className`,`style`,`line`])),{className:P(`token-line`,r)});return typeof e==`object`&&`plain`in e&&(o.style=e.plain),typeof i==`object`&&(o.style=wB(wB({},o.style||{}),i)),o},[e]),$B=e=>{let t=(0,d.useCallback)(({types:t,empty:n})=>{if(e!=null)return t.length===1&&t[0]===`plain`?n==null?void 0:{display:`inline-block`}:t.length===1&&n!=null?e[t[0]]:Object.assign(n==null?{}:{display:`inline-block`},...t.map(t=>e[t]))},[e]);return(0,d.useCallback)(e=>{var n=e,{token:r,className:i,style:a}=n;let o=TB(wB({},EB(n,[`token`,`className`,`style`])),{className:P(`token`,...r.types,i),children:r.content,style:t(r)});return a!=null&&(o.style=wB(wB({},o.style||{}),a)),o},[t])},eV=/\r\n|\r|\n/,tV=e=>{e.length===0?e.push({types:[`plain`],content:`
72
72
  `,empty:!0}):e.length===1&&e[0].content===``&&(e[0].content=`
73
- `,e[0].empty=!0)},nV=(e,t)=>{let n=e.length;return n>0&&e[n-1]===t?e:e.concat(t)},rV=e=>{let t=[[]],n=[e],r=[0],i=[e.length],a=0,o=0,s=[],c=[s];for(;o>-1;){for(;(a=r[o]++)<i[o];){let e,l=t[o],u=n[o][a];if(typeof u==`string`?(l=o>0?l:[`plain`],e=u):(l=nV(l,u.type),u.alias&&(l=nV(l,u.alias)),e=u.content),typeof e!=`string`){o++,t.push(l),n.push(e),r.push(0),i.push(e.length);continue}let d=e.split(eV),f=d.length;s.push({types:l,content:d[0]});for(let e=1;e<f;e++)tV(s),c.push(s=[]),s.push({types:l,content:d[e]})}o--,t.pop(),n.pop(),r.pop(),i.pop()}return tV(s),c},iV=({prism:e,code:t,grammar:n,language:r})=>(0,d.useMemo)(()=>{if(n==null)return rV([t]);let i={code:t,grammar:n,language:r,tokens:[]};return e.hooks.run(`before-tokenize`,i),i.tokens=e.tokenize(t,n),e.hooks.run(`after-tokenize`,i),rV(i.tokens)},[t,n,r,e]),aV=(e,t)=>{let{plain:n}=e,r=e.styles.reduce((e,n)=>{let{languages:r,style:i}=n;return r&&!r.includes(t)||n.types.forEach(t=>{e[t]=wB(wB({},e[t]),i)}),e},{});return r.root=n,r.plain=TB(wB({},n),{backgroundColor:void 0}),r},oV=({children:e,language:t,code:n,theme:r,prism:i})=>{let a=t.toLowerCase(),o=aV(r,a),s=QB(o),c=$B(o),l=i.languages[a];return e({tokens:iV({prism:i,language:a,code:n,grammar:l}),className:`prism-code language-${a}`,style:o==null?{}:o.root,getLineProps:s,getTokenProps:c})},sV=e=>(0,d.createElement)(oV,TB(wB({},e),{prism:e.prism||Y,theme:e.theme||WB,code:e.code,language:e.language})),cV={"rst-codeblock":`_rst-codeblock_kcxwg_1`},lV=({children:e,className:t})=>{let n=t?.replace(/language-/,``)||`javascript`,r=[cV[`rst-codeblock`]].filter(Boolean).join(` `);return(0,h.jsx)(sV,{code:e.trim(),language:n,theme:AB.github,children:({className:e,style:t,tokens:n,getLineProps:i,getTokenProps:a})=>(0,h.jsx)(`pre`,{className:`${e} ${r}`,style:t,children:n.map((e,t)=>(0,h.jsx)(`div`,{...i({line:e}),children:e.map((e,t)=>(0,h.jsx)(`span`,{...a({token:e})},t))},t))})})},uV={h1:({children:e})=>(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(T,{variant:`display`,children:e}),(0,h.jsx)(`hr`,{})]}),h2:({children:e})=>(0,h.jsx)(T,{id:fB(String(e)),variant:`heading`,children:e}),h3:({children:e})=>(0,h.jsx)(T,{variant:`title`,children:e}),h4:({children:e})=>(0,h.jsx)(T,{variant:`subtitle`,children:e}),p:({children:e})=>(0,h.jsx)(T,{variant:`body`,children:e}),pre:({children:e})=>{let t=e;return(0,h.jsx)(lV,{className:t.props.className,children:String(t.props.children)})},code:({children:e})=>(0,h.jsx)(T,{variant:`code`,children:e}),ol:({children:e})=>(0,h.jsx)(`ol`,{children:e}),li:({children:e})=>(0,h.jsx)(`li`,{children:(0,h.jsx)(T,{variant:`body`,children:e})}),img:({src:e,alt:t})=>(0,h.jsxs)(`figure`,{children:[(0,h.jsx)(`img`,{src:e??``,alt:t??``,style:{maxWidth:`100%`}}),t&&(0,h.jsx)(`figcaption`,{children:(0,h.jsx)(T,{variant:`label`,children:t})})]}),Graph:Qz,Tag:E,Banner:O},dV=({content:e})=>e?(0,h.jsx)(dB,{components:uV,children:(0,h.jsx)(e,{components:uV})}):null;function fV({items:e,itemHeight:t,containerHeight:n,overscan:r=5}){let[i,a]=(0,d.useState)(0),o=(0,d.useRef)(null),s=e.length*t,c=Math.max(0,Math.floor(i/t)-r),l=Math.min(e.length-1,Math.floor((i+n)/t)+r),u=[];for(let n=c;n<=l;n++)u.push({item:e[n],index:n,offsetTop:n*t});let f=(0,d.useCallback)(e=>{let t=e.target.scrollTop;a(t)},[]);return{virtualItems:u,containerProps:{ref:o,style:{maxHeight:`${n}px`,overflowY:`auto`,position:`relative`,willChange:`transform`},onScroll:f},innerProps:{style:{height:`${s}px`,position:`relative`,width:`100%`}},scrollInfo:{scrollTop:i,viewportHeight:n,totalHeight:s,startIndex:c,endIndex:l},scrollToIndex:e=>{if(!o.current)return;let r=e*t,i=r+t,a=o.current,s=a.scrollTop,c=s+n;r<s?a.scrollTop=r:i>c&&(a.scrollTop=i-n)}}}var pV={"rst-list":`_rst-list_19ihv_1`,"rst-list-virtualScroll":`_rst-list-virtualScroll_19ihv_11`,"rst-list-input":`_rst-list-input_19ihv_15`,"rst-list-container":`_rst-list-container_19ihv_20`,"rst-list-listItem":`_rst-list-listItem_19ihv_25`,"rst-list-noElements":`_rst-list-noElements_19ihv_55`};function mV(e,t){if(!t)return e;let n=e.toLowerCase(),r=t.toLowerCase(),i=n.indexOf(r);if(i===-1)return e;let a=e.slice(0,i),o=e.slice(i,i+t.length),s=e.slice(i+t.length);return(0,h.jsxs)(`span`,{children:[a,(0,h.jsx)(`strong`,{children:o}),s]})}var hV=(e,t)=>{let n=e.filter(e=>e.value.toLowerCase().includes(t.toLowerCase())),r=n.some(e=>e.value.toLowerCase()===t.toLowerCase());return{filteredOptions:n,fullOptions:n,showCreateItem:!!(t&&!r)}},gV=({e,localSelectedIndex:t,setLocalSelectedIndex:n,filteredOptions:r,fullOptions:i,onClick:a,onKeyDown:o})=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let i=t;e.key===`ArrowDown`?i=t<r.length-1?t+1:0:e.key===`ArrowUp`&&(i=t>0?t-1:r.length-1),n(i)}else if(e.key===`Enter`){let e=i[t];a?.(e)}o?.(e)},_V={"rst-inputField-wrapper":`_rst-inputField-wrapper_whc7v_1`,"rst-input-wrapper":`_rst-input-wrapper_whc7v_7`,"rst-input-small":`_rst-input-small_whc7v_23`,"rst-input-default":`_rst-input-default_whc7v_28`,"rst-input-large":`_rst-input-large_whc7v_33`,"rst-input":`_rst-input_whc7v_1`,"rst-input-error":`_rst-input-error_whc7v_56`},vV=({error:e,disabled:t,size:n=`default`,leadingIcon:r,trailingIcon:i,className:a,children:o})=>{let s=(0,d.useId)(),c={fieldWrapper:`${_V[`rst-inputField-wrapper`]} ${a||``}`,inputWrapper:`${_V[`rst-input-wrapper`]} ${n?_V[`rst-input-${n}`]:``} ${e?_V[`rst-input-error`]:``}`};return(0,h.jsx)(`div`,{className:c.fieldWrapper,children:(0,h.jsxs)(`span`,{className:c.inputWrapper,children:[r&&(0,h.jsx)(b,{src:r,disabled:t}),o({id:s,disabled:t}),i&&(0,h.jsx)(b,{src:i,disabled:t})]})})},yV=e=>{let{value:t,autoFocus:n,placeholder:r,error:i,leadingIcon:a,trailingIcon:o,size:s,onBlur:c,onKeyDown:l,onChange:u,readOnly:d}=e;return(0,h.jsx)(vV,{...e,error:i,leadingIcon:a,trailingIcon:o,size:s,children:({id:e,disabled:i})=>(0,h.jsx)(`input`,{id:e,type:`text`,value:t,disabled:i,autoFocus:n,placeholder:r,className:_V[`rst-input`],onChange:e=>u(e.target.value),onBlur:c,onKeyDown:l,readOnly:d})})},bV=({id:e,options:t,ref:n,activeIndex:r=[],width:i,onClick:a,onKeyDown:o,multiple:s=!1,selectedIndex:c=-1})=>{let[l,u]=(0,d.useState)(``),[f,p]=(0,d.useState)(c);(0,d.useEffect)(()=>{p(c)},[c]);let{filteredOptions:m,fullOptions:g}=hV(t,l),{virtualItems:_,containerProps:v,innerProps:y,scrollToIndex:x}=fV({items:g,itemHeight:24,containerHeight:200,overscan:5});(0,d.useEffect)(()=>{if(Array.isArray(r)&&r.length>0){let e=m.findIndex(e=>e.value===r[0]);e!==-1&&x(e)}},[m,r,x]);let S={wrapper:`${pV[`rst-list`]}`,input:`${pV[`rst-list-input`]}`,container:`${pV[`rst-list-container`]}`,virtualScroll:`${pV[`rst-list-virtualScroll`]}`,listItem:`${pV[`rst-list-listItem`]}`,listItemCreate:`${pV[`rst-list-listItem-create`]}`,noElements:`${pV[`rst-list-noElements`]}`};return(0,h.jsxs)(`div`,{id:e,ref:n,className:S.wrapper,"data-component":`list`,style:{width:i},children:[(0,h.jsx)(`div`,{className:S.input,children:(0,h.jsx)(yV,{autoFocus:!0,value:l,placeholder:`Search...`,onChange:e=>u(e??``),onKeyDown:e=>gV({e,localSelectedIndex:f,setLocalSelectedIndex:p,filteredOptions:m,fullOptions:g,onClick:a,onKeyDown:o})})}),(0,h.jsx)(`div`,{...v,className:S.container,tabIndex:0,role:`listbox`,"aria-label":`List`,"aria-multiselectable":s,onKeyDown:e=>gV({e,localSelectedIndex:f,setLocalSelectedIndex:p,filteredOptions:m,fullOptions:g,onClick:a,onKeyDown:o}),"aria-activedescendant":f>=0&&f<m.length?m[f]?.value:void 0,children:(0,h.jsx)(`div`,{...y,className:S.virtualScroll,children:m.length===0?(0,h.jsx)(`div`,{className:S.noElements,children:`No elements`}):_.map(({item:e,index:t,offsetTop:n})=>{let i=e.value,o=r.includes(e.value);return(0,h.jsxs)(`li`,{role:`option`,id:e.value,"aria-selected":f===t,tabIndex:-1,className:`${S.listItem} ${o?`selected-item`:``}`,"aria-label":i,style:{height:`24px`,lineHeight:`calc(24px - 2*2px)`,transform:`translateY(${n}px)`},onClick:()=>{a?.(e),p(t)},children:[(0,h.jsxs)(`span`,{className:S.listItemCreate,children:[e.leadingVisual&&(0,h.jsx)(b,{src:e.leadingVisual}),mV(i,l)]}),o&&(0,h.jsx)(b,{src:`check`})]},t)})})})]})},xV={"rst-field-select-wrapper":`_rst-field-select-wrapper_d20in_1`,"rst-select-wrapper":`_rst-select-wrapper_d20in_11`},SV=({value:e,onChange:t,options:n,multiActiveIndex:r,disabled:i,multiple:a=!1})=>{let[o,s]=(0,d.useState)(!1),[c,l]=(0,d.useState)(-1),[u,f]=(0,d.useState)(Array.isArray(e)?e:[e]),p=(0,d.useId)(),m=r=>{if(a){let n=Array.isArray(e)?[...e]:[],i=n.includes(r.value)?n.filter(e=>e!==r.value):[...n,r.value];t?.(i),f(i)}else t?.(r.value),l(n.findIndex(e=>e.value===r.value)),f([r.value]),s(!1)},g=()=>{s(!1),l(-1)},_={fieldWrapper:xV[`rst-field-select-wrapper`]};return(0,h.jsx)(`div`,{role:`combobox`,"aria-expanded":o,"aria-controls":p,"aria-owns":p,"aria-disabled":i,"data-component":`combobox`,className:_.fieldWrapper,children:(0,h.jsx)(M,{anchor:(0,h.jsx)(D,{value:(()=>{if(a&&Array.isArray(e)){if(e.length>=4)return`Selected elements: `;let t=n.filter(t=>e.includes(t.value)).map(e=>e.value);return t.length>0?t.join(`, `):`Select options`}else return n.find(t=>t.value===e)?.value||`Select an option`})(),count:a&&u.length>=4?u.length:void 0,onClick:()=>s(e=>!e),"aria-label":`Toggle Select`,trailingVisual:`expand`,disabled:i}),target:(0,h.jsx)(bV,{id:p,options:n,activeIndex:r||u,onClick:m,selectedIndex:c,multiple:a}),isOpen:o,onClose:g,position:`center`,align:`bottom`})})},CV={"rst-grid":`_rst-grid_8mmbv_1`,"rst-column":`_rst-column_8mmbv_7`,"rst-cell":`_rst-cell_8mmbv_13`};function wV(e,t,n,r){if(e<=0)return`oklch(95% 0 0)`;let i=Math.min(e/t,1),a=75-Math.ceil(i*n)*(50/n);return r.replace(/oklch\([^%]+%/,`oklch(${a}%`)}function TV(e=`year`,t){let n=t?new Date(t):new Date,r=e===`month`?EV(n):e===`quarter`?DV(n):OV(n),i=e===`month`?30:e===`quarter`?90:365,a=[];for(let e=0;e<i;e++){let t=kV(r,e);a.push({day:AV(t),count:Math.floor(Math.random()*10)})}let o=[];for(let e=0;e<a.length;e+=7)o.push(a.slice(e,e+7));return o}function EV(e){return new Date(e.getFullYear(),e.getMonth(),1)}function DV(e){let t=Math.floor(e.getMonth()/3);return new Date(e.getFullYear(),t*3,1)}function OV(e){return new Date(e.getFullYear(),0,1)}function kV(e,t){let n=new Date(e);return n.setDate(n.getDate()+t),n}function AV(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}var jV=({data:e,bands:t,color:n,period:r,startDate:i})=>{let a=d.default.useMemo(()=>e??TV(r,i),[e,r,i]),o=d.default.useMemo(()=>Math.max(...a.flat().map(e=>e.count)),[a]),s={grid:CV[`rst-grid`],column:CV[`rst-column`],cell:CV[`rst-cell`]};return(0,h.jsx)(`div`,{className:`${s.grid}`,style:{gridTemplateColumns:`repeat(${e.length}, auto)`},children:a.map((e,r)=>(0,h.jsx)(`div`,{className:s.column,children:e.map((e,r)=>{let i=wV(e.count,o,t,n);return(0,h.jsx)(`div`,{className:s.cell,title:`${e.day}: ${e.count}`,style:{backgroundColor:i}},r)})},r))})},MV=e=>{let{value:t,placeholder:n,autoFocus:r,min:i,max:a,onBlur:o,onKeyDown:s,onChange:c,error:l}=e;return(0,h.jsx)(vV,{...e,error:l,children:({id:e,disabled:l})=>(0,h.jsx)(`input`,{id:e,type:`number`,value:t??``,disabled:l,placeholder:n,autoFocus:r,min:i,max:a,className:_V[`rst-input`],onChange:e=>{let t=e.target.valueAsNumber;c(Number.isNaN(t)?void 0:t)},onBlur:o,onKeyDown:s})})},NV={"rst-label":`_rst-label_1cj39_1`,"rst-label-required":`_rst-label-required_1cj39_12`},PV=({label:e,id:t,disabled:n,required:r})=>(0,h.jsxs)(T,{variant:`label`,"aria-disabled":n,htmlFor:t,className:{label:NV[`rst-label`]}.label,children:[e,r&&(0,h.jsxs)(`span`,{className:NV[`rst-label-required`],"aria-label":`required`,children:[` `,`*`]})]}),FV={"rst-timeline-tl":`_rst-timeline-tl_9aze7_1`,"rst-timeline-list":`_rst-timeline-list_9aze7_5`,"rst-timeline-item":`_rst-timeline-item_9aze7_13`,"rst-timeline-rail":`_rst-timeline-rail_9aze7_19`,"rst-timeline-line":`_rst-timeline-line_9aze7_29`,"rst-timeline-dot":`_rst-timeline-dot_9aze7_37`,"rst-timeline-node":`_rst-timeline-node_9aze7_49`,"rst-timeline-node-header":`_rst-timeline-node-header_9aze7_54`,"rst-timeline-node-image":`_rst-timeline-node-image_9aze7_66`,"rst-timeline-node-article":`_rst-timeline-node-article_9aze7_82`},IV={"rst-skeleton":`_rst-skeleton_4cfvo_1`,"skeleton-loading":`_skeleton-loading_4cfvo_1`},LV=({width:e,height:t,circle:n=!1,className:r})=>{let i={width:e,height:t,borderRadius:n?`50%`:`4px`};return(0,h.jsx)(`span`,{className:`${{skeleton:`${IV[`rst-skeleton`]}`}.skeleton} ${r||``}`,style:i,"aria-hidden":`true`})},RV=({items:e=2})=>{let t={timelineTl:`${FV[`rst-timeline-tl`]}`,timelineList:`${FV[`rst-timeline-list`]}`,timelineItem:`${FV[`rst-timeline-item`]}`,timelineRail:`${FV[`rst-timeline-rail`]}`,timelineLine:`${FV[`rst-timeline-line`]}`,timelineDot:`${FV[`rst-timeline-dot`]}`,timelineNode:`${FV[`rst-timeline-node`]}`,timelineNodeHeader:`${FV[`rst-timeline-node-header`]}`,timelineNodeArticle:`${FV[`rst-timeline-node-article`]}`};return(0,h.jsx)(`section`,{className:t.timelineTl,"aria-label":`Timeline Skeleton`,children:(0,h.jsx)(`ul`,{className:t.timelineList,children:Array.from({length:e}).map((e,n)=>(0,h.jsxs)(`li`,{className:t.timelineItem,children:[(0,h.jsxs)(`div`,{className:t.timelineRail,"aria-hidden":!0,children:[(0,h.jsx)(`span`,{className:t.timelineDot}),(0,h.jsx)(`span`,{className:t.timelineLine})]}),(0,h.jsxs)(`div`,{className:t.timelineNode,children:[(0,h.jsxs)(`span`,{className:t.timelineNodeHeader,children:[(0,h.jsx)(LV,{width:120,height:16}),` `,(0,h.jsx)(LV,{width:60,height:12}),` `]}),(0,h.jsxs)(`article`,{className:t.timelineNodeArticle,children:[(0,h.jsx)(LV,{width:`100%`,height:12}),(0,h.jsx)(LV,{width:`90%`,height:12}),(0,h.jsx)(LV,{width:`95%`,height:12}),(0,h.jsx)(LV,{width:`100%`,height:120}),` `]})]})]},n))})})};function zV(...e){return e.filter(Boolean).join(` `)}function BV(e,t){let n=d.default.Children.toArray(e),r=Object.fromEntries(t.map(e=>[e,null]));for(let e of n)if(d.default.isValidElement(e)&&typeof e.type==`function`){let n=e.type.displayName;t.includes(n)&&(r[n]=e)}return r}var VV=({children:e,visual:t})=>t?(0,h.jsx)(b,{src:t}):(0,h.jsx)(`div`,{className:FV[`rst-timeline-dot`],children:e});VV.displayName=`TimelineItem.Icon`;var HV=({children:e,href:t})=>{let n=(0,h.jsx)(T,{variant:`body`,children:typeof e==`string`?e:String(e)});return t?(0,h.jsx)(`a`,{href:t,children:n}):n};HV.displayName=`TimelineItem.Title`;var UV=({children:e})=>(0,h.jsx)(T,{variant:`code`,children:String(e)});UV.displayName=`TimelineItem.Date`;var WV=({children:e})=>(0,h.jsx)(T,{variant:`body`,children:String(e)});WV.displayName=`TimelineItem.Description`;var GV=({src:e,alt:t=``})=>(0,h.jsx)(`img`,{className:FV[`rst-timeline-node-image`],src:e,alt:t});GV.displayName=`TimelineItem.Image`;var KV=({children:e})=>{let{"TimelineItem.Title":t,"TimelineItem.Date":n,"TimelineItem.Description":r,"TimelineItem.Image":i}=BV(e,[`TimelineItem.Title`,`TimelineItem.Date`,`TimelineItem.Description`,`TimelineItem.Image`]);return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`span`,{className:FV[`rst-timeline-node-header`],children:[t,n]}),(0,h.jsxs)(`article`,{children:[r,i]})]})};KV.displayName=`TimelineItem.Content`;var qV=({children:e,className:t})=>{let{"TimelineItem.Icon":n,"TimelineItem.Content":r}=BV(e,[`TimelineItem.Icon`,`TimelineItem.Content`]);return(0,h.jsxs)(`li`,{className:zV(FV[`rst-timeline-item`],t),children:[(0,h.jsxs)(`div`,{className:FV[`rst-timeline-rail`],"aria-hidden":!0,children:[n||(0,h.jsx)(`span`,{className:FV[`rst-timeline-dot`]}),(0,h.jsx)(`span`,{className:FV[`rst-timeline-line`]})]}),(0,h.jsx)(`div`,{className:FV[`rst-timeline-node`],children:r})]})};qV.displayName=`TimelineItem`,qV.Icon=VV,qV.Content=KV,qV.Title=HV,qV.Date=UV,qV.Description=WV,qV.Image=GV;var JV=Object.assign(({loading:e=!1,children:t})=>e?(0,h.jsx)(RV,{items:3}):(0,h.jsx)(`section`,{className:FV[`rst-timeline-tl`],"aria-label":`Timeline`,children:(0,h.jsx)(`ul`,{className:FV[`rst-timeline-list`],children:t})}),{Item:qV}),YV=()=>{if(typeof window>`u`)return`desktop`;let e=window.innerWidth;return e<768?`mobile`:e<1024?`tablet`:`desktop`},XV=({children:e,layout:t,className:n})=>{let[r,i]=(0,d.useState)(`desktop`);(0,d.useEffect)(()=>{i(YV());let e=()=>i(YV());return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let a=t[r],o=d.default.Children.toArray(e);return(0,h.jsx)(`div`,{style:{display:`grid`,gap:`${(a.gap||0)*.25}rem`,width:`100%`,height:`100%`},className:n,children:o.map((e,t)=>{let n=a.blocks[t];return n?(0,h.jsx)(`div`,{style:{gridColumn:`${n.col} / span ${n.w}`,gridRow:`${n.row} / span ${n.h}`,display:`flex`,justifyContent:n.alignX,alignItems:n.alignY},children:e},t):null})})};XV.displayName=`Layout`;var ZV=({children:e,direction:t=`column`,gap:n=1,align:r=`flex-start`,justify:i=`flex-start`,wrap:a=!1})=>(0,h.jsx)(`div`,{style:{display:`flex`,flexDirection:t,gap:`${n}rem`,alignItems:r,justifyContent:i,flexWrap:a?`wrap`:`nowrap`},children:e}),QV=(0,d.createContext)(null),$V={"rst-tour-backdrop":`_rst-tour-backdrop_1tdjs_3`,"rst-tour-backdrop-path":`_rst-tour-backdrop-path_1tdjs_14`,"rst-tour-backdrop-loading":`_rst-tour-backdrop-loading_1tdjs_20`,"rst-tour-spotlight":`_rst-tour-spotlight_1tdjs_31`,"rst-tour-tooltip":`_rst-tour-tooltip_1tdjs_47`,"rst-tour-tooltip--loading":`_rst-tour-tooltip--loading_1tdjs_70`,"rst-tour-progress-bar":`_rst-tour-progress-bar_1tdjs_82`,"rst-tour-progress-fill":`_rst-tour-progress-fill_1tdjs_90`,"rst-tour-step-counter":`_rst-tour-step-counter_1tdjs_99`,"rst-tour-tooltip-content":`_rst-tour-tooltip-content_1tdjs_107`,"rst-tour-button-group":`_rst-tour-button-group_1tdjs_115`};function eH(e,t){if(t!==`auto`)return t;let n=e.top,r=window.innerHeight-e.bottom,i=e.left,a=window.innerWidth-e.right,o=Math.max(r,n,i,a);return o===r?`bottom`:o===n?`top`:o===a?`right`:`left`}function tH(e,t){let n=window.scrollX,r=window.scrollY;switch(t){case`top`:return{top:e.top+r,left:e.left+n,placement:t};case`bottom`:return{top:e.bottom+r+12,left:e.left+n,placement:t};case`right`:return{top:e.top+r,left:e.right+n+12,placement:t};case`left`:return{top:e.top+r,left:e.left+n,placement:t}}}function nH(e={}){return{currentStepIndex:0,completedSteps:[],skippedSteps:[],completed:!1,startedAt:Date.now(),...e}}function rH(e){let{tourId:t,steps:n,persistence:r,analytics:i,autoScroll:a=!0,autoScrollOptions:o={behavior:`smooth`,block:`center`},onComplete:s,onStart:c}=e,[l,u]=(0,d.useState)(null),[f,p]=(0,d.useState)(null),[m,g]=(0,d.useState)(!1),[_,v]=(0,d.useState)(!1),[y,b]=(0,d.useState)(null),x=(0,d.useRef)(0),S=(0,d.useRef)(new Set),C=(0,d.useRef)(new Set),w=(0,d.useRef)(null),E=(0,d.useRef)(()=>{}),O=(0,d.useRef)(0),k=(0,d.useRef)(n);k.current=n;let A=(0,d.useRef)(a);A.current=a;let j=(0,d.useRef)(o);j.current=o;let M=(0,d.useContext)(QV);(0,d.useEffect)(()=>{r&&(async()=>{let e=await Promise.resolve(r.getProgress(t));e&&(b(e),e.completed&&v(!0),S.current=new Set(e.completedSteps),C.current=new Set(e.skippedSteps))})()},[t]),(0,d.useEffect)(()=>{if(M)return M.registerTour(t,w.current),()=>M.unregisterTour(t)},[t]);let N=(0,d.useCallback)(e=>{if(e===null){p(null);return}let t=k.current[e];if(!t){p(null);return}let n=document.querySelector(t.selector);if(!n){p(null);return}A.current&&n.scrollIntoView(j.current),p(n.getBoundingClientRect())},[]);(0,d.useEffect)(()=>{if(l===null)return;let e=()=>N(l);return window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[l,N]),(0,d.useEffect)(()=>{N(l)},[l,N]),(0,d.useEffect)(()=>{if(l===null||m)return;let e=k.current[l];if(!e?.trigger||e.trigger===`manual`)return;let t=document.querySelector(e.selector);if(!t)return;let n=()=>E.current();return typeof e.trigger==`function`?e.trigger(t,n):e.trigger===`click`?(t.addEventListener(`click`,n),()=>t.removeEventListener(`click`,n)):(t.addEventListener(`change`,n),t.addEventListener(`input`,n),()=>{t.removeEventListener(`change`,n),t.removeEventListener(`input`,n)})},[l,m]);let P=(0,d.useCallback)(e=>{r?.saveProgress(t,e)},[r,t]),F=(0,d.useCallback)(async e=>{if(!e.beforeShow)return;let t=++O.current;g(!0);try{await e.beforeShow()}finally{O.current===t&&g(!1)}},[]),ee=(0,d.useCallback)(()=>{n.length!==0&&(S.current=new Set,C.current=new Set,b(nH()),v(!1),u(0),x.current=Date.now(),i?.onTourStart?.({tourId:t,totalSteps:n.length,completedSteps:[],skippedSteps:[]}),c?.(),M?.setActiveTourId(t),F(n[0]))},[n,i,t,c,M,F]),te=(0,d.useCallback)(()=>{O.current++,g(!1),u(e=>{if(e!==null&&!_){let r=n[e];i?.onTourDrop?.({tourId:t,totalSteps:n.length,completedSteps:[...S.current],skippedSteps:[...C.current],dropStepId:r?.id??``,dropStepIndex:e});let a=nH({currentStepIndex:e,completedSteps:[...S.current],skippedSteps:[...C.current],completed:!1,startedAt:y?.startedAt??Date.now()});P(a),b(a)}return null}),M?.setActiveTourId(null)},[_,n,i,t,y,P,M]),ne=(0,d.useCallback)(async()=>{let e=r?await Promise.resolve(r.getProgress(t)):y;if(!e||e.completed){ee();return}S.current=new Set(e.completedSteps),C.current=new Set(e.skippedSteps),b(e),v(!1);let a=Math.min(e.currentStepIndex,n.length-1);u(a),x.current=Date.now(),i?.onTourStart?.({tourId:t,totalSteps:n.length,completedSteps:e.completedSteps,skippedSteps:e.skippedSteps}),M?.setActiveTourId(t),F(n[a])},[r,t,y,n,ee,i,M,F]),re=(0,d.useCallback)((e,r,a)=>{let o=Date.now()-x.current,c=n[r];if(c.afterLeave?.(),a?(C.current.add(c.id),i?.onStepSkip?.({tourId:t,stepId:c.id,stepIndex:r,timeSpentMs:o})):(S.current.add(c.id),i?.onStepComplete?.({tourId:t,stepId:c.id,stepIndex:r,timeSpentMs:o})),e>=n.length){let e=nH({currentStepIndex:r,completedSteps:[...S.current],skippedSteps:[...C.current],completed:!0,startedAt:y?.startedAt??Date.now()});b(e),v(!0),u(null),P(e),i?.onTourComplete?.({tourId:t,totalSteps:n.length,completedSteps:[...S.current],skippedSteps:[...C.current]}),s?.();return}x.current=Date.now();let l=nH({currentStepIndex:e,completedSteps:[...S.current],skippedSteps:[...C.current],startedAt:y?.startedAt??Date.now()});b(l),u(e),P(l),i?.onStepStart?.({tourId:t,stepId:n[e].id,stepIndex:e,timeSpentMs:0}),F(n[e])},[n,i,t,y,P,s,F]),I=(0,d.useCallback)(()=>{u(e=>e===null?null:(re(e+1,e,!1),e))},[re]),ie=(0,d.useCallback)(()=>{u(e=>e===null?null:(n[e].skipable===!1||re(e+1,e,!0),e))},[re,n]),ae=(0,d.useCallback)(()=>{O.current++,g(!1),u(e=>e===null||e===0?e:(x.current=Date.now(),e-1))},[]),oe=(0,d.useCallback)(async()=>{O.current++,g(!1),r&&await Promise.resolve(r.clearProgress(t)),S.current=new Set,C.current=new Set,b(null),v(!1),u(null),p(null)},[r,t]),se=(0,d.useCallback)(async()=>{await oe(),setTimeout(ee,0)},[oe,ee]),ce=(0,d.useCallback)(()=>{if(l===null)return null;let e=n[l];if(m||!f)return(0,h.jsx)(`div`,{className:$V[`rst-tour-backdrop-loading`],onClick:te,children:(0,h.jsxs)(`div`,{className:`${$V[`rst-tour-tooltip`]} ${$V[`rst-tour-tooltip--loading`]}`,"data-placement":`bottom`,children:[(0,h.jsx)(LV,{height:16,width:120}),(0,h.jsx)(LV,{height:52,width:220})]})});let t={top:f.top-8,left:f.left-8,width:f.width+16,height:f.height+16,right:f.right+8,bottom:f.bottom+8},r=tH(t,eH(f,e.placement??`auto`)),i=l===0,a=l===n.length-1,o=e.skipable!==!1,s=n.length>1?l/(n.length-1)*100:100;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`svg`,{className:$V[`rst-tour-backdrop`],children:(0,h.jsx)(`path`,{d:[`M 0 0 L 10000 0 L 10000 10000 L 0 10000 Z`,`M ${t.left} ${t.top}`,`L ${t.right} ${t.top}`,`L ${t.right} ${t.bottom}`,`L ${t.left} ${t.bottom} Z`].join(` `),fill:`oklch(0% 0 0deg / 60%)`,fillRule:`evenodd`,className:$V[`rst-tour-backdrop-path`],onClick:te})}),(0,h.jsx)(`div`,{className:$V[`rst-tour-spotlight`],style:{top:t.top+window.scrollY,left:t.left+window.scrollX,width:t.width,height:t.height}}),(0,h.jsxs)(`div`,{className:$V[`rst-tour-tooltip`],"data-placement":r.placement,style:{top:r.top,left:r.left},children:[(0,h.jsx)(`div`,{children:(0,h.jsx)(D,{leadingVisual:`close`,size:`small`,variant:`invisible`,value:``,onClick:te})}),(0,h.jsx)(`div`,{className:$V[`rst-tour-progress-bar`],children:(0,h.jsx)(`div`,{className:$V[`rst-tour-progress-fill`],style:{width:`${s}%`}})}),(0,h.jsxs)(`div`,{className:$V[`rst-tour-step-counter`],children:[l+1,` / `,n.length]}),e.title&&(0,h.jsx)(T,{variant:`title`,children:e.title}),(0,h.jsx)(`div`,{className:$V[`rst-tour-tooltip-content`],children:e.content}),(0,h.jsxs)(`div`,{className:$V[`rst-tour-button-group`],children:[o&&!a&&(0,h.jsx)(D,{size:`small`,variant:`invisible`,value:`Skip`,onClick:ie}),(0,h.jsxs)(ZV,{direction:`row`,gap:1,children:[!i&&(0,h.jsx)(D,{size:`small`,variant:`invisible`,value:`Prev`,onClick:ae}),a?(0,h.jsx)(D,{size:`small`,variant:`primary`,value:`Finish`,onClick:I}):(0,h.jsx)(D,{size:`small`,variant:`primary`,value:`Next`,onClick:I})]})]})]})]})},[l,f,n,m,ie,ae,I,te]);E.current=I;let le={start:ee,resume:ne,stop:te,next:I,prev:ae,skip:ie,reset:oe,replay:se,activeStep:l,isLoading:m,isComplete:_,progress:y,render:ce};return w.current=le,le}function iH({children:e}){let[t,n]=(0,d.useState)(null),[r,i]=(0,d.useState)([]),a=(0,d.useRef)({}),o=(0,d.useCallback)(e=>{n(t=>(t&&t!==e&&a.current[t]?.stop(),e))},[]),s=(0,d.useCallback)((e,t)=>{a.current[e]=t,i(t=>t.includes(e)?t:[...t,e])},[]),c=(0,d.useCallback)(e=>{delete a.current[e],i(t=>t.filter(t=>t!==e))},[]);return(0,h.jsx)(QV.Provider,{value:{activeTourId:t,setActiveTourId:o,instancesRef:a,registeredTourIds:r,registerTour:s,unregisterTour:c},children:e})}function aH(){let e=(0,d.useContext)(QV);if(!e)throw Error(`[useTourManager] must be used inside a <TourProvider>. Wrap your component tree with <TourProvider> to enable multi-tour management.`);let{activeTourId:t,setActiveTourId:n,instancesRef:r,registeredTourIds:i}=e;return{tours:Object.fromEntries(i.map(e=>[e,{tourId:e,isActive:e===t}])),activeTourId:t,startTour:(0,d.useCallback)(e=>{let t=r.current[e];if(!t){console.warn(`[useTourManager] No tour registered with id "${e}".`);return}n(e),t.start()},[r,n]),stopActiveTour:(0,d.useCallback)(()=>{t&&(r.current[t]?.stop(),n(null))},[t,r,n])}}function oH(e,t={}){let{maxHistory:n=50,isEqual:r}=t,[i,a]=(0,d.useState)([]),[o,s]=(0,d.useState)(e),[c,l]=(0,d.useState)([]),u=(0,d.useRef)(!1),f=(0,d.useCallback)(e=>{r&&r(o,e)||(u.current||(a(e=>{let t=[...e,o];return t.length>n?t.slice(t.length-n):t}),l([])),s(e))},[o,n,r]),p=(0,d.useCallback)(()=>{if(i.length===0)return;u.current=!0;let e=i[i.length-1];a(i.slice(0,i.length-1)),s(e),l(e=>[o,...e]),requestAnimationFrame(()=>{u.current=!1})},[i,o]),m=(0,d.useCallback)(()=>{if(c.length===0)return;u.current=!0;let e=c[0],t=c.slice(1);a(e=>[...e,o]),s(e),l(t),requestAnimationFrame(()=>{u.current=!1})},[c,o]),h=(0,d.useCallback)(()=>{a([]),l([])},[]),g=(0,d.useCallback)(e=>{a([]),s(e),l([])},[]);return{state:o,setState:f,undo:p,redo:m,canUndo:i.length>0,canRedo:c.length>0,clearHistory:h,undoCount:i.length,redoCount:c.length,reset:g}}var sH={"rst-kbd-group":`_rst-kbd-group_9wtu1_2`,"rst-kbd-group-separator":`_rst-kbd-group-separator_9wtu1_10`,"rst-kbd-group-plus":`_rst-kbd-group-plus_9wtu1_18`,"rst-kbd-group-combination":`_rst-kbd-group-combination_9wtu1_26`},cH=({keys:e,separator:t=`+`,showSeparator:n=!1,className:r,...i})=>{let a=[sH[`rst-kbd-group`],n&&sH[`rst-kbd-group-combination`],r].filter(Boolean).join(` `),o=n=>n===e.length-1?null:(0,h.jsx)(`span`,{className:sH[`rst-kbd-group-separator`],children:t},`sep-${n}`);return(0,h.jsx)(`div`,{className:a,...i,children:e.map((e,t)=>(0,h.jsxs)(d.default.Fragment,{children:[(0,h.jsx)(aB,{children:e}),n&&o(t)]},t))})},lH={"rst-menu":`_rst-menu_bwbr2_2`,"rst-menu-item":`_rst-menu-item_bwbr2_14`,"rst-menu-item-disabled":`_rst-menu-item-disabled_bwbr2_37`,"rst-menu-separator":`_rst-menu-separator_bwbr2_47`,"rst-menu-item-content":`_rst-menu-item-content_bwbr2_55`,"rst-menu-item-label":`_rst-menu-item-label_bwbr2_62`,"rst-menu-item-leading-visual":`_rst-menu-item-leading-visual_bwbr2_74`,"rst-menu-item-trailing-visual":`_rst-menu-item-trailing-visual_bwbr2_82`,"rst-menu-item-shortcut":`_rst-menu-item-shortcut_bwbr2_90`,"rst-menu-item-submenu-indicator":`_rst-menu-item-submenu-indicator_bwbr2_97`,"rst-menu-node":`_rst-menu-node_bwbr2_105`},uH=({children:e,className:t,...n})=>(0,h.jsx)(`div`,{className:[lH[`rst-menu`],t].filter(Boolean).join(` `),role:`menu`,...n,children:e}),dH=({label:e,children:t,disabled:n=!1,leadingVisual:r,shortcut:i,onClick:a,content:o,id:s,...c})=>{let l=t&&t.length>=1;console.log(`Rendering MenuItem:`,e,o);let u=()=>{n||a?.({label:e,disabled:n,leadingVisual:r,shortcut:i})};return(0,h.jsx)(`div`,{className:[lH[`rst-menu-item`],n?lH[`rst-menu-item-disabled`]:``].filter(Boolean).join(` `),onClick:u,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&!n&&(e.preventDefault(),u())},tabIndex:n?-1:0,role:`menuitem`,"aria-disabled":n,"aria-haspopup":l?`menu`:void 0,...c,children:o?(0,h.jsx)(h.Fragment,{children:o}):(0,h.jsxs)(`div`,{className:lH[`rst-menu-item-content`],children:[r&&(0,h.jsx)(`div`,{className:lH[`rst-menu-item-leading-visual`],children:(0,h.jsx)(b,{src:r,state:`base`})}),(0,h.jsx)(T,{variant:`body`,children:e}),i&&(0,h.jsx)(`div`,{className:lH[`rst-menu-item-shortcut`],children:(0,h.jsx)(cH,{keys:i,showSeparator:!1})}),l&&(0,h.jsx)(`div`,{className:lH[`rst-menu-item-submenu-indicator`],children:(0,h.jsx)(b,{src:`chevron-right`,state:`base`})})]})},s)},fH=Object.assign(uH,{Item:dH,Separator:({className:e,...t})=>(0,h.jsx)(`hr`,{className:[lH[`rst-menu-separator`],e].filter(Boolean).join(` `),role:`separator`,...t}),Submenu:({trigger:e,children:t,position:n=`right`,align:r=`center`,className:i,...a})=>{let[o,s]=(0,d.useState)(!1),c=(0,d.useRef)(null),l=(0,d.useRef)(null),u=()=>{s(!0)},f=e=>{let t=l.current;t&&t.contains(e.relatedTarget)||s(!1)},p=e=>{let t=c.current;t&&t.contains(e.relatedTarget)||s(!1)},m=e=>{e.key===`ArrowRight`?(e.preventDefault(),s(!0)):(e.key===`ArrowLeft`&&o||e.key===`Escape`)&&(e.preventDefault(),s(!1))},g=[lH[`rst-menu-submenu`],i].filter(Boolean).join(` `),_=d.default.isValidElement(e)&&e.type===dH?d.default.cloneElement(e):e;return(0,h.jsx)(`div`,{className:g,...a,children:(0,h.jsx)(M,{isOpen:o,onClose:()=>s(!1),position:n,align:r,anchor:(0,h.jsx)(`div`,{ref:c,onMouseEnter:u,onMouseLeave:f,onKeyDown:m,"aria-haspopup":`menu`,"aria-expanded":o,children:_}),target:(0,h.jsx)(`div`,{ref:l,className:lH[`rst-menu`],role:`menu`,onMouseLeave:p,children:t})})})}}),pH={"rst-chart-container":`_rst-chart-container_10aqn_2`,"rst-chart-header":`_rst-chart-header_10aqn_13`,"rst-chart-title":`_rst-chart-title_10aqn_17`,"rst-chart-subtitle":`_rst-chart-subtitle_10aqn_25`,"rst-chart-content":`_rst-chart-content_10aqn_33`,"rst-chart-error":`_rst-chart-error_10aqn_39`,"rst-chart-empty":`_rst-chart-empty_10aqn_51`};function mH(e,t){let n=t?.headerFormatter||(e=>e.charAt(0).toUpperCase()+e.slice(1).replace(/([A-Z])/g,` $1`));return e.map(e=>({id:String(e),accessorKey:e,header:n(String(e))}))}function hH(e,t){return function(n){let{x:r,y:i,width:a,height:o,index:s,payload:c}=n,l=e[s]??`#94a3b8`,u=c.depth??0,d=u===0,f=t>1&&!d&&u!==t,p=i+o/2;return(0,h.jsxs)(L,{children:[(0,h.jsx)(yp,{x:r,y:i,width:a,height:o,fill:l,fillOpacity:.9,radius:3}),f?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`text`,{x:r+a/2,y:i-14,textAnchor:`middle`,dominantBaseline:`auto`,fontSize:11,fontWeight:600,fill:`#1e293b`,children:c.name}),(0,h.jsx)(`text`,{x:r+a/2,y:i-3,textAnchor:`middle`,dominantBaseline:`auto`,fontSize:10,fill:`#64748b`,children:c.value})]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`text`,{x:d?r-12:r+a+12,y:p-(o>24?7:0),textAnchor:d?`end`:`start`,dominantBaseline:`middle`,fontSize:12,fontWeight:600,fill:`#1e293b`,children:c.name}),o>20&&(0,h.jsx)(`text`,{x:d?r-12:r+a+12,y:p+9,textAnchor:d?`end`:`start`,dominantBaseline:`middle`,fontSize:11,fill:`#64748b`,children:c.value})]})]},`sn-${s}`)}}function gH(e){return function(t){let{sourceX:n,targetX:r,sourceY:i,targetY:a,sourceControlX:o,targetControlX:s,linkWidth:c,payload:l}=t;if(!l)return(0,h.jsx)(`g`,{});let u=e[typeof l.target==`number`?l.target:l.target.index]??`#94a3b8`,d=Math.max(1,c||0)/2;return(0,h.jsx)(`path`,{d:[`M${n},${i-d}`,`C${o},${i-d} ${s},${a-d} ${r},${a-d}`,`L${r},${a+d}`,`C${s},${a+d} ${o},${i+d} ${n},${i+d}`,`Z`].join(` `),fill:u,fillOpacity:.3,stroke:u,strokeOpacity:.15,strokeWidth:.5})}}function _H(e,t,n,r){let i=[],a=[],o=new Map,s=t.map(()=>new Map);for(let n of e)t.forEach((e,t)=>{let r=n[e];r!=null&&String(r).trim()!==``&&s[t].set(String(r),null)});s.forEach((e,t)=>{for(let n of e.keys())o.set(`${t}:${n}`,i.length),i.push({name:n}),a.push(r[t%r.length])});let c=new Map;for(let r of e){let e=r[n],i=typeof e==`number`?e:Number(e)||0,a=[];t.forEach((e,t)=>{let n=r[e];n!=null&&String(n).trim()!==``&&a.push(o.get(`${t}:${String(n)}`))});for(let e=0;e<a.length-1;e++){let t=a[e],n=a[e+1],r=`${t}:${n}`,o=c.get(r);o?o.value+=i:c.set(r,{source:t,target:n,value:i})}}return{nodes:i,links:Array.from(c.values()),nodeColors:a}}var vH=({data:e,columns:t,type:n,xAxisColumn:r=``,yAxisColumns:i=[],title:a,subtitle:o,width:s=`100%`,height:c=400,colors:l=[`#8884d8`,`#82ca9d`,`#ffc658`,`#ff7c7c`,`#8dd1e1`],showGrid:u=!0,showTooltip:d=!0,showLegend:f=!0,showXAxis:p=!0,showYAxis:m=!0,layout:g=`horizontal`,sankeyConfig:_})=>{let v=e[0]?Object.keys(e[0]):[],y=t||mH(v);if(n!==`sankey`&&(!r||!i||i.length===0))return(0,h.jsx)(`div`,{className:pH[`rst-chart-container`],children:(0,h.jsx)(`div`,{className:pH[`rst-chart-error`],children:`Missing required axis configuration. Please provide xAxisColumn and yAxisColumns.`})});if(!e||e.length===0)return(0,h.jsx)(`div`,{className:pH[`rst-chart-container`],children:(0,h.jsx)(`div`,{className:pH[`rst-chart-empty`],children:`No data to display`})});let b=(e,t)=>{let n=y.find(e=>e.id===t||e.accessorKey===t||String(e.accessorKey)===t);if(n){if(n.accessorFn)return n.accessorFn(e);if(n.accessorKey)return e[n.accessorKey]}return e[t]},x=e=>y.find(t=>t.id===e||t.accessorKey===e||String(t.accessorKey)===e)?.header||String(e),S=()=>e.map((e,t)=>{let n={_originalData:e,_index:t};return n[String(r)]=b(e,r),i.forEach(t=>{let r=b(e,t);n[String(t)]=typeof r==`number`?r:typeof r==`string`&&!isNaN(Number(r))?Number(r):0}),n}),C=c;if(n===`sankey`&&_&&e.length>0){let t=_.stageColumns.map(t=>new Set(e.map(e=>e[t]).filter(e=>e!=null&&String(e).trim()!==``)).size),n=Math.max(...t)*44-20+48;C=typeof c==`number`?Math.max(c,n):n}return(0,h.jsxs)(`div`,{className:[pH[`rst-chart-container`]].filter(Boolean).join(` `),children:[a&&(0,h.jsxs)(`div`,{className:pH[`rst-chart-header`],children:[(0,h.jsx)(`h3`,{className:pH[`rst-chart-title`],children:a}),o&&(0,h.jsx)(`p`,{className:pH[`rst-chart-subtitle`],children:o})]}),(0,h.jsx)(`div`,{className:pH[`rst-chart-content`],children:(0,h.jsx)(cl,{width:s,height:C,children:(()=>{let t={data:S(),margin:{top:20,right:30,left:20,bottom:5}},a=p?{...g!==`vertical`&&{dataKey:String(r)}}:{},o=m?{...g===`vertical`&&{dataKey:String(r)}}:{};switch(n){case`line`:return(0,h.jsxs)(jR,{...t,children:[u&&(0,h.jsx)(iN,{strokeDasharray:`3 3`}),p&&(0,h.jsx)(II,{...a}),m&&(0,h.jsx)(ZI,{...o}),d&&(0,h.jsx)(AE,{}),f&&(0,h.jsx)(cd,{}),i.map((e,t)=>(0,h.jsx)(eP,{type:`monotone`,dataKey:String(e),stroke:l[t%l.length],name:x(e)},String(e)))]});case`bar`:return(0,h.jsxs)(NR,{...t,layout:g,children:[u&&(0,h.jsx)(iN,{strokeDasharray:`3 3`}),p&&(0,h.jsx)(II,{...a}),m&&(0,h.jsx)(ZI,{...o}),d&&(0,h.jsx)(AE,{}),f&&(0,h.jsx)(cd,{}),i.map((e,t)=>(0,h.jsx)(zF,{dataKey:String(e),fill:l[t%l.length],name:x(e)},String(e)))]});case`area`:return(0,h.jsxs)(Xz,{...t,children:[u&&(0,h.jsx)(iN,{strokeDasharray:`3 3`}),p&&(0,h.jsx)(II,{...a}),m&&(0,h.jsx)(ZI,{...o}),d&&(0,h.jsx)(AE,{}),f&&(0,h.jsx)(cd,{}),i.map((e,t)=>(0,h.jsx)(zP,{type:`monotone`,dataKey:String(e),stackId:`1`,stroke:l[t%l.length],fill:l[t%l.length],name:x(e)},String(e)))]});case`pie`:return(0,h.jsxs)($R,{...t,children:[i.map((e,t)=>(0,h.jsx)(IA,{data:S(),dataKey:String(e),nameKey:String(r),cx:`50%`,cy:`50%`,outerRadius:80+t*30,fill:l[t%l.length],label:!0},String(e))),d&&(0,h.jsx)(AE,{}),f&&(0,h.jsx)(cd,{})]});case`scatter`:return(0,h.jsxs)(Jz,{...t,children:[u&&(0,h.jsx)(iN,{strokeDasharray:`3 3`}),p&&(0,h.jsx)(II,{...a}),m&&(0,h.jsx)(ZI,{...o}),d&&(0,h.jsx)(AE,{}),f&&(0,h.jsx)(cd,{}),i.map((e,t)=>(0,h.jsx)(hI,{dataKey:String(e),name:x(e),fill:l[t%l.length]},String(e)))]});case`sankey`:{if(!_)return(0,h.jsxs)(`div`,{children:[`Sankey requires a `,(0,h.jsx)(`code`,{children:`sankeyConfig`}),` prop with `,(0,h.jsx)(`code`,{children:`stageColumns`}),` and `,(0,h.jsx)(`code`,{children:`valueColumn`}),`.`]});let{nodes:t,links:n,nodeColors:r}=_H(e,_.stageColumns,_.valueColumn,l),i=_.stageColumns.length-1,a=i>1,o=6.5,s=[...new Set(e.map(e=>String(e[_.stageColumns[0]]??``)))].filter(Boolean),c=[...new Set(e.map(e=>String(e[_.stageColumns[i]]??``)))].filter(Boolean),u=Math.max(64,Math.max(...s.map(e=>e.length))*o+14),d=Math.max(64,Math.max(...c.map(e=>e.length))*o+14),f=a?36:14;return(0,h.jsx)(Kz,{data:{nodes:t,links:n},node:hH(r,i),link:gH(r),nodePadding:20,nodeWidth:14,iterations:32,margin:{top:f,right:Math.ceil(d),bottom:14,left:Math.ceil(u)}})}default:return(0,h.jsxs)(`div`,{children:[`Unsupported chart type: `,n]})}})()})})]})},X={"rst-table-container":`_rst-table-container_9t24z_1`,"rst-column-visibility-list":`_rst-column-visibility-list_9t24z_11`,"rst-column-visibility-item":`_rst-column-visibility-item_9t24z_17`,"rst-column-visibility-label":`_rst-column-visibility-label_9t24z_31`,"rst-table-skeleton-row":`_rst-table-skeleton-row_9t24z_37`,"rst-table-skeleton-cell":`_rst-table-skeleton-cell_9t24z_41`,"rst-table-empty-state":`_rst-table-empty-state_9t24z_57`,"rst-table-empty-state-label":`_rst-table-empty-state-label_9t24z_63`,"rst-table-outer":`_rst-table-outer_9t24z_72`,"rst-table-outer-content":`_rst-table-outer-content_9t24z_87`,"rst-table-sidebar":`_rst-table-sidebar_9t24z_93`,"rst-sidebar-btn":`_rst-sidebar-btn_9t24z_105`,"rst-sidebar-btn-active":`_rst-sidebar-btn-active_9t24z_112`,"rst-table-tool-panel":`_rst-table-tool-panel_9t24z_117`,"rst-table-tool-panel-header":`_rst-table-tool-panel-header_9t24z_131`,"rst-table-tool-panel-title":`_rst-table-tool-panel-title_9t24z_140`,"rst-table-tool-panel-body":`_rst-table-tool-panel-body_9t24z_146`,"rst-table-grid":`_rst-table-grid_9t24z_152`,"rst-table-grid-fixed":`_rst-table-grid-fixed_9t24z_161`,"rst-table-body":`_rst-table-body_9t24z_167`,"rst-table-cell":`_rst-table-cell_9t24z_180`,"rst-table-row":`_rst-table-row_9t24z_188`,"rst-table-cell-wrapper":`_rst-table-cell-wrapper_9t24z_209`,"rst-table-row-group":`_rst-table-row-group_9t24z_220`,"rst-table-group-cell":`_rst-table-group-cell_9t24z_225`,"rst-table-group-label":`_rst-table-group-label_9t24z_229`,"rst-table-cell-pinned":`_rst-table-cell-pinned_9t24z_239`,"rst-table-cell-pinned-left":`_rst-table-cell-pinned-left_9t24z_247`,"rst-table-cell-pinned-right":`_rst-table-cell-pinned-right_9t24z_252`,"rst-table-row-selected":`_rst-table-row-selected_9t24z_260`,"rst-table-footer":`_rst-table-footer_9t24z_265`,"rst-table-footer-sticky":`_rst-table-footer-sticky_9t24z_280`,"rst-pivot-container":`_rst-pivot-container_9t24z_296`,"rst-pivot-config-panel":`_rst-pivot-config-panel_9t24z_304`,"rst-pivot-available-fields":`_rst-pivot-available-fields_9t24z_314`,"rst-pivot-zones":`_rst-pivot-zones_9t24z_322`,"rst-pivot-zone":`_rst-pivot-zone_9t24z_322`,"rst-pivot-zone-active":`_rst-pivot-zone-active_9t24z_342`,"rst-pivot-zone-title":`_rst-pivot-zone-title_9t24z_347`,"rst-pivot-zone-placeholder":`_rst-pivot-zone-placeholder_9t24z_355`,"rst-pivot-chip-wrapper":`_rst-pivot-chip-wrapper_9t24z_361`,"rst-pivot-agg-select":`_rst-pivot-agg-select_9t24z_367`,"rst-pivot-table":`_rst-pivot-table_9t24z_378`,"rst-pivot-header-row-field":`_rst-pivot-header-row-field_9t24z_382`,"rst-pivot-header-group":`_rst-pivot-header-group_9t24z_387`,"rst-pivot-header-value":`_rst-pivot-header-value_9t24z_394`,"rst-pivot-cell-row-field":`_rst-pivot-cell-row-field_9t24z_398`,"rst-pivot-cell-value":`_rst-pivot-cell-value_9t24z_403`,"rst-pivot-empty":`_rst-pivot-empty_9t24z_408`,"rst-table-selection-cell":`_rst-table-selection-cell_9t24z_420`},yH=(0,d.createContext)(void 0);function bH(e,t,n){if(t.length===0)return e;let r=t[0],i=n.find(e=>(e.id||e.accessorKey)===r.id);return i?[...e].sort((e,t)=>{let n,a;if(i.accessorFn)n=i.accessorFn(e),a=i.accessorFn(t);else if(i.accessorKey)n=e[i.accessorKey],a=t[i.accessorKey];else return 0;if(i.sortingFn){let n=i.sortingFn(e,t,r.id);return r.desc?-n:n}if(n===a)return 0;if(n==null)return 1;if(a==null)return-1;let o=n<a?-1:1;return r.desc?-o:o}):e}function xH(e,t){return e.id||(e.accessorKey?String(e.accessorKey):`col-${t}`)}function SH(e,t,n){let r=n.find(e=>(e.id||e.accessorKey)===t);return r?r.accessorFn?r.accessorFn(e):r.accessorKey?e[r.accessorKey]:null:null}function CH(e,t,n,r,i=0,a){if(t.length===0)return wH(e,void 0,r,`table`,a,i);let o=t[0],s=t.slice(1),c=new Map;e.forEach(e=>{let t=SH(e,o,n),r=String(t);c.has(r)||c.set(r,[]),c.get(r).push(e)});let l=[],u=0;return c.forEach((e,t)=>{let c=a?`${a}.group.${t}`:`group.${t}`,d=r.has(c),f={id:c,data:e[0],groupItems:e,index:u++,parentId:a,depth:i,isExpanded:d,isGroup:!0,groupingValue:t,groupingColumnId:o,subRows:void 0};if(l.push(f),d){let t=CH(e,s,n,r,i+1,c);l.push(...t)}}),l}function wH(e,t,n=new Set,r=`table`,i,a=0){let o=[];return e.forEach((e,s)=>{let c=i?`${i}.${s}`:`${s}`,l=t?.(e,s),u=l&&l.length>0,d=n.has(c),f={id:c,data:e,index:s,parentId:i,depth:r===`table`?0:a,isExpanded:d,subRows:void 0};if(u)switch(r){case`table`:break;case`tree`:if(o.push(f),l){let e=wH(l,t,n,r,void 0,0);o.push(...e)}return o;case`table-tree`:d&&(f.subRows=wH(l,t,n,r,c,a+1));break}o.push(f),r===`table-tree`&&f.subRows&&o.push(...f.subRows)}),o}function TH(e,t){let n=e.id??(e.accessorKey?String(e.accessorKey):``);return n&&n in t?t[n]:e.pinned??!1}function EH(e,t){if(!(Object.keys(t).length>0||e.some(e=>e.pinned===`left`||e.pinned===`right`)))return e;let n=[],r=[],i=[];return e.forEach(e=>{let a=TH(e,t);a===`left`?n.push(e):a===`right`?i.push(e):r.push(e)}),[...n,...r,...i]}function DH(e,t,n){let r={},i=n?40:0;e.forEach((e,n)=>{TH(e,t)===`left`&&(r[xH(e,n)]={left:i},i+=e.size??e.minSize??150)});let a=0;for(let n=e.length-1;n>=0;n--){let i=e[n];TH(i,t)===`right`&&(r[xH(i,n)]={right:a},a+=i.size??i.minSize??150)}return r}function OH(e){return Object.values(e).some(e=>e.left!==void 0)}function kH(e,t,n){let r=n(t,0);if(!r||r.length===0)return[];let i=[];return r.forEach((t,r)=>{let a=`${e}.${r}`;i.push(a),i.push(...kH(a,t,n))}),i}function AH(e,t){let n=[];return t.filter(t=>t.parentId===e).forEach(e=>{e.isGroup||n.push(e.id),n.push(...AH(e.id,t))}),n}function jH(e,t,n){return e.isGroup?AH(e.id,t):n?kH(e.id,e.data,n):[]}function MH(e,t,n,r){let i=jH(e,n,r);if(i.length===0)return t.has(e.id)?`checked`:`unchecked`;let a=i.filter(e=>t.has(e)).length;return a===0?`unchecked`:a===i.length?`checked`:`indeterminate`}function NH(e,t){if(e.length===0)return`unchecked`;let n=e.filter(e=>t.has(e)).length;return n===0?`unchecked`:n===e.length?`checked`:`indeterminate`}function PH(e,t,n,r){let i=MH(e,t,n,r),a=jH(e,n,r),o=e.isGroup?a:[e.id,...a],s=new Set(t);return i===`unchecked`?o.forEach(e=>s.add(e)):o.forEach(e=>s.delete(e)),s}function FH(e,t,n,r=!1){if(r)return t.filter(e=>!e.isGroup).map(e=>e.id);let i=(e,t)=>{let r=[];return e.forEach((e,a)=>{let o=t?`${t}.${a}`:`${a}`;r.push(o);let s=n?.(e,a);s&&s.length>0&&r.push(...i(s,o))}),r};return i(e)}function IH({children:e,initialData:t,columns:n,getSubRows:r,onDataChange:i,onSelectionChange:a,options:o={},addFormulaColumn:s}){let c=(0,d.useMemo)(()=>r&&t.some((e,t)=>{let n=r(e,t);return n&&n.length>0})?n.length>1?`table-tree`:`tree`:`table`,[r,t,n.length]),[l,u]=(0,d.useState)({dataState:t,sorting:[],grouping:[],expandedRows:new Set,displayMode:c,selectedRows:new Set,columnOrder:[],hiddenColumns:new Set,columnPinning:{}});(0,d.useEffect)(()=>{u(e=>({...e,dataState:t}))},[t]);let f=(0,d.useCallback)(e=>{u(t=>({...t,sorting:e}))},[]),p=(0,d.useCallback)(e=>{u(t=>({...t,grouping:e}))},[]),m=(0,d.useCallback)(e=>{u(t=>({...t,columnOrder:e}))},[]),g=(0,d.useCallback)(e=>{u(t=>({...t,selectedRows:e}))},[]),_=(0,d.useCallback)(e=>{u(t=>{let n=new Set(t.hiddenColumns);return n.has(e)?n.delete(e):n.add(e),{...t,hiddenColumns:n}})},[]),v=(0,d.useCallback)((e,t)=>{u(n=>({...n,columnPinning:{...n.columnPinning,[e]:t}}))},[]),y=(0,d.useCallback)(e=>{u(t=>{let n=new Set(t.expandedRows);return n.has(e)?n.delete(e):n.add(e),{...t,expandedRows:n}})},[]),b=(0,d.useCallback)((e,t,r)=>{u(a=>{let o=n.find(e=>(e.id||e.accessorKey)===t);if(!o||!o.accessorKey)return a;let s=a.dataState.indexOf(e);if(s===-1)return a;let c=[...a.dataState];return c[s]={...c[s],[o.accessorKey]:r},i&&i(c),{...a,dataState:c}})},[n,i]),x=(0,d.useCallback)(()=>{let e=bH(l.dataState,l.sorting,n);return l.grouping.length>0?CH(e,l.grouping,n,l.expandedRows):wH(e,r,l.expandedRows,c)},[l.dataState,l.sorting,l.grouping,l.expandedRows,n,r,c]),S=(0,d.useCallback)(e=>{u(t=>({...t,globalFilter:e}))},[]),C=(0,d.useRef)(!0);(0,d.useEffect)(()=>{if(C.current){C.current=!1;return}if(!a)return;let e=Array.from(l.selectedRows);a(e,l.dataState.filter((t,n)=>e.includes(String(n))))},[l.selectedRows]);let w=(0,d.useCallback)(e=>{u(t=>{let i=(()=>{let e=bH(t.dataState,t.sorting,n);return t.grouping.length>0?CH(e,t.grouping,n,t.expandedRows):wH(e,r,t.expandedRows,c)})(),a=PH(e,t.selectedRows,i,r);return{...t,selectedRows:a}})},[n,r,c]),T=(0,d.useCallback)(()=>{u(e=>{let t=(()=>{let t=bH(e.dataState,e.sorting,n);return e.grouping.length>0?CH(t,e.grouping,n,e.expandedRows):wH(t,r,e.expandedRows,c)})(),i=FH(e.dataState,t,r,e.grouping.length>0),a=i.every(t=>e.selectedRows.has(t))?new Set:new Set(i);return{...e,selectedRows:a}})},[n,r,c]),E=(0,d.useCallback)(e=>{let t=x();return MH(e,l.selectedRows,t,r)},[x,l.selectedRows,r]),D=(0,d.useCallback)(()=>{let e=x();return NH(FH(l.dataState,e,r,l.grouping.length>0),l.selectedRows)},[x,l.dataState,l.selectedRows,r,l.grouping]),O=(0,d.useMemo)(()=>{let e;if(l.columnOrder.length>0){let t=new Map(n.map((e,t)=>[xH(e,t),e])),r=l.columnOrder.flatMap(e=>{let n=t.get(e);return n?[n]:[]}),i=new Set(l.columnOrder),a=n.filter((e,t)=>!i.has(xH(e,t)));e=[...r,...a]}else e=[...n];if(l.hiddenColumns.size>0){let t=new Map(n.map((e,t)=>[e,t]));e=e.filter(e=>{let n=t.get(e)??0;return!l.hiddenColumns.has(xH(e,n))})}if(l.grouping.length>0){let t=new Set(l.grouping),r=new Map(n.map((e,t)=>[e,t]));return[{id:`__group__`,header:`Group`,minSize:200},...EH(e.filter(e=>{let n=r.get(e)??0;return!t.has(xH(e,n))}),l.columnPinning)]}return EH(e,l.columnPinning)},[l.grouping,l.columnOrder,l.hiddenColumns,l.columnPinning,n]),k=(0,d.useMemo)(()=>({data:l.dataState,columns:n,visibleColumns:O,getSubRows:r,state:l,displayMode:c,setSorting:f,setGrouping:p,toggleRowExpansion:y,updateCellValue:b,getRows:x,options:o,toggleRowSelection:w,toggleAllSelection:T,getRowSelectionState:E,getAllSelectionState:D,setGlobalFilter:S,setColumnOrder:m,toggleColumnVisibility:_,setPinColumn:v,setSelectedRows:g,addFormulaColumn:s}),[l,n,O,r,c,f,p,y,b,x,o,w,T,E,D,S,m,_,v,g,s]);return(0,h.jsx)(yH.Provider,{value:k,children:e})}function LH(){let e=(0,d.useContext)(yH);if(e===void 0)throw Error(`useTable must be used within a TableProvider`);return e}function RH(){return LH()}function zH(e,t){return e??t??!1}function BH(e,t){return e===`always`&&t}function VH(e){return e instanceof Date?(0,h.jsx)(T,{variant:`body`,children:e.toLocaleDateString()}):Array.isArray(e)?(0,h.jsx)(T,{variant:`body`,children:e.join(`, `)}):typeof e==`boolean`?(0,h.jsx)(A,{checked:e,disabled:!0}):typeof e==`number`&&e<0?(0,h.jsx)(T,{variant:`body`,color:`var(--rst-fontColor-danger)`,children:String(e)}):(0,h.jsx)(T,{variant:`body`,children:String(e??``)})}function HH(e,t){return n=>{n.key===`Enter`?(n.preventDefault(),e()):n.key===`Escape`&&(n.preventDefault(),t())}}var UH={"rst-button-group":`_rst-button-group_1q8r7_1`},WH=({options:e,value:t,onChange:n,size:r=`default`,disabled:i=!1,iconOnly:a=!1})=>{let[o,s]=(0,d.useState)(t),c=t??o,l=e=>{t||s(e),n?.(e)};return(0,h.jsx)(`div`,{className:UH[`rst-button-group`],"aria-disabled":i,children:e.map(e=>(0,h.jsx)(D,{value:a?void 0:e.value,leadingVisual:e.leadingVisual,variant:`invisible`,"aria-pressed":c===e.value,size:r,disabled:i||e.disabled,onClick:()=>l(e.value)},e.value))})},Z={"rst-date-input":`_rst-date-input_31mz7_3`,"rst-datepicker-icon-btn":`_rst-datepicker-icon-btn_31mz7_23`,"rst-datepicker-range-sep":`_rst-datepicker-range-sep_31mz7_46`,"rst-datepicker-popup":`_rst-datepicker-popup_31mz7_55`,"rst-datepicker-shortcuts":`_rst-datepicker-shortcuts_31mz7_67`,"rst-datepicker-shortcut-btn":`_rst-datepicker-shortcut-btn_31mz7_76`,"rst-datepicker-shortcut-active":`_rst-datepicker-shortcut-active_31mz7_93`,"rst-datepicker-calendar":`_rst-datepicker-calendar_31mz7_101`,"rst-datepicker-dual":`_rst-datepicker-dual_31mz7_109`,"rst-datepicker-header":`_rst-datepicker-header_31mz7_120`,"rst-datepicker-header-title":`_rst-datepicker-header-title_31mz7_127`,"rst-datepicker-nav-btn":`_rst-datepicker-nav-btn_31mz7_135`,"rst-datepicker-header-btn":`_rst-datepicker-header-btn_31mz7_158`,"rst-datepicker-weekdays":`_rst-datepicker-weekdays_31mz7_175`,"rst-datepicker-weekday":`_rst-datepicker-weekday_31mz7_175`,"rst-datepicker-days":`_rst-datepicker-days_31mz7_188`,"rst-datepicker-day":`_rst-datepicker-day_31mz7_188`,"rst-datepicker-day-selected":`_rst-datepicker-day-selected_31mz7_211`,"rst-datepicker-day-range-start":`_rst-datepicker-day-range-start_31mz7_211`,"rst-datepicker-day-range-end":`_rst-datepicker-day-range-end_31mz7_211`,"rst-datepicker-day-outside":`_rst-datepicker-day-outside_31mz7_215`,"rst-datepicker-day-today":`_rst-datepicker-day-today_31mz7_219`,"rst-datepicker-day-in-range":`_rst-datepicker-day-in-range_31mz7_242`,"rst-datepicker-grid":`_rst-datepicker-grid_31mz7_272`,"rst-datepicker-grid-item":`_rst-datepicker-grid-item_31mz7_279`,"rst-datepicker-grid-item-selected":`_rst-datepicker-grid-item-selected_31mz7_293`,"rst-datepicker-grid-item-in-range":`_rst-datepicker-grid-item-in-range_31mz7_302`,"rst-datepicker-grid-item-current":`_rst-datepicker-grid-item-current_31mz7_307`,"rst-datepicker-grid-4":`_rst-datepicker-grid-4_31mz7_317`,"rst-datepicker-grid-item-range-start":`_rst-datepicker-grid-item-range-start_31mz7_322`,"rst-datepicker-grid-item-range-end":`_rst-datepicker-grid-item-range-end_31mz7_328`};function GH(e,t){let n=(new Date(e,t,1).getDay()+6)%7,r=new Date(e,t,1-n),i=[];for(let e=0;e<42;e++)i.push(new Date(r.getFullYear(),r.getMonth(),r.getDate()+e));return i}var KH=[`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`,`Su`],qH=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],JH=[`Q1`,`Q2`,`Q3`,`Q4`];function YH(e){return Math.floor(e.getMonth()/3)}function XH(e,t){return new Date(e,t*3,1)}function ZH(e,t){return new Date(e,t*3+3,0)}function QH(e){return e?`${e.getDate().toString().padStart(2,`0`)}/${(e.getMonth()+1).toString().padStart(2,`0`)}/${e.getFullYear().toString().padStart(4,`0`)}`:``}function $H(e){return e?`${e.getDate().toString().padStart(2,`0`)}${(e.getMonth()+1).toString().padStart(2,`0`)}${e.getFullYear().toString().padStart(4,`0`)}`:``}function eU(e){let t=e.slice(0,8);return t.length===0?``:t.length<=2?t:t.length<=4?`${t.slice(0,2)}/${t.slice(2)}`:`${t.slice(0,2)}/${t.slice(2,4)}/${t.slice(4)}`}function tU(e){if(e.length!==8)return;let t=parseInt(e.slice(0,2),10),n=parseInt(e.slice(2,4),10)-1,r=parseInt(e.slice(4,8),10);if(n<0||n>11||t<1||t>31)return;let i=new Date(r,n,t);if(!(i.getMonth()!==n||i.getDate()!==t))return i}function nU(e){return e?`${qH[e.getMonth()]} ${e.getFullYear()}`:``}function rU(e){return e?`Q${YH(e)+1} ${e.getFullYear()}`:``}function iU(e){return e?e.getFullYear().toString():``}function aU(e,t){if(!e)return``;switch(t){case`day`:return QH(e);case`month`:return nU(e);case`quarter`:return rU(e);case`year`:return iU(e)}}function oU(e,t){return!e||!t?!1:e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function sU(e,t){return!e||!t?!1:e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()}function cU(e,t){return!e||!t?!1:e.getFullYear()===t.getFullYear()&&YH(e)===YH(t)}function lU(e,t){return!e||!t?!1:e.getFullYear()===t.getFullYear()}function uU(e,t,n){if(!t||!n)return!1;let r=e.getTime();return r>t.getTime()&&r<n.getTime()}function dU(e,t,n){if(!t||!n)return!1;let r=new Date(e.getFullYear(),e.getMonth(),1).getTime(),i=new Date(t.getFullYear(),t.getMonth(),1).getTime(),a=new Date(n.getFullYear(),n.getMonth(),1).getTime();return r>i&&r<a}function fU(e,t,n,r){if(!n||!r)return!1;let i=XH(e,t).getTime(),a=XH(n.getFullYear(),YH(n)).getTime(),o=XH(r.getFullYear(),YH(r)).getTime();return i>a&&i<o}function pU(e,t,n){return!t||!n?!1:e>t.getFullYear()&&e<n.getFullYear()}function mU(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())}function hU(e){let t=(e.getDay()+6)%7;return new Date(e.getFullYear(),e.getMonth(),e.getDate()-t)}function gU(e){let t=hU(e);return new Date(t.getFullYear(),t.getMonth(),t.getDate()+6)}function _U(e){return new Date(e.getFullYear(),e.getMonth(),1)}function vU(e){return new Date(e.getFullYear(),e.getMonth()+1,0)}function yU(e){return new Date(e.getFullYear(),0,1)}function bU(e){return new Date(e.getFullYear(),11,31)}function xU(e,t){return new Date(e.getFullYear(),e.getMonth(),e.getDate()+t)}function SU(e,t){return new Date(e.getFullYear(),e.getMonth()+t,1)}function CU(e,t){return new Date(e.getFullYear()+t,e.getMonth(),e.getDate())}var wU=({viewDate:e,onViewDateChange:t,selectedDate:n,rangeStart:r,rangeEnd:i,hoveredDate:a,onHover:o,onSelect:s,mode:c,onModeChange:l})=>{let u=new Date,d=i??a;if(c===`day`){let i=GH(e.getFullYear(),e.getMonth()),a=t=>{let i=[Z[`rst-datepicker-day`]];if(t.getMonth()!==e.getMonth()&&i.push(Z[`rst-datepicker-day-outside`]),oU(t,u)&&i.push(Z[`rst-datepicker-day-today`]),r&&d){let e=r<d?r:d,n=r<d?d:r;oU(t,e)?i.push(Z[`rst-datepicker-day-range-start`]):oU(t,n)?i.push(Z[`rst-datepicker-day-range-end`]):uU(t,e,n)&&i.push(Z[`rst-datepicker-day-in-range`])}else oU(t,n)&&i.push(Z[`rst-datepicker-day-selected`]);return i.join(` `)};return(0,h.jsxs)(`div`,{className:Z[`rst-datepicker-calendar`],children:[(0,h.jsxs)(`div`,{className:Z[`rst-datepicker-header`],children:[(0,h.jsx)(`button`,{className:Z[`rst-datepicker-nav-btn`],onClick:()=>t(SU(e,-1)),"aria-label":`Previous month`,children:`‹`}),(0,h.jsxs)(`div`,{className:Z[`rst-datepicker-header-title`],children:[(0,h.jsx)(`button`,{className:Z[`rst-datepicker-header-btn`],onClick:()=>l(`month`),children:qH[e.getMonth()]}),(0,h.jsx)(`button`,{className:Z[`rst-datepicker-header-btn`],onClick:()=>l(`year`),children:e.getFullYear()})]}),(0,h.jsx)(`button`,{className:Z[`rst-datepicker-nav-btn`],onClick:()=>t(SU(e,1)),"aria-label":`Next month`,children:`›`})]}),(0,h.jsx)(`div`,{className:Z[`rst-datepicker-weekdays`],children:KH.map(e=>(0,h.jsx)(`div`,{className:Z[`rst-datepicker-weekday`],children:e},e))}),(0,h.jsx)(`div`,{className:Z[`rst-datepicker-days`],children:i.map((e,t)=>(0,h.jsx)(`button`,{className:a(e),onClick:()=>s(e),onMouseEnter:()=>o?.(e),onMouseLeave:()=>o?.(void 0),"aria-label":e.toLocaleDateString(),"aria-pressed":oU(e,n),children:e.getDate()},t))})]})}if(c===`month`){let i=t=>{let i=[Z[`rst-datepicker-grid-item`]],a=new Date(e.getFullYear(),t,1);if(r&&d){let e=r<d?r:d,t=r<d?d:r;sU(a,e)?i.push(Z[`rst-datepicker-grid-item-range-start`]):sU(a,t)?i.push(Z[`rst-datepicker-grid-item-range-end`]):dU(a,e,t)&&i.push(Z[`rst-datepicker-grid-item-in-range`])}else sU(a,n)&&i.push(Z[`rst-datepicker-grid-item-selected`]);return a.getMonth()===u.getMonth()&&a.getFullYear()===u.getFullYear()&&i.push(Z[`rst-datepicker-grid-item-current`]),i.join(` `)};return(0,h.jsxs)(`div`,{className:Z[`rst-datepicker-calendar`],children:[(0,h.jsxs)(`div`,{className:Z[`rst-datepicker-header`],children:[(0,h.jsx)(`button`,{className:Z[`rst-datepicker-nav-btn`],onClick:()=>t(CU(e,-1)),"aria-label":`Previous year`,children:`‹`}),(0,h.jsx)(`div`,{className:Z[`rst-datepicker-header-title`],children:(0,h.jsx)(`button`,{className:Z[`rst-datepicker-header-btn`],onClick:()=>l(`year`),children:e.getFullYear()})}),(0,h.jsx)(`button`,{className:Z[`rst-datepicker-nav-btn`],onClick:()=>t(CU(e,1)),"aria-label":`Next year`,children:`›`})]}),(0,h.jsx)(`div`,{className:Z[`rst-datepicker-grid`],children:qH.map((t,n)=>(0,h.jsx)(`button`,{className:i(n),onClick:()=>s(new Date(e.getFullYear(),n,1)),onMouseEnter:()=>o?.(new Date(e.getFullYear(),n,1)),onMouseLeave:()=>o?.(void 0),children:t},n))})]})}if(c===`quarter`){let i=t=>{let i=[Z[`rst-datepicker-grid-item`]],a=XH(e.getFullYear(),t);if(r&&d){let n=r<d?r:d,o=r<d?d:r;cU(a,n)?i.push(Z[`rst-datepicker-grid-item-range-start`]):cU(a,o)?i.push(Z[`rst-datepicker-grid-item-range-end`]):fU(e.getFullYear(),t,n,o)&&i.push(Z[`rst-datepicker-grid-item-in-range`])}else cU(a,n)&&i.push(Z[`rst-datepicker-grid-item-selected`]);return e.getFullYear()===u.getFullYear()&&t===YH(u)&&i.push(Z[`rst-datepicker-grid-item-current`]),i.join(` `)};return(0,h.jsxs)(`div`,{className:Z[`rst-datepicker-calendar`],children:[(0,h.jsxs)(`div`,{className:Z[`rst-datepicker-header`],children:[(0,h.jsx)(`button`,{className:Z[`rst-datepicker-nav-btn`],onClick:()=>t(CU(e,-1)),"aria-label":`Previous year`,children:`‹`}),(0,h.jsx)(`div`,{className:Z[`rst-datepicker-header-title`],children:(0,h.jsx)(`button`,{className:Z[`rst-datepicker-header-btn`],onClick:()=>l(`year`),children:e.getFullYear()})}),(0,h.jsx)(`button`,{className:Z[`rst-datepicker-nav-btn`],onClick:()=>t(CU(e,1)),"aria-label":`Next year`,children:`›`})]}),(0,h.jsx)(`div`,{className:`${Z[`rst-datepicker-grid`]} ${Z[`rst-datepicker-grid-4`]}`,children:JH.map((t,n)=>(0,h.jsx)(`button`,{className:i(n),onClick:()=>s(XH(e.getFullYear(),n)),onMouseEnter:()=>o?.(XH(e.getFullYear(),n)),onMouseLeave:()=>o?.(void 0),children:t},n))})]})}let f=Math.floor(e.getFullYear()/12)*12,p=Array.from({length:12},(e,t)=>f+t),m=e=>{let t=[Z[`rst-datepicker-grid-item`]],i=new Date(e,0,1);if(r&&d){let n=r<d?r:d,a=r<d?d:r;lU(i,n)?t.push(Z[`rst-datepicker-grid-item-range-start`]):lU(i,a)?t.push(Z[`rst-datepicker-grid-item-range-end`]):pU(e,n,a)&&t.push(Z[`rst-datepicker-grid-item-in-range`])}else lU(i,n)&&t.push(Z[`rst-datepicker-grid-item-selected`]);return e===u.getFullYear()&&t.push(Z[`rst-datepicker-grid-item-current`]),t.join(` `)};return(0,h.jsxs)(`div`,{className:Z[`rst-datepicker-calendar`],children:[(0,h.jsxs)(`div`,{className:Z[`rst-datepicker-header`],children:[(0,h.jsx)(`button`,{className:Z[`rst-datepicker-nav-btn`],onClick:()=>t(new Date(f-12,0,1)),"aria-label":`Previous decade`,children:`‹`}),(0,h.jsx)(`div`,{className:Z[`rst-datepicker-header-title`],children:(0,h.jsxs)(`span`,{style:{font:`var(--rst-font-body)`,fontWeight:600,color:`var(--rst-fontColor-default)`},children:[f,` – `,f+11]})}),(0,h.jsx)(`button`,{className:Z[`rst-datepicker-nav-btn`],onClick:()=>t(new Date(f+12,0,1)),"aria-label":`Next decade`,children:`›`})]}),(0,h.jsx)(`div`,{className:Z[`rst-datepicker-grid`],children:p.map(e=>(0,h.jsx)(`button`,{className:m(e),onClick:()=>s(new Date(e,0,1)),onMouseEnter:()=>o?.(new Date(e,0,1)),onMouseLeave:()=>o?.(void 0),children:e},e))})]})};function TU(){let e=new Date;return[{label:`Today`,getValue:()=>mU(e)},{label:`Yesterday`,getValue:()=>xU(mU(e),-1)},{label:`Tomorrow`,getValue:()=>xU(mU(e),1)}]}function EU(){let e=new Date,t=YH(e);return[{label:`Today`,getValue:()=>({from:mU(e),to:mU(e)})},{label:`This week`,getValue:()=>({from:hU(e),to:gU(e)})},{label:`Last week`,getValue:()=>({from:hU(xU(e,-7)),to:gU(xU(e,-7))})},{label:`Last 7 days`,getValue:()=>({from:xU(mU(e),-6),to:mU(e)})},{label:`Last 30 days`,getValue:()=>({from:xU(mU(e),-29),to:mU(e)})},{label:`This month`,getValue:()=>({from:_U(e),to:vU(e)})},{label:`Last month`,getValue:()=>({from:_U(SU(e,-1)),to:vU(SU(e,-1))})},{label:`This quarter`,getValue:()=>({from:XH(e.getFullYear(),t),to:ZH(e.getFullYear(),t)})},{label:`Last quarter`,getValue:()=>{let n=t===0?3:t-1,r=t===0?e.getFullYear()-1:e.getFullYear();return{from:XH(r,n),to:ZH(r,n)}}},{label:`This year`,getValue:()=>({from:yU(e),to:bU(e)})},{label:`Last year`,getValue:()=>({from:yU(CU(e,-1)),to:bU(CU(e,-1))})}]}var DU=({rangeMode:e,onSelectSingle:t,onSelectRange:n})=>{if(e){let e=EU();return(0,h.jsx)(`div`,{className:Z[`rst-datepicker-shortcuts`],children:e.map(e=>(0,h.jsx)(`button`,{className:Z[`rst-datepicker-shortcut-btn`],onClick:()=>n(e.getValue()),type:`button`,children:e.label},e.label))})}let r=TU();return(0,h.jsx)(`div`,{className:Z[`rst-datepicker-shortcuts`],children:r.map(e=>(0,h.jsx)(`button`,{className:Z[`rst-datepicker-shortcut-btn`],onClick:()=>t(e.getValue()),type:`button`,children:e.label},e.label))})},OU=({value:e,mode:t,onRangeChange:n,onOpen:r,error:i,leadingIcon:a,size:o,disabled:s,isReadOnly:c,onBlur:l,className:u})=>{let f=(0,d.useRef)(null),p=(0,d.useRef)(null),[m,g]=(0,d.useState)(()=>t===`day`?$H(e.from):``),[_,v]=(0,d.useState)(()=>t===`day`?$H(e.to):``);(0,d.useEffect)(()=>{t===`day`&&g($H(e.from))},[e.from,t]),(0,d.useEffect)(()=>{t===`day`&&v($H(e.to))},[e.to,t]);let y=r=>{if(t!==`day`)return;let i=r.target.value.replace(/\D/g,``).slice(0,8),a=m.length;if(g(i),i.length===2&&a<2?requestAnimationFrame(()=>f.current?.setSelectionRange(3,3)):i.length===4&&a<4&&requestAnimationFrame(()=>f.current?.setSelectionRange(6,6)),i.length===8){let t=tU(i);n({from:t,to:e.to}),t&&requestAnimationFrame(()=>p.current?.focus())}else i.length===0&&n({from:void 0,to:e.to})},x=r=>{if(t!==`day`)return;let i=r.target.value.replace(/\D/g,``).slice(0,8),a=_.length;v(i),i.length===2&&a<2?requestAnimationFrame(()=>p.current?.setSelectionRange(3,3)):i.length===4&&a<4&&requestAnimationFrame(()=>p.current?.setSelectionRange(6,6)),i.length===8?n({from:e.from,to:tU(i)}):i.length===0&&n({from:e.from,to:void 0})},S=()=>{t===`day`&&m.length>0&&m.length<8&&g($H(e.from)),l?.()},C=()=>{t===`day`&&_.length>0&&_.length<8&&v($H(e.to)),l?.()},w=()=>{!s&&!c&&r()},T=c||t!==`day`;return(0,h.jsx)(vV,{error:i,leadingIcon:a,size:o,disabled:s,className:u,children:({disabled:e})=>(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`input`,{ref:f,type:`text`,placeholder:`DD/MM/YYYY`,value:eU(m),className:`${_V[`rst-input`]} ${Z[`rst-date-input`]}`,onChange:y,onBlur:S,disabled:e,readOnly:T,inputMode:`numeric`,autoComplete:`off`,style:{flex:1,width:`auto`},onClick:w,size:10}),(0,h.jsx)(b,{src:`arrow-right`,disabled:e}),(0,h.jsx)(`input`,{ref:p,type:`text`,placeholder:`DD/MM/YYYY`,value:eU(_),className:`${_V[`rst-input`]} ${Z[`rst-date-input`]}`,onChange:x,onBlur:C,disabled:e,readOnly:T,inputMode:`numeric`,autoComplete:`off`,style:{flex:1,width:`auto`},onClick:w,size:10}),(0,h.jsx)(D,{variant:`invisible`,"aria-label":`Open calendar`,onClick:w,disabled:e||T,type:`button`,tabIndex:-1,leadingVisual:`calendar`})]})})},kU=({value:e,onChange:t,mode:n=`day`,shortcuts:r=!1,readOnly:i,disabled:a,...o})=>{let[s,c]=(0,d.useState)(!1),[l,u]=(0,d.useState)(void 0),[f,p]=(0,d.useState)(null),[m,g]=(0,d.useState)(()=>e.from??new Date),[_,v]=(0,d.useState)(()=>e.from?SU(e.from,1):SU(new Date,1)),[y,b]=(0,d.useState)(n),x=()=>{!a&&!i&&(c(!0),p(`start`))},S=r=>{if(y!==n){b(n);return}if(f===`start`||!f)t({from:r,to:void 0}),p(`end`);else{let n=e.from;t(r<n?{from:r,to:n}:{from:n,to:r}),p(null),c(!1)}},C=e=>{t(e),p(null),c(!1)},w=e=>{g(e),n===`day`&&e>=_&&v(SU(e,1))},T=e=>{v(e),n===`day`&&e<=m&&g(SU(e,-1))};return(0,h.jsx)(M,{isOpen:s&&!a&&!i,onClose:()=>{c(!1),p(null)},position:`center`,align:`bottom`,anchor:(0,h.jsx)(OU,{...o,value:e,mode:n,onRangeChange:t,onOpen:x,disabled:a,isReadOnly:i}),target:(0,h.jsxs)(`div`,{className:Z[`rst-datepicker-popup`],children:[r&&(0,h.jsx)(DU,{pickerMode:n,rangeMode:!0,onSelectSingle:()=>{},onSelectRange:C}),(0,h.jsxs)(`div`,{className:Z[`rst-datepicker-dual`],children:[(0,h.jsx)(wU,{viewDate:m,onViewDateChange:w,rangeStart:e.from,rangeEnd:f===`end`?l??e.to:e.to,hoveredDate:f===`end`?l:void 0,onHover:u,onSelect:S,mode:y,onModeChange:b}),n===`day`&&(0,h.jsx)(wU,{viewDate:_,onViewDateChange:T,rangeStart:e.from,rangeEnd:f===`end`?l??e.to:e.to,hoveredDate:f===`end`?l:void 0,onHover:u,onSelect:S,mode:y,onModeChange:b})]})]})})},AU={SELECT:`SELECT`,BUTTON_GROUP:`BUTTON_GROUP`,TEXT:`TEXT`,NUMBER:`NUMBER`,DATE:`DATE`,DATE_RANGE:`DATE_RANGE`},jU=({value:e,mode:t,onDateChange:n,onOpen:r,autoFocus:i,placeholder:a,error:o,leadingIcon:s,size:c,disabled:l,readOnly:u,onBlur:f,onKeyDown:p,className:m})=>{let g=(0,d.useRef)(null),[_,v]=(0,d.useState)(()=>t===`day`?$H(e):``);(0,d.useEffect)(()=>{t===`day`&&v($H(e))},[e,t]);let y=a??(t===`day`?`DD/MM/YYYY`:t===`month`?`MMM YYYY`:t===`quarter`?`Qn YYYY`:`YYYY`),b=t===`day`?eU(_):aU(e,t),x=e=>{if(t!==`day`)return;let r=e.target.value.replace(/\D/g,``).slice(0,8),i=_.length;v(r),r.length===2&&i<2?requestAnimationFrame(()=>g.current?.setSelectionRange(3,3)):r.length===4&&i<4&&requestAnimationFrame(()=>g.current?.setSelectionRange(6,6)),r.length===8?n(tU(r)):r.length===0&&n(void 0)},S=()=>{t===`day`&&_.length>0&&_.length<8&&v($H(e)),f?.()},C=()=>{!l&&!u&&r()};return(0,h.jsx)(vV,{error:o,leadingIcon:s,size:c,disabled:l,className:m,children:({id:e,disabled:n})=>(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`input`,{ref:g,id:e,type:`text`,value:b,disabled:n,autoFocus:i,placeholder:y,className:`${_V[`rst-input`]} ${Z[`rst-date-input`]}`,onChange:x,onBlur:S,onKeyDown:p,readOnly:u||t!==`day`,inputMode:`numeric`,autoComplete:`off`,onClick:C,size:10}),(0,h.jsx)(D,{variant:`invisible`,"aria-label":`Open calendar`,onClick:C,disabled:n||u,type:`button`,tabIndex:-1,leadingVisual:`calendar`})]})})},MU=({value:e,onChange:t,mode:n=`day`,shortcuts:r=!1,readOnly:i,disabled:a,...o})=>{let[s,c]=(0,d.useState)(!1),[l,u]=(0,d.useState)(()=>e??new Date),[f,p]=(0,d.useState)(n),m=e=>{t(e),f===n?c(!1):p(n)},g=e=>{p(e)},_=e=>{t(e),c(!1)};return(0,h.jsx)(M,{isOpen:s&&!a&&!i,onClose:()=>c(!1),position:`center`,align:`bottom`,anchor:(0,h.jsx)(jU,{...o,value:e,mode:n,onDateChange:t,onOpen:()=>!a&&!i&&c(!0),disabled:a,readOnly:i}),target:(0,h.jsxs)(`div`,{className:Z[`rst-datepicker-popup`],children:[r&&(0,h.jsx)(DU,{pickerMode:n,rangeMode:!1,onSelectSingle:_,onSelectRange:()=>{}}),(0,h.jsx)(wU,{viewDate:l,onViewDateChange:u,selectedDate:e,onSelect:m,mode:f,onModeChange:g})]})})};function NU(e,t,n,r,i,a,o,s,c,l){if(`options`in t&&t.options)switch(t.cellType){case AU.SELECT:return(0,h.jsx)(SV,{value:String(e??``),options:t.options,onChange:e=>i(e),disabled:c});case AU.BUTTON_GROUP:return(0,h.jsx)(WH,{value:String(e??``),options:t.options,onChange:e=>i(e),size:`small`,disabled:c});default:return(0,h.jsx)(SV,{value:String(e??``),options:t.options,onChange:e=>i(e),disabled:c})}return e==null?t.cellType===AU.NUMBER?(0,h.jsx)(MV,{value:void 0,onChange:e=>n(e),onBlur:r,onKeyDown:a,autoFocus:o,className:l,error:s,disabled:c}):(0,h.jsx)(yV,{value:``,onChange:e=>n(e),onBlur:r,onKeyDown:a,autoFocus:o,className:l,error:s,disabled:c}):typeof e==`string`?(0,h.jsx)(yV,{value:e,onChange:e=>n(e),onBlur:r,onKeyDown:a,autoFocus:o,error:s,disabled:c}):typeof e==`number`?(0,h.jsx)(MV,{value:e,onChange:e=>n(e),onBlur:r,onKeyDown:a,autoFocus:o,className:l,error:s,disabled:c}):typeof e==`boolean`?(0,h.jsx)(A,{checked:e,onChange:e=>i(e),className:l,disabled:c}):t.cellType===AU.DATE_RANGE?(0,h.jsx)(kU,{value:e??{from:null,to:null},onChange:e=>i(e),className:l,error:s,disabled:c,shortcuts:!0}):e instanceof Date?(0,h.jsx)(MU,{value:e,onChange:e=>n(e),onBlur:r,onKeyDown:a,autoFocus:o,className:l,error:s,disabled:c}):(0,h.jsx)(yV,{value:e,onChange:e=>n(e),onBlur:r,onKeyDown:a,autoFocus:o,className:l,disabled:c})}var PU={"rst-helper-text":`_rst-helper-text_1vzvn_1`,"rst-helper-text-success":`_rst-helper-text-success_1vzvn_9`,"rst-helper-text-danger":`_rst-helper-text-danger_1vzvn_13`},FU=({id:e,helperText:t,disabled:n,state:r})=>{let i=r==`success`?`check`:r==`warning`?`warning`:`error`;return(0,h.jsxs)(T,{variant:`caption`,id:e,"aria-live":`polite`,className:{helperText:` ${PU[`rst-helper-text`]} ${r?PU[`rst-helper-text-${r}`]:``}`}.helperText,"aria-disabled":n,children:[r&&(0,h.jsx)(b,{src:i,state:r,disabled:n}),t]})},IU=({value:e,column:t,rowData:n,editMode:r=`doubleClick`,isEditable:i,error:a,disabled:o=!1,showLabel:s=!0,showHelperText:c=!0,onValueChange:l,onEditStart:u,onEditEnd:f})=>{let p=zH(i,t.enableEditing),m=BH(r,p),g=!p||r===`never`,[_,v]=(0,d.useState)(e),[y,b]=(0,d.useState)(m),x=t.id||String(t.accessorKey),S=t.header;(0,d.useEffect)(()=>{v(e)},[e]);let C=(0,d.useCallback)(()=>{!p||o||(b(!0),u?.(n,t))},[p,o,u,n,t]),w=(0,d.useCallback)(()=>{_!==e&&l&&l(_,n,t),m||(b(!1),f?.(n,t))},[_,e,t,n,l,m,f]),T=(0,d.useCallback)(()=>{v(e),m||(b(!1),f?.(n,t))},[e,m,f,n,t]),E=(0,d.useCallback)(e=>{v(e),l&&l(e,n,t)},[l,n,t]),D=HH(w,T),O=r===`click`?C:void 0,k=r===`doubleClick`?C:void 0;return g||o?(0,h.jsx)(`div`,{style:{opacity:o?.5:1,cursor:o?`not-allowed`:`default`},children:VH(_)}):m||y?(0,h.jsxs)(`div`,{children:[s&&S&&(0,h.jsx)(PV,{label:S,id:x,required:t.required,disabled:o}),NU(_,t,v,w,E,D,!m,a,o),c&&a&&(0,h.jsx)(FU,{helperText:a,id:x,disabled:o,state:`base`})]}):(0,h.jsx)(`div`,{onClick:o?void 0:O,onDoubleClick:o?void 0:k,style:{cursor:o?`not-allowed`:`pointer`,opacity:o?.5:1},children:_==null||_===``?(0,h.jsx)(`span`,{style:{color:`var(--rst-fontColor-disabled)`,display:`block`,minHeight:`1.25em`},children:`—`}):VH(_)})},LU=class{input;position;length;constructor(e){this.input=e,this.position=0,this.length=e.length}tokenize(){let e=[];for(;this.position<this.length;){let t=this.input[this.position];if(/\s/.test(t)){this.position++;continue}if(this.isDigit(t)){e.push(this.readNumber());continue}if(this.isAlpha(t)){e.push(this.readIdentifierOrKeyword());continue}if(t===`"`||t===`'`){e.push(this.readString(t));continue}if(this.isOperatorStart(t)){e.push(this.readOperator());continue}if(t===`(`){e.push({type:`LPAREN`,value:`(`,position:this.position++});continue}if(t===`)`){e.push({type:`RPAREN`,value:`)`,position:this.position++});continue}if(t===`,`){e.push({type:`COMMA`,value:`,`,position:this.position++});continue}throw Error(`Unexpected character: ${t} at position ${this.position}`)}return e.push({type:`EOF`,value:``,position:this.position}),e}isDigit(e){return/[0-9]/.test(e)}isAlpha(e){return/[a-zA-Z_]/.test(e)}isOperatorStart(e){return/[+\-*/%><=!&|]/.test(e)}readNumber(){let e=this.position,t=!1;for(;this.position<this.length;){let e=this.input[this.position];if(this.isDigit(e))this.position++;else if(e===`.`&&!t)t=!0,this.position++;else break}return{type:`NUMBER`,value:this.input.slice(e,this.position),position:e}}readIdentifierOrKeyword(){let e=this.position;for(;this.position<this.length&&(this.isAlpha(this.input[this.position])||this.isDigit(this.input[this.position]));)this.position++;let t=this.input.slice(e,this.position);return[`AND`,`OR`,`NOT`].includes(t.toUpperCase())?{type:`OPERATOR`,value:t.toUpperCase(),position:e}:{type:`IDENTIFIER`,value:t,position:e}}readString(e){let t=this.position;for(this.position++;this.position<this.length&&this.input[this.position]!==e;)this.position++;if(this.position>=this.length)throw Error(`Unterminated string literal`);return this.position++,{type:`STRING`,value:this.input.slice(t+1,this.position-1),position:t}}readOperator(){let e=this.position,t=this.input[this.position];return(t===`>`||t===`<`||t===`!`||t===`=`)&&this.input[this.position+1]===`=`?(this.position+=2,{type:`OPERATOR`,value:t+`=`,position:e}):t===`&`&&this.input[this.position+1]===`&`?(this.position+=2,{type:`OPERATOR`,value:`&&`,position:e}):t===`|`&&this.input[this.position+1]===`|`?(this.position+=2,{type:`OPERATOR`,value:`||`,position:e}):(this.position++,{type:`OPERATOR`,value:t,position:e})}},RU=class{tokens;current=0;constructor(e){this.tokens=e}parse(){let e=this.expression();if(!this.isAtEnd())throw Error(`Unexpected trailing tokens at position ${this.peek().position}: '${this.peek().value}'`);return e}expression(){return this.logicalOr()}logicalOr(){let e=this.logicalAnd();for(;this.match(`OPERATOR`,`OR`)||this.match(`OPERATOR`,`||`);){let t=this.previous().value,n=this.logicalAnd();e={type:`BinaryExpression`,operator:t,left:e,right:n}}return e}logicalAnd(){let e=this.equality();for(;this.match(`OPERATOR`,`AND`)||this.match(`OPERATOR`,`&&`);){let t=this.previous().value,n=this.equality();e={type:`BinaryExpression`,operator:t,left:e,right:n}}return e}equality(){let e=this.relational();for(;this.match(`OPERATOR`,`==`)||this.match(`OPERATOR`,`!=`);){let t=this.previous().value,n=this.relational();e={type:`BinaryExpression`,operator:t,left:e,right:n}}return e}relational(){let e=this.additive();for(;this.match(`OPERATOR`,`>`)||this.match(`OPERATOR`,`<`)||this.match(`OPERATOR`,`>=`)||this.match(`OPERATOR`,`<=`);){let t=this.previous().value,n=this.additive();e={type:`BinaryExpression`,operator:t,left:e,right:n}}return e}additive(){let e=this.multiplicative();for(;this.match(`OPERATOR`,`+`)||this.match(`OPERATOR`,`-`);){let t=this.previous().value,n=this.multiplicative();e={type:`BinaryExpression`,operator:t,left:e,right:n}}return e}multiplicative(){let e=this.unary();for(;this.match(`OPERATOR`,`*`)||this.match(`OPERATOR`,`/`)||this.match(`OPERATOR`,`%`);){let t=this.previous().value,n=this.unary();e={type:`BinaryExpression`,operator:t,left:e,right:n}}return e}unary(){return this.match(`OPERATOR`,`-`)||this.match(`OPERATOR`,`!`)||this.match(`OPERATOR`,`NOT`)?{type:`UnaryExpression`,operator:this.previous().value,argument:this.unary()}:this.primary()}primary(){if(this.match(`NUMBER`))return{type:`Literal`,value:parseFloat(this.previous().value),raw:this.previous().value};if(this.match(`STRING`))return{type:`Literal`,value:this.previous().value,raw:this.previous().value};if(this.match(`IDENTIFIER`))return{type:`Identifier`,name:this.previous().value};if(this.match(`LPAREN`)){let e=this.expression();return this.consume(`RPAREN`,`Expect ')' after expression.`),e}throw Error(`Expect expression at position ${this.peek().position}. Found ${this.peek().type} '${this.peek().value}'`)}match(e,t){return this.check(e,t)?(this.advance(),!0):!1}check(e,t){if(this.isAtEnd())return!1;let n=this.peek();return!(n.type!==e||t!==void 0&&n.value!==t)}advance(){return this.isAtEnd()||this.current++,this.previous()}isAtEnd(){return this.peek().type===`EOF`}peek(){return this.tokens[this.current]}previous(){return this.tokens[this.current-1]}consume(e,t){if(this.check(e))return this.advance();throw Error(t)}},zU=class{context;constructor(e){this.context=e}evaluate(e){switch(e.type){case`Literal`:return e.value;case`Identifier`:return this.evaluateIdentifier(e);case`BinaryExpression`:return this.evaluateBinary(e);case`UnaryExpression`:return this.evaluateUnary(e);default:throw Error(`Unknown node type: ${e.type}`)}}evaluateIdentifier(e){let t=this.context[e.name];return t===void 0?null:t}evaluateBinary(e){let t=this.evaluate(e.left),n=this.evaluate(e.right);switch(e.operator){case`+`:return this.toNumber(t)+this.toNumber(n);case`-`:return this.toNumber(t)-this.toNumber(n);case`*`:return this.toNumber(t)*this.toNumber(n);case`/`:{let e=this.toNumber(n);return e===0?1/0:this.toNumber(t)/e}case`%`:return this.toNumber(t)%this.toNumber(n);case`>`:return t>n;case`<`:return t<n;case`>=`:return t>=n;case`<=`:return t<=n;case`==`:return t==n;case`!=`:return t!=n;case`&&`:return!!t&&!!n;case`||`:return!!t||!!n;default:throw Error(`Unknown operator: ${e.operator}`)}}evaluateUnary(e){let t=this.evaluate(e.argument);switch(e.operator){case`-`:return-this.toNumber(t);case`!`:return!t;default:throw Error(`Unknown unary operator: ${e.operator}`)}}toNumber(e){if(typeof e==`number`)return e;if(e==null)return 0;let t=parseFloat(String(e));return isNaN(t)?0:t}},BU=class{static cache=new Map;static parse(e){if(this.cache.has(e))return this.cache.get(e);let t=new RU(new LU(e).tokenize()).parse();return this.cache.set(e,t),t}static evaluate(e,t){try{let n=this.parse(e);return new zU(t).evaluate(n)}catch(t){return console.error(`Error evaluating formula "${e}":`,t),null}}static validate(e){try{return this.parse(e),{valid:!0}}catch(e){return{valid:!1,error:e instanceof Error?e.message:String(e)}}}};function VU(e,t){if(e.formula)return BU.evaluate(e.formula,t);if(e.accessorFn)return e.accessorFn(t);if(e.accessorKey)return t[e.accessorKey]}function HU(e,t){if(t.length===0)return;let n=t.map(t=>VU(e,t));if(n.every(e=>typeof e==`number`))return n.reduce((e,t)=>e+t,0)}function UU({row:e,onRowClick:t,isEnableEditing:n=!1,"aria-rowindex":r,columnOffsets:i}){let{visibleColumns:a,toggleRowExpansion:o,getSubRows:s,updateCellValue:c,displayMode:l,options:u,toggleRowSelection:d,getRowSelectionState:f}=RH(),p=a,m=e.isGroup,g=s?(s(e.data,e.index)?.length||0)>0:!1,_=l===`table-tree`&&g,v=u.enableSelection,y=v?f(e):`unchecked`,b=y===`checked`,x=v&&OH(i??{}),S=()=>{m?o(e.id):t?.(e.data,e.index)},C=(t,n,r)=>{let i=r.id||String(r.accessorKey);c(e.data,i,t)};return(0,h.jsxs)(`tr`,{className:[X[`rst-table-row`],m?X[`rst-table-row-group`]:X[`rst-table-row-${l}`],b?X[`rst-table-row-selected`]:``].filter(Boolean).join(` `),onClick:S,"aria-rowindex":r,"aria-selected":v?b:void 0,children:[v&&(0,h.jsx)(`td`,{className:[X[`rst-table-cell`],X[`rst-table-selection-cell`],x?X[`rst-table-cell-pinned`]:``].filter(Boolean).join(` `),style:x?{left:0}:void 0,children:(0,h.jsx)(`div`,{className:X[`rst-table-cell-wrapper`],children:(0,h.jsx)(A,{checked:y===`checked`,indeterminate:y===`indeterminate`,onChange:()=>d(e),"aria-label":`Select row ${e.id}`})})}),p.map((t,r)=>{let a=r===0,s=t.id===`__group__`,c=xH(t,r),l=i?.[c],u=!!l&&l.left!==void 0,d=!!l&&l.right!==void 0,f=u||d,p=f?{left:l.left,right:l.right}:{},g=s?void 0:m&&e.groupItems?HU(t,e.groupItems):VU(t,e.data);return(0,h.jsx)(`td`,{className:`${X[`rst-table-cell`]} ${f?X[`rst-table-cell-pinned`]:``} ${u?X[`rst-table-cell-pinned-left`]:``} ${d?X[`rst-table-cell-pinned-right`]:``} ${m?X[`rst-table-cell-group`]:``}`,style:{paddingLeft:a?`${e.depth*24+(m?16:4)}px`:void 0,...p},children:(0,h.jsxs)(`div`,{className:X[`rst-table-cell-wrapper`],children:[a&&(_||m)&&(0,h.jsx)(D,{onClick:t=>{t.stopPropagation(),o(e.id)},leadingVisual:e.isExpanded?`chevron-down`:`chevron-right`,variant:`invisible`}),m&&a&&(0,h.jsx)(`span`,{className:X[`rst-table-group-label`],children:String(e.groupingValue)}),!s&&(0,h.jsx)(IU,{value:g,column:t,rowData:e.data,rowIndex:e.index,editMode:!m&&n&&t.enableEditing!==!1?g==null||g===``?`click`:`doubleClick`:`never`,onValueChange:C,showHelperText:!1,showLabel:!1})]})},`${e.id}-${c}`)})]})}function WU(e,t){if(e.length===0)return null;switch(t){case`sum`:return e.reduce((e,t)=>e+t,0);case`count`:return e.length;case`avg`:return e.reduce((e,t)=>e+t,0)/e.length;case`min`:return e.reduce((e,t)=>t<e?t:e,1/0);case`max`:return e.reduce((e,t)=>t>e?t:e,-1/0);default:return null}}function GU(e){return e==null?`—`:typeof e==`string`?e:Number.isInteger(e)?String(e):e.toFixed(2)}function KU({columnOffsets:e}){let{visibleColumns:t,data:n,options:r}=RH(),{stickyFooter:i,enableSelection:a}=r;if(!i)return null;let o=a&&OH(e),s=e=>{if(typeof e.footer==`function`)return e.footer({column:e});if(typeof e.footer==`object`&&e.footer!==null){let{aggregation:t}=e.footer,r=e.accessorKey;return r?GU(WU(t===`count`?n.map(()=>1):n.map(e=>Number(e[r])).filter(e=>!isNaN(e)),t)):e.footer.label??null}return e.footer??null};return(0,h.jsx)(`tfoot`,{className:`${X[`rst-table-footer`]} ${i?X[`rst-table-footer-sticky`]:``}`,children:(0,h.jsxs)(`tr`,{children:[a&&(0,h.jsx)(`td`,{className:[X[`rst-table-selection-cell`],o?X[`rst-table-cell-pinned`]:``].filter(Boolean).join(` `),style:o?{left:0}:void 0}),t.map((t,n)=>{let r=xH(t,n),i=e[r],a=!!i&&i.left!==void 0,o=!!i&&i.right!==void 0,c=a||o,l=c?{left:i.left,right:i.right}:{};return(0,h.jsx)(`td`,{className:[c?X[`rst-table-cell-pinned`]:``,a?X[`rst-table-cell-pinned-left`]:``,o?X[`rst-table-cell-pinned-right`]:``].filter(Boolean).join(` `),style:l,children:s(t)},r)})]})})}var qU={"rst-chip":`_rst-chip_1wj5n_1`,"rst-chip-variant-default":`_rst-chip-variant-default_1wj5n_20`,"rst-chip-variant-primary":`_rst-chip-variant-primary_1wj5n_26`,"rst-chip-variant-outline":`_rst-chip-variant-outline_1wj5n_31`,"rst-chip-size-small":`_rst-chip-size-small_1wj5n_37`,"rst-chip-size-default":`_rst-chip-size-default_1wj5n_41`},JU=d.default.forwardRef(({children:e,leadingVisual:t,trailingVisual:n,onRemove:r,variant:i=`default`,size:a=`small`,className:o,draggable:s,onDragStart:c,onDragOver:l,onDragEnd:u,...d},f)=>(0,h.jsxs)(`div`,{"data-component":`chip`,ref:f,className:[qU[`rst-chip`],qU[`rst-chip-variant-${i}`],qU[`rst-chip-size-${a}`],o].filter(Boolean).join(` `),...d,"data-draggable":s,"data-clearable":!!r,children:[s&&(0,h.jsx)(`span`,{draggable:!0,onDragStart:c,onDragOver:l,onDragEnd:u,className:qU[`drag-handle`],children:(0,h.jsx)(D,{leadingVisual:`drag`,variant:`invisible`,"aria-label":`Drag`,size:`small`})}),t&&(0,h.jsx)(b,{src:t}),(0,h.jsx)(T,{variant:`caption`,children:e}),n&&!r&&(0,h.jsx)(b,{src:n}),r&&(0,h.jsx)(D,{onClick:r,variant:`invisible`,"aria-label":`Remove`,leadingVisual:`delete`,size:`small`})]})),YU={"rst-group-panel":`_rst-group-panel_19fkn_2`,"rst-group-panel-indicator":`_rst-group-panel-indicator_19fkn_10`,"rst-chip-ghost":`_rst-chip-ghost_19fkn_15`};function XU({grouping:e,columns:t,onGroupingChange:n}){let[r,i]=(0,d.useState)(null),[a,o]=(0,d.useState)(null),s=(0,d.useRef)(null),c=t=>{n(e.filter(e=>e!==t))},l=(n,r)=>{n.dataTransfer.setData(`application/x-restio-group-index`,String(r)),n.dataTransfer.effectAllowed=`move`;let i=t.find(t=>(t.id||t.accessorKey)===e[r]);o(i?.header?String(i.header):e[r]??null)},u=()=>{i(null),o(null)},f=e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`move`;let t=s.current;if(!t)return;let n=Array.from(t.querySelectorAll(`[data-chip]`)),r=e.clientX,a=n.length;for(let e=0;e<n.length;e++){let t=n[e].getBoundingClientRect();if(r<t.left+t.width/2){a=e;break}}i(e=>e?.index===a?e:{index:a})},p=t=>{t.preventDefault(),t.stopPropagation();let a=r?.index??e.length;i(null);let s=t.dataTransfer.getData(`application/x-restio-group-index`);if(s){let t=parseInt(s,10);if(isNaN(t)||t===a)return;let r=[...e],[i]=r.splice(t,1),o=t<a?a-1:a;r.splice(o,0,i),n(r);return}let c=t.dataTransfer.getData(`text/plain`);if(c&&!e.includes(c)){let t=[...e];t.splice(a,0,c),n(t)}o(null)},m=a?(0,h.jsx)(JU,{draggable:!0,className:YU[`rst-chip-ghost`],children:String(a)}):null;return(0,h.jsxs)(`div`,{ref:s,className:YU[`rst-group-panel`],onDrop:p,onDragOver:f,children:[(0,h.jsx)(`div`,{className:YU[`rst-group-panel-indicator`],children:e.length===0?(0,h.jsx)(T,{variant:`caption`,children:`(Drag to reorder)`}):(0,h.jsx)(b,{src:`groups`})}),e.map((n,i)=>{let o=t.find(e=>(e.id||e.accessorKey)===n)?.header||n,s=r?.index===i&&a&&e.includes(a),f=r?.index===i&&(!e.includes(a)||!s);return(0,h.jsxs)(d.default.Fragment,{children:[f&&m,(0,h.jsx)(JU,{"data-chip":!0,draggable:!0,onDragStart:e=>l(e,i),onDragEnd:u,onRemove:e=>{e.stopPropagation(),c(n)},children:o}),e.length>1&&i<e.length-1&&(0,h.jsx)(b,{src:`arrow-right`})]},n)}),r?.index===e.length&&m]})}var ZU={"rst-table-header":`_rst-table-header_161qw_1`,"rst-table-header-cell":`_rst-table-header-cell_161qw_5`,"rst-table-header-content":`_rst-table-header-content_161qw_18`,"rst-table-header-cell-pinned":`_rst-table-header-cell-pinned_161qw_33`,"rst-table-header-cell-pinned-left":`_rst-table-header-cell-pinned-left_161qw_39`,"rst-table-header-cell-pinned-right":`_rst-table-header-cell-pinned-right_161qw_43`,"rst-table-header-cell-drag-over":`_rst-table-header-cell-drag-over_161qw_47`,"rst-table-header-sticky":`_rst-table-header-sticky_161qw_52`},QU={"rst-anchored-navigation":`_rst-anchored-navigation_9n3ru_1`,"rst-anchored-navigation-header":`_rst-anchored-navigation-header_9n3ru_12`,"rst-anchored-navigation-title":`_rst-anchored-navigation-title_9n3ru_19`,"rst-anchored-navigation-back":`_rst-anchored-navigation-back_9n3ru_25`,"rst-anchored-navigation-close":`_rst-anchored-navigation-close_9n3ru_29`,"rst-anchored-navigation-content":`_rst-anchored-navigation-content_9n3ru_33`},$U=({items:e,anchor:t,isOpen:n,onClose:r,onItemClick:i,width:a=320,initialTitle:o=``,isClosingOnSelect:s=!1,variant:c=`stack`,position:l,align:u})=>{let[f,p]=(0,d.useState)([{title:o,items:e}]),m=f[f.length-1],g=e=>{e.children&&p(t=>[...t,{title:e.label,items:e.children}])},_=()=>{p(e=>e.length>1?e.slice(0,-1):e)},v=e=>{if(c===`stack`&&e.children){g(e);return}c===`flyout`&&e.children||(i?.(e),s&&r?.())},y=e=>e.type===`separator`?(0,h.jsx)(fH.Separator,{},e.id):e.children&&e.children.length>0?(0,h.jsx)(fH.Submenu,{trigger:(0,h.jsx)(fH.Item,{label:e.label,leadingVisual:e.leadingVisual,disabled:e.disabled,shortcut:e.shortcut,children:e.children}),children:e.children.map(y)},e.id):(0,h.jsx)(fH.Item,{label:e.label,leadingVisual:e.leadingVisual,disabled:e.disabled,shortcut:e.shortcut,content:e.content,onClick:()=>v(e)},e.id),b=e=>e.type===`separator`?(0,h.jsx)(fH.Separator,{},e.id):(0,h.jsx)(fH.Item,{label:e.label,leadingVisual:e.leadingVisual,disabled:e.disabled,shortcut:e.shortcut,children:e.children,content:e.content,onClick:()=>v(e)},e.id),x=c===`stack`?m.title:o,S=c===`stack`&&f.length>1;return(0,h.jsx)(M,{isOpen:n,onClose:r,anchor:t,position:l,align:u,target:(0,h.jsxs)(`div`,{className:QU[`rst-anchored-navigation`],style:{width:a},role:`menu`,children:[(0,h.jsxs)(`div`,{className:QU[`rst-anchored-navigation-header`],children:[(0,h.jsx)(`div`,{className:QU[`rst-anchored-navigation-back`],children:S?(0,h.jsx)(D,{leadingVisual:`arrow-left`,variant:`invisible`,onClick:_,"aria-label":`Back`}):(0,h.jsx)(`div`,{style:{width:16}})}),(0,h.jsx)(`div`,{className:QU[`rst-anchored-navigation-title`],children:x}),(0,h.jsx)(`div`,{className:QU[`rst-anchored-navigation-close`],children:(0,h.jsx)(D,{leadingVisual:`close`,variant:`invisible`,onClick:r,"aria-label":`Close`})})]}),(0,h.jsx)(`div`,{className:QU[`rst-anchored-navigation-content`],children:c===`stack`?m.items.map(b):e.map(y)})]})})};function eW({columnId:e,isOpen:t,onClose:n,anchor:r}){let{state:i,setSorting:a,toggleColumnVisibility:o,setPinColumn:s}=RH();return(0,h.jsx)($U,{items:[{id:`pin`,label:`Pin Column`,leadingVisual:`pin`,children:[{id:`pin-left`,label:`Pin Left`,leadingVisual:`arrow-left-to-line`,onClick:()=>{s(e,`left`)}},{id:`pin-right`,label:`Pin Right`,leadingVisual:`arrow-right-to-line`,onClick:()=>{s(e,`right`)}},{id:`pin-none`,label:`No Pin`,leadingVisual:`pin-off`,onClick:()=>{s(e,!1)}}]},{id:`sort`,label:`Sort`,leadingVisual:`arrow-down-up`,children:[{id:`sort-asc`,label:`Ascending`,leadingVisual:`arrow-up-narrow-wide`,onClick:()=>{a([{id:e,desc:!1}])}},{id:`sort-desc`,label:`Descending`,leadingVisual:`arrow-down-wide-narrow`,onClick:()=>{a([{id:e,desc:!0}])}},{id:`sort-none`,label:`No Sort`,leadingVisual:`x`,onClick:()=>{a(i.sorting.filter(t=>t.id!==e))}}]},{id:`sep`,type:`separator`},{id:`hide`,label:`Hide Column`,leadingVisual:`eye-off`,onClick:()=>{o(e)}}],anchor:r,isOpen:t,onClose:n,isClosingOnSelect:!0,onItemClick:e=>{console.log(e),e.onClick?.(e)},variant:`flyout`,position:`center`,align:`bottom`,width:220})}function tW({columnOffsets:e,onGroupingChange:t}){let{columns:n,visibleColumns:r,state:i,setSorting:a,setGrouping:o,setColumnOrder:s,options:c,toggleAllSelection:l,getAllSelectionState:u}=RH(),{enableSorting:f,enableGrouping:p,stickyHeader:m,columnSizing:g=`auto`,enableSelection:_,enableColumnReorder:v}=c,[y,b]=(0,d.useState)(null),[x,S]=(0,d.useState)(null),C=(0,d.useRef)(null),w=(0,d.useRef)(null);(0,d.useLayoutEffect)(()=>{if(!m||!p)return;let e=w.current,t=C.current;if(!e||!t)return;let n=()=>{t.style.setProperty(`--rst-group-panel-row-height`,`${e.offsetHeight}px`)};n();let r=new ResizeObserver(n);return r.observe(e),()=>r.disconnect()},[m,p]);let E=_&&OH(e),O=e=>{if(f){let t=i.sorting,n=t.find(t=>t.id===e);n?n.desc?a(t.filter(t=>t.id!==e)):a([{id:e,desc:!0}]):a([{id:e,desc:!1}])}},k=e=>{o(e),t&&t(e)},j=(e,t)=>{e.dataTransfer.setData(`text/plain`,t),v&&(e.dataTransfer.setData(`application/x-restio-column-reorder`,t),e.dataTransfer.effectAllowed=`move`)},M=(e,t)=>{v&&e.dataTransfer.types.includes(`application/x-restio-column-reorder`)&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`move`,b(t))},N=(e,t)=>{if(!v)return;e.preventDefault(),e.stopPropagation(),b(null);let r=e.dataTransfer.getData(`application/x-restio-column-reorder`);if(!r||r===t)return;let a=n.map((e,t)=>xH(e,t)),o=i.columnOrder.length>0?[...i.columnOrder]:[...a],c=o.indexOf(r),l=o.indexOf(t);c===-1||l===-1||(o.splice(c,1),o.splice(l,0,r),s(o))},P=()=>b(null),F=e=>{let t=i.sorting.find(t=>t.id===e);return t?t.desc?(0,h.jsx)(D,{variant:`invisible`,leadingVisual:`arrow-up`}):(0,h.jsx)(D,{variant:`invisible`,leadingVisual:`arrow-down`}):(0,h.jsx)(D,{variant:`invisible`,leadingVisual:`arrow-down-up`})};return(0,h.jsxs)(`thead`,{ref:C,className:`${ZU[`rst-table-header`]} ${m?ZU[`rst-table-header-sticky`]:``}`,children:[p&&(0,h.jsx)(`tr`,{ref:w,children:(0,h.jsx)(`td`,{colSpan:r.length+ +!!_,style:{padding:0,borderBottom:`none`},children:(0,h.jsx)(XU,{grouping:i.grouping,columns:n,onGroupingChange:k})})}),(0,h.jsxs)(`tr`,{children:[_&&(0,h.jsx)(`th`,{className:[ZU[`rst-table-header-cell`],X[`rst-table-selection-cell`],E?ZU[`rst-table-header-cell-pinned`]:``].filter(Boolean).join(` `),style:E?{left:0}:void 0,children:(0,h.jsx)(`div`,{className:ZU[`rst-table-header-content`],children:(0,h.jsx)(A,{checked:u()===`checked`,indeterminate:u()===`indeterminate`,onChange:l,"aria-label":`Select all rows`})})}),r.map((t,n)=>{let r=xH(t,n),i=e[r],a=!!i&&i.left!==void 0,o=!!i&&i.right!==void 0,s=a||o,c=r===`__group__`,l=s?{left:i.left,right:i.right}:{};return(0,h.jsx)(`th`,{className:[ZU[`rst-table-header-cell`],s?ZU[`rst-table-header-cell-pinned`]:``,a?ZU[`rst-table-header-cell-pinned-left`]:``,o?ZU[`rst-table-header-cell-pinned-right`]:``,y===r?ZU[`rst-table-header-cell-drag-over`]:``].filter(Boolean).join(` `),style:{...g===`fixed`?{width:t.size,minWidth:t.minSize??t.size,maxWidth:t.maxSize}:{minWidth:t.minSize},...l},onClick:()=>!c&&t.enableSorting!==!1&&O(r),draggable:!c&&(p||v),onDragStart:e=>!c&&j(e,r),onDragOver:e=>!c&&M(e,r),onDrop:e=>!c&&N(e,r),onDragEnd:P,onContextMenu:e=>{c||(e.preventDefault(),S(r))},children:(0,h.jsx)(eW,{columnId:r,isOpen:x===r,onClose:()=>S(null),anchor:(0,h.jsxs)(`div`,{className:ZU[`rst-table-header-content`],children:[(0,h.jsx)(T,{variant:`title`,children:t.header||r}),f&&!c&&t.enableSorting!==!1&&(0,h.jsx)(`span`,{className:ZU[`rst-table-sort-icon`],children:F(r)})]})})},r)})]})]})}function nW(e){let t=[],n=new Map;return e.filter(e=>!e.isRowField).forEach(e=>{let r=`${e.columnFieldId??``}__${e.columnFieldValue??``}`;n.has(r)||(n.set(r,{label:e.label,cols:[]}),t.push(r)),n.get(r).cols.push(e)}),t.map(e=>({key:e,...n.get(e)}))}function rW(e,t,n){let r=n.find(e=>(e.id||String(e.accessorKey??``))===t);return r?r.accessorFn?r.accessorFn(e):r.accessorKey?e[r.accessorKey]:null:null}function iW(e,t){let n=t.find(t=>(t.id||String(t.accessorKey??``))===e);return n&&n.header?String(n.header):e}function aW(e,t,n){let{rowFields:r,columnFields:i,valueFields:a}=t,o=new Map;i.forEach(t=>{let r=new Set;e.forEach(e=>{let i=String(rW(e,t,n)??``);r.add(i)}),o.set(t,Array.from(r).sort())});let s=[];r.forEach(e=>{s.push({id:`row__${e}`,label:iW(e,n),isRowField:!0})}),i.length>0?i.forEach(e=>{(o.get(e)??[]).forEach(t=>{a.forEach(r=>{let i=r.label??`${iW(r.field,n)} (${r.aggregation})`;s.push({id:`pivot__${e}__${t}__${r.field}__${r.aggregation}`,label:t,subLabel:i,isRowField:!1,columnFieldValue:t,columnFieldId:e,valueField:r})})})}):a.forEach(e=>{let t=e.label??`${iW(e.field,n)} (${e.aggregation})`;s.push({id:`pivot__${e.field}__${e.aggregation}`,label:t,isRowField:!1,valueField:e})});let c=new Map;e.forEach(e=>{let t=r.map(t=>String(rW(e,t,n)??``)).join(`\0`);c.has(t)||c.set(t,[]),c.get(t).push(e)});let l=[],u=0;return(r.length>0?Array.from(c.entries()):[[`__all__`,e]]).forEach(([e,t])=>{let s={};if(r.length>0){let t=e.split(`\0`);r.forEach((e,n)=>{s[e]=t[n]??``})}let c={};r.forEach(e=>{c[`row__${e}`]=s[e]}),i.length>0?i.forEach(e=>{(o.get(e)??[]).forEach(r=>{let i=t.filter(t=>String(rW(t,e,n)??``)===r);a.forEach(t=>{let a=`pivot__${e}__${r}__${t.field}__${t.aggregation}`;c[a]=WU(t.aggregation===`count`?i.map(()=>1):i.map(e=>Number(rW(e,t.field,n))).filter(e=>!isNaN(e)),t.aggregation)})})}):a.forEach(e=>{let r=`pivot__${e.field}__${e.aggregation}`;c[r]=WU(e.aggregation===`count`?t.map(()=>1):t.map(t=>Number(rW(t,e.field,n))).filter(e=>!isNaN(e)),e.aggregation)}),l.push({id:`pivot-row-${u++}`,rowValues:s,cells:c})}),{columns:s,rows:l}}var oW=[`sum`,`count`,`avg`,`min`,`max`];function sW({columns:e,config:t,onConfigChange:n}){let[r,i]=(0,d.useState)(null),a=e=>e.id||(e.accessorKey?String(e.accessorKey):``),o=new Set([...t.rowFields,...t.columnFields,...t.valueFields.map(e=>e.field)]),s=e.map(a).filter(e=>e&&!o.has(e)),c=(e,t)=>{e.dataTransfer.setData(`application/x-pivot`,JSON.stringify(t)),e.dataTransfer.effectAllowed=`move`},l=e=>{try{return JSON.parse(e.dataTransfer.getData(`application/x-pivot`))}catch{return null}},u=(e,r)=>{e.preventDefault(),i(null);let a=l(e);if(!a)return;let{fieldId:o,fromZone:s}=a,c={...t,rowFields:[...t.rowFields],columnFields:[...t.columnFields],valueFields:[...t.valueFields]};s===`rows`&&(c.rowFields=c.rowFields.filter(e=>e!==o)),s===`columns`&&(c.columnFields=c.columnFields.filter(e=>e!==o)),s===`values`&&(c.valueFields=c.valueFields.filter(e=>e.field!==o)),r===`rows`&&!c.rowFields.includes(o)?c.rowFields.push(o):r===`columns`&&!c.columnFields.includes(o)?c.columnFields.push(o):r===`values`&&!c.valueFields.find(e=>e.field===o)&&c.valueFields.push({field:o,aggregation:`sum`}),n(c)},f=(e,r)=>{let i={...t};e===`rows`&&(i.rowFields=t.rowFields.filter(e=>e!==r)),e===`columns`&&(i.columnFields=t.columnFields.filter(e=>e!==r)),e===`values`&&(i.valueFields=t.valueFields.filter(e=>e.field!==r)),n(i)},p=(e,r)=>{n({...t,valueFields:t.valueFields.map(t=>t.field===e?{...t,aggregation:r}:t)})},m=e=>({onDragOver:t=>{t.preventDefault(),t.dataTransfer.dropEffect=`move`,i(e)},onDragLeave:()=>i(null),onDrop:t=>u(t,e)}),g=(t,n,i,a)=>(0,h.jsxs)(`div`,{className:`${X[`rst-pivot-zone`]} ${r===t?X[`rst-pivot-zone-active`]:``}`,...m(t),children:[(0,h.jsx)(`span`,{className:X[`rst-pivot-zone-title`],children:n}),(0,h.jsxs)(ZV,{direction:`row`,gap:1,align:`center`,wrap:!0,children:[i.length===0&&(0,h.jsx)(`span`,{className:X[`rst-pivot-zone-placeholder`],children:`Drop fields here`}),i.map(n=>{let r=a?.find(e=>e.field===n);return(0,h.jsxs)(`div`,{className:X[`rst-pivot-chip-wrapper`],children:[(0,h.jsx)(JU,{draggable:!0,onDragStart:e=>c(e,{fieldId:n,fromZone:t,valueAggregation:r?.aggregation}),onRemove:e=>{e.stopPropagation(),f(t,n)},children:iW(n,e)}),t===`values`&&r&&(0,h.jsx)(`select`,{className:X[`rst-pivot-agg-select`],value:r.aggregation,onChange:e=>p(n,e.target.value),onClick:e=>e.stopPropagation(),children:oW.map(e=>(0,h.jsx)(`option`,{value:e,children:e},e))})]},n)})]})]});return(0,h.jsxs)(`div`,{className:X[`rst-pivot-config-panel`],children:[(0,h.jsxs)(`div`,{className:X[`rst-pivot-available-fields`],children:[(0,h.jsx)(`span`,{className:X[`rst-pivot-zone-title`],children:`Fields`}),(0,h.jsxs)(ZV,{direction:`row`,gap:1,align:`center`,wrap:!0,children:[s.map(t=>(0,h.jsx)(JU,{draggable:!0,onDragStart:e=>c(e,{fieldId:t,fromZone:`available`}),children:iW(t,e)},t)),s.length===0&&(0,h.jsx)(`span`,{className:X[`rst-pivot-zone-placeholder`],children:`All fields assigned`})]})]}),(0,h.jsxs)(`div`,{className:X[`rst-pivot-zones`],children:[g(`rows`,`Rows`,t.rowFields),g(`columns`,`Columns`,t.columnFields),g(`values`,`Values`,t.valueFields.map(e=>e.field),t.valueFields)]})]})}function cW({pivotData:e,className:t}){let{columns:n,rows:r}=e,i=n.filter(e=>e.isRowField),a=n.filter(e=>!e.isRowField),o=a.some(e=>e.columnFieldId!==void 0),s=o?nW(n):[],c=[X[`rst-table-grid`],X[`rst-pivot-table`],t].filter(Boolean).join(` `);return(0,h.jsx)(`div`,{className:X[`rst-table-container`],children:(0,h.jsxs)(`table`,{className:c,children:[(0,h.jsx)(`thead`,{className:ZU[`rst-table-header`],children:o?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`tr`,{children:[i.map(e=>(0,h.jsx)(`th`,{rowSpan:2,className:`${ZU[`rst-table-header-cell`]} ${ZU[`rst-pivot-header-row-field`]}`,children:(0,h.jsx)(`div`,{className:ZU[`rst-table-header-content`],children:(0,h.jsx)(T,{variant:`title`,children:e.label})})},e.id)),s.map(e=>(0,h.jsx)(`th`,{colSpan:e.cols.length,className:`${ZU[`rst-table-header-cell`]} ${ZU[`rst-pivot-header-group`]}`,children:(0,h.jsx)(`div`,{className:ZU[`rst-table-header-content`],children:(0,h.jsx)(T,{variant:`title`,children:e.label})})},e.key))]}),(0,h.jsx)(`tr`,{children:a.map(e=>(0,h.jsx)(`th`,{className:`${ZU[`rst-table-header-cell`]} ${ZU[`rst-pivot-header-value`]}`,children:(0,h.jsx)(`div`,{className:ZU[`rst-table-header-content`],children:(0,h.jsx)(T,{variant:`title`,children:e.subLabel??e.label})})},e.id))})]}):(0,h.jsx)(`tr`,{children:n.map(e=>(0,h.jsx)(`th`,{className:[ZU[`rst-table-header-cell`],e.isRowField?ZU[`rst-pivot-header-row-field`]:X[`rst-pivot-header-value`]].filter(Boolean).join(` `),children:(0,h.jsx)(`div`,{className:ZU[`rst-table-header-content`],children:(0,h.jsx)(T,{variant:`title`,children:e.label})})},e.id))})}),(0,h.jsx)(`tbody`,{className:X[`rst-table-body`],children:r.length===0?(0,h.jsx)(`tr`,{children:(0,h.jsx)(`td`,{colSpan:n.length,className:X[`rst-pivot-empty`],children:`No data to display`})}):r.map(e=>(0,h.jsx)(`tr`,{className:X[`rst-table-row`],children:n.map(t=>{let n=e.cells[t.id];return(0,h.jsx)(`td`,{className:[X[`rst-table-cell`],t.isRowField?X[`rst-pivot-cell-row-field`]:X[`rst-pivot-cell-value`]].filter(Boolean).join(` `),children:(0,h.jsx)(`div`,{className:X[`rst-table-cell-wrapper`],children:GU(n)})},t.id)})},e.id))})]})})}function lW({enablePivot:e,enableFormula:t,enableColumnVisibility:n,enableAI:r,onPivotClick:i,onFormulaClick:a,onColumnVisibilityClick:o,onAIClick:s}){return(0,h.jsxs)(`div`,{className:X[`rst-table-sidebar`],children:[e&&(0,h.jsx)(D,{variant:`invisible`,size:`small`,leadingVisual:`groups`,title:`Pivot Mode`,onClick:i}),t&&(0,h.jsx)(D,{variant:`invisible`,size:`small`,leadingVisual:`pencil`,title:`Formula Builder`,onClick:a}),n&&(0,h.jsx)(D,{variant:`invisible`,size:`small`,leadingVisual:`columns`,title:`Column Visibility`,onClick:o}),r&&(0,h.jsx)(D,{variant:`invisible`,size:`small`,leadingVisual:`sparkle`,title:`AI Assistant`,onClick:s})]})}function uW({onSave:e,onCancel:t,existingColumns:n,sampleRow:r}){let[i,a]=(0,d.useState)(``),[o,s]=(0,d.useState)(``),[c,l]=(0,d.useState)(null),[u,f]=(0,d.useState)(null);return(0,d.useEffect)(()=>{if(!o||!r){l(null),f(null);return}let e=BU.validate(o);if(!e.valid){f(e.error??`Invalid formula`),l(null);return}let t=BU.evaluate(o,r);l(t===null?null:String(t)),f(null)},[o,r]),(0,h.jsxs)(ZV,{direction:`column`,gap:1,children:[(0,h.jsxs)(ZV,{direction:`column`,gap:1,children:[(0,h.jsx)(T,{variant:`label`,children:`Column Header`}),(0,h.jsx)(yV,{value:i,onChange:e=>a(e??``),placeholder:`e.g. Profit Margin`})]}),(0,h.jsxs)(ZV,{direction:`column`,gap:1,children:[(0,h.jsx)(T,{variant:`label`,children:`Formula`}),(0,h.jsx)(yV,{value:o,onChange:e=>s(e??``),placeholder:`e.g. (revenue - cost) / revenue`}),(0,h.jsxs)(T,{variant:`caption`,children:[`Available columns:`,` `,n.map(e=>e.id||e.accessorKey).filter(Boolean).join(`, `)]})]}),c!==null&&(0,h.jsxs)(`div`,{style:{padding:`8px`,background:`var(--rst-color-bg-subtle)`,borderRadius:`4px`},children:[(0,h.jsx)(`strong`,{children:`Preview:`}),` `,c]}),u&&(0,h.jsxs)(`div`,{style:{color:`var(--rst-color-fg-danger)`},children:[`Error: `,u]}),(0,h.jsxs)(ZV,{direction:`row`,gap:2,justify:`end`,children:[(0,h.jsx)(D,{variant:`invisible`,onClick:t,value:`cancel`}),(0,h.jsx)(D,{variant:`primary`,onClick:()=>{!i||!o||e({id:i.toLowerCase().replace(/\s+/g,`_`),header:i,formula:o,accessorKey:void 0})},disabled:!i||!o||!!u,value:`Add Column`})]})]})}function dW(e,t){let n=Math.min(t.length,20);for(let r=0;r<n;r++){let n=e.accessorFn?e.accessorFn(t[r]):e.accessorKey?t[r][e.accessorKey]:void 0;if(n!=null)return n}}function fW(e,t,n,r){let i=n.findIndex(e=>xH(e,n.indexOf(e))===t);if(i===-1)return e;let a=n[i],o=dW(a,r);if(typeof o==`boolean`)return typeof e==`boolean`?e:typeof e==`string`?e.toLowerCase()===`true`:!!e;if(o instanceof Date){if(e instanceof Date)return e;if(typeof e==`string`||typeof e==`number`){let t=new Date(e);if(!isNaN(t.getTime()))return t}return e}if(o===void 0){if(a.cellType===AU.NUMBER){let t=Number(e);return isNaN(t)?e:t}return a.options||a.cellType===AU.SELECT||a.cellType===AU.BUTTON_GROUP||a.cellType===AU.TEXT?String(e??``):e}return e}function pW(e,t,n){let r=n.find(e=>xH(e,n.indexOf(e))===t.column);if(!r)return!1;let i=VU(r,e),a=t.value;switch(t.operator){case`equals`:return String(i).toLowerCase()===String(a).toLowerCase();case`not_equals`:return String(i).toLowerCase()!==String(a).toLowerCase();case`contains`:return String(i).toLowerCase().includes(String(a).toLowerCase());case`greater_than`:return Number(i)>Number(a);case`less_than`:return Number(i)<Number(a);default:return!1}}function mW(){let{data:e,columns:t,getRows:n,setSorting:r,setGrouping:i,setColumnOrder:a,toggleColumnVisibility:o,updateCellValue:s,setSelectedRows:c,setPinColumn:l,addFormulaColumn:u,state:f}=RH();return{execute:(0,d.useCallback)(d=>{let p=[];for(let m of d)try{switch(m.tool){case`select_rows`:{let e=m.arguments,r=n(),i=new Set;for(let n of r)n.isGroup||e.conditions.every(e=>pW(n.data,e,t))&&i.add(n.id);c(i),p.push({tool:`select_rows`,success:!0,message:`Selected ${i.size} row(s)`});break}case`sort`:{let e=m.arguments;r([{id:e.column,desc:e.direction===`desc`}]),p.push({tool:`sort`,success:!0,message:`Sorted by "${e.column}" ${e.direction===`desc`?`descending`:`ascending`}`});break}case`column_visibility`:{let e=m.arguments,t=f.hiddenColumns.has(e.column);e.visible&&t?(o(e.column),p.push({tool:`column_visibility`,success:!0,message:`Column "${e.column}" is now visible`})):!e.visible&&!t?(o(e.column),p.push({tool:`column_visibility`,success:!0,message:`Column "${e.column}" is now hidden`})):p.push({tool:`column_visibility`,success:!0,message:`Column "${e.column}" already ${e.visible?`visible`:`hidden`}`});break}case`column_order`:{let e=m.arguments;a(e.order),p.push({tool:`column_order`,success:!0,message:`Columns reordered`});break}case`edit_cells`:{let n=m.arguments,r=0;for(let i of n.edits)if(i.rowIndex>=0&&i.rowIndex<e.length){let n=e[i.rowIndex],a=fW(i.value,i.column,t,e);s(n,i.column,a),r++}p.push({tool:`edit_cells`,success:!0,message:`Edited ${r} cell(s)`});break}case`group_by`:{let e=m.arguments;i(e.columns),p.push({tool:`group_by`,success:!0,message:e.columns.length>0?`Grouped by: ${e.columns.join(`, `)}`:`Grouping cleared`});break}case`pin_column`:{let e=m.arguments,t=e.side===`none`?!1:e.side;l(e.column,t),p.push({tool:`pin_column`,success:!0,message:e.side===`none`?`Column "${e.column}" unpinned`:`Column "${e.column}" pinned to the ${e.side}`});break}case`multi_sort`:{let e=m.arguments;r(e.sorts.map(e=>({id:e.column,desc:e.direction===`desc`})));let t=e.sorts.map(e=>`"${e.column}" ${e.direction}`).join(`, `);p.push({tool:`multi_sort`,success:!0,message:`Sorted by: ${t}`});break}case`clear_state`:r([]),i([]),c(new Set),a([]),p.push({tool:`clear_state`,success:!0,message:`Table state cleared`});break;case`create_formula`:{let e=m.arguments,t=BU.validate(e.formula);if(!t.valid){p.push({tool:`create_formula`,success:!1,message:`Invalid formula: ${t.error}`});break}if(!u){p.push({tool:`create_formula`,success:!1,message:`Formula builder is not enabled on this table`});break}u({id:e.header.toLowerCase().replace(/\s+/g,`_`),header:e.header,formula:e.formula,accessorKey:void 0}),p.push({tool:`create_formula`,success:!0,message:`Formula column "${e.header}" added`});break}case`fill_column_from_column`:{let n=m.arguments,r=0;for(let i of n.edits)if(i.rowIndex>=0&&i.rowIndex<e.length){let a=e[i.rowIndex],o=fW(i.value,n.targetColumn,t,e);s(a,n.targetColumn,o),r++}p.push({tool:`fill_column_from_column`,success:!0,message:`Filled ${r} row(s) in "${n.targetColumn}" based on "${n.sourceColumn}"`});break}default:p.push({tool:m.tool,success:!1,message:`Unknown tool "${m.tool}"`})}}catch(e){p.push({tool:m.tool,success:!1,message:e instanceof Error?e.message:`Unknown error`})}return p},[e,t,n,r,i,a,o,s,c,l,u,f.hiddenColumns])}}function hW(e){return e==null?`unknown`:typeof e==`boolean`?`boolean`:typeof e==`number`?`number`:e instanceof Date?`date`:typeof e==`string`?!isNaN(Date.parse(e))&&/^\d{4}-\d{2}-\d{2}/.test(e)?`date`:`string`:`unknown`}function gW(e){return e.options&&e.options.length>0?`string`:e.cellType===AU.NUMBER?`number`:(e.cellType===AU.TEXT||e.cellType===AU.SELECT||(e.cellType,AU.BUTTON_GROUP),`string`)}function _W(e,t){let n=Math.min(t.length,20);for(let r=0;r<n;r++){let n=t[r],i=e.accessorFn?e.accessorFn(n):e.accessorKey?n[e.accessorKey]:void 0;if(i!=null)return i}}function vW(e,t){return e.map(e=>{let n=e.id??(e.accessorKey?String(e.accessorKey):void 0);if(!n)return null;let r=typeof e.header==`string`?e.header:n,i=hW(_W(e,t));return{id:n,label:r,type:i===`unknown`?gW(e):i,...e.options&&e.options.length>0?{options:e.options.map(e=>e.value)}:{}}}).filter(e=>e!==null)}var yW=[{name:`select_rows`,description:`Select rows that match the given conditions. Each condition specifies a column, an operator, and a value. Multiple conditions are combined with AND logic.`,parameters:[{name:`conditions`,type:`array`,description:`Array of conditions. Each condition has: column (column id), operator (equals | not_equals | contains | greater_than | less_than), value (the value to compare against).`,required:!0}]},{name:`sort`,description:`Sort the table by a specific column in ascending or descending order.`,parameters:[{name:`column`,type:`string`,description:`The column id to sort by.`,required:!0},{name:`direction`,type:`string`,description:`Sort direction: 'asc' for ascending, 'desc' for descending.`,required:!0}]},{name:`column_visibility`,description:`Show or hide a specific column in the table.`,parameters:[{name:`column`,type:`string`,description:`The column id to show or hide.`,required:!0},{name:`visible`,type:`boolean`,description:`Set to true to show the column, false to hide it.`,required:!0}]},{name:`column_order`,description:`Reorder columns in the table by providing the desired column order as an array of column ids.`,parameters:[{name:`order`,type:`array`,description:`Array of column ids in the desired display order.`,required:!0}]},{name:`edit_cells`,description:`Edit one or more cell values in the table. Each edit specifies a row index, column id, and new value.`,parameters:[{name:`edits`,type:`array`,description:`Array of edits. Each edit has: rowIndex (0-based row number), column (column id), value (the new cell value).`,required:!0}]},{name:`group_by`,description:`Group table rows by one or more columns. Pass an empty array to remove all grouping.`,parameters:[{name:`columns`,type:`array`,description:`Array of column ids to group by, in order. Pass an empty array to clear grouping.`,required:!0}]},{name:`pin_column`,description:`Pin a column to the left or right side of the table, or unpin it.`,parameters:[{name:`column`,type:`string`,description:`The column id to pin or unpin.`,required:!0},{name:`side`,type:`string`,description:`Where to pin the column: 'left', 'right', or 'none' to unpin.`,required:!0}]},{name:`multi_sort`,description:`Sort the table by multiple columns at once, applying sorts in the given priority order.`,parameters:[{name:`sorts`,type:`array`,description:`Array of sort criteria in priority order. Each item has: column (column id), direction ('asc' or 'desc').`,required:!0}]},{name:`clear_state`,description:`Reset the table to its default state: clears sorting, grouping, row selection, and column order.`,parameters:[]},{name:`create_formula`,description:`Add a new computed column to the table by providing a header name and a formula expression. The formula can reference any column by its accessorKey (e.g. 'price * quantity', 'score / max_score * 100'). Supported operators: +, -, *, /, %, >, <, >=, <=, ==, !=, &&, ||, !.`,parameters:[{name:`header`,type:`string`,description:`The display name for the new formula column.`,required:!0},{name:`formula`,type:`string`,description:`The formula expression using column accessorKeys as variable names (e.g. 'revenue - cost', 'quantity * unit_price').`,required:!0}]},{name:`fill_column_from_column`,description:`Fill every cell in a target column with a value derived from another column. Read each row's sourceColumn value from the Table Data section and determine the best targetColumn value. For SELECT or BUTTON_GROUP columns, the value must match one of the column's valid options. Return ALL rows in the edits array.`,parameters:[{name:`targetColumn`,type:`string`,description:`The column id to fill with inferred values.`,required:!0},{name:`sourceColumn`,type:`string`,description:`The column id to read values from in order to infer the target value.`,required:!0},{name:`edits`,type:`array`,description:`Array of per-row assignments. Each entry has: rowIndex (0-based integer), value (the new value for that row's targetColumn).`,required:!0}]}];function bW(e,t){let n=e.toLowerCase(),r=t.find(e=>e.id.toLowerCase()===n);if(r)return r.id;let i=t.find(e=>e.label.toLowerCase()===n);return i?i.id:null}function xW(e){return{"=":`equals`,"==":`equals`,"===":`equals`,equals:`equals`,eq:`equals`,"!=":`not_equals`,"!==":`not_equals`,not_equals:`not_equals`,neq:`not_equals`,contains:`contains`,like:`contains`,">":`greater_than`,greater_than:`greater_than`,gt:`greater_than`,"<":`less_than`,less_than:`less_than`,lt:`less_than`}[e]??`equals`}function SW(e,t,n,r){let i=[],a=[];for(let o of e){let e=t.find(e=>e.name===o.tool);if(!e){a.push(`Unknown tool "${o.tool}"`);continue}let s=e.parameters.filter(e=>e.required&&!(e.name in o.arguments));if(s.length>0){a.push(`Tool "${o.tool}" missing required parameters: ${s.map(e=>e.name).join(`, `)}`);continue}if(r){let e=r(o,n);if(e.errors.length>0){a.push(...e.errors);continue}e.resolved&&i.push(e.resolved)}else i.push(o)}return{valid:i,errors:a}}function CW(e,t){let n=[],r=[];for(let i of e){if(typeof i!=`object`||!i){r.push(`Invalid condition: expected an object`);continue}let e=i,a=String(e.column??``),o=bW(a,t);if(!o){r.push(`Unknown column "${a}"`);continue}n.push({column:o,operator:xW(String(e.operator??`equals`)),value:e.value})}return{resolved:n,errors:r}}function wW(e,t){let n={...e,arguments:{...e.arguments}},r=[];switch(e.tool){case`select_rows`:{let r=e.arguments.conditions;if(!Array.isArray(r))return{resolved:null,errors:[`Tool "select_rows" requires "conditions" to be an array`]};let i=CW(r,t);if(i.errors.length>0)return{resolved:null,errors:i.errors};n.arguments={conditions:i.resolved};break}case`sort`:{let r=String(e.arguments.column??``),i=bW(r,t);if(!i)return{resolved:null,errors:[`Sort: unknown column "${r}"`]};n.arguments={...e.arguments,column:i};break}case`column_visibility`:{let r=String(e.arguments.column??``),i=bW(r,t);if(!i)return{resolved:null,errors:[`Column visibility: unknown column "${r}"`]};n.arguments={...e.arguments,column:i};break}case`column_order`:{let r=e.arguments.order;if(!Array.isArray(r))return{resolved:null,errors:[`Tool "column_order" requires "order" to be an array`]};n.arguments={order:r.map(e=>bW(String(e),t)??String(e))};break}case`edit_cells`:{let r=e.arguments.edits;if(!Array.isArray(r))return{resolved:null,errors:[`Tool "edit_cells" requires "edits" to be an array`]};let i=[];for(let e of r){let n=e,r=String(n.column??``),a=bW(r,t);if(!a)return{resolved:null,errors:[`Edit: unknown column "${r}"`]};i.push({...n,column:a})}n.arguments={edits:i};break}case`group_by`:{let r=e.arguments.columns;if(!Array.isArray(r))return{resolved:null,errors:[`Tool "group_by" requires "columns" to be an array`]};let i=[];for(let e of r){let n=bW(String(e),t);if(!n)return{resolved:null,errors:[`Group by: unknown column "${e}"`]};i.push(n)}n.arguments={columns:i};break}case`pin_column`:{let r=String(e.arguments.column??``),i=bW(r,t);if(!i)return{resolved:null,errors:[`Pin column: unknown column "${r}"`]};n.arguments={...e.arguments,column:i};break}case`multi_sort`:{let r=e.arguments.sorts;if(!Array.isArray(r))return{resolved:null,errors:[`Tool "multi_sort" requires "sorts" to be an array`]};let i=[];for(let e of r){let n=e,r=String(n.column??``),a=bW(r,t);if(!a)return{resolved:null,errors:[`Multi sort: unknown column "${r}"`]};i.push({...n,column:a})}n.arguments={sorts:i};break}case`clear_state`:break;case`create_formula`:if(typeof e.arguments.header!=`string`||!e.arguments.header)return{resolved:null,errors:[`Tool "create_formula" requires a non-empty "header" string`]};if(typeof e.arguments.formula!=`string`||!e.arguments.formula)return{resolved:null,errors:[`Tool "create_formula" requires a non-empty "formula" string`]};break;case`fill_column_from_column`:{let r=String(e.arguments.targetColumn??``),i=String(e.arguments.sourceColumn??``),a=bW(r,t);if(!a)return{resolved:null,errors:[`Fill column: unknown target column "${r}"`]};let o=bW(i,t);if(!o)return{resolved:null,errors:[`Fill column: unknown source column "${i}"`]};let s=e.arguments.edits;if(!Array.isArray(s))return{resolved:null,errors:[`Tool "fill_column_from_column" requires "edits" to be an array`]};n.arguments={...e.arguments,targetColumn:a,sourceColumn:o};break}}return{resolved:n,errors:r}}function TW(e,t){return SW(e,yW,t,wW)}var EW={"rst-textareaField-wrapper":`_rst-textareaField-wrapper_lahxa_1`,"rst-textarea-wrapper":`_rst-textarea-wrapper_lahxa_23`,"rst-textarea-small":`_rst-textarea-small_lahxa_29`,"rst-textarea-default":`_rst-textarea-default_lahxa_34`,"rst-textarea-large":`_rst-textarea-large_lahxa_39`,"rst-textarea":`_rst-textarea_lahxa_1`},DW=({value:e,onChange:t,onKeyDown:n,label:r,helperText:i,placeholder:a,ariaLabel:o,ref:s,disabled:c,size:l,rows:u=3})=>{let f=(0,d.useId)(),p=`${f}-helper`,m={fieldWrapper:EW[`rst-textareaField-wrapper`],textareaWrapper:`${EW[`rst-textarea-wrapper`]} ${l?EW[`rst-textarea-${l}`]:``}`,textarea:EW[`rst-textarea`]};return(0,h.jsxs)(`div`,{className:m.fieldWrapper,children:[r&&(0,h.jsx)(PV,{label:r,id:f,disabled:c}),(0,h.jsx)(`textarea`,{id:f,value:e,className:m.textarea,placeholder:a,onChange:e=>{t?.(e.target.value)},onKeyDown:n,"aria-label":o,"aria-describedby":i?p:void 0,ref:s,disabled:c,rows:u}),i&&(0,h.jsx)(FU,{helperText:i,id:p,disabled:c})]})},OW={"rst-chat-container":`_rst-chat-container_sqjcv_1`,"rst-chat-messages":`_rst-chat-messages_sqjcv_7`,"rst-chat-message":`_rst-chat-message_sqjcv_7`,"rst-chat-message-user":`_rst-chat-message-user_sqjcv_22`,"rst-chat-message-assistant":`_rst-chat-message-assistant_sqjcv_26`,"rst-chat-bubble":`_rst-chat-bubble_sqjcv_30`,"rst-chat-bubble-user":`_rst-chat-bubble-user_sqjcv_38`,"rst-chat-bubble-assistant":`_rst-chat-bubble-assistant_sqjcv_42`,"rst-chat-tool-calls":`_rst-chat-tool-calls_sqjcv_46`,"rst-chat-tool-call":`_rst-chat-tool-call_sqjcv_46`,"rst-chat-tool-call-success":`_rst-chat-tool-call-success_sqjcv_65`,"rst-chat-tool-call-error":`_rst-chat-tool-call-error_sqjcv_69`,"rst-chat-input-form":`_rst-chat-input-form_sqjcv_73`,"rst-chat-actions":`_rst-chat-actions_sqjcv_87`,"rst-chat-input-wrapper":`_rst-chat-input-wrapper_sqjcv_100`,"rst-chat-empty":`_rst-chat-empty_sqjcv_107`,"rst-chat-processing":`_rst-chat-processing_sqjcv_118`,"rst-chat-confirmation":`_rst-chat-confirmation_sqjcv_127`,"rst-chat-confirmation-actions":`_rst-chat-confirmation-actions_sqjcv_134`,"rst-chat-tool-call-pending":`_rst-chat-tool-call-pending_sqjcv_139`,"rst-chat-quick-actions":`_rst-chat-quick-actions_sqjcv_145`,"rst-chat-quick-action":`_rst-chat-quick-action_sqjcv_145`};function kW({messages:e,isProcessing:t,emptyStateText:n=`Ask me something...`,inputValue:r,onInputChange:i,onKeyDown:a,onSubmit:o,onConfirm:s,onReject:c,quickActions:l,onQuickAction:u}){let f=(0,d.useRef)(null),p=e.some(e=>e.status===`pending`);return(0,d.useEffect)(()=>{f.current?.scrollIntoView({behavior:`smooth`})},[e]),(0,h.jsxs)(`div`,{className:OW[`rst-chat-container`],children:[e.length===0?(0,h.jsx)(`div`,{className:OW[`rst-chat-empty`],children:n}):(0,h.jsxs)(`div`,{className:OW[`rst-chat-messages`],children:[e.map(e=>(0,h.jsxs)(`div`,{className:`${OW[`rst-chat-message`]} ${OW[`rst-chat-message-${e.role}`]}`,children:[(0,h.jsx)(`div`,{className:`${OW[`rst-chat-bubble`]} ${OW[`rst-chat-bubble-${e.role}`]}`,children:e.content}),e.status===`pending`&&e.toolCalls&&e.toolCalls.length>0&&(0,h.jsxs)(`div`,{className:OW[`rst-chat-confirmation`],children:[(0,h.jsx)(`div`,{className:OW[`rst-chat-tool-calls`],children:e.toolCalls.map((e,t)=>(0,h.jsxs)(`div`,{className:`${OW[`rst-chat-tool-call`]} ${OW[`rst-chat-tool-call-pending`]}`,children:[(0,h.jsx)(`span`,{children:`◷`}),(0,h.jsx)(`span`,{children:e.tool.replace(/_/g,` `)})]},t))}),(0,h.jsxs)(`div`,{className:OW[`rst-chat-confirmation-actions`],children:[(0,h.jsx)(D,{variant:`primary`,value:`Apply`,onClick:()=>s?.()}),(0,h.jsx)(D,{variant:`invisible`,value:`Discard`,onClick:()=>c?.()})]})]}),e.status!==`pending`&&e.executionResults&&e.executionResults.length>0&&(0,h.jsx)(`div`,{className:OW[`rst-chat-tool-calls`],children:e.executionResults.map((e,t)=>(0,h.jsxs)(`div`,{className:`${OW[`rst-chat-tool-call`]} ${e.success?OW[`rst-chat-tool-call-success`]:OW[`rst-chat-tool-call-error`]}`,children:[(0,h.jsx)(`span`,{children:e.success?`✓`:`✗`}),(0,h.jsx)(`span`,{children:e.message})]},t))})]},e.id)),t&&(0,h.jsx)(`div`,{className:OW[`rst-chat-processing`],children:(0,h.jsx)(`span`,{children:`Processing...`})}),(0,h.jsx)(`div`,{ref:f})]}),(0,h.jsxs)(`form`,{className:OW[`rst-chat-input-form`],onSubmit:o,children:[l&&l.length>0&&(0,h.jsx)(`div`,{className:OW[`rst-chat-quick-actions`],children:l.map((e,n)=>(0,h.jsx)(`button`,{type:`button`,className:OW[`rst-chat-quick-action`],disabled:t||!!p,onClick:()=>u?.(e.prompt),children:e.label},n))}),(0,h.jsx)(`div`,{className:OW[`rst-chat-input-wrapper`],children:(0,h.jsx)(DW,{value:r,onChange:i,onKeyDown:a,placeholder:`Ask something...`,disabled:t||p,rows:1})}),(0,h.jsxs)(`div`,{className:OW[`rst-chat-actions`],children:[(0,h.jsx)(D,{variant:`invisible`,disabled:!0,leadingVisual:`plus`,value:`Add files`}),(0,h.jsx)(D,{variant:`primary`,type:`submit`,disabled:t||!r.trim()||p,leadingVisual:`send`})]})]})]})}function AW({aiProvider:e,toolDefinitions:t,schema:n,tableContext:r,onExecute:i,onValidate:a,emptyStateText:o,requiresConfirmation:s,quickActions:c}){let[l,u]=(0,d.useState)([]),[f,p]=(0,d.useState)(``),[m,g]=(0,d.useState)(!1),[_,v]=(0,d.useState)(null),y=(0,d.useCallback)(async o=>{if(!o||m||_)return;let c={id:`msg-${Date.now()}`,role:`user`,content:o,timestamp:new Date().toISOString()};u(e=>[...e,c]),g(!0);try{let c=await e.processMessage(o,n,t,r),l=c.toolCalls,d=[];if(a){let e=a(c.toolCalls,n);l=e.valid,d=e.errors}if(s&&l.length>0){let e=`msg-${Date.now()+1}`,t={id:e,role:`assistant`,content:c.message,toolCalls:l,status:`pending`,timestamp:new Date().toISOString()};u(e=>[...e,t]),v({messageId:e,validCalls:l,validationErrors:d})}else{let e=[];l.length>0&&(e=i(l)),d.length>0&&(e=[...e,...d.map(e=>({tool:`validation`,success:!1,message:e}))]);let t={id:`msg-${Date.now()+1}`,role:`assistant`,content:c.message,toolCalls:l,executionResults:e,timestamp:new Date().toISOString()};u(e=>[...e,t])}}catch(e){let t={id:`msg-${Date.now()+1}`,role:`assistant`,content:e instanceof Error?e.message:`An error occurred while processing your request.`,timestamp:new Date().toISOString()};u(e=>[...e,t])}finally{g(!1)}},[m,_,e,n,r,t,i,a,s]),b=(0,d.useCallback)(async e=>{e?.preventDefault();let t=f.trim();t&&(p(``),await y(t))},[f,y]),x=(0,d.useCallback)(async e=>{await y(e)},[y]),S=(0,d.useCallback)(()=>{if(!_)return;let e=i(_.validCalls),t=_.validationErrors.length>0?[...e,..._.validationErrors.map(e=>({tool:`validation`,success:!1,message:e}))]:e;u(e=>e.map(e=>e.id===_.messageId?{...e,status:`confirmed`,executionResults:t}:e)),v(null)},[_,i]),C=(0,d.useCallback)(()=>{_&&(u(e=>e.map(e=>e.id===_.messageId?{...e,status:`rejected`,executionResults:[{tool:`confirmation`,success:!1,message:`Discarded by user`}]}:e)),v(null))},[_]);return(0,h.jsx)(kW,{messages:l,isProcessing:m,emptyStateText:o,inputValue:f,onInputChange:p,onKeyDown:(0,d.useCallback)(e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),b())},[b]),onSubmit:b,onConfirm:_?S:void 0,onReject:_?C:void 0,quickActions:c,onQuickAction:x})}function jW({aiProvider:e,requiresConfirmation:t,quickActions:n}){let{data:r,columns:i,state:a}=RH(),{execute:o}=mW();return(0,h.jsx)(AW,{aiProvider:e,toolDefinitions:yW,schema:(0,d.useMemo)(()=>vW(i,r),[i,r]),tableContext:(0,d.useMemo)(()=>{let e={};for(let[t,n]of Object.entries(a.columnPinning))(n===`left`||n===`right`)&&(e[t]=n);return{rows:r,sorting:a.sorting.map(e=>({column:e.id,direction:e.desc?`desc`:`asc`})),grouping:a.grouping,selectedRowIds:Array.from(a.selectedRows),hiddenColumnIds:Array.from(a.hiddenColumns),columnOrder:a.columnOrder,columnPinning:Object.keys(e).length>0?e:void 0}},[r,a]),onExecute:o,onValidate:(0,d.useCallback)((e,t)=>TW(e,t),[]),emptyStateText:`Ask me to sort, select rows, hide columns, reorder columns, edit cells, or fill a column based on another.`,requiresConfirmation:t,quickActions:n})}var MW=5;function NW({className:e,virtualizedRowHeight:t=40,virtualizedContainerHeight:n=400,onGroupingChange:r,onRowClick:i,loading:a=!1}){let{visibleColumns:o,getRows:s,options:c,state:l}=RH(),{enableEditing:u=!1,enableVirtualization:f=!0,columnSizing:p=`auto`}=c,m=s(),g=(0,d.useMemo)(()=>DH(o,l.columnPinning,c.enableSelection??!1),[o,l.columnPinning,c.enableSelection]),{virtualItems:_,containerProps:v,scrollInfo:y}=fV({items:f?m:[],itemHeight:t,containerHeight:n,overscan:5}),b=_.length>0?_[0].offsetTop:0,x=y.totalHeight-(b+_.length*t),S=[X[`rst-table-grid`],p===`fixed`?X[`rst-table-grid-fixed`]:``,e].filter(Boolean).join(` `),C=f?{...v,className:X[`rst-table-container`],style:v.style}:{className:X[`rst-table-container`]},w=o.length+ +!!c.enableSelection;return a?(0,h.jsx)(`div`,{...C,children:(0,h.jsxs)(`table`,{className:S,children:[(0,h.jsx)(tW,{columnOffsets:g,onGroupingChange:r}),(0,h.jsx)(`tbody`,{className:X[`rst-table-body`],children:Array.from({length:MW}).map((e,t)=>(0,h.jsxs)(`tr`,{className:X[`rst-table-skeleton-row`],children:[c.enableSelection&&(0,h.jsx)(`td`,{className:X[`rst-table-skeleton-cell`],children:(0,h.jsx)(LV,{width:`16px`,height:`16px`})}),o.map((e,t)=>(0,h.jsx)(`td`,{className:X[`rst-table-skeleton-cell`],children:(0,h.jsx)(LV,{width:t===0?`60%`:`80%`,height:`14px`})},xH(e,t)))]},t))})]})}):(0,h.jsx)(`div`,{...C,children:(0,h.jsxs)(`table`,{className:S,children:[(0,h.jsx)(tW,{columnOffsets:g,onGroupingChange:r}),(0,h.jsxs)(`tbody`,{className:X[`rst-table-body`],children:[f&&b>0&&(0,h.jsx)(`tr`,{style:{height:b},children:(0,h.jsx)(`td`,{colSpan:o.length,style:{padding:0,border:0}})}),f?_.map(({item:e,index:t})=>(0,h.jsx)(UU,{row:e,onRowClick:i,isEnableEditing:u,"aria-rowindex":t+1,columnOffsets:g},e.id)):m.map((e,t)=>(0,h.jsx)(UU,{row:e,onRowClick:i,isEnableEditing:u,"aria-rowindex":t+1,columnOffsets:g},e.id)),f&&x>0&&(0,h.jsx)(`tr`,{style:{height:x},children:(0,h.jsx)(`td`,{colSpan:o.length,style:{padding:0,border:0}})}),(!f&&m.length===0||f&&_.length===0)&&(0,h.jsx)(`tr`,{children:(0,h.jsx)(`td`,{colSpan:w,className:X[`rst-table-empty-state`],children:(0,h.jsx)(`span`,{className:X[`rst-table-empty-state-label`],children:`No data available`})})})]}),(0,h.jsx)(KU,{columnOffsets:g})]})})}function PW({enablePivot:e,enableFormulaBuilder:t,pivotConfig:n,onPivotConfigChange:r,onFormulaColumnAdd:i,aiProvider:a,requiresConfirmation:o,aiQuickActions:s,className:c,virtualizedRowHeight:l,virtualizedContainerHeight:u,onGroupingChange:f,onRowClick:p,loading:m}){let{data:g,columns:_,state:v,options:y,toggleColumnVisibility:b}=RH(),{enableColumnVisibility:x,enableAIAssistant:S}=y,[C,w]=(0,d.useState)(!1),[T,E]=(0,d.useState)(null),[O,k]=(0,d.useState)(n??{rowFields:[],columnFields:[],valueFields:[]});(0,d.useEffect)(()=>{n&&k(n)},[n]);let j=e||t||x||S&&a,M=()=>{let e=!C;w(e),E(e?`pivot`:null)},N=()=>{E(e=>e===`formula`?null:`formula`)},P=()=>{E(e=>e===`columns`?null:`columns`)},F=()=>{E(e=>e===`ai`?null:`ai`)},ee=(0,d.useCallback)(e=>{k(e),r?.(e)},[r]),te=O.valueFields.length>0||O.rowFields.length>0||O.columnFields.length>0,ne=(0,d.useMemo)(()=>!C||!te?null:aW(g,O,_),[g,O,_,C,te]);return(0,h.jsxs)(`div`,{className:X[`rst-table-outer`],children:[(0,h.jsx)(`div`,{className:X[`rst-table-outer-content`],children:C?ne?(0,h.jsx)(cW,{pivotData:ne}):(0,h.jsx)(`div`,{className:X[`rst-pivot-empty`],children:`Configure the pivot: drag fields to Rows, Columns, or Values in the panel.`}):(0,h.jsx)(NW,{className:c,virtualizedRowHeight:l,virtualizedContainerHeight:u,onGroupingChange:f,onRowClick:p,loading:m})}),j&&(0,h.jsx)(lW,{enablePivot:e,enableFormula:t,enableColumnVisibility:x,enableAI:!!S&&!!a,isPivotMode:C,activeTool:T,onPivotClick:M,onFormulaClick:N,onColumnVisibilityClick:P,onAIClick:F}),T===`pivot`&&(0,h.jsxs)(`div`,{className:X[`rst-table-tool-panel`],children:[(0,h.jsxs)(`div`,{className:X[`rst-table-tool-panel-header`],children:[(0,h.jsx)(`span`,{className:X[`rst-table-tool-panel-title`],children:`Pivot`}),(0,h.jsx)(D,{variant:`invisible`,size:`small`,leadingVisual:`close`,onClick:()=>E(null)})]}),(0,h.jsx)(`div`,{className:X[`rst-table-tool-panel-body`],children:(0,h.jsx)(sW,{columns:_,config:O,onConfigChange:ee})})]}),T===`formula`&&(0,h.jsxs)(`div`,{className:X[`rst-table-tool-panel`],children:[(0,h.jsxs)(`div`,{className:X[`rst-table-tool-panel-header`],children:[(0,h.jsx)(`span`,{className:X[`rst-table-tool-panel-title`],children:`Formula Builder`}),(0,h.jsx)(D,{variant:`invisible`,size:`small`,leadingVisual:`close`,onClick:()=>E(null)})]}),(0,h.jsx)(`div`,{className:X[`rst-table-tool-panel-body`],children:(0,h.jsx)(uW,{existingColumns:_,sampleRow:g[0],onSave:e=>{i?.(e),E(null)},onCancel:()=>E(null)})})]}),T===`columns`&&(0,h.jsxs)(`div`,{className:X[`rst-table-tool-panel`],children:[(0,h.jsxs)(`div`,{className:X[`rst-table-tool-panel-header`],children:[(0,h.jsx)(`span`,{className:X[`rst-table-tool-panel-title`],children:`Columns`}),(0,h.jsx)(D,{variant:`invisible`,size:`small`,leadingVisual:`close`,onClick:()=>E(null)})]}),(0,h.jsx)(`div`,{className:X[`rst-table-tool-panel-body`],children:(0,h.jsx)(`div`,{className:X[`rst-column-visibility-list`],children:_.map((e,t)=>{let n=e.id??e.accessorKey??String(t),r=typeof e.header==`string`?e.header:n,i=v.hiddenColumns.has(n);return(0,h.jsxs)(`label`,{className:X[`rst-column-visibility-item`],children:[(0,h.jsx)(A,{checked:!i,onChange:()=>b(n),"aria-label":r}),(0,h.jsx)(`span`,{className:X[`rst-column-visibility-label`],children:r})]},n)})})})]}),T===`ai`&&a&&(0,h.jsxs)(`div`,{className:X[`rst-table-tool-panel`],children:[(0,h.jsxs)(`div`,{className:X[`rst-table-tool-panel-header`],children:[(0,h.jsx)(`span`,{className:X[`rst-table-tool-panel-title`],children:`AI Assistant`}),(0,h.jsx)(D,{variant:`invisible`,size:`small`,leadingVisual:`close`,onClick:()=>E(null)})]}),(0,h.jsx)(`div`,{className:X[`rst-table-tool-panel-body`],children:(0,h.jsx)(jW,{aiProvider:a,requiresConfirmation:o,quickActions:s})})]})]})}function FW({data:e,columns:t,getSubRows:n,onDataChange:r,onSelectionChange:i,enableSorting:a,enableSelection:o,enableEditing:s,enableGrouping:c,enableVirtualization:l,stickyHeader:u,stickyFooter:f,columnSizing:p,enableColumnReorder:m,enableColumnVisibility:g,enableAIAssistant:_,aiProvider:v,onFormulaColumnAdd:y,loading:b,...x}){let S={enableSorting:a,enableSelection:o,enableEditing:s,enableGrouping:c,enableVirtualization:l,stickyHeader:u,stickyFooter:f,columnSizing:p,enableColumnReorder:m,enableColumnVisibility:g,enableAIAssistant:_},C=e[0]?Object.keys(e[0]):[],w=t||mH(C),[T,E]=(0,d.useState)([]),D=(0,d.useMemo)(()=>[...w,...T],[w,T]),O=(0,d.useCallback)(e=>{E(t=>[...t,e]),y?.(e)},[y]);return(0,h.jsx)(IH,{initialData:e,columns:D,getSubRows:n,onDataChange:r,onSelectionChange:i,options:S,addFormulaColumn:O,children:(0,h.jsx)(PW,{...x,loading:b,onFormulaColumnAdd:O,aiProvider:v})})}function IW(e,t,n){let r=e.map(e=>{let t=` - id: "${e.id}", label: "${e.label}", type: ${e.type}`;return e.options&&e.options.length>0&&(t+=`, options: [${e.options.map(e=>`"${e}"`).join(`, `)}]`),t}).join(`
73
+ `,e[0].empty=!0)},nV=(e,t)=>{let n=e.length;return n>0&&e[n-1]===t?e:e.concat(t)},rV=e=>{let t=[[]],n=[e],r=[0],i=[e.length],a=0,o=0,s=[],c=[s];for(;o>-1;){for(;(a=r[o]++)<i[o];){let e,l=t[o],u=n[o][a];if(typeof u==`string`?(l=o>0?l:[`plain`],e=u):(l=nV(l,u.type),u.alias&&(l=nV(l,u.alias)),e=u.content),typeof e!=`string`){o++,t.push(l),n.push(e),r.push(0),i.push(e.length);continue}let d=e.split(eV),f=d.length;s.push({types:l,content:d[0]});for(let e=1;e<f;e++)tV(s),c.push(s=[]),s.push({types:l,content:d[e]})}o--,t.pop(),n.pop(),r.pop(),i.pop()}return tV(s),c},iV=({prism:e,code:t,grammar:n,language:r})=>(0,d.useMemo)(()=>{if(n==null)return rV([t]);let i={code:t,grammar:n,language:r,tokens:[]};return e.hooks.run(`before-tokenize`,i),i.tokens=e.tokenize(t,n),e.hooks.run(`after-tokenize`,i),rV(i.tokens)},[t,n,r,e]),aV=(e,t)=>{let{plain:n}=e,r=e.styles.reduce((e,n)=>{let{languages:r,style:i}=n;return r&&!r.includes(t)||n.types.forEach(t=>{e[t]=wB(wB({},e[t]),i)}),e},{});return r.root=n,r.plain=TB(wB({},n),{backgroundColor:void 0}),r},oV=({children:e,language:t,code:n,theme:r,prism:i})=>{let a=t.toLowerCase(),o=aV(r,a),s=QB(o),c=$B(o),l=i.languages[a];return e({tokens:iV({prism:i,language:a,code:n,grammar:l}),className:`prism-code language-${a}`,style:o==null?{}:o.root,getLineProps:s,getTokenProps:c})},sV=e=>(0,d.createElement)(oV,TB(wB({},e),{prism:e.prism||Y,theme:e.theme||WB,code:e.code,language:e.language})),cV={"rst-codeblock":`_rst-codeblock_kcxwg_1`},lV=({children:e,className:t})=>{let n=t?.replace(/language-/,``)||`javascript`,r=[cV[`rst-codeblock`]].filter(Boolean).join(` `);return(0,h.jsx)(sV,{code:e.trim(),language:n,theme:AB.github,children:({className:e,style:t,tokens:n,getLineProps:i,getTokenProps:a})=>(0,h.jsx)(`pre`,{className:`${e} ${r}`,style:t,children:n.map((e,t)=>(0,h.jsx)(`div`,{...i({line:e}),children:e.map((e,t)=>(0,h.jsx)(`span`,{...a({token:e})},t))},t))})})},uV={h1:({children:e})=>(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(T,{variant:`display`,children:e}),(0,h.jsx)(`hr`,{})]}),h2:({children:e})=>(0,h.jsx)(T,{id:fB(String(e)),variant:`heading`,children:e}),h3:({children:e})=>(0,h.jsx)(T,{variant:`title`,children:e}),h4:({children:e})=>(0,h.jsx)(T,{variant:`subtitle`,children:e}),p:({children:e})=>(0,h.jsx)(T,{variant:`body`,children:e}),pre:({children:e})=>{let t=e;return(0,h.jsx)(lV,{className:t.props.className,children:String(t.props.children)})},code:({children:e})=>(0,h.jsx)(T,{variant:`code`,children:e}),ol:({children:e})=>(0,h.jsx)(`ol`,{children:e}),li:({children:e})=>(0,h.jsx)(`li`,{children:(0,h.jsx)(T,{variant:`body`,children:e})}),img:({src:e,alt:t})=>(0,h.jsxs)(`figure`,{children:[(0,h.jsx)(`img`,{src:e??``,alt:t??``,style:{maxWidth:`100%`}}),t&&(0,h.jsx)(`figcaption`,{children:(0,h.jsx)(T,{variant:`label`,children:t})})]}),Graph:Qz,Tag:E,Banner:O},dV=({content:e})=>e?(0,h.jsx)(dB,{components:uV,children:(0,h.jsx)(e,{components:uV})}):null,fV={"rst-list":`_rst-list_19ihv_1`,"rst-list-virtualScroll":`_rst-list-virtualScroll_19ihv_11`,"rst-list-input":`_rst-list-input_19ihv_15`,"rst-list-container":`_rst-list-container_19ihv_20`,"rst-list-listItem":`_rst-list-listItem_19ihv_25`,"rst-list-noElements":`_rst-list-noElements_19ihv_55`};function pV(e,t){if(!t)return e;let n=e.toLowerCase(),r=t.toLowerCase(),i=n.indexOf(r);if(i===-1)return e;let a=e.slice(0,i),o=e.slice(i,i+t.length),s=e.slice(i+t.length);return(0,h.jsxs)(`span`,{children:[a,(0,h.jsx)(`strong`,{children:o}),s]})}var mV=(e,t)=>{let n=e.filter(e=>e.value.toLowerCase().includes(t.toLowerCase())),r=n.some(e=>e.value.toLowerCase()===t.toLowerCase());return{filteredOptions:n,fullOptions:n,showCreateItem:!!(t&&!r)}},hV=({e,localSelectedIndex:t,setLocalSelectedIndex:n,filteredOptions:r,fullOptions:i,onClick:a,onKeyDown:o})=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let i=t;e.key===`ArrowDown`?i=t<r.length-1?t+1:0:e.key===`ArrowUp`&&(i=t>0?t-1:r.length-1),n(i)}else if(e.key===`Enter`){let e=i[t];a?.(e)}o?.(e)},gV={"rst-inputField-wrapper":`_rst-inputField-wrapper_whc7v_1`,"rst-input-wrapper":`_rst-input-wrapper_whc7v_7`,"rst-input-small":`_rst-input-small_whc7v_23`,"rst-input-default":`_rst-input-default_whc7v_28`,"rst-input-large":`_rst-input-large_whc7v_33`,"rst-input":`_rst-input_whc7v_1`,"rst-input-error":`_rst-input-error_whc7v_56`},_V=({error:e,disabled:t,size:n=`default`,leadingIcon:r,trailingIcon:i,className:a,children:o})=>{let s=(0,d.useId)(),c={fieldWrapper:`${gV[`rst-inputField-wrapper`]} ${a||``}`,inputWrapper:`${gV[`rst-input-wrapper`]} ${n?gV[`rst-input-${n}`]:``} ${e?gV[`rst-input-error`]:``}`};return(0,h.jsx)(`div`,{className:c.fieldWrapper,children:(0,h.jsxs)(`span`,{className:c.inputWrapper,children:[r&&(0,h.jsx)(b,{src:r,disabled:t}),o({id:s,disabled:t}),i&&(0,h.jsx)(b,{src:i,disabled:t})]})})},vV=e=>{let{value:t,autoFocus:n,placeholder:r,error:i,leadingIcon:a,trailingIcon:o,size:s,onBlur:c,onKeyDown:l,onChange:u,readOnly:d}=e;return(0,h.jsx)(_V,{...e,error:i,leadingIcon:a,trailingIcon:o,size:s,children:({id:e,disabled:i})=>(0,h.jsx)(`input`,{id:e,type:`text`,value:t,disabled:i,autoFocus:n,placeholder:r,className:gV[`rst-input`],onChange:e=>u(e.target.value),onBlur:c,onKeyDown:l,readOnly:d})})};function yV({items:e,itemHeight:t,containerHeight:n,overscan:r=5}){let[i,a]=(0,d.useState)(0),o=(0,d.useRef)(null),s=e.length*t,{startIndex:c,endIndex:l}=(0,d.useMemo)(()=>({startIndex:Math.max(0,Math.floor(i/t)-r),endIndex:Math.min(e.length-1,Math.floor((i+n)/t)+r)}),[i,t,n,e.length,r]),u=(0,d.useMemo)(()=>{let n=[];for(let r=c;r<=l;r++)n.push({item:e[r],index:r,offsetTop:r*t});return n},[e,c,l,t]),f=(0,d.useCallback)(e=>{a(e.currentTarget.scrollTop)},[]),p=(0,d.useCallback)(e=>{let r=o.current;if(!r)return;let i=e*t,a=i+t,s=r.scrollTop,c=s+n;i<s?r.scrollTop=i:a>c&&(r.scrollTop=a-n)},[t,n]);return{containerProps:{ref:o,onScroll:f,style:{maxHeight:`${n}px`,overflowY:`auto`,position:`relative`}},innerProps:{style:{height:`${s}px`,position:`relative`,width:`100%`}},virtualItems:u,scrollToIndex:p,scrollTop:i,startIndex:c,endIndex:l}}var bV=({id:e,options:t,ref:n,width:r,onClick:i,onKeyDown:a,multiple:o=!1,selectedIndex:s=-1,activeIndex:c=[]})=>{let[l,u]=(0,d.useState)(``),[f,p]=(0,d.useState)(s);(0,d.useEffect)(()=>{p(s)},[s]);let{filteredOptions:m,fullOptions:g}=(0,d.useMemo)(()=>mV(t,l),[t,l]),{virtualItems:_,containerProps:v,innerProps:y,scrollToIndex:x}=yV({items:m,itemHeight:24,containerHeight:200,overscan:5});(0,d.useEffect)(()=>{if(!c?.length)return;let e=m.findIndex(e=>e.value===c[0]);e!==-1&&x(e)},[c,m,x]);let S={wrapper:fV[`rst-list`],input:fV[`rst-list-input`],container:fV[`rst-list-container`],virtualScroll:fV[`rst-list-virtualScroll`],listItem:fV[`rst-list-listItem`],listItemCreate:fV[`rst-list-listItem-create`],noElements:fV[`rst-list-noElements`]};return(0,h.jsxs)(`div`,{id:e,ref:n,className:S.wrapper,"data-component":`list`,style:{width:r},children:[(0,h.jsx)(`div`,{className:S.input,children:(0,h.jsx)(vV,{autoFocus:!0,value:l,placeholder:`Search...`,onChange:e=>u(e??``),onKeyDown:e=>hV({e,localSelectedIndex:f,setLocalSelectedIndex:p,filteredOptions:m,fullOptions:g,onClick:i,onKeyDown:a})})}),(0,h.jsx)(`div`,{...v,className:S.container,tabIndex:0,role:`listbox`,"aria-label":`List`,"aria-multiselectable":o,"aria-activedescendant":m[f]?.value,onKeyDown:e=>hV({e,localSelectedIndex:f,setLocalSelectedIndex:p,filteredOptions:m,fullOptions:g,onClick:i,onKeyDown:a}),children:(0,h.jsx)(`div`,{...y,className:S.virtualScroll,children:m.length===0?(0,h.jsx)(`div`,{className:S.noElements,children:`No elements`}):_.map(({item:e,index:t,offsetTop:n})=>{let r=c.includes(e.value),a=f===t;return(0,h.jsxs)(`li`,{role:`option`,id:e.value,"aria-selected":a,tabIndex:-1,className:`${S.listItem} ${r?`selected-item`:``}`,"aria-label":e.value,style:{height:24,lineHeight:`20px`,transform:`translateY(${n}px)`},onClick:()=>{i?.(e),p(t)},children:[(0,h.jsxs)(`span`,{className:S.listItemCreate,children:[e.leadingVisual&&(0,h.jsx)(b,{src:e.leadingVisual}),pV(e.value,l)]}),r&&(0,h.jsx)(b,{src:`check`})]},e.value)})})})]})},xV={"rst-field-select-wrapper":`_rst-field-select-wrapper_d20in_1`,"rst-select-wrapper":`_rst-select-wrapper_d20in_11`},SV=({value:e,onChange:t,options:n,multiActiveIndex:r,disabled:i,multiple:a=!1})=>{let[o,s]=(0,d.useState)(!1),[c,l]=(0,d.useState)(-1),[u,f]=(0,d.useState)(Array.isArray(e)?e:[e]),p=(0,d.useId)(),m=r=>{if(a){let n=Array.isArray(e)?[...e]:[],i=n.includes(r.value)?n.filter(e=>e!==r.value):[...n,r.value];t?.(i),f(i)}else t?.(r.value),l(n.findIndex(e=>e.value===r.value)),f([r.value]),s(!1)},g=()=>{s(!1),l(-1)},_={fieldWrapper:xV[`rst-field-select-wrapper`]};return(0,h.jsx)(`div`,{role:`combobox`,"aria-expanded":o,"aria-controls":p,"aria-owns":p,"aria-disabled":i,"data-component":`combobox`,className:_.fieldWrapper,children:(0,h.jsx)(M,{anchor:(0,h.jsx)(D,{value:(()=>{if(a&&Array.isArray(e)){if(e.length>=4)return`Selected elements: `;let t=n.filter(t=>e.includes(t.value)).map(e=>e.value);return t.length>0?t.join(`, `):`Select options`}else return n.find(t=>t.value===e)?.value||`Select an option`})(),count:a&&u.length>=4?u.length:void 0,onClick:()=>s(e=>!e),"aria-label":`Toggle Select`,trailingVisual:`expand`,disabled:i}),target:(0,h.jsx)(bV,{id:p,options:n,activeIndex:r||u,onClick:m,selectedIndex:c,multiple:a}),isOpen:o,onClose:g,position:`center`,align:`bottom`})})},CV={"rst-grid":`_rst-grid_8mmbv_1`,"rst-column":`_rst-column_8mmbv_7`,"rst-cell":`_rst-cell_8mmbv_13`};function wV(e,t,n,r){if(e<=0)return`oklch(95% 0 0)`;let i=Math.min(e/t,1),a=75-Math.ceil(i*n)*(50/n);return r.replace(/oklch\([^%]+%/,`oklch(${a}%`)}function TV(e=`year`,t){let n=t?new Date(t):new Date,r=e===`month`?EV(n):e===`quarter`?DV(n):OV(n),i=e===`month`?30:e===`quarter`?90:365,a=[];for(let e=0;e<i;e++){let t=kV(r,e);a.push({day:AV(t),count:Math.floor(Math.random()*10)})}let o=[];for(let e=0;e<a.length;e+=7)o.push(a.slice(e,e+7));return o}function EV(e){return new Date(e.getFullYear(),e.getMonth(),1)}function DV(e){let t=Math.floor(e.getMonth()/3);return new Date(e.getFullYear(),t*3,1)}function OV(e){return new Date(e.getFullYear(),0,1)}function kV(e,t){let n=new Date(e);return n.setDate(n.getDate()+t),n}function AV(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}var jV=({data:e,bands:t,color:n,period:r,startDate:i})=>{let a=d.default.useMemo(()=>e??TV(r,i),[e,r,i]),o=d.default.useMemo(()=>Math.max(...a.flat().map(e=>e.count)),[a]),s={grid:CV[`rst-grid`],column:CV[`rst-column`],cell:CV[`rst-cell`]};return(0,h.jsx)(`div`,{className:`${s.grid}`,style:{gridTemplateColumns:`repeat(${e.length}, auto)`},children:a.map((e,r)=>(0,h.jsx)(`div`,{className:s.column,children:e.map((e,r)=>{let i=wV(e.count,o,t,n);return(0,h.jsx)(`div`,{className:s.cell,title:`${e.day}: ${e.count}`,style:{backgroundColor:i}},r)})},r))})},MV=e=>{let{value:t,placeholder:n,autoFocus:r,min:i,max:a,onBlur:o,onKeyDown:s,onChange:c,error:l}=e;return(0,h.jsx)(_V,{...e,error:l,children:({id:e,disabled:l})=>(0,h.jsx)(`input`,{id:e,type:`number`,value:t??``,disabled:l,placeholder:n,autoFocus:r,min:i,max:a,className:gV[`rst-input`],onChange:e=>{let t=e.target.valueAsNumber;c(Number.isNaN(t)?void 0:t)},onBlur:o,onKeyDown:s})})},NV={"rst-label":`_rst-label_1cj39_1`,"rst-label-required":`_rst-label-required_1cj39_12`},PV=({label:e,id:t,disabled:n,required:r})=>(0,h.jsxs)(T,{variant:`label`,"aria-disabled":n,htmlFor:t,className:{label:NV[`rst-label`]}.label,children:[e,r&&(0,h.jsxs)(`span`,{className:NV[`rst-label-required`],"aria-label":`required`,children:[` `,`*`]})]}),FV={"rst-timeline-tl":`_rst-timeline-tl_9aze7_1`,"rst-timeline-list":`_rst-timeline-list_9aze7_5`,"rst-timeline-item":`_rst-timeline-item_9aze7_13`,"rst-timeline-rail":`_rst-timeline-rail_9aze7_19`,"rst-timeline-line":`_rst-timeline-line_9aze7_29`,"rst-timeline-dot":`_rst-timeline-dot_9aze7_37`,"rst-timeline-node":`_rst-timeline-node_9aze7_49`,"rst-timeline-node-header":`_rst-timeline-node-header_9aze7_54`,"rst-timeline-node-image":`_rst-timeline-node-image_9aze7_66`,"rst-timeline-node-article":`_rst-timeline-node-article_9aze7_82`},IV={"rst-skeleton":`_rst-skeleton_4cfvo_1`,"skeleton-loading":`_skeleton-loading_4cfvo_1`},LV=({width:e,height:t,circle:n=!1,className:r})=>{let i={width:e,height:t,borderRadius:n?`50%`:`4px`};return(0,h.jsx)(`span`,{className:`${{skeleton:`${IV[`rst-skeleton`]}`}.skeleton} ${r||``}`,style:i,"aria-hidden":`true`})},RV=({items:e=2})=>{let t={timelineTl:`${FV[`rst-timeline-tl`]}`,timelineList:`${FV[`rst-timeline-list`]}`,timelineItem:`${FV[`rst-timeline-item`]}`,timelineRail:`${FV[`rst-timeline-rail`]}`,timelineLine:`${FV[`rst-timeline-line`]}`,timelineDot:`${FV[`rst-timeline-dot`]}`,timelineNode:`${FV[`rst-timeline-node`]}`,timelineNodeHeader:`${FV[`rst-timeline-node-header`]}`,timelineNodeArticle:`${FV[`rst-timeline-node-article`]}`};return(0,h.jsx)(`section`,{className:t.timelineTl,"aria-label":`Timeline Skeleton`,children:(0,h.jsx)(`ul`,{className:t.timelineList,children:Array.from({length:e}).map((e,n)=>(0,h.jsxs)(`li`,{className:t.timelineItem,children:[(0,h.jsxs)(`div`,{className:t.timelineRail,"aria-hidden":!0,children:[(0,h.jsx)(`span`,{className:t.timelineDot}),(0,h.jsx)(`span`,{className:t.timelineLine})]}),(0,h.jsxs)(`div`,{className:t.timelineNode,children:[(0,h.jsxs)(`span`,{className:t.timelineNodeHeader,children:[(0,h.jsx)(LV,{width:120,height:16}),` `,(0,h.jsx)(LV,{width:60,height:12}),` `]}),(0,h.jsxs)(`article`,{className:t.timelineNodeArticle,children:[(0,h.jsx)(LV,{width:`100%`,height:12}),(0,h.jsx)(LV,{width:`90%`,height:12}),(0,h.jsx)(LV,{width:`95%`,height:12}),(0,h.jsx)(LV,{width:`100%`,height:120}),` `]})]})]},n))})})};function zV(...e){return e.filter(Boolean).join(` `)}function BV(e,t){let n=d.default.Children.toArray(e),r=Object.fromEntries(t.map(e=>[e,null]));for(let e of n)if(d.default.isValidElement(e)&&typeof e.type==`function`){let n=e.type.displayName;t.includes(n)&&(r[n]=e)}return r}var VV=({children:e,visual:t})=>t?(0,h.jsx)(b,{src:t}):(0,h.jsx)(`div`,{className:FV[`rst-timeline-dot`],children:e});VV.displayName=`TimelineItem.Icon`;var HV=({children:e,href:t})=>{let n=(0,h.jsx)(T,{variant:`body`,children:typeof e==`string`?e:String(e)});return t?(0,h.jsx)(`a`,{href:t,children:n}):n};HV.displayName=`TimelineItem.Title`;var UV=({children:e})=>(0,h.jsx)(T,{variant:`code`,children:String(e)});UV.displayName=`TimelineItem.Date`;var WV=({children:e})=>(0,h.jsx)(T,{variant:`body`,children:String(e)});WV.displayName=`TimelineItem.Description`;var GV=({src:e,alt:t=``})=>(0,h.jsx)(`img`,{className:FV[`rst-timeline-node-image`],src:e,alt:t});GV.displayName=`TimelineItem.Image`;var KV=({children:e})=>{let{"TimelineItem.Title":t,"TimelineItem.Date":n,"TimelineItem.Description":r,"TimelineItem.Image":i}=BV(e,[`TimelineItem.Title`,`TimelineItem.Date`,`TimelineItem.Description`,`TimelineItem.Image`]);return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`span`,{className:FV[`rst-timeline-node-header`],children:[t,n]}),(0,h.jsxs)(`article`,{children:[r,i]})]})};KV.displayName=`TimelineItem.Content`;var qV=({children:e,className:t})=>{let{"TimelineItem.Icon":n,"TimelineItem.Content":r}=BV(e,[`TimelineItem.Icon`,`TimelineItem.Content`]);return(0,h.jsxs)(`li`,{className:zV(FV[`rst-timeline-item`],t),children:[(0,h.jsxs)(`div`,{className:FV[`rst-timeline-rail`],"aria-hidden":!0,children:[n||(0,h.jsx)(`span`,{className:FV[`rst-timeline-dot`]}),(0,h.jsx)(`span`,{className:FV[`rst-timeline-line`]})]}),(0,h.jsx)(`div`,{className:FV[`rst-timeline-node`],children:r})]})};qV.displayName=`TimelineItem`,qV.Icon=VV,qV.Content=KV,qV.Title=HV,qV.Date=UV,qV.Description=WV,qV.Image=GV;var JV=Object.assign(({loading:e=!1,children:t})=>e?(0,h.jsx)(RV,{items:3}):(0,h.jsx)(`section`,{className:FV[`rst-timeline-tl`],"aria-label":`Timeline`,children:(0,h.jsx)(`ul`,{className:FV[`rst-timeline-list`],children:t})}),{Item:qV}),YV=()=>{if(typeof window>`u`)return`desktop`;let e=window.innerWidth;return e<768?`mobile`:e<1024?`tablet`:`desktop`},XV=({children:e,layout:t,className:n})=>{let[r,i]=(0,d.useState)(`desktop`);(0,d.useEffect)(()=>{i(YV());let e=()=>i(YV());return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let a=t[r],o=d.default.Children.toArray(e);return(0,h.jsx)(`div`,{style:{display:`grid`,gap:`${(a.gap||0)*.25}rem`,width:`100%`,height:`100%`},className:n,children:o.map((e,t)=>{let n=a.blocks[t];return n?(0,h.jsx)(`div`,{style:{gridColumn:`${n.col} / span ${n.w}`,gridRow:`${n.row} / span ${n.h}`,display:`flex`,justifyContent:n.alignX,alignItems:n.alignY},children:e},t):null})})};XV.displayName=`Layout`;var ZV=({children:e,direction:t=`column`,gap:n=1,align:r=`flex-start`,justify:i=`flex-start`,wrap:a=!1})=>(0,h.jsx)(`div`,{style:{display:`flex`,flexDirection:t,gap:`${n}rem`,alignItems:r,justifyContent:i,flexWrap:a?`wrap`:`nowrap`},children:e}),QV=(0,d.createContext)(null),$V={"rst-tour-backdrop":`_rst-tour-backdrop_1tdjs_3`,"rst-tour-backdrop-path":`_rst-tour-backdrop-path_1tdjs_14`,"rst-tour-backdrop-loading":`_rst-tour-backdrop-loading_1tdjs_20`,"rst-tour-spotlight":`_rst-tour-spotlight_1tdjs_31`,"rst-tour-tooltip":`_rst-tour-tooltip_1tdjs_47`,"rst-tour-tooltip--loading":`_rst-tour-tooltip--loading_1tdjs_70`,"rst-tour-progress-bar":`_rst-tour-progress-bar_1tdjs_82`,"rst-tour-progress-fill":`_rst-tour-progress-fill_1tdjs_90`,"rst-tour-step-counter":`_rst-tour-step-counter_1tdjs_99`,"rst-tour-tooltip-content":`_rst-tour-tooltip-content_1tdjs_107`,"rst-tour-button-group":`_rst-tour-button-group_1tdjs_115`};function eH(e,t){if(t!==`auto`)return t;let n=e.top,r=window.innerHeight-e.bottom,i=e.left,a=window.innerWidth-e.right,o=Math.max(r,n,i,a);return o===r?`bottom`:o===n?`top`:o===a?`right`:`left`}function tH(e,t){let n=window.scrollX,r=window.scrollY;switch(t){case`top`:return{top:e.top+r,left:e.left+n,placement:t};case`bottom`:return{top:e.bottom+r+12,left:e.left+n,placement:t};case`right`:return{top:e.top+r,left:e.right+n+12,placement:t};case`left`:return{top:e.top+r,left:e.left+n,placement:t}}}function nH(e={}){return{currentStepIndex:0,completedSteps:[],skippedSteps:[],completed:!1,startedAt:Date.now(),...e}}function rH(e){let{tourId:t,steps:n,persistence:r,analytics:i,autoScroll:a=!0,autoScrollOptions:o={behavior:`smooth`,block:`center`},onComplete:s,onStart:c}=e,[l,u]=(0,d.useState)(null),[f,p]=(0,d.useState)(null),[m,g]=(0,d.useState)(!1),[_,v]=(0,d.useState)(!1),[y,b]=(0,d.useState)(null),x=(0,d.useRef)(0),S=(0,d.useRef)(new Set),C=(0,d.useRef)(new Set),w=(0,d.useRef)(null),E=(0,d.useRef)(()=>{}),O=(0,d.useRef)(0),k=(0,d.useRef)(n);k.current=n;let A=(0,d.useRef)(a);A.current=a;let j=(0,d.useRef)(o);j.current=o;let M=(0,d.useContext)(QV);(0,d.useEffect)(()=>{r&&(async()=>{let e=await Promise.resolve(r.getProgress(t));e&&(b(e),e.completed&&v(!0),S.current=new Set(e.completedSteps),C.current=new Set(e.skippedSteps))})()},[t]),(0,d.useEffect)(()=>{if(M)return M.registerTour(t,w.current),()=>M.unregisterTour(t)},[t]);let N=(0,d.useCallback)(e=>{if(e===null){p(null);return}let t=k.current[e];if(!t){p(null);return}let n=document.querySelector(t.selector);if(!n){p(null);return}A.current&&n.scrollIntoView(j.current),p(n.getBoundingClientRect())},[]);(0,d.useEffect)(()=>{if(l===null)return;let e=()=>N(l);return window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[l,N]),(0,d.useEffect)(()=>{N(l)},[l,N]),(0,d.useEffect)(()=>{if(l===null||m)return;let e=k.current[l];if(!e?.trigger||e.trigger===`manual`)return;let t=document.querySelector(e.selector);if(!t)return;let n=()=>E.current();return typeof e.trigger==`function`?e.trigger(t,n):e.trigger===`click`?(t.addEventListener(`click`,n),()=>t.removeEventListener(`click`,n)):(t.addEventListener(`change`,n),t.addEventListener(`input`,n),()=>{t.removeEventListener(`change`,n),t.removeEventListener(`input`,n)})},[l,m]);let P=(0,d.useCallback)(e=>{r?.saveProgress(t,e)},[r,t]),F=(0,d.useCallback)(async e=>{if(!e.beforeShow)return;let t=++O.current;g(!0);try{await e.beforeShow()}finally{O.current===t&&g(!1)}},[]),ee=(0,d.useCallback)(()=>{n.length!==0&&(S.current=new Set,C.current=new Set,b(nH()),v(!1),u(0),x.current=Date.now(),i?.onTourStart?.({tourId:t,totalSteps:n.length,completedSteps:[],skippedSteps:[]}),c?.(),M?.setActiveTourId(t),F(n[0]))},[n,i,t,c,M,F]),te=(0,d.useCallback)(()=>{O.current++,g(!1),u(e=>{if(e!==null&&!_){let r=n[e];i?.onTourDrop?.({tourId:t,totalSteps:n.length,completedSteps:[...S.current],skippedSteps:[...C.current],dropStepId:r?.id??``,dropStepIndex:e});let a=nH({currentStepIndex:e,completedSteps:[...S.current],skippedSteps:[...C.current],completed:!1,startedAt:y?.startedAt??Date.now()});P(a),b(a)}return null}),M?.setActiveTourId(null)},[_,n,i,t,y,P,M]),ne=(0,d.useCallback)(async()=>{let e=r?await Promise.resolve(r.getProgress(t)):y;if(!e||e.completed){ee();return}S.current=new Set(e.completedSteps),C.current=new Set(e.skippedSteps),b(e),v(!1);let a=Math.min(e.currentStepIndex,n.length-1);u(a),x.current=Date.now(),i?.onTourStart?.({tourId:t,totalSteps:n.length,completedSteps:e.completedSteps,skippedSteps:e.skippedSteps}),M?.setActiveTourId(t),F(n[a])},[r,t,y,n,ee,i,M,F]),re=(0,d.useCallback)((e,r,a)=>{let o=Date.now()-x.current,c=n[r];if(c.afterLeave?.(),a?(C.current.add(c.id),i?.onStepSkip?.({tourId:t,stepId:c.id,stepIndex:r,timeSpentMs:o})):(S.current.add(c.id),i?.onStepComplete?.({tourId:t,stepId:c.id,stepIndex:r,timeSpentMs:o})),e>=n.length){let e=nH({currentStepIndex:r,completedSteps:[...S.current],skippedSteps:[...C.current],completed:!0,startedAt:y?.startedAt??Date.now()});b(e),v(!0),u(null),P(e),i?.onTourComplete?.({tourId:t,totalSteps:n.length,completedSteps:[...S.current],skippedSteps:[...C.current]}),s?.();return}x.current=Date.now();let l=nH({currentStepIndex:e,completedSteps:[...S.current],skippedSteps:[...C.current],startedAt:y?.startedAt??Date.now()});b(l),u(e),P(l),i?.onStepStart?.({tourId:t,stepId:n[e].id,stepIndex:e,timeSpentMs:0}),F(n[e])},[n,i,t,y,P,s,F]),I=(0,d.useCallback)(()=>{u(e=>e===null?null:(re(e+1,e,!1),e))},[re]),ie=(0,d.useCallback)(()=>{u(e=>e===null?null:(n[e].skipable===!1||re(e+1,e,!0),e))},[re,n]),ae=(0,d.useCallback)(()=>{O.current++,g(!1),u(e=>e===null||e===0?e:(x.current=Date.now(),e-1))},[]),oe=(0,d.useCallback)(async()=>{O.current++,g(!1),r&&await Promise.resolve(r.clearProgress(t)),S.current=new Set,C.current=new Set,b(null),v(!1),u(null),p(null)},[r,t]),se=(0,d.useCallback)(async()=>{await oe(),setTimeout(ee,0)},[oe,ee]),ce=(0,d.useCallback)(()=>{if(l===null)return null;let e=n[l];if(m||!f)return(0,h.jsx)(`div`,{className:$V[`rst-tour-backdrop-loading`],onClick:te,children:(0,h.jsxs)(`div`,{className:`${$V[`rst-tour-tooltip`]} ${$V[`rst-tour-tooltip--loading`]}`,"data-placement":`bottom`,children:[(0,h.jsx)(LV,{height:16,width:120}),(0,h.jsx)(LV,{height:52,width:220})]})});let t={top:f.top-8,left:f.left-8,width:f.width+16,height:f.height+16,right:f.right+8,bottom:f.bottom+8},r=tH(t,eH(f,e.placement??`auto`)),i=l===0,a=l===n.length-1,o=e.skipable!==!1,s=n.length>1?l/(n.length-1)*100:100;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`svg`,{className:$V[`rst-tour-backdrop`],children:(0,h.jsx)(`path`,{d:[`M 0 0 L 10000 0 L 10000 10000 L 0 10000 Z`,`M ${t.left} ${t.top}`,`L ${t.right} ${t.top}`,`L ${t.right} ${t.bottom}`,`L ${t.left} ${t.bottom} Z`].join(` `),fill:`oklch(0% 0 0deg / 60%)`,fillRule:`evenodd`,className:$V[`rst-tour-backdrop-path`],onClick:te})}),(0,h.jsx)(`div`,{className:$V[`rst-tour-spotlight`],style:{top:t.top+window.scrollY,left:t.left+window.scrollX,width:t.width,height:t.height}}),(0,h.jsxs)(`div`,{className:$V[`rst-tour-tooltip`],"data-placement":r.placement,style:{top:r.top,left:r.left},children:[(0,h.jsx)(`div`,{children:(0,h.jsx)(D,{leadingVisual:`close`,size:`small`,variant:`invisible`,value:``,onClick:te})}),(0,h.jsx)(`div`,{className:$V[`rst-tour-progress-bar`],children:(0,h.jsx)(`div`,{className:$V[`rst-tour-progress-fill`],style:{width:`${s}%`}})}),(0,h.jsxs)(`div`,{className:$V[`rst-tour-step-counter`],children:[l+1,` / `,n.length]}),e.title&&(0,h.jsx)(T,{variant:`title`,children:e.title}),(0,h.jsx)(`div`,{className:$V[`rst-tour-tooltip-content`],children:e.content}),(0,h.jsxs)(`div`,{className:$V[`rst-tour-button-group`],children:[o&&!a&&(0,h.jsx)(D,{size:`small`,variant:`invisible`,value:`Skip`,onClick:ie}),(0,h.jsxs)(ZV,{direction:`row`,gap:1,children:[!i&&(0,h.jsx)(D,{size:`small`,variant:`invisible`,value:`Prev`,onClick:ae}),a?(0,h.jsx)(D,{size:`small`,variant:`primary`,value:`Finish`,onClick:I}):(0,h.jsx)(D,{size:`small`,variant:`primary`,value:`Next`,onClick:I})]})]})]})]})},[l,f,n,m,ie,ae,I,te]);E.current=I;let le={start:ee,resume:ne,stop:te,next:I,prev:ae,skip:ie,reset:oe,replay:se,activeStep:l,isLoading:m,isComplete:_,progress:y,render:ce};return w.current=le,le}function iH({children:e}){let[t,n]=(0,d.useState)(null),[r,i]=(0,d.useState)([]),a=(0,d.useRef)({}),o=(0,d.useCallback)(e=>{n(t=>(t&&t!==e&&a.current[t]?.stop(),e))},[]),s=(0,d.useCallback)((e,t)=>{a.current[e]=t,i(t=>t.includes(e)?t:[...t,e])},[]),c=(0,d.useCallback)(e=>{delete a.current[e],i(t=>t.filter(t=>t!==e))},[]);return(0,h.jsx)(QV.Provider,{value:{activeTourId:t,setActiveTourId:o,instancesRef:a,registeredTourIds:r,registerTour:s,unregisterTour:c},children:e})}function aH(){let e=(0,d.useContext)(QV);if(!e)throw Error(`[useTourManager] must be used inside a <TourProvider>. Wrap your component tree with <TourProvider> to enable multi-tour management.`);let{activeTourId:t,setActiveTourId:n,instancesRef:r,registeredTourIds:i}=e;return{tours:Object.fromEntries(i.map(e=>[e,{tourId:e,isActive:e===t}])),activeTourId:t,startTour:(0,d.useCallback)(e=>{let t=r.current[e];if(!t){console.warn(`[useTourManager] No tour registered with id "${e}".`);return}n(e),t.start()},[r,n]),stopActiveTour:(0,d.useCallback)(()=>{t&&(r.current[t]?.stop(),n(null))},[t,r,n])}}function oH(e,t={}){let{maxHistory:n=50,isEqual:r}=t,[i,a]=(0,d.useState)([]),[o,s]=(0,d.useState)(e),[c,l]=(0,d.useState)([]),u=(0,d.useRef)(!1),f=(0,d.useCallback)(e=>{r&&r(o,e)||(u.current||(a(e=>{let t=[...e,o];return t.length>n?t.slice(t.length-n):t}),l([])),s(e))},[o,n,r]),p=(0,d.useCallback)(()=>{if(i.length===0)return;u.current=!0;let e=i[i.length-1];a(i.slice(0,i.length-1)),s(e),l(e=>[o,...e]),requestAnimationFrame(()=>{u.current=!1})},[i,o]),m=(0,d.useCallback)(()=>{if(c.length===0)return;u.current=!0;let e=c[0],t=c.slice(1);a(e=>[...e,o]),s(e),l(t),requestAnimationFrame(()=>{u.current=!1})},[c,o]),h=(0,d.useCallback)(()=>{a([]),l([])},[]),g=(0,d.useCallback)(e=>{a([]),s(e),l([])},[]);return{state:o,setState:f,undo:p,redo:m,canUndo:i.length>0,canRedo:c.length>0,clearHistory:h,undoCount:i.length,redoCount:c.length,reset:g}}var sH={"rst-kbd-group":`_rst-kbd-group_9wtu1_2`,"rst-kbd-group-separator":`_rst-kbd-group-separator_9wtu1_10`,"rst-kbd-group-plus":`_rst-kbd-group-plus_9wtu1_18`,"rst-kbd-group-combination":`_rst-kbd-group-combination_9wtu1_26`},cH=({keys:e,separator:t=`+`,showSeparator:n=!1,className:r,...i})=>{let a=[sH[`rst-kbd-group`],n&&sH[`rst-kbd-group-combination`],r].filter(Boolean).join(` `),o=n=>n===e.length-1?null:(0,h.jsx)(`span`,{className:sH[`rst-kbd-group-separator`],children:t},`sep-${n}`);return(0,h.jsx)(`div`,{className:a,...i,children:e.map((e,t)=>(0,h.jsxs)(d.default.Fragment,{children:[(0,h.jsx)(aB,{children:e}),n&&o(t)]},t))})},lH={"rst-menu":`_rst-menu_bwbr2_2`,"rst-menu-item":`_rst-menu-item_bwbr2_14`,"rst-menu-item-disabled":`_rst-menu-item-disabled_bwbr2_37`,"rst-menu-separator":`_rst-menu-separator_bwbr2_47`,"rst-menu-item-content":`_rst-menu-item-content_bwbr2_55`,"rst-menu-item-label":`_rst-menu-item-label_bwbr2_62`,"rst-menu-item-leading-visual":`_rst-menu-item-leading-visual_bwbr2_74`,"rst-menu-item-trailing-visual":`_rst-menu-item-trailing-visual_bwbr2_82`,"rst-menu-item-shortcut":`_rst-menu-item-shortcut_bwbr2_90`,"rst-menu-item-submenu-indicator":`_rst-menu-item-submenu-indicator_bwbr2_97`,"rst-menu-node":`_rst-menu-node_bwbr2_105`},uH=({children:e,className:t,...n})=>(0,h.jsx)(`div`,{className:[lH[`rst-menu`],t].filter(Boolean).join(` `),role:`menu`,...n,children:e}),dH=({label:e,children:t,disabled:n=!1,leadingVisual:r,shortcut:i,onClick:a,content:o,id:s,...c})=>{let l=t&&t.length>=1;console.log(`Rendering MenuItem:`,e,o);let u=()=>{n||a?.({label:e,disabled:n,leadingVisual:r,shortcut:i})};return(0,h.jsx)(`div`,{className:[lH[`rst-menu-item`],n?lH[`rst-menu-item-disabled`]:``].filter(Boolean).join(` `),onClick:u,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&!n&&(e.preventDefault(),u())},tabIndex:n?-1:0,role:`menuitem`,"aria-disabled":n,"aria-haspopup":l?`menu`:void 0,...c,children:o?(0,h.jsx)(h.Fragment,{children:o}):(0,h.jsxs)(`div`,{className:lH[`rst-menu-item-content`],children:[r&&(0,h.jsx)(`div`,{className:lH[`rst-menu-item-leading-visual`],children:(0,h.jsx)(b,{src:r,state:`base`})}),(0,h.jsx)(T,{variant:`body`,children:e}),i&&(0,h.jsx)(`div`,{className:lH[`rst-menu-item-shortcut`],children:(0,h.jsx)(cH,{keys:i,showSeparator:!1})}),l&&(0,h.jsx)(`div`,{className:lH[`rst-menu-item-submenu-indicator`],children:(0,h.jsx)(b,{src:`chevron-right`,state:`base`})})]})},s)},fH=Object.assign(uH,{Item:dH,Separator:({className:e,...t})=>(0,h.jsx)(`hr`,{className:[lH[`rst-menu-separator`],e].filter(Boolean).join(` `),role:`separator`,...t}),Submenu:({trigger:e,children:t,position:n=`right`,align:r=`center`,className:i,...a})=>{let[o,s]=(0,d.useState)(!1),c=(0,d.useRef)(null),l=(0,d.useRef)(null),u=()=>{s(!0)},f=e=>{let t=l.current;t&&t.contains(e.relatedTarget)||s(!1)},p=e=>{let t=c.current;t&&t.contains(e.relatedTarget)||s(!1)},m=e=>{e.key===`ArrowRight`?(e.preventDefault(),s(!0)):(e.key===`ArrowLeft`&&o||e.key===`Escape`)&&(e.preventDefault(),s(!1))},g=[lH[`rst-menu-submenu`],i].filter(Boolean).join(` `),_=d.default.isValidElement(e)&&e.type===dH?d.default.cloneElement(e):e;return(0,h.jsx)(`div`,{className:g,...a,children:(0,h.jsx)(M,{isOpen:o,onClose:()=>s(!1),position:n,align:r,anchor:(0,h.jsx)(`div`,{ref:c,onMouseEnter:u,onMouseLeave:f,onKeyDown:m,"aria-haspopup":`menu`,"aria-expanded":o,children:_}),target:(0,h.jsx)(`div`,{ref:l,className:lH[`rst-menu`],role:`menu`,onMouseLeave:p,children:t})})})}}),pH={"rst-chart-container":`_rst-chart-container_10aqn_2`,"rst-chart-header":`_rst-chart-header_10aqn_13`,"rst-chart-title":`_rst-chart-title_10aqn_17`,"rst-chart-subtitle":`_rst-chart-subtitle_10aqn_25`,"rst-chart-content":`_rst-chart-content_10aqn_33`,"rst-chart-error":`_rst-chart-error_10aqn_39`,"rst-chart-empty":`_rst-chart-empty_10aqn_51`};function mH(e,t){let n=t?.headerFormatter||(e=>e.charAt(0).toUpperCase()+e.slice(1).replace(/([A-Z])/g,` $1`));return e.map(e=>({id:String(e),accessorKey:e,header:n(String(e))}))}function hH(e,t){return function(n){let{x:r,y:i,width:a,height:o,index:s,payload:c}=n,l=e[s]??`#94a3b8`,u=c.depth??0,d=u===0,f=t>1&&!d&&u!==t,p=i+o/2;return(0,h.jsxs)(L,{children:[(0,h.jsx)(yp,{x:r,y:i,width:a,height:o,fill:l,fillOpacity:.9,radius:3}),f?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`text`,{x:r+a/2,y:i-14,textAnchor:`middle`,dominantBaseline:`auto`,fontSize:11,fontWeight:600,fill:`#1e293b`,children:c.name}),(0,h.jsx)(`text`,{x:r+a/2,y:i-3,textAnchor:`middle`,dominantBaseline:`auto`,fontSize:10,fill:`#64748b`,children:c.value})]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`text`,{x:d?r-12:r+a+12,y:p-(o>24?7:0),textAnchor:d?`end`:`start`,dominantBaseline:`middle`,fontSize:12,fontWeight:600,fill:`#1e293b`,children:c.name}),o>20&&(0,h.jsx)(`text`,{x:d?r-12:r+a+12,y:p+9,textAnchor:d?`end`:`start`,dominantBaseline:`middle`,fontSize:11,fill:`#64748b`,children:c.value})]})]},`sn-${s}`)}}function gH(e){return function(t){let{sourceX:n,targetX:r,sourceY:i,targetY:a,sourceControlX:o,targetControlX:s,linkWidth:c,payload:l}=t;if(!l)return(0,h.jsx)(`g`,{});let u=e[typeof l.target==`number`?l.target:l.target.index]??`#94a3b8`,d=Math.max(1,c||0)/2;return(0,h.jsx)(`path`,{d:[`M${n},${i-d}`,`C${o},${i-d} ${s},${a-d} ${r},${a-d}`,`L${r},${a+d}`,`C${s},${a+d} ${o},${i+d} ${n},${i+d}`,`Z`].join(` `),fill:u,fillOpacity:.3,stroke:u,strokeOpacity:.15,strokeWidth:.5})}}function _H(e,t,n,r){let i=[],a=[],o=new Map,s=t.map(()=>new Map);for(let n of e)t.forEach((e,t)=>{let r=n[e];r!=null&&String(r).trim()!==``&&s[t].set(String(r),null)});s.forEach((e,t)=>{for(let n of e.keys())o.set(`${t}:${n}`,i.length),i.push({name:n}),a.push(r[t%r.length])});let c=new Map;for(let r of e){let e=r[n],i=typeof e==`number`?e:Number(e)||0,a=[];t.forEach((e,t)=>{let n=r[e];n!=null&&String(n).trim()!==``&&a.push(o.get(`${t}:${String(n)}`))});for(let e=0;e<a.length-1;e++){let t=a[e],n=a[e+1],r=`${t}:${n}`,o=c.get(r);o?o.value+=i:c.set(r,{source:t,target:n,value:i})}}return{nodes:i,links:Array.from(c.values()),nodeColors:a}}var vH=({data:e,columns:t,type:n,xAxisColumn:r=``,yAxisColumns:i=[],title:a,subtitle:o,width:s=`100%`,height:c=400,colors:l=[`#8884d8`,`#82ca9d`,`#ffc658`,`#ff7c7c`,`#8dd1e1`],showGrid:u=!0,showTooltip:d=!0,showLegend:f=!0,showXAxis:p=!0,showYAxis:m=!0,layout:g=`horizontal`,sankeyConfig:_})=>{let v=e[0]?Object.keys(e[0]):[],y=t||mH(v);if(n!==`sankey`&&(!r||!i||i.length===0))return(0,h.jsx)(`div`,{className:pH[`rst-chart-container`],children:(0,h.jsx)(`div`,{className:pH[`rst-chart-error`],children:`Missing required axis configuration. Please provide xAxisColumn and yAxisColumns.`})});if(!e||e.length===0)return(0,h.jsx)(`div`,{className:pH[`rst-chart-container`],children:(0,h.jsx)(`div`,{className:pH[`rst-chart-empty`],children:`No data to display`})});let b=(e,t)=>{let n=y.find(e=>e.id===t||e.accessorKey===t||String(e.accessorKey)===t);if(n){if(n.accessorFn)return n.accessorFn(e);if(n.accessorKey)return e[n.accessorKey]}return e[t]},x=e=>y.find(t=>t.id===e||t.accessorKey===e||String(t.accessorKey)===e)?.header||String(e),S=()=>e.map((e,t)=>{let n={_originalData:e,_index:t};return n[String(r)]=b(e,r),i.forEach(t=>{let r=b(e,t);n[String(t)]=typeof r==`number`?r:typeof r==`string`&&!isNaN(Number(r))?Number(r):0}),n}),C=c;if(n===`sankey`&&_&&e.length>0){let t=_.stageColumns.map(t=>new Set(e.map(e=>e[t]).filter(e=>e!=null&&String(e).trim()!==``)).size),n=Math.max(...t)*44-20+48;C=typeof c==`number`?Math.max(c,n):n}return(0,h.jsxs)(`div`,{className:[pH[`rst-chart-container`]].filter(Boolean).join(` `),children:[a&&(0,h.jsxs)(`div`,{className:pH[`rst-chart-header`],children:[(0,h.jsx)(`h3`,{className:pH[`rst-chart-title`],children:a}),o&&(0,h.jsx)(`p`,{className:pH[`rst-chart-subtitle`],children:o})]}),(0,h.jsx)(`div`,{className:pH[`rst-chart-content`],children:(0,h.jsx)(cl,{width:s,height:C,children:(()=>{let t={data:S(),margin:{top:20,right:30,left:20,bottom:5}},a=p?{...g!==`vertical`&&{dataKey:String(r)}}:{},o=m?{...g===`vertical`&&{dataKey:String(r)}}:{};switch(n){case`line`:return(0,h.jsxs)(jR,{...t,children:[u&&(0,h.jsx)(iN,{strokeDasharray:`3 3`}),p&&(0,h.jsx)(II,{...a}),m&&(0,h.jsx)(ZI,{...o}),d&&(0,h.jsx)(AE,{}),f&&(0,h.jsx)(cd,{}),i.map((e,t)=>(0,h.jsx)(eP,{type:`monotone`,dataKey:String(e),stroke:l[t%l.length],name:x(e)},String(e)))]});case`bar`:return(0,h.jsxs)(NR,{...t,layout:g,children:[u&&(0,h.jsx)(iN,{strokeDasharray:`3 3`}),p&&(0,h.jsx)(II,{...a}),m&&(0,h.jsx)(ZI,{...o}),d&&(0,h.jsx)(AE,{}),f&&(0,h.jsx)(cd,{}),i.map((e,t)=>(0,h.jsx)(zF,{dataKey:String(e),fill:l[t%l.length],name:x(e)},String(e)))]});case`area`:return(0,h.jsxs)(Xz,{...t,children:[u&&(0,h.jsx)(iN,{strokeDasharray:`3 3`}),p&&(0,h.jsx)(II,{...a}),m&&(0,h.jsx)(ZI,{...o}),d&&(0,h.jsx)(AE,{}),f&&(0,h.jsx)(cd,{}),i.map((e,t)=>(0,h.jsx)(zP,{type:`monotone`,dataKey:String(e),stackId:`1`,stroke:l[t%l.length],fill:l[t%l.length],name:x(e)},String(e)))]});case`pie`:return(0,h.jsxs)($R,{...t,children:[i.map((e,t)=>(0,h.jsx)(IA,{data:S(),dataKey:String(e),nameKey:String(r),cx:`50%`,cy:`50%`,outerRadius:80+t*30,fill:l[t%l.length],label:!0},String(e))),d&&(0,h.jsx)(AE,{}),f&&(0,h.jsx)(cd,{})]});case`scatter`:return(0,h.jsxs)(Jz,{...t,children:[u&&(0,h.jsx)(iN,{strokeDasharray:`3 3`}),p&&(0,h.jsx)(II,{...a}),m&&(0,h.jsx)(ZI,{...o}),d&&(0,h.jsx)(AE,{}),f&&(0,h.jsx)(cd,{}),i.map((e,t)=>(0,h.jsx)(hI,{dataKey:String(e),name:x(e),fill:l[t%l.length]},String(e)))]});case`sankey`:{if(!_)return(0,h.jsxs)(`div`,{children:[`Sankey requires a `,(0,h.jsx)(`code`,{children:`sankeyConfig`}),` prop with `,(0,h.jsx)(`code`,{children:`stageColumns`}),` and `,(0,h.jsx)(`code`,{children:`valueColumn`}),`.`]});let{nodes:t,links:n,nodeColors:r}=_H(e,_.stageColumns,_.valueColumn,l),i=_.stageColumns.length-1,a=i>1,o=6.5,s=[...new Set(e.map(e=>String(e[_.stageColumns[0]]??``)))].filter(Boolean),c=[...new Set(e.map(e=>String(e[_.stageColumns[i]]??``)))].filter(Boolean),u=Math.max(64,Math.max(...s.map(e=>e.length))*o+14),d=Math.max(64,Math.max(...c.map(e=>e.length))*o+14),f=a?36:14;return(0,h.jsx)(Kz,{data:{nodes:t,links:n},node:hH(r,i),link:gH(r),nodePadding:20,nodeWidth:14,iterations:32,margin:{top:f,right:Math.ceil(d),bottom:14,left:Math.ceil(u)}})}default:return(0,h.jsxs)(`div`,{children:[`Unsupported chart type: `,n]})}})()})})]})},X={"rst-table-container":`_rst-table-container_9t24z_1`,"rst-column-visibility-list":`_rst-column-visibility-list_9t24z_11`,"rst-column-visibility-item":`_rst-column-visibility-item_9t24z_17`,"rst-column-visibility-label":`_rst-column-visibility-label_9t24z_31`,"rst-table-skeleton-row":`_rst-table-skeleton-row_9t24z_37`,"rst-table-skeleton-cell":`_rst-table-skeleton-cell_9t24z_41`,"rst-table-empty-state":`_rst-table-empty-state_9t24z_57`,"rst-table-empty-state-label":`_rst-table-empty-state-label_9t24z_63`,"rst-table-outer":`_rst-table-outer_9t24z_72`,"rst-table-outer-content":`_rst-table-outer-content_9t24z_87`,"rst-table-sidebar":`_rst-table-sidebar_9t24z_93`,"rst-sidebar-btn":`_rst-sidebar-btn_9t24z_105`,"rst-sidebar-btn-active":`_rst-sidebar-btn-active_9t24z_112`,"rst-table-tool-panel":`_rst-table-tool-panel_9t24z_117`,"rst-table-tool-panel-header":`_rst-table-tool-panel-header_9t24z_131`,"rst-table-tool-panel-title":`_rst-table-tool-panel-title_9t24z_140`,"rst-table-tool-panel-body":`_rst-table-tool-panel-body_9t24z_146`,"rst-table-grid":`_rst-table-grid_9t24z_152`,"rst-table-grid-fixed":`_rst-table-grid-fixed_9t24z_161`,"rst-table-body":`_rst-table-body_9t24z_167`,"rst-table-cell":`_rst-table-cell_9t24z_180`,"rst-table-row":`_rst-table-row_9t24z_188`,"rst-table-cell-wrapper":`_rst-table-cell-wrapper_9t24z_209`,"rst-table-row-group":`_rst-table-row-group_9t24z_220`,"rst-table-group-cell":`_rst-table-group-cell_9t24z_225`,"rst-table-group-label":`_rst-table-group-label_9t24z_229`,"rst-table-cell-pinned":`_rst-table-cell-pinned_9t24z_239`,"rst-table-cell-pinned-left":`_rst-table-cell-pinned-left_9t24z_247`,"rst-table-cell-pinned-right":`_rst-table-cell-pinned-right_9t24z_252`,"rst-table-row-selected":`_rst-table-row-selected_9t24z_260`,"rst-table-footer":`_rst-table-footer_9t24z_265`,"rst-table-footer-sticky":`_rst-table-footer-sticky_9t24z_280`,"rst-pivot-container":`_rst-pivot-container_9t24z_296`,"rst-pivot-config-panel":`_rst-pivot-config-panel_9t24z_304`,"rst-pivot-available-fields":`_rst-pivot-available-fields_9t24z_314`,"rst-pivot-zones":`_rst-pivot-zones_9t24z_322`,"rst-pivot-zone":`_rst-pivot-zone_9t24z_322`,"rst-pivot-zone-active":`_rst-pivot-zone-active_9t24z_342`,"rst-pivot-zone-title":`_rst-pivot-zone-title_9t24z_347`,"rst-pivot-zone-placeholder":`_rst-pivot-zone-placeholder_9t24z_355`,"rst-pivot-chip-wrapper":`_rst-pivot-chip-wrapper_9t24z_361`,"rst-pivot-agg-select":`_rst-pivot-agg-select_9t24z_367`,"rst-pivot-table":`_rst-pivot-table_9t24z_378`,"rst-pivot-header-row-field":`_rst-pivot-header-row-field_9t24z_382`,"rst-pivot-header-group":`_rst-pivot-header-group_9t24z_387`,"rst-pivot-header-value":`_rst-pivot-header-value_9t24z_394`,"rst-pivot-cell-row-field":`_rst-pivot-cell-row-field_9t24z_398`,"rst-pivot-cell-value":`_rst-pivot-cell-value_9t24z_403`,"rst-pivot-empty":`_rst-pivot-empty_9t24z_408`,"rst-table-selection-cell":`_rst-table-selection-cell_9t24z_420`},yH=(0,d.createContext)(void 0);function bH(e,t,n){if(t.length===0)return e;let r=t[0],i=n.find(e=>(e.id||e.accessorKey)===r.id);return i?[...e].sort((e,t)=>{let n,a;if(i.accessorFn)n=i.accessorFn(e),a=i.accessorFn(t);else if(i.accessorKey)n=e[i.accessorKey],a=t[i.accessorKey];else return 0;if(i.sortingFn){let n=i.sortingFn(e,t,r.id);return r.desc?-n:n}if(n===a)return 0;if(n==null)return 1;if(a==null)return-1;let o=n<a?-1:1;return r.desc?-o:o}):e}function xH(e,t){return e.id||(e.accessorKey?String(e.accessorKey):`col-${t}`)}function SH(e,t,n){let r=n.find(e=>(e.id||e.accessorKey)===t);return r?r.accessorFn?r.accessorFn(e):r.accessorKey?e[r.accessorKey]:null:null}function CH(e,t,n,r,i=0,a){if(t.length===0)return wH(e,void 0,r,`table`,a,i);let o=t[0],s=t.slice(1),c=new Map;e.forEach(e=>{let t=SH(e,o,n),r=String(t);c.has(r)||c.set(r,[]),c.get(r).push(e)});let l=[],u=0;return c.forEach((e,t)=>{let c=a?`${a}.group.${t}`:`group.${t}`,d=r.has(c),f={id:c,data:e[0],groupItems:e,index:u++,parentId:a,depth:i,isExpanded:d,isGroup:!0,groupingValue:t,groupingColumnId:o,subRows:void 0};if(l.push(f),d){let t=CH(e,s,n,r,i+1,c);l.push(...t)}}),l}function wH(e,t,n=new Set,r=`table`,i,a=0){let o=[];return e.forEach((e,s)=>{let c=i?`${i}.${s}`:`${s}`,l=t?.(e,s),u=l&&l.length>0,d=n.has(c),f={id:c,data:e,index:s,parentId:i,depth:r===`table`?0:a,isExpanded:d,subRows:void 0};if(u)switch(r){case`table`:break;case`tree`:if(o.push(f),l){let e=wH(l,t,n,r,void 0,0);o.push(...e)}return o;case`table-tree`:d&&(f.subRows=wH(l,t,n,r,c,a+1));break}o.push(f),r===`table-tree`&&f.subRows&&o.push(...f.subRows)}),o}function TH(e,t){let n=e.id??(e.accessorKey?String(e.accessorKey):``);return n&&n in t?t[n]:e.pinned??!1}function EH(e,t){if(!(Object.keys(t).length>0||e.some(e=>e.pinned===`left`||e.pinned===`right`)))return e;let n=[],r=[],i=[];return e.forEach(e=>{let a=TH(e,t);a===`left`?n.push(e):a===`right`?i.push(e):r.push(e)}),[...n,...r,...i]}function DH(e,t,n){let r={},i=n?40:0;e.forEach((e,n)=>{TH(e,t)===`left`&&(r[xH(e,n)]={left:i},i+=e.size??e.minSize??150)});let a=0;for(let n=e.length-1;n>=0;n--){let i=e[n];TH(i,t)===`right`&&(r[xH(i,n)]={right:a},a+=i.size??i.minSize??150)}return r}function OH(e){return Object.values(e).some(e=>e.left!==void 0)}function kH(e,t,n){let r=n(t,0);if(!r||r.length===0)return[];let i=[];return r.forEach((t,r)=>{let a=`${e}.${r}`;i.push(a),i.push(...kH(a,t,n))}),i}function AH(e,t){let n=[];return t.filter(t=>t.parentId===e).forEach(e=>{e.isGroup||n.push(e.id),n.push(...AH(e.id,t))}),n}function jH(e,t,n){return e.isGroup?AH(e.id,t):n?kH(e.id,e.data,n):[]}function MH(e,t,n,r){let i=jH(e,n,r);if(i.length===0)return t.has(e.id)?`checked`:`unchecked`;let a=i.filter(e=>t.has(e)).length;return a===0?`unchecked`:a===i.length?`checked`:`indeterminate`}function NH(e,t){if(e.length===0)return`unchecked`;let n=e.filter(e=>t.has(e)).length;return n===0?`unchecked`:n===e.length?`checked`:`indeterminate`}function PH(e,t,n,r){let i=MH(e,t,n,r),a=jH(e,n,r),o=e.isGroup?a:[e.id,...a],s=new Set(t);return i===`unchecked`?o.forEach(e=>s.add(e)):o.forEach(e=>s.delete(e)),s}function FH(e,t,n,r=!1){if(r)return t.filter(e=>!e.isGroup).map(e=>e.id);let i=(e,t)=>{let r=[];return e.forEach((e,a)=>{let o=t?`${t}.${a}`:`${a}`;r.push(o);let s=n?.(e,a);s&&s.length>0&&r.push(...i(s,o))}),r};return i(e)}function IH({children:e,initialData:t,columns:n,getSubRows:r,onDataChange:i,onSelectionChange:a,options:o={},addFormulaColumn:s}){let c=(0,d.useMemo)(()=>r&&t.some((e,t)=>{let n=r(e,t);return n&&n.length>0})?n.length>1?`table-tree`:`tree`:`table`,[r,t,n.length]),[l,u]=(0,d.useState)({dataState:t,sorting:[],grouping:[],expandedRows:new Set,displayMode:c,selectedRows:new Set,columnOrder:[],hiddenColumns:new Set,columnPinning:{}});(0,d.useEffect)(()=>{u(e=>({...e,dataState:t}))},[t]);let f=(0,d.useCallback)(e=>{u(t=>({...t,sorting:e}))},[]),p=(0,d.useCallback)(e=>{u(t=>({...t,grouping:e}))},[]),m=(0,d.useCallback)(e=>{u(t=>({...t,columnOrder:e}))},[]),g=(0,d.useCallback)(e=>{u(t=>({...t,selectedRows:e}))},[]),_=(0,d.useCallback)(e=>{u(t=>{let n=new Set(t.hiddenColumns);return n.has(e)?n.delete(e):n.add(e),{...t,hiddenColumns:n}})},[]),v=(0,d.useCallback)((e,t)=>{u(n=>({...n,columnPinning:{...n.columnPinning,[e]:t}}))},[]),y=(0,d.useCallback)(e=>{u(t=>{let n=new Set(t.expandedRows);return n.has(e)?n.delete(e):n.add(e),{...t,expandedRows:n}})},[]),b=(0,d.useCallback)((e,t,r)=>{u(a=>{let o=n.find(e=>(e.id||e.accessorKey)===t);if(!o||!o.accessorKey)return a;let s=a.dataState.indexOf(e);if(s===-1)return a;let c=[...a.dataState];return c[s]={...c[s],[o.accessorKey]:r},i&&i(c),{...a,dataState:c}})},[n,i]),x=(0,d.useCallback)(()=>{let e=bH(l.dataState,l.sorting,n);return l.grouping.length>0?CH(e,l.grouping,n,l.expandedRows):wH(e,r,l.expandedRows,c)},[l.dataState,l.sorting,l.grouping,l.expandedRows,n,r,c]),S=(0,d.useCallback)(e=>{u(t=>({...t,globalFilter:e}))},[]),C=(0,d.useRef)(!0);(0,d.useEffect)(()=>{if(C.current){C.current=!1;return}if(!a)return;let e=Array.from(l.selectedRows);a(e,l.dataState.filter((t,n)=>e.includes(String(n))))},[l.selectedRows]);let w=(0,d.useCallback)(e=>{u(t=>{let i=(()=>{let e=bH(t.dataState,t.sorting,n);return t.grouping.length>0?CH(e,t.grouping,n,t.expandedRows):wH(e,r,t.expandedRows,c)})(),a=PH(e,t.selectedRows,i,r);return{...t,selectedRows:a}})},[n,r,c]),T=(0,d.useCallback)(()=>{u(e=>{let t=(()=>{let t=bH(e.dataState,e.sorting,n);return e.grouping.length>0?CH(t,e.grouping,n,e.expandedRows):wH(t,r,e.expandedRows,c)})(),i=FH(e.dataState,t,r,e.grouping.length>0),a=i.every(t=>e.selectedRows.has(t))?new Set:new Set(i);return{...e,selectedRows:a}})},[n,r,c]),E=(0,d.useCallback)(e=>{let t=x();return MH(e,l.selectedRows,t,r)},[x,l.selectedRows,r]),D=(0,d.useCallback)(()=>{let e=x();return NH(FH(l.dataState,e,r,l.grouping.length>0),l.selectedRows)},[x,l.dataState,l.selectedRows,r,l.grouping]),O=(0,d.useMemo)(()=>{let e;if(l.columnOrder.length>0){let t=new Map(n.map((e,t)=>[xH(e,t),e])),r=l.columnOrder.flatMap(e=>{let n=t.get(e);return n?[n]:[]}),i=new Set(l.columnOrder),a=n.filter((e,t)=>!i.has(xH(e,t)));e=[...r,...a]}else e=[...n];if(l.hiddenColumns.size>0){let t=new Map(n.map((e,t)=>[e,t]));e=e.filter(e=>{let n=t.get(e)??0;return!l.hiddenColumns.has(xH(e,n))})}if(l.grouping.length>0){let t=new Set(l.grouping),r=new Map(n.map((e,t)=>[e,t]));return[{id:`__group__`,header:`Group`,minSize:200},...EH(e.filter(e=>{let n=r.get(e)??0;return!t.has(xH(e,n))}),l.columnPinning)]}return EH(e,l.columnPinning)},[l.grouping,l.columnOrder,l.hiddenColumns,l.columnPinning,n]),k=(0,d.useMemo)(()=>({data:l.dataState,columns:n,visibleColumns:O,getSubRows:r,state:l,displayMode:c,setSorting:f,setGrouping:p,toggleRowExpansion:y,updateCellValue:b,getRows:x,options:o,toggleRowSelection:w,toggleAllSelection:T,getRowSelectionState:E,getAllSelectionState:D,setGlobalFilter:S,setColumnOrder:m,toggleColumnVisibility:_,setPinColumn:v,setSelectedRows:g,addFormulaColumn:s}),[l,n,O,r,c,f,p,y,b,x,o,w,T,E,D,S,m,_,v,g,s]);return(0,h.jsx)(yH.Provider,{value:k,children:e})}function LH(){let e=(0,d.useContext)(yH);if(e===void 0)throw Error(`useTable must be used within a TableProvider`);return e}function RH(){return LH()}function zH(e,t){return e??t??!1}function BH(e,t){return e===`always`&&t}function VH(e){return e instanceof Date?(0,h.jsx)(T,{variant:`body`,children:e.toLocaleDateString()}):Array.isArray(e)?(0,h.jsx)(T,{variant:`body`,children:e.join(`, `)}):typeof e==`boolean`?(0,h.jsx)(A,{checked:e,disabled:!0}):typeof e==`number`&&e<0?(0,h.jsx)(T,{variant:`body`,color:`var(--rst-fontColor-danger)`,children:String(e)}):(0,h.jsx)(T,{variant:`body`,children:String(e??``)})}function HH(e,t){return n=>{n.key===`Enter`?(n.preventDefault(),e()):n.key===`Escape`&&(n.preventDefault(),t())}}var UH={"rst-button-group":`_rst-button-group_1q8r7_1`},WH=({options:e,value:t,onChange:n,size:r=`default`,disabled:i=!1,iconOnly:a=!1})=>{let[o,s]=(0,d.useState)(t),c=t??o,l=e=>{t||s(e),n?.(e)};return(0,h.jsx)(`div`,{className:UH[`rst-button-group`],"aria-disabled":i,children:e.map(e=>(0,h.jsx)(D,{value:a?void 0:e.value,leadingVisual:e.leadingVisual,variant:`invisible`,"aria-pressed":c===e.value,size:r,disabled:i||e.disabled,onClick:()=>l(e.value)},e.value))})},Z={"rst-date-input":`_rst-date-input_31mz7_3`,"rst-datepicker-icon-btn":`_rst-datepicker-icon-btn_31mz7_23`,"rst-datepicker-range-sep":`_rst-datepicker-range-sep_31mz7_46`,"rst-datepicker-popup":`_rst-datepicker-popup_31mz7_55`,"rst-datepicker-shortcuts":`_rst-datepicker-shortcuts_31mz7_67`,"rst-datepicker-shortcut-btn":`_rst-datepicker-shortcut-btn_31mz7_76`,"rst-datepicker-shortcut-active":`_rst-datepicker-shortcut-active_31mz7_93`,"rst-datepicker-calendar":`_rst-datepicker-calendar_31mz7_101`,"rst-datepicker-dual":`_rst-datepicker-dual_31mz7_109`,"rst-datepicker-header":`_rst-datepicker-header_31mz7_120`,"rst-datepicker-header-title":`_rst-datepicker-header-title_31mz7_127`,"rst-datepicker-nav-btn":`_rst-datepicker-nav-btn_31mz7_135`,"rst-datepicker-header-btn":`_rst-datepicker-header-btn_31mz7_158`,"rst-datepicker-weekdays":`_rst-datepicker-weekdays_31mz7_175`,"rst-datepicker-weekday":`_rst-datepicker-weekday_31mz7_175`,"rst-datepicker-days":`_rst-datepicker-days_31mz7_188`,"rst-datepicker-day":`_rst-datepicker-day_31mz7_188`,"rst-datepicker-day-selected":`_rst-datepicker-day-selected_31mz7_211`,"rst-datepicker-day-range-start":`_rst-datepicker-day-range-start_31mz7_211`,"rst-datepicker-day-range-end":`_rst-datepicker-day-range-end_31mz7_211`,"rst-datepicker-day-outside":`_rst-datepicker-day-outside_31mz7_215`,"rst-datepicker-day-today":`_rst-datepicker-day-today_31mz7_219`,"rst-datepicker-day-in-range":`_rst-datepicker-day-in-range_31mz7_242`,"rst-datepicker-grid":`_rst-datepicker-grid_31mz7_272`,"rst-datepicker-grid-item":`_rst-datepicker-grid-item_31mz7_279`,"rst-datepicker-grid-item-selected":`_rst-datepicker-grid-item-selected_31mz7_293`,"rst-datepicker-grid-item-in-range":`_rst-datepicker-grid-item-in-range_31mz7_302`,"rst-datepicker-grid-item-current":`_rst-datepicker-grid-item-current_31mz7_307`,"rst-datepicker-grid-4":`_rst-datepicker-grid-4_31mz7_317`,"rst-datepicker-grid-item-range-start":`_rst-datepicker-grid-item-range-start_31mz7_322`,"rst-datepicker-grid-item-range-end":`_rst-datepicker-grid-item-range-end_31mz7_328`};function GH(e,t){let n=(new Date(e,t,1).getDay()+6)%7,r=new Date(e,t,1-n),i=[];for(let e=0;e<42;e++)i.push(new Date(r.getFullYear(),r.getMonth(),r.getDate()+e));return i}var KH=[`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`,`Su`],qH=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],JH=[`Q1`,`Q2`,`Q3`,`Q4`];function YH(e){return Math.floor(e.getMonth()/3)}function XH(e,t){return new Date(e,t*3,1)}function ZH(e,t){return new Date(e,t*3+3,0)}function QH(e){return e?`${e.getDate().toString().padStart(2,`0`)}/${(e.getMonth()+1).toString().padStart(2,`0`)}/${e.getFullYear().toString().padStart(4,`0`)}`:``}function $H(e){return e?`${e.getDate().toString().padStart(2,`0`)}${(e.getMonth()+1).toString().padStart(2,`0`)}${e.getFullYear().toString().padStart(4,`0`)}`:``}function eU(e){let t=e.slice(0,8);return t.length===0?``:t.length<=2?t:t.length<=4?`${t.slice(0,2)}/${t.slice(2)}`:`${t.slice(0,2)}/${t.slice(2,4)}/${t.slice(4)}`}function tU(e){if(e.length!==8)return;let t=parseInt(e.slice(0,2),10),n=parseInt(e.slice(2,4),10)-1,r=parseInt(e.slice(4,8),10);if(n<0||n>11||t<1||t>31)return;let i=new Date(r,n,t);if(!(i.getMonth()!==n||i.getDate()!==t))return i}function nU(e){return e?`${qH[e.getMonth()]} ${e.getFullYear()}`:``}function rU(e){return e?`Q${YH(e)+1} ${e.getFullYear()}`:``}function iU(e){return e?e.getFullYear().toString():``}function aU(e,t){if(!e)return``;switch(t){case`day`:return QH(e);case`month`:return nU(e);case`quarter`:return rU(e);case`year`:return iU(e)}}function oU(e,t){return!e||!t?!1:e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function sU(e,t){return!e||!t?!1:e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()}function cU(e,t){return!e||!t?!1:e.getFullYear()===t.getFullYear()&&YH(e)===YH(t)}function lU(e,t){return!e||!t?!1:e.getFullYear()===t.getFullYear()}function uU(e,t,n){if(!t||!n)return!1;let r=e.getTime();return r>t.getTime()&&r<n.getTime()}function dU(e,t,n){if(!t||!n)return!1;let r=new Date(e.getFullYear(),e.getMonth(),1).getTime(),i=new Date(t.getFullYear(),t.getMonth(),1).getTime(),a=new Date(n.getFullYear(),n.getMonth(),1).getTime();return r>i&&r<a}function fU(e,t,n,r){if(!n||!r)return!1;let i=XH(e,t).getTime(),a=XH(n.getFullYear(),YH(n)).getTime(),o=XH(r.getFullYear(),YH(r)).getTime();return i>a&&i<o}function pU(e,t,n){return!t||!n?!1:e>t.getFullYear()&&e<n.getFullYear()}function mU(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())}function hU(e){let t=(e.getDay()+6)%7;return new Date(e.getFullYear(),e.getMonth(),e.getDate()-t)}function gU(e){let t=hU(e);return new Date(t.getFullYear(),t.getMonth(),t.getDate()+6)}function _U(e){return new Date(e.getFullYear(),e.getMonth(),1)}function vU(e){return new Date(e.getFullYear(),e.getMonth()+1,0)}function yU(e){return new Date(e.getFullYear(),0,1)}function bU(e){return new Date(e.getFullYear(),11,31)}function xU(e,t){return new Date(e.getFullYear(),e.getMonth(),e.getDate()+t)}function SU(e,t){return new Date(e.getFullYear(),e.getMonth()+t,1)}function CU(e,t){return new Date(e.getFullYear()+t,e.getMonth(),e.getDate())}var wU=({viewDate:e,onViewDateChange:t,selectedDate:n,rangeStart:r,rangeEnd:i,hoveredDate:a,onHover:o,onSelect:s,mode:c,onModeChange:l})=>{let u=new Date,d=i??a;if(c===`day`){let i=GH(e.getFullYear(),e.getMonth()),a=t=>{let i=[Z[`rst-datepicker-day`]];if(t.getMonth()!==e.getMonth()&&i.push(Z[`rst-datepicker-day-outside`]),oU(t,u)&&i.push(Z[`rst-datepicker-day-today`]),r&&d){let e=r<d?r:d,n=r<d?d:r;oU(t,e)?i.push(Z[`rst-datepicker-day-range-start`]):oU(t,n)?i.push(Z[`rst-datepicker-day-range-end`]):uU(t,e,n)&&i.push(Z[`rst-datepicker-day-in-range`])}else oU(t,n)&&i.push(Z[`rst-datepicker-day-selected`]);return i.join(` `)};return(0,h.jsxs)(`div`,{className:Z[`rst-datepicker-calendar`],children:[(0,h.jsxs)(`div`,{className:Z[`rst-datepicker-header`],children:[(0,h.jsx)(`button`,{className:Z[`rst-datepicker-nav-btn`],onClick:()=>t(SU(e,-1)),"aria-label":`Previous month`,children:`‹`}),(0,h.jsxs)(`div`,{className:Z[`rst-datepicker-header-title`],children:[(0,h.jsx)(`button`,{className:Z[`rst-datepicker-header-btn`],onClick:()=>l(`month`),children:qH[e.getMonth()]}),(0,h.jsx)(`button`,{className:Z[`rst-datepicker-header-btn`],onClick:()=>l(`year`),children:e.getFullYear()})]}),(0,h.jsx)(`button`,{className:Z[`rst-datepicker-nav-btn`],onClick:()=>t(SU(e,1)),"aria-label":`Next month`,children:`›`})]}),(0,h.jsx)(`div`,{className:Z[`rst-datepicker-weekdays`],children:KH.map(e=>(0,h.jsx)(`div`,{className:Z[`rst-datepicker-weekday`],children:e},e))}),(0,h.jsx)(`div`,{className:Z[`rst-datepicker-days`],children:i.map((e,t)=>(0,h.jsx)(`button`,{className:a(e),onClick:()=>s(e),onMouseEnter:()=>o?.(e),onMouseLeave:()=>o?.(void 0),"aria-label":e.toLocaleDateString(),"aria-pressed":oU(e,n),children:e.getDate()},t))})]})}if(c===`month`){let i=t=>{let i=[Z[`rst-datepicker-grid-item`]],a=new Date(e.getFullYear(),t,1);if(r&&d){let e=r<d?r:d,t=r<d?d:r;sU(a,e)?i.push(Z[`rst-datepicker-grid-item-range-start`]):sU(a,t)?i.push(Z[`rst-datepicker-grid-item-range-end`]):dU(a,e,t)&&i.push(Z[`rst-datepicker-grid-item-in-range`])}else sU(a,n)&&i.push(Z[`rst-datepicker-grid-item-selected`]);return a.getMonth()===u.getMonth()&&a.getFullYear()===u.getFullYear()&&i.push(Z[`rst-datepicker-grid-item-current`]),i.join(` `)};return(0,h.jsxs)(`div`,{className:Z[`rst-datepicker-calendar`],children:[(0,h.jsxs)(`div`,{className:Z[`rst-datepicker-header`],children:[(0,h.jsx)(`button`,{className:Z[`rst-datepicker-nav-btn`],onClick:()=>t(CU(e,-1)),"aria-label":`Previous year`,children:`‹`}),(0,h.jsx)(`div`,{className:Z[`rst-datepicker-header-title`],children:(0,h.jsx)(`button`,{className:Z[`rst-datepicker-header-btn`],onClick:()=>l(`year`),children:e.getFullYear()})}),(0,h.jsx)(`button`,{className:Z[`rst-datepicker-nav-btn`],onClick:()=>t(CU(e,1)),"aria-label":`Next year`,children:`›`})]}),(0,h.jsx)(`div`,{className:Z[`rst-datepicker-grid`],children:qH.map((t,n)=>(0,h.jsx)(`button`,{className:i(n),onClick:()=>s(new Date(e.getFullYear(),n,1)),onMouseEnter:()=>o?.(new Date(e.getFullYear(),n,1)),onMouseLeave:()=>o?.(void 0),children:t},n))})]})}if(c===`quarter`){let i=t=>{let i=[Z[`rst-datepicker-grid-item`]],a=XH(e.getFullYear(),t);if(r&&d){let n=r<d?r:d,o=r<d?d:r;cU(a,n)?i.push(Z[`rst-datepicker-grid-item-range-start`]):cU(a,o)?i.push(Z[`rst-datepicker-grid-item-range-end`]):fU(e.getFullYear(),t,n,o)&&i.push(Z[`rst-datepicker-grid-item-in-range`])}else cU(a,n)&&i.push(Z[`rst-datepicker-grid-item-selected`]);return e.getFullYear()===u.getFullYear()&&t===YH(u)&&i.push(Z[`rst-datepicker-grid-item-current`]),i.join(` `)};return(0,h.jsxs)(`div`,{className:Z[`rst-datepicker-calendar`],children:[(0,h.jsxs)(`div`,{className:Z[`rst-datepicker-header`],children:[(0,h.jsx)(`button`,{className:Z[`rst-datepicker-nav-btn`],onClick:()=>t(CU(e,-1)),"aria-label":`Previous year`,children:`‹`}),(0,h.jsx)(`div`,{className:Z[`rst-datepicker-header-title`],children:(0,h.jsx)(`button`,{className:Z[`rst-datepicker-header-btn`],onClick:()=>l(`year`),children:e.getFullYear()})}),(0,h.jsx)(`button`,{className:Z[`rst-datepicker-nav-btn`],onClick:()=>t(CU(e,1)),"aria-label":`Next year`,children:`›`})]}),(0,h.jsx)(`div`,{className:`${Z[`rst-datepicker-grid`]} ${Z[`rst-datepicker-grid-4`]}`,children:JH.map((t,n)=>(0,h.jsx)(`button`,{className:i(n),onClick:()=>s(XH(e.getFullYear(),n)),onMouseEnter:()=>o?.(XH(e.getFullYear(),n)),onMouseLeave:()=>o?.(void 0),children:t},n))})]})}let f=Math.floor(e.getFullYear()/12)*12,p=Array.from({length:12},(e,t)=>f+t),m=e=>{let t=[Z[`rst-datepicker-grid-item`]],i=new Date(e,0,1);if(r&&d){let n=r<d?r:d,a=r<d?d:r;lU(i,n)?t.push(Z[`rst-datepicker-grid-item-range-start`]):lU(i,a)?t.push(Z[`rst-datepicker-grid-item-range-end`]):pU(e,n,a)&&t.push(Z[`rst-datepicker-grid-item-in-range`])}else lU(i,n)&&t.push(Z[`rst-datepicker-grid-item-selected`]);return e===u.getFullYear()&&t.push(Z[`rst-datepicker-grid-item-current`]),t.join(` `)};return(0,h.jsxs)(`div`,{className:Z[`rst-datepicker-calendar`],children:[(0,h.jsxs)(`div`,{className:Z[`rst-datepicker-header`],children:[(0,h.jsx)(`button`,{className:Z[`rst-datepicker-nav-btn`],onClick:()=>t(new Date(f-12,0,1)),"aria-label":`Previous decade`,children:`‹`}),(0,h.jsx)(`div`,{className:Z[`rst-datepicker-header-title`],children:(0,h.jsxs)(`span`,{style:{font:`var(--rst-font-body)`,fontWeight:600,color:`var(--rst-fontColor-default)`},children:[f,` – `,f+11]})}),(0,h.jsx)(`button`,{className:Z[`rst-datepicker-nav-btn`],onClick:()=>t(new Date(f+12,0,1)),"aria-label":`Next decade`,children:`›`})]}),(0,h.jsx)(`div`,{className:Z[`rst-datepicker-grid`],children:p.map(e=>(0,h.jsx)(`button`,{className:m(e),onClick:()=>s(new Date(e,0,1)),onMouseEnter:()=>o?.(new Date(e,0,1)),onMouseLeave:()=>o?.(void 0),children:e},e))})]})};function TU(){let e=new Date;return[{label:`Today`,getValue:()=>mU(e)},{label:`Yesterday`,getValue:()=>xU(mU(e),-1)},{label:`Tomorrow`,getValue:()=>xU(mU(e),1)}]}function EU(){let e=new Date,t=YH(e);return[{label:`Today`,getValue:()=>({from:mU(e),to:mU(e)})},{label:`This week`,getValue:()=>({from:hU(e),to:gU(e)})},{label:`Last week`,getValue:()=>({from:hU(xU(e,-7)),to:gU(xU(e,-7))})},{label:`Last 7 days`,getValue:()=>({from:xU(mU(e),-6),to:mU(e)})},{label:`Last 30 days`,getValue:()=>({from:xU(mU(e),-29),to:mU(e)})},{label:`This month`,getValue:()=>({from:_U(e),to:vU(e)})},{label:`Last month`,getValue:()=>({from:_U(SU(e,-1)),to:vU(SU(e,-1))})},{label:`This quarter`,getValue:()=>({from:XH(e.getFullYear(),t),to:ZH(e.getFullYear(),t)})},{label:`Last quarter`,getValue:()=>{let n=t===0?3:t-1,r=t===0?e.getFullYear()-1:e.getFullYear();return{from:XH(r,n),to:ZH(r,n)}}},{label:`This year`,getValue:()=>({from:yU(e),to:bU(e)})},{label:`Last year`,getValue:()=>({from:yU(CU(e,-1)),to:bU(CU(e,-1))})}]}var DU=({rangeMode:e,onSelectSingle:t,onSelectRange:n})=>{if(e){let e=EU();return(0,h.jsx)(`div`,{className:Z[`rst-datepicker-shortcuts`],children:e.map(e=>(0,h.jsx)(`button`,{className:Z[`rst-datepicker-shortcut-btn`],onClick:()=>n(e.getValue()),type:`button`,children:e.label},e.label))})}let r=TU();return(0,h.jsx)(`div`,{className:Z[`rst-datepicker-shortcuts`],children:r.map(e=>(0,h.jsx)(`button`,{className:Z[`rst-datepicker-shortcut-btn`],onClick:()=>t(e.getValue()),type:`button`,children:e.label},e.label))})},OU=({value:e,mode:t,onRangeChange:n,onOpen:r,error:i,leadingIcon:a,size:o,disabled:s,isReadOnly:c,onBlur:l,className:u})=>{let f=(0,d.useRef)(null),p=(0,d.useRef)(null),[m,g]=(0,d.useState)(()=>t===`day`?$H(e.from):``),[_,v]=(0,d.useState)(()=>t===`day`?$H(e.to):``);(0,d.useEffect)(()=>{t===`day`&&g($H(e.from))},[e.from,t]),(0,d.useEffect)(()=>{t===`day`&&v($H(e.to))},[e.to,t]);let y=r=>{if(t!==`day`)return;let i=r.target.value.replace(/\D/g,``).slice(0,8),a=m.length;if(g(i),i.length===2&&a<2?requestAnimationFrame(()=>f.current?.setSelectionRange(3,3)):i.length===4&&a<4&&requestAnimationFrame(()=>f.current?.setSelectionRange(6,6)),i.length===8){let t=tU(i);n({from:t,to:e.to}),t&&requestAnimationFrame(()=>p.current?.focus())}else i.length===0&&n({from:void 0,to:e.to})},x=r=>{if(t!==`day`)return;let i=r.target.value.replace(/\D/g,``).slice(0,8),a=_.length;v(i),i.length===2&&a<2?requestAnimationFrame(()=>p.current?.setSelectionRange(3,3)):i.length===4&&a<4&&requestAnimationFrame(()=>p.current?.setSelectionRange(6,6)),i.length===8?n({from:e.from,to:tU(i)}):i.length===0&&n({from:e.from,to:void 0})},S=()=>{t===`day`&&m.length>0&&m.length<8&&g($H(e.from)),l?.()},C=()=>{t===`day`&&_.length>0&&_.length<8&&v($H(e.to)),l?.()},w=()=>{!s&&!c&&r()},T=c||t!==`day`;return(0,h.jsx)(_V,{error:i,leadingIcon:a,size:o,disabled:s,className:u,children:({disabled:e})=>(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`input`,{ref:f,type:`text`,placeholder:`DD/MM/YYYY`,value:eU(m),className:`${gV[`rst-input`]} ${Z[`rst-date-input`]}`,onChange:y,onBlur:S,disabled:e,readOnly:T,inputMode:`numeric`,autoComplete:`off`,style:{flex:1,width:`auto`},onClick:w,size:10}),(0,h.jsx)(b,{src:`arrow-right`,disabled:e}),(0,h.jsx)(`input`,{ref:p,type:`text`,placeholder:`DD/MM/YYYY`,value:eU(_),className:`${gV[`rst-input`]} ${Z[`rst-date-input`]}`,onChange:x,onBlur:C,disabled:e,readOnly:T,inputMode:`numeric`,autoComplete:`off`,style:{flex:1,width:`auto`},onClick:w,size:10}),(0,h.jsx)(D,{variant:`invisible`,"aria-label":`Open calendar`,onClick:w,disabled:e||T,type:`button`,tabIndex:-1,leadingVisual:`calendar`})]})})},kU=({value:e,onChange:t,mode:n=`day`,shortcuts:r=!1,readOnly:i,disabled:a,...o})=>{let[s,c]=(0,d.useState)(!1),[l,u]=(0,d.useState)(void 0),[f,p]=(0,d.useState)(null),[m,g]=(0,d.useState)(()=>e.from??new Date),[_,v]=(0,d.useState)(()=>e.from?SU(e.from,1):SU(new Date,1)),[y,b]=(0,d.useState)(n),x=()=>{!a&&!i&&(c(!0),p(`start`))},S=r=>{if(y!==n){b(n);return}if(f===`start`||!f)t({from:r,to:void 0}),p(`end`);else{let n=e.from;t(r<n?{from:r,to:n}:{from:n,to:r}),p(null),c(!1)}},C=e=>{t(e),p(null),c(!1)},w=e=>{g(e),n===`day`&&e>=_&&v(SU(e,1))},T=e=>{v(e),n===`day`&&e<=m&&g(SU(e,-1))};return(0,h.jsx)(M,{isOpen:s&&!a&&!i,onClose:()=>{c(!1),p(null)},position:`center`,align:`bottom`,anchor:(0,h.jsx)(OU,{...o,value:e,mode:n,onRangeChange:t,onOpen:x,disabled:a,isReadOnly:i}),target:(0,h.jsxs)(`div`,{className:Z[`rst-datepicker-popup`],children:[r&&(0,h.jsx)(DU,{pickerMode:n,rangeMode:!0,onSelectSingle:()=>{},onSelectRange:C}),(0,h.jsxs)(`div`,{className:Z[`rst-datepicker-dual`],children:[(0,h.jsx)(wU,{viewDate:m,onViewDateChange:w,rangeStart:e.from,rangeEnd:f===`end`?l??e.to:e.to,hoveredDate:f===`end`?l:void 0,onHover:u,onSelect:S,mode:y,onModeChange:b}),n===`day`&&(0,h.jsx)(wU,{viewDate:_,onViewDateChange:T,rangeStart:e.from,rangeEnd:f===`end`?l??e.to:e.to,hoveredDate:f===`end`?l:void 0,onHover:u,onSelect:S,mode:y,onModeChange:b})]})]})})},AU={SELECT:`SELECT`,BUTTON_GROUP:`BUTTON_GROUP`,TEXT:`TEXT`,NUMBER:`NUMBER`,DATE:`DATE`,DATE_RANGE:`DATE_RANGE`},jU=({value:e,mode:t,onDateChange:n,onOpen:r,autoFocus:i,placeholder:a,error:o,leadingIcon:s,size:c,disabled:l,readOnly:u,onBlur:f,onKeyDown:p,className:m})=>{let g=(0,d.useRef)(null),[_,v]=(0,d.useState)(()=>t===`day`?$H(e):``);(0,d.useEffect)(()=>{t===`day`&&v($H(e))},[e,t]);let y=a??(t===`day`?`DD/MM/YYYY`:t===`month`?`MMM YYYY`:t===`quarter`?`Qn YYYY`:`YYYY`),b=t===`day`?eU(_):aU(e,t),x=e=>{if(t!==`day`)return;let r=e.target.value.replace(/\D/g,``).slice(0,8),i=_.length;v(r),r.length===2&&i<2?requestAnimationFrame(()=>g.current?.setSelectionRange(3,3)):r.length===4&&i<4&&requestAnimationFrame(()=>g.current?.setSelectionRange(6,6)),r.length===8?n(tU(r)):r.length===0&&n(void 0)},S=()=>{t===`day`&&_.length>0&&_.length<8&&v($H(e)),f?.()},C=()=>{!l&&!u&&r()};return(0,h.jsx)(_V,{error:o,leadingIcon:s,size:c,disabled:l,className:m,children:({id:e,disabled:n})=>(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`input`,{ref:g,id:e,type:`text`,value:b,disabled:n,autoFocus:i,placeholder:y,className:`${gV[`rst-input`]} ${Z[`rst-date-input`]}`,onChange:x,onBlur:S,onKeyDown:p,readOnly:u||t!==`day`,inputMode:`numeric`,autoComplete:`off`,onClick:C,size:10}),(0,h.jsx)(D,{variant:`invisible`,"aria-label":`Open calendar`,onClick:C,disabled:n||u,type:`button`,tabIndex:-1,leadingVisual:`calendar`})]})})},MU=({value:e,onChange:t,mode:n=`day`,shortcuts:r=!1,readOnly:i,disabled:a,...o})=>{let[s,c]=(0,d.useState)(!1),[l,u]=(0,d.useState)(()=>e??new Date),[f,p]=(0,d.useState)(n),m=e=>{t(e),f===n?c(!1):p(n)},g=e=>{p(e)},_=e=>{t(e),c(!1)};return(0,h.jsx)(M,{isOpen:s&&!a&&!i,onClose:()=>c(!1),position:`center`,align:`bottom`,anchor:(0,h.jsx)(jU,{...o,value:e,mode:n,onDateChange:t,onOpen:()=>!a&&!i&&c(!0),disabled:a,readOnly:i}),target:(0,h.jsxs)(`div`,{className:Z[`rst-datepicker-popup`],children:[r&&(0,h.jsx)(DU,{pickerMode:n,rangeMode:!1,onSelectSingle:_,onSelectRange:()=>{}}),(0,h.jsx)(wU,{viewDate:l,onViewDateChange:u,selectedDate:e,onSelect:m,mode:f,onModeChange:g})]})})};function NU(e,t,n,r,i,a,o,s,c,l){if(`options`in t&&t.options)switch(t.cellType){case AU.SELECT:return(0,h.jsx)(SV,{value:String(e??``),options:t.options,onChange:e=>i(e),disabled:c});case AU.BUTTON_GROUP:return(0,h.jsx)(WH,{value:String(e??``),options:t.options,onChange:e=>i(e),size:`small`,disabled:c});default:return(0,h.jsx)(SV,{value:String(e??``),options:t.options,onChange:e=>i(e),disabled:c})}return e==null?t.cellType===AU.NUMBER?(0,h.jsx)(MV,{value:void 0,onChange:e=>n(e),onBlur:r,onKeyDown:a,autoFocus:o,className:l,error:s,disabled:c}):(0,h.jsx)(vV,{value:``,onChange:e=>n(e),onBlur:r,onKeyDown:a,autoFocus:o,className:l,error:s,disabled:c}):typeof e==`string`?(0,h.jsx)(vV,{value:e,onChange:e=>n(e),onBlur:r,onKeyDown:a,autoFocus:o,error:s,disabled:c}):typeof e==`number`?(0,h.jsx)(MV,{value:e,onChange:e=>n(e),onBlur:r,onKeyDown:a,autoFocus:o,className:l,error:s,disabled:c}):typeof e==`boolean`?(0,h.jsx)(A,{checked:e,onChange:e=>i(e),className:l,disabled:c}):t.cellType===AU.DATE_RANGE?(0,h.jsx)(kU,{value:e??{from:null,to:null},onChange:e=>i(e),className:l,error:s,disabled:c,shortcuts:!0}):e instanceof Date?(0,h.jsx)(MU,{value:e,onChange:e=>n(e),onBlur:r,onKeyDown:a,autoFocus:o,className:l,error:s,disabled:c}):(0,h.jsx)(vV,{value:e,onChange:e=>n(e),onBlur:r,onKeyDown:a,autoFocus:o,className:l,disabled:c})}var PU={"rst-helper-text":`_rst-helper-text_1vzvn_1`,"rst-helper-text-success":`_rst-helper-text-success_1vzvn_9`,"rst-helper-text-danger":`_rst-helper-text-danger_1vzvn_13`},FU=({id:e,helperText:t,disabled:n,state:r})=>{let i=r==`success`?`check`:r==`warning`?`warning`:`error`;return(0,h.jsxs)(T,{variant:`caption`,id:e,"aria-live":`polite`,className:{helperText:` ${PU[`rst-helper-text`]} ${r?PU[`rst-helper-text-${r}`]:``}`}.helperText,"aria-disabled":n,children:[r&&(0,h.jsx)(b,{src:i,state:r,disabled:n}),t]})},IU=({value:e,column:t,rowData:n,editMode:r=`doubleClick`,isEditable:i,error:a,disabled:o=!1,showLabel:s=!0,showHelperText:c=!0,onValueChange:l,onEditStart:u,onEditEnd:f})=>{let p=zH(i,t.enableEditing),m=BH(r,p),g=!p||r===`never`,[_,v]=(0,d.useState)(e),[y,b]=(0,d.useState)(m),x=t.id||String(t.accessorKey),S=t.header;(0,d.useEffect)(()=>{v(e)},[e]);let C=(0,d.useCallback)(()=>{!p||o||(b(!0),u?.(n,t))},[p,o,u,n,t]),w=(0,d.useCallback)(()=>{_!==e&&l&&l(_,n,t),m||(b(!1),f?.(n,t))},[_,e,t,n,l,m,f]),T=(0,d.useCallback)(()=>{v(e),m||(b(!1),f?.(n,t))},[e,m,f,n,t]),E=(0,d.useCallback)(e=>{v(e),l&&l(e,n,t)},[l,n,t]),D=HH(w,T),O=r===`click`?C:void 0,k=r===`doubleClick`?C:void 0;return g||o?(0,h.jsx)(`div`,{style:{opacity:o?.5:1,cursor:o?`not-allowed`:`default`},children:VH(_)}):m||y?(0,h.jsxs)(`div`,{children:[s&&S&&(0,h.jsx)(PV,{label:S,id:x,required:t.required,disabled:o}),NU(_,t,v,w,E,D,!m,a,o),c&&a&&(0,h.jsx)(FU,{helperText:a,id:x,disabled:o,state:`base`})]}):(0,h.jsx)(`div`,{onClick:o?void 0:O,onDoubleClick:o?void 0:k,style:{cursor:o?`not-allowed`:`pointer`,opacity:o?.5:1},children:_==null||_===``?(0,h.jsx)(`span`,{style:{color:`var(--rst-fontColor-disabled)`,display:`block`,minHeight:`1.25em`},children:`—`}):VH(_)})},LU=class{input;position;length;constructor(e){this.input=e,this.position=0,this.length=e.length}tokenize(){let e=[];for(;this.position<this.length;){let t=this.input[this.position];if(/\s/.test(t)){this.position++;continue}if(this.isDigit(t)){e.push(this.readNumber());continue}if(this.isAlpha(t)){e.push(this.readIdentifierOrKeyword());continue}if(t===`"`||t===`'`){e.push(this.readString(t));continue}if(this.isOperatorStart(t)){e.push(this.readOperator());continue}if(t===`(`){e.push({type:`LPAREN`,value:`(`,position:this.position++});continue}if(t===`)`){e.push({type:`RPAREN`,value:`)`,position:this.position++});continue}if(t===`,`){e.push({type:`COMMA`,value:`,`,position:this.position++});continue}throw Error(`Unexpected character: ${t} at position ${this.position}`)}return e.push({type:`EOF`,value:``,position:this.position}),e}isDigit(e){return/[0-9]/.test(e)}isAlpha(e){return/[a-zA-Z_]/.test(e)}isOperatorStart(e){return/[+\-*/%><=!&|]/.test(e)}readNumber(){let e=this.position,t=!1;for(;this.position<this.length;){let e=this.input[this.position];if(this.isDigit(e))this.position++;else if(e===`.`&&!t)t=!0,this.position++;else break}return{type:`NUMBER`,value:this.input.slice(e,this.position),position:e}}readIdentifierOrKeyword(){let e=this.position;for(;this.position<this.length&&(this.isAlpha(this.input[this.position])||this.isDigit(this.input[this.position]));)this.position++;let t=this.input.slice(e,this.position);return[`AND`,`OR`,`NOT`].includes(t.toUpperCase())?{type:`OPERATOR`,value:t.toUpperCase(),position:e}:{type:`IDENTIFIER`,value:t,position:e}}readString(e){let t=this.position;for(this.position++;this.position<this.length&&this.input[this.position]!==e;)this.position++;if(this.position>=this.length)throw Error(`Unterminated string literal`);return this.position++,{type:`STRING`,value:this.input.slice(t+1,this.position-1),position:t}}readOperator(){let e=this.position,t=this.input[this.position];return(t===`>`||t===`<`||t===`!`||t===`=`)&&this.input[this.position+1]===`=`?(this.position+=2,{type:`OPERATOR`,value:t+`=`,position:e}):t===`&`&&this.input[this.position+1]===`&`?(this.position+=2,{type:`OPERATOR`,value:`&&`,position:e}):t===`|`&&this.input[this.position+1]===`|`?(this.position+=2,{type:`OPERATOR`,value:`||`,position:e}):(this.position++,{type:`OPERATOR`,value:t,position:e})}},RU=class{tokens;current=0;constructor(e){this.tokens=e}parse(){let e=this.expression();if(!this.isAtEnd())throw Error(`Unexpected trailing tokens at position ${this.peek().position}: '${this.peek().value}'`);return e}expression(){return this.logicalOr()}logicalOr(){let e=this.logicalAnd();for(;this.match(`OPERATOR`,`OR`)||this.match(`OPERATOR`,`||`);){let t=this.previous().value,n=this.logicalAnd();e={type:`BinaryExpression`,operator:t,left:e,right:n}}return e}logicalAnd(){let e=this.equality();for(;this.match(`OPERATOR`,`AND`)||this.match(`OPERATOR`,`&&`);){let t=this.previous().value,n=this.equality();e={type:`BinaryExpression`,operator:t,left:e,right:n}}return e}equality(){let e=this.relational();for(;this.match(`OPERATOR`,`==`)||this.match(`OPERATOR`,`!=`);){let t=this.previous().value,n=this.relational();e={type:`BinaryExpression`,operator:t,left:e,right:n}}return e}relational(){let e=this.additive();for(;this.match(`OPERATOR`,`>`)||this.match(`OPERATOR`,`<`)||this.match(`OPERATOR`,`>=`)||this.match(`OPERATOR`,`<=`);){let t=this.previous().value,n=this.additive();e={type:`BinaryExpression`,operator:t,left:e,right:n}}return e}additive(){let e=this.multiplicative();for(;this.match(`OPERATOR`,`+`)||this.match(`OPERATOR`,`-`);){let t=this.previous().value,n=this.multiplicative();e={type:`BinaryExpression`,operator:t,left:e,right:n}}return e}multiplicative(){let e=this.unary();for(;this.match(`OPERATOR`,`*`)||this.match(`OPERATOR`,`/`)||this.match(`OPERATOR`,`%`);){let t=this.previous().value,n=this.unary();e={type:`BinaryExpression`,operator:t,left:e,right:n}}return e}unary(){return this.match(`OPERATOR`,`-`)||this.match(`OPERATOR`,`!`)||this.match(`OPERATOR`,`NOT`)?{type:`UnaryExpression`,operator:this.previous().value,argument:this.unary()}:this.primary()}primary(){if(this.match(`NUMBER`))return{type:`Literal`,value:parseFloat(this.previous().value),raw:this.previous().value};if(this.match(`STRING`))return{type:`Literal`,value:this.previous().value,raw:this.previous().value};if(this.match(`IDENTIFIER`))return{type:`Identifier`,name:this.previous().value};if(this.match(`LPAREN`)){let e=this.expression();return this.consume(`RPAREN`,`Expect ')' after expression.`),e}throw Error(`Expect expression at position ${this.peek().position}. Found ${this.peek().type} '${this.peek().value}'`)}match(e,t){return this.check(e,t)?(this.advance(),!0):!1}check(e,t){if(this.isAtEnd())return!1;let n=this.peek();return!(n.type!==e||t!==void 0&&n.value!==t)}advance(){return this.isAtEnd()||this.current++,this.previous()}isAtEnd(){return this.peek().type===`EOF`}peek(){return this.tokens[this.current]}previous(){return this.tokens[this.current-1]}consume(e,t){if(this.check(e))return this.advance();throw Error(t)}},zU=class{context;constructor(e){this.context=e}evaluate(e){switch(e.type){case`Literal`:return e.value;case`Identifier`:return this.evaluateIdentifier(e);case`BinaryExpression`:return this.evaluateBinary(e);case`UnaryExpression`:return this.evaluateUnary(e);default:throw Error(`Unknown node type: ${e.type}`)}}evaluateIdentifier(e){let t=this.context[e.name];return t===void 0?null:t}evaluateBinary(e){let t=this.evaluate(e.left),n=this.evaluate(e.right);switch(e.operator){case`+`:return this.toNumber(t)+this.toNumber(n);case`-`:return this.toNumber(t)-this.toNumber(n);case`*`:return this.toNumber(t)*this.toNumber(n);case`/`:{let e=this.toNumber(n);return e===0?1/0:this.toNumber(t)/e}case`%`:return this.toNumber(t)%this.toNumber(n);case`>`:return t>n;case`<`:return t<n;case`>=`:return t>=n;case`<=`:return t<=n;case`==`:return t==n;case`!=`:return t!=n;case`&&`:return!!t&&!!n;case`||`:return!!t||!!n;default:throw Error(`Unknown operator: ${e.operator}`)}}evaluateUnary(e){let t=this.evaluate(e.argument);switch(e.operator){case`-`:return-this.toNumber(t);case`!`:return!t;default:throw Error(`Unknown unary operator: ${e.operator}`)}}toNumber(e){if(typeof e==`number`)return e;if(e==null)return 0;let t=parseFloat(String(e));return isNaN(t)?0:t}},BU=class{static cache=new Map;static parse(e){if(this.cache.has(e))return this.cache.get(e);let t=new RU(new LU(e).tokenize()).parse();return this.cache.set(e,t),t}static evaluate(e,t){try{let n=this.parse(e);return new zU(t).evaluate(n)}catch(t){return console.error(`Error evaluating formula "${e}":`,t),null}}static validate(e){try{return this.parse(e),{valid:!0}}catch(e){return{valid:!1,error:e instanceof Error?e.message:String(e)}}}};function VU(e,t){if(e.formula)return BU.evaluate(e.formula,t);if(e.accessorFn)return e.accessorFn(t);if(e.accessorKey)return t[e.accessorKey]}function HU(e,t){if(t.length===0)return;let n=t.map(t=>VU(e,t));if(n.every(e=>typeof e==`number`))return n.reduce((e,t)=>e+t,0)}function UU({row:e,onRowClick:t,isEnableEditing:n=!1,"aria-rowindex":r,columnOffsets:i}){let{visibleColumns:a,toggleRowExpansion:o,getSubRows:s,updateCellValue:c,displayMode:l,options:u,toggleRowSelection:d,getRowSelectionState:f}=RH(),p=a,m=e.isGroup,g=s?(s(e.data,e.index)?.length||0)>0:!1,_=l===`table-tree`&&g,v=u.enableSelection,y=v?f(e):`unchecked`,b=y===`checked`,x=v&&OH(i??{}),S=()=>{m?o(e.id):t?.(e.data,e.index)},C=(t,n,r)=>{let i=r.id||String(r.accessorKey);c(e.data,i,t)};return(0,h.jsxs)(`tr`,{className:[X[`rst-table-row`],m?X[`rst-table-row-group`]:X[`rst-table-row-${l}`],b?X[`rst-table-row-selected`]:``].filter(Boolean).join(` `),onClick:S,"aria-rowindex":r,"aria-selected":v?b:void 0,children:[v&&(0,h.jsx)(`td`,{className:[X[`rst-table-cell`],X[`rst-table-selection-cell`],x?X[`rst-table-cell-pinned`]:``].filter(Boolean).join(` `),style:x?{left:0}:void 0,children:(0,h.jsx)(`div`,{className:X[`rst-table-cell-wrapper`],children:(0,h.jsx)(A,{checked:y===`checked`,indeterminate:y===`indeterminate`,onChange:()=>d(e),"aria-label":`Select row ${e.id}`})})}),p.map((t,r)=>{let a=r===0,s=t.id===`__group__`,c=xH(t,r),l=i?.[c],u=!!l&&l.left!==void 0,d=!!l&&l.right!==void 0,f=u||d,p=f?{left:l.left,right:l.right}:{},g=s?void 0:m&&e.groupItems?HU(t,e.groupItems):VU(t,e.data);return(0,h.jsx)(`td`,{className:`${X[`rst-table-cell`]} ${f?X[`rst-table-cell-pinned`]:``} ${u?X[`rst-table-cell-pinned-left`]:``} ${d?X[`rst-table-cell-pinned-right`]:``} ${m?X[`rst-table-cell-group`]:``}`,style:{paddingLeft:a?`${e.depth*24+(m?16:4)}px`:void 0,...p},children:(0,h.jsxs)(`div`,{className:X[`rst-table-cell-wrapper`],children:[a&&(_||m)&&(0,h.jsx)(D,{onClick:t=>{t.stopPropagation(),o(e.id)},leadingVisual:e.isExpanded?`chevron-down`:`chevron-right`,variant:`invisible`}),m&&a&&(0,h.jsx)(`span`,{className:X[`rst-table-group-label`],children:String(e.groupingValue)}),!s&&(0,h.jsx)(IU,{value:g,column:t,rowData:e.data,rowIndex:e.index,editMode:!m&&n&&t.enableEditing!==!1?g==null||g===``?`click`:`doubleClick`:`never`,onValueChange:C,showHelperText:!1,showLabel:!1})]})},`${e.id}-${c}`)})]})}function WU({items:e,itemHeight:t,containerHeight:n,overscan:r=5}){let[i,a]=(0,d.useState)(0),o=(0,d.useRef)(null),s=e.length*t,c=Math.max(0,Math.floor(i/t)-r),l=Math.min(e.length-1,Math.floor((i+n)/t)+r),u=[];for(let n=c;n<=l;n++)u.push({item:e[n],index:n,offsetTop:n*t});let f=(0,d.useCallback)(e=>{let t=e.target.scrollTop;a(t)},[]);return{virtualItems:u,containerProps:{ref:o,style:{maxHeight:`${n}px`,overflowY:`auto`,position:`relative`,willChange:`transform`},onScroll:f},innerProps:{style:{height:`${s}px`,position:`relative`,width:`100%`}},scrollInfo:{scrollTop:i,viewportHeight:n,totalHeight:s,startIndex:c,endIndex:l},scrollToIndex:e=>{if(!o.current)return;let r=e*t,i=r+t,a=o.current,s=a.scrollTop,c=s+n;r<s?a.scrollTop=r:i>c&&(a.scrollTop=i-n)}}}function GU(e,t){if(e.length===0)return null;switch(t){case`sum`:return e.reduce((e,t)=>e+t,0);case`count`:return e.length;case`avg`:return e.reduce((e,t)=>e+t,0)/e.length;case`min`:return e.reduce((e,t)=>t<e?t:e,1/0);case`max`:return e.reduce((e,t)=>t>e?t:e,-1/0);default:return null}}function KU(e){return e==null?`—`:typeof e==`string`?e:Number.isInteger(e)?String(e):e.toFixed(2)}function qU({columnOffsets:e}){let{visibleColumns:t,data:n,options:r}=RH(),{stickyFooter:i,enableSelection:a}=r;if(!i)return null;let o=a&&OH(e),s=e=>{if(typeof e.footer==`function`)return e.footer({column:e});if(typeof e.footer==`object`&&e.footer!==null){let{aggregation:t}=e.footer,r=e.accessorKey;return r?KU(GU(t===`count`?n.map(()=>1):n.map(e=>Number(e[r])).filter(e=>!isNaN(e)),t)):e.footer.label??null}return e.footer??null};return(0,h.jsx)(`tfoot`,{className:`${X[`rst-table-footer`]} ${i?X[`rst-table-footer-sticky`]:``}`,children:(0,h.jsxs)(`tr`,{children:[a&&(0,h.jsx)(`td`,{className:[X[`rst-table-selection-cell`],o?X[`rst-table-cell-pinned`]:``].filter(Boolean).join(` `),style:o?{left:0}:void 0}),t.map((t,n)=>{let r=xH(t,n),i=e[r],a=!!i&&i.left!==void 0,o=!!i&&i.right!==void 0,c=a||o,l=c?{left:i.left,right:i.right}:{};return(0,h.jsx)(`td`,{className:[c?X[`rst-table-cell-pinned`]:``,a?X[`rst-table-cell-pinned-left`]:``,o?X[`rst-table-cell-pinned-right`]:``].filter(Boolean).join(` `),style:l,children:s(t)},r)})]})})}var JU={"rst-chip":`_rst-chip_1wj5n_1`,"rst-chip-variant-default":`_rst-chip-variant-default_1wj5n_20`,"rst-chip-variant-primary":`_rst-chip-variant-primary_1wj5n_26`,"rst-chip-variant-outline":`_rst-chip-variant-outline_1wj5n_31`,"rst-chip-size-small":`_rst-chip-size-small_1wj5n_37`,"rst-chip-size-default":`_rst-chip-size-default_1wj5n_41`},YU=d.default.forwardRef(({children:e,leadingVisual:t,trailingVisual:n,onRemove:r,variant:i=`default`,size:a=`small`,className:o,draggable:s,onDragStart:c,onDragOver:l,onDragEnd:u,...d},f)=>(0,h.jsxs)(`div`,{"data-component":`chip`,ref:f,className:[JU[`rst-chip`],JU[`rst-chip-variant-${i}`],JU[`rst-chip-size-${a}`],o].filter(Boolean).join(` `),...d,"data-draggable":s,"data-clearable":!!r,children:[s&&(0,h.jsx)(`span`,{draggable:!0,onDragStart:c,onDragOver:l,onDragEnd:u,className:JU[`drag-handle`],children:(0,h.jsx)(D,{leadingVisual:`drag`,variant:`invisible`,"aria-label":`Drag`,size:`small`})}),t&&(0,h.jsx)(b,{src:t}),(0,h.jsx)(T,{variant:`caption`,children:e}),n&&!r&&(0,h.jsx)(b,{src:n}),r&&(0,h.jsx)(D,{onClick:r,variant:`invisible`,"aria-label":`Remove`,leadingVisual:`delete`,size:`small`})]})),XU={"rst-group-panel":`_rst-group-panel_19fkn_2`,"rst-group-panel-indicator":`_rst-group-panel-indicator_19fkn_10`,"rst-chip-ghost":`_rst-chip-ghost_19fkn_15`};function ZU({grouping:e,columns:t,onGroupingChange:n}){let[r,i]=(0,d.useState)(null),[a,o]=(0,d.useState)(null),s=(0,d.useRef)(null),c=t=>{n(e.filter(e=>e!==t))},l=(n,r)=>{n.dataTransfer.setData(`application/x-restio-group-index`,String(r)),n.dataTransfer.effectAllowed=`move`;let i=t.find(t=>(t.id||t.accessorKey)===e[r]);o(i?.header?String(i.header):e[r]??null)},u=()=>{i(null),o(null)},f=e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`move`;let t=s.current;if(!t)return;let n=Array.from(t.querySelectorAll(`[data-chip]`)),r=e.clientX,a=n.length;for(let e=0;e<n.length;e++){let t=n[e].getBoundingClientRect();if(r<t.left+t.width/2){a=e;break}}i(e=>e?.index===a?e:{index:a})},p=t=>{t.preventDefault(),t.stopPropagation();let a=r?.index??e.length;i(null);let s=t.dataTransfer.getData(`application/x-restio-group-index`);if(s){let t=parseInt(s,10);if(isNaN(t)||t===a)return;let r=[...e],[i]=r.splice(t,1),o=t<a?a-1:a;r.splice(o,0,i),n(r);return}let c=t.dataTransfer.getData(`text/plain`);if(c&&!e.includes(c)){let t=[...e];t.splice(a,0,c),n(t)}o(null)},m=a?(0,h.jsx)(YU,{draggable:!0,className:XU[`rst-chip-ghost`],children:String(a)}):null;return(0,h.jsxs)(`div`,{ref:s,className:XU[`rst-group-panel`],onDrop:p,onDragOver:f,children:[(0,h.jsx)(`div`,{className:XU[`rst-group-panel-indicator`],children:e.length===0?(0,h.jsx)(T,{variant:`caption`,children:`(Drag to reorder)`}):(0,h.jsx)(b,{src:`groups`})}),e.map((n,i)=>{let o=t.find(e=>(e.id||e.accessorKey)===n)?.header||n,s=r?.index===i&&a&&e.includes(a),f=r?.index===i&&(!e.includes(a)||!s);return(0,h.jsxs)(d.default.Fragment,{children:[f&&m,(0,h.jsx)(YU,{"data-chip":!0,draggable:!0,onDragStart:e=>l(e,i),onDragEnd:u,onRemove:e=>{e.stopPropagation(),c(n)},children:o}),e.length>1&&i<e.length-1&&(0,h.jsx)(b,{src:`arrow-right`})]},n)}),r?.index===e.length&&m]})}var QU={"rst-table-header":`_rst-table-header_161qw_1`,"rst-table-header-cell":`_rst-table-header-cell_161qw_5`,"rst-table-header-content":`_rst-table-header-content_161qw_18`,"rst-table-header-cell-pinned":`_rst-table-header-cell-pinned_161qw_33`,"rst-table-header-cell-pinned-left":`_rst-table-header-cell-pinned-left_161qw_39`,"rst-table-header-cell-pinned-right":`_rst-table-header-cell-pinned-right_161qw_43`,"rst-table-header-cell-drag-over":`_rst-table-header-cell-drag-over_161qw_47`,"rst-table-header-sticky":`_rst-table-header-sticky_161qw_52`},$U={"rst-anchored-navigation":`_rst-anchored-navigation_9n3ru_1`,"rst-anchored-navigation-header":`_rst-anchored-navigation-header_9n3ru_12`,"rst-anchored-navigation-title":`_rst-anchored-navigation-title_9n3ru_19`,"rst-anchored-navigation-back":`_rst-anchored-navigation-back_9n3ru_25`,"rst-anchored-navigation-close":`_rst-anchored-navigation-close_9n3ru_29`,"rst-anchored-navigation-content":`_rst-anchored-navigation-content_9n3ru_33`},eW=({items:e,anchor:t,isOpen:n,onClose:r,onItemClick:i,width:a=320,initialTitle:o=``,isClosingOnSelect:s=!1,variant:c=`stack`,position:l,align:u})=>{let[f,p]=(0,d.useState)([{title:o,items:e}]),m=f[f.length-1],g=e=>{e.children&&p(t=>[...t,{title:e.label,items:e.children}])},_=()=>{p(e=>e.length>1?e.slice(0,-1):e)},v=e=>{if(c===`stack`&&e.children){g(e);return}c===`flyout`&&e.children||(i?.(e),s&&r?.())},y=e=>e.type===`separator`?(0,h.jsx)(fH.Separator,{},e.id):e.children&&e.children.length>0?(0,h.jsx)(fH.Submenu,{trigger:(0,h.jsx)(fH.Item,{label:e.label,leadingVisual:e.leadingVisual,disabled:e.disabled,shortcut:e.shortcut,children:e.children}),children:e.children.map(y)},e.id):(0,h.jsx)(fH.Item,{label:e.label,leadingVisual:e.leadingVisual,disabled:e.disabled,shortcut:e.shortcut,content:e.content,onClick:()=>v(e)},e.id),b=e=>e.type===`separator`?(0,h.jsx)(fH.Separator,{},e.id):(0,h.jsx)(fH.Item,{label:e.label,leadingVisual:e.leadingVisual,disabled:e.disabled,shortcut:e.shortcut,children:e.children,content:e.content,onClick:()=>v(e)},e.id),x=c===`stack`?m.title:o,S=c===`stack`&&f.length>1;return(0,h.jsx)(M,{isOpen:n,onClose:r,anchor:t,position:l,align:u,target:(0,h.jsxs)(`div`,{className:$U[`rst-anchored-navigation`],style:{width:a},role:`menu`,children:[(0,h.jsxs)(`div`,{className:$U[`rst-anchored-navigation-header`],children:[(0,h.jsx)(`div`,{className:$U[`rst-anchored-navigation-back`],children:S?(0,h.jsx)(D,{leadingVisual:`arrow-left`,variant:`invisible`,onClick:_,"aria-label":`Back`}):(0,h.jsx)(`div`,{style:{width:16}})}),(0,h.jsx)(`div`,{className:$U[`rst-anchored-navigation-title`],children:x}),(0,h.jsx)(`div`,{className:$U[`rst-anchored-navigation-close`],children:(0,h.jsx)(D,{leadingVisual:`close`,variant:`invisible`,onClick:r,"aria-label":`Close`})})]}),(0,h.jsx)(`div`,{className:$U[`rst-anchored-navigation-content`],children:c===`stack`?m.items.map(b):e.map(y)})]})})};function tW({columnId:e,isOpen:t,onClose:n,anchor:r}){let{state:i,setSorting:a,toggleColumnVisibility:o,setPinColumn:s}=RH();return(0,h.jsx)(eW,{items:[{id:`pin`,label:`Pin Column`,leadingVisual:`pin`,children:[{id:`pin-left`,label:`Pin Left`,leadingVisual:`arrow-left-to-line`,onClick:()=>{s(e,`left`)}},{id:`pin-right`,label:`Pin Right`,leadingVisual:`arrow-right-to-line`,onClick:()=>{s(e,`right`)}},{id:`pin-none`,label:`No Pin`,leadingVisual:`pin-off`,onClick:()=>{s(e,!1)}}]},{id:`sort`,label:`Sort`,leadingVisual:`arrow-down-up`,children:[{id:`sort-asc`,label:`Ascending`,leadingVisual:`arrow-up-narrow-wide`,onClick:()=>{a([{id:e,desc:!1}])}},{id:`sort-desc`,label:`Descending`,leadingVisual:`arrow-down-wide-narrow`,onClick:()=>{a([{id:e,desc:!0}])}},{id:`sort-none`,label:`No Sort`,leadingVisual:`x`,onClick:()=>{a(i.sorting.filter(t=>t.id!==e))}}]},{id:`sep`,type:`separator`},{id:`hide`,label:`Hide Column`,leadingVisual:`eye-off`,onClick:()=>{o(e)}}],anchor:r,isOpen:t,onClose:n,isClosingOnSelect:!0,onItemClick:e=>{console.log(e),e.onClick?.(e)},variant:`flyout`,position:`center`,align:`bottom`,width:220})}function nW({columnOffsets:e,onGroupingChange:t}){let{columns:n,visibleColumns:r,state:i,setSorting:a,setGrouping:o,setColumnOrder:s,options:c,toggleAllSelection:l,getAllSelectionState:u}=RH(),{enableSorting:f,enableGrouping:p,stickyHeader:m,columnSizing:g=`auto`,enableSelection:_,enableColumnReorder:v}=c,[y,b]=(0,d.useState)(null),[x,S]=(0,d.useState)(null),C=(0,d.useRef)(null),w=(0,d.useRef)(null);(0,d.useLayoutEffect)(()=>{if(!m||!p)return;let e=w.current,t=C.current;if(!e||!t)return;let n=()=>{t.style.setProperty(`--rst-group-panel-row-height`,`${e.offsetHeight}px`)};n();let r=new ResizeObserver(n);return r.observe(e),()=>r.disconnect()},[m,p]);let E=_&&OH(e),O=e=>{if(f){let t=i.sorting,n=t.find(t=>t.id===e);n?n.desc?a(t.filter(t=>t.id!==e)):a([{id:e,desc:!0}]):a([{id:e,desc:!1}])}},k=e=>{o(e),t&&t(e)},j=(e,t)=>{e.dataTransfer.setData(`text/plain`,t),v&&(e.dataTransfer.setData(`application/x-restio-column-reorder`,t),e.dataTransfer.effectAllowed=`move`)},M=(e,t)=>{v&&e.dataTransfer.types.includes(`application/x-restio-column-reorder`)&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`move`,b(t))},N=(e,t)=>{if(!v)return;e.preventDefault(),e.stopPropagation(),b(null);let r=e.dataTransfer.getData(`application/x-restio-column-reorder`);if(!r||r===t)return;let a=n.map((e,t)=>xH(e,t)),o=i.columnOrder.length>0?[...i.columnOrder]:[...a],c=o.indexOf(r),l=o.indexOf(t);c===-1||l===-1||(o.splice(c,1),o.splice(l,0,r),s(o))},P=()=>b(null),F=e=>{let t=i.sorting.find(t=>t.id===e);return t?t.desc?(0,h.jsx)(D,{variant:`invisible`,leadingVisual:`arrow-up`}):(0,h.jsx)(D,{variant:`invisible`,leadingVisual:`arrow-down`}):(0,h.jsx)(D,{variant:`invisible`,leadingVisual:`arrow-down-up`})};return(0,h.jsxs)(`thead`,{ref:C,className:`${QU[`rst-table-header`]} ${m?QU[`rst-table-header-sticky`]:``}`,children:[p&&(0,h.jsx)(`tr`,{ref:w,children:(0,h.jsx)(`td`,{colSpan:r.length+ +!!_,style:{padding:0,borderBottom:`none`},children:(0,h.jsx)(ZU,{grouping:i.grouping,columns:n,onGroupingChange:k})})}),(0,h.jsxs)(`tr`,{children:[_&&(0,h.jsx)(`th`,{className:[QU[`rst-table-header-cell`],X[`rst-table-selection-cell`],E?QU[`rst-table-header-cell-pinned`]:``].filter(Boolean).join(` `),style:E?{left:0}:void 0,children:(0,h.jsx)(`div`,{className:QU[`rst-table-header-content`],children:(0,h.jsx)(A,{checked:u()===`checked`,indeterminate:u()===`indeterminate`,onChange:l,"aria-label":`Select all rows`})})}),r.map((t,n)=>{let r=xH(t,n),i=e[r],a=!!i&&i.left!==void 0,o=!!i&&i.right!==void 0,s=a||o,c=r===`__group__`,l=s?{left:i.left,right:i.right}:{};return(0,h.jsx)(`th`,{className:[QU[`rst-table-header-cell`],s?QU[`rst-table-header-cell-pinned`]:``,a?QU[`rst-table-header-cell-pinned-left`]:``,o?QU[`rst-table-header-cell-pinned-right`]:``,y===r?QU[`rst-table-header-cell-drag-over`]:``].filter(Boolean).join(` `),style:{...g===`fixed`?{width:t.size,minWidth:t.minSize??t.size,maxWidth:t.maxSize}:{minWidth:t.minSize},...l},onClick:()=>!c&&t.enableSorting!==!1&&O(r),draggable:!c&&(p||v),onDragStart:e=>!c&&j(e,r),onDragOver:e=>!c&&M(e,r),onDrop:e=>!c&&N(e,r),onDragEnd:P,onContextMenu:e=>{c||(e.preventDefault(),S(r))},children:(0,h.jsx)(tW,{columnId:r,isOpen:x===r,onClose:()=>S(null),anchor:(0,h.jsxs)(`div`,{className:QU[`rst-table-header-content`],children:[(0,h.jsx)(T,{variant:`title`,children:t.header||r}),f&&!c&&t.enableSorting!==!1&&(0,h.jsx)(`span`,{className:QU[`rst-table-sort-icon`],children:F(r)})]})})},r)})]})]})}function rW(e){let t=[],n=new Map;return e.filter(e=>!e.isRowField).forEach(e=>{let r=`${e.columnFieldId??``}__${e.columnFieldValue??``}`;n.has(r)||(n.set(r,{label:e.label,cols:[]}),t.push(r)),n.get(r).cols.push(e)}),t.map(e=>({key:e,...n.get(e)}))}function iW(e,t,n){let r=n.find(e=>(e.id||String(e.accessorKey??``))===t);return r?r.accessorFn?r.accessorFn(e):r.accessorKey?e[r.accessorKey]:null:null}function aW(e,t){let n=t.find(t=>(t.id||String(t.accessorKey??``))===e);return n&&n.header?String(n.header):e}function oW(e,t,n){let{rowFields:r,columnFields:i,valueFields:a}=t,o=new Map;i.forEach(t=>{let r=new Set;e.forEach(e=>{let i=String(iW(e,t,n)??``);r.add(i)}),o.set(t,Array.from(r).sort())});let s=[];r.forEach(e=>{s.push({id:`row__${e}`,label:aW(e,n),isRowField:!0})}),i.length>0?i.forEach(e=>{(o.get(e)??[]).forEach(t=>{a.forEach(r=>{let i=r.label??`${aW(r.field,n)} (${r.aggregation})`;s.push({id:`pivot__${e}__${t}__${r.field}__${r.aggregation}`,label:t,subLabel:i,isRowField:!1,columnFieldValue:t,columnFieldId:e,valueField:r})})})}):a.forEach(e=>{let t=e.label??`${aW(e.field,n)} (${e.aggregation})`;s.push({id:`pivot__${e.field}__${e.aggregation}`,label:t,isRowField:!1,valueField:e})});let c=new Map;e.forEach(e=>{let t=r.map(t=>String(iW(e,t,n)??``)).join(`\0`);c.has(t)||c.set(t,[]),c.get(t).push(e)});let l=[],u=0;return(r.length>0?Array.from(c.entries()):[[`__all__`,e]]).forEach(([e,t])=>{let s={};if(r.length>0){let t=e.split(`\0`);r.forEach((e,n)=>{s[e]=t[n]??``})}let c={};r.forEach(e=>{c[`row__${e}`]=s[e]}),i.length>0?i.forEach(e=>{(o.get(e)??[]).forEach(r=>{let i=t.filter(t=>String(iW(t,e,n)??``)===r);a.forEach(t=>{let a=`pivot__${e}__${r}__${t.field}__${t.aggregation}`;c[a]=GU(t.aggregation===`count`?i.map(()=>1):i.map(e=>Number(iW(e,t.field,n))).filter(e=>!isNaN(e)),t.aggregation)})})}):a.forEach(e=>{let r=`pivot__${e.field}__${e.aggregation}`;c[r]=GU(e.aggregation===`count`?t.map(()=>1):t.map(t=>Number(iW(t,e.field,n))).filter(e=>!isNaN(e)),e.aggregation)}),l.push({id:`pivot-row-${u++}`,rowValues:s,cells:c})}),{columns:s,rows:l}}var sW=[`sum`,`count`,`avg`,`min`,`max`];function cW({columns:e,config:t,onConfigChange:n}){let[r,i]=(0,d.useState)(null),a=e=>e.id||(e.accessorKey?String(e.accessorKey):``),o=new Set([...t.rowFields,...t.columnFields,...t.valueFields.map(e=>e.field)]),s=e.map(a).filter(e=>e&&!o.has(e)),c=(e,t)=>{e.dataTransfer.setData(`application/x-pivot`,JSON.stringify(t)),e.dataTransfer.effectAllowed=`move`},l=e=>{try{return JSON.parse(e.dataTransfer.getData(`application/x-pivot`))}catch{return null}},u=(e,r)=>{e.preventDefault(),i(null);let a=l(e);if(!a)return;let{fieldId:o,fromZone:s}=a,c={...t,rowFields:[...t.rowFields],columnFields:[...t.columnFields],valueFields:[...t.valueFields]};s===`rows`&&(c.rowFields=c.rowFields.filter(e=>e!==o)),s===`columns`&&(c.columnFields=c.columnFields.filter(e=>e!==o)),s===`values`&&(c.valueFields=c.valueFields.filter(e=>e.field!==o)),r===`rows`&&!c.rowFields.includes(o)?c.rowFields.push(o):r===`columns`&&!c.columnFields.includes(o)?c.columnFields.push(o):r===`values`&&!c.valueFields.find(e=>e.field===o)&&c.valueFields.push({field:o,aggregation:`sum`}),n(c)},f=(e,r)=>{let i={...t};e===`rows`&&(i.rowFields=t.rowFields.filter(e=>e!==r)),e===`columns`&&(i.columnFields=t.columnFields.filter(e=>e!==r)),e===`values`&&(i.valueFields=t.valueFields.filter(e=>e.field!==r)),n(i)},p=(e,r)=>{n({...t,valueFields:t.valueFields.map(t=>t.field===e?{...t,aggregation:r}:t)})},m=e=>({onDragOver:t=>{t.preventDefault(),t.dataTransfer.dropEffect=`move`,i(e)},onDragLeave:()=>i(null),onDrop:t=>u(t,e)}),g=(t,n,i,a)=>(0,h.jsxs)(`div`,{className:`${X[`rst-pivot-zone`]} ${r===t?X[`rst-pivot-zone-active`]:``}`,...m(t),children:[(0,h.jsx)(`span`,{className:X[`rst-pivot-zone-title`],children:n}),(0,h.jsxs)(ZV,{direction:`row`,gap:1,align:`center`,wrap:!0,children:[i.length===0&&(0,h.jsx)(`span`,{className:X[`rst-pivot-zone-placeholder`],children:`Drop fields here`}),i.map(n=>{let r=a?.find(e=>e.field===n);return(0,h.jsxs)(`div`,{className:X[`rst-pivot-chip-wrapper`],children:[(0,h.jsx)(YU,{draggable:!0,onDragStart:e=>c(e,{fieldId:n,fromZone:t,valueAggregation:r?.aggregation}),onRemove:e=>{e.stopPropagation(),f(t,n)},children:aW(n,e)}),t===`values`&&r&&(0,h.jsx)(`select`,{className:X[`rst-pivot-agg-select`],value:r.aggregation,onChange:e=>p(n,e.target.value),onClick:e=>e.stopPropagation(),children:sW.map(e=>(0,h.jsx)(`option`,{value:e,children:e},e))})]},n)})]})]});return(0,h.jsxs)(`div`,{className:X[`rst-pivot-config-panel`],children:[(0,h.jsxs)(`div`,{className:X[`rst-pivot-available-fields`],children:[(0,h.jsx)(`span`,{className:X[`rst-pivot-zone-title`],children:`Fields`}),(0,h.jsxs)(ZV,{direction:`row`,gap:1,align:`center`,wrap:!0,children:[s.map(t=>(0,h.jsx)(YU,{draggable:!0,onDragStart:e=>c(e,{fieldId:t,fromZone:`available`}),children:aW(t,e)},t)),s.length===0&&(0,h.jsx)(`span`,{className:X[`rst-pivot-zone-placeholder`],children:`All fields assigned`})]})]}),(0,h.jsxs)(`div`,{className:X[`rst-pivot-zones`],children:[g(`rows`,`Rows`,t.rowFields),g(`columns`,`Columns`,t.columnFields),g(`values`,`Values`,t.valueFields.map(e=>e.field),t.valueFields)]})]})}function lW({pivotData:e,className:t}){let{columns:n,rows:r}=e,i=n.filter(e=>e.isRowField),a=n.filter(e=>!e.isRowField),o=a.some(e=>e.columnFieldId!==void 0),s=o?rW(n):[],c=[X[`rst-table-grid`],X[`rst-pivot-table`],t].filter(Boolean).join(` `);return(0,h.jsx)(`div`,{className:X[`rst-table-container`],children:(0,h.jsxs)(`table`,{className:c,children:[(0,h.jsx)(`thead`,{className:QU[`rst-table-header`],children:o?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`tr`,{children:[i.map(e=>(0,h.jsx)(`th`,{rowSpan:2,className:`${QU[`rst-table-header-cell`]} ${QU[`rst-pivot-header-row-field`]}`,children:(0,h.jsx)(`div`,{className:QU[`rst-table-header-content`],children:(0,h.jsx)(T,{variant:`title`,children:e.label})})},e.id)),s.map(e=>(0,h.jsx)(`th`,{colSpan:e.cols.length,className:`${QU[`rst-table-header-cell`]} ${QU[`rst-pivot-header-group`]}`,children:(0,h.jsx)(`div`,{className:QU[`rst-table-header-content`],children:(0,h.jsx)(T,{variant:`title`,children:e.label})})},e.key))]}),(0,h.jsx)(`tr`,{children:a.map(e=>(0,h.jsx)(`th`,{className:`${QU[`rst-table-header-cell`]} ${QU[`rst-pivot-header-value`]}`,children:(0,h.jsx)(`div`,{className:QU[`rst-table-header-content`],children:(0,h.jsx)(T,{variant:`title`,children:e.subLabel??e.label})})},e.id))})]}):(0,h.jsx)(`tr`,{children:n.map(e=>(0,h.jsx)(`th`,{className:[QU[`rst-table-header-cell`],e.isRowField?QU[`rst-pivot-header-row-field`]:X[`rst-pivot-header-value`]].filter(Boolean).join(` `),children:(0,h.jsx)(`div`,{className:QU[`rst-table-header-content`],children:(0,h.jsx)(T,{variant:`title`,children:e.label})})},e.id))})}),(0,h.jsx)(`tbody`,{className:X[`rst-table-body`],children:r.length===0?(0,h.jsx)(`tr`,{children:(0,h.jsx)(`td`,{colSpan:n.length,className:X[`rst-pivot-empty`],children:`No data to display`})}):r.map(e=>(0,h.jsx)(`tr`,{className:X[`rst-table-row`],children:n.map(t=>{let n=e.cells[t.id];return(0,h.jsx)(`td`,{className:[X[`rst-table-cell`],t.isRowField?X[`rst-pivot-cell-row-field`]:X[`rst-pivot-cell-value`]].filter(Boolean).join(` `),children:(0,h.jsx)(`div`,{className:X[`rst-table-cell-wrapper`],children:KU(n)})},t.id)})},e.id))})]})})}function uW({enablePivot:e,enableFormula:t,enableColumnVisibility:n,enableAI:r,onPivotClick:i,onFormulaClick:a,onColumnVisibilityClick:o,onAIClick:s}){return(0,h.jsxs)(`div`,{className:X[`rst-table-sidebar`],children:[e&&(0,h.jsx)(D,{variant:`invisible`,size:`small`,leadingVisual:`groups`,title:`Pivot Mode`,onClick:i}),t&&(0,h.jsx)(D,{variant:`invisible`,size:`small`,leadingVisual:`pencil`,title:`Formula Builder`,onClick:a}),n&&(0,h.jsx)(D,{variant:`invisible`,size:`small`,leadingVisual:`columns`,title:`Column Visibility`,onClick:o}),r&&(0,h.jsx)(D,{variant:`invisible`,size:`small`,leadingVisual:`sparkle`,title:`AI Assistant`,onClick:s})]})}function dW({onSave:e,onCancel:t,existingColumns:n,sampleRow:r}){let[i,a]=(0,d.useState)(``),[o,s]=(0,d.useState)(``),[c,l]=(0,d.useState)(null),[u,f]=(0,d.useState)(null);return(0,d.useEffect)(()=>{if(!o||!r){l(null),f(null);return}let e=BU.validate(o);if(!e.valid){f(e.error??`Invalid formula`),l(null);return}let t=BU.evaluate(o,r);l(t===null?null:String(t)),f(null)},[o,r]),(0,h.jsxs)(ZV,{direction:`column`,gap:1,children:[(0,h.jsxs)(ZV,{direction:`column`,gap:1,children:[(0,h.jsx)(T,{variant:`label`,children:`Column Header`}),(0,h.jsx)(vV,{value:i,onChange:e=>a(e??``),placeholder:`e.g. Profit Margin`})]}),(0,h.jsxs)(ZV,{direction:`column`,gap:1,children:[(0,h.jsx)(T,{variant:`label`,children:`Formula`}),(0,h.jsx)(vV,{value:o,onChange:e=>s(e??``),placeholder:`e.g. (revenue - cost) / revenue`}),(0,h.jsxs)(T,{variant:`caption`,children:[`Available columns:`,` `,n.map(e=>e.id||e.accessorKey).filter(Boolean).join(`, `)]})]}),c!==null&&(0,h.jsxs)(`div`,{style:{padding:`8px`,background:`var(--rst-color-bg-subtle)`,borderRadius:`4px`},children:[(0,h.jsx)(`strong`,{children:`Preview:`}),` `,c]}),u&&(0,h.jsxs)(`div`,{style:{color:`var(--rst-color-fg-danger)`},children:[`Error: `,u]}),(0,h.jsxs)(ZV,{direction:`row`,gap:2,justify:`end`,children:[(0,h.jsx)(D,{variant:`invisible`,onClick:t,value:`cancel`}),(0,h.jsx)(D,{variant:`primary`,onClick:()=>{!i||!o||e({id:i.toLowerCase().replace(/\s+/g,`_`),header:i,formula:o,accessorKey:void 0})},disabled:!i||!o||!!u,value:`Add Column`})]})]})}function fW(e,t){let n=Math.min(t.length,20);for(let r=0;r<n;r++){let n=e.accessorFn?e.accessorFn(t[r]):e.accessorKey?t[r][e.accessorKey]:void 0;if(n!=null)return n}}function pW(e,t,n,r){let i=n.findIndex(e=>xH(e,n.indexOf(e))===t);if(i===-1)return e;let a=n[i],o=fW(a,r);if(typeof o==`boolean`)return typeof e==`boolean`?e:typeof e==`string`?e.toLowerCase()===`true`:!!e;if(o instanceof Date){if(e instanceof Date)return e;if(typeof e==`string`||typeof e==`number`){let t=new Date(e);if(!isNaN(t.getTime()))return t}return e}if(o===void 0){if(a.cellType===AU.NUMBER){let t=Number(e);return isNaN(t)?e:t}return a.options||a.cellType===AU.SELECT||a.cellType===AU.BUTTON_GROUP||a.cellType===AU.TEXT?String(e??``):e}return e}function mW(e,t,n){let r=n.find(e=>xH(e,n.indexOf(e))===t.column);if(!r)return!1;let i=VU(r,e),a=t.value;switch(t.operator){case`equals`:return String(i).toLowerCase()===String(a).toLowerCase();case`not_equals`:return String(i).toLowerCase()!==String(a).toLowerCase();case`contains`:return String(i).toLowerCase().includes(String(a).toLowerCase());case`greater_than`:return Number(i)>Number(a);case`less_than`:return Number(i)<Number(a);default:return!1}}function hW(){let{data:e,columns:t,getRows:n,setSorting:r,setGrouping:i,setColumnOrder:a,toggleColumnVisibility:o,updateCellValue:s,setSelectedRows:c,setPinColumn:l,addFormulaColumn:u,state:f}=RH();return{execute:(0,d.useCallback)(d=>{let p=[];for(let m of d)try{switch(m.tool){case`select_rows`:{let e=m.arguments,r=n(),i=new Set;for(let n of r)n.isGroup||e.conditions.every(e=>mW(n.data,e,t))&&i.add(n.id);c(i),p.push({tool:`select_rows`,success:!0,message:`Selected ${i.size} row(s)`});break}case`sort`:{let e=m.arguments;r([{id:e.column,desc:e.direction===`desc`}]),p.push({tool:`sort`,success:!0,message:`Sorted by "${e.column}" ${e.direction===`desc`?`descending`:`ascending`}`});break}case`column_visibility`:{let e=m.arguments,t=f.hiddenColumns.has(e.column);e.visible&&t?(o(e.column),p.push({tool:`column_visibility`,success:!0,message:`Column "${e.column}" is now visible`})):!e.visible&&!t?(o(e.column),p.push({tool:`column_visibility`,success:!0,message:`Column "${e.column}" is now hidden`})):p.push({tool:`column_visibility`,success:!0,message:`Column "${e.column}" already ${e.visible?`visible`:`hidden`}`});break}case`column_order`:{let e=m.arguments;a(e.order),p.push({tool:`column_order`,success:!0,message:`Columns reordered`});break}case`edit_cells`:{let n=m.arguments,r=0;for(let i of n.edits)if(i.rowIndex>=0&&i.rowIndex<e.length){let n=e[i.rowIndex],a=pW(i.value,i.column,t,e);s(n,i.column,a),r++}p.push({tool:`edit_cells`,success:!0,message:`Edited ${r} cell(s)`});break}case`group_by`:{let e=m.arguments;i(e.columns),p.push({tool:`group_by`,success:!0,message:e.columns.length>0?`Grouped by: ${e.columns.join(`, `)}`:`Grouping cleared`});break}case`pin_column`:{let e=m.arguments,t=e.side===`none`?!1:e.side;l(e.column,t),p.push({tool:`pin_column`,success:!0,message:e.side===`none`?`Column "${e.column}" unpinned`:`Column "${e.column}" pinned to the ${e.side}`});break}case`multi_sort`:{let e=m.arguments;r(e.sorts.map(e=>({id:e.column,desc:e.direction===`desc`})));let t=e.sorts.map(e=>`"${e.column}" ${e.direction}`).join(`, `);p.push({tool:`multi_sort`,success:!0,message:`Sorted by: ${t}`});break}case`clear_state`:r([]),i([]),c(new Set),a([]),p.push({tool:`clear_state`,success:!0,message:`Table state cleared`});break;case`create_formula`:{let e=m.arguments,t=BU.validate(e.formula);if(!t.valid){p.push({tool:`create_formula`,success:!1,message:`Invalid formula: ${t.error}`});break}if(!u){p.push({tool:`create_formula`,success:!1,message:`Formula builder is not enabled on this table`});break}u({id:e.header.toLowerCase().replace(/\s+/g,`_`),header:e.header,formula:e.formula,accessorKey:void 0}),p.push({tool:`create_formula`,success:!0,message:`Formula column "${e.header}" added`});break}case`fill_column_from_column`:{let n=m.arguments,r=0;for(let i of n.edits)if(i.rowIndex>=0&&i.rowIndex<e.length){let a=e[i.rowIndex],o=pW(i.value,n.targetColumn,t,e);s(a,n.targetColumn,o),r++}p.push({tool:`fill_column_from_column`,success:!0,message:`Filled ${r} row(s) in "${n.targetColumn}" based on "${n.sourceColumn}"`});break}default:p.push({tool:m.tool,success:!1,message:`Unknown tool "${m.tool}"`})}}catch(e){p.push({tool:m.tool,success:!1,message:e instanceof Error?e.message:`Unknown error`})}return p},[e,t,n,r,i,a,o,s,c,l,u,f.hiddenColumns])}}function gW(e){return e==null?`unknown`:typeof e==`boolean`?`boolean`:typeof e==`number`?`number`:e instanceof Date?`date`:typeof e==`string`?!isNaN(Date.parse(e))&&/^\d{4}-\d{2}-\d{2}/.test(e)?`date`:`string`:`unknown`}function _W(e){return e.options&&e.options.length>0?`string`:e.cellType===AU.NUMBER?`number`:(e.cellType===AU.TEXT||e.cellType===AU.SELECT||(e.cellType,AU.BUTTON_GROUP),`string`)}function vW(e,t){let n=Math.min(t.length,20);for(let r=0;r<n;r++){let n=t[r],i=e.accessorFn?e.accessorFn(n):e.accessorKey?n[e.accessorKey]:void 0;if(i!=null)return i}}function yW(e,t){return e.map(e=>{let n=e.id??(e.accessorKey?String(e.accessorKey):void 0);if(!n)return null;let r=typeof e.header==`string`?e.header:n,i=gW(vW(e,t));return{id:n,label:r,type:i===`unknown`?_W(e):i,...e.options&&e.options.length>0?{options:e.options.map(e=>e.value)}:{}}}).filter(e=>e!==null)}var bW=[{name:`select_rows`,description:`Select rows that match the given conditions. Each condition specifies a column, an operator, and a value. Multiple conditions are combined with AND logic.`,parameters:[{name:`conditions`,type:`array`,description:`Array of conditions. Each condition has: column (column id), operator (equals | not_equals | contains | greater_than | less_than), value (the value to compare against).`,required:!0}]},{name:`sort`,description:`Sort the table by a specific column in ascending or descending order.`,parameters:[{name:`column`,type:`string`,description:`The column id to sort by.`,required:!0},{name:`direction`,type:`string`,description:`Sort direction: 'asc' for ascending, 'desc' for descending.`,required:!0}]},{name:`column_visibility`,description:`Show or hide a specific column in the table.`,parameters:[{name:`column`,type:`string`,description:`The column id to show or hide.`,required:!0},{name:`visible`,type:`boolean`,description:`Set to true to show the column, false to hide it.`,required:!0}]},{name:`column_order`,description:`Reorder columns in the table by providing the desired column order as an array of column ids.`,parameters:[{name:`order`,type:`array`,description:`Array of column ids in the desired display order.`,required:!0}]},{name:`edit_cells`,description:`Edit one or more cell values in the table. Each edit specifies a row index, column id, and new value.`,parameters:[{name:`edits`,type:`array`,description:`Array of edits. Each edit has: rowIndex (0-based row number), column (column id), value (the new cell value).`,required:!0}]},{name:`group_by`,description:`Group table rows by one or more columns. Pass an empty array to remove all grouping.`,parameters:[{name:`columns`,type:`array`,description:`Array of column ids to group by, in order. Pass an empty array to clear grouping.`,required:!0}]},{name:`pin_column`,description:`Pin a column to the left or right side of the table, or unpin it.`,parameters:[{name:`column`,type:`string`,description:`The column id to pin or unpin.`,required:!0},{name:`side`,type:`string`,description:`Where to pin the column: 'left', 'right', or 'none' to unpin.`,required:!0}]},{name:`multi_sort`,description:`Sort the table by multiple columns at once, applying sorts in the given priority order.`,parameters:[{name:`sorts`,type:`array`,description:`Array of sort criteria in priority order. Each item has: column (column id), direction ('asc' or 'desc').`,required:!0}]},{name:`clear_state`,description:`Reset the table to its default state: clears sorting, grouping, row selection, and column order.`,parameters:[]},{name:`create_formula`,description:`Add a new computed column to the table by providing a header name and a formula expression. The formula can reference any column by its accessorKey (e.g. 'price * quantity', 'score / max_score * 100'). Supported operators: +, -, *, /, %, >, <, >=, <=, ==, !=, &&, ||, !.`,parameters:[{name:`header`,type:`string`,description:`The display name for the new formula column.`,required:!0},{name:`formula`,type:`string`,description:`The formula expression using column accessorKeys as variable names (e.g. 'revenue - cost', 'quantity * unit_price').`,required:!0}]},{name:`fill_column_from_column`,description:`Fill every cell in a target column with a value derived from another column. Read each row's sourceColumn value from the Table Data section and determine the best targetColumn value. For SELECT or BUTTON_GROUP columns, the value must match one of the column's valid options. Return ALL rows in the edits array.`,parameters:[{name:`targetColumn`,type:`string`,description:`The column id to fill with inferred values.`,required:!0},{name:`sourceColumn`,type:`string`,description:`The column id to read values from in order to infer the target value.`,required:!0},{name:`edits`,type:`array`,description:`Array of per-row assignments. Each entry has: rowIndex (0-based integer), value (the new value for that row's targetColumn).`,required:!0}]}];function xW(e,t){let n=e.toLowerCase(),r=t.find(e=>e.id.toLowerCase()===n);if(r)return r.id;let i=t.find(e=>e.label.toLowerCase()===n);return i?i.id:null}function SW(e){return{"=":`equals`,"==":`equals`,"===":`equals`,equals:`equals`,eq:`equals`,"!=":`not_equals`,"!==":`not_equals`,not_equals:`not_equals`,neq:`not_equals`,contains:`contains`,like:`contains`,">":`greater_than`,greater_than:`greater_than`,gt:`greater_than`,"<":`less_than`,less_than:`less_than`,lt:`less_than`}[e]??`equals`}function CW(e,t,n,r){let i=[],a=[];for(let o of e){let e=t.find(e=>e.name===o.tool);if(!e){a.push(`Unknown tool "${o.tool}"`);continue}let s=e.parameters.filter(e=>e.required&&!(e.name in o.arguments));if(s.length>0){a.push(`Tool "${o.tool}" missing required parameters: ${s.map(e=>e.name).join(`, `)}`);continue}if(r){let e=r(o,n);if(e.errors.length>0){a.push(...e.errors);continue}e.resolved&&i.push(e.resolved)}else i.push(o)}return{valid:i,errors:a}}function wW(e,t){let n=[],r=[];for(let i of e){if(typeof i!=`object`||!i){r.push(`Invalid condition: expected an object`);continue}let e=i,a=String(e.column??``),o=xW(a,t);if(!o){r.push(`Unknown column "${a}"`);continue}n.push({column:o,operator:SW(String(e.operator??`equals`)),value:e.value})}return{resolved:n,errors:r}}function TW(e,t){let n={...e,arguments:{...e.arguments}},r=[];switch(e.tool){case`select_rows`:{let r=e.arguments.conditions;if(!Array.isArray(r))return{resolved:null,errors:[`Tool "select_rows" requires "conditions" to be an array`]};let i=wW(r,t);if(i.errors.length>0)return{resolved:null,errors:i.errors};n.arguments={conditions:i.resolved};break}case`sort`:{let r=String(e.arguments.column??``),i=xW(r,t);if(!i)return{resolved:null,errors:[`Sort: unknown column "${r}"`]};n.arguments={...e.arguments,column:i};break}case`column_visibility`:{let r=String(e.arguments.column??``),i=xW(r,t);if(!i)return{resolved:null,errors:[`Column visibility: unknown column "${r}"`]};n.arguments={...e.arguments,column:i};break}case`column_order`:{let r=e.arguments.order;if(!Array.isArray(r))return{resolved:null,errors:[`Tool "column_order" requires "order" to be an array`]};n.arguments={order:r.map(e=>xW(String(e),t)??String(e))};break}case`edit_cells`:{let r=e.arguments.edits;if(!Array.isArray(r))return{resolved:null,errors:[`Tool "edit_cells" requires "edits" to be an array`]};let i=[];for(let e of r){let n=e,r=String(n.column??``),a=xW(r,t);if(!a)return{resolved:null,errors:[`Edit: unknown column "${r}"`]};i.push({...n,column:a})}n.arguments={edits:i};break}case`group_by`:{let r=e.arguments.columns;if(!Array.isArray(r))return{resolved:null,errors:[`Tool "group_by" requires "columns" to be an array`]};let i=[];for(let e of r){let n=xW(String(e),t);if(!n)return{resolved:null,errors:[`Group by: unknown column "${e}"`]};i.push(n)}n.arguments={columns:i};break}case`pin_column`:{let r=String(e.arguments.column??``),i=xW(r,t);if(!i)return{resolved:null,errors:[`Pin column: unknown column "${r}"`]};n.arguments={...e.arguments,column:i};break}case`multi_sort`:{let r=e.arguments.sorts;if(!Array.isArray(r))return{resolved:null,errors:[`Tool "multi_sort" requires "sorts" to be an array`]};let i=[];for(let e of r){let n=e,r=String(n.column??``),a=xW(r,t);if(!a)return{resolved:null,errors:[`Multi sort: unknown column "${r}"`]};i.push({...n,column:a})}n.arguments={sorts:i};break}case`clear_state`:break;case`create_formula`:if(typeof e.arguments.header!=`string`||!e.arguments.header)return{resolved:null,errors:[`Tool "create_formula" requires a non-empty "header" string`]};if(typeof e.arguments.formula!=`string`||!e.arguments.formula)return{resolved:null,errors:[`Tool "create_formula" requires a non-empty "formula" string`]};break;case`fill_column_from_column`:{let r=String(e.arguments.targetColumn??``),i=String(e.arguments.sourceColumn??``),a=xW(r,t);if(!a)return{resolved:null,errors:[`Fill column: unknown target column "${r}"`]};let o=xW(i,t);if(!o)return{resolved:null,errors:[`Fill column: unknown source column "${i}"`]};let s=e.arguments.edits;if(!Array.isArray(s))return{resolved:null,errors:[`Tool "fill_column_from_column" requires "edits" to be an array`]};n.arguments={...e.arguments,targetColumn:a,sourceColumn:o};break}}return{resolved:n,errors:r}}function EW(e,t){return CW(e,bW,t,TW)}var DW={"rst-textareaField-wrapper":`_rst-textareaField-wrapper_lahxa_1`,"rst-textarea-wrapper":`_rst-textarea-wrapper_lahxa_23`,"rst-textarea-small":`_rst-textarea-small_lahxa_29`,"rst-textarea-default":`_rst-textarea-default_lahxa_34`,"rst-textarea-large":`_rst-textarea-large_lahxa_39`,"rst-textarea":`_rst-textarea_lahxa_1`},OW=({value:e,onChange:t,onKeyDown:n,label:r,helperText:i,placeholder:a,ariaLabel:o,ref:s,disabled:c,size:l,rows:u=3})=>{let f=(0,d.useId)(),p=`${f}-helper`,m={fieldWrapper:DW[`rst-textareaField-wrapper`],textareaWrapper:`${DW[`rst-textarea-wrapper`]} ${l?DW[`rst-textarea-${l}`]:``}`,textarea:DW[`rst-textarea`]};return(0,h.jsxs)(`div`,{className:m.fieldWrapper,children:[r&&(0,h.jsx)(PV,{label:r,id:f,disabled:c}),(0,h.jsx)(`textarea`,{id:f,value:e,className:m.textarea,placeholder:a,onChange:e=>{t?.(e.target.value)},onKeyDown:n,"aria-label":o,"aria-describedby":i?p:void 0,ref:s,disabled:c,rows:u}),i&&(0,h.jsx)(FU,{helperText:i,id:p,disabled:c})]})},kW={"rst-chat-container":`_rst-chat-container_sqjcv_1`,"rst-chat-messages":`_rst-chat-messages_sqjcv_7`,"rst-chat-message":`_rst-chat-message_sqjcv_7`,"rst-chat-message-user":`_rst-chat-message-user_sqjcv_22`,"rst-chat-message-assistant":`_rst-chat-message-assistant_sqjcv_26`,"rst-chat-bubble":`_rst-chat-bubble_sqjcv_30`,"rst-chat-bubble-user":`_rst-chat-bubble-user_sqjcv_38`,"rst-chat-bubble-assistant":`_rst-chat-bubble-assistant_sqjcv_42`,"rst-chat-tool-calls":`_rst-chat-tool-calls_sqjcv_46`,"rst-chat-tool-call":`_rst-chat-tool-call_sqjcv_46`,"rst-chat-tool-call-success":`_rst-chat-tool-call-success_sqjcv_65`,"rst-chat-tool-call-error":`_rst-chat-tool-call-error_sqjcv_69`,"rst-chat-input-form":`_rst-chat-input-form_sqjcv_73`,"rst-chat-actions":`_rst-chat-actions_sqjcv_87`,"rst-chat-input-wrapper":`_rst-chat-input-wrapper_sqjcv_100`,"rst-chat-empty":`_rst-chat-empty_sqjcv_107`,"rst-chat-processing":`_rst-chat-processing_sqjcv_118`,"rst-chat-confirmation":`_rst-chat-confirmation_sqjcv_127`,"rst-chat-confirmation-actions":`_rst-chat-confirmation-actions_sqjcv_134`,"rst-chat-tool-call-pending":`_rst-chat-tool-call-pending_sqjcv_139`,"rst-chat-quick-actions":`_rst-chat-quick-actions_sqjcv_145`,"rst-chat-quick-action":`_rst-chat-quick-action_sqjcv_145`};function AW({messages:e,isProcessing:t,emptyStateText:n=`Ask me something...`,inputValue:r,onInputChange:i,onKeyDown:a,onSubmit:o,onConfirm:s,onReject:c,quickActions:l,onQuickAction:u}){let f=(0,d.useRef)(null),p=e.some(e=>e.status===`pending`);return(0,d.useEffect)(()=>{f.current?.scrollIntoView({behavior:`smooth`})},[e]),(0,h.jsxs)(`div`,{className:kW[`rst-chat-container`],children:[e.length===0?(0,h.jsx)(`div`,{className:kW[`rst-chat-empty`],children:n}):(0,h.jsxs)(`div`,{className:kW[`rst-chat-messages`],children:[e.map(e=>(0,h.jsxs)(`div`,{className:`${kW[`rst-chat-message`]} ${kW[`rst-chat-message-${e.role}`]}`,children:[(0,h.jsx)(`div`,{className:`${kW[`rst-chat-bubble`]} ${kW[`rst-chat-bubble-${e.role}`]}`,children:e.content}),e.status===`pending`&&e.toolCalls&&e.toolCalls.length>0&&(0,h.jsxs)(`div`,{className:kW[`rst-chat-confirmation`],children:[(0,h.jsx)(`div`,{className:kW[`rst-chat-tool-calls`],children:e.toolCalls.map((e,t)=>(0,h.jsxs)(`div`,{className:`${kW[`rst-chat-tool-call`]} ${kW[`rst-chat-tool-call-pending`]}`,children:[(0,h.jsx)(`span`,{children:`◷`}),(0,h.jsx)(`span`,{children:e.tool.replace(/_/g,` `)})]},t))}),(0,h.jsxs)(`div`,{className:kW[`rst-chat-confirmation-actions`],children:[(0,h.jsx)(D,{variant:`primary`,value:`Apply`,onClick:()=>s?.()}),(0,h.jsx)(D,{variant:`invisible`,value:`Discard`,onClick:()=>c?.()})]})]}),e.status!==`pending`&&e.executionResults&&e.executionResults.length>0&&(0,h.jsx)(`div`,{className:kW[`rst-chat-tool-calls`],children:e.executionResults.map((e,t)=>(0,h.jsxs)(`div`,{className:`${kW[`rst-chat-tool-call`]} ${e.success?kW[`rst-chat-tool-call-success`]:kW[`rst-chat-tool-call-error`]}`,children:[(0,h.jsx)(`span`,{children:e.success?`✓`:`✗`}),(0,h.jsx)(`span`,{children:e.message})]},t))})]},e.id)),t&&(0,h.jsx)(`div`,{className:kW[`rst-chat-processing`],children:(0,h.jsx)(`span`,{children:`Processing...`})}),(0,h.jsx)(`div`,{ref:f})]}),(0,h.jsxs)(`form`,{className:kW[`rst-chat-input-form`],onSubmit:o,children:[l&&l.length>0&&(0,h.jsx)(`div`,{className:kW[`rst-chat-quick-actions`],children:l.map((e,n)=>(0,h.jsx)(`button`,{type:`button`,className:kW[`rst-chat-quick-action`],disabled:t||!!p,onClick:()=>u?.(e.prompt),children:e.label},n))}),(0,h.jsx)(`div`,{className:kW[`rst-chat-input-wrapper`],children:(0,h.jsx)(OW,{value:r,onChange:i,onKeyDown:a,placeholder:`Ask something...`,disabled:t||p,rows:1})}),(0,h.jsxs)(`div`,{className:kW[`rst-chat-actions`],children:[(0,h.jsx)(D,{variant:`invisible`,disabled:!0,leadingVisual:`plus`,value:`Add files`}),(0,h.jsx)(D,{variant:`primary`,type:`submit`,disabled:t||!r.trim()||p,leadingVisual:`send`})]})]})]})}function jW({aiProvider:e,toolDefinitions:t,schema:n,tableContext:r,onExecute:i,onValidate:a,emptyStateText:o,requiresConfirmation:s,quickActions:c}){let[l,u]=(0,d.useState)([]),[f,p]=(0,d.useState)(``),[m,g]=(0,d.useState)(!1),[_,v]=(0,d.useState)(null),y=(0,d.useCallback)(async o=>{if(!o||m||_)return;let c={id:`msg-${Date.now()}`,role:`user`,content:o,timestamp:new Date().toISOString()};u(e=>[...e,c]),g(!0);try{let c=await e.processMessage(o,n,t,r),l=c.toolCalls,d=[];if(a){let e=a(c.toolCalls,n);l=e.valid,d=e.errors}if(s&&l.length>0){let e=`msg-${Date.now()+1}`,t={id:e,role:`assistant`,content:c.message,toolCalls:l,status:`pending`,timestamp:new Date().toISOString()};u(e=>[...e,t]),v({messageId:e,validCalls:l,validationErrors:d})}else{let e=[];l.length>0&&(e=i(l)),d.length>0&&(e=[...e,...d.map(e=>({tool:`validation`,success:!1,message:e}))]);let t={id:`msg-${Date.now()+1}`,role:`assistant`,content:c.message,toolCalls:l,executionResults:e,timestamp:new Date().toISOString()};u(e=>[...e,t])}}catch(e){let t={id:`msg-${Date.now()+1}`,role:`assistant`,content:e instanceof Error?e.message:`An error occurred while processing your request.`,timestamp:new Date().toISOString()};u(e=>[...e,t])}finally{g(!1)}},[m,_,e,n,r,t,i,a,s]),b=(0,d.useCallback)(async e=>{e?.preventDefault();let t=f.trim();t&&(p(``),await y(t))},[f,y]),x=(0,d.useCallback)(async e=>{await y(e)},[y]),S=(0,d.useCallback)(()=>{if(!_)return;let e=i(_.validCalls),t=_.validationErrors.length>0?[...e,..._.validationErrors.map(e=>({tool:`validation`,success:!1,message:e}))]:e;u(e=>e.map(e=>e.id===_.messageId?{...e,status:`confirmed`,executionResults:t}:e)),v(null)},[_,i]),C=(0,d.useCallback)(()=>{_&&(u(e=>e.map(e=>e.id===_.messageId?{...e,status:`rejected`,executionResults:[{tool:`confirmation`,success:!1,message:`Discarded by user`}]}:e)),v(null))},[_]);return(0,h.jsx)(AW,{messages:l,isProcessing:m,emptyStateText:o,inputValue:f,onInputChange:p,onKeyDown:(0,d.useCallback)(e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),b())},[b]),onSubmit:b,onConfirm:_?S:void 0,onReject:_?C:void 0,quickActions:c,onQuickAction:x})}function MW({aiProvider:e,requiresConfirmation:t,quickActions:n}){let{data:r,columns:i,state:a}=RH(),{execute:o}=hW();return(0,h.jsx)(jW,{aiProvider:e,toolDefinitions:bW,schema:(0,d.useMemo)(()=>yW(i,r),[i,r]),tableContext:(0,d.useMemo)(()=>{let e={};for(let[t,n]of Object.entries(a.columnPinning))(n===`left`||n===`right`)&&(e[t]=n);return{rows:r,sorting:a.sorting.map(e=>({column:e.id,direction:e.desc?`desc`:`asc`})),grouping:a.grouping,selectedRowIds:Array.from(a.selectedRows),hiddenColumnIds:Array.from(a.hiddenColumns),columnOrder:a.columnOrder,columnPinning:Object.keys(e).length>0?e:void 0}},[r,a]),onExecute:o,onValidate:(0,d.useCallback)((e,t)=>EW(e,t),[]),emptyStateText:`Ask me to sort, select rows, hide columns, reorder columns, edit cells, or fill a column based on another.`,requiresConfirmation:t,quickActions:n})}var NW=5;function PW({className:e,virtualizedRowHeight:t=40,virtualizedContainerHeight:n=400,onGroupingChange:r,onRowClick:i,loading:a=!1}){let{visibleColumns:o,getRows:s,options:c,state:l}=RH(),{enableEditing:u=!1,enableVirtualization:f=!0,columnSizing:p=`auto`}=c,m=s(),g=(0,d.useMemo)(()=>DH(o,l.columnPinning,c.enableSelection??!1),[o,l.columnPinning,c.enableSelection]),{virtualItems:_,containerProps:v,scrollInfo:y}=WU({items:f?m:[],itemHeight:t,containerHeight:n,overscan:5}),b=_.length>0?_[0].offsetTop:0,x=y.totalHeight-(b+_.length*t),S=[X[`rst-table-grid`],p===`fixed`?X[`rst-table-grid-fixed`]:``,e].filter(Boolean).join(` `),C=f?{...v,className:X[`rst-table-container`],style:v.style}:{className:X[`rst-table-container`]},w=o.length+ +!!c.enableSelection;return a?(0,h.jsx)(`div`,{...C,children:(0,h.jsxs)(`table`,{className:S,children:[(0,h.jsx)(nW,{columnOffsets:g,onGroupingChange:r}),(0,h.jsx)(`tbody`,{className:X[`rst-table-body`],children:Array.from({length:NW}).map((e,t)=>(0,h.jsxs)(`tr`,{className:X[`rst-table-skeleton-row`],children:[c.enableSelection&&(0,h.jsx)(`td`,{className:X[`rst-table-skeleton-cell`],children:(0,h.jsx)(LV,{width:`16px`,height:`16px`})}),o.map((e,t)=>(0,h.jsx)(`td`,{className:X[`rst-table-skeleton-cell`],children:(0,h.jsx)(LV,{width:t===0?`60%`:`80%`,height:`14px`})},xH(e,t)))]},t))})]})}):(0,h.jsx)(`div`,{...C,children:(0,h.jsxs)(`table`,{className:S,children:[(0,h.jsx)(nW,{columnOffsets:g,onGroupingChange:r}),(0,h.jsxs)(`tbody`,{className:X[`rst-table-body`],children:[f&&b>0&&(0,h.jsx)(`tr`,{style:{height:b},children:(0,h.jsx)(`td`,{colSpan:o.length,style:{padding:0,border:0}})}),f?_.map(({item:e,index:t})=>(0,h.jsx)(UU,{row:e,onRowClick:i,isEnableEditing:u,"aria-rowindex":t+1,columnOffsets:g},e.id)):m.map((e,t)=>(0,h.jsx)(UU,{row:e,onRowClick:i,isEnableEditing:u,"aria-rowindex":t+1,columnOffsets:g},e.id)),f&&x>0&&(0,h.jsx)(`tr`,{style:{height:x},children:(0,h.jsx)(`td`,{colSpan:o.length,style:{padding:0,border:0}})}),(!f&&m.length===0||f&&_.length===0)&&(0,h.jsx)(`tr`,{children:(0,h.jsx)(`td`,{colSpan:w,className:X[`rst-table-empty-state`],children:(0,h.jsx)(`span`,{className:X[`rst-table-empty-state-label`],children:`No data available`})})})]}),(0,h.jsx)(qU,{columnOffsets:g})]})})}function FW({enablePivot:e,enableFormulaBuilder:t,pivotConfig:n,onPivotConfigChange:r,onFormulaColumnAdd:i,aiProvider:a,requiresConfirmation:o,aiQuickActions:s,className:c,virtualizedRowHeight:l,virtualizedContainerHeight:u,onGroupingChange:f,onRowClick:p,loading:m}){let{data:g,columns:_,state:v,options:y,toggleColumnVisibility:b}=RH(),{enableColumnVisibility:x,enableAIAssistant:S}=y,[C,w]=(0,d.useState)(!1),[T,E]=(0,d.useState)(null),[O,k]=(0,d.useState)(n??{rowFields:[],columnFields:[],valueFields:[]});(0,d.useEffect)(()=>{n&&k(n)},[n]);let j=e||t||x||S&&a,M=()=>{let e=!C;w(e),E(e?`pivot`:null)},N=()=>{E(e=>e===`formula`?null:`formula`)},P=()=>{E(e=>e===`columns`?null:`columns`)},F=()=>{E(e=>e===`ai`?null:`ai`)},ee=(0,d.useCallback)(e=>{k(e),r?.(e)},[r]),te=O.valueFields.length>0||O.rowFields.length>0||O.columnFields.length>0,ne=(0,d.useMemo)(()=>!C||!te?null:oW(g,O,_),[g,O,_,C,te]);return(0,h.jsxs)(`div`,{className:X[`rst-table-outer`],children:[(0,h.jsx)(`div`,{className:X[`rst-table-outer-content`],children:C?ne?(0,h.jsx)(lW,{pivotData:ne}):(0,h.jsx)(`div`,{className:X[`rst-pivot-empty`],children:`Configure the pivot: drag fields to Rows, Columns, or Values in the panel.`}):(0,h.jsx)(PW,{className:c,virtualizedRowHeight:l,virtualizedContainerHeight:u,onGroupingChange:f,onRowClick:p,loading:m})}),j&&(0,h.jsx)(uW,{enablePivot:e,enableFormula:t,enableColumnVisibility:x,enableAI:!!S&&!!a,isPivotMode:C,activeTool:T,onPivotClick:M,onFormulaClick:N,onColumnVisibilityClick:P,onAIClick:F}),T===`pivot`&&(0,h.jsxs)(`div`,{className:X[`rst-table-tool-panel`],children:[(0,h.jsxs)(`div`,{className:X[`rst-table-tool-panel-header`],children:[(0,h.jsx)(`span`,{className:X[`rst-table-tool-panel-title`],children:`Pivot`}),(0,h.jsx)(D,{variant:`invisible`,size:`small`,leadingVisual:`close`,onClick:()=>E(null)})]}),(0,h.jsx)(`div`,{className:X[`rst-table-tool-panel-body`],children:(0,h.jsx)(cW,{columns:_,config:O,onConfigChange:ee})})]}),T===`formula`&&(0,h.jsxs)(`div`,{className:X[`rst-table-tool-panel`],children:[(0,h.jsxs)(`div`,{className:X[`rst-table-tool-panel-header`],children:[(0,h.jsx)(`span`,{className:X[`rst-table-tool-panel-title`],children:`Formula Builder`}),(0,h.jsx)(D,{variant:`invisible`,size:`small`,leadingVisual:`close`,onClick:()=>E(null)})]}),(0,h.jsx)(`div`,{className:X[`rst-table-tool-panel-body`],children:(0,h.jsx)(dW,{existingColumns:_,sampleRow:g[0],onSave:e=>{i?.(e),E(null)},onCancel:()=>E(null)})})]}),T===`columns`&&(0,h.jsxs)(`div`,{className:X[`rst-table-tool-panel`],children:[(0,h.jsxs)(`div`,{className:X[`rst-table-tool-panel-header`],children:[(0,h.jsx)(`span`,{className:X[`rst-table-tool-panel-title`],children:`Columns`}),(0,h.jsx)(D,{variant:`invisible`,size:`small`,leadingVisual:`close`,onClick:()=>E(null)})]}),(0,h.jsx)(`div`,{className:X[`rst-table-tool-panel-body`],children:(0,h.jsx)(`div`,{className:X[`rst-column-visibility-list`],children:_.map((e,t)=>{let n=e.id??e.accessorKey??String(t),r=typeof e.header==`string`?e.header:n,i=v.hiddenColumns.has(n);return(0,h.jsxs)(`label`,{className:X[`rst-column-visibility-item`],children:[(0,h.jsx)(A,{checked:!i,onChange:()=>b(n),"aria-label":r}),(0,h.jsx)(`span`,{className:X[`rst-column-visibility-label`],children:r})]},n)})})})]}),T===`ai`&&a&&(0,h.jsxs)(`div`,{className:X[`rst-table-tool-panel`],children:[(0,h.jsxs)(`div`,{className:X[`rst-table-tool-panel-header`],children:[(0,h.jsx)(`span`,{className:X[`rst-table-tool-panel-title`],children:`AI Assistant`}),(0,h.jsx)(D,{variant:`invisible`,size:`small`,leadingVisual:`close`,onClick:()=>E(null)})]}),(0,h.jsx)(`div`,{className:X[`rst-table-tool-panel-body`],children:(0,h.jsx)(MW,{aiProvider:a,requiresConfirmation:o,quickActions:s})})]})]})}function IW({data:e,columns:t,getSubRows:n,onDataChange:r,onSelectionChange:i,enableSorting:a,enableSelection:o,enableEditing:s,enableGrouping:c,enableVirtualization:l,stickyHeader:u,stickyFooter:f,columnSizing:p,enableColumnReorder:m,enableColumnVisibility:g,enableAIAssistant:_,aiProvider:v,onFormulaColumnAdd:y,loading:b,...x}){let S={enableSorting:a,enableSelection:o,enableEditing:s,enableGrouping:c,enableVirtualization:l,stickyHeader:u,stickyFooter:f,columnSizing:p,enableColumnReorder:m,enableColumnVisibility:g,enableAIAssistant:_},C=e[0]?Object.keys(e[0]):[],w=t||mH(C),[T,E]=(0,d.useState)([]),D=(0,d.useMemo)(()=>[...w,...T],[w,T]),O=(0,d.useCallback)(e=>{E(t=>[...t,e]),y?.(e)},[y]);return(0,h.jsx)(IH,{initialData:e,columns:D,getSubRows:n,onDataChange:r,onSelectionChange:i,options:S,addFormulaColumn:O,children:(0,h.jsx)(FW,{...x,loading:b,onFormulaColumnAdd:O,aiProvider:v})})}function LW(e,t,n){let r=e.map(e=>{let t=` - id: "${e.id}", label: "${e.label}", type: ${e.type}`;return e.options&&e.options.length>0&&(t+=`, options: [${e.options.map(e=>`"${e}"`).join(`, `)}]`),t}).join(`
74
74
  `),i=t.map(e=>{let t=e.parameters.map(e=>` - ${e.name} (${e.type}${e.required?`, required`:``}): ${e.description}`).join(`
75
75
  `);return` ### ${e.name}\n ${e.description}\n Parameters:\n${t}`}).join(`
76
76
 
@@ -103,7 +103,7 @@ You MUST respond with valid JSON in the following format:
103
103
  4. If the user request is unclear, return an empty toolCalls array and ask for clarification in the message.
104
104
  5. Match column references case-insensitively. If the user says "Name", map it to the column with label "Name".
105
105
  6. Respond in the same language as the user's input.
106
- 7. When using fill_column_from_column, read each row's sourceColumn value from the Table Data section and determine the best targetColumn value. Return every row's assignment in the "edits" array.`}var LW=class{delay;constructor(e=500){this.delay=e}async processMessage(e,t,n,r){await new Promise(e=>setTimeout(e,this.delay));let i=e.toLowerCase(),a=r?.rows;if(i.includes(`select`)||i.includes(`seleziona`)){let e=this.extractCondition(i,t);if(e)return{message:`Selecting rows where ${e.column} ${e.operator} "${e.value}"`,toolCalls:[{tool:`select_rows`,arguments:{conditions:[e]}}]}}if(i.includes(`sort`)||i.includes(`ordina`)||i.includes(`riordina`)){let e=this.findColumnRef(i,t),n=i.includes(`desc`)||i.includes(`discendente`)||i.includes(`decrescente`);if(e)return{message:`Sorting by "${e}" ${n?`descending`:`ascending`}`,toolCalls:[{tool:`sort`,arguments:{column:e,direction:n?`desc`:`asc`}}]}}if(i.includes(`hide`)||i.includes(`nascondi`)){let e=this.findColumnRef(i,t);if(e)return{message:`Hiding column "${e}"`,toolCalls:[{tool:`column_visibility`,arguments:{column:e,visible:!1}}]}}if(i.includes(`show column`)||i.includes(`mostra colonna`)){let e=this.findColumnRef(i,t);if(e)return{message:`Showing column "${e}"`,toolCalls:[{tool:`column_visibility`,arguments:{column:e,visible:!0}}]}}if((i.includes(`sort`)||i.includes(`ordina`))&&(i.includes(`select`)||i.includes(`seleziona`))){let e=[],n=this.findColumnRef(i.split(/and|e|then|poi/)[0],t);if(n){let t=i.includes(`desc`)||i.includes(`discendente`);e.push({tool:`sort`,arguments:{column:n,direction:t?`desc`:`asc`}})}let r=this.extractCondition(i,t);if(r&&e.push({tool:`select_rows`,arguments:{conditions:[r]}}),e.length>0)return{message:`Executing ${e.length} action(s)`,toolCalls:e}}if(i.includes(`edit`)||i.includes(`modifica`)||i.includes(`cambia`))return{message:`I can edit cells for you. Please specify the row number, column, and new value.`,toolCalls:[]};if(i.includes(`reorder columns`)||i.includes(`riordina colonne`))return{message:`Reversing column order as a demo`,toolCalls:[{tool:`column_order`,arguments:{order:[...t.map(e=>e.id)].reverse()}}]};if(i.includes(`group by`)||i.includes(`raggruppa per`)||i.includes(`group per`)){let e=this.findColumnRef(i,t);if(e)return{message:`Grouping rows by "${e}"`,toolCalls:[{tool:`group_by`,arguments:{columns:[e]}}]}}if(i.includes(`clear group`)||i.includes(`remove group`)||i.includes(`rimuovi raggruppa`))return{message:`Clearing all grouping`,toolCalls:[{tool:`group_by`,arguments:{columns:[]}}]};if(i.includes(`pin`)||i.includes(`blocca colonna`)){let e=this.findColumnRef(i,t);if(e){let t=i.includes(`right`)||i.includes(`destra`)?`right`:`left`;return{message:`Pinning column "${e}" to the ${t}`,toolCalls:[{tool:`pin_column`,arguments:{column:e,side:t}}]}}}if(i.includes(`unpin`)||i.includes(`sblocca colonna`)){let e=this.findColumnRef(i,t);if(e)return{message:`Unpinning column "${e}"`,toolCalls:[{tool:`pin_column`,arguments:{column:e,side:`none`}}]}}if((i.includes(`sort by`)||i.includes(`ordina per`))&&(i.includes(` and `)||i.includes(` then `)||i.includes(` poi `)||i.includes(` e `))){let e=i.split(/\band\b|\bthen\b|\bpoi\b/),n=[];for(let r of e){let e=this.findColumnRef(r,t);if(e){let t=r.includes(`desc`)||r.includes(`discendente`)||r.includes(`decrescente`);n.push({column:e,direction:t?`desc`:`asc`})}}if(n.length>1)return{message:`Sorting by ${n.map(e=>`"${e.column}" ${e.direction}`).join(`, `)}`,toolCalls:[{tool:`multi_sort`,arguments:{sorts:n}}]}}if(i.includes(`reset`)||i.includes(`clear all`)||i.includes(`clear table`)||i.includes(`azzera`)||i.includes(`ripristina`))return{message:`Resetting table to default state`,toolCalls:[{tool:`clear_state`,arguments:{}}]};if((i.includes(`fill`)||i.includes(`riempi`)||i.includes(`compila`)||i.includes(`aggiorna`)||i.includes(`update`))&&(i.includes(`based on`)||i.includes(`in base a`)||i.includes(`dalla`)||i.includes(`from`))){let e=t.filter(e=>i.includes(e.label.toLowerCase())||i.includes(e.id.toLowerCase()));if(e.length>=2&&a&&a.length>0){let t=e.find(e=>e.options&&e.options.length>0)??e[0],n=e.find(e=>e.id!==t.id)??e[1],r=t.options??[],i=a.map((e,t)=>({rowIndex:t,value:r.length>0?r[t%r.length]:`auto`}));return{message:`Filling "${t.label}" based on "${n.label}" (${i.length} rows)`,toolCalls:[{tool:`fill_column_from_column`,arguments:{targetColumn:t.id,sourceColumn:n.id,edits:i}}]}}return{message:`Please specify which column to fill and which column to use as the source (e.g. 'fill category based on description').`,toolCalls:[]}}if(i.includes(`formula`)||i.includes(`calculated column`)||i.includes(`compute`)||i.includes(`calcola`)||i.includes(`colonna calcolata`)){let e=i.match(/(?:called|named|column|colonna)\s+['"]?([\w\s]+?)['"]?\s+(?:with|using|=|formula|che)/i),t=i.match(/(?:formula|expression|expr|=)\s*['"]?([^'"]+)['"]?\s*$/i),n=e?e[1].trim():`Computed`,r=t?t[1].trim():null;return r?{message:`Creating formula column "${n}" with expression: ${r}`,toolCalls:[{tool:`create_formula`,arguments:{header:n,formula:r}}]}:{message:`I can create a formula column for you. Please specify a column name and a formula expression using column field names (e.g. 'create a formula column called Profit with formula revenue - cost').`,toolCalls:[]}}return{message:`I didn't understand that request. Try asking me to sort, select rows, hide/show columns, or edit cells.`,toolCalls:[]}}findColumnRef(e,t){let n=e.toLowerCase(),r=[...t].sort((e,t)=>t.label.length-e.label.length);for(let e of r)if(n.includes(e.label.toLowerCase()))return e.id;for(let e of t)if(n.includes(e.id.toLowerCase()))return e.id;return null}extractCondition(e,t){for(let n of[/(?:where|dove|con)\s+(.+?)\s+(?:is|è|=|equals)\s+(.+)/i,/(?:column|colonna)\s+(.+?)\s+(?:is|è|=|equals)\s+(.+)/i,/(.+?)\s+(?:above|sopra|greater than|maggiore di|>)\s+(\d+)/i,/(.+?)\s+(?:below|sotto|less than|minore di|<)\s+(\d+)/i]){let r=e.match(n);if(r){let n=r[1].trim(),i=r[2].trim(),a=this.findColumnRef(n,t);if(a){let t=`equals`;return e.includes(`above`)||e.includes(`sopra`)||e.includes(`greater`)||e.includes(`maggiore`)||e.includes(`>`)?t=`greater_than`:(e.includes(`below`)||e.includes(`sotto`)||e.includes(`less`)||e.includes(`minore`)||e.includes(`<`))&&(t=`less_than`),{column:a,operator:t,value:isNaN(Number(i))?i:Number(i)}}}}return null}},RW={"rst-shortcut-tooltip":`_rst-shortcut-tooltip_1w51f_2`,fadeIn:`_fadeIn_1w51f_1`,"rst-shortcut-tooltip-content":`_rst-shortcut-tooltip-content_1w51f_15`,"rst-shortcut-tooltip-progress":`_rst-shortcut-tooltip-progress_1w51f_22`,"rst-shortcut-tooltip-progress-bar":`_rst-shortcut-tooltip-progress-bar_1w51f_31`},zW=({isVisible:e,shortcut:t,functionName:n,holdDuration:r,holdProgress:i=0,position:a})=>{if(!e)return null;let o=r&&i>0?Math.min(i/r*100,100):0;return(0,h.jsxs)(`div`,{className:RW[`rst-shortcut-tooltip`],style:{left:a.x,top:a.y,transform:`translate(-50%, calc(-100% - 8px))`},children:[(0,h.jsxs)(`div`,{className:RW[`rst-shortcut-tooltip-content`],children:[(0,h.jsx)(cH,{keys:t,showSeparator:!0}),(0,h.jsx)(T,{variant:`caption`,children:n})]}),r&&r>0&&(0,h.jsx)(`div`,{className:RW[`rst-shortcut-tooltip-progress`],children:(0,h.jsx)(`div`,{className:RW[`rst-shortcut-tooltip-progress-bar`],style:{width:`${o}%`,minWidth:o>0?`2px`:`0px`}})})]})},BW=(0,d.createContext)(null),VW=({children:e})=>{let[t]=(0,d.useState)(new Map),[n,r]=(0,d.useState)(new Set),[i,a]=(0,d.useState)({isVisible:!1,shortcut:[],functionName:``,holdProgress:0,position:{x:0,y:0}}),o=(0,d.useRef)(void 0),s=(0,d.useRef)(void 0),c=(0,d.useRef)({x:0,y:0}),l=(0,d.useRef)(new Set),u=(0,d.useRef)(null),f=(0,d.useRef)(new Set);(0,d.useEffect)(()=>{let e=e=>{c.current={x:e.clientX,y:e.clientY}};return document.addEventListener(`mousemove`,e),()=>document.removeEventListener(`mousemove`,e)},[]);let p=(0,d.useCallback)(()=>{a(e=>({...e,isVisible:!1})),o.current&&=(clearTimeout(o.current),void 0),s.current&&=(clearInterval(s.current),void 0),u.current=null,f.current.clear()},[]),m=(0,d.useCallback)((e,n,r)=>{let i=iB(e),a={...n,componentId:r,holdDuration:n.holdDuration===0?3e3:n.holdDuration};t.set(i,a)},[t]),g=(0,d.useCallback)(e=>{t.delete(e)},[t]),_=(0,d.useCallback)(e=>{r(t=>new Set(t).add(e))},[]),v=(0,d.useCallback)(e=>{r(t=>{let n=new Set(t);return n.delete(e),n})},[]),y=(0,d.useCallback)(e=>{let r=t.get(e);if(r&&!(u.current&&u.current!==e)&&!(r.componentId&&!n.has(r.componentId)))if(a({isVisible:!0,shortcut:nB(e.split(`+`).map(e=>e.trim())),functionName:r.name,holdDuration:r.holdDuration,holdProgress:0,position:c.current}),r.holdDuration){u.current=e;let t=Date.now();s.current=setInterval(()=>{let e=Date.now()-t,n=Math.min(e,r.holdDuration);a(e=>({...e,holdProgress:n}))},16),o.current=setTimeout(()=>{u.current===e&&(r.action(),f.current.add(e),p())},r.holdDuration)}else r.action(),setTimeout(p,1500)},[t,n,p]);(0,d.useEffect)(()=>{let e=e=>{let n=[];(e.ctrlKey||e.metaKey)&&n.push(`ctrl`),e.shiftKey&&n.push(`shift`),e.altKey&&n.push(`alt`);let r=tB(e.key);r&&![`ctrl`,`shift`,`alt`,`cmd`].includes(r)&&n.push(r);let i=n.join(`+`);if(n.forEach(e=>l.current.add(e)),t.has(i)){if(e.preventDefault(),e.repeat||f.current.has(i))return;y(i)}},n=e=>{let t=tB(e.key);t===`control`||t===`meta`?l.current.delete(`ctrl`):t===`shift`?l.current.delete(`shift`):t===`alt`?l.current.delete(`alt`):l.current.delete(t),u.current&&(u.current.split(`+`).every(e=>l.current.has(e.trim()))||(f.current.add(u.current),p())),l.current.size===0&&f.current.clear()};return document.addEventListener(`keydown`,e),document.addEventListener(`keyup`,n),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`keyup`,n)}},[t,y,p]);let b={registerShortcut:m,unregisterShortcut:g,triggerShortcut:y,registerComponent:_,unregisterComponent:v};return(0,h.jsxs)(BW.Provider,{value:b,children:[e,(0,h.jsx)(zW,{...i})]})},HW=(e={})=>{let t=(0,d.useContext)(BW),n=(0,d.useRef)([]),{scope:r=`component`,enabled:i=!0}=e,a=(0,d.useId)(),o=(0,d.useMemo)(()=>r===`component`?`component-${a}`:void 0,[r,a]);if(!t)throw Error(`useShortcut must be used within a ShortcutProvider`);let{registerShortcut:s,unregisterShortcut:c,triggerShortcut:l,registerComponent:u,unregisterComponent:f}=t,p=(0,d.useCallback)((e,t)=>{i&&(s(e,t,o),n.current.push(e))},[s,o,i]),m=(0,d.useCallback)(e=>{c(e),n.current=n.current.filter(t=>t!==e)},[c]),h=(0,d.useCallback)(()=>{r===`component`&&o&&i&&u(o)},[r,o,u,i]),g=(0,d.useCallback)(()=>{r===`component`&&o&&f(o)},[r,o,f]);return(0,d.useEffect)(()=>{if(r===`component`)return()=>{n.current.forEach(e=>{c(e)}),o&&f(o)}},[r,c,o,f]),{register:p,unregister:m,trigger:l,activate:h,deactivate:g}},UW=(0,d.createContext)(null),WW=()=>{let e=(0,d.useContext)(UW);if(!e)throw Error(`useScaffold must be used within a Scaffold component`);return e},GW={"rst-appbar":`_rst-appbar_1yrtz_2`,"rst-appbar-title":`_rst-appbar-title_1yrtz_12`,"rst-appbar-actions":`_rst-appbar-actions_1yrtz_22`},KW=Object.assign(({children:e,className:t,...n})=>(0,h.jsx)(`header`,{className:[GW[`rst-appbar`],t].filter(Boolean).join(` `),...n,children:e}),{Title:({children:e,className:t,...n})=>(0,h.jsx)(`div`,{className:[GW[`rst-appbar-title`],t].filter(Boolean).join(` `),...n,children:(0,h.jsx)(T,{variant:`heading`,children:e})}),Actions:({children:e,className:t,...n})=>(0,h.jsx)(`div`,{className:[GW[`rst-appbar-actions`],t].filter(Boolean).join(` `),...n,children:e}),MenuButton:({onClick:e,"aria-label":t=`Toggle menu`,...n})=>{let{toggleSidebar:r}=WW();return(0,h.jsx)(D,{variant:`invisible`,leadingVisual:`menu`,onClick:e||r,"aria-label":t,...n})}});KW.displayName=`AppBar`;var qW={"rst-breadcrumbs":`_rst-breadcrumbs_1tams_1`,"rst-breadcrumbs-list":`_rst-breadcrumbs-list_1tams_6`,"rst-breadcrumbs-separator":`_rst-breadcrumbs-separator_1tams_16`},JW=({items:e,collapsThreshold:t=3,...n})=>{let[r,i]=(0,d.useState)(!1),a=e.length>t,o=()=>{if(!a)return e.map((t,n)=>(0,h.jsxs)(d.default.Fragment,{children:[n>0&&(0,h.jsx)(`span`,{className:qW[`rst-breadcrumbs-separator`],children:`/`}),n===e.length-1?(0,h.jsx)(T,{variant:`title`,children:t.label}):(0,h.jsx)(D,{variant:`link`,onClick:t.onClick,value:t.label})]},t.value||n));let t=e[0],n=e[e.length-1],o=e.slice(1,e.length-1);return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(D,{variant:`link`,onClick:t.onClick,value:t.label}),(0,h.jsx)(`span`,{className:qW[`rst-breadcrumbs-separator`],children:`/`}),(0,h.jsx)(M,{isOpen:r,anchor:(0,h.jsx)(D,{leadingVisual:`plus`,variant:`invisible`,onClick:()=>i(!r)}),target:(0,h.jsx)(bV,{options:o.map(e=>({value:e.value||e.label,id:e.value})),onClick:e=>{o.find(t=>t.value===e.value||t.label===e.value)?.onClick?.(),i(!1)}})}),(0,h.jsx)(`span`,{className:qW[`rst-breadcrumbs-separator`],children:`/`}),(0,h.jsx)(T,{variant:`title`,children:n.label})]})};return(0,h.jsx)(`nav`,{className:qW[`rst-breadcrumbs`],"aria-label":`Breadcrumb`,...n,children:(0,h.jsx)(`ol`,{className:qW[`rst-breadcrumbs-list`],children:o()})})},YW=(0,d.createContext)(void 0),XW=()=>{let e=(0,d.useContext)(YW);if(!e)throw Error(`Sidebar compound components must be used within <Sidebar>`);return e},ZW={"rst-logo-container":`_rst-logo-container_66wnp_1`},QW=({logo:e})=>{let{isOpen:t,setHoveringLogo:n,isHoveringLogo:r,toggle:i}=XW();return(0,h.jsxs)(`div`,{className:{logoContainer:`${ZW[`rst-logo-container`]}`}.logoContainer,children:[!t&&r?(0,h.jsx)(D,{leadingVisual:`dock-right-arrow`,onClick:i}):(0,h.jsx)(D,{leadingVisual:e,variant:`invisible`,onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1)}),t&&(0,h.jsx)(D,{onClick:i,variant:`invisible`,leadingVisual:`dock-left-arrow`})]})},$W={"rst-sidebar":`_rst-sidebar_nmzg6_1`,"rst-sidebar-section":`_rst-sidebar-section_nmzg6_12`,"rst-sidebar-user":`_rst-sidebar-user_nmzg6_19`},eG=({children:e})=>{let{isSidebarOpen:t,toggleSidebar:n,isHoveringLogo:r,setHoveringLogo:i}=WW(),a=n,o={sidebar:`${$W[`rst-sidebar`]}`};return(0,h.jsx)(YW.Provider,{value:{isOpen:t,toggle:a,setHoveringLogo:i,isHoveringLogo:r},children:(0,h.jsx)(`div`,{style:{width:t?220:40,alignItems:t?``:`center`},className:o.sidebar,children:e})})};eG.displayName=`Sidebar`,eG.Logo=QW,eG.Item=({leadingVisual:e,label:t,shortcut:n,onClick:r})=>{let{isOpen:i}=XW();return i?(0,h.jsx)(fH.Item,{leadingVisual:e,"aria-label":t,shortcut:n,label:t,onClick:r}):(0,h.jsx)(D,{leadingVisual:e,"aria-label":t,variant:`invisible`,onClick:()=>r})},eG.Section=({title:e,children:t})=>{let n={sectionContainer:`${$W[`rst-sidebar-section`]}`},{isOpen:r}=XW();return(0,h.jsxs)(`div`,{className:n.sectionContainer,children:[e&&r&&(0,h.jsx)(`div`,{children:(0,h.jsx)(T,{variant:`label`,children:e})}),t]})},eG.User=({avatar:e,name:t})=>{let{isOpen:n}=XW();return(0,h.jsxs)(`div`,{className:$W[`rst-sidebar-user`],children:[e,n&&(0,h.jsx)(`span`,{style:{marginLeft:8},children:t})]})};var tG={"rst-scaffold":`_rst-scaffold_10eyy_2`,"rst-scaffold-sidebar":`_rst-scaffold-sidebar_10eyy_9`,"rst-scaffold-content":`_rst-scaffold-content_10eyy_17`,"rst-scaffold-appbar":`_rst-scaffold-appbar_10eyy_26`,"rst-scaffold-main":`_rst-scaffold-main_10eyy_32`},nG=e=>{if(typeof e.type==`function`||typeof e.type==`object`&&e.type!==null&&`displayName`in e.type)return e.type.displayName},rG=Object.assign(({children:e,defaultSidebarOpen:t=!0,className:n,...r})=>{let[i,a]=(0,d.useState)(t),[o,s]=(0,d.useState)(!1),c=(0,d.useCallback)(()=>{a(e=>!e)},[]),l=(0,d.useCallback)(e=>{a(e)},[]),u=d.default.Children.toArray(e),f=null,p=null,m=null,g=[];u.forEach(e=>{if(d.default.isValidElement(e))switch(nG(e)){case`Sidebar`:f=e;break;case`Drawer`:p=e;break;case`AppBar`:m=e;break;default:g.push(e);break}else g.push(e)});let _=[tG[`rst-scaffold`],n].filter(Boolean).join(` `);return(0,h.jsx)(UW.Provider,{value:{isSidebarOpen:i,toggleSidebar:c,setSidebarOpen:l,isHoveringLogo:o,setHoveringLogo:s},children:(0,h.jsxs)(`div`,{className:_,...r,children:[f&&(0,h.jsx)(`div`,{className:tG[`rst-scaffold-sidebar`],children:f}),(0,h.jsxs)(`div`,{className:tG[`rst-scaffold-content`],children:[m&&(0,h.jsx)(`div`,{className:tG[`rst-scaffold-appbar`],children:m}),(0,h.jsx)(`main`,{className:tG[`rst-scaffold-main`],children:g})]}),p]})})},{Content:({children:e,className:t,...n})=>(0,h.jsx)(`div`,{className:[tG[`rst-scaffold-content`],t].filter(Boolean).join(` `),...n,children:e})}),iG=class{config;constructor(e){this.config=e}layout(e){let t=this.convertToLayoutNode(e,null,0);this.config.layoutType===`radial`?this.calculateRadialPositions(t):this.calculatePositions(t);let n=this.collectNodes(t),r=this.calculateBounds(n);return this.normalizePositions(n,r),{nodes:n,root:t,width:Math.max(r.maxX-r.minX+this.config.nodeWidth,this.config.nodeWidth),height:Math.max(r.maxY-r.minY+this.config.nodeHeight,this.config.nodeHeight)}}convertToLayoutNode(e,t,n){let r={id:e.id,label:e.label,data:e.data,collapsed:e.collapsed,x:0,y:n*this.config.levelSpacing,depth:n,parent:t||void 0,prelim:0,mod:0,thread:void 0,change:0,shift:0,ancestor:void 0};return e.children&&(r.children=e.children.map(e=>this.convertToLayoutNode(e,r,n+1))),r}firstWalk(e){if(!e.children||e.children.length===0){let t;if(this.isLeftmost(e))t=0;else{let n=this.getLeftSibling(e);t=n?(n.prelim||0)+this.config.siblingSpacing+this.config.nodeWidth:0}Object.assign(e,{prelim:t})}else{let t=e.children[0],n=e.children[e.children.length-1];e.children.forEach(e=>this.firstWalk(e));let r=((t.prelim||0)+(n.prelim||0))/2,i,a=0;if(this.isLeftmost(e))i=r;else{let t=this.getLeftSibling(e);if(t){i=(t.prelim||0)+this.config.siblingSpacing+this.config.nodeWidth,a=i-r,Object.assign(e,{prelim:i,mod:a}),this.apportion(e);return}else i=r}Object.assign(e,{prelim:i,mod:a})}}secondWalk(e,t){let n=(e.prelim||0)+t;if(Object.assign(e,{x:n}),e.children&&e.children.length>0){let n=t+(e.mod||0);e.children.forEach(e=>this.secondWalk(e,n))}}apportion(e){if(!e.children||e.children.length===0)return;let t=this.getLeftSibling(e);if(!t)return;let n=e.children[0],r=this.getRightmostDescendant(t);if(n&&r){let t=(r.prelim||0)+this.config.siblingSpacing+this.config.nodeWidth-(n.prelim||0);if(t>0){let n=t;Object.assign(e,{prelim:(e.prelim||0)+n,mod:(e.mod||0)+n})}}}getRightmostDescendant(e){return!e.children||e.children.length===0?e:this.getRightmostDescendant(e.children[e.children.length-1])}isLeftmost(e){return!e.parent||e.parent.children[0]===e}getLeftSibling(e){if(!e.parent)return;let t=e.parent.children,n=t.indexOf(e);return n>0?t[n-1]:void 0}getRightmost(e){return e.children&&e.children.length>0?e.children[e.children.length-1]:e}getLeftmost(e){return e.children&&e.children.length>0?e.children[0]:e}calculatePositions(e){this.firstWalk(e),this.secondWalk(e,0)}collectNodes(e){let t=[];function n(e){t.push(e),e.children&&e.children.forEach(n)}return n(e),t}calculateBounds(e){let t=1/0,n=-1/0,r=1/0,i=-1/0;return e.forEach(e=>{t=Math.min(t,e.x),n=Math.max(n,e.x),r=Math.min(r,e.y),i=Math.max(i,e.y)}),{minX:t,maxX:n,minY:r,maxY:i}}normalizePositions(e,t){let n=-t.minX,r=-t.minY;e.forEach(e=>{let t={x:e.x+n,y:e.y+r};Object.assign(e,t)})}calculateRadialPositions(e){Object.assign(e,{x:0,y:0}),this.positionRadialLevel(e,1)}positionRadialLevel(e,t){if(!e.children||e.children.length===0)return;let n=t*this.config.levelSpacing,r=2*Math.PI/this.getTotalDescendants(e),i=this.getStartAngle(e);e.children.forEach(a=>{let o=i+r*this.getSubtreeSize(a)/2,s=e.x+n*Math.cos(o),c=e.y+n*Math.sin(o);Object.assign(a,{x:s,y:c}),i+=r*this.getSubtreeSize(a),this.positionRadialLevel(a,t+1)})}getTotalDescendants(e){return!e.children||e.children.length===0?1:e.children.reduce((e,t)=>e+this.getSubtreeSize(t),0)}getSubtreeSize(e){return!e.children||e.children.length===0?1:e.children.reduce((e,t)=>e+this.getSubtreeSize(t),0)}getStartAngle(e){return e.parent?Math.atan2(e.y-e.parent.y,e.x-e.parent.x)-Math.PI:-Math.PI/2}},aG={"rst-mind-tree":`_rst-mind-tree_11uth_1`,"rst-mind-tree-svg":`_rst-mind-tree-svg_11uth_11`,"rst-mind-tree-container":`_rst-mind-tree-container_11uth_17`,"rst-mind-tree-node":`_rst-mind-tree-node_11uth_21`,"rst-mind-tree-node-rect":`_rst-mind-tree-node-rect_11uth_26`,root:`_root_11uth_35`,"rst-mind-tree-node-text":`_rst-mind-tree-node-text_11uth_52`,"rst-mind-tree-link":`_rst-mind-tree-link_11uth_66`,"rst-mind-tree-expand-button":`_rst-mind-tree-expand-button_11uth_78`,"rst-mind-tree-expand-button-circle":`_rst-mind-tree-expand-button-circle_11uth_83`,"rst-mind-tree-expand-button-text":`_rst-mind-tree-expand-button-text_11uth_90`,"rst-mind-tree-controls":`_rst-mind-tree-controls_11uth_100`,"rst-mind-tree-zoom-group":`_rst-mind-tree-zoom-group_11uth_114`,"rst-mind-tree-zoom-slider-container":`_rst-mind-tree-zoom-slider-container_11uth_120`,"rst-mind-tree-zoom-slider":`_rst-mind-tree-zoom-slider_11uth_120`,"rst-mind-tree-zoom-label":`_rst-mind-tree-zoom-label_11uth_159`,"rst-mind-tree-node-entering":`_rst-mind-tree-node-entering_11uth_168`,"rst-mind-tree-node-entered":`_rst-mind-tree-node-entered_11uth_173`,"rst-mind-tree-node-exiting":`_rst-mind-tree-node-exiting_11uth_179`,"rst-mind-tree-link-entering":`_rst-mind-tree-link-entering_11uth_185`,"rst-mind-tree-link-entered":`_rst-mind-tree-link-entered_11uth_190`,"rst-mind-tree-control-button":`_rst-mind-tree-control-button_11uth_207`};function oG({data:e,width:t=800,height:n=600,nodeSpacing:r=80,levelSpacing:i=100,nodeWidth:a=120,nodeHeight:o=40,interactive:s=!0,renderNode:c,renderLink:l,onNodeClick:u,onNodeToggle:f,layoutType:p=`hierarchical`,className:m}){let[g,_]=(0,d.useState)(new Set),[v,y]=(0,d.useState)({x:0,y:0,scale:1}),[b,x]=(0,d.useState)(!1),[S,C]=(0,d.useState)({x:0,y:0}),w=(0,d.useRef)(null),E=(0,d.useMemo)(()=>[.25,.5,.75,1,1.25,1.5,2,3],[]),O=E.findIndex(e=>Math.abs(e-v.scale)<.01)??E.reduce((e,t,n)=>Math.abs(t-v.scale)<Math.abs(E[e]-v.scale)?n:e,0),k=(0,d.useMemo)(()=>new iG({siblingSpacing:r,levelSpacing:i,nodeWidth:a,nodeHeight:o,layoutType:p}).layout(e),[e,r,i,a,o,p]),A=(0,d.useMemo)(()=>{if(!k)return new Set;let e=new Set;function t(t){if(!t.parent)return e.add(t.id),!0;let n=e.has(t.parent.id),r=g.has(t.parent.id);return n&&!r?(e.add(t.id),!0):!1}function n(e){t(e),e.children&&e.children.forEach(n)}return n(k.root),e},[k,g]),j=(0,d.useCallback)(e=>{!e.children||e.children.length===0||(_(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n}),f?.(e))},[f]),M=(0,d.useCallback)(e=>{u?.(e)},[u]),N=(0,d.useCallback)(e=>{s&&(x(!0),C({x:e.clientX-v.x,y:e.clientY-v.y}))},[s,v]),P=(0,d.useCallback)(e=>{!b||!s||y(t=>({...t,x:e.clientX-S.x,y:e.clientY-S.y}))},[b,s,S]),F=(0,d.useCallback)(()=>{x(!1)},[]),ee=(0,d.useCallback)(e=>{if(!s)return;e.preventDefault();let t=e.deltaY>0?.9:1.1,n=Math.max(.1,Math.min(3,v.scale*t));y(e=>({...e,scale:n}))},[s,v.scale]);d.default.useEffect(()=>{let e=w.current;if(!e)return;let t=e=>ee(e);return e.addEventListener(`wheel`,t,{passive:!1}),()=>{e.removeEventListener(`wheel`,t)}},[ee]);let te=(0,d.useCallback)(()=>{let e=Math.min(E.length-1,O+1);y(t=>({...t,scale:E[e]}))},[O,E]),ne=(0,d.useCallback)(()=>{let e=Math.max(0,O-1);y(t=>({...t,scale:E[e]}))},[O,E]),re=(0,d.useCallback)(()=>{y({x:0,y:0,scale:1})},[]),I=(0,d.useCallback)(()=>{if(!k||!w.current)return;let e=(t-100)/k.width,r=(n-100)/k.height,i=Math.min(e,r,1);y({x:(t-k.width*i)/2,y:(n-k.height*i)/2,scale:i})},[k,t,n]),ie=(0,d.useCallback)((e,t)=>{function n(e,t){if(e.id===t)return e;if(e.children)for(let r of e.children){let e=n(r,t);if(e)return e}return null}return n(e,t)},[]),ae=(0,d.useCallback)((t,n)=>{let r=ie(e,t.id),i=r?.children&&r.children.length>0,s=g.has(t.id);return(0,h.jsxs)(`g`,{className:aG[`rst-mind-tree-node`],children:[(0,h.jsx)(`rect`,{className:`${aG[`rst-mind-tree-node-rect`]} ${n?aG.root:``}`,x:-a/2,y:-o/2,width:a,height:o,onClick:()=>M(t)}),(0,h.jsx)(`text`,{className:`${aG[`rst-mind-tree-node-text`]} ${n?aG.root:``}`,onClick:()=>M(t),children:t.id}),i&&(0,h.jsxs)(`g`,{className:aG[`rst-mind-tree-expand-button`],transform:`translate(${a/2-10}, 0)`,onClick:e=>{e.stopPropagation(),j(t)},children:[(0,h.jsx)(`circle`,{className:aG[`rst-mind-tree-expand-button-circle`],r:`8`}),(0,h.jsx)(`text`,{className:aG[`rst-mind-tree-expand-button-text`],children:s?`+`:`−`})]})]})},[ie,e,g,a,o,M,j]),oe=(0,d.useCallback)((e,t)=>{let n=e.x,r=e.y+o/2,i=t.x,a=t.y-o/2,s=r+(a-r)/2,c=`M ${n},${r}
107
- C ${n},${s} ${i},${s} ${i},${a}`;return(0,h.jsx)(`path`,{className:aG[`rst-mind-tree-link`],d:c},`${e.id}-${t.id}`)},[o]);return k?(0,h.jsxs)(`div`,{className:`${aG[`rst-mind-tree`]} ${m||``}`,children:[(0,h.jsx)(`svg`,{ref:w,className:aG[`rst-mind-tree-svg`],width:t,height:n,onMouseDown:N,onMouseMove:P,onMouseUp:F,onMouseLeave:F,style:{cursor:b?`grabbing`:`grab`},children:(0,h.jsxs)(`g`,{className:aG[`rst-mind-tree-container`],transform:`translate(${v.x}, ${v.y}) scale(${v.scale})`,children:[(0,h.jsx)(`g`,{children:k.nodes.map(e=>e.children?.filter(t=>A.has(e.id)&&A.has(t.id)).map(t=>l?l(e,t):oe(e,t))||[])}),(0,h.jsx)(`g`,{children:k.nodes.filter(e=>A.has(e.id)).map(e=>(0,h.jsx)(`g`,{transform:`translate(${e.x}, ${e.y})`,children:c?c(e,e===k.root):ae(e,e===k.root)},e.id))})]})}),s&&(0,h.jsxs)(`div`,{className:aG[`rst-mind-tree-controls`],children:[(0,h.jsxs)(`div`,{className:aG[`rst-mind-tree-zoom-group`],children:[(0,h.jsx)(D,{onClick:ne,value:`-`,disabled:O===0,title:`Zoom Out`}),(0,h.jsx)(`div`,{className:aG[`rst-mind-tree-zoom-slider-container`],children:(0,h.jsxs)(T,{variant:`body`,children:[Math.round(v.scale*100),`%`]})}),(0,h.jsx)(D,{onClick:te,value:`+`,title:`Zoom In`,disabled:O===E.length-1})]}),(0,h.jsx)(D,{onClick:I,value:`⌂`,title:`Fit to View`}),(0,h.jsx)(D,{onClick:re,value:`⟲`,title:`Reset View`})]})]}):null}var sG={"rst-calendar":`_rst-calendar_48fkh_1`,"rst-calendar-grid":`_rst-calendar-grid_48fkh_6`,"rst-calendar-cell":`_rst-calendar-cell_48fkh_11`,"rst-calendar-cell--otherMonth":`_rst-calendar-cell--otherMonth_48fkh_18`,"rst-calendar-date":`_rst-calendar-date_48fkh_22`,"rst-calendar-event":`_rst-calendar-event_48fkh_27`};function cG(e){if(!e)return null;if(e instanceof Date)return e;if(typeof e==`string`||typeof e==`number`){let t=new Date(e);return isNaN(t.getTime())?null:t}return null}function lG(e){return new Date(e.getFullYear(),e.getMonth(),1)}function uG(e,t){let n=new Date(e);return n.setDate(n.getDate()+t),n}function dG({data:e,columns:t,dateColumnId:n,eventColumnId:r,initialMonth:i}){let a=e[0]?Object.keys(e[0]):[],o=t||mH(a),s=(0,d.useMemo)(()=>lG(i||new Date),[i]),c=(0,d.useCallback)((e,t)=>{let n=o.find(e=>e.id===String(t)||e.accessorKey===t);return n?n.accessorFn?n.accessorFn(e):n.accessorKey?e[n.accessorKey]:e[n.id]??e[t]:e[t]},[o]),l=(0,d.useMemo)(()=>{let t=new Map;return e.forEach(e=>{let r=cG(c(e,n));if(!r)return;let i=r.toISOString().slice(0,10);t.has(i)||t.set(i,[]),t.get(i).push(e)}),t},[e,c,n]),u=(0,d.useMemo)(()=>{let e=lG(s);return uG(e,-e.getDay())},[s]),f=[];for(let e=0;e<42;e++)f.push(uG(u,e));return(0,h.jsxs)(`div`,{className:sG[`rst-calendar`],children:[(0,h.jsx)(`div`,{style:{marginBottom:8,fontWeight:700},children:s.toLocaleString(void 0,{month:`long`,year:`numeric`})}),(0,h.jsx)(`div`,{className:sG[`rst-calendar-grid`],children:f.map(e=>{let t=e.toISOString().slice(0,10),n=l.get(t)??[],i=e.getMonth()!==s.getMonth();return(0,h.jsxs)(`div`,{className:sG[`rst-calendar-cell`]+(i?` `+sG[`rst-calendar-cell--otherMonth`]:``),children:[(0,h.jsx)(`div`,{className:sG[`rst-calendar-date`],children:e.getDate()}),(0,h.jsx)(`div`,{children:n.map((e,t)=>{let n=c(e,r),i=typeof n==`string`||typeof n==`number`?String(n):JSON.stringify(n);return(0,h.jsx)(`div`,{className:sG[`rst-calendar-event`],title:i,children:i},t)})})]},t)})})]})}var fG={"rst-form":`_rst-form_qdlsq_1`,"rst-form-header":`_rst-form-header_qdlsq_9`,"rst-form-title":`_rst-form-title_qdlsq_13`,"rst-form-field":`_rst-form-field_qdlsq_20`,"rst-form-label":`_rst-form-label_qdlsq_26`,"rst-form-actions":`_rst-form-actions_qdlsq_32`,"rst-form-field-error":`_rst-form-field-error_qdlsq_40`,"rst-form-field-label-left":`_rst-form-field-label-left_qdlsq_46`};function pG({data:e,columns:t,layout:n,onSubmit:r,onCancel:i}){let[a,o]=(0,d.useState)(()=>e&&e.length>0?{...e[0]}:{}),s=e[0]?Object.keys(e[0]):[],c=t||mH(s),[l,u]=(0,d.useState)({});(0,d.useEffect)(()=>{e&&e.length>0&&o({...e[0]})},[e]);let f=(e,t)=>{if(e.accessorFn)return e.accessorFn(t);if(e.accessorKey)return t[e.accessorKey]},p=(e,t,n)=>{let r=n.accessorKey;o(t=>({...t,[r]:e})),l[r]&&u(e=>{let t={...e};return delete t[r],t})},m=(e,t,n)=>{let r=e.accessorKey;if(e.required&&(t==null||t===``))return e.requiredMessage||`${String(e.header||r)} is required`;if(e.validate)return e.validate(t,n)},g=()=>{let e={},t=!1;return c.forEach(n=>{let r=n.accessorKey;if(!r)return;let i=m(n,f(n,a),a);i&&(e[r]=i,t=!0)}),u(e),!t},_=e=>{e.preventDefault(),g()&&r?.(a)},v=(0,d.useMemo)(()=>{if(!n)return;let e=e=>{let t=n[e];if(!t)return;let r={};return c.forEach((e,n)=>{let i=e.id||String(e.accessorKey),a=t.blocks[i]||t.blocks[n];a&&(r[n]=a)}),{...t,blocks:r}};return{desktop:e(`desktop`)||n.desktop,tablet:e(`tablet`)||n.tablet,mobile:e(`mobile`)||n.mobile}},[n,c]);if(!e||e.length===0)return(0,h.jsx)(`div`,{children:`No data to display`});let y=c.map((e,t)=>{let n=e.accessorKey;return(0,h.jsx)(IU,{value:f(e,a),column:e,rowData:a,rowIndex:0,editMode:`always`,isEditable:!0,onValueChange:p,error:n?l[n]:void 0},t)});return(0,h.jsxs)(`form`,{className:fG[`rst-form`],onSubmit:_,children:[v?(0,h.jsx)(XV,{layout:v,children:y}):y,(0,h.jsxs)(`div`,{className:fG[`rst-form-actions`],children:[i&&(0,h.jsx)(D,{type:`button`,variant:`invisible`,onClick:i,value:`Cancel`}),(0,h.jsx)(D,{type:`submit`,variant:`primary`,value:`Save`})]})]})}var Q={"rst-layout-builder":`_rst-layout-builder_1dfsp_1`,"rst-layout-builder-navbar":`_rst-layout-builder-navbar_1dfsp_21`,"rst-layout-builder-content-wrapper":`_rst-layout-builder-content-wrapper_1dfsp_33`,"rst-layout-builder-footer":`_rst-layout-builder-footer_1dfsp_41`,"rst-layout-builder-toolbar":`_rst-layout-builder-toolbar_1dfsp_55`,"rst-layout-builder-group":`_rst-layout-builder-group_1dfsp_66`,"rst-layout-builder-label":`_rst-layout-builder-label_1dfsp_74`,"rst-layout-builder-grid-container":`_rst-layout-builder-grid-container_1dfsp_83`,"rst-layout-builder-grid":`_rst-layout-builder-grid_1dfsp_83`,"rst-layout-builder-grid-overlay":`_rst-layout-builder-grid-overlay_1dfsp_102`,"rst-layout-builder-cell":`_rst-layout-builder-cell_1dfsp_113`,"rst-layout-builder-block":`_rst-layout-builder-block_1dfsp_119`,"rst-layout-builder-block-selected":`_rst-layout-builder-block-selected_1dfsp_138`,"rst-layout-builder-ghost":`_rst-layout-builder-ghost_1dfsp_146`,"rst-layout-builder-block-controls":`_rst-layout-builder-block-controls_1dfsp_154`,"rst-layout-builder-block-info":`_rst-layout-builder-block-info_1dfsp_163`,"rst-layout-builder-input":`_rst-layout-builder-input_1dfsp_169`,"rst-layout-builder-button":`_rst-layout-builder-button_1dfsp_177`,"rst-layout-builder-button-active":`_rst-layout-builder-button-active_1dfsp_191`,"rst-layout-builder-icon-btn":`_rst-layout-builder-icon-btn_1dfsp_201`,"rst-layout-builder-resize-handle":`_rst-layout-builder-resize-handle_1dfsp_219`,"rst-layout-builder-resize-handle-se":`_rst-layout-builder-resize-handle-se_1dfsp_229`,"rst-layout-builder-content":`_rst-layout-builder-content_1dfsp_33`,"rst-layout-builder-field-palette":`_rst-layout-builder-field-palette_1dfsp_246`,"rst-layout-builder-field-palette-title":`_rst-layout-builder-field-palette-title_1dfsp_259`,"rst-layout-builder-field-list":`_rst-layout-builder-field-list_1dfsp_266`,"rst-layout-builder-field-item":`_rst-layout-builder-field-item_1dfsp_272`,"rst-layout-builder-field-item-dragging":`_rst-layout-builder-field-item-dragging_1dfsp_291`,"rst-layout-builder-field-item-used":`_rst-layout-builder-field-item-used_1dfsp_295`,"rst-layout-builder-grid-container-with-palette":`_rst-layout-builder-grid-container-with-palette_1dfsp_305`,"rst-layout-builder-drop-indicator":`_rst-layout-builder-drop-indicator_1dfsp_309`,"rst-layout-builder-drop-indicator-label":`_rst-layout-builder-drop-indicator-label_1dfsp_320`,"rst-layout-builder-grid-locked":`_rst-layout-builder-grid-locked_1dfsp_331`,"rst-layout-builder-select":`_rst-layout-builder-select_1dfsp_361`,"rst-layout-builder-block-slot":`_rst-layout-builder-block-slot_1dfsp_378`,"rst-layout-builder-slot-hint":`_rst-layout-builder-slot-hint_1dfsp_389`},mG={"rst-json-editor":`_rst-json-editor_1so51_1`,"rst-json-editor-toolbar":`_rst-json-editor-toolbar_1so51_11`,"rst-json-editor-label":`_rst-json-editor-label_1so51_22`,"rst-json-editor-status-valid":`_rst-json-editor-status-valid_1so51_27`,"rst-json-editor-status-invalid":`_rst-json-editor-status-invalid_1so51_33`,"rst-json-editor-cursor":`_rst-json-editor-cursor_1so51_39`,"rst-json-editor-container":`_rst-json-editor-container_1so51_46`,"rst-json-editor-line-numbers":`_rst-json-editor-line-numbers_1so51_53`,"rst-json-editor-line-number":`_rst-json-editor-line-number_1so51_53`,"rst-json-editor-line-error":`_rst-json-editor-line-error_1so51_72`,"rst-json-editor-textarea":`_rst-json-editor-textarea_1so51_77`,"rst-json-editor-textarea-invalid":`_rst-json-editor-textarea-invalid_1so51_96`,"rst-json-editor-errors":`_rst-json-editor-errors_1so51_100`,"rst-json-editor-errors-header":`_rst-json-editor-errors-header_1so51_108`,"rst-json-editor-errors-list":`_rst-json-editor-errors-list_1so51_116`,"rst-json-editor-error-item":`_rst-json-editor-error-item_1so51_121`,"rst-json-editor-error-path":`_rst-json-editor-error-path_1so51_135`,"rst-json-editor-error-message":`_rst-json-editor-error-message_1so51_141`,"rst-json-editor-error-expected":`_rst-json-editor-error-expected_1so51_147`,"rst-view-toggle":`_rst-view-toggle_1so51_155`,"rst-view-toggle-btn":`_rst-view-toggle-btn_1so51_164`,"rst-view-toggle-btn-active":`_rst-view-toggle-btn-active_1so51_180`,"rst-split-view":`_rst-split-view_1so51_187`,"rst-split-view-panel":`_rst-split-view-panel_1so51_194`,"rst-split-view-divider":`_rst-split-view-divider_1so51_201`},hG=({value:e,onChange:t,errors:n,readOnly:r=!1,height:i,onActivate:a,onDeactivate:o})=>{let s=(0,d.useRef)(null),c=(0,d.useRef)(null),[l,u]=(0,d.useState)(e),[f,p]=(0,d.useState)(null);(0,d.useEffect)(()=>{u(e)},[e]);let m=l.split(`
106
+ 7. When using fill_column_from_column, read each row's sourceColumn value from the Table Data section and determine the best targetColumn value. Return every row's assignment in the "edits" array.`}var RW=class{delay;constructor(e=500){this.delay=e}async processMessage(e,t,n,r){await new Promise(e=>setTimeout(e,this.delay));let i=e.toLowerCase(),a=r?.rows;if(i.includes(`select`)||i.includes(`seleziona`)){let e=this.extractCondition(i,t);if(e)return{message:`Selecting rows where ${e.column} ${e.operator} "${e.value}"`,toolCalls:[{tool:`select_rows`,arguments:{conditions:[e]}}]}}if(i.includes(`sort`)||i.includes(`ordina`)||i.includes(`riordina`)){let e=this.findColumnRef(i,t),n=i.includes(`desc`)||i.includes(`discendente`)||i.includes(`decrescente`);if(e)return{message:`Sorting by "${e}" ${n?`descending`:`ascending`}`,toolCalls:[{tool:`sort`,arguments:{column:e,direction:n?`desc`:`asc`}}]}}if(i.includes(`hide`)||i.includes(`nascondi`)){let e=this.findColumnRef(i,t);if(e)return{message:`Hiding column "${e}"`,toolCalls:[{tool:`column_visibility`,arguments:{column:e,visible:!1}}]}}if(i.includes(`show column`)||i.includes(`mostra colonna`)){let e=this.findColumnRef(i,t);if(e)return{message:`Showing column "${e}"`,toolCalls:[{tool:`column_visibility`,arguments:{column:e,visible:!0}}]}}if((i.includes(`sort`)||i.includes(`ordina`))&&(i.includes(`select`)||i.includes(`seleziona`))){let e=[],n=this.findColumnRef(i.split(/and|e|then|poi/)[0],t);if(n){let t=i.includes(`desc`)||i.includes(`discendente`);e.push({tool:`sort`,arguments:{column:n,direction:t?`desc`:`asc`}})}let r=this.extractCondition(i,t);if(r&&e.push({tool:`select_rows`,arguments:{conditions:[r]}}),e.length>0)return{message:`Executing ${e.length} action(s)`,toolCalls:e}}if(i.includes(`edit`)||i.includes(`modifica`)||i.includes(`cambia`))return{message:`I can edit cells for you. Please specify the row number, column, and new value.`,toolCalls:[]};if(i.includes(`reorder columns`)||i.includes(`riordina colonne`))return{message:`Reversing column order as a demo`,toolCalls:[{tool:`column_order`,arguments:{order:[...t.map(e=>e.id)].reverse()}}]};if(i.includes(`group by`)||i.includes(`raggruppa per`)||i.includes(`group per`)){let e=this.findColumnRef(i,t);if(e)return{message:`Grouping rows by "${e}"`,toolCalls:[{tool:`group_by`,arguments:{columns:[e]}}]}}if(i.includes(`clear group`)||i.includes(`remove group`)||i.includes(`rimuovi raggruppa`))return{message:`Clearing all grouping`,toolCalls:[{tool:`group_by`,arguments:{columns:[]}}]};if(i.includes(`pin`)||i.includes(`blocca colonna`)){let e=this.findColumnRef(i,t);if(e){let t=i.includes(`right`)||i.includes(`destra`)?`right`:`left`;return{message:`Pinning column "${e}" to the ${t}`,toolCalls:[{tool:`pin_column`,arguments:{column:e,side:t}}]}}}if(i.includes(`unpin`)||i.includes(`sblocca colonna`)){let e=this.findColumnRef(i,t);if(e)return{message:`Unpinning column "${e}"`,toolCalls:[{tool:`pin_column`,arguments:{column:e,side:`none`}}]}}if((i.includes(`sort by`)||i.includes(`ordina per`))&&(i.includes(` and `)||i.includes(` then `)||i.includes(` poi `)||i.includes(` e `))){let e=i.split(/\band\b|\bthen\b|\bpoi\b/),n=[];for(let r of e){let e=this.findColumnRef(r,t);if(e){let t=r.includes(`desc`)||r.includes(`discendente`)||r.includes(`decrescente`);n.push({column:e,direction:t?`desc`:`asc`})}}if(n.length>1)return{message:`Sorting by ${n.map(e=>`"${e.column}" ${e.direction}`).join(`, `)}`,toolCalls:[{tool:`multi_sort`,arguments:{sorts:n}}]}}if(i.includes(`reset`)||i.includes(`clear all`)||i.includes(`clear table`)||i.includes(`azzera`)||i.includes(`ripristina`))return{message:`Resetting table to default state`,toolCalls:[{tool:`clear_state`,arguments:{}}]};if((i.includes(`fill`)||i.includes(`riempi`)||i.includes(`compila`)||i.includes(`aggiorna`)||i.includes(`update`))&&(i.includes(`based on`)||i.includes(`in base a`)||i.includes(`dalla`)||i.includes(`from`))){let e=t.filter(e=>i.includes(e.label.toLowerCase())||i.includes(e.id.toLowerCase()));if(e.length>=2&&a&&a.length>0){let t=e.find(e=>e.options&&e.options.length>0)??e[0],n=e.find(e=>e.id!==t.id)??e[1],r=t.options??[],i=a.map((e,t)=>({rowIndex:t,value:r.length>0?r[t%r.length]:`auto`}));return{message:`Filling "${t.label}" based on "${n.label}" (${i.length} rows)`,toolCalls:[{tool:`fill_column_from_column`,arguments:{targetColumn:t.id,sourceColumn:n.id,edits:i}}]}}return{message:`Please specify which column to fill and which column to use as the source (e.g. 'fill category based on description').`,toolCalls:[]}}if(i.includes(`formula`)||i.includes(`calculated column`)||i.includes(`compute`)||i.includes(`calcola`)||i.includes(`colonna calcolata`)){let e=i.match(/(?:called|named|column|colonna)\s+['"]?([\w\s]+?)['"]?\s+(?:with|using|=|formula|che)/i),t=i.match(/(?:formula|expression|expr|=)\s*['"]?([^'"]+)['"]?\s*$/i),n=e?e[1].trim():`Computed`,r=t?t[1].trim():null;return r?{message:`Creating formula column "${n}" with expression: ${r}`,toolCalls:[{tool:`create_formula`,arguments:{header:n,formula:r}}]}:{message:`I can create a formula column for you. Please specify a column name and a formula expression using column field names (e.g. 'create a formula column called Profit with formula revenue - cost').`,toolCalls:[]}}return{message:`I didn't understand that request. Try asking me to sort, select rows, hide/show columns, or edit cells.`,toolCalls:[]}}findColumnRef(e,t){let n=e.toLowerCase(),r=[...t].sort((e,t)=>t.label.length-e.label.length);for(let e of r)if(n.includes(e.label.toLowerCase()))return e.id;for(let e of t)if(n.includes(e.id.toLowerCase()))return e.id;return null}extractCondition(e,t){for(let n of[/(?:where|dove|con)\s+(.+?)\s+(?:is|è|=|equals)\s+(.+)/i,/(?:column|colonna)\s+(.+?)\s+(?:is|è|=|equals)\s+(.+)/i,/(.+?)\s+(?:above|sopra|greater than|maggiore di|>)\s+(\d+)/i,/(.+?)\s+(?:below|sotto|less than|minore di|<)\s+(\d+)/i]){let r=e.match(n);if(r){let n=r[1].trim(),i=r[2].trim(),a=this.findColumnRef(n,t);if(a){let t=`equals`;return e.includes(`above`)||e.includes(`sopra`)||e.includes(`greater`)||e.includes(`maggiore`)||e.includes(`>`)?t=`greater_than`:(e.includes(`below`)||e.includes(`sotto`)||e.includes(`less`)||e.includes(`minore`)||e.includes(`<`))&&(t=`less_than`),{column:a,operator:t,value:isNaN(Number(i))?i:Number(i)}}}}return null}},zW={"rst-shortcut-tooltip":`_rst-shortcut-tooltip_1w51f_2`,fadeIn:`_fadeIn_1w51f_1`,"rst-shortcut-tooltip-content":`_rst-shortcut-tooltip-content_1w51f_15`,"rst-shortcut-tooltip-progress":`_rst-shortcut-tooltip-progress_1w51f_22`,"rst-shortcut-tooltip-progress-bar":`_rst-shortcut-tooltip-progress-bar_1w51f_31`},BW=({isVisible:e,shortcut:t,functionName:n,holdDuration:r,holdProgress:i=0,position:a})=>{if(!e)return null;let o=r&&i>0?Math.min(i/r*100,100):0;return(0,h.jsxs)(`div`,{className:zW[`rst-shortcut-tooltip`],style:{left:a.x,top:a.y,transform:`translate(-50%, calc(-100% - 8px))`},children:[(0,h.jsxs)(`div`,{className:zW[`rst-shortcut-tooltip-content`],children:[(0,h.jsx)(cH,{keys:t,showSeparator:!0}),(0,h.jsx)(T,{variant:`caption`,children:n})]}),r&&r>0&&(0,h.jsx)(`div`,{className:zW[`rst-shortcut-tooltip-progress`],children:(0,h.jsx)(`div`,{className:zW[`rst-shortcut-tooltip-progress-bar`],style:{width:`${o}%`,minWidth:o>0?`2px`:`0px`}})})]})},VW=(0,d.createContext)(null),HW=({children:e})=>{let[t]=(0,d.useState)(new Map),[n,r]=(0,d.useState)(new Set),[i,a]=(0,d.useState)({isVisible:!1,shortcut:[],functionName:``,holdProgress:0,position:{x:0,y:0}}),o=(0,d.useRef)(void 0),s=(0,d.useRef)(void 0),c=(0,d.useRef)({x:0,y:0}),l=(0,d.useRef)(new Set),u=(0,d.useRef)(null),f=(0,d.useRef)(new Set);(0,d.useEffect)(()=>{let e=e=>{c.current={x:e.clientX,y:e.clientY}};return document.addEventListener(`mousemove`,e),()=>document.removeEventListener(`mousemove`,e)},[]);let p=(0,d.useCallback)(()=>{a(e=>({...e,isVisible:!1})),o.current&&=(clearTimeout(o.current),void 0),s.current&&=(clearInterval(s.current),void 0),u.current=null,f.current.clear()},[]),m=(0,d.useCallback)((e,n,r)=>{let i=iB(e),a={...n,componentId:r,holdDuration:n.holdDuration===0?3e3:n.holdDuration};t.set(i,a)},[t]),g=(0,d.useCallback)(e=>{t.delete(e)},[t]),_=(0,d.useCallback)(e=>{r(t=>new Set(t).add(e))},[]),v=(0,d.useCallback)(e=>{r(t=>{let n=new Set(t);return n.delete(e),n})},[]),y=(0,d.useCallback)(e=>{let r=t.get(e);if(r&&!(u.current&&u.current!==e)&&!(r.componentId&&!n.has(r.componentId)))if(a({isVisible:!0,shortcut:nB(e.split(`+`).map(e=>e.trim())),functionName:r.name,holdDuration:r.holdDuration,holdProgress:0,position:c.current}),r.holdDuration){u.current=e;let t=Date.now();s.current=setInterval(()=>{let e=Date.now()-t,n=Math.min(e,r.holdDuration);a(e=>({...e,holdProgress:n}))},16),o.current=setTimeout(()=>{u.current===e&&(r.action(),f.current.add(e),p())},r.holdDuration)}else r.action(),setTimeout(p,1500)},[t,n,p]);(0,d.useEffect)(()=>{let e=e=>{let n=[];(e.ctrlKey||e.metaKey)&&n.push(`ctrl`),e.shiftKey&&n.push(`shift`),e.altKey&&n.push(`alt`);let r=tB(e.key);r&&![`ctrl`,`shift`,`alt`,`cmd`].includes(r)&&n.push(r);let i=n.join(`+`);if(n.forEach(e=>l.current.add(e)),t.has(i)){if(e.preventDefault(),e.repeat||f.current.has(i))return;y(i)}},n=e=>{let t=tB(e.key);t===`control`||t===`meta`?l.current.delete(`ctrl`):t===`shift`?l.current.delete(`shift`):t===`alt`?l.current.delete(`alt`):l.current.delete(t),u.current&&(u.current.split(`+`).every(e=>l.current.has(e.trim()))||(f.current.add(u.current),p())),l.current.size===0&&f.current.clear()};return document.addEventListener(`keydown`,e),document.addEventListener(`keyup`,n),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`keyup`,n)}},[t,y,p]);let b={registerShortcut:m,unregisterShortcut:g,triggerShortcut:y,registerComponent:_,unregisterComponent:v};return(0,h.jsxs)(VW.Provider,{value:b,children:[e,(0,h.jsx)(BW,{...i})]})},UW=(e={})=>{let t=(0,d.useContext)(VW),n=(0,d.useRef)([]),{scope:r=`component`,enabled:i=!0}=e,a=(0,d.useId)(),o=(0,d.useMemo)(()=>r===`component`?`component-${a}`:void 0,[r,a]);if(!t)throw Error(`useShortcut must be used within a ShortcutProvider`);let{registerShortcut:s,unregisterShortcut:c,triggerShortcut:l,registerComponent:u,unregisterComponent:f}=t,p=(0,d.useCallback)((e,t)=>{i&&(s(e,t,o),n.current.push(e))},[s,o,i]),m=(0,d.useCallback)(e=>{c(e),n.current=n.current.filter(t=>t!==e)},[c]),h=(0,d.useCallback)(()=>{r===`component`&&o&&i&&u(o)},[r,o,u,i]),g=(0,d.useCallback)(()=>{r===`component`&&o&&f(o)},[r,o,f]);return(0,d.useEffect)(()=>{if(r===`component`)return()=>{n.current.forEach(e=>{c(e)}),o&&f(o)}},[r,c,o,f]),{register:p,unregister:m,trigger:l,activate:h,deactivate:g}},WW=(0,d.createContext)(null),GW=()=>{let e=(0,d.useContext)(WW);if(!e)throw Error(`useScaffold must be used within a Scaffold component`);return e},KW={"rst-appbar":`_rst-appbar_1yrtz_2`,"rst-appbar-title":`_rst-appbar-title_1yrtz_12`,"rst-appbar-actions":`_rst-appbar-actions_1yrtz_22`},qW=Object.assign(({children:e,className:t,...n})=>(0,h.jsx)(`header`,{className:[KW[`rst-appbar`],t].filter(Boolean).join(` `),...n,children:e}),{Title:({children:e,className:t,...n})=>(0,h.jsx)(`div`,{className:[KW[`rst-appbar-title`],t].filter(Boolean).join(` `),...n,children:(0,h.jsx)(T,{variant:`heading`,children:e})}),Actions:({children:e,className:t,...n})=>(0,h.jsx)(`div`,{className:[KW[`rst-appbar-actions`],t].filter(Boolean).join(` `),...n,children:e}),MenuButton:({onClick:e,"aria-label":t=`Toggle menu`,...n})=>{let{toggleSidebar:r}=GW();return(0,h.jsx)(D,{variant:`invisible`,leadingVisual:`menu`,onClick:e||r,"aria-label":t,...n})}});qW.displayName=`AppBar`;var JW={"rst-breadcrumbs":`_rst-breadcrumbs_1tams_1`,"rst-breadcrumbs-list":`_rst-breadcrumbs-list_1tams_6`,"rst-breadcrumbs-separator":`_rst-breadcrumbs-separator_1tams_16`},YW=({items:e,collapsThreshold:t=3,...n})=>{let[r,i]=(0,d.useState)(!1),a=e.length>t,o=()=>{if(!a)return e.map((t,n)=>(0,h.jsxs)(d.default.Fragment,{children:[n>0&&(0,h.jsx)(`span`,{className:JW[`rst-breadcrumbs-separator`],children:`/`}),n===e.length-1?(0,h.jsx)(T,{variant:`title`,children:t.label}):(0,h.jsx)(D,{variant:`link`,onClick:t.onClick,value:t.label})]},t.value||n));let t=e[0],n=e[e.length-1],o=e.slice(1,e.length-1);return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(D,{variant:`link`,onClick:t.onClick,value:t.label}),(0,h.jsx)(`span`,{className:JW[`rst-breadcrumbs-separator`],children:`/`}),(0,h.jsx)(M,{isOpen:r,anchor:(0,h.jsx)(D,{leadingVisual:`plus`,variant:`invisible`,onClick:()=>i(!r)}),target:(0,h.jsx)(bV,{options:o.map(e=>({value:e.value||e.label,id:e.value})),onClick:e=>{o.find(t=>t.value===e.value||t.label===e.value)?.onClick?.(),i(!1)}})}),(0,h.jsx)(`span`,{className:JW[`rst-breadcrumbs-separator`],children:`/`}),(0,h.jsx)(T,{variant:`title`,children:n.label})]})};return(0,h.jsx)(`nav`,{className:JW[`rst-breadcrumbs`],"aria-label":`Breadcrumb`,...n,children:(0,h.jsx)(`ol`,{className:JW[`rst-breadcrumbs-list`],children:o()})})},XW=(0,d.createContext)(void 0),ZW=()=>{let e=(0,d.useContext)(XW);if(!e)throw Error(`Sidebar compound components must be used within <Sidebar>`);return e},QW={"rst-logo-container":`_rst-logo-container_66wnp_1`},$W=({logo:e})=>{let{isOpen:t,setHoveringLogo:n,isHoveringLogo:r,toggle:i}=ZW();return(0,h.jsxs)(`div`,{className:{logoContainer:`${QW[`rst-logo-container`]}`}.logoContainer,children:[!t&&r?(0,h.jsx)(D,{leadingVisual:`dock-right-arrow`,onClick:i}):(0,h.jsx)(D,{leadingVisual:e,variant:`invisible`,onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1)}),t&&(0,h.jsx)(D,{onClick:i,variant:`invisible`,leadingVisual:`dock-left-arrow`})]})},eG={"rst-sidebar":`_rst-sidebar_nmzg6_1`,"rst-sidebar-section":`_rst-sidebar-section_nmzg6_12`,"rst-sidebar-user":`_rst-sidebar-user_nmzg6_19`},tG=({children:e})=>{let{isSidebarOpen:t,toggleSidebar:n,isHoveringLogo:r,setHoveringLogo:i}=GW(),a=n,o={sidebar:`${eG[`rst-sidebar`]}`};return(0,h.jsx)(XW.Provider,{value:{isOpen:t,toggle:a,setHoveringLogo:i,isHoveringLogo:r},children:(0,h.jsx)(`div`,{style:{width:t?220:40,alignItems:t?``:`center`},className:o.sidebar,children:e})})};tG.displayName=`Sidebar`,tG.Logo=$W,tG.Item=({leadingVisual:e,label:t,shortcut:n,onClick:r})=>{let{isOpen:i}=ZW();return i?(0,h.jsx)(fH.Item,{leadingVisual:e,"aria-label":t,shortcut:n,label:t,onClick:r}):(0,h.jsx)(D,{leadingVisual:e,"aria-label":t,variant:`invisible`,onClick:()=>r})},tG.Section=({title:e,children:t})=>{let n={sectionContainer:`${eG[`rst-sidebar-section`]}`},{isOpen:r}=ZW();return(0,h.jsxs)(`div`,{className:n.sectionContainer,children:[e&&r&&(0,h.jsx)(`div`,{children:(0,h.jsx)(T,{variant:`label`,children:e})}),t]})},tG.User=({avatar:e,name:t})=>{let{isOpen:n}=ZW();return(0,h.jsxs)(`div`,{className:eG[`rst-sidebar-user`],children:[e,n&&(0,h.jsx)(`span`,{style:{marginLeft:8},children:t})]})};var nG={"rst-scaffold":`_rst-scaffold_10eyy_2`,"rst-scaffold-sidebar":`_rst-scaffold-sidebar_10eyy_9`,"rst-scaffold-content":`_rst-scaffold-content_10eyy_17`,"rst-scaffold-appbar":`_rst-scaffold-appbar_10eyy_26`,"rst-scaffold-main":`_rst-scaffold-main_10eyy_32`},rG=e=>{if(typeof e.type==`function`||typeof e.type==`object`&&e.type!==null&&`displayName`in e.type)return e.type.displayName},iG=Object.assign(({children:e,defaultSidebarOpen:t=!0,className:n,...r})=>{let[i,a]=(0,d.useState)(t),[o,s]=(0,d.useState)(!1),c=(0,d.useCallback)(()=>{a(e=>!e)},[]),l=(0,d.useCallback)(e=>{a(e)},[]),u=d.default.Children.toArray(e),f=null,p=null,m=null,g=[];u.forEach(e=>{if(d.default.isValidElement(e))switch(rG(e)){case`Sidebar`:f=e;break;case`Drawer`:p=e;break;case`AppBar`:m=e;break;default:g.push(e);break}else g.push(e)});let _=[nG[`rst-scaffold`],n].filter(Boolean).join(` `);return(0,h.jsx)(WW.Provider,{value:{isSidebarOpen:i,toggleSidebar:c,setSidebarOpen:l,isHoveringLogo:o,setHoveringLogo:s},children:(0,h.jsxs)(`div`,{className:_,...r,children:[f&&(0,h.jsx)(`div`,{className:nG[`rst-scaffold-sidebar`],children:f}),(0,h.jsxs)(`div`,{className:nG[`rst-scaffold-content`],children:[m&&(0,h.jsx)(`div`,{className:nG[`rst-scaffold-appbar`],children:m}),(0,h.jsx)(`main`,{className:nG[`rst-scaffold-main`],children:g})]}),p]})})},{Content:({children:e,className:t,...n})=>(0,h.jsx)(`div`,{className:[nG[`rst-scaffold-content`],t].filter(Boolean).join(` `),...n,children:e})}),aG=class{config;constructor(e){this.config=e}layout(e){let t=this.convertToLayoutNode(e,null,0);this.config.layoutType===`radial`?this.calculateRadialPositions(t):this.calculatePositions(t);let n=this.collectNodes(t),r=this.calculateBounds(n);return this.normalizePositions(n,r),{nodes:n,root:t,width:Math.max(r.maxX-r.minX+this.config.nodeWidth,this.config.nodeWidth),height:Math.max(r.maxY-r.minY+this.config.nodeHeight,this.config.nodeHeight)}}convertToLayoutNode(e,t,n){let r={id:e.id,label:e.label,data:e.data,collapsed:e.collapsed,x:0,y:n*this.config.levelSpacing,depth:n,parent:t||void 0,prelim:0,mod:0,thread:void 0,change:0,shift:0,ancestor:void 0};return e.children&&(r.children=e.children.map(e=>this.convertToLayoutNode(e,r,n+1))),r}firstWalk(e){if(!e.children||e.children.length===0){let t;if(this.isLeftmost(e))t=0;else{let n=this.getLeftSibling(e);t=n?(n.prelim||0)+this.config.siblingSpacing+this.config.nodeWidth:0}Object.assign(e,{prelim:t})}else{let t=e.children[0],n=e.children[e.children.length-1];e.children.forEach(e=>this.firstWalk(e));let r=((t.prelim||0)+(n.prelim||0))/2,i,a=0;if(this.isLeftmost(e))i=r;else{let t=this.getLeftSibling(e);if(t){i=(t.prelim||0)+this.config.siblingSpacing+this.config.nodeWidth,a=i-r,Object.assign(e,{prelim:i,mod:a}),this.apportion(e);return}else i=r}Object.assign(e,{prelim:i,mod:a})}}secondWalk(e,t){let n=(e.prelim||0)+t;if(Object.assign(e,{x:n}),e.children&&e.children.length>0){let n=t+(e.mod||0);e.children.forEach(e=>this.secondWalk(e,n))}}apportion(e){if(!e.children||e.children.length===0)return;let t=this.getLeftSibling(e);if(!t)return;let n=e.children[0],r=this.getRightmostDescendant(t);if(n&&r){let t=(r.prelim||0)+this.config.siblingSpacing+this.config.nodeWidth-(n.prelim||0);if(t>0){let n=t;Object.assign(e,{prelim:(e.prelim||0)+n,mod:(e.mod||0)+n})}}}getRightmostDescendant(e){return!e.children||e.children.length===0?e:this.getRightmostDescendant(e.children[e.children.length-1])}isLeftmost(e){return!e.parent||e.parent.children[0]===e}getLeftSibling(e){if(!e.parent)return;let t=e.parent.children,n=t.indexOf(e);return n>0?t[n-1]:void 0}getRightmost(e){return e.children&&e.children.length>0?e.children[e.children.length-1]:e}getLeftmost(e){return e.children&&e.children.length>0?e.children[0]:e}calculatePositions(e){this.firstWalk(e),this.secondWalk(e,0)}collectNodes(e){let t=[];function n(e){t.push(e),e.children&&e.children.forEach(n)}return n(e),t}calculateBounds(e){let t=1/0,n=-1/0,r=1/0,i=-1/0;return e.forEach(e=>{t=Math.min(t,e.x),n=Math.max(n,e.x),r=Math.min(r,e.y),i=Math.max(i,e.y)}),{minX:t,maxX:n,minY:r,maxY:i}}normalizePositions(e,t){let n=-t.minX,r=-t.minY;e.forEach(e=>{let t={x:e.x+n,y:e.y+r};Object.assign(e,t)})}calculateRadialPositions(e){Object.assign(e,{x:0,y:0}),this.positionRadialLevel(e,1)}positionRadialLevel(e,t){if(!e.children||e.children.length===0)return;let n=t*this.config.levelSpacing,r=2*Math.PI/this.getTotalDescendants(e),i=this.getStartAngle(e);e.children.forEach(a=>{let o=i+r*this.getSubtreeSize(a)/2,s=e.x+n*Math.cos(o),c=e.y+n*Math.sin(o);Object.assign(a,{x:s,y:c}),i+=r*this.getSubtreeSize(a),this.positionRadialLevel(a,t+1)})}getTotalDescendants(e){return!e.children||e.children.length===0?1:e.children.reduce((e,t)=>e+this.getSubtreeSize(t),0)}getSubtreeSize(e){return!e.children||e.children.length===0?1:e.children.reduce((e,t)=>e+this.getSubtreeSize(t),0)}getStartAngle(e){return e.parent?Math.atan2(e.y-e.parent.y,e.x-e.parent.x)-Math.PI:-Math.PI/2}},oG={"rst-mind-tree":`_rst-mind-tree_11uth_1`,"rst-mind-tree-svg":`_rst-mind-tree-svg_11uth_11`,"rst-mind-tree-container":`_rst-mind-tree-container_11uth_17`,"rst-mind-tree-node":`_rst-mind-tree-node_11uth_21`,"rst-mind-tree-node-rect":`_rst-mind-tree-node-rect_11uth_26`,root:`_root_11uth_35`,"rst-mind-tree-node-text":`_rst-mind-tree-node-text_11uth_52`,"rst-mind-tree-link":`_rst-mind-tree-link_11uth_66`,"rst-mind-tree-expand-button":`_rst-mind-tree-expand-button_11uth_78`,"rst-mind-tree-expand-button-circle":`_rst-mind-tree-expand-button-circle_11uth_83`,"rst-mind-tree-expand-button-text":`_rst-mind-tree-expand-button-text_11uth_90`,"rst-mind-tree-controls":`_rst-mind-tree-controls_11uth_100`,"rst-mind-tree-zoom-group":`_rst-mind-tree-zoom-group_11uth_114`,"rst-mind-tree-zoom-slider-container":`_rst-mind-tree-zoom-slider-container_11uth_120`,"rst-mind-tree-zoom-slider":`_rst-mind-tree-zoom-slider_11uth_120`,"rst-mind-tree-zoom-label":`_rst-mind-tree-zoom-label_11uth_159`,"rst-mind-tree-node-entering":`_rst-mind-tree-node-entering_11uth_168`,"rst-mind-tree-node-entered":`_rst-mind-tree-node-entered_11uth_173`,"rst-mind-tree-node-exiting":`_rst-mind-tree-node-exiting_11uth_179`,"rst-mind-tree-link-entering":`_rst-mind-tree-link-entering_11uth_185`,"rst-mind-tree-link-entered":`_rst-mind-tree-link-entered_11uth_190`,"rst-mind-tree-control-button":`_rst-mind-tree-control-button_11uth_207`};function sG({data:e,width:t=800,height:n=600,nodeSpacing:r=80,levelSpacing:i=100,nodeWidth:a=120,nodeHeight:o=40,interactive:s=!0,renderNode:c,renderLink:l,onNodeClick:u,onNodeToggle:f,layoutType:p=`hierarchical`,className:m}){let[g,_]=(0,d.useState)(new Set),[v,y]=(0,d.useState)({x:0,y:0,scale:1}),[b,x]=(0,d.useState)(!1),[S,C]=(0,d.useState)({x:0,y:0}),w=(0,d.useRef)(null),E=(0,d.useMemo)(()=>[.25,.5,.75,1,1.25,1.5,2,3],[]),O=E.findIndex(e=>Math.abs(e-v.scale)<.01)??E.reduce((e,t,n)=>Math.abs(t-v.scale)<Math.abs(E[e]-v.scale)?n:e,0),k=(0,d.useMemo)(()=>new aG({siblingSpacing:r,levelSpacing:i,nodeWidth:a,nodeHeight:o,layoutType:p}).layout(e),[e,r,i,a,o,p]),A=(0,d.useMemo)(()=>{if(!k)return new Set;let e=new Set;function t(t){if(!t.parent)return e.add(t.id),!0;let n=e.has(t.parent.id),r=g.has(t.parent.id);return n&&!r?(e.add(t.id),!0):!1}function n(e){t(e),e.children&&e.children.forEach(n)}return n(k.root),e},[k,g]),j=(0,d.useCallback)(e=>{!e.children||e.children.length===0||(_(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n}),f?.(e))},[f]),M=(0,d.useCallback)(e=>{u?.(e)},[u]),N=(0,d.useCallback)(e=>{s&&(x(!0),C({x:e.clientX-v.x,y:e.clientY-v.y}))},[s,v]),P=(0,d.useCallback)(e=>{!b||!s||y(t=>({...t,x:e.clientX-S.x,y:e.clientY-S.y}))},[b,s,S]),F=(0,d.useCallback)(()=>{x(!1)},[]),ee=(0,d.useCallback)(e=>{if(!s)return;e.preventDefault();let t=e.deltaY>0?.9:1.1,n=Math.max(.1,Math.min(3,v.scale*t));y(e=>({...e,scale:n}))},[s,v.scale]);d.default.useEffect(()=>{let e=w.current;if(!e)return;let t=e=>ee(e);return e.addEventListener(`wheel`,t,{passive:!1}),()=>{e.removeEventListener(`wheel`,t)}},[ee]);let te=(0,d.useCallback)(()=>{let e=Math.min(E.length-1,O+1);y(t=>({...t,scale:E[e]}))},[O,E]),ne=(0,d.useCallback)(()=>{let e=Math.max(0,O-1);y(t=>({...t,scale:E[e]}))},[O,E]),re=(0,d.useCallback)(()=>{y({x:0,y:0,scale:1})},[]),I=(0,d.useCallback)(()=>{if(!k||!w.current)return;let e=(t-100)/k.width,r=(n-100)/k.height,i=Math.min(e,r,1);y({x:(t-k.width*i)/2,y:(n-k.height*i)/2,scale:i})},[k,t,n]),ie=(0,d.useCallback)((e,t)=>{function n(e,t){if(e.id===t)return e;if(e.children)for(let r of e.children){let e=n(r,t);if(e)return e}return null}return n(e,t)},[]),ae=(0,d.useCallback)((t,n)=>{let r=ie(e,t.id),i=r?.children&&r.children.length>0,s=g.has(t.id);return(0,h.jsxs)(`g`,{className:oG[`rst-mind-tree-node`],children:[(0,h.jsx)(`rect`,{className:`${oG[`rst-mind-tree-node-rect`]} ${n?oG.root:``}`,x:-a/2,y:-o/2,width:a,height:o,onClick:()=>M(t)}),(0,h.jsx)(`text`,{className:`${oG[`rst-mind-tree-node-text`]} ${n?oG.root:``}`,onClick:()=>M(t),children:t.id}),i&&(0,h.jsxs)(`g`,{className:oG[`rst-mind-tree-expand-button`],transform:`translate(${a/2-10}, 0)`,onClick:e=>{e.stopPropagation(),j(t)},children:[(0,h.jsx)(`circle`,{className:oG[`rst-mind-tree-expand-button-circle`],r:`8`}),(0,h.jsx)(`text`,{className:oG[`rst-mind-tree-expand-button-text`],children:s?`+`:`−`})]})]})},[ie,e,g,a,o,M,j]),oe=(0,d.useCallback)((e,t)=>{let n=e.x,r=e.y+o/2,i=t.x,a=t.y-o/2,s=r+(a-r)/2,c=`M ${n},${r}
107
+ C ${n},${s} ${i},${s} ${i},${a}`;return(0,h.jsx)(`path`,{className:oG[`rst-mind-tree-link`],d:c},`${e.id}-${t.id}`)},[o]);return k?(0,h.jsxs)(`div`,{className:`${oG[`rst-mind-tree`]} ${m||``}`,children:[(0,h.jsx)(`svg`,{ref:w,className:oG[`rst-mind-tree-svg`],width:t,height:n,onMouseDown:N,onMouseMove:P,onMouseUp:F,onMouseLeave:F,style:{cursor:b?`grabbing`:`grab`},children:(0,h.jsxs)(`g`,{className:oG[`rst-mind-tree-container`],transform:`translate(${v.x}, ${v.y}) scale(${v.scale})`,children:[(0,h.jsx)(`g`,{children:k.nodes.map(e=>e.children?.filter(t=>A.has(e.id)&&A.has(t.id)).map(t=>l?l(e,t):oe(e,t))||[])}),(0,h.jsx)(`g`,{children:k.nodes.filter(e=>A.has(e.id)).map(e=>(0,h.jsx)(`g`,{transform:`translate(${e.x}, ${e.y})`,children:c?c(e,e===k.root):ae(e,e===k.root)},e.id))})]})}),s&&(0,h.jsxs)(`div`,{className:oG[`rst-mind-tree-controls`],children:[(0,h.jsxs)(`div`,{className:oG[`rst-mind-tree-zoom-group`],children:[(0,h.jsx)(D,{onClick:ne,value:`-`,disabled:O===0,title:`Zoom Out`}),(0,h.jsx)(`div`,{className:oG[`rst-mind-tree-zoom-slider-container`],children:(0,h.jsxs)(T,{variant:`body`,children:[Math.round(v.scale*100),`%`]})}),(0,h.jsx)(D,{onClick:te,value:`+`,title:`Zoom In`,disabled:O===E.length-1})]}),(0,h.jsx)(D,{onClick:I,value:`⌂`,title:`Fit to View`}),(0,h.jsx)(D,{onClick:re,value:`⟲`,title:`Reset View`})]})]}):null}var cG={"rst-calendar":`_rst-calendar_48fkh_1`,"rst-calendar-grid":`_rst-calendar-grid_48fkh_6`,"rst-calendar-cell":`_rst-calendar-cell_48fkh_11`,"rst-calendar-cell--otherMonth":`_rst-calendar-cell--otherMonth_48fkh_18`,"rst-calendar-date":`_rst-calendar-date_48fkh_22`,"rst-calendar-event":`_rst-calendar-event_48fkh_27`};function lG(e){if(!e)return null;if(e instanceof Date)return e;if(typeof e==`string`||typeof e==`number`){let t=new Date(e);return isNaN(t.getTime())?null:t}return null}function uG(e){return new Date(e.getFullYear(),e.getMonth(),1)}function dG(e,t){let n=new Date(e);return n.setDate(n.getDate()+t),n}function fG({data:e,columns:t,dateColumnId:n,eventColumnId:r,initialMonth:i}){let a=e[0]?Object.keys(e[0]):[],o=t||mH(a),s=(0,d.useMemo)(()=>uG(i||new Date),[i]),c=(0,d.useCallback)((e,t)=>{let n=o.find(e=>e.id===String(t)||e.accessorKey===t);return n?n.accessorFn?n.accessorFn(e):n.accessorKey?e[n.accessorKey]:e[n.id]??e[t]:e[t]},[o]),l=(0,d.useMemo)(()=>{let t=new Map;return e.forEach(e=>{let r=lG(c(e,n));if(!r)return;let i=r.toISOString().slice(0,10);t.has(i)||t.set(i,[]),t.get(i).push(e)}),t},[e,c,n]),u=(0,d.useMemo)(()=>{let e=uG(s);return dG(e,-e.getDay())},[s]),f=[];for(let e=0;e<42;e++)f.push(dG(u,e));return(0,h.jsxs)(`div`,{className:cG[`rst-calendar`],children:[(0,h.jsx)(`div`,{style:{marginBottom:8,fontWeight:700},children:s.toLocaleString(void 0,{month:`long`,year:`numeric`})}),(0,h.jsx)(`div`,{className:cG[`rst-calendar-grid`],children:f.map(e=>{let t=e.toISOString().slice(0,10),n=l.get(t)??[],i=e.getMonth()!==s.getMonth();return(0,h.jsxs)(`div`,{className:cG[`rst-calendar-cell`]+(i?` `+cG[`rst-calendar-cell--otherMonth`]:``),children:[(0,h.jsx)(`div`,{className:cG[`rst-calendar-date`],children:e.getDate()}),(0,h.jsx)(`div`,{children:n.map((e,t)=>{let n=c(e,r),i=typeof n==`string`||typeof n==`number`?String(n):JSON.stringify(n);return(0,h.jsx)(`div`,{className:cG[`rst-calendar-event`],title:i,children:i},t)})})]},t)})})]})}var pG={"rst-form":`_rst-form_qdlsq_1`,"rst-form-header":`_rst-form-header_qdlsq_9`,"rst-form-title":`_rst-form-title_qdlsq_13`,"rst-form-field":`_rst-form-field_qdlsq_20`,"rst-form-label":`_rst-form-label_qdlsq_26`,"rst-form-actions":`_rst-form-actions_qdlsq_32`,"rst-form-field-error":`_rst-form-field-error_qdlsq_40`,"rst-form-field-label-left":`_rst-form-field-label-left_qdlsq_46`};function mG({data:e,columns:t,layout:n,onSubmit:r,onCancel:i}){let[a,o]=(0,d.useState)(()=>e&&e.length>0?{...e[0]}:{}),s=e[0]?Object.keys(e[0]):[],c=t||mH(s),[l,u]=(0,d.useState)({});(0,d.useEffect)(()=>{e&&e.length>0&&o({...e[0]})},[e]);let f=(e,t)=>{if(e.accessorFn)return e.accessorFn(t);if(e.accessorKey)return t[e.accessorKey]},p=(e,t,n)=>{let r=n.accessorKey;o(t=>({...t,[r]:e})),l[r]&&u(e=>{let t={...e};return delete t[r],t})},m=(e,t,n)=>{let r=e.accessorKey;if(e.required&&(t==null||t===``))return e.requiredMessage||`${String(e.header||r)} is required`;if(e.validate)return e.validate(t,n)},g=()=>{let e={},t=!1;return c.forEach(n=>{let r=n.accessorKey;if(!r)return;let i=m(n,f(n,a),a);i&&(e[r]=i,t=!0)}),u(e),!t},_=e=>{e.preventDefault(),g()&&r?.(a)},v=(0,d.useMemo)(()=>{if(!n)return;let e=e=>{let t=n[e];if(!t)return;let r={};return c.forEach((e,n)=>{let i=e.id||String(e.accessorKey),a=t.blocks[i]||t.blocks[n];a&&(r[n]=a)}),{...t,blocks:r}};return{desktop:e(`desktop`)||n.desktop,tablet:e(`tablet`)||n.tablet,mobile:e(`mobile`)||n.mobile}},[n,c]);if(!e||e.length===0)return(0,h.jsx)(`div`,{children:`No data to display`});let y=c.map((e,t)=>{let n=e.accessorKey;return(0,h.jsx)(IU,{value:f(e,a),column:e,rowData:a,rowIndex:0,editMode:`always`,isEditable:!0,onValueChange:p,error:n?l[n]:void 0},t)});return(0,h.jsxs)(`form`,{className:pG[`rst-form`],onSubmit:_,children:[v?(0,h.jsx)(XV,{layout:v,children:y}):y,(0,h.jsxs)(`div`,{className:pG[`rst-form-actions`],children:[i&&(0,h.jsx)(D,{type:`button`,variant:`invisible`,onClick:i,value:`Cancel`}),(0,h.jsx)(D,{type:`submit`,variant:`primary`,value:`Save`})]})]})}var Q={"rst-layout-builder":`_rst-layout-builder_1dfsp_1`,"rst-layout-builder-navbar":`_rst-layout-builder-navbar_1dfsp_21`,"rst-layout-builder-content-wrapper":`_rst-layout-builder-content-wrapper_1dfsp_33`,"rst-layout-builder-footer":`_rst-layout-builder-footer_1dfsp_41`,"rst-layout-builder-toolbar":`_rst-layout-builder-toolbar_1dfsp_55`,"rst-layout-builder-group":`_rst-layout-builder-group_1dfsp_66`,"rst-layout-builder-label":`_rst-layout-builder-label_1dfsp_74`,"rst-layout-builder-grid-container":`_rst-layout-builder-grid-container_1dfsp_83`,"rst-layout-builder-grid":`_rst-layout-builder-grid_1dfsp_83`,"rst-layout-builder-grid-overlay":`_rst-layout-builder-grid-overlay_1dfsp_102`,"rst-layout-builder-cell":`_rst-layout-builder-cell_1dfsp_113`,"rst-layout-builder-block":`_rst-layout-builder-block_1dfsp_119`,"rst-layout-builder-block-selected":`_rst-layout-builder-block-selected_1dfsp_138`,"rst-layout-builder-ghost":`_rst-layout-builder-ghost_1dfsp_146`,"rst-layout-builder-block-controls":`_rst-layout-builder-block-controls_1dfsp_154`,"rst-layout-builder-block-info":`_rst-layout-builder-block-info_1dfsp_163`,"rst-layout-builder-input":`_rst-layout-builder-input_1dfsp_169`,"rst-layout-builder-button":`_rst-layout-builder-button_1dfsp_177`,"rst-layout-builder-button-active":`_rst-layout-builder-button-active_1dfsp_191`,"rst-layout-builder-icon-btn":`_rst-layout-builder-icon-btn_1dfsp_201`,"rst-layout-builder-resize-handle":`_rst-layout-builder-resize-handle_1dfsp_219`,"rst-layout-builder-resize-handle-se":`_rst-layout-builder-resize-handle-se_1dfsp_229`,"rst-layout-builder-content":`_rst-layout-builder-content_1dfsp_33`,"rst-layout-builder-field-palette":`_rst-layout-builder-field-palette_1dfsp_246`,"rst-layout-builder-field-palette-title":`_rst-layout-builder-field-palette-title_1dfsp_259`,"rst-layout-builder-field-list":`_rst-layout-builder-field-list_1dfsp_266`,"rst-layout-builder-field-item":`_rst-layout-builder-field-item_1dfsp_272`,"rst-layout-builder-field-item-dragging":`_rst-layout-builder-field-item-dragging_1dfsp_291`,"rst-layout-builder-field-item-used":`_rst-layout-builder-field-item-used_1dfsp_295`,"rst-layout-builder-grid-container-with-palette":`_rst-layout-builder-grid-container-with-palette_1dfsp_305`,"rst-layout-builder-drop-indicator":`_rst-layout-builder-drop-indicator_1dfsp_309`,"rst-layout-builder-drop-indicator-label":`_rst-layout-builder-drop-indicator-label_1dfsp_320`,"rst-layout-builder-grid-locked":`_rst-layout-builder-grid-locked_1dfsp_331`,"rst-layout-builder-select":`_rst-layout-builder-select_1dfsp_361`,"rst-layout-builder-block-slot":`_rst-layout-builder-block-slot_1dfsp_378`,"rst-layout-builder-slot-hint":`_rst-layout-builder-slot-hint_1dfsp_389`},hG={"rst-json-editor":`_rst-json-editor_1so51_1`,"rst-json-editor-toolbar":`_rst-json-editor-toolbar_1so51_11`,"rst-json-editor-label":`_rst-json-editor-label_1so51_22`,"rst-json-editor-status-valid":`_rst-json-editor-status-valid_1so51_27`,"rst-json-editor-status-invalid":`_rst-json-editor-status-invalid_1so51_33`,"rst-json-editor-cursor":`_rst-json-editor-cursor_1so51_39`,"rst-json-editor-container":`_rst-json-editor-container_1so51_46`,"rst-json-editor-line-numbers":`_rst-json-editor-line-numbers_1so51_53`,"rst-json-editor-line-number":`_rst-json-editor-line-number_1so51_53`,"rst-json-editor-line-error":`_rst-json-editor-line-error_1so51_72`,"rst-json-editor-textarea":`_rst-json-editor-textarea_1so51_77`,"rst-json-editor-textarea-invalid":`_rst-json-editor-textarea-invalid_1so51_96`,"rst-json-editor-errors":`_rst-json-editor-errors_1so51_100`,"rst-json-editor-errors-header":`_rst-json-editor-errors-header_1so51_108`,"rst-json-editor-errors-list":`_rst-json-editor-errors-list_1so51_116`,"rst-json-editor-error-item":`_rst-json-editor-error-item_1so51_121`,"rst-json-editor-error-path":`_rst-json-editor-error-path_1so51_135`,"rst-json-editor-error-message":`_rst-json-editor-error-message_1so51_141`,"rst-json-editor-error-expected":`_rst-json-editor-error-expected_1so51_147`,"rst-view-toggle":`_rst-view-toggle_1so51_155`,"rst-view-toggle-btn":`_rst-view-toggle-btn_1so51_164`,"rst-view-toggle-btn-active":`_rst-view-toggle-btn-active_1so51_180`,"rst-split-view":`_rst-split-view_1so51_187`,"rst-split-view-panel":`_rst-split-view-panel_1so51_194`,"rst-split-view-divider":`_rst-split-view-divider_1so51_201`},gG=({value:e,onChange:t,errors:n,readOnly:r=!1,height:i,onActivate:a,onDeactivate:o})=>{let s=(0,d.useRef)(null),c=(0,d.useRef)(null),[l,u]=(0,d.useState)(e),[f,p]=(0,d.useState)(null);(0,d.useEffect)(()=>{u(e)},[e]);let m=l.split(`
108
108
  `).length,g=Array.from({length:m},(e,t)=>t+1),_=new Set;for(let e of n){let t=e.path.match(/\.(\d+)/);t&&_.add(parseInt(t[1],10))}let v=e=>{let n=e.target.value;u(n),t(n)},y=()=>{s.current&&c.current&&(c.current.scrollTop=s.current.scrollTop)},b=(0,d.useCallback)(()=>{if(!s.current)return;let e=s.current,t=e.value,n=e.selectionStart,r=t.substring(0,n).split(`
109
- `),i=r.length;p({line:i,column:r[r.length-1].length+1})},[]),x=()=>{try{let e=JSON.parse(l),n=JSON.stringify(e,null,2);u(n),t(n)}catch{}},S=()=>{try{let e=JSON.parse(l),n=JSON.stringify(e);u(n),t(n)}catch{}},C=async()=>{try{await navigator.clipboard.writeText(l)}catch{s.current?.select(),document.execCommand(`copy`)}},w=n.length===0;return(0,h.jsxs)(`div`,{className:mG[`rst-json-editor`],style:{height:i},onFocus:a,onBlur:o,onMouseEnter:a,onMouseLeave:o,tabIndex:0,children:[(0,h.jsxs)(`div`,{className:mG[`rst-json-editor-toolbar`],children:[(0,h.jsxs)(ZV,{direction:`row`,gap:.75,align:`center`,children:[(0,h.jsx)(`span`,{className:mG[`rst-json-editor-label`],children:`JSON Editor`}),w?(0,h.jsx)(`span`,{className:mG[`rst-json-editor-status-valid`],children:`✓ Valid`}):(0,h.jsxs)(`span`,{className:mG[`rst-json-editor-status-invalid`],children:[`✗ `,n.length,` error`,n.length===1?``:`s`]})]}),(0,h.jsxs)(ZV,{direction:`row`,gap:.5,align:`center`,children:[f&&(0,h.jsxs)(`span`,{className:mG[`rst-json-editor-cursor`],children:[`Ln `,f.line,`, Col `,f.column]}),(0,h.jsx)(D,{size:`small`,variant:`base`,value:`Format`,onClick:x,title:`Format JSON (Ctrl+Shift+F)`}),(0,h.jsx)(D,{size:`small`,variant:`base`,value:`Minify`,onClick:S,title:`Minify JSON`}),(0,h.jsx)(D,{size:`small`,variant:`base`,value:`Copy`,onClick:C,title:`Copy to clipboard`})]})]}),(0,h.jsxs)(`div`,{className:mG[`rst-json-editor-container`],children:[(0,h.jsx)(`div`,{ref:c,className:mG[`rst-json-editor-line-numbers`],children:g.map(e=>(0,h.jsx)(`div`,{className:`${mG[`rst-json-editor-line-number`]} ${_.has(e)?mG[`rst-json-editor-line-error`]:``}`,children:e},e))}),(0,h.jsx)(`textarea`,{ref:s,className:`${mG[`rst-json-editor-textarea`]} ${w?``:mG[`rst-json-editor-textarea-invalid`]}`,value:l,onChange:v,onScroll:y,onClick:b,onKeyUp:b,readOnly:r,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,autoComplete:`off`,"data-gramm":`false`})]}),n.length>0&&(0,h.jsxs)(`div`,{className:mG[`rst-json-editor-errors`],children:[(0,h.jsxs)(`div`,{className:mG[`rst-json-editor-errors-header`],children:[`Validation Errors (`,n.length,`)`]}),(0,h.jsx)(`div`,{className:mG[`rst-json-editor-errors-list`],children:n.map((e,t)=>(0,h.jsxs)(`div`,{className:mG[`rst-json-editor-error-item`],children:[(0,h.jsx)(`span`,{className:mG[`rst-json-editor-error-path`],children:e.path||`(root)`}),(0,h.jsx)(`span`,{className:mG[`rst-json-editor-error-message`],children:e.message}),e.expected&&(0,h.jsxs)(`span`,{className:mG[`rst-json-editor-error-expected`],children:[`Expected: `,e.expected]})]},t))})]})]})};hG.displayName=`LayoutJsonEditor`;var gG=`1.0.0`,_G={type:`object`,properties:{columns:{type:`integer`,minimum:1,maximum:24,description:`Number of columns in the grid`},rows:{type:`integer`,minimum:1,maximum:24,description:`Number of rows in the grid`},gap:{type:`number`,minimum:0,description:`Gap between grid cells (in spacing units)`},blocks:{type:`object`,additionalProperties:{type:`object`,properties:{col:{type:`integer`,minimum:1,description:`Starting column (1-based index)`},row:{type:`integer`,minimum:1,description:`Starting row (1-based index)`},w:{type:`integer`,minimum:1,description:`Width in grid columns`},h:{type:`integer`,minimum:1,description:`Height in grid rows`},alignX:{type:`string`,enum:[`start`,`center`,`end`],description:`Horizontal alignment of content within the block`},alignY:{type:`string`,enum:[`start`,`center`,`end`],description:`Vertical alignment of content within the block`}},required:[`col`,`row`,`w`,`h`],additionalProperties:!1},description:`Map of block IDs to their grid placements`},extends:{type:`string`,enum:[`mobile`,`tablet`,`desktop`],description:`Optional: inherit from another breakpoint configuration`}},required:[`columns`,`blocks`],additionalProperties:!1};({..._G}),{..._G},{..._G};var vG={width:1,height:1},yG=[`mobile`,`tablet`,`desktop`],bG={desktop:{columns:12,rows:12,blocks:{}},tablet:{columns:8,rows:12,blocks:{}},mobile:{columns:4,rows:12,blocks:{}}};function xG(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function SG(e){return typeof e==`number`&&Number.isInteger(e)}function CG(e){return SG(e)&&e>0}function wG(e,t,n,r){let i=[];if(!xG(e))return i.push({path:t,message:`Expected an object`,value:e,expected:`{ col, row, w, h }`}),i;for(let n of[`col`,`row`,`w`,`h`])n in e?CG(e[n])||i.push({path:`${t}.${n}`,message:`'${n}' must be a positive integer`,value:e[n],expected:`integer >= 1`}):i.push({path:`${t}.${n}`,message:`Missing required field '${n}'`,expected:`integer >= 1`});if(CG(e.col)&&e.col>n&&i.push({path:`${t}.col`,message:`Column ${e.col} exceeds grid columns (${n})`,value:e.col,expected:`1 <= col <= ${n}`}),CG(e.row)&&e.row>r&&i.push({path:`${t}.row`,message:`Row ${e.row} exceeds grid rows (${r})`,value:e.row,expected:`1 <= row <= ${r}`}),CG(e.col)&&CG(e.w)){let r=e.col+e.w-1;r>n&&i.push({path:`${t}`,message:`Block extends beyond grid (col ${e.col} + width ${e.w} = ${r+1}, max: ${n})`,value:{col:e.col,w:e.w},expected:`col + w - 1 <= ${n}`})}if(CG(e.row)&&CG(e.h)){let n=e.row+e.h-1;n>r&&i.push({path:`${t}`,message:`Block extends beyond grid (row ${e.row} + height ${e.h} = ${n+1}, max: ${r})`,value:{row:e.row,h:e.h},expected:`row + h - 1 <= ${r}`})}`alignX`in e&&e.alignX!==void 0&&([`start`,`center`,`end`].includes(e.alignX)||i.push({path:`${t}.alignX`,message:`Invalid alignX value`,value:e.alignX,expected:`start | center | end`})),`alignY`in e&&e.alignY!==void 0&&([`start`,`center`,`end`].includes(e.alignY)||i.push({path:`${t}.alignY`,message:`Invalid alignY value`,value:e.alignY,expected:`start | center | end`}));let a=[`col`,`row`,`w`,`h`,`alignX`,`alignY`];for(let n of Object.keys(e))a.includes(n)||i.push({path:`${t}.${n}`,message:`Unknown property '${n}'`,value:e[n],expected:`Allowed: ${a.join(`, `)}`});return i}function TG(e,t,n){let r=[];if(!xG(e))return r.push({path:n,message:`Expected an object`,value:e,expected:`{ columns, blocks, ... }`}),r;`columns`in e?(!CG(e.columns)||e.columns>24)&&r.push({path:`${n}.columns`,message:`'columns' must be an integer between 1 and 24`,value:e.columns,expected:`1 <= columns <= 24`}):r.push({path:`${n}.columns`,message:`Missing required field 'columns'`,expected:`integer 1-24`});let i=CG(e.rows)?e.rows:12;if(`rows`in e&&e.rows!==void 0&&(!CG(e.rows)||e.rows>24)&&r.push({path:`${n}.rows`,message:`'rows' must be an integer between 1 and 24`,value:e.rows,expected:`1 <= rows <= 24`}),`gap`in e&&e.gap!==void 0&&(typeof e.gap!=`number`||e.gap<0)&&r.push({path:`${n}.gap`,message:`'gap' must be a non-negative number`,value:e.gap,expected:`number >= 0`}),`extends`in e&&e.extends!==void 0&&([`mobile`,`tablet`,`desktop`].includes(e.extends)||r.push({path:`${n}.extends`,message:`Invalid 'extends' value`,value:e.extends,expected:`mobile | tablet | desktop`}),e.extends===t&&r.push({path:`${n}.extends`,message:`A breakpoint cannot extend itself`,value:e.extends})),!(`blocks`in e))r.push({path:`${n}.blocks`,message:`Missing required field 'blocks'`,expected:`{ [blockId]: GridPlacement }`});else if(!xG(e.blocks))r.push({path:`${n}.blocks`,message:`'blocks' must be an object`,value:e.blocks,expected:`{ [blockId]: GridPlacement }`});else{let t=CG(e.columns)?e.columns:12;for(let[a,o]of Object.entries(e.blocks)){let e=wG(o,`${n}.blocks.${a}`,t,i);r.push(...e)}let a=EG(e.blocks);for(let e of a)r.push({path:`${n}.blocks`,message:`Block collision detected: '${e.block1}' overlaps with '${e.block2}'`,value:{block1:e.block1,block2:e.block2}})}let a=[`columns`,`rows`,`gap`,`blocks`,`extends`];for(let t of Object.keys(e))a.includes(t)||r.push({path:`${n}.${t}`,message:`Unknown property '${t}'`,value:e[t],expected:`Allowed: ${a.join(`, `)}`});return r}function EG(e){let t=[],n=Object.keys(e);for(let r=0;r<n.length;r++)for(let i=r+1;i<n.length;i++){let a=n[r],o=n[i],s=e[a],c=e[o];DG(s,c)&&t.push({block1:a,block2:o})}return t}function DG(e,t){let n=e.col+e.w-1,r=e.row+e.h-1,i=t.col+t.w-1,a=t.row+t.h-1,o=e.col<=i&&n>=t.col,s=e.row<=a&&r>=t.row;return o&&s}function OG(e){let t=[];if(!xG(e))return{valid:!1,errors:[{path:``,message:`Layout must be an object`,value:e,expected:`{ mobile, tablet, desktop }`}]};for(let n of yG)if(!(n in e))t.push({path:n,message:`Missing required breakpoint '${n}'`,expected:`BreakpointLayout`});else{let r=TG(e[n],n,n);t.push(...r)}`version`in e&&e.version!==void 0&&(typeof e.version!=`string`||!/^\d+\.\d+\.\d+$/.test(e.version))&&t.push({path:`version`,message:`Version must be a semver string (e.g., '1.0.0')`,value:e.version,expected:`X.Y.Z format`});let n=[`mobile`,`tablet`,`desktop`,`version`,`$schema`];for(let r of Object.keys(e))n.includes(r)||t.push({path:r,message:`Unknown top-level property '${r}'`,value:e[r],expected:`Allowed: ${n.join(`, `)}`});return{valid:t.length===0,errors:t}}function kG(e){let t;try{t=JSON.parse(e)}catch(e){return{layout:null,errors:[{path:``,message:`Invalid JSON: ${e.message}`}]}}let n=OG(t);return n.valid?{layout:t,errors:[]}:{layout:null,errors:n.errors}}function AG(e,t=!0){let n={version:gG,...e};return JSON.stringify(n,null,t?2:void 0)}var jG=[{id:`single-column`,name:`Single Column`,description:`4 stacked rows`,layout:{mobile:{columns:4,rows:4,blocks:{slot_1:{col:1,row:1,w:4,h:1},slot_2:{col:1,row:2,w:4,h:1},slot_3:{col:1,row:3,w:4,h:1},slot_4:{col:1,row:4,w:4,h:1}}},tablet:{columns:8,rows:4,blocks:{slot_1:{col:1,row:1,w:8,h:1},slot_2:{col:1,row:2,w:8,h:1},slot_3:{col:1,row:3,w:8,h:1},slot_4:{col:1,row:4,w:8,h:1}}},desktop:{columns:12,rows:4,blocks:{slot_1:{col:1,row:1,w:12,h:1},slot_2:{col:1,row:2,w:12,h:1},slot_3:{col:1,row:3,w:12,h:1},slot_4:{col:1,row:4,w:12,h:1}}}}},{id:`two-column`,name:`Two Columns`,description:`2x2 grid layout`,layout:{mobile:{columns:4,rows:4,blocks:{slot_1:{col:1,row:1,w:4,h:1},slot_2:{col:1,row:2,w:4,h:1},slot_3:{col:1,row:3,w:4,h:1},slot_4:{col:1,row:4,w:4,h:1}}},tablet:{columns:8,rows:2,blocks:{slot_1:{col:1,row:1,w:4,h:1},slot_2:{col:5,row:1,w:4,h:1},slot_3:{col:1,row:2,w:4,h:1},slot_4:{col:5,row:2,w:4,h:1}}},desktop:{columns:12,rows:2,blocks:{slot_1:{col:1,row:1,w:6,h:1},slot_2:{col:7,row:1,w:6,h:1},slot_3:{col:1,row:2,w:6,h:1},slot_4:{col:7,row:2,w:6,h:1}}}}},{id:`three-column`,name:`Three Columns`,description:`3x2 grid layout`,layout:{mobile:{columns:4,rows:6,blocks:{slot_1:{col:1,row:1,w:4,h:1},slot_2:{col:1,row:2,w:4,h:1},slot_3:{col:1,row:3,w:4,h:1},slot_4:{col:1,row:4,w:4,h:1},slot_5:{col:1,row:5,w:4,h:1},slot_6:{col:1,row:6,w:4,h:1}}},tablet:{columns:8,rows:3,blocks:{slot_1:{col:1,row:1,w:4,h:1},slot_2:{col:5,row:1,w:4,h:1},slot_3:{col:1,row:2,w:4,h:1},slot_4:{col:5,row:2,w:4,h:1},slot_5:{col:1,row:3,w:4,h:1},slot_6:{col:5,row:3,w:4,h:1}}},desktop:{columns:12,rows:2,blocks:{slot_1:{col:1,row:1,w:4,h:1},slot_2:{col:5,row:1,w:4,h:1},slot_3:{col:9,row:1,w:4,h:1},slot_4:{col:1,row:2,w:4,h:1},slot_5:{col:5,row:2,w:4,h:1},slot_6:{col:9,row:2,w:4,h:1}}}}},{id:`sidebar-content`,name:`Sidebar + Content`,description:`Sidebar with main content area`,layout:{mobile:{columns:4,rows:5,blocks:{slot_sidebar:{col:1,row:1,w:4,h:1},slot_content:{col:1,row:2,w:4,h:4}}},tablet:{columns:8,rows:4,blocks:{slot_sidebar:{col:1,row:1,w:2,h:4},slot_content:{col:3,row:1,w:6,h:4}}},desktop:{columns:12,rows:4,blocks:{slot_sidebar:{col:1,row:1,w:3,h:4},slot_content:{col:4,row:1,w:9,h:4}}}}},{id:`form-layout`,name:`Form Layout`,description:`Common form with 6 fields`,layout:{mobile:{columns:4,rows:6,blocks:{slot_1:{col:1,row:1,w:4,h:1},slot_2:{col:1,row:2,w:4,h:1},slot_3:{col:1,row:3,w:4,h:1},slot_4:{col:1,row:4,w:4,h:1},slot_5:{col:1,row:5,w:4,h:1},slot_6:{col:1,row:6,w:4,h:1}}},tablet:{columns:8,rows:3,blocks:{slot_1:{col:1,row:1,w:4,h:1},slot_2:{col:5,row:1,w:4,h:1},slot_3:{col:1,row:2,w:4,h:1},slot_4:{col:5,row:2,w:4,h:1},slot_5:{col:1,row:3,w:4,h:1},slot_6:{col:5,row:3,w:4,h:1}}},desktop:{columns:12,rows:3,blocks:{slot_1:{col:1,row:1,w:6,h:1},slot_2:{col:7,row:1,w:6,h:1},slot_3:{col:1,row:2,w:6,h:1},slot_4:{col:7,row:2,w:6,h:1},slot_5:{col:1,row:3,w:6,h:1},slot_6:{col:7,row:3,w:6,h:1}}}}}];function MG(e){return jG.find(t=>t.id===e)}function NG(e){return e.startsWith(`slot_`)}function PG(e){return e===null?`null`:Array.isArray(e)?`array`:typeof e}function FG(e,t,n){let r=e.col+e.w-1,i=e.row+e.h-1;return Object.entries(t).some(([t,a])=>{if(n!==void 0&&t===String(n))return!1;let o=a.col+a.w-1,s=a.row+a.h-1,c=e.col<=o&&r>=a.col,l=e.row<=s&&i>=a.row;return c&&l})}function IG(e,t,n){for(let[r,i]of Object.entries(n)){let n=e>=i.col&&e<i.col+i.w,a=t>=i.row&&t<i.row+i.h;if(n&&a)return r}return null}function LG(e){let t=yG.flatMap(t=>Object.keys(e[t].blocks).map(e=>parseInt(e,10)).filter(e=>!isNaN(e)));return t.length>0?Math.max(...t)+1:0}function RG(e,t){return yG.some(n=>t[n].blocks[e]!==void 0)}function zG(e,t,n,r){let i=r[t],a=r[n],o=i.rows||12,s=a.rows||12,c=a.columns/i.columns,l=s/o,u=Math.max(1,Math.round((e.col-1)*c)+1),d=Math.max(1,Math.round((e.row-1)*l)+1),f=Math.max(1,Math.round(e.w*c)),p=Math.max(1,Math.round(e.h*l)),m=Math.min(u,a.columns),h=Math.min(d,s);return{col:m,row:h,w:Math.min(f,a.columns-m+1),h:Math.min(p,s-h+1)}}function BG(e,t,n,r,i){let a={...r};for(let o of yG){if(o===n||i.has(o))continue;let s=zG(t,n,o,r);a[o]={...a[o],blocks:{...a[o].blocks,[e]:s}}}return a}function VG(e,t,n){let r={...t};for(let t of yG){if(n.has(t))continue;let i=Object.fromEntries(Object.entries(r[t].blocks).filter(([t])=>t!==String(e)));r[t]={...r[t],blocks:i}}return r}function HG(e,t,n){let r={...t};for(let t of yG){if(n.has(t))continue;let i={...r[t].blocks};for(let t of e)delete i[t];r[t]={...r[t],blocks:i}}return r}function UG(e,t,n,r){let i={...n};for(let n of yG){if(r.has(n))continue;let a=i[n].blocks[e];if(a){let r=Object.fromEntries(Object.entries(i[n].blocks).filter(([t])=>t!==String(e)));i[n]={...i[n],blocks:{...r,[t]:a}}}}return i}function WG(e,t,n){let r={...e};r.col=Math.max(1,r.col),r.row=Math.max(1,r.row);let i=t-r.col+1;r.w=Math.min(r.w,i);let a=n-r.row+1;return r.h=Math.min(r.h,a),r}function GG(e,t,n){let r=e.col+e.w-1,i=e.row+e.h-1;return e.col>=1&&e.row>=1&&r<=t&&i<=n}function KG(e){return{mobile:{...e.mobile,blocks:{...e.mobile.blocks}},tablet:{...e.tablet,blocks:{...e.tablet.blocks}},desktop:{...e.desktop,blocks:{...e.desktop.blocks}}}}var qG=({initialLayout:e,onChange:t,dataModel:n,defaultViewMode:r=`visual`,showViewToggle:i=!0})=>{let[a,o]=(0,d.useState)(r),[s,c]=(0,d.useState)(``),[l,u]=(0,d.useState)([]),[f,p]=(0,d.useState)(!1),{state:m,setState:g,undo:_,redo:v,canUndo:y,canRedo:b}=oH(e||bG,{maxHistory:50,isEqual:(e,t)=>JSON.stringify(e)===JSON.stringify(t)}),[x,S]=(0,d.useState)(`desktop`),[C,w]=(0,d.useState)(new Set),[E,O]=(0,d.useState)(!1),[k,A]=(0,d.useState)(null),[j,M]=(0,d.useState)(null),[N,P]=(0,d.useState)(!1),[F,ee]=(0,d.useState)(null),[te,ne]=(0,d.useState)(!1),[re,I]=(0,d.useState)(null),[ie,ae]=(0,d.useState)(!1),[oe,se]=(0,d.useState)(null),[ce,le]=(0,d.useState)(null),[ue,de]=(0,d.useState)(!0),[fe,pe]=(0,d.useState)(new Set),[me,he]=(0,d.useState)(null),[L,ge]=(0,d.useState)({}),_e=(0,d.useRef)(null),R=m[x],ve=R.rows||12,ye=R.columns,be=fe.has(x),xe=AG(m);(0,d.useEffect)(()=>{f||(c(xe),u([]))},[xe]);let Se=(0,d.useCallback)(e=>{c(e),p(!0);let n=kG(e);if(n.errors.length>0)u(n.errors);else{u([]);let e=n.layout;g(e),t?.(e),p(!1)}},[g,t]),Ce=(0,d.useCallback)(()=>{c(AG(m)),u([]),p(!1)},[m]),we=e=>{g(e),t?.(e),p(!1)},Te=e=>{we({...m,[x]:{...m[x],...e}})},Ee=e=>{pe(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},De=e=>{let t=MG(e);if(!t)return;let n=KG(t.layout);he(e),ge({}),w(new Set),we(n)},Oe=()=>{he(null),ge({}),w(new Set),we(bG)},ke=()=>Object.keys(R.blocks).filter(NG),Ae=()=>{if(!n)return[];let e=new Set(Object.keys(R.blocks).filter(e=>!NG(e)));return Object.keys(n).filter(t=>!e.has(t))},je=(e,t)=>{ge({...L,[e]:t}),we(UG(e,t,m,fe)),w(new Set([t]))},Me=()=>{if(!n)return;let e=ke(),t=Ae();if(e.length===0||t.length===0)return;let r={...m},i={...L},a=t.slice(0,e.length);for(let t=0;t<a.length;t++){let n=a[t],o=e[t];i[o]=n,r=UG(o,n,r,fe)}ge(i),we(r)},Ne=(e,t)=>{if(be)return;let n=R.blocks[e];if(!n)return;let r=WG({...n,...t},ye,ve);FG(r,R.blocks,e)||Te({blocks:{...R.blocks,[e]:r}})},Pe=e=>{be||(ue?we(VG(e,m,fe)):Te({blocks:Object.fromEntries(Object.entries(R.blocks).filter(([t])=>t!==String(e)))}),w(new Set))},Fe=()=>{if(!(be||C.size===0)){if(ue)we(HG(C,m,fe));else{let e={...R.blocks};for(let t of C)delete e[t];Te({blocks:e})}w(new Set)}},Ie=(e,t)=>{if(!(e===t||be)&&!RG(t,m)){if(ue)we(UG(e,t,m,fe));else{let n=R.blocks[e];Te({blocks:{...Object.fromEntries(Object.entries(R.blocks).filter(([t])=>t!==String(e))),[t]:n}})}w(new Set([String(t)]))}},Le=(0,d.useRef)(Fe);(0,d.useEffect)(()=>{Le.current=Fe});let Re=()=>{let e=document.activeElement;if(!e)return!1;let t=e.tagName.toLowerCase();return t===`input`||t===`textarea`||e.getAttribute(`contenteditable`)===`true`},{register:ze,activate:Be,deactivate:Ve}=HW({scope:`component`}),{register:He,activate:Ue,deactivate:We}=HW({scope:`component`}),Ge=(0,d.useRef)(()=>{}),Ke=(0,d.useRef)(()=>{});(0,d.useEffect)(()=>{ze(`ctrl+z`,{name:`Undo`,action:()=>_()}),ze(`ctrl+shift+z`,{name:`Redo`,action:()=>v()}),ze(`ctrl+y`,{name:`Redo`,action:()=>v()}),ze(`cmd+delete`,{name:`Delete Selected`,action:()=>{Re()||Le.current()}})},[ze,_,v]),(0,d.useEffect)(()=>{He(`ctrl+shift+f`,{name:`Format JSON`,action:()=>Ge.current()}),He(`ctrl+shift+c`,{name:`Copy JSON`,action:()=>Ke.current()}),He(`ctrl+shift+r`,{name:`Reset JSON`,action:()=>Ce()})},[He,Ce]);let qe=e=>{if(!_e.current)return null;let t=_e.current.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top,i=t.width/ye,a=t.height/ve,o=Math.floor(n/i)+1,s=Math.floor(r/a)+1;return{col:Math.max(1,Math.min(o,ye)),row:Math.max(1,Math.min(s,ve))}},Je=e=>{if(e.target.closest(`.${Q[`rst-layout-builder-block`]}`)||be)return;let t=qe(e);t&&(O(!0),A(t),M(t),w(new Set))},Ye=(e,t)=>{if(e.stopPropagation(),be)return;let n=R.blocks[t];n&&(P(!0),ee(t),A({col:n.col,row:n.row}),M({col:n.col+n.w-1,row:n.row+n.h-1}))},Xe=(e,t)=>{if(e.stopPropagation(),be)return;let n=e.target.closest(`.${Q[`rst-layout-builder-block-controls`]}`),r=e.target.closest(`.${Q[`rst-layout-builder-resize-handle`]}`);if(n||r||!R.blocks[t])return;let i=qe(e);i&&(ne(!0),I(t),A(i),M(i),w(new Set([String(t)])))},Ze=e=>{if(!(E||N||te)||!k)return;let t=qe(e);t&&M(t)},Qe=()=>{if(be){$e();return}E&&k&&j?et():N&&F&&k&&j?tt():te&&re&&k&&j&&nt(),$e()},$e=()=>{O(!1),P(!1),ne(!1),ee(null),I(null),A(null),M(null)},et=()=>{if(!k||!j)return;let e={col:Math.min(k.col,j.col),row:Math.min(k.row,j.row),w:Math.abs(k.col-j.col)+1,h:Math.abs(k.row-j.row)+1};if(!FG(e,R.blocks)){let t=LG(m);if(ue){let n=BG(t,e,x,m,fe);n[x]={...n[x],blocks:{...n[x].blocks,[t]:e}},we(n)}else Te({blocks:{...R.blocks,[t]:e}});w(new Set([String(t)]))}},tt=()=>{if(!k||!j||!F)return;let e=Math.max(1,j.col-k.col+1),t=Math.max(1,j.row-k.row+1),n={col:k.col,row:k.row,w:e,h:t};FG(n,R.blocks,F)||Te({blocks:{...R.blocks,[F]:n}})},nt=()=>{if(!k||!j||!re)return;let e=R.blocks[re];if(!e)return;let t=j.col-k.col,n=j.row-k.row,r=e.col+t,i=e.row+n,a={...e,col:r,row:i},o=GG(a,ye,ve),s=FG(a,R.blocks,re);o&&!s&&Te({blocks:{...R.blocks,[re]:a}})},rt=(e,t)=>{e.stopPropagation(),e.shiftKey?w(e=>{let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n}):w(new Set([t]))},it=e=>C.has(e),at=C.size>0?Array.from(C)[0]:null,ot=e=>Object.keys(R.blocks).includes(e),st=(e,t)=>{if(ot(t)){e.preventDefault();return}ae(!0),se(t);let{dataTransfer:n}=e;n.setData(`text/plain`,t),n.effectAllowed=`copy`},ct=()=>{ae(!1),se(null),le(null)},lt=e=>{if(!ie)return;e.preventDefault();let{dataTransfer:t}=e;t.dropEffect=`copy`;let n=qe(e);n&&le(n)},ut=()=>{le(null)},dt=e=>{if(e.preventDefault(),be||!ie||!oe||!ce){ct();return}let t=IG(ce.col,ce.row,R.blocks);if(t&&NG(t)){je(t,oe),ct();return}let n={col:ce.col,row:ce.row,w:Math.min(vG.width,ye-ce.col+1),h:Math.min(vG.height,ve-ce.row+1)};if(!FG(n,R.blocks)){if(ue){let e=BG(oe,n,x,m,fe);e[x]={...e[x],blocks:{...e[x].blocks,[oe]:n}},we(e)}else Te({blocks:{...R.blocks,[oe]:n}});w(new Set([oe]))}ct()},ft=()=>{let e=[];for(let t=1;t<=ve;t++)for(let n=1;n<=ye;n++)e.push((0,h.jsx)(`div`,{className:Q[`rst-layout-builder-cell`],style:{gridColumn:n,gridRow:t}},`${t}-${n}`));return e},pt=()=>{if(!(E||N||te)||!k||!j)return null;let e,t,n,r;if(N)e=k.col,t=k.row,n=Math.max(1,j.col-e+1),r=Math.max(1,j.row-t+1);else if(te&&re){let i=R.blocks[re];if(!i)return null;let a=j.col-k.col,o=j.row-k.row;e=i.col+a,t=i.row+o,n=i.w,r=i.h}else e=Math.min(k.col,j.col),t=Math.min(k.row,j.row),n=Math.abs(k.col-j.col)+1,r=Math.abs(k.row-j.row)+1;return(0,h.jsx)(`div`,{className:Q[`rst-layout-builder-ghost`],style:{gridColumn:`${e} / span ${n}`,gridRow:`${t} / span ${r}`}})},mt=()=>{if(!ie||!ce||!oe)return null;let e=IG(ce.col,ce.row,R.blocks);if(e&&NG(e)&&e){let t=R.blocks[e];return(0,h.jsx)(`div`,{className:Q[`rst-layout-builder-drop-indicator`],style:{gridColumn:`${t.col} / span ${t.w}`,gridRow:`${t.row} / span ${t.h}`},children:(0,h.jsxs)(`span`,{className:Q[`rst-layout-builder-drop-indicator-label`],children:[`Drop into `,e]})})}let t=Math.min(vG.width,ye-ce.col+1),n=Math.min(vG.height,ve-ce.row+1),r=FG({col:ce.col,row:ce.row,w:t,h:n},R.blocks);return(0,h.jsx)(`div`,{className:Q[`rst-layout-builder-drop-indicator`],style:{gridColumn:`${ce.col} / span ${t}`,gridRow:`${ce.row} / span ${n}`,backgroundColor:r?`rgba(244, 67, 54, 0.3)`:void 0,borderColor:r?`#f44336`:void 0},children:(0,h.jsx)(`span`,{className:Q[`rst-layout-builder-drop-indicator-label`],style:{backgroundColor:r?`#f44336`:void 0},children:r?`Occupied`:oe})})},ht=()=>{if(!n)return null;let e=Object.entries(n);return(0,h.jsxs)(`div`,{className:Q[`rst-layout-builder-field-palette`],children:[(0,h.jsx)(T,{variant:`body`,className:Q[`rst-layout-builder-field-palette-title`],children:`Available Fields`}),(0,h.jsx)(`div`,{className:Q[`rst-layout-builder-field-list`],children:e.map(([e,t])=>{let n=ot(e),r=oe===e;return(0,h.jsxs)(`div`,{className:`${Q[`rst-layout-builder-field-item`]} ${n?Q[`rst-layout-builder-field-item-used`]:``} ${r?Q[`rst-layout-builder-field-item-dragging`]:``}`,draggable:!n,onDragStart:t=>st(t,e),onDragEnd:ct,children:[(0,h.jsx)(T,{variant:`body`,children:e}),(0,h.jsxs)(T,{variant:`caption`,children:[PG(t),n&&` • In use`]})]},e)})})]})},gt=()=>i?(0,h.jsx)(WH,{onChange:e=>o(e),value:a,options:[{value:`visual`,id:`visual`},{value:`split`,id:`split`},{value:`json`,id:`json`}]}):null,_t=()=>(0,h.jsxs)(`div`,{className:Q[`rst-layout-builder-content`],onFocus:Be,onBlur:Ve,onMouseEnter:Be,onMouseLeave:Ve,tabIndex:0,children:[(0,h.jsx)(`div`,{className:`${Q[`rst-layout-builder-grid-container`]} ${n?Q[`rst-layout-builder-grid-container-with-palette`]:``} ${be?Q[`rst-layout-builder-grid-locked`]:``}`,children:(0,h.jsxs)(`div`,{ref:_e,className:Q[`rst-layout-builder-grid`],style:{gridTemplateColumns:`repeat(${ye}, 1fr)`,gridTemplateRows:`repeat(${ve}, 1fr)`},onMouseDown:Je,onMouseMove:Ze,onMouseUp:Qe,onMouseLeave:Qe,onDragOver:lt,onDragLeave:ut,onDrop:dt,children:[(0,h.jsx)(`div`,{className:Q[`rst-layout-builder-grid-overlay`],style:{gridTemplateColumns:`repeat(${ye}, 1fr)`,gridTemplateRows:`repeat(${ve}, 1fr)`},children:ft()}),pt(),mt(),Object.entries(R.blocks).map(([e,t])=>{let n=it(e),r=n&&C.size===1,i=NG(e);return(0,h.jsxs)(`div`,{className:`${Q[`rst-layout-builder-block`]} ${n?Q[`rst-layout-builder-block-selected`]:``} ${i?Q[`rst-layout-builder-block-slot`]:``}`,style:{gridColumn:`${t.col} / span ${t.w}`,gridRow:`${t.row} / span ${t.h}`},onClick:t=>rt(t,e),onMouseDown:t=>{t.shiftKey||Xe(t,e)},onDragOver:e=>{ie&&i&&(e.preventDefault(),e.stopPropagation())},onDrop:t=>{ie&&i&&oe&&(t.preventDefault(),t.stopPropagation(),je(e,oe),ct())},tabIndex:0,children:[(0,h.jsx)(T,{variant:`caption`,className:Q[`rst-layout-builder-block-dimensions`],children:i?`📦 ${e}`:e}),i&&(0,h.jsx)(T,{variant:`caption`,className:Q[`rst-layout-builder-slot-hint`],children:`Drop field here`}),r&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`div`,{className:Q[`rst-layout-builder-block-controls`],children:[(0,h.jsx)(D,{value:`W-`,size:`small`,onClick:n=>{n.stopPropagation(),Ne(e,{w:t.w-1})}}),(0,h.jsx)(D,{value:`W+`,size:`small`,onClick:n=>{n.stopPropagation(),Ne(e,{w:t.w+1})}}),(0,h.jsx)(D,{value:`H-`,size:`small`,onClick:n=>{n.stopPropagation(),Ne(e,{h:t.h-1})}}),(0,h.jsx)(D,{value:`H+`,size:`small`,onClick:n=>{n.stopPropagation(),Ne(e,{h:t.h+1})}})]}),(0,h.jsx)(`div`,{className:`${Q[`rst-layout-builder-resize-handle`]} ${Q[`rst-layout-builder-resize-handle-se`]}`,onMouseDown:t=>Ye(t,e)})]})]},e)})]})}),ht()]}),vt=()=>(Ge.current=()=>{try{let e=JSON.parse(s),t=JSON.stringify(e,null,2);c(t),Se(t)}catch{}},Ke.current=async()=>{try{await navigator.clipboard.writeText(s)}catch{}},(0,h.jsx)(hG,{value:s,onChange:Se,errors:l,onActivate:Ue,onDeactivate:We}));return(0,h.jsxs)(`div`,{className:Q[`rst-layout-builder`],tabIndex:0,children:[(0,h.jsxs)(`div`,{className:Q[`rst-layout-builder-navbar`],children:[gt(),a!==`json`&&(0,h.jsxs)(`div`,{className:Q[`rst-layout-builder-group`],children:[(0,h.jsx)(T,{variant:`body`,children:`Template:`}),(0,h.jsx)(SV,{value:me||``,onChange:e=>e&&De(e),options:[...jG.map(e=>({value:e.id,label:`${e.name} - ${e.description}`}))]}),me&&(0,h.jsx)(D,{value:`Clear`,size:`small`,variant:`base`,onClick:Oe})]}),(0,h.jsxs)(`div`,{className:Q[`rst-layout-builder-group`],children:[(0,h.jsx)(D,{value:``,leadingVisual:`arrow-left`,size:`small`,variant:`base`,onClick:_,disabled:!y,title:`Undo (Cmd/Ctrl+Z)`}),(0,h.jsx)(D,{value:``,leadingVisual:`arrow-right`,size:`small`,variant:`base`,onClick:v,disabled:!b,title:`Redo (Cmd/Ctrl+Shift+Z)`})]})]}),(0,h.jsxs)(`div`,{className:Q[`rst-layout-builder-content-wrapper`],children:[a===`visual`&&_t(),a===`json`&&vt(),a===`split`&&(0,h.jsxs)(`div`,{className:mG[`rst-split-view`],children:[(0,h.jsx)(`div`,{className:mG[`rst-split-view-panel`],children:_t()}),(0,h.jsx)(`div`,{className:mG[`rst-split-view-divider`]}),(0,h.jsx)(`div`,{className:mG[`rst-split-view-panel`],children:vt()})]})]}),(0,h.jsxs)(`div`,{className:Q[`rst-layout-builder-footer`],children:[n&&a!==`json`&&(0,h.jsx)(`div`,{className:Q[`rst-layout-builder-group`],children:(0,h.jsx)(D,{value:`Auto-place (${Ae().length} fields, ${ke().length} slots)`,size:`small`,variant:`primary`,leadingVisual:`sparkle`,onClick:Me,disabled:ke().length===0||Ae().length===0})}),(0,h.jsxs)(`div`,{className:Q[`rst-layout-builder-group`],children:[(0,h.jsxs)(`label`,{className:Q[`rst-layout-builder-label`],children:[(0,h.jsx)(T,{variant:`body`,children:`Cols:`}),(0,h.jsx)(MV,{min:1,max:24,value:ye,onChange:e=>Te({columns:e||1})})]}),(0,h.jsxs)(`label`,{className:Q[`rst-layout-builder-label`],children:[(0,h.jsx)(T,{variant:`body`,children:`Rows:`}),(0,h.jsx)(MV,{min:1,max:100,value:ve,onChange:e=>Te({rows:e||1})})]})]}),(0,h.jsxs)(`div`,{className:Q[`rst-layout-builder-group`],children:[(0,h.jsx)(T,{variant:`body`,children:`Breakpoint:`}),(0,h.jsx)(WH,{onChange:e=>S(e),value:x,defaultValue:`desktop`,options:yG.map(e=>({value:e,id:e,leadingVisual:fe.has(e)?`lock`:void 0}))}),(0,h.jsx)(D,{value:fe.has(x)?`Unlock`:`Lock`,variant:fe.has(x)?`primary`:`base`,leadingVisual:fe.has(x)?`lock`:`lock-open`,size:`small`,onClick:()=>Ee(x)})]}),(0,h.jsxs)(`div`,{className:Q[`rst-layout-builder-group`],children:[(0,h.jsx)(T,{variant:`body`,children:`Sync:`}),(0,h.jsx)(D,{value:ue?`On`:`Off`,variant:ue?`primary`:`base`,leadingVisual:ue?`link`:`link-off`,size:`small`,onClick:()=>de(!ue)})]}),a!==`visual`&&(0,h.jsxs)(`div`,{className:Q[`rst-layout-builder-group`],children:[l.length===0?(0,h.jsx)(T,{variant:`caption`,style:{color:`var(--rst-color-success, #22c55e)`},children:`✓ JSON Valid`}):(0,h.jsxs)(T,{variant:`caption`,style:{color:`var(--rst-color-danger, #ef4444)`},children:[`✗ `,l.length,` error`,l.length===1?``:`s`]}),f&&l.length>0&&(0,h.jsx)(D,{value:`Reset`,size:`small`,variant:`base`,onClick:Ce,title:`Reset to last valid state`})]}),C.size>0&&(0,h.jsx)(`div`,{className:Q[`rst-layout-builder-group`],children:C.size===1&&at?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(T,{variant:`body`,children:`Block:`}),(0,h.jsx)(yV,{value:String(at),onChange:e=>Ie(at,e)}),(0,h.jsxs)(T,{variant:`caption`,style:{marginLeft:`0.5rem`,color:`var(--rst-color-text-subtle, #666)`},children:[R.blocks[at]?.w,` x `,R.blocks[at]?.h]}),(0,h.jsx)(D,{value:`Delete`,onClick:()=>Pe(at)})]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(T,{variant:`body`,children:[C.size,` blocks selected`]}),(0,h.jsx)(D,{value:`Delete ${C.size}`,variant:`danger`,onClick:Fe})]})})]})]})},JG={"rst-file-upload":`_rst-file-upload_thtch_1`,"rst-file-upload-dropzone":`_rst-file-upload-dropzone_thtch_8`,"rst-file-upload-dropzone-active":`_rst-file-upload-dropzone-active_thtch_23`,"rst-file-upload-dropzone-error":`_rst-file-upload-dropzone-error_thtch_28`,"rst-file-upload-header":`_rst-file-upload-header_thtch_33`,"rst-file-upload-tags":`_rst-file-upload-tags_thtch_40`,"rst-file-upload-files":`_rst-file-upload-files_thtch_47`,"rst-file-upload-file-item":`_rst-file-upload-file-item_thtch_53`,"rst-file-upload-file-info":`_rst-file-upload-file-info_thtch_63`,"rst-file-upload-hidden-input":`_rst-file-upload-hidden-input_thtch_69`},YG=(e,t=0)=>{if(e===0)return`0 Bytes`;let n=1024,r=t<0?0:t,i=[`Bytes`,`KB`,`MB`,`GB`,`TB`,`PB`,`EB`,`ZB`,`YB`],a=Math.floor(Math.log(e)/Math.log(n));return parseFloat((e/n**+a).toFixed(r))+` `+i[a]},XG=({title:e=`Upload files`,acceptedFileTypes:t=[],maxFileSize:n,maxFiles:r,onFilesChange:i,trigger:a,state:o=`base`,icon:s=`arrow-up`,className:c,...l})=>{let[u,f]=(0,d.useState)([]),[p,m]=(0,d.useState)(!1),[g,_]=(0,d.useState)(null),v=(0,d.useRef)(null),y=e=>{e.preventDefault(),e.stopPropagation(),m(!0)},x=e=>{e.preventDefault(),e.stopPropagation(),m(!1)},S=e=>{e.preventDefault(),e.stopPropagation(),m(!0)},C=e=>{if(n&&e.size>n)return`File ${e.name} is too large. Max size is ${n} bytes.`;if(t.length>0){let n=`.`+e.name.split(`.`).pop()?.toLowerCase();if(!t.includes(n))return`File ${e.name} has invalid type. Accepted types: ${t.join(`, `)}`}return null},w=e=>{e.preventDefault(),e.stopPropagation(),m(!1),_(null),k(Array.from(e.dataTransfer.files))},O=e=>{e.target.files&&k(Array.from(e.target.files))},k=e=>{let t=[],n=[];if(r&&u.length+e.length>r){_(`You can only upload a maximum of ${r} files.`);return}if(e.forEach(e=>{let r=C(e);r?n.push(r):t.push(e)}),n.length>0&&_(n[0]),t.length>0){let e=[...u,...t];f(e),i?.(e)}},A=e=>{let t=u.filter((t,n)=>n!==e);f(t),i?.(t)},j=()=>{v.current?.click()},M=[JG[`rst-file-upload-dropzone`],p?JG[`rst-file-upload-dropzone-active`]:``,g||o===`danger`?JG[`rst-file-upload-dropzone-error`]:``].filter(Boolean).join(` `);return(0,h.jsxs)(`div`,{className:`${JG[`rst-file-upload`]} ${c||``}`,...l,children:[(0,h.jsxs)(`div`,{className:M,onDragEnter:y,onDragLeave:x,onDragOver:S,onDrop:w,onClick:j,children:[(0,h.jsx)(`input`,{type:`file`,ref:v,className:JG[`rst-file-upload-hidden-input`],multiple:r!==1,accept:t.join(`,`),onChange:O}),(0,h.jsxs)(`div`,{className:JG[`rst-file-upload-header`],children:[(0,h.jsx)(sB,{src:s,size:`large`}),(0,h.jsx)(T,{variant:`heading`,children:e})]}),t.length>0&&(0,h.jsx)(`div`,{className:JG[`rst-file-upload-tags`],children:t.map(e=>(0,h.jsx)(E,{value:e,state:`base`},e))}),(n||r)&&(0,h.jsx)(T,{variant:`caption`,children:[n?`Maximum file size: ${YG(n)}`:null,r?`Maximum files: ${r}`:null].filter(Boolean).join(` • `)}),a?(0,h.jsx)(`div`,{onClick:e=>{e.stopPropagation(),j()},children:a}):(0,h.jsx)(T,{variant:`caption`,children:`Drag & drop files here or click to browse`})]}),g&&(0,h.jsx)(T,{variant:`caption`,color:`var(--rst-color-error-600)`,children:g}),u.length>0&&(0,h.jsx)(`div`,{className:JG[`rst-file-upload-files`],children:u.map((e,t)=>(0,h.jsxs)(`div`,{className:JG[`rst-file-upload-file-item`],children:[(0,h.jsxs)(`div`,{className:JG[`rst-file-upload-file-info`],children:[(0,h.jsx)(b,{src:`document-outline`}),(0,h.jsx)(T,{variant:`body`,children:e.name}),(0,h.jsxs)(T,{variant:`caption`,color:`var(--rst-color-gray-500)`,children:[`(`,(e.size/1024).toFixed(1),` KB)`]})]}),(0,h.jsx)(D,{leadingVisual:`delete`,variant:`invisible`,size:`small`,onClick:e=>{e.stopPropagation(),A(t)},"aria-label":`Remove file`})]},`${e.name}-${t}`))})]})},ZG={"rst-workflow-node":`_rst-workflow-node_1sk0t_2`,"rst-workflow-node-header":`_rst-workflow-node-header_1sk0t_20`,"rst-workflow-node-title":`_rst-workflow-node-title_1sk0t_27`,"rst-workflow-node-content":`_rst-workflow-node-content_1sk0t_34`,"rst-workflow-node-empty":`_rst-workflow-node-empty_1sk0t_38`,"rst-workflow-node-footer":`_rst-workflow-node-footer_1sk0t_47`,"rst-workflow-node-metadata":`_rst-workflow-node-metadata_1sk0t_56`};function QG({node:e,onClick:t,className:n}){let r=()=>{t&&t(e)};return(0,h.jsxs)(`div`,{className:[ZG[`rst-workflow-node`],n,e.className].filter(Boolean).join(` `),style:{left:`${e.x}px`,top:`${e.y}px`},onClick:r,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),r())},role:`button`,tabIndex:0,"aria-label":`Workflow node: ${e.label}`,children:[(0,h.jsxs)(`div`,{className:ZG[`rst-workflow-node-header`],children:[e.icon&&(0,h.jsx)(b,{src:e.icon}),(0,h.jsx)(T,{variant:`title`,children:e.label})]}),e.description&&(0,h.jsx)(`div`,{className:ZG[`rst-workflow-node-content`],children:(0,h.jsx)(T,{variant:`body`,children:e.description})}),e.metadata&&Object.keys(e.metadata).length>0&&(0,h.jsx)(`div`,{className:ZG[`rst-workflow-node-footer`],children:Object.entries(e.metadata).map(([e,t])=>(0,h.jsxs)(`span`,{className:ZG[`rst-workflow-node-metadata`],children:[e,`: `,String(t)]},e))})]})}var $G={direction:`TB`,nodeSpacingX:120,nodeSpacingY:100,nodeWidth:300,nodeHeight:75,padding:50};function eK(e,t){let n=new Map,r=new Set,i=new Map;e.forEach(e=>{i.set(e.id,0)}),t.forEach(e=>{let t=i.get(e.target)||0;i.set(e.target,t+1)});let a=[];for(e.forEach(e=>{i.get(e.id)===0&&(a.push(e.id),n.set(e.id,0))});a.length>0;){let e=a.shift();r.add(e);let o=n.get(e)||0;t.filter(t=>t.source===e).map(e=>e.target).forEach(e=>{let t=i.get(e)-1;i.set(e,t);let s=o+1,c=n.get(e)||0;n.set(e,Math.max(c,s)),t===0&&!r.has(e)&&a.push(e)})}return n}function tK(e,t,n){let r={...$G,...n},i=eK(e,t),a=new Map;e.forEach(e=>{let t=i.get(e.id)||0;a.has(t)||a.set(t,[]),a.get(t).push(e)});let o=[];return a.forEach((e,t)=>{e.forEach((e,n)=>{let i,a;r.direction===`TB`?(a=r.padding+t*(r.nodeHeight+r.nodeSpacingY),i=r.padding+n*(r.nodeWidth+r.nodeSpacingX)):(i=r.padding+t*(r.nodeWidth+r.nodeSpacingX),a=r.padding+n*(r.nodeHeight+r.nodeSpacingY)),o.push({...e,x:i,y:a,level:t})})}),nK(o,r)}function nK(e,t){let n=new Map;e.forEach(e=>{n.has(e.level)||n.set(e.level,[]),n.get(e.level).push(e)});let r=0;n.forEach(e=>{r=Math.max(r,e.length)});let i=t.direction===`TB`?r*(t.nodeWidth+t.nodeSpacingX)-t.nodeSpacingX:r*(t.nodeHeight+t.nodeSpacingY)-t.nodeSpacingY;return n.forEach(e=>{let n=(i-(t.direction===`TB`?e.length*(t.nodeWidth+t.nodeSpacingX)-t.nodeSpacingX:e.length*(t.nodeHeight+t.nodeSpacingY)-t.nodeSpacingY))/2;e.forEach(e=>{t.direction===`TB`?e.x+=n:e.y+=n})}),e}function rK(e,t,n){let{x:r,y:i}=e,{nodeWidth:a,nodeHeight:o}=n;switch(t){case`top`:return{x:r+a/2,y:i,side:t};case`right`:return{x:r+a,y:i+o/2,side:t};case`bottom`:return{x:r+a/2,y:i+o,side:t};case`left`:return{x:r,y:i+o/2,side:t}}}function iK(e,t,n){return n.direction===`TB`?t.level>e.level?{sourceSide:`bottom`,targetSide:`top`}:t.level<e.level?{sourceSide:`top`,targetSide:`bottom`}:t.x>e.x?{sourceSide:`right`,targetSide:`left`}:{sourceSide:`left`,targetSide:`right`}:t.level>e.level?{sourceSide:`right`,targetSide:`left`}:t.level<e.level?{sourceSide:`left`,targetSide:`right`}:t.y>e.y?{sourceSide:`bottom`,targetSide:`top`}:{sourceSide:`top`,targetSide:`bottom`}}function aK(e,t){let n=Math.abs(t.x-e.x),r=Math.abs(t.y-e.y),i=Math.sqrt(n*n+r*r),a=Math.max(50,i*.4),o=e.x,s=e.y,c=t.x,l=t.y;switch(e.side){case`right`:o=e.x+a;break;case`left`:o=e.x-a;break;case`bottom`:s=e.y+a;break;case`top`:s=e.y-a;break}switch(t.side){case`right`:c=t.x+a;break;case`left`:c=t.x-a;break;case`bottom`:l=t.y+a;break;case`top`:l=t.y-a;break}return`M ${e.x},${e.y} C ${o},${s} ${c},${l} ${t.x},${t.y}`}function oK(e,t){if(e.length===0)return{width:0,height:0};let n=0,r=0;return e.forEach(e=>{n=Math.max(n,e.x+t.nodeWidth),r=Math.max(r,e.y+t.nodeHeight)}),{width:n+t.padding,height:r+t.padding}}var sK={"rst-workflow-edges":`_rst-workflow-edges_d1kor_1`,"rst-workflow-edge":`_rst-workflow-edge_d1kor_1`,"rst-workflow-edge-path":`_rst-workflow-edge-path_d1kor_18`,"rst-workflow-edge-hitbox":`_rst-workflow-edge-hitbox_d1kor_32`,"rst-workflow-edge-endpoint-start":`_rst-workflow-edge-endpoint-start_d1kor_39`,"rst-workflow-edge-endpoint-end":`_rst-workflow-edge-endpoint-end_d1kor_49`,"rst-workflow-edge-label-bg":`_rst-workflow-edge-label-bg_d1kor_67`,"rst-workflow-edge-label":`_rst-workflow-edge-label_d1kor_67`,"rst-workflow-edge-default":`_rst-workflow-edge-default_d1kor_80`,"rst-workflow-edge-conditional":`_rst-workflow-edge-conditional_d1kor_84`,"rst-workflow-edge-error":`_rst-workflow-edge-error_d1kor_89`,"rst-workflow-edge-success":`_rst-workflow-edge-success_d1kor_93`,"rst-workflow-edge-timeout":`_rst-workflow-edge-timeout_d1kor_97`};function cK({edge:e,sourceNode:t,targetNode:n,layout:r,onClick:i,className:a}){let{sourceSide:o,targetSide:s}=iK(t,n,r),c=rK(t,o,r),l=rK(n,s,r),u=aK(c,l),d=(c.x+l.x)/2,f=(c.y+l.y)/2,p=sK[`rst-workflow-edge-${e.type||`default`}`],m=()=>{i&&i(e)};return(0,h.jsxs)(`g`,{className:[sK[`rst-workflow-edge`],p,a,e.className].filter(Boolean).join(` `),onClick:m,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),m())},role:`button`,tabIndex:0,"aria-label":`Connection from ${t.label} to ${n.label}${e.type?` (${e.type})`:``}`,children:[(0,h.jsx)(`path`,{d:u,className:sK[`rst-workflow-edge-path`],fill:`none`}),(0,h.jsx)(`path`,{d:u,className:sK[`rst-workflow-edge-hitbox`],fill:`none`,strokeWidth:`20`,stroke:`transparent`,pointerEvents:`stroke`}),(0,h.jsx)(`circle`,{cx:c.x,cy:c.y,r:`4`,className:sK[`rst-workflow-edge-endpoint-start`]}),(0,h.jsx)(`circle`,{cx:l.x,cy:l.y,r:`4`,className:sK[`rst-workflow-edge-endpoint-end`]}),e.label&&(0,h.jsxs)(`g`,{children:[(0,h.jsx)(`rect`,{x:d-30,y:f-12,width:`60`,height:`24`,rx:`4`,className:sK[`rst-workflow-edge-label-bg`]}),(0,h.jsx)(`text`,{x:d,y:f,textAnchor:`middle`,dominantBaseline:`middle`,className:sK[`rst-workflow-edge-label`],children:e.label})]})]})}var lK={"rst-workflow-toolbar":`_rst-workflow-toolbar_1vjr0_2`,"rst-workflow-toolbar-divider":`_rst-workflow-toolbar-divider_1vjr0_18`};function uK({mode:e,onModeChange:t,zoom:n,onZoomChange:r,minZoom:i=.1,maxZoom:a=2,className:o}){let s=()=>{let e=Math.min(n+.1,a);r(Number(e.toFixed(1)))},c=()=>{let e=Math.max(n-.1,i);r(Number(e.toFixed(1)))},l=()=>{r(1)},u=Math.round(n*100);return(0,h.jsxs)(`div`,{className:[lK[`rst-workflow-toolbar`],o].filter(Boolean).join(` `),children:[(0,h.jsx)(D,{variant:e===`pointer`?`primary`:`base`,size:`small`,leadingVisual:`cursor`,onClick:()=>t(`pointer`),"aria-label":`Pointer mode`,title:`Pointer mode - Select and interact with nodes`,children:`Pointer`}),(0,h.jsx)(D,{variant:e===`drag`?`primary`:`base`,size:`small`,leadingVisual:`drag`,onClick:()=>t(`drag`),"aria-label":`Drag mode`,title:`Drag mode - Pan the canvas`,children:`Drag`}),(0,h.jsx)(`div`,{className:lK[`rst-workflow-toolbar-divider`]}),(0,h.jsx)(D,{variant:`base`,size:`small`,leadingVisual:`zoom-minus`,onClick:c,disabled:n<=i,"aria-label":`Zoom out`,title:`Zoom out`}),(0,h.jsx)(D,{variant:`base`,size:`small`,onClick:l,"aria-label":`Reset zoom`,title:`Reset zoom to 100%`,value:`${u}%`}),(0,h.jsx)(D,{variant:`base`,size:`small`,leadingVisual:`zoom-plus`,onClick:s,disabled:n>=a,"aria-label":`Zoom in`,title:`Zoom in`})]})}var $={"rst-workflow-panel":`_rst-workflow-panel_1bnks_1`,"rst-workflow-panel-header":`_rst-workflow-panel-header_1bnks_18`,"rst-workflow-panel-badge":`_rst-workflow-panel-badge_1bnks_34`,"rst-workflow-panel-title":`_rst-workflow-panel-title_1bnks_46`,"rst-workflow-panel-close":`_rst-workflow-panel-close_1bnks_51`,"rst-workflow-panel-content":`_rst-workflow-panel-content_1bnks_71`,"rst-workflow-panel-section":`_rst-workflow-panel-section_1bnks_77`,"rst-workflow-panel-section-title":`_rst-workflow-panel-section-title_1bnks_81`,"rst-workflow-panel-next-step":`_rst-workflow-panel-next-step_1bnks_90`,"rst-workflow-panel-next-step-icon":`_rst-workflow-panel-next-step-icon_1bnks_112`,"rst-workflow-panel-next-step-text":`_rst-workflow-panel-next-step-text_1bnks_123`,"rst-workflow-panel-node-list":`_rst-workflow-panel-node-list_1bnks_128`,"rst-workflow-panel-node-item":`_rst-workflow-panel-node-item_1bnks_134`,"rst-workflow-panel-node-item-icon":`_rst-workflow-panel-node-item-icon_1bnks_151`,"rst-workflow-panel-node-item-label":`_rst-workflow-panel-node-item-label_1bnks_158`,"rst-workflow-panel-empty":`_rst-workflow-panel-empty_1bnks_163`,"rst-workflow-panel-divider":`_rst-workflow-panel-divider_1bnks_170`,"rst-workflow-panel-info":`_rst-workflow-panel-info_1bnks_176`,"rst-workflow-panel-info-row":`_rst-workflow-panel-info-row_1bnks_182`,"rst-workflow-panel-info-label":`_rst-workflow-panel-info-label_1bnks_188`,"rst-workflow-panel-info-value":`_rst-workflow-panel-info-value_1bnks_194`,"rst-workflow-panel-actions":`_rst-workflow-panel-actions_1bnks_201`,"rst-workflow-panel-action-item":`_rst-workflow-panel-action-item_1bnks_207`,"rst-workflow-panel-action-content":`_rst-workflow-panel-action-content_1bnks_217`,"rst-workflow-panel-action-name":`_rst-workflow-panel-action-name_1bnks_224`,"rst-workflow-panel-action-type":`_rst-workflow-panel-action-type_1bnks_230`,"rst-workflow-panel-connection-group":`_rst-workflow-panel-connection-group_1bnks_237`,"rst-workflow-panel-connection-label":`_rst-workflow-panel-connection-label_1bnks_243`,"rst-workflow-panel-connection-divider":`_rst-workflow-panel-connection-divider_1bnks_249`,"rst-workflow-panel-connection-info":`_rst-workflow-panel-connection-info_1bnks_259`,"rst-workflow-panel-node-button":`_rst-workflow-panel-node-button_1bnks_270`,"rst-workflow-panel-node-type":`_rst-workflow-panel-node-type_1bnks_294`,"rst-workflow-panel-advanced-toggle":`_rst-workflow-panel-advanced-toggle_1bnks_304`};function dK({selectedNode:e,allNodes:t,hasOutputs:n,onCreateNode:r,onConnectNode:i,onClose:a,className:o}){let[s,c]=(0,d.useState)(`default`),[l,u]=(0,d.useState)(!1);if(!e)return null;let f=t.filter(t=>t.id!==e.id),p=()=>{r(e.id)},m=t=>{i(e.id,t)},g=(()=>{let t=e.nodeType||`task`,n={start:{icon:`play`,label:`Start Node`,color:`var(--rst-borderColor-success-default)`},task:{icon:`check-circle`,label:`Task Node`,color:`var(--rst-borderColor-accent-default)`},decision:{icon:`git-branch`,label:`Decision Node`,color:`var(--rst-borderColor-attention-default)`},end:{icon:`check`,label:`End Node`,color:`var(--rst-borderColor-danger-default)`}};return n[t]||n.task})();return(0,h.jsxs)(`div`,{className:[$[`rst-workflow-panel`],o].filter(Boolean).join(` `),children:[(0,h.jsxs)(`div`,{className:$[`rst-workflow-panel-header`],children:[(0,h.jsxs)(`div`,{children:[(0,h.jsx)(T,{variant:`title`,className:$[`rst-workflow-panel-title`],children:e.label}),(0,h.jsxs)(`div`,{className:$[`rst-workflow-panel-badge`],style:{borderColor:g.color,color:g.color},children:[(0,h.jsx)(b,{src:g.icon}),(0,h.jsx)(`span`,{children:g.label})]})]}),(0,h.jsx)(`button`,{className:$[`rst-workflow-panel-close`],onClick:a,"aria-label":`Close panel`,type:`button`,children:(0,h.jsx)(b,{src:`close`})})]}),(0,h.jsxs)(`div`,{className:$[`rst-workflow-panel-content`],children:[(0,h.jsxs)(`div`,{className:$[`rst-workflow-panel-section`],children:[(0,h.jsxs)(`div`,{className:$[`rst-workflow-panel-section-title`],children:[(0,h.jsx)(b,{src:`info`}),`Node Information`]}),(0,h.jsxs)(`div`,{className:$[`rst-workflow-panel-info`],children:[(0,h.jsxs)(`div`,{className:$[`rst-workflow-panel-info-row`],children:[(0,h.jsx)(`span`,{className:$[`rst-workflow-panel-info-label`],children:`ID:`}),(0,h.jsx)(`span`,{className:$[`rst-workflow-panel-info-value`],children:e.id})]}),e.description&&(0,h.jsxs)(`div`,{className:$[`rst-workflow-panel-info-row`],children:[(0,h.jsx)(`span`,{className:$[`rst-workflow-panel-info-label`],children:`Description:`}),(0,h.jsx)(`span`,{className:$[`rst-workflow-panel-info-value`],children:e.description})]}),(0,h.jsxs)(`div`,{className:$[`rst-workflow-panel-info-row`],children:[(0,h.jsx)(`span`,{className:$[`rst-workflow-panel-info-label`],children:`Type:`}),(0,h.jsx)(`span`,{className:$[`rst-workflow-panel-info-value`],children:e.nodeType||`task`})]})]})]}),e.actions&&e.actions.length>0&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`div`,{className:$[`rst-workflow-panel-divider`]}),(0,h.jsxs)(`div`,{className:$[`rst-workflow-panel-section`],children:[(0,h.jsxs)(`div`,{className:$[`rst-workflow-panel-section-title`],children:[(0,h.jsx)(b,{src:`zap`}),`Actions (`,e.actions.length,`)`]}),(0,h.jsx)(`div`,{className:$[`rst-workflow-panel-actions`],children:e.actions.map(e=>(0,h.jsxs)(`div`,{className:$[`rst-workflow-panel-action-item`],children:[(0,h.jsx)(b,{src:fK(e.type)}),(0,h.jsxs)(`div`,{className:$[`rst-workflow-panel-action-content`],children:[(0,h.jsx)(`div`,{className:$[`rst-workflow-panel-action-name`],children:e.name}),(0,h.jsx)(`div`,{className:$[`rst-workflow-panel-action-type`],children:e.type})]})]},e.id))})]})]}),(0,h.jsx)(`div`,{className:$[`rst-workflow-panel-divider`]}),(0,h.jsxs)(`div`,{className:$[`rst-workflow-panel-section`],children:[(0,h.jsxs)(`div`,{className:$[`rst-workflow-panel-section-title`],children:[(0,h.jsx)(b,{src:`git-branch`}),`Connections`]}),n?(0,h.jsxs)(`div`,{className:$[`rst-workflow-panel-connection-info`],children:[(0,h.jsx)(b,{src:`check-circle`}),(0,h.jsx)(`span`,{children:`This node already has outgoing connections.`})]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`div`,{className:$[`rst-workflow-panel-connection-group`],children:[(0,h.jsx)(`div`,{className:$[`rst-workflow-panel-connection-label`],children:`Create & Connect New Node`}),(0,h.jsx)(D,{leadingVisual:`plus`,variant:`primary`,size:`small`,onClick:p,type:`button`,children:`Create Node`})]}),f.length>0&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`div`,{className:$[`rst-workflow-panel-connection-divider`],children:`OR`}),(0,h.jsxs)(`div`,{className:$[`rst-workflow-panel-connection-group`],children:[(0,h.jsx)(`div`,{className:$[`rst-workflow-panel-connection-label`],children:`Connect to Existing Node`}),(0,h.jsx)(SV,{value:s,onChange:e=>c(Array.isArray(e)?e[0]:e),options:[{value:`default`,id:`default`},{value:`conditional`,id:`conditional`},{value:`success`,id:`success`},{value:`error`,id:`error`},{value:`timeout`,id:`timeout`}]}),(0,h.jsx)(`div`,{className:$[`rst-workflow-panel-node-list`],children:f.map(e=>(0,h.jsxs)(`button`,{className:$[`rst-workflow-panel-node-button`],onClick:()=>m(e.id),type:`button`,children:[(0,h.jsx)(b,{src:e.icon||`file`}),(0,h.jsx)(`span`,{children:e.label}),e.nodeType&&(0,h.jsx)(`span`,{className:$[`rst-workflow-panel-node-type`],children:e.nodeType})]},e.id))})]})]})]})]}),(0,h.jsx)(`div`,{className:$[`rst-workflow-panel-divider`]}),(0,h.jsxs)(`button`,{className:$[`rst-workflow-panel-advanced-toggle`],onClick:()=>u(!l),type:`button`,children:[(0,h.jsx)(`span`,{children:`Advanced Settings`}),(0,h.jsx)(b,{src:l?`chevron-up`:`chevron-down`})]}),l&&(0,h.jsx)(`div`,{className:$[`rst-workflow-panel-section`],children:(0,h.jsxs)(`div`,{className:$[`rst-workflow-panel-info`],children:[(0,h.jsxs)(`div`,{className:$[`rst-workflow-panel-info-row`],children:[(0,h.jsx)(`span`,{className:$[`rst-workflow-panel-info-label`],children:`Data Records:`}),(0,h.jsx)(`span`,{className:$[`rst-workflow-panel-info-value`],children:e.data?.length||0})]}),(0,h.jsxs)(`div`,{className:$[`rst-workflow-panel-info-row`],children:[(0,h.jsx)(`span`,{className:$[`rst-workflow-panel-info-label`],children:`Columns:`}),(0,h.jsx)(`span`,{className:$[`rst-workflow-panel-info-value`],children:e.columns?.length||0})]}),e.metadata&&Object.keys(e.metadata).length>0&&(0,h.jsxs)(`div`,{className:$[`rst-workflow-panel-info-row`],children:[(0,h.jsx)(`span`,{className:$[`rst-workflow-panel-info-label`],children:`Metadata:`}),(0,h.jsxs)(`span`,{className:$[`rst-workflow-panel-info-value`],children:[Object.keys(e.metadata).length,` properties`]})]})]})})]})]})}function fK(e){return{api:`globe`,transform:`code`,wait:`clock`,notification:`bell`,condition:`git-branch`}[e]||`zap`}var pK={"rst-workflow":`_rst-workflow_3342o_2`,"rst-workflow-viewport":`_rst-workflow-viewport_3342o_12`,"rst-workflow-svg":`_rst-workflow-svg_3342o_20`,"rst-workflow-nodes":`_rst-workflow-nodes_3342o_29`,"rst-workflow-arrow":`_rst-workflow-arrow_3342o_37`,"rst-workflow-edge":`_rst-workflow-edge_3342o_42`};function mK({nodes:e,edges:t,layout:n,showToolbar:r=!0,showPanel:i=!0,defaultZoom:a=1,minZoom:o=.1,maxZoom:s=2,onNodeClick:c,onEdgeClick:l,onNodeCreate:u,onNodeConnect:f,className:p,...m}){let[g,_]=(0,d.useState)(`pointer`),[v,y]=(0,d.useState)(a),[b,x]=(0,d.useState)({x:0,y:0}),[S,C]=(0,d.useState)(!1),[w,T]=(0,d.useState)({x:0,y:0}),[E,D]=(0,d.useState)(null),O=(0,d.useRef)(null),k=(0,d.useMemo)(()=>({...$G,...n}),[n]),A=(0,d.useMemo)(()=>tK(e,t,k),[e,t,k]),{width:j,height:M}=(0,d.useMemo)(()=>oK(A,k),[A,k]),N=(0,d.useMemo)(()=>{let e=new Map;return A.forEach(t=>{e.set(t.id,t)}),e},[A]),P=(0,d.useMemo)(()=>E?t.some(e=>e.source===E.id):!1,[E,t]),F=e=>{D(e),c&&c(e)},ee=()=>{D(null)},te=e=>{u&&u(e)},ne=(e,t)=>{f&&f(e,t)},re=e=>{g===`drag`&&(C(!0),T({x:e.clientX-b.x,y:e.clientY-b.y}),O.current&&(O.current.style.cursor=`grabbing`))},I=e=>{S&&g===`drag`&&x({x:e.clientX-w.x,y:e.clientY-w.y})},ie=()=>{S&&(C(!1),O.current&&(O.current.style.cursor=g===`drag`?`grab`:`default`))},ae=()=>{S&&(C(!1),O.current&&(O.current.style.cursor=g===`drag`?`grab`:`default`))},oe=e=>{if(e.ctrlKey||e.metaKey){e.preventDefault();let t=e.deltaY>0?-.1:.1,n=Math.max(o,Math.min(s,v+t));y(Number(n.toFixed(1)))}},se=g===`drag`?S?`grabbing`:`grab`:`default`;return(0,h.jsxs)(`div`,{ref:O,className:[pK[`rst-workflow`],p].filter(Boolean).join(` `),onMouseDown:re,onMouseMove:I,onMouseUp:ie,onMouseLeave:ae,onWheel:oe,style:{cursor:se},...m,children:[r&&(0,h.jsx)(uK,{mode:g,onModeChange:_,zoom:v,onZoomChange:y,minZoom:o,maxZoom:s}),(0,h.jsxs)(`div`,{className:pK[`rst-workflow-viewport`],style:{transform:`translate(${b.x}px, ${b.y}px) scale(${v})`,transformOrigin:`0 0`},children:[(0,h.jsxs)(`svg`,{className:pK[`rst-workflow-svg`],width:j,height:M,xmlns:`http://www.w3.org/2000/svg`,children:[(0,h.jsx)(`defs`,{children:(0,h.jsx)(`marker`,{id:`arrowhead`,markerWidth:`10`,markerHeight:`10`,refX:`9`,refY:`3`,orient:`auto`,markerUnits:`strokeWidth`,children:(0,h.jsx)(`path`,{d:`M0,0 L0,6 L9,3 z`,className:pK[`rst-workflow-arrow`]})})}),(0,h.jsx)(`g`,{className:pK[`rst-workflow-edges`],children:t.map(e=>{let t=N.get(e.source),n=N.get(e.target);return!t||!n?(console.warn(`Edge ${e.id} references non-existent node(s): source=${e.source}, target=${e.target}`),null):(0,h.jsx)(cK,{edge:e,sourceNode:t,targetNode:n,layout:k,onClick:l},e.id)})})]}),(0,h.jsx)(`div`,{className:pK[`rst-workflow-nodes`],style:{width:`${j}px`,height:`${M}px`},children:A.map(e=>(0,h.jsx)(QG,{node:e,onClick:F},e.id))})]}),i&&E&&(0,h.jsx)(dK,{selectedNode:E,allNodes:e,hasOutputs:P,onCreateNode:te,onConnectNode:ne,onClose:ee})]})}function hK(e,t){let n=[],r=[];return gK(e,t,new Map(e.map(e=>[e.id,e])),n),_K(e,t,n,r),vK(e,t,r),yK(e,t,n),bK(t,r),xK(t,r),{valid:n.length===0,errors:n,warnings:r}}function gK(e,t,n,r){for(let e of t)n.has(e.source)||r.push({type:`invalid-edge`,message:`Edge ${e.id} references non-existent source node: ${e.source}`,relatedIds:[e.id,e.source]}),n.has(e.target)||r.push({type:`invalid-edge`,message:`Edge ${e.id} references non-existent target node: ${e.target}`,relatedIds:[e.id,e.target]})}function _K(e,t,n,r){let i=e.filter(e=>e.nodeType===`start`),a=e.filter(e=>e.nodeType===`end`);if(i.length===0){let r=new Set(t.map(e=>e.target));e.filter(e=>!r.has(e.id)).length===0&&n.push({type:`missing-start`,message:`Workflow must have at least one start node or a node with no incoming edges`,relatedIds:[]})}else i.length>1&&r.push({type:`unreachable-node`,message:`Workflow has multiple start nodes (${i.length}). This may be intentional for parallel execution.`,relatedIds:i.map(e=>e.id)});if(a.length===0){let n=new Set(t.map(e=>e.source));e.filter(e=>!n.has(e.id)).length===0&&r.push({type:`dead-end`,message:`Workflow should have at least one end node or a node with no outgoing edges`,relatedIds:[]})}}function vK(e,t,n){let r=new Set;for(let e of t)r.add(e.source),r.add(e.target);let i=e.filter(e=>!r.has(e.id));i.length>0&&n.push({type:`orphaned-node`,message:`Found ${i.length} orphaned node(s) with no connections`,relatedIds:i.map(e=>e.id)})}function yK(e,t,n){let r=new Map;for(let t of e)r.set(t.id,[]);for(let e of t){let t=r.get(e.source)||[];t.push(e.target),r.set(e.source,t)}let i=new Set,a=new Set,o=[];function s(e,t){i.add(e),a.add(e),t.push(e);let n=r.get(e)||[];for(let e of n)if(!i.has(e))s(e,[...t]);else if(a.has(e)){let n=t.indexOf(e),r=t.slice(n);r.push(e),o.push(r)}a.delete(e)}for(let t of e)i.has(t.id)||s(t.id,[]);for(let e of o)n.push({type:`circular-dependency`,message:`Circular dependency detected: ${e.join(` → `)}`,relatedIds:e})}function bK(e,t){let n=e.filter(e=>e.type===`conditional`&&!e.condition);n.length>0&&t.push({type:`missing-condition`,message:`${n.length} conditional edge(s) are missing condition logic`,relatedIds:n.map(e=>e.id)})}function xK(e,t){let n=new Map;for(let t of e){let e=`${t.source}->${t.target}`,r=n.get(e)||[];r.push(t.id),n.set(e,r)}for(let[e,r]of n.entries())r.length>1&&t.push({type:`duplicate-edge`,message:`Multiple edges between same nodes: ${e}`,relatedIds:r})}function SK(e,t){let n=new Set,r=[e];for(;r.length>0;){let e=r.shift();if(n.has(e))continue;n.add(e);let i=t.filter(t=>t.source===e);for(let e of i)n.has(e.target)||r.push(e.target)}return n}function CK(e,t){let n=new Map,r=new Map;for(let t of e)n.set(t.id,[]),r.set(t.id,0);for(let e of t){let t=n.get(e.source)||[];t.push(e.target),n.set(e.source,t),r.set(e.target,(r.get(e.target)||0)+1)}let i=[],a=[];for(let[e,t]of r.entries())t===0&&i.push(e);for(;i.length>0;){let e=i.shift();a.push(e);let t=n.get(e)||[];for(let e of t){let t=(r.get(e)||0)-1;r.set(e,t),t===0&&i.push(e)}}return a.length===e.length?a:null}exports.AIChatPanel=AW,exports.AnchoredOverlay=M,exports.AppBar=KW,exports.Avatar=sB,exports.Banner=O,exports.Breadcrumbs=JW,exports.Button=D,exports.Calendar=dG,exports.Cell=IU,exports.CellType=AU,exports.Chart=vH,exports.Checkbox=A,exports.ContributionHeatmap=jV,exports.DatePicker=MU,exports.DateRangePicker=kU,exports.FileUpload=XG,exports.Form=pG,exports.Graph=Qz,exports.Icon=b,exports.Kbd=aB,exports.Label=PV,exports.Layout=XV,exports.LayoutBuilder=qG,exports.Markdown=dV,exports.Menu=fH,exports.MindTree=oG,exports.MockAIProvider=LW,exports.NumberInput=MV,exports.OTP=g,exports.Scaffold=rG,exports.Select=SV,exports.ShortcutProvider=VW,exports.Sidebar=eG,exports.Stack=ZV,exports.TableGrid=FW,exports.TableGridRow=UU,exports.TableProvider=IH,exports.TextInput=yV,exports.Timeline=JV,exports.TourProvider=iH,exports.Typography=T,exports.Workflow=mK,exports.WorkflowPanel=dK,exports.WorkflowToolbar=uK,exports.buildColumnSchema=vW,exports.buildSystemPrompt=IW,exports.getReachableNodes=SK,exports.getTopologicalOrder=CK,exports.tableGridToolDefinitions=yW,exports.useHistory=oH,exports.useScaffold=WW,exports.useShortcut=HW,exports.useTour=rH,exports.useTourManager=aH,exports.validateToolCallsGeneric=SW,exports.validateWorkflow=hK;
109
+ `),i=r.length;p({line:i,column:r[r.length-1].length+1})},[]),x=()=>{try{let e=JSON.parse(l),n=JSON.stringify(e,null,2);u(n),t(n)}catch{}},S=()=>{try{let e=JSON.parse(l),n=JSON.stringify(e);u(n),t(n)}catch{}},C=async()=>{try{await navigator.clipboard.writeText(l)}catch{s.current?.select(),document.execCommand(`copy`)}},w=n.length===0;return(0,h.jsxs)(`div`,{className:hG[`rst-json-editor`],style:{height:i},onFocus:a,onBlur:o,onMouseEnter:a,onMouseLeave:o,tabIndex:0,children:[(0,h.jsxs)(`div`,{className:hG[`rst-json-editor-toolbar`],children:[(0,h.jsxs)(ZV,{direction:`row`,gap:.75,align:`center`,children:[(0,h.jsx)(`span`,{className:hG[`rst-json-editor-label`],children:`JSON Editor`}),w?(0,h.jsx)(`span`,{className:hG[`rst-json-editor-status-valid`],children:`✓ Valid`}):(0,h.jsxs)(`span`,{className:hG[`rst-json-editor-status-invalid`],children:[`✗ `,n.length,` error`,n.length===1?``:`s`]})]}),(0,h.jsxs)(ZV,{direction:`row`,gap:.5,align:`center`,children:[f&&(0,h.jsxs)(`span`,{className:hG[`rst-json-editor-cursor`],children:[`Ln `,f.line,`, Col `,f.column]}),(0,h.jsx)(D,{size:`small`,variant:`base`,value:`Format`,onClick:x,title:`Format JSON (Ctrl+Shift+F)`}),(0,h.jsx)(D,{size:`small`,variant:`base`,value:`Minify`,onClick:S,title:`Minify JSON`}),(0,h.jsx)(D,{size:`small`,variant:`base`,value:`Copy`,onClick:C,title:`Copy to clipboard`})]})]}),(0,h.jsxs)(`div`,{className:hG[`rst-json-editor-container`],children:[(0,h.jsx)(`div`,{ref:c,className:hG[`rst-json-editor-line-numbers`],children:g.map(e=>(0,h.jsx)(`div`,{className:`${hG[`rst-json-editor-line-number`]} ${_.has(e)?hG[`rst-json-editor-line-error`]:``}`,children:e},e))}),(0,h.jsx)(`textarea`,{ref:s,className:`${hG[`rst-json-editor-textarea`]} ${w?``:hG[`rst-json-editor-textarea-invalid`]}`,value:l,onChange:v,onScroll:y,onClick:b,onKeyUp:b,readOnly:r,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,autoComplete:`off`,"data-gramm":`false`})]}),n.length>0&&(0,h.jsxs)(`div`,{className:hG[`rst-json-editor-errors`],children:[(0,h.jsxs)(`div`,{className:hG[`rst-json-editor-errors-header`],children:[`Validation Errors (`,n.length,`)`]}),(0,h.jsx)(`div`,{className:hG[`rst-json-editor-errors-list`],children:n.map((e,t)=>(0,h.jsxs)(`div`,{className:hG[`rst-json-editor-error-item`],children:[(0,h.jsx)(`span`,{className:hG[`rst-json-editor-error-path`],children:e.path||`(root)`}),(0,h.jsx)(`span`,{className:hG[`rst-json-editor-error-message`],children:e.message}),e.expected&&(0,h.jsxs)(`span`,{className:hG[`rst-json-editor-error-expected`],children:[`Expected: `,e.expected]})]},t))})]})]})};gG.displayName=`LayoutJsonEditor`;var _G=`1.0.0`,vG={type:`object`,properties:{columns:{type:`integer`,minimum:1,maximum:24,description:`Number of columns in the grid`},rows:{type:`integer`,minimum:1,maximum:24,description:`Number of rows in the grid`},gap:{type:`number`,minimum:0,description:`Gap between grid cells (in spacing units)`},blocks:{type:`object`,additionalProperties:{type:`object`,properties:{col:{type:`integer`,minimum:1,description:`Starting column (1-based index)`},row:{type:`integer`,minimum:1,description:`Starting row (1-based index)`},w:{type:`integer`,minimum:1,description:`Width in grid columns`},h:{type:`integer`,minimum:1,description:`Height in grid rows`},alignX:{type:`string`,enum:[`start`,`center`,`end`],description:`Horizontal alignment of content within the block`},alignY:{type:`string`,enum:[`start`,`center`,`end`],description:`Vertical alignment of content within the block`}},required:[`col`,`row`,`w`,`h`],additionalProperties:!1},description:`Map of block IDs to their grid placements`},extends:{type:`string`,enum:[`mobile`,`tablet`,`desktop`],description:`Optional: inherit from another breakpoint configuration`}},required:[`columns`,`blocks`],additionalProperties:!1};({...vG}),{...vG},{...vG};var yG={width:1,height:1},bG=[`mobile`,`tablet`,`desktop`],xG={desktop:{columns:12,rows:12,blocks:{}},tablet:{columns:8,rows:12,blocks:{}},mobile:{columns:4,rows:12,blocks:{}}};function SG(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function CG(e){return typeof e==`number`&&Number.isInteger(e)}function wG(e){return CG(e)&&e>0}function TG(e,t,n,r){let i=[];if(!SG(e))return i.push({path:t,message:`Expected an object`,value:e,expected:`{ col, row, w, h }`}),i;for(let n of[`col`,`row`,`w`,`h`])n in e?wG(e[n])||i.push({path:`${t}.${n}`,message:`'${n}' must be a positive integer`,value:e[n],expected:`integer >= 1`}):i.push({path:`${t}.${n}`,message:`Missing required field '${n}'`,expected:`integer >= 1`});if(wG(e.col)&&e.col>n&&i.push({path:`${t}.col`,message:`Column ${e.col} exceeds grid columns (${n})`,value:e.col,expected:`1 <= col <= ${n}`}),wG(e.row)&&e.row>r&&i.push({path:`${t}.row`,message:`Row ${e.row} exceeds grid rows (${r})`,value:e.row,expected:`1 <= row <= ${r}`}),wG(e.col)&&wG(e.w)){let r=e.col+e.w-1;r>n&&i.push({path:`${t}`,message:`Block extends beyond grid (col ${e.col} + width ${e.w} = ${r+1}, max: ${n})`,value:{col:e.col,w:e.w},expected:`col + w - 1 <= ${n}`})}if(wG(e.row)&&wG(e.h)){let n=e.row+e.h-1;n>r&&i.push({path:`${t}`,message:`Block extends beyond grid (row ${e.row} + height ${e.h} = ${n+1}, max: ${r})`,value:{row:e.row,h:e.h},expected:`row + h - 1 <= ${r}`})}`alignX`in e&&e.alignX!==void 0&&([`start`,`center`,`end`].includes(e.alignX)||i.push({path:`${t}.alignX`,message:`Invalid alignX value`,value:e.alignX,expected:`start | center | end`})),`alignY`in e&&e.alignY!==void 0&&([`start`,`center`,`end`].includes(e.alignY)||i.push({path:`${t}.alignY`,message:`Invalid alignY value`,value:e.alignY,expected:`start | center | end`}));let a=[`col`,`row`,`w`,`h`,`alignX`,`alignY`];for(let n of Object.keys(e))a.includes(n)||i.push({path:`${t}.${n}`,message:`Unknown property '${n}'`,value:e[n],expected:`Allowed: ${a.join(`, `)}`});return i}function EG(e,t,n){let r=[];if(!SG(e))return r.push({path:n,message:`Expected an object`,value:e,expected:`{ columns, blocks, ... }`}),r;`columns`in e?(!wG(e.columns)||e.columns>24)&&r.push({path:`${n}.columns`,message:`'columns' must be an integer between 1 and 24`,value:e.columns,expected:`1 <= columns <= 24`}):r.push({path:`${n}.columns`,message:`Missing required field 'columns'`,expected:`integer 1-24`});let i=wG(e.rows)?e.rows:12;if(`rows`in e&&e.rows!==void 0&&(!wG(e.rows)||e.rows>24)&&r.push({path:`${n}.rows`,message:`'rows' must be an integer between 1 and 24`,value:e.rows,expected:`1 <= rows <= 24`}),`gap`in e&&e.gap!==void 0&&(typeof e.gap!=`number`||e.gap<0)&&r.push({path:`${n}.gap`,message:`'gap' must be a non-negative number`,value:e.gap,expected:`number >= 0`}),`extends`in e&&e.extends!==void 0&&([`mobile`,`tablet`,`desktop`].includes(e.extends)||r.push({path:`${n}.extends`,message:`Invalid 'extends' value`,value:e.extends,expected:`mobile | tablet | desktop`}),e.extends===t&&r.push({path:`${n}.extends`,message:`A breakpoint cannot extend itself`,value:e.extends})),!(`blocks`in e))r.push({path:`${n}.blocks`,message:`Missing required field 'blocks'`,expected:`{ [blockId]: GridPlacement }`});else if(!SG(e.blocks))r.push({path:`${n}.blocks`,message:`'blocks' must be an object`,value:e.blocks,expected:`{ [blockId]: GridPlacement }`});else{let t=wG(e.columns)?e.columns:12;for(let[a,o]of Object.entries(e.blocks)){let e=TG(o,`${n}.blocks.${a}`,t,i);r.push(...e)}let a=DG(e.blocks);for(let e of a)r.push({path:`${n}.blocks`,message:`Block collision detected: '${e.block1}' overlaps with '${e.block2}'`,value:{block1:e.block1,block2:e.block2}})}let a=[`columns`,`rows`,`gap`,`blocks`,`extends`];for(let t of Object.keys(e))a.includes(t)||r.push({path:`${n}.${t}`,message:`Unknown property '${t}'`,value:e[t],expected:`Allowed: ${a.join(`, `)}`});return r}function DG(e){let t=[],n=Object.keys(e);for(let r=0;r<n.length;r++)for(let i=r+1;i<n.length;i++){let a=n[r],o=n[i],s=e[a],c=e[o];OG(s,c)&&t.push({block1:a,block2:o})}return t}function OG(e,t){let n=e.col+e.w-1,r=e.row+e.h-1,i=t.col+t.w-1,a=t.row+t.h-1,o=e.col<=i&&n>=t.col,s=e.row<=a&&r>=t.row;return o&&s}function kG(e){let t=[];if(!SG(e))return{valid:!1,errors:[{path:``,message:`Layout must be an object`,value:e,expected:`{ mobile, tablet, desktop }`}]};for(let n of bG)if(!(n in e))t.push({path:n,message:`Missing required breakpoint '${n}'`,expected:`BreakpointLayout`});else{let r=EG(e[n],n,n);t.push(...r)}`version`in e&&e.version!==void 0&&(typeof e.version!=`string`||!/^\d+\.\d+\.\d+$/.test(e.version))&&t.push({path:`version`,message:`Version must be a semver string (e.g., '1.0.0')`,value:e.version,expected:`X.Y.Z format`});let n=[`mobile`,`tablet`,`desktop`,`version`,`$schema`];for(let r of Object.keys(e))n.includes(r)||t.push({path:r,message:`Unknown top-level property '${r}'`,value:e[r],expected:`Allowed: ${n.join(`, `)}`});return{valid:t.length===0,errors:t}}function AG(e){let t;try{t=JSON.parse(e)}catch(e){return{layout:null,errors:[{path:``,message:`Invalid JSON: ${e.message}`}]}}let n=kG(t);return n.valid?{layout:t,errors:[]}:{layout:null,errors:n.errors}}function jG(e,t=!0){let n={version:_G,...e};return JSON.stringify(n,null,t?2:void 0)}var MG=[{id:`single-column`,name:`Single Column`,description:`4 stacked rows`,layout:{mobile:{columns:4,rows:4,blocks:{slot_1:{col:1,row:1,w:4,h:1},slot_2:{col:1,row:2,w:4,h:1},slot_3:{col:1,row:3,w:4,h:1},slot_4:{col:1,row:4,w:4,h:1}}},tablet:{columns:8,rows:4,blocks:{slot_1:{col:1,row:1,w:8,h:1},slot_2:{col:1,row:2,w:8,h:1},slot_3:{col:1,row:3,w:8,h:1},slot_4:{col:1,row:4,w:8,h:1}}},desktop:{columns:12,rows:4,blocks:{slot_1:{col:1,row:1,w:12,h:1},slot_2:{col:1,row:2,w:12,h:1},slot_3:{col:1,row:3,w:12,h:1},slot_4:{col:1,row:4,w:12,h:1}}}}},{id:`two-column`,name:`Two Columns`,description:`2x2 grid layout`,layout:{mobile:{columns:4,rows:4,blocks:{slot_1:{col:1,row:1,w:4,h:1},slot_2:{col:1,row:2,w:4,h:1},slot_3:{col:1,row:3,w:4,h:1},slot_4:{col:1,row:4,w:4,h:1}}},tablet:{columns:8,rows:2,blocks:{slot_1:{col:1,row:1,w:4,h:1},slot_2:{col:5,row:1,w:4,h:1},slot_3:{col:1,row:2,w:4,h:1},slot_4:{col:5,row:2,w:4,h:1}}},desktop:{columns:12,rows:2,blocks:{slot_1:{col:1,row:1,w:6,h:1},slot_2:{col:7,row:1,w:6,h:1},slot_3:{col:1,row:2,w:6,h:1},slot_4:{col:7,row:2,w:6,h:1}}}}},{id:`three-column`,name:`Three Columns`,description:`3x2 grid layout`,layout:{mobile:{columns:4,rows:6,blocks:{slot_1:{col:1,row:1,w:4,h:1},slot_2:{col:1,row:2,w:4,h:1},slot_3:{col:1,row:3,w:4,h:1},slot_4:{col:1,row:4,w:4,h:1},slot_5:{col:1,row:5,w:4,h:1},slot_6:{col:1,row:6,w:4,h:1}}},tablet:{columns:8,rows:3,blocks:{slot_1:{col:1,row:1,w:4,h:1},slot_2:{col:5,row:1,w:4,h:1},slot_3:{col:1,row:2,w:4,h:1},slot_4:{col:5,row:2,w:4,h:1},slot_5:{col:1,row:3,w:4,h:1},slot_6:{col:5,row:3,w:4,h:1}}},desktop:{columns:12,rows:2,blocks:{slot_1:{col:1,row:1,w:4,h:1},slot_2:{col:5,row:1,w:4,h:1},slot_3:{col:9,row:1,w:4,h:1},slot_4:{col:1,row:2,w:4,h:1},slot_5:{col:5,row:2,w:4,h:1},slot_6:{col:9,row:2,w:4,h:1}}}}},{id:`sidebar-content`,name:`Sidebar + Content`,description:`Sidebar with main content area`,layout:{mobile:{columns:4,rows:5,blocks:{slot_sidebar:{col:1,row:1,w:4,h:1},slot_content:{col:1,row:2,w:4,h:4}}},tablet:{columns:8,rows:4,blocks:{slot_sidebar:{col:1,row:1,w:2,h:4},slot_content:{col:3,row:1,w:6,h:4}}},desktop:{columns:12,rows:4,blocks:{slot_sidebar:{col:1,row:1,w:3,h:4},slot_content:{col:4,row:1,w:9,h:4}}}}},{id:`form-layout`,name:`Form Layout`,description:`Common form with 6 fields`,layout:{mobile:{columns:4,rows:6,blocks:{slot_1:{col:1,row:1,w:4,h:1},slot_2:{col:1,row:2,w:4,h:1},slot_3:{col:1,row:3,w:4,h:1},slot_4:{col:1,row:4,w:4,h:1},slot_5:{col:1,row:5,w:4,h:1},slot_6:{col:1,row:6,w:4,h:1}}},tablet:{columns:8,rows:3,blocks:{slot_1:{col:1,row:1,w:4,h:1},slot_2:{col:5,row:1,w:4,h:1},slot_3:{col:1,row:2,w:4,h:1},slot_4:{col:5,row:2,w:4,h:1},slot_5:{col:1,row:3,w:4,h:1},slot_6:{col:5,row:3,w:4,h:1}}},desktop:{columns:12,rows:3,blocks:{slot_1:{col:1,row:1,w:6,h:1},slot_2:{col:7,row:1,w:6,h:1},slot_3:{col:1,row:2,w:6,h:1},slot_4:{col:7,row:2,w:6,h:1},slot_5:{col:1,row:3,w:6,h:1},slot_6:{col:7,row:3,w:6,h:1}}}}}];function NG(e){return MG.find(t=>t.id===e)}function PG(e){return e.startsWith(`slot_`)}function FG(e){return e===null?`null`:Array.isArray(e)?`array`:typeof e}function IG(e,t,n){let r=e.col+e.w-1,i=e.row+e.h-1;return Object.entries(t).some(([t,a])=>{if(n!==void 0&&t===String(n))return!1;let o=a.col+a.w-1,s=a.row+a.h-1,c=e.col<=o&&r>=a.col,l=e.row<=s&&i>=a.row;return c&&l})}function LG(e,t,n){for(let[r,i]of Object.entries(n)){let n=e>=i.col&&e<i.col+i.w,a=t>=i.row&&t<i.row+i.h;if(n&&a)return r}return null}function RG(e){let t=bG.flatMap(t=>Object.keys(e[t].blocks).map(e=>parseInt(e,10)).filter(e=>!isNaN(e)));return t.length>0?Math.max(...t)+1:0}function zG(e,t){return bG.some(n=>t[n].blocks[e]!==void 0)}function BG(e,t,n,r){let i=r[t],a=r[n],o=i.rows||12,s=a.rows||12,c=a.columns/i.columns,l=s/o,u=Math.max(1,Math.round((e.col-1)*c)+1),d=Math.max(1,Math.round((e.row-1)*l)+1),f=Math.max(1,Math.round(e.w*c)),p=Math.max(1,Math.round(e.h*l)),m=Math.min(u,a.columns),h=Math.min(d,s);return{col:m,row:h,w:Math.min(f,a.columns-m+1),h:Math.min(p,s-h+1)}}function VG(e,t,n,r,i){let a={...r};for(let o of bG){if(o===n||i.has(o))continue;let s=BG(t,n,o,r);a[o]={...a[o],blocks:{...a[o].blocks,[e]:s}}}return a}function HG(e,t,n){let r={...t};for(let t of bG){if(n.has(t))continue;let i=Object.fromEntries(Object.entries(r[t].blocks).filter(([t])=>t!==String(e)));r[t]={...r[t],blocks:i}}return r}function UG(e,t,n){let r={...t};for(let t of bG){if(n.has(t))continue;let i={...r[t].blocks};for(let t of e)delete i[t];r[t]={...r[t],blocks:i}}return r}function WG(e,t,n,r){let i={...n};for(let n of bG){if(r.has(n))continue;let a=i[n].blocks[e];if(a){let r=Object.fromEntries(Object.entries(i[n].blocks).filter(([t])=>t!==String(e)));i[n]={...i[n],blocks:{...r,[t]:a}}}}return i}function GG(e,t,n){let r={...e};r.col=Math.max(1,r.col),r.row=Math.max(1,r.row);let i=t-r.col+1;r.w=Math.min(r.w,i);let a=n-r.row+1;return r.h=Math.min(r.h,a),r}function KG(e,t,n){let r=e.col+e.w-1,i=e.row+e.h-1;return e.col>=1&&e.row>=1&&r<=t&&i<=n}function qG(e){return{mobile:{...e.mobile,blocks:{...e.mobile.blocks}},tablet:{...e.tablet,blocks:{...e.tablet.blocks}},desktop:{...e.desktop,blocks:{...e.desktop.blocks}}}}var JG=({initialLayout:e,onChange:t,dataModel:n,defaultViewMode:r=`visual`,showViewToggle:i=!0})=>{let[a,o]=(0,d.useState)(r),[s,c]=(0,d.useState)(``),[l,u]=(0,d.useState)([]),[f,p]=(0,d.useState)(!1),{state:m,setState:g,undo:_,redo:v,canUndo:y,canRedo:b}=oH(e||xG,{maxHistory:50,isEqual:(e,t)=>JSON.stringify(e)===JSON.stringify(t)}),[x,S]=(0,d.useState)(`desktop`),[C,w]=(0,d.useState)(new Set),[E,O]=(0,d.useState)(!1),[k,A]=(0,d.useState)(null),[j,M]=(0,d.useState)(null),[N,P]=(0,d.useState)(!1),[F,ee]=(0,d.useState)(null),[te,ne]=(0,d.useState)(!1),[re,I]=(0,d.useState)(null),[ie,ae]=(0,d.useState)(!1),[oe,se]=(0,d.useState)(null),[ce,le]=(0,d.useState)(null),[ue,de]=(0,d.useState)(!0),[fe,pe]=(0,d.useState)(new Set),[me,he]=(0,d.useState)(null),[L,ge]=(0,d.useState)({}),_e=(0,d.useRef)(null),R=m[x],ve=R.rows||12,ye=R.columns,be=fe.has(x),xe=jG(m);(0,d.useEffect)(()=>{f||(c(xe),u([]))},[xe]);let Se=(0,d.useCallback)(e=>{c(e),p(!0);let n=AG(e);if(n.errors.length>0)u(n.errors);else{u([]);let e=n.layout;g(e),t?.(e),p(!1)}},[g,t]),Ce=(0,d.useCallback)(()=>{c(jG(m)),u([]),p(!1)},[m]),we=e=>{g(e),t?.(e),p(!1)},Te=e=>{we({...m,[x]:{...m[x],...e}})},Ee=e=>{pe(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},De=e=>{let t=NG(e);if(!t)return;let n=qG(t.layout);he(e),ge({}),w(new Set),we(n)},Oe=()=>{he(null),ge({}),w(new Set),we(xG)},ke=()=>Object.keys(R.blocks).filter(PG),Ae=()=>{if(!n)return[];let e=new Set(Object.keys(R.blocks).filter(e=>!PG(e)));return Object.keys(n).filter(t=>!e.has(t))},je=(e,t)=>{ge({...L,[e]:t}),we(WG(e,t,m,fe)),w(new Set([t]))},Me=()=>{if(!n)return;let e=ke(),t=Ae();if(e.length===0||t.length===0)return;let r={...m},i={...L},a=t.slice(0,e.length);for(let t=0;t<a.length;t++){let n=a[t],o=e[t];i[o]=n,r=WG(o,n,r,fe)}ge(i),we(r)},Ne=(e,t)=>{if(be)return;let n=R.blocks[e];if(!n)return;let r=GG({...n,...t},ye,ve);IG(r,R.blocks,e)||Te({blocks:{...R.blocks,[e]:r}})},Pe=e=>{be||(ue?we(HG(e,m,fe)):Te({blocks:Object.fromEntries(Object.entries(R.blocks).filter(([t])=>t!==String(e)))}),w(new Set))},Fe=()=>{if(!(be||C.size===0)){if(ue)we(UG(C,m,fe));else{let e={...R.blocks};for(let t of C)delete e[t];Te({blocks:e})}w(new Set)}},Ie=(e,t)=>{if(!(e===t||be)&&!zG(t,m)){if(ue)we(WG(e,t,m,fe));else{let n=R.blocks[e];Te({blocks:{...Object.fromEntries(Object.entries(R.blocks).filter(([t])=>t!==String(e))),[t]:n}})}w(new Set([String(t)]))}},Le=(0,d.useRef)(Fe);(0,d.useEffect)(()=>{Le.current=Fe});let Re=()=>{let e=document.activeElement;if(!e)return!1;let t=e.tagName.toLowerCase();return t===`input`||t===`textarea`||e.getAttribute(`contenteditable`)===`true`},{register:ze,activate:Be,deactivate:Ve}=UW({scope:`component`}),{register:He,activate:Ue,deactivate:We}=UW({scope:`component`}),Ge=(0,d.useRef)(()=>{}),Ke=(0,d.useRef)(()=>{});(0,d.useEffect)(()=>{ze(`ctrl+z`,{name:`Undo`,action:()=>_()}),ze(`ctrl+shift+z`,{name:`Redo`,action:()=>v()}),ze(`ctrl+y`,{name:`Redo`,action:()=>v()}),ze(`cmd+delete`,{name:`Delete Selected`,action:()=>{Re()||Le.current()}})},[ze,_,v]),(0,d.useEffect)(()=>{He(`ctrl+shift+f`,{name:`Format JSON`,action:()=>Ge.current()}),He(`ctrl+shift+c`,{name:`Copy JSON`,action:()=>Ke.current()}),He(`ctrl+shift+r`,{name:`Reset JSON`,action:()=>Ce()})},[He,Ce]);let qe=e=>{if(!_e.current)return null;let t=_e.current.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top,i=t.width/ye,a=t.height/ve,o=Math.floor(n/i)+1,s=Math.floor(r/a)+1;return{col:Math.max(1,Math.min(o,ye)),row:Math.max(1,Math.min(s,ve))}},Je=e=>{if(e.target.closest(`.${Q[`rst-layout-builder-block`]}`)||be)return;let t=qe(e);t&&(O(!0),A(t),M(t),w(new Set))},Ye=(e,t)=>{if(e.stopPropagation(),be)return;let n=R.blocks[t];n&&(P(!0),ee(t),A({col:n.col,row:n.row}),M({col:n.col+n.w-1,row:n.row+n.h-1}))},Xe=(e,t)=>{if(e.stopPropagation(),be)return;let n=e.target.closest(`.${Q[`rst-layout-builder-block-controls`]}`),r=e.target.closest(`.${Q[`rst-layout-builder-resize-handle`]}`);if(n||r||!R.blocks[t])return;let i=qe(e);i&&(ne(!0),I(t),A(i),M(i),w(new Set([String(t)])))},Ze=e=>{if(!(E||N||te)||!k)return;let t=qe(e);t&&M(t)},Qe=()=>{if(be){$e();return}E&&k&&j?et():N&&F&&k&&j?tt():te&&re&&k&&j&&nt(),$e()},$e=()=>{O(!1),P(!1),ne(!1),ee(null),I(null),A(null),M(null)},et=()=>{if(!k||!j)return;let e={col:Math.min(k.col,j.col),row:Math.min(k.row,j.row),w:Math.abs(k.col-j.col)+1,h:Math.abs(k.row-j.row)+1};if(!IG(e,R.blocks)){let t=RG(m);if(ue){let n=VG(t,e,x,m,fe);n[x]={...n[x],blocks:{...n[x].blocks,[t]:e}},we(n)}else Te({blocks:{...R.blocks,[t]:e}});w(new Set([String(t)]))}},tt=()=>{if(!k||!j||!F)return;let e=Math.max(1,j.col-k.col+1),t=Math.max(1,j.row-k.row+1),n={col:k.col,row:k.row,w:e,h:t};IG(n,R.blocks,F)||Te({blocks:{...R.blocks,[F]:n}})},nt=()=>{if(!k||!j||!re)return;let e=R.blocks[re];if(!e)return;let t=j.col-k.col,n=j.row-k.row,r=e.col+t,i=e.row+n,a={...e,col:r,row:i},o=KG(a,ye,ve),s=IG(a,R.blocks,re);o&&!s&&Te({blocks:{...R.blocks,[re]:a}})},rt=(e,t)=>{e.stopPropagation(),e.shiftKey?w(e=>{let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n}):w(new Set([t]))},it=e=>C.has(e),at=C.size>0?Array.from(C)[0]:null,ot=e=>Object.keys(R.blocks).includes(e),st=(e,t)=>{if(ot(t)){e.preventDefault();return}ae(!0),se(t);let{dataTransfer:n}=e;n.setData(`text/plain`,t),n.effectAllowed=`copy`},ct=()=>{ae(!1),se(null),le(null)},lt=e=>{if(!ie)return;e.preventDefault();let{dataTransfer:t}=e;t.dropEffect=`copy`;let n=qe(e);n&&le(n)},ut=()=>{le(null)},dt=e=>{if(e.preventDefault(),be||!ie||!oe||!ce){ct();return}let t=LG(ce.col,ce.row,R.blocks);if(t&&PG(t)){je(t,oe),ct();return}let n={col:ce.col,row:ce.row,w:Math.min(yG.width,ye-ce.col+1),h:Math.min(yG.height,ve-ce.row+1)};if(!IG(n,R.blocks)){if(ue){let e=VG(oe,n,x,m,fe);e[x]={...e[x],blocks:{...e[x].blocks,[oe]:n}},we(e)}else Te({blocks:{...R.blocks,[oe]:n}});w(new Set([oe]))}ct()},ft=()=>{let e=[];for(let t=1;t<=ve;t++)for(let n=1;n<=ye;n++)e.push((0,h.jsx)(`div`,{className:Q[`rst-layout-builder-cell`],style:{gridColumn:n,gridRow:t}},`${t}-${n}`));return e},pt=()=>{if(!(E||N||te)||!k||!j)return null;let e,t,n,r;if(N)e=k.col,t=k.row,n=Math.max(1,j.col-e+1),r=Math.max(1,j.row-t+1);else if(te&&re){let i=R.blocks[re];if(!i)return null;let a=j.col-k.col,o=j.row-k.row;e=i.col+a,t=i.row+o,n=i.w,r=i.h}else e=Math.min(k.col,j.col),t=Math.min(k.row,j.row),n=Math.abs(k.col-j.col)+1,r=Math.abs(k.row-j.row)+1;return(0,h.jsx)(`div`,{className:Q[`rst-layout-builder-ghost`],style:{gridColumn:`${e} / span ${n}`,gridRow:`${t} / span ${r}`}})},mt=()=>{if(!ie||!ce||!oe)return null;let e=LG(ce.col,ce.row,R.blocks);if(e&&PG(e)&&e){let t=R.blocks[e];return(0,h.jsx)(`div`,{className:Q[`rst-layout-builder-drop-indicator`],style:{gridColumn:`${t.col} / span ${t.w}`,gridRow:`${t.row} / span ${t.h}`},children:(0,h.jsxs)(`span`,{className:Q[`rst-layout-builder-drop-indicator-label`],children:[`Drop into `,e]})})}let t=Math.min(yG.width,ye-ce.col+1),n=Math.min(yG.height,ve-ce.row+1),r=IG({col:ce.col,row:ce.row,w:t,h:n},R.blocks);return(0,h.jsx)(`div`,{className:Q[`rst-layout-builder-drop-indicator`],style:{gridColumn:`${ce.col} / span ${t}`,gridRow:`${ce.row} / span ${n}`,backgroundColor:r?`rgba(244, 67, 54, 0.3)`:void 0,borderColor:r?`#f44336`:void 0},children:(0,h.jsx)(`span`,{className:Q[`rst-layout-builder-drop-indicator-label`],style:{backgroundColor:r?`#f44336`:void 0},children:r?`Occupied`:oe})})},ht=()=>{if(!n)return null;let e=Object.entries(n);return(0,h.jsxs)(`div`,{className:Q[`rst-layout-builder-field-palette`],children:[(0,h.jsx)(T,{variant:`body`,className:Q[`rst-layout-builder-field-palette-title`],children:`Available Fields`}),(0,h.jsx)(`div`,{className:Q[`rst-layout-builder-field-list`],children:e.map(([e,t])=>{let n=ot(e),r=oe===e;return(0,h.jsxs)(`div`,{className:`${Q[`rst-layout-builder-field-item`]} ${n?Q[`rst-layout-builder-field-item-used`]:``} ${r?Q[`rst-layout-builder-field-item-dragging`]:``}`,draggable:!n,onDragStart:t=>st(t,e),onDragEnd:ct,children:[(0,h.jsx)(T,{variant:`body`,children:e}),(0,h.jsxs)(T,{variant:`caption`,children:[FG(t),n&&` • In use`]})]},e)})})]})},gt=()=>i?(0,h.jsx)(WH,{onChange:e=>o(e),value:a,options:[{value:`visual`,id:`visual`},{value:`split`,id:`split`},{value:`json`,id:`json`}]}):null,_t=()=>(0,h.jsxs)(`div`,{className:Q[`rst-layout-builder-content`],onFocus:Be,onBlur:Ve,onMouseEnter:Be,onMouseLeave:Ve,tabIndex:0,children:[(0,h.jsx)(`div`,{className:`${Q[`rst-layout-builder-grid-container`]} ${n?Q[`rst-layout-builder-grid-container-with-palette`]:``} ${be?Q[`rst-layout-builder-grid-locked`]:``}`,children:(0,h.jsxs)(`div`,{ref:_e,className:Q[`rst-layout-builder-grid`],style:{gridTemplateColumns:`repeat(${ye}, 1fr)`,gridTemplateRows:`repeat(${ve}, 1fr)`},onMouseDown:Je,onMouseMove:Ze,onMouseUp:Qe,onMouseLeave:Qe,onDragOver:lt,onDragLeave:ut,onDrop:dt,children:[(0,h.jsx)(`div`,{className:Q[`rst-layout-builder-grid-overlay`],style:{gridTemplateColumns:`repeat(${ye}, 1fr)`,gridTemplateRows:`repeat(${ve}, 1fr)`},children:ft()}),pt(),mt(),Object.entries(R.blocks).map(([e,t])=>{let n=it(e),r=n&&C.size===1,i=PG(e);return(0,h.jsxs)(`div`,{className:`${Q[`rst-layout-builder-block`]} ${n?Q[`rst-layout-builder-block-selected`]:``} ${i?Q[`rst-layout-builder-block-slot`]:``}`,style:{gridColumn:`${t.col} / span ${t.w}`,gridRow:`${t.row} / span ${t.h}`},onClick:t=>rt(t,e),onMouseDown:t=>{t.shiftKey||Xe(t,e)},onDragOver:e=>{ie&&i&&(e.preventDefault(),e.stopPropagation())},onDrop:t=>{ie&&i&&oe&&(t.preventDefault(),t.stopPropagation(),je(e,oe),ct())},tabIndex:0,children:[(0,h.jsx)(T,{variant:`caption`,className:Q[`rst-layout-builder-block-dimensions`],children:i?`📦 ${e}`:e}),i&&(0,h.jsx)(T,{variant:`caption`,className:Q[`rst-layout-builder-slot-hint`],children:`Drop field here`}),r&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`div`,{className:Q[`rst-layout-builder-block-controls`],children:[(0,h.jsx)(D,{value:`W-`,size:`small`,onClick:n=>{n.stopPropagation(),Ne(e,{w:t.w-1})}}),(0,h.jsx)(D,{value:`W+`,size:`small`,onClick:n=>{n.stopPropagation(),Ne(e,{w:t.w+1})}}),(0,h.jsx)(D,{value:`H-`,size:`small`,onClick:n=>{n.stopPropagation(),Ne(e,{h:t.h-1})}}),(0,h.jsx)(D,{value:`H+`,size:`small`,onClick:n=>{n.stopPropagation(),Ne(e,{h:t.h+1})}})]}),(0,h.jsx)(`div`,{className:`${Q[`rst-layout-builder-resize-handle`]} ${Q[`rst-layout-builder-resize-handle-se`]}`,onMouseDown:t=>Ye(t,e)})]})]},e)})]})}),ht()]}),vt=()=>(Ge.current=()=>{try{let e=JSON.parse(s),t=JSON.stringify(e,null,2);c(t),Se(t)}catch{}},Ke.current=async()=>{try{await navigator.clipboard.writeText(s)}catch{}},(0,h.jsx)(gG,{value:s,onChange:Se,errors:l,onActivate:Ue,onDeactivate:We}));return(0,h.jsxs)(`div`,{className:Q[`rst-layout-builder`],tabIndex:0,children:[(0,h.jsxs)(`div`,{className:Q[`rst-layout-builder-navbar`],children:[gt(),a!==`json`&&(0,h.jsxs)(`div`,{className:Q[`rst-layout-builder-group`],children:[(0,h.jsx)(T,{variant:`body`,children:`Template:`}),(0,h.jsx)(SV,{value:me||``,onChange:e=>e&&De(e),options:[...MG.map(e=>({value:e.id,label:`${e.name} - ${e.description}`}))]}),me&&(0,h.jsx)(D,{value:`Clear`,size:`small`,variant:`base`,onClick:Oe})]}),(0,h.jsxs)(`div`,{className:Q[`rst-layout-builder-group`],children:[(0,h.jsx)(D,{value:``,leadingVisual:`arrow-left`,size:`small`,variant:`base`,onClick:_,disabled:!y,title:`Undo (Cmd/Ctrl+Z)`}),(0,h.jsx)(D,{value:``,leadingVisual:`arrow-right`,size:`small`,variant:`base`,onClick:v,disabled:!b,title:`Redo (Cmd/Ctrl+Shift+Z)`})]})]}),(0,h.jsxs)(`div`,{className:Q[`rst-layout-builder-content-wrapper`],children:[a===`visual`&&_t(),a===`json`&&vt(),a===`split`&&(0,h.jsxs)(`div`,{className:hG[`rst-split-view`],children:[(0,h.jsx)(`div`,{className:hG[`rst-split-view-panel`],children:_t()}),(0,h.jsx)(`div`,{className:hG[`rst-split-view-divider`]}),(0,h.jsx)(`div`,{className:hG[`rst-split-view-panel`],children:vt()})]})]}),(0,h.jsxs)(`div`,{className:Q[`rst-layout-builder-footer`],children:[n&&a!==`json`&&(0,h.jsx)(`div`,{className:Q[`rst-layout-builder-group`],children:(0,h.jsx)(D,{value:`Auto-place (${Ae().length} fields, ${ke().length} slots)`,size:`small`,variant:`primary`,leadingVisual:`sparkle`,onClick:Me,disabled:ke().length===0||Ae().length===0})}),(0,h.jsxs)(`div`,{className:Q[`rst-layout-builder-group`],children:[(0,h.jsxs)(`label`,{className:Q[`rst-layout-builder-label`],children:[(0,h.jsx)(T,{variant:`body`,children:`Cols:`}),(0,h.jsx)(MV,{min:1,max:24,value:ye,onChange:e=>Te({columns:e||1})})]}),(0,h.jsxs)(`label`,{className:Q[`rst-layout-builder-label`],children:[(0,h.jsx)(T,{variant:`body`,children:`Rows:`}),(0,h.jsx)(MV,{min:1,max:100,value:ve,onChange:e=>Te({rows:e||1})})]})]}),(0,h.jsxs)(`div`,{className:Q[`rst-layout-builder-group`],children:[(0,h.jsx)(T,{variant:`body`,children:`Breakpoint:`}),(0,h.jsx)(WH,{onChange:e=>S(e),value:x,defaultValue:`desktop`,options:bG.map(e=>({value:e,id:e,leadingVisual:fe.has(e)?`lock`:void 0}))}),(0,h.jsx)(D,{value:fe.has(x)?`Unlock`:`Lock`,variant:fe.has(x)?`primary`:`base`,leadingVisual:fe.has(x)?`lock`:`lock-open`,size:`small`,onClick:()=>Ee(x)})]}),(0,h.jsxs)(`div`,{className:Q[`rst-layout-builder-group`],children:[(0,h.jsx)(T,{variant:`body`,children:`Sync:`}),(0,h.jsx)(D,{value:ue?`On`:`Off`,variant:ue?`primary`:`base`,leadingVisual:ue?`link`:`link-off`,size:`small`,onClick:()=>de(!ue)})]}),a!==`visual`&&(0,h.jsxs)(`div`,{className:Q[`rst-layout-builder-group`],children:[l.length===0?(0,h.jsx)(T,{variant:`caption`,style:{color:`var(--rst-color-success, #22c55e)`},children:`✓ JSON Valid`}):(0,h.jsxs)(T,{variant:`caption`,style:{color:`var(--rst-color-danger, #ef4444)`},children:[`✗ `,l.length,` error`,l.length===1?``:`s`]}),f&&l.length>0&&(0,h.jsx)(D,{value:`Reset`,size:`small`,variant:`base`,onClick:Ce,title:`Reset to last valid state`})]}),C.size>0&&(0,h.jsx)(`div`,{className:Q[`rst-layout-builder-group`],children:C.size===1&&at?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(T,{variant:`body`,children:`Block:`}),(0,h.jsx)(vV,{value:String(at),onChange:e=>Ie(at,e)}),(0,h.jsxs)(T,{variant:`caption`,style:{marginLeft:`0.5rem`,color:`var(--rst-color-text-subtle, #666)`},children:[R.blocks[at]?.w,` x `,R.blocks[at]?.h]}),(0,h.jsx)(D,{value:`Delete`,onClick:()=>Pe(at)})]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(T,{variant:`body`,children:[C.size,` blocks selected`]}),(0,h.jsx)(D,{value:`Delete ${C.size}`,variant:`danger`,onClick:Fe})]})})]})]})},YG={"rst-file-upload":`_rst-file-upload_thtch_1`,"rst-file-upload-dropzone":`_rst-file-upload-dropzone_thtch_8`,"rst-file-upload-dropzone-active":`_rst-file-upload-dropzone-active_thtch_23`,"rst-file-upload-dropzone-error":`_rst-file-upload-dropzone-error_thtch_28`,"rst-file-upload-header":`_rst-file-upload-header_thtch_33`,"rst-file-upload-tags":`_rst-file-upload-tags_thtch_40`,"rst-file-upload-files":`_rst-file-upload-files_thtch_47`,"rst-file-upload-file-item":`_rst-file-upload-file-item_thtch_53`,"rst-file-upload-file-info":`_rst-file-upload-file-info_thtch_63`,"rst-file-upload-hidden-input":`_rst-file-upload-hidden-input_thtch_69`},XG=(e,t=0)=>{if(e===0)return`0 Bytes`;let n=1024,r=t<0?0:t,i=[`Bytes`,`KB`,`MB`,`GB`,`TB`,`PB`,`EB`,`ZB`,`YB`],a=Math.floor(Math.log(e)/Math.log(n));return parseFloat((e/n**+a).toFixed(r))+` `+i[a]},ZG=({title:e=`Upload files`,acceptedFileTypes:t=[],maxFileSize:n,maxFiles:r,onFilesChange:i,trigger:a,state:o=`base`,icon:s=`arrow-up`,className:c,...l})=>{let[u,f]=(0,d.useState)([]),[p,m]=(0,d.useState)(!1),[g,_]=(0,d.useState)(null),v=(0,d.useRef)(null),y=e=>{e.preventDefault(),e.stopPropagation(),m(!0)},x=e=>{e.preventDefault(),e.stopPropagation(),m(!1)},S=e=>{e.preventDefault(),e.stopPropagation(),m(!0)},C=e=>{if(n&&e.size>n)return`File ${e.name} is too large. Max size is ${n} bytes.`;if(t.length>0){let n=`.`+e.name.split(`.`).pop()?.toLowerCase();if(!t.includes(n))return`File ${e.name} has invalid type. Accepted types: ${t.join(`, `)}`}return null},w=e=>{e.preventDefault(),e.stopPropagation(),m(!1),_(null),k(Array.from(e.dataTransfer.files))},O=e=>{e.target.files&&k(Array.from(e.target.files))},k=e=>{let t=[],n=[];if(r&&u.length+e.length>r){_(`You can only upload a maximum of ${r} files.`);return}if(e.forEach(e=>{let r=C(e);r?n.push(r):t.push(e)}),n.length>0&&_(n[0]),t.length>0){let e=[...u,...t];f(e),i?.(e)}},A=e=>{let t=u.filter((t,n)=>n!==e);f(t),i?.(t)},j=()=>{v.current?.click()},M=[YG[`rst-file-upload-dropzone`],p?YG[`rst-file-upload-dropzone-active`]:``,g||o===`danger`?YG[`rst-file-upload-dropzone-error`]:``].filter(Boolean).join(` `);return(0,h.jsxs)(`div`,{className:`${YG[`rst-file-upload`]} ${c||``}`,...l,children:[(0,h.jsxs)(`div`,{className:M,onDragEnter:y,onDragLeave:x,onDragOver:S,onDrop:w,onClick:j,children:[(0,h.jsx)(`input`,{type:`file`,ref:v,className:YG[`rst-file-upload-hidden-input`],multiple:r!==1,accept:t.join(`,`),onChange:O}),(0,h.jsxs)(`div`,{className:YG[`rst-file-upload-header`],children:[(0,h.jsx)(sB,{src:s,size:`large`}),(0,h.jsx)(T,{variant:`heading`,children:e})]}),t.length>0&&(0,h.jsx)(`div`,{className:YG[`rst-file-upload-tags`],children:t.map(e=>(0,h.jsx)(E,{value:e,state:`base`},e))}),(n||r)&&(0,h.jsx)(T,{variant:`caption`,children:[n?`Maximum file size: ${XG(n)}`:null,r?`Maximum files: ${r}`:null].filter(Boolean).join(` • `)}),a?(0,h.jsx)(`div`,{onClick:e=>{e.stopPropagation(),j()},children:a}):(0,h.jsx)(T,{variant:`caption`,children:`Drag & drop files here or click to browse`})]}),g&&(0,h.jsx)(T,{variant:`caption`,color:`var(--rst-color-error-600)`,children:g}),u.length>0&&(0,h.jsx)(`div`,{className:YG[`rst-file-upload-files`],children:u.map((e,t)=>(0,h.jsxs)(`div`,{className:YG[`rst-file-upload-file-item`],children:[(0,h.jsxs)(`div`,{className:YG[`rst-file-upload-file-info`],children:[(0,h.jsx)(b,{src:`document-outline`}),(0,h.jsx)(T,{variant:`body`,children:e.name}),(0,h.jsxs)(T,{variant:`caption`,color:`var(--rst-color-gray-500)`,children:[`(`,(e.size/1024).toFixed(1),` KB)`]})]}),(0,h.jsx)(D,{leadingVisual:`delete`,variant:`invisible`,size:`small`,onClick:e=>{e.stopPropagation(),A(t)},"aria-label":`Remove file`})]},`${e.name}-${t}`))})]})},QG={"rst-workflow-node":`_rst-workflow-node_1sk0t_2`,"rst-workflow-node-header":`_rst-workflow-node-header_1sk0t_20`,"rst-workflow-node-title":`_rst-workflow-node-title_1sk0t_27`,"rst-workflow-node-content":`_rst-workflow-node-content_1sk0t_34`,"rst-workflow-node-empty":`_rst-workflow-node-empty_1sk0t_38`,"rst-workflow-node-footer":`_rst-workflow-node-footer_1sk0t_47`,"rst-workflow-node-metadata":`_rst-workflow-node-metadata_1sk0t_56`};function $G({node:e,onClick:t,className:n}){let r=()=>{t&&t(e)};return(0,h.jsxs)(`div`,{className:[QG[`rst-workflow-node`],n,e.className].filter(Boolean).join(` `),style:{left:`${e.x}px`,top:`${e.y}px`},onClick:r,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),r())},role:`button`,tabIndex:0,"aria-label":`Workflow node: ${e.label}`,children:[(0,h.jsxs)(`div`,{className:QG[`rst-workflow-node-header`],children:[e.icon&&(0,h.jsx)(b,{src:e.icon}),(0,h.jsx)(T,{variant:`title`,children:e.label})]}),e.description&&(0,h.jsx)(`div`,{className:QG[`rst-workflow-node-content`],children:(0,h.jsx)(T,{variant:`body`,children:e.description})}),e.metadata&&Object.keys(e.metadata).length>0&&(0,h.jsx)(`div`,{className:QG[`rst-workflow-node-footer`],children:Object.entries(e.metadata).map(([e,t])=>(0,h.jsxs)(`span`,{className:QG[`rst-workflow-node-metadata`],children:[e,`: `,String(t)]},e))})]})}var eK={direction:`TB`,nodeSpacingX:120,nodeSpacingY:100,nodeWidth:300,nodeHeight:75,padding:50};function tK(e,t){let n=new Map,r=new Set,i=new Map;e.forEach(e=>{i.set(e.id,0)}),t.forEach(e=>{let t=i.get(e.target)||0;i.set(e.target,t+1)});let a=[];for(e.forEach(e=>{i.get(e.id)===0&&(a.push(e.id),n.set(e.id,0))});a.length>0;){let e=a.shift();r.add(e);let o=n.get(e)||0;t.filter(t=>t.source===e).map(e=>e.target).forEach(e=>{let t=i.get(e)-1;i.set(e,t);let s=o+1,c=n.get(e)||0;n.set(e,Math.max(c,s)),t===0&&!r.has(e)&&a.push(e)})}return n}function nK(e,t,n){let r={...eK,...n},i=tK(e,t),a=new Map;e.forEach(e=>{let t=i.get(e.id)||0;a.has(t)||a.set(t,[]),a.get(t).push(e)});let o=[];return a.forEach((e,t)=>{e.forEach((e,n)=>{let i,a;r.direction===`TB`?(a=r.padding+t*(r.nodeHeight+r.nodeSpacingY),i=r.padding+n*(r.nodeWidth+r.nodeSpacingX)):(i=r.padding+t*(r.nodeWidth+r.nodeSpacingX),a=r.padding+n*(r.nodeHeight+r.nodeSpacingY)),o.push({...e,x:i,y:a,level:t})})}),rK(o,r)}function rK(e,t){let n=new Map;e.forEach(e=>{n.has(e.level)||n.set(e.level,[]),n.get(e.level).push(e)});let r=0;n.forEach(e=>{r=Math.max(r,e.length)});let i=t.direction===`TB`?r*(t.nodeWidth+t.nodeSpacingX)-t.nodeSpacingX:r*(t.nodeHeight+t.nodeSpacingY)-t.nodeSpacingY;return n.forEach(e=>{let n=(i-(t.direction===`TB`?e.length*(t.nodeWidth+t.nodeSpacingX)-t.nodeSpacingX:e.length*(t.nodeHeight+t.nodeSpacingY)-t.nodeSpacingY))/2;e.forEach(e=>{t.direction===`TB`?e.x+=n:e.y+=n})}),e}function iK(e,t,n){let{x:r,y:i}=e,{nodeWidth:a,nodeHeight:o}=n;switch(t){case`top`:return{x:r+a/2,y:i,side:t};case`right`:return{x:r+a,y:i+o/2,side:t};case`bottom`:return{x:r+a/2,y:i+o,side:t};case`left`:return{x:r,y:i+o/2,side:t}}}function aK(e,t,n){return n.direction===`TB`?t.level>e.level?{sourceSide:`bottom`,targetSide:`top`}:t.level<e.level?{sourceSide:`top`,targetSide:`bottom`}:t.x>e.x?{sourceSide:`right`,targetSide:`left`}:{sourceSide:`left`,targetSide:`right`}:t.level>e.level?{sourceSide:`right`,targetSide:`left`}:t.level<e.level?{sourceSide:`left`,targetSide:`right`}:t.y>e.y?{sourceSide:`bottom`,targetSide:`top`}:{sourceSide:`top`,targetSide:`bottom`}}function oK(e,t){let n=Math.abs(t.x-e.x),r=Math.abs(t.y-e.y),i=Math.sqrt(n*n+r*r),a=Math.max(50,i*.4),o=e.x,s=e.y,c=t.x,l=t.y;switch(e.side){case`right`:o=e.x+a;break;case`left`:o=e.x-a;break;case`bottom`:s=e.y+a;break;case`top`:s=e.y-a;break}switch(t.side){case`right`:c=t.x+a;break;case`left`:c=t.x-a;break;case`bottom`:l=t.y+a;break;case`top`:l=t.y-a;break}return`M ${e.x},${e.y} C ${o},${s} ${c},${l} ${t.x},${t.y}`}function sK(e,t){if(e.length===0)return{width:0,height:0};let n=0,r=0;return e.forEach(e=>{n=Math.max(n,e.x+t.nodeWidth),r=Math.max(r,e.y+t.nodeHeight)}),{width:n+t.padding,height:r+t.padding}}var cK={"rst-workflow-edges":`_rst-workflow-edges_d1kor_1`,"rst-workflow-edge":`_rst-workflow-edge_d1kor_1`,"rst-workflow-edge-path":`_rst-workflow-edge-path_d1kor_18`,"rst-workflow-edge-hitbox":`_rst-workflow-edge-hitbox_d1kor_32`,"rst-workflow-edge-endpoint-start":`_rst-workflow-edge-endpoint-start_d1kor_39`,"rst-workflow-edge-endpoint-end":`_rst-workflow-edge-endpoint-end_d1kor_49`,"rst-workflow-edge-label-bg":`_rst-workflow-edge-label-bg_d1kor_67`,"rst-workflow-edge-label":`_rst-workflow-edge-label_d1kor_67`,"rst-workflow-edge-default":`_rst-workflow-edge-default_d1kor_80`,"rst-workflow-edge-conditional":`_rst-workflow-edge-conditional_d1kor_84`,"rst-workflow-edge-error":`_rst-workflow-edge-error_d1kor_89`,"rst-workflow-edge-success":`_rst-workflow-edge-success_d1kor_93`,"rst-workflow-edge-timeout":`_rst-workflow-edge-timeout_d1kor_97`};function lK({edge:e,sourceNode:t,targetNode:n,layout:r,onClick:i,className:a}){let{sourceSide:o,targetSide:s}=aK(t,n,r),c=iK(t,o,r),l=iK(n,s,r),u=oK(c,l),d=(c.x+l.x)/2,f=(c.y+l.y)/2,p=cK[`rst-workflow-edge-${e.type||`default`}`],m=()=>{i&&i(e)};return(0,h.jsxs)(`g`,{className:[cK[`rst-workflow-edge`],p,a,e.className].filter(Boolean).join(` `),onClick:m,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),m())},role:`button`,tabIndex:0,"aria-label":`Connection from ${t.label} to ${n.label}${e.type?` (${e.type})`:``}`,children:[(0,h.jsx)(`path`,{d:u,className:cK[`rst-workflow-edge-path`],fill:`none`}),(0,h.jsx)(`path`,{d:u,className:cK[`rst-workflow-edge-hitbox`],fill:`none`,strokeWidth:`20`,stroke:`transparent`,pointerEvents:`stroke`}),(0,h.jsx)(`circle`,{cx:c.x,cy:c.y,r:`4`,className:cK[`rst-workflow-edge-endpoint-start`]}),(0,h.jsx)(`circle`,{cx:l.x,cy:l.y,r:`4`,className:cK[`rst-workflow-edge-endpoint-end`]}),e.label&&(0,h.jsxs)(`g`,{children:[(0,h.jsx)(`rect`,{x:d-30,y:f-12,width:`60`,height:`24`,rx:`4`,className:cK[`rst-workflow-edge-label-bg`]}),(0,h.jsx)(`text`,{x:d,y:f,textAnchor:`middle`,dominantBaseline:`middle`,className:cK[`rst-workflow-edge-label`],children:e.label})]})]})}var uK={"rst-workflow-toolbar":`_rst-workflow-toolbar_1vjr0_2`,"rst-workflow-toolbar-divider":`_rst-workflow-toolbar-divider_1vjr0_18`};function dK({mode:e,onModeChange:t,zoom:n,onZoomChange:r,minZoom:i=.1,maxZoom:a=2,className:o}){let s=()=>{let e=Math.min(n+.1,a);r(Number(e.toFixed(1)))},c=()=>{let e=Math.max(n-.1,i);r(Number(e.toFixed(1)))},l=()=>{r(1)},u=Math.round(n*100);return(0,h.jsxs)(`div`,{className:[uK[`rst-workflow-toolbar`],o].filter(Boolean).join(` `),children:[(0,h.jsx)(D,{variant:e===`pointer`?`primary`:`base`,size:`small`,leadingVisual:`cursor`,onClick:()=>t(`pointer`),"aria-label":`Pointer mode`,title:`Pointer mode - Select and interact with nodes`,children:`Pointer`}),(0,h.jsx)(D,{variant:e===`drag`?`primary`:`base`,size:`small`,leadingVisual:`drag`,onClick:()=>t(`drag`),"aria-label":`Drag mode`,title:`Drag mode - Pan the canvas`,children:`Drag`}),(0,h.jsx)(`div`,{className:uK[`rst-workflow-toolbar-divider`]}),(0,h.jsx)(D,{variant:`base`,size:`small`,leadingVisual:`zoom-minus`,onClick:c,disabled:n<=i,"aria-label":`Zoom out`,title:`Zoom out`}),(0,h.jsx)(D,{variant:`base`,size:`small`,onClick:l,"aria-label":`Reset zoom`,title:`Reset zoom to 100%`,value:`${u}%`}),(0,h.jsx)(D,{variant:`base`,size:`small`,leadingVisual:`zoom-plus`,onClick:s,disabled:n>=a,"aria-label":`Zoom in`,title:`Zoom in`})]})}var $={"rst-workflow-panel":`_rst-workflow-panel_1bnks_1`,"rst-workflow-panel-header":`_rst-workflow-panel-header_1bnks_18`,"rst-workflow-panel-badge":`_rst-workflow-panel-badge_1bnks_34`,"rst-workflow-panel-title":`_rst-workflow-panel-title_1bnks_46`,"rst-workflow-panel-close":`_rst-workflow-panel-close_1bnks_51`,"rst-workflow-panel-content":`_rst-workflow-panel-content_1bnks_71`,"rst-workflow-panel-section":`_rst-workflow-panel-section_1bnks_77`,"rst-workflow-panel-section-title":`_rst-workflow-panel-section-title_1bnks_81`,"rst-workflow-panel-next-step":`_rst-workflow-panel-next-step_1bnks_90`,"rst-workflow-panel-next-step-icon":`_rst-workflow-panel-next-step-icon_1bnks_112`,"rst-workflow-panel-next-step-text":`_rst-workflow-panel-next-step-text_1bnks_123`,"rst-workflow-panel-node-list":`_rst-workflow-panel-node-list_1bnks_128`,"rst-workflow-panel-node-item":`_rst-workflow-panel-node-item_1bnks_134`,"rst-workflow-panel-node-item-icon":`_rst-workflow-panel-node-item-icon_1bnks_151`,"rst-workflow-panel-node-item-label":`_rst-workflow-panel-node-item-label_1bnks_158`,"rst-workflow-panel-empty":`_rst-workflow-panel-empty_1bnks_163`,"rst-workflow-panel-divider":`_rst-workflow-panel-divider_1bnks_170`,"rst-workflow-panel-info":`_rst-workflow-panel-info_1bnks_176`,"rst-workflow-panel-info-row":`_rst-workflow-panel-info-row_1bnks_182`,"rst-workflow-panel-info-label":`_rst-workflow-panel-info-label_1bnks_188`,"rst-workflow-panel-info-value":`_rst-workflow-panel-info-value_1bnks_194`,"rst-workflow-panel-actions":`_rst-workflow-panel-actions_1bnks_201`,"rst-workflow-panel-action-item":`_rst-workflow-panel-action-item_1bnks_207`,"rst-workflow-panel-action-content":`_rst-workflow-panel-action-content_1bnks_217`,"rst-workflow-panel-action-name":`_rst-workflow-panel-action-name_1bnks_224`,"rst-workflow-panel-action-type":`_rst-workflow-panel-action-type_1bnks_230`,"rst-workflow-panel-connection-group":`_rst-workflow-panel-connection-group_1bnks_237`,"rst-workflow-panel-connection-label":`_rst-workflow-panel-connection-label_1bnks_243`,"rst-workflow-panel-connection-divider":`_rst-workflow-panel-connection-divider_1bnks_249`,"rst-workflow-panel-connection-info":`_rst-workflow-panel-connection-info_1bnks_259`,"rst-workflow-panel-node-button":`_rst-workflow-panel-node-button_1bnks_270`,"rst-workflow-panel-node-type":`_rst-workflow-panel-node-type_1bnks_294`,"rst-workflow-panel-advanced-toggle":`_rst-workflow-panel-advanced-toggle_1bnks_304`};function fK({selectedNode:e,allNodes:t,hasOutputs:n,onCreateNode:r,onConnectNode:i,onClose:a,className:o}){let[s,c]=(0,d.useState)(`default`),[l,u]=(0,d.useState)(!1);if(!e)return null;let f=t.filter(t=>t.id!==e.id),p=()=>{r(e.id)},m=t=>{i(e.id,t)},g=(()=>{let t=e.nodeType||`task`,n={start:{icon:`play`,label:`Start Node`,color:`var(--rst-borderColor-success-default)`},task:{icon:`check-circle`,label:`Task Node`,color:`var(--rst-borderColor-accent-default)`},decision:{icon:`git-branch`,label:`Decision Node`,color:`var(--rst-borderColor-attention-default)`},end:{icon:`check`,label:`End Node`,color:`var(--rst-borderColor-danger-default)`}};return n[t]||n.task})();return(0,h.jsxs)(`div`,{className:[$[`rst-workflow-panel`],o].filter(Boolean).join(` `),children:[(0,h.jsxs)(`div`,{className:$[`rst-workflow-panel-header`],children:[(0,h.jsxs)(`div`,{children:[(0,h.jsx)(T,{variant:`title`,className:$[`rst-workflow-panel-title`],children:e.label}),(0,h.jsxs)(`div`,{className:$[`rst-workflow-panel-badge`],style:{borderColor:g.color,color:g.color},children:[(0,h.jsx)(b,{src:g.icon}),(0,h.jsx)(`span`,{children:g.label})]})]}),(0,h.jsx)(`button`,{className:$[`rst-workflow-panel-close`],onClick:a,"aria-label":`Close panel`,type:`button`,children:(0,h.jsx)(b,{src:`close`})})]}),(0,h.jsxs)(`div`,{className:$[`rst-workflow-panel-content`],children:[(0,h.jsxs)(`div`,{className:$[`rst-workflow-panel-section`],children:[(0,h.jsxs)(`div`,{className:$[`rst-workflow-panel-section-title`],children:[(0,h.jsx)(b,{src:`info`}),`Node Information`]}),(0,h.jsxs)(`div`,{className:$[`rst-workflow-panel-info`],children:[(0,h.jsxs)(`div`,{className:$[`rst-workflow-panel-info-row`],children:[(0,h.jsx)(`span`,{className:$[`rst-workflow-panel-info-label`],children:`ID:`}),(0,h.jsx)(`span`,{className:$[`rst-workflow-panel-info-value`],children:e.id})]}),e.description&&(0,h.jsxs)(`div`,{className:$[`rst-workflow-panel-info-row`],children:[(0,h.jsx)(`span`,{className:$[`rst-workflow-panel-info-label`],children:`Description:`}),(0,h.jsx)(`span`,{className:$[`rst-workflow-panel-info-value`],children:e.description})]}),(0,h.jsxs)(`div`,{className:$[`rst-workflow-panel-info-row`],children:[(0,h.jsx)(`span`,{className:$[`rst-workflow-panel-info-label`],children:`Type:`}),(0,h.jsx)(`span`,{className:$[`rst-workflow-panel-info-value`],children:e.nodeType||`task`})]})]})]}),e.actions&&e.actions.length>0&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`div`,{className:$[`rst-workflow-panel-divider`]}),(0,h.jsxs)(`div`,{className:$[`rst-workflow-panel-section`],children:[(0,h.jsxs)(`div`,{className:$[`rst-workflow-panel-section-title`],children:[(0,h.jsx)(b,{src:`zap`}),`Actions (`,e.actions.length,`)`]}),(0,h.jsx)(`div`,{className:$[`rst-workflow-panel-actions`],children:e.actions.map(e=>(0,h.jsxs)(`div`,{className:$[`rst-workflow-panel-action-item`],children:[(0,h.jsx)(b,{src:pK(e.type)}),(0,h.jsxs)(`div`,{className:$[`rst-workflow-panel-action-content`],children:[(0,h.jsx)(`div`,{className:$[`rst-workflow-panel-action-name`],children:e.name}),(0,h.jsx)(`div`,{className:$[`rst-workflow-panel-action-type`],children:e.type})]})]},e.id))})]})]}),(0,h.jsx)(`div`,{className:$[`rst-workflow-panel-divider`]}),(0,h.jsxs)(`div`,{className:$[`rst-workflow-panel-section`],children:[(0,h.jsxs)(`div`,{className:$[`rst-workflow-panel-section-title`],children:[(0,h.jsx)(b,{src:`git-branch`}),`Connections`]}),n?(0,h.jsxs)(`div`,{className:$[`rst-workflow-panel-connection-info`],children:[(0,h.jsx)(b,{src:`check-circle`}),(0,h.jsx)(`span`,{children:`This node already has outgoing connections.`})]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`div`,{className:$[`rst-workflow-panel-connection-group`],children:[(0,h.jsx)(`div`,{className:$[`rst-workflow-panel-connection-label`],children:`Create & Connect New Node`}),(0,h.jsx)(D,{leadingVisual:`plus`,variant:`primary`,size:`small`,onClick:p,type:`button`,children:`Create Node`})]}),f.length>0&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`div`,{className:$[`rst-workflow-panel-connection-divider`],children:`OR`}),(0,h.jsxs)(`div`,{className:$[`rst-workflow-panel-connection-group`],children:[(0,h.jsx)(`div`,{className:$[`rst-workflow-panel-connection-label`],children:`Connect to Existing Node`}),(0,h.jsx)(SV,{value:s,onChange:e=>c(Array.isArray(e)?e[0]:e),options:[{value:`default`,id:`default`},{value:`conditional`,id:`conditional`},{value:`success`,id:`success`},{value:`error`,id:`error`},{value:`timeout`,id:`timeout`}]}),(0,h.jsx)(`div`,{className:$[`rst-workflow-panel-node-list`],children:f.map(e=>(0,h.jsxs)(`button`,{className:$[`rst-workflow-panel-node-button`],onClick:()=>m(e.id),type:`button`,children:[(0,h.jsx)(b,{src:e.icon||`file`}),(0,h.jsx)(`span`,{children:e.label}),e.nodeType&&(0,h.jsx)(`span`,{className:$[`rst-workflow-panel-node-type`],children:e.nodeType})]},e.id))})]})]})]})]}),(0,h.jsx)(`div`,{className:$[`rst-workflow-panel-divider`]}),(0,h.jsxs)(`button`,{className:$[`rst-workflow-panel-advanced-toggle`],onClick:()=>u(!l),type:`button`,children:[(0,h.jsx)(`span`,{children:`Advanced Settings`}),(0,h.jsx)(b,{src:l?`chevron-up`:`chevron-down`})]}),l&&(0,h.jsx)(`div`,{className:$[`rst-workflow-panel-section`],children:(0,h.jsxs)(`div`,{className:$[`rst-workflow-panel-info`],children:[(0,h.jsxs)(`div`,{className:$[`rst-workflow-panel-info-row`],children:[(0,h.jsx)(`span`,{className:$[`rst-workflow-panel-info-label`],children:`Data Records:`}),(0,h.jsx)(`span`,{className:$[`rst-workflow-panel-info-value`],children:e.data?.length||0})]}),(0,h.jsxs)(`div`,{className:$[`rst-workflow-panel-info-row`],children:[(0,h.jsx)(`span`,{className:$[`rst-workflow-panel-info-label`],children:`Columns:`}),(0,h.jsx)(`span`,{className:$[`rst-workflow-panel-info-value`],children:e.columns?.length||0})]}),e.metadata&&Object.keys(e.metadata).length>0&&(0,h.jsxs)(`div`,{className:$[`rst-workflow-panel-info-row`],children:[(0,h.jsx)(`span`,{className:$[`rst-workflow-panel-info-label`],children:`Metadata:`}),(0,h.jsxs)(`span`,{className:$[`rst-workflow-panel-info-value`],children:[Object.keys(e.metadata).length,` properties`]})]})]})})]})]})}function pK(e){return{api:`globe`,transform:`code`,wait:`clock`,notification:`bell`,condition:`git-branch`}[e]||`zap`}var mK={"rst-workflow":`_rst-workflow_3342o_2`,"rst-workflow-viewport":`_rst-workflow-viewport_3342o_12`,"rst-workflow-svg":`_rst-workflow-svg_3342o_20`,"rst-workflow-nodes":`_rst-workflow-nodes_3342o_29`,"rst-workflow-arrow":`_rst-workflow-arrow_3342o_37`,"rst-workflow-edge":`_rst-workflow-edge_3342o_42`};function hK({nodes:e,edges:t,layout:n,showToolbar:r=!0,showPanel:i=!0,defaultZoom:a=1,minZoom:o=.1,maxZoom:s=2,onNodeClick:c,onEdgeClick:l,onNodeCreate:u,onNodeConnect:f,className:p,...m}){let[g,_]=(0,d.useState)(`pointer`),[v,y]=(0,d.useState)(a),[b,x]=(0,d.useState)({x:0,y:0}),[S,C]=(0,d.useState)(!1),[w,T]=(0,d.useState)({x:0,y:0}),[E,D]=(0,d.useState)(null),O=(0,d.useRef)(null),k=(0,d.useMemo)(()=>({...eK,...n}),[n]),A=(0,d.useMemo)(()=>nK(e,t,k),[e,t,k]),{width:j,height:M}=(0,d.useMemo)(()=>sK(A,k),[A,k]),N=(0,d.useMemo)(()=>{let e=new Map;return A.forEach(t=>{e.set(t.id,t)}),e},[A]),P=(0,d.useMemo)(()=>E?t.some(e=>e.source===E.id):!1,[E,t]),F=e=>{D(e),c&&c(e)},ee=()=>{D(null)},te=e=>{u&&u(e)},ne=(e,t)=>{f&&f(e,t)},re=e=>{g===`drag`&&(C(!0),T({x:e.clientX-b.x,y:e.clientY-b.y}),O.current&&(O.current.style.cursor=`grabbing`))},I=e=>{S&&g===`drag`&&x({x:e.clientX-w.x,y:e.clientY-w.y})},ie=()=>{S&&(C(!1),O.current&&(O.current.style.cursor=g===`drag`?`grab`:`default`))},ae=()=>{S&&(C(!1),O.current&&(O.current.style.cursor=g===`drag`?`grab`:`default`))},oe=e=>{if(e.ctrlKey||e.metaKey){e.preventDefault();let t=e.deltaY>0?-.1:.1,n=Math.max(o,Math.min(s,v+t));y(Number(n.toFixed(1)))}},se=g===`drag`?S?`grabbing`:`grab`:`default`;return(0,h.jsxs)(`div`,{ref:O,className:[mK[`rst-workflow`],p].filter(Boolean).join(` `),onMouseDown:re,onMouseMove:I,onMouseUp:ie,onMouseLeave:ae,onWheel:oe,style:{cursor:se},...m,children:[r&&(0,h.jsx)(dK,{mode:g,onModeChange:_,zoom:v,onZoomChange:y,minZoom:o,maxZoom:s}),(0,h.jsxs)(`div`,{className:mK[`rst-workflow-viewport`],style:{transform:`translate(${b.x}px, ${b.y}px) scale(${v})`,transformOrigin:`0 0`},children:[(0,h.jsxs)(`svg`,{className:mK[`rst-workflow-svg`],width:j,height:M,xmlns:`http://www.w3.org/2000/svg`,children:[(0,h.jsx)(`defs`,{children:(0,h.jsx)(`marker`,{id:`arrowhead`,markerWidth:`10`,markerHeight:`10`,refX:`9`,refY:`3`,orient:`auto`,markerUnits:`strokeWidth`,children:(0,h.jsx)(`path`,{d:`M0,0 L0,6 L9,3 z`,className:mK[`rst-workflow-arrow`]})})}),(0,h.jsx)(`g`,{className:mK[`rst-workflow-edges`],children:t.map(e=>{let t=N.get(e.source),n=N.get(e.target);return!t||!n?(console.warn(`Edge ${e.id} references non-existent node(s): source=${e.source}, target=${e.target}`),null):(0,h.jsx)(lK,{edge:e,sourceNode:t,targetNode:n,layout:k,onClick:l},e.id)})})]}),(0,h.jsx)(`div`,{className:mK[`rst-workflow-nodes`],style:{width:`${j}px`,height:`${M}px`},children:A.map(e=>(0,h.jsx)($G,{node:e,onClick:F},e.id))})]}),i&&E&&(0,h.jsx)(fK,{selectedNode:E,allNodes:e,hasOutputs:P,onCreateNode:te,onConnectNode:ne,onClose:ee})]})}function gK(e,t){let n=[],r=[];return _K(e,t,new Map(e.map(e=>[e.id,e])),n),vK(e,t,n,r),yK(e,t,r),bK(e,t,n),xK(t,r),SK(t,r),{valid:n.length===0,errors:n,warnings:r}}function _K(e,t,n,r){for(let e of t)n.has(e.source)||r.push({type:`invalid-edge`,message:`Edge ${e.id} references non-existent source node: ${e.source}`,relatedIds:[e.id,e.source]}),n.has(e.target)||r.push({type:`invalid-edge`,message:`Edge ${e.id} references non-existent target node: ${e.target}`,relatedIds:[e.id,e.target]})}function vK(e,t,n,r){let i=e.filter(e=>e.nodeType===`start`),a=e.filter(e=>e.nodeType===`end`);if(i.length===0){let r=new Set(t.map(e=>e.target));e.filter(e=>!r.has(e.id)).length===0&&n.push({type:`missing-start`,message:`Workflow must have at least one start node or a node with no incoming edges`,relatedIds:[]})}else i.length>1&&r.push({type:`unreachable-node`,message:`Workflow has multiple start nodes (${i.length}). This may be intentional for parallel execution.`,relatedIds:i.map(e=>e.id)});if(a.length===0){let n=new Set(t.map(e=>e.source));e.filter(e=>!n.has(e.id)).length===0&&r.push({type:`dead-end`,message:`Workflow should have at least one end node or a node with no outgoing edges`,relatedIds:[]})}}function yK(e,t,n){let r=new Set;for(let e of t)r.add(e.source),r.add(e.target);let i=e.filter(e=>!r.has(e.id));i.length>0&&n.push({type:`orphaned-node`,message:`Found ${i.length} orphaned node(s) with no connections`,relatedIds:i.map(e=>e.id)})}function bK(e,t,n){let r=new Map;for(let t of e)r.set(t.id,[]);for(let e of t){let t=r.get(e.source)||[];t.push(e.target),r.set(e.source,t)}let i=new Set,a=new Set,o=[];function s(e,t){i.add(e),a.add(e),t.push(e);let n=r.get(e)||[];for(let e of n)if(!i.has(e))s(e,[...t]);else if(a.has(e)){let n=t.indexOf(e),r=t.slice(n);r.push(e),o.push(r)}a.delete(e)}for(let t of e)i.has(t.id)||s(t.id,[]);for(let e of o)n.push({type:`circular-dependency`,message:`Circular dependency detected: ${e.join(` → `)}`,relatedIds:e})}function xK(e,t){let n=e.filter(e=>e.type===`conditional`&&!e.condition);n.length>0&&t.push({type:`missing-condition`,message:`${n.length} conditional edge(s) are missing condition logic`,relatedIds:n.map(e=>e.id)})}function SK(e,t){let n=new Map;for(let t of e){let e=`${t.source}->${t.target}`,r=n.get(e)||[];r.push(t.id),n.set(e,r)}for(let[e,r]of n.entries())r.length>1&&t.push({type:`duplicate-edge`,message:`Multiple edges between same nodes: ${e}`,relatedIds:r})}function CK(e,t){let n=new Set,r=[e];for(;r.length>0;){let e=r.shift();if(n.has(e))continue;n.add(e);let i=t.filter(t=>t.source===e);for(let e of i)n.has(e.target)||r.push(e.target)}return n}function wK(e,t){let n=new Map,r=new Map;for(let t of e)n.set(t.id,[]),r.set(t.id,0);for(let e of t){let t=n.get(e.source)||[];t.push(e.target),n.set(e.source,t),r.set(e.target,(r.get(e.target)||0)+1)}let i=[],a=[];for(let[e,t]of r.entries())t===0&&i.push(e);for(;i.length>0;){let e=i.shift();a.push(e);let t=n.get(e)||[];for(let e of t){let t=(r.get(e)||0)-1;r.set(e,t),t===0&&i.push(e)}}return a.length===e.length?a:null}exports.AIChatPanel=jW,exports.AnchoredOverlay=M,exports.AppBar=qW,exports.Avatar=sB,exports.Banner=O,exports.Breadcrumbs=YW,exports.Button=D,exports.Calendar=fG,exports.Cell=IU,exports.CellType=AU,exports.Chart=vH,exports.Checkbox=A,exports.ContributionHeatmap=jV,exports.DatePicker=MU,exports.DateRangePicker=kU,exports.FileUpload=ZG,exports.Form=mG,exports.Graph=Qz,exports.Icon=b,exports.Kbd=aB,exports.Label=PV,exports.Layout=XV,exports.LayoutBuilder=JG,exports.Markdown=dV,exports.Menu=fH,exports.MindTree=sG,exports.MockAIProvider=RW,exports.NumberInput=MV,exports.OTP=g,exports.Scaffold=iG,exports.Select=SV,exports.ShortcutProvider=HW,exports.Sidebar=tG,exports.Stack=ZV,exports.TableGrid=IW,exports.TableGridRow=UU,exports.TableProvider=IH,exports.TextInput=vV,exports.Timeline=JV,exports.TourProvider=iH,exports.Typography=T,exports.Workflow=hK,exports.WorkflowPanel=fK,exports.WorkflowToolbar=dK,exports.buildColumnSchema=yW,exports.buildSystemPrompt=LW,exports.getReachableNodes=CK,exports.getTopologicalOrder=wK,exports.tableGridToolDefinitions=bW,exports.useHistory=oH,exports.useScaffold=GW,exports.useShortcut=UW,exports.useTour=rH,exports.useTourManager=aH,exports.validateToolCallsGeneric=CW,exports.validateWorkflow=gK;