@1urso/generic-editor 0.1.76 → 0.1.78

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.
@@ -45,7 +45,7 @@ If you want to hide the \`${n.titleName}\`, you can wrap it with our VisuallyHid
45
45
  For more information, see https://radix-ui.com/primitives/docs/components/${n.docsSlug}`;return t.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},ba=`DialogDescriptionWarning`,xa=({contentRef:e,descriptionId:n})=>{let r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${va(ba).contentName}}.`;return t.useEffect(()=>{let t=e.current?.getAttribute(`aria-describedby`);n&&t&&(document.getElementById(n)||console.warn(r))},[r,e,n]),null},Sa=qi,Ca=Yi,wa=$i,Ta=ta,Ea=aa,Da=ua,Oa=fa,ka=ma;function Aa(e){let n=t.useRef({value:e,previous:e});return t.useMemo(()=>(n.current.value!==e&&(n.current.previous=n.current.value,n.current.value=e),n.current.previous),[e])}function ja(e){let[n,r]=t.useState(void 0);return wn(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let n=t[0],i,a;if(`borderBoxSize`in n){let e=n.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;r({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else r(void 0)},[e]),n}var Ma=[`top`,`right`,`bottom`,`left`],Na=Math.min,Pa=Math.max,Fa=Math.round,Ia=Math.floor,La=e=>({x:e,y:e}),Ra={left:`right`,right:`left`,bottom:`top`,top:`bottom`},za={start:`end`,end:`start`};function Ba(e,t,n){return Pa(e,Na(t,n))}function Va(e,t){return typeof e==`function`?e(t):e}function Ha(e){return e.split(`-`)[0]}function Ua(e){return e.split(`-`)[1]}function Wa(e){return e===`x`?`y`:`x`}function Ga(e){return e===`y`?`height`:`width`}var Ka=new Set([`top`,`bottom`]);function qa(e){return Ka.has(Ha(e))?`y`:`x`}function Ja(e){return Wa(qa(e))}function Ya(e,t,n){n===void 0&&(n=!1);let r=Ua(e),i=Ja(e),a=Ga(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=io(o)),[o,io(o)]}function Xa(e){let t=io(e);return[Za(e),t,Za(t)]}function Za(e){return e.replace(/start|end/g,e=>za[e])}var Qa=[`left`,`right`],$a=[`right`,`left`],eo=[`top`,`bottom`],to=[`bottom`,`top`];function no(e,t,n){switch(e){case`top`:case`bottom`:return n?t?$a:Qa:t?Qa:$a;case`left`:case`right`:return t?eo:to;default:return[]}}function ro(e,t,n,r){let i=Ua(e),a=no(Ha(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Za)))),a}function io(e){return e.replace(/left|right|bottom|top/g,e=>Ra[e])}function ao(e){return{top:0,right:0,bottom:0,left:0,...e}}function oo(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:ao(e)}function so(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function co(e,t,n){let{reference:r,floating:i}=e,a=qa(t),o=Ja(t),s=Ga(o),c=Ha(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(Ua(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function lo(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=Va(t,e),p=oo(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=so(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=so(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var uo=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=a.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=co(l,r,c),f=r,p={},m=0;for(let n=0;n<s.length;n++){let{name:a,fn:h}=s[n],{x:g,y:_,data:v,reset:y}=await h({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:p,rects:l,platform:{...o,detectOverflow:o.detectOverflow??lo},elements:{reference:e,floating:t}});u=g??u,d=_??d,p={...p,[a]:{...p[a],...v}},y&&m<=50&&(m++,typeof y==`object`&&(y.placement&&(f=y.placement),y.rects&&(l=y.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):y.rects),{x:u,y:d}=co(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:p}},fo=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=Va(e,t)||{};if(l==null)return{};let d=oo(u),f={x:n,y:r},p=Ja(i),m=Ga(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=Na(d[_],T),D=Na(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=Ba(O,A,k),M=!c.arrow&&Ua(i)!=null&&A!==j&&a.reference[m]/2-(A<O?E:D)-h[m]/2<0,N=M?A<O?A-O:A-k:0;return{[p]:f[p]+N,data:{[p]:j,centerOffset:A-j-N,...M&&{alignmentOffset:N}},reset:M}}}),po=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=Va(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Ha(r),_=qa(o),v=Ha(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[io(o)]:Xa(o)),x=p!==`none`;!d&&x&&b.push(...ro(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Ya(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==qa(t))||T.every(e=>qa(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=qa(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function mo(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function ho(e){return Ma.some(t=>e[t]>=0)}var go=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=Va(e,t);switch(i){case`referenceHidden`:{let e=mo(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:ho(e)}}}case`escaped`:{let e=mo(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:ho(e)}}}default:return{}}}}},_o=new Set([`left`,`top`]);async function vo(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Ha(n),s=Ua(n),c=qa(n)===`y`,l=_o.has(o)?-1:1,u=a&&c?-1:1,d=Va(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var yo=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await vo(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},bo=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=Va(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=qa(Ha(i)),p=Wa(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=Ba(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=Ba(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},xo=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=Va(e,t),u={x:n,y:r},d=qa(i),f=Wa(d),p=u[f],m=u[d],h=Va(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=_o.has(Ha(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},So=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=Va(e,t),u=await o.detectOverflow(t,l),d=Ha(i),f=Ua(i),p=qa(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=Na(h-u[g],v),x=Na(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=Pa(u.left,0),t=Pa(u.right,0),n=Pa(u.top,0),r=Pa(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:Pa(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:Pa(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function Co(){return typeof window<`u`}function wo(e){return Do(e)?(e.nodeName||``).toLowerCase():`#document`}function To(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Eo(e){return((Do(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Do(e){return Co()?e instanceof Node||e instanceof To(e).Node:!1}function Oo(e){return Co()?e instanceof Element||e instanceof To(e).Element:!1}function ko(e){return Co()?e instanceof HTMLElement||e instanceof To(e).HTMLElement:!1}function Ao(e){return!Co()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof To(e).ShadowRoot}var jo=new Set([`inline`,`contents`]);function Mo(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Go(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!jo.has(i)}var No=new Set([`table`,`td`,`th`]);function Po(e){return No.has(wo(e))}var Fo=[`:popover-open`,`:modal`];function Io(e){return Fo.some(t=>{try{return e.matches(t)}catch{return!1}})}var Lo=[`transform`,`translate`,`scale`,`rotate`,`perspective`],Ro=[`transform`,`translate`,`scale`,`rotate`,`perspective`,`filter`],zo=[`paint`,`layout`,`strict`,`content`];function Bo(e){let t=Ho(),n=Oo(e)?Go(e):e;return Lo.some(e=>n[e]?n[e]!==`none`:!1)||(n.containerType?n.containerType!==`normal`:!1)||!t&&(n.backdropFilter?n.backdropFilter!==`none`:!1)||!t&&(n.filter?n.filter!==`none`:!1)||Ro.some(e=>(n.willChange||``).includes(e))||zo.some(e=>(n.contain||``).includes(e))}function Vo(e){let t=qo(e);for(;ko(t)&&!Wo(t);){if(Bo(t))return t;if(Io(t))return null;t=qo(t)}return null}function Ho(){return typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter`,`none`)}var Uo=new Set([`html`,`body`,`#document`]);function Wo(e){return Uo.has(wo(e))}function Go(e){return To(e).getComputedStyle(e)}function Ko(e){return Oo(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function qo(e){if(wo(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Ao(e)&&e.host||Eo(e);return Ao(t)?t.host:t}function Jo(e){let t=qo(e);return Wo(t)?e.ownerDocument?e.ownerDocument.body:e.body:ko(t)&&Mo(t)?t:Jo(t)}function Yo(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Jo(e),i=r===e.ownerDocument?.body,a=To(r);if(i){let e=Xo(a);return t.concat(a,a.visualViewport||[],Mo(r)?r:[],e&&n?Yo(e):[])}return t.concat(r,Yo(r,[],n))}function Xo(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Zo(e){let t=Go(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=ko(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Fa(n)!==a||Fa(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Qo(e){return Oo(e)?e:e.contextElement}function $o(e){let t=Qo(e);if(!ko(t))return La(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Zo(t),o=(a?Fa(n.width):n.width)/r,s=(a?Fa(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var es=La(0);function ts(e){let t=To(e);return!Ho()||!t.visualViewport?es:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function ns(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==To(e)?!1:t}function rs(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Qo(e),o=La(1);t&&(r?Oo(r)&&(o=$o(r)):o=$o(e));let s=ns(a,n,r)?ts(a):La(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=To(a),t=r&&Oo(r)?To(r):r,n=e,i=Xo(n);for(;i&&r&&t!==n;){let e=$o(i),t=i.getBoundingClientRect(),r=Go(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=To(i),i=Xo(n)}}return so({width:u,height:d,x:c,y:l})}function is(e,t){let n=Ko(e).scrollLeft;return t?t.left+n:rs(Eo(e)).left+n}function as(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-is(e,n),y:n.top+t.scrollTop}}function os(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Eo(r),s=t?Io(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=La(1),u=La(0),d=ko(r);if((d||!d&&!a)&&((wo(r)!==`body`||Mo(o))&&(c=Ko(r)),ko(r))){let e=rs(r);l=$o(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?as(o,c):La(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function ss(e){return Array.from(e.getClientRects())}function cs(e){let t=Eo(e),n=Ko(e),r=e.ownerDocument.body,i=Pa(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=Pa(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+is(e),s=-n.scrollTop;return Go(r).direction===`rtl`&&(o+=Pa(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var ls=25;function us(e,t){let n=To(e),r=Eo(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Ho();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=is(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=ls&&(a-=o)}else l<=ls&&(a+=l);return{width:a,height:o,x:s,y:c}}var ds=new Set([`absolute`,`fixed`]);function fs(e,t){let n=rs(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=ko(e)?$o(e):La(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function ps(e,t,n){let r;if(t===`viewport`)r=us(e,n);else if(t===`document`)r=cs(Eo(e));else if(Oo(t))r=fs(t,n);else{let n=ts(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return so(r)}function ms(e,t){let n=qo(e);return n===t||!Oo(n)||Wo(n)?!1:Go(n).position===`fixed`||ms(n,t)}function hs(e,t){let n=t.get(e);if(n)return n;let r=Yo(e,[],!1).filter(e=>Oo(e)&&wo(e)!==`body`),i=null,a=Go(e).position===`fixed`,o=a?qo(e):e;for(;Oo(o)&&!Wo(o);){let t=Go(o),n=Bo(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&ds.has(i.position)||Mo(o)&&!n&&ms(e,o))?r=r.filter(e=>e!==o):i=t,o=qo(o)}return t.set(e,r),r}function gs(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Io(t)?[]:hs(t,this._c):[].concat(n),r],o=a[0],s=a.reduce((e,n)=>{let r=ps(t,n,i);return e.top=Pa(r.top,e.top),e.right=Na(r.right,e.right),e.bottom=Na(r.bottom,e.bottom),e.left=Pa(r.left,e.left),e},ps(t,o,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}}function _s(e){let{width:t,height:n}=Zo(e);return{width:t,height:n}}function vs(e,t,n){let r=ko(t),i=Eo(t),a=n===`fixed`,o=rs(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=La(0);function l(){c.x=is(i)}if(r||!r&&!a)if((wo(t)!==`body`||Mo(i))&&(s=Ko(t)),r){let e=rs(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?as(i,s):La(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function ys(e){return Go(e).position===`static`}function bs(e,t){if(!ko(e)||Go(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Eo(e)===n&&(n=n.ownerDocument.body),n}function xs(e,t){let n=To(e);if(Io(e))return n;if(!ko(e)){let t=qo(e);for(;t&&!Wo(t);){if(Oo(t)&&!ys(t))return t;t=qo(t)}return n}let r=bs(e,t);for(;r&&Po(r)&&ys(r);)r=bs(r,t);return r&&Wo(r)&&ys(r)&&!Bo(r)?n:r||Vo(e)||n}var Ss=async function(e){let t=this.getOffsetParent||xs,n=this.getDimensions,r=await n(e.floating);return{reference:vs(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Cs(e){return Go(e).direction===`rtl`}var ws={convertOffsetParentRelativeRectToViewportRelativeRect:os,getDocumentElement:Eo,getClippingRect:gs,getOffsetParent:xs,getElementRects:Ss,getClientRects:ss,getDimensions:_s,getScale:$o,isElement:Oo,isRTL:Cs};function Ts(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Es(e,t){let n=null,r,i=Eo(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=Ia(d),h=Ia(i.clientWidth-(u+f)),g=Ia(i.clientHeight-(d+p)),_=Ia(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Pa(0,Na(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!Ts(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function Ds(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Qo(e),u=i||a?[...l?Yo(l):[],...Yo(t)]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?Es(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),p.observe(t));let m,h=c?rs(e):null;c&&g();function g(){let t=rs(e);h&&!Ts(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Os=yo,ks=bo,As=po,js=So,Ms=go,Ns=fo,Ps=xo,Fs=(e,t,n)=>{let r=new Map,i={platform:ws,...n},a={...i.platform,_c:r};return uo(e,t,{...i,platform:a})},Is=typeof document<`u`?t.useLayoutEffect:function(){};function Ls(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Ls(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Ls(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Rs(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function zs(e,t){let n=Rs(e);return Math.round(t*n)/n}function Bs(e){let n=t.useRef(e);return Is(()=>{n.current=e}),n}function Vs(e){e===void 0&&(e={});let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o,elements:{reference:s,floating:c}={},transform:l=!0,whileElementsMounted:u,open:d}=e,[f,p]=t.useState({x:0,y:0,strategy:i,placement:r,middlewareData:{},isPositioned:!1}),[m,h]=t.useState(a);Ls(m,a)||h(a);let[g,_]=t.useState(null),[v,y]=t.useState(null),b=t.useCallback(e=>{e!==w.current&&(w.current=e,_(e))},[]),x=t.useCallback(e=>{e!==T.current&&(T.current=e,y(e))},[]),S=s||g,C=c||v,w=t.useRef(null),T=t.useRef(null),E=t.useRef(f),D=u!=null,O=Bs(u),k=Bs(o),A=Bs(d),j=t.useCallback(()=>{if(!w.current||!T.current)return;let e={placement:r,strategy:i,middleware:m};k.current&&(e.platform=k.current),Fs(w.current,T.current,e).then(e=>{let t={...e,isPositioned:A.current!==!1};M.current&&!Ls(E.current,t)&&(E.current=t,n.flushSync(()=>{p(t)}))})},[m,r,i,k,A]);Is(()=>{d===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,p(e=>({...e,isPositioned:!1})))},[d]);let M=t.useRef(!1);Is(()=>(M.current=!0,()=>{M.current=!1}),[]),Is(()=>{if(S&&(w.current=S),C&&(T.current=C),S&&C){if(O.current)return O.current(S,C,j);j()}},[S,C,j,O,D]);let N=t.useMemo(()=>({reference:w,floating:T,setReference:b,setFloating:x}),[b,x]),P=t.useMemo(()=>({reference:S,floating:C}),[S,C]),ee=t.useMemo(()=>{let e={position:i,left:0,top:0};if(!P.floating)return e;let t=zs(P.floating,f.x),n=zs(P.floating,f.y);return l?{...e,transform:`translate(`+t+`px, `+n+`px)`,...Rs(P.floating)>=1.5&&{willChange:`transform`}}:{position:i,left:t,top:n}},[i,l,P.floating,f.x,f.y]);return t.useMemo(()=>({...f,update:j,refs:N,elements:P,floatingStyles:ee}),[f,j,N,P,ee])}var Hs=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:Ns({element:r.current,padding:i}).fn(n):r?Ns({element:r,padding:i}).fn(n):{}}}},Us=(e,t)=>({...Os(e),options:[e,t]}),Ws=(e,t)=>({...ks(e),options:[e,t]}),Gs=(e,t)=>({...Ps(e),options:[e,t]}),Ks=(e,t)=>({...As(e),options:[e,t]}),qs=(e,t)=>({...js(e),options:[e,t]}),Js=(e,t)=>({...Ms(e),options:[e,t]}),Ys=(e,t)=>({...Hs(e),options:[e,t]}),Xs=`Arrow`,Zs=t.forwardRef((e,t)=>{let{children:n,width:i=10,height:a=5,...o}=e;return(0,r.jsx)(R.svg,{...o,ref:t,width:i,height:a,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,r.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});Zs.displayName=Xs;var Qs=Zs,$s=`Popper`,[ec,tc]=xn($s),[nc,rc]=ec($s),ic=e=>{let{__scopePopper:n,children:i}=e,[a,o]=t.useState(null);return(0,r.jsx)(nc,{scope:n,anchor:a,onAnchorChange:o,children:i})};ic.displayName=$s;var ac=`PopperAnchor`,oc=t.forwardRef((e,n)=>{let{__scopePopper:i,virtualRef:a,...o}=e,s=rc(ac,i),c=t.useRef(null),l=L(n,c),u=t.useRef(null);return t.useEffect(()=>{let e=u.current;u.current=a?.current||c.current,e!==u.current&&s.onAnchorChange(u.current)}),a?null:(0,r.jsx)(R.div,{...o,ref:l})});oc.displayName=ac;var sc=`PopperContent`,[cc,lc]=ec(sc),uc=t.forwardRef((e,n)=>{let{__scopePopper:i,side:a=`bottom`,sideOffset:o=0,align:s=`center`,alignOffset:c=0,arrowPadding:l=0,avoidCollisions:u=!0,collisionBoundary:d=[],collisionPadding:f=0,sticky:p=`partial`,hideWhenDetached:m=!1,updatePositionStrategy:h=`optimized`,onPlaced:g,..._}=e,v=rc(sc,i),[y,b]=t.useState(null),x=L(n,e=>b(e)),[S,C]=t.useState(null),w=ja(S),T=w?.width??0,E=w?.height??0,D=a+(s===`center`?``:`-`+s),O=typeof f==`number`?f:{top:0,right:0,bottom:0,left:0,...f},k=Array.isArray(d)?d:[d],A=k.length>0,j={padding:O,boundary:k.filter(mc),altBoundary:A},{refs:M,floatingStyles:N,placement:P,isPositioned:ee,middlewareData:F}=Vs({strategy:`fixed`,placement:D,whileElementsMounted:(...e)=>Ds(...e,{animationFrame:h===`always`}),elements:{reference:v.anchor},middleware:[Us({mainAxis:o+E,alignmentAxis:c}),u&&Ws({mainAxis:!0,crossAxis:!1,limiter:p===`partial`?Gs():void 0,...j}),u&&Ks({...j}),qs({...j,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),S&&Ys({element:S,padding:l}),hc({arrowWidth:T,arrowHeight:E}),m&&Js({strategy:`referenceHidden`,...j})]}),[te,I]=gc(P),ne=Vn(g);wn(()=>{ee&&ne?.()},[ee,ne]);let re=F.arrow?.x,ie=F.arrow?.y,ae=F.arrow?.centerOffset!==0,[oe,se]=t.useState();return wn(()=>{y&&se(window.getComputedStyle(y).zIndex)},[y]),(0,r.jsx)(`div`,{ref:M.setFloating,"data-radix-popper-content-wrapper":``,style:{...N,transform:ee?N.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:oe,"--radix-popper-transform-origin":[F.transformOrigin?.x,F.transformOrigin?.y].join(` `),...F.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,r.jsx)(cc,{scope:i,placedSide:te,onArrowChange:C,arrowX:re,arrowY:ie,shouldHideArrow:ae,children:(0,r.jsx)(R.div,{"data-side":te,"data-align":I,..._,ref:x,style:{..._.style,animation:ee?void 0:`none`}})})})});uc.displayName=sc;var dc=`PopperArrow`,fc={top:`bottom`,right:`left`,bottom:`top`,left:`right`},pc=t.forwardRef(function(e,t){let{__scopePopper:n,...i}=e,a=lc(dc,n),o=fc[a.placedSide];return(0,r.jsx)(`span`,{ref:a.onArrowChange,style:{position:`absolute`,left:a.arrowX,top:a.arrowY,[o]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[a.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[a.placedSide],visibility:a.shouldHideArrow?`hidden`:void 0},children:(0,r.jsx)(Qs,{...i,ref:t,style:{...i.style,display:`block`}})})});pc.displayName=dc;function mc(e){return e!==null}var hc=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=gc(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function gc(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var _c=ic,vc=oc,yc=uc,bc=pc,xc=`rovingFocusGroup.onEntryFocus`,Sc={bubbles:!1,cancelable:!0},Cc=`RovingFocusGroup`,[wc,Tc,Ec]=Cn(Cc),[Dc,Oc]=xn(Cc,[Ec]),[kc,Ac]=Dc(Cc),jc=t.forwardRef((e,t)=>(0,r.jsx)(wc.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,r.jsx)(wc.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,r.jsx)(Mc,{...e,ref:t})})}));jc.displayName=Cc;var Mc=t.forwardRef((e,n)=>{let{__scopeRovingFocusGroup:i,orientation:a,loop:o=!1,dir:s,currentTabStopId:c,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:u,onEntryFocus:d,preventScrollOnEntryFocus:f=!1,...p}=e,m=t.useRef(null),h=L(n,m),g=zn(s),[_,v]=En({prop:c,defaultProp:l??null,onChange:u,caller:Cc}),[y,b]=t.useState(!1),x=Vn(d),S=Tc(i),C=t.useRef(!1),[w,T]=t.useState(0);return t.useEffect(()=>{let e=m.current;if(e)return e.addEventListener(xc,x),()=>e.removeEventListener(xc,x)},[x]),(0,r.jsx)(kc,{scope:i,orientation:a,dir:g,loop:o,currentTabStopId:_,onItemFocus:t.useCallback(e=>v(e),[v]),onItemShiftTab:t.useCallback(()=>b(!0),[]),onFocusableItemAdd:t.useCallback(()=>T(e=>e+1),[]),onFocusableItemRemove:t.useCallback(()=>T(e=>e-1),[]),children:(0,r.jsx)(R.div,{tabIndex:y||w===0?-1:0,"data-orientation":a,...p,ref:h,style:{outline:`none`,...e.style},onMouseDown:z(e.onMouseDown,()=>{C.current=!0}),onFocus:z(e.onFocus,e=>{let t=!C.current;if(e.target===e.currentTarget&&t&&!y){let t=new CustomEvent(xc,Sc);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=S().filter(e=>e.focusable);Rc([e.find(e=>e.active),e.find(e=>e.id===_),...e].filter(Boolean).map(e=>e.ref.current),f)}}C.current=!1}),onBlur:z(e.onBlur,()=>b(!1))})})}),Nc=`RovingFocusGroupItem`,Pc=t.forwardRef((e,n)=>{let{__scopeRovingFocusGroup:i,focusable:a=!0,active:o=!1,tabStopId:s,children:c,...l}=e,u=In(),d=s||u,f=Ac(Nc,i),p=f.currentTabStopId===d,m=Tc(i),{onFocusableItemAdd:h,onFocusableItemRemove:g,currentTabStopId:_}=f;return t.useEffect(()=>{if(a)return h(),()=>g()},[a,h,g]),(0,r.jsx)(wc.ItemSlot,{scope:i,id:d,focusable:a,active:o,children:(0,r.jsx)(R.span,{tabIndex:p?0:-1,"data-orientation":f.orientation,...l,ref:n,onMouseDown:z(e.onMouseDown,e=>{a?f.onItemFocus(d):e.preventDefault()}),onFocus:z(e.onFocus,()=>f.onItemFocus(d)),onKeyDown:z(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){f.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=Lc(e,f.orientation,f.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=m().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=f.loop?zc(n,r+1):n.slice(r+1)}setTimeout(()=>Rc(n))}}),children:typeof c==`function`?c({isCurrentTabStop:p,hasTabStop:_!=null}):c})})});Pc.displayName=Nc;var Fc={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function Ic(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function Lc(e,t,n){let r=Ic(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return Fc[r]}function Rc(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function zc(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Bc=jc,Vc=Pc,Hc=[`Enter`,` `],Uc=[`ArrowDown`,`PageUp`,`Home`],Wc=[`ArrowUp`,`PageDown`,`End`],Gc=[...Uc,...Wc],Kc={ltr:[...Hc,`ArrowRight`],rtl:[...Hc,`ArrowLeft`]},qc={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},Jc=`Menu`,[Yc,Xc,Zc]=Cn(Jc),[Qc,$c]=xn(Jc,[Zc,tc,Oc]),el=tc(),tl=Oc(),[nl,rl]=Qc(Jc),[il,al]=Qc(Jc),ol=e=>{let{__scopeMenu:n,open:i=!1,children:a,dir:o,onOpenChange:s,modal:c=!0}=e,l=el(n),[u,d]=t.useState(null),f=t.useRef(!1),p=Vn(s),m=zn(o);return t.useEffect(()=>{let e=()=>{f.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>f.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,r.jsx)(_c,{...l,children:(0,r.jsx)(nl,{scope:n,open:i,onOpenChange:p,content:u,onContentChange:d,children:(0,r.jsx)(il,{scope:n,onClose:t.useCallback(()=>p(!1),[p]),isUsingKeyboardRef:f,dir:m,modal:c,children:a})})})};ol.displayName=Jc;var sl=`MenuAnchor`,cl=t.forwardRef((e,t)=>{let{__scopeMenu:n,...i}=e,a=el(n);return(0,r.jsx)(vc,{...a,...i,ref:t})});cl.displayName=sl;var ll=`MenuPortal`,[ul,dl]=Qc(ll,{forceMount:void 0}),fl=e=>{let{__scopeMenu:t,forceMount:n,children:i,container:a}=e,o=rl(ll,t);return(0,r.jsx)(ul,{scope:t,forceMount:n,children:(0,r.jsx)(An,{present:n||o.open,children:(0,r.jsx)(yr,{asChild:!0,container:a,children:i})})})};fl.displayName=ll;var pl=`MenuContent`,[ml,hl]=Qc(pl),gl=t.forwardRef((e,t)=>{let n=dl(pl,e.__scopeMenu),{forceMount:i=n.forceMount,...a}=e,o=rl(pl,e.__scopeMenu),s=al(pl,e.__scopeMenu);return(0,r.jsx)(Yc.Provider,{scope:e.__scopeMenu,children:(0,r.jsx)(An,{present:i||o.open,children:(0,r.jsx)(Yc.Slot,{scope:e.__scopeMenu,children:s.modal?(0,r.jsx)(_l,{...a,ref:t}):(0,r.jsx)(vl,{...a,ref:t})})})})}),_l=t.forwardRef((e,n)=>{let i=rl(pl,e.__scopeMenu),a=t.useRef(null),o=L(n,a);return t.useEffect(()=>{let e=a.current;if(e)return Vi(e)},[]),(0,r.jsx)(bl,{...e,ref:o,trapFocus:i.open,disableOutsidePointerEvents:i.open,disableOutsideScroll:!0,onFocusOutside:z(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>i.onOpenChange(!1)})}),vl=t.forwardRef((e,t)=>{let n=rl(pl,e.__scopeMenu);return(0,r.jsx)(bl,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),yl=on(`MenuContent.ScrollLock`),bl=t.forwardRef((e,n)=>{let{__scopeMenu:i,loop:a=!1,trapFocus:o,onOpenAutoFocus:s,onCloseAutoFocus:c,disableOutsidePointerEvents:l,onEntryFocus:u,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:p,onInteractOutside:m,onDismiss:h,disableOutsideScroll:g,..._}=e,v=rl(pl,i),y=al(pl,i),b=el(i),x=tl(i),S=Xc(i),[C,w]=t.useState(null),T=t.useRef(null),E=L(n,T,v.onContentChange),D=t.useRef(0),O=t.useRef(``),k=t.useRef(0),A=t.useRef(null),j=t.useRef(`right`),M=t.useRef(0),N=g?Mi:t.Fragment,P=g?{as:yl,allowPinchZoom:!0}:void 0,ee=e=>{let t=O.current+e,n=S().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=iu(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){O.current=t,window.clearTimeout(D.current),t!==``&&(D.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};t.useEffect(()=>()=>window.clearTimeout(D.current),[]),xr();let F=t.useCallback(e=>j.current===A.current?.side&&ou(e,A.current?.area),[]);return(0,r.jsx)(ml,{scope:i,searchRef:O,onItemEnter:t.useCallback(e=>{F(e)&&e.preventDefault()},[F]),onItemLeave:t.useCallback(e=>{F(e)||(T.current?.focus(),w(null))},[F]),onTriggerLeave:t.useCallback(e=>{F(e)&&e.preventDefault()},[F]),pointerGraceTimerRef:k,onPointerGraceIntentChange:t.useCallback(e=>{A.current=e},[]),children:(0,r.jsx)(N,{...P,children:(0,r.jsx)(or,{asChild:!0,trapped:o,onMountAutoFocus:z(s,e=>{e.preventDefault(),T.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:c,children:(0,r.jsx)(Yn,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:p,onInteractOutside:m,onDismiss:h,children:(0,r.jsx)(Bc,{asChild:!0,...x,dir:y.dir,orientation:`vertical`,loop:a,currentTabStopId:C,onCurrentTabStopIdChange:w,onEntryFocus:z(u,e=>{y.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,r.jsx)(yc,{role:`menu`,"aria-orientation":`vertical`,"data-state":$l(v.open),"data-radix-menu-content":``,dir:y.dir,...b,..._,ref:E,style:{outline:`none`,..._.style},onKeyDown:z(_.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&ee(e.key));let i=T.current;if(e.target!==i||!Gc.includes(e.key))return;e.preventDefault();let a=S().filter(e=>!e.disabled).map(e=>e.ref.current);Wc.includes(e.key)&&a.reverse(),nu(a)}),onBlur:z(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(D.current),O.current=``)}),onPointerMove:z(e.onPointerMove,su(e=>{let t=e.target,n=M.current!==e.clientX;e.currentTarget.contains(t)&&n&&(j.current=e.clientX>M.current?`right`:`left`,M.current=e.clientX)}))})})})})})})});gl.displayName=pl;var xl=`MenuGroup`,Sl=t.forwardRef((e,t)=>{let{__scopeMenu:n,...i}=e;return(0,r.jsx)(R.div,{role:`group`,...i,ref:t})});Sl.displayName=xl;var Cl=`MenuLabel`,wl=t.forwardRef((e,t)=>{let{__scopeMenu:n,...i}=e;return(0,r.jsx)(R.div,{...i,ref:t})});wl.displayName=Cl;var Tl=`MenuItem`,El=`menu.itemSelect`,Dl=t.forwardRef((e,n)=>{let{disabled:i=!1,onSelect:a,...o}=e,s=t.useRef(null),c=al(Tl,e.__scopeMenu),l=hl(Tl,e.__scopeMenu),u=L(n,s),d=t.useRef(!1),f=()=>{let e=s.current;if(!i&&e){let t=new CustomEvent(El,{bubbles:!0,cancelable:!0});e.addEventListener(El,e=>a?.(e),{once:!0}),hn(e,t),t.defaultPrevented?d.current=!1:c.onClose()}};return(0,r.jsx)(Ol,{...o,ref:u,disabled:i,onClick:z(e.onClick,f),onPointerDown:t=>{e.onPointerDown?.(t),d.current=!0},onPointerUp:z(e.onPointerUp,e=>{d.current||e.currentTarget?.click()}),onKeyDown:z(e.onKeyDown,e=>{let t=l.searchRef.current!==``;i||t&&e.key===` `||Hc.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});Dl.displayName=Tl;var Ol=t.forwardRef((e,n)=>{let{__scopeMenu:i,disabled:a=!1,textValue:o,...s}=e,c=hl(Tl,i),l=tl(i),u=t.useRef(null),d=L(n,u),[f,p]=t.useState(!1),[m,h]=t.useState(``);return t.useEffect(()=>{let e=u.current;e&&h((e.textContent??``).trim())},[s.children]),(0,r.jsx)(Yc.ItemSlot,{scope:i,disabled:a,textValue:o??m,children:(0,r.jsx)(Vc,{asChild:!0,...l,focusable:!a,children:(0,r.jsx)(R.div,{role:`menuitem`,"data-highlighted":f?``:void 0,"aria-disabled":a||void 0,"data-disabled":a?``:void 0,...s,ref:d,onPointerMove:z(e.onPointerMove,su(e=>{a?c.onItemLeave(e):(c.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:z(e.onPointerLeave,su(e=>c.onItemLeave(e))),onFocus:z(e.onFocus,()=>p(!0)),onBlur:z(e.onBlur,()=>p(!1))})})})}),kl=`MenuCheckboxItem`,Al=t.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:i,...a}=e;return(0,r.jsx)(Rl,{scope:e.__scopeMenu,checked:n,children:(0,r.jsx)(Dl,{role:`menuitemcheckbox`,"aria-checked":eu(n)?`mixed`:n,...a,ref:t,"data-state":tu(n),onSelect:z(a.onSelect,()=>i?.(eu(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Al.displayName=kl;var jl=`MenuRadioGroup`,[Ml,Nl]=Qc(jl,{value:void 0,onValueChange:()=>{}}),Pl=t.forwardRef((e,t)=>{let{value:n,onValueChange:i,...a}=e,o=Vn(i);return(0,r.jsx)(Ml,{scope:e.__scopeMenu,value:n,onValueChange:o,children:(0,r.jsx)(Sl,{...a,ref:t})})});Pl.displayName=jl;var Fl=`MenuRadioItem`,Il=t.forwardRef((e,t)=>{let{value:n,...i}=e,a=Nl(Fl,e.__scopeMenu),o=n===a.value;return(0,r.jsx)(Rl,{scope:e.__scopeMenu,checked:o,children:(0,r.jsx)(Dl,{role:`menuitemradio`,"aria-checked":o,...i,ref:t,"data-state":tu(o),onSelect:z(i.onSelect,()=>a.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});Il.displayName=Fl;var Ll=`MenuItemIndicator`,[Rl,zl]=Qc(Ll,{checked:!1}),Bl=t.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:i,...a}=e,o=zl(Ll,n);return(0,r.jsx)(An,{present:i||eu(o.checked)||o.checked===!0,children:(0,r.jsx)(R.span,{...a,ref:t,"data-state":tu(o.checked)})})});Bl.displayName=Ll;var Vl=`MenuSeparator`,Hl=t.forwardRef((e,t)=>{let{__scopeMenu:n,...i}=e;return(0,r.jsx)(R.div,{role:`separator`,"aria-orientation":`horizontal`,...i,ref:t})});Hl.displayName=Vl;var Ul=`MenuArrow`,Wl=t.forwardRef((e,t)=>{let{__scopeMenu:n,...i}=e,a=el(n);return(0,r.jsx)(bc,{...a,...i,ref:t})});Wl.displayName=Ul;var Gl=`MenuSub`,[Kl,ql]=Qc(Gl),Jl=e=>{let{__scopeMenu:n,children:i,open:a=!1,onOpenChange:o}=e,s=rl(Gl,n),c=el(n),[l,u]=t.useState(null),[d,f]=t.useState(null),p=Vn(o);return t.useEffect(()=>(s.open===!1&&p(!1),()=>p(!1)),[s.open,p]),(0,r.jsx)(_c,{...c,children:(0,r.jsx)(nl,{scope:n,open:a,onOpenChange:p,content:d,onContentChange:f,children:(0,r.jsx)(Kl,{scope:n,contentId:In(),triggerId:In(),trigger:l,onTriggerChange:u,children:i})})})};Jl.displayName=Gl;var Yl=`MenuSubTrigger`,Xl=t.forwardRef((e,n)=>{let i=rl(Yl,e.__scopeMenu),a=al(Yl,e.__scopeMenu),o=ql(Yl,e.__scopeMenu),s=hl(Yl,e.__scopeMenu),c=t.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:u}=s,d={__scopeMenu:e.__scopeMenu},f=t.useCallback(()=>{c.current&&window.clearTimeout(c.current),c.current=null},[]);return t.useEffect(()=>f,[f]),t.useEffect(()=>{let e=l.current;return()=>{window.clearTimeout(e),u(null)}},[l,u]),(0,r.jsx)(cl,{asChild:!0,...d,children:(0,r.jsx)(Ol,{id:o.triggerId,"aria-haspopup":`menu`,"aria-expanded":i.open,"aria-controls":o.contentId,"data-state":$l(i.open),...e,ref:an(n,o.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),i.open||i.onOpenChange(!0))},onPointerMove:z(e.onPointerMove,su(t=>{s.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!i.open&&!c.current&&(s.onPointerGraceIntentChange(null),c.current=window.setTimeout(()=>{i.onOpenChange(!0),f()},100))})),onPointerLeave:z(e.onPointerLeave,su(e=>{f();let t=i.content?.getBoundingClientRect();if(t){let n=i.content?.dataset.side,r=n===`right`,a=r?-5:5,o=t[r?`left`:`right`],c=t[r?`right`:`left`];s.onPointerGraceIntentChange({area:[{x:e.clientX+a,y:e.clientY},{x:o,y:t.top},{x:c,y:t.top},{x:c,y:t.bottom},{x:o,y:t.bottom}],side:n}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(e),e.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:z(e.onKeyDown,t=>{let n=s.searchRef.current!==``;e.disabled||n&&t.key===` `||Kc[a.dir].includes(t.key)&&(i.onOpenChange(!0),i.content?.focus(),t.preventDefault())})})})});Xl.displayName=Yl;var Zl=`MenuSubContent`,Ql=t.forwardRef((e,n)=>{let i=dl(pl,e.__scopeMenu),{forceMount:a=i.forceMount,...o}=e,s=rl(pl,e.__scopeMenu),c=al(pl,e.__scopeMenu),l=ql(Zl,e.__scopeMenu),u=t.useRef(null),d=L(n,u);return(0,r.jsx)(Yc.Provider,{scope:e.__scopeMenu,children:(0,r.jsx)(An,{present:a||s.open,children:(0,r.jsx)(Yc.Slot,{scope:e.__scopeMenu,children:(0,r.jsx)(bl,{id:l.contentId,"aria-labelledby":l.triggerId,...o,ref:d,align:`start`,side:c.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{c.isUsingKeyboardRef.current&&u.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:z(e.onFocusOutside,e=>{e.target!==l.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:z(e.onEscapeKeyDown,e=>{c.onClose(),e.preventDefault()}),onKeyDown:z(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=qc[c.dir].includes(e.key);t&&n&&(s.onOpenChange(!1),l.trigger?.focus(),e.preventDefault())})})})})})});Ql.displayName=Zl;function $l(e){return e?`open`:`closed`}function eu(e){return e===`indeterminate`}function tu(e){return eu(e)?`indeterminate`:e?`checked`:`unchecked`}function nu(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function ru(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function iu(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=ru(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function au(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function ou(e,t){return t?au({x:e.clientX,y:e.clientY},t):!1}function su(e){return t=>t.pointerType===`mouse`?e(t):void 0}var cu=ol,lu=cl,uu=fl,du=gl,fu=Sl,pu=wl,mu=Dl,hu=Al,gu=Pl,_u=Il,vu=Bl,yu=Hl,bu=Wl,xu=Jl,Su=Xl,Cu=Ql,wu=`DropdownMenu`,[Tu,Eu]=xn(wu,[$c]),Du=$c(),[Ou,ku]=Tu(wu),Au=e=>{let{__scopeDropdownMenu:n,children:i,dir:a,open:o,defaultOpen:s,onOpenChange:c,modal:l=!0}=e,u=Du(n),d=t.useRef(null),[f,p]=En({prop:o,defaultProp:s??!1,onChange:c,caller:wu});return(0,r.jsx)(Ou,{scope:n,triggerId:In(),triggerRef:d,contentId:In(),open:f,onOpenChange:p,onOpenToggle:t.useCallback(()=>p(e=>!e),[p]),modal:l,children:(0,r.jsx)(cu,{...u,open:f,onOpenChange:p,dir:a,modal:l,children:i})})};Au.displayName=wu;var ju=`DropdownMenuTrigger`,Mu=t.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:i=!1,...a}=e,o=ku(ju,n),s=Du(n);return(0,r.jsx)(lu,{asChild:!0,...s,children:(0,r.jsx)(R.button,{type:`button`,id:o.triggerId,"aria-haspopup":`menu`,"aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?`open`:`closed`,"data-disabled":i?``:void 0,disabled:i,...a,ref:an(t,o.triggerRef),onPointerDown:z(e.onPointerDown,e=>{!i&&e.button===0&&e.ctrlKey===!1&&(o.onOpenToggle(),o.open||e.preventDefault())}),onKeyDown:z(e.onKeyDown,e=>{i||([`Enter`,` `].includes(e.key)&&o.onOpenToggle(),e.key===`ArrowDown`&&o.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});Mu.displayName=ju;var Nu=`DropdownMenuPortal`,Pu=e=>{let{__scopeDropdownMenu:t,...n}=e,i=Du(t);return(0,r.jsx)(uu,{...i,...n})};Pu.displayName=Nu;var Fu=`DropdownMenuContent`,Iu=t.forwardRef((e,n)=>{let{__scopeDropdownMenu:i,...a}=e,o=ku(Fu,i),s=Du(i),c=t.useRef(!1);return(0,r.jsx)(du,{id:o.contentId,"aria-labelledby":o.triggerId,...s,...a,ref:n,onCloseAutoFocus:z(e.onCloseAutoFocus,e=>{c.current||o.triggerRef.current?.focus(),c.current=!1,e.preventDefault()}),onInteractOutside:z(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!o.modal||r)&&(c.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Iu.displayName=Fu;var Lu=`DropdownMenuGroup`,Ru=t.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...i}=e,a=Du(n);return(0,r.jsx)(fu,{...a,...i,ref:t})});Ru.displayName=Lu;var zu=`DropdownMenuLabel`,Bu=t.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...i}=e,a=Du(n);return(0,r.jsx)(pu,{...a,...i,ref:t})});Bu.displayName=zu;var Vu=`DropdownMenuItem`,Hu=t.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...i}=e,a=Du(n);return(0,r.jsx)(mu,{...a,...i,ref:t})});Hu.displayName=Vu;var Uu=`DropdownMenuCheckboxItem`,Wu=t.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...i}=e,a=Du(n);return(0,r.jsx)(hu,{...a,...i,ref:t})});Wu.displayName=Uu;var Gu=`DropdownMenuRadioGroup`,Ku=t.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...i}=e,a=Du(n);return(0,r.jsx)(gu,{...a,...i,ref:t})});Ku.displayName=Gu;var qu=`DropdownMenuRadioItem`,Ju=t.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...i}=e,a=Du(n);return(0,r.jsx)(_u,{...a,...i,ref:t})});Ju.displayName=qu;var Yu=`DropdownMenuItemIndicator`,Xu=t.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...i}=e,a=Du(n);return(0,r.jsx)(vu,{...a,...i,ref:t})});Xu.displayName=Yu;var Zu=`DropdownMenuSeparator`,Qu=t.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...i}=e,a=Du(n);return(0,r.jsx)(yu,{...a,...i,ref:t})});Qu.displayName=Zu;var $u=`DropdownMenuArrow`,ed=t.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...i}=e,a=Du(n);return(0,r.jsx)(bu,{...a,...i,ref:t})});ed.displayName=$u;var td=e=>{let{__scopeDropdownMenu:t,children:n,open:i,onOpenChange:a,defaultOpen:o}=e,s=Du(t),[c,l]=En({prop:i,defaultProp:o??!1,onChange:a,caller:`DropdownMenuSub`});return(0,r.jsx)(xu,{...s,open:c,onOpenChange:l,children:n})},nd=`DropdownMenuSubTrigger`,rd=t.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...i}=e,a=Du(n);return(0,r.jsx)(Su,{...a,...i,ref:t})});rd.displayName=nd;var id=`DropdownMenuSubContent`,ad=t.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...i}=e,a=Du(n);return(0,r.jsx)(Cu,{...a,...i,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});ad.displayName=id;var od=Au,sd=Mu,cd=Pu,ld=Iu,ud=Ru,dd=Bu,fd=Hu,pd=Wu,md=Ku,hd=Ju,gd=Xu,_d=Qu,vd=td,yd=rd,bd=ad;function xd(e,[t,n]){return Math.min(n,Math.max(t,e))}var Sd=`Popover`,[Cd,wd]=xn(Sd,[tc]),Td=tc(),[Ed,Dd]=Cd(Sd),Od=e=>{let{__scopePopover:n,children:i,open:a,defaultOpen:o,onOpenChange:s,modal:c=!1}=e,l=Td(n),u=t.useRef(null),[d,f]=t.useState(!1),[p,m]=En({prop:a,defaultProp:o??!1,onChange:s,caller:Sd});return(0,r.jsx)(_c,{...l,children:(0,r.jsx)(Ed,{scope:n,contentId:In(),triggerRef:u,open:p,onOpenChange:m,onOpenToggle:t.useCallback(()=>m(e=>!e),[m]),hasCustomAnchor:d,onCustomAnchorAdd:t.useCallback(()=>f(!0),[]),onCustomAnchorRemove:t.useCallback(()=>f(!1),[]),modal:c,children:i})})};Od.displayName=Sd;var kd=`PopoverAnchor`,Ad=t.forwardRef((e,n)=>{let{__scopePopover:i,...a}=e,o=Dd(kd,i),s=Td(i),{onCustomAnchorAdd:c,onCustomAnchorRemove:l}=o;return t.useEffect(()=>(c(),()=>l()),[c,l]),(0,r.jsx)(vc,{...s,...a,ref:n})});Ad.displayName=kd;var jd=`PopoverTrigger`,Md=t.forwardRef((e,t)=>{let{__scopePopover:n,...i}=e,a=Dd(jd,n),o=Td(n),s=L(t,a.triggerRef),c=(0,r.jsx)(R.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":a.open,"aria-controls":a.contentId,"data-state":qd(a.open),...i,ref:s,onClick:z(e.onClick,a.onOpenToggle)});return a.hasCustomAnchor?c:(0,r.jsx)(vc,{asChild:!0,...o,children:c})});Md.displayName=jd;var Nd=`PopoverPortal`,[Pd,Fd]=Cd(Nd,{forceMount:void 0}),Id=e=>{let{__scopePopover:t,forceMount:n,children:i,container:a}=e,o=Dd(Nd,t);return(0,r.jsx)(Pd,{scope:t,forceMount:n,children:(0,r.jsx)(An,{present:n||o.open,children:(0,r.jsx)(yr,{asChild:!0,container:a,children:i})})})};Id.displayName=Nd;var Ld=`PopoverContent`,Rd=t.forwardRef((e,t)=>{let n=Fd(Ld,e.__scopePopover),{forceMount:i=n.forceMount,...a}=e,o=Dd(Ld,e.__scopePopover);return(0,r.jsx)(An,{present:i||o.open,children:o.modal?(0,r.jsx)(Bd,{...a,ref:t}):(0,r.jsx)(Vd,{...a,ref:t})})});Rd.displayName=Ld;var zd=on(`PopoverContent.RemoveScroll`),Bd=t.forwardRef((e,n)=>{let i=Dd(Ld,e.__scopePopover),a=t.useRef(null),o=L(n,a),s=t.useRef(!1);return t.useEffect(()=>{let e=a.current;if(e)return Vi(e)},[]),(0,r.jsx)(Mi,{as:zd,allowPinchZoom:!0,children:(0,r.jsx)(Hd,{...e,ref:o,trapFocus:i.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:z(e.onCloseAutoFocus,e=>{e.preventDefault(),s.current||i.triggerRef.current?.focus()}),onPointerDownOutside:z(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;s.current=t.button===2||n},{checkForDefaultPrevented:!1}),onFocusOutside:z(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),Vd=t.forwardRef((e,n)=>{let i=Dd(Ld,e.__scopePopover),a=t.useRef(!1),o=t.useRef(!1);return(0,r.jsx)(Hd,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(a.current||i.triggerRef.current?.focus(),t.preventDefault()),a.current=!1,o.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(a.current=!0,t.detail.originalEvent.type===`pointerdown`&&(o.current=!0));let n=t.target;i.triggerRef.current?.contains(n)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&o.current&&t.preventDefault()}})}),Hd=t.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:u,onInteractOutside:d,...f}=e,p=Dd(Ld,n),m=Td(n);return xr(),(0,r.jsx)(or,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:a,onUnmountAutoFocus:o,children:(0,r.jsx)(Yn,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:d,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:u,onDismiss:()=>p.onOpenChange(!1),children:(0,r.jsx)(yc,{"data-state":qd(p.open),role:`dialog`,id:p.contentId,...m,...f,ref:t,style:{...f.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),Ud=`PopoverClose`,Wd=t.forwardRef((e,t)=>{let{__scopePopover:n,...i}=e,a=Dd(Ud,n);return(0,r.jsx)(R.button,{type:`button`,...i,ref:t,onClick:z(e.onClick,()=>a.onOpenChange(!1))})});Wd.displayName=Ud;var Gd=`PopoverArrow`,Kd=t.forwardRef((e,t)=>{let{__scopePopover:n,...i}=e,a=Td(n);return(0,r.jsx)(bc,{...a,...i,ref:t})});Kd.displayName=Gd;function qd(e){return e?`open`:`closed`}var Jd=Od,Yd=Ad,Xd=Md,Zd=Id,Qd=Rd,$d=Wd;function ef(e,n){return t.useReducer((e,t)=>n[e][t]??e,e)}var tf=`ScrollArea`,[nf,rf]=xn(tf),[af,of]=nf(tf),sf=t.forwardRef((e,n)=>{let{__scopeScrollArea:i,type:a=`hover`,dir:o,scrollHideDelay:s=600,...c}=e,[l,u]=t.useState(null),[d,f]=t.useState(null),[p,m]=t.useState(null),[h,g]=t.useState(null),[_,v]=t.useState(null),[y,b]=t.useState(0),[x,S]=t.useState(0),[C,w]=t.useState(!1),[T,E]=t.useState(!1),D=L(n,e=>u(e)),O=zn(o);return(0,r.jsx)(af,{scope:i,type:a,dir:O,scrollHideDelay:s,scrollArea:l,viewport:d,onViewportChange:f,content:p,onContentChange:m,scrollbarX:h,onScrollbarXChange:g,scrollbarXEnabled:C,onScrollbarXEnabledChange:w,scrollbarY:_,onScrollbarYChange:v,scrollbarYEnabled:T,onScrollbarYEnabledChange:E,onCornerWidthChange:b,onCornerHeightChange:S,children:(0,r.jsx)(R.div,{dir:O,...c,ref:D,style:{position:`relative`,"--radix-scroll-area-corner-width":y+`px`,"--radix-scroll-area-corner-height":x+`px`,...e.style}})})});sf.displayName=tf;var cf=`ScrollAreaViewport`,lf=t.forwardRef((e,n)=>{let{__scopeScrollArea:i,children:a,nonce:o,...s}=e,c=of(cf,i),l=L(n,t.useRef(null),c.onViewportChange);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}`},nonce:o}),(0,r.jsx)(R.div,{"data-radix-scroll-area-viewport":``,...s,ref:l,style:{overflowX:c.scrollbarXEnabled?`scroll`:`hidden`,overflowY:c.scrollbarYEnabled?`scroll`:`hidden`,...e.style},children:(0,r.jsx)(`div`,{ref:c.onContentChange,style:{minWidth:`100%`,display:`table`},children:a})})]})});lf.displayName=cf;var uf=`ScrollAreaScrollbar`,df=t.forwardRef((e,n)=>{let{forceMount:i,...a}=e,o=of(uf,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:c}=o,l=e.orientation===`horizontal`;return t.useEffect(()=>(l?s(!0):c(!0),()=>{l?s(!1):c(!1)}),[l,s,c]),o.type===`hover`?(0,r.jsx)(ff,{...a,ref:n,forceMount:i}):o.type===`scroll`?(0,r.jsx)(pf,{...a,ref:n,forceMount:i}):o.type===`auto`?(0,r.jsx)(mf,{...a,ref:n,forceMount:i}):o.type===`always`?(0,r.jsx)(hf,{...a,ref:n}):null});df.displayName=uf;var ff=t.forwardRef((e,n)=>{let{forceMount:i,...a}=e,o=of(uf,e.__scopeScrollArea),[s,c]=t.useState(!1);return t.useEffect(()=>{let e=o.scrollArea,t=0;if(e){let n=()=>{window.clearTimeout(t),c(!0)},r=()=>{t=window.setTimeout(()=>c(!1),o.scrollHideDelay)};return e.addEventListener(`pointerenter`,n),e.addEventListener(`pointerleave`,r),()=>{window.clearTimeout(t),e.removeEventListener(`pointerenter`,n),e.removeEventListener(`pointerleave`,r)}}},[o.scrollArea,o.scrollHideDelay]),(0,r.jsx)(An,{present:i||s,children:(0,r.jsx)(mf,{"data-state":s?`visible`:`hidden`,...a,ref:n})})}),pf=t.forwardRef((e,n)=>{let{forceMount:i,...a}=e,o=of(uf,e.__scopeScrollArea),s=e.orientation===`horizontal`,c=Ff(()=>u(`SCROLL_END`),100),[l,u]=ef(`hidden`,{hidden:{SCROLL:`scrolling`},scrolling:{SCROLL_END:`idle`,POINTER_ENTER:`interacting`},interacting:{SCROLL:`interacting`,POINTER_LEAVE:`idle`},idle:{HIDE:`hidden`,SCROLL:`scrolling`,POINTER_ENTER:`interacting`}});return t.useEffect(()=>{if(l===`idle`){let e=window.setTimeout(()=>u(`HIDE`),o.scrollHideDelay);return()=>window.clearTimeout(e)}},[l,o.scrollHideDelay,u]),t.useEffect(()=>{let e=o.viewport,t=s?`scrollLeft`:`scrollTop`;if(e){let n=e[t],r=()=>{let r=e[t];n!==r&&(u(`SCROLL`),c()),n=r};return e.addEventListener(`scroll`,r),()=>e.removeEventListener(`scroll`,r)}},[o.viewport,s,u,c]),(0,r.jsx)(An,{present:i||l!==`hidden`,children:(0,r.jsx)(hf,{"data-state":l===`hidden`?`hidden`:`visible`,...a,ref:n,onPointerEnter:z(e.onPointerEnter,()=>u(`POINTER_ENTER`)),onPointerLeave:z(e.onPointerLeave,()=>u(`POINTER_LEAVE`))})})}),mf=t.forwardRef((e,n)=>{let i=of(uf,e.__scopeScrollArea),{forceMount:a,...o}=e,[s,c]=t.useState(!1),l=e.orientation===`horizontal`,u=Ff(()=>{if(i.viewport){let e=i.viewport.offsetWidth<i.viewport.scrollWidth,t=i.viewport.offsetHeight<i.viewport.scrollHeight;c(l?e:t)}},10);return If(i.viewport,u),If(i.content,u),(0,r.jsx)(An,{present:a||s,children:(0,r.jsx)(hf,{"data-state":s?`visible`:`hidden`,...o,ref:n})})}),hf=t.forwardRef((e,n)=>{let{orientation:i=`vertical`,...a}=e,o=of(uf,e.__scopeScrollArea),s=t.useRef(null),c=t.useRef(0),[l,u]=t.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),d=Of(l.viewport,l.content),f={...a,sizes:l,onSizesChange:u,hasThumb:d>0&&d<1,onThumbChange:e=>s.current=e,onThumbPointerUp:()=>c.current=0,onThumbPointerDown:e=>c.current=e};function p(e,t){return Af(e,c.current,l,t)}return i===`horizontal`?(0,r.jsx)(gf,{...f,ref:n,onThumbPositionChange:()=>{if(o.viewport&&s.current){let e=o.viewport.scrollLeft,t=jf(e,l,o.dir);s.current.style.transform=`translate3d(${t}px, 0, 0)`}},onWheelScroll:e=>{o.viewport&&(o.viewport.scrollLeft=e)},onDragScroll:e=>{o.viewport&&(o.viewport.scrollLeft=p(e,o.dir))}}):i===`vertical`?(0,r.jsx)(_f,{...f,ref:n,onThumbPositionChange:()=>{if(o.viewport&&s.current){let e=o.viewport.scrollTop,t=jf(e,l);s.current.style.transform=`translate3d(0, ${t}px, 0)`}},onWheelScroll:e=>{o.viewport&&(o.viewport.scrollTop=e)},onDragScroll:e=>{o.viewport&&(o.viewport.scrollTop=p(e))}}):null}),gf=t.forwardRef((e,n)=>{let{sizes:i,onSizesChange:a,...o}=e,s=of(uf,e.__scopeScrollArea),[c,l]=t.useState(),u=t.useRef(null),d=L(n,u,s.onScrollbarXChange);return t.useEffect(()=>{u.current&&l(getComputedStyle(u.current))},[u]),(0,r.jsx)(bf,{"data-orientation":`horizontal`,...o,ref:d,sizes:i,style:{bottom:0,left:s.dir===`rtl`?`var(--radix-scroll-area-corner-width)`:0,right:s.dir===`ltr`?`var(--radix-scroll-area-corner-width)`:0,"--radix-scroll-area-thumb-width":kf(i)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,n)=>{if(s.viewport){let r=s.viewport.scrollLeft+t.deltaX;e.onWheelScroll(r),Nf(r,n)&&t.preventDefault()}},onResize:()=>{u.current&&s.viewport&&c&&a({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:u.current.clientWidth,paddingStart:Df(c.paddingLeft),paddingEnd:Df(c.paddingRight)}})}})}),_f=t.forwardRef((e,n)=>{let{sizes:i,onSizesChange:a,...o}=e,s=of(uf,e.__scopeScrollArea),[c,l]=t.useState(),u=t.useRef(null),d=L(n,u,s.onScrollbarYChange);return t.useEffect(()=>{u.current&&l(getComputedStyle(u.current))},[u]),(0,r.jsx)(bf,{"data-orientation":`vertical`,...o,ref:d,sizes:i,style:{top:0,right:s.dir===`ltr`?0:void 0,left:s.dir===`rtl`?0:void 0,bottom:`var(--radix-scroll-area-corner-height)`,"--radix-scroll-area-thumb-height":kf(i)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,n)=>{if(s.viewport){let r=s.viewport.scrollTop+t.deltaY;e.onWheelScroll(r),Nf(r,n)&&t.preventDefault()}},onResize:()=>{u.current&&s.viewport&&c&&a({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:u.current.clientHeight,paddingStart:Df(c.paddingTop),paddingEnd:Df(c.paddingBottom)}})}})}),[vf,yf]=nf(uf),bf=t.forwardRef((e,n)=>{let{__scopeScrollArea:i,sizes:a,hasThumb:o,onThumbChange:s,onThumbPointerUp:c,onThumbPointerDown:l,onThumbPositionChange:u,onDragScroll:d,onWheelScroll:f,onResize:p,...m}=e,h=of(uf,i),[g,_]=t.useState(null),v=L(n,e=>_(e)),y=t.useRef(null),b=t.useRef(``),x=h.viewport,S=a.content-a.viewport,C=Vn(f),w=Vn(u),T=Ff(p,10);function E(e){y.current&&d({x:e.clientX-y.current.left,y:e.clientY-y.current.top})}return t.useEffect(()=>{let e=e=>{let t=e.target;g?.contains(t)&&C(e,S)};return document.addEventListener(`wheel`,e,{passive:!1}),()=>document.removeEventListener(`wheel`,e,{passive:!1})},[x,g,S,C]),t.useEffect(w,[a,w]),If(g,T),If(h.content,T),(0,r.jsx)(vf,{scope:i,scrollbar:g,hasThumb:o,onThumbChange:Vn(s),onThumbPointerUp:Vn(c),onThumbPositionChange:w,onThumbPointerDown:Vn(l),children:(0,r.jsx)(R.div,{...m,ref:v,style:{position:`absolute`,...m.style},onPointerDown:z(e.onPointerDown,e=>{e.button===0&&(e.target.setPointerCapture(e.pointerId),y.current=g.getBoundingClientRect(),b.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect=`none`,h.viewport&&(h.viewport.style.scrollBehavior=`auto`),E(e))}),onPointerMove:z(e.onPointerMove,E),onPointerUp:z(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=b.current,h.viewport&&(h.viewport.style.scrollBehavior=``),y.current=null})})})}),xf=`ScrollAreaThumb`,Sf=t.forwardRef((e,t)=>{let{forceMount:n,...i}=e,a=yf(xf,e.__scopeScrollArea);return(0,r.jsx)(An,{present:n||a.hasThumb,children:(0,r.jsx)(Cf,{ref:t,...i})})}),Cf=t.forwardRef((e,n)=>{let{__scopeScrollArea:i,style:a,...o}=e,s=of(xf,i),c=yf(xf,i),{onThumbPositionChange:l}=c,u=L(n,e=>c.onThumbChange(e)),d=t.useRef(void 0),f=Ff(()=>{d.current&&=(d.current(),void 0)},100);return t.useEffect(()=>{let e=s.viewport;if(e){let t=()=>{f(),d.current||(d.current=Pf(e,l),l())};return l(),e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)}},[s.viewport,f,l]),(0,r.jsx)(R.div,{"data-state":c.hasThumb?`visible`:`hidden`,...o,ref:u,style:{width:`var(--radix-scroll-area-thumb-width)`,height:`var(--radix-scroll-area-thumb-height)`,...a},onPointerDownCapture:z(e.onPointerDownCapture,e=>{let t=e.target.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top;c.onThumbPointerDown({x:n,y:r})}),onPointerUp:z(e.onPointerUp,c.onThumbPointerUp)})});Sf.displayName=xf;var wf=`ScrollAreaCorner`,Tf=t.forwardRef((e,t)=>{let n=of(wf,e.__scopeScrollArea),i=!!(n.scrollbarX&&n.scrollbarY);return n.type!==`scroll`&&i?(0,r.jsx)(Ef,{...e,ref:t}):null});Tf.displayName=wf;var Ef=t.forwardRef((e,n)=>{let{__scopeScrollArea:i,...a}=e,o=of(wf,i),[s,c]=t.useState(0),[l,u]=t.useState(0),d=!!(s&&l);return If(o.scrollbarX,()=>{let e=o.scrollbarX?.offsetHeight||0;o.onCornerHeightChange(e),u(e)}),If(o.scrollbarY,()=>{let e=o.scrollbarY?.offsetWidth||0;o.onCornerWidthChange(e),c(e)}),d?(0,r.jsx)(R.div,{...a,ref:n,style:{width:s,height:l,position:`absolute`,right:o.dir===`ltr`?0:void 0,left:o.dir===`rtl`?0:void 0,bottom:0,...e.style}}):null});function Df(e){return e?parseInt(e,10):0}function Of(e,t){let n=e/t;return isNaN(n)?0:n}function kf(e){let t=Of(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function Af(e,t,n,r=`ltr`){let i=kf(n),a=i/2,o=t||a,s=i-o,c=n.scrollbar.paddingStart+o,l=n.scrollbar.size-n.scrollbar.paddingEnd-s,u=n.content-n.viewport,d=r===`ltr`?[0,u]:[u*-1,0];return Mf([c,l],d)(e)}function jf(e,t,n=`ltr`){let r=kf(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-i,o=t.content-t.viewport,s=a-r,c=xd(e,n===`ltr`?[0,o]:[o*-1,0]);return Mf([0,o],[0,s])(c)}function Mf(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function Nf(e,t){return e>0&&e<t}var Pf=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return(function i(){let a={left:e.scrollLeft,top:e.scrollTop},o=n.left!==a.left,s=n.top!==a.top;(o||s)&&t(),n=a,r=window.requestAnimationFrame(i)})(),()=>window.cancelAnimationFrame(r)};function Ff(e,n){let r=Vn(e),i=t.useRef(0);return t.useEffect(()=>()=>window.clearTimeout(i.current),[]),t.useCallback(()=>{window.clearTimeout(i.current),i.current=window.setTimeout(r,n)},[r,n])}function If(e,t){let n=Vn(t);wn(()=>{let t=0;if(e){let r=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(n)});return r.observe(e),()=>{window.cancelAnimationFrame(t),r.unobserve(e)}}},[e,n])}var Lf=sf,Rf=lf,zf=df,Bf=Sf,Vf=Tf,Hf=[` `,`Enter`,`ArrowUp`,`ArrowDown`],Uf=[` `,`Enter`],Wf=`Select`,[Gf,Kf,qf]=Cn(Wf),[Jf,Yf]=xn(Wf,[qf,tc]),Xf=tc(),[Zf,Qf]=Jf(Wf),[$f,ep]=Jf(Wf),tp=e=>{let{__scopeSelect:n,children:i,open:a,defaultOpen:o,onOpenChange:s,value:c,defaultValue:l,onValueChange:u,dir:d,name:f,autoComplete:p,disabled:m,required:h,form:g}=e,_=Xf(n),[v,y]=t.useState(null),[b,x]=t.useState(null),[S,C]=t.useState(!1),w=zn(d),[T,E]=En({prop:a,defaultProp:o??!1,onChange:s,caller:Wf}),[D,O]=En({prop:c,defaultProp:l,onChange:u,caller:Wf}),k=t.useRef(null),A=v?g||!!v.closest(`form`):!0,[j,M]=t.useState(new Set),N=Array.from(j).map(e=>e.props.value).join(`;`);return(0,r.jsx)(_c,{..._,children:(0,r.jsxs)(Zf,{required:h,scope:n,trigger:v,onTriggerChange:y,valueNode:b,onValueNodeChange:x,valueNodeHasChildren:S,onValueNodeHasChildrenChange:C,contentId:In(),value:D,onValueChange:O,open:T,onOpenChange:E,dir:w,triggerPointerDownPosRef:k,disabled:m,children:[(0,r.jsx)(Gf.Provider,{scope:n,children:(0,r.jsx)($f,{scope:e.__scopeSelect,onNativeOptionAdd:t.useCallback(e=>{M(t=>new Set(t).add(e))},[]),onNativeOptionRemove:t.useCallback(e=>{M(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:i})}),A?(0,r.jsxs)(Xp,{"aria-hidden":!0,required:h,tabIndex:-1,name:f,autoComplete:p,value:D,onChange:e=>O(e.target.value),disabled:m,form:g,children:[D===void 0?(0,r.jsx)(`option`,{value:``}):null,Array.from(j)]},N):null]})})};tp.displayName=Wf;var np=`SelectTrigger`,rp=t.forwardRef((e,n)=>{let{__scopeSelect:i,disabled:a=!1,...o}=e,s=Xf(i),c=Qf(np,i),l=c.disabled||a,u=L(n,c.onTriggerChange),d=Kf(i),f=t.useRef(`touch`),[p,m,h]=Qp(e=>{let t=d().filter(e=>!e.disabled),n=$p(t,e,t.find(e=>e.value===c.value));n!==void 0&&c.onValueChange(n.value)}),g=e=>{l||(c.onOpenChange(!0),h()),e&&(c.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,r.jsx)(vc,{asChild:!0,...s,children:(0,r.jsx)(R.button,{type:`button`,role:`combobox`,"aria-controls":c.contentId,"aria-expanded":c.open,"aria-required":c.required,"aria-autocomplete":`none`,dir:c.dir,"data-state":c.open?`open`:`closed`,disabled:l,"data-disabled":l?``:void 0,"data-placeholder":Zp(c.value)?``:void 0,...o,ref:u,onClick:z(o.onClick,e=>{e.currentTarget.focus(),f.current!==`mouse`&&g(e)}),onPointerDown:z(o.onPointerDown,e=>{f.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(g(e),e.preventDefault())}),onKeyDown:z(o.onKeyDown,e=>{let t=p.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&m(e.key),!(t&&e.key===` `)&&Hf.includes(e.key)&&(g(),e.preventDefault())})})})});rp.displayName=np;var ip=`SelectValue`,ap=t.forwardRef((e,t)=>{let{__scopeSelect:n,className:i,style:a,children:o,placeholder:s=``,...c}=e,l=Qf(ip,n),{onValueNodeHasChildrenChange:u}=l,d=o!==void 0,f=L(t,l.onValueNodeChange);return wn(()=>{u(d)},[u,d]),(0,r.jsx)(R.span,{...c,ref:f,style:{pointerEvents:`none`},children:Zp(l.value)?(0,r.jsx)(r.Fragment,{children:s}):o})});ap.displayName=ip;var op=`SelectIcon`,sp=t.forwardRef((e,t)=>{let{__scopeSelect:n,children:i,...a}=e;return(0,r.jsx)(R.span,{"aria-hidden":!0,...a,ref:t,children:i||`▼`})});sp.displayName=op;var cp=`SelectPortal`,lp=e=>(0,r.jsx)(yr,{asChild:!0,...e});lp.displayName=cp;var up=`SelectContent`,dp=t.forwardRef((e,i)=>{let a=Qf(up,e.__scopeSelect),[o,s]=t.useState();if(wn(()=>{s(new DocumentFragment)},[]),!a.open){let t=o;return t?n.createPortal((0,r.jsx)(pp,{scope:e.__scopeSelect,children:(0,r.jsx)(Gf.Slot,{scope:e.__scopeSelect,children:(0,r.jsx)(`div`,{children:e.children})})}),t):null}return(0,r.jsx)(_p,{...e,ref:i})});dp.displayName=up;var fp=10,[pp,mp]=Jf(up),hp=`SelectContentImpl`,gp=on(`SelectContent.RemoveScroll`),_p=t.forwardRef((e,n)=>{let{__scopeSelect:i,position:a=`item-aligned`,onCloseAutoFocus:o,onEscapeKeyDown:s,onPointerDownOutside:c,side:l,sideOffset:u,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:_,avoidCollisions:v,...y}=e,b=Qf(up,i),[x,S]=t.useState(null),[C,w]=t.useState(null),T=L(n,e=>S(e)),[E,D]=t.useState(null),[O,k]=t.useState(null),A=Kf(i),[j,M]=t.useState(!1),N=t.useRef(!1);t.useEffect(()=>{if(x)return Vi(x)},[x]),xr();let P=t.useCallback(e=>{let[t,...n]=A().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&C&&(C.scrollTop=0),n===r&&C&&(C.scrollTop=C.scrollHeight),n?.focus(),document.activeElement!==i))return},[A,C]),ee=t.useCallback(()=>P([E,x]),[P,E,x]);t.useEffect(()=>{j&&ee()},[j,ee]);let{onOpenChange:F,triggerPointerDownPosRef:te}=b;t.useEffect(()=>{if(x){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(te.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(te.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():x.contains(n.target)||F(!1),document.removeEventListener(`pointermove`,t),te.current=null};return te.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[x,F,te]),t.useEffect(()=>{let e=()=>F(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[F]);let[I,ne]=Qp(e=>{let t=A().filter(e=>!e.disabled),n=$p(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),re=t.useCallback((e,t,n)=>{let r=!N.current&&!n;(b.value!==void 0&&b.value===t||r)&&(D(e),r&&(N.current=!0))},[b.value]),ie=t.useCallback(()=>x?.focus(),[x]),ae=t.useCallback((e,t,n)=>{let r=!N.current&&!n;(b.value!==void 0&&b.value===t||r)&&k(e)},[b.value]),oe=a===`popper`?xp:yp,se=oe===xp?{side:l,sideOffset:u,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:_,avoidCollisions:v}:{};return(0,r.jsx)(pp,{scope:i,content:x,viewport:C,onViewportChange:w,itemRefCallback:re,selectedItem:E,onItemLeave:ie,itemTextRefCallback:ae,focusSelectedItem:ee,selectedItemText:O,position:a,isPositioned:j,searchRef:I,children:(0,r.jsx)(Mi,{as:gp,allowPinchZoom:!0,children:(0,r.jsx)(or,{asChild:!0,trapped:b.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:z(o,e=>{b.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,r.jsx)(Yn,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>b.onOpenChange(!1),children:(0,r.jsx)(oe,{role:`listbox`,id:b.contentId,"data-state":b.open?`open`:`closed`,dir:b.dir,onContextMenu:e=>e.preventDefault(),...y,...se,onPlaced:()=>M(!0),ref:T,style:{display:`flex`,flexDirection:`column`,outline:`none`,...y.style},onKeyDown:z(y.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&ne(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=A().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>P(t)),e.preventDefault()}})})})})})})});_p.displayName=hp;var vp=`SelectItemAlignedPosition`,yp=t.forwardRef((e,n)=>{let{__scopeSelect:i,onPlaced:a,...o}=e,s=Qf(up,i),c=mp(up,i),[l,u]=t.useState(null),[d,f]=t.useState(null),p=L(n,e=>f(e)),m=Kf(i),h=t.useRef(!1),g=t.useRef(!0),{viewport:_,selectedItem:v,selectedItemText:y,focusSelectedItem:b}=c,x=t.useCallback(()=>{if(s.trigger&&s.valueNode&&l&&d&&_&&v&&y){let e=s.trigger.getBoundingClientRect(),t=d.getBoundingClientRect(),n=s.valueNode.getBoundingClientRect(),r=y.getBoundingClientRect();if(s.dir!==`rtl`){let i=r.left-t.left,a=n.left-i,o=e.left-a,s=e.width+o,c=Math.max(s,t.width),u=window.innerWidth-fp,d=xd(a,[fp,Math.max(fp,u-c)]);l.style.minWidth=s+`px`,l.style.left=d+`px`}else{let i=t.right-r.right,a=window.innerWidth-n.right-i,o=window.innerWidth-e.right-a,s=e.width+o,c=Math.max(s,t.width),u=window.innerWidth-fp,d=xd(a,[fp,Math.max(fp,u-c)]);l.style.minWidth=s+`px`,l.style.right=d+`px`}let i=m(),o=window.innerHeight-fp*2,c=_.scrollHeight,u=window.getComputedStyle(d),f=parseInt(u.borderTopWidth,10),p=parseInt(u.paddingTop,10),g=parseInt(u.borderBottomWidth,10),b=parseInt(u.paddingBottom,10),x=f+p+c+b+g,S=Math.min(v.offsetHeight*5,x),C=window.getComputedStyle(_),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-fp,D=o-E,O=v.offsetHeight/2,k=v.offsetTop+O,A=f+p+k,j=x-A;if(A<=E){let e=i.length>0&&v===i[i.length-1].ref.current;l.style.bottom=`0px`;let t=d.clientHeight-_.offsetTop-_.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+g);l.style.height=n+`px`}else{let e=i.length>0&&v===i[0].ref.current;l.style.top=`0px`;let t=Math.max(E,f+_.offsetTop+(e?w:0)+O)+j;l.style.height=t+`px`,_.scrollTop=A-E+_.offsetTop}l.style.margin=`${fp}px 0`,l.style.minHeight=S+`px`,l.style.maxHeight=o+`px`,a?.(),requestAnimationFrame(()=>h.current=!0)}},[m,s.trigger,s.valueNode,l,d,_,v,y,s.dir,a]);wn(()=>x(),[x]);let[S,C]=t.useState();return wn(()=>{d&&C(window.getComputedStyle(d).zIndex)},[d]),(0,r.jsx)(Sp,{scope:i,contentWrapper:l,shouldExpandOnScrollRef:h,onScrollButtonChange:t.useCallback(e=>{e&&g.current===!0&&(x(),b?.(),g.current=!1)},[x,b]),children:(0,r.jsx)(`div`,{ref:u,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:S},children:(0,r.jsx)(R.div,{...o,ref:p,style:{boxSizing:`border-box`,maxHeight:`100%`,...o.style}})})})});yp.displayName=vp;var bp=`SelectPopperPosition`,xp=t.forwardRef((e,t)=>{let{__scopeSelect:n,align:i=`start`,collisionPadding:a=fp,...o}=e,s=Xf(n);return(0,r.jsx)(yc,{...s,...o,ref:t,align:i,collisionPadding:a,style:{boxSizing:`border-box`,...o.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});xp.displayName=bp;var[Sp,Cp]=Jf(up,{}),wp=`SelectViewport`,Tp=t.forwardRef((e,n)=>{let{__scopeSelect:i,nonce:a,...o}=e,s=mp(wp,i),c=Cp(wp,i),l=L(n,s.onViewportChange),u=t.useRef(0);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:a}),(0,r.jsx)(Gf.Slot,{scope:i,children:(0,r.jsx)(R.div,{"data-radix-select-viewport":``,role:`presentation`,...o,ref:l,style:{position:`relative`,flex:1,overflow:`hidden auto`,...o.style},onScroll:z(o.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=c;if(r?.current&&n){let e=Math.abs(u.current-t.scrollTop);if(e>0){let r=window.innerHeight-fp*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}u.current=t.scrollTop})})})]})});Tp.displayName=wp;var Ep=`SelectGroup`,[Dp,Op]=Jf(Ep),kp=t.forwardRef((e,t)=>{let{__scopeSelect:n,...i}=e,a=In();return(0,r.jsx)(Dp,{scope:n,id:a,children:(0,r.jsx)(R.div,{role:`group`,"aria-labelledby":a,...i,ref:t})})});kp.displayName=Ep;var Ap=`SelectLabel`,jp=t.forwardRef((e,t)=>{let{__scopeSelect:n,...i}=e,a=Op(Ap,n);return(0,r.jsx)(R.div,{id:a.id,...i,ref:t})});jp.displayName=Ap;var Mp=`SelectItem`,[Np,Pp]=Jf(Mp),Fp=t.forwardRef((e,n)=>{let{__scopeSelect:i,value:a,disabled:o=!1,textValue:s,...c}=e,l=Qf(Mp,i),u=mp(Mp,i),d=l.value===a,[f,p]=t.useState(s??``),[m,h]=t.useState(!1),g=L(n,e=>u.itemRefCallback?.(e,a,o)),_=In(),v=t.useRef(`touch`),y=()=>{o||(l.onValueChange(a),l.onOpenChange(!1))};if(a===``)throw Error(`A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.`);return(0,r.jsx)(Np,{scope:i,value:a,disabled:o,textId:_,isSelected:d,onItemTextChange:t.useCallback(e=>{p(t=>t||(e?.textContent??``).trim())},[]),children:(0,r.jsx)(Gf.ItemSlot,{scope:i,value:a,disabled:o,textValue:f,children:(0,r.jsx)(R.div,{role:`option`,"aria-labelledby":_,"data-highlighted":m?``:void 0,"aria-selected":d&&m,"data-state":d?`checked`:`unchecked`,"aria-disabled":o||void 0,"data-disabled":o?``:void 0,tabIndex:o?void 0:-1,...c,ref:g,onFocus:z(c.onFocus,()=>h(!0)),onBlur:z(c.onBlur,()=>h(!1)),onClick:z(c.onClick,()=>{v.current!==`mouse`&&y()}),onPointerUp:z(c.onPointerUp,()=>{v.current===`mouse`&&y()}),onPointerDown:z(c.onPointerDown,e=>{v.current=e.pointerType}),onPointerMove:z(c.onPointerMove,e=>{v.current=e.pointerType,o?u.onItemLeave?.():v.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:z(c.onPointerLeave,e=>{e.currentTarget===document.activeElement&&u.onItemLeave?.()}),onKeyDown:z(c.onKeyDown,e=>{u.searchRef?.current!==``&&e.key===` `||(Uf.includes(e.key)&&y(),e.key===` `&&e.preventDefault())})})})})});Fp.displayName=Mp;var Ip=`SelectItemText`,Lp=t.forwardRef((e,i)=>{let{__scopeSelect:a,className:o,style:s,...c}=e,l=Qf(Ip,a),u=mp(Ip,a),d=Pp(Ip,a),f=ep(Ip,a),[p,m]=t.useState(null),h=L(i,e=>m(e),d.onItemTextChange,e=>u.itemTextRefCallback?.(e,d.value,d.disabled)),g=p?.textContent,_=t.useMemo(()=>(0,r.jsx)(`option`,{value:d.value,disabled:d.disabled,children:g},d.value),[d.disabled,d.value,g]),{onNativeOptionAdd:v,onNativeOptionRemove:y}=f;return wn(()=>(v(_),()=>y(_)),[v,y,_]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(R.span,{id:d.textId,...c,ref:h}),d.isSelected&&l.valueNode&&!l.valueNodeHasChildren?n.createPortal(c.children,l.valueNode):null]})});Lp.displayName=Ip;var Rp=`SelectItemIndicator`,zp=t.forwardRef((e,t)=>{let{__scopeSelect:n,...i}=e;return Pp(Rp,n).isSelected?(0,r.jsx)(R.span,{"aria-hidden":!0,...i,ref:t}):null});zp.displayName=Rp;var Bp=`SelectScrollUpButton`,Vp=t.forwardRef((e,n)=>{let i=mp(Bp,e.__scopeSelect),a=Cp(Bp,e.__scopeSelect),[o,s]=t.useState(!1),c=L(n,a.onScrollButtonChange);return wn(()=>{if(i.viewport&&i.isPositioned){let e=function(){s(t.scrollTop>0)},t=i.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[i.viewport,i.isPositioned]),o?(0,r.jsx)(Wp,{...e,ref:c,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=i;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});Vp.displayName=Bp;var Hp=`SelectScrollDownButton`,Up=t.forwardRef((e,n)=>{let i=mp(Hp,e.__scopeSelect),a=Cp(Hp,e.__scopeSelect),[o,s]=t.useState(!1),c=L(n,a.onScrollButtonChange);return wn(()=>{if(i.viewport&&i.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;s(Math.ceil(t.scrollTop)<e)},t=i.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[i.viewport,i.isPositioned]),o?(0,r.jsx)(Wp,{...e,ref:c,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=i;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});Up.displayName=Hp;var Wp=t.forwardRef((e,n)=>{let{__scopeSelect:i,onAutoScroll:a,...o}=e,s=mp(`SelectScrollButton`,i),c=t.useRef(null),l=Kf(i),u=t.useCallback(()=>{c.current!==null&&(window.clearInterval(c.current),c.current=null)},[]);return t.useEffect(()=>()=>u(),[u]),wn(()=>{l().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[l]),(0,r.jsx)(R.div,{"aria-hidden":!0,...o,ref:n,style:{flexShrink:0,...o.style},onPointerDown:z(o.onPointerDown,()=>{c.current===null&&(c.current=window.setInterval(a,50))}),onPointerMove:z(o.onPointerMove,()=>{s.onItemLeave?.(),c.current===null&&(c.current=window.setInterval(a,50))}),onPointerLeave:z(o.onPointerLeave,()=>{u()})})}),Gp=`SelectSeparator`,Kp=t.forwardRef((e,t)=>{let{__scopeSelect:n,...i}=e;return(0,r.jsx)(R.div,{"aria-hidden":!0,...i,ref:t})});Kp.displayName=Gp;var qp=`SelectArrow`,Jp=t.forwardRef((e,t)=>{let{__scopeSelect:n,...i}=e,a=Xf(n),o=Qf(qp,n),s=mp(qp,n);return o.open&&s.position===`popper`?(0,r.jsx)(bc,{...a,...i,ref:t}):null});Jp.displayName=qp;var Yp=`SelectBubbleInput`,Xp=t.forwardRef(({__scopeSelect:e,value:n,...i},a)=>{let o=t.useRef(null),s=L(a,o),c=Aa(n);return t.useEffect(()=>{let e=o.current;if(!e)return;let t=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(t,`value`).set;if(c!==n&&r){let t=new Event(`change`,{bubbles:!0});r.call(e,n),e.dispatchEvent(t)}},[c,n]),(0,r.jsx)(R.select,{...i,style:{...gn,...i.style},ref:s,defaultValue:n})});Xp.displayName=Yp;function Zp(e){return e===``||e===void 0}function Qp(e){let n=Vn(e),r=t.useRef(``),i=t.useRef(0),a=t.useCallback(e=>{let t=r.current+e;n(t),(function e(t){r.current=t,window.clearTimeout(i.current),t!==``&&(i.current=window.setTimeout(()=>e(``),1e3))})(t)},[n]),o=t.useCallback(()=>{r.current=``,window.clearTimeout(i.current)},[]);return t.useEffect(()=>()=>window.clearTimeout(i.current),[]),[r,a,o]}function $p(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=em(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function em(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var tm=tp,nm=rp,rm=ap,im=sp,am=lp,om=dp,sm=Tp,cm=kp,lm=jp,um=Fp,dm=Lp,fm=zp,pm=Kp,mm=[`PageUp`,`PageDown`],hm=[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`],gm={"from-left":[`Home`,`PageDown`,`ArrowDown`,`ArrowLeft`],"from-right":[`Home`,`PageDown`,`ArrowDown`,`ArrowRight`],"from-bottom":[`Home`,`PageDown`,`ArrowDown`,`ArrowLeft`],"from-top":[`Home`,`PageDown`,`ArrowUp`,`ArrowLeft`]},_m=`Slider`,[vm,ym,bm]=Cn(_m),[xm,Sm]=xn(_m,[bm]),[Cm,wm]=xm(_m),Tm=t.forwardRef((e,n)=>{let{name:i,min:a=0,max:o=100,step:s=1,orientation:c=`horizontal`,disabled:l=!1,minStepsBetweenThumbs:u=0,defaultValue:d=[a],value:f,onValueChange:p=()=>{},onValueCommit:m=()=>{},inverted:h=!1,form:g,..._}=e,v=t.useRef(new Set),y=t.useRef(0),b=c===`horizontal`?Om:km,[x=[],S]=En({prop:f,defaultProp:d,onChange:e=>{[...v.current][y.current]?.focus(),p(e)}}),C=t.useRef(x);function w(e){D(e,Um(x,e))}function T(e){D(e,y.current)}function E(){let e=C.current[y.current];x[y.current]!==e&&m(x)}function D(e,t,{commit:n}={commit:!1}){let r=Jm(s),i=xd(Ym(Math.round((e-a)/s)*s+a,r),[a,o]);S((e=[])=>{let r=Bm(e,i,t);if(Km(r,u*s)){y.current=r.indexOf(i);let t=String(r)!==String(e);return t&&n&&m(r),t?r:e}else return e})}return(0,r.jsx)(Cm,{scope:e.__scopeSlider,name:i,disabled:l,min:a,max:o,valueIndexToChangeRef:y,thumbs:v.current,values:x,orientation:c,form:g,children:(0,r.jsx)(vm.Provider,{scope:e.__scopeSlider,children:(0,r.jsx)(vm.Slot,{scope:e.__scopeSlider,children:(0,r.jsx)(b,{"aria-disabled":l,"data-disabled":l?``:void 0,..._,ref:n,onPointerDown:z(_.onPointerDown,()=>{l||(C.current=x)}),min:a,max:o,inverted:h,onSlideStart:l?void 0:w,onSlideMove:l?void 0:T,onSlideEnd:l?void 0:E,onHomeKeyDown:()=>!l&&D(a,0,{commit:!0}),onEndKeyDown:()=>!l&&D(o,x.length-1,{commit:!0}),onStepKeyDown:({event:e,direction:t})=>{if(!l){let n=mm.includes(e.key)||e.shiftKey&&hm.includes(e.key)?10:1,r=y.current,i=x[r];D(i+s*n*t,r,{commit:!0})}}})})})})});Tm.displayName=_m;var[Em,Dm]=xm(_m,{startEdge:`left`,endEdge:`right`,size:`width`,direction:1}),Om=t.forwardRef((e,n)=>{let{min:i,max:a,dir:o,inverted:s,onSlideStart:c,onSlideMove:l,onSlideEnd:u,onStepKeyDown:d,...f}=e,[p,m]=t.useState(null),h=L(n,e=>m(e)),g=t.useRef(void 0),_=zn(o),v=_===`ltr`,y=v&&!s||!v&&s;function b(e){let t=g.current||p.getBoundingClientRect(),n=qm([0,t.width],y?[i,a]:[a,i]);return g.current=t,n(e-t.left)}return(0,r.jsx)(Em,{scope:e.__scopeSlider,startEdge:y?`left`:`right`,endEdge:y?`right`:`left`,direction:y?1:-1,size:`width`,children:(0,r.jsx)(Am,{dir:_,"data-orientation":`horizontal`,...f,ref:h,style:{...f.style,"--radix-slider-thumb-transform":`translateX(-50%)`},onSlideStart:e=>{let t=b(e.clientX);c?.(t)},onSlideMove:e=>{let t=b(e.clientX);l?.(t)},onSlideEnd:()=>{g.current=void 0,u?.()},onStepKeyDown:e=>{let t=gm[y?`from-left`:`from-right`].includes(e.key);d?.({event:e,direction:t?-1:1})}})})}),km=t.forwardRef((e,n)=>{let{min:i,max:a,inverted:o,onSlideStart:s,onSlideMove:c,onSlideEnd:l,onStepKeyDown:u,...d}=e,f=t.useRef(null),p=L(n,f),m=t.useRef(void 0),h=!o;function g(e){let t=m.current||f.current.getBoundingClientRect(),n=qm([0,t.height],h?[a,i]:[i,a]);return m.current=t,n(e-t.top)}return(0,r.jsx)(Em,{scope:e.__scopeSlider,startEdge:h?`bottom`:`top`,endEdge:h?`top`:`bottom`,size:`height`,direction:h?1:-1,children:(0,r.jsx)(Am,{"data-orientation":`vertical`,...d,ref:p,style:{...d.style,"--radix-slider-thumb-transform":`translateY(50%)`},onSlideStart:e=>{let t=g(e.clientY);s?.(t)},onSlideMove:e=>{let t=g(e.clientY);c?.(t)},onSlideEnd:()=>{m.current=void 0,l?.()},onStepKeyDown:e=>{let t=gm[h?`from-bottom`:`from-top`].includes(e.key);u?.({event:e,direction:t?-1:1})}})})}),Am=t.forwardRef((e,t)=>{let{__scopeSlider:n,onSlideStart:i,onSlideMove:a,onSlideEnd:o,onHomeKeyDown:s,onEndKeyDown:c,onStepKeyDown:l,...u}=e,d=wm(_m,n);return(0,r.jsx)(R.span,{...u,ref:t,onKeyDown:z(e.onKeyDown,e=>{e.key===`Home`?(s(e),e.preventDefault()):e.key===`End`?(c(e),e.preventDefault()):mm.concat(hm).includes(e.key)&&(l(e),e.preventDefault())}),onPointerDown:z(e.onPointerDown,e=>{let t=e.target;t.setPointerCapture(e.pointerId),e.preventDefault(),d.thumbs.has(t)?t.focus():i(e)}),onPointerMove:z(e.onPointerMove,e=>{e.target.hasPointerCapture(e.pointerId)&&a(e)}),onPointerUp:z(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&(t.releasePointerCapture(e.pointerId),o(e))})})}),jm=`SliderTrack`,Mm=t.forwardRef((e,t)=>{let{__scopeSlider:n,...i}=e,a=wm(jm,n);return(0,r.jsx)(R.span,{"data-disabled":a.disabled?``:void 0,"data-orientation":a.orientation,...i,ref:t})});Mm.displayName=jm;var Nm=`SliderRange`,Pm=t.forwardRef((e,n)=>{let{__scopeSlider:i,...a}=e,o=wm(Nm,i),s=Dm(Nm,i),c=L(n,t.useRef(null)),l=o.values.length,u=o.values.map(e=>Vm(e,o.min,o.max)),d=l>1?Math.min(...u):0,f=100-Math.max(...u);return(0,r.jsx)(R.span,{"data-orientation":o.orientation,"data-disabled":o.disabled?``:void 0,...a,ref:c,style:{...e.style,[s.startEdge]:d+`%`,[s.endEdge]:f+`%`}})});Pm.displayName=Nm;var Fm=`SliderThumb`,Im=t.forwardRef((e,n)=>{let i=ym(e.__scopeSlider),[a,o]=t.useState(null),s=L(n,e=>o(e)),c=t.useMemo(()=>a?i().findIndex(e=>e.ref.current===a):-1,[i,a]);return(0,r.jsx)(Lm,{...e,ref:s,index:c})}),Lm=t.forwardRef((e,n)=>{let{__scopeSlider:i,index:a,name:o,...s}=e,c=wm(Fm,i),l=Dm(Fm,i),[u,d]=t.useState(null),f=L(n,e=>d(e)),p=u?c.form||!!u.closest(`form`):!0,m=ja(u),h=c.values[a],g=h===void 0?0:Vm(h,c.min,c.max),_=Hm(a,c.values.length),v=m?.[l.size],y=v?Wm(v,g,l.direction):0;return t.useEffect(()=>{if(u)return c.thumbs.add(u),()=>{c.thumbs.delete(u)}},[u,c.thumbs]),(0,r.jsxs)(`span`,{style:{transform:`var(--radix-slider-thumb-transform)`,position:`absolute`,[l.startEdge]:`calc(${g}% + ${y}px)`},children:[(0,r.jsx)(vm.ItemSlot,{scope:e.__scopeSlider,children:(0,r.jsx)(R.span,{role:`slider`,"aria-label":e[`aria-label`]||_,"aria-valuemin":c.min,"aria-valuenow":h,"aria-valuemax":c.max,"aria-orientation":c.orientation,"data-orientation":c.orientation,"data-disabled":c.disabled?``:void 0,tabIndex:c.disabled?void 0:0,...s,ref:f,style:h===void 0?{display:`none`}:e.style,onFocus:z(e.onFocus,()=>{c.valueIndexToChangeRef.current=a})})}),p&&(0,r.jsx)(zm,{name:o??(c.name?c.name+(c.values.length>1?`[]`:``):void 0),form:c.form,value:h},a)]})});Im.displayName=Fm;var Rm=`RadioBubbleInput`,zm=t.forwardRef(({__scopeSlider:e,value:n,...i},a)=>{let o=t.useRef(null),s=L(o,a),c=Aa(n);return t.useEffect(()=>{let e=o.current;if(!e)return;let t=window.HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(t,`value`).set;if(c!==n&&r){let t=new Event(`input`,{bubbles:!0});r.call(e,n),e.dispatchEvent(t)}},[c,n]),(0,r.jsx)(R.input,{style:{display:`none`},...i,ref:s,defaultValue:n})});zm.displayName=Rm;function Bm(e=[],t,n){let r=[...e];return r[n]=t,r.sort((e,t)=>e-t)}function Vm(e,t,n){return xd(100/(n-t)*(e-t),[0,100])}function Hm(e,t){if(t>2)return`Value ${e+1} of ${t}`;if(t===2)return[`Minimum`,`Maximum`][e]}function Um(e,t){if(e.length===1)return 0;let n=e.map(e=>Math.abs(e-t)),r=Math.min(...n);return n.indexOf(r)}function Wm(e,t,n){let r=e/2;return(r-qm([0,50],[0,r])(t)*n)*n}function Gm(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function Km(e,t){if(t>0){let n=Gm(e);return Math.min(...n)>=t}return!0}function qm(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function Jm(e){return(String(e).split(`.`)[1]||``).length}function Ym(e,t){let n=10**t;return Math.round(e*n)/n}var Xm=Tm,Zm=Mm,Qm=Pm,$m=Im,eh=`Switch`,[th,nh]=xn(eh),[rh,ih]=th(eh),ah=t.forwardRef((e,n)=>{let{__scopeSwitch:i,name:a,checked:o,defaultChecked:s,required:c,disabled:l,value:u=`on`,onCheckedChange:d,form:f,...p}=e,[m,h]=t.useState(null),g=L(n,e=>h(e)),_=t.useRef(!1),v=m?f||!!m.closest(`form`):!0,[y,b]=En({prop:o,defaultProp:s??!1,onChange:d,caller:eh});return(0,r.jsxs)(rh,{scope:i,checked:y,disabled:l,children:[(0,r.jsx)(R.button,{type:`button`,role:`switch`,"aria-checked":y,"aria-required":c,"data-state":uh(y),"data-disabled":l?``:void 0,disabled:l,value:u,...p,ref:g,onClick:z(e.onClick,e=>{b(e=>!e),v&&(_.current=e.isPropagationStopped(),_.current||e.stopPropagation())})}),v&&(0,r.jsx)(lh,{control:m,bubbles:!_.current,name:a,value:u,checked:y,required:c,disabled:l,form:f,style:{transform:`translateX(-100%)`}})]})});ah.displayName=eh;var oh=`SwitchThumb`,sh=t.forwardRef((e,t)=>{let{__scopeSwitch:n,...i}=e,a=ih(oh,n);return(0,r.jsx)(R.span,{"data-state":uh(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t})});sh.displayName=oh;var ch=`SwitchBubbleInput`,lh=t.forwardRef(({__scopeSwitch:e,control:n,checked:i,bubbles:a=!0,...o},s)=>{let c=t.useRef(null),l=L(c,s),u=Aa(i),d=ja(n);return t.useEffect(()=>{let e=c.current;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set;if(u!==i&&n){let t=new Event(`click`,{bubbles:a});n.call(e,i),e.dispatchEvent(t)}},[u,i,a]),(0,r.jsx)(`input`,{type:`checkbox`,"aria-hidden":!0,defaultChecked:i,...o,tabIndex:-1,ref:l,style:{...o.style,...d,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0}})});lh.displayName=ch;function uh(e){return e?`checked`:`unchecked`}var dh=ah,fh=sh,ph=`Tabs`,[mh,hh]=xn(ph,[Oc]),gh=Oc(),[_h,vh]=mh(ph),yh=t.forwardRef((e,t)=>{let{__scopeTabs:n,value:i,onValueChange:a,defaultValue:o,orientation:s=`horizontal`,dir:c,activationMode:l=`automatic`,...u}=e,d=zn(c),[f,p]=En({prop:i,onChange:a,defaultProp:o??``,caller:ph});return(0,r.jsx)(_h,{scope:n,baseId:In(),value:f,onValueChange:p,orientation:s,dir:d,activationMode:l,children:(0,r.jsx)(R.div,{dir:d,"data-orientation":s,...u,ref:t})})});yh.displayName=ph;var bh=`TabsList`,xh=t.forwardRef((e,t)=>{let{__scopeTabs:n,loop:i=!0,...a}=e,o=vh(bh,n),s=gh(n);return(0,r.jsx)(Bc,{asChild:!0,...s,orientation:o.orientation,dir:o.dir,loop:i,children:(0,r.jsx)(R.div,{role:`tablist`,"aria-orientation":o.orientation,...a,ref:t})})});xh.displayName=bh;var Sh=`TabsTrigger`,Ch=t.forwardRef((e,t)=>{let{__scopeTabs:n,value:i,disabled:a=!1,...o}=e,s=vh(Sh,n),c=gh(n),l=Eh(s.baseId,i),u=Dh(s.baseId,i),d=i===s.value;return(0,r.jsx)(Vc,{asChild:!0,...c,focusable:!a,active:d,children:(0,r.jsx)(R.button,{type:`button`,role:`tab`,"aria-selected":d,"aria-controls":u,"data-state":d?`active`:`inactive`,"data-disabled":a?``:void 0,disabled:a,id:l,...o,ref:t,onMouseDown:z(e.onMouseDown,e=>{!a&&e.button===0&&e.ctrlKey===!1?s.onValueChange(i):e.preventDefault()}),onKeyDown:z(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&s.onValueChange(i)}),onFocus:z(e.onFocus,()=>{let e=s.activationMode!==`manual`;!d&&!a&&e&&s.onValueChange(i)})})})});Ch.displayName=Sh;var wh=`TabsContent`,Th=t.forwardRef((e,n)=>{let{__scopeTabs:i,value:a,forceMount:o,children:s,...c}=e,l=vh(wh,i),u=Eh(l.baseId,a),d=Dh(l.baseId,a),f=a===l.value,p=t.useRef(f);return t.useEffect(()=>{let e=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,r.jsx)(An,{present:o||f,children:({present:t})=>(0,r.jsx)(R.div,{"data-state":f?`active`:`inactive`,"data-orientation":l.orientation,role:`tabpanel`,"aria-labelledby":u,hidden:!t,id:d,tabIndex:0,...c,ref:n,style:{...e.style,animationDuration:p.current?`0s`:void 0},children:t&&s})})});Th.displayName=wh;function Eh(e,t){return`${e}-trigger-${t}`}function Dh(e,t){return`${e}-content-${t}`}var Oh=yh,kh=xh,Ah=Ch,jh=Th,Mh=`Toggle`,Nh=t.forwardRef((e,t)=>{let{pressed:n,defaultPressed:i,onPressedChange:a,...o}=e,[s,c]=En({prop:n,onChange:a,defaultProp:i??!1,caller:Mh});return(0,r.jsx)(R.button,{type:`button`,"aria-pressed":s,"data-state":s?`on`:`off`,"data-disabled":e.disabled?``:void 0,...o,ref:t,onClick:z(e.onClick,()=>{e.disabled||c(!s)})})});Nh.displayName=Mh;var Ph=`ToggleGroup`,[Fh,Ih]=xn(Ph,[Oc]),Lh=Oc(),Rh=t.default.forwardRef((e,t)=>{let{type:n,...i}=e;if(n===`single`)return(0,r.jsx)(Vh,{...i,ref:t});if(n===`multiple`)return(0,r.jsx)(Hh,{...i,ref:t});throw Error(`Missing prop \`type\` expected on \`${Ph}\``)});Rh.displayName=Ph;var[zh,Bh]=Fh(Ph),Vh=t.default.forwardRef((e,n)=>{let{value:i,defaultValue:a,onValueChange:o=()=>{},...s}=e,[c,l]=En({prop:i,defaultProp:a??``,onChange:o,caller:Ph});return(0,r.jsx)(zh,{scope:e.__scopeToggleGroup,type:`single`,value:t.default.useMemo(()=>c?[c]:[],[c]),onItemActivate:l,onItemDeactivate:t.default.useCallback(()=>l(``),[l]),children:(0,r.jsx)(Gh,{...s,ref:n})})}),Hh=t.default.forwardRef((e,n)=>{let{value:i,defaultValue:a,onValueChange:o=()=>{},...s}=e,[c,l]=En({prop:i,defaultProp:a??[],onChange:o,caller:Ph}),u=t.default.useCallback(e=>l((t=[])=>[...t,e]),[l]),d=t.default.useCallback(e=>l((t=[])=>t.filter(t=>t!==e)),[l]);return(0,r.jsx)(zh,{scope:e.__scopeToggleGroup,type:`multiple`,value:c,onItemActivate:u,onItemDeactivate:d,children:(0,r.jsx)(Gh,{...s,ref:n})})});Rh.displayName=Ph;var[Uh,Wh]=Fh(Ph),Gh=t.default.forwardRef((e,t)=>{let{__scopeToggleGroup:n,disabled:i=!1,rovingFocus:a=!0,orientation:o,dir:s,loop:c=!0,...l}=e,u=Lh(n),d=zn(s),f={role:`group`,dir:d,...l};return(0,r.jsx)(Uh,{scope:n,rovingFocus:a,disabled:i,children:a?(0,r.jsx)(Bc,{asChild:!0,...u,orientation:o,dir:d,loop:c,children:(0,r.jsx)(R.div,{...f,ref:t})}):(0,r.jsx)(R.div,{...f,ref:t})})}),Kh=`ToggleGroupItem`,qh=t.default.forwardRef((e,n)=>{let i=Bh(Kh,e.__scopeToggleGroup),a=Wh(Kh,e.__scopeToggleGroup),o=Lh(e.__scopeToggleGroup),s=i.value.includes(e.value),c=a.disabled||e.disabled,l={...e,pressed:s,disabled:c},u=t.default.useRef(null);return a.rovingFocus?(0,r.jsx)(Vc,{asChild:!0,...o,focusable:!c,active:s,ref:u,children:(0,r.jsx)(Jh,{...l,ref:n})}):(0,r.jsx)(Jh,{...l,ref:n})});qh.displayName=Kh;var Jh=t.default.forwardRef((e,t)=>{let{__scopeToggleGroup:n,value:i,...a}=e,o=Bh(Kh,n),s={role:`radio`,"aria-checked":e.pressed,"aria-pressed":void 0};return(0,r.jsx)(Nh,{...o.type===`single`?s:void 0,...a,ref:t,onPressedChange:e=>{e?o.onItemActivate(i):o.onItemDeactivate(i)}})}),Yh=Rh,Xh=qh,[Zh,Qh]=xn(`Tooltip`,[tc]),$h=tc(),eg=`TooltipProvider`,tg=700,ng=`tooltip.open`,[rg,ig]=Zh(eg),ag=e=>{let{__scopeTooltip:n,delayDuration:i=tg,skipDelayDuration:a=300,disableHoverableContent:o=!1,children:s}=e,c=t.useRef(!0),l=t.useRef(!1),u=t.useRef(0);return t.useEffect(()=>{let e=u.current;return()=>window.clearTimeout(e)},[]),(0,r.jsx)(rg,{scope:n,isOpenDelayedRef:c,delayDuration:i,onOpen:t.useCallback(()=>{window.clearTimeout(u.current),c.current=!1},[]),onClose:t.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>c.current=!0,a)},[a]),isPointerInTransitRef:l,onPointerInTransitChange:t.useCallback(e=>{l.current=e},[]),disableHoverableContent:o,children:s})};ag.displayName=eg;var og=`Tooltip`,[sg,cg]=Zh(og),lg=e=>{let{__scopeTooltip:n,children:i,open:a,defaultOpen:o,onOpenChange:s,disableHoverableContent:c,delayDuration:l}=e,u=ig(og,e.__scopeTooltip),d=$h(n),[f,p]=t.useState(null),m=In(),h=t.useRef(0),g=c??u.disableHoverableContent,_=l??u.delayDuration,v=t.useRef(!1),[y,b]=En({prop:a,defaultProp:o??!1,onChange:e=>{e?(u.onOpen(),document.dispatchEvent(new CustomEvent(ng))):u.onClose(),s?.(e)},caller:og}),x=t.useMemo(()=>y?v.current?`delayed-open`:`instant-open`:`closed`,[y]),S=t.useCallback(()=>{window.clearTimeout(h.current),h.current=0,v.current=!1,b(!0)},[b]),C=t.useCallback(()=>{window.clearTimeout(h.current),h.current=0,b(!1)},[b]),w=t.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{v.current=!0,b(!0),h.current=0},_)},[_,b]);return t.useEffect(()=>()=>{h.current&&=(window.clearTimeout(h.current),0)},[]),(0,r.jsx)(_c,{...d,children:(0,r.jsx)(sg,{scope:n,contentId:m,open:y,stateAttribute:x,trigger:f,onTriggerChange:p,onTriggerEnter:t.useCallback(()=>{u.isOpenDelayedRef.current?w():S()},[u.isOpenDelayedRef,w,S]),onTriggerLeave:t.useCallback(()=>{g?C():(window.clearTimeout(h.current),h.current=0)},[C,g]),onOpen:S,onClose:C,disableHoverableContent:g,children:i})})};lg.displayName=og;var ug=`TooltipTrigger`,dg=t.forwardRef((e,n)=>{let{__scopeTooltip:i,...a}=e,o=cg(ug,i),s=ig(ug,i),c=$h(i),l=L(n,t.useRef(null),o.onTriggerChange),u=t.useRef(!1),d=t.useRef(!1),f=t.useCallback(()=>u.current=!1,[]);return t.useEffect(()=>()=>document.removeEventListener(`pointerup`,f),[f]),(0,r.jsx)(vc,{asChild:!0,...c,children:(0,r.jsx)(R.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...a,ref:l,onPointerMove:z(e.onPointerMove,e=>{e.pointerType!==`touch`&&!d.current&&!s.isPointerInTransitRef.current&&(o.onTriggerEnter(),d.current=!0)}),onPointerLeave:z(e.onPointerLeave,()=>{o.onTriggerLeave(),d.current=!1}),onPointerDown:z(e.onPointerDown,()=>{o.open&&o.onClose(),u.current=!0,document.addEventListener(`pointerup`,f,{once:!0})}),onFocus:z(e.onFocus,()=>{u.current||o.onOpen()}),onBlur:z(e.onBlur,o.onClose),onClick:z(e.onClick,o.onClose)})})});dg.displayName=ug;var fg=`TooltipPortal`,[pg,mg]=Zh(fg,{forceMount:void 0}),hg=e=>{let{__scopeTooltip:t,forceMount:n,children:i,container:a}=e,o=cg(fg,t);return(0,r.jsx)(pg,{scope:t,forceMount:n,children:(0,r.jsx)(An,{present:n||o.open,children:(0,r.jsx)(yr,{asChild:!0,container:a,children:i})})})};hg.displayName=fg;var gg=`TooltipContent`,_g=t.forwardRef((e,t)=>{let n=mg(gg,e.__scopeTooltip),{forceMount:i=n.forceMount,side:a=`top`,...o}=e,s=cg(gg,e.__scopeTooltip);return(0,r.jsx)(An,{present:i||s.open,children:s.disableHoverableContent?(0,r.jsx)(Sg,{side:a,...o,ref:t}):(0,r.jsx)(vg,{side:a,...o,ref:t})})}),vg=t.forwardRef((e,n)=>{let i=cg(gg,e.__scopeTooltip),a=ig(gg,e.__scopeTooltip),o=t.useRef(null),s=L(n,o),[c,l]=t.useState(null),{trigger:u,onClose:d}=i,f=o.current,{onPointerInTransitChange:p}=a,m=t.useCallback(()=>{l(null),p(!1)},[p]),h=t.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=Eg(r,Tg(r,n.getBoundingClientRect())),a=Dg(t.getBoundingClientRect());l(kg([...i,...a])),p(!0)},[p]);return t.useEffect(()=>()=>m(),[m]),t.useEffect(()=>{if(u&&f){let e=e=>h(e,f),t=e=>h(e,u);return u.addEventListener(`pointerleave`,e),f.addEventListener(`pointerleave`,t),()=>{u.removeEventListener(`pointerleave`,e),f.removeEventListener(`pointerleave`,t)}}},[u,f,h,m]),t.useEffect(()=>{if(c){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=u?.contains(t)||f?.contains(t),i=!Og(n,c);r?m():i&&(m(),d())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[u,f,c,d,m]),(0,r.jsx)(Sg,{...e,ref:s})}),[yg,bg]=Zh(og,{isInside:!1}),xg=un(`TooltipContent`),Sg=t.forwardRef((e,n)=>{let{__scopeTooltip:i,children:a,"aria-label":o,onEscapeKeyDown:s,onPointerDownOutside:c,...l}=e,u=cg(gg,i),d=$h(i),{onClose:f}=u;return t.useEffect(()=>(document.addEventListener(ng,f),()=>document.removeEventListener(ng,f)),[f]),t.useEffect(()=>{if(u.trigger){let e=e=>{e.target?.contains(u.trigger)&&f()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[u.trigger,f]),(0,r.jsx)(Yn,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:e=>e.preventDefault(),onDismiss:f,children:(0,r.jsxs)(yc,{"data-state":u.stateAttribute,...d,...l,ref:n,style:{...l.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,r.jsx)(xg,{children:a}),(0,r.jsx)(yg,{scope:i,isInside:!0,children:(0,r.jsx)(yn,{id:u.contentId,role:`tooltip`,children:o||a})})]})})});_g.displayName=gg;var Cg=`TooltipArrow`,wg=t.forwardRef((e,t)=>{let{__scopeTooltip:n,...i}=e,a=$h(n);return bg(Cg,n).isInside?null:(0,r.jsx)(bc,{...a,...i,ref:t})});wg.displayName=Cg;function Tg(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function Eg(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function Dg(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function Og(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function kg(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:e.y>t.y?1:0),Ag(t)}function Ag(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var jg=ag,Mg=lg,Ng=dg,Pg=hg,Fg=_g,Ig=wg,B=f(((e,t)=>{(function(){var e={}.hasOwnProperty;function n(){for(var e=``,t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=i(e,r(n)))}return e}function r(t){if(typeof t==`string`||typeof t==`number`)return t;if(typeof t!=`object`)return``;if(Array.isArray(t))return n.apply(null,t);if(t.toString!==Object.prototype.toString&&!t.toString.toString().includes(`[native code]`))return t.toString();var r=``;for(var a in t)e.call(t,a)&&t[a]&&(r=i(r,a));return r}function i(e,t){return t?e?e+` `+t:e+t:e}t!==void 0&&t.exports?(n.default=n,t.exports=n):typeof define==`function`&&typeof define.amd==`object`&&define.amd?define(`classnames`,[],function(){return n}):window.classNames=n})()})),Lg={asChild:{type:`boolean`}},Rg={width:{type:`string`,className:`rt-r-w`,customProperties:[`--width`],responsive:!0},minWidth:{type:`string`,className:`rt-r-min-w`,customProperties:[`--min-width`],responsive:!0},maxWidth:{type:`string`,className:`rt-r-max-w`,customProperties:[`--max-width`],responsive:!0}},zg={height:{type:`string`,className:`rt-r-h`,customProperties:[`--height`],responsive:!0},minHeight:{type:`string`,className:`rt-r-min-h`,customProperties:[`--min-height`],responsive:!0},maxHeight:{type:`string`,className:`rt-r-max-h`,customProperties:[`--max-height`],responsive:!0}},Bg=[`1`,`2`,`3`,`4`],Vg={...Lg,align:{type:`enum`,className:`rt-r-align`,values:[`start`,`center`],default:`center`},size:{type:`enum`,className:`rt-r-size`,values:Bg,default:`3`,responsive:!0},width:Rg.width,minWidth:Rg.minWidth,maxWidth:{...Rg.maxWidth,default:`600px`},...zg},Hg=`gray.gold.bronze.brown.yellow.amber.orange.tomato.red.ruby.crimson.pink.plum.purple.violet.iris.indigo.blue.cyan.teal.jade.green.grass.lime.mint.sky`.split(`.`),Ug=[`auto`,`gray`,`mauve`,`slate`,`sage`,`olive`,`sand`],Wg={color:{type:`enum`,values:Hg,default:void 0}},Gg={color:{type:`enum`,values:Hg,default:``}},Kg={highContrast:{type:`boolean`,className:`rt-high-contrast`,default:void 0}},qg={trim:{type:`enum`,className:`rt-r-lt`,values:[`normal`,`start`,`end`,`both`],responsive:!0}},Jg={align:{type:`enum`,className:`rt-r-ta`,values:[`left`,`center`,`right`],responsive:!0}},Yg={wrap:{type:`enum`,className:`rt-r-tw`,values:[`wrap`,`nowrap`,`pretty`,`balance`],responsive:!0}},Xg={truncate:{type:`boolean`,className:`rt-truncate`}},Zg={weight:{type:`enum`,className:`rt-r-weight`,values:[`light`,`regular`,`medium`,`bold`],responsive:!0}},Qg=[`h1`,`h2`,`h3`,`h4`,`h5`,`h6`],$g=[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`],e_={as:{type:`enum`,values:Qg,default:`h1`},...Lg,size:{type:`enum`,className:`rt-r-size`,values:$g,default:`6`,responsive:!0},...Zg,...Jg,...qg,...Xg,...Yg,...Wg,...Kg},t_=[`initial`,`xs`,`sm`,`md`,`lg`,`xl`];function n_(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function r_(e){return typeof e==`object`&&Object.keys(e).some(e=>t_.includes(e))}function i_({className:e,customProperties:t,...n}){return[a_({allowArbitraryValues:!0,className:e,...n}),s_({customProperties:t,...n})]}function a_({allowArbitraryValues:e,value:t,className:n,propValues:r,parseValue:i=e=>e}){let a=[];if(t){if(typeof t==`string`&&r.includes(t))return o_(n,t,i);if(r_(t)){let o=t;for(let t in o){if(!n_(o,t)||!t_.includes(t))continue;let s=o[t];if(s!==void 0){if(r.includes(s)){let e=o_(n,s,i),r=t===`initial`?e:`${t}:${e}`;a.push(r)}else if(e){let e=t===`initial`?n:`${t}:${n}`;a.push(e)}}}return a.join(` `)}if(e)return n}}function o_(e,t,n){let r=e?`-`:``,i=n(t),a=i?.startsWith(`-`);return`${a?`-`:``}${e}${r}${a?i?.substring(1):i}`}function s_({customProperties:e,value:t,propValues:n,parseValue:r=e=>e}){let i={};if(!(!t||typeof t==`string`&&n.includes(t))){if(typeof t==`string`&&(i=Object.fromEntries(e.map(e=>[e,t]))),r_(t)){let r=t;for(let t in r){if(!n_(r,t)||!t_.includes(t))continue;let a=r[t];if(!n.includes(a))for(let n of e)i={[t===`initial`?n:`${n}-${t}`]:a,...i}}}for(let e in i){let t=i[e];t!==void 0&&(i[e]=r(t))}return i}}function c_(...e){let t={};for(let n of e)n&&(t={...t,...n});return Object.keys(t).length?t:void 0}var l_=h(B());function u_(...e){return Object.assign({},...e)}function V(e,...t){let n,r,i={...e},a=u_(...t);for(let e in a){let t=i[e],o=a[e];if(o.default!==void 0&&t===void 0&&(t=o.default),o.type===`enum`&&![o.default,...o.values].includes(t)&&!r_(t)&&(t=o.default),i[e]=t,`className`in o&&o.className){delete i[e];let a=`responsive`in o;if(!t||r_(t)&&!a)continue;if(r_(t)&&(o.default!==void 0&&t.initial===void 0&&(t.initial=o.default),o.type===`enum`&&([o.default,...o.values].includes(t.initial)||(t.initial=o.default))),o.type===`enum`){let e=a_({allowArbitraryValues:!1,value:t,className:o.className,propValues:o.values,parseValue:o.parseValue});n=(0,l_.default)(n,e);continue}if(o.type===`string`||o.type===`enum | string`){let e=o.type===`string`?[]:o.values,[i,a]=i_({className:o.className,customProperties:o.customProperties,propValues:e,parseValue:o.parseValue,value:t});r=c_(r,a),n=(0,l_.default)(n,i);continue}if(o.type===`boolean`&&t){n=(0,l_.default)(n,o.className);continue}}}return i.className=(0,l_.default)(n,e.className),i.style=c_(r,e.style),i}var d_=[`0`,`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`,`-1`,`-2`,`-3`,`-4`,`-5`,`-6`,`-7`,`-8`,`-9`],f_={m:{type:`enum | string`,values:d_,responsive:!0,className:`rt-r-m`,customProperties:[`--m`]},mx:{type:`enum | string`,values:d_,responsive:!0,className:`rt-r-mx`,customProperties:[`--ml`,`--mr`]},my:{type:`enum | string`,values:d_,responsive:!0,className:`rt-r-my`,customProperties:[`--mt`,`--mb`]},mt:{type:`enum | string`,values:d_,responsive:!0,className:`rt-r-mt`,customProperties:[`--mt`]},mr:{type:`enum | string`,values:d_,responsive:!0,className:`rt-r-mr`,customProperties:[`--mr`]},mb:{type:`enum | string`,values:d_,responsive:!0,className:`rt-r-mb`,customProperties:[`--mb`]},ml:{type:`enum | string`,values:d_,responsive:!0,className:`rt-r-ml`,customProperties:[`--ml`]}},p_=h(B()),m_=t.forwardRef((e,n)=>{let{children:r,className:i,asChild:a,as:o=`h1`,color:s,...c}=V(e,e_,f_);return t.createElement(sn,{"data-accent-color":s,...c,ref:n,className:(0,p_.default)(`rt-Heading`,i)},a?r:t.createElement(o,null,r))});m_.displayName=`Heading`;var h_=[`span`,`div`,`label`,`p`],g_=[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`],__={as:{type:`enum`,values:h_,default:`span`},...Lg,size:{type:`enum`,className:`rt-r-size`,values:g_,responsive:!0},...Zg,...Jg,...qg,...Xg,...Yg,...Wg,...Kg},v_=h(B()),H=t.forwardRef((e,n)=>{let{children:r,className:i,asChild:a,as:o=`span`,color:s,...c}=V(e,__,f_);return t.createElement(sn,{"data-accent-color":s,...c,ref:n,className:(0,v_.default)(`rt-Text`,i)},a?r:t.createElement(o,null,r))});H.displayName=`Text`;function y_(e){switch(e){case`tomato`:case`red`:case`ruby`:case`crimson`:case`pink`:case`plum`:case`purple`:case`violet`:return`mauve`;case`iris`:case`indigo`:case`blue`:case`sky`:case`cyan`:return`slate`;case`teal`:case`jade`:case`mint`:case`green`:return`sage`;case`grass`:case`lime`:return`olive`;case`yellow`:case`amber`:case`orange`:case`brown`:case`gold`:case`bronze`:return`sand`;case`gray`:return`gray`}}var b_=[`none`,`small`,`medium`,`large`,`full`],x_={radius:{type:`enum`,values:b_,default:void 0}},S_=[`inherit`,`light`,`dark`],C_=[`solid`,`translucent`],w_=[`90%`,`95%`,`100%`,`105%`,`110%`],T_={...Lg,hasBackground:{type:`boolean`,default:!0},appearance:{type:`enum`,values:S_,default:`inherit`},accentColor:{type:`enum`,values:Hg,default:`indigo`},grayColor:{type:`enum`,values:Ug,default:`auto`},panelBackground:{type:`enum`,values:C_,default:`translucent`},radius:{type:`enum`,values:b_,default:`medium`},scaling:{type:`enum`,values:w_,default:`100%`}},E_=h(B()),D_=()=>{},O_=t.createContext(void 0);function k_(){let e=t.useContext(O_);if(e===void 0)throw Error("`useThemeContext` must be used within a `Theme`");return e}var A_=t.forwardRef((e,n)=>t.useContext(O_)===void 0?t.createElement(jg,{delayDuration:200},t.createElement(Bn,{dir:`ltr`},t.createElement(j_,{...e,ref:n}))):t.createElement(M_,{...e,ref:n}));A_.displayName=`Theme`;var j_=t.forwardRef((e,n)=>{let{appearance:r=T_.appearance.default,accentColor:i=T_.accentColor.default,grayColor:a=T_.grayColor.default,panelBackground:o=T_.panelBackground.default,radius:s=T_.radius.default,scaling:c=T_.scaling.default,hasBackground:l=T_.hasBackground.default,...u}=e,[d,f]=t.useState(r);t.useEffect(()=>f(r),[r]);let[p,m]=t.useState(i);t.useEffect(()=>m(i),[i]);let[h,g]=t.useState(a);t.useEffect(()=>g(a),[a]);let[_,v]=t.useState(o);t.useEffect(()=>v(o),[o]);let[y,b]=t.useState(s);t.useEffect(()=>b(s),[s]);let[x,S]=t.useState(c);return t.useEffect(()=>S(c),[c]),t.createElement(M_,{...u,ref:n,isRoot:!0,hasBackground:l,appearance:d,accentColor:p,grayColor:h,panelBackground:_,radius:y,scaling:x,onAppearanceChange:f,onAccentColorChange:m,onGrayColorChange:g,onPanelBackgroundChange:v,onRadiusChange:b,onScalingChange:S})});j_.displayName=`ThemeRoot`;var M_=t.forwardRef((e,n)=>{let r=t.useContext(O_),{asChild:i,isRoot:a,hasBackground:o,appearance:s=r?.appearance??T_.appearance.default,accentColor:c=r?.accentColor??T_.accentColor.default,grayColor:l=r?.resolvedGrayColor??T_.grayColor.default,panelBackground:u=r?.panelBackground??T_.panelBackground.default,radius:d=r?.radius??T_.radius.default,scaling:f=r?.scaling??T_.scaling.default,onAppearanceChange:p=D_,onAccentColorChange:m=D_,onGrayColorChange:h=D_,onPanelBackgroundChange:g=D_,onRadiusChange:_=D_,onScalingChange:v=D_,...y}=e,b=i?sn:`div`,x=l===`auto`?y_(c):l,S=e.appearance===`light`||e.appearance===`dark`,C=o===void 0?a||S:o;return t.createElement(O_.Provider,{value:t.useMemo(()=>({appearance:s,accentColor:c,grayColor:l,resolvedGrayColor:x,panelBackground:u,radius:d,scaling:f,onAppearanceChange:p,onAccentColorChange:m,onGrayColorChange:h,onPanelBackgroundChange:g,onRadiusChange:_,onScalingChange:v}),[s,c,l,x,u,d,f,p,m,h,g,_,v])},t.createElement(b,{"data-is-root-theme":a?`true`:`false`,"data-accent-color":c,"data-gray-color":x,"data-has-background":C?`true`:`false`,"data-panel-background":u,"data-radius":d,"data-scaling":f,ref:n,...y,className:(0,E_.default)(`radix-themes`,{light:s===`light`,dark:s===`dark`},y.className)}))});M_.displayName=`ThemeImpl`;var N_=e=>{if(!t.isValidElement(e))throw Error(`Expected a single React Element child, but got: ${t.Children.toArray(e).map(e=>typeof e==`object`&&`type`in e&&typeof e.type==`string`?e.type:typeof e).join(`, `)}`);return e};function P_(e,n){let{asChild:r,children:i}=e;if(!r)return typeof n==`function`?n(i):n;let a=t.Children.only(i);return t.cloneElement(a,{children:typeof n==`function`?n(a.props.children):n})}var F_=[`1`,`2`,`3`],I_=[`solid`,`soft`,`surface`,`outline`],L_={...Lg,size:{type:`enum`,className:`rt-r-size`,values:F_,default:`1`,responsive:!0},variant:{type:`enum`,className:`rt-variant`,values:I_,default:`soft`},...Gg,...Kg,...x_},R_=h(B()),z_=t.forwardRef((e,n)=>{let{asChild:r,className:i,color:a,radius:o,...s}=V(e,L_,f_),c=r?sn:`span`;return t.createElement(c,{"data-accent-color":a,"data-radius":o,...s,ref:n,className:(0,R_.default)(`rt-reset`,`rt-Badge`,i)})});z_.displayName=`Badge`;var B_=sn,V_=[`div`,`span`],H_=[`none`,`inline`,`inline-block`,`block`,`contents`],U_={as:{type:`enum`,values:V_,default:`div`},...Lg,display:{type:`enum`,className:`rt-r-display`,values:H_,responsive:!0}},W_=[`0`,`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`],G_={p:{type:`enum | string`,className:`rt-r-p`,customProperties:[`--p`],values:W_,responsive:!0},px:{type:`enum | string`,className:`rt-r-px`,customProperties:[`--pl`,`--pr`],values:W_,responsive:!0},py:{type:`enum | string`,className:`rt-r-py`,customProperties:[`--pt`,`--pb`],values:W_,responsive:!0},pt:{type:`enum | string`,className:`rt-r-pt`,customProperties:[`--pt`],values:W_,responsive:!0},pr:{type:`enum | string`,className:`rt-r-pr`,customProperties:[`--pr`],values:W_,responsive:!0},pb:{type:`enum | string`,className:`rt-r-pb`,customProperties:[`--pb`],values:W_,responsive:!0},pl:{type:`enum | string`,className:`rt-r-pl`,customProperties:[`--pl`],values:W_,responsive:!0}},K_=[`visible`,`hidden`,`clip`,`scroll`,`auto`],q_=[`static`,`relative`,`absolute`,`fixed`,`sticky`],J_=[`0`,`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`,`-1`,`-2`,`-3`,`-4`,`-5`,`-6`,`-7`,`-8`,`-9`],Y_=[`0`,`1`],X_=[`0`,`1`],Z_={...G_,...Rg,...zg,position:{type:`enum`,className:`rt-r-position`,values:q_,responsive:!0},inset:{type:`enum | string`,className:`rt-r-inset`,customProperties:[`--inset`],values:J_,responsive:!0},top:{type:`enum | string`,className:`rt-r-top`,customProperties:[`--top`],values:J_,responsive:!0},right:{type:`enum | string`,className:`rt-r-right`,customProperties:[`--right`],values:J_,responsive:!0},bottom:{type:`enum | string`,className:`rt-r-bottom`,customProperties:[`--bottom`],values:J_,responsive:!0},left:{type:`enum | string`,className:`rt-r-left`,customProperties:[`--left`],values:J_,responsive:!0},overflow:{type:`enum`,className:`rt-r-overflow`,values:K_,responsive:!0},overflowX:{type:`enum`,className:`rt-r-ox`,values:K_,responsive:!0},overflowY:{type:`enum`,className:`rt-r-oy`,values:K_,responsive:!0},flexBasis:{type:`string`,className:`rt-r-fb`,customProperties:[`--flex-basis`],responsive:!0},flexShrink:{type:`enum | string`,className:`rt-r-fs`,customProperties:[`--flex-shrink`],values:Y_,responsive:!0},flexGrow:{type:`enum | string`,className:`rt-r-fg`,customProperties:[`--flex-grow`],values:X_,responsive:!0},gridArea:{type:`string`,className:`rt-r-ga`,customProperties:[`--grid-area`],responsive:!0},gridColumn:{type:`string`,className:`rt-r-gc`,customProperties:[`--grid-column`],responsive:!0},gridColumnStart:{type:`string`,className:`rt-r-gcs`,customProperties:[`--grid-column-start`],responsive:!0},gridColumnEnd:{type:`string`,className:`rt-r-gce`,customProperties:[`--grid-column-end`],responsive:!0},gridRow:{type:`string`,className:`rt-r-gr`,customProperties:[`--grid-row`],responsive:!0},gridRowStart:{type:`string`,className:`rt-r-grs`,customProperties:[`--grid-row-start`],responsive:!0},gridRowEnd:{type:`string`,className:`rt-r-gre`,customProperties:[`--grid-row-end`],responsive:!0}},Q_=h(B()),U=t.forwardRef((e,n)=>{let{className:r,asChild:i,as:a=`div`,...o}=V(e,U_,Z_,f_);return t.createElement(i?B_:a,{...o,ref:n,className:(0,Q_.default)(`rt-Box`,r)})});U.displayName=`Box`;var $_=[`1`,`2`,`3`,`4`],ev=[`classic`,`solid`,`soft`,`surface`,`outline`,`ghost`],tv={...Lg,size:{type:`enum`,className:`rt-r-size`,values:$_,default:`2`,responsive:!0},variant:{type:`enum`,className:`rt-variant`,values:ev,default:`solid`},...Gg,...Kg,...x_,loading:{type:`boolean`,className:`rt-loading`,default:!1}},nv=[`0`,`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`],rv={gap:{type:`enum | string`,className:`rt-r-gap`,customProperties:[`--gap`],values:nv,responsive:!0},gapX:{type:`enum | string`,className:`rt-r-cg`,customProperties:[`--column-gap`],values:nv,responsive:!0},gapY:{type:`enum | string`,className:`rt-r-rg`,customProperties:[`--row-gap`],values:nv,responsive:!0}},iv=[`div`,`span`],av=[`none`,`inline-flex`,`flex`],ov=[`row`,`column`,`row-reverse`,`column-reverse`],sv=[`start`,`center`,`end`,`baseline`,`stretch`],cv=[`start`,`center`,`end`,`between`],lv=[`nowrap`,`wrap`,`wrap-reverse`],uv={as:{type:`enum`,values:iv,default:`div`},...Lg,display:{type:`enum`,className:`rt-r-display`,values:av,responsive:!0},direction:{type:`enum`,className:`rt-r-fd`,values:ov,responsive:!0},align:{type:`enum`,className:`rt-r-ai`,values:sv,responsive:!0},justify:{type:`enum`,className:`rt-r-jc`,values:cv,parseValue:dv,responsive:!0},wrap:{type:`enum`,className:`rt-r-fw`,values:lv,responsive:!0},...rv};function dv(e){return e===`between`?`space-between`:e}var fv=h(B()),W=t.forwardRef((e,n)=>{let{className:r,asChild:i,as:a=`div`,...o}=V(e,uv,Z_,f_);return t.createElement(i?B_:a,{...o,ref:n,className:(0,fv.default)(`rt-Flex`,r)})});W.displayName=`Flex`;var pv={size:{type:`enum`,className:`rt-r-size`,values:[`1`,`2`,`3`],default:`2`,responsive:!0},loading:{type:`boolean`,default:!0}},mv=h(B()),hv=t.forwardRef((e,n)=>{let{className:r,children:i,loading:a,...o}=V(e,pv,f_);if(!a)return i;let s=t.createElement(`span`,{...o,ref:n,className:(0,mv.default)(`rt-Spinner`,r)},t.createElement(`span`,{className:`rt-SpinnerLeaf`}),t.createElement(`span`,{className:`rt-SpinnerLeaf`}),t.createElement(`span`,{className:`rt-SpinnerLeaf`}),t.createElement(`span`,{className:`rt-SpinnerLeaf`}),t.createElement(`span`,{className:`rt-SpinnerLeaf`}),t.createElement(`span`,{className:`rt-SpinnerLeaf`}),t.createElement(`span`,{className:`rt-SpinnerLeaf`}),t.createElement(`span`,{className:`rt-SpinnerLeaf`}));return i===void 0?s:t.createElement(W,{asChild:!0,position:`relative`,align:`center`,justify:`center`},t.createElement(`span`,null,t.createElement(`span`,{"aria-hidden":!0,style:{display:`contents`,visibility:`hidden`},inert:void 0},i),t.createElement(W,{asChild:!0,align:`center`,justify:`center`,position:`absolute`,inset:`0`},t.createElement(`span`,null,s))))});hv.displayName=`Spinner`;var gv=yn;function _v(e,t){if(e!==void 0)return typeof e==`string`?t(e):Object.fromEntries(Object.entries(e).map(([e,n])=>[e,t(n)]))}function vv(e){switch(e){case`1`:return`1`;case`2`:case`3`:return`2`;case`4`:return`3`}}var yv=h(B()),bv=t.forwardRef((e,n)=>{let{size:r=tv.size.default}=e,{className:i,children:a,asChild:o,color:s,radius:c,disabled:l=e.loading,...u}=V(e,tv,f_),d=o?sn:`button`;return t.createElement(d,{"data-disabled":l||void 0,"data-accent-color":s,"data-radius":c,...u,ref:n,className:(0,yv.default)(`rt-reset`,`rt-BaseButton`,i),disabled:l},e.loading?t.createElement(t.Fragment,null,t.createElement(`span`,{style:{display:`contents`,visibility:`hidden`},"aria-hidden":!0},a),t.createElement(gv,null,a),t.createElement(W,{asChild:!0,align:`center`,justify:`center`,position:`absolute`,inset:`0`},t.createElement(`span`,null,t.createElement(hv,{size:_v(r,vv)})))):a)});bv.displayName=`BaseButton`;var xv=h(B()),G=t.forwardRef(({className:e,...n},r)=>t.createElement(bv,{...n,ref:r,className:(0,xv.default)(`rt-Button`,e)}));G.displayName=`Button`;var Sv=[`1`,`2`,`3`,`4`,`5`],Cv=[`surface`,`classic`,`ghost`],wv={...Lg,size:{type:`enum`,className:`rt-r-size`,values:Sv,default:`1`,responsive:!0},variant:{type:`enum`,className:`rt-variant`,values:Cv,default:`surface`}},Tv=h(B()),Ev=t.forwardRef((e,n)=>{let{asChild:r,className:i,...a}=V(e,wv,f_),o=r?sn:`div`;return t.createElement(o,{ref:n,...a,className:(0,Tv.default)(`rt-reset`,`rt-BaseCard`,`rt-Card`,i)})});Ev.displayName=`Card`;var Dv=[`div`,`span`],Ov=[`none`,`inline-grid`,`grid`],kv=[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`],Av=[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`],jv=[`row`,`column`,`dense`,`row-dense`,`column-dense`],Mv=[`start`,`center`,`end`,`baseline`,`stretch`],Nv=[`start`,`center`,`end`,`between`],Pv={as:{type:`enum`,values:Dv,default:`div`},...Lg,display:{type:`enum`,className:`rt-r-display`,values:Ov,responsive:!0},areas:{type:`string`,className:`rt-r-gta`,customProperties:[`--grid-template-areas`],responsive:!0},columns:{type:`enum | string`,className:`rt-r-gtc`,customProperties:[`--grid-template-columns`],values:kv,parseValue:Fv,responsive:!0},rows:{type:`enum | string`,className:`rt-r-gtr`,customProperties:[`--grid-template-rows`],values:Av,parseValue:Fv,responsive:!0},flow:{type:`enum`,className:`rt-r-gaf`,values:jv,responsive:!0},align:{type:`enum`,className:`rt-r-ai`,values:Mv,responsive:!0},justify:{type:`enum`,className:`rt-r-jc`,values:Nv,parseValue:Iv,responsive:!0},...rv};function Fv(e){return Pv.columns.values.includes(e)?e:e?.match(/^\d+$/)?`repeat(${e}, minmax(0, 1fr))`:e}function Iv(e){return e===`between`?`space-between`:e}var Lv=h(B()),K=t.forwardRef((e,n)=>{let{className:r,asChild:i,as:a=`div`,...o}=V(e,Pv,Z_,f_);return t.createElement(i?B_:a,{...o,ref:n,className:(0,Lv.default)(`rt-Grid`,r)})});K.displayName=`Grid`;var Rv=t.default.forwardRef((e,n)=>t.default.createElement(`svg`,{width:`9`,height:`9`,viewBox:`0 0 9 9`,fill:`currentcolor`,xmlns:`http://www.w3.org/2000/svg`,...e,ref:n},t.default.createElement(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M0.75 4.5C0.75 4.08579 1.08579 3.75 1.5 3.75H7.5C7.91421 3.75 8.25 4.08579 8.25 4.5C8.25 4.91421 7.91421 5.25 7.5 5.25H1.5C1.08579 5.25 0.75 4.91421 0.75 4.5Z`})));Rv.displayName=`ThickDividerHorizontalIcon`;var zv=t.default.forwardRef((e,n)=>t.default.createElement(`svg`,{width:`9`,height:`9`,viewBox:`0 0 9 9`,fill:`currentcolor`,xmlns:`http://www.w3.org/2000/svg`,...e,ref:n},t.default.createElement(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M8.53547 0.62293C8.88226 0.849446 8.97976 1.3142 8.75325 1.66099L4.5083 8.1599C4.38833 8.34356 4.19397 8.4655 3.9764 8.49358C3.75883 8.52167 3.53987 8.45309 3.3772 8.30591L0.616113 5.80777C0.308959 5.52987 0.285246 5.05559 0.563148 4.74844C0.84105 4.44128 1.31533 4.41757 1.62249 4.69547L3.73256 6.60459L7.49741 0.840706C7.72393 0.493916 8.18868 0.396414 8.53547 0.62293Z`})));zv.displayName=`ThickCheckIcon`;var Bv=t.default.forwardRef((e,n)=>t.default.createElement(`svg`,{width:`9`,height:`9`,viewBox:`0 0 9 9`,fill:`currentcolor`,xmlns:`http://www.w3.org/2000/svg`,...e,ref:n},t.default.createElement(`path`,{d:`M0.135232 3.15803C0.324102 2.95657 0.640521 2.94637 0.841971 3.13523L4.5 6.56464L8.158 3.13523C8.3595 2.94637 8.6759 2.95657 8.8648 3.15803C9.0536 3.35949 9.0434 3.67591 8.842 3.86477L4.84197 7.6148C4.64964 7.7951 4.35036 7.7951 4.15803 7.6148L0.158031 3.86477C-0.0434285 3.67591 -0.0536285 3.35949 0.135232 3.15803Z`})));Bv.displayName=`ChevronDownIcon`;var Vv=t.default.forwardRef((e,n)=>t.default.createElement(`svg`,{width:`9`,height:`9`,viewBox:`0 0 9 9`,fill:`currentcolor`,xmlns:`http://www.w3.org/2000/svg`,...e,ref:n},t.default.createElement(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M3.23826 0.201711C3.54108 -0.0809141 4.01567 -0.0645489 4.29829 0.238264L7.79829 3.98826C8.06724 4.27642 8.06724 4.72359 7.79829 5.01174L4.29829 8.76174C4.01567 9.06455 3.54108 9.08092 3.23826 8.79829C2.93545 8.51567 2.91909 8.04108 3.20171 7.73826L6.22409 4.5L3.20171 1.26174C2.91909 0.958928 2.93545 0.484337 3.23826 0.201711Z`})));Vv.displayName=`ThickChevronRightIcon`;var Hv=[`1`,`2`,`3`],Uv=[`vertical`,`horizontal`,`both`],Wv={...Lg,size:{type:`enum`,className:`rt-r-size`,values:Hv,default:`1`,responsive:!0},...x_,scrollbars:{type:`enum`,values:Uv,default:`both`}};function Gv(e){let{m:t,mx:n,my:r,mt:i,mr:a,mb:o,ml:s,...c}=e;return{m:t,mx:n,my:r,mt:i,mr:a,mb:o,ml:s,rest:c}}var Kv=h(B()),qv=f_.m.values;function Jv(e){let[t,n]=i_({className:`rt-r-m`,customProperties:[`--margin`],propValues:qv,value:e.m}),[r,i]=i_({className:`rt-r-mx`,customProperties:[`--margin-left`,`--margin-right`],propValues:qv,value:e.mx}),[a,o]=i_({className:`rt-r-my`,customProperties:[`--margin-top`,`--margin-bottom`],propValues:qv,value:e.my}),[s,c]=i_({className:`rt-r-mt`,customProperties:[`--margin-top`],propValues:qv,value:e.mt}),[l,u]=i_({className:`rt-r-mr`,customProperties:[`--margin-right`],propValues:qv,value:e.mr}),[d,f]=i_({className:`rt-r-mb`,customProperties:[`--margin-bottom`],propValues:qv,value:e.mb}),[p,m]=i_({className:`rt-r-ml`,customProperties:[`--margin-left`],propValues:qv,value:e.ml});return[(0,Kv.default)(t,r,a,s,l,d,p),c_(n,i,o,c,u,f,m)]}var Yv=h(B()),Xv=t.forwardRef((e,n)=>{let{rest:r,...i}=Gv(e),[a,o]=Jv(i),{asChild:s,children:c,className:l,style:u,type:d,scrollHideDelay:f=d===`scroll`?void 0:0,dir:p,size:m=Wv.size.default,radius:h=Wv.radius.default,scrollbars:g=Wv.scrollbars.default,..._}=r;return t.createElement(Lf,{type:d,scrollHideDelay:f,className:(0,Yv.default)(`rt-ScrollAreaRoot`,a,l),style:c_(o,u),asChild:s},P_({asChild:s,children:c},e=>t.createElement(t.Fragment,null,t.createElement(Rf,{..._,ref:n,className:`rt-ScrollAreaViewport`},e),t.createElement(`div`,{className:`rt-ScrollAreaViewportFocusRing`}),g===`vertical`?null:t.createElement(zf,{"data-radius":h,orientation:`horizontal`,className:(0,Yv.default)(`rt-ScrollAreaScrollbar`,a_({className:`rt-r-size`,value:m,propValues:Wv.size.values}))},t.createElement(Bf,{className:`rt-ScrollAreaThumb`})),g===`horizontal`?null:t.createElement(zf,{"data-radius":h,orientation:`vertical`,className:(0,Yv.default)(`rt-ScrollAreaScrollbar`,a_({className:`rt-r-size`,value:m,propValues:Wv.size.values}))},t.createElement(Bf,{className:`rt-ScrollAreaThumb`})),g===`both`?t.createElement(Vf,{className:`rt-ScrollAreaCorner`}):null)))});Xv.displayName=`ScrollArea`;var Zv={size:{type:`enum`,className:`rt-r-size`,values:[`1`,`2`],default:`2`,responsive:!0},variant:{type:`enum`,className:`rt-variant`,values:[`solid`,`soft`],default:`solid`},...Wg,...Kg},Qv={...Lg,...Wg,shortcut:{type:`string`}},$v={...Wg,shortcut:{type:`string`}},ey={...Wg},ty=h(B()),ny=e=>t.createElement(Sa,{...e,modal:!0});ny.displayName=`Dialog.Root`;var ry=t.forwardRef(({children:e,...n},r)=>t.createElement(Ca,{...n,ref:r,asChild:!0},N_(e)));ry.displayName=`Dialog.Trigger`;var iy=t.forwardRef(({align:e,...n},r)=>{let{align:i,...a}=Vg,{className:o}=V({align:e},{align:i}),{className:s,forceMount:c,container:l,...u}=V(n,a);return t.createElement(wa,{container:l,forceMount:c},t.createElement(A_,{asChild:!0},t.createElement(Ta,{className:`rt-BaseDialogOverlay rt-DialogOverlay`},t.createElement(`div`,{className:`rt-BaseDialogScroll rt-DialogScroll`},t.createElement(`div`,{className:`rt-BaseDialogScrollPadding rt-DialogScrollPadding ${o}`},t.createElement(Ea,{...u,ref:r,className:(0,ty.default)(`rt-BaseDialogContent`,`rt-DialogContent`,s)}))))))});iy.displayName=`Dialog.Content`;var ay=t.forwardRef((e,n)=>t.createElement(Da,{asChild:!0},t.createElement(m_,{size:`5`,mb:`3`,trim:`start`,...e,asChild:!1,ref:n})));ay.displayName=`Dialog.Title`;var oy=t.forwardRef((e,n)=>t.createElement(Oa,{asChild:!0},t.createElement(H,{as:`p`,size:`3`,...e,asChild:!1,ref:n})));oy.displayName=`Dialog.Description`;var sy=t.forwardRef(({children:e,...n},r)=>t.createElement(ka,{...n,ref:r,asChild:!0},N_(e)));sy.displayName=`Dialog.Close`;var cy=h(B()),ly=e=>t.createElement(od,{...e});ly.displayName=`DropdownMenu.Root`;var uy=t.forwardRef(({children:e,...n},r)=>t.createElement(sd,{...n,ref:r,asChild:!0},N_(e)));uy.displayName=`DropdownMenu.Trigger`;var dy=t.createContext({}),fy=t.forwardRef((e,n)=>{let r=k_(),{size:i=Zv.size.default,variant:a=Zv.variant.default,highContrast:o=Zv.highContrast.default}=e,{className:s,children:c,color:l,container:u,forceMount:d,...f}=V(e,Zv),p=l||r.accentColor;return t.createElement(cd,{container:u,forceMount:d},t.createElement(A_,{asChild:!0},t.createElement(ld,{"data-accent-color":p,align:`start`,sideOffset:4,collisionPadding:10,...f,asChild:!1,ref:n,className:(0,cy.default)(`rt-PopperContent`,`rt-BaseMenuContent`,`rt-DropdownMenuContent`,s)},t.createElement(Xv,{type:`auto`},t.createElement(`div`,{className:(0,cy.default)(`rt-BaseMenuViewport`,`rt-DropdownMenuViewport`)},t.createElement(dy.Provider,{value:t.useMemo(()=>({size:i,variant:a,color:p,highContrast:o}),[i,a,p,o])},c))))))});fy.displayName=`DropdownMenu.Content`;var py=t.forwardRef(({className:e,...n},r)=>t.createElement(dd,{...n,asChild:!1,ref:r,className:(0,cy.default)(`rt-BaseMenuLabel`,`rt-DropdownMenuLabel`,e)}));py.displayName=`DropdownMenu.Label`;var q=t.forwardRef((e,n)=>{let{className:r,children:i,color:a=Qv.color.default,shortcut:o,...s}=e;return t.createElement(fd,{"data-accent-color":a,...s,ref:n,className:(0,cy.default)(`rt-reset`,`rt-BaseMenuItem`,`rt-DropdownMenuItem`,r)},t.createElement(dn,null,i),o&&t.createElement(`div`,{className:`rt-BaseMenuShortcut rt-DropdownMenuShortcut`},o))});q.displayName=`DropdownMenu.Item`;var my=t.forwardRef(({className:e,...n},r)=>t.createElement(ud,{...n,asChild:!1,ref:r,className:(0,cy.default)(`rt-BaseMenuGroup`,`rt-DropdownMenuGroup`,e)}));my.displayName=`DropdownMenu.Group`;var hy=t.forwardRef(({className:e,...n},r)=>t.createElement(md,{...n,asChild:!1,ref:r,className:(0,cy.default)(`rt-BaseMenuRadioGroup`,`rt-DropdownMenuRadioGroup`,e)}));hy.displayName=`DropdownMenu.RadioGroup`;var gy=t.forwardRef((e,n)=>{let{children:r,className:i,color:a=ey.color.default,...o}=e;return t.createElement(hd,{...o,asChild:!1,ref:n,"data-accent-color":a,className:(0,cy.default)(`rt-BaseMenuItem`,`rt-BaseMenuRadioItem`,`rt-DropdownMenuItem`,`rt-DropdownMenuRadioItem`,i)},r,t.createElement(gd,{className:`rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator`},t.createElement(zv,{className:`rt-BaseMenuItemIndicatorIcon rt-DropdownMenuItemIndicatorIcon`})))});gy.displayName=`DropdownMenu.RadioItem`;var _y=t.forwardRef((e,n)=>{let{children:r,className:i,shortcut:a,color:o=$v.color.default,...s}=e;return t.createElement(pd,{...s,asChild:!1,ref:n,"data-accent-color":o,className:(0,cy.default)(`rt-BaseMenuItem`,`rt-BaseMenuCheckboxItem`,`rt-DropdownMenuItem`,`rt-DropdownMenuCheckboxItem`,i)},r,t.createElement(gd,{className:`rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator`},t.createElement(zv,{className:`rt-BaseMenuItemIndicatorIcon rt-ContextMenuItemIndicatorIcon`})),a&&t.createElement(`div`,{className:`rt-BaseMenuShortcut rt-DropdownMenuShortcut`},a))});_y.displayName=`DropdownMenu.CheckboxItem`;var vy=e=>t.createElement(vd,{...e});vy.displayName=`DropdownMenu.Sub`;var yy=t.forwardRef((e,n)=>{let{className:r,children:i,...a}=e;return t.createElement(yd,{...a,asChild:!1,ref:n,className:(0,cy.default)(`rt-BaseMenuItem`,`rt-BaseMenuSubTrigger`,`rt-DropdownMenuItem`,`rt-DropdownMenuSubTrigger`,r)},i,t.createElement(`div`,{className:`rt-BaseMenuShortcut rt-DropdownMenuShortcut`},t.createElement(Vv,{className:`rt-BaseMenuSubTriggerIcon rt-DropdownMenuSubtriggerIcon`})))});yy.displayName=`DropdownMenu.SubTrigger`;var by=t.forwardRef((e,n)=>{let{size:r,variant:i,color:a,highContrast:o}=t.useContext(dy),{className:s,children:c,container:l,forceMount:u,...d}=V({size:r,variant:i,color:a,highContrast:o,...e},Zv);return t.createElement(cd,{container:l,forceMount:u},t.createElement(A_,{asChild:!0},t.createElement(bd,{"data-accent-color":a,alignOffset:-Number(r)*4,sideOffset:1,collisionPadding:10,...d,asChild:!1,ref:n,className:(0,cy.default)(`rt-PopperContent`,`rt-BaseMenuContent`,`rt-BaseMenuSubContent`,`rt-DropdownMenuContent`,`rt-DropdownMenuSubContent`,s)},t.createElement(Xv,{type:`auto`},t.createElement(`div`,{className:(0,cy.default)(`rt-BaseMenuViewport`,`rt-DropdownMenuViewport`)},c)))))});by.displayName=`DropdownMenu.SubContent`;var xy=t.forwardRef(({className:e,...n},r)=>t.createElement(_d,{...n,asChild:!1,ref:r,className:(0,cy.default)(`rt-BaseMenuSeparator`,`rt-DropdownMenuSeparator`,e)}));xy.displayName=`DropdownMenu.Separator`;var Sy=h(B()),J=t.forwardRef(({className:e,...n},r)=>t.createElement(bv,{...n,ref:r,className:(0,Sy.default)(`rt-IconButton`,e)}));J.displayName=`IconButton`;var Cy=[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`],wy={...Lg,size:{type:`enum`,className:`rt-r-size`,values:Cy,responsive:!0}},Ty=h(B()),Ey=t.forwardRef((e,n)=>{let{asChild:r,className:i,...a}=V(e,wy,f_),o=r?sn:`kbd`;return t.createElement(o,{...a,ref:n,className:(0,Ty.default)(`rt-reset`,`rt-Kbd`,i)})});Ey.displayName=`Kbd`;var Dy=[`1`,`2`,`3`,`4`],Oy={...Lg,size:{type:`enum`,className:`rt-r-size`,values:Dy,default:`2`,responsive:!0},width:Rg.width,minWidth:Rg.minWidth,maxWidth:{...Rg.maxWidth,default:`480px`},...zg},ky=h(B()),Ay=e=>t.createElement(Jd,{...e});Ay.displayName=`Popover.Root`;var jy=t.forwardRef(({children:e,...n},r)=>t.createElement(Xd,{...n,ref:r,asChild:!0},N_(e)));jy.displayName=`Popover.Trigger`;var My=t.forwardRef((e,n)=>{let{className:r,forceMount:i,container:a,...o}=V(e,Oy);return t.createElement(Zd,{container:a,forceMount:i},t.createElement(A_,{asChild:!0},t.createElement(Qd,{align:`start`,sideOffset:8,collisionPadding:10,...o,ref:n,className:(0,ky.default)(`rt-PopperContent`,`rt-PopoverContent`,r)})))});My.displayName=`Popover.Content`;var Ny=t.forwardRef(({children:e,...n},r)=>t.createElement($d,{...n,ref:r,asChild:!0},N_(e)));Ny.displayName=`Popover.Close`;var Py=t.forwardRef(({children:e,...n},r)=>t.createElement(Yd,{...n,ref:r}));Py.displayName=`Popover.Anchor`;var Fy={disabled:{type:`boolean`,className:`disabled`,default:!1},size:{type:`enum`,className:`rt-r-size`,values:[`1`,`2`,`3`],default:`2`,responsive:!0},variant:{type:`enum`,className:`rt-variant`,values:[`surface`,`classic`],default:`surface`},...x_},Iy=h(B()),Ly=t.forwardRef((e,n)=>{let{className:r,children:i,radius:a,value:o,defaultValue:s,onValueChange:c,...l}=V(e,Fy,f_),[u,d]=En({prop:o,onChange:c,defaultProp:s});return t.createElement(Yh,{"data-disabled":e.disabled||void 0,"data-radius":a,ref:n,className:(0,Iy.default)(`rt-SegmentedControlRoot`,r),onValueChange:e=>{e&&d(e)},...l,type:`single`,value:u,asChild:!1,disabled:!!e.disabled},i,t.createElement(`div`,{className:`rt-SegmentedControlIndicator`}))});Ly.displayName=`SegmentedControl.Root`;var Ry=t.forwardRef(({children:e,className:n,...r},i)=>t.createElement(Xh,{ref:i,className:(0,Iy.default)(`rt-reset`,`rt-SegmentedControlItem`,n),...r,disabled:!1,asChild:!1},t.createElement(`span`,{className:`rt-SegmentedControlItemSeparator`}),t.createElement(`span`,{className:`rt-SegmentedControlItemLabel`},t.createElement(`span`,{className:`rt-SegmentedControlItemLabelActive`},e),t.createElement(`span`,{className:`rt-SegmentedControlItemLabelInactive`,"aria-hidden":!0},e))));Ry.displayName=`SegmentedControl.Item`;var zy={size:{type:`enum`,className:`rt-r-size`,values:[`1`,`2`,`3`],default:`2`,responsive:!0}},By={variant:{type:`enum`,className:`rt-variant`,values:[`classic`,`surface`,`soft`,`ghost`],default:`surface`},...Wg,...x_,placeholder:{type:`string`}},Vy={variant:{type:`enum`,className:`rt-variant`,values:[`solid`,`soft`],default:`solid`},...Wg,...Kg},Hy=h(B()),Uy=t.createContext({}),Wy=e=>{let{children:n,size:r=zy.size.default,...i}=e;return t.createElement(tm,{...i},t.createElement(Uy.Provider,{value:t.useMemo(()=>({size:r}),[r])},n))};Wy.displayName=`Select.Root`;var Gy=t.forwardRef((e,n)=>{let{children:r,className:i,color:a,radius:o,placeholder:s,...c}=V({size:t.useContext(Uy)?.size,...e},{size:zy.size},By,f_);return t.createElement(nm,{asChild:!0},t.createElement(`button`,{"data-accent-color":a,"data-radius":o,...c,ref:n,className:(0,Hy.default)(`rt-reset`,`rt-SelectTrigger`,i)},t.createElement(`span`,{className:`rt-SelectTriggerInner`},t.createElement(rm,{placeholder:s},r)),t.createElement(im,{asChild:!0},t.createElement(Bv,{className:`rt-SelectIcon`}))))});Gy.displayName=`Select.Trigger`;var Ky=t.forwardRef((e,n)=>{let{className:r,children:i,color:a,container:o,...s}=V({size:t.useContext(Uy)?.size,...e},{size:zy.size},Vy),c=k_(),l=a||c.accentColor;return t.createElement(am,{container:o},t.createElement(A_,{asChild:!0},t.createElement(om,{"data-accent-color":l,sideOffset:4,...s,asChild:!1,ref:n,className:(0,Hy.default)({"rt-PopperContent":s.position===`popper`},`rt-SelectContent`,r)},t.createElement(Lf,{type:`auto`,className:`rt-ScrollAreaRoot`},t.createElement(sm,{asChild:!0,className:`rt-SelectViewport`},t.createElement(Rf,{className:`rt-ScrollAreaViewport`,style:{overflowY:void 0}},i)),t.createElement(zf,{className:`rt-ScrollAreaScrollbar rt-r-size-1`,orientation:`vertical`},t.createElement(Bf,{className:`rt-ScrollAreaThumb`}))))))});Ky.displayName=`Select.Content`;var Y=t.forwardRef((e,n)=>{let{className:r,children:i,...a}=e;return t.createElement(um,{...a,asChild:!1,ref:n,className:(0,Hy.default)(`rt-SelectItem`,r)},t.createElement(fm,{className:`rt-SelectItemIndicator`},t.createElement(zv,{className:`rt-SelectItemIndicatorIcon`})),t.createElement(dm,null,i))});Y.displayName=`Select.Item`;var qy=t.forwardRef(({className:e,...n},r)=>t.createElement(cm,{...n,asChild:!1,ref:r,className:(0,Hy.default)(`rt-SelectGroup`,e)}));qy.displayName=`Select.Group`;var Jy=t.forwardRef(({className:e,...n},r)=>t.createElement(lm,{...n,asChild:!1,ref:r,className:(0,Hy.default)(`rt-SelectLabel`,e)}));Jy.displayName=`Select.Label`;var Yy=t.forwardRef(({className:e,...n},r)=>t.createElement(pm,{...n,asChild:!1,ref:r,className:(0,Hy.default)(`rt-SelectSeparator`,e)}));Yy.displayName=`Select.Separator`;var Xy={orientation:{type:`enum`,className:`rt-r-orientation`,values:[`horizontal`,`vertical`],default:`horizontal`,responsive:!0},size:{type:`enum`,className:`rt-r-size`,values:[`1`,`2`,`3`,`4`],default:`1`,responsive:!0},color:{...Wg.color,default:`gray`},decorative:{type:`boolean`,default:!0}},Zy=h(B()),Qy=t.forwardRef((e,n)=>{let{className:r,color:i,decorative:a,...o}=V(e,Xy,f_);return t.createElement(`span`,{"data-accent-color":i,role:a?void 0:`separator`,...o,ref:n,className:(0,Zy.default)(`rt-Separator`,r)})});Qy.displayName=`Separator`;var $y={size:{type:`enum`,className:`rt-r-size`,values:[`1`,`2`,`3`],default:`2`,responsive:!0},variant:{type:`enum`,className:`rt-variant`,values:[`classic`,`surface`,`soft`],default:`surface`},...Wg,...Kg,...x_},eb=h(B()),tb=t.forwardRef((e,n)=>{let{className:r,color:i,radius:a,tabIndex:o,...s}=V(e,$y,f_);return t.createElement(Xm,{"data-accent-color":i,"data-radius":a,ref:n,...s,asChild:!1,className:(0,eb.default)(`rt-SliderRoot`,r)},t.createElement(Zm,{className:`rt-SliderTrack`},t.createElement(Qm,{className:(0,eb.default)(`rt-SliderRange`,{"rt-high-contrast":e.highContrast}),"data-inverted":s.inverted?``:void 0})),(s.value??s.defaultValue??[]).map((e,n)=>t.createElement($m,{key:n,className:`rt-SliderThumb`,...o===void 0?void 0:{tabIndex:o}})))});tb.displayName=`Slider`;var nb={size:{type:`enum`,className:`rt-r-size`,values:[`1`,`2`,`3`],default:`2`,responsive:!0},variant:{type:`enum`,className:`rt-variant`,values:[`classic`,`surface`,`soft`],default:`surface`},...Wg,...Kg,...x_},rb=h(B()),ib=t.forwardRef((e,n)=>{let{className:r,color:i,radius:a,...o}=V(e,nb,f_);return t.createElement(dh,{"data-accent-color":i,"data-radius":a,...o,asChild:!1,ref:n,className:(0,rb.default)(`rt-reset`,`rt-SwitchRoot`,r)},t.createElement(fh,{className:(0,rb.default)(`rt-SwitchThumb`,{"rt-high-contrast":e.highContrast})}))});ib.displayName=`Switch`;var ab={size:{type:`enum`,className:`rt-r-size`,values:[`1`,`2`],default:`2`,responsive:!0},wrap:{type:`enum`,className:`rt-r-fw`,values:[`nowrap`,`wrap`,`wrap-reverse`],responsive:!0},justify:{type:`enum`,className:`rt-r-jc`,values:[`start`,`center`,`end`],responsive:!0},...Wg,...Kg},ob=h(B()),sb=t.forwardRef((e,n)=>{let{className:r,...i}=V(e,f_);return t.createElement(Oh,{...i,ref:n,className:(0,ob.default)(`rt-TabsRoot`,r)})});sb.displayName=`Tabs.Root`;var cb=t.forwardRef((e,n)=>{let{className:r,color:i,...a}=V(e,ab,f_);return t.createElement(kh,{"data-accent-color":i,...a,asChild:!1,ref:n,className:(0,ob.default)(`rt-BaseTabList`,`rt-TabsList`,r)})});cb.displayName=`Tabs.List`;var lb=t.forwardRef((e,n)=>{let{className:r,children:i,...a}=e;return t.createElement(Ah,{...a,asChild:!1,ref:n,className:(0,ob.default)(`rt-reset`,`rt-BaseTabListTrigger`,`rt-TabsTrigger`,r)},t.createElement(`span`,{className:`rt-BaseTabListTriggerInner rt-TabsTriggerInner`},i),t.createElement(`span`,{className:`rt-BaseTabListTriggerInnerHidden rt-TabsTriggerInnerHidden`},i))});lb.displayName=`Tabs.Trigger`;var ub=t.forwardRef((e,n)=>{let{className:r,...i}=V(e,f_);return t.createElement(jh,{...i,ref:n,className:(0,ob.default)(`rt-TabsContent`,r)})});ub.displayName=`Tabs.Content`;var db={size:{type:`enum`,className:`rt-r-size`,values:[`1`,`2`,`3`],default:`2`,responsive:!0},variant:{type:`enum`,className:`rt-variant`,values:[`classic`,`surface`,`soft`],default:`surface`},resize:{type:`enum`,className:`rt-r-resize`,values:[`none`,`vertical`,`horizontal`,`both`],responsive:!0},...Wg,...x_},fb=h(B()),pb=t.forwardRef((e,n)=>{let{className:r,color:i,radius:a,style:o,...s}=V(e,db,f_);return t.createElement(`div`,{"data-accent-color":i,"data-radius":a,className:(0,fb.default)(`rt-TextAreaRoot`,r),style:o},t.createElement(`textarea`,{className:`rt-reset rt-TextAreaInput`,ref:n,...s}))});pb.displayName=`TextArea`;var mb={size:{type:`enum`,className:`rt-r-size`,values:[`1`,`2`,`3`],default:`2`,responsive:!0},variant:{type:`enum`,className:`rt-variant`,values:[`classic`,`surface`,`soft`],default:`surface`},...Wg,...x_},hb={side:{type:`enum`,values:[`left`,`right`]},...Wg,gap:uv.gap,px:G_.px,pl:G_.pl,pr:G_.pr},gb=h(B()),X=t.forwardRef((e,n)=>{let r=t.useRef(null),{children:i,className:a,color:o,radius:s,style:c,...l}=V(e,mb,f_);return t.createElement(`div`,{"data-accent-color":o,"data-radius":s,style:c,className:(0,gb.default)(`rt-TextFieldRoot`,a),onPointerDown:e=>{let t=e.target;if(t.closest(`input, button, a`))return;let n=r.current;if(!n)return;let i=t.closest(`
46
46
  .rt-TextFieldSlot[data-side='right'],
47
47
  .rt-TextFieldSlot:not([data-side='right']) ~ .rt-TextFieldSlot:not([data-side='left'])
48
- `)?n.value.length:0;requestAnimationFrame(()=>{try{n.setSelectionRange(i,i)}catch{}n.focus()})}},t.createElement(`input`,{spellCheck:`false`,...l,ref:an(r,n),className:`rt-reset rt-TextFieldInput`}),i)});X.displayName=`TextField.Root`;var _b=t.forwardRef((e,n)=>{let{className:r,color:i,side:a,...o}=V(e,hb);return t.createElement(`div`,{"data-accent-color":i,"data-side":a,...o,ref:n,className:(0,gb.default)(`rt-TextFieldSlot`,r)})});_b.displayName=`TextField.Slot`;var vb={content:{type:`ReactNode`,required:!0},width:Rg.width,minWidth:Rg.minWidth,maxWidth:{...Rg.maxWidth,default:`360px`}},yb=h(B()),bb=t.forwardRef((e,n)=>{let{children:r,className:i,open:a,defaultOpen:o,onOpenChange:s,delayDuration:c,disableHoverableContent:l,content:u,container:d,forceMount:f,...p}=V(e,vb),m={open:a,defaultOpen:o,onOpenChange:s,delayDuration:c,disableHoverableContent:l};return t.createElement(Mg,{...m},t.createElement(Ng,{asChild:!0},r),t.createElement(Pg,{container:d,forceMount:f},t.createElement(A_,{asChild:!0},t.createElement(Fg,{sideOffset:4,collisionPadding:10,...p,asChild:!1,ref:n,className:(0,yb.default)(`rt-TooltipContent`,i)},t.createElement(H,{as:`p`,className:`rt-TooltipText`,size:`1`},u),t.createElement(Ig,{className:`rt-TooltipArrow`})))))});bb.displayName=`Tooltip`;function Z(e,t=`Assertion error`){if(!e)throw Error(t)}function xb({group:e}){let{orientation:t,panels:n}=e;return n.reduce((e,n)=>(e+=t===`horizontal`?n.element.offsetWidth:n.element.offsetHeight,e),0)}function Sb(e,t){return t.sort(e===`horizontal`?Cb:wb)}function Cb(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function wb(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function Tb(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function Eb(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function Db({orientation:e,rects:t,targetRect:n}){let r={x:n.x+n.width/2,y:n.y+n.height/2},i,a=Number.MAX_VALUE;for(let n of t){let{x:t,y:o}=Eb(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return Z(i,`No rect found`),i}function Ob(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=Sb(n,Array.from(t.children).filter(Tb).map(e=>({element:e}))).map(({element:e})=>e),o=[],s=!1,c,l=[];for(let t of a)if(t.hasAttribute(`data-panel`)){let i=r.find(e=>e.element===t);if(i){if(c){let r=c.element.getBoundingClientRect(),a=t.getBoundingClientRect(),u;if(s){let e=n===`horizontal`?new DOMRect(r.right,r.top,0,r.height):new DOMRect(r.left,r.bottom,r.width,0),t=n===`horizontal`?new DOMRect(a.left,a.top,0,a.height):new DOMRect(a.left,a.top,a.width,0);switch(l.length){case 0:u=[e,t];break;case 1:{let i=l[0];u=[i,Db({orientation:n,rects:[r,a],targetRect:i.element.getBoundingClientRect()})===r?t:e];break}default:u=l;break}}else u=l.length?l:[n===`horizontal`?new DOMRect(r.right,a.top,a.left-r.right,a.height):new DOMRect(a.left,r.bottom,a.width,a.top-r.bottom)];for(let t of u)o.push({group:e,groupSize:xb({group:e}),panels:[c,i],separator:`width`in t?void 0:t,rect:`width`in t?t:t.element.getBoundingClientRect()})}s=!1,c=i,l=[]}}else if(t.hasAttribute(`data-separator`)){let e=i.find(e=>e.element===t);e?l.push(e):(c=void 0,l=[])}else s=!0;return o}function kb(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function Ab(e,t){let n=getComputedStyle(e.ownerDocument.body);return t*parseFloat(n.fontSize)}function jb(e){return e/100*window.innerHeight}function Mb(e){return e/100*window.innerWidth}function Nb(e){switch(typeof e){case`number`:return[e,`px`];case`string`:{let t=parseFloat(e);return e.endsWith(`%`)?[t,`%`]:e.endsWith(`px`)?[t,`px`]:e.endsWith(`rem`)?[t,`rem`]:e.endsWith(`em`)?[t,`em`]:e.endsWith(`vh`)?[t,`vh`]:e.endsWith(`vw`)?[t,`vw`]:[t,`%`]}}}function Pb({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=Nb(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=Ab(t,i);break;case`em`:r=kb(t,i);break;case`vh`:r=jb(i);break;case`vw`:r=Mb(i);break}return r}function Fb(e){return parseFloat(e.toFixed(3))}function Ib(e){let{panels:t}=e,n=xb({group:e});return n===0?t.map(e=>({collapsedSize:0,collapsible:e.panelConstraints.collapsible===!0,defaultSize:void 0,minSize:0,maxSize:100,panelId:e.id})):t.map(e=>{let{element:t,panelConstraints:r}=e,i=0;r.collapsedSize&&(i=Fb(Pb({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize&&(a=Fb(Pb({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize&&(o=Fb(Pb({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize&&(s=Fb(Pb({groupSize:n,panelElement:t,styleProp:r.maxSize})/n*100)),{collapsedSize:i,collapsible:r.collapsible===!0,defaultSize:a,minSize:o,maxSize:s,panelId:e.id}})}var Lb=class{#e={};addListener(e,t){let n=this.#e[e];return n===void 0?this.#e[e]=[t]:n.includes(t)||n.push(t),()=>{this.removeListener(e,t)}}emit(e,t){let n=this.#e[e];if(n!==void 0)if(n.length===1)n[0].call(null,t);else{let e=!1,r=null,i=Array.from(n);for(let n=0;n<i.length;n++){let a=i[n];try{a.call(null,t)}catch(t){r===null&&(e=!0,r=t)}}if(e)throw r}}removeAllListeners(){this.#e={}}removeListener(e,t){let n=this.#e[e];if(n!==void 0){let e=n.indexOf(t);e>=0&&n.splice(e,1)}}};function Rb(e,t,n=0){return Math.abs(Fb(e)-Fb(t))<=n}var zb={cursorFlags:0,interactionState:{state:`inactive`},mountedGroups:new Map},Bb=new Lb;function Vb(){return zb}function Hb(e){let t=typeof e==`function`?e(zb):e;if(zb===t)return zb;let n=zb;return zb={...zb,...t},t.cursorFlags!==void 0&&Bb.emit(`cursorFlagsChange`,zb.cursorFlags),t.interactionState!==void 0&&Bb.emit(`interactionStateChange`,zb.interactionState),t.mountedGroups!==void 0&&(zb.mountedGroups.forEach((e,t)=>{e.derivedPanelConstraints.forEach(r=>{if(r.collapsible){let{layout:i}=n.mountedGroups.get(t)??{};if(i){let n=Rb(r.collapsedSize,e.layout[r.panelId]),a=Rb(r.collapsedSize,i[r.panelId]);n&&!a&&(t.inMemoryLastExpandedPanelSizes[r.panelId]=i[r.panelId])}}})}),Bb.emit(`mountedGroupsChange`,zb.mountedGroups)),zb}function Ub(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function Wb(e,t){return Rb(e,t)?0:e>t?1:-1}function Gb({panelConstraints:e,size:t}){let{collapsedSize:n=0,collapsible:r,maxSize:i=100,minSize:a=0}=e;if(Wb(t,a)<0)if(r){let e=(n+a)/2;t=Wb(t,e)<0?n:a}else t=a;return t=Math.min(i,t),t=Fb(t),t}function Kb({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(Rb(e,0))return t;let o=Object.values(t),s=Object.values(i),c=[...o],[l,u]=r;Z(l!=null,`Invalid first pivot index`),Z(u!=null,`Invalid second pivot index`);let d=0;if(a===`keyboard`){{let t=e<0?u:l,r=n[t];Z(r,`Panel constraints not found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:s=0}=r;if(a){let n=o[t];if(Z(n!=null,`Previous layout not found for panel index ${t}`),Rb(n,i)){let t=s-n;Wb(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?l:u,r=n[t];Z(r,`No panel constraints found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:s=0}=r;if(a){let n=o[t];if(Z(n!=null,`Previous layout not found for panel index ${t}`),Rb(n,s)){let t=n-i;Wb(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}}{let t=e<0?1:-1,r=e<0?u:l,i=0;for(;;){let e=o[r];Z(e!=null,`Previous layout not found for panel index ${r}`);let a=Gb({panelConstraints:n[r],size:100})-e;if(i+=a,r+=t,r<0||r>=n.length)break}let a=Math.min(Math.abs(e),Math.abs(i));e=e<0?0-a:a}{let t=e<0?l:u;for(;t>=0&&t<n.length;){let r=Math.abs(e)-Math.abs(d),i=o[t];Z(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,s=Gb({panelConstraints:n[t],size:a});if(!Rb(i,s)&&(d+=i-s,c[t]=s,d.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?t--:t++}}if(Ub(s,c))return i;{let t=e<0?u:l,r=o[t];Z(r!=null,`Previous layout not found for panel index ${t}`);let i=r+d,a=Gb({panelConstraints:n[t],size:i});if(c[t]=a,!Rb(a,i)){let t=i-a,r=e<0?u:l;for(;r>=0&&r<n.length;){let i=c[r];Z(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,o=Gb({panelConstraints:n[r],size:a});if(Rb(i,o)||(t-=o-i,c[r]=o),Rb(t,0))break;e>0?r--:r++}}}if(!Rb(Object.values(c).reduce((e,t)=>t+e,0),100,.1))return i;let f=Object.keys(i);return c.reduce((e,t,n)=>(e[f[n]]=t,e),{})}function qb(e){let{mountedGroups:t}=Vb();for(let[n]of t)if(n.separators.some(t=>t.element===e))return n;throw Error(`Could not find parent Group for separator element`)}function Jb(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||Wb(e[n],t[n])!==0)return!1;return!0}function Yb({layout:e,panelConstraints:t}){let n=[...Object.values(e)],r=n.reduce((e,t)=>e+t,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(e=>`${e}%`).join(`, `)}`);if(!Rb(r,100)&&n.length>0)for(let e=0;e<t.length;e++){let t=n[e];Z(t!=null,`No layout data found for index ${e}`),n[e]=100/r*t}let i=0;for(let e=0;e<t.length;e++){let r=n[e];Z(r!=null,`No layout data found for index ${e}`);let a=Gb({panelConstraints:t[e],size:r});r!=a&&(i+=r-a,n[e]=a)}if(!Rb(i,0))for(let e=0;e<t.length;e++){let r=n[e];Z(r!=null,`No layout data found for index ${e}`);let a=r+i,o=Gb({panelConstraints:t[e],size:a});if(r!==o&&(i-=o-r,n[e]=o,Rb(i,0)))break}let a=Object.keys(e);return n.reduce((e,t,n)=>(e[a[n]]=t,e),{})}function Xb({groupId:e}){let t=()=>{let{mountedGroups:t}=Vb();for(let[n,r]of t)if(n.id===e)return{group:n,...r};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){let{defaultLayoutDeferred:e,layout:n}=t();return e?{}:n},setLayout(e){let{defaultLayoutDeferred:n,derivedPanelConstraints:r,group:i,layout:a,separatorToPanels:o}=t(),s=Yb({layout:e,panelConstraints:r});return n?a:(Jb(a,s)||Hb(e=>({mountedGroups:new Map(e.mountedGroups).set(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,layout:s,separatorToPanels:o})})),s)}}}function Zb(e){let{mountedGroups:t}=Vb(),n=t.get(e);return Z(n,`Mounted Group ${e.id} not found`),n}function Qb(e,t){let n=qb(e),r=Zb(n),i=n.separators.find(t=>t.element===e);Z(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);Z(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=Xb({groupId:n.id}).getLayout(),c=Yb({layout:Kb({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});Jb(s,c)||Hb(e=>({mountedGroups:new Map(e.mountedGroups).set(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,layout:c,separatorToPanels:r.separatorToPanels})}))}function $b(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=qb(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&Qb(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&Qb(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&Qb(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&Qb(t,-5);break;case`End`:e.preventDefault(),Qb(t,100);break;case`Enter`:{e.preventDefault();let n=qb(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=Zb(n),o=n.separators.find(e=>e.element===t);Z(o,`Matching separator not found`);let s=a.get(o);Z(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(Z(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];Qb(t,(l.collapsedSize===e?n.inMemoryLastExpandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=qb(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);Z(r!==null,`Index not found`),n[e.shiftKey?r>0?r-1:n.length-1:r+1<n.length?r+1:0].focus();break}case`Home`:e.preventDefault(),Qb(t,-100);break}}var ex=e=>e,tx=()=>{},nx=1,rx=2,ix=4,ax=8,ox={coarse:10,precise:5};function sx(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=Eb(n,a.rect);switch(e){case`horizontal`:t.x<=i.x&&(r=a,i=t);break;case`vertical`:t.y<=i.y&&(r=a,i=t);break}}return r?{distance:i,hitRegion:r}:void 0}var cx;function lx(){return cx===void 0&&(cx=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),cx}function ux(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function dx(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:_x(e),b:_x(t)},r;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),r=e;Z(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:gx(hx(n.a)),b:gx(hx(n.b))};if(i.a===i.b){let e=r.childNodes,t={a:n.a.at(-1),b:n.b.at(-1)},i=e.length;for(;i--;){let n=e[i];if(n===t.a)return 1;if(n===t.b)return-1}}return Math.sign(i.a-i.b)}var fx=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function px(e){let t=getComputedStyle(vx(e)??e).display;return t===`flex`||t===`inline-flex`}function mx(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||px(e))||+t.opacity<1||`transform`in t&&t.transform!==`none`||`webkitTransform`in t&&t.webkitTransform!==`none`||`mixBlendMode`in t&&t.mixBlendMode!==`normal`||`filter`in t&&t.filter!==`none`||`webkitFilter`in t&&t.webkitFilter!==`none`||`isolation`in t&&t.isolation===`isolate`||fx.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function hx(e){let t=e.length;for(;t--;){let n=e[t];if(Z(n,`Missing node`),mx(n))return n}return null}function gx(e){return e&&Number(getComputedStyle(e).zIndex)||0}function _x(e){let t=[];for(;e;)t.push(e),e=vx(e);return t}function vx(e){let{parentNode:t}=e;return ux(t)?t.host:t}function yx(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function bx({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!Tb(n)||n.contains(e)||e.contains(n))return!0;if(dx(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(yx(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function xx(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=lx()?ox.coarse:ox.precise,a=Ob(r),o=sx(r.orientation,a,{x:e.clientX,y:e.clientY});o&&o.distance.x<=i&&o.distance.y<=i&&bx({groupElement:r.element,hitRegion:o.hitRegion.rect,pointerEventTarget:e.target})&&n.push(o.hitRegion)}),n}function Sx(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let{mountedGroups:t}=Vb(),n=xx(e,t),r=new Set,i=new Set,a=new Set,o=new Map,s=!1;n.forEach(e=>{r.add(e.group),e.panels.forEach(e=>{i.add(e)}),e.separator&&(a.add(e.separator),s||(s=!0,e.separator.element.focus()));let n=t.get(e.group);n&&o.set(e.group,n.layout)}),Hb({interactionState:{hitRegions:n,initialLayoutMap:o,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}}),n.length&&e.preventDefault()}function Cx({cursorFlags:e,groups:t,state:n}){let r=0,i=0;switch(n){case`active`:case`hover`:t.forEach(e=>{if(!e.disableCursor)switch(e.orientation){case`horizontal`:r++;break;case`vertical`:i++;break}})}if(r===0&&i===0)return null;switch(n){case`active`:{let t=(e&nx)!==0,n=(e&rx)!==0,r=(e&ix)!==0,i=(e&ax)!==0;if(e){if(t)return r?`se-resize`:i?`ne-resize`:`e-resize`;if(n)return r?`sw-resize`:i?`nw-resize`:`w-resize`;if(r)return`s-resize`;if(i)return`n-resize`}break}}return r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`}var wx=new WeakMap;function Tx(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=wx.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets=[n]);let{cursorFlags:r,interactionState:i}=Vb();switch(i.state){case`active`:case`hover`:{let e=Cx({cursorFlags:r,groups:i.hitRegions.map(e=>e.group),state:i.state}),a=`*{cursor: ${e} !important; ${i.state===`active`?`touch-action: none;`:``} }`;if(t===a)return;t=a,e?n.cssRules.length===0?n.insertRule(a):n.replaceSync(a):n.cssRules.length===1&&n.deleteRule(0);break}case`inactive`:t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}wx.set(e,{prevStyle:t,styleSheet:n})}function Ex({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:i,pointerDownAtPoint:a}){let o=0,s=new Map(i);n.forEach(e=>{let{group:n,groupSize:c}=e,{disableCursor:l,orientation:u,panels:d}=n,f=0;f=a?u===`horizontal`?(t.clientX-a.x)/c*100:(t.clientY-a.y)/c*100:u===`horizontal`?t.clientX<0?-100:100:t.clientY<0?-100:100;let p=r.get(n),{defaultLayoutDeferred:m,derivedPanelConstraints:h,layout:g,separatorToPanels:_}=i.get(n)??{defaultLayoutDeferred:!1};if(h&&p&&g&&_){let t=Kb({delta:f,initialLayout:p,panelConstraints:h,pivotIndices:e.panels.map(e=>d.indexOf(e)),prevLayout:g,trigger:`mouse-or-touch`});if(Jb(t,g)){if(f!==0&&!l)switch(u){case`horizontal`:o|=f<0?nx:rx;break;case`vertical`:o|=f<0?ix:ax;break}}else{s.set(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,layout:t,separatorToPanels:_});let n=e.group.panels.map(({id:e})=>e).join(`,`);e.group.inMemoryLayouts[n]=t}}}),Hb({cursorFlags:o,mountedGroups:s}),Tx(e)}function Dx(e){let{interactionState:t,mountedGroups:n}=Vb();switch(t.state){case`active`:Ex({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n})}}function Ox(e){if(e.defaultPrevented)return;let{interactionState:t,mountedGroups:n}=Vb();switch(t.state){case`active`:if(e.buttons===0){Hb(e=>e.interactionState.state===`inactive`?e:{cursorFlags:0,interactionState:{state:`inactive`}});return}Ex({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint});break;default:{let r=xx(e,n);r.length===0?t.state!==`inactive`&&Hb({interactionState:{state:`inactive`}}):Hb({interactionState:{hitRegions:r,state:`hover`}}),Tx(e.currentTarget);break}}}function kx(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;e.preventDefault();let{interactionState:t}=Vb();switch(t.state){case`active`:Hb({cursorFlags:0,interactionState:{state:`inactive`}}),Tx(e.currentTarget)}}function Ax(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=Fb(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=Fb((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function jx(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=xb({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:Fb(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function Mx(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function Nx(e,t){let n=e.map(e=>e.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(let e of n)if(!r.includes(e))return!1;return!0}var Px=new Map;function Fx(e){let t=!0;Z(e.element.ownerDocument.defaultView,`Cannot register an unmounted Group`);let n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,i=new Set,a=new n(n=>{for(let r of n){let{borderBoxSize:n,target:i}=r;if(i===e.element){if(t){if(xb({group:e})===0)return;Hb(t=>{let n=t.mountedGroups.get(e);if(n){let r=Ib(e),i=n.defaultLayoutDeferred?Ax(r):n.layout,a=Yb({layout:i,panelConstraints:r});return!n.defaultLayoutDeferred&&Jb(i,a)&&Mx(n.derivedPanelConstraints,r)?t:{mountedGroups:new Map(t.mountedGroups).set(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,layout:a,separatorToPanels:n.separatorToPanels})}}return t})}}else jx(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{Z(!r.has(e.id),`Panel ids must be unique; id "${e.id}" was used more than once`),r.add(e.id),e.onResize&&a.observe(e.element)});let o=xb({group:e}),s=Ib(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.defaultLayout;l&&(Nx(e.panels,l)||(l=void 0));let u=Yb({layout:e.inMemoryLayouts[c]??l??Ax(s),panelConstraints:s}),d=Ob(e),f=e.element.ownerDocument;return Hb(t=>{let n=new Map;return Px.set(f,(Px.get(f)??0)+1),d.forEach(e=>{e.separator&&n.set(e.separator,e.panels)}),{mountedGroups:new Map(t.mountedGroups).set(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,layout:u,separatorToPanels:n})}}),e.separators.forEach(e=>{Z(!i.has(e.id),`Separator ids must be unique; id "${e.id}" was used more than once`),i.add(e.id),e.element.addEventListener(`keydown`,$b)}),Px.get(f)===1&&(f.addEventListener(`pointerdown`,Sx,!0),f.addEventListener(`pointerleave`,Dx),f.addEventListener(`pointermove`,Ox),f.addEventListener(`pointerup`,kx,!0)),function(){t=!1,Px.set(f,Math.max(0,(Px.get(f)??0)-1)),Hb(t=>{let n=new Map(t.mountedGroups);return n.delete(e),{mountedGroups:n}}),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,$b)}),Px.get(f)||(f.removeEventListener(`pointerdown`,Sx,!0),f.removeEventListener(`pointerleave`,Dx),f.removeEventListener(`pointermove`,Ox),f.removeEventListener(`pointerup`,kx,!0)),a.disconnect()}}function Ix(){let[e,n]=(0,t.useState)({});return[e,(0,t.useCallback)(()=>n({}),[])]}function Lx(e){let n=(0,t.useId)();return`${e??n}`}var Rx=typeof window<`u`?t.useLayoutEffect:t.useEffect;function zx(e){let n=(0,t.useRef)(e);return Rx(()=>{n.current=e},[e]),(0,t.useCallback)((...e)=>n.current?.(...e),[n])}function Bx(...e){return zx(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function Vx(e){let n=(0,t.useRef)({...e});return Rx(()=>{for(let t in e)n.current[t]=e[t]},[e]),n.current}var Hx=`--react-resizable-panels--panel--pointer-events`;function Ux(e,t){return`--react-resizable-panels--${e.replace(/[^a-zA-Z0-9\-_]/g,``)}--${t.replace(/[^a-zA-Z0-9\-_]/g,``)}`}var Wx=(0,t.createContext)(null);function Gx(e,n){let r=(0,t.useRef)({getLayout:()=>({}),setLayout:ex});(0,t.useImperativeHandle)(n,()=>r.current,[]),Rx(()=>{Object.assign(r.current,Xb({groupId:e}))})}function Kx({children:e,className:n,defaultLayout:i,disableCursor:a,disabled:o,elementRef:s,groupRef:c,id:l,onLayoutChange:u,orientation:d=`horizontal`,style:f,...p}){let m=(0,t.useRef)({}),h=zx(e=>{Jb(m.current,e)||(m.current=e,u?.(e))}),g=Lx(l),_=(0,t.useRef)(null),[v,y]=(0,t.useState)(!1),[b,x]=(0,t.useState)(i??{}),[S,C]=Ix(),w=(0,t.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],separators:[]}),T=Bx(_,s);Gx(g,c);let E=(0,t.useMemo)(()=>({id:g,orientation:d,registerPanel:e=>{let t=w.current;return t.panels=Sb(d,[...t.panels,e]),C(),()=>{t.panels=t.panels.filter(t=>t!==e),C()}},registerSeparator:e=>{let t=w.current;return t.separators=Sb(d,[...t.separators,e]),C(),()=>{t.separators=t.separators.filter(t=>t!==e),C()}}}),[g,C,d]),D=Vx({defaultLayout:i,disableCursor:a}),O=(0,t.useRef)(null);Rx(()=>{let e=_.current;if(e===null)return;let t=w.current,n={defaultLayout:D.defaultLayout,disableCursor:!!D.disableCursor,disabled:!!o,element:e,id:g,inMemoryLastExpandedPanelSizes:w.current.lastExpandedPanelSizes,inMemoryLayouts:w.current.layouts,orientation:d,panels:t.panels,separators:t.separators};O.current=n;let r=Fx(n),i=Vb().mountedGroups.get(n);if(i){let{defaultLayoutDeferred:e,derivedPanelConstraints:t,layout:n}=i;!e&&t.length>0&&(x(n),h?.(n))}let a=Bb.addListener(`interactionStateChange`,e=>{switch(e.state){case`active`:y(e.hitRegions.some(e=>e.group===n));break;default:y(!1);break}}),s=Bb.addListener(`mountedGroupsChange`,e=>{let t=e.get(n);if(t){let{defaultLayoutDeferred:e,derivedPanelConstraints:n,layout:r}=t;if(e||n.length===0)return;x(r),h?.(r)}});return()=>{O.current=null,r(),a(),s()}},[o,g,h,d,S,D]),(0,t.useEffect)(()=>{let e=O.current;e&&(e.defaultLayout=i,e.disableCursor=!!a)});let k={[Hx]:v?`none`:void 0};for(let e in b){let t=Ux(g,e);k[t]=b[e]}return(0,r.jsx)(Wx.Provider,{value:E,children:(0,r.jsx)(`div`,{...p,"aria-orientation":d,className:n,"data-group":!0,"data-testid":g,id:g,ref:T,style:{height:`100%`,width:`100%`,overflow:`hidden`,...f,...k,display:`flex`,flexDirection:d===`horizontal`?`row`:`column`,flexWrap:`nowrap`},children:e})})}Kx.displayName=`Group`;function qx(){let e=(0,t.useContext)(Wx);return Z(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function Jx({groupId:e,panelId:t}){let n=()=>{let{mountedGroups:t}=Vb();for(let[n,{defaultLayoutDeferred:r,derivedPanelConstraints:i,layout:a,separatorToPanels:o}]of t)if(n.id===e)return{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:n,layout:a,separatorToPanels:o};throw Error(`Group ${e} not found`)},r=()=>{let e=n().derivedPanelConstraints.find(e=>e.panelId===t);if(e!==void 0)return e;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{let e=n().group.panels.find(e=>e.id===t);if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},a=()=>{let e=n().layout[t];if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},o=e=>{let r=a();if(e===r)return;let{defaultLayoutDeferred:i,derivedPanelConstraints:o,group:s,layout:c,separatorToPanels:l}=n(),u=s.panels.findIndex(e=>e.id===t),d=u===s.panels.length-1,f=Yb({layout:Kb({delta:d?r-e:e-r,initialLayout:c,panelConstraints:o,pivotIndices:d?[u-1,u]:[u,u+1],prevLayout:c,trigger:`imperative-api`}),panelConstraints:o});Jb(c,f)||Hb(e=>({mountedGroups:new Map(e.mountedGroups).set(s,{defaultLayoutDeferred:i,derivedPanelConstraints:o,layout:f,separatorToPanels:l})}))};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=r(),{mutableValues:n}=i(),s=a();e&&s!==t&&(n.expandToSize=s,o(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:n}=r(),{mutableValues:s}=i(),c=a();if(e&&c===t){let e=s.expandToSize??n;e===0&&(e=1),o(e)}},getSize:()=>{let{group:e}=n(),t=a(),{element:r}=i();return{asPercentage:t,inPixels:e.orientation===`horizontal`?r.offsetWidth:r.offsetHeight}},isCollapsed:()=>{let{collapsible:e,collapsedSize:t}=r(),n=a();return e&&Rb(t,n)},resize:e=>{if(a()!==e){let t;switch(typeof e){case`number`:{let{group:r}=n();t=Fb(e/xb({group:r})*100);break}case`string`:t=parseFloat(e);break}o(t)}}}}function Yx(e,n){let{id:r}=qx(),i=(0,t.useRef)({collapse:tx,expand:tx,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:tx});(0,t.useImperativeHandle)(n,()=>i.current,[]),Rx(()=>{Object.assign(i.current,Jx({groupId:r,panelId:e}))})}function Xx({children:e,className:n,collapsedSize:i=`0%`,collapsible:a=!1,defaultSize:o,elementRef:s,id:c,maxSize:l=`100%`,minSize:u=`0%`,onResize:d,panelRef:f,style:p,...m}){let h=!!c,g=Lx(c),_=(0,t.useRef)(null),v=Bx(_,s),{id:y,registerPanel:b}=qx(),x=d!==null,S=zx((e,t,n)=>{d?.(e,c,n)});Rx(()=>{let e=_.current;if(e!==null)return b({element:e,id:g,idIsStable:h,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:x?S:void 0,panelConstraints:{collapsedSize:i,collapsible:a,defaultSize:o,maxSize:l,minSize:u}})},[i,a,o,x,g,h,l,u,S,b]),Yx(g,f);let C=Ux(y,g);return(0,r.jsx)(`div`,{...m,"data-panel":!0,"data-testid":g,id:g,ref:v,style:{...Zx,flexBasis:0,flexGrow:`var(${C}, 1)`,flexShrink:1,overflow:`hidden`,pointerEvents:`var(${Hx})`},children:(0,r.jsx)(`div`,{className:n,style:{width:`100%`,height:`100%`,...p},children:e})})}Xx.displayName=`Panel`;var Zx={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function Qx({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let i,a,o=e[n],s=t.find(e=>e.panelId===n);if(s){let c=s.maxSize,l=a=s.collapsible?s.collapsedSize:s.minSize,u=[r,r+1];a=Yb({layout:Kb({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e,trigger:`keyboard`}),panelConstraints:t})[n],i=Yb({layout:Kb({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e,trigger:`keyboard`}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function $x({children:e,className:n,elementRef:i,id:a,style:o,...s}){let c=Lx(a),[l,u]=(0,t.useState)({}),[d,f]=(0,t.useState)(`inactive`),p=(0,t.useRef)(null),m=Bx(p,i),{id:h,orientation:g,registerSeparator:_}=qx(),v=g===`horizontal`?`vertical`:`horizontal`;return Rx(()=>{let e=p.current;if(e!==null){let t={element:e,id:c},n=_(t),r=Bb.addListener(`interactionStateChange`,e=>{f(e.state!==`inactive`&&e.hitRegions.some(e=>e.separator===t)?e.state:`inactive`)}),i=Bb.addListener(`mountedGroupsChange`,e=>{e.forEach(({derivedPanelConstraints:e,layout:n,separatorToPanels:r},i)=>{if(i.id===h){let a=r.get(t);if(a){let t=a[0],r=i.panels.indexOf(t);u(Qx({layout:n,panelConstraints:e,panelId:t.id,panelIndex:r}))}}})});return()=>{r(),i(),n()}}},[h,c,_]),(0,r.jsx)(`div`,{...s,"aria-controls":l.valueControls,"aria-orientation":v,"aria-valuemax":l.valueMax,"aria-valuemin":l.valueMin,"aria-valuenow":l.valueNow,children:e,className:n,"data-separator":d,"data-testid":c,id:c,ref:m,role:`separator`,style:{flexBasis:`auto`,...o,flexGrow:0,flexShrink:0},tabIndex:0})}$x.displayName=`Separator`;let eS=(0,t.createContext)(void 0);var tS=[`Arial`,`Helvetica`,`Times New Roman`,`Courier New`,`Verdana`,`Georgia`,`Palatino`,`Garamond`,`Bookman`,`Comic Sans MS`,`Trebuchet MS`,`Arial Black`,`Impact`];let nS=({children:e,isList:n=!1,availableProps:i=[],theme:a=`light`})=>{let[o,s]=(0,t.useState)({elements:[],selectedElementIds:[],isList:n,mockData:[],singleMockData:{},listSettings:{sortOrder:`asc`,newestPosition:`bottom`,scrollDirection:`down`},availableProps:i,availableFonts:[...tS,`Roboto`,`Open Sans`,`Lato`,`Montserrat`],theme:a,history:[[]],historyDescriptions:[],historyIndex:0,clipboard:[],gridSize:0,zoom:1,pan:{x:0,y:0},snapLines:[],assets:[],isPropertiesPanelOpen:!1});t.default.useEffect(()=>{o.availableFonts.forEach(e=>{if(tS.includes(e))return;let t=`font-${e.replace(/\s+/g,`-`).toLowerCase()}`;if(!document.getElementById(t)){let n=document.createElement(`link`);n.id=t,n.href=`https://fonts.googleapis.com/css2?family=${e.replace(/ /g,`+`)}&display=swap`,n.rel=`stylesheet`,document.head.appendChild(n)}})},[o.availableFonts]),t.default.useEffect(()=>{s(e=>({...e,isList:n,availableProps:i,theme:a}))},[n,i,a]);let c=t.default.useCallback(e=>{s(t=>({...t,isPropertiesPanelOpen:e}))},[]),l=t.default.useCallback(e=>{s(t=>({...t,canvasHeight:e}))},[]),u=t.default.useCallback(e=>{s(t=>({...t,gridSize:e}))},[]),d=t.default.useCallback(e=>{s(t=>({...t,zoom:e}))},[]),f=t.default.useCallback(e=>{s(t=>({...t,pan:e}))},[]),p=t.default.useCallback(e=>{s(t=>({...t,snapLines:e}))},[]),m=t.default.useCallback(e=>{s(t=>{let n=e.elements||t.elements,r=[],i=new Set;return n.forEach(e=>{let t=e.id;(!t||i.has(t))&&(t=crypto.randomUUID()),i.add(t),r.push({...e,id:t,x:Number.isFinite(e.x)?e.x:0,y:Number.isFinite(e.y)?e.y:0,width:Number.isFinite(e.width)?e.width:100,height:Number.isFinite(e.height)?e.height:100,locked:!!e.locked,hidden:!!e.hidden})}),{...t,...e,elements:r,isList:e.isList??t.isList,availableProps:e.availableProps??t.availableProps,availableFonts:e.availableFonts??t.availableFonts,selectedElementIds:[],history:[r],historyIndex:0,clipboard:[]}})},[]),h=t.default.useCallback(()=>{s(e=>{if(e.historyIndex>0){let t=e.historyIndex-1;return{...e,elements:e.history[t],historyIndex:t,selectedElementIds:[]}}return e})},[]),g=t.default.useCallback(()=>{s(e=>{if(e.historyIndex<e.history.length-1){let t=e.historyIndex+1;return{...e,elements:e.history[t],historyIndex:t,selectedElementIds:[]}}return e})},[]),_=t.default.useCallback(e=>{s(t=>e>=0&&e<t.history.length?{...t,elements:t.history[e],historyIndex:e,selectedElementIds:[]}:t)},[]),v=t.default.useCallback(()=>{s(e=>{if(e.selectedElementIds.length>0){let t=e.elements.filter(t=>e.selectedElementIds.includes(t.id));return{...e,clipboard:t}}return e})},[]),y=t.default.useCallback(()=>{s(e=>{if(e.clipboard.length>0){let t=e.clipboard.map(e=>({...e,id:crypto.randomUUID(),x:e.x+20,y:e.y+20})),n=[...e.elements,...t],r=e.history.slice(0,e.historyIndex+1);r.push(n);let i=e.historyDescriptions.slice(0,e.historyIndex+1);return i.push(`Colar Elementos`),{...e,elements:n,history:r,historyDescriptions:i,historyIndex:r.length-1,selectedElementIds:t.map(e=>e.id)}}return e})},[]),b=t.default.useCallback(e=>{let t={};e.type===`box`&&(t.backgroundColor=`var(--gray-4)`),e.type===`text-container`&&(t.backgroundColor=`var(--gray-4)`,t.border=`1px solid var(--gray-8)`,t.padding=`8px`,t.display=`flex`,t.alignItems=`flex-start`,t.justifyContent=`flex-start`);let n={id:crypto.randomUUID(),x:50,y:50,width:200,height:e.type===`text`?50:150,...e,style:{...t,...e.style||{}}};s(e=>{let t=[...e.elements,n],r=e.history.slice(0,e.historyIndex+1);r.push(t);let i=e.historyDescriptions.slice(0,e.historyIndex+1),a={text:`Texto`,image:`Imagem`,box:`Caixa`,group:`Grupo`,"text-container":`Texto em Caixa`,checkbox:`Caixa de Seleção`}[n.type]||n.type;return i.push(`Adicionou ${a}`),{...e,elements:t,history:r,historyDescriptions:i,historyIndex:r.length-1,selectedElementIds:[n.id]}})},[]),x=t.default.useCallback(e=>{s(t=>{let n=t.elements.filter(t=>t.id!==e),r=t.history.slice(0,t.historyIndex+1);r.push(n);let i=t.historyDescriptions.slice(0,t.historyIndex+1);return i.push(`Remover Elemento`),{...t,elements:n,selectedElementIds:t.selectedElementIds.filter(t=>t!==e),history:r,historyDescriptions:i,historyIndex:r.length-1}})},[]),S=t.default.useCallback(()=>{s(e=>{if(e.selectedElementIds.length===0)return e;let t=e.elements.filter(t=>!e.selectedElementIds.includes(t.id)),n=e.history.slice(0,e.historyIndex+1);n.push(t);let r=e.historyDescriptions.slice(0,e.historyIndex+1);return r.push(`Remover Itens Selecionados`),{...e,elements:t,selectedElementIds:[],history:n,historyDescriptions:r,historyIndex:n.length-1}})},[]),C=t.default.useCallback((e,t=!1)=>{s(n=>{if(e===null)return{...n,selectedElementIds:[]};if(t){let t=n.selectedElementIds.includes(e),r;return r=t?n.selectedElementIds.filter(t=>t!==e):[...n.selectedElementIds,e],{...n,selectedElementIds:r}}else return{...n,selectedElementIds:[e]}})},[]),w=t.default.useCallback(e=>{s(t=>({...t,selectedElementIds:e}))},[]),T=t.default.useCallback((e,t)=>{s(n=>{let r=[...n.elements],i=r[e];r.splice(e,1),r.splice(t,0,i);let a=n.history.slice(0,n.historyIndex+1);a.push(r);let o=n.historyDescriptions.slice(0,n.historyIndex+1);return o.push(`Mover Elemento`),{...n,elements:r,history:a,historyDescriptions:o,historyIndex:a.length-1}})},[]),E=t.default.useCallback((e,t,n=!0)=>{s(r=>{let i=r.elements.map(n=>n.id===e?{...n,...t}:n),a=r.history,o=r.historyIndex,s=r.historyDescriptions;return n&&(a=r.history.slice(0,r.historyIndex+1),a.push(i),o=a.length-1,s=r.historyDescriptions.slice(0,r.historyIndex+1),s.push(`Atualizar Elemento`)),{...r,elements:i,history:a,historyDescriptions:s,historyIndex:o}})},[]),D=t.default.useCallback((e,t=!0)=>{s(n=>{let r=[...n.elements],i=[],a=new Set;e.forEach(({id:e,changes:t})=>{let r=n.elements.find(t=>t.id===e);if(r)if(r.groupId&&(t.x!==void 0||t.y!==void 0)){let e=n.elements.find(e=>e.id===r.groupId);if(e&&!a.has(e.id)){let n=(t.x??r.x)-r.x,o=(t.y??r.y)-r.y;i.push({id:e.id,changes:{x:e.x+n,y:e.y+o}}),a.add(e.id)}}else i.push({id:e,changes:t})});let o=[...i];i.forEach(({id:e,changes:t})=>{if(t.x!==void 0||t.y!==void 0){let r=n.elements.find(t=>t.id===e);if(r&&r.type===`group`){let i=(t.x??r.x)-r.x,a=(t.y??r.y)-r.y;n.elements.forEach(t=>{t.groupId===e&&(o.some(e=>e.id===t.id)||o.push({id:t.id,changes:{x:t.x+i,y:t.y+a}}))})}}}),o.forEach(({id:e,changes:t})=>{let n=r.findIndex(t=>t.id===e);n!==-1&&(r[n]={...r[n],...t})});let s=n.history,c=n.historyIndex,l=n.historyDescriptions;return t&&(s=n.history.slice(0,n.historyIndex+1),s.push(r),c=s.length-1,l=n.historyDescriptions.slice(0,n.historyIndex+1),l.push(`Atualizar Múltiplos Elementos`)),{...n,elements:r,history:s,historyDescriptions:l,historyIndex:c}})},[]),O=t.default.useCallback(e=>{s(t=>{let n=t.elements.filter(t=>e.includes(t.id));if(n.length===0)return t;let r=Math.min(...n.map(e=>e.x)),i=Math.min(...n.map(e=>e.y)),a=Math.max(...n.map(e=>e.x+e.width)),o=Math.max(...n.map(e=>e.y+e.height)),s={id:crypto.randomUUID(),type:`group`,name:`Novo Grupo`,content:``,x:r,y:i,width:a-r,height:o-i,style:{zIndex:0}},c=t.elements.map(t=>e.includes(t.id)?{...t,groupId:s.id}:t);c.push(s);let l=t.history.slice(0,t.historyIndex+1);l.push(c);let u=t.historyDescriptions.slice(0,t.historyIndex+1);return u.push(`Agrupar Elementos`),{...t,elements:c,selectedElementIds:[s.id],history:l,historyDescriptions:u,historyIndex:l.length-1}})},[]),k=t.default.useCallback(e=>{s(t=>{let n=t.elements.find(t=>t.id===e);if(!n||n.type!==`group`)return t;let r=[],i=t.elements.filter(t=>t.id!==e).map(t=>t.groupId===e?(r.push(t.id),{...t,groupId:void 0}):t),a=t.history.slice(0,t.historyIndex+1);a.push(i);let o=t.historyDescriptions.slice(0,t.historyIndex+1);return o.push(`Desagrupar Elementos`),{...t,elements:i,selectedElementIds:r,history:a,historyDescriptions:o,historyIndex:a.length-1}})},[]),A=t.default.useCallback((e,t)=>{s(n=>{let r=n.elements.map(n=>n.id===e?{...n,name:t}:n);return{...n,elements:r}})},[]),j=t.default.useCallback((e,t)=>{if(!e.find(e=>e.id===t&&e.type===`group`))return e;let n=e.filter(e=>e.groupId===t);if(n.length===0)return e;let r=Math.min(...n.map(e=>e.x)),i=Math.min(...n.map(e=>e.y)),a=Math.max(...n.map(e=>e.x+e.width)),o=Math.max(...n.map(e=>e.y+e.height));return e.map(e=>e.id===t?{...e,x:r,y:i,width:a-r,height:o-i}:e)},[]),M=t.default.useCallback((e,t)=>{s(n=>{let r=n.elements.find(t=>t.id===e),i=n.elements.find(e=>e.id===t&&e.type===`group`);if(!r||!i)return n;let a=n.elements.map(n=>n.id===e?{...n,groupId:t}:n);a=j(a,t);let o=n.history.slice(0,n.historyIndex+1);o.push(a);let s=n.historyDescriptions.slice(0,n.historyIndex+1);return s.push(`Adicionar ao Grupo`),{...n,elements:a,history:o,historyDescriptions:s,historyIndex:o.length-1}})},[j]),N=t.default.useCallback(e=>{s(t=>{let n=t.elements.find(t=>t.id===e);if(!n||!n.groupId)return t;let r=n.groupId,i=t.elements.map(t=>t.id===e?{...t,groupId:void 0}:t);i=j(i,r);let a=t.history.slice(0,t.historyIndex+1);a.push(i);let o=t.historyDescriptions.slice(0,t.historyIndex+1);return o.push(`Remover do Grupo`),{...t,elements:i,history:a,historyDescriptions:o,historyIndex:a.length-1}})},[j]),P=t.default.useCallback((e,t,n)=>{s(r=>{let i=r.elements.find(t=>t.id===e&&t.type===`group`);if(!i)return r;let a=t/i.width,o=n/i.height,s=i.x,c=i.y,l=r.elements.map(r=>{if(r.id===e)return{...r,width:t,height:n};if(r.groupId===e){let e=r.x-s,t=r.y-c,n=s+e*a,i=c+t*o;return{...r,x:n,y:i,width:Math.max(1,r.width*a),height:Math.max(1,r.height*o)}}return r}),u=r.history.slice(0,r.historyIndex+1);u.push(l);let d=r.historyDescriptions.slice(0,r.historyIndex+1);return d.push(`Redimensionar Grupo`),{...r,elements:l,history:u,historyDescriptions:d,historyIndex:u.length-1}})},[]),ee=t.default.useCallback((e,t)=>{s(n=>({...n,mockData:e,singleMockData:t}))},[]),F=t.default.useCallback(e=>{s(t=>({...t,listSettings:{...t.listSettings,...e}}))},[]),te=t.default.useCallback(e=>{s(t=>({...t,assets:[...t.assets,e]}))},[]),I=t.default.useCallback(e=>{s(t=>({...t,assets:t.assets.filter(t=>t.id!==e)}))},[]);return(0,r.jsx)(eS.Provider,{value:t.default.useMemo(()=>({state:o,setGridSize:u,setZoom:d,setPan:f,setSnapLines:p,addElement:b,removeElement:x,removeSelected:S,selectElement:C,setSelectedElements:w,moveElement:T,updateElement:E,updateElements:D,groupElements:O,ungroupElements:k,renameElement:A,addToGroup:M,removeFromGroup:N,resizeGroup:P,setMockData:ee,updateListSettings:F,setCanvasHeight:l,loadState:m,undo:h,redo:g,jumpToHistory:_,copy:v,paste:y,setPropertiesPanelOpen:c,addAsset:te,removeAsset:I}),[o,b,x,S,C,w,T,E,D,O,k,A,M,N,P,ee,F,l,m,h,g,_,v,y,u,d,f,p,te,I,c]),children:e})},rS=()=>{let e=(0,t.useContext)(eS);if(!e)throw Error(`useEditor must be used within an EditorProvider`);return e},iS=()=>{let{state:e,updateElements:t}=rS(),{selectedElementIds:n,elements:i}=e;if(n.length<2)return null;let a=()=>i.filter(e=>n.includes(e.id));return(0,r.jsxs)(W,{gap:`2`,align:`center`,wrap:`wrap`,style:{backgroundColor:`var(--color-panel-solid)`,padding:`8px`,borderRadius:`8px`,boxShadow:`0 2px 10px rgba(0,0,0,0.1)`,border:`1px solid var(--gray-5)`,maxWidth:`90vw`,justifyContent:`center`},children:[(0,r.jsx)(J,{variant:`ghost`,color:`gray`,onClick:()=>{let e=a();if(e.length<2)return;let n=Math.min(...e.map(e=>e.x));t(e.map(e=>({id:e.id,changes:{x:n}})))},title:`Alinhar à Esquerda`,children:(0,r.jsx)(T,{})}),(0,r.jsx)(J,{variant:`ghost`,color:`gray`,onClick:()=>{let e=a();if(e.length<2)return;let n=(Math.min(...e.map(e=>e.x))+Math.max(...e.map(e=>e.x+e.width)))/2;t(e.map(e=>({id:e.id,changes:{x:n-e.width/2}})))},title:`Alinhar ao Centro (Horizontal)`,children:(0,r.jsx)(x,{})}),(0,r.jsx)(J,{variant:`ghost`,color:`gray`,onClick:()=>{let e=a();if(e.length<2)return;let n=Math.max(...e.map(e=>e.x+e.width));t(e.map(e=>({id:e.id,changes:{x:n-e.width}})))},title:`Alinhar à Direita`,children:(0,r.jsx)(D,{})}),(0,r.jsx)(Qy,{orientation:`vertical`}),(0,r.jsx)(J,{variant:`ghost`,color:`gray`,onClick:()=>{let e=a();if(e.length<2)return;let n=Math.min(...e.map(e=>e.y));t(e.map(e=>({id:e.id,changes:{y:n}})))},title:`Alinhar ao Topo`,children:(0,r.jsx)(k,{})}),(0,r.jsx)(J,{variant:`ghost`,color:`gray`,onClick:()=>{let e=a();if(e.length<2)return;let n=(Math.min(...e.map(e=>e.y))+Math.max(...e.map(e=>e.y+e.height)))/2;t(e.map(e=>({id:e.id,changes:{y:n-e.height/2}})))},title:`Alinhar ao Centro (Vertical)`,children:(0,r.jsx)(C,{})}),(0,r.jsx)(J,{variant:`ghost`,color:`gray`,onClick:()=>{let e=a();if(e.length<2)return;let n=Math.max(...e.map(e=>e.y+e.height));t(e.map(e=>({id:e.id,changes:{y:n-e.height}})))},title:`Alinhar à Base`,children:(0,r.jsx)(y,{})}),n.length>=3&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(Qy,{orientation:`vertical`}),(0,r.jsx)(J,{variant:`ghost`,color:`gray`,onClick:()=>{let e=a();if(e.length<3)return;let n=[...e].sort((e,t)=>e.x-t.x),r=n[0],i=n[n.length-1],o=(i.x+i.width/2-(r.x+r.width/2))/(n.length-1);t(n.map((e,t)=>{if(t===0||t===n.length-1)return null;let i=r.x+r.width/2+o*t;return{id:e.id,changes:{x:i-e.width/2}}}).filter(e=>e!==null))},title:`Distribuir Horizontalmente`,children:(0,r.jsx)(wt,{})}),(0,r.jsx)(J,{variant:`ghost`,color:`gray`,onClick:()=>{let e=a();if(e.length<3)return;let n=[...e].sort((e,t)=>e.y-t.y),r=n[0],i=n[n.length-1],o=(i.y+i.height/2-(r.y+r.height/2))/(n.length-1);t(n.map((e,t)=>{if(t===0||t===n.length-1)return null;let i=r.y+r.height/2+o*t;return{id:e.id,changes:{y:i-e.height/2}}}).filter(e=>e!==null))},title:`Distribuir Verticalmente`,children:(0,r.jsx)(Et,{})})]})]})};var aS=function(){return aS=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},aS.apply(this,arguments)},oS={width:`100%`,height:`10px`,top:`0px`,left:`0px`,cursor:`row-resize`},sS={width:`10px`,height:`100%`,top:`0px`,left:`0px`,cursor:`col-resize`},cS={width:`20px`,height:`20px`,position:`absolute`,zIndex:1},lS={top:aS(aS({},oS),{top:`-5px`}),right:aS(aS({},sS),{left:void 0,right:`-5px`}),bottom:aS(aS({},oS),{top:void 0,bottom:`-5px`}),left:aS(aS({},sS),{left:`-5px`}),topRight:aS(aS({},cS),{right:`-10px`,top:`-10px`,cursor:`ne-resize`}),bottomRight:aS(aS({},cS),{right:`-10px`,bottom:`-10px`,cursor:`se-resize`}),bottomLeft:aS(aS({},cS),{left:`-10px`,bottom:`-10px`,cursor:`sw-resize`}),topLeft:aS(aS({},cS),{left:`-10px`,top:`-10px`,cursor:`nw-resize`})},uS=(0,t.memo)(function(e){var n=e.onResizeStart,i=e.direction,a=e.children,o=e.replaceStyles,s=e.className,c=(0,t.useCallback)(function(e){n(e,i)},[n,i]),l=(0,t.useCallback)(function(e){n(e,i)},[n,i]),u=(0,t.useMemo)(function(){return aS(aS({position:`absolute`,userSelect:`none`},lS[i]),o??{})},[o,i]);return(0,r.jsx)(`div`,{className:s||void 0,style:u,onMouseDown:c,onTouchStart:l,children:a})}),dS=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),fS=function(){return fS=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},fS.apply(this,arguments)},pS={width:`auto`,height:`auto`},mS=function(e,t,n){return Math.max(Math.min(e,n),t)},hS=function(e,t,n){var r=Math.round(e/t);return r*t+n*(r-1)},gS=function(e,t){return new RegExp(e,`i`).test(t)},_S=function(e){return!!(e.touches&&e.touches.length)},vS=function(e){return!!((e.clientX||e.clientX===0)&&(e.clientY||e.clientY===0))},yS=function(e,t,n){n===void 0&&(n=0);var r=t.reduce(function(n,r,i){return Math.abs(r-e)<Math.abs(t[n]-e)?i:n},0),i=Math.abs(t[r]-e);return n===0||i<n?t[r]:e},bS=function(e){return e=e.toString(),e===`auto`||e.endsWith(`px`)||e.endsWith(`%`)||e.endsWith(`vh`)||e.endsWith(`vw`)||e.endsWith(`vmax`)||e.endsWith(`vmin`)?e:`${e}px`},xS=function(e,t,n,r){if(e&&typeof e==`string`){if(e.endsWith(`px`))return Number(e.replace(`px`,``));if(e.endsWith(`%`)){var i=Number(e.replace(`%`,``))/100;return t*i}if(e.endsWith(`vw`)){var i=Number(e.replace(`vw`,``))/100;return n*i}if(e.endsWith(`vh`)){var i=Number(e.replace(`vh`,``))/100;return r*i}}return e},SS=function(e,t,n,r,i,a,o){return r=xS(r,e.width,t,n),i=xS(i,e.height,t,n),a=xS(a,e.width,t,n),o=xS(o,e.height,t,n),{maxWidth:r===void 0?void 0:Number(r),maxHeight:i===void 0?void 0:Number(i),minWidth:a===void 0?void 0:Number(a),minHeight:o===void 0?void 0:Number(o)}},CS=function(e){return Array.isArray(e)?e:[e,e]},wS=`as.ref.style.className.grid.gridGap.snap.bounds.boundsByDirection.size.defaultSize.minWidth.minHeight.maxWidth.maxHeight.lockAspectRatio.lockAspectRatioExtraWidth.lockAspectRatioExtraHeight.enable.handleStyles.handleClasses.handleWrapperStyle.handleWrapperClass.children.onResizeStart.onResize.onResizeStop.handleComponent.scale.resizeRatio.snapGap`.split(`.`),TS=`__resizable_base__`,ES=function(e){dS(t,e);function t(t){var n=e.call(this,t)||this;return n.ratio=1,n.resizable=null,n.parentLeft=0,n.parentTop=0,n.resizableLeft=0,n.resizableRight=0,n.resizableTop=0,n.resizableBottom=0,n.targetLeft=0,n.targetTop=0,n.delta={width:0,height:0},n.appendBase=function(){if(!n.resizable||!n.window)return null;var e=n.parentNode;if(!e)return null;var t=n.window.document.createElement(`div`);return t.style.width=`100%`,t.style.height=`100%`,t.style.position=`absolute`,t.style.transform=`scale(0, 0)`,t.style.left=`0`,t.style.flex=`0 0 100%`,t.classList?t.classList.add(TS):t.className+=TS,e.appendChild(t),t},n.removeBase=function(e){var t=n.parentNode;t&&t.removeChild(e)},n.state={isResizing:!1,width:n.propsSize?.width??`auto`,height:n.propsSize?.height??`auto`,direction:`right`,original:{x:0,y:0,width:0,height:0},backgroundStyle:{height:`100%`,width:`100%`,backgroundColor:`rgba(0,0,0,0)`,cursor:`auto`,opacity:0,position:`fixed`,zIndex:9999,top:`0`,left:`0`,bottom:`0`,right:`0`},flexBasis:void 0},n.onResizeStart=n.onResizeStart.bind(n),n.onMouseMove=n.onMouseMove.bind(n),n.onMouseUp=n.onMouseUp.bind(n),n}return Object.defineProperty(t.prototype,`parentNode`,{get:function(){return this.resizable?this.resizable.parentNode:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,`window`,{get:function(){return!this.resizable||!this.resizable.ownerDocument?null:this.resizable.ownerDocument.defaultView},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,`propsSize`,{get:function(){return this.props.size||this.props.defaultSize||pS},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,`size`,{get:function(){var e=0,t=0;if(this.resizable&&this.window){var n=this.resizable.offsetWidth,r=this.resizable.offsetHeight,i=this.resizable.style.position;i!==`relative`&&(this.resizable.style.position=`relative`),e=this.resizable.style.width===`auto`?n:this.resizable.offsetWidth,t=this.resizable.style.height===`auto`?r:this.resizable.offsetHeight,this.resizable.style.position=i}return{width:e,height:t}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,`sizeStyle`,{get:function(){var e=this,t=this.props.size,n=function(t){if(e.state[t]===void 0||e.state[t]===`auto`)return`auto`;if(e.propsSize&&e.propsSize[t]&&e.propsSize[t]?.toString().endsWith(`%`)){if(e.state[t].toString().endsWith(`%`))return e.state[t].toString();var n=e.getParentSize();return`${Number(e.state[t].toString().replace(`px`,``))/n[t]*100}%`}return bS(e.state[t])};return{width:t&&t.width!==void 0&&!this.state.isResizing?bS(t.width):n(`width`),height:t&&t.height!==void 0&&!this.state.isResizing?bS(t.height):n(`height`)}},enumerable:!1,configurable:!0}),t.prototype.getParentSize=function(){if(!this.parentNode)return this.window?{width:this.window.innerWidth,height:this.window.innerHeight}:{width:0,height:0};var e=this.appendBase();if(!e)return{width:0,height:0};var t=!1,n=this.parentNode.style.flexWrap;n!==`wrap`&&(t=!0,this.parentNode.style.flexWrap=`wrap`),e.style.position=`relative`,e.style.minWidth=`100%`,e.style.minHeight=`100%`;var r={width:e.offsetWidth,height:e.offsetHeight};return t&&(this.parentNode.style.flexWrap=n),this.removeBase(e),r},t.prototype.bindEvents=function(){this.window&&(this.window.addEventListener(`mouseup`,this.onMouseUp),this.window.addEventListener(`mousemove`,this.onMouseMove),this.window.addEventListener(`mouseleave`,this.onMouseUp),this.window.addEventListener(`touchmove`,this.onMouseMove,{capture:!0,passive:!1}),this.window.addEventListener(`touchend`,this.onMouseUp))},t.prototype.unbindEvents=function(){this.window&&(this.window.removeEventListener(`mouseup`,this.onMouseUp),this.window.removeEventListener(`mousemove`,this.onMouseMove),this.window.removeEventListener(`mouseleave`,this.onMouseUp),this.window.removeEventListener(`touchmove`,this.onMouseMove,!0),this.window.removeEventListener(`touchend`,this.onMouseUp))},t.prototype.componentDidMount=function(){if(!(!this.resizable||!this.window)){var e=this.window.getComputedStyle(this.resizable);this.setState({width:this.state.width||this.size.width,height:this.state.height||this.size.height,flexBasis:e.flexBasis===`auto`?void 0:e.flexBasis})}},t.prototype.componentWillUnmount=function(){this.window&&this.unbindEvents()},t.prototype.createSizeForCssProperty=function(e,t){var n=this.propsSize&&this.propsSize[t];return this.state[t]===`auto`&&this.state.original[t]===e&&(n===void 0||n===`auto`)?`auto`:e},t.prototype.calculateNewMaxFromBoundary=function(e,t){var n=this.props.boundsByDirection,r=this.state.direction,i=n&&gS(`left`,r),a=n&&gS(`top`,r),o,s;if(this.props.bounds===`parent`){var c=this.parentNode;c&&(o=i?this.resizableRight-this.parentLeft:c.offsetWidth+(this.parentLeft-this.resizableLeft),s=a?this.resizableBottom-this.parentTop:c.offsetHeight+(this.parentTop-this.resizableTop))}else this.props.bounds===`window`?this.window&&(o=i?this.resizableRight:this.window.innerWidth-this.resizableLeft,s=a?this.resizableBottom:this.window.innerHeight-this.resizableTop):this.props.bounds&&(o=i?this.resizableRight-this.targetLeft:this.props.bounds.offsetWidth+(this.targetLeft-this.resizableLeft),s=a?this.resizableBottom-this.targetTop:this.props.bounds.offsetHeight+(this.targetTop-this.resizableTop));return o&&Number.isFinite(o)&&(e=e&&e<o?e:o),s&&Number.isFinite(s)&&(t=t&&t<s?t:s),{maxWidth:e,maxHeight:t}},t.prototype.calculateNewSizeFromDirection=function(e,t){var n=this.props.scale||1,r=CS(this.props.resizeRatio||1),i=r[0],a=r[1],o=this.state,s=o.direction,c=o.original,l=this.props,u=l.lockAspectRatio,d=l.lockAspectRatioExtraHeight,f=l.lockAspectRatioExtraWidth,p=c.width,m=c.height,h=d||0,g=f||0;return gS(`right`,s)&&(p=c.width+(e-c.x)*i/n,u&&(m=(p-g)/this.ratio+h)),gS(`left`,s)&&(p=c.width-(e-c.x)*i/n,u&&(m=(p-g)/this.ratio+h)),gS(`bottom`,s)&&(m=c.height+(t-c.y)*a/n,u&&(p=(m-h)*this.ratio+g)),gS(`top`,s)&&(m=c.height-(t-c.y)*a/n,u&&(p=(m-h)*this.ratio+g)),{newWidth:p,newHeight:m}},t.prototype.calculateNewSizeFromAspectRatio=function(e,t,n,r){var i=this.props,a=i.lockAspectRatio,o=i.lockAspectRatioExtraHeight,s=i.lockAspectRatioExtraWidth,c=r.width===void 0?10:r.width,l=n.width===void 0||n.width<0?e:n.width,u=r.height===void 0?10:r.height,d=n.height===void 0||n.height<0?t:n.height,f=o||0,p=s||0;if(a){var m=(u-f)*this.ratio+p,h=(d-f)*this.ratio+p,g=(c-p)/this.ratio+f,_=(l-p)/this.ratio+f,v=Math.max(c,m),y=Math.min(l,h),b=Math.max(u,g),x=Math.min(d,_);e=mS(e,v,y),t=mS(t,b,x)}else e=mS(e,c,l),t=mS(t,u,d);return{newWidth:e,newHeight:t}},t.prototype.setBoundingClientRect=function(){var e=1/(this.props.scale||1);if(this.props.bounds===`parent`){var t=this.parentNode;if(t){var n=t.getBoundingClientRect();this.parentLeft=n.left*e,this.parentTop=n.top*e}}if(this.props.bounds&&typeof this.props.bounds!=`string`){var r=this.props.bounds.getBoundingClientRect();this.targetLeft=r.left*e,this.targetTop=r.top*e}if(this.resizable){var i=this.resizable.getBoundingClientRect(),a=i.left,o=i.top,s=i.right,c=i.bottom;this.resizableLeft=a*e,this.resizableRight=s*e,this.resizableTop=o*e,this.resizableBottom=c*e}},t.prototype.onResizeStart=function(e,t){if(!(!this.resizable||!this.window)){var n=0,r=0;if(e.nativeEvent&&vS(e.nativeEvent)?(n=e.nativeEvent.clientX,r=e.nativeEvent.clientY):e.nativeEvent&&_S(e.nativeEvent)&&(n=e.nativeEvent.touches[0].clientX,r=e.nativeEvent.touches[0].clientY),!(this.props.onResizeStart&&this.resizable&&this.props.onResizeStart(e,t,this.resizable)===!1)){this.props.size&&(this.props.size.height!==void 0&&this.props.size.height!==this.state.height&&this.setState({height:this.props.size.height}),this.props.size.width!==void 0&&this.props.size.width!==this.state.width&&this.setState({width:this.props.size.width})),this.ratio=typeof this.props.lockAspectRatio==`number`?this.props.lockAspectRatio:this.size.width/this.size.height;var i,a=this.window.getComputedStyle(this.resizable);if(a.flexBasis!==`auto`){var o=this.parentNode;o&&(this.flexDir=this.window.getComputedStyle(o).flexDirection.startsWith(`row`)?`row`:`column`,i=a.flexBasis)}this.setBoundingClientRect(),this.bindEvents();var s={original:{x:n,y:r,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:fS(fS({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(e.target).cursor||`auto`}),direction:t,flexBasis:i};this.setState(s)}}},t.prototype.onMouseMove=function(e){var t=this;if(!(!this.state.isResizing||!this.resizable||!this.window)){if(this.window.TouchEvent&&_S(e))try{e.preventDefault(),e.stopPropagation()}catch{}var r=this.props,i=r.maxWidth,a=r.maxHeight,o=r.minWidth,s=r.minHeight,c=_S(e)?e.touches[0].clientX:e.clientX,l=_S(e)?e.touches[0].clientY:e.clientY,u=this.state,d=u.direction,f=u.original,p=u.width,m=u.height,h=this.getParentSize(),g=SS(h,this.window.innerWidth,this.window.innerHeight,i,a,o,s);i=g.maxWidth,a=g.maxHeight,o=g.minWidth,s=g.minHeight;var _=this.calculateNewSizeFromDirection(c,l),v=_.newHeight,y=_.newWidth,b=this.calculateNewMaxFromBoundary(i,a);this.props.snap&&this.props.snap.x&&(y=yS(y,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(v=yS(v,this.props.snap.y,this.props.snapGap));var x=this.calculateNewSizeFromAspectRatio(y,v,{width:b.maxWidth,height:b.maxHeight},{width:o,height:s});if(y=x.newWidth,v=x.newHeight,this.props.grid){var S=hS(y,this.props.grid[0],this.props.gridGap?this.props.gridGap[0]:0),C=hS(v,this.props.grid[1],this.props.gridGap?this.props.gridGap[1]:0),w=this.props.snapGap||0,T=w===0||Math.abs(S-y)<=w?S:y,E=w===0||Math.abs(C-v)<=w?C:v;y=T,v=E}var D={width:y-f.width,height:v-f.height};if(this.delta=D,p&&typeof p==`string`){if(p.endsWith(`%`)){var O=y/h.width*100;y=`${O}%`}else if(p.endsWith(`vw`)){var k=y/this.window.innerWidth*100;y=`${k}vw`}else if(p.endsWith(`vh`)){var A=y/this.window.innerHeight*100;y=`${A}vh`}}if(m&&typeof m==`string`){if(m.endsWith(`%`)){var O=v/h.height*100;v=`${O}%`}else if(m.endsWith(`vw`)){var k=v/this.window.innerWidth*100;v=`${k}vw`}else if(m.endsWith(`vh`)){var A=v/this.window.innerHeight*100;v=`${A}vh`}}var j={width:this.createSizeForCssProperty(y,`width`),height:this.createSizeForCssProperty(v,`height`)};this.flexDir===`row`?j.flexBasis=j.width:this.flexDir===`column`&&(j.flexBasis=j.height);var M=this.state.width!==j.width,N=this.state.height!==j.height,P=this.state.flexBasis!==j.flexBasis,ee=M||N||P;ee&&(0,n.flushSync)(function(){t.setState(j)}),this.props.onResize&&ee&&this.props.onResize(e,d,this.resizable,D)}},t.prototype.onMouseUp=function(e){var t=this.state,n=t.isResizing,r=t.direction;t.original,!(!n||!this.resizable)&&(this.props.onResizeStop&&this.props.onResizeStop(e,r,this.resizable,this.delta),this.props.size&&this.setState({width:this.props.size.width??`auto`,height:this.props.size.height??`auto`}),this.unbindEvents(),this.setState({isResizing:!1,backgroundStyle:fS(fS({},this.state.backgroundStyle),{cursor:`auto`})}))},t.prototype.updateSize=function(e){this.setState({width:e.width??`auto`,height:e.height??`auto`})},t.prototype.renderResizer=function(){var e=this,t=this.props,n=t.enable,i=t.handleStyles,a=t.handleClasses,o=t.handleWrapperStyle,s=t.handleWrapperClass,c=t.handleComponent;return n?(0,r.jsx)(`div`,{className:s,style:o,children:Object.keys(n).map(function(t){return n[t]===!1?null:(0,r.jsx)(uS,{direction:t,onResizeStart:e.onResizeStart,replaceStyles:i&&i[t],className:a&&a[t],children:c&&c[t]?c[t]:null},t)})}):null},t.prototype.render=function(){var e=this,t=Object.keys(this.props).reduce(function(t,n){return wS.indexOf(n)===-1&&(t[n]=e.props[n]),t},{}),n=fS(fS(fS({position:`relative`,userSelect:this.state.isResizing?`none`:`auto`},this.props.style),this.sizeStyle),{maxWidth:this.props.maxWidth,maxHeight:this.props.maxHeight,minWidth:this.props.minWidth,minHeight:this.props.minHeight,boxSizing:`border-box`,flexShrink:0});return this.state.flexBasis&&(n.flexBasis=this.state.flexBasis),(0,r.jsxs)(this.props.as||`div`,fS({style:n,className:this.props.className},t,{ref:function(t){t&&(e.resizable=t)},children:[this.state.isResizing&&(0,r.jsx)(`div`,{style:this.state.backgroundStyle}),this.props.children,this.renderResizer()]}))},t.defaultProps={as:`div`,onResizeStart:function(){},onResize:function(){},onResizeStop:function(){},enable:{top:!0,right:!0,bottom:!0,left:!0,topRight:!0,bottomRight:!0,bottomLeft:!0,topLeft:!0},style:{},grid:[1,1],gridGap:[0,0],lockAspectRatio:!1,lockAspectRatioExtraWidth:0,lockAspectRatioExtraHeight:0,scale:1,resizeRatio:1,snapGap:0},t}(t.PureComponent);let DS=[`normal`,`bold`,`100`,`300`,`900`],OS=[`100`,`300`,`400`,`500`,`600`,`700`,`900`,`normal`,`bold`],kS=(e,t=DS)=>{let n=e==null?`normal`:String(e);return n===`400`||n===`normal`?t.includes(`400`)?`400`:`normal`:n===`700`||n===`bold`?t.includes(`700`)?`700`:`bold`:t.includes(n)?n:t.includes(`400`)?`400`:t[0]??`normal`},AS=(e,t)=>t.includes(e)?t:[e,...t],jS=(e,t)=>{if(e==null)return``;if(t.type===`boolean`)return String(e)===`true`||e===!0||typeof e==`number`&&e>0?t.trueLabel||`Sim`:t.falseLabel||`Não`;if(t.type===`date`)try{let n=new Date(e);if(isNaN(n.getTime()))return String(e);if(t.dateFormat){let e=n.getDate().toString().padStart(2,`0`),r=(n.getMonth()+1).toString().padStart(2,`0`),i=n.getFullYear(),a=n.getHours().toString().padStart(2,`0`),o=n.getMinutes().toString().padStart(2,`0`),s=n.getSeconds().toString().padStart(2,`0`);return t.dateFormat.replace(`DD`,e).replace(`MM`,r).replace(`YYYY`,String(i)).replace(`HH`,a).replace(`mm`,o).replace(`ss`,s)}return n.toLocaleDateString()}catch{return String(e)}if(t.type===`number`){let n=parseFloat(String(e));return isNaN(n)?String(e):t.numberFormat===`currency`?(t.currencySymbol||`R$`)+` `+n.toFixed(t.decimalPlaces||2):t.numberFormat===`percent`?n.toFixed(t.decimalPlaces||0)+`%`:n.toFixed(t.decimalPlaces||0)}return String(e)},MS=(e,t,n)=>{let r=String(e).toLowerCase(),i=String(n).toLowerCase();switch(t){case`equals`:return r===i;case`notEquals`:return r!==i;case`contains`:return r.includes(i);case`greaterThan`:return parseFloat(r)>parseFloat(i);case`lessThan`:return parseFloat(r)<parseFloat(i);case`truthy`:return!!e;case`falsy`:return!e;default:return!1}},NS=t.default.memo(({element:e,isSelected:n})=>{let{selectElement:i,updateElement:a,updateElements:o,state:s,resizeGroup:c,setSnapLines:l,setPropertiesPanelOpen:u}=rS(),[d,f]=(0,t.useState)(!1),[,p]=(0,t.useState)(!1),[m,h]=(0,t.useState)(!1),g=(0,t.useRef)(null),_=(0,t.useRef)({x:0,y:0}),v=(0,t.useRef)({}),y=(0,t.useRef)(!1),b=(0,t.useRef)(!1),x=(0,t.useRef)(0),S=(0,t.useRef)(0),C=(0,t.useRef)({x:0,y:0}),w=(0,t.useRef)(!1),T=s.canvasHeight||150,E=s.isList?s.mockData.length>0?s.mockData[0]:null:s.singleMockData,D=e.content,O={},k=(e,t)=>{let n=/(rgba?\([^)]+\)|#(?:[0-9a-fA-F]{3,8})|[a-zA-Z]+)\s*$/;return!e||e===`none`?`0 4px 12px 0 ${t}`:n.test(e)?e.replace(n,t):`${e} ${t}`};if(E){if(e.type===`text`||e.type===`text-container`)D=D.replace(/\{\{(.*?)\}\}/g,(t,n)=>{let r=E[n.trim()];return r==null?t:e.formatting?jS(r,e.formatting):String(r)});else if(e.type===`image`)if(e.dataBinding){let t=E[e.dataBinding];t!=null&&(D=String(t))}else D=D.replace(/\{\{(.*?)\}\}/g,(e,t)=>{let n=E[t.trim()];return n==null?e:String(n)});e.styleBindings&&Object.entries(e.styleBindings).forEach(([t,n])=>{let r=E[n];if(r!=null)if(t===`boxShadowColor`){let t=O.boxShadow||e.style?.boxShadow;O={...O,boxShadow:k(t,String(r))}}else O={...O,[t]:String(r)}}),e.conditions&&e.conditions.forEach(e=>{let t=E[e.property];MS(t,e.operator,e.value)&&(O={...O,...e.style})})}let A=O.display===`none`;if(A&&n){let{display:e,...t}=O;O=t}let j=t=>{t.stopPropagation(),!y.current&&!b.current&&!d&&(t.shiftKey?i(e.id,!0):i(e.id,!1))},M=t=>{t.stopPropagation(),e.locked||u(!0)},N=t=>{if(e.locked||t.button!==0)return;t.stopPropagation();let r=t.shiftKey;if(y.current=!1,b.current=!1,e.groupId&&!n){i(e.groupId,r);return}n||(i(e.id,r),b.current=!0),f(!0),_.current={x:t.clientX,y:t.clientY},t.currentTarget.setPointerCapture(t.pointerId);let a=new Set(s.selectedElementIds);n||(r||a.clear(),a.add(e.id));let o={};s.elements.forEach(e=>{a.has(e.id)&&(o[e.id]={x:e.x,y:e.y})}),v.current=o},P=t=>{if(d){let n=s.zoom||1,r=(t.clientX-_.current.x)/n,i=(t.clientY-_.current.y)/n;(Math.abs(r)>2||Math.abs(i)>2)&&(y.current=!0);let a=5/n,c=[],u=Object.entries(v.current).map(([t,n])=>{let o=n.x+r,l=n.y+i;if(s.gridSize>0)o=Math.round(o/s.gridSize)*s.gridSize,l=Math.round(l/s.gridSize)*s.gridSize;else{let n=!1,r=!1,i=e.width??100,u=e.height??100;Object.keys(v.current).length===1&&s.elements.forEach(e=>{if(e.id===t)return;let s=e.width??100,d=e.height??100;n||(Math.abs(o-e.x)<a?(o=e.x,n=!0,c.push({orientation:`vertical`,position:e.x})):Math.abs(o-(e.x+s))<a?(o=e.x+s,n=!0,c.push({orientation:`vertical`,position:e.x+s})):Math.abs(o+i-e.x)<a?(o=e.x-i,n=!0,c.push({orientation:`vertical`,position:e.x})):Math.abs(o+i-(e.x+s))<a&&(o=e.x+s-i,n=!0,c.push({orientation:`vertical`,position:e.x+s}))),r||(Math.abs(l-e.y)<a?(l=e.y,r=!0,c.push({orientation:`horizontal`,position:e.y})):Math.abs(l-(e.y+d))<a?(l=e.y+d,r=!0,c.push({orientation:`horizontal`,position:e.y+d})):Math.abs(l+u-e.y)<a?(l=e.y-u,r=!0,c.push({orientation:`horizontal`,position:e.y})):Math.abs(l+u-(e.y+d))<a&&(l=e.y+d-u,r=!0,c.push({orientation:`horizontal`,position:e.y+d})))})}if(o=Math.max(0,o),s.isList){l=Math.max(0,l);let t=e.height??100;T>0&&(l=Math.min(l,T-t)),l=Math.max(0,l)}return{id:t,changes:{x:o,y:l}}});l&&l(c),o(u,!1)}},ee=e=>{d&&(f(!1),e.currentTarget.releasePointerCapture(e.pointerId),o([],!0),l&&l([]))},F=t=>{t.stopPropagation(),t.preventDefault(),h(!0);let n=t.target.closest(`.resizable-element`);if(n){let r=n.getBoundingClientRect();C.current={x:r.left+r.width/2,y:r.top+r.height/2};let i=t.clientX-C.current.x,a=t.clientY-C.current.y;x.current=Math.atan2(a,i)*(180/Math.PI),S.current=e.rotation||0}};(0,t.useEffect)(()=>{let t=t=>{if(m){let n=t.clientX-C.current.x,r=t.clientY-C.current.y,i=Math.atan2(r,n)*(180/Math.PI)-x.current,o=(S.current+i)%360;a(e.id,{rotation:o},!1)}},n=()=>{m&&(h(!1),a(e.id,{rotation:e.rotation},!0))};return m&&(window.addEventListener(`mousemove`,t),window.addEventListener(`mouseup`,n)),()=>{window.removeEventListener(`mousemove`,t),window.removeEventListener(`mouseup`,n)}},[m,e.id,a,e.rotation]),(0,t.useEffect)(()=>{e.type===`text-container`&&e.autoGrow&&e.containerExpansion===`horizontal`&&requestAnimationFrame(()=>{if(g.current){let t=g.current.scrollWidth;Math.abs(t-(e.width??0))>2&&a(e.id,{width:t},!1)}})},[D,e.autoGrow,e.containerExpansion,e.style,e.width,e.formatting,a,e.id,e.type]);let te={position:`relative`,left:0,top:0,width:`100%`,height:e.autoGrow?`auto`:`100%`,minHeight:e.autoGrow?`100%`:void 0,padding:e.type===`image`||e.type===`text`?0:`8px`,outline:`none`,cursor:d?`grabbing`:`grab`,borderRadius:`var(--radius-2)`,overflow:e.autoGrow?`visible`:`hidden`,whiteSpace:e.autoGrow?`pre-wrap`:void 0,wordBreak:e.autoGrow?`break-word`:void 0,userSelect:`none`,boxSizing:`border-box`,...e.style,...O},[I,ne]=(0,t.useState)(!1);return(0,r.jsx)(ES,{className:`resizable-element`,size:{width:e.width??100,height:e.autoGrow?`auto`:e.height??100},maxHeight:s.isList?Math.max(10,T-e.y):void 0,onResizeStart:e=>{p(!0),w.current=!!e.shiftKey},onResizeStop:(t,n,r,i)=>{p(!1);let o=(e.width??100)+i.width,s=(e.height??100)+i.height,l=e.x??0,u=e.y??0;n.includes(`left`)&&(l-=i.width),n.includes(`top`)&&(u-=i.height),e.type===`group`?(c(e.id,o,s),a(e.id,{x:l,y:u},!0)):a(e.id,{width:o,height:s,x:l,y:u})},handleComponent:{topLeft:(0,r.jsx)(`div`,{className:`resize-handle top-left`,onPointerDown:t=>{t.button===0&&(t.stopPropagation(),i(e.id,t.shiftKey))}}),topRight:(0,r.jsx)(`div`,{className:`resize-handle top-right`,onPointerDown:t=>{t.button===0&&(t.stopPropagation(),i(e.id,t.shiftKey))}}),bottomLeft:(0,r.jsx)(`div`,{className:`resize-handle bottom-left`,onPointerDown:t=>{t.button===0&&(t.stopPropagation(),i(e.id,t.shiftKey))}}),bottomRight:(0,r.jsx)(`div`,{className:`resize-handle bottom-right`,onPointerDown:t=>{t.button===0&&(t.stopPropagation(),i(e.id,t.shiftKey))}}),top:(0,r.jsx)(`div`,{className:`resize-handle top`,onPointerDown:t=>{t.button===0&&(t.stopPropagation(),i(e.id,t.shiftKey))}}),bottom:(0,r.jsx)(`div`,{className:`resize-handle bottom`,onPointerDown:t=>{t.button===0&&(t.stopPropagation(),i(e.id,t.shiftKey))}}),left:(0,r.jsx)(`div`,{className:`resize-handle left`,onPointerDown:t=>{t.button===0&&(t.stopPropagation(),i(e.id,t.shiftKey))}}),right:(0,r.jsx)(`div`,{className:`resize-handle right`,onPointerDown:t=>{t.button===0&&(t.stopPropagation(),i(e.id,t.shiftKey))}})},handleStyles:{topLeft:{width:10,height:10,background:`var(--accent-9)`,borderRadius:`50%`,left:-5,top:-5,zIndex:n?1001:10,opacity:n?1:0},topRight:{width:10,height:10,background:`var(--accent-9)`,borderRadius:`50%`,right:-5,top:-5,zIndex:n?1001:10,opacity:n?1:0},bottomLeft:{width:10,height:10,background:`var(--accent-9)`,borderRadius:`50%`,left:-5,bottom:-5,zIndex:n?1001:10,opacity:n?1:0},bottomRight:{width:10,height:10,background:`var(--accent-9)`,borderRadius:`50%`,right:-5,bottom:-5,zIndex:n?1001:10,opacity:n?1:0},top:{height:6,top:-3,zIndex:n?1e3:9,opacity:n?1:0},bottom:{height:6,bottom:-3,zIndex:n?1e3:9,opacity:n?1:0},left:{width:6,left:-3,zIndex:n?1e3:9,opacity:n?1:0},right:{width:6,right:-3,zIndex:n?1e3:9,opacity:n?1:0}},style:{position:`absolute`,transform:`translate(${e.x??0}px, ${e.y??0}px) rotate(${e.rotation||0}deg)`,height:e.autoGrow?`auto`:void 0,display:A&&!n?`none`:void 0,opacity:A&&n?.4:1,zIndex:n?1e3:e.style?.zIndex===void 0?void 0:Number(e.style.zIndex),outline:`none`,overflow:e.style?.overflow||(e.autoGrow?`visible`:`hidden`)},enable:e.autoGrow?{top:!1,right:!0,bottom:!1,left:!0,topRight:!1,bottomRight:!0,bottomLeft:!1,topLeft:!1}:void 0,lockAspectRatio:w.current,grid:s.gridSize>0?[s.gridSize,s.gridSize]:void 0,children:(0,r.jsxs)(`div`,{style:{width:`100%`,height:`100%`,position:`relative`},onMouseEnter:()=>ne(!0),onMouseLeave:()=>ne(!1),children:[(0,r.jsx)(`div`,{style:{position:`absolute`,top:0,left:0,right:0,bottom:0,pointerEvents:`none`,border:n?`2px solid var(--accent-9)`:I?`1px dashed var(--gray-8)`:`none`,borderRadius:e.style?.borderRadius||`var(--radius-2)`,borderTopLeftRadius:e.style?.borderTopLeftRadius,borderTopRightRadius:e.style?.borderTopRightRadius,borderBottomRightRadius:e.style?.borderBottomRightRadius,borderBottomLeftRadius:e.style?.borderBottomLeftRadius,zIndex:10}}),(0,r.jsxs)(U,{ref:g,style:{...te,...e.type===`text-container`&&{display:`flex`,alignItems:e.style?.alignItems||`flex-start`,justifyContent:e.style?.justifyContent||`flex-start`},zIndex:2,whiteSpace:e.type===`text-container`&&e.autoGrow&&e.containerExpansion===`horizontal`?`nowrap`:te.whiteSpace,width:e.type===`text-container`&&e.autoGrow&&e.containerExpansion===`horizontal`?`max-content`:`100%`,height:e.type===`text-container`&&e.autoGrow&&e.containerExpansion===`vertical`?`auto`:`100%`},onPointerDown:N,onPointerMove:P,onPointerUp:ee,onMouseDown:e=>{e.button===0&&e.stopPropagation()},onClick:j,onDoubleClick:M,title:e.name,onDragOver:e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`copy`},onDrop:t=>{t.preventDefault(),t.stopPropagation();let n=t.dataTransfer.getData(`application/x-editor-prop`);if(n)if(e.type===`text`||e.type===`text-container`){let t=e.content?`${e.content} {{${n}}}`:`{{${n}}}`;a(e.id,{content:t,dataBinding:n})}else e.type===`image`?a(e.id,{dataBinding:n,content:`{{${n}}}`}):e.type===`checkbox`&&a(e.id,{dataBinding:n})},children:[e.type===`text`&&(0,r.jsx)(H,{style:{width:`100%`,height:`100%`},children:D}),e.type===`text-container`&&(0,r.jsx)(H,{style:{width:`100%`,height:`100%`,display:`block`},children:D}),e.type===`image`&&(D?(0,r.jsx)(`img`,{src:D,alt:`Element`,style:{width:`100%`,height:`100%`,objectFit:e.style?.objectFit||`cover`,display:`block`,pointerEvents:`none`}}):(0,r.jsx)(U,{style:{width:`100%`,height:`100%`,backgroundColor:`#eee`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,r.jsx)(H,{size:`1`,children:`Imagem Placeholder`})})),e.type===`box`&&(0,r.jsx)(U,{style:{width:`100%`,height:`100%`}}),e.type===`group`&&(0,r.jsx)(U,{style:{width:`100%`,height:`100%`,border:n?`1px dashed var(--accent-9)`:`1px dashed var(--gray-6)`,opacity:.5,pointerEvents:`none`},children:(0,r.jsx)(H,{size:`1`,style:{position:`absolute`,top:0,left:0,backgroundColor:`var(--accent-3)`,color:`var(--accent-11)`,padding:`2px 6px`,fontSize:`10px`,borderBottomRightRadius:`4px`},children:e.name||`Grupo`})})]}),n&&(0,r.jsx)(U,{className:`rotate-handle`,style:{position:`absolute`,top:-30,left:`50%`,transform:`translateX(-50%)`,width:12,height:12,backgroundColor:`var(--accent-9)`,borderRadius:`50%`,cursor:`crosshair`,zIndex:50,boxShadow:`0 0 0 2px white`},onMouseDown:F,onPointerDown:e=>e.stopPropagation(),children:(0,r.jsx)(U,{style:{position:`absolute`,top:12,left:`50%`,width:2,height:18,backgroundColor:`var(--accent-9)`,transform:`translateX(-50%)`}})})]})})}),PS=()=>{let{state:e}=rS(),{snapLines:t}=e;return t.length===0?null:(0,r.jsx)(r.Fragment,{children:t.map((e,t)=>(0,r.jsx)(`div`,{style:{position:`absolute`,left:e.orientation===`vertical`?e.position:0,top:e.orientation===`horizontal`?e.position:0,width:e.orientation===`vertical`?`1px`:`100%`,height:e.orientation===`horizontal`?`1px`:`100%`,backgroundColor:`#ff0000`,zIndex:9999,pointerEvents:`none`,borderLeft:e.orientation===`vertical`?`1px dashed #ff0000`:`none`,borderTop:e.orientation===`horizontal`?`1px dashed #ff0000`:`none`}},t))})},FS=()=>{let{state:e,selectElement:n,setSelectedElements:i,addElement:a,setZoom:o,setPan:s,undo:c,redo:l,copy:u,paste:d,removeSelected:f,updateElements:p}=rS(),m=(0,t.useRef)(null),[h,g]=(0,t.useState)(null),_=(0,t.useRef)(!1),v=(0,t.useRef)(!1),y=(0,t.useRef)(!1),b=(0,t.useRef)({x:0,y:0}),x=(0,t.useRef)({x:0,y:0}),S=(0,t.useRef)([]),C=(0,t.useRef)([]),w=(0,t.useRef)(e),T=(0,t.useRef)(0);(0,t.useEffect)(()=>{w.current=e},[e]);let E=(0,t.useCallback)(e=>{if(!m.current)return;let t=w.current;if(v.current){let n=e.clientX-x.current.x,r=e.clientY-x.current.y;s({x:t.pan.x+n,y:t.pan.y+r}),x.current={x:e.clientX,y:e.clientY};return}if(!_.current)return;let n=m.current.getBoundingClientRect(),r=(e.clientX-n.left-t.pan.x)/t.zoom,a=(e.clientY-n.top-t.pan.y)/t.zoom,o=Math.min(b.current.x,r),c=Math.min(b.current.y,a),l=Math.abs(r-b.current.x),u=Math.abs(a-b.current.y);g({x:o,y:c,width:l,height:u});let d=Date.now();if(!(d-T.current<50)&&(l>0||u>0)){let e=[];t.elements.forEach(t=>{let n=t.x??0,r=t.y??0,i=t.width??100,a=t.height??100,s=n+i,d=r+a,f=o+l,p=c+u;n<f&&s>o&&r<p&&d>c&&e.push(t.id)});let n=Array.from(new Set([...S.current,...e])),r=C.current;r.length===n.length&&r.every(e=>n.includes(e))||(i(n),C.current=n,T.current=d)}},[i,s]),D=(0,t.useCallback)(e=>{(_.current||v.current)&&e.target.releasePointerCapture(e.pointerId),_.current=!1,v.current=!1,g(null)},[]),O=t=>{if(t.button===2)return;let r=t.target;if(r.closest(`.resize-handle`)||r.closest(`.rotate-handle`))return;if(t.currentTarget.setPointerCapture(t.pointerId),t.button===1||t.button===0&&y.current||t.pointerType===`touch`){t.preventDefault(),v.current=!0,x.current={x:t.clientX,y:t.clientY};return}_.current=t.shiftKey;let i=m.current?.getBoundingClientRect();if(!i)return;let a=i.left,o=i.top;b.current={x:(t.clientX-a-e.pan.x)/e.zoom,y:(t.clientY-o-e.pan.y)/e.zoom},S.current=e.selectedElementIds,C.current=e.selectedElementIds,t.shiftKey||(n(null),S.current=[],C.current=[])};(0,t.useEffect)(()=>{let e=e=>{e.preventDefault();let t=w.current;if(e.ctrlKey||e.metaKey)o(Math.min(Math.max(.1,t.zoom-e.deltaY*.001),5));else{let n=e.shiftKey?e.deltaY:e.deltaX,r=e.shiftKey?e.deltaX:e.deltaY;s({x:t.pan.x-n*1,y:t.pan.y-r*1})}},t=m.current;return t&&t.addEventListener(`wheel`,e,{passive:!1}),()=>{t&&t.removeEventListener(`wheel`,e)}},[o,s]),(0,t.useEffect)(()=>{let t=t=>{if(t.code===`Space`&&!t.repeat&&!(t.target instanceof HTMLInputElement||t.target instanceof HTMLTextAreaElement)&&(y.current=!0,m.current&&(m.current.style.cursor=`grab`)),!(t.target instanceof HTMLInputElement||t.target instanceof HTMLTextAreaElement)&&((t.ctrlKey||t.metaKey)&&t.key.toLowerCase()===`z`&&(t.preventDefault(),t.shiftKey?l():c()),(t.ctrlKey||t.metaKey)&&t.key.toLowerCase()===`y`&&(t.preventDefault(),l()),(t.ctrlKey||t.metaKey)&&t.key.toLowerCase()===`c`&&(t.preventDefault(),u()),(t.ctrlKey||t.metaKey)&&t.key.toLowerCase()===`v`&&(t.preventDefault(),d()),(t.key===`Delete`||t.key===`Backspace`)&&(t.preventDefault(),f()),[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`].includes(t.key))){t.preventDefault();let n=t.shiftKey?10:1,r=[];e.selectedElementIds.forEach(i=>{let a=e.elements.find(e=>e.id===i);if(a){let{x:o=0,y:s=0}=a;if(t.key===`ArrowUp`&&(s-=n),t.key===`ArrowDown`&&(s+=n),t.key===`ArrowLeft`&&(o-=n),t.key===`ArrowRight`&&(o+=n),o=Math.max(0,o),e.isList){s=Math.max(0,s);let t=a.height??100,n=e.canvasHeight||150;n>0&&(s=Math.min(s,n-t)),s=Math.max(0,s)}r.push({id:i,changes:{x:o,y:s}})}}),r.length>0&&p(r)}},n=e=>{e.code===`Space`&&(y.current=!1,m.current&&!v.current&&(m.current.style.cursor=`default`))};return window.addEventListener(`keydown`,t),window.addEventListener(`keyup`,n),()=>{window.removeEventListener(`keydown`,t),window.removeEventListener(`keyup`,n)}},[c,l,u,d,f,p,e.selectedElementIds,e.elements]);let k=(0,t.useRef)(!1),{setCanvasHeight:A}=rS(),j=e=>{e.stopPropagation(),e.preventDefault(),k.current=!0,window.addEventListener(`mousemove`,M),window.addEventListener(`mouseup`,N)},M=(0,t.useCallback)(e=>{if(!k.current||!m.current)return;let t=m.current.getBoundingClientRect(),n=e.clientY-t.top,r=Math.max(50,Math.min(n,2e3));A(Math.round(r))},[A]),N=(0,t.useCallback)(()=>{k.current=!1,window.removeEventListener(`mousemove`,M),window.removeEventListener(`mouseup`,N)},[M]);(0,t.useEffect)(()=>()=>{window.removeEventListener(`mousemove`,M),window.removeEventListener(`mouseup`,N)},[M,N]);let P=e=>{e.preventDefault(),e.dataTransfer.dropEffect=`copy`},ee=t=>{t.preventDefault();let n=t.currentTarget.getBoundingClientRect(),r=(t.clientX-n.left-e.pan.x)/e.zoom,i=(t.clientY-n.top-e.pan.y)/e.zoom,o=t.dataTransfer.getData(`application/x-editor-prop`);if(o){a({type:`text`,content:`{{${o}}}`,x:r,y:i,width:150,height:30,dataBinding:o});return}let s=t.dataTransfer.getData(`application/x-editor-asset`);if(s)try{let e=JSON.parse(s);a({type:`image`,name:e.name,content:e.url,x:r,y:i,width:e.width||200,height:e.height||200})}catch(e){console.error(`Failed to parse asset`,e)}},F=e.canvasHeight||150;return(0,r.jsxs)(U,{ref:m,onPointerDown:O,onPointerMove:e=>{(_.current||v.current)&&E(e.nativeEvent)},onPointerUp:e=>{(_.current||v.current)&&D(e.nativeEvent)},onDragOver:P,onDrop:ee,style:{width:`100%`,height:`100%`,position:`relative`,overflow:`hidden`,backgroundColor:`var(--gray-1)`,cursor:v.current?`grabbing`:`default`,backgroundImage:`radial-gradient(var(--gray-5) 1px, transparent 1px)`,backgroundSize:`${20*e.zoom}px ${20*e.zoom}px`,backgroundPosition:`${e.pan.x}px ${e.pan.y}px`},children:[(0,r.jsxs)(`div`,{style:{transform:`translate(${e.pan.x}px, ${e.pan.y}px) scale(${e.zoom})`,transformOrigin:`0 0`,width:`100%`,height:`100%`,position:`absolute`,top:0,left:0,pointerEvents:`none`},children:[(0,r.jsx)(`div`,{style:{position:`absolute`,top:0,left:0,width:`100%`,height:`1px`,borderTop:`1px dashed var(--accent-9)`,opacity:.6,zIndex:5,pointerEvents:`none`},children:(0,r.jsx)(`span`,{style:{position:`absolute`,top:-16,left:4,fontSize:`10px`,color:`var(--accent-9)`,fontWeight:500},children:`Início (0px)`})}),e.elements.filter(e=>!e.hidden).map(t=>(0,r.jsx)(`div`,{style:{pointerEvents:`auto`},children:(0,r.jsx)(NS,{element:t,isSelected:e.selectedElementIds.includes(t.id)})},t.id)),(0,r.jsx)(PS,{}),h&&(0,r.jsx)(`div`,{style:{position:`absolute`,left:h.x,top:h.y,width:h.width,height:h.height,backgroundColor:`rgba(0, 120, 255, 0.2)`,border:`1px solid rgba(0, 120, 255, 0.8)`,pointerEvents:`none`,zIndex:999999}}),e.isList&&(0,r.jsxs)(`div`,{style:{position:`absolute`,top:F,left:0,right:0,height:`10px`,marginTop:`-5px`,cursor:`ns-resize`,zIndex:100,display:`flex`,alignItems:`center`,justifyContent:`center`},onMouseDown:j,children:[(0,r.jsx)(`div`,{style:{width:`100%`,height:`2px`,backgroundColor:`var(--accent-9)`,borderBottom:`none`,opacity:.8,boxShadow:`0 1px 4px rgba(0,0,0,0.2)`}}),(0,r.jsxs)(`div`,{style:{position:`absolute`,right:10,top:-20,backgroundColor:`var(--accent-9)`,color:`white`,fontSize:`11px`,padding:`2px 6px`,borderRadius:`4px`,fontWeight:500,pointerEvents:`none`,boxShadow:`0 2px 5px rgba(0,0,0,0.1)`},children:[`Altura do Item: `,F,`px`]})]})]}),e.elements.length===0&&(0,r.jsx)(W,{align:`center`,justify:`center`,style:{position:`absolute`,inset:0,pointerEvents:`none`},children:(0,r.jsxs)(U,{style:{backgroundColor:`var(--gray-2)`,border:`1px solid var(--gray-4)`,borderRadius:12,padding:16,maxWidth:320,textAlign:`center`,boxShadow:`0 6px 20px rgba(0,0,0,0.08)`},children:[(0,r.jsx)(H,{size:`3`,weight:`bold`,children:`Comece adicionando um elemento`}),(0,r.jsx)(H,{size:`2`,color:`gray`,as:`div`,mt:`2`,children:`Depois, arraste para mover e use os cantos para redimensionar.`}),(0,r.jsx)(H,{size:`1`,color:`gray`,as:`div`,mt:`2`,children:`Dica: clique com o botão direito para mais opções.`})]})}),h&&(0,r.jsx)(`div`,{style:{position:`absolute`,top:0,left:0,width:`100%`,height:`100%`,zIndex:999995,pointerEvents:`auto`}})]})},IS=({onSave:e,templates:n,setIsTemplatesOpen:i,onFinish:a,onToggleSidebar:o})=>{let{state:s,loadState:c,addElement:l}=rS(),u=(0,t.useRef)(null),d=()=>{let e={elements:s.elements,isList:s.isList,mockData:s.mockData,singleMockData:s.singleMockData,listSettings:s.listSettings,canvasHeight:s.canvasHeight,gridSize:s.gridSize},t=JSON.stringify(e,null,2),n=new Blob([t],{type:`application/json`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`layout-${new Date().toISOString().slice(0,10)}.json`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r)},f=()=>{u.current?.click()},p=e=>{let t=e.target.files?.[0];if(!t)return;let n=new FileReader;n.onload=e=>{try{let t=e.target?.result;c(JSON.parse(t))}catch(e){console.error(`Failed to import layout`,e),alert(`Erro ao importar layout. Arquivo inválido.`)}},n.readAsText(t),e.target.value=``},m=()=>{if(e){let t={elements:s.elements,isList:s.isList,mockData:s.mockData,singleMockData:s.singleMockData,listSettings:s.listSettings,canvasHeight:s.canvasHeight};e(JSON.stringify(t,null,2))}},h=e=>{l({type:e,content:`New ${e}`})};return(0,r.jsxs)(W,{justify:`between`,align:`center`,px:`4`,py:`3`,style:{borderBottom:`1px solid var(--gray-5)`,backgroundColor:`var(--gray-1)`,flexShrink:0,zIndex:100},children:[(0,r.jsxs)(W,{gap:`4`,align:`center`,children:[o&&(0,r.jsx)(U,{display:{initial:`block`,md:`none`},children:(0,r.jsx)(J,{variant:`ghost`,color:`gray`,onClick:o,children:(0,r.jsx)(Qe,{width:`24`,height:`24`})})}),(0,r.jsx)(H,{size:`3`,weight:`bold`,children:`Editor de Layout`})]}),(0,r.jsxs)(W,{gap:`3`,align:`center`,children:[(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`solid`,color:`green`,style:{cursor:`pointer`},children:[(0,r.jsx)(mt,{}),` Adicionar`]})}),(0,r.jsxs)(fy,{children:[(0,r.jsx)(q,{onSelect:()=>h(`text`),children:`Texto`}),(0,r.jsx)(q,{onSelect:()=>h(`image`),children:`Imagem`}),(0,r.jsx)(q,{onSelect:()=>h(`box`),children:`Container / Grupo`}),(0,r.jsx)(q,{onSelect:()=>h(`text-container`),children:`Container com Texto`})]})]}),(0,r.jsxs)(G,{variant:`soft`,color:`gray`,onClick:f,style:{cursor:`pointer`},children:[(0,r.jsx)(en,{}),` Importar`]}),(0,r.jsx)(`input`,{type:`file`,ref:u,style:{display:`none`},accept:`.json`,onChange:p}),(0,r.jsxs)(G,{variant:`soft`,color:`gray`,onClick:d,style:{cursor:`pointer`},children:[(0,r.jsx)(Ie,{}),` Exportar`]}),n&&n.length>0&&(0,r.jsxs)(G,{variant:`soft`,color:`gray`,onClick:()=>i(!0),style:{cursor:`pointer`},children:[(0,r.jsx)(We,{}),` Templates`]}),a&&(0,r.jsxs)(G,{id:`finish-button`,variant:`solid`,color:`green`,onClick:a,style:{cursor:`pointer`,marginLeft:8},children:[(0,r.jsx)(ge,{}),` Finalizar e Testar`]}),(0,r.jsxs)(G,{variant:`solid`,color:`blue`,onClick:m,style:{cursor:`pointer`},children:[(0,r.jsx)(bt,{}),` Salvar`]})]})]})},LS=()=>{let{state:e}=rS(),{elements:t,zoom:n,pan:i}=e,a=(()=>{if(t.length===0)return{minX:0,minY:0,maxX:1e3,maxY:1e3};let e=1/0,n=1/0,r=-1/0,i=-1/0;return t.forEach(t=>{e=Math.min(e,t.x),n=Math.min(n,t.y),r=Math.max(r,t.x+t.width),i=Math.max(i,t.y+t.height)}),{minX:e-100,minY:n-100,maxX:r+100,maxY:i+100,width:r-e+200,height:i-n+200}})(),o=window.innerWidth/n,s=window.innerHeight/n,c=-i.x/n,l=-i.y/n;return(0,r.jsx)(U,{style:{position:`absolute`,bottom:20,right:20,width:150,height:150,backgroundColor:`rgba(255, 255, 255, 0.9)`,border:`1px solid var(--gray-6)`,borderRadius:8,overflow:`hidden`,boxShadow:`0 4px 12px rgba(0,0,0,0.1)`,zIndex:100},children:(0,r.jsxs)(`div`,{style:{position:`relative`,width:`100%`,height:`100%`,transform:`scale(0.1) translate(${-a.minX}px, ${-a.minY}px)`,transformOrigin:`top left`},children:[t.filter(e=>!e.hidden).map(e=>(0,r.jsx)(`div`,{style:{position:`absolute`,left:e.x,top:e.y,width:e.width,height:e.height,backgroundColor:`var(--accent-9)`,opacity:.5,border:`1px solid var(--accent-11)`}},e.id)),(0,r.jsx)(`div`,{style:{position:`absolute`,left:c,top:l,width:o,height:s,border:`20px solid rgba(0, 0, 0, 0.2)`,pointerEvents:`none`}})]})})};var RS=[{targetId:`sidebar-area`,title:`Biblioteca de Blocos`,content:`Arraste ou clique nos blocos para adicionar ao layout. Aqui você também gerencia o conteúdo.`,position:`right`},{targetId:`canvas-area`,title:`Área de Criação`,content:`Seu espaço de trabalho. Mova, redimensione e organize os elementos livremente.`,position:`center`},{targetId:`preview-area`,title:`Visualização Real`,content:`Confira o resultado final com dados reais enquanto edita. O que você vê é o que será exportado.`,position:`left`},{targetId:`finish-button`,title:`Finalizar e Testar`,content:`Pronto? Clique aqui para testar com mais dados e exportar seu layout.`,position:`bottom`}];let zS=({isOpen:e,onClose:n})=>{let[i,a]=(0,t.useState)(0),[o,s]=(0,t.useState)(null);if((0,t.useEffect)(()=>{if(!e)return;let t=RS[i],n=document.getElementById(t.targetId);if(n){let e=n.getBoundingClientRect(),r=0,i=0;switch(t.position){case`right`:r=e.top+e.height/2-100,i=e.right+20;break;case`left`:r=e.top+e.height/2-100,i=e.left-320-20;break;case`bottom`:r=e.bottom+20,i=e.left+e.width/2-160;break;case`top`:r=e.top-200-20,i=e.left+e.width/2-160;break;case`center`:r=window.innerHeight/2-100,i=window.innerWidth/2-160;break}i<20&&(i=20),r<20&&(r=20),i+320>window.innerWidth&&(i=window.innerWidth-340),r+200>window.innerHeight&&(r=window.innerHeight-220),s({top:r,left:i})}else s({top:window.innerHeight/2-100,left:window.innerWidth/2-160})},[e,i]),!e||!o)return null;let c=RS[i],l=i===RS.length-1;return(0,r.jsx)(U,{style:{position:`fixed`,top:0,left:0,width:`100vw`,height:`100vh`,zIndex:9999,pointerEvents:`none`},children:(0,r.jsx)(Ev,{style:{position:`absolute`,top:o.top,left:o.left,width:320,pointerEvents:`auto`,boxShadow:`0 10px 30px rgba(0,0,0,0.2), 0 0 0 2px var(--accent-9)`,backgroundColor:`var(--color-panel-solid)`,transition:`all 0.3s ease-out`},children:(0,r.jsxs)(W,{direction:`column`,gap:`3`,children:[(0,r.jsxs)(W,{justify:`between`,align:`center`,children:[(0,r.jsx)(m_,{size:`3`,color:`blue`,children:c.title}),(0,r.jsx)(G,{variant:`ghost`,color:`gray`,onClick:n,size:`1`,style:{cursor:`pointer`},children:(0,r.jsx)(Ee,{})})]}),(0,r.jsx)(H,{size:`2`,color:`gray`,children:c.content}),(0,r.jsxs)(W,{justify:`between`,align:`center`,mt:`2`,children:[(0,r.jsxs)(H,{size:`1`,color:`gray`,children:[i+1,` de `,RS.length]}),(0,r.jsxs)(W,{gap:`2`,children:[i>0&&(0,r.jsx)(G,{variant:`soft`,color:`gray`,onClick:()=>a(e=>e-1),style:{cursor:`pointer`},children:`Voltar`}),(0,r.jsx)(G,{onClick:()=>{l?n():a(e=>e+1)},style:{cursor:`pointer`},children:l?`Entendi!`:`Próximo`})]})]})]})})})};var BS=(0,t.createContext)({});function VS(e){let n=(0,t.useRef)(null);return n.current===null&&(n.current=e()),n.current}var HS=typeof window<`u`,US=HS?t.useLayoutEffect:t.useEffect,WS=(0,t.createContext)(null);function GS(e,t){e.indexOf(t)===-1&&e.push(t)}function KS(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}var qS=(e,t,n)=>n>t?t:n<e?e:n;function JS(e,t){return t?`${e}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${t}`:e}var YS=()=>{},XS=()=>{};typeof process<`u`&&process.env.NODE_ENV!==`production`&&(YS=(e,t,n)=>{!e&&typeof console<`u`&&console.warn(JS(t,n))},XS=(e,t,n)=>{if(!e)throw Error(JS(t,n))});var ZS={},QS=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function $S(e){return typeof e==`object`&&!!e}var eC=e=>/^0[^.\s]+$/u.test(e);function tC(e){let t;return()=>(t===void 0&&(t=e()),t)}var nC=e=>e,rC=(e,t)=>n=>t(e(n)),iC=(...e)=>e.reduce(rC),aC=(e,t,n)=>{let r=t-e;return r===0?1:(n-e)/r},oC=class{constructor(){this.subscriptions=[]}add(e){return GS(this.subscriptions,e),()=>KS(this.subscriptions,e)}notify(e,t,n){let r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,t,n);else for(let i=0;i<r;i++){let r=this.subscriptions[i];r&&r(e,t,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}},sC=e=>e*1e3,cC=e=>e/1e3;function lC(e,t){return t?e*(1e3/t):0}var uC=new Set;function dC(e,t,n){e||uC.has(t)||(console.warn(JS(t,n)),uC.add(t))}var fC=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,pC=1e-7,mC=12;function hC(e,t,n,r,i){let a,o,s=0;do o=t+(n-t)/2,a=fC(o,r,i)-e,a>0?n=o:t=o;while(Math.abs(a)>pC&&++s<mC);return o}function gC(e,t,n,r){if(e===t&&n===r)return nC;let i=t=>hC(t,0,1,e,n);return e=>e===0||e===1?e:fC(i(e),t,r)}var _C=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,vC=e=>t=>1-e(1-t),yC=gC(.33,1.53,.69,.99),bC=vC(yC),xC=_C(bC),SC=e=>(e*=2)<1?.5*bC(e):.5*(2-2**(-10*(e-1))),CC=e=>1-Math.sin(Math.acos(e)),wC=vC(CC),TC=_C(CC),EC=gC(.42,0,1,1),DC=gC(0,0,.58,1),OC=gC(.42,0,.58,1),kC=e=>Array.isArray(e)&&typeof e[0]!=`number`,AC=e=>Array.isArray(e)&&typeof e[0]==`number`,jC={linear:nC,easeIn:EC,easeInOut:OC,easeOut:DC,circIn:CC,circInOut:TC,circOut:wC,backIn:bC,backInOut:xC,backOut:yC,anticipate:SC},MC=e=>typeof e==`string`,NC=e=>{if(AC(e)){XS(e.length===4,`Cubic bezier arrays must contain four numerical values.`,`cubic-bezier-length`);let[t,n,r,i]=e;return gC(t,n,r,i)}else if(MC(e))return XS(jC[e]!==void 0,`Invalid easing type '${e}'`,`invalid-easing-type`),jC[e];return e},PC=[`setup`,`read`,`resolveKeyframes`,`preUpdate`,`update`,`preRender`,`render`,`postRender`],FC={value:null,addProjectionMetrics:null};function IC(e,t){let n=new Set,r=new Set,i=!1,a=!1,o=new WeakSet,s={delta:0,timestamp:0,isProcessing:!1},c=0;function l(t){o.has(t)&&(u.schedule(t),e()),c++,t(s)}let u={schedule:(e,t=!1,a=!1)=>{let s=a&&i?n:r;return t&&o.add(e),s.has(e)||s.add(e),e},cancel:e=>{r.delete(e),o.delete(e)},process:e=>{if(s=e,i){a=!0;return}i=!0,[n,r]=[r,n],n.forEach(l),t&&FC.value&&FC.value.frameloop[t].push(c),c=0,n.clear(),i=!1,a&&(a=!1,u.process(e))}};return u}var LC=40;function RC(e,t){let n=!1,r=!0,i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=PC.reduce((e,n)=>(e[n]=IC(a,t?n:void 0),e),{}),{setup:s,read:c,resolveKeyframes:l,preUpdate:u,update:d,preRender:f,render:p,postRender:m}=o,h=()=>{let a=ZS.useManualTiming?i.timestamp:performance.now();n=!1,ZS.useManualTiming||(i.delta=r?1e3/60:Math.max(Math.min(a-i.timestamp,LC),1)),i.timestamp=a,i.isProcessing=!0,s.process(i),c.process(i),l.process(i),u.process(i),d.process(i),f.process(i),p.process(i),m.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(h))},g=()=>{n=!0,r=!0,i.isProcessing||e(h)};return{schedule:PC.reduce((e,t)=>{let r=o[t];return e[t]=(e,t=!1,i=!1)=>(n||g(),r.schedule(e,t,i)),e},{}),cancel:e=>{for(let t=0;t<PC.length;t++)o[PC[t]].cancel(e)},state:i,steps:o}}var{schedule:zC,cancel:BC,state:VC,steps:HC}=RC(typeof requestAnimationFrame<`u`?requestAnimationFrame:nC,!0),UC;function WC(){UC=void 0}var GC={now:()=>(UC===void 0&&GC.set(VC.isProcessing||ZS.useManualTiming?VC.timestamp:performance.now()),UC),set:e=>{UC=e,queueMicrotask(WC)}},KC={layout:0,mainThread:0,waapi:0},qC=e=>t=>typeof t==`string`&&t.startsWith(e),JC=qC(`--`),YC=qC(`var(--`),XC=e=>YC(e)?ZC.test(e.split(`/*`)[0].trim()):!1,ZC=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function QC(e){return typeof e==`string`?e.split(`/*`)[0].includes(`var(--`):!1}var $C={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},ew={...$C,transform:e=>qS(0,1,e)},tw={...$C,default:1},nw=e=>Math.round(e*1e5)/1e5,rw=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function iw(e){return e==null}var aw=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,ow=(e,t)=>n=>!!(typeof n==`string`&&aw.test(n)&&n.startsWith(e)||t&&!iw(n)&&Object.prototype.hasOwnProperty.call(n,t)),sw=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(rw);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},cw=e=>qS(0,255,e),lw={...$C,transform:e=>Math.round(cw(e))},uw={test:ow(`rgb`,`red`),parse:sw(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+lw.transform(e)+`, `+lw.transform(t)+`, `+lw.transform(n)+`, `+nw(ew.transform(r))+`)`};function dw(e){let t=``,n=``,r=``,i=``;return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}var fw={test:ow(`#`),parse:dw,transform:uw.transform},pw=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),mw=pw(`deg`),hw=pw(`%`),Q=pw(`px`),gw=pw(`vh`),_w=pw(`vw`),vw=(()=>({...hw,parse:e=>hw.parse(e)/100,transform:e=>hw.transform(e*100)}))(),yw={test:ow(`hsl`,`hue`),parse:sw(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+hw.transform(nw(t))+`, `+hw.transform(nw(n))+`, `+nw(ew.transform(r))+`)`},bw={test:e=>uw.test(e)||fw.test(e)||yw.test(e),parse:e=>uw.test(e)?uw.parse(e):yw.test(e)?yw.parse(e):fw.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?uw.transform(e):yw.transform(e),getAnimatableNone:e=>{let t=bw.parse(e);return t.alpha=0,bw.transform(t)}},xw=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Sw(e){return isNaN(e)&&typeof e==`string`&&(e.match(rw)?.length||0)+(e.match(xw)?.length||0)>0}var Cw=`number`,ww=`color`,Tw=`var`,Ew=`var(`,Dw="${}",Ow=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function kw(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(Ow,e=>(bw.test(e)?(r.color.push(a),i.push(ww),n.push(bw.parse(e))):e.startsWith(Ew)?(r.var.push(a),i.push(Tw),n.push(e)):(r.number.push(a),i.push(Cw),n.push(parseFloat(e))),++a,Dw)).split(Dw),indexes:r,types:i}}function Aw(e){return kw(e).values}function jw(e){let{split:t,types:n}=kw(e),r=t.length;return e=>{let i=``;for(let a=0;a<r;a++)if(i+=t[a],e[a]!==void 0){let t=n[a];t===Cw?i+=nw(e[a]):t===ww?i+=bw.transform(e[a]):i+=e[a]}return i}}var Mw=e=>typeof e==`number`?0:bw.test(e)?bw.getAnimatableNone(e):e;function Nw(e){let t=Aw(e);return jw(e)(t.map(Mw))}var Pw={test:Sw,parse:Aw,createTransformer:jw,getAnimatableNone:Nw};function Fw(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function Iw({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,a=0,o=0;if(!t)i=a=o=n;else{let r=n<.5?n*(1+t):n+t-n*t,s=2*n-r;i=Fw(s,r,e+1/3),a=Fw(s,r,e),o=Fw(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function Lw(e,t){return n=>n>0?t:e}var Rw=(e,t,n)=>e+(t-e)*n,zw=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},Bw=[fw,uw,yw],Vw=e=>Bw.find(t=>t.test(e));function Hw(e){let t=Vw(e);if(YS(!!t,`'${e}' is not an animatable color. Use the equivalent color code instead.`,`color-not-animatable`),!t)return!1;let n=t.parse(e);return t===yw&&(n=Iw(n)),n}var Uw=(e,t)=>{let n=Hw(e),r=Hw(t);if(!n||!r)return Lw(e,t);let i={...n};return e=>(i.red=zw(n.red,r.red,e),i.green=zw(n.green,r.green,e),i.blue=zw(n.blue,r.blue,e),i.alpha=Rw(n.alpha,r.alpha,e),uw.transform(i))},Ww=new Set([`none`,`hidden`]);function Gw(e,t){return Ww.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function Kw(e,t){return n=>Rw(e,t,n)}function qw(e){return typeof e==`number`?Kw:typeof e==`string`?XC(e)?Lw:bw.test(e)?Uw:Zw:Array.isArray(e)?Jw:typeof e==`object`?bw.test(e)?Uw:Yw:Lw}function Jw(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>qw(e)(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=i[t](e);return n}}function Yw(e,t){let n={...e,...t},r={};for(let i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=qw(e[i])(e[i],t[i]));return e=>{for(let t in r)n[t]=r[t](e);return n}}function Xw(e,t){let n=[],r={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){let a=t.types[i],o=e.indexes[a][r[a]];n[i]=e.values[o]??0,r[a]++}return n}var Zw=(e,t)=>{let n=Pw.createTransformer(t),r=kw(e),i=kw(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?Ww.has(e)&&!i.values.length||Ww.has(t)&&!r.values.length?Gw(e,t):iC(Jw(Xw(r,i),i.values),n):(YS(!0,`Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,`complex-values-different`),Lw(e,t))};function Qw(e,t,n){return typeof e==`number`&&typeof t==`number`&&typeof n==`number`?Rw(e,t,n):qw(e)(e,t)}var $w=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>zC.update(t,e),stop:()=>BC(t),now:()=>VC.isProcessing?VC.timestamp:GC.now()}},eT=(e,t,n=10)=>{let r=``,i=Math.max(Math.round(t/n),2);for(let t=0;t<i;t++)r+=Math.round(e(t/(i-1))*1e4)/1e4+`, `;return`linear(${r.substring(0,r.length-2)})`},tT=2e4;function nT(e){let t=0,n=e.next(t);for(;!n.done&&t<2e4;)t+=50,n=e.next(t);return t>=2e4?1/0:t}function rT(e,t=100,n){let r=n({...e,keyframes:[0,t]}),i=Math.min(nT(r),tT);return{type:`keyframes`,ease:e=>r.next(i*e).value/t,duration:cC(i)}}var iT=5;function aT(e,t,n){let r=Math.max(t-iT,0);return lC(n-e(r),t-r)}var oT={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},sT=.001;function cT({duration:e=oT.duration,bounce:t=oT.bounce,velocity:n=oT.velocity,mass:r=oT.mass}){let i,a;YS(e<=sC(oT.maxDuration),`Spring duration must be 10 seconds or less`,`spring-duration-limit`);let o=1-t;o=qS(oT.minDamping,oT.maxDamping,o),e=qS(oT.minDuration,oT.maxDuration,cC(e)),o<1?(i=t=>{let r=t*o,i=r*e,a=r-n,s=dT(t,o),c=Math.exp(-i);return sT-a/s*c},a=t=>{let r=t*o*e,a=r*n+n,s=o**2*t**2*e,c=Math.exp(-r),l=dT(t**2,o);return(-i(t)+sT>0?-1:1)*((a-s)*c)/l}):(i=t=>{let r=Math.exp(-t*e),i=(t-n)*e+1;return-sT+r*i},a=t=>Math.exp(-t*e)*((n-t)*(e*e)));let s=5/e,c=uT(i,a,s);if(e=sC(e),isNaN(c))return{stiffness:oT.stiffness,damping:oT.damping,duration:e};{let t=c**2*r;return{stiffness:t,damping:o*2*Math.sqrt(r*t),duration:e}}}var lT=12;function uT(e,t,n){let r=n;for(let n=1;n<lT;n++)r-=e(r)/t(r);return r}function dT(e,t){return e*Math.sqrt(1-t*t)}var fT=[`duration`,`bounce`],pT=[`stiffness`,`damping`,`mass`];function mT(e,t){return t.some(t=>e[t]!==void 0)}function hT(e){let t={velocity:oT.velocity,stiffness:oT.stiffness,damping:oT.damping,mass:oT.mass,isResolvedFromDuration:!1,...e};if(!mT(e,pT)&&mT(e,fT))if(e.visualDuration){let n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,a=2*qS(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:oT.mass,stiffness:i,damping:a}}else{let n=cT(e);t={...t,...n,mass:oT.mass},t.isResolvedFromDuration=!0}return t}function gT(e=oT.visualDuration,t=oT.bounce){let n=typeof e==`object`?e:{visualDuration:e,keyframes:[0,1],bounce:t},{restSpeed:r,restDelta:i}=n,a=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],s={done:!1,value:a},{stiffness:c,damping:l,mass:u,duration:d,velocity:f,isResolvedFromDuration:p}=hT({...n,velocity:-cC(n.velocity||0)}),m=f||0,h=l/(2*Math.sqrt(c*u)),g=o-a,_=cC(Math.sqrt(c/u)),v=Math.abs(g)<5;r||=v?oT.restSpeed.granular:oT.restSpeed.default,i||=v?oT.restDelta.granular:oT.restDelta.default;let y;if(h<1){let e=dT(_,h);y=t=>o-Math.exp(-h*_*t)*((m+h*_*g)/e*Math.sin(e*t)+g*Math.cos(e*t))}else if(h===1)y=e=>o-Math.exp(-_*e)*(g+(m+_*g)*e);else{let e=_*Math.sqrt(h*h-1);y=t=>{let n=Math.exp(-h*_*t),r=Math.min(e*t,300);return o-n*((m+h*_*g)*Math.sinh(r)+e*g*Math.cosh(r))/e}}let b={calculatedDuration:p&&d||null,next:e=>{let t=y(e);if(p)s.done=e>=d;else{let n=e===0?m:0;h<1&&(n=e===0?sC(m):aT(y,e,t));let a=Math.abs(n)<=r,c=Math.abs(o-t)<=i;s.done=a&&c}return s.value=s.done?o:t,s},toString:()=>{let e=Math.min(nT(b),tT),t=eT(t=>b.next(e*t).value,e,30);return e+`ms `+t},toTransition:()=>{}};return b}gT.applyToOptions=e=>{let t=rT(e,100,gT);return e.ease=t.ease,e.duration=sC(t.duration),e.type=`keyframes`,e};function _T({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:o,min:s,max:c,restDelta:l=.5,restSpeed:u}){let d=e[0],f={done:!1,value:d},p=e=>s!==void 0&&e<s||c!==void 0&&e>c,m=e=>s===void 0?c:c===void 0||Math.abs(s-e)<Math.abs(c-e)?s:c,h=n*t,g=d+h,_=o===void 0?g:o(g);_!==g&&(h=_-d);let v=e=>-h*Math.exp(-e/r),y=e=>_+v(e),b=e=>{let t=v(e),n=y(e);f.done=Math.abs(t)<=l,f.value=f.done?_:n},x,S,C=e=>{p(f.value)&&(x=e,S=gT({keyframes:[f.value,m(f.value)],velocity:aT(y,e,f.value),damping:i,stiffness:a,restDelta:l,restSpeed:u}))};return C(0),{calculatedDuration:null,next:e=>{let t=!1;return!S&&x===void 0&&(t=!0,b(e),C(e)),x!==void 0&&e>=x?S.next(e-x):(!t&&b(e),f)}}}function vT(e,t,n){let r=[],i=n||ZS.mix||Qw,a=e.length-1;for(let n=0;n<a;n++){let a=i(e[n],e[n+1]);t&&(a=iC(Array.isArray(t)?t[n]||nC:t,a)),r.push(a)}return r}function yT(e,t,{clamp:n=!0,ease:r,mixer:i}={}){let a=e.length;if(XS(a===t.length,`Both input and output ranges must be the same length`,`range-length`),a===1)return()=>t[0];if(a===2&&t[0]===t[1])return()=>t[1];let o=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());let s=vT(t,r,i),c=s.length,l=n=>{if(o&&n<e[0])return t[0];let r=0;if(c>1)for(;r<e.length-2&&!(n<e[r+1]);r++);let i=aC(e[r],e[r+1],n);return s[r](i)};return n?t=>l(qS(e[0],e[a-1],t)):l}function bT(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=aC(0,t,r);e.push(Rw(n,1,i))}}function xT(e){let t=[0];return bT(t,e.length-1),t}function ST(e,t){return e.map(e=>e*t)}function CT(e,t){return e.map(()=>t||OC).splice(0,e.length-1)}function wT({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`}){let i=kC(r)?r.map(NC):NC(r),a={done:!1,value:t[0]},o=yT(ST(n&&n.length===t.length?n:xT(t),e),t,{ease:Array.isArray(i)?i:CT(t,i)});return{calculatedDuration:e,next:t=>(a.value=o(t),a.done=t>=e,a)}}var TT=e=>e!==null;function ET(e,{repeat:t,repeatType:n=`loop`},r,i=1){let a=e.filter(TT),o=i<0||t&&n!==`loop`&&t%2==1?0:a.length-1;return!o||r===void 0?a[o]:r}var DT={decay:_T,inertia:_T,tween:wT,keyframes:wT,spring:gT};function OT(e){typeof e.type==`string`&&(e.type=DT[e.type])}var kT=class{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}},AT=e=>e/100,jT=class extends kT{constructor(e){super(),this.state=`idle`,this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{let{motionValue:e}=this.options;e&&e.updatedAt!==GC.now()&&this.tick(GC.now()),this.isStopped=!0,this.state!==`idle`&&(this.teardown(),this.options.onStop?.())},KC.mainThread++,this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){let{options:e}=this;OT(e);let{type:t=wT,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=e,{keyframes:o}=e,s=t||wT;process.env.NODE_ENV!==`production`&&s!==wT&&XS(o.length<=2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${o}`,`spring-two-frames`),s!==wT&&typeof o[0]!=`number`&&(this.mixKeyframes=iC(AT,Qw(o[0],o[1])),o=[0,100]);let c=s({...e,keyframes:o});i===`mirror`&&(this.mirroredGenerator=s({...e,keyframes:[...o].reverse(),velocity:-a})),c.calculatedDuration===null&&(c.calculatedDuration=nT(c));let{calculatedDuration:l}=c;this.calculatedDuration=l,this.resolvedDuration=l+r,this.totalDuration=this.resolvedDuration*(n+1)-r,this.generator=c}updateTime(e){let t=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime===null?this.currentTime=t:this.currentTime=this.holdTime}tick(e,t=!1){let{generator:n,totalDuration:r,mixKeyframes:i,mirroredGenerator:a,resolvedDuration:o,calculatedDuration:s}=this;if(this.startTime===null)return n.next(0);let{delay:c=0,keyframes:l,repeat:u,repeatType:d,repeatDelay:f,type:p,onUpdate:m,finalKeyframe:h}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);let g=this.currentTime-c*(this.playbackSpeed>=0?1:-1),_=this.playbackSpeed>=0?g<0:g>r;this.currentTime=Math.max(g,0),this.state===`finished`&&this.holdTime===null&&(this.currentTime=r);let v=this.currentTime,y=n;if(u){let e=Math.min(this.currentTime,r)/o,t=Math.floor(e),n=e%1;!n&&e>=1&&(n=1),n===1&&t--,t=Math.min(t,u+1),t%2&&(d===`reverse`?(n=1-n,f&&(n-=f/o)):d===`mirror`&&(y=a)),v=qS(0,1,n)*o}let b=_?{done:!1,value:l[0]}:y.next(v);i&&(b.value=i(b.value));let{done:x}=b;!_&&s!==null&&(x=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);let S=this.holdTime===null&&(this.state===`finished`||this.state===`running`&&x);return S&&p!==_T&&(b.value=ET(l,this.options,h,this.speed)),m&&m(b.value),S&&this.finish(),b}then(e,t){return this.finished.then(e,t)}get duration(){return cC(this.calculatedDuration)}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+cC(e)}get time(){return cC(this.currentTime)}set time(e){e=sC(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(GC.now());let t=this.playbackSpeed!==e;this.playbackSpeed=e,t&&(this.time=cC(this.currentTime))}play(){if(this.isStopped)return;let{driver:e=$w,startTime:t}=this.options;this.driver||=e(e=>this.tick(e)),this.options.onPlay?.();let n=this.driver.now();this.state===`finished`?(this.updateFinished(),this.startTime=n):this.holdTime===null?this.startTime||=t??n:this.startTime=n-this.holdTime,this.state===`finished`&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state=`running`,this.driver.start()}pause(){this.state=`paused`,this.updateTime(GC.now()),this.holdTime=this.currentTime}complete(){this.state!==`running`&&this.play(),this.state=`finished`,this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state=`finished`,this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state=`idle`,this.stopDriver(),this.startTime=this.holdTime=null,KC.mainThread--}stopDriver(){this.driver&&=(this.driver.stop(),void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type=`keyframes`,this.options.ease=`linear`,this.initAnimation()),this.driver?.stop(),e.observe(this)}};function MT(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}var NT=e=>e*180/Math.PI,PT=e=>IT(NT(Math.atan2(e[1],e[0]))),FT={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:PT,rotateZ:PT,skewX:e=>NT(Math.atan(e[1])),skewY:e=>NT(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},IT=e=>(e%=360,e<0&&(e+=360),e),LT=PT,RT=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),zT=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),BT={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:RT,scaleY:zT,scale:e=>(RT(e)+zT(e))/2,rotateX:e=>IT(NT(Math.atan2(e[6],e[5]))),rotateY:e=>IT(NT(Math.atan2(-e[2],e[0]))),rotateZ:LT,rotate:LT,skewX:e=>NT(Math.atan(e[4])),skewY:e=>NT(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function VT(e){return e.includes(`scale`)?1:0}function HT(e,t){if(!e||e===`none`)return VT(t);let n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u),r,i;if(n)r=BT,i=n;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=FT,i=t}if(!i)return VT(t);let a=r[t],o=i[1].split(`,`).map(WT);return typeof a==`function`?a(o):o[a]}var UT=(e,t)=>{let{transform:n=`none`}=getComputedStyle(e);return HT(n,t)};function WT(e){return parseFloat(e.trim())}var GT=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],KT=(()=>new Set(GT))(),qT=e=>e===$C||e===Q,JT=new Set([`x`,`y`,`z`]),YT=GT.filter(e=>!JT.has(e));function XT(e){let t=[];return YT.forEach(n=>{let r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith(`scale`)?1:0))}),t}var ZT={width:({x:e},{paddingLeft:t=`0`,paddingRight:n=`0`})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t=`0`,paddingBottom:n=`0`})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>HT(t,`x`),y:(e,{transform:t})=>HT(t,`y`)};ZT.translateX=ZT.x,ZT.translateY=ZT.y;var QT=new Set,$T=!1,eE=!1,tE=!1;function nE(){if(eE){let e=Array.from(QT).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{let t=XT(e);t.length&&(n.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=n.get(e);t&&t.forEach(([t,n])=>{e.getValue(t)?.set(n)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{e.suspendedScrollY!==void 0&&window.scrollTo(0,e.suspendedScrollY)})}eE=!1,$T=!1,QT.forEach(e=>e.complete(tE)),QT.clear()}function rE(){QT.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(eE=!0)})}function iE(){tE=!0,rE(),nE(),tE=!1}var aE=class{constructor(e,t,n,r,i,a=!1){this.state=`pending`,this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=i,this.isAsync=a}scheduleResolve(){this.state=`scheduled`,this.isAsync?(QT.add(this),$T||($T=!0,zC.read(rE),zC.resolveKeyframes(nE))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;if(e[0]===null){let i=r?.get(),a=e[e.length-1];if(i!==void 0)e[0]=i;else if(n&&t){let r=n.readValue(t,a);r!=null&&(e[0]=r)}e[0]===void 0&&(e[0]=a),r&&i===void 0&&r.set(e[0])}MT(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state=`complete`,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),QT.delete(this)}cancel(){this.state===`scheduled`&&(QT.delete(this),this.state=`pending`)}resume(){this.state===`pending`&&this.scheduleResolve()}},oE=e=>e.startsWith(`--`);function sE(e,t,n){oE(t)?e.style.setProperty(t,n):e.style[t]=n}var cE=tC(()=>window.ScrollTimeline!==void 0),lE={};function uE(e,t){let n=tC(e);return()=>lE[t]??n()}var dE=uE(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),fE=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,pE={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:fE([0,.65,.55,1]),circOut:fE([.55,0,1,.45]),backIn:fE([.31,.01,.66,-.59]),backOut:fE([.33,1.53,.69,.99])};function mE(e,t){if(e)return typeof e==`function`?dE()?eT(e,t):`ease-out`:AC(e)?fE(e):Array.isArray(e)?e.map(e=>mE(e,t)||pE.easeOut):pE[e]}function hE(e,t,n,{delay:r=0,duration:i=300,repeat:a=0,repeatType:o=`loop`,ease:s=`easeOut`,times:c}={},l=void 0){let u={[t]:n};c&&(u.offset=c);let d=mE(s,i);Array.isArray(d)&&(u.easing=d),FC.value&&KC.waapi++;let f={delay:r,duration:i,easing:Array.isArray(d)?`linear`:d,fill:`both`,iterations:a+1,direction:o===`reverse`?`alternate`:`normal`};l&&(f.pseudoElement=l);let p=e.animate(u,f);return FC.value&&p.finished.finally(()=>{KC.waapi--}),p}function gE(e){return typeof e==`function`&&`applyToOptions`in e}function _E({type:e,...t}){return gE(e)&&dE()?e.applyToOptions(t):(t.duration??=300,t.ease??=`easeOut`,t)}var vE=class extends kT{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;let{element:t,name:n,keyframes:r,pseudoElement:i,allowFlatten:a=!1,finalKeyframe:o,onComplete:s}=e;this.isPseudoElement=!!i,this.allowFlatten=a,this.options=e,XS(typeof e.type!=`string`,`Mini animate() doesn't support "type" as a string.`,`mini-spring`);let c=_E(e);this.animation=hE(t,n,r,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=ET(r,this.options,o,this.speed);this.updateMotionValue?this.updateMotionValue(e):sE(t,n,e),this.animation.cancel()}s?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state===`finished`&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:e}=this;e===`idle`||e===`finished`||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){let e=this.animation.effect?.getComputedTiming?.().duration||0;return cC(Number(e))}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+cC(e)}get time(){return cC(Number(this.animation.currentTime)||0)}set time(e){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=sC(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime===null?this.animation.playState:`finished`}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,observe:t}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:`linear`}),this.animation.onfinish=null,e&&cE()?(this.animation.timeline=e,nC):t(this)}},yE={anticipate:SC,backInOut:xC,circInOut:TC};function bE(e){return e in yE}function xE(e){typeof e.ease==`string`&&bE(e.ease)&&(e.ease=yE[e.ease])}var SE=10,CE=class extends vE{constructor(e){xE(e),OT(e),super(e),e.startTime!==void 0&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){let{motionValue:t,onUpdate:n,onComplete:r,element:i,...a}=this.options;if(!t)return;if(e!==void 0){t.set(e);return}let o=new jT({...a,autoplay:!1}),s=Math.max(SE,GC.now()-this.startTime),c=qS(0,SE,s-SE);t.setWithVelocity(o.sample(Math.max(0,s-c)).value,o.sample(s).value,c),o.stop()}},wE=(e,t)=>t===`zIndex`?!1:!!(typeof e==`number`||Array.isArray(e)||typeof e==`string`&&(Pw.test(e)||e===`0`)&&!e.startsWith(`url(`));function TE(e){let t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function EE(e,t,n,r){let i=e[0];if(i===null)return!1;if(t===`display`||t===`visibility`)return!0;let a=e[e.length-1],o=wE(i,t),s=wE(a,t);return YS(o===s,`You are trying to animate ${t} from "${i}" to "${a}". "${o?a:i}" is not an animatable value.`,`value-not-animatable`),!o||!s?!1:TE(e)||(n===`spring`||gE(n))&&r}function DE(e){e.duration=0,e.type=`keyframes`}var OE=new Set([`opacity`,`clipPath`,`filter`,`transform`]),kE=tC(()=>Object.hasOwnProperty.call(Element.prototype,`animate`));function AE(e){let{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:a,type:o}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;let{onUpdate:s,transformTemplate:c}=t.owner.getProps();return kE()&&n&&OE.has(n)&&(n!==`transform`||!c)&&!s&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`}var jE=40,ME=class extends kT{constructor({autoplay:e=!0,delay:t=0,type:n=`keyframes`,repeat:r=0,repeatDelay:i=0,repeatType:a=`loop`,keyframes:o,name:s,motionValue:c,element:l,...u}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=GC.now();let d={autoplay:e,delay:t,type:n,repeat:r,repeatDelay:i,repeatType:a,name:s,motionValue:c,element:l,...u};this.keyframeResolver=new(l?.KeyframeResolver||aE)(o,(e,t,n)=>this.onKeyframesResolved(e,t,d,!n),s,c,l),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,n,r){this.keyframeResolver=void 0;let{name:i,type:a,velocity:o,delay:s,isHandoff:c,onUpdate:l}=n;this.resolvedAt=GC.now(),EE(e,i,a,o)||((ZS.instantAnimations||!s)&&l?.(ET(e,n,t)),e[0]=e[e.length-1],DE(n),n.repeat=0);let u={startTime:r?this.resolvedAt&&this.resolvedAt-this.createdAt>jE?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...n,keyframes:e},d=!c&&AE(u)?new CE({...u,element:u.motionValue.owner.current}):new jT(u);d.finished.then(()=>this.notifyFinished()).catch(nC),this.pendingTimeline&&=(this.stopTimeline=d.attachTimeline(this.pendingTimeline),void 0),this._animation=d}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),iE()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}},NE=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function PE(e){let t=NE.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}var FE=4;function IE(e,t,n=1){XS(n<=FE,`Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`,`max-css-var-depth`);let[r,i]=PE(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return QS(e)?parseFloat(e):e}return XC(i)?IE(i,t,n+1):i}function LE(e,t){return e?.[t]??e?.default??e}var RE=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...GT]),zE={test:e=>e===`auto`,parse:e=>e},BE=e=>t=>t.test(e),VE=[$C,Q,hw,mw,_w,gw,zE],HE=e=>VE.find(BE(e));function UE(e){return typeof e==`number`?e===0:e===null?!0:e===`none`||e===`0`||eC(e)}var WE=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function GE(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(rw)||[];if(!r)return e;let i=n.replace(r,``),a=WE.has(t)?1:0;return r!==n&&(a*=100),t+`(`+a+i+`)`}var KE=/\b([a-z-]*)\(.*?\)/gu,qE={...Pw,getAnimatableNone:e=>{let t=e.match(KE);return t?t.map(GE).join(` `):e}},JE={...$C,transform:Math.round},YE={borderWidth:Q,borderTopWidth:Q,borderRightWidth:Q,borderBottomWidth:Q,borderLeftWidth:Q,borderRadius:Q,radius:Q,borderTopLeftRadius:Q,borderTopRightRadius:Q,borderBottomRightRadius:Q,borderBottomLeftRadius:Q,width:Q,maxWidth:Q,height:Q,maxHeight:Q,top:Q,right:Q,bottom:Q,left:Q,inset:Q,insetBlock:Q,insetBlockStart:Q,insetBlockEnd:Q,insetInline:Q,insetInlineStart:Q,insetInlineEnd:Q,padding:Q,paddingTop:Q,paddingRight:Q,paddingBottom:Q,paddingLeft:Q,paddingBlock:Q,paddingBlockStart:Q,paddingBlockEnd:Q,paddingInline:Q,paddingInlineStart:Q,paddingInlineEnd:Q,margin:Q,marginTop:Q,marginRight:Q,marginBottom:Q,marginLeft:Q,marginBlock:Q,marginBlockStart:Q,marginBlockEnd:Q,marginInline:Q,marginInlineStart:Q,marginInlineEnd:Q,backgroundPositionX:Q,backgroundPositionY:Q,rotate:mw,rotateX:mw,rotateY:mw,rotateZ:mw,scale:tw,scaleX:tw,scaleY:tw,scaleZ:tw,skew:mw,skewX:mw,skewY:mw,distance:Q,translateX:Q,translateY:Q,translateZ:Q,x:Q,y:Q,z:Q,perspective:Q,transformPerspective:Q,opacity:ew,originX:vw,originY:vw,originZ:Q,zIndex:JE,fillOpacity:ew,strokeOpacity:ew,numOctaves:JE},XE={...YE,color:bw,backgroundColor:bw,outlineColor:bw,fill:bw,stroke:bw,borderColor:bw,borderTopColor:bw,borderRightColor:bw,borderBottomColor:bw,borderLeftColor:bw,filter:qE,WebkitFilter:qE},ZE=e=>XE[e];function QE(e,t){let n=ZE(e);return n!==qE&&(n=Pw),n.getAnimatableNone?n.getAnimatableNone(t):void 0}var $E=new Set([`auto`,`none`,`0`]);function eD(e,t,n){let r=0,i;for(;r<e.length&&!i;){let t=e[r];typeof t==`string`&&!$E.has(t)&&kw(t).values.length&&(i=e[r]),r++}if(i&&n)for(let r of t)e[r]=QE(n,i)}var tD=class extends aE{constructor(e,t,n,r,i){super(e,t,n,r,i,!0)}readKeyframes(){let{unresolvedKeyframes:e,element:t,name:n}=this;if(!t||!t.current)return;super.readKeyframes();for(let n=0;n<e.length;n++){let r=e[n];if(typeof r==`string`&&(r=r.trim(),XC(r))){let i=IE(r,t.current);i!==void 0&&(e[n]=i),n===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!RE.has(n)||e.length!==2)return;let[r,i]=e,a=HE(r),o=HE(i);if(QC(r)!==QC(i)&&ZT[n]){this.needsMeasurement=!0;return}if(a!==o)if(qT(a)&&qT(o))for(let t=0;t<e.length;t++){let n=e[t];typeof n==`string`&&(e[t]=parseFloat(n))}else ZT[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,n=[];for(let t=0;t<e.length;t++)(e[t]===null||UE(e[t]))&&n.push(t);n.length&&eD(e,n,t)}measureInitialState(){let{element:e,unresolvedKeyframes:t,name:n}=this;if(!e||!e.current)return;n===`height`&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=ZT[n](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;let r=t[t.length-1];r!==void 0&&e.getValue(n,r).jump(r,!1)}measureEndState(){let{element:e,name:t,unresolvedKeyframes:n}=this;if(!e||!e.current)return;let r=e.getValue(t);r&&r.jump(this.measuredOrigin,!1);let i=n.length-1,a=n[i];n[i]=ZT[t](e.measureViewportBox(),window.getComputedStyle(e.current)),a!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=a),this.removedTransforms?.length&&this.removedTransforms.forEach(([t,n])=>{e.getValue(t).set(n)}),this.resolveNoneKeyframes()}};function nD(e,t,n){if(e instanceof EventTarget)return[e];if(typeof e==`string`){let r=document;t&&(r=t.current);let i=n?.[e]??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e)}var rD=(e,t)=>t&&typeof e==`number`?t.transform(e):e;function iD(e){return $S(e)&&`offsetHeight`in e}var aD=30,oD=e=>!isNaN(parseFloat(e)),sD={current:void 0},cD=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=GC.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=GC.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=oD(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return process.env.NODE_ENV!==`production`&&dC(!1,`value.onChange(callback) is deprecated. Switch to value.on("change", callback).`),this.on(`change`,e)}on(e,t){this.events[e]||(this.events[e]=new oC);let n=this.events[e].add(t);return e===`change`?()=>{n(),zC.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||=new Set,this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return sD.current&&sD.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=GC.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>aD)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,aD);return lC(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function lD(e,t){return new cD(e,t)}var{schedule:uD,cancel:dD}=RC(queueMicrotask,!1),fD={x:!1,y:!1};function pD(){return fD.x||fD.y}function mD(e){return e===`x`||e===`y`?fD[e]?null:(fD[e]=!0,()=>{fD[e]=!1}):fD.x||fD.y?null:(fD.x=fD.y=!0,()=>{fD.x=fD.y=!1})}function hD(e,t){let n=nD(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function gD(e){return!(e.pointerType===`touch`||pD())}function _D(e,t,n={}){let[r,i,a]=hD(e,n),o=e=>{if(!gD(e))return;let{target:n}=e,r=t(n,e);if(typeof r!=`function`||!n)return;let a=e=>{gD(e)&&(r(e),n.removeEventListener(`pointerleave`,a))};n.addEventListener(`pointerleave`,a,i)};return r.forEach(e=>{e.addEventListener(`pointerenter`,o,i)}),a}var vD=(e,t)=>t?e===t?!0:vD(e,t.parentElement):!1,yD=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1,bD=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function xD(e){return bD.has(e.tagName)||e.isContentEditable===!0}var SD=new WeakSet;function CD(e){return t=>{t.key===`Enter`&&e(t)}}function wD(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}var TD=(e,t)=>{let n=e.currentTarget;if(!n)return;let r=CD(()=>{if(SD.has(n))return;wD(n,`down`);let e=CD(()=>{wD(n,`up`)});n.addEventListener(`keyup`,e,t),n.addEventListener(`blur`,()=>wD(n,`cancel`),t)});n.addEventListener(`keydown`,r,t),n.addEventListener(`blur`,()=>n.removeEventListener(`keydown`,r),t)};function ED(e){return yD(e)&&!pD()}function DD(e,t,n={}){let[r,i,a]=hD(e,n),o=e=>{let r=e.currentTarget;if(!ED(e))return;SD.add(r);let a=t(r,e),o=(e,t)=>{window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,c),SD.has(r)&&SD.delete(r),ED(e)&&typeof a==`function`&&a(e,{success:t})},s=e=>{o(e,r===window||r===document||n.useGlobalTarget||vD(r,e.target))},c=e=>{o(e,!1)};window.addEventListener(`pointerup`,s,i),window.addEventListener(`pointercancel`,c,i)};return r.forEach(e=>{(n.useGlobalTarget?window:e).addEventListener(`pointerdown`,o,i),iD(e)&&(e.addEventListener(`focus`,e=>TD(e,i)),!xD(e)&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=0))}),a}function OD(e){return $S(e)&&`ownerSVGElement`in e}function kD(e){return OD(e)&&e.tagName===`svg`}var AD=e=>!!(e&&e.getVelocity),jD=[...VE,bw,Pw],MD=e=>jD.find(BE(e)),ND=(0,t.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`});function PD(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function FD(...e){return t=>{let n=!1,r=e.map(e=>{let r=PD(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():PD(e[t],null)}}}}function ID(...e){return t.useCallback(FD(...e),e)}var LD=class extends t.Component{getSnapshotBeforeUpdate(e){let t=this.props.childRef.current;if(t&&e.isPresent&&!this.props.isPresent){let e=t.offsetParent,n=iD(e)&&e.offsetWidth||0,r=this.props.sizeRef.current;r.height=t.offsetHeight||0,r.width=t.offsetWidth||0,r.top=t.offsetTop,r.left=t.offsetLeft,r.right=n-r.width-r.left}return null}componentDidUpdate(){}render(){return this.props.children}};function RD({children:e,isPresent:n,anchorX:i,root:a}){let o=(0,t.useId)(),s=(0,t.useRef)(null),c=(0,t.useRef)({width:0,height:0,top:0,left:0,right:0}),{nonce:l}=(0,t.useContext)(ND),u=ID(s,e.props?.ref??e?.ref);return(0,t.useInsertionEffect)(()=>{let{width:e,height:t,top:r,left:u,right:d}=c.current;if(n||!s.current||!e||!t)return;let f=i===`left`?`left: ${u}`:`right: ${d}`;s.current.dataset.motionPopId=o;let p=document.createElement(`style`);l&&(p.nonce=l);let m=a??document.head;return m.appendChild(p),p.sheet&&p.sheet.insertRule(`
48
+ `)?n.value.length:0;requestAnimationFrame(()=>{try{n.setSelectionRange(i,i)}catch{}n.focus()})}},t.createElement(`input`,{spellCheck:`false`,...l,ref:an(r,n),className:`rt-reset rt-TextFieldInput`}),i)});X.displayName=`TextField.Root`;var _b=t.forwardRef((e,n)=>{let{className:r,color:i,side:a,...o}=V(e,hb);return t.createElement(`div`,{"data-accent-color":i,"data-side":a,...o,ref:n,className:(0,gb.default)(`rt-TextFieldSlot`,r)})});_b.displayName=`TextField.Slot`;var vb={content:{type:`ReactNode`,required:!0},width:Rg.width,minWidth:Rg.minWidth,maxWidth:{...Rg.maxWidth,default:`360px`}},yb=h(B()),bb=t.forwardRef((e,n)=>{let{children:r,className:i,open:a,defaultOpen:o,onOpenChange:s,delayDuration:c,disableHoverableContent:l,content:u,container:d,forceMount:f,...p}=V(e,vb),m={open:a,defaultOpen:o,onOpenChange:s,delayDuration:c,disableHoverableContent:l};return t.createElement(Mg,{...m},t.createElement(Ng,{asChild:!0},r),t.createElement(Pg,{container:d,forceMount:f},t.createElement(A_,{asChild:!0},t.createElement(Fg,{sideOffset:4,collisionPadding:10,...p,asChild:!1,ref:n,className:(0,yb.default)(`rt-TooltipContent`,i)},t.createElement(H,{as:`p`,className:`rt-TooltipText`,size:`1`},u),t.createElement(Ig,{className:`rt-TooltipArrow`})))))});bb.displayName=`Tooltip`;function Z(e,t=`Assertion error`){if(!e)throw Error(t)}function xb({group:e}){let{orientation:t,panels:n}=e;return n.reduce((e,n)=>(e+=t===`horizontal`?n.element.offsetWidth:n.element.offsetHeight,e),0)}function Sb(e,t){return t.sort(e===`horizontal`?Cb:wb)}function Cb(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function wb(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function Tb(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function Eb(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function Db({orientation:e,rects:t,targetRect:n}){let r={x:n.x+n.width/2,y:n.y+n.height/2},i,a=Number.MAX_VALUE;for(let n of t){let{x:t,y:o}=Eb(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return Z(i,`No rect found`),i}function Ob(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=Sb(n,Array.from(t.children).filter(Tb).map(e=>({element:e}))).map(({element:e})=>e),o=[],s=!1,c,l=[];for(let t of a)if(t.hasAttribute(`data-panel`)){let i=r.find(e=>e.element===t);if(i){if(c){let r=c.element.getBoundingClientRect(),a=t.getBoundingClientRect(),u;if(s){let e=n===`horizontal`?new DOMRect(r.right,r.top,0,r.height):new DOMRect(r.left,r.bottom,r.width,0),t=n===`horizontal`?new DOMRect(a.left,a.top,0,a.height):new DOMRect(a.left,a.top,a.width,0);switch(l.length){case 0:u=[e,t];break;case 1:{let i=l[0];u=[i,Db({orientation:n,rects:[r,a],targetRect:i.element.getBoundingClientRect()})===r?t:e];break}default:u=l;break}}else u=l.length?l:[n===`horizontal`?new DOMRect(r.right,a.top,a.left-r.right,a.height):new DOMRect(a.left,r.bottom,a.width,a.top-r.bottom)];for(let t of u)o.push({group:e,groupSize:xb({group:e}),panels:[c,i],separator:`width`in t?void 0:t,rect:`width`in t?t:t.element.getBoundingClientRect()})}s=!1,c=i,l=[]}}else if(t.hasAttribute(`data-separator`)){let e=i.find(e=>e.element===t);e?l.push(e):(c=void 0,l=[])}else s=!0;return o}function kb(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function Ab(e,t){let n=getComputedStyle(e.ownerDocument.body);return t*parseFloat(n.fontSize)}function jb(e){return e/100*window.innerHeight}function Mb(e){return e/100*window.innerWidth}function Nb(e){switch(typeof e){case`number`:return[e,`px`];case`string`:{let t=parseFloat(e);return e.endsWith(`%`)?[t,`%`]:e.endsWith(`px`)?[t,`px`]:e.endsWith(`rem`)?[t,`rem`]:e.endsWith(`em`)?[t,`em`]:e.endsWith(`vh`)?[t,`vh`]:e.endsWith(`vw`)?[t,`vw`]:[t,`%`]}}}function Pb({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=Nb(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=Ab(t,i);break;case`em`:r=kb(t,i);break;case`vh`:r=jb(i);break;case`vw`:r=Mb(i);break}return r}function Fb(e){return parseFloat(e.toFixed(3))}function Ib(e){let{panels:t}=e,n=xb({group:e});return n===0?t.map(e=>({collapsedSize:0,collapsible:e.panelConstraints.collapsible===!0,defaultSize:void 0,minSize:0,maxSize:100,panelId:e.id})):t.map(e=>{let{element:t,panelConstraints:r}=e,i=0;r.collapsedSize&&(i=Fb(Pb({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize&&(a=Fb(Pb({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize&&(o=Fb(Pb({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize&&(s=Fb(Pb({groupSize:n,panelElement:t,styleProp:r.maxSize})/n*100)),{collapsedSize:i,collapsible:r.collapsible===!0,defaultSize:a,minSize:o,maxSize:s,panelId:e.id}})}var Lb=class{#e={};addListener(e,t){let n=this.#e[e];return n===void 0?this.#e[e]=[t]:n.includes(t)||n.push(t),()=>{this.removeListener(e,t)}}emit(e,t){let n=this.#e[e];if(n!==void 0)if(n.length===1)n[0].call(null,t);else{let e=!1,r=null,i=Array.from(n);for(let n=0;n<i.length;n++){let a=i[n];try{a.call(null,t)}catch(t){r===null&&(e=!0,r=t)}}if(e)throw r}}removeAllListeners(){this.#e={}}removeListener(e,t){let n=this.#e[e];if(n!==void 0){let e=n.indexOf(t);e>=0&&n.splice(e,1)}}};function Rb(e,t,n=0){return Math.abs(Fb(e)-Fb(t))<=n}var zb={cursorFlags:0,interactionState:{state:`inactive`},mountedGroups:new Map},Bb=new Lb;function Vb(){return zb}function Hb(e){let t=typeof e==`function`?e(zb):e;if(zb===t)return zb;let n=zb;return zb={...zb,...t},t.cursorFlags!==void 0&&Bb.emit(`cursorFlagsChange`,zb.cursorFlags),t.interactionState!==void 0&&Bb.emit(`interactionStateChange`,zb.interactionState),t.mountedGroups!==void 0&&(zb.mountedGroups.forEach((e,t)=>{e.derivedPanelConstraints.forEach(r=>{if(r.collapsible){let{layout:i}=n.mountedGroups.get(t)??{};if(i){let n=Rb(r.collapsedSize,e.layout[r.panelId]),a=Rb(r.collapsedSize,i[r.panelId]);n&&!a&&(t.inMemoryLastExpandedPanelSizes[r.panelId]=i[r.panelId])}}})}),Bb.emit(`mountedGroupsChange`,zb.mountedGroups)),zb}function Ub(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function Wb(e,t){return Rb(e,t)?0:e>t?1:-1}function Gb({panelConstraints:e,size:t}){let{collapsedSize:n=0,collapsible:r,maxSize:i=100,minSize:a=0}=e;if(Wb(t,a)<0)if(r){let e=(n+a)/2;t=Wb(t,e)<0?n:a}else t=a;return t=Math.min(i,t),t=Fb(t),t}function Kb({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(Rb(e,0))return t;let o=Object.values(t),s=Object.values(i),c=[...o],[l,u]=r;Z(l!=null,`Invalid first pivot index`),Z(u!=null,`Invalid second pivot index`);let d=0;if(a===`keyboard`){{let t=e<0?u:l,r=n[t];Z(r,`Panel constraints not found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:s=0}=r;if(a){let n=o[t];if(Z(n!=null,`Previous layout not found for panel index ${t}`),Rb(n,i)){let t=s-n;Wb(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?l:u,r=n[t];Z(r,`No panel constraints found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:s=0}=r;if(a){let n=o[t];if(Z(n!=null,`Previous layout not found for panel index ${t}`),Rb(n,s)){let t=n-i;Wb(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}}{let t=e<0?1:-1,r=e<0?u:l,i=0;for(;;){let e=o[r];Z(e!=null,`Previous layout not found for panel index ${r}`);let a=Gb({panelConstraints:n[r],size:100})-e;if(i+=a,r+=t,r<0||r>=n.length)break}let a=Math.min(Math.abs(e),Math.abs(i));e=e<0?0-a:a}{let t=e<0?l:u;for(;t>=0&&t<n.length;){let r=Math.abs(e)-Math.abs(d),i=o[t];Z(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,s=Gb({panelConstraints:n[t],size:a});if(!Rb(i,s)&&(d+=i-s,c[t]=s,d.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?t--:t++}}if(Ub(s,c))return i;{let t=e<0?u:l,r=o[t];Z(r!=null,`Previous layout not found for panel index ${t}`);let i=r+d,a=Gb({panelConstraints:n[t],size:i});if(c[t]=a,!Rb(a,i)){let t=i-a,r=e<0?u:l;for(;r>=0&&r<n.length;){let i=c[r];Z(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,o=Gb({panelConstraints:n[r],size:a});if(Rb(i,o)||(t-=o-i,c[r]=o),Rb(t,0))break;e>0?r--:r++}}}if(!Rb(Object.values(c).reduce((e,t)=>t+e,0),100,.1))return i;let f=Object.keys(i);return c.reduce((e,t,n)=>(e[f[n]]=t,e),{})}function qb(e){let{mountedGroups:t}=Vb();for(let[n]of t)if(n.separators.some(t=>t.element===e))return n;throw Error(`Could not find parent Group for separator element`)}function Jb(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||Wb(e[n],t[n])!==0)return!1;return!0}function Yb({layout:e,panelConstraints:t}){let n=[...Object.values(e)],r=n.reduce((e,t)=>e+t,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(e=>`${e}%`).join(`, `)}`);if(!Rb(r,100)&&n.length>0)for(let e=0;e<t.length;e++){let t=n[e];Z(t!=null,`No layout data found for index ${e}`),n[e]=100/r*t}let i=0;for(let e=0;e<t.length;e++){let r=n[e];Z(r!=null,`No layout data found for index ${e}`);let a=Gb({panelConstraints:t[e],size:r});r!=a&&(i+=r-a,n[e]=a)}if(!Rb(i,0))for(let e=0;e<t.length;e++){let r=n[e];Z(r!=null,`No layout data found for index ${e}`);let a=r+i,o=Gb({panelConstraints:t[e],size:a});if(r!==o&&(i-=o-r,n[e]=o,Rb(i,0)))break}let a=Object.keys(e);return n.reduce((e,t,n)=>(e[a[n]]=t,e),{})}function Xb({groupId:e}){let t=()=>{let{mountedGroups:t}=Vb();for(let[n,r]of t)if(n.id===e)return{group:n,...r};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){let{defaultLayoutDeferred:e,layout:n}=t();return e?{}:n},setLayout(e){let{defaultLayoutDeferred:n,derivedPanelConstraints:r,group:i,layout:a,separatorToPanels:o}=t(),s=Yb({layout:e,panelConstraints:r});return n?a:(Jb(a,s)||Hb(e=>({mountedGroups:new Map(e.mountedGroups).set(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,layout:s,separatorToPanels:o})})),s)}}}function Zb(e){let{mountedGroups:t}=Vb(),n=t.get(e);return Z(n,`Mounted Group ${e.id} not found`),n}function Qb(e,t){let n=qb(e),r=Zb(n),i=n.separators.find(t=>t.element===e);Z(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);Z(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=Xb({groupId:n.id}).getLayout(),c=Yb({layout:Kb({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});Jb(s,c)||Hb(e=>({mountedGroups:new Map(e.mountedGroups).set(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,layout:c,separatorToPanels:r.separatorToPanels})}))}function $b(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=qb(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&Qb(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&Qb(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&Qb(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&Qb(t,-5);break;case`End`:e.preventDefault(),Qb(t,100);break;case`Enter`:{e.preventDefault();let n=qb(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=Zb(n),o=n.separators.find(e=>e.element===t);Z(o,`Matching separator not found`);let s=a.get(o);Z(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(Z(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];Qb(t,(l.collapsedSize===e?n.inMemoryLastExpandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=qb(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);Z(r!==null,`Index not found`),n[e.shiftKey?r>0?r-1:n.length-1:r+1<n.length?r+1:0].focus();break}case`Home`:e.preventDefault(),Qb(t,-100);break}}var ex=e=>e,tx=()=>{},nx=1,rx=2,ix=4,ax=8,ox={coarse:10,precise:5};function sx(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=Eb(n,a.rect);switch(e){case`horizontal`:t.x<=i.x&&(r=a,i=t);break;case`vertical`:t.y<=i.y&&(r=a,i=t);break}}return r?{distance:i,hitRegion:r}:void 0}var cx;function lx(){return cx===void 0&&(cx=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),cx}function ux(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function dx(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:_x(e),b:_x(t)},r;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),r=e;Z(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:gx(hx(n.a)),b:gx(hx(n.b))};if(i.a===i.b){let e=r.childNodes,t={a:n.a.at(-1),b:n.b.at(-1)},i=e.length;for(;i--;){let n=e[i];if(n===t.a)return 1;if(n===t.b)return-1}}return Math.sign(i.a-i.b)}var fx=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function px(e){let t=getComputedStyle(vx(e)??e).display;return t===`flex`||t===`inline-flex`}function mx(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||px(e))||+t.opacity<1||`transform`in t&&t.transform!==`none`||`webkitTransform`in t&&t.webkitTransform!==`none`||`mixBlendMode`in t&&t.mixBlendMode!==`normal`||`filter`in t&&t.filter!==`none`||`webkitFilter`in t&&t.webkitFilter!==`none`||`isolation`in t&&t.isolation===`isolate`||fx.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function hx(e){let t=e.length;for(;t--;){let n=e[t];if(Z(n,`Missing node`),mx(n))return n}return null}function gx(e){return e&&Number(getComputedStyle(e).zIndex)||0}function _x(e){let t=[];for(;e;)t.push(e),e=vx(e);return t}function vx(e){let{parentNode:t}=e;return ux(t)?t.host:t}function yx(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function bx({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!Tb(n)||n.contains(e)||e.contains(n))return!0;if(dx(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(yx(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function xx(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=lx()?ox.coarse:ox.precise,a=Ob(r),o=sx(r.orientation,a,{x:e.clientX,y:e.clientY});o&&o.distance.x<=i&&o.distance.y<=i&&bx({groupElement:r.element,hitRegion:o.hitRegion.rect,pointerEventTarget:e.target})&&n.push(o.hitRegion)}),n}function Sx(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let{mountedGroups:t}=Vb(),n=xx(e,t),r=new Set,i=new Set,a=new Set,o=new Map,s=!1;n.forEach(e=>{r.add(e.group),e.panels.forEach(e=>{i.add(e)}),e.separator&&(a.add(e.separator),s||(s=!0,e.separator.element.focus()));let n=t.get(e.group);n&&o.set(e.group,n.layout)}),Hb({interactionState:{hitRegions:n,initialLayoutMap:o,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}}),n.length&&e.preventDefault()}function Cx({cursorFlags:e,groups:t,state:n}){let r=0,i=0;switch(n){case`active`:case`hover`:t.forEach(e=>{if(!e.disableCursor)switch(e.orientation){case`horizontal`:r++;break;case`vertical`:i++;break}})}if(r===0&&i===0)return null;switch(n){case`active`:{let t=(e&nx)!==0,n=(e&rx)!==0,r=(e&ix)!==0,i=(e&ax)!==0;if(e){if(t)return r?`se-resize`:i?`ne-resize`:`e-resize`;if(n)return r?`sw-resize`:i?`nw-resize`:`w-resize`;if(r)return`s-resize`;if(i)return`n-resize`}break}}return r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`}var wx=new WeakMap;function Tx(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=wx.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets=[n]);let{cursorFlags:r,interactionState:i}=Vb();switch(i.state){case`active`:case`hover`:{let e=Cx({cursorFlags:r,groups:i.hitRegions.map(e=>e.group),state:i.state}),a=`*{cursor: ${e} !important; ${i.state===`active`?`touch-action: none;`:``} }`;if(t===a)return;t=a,e?n.cssRules.length===0?n.insertRule(a):n.replaceSync(a):n.cssRules.length===1&&n.deleteRule(0);break}case`inactive`:t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}wx.set(e,{prevStyle:t,styleSheet:n})}function Ex({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:i,pointerDownAtPoint:a}){let o=0,s=new Map(i);n.forEach(e=>{let{group:n,groupSize:c}=e,{disableCursor:l,orientation:u,panels:d}=n,f=0;f=a?u===`horizontal`?(t.clientX-a.x)/c*100:(t.clientY-a.y)/c*100:u===`horizontal`?t.clientX<0?-100:100:t.clientY<0?-100:100;let p=r.get(n),{defaultLayoutDeferred:m,derivedPanelConstraints:h,layout:g,separatorToPanels:_}=i.get(n)??{defaultLayoutDeferred:!1};if(h&&p&&g&&_){let t=Kb({delta:f,initialLayout:p,panelConstraints:h,pivotIndices:e.panels.map(e=>d.indexOf(e)),prevLayout:g,trigger:`mouse-or-touch`});if(Jb(t,g)){if(f!==0&&!l)switch(u){case`horizontal`:o|=f<0?nx:rx;break;case`vertical`:o|=f<0?ix:ax;break}}else{s.set(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,layout:t,separatorToPanels:_});let n=e.group.panels.map(({id:e})=>e).join(`,`);e.group.inMemoryLayouts[n]=t}}}),Hb({cursorFlags:o,mountedGroups:s}),Tx(e)}function Dx(e){let{interactionState:t,mountedGroups:n}=Vb();switch(t.state){case`active`:Ex({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n})}}function Ox(e){if(e.defaultPrevented)return;let{interactionState:t,mountedGroups:n}=Vb();switch(t.state){case`active`:if(e.buttons===0){Hb(e=>e.interactionState.state===`inactive`?e:{cursorFlags:0,interactionState:{state:`inactive`}});return}Ex({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint});break;default:{let r=xx(e,n);r.length===0?t.state!==`inactive`&&Hb({interactionState:{state:`inactive`}}):Hb({interactionState:{hitRegions:r,state:`hover`}}),Tx(e.currentTarget);break}}}function kx(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;e.preventDefault();let{interactionState:t}=Vb();switch(t.state){case`active`:Hb({cursorFlags:0,interactionState:{state:`inactive`}}),Tx(e.currentTarget)}}function Ax(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=Fb(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=Fb((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function jx(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=xb({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:Fb(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function Mx(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function Nx(e,t){let n=e.map(e=>e.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(let e of n)if(!r.includes(e))return!1;return!0}var Px=new Map;function Fx(e){let t=!0;Z(e.element.ownerDocument.defaultView,`Cannot register an unmounted Group`);let n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,i=new Set,a=new n(n=>{for(let r of n){let{borderBoxSize:n,target:i}=r;if(i===e.element){if(t){if(xb({group:e})===0)return;Hb(t=>{let n=t.mountedGroups.get(e);if(n){let r=Ib(e),i=n.defaultLayoutDeferred?Ax(r):n.layout,a=Yb({layout:i,panelConstraints:r});return!n.defaultLayoutDeferred&&Jb(i,a)&&Mx(n.derivedPanelConstraints,r)?t:{mountedGroups:new Map(t.mountedGroups).set(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,layout:a,separatorToPanels:n.separatorToPanels})}}return t})}}else jx(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{Z(!r.has(e.id),`Panel ids must be unique; id "${e.id}" was used more than once`),r.add(e.id),e.onResize&&a.observe(e.element)});let o=xb({group:e}),s=Ib(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.defaultLayout;l&&(Nx(e.panels,l)||(l=void 0));let u=Yb({layout:e.inMemoryLayouts[c]??l??Ax(s),panelConstraints:s}),d=Ob(e),f=e.element.ownerDocument;return Hb(t=>{let n=new Map;return Px.set(f,(Px.get(f)??0)+1),d.forEach(e=>{e.separator&&n.set(e.separator,e.panels)}),{mountedGroups:new Map(t.mountedGroups).set(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,layout:u,separatorToPanels:n})}}),e.separators.forEach(e=>{Z(!i.has(e.id),`Separator ids must be unique; id "${e.id}" was used more than once`),i.add(e.id),e.element.addEventListener(`keydown`,$b)}),Px.get(f)===1&&(f.addEventListener(`pointerdown`,Sx,!0),f.addEventListener(`pointerleave`,Dx),f.addEventListener(`pointermove`,Ox),f.addEventListener(`pointerup`,kx,!0)),function(){t=!1,Px.set(f,Math.max(0,(Px.get(f)??0)-1)),Hb(t=>{let n=new Map(t.mountedGroups);return n.delete(e),{mountedGroups:n}}),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,$b)}),Px.get(f)||(f.removeEventListener(`pointerdown`,Sx,!0),f.removeEventListener(`pointerleave`,Dx),f.removeEventListener(`pointermove`,Ox),f.removeEventListener(`pointerup`,kx,!0)),a.disconnect()}}function Ix(){let[e,n]=(0,t.useState)({});return[e,(0,t.useCallback)(()=>n({}),[])]}function Lx(e){let n=(0,t.useId)();return`${e??n}`}var Rx=typeof window<`u`?t.useLayoutEffect:t.useEffect;function zx(e){let n=(0,t.useRef)(e);return Rx(()=>{n.current=e},[e]),(0,t.useCallback)((...e)=>n.current?.(...e),[n])}function Bx(...e){return zx(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function Vx(e){let n=(0,t.useRef)({...e});return Rx(()=>{for(let t in e)n.current[t]=e[t]},[e]),n.current}var Hx=`--react-resizable-panels--panel--pointer-events`;function Ux(e,t){return`--react-resizable-panels--${e.replace(/[^a-zA-Z0-9\-_]/g,``)}--${t.replace(/[^a-zA-Z0-9\-_]/g,``)}`}var Wx=(0,t.createContext)(null);function Gx(e,n){let r=(0,t.useRef)({getLayout:()=>({}),setLayout:ex});(0,t.useImperativeHandle)(n,()=>r.current,[]),Rx(()=>{Object.assign(r.current,Xb({groupId:e}))})}function Kx({children:e,className:n,defaultLayout:i,disableCursor:a,disabled:o,elementRef:s,groupRef:c,id:l,onLayoutChange:u,orientation:d=`horizontal`,style:f,...p}){let m=(0,t.useRef)({}),h=zx(e=>{Jb(m.current,e)||(m.current=e,u?.(e))}),g=Lx(l),_=(0,t.useRef)(null),[v,y]=(0,t.useState)(!1),[b,x]=(0,t.useState)(i??{}),[S,C]=Ix(),w=(0,t.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],separators:[]}),T=Bx(_,s);Gx(g,c);let E=(0,t.useMemo)(()=>({id:g,orientation:d,registerPanel:e=>{let t=w.current;return t.panels=Sb(d,[...t.panels,e]),C(),()=>{t.panels=t.panels.filter(t=>t!==e),C()}},registerSeparator:e=>{let t=w.current;return t.separators=Sb(d,[...t.separators,e]),C(),()=>{t.separators=t.separators.filter(t=>t!==e),C()}}}),[g,C,d]),D=Vx({defaultLayout:i,disableCursor:a}),O=(0,t.useRef)(null);Rx(()=>{let e=_.current;if(e===null)return;let t=w.current,n={defaultLayout:D.defaultLayout,disableCursor:!!D.disableCursor,disabled:!!o,element:e,id:g,inMemoryLastExpandedPanelSizes:w.current.lastExpandedPanelSizes,inMemoryLayouts:w.current.layouts,orientation:d,panels:t.panels,separators:t.separators};O.current=n;let r=Fx(n),i=Vb().mountedGroups.get(n);if(i){let{defaultLayoutDeferred:e,derivedPanelConstraints:t,layout:n}=i;!e&&t.length>0&&(x(n),h?.(n))}let a=Bb.addListener(`interactionStateChange`,e=>{switch(e.state){case`active`:y(e.hitRegions.some(e=>e.group===n));break;default:y(!1);break}}),s=Bb.addListener(`mountedGroupsChange`,e=>{let t=e.get(n);if(t){let{defaultLayoutDeferred:e,derivedPanelConstraints:n,layout:r}=t;if(e||n.length===0)return;x(r),h?.(r)}});return()=>{O.current=null,r(),a(),s()}},[o,g,h,d,S,D]),(0,t.useEffect)(()=>{let e=O.current;e&&(e.defaultLayout=i,e.disableCursor=!!a)});let k={[Hx]:v?`none`:void 0};for(let e in b){let t=Ux(g,e);k[t]=b[e]}return(0,r.jsx)(Wx.Provider,{value:E,children:(0,r.jsx)(`div`,{...p,"aria-orientation":d,className:n,"data-group":!0,"data-testid":g,id:g,ref:T,style:{height:`100%`,width:`100%`,overflow:`hidden`,...f,...k,display:`flex`,flexDirection:d===`horizontal`?`row`:`column`,flexWrap:`nowrap`},children:e})})}Kx.displayName=`Group`;function qx(){let e=(0,t.useContext)(Wx);return Z(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function Jx({groupId:e,panelId:t}){let n=()=>{let{mountedGroups:t}=Vb();for(let[n,{defaultLayoutDeferred:r,derivedPanelConstraints:i,layout:a,separatorToPanels:o}]of t)if(n.id===e)return{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:n,layout:a,separatorToPanels:o};throw Error(`Group ${e} not found`)},r=()=>{let e=n().derivedPanelConstraints.find(e=>e.panelId===t);if(e!==void 0)return e;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{let e=n().group.panels.find(e=>e.id===t);if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},a=()=>{let e=n().layout[t];if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},o=e=>{let r=a();if(e===r)return;let{defaultLayoutDeferred:i,derivedPanelConstraints:o,group:s,layout:c,separatorToPanels:l}=n(),u=s.panels.findIndex(e=>e.id===t),d=u===s.panels.length-1,f=Yb({layout:Kb({delta:d?r-e:e-r,initialLayout:c,panelConstraints:o,pivotIndices:d?[u-1,u]:[u,u+1],prevLayout:c,trigger:`imperative-api`}),panelConstraints:o});Jb(c,f)||Hb(e=>({mountedGroups:new Map(e.mountedGroups).set(s,{defaultLayoutDeferred:i,derivedPanelConstraints:o,layout:f,separatorToPanels:l})}))};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=r(),{mutableValues:n}=i(),s=a();e&&s!==t&&(n.expandToSize=s,o(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:n}=r(),{mutableValues:s}=i(),c=a();if(e&&c===t){let e=s.expandToSize??n;e===0&&(e=1),o(e)}},getSize:()=>{let{group:e}=n(),t=a(),{element:r}=i();return{asPercentage:t,inPixels:e.orientation===`horizontal`?r.offsetWidth:r.offsetHeight}},isCollapsed:()=>{let{collapsible:e,collapsedSize:t}=r(),n=a();return e&&Rb(t,n)},resize:e=>{if(a()!==e){let t;switch(typeof e){case`number`:{let{group:r}=n();t=Fb(e/xb({group:r})*100);break}case`string`:t=parseFloat(e);break}o(t)}}}}function Yx(e,n){let{id:r}=qx(),i=(0,t.useRef)({collapse:tx,expand:tx,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:tx});(0,t.useImperativeHandle)(n,()=>i.current,[]),Rx(()=>{Object.assign(i.current,Jx({groupId:r,panelId:e}))})}function Xx({children:e,className:n,collapsedSize:i=`0%`,collapsible:a=!1,defaultSize:o,elementRef:s,id:c,maxSize:l=`100%`,minSize:u=`0%`,onResize:d,panelRef:f,style:p,...m}){let h=!!c,g=Lx(c),_=(0,t.useRef)(null),v=Bx(_,s),{id:y,registerPanel:b}=qx(),x=d!==null,S=zx((e,t,n)=>{d?.(e,c,n)});Rx(()=>{let e=_.current;if(e!==null)return b({element:e,id:g,idIsStable:h,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:x?S:void 0,panelConstraints:{collapsedSize:i,collapsible:a,defaultSize:o,maxSize:l,minSize:u}})},[i,a,o,x,g,h,l,u,S,b]),Yx(g,f);let C=Ux(y,g);return(0,r.jsx)(`div`,{...m,"data-panel":!0,"data-testid":g,id:g,ref:v,style:{...Zx,flexBasis:0,flexGrow:`var(${C}, 1)`,flexShrink:1,overflow:`hidden`,pointerEvents:`var(${Hx})`},children:(0,r.jsx)(`div`,{className:n,style:{width:`100%`,height:`100%`,...p},children:e})})}Xx.displayName=`Panel`;var Zx={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function Qx({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let i,a,o=e[n],s=t.find(e=>e.panelId===n);if(s){let c=s.maxSize,l=a=s.collapsible?s.collapsedSize:s.minSize,u=[r,r+1];a=Yb({layout:Kb({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e,trigger:`keyboard`}),panelConstraints:t})[n],i=Yb({layout:Kb({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e,trigger:`keyboard`}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function $x({children:e,className:n,elementRef:i,id:a,style:o,...s}){let c=Lx(a),[l,u]=(0,t.useState)({}),[d,f]=(0,t.useState)(`inactive`),p=(0,t.useRef)(null),m=Bx(p,i),{id:h,orientation:g,registerSeparator:_}=qx(),v=g===`horizontal`?`vertical`:`horizontal`;return Rx(()=>{let e=p.current;if(e!==null){let t={element:e,id:c},n=_(t),r=Bb.addListener(`interactionStateChange`,e=>{f(e.state!==`inactive`&&e.hitRegions.some(e=>e.separator===t)?e.state:`inactive`)}),i=Bb.addListener(`mountedGroupsChange`,e=>{e.forEach(({derivedPanelConstraints:e,layout:n,separatorToPanels:r},i)=>{if(i.id===h){let a=r.get(t);if(a){let t=a[0],r=i.panels.indexOf(t);u(Qx({layout:n,panelConstraints:e,panelId:t.id,panelIndex:r}))}}})});return()=>{r(),i(),n()}}},[h,c,_]),(0,r.jsx)(`div`,{...s,"aria-controls":l.valueControls,"aria-orientation":v,"aria-valuemax":l.valueMax,"aria-valuemin":l.valueMin,"aria-valuenow":l.valueNow,children:e,className:n,"data-separator":d,"data-testid":c,id:c,ref:m,role:`separator`,style:{flexBasis:`auto`,...o,flexGrow:0,flexShrink:0},tabIndex:0})}$x.displayName=`Separator`;let eS=(0,t.createContext)(void 0);var tS=[`Arial`,`Helvetica`,`Times New Roman`,`Courier New`,`Verdana`,`Georgia`,`Palatino`,`Garamond`,`Bookman`,`Comic Sans MS`,`Trebuchet MS`,`Arial Black`,`Impact`];let nS=({children:e,isList:n=!1,availableProps:i=[],theme:a=`light`})=>{let[o,s]=(0,t.useState)({elements:[],selectedElementIds:[],isList:n,mockData:[],singleMockData:{},listSettings:{sortOrder:`asc`,newestPosition:`bottom`,scrollDirection:`down`},availableProps:i,availableFonts:[...tS,`Roboto`,`Open Sans`,`Lato`,`Montserrat`],theme:a,history:[[]],historyDescriptions:[],historyIndex:0,clipboard:[],gridSize:0,zoom:1,pan:{x:0,y:0},snapLines:[],assets:[],isPropertiesPanelOpen:!1});t.default.useEffect(()=>{o.availableFonts.forEach(e=>{if(tS.includes(e))return;let t=`font-${e.replace(/\s+/g,`-`).toLowerCase()}`;if(!document.getElementById(t)){let n=document.createElement(`link`);n.id=t,n.href=`https://fonts.googleapis.com/css2?family=${e.replace(/ /g,`+`)}&display=swap`,n.rel=`stylesheet`,document.head.appendChild(n)}})},[o.availableFonts]),t.default.useEffect(()=>{s(e=>({...e,isList:n,availableProps:i,theme:a}))},[n,i,a]);let c=t.default.useCallback(e=>{s(t=>({...t,isPropertiesPanelOpen:e}))},[]),l=t.default.useCallback(e=>{s(t=>({...t,canvasHeight:e}))},[]),u=t.default.useCallback(e=>{s(t=>({...t,gridSize:e}))},[]),d=t.default.useCallback(e=>{s(t=>({...t,zoom:e}))},[]),f=t.default.useCallback(e=>{s(t=>({...t,pan:e}))},[]),p=t.default.useCallback(e=>{s(t=>({...t,snapLines:e}))},[]),m=t.default.useCallback(e=>{s(t=>{let n=e.elements||t.elements,r=[],i=new Set;return n.forEach(e=>{let t=e.id;(!t||i.has(t))&&(t=crypto.randomUUID()),i.add(t),r.push({...e,id:t,x:Number.isFinite(e.x)?e.x:0,y:Number.isFinite(e.y)?e.y:0,width:Number.isFinite(e.width)?e.width:100,height:Number.isFinite(e.height)?e.height:100,locked:!!e.locked,hidden:!!e.hidden})}),{...t,...e,elements:r,isList:e.isList??t.isList,availableProps:e.availableProps??t.availableProps,availableFonts:e.availableFonts??t.availableFonts,selectedElementIds:[],history:[r],historyIndex:0,clipboard:[]}})},[]),h=t.default.useCallback(()=>{s(e=>{if(e.historyIndex>0){let t=e.historyIndex-1;return{...e,elements:e.history[t],historyIndex:t,selectedElementIds:[]}}return e})},[]),g=t.default.useCallback(()=>{s(e=>{if(e.historyIndex<e.history.length-1){let t=e.historyIndex+1;return{...e,elements:e.history[t],historyIndex:t,selectedElementIds:[]}}return e})},[]),_=t.default.useCallback(e=>{s(t=>e>=0&&e<t.history.length?{...t,elements:t.history[e],historyIndex:e,selectedElementIds:[]}:t)},[]),v=t.default.useCallback(()=>{s(e=>{if(e.selectedElementIds.length>0){let t=e.elements.filter(t=>e.selectedElementIds.includes(t.id));return{...e,clipboard:t}}return e})},[]),y=t.default.useCallback(()=>{s(e=>{if(e.clipboard.length>0){let t=e.clipboard.map(e=>({...e,id:crypto.randomUUID(),x:e.x+20,y:e.y+20})),n=[...e.elements,...t],r=e.history.slice(0,e.historyIndex+1);r.push(n);let i=e.historyDescriptions.slice(0,e.historyIndex+1);return i.push(`Colar Elementos`),{...e,elements:n,history:r,historyDescriptions:i,historyIndex:r.length-1,selectedElementIds:t.map(e=>e.id)}}return e})},[]),b=t.default.useCallback(e=>{let t={};e.type===`box`&&(t.backgroundColor=`var(--gray-4)`),e.type===`text-container`&&(t.backgroundColor=`var(--gray-4)`,t.border=`1px solid var(--gray-8)`,t.padding=`8px`,t.display=`flex`,t.alignItems=`flex-start`,t.justifyContent=`flex-start`);let n={id:crypto.randomUUID(),x:50,y:50,width:200,height:e.type===`text`?50:150,...e,style:{...t,...e.style||{}}};s(e=>{let t=[...e.elements,n],r=e.history.slice(0,e.historyIndex+1);r.push(t);let i=e.historyDescriptions.slice(0,e.historyIndex+1),a={text:`Texto`,image:`Imagem`,box:`Caixa`,group:`Grupo`,"text-container":`Texto em Caixa`,checkbox:`Caixa de Seleção`}[n.type]||n.type;return i.push(`Adicionou ${a}`),{...e,elements:t,history:r,historyDescriptions:i,historyIndex:r.length-1,selectedElementIds:[n.id]}})},[]),x=t.default.useCallback(e=>{s(t=>{let n=t.elements.filter(t=>t.id!==e),r=t.history.slice(0,t.historyIndex+1);r.push(n);let i=t.historyDescriptions.slice(0,t.historyIndex+1);return i.push(`Remover Elemento`),{...t,elements:n,selectedElementIds:t.selectedElementIds.filter(t=>t!==e),history:r,historyDescriptions:i,historyIndex:r.length-1}})},[]),S=t.default.useCallback(()=>{s(e=>{if(e.selectedElementIds.length===0)return e;let t=e.elements.filter(t=>!e.selectedElementIds.includes(t.id)),n=e.history.slice(0,e.historyIndex+1);n.push(t);let r=e.historyDescriptions.slice(0,e.historyIndex+1);return r.push(`Remover Itens Selecionados`),{...e,elements:t,selectedElementIds:[],history:n,historyDescriptions:r,historyIndex:n.length-1}})},[]),C=t.default.useCallback((e,t=!1)=>{s(n=>{if(e===null)return{...n,selectedElementIds:[]};if(t){let t=n.selectedElementIds.includes(e),r;return r=t?n.selectedElementIds.filter(t=>t!==e):[...n.selectedElementIds,e],{...n,selectedElementIds:r}}else return{...n,selectedElementIds:[e]}})},[]),w=t.default.useCallback(e=>{s(t=>({...t,selectedElementIds:e}))},[]),T=t.default.useCallback((e,t)=>{s(n=>{let r=[...n.elements],i=r[e];r.splice(e,1),r.splice(t,0,i);let a=n.history.slice(0,n.historyIndex+1);a.push(r);let o=n.historyDescriptions.slice(0,n.historyIndex+1);return o.push(`Mover Elemento`),{...n,elements:r,history:a,historyDescriptions:o,historyIndex:a.length-1}})},[]),E=t.default.useCallback((e,t,n=!0)=>{s(r=>{let i=r.elements.map(n=>n.id===e?{...n,...t}:n),a=r.history,o=r.historyIndex,s=r.historyDescriptions;return n&&(a=r.history.slice(0,r.historyIndex+1),a.push(i),o=a.length-1,s=r.historyDescriptions.slice(0,r.historyIndex+1),s.push(`Atualizar Elemento`)),{...r,elements:i,history:a,historyDescriptions:s,historyIndex:o}})},[]),D=t.default.useCallback((e,t=!0)=>{s(n=>{let r=[...n.elements],i=[],a=new Set;e.forEach(({id:e,changes:t})=>{let r=n.elements.find(t=>t.id===e);if(r)if(r.groupId&&(t.x!==void 0||t.y!==void 0)){let e=n.elements.find(e=>e.id===r.groupId);if(e&&!a.has(e.id)){let n=(t.x??r.x)-r.x,o=(t.y??r.y)-r.y;i.push({id:e.id,changes:{x:e.x+n,y:e.y+o}}),a.add(e.id)}}else i.push({id:e,changes:t})});let o=[...i];i.forEach(({id:e,changes:t})=>{if(t.x!==void 0||t.y!==void 0){let r=n.elements.find(t=>t.id===e);if(r&&r.type===`group`){let i=(t.x??r.x)-r.x,a=(t.y??r.y)-r.y;n.elements.forEach(t=>{t.groupId===e&&(o.some(e=>e.id===t.id)||o.push({id:t.id,changes:{x:t.x+i,y:t.y+a}}))})}}}),o.forEach(({id:e,changes:t})=>{let n=r.findIndex(t=>t.id===e);n!==-1&&(r[n]={...r[n],...t})});let s=n.history,c=n.historyIndex,l=n.historyDescriptions;return t&&(s=n.history.slice(0,n.historyIndex+1),s.push(r),c=s.length-1,l=n.historyDescriptions.slice(0,n.historyIndex+1),l.push(`Atualizar Múltiplos Elementos`)),{...n,elements:r,history:s,historyDescriptions:l,historyIndex:c}})},[]),O=t.default.useCallback(e=>{s(t=>{let n=t.elements.filter(t=>e.includes(t.id));if(n.length===0)return t;let r=Math.min(...n.map(e=>e.x)),i=Math.min(...n.map(e=>e.y)),a=Math.max(...n.map(e=>e.x+e.width)),o=Math.max(...n.map(e=>e.y+e.height)),s={id:crypto.randomUUID(),type:`group`,name:`Novo Grupo`,content:``,x:r,y:i,width:a-r,height:o-i,style:{zIndex:0}},c=t.elements.map(t=>e.includes(t.id)?{...t,groupId:s.id}:t);c.push(s);let l=t.history.slice(0,t.historyIndex+1);l.push(c);let u=t.historyDescriptions.slice(0,t.historyIndex+1);return u.push(`Agrupar Elementos`),{...t,elements:c,selectedElementIds:[s.id],history:l,historyDescriptions:u,historyIndex:l.length-1}})},[]),k=t.default.useCallback(e=>{s(t=>{let n=t.elements.find(t=>t.id===e);if(!n||n.type!==`group`)return t;let r=[],i=t.elements.filter(t=>t.id!==e).map(t=>t.groupId===e?(r.push(t.id),{...t,groupId:void 0}):t),a=t.history.slice(0,t.historyIndex+1);a.push(i);let o=t.historyDescriptions.slice(0,t.historyIndex+1);return o.push(`Desagrupar Elementos`),{...t,elements:i,selectedElementIds:r,history:a,historyDescriptions:o,historyIndex:a.length-1}})},[]),A=t.default.useCallback((e,t)=>{s(n=>{let r=n.elements.map(n=>n.id===e?{...n,name:t}:n);return{...n,elements:r}})},[]),j=t.default.useCallback((e,t)=>{if(!e.find(e=>e.id===t&&e.type===`group`))return e;let n=e.filter(e=>e.groupId===t);if(n.length===0)return e;let r=Math.min(...n.map(e=>e.x)),i=Math.min(...n.map(e=>e.y)),a=Math.max(...n.map(e=>e.x+e.width)),o=Math.max(...n.map(e=>e.y+e.height));return e.map(e=>e.id===t?{...e,x:r,y:i,width:a-r,height:o-i}:e)},[]),M=t.default.useCallback((e,t)=>{s(n=>{let r=n.elements.find(t=>t.id===e),i=n.elements.find(e=>e.id===t&&e.type===`group`);if(!r||!i)return n;let a=n.elements.map(n=>n.id===e?{...n,groupId:t}:n);a=j(a,t);let o=n.history.slice(0,n.historyIndex+1);o.push(a);let s=n.historyDescriptions.slice(0,n.historyIndex+1);return s.push(`Adicionar ao Grupo`),{...n,elements:a,history:o,historyDescriptions:s,historyIndex:o.length-1}})},[j]),N=t.default.useCallback(e=>{s(t=>{let n=t.elements.find(t=>t.id===e);if(!n||!n.groupId)return t;let r=n.groupId,i=t.elements.map(t=>t.id===e?{...t,groupId:void 0}:t);i=j(i,r);let a=t.history.slice(0,t.historyIndex+1);a.push(i);let o=t.historyDescriptions.slice(0,t.historyIndex+1);return o.push(`Remover do Grupo`),{...t,elements:i,history:a,historyDescriptions:o,historyIndex:a.length-1}})},[j]),P=t.default.useCallback((e,t,n)=>{s(r=>{let i=r.elements.find(t=>t.id===e&&t.type===`group`);if(!i)return r;let a=t/i.width,o=n/i.height,s=i.x,c=i.y,l=r.elements.map(r=>{if(r.id===e)return{...r,width:t,height:n};if(r.groupId===e){let e=r.x-s,t=r.y-c,n=s+e*a,i=c+t*o;return{...r,x:n,y:i,width:Math.max(1,r.width*a),height:Math.max(1,r.height*o)}}return r}),u=r.history.slice(0,r.historyIndex+1);u.push(l);let d=r.historyDescriptions.slice(0,r.historyIndex+1);return d.push(`Redimensionar Grupo`),{...r,elements:l,history:u,historyDescriptions:d,historyIndex:u.length-1}})},[]),ee=t.default.useCallback((e,t)=>{s(n=>({...n,mockData:e,singleMockData:t}))},[]),F=t.default.useCallback(e=>{s(t=>({...t,listSettings:{...t.listSettings,...e}}))},[]),te=t.default.useCallback(e=>{s(t=>({...t,assets:[...t.assets,e]}))},[]),I=t.default.useCallback(e=>{s(t=>({...t,assets:t.assets.filter(t=>t.id!==e)}))},[]);return(0,r.jsx)(eS.Provider,{value:t.default.useMemo(()=>({state:o,setGridSize:u,setZoom:d,setPan:f,setSnapLines:p,addElement:b,removeElement:x,removeSelected:S,selectElement:C,setSelectedElements:w,moveElement:T,updateElement:E,updateElements:D,groupElements:O,ungroupElements:k,renameElement:A,addToGroup:M,removeFromGroup:N,resizeGroup:P,setMockData:ee,updateListSettings:F,setCanvasHeight:l,loadState:m,undo:h,redo:g,jumpToHistory:_,copy:v,paste:y,setPropertiesPanelOpen:c,addAsset:te,removeAsset:I}),[o,b,x,S,C,w,T,E,D,O,k,A,M,N,P,ee,F,l,m,h,g,_,v,y,u,d,f,p,te,I,c]),children:e})},rS=()=>{let e=(0,t.useContext)(eS);if(!e)throw Error(`useEditor must be used within an EditorProvider`);return e},iS=()=>{let{state:e,updateElements:t}=rS(),{selectedElementIds:n,elements:i}=e;if(n.length<2)return null;let a=()=>i.filter(e=>n.includes(e.id));return(0,r.jsxs)(W,{gap:`2`,align:`center`,wrap:`wrap`,style:{backgroundColor:`var(--color-panel-solid)`,padding:`8px`,borderRadius:`8px`,boxShadow:`0 2px 10px rgba(0,0,0,0.1)`,border:`1px solid var(--gray-5)`,maxWidth:`90vw`,justifyContent:`center`},children:[(0,r.jsx)(J,{variant:`ghost`,color:`gray`,onClick:()=>{let e=a();if(e.length<2)return;let n=Math.min(...e.map(e=>e.x));t(e.map(e=>({id:e.id,changes:{x:n}})))},title:`Alinhar à Esquerda`,children:(0,r.jsx)(T,{})}),(0,r.jsx)(J,{variant:`ghost`,color:`gray`,onClick:()=>{let e=a();if(e.length<2)return;let n=(Math.min(...e.map(e=>e.x))+Math.max(...e.map(e=>e.x+e.width)))/2;t(e.map(e=>({id:e.id,changes:{x:n-e.width/2}})))},title:`Alinhar ao Centro (Horizontal)`,children:(0,r.jsx)(x,{})}),(0,r.jsx)(J,{variant:`ghost`,color:`gray`,onClick:()=>{let e=a();if(e.length<2)return;let n=Math.max(...e.map(e=>e.x+e.width));t(e.map(e=>({id:e.id,changes:{x:n-e.width}})))},title:`Alinhar à Direita`,children:(0,r.jsx)(D,{})}),(0,r.jsx)(Qy,{orientation:`vertical`}),(0,r.jsx)(J,{variant:`ghost`,color:`gray`,onClick:()=>{let e=a();if(e.length<2)return;let n=Math.min(...e.map(e=>e.y));t(e.map(e=>({id:e.id,changes:{y:n}})))},title:`Alinhar ao Topo`,children:(0,r.jsx)(k,{})}),(0,r.jsx)(J,{variant:`ghost`,color:`gray`,onClick:()=>{let e=a();if(e.length<2)return;let n=(Math.min(...e.map(e=>e.y))+Math.max(...e.map(e=>e.y+e.height)))/2;t(e.map(e=>({id:e.id,changes:{y:n-e.height/2}})))},title:`Alinhar ao Centro (Vertical)`,children:(0,r.jsx)(C,{})}),(0,r.jsx)(J,{variant:`ghost`,color:`gray`,onClick:()=>{let e=a();if(e.length<2)return;let n=Math.max(...e.map(e=>e.y+e.height));t(e.map(e=>({id:e.id,changes:{y:n-e.height}})))},title:`Alinhar à Base`,children:(0,r.jsx)(y,{})}),n.length>=3&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(Qy,{orientation:`vertical`}),(0,r.jsx)(J,{variant:`ghost`,color:`gray`,onClick:()=>{let e=a();if(e.length<3)return;let n=[...e].sort((e,t)=>e.x-t.x),r=n[0],i=n[n.length-1],o=(i.x+i.width/2-(r.x+r.width/2))/(n.length-1);t(n.map((e,t)=>{if(t===0||t===n.length-1)return null;let i=r.x+r.width/2+o*t;return{id:e.id,changes:{x:i-e.width/2}}}).filter(e=>e!==null))},title:`Distribuir Horizontalmente`,children:(0,r.jsx)(wt,{})}),(0,r.jsx)(J,{variant:`ghost`,color:`gray`,onClick:()=>{let e=a();if(e.length<3)return;let n=[...e].sort((e,t)=>e.y-t.y),r=n[0],i=n[n.length-1],o=(i.y+i.height/2-(r.y+r.height/2))/(n.length-1);t(n.map((e,t)=>{if(t===0||t===n.length-1)return null;let i=r.y+r.height/2+o*t;return{id:e.id,changes:{y:i-e.height/2}}}).filter(e=>e!==null))},title:`Distribuir Verticalmente`,children:(0,r.jsx)(Et,{})})]})]})};var aS=function(){return aS=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},aS.apply(this,arguments)},oS={width:`100%`,height:`10px`,top:`0px`,left:`0px`,cursor:`row-resize`},sS={width:`10px`,height:`100%`,top:`0px`,left:`0px`,cursor:`col-resize`},cS={width:`20px`,height:`20px`,position:`absolute`,zIndex:1},lS={top:aS(aS({},oS),{top:`-5px`}),right:aS(aS({},sS),{left:void 0,right:`-5px`}),bottom:aS(aS({},oS),{top:void 0,bottom:`-5px`}),left:aS(aS({},sS),{left:`-5px`}),topRight:aS(aS({},cS),{right:`-10px`,top:`-10px`,cursor:`ne-resize`}),bottomRight:aS(aS({},cS),{right:`-10px`,bottom:`-10px`,cursor:`se-resize`}),bottomLeft:aS(aS({},cS),{left:`-10px`,bottom:`-10px`,cursor:`sw-resize`}),topLeft:aS(aS({},cS),{left:`-10px`,top:`-10px`,cursor:`nw-resize`})},uS=(0,t.memo)(function(e){var n=e.onResizeStart,i=e.direction,a=e.children,o=e.replaceStyles,s=e.className,c=(0,t.useCallback)(function(e){n(e,i)},[n,i]),l=(0,t.useCallback)(function(e){n(e,i)},[n,i]),u=(0,t.useMemo)(function(){return aS(aS({position:`absolute`,userSelect:`none`},lS[i]),o??{})},[o,i]);return(0,r.jsx)(`div`,{className:s||void 0,style:u,onMouseDown:c,onTouchStart:l,children:a})}),dS=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),fS=function(){return fS=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},fS.apply(this,arguments)},pS={width:`auto`,height:`auto`},mS=function(e,t,n){return Math.max(Math.min(e,n),t)},hS=function(e,t,n){var r=Math.round(e/t);return r*t+n*(r-1)},gS=function(e,t){return new RegExp(e,`i`).test(t)},_S=function(e){return!!(e.touches&&e.touches.length)},vS=function(e){return!!((e.clientX||e.clientX===0)&&(e.clientY||e.clientY===0))},yS=function(e,t,n){n===void 0&&(n=0);var r=t.reduce(function(n,r,i){return Math.abs(r-e)<Math.abs(t[n]-e)?i:n},0),i=Math.abs(t[r]-e);return n===0||i<n?t[r]:e},bS=function(e){return e=e.toString(),e===`auto`||e.endsWith(`px`)||e.endsWith(`%`)||e.endsWith(`vh`)||e.endsWith(`vw`)||e.endsWith(`vmax`)||e.endsWith(`vmin`)?e:`${e}px`},xS=function(e,t,n,r){if(e&&typeof e==`string`){if(e.endsWith(`px`))return Number(e.replace(`px`,``));if(e.endsWith(`%`)){var i=Number(e.replace(`%`,``))/100;return t*i}if(e.endsWith(`vw`)){var i=Number(e.replace(`vw`,``))/100;return n*i}if(e.endsWith(`vh`)){var i=Number(e.replace(`vh`,``))/100;return r*i}}return e},SS=function(e,t,n,r,i,a,o){return r=xS(r,e.width,t,n),i=xS(i,e.height,t,n),a=xS(a,e.width,t,n),o=xS(o,e.height,t,n),{maxWidth:r===void 0?void 0:Number(r),maxHeight:i===void 0?void 0:Number(i),minWidth:a===void 0?void 0:Number(a),minHeight:o===void 0?void 0:Number(o)}},CS=function(e){return Array.isArray(e)?e:[e,e]},wS=`as.ref.style.className.grid.gridGap.snap.bounds.boundsByDirection.size.defaultSize.minWidth.minHeight.maxWidth.maxHeight.lockAspectRatio.lockAspectRatioExtraWidth.lockAspectRatioExtraHeight.enable.handleStyles.handleClasses.handleWrapperStyle.handleWrapperClass.children.onResizeStart.onResize.onResizeStop.handleComponent.scale.resizeRatio.snapGap`.split(`.`),TS=`__resizable_base__`,ES=function(e){dS(t,e);function t(t){var n=e.call(this,t)||this;return n.ratio=1,n.resizable=null,n.parentLeft=0,n.parentTop=0,n.resizableLeft=0,n.resizableRight=0,n.resizableTop=0,n.resizableBottom=0,n.targetLeft=0,n.targetTop=0,n.delta={width:0,height:0},n.appendBase=function(){if(!n.resizable||!n.window)return null;var e=n.parentNode;if(!e)return null;var t=n.window.document.createElement(`div`);return t.style.width=`100%`,t.style.height=`100%`,t.style.position=`absolute`,t.style.transform=`scale(0, 0)`,t.style.left=`0`,t.style.flex=`0 0 100%`,t.classList?t.classList.add(TS):t.className+=TS,e.appendChild(t),t},n.removeBase=function(e){var t=n.parentNode;t&&t.removeChild(e)},n.state={isResizing:!1,width:n.propsSize?.width??`auto`,height:n.propsSize?.height??`auto`,direction:`right`,original:{x:0,y:0,width:0,height:0},backgroundStyle:{height:`100%`,width:`100%`,backgroundColor:`rgba(0,0,0,0)`,cursor:`auto`,opacity:0,position:`fixed`,zIndex:9999,top:`0`,left:`0`,bottom:`0`,right:`0`},flexBasis:void 0},n.onResizeStart=n.onResizeStart.bind(n),n.onMouseMove=n.onMouseMove.bind(n),n.onMouseUp=n.onMouseUp.bind(n),n}return Object.defineProperty(t.prototype,`parentNode`,{get:function(){return this.resizable?this.resizable.parentNode:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,`window`,{get:function(){return!this.resizable||!this.resizable.ownerDocument?null:this.resizable.ownerDocument.defaultView},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,`propsSize`,{get:function(){return this.props.size||this.props.defaultSize||pS},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,`size`,{get:function(){var e=0,t=0;if(this.resizable&&this.window){var n=this.resizable.offsetWidth,r=this.resizable.offsetHeight,i=this.resizable.style.position;i!==`relative`&&(this.resizable.style.position=`relative`),e=this.resizable.style.width===`auto`?n:this.resizable.offsetWidth,t=this.resizable.style.height===`auto`?r:this.resizable.offsetHeight,this.resizable.style.position=i}return{width:e,height:t}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,`sizeStyle`,{get:function(){var e=this,t=this.props.size,n=function(t){if(e.state[t]===void 0||e.state[t]===`auto`)return`auto`;if(e.propsSize&&e.propsSize[t]&&e.propsSize[t]?.toString().endsWith(`%`)){if(e.state[t].toString().endsWith(`%`))return e.state[t].toString();var n=e.getParentSize();return`${Number(e.state[t].toString().replace(`px`,``))/n[t]*100}%`}return bS(e.state[t])};return{width:t&&t.width!==void 0&&!this.state.isResizing?bS(t.width):n(`width`),height:t&&t.height!==void 0&&!this.state.isResizing?bS(t.height):n(`height`)}},enumerable:!1,configurable:!0}),t.prototype.getParentSize=function(){if(!this.parentNode)return this.window?{width:this.window.innerWidth,height:this.window.innerHeight}:{width:0,height:0};var e=this.appendBase();if(!e)return{width:0,height:0};var t=!1,n=this.parentNode.style.flexWrap;n!==`wrap`&&(t=!0,this.parentNode.style.flexWrap=`wrap`),e.style.position=`relative`,e.style.minWidth=`100%`,e.style.minHeight=`100%`;var r={width:e.offsetWidth,height:e.offsetHeight};return t&&(this.parentNode.style.flexWrap=n),this.removeBase(e),r},t.prototype.bindEvents=function(){this.window&&(this.window.addEventListener(`mouseup`,this.onMouseUp),this.window.addEventListener(`mousemove`,this.onMouseMove),this.window.addEventListener(`mouseleave`,this.onMouseUp),this.window.addEventListener(`touchmove`,this.onMouseMove,{capture:!0,passive:!1}),this.window.addEventListener(`touchend`,this.onMouseUp))},t.prototype.unbindEvents=function(){this.window&&(this.window.removeEventListener(`mouseup`,this.onMouseUp),this.window.removeEventListener(`mousemove`,this.onMouseMove),this.window.removeEventListener(`mouseleave`,this.onMouseUp),this.window.removeEventListener(`touchmove`,this.onMouseMove,!0),this.window.removeEventListener(`touchend`,this.onMouseUp))},t.prototype.componentDidMount=function(){if(!(!this.resizable||!this.window)){var e=this.window.getComputedStyle(this.resizable);this.setState({width:this.state.width||this.size.width,height:this.state.height||this.size.height,flexBasis:e.flexBasis===`auto`?void 0:e.flexBasis})}},t.prototype.componentWillUnmount=function(){this.window&&this.unbindEvents()},t.prototype.createSizeForCssProperty=function(e,t){var n=this.propsSize&&this.propsSize[t];return this.state[t]===`auto`&&this.state.original[t]===e&&(n===void 0||n===`auto`)?`auto`:e},t.prototype.calculateNewMaxFromBoundary=function(e,t){var n=this.props.boundsByDirection,r=this.state.direction,i=n&&gS(`left`,r),a=n&&gS(`top`,r),o,s;if(this.props.bounds===`parent`){var c=this.parentNode;c&&(o=i?this.resizableRight-this.parentLeft:c.offsetWidth+(this.parentLeft-this.resizableLeft),s=a?this.resizableBottom-this.parentTop:c.offsetHeight+(this.parentTop-this.resizableTop))}else this.props.bounds===`window`?this.window&&(o=i?this.resizableRight:this.window.innerWidth-this.resizableLeft,s=a?this.resizableBottom:this.window.innerHeight-this.resizableTop):this.props.bounds&&(o=i?this.resizableRight-this.targetLeft:this.props.bounds.offsetWidth+(this.targetLeft-this.resizableLeft),s=a?this.resizableBottom-this.targetTop:this.props.bounds.offsetHeight+(this.targetTop-this.resizableTop));return o&&Number.isFinite(o)&&(e=e&&e<o?e:o),s&&Number.isFinite(s)&&(t=t&&t<s?t:s),{maxWidth:e,maxHeight:t}},t.prototype.calculateNewSizeFromDirection=function(e,t){var n=this.props.scale||1,r=CS(this.props.resizeRatio||1),i=r[0],a=r[1],o=this.state,s=o.direction,c=o.original,l=this.props,u=l.lockAspectRatio,d=l.lockAspectRatioExtraHeight,f=l.lockAspectRatioExtraWidth,p=c.width,m=c.height,h=d||0,g=f||0;return gS(`right`,s)&&(p=c.width+(e-c.x)*i/n,u&&(m=(p-g)/this.ratio+h)),gS(`left`,s)&&(p=c.width-(e-c.x)*i/n,u&&(m=(p-g)/this.ratio+h)),gS(`bottom`,s)&&(m=c.height+(t-c.y)*a/n,u&&(p=(m-h)*this.ratio+g)),gS(`top`,s)&&(m=c.height-(t-c.y)*a/n,u&&(p=(m-h)*this.ratio+g)),{newWidth:p,newHeight:m}},t.prototype.calculateNewSizeFromAspectRatio=function(e,t,n,r){var i=this.props,a=i.lockAspectRatio,o=i.lockAspectRatioExtraHeight,s=i.lockAspectRatioExtraWidth,c=r.width===void 0?10:r.width,l=n.width===void 0||n.width<0?e:n.width,u=r.height===void 0?10:r.height,d=n.height===void 0||n.height<0?t:n.height,f=o||0,p=s||0;if(a){var m=(u-f)*this.ratio+p,h=(d-f)*this.ratio+p,g=(c-p)/this.ratio+f,_=(l-p)/this.ratio+f,v=Math.max(c,m),y=Math.min(l,h),b=Math.max(u,g),x=Math.min(d,_);e=mS(e,v,y),t=mS(t,b,x)}else e=mS(e,c,l),t=mS(t,u,d);return{newWidth:e,newHeight:t}},t.prototype.setBoundingClientRect=function(){var e=1/(this.props.scale||1);if(this.props.bounds===`parent`){var t=this.parentNode;if(t){var n=t.getBoundingClientRect();this.parentLeft=n.left*e,this.parentTop=n.top*e}}if(this.props.bounds&&typeof this.props.bounds!=`string`){var r=this.props.bounds.getBoundingClientRect();this.targetLeft=r.left*e,this.targetTop=r.top*e}if(this.resizable){var i=this.resizable.getBoundingClientRect(),a=i.left,o=i.top,s=i.right,c=i.bottom;this.resizableLeft=a*e,this.resizableRight=s*e,this.resizableTop=o*e,this.resizableBottom=c*e}},t.prototype.onResizeStart=function(e,t){if(!(!this.resizable||!this.window)){var n=0,r=0;if(e.nativeEvent&&vS(e.nativeEvent)?(n=e.nativeEvent.clientX,r=e.nativeEvent.clientY):e.nativeEvent&&_S(e.nativeEvent)&&(n=e.nativeEvent.touches[0].clientX,r=e.nativeEvent.touches[0].clientY),!(this.props.onResizeStart&&this.resizable&&this.props.onResizeStart(e,t,this.resizable)===!1)){this.props.size&&(this.props.size.height!==void 0&&this.props.size.height!==this.state.height&&this.setState({height:this.props.size.height}),this.props.size.width!==void 0&&this.props.size.width!==this.state.width&&this.setState({width:this.props.size.width})),this.ratio=typeof this.props.lockAspectRatio==`number`?this.props.lockAspectRatio:this.size.width/this.size.height;var i,a=this.window.getComputedStyle(this.resizable);if(a.flexBasis!==`auto`){var o=this.parentNode;o&&(this.flexDir=this.window.getComputedStyle(o).flexDirection.startsWith(`row`)?`row`:`column`,i=a.flexBasis)}this.setBoundingClientRect(),this.bindEvents();var s={original:{x:n,y:r,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:fS(fS({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(e.target).cursor||`auto`}),direction:t,flexBasis:i};this.setState(s)}}},t.prototype.onMouseMove=function(e){var t=this;if(!(!this.state.isResizing||!this.resizable||!this.window)){if(this.window.TouchEvent&&_S(e))try{e.preventDefault(),e.stopPropagation()}catch{}var r=this.props,i=r.maxWidth,a=r.maxHeight,o=r.minWidth,s=r.minHeight,c=_S(e)?e.touches[0].clientX:e.clientX,l=_S(e)?e.touches[0].clientY:e.clientY,u=this.state,d=u.direction,f=u.original,p=u.width,m=u.height,h=this.getParentSize(),g=SS(h,this.window.innerWidth,this.window.innerHeight,i,a,o,s);i=g.maxWidth,a=g.maxHeight,o=g.minWidth,s=g.minHeight;var _=this.calculateNewSizeFromDirection(c,l),v=_.newHeight,y=_.newWidth,b=this.calculateNewMaxFromBoundary(i,a);this.props.snap&&this.props.snap.x&&(y=yS(y,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(v=yS(v,this.props.snap.y,this.props.snapGap));var x=this.calculateNewSizeFromAspectRatio(y,v,{width:b.maxWidth,height:b.maxHeight},{width:o,height:s});if(y=x.newWidth,v=x.newHeight,this.props.grid){var S=hS(y,this.props.grid[0],this.props.gridGap?this.props.gridGap[0]:0),C=hS(v,this.props.grid[1],this.props.gridGap?this.props.gridGap[1]:0),w=this.props.snapGap||0,T=w===0||Math.abs(S-y)<=w?S:y,E=w===0||Math.abs(C-v)<=w?C:v;y=T,v=E}var D={width:y-f.width,height:v-f.height};if(this.delta=D,p&&typeof p==`string`){if(p.endsWith(`%`)){var O=y/h.width*100;y=`${O}%`}else if(p.endsWith(`vw`)){var k=y/this.window.innerWidth*100;y=`${k}vw`}else if(p.endsWith(`vh`)){var A=y/this.window.innerHeight*100;y=`${A}vh`}}if(m&&typeof m==`string`){if(m.endsWith(`%`)){var O=v/h.height*100;v=`${O}%`}else if(m.endsWith(`vw`)){var k=v/this.window.innerWidth*100;v=`${k}vw`}else if(m.endsWith(`vh`)){var A=v/this.window.innerHeight*100;v=`${A}vh`}}var j={width:this.createSizeForCssProperty(y,`width`),height:this.createSizeForCssProperty(v,`height`)};this.flexDir===`row`?j.flexBasis=j.width:this.flexDir===`column`&&(j.flexBasis=j.height);var M=this.state.width!==j.width,N=this.state.height!==j.height,P=this.state.flexBasis!==j.flexBasis,ee=M||N||P;ee&&(0,n.flushSync)(function(){t.setState(j)}),this.props.onResize&&ee&&this.props.onResize(e,d,this.resizable,D)}},t.prototype.onMouseUp=function(e){var t=this.state,n=t.isResizing,r=t.direction;t.original,!(!n||!this.resizable)&&(this.props.onResizeStop&&this.props.onResizeStop(e,r,this.resizable,this.delta),this.props.size&&this.setState({width:this.props.size.width??`auto`,height:this.props.size.height??`auto`}),this.unbindEvents(),this.setState({isResizing:!1,backgroundStyle:fS(fS({},this.state.backgroundStyle),{cursor:`auto`})}))},t.prototype.updateSize=function(e){this.setState({width:e.width??`auto`,height:e.height??`auto`})},t.prototype.renderResizer=function(){var e=this,t=this.props,n=t.enable,i=t.handleStyles,a=t.handleClasses,o=t.handleWrapperStyle,s=t.handleWrapperClass,c=t.handleComponent;return n?(0,r.jsx)(`div`,{className:s,style:o,children:Object.keys(n).map(function(t){return n[t]===!1?null:(0,r.jsx)(uS,{direction:t,onResizeStart:e.onResizeStart,replaceStyles:i&&i[t],className:a&&a[t],children:c&&c[t]?c[t]:null},t)})}):null},t.prototype.render=function(){var e=this,t=Object.keys(this.props).reduce(function(t,n){return wS.indexOf(n)===-1&&(t[n]=e.props[n]),t},{}),n=fS(fS(fS({position:`relative`,userSelect:this.state.isResizing?`none`:`auto`},this.props.style),this.sizeStyle),{maxWidth:this.props.maxWidth,maxHeight:this.props.maxHeight,minWidth:this.props.minWidth,minHeight:this.props.minHeight,boxSizing:`border-box`,flexShrink:0});return this.state.flexBasis&&(n.flexBasis=this.state.flexBasis),(0,r.jsxs)(this.props.as||`div`,fS({style:n,className:this.props.className},t,{ref:function(t){t&&(e.resizable=t)},children:[this.state.isResizing&&(0,r.jsx)(`div`,{style:this.state.backgroundStyle}),this.props.children,this.renderResizer()]}))},t.defaultProps={as:`div`,onResizeStart:function(){},onResize:function(){},onResizeStop:function(){},enable:{top:!0,right:!0,bottom:!0,left:!0,topRight:!0,bottomRight:!0,bottomLeft:!0,topLeft:!0},style:{},grid:[1,1],gridGap:[0,0],lockAspectRatio:!1,lockAspectRatioExtraWidth:0,lockAspectRatioExtraHeight:0,scale:1,resizeRatio:1,snapGap:0},t}(t.PureComponent);let DS=[`normal`,`bold`,`100`,`300`,`900`],OS=[`100`,`300`,`400`,`500`,`600`,`700`,`900`,`normal`,`bold`],kS=(e,t=DS)=>{let n=e==null?`normal`:String(e);return n===`400`||n===`normal`?t.includes(`400`)?`400`:`normal`:n===`700`||n===`bold`?t.includes(`700`)?`700`:`bold`:t.includes(n)?n:t.includes(`400`)?`400`:t[0]??`normal`},AS=(e,t)=>t.includes(e)?t:[e,...t],jS=(e,t)=>{if(e==null)return``;if(t.type===`boolean`)return String(e)===`true`||e===!0||typeof e==`number`&&e>0?t.trueLabel||`Sim`:t.falseLabel||`Não`;if(t.type===`date`)try{let n=new Date(e);if(isNaN(n.getTime()))return String(e);if(t.dateFormat){let e=n.getDate().toString().padStart(2,`0`),r=(n.getMonth()+1).toString().padStart(2,`0`),i=n.getFullYear(),a=n.getHours().toString().padStart(2,`0`),o=n.getMinutes().toString().padStart(2,`0`),s=n.getSeconds().toString().padStart(2,`0`);return t.dateFormat.replace(`DD`,e).replace(`MM`,r).replace(`YYYY`,String(i)).replace(`HH`,a).replace(`mm`,o).replace(`ss`,s)}return n.toLocaleDateString()}catch{return String(e)}if(t.type===`number`){let n=parseFloat(String(e));return isNaN(n)?String(e):t.numberFormat===`currency`?(t.currencySymbol||`R$`)+` `+n.toFixed(t.decimalPlaces||2):t.numberFormat===`percent`?n.toFixed(t.decimalPlaces||0)+`%`:n.toFixed(t.decimalPlaces||0)}return String(e)},MS=e=>{if(e==null)return!1;let t=String(e).trim();return t?t.startsWith(`http://`)||t.startsWith(`https://`)||t.startsWith(`data:`)||t.startsWith(`/`)||/^[a-zA-Z0-9][a-zA-Z0-9-+.]*:/.test(t):!1},NS=(e,t,n)=>{let r=String(e).toLowerCase(),i=String(n).toLowerCase();switch(t){case`equals`:return r===i;case`notEquals`:return r!==i;case`contains`:return r.includes(i);case`greaterThan`:return parseFloat(r)>parseFloat(i);case`lessThan`:return parseFloat(r)<parseFloat(i);case`truthy`:return!!e;case`falsy`:return!e;default:return!1}},PS=t.default.memo(({element:e,isSelected:n})=>{let{selectElement:i,updateElement:a,updateElements:o,state:s,resizeGroup:c,setSnapLines:l,setPropertiesPanelOpen:u}=rS(),[d,f]=(0,t.useState)(!1),[,p]=(0,t.useState)(!1),[m,h]=(0,t.useState)(!1),g=(0,t.useRef)(null),_=(0,t.useRef)({x:0,y:0}),v=(0,t.useRef)({}),y=(0,t.useRef)(!1),b=(0,t.useRef)(!1),x=(0,t.useRef)(0),S=(0,t.useRef)(0),C=(0,t.useRef)({x:0,y:0}),w=(0,t.useRef)(!1),T=s.canvasHeight||150,E=s.isList?s.mockData.length>0?s.mockData[0]:null:s.singleMockData,D=e.content,O={},k=(e,t)=>{let n=/(rgba?\([^)]+\)|#(?:[0-9a-fA-F]{3,8})|[a-zA-Z]+)\s*$/;return!e||e===`none`?`0 4px 12px 0 ${t}`:n.test(e)?e.replace(n,t):`${e} ${t}`};if(E){if(e.type===`text`||e.type===`text-container`)D=D.replace(/\{\{(.*?)\}\}/g,(t,n)=>{let r=E[n.trim()];return r==null?t:e.formatting?jS(r,e.formatting):String(r)});else if(e.type===`image`)if(e.dataBinding){let t=E[e.dataBinding];t!=null&&(D=String(t))}else D=D.replace(/\{\{(.*?)\}\}/g,(e,t)=>{let n=E[t.trim()];return n==null?e:String(n)});e.styleBindings&&Object.entries(e.styleBindings).forEach(([t,n])=>{let r=E[n];if(r!=null)if(t===`boxShadowColor`){let t=O.boxShadow||e.style?.boxShadow;O={...O,boxShadow:k(t,String(r))}}else O={...O,[t]:String(r)}}),e.conditions&&e.conditions.forEach(e=>{let t=E[e.property];NS(t,e.operator,e.value)&&(O={...O,...e.style})})}let A=O.display===`none`;if(A&&n){let{display:e,...t}=O;O=t}let j=t=>{t.stopPropagation(),!y.current&&!b.current&&!d&&(t.shiftKey?i(e.id,!0):i(e.id,!1))},M=t=>{t.stopPropagation(),e.locked||u(!0)},N=t=>{if(e.locked||t.button!==0)return;t.stopPropagation();let r=t.shiftKey;if(y.current=!1,b.current=!1,e.groupId&&!n){i(e.groupId,r);return}n||(i(e.id,r),b.current=!0),f(!0),_.current={x:t.clientX,y:t.clientY},t.currentTarget.setPointerCapture(t.pointerId);let a=new Set(s.selectedElementIds);n||(r||a.clear(),a.add(e.id));let o={};s.elements.forEach(e=>{a.has(e.id)&&(o[e.id]={x:e.x,y:e.y})}),v.current=o},P=t=>{if(d){let n=s.zoom||1,r=(t.clientX-_.current.x)/n,i=(t.clientY-_.current.y)/n;(Math.abs(r)>2||Math.abs(i)>2)&&(y.current=!0);let a=5/n,c=[],u=Object.entries(v.current).map(([t,n])=>{let o=n.x+r,l=n.y+i;if(s.gridSize>0)o=Math.round(o/s.gridSize)*s.gridSize,l=Math.round(l/s.gridSize)*s.gridSize;else{let n=!1,r=!1,i=e.width??100,u=e.height??100;Object.keys(v.current).length===1&&s.elements.forEach(e=>{if(e.id===t)return;let s=e.width??100,d=e.height??100;n||(Math.abs(o-e.x)<a?(o=e.x,n=!0,c.push({orientation:`vertical`,position:e.x})):Math.abs(o-(e.x+s))<a?(o=e.x+s,n=!0,c.push({orientation:`vertical`,position:e.x+s})):Math.abs(o+i-e.x)<a?(o=e.x-i,n=!0,c.push({orientation:`vertical`,position:e.x})):Math.abs(o+i-(e.x+s))<a&&(o=e.x+s-i,n=!0,c.push({orientation:`vertical`,position:e.x+s}))),r||(Math.abs(l-e.y)<a?(l=e.y,r=!0,c.push({orientation:`horizontal`,position:e.y})):Math.abs(l-(e.y+d))<a?(l=e.y+d,r=!0,c.push({orientation:`horizontal`,position:e.y+d})):Math.abs(l+u-e.y)<a?(l=e.y-u,r=!0,c.push({orientation:`horizontal`,position:e.y})):Math.abs(l+u-(e.y+d))<a&&(l=e.y+d-u,r=!0,c.push({orientation:`horizontal`,position:e.y+d})))})}if(o=Math.max(0,o),s.isList){l=Math.max(0,l);let t=e.height??100;T>0&&(l=Math.min(l,T-t)),l=Math.max(0,l)}return{id:t,changes:{x:o,y:l}}});l&&l(c),o(u,!1)}},ee=e=>{d&&(f(!1),e.currentTarget.releasePointerCapture(e.pointerId),o([],!0),l&&l([]))},F=t=>{t.stopPropagation(),t.preventDefault(),h(!0);let n=t.target.closest(`.resizable-element`);if(n){let r=n.getBoundingClientRect();C.current={x:r.left+r.width/2,y:r.top+r.height/2};let i=t.clientX-C.current.x,a=t.clientY-C.current.y;x.current=Math.atan2(a,i)*(180/Math.PI),S.current=e.rotation||0}};(0,t.useEffect)(()=>{let t=t=>{if(m){let n=t.clientX-C.current.x,r=t.clientY-C.current.y,i=Math.atan2(r,n)*(180/Math.PI)-x.current,o=(S.current+i)%360;a(e.id,{rotation:o},!1)}},n=()=>{m&&(h(!1),a(e.id,{rotation:e.rotation},!0))};return m&&(window.addEventListener(`mousemove`,t),window.addEventListener(`mouseup`,n)),()=>{window.removeEventListener(`mousemove`,t),window.removeEventListener(`mouseup`,n)}},[m,e.id,a,e.rotation]),(0,t.useEffect)(()=>{e.type===`text-container`&&e.autoGrow&&e.containerExpansion===`horizontal`&&requestAnimationFrame(()=>{if(g.current){let t=g.current.scrollWidth;Math.abs(t-(e.width??0))>2&&a(e.id,{width:t},!1)}})},[D,e.autoGrow,e.containerExpansion,e.style,e.width,e.formatting,a,e.id,e.type]);let te={position:`relative`,left:0,top:0,width:`100%`,height:e.autoGrow?`auto`:`100%`,minHeight:e.autoGrow?`100%`:void 0,padding:e.type===`image`||e.type===`text`?0:`8px`,outline:`none`,cursor:d?`grabbing`:`grab`,borderRadius:`var(--radius-2)`,overflow:e.autoGrow?`visible`:`hidden`,whiteSpace:e.autoGrow?`pre-wrap`:void 0,wordBreak:e.autoGrow?`break-word`:void 0,userSelect:`none`,boxSizing:`border-box`,...e.style,...O},[I,ne]=(0,t.useState)(!1);return(0,r.jsx)(ES,{className:`resizable-element`,size:{width:e.width??100,height:e.autoGrow?`auto`:e.height??100},maxHeight:s.isList?Math.max(10,T-e.y):void 0,onResizeStart:e=>{p(!0),w.current=!!e.shiftKey},onResizeStop:(t,n,r,i)=>{p(!1);let o=(e.width??100)+i.width,s=(e.height??100)+i.height,l=e.x??0,u=e.y??0;n.includes(`left`)&&(l-=i.width),n.includes(`top`)&&(u-=i.height),e.type===`group`?(c(e.id,o,s),a(e.id,{x:l,y:u},!0)):a(e.id,{width:o,height:s,x:l,y:u})},handleComponent:{topLeft:(0,r.jsx)(`div`,{className:`resize-handle top-left`,onPointerDown:t=>{t.button===0&&(t.stopPropagation(),i(e.id,t.shiftKey))}}),topRight:(0,r.jsx)(`div`,{className:`resize-handle top-right`,onPointerDown:t=>{t.button===0&&(t.stopPropagation(),i(e.id,t.shiftKey))}}),bottomLeft:(0,r.jsx)(`div`,{className:`resize-handle bottom-left`,onPointerDown:t=>{t.button===0&&(t.stopPropagation(),i(e.id,t.shiftKey))}}),bottomRight:(0,r.jsx)(`div`,{className:`resize-handle bottom-right`,onPointerDown:t=>{t.button===0&&(t.stopPropagation(),i(e.id,t.shiftKey))}}),top:(0,r.jsx)(`div`,{className:`resize-handle top`,onPointerDown:t=>{t.button===0&&(t.stopPropagation(),i(e.id,t.shiftKey))}}),bottom:(0,r.jsx)(`div`,{className:`resize-handle bottom`,onPointerDown:t=>{t.button===0&&(t.stopPropagation(),i(e.id,t.shiftKey))}}),left:(0,r.jsx)(`div`,{className:`resize-handle left`,onPointerDown:t=>{t.button===0&&(t.stopPropagation(),i(e.id,t.shiftKey))}}),right:(0,r.jsx)(`div`,{className:`resize-handle right`,onPointerDown:t=>{t.button===0&&(t.stopPropagation(),i(e.id,t.shiftKey))}})},handleStyles:{topLeft:{width:10,height:10,background:`var(--accent-9)`,borderRadius:`50%`,left:-5,top:-5,zIndex:n?1001:10,opacity:n?1:0},topRight:{width:10,height:10,background:`var(--accent-9)`,borderRadius:`50%`,right:-5,top:-5,zIndex:n?1001:10,opacity:n?1:0},bottomLeft:{width:10,height:10,background:`var(--accent-9)`,borderRadius:`50%`,left:-5,bottom:-5,zIndex:n?1001:10,opacity:n?1:0},bottomRight:{width:10,height:10,background:`var(--accent-9)`,borderRadius:`50%`,right:-5,bottom:-5,zIndex:n?1001:10,opacity:n?1:0},top:{height:6,top:-3,zIndex:n?1e3:9,opacity:n?1:0},bottom:{height:6,bottom:-3,zIndex:n?1e3:9,opacity:n?1:0},left:{width:6,left:-3,zIndex:n?1e3:9,opacity:n?1:0},right:{width:6,right:-3,zIndex:n?1e3:9,opacity:n?1:0}},style:{position:`absolute`,transform:`translate(${e.x??0}px, ${e.y??0}px) rotate(${e.rotation||0}deg)`,height:e.autoGrow?`auto`:void 0,display:A&&!n?`none`:void 0,opacity:A&&n?.4:1,zIndex:n?1e3:e.style?.zIndex===void 0?void 0:Number(e.style.zIndex),outline:`none`,overflow:e.style?.overflow||(e.autoGrow?`visible`:`hidden`)},enable:e.autoGrow?{top:!1,right:!0,bottom:!1,left:!0,topRight:!1,bottomRight:!0,bottomLeft:!1,topLeft:!1}:void 0,lockAspectRatio:w.current,grid:s.gridSize>0?[s.gridSize,s.gridSize]:void 0,children:(0,r.jsxs)(`div`,{style:{width:`100%`,height:`100%`,position:`relative`},onMouseEnter:()=>ne(!0),onMouseLeave:()=>ne(!1),children:[(0,r.jsx)(`div`,{style:{position:`absolute`,top:0,left:0,right:0,bottom:0,pointerEvents:`none`,border:n?`2px solid var(--accent-9)`:I?`1px dashed var(--gray-8)`:`none`,borderRadius:e.style?.borderRadius||`var(--radius-2)`,borderTopLeftRadius:e.style?.borderTopLeftRadius,borderTopRightRadius:e.style?.borderTopRightRadius,borderBottomRightRadius:e.style?.borderBottomRightRadius,borderBottomLeftRadius:e.style?.borderBottomLeftRadius,zIndex:10}}),(0,r.jsxs)(U,{ref:g,style:{...te,...e.type===`text-container`&&{display:`flex`,alignItems:e.style?.alignItems||`flex-start`,justifyContent:e.style?.justifyContent||`flex-start`},zIndex:2,whiteSpace:e.type===`text-container`&&e.autoGrow&&e.containerExpansion===`horizontal`?`nowrap`:te.whiteSpace,width:e.type===`text-container`&&e.autoGrow&&e.containerExpansion===`horizontal`?`max-content`:`100%`,height:e.type===`text-container`&&e.autoGrow&&e.containerExpansion===`vertical`?`auto`:`100%`},onPointerDown:N,onPointerMove:P,onPointerUp:ee,onMouseDown:e=>{e.button===0&&e.stopPropagation()},onClick:j,onDoubleClick:M,title:e.name,onDragOver:e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`copy`},onDrop:t=>{t.preventDefault(),t.stopPropagation();let n=t.dataTransfer.getData(`application/x-editor-prop`);if(n)if(e.type===`text`||e.type===`text-container`){let t=e.content?`${e.content} {{${n}}}`:`{{${n}}}`;a(e.id,{content:t,dataBinding:n})}else e.type===`image`?a(e.id,{dataBinding:n,content:`{{${n}}}`}):e.type===`checkbox`&&a(e.id,{dataBinding:n})},children:[e.type===`text`&&(0,r.jsx)(H,{style:{width:`100%`,height:`100%`},children:D}),e.type===`text-container`&&(0,r.jsx)(H,{style:{width:`100%`,height:`100%`,display:`block`},children:D}),e.type===`image`&&(D&&MS(D)?(0,r.jsx)(`img`,{src:D,alt:`Element`,style:{width:`100%`,height:`100%`,objectFit:e.style?.objectFit||`cover`,display:`block`,pointerEvents:`none`}}):(0,r.jsx)(U,{style:{width:`100%`,height:`100%`,backgroundColor:`#eee`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,r.jsx)(H,{size:`1`,children:D?`URL inválida`:`Imagem Placeholder`})})),e.type===`box`&&(0,r.jsx)(U,{style:{width:`100%`,height:`100%`}}),e.type===`group`&&(0,r.jsx)(U,{style:{width:`100%`,height:`100%`,border:n?`1px dashed var(--accent-9)`:`1px dashed var(--gray-6)`,opacity:.5,pointerEvents:`none`},children:(0,r.jsx)(H,{size:`1`,style:{position:`absolute`,top:0,left:0,backgroundColor:`var(--accent-3)`,color:`var(--accent-11)`,padding:`2px 6px`,fontSize:`10px`,borderBottomRightRadius:`4px`},children:e.name||`Grupo`})})]}),n&&(0,r.jsx)(U,{className:`rotate-handle`,style:{position:`absolute`,top:-30,left:`50%`,transform:`translateX(-50%)`,width:12,height:12,backgroundColor:`var(--accent-9)`,borderRadius:`50%`,cursor:`crosshair`,zIndex:50,boxShadow:`0 0 0 2px white`},onMouseDown:F,onPointerDown:e=>e.stopPropagation(),children:(0,r.jsx)(U,{style:{position:`absolute`,top:12,left:`50%`,width:2,height:18,backgroundColor:`var(--accent-9)`,transform:`translateX(-50%)`}})})]})})}),FS=()=>{let{state:e}=rS(),{snapLines:t}=e;return t.length===0?null:(0,r.jsx)(r.Fragment,{children:t.map((e,t)=>(0,r.jsx)(`div`,{style:{position:`absolute`,left:e.orientation===`vertical`?e.position:0,top:e.orientation===`horizontal`?e.position:0,width:e.orientation===`vertical`?`1px`:`100%`,height:e.orientation===`horizontal`?`1px`:`100%`,backgroundColor:`#ff0000`,zIndex:9999,pointerEvents:`none`,borderLeft:e.orientation===`vertical`?`1px dashed #ff0000`:`none`,borderTop:e.orientation===`horizontal`?`1px dashed #ff0000`:`none`}},t))})},IS=()=>{let{state:e,selectElement:n,setSelectedElements:i,addElement:a,setZoom:o,setPan:s,undo:c,redo:l,copy:u,paste:d,removeSelected:f,updateElements:p}=rS(),m=(0,t.useRef)(null),[h,g]=(0,t.useState)(null),_=(0,t.useRef)(!1),v=(0,t.useRef)(!1),y=(0,t.useRef)(!1),b=(0,t.useRef)({x:0,y:0}),x=(0,t.useRef)({x:0,y:0}),S=(0,t.useRef)([]),C=(0,t.useRef)([]),w=(0,t.useRef)(e),T=(0,t.useRef)(0);(0,t.useEffect)(()=>{w.current=e},[e]);let E=(0,t.useCallback)(e=>{if(!m.current)return;let t=w.current;if(v.current){let n=e.clientX-x.current.x,r=e.clientY-x.current.y;s({x:t.pan.x+n,y:t.pan.y+r}),x.current={x:e.clientX,y:e.clientY};return}if(!_.current)return;let n=m.current.getBoundingClientRect(),r=(e.clientX-n.left-t.pan.x)/t.zoom,a=(e.clientY-n.top-t.pan.y)/t.zoom,o=Math.min(b.current.x,r),c=Math.min(b.current.y,a),l=Math.abs(r-b.current.x),u=Math.abs(a-b.current.y);g({x:o,y:c,width:l,height:u});let d=Date.now();if(!(d-T.current<50)&&(l>0||u>0)){let e=[];t.elements.forEach(t=>{let n=t.x??0,r=t.y??0,i=t.width??100,a=t.height??100,s=n+i,d=r+a,f=o+l,p=c+u;n<f&&s>o&&r<p&&d>c&&e.push(t.id)});let n=Array.from(new Set([...S.current,...e])),r=C.current;r.length===n.length&&r.every(e=>n.includes(e))||(i(n),C.current=n,T.current=d)}},[i,s]),D=(0,t.useCallback)(e=>{(_.current||v.current)&&e.target.releasePointerCapture(e.pointerId),_.current=!1,v.current=!1,g(null)},[]),O=t=>{if(t.button===2)return;let r=t.target;if(r.closest(`.resize-handle`)||r.closest(`.rotate-handle`))return;if(t.currentTarget.setPointerCapture(t.pointerId),t.button===1||t.button===0&&y.current||t.pointerType===`touch`){t.preventDefault(),v.current=!0,x.current={x:t.clientX,y:t.clientY};return}_.current=t.shiftKey;let i=m.current?.getBoundingClientRect();if(!i)return;let a=i.left,o=i.top;b.current={x:(t.clientX-a-e.pan.x)/e.zoom,y:(t.clientY-o-e.pan.y)/e.zoom},S.current=e.selectedElementIds,C.current=e.selectedElementIds,t.shiftKey||(n(null),S.current=[],C.current=[])};(0,t.useEffect)(()=>{let e=e=>{e.preventDefault();let t=w.current;if(e.ctrlKey||e.metaKey)o(Math.min(Math.max(.1,t.zoom-e.deltaY*.001),5));else{let n=e.shiftKey?e.deltaY:e.deltaX,r=e.shiftKey?e.deltaX:e.deltaY;s({x:t.pan.x-n*1,y:t.pan.y-r*1})}},t=m.current;return t&&t.addEventListener(`wheel`,e,{passive:!1}),()=>{t&&t.removeEventListener(`wheel`,e)}},[o,s]),(0,t.useEffect)(()=>{let t=t=>{if(t.code===`Space`&&!t.repeat&&!(t.target instanceof HTMLInputElement||t.target instanceof HTMLTextAreaElement)&&(y.current=!0,m.current&&(m.current.style.cursor=`grab`)),!(t.target instanceof HTMLInputElement||t.target instanceof HTMLTextAreaElement)&&((t.ctrlKey||t.metaKey)&&t.key.toLowerCase()===`z`&&(t.preventDefault(),t.shiftKey?l():c()),(t.ctrlKey||t.metaKey)&&t.key.toLowerCase()===`y`&&(t.preventDefault(),l()),(t.ctrlKey||t.metaKey)&&t.key.toLowerCase()===`c`&&(t.preventDefault(),u()),(t.ctrlKey||t.metaKey)&&t.key.toLowerCase()===`v`&&(t.preventDefault(),d()),(t.key===`Delete`||t.key===`Backspace`)&&(t.preventDefault(),f()),[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`].includes(t.key))){t.preventDefault();let n=t.shiftKey?10:1,r=[];e.selectedElementIds.forEach(i=>{let a=e.elements.find(e=>e.id===i);if(a){let{x:o=0,y:s=0}=a;if(t.key===`ArrowUp`&&(s-=n),t.key===`ArrowDown`&&(s+=n),t.key===`ArrowLeft`&&(o-=n),t.key===`ArrowRight`&&(o+=n),o=Math.max(0,o),e.isList){s=Math.max(0,s);let t=a.height??100,n=e.canvasHeight||150;n>0&&(s=Math.min(s,n-t)),s=Math.max(0,s)}r.push({id:i,changes:{x:o,y:s}})}}),r.length>0&&p(r)}},n=e=>{e.code===`Space`&&(y.current=!1,m.current&&!v.current&&(m.current.style.cursor=`default`))};return window.addEventListener(`keydown`,t),window.addEventListener(`keyup`,n),()=>{window.removeEventListener(`keydown`,t),window.removeEventListener(`keyup`,n)}},[c,l,u,d,f,p,e.selectedElementIds,e.elements]);let k=(0,t.useRef)(!1),{setCanvasHeight:A}=rS(),j=e=>{e.stopPropagation(),e.preventDefault(),k.current=!0,window.addEventListener(`mousemove`,M),window.addEventListener(`mouseup`,N)},M=(0,t.useCallback)(e=>{if(!k.current||!m.current)return;let t=m.current.getBoundingClientRect(),n=e.clientY-t.top,r=Math.max(50,Math.min(n,2e3));A(Math.round(r))},[A]),N=(0,t.useCallback)(()=>{k.current=!1,window.removeEventListener(`mousemove`,M),window.removeEventListener(`mouseup`,N)},[M]);(0,t.useEffect)(()=>()=>{window.removeEventListener(`mousemove`,M),window.removeEventListener(`mouseup`,N)},[M,N]);let P=e=>{e.preventDefault(),e.dataTransfer.dropEffect=`copy`},ee=t=>{t.preventDefault();let n=t.currentTarget.getBoundingClientRect(),r=(t.clientX-n.left-e.pan.x)/e.zoom,i=(t.clientY-n.top-e.pan.y)/e.zoom,o=t.dataTransfer.getData(`application/x-editor-prop`);if(o){a({type:`text`,content:`{{${o}}}`,x:r,y:i,width:150,height:30,dataBinding:o});return}let s=t.dataTransfer.getData(`application/x-editor-asset`);if(s)try{let e=JSON.parse(s);a({type:`image`,name:e.name,content:e.url,x:r,y:i,width:e.width||200,height:e.height||200})}catch(e){console.error(`Failed to parse asset`,e)}},F=e.canvasHeight||150;return(0,r.jsxs)(U,{ref:m,onPointerDown:O,onPointerMove:e=>{(_.current||v.current)&&E(e.nativeEvent)},onPointerUp:e=>{(_.current||v.current)&&D(e.nativeEvent)},onDragOver:P,onDrop:ee,style:{width:`100%`,height:`100%`,position:`relative`,overflow:`hidden`,backgroundColor:`var(--gray-1)`,cursor:v.current?`grabbing`:`default`,backgroundImage:`radial-gradient(var(--gray-5) 1px, transparent 1px)`,backgroundSize:`${20*e.zoom}px ${20*e.zoom}px`,backgroundPosition:`${e.pan.x}px ${e.pan.y}px`},children:[(0,r.jsxs)(`div`,{style:{transform:`translate(${e.pan.x}px, ${e.pan.y}px) scale(${e.zoom})`,transformOrigin:`0 0`,width:`100%`,height:`100%`,position:`absolute`,top:0,left:0,pointerEvents:`none`},children:[(0,r.jsx)(`div`,{style:{position:`absolute`,top:0,left:0,width:`100%`,height:`1px`,borderTop:`1px dashed var(--accent-9)`,opacity:.6,zIndex:5,pointerEvents:`none`},children:(0,r.jsx)(`span`,{style:{position:`absolute`,top:-16,left:4,fontSize:`10px`,color:`var(--accent-9)`,fontWeight:500},children:`Início (0px)`})}),e.elements.filter(e=>!e.hidden).map(t=>(0,r.jsx)(`div`,{style:{pointerEvents:`auto`},children:(0,r.jsx)(PS,{element:t,isSelected:e.selectedElementIds.includes(t.id)})},t.id)),(0,r.jsx)(FS,{}),h&&(0,r.jsx)(`div`,{style:{position:`absolute`,left:h.x,top:h.y,width:h.width,height:h.height,backgroundColor:`rgba(0, 120, 255, 0.2)`,border:`1px solid rgba(0, 120, 255, 0.8)`,pointerEvents:`none`,zIndex:999999}}),e.isList&&(0,r.jsxs)(`div`,{style:{position:`absolute`,top:F,left:0,right:0,height:`10px`,marginTop:`-5px`,cursor:`ns-resize`,zIndex:100,display:`flex`,alignItems:`center`,justifyContent:`center`},onMouseDown:j,children:[(0,r.jsx)(`div`,{style:{width:`100%`,height:`2px`,backgroundColor:`var(--accent-9)`,borderBottom:`none`,opacity:.8,boxShadow:`0 1px 4px rgba(0,0,0,0.2)`}}),(0,r.jsxs)(`div`,{style:{position:`absolute`,right:10,top:-20,backgroundColor:`var(--accent-9)`,color:`white`,fontSize:`11px`,padding:`2px 6px`,borderRadius:`4px`,fontWeight:500,pointerEvents:`none`,boxShadow:`0 2px 5px rgba(0,0,0,0.1)`},children:[`Altura do Item: `,F,`px`]})]})]}),e.elements.length===0&&(0,r.jsx)(W,{align:`center`,justify:`center`,style:{position:`absolute`,inset:0,pointerEvents:`none`},children:(0,r.jsxs)(U,{style:{backgroundColor:`var(--gray-2)`,border:`1px solid var(--gray-4)`,borderRadius:12,padding:16,maxWidth:320,textAlign:`center`,boxShadow:`0 6px 20px rgba(0,0,0,0.08)`},children:[(0,r.jsx)(H,{size:`3`,weight:`bold`,children:`Comece adicionando um elemento`}),(0,r.jsx)(H,{size:`2`,color:`gray`,as:`div`,mt:`2`,children:`Depois, arraste para mover e use os cantos para redimensionar.`}),(0,r.jsx)(H,{size:`1`,color:`gray`,as:`div`,mt:`2`,children:`Dica: clique com o botão direito para mais opções.`})]})}),h&&(0,r.jsx)(`div`,{style:{position:`absolute`,top:0,left:0,width:`100%`,height:`100%`,zIndex:999995,pointerEvents:`auto`}})]})},LS=({onSave:e,templates:n,setIsTemplatesOpen:i,onFinish:a,onToggleSidebar:o})=>{let{state:s,loadState:c,addElement:l}=rS(),u=(0,t.useRef)(null),d=()=>{let e={elements:s.elements,isList:s.isList,mockData:s.mockData,singleMockData:s.singleMockData,listSettings:s.listSettings,canvasHeight:s.canvasHeight,gridSize:s.gridSize},t=JSON.stringify(e,null,2),n=new Blob([t],{type:`application/json`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`layout-${new Date().toISOString().slice(0,10)}.json`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r)},f=()=>{u.current?.click()},p=e=>{let t=e.target.files?.[0];if(!t)return;let n=new FileReader;n.onload=e=>{try{let t=e.target?.result;c(JSON.parse(t))}catch(e){console.error(`Failed to import layout`,e),alert(`Erro ao importar layout. Arquivo inválido.`)}},n.readAsText(t),e.target.value=``},m=()=>{if(e){let t={elements:s.elements,isList:s.isList,mockData:s.mockData,singleMockData:s.singleMockData,listSettings:s.listSettings,canvasHeight:s.canvasHeight};e(JSON.stringify(t,null,2))}},h=e=>{l({type:e,content:`New ${e}`})};return(0,r.jsxs)(W,{justify:`between`,align:`center`,px:`4`,py:`3`,style:{borderBottom:`1px solid var(--gray-5)`,backgroundColor:`var(--gray-1)`,flexShrink:0,zIndex:100},children:[(0,r.jsxs)(W,{gap:`4`,align:`center`,children:[o&&(0,r.jsx)(U,{display:{initial:`block`,md:`none`},children:(0,r.jsx)(J,{variant:`ghost`,color:`gray`,onClick:o,children:(0,r.jsx)(Qe,{width:`24`,height:`24`})})}),(0,r.jsx)(H,{size:`3`,weight:`bold`,children:`Editor de Layout`})]}),(0,r.jsxs)(W,{gap:`3`,align:`center`,children:[(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`solid`,color:`green`,style:{cursor:`pointer`},children:[(0,r.jsx)(mt,{}),` Adicionar`]})}),(0,r.jsxs)(fy,{children:[(0,r.jsx)(q,{onSelect:()=>h(`text`),children:`Texto`}),(0,r.jsx)(q,{onSelect:()=>h(`image`),children:`Imagem`}),(0,r.jsx)(q,{onSelect:()=>h(`box`),children:`Container / Grupo`}),(0,r.jsx)(q,{onSelect:()=>h(`text-container`),children:`Container com Texto`})]})]}),(0,r.jsxs)(G,{variant:`soft`,color:`gray`,onClick:f,style:{cursor:`pointer`},children:[(0,r.jsx)(en,{}),` Importar`]}),(0,r.jsx)(`input`,{type:`file`,ref:u,style:{display:`none`},accept:`.json`,onChange:p}),(0,r.jsxs)(G,{variant:`soft`,color:`gray`,onClick:d,style:{cursor:`pointer`},children:[(0,r.jsx)(Ie,{}),` Exportar`]}),n&&n.length>0&&(0,r.jsxs)(G,{variant:`soft`,color:`gray`,onClick:()=>i(!0),style:{cursor:`pointer`},children:[(0,r.jsx)(We,{}),` Templates`]}),a&&(0,r.jsxs)(G,{id:`finish-button`,variant:`solid`,color:`green`,onClick:a,style:{cursor:`pointer`,marginLeft:8},children:[(0,r.jsx)(ge,{}),` Finalizar e Testar`]}),(0,r.jsxs)(G,{variant:`solid`,color:`blue`,onClick:m,style:{cursor:`pointer`},children:[(0,r.jsx)(bt,{}),` Salvar`]})]})]})},RS=()=>{let{state:e}=rS(),{elements:t,zoom:n,pan:i}=e,a=(()=>{if(t.length===0)return{minX:0,minY:0,maxX:1e3,maxY:1e3};let e=1/0,n=1/0,r=-1/0,i=-1/0;return t.forEach(t=>{e=Math.min(e,t.x),n=Math.min(n,t.y),r=Math.max(r,t.x+t.width),i=Math.max(i,t.y+t.height)}),{minX:e-100,minY:n-100,maxX:r+100,maxY:i+100,width:r-e+200,height:i-n+200}})(),o=window.innerWidth/n,s=window.innerHeight/n,c=-i.x/n,l=-i.y/n;return(0,r.jsx)(U,{style:{position:`absolute`,bottom:20,right:20,width:150,height:150,backgroundColor:`rgba(255, 255, 255, 0.9)`,border:`1px solid var(--gray-6)`,borderRadius:8,overflow:`hidden`,boxShadow:`0 4px 12px rgba(0,0,0,0.1)`,zIndex:100},children:(0,r.jsxs)(`div`,{style:{position:`relative`,width:`100%`,height:`100%`,transform:`scale(0.1) translate(${-a.minX}px, ${-a.minY}px)`,transformOrigin:`top left`},children:[t.filter(e=>!e.hidden).map(e=>(0,r.jsx)(`div`,{style:{position:`absolute`,left:e.x,top:e.y,width:e.width,height:e.height,backgroundColor:`var(--accent-9)`,opacity:.5,border:`1px solid var(--accent-11)`}},e.id)),(0,r.jsx)(`div`,{style:{position:`absolute`,left:c,top:l,width:o,height:s,border:`20px solid rgba(0, 0, 0, 0.2)`,pointerEvents:`none`}})]})})};var zS=[{targetId:`sidebar-area`,title:`Biblioteca de Blocos`,content:`Arraste ou clique nos blocos para adicionar ao layout. Aqui você também gerencia o conteúdo.`,position:`right`},{targetId:`canvas-area`,title:`Área de Criação`,content:`Seu espaço de trabalho. Mova, redimensione e organize os elementos livremente.`,position:`center`},{targetId:`preview-area`,title:`Visualização Real`,content:`Confira o resultado final com dados reais enquanto edita. O que você vê é o que será exportado.`,position:`left`},{targetId:`finish-button`,title:`Finalizar e Testar`,content:`Pronto? Clique aqui para testar com mais dados e exportar seu layout.`,position:`bottom`}];let BS=({isOpen:e,onClose:n})=>{let[i,a]=(0,t.useState)(0),[o,s]=(0,t.useState)(null);if((0,t.useEffect)(()=>{if(!e)return;let t=zS[i],n=document.getElementById(t.targetId);if(n){let e=n.getBoundingClientRect(),r=0,i=0;switch(t.position){case`right`:r=e.top+e.height/2-100,i=e.right+20;break;case`left`:r=e.top+e.height/2-100,i=e.left-320-20;break;case`bottom`:r=e.bottom+20,i=e.left+e.width/2-160;break;case`top`:r=e.top-200-20,i=e.left+e.width/2-160;break;case`center`:r=window.innerHeight/2-100,i=window.innerWidth/2-160;break}i<20&&(i=20),r<20&&(r=20),i+320>window.innerWidth&&(i=window.innerWidth-340),r+200>window.innerHeight&&(r=window.innerHeight-220),s({top:r,left:i})}else s({top:window.innerHeight/2-100,left:window.innerWidth/2-160})},[e,i]),!e||!o)return null;let c=zS[i],l=i===zS.length-1;return(0,r.jsx)(U,{style:{position:`fixed`,top:0,left:0,width:`100vw`,height:`100vh`,zIndex:9999,pointerEvents:`none`},children:(0,r.jsx)(Ev,{style:{position:`absolute`,top:o.top,left:o.left,width:320,pointerEvents:`auto`,boxShadow:`0 10px 30px rgba(0,0,0,0.2), 0 0 0 2px var(--accent-9)`,backgroundColor:`var(--color-panel-solid)`,transition:`all 0.3s ease-out`},children:(0,r.jsxs)(W,{direction:`column`,gap:`3`,children:[(0,r.jsxs)(W,{justify:`between`,align:`center`,children:[(0,r.jsx)(m_,{size:`3`,color:`blue`,children:c.title}),(0,r.jsx)(G,{variant:`ghost`,color:`gray`,onClick:n,size:`1`,style:{cursor:`pointer`},children:(0,r.jsx)(Ee,{})})]}),(0,r.jsx)(H,{size:`2`,color:`gray`,children:c.content}),(0,r.jsxs)(W,{justify:`between`,align:`center`,mt:`2`,children:[(0,r.jsxs)(H,{size:`1`,color:`gray`,children:[i+1,` de `,zS.length]}),(0,r.jsxs)(W,{gap:`2`,children:[i>0&&(0,r.jsx)(G,{variant:`soft`,color:`gray`,onClick:()=>a(e=>e-1),style:{cursor:`pointer`},children:`Voltar`}),(0,r.jsx)(G,{onClick:()=>{l?n():a(e=>e+1)},style:{cursor:`pointer`},children:l?`Entendi!`:`Próximo`})]})]})]})})})};var VS=(0,t.createContext)({});function HS(e){let n=(0,t.useRef)(null);return n.current===null&&(n.current=e()),n.current}var US=typeof window<`u`,WS=US?t.useLayoutEffect:t.useEffect,GS=(0,t.createContext)(null);function KS(e,t){e.indexOf(t)===-1&&e.push(t)}function qS(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}var JS=(e,t,n)=>n>t?t:n<e?e:n;function YS(e,t){return t?`${e}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${t}`:e}var XS=()=>{},ZS=()=>{};typeof process<`u`&&process.env.NODE_ENV!==`production`&&(XS=(e,t,n)=>{!e&&typeof console<`u`&&console.warn(YS(t,n))},ZS=(e,t,n)=>{if(!e)throw Error(YS(t,n))});var QS={},$S=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function eC(e){return typeof e==`object`&&!!e}var tC=e=>/^0[^.\s]+$/u.test(e);function nC(e){let t;return()=>(t===void 0&&(t=e()),t)}var rC=e=>e,iC=(e,t)=>n=>t(e(n)),aC=(...e)=>e.reduce(iC),oC=(e,t,n)=>{let r=t-e;return r===0?1:(n-e)/r},sC=class{constructor(){this.subscriptions=[]}add(e){return KS(this.subscriptions,e),()=>qS(this.subscriptions,e)}notify(e,t,n){let r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,t,n);else for(let i=0;i<r;i++){let r=this.subscriptions[i];r&&r(e,t,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}},cC=e=>e*1e3,lC=e=>e/1e3;function uC(e,t){return t?e*(1e3/t):0}var dC=new Set;function fC(e,t,n){e||dC.has(t)||(console.warn(YS(t,n)),dC.add(t))}var pC=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,mC=1e-7,hC=12;function gC(e,t,n,r,i){let a,o,s=0;do o=t+(n-t)/2,a=pC(o,r,i)-e,a>0?n=o:t=o;while(Math.abs(a)>mC&&++s<hC);return o}function _C(e,t,n,r){if(e===t&&n===r)return rC;let i=t=>gC(t,0,1,e,n);return e=>e===0||e===1?e:pC(i(e),t,r)}var vC=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,yC=e=>t=>1-e(1-t),bC=_C(.33,1.53,.69,.99),xC=yC(bC),SC=vC(xC),CC=e=>(e*=2)<1?.5*xC(e):.5*(2-2**(-10*(e-1))),wC=e=>1-Math.sin(Math.acos(e)),TC=yC(wC),EC=vC(wC),DC=_C(.42,0,1,1),OC=_C(0,0,.58,1),kC=_C(.42,0,.58,1),AC=e=>Array.isArray(e)&&typeof e[0]!=`number`,jC=e=>Array.isArray(e)&&typeof e[0]==`number`,MC={linear:rC,easeIn:DC,easeInOut:kC,easeOut:OC,circIn:wC,circInOut:EC,circOut:TC,backIn:xC,backInOut:SC,backOut:bC,anticipate:CC},NC=e=>typeof e==`string`,PC=e=>{if(jC(e)){ZS(e.length===4,`Cubic bezier arrays must contain four numerical values.`,`cubic-bezier-length`);let[t,n,r,i]=e;return _C(t,n,r,i)}else if(NC(e))return ZS(MC[e]!==void 0,`Invalid easing type '${e}'`,`invalid-easing-type`),MC[e];return e},FC=[`setup`,`read`,`resolveKeyframes`,`preUpdate`,`update`,`preRender`,`render`,`postRender`],IC={value:null,addProjectionMetrics:null};function LC(e,t){let n=new Set,r=new Set,i=!1,a=!1,o=new WeakSet,s={delta:0,timestamp:0,isProcessing:!1},c=0;function l(t){o.has(t)&&(u.schedule(t),e()),c++,t(s)}let u={schedule:(e,t=!1,a=!1)=>{let s=a&&i?n:r;return t&&o.add(e),s.has(e)||s.add(e),e},cancel:e=>{r.delete(e),o.delete(e)},process:e=>{if(s=e,i){a=!0;return}i=!0,[n,r]=[r,n],n.forEach(l),t&&IC.value&&IC.value.frameloop[t].push(c),c=0,n.clear(),i=!1,a&&(a=!1,u.process(e))}};return u}var RC=40;function zC(e,t){let n=!1,r=!0,i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=FC.reduce((e,n)=>(e[n]=LC(a,t?n:void 0),e),{}),{setup:s,read:c,resolveKeyframes:l,preUpdate:u,update:d,preRender:f,render:p,postRender:m}=o,h=()=>{let a=QS.useManualTiming?i.timestamp:performance.now();n=!1,QS.useManualTiming||(i.delta=r?1e3/60:Math.max(Math.min(a-i.timestamp,RC),1)),i.timestamp=a,i.isProcessing=!0,s.process(i),c.process(i),l.process(i),u.process(i),d.process(i),f.process(i),p.process(i),m.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(h))},g=()=>{n=!0,r=!0,i.isProcessing||e(h)};return{schedule:FC.reduce((e,t)=>{let r=o[t];return e[t]=(e,t=!1,i=!1)=>(n||g(),r.schedule(e,t,i)),e},{}),cancel:e=>{for(let t=0;t<FC.length;t++)o[FC[t]].cancel(e)},state:i,steps:o}}var{schedule:BC,cancel:VC,state:HC,steps:UC}=zC(typeof requestAnimationFrame<`u`?requestAnimationFrame:rC,!0),WC;function GC(){WC=void 0}var KC={now:()=>(WC===void 0&&KC.set(HC.isProcessing||QS.useManualTiming?HC.timestamp:performance.now()),WC),set:e=>{WC=e,queueMicrotask(GC)}},qC={layout:0,mainThread:0,waapi:0},JC=e=>t=>typeof t==`string`&&t.startsWith(e),YC=JC(`--`),XC=JC(`var(--`),ZC=e=>XC(e)?QC.test(e.split(`/*`)[0].trim()):!1,QC=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function $C(e){return typeof e==`string`?e.split(`/*`)[0].includes(`var(--`):!1}var ew={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},tw={...ew,transform:e=>JS(0,1,e)},nw={...ew,default:1},rw=e=>Math.round(e*1e5)/1e5,iw=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function aw(e){return e==null}var ow=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,sw=(e,t)=>n=>!!(typeof n==`string`&&ow.test(n)&&n.startsWith(e)||t&&!aw(n)&&Object.prototype.hasOwnProperty.call(n,t)),cw=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(iw);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},lw=e=>JS(0,255,e),uw={...ew,transform:e=>Math.round(lw(e))},dw={test:sw(`rgb`,`red`),parse:cw(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+uw.transform(e)+`, `+uw.transform(t)+`, `+uw.transform(n)+`, `+rw(tw.transform(r))+`)`};function fw(e){let t=``,n=``,r=``,i=``;return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}var pw={test:sw(`#`),parse:fw,transform:dw.transform},mw=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),hw=mw(`deg`),gw=mw(`%`),Q=mw(`px`),_w=mw(`vh`),vw=mw(`vw`),yw=(()=>({...gw,parse:e=>gw.parse(e)/100,transform:e=>gw.transform(e*100)}))(),bw={test:sw(`hsl`,`hue`),parse:cw(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+gw.transform(rw(t))+`, `+gw.transform(rw(n))+`, `+rw(tw.transform(r))+`)`},xw={test:e=>dw.test(e)||pw.test(e)||bw.test(e),parse:e=>dw.test(e)?dw.parse(e):bw.test(e)?bw.parse(e):pw.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?dw.transform(e):bw.transform(e),getAnimatableNone:e=>{let t=xw.parse(e);return t.alpha=0,xw.transform(t)}},Sw=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Cw(e){return isNaN(e)&&typeof e==`string`&&(e.match(iw)?.length||0)+(e.match(Sw)?.length||0)>0}var ww=`number`,Tw=`color`,Ew=`var`,Dw=`var(`,Ow="${}",kw=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Aw(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(kw,e=>(xw.test(e)?(r.color.push(a),i.push(Tw),n.push(xw.parse(e))):e.startsWith(Dw)?(r.var.push(a),i.push(Ew),n.push(e)):(r.number.push(a),i.push(ww),n.push(parseFloat(e))),++a,Ow)).split(Ow),indexes:r,types:i}}function jw(e){return Aw(e).values}function Mw(e){let{split:t,types:n}=Aw(e),r=t.length;return e=>{let i=``;for(let a=0;a<r;a++)if(i+=t[a],e[a]!==void 0){let t=n[a];t===ww?i+=rw(e[a]):t===Tw?i+=xw.transform(e[a]):i+=e[a]}return i}}var Nw=e=>typeof e==`number`?0:xw.test(e)?xw.getAnimatableNone(e):e;function Pw(e){let t=jw(e);return Mw(e)(t.map(Nw))}var Fw={test:Cw,parse:jw,createTransformer:Mw,getAnimatableNone:Pw};function Iw(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function Lw({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,a=0,o=0;if(!t)i=a=o=n;else{let r=n<.5?n*(1+t):n+t-n*t,s=2*n-r;i=Iw(s,r,e+1/3),a=Iw(s,r,e),o=Iw(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function Rw(e,t){return n=>n>0?t:e}var zw=(e,t,n)=>e+(t-e)*n,Bw=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},Vw=[pw,dw,bw],Hw=e=>Vw.find(t=>t.test(e));function Uw(e){let t=Hw(e);if(XS(!!t,`'${e}' is not an animatable color. Use the equivalent color code instead.`,`color-not-animatable`),!t)return!1;let n=t.parse(e);return t===bw&&(n=Lw(n)),n}var Ww=(e,t)=>{let n=Uw(e),r=Uw(t);if(!n||!r)return Rw(e,t);let i={...n};return e=>(i.red=Bw(n.red,r.red,e),i.green=Bw(n.green,r.green,e),i.blue=Bw(n.blue,r.blue,e),i.alpha=zw(n.alpha,r.alpha,e),dw.transform(i))},Gw=new Set([`none`,`hidden`]);function Kw(e,t){return Gw.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function qw(e,t){return n=>zw(e,t,n)}function Jw(e){return typeof e==`number`?qw:typeof e==`string`?ZC(e)?Rw:xw.test(e)?Ww:Qw:Array.isArray(e)?Yw:typeof e==`object`?xw.test(e)?Ww:Xw:Rw}function Yw(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>Jw(e)(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=i[t](e);return n}}function Xw(e,t){let n={...e,...t},r={};for(let i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=Jw(e[i])(e[i],t[i]));return e=>{for(let t in r)n[t]=r[t](e);return n}}function Zw(e,t){let n=[],r={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){let a=t.types[i],o=e.indexes[a][r[a]];n[i]=e.values[o]??0,r[a]++}return n}var Qw=(e,t)=>{let n=Fw.createTransformer(t),r=Aw(e),i=Aw(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?Gw.has(e)&&!i.values.length||Gw.has(t)&&!r.values.length?Kw(e,t):aC(Yw(Zw(r,i),i.values),n):(XS(!0,`Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,`complex-values-different`),Rw(e,t))};function $w(e,t,n){return typeof e==`number`&&typeof t==`number`&&typeof n==`number`?zw(e,t,n):Jw(e)(e,t)}var eT=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>BC.update(t,e),stop:()=>VC(t),now:()=>HC.isProcessing?HC.timestamp:KC.now()}},tT=(e,t,n=10)=>{let r=``,i=Math.max(Math.round(t/n),2);for(let t=0;t<i;t++)r+=Math.round(e(t/(i-1))*1e4)/1e4+`, `;return`linear(${r.substring(0,r.length-2)})`},nT=2e4;function rT(e){let t=0,n=e.next(t);for(;!n.done&&t<2e4;)t+=50,n=e.next(t);return t>=2e4?1/0:t}function iT(e,t=100,n){let r=n({...e,keyframes:[0,t]}),i=Math.min(rT(r),nT);return{type:`keyframes`,ease:e=>r.next(i*e).value/t,duration:lC(i)}}var aT=5;function oT(e,t,n){let r=Math.max(t-aT,0);return uC(n-e(r),t-r)}var sT={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},cT=.001;function lT({duration:e=sT.duration,bounce:t=sT.bounce,velocity:n=sT.velocity,mass:r=sT.mass}){let i,a;XS(e<=cC(sT.maxDuration),`Spring duration must be 10 seconds or less`,`spring-duration-limit`);let o=1-t;o=JS(sT.minDamping,sT.maxDamping,o),e=JS(sT.minDuration,sT.maxDuration,lC(e)),o<1?(i=t=>{let r=t*o,i=r*e,a=r-n,s=fT(t,o),c=Math.exp(-i);return cT-a/s*c},a=t=>{let r=t*o*e,a=r*n+n,s=o**2*t**2*e,c=Math.exp(-r),l=fT(t**2,o);return(-i(t)+cT>0?-1:1)*((a-s)*c)/l}):(i=t=>{let r=Math.exp(-t*e),i=(t-n)*e+1;return-cT+r*i},a=t=>Math.exp(-t*e)*((n-t)*(e*e)));let s=5/e,c=dT(i,a,s);if(e=cC(e),isNaN(c))return{stiffness:sT.stiffness,damping:sT.damping,duration:e};{let t=c**2*r;return{stiffness:t,damping:o*2*Math.sqrt(r*t),duration:e}}}var uT=12;function dT(e,t,n){let r=n;for(let n=1;n<uT;n++)r-=e(r)/t(r);return r}function fT(e,t){return e*Math.sqrt(1-t*t)}var pT=[`duration`,`bounce`],mT=[`stiffness`,`damping`,`mass`];function hT(e,t){return t.some(t=>e[t]!==void 0)}function gT(e){let t={velocity:sT.velocity,stiffness:sT.stiffness,damping:sT.damping,mass:sT.mass,isResolvedFromDuration:!1,...e};if(!hT(e,mT)&&hT(e,pT))if(e.visualDuration){let n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,a=2*JS(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:sT.mass,stiffness:i,damping:a}}else{let n=lT(e);t={...t,...n,mass:sT.mass},t.isResolvedFromDuration=!0}return t}function _T(e=sT.visualDuration,t=sT.bounce){let n=typeof e==`object`?e:{visualDuration:e,keyframes:[0,1],bounce:t},{restSpeed:r,restDelta:i}=n,a=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],s={done:!1,value:a},{stiffness:c,damping:l,mass:u,duration:d,velocity:f,isResolvedFromDuration:p}=gT({...n,velocity:-lC(n.velocity||0)}),m=f||0,h=l/(2*Math.sqrt(c*u)),g=o-a,_=lC(Math.sqrt(c/u)),v=Math.abs(g)<5;r||=v?sT.restSpeed.granular:sT.restSpeed.default,i||=v?sT.restDelta.granular:sT.restDelta.default;let y;if(h<1){let e=fT(_,h);y=t=>o-Math.exp(-h*_*t)*((m+h*_*g)/e*Math.sin(e*t)+g*Math.cos(e*t))}else if(h===1)y=e=>o-Math.exp(-_*e)*(g+(m+_*g)*e);else{let e=_*Math.sqrt(h*h-1);y=t=>{let n=Math.exp(-h*_*t),r=Math.min(e*t,300);return o-n*((m+h*_*g)*Math.sinh(r)+e*g*Math.cosh(r))/e}}let b={calculatedDuration:p&&d||null,next:e=>{let t=y(e);if(p)s.done=e>=d;else{let n=e===0?m:0;h<1&&(n=e===0?cC(m):oT(y,e,t));let a=Math.abs(n)<=r,c=Math.abs(o-t)<=i;s.done=a&&c}return s.value=s.done?o:t,s},toString:()=>{let e=Math.min(rT(b),nT),t=tT(t=>b.next(e*t).value,e,30);return e+`ms `+t},toTransition:()=>{}};return b}_T.applyToOptions=e=>{let t=iT(e,100,_T);return e.ease=t.ease,e.duration=cC(t.duration),e.type=`keyframes`,e};function vT({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:o,min:s,max:c,restDelta:l=.5,restSpeed:u}){let d=e[0],f={done:!1,value:d},p=e=>s!==void 0&&e<s||c!==void 0&&e>c,m=e=>s===void 0?c:c===void 0||Math.abs(s-e)<Math.abs(c-e)?s:c,h=n*t,g=d+h,_=o===void 0?g:o(g);_!==g&&(h=_-d);let v=e=>-h*Math.exp(-e/r),y=e=>_+v(e),b=e=>{let t=v(e),n=y(e);f.done=Math.abs(t)<=l,f.value=f.done?_:n},x,S,C=e=>{p(f.value)&&(x=e,S=_T({keyframes:[f.value,m(f.value)],velocity:oT(y,e,f.value),damping:i,stiffness:a,restDelta:l,restSpeed:u}))};return C(0),{calculatedDuration:null,next:e=>{let t=!1;return!S&&x===void 0&&(t=!0,b(e),C(e)),x!==void 0&&e>=x?S.next(e-x):(!t&&b(e),f)}}}function yT(e,t,n){let r=[],i=n||QS.mix||$w,a=e.length-1;for(let n=0;n<a;n++){let a=i(e[n],e[n+1]);t&&(a=aC(Array.isArray(t)?t[n]||rC:t,a)),r.push(a)}return r}function bT(e,t,{clamp:n=!0,ease:r,mixer:i}={}){let a=e.length;if(ZS(a===t.length,`Both input and output ranges must be the same length`,`range-length`),a===1)return()=>t[0];if(a===2&&t[0]===t[1])return()=>t[1];let o=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());let s=yT(t,r,i),c=s.length,l=n=>{if(o&&n<e[0])return t[0];let r=0;if(c>1)for(;r<e.length-2&&!(n<e[r+1]);r++);let i=oC(e[r],e[r+1],n);return s[r](i)};return n?t=>l(JS(e[0],e[a-1],t)):l}function xT(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=oC(0,t,r);e.push(zw(n,1,i))}}function ST(e){let t=[0];return xT(t,e.length-1),t}function CT(e,t){return e.map(e=>e*t)}function wT(e,t){return e.map(()=>t||kC).splice(0,e.length-1)}function TT({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`}){let i=AC(r)?r.map(PC):PC(r),a={done:!1,value:t[0]},o=bT(CT(n&&n.length===t.length?n:ST(t),e),t,{ease:Array.isArray(i)?i:wT(t,i)});return{calculatedDuration:e,next:t=>(a.value=o(t),a.done=t>=e,a)}}var ET=e=>e!==null;function DT(e,{repeat:t,repeatType:n=`loop`},r,i=1){let a=e.filter(ET),o=i<0||t&&n!==`loop`&&t%2==1?0:a.length-1;return!o||r===void 0?a[o]:r}var OT={decay:vT,inertia:vT,tween:TT,keyframes:TT,spring:_T};function kT(e){typeof e.type==`string`&&(e.type=OT[e.type])}var AT=class{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}},jT=e=>e/100,MT=class extends AT{constructor(e){super(),this.state=`idle`,this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{let{motionValue:e}=this.options;e&&e.updatedAt!==KC.now()&&this.tick(KC.now()),this.isStopped=!0,this.state!==`idle`&&(this.teardown(),this.options.onStop?.())},qC.mainThread++,this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){let{options:e}=this;kT(e);let{type:t=TT,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=e,{keyframes:o}=e,s=t||TT;process.env.NODE_ENV!==`production`&&s!==TT&&ZS(o.length<=2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${o}`,`spring-two-frames`),s!==TT&&typeof o[0]!=`number`&&(this.mixKeyframes=aC(jT,$w(o[0],o[1])),o=[0,100]);let c=s({...e,keyframes:o});i===`mirror`&&(this.mirroredGenerator=s({...e,keyframes:[...o].reverse(),velocity:-a})),c.calculatedDuration===null&&(c.calculatedDuration=rT(c));let{calculatedDuration:l}=c;this.calculatedDuration=l,this.resolvedDuration=l+r,this.totalDuration=this.resolvedDuration*(n+1)-r,this.generator=c}updateTime(e){let t=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime===null?this.currentTime=t:this.currentTime=this.holdTime}tick(e,t=!1){let{generator:n,totalDuration:r,mixKeyframes:i,mirroredGenerator:a,resolvedDuration:o,calculatedDuration:s}=this;if(this.startTime===null)return n.next(0);let{delay:c=0,keyframes:l,repeat:u,repeatType:d,repeatDelay:f,type:p,onUpdate:m,finalKeyframe:h}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);let g=this.currentTime-c*(this.playbackSpeed>=0?1:-1),_=this.playbackSpeed>=0?g<0:g>r;this.currentTime=Math.max(g,0),this.state===`finished`&&this.holdTime===null&&(this.currentTime=r);let v=this.currentTime,y=n;if(u){let e=Math.min(this.currentTime,r)/o,t=Math.floor(e),n=e%1;!n&&e>=1&&(n=1),n===1&&t--,t=Math.min(t,u+1),t%2&&(d===`reverse`?(n=1-n,f&&(n-=f/o)):d===`mirror`&&(y=a)),v=JS(0,1,n)*o}let b=_?{done:!1,value:l[0]}:y.next(v);i&&(b.value=i(b.value));let{done:x}=b;!_&&s!==null&&(x=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);let S=this.holdTime===null&&(this.state===`finished`||this.state===`running`&&x);return S&&p!==vT&&(b.value=DT(l,this.options,h,this.speed)),m&&m(b.value),S&&this.finish(),b}then(e,t){return this.finished.then(e,t)}get duration(){return lC(this.calculatedDuration)}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+lC(e)}get time(){return lC(this.currentTime)}set time(e){e=cC(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(KC.now());let t=this.playbackSpeed!==e;this.playbackSpeed=e,t&&(this.time=lC(this.currentTime))}play(){if(this.isStopped)return;let{driver:e=eT,startTime:t}=this.options;this.driver||=e(e=>this.tick(e)),this.options.onPlay?.();let n=this.driver.now();this.state===`finished`?(this.updateFinished(),this.startTime=n):this.holdTime===null?this.startTime||=t??n:this.startTime=n-this.holdTime,this.state===`finished`&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state=`running`,this.driver.start()}pause(){this.state=`paused`,this.updateTime(KC.now()),this.holdTime=this.currentTime}complete(){this.state!==`running`&&this.play(),this.state=`finished`,this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state=`finished`,this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state=`idle`,this.stopDriver(),this.startTime=this.holdTime=null,qC.mainThread--}stopDriver(){this.driver&&=(this.driver.stop(),void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type=`keyframes`,this.options.ease=`linear`,this.initAnimation()),this.driver?.stop(),e.observe(this)}};function NT(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}var PT=e=>e*180/Math.PI,FT=e=>LT(PT(Math.atan2(e[1],e[0]))),IT={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:FT,rotateZ:FT,skewX:e=>PT(Math.atan(e[1])),skewY:e=>PT(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},LT=e=>(e%=360,e<0&&(e+=360),e),RT=FT,zT=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),BT=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),VT={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:zT,scaleY:BT,scale:e=>(zT(e)+BT(e))/2,rotateX:e=>LT(PT(Math.atan2(e[6],e[5]))),rotateY:e=>LT(PT(Math.atan2(-e[2],e[0]))),rotateZ:RT,rotate:RT,skewX:e=>PT(Math.atan(e[4])),skewY:e=>PT(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function HT(e){return e.includes(`scale`)?1:0}function UT(e,t){if(!e||e===`none`)return HT(t);let n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u),r,i;if(n)r=VT,i=n;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=IT,i=t}if(!i)return HT(t);let a=r[t],o=i[1].split(`,`).map(GT);return typeof a==`function`?a(o):o[a]}var WT=(e,t)=>{let{transform:n=`none`}=getComputedStyle(e);return UT(n,t)};function GT(e){return parseFloat(e.trim())}var KT=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],qT=(()=>new Set(KT))(),JT=e=>e===ew||e===Q,YT=new Set([`x`,`y`,`z`]),XT=KT.filter(e=>!YT.has(e));function ZT(e){let t=[];return XT.forEach(n=>{let r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith(`scale`)?1:0))}),t}var QT={width:({x:e},{paddingLeft:t=`0`,paddingRight:n=`0`})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t=`0`,paddingBottom:n=`0`})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>UT(t,`x`),y:(e,{transform:t})=>UT(t,`y`)};QT.translateX=QT.x,QT.translateY=QT.y;var $T=new Set,eE=!1,tE=!1,nE=!1;function rE(){if(tE){let e=Array.from($T).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{let t=ZT(e);t.length&&(n.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=n.get(e);t&&t.forEach(([t,n])=>{e.getValue(t)?.set(n)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{e.suspendedScrollY!==void 0&&window.scrollTo(0,e.suspendedScrollY)})}tE=!1,eE=!1,$T.forEach(e=>e.complete(nE)),$T.clear()}function iE(){$T.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(tE=!0)})}function aE(){nE=!0,iE(),rE(),nE=!1}var oE=class{constructor(e,t,n,r,i,a=!1){this.state=`pending`,this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=i,this.isAsync=a}scheduleResolve(){this.state=`scheduled`,this.isAsync?($T.add(this),eE||(eE=!0,BC.read(iE),BC.resolveKeyframes(rE))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;if(e[0]===null){let i=r?.get(),a=e[e.length-1];if(i!==void 0)e[0]=i;else if(n&&t){let r=n.readValue(t,a);r!=null&&(e[0]=r)}e[0]===void 0&&(e[0]=a),r&&i===void 0&&r.set(e[0])}NT(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state=`complete`,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),$T.delete(this)}cancel(){this.state===`scheduled`&&($T.delete(this),this.state=`pending`)}resume(){this.state===`pending`&&this.scheduleResolve()}},sE=e=>e.startsWith(`--`);function cE(e,t,n){sE(t)?e.style.setProperty(t,n):e.style[t]=n}var lE=nC(()=>window.ScrollTimeline!==void 0),uE={};function dE(e,t){let n=nC(e);return()=>uE[t]??n()}var fE=dE(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),pE=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,mE={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:pE([0,.65,.55,1]),circOut:pE([.55,0,1,.45]),backIn:pE([.31,.01,.66,-.59]),backOut:pE([.33,1.53,.69,.99])};function hE(e,t){if(e)return typeof e==`function`?fE()?tT(e,t):`ease-out`:jC(e)?pE(e):Array.isArray(e)?e.map(e=>hE(e,t)||mE.easeOut):mE[e]}function gE(e,t,n,{delay:r=0,duration:i=300,repeat:a=0,repeatType:o=`loop`,ease:s=`easeOut`,times:c}={},l=void 0){let u={[t]:n};c&&(u.offset=c);let d=hE(s,i);Array.isArray(d)&&(u.easing=d),IC.value&&qC.waapi++;let f={delay:r,duration:i,easing:Array.isArray(d)?`linear`:d,fill:`both`,iterations:a+1,direction:o===`reverse`?`alternate`:`normal`};l&&(f.pseudoElement=l);let p=e.animate(u,f);return IC.value&&p.finished.finally(()=>{qC.waapi--}),p}function _E(e){return typeof e==`function`&&`applyToOptions`in e}function vE({type:e,...t}){return _E(e)&&fE()?e.applyToOptions(t):(t.duration??=300,t.ease??=`easeOut`,t)}var yE=class extends AT{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;let{element:t,name:n,keyframes:r,pseudoElement:i,allowFlatten:a=!1,finalKeyframe:o,onComplete:s}=e;this.isPseudoElement=!!i,this.allowFlatten=a,this.options=e,ZS(typeof e.type!=`string`,`Mini animate() doesn't support "type" as a string.`,`mini-spring`);let c=vE(e);this.animation=gE(t,n,r,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=DT(r,this.options,o,this.speed);this.updateMotionValue?this.updateMotionValue(e):cE(t,n,e),this.animation.cancel()}s?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state===`finished`&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:e}=this;e===`idle`||e===`finished`||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){let e=this.animation.effect?.getComputedTiming?.().duration||0;return lC(Number(e))}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+lC(e)}get time(){return lC(Number(this.animation.currentTime)||0)}set time(e){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=cC(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime===null?this.animation.playState:`finished`}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,observe:t}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:`linear`}),this.animation.onfinish=null,e&&lE()?(this.animation.timeline=e,rC):t(this)}},bE={anticipate:CC,backInOut:SC,circInOut:EC};function xE(e){return e in bE}function SE(e){typeof e.ease==`string`&&xE(e.ease)&&(e.ease=bE[e.ease])}var CE=10,wE=class extends yE{constructor(e){SE(e),kT(e),super(e),e.startTime!==void 0&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){let{motionValue:t,onUpdate:n,onComplete:r,element:i,...a}=this.options;if(!t)return;if(e!==void 0){t.set(e);return}let o=new MT({...a,autoplay:!1}),s=Math.max(CE,KC.now()-this.startTime),c=JS(0,CE,s-CE);t.setWithVelocity(o.sample(Math.max(0,s-c)).value,o.sample(s).value,c),o.stop()}},TE=(e,t)=>t===`zIndex`?!1:!!(typeof e==`number`||Array.isArray(e)||typeof e==`string`&&(Fw.test(e)||e===`0`)&&!e.startsWith(`url(`));function EE(e){let t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function DE(e,t,n,r){let i=e[0];if(i===null)return!1;if(t===`display`||t===`visibility`)return!0;let a=e[e.length-1],o=TE(i,t),s=TE(a,t);return XS(o===s,`You are trying to animate ${t} from "${i}" to "${a}". "${o?a:i}" is not an animatable value.`,`value-not-animatable`),!o||!s?!1:EE(e)||(n===`spring`||_E(n))&&r}function OE(e){e.duration=0,e.type=`keyframes`}var kE=new Set([`opacity`,`clipPath`,`filter`,`transform`]),AE=nC(()=>Object.hasOwnProperty.call(Element.prototype,`animate`));function jE(e){let{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:a,type:o}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;let{onUpdate:s,transformTemplate:c}=t.owner.getProps();return AE()&&n&&kE.has(n)&&(n!==`transform`||!c)&&!s&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`}var ME=40,NE=class extends AT{constructor({autoplay:e=!0,delay:t=0,type:n=`keyframes`,repeat:r=0,repeatDelay:i=0,repeatType:a=`loop`,keyframes:o,name:s,motionValue:c,element:l,...u}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=KC.now();let d={autoplay:e,delay:t,type:n,repeat:r,repeatDelay:i,repeatType:a,name:s,motionValue:c,element:l,...u};this.keyframeResolver=new(l?.KeyframeResolver||oE)(o,(e,t,n)=>this.onKeyframesResolved(e,t,d,!n),s,c,l),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,n,r){this.keyframeResolver=void 0;let{name:i,type:a,velocity:o,delay:s,isHandoff:c,onUpdate:l}=n;this.resolvedAt=KC.now(),DE(e,i,a,o)||((QS.instantAnimations||!s)&&l?.(DT(e,n,t)),e[0]=e[e.length-1],OE(n),n.repeat=0);let u={startTime:r?this.resolvedAt&&this.resolvedAt-this.createdAt>ME?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...n,keyframes:e},d=!c&&jE(u)?new wE({...u,element:u.motionValue.owner.current}):new MT(u);d.finished.then(()=>this.notifyFinished()).catch(rC),this.pendingTimeline&&=(this.stopTimeline=d.attachTimeline(this.pendingTimeline),void 0),this._animation=d}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),aE()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}},PE=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function FE(e){let t=PE.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}var IE=4;function LE(e,t,n=1){ZS(n<=IE,`Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`,`max-css-var-depth`);let[r,i]=FE(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return $S(e)?parseFloat(e):e}return ZC(i)?LE(i,t,n+1):i}function RE(e,t){return e?.[t]??e?.default??e}var zE=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...KT]),BE={test:e=>e===`auto`,parse:e=>e},VE=e=>t=>t.test(e),HE=[ew,Q,gw,hw,vw,_w,BE],UE=e=>HE.find(VE(e));function WE(e){return typeof e==`number`?e===0:e===null?!0:e===`none`||e===`0`||tC(e)}var GE=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function KE(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(iw)||[];if(!r)return e;let i=n.replace(r,``),a=GE.has(t)?1:0;return r!==n&&(a*=100),t+`(`+a+i+`)`}var qE=/\b([a-z-]*)\(.*?\)/gu,JE={...Fw,getAnimatableNone:e=>{let t=e.match(qE);return t?t.map(KE).join(` `):e}},YE={...ew,transform:Math.round},XE={borderWidth:Q,borderTopWidth:Q,borderRightWidth:Q,borderBottomWidth:Q,borderLeftWidth:Q,borderRadius:Q,radius:Q,borderTopLeftRadius:Q,borderTopRightRadius:Q,borderBottomRightRadius:Q,borderBottomLeftRadius:Q,width:Q,maxWidth:Q,height:Q,maxHeight:Q,top:Q,right:Q,bottom:Q,left:Q,inset:Q,insetBlock:Q,insetBlockStart:Q,insetBlockEnd:Q,insetInline:Q,insetInlineStart:Q,insetInlineEnd:Q,padding:Q,paddingTop:Q,paddingRight:Q,paddingBottom:Q,paddingLeft:Q,paddingBlock:Q,paddingBlockStart:Q,paddingBlockEnd:Q,paddingInline:Q,paddingInlineStart:Q,paddingInlineEnd:Q,margin:Q,marginTop:Q,marginRight:Q,marginBottom:Q,marginLeft:Q,marginBlock:Q,marginBlockStart:Q,marginBlockEnd:Q,marginInline:Q,marginInlineStart:Q,marginInlineEnd:Q,backgroundPositionX:Q,backgroundPositionY:Q,rotate:hw,rotateX:hw,rotateY:hw,rotateZ:hw,scale:nw,scaleX:nw,scaleY:nw,scaleZ:nw,skew:hw,skewX:hw,skewY:hw,distance:Q,translateX:Q,translateY:Q,translateZ:Q,x:Q,y:Q,z:Q,perspective:Q,transformPerspective:Q,opacity:tw,originX:yw,originY:yw,originZ:Q,zIndex:YE,fillOpacity:tw,strokeOpacity:tw,numOctaves:YE},ZE={...XE,color:xw,backgroundColor:xw,outlineColor:xw,fill:xw,stroke:xw,borderColor:xw,borderTopColor:xw,borderRightColor:xw,borderBottomColor:xw,borderLeftColor:xw,filter:JE,WebkitFilter:JE},QE=e=>ZE[e];function $E(e,t){let n=QE(e);return n!==JE&&(n=Fw),n.getAnimatableNone?n.getAnimatableNone(t):void 0}var eD=new Set([`auto`,`none`,`0`]);function tD(e,t,n){let r=0,i;for(;r<e.length&&!i;){let t=e[r];typeof t==`string`&&!eD.has(t)&&Aw(t).values.length&&(i=e[r]),r++}if(i&&n)for(let r of t)e[r]=$E(n,i)}var nD=class extends oE{constructor(e,t,n,r,i){super(e,t,n,r,i,!0)}readKeyframes(){let{unresolvedKeyframes:e,element:t,name:n}=this;if(!t||!t.current)return;super.readKeyframes();for(let n=0;n<e.length;n++){let r=e[n];if(typeof r==`string`&&(r=r.trim(),ZC(r))){let i=LE(r,t.current);i!==void 0&&(e[n]=i),n===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!zE.has(n)||e.length!==2)return;let[r,i]=e,a=UE(r),o=UE(i);if($C(r)!==$C(i)&&QT[n]){this.needsMeasurement=!0;return}if(a!==o)if(JT(a)&&JT(o))for(let t=0;t<e.length;t++){let n=e[t];typeof n==`string`&&(e[t]=parseFloat(n))}else QT[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,n=[];for(let t=0;t<e.length;t++)(e[t]===null||WE(e[t]))&&n.push(t);n.length&&tD(e,n,t)}measureInitialState(){let{element:e,unresolvedKeyframes:t,name:n}=this;if(!e||!e.current)return;n===`height`&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=QT[n](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;let r=t[t.length-1];r!==void 0&&e.getValue(n,r).jump(r,!1)}measureEndState(){let{element:e,name:t,unresolvedKeyframes:n}=this;if(!e||!e.current)return;let r=e.getValue(t);r&&r.jump(this.measuredOrigin,!1);let i=n.length-1,a=n[i];n[i]=QT[t](e.measureViewportBox(),window.getComputedStyle(e.current)),a!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=a),this.removedTransforms?.length&&this.removedTransforms.forEach(([t,n])=>{e.getValue(t).set(n)}),this.resolveNoneKeyframes()}};function rD(e,t,n){if(e instanceof EventTarget)return[e];if(typeof e==`string`){let r=document;t&&(r=t.current);let i=n?.[e]??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e)}var iD=(e,t)=>t&&typeof e==`number`?t.transform(e):e;function aD(e){return eC(e)&&`offsetHeight`in e}var oD=30,sD=e=>!isNaN(parseFloat(e)),cD={current:void 0},lD=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=KC.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=KC.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=sD(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return process.env.NODE_ENV!==`production`&&fC(!1,`value.onChange(callback) is deprecated. Switch to value.on("change", callback).`),this.on(`change`,e)}on(e,t){this.events[e]||(this.events[e]=new sC);let n=this.events[e].add(t);return e===`change`?()=>{n(),BC.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||=new Set,this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return cD.current&&cD.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=KC.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>oD)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,oD);return uC(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function uD(e,t){return new lD(e,t)}var{schedule:dD,cancel:fD}=zC(queueMicrotask,!1),pD={x:!1,y:!1};function mD(){return pD.x||pD.y}function hD(e){return e===`x`||e===`y`?pD[e]?null:(pD[e]=!0,()=>{pD[e]=!1}):pD.x||pD.y?null:(pD.x=pD.y=!0,()=>{pD.x=pD.y=!1})}function gD(e,t){let n=rD(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function _D(e){return!(e.pointerType===`touch`||mD())}function vD(e,t,n={}){let[r,i,a]=gD(e,n),o=e=>{if(!_D(e))return;let{target:n}=e,r=t(n,e);if(typeof r!=`function`||!n)return;let a=e=>{_D(e)&&(r(e),n.removeEventListener(`pointerleave`,a))};n.addEventListener(`pointerleave`,a,i)};return r.forEach(e=>{e.addEventListener(`pointerenter`,o,i)}),a}var yD=(e,t)=>t?e===t?!0:yD(e,t.parentElement):!1,bD=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1,xD=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function SD(e){return xD.has(e.tagName)||e.isContentEditable===!0}var CD=new WeakSet;function wD(e){return t=>{t.key===`Enter`&&e(t)}}function TD(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}var ED=(e,t)=>{let n=e.currentTarget;if(!n)return;let r=wD(()=>{if(CD.has(n))return;TD(n,`down`);let e=wD(()=>{TD(n,`up`)});n.addEventListener(`keyup`,e,t),n.addEventListener(`blur`,()=>TD(n,`cancel`),t)});n.addEventListener(`keydown`,r,t),n.addEventListener(`blur`,()=>n.removeEventListener(`keydown`,r),t)};function DD(e){return bD(e)&&!mD()}function OD(e,t,n={}){let[r,i,a]=gD(e,n),o=e=>{let r=e.currentTarget;if(!DD(e))return;CD.add(r);let a=t(r,e),o=(e,t)=>{window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,c),CD.has(r)&&CD.delete(r),DD(e)&&typeof a==`function`&&a(e,{success:t})},s=e=>{o(e,r===window||r===document||n.useGlobalTarget||yD(r,e.target))},c=e=>{o(e,!1)};window.addEventListener(`pointerup`,s,i),window.addEventListener(`pointercancel`,c,i)};return r.forEach(e=>{(n.useGlobalTarget?window:e).addEventListener(`pointerdown`,o,i),aD(e)&&(e.addEventListener(`focus`,e=>ED(e,i)),!SD(e)&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=0))}),a}function kD(e){return eC(e)&&`ownerSVGElement`in e}function AD(e){return kD(e)&&e.tagName===`svg`}var jD=e=>!!(e&&e.getVelocity),MD=[...HE,xw,Fw],ND=e=>MD.find(VE(e)),PD=(0,t.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`});function FD(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function ID(...e){return t=>{let n=!1,r=e.map(e=>{let r=FD(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():FD(e[t],null)}}}}function LD(...e){return t.useCallback(ID(...e),e)}var RD=class extends t.Component{getSnapshotBeforeUpdate(e){let t=this.props.childRef.current;if(t&&e.isPresent&&!this.props.isPresent){let e=t.offsetParent,n=aD(e)&&e.offsetWidth||0,r=this.props.sizeRef.current;r.height=t.offsetHeight||0,r.width=t.offsetWidth||0,r.top=t.offsetTop,r.left=t.offsetLeft,r.right=n-r.width-r.left}return null}componentDidUpdate(){}render(){return this.props.children}};function zD({children:e,isPresent:n,anchorX:i,root:a}){let o=(0,t.useId)(),s=(0,t.useRef)(null),c=(0,t.useRef)({width:0,height:0,top:0,left:0,right:0}),{nonce:l}=(0,t.useContext)(PD),u=LD(s,e.props?.ref??e?.ref);return(0,t.useInsertionEffect)(()=>{let{width:e,height:t,top:r,left:u,right:d}=c.current;if(n||!s.current||!e||!t)return;let f=i===`left`?`left: ${u}`:`right: ${d}`;s.current.dataset.motionPopId=o;let p=document.createElement(`style`);l&&(p.nonce=l);let m=a??document.head;return m.appendChild(p),p.sheet&&p.sheet.insertRule(`
49
49
  [data-motion-pop-id="${o}"] {
50
50
  position: absolute !important;
51
51
  width: ${e}px !important;
@@ -53,14 +53,14 @@ For more information, see https://radix-ui.com/primitives/docs/components/${n.do
53
53
  ${f}px !important;
54
54
  top: ${r}px !important;
55
55
  }
56
- `),()=>{m.contains(p)&&m.removeChild(p)}},[n]),(0,r.jsx)(LD,{isPresent:n,childRef:s,sizeRef:c,children:t.cloneElement(e,{ref:u})})}var zD=({children:e,initial:n,isPresent:i,onExitComplete:a,custom:o,presenceAffectsLayout:s,mode:c,anchorX:l,root:u})=>{let d=VS(BD),f=(0,t.useId)(),p=!0,m=(0,t.useMemo)(()=>(p=!1,{id:f,initial:n,isPresent:i,custom:o,onExitComplete:e=>{d.set(e,!0);for(let e of d.values())if(!e)return;a&&a()},register:e=>(d.set(e,!1),()=>d.delete(e))}),[i,d,a]);return s&&p&&(m={...m}),(0,t.useMemo)(()=>{d.forEach((e,t)=>d.set(t,!1))},[i]),t.useEffect(()=>{!i&&!d.size&&a&&a()},[i]),c===`popLayout`&&(e=(0,r.jsx)(RD,{isPresent:i,anchorX:l,root:u,children:e})),(0,r.jsx)(WS.Provider,{value:m,children:e})};function BD(){return new Map}function VD(e=!0){let n=(0,t.useContext)(WS);if(n===null)return[!0,null];let{isPresent:r,onExitComplete:i,register:a}=n,o=(0,t.useId)();(0,t.useEffect)(()=>{if(e)return a(o)},[e]);let s=(0,t.useCallback)(()=>e&&i&&i(o),[o,i,e]);return!r&&i?[!1,s]:[!0]}var HD=e=>e.key||``;function UD(e){let n=[];return t.Children.forEach(e,e=>{(0,t.isValidElement)(e)&&n.push(e)}),n}var WD=({children:e,custom:n,initial:i=!0,onExitComplete:a,presenceAffectsLayout:o=!0,mode:s=`sync`,propagate:c=!1,anchorX:l=`left`,root:u})=>{let[d,f]=VD(c),p=(0,t.useMemo)(()=>UD(e),[e]),m=c&&!d?[]:p.map(HD),h=(0,t.useRef)(!0),g=(0,t.useRef)(p),_=VS(()=>new Map),v=(0,t.useRef)(new Set),[y,b]=(0,t.useState)(p),[x,S]=(0,t.useState)(p);US(()=>{h.current=!1,g.current=p;for(let e=0;e<x.length;e++){let t=HD(x[e]);m.includes(t)?(_.delete(t),v.current.delete(t)):_.get(t)!==!0&&_.set(t,!1)}},[x,m.length,m.join(`-`)]);let C=[];if(p!==y){let e=[...p];for(let t=0;t<x.length;t++){let n=x[t],r=HD(n);m.includes(r)||(e.splice(t,0,n),C.push(n))}return s===`wait`&&C.length&&(e=C),S(UD(e)),b(p),null}process.env.NODE_ENV!==`production`&&s===`wait`&&x.length>1&&console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);let{forceRender:w}=(0,t.useContext)(BS);return(0,r.jsx)(r.Fragment,{children:x.map(e=>{let t=HD(e),y=c&&!d?!1:p===x||m.includes(t);return(0,r.jsx)(zD,{isPresent:y,initial:!h.current||i?void 0:!1,custom:n,presenceAffectsLayout:o,mode:s,root:u,onExitComplete:y?void 0:()=>{if(v.current.has(t))return;if(v.current.add(t),_.has(t))_.set(t,!0);else return;let e=!0;_.forEach(t=>{t||(e=!1)}),e&&(w?.(),S(g.current),c&&f?.(),a&&a())},anchorX:l,children:e},t)})})},GD=(0,t.createContext)({strict:!1}),KD={animation:[`animate`,`variants`,`whileHover`,`whileTap`,`exit`,`whileInView`,`whileFocus`,`whileDrag`],exit:[`exit`],drag:[`drag`,`dragControls`],focus:[`whileFocus`],hover:[`whileHover`,`onHoverStart`,`onHoverEnd`],tap:[`whileTap`,`onTap`,`onTapStart`,`onTapCancel`],pan:[`onPan`,`onPanStart`,`onPanSessionStart`,`onPanEnd`],inView:[`whileInView`,`onViewportEnter`,`onViewportLeave`],layout:[`layout`,`layoutId`]},qD={};for(let e in KD)qD[e]={isEnabled:t=>KD[e].some(e=>!!t[e])};function JD(e){for(let t in e)qD[t]={...qD[t],...e[t]}}var YD=new Set(`animate.exit.variants.initial.style.values.variants.transition.transformTemplate.custom.inherit.onBeforeLayoutMeasure.onAnimationStart.onAnimationComplete.onUpdate.onDragStart.onDrag.onDragEnd.onMeasureDragConstraints.onDirectionLock.onDragTransitionEnd._dragX._dragY.onHoverStart.onHoverEnd.onViewportEnter.onViewportLeave.globalTapTarget.ignoreStrict.viewport`.split(`.`));function XD(e){return e.startsWith(`while`)||e.startsWith(`drag`)&&e!==`draggable`||e.startsWith(`layout`)||e.startsWith(`onTap`)||e.startsWith(`onPan`)||e.startsWith(`onLayout`)||YD.has(e)}function ZD(e){var t=Object.create(null);return function(n){return t[n]===void 0&&(t[n]=e(n)),t[n]}}var QD=d((()=>{})),$D=p({default:()=>tO}),eO,tO,nO=d((()=>{QD(),eO=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|fetchpriority|fetchPriority|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|popover|popoverTarget|popoverTargetAction|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,tO=ZD(function(e){return eO.test(e)||e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)<91})})),rO=e=>!XD(e);function iO(e){typeof e==`function`&&(rO=t=>t.startsWith(`on`)?!XD(t):e(t))}try{iO((nO(),g($D)).default)}catch{}function aO(e,t,n){let r={};for(let i in e)i===`values`&&typeof e.values==`object`||(rO(i)||n===!0&&XD(i)||!t&&!XD(i)||e.draggable&&i.startsWith(`onDrag`))&&(r[i]=e[i]);return r}var oO=(0,t.createContext)({});function sO(e){return typeof e==`object`&&!!e&&typeof e.start==`function`}function cO(e){return typeof e==`string`||Array.isArray(e)}var lO=[`animate`,`whileInView`,`whileFocus`,`whileHover`,`whileTap`,`whileDrag`,`exit`],uO=[`initial`,...lO];function dO(e){return sO(e.animate)||uO.some(t=>cO(e[t]))}function fO(e){return!!(dO(e)||e.variants)}function pO(e,t){if(dO(e)){let{initial:t,animate:n}=e;return{initial:t===!1||cO(t)?t:void 0,animate:cO(n)?n:void 0}}return e.inherit===!1?{}:t}function mO(e){let{initial:n,animate:r}=pO(e,(0,t.useContext)(oO));return(0,t.useMemo)(()=>({initial:n,animate:r}),[hO(n),hO(r)])}function hO(e){return Array.isArray(e)?e.join(` `):e}function gO(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}var _O={correct:(e,t)=>{if(!t.target)return e;if(typeof e==`string`)if(Q.test(e))e=parseFloat(e);else return e;return`${gO(e,t.target.x)}% ${gO(e,t.target.y)}%`}},vO={correct:(e,{treeScale:t,projectionDelta:n})=>{let r=e,i=Pw.parse(e);if(i.length>5)return r;let a=Pw.createTransformer(e),o=typeof i[0]==`number`?0:1,s=n.x.scale*t.x,c=n.y.scale*t.y;i[0+o]/=s,i[1+o]/=c;let l=Rw(s,c,.5);return typeof i[2+o]==`number`&&(i[2+o]/=l),typeof i[3+o]==`number`&&(i[3+o]/=l),a(i)}},yO={borderRadius:{..._O,applyTo:[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomLeftRadius`,`borderBottomRightRadius`]},borderTopLeftRadius:_O,borderTopRightRadius:_O,borderBottomLeftRadius:_O,borderBottomRightRadius:_O,boxShadow:vO};function bO(e,{layout:t,layoutId:n}){return KT.has(e)||e.startsWith(`origin`)||(t||n!==void 0)&&(!!yO[e]||e===`opacity`)}var xO={x:`translateX`,y:`translateY`,z:`translateZ`,transformPerspective:`perspective`},SO=GT.length;function CO(e,t,n){let r=``,i=!0;for(let a=0;a<SO;a++){let o=GT[a],s=e[o];if(s===void 0)continue;let c=!0;if(c=typeof s==`number`?s===(o.startsWith(`scale`)?1:0):parseFloat(s)===0,!c||n){let e=rD(s,YE[o]);if(!c){i=!1;let t=xO[o]||o;r+=`${t}(${e}) `}n&&(t[o]=e)}}return r=r.trim(),n?r=n(t,i?``:r):i&&(r=`none`),r}function wO(e,t,n){let{style:r,vars:i,transformOrigin:a}=e,o=!1,s=!1;for(let e in t){let n=t[e];if(KT.has(e)){o=!0;continue}else if(JC(e)){i[e]=n;continue}else{let t=rD(n,YE[e]);e.startsWith(`origin`)?(s=!0,a[e]=t):r[e]=t}}if(t.transform||(o||n?r.transform=CO(t,e.transform,n):r.transform&&=`none`),s){let{originX:e=`50%`,originY:t=`50%`,originZ:n=0}=a;r.transformOrigin=`${e} ${t} ${n}`}}var TO=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function EO(e,t,n){for(let r in t)!AD(t[r])&&!bO(r,n)&&(e[r]=t[r])}function DO({transformTemplate:e},n){return(0,t.useMemo)(()=>{let t=TO();return wO(t,n,e),Object.assign({},t.vars,t.style)},[n])}function OO(e,t){let n=e.style||{},r={};return EO(r,n,e),Object.assign(r,DO(e,t)),r}function kO(e,t){let n={},r=OO(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout=`none`,r.touchAction=e.drag===!0?`none`:`pan-${e.drag===`x`?`y`:`x`}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}var AO={offset:`stroke-dashoffset`,array:`stroke-dasharray`},jO={offset:`strokeDashoffset`,array:`strokeDasharray`};function MO(e,t,n=1,r=0,i=!0){e.pathLength=1;let a=i?AO:jO;e[a.offset]=Q.transform(-r);let o=Q.transform(t),s=Q.transform(n);e[a.array]=`${o} ${s}`}var NO=[`offsetDistance`,`offsetPath`,`offsetRotate`,`offsetAnchor`];function PO(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:a=1,pathOffset:o=0,...s},c,l,u){if(wO(e,s,l),c){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:d,style:f}=e;d.transform&&(f.transform=d.transform,delete d.transform),(f.transform||d.transformOrigin)&&(f.transformOrigin=d.transformOrigin??`50% 50%`,delete d.transformOrigin),f.transform&&(f.transformBox=u?.transformBox??`fill-box`,delete d.transformBox);for(let e of NO)d[e]!==void 0&&(f[e]=d[e],delete d[e]);t!==void 0&&(d.x=t),n!==void 0&&(d.y=n),r!==void 0&&(d.scale=r),i!==void 0&&MO(d,i,a,o,!1)}var FO=()=>({...TO(),attrs:{}}),IO=e=>typeof e==`string`&&e.toLowerCase()===`svg`;function LO(e,n,r,i){let a=(0,t.useMemo)(()=>{let t=FO();return PO(t,n,IO(i),e.transformTemplate,e.style),{...t.attrs,style:{...t.style}}},[n]);if(e.style){let t={};EO(t,e.style,e),a.style={...t,...a.style}}return a}var RO=[`animate`,`circle`,`defs`,`desc`,`ellipse`,`g`,`image`,`line`,`filter`,`marker`,`mask`,`metadata`,`path`,`pattern`,`polygon`,`polyline`,`rect`,`stop`,`switch`,`symbol`,`svg`,`text`,`tspan`,`use`,`view`];function zO(e){return typeof e!=`string`||e.includes(`-`)?!1:!!(RO.indexOf(e)>-1||/[A-Z]/u.test(e))}function BO(e,n,r,{latestValues:i},a,o=!1,s){let c=(s??zO(e)?LO:kO)(n,i,a,e),l=aO(n,typeof e==`string`,o),u=e===t.Fragment?{}:{...l,...c,ref:r},{children:d}=n,f=(0,t.useMemo)(()=>AD(d)?d.get():d,[d]);return(0,t.createElement)(e,{...u,children:f})}function VO(e){let t=[{},{}];return e?.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function HO(e,t,n,r){if(typeof t==`function`){let[i,a]=VO(r);t=t(n===void 0?e.custom:n,i,a)}if(typeof t==`string`&&(t=e.variants&&e.variants[t]),typeof t==`function`){let[i,a]=VO(r);t=t(n===void 0?e.custom:n,i,a)}return t}function UO(e){return AD(e)?e.get():e}function WO({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,i){return{latestValues:GO(n,r,i,e),renderState:t()}}function GO(e,t,n,r){let i={},a=r(e,{});for(let e in a)i[e]=UO(a[e]);let{initial:o,animate:s}=e,c=dO(e),l=fO(e);t&&l&&!c&&e.inherit!==!1&&(o===void 0&&(o=t.initial),s===void 0&&(s=t.animate));let u=n?n.initial===!1:!1;u||=o===!1;let d=u?s:o;if(d&&typeof d!=`boolean`&&!sO(d)){let t=Array.isArray(d)?d:[d];for(let n=0;n<t.length;n++){let r=HO(e,t[n]);if(r){let{transitionEnd:e,transition:t,...n}=r;for(let e in n){let t=n[e];if(Array.isArray(t)){let e=u?t.length-1:0;t=t[e]}t!==null&&(i[e]=t)}for(let t in e)i[t]=e[t]}}}return i}var KO=e=>(n,r)=>{let i=(0,t.useContext)(oO),a=(0,t.useContext)(WS),o=()=>WO(e,n,i,a);return r?o():VS(o)};function qO(e,t,n){let{style:r}=e,i={};for(let a in r)(AD(r[a])||t.style&&AD(t.style[a])||bO(a,e)||n?.getValue(a)?.liveStyle!==void 0)&&(i[a]=r[a]);return i}var JO=KO({scrapeMotionValuesFromProps:qO,createRenderState:TO});function YO(e,t,n){let r=qO(e,t,n);for(let n in e)if(AD(e[n])||AD(t[n])){let t=GT.indexOf(n)===-1?n:`attr`+n.charAt(0).toUpperCase()+n.substring(1);r[t]=e[n]}return r}var XO=KO({scrapeMotionValuesFromProps:YO,createRenderState:FO}),ZO=Symbol.for(`motionComponentSymbol`);function QO(e,n,r){let i=(0,t.useRef)(r);(0,t.useInsertionEffect)(()=>{i.current=r});let a=(0,t.useRef)(null);return(0,t.useCallback)(t=>{t&&e.onMount?.(t),n&&(t?n.mount(t):n.unmount());let r=i.current;if(typeof r==`function`)if(t){let e=r(t);typeof e==`function`&&(a.current=e)}else a.current?(a.current(),a.current=null):r(t);else r&&(r.current=t)},[n])}var $O=e=>e.replace(/([a-z])([A-Z])/gu,`$1-$2`).toLowerCase(),ek=`data-`+$O(`framerAppearId`),tk=(0,t.createContext)({});function nk(e){return e&&typeof e==`object`&&Object.prototype.hasOwnProperty.call(e,`current`)}function rk(e,n,r,i,a,o){let{visualElement:s}=(0,t.useContext)(oO),c=(0,t.useContext)(GD),l=(0,t.useContext)(WS),u=(0,t.useContext)(ND).reducedMotion,d=(0,t.useRef)(null);i||=c.renderer,!d.current&&i&&(d.current=i(e,{visualState:n,parent:s,props:r,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:u,isSVG:o}));let f=d.current,p=(0,t.useContext)(tk);f&&!f.projection&&a&&(f.type===`html`||f.type===`svg`)&&ik(d.current,r,a,p);let m=(0,t.useRef)(!1);(0,t.useInsertionEffect)(()=>{f&&m.current&&f.update(r,l)});let h=r[ek],g=(0,t.useRef)(!!h&&!window.MotionHandoffIsComplete?.(h)&&window.MotionHasOptimisedAnimation?.(h));return US(()=>{f&&(m.current=!0,window.MotionIsMounted=!0,f.updateFeatures(),f.scheduleRenderMicrotask(),g.current&&f.animationState&&f.animationState.animateChanges())}),(0,t.useEffect)(()=>{f&&(!g.current&&f.animationState&&f.animationState.animateChanges(),g.current&&=(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(h)}),!1),f.enteringChildren=void 0)}),f}function ik(e,t,n,r){let{layoutId:i,layout:a,drag:o,dragConstraints:s,layoutScroll:c,layoutRoot:l,layoutCrossfade:u}=t;e.projection=new n(e.latestValues,t[`data-framer-portal-id`]?void 0:ak(e.parent)),e.projection.setOptions({layoutId:i,layout:a,alwaysMeasureLayout:!!o||s&&nk(s),visualElement:e,animationType:typeof a==`string`?a:`both`,initialPromotionConfig:r,crossfade:u,layoutScroll:c,layoutRoot:l})}function ak(e){if(e)return e.options.allowProjection===!1?ak(e.parent):e.projection}function ok(e,{forwardMotionProps:n=!1,type:i}={},a,o){a&&JD(a);let s=i?i===`svg`:zO(e),c=s?XO:JO;function l(i,l){let u,d={...(0,t.useContext)(ND),...i,layoutId:sk(i)},{isStatic:f}=d,p=mO(i),m=c(i,f);if(!f&&HS){ck(d,a);let t=lk(d);u=t.MeasureLayout,p.visualElement=rk(e,m,d,o,t.ProjectionNode,s)}return(0,r.jsxs)(oO.Provider,{value:p,children:[u&&p.visualElement?(0,r.jsx)(u,{visualElement:p.visualElement,...d}):null,BO(e,i,QO(m,p.visualElement,l),m,f,n,s)]})}l.displayName=`motion.${typeof e==`string`?e:`create(${e.displayName??e.name??``})`}`;let u=(0,t.forwardRef)(l);return u[ZO]=e,u}function sk({layoutId:e}){let n=(0,t.useContext)(BS).id;return n&&e!==void 0?n+`-`+e:e}function ck(e,n){let r=(0,t.useContext)(GD).strict;if(process.env.NODE_ENV!==`production`&&n&&r){let t="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";e.ignoreStrict?YS(!1,t,`lazy-strict-mode`):XS(!1,t,`lazy-strict-mode`)}}function lk(e){let{drag:t,layout:n}=qD;if(!t&&!n)return{};let r={...t,...n};return{MeasureLayout:t?.isEnabled(e)||n?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function uk(e,t){if(typeof Proxy>`u`)return ok;let n=new Map,r=(n,r)=>ok(n,r,e,t);return new Proxy((e,t)=>(process.env.NODE_ENV!==`production`&&dC(!1,`motion() is deprecated. Use motion.create() instead.`),r(e,t)),{get:(i,a)=>a===`create`?r:(n.has(a)||n.set(a,ok(a,void 0,e,t)),n.get(a))})}function dk({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function fk({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function pk(e,t){if(!t)return e;let n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function mk(e){return e===void 0||e===1}function hk({scale:e,scaleX:t,scaleY:n}){return!mk(e)||!mk(t)||!mk(n)}function gk(e){return hk(e)||_k(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function _k(e){return vk(e.x)||vk(e.y)}function vk(e){return e&&e!==`0%`}function yk(e,t,n){return n+t*(e-n)}function bk(e,t,n,r,i){return i!==void 0&&(e=yk(e,i,r)),yk(e,n,r)+t}function xk(e,t=0,n=1,r,i){e.min=bk(e.min,t,n,r,i),e.max=bk(e.max,t,n,r,i)}function Sk(e,{x:t,y:n}){xk(e.x,t.translate,t.scale,t.originPoint),xk(e.y,n.translate,n.scale,n.originPoint)}var Ck=.999999999999,wk=1.0000000000001;function Tk(e,t,n,r=!1){let i=n.length;if(!i)return;t.x=t.y=1;let a,o;for(let s=0;s<i;s++){a=n[s],o=a.projectionDelta;let{visualElement:i}=a.options;i&&i.props.style&&i.props.style.display===`contents`||(r&&a.options.layoutScroll&&a.scroll&&a!==a.root&&Ok(e,{x:-a.scroll.offset.x,y:-a.scroll.offset.y}),o&&(t.x*=o.x.scale,t.y*=o.y.scale,Sk(e,o)),r&&gk(a.latestValues)&&Ok(e,a.latestValues))}t.x<wk&&t.x>Ck&&(t.x=1),t.y<wk&&t.y>Ck&&(t.y=1)}function Ek(e,t){e.min+=t,e.max+=t}function Dk(e,t,n,r,i=.5){xk(e,t,n,Rw(e.min,e.max,i),r)}function Ok(e,t){Dk(e.x,t.x,t.scaleX,t.scale,t.originX),Dk(e.y,t.y,t.scaleY,t.scale,t.originY)}function kk(e,t){return dk(pk(e.getBoundingClientRect(),t))}function Ak(e,t,n){let r=kk(e,n),{scroll:i}=t;return i&&(Ek(r.x,i.offset.x),Ek(r.y,i.offset.y)),r}var jk=()=>({translate:0,scale:1,origin:0,originPoint:0}),Mk=()=>({x:jk(),y:jk()}),Nk=()=>({min:0,max:0}),Pk=()=>({x:Nk(),y:Nk()}),Fk={current:null},Ik={current:!1};function Lk(){if(Ik.current=!0,HS)if(window.matchMedia){let e=window.matchMedia(`(prefers-reduced-motion)`),t=()=>Fk.current=e.matches;e.addEventListener(`change`,t),t()}else Fk.current=!1}var Rk=new WeakMap;function zk(e,t,n){for(let r in t){let i=t[r],a=n[r];if(AD(i))e.addValue(r,i);else if(AD(a))e.addValue(r,lD(i,{owner:e}));else if(a!==i)if(e.hasValue(r)){let t=e.getValue(r);t.liveStyle===!0?t.jump(i):t.hasAnimated||t.set(i)}else{let t=e.getStaticValue(r);e.addValue(r,lD(t===void 0?i:t,{owner:e}))}}for(let r in n)t[r]===void 0&&e.removeValue(r);return t}var Bk=[`AnimationStart`,`AnimationComplete`,`Update`,`BeforeLayoutMeasure`,`LayoutMeasure`,`LayoutAnimationStart`,`LayoutAnimationComplete`],Vk=class{scrapeMotionValuesFromProps(e,t,n){return{}}constructor({parent:e,props:t,presenceContext:n,reducedMotionConfig:r,blockInitialAnimation:i,visualState:a},o={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=aE,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify(`Update`,this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{let e=GC.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,zC.render(this.render,!1,!0))};let{latestValues:s,renderState:c}=a;this.latestValues=s,this.baseTarget={...s},this.initialValues=t.initial?{...s}:{},this.renderState=c,this.parent=e,this.props=t,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.options=o,this.blockInitialAnimation=!!i,this.isControllingVariants=dO(t),this.isVariantNode=fO(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);let{willChange:l,...u}=this.scrapeMotionValuesFromProps(t,{},this);for(let e in u){let t=u[e];s[e]!==void 0&&AD(t)&&t.set(s[e])}}mount(e){this.current=e,Rk.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),this.reducedMotionConfig===`never`?this.shouldReduceMotion=!1:this.reducedMotionConfig===`always`?this.shouldReduceMotion=!0:(Ik.current||Lk(),this.shouldReduceMotion=Fk.current),process.env.NODE_ENV!==`production`&&dC(this.shouldReduceMotion!==!0,`You have Reduced Motion enabled on your device. Animations may not appear as expected.`,`reduced-motion-disabled`),this.parent?.addChild(this),this.update(this.props,this.presenceContext)}unmount(){for(let e in this.projection&&this.projection.unmount(),BC(this.notifyUpdate),BC(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this),this.events)this.events[e].clear();for(let e in this.features){let t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??=new Set,this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();let n=KT.has(e);n&&this.onBindTransform&&this.onBindTransform();let r=t.on(`change`,t=>{this.latestValues[e]=t,this.props.onUpdate&&zC.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()}),i;window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{r(),i&&i(),t.owner&&t.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e=`animation`;for(e in qD){let t=qD[e];if(!t)continue;let{isEnabled:n,Feature:r}=t;if(!this.features[e]&&r&&n(this.props)&&(this.features[e]=new r(this)),this.features[e]){let t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Pk()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;t<Bk.length;t++){let n=Bk[t];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);let r=e[`on`+n];r&&(this.propEventSubscriptions[n]=this.on(n,r))}this.prevMotionValues=zk(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){let t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){let n=this.values.get(e);t!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);let t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&t!==void 0&&(n=lD(t===null?void 0:t,{owner:this}),this.addValue(e,n)),n}readValue(e,t){let n=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return n!=null&&(typeof n==`string`&&(QS(n)||eC(n))?n=parseFloat(n):!MD(n)&&Pw.test(t)&&(n=QE(e,t)),this.setBaseTarget(e,AD(n)?n.get():n)),AD(n)?n.get():n}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){let{initial:t}=this.props,n;if(typeof t==`string`||typeof t==`object`){let r=HO(this.props,t,this.presenceContext?.custom);r&&(n=r[e])}if(t&&n!==void 0)return n;let r=this.getBaseTargetFromProps(this.props,e);return r!==void 0&&!AD(r)?r:this.initialValues[e]!==void 0&&n===void 0?void 0:this.baseTarget[e]}on(e,t){return this.events[e]||(this.events[e]=new oC),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){uD.render(this.render)}},Hk=class extends Vk{constructor(){super(...arguments),this.KeyframeResolver=tD}sortInstanceNodePosition(e,t){return e.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(e,t){return e.style?e.style[t]:void 0}removeValueFromRenderState(e,{vars:t,style:n}){delete t[e],delete n[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:e}=this.props;AD(e)&&(this.childSubscription=e.on(`change`,e=>{this.current&&(this.current.textContent=`${e}`)}))}};function Uk(e,{style:t,vars:n},r,i){let a=e.style,o;for(o in t)a[o]=t[o];for(o in i?.applyProjectionStyles(a,r),n)a.setProperty(o,n[o])}function Wk(e){return window.getComputedStyle(e)}var Gk=class extends Hk{constructor(){super(...arguments),this.type=`html`,this.renderInstance=Uk}readValueFromInstance(e,t){if(KT.has(t))return this.projection?.isProjecting?VT(t):UT(e,t);{let n=Wk(e),r=(JC(t)?n.getPropertyValue(t):n[t])||0;return typeof r==`string`?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return kk(e,t)}build(e,t,n){wO(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return qO(e,t,n)}},Kk=new Set([`baseFrequency`,`diffuseConstant`,`kernelMatrix`,`kernelUnitLength`,`keySplines`,`keyTimes`,`limitingConeAngle`,`markerHeight`,`markerWidth`,`numOctaves`,`targetX`,`targetY`,`surfaceScale`,`specularConstant`,`specularExponent`,`stdDeviation`,`tableValues`,`viewBox`,`gradientTransform`,`pathLength`,`startOffset`,`textLength`,`lengthAdjust`]);function qk(e,t,n,r){for(let n in Uk(e,t,void 0,r),t.attrs)e.setAttribute(Kk.has(n)?n:$O(n),t.attrs[n])}var Jk=class extends Hk{constructor(){super(...arguments),this.type=`svg`,this.isSVGTag=!1,this.measureInstanceViewportBox=Pk}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(KT.has(t)){let e=ZE(t);return e&&e.default||0}return t=Kk.has(t)?t:$O(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return YO(e,t,n)}build(e,t,n){PO(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,r){qk(e,t,n,r)}mount(e){this.isSVGTag=IO(e.tagName),super.mount(e)}},Yk=(e,n)=>n.isSVG??zO(e)?new Jk(n):new Gk(n,{allowProjection:e!==t.Fragment});function Xk(e,t,n){let r=e.getProps();return HO(r,t,n===void 0?r.custom:n,e)}var Zk=e=>Array.isArray(e);function Qk(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,lD(n))}function $k(e){return Zk(e)?e[e.length-1]||0:e}function eA(e,t){let{transitionEnd:n={},transition:r={},...i}=Xk(e,t)||{};for(let t in i={...i,...n},i)Qk(e,t,$k(i[t]))}function tA(e){return!!(AD(e)&&e.add)}function nA(e,t){let n=e.getValue(`willChange`);if(tA(n))return n.add(t);if(!n&&ZS.WillChange){let n=new ZS.WillChange(`auto`);e.addValue(`willChange`,n),n.add(t)}}function rA(e){return e.props[ek]}var iA=e=>e!==null;function aA(e,{repeat:t,repeatType:n=`loop`},r){let i=e.filter(iA),a=t&&n!==`loop`&&t%2==1?0:i.length-1;return!a||r===void 0?i[a]:r}var oA={type:`spring`,stiffness:500,damping:25,restSpeed:10},sA=e=>({type:`spring`,stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),cA={type:`keyframes`,duration:.8},lA={type:`keyframes`,ease:[.25,.1,.35,1],duration:.3},uA=(e,{keyframes:t})=>t.length>2?cA:KT.has(e)?e.startsWith(`scale`)?sA(t[1]):oA:lA;function dA({when:e,delay:t,delayChildren:n,staggerChildren:r,staggerDirection:i,repeat:a,repeatType:o,repeatDelay:s,from:c,elapsed:l,...u}){return!!Object.keys(u).length}var fA=(e,t,n,r={},i,a)=>o=>{let s=LE(r,e)||{},c=s.delay||r.delay||0,{elapsed:l=0}=r;l-=sC(c);let u={keyframes:Array.isArray(n)?n:[null,n],ease:`easeOut`,velocity:t.getVelocity(),...s,delay:-l,onUpdate:e=>{t.set(e),s.onUpdate&&s.onUpdate(e)},onComplete:()=>{o(),s.onComplete&&s.onComplete()},name:e,motionValue:t,element:a?void 0:i};dA(s)||Object.assign(u,uA(e,u)),u.duration&&=sC(u.duration),u.repeatDelay&&=sC(u.repeatDelay),u.from!==void 0&&(u.keyframes[0]=u.from);let d=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(DE(u),u.delay===0&&(d=!0)),(ZS.instantAnimations||ZS.skipAnimations)&&(d=!0,DE(u),u.delay=0),u.allowFlatten=!s.type&&!s.ease,d&&!a&&t.get()!==void 0){let e=aA(u.keyframes,s);if(e!==void 0){zC.update(()=>{u.onUpdate(e),u.onComplete()});return}}return s.isSync?new jT(u):new ME(u)};function pA({protectedKeys:e,needsAnimating:t},n){let r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function mA(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:a=e.getDefaultTransition(),transitionEnd:o,...s}=t;r&&(a=r);let c=[],l=i&&e.animationState&&e.animationState.getState()[i];for(let t in s){let r=e.getValue(t,e.latestValues[t]??null),i=s[t];if(i===void 0||l&&pA(l,t))continue;let o={delay:n,...LE(a||{},t)},u=r.get();if(u!==void 0&&!r.isAnimating&&!Array.isArray(i)&&i===u&&!o.velocity)continue;let d=!1;if(window.MotionHandoffAnimation){let n=rA(e);if(n){let e=window.MotionHandoffAnimation(n,t,zC);e!==null&&(o.startTime=e,d=!0)}}nA(e,t),r.start(fA(t,r,i,e.shouldReduceMotion&&RE.has(t)?{type:!1}:o,e,d));let f=r.animation;f&&c.push(f)}return o&&Promise.all(c).then(()=>{zC.update(()=>{o&&eA(e,o)})}),c}function hA(e,t,n,r=0,i=1){let a=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),o=e.size,s=(o-1)*r;return typeof n==`function`?n(a,o):i===1?a*r:s-a*r}function gA(e,t,n={}){let r=Xk(e,t,n.type===`exit`?e.presenceContext?.custom:void 0),{transition:i=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);let a=r?()=>Promise.all(mA(e,r,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(r=0)=>{let{delayChildren:a=0,staggerChildren:o,staggerDirection:s}=i;return _A(e,t,r,a,o,s,n)}:()=>Promise.resolve(),{when:s}=i;if(s){let[e,t]=s===`beforeChildren`?[a,o]:[o,a];return e().then(()=>t())}else return Promise.all([a(),o(n.delay)])}function _A(e,t,n=0,r=0,i=0,a=1,o){let s=[];for(let c of e.variantChildren)c.notify(`AnimationStart`,t),s.push(gA(c,t,{...o,delay:n+(typeof r==`function`?0:r)+hA(e.variantChildren,c,r,i,a)}).then(()=>c.notify(`AnimationComplete`,t)));return Promise.all(s)}function vA(e,t,n={}){e.notify(`AnimationStart`,t);let r;if(Array.isArray(t)){let i=t.map(t=>gA(e,t,n));r=Promise.all(i)}else if(typeof t==`string`)r=gA(e,t,n);else{let i=typeof t==`function`?Xk(e,t,n.custom):t;r=Promise.all(mA(e,i,n))}return r.then(()=>{e.notify(`AnimationComplete`,t)})}function yA(e,t){if(!Array.isArray(t))return!1;let n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}var bA=uO.length;function xA(e){if(!e)return;if(!e.isControllingVariants){let t=e.parent&&xA(e.parent)||{};return e.props.initial!==void 0&&(t.initial=e.props.initial),t}let t={};for(let n=0;n<bA;n++){let r=uO[n],i=e.props[r];(cO(i)||i===!1)&&(t[r]=i)}return t}var SA=[...lO].reverse(),CA=lO.length;function wA(e){return t=>Promise.all(t.map(({animation:t,options:n})=>vA(e,t,n)))}function TA(e){let t=wA(e),n=OA(),r=!0,i=t=>(n,r)=>{let i=Xk(e,r,t===`exit`?e.presenceContext?.custom:void 0);if(i){let{transition:e,transitionEnd:t,...r}=i;n={...n,...r,...t}}return n};function a(n){t=n(e)}function o(a){let{props:o}=e,s=xA(e.parent)||{},c=[],l=new Set,u={},d=1/0;for(let t=0;t<CA;t++){let f=SA[t],p=n[f],m=o[f]===void 0?s[f]:o[f],h=cO(m),g=f===a?p.isActive:null;g===!1&&(d=t);let _=m===s[f]&&m!==o[f]&&h;if(_&&r&&e.manuallyAnimateOnMount&&(_=!1),p.protectedKeys={...u},!p.isActive&&g===null||!m&&!p.prevProp||sO(m)||typeof m==`boolean`)continue;let v=EA(p.prevProp,m),y=v||f===a&&p.isActive&&!_&&h||t>d&&h,b=!1,x=Array.isArray(m)?m:[m],S=x.reduce(i(f),{});g===!1&&(S={});let{prevResolvedValues:C={}}=p,w={...C,...S},T=t=>{y=!0,l.has(t)&&(b=!0,l.delete(t)),p.needsAnimating[t]=!0;let n=e.getValue(t);n&&(n.liveStyle=!1)};for(let e in w){let t=S[e],n=C[e];if(u.hasOwnProperty(e))continue;let r=!1;r=Zk(t)&&Zk(n)?!yA(t,n):t!==n,r?t==null?l.add(e):T(e):t!==void 0&&l.has(e)?T(e):p.protectedKeys[e]=!0}p.prevProp=m,p.prevResolvedValues=S,p.isActive&&(u={...u,...S}),r&&e.blockInitialAnimation&&(y=!1);let E=_&&v;y&&(!E||b)&&c.push(...x.map(t=>{let n={type:f};if(typeof t==`string`&&r&&!E&&e.manuallyAnimateOnMount&&e.parent){let{parent:r}=e,i=Xk(r,t);if(r.enteringChildren&&i){let{delayChildren:t}=i.transition||{};n.delay=hA(r.enteringChildren,e,t)}}return{animation:t,options:n}}))}if(l.size){let t={};if(typeof o.initial!=`boolean`){let n=Xk(e,Array.isArray(o.initial)?o.initial[0]:o.initial);n&&n.transition&&(t.transition=n.transition)}l.forEach(n=>{let r=e.getBaseTarget(n),i=e.getValue(n);i&&(i.liveStyle=!0),t[n]=r??null}),c.push({animation:t})}let f=!!c.length;return r&&(o.initial===!1||o.initial===o.animate)&&!e.manuallyAnimateOnMount&&(f=!1),r=!1,f?t(c):Promise.resolve()}function s(t,r){if(n[t].isActive===r)return Promise.resolve();e.variantChildren?.forEach(e=>e.animationState?.setActive(t,r)),n[t].isActive=r;let i=o(t);for(let e in n)n[e].protectedKeys={};return i}return{animateChanges:o,setActive:s,setAnimateFunction:a,getState:()=>n,reset:()=>{n=OA()}}}function EA(e,t){return typeof t==`string`?t!==e:Array.isArray(t)?!yA(t,e):!1}function DA(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function OA(){return{animate:DA(!0),whileInView:DA(),whileHover:DA(),whileTap:DA(),whileDrag:DA(),whileFocus:DA(),exit:DA()}}var kA=class{constructor(e){this.isMounted=!1,this.node=e}update(){}},AA=class extends kA{constructor(e){super(e),e.animationState||=TA(e)}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();sO(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}},jA=0,MA={animation:{Feature:AA},exit:{Feature:class extends kA{constructor(){super(...arguments),this.id=jA++}update(){if(!this.node.presenceContext)return;let{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;let r=this.node.animationState.setActive(`exit`,!e);t&&!e&&r.then(()=>{t(this.id)})}mount(){let{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}}};function NA(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}function PA(e){return{point:{x:e.pageX,y:e.pageY}}}var FA=e=>t=>yD(t)&&e(t,PA(t));function IA(e,t,n,r){return NA(e,t,FA(n),r)}var LA=1e-4,RA=1-LA,zA=1+LA,BA=.01,VA=0-BA,HA=0+BA;function UA(e){return e.max-e.min}function WA(e,t,n){return Math.abs(e-t)<=n}function GA(e,t,n,r=.5){e.origin=r,e.originPoint=Rw(t.min,t.max,e.origin),e.scale=UA(n)/UA(t),e.translate=Rw(n.min,n.max,e.origin)-e.originPoint,(e.scale>=RA&&e.scale<=zA||isNaN(e.scale))&&(e.scale=1),(e.translate>=VA&&e.translate<=HA||isNaN(e.translate))&&(e.translate=0)}function KA(e,t,n,r){GA(e.x,t.x,n.x,r?r.originX:void 0),GA(e.y,t.y,n.y,r?r.originY:void 0)}function qA(e,t,n){e.min=n.min+t.min,e.max=e.min+UA(t)}function JA(e,t,n){qA(e.x,t.x,n.x),qA(e.y,t.y,n.y)}function YA(e,t,n){e.min=t.min-n.min,e.max=e.min+UA(t)}function XA(e,t,n){YA(e.x,t.x,n.x),YA(e.y,t.y,n.y)}function ZA(e){return[e(`x`),e(`y`)]}var QA=({current:e})=>e?e.ownerDocument.defaultView:null,$A=(e,t)=>Math.abs(e-t);function ej(e,t){let n=$A(e.x,t.x),r=$A(e.y,t.y);return Math.sqrt(n**2+r**2)}var tj=new Set([`auto`,`scroll`]),nj=class{constructor(e,t,{transformPagePoint:n,contextWindow:r=window,dragSnapToOrigin:i=!1,distanceThreshold:a=3,element:o}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=e=>{this.handleScroll(e.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let e=aj(this.lastMoveEventInfo,this.history),t=this.startEvent!==null,n=ej(e.offset,{x:0,y:0})>=this.distanceThreshold;if(!t&&!n)return;let{point:r}=e,{timestamp:i}=VC;this.history.push({...r,timestamp:i});let{onStart:a,onMove:o}=this.handlers;t||(a&&a(this.lastMoveEvent,e),this.startEvent=this.lastMoveEvent),o&&o(this.lastMoveEvent,e)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastMoveEventInfo=rj(t,this.transformPagePoint),zC.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.end();let{onEnd:n,onSessionEnd:r,resumeAnimation:i}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&i&&i(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let a=aj(e.type===`pointercancel`?this.lastMoveEventInfo:rj(t,this.transformPagePoint),this.history);this.startEvent&&n&&n(e,a),r&&r(e,a)},!yD(e))return;this.dragSnapToOrigin=i,this.handlers=t,this.transformPagePoint=n,this.distanceThreshold=a,this.contextWindow=r||window;let s=rj(PA(e),this.transformPagePoint),{point:c}=s,{timestamp:l}=VC;this.history=[{...c,timestamp:l}];let{onSessionStart:u}=t;u&&u(e,aj(s,this.history)),this.removeListeners=iC(IA(this.contextWindow,`pointermove`,this.handlePointerMove),IA(this.contextWindow,`pointerup`,this.handlePointerUp),IA(this.contextWindow,`pointercancel`,this.handlePointerUp)),o&&this.startScrollTracking(o)}startScrollTracking(e){let t=e.parentElement;for(;t;){let e=getComputedStyle(t);(tj.has(e.overflowX)||tj.has(e.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener(`scroll`,this.onElementScroll,{capture:!0,passive:!0}),window.addEventListener(`scroll`,this.onWindowScroll,{passive:!0}),this.removeScrollListeners=()=>{window.removeEventListener(`scroll`,this.onElementScroll,{capture:!0}),window.removeEventListener(`scroll`,this.onWindowScroll)}}handleScroll(e){let t=this.scrollPositions.get(e);if(!t)return;let n=e===window,r=n?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},i={x:r.x-t.x,y:r.y-t.y};i.x===0&&i.y===0||(n?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=i.x,this.lastMoveEventInfo.point.y+=i.y):this.history.length>0&&(this.history[0].x-=i.x,this.history[0].y-=i.y),this.scrollPositions.set(e,r),zC.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),BC(this.updatePoint)}};function rj(e,t){return t?{point:t(e.point)}:e}function ij(e,t){return{x:e.x-t.x,y:e.y-t.y}}function aj({point:e},t){return{point:e,delta:ij(e,sj(t)),offset:ij(e,oj(t)),velocity:cj(t,.1)}}function oj(e){return e[0]}function sj(e){return e[e.length-1]}function cj(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null,i=sj(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>sC(t)));)n--;if(!r)return{x:0,y:0};let a=cC(i.timestamp-r.timestamp);if(a===0)return{x:0,y:0};let o={x:(i.x-r.x)/a,y:(i.y-r.y)/a};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function lj(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?Rw(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?Rw(n,e,r.max):Math.min(e,n)),e}function uj(e,t,n){return{min:t===void 0?void 0:e.min+t,max:n===void 0?void 0:e.max+n-(e.max-e.min)}}function dj(e,{top:t,left:n,bottom:r,right:i}){return{x:uj(e.x,n,i),y:uj(e.y,t,r)}}function fj(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function pj(e,t){return{x:fj(e.x,t.x),y:fj(e.y,t.y)}}function mj(e,t){let n=.5,r=UA(e),i=UA(t);return i>r?n=aC(t.min,t.max-r,e.min):r>i&&(n=aC(e.min,e.max-i,t.min)),qS(0,1,n)}function hj(e,t){let n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}var gj=.35;function _j(e=gj){return e===!1?e=0:e===!0&&(e=gj),{x:vj(e,`left`,`right`),y:vj(e,`top`,`bottom`)}}function vj(e,t,n){return{min:yj(e,t),max:yj(e,n)}}function yj(e,t){return typeof e==`number`?e:e[t]||0}var bj=new WeakMap,xj=class{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Pk(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:n}={}){let{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;let i=e=>{t?(this.stopAnimation(),this.snapToCursor(PA(e).point)):this.pauseAnimation()},a=(e,t)=>{this.stopAnimation();let{drag:n,dragPropagation:r,onDragStart:i}=this.getProps();if(n&&!r&&(this.openDragLock&&this.openDragLock(),this.openDragLock=mD(n),!this.openDragLock))return;this.latestPointerEvent=e,this.latestPanInfo=t,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),ZA(e=>{let t=this.getAxisMotionValue(e).get()||0;if(hw.test(t)){let{projection:n}=this.visualElement;if(n&&n.layout){let r=n.layout.layoutBox[e];r&&(t=UA(r)*(parseFloat(t)/100))}}this.originPoint[e]=t}),i&&zC.postRender(()=>i(e,t)),nA(this.visualElement,`transform`);let{animationState:a}=this.visualElement;a&&a.setActive(`whileDrag`,!0)},o=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t;let{dragPropagation:n,dragDirectionLock:r,onDirectionLock:i,onDrag:a}=this.getProps();if(!n&&!this.openDragLock)return;let{offset:o}=t;if(r&&this.currentDirection===null){this.currentDirection=Cj(o),this.currentDirection!==null&&i&&i(this.currentDirection);return}this.updateAxis(`x`,t.point,o),this.updateAxis(`y`,t.point,o),this.visualElement.render(),a&&a(e,t)},s=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},c=()=>ZA(e=>this.getAnimationState(e)===`paused`&&this.getAxisMotionValue(e).animation?.play()),{dragSnapToOrigin:l}=this.getProps();this.panSession=new nj(e,{onSessionStart:i,onStart:a,onMove:o,onSessionEnd:s,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,distanceThreshold:n,contextWindow:QA(this.visualElement),element:this.visualElement.current})}stop(e,t){let n=e||this.latestPointerEvent,r=t||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!r||!n)return;let{velocity:a}=r;this.startAnimation(a);let{onDragEnd:o}=this.getProps();o&&zC.postRender(()=>o(n,r))}cancel(){this.isDragging=!1;let{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;let{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive(`whileDrag`,!1)}updateAxis(e,t,n){let{drag:r}=this.getProps();if(!n||!Sj(e,r,this.currentDirection))return;let i=this.getAxisMotionValue(e),a=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(a=lj(a,this.constraints[e],this.elastic[e])),i.set(a)}resolveConstraints(){let{dragConstraints:e,dragElastic:t}=this.getProps(),n=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,r=this.constraints;e&&nk(e)?this.constraints||=this.resolveRefConstraints():e&&n?this.constraints=dj(n.layoutBox,e):this.constraints=!1,this.elastic=_j(t),r!==this.constraints&&n&&this.constraints&&!this.hasMutatedConstraints&&ZA(e=>{this.constraints!==!1&&this.getAxisMotionValue(e)&&(this.constraints[e]=hj(n.layoutBox[e],this.constraints[e]))})}resolveRefConstraints(){let{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!nk(e))return!1;let n=e.current;XS(n!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.",`drag-constraints-ref`);let{projection:r}=this.visualElement;if(!r||!r.layout)return!1;let i=Ak(n,r.root,this.visualElement.getTransformPagePoint()),a=pj(r.layout.layoutBox,i);if(t){let e=t(fk(a));this.hasMutatedConstraints=!!e,e&&(a=dk(e))}return a}startAnimation(e){let{drag:t,dragMomentum:n,dragElastic:r,dragTransition:i,dragSnapToOrigin:a,onDragTransitionEnd:o}=this.getProps(),s=this.constraints||{},c=ZA(o=>{if(!Sj(o,t,this.currentDirection))return;let c=s&&s[o]||{};a&&(c={min:0,max:0});let l=r?200:1e6,u=r?40:1e7,d={type:`inertia`,velocity:n?e[o]:0,bounceStiffness:l,bounceDamping:u,timeConstant:750,restDelta:1,restSpeed:10,...i,...c};return this.startAxisValueAnimation(o,d)});return Promise.all(c).then(o)}startAxisValueAnimation(e,t){let n=this.getAxisMotionValue(e);return nA(this.visualElement,e),n.start(fA(e,n,0,t,this.visualElement,!1))}stopAnimation(){ZA(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){ZA(e=>this.getAxisMotionValue(e).animation?.pause())}getAnimationState(e){return this.getAxisMotionValue(e).animation?.state}getAxisMotionValue(e){let t=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps();return n[t]||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){ZA(t=>{let{drag:n}=this.getProps();if(!Sj(t,n,this.currentDirection))return;let{projection:r}=this.visualElement,i=this.getAxisMotionValue(t);if(r&&r.layout){let{min:n,max:a}=r.layout.layoutBox[t],o=i.get()||0;i.set(e[t]-Rw(n,a,.5)+o)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:e,dragConstraints:t}=this.getProps(),{projection:n}=this.visualElement;if(!nk(t)||!n||!this.constraints)return;this.stopAnimation();let r={x:0,y:0};ZA(e=>{let t=this.getAxisMotionValue(e);if(t&&this.constraints!==!1){let n=t.get();r[e]=mj({min:n,max:n},this.constraints[e])}});let{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},``):`none`,n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),ZA(t=>{if(!Sj(t,e,null))return;let n=this.getAxisMotionValue(t),{min:i,max:a}=this.constraints[t];n.set(Rw(i,a,r[t]))})}addListeners(){if(!this.visualElement.current)return;bj.set(this.visualElement,this);let e=this.visualElement.current,t=IA(e,`pointerdown`,e=>{let{drag:t,dragListener:n=!0}=this.getProps();t&&n&&!xD(e.target)&&this.start(e)}),n=()=>{let{dragConstraints:e}=this.getProps();nk(e)&&e.current&&(this.constraints=this.resolveRefConstraints())},{projection:r}=this.visualElement,i=r.addEventListener(`measure`,n);r&&!r.layout&&(r.root&&r.root.updateScroll(),r.updateLayout()),zC.read(n);let a=NA(window,`resize`,()=>this.scalePositionWithinConstraints()),o=r.addEventListener(`didUpdate`,(({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(ZA(t=>{let n=this.getAxisMotionValue(t);n&&(this.originPoint[t]+=e[t].translate,n.set(n.get()+e[t].translate))}),this.visualElement.render())}));return()=>{a(),t(),i(),o&&o()}}getProps(){let e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:n=!1,dragPropagation:r=!1,dragConstraints:i=!1,dragElastic:a=gj,dragMomentum:o=!0}=e;return{...e,drag:t,dragDirectionLock:n,dragPropagation:r,dragConstraints:i,dragElastic:a,dragMomentum:o}}};function Sj(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function Cj(e,t=10){let n=null;return Math.abs(e.y)>t?n=`y`:Math.abs(e.x)>t&&(n=`x`),n}var wj=class extends kA{constructor(e){super(e),this.removeGroupControls=nC,this.removeListeners=nC,this.controls=new xj(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||nC}update(){let{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners()}},Tj=e=>(t,n)=>{e&&zC.postRender(()=>e(t,n))},Ej=class extends kA{constructor(){super(...arguments),this.removePointerDownListener=nC}onPointerDown(e){this.session=new nj(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:QA(this.node)})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:Tj(e),onStart:Tj(t),onMove:n,onEnd:(e,t)=>{delete this.session,r&&zC.postRender(()=>r(e,t))}}}mount(){this.removePointerDownListener=IA(this.node.current,`pointerdown`,e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}},Dj={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Oj=!1,kj=class extends t.Component{componentDidMount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n,layoutId:r}=this.props,{projection:i}=e;i&&(t.group&&t.group.add(i),n&&n.register&&r&&n.register(i),Oj&&i.root.didUpdate(),i.addEventListener(`animationComplete`,()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),Dj.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layoutDependency:t,visualElement:n,drag:r,isPresent:i}=this.props,{projection:a}=n;return a?(a.isPresent=i,Oj=!0,r||e.layoutDependency!==t||t===void 0||e.isPresent!==i?a.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?a.promote():a.relegate()||zC.postRender(()=>{let e=a.getStack();(!e||!e.members.length)&&this.safeToRemove()})),null):null}componentDidUpdate(){let{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),uD.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:r}=e;Oj=!0,r&&(r.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(r),n&&n.deregister&&n.deregister(r))}safeToRemove(){let{safeToRemove:e}=this.props;e&&e()}render(){return null}};function Aj(e){let[n,i]=VD(),a=(0,t.useContext)(BS);return(0,r.jsx)(kj,{...e,layoutGroup:a,switchLayoutGroup:(0,t.useContext)(tk),isPresent:n,safeToRemove:i})}function jj(e,t,n){let r=AD(e)?e:lD(e);return r.start(fA(``,r,t,n)),r.animation}var Mj=(e,t)=>e.depth-t.depth,Nj=class{constructor(){this.children=[],this.isDirty=!1}add(e){GS(this.children,e),this.isDirty=!0}remove(e){KS(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Mj),this.isDirty=!1,this.children.forEach(e)}};function Pj(e,t){let n=GC.now(),r=({timestamp:i})=>{let a=i-n;a>=t&&(BC(r),e(a-t))};return zC.setup(r,!0),()=>BC(r)}var Fj=[`TopLeft`,`TopRight`,`BottomLeft`,`BottomRight`],Ij=Fj.length,Lj=e=>typeof e==`string`?parseFloat(e):e,Rj=e=>typeof e==`number`||Q.test(e);function zj(e,t,n,r,i,a){i?(e.opacity=Rw(0,n.opacity??1,Vj(r)),e.opacityExit=Rw(t.opacity??1,0,Hj(r))):a&&(e.opacity=Rw(t.opacity??1,n.opacity??1,r));for(let i=0;i<Ij;i++){let a=`border${Fj[i]}Radius`,o=Bj(t,a),s=Bj(n,a);o===void 0&&s===void 0||(o||=0,s||=0,o===0||s===0||Rj(o)===Rj(s)?(e[a]=Math.max(Rw(Lj(o),Lj(s),r),0),(hw.test(s)||hw.test(o))&&(e[a]+=`%`)):e[a]=s)}(t.rotate||n.rotate)&&(e.rotate=Rw(t.rotate||0,n.rotate||0,r))}function Bj(e,t){return e[t]===void 0?e.borderRadius:e[t]}var Vj=Uj(0,.5,wC),Hj=Uj(.5,.95,nC);function Uj(e,t,n){return r=>r<e?0:r>t?1:n(aC(e,t,r))}function Wj(e,t){e.min=t.min,e.max=t.max}function Gj(e,t){Wj(e.x,t.x),Wj(e.y,t.y)}function Kj(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function qj(e,t,n,r,i){return e-=t,e=yk(e,1/n,r),i!==void 0&&(e=yk(e,1/i,r)),e}function Jj(e,t=0,n=1,r=.5,i,a=e,o=e){if(hw.test(t)&&(t=parseFloat(t),t=Rw(o.min,o.max,t/100)-o.min),typeof t!=`number`)return;let s=Rw(a.min,a.max,r);e===a&&(s-=t),e.min=qj(e.min,t,n,s,i),e.max=qj(e.max,t,n,s,i)}function Yj(e,t,[n,r,i],a,o){Jj(e,t[n],t[r],t[i],t.scale,a,o)}var Xj=[`x`,`scaleX`,`originX`],Zj=[`y`,`scaleY`,`originY`];function Qj(e,t,n,r){Yj(e.x,t,Xj,n?n.x:void 0,r?r.x:void 0),Yj(e.y,t,Zj,n?n.y:void 0,r?r.y:void 0)}function $j(e){return e.translate===0&&e.scale===1}function eM(e){return $j(e.x)&&$j(e.y)}function tM(e,t){return e.min===t.min&&e.max===t.max}function nM(e,t){return tM(e.x,t.x)&&tM(e.y,t.y)}function rM(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function iM(e,t){return rM(e.x,t.x)&&rM(e.y,t.y)}function aM(e){return UA(e.x)/UA(e.y)}function oM(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}var sM=class{constructor(){this.members=[]}add(e){GS(this.members,e),e.scheduleRender()}remove(e){if(KS(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){let e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){let t=this.members.findIndex(t=>e===t);if(t===0)return!1;let n;for(let e=t;e>=0;e--){let t=this.members[e];if(t.isPresent!==!1){n=t;break}}return n?(this.promote(n),!0):!1}promote(e,t){let n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.instance&&n.scheduleRender(),e.scheduleRender(),e.resumeFrom=n,t&&(e.resumeFrom.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);let{crossfade:r}=e.options;r===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{let{options:t,resumingFrom:n}=e;t.onExitComplete&&t.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}};function cM(e,t,n){let r=``,i=e.x.translate/t.x,a=e.y.translate/t.y,o=n?.z||0;if((i||a||o)&&(r=`translate3d(${i}px, ${a}px, ${o}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){let{transformPerspective:e,rotate:t,rotateX:i,rotateY:a,skewX:o,skewY:s}=n;e&&(r=`perspective(${e}px) ${r}`),t&&(r+=`rotate(${t}deg) `),i&&(r+=`rotateX(${i}deg) `),a&&(r+=`rotateY(${a}deg) `),o&&(r+=`skewX(${o}deg) `),s&&(r+=`skewY(${s}deg) `)}let s=e.x.scale*t.x,c=e.y.scale*t.y;return(s!==1||c!==1)&&(r+=`scale(${s}, ${c})`),r||`none`}var lM={nodes:0,calculatedTargetDeltas:0,calculatedProjections:0},uM=[``,`X`,`Y`,`Z`],dM=1e3,fM=0;function pM(e,t,n,r){let{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function mM(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;let{visualElement:t}=e.options;if(!t)return;let n=rA(t);if(window.MotionHasOptimisedAnimation(n,`transform`)){let{layout:t,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,`transform`,zC,!(t||r))}let{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&mM(r)}function hM({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(e={},n=t?.()){this.id=fM++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,FC.value&&(lM.nodes=lM.calculatedTargetDeltas=lM.calculatedProjections=0),this.nodes.forEach(vM),this.nodes.forEach(TM),this.nodes.forEach(EM),this.nodes.forEach(yM),FC.addProjectionMetrics&&FC.addProjectionMetrics(lM)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=n?n.root||n:this,this.path=n?[...n.path,n]:[],this.parent=n,this.depth=n?n.depth+1:0;for(let e=0;e<this.path.length;e++)this.path[e].shouldResetTransform=!0;this.root===this&&(this.nodes=new Nj)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new oC),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){let n=this.eventHandlers.get(e);n&&n.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t){if(this.instance)return;this.isSVG=OD(t)&&!kD(t),this.instance=t;let{layoutId:n,layout:r,visualElement:i}=this.options;if(i&&!i.current&&i.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(r||n)&&(this.isLayoutDirty=!0),e){let n,r=0,i=()=>this.root.updateBlockedByResize=!1;zC.read(()=>{r=window.innerWidth}),e(t,()=>{let e=window.innerWidth;e!==r&&(r=e,this.root.updateBlockedByResize=!0,n&&n(),n=Pj(i,250),Dj.hasAnimatedSinceResize&&(Dj.hasAnimatedSinceResize=!1,this.nodes.forEach(wM)))})}n&&this.root.registerSharedNode(n,this),this.options.animate!==!1&&i&&(n||r)&&this.addEventListener(`didUpdate`,({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:n,layout:r})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let a=this.options.transition||i.getDefaultTransition()||NM,{onLayoutAnimationStart:o,onLayoutAnimationComplete:s}=i.getProps(),c=!this.targetLayout||!iM(this.targetLayout,r),l=!t&&n;if(this.options.layoutRoot||this.resumeFrom||l||t&&(c||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);let t={...LE(a,`layout`),onPlay:o,onComplete:s};(i.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,l)}else t||wM(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=r})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),BC(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(DM),this.animationId++)}getTransformTemplate(){let{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&mM(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let e=0;e<this.path.length;e++){let t=this.path[e];t.shouldResetTransform=!0,t.updateScroll(`snapshot`),t.options.layoutRoot&&t.willUpdate(!1)}let{layoutId:t,layout:n}=this.options;if(t===void 0&&!n)return;let r=this.getTransformTemplate();this.prevTransformTemplateValue=r?r(this.latestValues,``):void 0,this.updateSnapshot(),e&&this.notifyListeners(`willUpdate`)}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(xM);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(SM);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(CM),this.nodes.forEach(gM),this.nodes.forEach(_M)):this.nodes.forEach(SM),this.clearAllSnapshots();let e=GC.now();VC.delta=qS(0,1e3/60,e-VC.timestamp),VC.timestamp=e,VC.isProcessing=!0,HC.update.process(VC),HC.preRender.process(VC),HC.render.process(VC),VC.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,uD.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(bM),this.sharedNodes.forEach(OM)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,zC.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){zC.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!UA(this.snapshot.measuredBox.x)&&!UA(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let e=0;e<this.path.length;e++)this.path[e].updateScroll();let e=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=Pk(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners(`measure`,this.layout.layoutBox);let{visualElement:t}=this.options;t&&t.notify(`LayoutMeasure`,this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e=`measure`){let t=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t&&this.instance){let t=r(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!i)return;let e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!eM(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,``):void 0,a=r!==this.prevTransformTemplateValue;e&&this.instance&&(t||gk(this.latestValues)||a)&&(i(this.instance,r),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){let t=this.measurePageBox(),n=this.removeElementScroll(t);return e&&(n=this.removeTransform(n)),LM(n),{animationId:this.root.animationId,measuredBox:t,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:e}=this.options;if(!e)return Pk();let t=e.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(zM))){let{scroll:e}=this.root;e&&(Ek(t.x,e.offset.x),Ek(t.y,e.offset.y))}return t}removeElementScroll(e){let t=Pk();if(Gj(t,e),this.scroll?.wasRoot)return t;for(let n=0;n<this.path.length;n++){let r=this.path[n],{scroll:i,options:a}=r;r!==this.root&&i&&a.layoutScroll&&(i.wasRoot&&Gj(t,e),Ek(t.x,i.offset.x),Ek(t.y,i.offset.y))}return t}applyTransform(e,t=!1){let n=Pk();Gj(n,e);for(let e=0;e<this.path.length;e++){let r=this.path[e];!t&&r.options.layoutScroll&&r.scroll&&r!==r.root&&Ok(n,{x:-r.scroll.offset.x,y:-r.scroll.offset.y}),gk(r.latestValues)&&Ok(n,r.latestValues)}return gk(this.latestValues)&&Ok(n,this.latestValues),n}removeTransform(e){let t=Pk();Gj(t,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];if(!n.instance||!gk(n.latestValues))continue;hk(n.latestValues)&&n.updateSnapshot();let r=Pk();Gj(r,n.measurePageBox()),Qj(t,n.latestValues,n.snapshot?n.snapshot.layoutBox:void 0,r)}return gk(this.latestValues)&&Qj(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:e.crossfade===void 0?!0:e.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==VC.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){let t=this.getLead();this.isProjectionDirty||=t.isProjectionDirty,this.isTransformDirty||=t.isTransformDirty,this.isSharedProjectionDirty||=t.isSharedProjectionDirty;let n=!!this.resumingFrom||this!==t;if(!(e||n&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;let{layout:r,layoutId:i}=this.options;if(!this.layout||!(r||i))return;this.resolvedRelativeTargetAt=VC.timestamp;let a=this.getClosestProjectingParent();a&&this.linkedParentVersion!==a.layoutVersion&&!a.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(a&&a.layout?this.createRelativeTarget(a,this.layout.layoutBox,a.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=Pk(),this.targetWithTransforms=Pk()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),JA(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Gj(this.target,this.layout.layoutBox),Sk(this.target,this.targetDelta)):Gj(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,a&&!!a.resumingFrom==!!this.resumingFrom&&!a.options.layoutScroll&&a.target&&this.animationProgress!==1?this.createRelativeTarget(a,this.target,a.target):this.relativeParent=this.relativeTarget=void 0),FC.value&&lM.calculatedTargetDeltas++)}getClosestProjectingParent(){if(!(!this.parent||hk(this.parent.latestValues)||_k(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(e,t,n){this.relativeParent=e,this.linkedParentVersion=e.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Pk(),this.relativeTargetOrigin=Pk(),XA(this.relativeTargetOrigin,t,n),Gj(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){let e=this.getLead(),t=!!this.resumingFrom||this!==e,n=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(n=!1),t&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(n=!1),this.resolvedRelativeTargetAt===VC.timestamp&&(n=!1),n)return;let{layout:r,layoutId:i}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(r||i))return;Gj(this.layoutCorrected,this.layout.layoutBox);let a=this.treeScale.x,o=this.treeScale.y;Tk(this.layoutCorrected,this.treeScale,this.path,t),e.layout&&!e.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(e.target=e.layout.layoutBox,e.targetWithTransforms=Pk());let{target:s}=e;if(!s){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Kj(this.prevProjectionDelta.x,this.projectionDelta.x),Kj(this.prevProjectionDelta.y,this.projectionDelta.y)),KA(this.projectionDelta,this.layoutCorrected,s,this.latestValues),(this.treeScale.x!==a||this.treeScale.y!==o||!oM(this.projectionDelta.x,this.prevProjectionDelta.x)||!oM(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners(`projectionUpdate`,s)),FC.value&&lM.calculatedProjections++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){if(this.options.visualElement?.scheduleRender(),e){let e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Mk(),this.projectionDelta=Mk(),this.projectionDeltaWithTransform=Mk()}setAnimationOrigin(e,t=!1){let n=this.snapshot,r=n?n.latestValues:{},i={...this.latestValues},a=Mk();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let o=Pk(),s=(n?n.source:void 0)!==(this.layout?this.layout.source:void 0),c=this.getStack(),l=!c||c.members.length<=1,u=!!(s&&!l&&this.options.crossfade===!0&&!this.path.some(MM));this.animationProgress=0;let d;this.mixTargetDelta=t=>{let n=t/1e3;kM(a.x,e.x,n),kM(a.y,e.y,n),this.setTargetDelta(a),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(XA(o,this.layout.layoutBox,this.relativeParent.layout.layoutBox),jM(this.relativeTarget,this.relativeTargetOrigin,o,n),d&&nM(this.relativeTarget,d)&&(this.isProjectionDirty=!1),d||=Pk(),Gj(d,this.relativeTarget)),s&&(this.animationValues=i,zj(i,r,this.latestValues,n,u,l)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(e){this.notifyListeners(`animationStart`),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&=(BC(this.pendingAnimation),void 0),this.pendingAnimation=zC.update(()=>{Dj.hasAnimatedSinceResize=!0,KC.layout++,this.motionValue||=lD(0),this.currentAnimation=jj(this.motionValue,[0,1e3],{...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onStop:()=>{KC.layout--},onComplete:()=>{KC.layout--,e.onComplete&&e.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners(`animationComplete`)}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(dM),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let e=this.getLead(),{targetWithTransforms:t,target:n,layout:r,latestValues:i}=e;if(!(!t||!n||!r)){if(this!==e&&this.layout&&r&&RM(this.options.animationType,this.layout.layoutBox,r.layoutBox)){n=this.target||Pk();let t=UA(this.layout.layoutBox.x);n.x.min=e.target.x.min,n.x.max=n.x.min+t;let r=UA(this.layout.layoutBox.y);n.y.min=e.target.y.min,n.y.max=n.y.min+r}Gj(t,n),Ok(t,i),KA(this.projectionDeltaWithTransform,this.layoutCorrected,t,i)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new sM),this.sharedNodes.get(e).add(t);let n=t.options.initialPromotionConfig;t.promote({transition:n?n.transition:void 0,preserveFollowOpacity:n&&n.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(t):void 0})}isLead(){let e=this.getStack();return e?e.lead===this:!0}getLead(){let{layoutId:e}=this.options;return e&&this.getStack()?.lead||this}getPrevLead(){let{layoutId:e}=this.options;return e?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:n}={}){let r=this.getStack();r&&r.promote(this,n),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){let e=this.getStack();return e?e.relegate(this):!1}resetSkewAndRotation(){let{visualElement:e}=this.options;if(!e)return;let t=!1,{latestValues:n}=e;if((n.z||n.rotate||n.rotateX||n.rotateY||n.rotateZ||n.skewX||n.skewY)&&(t=!0),!t)return;let r={};n.z&&pM(`z`,e,r,this.animationValues);for(let t=0;t<uM.length;t++)pM(`rotate${uM[t]}`,e,r,this.animationValues),pM(`skew${uM[t]}`,e,r,this.animationValues);for(let t in e.render(),r)e.setStaticValue(t,r[t]),this.animationValues&&(this.animationValues[t]=r[t]);e.scheduleRender()}applyProjectionStyles(e,t){if(!this.instance||this.isSVG)return;if(!this.isVisible){e.visibility=`hidden`;return}let n=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,e.visibility=``,e.opacity=``,e.pointerEvents=UO(t?.pointerEvents)||``,e.transform=n?n(this.latestValues,``):`none`;return}let r=this.getLead();if(!this.projectionDelta||!this.layout||!r.target){this.options.layoutId&&(e.opacity=this.latestValues.opacity===void 0?1:this.latestValues.opacity,e.pointerEvents=UO(t?.pointerEvents)||``),this.hasProjected&&!gk(this.latestValues)&&(e.transform=n?n({},``):`none`,this.hasProjected=!1);return}e.visibility=``;let i=r.animationValues||r.latestValues;this.applyTransformsToTarget();let a=cM(this.projectionDeltaWithTransform,this.treeScale,i);n&&(a=n(i,a)),e.transform=a;let{x:o,y:s}=this.projectionDelta;for(let t in e.transformOrigin=`${o.origin*100}% ${s.origin*100}% 0`,r.animationValues?e.opacity=r===this?i.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:i.opacityExit:e.opacity=r===this?i.opacity===void 0?``:i.opacity:i.opacityExit===void 0?0:i.opacityExit,yO){if(i[t]===void 0)continue;let{correct:n,applyTo:o,isCSSVariable:s}=yO[t],c=a===`none`?i[t]:n(i[t],r);if(o){let t=o.length;for(let n=0;n<t;n++)e[o[n]]=c}else s?this.options.visualElement.renderState.vars[t]=c:e[t]=c}this.options.layoutId&&(e.pointerEvents=r===this?UO(t?.pointerEvents)||``:`none`)}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(xM),this.root.sharedNodes.clear()}}}function gM(e){e.updateLayout()}function _M(e){let t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners(`didUpdate`)){let{layoutBox:n,measuredBox:r}=e.layout,{animationType:i}=e.options,a=t.source!==e.layout.source;i===`size`?ZA(e=>{let r=a?t.measuredBox[e]:t.layoutBox[e],i=UA(r);r.min=n[e].min,r.max=r.min+i}):RM(i,t.layoutBox,n)&&ZA(r=>{let i=a?t.measuredBox[r]:t.layoutBox[r],o=UA(n[r]);i.max=i.min+o,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[r].max=e.relativeTarget[r].min+o)});let o=Mk();KA(o,n,t.layoutBox);let s=Mk();a?KA(s,e.applyTransform(r,!0),t.measuredBox):KA(s,n,t.layoutBox);let c=!eM(o),l=!1;if(!e.resumeFrom){let r=e.getClosestProjectingParent();if(r&&!r.resumeFrom){let{snapshot:i,layout:a}=r;if(i&&a){let o=Pk();XA(o,t.layoutBox,i.layoutBox);let s=Pk();XA(s,n,a.layoutBox),iM(o,s)||(l=!0),r.options.layoutRoot&&(e.relativeTarget=s,e.relativeTargetOrigin=o,e.relativeParent=r)}}}e.notifyListeners(`didUpdate`,{layout:n,snapshot:t,delta:s,layoutDelta:o,hasLayoutChanged:c,hasRelativeLayoutChanged:l})}else if(e.isLead()){let{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function vM(e){FC.value&&lM.nodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty),e.isTransformDirty||=e.parent.isTransformDirty)}function yM(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function bM(e){e.clearSnapshot()}function xM(e){e.clearMeasurements()}function SM(e){e.isLayoutDirty=!1}function CM(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify(`BeforeLayoutMeasure`),e.resetTransform()}function wM(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function TM(e){e.resolveTargetDelta()}function EM(e){e.calcProjection()}function DM(e){e.resetSkewAndRotation()}function OM(e){e.removeLeadSnapshot()}function kM(e,t,n){e.translate=Rw(t.translate,0,n),e.scale=Rw(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function AM(e,t,n,r){e.min=Rw(t.min,n.min,r),e.max=Rw(t.max,n.max,r)}function jM(e,t,n,r){AM(e.x,t.x,n.x,r),AM(e.y,t.y,n.y,r)}function MM(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}var NM={duration:.45,ease:[.4,0,.1,1]},PM=e=>typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),FM=PM(`applewebkit/`)&&!PM(`chrome/`)?Math.round:nC;function IM(e){e.min=FM(e.min),e.max=FM(e.max)}function LM(e){IM(e.x),IM(e.y)}function RM(e,t,n){return e===`position`||e===`preserve-aspect`&&!WA(aM(t),aM(n),.2)}function zM(e){return e!==e.root&&e.scroll?.wasRoot}var BM=hM({attachResizeListener:(e,t)=>NA(e,`resize`,t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),VM={current:void 0},HM=hM({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!VM.current){let e=new BM({});e.mount(window),e.setOptions({layoutScroll:!0}),VM.current=e}return VM.current},resetTransform:(e,t)=>{e.style.transform=t===void 0?`none`:t},checkIsScrollRoot:e=>window.getComputedStyle(e).position===`fixed`}),UM={pan:{Feature:Ej},drag:{Feature:wj,ProjectionNode:HM,MeasureLayout:Aj}};function WM(e,t,n){let{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive(`whileHover`,n===`Start`);let i=r[`onHover`+n];i&&zC.postRender(()=>i(t,PA(t)))}var GM=class extends kA{mount(){let{current:e}=this.node;e&&(this.unmount=_D(e,(e,t)=>(WM(this.node,t,`Start`),e=>WM(this.node,e,`End`))))}unmount(){}},KM=class extends kA{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(`:focus-visible`)}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!1),this.isActive=!1)}mount(){this.unmount=iC(NA(this.node.current,`focus`,()=>this.onFocus()),NA(this.node.current,`blur`,()=>this.onBlur()))}unmount(){}};function qM(e,t,n){let{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive(`whileTap`,n===`Start`);let i=r[`onTap`+(n===`End`?``:n)];i&&zC.postRender(()=>i(t,PA(t)))}var JM=class extends kA{mount(){let{current:e}=this.node;e&&(this.unmount=DD(e,(e,t)=>(qM(this.node,t,`Start`),(e,{success:t})=>qM(this.node,e,t?`End`:`Cancel`)),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}},YM=new WeakMap,XM=new WeakMap,ZM=e=>{let t=YM.get(e.target);t&&t(e)},QM=e=>{e.forEach(ZM)};function $M({root:e,...t}){let n=e||document;XM.has(n)||XM.set(n,{});let r=XM.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(QM,{root:e,...t})),r[i]}function eN(e,t,n){let r=$M(t);return YM.set(e,n),r.observe(e),()=>{YM.delete(e),r.unobserve(e)}}var tN={some:0,all:1},nN=class extends kA{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();let{viewport:e={}}=this.node.getProps(),{root:t,margin:n,amount:r=`some`,once:i}=e,a={root:t?t.current:void 0,rootMargin:n,threshold:typeof r==`number`?r:tN[r]};return eN(this.node.current,a,e=>{let{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,i&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive(`whileInView`,t);let{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),a=t?n:r;a&&a(e)})}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>`u`)return;let{props:e,prevProps:t}=this.node;[`amount`,`margin`,`root`].some(rN(e,t))&&this.startObserver()}unmount(){}};function rN({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}var iN={inView:{Feature:nN},tap:{Feature:JM},focus:{Feature:KM},hover:{Feature:GM}},aN={layout:{ProjectionNode:HM,MeasureLayout:Aj}},oN=uk({...MA,...iN,...UM,...aN},Yk),sN=(e,t)=>{if(e.id===t.id)return!1;let n=.1;return e.x>=t.x-n&&e.x+e.width<=t.x+t.width+n&&e.y>=t.y-n&&e.y+e.height<=t.y+t.height+n},cN=(e,t,n,r,i=1.2)=>{if(!e)return 0;let a=document.createElement(`canvas`).getContext(`2d`);if(!a)return 0;a.font=`${r}px ${n}`;let o=e.split(` `),s=``,c=1;for(let e=0;e<o.length;e++){let n=s+o[e]+` `;a.measureText(n).width>t&&e>0?(s=o[e]+` `,c++):s=n}let l=e.split(`
57
- `).length-1;return c+=l,Math.ceil(c*r*i)};let lN=(e,t)=>{let n=e.map(e=>({...e})),r=new Map(e.map(e=>[e.id,e])),i=[];n.forEach(e=>{let a=e.type===`text`,o=e.type===`text-container`;if((a||o)&&e.autoGrow){let a=e.content;t&&(a=a.replace(/\{\{(.*?)\}\}/g,(n,r)=>{let i=t[r.trim()];return i==null?n:e.formatting?jS(i,e.formatting):String(i)}));let s=parseInt(String(e.style?.fontSize||16)),c=String(e.style?.fontFamily||`Arial`);if(o&&e.containerExpansion===`horizontal`){let t=document.createElement(`canvas`).getContext(`2d`);if(t){t.font=`${s}px ${c}`;let n=t.measureText(a),r=Math.ceil(n.width+parseInt(String(e.style?.padding||0))*2);Math.abs(r-e.width)>1&&(e.width=r,e.content=a)}}else{let t=cN(a,e.width,c,s),o=e.height,l=t-o;if(Math.abs(l)>1){e.height=t,e.content=a;let s=[],c=r.get(e.id);c&&n.forEach(t=>{if(t.id===e.id)return;let n=r.get(t.id);n&&sN(c,n)&&s.push(t)});let u=new Set([e.id]);s.forEach(e=>{e.height+=l,u.add(e.id)}),i.push({triggerY:e.y+o,delta:l,ignoreIds:u})}}}}),n.forEach(e=>{let t=r.get(e.id);if(!t)return;let n=0;i.forEach(r=>{r.ignoreIds.has(e.id)||t.y>=r.triggerY-.1&&(n+=r.delta)}),e.y+=n});let a=0;return n.forEach(e=>{let t=e.y+e.height;t>a&&(a=t)}),{elements:n,totalHeight:a}};var uN=e=>{switch(e){case`linear`:return`linear`;case`ease-in`:return`easeIn`;case`ease-out`:return`easeOut`;case`ease-in-out`:return`easeInOut`;case`bounce`:return`easeOut`;case`ease`:return`easeInOut`;default:return`easeOut`}},dN=e=>{if(!e||e.type===`none`)return{initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1}};let t={initial:{},animate:{}};switch(e.type){case`fadeIn`:t.initial={opacity:0},t.animate={opacity:1};break;case`slideInLeft`:t.initial={opacity:0,x:-100},t.animate={opacity:1,x:0};break;case`slideInRight`:t.initial={opacity:0,x:100},t.animate={opacity:1,x:0};break;case`slideInUp`:t.initial={opacity:0,y:100},t.animate={opacity:1,y:0};break;case`slideInDown`:t.initial={opacity:0,y:-100},t.animate={opacity:1,y:0};break;case`zoomIn`:t.initial={opacity:0,scale:.5},t.animate={opacity:1,scale:1};break;case`bounceIn`:t.initial={opacity:0,scale:.3},t.animate={opacity:1,scale:1,transition:{type:`spring`,bounce:.6}};break;case`smoothSlideUp`:t.initial={opacity:0,y:30},t.animate={opacity:1,y:0};break;case`popIn`:t.initial={opacity:0,scale:.8,y:10},t.animate={opacity:1,scale:1,y:0};break;case`blurIn`:t.initial={opacity:0,filter:`blur(10px)`},t.animate={opacity:1,filter:`blur(0px)`};break;case`pulse`:t.animate={scale:[1,1.05,1]};break;case`shake`:t.animate={x:[0,-5,5,-5,5,0]};break;case`spin`:t.animate={rotate:360};break;default:t.initial={opacity:0,y:20},t.animate={opacity:1,y:0}}return t},fN=(e,t)=>{let n={duration:e?.duration||.4,ease:uN(e?.timingFunction),delay:e?.delay||0},r;e?.iterationCount===`infinite`?r=1/0:typeof e?.iterationCount==`number`&&e.iterationCount>1&&(r=e.iterationCount-1);let i=t?.animate?.transition;return i?{...n,...i,delay:n.delay,repeat:r??i.repeat}:r===void 0?n:{...n,repeat:r}},pN=({element:e,offsetY:n=0,dataContext:i,onSelect:a,isSelected:o})=>{let s=e.content;if(i){if(e.type===`text`||e.type===`text-container`)s=s.replace(/\{\{(.*?)\}\}/g,(t,n)=>{let r=i[n.trim()];return r==null?t:e.formatting?jS(r,e.formatting):String(r)});else if(e.type===`image`)if(e.dataBinding){let t=i[e.dataBinding];t!=null&&(s=String(t))}else s=s.replace(/\{\{(.*?)\}\}/g,(e,t)=>{let n=i[t.trim()];return n==null?e:String(n)})}let c={position:`absolute`,left:e.x,top:e.y+n,width:e.type===`text-container`&&e.autoGrow&&e.containerExpansion===`horizontal`?`max-content`:`${e.width}px`,height:e.autoGrow?`auto`:`${e.height}px`,transform:e.rotation?`rotate(${e.rotation}deg)`:void 0,padding:e.type===`image`||e.type===`text`||e.type===`text-container`?0:`8px`,overflow:e.autoGrow?`visible`:`hidden`,whiteSpace:e.type===`text-container`&&e.autoGrow&&e.containerExpansion===`horizontal`?`nowrap`:e.autoGrow?`pre-wrap`:void 0,wordBreak:e.autoGrow?`break-word`:void 0,outline:o?`2px solid var(--blue-9)`:void 0,zIndex:o?10:void 0,cursor:a?`pointer`:void 0,...e.style},l=e.animation&&e.animation.type!==`none`,u=t.default.useMemo(()=>l?dN(e.animation):null,[e.animation,l]),d=t.default.useMemo(()=>fN(e.animation,u),[e.animation,u]),f=(0,r.jsxs)(r.Fragment,{children:[(e.type===`text`||e.type===`text-container`)&&(0,r.jsx)(H,{style:{width:`100%`,height:`100%`,display:`block`},children:s}),e.type===`image`&&(s?(0,r.jsx)(`img`,{src:s,alt:`Element`,style:{width:`100%`,height:`100%`,objectFit:e.style?.objectFit||`cover`,display:`block`}}):(0,r.jsx)(U,{style:{width:`100%`,height:`100%`,backgroundColor:`#eee`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,r.jsx)(H,{size:`1`,children:`Imagem`})})),e.type===`box`&&(0,r.jsx)(U,{style:{width:`100%`,height:`100%`}}),e.type===`checkbox`&&(0,r.jsx)(U,{style:{width:`100%`,height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,r.jsx)(`input`,{type:`checkbox`,checked:i&&e.dataBinding?i[e.dataBinding]===!0||String(i[e.dataBinding])===`true`:!1,readOnly:!0,style:{width:`100%`,height:`100%`,margin:0}})})]});return l&&u?(0,r.jsx)(oN.div,{variants:u,initial:`initial`,animate:`animate`,transition:d,style:c,onClick:t=>{t.stopPropagation(),a?.(e.id)},children:f}):(0,r.jsx)(U,{style:c,onClick:t=>{t.stopPropagation(),a?.(e.id)},children:f})},mN=({item:e,elements:n,animation:i,onSelect:a,selectedElementIds:o})=>{let{elements:s,totalHeight:c}=t.default.useMemo(()=>lN(n,e),[n,e]),l=t.default.useMemo(()=>dN(i),[i]),u=t.default.useMemo(()=>l.animate?.transition||{duration:i?.duration||.4,ease:uN(i?.timingFunction)},[i,l]);return(0,r.jsx)(oN.div,{layout:!0,variants:l,initial:`initial`,animate:`animate`,exit:{opacity:0,scale:.9},transition:u,whileHover:{scale:1.02,transition:{duration:.2}},style:{position:`relative`,height:c,width:`100%`,marginBottom:`20px`,transformOrigin:`center center`},children:s.map(t=>(0,r.jsx)(pN,{element:t,offsetY:0,dataContext:e,onSelect:a,isSelected:o?.includes(t.id)},t.id))})};let hN=()=>{let{state:e,setSelectedElements:n}=rS(),[i,a]=t.default.useState(!1),[o,s]=t.default.useState([]);return t.default.useEffect(()=>{let t;return i&&e.isList?(o.length===0&&s([{id:Date.now(),...e.mockData[0]||{}}]),t=setInterval(()=>{s(t=>{let n=t.length%(e.mockData.length||1),r={...e.mockData.length>0?e.mockData[n]:{id:t.length},id:`${Date.now()}-${t.length}`};return e.listSettings.newestPosition===`top`?[r,...t].slice(0,20):[...t,r].slice(-20)})},1500)):s([]),()=>clearInterval(t)},[i,e.isList,e.listSettings.newestPosition,e.mockData]),(0,r.jsxs)(U,{style:{width:`100%`,height:`100%`,position:`relative`,overflow:`hidden`,backgroundColor:`var(--color-panel-solid)`},children:[e.isList&&(0,r.jsx)(U,{style:{position:`absolute`,bottom:10,right:10,zIndex:100,backgroundColor:`var(--color-surface)`,padding:`4px`,borderRadius:`var(--radius-3)`,boxShadow:`0 2px 10px rgba(0,0,0,0.1)`},children:(0,r.jsxs)(G,{size:`1`,variant:i?`soft`:`solid`,color:i?`red`:`green`,onClick:()=>a(!i),children:[i?(0,r.jsx)(Mt,{}):(0,r.jsx)(ft,{}),i?`Parar Simulação`:`Simular Entrada`]})}),(0,r.jsx)(Xv,{type:`auto`,scrollbars:`vertical`,style:{height:`100%`,width:`100%`},children:(0,r.jsx)(U,{style:{position:`relative`,minHeight:`100%`,width:`100%`},children:(()=>{if(e.elements.length===0)return(0,r.jsx)(W,{align:`center`,justify:`center`,style:{height:`100%`},children:(0,r.jsx)(H,{color:`gray`,children:`Preview vazio`})});if(e.isList){let t=[];if(i)t=o;else{if(t=e.mockData.length>0?e.mockData:Array.from({length:10}).map((e,t)=>({id:t})),e.listSettings.sortProp){let n=e.listSettings.sortProp,r=e.listSettings.sortOrder===`asc`?1:-1;t=[...t].sort((e,t)=>{let i=e[n],a=t[n];return i<a?-1*r:i>a?1*r:0})}e.listSettings.newestPosition===`top`&&(t=[...t].reverse())}let a=e.listSettings.containerHeight;return(0,r.jsx)(U,{style:{width:`100%`,minHeight:a?`${a}px`:`100%`,height:a?`${a}px`:void 0,overflowY:a?`auto`:void 0,display:`flex`,flexDirection:`column`,justifyContent:e.listSettings.newestPosition===`top`?`flex-start`:`flex-end`,padding:16},children:(0,r.jsx)(WD,{mode:`popLayout`,children:t.map((t,i)=>(0,r.jsx)(mN,{item:t,elements:e.elements,animation:e.listSettings.entryAnimation,onSelect:e=>n([e]),selectedElementIds:e.selectedElementIds},t.id||i))})})}return(0,r.jsx)(r.Fragment,{children:e.elements.map(t=>(0,r.jsx)(pN,{element:t,dataContext:e.singleMockData,onSelect:e=>n([e]),isSelected:e.selectedElementIds.includes(t.id)},t.id))})})()})})]})};function gN(){return(gN=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function _N(e,t){if(e==null)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)t.indexOf(n=a[r])>=0||(i[n]=e[n]);return i}function vN(e){var n=(0,t.useRef)(e),r=(0,t.useRef)(function(e){n.current&&n.current(e)});return n.current=e,r.current}var yN=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e<t?t:e},bN=function(e){return`touches`in e},xN=function(e){return e&&e.ownerDocument.defaultView||self},SN=function(e,t,n){var r=e.getBoundingClientRect(),i=bN(t)?function(e,t){for(var n=0;n<e.length;n++)if(e[n].identifier===t)return e[n];return e[0]}(t.touches,n):t;return{left:yN((i.pageX-(r.left+xN(e).pageXOffset))/r.width),top:yN((i.pageY-(r.top+xN(e).pageYOffset))/r.height)}},CN=function(e){!bN(e)&&e.preventDefault()},wN=t.default.memo(function(e){var n=e.onMove,r=e.onKey,i=_N(e,[`onMove`,`onKey`]),a=(0,t.useRef)(null),o=vN(n),s=vN(r),c=(0,t.useRef)(null),l=(0,t.useRef)(!1),u=(0,t.useMemo)(function(){var e=function(e){CN(e),(bN(e)?e.touches.length>0:e.buttons>0)&&a.current?o(SN(a.current,e,c.current)):n(!1)},t=function(){return n(!1)};function n(n){var r=l.current,i=xN(a.current),o=n?i.addEventListener:i.removeEventListener;o(r?`touchmove`:`mousemove`,e),o(r?`touchend`:`mouseup`,t)}return[function(e){var t=e.nativeEvent,r=a.current;if(r&&(CN(t),!function(e,t){return t&&!bN(e)}(t,l.current)&&r)){if(bN(t)){l.current=!0;var i=t.changedTouches||[];i.length&&(c.current=i[0].identifier)}r.focus(),o(SN(r,t,c.current)),n(!0)}},function(e){var t=e.which||e.keyCode;t<37||t>40||(e.preventDefault(),s({left:t===39?.05:t===37?-.05:0,top:t===40?.05:t===38?-.05:0}))},n]},[s,o]),d=u[0],f=u[1],p=u[2];return(0,t.useEffect)(function(){return p},[p]),t.default.createElement(`div`,gN({},i,{onTouchStart:d,onMouseDown:d,className:`react-colorful__interactive`,ref:a,onKeyDown:f,tabIndex:0,role:`slider`}))}),TN=function(e){return e.filter(Boolean).join(` `)},EN=function(e){var n=e.color,r=e.left,i=e.top,a=i===void 0?.5:i,o=TN([`react-colorful__pointer`,e.className]);return t.default.createElement(`div`,{className:o,style:{top:100*a+`%`,left:100*r+`%`}},t.default.createElement(`div`,{className:`react-colorful__pointer-fill`,style:{backgroundColor:n}}))},DN=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=10**t),Math.round(n*e)/n};360/(2*Math.PI);var ON=function(e){return LN(kN(e))},kN=function(e){return e[0]===`#`&&(e=e.substring(1)),e.length<6?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:e.length===4?DN(parseInt(e[3]+e[3],16)/255,2):1}:{r:parseInt(e.substring(0,2),16),g:parseInt(e.substring(2,4),16),b:parseInt(e.substring(4,6),16),a:e.length===8?DN(parseInt(e.substring(6,8),16)/255,2):1}},AN=function(e){return IN(PN(e))},jN=function(e){var t=e.s,n=e.v,r=e.a,i=(200-t)*n/100;return{h:DN(e.h),s:DN(i>0&&i<200?t*n/100/(i<=100?i:200-i)*100:0),l:DN(i/2),a:DN(r,2)}},MN=function(e){var t=jN(e);return`hsl(`+t.h+`, `+t.s+`%, `+t.l+`%)`},NN=function(e){var t=jN(e);return`hsla(`+t.h+`, `+t.s+`%, `+t.l+`%, `+t.a+`)`},PN=function(e){var t=e.h,n=e.s,r=e.v,i=e.a;t=t/360*6,n/=100,r/=100;var a=Math.floor(t),o=r*(1-n),s=r*(1-(t-a)*n),c=r*(1-(1-t+a)*n),l=a%6;return{r:DN(255*[r,s,o,o,c,r][l]),g:DN(255*[c,r,r,s,o,o][l]),b:DN(255*[o,o,c,r,r,s][l]),a:DN(i,2)}},FN=function(e){var t=e.toString(16);return t.length<2?`0`+t:t},IN=function(e){var t=e.r,n=e.g,r=e.b,i=e.a,a=i<1?FN(DN(255*i)):``;return`#`+FN(t)+FN(n)+FN(r)+a},LN=function(e){var t=e.r,n=e.g,r=e.b,i=e.a,a=Math.max(t,n,r),o=a-Math.min(t,n,r),s=o?a===t?(n-r)/o:a===n?2+(r-t)/o:4+(t-n)/o:0;return{h:DN(60*(s<0?s+6:s)),s:DN(a?o/a*100:0),v:DN(a/255*100),a:i}},RN=t.default.memo(function(e){var n=e.hue,r=e.onChange,i=TN([`react-colorful__hue`,e.className]);return t.default.createElement(`div`,{className:i},t.default.createElement(wN,{onMove:function(e){r({h:360*e.left})},onKey:function(e){r({h:yN(n+360*e.left,0,360)})},"aria-label":`Hue`,"aria-valuenow":DN(n),"aria-valuemax":`360`,"aria-valuemin":`0`},t.default.createElement(EN,{className:`react-colorful__hue-pointer`,left:n/360,color:MN({h:n,s:100,v:100,a:1})})))}),zN=t.default.memo(function(e){var n=e.hsva,r=e.onChange,i={backgroundColor:MN({h:n.h,s:100,v:100,a:1})};return t.default.createElement(`div`,{className:`react-colorful__saturation`,style:i},t.default.createElement(wN,{onMove:function(e){r({s:100*e.left,v:100-100*e.top})},onKey:function(e){r({s:yN(n.s+100*e.left,0,100),v:yN(n.v-100*e.top,0,100)})},"aria-label":`Color`,"aria-valuetext":`Saturation `+DN(n.s)+`%, Brightness `+DN(n.v)+`%`},t.default.createElement(EN,{className:`react-colorful__saturation-pointer`,top:1-n.v/100,left:n.s/100,color:MN(n)})))}),BN=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0},VN=function(e,t){return e.toLowerCase()===t.toLowerCase()||BN(kN(e),kN(t))};function HN(e,n,r){var i=vN(r),a=(0,t.useState)(function(){return e.toHsva(n)}),o=a[0],s=a[1],c=(0,t.useRef)({color:n,hsva:o});return(0,t.useEffect)(function(){if(!e.equal(n,c.current.color)){var t=e.toHsva(n);c.current={hsva:t,color:n},s(t)}},[n,e]),(0,t.useEffect)(function(){var t;BN(o,c.current.hsva)||e.equal(t=e.fromHsva(o),c.current.color)||(c.current={hsva:o,color:t},i(t))},[o,e,i]),[o,(0,t.useCallback)(function(e){s(function(t){return Object.assign({},t,e)})},[])]}var UN,WN=typeof window<`u`?t.useLayoutEffect:t.useEffect,GN=function(){return UN||(typeof __webpack_nonce__<`u`?__webpack_nonce__:void 0)},KN=new Map,qN=function(e){WN(function(){var t=e.current?e.current.ownerDocument:document;if(t!==void 0&&!KN.has(t)){var n=t.createElement(`style`);n.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,KN.set(t,n);var r=GN();r&&n.setAttribute(`nonce`,r),t.head.appendChild(n)}},[])},JN=function(e){var n=e.className,r=e.hsva,i=e.onChange,a={backgroundImage:`linear-gradient(90deg, `+NN(Object.assign({},r,{a:0}))+`, `+NN(Object.assign({},r,{a:1}))+`)`},o=TN([`react-colorful__alpha`,n]),s=DN(100*r.a);return t.default.createElement(`div`,{className:o},t.default.createElement(`div`,{className:`react-colorful__alpha-gradient`,style:a}),t.default.createElement(wN,{onMove:function(e){i({a:e.left})},onKey:function(e){i({a:yN(r.a+e.left)})},"aria-label":`Alpha`,"aria-valuetext":s+`%`,"aria-valuenow":s,"aria-valuemin":`0`,"aria-valuemax":`100`},t.default.createElement(EN,{className:`react-colorful__alpha-pointer`,left:r.a,color:NN(r)})))},YN=function(e){var n=e.className,r=e.colorModel,i=e.color,a=i===void 0?r.defaultColor:i,o=e.onChange,s=_N(e,[`className`,`colorModel`,`color`,`onChange`]),c=(0,t.useRef)(null);qN(c);var l=HN(r,a,o),u=l[0],d=l[1],f=TN([`react-colorful`,n]);return t.default.createElement(`div`,gN({},s,{ref:c,className:f}),t.default.createElement(zN,{hsva:u,onChange:d}),t.default.createElement(RN,{hue:u.h,onChange:d}),t.default.createElement(JN,{hsva:u,onChange:d,className:`react-colorful__last-control`}))},XN={defaultColor:`0001`,toHsva:ON,fromHsva:AN,equal:VN},ZN=function(e){return t.default.createElement(YN,gN({},e,{colorModel:XN}))},QN={black:`#000000`,white:`#ffffff`,red:`#ff0000`,green:`#008000`,blue:`#0000ff`,yellow:`#ffff00`,cyan:`#00ffff`,magenta:`#ff00ff`,gray:`#808080`,grey:`#808080`,silver:`#c0c0c0`,maroon:`#800000`,olive:`#808000`,purple:`#800080`,teal:`#008080`,navy:`#000080`,orange:`#ffa500`,transparent:`#00000000`};let $N=e=>{if(!e)return`#000000`;let t=e.trim().toLowerCase();if(t.startsWith(`#`))return t.length===4?`#`+t[1]+t[1]+t[2]+t[2]+t[3]+t[3]:t.length===5?`#`+t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+t[4]+t[4]:t;if(QN[t])return QN[t];let n=t.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)$/);if(n){let e=parseInt(n[1]),t=parseInt(n[2]),r=parseInt(n[3]),i=n[4]?parseFloat(n[4]):1,a=e=>{let t=Math.round(e).toString(16);return t.length===1?`0`+t:t},o=Math.round(i*255);return`#${a(e)}${a(t)}${a(r)}${a(o)}`}return`#000000`},eP=({color:e,onChange:t})=>{let n=(e=>$N(e))(e);return(0,r.jsxs)(W,{direction:`column`,gap:`3`,style:{width:`100%`},children:[(0,r.jsx)(ZN,{color:n,onChange:t,style:{width:`100%`}}),(0,r.jsxs)(W,{gap:`2`,align:`center`,children:[(0,r.jsx)(U,{style:{width:32,height:32,backgroundColor:n,borderRadius:4,border:`1px solid var(--gray-5)`,flexShrink:0}}),(0,r.jsx)(X,{value:e,onChange:e=>t(e.target.value),onBlur:()=>{e&&/^[0-9A-Fa-f]{3,8}$/.test(e)&&t(`#`+e)},placeholder:`#RRGGBBAA`,style:{flexGrow:1}})]})]})},tP=({color:e,onChange:t,label:n})=>(0,r.jsxs)(Ay,{children:[(0,r.jsx)(jy,{children:(0,r.jsxs)(G,{variant:`surface`,color:`gray`,style:{width:`100%`,justifyContent:`flex-start`,padding:`0 8px`,height:32},children:[(0,r.jsx)(U,{style:{width:18,height:18,backgroundColor:e||`transparent`,borderRadius:2,border:`1px solid var(--gray-8)`,marginRight:8,backgroundImage:e===`transparent`?`linear-gradient(45deg, #ccc 25%, transparent 25%), linear-gradient(-45deg, #ccc 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #ccc 75%), linear-gradient(-45deg, transparent 75%, #ccc 75%)`:`none`,backgroundSize:`8px 8px`,backgroundPosition:`0 0, 0 4px, 4px -4px, -4px 0px`}}),(0,r.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:n||e||`Transparente`})]})}),(0,r.jsx)(My,{style:{width:240},children:(0,r.jsx)(eP,{color:e,onChange:t})})]}),nP=({elementId:e})=>{let{state:t,updateElement:n}=rS(),i=t.elements.find(t=>t.id===e);return i?(0,r.jsx)(U,{pt:`2`,children:(0,r.jsxs)(sb,{defaultValue:`formatting`,children:[(0,r.jsxs)(cb,{children:[(0,r.jsx)(lb,{value:`formatting`,style:{flex:1},children:`Formatação`}),(0,r.jsx)(lb,{value:`style`,style:{flex:1},children:`Estilo`}),(0,r.jsx)(lb,{value:`bindings`,style:{flex:1},children:`Vínculos`}),(0,r.jsx)(lb,{value:`conditional`,style:{flex:1},children:`Regras`}),(0,r.jsx)(lb,{value:`animation`,style:{flex:1},children:`Anim`})]}),(0,r.jsxs)(U,{pt:`3`,children:[(0,r.jsx)(ub,{value:`formatting`,children:(0,r.jsx)(iP,{element:i,updateElement:n})}),(0,r.jsx)(ub,{value:`style`,children:(0,r.jsx)(aP,{element:i,updateElement:n})}),(0,r.jsx)(ub,{value:`bindings`,children:(0,r.jsx)(pP,{element:i,updateElement:n,availableProps:t.availableProps||[]})}),(0,r.jsx)(ub,{value:`conditional`,children:(0,r.jsx)(mP,{element:i,updateElement:n,availableProps:t.availableProps||[]})}),(0,r.jsx)(ub,{value:`animation`,children:(0,r.jsx)(rP,{element:i,updateElement:n})})]})]})}):null},rP=({element:e,updateElement:t})=>{let n=e.animation||{type:`none`,duration:1,delay:0},i=r=>{t(e.id,{animation:{...n,...r}})};return(0,r.jsxs)(W,{direction:`column`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Tipo de Animação`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[n.type===`none`?`Nenhuma`:n.type===`slideIn`?`Slide In (Padrão)`:n.type===`fadeIn`?`Fade In`:n.type===`smoothSlideUp`?`Slide Suave (Up)`:n.type===`popIn`?`Pop In`:n.type===`blurIn`?`Blur In`:n.type===`slideInLeft`?`Slide In (Esquerda)`:n.type===`slideInRight`?`Slide In (Direita)`:n.type===`slideInUp`?`Slide In (Cima)`:n.type===`slideInDown`?`Slide In (Baixo)`:n.type===`zoomIn`?`Zoom In`:n.type===`bounceIn`?`Bounce In`:n.type===`pulse`?`Pulse (Atenção)`:n.type===`shake`?`Shake (Atenção)`:`Spin (Loop)`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>i({type:`none`}),children:`Nenhuma`}),(0,r.jsx)(q,{onSelect:()=>i({type:`slideIn`}),children:`Slide In (Padrão)`}),(0,r.jsx)(q,{onSelect:()=>i({type:`fadeIn`}),children:`Fade In`}),(0,r.jsx)(q,{onSelect:()=>i({type:`smoothSlideUp`}),children:`Slide Suave (Up)`}),(0,r.jsx)(q,{onSelect:()=>i({type:`popIn`}),children:`Pop In`}),(0,r.jsx)(q,{onSelect:()=>i({type:`blurIn`}),children:`Blur In`}),(0,r.jsx)(q,{onSelect:()=>i({type:`slideInLeft`}),children:`Slide In (Esquerda)`}),(0,r.jsx)(q,{onSelect:()=>i({type:`slideInRight`}),children:`Slide In (Direita)`}),(0,r.jsx)(q,{onSelect:()=>i({type:`slideInUp`}),children:`Slide In (Cima)`}),(0,r.jsx)(q,{onSelect:()=>i({type:`slideInDown`}),children:`Slide In (Baixo)`}),(0,r.jsx)(q,{onSelect:()=>i({type:`zoomIn`}),children:`Zoom In`}),(0,r.jsx)(q,{onSelect:()=>i({type:`bounceIn`}),children:`Bounce In`}),(0,r.jsx)(q,{onSelect:()=>i({type:`pulse`}),children:`Pulse (Atenção)`}),(0,r.jsx)(q,{onSelect:()=>i({type:`shake`}),children:`Shake (Atenção)`}),(0,r.jsx)(q,{onSelect:()=>i({type:`spin`}),children:`Spin (Loop)`})]})]})]}),n.type!==`none`&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(K,{columns:`2`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Duração (s)`}),(0,r.jsx)(X,{type:`number`,step:`0.1`,min:`0.1`,value:n.duration,onChange:e=>i({duration:parseFloat(e.target.value)||.5})})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Atraso (s)`}),(0,r.jsx)(X,{type:`number`,step:`0.1`,min:`0`,value:n.delay,onChange:e=>i({delay:parseFloat(e.target.value)||0})})]})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Curva de Tempo`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[(n.timingFunction||`ease`)===`linear`?`Linear`:(n.timingFunction||`ease`)===`ease-in`?`Ease In`:(n.timingFunction||`ease`)===`ease-out`?`Ease Out`:(n.timingFunction||`ease`)===`ease-in-out`?`Ease In Out`:(n.timingFunction||`ease`)===`bounce`?`Bounce`:`Ease`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>i({timingFunction:`linear`}),children:`Linear`}),(0,r.jsx)(q,{onSelect:()=>i({timingFunction:`ease`}),children:`Ease`}),(0,r.jsx)(q,{onSelect:()=>i({timingFunction:`ease-in`}),children:`Ease In`}),(0,r.jsx)(q,{onSelect:()=>i({timingFunction:`ease-out`}),children:`Ease Out`}),(0,r.jsx)(q,{onSelect:()=>i({timingFunction:`ease-in-out`}),children:`Ease In Out`}),(0,r.jsx)(q,{onSelect:()=>i({timingFunction:`bounce`}),children:`Bounce`})]})]})]}),[`pulse`,`shake`,`spin`].includes(n.type)&&(0,r.jsx)(U,{children:(0,r.jsxs)(W,{align:`center`,gap:`2`,mt:`2`,children:[(0,r.jsx)(ib,{checked:n.iterationCount===`infinite`,onCheckedChange:e=>i({iterationCount:e?`infinite`:1})}),(0,r.jsx)(H,{size:`2`,children:`Repetir Infinitamente`})]})})]})]})},iP=({element:e,updateElement:t})=>{let n=e.formatting||{type:`text`},i=r=>{t(e.id,{formatting:{...n,...r}})};return(0,r.jsxs)(W,{direction:`column`,gap:`3`,children:[(e.type===`text`||e.type===`text-container`)&&(0,r.jsxs)(U,{children:[(0,r.jsxs)(W,{align:`center`,gap:`2`,mb:`3`,children:[(0,r.jsx)(ib,{checked:e.autoGrow||!1,onCheckedChange:n=>t(e.id,{autoGrow:n})}),(0,r.jsx)(H,{size:`2`,children:e.type===`text-container`?`Expandir container automaticamente`:`Expandir altura automaticamente`})]}),e.type===`text-container`&&e.autoGrow&&(0,r.jsxs)(U,{mb:`3`,ml:`4`,children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Direção de Expansão`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[(e.containerExpansion||`vertical`)===`vertical`?`Vertical (Altura Cresce)`:`Horizontal (Largura Cresce)`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>t(e.id,{containerExpansion:`vertical`}),children:`Vertical (Altura Cresce)`}),(0,r.jsx)(q,{onSelect:()=>t(e.id,{containerExpansion:`horizontal`}),children:`Horizontal (Largura Cresce)`})]})]})]}),(0,r.jsx)(Qy,{size:`4`,mb:`2`})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Tipo de Formatação`}),(0,r.jsxs)(Wy,{value:n.type,onValueChange:e=>i({type:e}),children:[(0,r.jsx)(Gy,{style:{width:`100%`}}),(0,r.jsxs)(Ky,{children:[(0,r.jsx)(Y,{value:`text`,children:`Texto (Padrão)`}),(0,r.jsx)(Y,{value:`boolean`,children:`Booleano (Sim/Não)`}),(0,r.jsx)(Y,{value:`date`,children:`Data`}),(0,r.jsx)(Y,{value:`number`,children:`Número / Moeda`})]})]})]}),n.type===`boolean`&&(0,r.jsxs)(K,{columns:`2`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Texto para Verdadeiro`}),(0,r.jsx)(X,{placeholder:`Ex: Sim`,value:n.trueLabel||``,onChange:e=>i({trueLabel:e.target.value})})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Texto para Falso`}),(0,r.jsx)(X,{placeholder:`Ex: Não`,value:n.falseLabel||``,onChange:e=>i({falseLabel:e.target.value})})]})]}),n.type===`date`&&(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Formato da Data`}),(0,r.jsx)(X,{placeholder:`Ex: DD/MM/YYYY`,value:n.dateFormat||``,onChange:e=>i({dateFormat:e.target.value})}),(0,r.jsx)(H,{size:`1`,color:`gray`,mt:`1`,style:{fontSize:10},children:`Use DD, MM, YYYY, HH, mm, ss.`})]}),n.type===`number`&&(0,r.jsxs)(W,{direction:`column`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Estilo`}),(0,r.jsxs)(Wy,{value:n.numberFormat||`decimal`,onValueChange:e=>i({numberFormat:e}),children:[(0,r.jsx)(Gy,{style:{width:`100%`}}),(0,r.jsxs)(Ky,{children:[(0,r.jsx)(Y,{value:`decimal`,children:`Decimal`}),(0,r.jsx)(Y,{value:`currency`,children:`Moeda`}),(0,r.jsx)(Y,{value:`percent`,children:`Porcentagem`})]})]})]}),n.numberFormat===`currency`&&(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Símbolo da Moeda`}),(0,r.jsx)(X,{placeholder:`Ex: R$`,value:n.currencySymbol||``,onChange:e=>i({currencySymbol:e.target.value})})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Casas Decimais`}),(0,r.jsx)(X,{type:`number`,placeholder:`2`,value:n.decimalPlaces===void 0?``:n.decimalPlaces,onChange:e=>i({decimalPlaces:parseInt(e.target.value)||0})})]})]})]})},aP=({element:e,updateElement:n})=>{let i=e.style||{},[a,o]=(0,t.useState)(i.borderTopLeftRadius!==void 0||i.borderTopRightRadius!==void 0||i.borderBottomRightRadius!==void 0||i.borderBottomLeftRadius!==void 0),s=t=>{n(e.id,{style:{...i,...t}})},c=(e,t)=>{let n=typeof e==`number`?e:parseInt(e)||0;s({[t]:`${n}px`})};return(0,r.jsxs)(W,{direction:`column`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsxs)(W,{align:`center`,justify:`between`,mb:`2`,children:[(0,r.jsx)(H,{size:`2`,weight:`bold`,children:`Arredondamento`}),(0,r.jsxs)(W,{align:`center`,gap:`2`,children:[(0,r.jsx)(H,{size:`1`,children:`Individual`}),(0,r.jsx)(ib,{checked:a,onCheckedChange:e=>{if(o(e),!e)s({borderRadius:i.borderTopLeftRadius||i.borderRadius||0,borderTopLeftRadius:void 0,borderTopRightRadius:void 0,borderBottomRightRadius:void 0,borderBottomLeftRadius:void 0});else{let e=i.borderRadius||0;s({borderRadius:void 0,borderTopLeftRadius:e,borderTopRightRadius:e,borderBottomRightRadius:e,borderBottomLeftRadius:e})}}})]})]}),a?(0,r.jsxs)(K,{columns:`2`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Sup. Esq.`}),(0,r.jsx)(X,{type:`number`,min:`0`,value:parseInt(i.borderTopLeftRadius)||0,onChange:e=>c(e.target.value,`borderTopLeftRadius`)})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Sup. Dir.`}),(0,r.jsx)(X,{type:`number`,min:`0`,value:parseInt(i.borderTopRightRadius)||0,onChange:e=>c(e.target.value,`borderTopRightRadius`)})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Inf. Esq.`}),(0,r.jsx)(X,{type:`number`,min:`0`,value:parseInt(i.borderBottomLeftRadius)||0,onChange:e=>c(e.target.value,`borderBottomLeftRadius`)})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Inf. Dir.`}),(0,r.jsx)(X,{type:`number`,min:`0`,value:parseInt(i.borderBottomRightRadius)||0,onChange:e=>c(e.target.value,`borderBottomRightRadius`)})]})]}):(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Raio (Todos os cantos)`}),(0,r.jsx)(X,{type:`number`,min:`0`,value:parseInt(i.borderRadius)||0,onChange:e=>s({borderRadius:`${parseInt(e.target.value)||0}px`})})]})]}),(0,r.jsx)(Qy,{size:`4`,my:`2`}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`2`,weight:`bold`,mb:`2`,children:`Espaçamento Interno`}),(0,r.jsx)(K,{columns:`2`,gap:`3`,children:(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Tamanho (px)`}),(0,r.jsx)(X,{type:`number`,min:`0`,value:parseInt(i.padding)||0,onChange:e=>s({padding:`${parseInt(e.target.value)||0}px`})})]})})]}),(0,r.jsx)(Qy,{size:`4`,my:`2`}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`2`,weight:`bold`,mb:`2`,children:`Sombra (Box Shadow)`}),(0,r.jsxs)(W,{direction:`column`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Cor`}),(0,r.jsx)(tP,{color:oP(i.boxShadow),onChange:e=>s({boxShadow:lP(i.boxShadow,e)})})]}),(0,r.jsxs)(K,{columns:`2`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Blur (px)`}),(0,r.jsx)(X,{type:`number`,min:`0`,value:sP(i.boxShadow),onChange:e=>s({boxShadow:uP(i.boxShadow,parseInt(e.target.value)||0)})})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Spread (px)`}),(0,r.jsx)(X,{type:`number`,value:cP(i.boxShadow),onChange:e=>s({boxShadow:dP(i.boxShadow,parseInt(e.target.value)||0)})})]})]}),(0,r.jsx)(G,{variant:`soft`,color:`gray`,size:`1`,onClick:()=>s({boxShadow:i.boxShadow?void 0:`0 4px 12px 0 rgba(0,0,0,0.15)`}),children:i.boxShadow?`Remover Sombra`:`Adicionar Sombra`})]})]})]})};var oP=e=>{if(!e||e===`none`)return`#0000001a`;let t=e.match(/(?:rgba?\([^)]+\)|#[0-9a-fA-F]{3,8}|[a-zA-Z]+)\s*$/);return t?t[0].trim():`#0000001a`},sP=e=>{if(!e||e===`none`)return 12;let t=e.match(/(-?\d+(?:\.\d+)?)(?:px)?/g);return t&&t.length>=3?parseFloat(t[2]):12},cP=e=>{if(!e||e===`none`)return 0;let t=e.match(/(-?\d+(?:\.\d+)?)(?:px)?/g);return t&&t.length>=4?parseFloat(t[3]):0},lP=(e,t)=>{let n=sP(e),r=cP(e);return`${e?.includes(`inset`)?`inset `:``}0px 4px ${n}px ${r}px ${t}`},uP=(e,t)=>{let n=(e||`0 4px 12px 0 #0000001a`).match(/(-?\d+(?:\.\d+)?)(?:px)?/g)||[`0`,`4`,`12`,`0`],r=oP(e);return`${e?.includes(`inset`)?`inset `:``}${n[0]||0}px ${n[1]||4}px ${t}px ${n[3]||0}px ${r}`},dP=(e,t)=>{let n=(e||`0 4px 12px 0 #0000001a`).match(/(-?\d+(?:\.\d+)?)(?:px)?/g)||[`0`,`4`,`12`,`0`],r=oP(e);return`${e?.includes(`inset`)?`inset `:``}${n[0]||0}px ${n[1]||4}px ${n[2]||12}px ${t}px ${r}`},fP=[{key:`color`,label:`Cor do texto`},{key:`backgroundColor`,label:`Cor de fundo`},{key:`borderColor`,label:`Cor da borda`},{key:`boxShadowColor`,label:`Cor da sombra`}];let pP=({element:e,updateElement:t,availableProps:n})=>{let i=e.styleBindings||{},a=(n,r)=>{let a={...i};r?a[n]=r:delete a[n],t(e.id,{styleBindings:Object.keys(a).length>0?a:void 0})};return(0,r.jsxs)(W,{direction:`column`,gap:`3`,children:[(0,r.jsx)(H,{size:`2`,weight:`bold`,children:`Vínculos de Estilo (Data Binding)`}),(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`2`,children:`Vincule propriedades de estilo a variáveis de dados. O valor da variável será aplicado em tempo real (ex.: cores em formato #RRGGBB, rgba(), etc.).`}),fP.map(({key:e,label:t})=>(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:t}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,size:`1`,style:{width:`100%`,justifyContent:`space-between`},children:[i[e]?n.find(t=>t.dataName===i[e])?.name||i[e]:`Nenhum`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>a(e,null),children:`Nenhum`}),n.map(t=>(0,r.jsx)(q,{onSelect:()=>a(e,t.dataName),children:t.name},t.dataName)),n.length===0&&(0,r.jsx)(q,{disabled:!0,children:`Nenhuma variável disponível`})]})]})]},e))]})},mP=({element:e,updateElement:t,availableProps:n})=>{let i=e.conditions||[],a=()=>{let r={id:crypto.randomUUID(),property:n.length>0?n[0].dataName:``,operator:`equals`,value:``,style:{color:`#ff0000`}};t(e.id,{conditions:[...i,r]})},o=n=>{t(e.id,{conditions:i.filter(e=>e.id!==n)})},s=(n,r)=>{t(e.id,{conditions:i.map(e=>e.id===n?{...e,...r}:e)})};return(0,r.jsxs)(W,{direction:`column`,gap:`3`,children:[(0,r.jsxs)(W,{justify:`between`,align:`center`,children:[(0,r.jsx)(H,{size:`2`,color:`gray`,children:`Regras de Exibição`}),(0,r.jsxs)(G,{size:`1`,variant:`soft`,onClick:a,children:[(0,r.jsx)(mt,{}),` Nova Regra`]})]}),i.length===0?(0,r.jsx)(H,{size:`1`,color:`gray`,style:{fontStyle:`italic`},children:`Nenhuma regra condicional definida.`}):(0,r.jsx)(W,{direction:`column`,gap:`2`,children:i.map(e=>(0,r.jsxs)(U,{style:{border:`1px solid var(--gray-6)`,borderRadius:4,padding:8},children:[(0,r.jsxs)(W,{justify:`between`,align:`center`,mb:`2`,children:[(0,r.jsxs)(H,{size:`1`,weight:`bold`,children:[`Se `,e.property,`...`]}),(0,r.jsx)(J,{size:`1`,color:`red`,variant:`ghost`,onClick:()=>o(e.id),children:(0,r.jsx)(Xt,{})})]}),(0,r.jsxs)(K,{columns:`2`,gap:`2`,mb:`2`,children:[(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,size:`1`,style:{width:`100%`,justifyContent:`space-between`},children:[n.find(t=>t.dataName===e.property)?.name||e.property||`Propriedade`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[n.map(t=>(0,r.jsx)(q,{onSelect:()=>s(e.id,{property:t.dataName}),children:t.name},t.dataName)),n.length===0&&(0,r.jsx)(q,{disabled:!0,children:`Nenhuma variável disponível`})]})]}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,size:`1`,style:{width:`100%`,justifyContent:`space-between`},children:[e.operator===`equals`?`Igual a`:e.operator===`notEquals`?`Diferente de`:e.operator===`contains`?`Contém`:e.operator===`greaterThan`?`Maior que`:`Menor que`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>s(e.id,{operator:`equals`}),children:`Igual a`}),(0,r.jsx)(q,{onSelect:()=>s(e.id,{operator:`notEquals`}),children:`Diferente de`}),(0,r.jsx)(q,{onSelect:()=>s(e.id,{operator:`contains`}),children:`Contém`}),(0,r.jsx)(q,{onSelect:()=>s(e.id,{operator:`greaterThan`}),children:`Maior que`}),(0,r.jsx)(q,{onSelect:()=>s(e.id,{operator:`lessThan`}),children:`Menor que`})]})]})]}),(0,r.jsx)(X,{size:`1`,placeholder:`Valor`,value:e.value,onChange:t=>s(e.id,{value:t.target.value})}),(0,r.jsxs)(U,{mt:`2`,children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Cor quando verdadeiro`}),(0,r.jsx)(tP,{color:e.style?.color||`#ff0000`,onChange:t=>s(e.id,{style:{...e.style,color:t}})})]})]},e.id))})]})};var hP=({title:e,isOpen:t,onToggle:n,children:i,onReset:a})=>(0,r.jsxs)(U,{style:{borderBottom:`1px solid var(--gray-4)`},children:[(0,r.jsxs)(W,{align:`center`,style:{width:`100%`},children:[(0,r.jsxs)(G,{variant:`ghost`,onClick:n,style:{flex:1,justifyContent:`space-between`,padding:`12px 8px`,borderRadius:0,height:`auto`,cursor:`pointer`,color:`var(--gray-12)`},children:[(0,r.jsx)(H,{weight:`bold`,size:`2`,children:e}),t?(0,r.jsx)(fe,{}):(0,r.jsx)(me,{})]}),a&&t&&(0,r.jsx)(bb,{content:`Resetar para padrão`,children:(0,r.jsx)(J,{variant:`ghost`,color:`gray`,onClick:e=>{e.stopPropagation(),a()},style:{marginRight:8},children:(0,r.jsx)(vt,{})})})]}),t&&(0,r.jsx)(U,{p:`3`,style:{backgroundColor:`var(--gray-2)`},children:i})]}),gP=({value:e,onChange:n,units:i=[`px`,`%`,`em`,`rem`,`vw`,`vh`],min:a,max:o,placeholder:s,label:c})=>{let l=e=>{if(e==null||e===``)return{num:``,unit:i[0]};let t=String(e).match(/^(-?[\d.]+)([a-z%]+)?$/i);return t?{num:t[1],unit:t[2]||i[0]}:{num:``,unit:i[0]}},[u,d]=(0,t.useState)(l(e));(0,t.useEffect)(()=>{d(l(e))},[e]);let f=(e,t)=>{if(e===``){n(``);return}n(`${e}${t}`)};return(0,r.jsxs)(U,{children:[c&&(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:c}),(0,r.jsxs)(W,{children:[(0,r.jsx)(X,{type:`number`,value:u.num,onChange:e=>{let t=e.target.value;d({...u,num:t}),f(t,u.unit)},placeholder:s,style:{borderTopRightRadius:0,borderBottomRightRadius:0,flex:1},min:a,max:o}),(0,r.jsxs)(Wy,{value:u.unit,onValueChange:e=>{d({...u,unit:e}),f(u.num,e)},children:[(0,r.jsx)(Gy,{style:{width:60,borderTopLeftRadius:0,borderBottomLeftRadius:0,marginLeft:-1}}),(0,r.jsx)(Ky,{children:i.map(e=>(0,r.jsx)(Y,{value:e,children:e},e))})]})]})]})},_P=({values:e,onChange:n,label:i})=>{let[a,o]=(0,t.useState)(!0),s=e=>{n({top:e,right:e,bottom:e,left:e})},c=(t,r)=>{n({...e,[t]:r})};return(0,r.jsxs)(U,{children:[(0,r.jsxs)(W,{justify:`between`,align:`center`,mb:`1`,children:[i&&(0,r.jsx)(H,{size:`1`,color:`gray`,children:i}),(0,r.jsx)(bb,{content:a?`Desvincular lados`:`Vincular lados`,children:(0,r.jsx)(J,{size:`1`,variant:`ghost`,color:a?`blue`:`gray`,onClick:()=>o(!a),children:a?(0,r.jsx)(vP,{}):(0,r.jsx)(yP,{})})})]}),a?(0,r.jsx)(gP,{value:e.top||``,onChange:s,placeholder:`Todos`}):(0,r.jsxs)(K,{columns:`2`,gap:`2`,children:[(0,r.jsx)(gP,{value:e.top,onChange:e=>c(`top`,e),label:`Top`}),(0,r.jsx)(gP,{value:e.right,onChange:e=>c(`right`,e),label:`Right`}),(0,r.jsx)(gP,{value:e.bottom,onChange:e=>c(`bottom`,e),label:`Bottom`}),(0,r.jsx)(gP,{value:e.left,onChange:e=>c(`left`,e),label:`Left`})]})]})},vP=()=>(0,r.jsx)(`svg`,{width:`15`,height:`15`,viewBox:`0 0 15 15`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,r.jsx)(`path`,{d:`M4.5 6.5L1.35355 9.64645C0.908293 10.0917 0.908293 10.8134 1.35355 11.2587L3.74132 13.6464C4.18658 14.0917 4.90829 14.0917 5.35355 13.6464L8.5 10.5M10.5 8.5L13.6464 5.35355C14.0917 4.90829 14.0917 4.18658 13.6464 3.74132L11.2587 1.35355C10.8134 0.908293 10.0917 0.908293 9.64645 1.35355L6.5 4.5M6.5 8.5H8.5`,stroke:`currentColor`})}),yP=()=>(0,r.jsx)(`svg`,{width:`15`,height:`15`,viewBox:`0 0 15 15`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,r.jsx)(`path`,{d:`M4.5 6.5L1.35355 9.64645C0.908293 10.0917 0.908293 10.8134 1.35355 11.2587L3.74132 13.6464C4.18658 14.0917 4.90829 14.0917 5.35355 13.6464L8.5 10.5M10.5 8.5L13.6464 5.35355C14.0917 4.90829 14.0917 4.18658 13.6464 3.74132L11.2587 1.35355C10.8134 0.908293 10.0917 0.908293 9.64645 1.35355L6.5 4.5`,stroke:`currentColor`})});let bP=()=>{let{state:e,setPropertiesPanelOpen:n,updateElement:i,updateElements:a,removeSelected:o,copy:s,paste:c,addElement:l}=rS(),{isPropertiesPanelOpen:u,selectedElementIds:d,elements:f}=e,p=(0,t.useMemo)(()=>f.filter(e=>d.includes(e.id)),[f,d]),m=p[0],h=p.length>1,[g,_]=(0,t.useState)({content:!0,layout:!0,typography:!0,appearance:!1,borders:!1,effects:!1,transform:!1,animation:!1,conditions:!1,formatting:!1,spacing:!1}),[v,y]=(0,t.useState)(``),[b,x]=(0,t.useState)({});(0,t.useEffect)(()=>{let e=localStorage.getItem(`editor-presets`);if(e)try{x(JSON.parse(e))}catch(e){console.error(`Failed to load presets`,e)}},[]);let S=e=>{if(!m)return;let t={...b,[e]:{style:m.style}};x(t),localStorage.setItem(`editor-presets`,JSON.stringify(t))},C=e=>{let t=b[e];t&&t.style&&D(t.style)};if(!u||!m)return null;let w=e=>{_(t=>({...t,[e]:!t[e]}))},T=e=>{h?a(d.map(t=>({id:t,changes:e}))):i(m.id,e)},E=()=>{if(h)s(),c();else{let{id:e,...t}=m;l({...t,x:m.x+20,y:m.y+20})}},D=e=>{h?a(p.map(t=>({id:t.id,changes:{style:{...t.style,...e}}}))):i(m.id,{style:{...m.style,...e}})},O=e=>{let t={};e.forEach(e=>t[e]=void 0),D(t)},k=(e,t)=>{if(!v)return!0;let n=v.toLowerCase();return e.toLowerCase().includes(n)||t.some(e=>e.toLowerCase().includes(n))},A=e=>{if(!h)return e(m);let t=e(m);return p.every(n=>e(n)===t)?t:`Mixed`},j=(e,t=``)=>{let n=A(t=>t.style?.[e]);return n===`Mixed`?`Mixed`:n===void 0?t:n},M=String(j(`fontFamily`,`Arial`)),N=AS(M,e.availableFonts||[`Arial`]),P=()=>{let e=j(`fontWeight`,`normal`);return e===`Mixed`?`400`:kS(e,OS)},F=e=>{let t={x:0,y:4,blur:12,spread:0,color:`#0000001a`,inset:!1};if(!e||e===`none`)return t;let n=e.trim(),r=n.includes(`inset`),i=n.replace(`inset`,``).trim(),a=i.match(/(-?\d+(?:\.\d+)?)(?:px)?\s+(-?\d+(?:\.\d+)?)(?:px)?(?:\s+(\d+(?:\.\d+)?)(?:px)?)?(?:\s+(\d+(?:\.\d+)?)(?:px)?)?/);return a?{x:parseFloat(a[1]),y:parseFloat(a[2]),blur:a[3]?parseFloat(a[3]):0,spread:a[4]?parseFloat(a[4]):0,color:i.replace(a[0],``).trim()||t.color,inset:r}:t},I=F(m.style?.boxShadow),re=e=>{let t={...I,...e};D({boxShadow:`${t.inset?`inset `:``}${t.x}px ${t.y}px ${t.blur}px ${t.spread}px ${t.color}`})};return(0,r.jsx)(ny,{open:u,onOpenChange:n,children:(0,r.jsxs)(iy,{style:{maxWidth:500,width:`100%`,maxHeight:`85vh`,height:`100%`,padding:0,display:`flex`,flexDirection:`column`,overflow:`hidden`},children:[(0,r.jsxs)(U,{style:{borderBottom:`1px solid var(--gray-4)`},children:[(0,r.jsxs)(W,{justify:`between`,align:`center`,p:`4`,pb:`2`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(ay,{style:{margin:0},children:`Propriedades`}),(0,r.jsx)(oy,{size:`1`,color:`gray`,children:h?`${p.length} selecionados`:m.name||`Elemento`})]}),(0,r.jsxs)(W,{gap:`2`,children:[(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsx)(J,{variant:`ghost`,color:`gray`,children:(0,r.jsx)(ee,{})})}),(0,r.jsxs)(fy,{children:[(0,r.jsx)(py,{children:`Presets`}),Object.keys(b).length===0&&(0,r.jsx)(q,{disabled:!0,children:`Nenhum preset salvo`}),Object.keys(b).map(e=>(0,r.jsx)(q,{onSelect:t=>{t.preventDefault(),C(e)},onClick:()=>C(e),style:{cursor:`pointer`},children:e},e)),(0,r.jsx)(xy,{}),(0,r.jsxs)(q,{onSelect:e=>{e.preventDefault();let t=prompt(`Nome do novo preset:`);t&&S(t)},children:[(0,r.jsx)(mt,{style:{marginRight:8}}),` Salvar Atual`]})]})]}),(0,r.jsx)(sy,{children:(0,r.jsx)(J,{variant:`ghost`,color:`gray`,children:(0,r.jsx)(Ee,{})})})]})]}),(0,r.jsxs)(W,{gap:`2`,px:`4`,pb:`3`,children:[(0,r.jsx)(bb,{content:`Bloquear`,children:(0,r.jsx)(J,{variant:`soft`,color:m.locked?`orange`:`gray`,onClick:()=>T({locked:!m.locked}),children:m.locked?(0,r.jsx)(et,{}):(0,r.jsx)(nt,{})})}),(0,r.jsx)(bb,{content:`Ocultar`,children:(0,r.jsx)(J,{variant:`soft`,color:m.hidden?`blue`:`gray`,onClick:()=>T({hidden:!m.hidden}),children:m.hidden?(0,r.jsx)(Be,{}):(0,r.jsx)(He,{})})}),(0,r.jsx)(bb,{content:`Duplicar`,children:(0,r.jsx)(J,{variant:`soft`,color:`gray`,onClick:E,children:(0,r.jsx)(we,{})})}),(0,r.jsx)(U,{style:{flex:1}}),(0,r.jsx)(bb,{content:`Excluir`,children:(0,r.jsx)(J,{variant:`soft`,color:`red`,onClick:()=>{o(),n(!1)},children:(0,r.jsx)(Xt,{})})})]})]}),(0,r.jsx)(U,{p:`3`,style:{borderBottom:`1px solid var(--gray-4)`,backgroundColor:`var(--gray-1)`},children:(0,r.jsx)(X,{placeholder:`Buscar...`,value:v,onChange:e=>y(e.target.value),children:(0,r.jsx)(_b,{children:(0,r.jsx)(ot,{height:`16`,width:`16`})})})}),(0,r.jsxs)(U,{style:{flex:1,overflowY:`auto`,overflowX:`hidden`},children:[k(`Conteúdo`,[`text`,`image`,`url`,`value`,`content`])&&(m.type===`text`||m.type===`text-container`||m.type===`image`)&&(0,r.jsx)(hP,{title:`Conteúdo`,isOpen:g.content,onToggle:()=>w(`content`),children:(0,r.jsxs)(U,{children:[(m.type===`text`||m.type===`text-container`)&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Texto`}),(0,r.jsx)(pb,{value:m.content||``,onChange:e=>T({content:e.target.value}),rows:4,placeholder:`Texto ou {{variavel}}...`})]}),m.type===`image`&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`URL da Imagem`}),(0,r.jsx)(X,{value:m.content||``,onChange:e=>T({content:e.target.value}),placeholder:`https://...`})]})]})}),k(`Tipografia`,[`font`,`text`,`color`,`align`,`size`,`weight`,`transform`,`decoration`])&&(0,r.jsx)(hP,{title:`Tipografia`,isOpen:g.typography,onToggle:()=>w(`typography`),onReset:()=>O([`fontFamily`,`fontSize`,`fontWeight`,`color`,`textAlign`,`fontStyle`,`textDecoration`,`textTransform`,`lineHeight`,`letterSpacing`]),children:(0,r.jsxs)(K,{columns:`2`,gap:`3`,children:[(0,r.jsxs)(U,{style:{gridColumn:`span 2`},children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Família da Fonte`}),(0,r.jsxs)(Wy,{value:M,onValueChange:e=>D({fontFamily:e}),children:[(0,r.jsx)(Gy,{style:{width:`100%`},placeholder:`Selecione...`}),(0,r.jsx)(Ky,{style:{zIndex:1e5},children:N.map(e=>(0,r.jsx)(Y,{value:e,children:e},e))})]})]}),(0,r.jsx)(gP,{label:`Tamanho`,value:j(`fontSize`,`16px`),onChange:e=>D({fontSize:e})}),(0,r.jsx)(gP,{label:`Altura da Linha`,value:j(`lineHeight`,`normal`),onChange:e=>D({lineHeight:e}),units:[``,`px`,`em`,`%`],placeholder:`Normal`}),(0,r.jsx)(gP,{label:`Espaçamento`,value:j(`letterSpacing`,`normal`),onChange:e=>D({letterSpacing:e}),units:[`px`,`em`],placeholder:`Normal`}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Peso`}),(0,r.jsxs)(Wy,{value:P(),onValueChange:e=>D({fontWeight:e}),children:[(0,r.jsx)(Gy,{style:{width:`100%`},placeholder:`Normal`}),(0,r.jsxs)(Ky,{style:{zIndex:1e5},children:[(0,r.jsx)(Y,{value:`100`,children:`100 - Thin`}),(0,r.jsx)(Y,{value:`300`,children:`300 - Light`}),(0,r.jsx)(Y,{value:`400`,children:`400 - Normal`}),(0,r.jsx)(Y,{value:`500`,children:`500 - Medium`}),(0,r.jsx)(Y,{value:`600`,children:`600 - Semi Bold`}),(0,r.jsx)(Y,{value:`700`,children:`700 - Bold`}),(0,r.jsx)(Y,{value:`900`,children:`900 - Black`}),(0,r.jsx)(Y,{value:`normal`,children:`Normal`}),(0,r.jsx)(Y,{value:`bold`,children:`Bold`})]})]})]}),(0,r.jsx)(U,{style:{gridColumn:`span 2`},children:(0,r.jsxs)(W,{justify:`between`,align:`center`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Estilo`}),(0,r.jsxs)(W,{gap:`1`,children:[(0,r.jsx)(J,{variant:j(`fontStyle`)===`italic`?`solid`:`soft`,onClick:()=>D({fontStyle:j(`fontStyle`)===`italic`?`normal`:`italic`}),children:(0,r.jsx)(Ke,{})}),(0,r.jsx)(J,{variant:j(`textDecoration`)===`underline`?`solid`:`soft`,onClick:()=>D({textDecoration:j(`textDecoration`)===`underline`?`none`:`underline`}),children:(0,r.jsx)(Qt,{})}),(0,r.jsx)(J,{variant:j(`textDecoration`)===`line-through`?`solid`:`soft`,onClick:()=>D({textDecoration:j(`textDecoration`)===`line-through`?`none`:`line-through`}),children:(0,r.jsx)(Pt,{})})]})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Transformação`}),(0,r.jsxs)(Wy,{value:j(`textTransform`,`none`),onValueChange:e=>D({textTransform:e}),children:[(0,r.jsx)(Gy,{style:{width:100}}),(0,r.jsxs)(Ky,{children:[(0,r.jsx)(Y,{value:`none`,children:`Nenhum`}),(0,r.jsx)(Y,{value:`uppercase`,children:`MAIÚSCULA`}),(0,r.jsx)(Y,{value:`lowercase`,children:`minúscula`}),(0,r.jsx)(Y,{value:`capitalize`,children:`Capitalizada`})]})]})]})]})}),(0,r.jsxs)(U,{style:{gridColumn:`span 2`},children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Alinhamento`}),(0,r.jsxs)(Ly,{value:j(`textAlign`,`left`),onValueChange:e=>D({textAlign:e}),children:[(0,r.jsx)(Ry,{value:`left`,children:(0,r.jsx)(Wt,{})}),(0,r.jsx)(Ry,{value:`center`,children:(0,r.jsx)(Bt,{})}),(0,r.jsx)(Ry,{value:`right`,children:(0,r.jsx)(Kt,{})}),(0,r.jsx)(Ry,{value:`justify`,children:(0,r.jsx)(Ht,{})})]})]}),(0,r.jsxs)(U,{style:{gridColumn:`span 2`},children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Cor do Texto`}),(0,r.jsx)(tP,{color:j(`color`,`#000000`),onChange:e=>D({color:e})})]})]})}),k(`Aparência`,[`background`,`opacity`,`blend`,`cursor`])&&(0,r.jsxs)(hP,{title:`Aparência`,isOpen:g.appearance,onToggle:()=>w(`appearance`),onReset:()=>O([`backgroundColor`,`backgroundImage`,`backgroundSize`,`opacity`,`mixBlendMode`,`cursor`]),children:[(0,r.jsxs)(sb,{defaultValue:`solid`,children:[(0,r.jsxs)(cb,{children:[(0,r.jsx)(lb,{value:`solid`,children:`Sólido`}),(0,r.jsx)(lb,{value:`gradient`,children:`Gradiente`}),(0,r.jsx)(lb,{value:`image`,children:`Imagem`})]}),(0,r.jsxs)(U,{pt:`3`,children:[(0,r.jsxs)(ub,{value:`solid`,children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Cor de Fundo`}),(0,r.jsx)(tP,{color:j(`backgroundColor`,`transparent`),onChange:e=>D({backgroundColor:e,backgroundImage:`none`})})]}),(0,r.jsxs)(ub,{value:`gradient`,children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`CSS Gradient`}),(0,r.jsx)(pb,{value:j(`backgroundImage`,``),onChange:e=>D({backgroundImage:e.target.value}),placeholder:`linear-gradient(to right, red, blue)`,rows:3})]}),(0,r.jsxs)(ub,{value:`image`,children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`URL da Imagem`}),(0,r.jsx)(X,{value:j(`backgroundImage`,``).replace(/url\(['"]?(.*?)['"]?\)/,`$1`),onChange:e=>D({backgroundImage:`url('${e.target.value}')`}),placeholder:`https://...`,mb:`2`}),(0,r.jsxs)(K,{columns:`2`,gap:`2`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Tamanho`}),(0,r.jsxs)(Wy,{value:j(`backgroundSize`,`auto`),onValueChange:e=>D({backgroundSize:e}),children:[(0,r.jsx)(Gy,{style:{width:`100%`}}),(0,r.jsxs)(Ky,{children:[(0,r.jsx)(Y,{value:`auto`,children:`Auto`}),(0,r.jsx)(Y,{value:`cover`,children:`Cobrir (Cover)`}),(0,r.jsx)(Y,{value:`contain`,children:`Conter (Contain)`}),(0,r.jsx)(Y,{value:`100% 100%`,children:`Esticar`})]})]})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Repetição`}),(0,r.jsxs)(Wy,{value:j(`backgroundRepeat`,`repeat`),onValueChange:e=>D({backgroundRepeat:e}),children:[(0,r.jsx)(Gy,{style:{width:`100%`}}),(0,r.jsxs)(Ky,{children:[(0,r.jsx)(Y,{value:`repeat`,children:`Repetir`}),(0,r.jsx)(Y,{value:`no-repeat`,children:`Não Repetir`}),(0,r.jsx)(Y,{value:`repeat-x`,children:`Horizontal`}),(0,r.jsx)(Y,{value:`repeat-y`,children:`Vertical`})]})]})]})]})]})]})]}),(0,r.jsxs)(U,{mt:`3`,children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Opacidade`}),(0,r.jsxs)(W,{align:`center`,gap:`2`,children:[(0,r.jsx)(tb,{min:0,max:1,step:.05,value:[parseFloat(j(`opacity`,`1`))],onValueChange:([e])=>D({opacity:e}),style:{flex:1}}),(0,r.jsxs)(H,{size:`1`,children:[Math.round(parseFloat(j(`opacity`,`1`))*100),`%`]})]})]}),(0,r.jsxs)(K,{columns:`2`,gap:`3`,mt:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Blend Mode`}),(0,r.jsxs)(Wy,{value:j(`mixBlendMode`,`normal`),onValueChange:e=>D({mixBlendMode:e}),children:[(0,r.jsx)(Gy,{style:{width:`100%`}}),(0,r.jsxs)(Ky,{children:[(0,r.jsx)(Y,{value:`normal`,children:`Normal`}),(0,r.jsx)(Y,{value:`multiply`,children:`Multiply`}),(0,r.jsx)(Y,{value:`screen`,children:`Screen`}),(0,r.jsx)(Y,{value:`overlay`,children:`Overlay`}),(0,r.jsx)(Y,{value:`darken`,children:`Darken`}),(0,r.jsx)(Y,{value:`lighten`,children:`Lighten`})]})]})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Cursor`}),(0,r.jsxs)(Wy,{value:j(`cursor`,`auto`),onValueChange:e=>D({cursor:e}),children:[(0,r.jsx)(Gy,{style:{width:`100%`}}),(0,r.jsxs)(Ky,{children:[(0,r.jsx)(Y,{value:`auto`,children:`Auto`}),(0,r.jsx)(Y,{value:`default`,children:`Padrão`}),(0,r.jsx)(Y,{value:`pointer`,children:`Mãozinha`}),(0,r.jsx)(Y,{value:`text`,children:`Texto`}),(0,r.jsx)(Y,{value:`move`,children:`Mover`}),(0,r.jsx)(Y,{value:`not-allowed`,children:`Bloqueado`})]})]})]})]})]}),k(`Layout`,[`width`,`height`,`x`,`y`,`z-index`,`overflow`])&&(0,r.jsx)(hP,{title:`Layout & Dimensões`,isOpen:g.layout,onToggle:()=>w(`layout`),onReset:()=>T({width:100,height:100,x:0,y:0,style:{...m.style,zIndex:void 0,overflow:void 0}}),children:(0,r.jsxs)(K,{columns:`2`,gap:`3`,children:[(0,r.jsx)(gP,{label:`Largura`,value:m.width,onChange:e=>T({width:parseFloat(e)}),units:[`px`]}),(0,r.jsx)(gP,{label:`Altura`,value:m.height,onChange:e=>T({height:parseFloat(e)}),units:[`px`]}),(0,r.jsx)(gP,{label:`Posição X`,value:m.x,onChange:e=>T({x:parseFloat(e)}),units:[`px`]}),(0,r.jsx)(gP,{label:`Posição Y`,value:m.y,onChange:e=>T({y:parseFloat(e)}),units:[`px`]}),(0,r.jsx)(gP,{label:`Z-Index`,value:j(`zIndex`,`auto`),onChange:e=>D({zIndex:e===``?void 0:parseInt(e)}),units:[``],placeholder:`Auto`}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Overflow`}),(0,r.jsxs)(Wy,{value:j(`overflow`,`visible`),onValueChange:e=>D({overflow:e}),children:[(0,r.jsx)(Gy,{style:{width:`100%`}}),(0,r.jsxs)(Ky,{children:[(0,r.jsx)(Y,{value:`visible`,children:`Visível`}),(0,r.jsx)(Y,{value:`hidden`,children:`Oculto`}),(0,r.jsx)(Y,{value:`scroll`,children:`Scroll`}),(0,r.jsx)(Y,{value:`auto`,children:`Auto`})]})]})]})]})}),k(`Espaçamento`,[`padding`,`margin`])&&(0,r.jsxs)(hP,{title:`Espaçamento (Margin/Padding)`,isOpen:g.spacing,onToggle:()=>w(`spacing`),onReset:()=>O([`padding`,`paddingTop`,`paddingRight`,`paddingBottom`,`paddingLeft`,`margin`,`marginTop`,`marginRight`,`marginBottom`,`marginLeft`]),children:[(0,r.jsx)(U,{mb:`3`,children:(0,r.jsx)(_P,{label:`Padding (Interno)`,values:{top:j(`paddingTop`,j(`padding`)),right:j(`paddingRight`,j(`padding`)),bottom:j(`paddingBottom`,j(`padding`)),left:j(`paddingLeft`,j(`padding`))},onChange:e=>{e.top===e.right&&e.right===e.bottom&&e.bottom===e.left?D({padding:e.top,paddingTop:void 0,paddingRight:void 0,paddingBottom:void 0,paddingLeft:void 0}):D({padding:void 0,paddingTop:e.top,paddingRight:e.right,paddingBottom:e.bottom,paddingLeft:e.left})}})}),(0,r.jsx)(U,{children:(0,r.jsx)(_P,{label:`Margin (Externo)`,values:{top:j(`marginTop`,j(`margin`)),right:j(`marginRight`,j(`margin`)),bottom:j(`marginBottom`,j(`margin`)),left:j(`marginLeft`,j(`margin`))},onChange:e=>{e.top===e.right&&e.right===e.bottom&&e.bottom===e.left?D({margin:e.top,marginTop:void 0,marginRight:void 0,marginBottom:void 0,marginLeft:void 0}):D({margin:void 0,marginTop:e.top,marginRight:e.right,marginBottom:e.bottom,marginLeft:e.left})}})})]}),k(`Bordas`,[`border`,`radius`,`stroke`])&&(0,r.jsxs)(hP,{title:`Bordas & Cantos`,isOpen:g.borders,onToggle:()=>w(`borders`),onReset:()=>O([`border`,`borderWidth`,`borderStyle`,`borderColor`,`borderRadius`,`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomRightRadius`,`borderBottomLeftRadius`]),children:[(0,r.jsxs)(sb,{defaultValue:`all`,children:[(0,r.jsxs)(cb,{children:[(0,r.jsx)(lb,{value:`all`,children:(0,r.jsx)(te,{})}),(0,r.jsx)(lb,{value:`top`,children:(0,r.jsx)(ce,{})}),(0,r.jsx)(lb,{value:`right`,children:(0,r.jsx)(oe,{})}),(0,r.jsx)(lb,{value:`bottom`,children:(0,r.jsx)(ne,{})}),(0,r.jsx)(lb,{value:`left`,children:(0,r.jsx)(ie,{})})]}),(0,r.jsx)(U,{pt:`3`,children:(0,r.jsxs)(K,{columns:`2`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Estilo`}),(0,r.jsxs)(Wy,{value:j(`borderStyle`,`none`),onValueChange:e=>D({borderStyle:e}),children:[(0,r.jsx)(Gy,{style:{width:`100%`}}),(0,r.jsxs)(Ky,{children:[(0,r.jsx)(Y,{value:`none`,children:`Nenhuma`}),(0,r.jsx)(Y,{value:`solid`,children:`Sólida`}),(0,r.jsx)(Y,{value:`dashed`,children:`Tracejada`}),(0,r.jsx)(Y,{value:`dotted`,children:`Pontilhada`}),(0,r.jsx)(Y,{value:`double`,children:`Dupla`})]})]})]}),(0,r.jsx)(gP,{label:`Espessura`,value:j(`borderWidth`,`0px`),onChange:e=>D({borderWidth:e})}),(0,r.jsxs)(U,{style:{gridColumn:`span 2`},children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Cor`}),(0,r.jsx)(tP,{color:j(`borderColor`,`#000000`),onChange:e=>D({borderColor:e})})]})]})})]}),(0,r.jsx)(U,{mt:`3`,children:(0,r.jsx)(_P,{label:`Arredondamento (Radius)`,values:{top:j(`borderTopLeftRadius`,j(`borderRadius`)),right:j(`borderTopRightRadius`,j(`borderRadius`)),bottom:j(`borderBottomRightRadius`,j(`borderRadius`)),left:j(`borderBottomLeftRadius`,j(`borderRadius`))},onChange:e=>{e.top===e.right&&e.right===e.bottom&&e.bottom===e.left?D({borderRadius:e.top,borderTopLeftRadius:void 0,borderTopRightRadius:void 0,borderBottomRightRadius:void 0,borderBottomLeftRadius:void 0}):D({borderRadius:void 0,borderTopLeftRadius:e.top,borderTopRightRadius:e.right,borderBottomRightRadius:e.bottom,borderBottomLeftRadius:e.left})}})})]}),k(`Efeitos`,[`shadow`,`sombra`])&&(0,r.jsx)(hP,{title:`Efeitos (Sombra)`,isOpen:g.effects,onToggle:()=>w(`effects`),onReset:()=>O([`boxShadow`,`textShadow`]),children:(0,r.jsxs)(sb,{defaultValue:`box`,children:[(0,r.jsxs)(cb,{children:[(0,r.jsx)(lb,{value:`box`,children:`Box Shadow`}),(0,r.jsx)(lb,{value:`text`,children:`Text Shadow`})]}),(0,r.jsxs)(U,{pt:`3`,children:[(0,r.jsx)(ub,{value:`box`,children:(0,r.jsxs)(U,{p:`2`,style:{backgroundColor:`var(--gray-3)`,borderRadius:`var(--radius-2)`},children:[(0,r.jsxs)(W,{justify:`between`,mb:`2`,children:[(0,r.jsx)(H,{size:`1`,weight:`bold`,children:`Box Shadow`}),(0,r.jsxs)(W,{gap:`2`,align:`center`,children:[(0,r.jsx)(H,{size:`1`,children:`Inset`}),(0,r.jsx)(`input`,{type:`checkbox`,checked:I.inset,onChange:e=>re({inset:e.target.checked})})]})]}),(0,r.jsxs)(K,{columns:`2`,gap:`2`,mb:`2`,children:[(0,r.jsx)(gP,{label:`X`,value:I.x,onChange:e=>re({x:parseFloat(e)}),units:[`px`]}),(0,r.jsx)(gP,{label:`Y`,value:I.y,onChange:e=>re({y:parseFloat(e)}),units:[`px`]}),(0,r.jsx)(gP,{label:`Blur`,value:I.blur,onChange:e=>re({blur:parseFloat(e)}),units:[`px`]}),(0,r.jsx)(gP,{label:`Spread`,value:I.spread,onChange:e=>re({spread:parseFloat(e)}),units:[`px`]})]}),(0,r.jsx)(tP,{color:I.color,onChange:e=>re({color:e})})]})}),(0,r.jsx)(ub,{value:`text`,children:(0,r.jsxs)(U,{p:`2`,style:{backgroundColor:`var(--gray-3)`,borderRadius:`var(--radius-2)`},children:[(0,r.jsx)(H,{size:`1`,weight:`bold`,mb:`2`,as:`div`,children:`Text Shadow`}),(0,r.jsxs)(K,{columns:`2`,gap:`2`,mb:`2`,children:[(0,r.jsx)(gP,{label:`X`,value:F(j(`textShadow`,`none`)).x,onChange:e=>{let t=F(j(`textShadow`,`none`));D({textShadow:`${e}px ${t.y}px ${t.blur}px ${t.color}`})},units:[`px`]}),(0,r.jsx)(gP,{label:`Y`,value:F(j(`textShadow`,`none`)).y,onChange:e=>{let t=F(j(`textShadow`,`none`));D({textShadow:`${t.x}px ${e}px ${t.blur}px ${t.color}`})},units:[`px`]}),(0,r.jsx)(gP,{label:`Blur`,value:F(j(`textShadow`,`none`)).blur,onChange:e=>{let t=F(j(`textShadow`,`none`));D({textShadow:`${t.x}px ${t.y}px ${e}px ${t.color}`})},units:[`px`]})]}),(0,r.jsx)(tP,{color:F(j(`textShadow`,`none`)).color,onChange:e=>{let t=F(j(`textShadow`,`none`));D({textShadow:`${t.x}px ${t.y}px ${t.blur}px ${e}`})}})]})})]})]})}),k(`Transform`,[`scale`,`rotate`,`skew`,`translate`])&&(0,r.jsx)(hP,{title:`Transformação`,isOpen:g.transform,onToggle:()=>w(`transform`),onReset:()=>T({rotation:0,style:{...m.style,transform:void 0}}),children:(0,r.jsxs)(K,{columns:`2`,gap:`3`,children:[(0,r.jsx)(gP,{label:`Rotação (deg)`,value:m.rotation,onChange:e=>T({rotation:parseFloat(e)}),units:[`deg`]}),(0,r.jsxs)(U,{style:{gridColumn:`span 2`},children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Transform CSS (Scale, Skew, Translate)`}),(0,r.jsx)(X,{value:j(`transform`,``),onChange:e=>D({transform:e.target.value}),placeholder:`ex: scale(1.5) skewX(10deg)`}),(0,r.jsxs)(H,{size:`1`,color:`gray`,mt:`1`,children:[`Use sintaxe CSS padrão. Ex: `,(0,r.jsx)(`code`,{children:`scale(1.2)`}),`, `,(0,r.jsx)(`code`,{children:`skewY(10deg)`})]})]})]})}),!h&&(0,r.jsxs)(r.Fragment,{children:[k(`Animação`,[`animation`])&&(0,r.jsx)(hP,{title:`Animação`,isOpen:g.animation,onToggle:()=>w(`animation`),onReset:()=>T({animation:void 0}),children:(0,r.jsx)(rP,{element:m,updateElement:i})}),k(`Regras`,[`condition`])&&(0,r.jsx)(hP,{title:`Regras Condicionais`,isOpen:g.conditions,onToggle:()=>w(`conditions`),onReset:()=>T({conditions:[]}),children:(0,r.jsx)(mP,{element:m,updateElement:i,availableProps:e.availableProps||[]})}),k(`Formatação`,[`format`])&&(0,r.jsx)(hP,{title:`Formatação`,isOpen:g.formatting,onToggle:()=>w(`formatting`),onReset:()=>T({formatting:void 0}),children:(0,r.jsx)(iP,{element:m,updateElement:i})})]})]},m?.id??d.join(`,`))]})})};var xP=20,SP=`#f5f5f5`,CP=`#999`;let wP=({orientation:e})=>{let{state:n}=rS(),{zoom:i,pan:a}=n,o=(0,t.useRef)(null);return(0,t.useEffect)(()=>{let t=o.current;if(!t)return;let n=t.getContext(`2d`);if(!n)return;let r=t.width,s=t.height;n.fillStyle=SP,n.fillRect(0,0,r,s),n.fillStyle=CP,n.font=`10px sans-serif`,n.strokeStyle=CP,n.lineWidth=1;let c=e===`horizontal`?-a.x/i:-a.y/i,l=e===`horizontal`?(r-a.x)/i:(s-a.y)/i,u=100;u=i>2?10:i>.8?50:i>.4?100:200;let d=Math.floor(c/u)*u;n.beginPath();for(let t=d;t<l;t+=u){let r=t*i+(e===`horizontal`?a.x:a.y);e===`horizontal`?(n.moveTo(r,0),n.lineTo(r,xP),n.fillText(t.toString(),r+2,10)):(n.moveTo(0,r),n.lineTo(xP,r),n.save(),n.translate(10,r+2),n.rotate(-Math.PI/2),n.fillText(t.toString(),0,0),n.restore())}n.stroke()},[i,a,e,n.canvasHeight]),(0,t.useEffect)(()=>{let e=o.current;if(!e)return;let t=new ResizeObserver(()=>{let t=e.parentElement?.getBoundingClientRect();t&&(e.width=t.width,e.height=t.height)});return e.parentElement&&t.observe(e.parentElement),()=>t.disconnect()},[]),(0,r.jsx)(`canvas`,{ref:o,style:{width:`100%`,height:`100%`,display:`block`,pointerEvents:`none`}})};var TP=({icon:e,label:n,keys:i})=>(0,r.jsxs)(W,{align:`center`,justify:`between`,py:`2`,children:[(0,r.jsxs)(W,{align:`center`,gap:`2`,children:[(0,r.jsx)(U,{style:{color:`var(--gray-10)`},children:(0,r.jsx)(e,{})}),(0,r.jsx)(H,{size:`2`,children:n})]}),(0,r.jsx)(W,{gap:`1`,children:i.map((e,n)=>(0,r.jsxs)(t.default.Fragment,{children:[(0,r.jsx)(Ey,{children:e}),n<i.length-1&&(0,r.jsx)(H,{size:`1`,color:`gray`,children:`+`})]},n))})]});let EP=()=>(0,r.jsxs)(ny,{children:[(0,r.jsx)(ry,{children:(0,r.jsxs)(G,{variant:`solid`,color:`amber`,radius:`full`,style:{height:36,padding:`0 14px`,boxShadow:`0 4px 6px rgba(0,0,0,0.1)`},title:`Atalhos de Teclado`,children:[(0,r.jsx)(gt,{width:`18`,height:`18`}),`Ajuda`]})}),(0,r.jsxs)(iy,{style:{maxWidth:700},onPointerDown:e=>e.stopPropagation(),children:[(0,r.jsx)(ay,{children:`Atalhos de Teclado`}),(0,r.jsx)(H,{size:`2`,color:`gray`,mb:`4`,as:`p`,children:`Agilize seu fluxo de trabalho com estes atalhos.`}),(0,r.jsxs)(K,{columns:{initial:`1`,sm:`2`},gap:`6`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`2`,weight:`bold`,mb:`2`,color:`blue`,children:`Edição Básica`}),(0,r.jsx)(Qy,{size:`4`,mb:`2`}),(0,r.jsx)(TP,{icon:It,label:`Desfazer`,keys:[`Ctrl`,`Z`]}),(0,r.jsx)(TP,{icon:It,label:`Refazer`,keys:[`Ctrl`,`Y`]}),(0,r.jsx)(TP,{icon:Se,label:`Copiar`,keys:[`Ctrl`,`C`]}),(0,r.jsx)(TP,{icon:Se,label:`Colar`,keys:[`Ctrl`,`V`]}),(0,r.jsx)(TP,{icon:Xt,label:`Excluir`,keys:[`Delete`]})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`2`,weight:`bold`,mb:`2`,color:`blue`,children:`Navegação e Seleção`}),(0,r.jsx)(Qy,{size:`4`,mb:`2`}),(0,r.jsx)(TP,{icon:ut,label:`Mover Elemento`,keys:[`Setas`]}),(0,r.jsx)(TP,{icon:ut,label:`Mover Rápido`,keys:[`Shift`,`Setas`]}),(0,r.jsx)(TP,{icon:Oe,label:`Multiseleção`,keys:[`Shift`,`Click`]}),(0,r.jsx)(TP,{icon:wt,label:`Mover Canvas (Pan)`,keys:[`Espaço`,`Arrastar`]}),(0,r.jsx)(TP,{icon:ot,label:`Zoom`,keys:[`Ctrl`,`Scroll`]})]})]}),(0,r.jsx)(W,{justify:`end`,mt:`5`,children:(0,r.jsx)(sy,{children:(0,r.jsx)(G,{variant:`soft`,color:`gray`,children:`Fechar`})})})]})]}),DP=()=>{let{state:e,updateListSettings:n,setCanvasHeight:i,setGridSize:a}=rS(),[o,s]=(0,t.useState)(!1),[c,l]=(0,t.useState)(``),[u,d]=(0,t.useState)(`asc`),[f,p]=(0,t.useState)(`bottom`),[m,h]=(0,t.useState)(`down`),[g,_]=(0,t.useState)(`150`),[v,y]=(0,t.useState)(``),[b,x]=(0,t.useState)(`0`),[S,C]=(0,t.useState)(`slideIn`),[w,T]=(0,t.useState)(.3),[E,D]=(0,t.useState)(`ease-out`),O=t.default.useRef(!1);return(0,t.useEffect)(()=>{if(o&&!O.current){O.current=!0,l(e.listSettings.sortProp||`__none__`),d(e.listSettings.sortOrder||`asc`),p(e.listSettings.newestPosition||`bottom`),h(e.listSettings.scrollDirection||`down`),y(e.listSettings.containerHeight?String(e.listSettings.containerHeight):``),_(String(e.canvasHeight||150)),x(String(e.gridSize||0));let t=e.listSettings.entryAnimation;C(t?.type||`slideIn`),T(t?.duration||.3),D(t?.timingFunction||`ease-out`)}o||(O.current=!1)},[o]),(0,t.useEffect)(()=>{if(!o)return;let e=parseInt(g,10);!isNaN(e)&&e>0&&i(e);let t=parseInt(b,10);!isNaN(t)&&t>=0&&a(t)},[g,b,o,i,a]),(0,r.jsxs)(ny,{open:o,onOpenChange:s,children:[(0,r.jsx)(ry,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`center`,cursor:`pointer`},children:[(0,r.jsx)(Je,{}),` Configurações`]})}),(0,r.jsxs)(iy,{style:{maxWidth:600},children:[(0,r.jsx)(ay,{children:`Configurações do Editor`}),(0,r.jsx)(oy,{size:`2`,mb:`4`,children:`Configure o comportamento da lista.`}),(0,r.jsx)(U,{pt:`3`,children:(0,r.jsxs)(W,{direction:`column`,gap:`3`,children:[(0,r.jsx)(H,{size:`2`,weight:`bold`,children:`Ordenação`}),(0,r.jsxs)(W,{gap:`3`,align:`center`,children:[(0,r.jsxs)(U,{flexGrow:`1`,children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,children:`Propriedade para Ordenar`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[c===`__none__`?`(Nenhum)`:e.availableProps.find(e=>e.dataName===c)?.name||c,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>l(`__none__`),children:`(Nenhum)`}),e.availableProps.map(e=>(0,r.jsx)(q,{onSelect:()=>l(e.dataName),children:e.name},e.dataName))]})]})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,children:`Direção`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:150,justifyContent:`space-between`},children:[u===`asc`?`Crescente (A-Z)`:`Decrescente (Z-A)`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>d(`asc`),children:`Crescente (A-Z)`}),(0,r.jsx)(q,{onSelect:()=>d(`desc`),children:`Decrescente (Z-A)`})]})]})]})]}),(0,r.jsxs)(W,{gap:`3`,align:`center`,children:[(0,r.jsxs)(U,{flexGrow:`1`,children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,children:`Posição do Recente`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[f===`top`?`Topo (Início)`:`Base (Final)`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>p(`top`),children:`Topo (Início)`}),(0,r.jsx)(q,{onSelect:()=>p(`bottom`),children:`Base (Final)`})]})]})]}),(0,r.jsxs)(U,{flexGrow:`1`,children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,children:`Comportamento de Rolagem`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[m===`down`?`Descer (Padrão)`:`Subir (Chat)`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>h(`down`),children:`Descer (Padrão)`}),(0,r.jsx)(q,{onSelect:()=>h(`up`),children:`Subir (Chat)`})]})]})]})]}),(0,r.jsx)(H,{size:`2`,weight:`bold`,mt:`2`,children:`Dimensões`}),(0,r.jsxs)(W,{gap:`3`,align:`center`,children:[(0,r.jsxs)(U,{flexGrow:`1`,children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,children:`Altura do Item (Template) (px)`}),(0,r.jsx)(X,{type:`number`,min:`10`,value:g,onChange:e=>_(e.target.value)}),(0,r.jsx)(H,{size:`1`,color:`gray`,children:`Altura de cada item individual na lista.`})]}),(0,r.jsxs)(U,{flexGrow:`1`,children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,children:`Altura da Lista (Container) (px)`}),(0,r.jsx)(X,{type:`number`,min:`0`,placeholder:`Auto (100%)`,value:v,onChange:e=>y(e.target.value)}),(0,r.jsx)(H,{size:`1`,color:`gray`,children:`Altura total da lista. Se exceder, rola. Vazio = 100%.`})]})]}),(0,r.jsx)(H,{size:`2`,weight:`bold`,mt:`2`,children:`Animação de Entrada na Lista`}),(0,r.jsxs)(K,{columns:`3`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,children:`Efeito`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[S===`slideIn`?`Slide (Padrão)`:S===`smoothSlideUp`?`Slide Suave (Up)`:S===`fadeIn`?`Fade In`:S===`popIn`?`Pop In`:S===`blurIn`?`Blur In`:S===`slideInLeft`?`Slide (Esq)`:S===`slideInRight`?`Slide (Dir)`:S===`zoomIn`?`Zoom In`:S===`bounceIn`?`Bounce`:`Nenhum`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>C(`none`),children:`Nenhum`}),(0,r.jsx)(q,{onSelect:()=>C(`slideIn`),children:`Slide (Padrão)`}),(0,r.jsx)(q,{onSelect:()=>C(`smoothSlideUp`),children:`Slide Suave (Up)`}),(0,r.jsx)(q,{onSelect:()=>C(`fadeIn`),children:`Fade In`}),(0,r.jsx)(q,{onSelect:()=>C(`popIn`),children:`Pop In`}),(0,r.jsx)(q,{onSelect:()=>C(`blurIn`),children:`Blur In`}),(0,r.jsx)(q,{onSelect:()=>C(`slideInLeft`),children:`Slide (Esq)`}),(0,r.jsx)(q,{onSelect:()=>C(`slideInRight`),children:`Slide (Dir)`}),(0,r.jsx)(q,{onSelect:()=>C(`zoomIn`),children:`Zoom In`}),(0,r.jsx)(q,{onSelect:()=>C(`bounceIn`),children:`Bounce`})]})]})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,children:`Duração (s)`}),(0,r.jsx)(X,{type:`number`,step:`0.1`,min:`0.1`,value:w,onChange:e=>T(parseFloat(e.target.value)||.3)})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,children:`Curva (Easing)`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[E===`ease-out`?`Ease Out`:E===`linear`?`Linear`:E===`bounce`?`Bounce`:`Ease`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>D(`ease`),children:`Ease`}),(0,r.jsx)(q,{onSelect:()=>D(`ease-out`),children:`Ease Out`}),(0,r.jsx)(q,{onSelect:()=>D(`linear`),children:`Linear`}),(0,r.jsx)(q,{onSelect:()=>D(`bounce`),children:`Bounce`})]})]})]})]}),(0,r.jsxs)(U,{mt:`2`,children:[(0,r.jsx)(H,{size:`2`,weight:`bold`,children:`Grid Snapping (Travar)`}),(0,r.jsx)(W,{gap:`3`,align:`center`,mt:`2`,children:(0,r.jsxs)(U,{flexGrow:`1`,children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,children:`Tamanho do Grid (px) - 0 para desativar`}),(0,r.jsx)(X,{type:`number`,value:b,onChange:e=>x(e.target.value),placeholder:`0`})]})})]})]})}),(0,r.jsxs)(W,{gap:`3`,mt:`4`,justify:`end`,children:[(0,r.jsx)(sy,{children:(0,r.jsx)(G,{variant:`soft`,color:`gray`,children:`Cancelar`})}),(0,r.jsx)(sy,{children:(0,r.jsx)(G,{onClick:()=>{let e=parseInt(v,10),t=parseInt(g,10),r=parseInt(b,10),o={type:S,duration:Number(w),delay:0,timingFunction:E};n({sortProp:c===`__none__`?``:c,sortOrder:u,newestPosition:f,scrollDirection:m,containerHeight:!isNaN(e)&&e>0?e:void 0,entryAnimation:o}),!isNaN(t)&&t>0&&i(t),!isNaN(r)&&r>=0&&a(r),s(!1)},children:`Salvar Alterações`})})]})]})]})},OP=({onClose:e})=>{let{state:t,jumpToHistory:n,undo:i,redo:a}=rS(),o=t=>{n(t),e&&e()};return(0,r.jsxs)(W,{direction:`column`,style:{width:`100%`},children:[(0,r.jsxs)(W,{justify:`between`,align:`center`,p:`2`,style:{borderBottom:`1px solid var(--gray-5)`},children:[(0,r.jsxs)(W,{align:`center`,gap:`2`,children:[(0,r.jsx)(vt,{}),(0,r.jsx)(H,{size:`2`,weight:`bold`,children:`Histórico`})]}),(0,r.jsxs)(W,{gap:`2`,children:[(0,r.jsx)(G,{size:`1`,variant:`soft`,onClick:i,disabled:t.historyIndex<=0,children:`Desfazer`}),(0,r.jsx)(G,{size:`1`,variant:`soft`,onClick:a,disabled:t.historyIndex>=t.history.length-1,children:`Refazer`})]})]}),(0,r.jsx)(U,{p:`0`,children:t.history.map((e,n)=>{let i=n===t.historyIndex,a=n>t.historyIndex,s=t.historyDescriptions?.[n]||(n===0?`Estado Inicial`:`Alteração ${n}`);return(0,r.jsx)(U,{p:`2`,style:{backgroundColor:i?`var(--accent-3)`:`transparent`,opacity:a?.5:1,cursor:`pointer`,borderBottom:`1px solid var(--gray-3)`},onClick:()=>o(n),className:`history-item`,children:(0,r.jsxs)(W,{align:`center`,justify:`between`,children:[(0,r.jsx)(H,{size:`2`,weight:i?`bold`:`regular`,children:s}),i&&(0,r.jsx)(H,{size:`1`,color:`blue`,children:`Atual`})]})},n)})})]})};function kP(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return(0,t.useMemo)(()=>e=>{n.forEach(t=>t(e))},n)}var AP=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function jP(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function MP(e){return`nodeType`in e}function NP(e){return e?jP(e)?e:MP(e)?e.ownerDocument?.defaultView??window:window:window}function PP(e){let{Document:t}=NP(e);return e instanceof t}function FP(e){return jP(e)?!1:e instanceof NP(e).HTMLElement}function IP(e){return e instanceof NP(e).SVGElement}function LP(e){return e?jP(e)?e.document:MP(e)?PP(e)?e:FP(e)||IP(e)?e.ownerDocument:document:document:document}var RP=AP?t.useLayoutEffect:t.useEffect;function zP(e){let n=(0,t.useRef)(e);return RP(()=>{n.current=e}),(0,t.useCallback)(function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return n.current==null?void 0:n.current(...t)},[])}function BP(){let e=(0,t.useRef)(null);return[(0,t.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,t.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function VP(e,n){n===void 0&&(n=[e]);let r=(0,t.useRef)(e);return RP(()=>{r.current!==e&&(r.current=e)},n),r}function HP(e,n){let r=(0,t.useRef)();return(0,t.useMemo)(()=>{let t=e(r.current);return r.current=t,t},[...n])}function UP(e){let n=zP(e),r=(0,t.useRef)(null);return[r,(0,t.useCallback)(e=>{e!==r.current&&n?.(e,r.current),r.current=e},[])]}function WP(e){let n=(0,t.useRef)();return(0,t.useEffect)(()=>{n.current=e},[e]),n.current}var GP={};function KP(e,n){return(0,t.useMemo)(()=>{if(n)return n;let t=GP[e]==null?0:GP[e]+1;return GP[e]=t,e+`-`+t},[e,n])}function qP(e){return function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var JP=qP(1),YP=qP(-1);function XP(e){return`clientX`in e&&`clientY`in e}function ZP(e){if(!e)return!1;let{KeyboardEvent:t}=NP(e.target);return t&&e instanceof t}function QP(e){if(!e)return!1;let{TouchEvent:t}=NP(e.target);return t&&e instanceof t}function $P(e){if(QP(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return XP(e)?{x:e.clientX,y:e.clientY}:null}var eF=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[eF.Translate.toString(e),eF.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),tF=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function nF(e){return e.matches(tF)?e:e.querySelector(tF)}var rF={display:`none`};function iF(e){let{id:n,value:r}=e;return t.default.createElement(`div`,{id:n,style:rF},r)}function aF(e){let{id:n,announcement:r,ariaLiveType:i=`assertive`}=e;return t.default.createElement(`div`,{id:n,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":i,"aria-atomic":!0},r)}function oF(){let[e,n]=(0,t.useState)(``);return{announce:(0,t.useCallback)(e=>{e!=null&&n(e)},[]),announcement:e}}var sF=(0,t.createContext)(null);function cF(e){let n=(0,t.useContext)(sF);(0,t.useEffect)(()=>{if(!n)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return n(e)},[e,n])}function lF(){let[e]=(0,t.useState)(()=>new Set),n=(0,t.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,t.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),n]}var uF={draggable:`
56
+ `),()=>{m.contains(p)&&m.removeChild(p)}},[n]),(0,r.jsx)(RD,{isPresent:n,childRef:s,sizeRef:c,children:t.cloneElement(e,{ref:u})})}var BD=({children:e,initial:n,isPresent:i,onExitComplete:a,custom:o,presenceAffectsLayout:s,mode:c,anchorX:l,root:u})=>{let d=HS(VD),f=(0,t.useId)(),p=!0,m=(0,t.useMemo)(()=>(p=!1,{id:f,initial:n,isPresent:i,custom:o,onExitComplete:e=>{d.set(e,!0);for(let e of d.values())if(!e)return;a&&a()},register:e=>(d.set(e,!1),()=>d.delete(e))}),[i,d,a]);return s&&p&&(m={...m}),(0,t.useMemo)(()=>{d.forEach((e,t)=>d.set(t,!1))},[i]),t.useEffect(()=>{!i&&!d.size&&a&&a()},[i]),c===`popLayout`&&(e=(0,r.jsx)(zD,{isPresent:i,anchorX:l,root:u,children:e})),(0,r.jsx)(GS.Provider,{value:m,children:e})};function VD(){return new Map}function HD(e=!0){let n=(0,t.useContext)(GS);if(n===null)return[!0,null];let{isPresent:r,onExitComplete:i,register:a}=n,o=(0,t.useId)();(0,t.useEffect)(()=>{if(e)return a(o)},[e]);let s=(0,t.useCallback)(()=>e&&i&&i(o),[o,i,e]);return!r&&i?[!1,s]:[!0]}var UD=e=>e.key||``;function WD(e){let n=[];return t.Children.forEach(e,e=>{(0,t.isValidElement)(e)&&n.push(e)}),n}var GD=({children:e,custom:n,initial:i=!0,onExitComplete:a,presenceAffectsLayout:o=!0,mode:s=`sync`,propagate:c=!1,anchorX:l=`left`,root:u})=>{let[d,f]=HD(c),p=(0,t.useMemo)(()=>WD(e),[e]),m=c&&!d?[]:p.map(UD),h=(0,t.useRef)(!0),g=(0,t.useRef)(p),_=HS(()=>new Map),v=(0,t.useRef)(new Set),[y,b]=(0,t.useState)(p),[x,S]=(0,t.useState)(p);WS(()=>{h.current=!1,g.current=p;for(let e=0;e<x.length;e++){let t=UD(x[e]);m.includes(t)?(_.delete(t),v.current.delete(t)):_.get(t)!==!0&&_.set(t,!1)}},[x,m.length,m.join(`-`)]);let C=[];if(p!==y){let e=[...p];for(let t=0;t<x.length;t++){let n=x[t],r=UD(n);m.includes(r)||(e.splice(t,0,n),C.push(n))}return s===`wait`&&C.length&&(e=C),S(WD(e)),b(p),null}process.env.NODE_ENV!==`production`&&s===`wait`&&x.length>1&&console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);let{forceRender:w}=(0,t.useContext)(VS);return(0,r.jsx)(r.Fragment,{children:x.map(e=>{let t=UD(e),y=c&&!d?!1:p===x||m.includes(t);return(0,r.jsx)(BD,{isPresent:y,initial:!h.current||i?void 0:!1,custom:n,presenceAffectsLayout:o,mode:s,root:u,onExitComplete:y?void 0:()=>{if(v.current.has(t))return;if(v.current.add(t),_.has(t))_.set(t,!0);else return;let e=!0;_.forEach(t=>{t||(e=!1)}),e&&(w?.(),S(g.current),c&&f?.(),a&&a())},anchorX:l,children:e},t)})})},KD=(0,t.createContext)({strict:!1}),qD={animation:[`animate`,`variants`,`whileHover`,`whileTap`,`exit`,`whileInView`,`whileFocus`,`whileDrag`],exit:[`exit`],drag:[`drag`,`dragControls`],focus:[`whileFocus`],hover:[`whileHover`,`onHoverStart`,`onHoverEnd`],tap:[`whileTap`,`onTap`,`onTapStart`,`onTapCancel`],pan:[`onPan`,`onPanStart`,`onPanSessionStart`,`onPanEnd`],inView:[`whileInView`,`onViewportEnter`,`onViewportLeave`],layout:[`layout`,`layoutId`]},JD={};for(let e in qD)JD[e]={isEnabled:t=>qD[e].some(e=>!!t[e])};function YD(e){for(let t in e)JD[t]={...JD[t],...e[t]}}var XD=new Set(`animate.exit.variants.initial.style.values.variants.transition.transformTemplate.custom.inherit.onBeforeLayoutMeasure.onAnimationStart.onAnimationComplete.onUpdate.onDragStart.onDrag.onDragEnd.onMeasureDragConstraints.onDirectionLock.onDragTransitionEnd._dragX._dragY.onHoverStart.onHoverEnd.onViewportEnter.onViewportLeave.globalTapTarget.ignoreStrict.viewport`.split(`.`));function ZD(e){return e.startsWith(`while`)||e.startsWith(`drag`)&&e!==`draggable`||e.startsWith(`layout`)||e.startsWith(`onTap`)||e.startsWith(`onPan`)||e.startsWith(`onLayout`)||XD.has(e)}function QD(e){var t=Object.create(null);return function(n){return t[n]===void 0&&(t[n]=e(n)),t[n]}}var $D=d((()=>{})),eO=p({default:()=>nO}),tO,nO,rO=d((()=>{$D(),tO=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|fetchpriority|fetchPriority|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|popover|popoverTarget|popoverTargetAction|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,nO=QD(function(e){return tO.test(e)||e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)<91})})),iO=e=>!ZD(e);function aO(e){typeof e==`function`&&(iO=t=>t.startsWith(`on`)?!ZD(t):e(t))}try{aO((rO(),g(eO)).default)}catch{}function oO(e,t,n){let r={};for(let i in e)i===`values`&&typeof e.values==`object`||(iO(i)||n===!0&&ZD(i)||!t&&!ZD(i)||e.draggable&&i.startsWith(`onDrag`))&&(r[i]=e[i]);return r}var sO=(0,t.createContext)({});function cO(e){return typeof e==`object`&&!!e&&typeof e.start==`function`}function lO(e){return typeof e==`string`||Array.isArray(e)}var uO=[`animate`,`whileInView`,`whileFocus`,`whileHover`,`whileTap`,`whileDrag`,`exit`],dO=[`initial`,...uO];function fO(e){return cO(e.animate)||dO.some(t=>lO(e[t]))}function pO(e){return!!(fO(e)||e.variants)}function mO(e,t){if(fO(e)){let{initial:t,animate:n}=e;return{initial:t===!1||lO(t)?t:void 0,animate:lO(n)?n:void 0}}return e.inherit===!1?{}:t}function hO(e){let{initial:n,animate:r}=mO(e,(0,t.useContext)(sO));return(0,t.useMemo)(()=>({initial:n,animate:r}),[gO(n),gO(r)])}function gO(e){return Array.isArray(e)?e.join(` `):e}function _O(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}var vO={correct:(e,t)=>{if(!t.target)return e;if(typeof e==`string`)if(Q.test(e))e=parseFloat(e);else return e;return`${_O(e,t.target.x)}% ${_O(e,t.target.y)}%`}},yO={correct:(e,{treeScale:t,projectionDelta:n})=>{let r=e,i=Fw.parse(e);if(i.length>5)return r;let a=Fw.createTransformer(e),o=typeof i[0]==`number`?0:1,s=n.x.scale*t.x,c=n.y.scale*t.y;i[0+o]/=s,i[1+o]/=c;let l=zw(s,c,.5);return typeof i[2+o]==`number`&&(i[2+o]/=l),typeof i[3+o]==`number`&&(i[3+o]/=l),a(i)}},bO={borderRadius:{...vO,applyTo:[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomLeftRadius`,`borderBottomRightRadius`]},borderTopLeftRadius:vO,borderTopRightRadius:vO,borderBottomLeftRadius:vO,borderBottomRightRadius:vO,boxShadow:yO};function xO(e,{layout:t,layoutId:n}){return qT.has(e)||e.startsWith(`origin`)||(t||n!==void 0)&&(!!bO[e]||e===`opacity`)}var SO={x:`translateX`,y:`translateY`,z:`translateZ`,transformPerspective:`perspective`},CO=KT.length;function wO(e,t,n){let r=``,i=!0;for(let a=0;a<CO;a++){let o=KT[a],s=e[o];if(s===void 0)continue;let c=!0;if(c=typeof s==`number`?s===(o.startsWith(`scale`)?1:0):parseFloat(s)===0,!c||n){let e=iD(s,XE[o]);if(!c){i=!1;let t=SO[o]||o;r+=`${t}(${e}) `}n&&(t[o]=e)}}return r=r.trim(),n?r=n(t,i?``:r):i&&(r=`none`),r}function TO(e,t,n){let{style:r,vars:i,transformOrigin:a}=e,o=!1,s=!1;for(let e in t){let n=t[e];if(qT.has(e)){o=!0;continue}else if(YC(e)){i[e]=n;continue}else{let t=iD(n,XE[e]);e.startsWith(`origin`)?(s=!0,a[e]=t):r[e]=t}}if(t.transform||(o||n?r.transform=wO(t,e.transform,n):r.transform&&=`none`),s){let{originX:e=`50%`,originY:t=`50%`,originZ:n=0}=a;r.transformOrigin=`${e} ${t} ${n}`}}var EO=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function DO(e,t,n){for(let r in t)!jD(t[r])&&!xO(r,n)&&(e[r]=t[r])}function OO({transformTemplate:e},n){return(0,t.useMemo)(()=>{let t=EO();return TO(t,n,e),Object.assign({},t.vars,t.style)},[n])}function kO(e,t){let n=e.style||{},r={};return DO(r,n,e),Object.assign(r,OO(e,t)),r}function AO(e,t){let n={},r=kO(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout=`none`,r.touchAction=e.drag===!0?`none`:`pan-${e.drag===`x`?`y`:`x`}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}var jO={offset:`stroke-dashoffset`,array:`stroke-dasharray`},MO={offset:`strokeDashoffset`,array:`strokeDasharray`};function NO(e,t,n=1,r=0,i=!0){e.pathLength=1;let a=i?jO:MO;e[a.offset]=Q.transform(-r);let o=Q.transform(t),s=Q.transform(n);e[a.array]=`${o} ${s}`}var PO=[`offsetDistance`,`offsetPath`,`offsetRotate`,`offsetAnchor`];function FO(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:a=1,pathOffset:o=0,...s},c,l,u){if(TO(e,s,l),c){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:d,style:f}=e;d.transform&&(f.transform=d.transform,delete d.transform),(f.transform||d.transformOrigin)&&(f.transformOrigin=d.transformOrigin??`50% 50%`,delete d.transformOrigin),f.transform&&(f.transformBox=u?.transformBox??`fill-box`,delete d.transformBox);for(let e of PO)d[e]!==void 0&&(f[e]=d[e],delete d[e]);t!==void 0&&(d.x=t),n!==void 0&&(d.y=n),r!==void 0&&(d.scale=r),i!==void 0&&NO(d,i,a,o,!1)}var IO=()=>({...EO(),attrs:{}}),LO=e=>typeof e==`string`&&e.toLowerCase()===`svg`;function RO(e,n,r,i){let a=(0,t.useMemo)(()=>{let t=IO();return FO(t,n,LO(i),e.transformTemplate,e.style),{...t.attrs,style:{...t.style}}},[n]);if(e.style){let t={};DO(t,e.style,e),a.style={...t,...a.style}}return a}var zO=[`animate`,`circle`,`defs`,`desc`,`ellipse`,`g`,`image`,`line`,`filter`,`marker`,`mask`,`metadata`,`path`,`pattern`,`polygon`,`polyline`,`rect`,`stop`,`switch`,`symbol`,`svg`,`text`,`tspan`,`use`,`view`];function BO(e){return typeof e!=`string`||e.includes(`-`)?!1:!!(zO.indexOf(e)>-1||/[A-Z]/u.test(e))}function VO(e,n,r,{latestValues:i},a,o=!1,s){let c=(s??BO(e)?RO:AO)(n,i,a,e),l=oO(n,typeof e==`string`,o),u=e===t.Fragment?{}:{...l,...c,ref:r},{children:d}=n,f=(0,t.useMemo)(()=>jD(d)?d.get():d,[d]);return(0,t.createElement)(e,{...u,children:f})}function HO(e){let t=[{},{}];return e?.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function UO(e,t,n,r){if(typeof t==`function`){let[i,a]=HO(r);t=t(n===void 0?e.custom:n,i,a)}if(typeof t==`string`&&(t=e.variants&&e.variants[t]),typeof t==`function`){let[i,a]=HO(r);t=t(n===void 0?e.custom:n,i,a)}return t}function WO(e){return jD(e)?e.get():e}function GO({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,i){return{latestValues:KO(n,r,i,e),renderState:t()}}function KO(e,t,n,r){let i={},a=r(e,{});for(let e in a)i[e]=WO(a[e]);let{initial:o,animate:s}=e,c=fO(e),l=pO(e);t&&l&&!c&&e.inherit!==!1&&(o===void 0&&(o=t.initial),s===void 0&&(s=t.animate));let u=n?n.initial===!1:!1;u||=o===!1;let d=u?s:o;if(d&&typeof d!=`boolean`&&!cO(d)){let t=Array.isArray(d)?d:[d];for(let n=0;n<t.length;n++){let r=UO(e,t[n]);if(r){let{transitionEnd:e,transition:t,...n}=r;for(let e in n){let t=n[e];if(Array.isArray(t)){let e=u?t.length-1:0;t=t[e]}t!==null&&(i[e]=t)}for(let t in e)i[t]=e[t]}}}return i}var qO=e=>(n,r)=>{let i=(0,t.useContext)(sO),a=(0,t.useContext)(GS),o=()=>GO(e,n,i,a);return r?o():HS(o)};function JO(e,t,n){let{style:r}=e,i={};for(let a in r)(jD(r[a])||t.style&&jD(t.style[a])||xO(a,e)||n?.getValue(a)?.liveStyle!==void 0)&&(i[a]=r[a]);return i}var YO=qO({scrapeMotionValuesFromProps:JO,createRenderState:EO});function XO(e,t,n){let r=JO(e,t,n);for(let n in e)if(jD(e[n])||jD(t[n])){let t=KT.indexOf(n)===-1?n:`attr`+n.charAt(0).toUpperCase()+n.substring(1);r[t]=e[n]}return r}var ZO=qO({scrapeMotionValuesFromProps:XO,createRenderState:IO}),QO=Symbol.for(`motionComponentSymbol`);function $O(e,n,r){let i=(0,t.useRef)(r);(0,t.useInsertionEffect)(()=>{i.current=r});let a=(0,t.useRef)(null);return(0,t.useCallback)(t=>{t&&e.onMount?.(t),n&&(t?n.mount(t):n.unmount());let r=i.current;if(typeof r==`function`)if(t){let e=r(t);typeof e==`function`&&(a.current=e)}else a.current?(a.current(),a.current=null):r(t);else r&&(r.current=t)},[n])}var ek=e=>e.replace(/([a-z])([A-Z])/gu,`$1-$2`).toLowerCase(),tk=`data-`+ek(`framerAppearId`),nk=(0,t.createContext)({});function rk(e){return e&&typeof e==`object`&&Object.prototype.hasOwnProperty.call(e,`current`)}function ik(e,n,r,i,a,o){let{visualElement:s}=(0,t.useContext)(sO),c=(0,t.useContext)(KD),l=(0,t.useContext)(GS),u=(0,t.useContext)(PD).reducedMotion,d=(0,t.useRef)(null);i||=c.renderer,!d.current&&i&&(d.current=i(e,{visualState:n,parent:s,props:r,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:u,isSVG:o}));let f=d.current,p=(0,t.useContext)(nk);f&&!f.projection&&a&&(f.type===`html`||f.type===`svg`)&&ak(d.current,r,a,p);let m=(0,t.useRef)(!1);(0,t.useInsertionEffect)(()=>{f&&m.current&&f.update(r,l)});let h=r[tk],g=(0,t.useRef)(!!h&&!window.MotionHandoffIsComplete?.(h)&&window.MotionHasOptimisedAnimation?.(h));return WS(()=>{f&&(m.current=!0,window.MotionIsMounted=!0,f.updateFeatures(),f.scheduleRenderMicrotask(),g.current&&f.animationState&&f.animationState.animateChanges())}),(0,t.useEffect)(()=>{f&&(!g.current&&f.animationState&&f.animationState.animateChanges(),g.current&&=(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(h)}),!1),f.enteringChildren=void 0)}),f}function ak(e,t,n,r){let{layoutId:i,layout:a,drag:o,dragConstraints:s,layoutScroll:c,layoutRoot:l,layoutCrossfade:u}=t;e.projection=new n(e.latestValues,t[`data-framer-portal-id`]?void 0:ok(e.parent)),e.projection.setOptions({layoutId:i,layout:a,alwaysMeasureLayout:!!o||s&&rk(s),visualElement:e,animationType:typeof a==`string`?a:`both`,initialPromotionConfig:r,crossfade:u,layoutScroll:c,layoutRoot:l})}function ok(e){if(e)return e.options.allowProjection===!1?ok(e.parent):e.projection}function sk(e,{forwardMotionProps:n=!1,type:i}={},a,o){a&&YD(a);let s=i?i===`svg`:BO(e),c=s?ZO:YO;function l(i,l){let u,d={...(0,t.useContext)(PD),...i,layoutId:ck(i)},{isStatic:f}=d,p=hO(i),m=c(i,f);if(!f&&US){lk(d,a);let t=uk(d);u=t.MeasureLayout,p.visualElement=ik(e,m,d,o,t.ProjectionNode,s)}return(0,r.jsxs)(sO.Provider,{value:p,children:[u&&p.visualElement?(0,r.jsx)(u,{visualElement:p.visualElement,...d}):null,VO(e,i,$O(m,p.visualElement,l),m,f,n,s)]})}l.displayName=`motion.${typeof e==`string`?e:`create(${e.displayName??e.name??``})`}`;let u=(0,t.forwardRef)(l);return u[QO]=e,u}function ck({layoutId:e}){let n=(0,t.useContext)(VS).id;return n&&e!==void 0?n+`-`+e:e}function lk(e,n){let r=(0,t.useContext)(KD).strict;if(process.env.NODE_ENV!==`production`&&n&&r){let t="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";e.ignoreStrict?XS(!1,t,`lazy-strict-mode`):ZS(!1,t,`lazy-strict-mode`)}}function uk(e){let{drag:t,layout:n}=JD;if(!t&&!n)return{};let r={...t,...n};return{MeasureLayout:t?.isEnabled(e)||n?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function dk(e,t){if(typeof Proxy>`u`)return sk;let n=new Map,r=(n,r)=>sk(n,r,e,t);return new Proxy((e,t)=>(process.env.NODE_ENV!==`production`&&fC(!1,`motion() is deprecated. Use motion.create() instead.`),r(e,t)),{get:(i,a)=>a===`create`?r:(n.has(a)||n.set(a,sk(a,void 0,e,t)),n.get(a))})}function fk({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function pk({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function mk(e,t){if(!t)return e;let n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function hk(e){return e===void 0||e===1}function gk({scale:e,scaleX:t,scaleY:n}){return!hk(e)||!hk(t)||!hk(n)}function _k(e){return gk(e)||vk(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function vk(e){return yk(e.x)||yk(e.y)}function yk(e){return e&&e!==`0%`}function bk(e,t,n){return n+t*(e-n)}function xk(e,t,n,r,i){return i!==void 0&&(e=bk(e,i,r)),bk(e,n,r)+t}function Sk(e,t=0,n=1,r,i){e.min=xk(e.min,t,n,r,i),e.max=xk(e.max,t,n,r,i)}function Ck(e,{x:t,y:n}){Sk(e.x,t.translate,t.scale,t.originPoint),Sk(e.y,n.translate,n.scale,n.originPoint)}var wk=.999999999999,Tk=1.0000000000001;function Ek(e,t,n,r=!1){let i=n.length;if(!i)return;t.x=t.y=1;let a,o;for(let s=0;s<i;s++){a=n[s],o=a.projectionDelta;let{visualElement:i}=a.options;i&&i.props.style&&i.props.style.display===`contents`||(r&&a.options.layoutScroll&&a.scroll&&a!==a.root&&kk(e,{x:-a.scroll.offset.x,y:-a.scroll.offset.y}),o&&(t.x*=o.x.scale,t.y*=o.y.scale,Ck(e,o)),r&&_k(a.latestValues)&&kk(e,a.latestValues))}t.x<Tk&&t.x>wk&&(t.x=1),t.y<Tk&&t.y>wk&&(t.y=1)}function Dk(e,t){e.min+=t,e.max+=t}function Ok(e,t,n,r,i=.5){Sk(e,t,n,zw(e.min,e.max,i),r)}function kk(e,t){Ok(e.x,t.x,t.scaleX,t.scale,t.originX),Ok(e.y,t.y,t.scaleY,t.scale,t.originY)}function Ak(e,t){return fk(mk(e.getBoundingClientRect(),t))}function jk(e,t,n){let r=Ak(e,n),{scroll:i}=t;return i&&(Dk(r.x,i.offset.x),Dk(r.y,i.offset.y)),r}var Mk=()=>({translate:0,scale:1,origin:0,originPoint:0}),Nk=()=>({x:Mk(),y:Mk()}),Pk=()=>({min:0,max:0}),Fk=()=>({x:Pk(),y:Pk()}),Ik={current:null},Lk={current:!1};function Rk(){if(Lk.current=!0,US)if(window.matchMedia){let e=window.matchMedia(`(prefers-reduced-motion)`),t=()=>Ik.current=e.matches;e.addEventListener(`change`,t),t()}else Ik.current=!1}var zk=new WeakMap;function Bk(e,t,n){for(let r in t){let i=t[r],a=n[r];if(jD(i))e.addValue(r,i);else if(jD(a))e.addValue(r,uD(i,{owner:e}));else if(a!==i)if(e.hasValue(r)){let t=e.getValue(r);t.liveStyle===!0?t.jump(i):t.hasAnimated||t.set(i)}else{let t=e.getStaticValue(r);e.addValue(r,uD(t===void 0?i:t,{owner:e}))}}for(let r in n)t[r]===void 0&&e.removeValue(r);return t}var Vk=[`AnimationStart`,`AnimationComplete`,`Update`,`BeforeLayoutMeasure`,`LayoutMeasure`,`LayoutAnimationStart`,`LayoutAnimationComplete`],Hk=class{scrapeMotionValuesFromProps(e,t,n){return{}}constructor({parent:e,props:t,presenceContext:n,reducedMotionConfig:r,blockInitialAnimation:i,visualState:a},o={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=oE,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify(`Update`,this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{let e=KC.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,BC.render(this.render,!1,!0))};let{latestValues:s,renderState:c}=a;this.latestValues=s,this.baseTarget={...s},this.initialValues=t.initial?{...s}:{},this.renderState=c,this.parent=e,this.props=t,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.options=o,this.blockInitialAnimation=!!i,this.isControllingVariants=fO(t),this.isVariantNode=pO(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);let{willChange:l,...u}=this.scrapeMotionValuesFromProps(t,{},this);for(let e in u){let t=u[e];s[e]!==void 0&&jD(t)&&t.set(s[e])}}mount(e){this.current=e,zk.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),this.reducedMotionConfig===`never`?this.shouldReduceMotion=!1:this.reducedMotionConfig===`always`?this.shouldReduceMotion=!0:(Lk.current||Rk(),this.shouldReduceMotion=Ik.current),process.env.NODE_ENV!==`production`&&fC(this.shouldReduceMotion!==!0,`You have Reduced Motion enabled on your device. Animations may not appear as expected.`,`reduced-motion-disabled`),this.parent?.addChild(this),this.update(this.props,this.presenceContext)}unmount(){for(let e in this.projection&&this.projection.unmount(),VC(this.notifyUpdate),VC(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this),this.events)this.events[e].clear();for(let e in this.features){let t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??=new Set,this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();let n=qT.has(e);n&&this.onBindTransform&&this.onBindTransform();let r=t.on(`change`,t=>{this.latestValues[e]=t,this.props.onUpdate&&BC.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()}),i;window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{r(),i&&i(),t.owner&&t.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e=`animation`;for(e in JD){let t=JD[e];if(!t)continue;let{isEnabled:n,Feature:r}=t;if(!this.features[e]&&r&&n(this.props)&&(this.features[e]=new r(this)),this.features[e]){let t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Fk()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;t<Vk.length;t++){let n=Vk[t];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);let r=e[`on`+n];r&&(this.propEventSubscriptions[n]=this.on(n,r))}this.prevMotionValues=Bk(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){let t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){let n=this.values.get(e);t!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);let t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&t!==void 0&&(n=uD(t===null?void 0:t,{owner:this}),this.addValue(e,n)),n}readValue(e,t){let n=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return n!=null&&(typeof n==`string`&&($S(n)||tC(n))?n=parseFloat(n):!ND(n)&&Fw.test(t)&&(n=$E(e,t)),this.setBaseTarget(e,jD(n)?n.get():n)),jD(n)?n.get():n}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){let{initial:t}=this.props,n;if(typeof t==`string`||typeof t==`object`){let r=UO(this.props,t,this.presenceContext?.custom);r&&(n=r[e])}if(t&&n!==void 0)return n;let r=this.getBaseTargetFromProps(this.props,e);return r!==void 0&&!jD(r)?r:this.initialValues[e]!==void 0&&n===void 0?void 0:this.baseTarget[e]}on(e,t){return this.events[e]||(this.events[e]=new sC),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){dD.render(this.render)}},Uk=class extends Hk{constructor(){super(...arguments),this.KeyframeResolver=nD}sortInstanceNodePosition(e,t){return e.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(e,t){return e.style?e.style[t]:void 0}removeValueFromRenderState(e,{vars:t,style:n}){delete t[e],delete n[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:e}=this.props;jD(e)&&(this.childSubscription=e.on(`change`,e=>{this.current&&(this.current.textContent=`${e}`)}))}};function Wk(e,{style:t,vars:n},r,i){let a=e.style,o;for(o in t)a[o]=t[o];for(o in i?.applyProjectionStyles(a,r),n)a.setProperty(o,n[o])}function Gk(e){return window.getComputedStyle(e)}var Kk=class extends Uk{constructor(){super(...arguments),this.type=`html`,this.renderInstance=Wk}readValueFromInstance(e,t){if(qT.has(t))return this.projection?.isProjecting?HT(t):WT(e,t);{let n=Gk(e),r=(YC(t)?n.getPropertyValue(t):n[t])||0;return typeof r==`string`?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return Ak(e,t)}build(e,t,n){TO(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return JO(e,t,n)}},qk=new Set([`baseFrequency`,`diffuseConstant`,`kernelMatrix`,`kernelUnitLength`,`keySplines`,`keyTimes`,`limitingConeAngle`,`markerHeight`,`markerWidth`,`numOctaves`,`targetX`,`targetY`,`surfaceScale`,`specularConstant`,`specularExponent`,`stdDeviation`,`tableValues`,`viewBox`,`gradientTransform`,`pathLength`,`startOffset`,`textLength`,`lengthAdjust`]);function Jk(e,t,n,r){for(let n in Wk(e,t,void 0,r),t.attrs)e.setAttribute(qk.has(n)?n:ek(n),t.attrs[n])}var Yk=class extends Uk{constructor(){super(...arguments),this.type=`svg`,this.isSVGTag=!1,this.measureInstanceViewportBox=Fk}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(qT.has(t)){let e=QE(t);return e&&e.default||0}return t=qk.has(t)?t:ek(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return XO(e,t,n)}build(e,t,n){FO(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,r){Jk(e,t,n,r)}mount(e){this.isSVGTag=LO(e.tagName),super.mount(e)}},Xk=(e,n)=>n.isSVG??BO(e)?new Yk(n):new Kk(n,{allowProjection:e!==t.Fragment});function Zk(e,t,n){let r=e.getProps();return UO(r,t,n===void 0?r.custom:n,e)}var Qk=e=>Array.isArray(e);function $k(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,uD(n))}function eA(e){return Qk(e)?e[e.length-1]||0:e}function tA(e,t){let{transitionEnd:n={},transition:r={},...i}=Zk(e,t)||{};for(let t in i={...i,...n},i)$k(e,t,eA(i[t]))}function nA(e){return!!(jD(e)&&e.add)}function rA(e,t){let n=e.getValue(`willChange`);if(nA(n))return n.add(t);if(!n&&QS.WillChange){let n=new QS.WillChange(`auto`);e.addValue(`willChange`,n),n.add(t)}}function iA(e){return e.props[tk]}var aA=e=>e!==null;function oA(e,{repeat:t,repeatType:n=`loop`},r){let i=e.filter(aA),a=t&&n!==`loop`&&t%2==1?0:i.length-1;return!a||r===void 0?i[a]:r}var sA={type:`spring`,stiffness:500,damping:25,restSpeed:10},cA=e=>({type:`spring`,stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),lA={type:`keyframes`,duration:.8},uA={type:`keyframes`,ease:[.25,.1,.35,1],duration:.3},dA=(e,{keyframes:t})=>t.length>2?lA:qT.has(e)?e.startsWith(`scale`)?cA(t[1]):sA:uA;function fA({when:e,delay:t,delayChildren:n,staggerChildren:r,staggerDirection:i,repeat:a,repeatType:o,repeatDelay:s,from:c,elapsed:l,...u}){return!!Object.keys(u).length}var pA=(e,t,n,r={},i,a)=>o=>{let s=RE(r,e)||{},c=s.delay||r.delay||0,{elapsed:l=0}=r;l-=cC(c);let u={keyframes:Array.isArray(n)?n:[null,n],ease:`easeOut`,velocity:t.getVelocity(),...s,delay:-l,onUpdate:e=>{t.set(e),s.onUpdate&&s.onUpdate(e)},onComplete:()=>{o(),s.onComplete&&s.onComplete()},name:e,motionValue:t,element:a?void 0:i};fA(s)||Object.assign(u,dA(e,u)),u.duration&&=cC(u.duration),u.repeatDelay&&=cC(u.repeatDelay),u.from!==void 0&&(u.keyframes[0]=u.from);let d=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(OE(u),u.delay===0&&(d=!0)),(QS.instantAnimations||QS.skipAnimations)&&(d=!0,OE(u),u.delay=0),u.allowFlatten=!s.type&&!s.ease,d&&!a&&t.get()!==void 0){let e=oA(u.keyframes,s);if(e!==void 0){BC.update(()=>{u.onUpdate(e),u.onComplete()});return}}return s.isSync?new MT(u):new NE(u)};function mA({protectedKeys:e,needsAnimating:t},n){let r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function hA(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:a=e.getDefaultTransition(),transitionEnd:o,...s}=t;r&&(a=r);let c=[],l=i&&e.animationState&&e.animationState.getState()[i];for(let t in s){let r=e.getValue(t,e.latestValues[t]??null),i=s[t];if(i===void 0||l&&mA(l,t))continue;let o={delay:n,...RE(a||{},t)},u=r.get();if(u!==void 0&&!r.isAnimating&&!Array.isArray(i)&&i===u&&!o.velocity)continue;let d=!1;if(window.MotionHandoffAnimation){let n=iA(e);if(n){let e=window.MotionHandoffAnimation(n,t,BC);e!==null&&(o.startTime=e,d=!0)}}rA(e,t),r.start(pA(t,r,i,e.shouldReduceMotion&&zE.has(t)?{type:!1}:o,e,d));let f=r.animation;f&&c.push(f)}return o&&Promise.all(c).then(()=>{BC.update(()=>{o&&tA(e,o)})}),c}function gA(e,t,n,r=0,i=1){let a=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),o=e.size,s=(o-1)*r;return typeof n==`function`?n(a,o):i===1?a*r:s-a*r}function _A(e,t,n={}){let r=Zk(e,t,n.type===`exit`?e.presenceContext?.custom:void 0),{transition:i=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);let a=r?()=>Promise.all(hA(e,r,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(r=0)=>{let{delayChildren:a=0,staggerChildren:o,staggerDirection:s}=i;return vA(e,t,r,a,o,s,n)}:()=>Promise.resolve(),{when:s}=i;if(s){let[e,t]=s===`beforeChildren`?[a,o]:[o,a];return e().then(()=>t())}else return Promise.all([a(),o(n.delay)])}function vA(e,t,n=0,r=0,i=0,a=1,o){let s=[];for(let c of e.variantChildren)c.notify(`AnimationStart`,t),s.push(_A(c,t,{...o,delay:n+(typeof r==`function`?0:r)+gA(e.variantChildren,c,r,i,a)}).then(()=>c.notify(`AnimationComplete`,t)));return Promise.all(s)}function yA(e,t,n={}){e.notify(`AnimationStart`,t);let r;if(Array.isArray(t)){let i=t.map(t=>_A(e,t,n));r=Promise.all(i)}else if(typeof t==`string`)r=_A(e,t,n);else{let i=typeof t==`function`?Zk(e,t,n.custom):t;r=Promise.all(hA(e,i,n))}return r.then(()=>{e.notify(`AnimationComplete`,t)})}function bA(e,t){if(!Array.isArray(t))return!1;let n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}var xA=dO.length;function SA(e){if(!e)return;if(!e.isControllingVariants){let t=e.parent&&SA(e.parent)||{};return e.props.initial!==void 0&&(t.initial=e.props.initial),t}let t={};for(let n=0;n<xA;n++){let r=dO[n],i=e.props[r];(lO(i)||i===!1)&&(t[r]=i)}return t}var CA=[...uO].reverse(),wA=uO.length;function TA(e){return t=>Promise.all(t.map(({animation:t,options:n})=>yA(e,t,n)))}function EA(e){let t=TA(e),n=kA(),r=!0,i=t=>(n,r)=>{let i=Zk(e,r,t===`exit`?e.presenceContext?.custom:void 0);if(i){let{transition:e,transitionEnd:t,...r}=i;n={...n,...r,...t}}return n};function a(n){t=n(e)}function o(a){let{props:o}=e,s=SA(e.parent)||{},c=[],l=new Set,u={},d=1/0;for(let t=0;t<wA;t++){let f=CA[t],p=n[f],m=o[f]===void 0?s[f]:o[f],h=lO(m),g=f===a?p.isActive:null;g===!1&&(d=t);let _=m===s[f]&&m!==o[f]&&h;if(_&&r&&e.manuallyAnimateOnMount&&(_=!1),p.protectedKeys={...u},!p.isActive&&g===null||!m&&!p.prevProp||cO(m)||typeof m==`boolean`)continue;let v=DA(p.prevProp,m),y=v||f===a&&p.isActive&&!_&&h||t>d&&h,b=!1,x=Array.isArray(m)?m:[m],S=x.reduce(i(f),{});g===!1&&(S={});let{prevResolvedValues:C={}}=p,w={...C,...S},T=t=>{y=!0,l.has(t)&&(b=!0,l.delete(t)),p.needsAnimating[t]=!0;let n=e.getValue(t);n&&(n.liveStyle=!1)};for(let e in w){let t=S[e],n=C[e];if(u.hasOwnProperty(e))continue;let r=!1;r=Qk(t)&&Qk(n)?!bA(t,n):t!==n,r?t==null?l.add(e):T(e):t!==void 0&&l.has(e)?T(e):p.protectedKeys[e]=!0}p.prevProp=m,p.prevResolvedValues=S,p.isActive&&(u={...u,...S}),r&&e.blockInitialAnimation&&(y=!1);let E=_&&v;y&&(!E||b)&&c.push(...x.map(t=>{let n={type:f};if(typeof t==`string`&&r&&!E&&e.manuallyAnimateOnMount&&e.parent){let{parent:r}=e,i=Zk(r,t);if(r.enteringChildren&&i){let{delayChildren:t}=i.transition||{};n.delay=gA(r.enteringChildren,e,t)}}return{animation:t,options:n}}))}if(l.size){let t={};if(typeof o.initial!=`boolean`){let n=Zk(e,Array.isArray(o.initial)?o.initial[0]:o.initial);n&&n.transition&&(t.transition=n.transition)}l.forEach(n=>{let r=e.getBaseTarget(n),i=e.getValue(n);i&&(i.liveStyle=!0),t[n]=r??null}),c.push({animation:t})}let f=!!c.length;return r&&(o.initial===!1||o.initial===o.animate)&&!e.manuallyAnimateOnMount&&(f=!1),r=!1,f?t(c):Promise.resolve()}function s(t,r){if(n[t].isActive===r)return Promise.resolve();e.variantChildren?.forEach(e=>e.animationState?.setActive(t,r)),n[t].isActive=r;let i=o(t);for(let e in n)n[e].protectedKeys={};return i}return{animateChanges:o,setActive:s,setAnimateFunction:a,getState:()=>n,reset:()=>{n=kA()}}}function DA(e,t){return typeof t==`string`?t!==e:Array.isArray(t)?!bA(t,e):!1}function OA(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function kA(){return{animate:OA(!0),whileInView:OA(),whileHover:OA(),whileTap:OA(),whileDrag:OA(),whileFocus:OA(),exit:OA()}}var AA=class{constructor(e){this.isMounted=!1,this.node=e}update(){}},jA=class extends AA{constructor(e){super(e),e.animationState||=EA(e)}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();cO(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}},MA=0,NA={animation:{Feature:jA},exit:{Feature:class extends AA{constructor(){super(...arguments),this.id=MA++}update(){if(!this.node.presenceContext)return;let{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;let r=this.node.animationState.setActive(`exit`,!e);t&&!e&&r.then(()=>{t(this.id)})}mount(){let{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}}};function PA(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}function FA(e){return{point:{x:e.pageX,y:e.pageY}}}var IA=e=>t=>bD(t)&&e(t,FA(t));function LA(e,t,n,r){return PA(e,t,IA(n),r)}var RA=1e-4,zA=1-RA,BA=1+RA,VA=.01,HA=0-VA,UA=0+VA;function WA(e){return e.max-e.min}function GA(e,t,n){return Math.abs(e-t)<=n}function KA(e,t,n,r=.5){e.origin=r,e.originPoint=zw(t.min,t.max,e.origin),e.scale=WA(n)/WA(t),e.translate=zw(n.min,n.max,e.origin)-e.originPoint,(e.scale>=zA&&e.scale<=BA||isNaN(e.scale))&&(e.scale=1),(e.translate>=HA&&e.translate<=UA||isNaN(e.translate))&&(e.translate=0)}function qA(e,t,n,r){KA(e.x,t.x,n.x,r?r.originX:void 0),KA(e.y,t.y,n.y,r?r.originY:void 0)}function JA(e,t,n){e.min=n.min+t.min,e.max=e.min+WA(t)}function YA(e,t,n){JA(e.x,t.x,n.x),JA(e.y,t.y,n.y)}function XA(e,t,n){e.min=t.min-n.min,e.max=e.min+WA(t)}function ZA(e,t,n){XA(e.x,t.x,n.x),XA(e.y,t.y,n.y)}function QA(e){return[e(`x`),e(`y`)]}var $A=({current:e})=>e?e.ownerDocument.defaultView:null,ej=(e,t)=>Math.abs(e-t);function tj(e,t){let n=ej(e.x,t.x),r=ej(e.y,t.y);return Math.sqrt(n**2+r**2)}var nj=new Set([`auto`,`scroll`]),rj=class{constructor(e,t,{transformPagePoint:n,contextWindow:r=window,dragSnapToOrigin:i=!1,distanceThreshold:a=3,element:o}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=e=>{this.handleScroll(e.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let e=oj(this.lastMoveEventInfo,this.history),t=this.startEvent!==null,n=tj(e.offset,{x:0,y:0})>=this.distanceThreshold;if(!t&&!n)return;let{point:r}=e,{timestamp:i}=HC;this.history.push({...r,timestamp:i});let{onStart:a,onMove:o}=this.handlers;t||(a&&a(this.lastMoveEvent,e),this.startEvent=this.lastMoveEvent),o&&o(this.lastMoveEvent,e)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastMoveEventInfo=ij(t,this.transformPagePoint),BC.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.end();let{onEnd:n,onSessionEnd:r,resumeAnimation:i}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&i&&i(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let a=oj(e.type===`pointercancel`?this.lastMoveEventInfo:ij(t,this.transformPagePoint),this.history);this.startEvent&&n&&n(e,a),r&&r(e,a)},!bD(e))return;this.dragSnapToOrigin=i,this.handlers=t,this.transformPagePoint=n,this.distanceThreshold=a,this.contextWindow=r||window;let s=ij(FA(e),this.transformPagePoint),{point:c}=s,{timestamp:l}=HC;this.history=[{...c,timestamp:l}];let{onSessionStart:u}=t;u&&u(e,oj(s,this.history)),this.removeListeners=aC(LA(this.contextWindow,`pointermove`,this.handlePointerMove),LA(this.contextWindow,`pointerup`,this.handlePointerUp),LA(this.contextWindow,`pointercancel`,this.handlePointerUp)),o&&this.startScrollTracking(o)}startScrollTracking(e){let t=e.parentElement;for(;t;){let e=getComputedStyle(t);(nj.has(e.overflowX)||nj.has(e.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener(`scroll`,this.onElementScroll,{capture:!0,passive:!0}),window.addEventListener(`scroll`,this.onWindowScroll,{passive:!0}),this.removeScrollListeners=()=>{window.removeEventListener(`scroll`,this.onElementScroll,{capture:!0}),window.removeEventListener(`scroll`,this.onWindowScroll)}}handleScroll(e){let t=this.scrollPositions.get(e);if(!t)return;let n=e===window,r=n?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},i={x:r.x-t.x,y:r.y-t.y};i.x===0&&i.y===0||(n?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=i.x,this.lastMoveEventInfo.point.y+=i.y):this.history.length>0&&(this.history[0].x-=i.x,this.history[0].y-=i.y),this.scrollPositions.set(e,r),BC.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),VC(this.updatePoint)}};function ij(e,t){return t?{point:t(e.point)}:e}function aj(e,t){return{x:e.x-t.x,y:e.y-t.y}}function oj({point:e},t){return{point:e,delta:aj(e,cj(t)),offset:aj(e,sj(t)),velocity:lj(t,.1)}}function sj(e){return e[0]}function cj(e){return e[e.length-1]}function lj(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null,i=cj(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>cC(t)));)n--;if(!r)return{x:0,y:0};let a=lC(i.timestamp-r.timestamp);if(a===0)return{x:0,y:0};let o={x:(i.x-r.x)/a,y:(i.y-r.y)/a};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function uj(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?zw(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?zw(n,e,r.max):Math.min(e,n)),e}function dj(e,t,n){return{min:t===void 0?void 0:e.min+t,max:n===void 0?void 0:e.max+n-(e.max-e.min)}}function fj(e,{top:t,left:n,bottom:r,right:i}){return{x:dj(e.x,n,i),y:dj(e.y,t,r)}}function pj(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function mj(e,t){return{x:pj(e.x,t.x),y:pj(e.y,t.y)}}function hj(e,t){let n=.5,r=WA(e),i=WA(t);return i>r?n=oC(t.min,t.max-r,e.min):r>i&&(n=oC(e.min,e.max-i,t.min)),JS(0,1,n)}function gj(e,t){let n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}var _j=.35;function vj(e=_j){return e===!1?e=0:e===!0&&(e=_j),{x:yj(e,`left`,`right`),y:yj(e,`top`,`bottom`)}}function yj(e,t,n){return{min:bj(e,t),max:bj(e,n)}}function bj(e,t){return typeof e==`number`?e:e[t]||0}var xj=new WeakMap,Sj=class{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Fk(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:n}={}){let{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;let i=e=>{t?(this.stopAnimation(),this.snapToCursor(FA(e).point)):this.pauseAnimation()},a=(e,t)=>{this.stopAnimation();let{drag:n,dragPropagation:r,onDragStart:i}=this.getProps();if(n&&!r&&(this.openDragLock&&this.openDragLock(),this.openDragLock=hD(n),!this.openDragLock))return;this.latestPointerEvent=e,this.latestPanInfo=t,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),QA(e=>{let t=this.getAxisMotionValue(e).get()||0;if(gw.test(t)){let{projection:n}=this.visualElement;if(n&&n.layout){let r=n.layout.layoutBox[e];r&&(t=WA(r)*(parseFloat(t)/100))}}this.originPoint[e]=t}),i&&BC.postRender(()=>i(e,t)),rA(this.visualElement,`transform`);let{animationState:a}=this.visualElement;a&&a.setActive(`whileDrag`,!0)},o=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t;let{dragPropagation:n,dragDirectionLock:r,onDirectionLock:i,onDrag:a}=this.getProps();if(!n&&!this.openDragLock)return;let{offset:o}=t;if(r&&this.currentDirection===null){this.currentDirection=wj(o),this.currentDirection!==null&&i&&i(this.currentDirection);return}this.updateAxis(`x`,t.point,o),this.updateAxis(`y`,t.point,o),this.visualElement.render(),a&&a(e,t)},s=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},c=()=>QA(e=>this.getAnimationState(e)===`paused`&&this.getAxisMotionValue(e).animation?.play()),{dragSnapToOrigin:l}=this.getProps();this.panSession=new rj(e,{onSessionStart:i,onStart:a,onMove:o,onSessionEnd:s,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,distanceThreshold:n,contextWindow:$A(this.visualElement),element:this.visualElement.current})}stop(e,t){let n=e||this.latestPointerEvent,r=t||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!r||!n)return;let{velocity:a}=r;this.startAnimation(a);let{onDragEnd:o}=this.getProps();o&&BC.postRender(()=>o(n,r))}cancel(){this.isDragging=!1;let{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;let{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive(`whileDrag`,!1)}updateAxis(e,t,n){let{drag:r}=this.getProps();if(!n||!Cj(e,r,this.currentDirection))return;let i=this.getAxisMotionValue(e),a=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(a=uj(a,this.constraints[e],this.elastic[e])),i.set(a)}resolveConstraints(){let{dragConstraints:e,dragElastic:t}=this.getProps(),n=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,r=this.constraints;e&&rk(e)?this.constraints||=this.resolveRefConstraints():e&&n?this.constraints=fj(n.layoutBox,e):this.constraints=!1,this.elastic=vj(t),r!==this.constraints&&n&&this.constraints&&!this.hasMutatedConstraints&&QA(e=>{this.constraints!==!1&&this.getAxisMotionValue(e)&&(this.constraints[e]=gj(n.layoutBox[e],this.constraints[e]))})}resolveRefConstraints(){let{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!rk(e))return!1;let n=e.current;ZS(n!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.",`drag-constraints-ref`);let{projection:r}=this.visualElement;if(!r||!r.layout)return!1;let i=jk(n,r.root,this.visualElement.getTransformPagePoint()),a=mj(r.layout.layoutBox,i);if(t){let e=t(pk(a));this.hasMutatedConstraints=!!e,e&&(a=fk(e))}return a}startAnimation(e){let{drag:t,dragMomentum:n,dragElastic:r,dragTransition:i,dragSnapToOrigin:a,onDragTransitionEnd:o}=this.getProps(),s=this.constraints||{},c=QA(o=>{if(!Cj(o,t,this.currentDirection))return;let c=s&&s[o]||{};a&&(c={min:0,max:0});let l=r?200:1e6,u=r?40:1e7,d={type:`inertia`,velocity:n?e[o]:0,bounceStiffness:l,bounceDamping:u,timeConstant:750,restDelta:1,restSpeed:10,...i,...c};return this.startAxisValueAnimation(o,d)});return Promise.all(c).then(o)}startAxisValueAnimation(e,t){let n=this.getAxisMotionValue(e);return rA(this.visualElement,e),n.start(pA(e,n,0,t,this.visualElement,!1))}stopAnimation(){QA(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){QA(e=>this.getAxisMotionValue(e).animation?.pause())}getAnimationState(e){return this.getAxisMotionValue(e).animation?.state}getAxisMotionValue(e){let t=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps();return n[t]||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){QA(t=>{let{drag:n}=this.getProps();if(!Cj(t,n,this.currentDirection))return;let{projection:r}=this.visualElement,i=this.getAxisMotionValue(t);if(r&&r.layout){let{min:n,max:a}=r.layout.layoutBox[t],o=i.get()||0;i.set(e[t]-zw(n,a,.5)+o)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:e,dragConstraints:t}=this.getProps(),{projection:n}=this.visualElement;if(!rk(t)||!n||!this.constraints)return;this.stopAnimation();let r={x:0,y:0};QA(e=>{let t=this.getAxisMotionValue(e);if(t&&this.constraints!==!1){let n=t.get();r[e]=hj({min:n,max:n},this.constraints[e])}});let{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},``):`none`,n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),QA(t=>{if(!Cj(t,e,null))return;let n=this.getAxisMotionValue(t),{min:i,max:a}=this.constraints[t];n.set(zw(i,a,r[t]))})}addListeners(){if(!this.visualElement.current)return;xj.set(this.visualElement,this);let e=this.visualElement.current,t=LA(e,`pointerdown`,e=>{let{drag:t,dragListener:n=!0}=this.getProps();t&&n&&!SD(e.target)&&this.start(e)}),n=()=>{let{dragConstraints:e}=this.getProps();rk(e)&&e.current&&(this.constraints=this.resolveRefConstraints())},{projection:r}=this.visualElement,i=r.addEventListener(`measure`,n);r&&!r.layout&&(r.root&&r.root.updateScroll(),r.updateLayout()),BC.read(n);let a=PA(window,`resize`,()=>this.scalePositionWithinConstraints()),o=r.addEventListener(`didUpdate`,(({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(QA(t=>{let n=this.getAxisMotionValue(t);n&&(this.originPoint[t]+=e[t].translate,n.set(n.get()+e[t].translate))}),this.visualElement.render())}));return()=>{a(),t(),i(),o&&o()}}getProps(){let e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:n=!1,dragPropagation:r=!1,dragConstraints:i=!1,dragElastic:a=_j,dragMomentum:o=!0}=e;return{...e,drag:t,dragDirectionLock:n,dragPropagation:r,dragConstraints:i,dragElastic:a,dragMomentum:o}}};function Cj(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function wj(e,t=10){let n=null;return Math.abs(e.y)>t?n=`y`:Math.abs(e.x)>t&&(n=`x`),n}var Tj=class extends AA{constructor(e){super(e),this.removeGroupControls=rC,this.removeListeners=rC,this.controls=new Sj(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||rC}update(){let{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners()}},Ej=e=>(t,n)=>{e&&BC.postRender(()=>e(t,n))},Dj=class extends AA{constructor(){super(...arguments),this.removePointerDownListener=rC}onPointerDown(e){this.session=new rj(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:$A(this.node)})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:Ej(e),onStart:Ej(t),onMove:n,onEnd:(e,t)=>{delete this.session,r&&BC.postRender(()=>r(e,t))}}}mount(){this.removePointerDownListener=LA(this.node.current,`pointerdown`,e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}},Oj={hasAnimatedSinceResize:!0,hasEverUpdated:!1},kj=!1,Aj=class extends t.Component{componentDidMount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n,layoutId:r}=this.props,{projection:i}=e;i&&(t.group&&t.group.add(i),n&&n.register&&r&&n.register(i),kj&&i.root.didUpdate(),i.addEventListener(`animationComplete`,()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),Oj.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layoutDependency:t,visualElement:n,drag:r,isPresent:i}=this.props,{projection:a}=n;return a?(a.isPresent=i,kj=!0,r||e.layoutDependency!==t||t===void 0||e.isPresent!==i?a.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?a.promote():a.relegate()||BC.postRender(()=>{let e=a.getStack();(!e||!e.members.length)&&this.safeToRemove()})),null):null}componentDidUpdate(){let{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),dD.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:r}=e;kj=!0,r&&(r.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(r),n&&n.deregister&&n.deregister(r))}safeToRemove(){let{safeToRemove:e}=this.props;e&&e()}render(){return null}};function jj(e){let[n,i]=HD(),a=(0,t.useContext)(VS);return(0,r.jsx)(Aj,{...e,layoutGroup:a,switchLayoutGroup:(0,t.useContext)(nk),isPresent:n,safeToRemove:i})}function Mj(e,t,n){let r=jD(e)?e:uD(e);return r.start(pA(``,r,t,n)),r.animation}var Nj=(e,t)=>e.depth-t.depth,Pj=class{constructor(){this.children=[],this.isDirty=!1}add(e){KS(this.children,e),this.isDirty=!0}remove(e){qS(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Nj),this.isDirty=!1,this.children.forEach(e)}};function Fj(e,t){let n=KC.now(),r=({timestamp:i})=>{let a=i-n;a>=t&&(VC(r),e(a-t))};return BC.setup(r,!0),()=>VC(r)}var Ij=[`TopLeft`,`TopRight`,`BottomLeft`,`BottomRight`],Lj=Ij.length,Rj=e=>typeof e==`string`?parseFloat(e):e,zj=e=>typeof e==`number`||Q.test(e);function Bj(e,t,n,r,i,a){i?(e.opacity=zw(0,n.opacity??1,Hj(r)),e.opacityExit=zw(t.opacity??1,0,Uj(r))):a&&(e.opacity=zw(t.opacity??1,n.opacity??1,r));for(let i=0;i<Lj;i++){let a=`border${Ij[i]}Radius`,o=Vj(t,a),s=Vj(n,a);o===void 0&&s===void 0||(o||=0,s||=0,o===0||s===0||zj(o)===zj(s)?(e[a]=Math.max(zw(Rj(o),Rj(s),r),0),(gw.test(s)||gw.test(o))&&(e[a]+=`%`)):e[a]=s)}(t.rotate||n.rotate)&&(e.rotate=zw(t.rotate||0,n.rotate||0,r))}function Vj(e,t){return e[t]===void 0?e.borderRadius:e[t]}var Hj=Wj(0,.5,TC),Uj=Wj(.5,.95,rC);function Wj(e,t,n){return r=>r<e?0:r>t?1:n(oC(e,t,r))}function Gj(e,t){e.min=t.min,e.max=t.max}function Kj(e,t){Gj(e.x,t.x),Gj(e.y,t.y)}function qj(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function Jj(e,t,n,r,i){return e-=t,e=bk(e,1/n,r),i!==void 0&&(e=bk(e,1/i,r)),e}function Yj(e,t=0,n=1,r=.5,i,a=e,o=e){if(gw.test(t)&&(t=parseFloat(t),t=zw(o.min,o.max,t/100)-o.min),typeof t!=`number`)return;let s=zw(a.min,a.max,r);e===a&&(s-=t),e.min=Jj(e.min,t,n,s,i),e.max=Jj(e.max,t,n,s,i)}function Xj(e,t,[n,r,i],a,o){Yj(e,t[n],t[r],t[i],t.scale,a,o)}var Zj=[`x`,`scaleX`,`originX`],Qj=[`y`,`scaleY`,`originY`];function $j(e,t,n,r){Xj(e.x,t,Zj,n?n.x:void 0,r?r.x:void 0),Xj(e.y,t,Qj,n?n.y:void 0,r?r.y:void 0)}function eM(e){return e.translate===0&&e.scale===1}function tM(e){return eM(e.x)&&eM(e.y)}function nM(e,t){return e.min===t.min&&e.max===t.max}function rM(e,t){return nM(e.x,t.x)&&nM(e.y,t.y)}function iM(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function aM(e,t){return iM(e.x,t.x)&&iM(e.y,t.y)}function oM(e){return WA(e.x)/WA(e.y)}function sM(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}var cM=class{constructor(){this.members=[]}add(e){KS(this.members,e),e.scheduleRender()}remove(e){if(qS(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){let e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){let t=this.members.findIndex(t=>e===t);if(t===0)return!1;let n;for(let e=t;e>=0;e--){let t=this.members[e];if(t.isPresent!==!1){n=t;break}}return n?(this.promote(n),!0):!1}promote(e,t){let n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.instance&&n.scheduleRender(),e.scheduleRender(),e.resumeFrom=n,t&&(e.resumeFrom.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);let{crossfade:r}=e.options;r===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{let{options:t,resumingFrom:n}=e;t.onExitComplete&&t.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}};function lM(e,t,n){let r=``,i=e.x.translate/t.x,a=e.y.translate/t.y,o=n?.z||0;if((i||a||o)&&(r=`translate3d(${i}px, ${a}px, ${o}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){let{transformPerspective:e,rotate:t,rotateX:i,rotateY:a,skewX:o,skewY:s}=n;e&&(r=`perspective(${e}px) ${r}`),t&&(r+=`rotate(${t}deg) `),i&&(r+=`rotateX(${i}deg) `),a&&(r+=`rotateY(${a}deg) `),o&&(r+=`skewX(${o}deg) `),s&&(r+=`skewY(${s}deg) `)}let s=e.x.scale*t.x,c=e.y.scale*t.y;return(s!==1||c!==1)&&(r+=`scale(${s}, ${c})`),r||`none`}var uM={nodes:0,calculatedTargetDeltas:0,calculatedProjections:0},dM=[``,`X`,`Y`,`Z`],fM=1e3,pM=0;function mM(e,t,n,r){let{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function hM(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;let{visualElement:t}=e.options;if(!t)return;let n=iA(t);if(window.MotionHasOptimisedAnimation(n,`transform`)){let{layout:t,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,`transform`,BC,!(t||r))}let{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&hM(r)}function gM({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(e={},n=t?.()){this.id=pM++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,IC.value&&(uM.nodes=uM.calculatedTargetDeltas=uM.calculatedProjections=0),this.nodes.forEach(yM),this.nodes.forEach(EM),this.nodes.forEach(DM),this.nodes.forEach(bM),IC.addProjectionMetrics&&IC.addProjectionMetrics(uM)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=n?n.root||n:this,this.path=n?[...n.path,n]:[],this.parent=n,this.depth=n?n.depth+1:0;for(let e=0;e<this.path.length;e++)this.path[e].shouldResetTransform=!0;this.root===this&&(this.nodes=new Pj)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new sC),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){let n=this.eventHandlers.get(e);n&&n.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t){if(this.instance)return;this.isSVG=kD(t)&&!AD(t),this.instance=t;let{layoutId:n,layout:r,visualElement:i}=this.options;if(i&&!i.current&&i.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(r||n)&&(this.isLayoutDirty=!0),e){let n,r=0,i=()=>this.root.updateBlockedByResize=!1;BC.read(()=>{r=window.innerWidth}),e(t,()=>{let e=window.innerWidth;e!==r&&(r=e,this.root.updateBlockedByResize=!0,n&&n(),n=Fj(i,250),Oj.hasAnimatedSinceResize&&(Oj.hasAnimatedSinceResize=!1,this.nodes.forEach(TM)))})}n&&this.root.registerSharedNode(n,this),this.options.animate!==!1&&i&&(n||r)&&this.addEventListener(`didUpdate`,({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:n,layout:r})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let a=this.options.transition||i.getDefaultTransition()||PM,{onLayoutAnimationStart:o,onLayoutAnimationComplete:s}=i.getProps(),c=!this.targetLayout||!aM(this.targetLayout,r),l=!t&&n;if(this.options.layoutRoot||this.resumeFrom||l||t&&(c||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);let t={...RE(a,`layout`),onPlay:o,onComplete:s};(i.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,l)}else t||TM(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=r})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),VC(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(OM),this.animationId++)}getTransformTemplate(){let{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&hM(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let e=0;e<this.path.length;e++){let t=this.path[e];t.shouldResetTransform=!0,t.updateScroll(`snapshot`),t.options.layoutRoot&&t.willUpdate(!1)}let{layoutId:t,layout:n}=this.options;if(t===void 0&&!n)return;let r=this.getTransformTemplate();this.prevTransformTemplateValue=r?r(this.latestValues,``):void 0,this.updateSnapshot(),e&&this.notifyListeners(`willUpdate`)}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(SM);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(CM);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(wM),this.nodes.forEach(_M),this.nodes.forEach(vM)):this.nodes.forEach(CM),this.clearAllSnapshots();let e=KC.now();HC.delta=JS(0,1e3/60,e-HC.timestamp),HC.timestamp=e,HC.isProcessing=!0,UC.update.process(HC),UC.preRender.process(HC),UC.render.process(HC),HC.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,dD.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(xM),this.sharedNodes.forEach(kM)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,BC.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){BC.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!WA(this.snapshot.measuredBox.x)&&!WA(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let e=0;e<this.path.length;e++)this.path[e].updateScroll();let e=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=Fk(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners(`measure`,this.layout.layoutBox);let{visualElement:t}=this.options;t&&t.notify(`LayoutMeasure`,this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e=`measure`){let t=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t&&this.instance){let t=r(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!i)return;let e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!tM(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,``):void 0,a=r!==this.prevTransformTemplateValue;e&&this.instance&&(t||_k(this.latestValues)||a)&&(i(this.instance,r),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){let t=this.measurePageBox(),n=this.removeElementScroll(t);return e&&(n=this.removeTransform(n)),RM(n),{animationId:this.root.animationId,measuredBox:t,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:e}=this.options;if(!e)return Fk();let t=e.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(BM))){let{scroll:e}=this.root;e&&(Dk(t.x,e.offset.x),Dk(t.y,e.offset.y))}return t}removeElementScroll(e){let t=Fk();if(Kj(t,e),this.scroll?.wasRoot)return t;for(let n=0;n<this.path.length;n++){let r=this.path[n],{scroll:i,options:a}=r;r!==this.root&&i&&a.layoutScroll&&(i.wasRoot&&Kj(t,e),Dk(t.x,i.offset.x),Dk(t.y,i.offset.y))}return t}applyTransform(e,t=!1){let n=Fk();Kj(n,e);for(let e=0;e<this.path.length;e++){let r=this.path[e];!t&&r.options.layoutScroll&&r.scroll&&r!==r.root&&kk(n,{x:-r.scroll.offset.x,y:-r.scroll.offset.y}),_k(r.latestValues)&&kk(n,r.latestValues)}return _k(this.latestValues)&&kk(n,this.latestValues),n}removeTransform(e){let t=Fk();Kj(t,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];if(!n.instance||!_k(n.latestValues))continue;gk(n.latestValues)&&n.updateSnapshot();let r=Fk();Kj(r,n.measurePageBox()),$j(t,n.latestValues,n.snapshot?n.snapshot.layoutBox:void 0,r)}return _k(this.latestValues)&&$j(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:e.crossfade===void 0?!0:e.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==HC.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){let t=this.getLead();this.isProjectionDirty||=t.isProjectionDirty,this.isTransformDirty||=t.isTransformDirty,this.isSharedProjectionDirty||=t.isSharedProjectionDirty;let n=!!this.resumingFrom||this!==t;if(!(e||n&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;let{layout:r,layoutId:i}=this.options;if(!this.layout||!(r||i))return;this.resolvedRelativeTargetAt=HC.timestamp;let a=this.getClosestProjectingParent();a&&this.linkedParentVersion!==a.layoutVersion&&!a.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(a&&a.layout?this.createRelativeTarget(a,this.layout.layoutBox,a.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=Fk(),this.targetWithTransforms=Fk()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),YA(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Kj(this.target,this.layout.layoutBox),Ck(this.target,this.targetDelta)):Kj(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,a&&!!a.resumingFrom==!!this.resumingFrom&&!a.options.layoutScroll&&a.target&&this.animationProgress!==1?this.createRelativeTarget(a,this.target,a.target):this.relativeParent=this.relativeTarget=void 0),IC.value&&uM.calculatedTargetDeltas++)}getClosestProjectingParent(){if(!(!this.parent||gk(this.parent.latestValues)||vk(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(e,t,n){this.relativeParent=e,this.linkedParentVersion=e.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Fk(),this.relativeTargetOrigin=Fk(),ZA(this.relativeTargetOrigin,t,n),Kj(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){let e=this.getLead(),t=!!this.resumingFrom||this!==e,n=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(n=!1),t&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(n=!1),this.resolvedRelativeTargetAt===HC.timestamp&&(n=!1),n)return;let{layout:r,layoutId:i}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(r||i))return;Kj(this.layoutCorrected,this.layout.layoutBox);let a=this.treeScale.x,o=this.treeScale.y;Ek(this.layoutCorrected,this.treeScale,this.path,t),e.layout&&!e.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(e.target=e.layout.layoutBox,e.targetWithTransforms=Fk());let{target:s}=e;if(!s){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(qj(this.prevProjectionDelta.x,this.projectionDelta.x),qj(this.prevProjectionDelta.y,this.projectionDelta.y)),qA(this.projectionDelta,this.layoutCorrected,s,this.latestValues),(this.treeScale.x!==a||this.treeScale.y!==o||!sM(this.projectionDelta.x,this.prevProjectionDelta.x)||!sM(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners(`projectionUpdate`,s)),IC.value&&uM.calculatedProjections++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){if(this.options.visualElement?.scheduleRender(),e){let e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Nk(),this.projectionDelta=Nk(),this.projectionDeltaWithTransform=Nk()}setAnimationOrigin(e,t=!1){let n=this.snapshot,r=n?n.latestValues:{},i={...this.latestValues},a=Nk();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let o=Fk(),s=(n?n.source:void 0)!==(this.layout?this.layout.source:void 0),c=this.getStack(),l=!c||c.members.length<=1,u=!!(s&&!l&&this.options.crossfade===!0&&!this.path.some(NM));this.animationProgress=0;let d;this.mixTargetDelta=t=>{let n=t/1e3;AM(a.x,e.x,n),AM(a.y,e.y,n),this.setTargetDelta(a),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(ZA(o,this.layout.layoutBox,this.relativeParent.layout.layoutBox),MM(this.relativeTarget,this.relativeTargetOrigin,o,n),d&&rM(this.relativeTarget,d)&&(this.isProjectionDirty=!1),d||=Fk(),Kj(d,this.relativeTarget)),s&&(this.animationValues=i,Bj(i,r,this.latestValues,n,u,l)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(e){this.notifyListeners(`animationStart`),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&=(VC(this.pendingAnimation),void 0),this.pendingAnimation=BC.update(()=>{Oj.hasAnimatedSinceResize=!0,qC.layout++,this.motionValue||=uD(0),this.currentAnimation=Mj(this.motionValue,[0,1e3],{...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onStop:()=>{qC.layout--},onComplete:()=>{qC.layout--,e.onComplete&&e.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners(`animationComplete`)}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(fM),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let e=this.getLead(),{targetWithTransforms:t,target:n,layout:r,latestValues:i}=e;if(!(!t||!n||!r)){if(this!==e&&this.layout&&r&&zM(this.options.animationType,this.layout.layoutBox,r.layoutBox)){n=this.target||Fk();let t=WA(this.layout.layoutBox.x);n.x.min=e.target.x.min,n.x.max=n.x.min+t;let r=WA(this.layout.layoutBox.y);n.y.min=e.target.y.min,n.y.max=n.y.min+r}Kj(t,n),kk(t,i),qA(this.projectionDeltaWithTransform,this.layoutCorrected,t,i)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new cM),this.sharedNodes.get(e).add(t);let n=t.options.initialPromotionConfig;t.promote({transition:n?n.transition:void 0,preserveFollowOpacity:n&&n.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(t):void 0})}isLead(){let e=this.getStack();return e?e.lead===this:!0}getLead(){let{layoutId:e}=this.options;return e&&this.getStack()?.lead||this}getPrevLead(){let{layoutId:e}=this.options;return e?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:n}={}){let r=this.getStack();r&&r.promote(this,n),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){let e=this.getStack();return e?e.relegate(this):!1}resetSkewAndRotation(){let{visualElement:e}=this.options;if(!e)return;let t=!1,{latestValues:n}=e;if((n.z||n.rotate||n.rotateX||n.rotateY||n.rotateZ||n.skewX||n.skewY)&&(t=!0),!t)return;let r={};n.z&&mM(`z`,e,r,this.animationValues);for(let t=0;t<dM.length;t++)mM(`rotate${dM[t]}`,e,r,this.animationValues),mM(`skew${dM[t]}`,e,r,this.animationValues);for(let t in e.render(),r)e.setStaticValue(t,r[t]),this.animationValues&&(this.animationValues[t]=r[t]);e.scheduleRender()}applyProjectionStyles(e,t){if(!this.instance||this.isSVG)return;if(!this.isVisible){e.visibility=`hidden`;return}let n=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,e.visibility=``,e.opacity=``,e.pointerEvents=WO(t?.pointerEvents)||``,e.transform=n?n(this.latestValues,``):`none`;return}let r=this.getLead();if(!this.projectionDelta||!this.layout||!r.target){this.options.layoutId&&(e.opacity=this.latestValues.opacity===void 0?1:this.latestValues.opacity,e.pointerEvents=WO(t?.pointerEvents)||``),this.hasProjected&&!_k(this.latestValues)&&(e.transform=n?n({},``):`none`,this.hasProjected=!1);return}e.visibility=``;let i=r.animationValues||r.latestValues;this.applyTransformsToTarget();let a=lM(this.projectionDeltaWithTransform,this.treeScale,i);n&&(a=n(i,a)),e.transform=a;let{x:o,y:s}=this.projectionDelta;for(let t in e.transformOrigin=`${o.origin*100}% ${s.origin*100}% 0`,r.animationValues?e.opacity=r===this?i.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:i.opacityExit:e.opacity=r===this?i.opacity===void 0?``:i.opacity:i.opacityExit===void 0?0:i.opacityExit,bO){if(i[t]===void 0)continue;let{correct:n,applyTo:o,isCSSVariable:s}=bO[t],c=a===`none`?i[t]:n(i[t],r);if(o){let t=o.length;for(let n=0;n<t;n++)e[o[n]]=c}else s?this.options.visualElement.renderState.vars[t]=c:e[t]=c}this.options.layoutId&&(e.pointerEvents=r===this?WO(t?.pointerEvents)||``:`none`)}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(SM),this.root.sharedNodes.clear()}}}function _M(e){e.updateLayout()}function vM(e){let t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners(`didUpdate`)){let{layoutBox:n,measuredBox:r}=e.layout,{animationType:i}=e.options,a=t.source!==e.layout.source;i===`size`?QA(e=>{let r=a?t.measuredBox[e]:t.layoutBox[e],i=WA(r);r.min=n[e].min,r.max=r.min+i}):zM(i,t.layoutBox,n)&&QA(r=>{let i=a?t.measuredBox[r]:t.layoutBox[r],o=WA(n[r]);i.max=i.min+o,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[r].max=e.relativeTarget[r].min+o)});let o=Nk();qA(o,n,t.layoutBox);let s=Nk();a?qA(s,e.applyTransform(r,!0),t.measuredBox):qA(s,n,t.layoutBox);let c=!tM(o),l=!1;if(!e.resumeFrom){let r=e.getClosestProjectingParent();if(r&&!r.resumeFrom){let{snapshot:i,layout:a}=r;if(i&&a){let o=Fk();ZA(o,t.layoutBox,i.layoutBox);let s=Fk();ZA(s,n,a.layoutBox),aM(o,s)||(l=!0),r.options.layoutRoot&&(e.relativeTarget=s,e.relativeTargetOrigin=o,e.relativeParent=r)}}}e.notifyListeners(`didUpdate`,{layout:n,snapshot:t,delta:s,layoutDelta:o,hasLayoutChanged:c,hasRelativeLayoutChanged:l})}else if(e.isLead()){let{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function yM(e){IC.value&&uM.nodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty),e.isTransformDirty||=e.parent.isTransformDirty)}function bM(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function xM(e){e.clearSnapshot()}function SM(e){e.clearMeasurements()}function CM(e){e.isLayoutDirty=!1}function wM(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify(`BeforeLayoutMeasure`),e.resetTransform()}function TM(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function EM(e){e.resolveTargetDelta()}function DM(e){e.calcProjection()}function OM(e){e.resetSkewAndRotation()}function kM(e){e.removeLeadSnapshot()}function AM(e,t,n){e.translate=zw(t.translate,0,n),e.scale=zw(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function jM(e,t,n,r){e.min=zw(t.min,n.min,r),e.max=zw(t.max,n.max,r)}function MM(e,t,n,r){jM(e.x,t.x,n.x,r),jM(e.y,t.y,n.y,r)}function NM(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}var PM={duration:.45,ease:[.4,0,.1,1]},FM=e=>typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),IM=FM(`applewebkit/`)&&!FM(`chrome/`)?Math.round:rC;function LM(e){e.min=IM(e.min),e.max=IM(e.max)}function RM(e){LM(e.x),LM(e.y)}function zM(e,t,n){return e===`position`||e===`preserve-aspect`&&!GA(oM(t),oM(n),.2)}function BM(e){return e!==e.root&&e.scroll?.wasRoot}var VM=gM({attachResizeListener:(e,t)=>PA(e,`resize`,t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),HM={current:void 0},UM=gM({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!HM.current){let e=new VM({});e.mount(window),e.setOptions({layoutScroll:!0}),HM.current=e}return HM.current},resetTransform:(e,t)=>{e.style.transform=t===void 0?`none`:t},checkIsScrollRoot:e=>window.getComputedStyle(e).position===`fixed`}),WM={pan:{Feature:Dj},drag:{Feature:Tj,ProjectionNode:UM,MeasureLayout:jj}};function GM(e,t,n){let{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive(`whileHover`,n===`Start`);let i=r[`onHover`+n];i&&BC.postRender(()=>i(t,FA(t)))}var KM=class extends AA{mount(){let{current:e}=this.node;e&&(this.unmount=vD(e,(e,t)=>(GM(this.node,t,`Start`),e=>GM(this.node,e,`End`))))}unmount(){}},qM=class extends AA{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(`:focus-visible`)}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!1),this.isActive=!1)}mount(){this.unmount=aC(PA(this.node.current,`focus`,()=>this.onFocus()),PA(this.node.current,`blur`,()=>this.onBlur()))}unmount(){}};function JM(e,t,n){let{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive(`whileTap`,n===`Start`);let i=r[`onTap`+(n===`End`?``:n)];i&&BC.postRender(()=>i(t,FA(t)))}var YM=class extends AA{mount(){let{current:e}=this.node;e&&(this.unmount=OD(e,(e,t)=>(JM(this.node,t,`Start`),(e,{success:t})=>JM(this.node,e,t?`End`:`Cancel`)),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}},XM=new WeakMap,ZM=new WeakMap,QM=e=>{let t=XM.get(e.target);t&&t(e)},$M=e=>{e.forEach(QM)};function eN({root:e,...t}){let n=e||document;ZM.has(n)||ZM.set(n,{});let r=ZM.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver($M,{root:e,...t})),r[i]}function tN(e,t,n){let r=eN(t);return XM.set(e,n),r.observe(e),()=>{XM.delete(e),r.unobserve(e)}}var nN={some:0,all:1},rN=class extends AA{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();let{viewport:e={}}=this.node.getProps(),{root:t,margin:n,amount:r=`some`,once:i}=e,a={root:t?t.current:void 0,rootMargin:n,threshold:typeof r==`number`?r:nN[r]};return tN(this.node.current,a,e=>{let{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,i&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive(`whileInView`,t);let{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),a=t?n:r;a&&a(e)})}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>`u`)return;let{props:e,prevProps:t}=this.node;[`amount`,`margin`,`root`].some(iN(e,t))&&this.startObserver()}unmount(){}};function iN({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}var aN={inView:{Feature:rN},tap:{Feature:YM},focus:{Feature:qM},hover:{Feature:KM}},oN={layout:{ProjectionNode:UM,MeasureLayout:jj}},sN=dk({...NA,...aN,...WM,...oN},Xk),cN=(e,t)=>{if(e.id===t.id)return!1;let n=.1;return e.x>=t.x-n&&e.x+e.width<=t.x+t.width+n&&e.y>=t.y-n&&e.y+e.height<=t.y+t.height+n},lN=(e,t,n,r,i=1.2)=>{if(!e)return 0;let a=document.createElement(`canvas`).getContext(`2d`);if(!a)return 0;a.font=`${r}px ${n}`;let o=e.split(` `),s=``,c=1;for(let e=0;e<o.length;e++){let n=s+o[e]+` `;a.measureText(n).width>t&&e>0?(s=o[e]+` `,c++):s=n}let l=e.split(`
57
+ `).length-1;return c+=l,Math.ceil(c*r*i)};let uN=(e,t)=>{let n=e.map(e=>({...e})),r=new Map(e.map(e=>[e.id,e])),i=[];n.forEach(e=>{let a=e.type===`text`,o=e.type===`text-container`;if((a||o)&&e.autoGrow){let a=e.content;t&&(a=a.replace(/\{\{(.*?)\}\}/g,(n,r)=>{let i=t[r.trim()];return i==null?n:e.formatting?jS(i,e.formatting):String(i)}));let s=parseInt(String(e.style?.fontSize||16)),c=String(e.style?.fontFamily||`Arial`);if(o&&e.containerExpansion===`horizontal`){let t=document.createElement(`canvas`).getContext(`2d`);if(t){t.font=`${s}px ${c}`;let n=t.measureText(a),r=Math.ceil(n.width+parseInt(String(e.style?.padding||0))*2);Math.abs(r-e.width)>1&&(e.width=r,e.content=a)}}else{let t=lN(a,e.width,c,s),o=e.height,l=t-o;if(Math.abs(l)>1){e.height=t,e.content=a;let s=[],c=r.get(e.id);c&&n.forEach(t=>{if(t.id===e.id)return;let n=r.get(t.id);n&&cN(c,n)&&s.push(t)});let u=new Set([e.id]);s.forEach(e=>{e.height+=l,u.add(e.id)}),i.push({triggerY:e.y+o,delta:l,ignoreIds:u})}}}}),n.forEach(e=>{let t=r.get(e.id);if(!t)return;let n=0;i.forEach(r=>{r.ignoreIds.has(e.id)||t.y>=r.triggerY-.1&&(n+=r.delta)}),e.y+=n});let a=0;return n.forEach(e=>{let t=e.y+e.height;t>a&&(a=t)}),{elements:n,totalHeight:a}};var dN=e=>{switch(e){case`linear`:return`linear`;case`ease-in`:return`easeIn`;case`ease-out`:return`easeOut`;case`ease-in-out`:return`easeInOut`;case`bounce`:return`easeOut`;case`ease`:return`easeInOut`;default:return`easeOut`}},fN=e=>{if(!e||e.type===`none`)return{initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1}};let t={initial:{},animate:{}};switch(e.type){case`fadeIn`:t.initial={opacity:0},t.animate={opacity:1};break;case`slideInLeft`:t.initial={opacity:0,x:-100},t.animate={opacity:1,x:0};break;case`slideInRight`:t.initial={opacity:0,x:100},t.animate={opacity:1,x:0};break;case`slideInUp`:t.initial={opacity:0,y:100},t.animate={opacity:1,y:0};break;case`slideInDown`:t.initial={opacity:0,y:-100},t.animate={opacity:1,y:0};break;case`zoomIn`:t.initial={opacity:0,scale:.5},t.animate={opacity:1,scale:1};break;case`bounceIn`:t.initial={opacity:0,scale:.3},t.animate={opacity:1,scale:1,transition:{type:`spring`,bounce:.6}};break;case`smoothSlideUp`:t.initial={opacity:0,y:30},t.animate={opacity:1,y:0};break;case`popIn`:t.initial={opacity:0,scale:.8,y:10},t.animate={opacity:1,scale:1,y:0};break;case`blurIn`:t.initial={opacity:0,filter:`blur(10px)`},t.animate={opacity:1,filter:`blur(0px)`};break;case`pulse`:t.animate={scale:[1,1.05,1]};break;case`shake`:t.animate={x:[0,-5,5,-5,5,0]};break;case`spin`:t.animate={rotate:360};break;default:t.initial={opacity:0,y:20},t.animate={opacity:1,y:0}}return t},pN=(e,t)=>{let n={duration:e?.duration||.4,ease:dN(e?.timingFunction),delay:e?.delay||0},r;e?.iterationCount===`infinite`?r=1/0:typeof e?.iterationCount==`number`&&e.iterationCount>1&&(r=e.iterationCount-1);let i=t?.animate?.transition;return i?{...n,...i,delay:n.delay,repeat:r??i.repeat}:r===void 0?n:{...n,repeat:r}},mN=({element:e,offsetY:n=0,dataContext:i,onSelect:a,isSelected:o})=>{let s=e.content;if(i){if(e.type===`text`||e.type===`text-container`)s=s.replace(/\{\{(.*?)\}\}/g,(t,n)=>{let r=i[n.trim()];return r==null?t:e.formatting?jS(r,e.formatting):String(r)});else if(e.type===`image`)if(e.dataBinding){let t=i[e.dataBinding];t!=null&&(s=String(t))}else s=s.replace(/\{\{(.*?)\}\}/g,(e,t)=>{let n=i[t.trim()];return n==null?e:String(n)})}let c={position:`absolute`,left:e.x,top:e.y+n,width:e.type===`text-container`&&e.autoGrow&&e.containerExpansion===`horizontal`?`max-content`:`${e.width}px`,height:e.autoGrow?`auto`:`${e.height}px`,transform:e.rotation?`rotate(${e.rotation}deg)`:void 0,padding:e.type===`image`||e.type===`text`||e.type===`text-container`?0:`8px`,overflow:e.autoGrow?`visible`:`hidden`,whiteSpace:e.type===`text-container`&&e.autoGrow&&e.containerExpansion===`horizontal`?`nowrap`:e.autoGrow?`pre-wrap`:void 0,wordBreak:e.autoGrow?`break-word`:void 0,outline:o?`2px solid var(--blue-9)`:void 0,zIndex:o?10:void 0,cursor:a?`pointer`:void 0,...e.style},l=e.animation&&e.animation.type!==`none`,u=t.default.useMemo(()=>l?fN(e.animation):null,[e.animation,l]),d=t.default.useMemo(()=>pN(e.animation,u),[e.animation,u]),f=(0,r.jsxs)(r.Fragment,{children:[(e.type===`text`||e.type===`text-container`)&&(0,r.jsx)(H,{style:{width:`100%`,height:`100%`,display:`block`},children:s}),e.type===`image`&&(s&&MS(s)?(0,r.jsx)(`img`,{src:s,alt:`Element`,style:{width:`100%`,height:`100%`,objectFit:e.style?.objectFit||`cover`,display:`block`}}):(0,r.jsx)(U,{style:{width:`100%`,height:`100%`,backgroundColor:`#eee`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,r.jsx)(H,{size:`1`,children:s?`URL inválida`:`Imagem`})})),e.type===`box`&&(0,r.jsx)(U,{style:{width:`100%`,height:`100%`}}),e.type===`checkbox`&&(0,r.jsx)(U,{style:{width:`100%`,height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,r.jsx)(`input`,{type:`checkbox`,checked:i&&e.dataBinding?i[e.dataBinding]===!0||String(i[e.dataBinding])===`true`:!1,readOnly:!0,style:{width:`100%`,height:`100%`,margin:0}})})]});return l&&u?(0,r.jsx)(sN.div,{variants:u,initial:`initial`,animate:`animate`,transition:d,style:c,onClick:t=>{t.stopPropagation(),a?.(e.id)},children:f}):(0,r.jsx)(U,{style:c,onClick:t=>{t.stopPropagation(),a?.(e.id)},children:f})},hN=({item:e,elements:n,animation:i,onSelect:a,selectedElementIds:o})=>{let{elements:s,totalHeight:c}=t.default.useMemo(()=>uN(n,e),[n,e]),l=t.default.useMemo(()=>fN(i),[i]),u=t.default.useMemo(()=>l.animate?.transition||{duration:i?.duration||.4,ease:dN(i?.timingFunction)},[i,l]);return(0,r.jsx)(sN.div,{layout:!0,variants:l,initial:`initial`,animate:`animate`,exit:{opacity:0,scale:.9},transition:u,whileHover:{scale:1.02,transition:{duration:.2}},style:{position:`relative`,height:c,width:`100%`,marginBottom:`20px`,transformOrigin:`center center`},children:s.map(t=>(0,r.jsx)(mN,{element:t,offsetY:0,dataContext:e,onSelect:a,isSelected:o?.includes(t.id)},t.id))})};let gN=()=>{let{state:e,setSelectedElements:n}=rS(),[i,a]=t.default.useState(!1),[o,s]=t.default.useState([]);return t.default.useEffect(()=>{let t;return i&&e.isList?(o.length===0&&s([{id:Date.now(),...e.mockData[0]||{}}]),t=setInterval(()=>{s(t=>{let n=t.length%(e.mockData.length||1),r={...e.mockData.length>0?e.mockData[n]:{id:t.length},id:`${Date.now()}-${t.length}`};return e.listSettings.newestPosition===`top`?[r,...t].slice(0,20):[...t,r].slice(-20)})},1500)):s([]),()=>clearInterval(t)},[i,e.isList,e.listSettings.newestPosition,e.mockData]),(0,r.jsxs)(U,{style:{width:`100%`,height:`100%`,position:`relative`,overflow:`hidden`,backgroundColor:`var(--color-panel-solid)`},children:[e.isList&&(0,r.jsx)(U,{style:{position:`absolute`,bottom:10,right:10,zIndex:100,backgroundColor:`var(--color-surface)`,padding:`4px`,borderRadius:`var(--radius-3)`,boxShadow:`0 2px 10px rgba(0,0,0,0.1)`},children:(0,r.jsxs)(G,{size:`1`,variant:i?`soft`:`solid`,color:i?`red`:`green`,onClick:()=>a(!i),children:[i?(0,r.jsx)(Mt,{}):(0,r.jsx)(ft,{}),i?`Parar Simulação`:`Simular Entrada`]})}),(0,r.jsx)(Xv,{type:`auto`,scrollbars:`vertical`,style:{height:`100%`,width:`100%`},children:(0,r.jsx)(U,{style:{position:`relative`,minHeight:`100%`,width:`100%`},children:(()=>{if(e.elements.length===0)return(0,r.jsx)(W,{align:`center`,justify:`center`,style:{height:`100%`},children:(0,r.jsx)(H,{color:`gray`,children:`Preview vazio`})});if(e.isList){let t=[];if(i)t=o;else{if(t=e.mockData.length>0?e.mockData:Array.from({length:10}).map((e,t)=>({id:t})),e.listSettings.sortProp){let n=e.listSettings.sortProp,r=e.listSettings.sortOrder===`asc`?1:-1;t=[...t].sort((e,t)=>{let i=e[n],a=t[n];return i<a?-1*r:i>a?1*r:0})}e.listSettings.newestPosition===`top`&&(t=[...t].reverse())}let a=e.listSettings.containerHeight;return(0,r.jsx)(U,{style:{width:`100%`,minHeight:a?`${a}px`:`100%`,height:a?`${a}px`:void 0,overflowY:a?`auto`:void 0,display:`flex`,flexDirection:`column`,justifyContent:e.listSettings.newestPosition===`top`?`flex-start`:`flex-end`,padding:16},children:(0,r.jsx)(GD,{mode:`popLayout`,children:t.map((t,i)=>(0,r.jsx)(hN,{item:t,elements:e.elements,animation:e.listSettings.entryAnimation,onSelect:e=>n([e]),selectedElementIds:e.selectedElementIds},t.id||i))})})}return(0,r.jsx)(r.Fragment,{children:e.elements.map(t=>(0,r.jsx)(mN,{element:t,dataContext:e.singleMockData,onSelect:e=>n([e]),isSelected:e.selectedElementIds.includes(t.id)},t.id))})})()})})]})};function _N(){return(_N=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function vN(e,t){if(e==null)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)t.indexOf(n=a[r])>=0||(i[n]=e[n]);return i}function yN(e){var n=(0,t.useRef)(e),r=(0,t.useRef)(function(e){n.current&&n.current(e)});return n.current=e,r.current}var bN=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e<t?t:e},xN=function(e){return`touches`in e},SN=function(e){return e&&e.ownerDocument.defaultView||self},CN=function(e,t,n){var r=e.getBoundingClientRect(),i=xN(t)?function(e,t){for(var n=0;n<e.length;n++)if(e[n].identifier===t)return e[n];return e[0]}(t.touches,n):t;return{left:bN((i.pageX-(r.left+SN(e).pageXOffset))/r.width),top:bN((i.pageY-(r.top+SN(e).pageYOffset))/r.height)}},wN=function(e){!xN(e)&&e.preventDefault()},TN=t.default.memo(function(e){var n=e.onMove,r=e.onKey,i=vN(e,[`onMove`,`onKey`]),a=(0,t.useRef)(null),o=yN(n),s=yN(r),c=(0,t.useRef)(null),l=(0,t.useRef)(!1),u=(0,t.useMemo)(function(){var e=function(e){wN(e),(xN(e)?e.touches.length>0:e.buttons>0)&&a.current?o(CN(a.current,e,c.current)):n(!1)},t=function(){return n(!1)};function n(n){var r=l.current,i=SN(a.current),o=n?i.addEventListener:i.removeEventListener;o(r?`touchmove`:`mousemove`,e),o(r?`touchend`:`mouseup`,t)}return[function(e){var t=e.nativeEvent,r=a.current;if(r&&(wN(t),!function(e,t){return t&&!xN(e)}(t,l.current)&&r)){if(xN(t)){l.current=!0;var i=t.changedTouches||[];i.length&&(c.current=i[0].identifier)}r.focus(),o(CN(r,t,c.current)),n(!0)}},function(e){var t=e.which||e.keyCode;t<37||t>40||(e.preventDefault(),s({left:t===39?.05:t===37?-.05:0,top:t===40?.05:t===38?-.05:0}))},n]},[s,o]),d=u[0],f=u[1],p=u[2];return(0,t.useEffect)(function(){return p},[p]),t.default.createElement(`div`,_N({},i,{onTouchStart:d,onMouseDown:d,className:`react-colorful__interactive`,ref:a,onKeyDown:f,tabIndex:0,role:`slider`}))}),EN=function(e){return e.filter(Boolean).join(` `)},DN=function(e){var n=e.color,r=e.left,i=e.top,a=i===void 0?.5:i,o=EN([`react-colorful__pointer`,e.className]);return t.default.createElement(`div`,{className:o,style:{top:100*a+`%`,left:100*r+`%`}},t.default.createElement(`div`,{className:`react-colorful__pointer-fill`,style:{backgroundColor:n}}))},ON=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=10**t),Math.round(n*e)/n};360/(2*Math.PI);var kN=function(e){return RN(AN(e))},AN=function(e){return e[0]===`#`&&(e=e.substring(1)),e.length<6?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:e.length===4?ON(parseInt(e[3]+e[3],16)/255,2):1}:{r:parseInt(e.substring(0,2),16),g:parseInt(e.substring(2,4),16),b:parseInt(e.substring(4,6),16),a:e.length===8?ON(parseInt(e.substring(6,8),16)/255,2):1}},jN=function(e){return LN(FN(e))},MN=function(e){var t=e.s,n=e.v,r=e.a,i=(200-t)*n/100;return{h:ON(e.h),s:ON(i>0&&i<200?t*n/100/(i<=100?i:200-i)*100:0),l:ON(i/2),a:ON(r,2)}},NN=function(e){var t=MN(e);return`hsl(`+t.h+`, `+t.s+`%, `+t.l+`%)`},PN=function(e){var t=MN(e);return`hsla(`+t.h+`, `+t.s+`%, `+t.l+`%, `+t.a+`)`},FN=function(e){var t=e.h,n=e.s,r=e.v,i=e.a;t=t/360*6,n/=100,r/=100;var a=Math.floor(t),o=r*(1-n),s=r*(1-(t-a)*n),c=r*(1-(1-t+a)*n),l=a%6;return{r:ON(255*[r,s,o,o,c,r][l]),g:ON(255*[c,r,r,s,o,o][l]),b:ON(255*[o,o,c,r,r,s][l]),a:ON(i,2)}},IN=function(e){var t=e.toString(16);return t.length<2?`0`+t:t},LN=function(e){var t=e.r,n=e.g,r=e.b,i=e.a,a=i<1?IN(ON(255*i)):``;return`#`+IN(t)+IN(n)+IN(r)+a},RN=function(e){var t=e.r,n=e.g,r=e.b,i=e.a,a=Math.max(t,n,r),o=a-Math.min(t,n,r),s=o?a===t?(n-r)/o:a===n?2+(r-t)/o:4+(t-n)/o:0;return{h:ON(60*(s<0?s+6:s)),s:ON(a?o/a*100:0),v:ON(a/255*100),a:i}},zN=t.default.memo(function(e){var n=e.hue,r=e.onChange,i=EN([`react-colorful__hue`,e.className]);return t.default.createElement(`div`,{className:i},t.default.createElement(TN,{onMove:function(e){r({h:360*e.left})},onKey:function(e){r({h:bN(n+360*e.left,0,360)})},"aria-label":`Hue`,"aria-valuenow":ON(n),"aria-valuemax":`360`,"aria-valuemin":`0`},t.default.createElement(DN,{className:`react-colorful__hue-pointer`,left:n/360,color:NN({h:n,s:100,v:100,a:1})})))}),BN=t.default.memo(function(e){var n=e.hsva,r=e.onChange,i={backgroundColor:NN({h:n.h,s:100,v:100,a:1})};return t.default.createElement(`div`,{className:`react-colorful__saturation`,style:i},t.default.createElement(TN,{onMove:function(e){r({s:100*e.left,v:100-100*e.top})},onKey:function(e){r({s:bN(n.s+100*e.left,0,100),v:bN(n.v-100*e.top,0,100)})},"aria-label":`Color`,"aria-valuetext":`Saturation `+ON(n.s)+`%, Brightness `+ON(n.v)+`%`},t.default.createElement(DN,{className:`react-colorful__saturation-pointer`,top:1-n.v/100,left:n.s/100,color:NN(n)})))}),VN=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0},HN=function(e,t){return e.toLowerCase()===t.toLowerCase()||VN(AN(e),AN(t))};function UN(e,n,r){var i=yN(r),a=(0,t.useState)(function(){return e.toHsva(n)}),o=a[0],s=a[1],c=(0,t.useRef)({color:n,hsva:o});return(0,t.useEffect)(function(){if(!e.equal(n,c.current.color)){var t=e.toHsva(n);c.current={hsva:t,color:n},s(t)}},[n,e]),(0,t.useEffect)(function(){var t;VN(o,c.current.hsva)||e.equal(t=e.fromHsva(o),c.current.color)||(c.current={hsva:o,color:t},i(t))},[o,e,i]),[o,(0,t.useCallback)(function(e){s(function(t){return Object.assign({},t,e)})},[])]}var WN,GN=typeof window<`u`?t.useLayoutEffect:t.useEffect,KN=function(){return WN||(typeof __webpack_nonce__<`u`?__webpack_nonce__:void 0)},qN=new Map,JN=function(e){GN(function(){var t=e.current?e.current.ownerDocument:document;if(t!==void 0&&!qN.has(t)){var n=t.createElement(`style`);n.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,qN.set(t,n);var r=KN();r&&n.setAttribute(`nonce`,r),t.head.appendChild(n)}},[])},YN=function(e){var n=e.className,r=e.hsva,i=e.onChange,a={backgroundImage:`linear-gradient(90deg, `+PN(Object.assign({},r,{a:0}))+`, `+PN(Object.assign({},r,{a:1}))+`)`},o=EN([`react-colorful__alpha`,n]),s=ON(100*r.a);return t.default.createElement(`div`,{className:o},t.default.createElement(`div`,{className:`react-colorful__alpha-gradient`,style:a}),t.default.createElement(TN,{onMove:function(e){i({a:e.left})},onKey:function(e){i({a:bN(r.a+e.left)})},"aria-label":`Alpha`,"aria-valuetext":s+`%`,"aria-valuenow":s,"aria-valuemin":`0`,"aria-valuemax":`100`},t.default.createElement(DN,{className:`react-colorful__alpha-pointer`,left:r.a,color:PN(r)})))},XN=function(e){var n=e.className,r=e.colorModel,i=e.color,a=i===void 0?r.defaultColor:i,o=e.onChange,s=vN(e,[`className`,`colorModel`,`color`,`onChange`]),c=(0,t.useRef)(null);JN(c);var l=UN(r,a,o),u=l[0],d=l[1],f=EN([`react-colorful`,n]);return t.default.createElement(`div`,_N({},s,{ref:c,className:f}),t.default.createElement(BN,{hsva:u,onChange:d}),t.default.createElement(zN,{hue:u.h,onChange:d}),t.default.createElement(YN,{hsva:u,onChange:d,className:`react-colorful__last-control`}))},ZN={defaultColor:`0001`,toHsva:kN,fromHsva:jN,equal:HN},QN=function(e){return t.default.createElement(XN,_N({},e,{colorModel:ZN}))},$N={black:`#000000`,white:`#ffffff`,red:`#ff0000`,green:`#008000`,blue:`#0000ff`,yellow:`#ffff00`,cyan:`#00ffff`,magenta:`#ff00ff`,gray:`#808080`,grey:`#808080`,silver:`#c0c0c0`,maroon:`#800000`,olive:`#808000`,purple:`#800080`,teal:`#008080`,navy:`#000080`,orange:`#ffa500`,transparent:`#00000000`};let eP=e=>{if(!e)return`#000000`;let t=e.trim().toLowerCase();if(t.startsWith(`#`))return t.length===4?`#`+t[1]+t[1]+t[2]+t[2]+t[3]+t[3]:t.length===5?`#`+t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+t[4]+t[4]:t;if($N[t])return $N[t];let n=t.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)$/);if(n){let e=parseInt(n[1]),t=parseInt(n[2]),r=parseInt(n[3]),i=n[4]?parseFloat(n[4]):1,a=e=>{let t=Math.round(e).toString(16);return t.length===1?`0`+t:t},o=Math.round(i*255);return`#${a(e)}${a(t)}${a(r)}${a(o)}`}return`#000000`},tP=({color:e,onChange:t})=>{let n=(e=>eP(e))(e);return(0,r.jsxs)(W,{direction:`column`,gap:`3`,style:{width:`100%`},children:[(0,r.jsx)(QN,{color:n,onChange:t,style:{width:`100%`}}),(0,r.jsxs)(W,{gap:`2`,align:`center`,children:[(0,r.jsx)(U,{style:{width:32,height:32,backgroundColor:n,borderRadius:4,border:`1px solid var(--gray-5)`,flexShrink:0}}),(0,r.jsx)(X,{value:e,onChange:e=>t(e.target.value),onBlur:()=>{e&&/^[0-9A-Fa-f]{3,8}$/.test(e)&&t(`#`+e)},placeholder:`#RRGGBBAA`,style:{flexGrow:1}})]})]})},nP=({color:e,onChange:t,label:n})=>(0,r.jsxs)(Ay,{children:[(0,r.jsx)(jy,{children:(0,r.jsxs)(G,{variant:`surface`,color:`gray`,style:{width:`100%`,justifyContent:`flex-start`,padding:`0 8px`,height:32},children:[(0,r.jsx)(U,{style:{width:18,height:18,backgroundColor:e||`transparent`,borderRadius:2,border:`1px solid var(--gray-8)`,marginRight:8,backgroundImage:e===`transparent`?`linear-gradient(45deg, #ccc 25%, transparent 25%), linear-gradient(-45deg, #ccc 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #ccc 75%), linear-gradient(-45deg, transparent 75%, #ccc 75%)`:`none`,backgroundSize:`8px 8px`,backgroundPosition:`0 0, 0 4px, 4px -4px, -4px 0px`}}),(0,r.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:n||e||`Transparente`})]})}),(0,r.jsx)(My,{style:{width:240},children:(0,r.jsx)(tP,{color:e,onChange:t})})]}),rP=({elementId:e})=>{let{state:t,updateElement:n}=rS(),i=t.elements.find(t=>t.id===e);return i?(0,r.jsx)(U,{pt:`2`,children:(0,r.jsxs)(sb,{defaultValue:`formatting`,children:[(0,r.jsxs)(cb,{children:[(0,r.jsx)(lb,{value:`formatting`,style:{flex:1},children:`Formatação`}),(0,r.jsx)(lb,{value:`style`,style:{flex:1},children:`Estilo`}),(0,r.jsx)(lb,{value:`bindings`,style:{flex:1},children:`Vínculos`}),(0,r.jsx)(lb,{value:`conditional`,style:{flex:1},children:`Regras`}),(0,r.jsx)(lb,{value:`animation`,style:{flex:1},children:`Anim`})]}),(0,r.jsxs)(U,{pt:`3`,children:[(0,r.jsx)(ub,{value:`formatting`,children:(0,r.jsx)(aP,{element:i,updateElement:n})}),(0,r.jsx)(ub,{value:`style`,children:(0,r.jsx)(oP,{element:i,updateElement:n})}),(0,r.jsx)(ub,{value:`bindings`,children:(0,r.jsx)(mP,{element:i,updateElement:n,availableProps:t.availableProps||[]})}),(0,r.jsx)(ub,{value:`conditional`,children:(0,r.jsx)(hP,{element:i,updateElement:n,availableProps:t.availableProps||[]})}),(0,r.jsx)(ub,{value:`animation`,children:(0,r.jsx)(iP,{element:i,updateElement:n})})]})]})}):null},iP=({element:e,updateElement:t})=>{let n=e.animation||{type:`none`,duration:1,delay:0},i=r=>{t(e.id,{animation:{...n,...r}})};return(0,r.jsxs)(W,{direction:`column`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Tipo de Animação`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[n.type===`none`?`Nenhuma`:n.type===`slideIn`?`Slide In (Padrão)`:n.type===`fadeIn`?`Fade In`:n.type===`smoothSlideUp`?`Slide Suave (Up)`:n.type===`popIn`?`Pop In`:n.type===`blurIn`?`Blur In`:n.type===`slideInLeft`?`Slide In (Esquerda)`:n.type===`slideInRight`?`Slide In (Direita)`:n.type===`slideInUp`?`Slide In (Cima)`:n.type===`slideInDown`?`Slide In (Baixo)`:n.type===`zoomIn`?`Zoom In`:n.type===`bounceIn`?`Bounce In`:n.type===`pulse`?`Pulse (Atenção)`:n.type===`shake`?`Shake (Atenção)`:`Spin (Loop)`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>i({type:`none`}),children:`Nenhuma`}),(0,r.jsx)(q,{onSelect:()=>i({type:`slideIn`}),children:`Slide In (Padrão)`}),(0,r.jsx)(q,{onSelect:()=>i({type:`fadeIn`}),children:`Fade In`}),(0,r.jsx)(q,{onSelect:()=>i({type:`smoothSlideUp`}),children:`Slide Suave (Up)`}),(0,r.jsx)(q,{onSelect:()=>i({type:`popIn`}),children:`Pop In`}),(0,r.jsx)(q,{onSelect:()=>i({type:`blurIn`}),children:`Blur In`}),(0,r.jsx)(q,{onSelect:()=>i({type:`slideInLeft`}),children:`Slide In (Esquerda)`}),(0,r.jsx)(q,{onSelect:()=>i({type:`slideInRight`}),children:`Slide In (Direita)`}),(0,r.jsx)(q,{onSelect:()=>i({type:`slideInUp`}),children:`Slide In (Cima)`}),(0,r.jsx)(q,{onSelect:()=>i({type:`slideInDown`}),children:`Slide In (Baixo)`}),(0,r.jsx)(q,{onSelect:()=>i({type:`zoomIn`}),children:`Zoom In`}),(0,r.jsx)(q,{onSelect:()=>i({type:`bounceIn`}),children:`Bounce In`}),(0,r.jsx)(q,{onSelect:()=>i({type:`pulse`}),children:`Pulse (Atenção)`}),(0,r.jsx)(q,{onSelect:()=>i({type:`shake`}),children:`Shake (Atenção)`}),(0,r.jsx)(q,{onSelect:()=>i({type:`spin`}),children:`Spin (Loop)`})]})]})]}),n.type!==`none`&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(K,{columns:`2`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Duração (s)`}),(0,r.jsx)(X,{type:`number`,step:`0.1`,min:`0.1`,value:n.duration,onChange:e=>i({duration:parseFloat(e.target.value)||.5})})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Atraso (s)`}),(0,r.jsx)(X,{type:`number`,step:`0.1`,min:`0`,value:n.delay,onChange:e=>i({delay:parseFloat(e.target.value)||0})})]})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Curva de Tempo`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[(n.timingFunction||`ease`)===`linear`?`Linear`:(n.timingFunction||`ease`)===`ease-in`?`Ease In`:(n.timingFunction||`ease`)===`ease-out`?`Ease Out`:(n.timingFunction||`ease`)===`ease-in-out`?`Ease In Out`:(n.timingFunction||`ease`)===`bounce`?`Bounce`:`Ease`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>i({timingFunction:`linear`}),children:`Linear`}),(0,r.jsx)(q,{onSelect:()=>i({timingFunction:`ease`}),children:`Ease`}),(0,r.jsx)(q,{onSelect:()=>i({timingFunction:`ease-in`}),children:`Ease In`}),(0,r.jsx)(q,{onSelect:()=>i({timingFunction:`ease-out`}),children:`Ease Out`}),(0,r.jsx)(q,{onSelect:()=>i({timingFunction:`ease-in-out`}),children:`Ease In Out`}),(0,r.jsx)(q,{onSelect:()=>i({timingFunction:`bounce`}),children:`Bounce`})]})]})]}),[`pulse`,`shake`,`spin`].includes(n.type)&&(0,r.jsx)(U,{children:(0,r.jsxs)(W,{align:`center`,gap:`2`,mt:`2`,children:[(0,r.jsx)(ib,{checked:n.iterationCount===`infinite`,onCheckedChange:e=>i({iterationCount:e?`infinite`:1})}),(0,r.jsx)(H,{size:`2`,children:`Repetir Infinitamente`})]})})]})]})},aP=({element:e,updateElement:t})=>{let n=e.formatting||{type:`text`},i=r=>{t(e.id,{formatting:{...n,...r}})};return(0,r.jsxs)(W,{direction:`column`,gap:`3`,children:[(e.type===`text`||e.type===`text-container`)&&(0,r.jsxs)(U,{children:[(0,r.jsxs)(W,{align:`center`,gap:`2`,mb:`3`,children:[(0,r.jsx)(ib,{checked:e.autoGrow||!1,onCheckedChange:n=>t(e.id,{autoGrow:n})}),(0,r.jsx)(H,{size:`2`,children:e.type===`text-container`?`Expandir container automaticamente`:`Expandir altura automaticamente`})]}),e.type===`text-container`&&e.autoGrow&&(0,r.jsxs)(U,{mb:`3`,ml:`4`,children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Direção de Expansão`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[(e.containerExpansion||`vertical`)===`vertical`?`Vertical (Altura Cresce)`:`Horizontal (Largura Cresce)`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>t(e.id,{containerExpansion:`vertical`}),children:`Vertical (Altura Cresce)`}),(0,r.jsx)(q,{onSelect:()=>t(e.id,{containerExpansion:`horizontal`}),children:`Horizontal (Largura Cresce)`})]})]})]}),(0,r.jsx)(Qy,{size:`4`,mb:`2`})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Tipo de Formatação`}),(0,r.jsxs)(Wy,{value:n.type,onValueChange:e=>i({type:e}),children:[(0,r.jsx)(Gy,{style:{width:`100%`}}),(0,r.jsxs)(Ky,{children:[(0,r.jsx)(Y,{value:`text`,children:`Texto (Padrão)`}),(0,r.jsx)(Y,{value:`boolean`,children:`Booleano (Sim/Não)`}),(0,r.jsx)(Y,{value:`date`,children:`Data`}),(0,r.jsx)(Y,{value:`number`,children:`Número / Moeda`})]})]})]}),n.type===`boolean`&&(0,r.jsxs)(K,{columns:`2`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Texto para Verdadeiro`}),(0,r.jsx)(X,{placeholder:`Ex: Sim`,value:n.trueLabel||``,onChange:e=>i({trueLabel:e.target.value})})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Texto para Falso`}),(0,r.jsx)(X,{placeholder:`Ex: Não`,value:n.falseLabel||``,onChange:e=>i({falseLabel:e.target.value})})]})]}),n.type===`date`&&(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Formato da Data`}),(0,r.jsx)(X,{placeholder:`Ex: DD/MM/YYYY`,value:n.dateFormat||``,onChange:e=>i({dateFormat:e.target.value})}),(0,r.jsx)(H,{size:`1`,color:`gray`,mt:`1`,style:{fontSize:10},children:`Use DD, MM, YYYY, HH, mm, ss.`})]}),n.type===`number`&&(0,r.jsxs)(W,{direction:`column`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Estilo`}),(0,r.jsxs)(Wy,{value:n.numberFormat||`decimal`,onValueChange:e=>i({numberFormat:e}),children:[(0,r.jsx)(Gy,{style:{width:`100%`}}),(0,r.jsxs)(Ky,{children:[(0,r.jsx)(Y,{value:`decimal`,children:`Decimal`}),(0,r.jsx)(Y,{value:`currency`,children:`Moeda`}),(0,r.jsx)(Y,{value:`percent`,children:`Porcentagem`})]})]})]}),n.numberFormat===`currency`&&(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Símbolo da Moeda`}),(0,r.jsx)(X,{placeholder:`Ex: R$`,value:n.currencySymbol||``,onChange:e=>i({currencySymbol:e.target.value})})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Casas Decimais`}),(0,r.jsx)(X,{type:`number`,placeholder:`2`,value:n.decimalPlaces===void 0?``:n.decimalPlaces,onChange:e=>i({decimalPlaces:parseInt(e.target.value)||0})})]})]})]})},oP=({element:e,updateElement:n})=>{let i=e.style||{},[a,o]=(0,t.useState)(i.borderTopLeftRadius!==void 0||i.borderTopRightRadius!==void 0||i.borderBottomRightRadius!==void 0||i.borderBottomLeftRadius!==void 0),s=t=>{n(e.id,{style:{...i,...t}})},c=(e,t)=>{let n=typeof e==`number`?e:parseInt(e)||0;s({[t]:`${n}px`})};return(0,r.jsxs)(W,{direction:`column`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsxs)(W,{align:`center`,justify:`between`,mb:`2`,children:[(0,r.jsx)(H,{size:`2`,weight:`bold`,children:`Arredondamento`}),(0,r.jsxs)(W,{align:`center`,gap:`2`,children:[(0,r.jsx)(H,{size:`1`,children:`Individual`}),(0,r.jsx)(ib,{checked:a,onCheckedChange:e=>{if(o(e),!e)s({borderRadius:i.borderTopLeftRadius||i.borderRadius||0,borderTopLeftRadius:void 0,borderTopRightRadius:void 0,borderBottomRightRadius:void 0,borderBottomLeftRadius:void 0});else{let e=i.borderRadius||0;s({borderRadius:void 0,borderTopLeftRadius:e,borderTopRightRadius:e,borderBottomRightRadius:e,borderBottomLeftRadius:e})}}})]})]}),a?(0,r.jsxs)(K,{columns:`2`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Sup. Esq.`}),(0,r.jsx)(X,{type:`number`,min:`0`,value:parseInt(i.borderTopLeftRadius)||0,onChange:e=>c(e.target.value,`borderTopLeftRadius`)})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Sup. Dir.`}),(0,r.jsx)(X,{type:`number`,min:`0`,value:parseInt(i.borderTopRightRadius)||0,onChange:e=>c(e.target.value,`borderTopRightRadius`)})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Inf. Esq.`}),(0,r.jsx)(X,{type:`number`,min:`0`,value:parseInt(i.borderBottomLeftRadius)||0,onChange:e=>c(e.target.value,`borderBottomLeftRadius`)})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Inf. Dir.`}),(0,r.jsx)(X,{type:`number`,min:`0`,value:parseInt(i.borderBottomRightRadius)||0,onChange:e=>c(e.target.value,`borderBottomRightRadius`)})]})]}):(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Raio (Todos os cantos)`}),(0,r.jsx)(X,{type:`number`,min:`0`,value:parseInt(i.borderRadius)||0,onChange:e=>s({borderRadius:`${parseInt(e.target.value)||0}px`})})]})]}),(0,r.jsx)(Qy,{size:`4`,my:`2`}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`2`,weight:`bold`,mb:`2`,children:`Espaçamento Interno`}),(0,r.jsx)(K,{columns:`2`,gap:`3`,children:(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Tamanho (px)`}),(0,r.jsx)(X,{type:`number`,min:`0`,value:parseInt(i.padding)||0,onChange:e=>s({padding:`${parseInt(e.target.value)||0}px`})})]})})]}),(0,r.jsx)(Qy,{size:`4`,my:`2`}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`2`,weight:`bold`,mb:`2`,children:`Sombra (Box Shadow)`}),(0,r.jsxs)(W,{direction:`column`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Cor`}),(0,r.jsx)(nP,{color:sP(i.boxShadow),onChange:e=>s({boxShadow:uP(i.boxShadow,e)})})]}),(0,r.jsxs)(K,{columns:`2`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Blur (px)`}),(0,r.jsx)(X,{type:`number`,min:`0`,value:cP(i.boxShadow),onChange:e=>s({boxShadow:dP(i.boxShadow,parseInt(e.target.value)||0)})})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,color:`gray`,children:`Spread (px)`}),(0,r.jsx)(X,{type:`number`,value:lP(i.boxShadow),onChange:e=>s({boxShadow:fP(i.boxShadow,parseInt(e.target.value)||0)})})]})]}),(0,r.jsx)(G,{variant:`soft`,color:`gray`,size:`1`,onClick:()=>s({boxShadow:i.boxShadow?void 0:`0 4px 12px 0 rgba(0,0,0,0.15)`}),children:i.boxShadow?`Remover Sombra`:`Adicionar Sombra`})]})]})]})};var sP=e=>{if(!e||e===`none`)return`#0000001a`;let t=e.match(/(?:rgba?\([^)]+\)|#[0-9a-fA-F]{3,8}|[a-zA-Z]+)\s*$/);return t?t[0].trim():`#0000001a`},cP=e=>{if(!e||e===`none`)return 12;let t=e.match(/(-?\d+(?:\.\d+)?)(?:px)?/g);return t&&t.length>=3?parseFloat(t[2]):12},lP=e=>{if(!e||e===`none`)return 0;let t=e.match(/(-?\d+(?:\.\d+)?)(?:px)?/g);return t&&t.length>=4?parseFloat(t[3]):0},uP=(e,t)=>{let n=cP(e),r=lP(e);return`${e?.includes(`inset`)?`inset `:``}0px 4px ${n}px ${r}px ${t}`},dP=(e,t)=>{let n=(e||`0 4px 12px 0 #0000001a`).match(/(-?\d+(?:\.\d+)?)(?:px)?/g)||[`0`,`4`,`12`,`0`],r=sP(e);return`${e?.includes(`inset`)?`inset `:``}${n[0]||0}px ${n[1]||4}px ${t}px ${n[3]||0}px ${r}`},fP=(e,t)=>{let n=(e||`0 4px 12px 0 #0000001a`).match(/(-?\d+(?:\.\d+)?)(?:px)?/g)||[`0`,`4`,`12`,`0`],r=sP(e);return`${e?.includes(`inset`)?`inset `:``}${n[0]||0}px ${n[1]||4}px ${n[2]||12}px ${t}px ${r}`},pP=[{key:`color`,label:`Cor do texto`},{key:`backgroundColor`,label:`Cor de fundo`},{key:`borderColor`,label:`Cor da borda`},{key:`boxShadowColor`,label:`Cor da sombra`}];let mP=({element:e,updateElement:t,availableProps:n})=>{let i=e.styleBindings||{},a=(n,r)=>{let a={...i};r?a[n]=r:delete a[n],t(e.id,{styleBindings:Object.keys(a).length>0?a:void 0})};return(0,r.jsxs)(W,{direction:`column`,gap:`3`,children:[(0,r.jsx)(H,{size:`2`,weight:`bold`,children:`Vínculos de Estilo (Data Binding)`}),(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`2`,children:`Vincule propriedades de estilo a variáveis de dados. O valor da variável será aplicado em tempo real (ex.: cores em formato #RRGGBB, rgba(), etc.).`}),pP.map(({key:e,label:t})=>(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:t}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,size:`1`,style:{width:`100%`,justifyContent:`space-between`},children:[i[e]?n.find(t=>t.dataName===i[e])?.name||i[e]:`Nenhum`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>a(e,null),children:`Nenhum`}),n.map(t=>(0,r.jsx)(q,{onSelect:()=>a(e,t.dataName),children:t.name},t.dataName)),n.length===0&&(0,r.jsx)(q,{disabled:!0,children:`Nenhuma variável disponível`})]})]})]},e))]})},hP=({element:e,updateElement:t,availableProps:n})=>{let i=e.conditions||[],a=()=>{let r={id:crypto.randomUUID(),property:n.length>0?n[0].dataName:``,operator:`equals`,value:``,style:{color:`#ff0000`}};t(e.id,{conditions:[...i,r]})},o=n=>{t(e.id,{conditions:i.filter(e=>e.id!==n)})},s=(n,r)=>{t(e.id,{conditions:i.map(e=>e.id===n?{...e,...r}:e)})};return(0,r.jsxs)(W,{direction:`column`,gap:`3`,children:[(0,r.jsxs)(W,{justify:`between`,align:`center`,children:[(0,r.jsx)(H,{size:`2`,color:`gray`,children:`Regras de Exibição`}),(0,r.jsxs)(G,{size:`1`,variant:`soft`,onClick:a,children:[(0,r.jsx)(mt,{}),` Nova Regra`]})]}),i.length===0?(0,r.jsx)(H,{size:`1`,color:`gray`,style:{fontStyle:`italic`},children:`Nenhuma regra condicional definida.`}):(0,r.jsx)(W,{direction:`column`,gap:`2`,children:i.map(e=>(0,r.jsxs)(U,{style:{border:`1px solid var(--gray-6)`,borderRadius:4,padding:8},children:[(0,r.jsxs)(W,{justify:`between`,align:`center`,mb:`2`,children:[(0,r.jsxs)(H,{size:`1`,weight:`bold`,children:[`Se `,e.property,`...`]}),(0,r.jsx)(J,{size:`1`,color:`red`,variant:`ghost`,onClick:()=>o(e.id),children:(0,r.jsx)(Xt,{})})]}),(0,r.jsxs)(K,{columns:`2`,gap:`2`,mb:`2`,children:[(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,size:`1`,style:{width:`100%`,justifyContent:`space-between`},children:[n.find(t=>t.dataName===e.property)?.name||e.property||`Propriedade`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[n.map(t=>(0,r.jsx)(q,{onSelect:()=>s(e.id,{property:t.dataName}),children:t.name},t.dataName)),n.length===0&&(0,r.jsx)(q,{disabled:!0,children:`Nenhuma variável disponível`})]})]}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,size:`1`,style:{width:`100%`,justifyContent:`space-between`},children:[e.operator===`equals`?`Igual a`:e.operator===`notEquals`?`Diferente de`:e.operator===`contains`?`Contém`:e.operator===`greaterThan`?`Maior que`:`Menor que`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>s(e.id,{operator:`equals`}),children:`Igual a`}),(0,r.jsx)(q,{onSelect:()=>s(e.id,{operator:`notEquals`}),children:`Diferente de`}),(0,r.jsx)(q,{onSelect:()=>s(e.id,{operator:`contains`}),children:`Contém`}),(0,r.jsx)(q,{onSelect:()=>s(e.id,{operator:`greaterThan`}),children:`Maior que`}),(0,r.jsx)(q,{onSelect:()=>s(e.id,{operator:`lessThan`}),children:`Menor que`})]})]})]}),(0,r.jsx)(X,{size:`1`,placeholder:`Valor`,value:e.value,onChange:t=>s(e.id,{value:t.target.value})}),(0,r.jsxs)(U,{mt:`2`,children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Cor quando verdadeiro`}),(0,r.jsx)(nP,{color:e.style?.color||`#ff0000`,onChange:t=>s(e.id,{style:{...e.style,color:t}})})]})]},e.id))})]})};var gP=({title:e,isOpen:t,onToggle:n,children:i,onReset:a})=>(0,r.jsxs)(U,{style:{borderBottom:`1px solid var(--gray-4)`},children:[(0,r.jsxs)(W,{align:`center`,style:{width:`100%`},children:[(0,r.jsxs)(G,{variant:`ghost`,onClick:n,style:{flex:1,justifyContent:`space-between`,padding:`12px 8px`,borderRadius:0,height:`auto`,cursor:`pointer`,color:`var(--gray-12)`},children:[(0,r.jsx)(H,{weight:`bold`,size:`2`,children:e}),t?(0,r.jsx)(fe,{}):(0,r.jsx)(me,{})]}),a&&t&&(0,r.jsx)(bb,{content:`Resetar para padrão`,children:(0,r.jsx)(J,{variant:`ghost`,color:`gray`,onClick:e=>{e.stopPropagation(),a()},style:{marginRight:8},children:(0,r.jsx)(vt,{})})})]}),t&&(0,r.jsx)(U,{p:`3`,style:{backgroundColor:`var(--gray-2)`},children:i})]}),_P=`__`,vP=({value:e,onChange:n,units:i=[`px`,`%`,`em`,`rem`,`vw`,`vh`],min:a,max:o,placeholder:s,label:c})=>{let l=e=>e===``?_P:e,u=e=>e===_P?``:e,d=e=>{if(e==null||e===``)return{num:``,unit:i[0]};let t=String(e).match(/^(-?[\d.]+)([a-z%]+)?$/i);return t?{num:t[1],unit:t[2]||i[0]}:{num:``,unit:i[0]}},[f,p]=(0,t.useState)(d(e));(0,t.useEffect)(()=>{p(d(e))},[e]);let m=(e,t)=>{if(e===``){n(``);return}n(`${e}${t}`)};return(0,r.jsxs)(U,{children:[c&&(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:c}),(0,r.jsxs)(W,{children:[(0,r.jsx)(X,{type:`number`,value:f.num,onChange:e=>{let t=e.target.value;p({...f,num:t}),m(t,f.unit)},placeholder:s,style:{borderTopRightRadius:0,borderBottomRightRadius:0,flex:1},min:a,max:o}),(0,r.jsxs)(Wy,{value:l(f.unit),onValueChange:e=>{let t=u(e);p({...f,unit:t}),m(f.num,t)},children:[(0,r.jsx)(Gy,{style:{width:60,borderTopLeftRadius:0,borderBottomLeftRadius:0,marginLeft:-1}}),(0,r.jsx)(Ky,{children:i.map(e=>(0,r.jsx)(Y,{value:l(e),children:e||s||`—`},e||_P))})]})]})]})},yP=({values:e,onChange:n,label:i})=>{let[a,o]=(0,t.useState)(!0),s=e=>{n({top:e,right:e,bottom:e,left:e})},c=(t,r)=>{n({...e,[t]:r})};return(0,r.jsxs)(U,{children:[(0,r.jsxs)(W,{justify:`between`,align:`center`,mb:`1`,children:[i&&(0,r.jsx)(H,{size:`1`,color:`gray`,children:i}),(0,r.jsx)(bb,{content:a?`Desvincular lados`:`Vincular lados`,children:(0,r.jsx)(J,{size:`1`,variant:`ghost`,color:a?`blue`:`gray`,onClick:()=>o(!a),children:a?(0,r.jsx)(bP,{}):(0,r.jsx)(xP,{})})})]}),a?(0,r.jsx)(vP,{value:e.top||``,onChange:s,placeholder:`Todos`}):(0,r.jsxs)(K,{columns:`2`,gap:`2`,children:[(0,r.jsx)(vP,{value:e.top,onChange:e=>c(`top`,e),label:`Top`}),(0,r.jsx)(vP,{value:e.right,onChange:e=>c(`right`,e),label:`Right`}),(0,r.jsx)(vP,{value:e.bottom,onChange:e=>c(`bottom`,e),label:`Bottom`}),(0,r.jsx)(vP,{value:e.left,onChange:e=>c(`left`,e),label:`Left`})]})]})},bP=()=>(0,r.jsx)(`svg`,{width:`15`,height:`15`,viewBox:`0 0 15 15`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,r.jsx)(`path`,{d:`M4.5 6.5L1.35355 9.64645C0.908293 10.0917 0.908293 10.8134 1.35355 11.2587L3.74132 13.6464C4.18658 14.0917 4.90829 14.0917 5.35355 13.6464L8.5 10.5M10.5 8.5L13.6464 5.35355C14.0917 4.90829 14.0917 4.18658 13.6464 3.74132L11.2587 1.35355C10.8134 0.908293 10.0917 0.908293 9.64645 1.35355L6.5 4.5M6.5 8.5H8.5`,stroke:`currentColor`})}),xP=()=>(0,r.jsx)(`svg`,{width:`15`,height:`15`,viewBox:`0 0 15 15`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,r.jsx)(`path`,{d:`M4.5 6.5L1.35355 9.64645C0.908293 10.0917 0.908293 10.8134 1.35355 11.2587L3.74132 13.6464C4.18658 14.0917 4.90829 14.0917 5.35355 13.6464L8.5 10.5M10.5 8.5L13.6464 5.35355C14.0917 4.90829 14.0917 4.18658 13.6464 3.74132L11.2587 1.35355C10.8134 0.908293 10.0917 0.908293 9.64645 1.35355L6.5 4.5`,stroke:`currentColor`})});let SP=()=>{let{state:e,setPropertiesPanelOpen:n,updateElement:i,updateElements:a,removeSelected:o,copy:s,paste:c,addElement:l}=rS(),{isPropertiesPanelOpen:u,selectedElementIds:d,elements:f}=e,p=(0,t.useMemo)(()=>f.filter(e=>d.includes(e.id)),[f,d]),m=p[0],h=p.length>1,[g,_]=(0,t.useState)({content:!0,layout:!0,typography:!0,appearance:!1,borders:!1,effects:!1,transform:!1,animation:!1,conditions:!1,formatting:!1,spacing:!1}),[v,y]=(0,t.useState)(``),[b,x]=(0,t.useState)({});(0,t.useEffect)(()=>{let e=localStorage.getItem(`editor-presets`);if(e)try{x(JSON.parse(e))}catch(e){console.error(`Failed to load presets`,e)}},[]);let S=e=>{if(!m)return;let t={...b,[e]:{style:m.style}};x(t),localStorage.setItem(`editor-presets`,JSON.stringify(t))},C=e=>{let t=b[e];t&&t.style&&D(t.style)};if(!u||!m)return null;let w=e=>{_(t=>({...t,[e]:!t[e]}))},T=e=>{h?a(d.map(t=>({id:t,changes:e}))):i(m.id,e)},E=()=>{if(h)s(),c();else{let{id:e,...t}=m;l({...t,x:m.x+20,y:m.y+20})}},D=e=>{h?a(p.map(t=>({id:t.id,changes:{style:{...t.style,...e}}}))):i(m.id,{style:{...m.style,...e}})},O=e=>{let t={};e.forEach(e=>t[e]=void 0),D(t)},k=(e,t)=>{if(!v)return!0;let n=v.toLowerCase();return e.toLowerCase().includes(n)||t.some(e=>e.toLowerCase().includes(n))},A=e=>{if(!h)return e(m);let t=e(m);return p.every(n=>e(n)===t)?t:`Mixed`},j=(e,t=``)=>{let n=A(t=>t.style?.[e]);return n===`Mixed`?`Mixed`:n===void 0?t:n},M=String(j(`fontFamily`,`Arial`)),N=AS(M,e.availableFonts||[`Arial`]),P=()=>{let e=j(`fontWeight`,`normal`);return e===`Mixed`?`400`:kS(e,OS)},F=e=>{let t={x:0,y:4,blur:12,spread:0,color:`#0000001a`,inset:!1};if(!e||e===`none`)return t;let n=e.trim(),r=n.includes(`inset`),i=n.replace(`inset`,``).trim(),a=i.match(/(-?\d+(?:\.\d+)?)(?:px)?\s+(-?\d+(?:\.\d+)?)(?:px)?(?:\s+(\d+(?:\.\d+)?)(?:px)?)?(?:\s+(\d+(?:\.\d+)?)(?:px)?)?/);return a?{x:parseFloat(a[1]),y:parseFloat(a[2]),blur:a[3]?parseFloat(a[3]):0,spread:a[4]?parseFloat(a[4]):0,color:i.replace(a[0],``).trim()||t.color,inset:r}:t},I=F(m.style?.boxShadow),re=e=>{let t={...I,...e};D({boxShadow:`${t.inset?`inset `:``}${t.x}px ${t.y}px ${t.blur}px ${t.spread}px ${t.color}`})};return(0,r.jsx)(ny,{open:u,onOpenChange:n,children:(0,r.jsxs)(iy,{style:{maxWidth:500,width:`100%`,maxHeight:`85vh`,height:`100%`,padding:0,display:`flex`,flexDirection:`column`,overflow:`hidden`},children:[(0,r.jsxs)(U,{style:{borderBottom:`1px solid var(--gray-4)`},children:[(0,r.jsxs)(W,{justify:`between`,align:`center`,p:`4`,pb:`2`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(ay,{style:{margin:0},children:`Propriedades`}),(0,r.jsx)(oy,{size:`1`,color:`gray`,children:h?`${p.length} selecionados`:m.name||`Elemento`})]}),(0,r.jsxs)(W,{gap:`2`,children:[(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsx)(J,{variant:`ghost`,color:`gray`,children:(0,r.jsx)(ee,{})})}),(0,r.jsxs)(fy,{children:[(0,r.jsx)(py,{children:`Presets`}),Object.keys(b).length===0&&(0,r.jsx)(q,{disabled:!0,children:`Nenhum preset salvo`}),Object.keys(b).map(e=>(0,r.jsx)(q,{onSelect:t=>{t.preventDefault(),C(e)},onClick:()=>C(e),style:{cursor:`pointer`},children:e},e)),(0,r.jsx)(xy,{}),(0,r.jsxs)(q,{onSelect:e=>{e.preventDefault();let t=prompt(`Nome do novo preset:`);t&&S(t)},children:[(0,r.jsx)(mt,{style:{marginRight:8}}),` Salvar Atual`]})]})]}),(0,r.jsx)(sy,{children:(0,r.jsx)(J,{variant:`ghost`,color:`gray`,children:(0,r.jsx)(Ee,{})})})]})]}),(0,r.jsxs)(W,{gap:`2`,px:`4`,pb:`3`,children:[(0,r.jsx)(bb,{content:`Bloquear`,children:(0,r.jsx)(J,{variant:`soft`,color:m.locked?`orange`:`gray`,onClick:()=>T({locked:!m.locked}),children:m.locked?(0,r.jsx)(et,{}):(0,r.jsx)(nt,{})})}),(0,r.jsx)(bb,{content:`Ocultar`,children:(0,r.jsx)(J,{variant:`soft`,color:m.hidden?`blue`:`gray`,onClick:()=>T({hidden:!m.hidden}),children:m.hidden?(0,r.jsx)(Be,{}):(0,r.jsx)(He,{})})}),(0,r.jsx)(bb,{content:`Duplicar`,children:(0,r.jsx)(J,{variant:`soft`,color:`gray`,onClick:E,children:(0,r.jsx)(we,{})})}),(0,r.jsx)(U,{style:{flex:1}}),(0,r.jsx)(bb,{content:`Excluir`,children:(0,r.jsx)(J,{variant:`soft`,color:`red`,onClick:()=>{o(),n(!1)},children:(0,r.jsx)(Xt,{})})})]})]}),(0,r.jsx)(U,{p:`3`,style:{borderBottom:`1px solid var(--gray-4)`,backgroundColor:`var(--gray-1)`},children:(0,r.jsx)(X,{placeholder:`Buscar...`,value:v,onChange:e=>y(e.target.value),children:(0,r.jsx)(_b,{children:(0,r.jsx)(ot,{height:`16`,width:`16`})})})}),(0,r.jsxs)(U,{style:{flex:1,overflowY:`auto`,overflowX:`hidden`},children:[k(`Conteúdo`,[`text`,`image`,`url`,`value`,`content`])&&(m.type===`text`||m.type===`text-container`||m.type===`image`)&&(0,r.jsx)(gP,{title:`Conteúdo`,isOpen:g.content,onToggle:()=>w(`content`),children:(0,r.jsxs)(U,{children:[(m.type===`text`||m.type===`text-container`)&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Texto`}),(0,r.jsx)(pb,{value:m.content||``,onChange:e=>T({content:e.target.value}),rows:4,placeholder:`Texto ou {{variavel}}...`})]}),m.type===`image`&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Vínculo de Propriedade`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,size:`1`,style:{width:`100%`,justifyContent:`space-between`,marginBottom:8},children:[m.dataBinding?e.availableProps.find(e=>e.dataName===m.dataBinding)?.name||m.dataBinding:`Nenhum (URL fixa)`,(0,r.jsx)(fe,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>T({dataBinding:void 0}),children:`Nenhum (URL fixa)`}),(e.availableProps||[]).map(e=>(0,r.jsx)(q,{onSelect:()=>T({dataBinding:e.dataName,content:`{{${e.dataName}}}`}),children:e.name},e.dataName))]})]}),(0,r.jsxs)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:[`URL ou `,`{{variável}}`]}),(0,r.jsx)(X,{value:m.content||``,onChange:e=>T({content:e.target.value}),placeholder:`https://... ou {{profilePicture}}`})]})]})}),k(`Tipografia`,[`font`,`text`,`color`,`align`,`size`,`weight`,`transform`,`decoration`])&&(0,r.jsx)(gP,{title:`Tipografia`,isOpen:g.typography,onToggle:()=>w(`typography`),onReset:()=>O([`fontFamily`,`fontSize`,`fontWeight`,`color`,`textAlign`,`fontStyle`,`textDecoration`,`textTransform`,`lineHeight`,`letterSpacing`]),children:(0,r.jsxs)(K,{columns:`2`,gap:`3`,children:[(0,r.jsxs)(U,{style:{gridColumn:`span 2`},children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Família da Fonte`}),(0,r.jsxs)(Wy,{value:M,onValueChange:e=>D({fontFamily:e}),children:[(0,r.jsx)(Gy,{style:{width:`100%`},placeholder:`Selecione...`}),(0,r.jsx)(Ky,{style:{zIndex:1e5},children:N.map(e=>(0,r.jsx)(Y,{value:e,children:e},e))})]})]}),(0,r.jsx)(vP,{label:`Tamanho`,value:j(`fontSize`,`16px`),onChange:e=>D({fontSize:e})}),(0,r.jsx)(vP,{label:`Altura da Linha`,value:j(`lineHeight`,`normal`),onChange:e=>D({lineHeight:e}),units:[``,`px`,`em`,`%`],placeholder:`Normal`}),(0,r.jsx)(vP,{label:`Espaçamento`,value:j(`letterSpacing`,`normal`),onChange:e=>D({letterSpacing:e}),units:[`px`,`em`],placeholder:`Normal`}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Peso`}),(0,r.jsxs)(Wy,{value:P(),onValueChange:e=>D({fontWeight:e}),children:[(0,r.jsx)(Gy,{style:{width:`100%`},placeholder:`Normal`}),(0,r.jsxs)(Ky,{style:{zIndex:1e5},children:[(0,r.jsx)(Y,{value:`100`,children:`100 - Thin`}),(0,r.jsx)(Y,{value:`300`,children:`300 - Light`}),(0,r.jsx)(Y,{value:`400`,children:`400 - Normal`}),(0,r.jsx)(Y,{value:`500`,children:`500 - Medium`}),(0,r.jsx)(Y,{value:`600`,children:`600 - Semi Bold`}),(0,r.jsx)(Y,{value:`700`,children:`700 - Bold`}),(0,r.jsx)(Y,{value:`900`,children:`900 - Black`}),(0,r.jsx)(Y,{value:`normal`,children:`Normal`}),(0,r.jsx)(Y,{value:`bold`,children:`Bold`})]})]})]}),(0,r.jsx)(U,{style:{gridColumn:`span 2`},children:(0,r.jsxs)(W,{justify:`between`,align:`center`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Estilo`}),(0,r.jsxs)(W,{gap:`1`,children:[(0,r.jsx)(J,{variant:j(`fontStyle`)===`italic`?`solid`:`soft`,onClick:()=>D({fontStyle:j(`fontStyle`)===`italic`?`normal`:`italic`}),children:(0,r.jsx)(Ke,{})}),(0,r.jsx)(J,{variant:j(`textDecoration`)===`underline`?`solid`:`soft`,onClick:()=>D({textDecoration:j(`textDecoration`)===`underline`?`none`:`underline`}),children:(0,r.jsx)(Qt,{})}),(0,r.jsx)(J,{variant:j(`textDecoration`)===`line-through`?`solid`:`soft`,onClick:()=>D({textDecoration:j(`textDecoration`)===`line-through`?`none`:`line-through`}),children:(0,r.jsx)(Pt,{})})]})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Transformação`}),(0,r.jsxs)(Wy,{value:j(`textTransform`,`none`),onValueChange:e=>D({textTransform:e}),children:[(0,r.jsx)(Gy,{style:{width:100}}),(0,r.jsxs)(Ky,{children:[(0,r.jsx)(Y,{value:`none`,children:`Nenhum`}),(0,r.jsx)(Y,{value:`uppercase`,children:`MAIÚSCULA`}),(0,r.jsx)(Y,{value:`lowercase`,children:`minúscula`}),(0,r.jsx)(Y,{value:`capitalize`,children:`Capitalizada`})]})]})]})]})}),(0,r.jsxs)(U,{style:{gridColumn:`span 2`},children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Alinhamento`}),(0,r.jsxs)(Ly,{value:j(`textAlign`,`left`),onValueChange:e=>D({textAlign:e}),children:[(0,r.jsx)(Ry,{value:`left`,children:(0,r.jsx)(Wt,{})}),(0,r.jsx)(Ry,{value:`center`,children:(0,r.jsx)(Bt,{})}),(0,r.jsx)(Ry,{value:`right`,children:(0,r.jsx)(Kt,{})}),(0,r.jsx)(Ry,{value:`justify`,children:(0,r.jsx)(Ht,{})})]})]}),(0,r.jsxs)(U,{style:{gridColumn:`span 2`},children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Cor do Texto`}),(0,r.jsx)(nP,{color:j(`color`,`#000000`),onChange:e=>D({color:e})})]})]})}),k(`Aparência`,[`background`,`opacity`,`blend`,`cursor`])&&(0,r.jsxs)(gP,{title:`Aparência`,isOpen:g.appearance,onToggle:()=>w(`appearance`),onReset:()=>O([`backgroundColor`,`backgroundImage`,`backgroundSize`,`opacity`,`mixBlendMode`,`cursor`]),children:[(0,r.jsxs)(sb,{defaultValue:`solid`,children:[(0,r.jsxs)(cb,{children:[(0,r.jsx)(lb,{value:`solid`,children:`Sólido`}),(0,r.jsx)(lb,{value:`gradient`,children:`Gradiente`}),(0,r.jsx)(lb,{value:`image`,children:`Imagem`})]}),(0,r.jsxs)(U,{pt:`3`,children:[(0,r.jsxs)(ub,{value:`solid`,children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Cor de Fundo`}),(0,r.jsx)(nP,{color:j(`backgroundColor`,`transparent`),onChange:e=>D({backgroundColor:e,backgroundImage:`none`})})]}),(0,r.jsxs)(ub,{value:`gradient`,children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`CSS Gradient`}),(0,r.jsx)(pb,{value:j(`backgroundImage`,``),onChange:e=>D({backgroundImage:e.target.value}),placeholder:`linear-gradient(to right, red, blue)`,rows:3})]}),(0,r.jsxs)(ub,{value:`image`,children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`URL da Imagem`}),(0,r.jsx)(X,{value:j(`backgroundImage`,``).replace(/url\(['"]?(.*?)['"]?\)/,`$1`),onChange:e=>D({backgroundImage:`url('${e.target.value}')`}),placeholder:`https://...`,mb:`2`}),(0,r.jsxs)(K,{columns:`2`,gap:`2`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Tamanho`}),(0,r.jsxs)(Wy,{value:j(`backgroundSize`,`auto`),onValueChange:e=>D({backgroundSize:e}),children:[(0,r.jsx)(Gy,{style:{width:`100%`}}),(0,r.jsxs)(Ky,{children:[(0,r.jsx)(Y,{value:`auto`,children:`Auto`}),(0,r.jsx)(Y,{value:`cover`,children:`Cobrir (Cover)`}),(0,r.jsx)(Y,{value:`contain`,children:`Conter (Contain)`}),(0,r.jsx)(Y,{value:`100% 100%`,children:`Esticar`})]})]})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Repetição`}),(0,r.jsxs)(Wy,{value:j(`backgroundRepeat`,`repeat`),onValueChange:e=>D({backgroundRepeat:e}),children:[(0,r.jsx)(Gy,{style:{width:`100%`}}),(0,r.jsxs)(Ky,{children:[(0,r.jsx)(Y,{value:`repeat`,children:`Repetir`}),(0,r.jsx)(Y,{value:`no-repeat`,children:`Não Repetir`}),(0,r.jsx)(Y,{value:`repeat-x`,children:`Horizontal`}),(0,r.jsx)(Y,{value:`repeat-y`,children:`Vertical`})]})]})]})]})]})]})]}),(0,r.jsxs)(U,{mt:`3`,children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Opacidade`}),(0,r.jsxs)(W,{align:`center`,gap:`2`,children:[(0,r.jsx)(tb,{min:0,max:1,step:.05,value:[parseFloat(j(`opacity`,`1`))],onValueChange:([e])=>D({opacity:e}),style:{flex:1}}),(0,r.jsxs)(H,{size:`1`,children:[Math.round(parseFloat(j(`opacity`,`1`))*100),`%`]})]})]}),(0,r.jsxs)(K,{columns:`2`,gap:`3`,mt:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Blend Mode`}),(0,r.jsxs)(Wy,{value:j(`mixBlendMode`,`normal`),onValueChange:e=>D({mixBlendMode:e}),children:[(0,r.jsx)(Gy,{style:{width:`100%`}}),(0,r.jsxs)(Ky,{children:[(0,r.jsx)(Y,{value:`normal`,children:`Normal`}),(0,r.jsx)(Y,{value:`multiply`,children:`Multiply`}),(0,r.jsx)(Y,{value:`screen`,children:`Screen`}),(0,r.jsx)(Y,{value:`overlay`,children:`Overlay`}),(0,r.jsx)(Y,{value:`darken`,children:`Darken`}),(0,r.jsx)(Y,{value:`lighten`,children:`Lighten`})]})]})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Cursor`}),(0,r.jsxs)(Wy,{value:j(`cursor`,`auto`),onValueChange:e=>D({cursor:e}),children:[(0,r.jsx)(Gy,{style:{width:`100%`}}),(0,r.jsxs)(Ky,{children:[(0,r.jsx)(Y,{value:`auto`,children:`Auto`}),(0,r.jsx)(Y,{value:`default`,children:`Padrão`}),(0,r.jsx)(Y,{value:`pointer`,children:`Mãozinha`}),(0,r.jsx)(Y,{value:`text`,children:`Texto`}),(0,r.jsx)(Y,{value:`move`,children:`Mover`}),(0,r.jsx)(Y,{value:`not-allowed`,children:`Bloqueado`})]})]})]})]})]}),k(`Layout`,[`width`,`height`,`x`,`y`,`z-index`,`overflow`])&&(0,r.jsx)(gP,{title:`Layout & Dimensões`,isOpen:g.layout,onToggle:()=>w(`layout`),onReset:()=>T({width:100,height:100,x:0,y:0,style:{...m.style,zIndex:void 0,overflow:void 0}}),children:(0,r.jsxs)(K,{columns:`2`,gap:`3`,children:[(0,r.jsx)(vP,{label:`Largura`,value:m.width,onChange:e=>T({width:parseFloat(e)}),units:[`px`]}),(0,r.jsx)(vP,{label:`Altura`,value:m.height,onChange:e=>T({height:parseFloat(e)}),units:[`px`]}),(0,r.jsx)(vP,{label:`Posição X`,value:m.x,onChange:e=>T({x:parseFloat(e)}),units:[`px`]}),(0,r.jsx)(vP,{label:`Posição Y`,value:m.y,onChange:e=>T({y:parseFloat(e)}),units:[`px`]}),(0,r.jsx)(vP,{label:`Z-Index`,value:j(`zIndex`,`auto`),onChange:e=>D({zIndex:e===``?void 0:parseInt(e)}),units:[``],placeholder:`Auto`}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Overflow`}),(0,r.jsxs)(Wy,{value:j(`overflow`,`visible`),onValueChange:e=>D({overflow:e}),children:[(0,r.jsx)(Gy,{style:{width:`100%`}}),(0,r.jsxs)(Ky,{children:[(0,r.jsx)(Y,{value:`visible`,children:`Visível`}),(0,r.jsx)(Y,{value:`hidden`,children:`Oculto`}),(0,r.jsx)(Y,{value:`scroll`,children:`Scroll`}),(0,r.jsx)(Y,{value:`auto`,children:`Auto`})]})]})]})]})}),k(`Espaçamento`,[`padding`,`margin`])&&(0,r.jsxs)(gP,{title:`Espaçamento (Margin/Padding)`,isOpen:g.spacing,onToggle:()=>w(`spacing`),onReset:()=>O([`padding`,`paddingTop`,`paddingRight`,`paddingBottom`,`paddingLeft`,`margin`,`marginTop`,`marginRight`,`marginBottom`,`marginLeft`]),children:[(0,r.jsx)(U,{mb:`3`,children:(0,r.jsx)(yP,{label:`Padding (Interno)`,values:{top:j(`paddingTop`,j(`padding`)),right:j(`paddingRight`,j(`padding`)),bottom:j(`paddingBottom`,j(`padding`)),left:j(`paddingLeft`,j(`padding`))},onChange:e=>{e.top===e.right&&e.right===e.bottom&&e.bottom===e.left?D({padding:e.top,paddingTop:void 0,paddingRight:void 0,paddingBottom:void 0,paddingLeft:void 0}):D({padding:void 0,paddingTop:e.top,paddingRight:e.right,paddingBottom:e.bottom,paddingLeft:e.left})}})}),(0,r.jsx)(U,{children:(0,r.jsx)(yP,{label:`Margin (Externo)`,values:{top:j(`marginTop`,j(`margin`)),right:j(`marginRight`,j(`margin`)),bottom:j(`marginBottom`,j(`margin`)),left:j(`marginLeft`,j(`margin`))},onChange:e=>{e.top===e.right&&e.right===e.bottom&&e.bottom===e.left?D({margin:e.top,marginTop:void 0,marginRight:void 0,marginBottom:void 0,marginLeft:void 0}):D({margin:void 0,marginTop:e.top,marginRight:e.right,marginBottom:e.bottom,marginLeft:e.left})}})})]}),k(`Bordas`,[`border`,`radius`,`stroke`])&&(0,r.jsxs)(gP,{title:`Bordas & Cantos`,isOpen:g.borders,onToggle:()=>w(`borders`),onReset:()=>O([`border`,`borderWidth`,`borderStyle`,`borderColor`,`borderRadius`,`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomRightRadius`,`borderBottomLeftRadius`]),children:[(0,r.jsxs)(sb,{defaultValue:`all`,children:[(0,r.jsxs)(cb,{children:[(0,r.jsx)(lb,{value:`all`,children:(0,r.jsx)(te,{})}),(0,r.jsx)(lb,{value:`top`,children:(0,r.jsx)(ce,{})}),(0,r.jsx)(lb,{value:`right`,children:(0,r.jsx)(oe,{})}),(0,r.jsx)(lb,{value:`bottom`,children:(0,r.jsx)(ne,{})}),(0,r.jsx)(lb,{value:`left`,children:(0,r.jsx)(ie,{})})]}),(0,r.jsx)(U,{pt:`3`,children:(0,r.jsxs)(K,{columns:`2`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Estilo`}),(0,r.jsxs)(Wy,{value:j(`borderStyle`,`none`),onValueChange:e=>D({borderStyle:e}),children:[(0,r.jsx)(Gy,{style:{width:`100%`}}),(0,r.jsxs)(Ky,{children:[(0,r.jsx)(Y,{value:`none`,children:`Nenhuma`}),(0,r.jsx)(Y,{value:`solid`,children:`Sólida`}),(0,r.jsx)(Y,{value:`dashed`,children:`Tracejada`}),(0,r.jsx)(Y,{value:`dotted`,children:`Pontilhada`}),(0,r.jsx)(Y,{value:`double`,children:`Dupla`})]})]})]}),(0,r.jsx)(vP,{label:`Espessura`,value:j(`borderWidth`,`0px`),onChange:e=>D({borderWidth:e})}),(0,r.jsxs)(U,{style:{gridColumn:`span 2`},children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Cor`}),(0,r.jsx)(nP,{color:j(`borderColor`,`#000000`),onChange:e=>D({borderColor:e})})]})]})})]}),(0,r.jsx)(U,{mt:`3`,children:(0,r.jsx)(yP,{label:`Arredondamento (Radius)`,values:{top:j(`borderTopLeftRadius`,j(`borderRadius`)),right:j(`borderTopRightRadius`,j(`borderRadius`)),bottom:j(`borderBottomRightRadius`,j(`borderRadius`)),left:j(`borderBottomLeftRadius`,j(`borderRadius`))},onChange:e=>{e.top===e.right&&e.right===e.bottom&&e.bottom===e.left?D({borderRadius:e.top,borderTopLeftRadius:void 0,borderTopRightRadius:void 0,borderBottomRightRadius:void 0,borderBottomLeftRadius:void 0}):D({borderRadius:void 0,borderTopLeftRadius:e.top,borderTopRightRadius:e.right,borderBottomRightRadius:e.bottom,borderBottomLeftRadius:e.left})}})})]}),k(`Efeitos`,[`shadow`,`sombra`])&&(0,r.jsx)(gP,{title:`Efeitos (Sombra)`,isOpen:g.effects,onToggle:()=>w(`effects`),onReset:()=>O([`boxShadow`,`textShadow`]),children:(0,r.jsxs)(sb,{defaultValue:`box`,children:[(0,r.jsxs)(cb,{children:[(0,r.jsx)(lb,{value:`box`,children:`Box Shadow`}),(0,r.jsx)(lb,{value:`text`,children:`Text Shadow`})]}),(0,r.jsxs)(U,{pt:`3`,children:[(0,r.jsx)(ub,{value:`box`,children:(0,r.jsxs)(U,{p:`2`,style:{backgroundColor:`var(--gray-3)`,borderRadius:`var(--radius-2)`},children:[(0,r.jsxs)(W,{justify:`between`,mb:`2`,children:[(0,r.jsx)(H,{size:`1`,weight:`bold`,children:`Box Shadow`}),(0,r.jsxs)(W,{gap:`2`,align:`center`,children:[(0,r.jsx)(H,{size:`1`,children:`Inset`}),(0,r.jsx)(`input`,{type:`checkbox`,checked:I.inset,onChange:e=>re({inset:e.target.checked})})]})]}),(0,r.jsxs)(K,{columns:`2`,gap:`2`,mb:`2`,children:[(0,r.jsx)(vP,{label:`X`,value:I.x,onChange:e=>re({x:parseFloat(e)}),units:[`px`]}),(0,r.jsx)(vP,{label:`Y`,value:I.y,onChange:e=>re({y:parseFloat(e)}),units:[`px`]}),(0,r.jsx)(vP,{label:`Blur`,value:I.blur,onChange:e=>re({blur:parseFloat(e)}),units:[`px`]}),(0,r.jsx)(vP,{label:`Spread`,value:I.spread,onChange:e=>re({spread:parseFloat(e)}),units:[`px`]})]}),(0,r.jsx)(nP,{color:I.color,onChange:e=>re({color:e})})]})}),(0,r.jsx)(ub,{value:`text`,children:(0,r.jsxs)(U,{p:`2`,style:{backgroundColor:`var(--gray-3)`,borderRadius:`var(--radius-2)`},children:[(0,r.jsx)(H,{size:`1`,weight:`bold`,mb:`2`,as:`div`,children:`Text Shadow`}),(0,r.jsxs)(K,{columns:`2`,gap:`2`,mb:`2`,children:[(0,r.jsx)(vP,{label:`X`,value:F(j(`textShadow`,`none`)).x,onChange:e=>{let t=F(j(`textShadow`,`none`));D({textShadow:`${e}px ${t.y}px ${t.blur}px ${t.color}`})},units:[`px`]}),(0,r.jsx)(vP,{label:`Y`,value:F(j(`textShadow`,`none`)).y,onChange:e=>{let t=F(j(`textShadow`,`none`));D({textShadow:`${t.x}px ${e}px ${t.blur}px ${t.color}`})},units:[`px`]}),(0,r.jsx)(vP,{label:`Blur`,value:F(j(`textShadow`,`none`)).blur,onChange:e=>{let t=F(j(`textShadow`,`none`));D({textShadow:`${t.x}px ${t.y}px ${e}px ${t.color}`})},units:[`px`]})]}),(0,r.jsx)(nP,{color:F(j(`textShadow`,`none`)).color,onChange:e=>{let t=F(j(`textShadow`,`none`));D({textShadow:`${t.x}px ${t.y}px ${t.blur}px ${e}`})}})]})})]})]})}),k(`Transform`,[`scale`,`rotate`,`skew`,`translate`])&&(0,r.jsx)(gP,{title:`Transformação`,isOpen:g.transform,onToggle:()=>w(`transform`),onReset:()=>T({rotation:0,style:{...m.style,transform:void 0}}),children:(0,r.jsxs)(K,{columns:`2`,gap:`3`,children:[(0,r.jsx)(vP,{label:`Rotação (deg)`,value:m.rotation,onChange:e=>T({rotation:parseFloat(e)}),units:[`deg`]}),(0,r.jsxs)(U,{style:{gridColumn:`span 2`},children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Transform CSS (Scale, Skew, Translate)`}),(0,r.jsx)(X,{value:j(`transform`,``),onChange:e=>D({transform:e.target.value}),placeholder:`ex: scale(1.5) skewX(10deg)`}),(0,r.jsxs)(H,{size:`1`,color:`gray`,mt:`1`,children:[`Use sintaxe CSS padrão. Ex: `,(0,r.jsx)(`code`,{children:`scale(1.2)`}),`, `,(0,r.jsx)(`code`,{children:`skewY(10deg)`})]})]})]})}),!h&&(0,r.jsxs)(r.Fragment,{children:[k(`Animação`,[`animation`])&&(0,r.jsx)(gP,{title:`Animação`,isOpen:g.animation,onToggle:()=>w(`animation`),onReset:()=>T({animation:void 0}),children:(0,r.jsx)(iP,{element:m,updateElement:i})}),k(`Regras`,[`condition`])&&(0,r.jsx)(gP,{title:`Regras Condicionais`,isOpen:g.conditions,onToggle:()=>w(`conditions`),onReset:()=>T({conditions:[]}),children:(0,r.jsx)(hP,{element:m,updateElement:i,availableProps:e.availableProps||[]})}),k(`Formatação`,[`format`])&&(0,r.jsx)(gP,{title:`Formatação`,isOpen:g.formatting,onToggle:()=>w(`formatting`),onReset:()=>T({formatting:void 0}),children:(0,r.jsx)(aP,{element:m,updateElement:i})})]})]},m?.id??d.join(`,`))]})})};var CP=20,wP=`#f5f5f5`,TP=`#999`;let EP=({orientation:e})=>{let{state:n}=rS(),{zoom:i,pan:a}=n,o=(0,t.useRef)(null);return(0,t.useEffect)(()=>{let t=o.current;if(!t)return;let n=t.getContext(`2d`);if(!n)return;let r=t.width,s=t.height;n.fillStyle=wP,n.fillRect(0,0,r,s),n.fillStyle=TP,n.font=`10px sans-serif`,n.strokeStyle=TP,n.lineWidth=1;let c=e===`horizontal`?-a.x/i:-a.y/i,l=e===`horizontal`?(r-a.x)/i:(s-a.y)/i,u=100;u=i>2?10:i>.8?50:i>.4?100:200;let d=Math.floor(c/u)*u;n.beginPath();for(let t=d;t<l;t+=u){let r=t*i+(e===`horizontal`?a.x:a.y);e===`horizontal`?(n.moveTo(r,0),n.lineTo(r,CP),n.fillText(t.toString(),r+2,10)):(n.moveTo(0,r),n.lineTo(CP,r),n.save(),n.translate(10,r+2),n.rotate(-Math.PI/2),n.fillText(t.toString(),0,0),n.restore())}n.stroke()},[i,a,e,n.canvasHeight]),(0,t.useEffect)(()=>{let e=o.current;if(!e)return;let t=new ResizeObserver(()=>{let t=e.parentElement?.getBoundingClientRect();t&&(e.width=t.width,e.height=t.height)});return e.parentElement&&t.observe(e.parentElement),()=>t.disconnect()},[]),(0,r.jsx)(`canvas`,{ref:o,style:{width:`100%`,height:`100%`,display:`block`,pointerEvents:`none`}})};var DP=({icon:e,label:n,keys:i})=>(0,r.jsxs)(W,{align:`center`,justify:`between`,py:`2`,children:[(0,r.jsxs)(W,{align:`center`,gap:`2`,children:[(0,r.jsx)(U,{style:{color:`var(--gray-10)`},children:(0,r.jsx)(e,{})}),(0,r.jsx)(H,{size:`2`,children:n})]}),(0,r.jsx)(W,{gap:`1`,children:i.map((e,n)=>(0,r.jsxs)(t.default.Fragment,{children:[(0,r.jsx)(Ey,{children:e}),n<i.length-1&&(0,r.jsx)(H,{size:`1`,color:`gray`,children:`+`})]},n))})]});let OP=()=>(0,r.jsxs)(ny,{children:[(0,r.jsx)(ry,{children:(0,r.jsxs)(G,{variant:`solid`,color:`amber`,radius:`full`,style:{height:36,padding:`0 14px`,boxShadow:`0 4px 6px rgba(0,0,0,0.1)`},title:`Atalhos de Teclado`,children:[(0,r.jsx)(gt,{width:`18`,height:`18`}),`Ajuda`]})}),(0,r.jsxs)(iy,{style:{maxWidth:700},onPointerDown:e=>e.stopPropagation(),children:[(0,r.jsx)(ay,{children:`Atalhos de Teclado`}),(0,r.jsx)(H,{size:`2`,color:`gray`,mb:`4`,as:`p`,children:`Agilize seu fluxo de trabalho com estes atalhos.`}),(0,r.jsxs)(K,{columns:{initial:`1`,sm:`2`},gap:`6`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`2`,weight:`bold`,mb:`2`,color:`blue`,children:`Edição Básica`}),(0,r.jsx)(Qy,{size:`4`,mb:`2`}),(0,r.jsx)(DP,{icon:It,label:`Desfazer`,keys:[`Ctrl`,`Z`]}),(0,r.jsx)(DP,{icon:It,label:`Refazer`,keys:[`Ctrl`,`Y`]}),(0,r.jsx)(DP,{icon:Se,label:`Copiar`,keys:[`Ctrl`,`C`]}),(0,r.jsx)(DP,{icon:Se,label:`Colar`,keys:[`Ctrl`,`V`]}),(0,r.jsx)(DP,{icon:Xt,label:`Excluir`,keys:[`Delete`]})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`2`,weight:`bold`,mb:`2`,color:`blue`,children:`Navegação e Seleção`}),(0,r.jsx)(Qy,{size:`4`,mb:`2`}),(0,r.jsx)(DP,{icon:ut,label:`Mover Elemento`,keys:[`Setas`]}),(0,r.jsx)(DP,{icon:ut,label:`Mover Rápido`,keys:[`Shift`,`Setas`]}),(0,r.jsx)(DP,{icon:Oe,label:`Multiseleção`,keys:[`Shift`,`Click`]}),(0,r.jsx)(DP,{icon:wt,label:`Mover Canvas (Pan)`,keys:[`Espaço`,`Arrastar`]}),(0,r.jsx)(DP,{icon:ot,label:`Zoom`,keys:[`Ctrl`,`Scroll`]})]})]}),(0,r.jsx)(W,{justify:`end`,mt:`5`,children:(0,r.jsx)(sy,{children:(0,r.jsx)(G,{variant:`soft`,color:`gray`,children:`Fechar`})})})]})]}),kP=()=>{let{state:e,updateListSettings:n,setCanvasHeight:i,setGridSize:a}=rS(),[o,s]=(0,t.useState)(!1),[c,l]=(0,t.useState)(``),[u,d]=(0,t.useState)(`asc`),[f,p]=(0,t.useState)(`bottom`),[m,h]=(0,t.useState)(`down`),[g,_]=(0,t.useState)(`150`),[v,y]=(0,t.useState)(``),[b,x]=(0,t.useState)(`0`),[S,C]=(0,t.useState)(`slideIn`),[w,T]=(0,t.useState)(.3),[E,D]=(0,t.useState)(`ease-out`),O=t.default.useRef(!1);return(0,t.useEffect)(()=>{if(o&&!O.current){O.current=!0,l(e.listSettings.sortProp||`__none__`),d(e.listSettings.sortOrder||`asc`),p(e.listSettings.newestPosition||`bottom`),h(e.listSettings.scrollDirection||`down`),y(e.listSettings.containerHeight?String(e.listSettings.containerHeight):``),_(String(e.canvasHeight||150)),x(String(e.gridSize||0));let t=e.listSettings.entryAnimation;C(t?.type||`slideIn`),T(t?.duration||.3),D(t?.timingFunction||`ease-out`)}o||(O.current=!1)},[o]),(0,t.useEffect)(()=>{if(!o)return;let e=parseInt(g,10);!isNaN(e)&&e>0&&i(e);let t=parseInt(b,10);!isNaN(t)&&t>=0&&a(t)},[g,b,o,i,a]),(0,r.jsxs)(ny,{open:o,onOpenChange:s,children:[(0,r.jsx)(ry,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`center`,cursor:`pointer`},children:[(0,r.jsx)(Je,{}),` Configurações`]})}),(0,r.jsxs)(iy,{style:{maxWidth:600},children:[(0,r.jsx)(ay,{children:`Configurações do Editor`}),(0,r.jsx)(oy,{size:`2`,mb:`4`,children:`Configure o comportamento da lista.`}),(0,r.jsx)(U,{pt:`3`,children:(0,r.jsxs)(W,{direction:`column`,gap:`3`,children:[(0,r.jsx)(H,{size:`2`,weight:`bold`,children:`Ordenação`}),(0,r.jsxs)(W,{gap:`3`,align:`center`,children:[(0,r.jsxs)(U,{flexGrow:`1`,children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,children:`Propriedade para Ordenar`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[c===`__none__`?`(Nenhum)`:e.availableProps.find(e=>e.dataName===c)?.name||c,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>l(`__none__`),children:`(Nenhum)`}),e.availableProps.map(e=>(0,r.jsx)(q,{onSelect:()=>l(e.dataName),children:e.name},e.dataName))]})]})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,children:`Direção`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:150,justifyContent:`space-between`},children:[u===`asc`?`Crescente (A-Z)`:`Decrescente (Z-A)`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>d(`asc`),children:`Crescente (A-Z)`}),(0,r.jsx)(q,{onSelect:()=>d(`desc`),children:`Decrescente (Z-A)`})]})]})]})]}),(0,r.jsxs)(W,{gap:`3`,align:`center`,children:[(0,r.jsxs)(U,{flexGrow:`1`,children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,children:`Posição do Recente`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[f===`top`?`Topo (Início)`:`Base (Final)`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>p(`top`),children:`Topo (Início)`}),(0,r.jsx)(q,{onSelect:()=>p(`bottom`),children:`Base (Final)`})]})]})]}),(0,r.jsxs)(U,{flexGrow:`1`,children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,children:`Comportamento de Rolagem`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[m===`down`?`Descer (Padrão)`:`Subir (Chat)`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>h(`down`),children:`Descer (Padrão)`}),(0,r.jsx)(q,{onSelect:()=>h(`up`),children:`Subir (Chat)`})]})]})]})]}),(0,r.jsx)(H,{size:`2`,weight:`bold`,mt:`2`,children:`Dimensões`}),(0,r.jsxs)(W,{gap:`3`,align:`center`,children:[(0,r.jsxs)(U,{flexGrow:`1`,children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,children:`Altura do Item (Template) (px)`}),(0,r.jsx)(X,{type:`number`,min:`10`,value:g,onChange:e=>_(e.target.value)}),(0,r.jsx)(H,{size:`1`,color:`gray`,children:`Altura de cada item individual na lista.`})]}),(0,r.jsxs)(U,{flexGrow:`1`,children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,children:`Altura da Lista (Container) (px)`}),(0,r.jsx)(X,{type:`number`,min:`0`,placeholder:`Auto (100%)`,value:v,onChange:e=>y(e.target.value)}),(0,r.jsx)(H,{size:`1`,color:`gray`,children:`Altura total da lista. Se exceder, rola. Vazio = 100%.`})]})]}),(0,r.jsx)(H,{size:`2`,weight:`bold`,mt:`2`,children:`Animação de Entrada na Lista`}),(0,r.jsxs)(K,{columns:`3`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,children:`Efeito`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[S===`slideIn`?`Slide (Padrão)`:S===`smoothSlideUp`?`Slide Suave (Up)`:S===`fadeIn`?`Fade In`:S===`popIn`?`Pop In`:S===`blurIn`?`Blur In`:S===`slideInLeft`?`Slide (Esq)`:S===`slideInRight`?`Slide (Dir)`:S===`zoomIn`?`Zoom In`:S===`bounceIn`?`Bounce`:`Nenhum`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>C(`none`),children:`Nenhum`}),(0,r.jsx)(q,{onSelect:()=>C(`slideIn`),children:`Slide (Padrão)`}),(0,r.jsx)(q,{onSelect:()=>C(`smoothSlideUp`),children:`Slide Suave (Up)`}),(0,r.jsx)(q,{onSelect:()=>C(`fadeIn`),children:`Fade In`}),(0,r.jsx)(q,{onSelect:()=>C(`popIn`),children:`Pop In`}),(0,r.jsx)(q,{onSelect:()=>C(`blurIn`),children:`Blur In`}),(0,r.jsx)(q,{onSelect:()=>C(`slideInLeft`),children:`Slide (Esq)`}),(0,r.jsx)(q,{onSelect:()=>C(`slideInRight`),children:`Slide (Dir)`}),(0,r.jsx)(q,{onSelect:()=>C(`zoomIn`),children:`Zoom In`}),(0,r.jsx)(q,{onSelect:()=>C(`bounceIn`),children:`Bounce`})]})]})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,children:`Duração (s)`}),(0,r.jsx)(X,{type:`number`,step:`0.1`,min:`0.1`,value:w,onChange:e=>T(parseFloat(e.target.value)||.3)})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,children:`Curva (Easing)`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[E===`ease-out`?`Ease Out`:E===`linear`?`Linear`:E===`bounce`?`Bounce`:`Ease`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>D(`ease`),children:`Ease`}),(0,r.jsx)(q,{onSelect:()=>D(`ease-out`),children:`Ease Out`}),(0,r.jsx)(q,{onSelect:()=>D(`linear`),children:`Linear`}),(0,r.jsx)(q,{onSelect:()=>D(`bounce`),children:`Bounce`})]})]})]})]}),(0,r.jsxs)(U,{mt:`2`,children:[(0,r.jsx)(H,{size:`2`,weight:`bold`,children:`Grid Snapping (Travar)`}),(0,r.jsx)(W,{gap:`3`,align:`center`,mt:`2`,children:(0,r.jsxs)(U,{flexGrow:`1`,children:[(0,r.jsx)(H,{size:`1`,mb:`1`,as:`div`,children:`Tamanho do Grid (px) - 0 para desativar`}),(0,r.jsx)(X,{type:`number`,value:b,onChange:e=>x(e.target.value),placeholder:`0`})]})})]})]})}),(0,r.jsxs)(W,{gap:`3`,mt:`4`,justify:`end`,children:[(0,r.jsx)(sy,{children:(0,r.jsx)(G,{variant:`soft`,color:`gray`,children:`Cancelar`})}),(0,r.jsx)(sy,{children:(0,r.jsx)(G,{onClick:()=>{let e=parseInt(v,10),t=parseInt(g,10),r=parseInt(b,10),o={type:S,duration:Number(w),delay:0,timingFunction:E};n({sortProp:c===`__none__`?``:c,sortOrder:u,newestPosition:f,scrollDirection:m,containerHeight:!isNaN(e)&&e>0?e:void 0,entryAnimation:o}),!isNaN(t)&&t>0&&i(t),!isNaN(r)&&r>=0&&a(r),s(!1)},children:`Salvar Alterações`})})]})]})]})},AP=({onClose:e})=>{let{state:t,jumpToHistory:n,undo:i,redo:a}=rS(),o=t=>{n(t),e&&e()};return(0,r.jsxs)(W,{direction:`column`,style:{width:`100%`},children:[(0,r.jsxs)(W,{justify:`between`,align:`center`,p:`2`,style:{borderBottom:`1px solid var(--gray-5)`},children:[(0,r.jsxs)(W,{align:`center`,gap:`2`,children:[(0,r.jsx)(vt,{}),(0,r.jsx)(H,{size:`2`,weight:`bold`,children:`Histórico`})]}),(0,r.jsxs)(W,{gap:`2`,children:[(0,r.jsx)(G,{size:`1`,variant:`soft`,onClick:i,disabled:t.historyIndex<=0,children:`Desfazer`}),(0,r.jsx)(G,{size:`1`,variant:`soft`,onClick:a,disabled:t.historyIndex>=t.history.length-1,children:`Refazer`})]})]}),(0,r.jsx)(U,{p:`0`,children:t.history.map((e,n)=>{let i=n===t.historyIndex,a=n>t.historyIndex,s=t.historyDescriptions?.[n]||(n===0?`Estado Inicial`:`Alteração ${n}`);return(0,r.jsx)(U,{p:`2`,style:{backgroundColor:i?`var(--accent-3)`:`transparent`,opacity:a?.5:1,cursor:`pointer`,borderBottom:`1px solid var(--gray-3)`},onClick:()=>o(n),className:`history-item`,children:(0,r.jsxs)(W,{align:`center`,justify:`between`,children:[(0,r.jsx)(H,{size:`2`,weight:i?`bold`:`regular`,children:s}),i&&(0,r.jsx)(H,{size:`1`,color:`blue`,children:`Atual`})]})},n)})})]})};function jP(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return(0,t.useMemo)(()=>e=>{n.forEach(t=>t(e))},n)}var MP=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function NP(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function PP(e){return`nodeType`in e}function FP(e){return e?NP(e)?e:PP(e)?e.ownerDocument?.defaultView??window:window:window}function IP(e){let{Document:t}=FP(e);return e instanceof t}function LP(e){return NP(e)?!1:e instanceof FP(e).HTMLElement}function RP(e){return e instanceof FP(e).SVGElement}function zP(e){return e?NP(e)?e.document:PP(e)?IP(e)?e:LP(e)||RP(e)?e.ownerDocument:document:document:document}var BP=MP?t.useLayoutEffect:t.useEffect;function VP(e){let n=(0,t.useRef)(e);return BP(()=>{n.current=e}),(0,t.useCallback)(function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return n.current==null?void 0:n.current(...t)},[])}function HP(){let e=(0,t.useRef)(null);return[(0,t.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,t.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function UP(e,n){n===void 0&&(n=[e]);let r=(0,t.useRef)(e);return BP(()=>{r.current!==e&&(r.current=e)},n),r}function WP(e,n){let r=(0,t.useRef)();return(0,t.useMemo)(()=>{let t=e(r.current);return r.current=t,t},[...n])}function GP(e){let n=VP(e),r=(0,t.useRef)(null);return[r,(0,t.useCallback)(e=>{e!==r.current&&n?.(e,r.current),r.current=e},[])]}function KP(e){let n=(0,t.useRef)();return(0,t.useEffect)(()=>{n.current=e},[e]),n.current}var qP={};function JP(e,n){return(0,t.useMemo)(()=>{if(n)return n;let t=qP[e]==null?0:qP[e]+1;return qP[e]=t,e+`-`+t},[e,n])}function YP(e){return function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var XP=YP(1),ZP=YP(-1);function QP(e){return`clientX`in e&&`clientY`in e}function $P(e){if(!e)return!1;let{KeyboardEvent:t}=FP(e.target);return t&&e instanceof t}function eF(e){if(!e)return!1;let{TouchEvent:t}=FP(e.target);return t&&e instanceof t}function tF(e){if(eF(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return QP(e)?{x:e.clientX,y:e.clientY}:null}var nF=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[nF.Translate.toString(e),nF.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),rF=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function iF(e){return e.matches(rF)?e:e.querySelector(rF)}var aF={display:`none`};function oF(e){let{id:n,value:r}=e;return t.default.createElement(`div`,{id:n,style:aF},r)}function sF(e){let{id:n,announcement:r,ariaLiveType:i=`assertive`}=e;return t.default.createElement(`div`,{id:n,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":i,"aria-atomic":!0},r)}function cF(){let[e,n]=(0,t.useState)(``);return{announce:(0,t.useCallback)(e=>{e!=null&&n(e)},[]),announcement:e}}var lF=(0,t.createContext)(null);function uF(e){let n=(0,t.useContext)(lF);(0,t.useEffect)(()=>{if(!n)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return n(e)},[e,n])}function dF(){let[e]=(0,t.useState)(()=>new Set),n=(0,t.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,t.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),n]}var fF={draggable:`
58
58
  To pick up a draggable item, press the space bar.
59
59
  While dragging, use the arrow keys to move the item.
60
60
  Press space again to drop the item in its new position, or press escape to cancel.
61
- `},dF={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function fF(e){let{announcements:r=dF,container:i,hiddenTextDescribedById:a,screenReaderInstructions:o=uF}=e,{announce:s,announcement:c}=oF(),l=KP(`DndLiveRegion`),[u,d]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{d(!0)},[]),cF((0,t.useMemo)(()=>({onDragStart(e){let{active:t}=e;s(r.onDragStart({active:t}))},onDragMove(e){let{active:t,over:n}=e;r.onDragMove&&s(r.onDragMove({active:t,over:n}))},onDragOver(e){let{active:t,over:n}=e;s(r.onDragOver({active:t,over:n}))},onDragEnd(e){let{active:t,over:n}=e;s(r.onDragEnd({active:t,over:n}))},onDragCancel(e){let{active:t,over:n}=e;s(r.onDragCancel({active:t,over:n}))}}),[s,r])),!u)return null;let f=t.default.createElement(t.default.Fragment,null,t.default.createElement(iF,{id:a,value:o.draggable}),t.default.createElement(aF,{id:l,announcement:c}));return i?(0,n.createPortal)(f,i):f}var pF;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(pF||={});function mF(){}function hF(e,n){return(0,t.useMemo)(()=>({sensor:e,options:n??{}}),[e,n])}function gF(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return(0,t.useMemo)(()=>[...n].filter(e=>e!=null),[...n])}var _F=Object.freeze({x:0,y:0});function vF(e,t){let n=$P(e);if(!n)return`0 0`;let r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+`% `+r.y+`%`}function yF(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function bF(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function xF(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var SF=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=xF(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(yF)};function CF(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function wF(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:_F}function TF(e){return function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var EF=TF(1);function DF(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function OF(e,t,n){let r=DF(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var kF={ignoreTransform:!1};function AF(e,t){t===void 0&&(t=kF);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=NP(e).getComputedStyle(e);t&&(n=OF(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function jF(e){return AF(e,{ignoreTransform:!0})}function MF(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function NF(e,t){return t===void 0&&(t=NP(e).getComputedStyle(e)),t.position===`fixed`}function PF(e,t){t===void 0&&(t=NP(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`?n.test(r):!1})}function FF(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(PP(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!FP(i)||IP(i)||n.includes(i))return n;let a=NP(e).getComputedStyle(i);return i!==e&&PF(i,a)&&n.push(i),NF(i,a)?n:r(i.parentNode)}return e?r(e):n}function IF(e){let[t]=FF(e,1);return t??null}function LF(e){return!AP||!e?null:jP(e)?e:MP(e)?PP(e)||e===LP(e).scrollingElement?window:FP(e)?e:null:null}function RF(e){return jP(e)?e.scrollX:e.scrollLeft}function zF(e){return jP(e)?e.scrollY:e.scrollTop}function BF(e){return{x:RF(e),y:zF(e)}}var VF;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(VF||={});function HF(e){return!AP||!e?!1:e===document.scrollingElement}function UF(e){let t={x:0,y:0},n=HF(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var WF={x:.2,y:.2};function GF(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=WF);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=UF(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=VF.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=VF.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=VF.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=VF.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function KF(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function qF(e){return e.reduce((e,t)=>JP(e,BF(t)),_F)}function JF(e){return e.reduce((e,t)=>e+RF(t),0)}function YF(e){return e.reduce((e,t)=>e+zF(t),0)}function XF(e,t){if(t===void 0&&(t=AF),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);IF(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var ZF=[[`x`,[`left`,`right`],JF],[`y`,[`top`,`bottom`],YF]],QF=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=FF(t),r=qF(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of ZF)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,`rect`,{enumerable:!1})}},$F=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function eI(e){let{EventTarget:t}=NP(e);return e instanceof t?e:LP(e)}function tI(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t?r>t.y:!1}var nI;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(nI||={});function rI(e){e.preventDefault()}function iI(e){e.stopPropagation()}var $;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})($||={});var aI={start:[$.Space,$.Enter],cancel:[$.Esc],end:[$.Space,$.Enter,$.Tab]},oI=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case $.Right:return{...n,x:n.x+25};case $.Left:return{...n,x:n.x-25};case $.Down:return{...n,y:n.y+25};case $.Up:return{...n,y:n.y-25}}},sI=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new $F(LP(t)),this.windowListeners=new $F(NP(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(nI.Resize,this.handleCancel),this.windowListeners.add(nI.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(nI.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&XF(n),t(_F)}handleKeyDown(e){if(ZP(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=aI,coordinateGetter:a=oI,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:_F;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=YP(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=UF(n),p=KF(n),m={x:Math.min(i===$.Right?p.right-p.width/2:p.right,Math.max(i===$.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===$.Down?p.bottom-p.height/2:p.bottom,Math.max(i===$.Down?p.top:p.top+p.height/2,u.y))},h=i===$.Right&&!s||i===$.Left&&!c,g=i===$.Down&&!l||i===$.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===$.Right&&e<=d.x||i===$.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===$.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===$.Down&&e<=d.y||i===$.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===$.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,JP(YP(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};sI.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=aI,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function cI(e){return!!(e&&`distance`in e)}function lI(e){return!!(e&&`delay`in e)}var uI=class{constructor(e,t,n){n===void 0&&(n=eI(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=LP(i),this.documentListeners=new $F(this.document),this.listeners=new $F(n),this.windowListeners=new $F(NP(i)),this.initialCoordinates=$P(r)??_F,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(nI.Resize,this.handleCancel),this.windowListeners.add(nI.DragStart,rI),this.windowListeners.add(nI.VisibilityChange,this.handleCancel),this.windowListeners.add(nI.ContextMenu,rI),this.documentListeners.add(nI.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(lI(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(cI(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(nI.Click,iI,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(nI.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=$P(e)??_F,s=YP(n,o);if(!t&&a){if(cI(a)){if(a.tolerance!=null&&tI(s,a.tolerance))return this.handleCancel();if(tI(s,a.distance))return this.handleStart()}if(lI(a)&&tI(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===$.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},dI={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},fI=class extends uI{constructor(e){let{event:t}=e,n=LP(t.target);super(e,dI,n)}};fI.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var pI={move:{name:`mousemove`},end:{name:`mouseup`}},mI;(function(e){e[e.RightClick=2]=`RightClick`})(mI||={});var hI=class extends uI{constructor(e){super(e,pI,LP(e.event.target))}};hI.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===mI.RightClick?!1:(r?.({event:n}),!0)}}];var gI={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},_I=class extends uI{constructor(e){super(e,gI)}static setup(){return window.addEventListener(gI.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(gI.move.name,e)};function e(){}}};_I.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var vI;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(vI||={});var yI;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(yI||={});function bI(e){let{acceleration:n,activator:r=vI.Pointer,canScroll:i,draggingRect:a,enabled:o,interval:s=5,order:c=yI.TreeOrder,pointerCoordinates:l,scrollableAncestors:u,scrollableAncestorRects:d,delta:f,threshold:p}=e,m=SI({delta:f,disabled:!o}),[h,g]=BP(),_=(0,t.useRef)({x:0,y:0}),v=(0,t.useRef)({x:0,y:0}),y=(0,t.useMemo)(()=>{switch(r){case vI.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case vI.DraggableRect:return a}},[r,a,l]),b=(0,t.useRef)(null),x=(0,t.useCallback)(()=>{let e=b.current;if(!e)return;let t=_.current.x*v.current.x,n=_.current.y*v.current.y;e.scrollBy(t,n)},[]),S=(0,t.useMemo)(()=>c===yI.TreeOrder?[...u].reverse():u,[c,u]);(0,t.useEffect)(()=>{if(!o||!u.length||!y){g();return}for(let e of S){if(i?.(e)===!1)continue;let t=d[u.indexOf(e)];if(!t)continue;let{direction:r,speed:a}=GF(e,t,y,n,p);for(let e of[`x`,`y`])m[e][r[e]]||(a[e]=0,r[e]=0);if(a.x>0||a.y>0){g(),b.current=e,h(x,s),_.current=a,v.current=r;return}}_.current={x:0,y:0},v.current={x:0,y:0},g()},[n,x,i,g,o,s,JSON.stringify(y),JSON.stringify(m),h,u,S,d,JSON.stringify(p)])}var xI={x:{[VF.Backward]:!1,[VF.Forward]:!1},y:{[VF.Backward]:!1,[VF.Forward]:!1}};function SI(e){let{delta:t,disabled:n}=e,r=WP(t);return HP(e=>{if(n||!r||!e)return xI;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[VF.Backward]:e.x[VF.Backward]||i.x===-1,[VF.Forward]:e.x[VF.Forward]||i.x===1},y:{[VF.Backward]:e.y[VF.Backward]||i.y===-1,[VF.Forward]:e.y[VF.Forward]||i.y===1}}},[n,t,r])}function CI(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return HP(e=>t==null?null:r??e??null,[r,t])}function wI(e,n){return(0,t.useMemo)(()=>e.reduce((e,t)=>{let{sensor:r}=t,i=r.activators.map(e=>({eventName:e.eventName,handler:n(e.handler,t)}));return[...e,...i]},[]),[e,n])}var TI;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(TI||={});var EI;(function(e){e.Optimized=`optimized`})(EI||={});var DI=new Map;function OI(e,n){let{dragging:r,dependencies:i,config:a}=n,[o,s]=(0,t.useState)(null),{frequency:c,measure:l,strategy:u}=a,d=(0,t.useRef)(e),f=_(),p=VP(f),m=(0,t.useCallback)(function(e){e===void 0&&(e=[]),!p.current&&s(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[p]),h=(0,t.useRef)(null),g=HP(t=>{if(f&&!r)return DI;if(!t||t===DI||d.current!==e||o!=null){let t=new Map;for(let n of e){if(!n)continue;if(o&&o.length>0&&!o.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new QF(l(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,o,r,f,l]);return(0,t.useEffect)(()=>{d.current=e},[e]),(0,t.useEffect)(()=>{f||m()},[r,f]),(0,t.useEffect)(()=>{o&&o.length>0&&s(null)},[JSON.stringify(o)]),(0,t.useEffect)(()=>{f||typeof c!=`number`||h.current!==null||(h.current=setTimeout(()=>{m(),h.current=null},c))},[c,f,m,...i]),{droppableRects:g,measureDroppableContainers:m,measuringScheduled:o!=null};function _(){switch(u){case TI.Always:return!1;case TI.BeforeDragging:return r;default:return!r}}}function kI(e,t){return HP(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function AI(e,t){return kI(e,t)}function jI(e){let{callback:n,disabled:r}=e,i=zP(n),a=(0,t.useMemo)(()=>{if(r||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(i)},[i,r]);return(0,t.useEffect)(()=>()=>a?.disconnect(),[a]),a}function MI(e){let{callback:n,disabled:r}=e,i=zP(n),a=(0,t.useMemo)(()=>{if(r||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(i)},[r]);return(0,t.useEffect)(()=>()=>a?.disconnect(),[a]),a}function NI(e){return new QF(AF(e),e)}function PI(e,n,r){n===void 0&&(n=NI);let[i,a]=(0,t.useState)(null);function o(){a(t=>{if(!e)return null;if(e.isConnected===!1)return t??r??null;let i=n(e);return JSON.stringify(t)===JSON.stringify(i)?t:i})}let s=jI({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){o();break}}}}),c=MI({callback:o});return RP(()=>{o(),e?(c?.observe(e),s?.observe(document.body,{childList:!0,subtree:!0})):(c?.disconnect(),s?.disconnect())},[e]),i}function FI(e){return wF(e,kI(e))}var II=[];function LI(e){let n=(0,t.useRef)(e),r=HP(t=>e?t&&t!==II&&e&&n.current&&e.parentNode===n.current.parentNode?t:FF(e):II,[e]);return(0,t.useEffect)(()=>{n.current=e},[e]),r}function RI(e){let[n,r]=(0,t.useState)(null),i=(0,t.useRef)(e),a=(0,t.useCallback)(e=>{let t=LF(e.target);t&&r(e=>e?(e.set(t,BF(t)),new Map(e)):null)},[]);return(0,t.useEffect)(()=>{let t=i.current;if(e!==t){n(t);let o=e.map(e=>{let t=LF(e);return t?(t.addEventListener(`scroll`,a,{passive:!0}),[t,BF(t)]):null}).filter(e=>e!=null);r(o.length?new Map(o):null),i.current=e}return()=>{n(e),n(t)};function n(e){e.forEach(e=>{LF(e)?.removeEventListener(`scroll`,a)})}},[a,e]),(0,t.useMemo)(()=>e.length?n?Array.from(n.values()).reduce((e,t)=>JP(e,t),_F):qF(e):_F,[e,n])}function zI(e,n){n===void 0&&(n=[]);let r=(0,t.useRef)(null);return(0,t.useEffect)(()=>{r.current=null},n),(0,t.useEffect)(()=>{let t=e!==_F;t&&!r.current&&(r.current=e),!t&&r.current&&(r.current=null)},[e]),r.current?YP(e,r.current):_F}function BI(e){(0,t.useEffect)(()=>{if(!AP)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function VI(e,n){return(0,t.useMemo)(()=>e.reduce((e,t)=>{let{eventName:r,handler:i}=t;return e[r]=e=>{i(e,n)},e},{}),[e,n])}function HI(e){return(0,t.useMemo)(()=>e?MF(e):null,[e])}var UI=[];function WI(e,n){n===void 0&&(n=AF);let[r]=e,i=HI(r?NP(r):null),[a,o]=(0,t.useState)(UI);function s(){o(()=>e.length?e.map(e=>HF(e)?i:new QF(n(e),e)):UI)}let c=MI({callback:s});return RP(()=>{c?.disconnect(),s(),e.forEach(e=>c?.observe(e))},[e]),a}function GI(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return FP(t)?t:e}function KI(e){let{measure:n}=e,[r,i]=(0,t.useState)(null),a=MI({callback:(0,t.useCallback)(e=>{for(let{target:t}of e)if(FP(t)){i(e=>{let r=n(t);return e?{...e,width:r.width,height:r.height}:r});break}},[n])}),[o,s]=UP((0,t.useCallback)(e=>{let t=GI(e);a?.disconnect(),t&&a?.observe(t),i(t?n(t):null)},[n,a]));return(0,t.useMemo)(()=>({nodeRef:o,rect:r,setRef:s}),[r,o,s])}var qI=[{sensor:fI,options:{}},{sensor:sI,options:{}}],JI={current:{}},YI={draggable:{measure:jF},droppable:{measure:jF,strategy:TI.WhileDragging,frequency:EI.Optimized},dragOverlay:{measure:AF}},XI=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},ZI={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new XI,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:mF},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:YI,measureDroppableContainers:mF,windowRect:null,measuringScheduled:!1},QI={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:mF,draggableNodes:new Map,over:null,measureDroppableContainers:mF},$I=(0,t.createContext)(QI),eL=(0,t.createContext)(ZI);function tL(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new XI}}}function nL(e,t){switch(t.type){case pF.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case pF.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case pF.DragEnd:case pF.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case pF.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new XI(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case pF.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new XI(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case pF.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new XI(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function rL(e){let{disabled:n}=e,{active:r,activatorEvent:i,draggableNodes:a}=(0,t.useContext)($I),o=WP(i),s=WP(r?.id);return(0,t.useEffect)(()=>{if(!n&&!i&&o&&s!=null){if(!ZP(o)||document.activeElement===o.target)return;let e=a.get(s);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=nF(e);if(t){t.focus();break}}})}},[i,n,a,s,o]),null}function iL(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function aL(e){return(0,t.useMemo)(()=>({draggable:{...YI.draggable,...e?.draggable},droppable:{...YI.droppable,...e?.droppable},dragOverlay:{...YI.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function oL(e){let{activeNode:n,measure:r,initialRect:i,config:a=!0}=e,o=(0,t.useRef)(!1),{x:s,y:c}=typeof a==`boolean`?{x:a,y:a}:a;RP(()=>{if(!s&&!c||!n){o.current=!1;return}if(o.current||!i)return;let e=n?.node.current;if(!e||e.isConnected===!1)return;let t=wF(r(e),i);if(s||(t.x=0),c||(t.y=0),o.current=!0,Math.abs(t.x)>0||Math.abs(t.y)>0){let n=IF(e);n&&n.scrollBy({top:t.y,left:t.x})}},[n,s,c,i,r])}var sL=(0,t.createContext)({..._F,scaleX:1,scaleY:1}),cL;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(cL||={});var lL=(0,t.memo)(function(e){let{id:r,accessibility:i,autoScroll:a=!0,children:o,sensors:s=qI,collisionDetection:c=SF,measuring:l,modifiers:u,...d}=e,[f,p]=(0,t.useReducer)(nL,void 0,tL),[m,h]=lF(),[g,_]=(0,t.useState)(cL.Uninitialized),v=g===cL.Initialized,{draggable:{active:y,nodes:b,translate:x},droppable:{containers:S}}=f,C=y==null?null:b.get(y),w=(0,t.useRef)({initial:null,translated:null}),T=(0,t.useMemo)(()=>y==null?null:{id:y,data:C?.data??JI,rect:w},[y,C]),E=(0,t.useRef)(null),[D,O]=(0,t.useState)(null),[k,A]=(0,t.useState)(null),j=VP(d,Object.values(d)),M=KP(`DndDescribedBy`,r),N=(0,t.useMemo)(()=>S.getEnabled(),[S]),P=aL(l),{droppableRects:ee,measureDroppableContainers:F,measuringScheduled:te}=OI(N,{dragging:v,dependencies:[x.x,x.y],config:P.droppable}),I=CI(b,y),ne=(0,t.useMemo)(()=>k?$P(k):null,[k]),re=Pe(),ie=AI(I,P.draggable.measure);oL({activeNode:y==null?null:b.get(y),config:re.layoutShiftCompensation,initialRect:ie,measure:P.draggable.measure});let ae=PI(I,P.draggable.measure,ie),oe=PI(I?I.parentElement:null),se=(0,t.useRef)({activatorEvent:null,active:null,activeNode:I,collisionRect:null,collisions:null,droppableRects:ee,draggableNodes:b,draggingNode:null,draggingNodeRect:null,droppableContainers:S,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ce=S.getNodeFor(se.current.over?.id),le=KI({measure:P.dragOverlay.measure}),ue=le.nodeRef.current??I,de=v?le.rect??ae:null,fe=!!(le.nodeRef.current&&le.rect),pe=FI(fe?null:ae),me=HI(ue?NP(ue):null),he=LI(v?ce??I:null),ge=WI(he),_e=iL(u,{transform:{x:x.x-pe.x,y:x.y-pe.y,scaleX:1,scaleY:1},activatorEvent:k,active:T,activeNodeRect:ae,containerNodeRect:oe,draggingNodeRect:de,over:se.current.over,overlayNodeRect:le.rect,scrollableAncestors:he,scrollableAncestorRects:ge,windowRect:me}),ve=ne?JP(ne,x):null,ye=RI(he),be=zI(ye),xe=zI(ye,[ae]),Se=JP(_e,be),Ce=de?EF(de,_e):null,we=T&&Ce?c({active:T,collisionRect:Ce,droppableRects:ee,droppableContainers:N,pointerCoordinates:ve}):null,Te=bF(we,`id`),[Ee,De]=(0,t.useState)(null),Oe=CF(fe?_e:JP(_e,xe),Ee?.rect??null,ae),ke=(0,t.useRef)(null),Ae=(0,t.useCallback)((e,t)=>{let{sensor:r,options:i}=t;if(E.current==null)return;let a=b.get(E.current);if(!a)return;let o=e.nativeEvent;ke.current=new r({active:E.current,activeNode:a,event:o,options:i,context:se,onAbort(e){if(!b.get(e))return;let{onDragAbort:t}=j.current,n={id:e};t?.(n),m({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!b.get(e))return;let{onDragPending:i}=j.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),m({type:`onDragPending`,event:a})},onStart(e){let t=E.current;if(t==null)return;let r=b.get(t);if(!r)return;let{onDragStart:i}=j.current,a={activatorEvent:o,active:{id:t,data:r.data,rect:w}};(0,n.unstable_batchedUpdates)(()=>{i?.(a),_(cL.Initializing),p({type:pF.DragStart,initialCoordinates:e,active:t}),m({type:`onDragStart`,event:a}),O(ke.current),A(o)})},onMove(e){p({type:pF.DragMove,coordinates:e})},onEnd:s(pF.DragEnd),onCancel:s(pF.DragCancel)});function s(e){return async function(){let{active:t,collisions:r,over:i,scrollAdjustedTranslate:a}=se.current,s=null;if(t&&a){let{cancelDrop:n}=j.current;s={activatorEvent:o,active:t,collisions:r,delta:a,over:i},e===pF.DragEnd&&typeof n==`function`&&await Promise.resolve(n(s))&&(e=pF.DragCancel)}E.current=null,(0,n.unstable_batchedUpdates)(()=>{p({type:e}),_(cL.Uninitialized),De(null),O(null),A(null),ke.current=null;let t=e===pF.DragEnd?`onDragEnd`:`onDragCancel`;if(s){let e=j.current[t];e?.(s),m({type:t,event:s})}})}}},[b]),je=wI(s,(0,t.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=b.get(r);if(E.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},E.current=r,Ae(n,t))},[b,Ae]));BI(s),RP(()=>{ae&&g===cL.Initializing&&_(cL.Initialized)},[ae,g]),(0,t.useEffect)(()=>{let{onDragMove:e}=j.current,{active:t,activatorEvent:r,collisions:i,over:a}=se.current;if(!t||!r)return;let o={active:t,activatorEvent:r,collisions:i,delta:{x:Se.x,y:Se.y},over:a};(0,n.unstable_batchedUpdates)(()=>{e?.(o),m({type:`onDragMove`,event:o})})},[Se.x,Se.y]),(0,t.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:r,droppableContainers:i,scrollAdjustedTranslate:a}=se.current;if(!e||E.current==null||!t||!a)return;let{onDragOver:o}=j.current,s=i.get(Te),c=s&&s.rect.current?{id:s.id,rect:s.rect.current,data:s.data,disabled:s.disabled}:null,l={active:e,activatorEvent:t,collisions:r,delta:{x:a.x,y:a.y},over:c};(0,n.unstable_batchedUpdates)(()=>{De(c),o?.(l),m({type:`onDragOver`,event:l})})},[Te]),RP(()=>{se.current={activatorEvent:k,active:T,activeNode:I,collisionRect:Ce,collisions:we,droppableRects:ee,draggableNodes:b,draggingNode:ue,draggingNodeRect:de,droppableContainers:S,over:Ee,scrollableAncestors:he,scrollAdjustedTranslate:Se},w.current={initial:de,translated:Ce}},[T,I,we,Ce,b,ue,de,ee,S,Ee,he,Se]),bI({...re,delta:x,draggingRect:Ce,pointerCoordinates:ve,scrollableAncestors:he,scrollableAncestorRects:ge});let Me=(0,t.useMemo)(()=>({active:T,activeNode:I,activeNodeRect:ae,activatorEvent:k,collisions:we,containerNodeRect:oe,dragOverlay:le,draggableNodes:b,droppableContainers:S,droppableRects:ee,over:Ee,measureDroppableContainers:F,scrollableAncestors:he,scrollableAncestorRects:ge,measuringConfiguration:P,measuringScheduled:te,windowRect:me}),[T,I,ae,k,we,oe,le,b,S,ee,Ee,F,he,ge,P,te,me]),Ne=(0,t.useMemo)(()=>({activatorEvent:k,activators:je,active:T,activeNodeRect:ae,ariaDescribedById:{draggable:M},dispatch:p,draggableNodes:b,over:Ee,measureDroppableContainers:F}),[k,je,T,ae,p,M,b,Ee,F]);return t.default.createElement(sF.Provider,{value:h},t.default.createElement($I.Provider,{value:Ne},t.default.createElement(eL.Provider,{value:Me},t.default.createElement(sL.Provider,{value:Oe},o)),t.default.createElement(rL,{disabled:i?.restoreFocus===!1})),t.default.createElement(fF,{...i,hiddenTextDescribedById:M}));function Pe(){let e=D?.autoScrollEnabled===!1,t=typeof a==`object`?a.enabled===!1:a===!1,n=v&&!e&&!t;return typeof a==`object`?{...a,enabled:n}:{enabled:n}}}),uL=(0,t.createContext)(null),dL=`button`,fL=`Draggable`;function pL(e){let{id:n,data:r,disabled:i=!1,attributes:a}=e,o=KP(fL),{activators:s,activatorEvent:c,active:l,activeNodeRect:u,ariaDescribedById:d,draggableNodes:f,over:p}=(0,t.useContext)($I),{role:m=dL,roleDescription:h=`draggable`,tabIndex:g=0}=a??{},_=l?.id===n,v=(0,t.useContext)(_?sL:uL),[y,b]=UP(),[x,S]=UP(),C=VI(s,n),w=VP(r);return RP(()=>(f.set(n,{id:n,key:o,node:y,activatorNode:x,data:w}),()=>{let e=f.get(n);e&&e.key===o&&f.delete(n)}),[f,n]),{active:l,activatorEvent:c,activeNodeRect:u,attributes:(0,t.useMemo)(()=>({role:m,tabIndex:g,"aria-disabled":i,"aria-pressed":_&&m===dL?!0:void 0,"aria-roledescription":h,"aria-describedby":d.draggable}),[i,m,g,_,h,d.draggable]),isDragging:_,listeners:i?void 0:C,node:y,over:p,setNodeRef:b,setActivatorNodeRef:S,transform:v}}function mL(){return(0,t.useContext)(eL)}var hL=`Droppable`,gL={timeout:25};function _L(e){let{data:n,disabled:r=!1,id:i,resizeObserverConfig:a}=e,o=KP(hL),{active:s,dispatch:c,over:l,measureDroppableContainers:u}=(0,t.useContext)($I),d=(0,t.useRef)({disabled:r}),f=(0,t.useRef)(!1),p=(0,t.useRef)(null),m=(0,t.useRef)(null),{disabled:h,updateMeasurementsFor:g,timeout:_}={...gL,...a},v=VP(g??i),y=MI({callback:(0,t.useCallback)(()=>{if(!f.current){f.current=!0;return}m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{u(Array.isArray(v.current)?v.current:[v.current]),m.current=null},_)},[_]),disabled:h||!s}),[b,x]=UP((0,t.useCallback)((e,t)=>{y&&(t&&(y.unobserve(t),f.current=!1),e&&y.observe(e))},[y])),S=VP(n);return(0,t.useEffect)(()=>{!y||!b.current||(y.disconnect(),f.current=!1,y.observe(b.current))},[b,y]),(0,t.useEffect)(()=>(c({type:pF.RegisterDroppable,element:{id:i,key:o,disabled:r,node:b,rect:p,data:S}}),()=>c({type:pF.UnregisterDroppable,key:o,id:i})),[i]),(0,t.useEffect)(()=>{r!==d.current.disabled&&(c({type:pF.SetDroppableDisabled,id:i,key:o,disabled:r}),d.current.disabled=r)},[i,o,r,c]),{active:s,rect:p,isOver:l?.id===i,node:b,over:l,setNodeRef:x}}function vL(e){let{animation:n,children:r}=e,[i,a]=(0,t.useState)(null),[o,s]=(0,t.useState)(null),c=WP(r);return!r&&!i&&c&&a(c),RP(()=>{if(!o)return;let e=i?.key,t=i?.props.id;if(e==null||t==null){a(null);return}Promise.resolve(n(t,o)).then(()=>{a(null)})},[n,i,o]),t.default.createElement(t.default.Fragment,null,r,i?(0,t.cloneElement)(i,{ref:s}):null)}var yL={x:0,y:0,scaleX:1,scaleY:1};function bL(e){let{children:n}=e;return t.default.createElement($I.Provider,{value:QI},t.default.createElement(sL.Provider,{value:yL},n))}var xL={position:`fixed`,touchAction:`none`},SL=e=>ZP(e)?`transform 250ms ease`:void 0,CL=(0,t.forwardRef)((e,n)=>{let{as:r,activatorEvent:i,adjustScale:a,children:o,className:s,rect:c,style:l,transform:u,transition:d=SL}=e;if(!c)return null;let f=a?u:{...u,scaleX:1,scaleY:1},p={...xL,width:c.width,height:c.height,top:c.top,left:c.left,transform:eF.Transform.toString(f),transformOrigin:a&&i?vF(i,c):void 0,transition:typeof d==`function`?d(i):d,...l};return t.default.createElement(r,{className:s,style:p,ref:n},o)}),wL={duration:250,easing:`ease`,keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:eF.Transform.toString(t)},{transform:eF.Transform.toString(n)}]},sideEffects:(e=>t=>{let{active:n,dragOverlay:r}=t,i={},{styles:a,className:o}=e;if(a!=null&&a.active)for(let[e,t]of Object.entries(a.active))t!==void 0&&(i[e]=n.node.style.getPropertyValue(e),n.node.style.setProperty(e,t));if(a!=null&&a.dragOverlay)for(let[e,t]of Object.entries(a.dragOverlay))t!==void 0&&r.node.style.setProperty(e,t);return o!=null&&o.active&&n.node.classList.add(o.active),o!=null&&o.dragOverlay&&r.node.classList.add(o.dragOverlay),function(){for(let[e,t]of Object.entries(i))n.node.style.setProperty(e,t);o!=null&&o.active&&n.node.classList.remove(o.active)}})({styles:{active:{opacity:`0`}}})};function TL(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return zP((e,a)=>{if(t===null)return;let o=n.get(e);if(!o)return;let s=o.node.current;if(!s)return;let c=GI(a);if(!c)return;let{transform:l}=NP(a).getComputedStyle(a),u=DF(l);if(!u)return;let d=typeof t==`function`?t:EL(t);return XF(s,i.draggable.measure),d({active:{id:e,data:o.data,node:s,rect:i.draggable.measure(s)},draggableNodes:n,dragOverlay:{node:a,rect:i.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:i,transform:u})})}function EL(e){let{duration:t,easing:n,sideEffects:r,keyframes:i}={...wL,...e};return e=>{let{active:a,dragOverlay:o,transform:s,...c}=e;if(!t)return;let l={x:o.rect.left-a.rect.left,y:o.rect.top-a.rect.top},u={scaleX:s.scaleX===1?1:a.rect.width*s.scaleX/o.rect.width,scaleY:s.scaleY===1?1:a.rect.height*s.scaleY/o.rect.height},d={x:s.x-l.x,y:s.y-l.y,...u},f=i({...c,active:a,dragOverlay:o,transform:{initial:s,final:d}}),[p]=f,m=f[f.length-1];if(JSON.stringify(p)===JSON.stringify(m))return;let h=r?.({active:a,dragOverlay:o,...c}),g=o.node.animate(f,{duration:t,easing:n,fill:`forwards`});return new Promise(e=>{g.onfinish=()=>{h?.(),e()}})}}var DL=0;function OL(e){return(0,t.useMemo)(()=>{if(e!=null)return DL++,DL},[e])}var kL=t.default.memo(e=>{let{adjustScale:n=!1,children:r,dropAnimation:i,style:a,transition:o,modifiers:s,wrapperElement:c=`div`,className:l,zIndex:u=999}=e,{activatorEvent:d,active:f,activeNodeRect:p,containerNodeRect:m,draggableNodes:h,droppableContainers:g,dragOverlay:_,over:v,measuringConfiguration:y,scrollableAncestors:b,scrollableAncestorRects:x,windowRect:S}=mL(),C=(0,t.useContext)(sL),w=OL(f?.id),T=iL(s,{activatorEvent:d,active:f,activeNodeRect:p,containerNodeRect:m,draggingNodeRect:_.rect,over:v,overlayNodeRect:_.rect,scrollableAncestors:b,scrollableAncestorRects:x,transform:C,windowRect:S}),E=kI(p),D=TL({config:i,draggableNodes:h,droppableContainers:g,measuringConfiguration:y}),O=E?_.setRef:void 0;return t.default.createElement(bL,null,t.default.createElement(vL,{animation:D},f&&w?t.default.createElement(CL,{key:w,id:f.id,ref:O,as:c,activatorEvent:d,adjustScale:n,className:l,transition:o,rect:E,style:{zIndex:u,...a},transform:T},r):null))});function AL(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function jL(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function ML(e){return e!==null&&e>=0}function NL(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function PL(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var FL=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=AL(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},IL={scaleX:1,scaleY:1},LL=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...IL}:null}let s=RL(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...IL}:r<t&&r>=a?{x:0,y:o.height+s,...IL}:{x:0,y:0,...IL}};function RL(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var zL=`Sortable`,BL=t.default.createContext({activeIndex:-1,containerId:zL,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:FL,disabled:{draggable:!1,droppable:!1}});function VL(e){let{children:n,id:r,items:i,strategy:a=FL,disabled:o=!1}=e,{active:s,dragOverlay:c,droppableRects:l,over:u,measureDroppableContainers:d}=mL(),f=KP(zL,r),p=c.rect!==null,m=(0,t.useMemo)(()=>i.map(e=>typeof e==`object`&&`id`in e?e.id:e),[i]),h=s!=null,g=s?m.indexOf(s.id):-1,_=u?m.indexOf(u.id):-1,v=(0,t.useRef)(m),y=!NL(m,v.current),b=_!==-1&&g===-1||y,x=PL(o);RP(()=>{y&&h&&d(m)},[y,m,h,d]),(0,t.useEffect)(()=>{v.current=m},[m]);let S=(0,t.useMemo)(()=>({activeIndex:g,containerId:f,disabled:x,disableTransforms:b,items:m,overIndex:_,useDragOverlay:p,sortedRects:jL(m,l),strategy:a}),[g,f,x.draggable,x.droppable,b,m,_,l,p,a]);return t.default.createElement(BL.Provider,{value:S},n)}var HL=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return AL(n,r,i).indexOf(t)},UL=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},WL={duration:200,easing:`ease`},GL=`transform`,KL=eF.Transition.toString({property:GL,duration:0,easing:`linear`}),qL={roleDescription:`sortable`};function JL(e){let{disabled:n,index:r,node:i,rect:a}=e,[o,s]=(0,t.useState)(null),c=(0,t.useRef)(r);return RP(()=>{if(!n&&r!==c.current&&i.current){let e=a.current;if(e){let t=AF(i.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&s(n)}}r!==c.current&&(c.current=r)},[n,r,i,a]),(0,t.useEffect)(()=>{o&&s(null)},[o]),o}function YL(e){let{animateLayoutChanges:n=UL,attributes:r,disabled:i,data:a,getNewIndex:o=HL,id:s,strategy:c,resizeObserverConfig:l,transition:u=WL}=e,{items:d,containerId:f,activeIndex:p,disabled:m,disableTransforms:h,sortedRects:g,overIndex:_,useDragOverlay:v,strategy:y}=(0,t.useContext)(BL),b=XL(i,m),x=d.indexOf(s),S=(0,t.useMemo)(()=>({sortable:{containerId:f,index:x,items:d},...a}),[f,a,x,d]),C=(0,t.useMemo)(()=>d.slice(d.indexOf(s)),[d,s]),{rect:w,node:T,isOver:E,setNodeRef:D}=_L({id:s,data:S,disabled:b.droppable,resizeObserverConfig:{updateMeasurementsFor:C,...l}}),{active:O,activatorEvent:k,activeNodeRect:A,attributes:j,setNodeRef:M,listeners:N,isDragging:P,over:ee,setActivatorNodeRef:F,transform:te}=pL({id:s,data:S,attributes:{...qL,...r},disabled:b.draggable}),I=kP(D,M),ne=!!O,re=ne&&!h&&ML(p)&&ML(_),ie=!v&&P,ae=re?(ie&&re?te:null)??(c??y)({rects:g,activeNodeRect:A,activeIndex:p,overIndex:_,index:x}):null,oe=ML(p)&&ML(_)?o({id:s,items:d,activeIndex:p,overIndex:_}):x,se=O?.id,ce=(0,t.useRef)({activeId:se,items:d,newIndex:oe,containerId:f}),le=d!==ce.current.items,ue=n({active:O,containerId:f,isDragging:P,isSorting:ne,id:s,index:x,items:d,newIndex:ce.current.newIndex,previousItems:ce.current.items,previousContainerId:ce.current.containerId,transition:u,wasDragging:ce.current.activeId!=null}),de=JL({disabled:!ue,index:x,node:T,rect:w});return(0,t.useEffect)(()=>{ne&&ce.current.newIndex!==oe&&(ce.current.newIndex=oe),f!==ce.current.containerId&&(ce.current.containerId=f),d!==ce.current.items&&(ce.current.items=d)},[ne,oe,f,d]),(0,t.useEffect)(()=>{if(se===ce.current.activeId)return;if(se!=null&&ce.current.activeId==null){ce.current.activeId=se;return}let e=setTimeout(()=>{ce.current.activeId=se},50);return()=>clearTimeout(e)},[se]),{active:O,activeIndex:p,attributes:j,data:S,rect:w,index:x,newIndex:oe,items:d,isOver:E,isSorting:ne,isDragging:P,listeners:N,node:T,overIndex:_,over:ee,setNodeRef:I,setActivatorNodeRef:F,setDroppableNodeRef:D,setDraggableNodeRef:M,transform:de??ae,transition:fe()};function fe(){if(de||le&&ce.current.newIndex===x)return KL;if(!(ie&&!ZP(k)||!u)&&(ne||ue))return eF.Transition.toString({...u,property:GL})}}function XL(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}$.Down,$.Right,$.Up,$.Left;var ZL={text:`Texto`,image:`Imagem`,box:`Grupo / Cartão`,"text-container":`Texto em Caixa`,group:`Grupo`,checkbox:`Caixa de Seleção`},QL=({element:e,isSelected:t,onSelect:n,onToggleLock:i,onToggleHide:a})=>{let{attributes:o,listeners:s,setNodeRef:c,transform:l,transition:u,isDragging:d}=YL({id:e.id});return(0,r.jsx)(U,{ref:c,style:{transform:eF.Transform.toString(l),transition:u,opacity:d?.5:1,touchAction:`none`},children:(0,r.jsxs)(W,{align:`center`,style:{padding:`8px 12px`,backgroundColor:t?`var(--accent-a3)`:`var(--gray-2)`,borderRadius:6,cursor:`pointer`,marginBottom:4,border:t?`1px solid var(--accent-9)`:`1px solid transparent`},onClick:e=>n(e.shiftKey),children:[(0,r.jsx)(U,{...o,...s,style:{cursor:`grab`,color:`var(--gray-8)`,marginRight:8},children:(0,r.jsx)(Re,{})}),(0,r.jsxs)(U,{style:{color:`var(--gray-10)`,marginRight:8},children:[e.type===`text`&&(0,r.jsx)(Rt,{}),e.type===`image`&&(0,r.jsx)(Xe,{}),(e.type===`box`||e.type===`group`)&&(0,r.jsx)(ue,{})]}),(0,r.jsx)(H,{size:`2`,weight:t?`bold`:`regular`,style:{flex:1},truncate:!0,children:e.name||ZL[e.type]||e.type}),(0,r.jsxs)(W,{gap:`1`,onClick:e=>e.stopPropagation(),children:[(0,r.jsx)(J,{size:`1`,variant:`ghost`,color:e.locked?`orange`:`gray`,onClick:i,title:e.locked?`Desbloquear`:`Bloquear`,children:e.locked?(0,r.jsx)(et,{}):(0,r.jsx)(nt,{})}),(0,r.jsx)(J,{size:`1`,variant:`ghost`,color:e.hidden?`red`:`gray`,onClick:a,title:e.hidden?`Mostrar`:`Ocultar`,children:e.hidden?(0,r.jsx)(Be,{}):(0,r.jsx)(He,{})})]})]})})};let $L=()=>{let{state:e,selectElement:n,moveElement:i,updateElement:a}=rS(),{elements:o,selectedElementIds:s}=e,c=(0,t.useMemo)(()=>[...o].reverse(),[o]),[l,u]=(0,t.useState)(null),d=gF(hF(fI,{activationConstraint:{distance:5}}));return(0,r.jsx)(U,{children:(0,r.jsxs)(lL,{sensors:d,onDragStart:e=>{u(e.active.id)},onDragEnd:e=>{let{active:t,over:n}=e;if(u(null),n&&t.id!==n.id){let e=c.findIndex(e=>e.id===t.id),r=c.findIndex(e=>e.id===n.id);i(o.length-1-e,o.length-1-r)}},children:[(0,r.jsx)(VL,{items:c.map(e=>e.id),strategy:LL,children:(0,r.jsxs)(W,{direction:`column`,children:[c.map(e=>(0,r.jsx)(QL,{element:e,isSelected:s.includes(e.id),onSelect:t=>n(e.id,t),onToggleLock:()=>a(e.id,{locked:!e.locked}),onToggleHide:()=>a(e.id,{hidden:!e.hidden})},e.id)),c.length===0&&(0,r.jsx)(H,{size:`2`,color:`gray`,align:`center`,style:{padding:20},children:`Adicione itens para ver a lista aqui.`})]})}),(0,r.jsx)(kL,{children:l?(0,r.jsx)(U,{style:{padding:`8px 12px`,backgroundColor:`var(--gray-4)`,borderRadius:6,boxShadow:`0 4px 12px rgba(0,0,0,0.1)`},children:(0,r.jsx)(H,{children:`Movendo...`})}):null})]})})},eR=()=>{let{state:e,updateElement:n,removeSelected:i,copy:a}=rS(),[o,s]=(0,t.useState)(!1),c=e.selectedElementIds[0],l=e.elements.find(e=>e.id===c);if(!l)return null;let u=e=>{n(l.id,e)},d=e=>{u({style:{...l.style,...e}})},f=l.style?.textAlign||`left`,p=parseInt(l.style?.fontSize||`14`,10),m=parseInt(l.style?.borderWidth||`0`,10),h=parseInt(l.style?.padding||`0`,10),g=parseInt(l.style?.borderRadius||`0`,10),_=Math.round((parseFloat(String(l.style?.opacity??`1`))||1)*100),v=l.style?.fontFamily||`Arial`,y=kS(l.style?.fontWeight,DS),b=AS(v,e.availableFonts||[`Arial`,`Helvetica`,`Times New Roman`,`Courier New`,`Verdana`,`Georgia`,`Tahoma`,`Trebuchet MS`]);return(0,r.jsxs)(W,{direction:`column`,gap:`4`,children:[(0,r.jsxs)(W,{justify:`between`,align:`center`,children:[(0,r.jsx)(H,{size:`3`,weight:`bold`,children:tR(l.type)}),(0,r.jsxs)(W,{gap:`2`,children:[(0,r.jsx)(J,{variant:`soft`,color:l.locked?`orange`:`gray`,onClick:()=>u({locked:!l.locked}),title:l.locked?`Desbloquear`:`Bloquear`,children:l.locked?(0,r.jsx)(et,{}):(0,r.jsx)(nt,{})}),(0,r.jsx)(J,{variant:`soft`,color:l.hidden?`blue`:`gray`,onClick:()=>u({hidden:!l.hidden}),title:l.hidden?`Mostrar`:`Ocultar`,children:l.hidden?(0,r.jsx)(Be,{}):(0,r.jsx)(He,{})}),(0,r.jsx)(Qy,{orientation:`vertical`}),(0,r.jsx)(J,{variant:`soft`,color:`gray`,onClick:a,title:`Copiar`,children:(0,r.jsx)(we,{})}),(0,r.jsx)(J,{variant:`soft`,color:`red`,onClick:i,title:`Excluir`,children:(0,r.jsx)(Xt,{})})]})]}),(0,r.jsx)(Qy,{size:`4`}),(l.type===`text`||l.type===`text-container`)&&(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`2`,weight:`bold`,mb:`2`,as:`div`,children:`Conteúdo`}),(0,r.jsx)(pb,{value:l.content,onChange:e=>u({content:e.target.value}),rows:3,placeholder:`Digite o texto aqui...`})]}),l.type===`image`&&(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`2`,weight:`bold`,mb:`2`,as:`div`,children:`Imagem URL`}),(0,r.jsx)(X,{value:l.content,onChange:e=>u({content:e.target.value}),placeholder:`https://...`})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`2`,weight:`bold`,mb:`2`,as:`div`,children:`Aparência`}),(0,r.jsxs)(W,{direction:`column`,gap:`3`,children:[(l.type===`text`||l.type===`text-container`)&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(K,{columns:`2`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Fonte`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[(0,r.jsx)(`span`,{style:{fontFamily:v},children:v}),(0,r.jsx)(ve,{})]})}),(0,r.jsx)(fy,{style:{zIndex:1e5},children:b.map(e=>(0,r.jsx)(q,{onSelect:()=>d({fontFamily:e}),style:{fontFamily:e},children:e},e))})]})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Peso`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[y===`normal`?`Normal`:y===`bold`?`Negrito`:y===`100`?`Fina`:y===`300`?`Leve`:`Pesada`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>d({fontWeight:`normal`}),children:`Normal`}),(0,r.jsx)(q,{onSelect:()=>{d({fontWeight:`bold`})},children:`Negrito`}),(0,r.jsx)(q,{onSelect:()=>{d({fontWeight:`100`})},children:`Fina`}),(0,r.jsx)(q,{onSelect:()=>{d({fontWeight:`300`})},children:`Leve`}),(0,r.jsx)(q,{onSelect:()=>{d({fontWeight:`900`})},children:`Pesada`})]})]})]})]}),(0,r.jsxs)(U,{children:[(0,r.jsxs)(W,{justify:`between`,mb:`1`,children:[(0,r.jsx)(H,{size:`1`,color:`gray`,children:`Tamanho do Texto`}),(0,r.jsxs)(H,{size:`1`,children:[p,`px`]})]}),(0,r.jsx)(tb,{min:8,max:72,value:[p],onValueChange:e=>d({fontSize:`${e[0]}px`})})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Alinhamento`}),(0,r.jsxs)(W,{gap:`2`,children:[(0,r.jsx)(J,{variant:f===`left`?`solid`:`soft`,color:`gray`,onClick:()=>d({textAlign:`left`}),children:(0,r.jsx)(Wt,{})}),(0,r.jsx)(J,{variant:f===`center`?`solid`:`soft`,color:`gray`,onClick:()=>d({textAlign:`center`}),children:(0,r.jsx)(Bt,{})}),(0,r.jsx)(J,{variant:f===`right`?`solid`:`soft`,color:`gray`,onClick:()=>d({textAlign:`right`}),children:(0,r.jsx)(Kt,{})})]})]}),(0,r.jsxs)(K,{columns:`2`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Estilo`}),(0,r.jsxs)(W,{gap:`1`,children:[(0,r.jsx)(J,{variant:l.style?.fontStyle===`italic`?`solid`:`soft`,color:`gray`,onClick:e=>{e.stopPropagation(),d({fontStyle:l.style?.fontStyle===`italic`?`normal`:`italic`})},title:`Itálico`,children:(0,r.jsx)(Ke,{})}),(0,r.jsx)(J,{variant:l.style?.textDecoration===`underline`?`solid`:`soft`,color:`gray`,onClick:e=>{e.stopPropagation(),d({textDecoration:l.style?.textDecoration===`underline`?`none`:`underline`})},title:`Sublinhado`,children:(0,r.jsx)(Qt,{})}),(0,r.jsx)(J,{variant:l.style?.textDecoration===`line-through`?`solid`:`soft`,color:`gray`,onClick:e=>{e.stopPropagation(),d({textDecoration:l.style?.textDecoration===`line-through`?`none`:`line-through`})},title:`Tachado`,children:(0,r.jsx)(Pt,{})})]})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Transformação`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[(l.style?.textTransform||`none`)===`none`?`Nenhum`:l.style?.textTransform===`uppercase`?`MAIÚSCULA`:l.style?.textTransform===`lowercase`?`minúscula`:`Capitalizada`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>d({textTransform:`none`}),children:`Nenhum`}),(0,r.jsx)(q,{onSelect:()=>d({textTransform:`uppercase`}),children:`MAIÚSCULA`}),(0,r.jsx)(q,{onSelect:()=>d({textTransform:`lowercase`}),children:`minúscula`}),(0,r.jsx)(q,{onSelect:()=>d({textTransform:`capitalize`}),children:`Capitalizada`})]})]})]})]}),(0,r.jsxs)(K,{columns:`2`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Altura da Linha`}),(0,r.jsx)(X,{placeholder:`Normal`,value:l.style?.lineHeight||``,onChange:e=>d({lineHeight:e.target.value||`normal`})})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Espaçamento`}),(0,r.jsx)(X,{placeholder:`Normal`,value:l.style?.letterSpacing||``,onChange:e=>d({letterSpacing:e.target.value||`normal`})})]})]}),l.type===`text-container`&&(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Alinhamento Vertical`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[(l.style?.alignItems||`flex-start`)===`flex-start`?`Topo`:l.style?.alignItems===`center`?`Centro`:`Base`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>d({alignItems:`flex-start`}),children:`Topo`}),(0,r.jsx)(q,{onSelect:()=>d({alignItems:`center`}),children:`Centro`}),(0,r.jsx)(q,{onSelect:()=>d({alignItems:`flex-end`}),children:`Base`})]})]})]})]}),l.type===`image`&&(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Ajuste da Imagem`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[(l.style?.objectFit||`cover`)===`cover`?`Cobrir (Cover)`:l.style?.objectFit===`contain`?`Conter (Contain)`:`Esticar (Fill)`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>d({objectFit:`cover`}),children:`Cobrir (Cover)`}),(0,r.jsx)(q,{onSelect:()=>d({objectFit:`contain`}),children:`Conter (Contain)`}),(0,r.jsx)(q,{onSelect:()=>d({objectFit:`fill`}),children:`Esticar (Fill)`})]})]})]}),(0,r.jsxs)(K,{columns:`2`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Cor de Fundo`}),(0,r.jsx)(tP,{color:l.style?.backgroundColor||`transparent`,onChange:e=>d({backgroundColor:e})})]}),(l.type===`text`||l.type===`text-container`)&&(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Cor do Texto`}),(0,r.jsx)(tP,{color:l.style?.color||`#000000`,onChange:e=>d({color:e})})]})]}),(0,r.jsxs)(U,{children:[(0,r.jsxs)(W,{justify:`between`,mb:`1`,children:[(0,r.jsx)(H,{size:`1`,color:`gray`,children:`Borda (Espessura)`}),(0,r.jsxs)(H,{size:`1`,children:[m,`px`]})]}),(0,r.jsx)(tb,{min:0,max:10,value:[m],onValueChange:e=>d({borderWidth:`${e[0]}px`,borderStyle:e[0]>0?`solid`:`none`,borderColor:l.style?.borderColor||`#000000`})})]}),m>0&&(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Cor da Borda`}),(0,r.jsx)(tP,{color:l.style?.borderColor||`#000000`,onChange:e=>d({borderColor:e})})]}),(0,r.jsxs)(U,{children:[(0,r.jsxs)(W,{justify:`between`,mb:`1`,children:[(0,r.jsx)(H,{size:`1`,color:`gray`,children:`Cantos Arredondados`}),(0,r.jsxs)(H,{size:`1`,children:[g,`px`]})]}),(0,r.jsx)(tb,{min:0,max:50,value:[g],onValueChange:e=>d({borderRadius:`${e[0]}px`})})]}),(0,r.jsxs)(U,{children:[(0,r.jsxs)(W,{justify:`between`,mb:`1`,children:[(0,r.jsx)(H,{size:`1`,color:`gray`,children:`Opacidade`}),(0,r.jsxs)(H,{size:`1`,children:[_,`%`]})]}),(0,r.jsx)(tb,{min:0,max:100,value:[_],onValueChange:e=>d({opacity:e[0]/100})})]}),(0,r.jsxs)(U,{children:[(0,r.jsxs)(W,{justify:`between`,mb:`1`,children:[(0,r.jsx)(H,{size:`1`,color:`gray`,children:`Espaçamento Interno (Padding)`}),(0,r.jsxs)(H,{size:`1`,children:[h,`px`]})]}),(0,r.jsx)(tb,{min:0,max:40,value:[h],onValueChange:e=>d({padding:`${e[0]}px`})})]})]})]}),(0,r.jsxs)(U,{mt:`2`,pt:`2`,style:{borderTop:`1px solid var(--gray-5)`},children:[(0,r.jsxs)(G,{variant:`ghost`,onClick:()=>s(!o),style:{width:`100%`,justifyContent:`space-between`,color:`var(--gray-11)`,cursor:`pointer`},children:[(0,r.jsx)(W,{align:`center`,gap:`2`,children:(0,r.jsx)(H,{size:`2`,children:`Mais opções`})}),o?(0,r.jsx)(ve,{}):(0,r.jsx)(be,{})]}),o&&(0,r.jsx)(U,{mt:`3`,className:`advanced-properties-content`,children:(0,r.jsx)(nP,{elementId:l.id})})]})]},c)};var tR=e=>{switch(e){case`text`:return`Texto`;case`image`:return`Imagem`;case`box`:return`Caixa / Grupo`;case`text-container`:return`Texto em Caixa`;default:return`Elemento`}};let nR=({onClose:e})=>{let{state:t,addElement:n,groupElements:i}=rS(),a=t.selectedElementIds.length>0,o=t=>{let r={id:`el-${new Date().toISOString()}`,x:20,y:20,width:150,height:40,style:{}};switch(t){case`text`:n({...r,type:`text`,content:`Novo Texto`,width:120,height:30});break;case`image`:n({...r,type:`image`,content:`https://via.placeholder.com/150`,width:150,height:150});break;case`box`:n({...r,type:`box`,content:``,width:200,height:100,style:{border:`1px solid #ccc`}});break;case`text-container`:n({...r,type:`text-container`,content:`Texto em Caixa`,width:150,height:50,style:{backgroundColor:`#f0f0f0`,padding:`10px`}});break;case`separator`:n({...r,type:`box`,content:``,width:300,height:2,style:{backgroundColor:`#000000`}});break;case`timestamp`:n({...r,type:`text`,content:`{{timestamp}}`,width:150,height:30,formatting:{type:`date`,dateFormat:`dd/MM/yyyy HH:mm`}});break;case`badge`:n({...r,type:`text-container`,content:`Badge`,width:80,height:30,style:{backgroundColor:`#007bff`,color:`white`,borderRadius:`15px`,textAlign:`center`,lineHeight:`30px`}});break;case`list-item`:let e=crypto.randomUUID(),t=crypto.randomUUID(),a=crypto.randomUUID(),o=crypto.randomUUID();n({id:e,type:`box`,x:20,y:20,width:300,height:120,style:{backgroundColor:`#ffffff`,border:`1px solid #e0e0e0`,borderRadius:`8px`,boxShadow:`0 2px 4px rgba(0,0,0,0.05)`}}),n({id:t,type:`image`,content:`https://via.placeholder.com/80`,x:35,y:35,width:80,height:80,style:{borderRadius:`4px`}}),n({id:a,type:`text`,content:`Título do Item`,x:130,y:35,width:170,height:24,style:{fontSize:`18px`,fontWeight:`bold`,color:`#333`}}),n({id:o,type:`text`,content:`Descrição curta do item. Adicione detalhes aqui.`,x:130,y:65,width:170,height:40,style:{fontSize:`14px`,color:`#666`}}),setTimeout(()=>{i([e,t,a,o])},100);break}e&&e()};return(0,r.jsxs)(W,{direction:`column`,style:{height:`100%`},children:[(0,r.jsx)(U,{p:`4`,style:{borderBottom:`1px solid var(--gray-5)`,minHeight:`180px`,flexShrink:0,maxHeight:`calc(100vh - 150px)`,overflowY:`auto`},children:a?(0,r.jsx)(eR,{}):(0,r.jsxs)(W,{direction:`column`,align:`center`,justify:`center`,style:{height:`100%`,minHeight:`100px`},gap:`3`,children:[(0,r.jsxs)(H,{size:`2`,color:`gray`,align:`center`,children:[`Selecione um item no desenho`,(0,r.jsx)(`br`,{}),`para editar suas propriedades`]}),(0,r.jsx)(z_,{color:`blue`,variant:`soft`,children:`Dica: Clique no desenho`})]})}),(0,r.jsxs)(sb,{defaultValue:`blocks`,style:{display:`flex`,flexDirection:`column`,flex:1,overflow:`hidden`},children:[(0,r.jsx)(U,{px:`4`,pt:`4`,style:{flexShrink:0},children:(0,r.jsxs)(cb,{children:[(0,r.jsx)(lb,{value:`blocks`,children:`Blocos`}),(0,r.jsx)(lb,{value:`layers`,children:`Conteúdo`}),(0,r.jsx)(lb,{value:`history`,children:`Histórico`})]})}),(0,r.jsx)(Xv,{type:`auto`,scrollbars:`vertical`,style:{flex:1},children:(0,r.jsxs)(U,{p:`4`,children:[(0,r.jsxs)(ub,{value:`blocks`,children:[(0,r.jsx)(H,{size:`2`,weight:`bold`,mb:`2`,as:`div`,children:`Adicionar Elemento`}),(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`3`,as:`div`,children:`Clique para adicionar ao desenho`}),(0,r.jsxs)(K,{columns:`2`,gap:`2`,children:[(0,r.jsx)(rR,{icon:(0,r.jsx)(We,{width:`20`,height:`20`}),label:`Texto`,onClick:()=>o(`text`)}),(0,r.jsx)(rR,{icon:(0,r.jsx)(Xe,{width:`20`,height:`20`}),label:`Imagem`,onClick:()=>o(`image`)}),(0,r.jsx)(rR,{icon:(0,r.jsx)(Ot,{width:`20`,height:`20`}),label:`Caixa / Grupo`,onClick:()=>o(`box`)}),(0,r.jsx)(rR,{icon:(0,r.jsx)(nn,{width:`20`,height:`20`}),label:`Texto em Caixa`,onClick:()=>o(`text-container`)}),(0,r.jsx)(rR,{icon:(0,r.jsx)(Ae,{width:`20`,height:`20`}),label:`Separador`,onClick:()=>o(`separator`)}),(0,r.jsx)(rR,{icon:(0,r.jsx)(Jt,{width:`20`,height:`20`}),label:`Data/Hora`,onClick:()=>o(`timestamp`)}),(0,r.jsx)(rR,{icon:(0,r.jsx)(At,{width:`20`,height:`20`}),label:`Badge / Etiqueta`,onClick:()=>o(`badge`)})]}),(0,r.jsx)(U,{mt:`4`,children:(0,r.jsx)(DP,{})})]}),(0,r.jsx)(ub,{value:`layers`,children:(0,r.jsx)($L,{})}),(0,r.jsx)(ub,{value:`history`,children:(0,r.jsx)(OP,{onClose:e})})]})})]})]})};var rR=({icon:e,label:t,onClick:n})=>(0,r.jsx)(Ev,{style:{cursor:`pointer`,transition:`all 0.2s`},onClick:n,children:(0,r.jsxs)(W,{direction:`column`,align:`center`,gap:`2`,p:`2`,children:[(0,r.jsx)(U,{style:{color:`var(--accent-9)`},children:e}),(0,r.jsx)(H,{size:`1`,weight:`medium`,align:`center`,children:t})]})});let iR=()=>{let{state:e,setZoom:t,setPan:n}=rS(),{zoom:i,elements:a}=e;return(0,r.jsxs)(W,{align:`center`,gap:`2`,style:{backgroundColor:`var(--color-panel-solid)`,padding:`4px 8px`,borderRadius:`8px`,boxShadow:`0 2px 10px rgba(0,0,0,0.1)`,border:`1px solid var(--gray-6)`},children:[(0,r.jsx)(bb,{content:`Diminuir Zoom (-)`,children:(0,r.jsx)(J,{size:`1`,variant:`ghost`,color:`gray`,onClick:()=>t(Math.max(.1,i-.1)),children:(0,r.jsx)(ct,{})})}),(0,r.jsxs)(H,{size:`1`,style:{width:40,textAlign:`center`,fontVariantNumeric:`tabular-nums`},children:[Math.round(i*100),`%`]}),(0,r.jsx)(bb,{content:`Aumentar Zoom (+)`,children:(0,r.jsx)(J,{size:`1`,variant:`ghost`,color:`gray`,onClick:()=>t(Math.min(5,i+.1)),children:(0,r.jsx)(mt,{})})}),(0,r.jsx)(Qy,{orientation:`vertical`,style:{height:16}}),(0,r.jsx)(bb,{content:`Resetar (100%)`,children:(0,r.jsx)(J,{size:`1`,variant:`ghost`,color:`gray`,onClick:()=>t(1),children:(0,r.jsx)(St,{})})}),(0,r.jsx)(bb,{content:`Ajustar à Tela`,children:(0,r.jsx)(J,{size:`1`,variant:`ghost`,color:`gray`,onClick:()=>{if(a.length===0)return;let e=1/0,r=1/0,i=-1/0,o=-1/0;a.forEach(t=>{e=Math.min(e,t.x),r=Math.min(r,t.y),i=Math.max(i,t.x+t.width),o=Math.max(o,t.y+t.height)});let s=i-e+100,c=o-r+100,l=window.innerWidth<768?0:300,u=window.innerWidth-l,d=window.innerHeight-100,f=u/s,p=d/c,m=Math.min(f,p);m=Math.min(Math.max(m,.1),5),t(m);let h=(e+i)/2,g=(r+o)/2,_=u/2,v=d/2;n({x:_-h*m,y:v-g*m})},children:(0,r.jsx)(N,{})})})]})},aR=({isOpen:e,onClose:n,templates:i,onSelectTemplate:a,initialStep:o=1,onFinishWizard:s,onStartTour:c})=>{let[l,u]=(0,t.useState)(o),[d,f]=(0,t.useState)(null);t.default.useEffect(()=>{e&&o&&u(o)},[e,o]);let p=()=>{l===1&&d?(a(i.find(e=>e.id===d)||null),u(2)):l===2?(n(),c&&c()):l===3&&(s&&s(),n())};return(0,r.jsx)(ny,{open:e,onOpenChange:n,children:(0,r.jsx)(iy,{style:{maxWidth:800},children:(0,r.jsxs)(W,{direction:`column`,gap:`4`,children:[(0,r.jsxs)(W,{justify:`between`,align:`center`,children:[(0,r.jsx)(ay,{children:(0,r.jsxs)(W,{align:`center`,gap:`2`,children:[(0,r.jsx)(it,{}),` Assistente de Criação`]})}),(0,r.jsx)(W,{gap:`2`,children:(0,r.jsx)(oR,{current:l,total:3})})]}),(0,r.jsxs)(U,{children:[l===1&&(0,r.jsxs)(W,{direction:`column`,gap:`4`,children:[(0,r.jsx)(m_,{size:`4`,children:`Passo 1: Escolha um Modelo (Template)`}),(0,r.jsx)(H,{color:`gray`,size:`2`,children:`Comece com um layout pronto e personalize conforme sua necessidade.`}),(0,r.jsxs)(K,{columns:`3`,gap:`3`,children:[i.map(e=>(0,r.jsx)(Ev,{variant:d===e.id?`surface`:`classic`,style:{cursor:`pointer`,border:d===e.id?`2px solid var(--accent-9)`:void 0,backgroundColor:d===e.id?`var(--accent-2)`:void 0},onClick:()=>f(e.id),children:(0,r.jsxs)(W,{direction:`column`,gap:`2`,align:`center`,p:`2`,children:[(0,r.jsx)(U,{style:{width:`100%`,height:100,backgroundColor:`var(--gray-3)`,borderRadius:4,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,r.jsx)(We,{width:32,height:32,color:`var(--gray-8)`})}),(0,r.jsx)(H,{weight:`bold`,size:`2`,children:e.name}),(0,r.jsx)(H,{size:`1`,color:`gray`,align:`center`,children:e.description})]})},e.id)),(0,r.jsx)(Ev,{variant:d===`blank`?`surface`:`classic`,style:{cursor:`pointer`,border:d===`blank`?`2px solid var(--accent-9)`:void 0,backgroundColor:d===`blank`?`var(--accent-2)`:void 0},onClick:()=>f(`blank`),children:(0,r.jsxs)(W,{direction:`column`,gap:`2`,align:`center`,p:`2`,children:[(0,r.jsx)(U,{style:{width:`100%`,height:100,backgroundColor:`var(--gray-3)`,borderRadius:4,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,r.jsx)(U,{style:{width:40,height:40,border:`2px dashed var(--gray-8)`,borderRadius:4}})}),(0,r.jsx)(H,{weight:`bold`,size:`2`,children:`Começar do Zero`}),(0,r.jsx)(H,{size:`1`,color:`gray`,align:`center`,children:`Tela em branco`})]})})]}),(0,r.jsxs)(W,{gap:`3`,mt:`4`,justify:`end`,children:[(0,r.jsx)(G,{variant:`soft`,color:`gray`,onClick:n,children:`Pular Assistente`}),(0,r.jsxs)(G,{onClick:p,disabled:!d,children:[`Continuar `,(0,r.jsx)(j,{})]})]})]}),l===2&&(0,r.jsxs)(W,{direction:`column`,gap:`4`,children:[(0,r.jsx)(m_,{size:`4`,children:`Passo 2: Personalizar Visual`}),(0,r.jsx)(H,{color:`gray`,size:`2`,children:`Agora é sua vez de ajustar o layout. Use as ferramentas disponíveis.`}),(0,r.jsxs)(K,{columns:`2`,gap:`4`,children:[(0,r.jsx)(Ev,{variant:`surface`,children:(0,r.jsxs)(W,{gap:`3`,align:`start`,children:[(0,r.jsx)(U,{style:{padding:8,backgroundColor:`var(--accent-3)`,borderRadius:4},children:(0,r.jsx)(We,{width:20,height:20,color:`var(--accent-9)`})}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{weight:`bold`,size:`2`,as:`div`,children:`Edite Conteúdo`}),(0,r.jsx)(H,{size:`1`,color:`gray`,children:`Clique duas vezes em qualquer texto ou imagem para editar suas propriedades.`})]})]})}),(0,r.jsx)(Ev,{variant:`surface`,children:(0,r.jsxs)(W,{gap:`3`,align:`start`,children:[(0,r.jsx)(U,{style:{padding:8,backgroundColor:`var(--green-3)`,borderRadius:4},children:(0,r.jsx)(it,{width:20,height:20,color:`var(--green-9)`})}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{weight:`bold`,size:`2`,as:`div`,children:`Adicione Blocos`}),(0,r.jsx)(H,{size:`1`,color:`gray`,children:`Use a barra lateral esquerda para arrastar novos elementos.`})]})]})})]}),(0,r.jsxs)(W,{gap:`3`,mt:`4`,justify:`end`,children:[(0,r.jsxs)(G,{variant:`soft`,color:`gray`,onClick:()=>u(1),children:[(0,r.jsx)(j,{style:{transform:`rotate(180deg)`}}),` Voltar`]}),(0,r.jsxs)(G,{onClick:p,children:[`Começar a Editar `,(0,r.jsx)(j,{})]})]})]}),l===3&&(0,r.jsxs)(W,{direction:`column`,gap:`4`,children:[(0,r.jsx)(m_,{size:`4`,children:`Passo 3: Testar e Exportar`}),(0,r.jsx)(H,{color:`gray`,size:`2`,children:`Seu layout está pronto? Teste com dados diferentes e exporte o resultado.`}),(0,r.jsx)(Ev,{variant:`surface`,style:{padding:20},children:(0,r.jsxs)(W,{direction:`column`,gap:`3`,align:`center`,children:[(0,r.jsx)(ge,{width:48,height:48,color:`var(--green-9)`}),(0,r.jsx)(m_,{size:`3`,children:`Tudo pronto!`}),(0,r.jsx)(H,{align:`center`,children:`Você completou a criação do layout. Agora você pode salvar, exportar ou continuar editando.`})]})}),(0,r.jsxs)(W,{gap:`3`,mt:`4`,justify:`end`,children:[(0,r.jsx)(G,{variant:`soft`,color:`gray`,onClick:n,children:`Voltar a Editar`}),(0,r.jsxs)(G,{onClick:p,color:`green`,children:[(0,r.jsx)(ge,{}),` Concluir e Exportar`]})]})]})]})]})})})};var oR=({current:e,total:t})=>(0,r.jsx)(W,{gap:`2`,children:[1,2,3].map(n=>(0,r.jsxs)(W,{align:`center`,gap:`1`,children:[(0,r.jsx)(U,{style:{width:24,height:24,borderRadius:`50%`,backgroundColor:n<=e?`var(--accent-9)`:`var(--gray-4)`,color:`white`,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:12,fontWeight:`bold`},children:n<e?(0,r.jsx)(ge,{}):n}),n<t&&(0,r.jsx)(U,{style:{width:20,height:2,backgroundColor:`var(--gray-4)`}})]},n))}),sR=({initialState:e,onSave:n,theme:i=`light`,templates:a,activeTemplateId:o,onTemplateChange:s})=>{let[c,l]=(0,t.useState)(!0),[u,d]=(0,t.useState)(!0),[f,p]=(0,t.useState)(!1),[m,h]=(0,t.useState)(!1),[g,_]=(0,t.useState)(a&&a.length>0?a[0].id:null),v=t.default.useRef(null),[y,b]=(0,t.useState)(!1),[x,S]=(0,t.useState)(1),[C,w]=(0,t.useState)(!1),{addElement:T,loadState:E,state:D,undo:O,redo:k,copy:A,paste:j,removeSelected:M,updateElements:N}=rS(),P=t.default.useRef(!1);t.default.useEffect(()=>{let e=()=>{let e=window.innerWidth<768;h(e),e&&(d(!1),l(!1))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let ee=()=>{let e={elements:D.elements,isList:D.isList,mockData:D.mockData,singleMockData:D.singleMockData,listSettings:D.listSettings,canvasHeight:D.canvasHeight,gridSize:D.gridSize},t=JSON.stringify(e,null,2),n=new Blob([t],{type:`application/json`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`layout-${new Date().toISOString().slice(0,10)}.json`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r)};t.default.useEffect(()=>{let e=e=>{if(document.activeElement?.tagName===`INPUT`||document.activeElement?.tagName===`TEXTAREA`||document.activeElement?.isContentEditable)return;let t=e.clipboardData?.items;if(t){for(let n=0;n<t.length;n++)if(t[n].type.indexOf(`image`)!==-1){e.preventDefault();let r=t[n].getAsFile();if(r){let e=new FileReader;e.onload=e=>{let t=e.target?.result;T({type:`image`,content:t,width:200,height:200})},e.readAsDataURL(r)}}}};return window.addEventListener(`paste`,e),()=>window.removeEventListener(`paste`,e)},[T]),t.default.useEffect(()=>{let e=e=>{if(!(document.activeElement?.tagName===`INPUT`||document.activeElement?.tagName===`TEXTAREA`||document.activeElement?.isContentEditable)){if((e.ctrlKey||e.metaKey)&&e.key===`z`)e.shiftKey?(e.preventDefault(),k()):(e.preventDefault(),O());else if((e.ctrlKey||e.metaKey)&&e.key===`y`)e.preventDefault(),k();else if((e.ctrlKey||e.metaKey)&&e.key===`c`)e.preventDefault(),A();else if((e.ctrlKey||e.metaKey)&&e.key===`v`)e.preventDefault(),j();else if(e.key===`Delete`||e.key===`Backspace`)D.selectedElementIds.length>0&&(e.preventDefault(),M());else if([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`].includes(e.key)&&D.selectedElementIds.length>0){e.preventDefault();let t=e.shiftKey?10:1,n=[];D.selectedElementIds.forEach(r=>{let i=D.elements.find(e=>e.id===r);if(i){let a={};e.key===`ArrowUp`&&(a.y=i.y-t),e.key===`ArrowDown`&&(a.y=i.y+t),e.key===`ArrowLeft`&&(a.x=i.x-t),e.key===`ArrowRight`&&(a.x=i.x+t),n.push({id:r,changes:a})}}),n.length>0&&N(n)}}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[O,k,A,j,M,D.selectedElementIds,D.elements,N]);let[F,te]=(0,t.useState)(!1);t.default.useEffect(()=>{if(e)try{let t=typeof e==`string`?JSON.parse(e):e;Array.isArray(t)?E({elements:t}):t.elements&&E(t)}catch(e){console.error(`Failed to load initial state`,e)}te(!0)},[e,E]),t.default.useEffect(()=>{F&&(P.current||D.elements.length===0&&(P.current=!0,S(1),b(!0)))},[F,D.elements]),t.default.useEffect(()=>{!a||a.length===0||f&&_(o||a[0].id)},[o,f,a]);let I=t.default.useCallback(e=>{if(e)try{let t=typeof e==`string`?JSON.parse(e):e;if(Array.isArray(t)){E({elements:t});return}if(t&&typeof t==`object`&&`elements`in t){E(t);return}}catch(e){console.error(`Failed to apply template`,e)}},[E]);return t.default.useEffect(()=>{if(!a||a.length===0||!o||v.current===o)return;let e=a.find(e=>e.id===o);e&&(I(e.state),v.current=o)},[o,I,a]),(0,r.jsx)(A_,{appearance:i,accentColor:`blue`,grayColor:`slate`,radius:`large`,scaling:`105%`,children:(0,r.jsxs)(W,{direction:`column`,style:{height:`100vh`,width:`100%`,overflow:`hidden`,backgroundColor:`var(--gray-1)`},children:[(0,r.jsx)(IS,{onSave:n,templates:a,setIsTemplatesOpen:p,onFinish:()=>{S(3),b(!0)},onToggleSidebar:()=>d(!u)}),(0,r.jsxs)(W,{direction:`row`,style:{flexGrow:1,overflow:`hidden`},children:[m&&u&&(0,r.jsx)(`div`,{style:{position:`absolute`,top:0,left:0,width:`100%`,height:`100%`,backgroundColor:`rgba(0,0,0,0.5)`,zIndex:90},onClick:()=>d(!1)}),u&&(0,r.jsxs)(W,{id:`sidebar-area`,direction:`column`,width:m?`100%`:`300px`,style:{borderRight:`1px solid var(--gray-5)`,backgroundColor:`var(--gray-1)`,flexShrink:0,height:`100%`,boxShadow:`1px 0 0 var(--gray-4)`,overflow:`hidden`,position:m?`absolute`:`relative`,zIndex:m?100:`auto`,top:0,left:0},children:[m&&(0,r.jsx)(W,{justify:`end`,p:`2`,children:(0,r.jsx)(J,{variant:`ghost`,color:`gray`,onClick:()=>d(!1),children:(0,r.jsx)(Ee,{})})}),(0,r.jsx)(nR,{onClose:()=>{m&&d(!1)}})]}),(0,r.jsxs)(W,{direction:`column`,style:{flex:1,height:`100%`,overflow:`hidden`},children:[(0,r.jsxs)(W,{justify:`between`,align:`center`,px:`3`,py:`2`,style:{borderBottom:`1px solid var(--gray-6)`,backgroundColor:`var(--gray-1)`,flexShrink:0,zIndex:10},children:[(0,r.jsx)(W,{gap:`3`,align:`center`,children:(0,r.jsx)(J,{size:`2`,variant:`ghost`,color:`gray`,onClick:()=>d(!u),title:u?`Ocultar Barra Lateral`:`Mostrar Barra Lateral`,style:{cursor:`pointer`},children:m?(0,r.jsx)(Qe,{}):u?(0,r.jsx)(Me,{}):(0,r.jsx)(Pe,{})})}),(0,r.jsxs)(W,{gap:`3`,align:`center`,children:[(0,r.jsx)(EP,{}),(0,r.jsx)(J,{size:`2`,variant:`ghost`,color:c?`blue`:`gray`,onClick:()=>l(!c),title:c?`Ocultar Preview`:`Mostrar Preview`,style:{cursor:`pointer`},children:c?(0,r.jsx)(He,{}):(0,r.jsx)(Be,{})})]})]}),(0,r.jsx)(U,{style:{flex:1,position:`relative`,overflow:`hidden`},children:(0,r.jsxs)(Kx,{orientation:`horizontal`,style:{height:`100%`,width:`100%`},children:[(!m||!c)&&(0,r.jsx)(Xx,{defaultSize:50,minSize:20,children:(0,r.jsxs)(K,{columns:`20px 1fr`,rows:`20px 1fr`,style:{height:`100%`,width:`100%`,backgroundColor:`var(--color-background)`},children:[(0,r.jsx)(U,{style:{backgroundColor:`var(--gray-2)`,borderRight:`1px solid var(--gray-6)`,borderBottom:`1px solid var(--gray-6)`,zIndex:30}}),(0,r.jsx)(U,{style:{backgroundColor:`var(--gray-2)`,borderBottom:`1px solid var(--gray-6)`,overflow:`hidden`,zIndex:30},children:(0,r.jsx)(wP,{orientation:`horizontal`})}),(0,r.jsx)(U,{style:{backgroundColor:`var(--gray-2)`,borderRight:`1px solid var(--gray-6)`,overflow:`hidden`,zIndex:30},children:(0,r.jsx)(wP,{orientation:`vertical`})}),(0,r.jsxs)(U,{style:{position:`relative`,overflow:`hidden`,width:`100%`,height:`100%`},id:`canvas-area`,children:[(0,r.jsx)(U,{style:{position:`absolute`,top:16,left:`50%`,transform:`translateX(-50%)`,zIndex:20},children:(0,r.jsx)(iS,{})}),(0,r.jsx)(U,{style:{position:`absolute`,bottom:16,right:16,zIndex:20},children:(0,r.jsx)(iR,{})}),(0,r.jsx)(FS,{}),(0,r.jsx)(LS,{})]})]})}),!m&&c&&(0,r.jsx)(Qy,{style:{width:`4px`,backgroundColor:`var(--gray-6)`,cursor:`col-resize`,transition:`background-color 0.2s`}}),c&&(0,r.jsx)(Xx,{defaultSize:50,minSize:20,children:(0,r.jsx)(U,{id:`preview-area`,style:{height:`100%`,width:`100%`,backgroundColor:`var(--gray-3)`,borderLeft:`1px solid var(--gray-5)`},children:(0,r.jsx)(hN,{})})})]})})]})]}),(0,r.jsx)(ny,{open:f,onOpenChange:p,children:(0,r.jsxs)(iy,{style:{maxWidth:450},children:[(0,r.jsx)(ay,{children:`Galeria de Templates`}),(0,r.jsx)(oy,{size:`2`,mb:`4`,children:`Escolha um layout pré-definido para começar.`}),a&&a.length>0?(0,r.jsxs)(W,{direction:`column`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`2`,weight:`bold`,as:`div`,mb:`2`,children:`Selecione o Template`}),(0,r.jsx)(W,{direction:`column`,gap:`2`,children:a.map(e=>(0,r.jsx)(G,{variant:g===e.id?`solid`:`soft`,color:g===e.id?`blue`:`gray`,size:`2`,style:{width:`100%`,justifyContent:`flex-start`,border:g===e.id?`2px solid var(--accent-9)`:void 0},onClick:()=>_(e.id),children:e.name},e.id))})]}),g&&a.find(e=>e.id===g)?.description&&(0,r.jsx)(U,{p:`3`,style:{backgroundColor:`var(--gray-2)`,borderRadius:8},children:(0,r.jsx)(H,{size:`2`,color:`gray`,children:a.find(e=>e.id===g)?.description})}),(0,r.jsxs)(W,{gap:`3`,mt:`4`,justify:`end`,children:[(0,r.jsx)(sy,{children:(0,r.jsx)(G,{variant:`soft`,color:`gray`,children:`Cancelar`})}),(0,r.jsx)(sy,{children:(0,r.jsx)(G,{onClick:()=>{if(!g)return;if(s){s(g);return}let e=a.find(e=>e.id===g);e&&(I(e.state),v.current=g)},children:`Aplicar`})})]})]}):(0,r.jsx)(H,{children:`Nenhum template disponível.`})]})}),(0,r.jsx)(aR,{isOpen:y,onClose:()=>b(!1),templates:a||[],onSelectTemplate:e=>{e&&I(e.state)},onStartTour:()=>w(!0),initialStep:x,onFinishWizard:()=>{ee(),alert(`Layout finalizado e exportado com sucesso!`)}}),(0,r.jsx)(zS,{isOpen:C,onClose:()=>w(!1)}),(0,r.jsx)(bP,{})]})})};let cR=e=>(0,r.jsx)(nS,{isList:e.layout.isList,availableProps:e.layout.props,theme:e.theme,children:(0,r.jsx)(sR,{...e})});var lR=e=>e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,`$1-$2`).toLowerCase(),uR=e=>{let t=/^#([0-9a-fA-F]{8})$/.exec(e);if(!t)return e;let n=t[1];return`rgba(${parseInt(n.slice(0,2),16)}, ${parseInt(n.slice(2,4),16)}, ${parseInt(n.slice(4,6),16)}, ${parseInt(n.slice(6,8),16)/255})`},dR=e=>{if(!e)return``;let t=[`width`,`height`,`top`,`left`,`right`,`bottom`,`fontSize`,`borderRadius`,`padding`,`margin`,`borderWidth`,`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomRightRadius`,`borderBottomLeftRadius`,`minHeight`,`maxHeight`,`minWidth`,`maxWidth`];return Object.entries(e).map(([e,n])=>{if(n==null)return``;let r=lR(e),i=typeof n==`number`&&t.includes(e)?n+`px`:n;return typeof i==`string`&&/^#([0-9a-fA-F]{8})$/.test(i)&&(i=uR(i)),`${r}: ${i}`}).filter(Boolean).join(`; `)},fR=(e,t)=>{let n=/(rgba?\([^)]+\)|#(?:[0-9a-fA-F]{3,8})|[a-zA-Z]+)\s*$/;return!e||e===`none`?`0 4px 12px 0 ${t}`:n.test(e)?e.replace(n,t):`${e} ${t}`},pR=(e,t,n,r,i=1.2)=>{if(!e)return 0;try{let a=document.createElement(`canvas`).getContext(`2d`);if(!a)return 0;a.font=`${r}px ${n}`;let o=String(e).split(`
62
- `),s=0;for(let e of o){let n=e.split(` `),r=``;if(n.length===1&&n[0]===``){s++;continue}for(let e=0;e<n.length;e++){let i=n[e],o=a.measureText(i).width;if(o>t){r.trim().length>0&&(s++,r=``),s+=Math.ceil(o/t);continue}let c=r+i+` `;a.measureText(c).width>t&&r.trim().length>0?(s++,r=i+` `):r=c}r.length>0&&s++}return Math.ceil(s*r*i)}catch{return 0}},mR=(e,t,n)=>{let r=String(e).toLowerCase(),i=String(n).toLowerCase();switch(t){case`equals`:return r===i;case`notEquals`:return r!==i;case`contains`:return r.includes(i);case`greaterThan`:return parseFloat(r)>parseFloat(i);case`lessThan`:return parseFloat(r)<parseFloat(i);case`truthy`:return!!e;case`falsy`:return!e;default:return!1}},hR=(e,t)=>{if(!t||t.type===`text`)return e==null?``:String(e);if(e==null)return``;if(t.type===`boolean`)return String(e)===`true`||e===!0||typeof e==`number`&&e>0?t.trueLabel||`Sim`:t.falseLabel||`Não`;if(t.type===`date`)try{let n=new Date(e);if(isNaN(n.getTime()))return String(e);if(t.dateFormat){let e=n.getDate().toString().padStart(2,`0`),r=(n.getMonth()+1).toString().padStart(2,`0`),i=n.getFullYear(),a=n.getHours().toString().padStart(2,`0`),o=n.getMinutes().toString().padStart(2,`0`),s=n.getSeconds().toString().padStart(2,`0`);return t.dateFormat.replace(`DD`,e).replace(`MM`,r).replace(`YYYY`,String(i)).replace(`HH`,a).replace(`mm`,o).replace(`ss`,s)}return n.toLocaleDateString()}catch{return String(e)}if(t.type===`number`){let n=parseFloat(e);return isNaN(n)?String(e):t.numberFormat===`currency`?(t.currencySymbol||`R$`)+` `+n.toFixed(t.decimalPlaces||2):t.numberFormat===`percent`?n.toFixed(t.decimalPlaces||0)+`%`:n.toFixed(t.decimalPlaces||0)}return String(e)},gR=e=>{switch(e){case`linear`:return`linear`;case`ease-in`:return`ease-in`;case`ease-out`:return`ease-out`;case`ease-in-out`:return`ease-in-out`;case`bounce`:return`cubic-bezier(0.175, 0.885, 0.32, 1.275)`;default:return`ease-out`}},_R=e=>{if(!e||e.type===`none`)return{};let t=(e.duration||.4)+`s`,n=(e.delay||0)+`s`,r=gR(e.timingFunction),i=e.iterationCount===`infinite`?`infinite`:typeof e.iterationCount==`number`?Math.max(1,e.iterationCount):1;return{animation:`${e.type} ${t} ${r} ${n}`,animationIterationCount:i,animationFillMode:`both`}},vR=(e,t)=>{let n=JSON.parse(JSON.stringify(e)),r=new Map(n.map(e=>[e.id,{...e}])),i=[],a=(e,t)=>{if(e.id===t.id)return!1;let n=.1;return e.x>=t.x-n&&e.x+e.width<=t.x+t.width+n&&e.y>=t.y-n&&e.y+e.height<=t.y+t.height+n};n.forEach(e=>{let o=e.type===`text`,s=e.type===`text-container`;if((o||s)&&e.autoGrow){let o=e.content;o=o.replace(/\{\{(.*?)\}\}/g,(n,r)=>{let i=t[r.trim()];return i==null?n:e.formatting?hR(i,e.formatting):String(i)});let c=parseInt(String(e.style&&e.style.fontSize||16)),l=String(e.style&&e.style.fontFamily||`Arial`);if(s&&e.containerExpansion===`horizontal`)try{let t=document.createElement(`canvas`).getContext(`2d`);if(t){t.font=`${c}px ${l}`;let n=t.measureText(o),r=parseInt(String(e.style&&e.style.padding||0))*2,i=Math.ceil(n.width+r);Math.abs(i-e.width)>1&&(e.width=i,e.content=o)}}catch{}else{let t=0,s=parseInt(String(e.style&&e.style.padding||0)),u=Math.max(1,e.width-s*2),d=/<([a-z]+)([^>]*?)>/i.exec(o);if(d){let e=d[2],n=/height=["']?(\d+)["']?/i.exec(e),r=/height:\s*(\d+)px/i.exec(e);t=n?parseInt(n[1]):r?parseInt(r[1]):pR(o,u,l,c)}else t=pR(o,u,l,c);let f=t+s*2;(!d||d&&!t)&&(f+=4);let p=parseInt(String(e.style&&e.style.minHeight||0)),m=Math.max(f,p),h=e.height,g=m-h;if(Math.abs(g)>1){e.height=m,e.content=o;let t=[],s=r.get(e.id);s&&n.forEach(n=>{if(n.id===e.id)return;let i=r.get(n.id);i&&a(s,i)&&t.push(n)});let c=new Set([e.id]);t.forEach(e=>{e.height+=g,c.add(e.id)}),i.push({triggerY:e.y+h,delta:g,ignoreIds:c})}}}}),n.forEach(e=>{let t=r.get(e.id);if(!t)return;let n=0;i.forEach(r=>{r.ignoreIds.has(e.id)||t.y>=r.triggerY-.1&&(n+=r.delta)}),e.y+=n});let o=0;return n.forEach(e=>{let t=e.y+e.height;t>o&&(o=t)}),{layoutElements:n,maxY:o}},yR=(e,t,n)=>{let{maxY:r}=vR(e,t);return n?Math.max(r,n):r},bR=(e,t,n=0,r=0)=>{let{layoutElements:i}=vR(e,t),a=i,o=e=>{let n=e.content,r=``;if(e.type===`text`||e.type===`text-container`)n=n.replace(/\{\{(.*?)\}\}/g,(n,r)=>{let i=t[r.trim()];return i==null?n:e.formatting?hR(i,e.formatting):String(i)});else if(e.type===`image`)if(e.dataBinding){let i=t[e.dataBinding];r=i==null?n:String(i)}else r=n.replace(/\{\{(.*?)\}\}/g,(e,n)=>{let r=t[n.trim()];return r==null?e:String(r)});let i={};e.conditions&&e.conditions.forEach(e=>{let n=t[e.property];mR(n,e.operator,e.value)&&(i={...i,...e.style})});let a={};e.styleBindings&&Object.entries(e.styleBindings).forEach(([n,r])=>{let o=t[r];o!=null&&(n===`boxShadowColor`?a.boxShadow=fR(i.boxShadow||e.style?.boxShadow,String(o)):a[n]=String(o))});let o={width:e.width,height:e.autoGrow?`auto`:e.height,transform:e.rotation?`rotate(${e.rotation}deg)`:void 0,overflow:e.autoGrow?`visible`:`hidden`,whiteSpace:e.type===`text-container`&&e.autoGrow&&e.containerExpansion===`horizontal`?`nowrap`:e.autoGrow?`pre-wrap`:void 0,wordBreak:e.autoGrow?`break-word`:void 0,...e.type===`text-container`?{display:`flex`,alignItems:e.style?.alignItems||`flex-start`,justifyContent:e.style?.justifyContent||`flex-start`}:{},...e.style,...i,...a,..._R(e.animation),...e.hidden?{display:`none`}:{}};return{content:n,imgSrc:r,baseStyle:o}},s=(e,n,r,i)=>{if(e.type===`text`||e.type===`text-container`)return`<div style="${n}">${r}</div>`;if(e.type===`image`)return`<div style="${n}"><img src="${i}" alt="Element" style="${dR({width:`100%`,height:`100%`,objectFit:e.style?.objectFit||`cover`,display:`block`})}" /></div>`;if(e.type===`box`)return`<div style="${n}"></div>`;if(e.type===`checkbox`){let r=!1;if(e.dataBinding){let n=t[e.dataBinding];r=n===!0||String(n)===`true`}return`<div style="${n}; display: flex; align-items: center; justify-content: center;"><input type="checkbox" ${r?`checked`:``} disabled style="width:100%;height:100%;margin:0;" /></div>`}return``};return a.map(e=>{let{content:t,imgSrc:n,baseStyle:i}=o(e);return s(e,dR({...i,position:`absolute`,left:e.x,top:e.y+r}),t,n)}).join(`
63
- `)},xR=({element:e,itemData:t})=>{let n=e.content,i=``;if(e.type===`text`||e.type===`text-container`)n=n.replace(/\{\{(.*?)\}\}/g,(n,r)=>{let i=t[r.trim()];return i==null?n:e.formatting?hR(i,e.formatting):String(i)});else if(e.type===`image`)if(e.dataBinding){let r=t[e.dataBinding];i=r==null?n:String(r)}else i=n.replace(/\{\{(.*?)\}\}/g,(e,n)=>{let r=t[n.trim()];return r==null?e:String(r)});let a={};e.conditions&&e.conditions.forEach(e=>{let n=t[e.property];mR(n,e.operator,e.value)&&(a={...a,...e.style})});let o={};e.styleBindings&&Object.entries(e.styleBindings).forEach(([n,r])=>{let i=t[r];i!=null&&(n===`boxShadowColor`?o.boxShadow=fR(a.boxShadow||e.style?.boxShadow,String(i)):o[n]=String(i))});let s={position:`absolute`,left:e.x,top:e.y,width:e.width,height:e.autoGrow?`auto`:e.height,transform:e.rotation?`rotate(${e.rotation}deg)`:void 0,overflow:e.autoGrow?`visible`:`hidden`,whiteSpace:e.type===`text-container`&&e.autoGrow&&e.containerExpansion===`horizontal`?`nowrap`:e.autoGrow?`pre-wrap`:void 0,wordBreak:e.autoGrow?`break-word`:void 0,...e.type===`text-container`?{display:`flex`,alignItems:e.style?.alignItems||`flex-start`,justifyContent:e.style?.justifyContent||`flex-start`}:{},...e.style,...a,...o,..._R(e.animation),...e.hidden?{display:`none`}:{}};if(e.type===`text`||e.type===`text-container`)return/<[a-z][\s\S]*>/i.test(n)?(0,r.jsx)(`div`,{style:s,dangerouslySetInnerHTML:{__html:n}}):(0,r.jsx)(`div`,{style:s,children:n});if(e.type===`image`){let t={width:`100%`,height:`100%`,objectFit:e.style?.objectFit||`cover`,display:`block`};return(0,r.jsx)(`div`,{style:s,children:(0,r.jsx)(`img`,{src:i,alt:`Element`,style:t})})}else if(e.type===`box`)return(0,r.jsx)(`div`,{style:s});else if(e.type===`checkbox`){let n=!1;if(e.dataBinding){let r=t[e.dataBinding];n=r===!0||String(r)===`true`}return(0,r.jsx)(`div`,{style:{...s,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,r.jsx)(`input`,{type:`checkbox`,checked:n,disabled:!0,style:{width:`100%`,height:`100%`,margin:0}})})}return null},SR=({elements:e,data:t,options:n})=>{let{isList:i,listSettings:a}=n,o=`
61
+ `},pF={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function mF(e){let{announcements:r=pF,container:i,hiddenTextDescribedById:a,screenReaderInstructions:o=fF}=e,{announce:s,announcement:c}=cF(),l=JP(`DndLiveRegion`),[u,d]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{d(!0)},[]),uF((0,t.useMemo)(()=>({onDragStart(e){let{active:t}=e;s(r.onDragStart({active:t}))},onDragMove(e){let{active:t,over:n}=e;r.onDragMove&&s(r.onDragMove({active:t,over:n}))},onDragOver(e){let{active:t,over:n}=e;s(r.onDragOver({active:t,over:n}))},onDragEnd(e){let{active:t,over:n}=e;s(r.onDragEnd({active:t,over:n}))},onDragCancel(e){let{active:t,over:n}=e;s(r.onDragCancel({active:t,over:n}))}}),[s,r])),!u)return null;let f=t.default.createElement(t.default.Fragment,null,t.default.createElement(oF,{id:a,value:o.draggable}),t.default.createElement(sF,{id:l,announcement:c}));return i?(0,n.createPortal)(f,i):f}var hF;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(hF||={});function gF(){}function _F(e,n){return(0,t.useMemo)(()=>({sensor:e,options:n??{}}),[e,n])}function vF(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return(0,t.useMemo)(()=>[...n].filter(e=>e!=null),[...n])}var yF=Object.freeze({x:0,y:0});function bF(e,t){let n=tF(e);if(!n)return`0 0`;let r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+`% `+r.y+`%`}function xF(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function SF(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function CF(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var wF=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=CF(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(xF)};function TF(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function EF(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:yF}function DF(e){return function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var OF=DF(1);function kF(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function AF(e,t,n){let r=kF(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var jF={ignoreTransform:!1};function MF(e,t){t===void 0&&(t=jF);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=FP(e).getComputedStyle(e);t&&(n=AF(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function NF(e){return MF(e,{ignoreTransform:!0})}function PF(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function FF(e,t){return t===void 0&&(t=FP(e).getComputedStyle(e)),t.position===`fixed`}function IF(e,t){t===void 0&&(t=FP(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`?n.test(r):!1})}function LF(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(IP(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!LP(i)||RP(i)||n.includes(i))return n;let a=FP(e).getComputedStyle(i);return i!==e&&IF(i,a)&&n.push(i),FF(i,a)?n:r(i.parentNode)}return e?r(e):n}function RF(e){let[t]=LF(e,1);return t??null}function zF(e){return!MP||!e?null:NP(e)?e:PP(e)?IP(e)||e===zP(e).scrollingElement?window:LP(e)?e:null:null}function BF(e){return NP(e)?e.scrollX:e.scrollLeft}function VF(e){return NP(e)?e.scrollY:e.scrollTop}function HF(e){return{x:BF(e),y:VF(e)}}var UF;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(UF||={});function WF(e){return!MP||!e?!1:e===document.scrollingElement}function GF(e){let t={x:0,y:0},n=WF(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var KF={x:.2,y:.2};function qF(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=KF);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=GF(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=UF.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=UF.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=UF.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=UF.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function JF(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function YF(e){return e.reduce((e,t)=>XP(e,HF(t)),yF)}function XF(e){return e.reduce((e,t)=>e+BF(t),0)}function ZF(e){return e.reduce((e,t)=>e+VF(t),0)}function QF(e,t){if(t===void 0&&(t=MF),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);RF(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var $F=[[`x`,[`left`,`right`],XF],[`y`,[`top`,`bottom`],ZF]],eI=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=LF(t),r=YF(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of $F)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,`rect`,{enumerable:!1})}},tI=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function nI(e){let{EventTarget:t}=FP(e);return e instanceof t?e:zP(e)}function rI(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t?r>t.y:!1}var iI;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(iI||={});function aI(e){e.preventDefault()}function oI(e){e.stopPropagation()}var $;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})($||={});var sI={start:[$.Space,$.Enter],cancel:[$.Esc],end:[$.Space,$.Enter,$.Tab]},cI=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case $.Right:return{...n,x:n.x+25};case $.Left:return{...n,x:n.x-25};case $.Down:return{...n,y:n.y+25};case $.Up:return{...n,y:n.y-25}}},lI=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new tI(zP(t)),this.windowListeners=new tI(FP(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(iI.Resize,this.handleCancel),this.windowListeners.add(iI.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(iI.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&QF(n),t(yF)}handleKeyDown(e){if($P(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=sI,coordinateGetter:a=cI,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:yF;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=ZP(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=GF(n),p=JF(n),m={x:Math.min(i===$.Right?p.right-p.width/2:p.right,Math.max(i===$.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===$.Down?p.bottom-p.height/2:p.bottom,Math.max(i===$.Down?p.top:p.top+p.height/2,u.y))},h=i===$.Right&&!s||i===$.Left&&!c,g=i===$.Down&&!l||i===$.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===$.Right&&e<=d.x||i===$.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===$.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===$.Down&&e<=d.y||i===$.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===$.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,XP(ZP(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};lI.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=sI,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function uI(e){return!!(e&&`distance`in e)}function dI(e){return!!(e&&`delay`in e)}var fI=class{constructor(e,t,n){n===void 0&&(n=nI(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=zP(i),this.documentListeners=new tI(this.document),this.listeners=new tI(n),this.windowListeners=new tI(FP(i)),this.initialCoordinates=tF(r)??yF,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(iI.Resize,this.handleCancel),this.windowListeners.add(iI.DragStart,aI),this.windowListeners.add(iI.VisibilityChange,this.handleCancel),this.windowListeners.add(iI.ContextMenu,aI),this.documentListeners.add(iI.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(dI(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(uI(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(iI.Click,oI,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(iI.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=tF(e)??yF,s=ZP(n,o);if(!t&&a){if(uI(a)){if(a.tolerance!=null&&rI(s,a.tolerance))return this.handleCancel();if(rI(s,a.distance))return this.handleStart()}if(dI(a)&&rI(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===$.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},pI={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},mI=class extends fI{constructor(e){let{event:t}=e,n=zP(t.target);super(e,pI,n)}};mI.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var hI={move:{name:`mousemove`},end:{name:`mouseup`}},gI;(function(e){e[e.RightClick=2]=`RightClick`})(gI||={});var _I=class extends fI{constructor(e){super(e,hI,zP(e.event.target))}};_I.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===gI.RightClick?!1:(r?.({event:n}),!0)}}];var vI={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},yI=class extends fI{constructor(e){super(e,vI)}static setup(){return window.addEventListener(vI.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(vI.move.name,e)};function e(){}}};yI.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var bI;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(bI||={});var xI;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(xI||={});function SI(e){let{acceleration:n,activator:r=bI.Pointer,canScroll:i,draggingRect:a,enabled:o,interval:s=5,order:c=xI.TreeOrder,pointerCoordinates:l,scrollableAncestors:u,scrollableAncestorRects:d,delta:f,threshold:p}=e,m=wI({delta:f,disabled:!o}),[h,g]=HP(),_=(0,t.useRef)({x:0,y:0}),v=(0,t.useRef)({x:0,y:0}),y=(0,t.useMemo)(()=>{switch(r){case bI.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case bI.DraggableRect:return a}},[r,a,l]),b=(0,t.useRef)(null),x=(0,t.useCallback)(()=>{let e=b.current;if(!e)return;let t=_.current.x*v.current.x,n=_.current.y*v.current.y;e.scrollBy(t,n)},[]),S=(0,t.useMemo)(()=>c===xI.TreeOrder?[...u].reverse():u,[c,u]);(0,t.useEffect)(()=>{if(!o||!u.length||!y){g();return}for(let e of S){if(i?.(e)===!1)continue;let t=d[u.indexOf(e)];if(!t)continue;let{direction:r,speed:a}=qF(e,t,y,n,p);for(let e of[`x`,`y`])m[e][r[e]]||(a[e]=0,r[e]=0);if(a.x>0||a.y>0){g(),b.current=e,h(x,s),_.current=a,v.current=r;return}}_.current={x:0,y:0},v.current={x:0,y:0},g()},[n,x,i,g,o,s,JSON.stringify(y),JSON.stringify(m),h,u,S,d,JSON.stringify(p)])}var CI={x:{[UF.Backward]:!1,[UF.Forward]:!1},y:{[UF.Backward]:!1,[UF.Forward]:!1}};function wI(e){let{delta:t,disabled:n}=e,r=KP(t);return WP(e=>{if(n||!r||!e)return CI;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[UF.Backward]:e.x[UF.Backward]||i.x===-1,[UF.Forward]:e.x[UF.Forward]||i.x===1},y:{[UF.Backward]:e.y[UF.Backward]||i.y===-1,[UF.Forward]:e.y[UF.Forward]||i.y===1}}},[n,t,r])}function TI(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return WP(e=>t==null?null:r??e??null,[r,t])}function EI(e,n){return(0,t.useMemo)(()=>e.reduce((e,t)=>{let{sensor:r}=t,i=r.activators.map(e=>({eventName:e.eventName,handler:n(e.handler,t)}));return[...e,...i]},[]),[e,n])}var DI;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(DI||={});var OI;(function(e){e.Optimized=`optimized`})(OI||={});var kI=new Map;function AI(e,n){let{dragging:r,dependencies:i,config:a}=n,[o,s]=(0,t.useState)(null),{frequency:c,measure:l,strategy:u}=a,d=(0,t.useRef)(e),f=_(),p=UP(f),m=(0,t.useCallback)(function(e){e===void 0&&(e=[]),!p.current&&s(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[p]),h=(0,t.useRef)(null),g=WP(t=>{if(f&&!r)return kI;if(!t||t===kI||d.current!==e||o!=null){let t=new Map;for(let n of e){if(!n)continue;if(o&&o.length>0&&!o.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new eI(l(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,o,r,f,l]);return(0,t.useEffect)(()=>{d.current=e},[e]),(0,t.useEffect)(()=>{f||m()},[r,f]),(0,t.useEffect)(()=>{o&&o.length>0&&s(null)},[JSON.stringify(o)]),(0,t.useEffect)(()=>{f||typeof c!=`number`||h.current!==null||(h.current=setTimeout(()=>{m(),h.current=null},c))},[c,f,m,...i]),{droppableRects:g,measureDroppableContainers:m,measuringScheduled:o!=null};function _(){switch(u){case DI.Always:return!1;case DI.BeforeDragging:return r;default:return!r}}}function jI(e,t){return WP(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function MI(e,t){return jI(e,t)}function NI(e){let{callback:n,disabled:r}=e,i=VP(n),a=(0,t.useMemo)(()=>{if(r||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(i)},[i,r]);return(0,t.useEffect)(()=>()=>a?.disconnect(),[a]),a}function PI(e){let{callback:n,disabled:r}=e,i=VP(n),a=(0,t.useMemo)(()=>{if(r||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(i)},[r]);return(0,t.useEffect)(()=>()=>a?.disconnect(),[a]),a}function FI(e){return new eI(MF(e),e)}function II(e,n,r){n===void 0&&(n=FI);let[i,a]=(0,t.useState)(null);function o(){a(t=>{if(!e)return null;if(e.isConnected===!1)return t??r??null;let i=n(e);return JSON.stringify(t)===JSON.stringify(i)?t:i})}let s=NI({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){o();break}}}}),c=PI({callback:o});return BP(()=>{o(),e?(c?.observe(e),s?.observe(document.body,{childList:!0,subtree:!0})):(c?.disconnect(),s?.disconnect())},[e]),i}function LI(e){return EF(e,jI(e))}var RI=[];function zI(e){let n=(0,t.useRef)(e),r=WP(t=>e?t&&t!==RI&&e&&n.current&&e.parentNode===n.current.parentNode?t:LF(e):RI,[e]);return(0,t.useEffect)(()=>{n.current=e},[e]),r}function BI(e){let[n,r]=(0,t.useState)(null),i=(0,t.useRef)(e),a=(0,t.useCallback)(e=>{let t=zF(e.target);t&&r(e=>e?(e.set(t,HF(t)),new Map(e)):null)},[]);return(0,t.useEffect)(()=>{let t=i.current;if(e!==t){n(t);let o=e.map(e=>{let t=zF(e);return t?(t.addEventListener(`scroll`,a,{passive:!0}),[t,HF(t)]):null}).filter(e=>e!=null);r(o.length?new Map(o):null),i.current=e}return()=>{n(e),n(t)};function n(e){e.forEach(e=>{zF(e)?.removeEventListener(`scroll`,a)})}},[a,e]),(0,t.useMemo)(()=>e.length?n?Array.from(n.values()).reduce((e,t)=>XP(e,t),yF):YF(e):yF,[e,n])}function VI(e,n){n===void 0&&(n=[]);let r=(0,t.useRef)(null);return(0,t.useEffect)(()=>{r.current=null},n),(0,t.useEffect)(()=>{let t=e!==yF;t&&!r.current&&(r.current=e),!t&&r.current&&(r.current=null)},[e]),r.current?ZP(e,r.current):yF}function HI(e){(0,t.useEffect)(()=>{if(!MP)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function UI(e,n){return(0,t.useMemo)(()=>e.reduce((e,t)=>{let{eventName:r,handler:i}=t;return e[r]=e=>{i(e,n)},e},{}),[e,n])}function WI(e){return(0,t.useMemo)(()=>e?PF(e):null,[e])}var GI=[];function KI(e,n){n===void 0&&(n=MF);let[r]=e,i=WI(r?FP(r):null),[a,o]=(0,t.useState)(GI);function s(){o(()=>e.length?e.map(e=>WF(e)?i:new eI(n(e),e)):GI)}let c=PI({callback:s});return BP(()=>{c?.disconnect(),s(),e.forEach(e=>c?.observe(e))},[e]),a}function qI(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return LP(t)?t:e}function JI(e){let{measure:n}=e,[r,i]=(0,t.useState)(null),a=PI({callback:(0,t.useCallback)(e=>{for(let{target:t}of e)if(LP(t)){i(e=>{let r=n(t);return e?{...e,width:r.width,height:r.height}:r});break}},[n])}),[o,s]=GP((0,t.useCallback)(e=>{let t=qI(e);a?.disconnect(),t&&a?.observe(t),i(t?n(t):null)},[n,a]));return(0,t.useMemo)(()=>({nodeRef:o,rect:r,setRef:s}),[r,o,s])}var YI=[{sensor:mI,options:{}},{sensor:lI,options:{}}],XI={current:{}},ZI={draggable:{measure:NF},droppable:{measure:NF,strategy:DI.WhileDragging,frequency:OI.Optimized},dragOverlay:{measure:MF}},QI=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},$I={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new QI,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:gF},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ZI,measureDroppableContainers:gF,windowRect:null,measuringScheduled:!1},eL={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:gF,draggableNodes:new Map,over:null,measureDroppableContainers:gF},tL=(0,t.createContext)(eL),nL=(0,t.createContext)($I);function rL(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new QI}}}function iL(e,t){switch(t.type){case hF.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case hF.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case hF.DragEnd:case hF.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case hF.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new QI(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case hF.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new QI(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case hF.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new QI(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function aL(e){let{disabled:n}=e,{active:r,activatorEvent:i,draggableNodes:a}=(0,t.useContext)(tL),o=KP(i),s=KP(r?.id);return(0,t.useEffect)(()=>{if(!n&&!i&&o&&s!=null){if(!$P(o)||document.activeElement===o.target)return;let e=a.get(s);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=iF(e);if(t){t.focus();break}}})}},[i,n,a,s,o]),null}function oL(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function sL(e){return(0,t.useMemo)(()=>({draggable:{...ZI.draggable,...e?.draggable},droppable:{...ZI.droppable,...e?.droppable},dragOverlay:{...ZI.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function cL(e){let{activeNode:n,measure:r,initialRect:i,config:a=!0}=e,o=(0,t.useRef)(!1),{x:s,y:c}=typeof a==`boolean`?{x:a,y:a}:a;BP(()=>{if(!s&&!c||!n){o.current=!1;return}if(o.current||!i)return;let e=n?.node.current;if(!e||e.isConnected===!1)return;let t=EF(r(e),i);if(s||(t.x=0),c||(t.y=0),o.current=!0,Math.abs(t.x)>0||Math.abs(t.y)>0){let n=RF(e);n&&n.scrollBy({top:t.y,left:t.x})}},[n,s,c,i,r])}var lL=(0,t.createContext)({...yF,scaleX:1,scaleY:1}),uL;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(uL||={});var dL=(0,t.memo)(function(e){let{id:r,accessibility:i,autoScroll:a=!0,children:o,sensors:s=YI,collisionDetection:c=wF,measuring:l,modifiers:u,...d}=e,[f,p]=(0,t.useReducer)(iL,void 0,rL),[m,h]=dF(),[g,_]=(0,t.useState)(uL.Uninitialized),v=g===uL.Initialized,{draggable:{active:y,nodes:b,translate:x},droppable:{containers:S}}=f,C=y==null?null:b.get(y),w=(0,t.useRef)({initial:null,translated:null}),T=(0,t.useMemo)(()=>y==null?null:{id:y,data:C?.data??XI,rect:w},[y,C]),E=(0,t.useRef)(null),[D,O]=(0,t.useState)(null),[k,A]=(0,t.useState)(null),j=UP(d,Object.values(d)),M=JP(`DndDescribedBy`,r),N=(0,t.useMemo)(()=>S.getEnabled(),[S]),P=sL(l),{droppableRects:ee,measureDroppableContainers:F,measuringScheduled:te}=AI(N,{dragging:v,dependencies:[x.x,x.y],config:P.droppable}),I=TI(b,y),ne=(0,t.useMemo)(()=>k?tF(k):null,[k]),re=Pe(),ie=MI(I,P.draggable.measure);cL({activeNode:y==null?null:b.get(y),config:re.layoutShiftCompensation,initialRect:ie,measure:P.draggable.measure});let ae=II(I,P.draggable.measure,ie),oe=II(I?I.parentElement:null),se=(0,t.useRef)({activatorEvent:null,active:null,activeNode:I,collisionRect:null,collisions:null,droppableRects:ee,draggableNodes:b,draggingNode:null,draggingNodeRect:null,droppableContainers:S,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ce=S.getNodeFor(se.current.over?.id),le=JI({measure:P.dragOverlay.measure}),ue=le.nodeRef.current??I,de=v?le.rect??ae:null,fe=!!(le.nodeRef.current&&le.rect),pe=LI(fe?null:ae),me=WI(ue?FP(ue):null),he=zI(v?ce??I:null),ge=KI(he),_e=oL(u,{transform:{x:x.x-pe.x,y:x.y-pe.y,scaleX:1,scaleY:1},activatorEvent:k,active:T,activeNodeRect:ae,containerNodeRect:oe,draggingNodeRect:de,over:se.current.over,overlayNodeRect:le.rect,scrollableAncestors:he,scrollableAncestorRects:ge,windowRect:me}),ve=ne?XP(ne,x):null,ye=BI(he),be=VI(ye),xe=VI(ye,[ae]),Se=XP(_e,be),Ce=de?OF(de,_e):null,we=T&&Ce?c({active:T,collisionRect:Ce,droppableRects:ee,droppableContainers:N,pointerCoordinates:ve}):null,Te=SF(we,`id`),[Ee,De]=(0,t.useState)(null),Oe=TF(fe?_e:XP(_e,xe),Ee?.rect??null,ae),ke=(0,t.useRef)(null),Ae=(0,t.useCallback)((e,t)=>{let{sensor:r,options:i}=t;if(E.current==null)return;let a=b.get(E.current);if(!a)return;let o=e.nativeEvent;ke.current=new r({active:E.current,activeNode:a,event:o,options:i,context:se,onAbort(e){if(!b.get(e))return;let{onDragAbort:t}=j.current,n={id:e};t?.(n),m({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!b.get(e))return;let{onDragPending:i}=j.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),m({type:`onDragPending`,event:a})},onStart(e){let t=E.current;if(t==null)return;let r=b.get(t);if(!r)return;let{onDragStart:i}=j.current,a={activatorEvent:o,active:{id:t,data:r.data,rect:w}};(0,n.unstable_batchedUpdates)(()=>{i?.(a),_(uL.Initializing),p({type:hF.DragStart,initialCoordinates:e,active:t}),m({type:`onDragStart`,event:a}),O(ke.current),A(o)})},onMove(e){p({type:hF.DragMove,coordinates:e})},onEnd:s(hF.DragEnd),onCancel:s(hF.DragCancel)});function s(e){return async function(){let{active:t,collisions:r,over:i,scrollAdjustedTranslate:a}=se.current,s=null;if(t&&a){let{cancelDrop:n}=j.current;s={activatorEvent:o,active:t,collisions:r,delta:a,over:i},e===hF.DragEnd&&typeof n==`function`&&await Promise.resolve(n(s))&&(e=hF.DragCancel)}E.current=null,(0,n.unstable_batchedUpdates)(()=>{p({type:e}),_(uL.Uninitialized),De(null),O(null),A(null),ke.current=null;let t=e===hF.DragEnd?`onDragEnd`:`onDragCancel`;if(s){let e=j.current[t];e?.(s),m({type:t,event:s})}})}}},[b]),je=EI(s,(0,t.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=b.get(r);if(E.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},E.current=r,Ae(n,t))},[b,Ae]));HI(s),BP(()=>{ae&&g===uL.Initializing&&_(uL.Initialized)},[ae,g]),(0,t.useEffect)(()=>{let{onDragMove:e}=j.current,{active:t,activatorEvent:r,collisions:i,over:a}=se.current;if(!t||!r)return;let o={active:t,activatorEvent:r,collisions:i,delta:{x:Se.x,y:Se.y},over:a};(0,n.unstable_batchedUpdates)(()=>{e?.(o),m({type:`onDragMove`,event:o})})},[Se.x,Se.y]),(0,t.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:r,droppableContainers:i,scrollAdjustedTranslate:a}=se.current;if(!e||E.current==null||!t||!a)return;let{onDragOver:o}=j.current,s=i.get(Te),c=s&&s.rect.current?{id:s.id,rect:s.rect.current,data:s.data,disabled:s.disabled}:null,l={active:e,activatorEvent:t,collisions:r,delta:{x:a.x,y:a.y},over:c};(0,n.unstable_batchedUpdates)(()=>{De(c),o?.(l),m({type:`onDragOver`,event:l})})},[Te]),BP(()=>{se.current={activatorEvent:k,active:T,activeNode:I,collisionRect:Ce,collisions:we,droppableRects:ee,draggableNodes:b,draggingNode:ue,draggingNodeRect:de,droppableContainers:S,over:Ee,scrollableAncestors:he,scrollAdjustedTranslate:Se},w.current={initial:de,translated:Ce}},[T,I,we,Ce,b,ue,de,ee,S,Ee,he,Se]),SI({...re,delta:x,draggingRect:Ce,pointerCoordinates:ve,scrollableAncestors:he,scrollableAncestorRects:ge});let Me=(0,t.useMemo)(()=>({active:T,activeNode:I,activeNodeRect:ae,activatorEvent:k,collisions:we,containerNodeRect:oe,dragOverlay:le,draggableNodes:b,droppableContainers:S,droppableRects:ee,over:Ee,measureDroppableContainers:F,scrollableAncestors:he,scrollableAncestorRects:ge,measuringConfiguration:P,measuringScheduled:te,windowRect:me}),[T,I,ae,k,we,oe,le,b,S,ee,Ee,F,he,ge,P,te,me]),Ne=(0,t.useMemo)(()=>({activatorEvent:k,activators:je,active:T,activeNodeRect:ae,ariaDescribedById:{draggable:M},dispatch:p,draggableNodes:b,over:Ee,measureDroppableContainers:F}),[k,je,T,ae,p,M,b,Ee,F]);return t.default.createElement(lF.Provider,{value:h},t.default.createElement(tL.Provider,{value:Ne},t.default.createElement(nL.Provider,{value:Me},t.default.createElement(lL.Provider,{value:Oe},o)),t.default.createElement(aL,{disabled:i?.restoreFocus===!1})),t.default.createElement(mF,{...i,hiddenTextDescribedById:M}));function Pe(){let e=D?.autoScrollEnabled===!1,t=typeof a==`object`?a.enabled===!1:a===!1,n=v&&!e&&!t;return typeof a==`object`?{...a,enabled:n}:{enabled:n}}}),fL=(0,t.createContext)(null),pL=`button`,mL=`Draggable`;function hL(e){let{id:n,data:r,disabled:i=!1,attributes:a}=e,o=JP(mL),{activators:s,activatorEvent:c,active:l,activeNodeRect:u,ariaDescribedById:d,draggableNodes:f,over:p}=(0,t.useContext)(tL),{role:m=pL,roleDescription:h=`draggable`,tabIndex:g=0}=a??{},_=l?.id===n,v=(0,t.useContext)(_?lL:fL),[y,b]=GP(),[x,S]=GP(),C=UI(s,n),w=UP(r);return BP(()=>(f.set(n,{id:n,key:o,node:y,activatorNode:x,data:w}),()=>{let e=f.get(n);e&&e.key===o&&f.delete(n)}),[f,n]),{active:l,activatorEvent:c,activeNodeRect:u,attributes:(0,t.useMemo)(()=>({role:m,tabIndex:g,"aria-disabled":i,"aria-pressed":_&&m===pL?!0:void 0,"aria-roledescription":h,"aria-describedby":d.draggable}),[i,m,g,_,h,d.draggable]),isDragging:_,listeners:i?void 0:C,node:y,over:p,setNodeRef:b,setActivatorNodeRef:S,transform:v}}function gL(){return(0,t.useContext)(nL)}var _L=`Droppable`,vL={timeout:25};function yL(e){let{data:n,disabled:r=!1,id:i,resizeObserverConfig:a}=e,o=JP(_L),{active:s,dispatch:c,over:l,measureDroppableContainers:u}=(0,t.useContext)(tL),d=(0,t.useRef)({disabled:r}),f=(0,t.useRef)(!1),p=(0,t.useRef)(null),m=(0,t.useRef)(null),{disabled:h,updateMeasurementsFor:g,timeout:_}={...vL,...a},v=UP(g??i),y=PI({callback:(0,t.useCallback)(()=>{if(!f.current){f.current=!0;return}m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{u(Array.isArray(v.current)?v.current:[v.current]),m.current=null},_)},[_]),disabled:h||!s}),[b,x]=GP((0,t.useCallback)((e,t)=>{y&&(t&&(y.unobserve(t),f.current=!1),e&&y.observe(e))},[y])),S=UP(n);return(0,t.useEffect)(()=>{!y||!b.current||(y.disconnect(),f.current=!1,y.observe(b.current))},[b,y]),(0,t.useEffect)(()=>(c({type:hF.RegisterDroppable,element:{id:i,key:o,disabled:r,node:b,rect:p,data:S}}),()=>c({type:hF.UnregisterDroppable,key:o,id:i})),[i]),(0,t.useEffect)(()=>{r!==d.current.disabled&&(c({type:hF.SetDroppableDisabled,id:i,key:o,disabled:r}),d.current.disabled=r)},[i,o,r,c]),{active:s,rect:p,isOver:l?.id===i,node:b,over:l,setNodeRef:x}}function bL(e){let{animation:n,children:r}=e,[i,a]=(0,t.useState)(null),[o,s]=(0,t.useState)(null),c=KP(r);return!r&&!i&&c&&a(c),BP(()=>{if(!o)return;let e=i?.key,t=i?.props.id;if(e==null||t==null){a(null);return}Promise.resolve(n(t,o)).then(()=>{a(null)})},[n,i,o]),t.default.createElement(t.default.Fragment,null,r,i?(0,t.cloneElement)(i,{ref:s}):null)}var xL={x:0,y:0,scaleX:1,scaleY:1};function SL(e){let{children:n}=e;return t.default.createElement(tL.Provider,{value:eL},t.default.createElement(lL.Provider,{value:xL},n))}var CL={position:`fixed`,touchAction:`none`},wL=e=>$P(e)?`transform 250ms ease`:void 0,TL=(0,t.forwardRef)((e,n)=>{let{as:r,activatorEvent:i,adjustScale:a,children:o,className:s,rect:c,style:l,transform:u,transition:d=wL}=e;if(!c)return null;let f=a?u:{...u,scaleX:1,scaleY:1},p={...CL,width:c.width,height:c.height,top:c.top,left:c.left,transform:nF.Transform.toString(f),transformOrigin:a&&i?bF(i,c):void 0,transition:typeof d==`function`?d(i):d,...l};return t.default.createElement(r,{className:s,style:p,ref:n},o)}),EL={duration:250,easing:`ease`,keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:nF.Transform.toString(t)},{transform:nF.Transform.toString(n)}]},sideEffects:(e=>t=>{let{active:n,dragOverlay:r}=t,i={},{styles:a,className:o}=e;if(a!=null&&a.active)for(let[e,t]of Object.entries(a.active))t!==void 0&&(i[e]=n.node.style.getPropertyValue(e),n.node.style.setProperty(e,t));if(a!=null&&a.dragOverlay)for(let[e,t]of Object.entries(a.dragOverlay))t!==void 0&&r.node.style.setProperty(e,t);return o!=null&&o.active&&n.node.classList.add(o.active),o!=null&&o.dragOverlay&&r.node.classList.add(o.dragOverlay),function(){for(let[e,t]of Object.entries(i))n.node.style.setProperty(e,t);o!=null&&o.active&&n.node.classList.remove(o.active)}})({styles:{active:{opacity:`0`}}})};function DL(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return VP((e,a)=>{if(t===null)return;let o=n.get(e);if(!o)return;let s=o.node.current;if(!s)return;let c=qI(a);if(!c)return;let{transform:l}=FP(a).getComputedStyle(a),u=kF(l);if(!u)return;let d=typeof t==`function`?t:OL(t);return QF(s,i.draggable.measure),d({active:{id:e,data:o.data,node:s,rect:i.draggable.measure(s)},draggableNodes:n,dragOverlay:{node:a,rect:i.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:i,transform:u})})}function OL(e){let{duration:t,easing:n,sideEffects:r,keyframes:i}={...EL,...e};return e=>{let{active:a,dragOverlay:o,transform:s,...c}=e;if(!t)return;let l={x:o.rect.left-a.rect.left,y:o.rect.top-a.rect.top},u={scaleX:s.scaleX===1?1:a.rect.width*s.scaleX/o.rect.width,scaleY:s.scaleY===1?1:a.rect.height*s.scaleY/o.rect.height},d={x:s.x-l.x,y:s.y-l.y,...u},f=i({...c,active:a,dragOverlay:o,transform:{initial:s,final:d}}),[p]=f,m=f[f.length-1];if(JSON.stringify(p)===JSON.stringify(m))return;let h=r?.({active:a,dragOverlay:o,...c}),g=o.node.animate(f,{duration:t,easing:n,fill:`forwards`});return new Promise(e=>{g.onfinish=()=>{h?.(),e()}})}}var kL=0;function AL(e){return(0,t.useMemo)(()=>{if(e!=null)return kL++,kL},[e])}var jL=t.default.memo(e=>{let{adjustScale:n=!1,children:r,dropAnimation:i,style:a,transition:o,modifiers:s,wrapperElement:c=`div`,className:l,zIndex:u=999}=e,{activatorEvent:d,active:f,activeNodeRect:p,containerNodeRect:m,draggableNodes:h,droppableContainers:g,dragOverlay:_,over:v,measuringConfiguration:y,scrollableAncestors:b,scrollableAncestorRects:x,windowRect:S}=gL(),C=(0,t.useContext)(lL),w=AL(f?.id),T=oL(s,{activatorEvent:d,active:f,activeNodeRect:p,containerNodeRect:m,draggingNodeRect:_.rect,over:v,overlayNodeRect:_.rect,scrollableAncestors:b,scrollableAncestorRects:x,transform:C,windowRect:S}),E=jI(p),D=DL({config:i,draggableNodes:h,droppableContainers:g,measuringConfiguration:y}),O=E?_.setRef:void 0;return t.default.createElement(SL,null,t.default.createElement(bL,{animation:D},f&&w?t.default.createElement(TL,{key:w,id:f.id,ref:O,as:c,activatorEvent:d,adjustScale:n,className:l,transition:o,rect:E,style:{zIndex:u,...a},transform:T},r):null))});function ML(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function NL(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function PL(e){return e!==null&&e>=0}function FL(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function IL(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var LL=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=ML(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},RL={scaleX:1,scaleY:1},zL=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...RL}:null}let s=BL(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...RL}:r<t&&r>=a?{x:0,y:o.height+s,...RL}:{x:0,y:0,...RL}};function BL(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var VL=`Sortable`,HL=t.default.createContext({activeIndex:-1,containerId:VL,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:LL,disabled:{draggable:!1,droppable:!1}});function UL(e){let{children:n,id:r,items:i,strategy:a=LL,disabled:o=!1}=e,{active:s,dragOverlay:c,droppableRects:l,over:u,measureDroppableContainers:d}=gL(),f=JP(VL,r),p=c.rect!==null,m=(0,t.useMemo)(()=>i.map(e=>typeof e==`object`&&`id`in e?e.id:e),[i]),h=s!=null,g=s?m.indexOf(s.id):-1,_=u?m.indexOf(u.id):-1,v=(0,t.useRef)(m),y=!FL(m,v.current),b=_!==-1&&g===-1||y,x=IL(o);BP(()=>{y&&h&&d(m)},[y,m,h,d]),(0,t.useEffect)(()=>{v.current=m},[m]);let S=(0,t.useMemo)(()=>({activeIndex:g,containerId:f,disabled:x,disableTransforms:b,items:m,overIndex:_,useDragOverlay:p,sortedRects:NL(m,l),strategy:a}),[g,f,x.draggable,x.droppable,b,m,_,l,p,a]);return t.default.createElement(HL.Provider,{value:S},n)}var WL=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return ML(n,r,i).indexOf(t)},GL=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},KL={duration:200,easing:`ease`},qL=`transform`,JL=nF.Transition.toString({property:qL,duration:0,easing:`linear`}),YL={roleDescription:`sortable`};function XL(e){let{disabled:n,index:r,node:i,rect:a}=e,[o,s]=(0,t.useState)(null),c=(0,t.useRef)(r);return BP(()=>{if(!n&&r!==c.current&&i.current){let e=a.current;if(e){let t=MF(i.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&s(n)}}r!==c.current&&(c.current=r)},[n,r,i,a]),(0,t.useEffect)(()=>{o&&s(null)},[o]),o}function ZL(e){let{animateLayoutChanges:n=GL,attributes:r,disabled:i,data:a,getNewIndex:o=WL,id:s,strategy:c,resizeObserverConfig:l,transition:u=KL}=e,{items:d,containerId:f,activeIndex:p,disabled:m,disableTransforms:h,sortedRects:g,overIndex:_,useDragOverlay:v,strategy:y}=(0,t.useContext)(HL),b=QL(i,m),x=d.indexOf(s),S=(0,t.useMemo)(()=>({sortable:{containerId:f,index:x,items:d},...a}),[f,a,x,d]),C=(0,t.useMemo)(()=>d.slice(d.indexOf(s)),[d,s]),{rect:w,node:T,isOver:E,setNodeRef:D}=yL({id:s,data:S,disabled:b.droppable,resizeObserverConfig:{updateMeasurementsFor:C,...l}}),{active:O,activatorEvent:k,activeNodeRect:A,attributes:j,setNodeRef:M,listeners:N,isDragging:P,over:ee,setActivatorNodeRef:F,transform:te}=hL({id:s,data:S,attributes:{...YL,...r},disabled:b.draggable}),I=jP(D,M),ne=!!O,re=ne&&!h&&PL(p)&&PL(_),ie=!v&&P,ae=re?(ie&&re?te:null)??(c??y)({rects:g,activeNodeRect:A,activeIndex:p,overIndex:_,index:x}):null,oe=PL(p)&&PL(_)?o({id:s,items:d,activeIndex:p,overIndex:_}):x,se=O?.id,ce=(0,t.useRef)({activeId:se,items:d,newIndex:oe,containerId:f}),le=d!==ce.current.items,ue=n({active:O,containerId:f,isDragging:P,isSorting:ne,id:s,index:x,items:d,newIndex:ce.current.newIndex,previousItems:ce.current.items,previousContainerId:ce.current.containerId,transition:u,wasDragging:ce.current.activeId!=null}),de=XL({disabled:!ue,index:x,node:T,rect:w});return(0,t.useEffect)(()=>{ne&&ce.current.newIndex!==oe&&(ce.current.newIndex=oe),f!==ce.current.containerId&&(ce.current.containerId=f),d!==ce.current.items&&(ce.current.items=d)},[ne,oe,f,d]),(0,t.useEffect)(()=>{if(se===ce.current.activeId)return;if(se!=null&&ce.current.activeId==null){ce.current.activeId=se;return}let e=setTimeout(()=>{ce.current.activeId=se},50);return()=>clearTimeout(e)},[se]),{active:O,activeIndex:p,attributes:j,data:S,rect:w,index:x,newIndex:oe,items:d,isOver:E,isSorting:ne,isDragging:P,listeners:N,node:T,overIndex:_,over:ee,setNodeRef:I,setActivatorNodeRef:F,setDroppableNodeRef:D,setDraggableNodeRef:M,transform:de??ae,transition:fe()};function fe(){if(de||le&&ce.current.newIndex===x)return JL;if(!(ie&&!$P(k)||!u)&&(ne||ue))return nF.Transition.toString({...u,property:qL})}}function QL(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}$.Down,$.Right,$.Up,$.Left;var $L={text:`Texto`,image:`Imagem`,box:`Grupo / Cartão`,"text-container":`Texto em Caixa`,group:`Grupo`,checkbox:`Caixa de Seleção`},eR=({element:e,isSelected:t,onSelect:n,onToggleLock:i,onToggleHide:a})=>{let{attributes:o,listeners:s,setNodeRef:c,transform:l,transition:u,isDragging:d}=ZL({id:e.id});return(0,r.jsx)(U,{ref:c,style:{transform:nF.Transform.toString(l),transition:u,opacity:d?.5:1,touchAction:`none`},children:(0,r.jsxs)(W,{align:`center`,style:{padding:`8px 12px`,backgroundColor:t?`var(--accent-a3)`:`var(--gray-2)`,borderRadius:6,cursor:`pointer`,marginBottom:4,border:t?`1px solid var(--accent-9)`:`1px solid transparent`},onClick:e=>n(e.shiftKey),children:[(0,r.jsx)(U,{...o,...s,style:{cursor:`grab`,color:`var(--gray-8)`,marginRight:8},children:(0,r.jsx)(Re,{})}),(0,r.jsxs)(U,{style:{color:`var(--gray-10)`,marginRight:8},children:[e.type===`text`&&(0,r.jsx)(Rt,{}),e.type===`image`&&(0,r.jsx)(Xe,{}),(e.type===`box`||e.type===`group`)&&(0,r.jsx)(ue,{})]}),(0,r.jsx)(H,{size:`2`,weight:t?`bold`:`regular`,style:{flex:1},truncate:!0,children:e.name||$L[e.type]||e.type}),(0,r.jsxs)(W,{gap:`1`,onClick:e=>e.stopPropagation(),children:[(0,r.jsx)(J,{size:`1`,variant:`ghost`,color:e.locked?`orange`:`gray`,onClick:i,title:e.locked?`Desbloquear`:`Bloquear`,children:e.locked?(0,r.jsx)(et,{}):(0,r.jsx)(nt,{})}),(0,r.jsx)(J,{size:`1`,variant:`ghost`,color:e.hidden?`red`:`gray`,onClick:a,title:e.hidden?`Mostrar`:`Ocultar`,children:e.hidden?(0,r.jsx)(Be,{}):(0,r.jsx)(He,{})})]})]})})};let tR=()=>{let{state:e,selectElement:n,moveElement:i,updateElement:a}=rS(),{elements:o,selectedElementIds:s}=e,c=(0,t.useMemo)(()=>[...o].reverse(),[o]),[l,u]=(0,t.useState)(null),d=vF(_F(mI,{activationConstraint:{distance:5}}));return(0,r.jsx)(U,{children:(0,r.jsxs)(dL,{sensors:d,onDragStart:e=>{u(e.active.id)},onDragEnd:e=>{let{active:t,over:n}=e;if(u(null),n&&t.id!==n.id){let e=c.findIndex(e=>e.id===t.id),r=c.findIndex(e=>e.id===n.id);i(o.length-1-e,o.length-1-r)}},children:[(0,r.jsx)(UL,{items:c.map(e=>e.id),strategy:zL,children:(0,r.jsxs)(W,{direction:`column`,children:[c.map(e=>(0,r.jsx)(eR,{element:e,isSelected:s.includes(e.id),onSelect:t=>n(e.id,t),onToggleLock:()=>a(e.id,{locked:!e.locked}),onToggleHide:()=>a(e.id,{hidden:!e.hidden})},e.id)),c.length===0&&(0,r.jsx)(H,{size:`2`,color:`gray`,align:`center`,style:{padding:20},children:`Adicione itens para ver a lista aqui.`})]})}),(0,r.jsx)(jL,{children:l?(0,r.jsx)(U,{style:{padding:`8px 12px`,backgroundColor:`var(--gray-4)`,borderRadius:6,boxShadow:`0 4px 12px rgba(0,0,0,0.1)`},children:(0,r.jsx)(H,{children:`Movendo...`})}):null})]})})},nR=()=>{let{state:e,updateElement:n,removeSelected:i,copy:a}=rS(),[o,s]=(0,t.useState)(!1),c=e.selectedElementIds[0],l=e.elements.find(e=>e.id===c);if(!l)return null;let u=e=>{n(l.id,e)},d=e=>{u({style:{...l.style,...e}})},f=l.style?.textAlign||`left`,p=parseInt(l.style?.fontSize||`14`,10),m=parseInt(l.style?.borderWidth||`0`,10),h=parseInt(l.style?.padding||`0`,10),g=parseInt(l.style?.borderRadius||`0`,10),_=Math.round((parseFloat(String(l.style?.opacity??`1`))||1)*100),v=l.style?.fontFamily||`Arial`,y=kS(l.style?.fontWeight,DS),b=AS(v,e.availableFonts||[`Arial`,`Helvetica`,`Times New Roman`,`Courier New`,`Verdana`,`Georgia`,`Tahoma`,`Trebuchet MS`]);return(0,r.jsxs)(W,{direction:`column`,gap:`4`,children:[(0,r.jsxs)(W,{justify:`between`,align:`center`,children:[(0,r.jsx)(H,{size:`3`,weight:`bold`,children:rR(l.type)}),(0,r.jsxs)(W,{gap:`2`,children:[(0,r.jsx)(J,{variant:`soft`,color:l.locked?`orange`:`gray`,onClick:()=>u({locked:!l.locked}),title:l.locked?`Desbloquear`:`Bloquear`,children:l.locked?(0,r.jsx)(et,{}):(0,r.jsx)(nt,{})}),(0,r.jsx)(J,{variant:`soft`,color:l.hidden?`blue`:`gray`,onClick:()=>u({hidden:!l.hidden}),title:l.hidden?`Mostrar`:`Ocultar`,children:l.hidden?(0,r.jsx)(Be,{}):(0,r.jsx)(He,{})}),(0,r.jsx)(Qy,{orientation:`vertical`}),(0,r.jsx)(J,{variant:`soft`,color:`gray`,onClick:a,title:`Copiar`,children:(0,r.jsx)(we,{})}),(0,r.jsx)(J,{variant:`soft`,color:`red`,onClick:i,title:`Excluir`,children:(0,r.jsx)(Xt,{})})]})]}),(0,r.jsx)(Qy,{size:`4`}),(l.type===`text`||l.type===`text-container`)&&(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`2`,weight:`bold`,mb:`2`,as:`div`,children:`Conteúdo`}),(0,r.jsx)(pb,{value:l.content,onChange:e=>u({content:e.target.value}),rows:3,placeholder:`Digite o texto aqui...`})]}),l.type===`image`&&(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`2`,weight:`bold`,mb:`2`,as:`div`,children:`Imagem`}),(0,r.jsxs)(U,{mb:`2`,children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Vínculo de Propriedade`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[l.dataBinding?e.availableProps.find(e=>e.dataName===l.dataBinding)?.name||l.dataBinding:`Nenhum (URL fixa)`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>u({dataBinding:void 0}),children:`Nenhum (URL fixa)`}),e.availableProps.map(e=>(0,r.jsx)(q,{onSelect:()=>u({dataBinding:e.dataName,content:`{{${e.dataName}}}`}),children:e.name},e.dataName)),e.availableProps.length===0&&(0,r.jsx)(q,{disabled:!0,children:`Nenhuma variável disponível`})]})]})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`URL ou {{variável}}`}),(0,r.jsx)(X,{value:l.content,onChange:e=>u({content:e.target.value}),placeholder:`https://... ou {{profilePicture}}`}),(0,r.jsx)(H,{size:`1`,color:`gray`,mt:`1`,as:`div`,children:`Se o valor vinculado for um link/URL válido, a imagem será exibida.`})]})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`2`,weight:`bold`,mb:`2`,as:`div`,children:`Aparência`}),(0,r.jsxs)(W,{direction:`column`,gap:`3`,children:[(l.type===`text`||l.type===`text-container`)&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(K,{columns:`2`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Fonte`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[(0,r.jsx)(`span`,{style:{fontFamily:v},children:v}),(0,r.jsx)(ve,{})]})}),(0,r.jsx)(fy,{style:{zIndex:1e5},children:b.map(e=>(0,r.jsx)(q,{onSelect:()=>d({fontFamily:e}),style:{fontFamily:e},children:e},e))})]})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Peso`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[y===`normal`?`Normal`:y===`bold`?`Negrito`:y===`100`?`Fina`:y===`300`?`Leve`:`Pesada`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>d({fontWeight:`normal`}),children:`Normal`}),(0,r.jsx)(q,{onSelect:()=>{d({fontWeight:`bold`})},children:`Negrito`}),(0,r.jsx)(q,{onSelect:()=>{d({fontWeight:`100`})},children:`Fina`}),(0,r.jsx)(q,{onSelect:()=>{d({fontWeight:`300`})},children:`Leve`}),(0,r.jsx)(q,{onSelect:()=>{d({fontWeight:`900`})},children:`Pesada`})]})]})]})]}),(0,r.jsxs)(U,{children:[(0,r.jsxs)(W,{justify:`between`,mb:`1`,children:[(0,r.jsx)(H,{size:`1`,color:`gray`,children:`Tamanho do Texto`}),(0,r.jsxs)(H,{size:`1`,children:[p,`px`]})]}),(0,r.jsx)(tb,{min:8,max:72,value:[p],onValueChange:e=>d({fontSize:`${e[0]}px`})})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Alinhamento`}),(0,r.jsxs)(W,{gap:`2`,children:[(0,r.jsx)(J,{variant:f===`left`?`solid`:`soft`,color:`gray`,onClick:()=>d({textAlign:`left`}),children:(0,r.jsx)(Wt,{})}),(0,r.jsx)(J,{variant:f===`center`?`solid`:`soft`,color:`gray`,onClick:()=>d({textAlign:`center`}),children:(0,r.jsx)(Bt,{})}),(0,r.jsx)(J,{variant:f===`right`?`solid`:`soft`,color:`gray`,onClick:()=>d({textAlign:`right`}),children:(0,r.jsx)(Kt,{})})]})]}),(0,r.jsxs)(K,{columns:`2`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Estilo`}),(0,r.jsxs)(W,{gap:`1`,children:[(0,r.jsx)(J,{variant:l.style?.fontStyle===`italic`?`solid`:`soft`,color:`gray`,onClick:e=>{e.stopPropagation(),d({fontStyle:l.style?.fontStyle===`italic`?`normal`:`italic`})},title:`Itálico`,children:(0,r.jsx)(Ke,{})}),(0,r.jsx)(J,{variant:l.style?.textDecoration===`underline`?`solid`:`soft`,color:`gray`,onClick:e=>{e.stopPropagation(),d({textDecoration:l.style?.textDecoration===`underline`?`none`:`underline`})},title:`Sublinhado`,children:(0,r.jsx)(Qt,{})}),(0,r.jsx)(J,{variant:l.style?.textDecoration===`line-through`?`solid`:`soft`,color:`gray`,onClick:e=>{e.stopPropagation(),d({textDecoration:l.style?.textDecoration===`line-through`?`none`:`line-through`})},title:`Tachado`,children:(0,r.jsx)(Pt,{})})]})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Transformação`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[(l.style?.textTransform||`none`)===`none`?`Nenhum`:l.style?.textTransform===`uppercase`?`MAIÚSCULA`:l.style?.textTransform===`lowercase`?`minúscula`:`Capitalizada`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>d({textTransform:`none`}),children:`Nenhum`}),(0,r.jsx)(q,{onSelect:()=>d({textTransform:`uppercase`}),children:`MAIÚSCULA`}),(0,r.jsx)(q,{onSelect:()=>d({textTransform:`lowercase`}),children:`minúscula`}),(0,r.jsx)(q,{onSelect:()=>d({textTransform:`capitalize`}),children:`Capitalizada`})]})]})]})]}),(0,r.jsxs)(K,{columns:`2`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Altura da Linha`}),(0,r.jsx)(X,{placeholder:`Normal`,value:l.style?.lineHeight||``,onChange:e=>d({lineHeight:e.target.value||`normal`})})]}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Espaçamento`}),(0,r.jsx)(X,{placeholder:`Normal`,value:l.style?.letterSpacing||``,onChange:e=>d({letterSpacing:e.target.value||`normal`})})]})]}),l.type===`text-container`&&(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Alinhamento Vertical`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[(l.style?.alignItems||`flex-start`)===`flex-start`?`Topo`:l.style?.alignItems===`center`?`Centro`:`Base`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>d({alignItems:`flex-start`}),children:`Topo`}),(0,r.jsx)(q,{onSelect:()=>d({alignItems:`center`}),children:`Centro`}),(0,r.jsx)(q,{onSelect:()=>d({alignItems:`flex-end`}),children:`Base`})]})]})]})]}),l.type===`image`&&(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Ajuste da Imagem`}),(0,r.jsxs)(ly,{children:[(0,r.jsx)(uy,{children:(0,r.jsxs)(G,{variant:`soft`,color:`gray`,style:{width:`100%`,justifyContent:`space-between`},children:[(l.style?.objectFit||`cover`)===`cover`?`Cobrir (Cover)`:l.style?.objectFit===`contain`?`Conter (Contain)`:`Esticar (Fill)`,(0,r.jsx)(ve,{})]})}),(0,r.jsxs)(fy,{style:{zIndex:1e5},children:[(0,r.jsx)(q,{onSelect:()=>d({objectFit:`cover`}),children:`Cobrir (Cover)`}),(0,r.jsx)(q,{onSelect:()=>d({objectFit:`contain`}),children:`Conter (Contain)`}),(0,r.jsx)(q,{onSelect:()=>d({objectFit:`fill`}),children:`Esticar (Fill)`})]})]})]}),(0,r.jsxs)(K,{columns:`2`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Cor de Fundo`}),(0,r.jsx)(nP,{color:l.style?.backgroundColor||`transparent`,onChange:e=>d({backgroundColor:e})})]}),(l.type===`text`||l.type===`text-container`)&&(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Cor do Texto`}),(0,r.jsx)(nP,{color:l.style?.color||`#000000`,onChange:e=>d({color:e})})]})]}),(0,r.jsxs)(U,{children:[(0,r.jsxs)(W,{justify:`between`,mb:`1`,children:[(0,r.jsx)(H,{size:`1`,color:`gray`,children:`Borda (Espessura)`}),(0,r.jsxs)(H,{size:`1`,children:[m,`px`]})]}),(0,r.jsx)(tb,{min:0,max:10,value:[m],onValueChange:e=>d({borderWidth:`${e[0]}px`,borderStyle:e[0]>0?`solid`:`none`,borderColor:l.style?.borderColor||`#000000`})})]}),m>0&&(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`1`,as:`div`,children:`Cor da Borda`}),(0,r.jsx)(nP,{color:l.style?.borderColor||`#000000`,onChange:e=>d({borderColor:e})})]}),(0,r.jsxs)(U,{children:[(0,r.jsxs)(W,{justify:`between`,mb:`1`,children:[(0,r.jsx)(H,{size:`1`,color:`gray`,children:`Cantos Arredondados`}),(0,r.jsxs)(H,{size:`1`,children:[g,`px`]})]}),(0,r.jsx)(tb,{min:0,max:50,value:[g],onValueChange:e=>d({borderRadius:`${e[0]}px`})})]}),(0,r.jsxs)(U,{children:[(0,r.jsxs)(W,{justify:`between`,mb:`1`,children:[(0,r.jsx)(H,{size:`1`,color:`gray`,children:`Opacidade`}),(0,r.jsxs)(H,{size:`1`,children:[_,`%`]})]}),(0,r.jsx)(tb,{min:0,max:100,value:[_],onValueChange:e=>d({opacity:e[0]/100})})]}),(0,r.jsxs)(U,{children:[(0,r.jsxs)(W,{justify:`between`,mb:`1`,children:[(0,r.jsx)(H,{size:`1`,color:`gray`,children:`Espaçamento Interno (Padding)`}),(0,r.jsxs)(H,{size:`1`,children:[h,`px`]})]}),(0,r.jsx)(tb,{min:0,max:40,value:[h],onValueChange:e=>d({padding:`${e[0]}px`})})]})]})]}),(0,r.jsxs)(U,{mt:`2`,pt:`2`,style:{borderTop:`1px solid var(--gray-5)`},children:[(0,r.jsxs)(G,{variant:`ghost`,onClick:()=>s(!o),style:{width:`100%`,justifyContent:`space-between`,color:`var(--gray-11)`,cursor:`pointer`},children:[(0,r.jsx)(W,{align:`center`,gap:`2`,children:(0,r.jsx)(H,{size:`2`,children:`Mais opções`})}),o?(0,r.jsx)(ve,{}):(0,r.jsx)(be,{})]}),o&&(0,r.jsx)(U,{mt:`3`,className:`advanced-properties-content`,children:(0,r.jsx)(rP,{elementId:l.id})})]})]},c)};var rR=e=>{switch(e){case`text`:return`Texto`;case`image`:return`Imagem`;case`box`:return`Caixa / Grupo`;case`text-container`:return`Texto em Caixa`;default:return`Elemento`}};let iR=({onClose:e})=>{let{state:t,addElement:n,groupElements:i}=rS(),a=t.selectedElementIds.length>0,o=t=>{let r={id:`el-${new Date().toISOString()}`,x:20,y:20,width:150,height:40,style:{}};switch(t){case`text`:n({...r,type:`text`,content:`Novo Texto`,width:120,height:30});break;case`image`:n({...r,type:`image`,content:`https://via.placeholder.com/150`,width:150,height:150});break;case`box`:n({...r,type:`box`,content:``,width:200,height:100,style:{border:`1px solid #ccc`}});break;case`text-container`:n({...r,type:`text-container`,content:`Texto em Caixa`,width:150,height:50,style:{backgroundColor:`#f0f0f0`,padding:`10px`}});break;case`separator`:n({...r,type:`box`,content:``,width:300,height:2,style:{backgroundColor:`#000000`}});break;case`timestamp`:n({...r,type:`text`,content:`{{timestamp}}`,width:150,height:30,formatting:{type:`date`,dateFormat:`dd/MM/yyyy HH:mm`}});break;case`badge`:n({...r,type:`text-container`,content:`Badge`,width:80,height:30,style:{backgroundColor:`#007bff`,color:`white`,borderRadius:`15px`,textAlign:`center`,lineHeight:`30px`}});break;case`list-item`:let e=crypto.randomUUID(),t=crypto.randomUUID(),a=crypto.randomUUID(),o=crypto.randomUUID();n({id:e,type:`box`,x:20,y:20,width:300,height:120,style:{backgroundColor:`#ffffff`,border:`1px solid #e0e0e0`,borderRadius:`8px`,boxShadow:`0 2px 4px rgba(0,0,0,0.05)`}}),n({id:t,type:`image`,content:`https://via.placeholder.com/80`,x:35,y:35,width:80,height:80,style:{borderRadius:`4px`}}),n({id:a,type:`text`,content:`Título do Item`,x:130,y:35,width:170,height:24,style:{fontSize:`18px`,fontWeight:`bold`,color:`#333`}}),n({id:o,type:`text`,content:`Descrição curta do item. Adicione detalhes aqui.`,x:130,y:65,width:170,height:40,style:{fontSize:`14px`,color:`#666`}}),setTimeout(()=>{i([e,t,a,o])},100);break}e&&e()};return(0,r.jsxs)(W,{direction:`column`,style:{height:`100%`},children:[(0,r.jsx)(U,{p:`4`,style:{borderBottom:`1px solid var(--gray-5)`,minHeight:`180px`,flexShrink:0,maxHeight:`calc(100vh - 150px)`,overflowY:`auto`},children:a?(0,r.jsx)(nR,{}):(0,r.jsxs)(W,{direction:`column`,align:`center`,justify:`center`,style:{height:`100%`,minHeight:`100px`},gap:`3`,children:[(0,r.jsxs)(H,{size:`2`,color:`gray`,align:`center`,children:[`Selecione um item no desenho`,(0,r.jsx)(`br`,{}),`para editar suas propriedades`]}),(0,r.jsx)(z_,{color:`blue`,variant:`soft`,children:`Dica: Clique no desenho`})]})}),(0,r.jsxs)(sb,{defaultValue:`blocks`,style:{display:`flex`,flexDirection:`column`,flex:1,overflow:`hidden`},children:[(0,r.jsx)(U,{px:`4`,pt:`4`,style:{flexShrink:0},children:(0,r.jsxs)(cb,{children:[(0,r.jsx)(lb,{value:`blocks`,children:`Blocos`}),(0,r.jsx)(lb,{value:`layers`,children:`Conteúdo`}),(0,r.jsx)(lb,{value:`history`,children:`Histórico`})]})}),(0,r.jsx)(Xv,{type:`auto`,scrollbars:`vertical`,style:{flex:1},children:(0,r.jsxs)(U,{p:`4`,children:[(0,r.jsxs)(ub,{value:`blocks`,children:[(0,r.jsx)(H,{size:`2`,weight:`bold`,mb:`2`,as:`div`,children:`Adicionar Elemento`}),(0,r.jsx)(H,{size:`1`,color:`gray`,mb:`3`,as:`div`,children:`Clique para adicionar ao desenho`}),(0,r.jsxs)(K,{columns:`2`,gap:`2`,children:[(0,r.jsx)(aR,{icon:(0,r.jsx)(We,{width:`20`,height:`20`}),label:`Texto`,onClick:()=>o(`text`)}),(0,r.jsx)(aR,{icon:(0,r.jsx)(Xe,{width:`20`,height:`20`}),label:`Imagem`,onClick:()=>o(`image`)}),(0,r.jsx)(aR,{icon:(0,r.jsx)(Ot,{width:`20`,height:`20`}),label:`Caixa / Grupo`,onClick:()=>o(`box`)}),(0,r.jsx)(aR,{icon:(0,r.jsx)(nn,{width:`20`,height:`20`}),label:`Texto em Caixa`,onClick:()=>o(`text-container`)}),(0,r.jsx)(aR,{icon:(0,r.jsx)(Ae,{width:`20`,height:`20`}),label:`Separador`,onClick:()=>o(`separator`)}),(0,r.jsx)(aR,{icon:(0,r.jsx)(Jt,{width:`20`,height:`20`}),label:`Data/Hora`,onClick:()=>o(`timestamp`)}),(0,r.jsx)(aR,{icon:(0,r.jsx)(At,{width:`20`,height:`20`}),label:`Badge / Etiqueta`,onClick:()=>o(`badge`)})]}),(0,r.jsx)(U,{mt:`4`,children:(0,r.jsx)(kP,{})})]}),(0,r.jsx)(ub,{value:`layers`,children:(0,r.jsx)(tR,{})}),(0,r.jsx)(ub,{value:`history`,children:(0,r.jsx)(AP,{onClose:e})})]})})]})]})};var aR=({icon:e,label:t,onClick:n})=>(0,r.jsx)(Ev,{style:{cursor:`pointer`,transition:`all 0.2s`},onClick:n,children:(0,r.jsxs)(W,{direction:`column`,align:`center`,gap:`2`,p:`2`,children:[(0,r.jsx)(U,{style:{color:`var(--accent-9)`},children:e}),(0,r.jsx)(H,{size:`1`,weight:`medium`,align:`center`,children:t})]})});let oR=()=>{let{state:e,setZoom:t,setPan:n}=rS(),{zoom:i,elements:a}=e;return(0,r.jsxs)(W,{align:`center`,gap:`2`,style:{backgroundColor:`var(--color-panel-solid)`,padding:`4px 8px`,borderRadius:`8px`,boxShadow:`0 2px 10px rgba(0,0,0,0.1)`,border:`1px solid var(--gray-6)`},children:[(0,r.jsx)(bb,{content:`Diminuir Zoom (-)`,children:(0,r.jsx)(J,{size:`1`,variant:`ghost`,color:`gray`,onClick:()=>t(Math.max(.1,i-.1)),children:(0,r.jsx)(ct,{})})}),(0,r.jsxs)(H,{size:`1`,style:{width:40,textAlign:`center`,fontVariantNumeric:`tabular-nums`},children:[Math.round(i*100),`%`]}),(0,r.jsx)(bb,{content:`Aumentar Zoom (+)`,children:(0,r.jsx)(J,{size:`1`,variant:`ghost`,color:`gray`,onClick:()=>t(Math.min(5,i+.1)),children:(0,r.jsx)(mt,{})})}),(0,r.jsx)(Qy,{orientation:`vertical`,style:{height:16}}),(0,r.jsx)(bb,{content:`Resetar (100%)`,children:(0,r.jsx)(J,{size:`1`,variant:`ghost`,color:`gray`,onClick:()=>t(1),children:(0,r.jsx)(St,{})})}),(0,r.jsx)(bb,{content:`Ajustar à Tela`,children:(0,r.jsx)(J,{size:`1`,variant:`ghost`,color:`gray`,onClick:()=>{if(a.length===0)return;let e=1/0,r=1/0,i=-1/0,o=-1/0;a.forEach(t=>{e=Math.min(e,t.x),r=Math.min(r,t.y),i=Math.max(i,t.x+t.width),o=Math.max(o,t.y+t.height)});let s=i-e+100,c=o-r+100,l=window.innerWidth<768?0:300,u=window.innerWidth-l,d=window.innerHeight-100,f=u/s,p=d/c,m=Math.min(f,p);m=Math.min(Math.max(m,.1),5),t(m);let h=(e+i)/2,g=(r+o)/2,_=u/2,v=d/2;n({x:_-h*m,y:v-g*m})},children:(0,r.jsx)(N,{})})})]})},sR=({isOpen:e,onClose:n,templates:i,onSelectTemplate:a,initialStep:o=1,onFinishWizard:s,onStartTour:c})=>{let[l,u]=(0,t.useState)(o),[d,f]=(0,t.useState)(null);t.default.useEffect(()=>{e&&o&&u(o)},[e,o]);let p=()=>{l===1&&d?(a(i.find(e=>e.id===d)||null),u(2)):l===2?(n(),c&&c()):l===3&&(s&&s(),n())};return(0,r.jsx)(ny,{open:e,onOpenChange:n,children:(0,r.jsx)(iy,{style:{maxWidth:800},children:(0,r.jsxs)(W,{direction:`column`,gap:`4`,children:[(0,r.jsxs)(W,{justify:`between`,align:`center`,children:[(0,r.jsx)(ay,{children:(0,r.jsxs)(W,{align:`center`,gap:`2`,children:[(0,r.jsx)(it,{}),` Assistente de Criação`]})}),(0,r.jsx)(W,{gap:`2`,children:(0,r.jsx)(cR,{current:l,total:3})})]}),(0,r.jsxs)(U,{children:[l===1&&(0,r.jsxs)(W,{direction:`column`,gap:`4`,children:[(0,r.jsx)(m_,{size:`4`,children:`Passo 1: Escolha um Modelo (Template)`}),(0,r.jsx)(H,{color:`gray`,size:`2`,children:`Comece com um layout pronto e personalize conforme sua necessidade.`}),(0,r.jsxs)(K,{columns:`3`,gap:`3`,children:[i.map(e=>(0,r.jsx)(Ev,{variant:d===e.id?`surface`:`classic`,style:{cursor:`pointer`,border:d===e.id?`2px solid var(--accent-9)`:void 0,backgroundColor:d===e.id?`var(--accent-2)`:void 0},onClick:()=>f(e.id),children:(0,r.jsxs)(W,{direction:`column`,gap:`2`,align:`center`,p:`2`,children:[(0,r.jsx)(U,{style:{width:`100%`,height:100,backgroundColor:`var(--gray-3)`,borderRadius:4,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,r.jsx)(We,{width:32,height:32,color:`var(--gray-8)`})}),(0,r.jsx)(H,{weight:`bold`,size:`2`,children:e.name}),(0,r.jsx)(H,{size:`1`,color:`gray`,align:`center`,children:e.description})]})},e.id)),(0,r.jsx)(Ev,{variant:d===`blank`?`surface`:`classic`,style:{cursor:`pointer`,border:d===`blank`?`2px solid var(--accent-9)`:void 0,backgroundColor:d===`blank`?`var(--accent-2)`:void 0},onClick:()=>f(`blank`),children:(0,r.jsxs)(W,{direction:`column`,gap:`2`,align:`center`,p:`2`,children:[(0,r.jsx)(U,{style:{width:`100%`,height:100,backgroundColor:`var(--gray-3)`,borderRadius:4,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,r.jsx)(U,{style:{width:40,height:40,border:`2px dashed var(--gray-8)`,borderRadius:4}})}),(0,r.jsx)(H,{weight:`bold`,size:`2`,children:`Começar do Zero`}),(0,r.jsx)(H,{size:`1`,color:`gray`,align:`center`,children:`Tela em branco`})]})})]}),(0,r.jsxs)(W,{gap:`3`,mt:`4`,justify:`end`,children:[(0,r.jsx)(G,{variant:`soft`,color:`gray`,onClick:n,children:`Pular Assistente`}),(0,r.jsxs)(G,{onClick:p,disabled:!d,children:[`Continuar `,(0,r.jsx)(j,{})]})]})]}),l===2&&(0,r.jsxs)(W,{direction:`column`,gap:`4`,children:[(0,r.jsx)(m_,{size:`4`,children:`Passo 2: Personalizar Visual`}),(0,r.jsx)(H,{color:`gray`,size:`2`,children:`Agora é sua vez de ajustar o layout. Use as ferramentas disponíveis.`}),(0,r.jsxs)(K,{columns:`2`,gap:`4`,children:[(0,r.jsx)(Ev,{variant:`surface`,children:(0,r.jsxs)(W,{gap:`3`,align:`start`,children:[(0,r.jsx)(U,{style:{padding:8,backgroundColor:`var(--accent-3)`,borderRadius:4},children:(0,r.jsx)(We,{width:20,height:20,color:`var(--accent-9)`})}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{weight:`bold`,size:`2`,as:`div`,children:`Edite Conteúdo`}),(0,r.jsx)(H,{size:`1`,color:`gray`,children:`Clique duas vezes em qualquer texto ou imagem para editar suas propriedades.`})]})]})}),(0,r.jsx)(Ev,{variant:`surface`,children:(0,r.jsxs)(W,{gap:`3`,align:`start`,children:[(0,r.jsx)(U,{style:{padding:8,backgroundColor:`var(--green-3)`,borderRadius:4},children:(0,r.jsx)(it,{width:20,height:20,color:`var(--green-9)`})}),(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{weight:`bold`,size:`2`,as:`div`,children:`Adicione Blocos`}),(0,r.jsx)(H,{size:`1`,color:`gray`,children:`Use a barra lateral esquerda para arrastar novos elementos.`})]})]})})]}),(0,r.jsxs)(W,{gap:`3`,mt:`4`,justify:`end`,children:[(0,r.jsxs)(G,{variant:`soft`,color:`gray`,onClick:()=>u(1),children:[(0,r.jsx)(j,{style:{transform:`rotate(180deg)`}}),` Voltar`]}),(0,r.jsxs)(G,{onClick:p,children:[`Começar a Editar `,(0,r.jsx)(j,{})]})]})]}),l===3&&(0,r.jsxs)(W,{direction:`column`,gap:`4`,children:[(0,r.jsx)(m_,{size:`4`,children:`Passo 3: Testar e Exportar`}),(0,r.jsx)(H,{color:`gray`,size:`2`,children:`Seu layout está pronto? Teste com dados diferentes e exporte o resultado.`}),(0,r.jsx)(Ev,{variant:`surface`,style:{padding:20},children:(0,r.jsxs)(W,{direction:`column`,gap:`3`,align:`center`,children:[(0,r.jsx)(ge,{width:48,height:48,color:`var(--green-9)`}),(0,r.jsx)(m_,{size:`3`,children:`Tudo pronto!`}),(0,r.jsx)(H,{align:`center`,children:`Você completou a criação do layout. Agora você pode salvar, exportar ou continuar editando.`})]})}),(0,r.jsxs)(W,{gap:`3`,mt:`4`,justify:`end`,children:[(0,r.jsx)(G,{variant:`soft`,color:`gray`,onClick:n,children:`Voltar a Editar`}),(0,r.jsxs)(G,{onClick:p,color:`green`,children:[(0,r.jsx)(ge,{}),` Concluir e Exportar`]})]})]})]})]})})})};var cR=({current:e,total:t})=>(0,r.jsx)(W,{gap:`2`,children:[1,2,3].map(n=>(0,r.jsxs)(W,{align:`center`,gap:`1`,children:[(0,r.jsx)(U,{style:{width:24,height:24,borderRadius:`50%`,backgroundColor:n<=e?`var(--accent-9)`:`var(--gray-4)`,color:`white`,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:12,fontWeight:`bold`},children:n<e?(0,r.jsx)(ge,{}):n}),n<t&&(0,r.jsx)(U,{style:{width:20,height:2,backgroundColor:`var(--gray-4)`}})]},n))}),lR=({initialState:e,onSave:n,theme:i=`light`,templates:a,activeTemplateId:o,onTemplateChange:s})=>{let[c,l]=(0,t.useState)(!0),[u,d]=(0,t.useState)(!0),[f,p]=(0,t.useState)(!1),[m,h]=(0,t.useState)(!1),[g,_]=(0,t.useState)(a&&a.length>0?a[0].id:null),v=t.default.useRef(null),[y,b]=(0,t.useState)(!1),[x,S]=(0,t.useState)(1),[C,w]=(0,t.useState)(!1),{addElement:T,loadState:E,state:D,undo:O,redo:k,copy:A,paste:j,removeSelected:M,updateElements:N}=rS(),P=t.default.useRef(!1);t.default.useEffect(()=>{let e=()=>{let e=window.innerWidth<768;h(e),e&&(d(!1),l(!1))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let ee=()=>{let e={elements:D.elements,isList:D.isList,mockData:D.mockData,singleMockData:D.singleMockData,listSettings:D.listSettings,canvasHeight:D.canvasHeight,gridSize:D.gridSize},t=JSON.stringify(e,null,2),n=new Blob([t],{type:`application/json`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`layout-${new Date().toISOString().slice(0,10)}.json`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r)};t.default.useEffect(()=>{let e=e=>{if(document.activeElement?.tagName===`INPUT`||document.activeElement?.tagName===`TEXTAREA`||document.activeElement?.isContentEditable)return;let t=e.clipboardData?.items;if(t){for(let n=0;n<t.length;n++)if(t[n].type.indexOf(`image`)!==-1){e.preventDefault();let r=t[n].getAsFile();if(r){let e=new FileReader;e.onload=e=>{let t=e.target?.result;T({type:`image`,content:t,width:200,height:200})},e.readAsDataURL(r)}}}};return window.addEventListener(`paste`,e),()=>window.removeEventListener(`paste`,e)},[T]),t.default.useEffect(()=>{let e=e=>{if(!(document.activeElement?.tagName===`INPUT`||document.activeElement?.tagName===`TEXTAREA`||document.activeElement?.isContentEditable)){if((e.ctrlKey||e.metaKey)&&e.key===`z`)e.shiftKey?(e.preventDefault(),k()):(e.preventDefault(),O());else if((e.ctrlKey||e.metaKey)&&e.key===`y`)e.preventDefault(),k();else if((e.ctrlKey||e.metaKey)&&e.key===`c`)e.preventDefault(),A();else if((e.ctrlKey||e.metaKey)&&e.key===`v`)e.preventDefault(),j();else if(e.key===`Delete`||e.key===`Backspace`)D.selectedElementIds.length>0&&(e.preventDefault(),M());else if([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`].includes(e.key)&&D.selectedElementIds.length>0){e.preventDefault();let t=e.shiftKey?10:1,n=[];D.selectedElementIds.forEach(r=>{let i=D.elements.find(e=>e.id===r);if(i){let a={};e.key===`ArrowUp`&&(a.y=i.y-t),e.key===`ArrowDown`&&(a.y=i.y+t),e.key===`ArrowLeft`&&(a.x=i.x-t),e.key===`ArrowRight`&&(a.x=i.x+t),n.push({id:r,changes:a})}}),n.length>0&&N(n)}}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[O,k,A,j,M,D.selectedElementIds,D.elements,N]);let[F,te]=(0,t.useState)(!1);t.default.useEffect(()=>{if(e)try{let t=typeof e==`string`?JSON.parse(e):e;Array.isArray(t)?E({elements:t}):t.elements&&E(t)}catch(e){console.error(`Failed to load initial state`,e)}te(!0)},[e,E]),t.default.useEffect(()=>{F&&(P.current||D.elements.length===0&&(P.current=!0,S(1),b(!0)))},[F,D.elements]),t.default.useEffect(()=>{!a||a.length===0||f&&_(o||a[0].id)},[o,f,a]);let I=t.default.useCallback(e=>{if(e)try{let t=typeof e==`string`?JSON.parse(e):e;if(Array.isArray(t)){E({elements:t});return}if(t&&typeof t==`object`&&`elements`in t){E(t);return}}catch(e){console.error(`Failed to apply template`,e)}},[E]);return t.default.useEffect(()=>{if(!a||a.length===0||!o||v.current===o)return;let e=a.find(e=>e.id===o);e&&(I(e.state),v.current=o)},[o,I,a]),(0,r.jsx)(A_,{appearance:i,accentColor:`blue`,grayColor:`slate`,radius:`large`,scaling:`105%`,children:(0,r.jsxs)(W,{direction:`column`,style:{height:`100vh`,width:`100%`,overflow:`hidden`,backgroundColor:`var(--gray-1)`},children:[(0,r.jsx)(LS,{onSave:n,templates:a,setIsTemplatesOpen:p,onFinish:()=>{S(3),b(!0)},onToggleSidebar:()=>d(!u)}),(0,r.jsxs)(W,{direction:`row`,style:{flexGrow:1,overflow:`hidden`},children:[m&&u&&(0,r.jsx)(`div`,{style:{position:`absolute`,top:0,left:0,width:`100%`,height:`100%`,backgroundColor:`rgba(0,0,0,0.5)`,zIndex:90},onClick:()=>d(!1)}),u&&(0,r.jsxs)(W,{id:`sidebar-area`,direction:`column`,width:m?`100%`:`300px`,style:{borderRight:`1px solid var(--gray-5)`,backgroundColor:`var(--gray-1)`,flexShrink:0,height:`100%`,boxShadow:`1px 0 0 var(--gray-4)`,overflow:`hidden`,position:m?`absolute`:`relative`,zIndex:m?100:`auto`,top:0,left:0},children:[m&&(0,r.jsx)(W,{justify:`end`,p:`2`,children:(0,r.jsx)(J,{variant:`ghost`,color:`gray`,onClick:()=>d(!1),children:(0,r.jsx)(Ee,{})})}),(0,r.jsx)(iR,{onClose:()=>{m&&d(!1)}})]}),(0,r.jsxs)(W,{direction:`column`,style:{flex:1,height:`100%`,overflow:`hidden`},children:[(0,r.jsxs)(W,{justify:`between`,align:`center`,px:`3`,py:`2`,style:{borderBottom:`1px solid var(--gray-6)`,backgroundColor:`var(--gray-1)`,flexShrink:0,zIndex:10},children:[(0,r.jsx)(W,{gap:`3`,align:`center`,children:(0,r.jsx)(J,{size:`2`,variant:`ghost`,color:`gray`,onClick:()=>d(!u),title:u?`Ocultar Barra Lateral`:`Mostrar Barra Lateral`,style:{cursor:`pointer`},children:m?(0,r.jsx)(Qe,{}):u?(0,r.jsx)(Me,{}):(0,r.jsx)(Pe,{})})}),(0,r.jsxs)(W,{gap:`3`,align:`center`,children:[(0,r.jsx)(OP,{}),(0,r.jsx)(J,{size:`2`,variant:`ghost`,color:c?`blue`:`gray`,onClick:()=>l(!c),title:c?`Ocultar Preview`:`Mostrar Preview`,style:{cursor:`pointer`},children:c?(0,r.jsx)(He,{}):(0,r.jsx)(Be,{})})]})]}),(0,r.jsx)(U,{style:{flex:1,position:`relative`,overflow:`hidden`},children:(0,r.jsxs)(Kx,{orientation:`horizontal`,style:{height:`100%`,width:`100%`},children:[(!m||!c)&&(0,r.jsx)(Xx,{defaultSize:50,minSize:20,children:(0,r.jsxs)(K,{columns:`20px 1fr`,rows:`20px 1fr`,style:{height:`100%`,width:`100%`,backgroundColor:`var(--color-background)`},children:[(0,r.jsx)(U,{style:{backgroundColor:`var(--gray-2)`,borderRight:`1px solid var(--gray-6)`,borderBottom:`1px solid var(--gray-6)`,zIndex:30}}),(0,r.jsx)(U,{style:{backgroundColor:`var(--gray-2)`,borderBottom:`1px solid var(--gray-6)`,overflow:`hidden`,zIndex:30},children:(0,r.jsx)(EP,{orientation:`horizontal`})}),(0,r.jsx)(U,{style:{backgroundColor:`var(--gray-2)`,borderRight:`1px solid var(--gray-6)`,overflow:`hidden`,zIndex:30},children:(0,r.jsx)(EP,{orientation:`vertical`})}),(0,r.jsxs)(U,{style:{position:`relative`,overflow:`hidden`,width:`100%`,height:`100%`},id:`canvas-area`,children:[(0,r.jsx)(U,{style:{position:`absolute`,top:16,left:`50%`,transform:`translateX(-50%)`,zIndex:20},children:(0,r.jsx)(iS,{})}),(0,r.jsx)(U,{style:{position:`absolute`,bottom:16,right:16,zIndex:20},children:(0,r.jsx)(oR,{})}),(0,r.jsx)(IS,{}),(0,r.jsx)(RS,{})]})]})}),!m&&c&&(0,r.jsx)(Qy,{style:{width:`4px`,backgroundColor:`var(--gray-6)`,cursor:`col-resize`,transition:`background-color 0.2s`}}),c&&(0,r.jsx)(Xx,{defaultSize:50,minSize:20,children:(0,r.jsx)(U,{id:`preview-area`,style:{height:`100%`,width:`100%`,backgroundColor:`var(--gray-3)`,borderLeft:`1px solid var(--gray-5)`},children:(0,r.jsx)(gN,{})})})]})})]})]}),(0,r.jsx)(ny,{open:f,onOpenChange:p,children:(0,r.jsxs)(iy,{style:{maxWidth:450},children:[(0,r.jsx)(ay,{children:`Galeria de Templates`}),(0,r.jsx)(oy,{size:`2`,mb:`4`,children:`Escolha um layout pré-definido para começar.`}),a&&a.length>0?(0,r.jsxs)(W,{direction:`column`,gap:`3`,children:[(0,r.jsxs)(U,{children:[(0,r.jsx)(H,{size:`2`,weight:`bold`,as:`div`,mb:`2`,children:`Selecione o Template`}),(0,r.jsx)(W,{direction:`column`,gap:`2`,children:a.map(e=>(0,r.jsx)(G,{variant:g===e.id?`solid`:`soft`,color:g===e.id?`blue`:`gray`,size:`2`,style:{width:`100%`,justifyContent:`flex-start`,border:g===e.id?`2px solid var(--accent-9)`:void 0},onClick:()=>_(e.id),children:e.name},e.id))})]}),g&&a.find(e=>e.id===g)?.description&&(0,r.jsx)(U,{p:`3`,style:{backgroundColor:`var(--gray-2)`,borderRadius:8},children:(0,r.jsx)(H,{size:`2`,color:`gray`,children:a.find(e=>e.id===g)?.description})}),(0,r.jsxs)(W,{gap:`3`,mt:`4`,justify:`end`,children:[(0,r.jsx)(sy,{children:(0,r.jsx)(G,{variant:`soft`,color:`gray`,children:`Cancelar`})}),(0,r.jsx)(sy,{children:(0,r.jsx)(G,{onClick:()=>{if(!g)return;if(s){s(g);return}let e=a.find(e=>e.id===g);e&&(I(e.state),v.current=g)},children:`Aplicar`})})]})]}):(0,r.jsx)(H,{children:`Nenhum template disponível.`})]})}),(0,r.jsx)(sR,{isOpen:y,onClose:()=>b(!1),templates:a||[],onSelectTemplate:e=>{e&&I(e.state)},onStartTour:()=>w(!0),initialStep:x,onFinishWizard:()=>{ee(),alert(`Layout finalizado e exportado com sucesso!`)}}),(0,r.jsx)(BS,{isOpen:C,onClose:()=>w(!1)}),(0,r.jsx)(SP,{})]})})};let uR=e=>(0,r.jsx)(nS,{isList:e.layout.isList,availableProps:e.layout.props,theme:e.theme,children:(0,r.jsx)(lR,{...e})});var dR=e=>e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,`$1-$2`).toLowerCase(),fR=e=>{let t=/^#([0-9a-fA-F]{8})$/.exec(e);if(!t)return e;let n=t[1];return`rgba(${parseInt(n.slice(0,2),16)}, ${parseInt(n.slice(2,4),16)}, ${parseInt(n.slice(4,6),16)}, ${parseInt(n.slice(6,8),16)/255})`},pR=e=>{if(!e)return``;let t=[`width`,`height`,`top`,`left`,`right`,`bottom`,`fontSize`,`borderRadius`,`padding`,`margin`,`borderWidth`,`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomRightRadius`,`borderBottomLeftRadius`,`minHeight`,`maxHeight`,`minWidth`,`maxWidth`];return Object.entries(e).map(([e,n])=>{if(n==null)return``;let r=dR(e),i=typeof n==`number`&&t.includes(e)?n+`px`:n;return typeof i==`string`&&/^#([0-9a-fA-F]{8})$/.test(i)&&(i=fR(i)),`${r}: ${i}`}).filter(Boolean).join(`; `)},mR=(e,t)=>{let n=/(rgba?\([^)]+\)|#(?:[0-9a-fA-F]{3,8})|[a-zA-Z]+)\s*$/;return!e||e===`none`?`0 4px 12px 0 ${t}`:n.test(e)?e.replace(n,t):`${e} ${t}`},hR=(e,t,n,r,i=1.2)=>{if(!e)return 0;try{let a=document.createElement(`canvas`).getContext(`2d`);if(!a)return 0;a.font=`${r}px ${n}`;let o=String(e).split(`
62
+ `),s=0;for(let e of o){let n=e.split(` `),r=``;if(n.length===1&&n[0]===``){s++;continue}for(let e=0;e<n.length;e++){let i=n[e],o=a.measureText(i).width;if(o>t){r.trim().length>0&&(s++,r=``),s+=Math.ceil(o/t);continue}let c=r+i+` `;a.measureText(c).width>t&&r.trim().length>0?(s++,r=i+` `):r=c}r.length>0&&s++}return Math.ceil(s*r*i)}catch{return 0}},gR=(e,t,n)=>{let r=String(e).toLowerCase(),i=String(n).toLowerCase();switch(t){case`equals`:return r===i;case`notEquals`:return r!==i;case`contains`:return r.includes(i);case`greaterThan`:return parseFloat(r)>parseFloat(i);case`lessThan`:return parseFloat(r)<parseFloat(i);case`truthy`:return!!e;case`falsy`:return!e;default:return!1}},_R=(e,t)=>{if(!t||t.type===`text`)return e==null?``:String(e);if(e==null)return``;if(t.type===`boolean`)return String(e)===`true`||e===!0||typeof e==`number`&&e>0?t.trueLabel||`Sim`:t.falseLabel||`Não`;if(t.type===`date`)try{let n=new Date(e);if(isNaN(n.getTime()))return String(e);if(t.dateFormat){let e=n.getDate().toString().padStart(2,`0`),r=(n.getMonth()+1).toString().padStart(2,`0`),i=n.getFullYear(),a=n.getHours().toString().padStart(2,`0`),o=n.getMinutes().toString().padStart(2,`0`),s=n.getSeconds().toString().padStart(2,`0`);return t.dateFormat.replace(`DD`,e).replace(`MM`,r).replace(`YYYY`,String(i)).replace(`HH`,a).replace(`mm`,o).replace(`ss`,s)}return n.toLocaleDateString()}catch{return String(e)}if(t.type===`number`){let n=parseFloat(e);return isNaN(n)?String(e):t.numberFormat===`currency`?(t.currencySymbol||`R$`)+` `+n.toFixed(t.decimalPlaces||2):t.numberFormat===`percent`?n.toFixed(t.decimalPlaces||0)+`%`:n.toFixed(t.decimalPlaces||0)}return String(e)},vR=e=>{switch(e){case`linear`:return`linear`;case`ease-in`:return`ease-in`;case`ease-out`:return`ease-out`;case`ease-in-out`:return`ease-in-out`;case`bounce`:return`cubic-bezier(0.175, 0.885, 0.32, 1.275)`;default:return`ease-out`}},yR=e=>{if(!e||e.type===`none`)return{};let t=(e.duration||.4)+`s`,n=(e.delay||0)+`s`,r=vR(e.timingFunction),i=e.iterationCount===`infinite`?`infinite`:typeof e.iterationCount==`number`?Math.max(1,e.iterationCount):1;return{animation:`${e.type} ${t} ${r} ${n}`,animationIterationCount:i,animationFillMode:`both`}},bR=(e,t)=>{let n=JSON.parse(JSON.stringify(e)),r=new Map(n.map(e=>[e.id,{...e}])),i=[],a=(e,t)=>{if(e.id===t.id)return!1;let n=.1;return e.x>=t.x-n&&e.x+e.width<=t.x+t.width+n&&e.y>=t.y-n&&e.y+e.height<=t.y+t.height+n};n.forEach(e=>{let o=e.type===`text`,s=e.type===`text-container`;if((o||s)&&e.autoGrow){let o=e.content;o=o.replace(/\{\{(.*?)\}\}/g,(n,r)=>{let i=t[r.trim()];return i==null?n:e.formatting?_R(i,e.formatting):String(i)});let c=parseInt(String(e.style&&e.style.fontSize||16)),l=String(e.style&&e.style.fontFamily||`Arial`);if(s&&e.containerExpansion===`horizontal`)try{let t=document.createElement(`canvas`).getContext(`2d`);if(t){t.font=`${c}px ${l}`;let n=t.measureText(o),r=parseInt(String(e.style&&e.style.padding||0))*2,i=Math.ceil(n.width+r);Math.abs(i-e.width)>1&&(e.width=i,e.content=o)}}catch{}else{let t=0,s=parseInt(String(e.style&&e.style.padding||0)),u=Math.max(1,e.width-s*2),d=/<([a-z]+)([^>]*?)>/i.exec(o);if(d){let e=d[2],n=/height=["']?(\d+)["']?/i.exec(e),r=/height:\s*(\d+)px/i.exec(e);t=n?parseInt(n[1]):r?parseInt(r[1]):hR(o,u,l,c)}else t=hR(o,u,l,c);let f=t+s*2;(!d||d&&!t)&&(f+=4);let p=parseInt(String(e.style&&e.style.minHeight||0)),m=Math.max(f,p),h=e.height,g=m-h;if(Math.abs(g)>1){e.height=m,e.content=o;let t=[],s=r.get(e.id);s&&n.forEach(n=>{if(n.id===e.id)return;let i=r.get(n.id);i&&a(s,i)&&t.push(n)});let c=new Set([e.id]);t.forEach(e=>{e.height+=g,c.add(e.id)}),i.push({triggerY:e.y+h,delta:g,ignoreIds:c})}}}}),n.forEach(e=>{let t=r.get(e.id);if(!t)return;let n=0;i.forEach(r=>{r.ignoreIds.has(e.id)||t.y>=r.triggerY-.1&&(n+=r.delta)}),e.y+=n});let o=0;return n.forEach(e=>{let t=e.y+e.height;t>o&&(o=t)}),{layoutElements:n,maxY:o}},xR=(e,t,n)=>{let{maxY:r}=bR(e,t);return n?Math.max(r,n):r},SR=(e,t,n=0,r=0)=>{let{layoutElements:i}=bR(e,t),a=i,o=e=>{let n=e.content,r=``;if(e.type===`text`||e.type===`text-container`)n=n.replace(/\{\{(.*?)\}\}/g,(n,r)=>{let i=t[r.trim()];return i==null?n:e.formatting?_R(i,e.formatting):String(i)});else if(e.type===`image`)if(e.dataBinding){let i=t[e.dataBinding];r=i==null?n:String(i)}else r=n.replace(/\{\{(.*?)\}\}/g,(e,n)=>{let r=t[n.trim()];return r==null?e:String(r)});let i={};e.conditions&&e.conditions.forEach(e=>{let n=t[e.property];gR(n,e.operator,e.value)&&(i={...i,...e.style})});let a={};e.styleBindings&&Object.entries(e.styleBindings).forEach(([n,r])=>{let o=t[r];o!=null&&(n===`boxShadowColor`?a.boxShadow=mR(i.boxShadow||e.style?.boxShadow,String(o)):a[n]=String(o))});let o={width:e.width,height:e.autoGrow?`auto`:e.height,transform:e.rotation?`rotate(${e.rotation}deg)`:void 0,overflow:e.autoGrow?`visible`:`hidden`,whiteSpace:e.type===`text-container`&&e.autoGrow&&e.containerExpansion===`horizontal`?`nowrap`:e.autoGrow?`pre-wrap`:void 0,wordBreak:e.autoGrow?`break-word`:void 0,...e.type===`text-container`?{display:`flex`,alignItems:e.style?.alignItems||`flex-start`,justifyContent:e.style?.justifyContent||`flex-start`}:{},...e.style,...i,...a,...yR(e.animation),...e.hidden?{display:`none`}:{}};return{content:n,imgSrc:r,baseStyle:o}},s=(e,n,r,i)=>{if(e.type===`text`||e.type===`text-container`)return`<div style="${n}">${r}</div>`;if(e.type===`image`){let t=pR({width:`100%`,height:`100%`,objectFit:e.style?.objectFit||`cover`,display:`block`});return`<div style="${n}"><img src="${(MS(i)?i:`data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7`).replace(/"/g,`&quot;`)}" alt="Element" style="${t}" /></div>`}else if(e.type===`box`)return`<div style="${n}"></div>`;else if(e.type===`checkbox`){let r=!1;if(e.dataBinding){let n=t[e.dataBinding];r=n===!0||String(n)===`true`}return`<div style="${n}; display: flex; align-items: center; justify-content: center;"><input type="checkbox" ${r?`checked`:``} disabled style="width:100%;height:100%;margin:0;" /></div>`}return``};return a.map(e=>{let{content:t,imgSrc:n,baseStyle:i}=o(e);return s(e,pR({...i,position:`absolute`,left:e.x,top:e.y+r}),t,n)}).join(`
63
+ `)},CR=({element:e,itemData:t})=>{let n=e.content,i=``;if(e.type===`text`||e.type===`text-container`)n=n.replace(/\{\{(.*?)\}\}/g,(n,r)=>{let i=t[r.trim()];return i==null?n:e.formatting?_R(i,e.formatting):String(i)});else if(e.type===`image`)if(e.dataBinding){let r=t[e.dataBinding];i=r==null?n:String(r)}else i=n.replace(/\{\{(.*?)\}\}/g,(e,n)=>{let r=t[n.trim()];return r==null?e:String(r)});let a={};e.conditions&&e.conditions.forEach(e=>{let n=t[e.property];gR(n,e.operator,e.value)&&(a={...a,...e.style})});let o={};e.styleBindings&&Object.entries(e.styleBindings).forEach(([n,r])=>{let i=t[r];i!=null&&(n===`boxShadowColor`?o.boxShadow=mR(a.boxShadow||e.style?.boxShadow,String(i)):o[n]=String(i))});let s={position:`absolute`,left:e.x,top:e.y,width:e.width,height:e.autoGrow?`auto`:e.height,transform:e.rotation?`rotate(${e.rotation}deg)`:void 0,overflow:e.autoGrow?`visible`:`hidden`,whiteSpace:e.type===`text-container`&&e.autoGrow&&e.containerExpansion===`horizontal`?`nowrap`:e.autoGrow?`pre-wrap`:void 0,wordBreak:e.autoGrow?`break-word`:void 0,...e.type===`text-container`?{display:`flex`,alignItems:e.style?.alignItems||`flex-start`,justifyContent:e.style?.justifyContent||`flex-start`}:{},...e.style,...a,...o,...yR(e.animation),...e.hidden?{display:`none`}:{}};if(e.type===`text`||e.type===`text-container`)return/<[a-z][\s\S]*>/i.test(n)?(0,r.jsx)(`div`,{style:s,dangerouslySetInnerHTML:{__html:n}}):(0,r.jsx)(`div`,{style:s,children:n});if(e.type===`image`){let t={width:`100%`,height:`100%`,objectFit:e.style?.objectFit||`cover`,display:`block`};return(0,r.jsx)(`div`,{style:s,children:(0,r.jsx)(`img`,{src:MS(i)?i:`data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7`,alt:`Element`,style:t})})}else if(e.type===`box`)return(0,r.jsx)(`div`,{style:s});else if(e.type===`checkbox`){let n=!1;if(e.dataBinding){let r=t[e.dataBinding];n=r===!0||String(r)===`true`}return(0,r.jsx)(`div`,{style:{...s,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,r.jsx)(`input`,{type:`checkbox`,checked:n,disabled:!0,style:{width:`100%`,height:`100%`,margin:0}})})}return null},wR=({elements:e,data:t,options:n})=>{let{isList:i,listSettings:a}=n,o=`
64
64
  @keyframes slideIn {
65
65
  from { opacity: 0; transform: translateY(20px); }
66
66
  to { opacity: 1; transform: translateY(0); }
@@ -125,25 +125,26 @@ For more information, see https://radix-ui.com/primitives/docs/components/${n.do
125
125
  }
126
126
  .list-wrapper::-webkit-scrollbar { width: 6px; }
127
127
  .list-wrapper::-webkit-scrollbar-thumb { background-color: rgba(0,0,0,0.2); border-radius: 3px; }
128
- `;if(i&&Array.isArray(t)){let i=[...t];if(a?.sortProp){let e=a.sortProp,t=a.sortOrder===`asc`?1:-1;i.sort((n,r)=>(n[e]<r[e]?-1:1)*t)}a?.newestPosition===`top`&&i.reverse();let s=a?.newestPosition===`top`?`flex-start`:`flex-end`,c=a?.entryAnimation||{type:`slideIn`,duration:.3,delay:0},l=c.type===`none`?`none`:c.type,u=(c.duration??.3)+`s`,d=(c.delay??0)+`s`,f=gR(c.timingFunction),p={display:`flex`,flexDirection:`column`,justifyContent:s,height:a?.containerHeight?a.containerHeight+`px`:`100%`,width:`100%`,overflowY:`auto`,overflowX:`hidden`,boxSizing:`border-box`,padding:`10px`};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(`style`,{dangerouslySetInnerHTML:{__html:o}}),(0,r.jsx)(`div`,{className:`list-wrapper`,style:p,children:i.map((t,i)=>(0,r.jsx)(`div`,{className:`list-item`,style:{position:`relative`,minHeight:yR(e,t,n.canvasHeight||0),width:`100%`,flexShrink:0,animation:l===`none`?void 0:`${l} ${u} ${f} ${d}`,animationFillMode:l===`none`?void 0:`both`,marginBottom:`10px`},children:(()=>{let{layoutElements:n}=vR(e,t);return(0,r.jsx)(r.Fragment,{children:n.map(e=>(0,r.jsx)(xR,{element:e,itemData:t},e.id))})})()},i))}),a?.scrollDirection===`up`&&(0,r.jsx)(`script`,{dangerouslySetInnerHTML:{__html:`document.addEventListener('DOMContentLoaded', () => { const w = document.querySelector('.list-wrapper'); if(w) w.scrollTop = w.scrollHeight; });`}})]})}let{layoutElements:s}=vR(e,t);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(`style`,{dangerouslySetInnerHTML:{__html:o}}),(0,r.jsx)(`div`,{style:{position:`relative`,width:`100%`,height:`100%`,overflow:`hidden`},children:s.map(e=>(0,r.jsx)(xR,{element:e,itemData:t},e.id))})]})};let CR=(e,t,n={})=>(0,i.renderToStaticMarkup)((0,r.jsx)(SR,{elements:e,data:t,options:n}))+(n.isList?wR(e,n):``);var wR=(e,t)=>`
128
+ `;if(i&&Array.isArray(t)){let i=[...t];if(a?.sortProp){let e=a.sortProp,t=a.sortOrder===`asc`?1:-1;i.sort((n,r)=>(n[e]<r[e]?-1:1)*t)}a?.newestPosition===`top`&&i.reverse();let s=a?.newestPosition===`top`?`flex-start`:`flex-end`,c=a?.entryAnimation||{type:`slideIn`,duration:.3,delay:0},l=c.type===`none`?`none`:c.type,u=(c.duration??.3)+`s`,d=(c.delay??0)+`s`,f=vR(c.timingFunction),p={display:`flex`,flexDirection:`column`,justifyContent:s,height:a?.containerHeight?a.containerHeight+`px`:`100%`,width:`100%`,overflowY:`auto`,overflowX:`hidden`,boxSizing:`border-box`,padding:`10px`};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(`style`,{dangerouslySetInnerHTML:{__html:o}}),(0,r.jsx)(`div`,{className:`list-wrapper`,style:p,children:i.map((t,i)=>(0,r.jsx)(`div`,{className:`list-item`,style:{position:`relative`,minHeight:xR(e,t,n.canvasHeight||0),width:`100%`,flexShrink:0,animation:l===`none`?void 0:`${l} ${u} ${f} ${d}`,animationFillMode:l===`none`?void 0:`both`,marginBottom:`10px`},children:(()=>{let{layoutElements:n}=bR(e,t);return(0,r.jsx)(r.Fragment,{children:n.map(e=>(0,r.jsx)(CR,{element:e,itemData:t},e.id))})})()},i))}),a?.scrollDirection===`up`&&(0,r.jsx)(`script`,{dangerouslySetInnerHTML:{__html:`document.addEventListener('DOMContentLoaded', () => { const w = document.querySelector('.list-wrapper'); if(w) w.scrollTop = w.scrollHeight; });`}})]})}let{layoutElements:s}=bR(e,t);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(`style`,{dangerouslySetInnerHTML:{__html:o}}),(0,r.jsx)(`div`,{style:{position:`relative`,width:`100%`,height:`100%`,overflow:`hidden`},children:s.map(e=>(0,r.jsx)(CR,{element:e,itemData:t},e.id))})]})};let TR=(e,t,n={})=>(0,i.renderToStaticMarkup)((0,r.jsx)(wR,{elements:e,data:t,options:n}))+(n.isList?ER(e,n):``);var ER=(e,t)=>`
129
129
  <script>
130
130
  (function() {
131
131
  try {
132
132
  const elements = ${JSON.stringify(e)};
133
133
 
134
134
  // Helper functions definitions
135
- const camelToKebab = ${lR.toString()};
136
- const hex8ToRgba = ${uR.toString()};
137
- const styleObjectToString = ${dR.toString()};
138
- const applyShadowColor = ${fR.toString()};
139
- const getElementAnimationStyle = ${_R.toString()};
140
- const measureTextHeight = ${pR.toString()};
141
- const checkCondition = ${mR.toString()};
142
- const formatValue = ${hR.toString()};
143
- const getSafeTimingFunction = ${gR.toString()};
144
- const computeLayout = ${vR.toString()};
145
- const computeItemHeight = ${yR.toString()};
146
- const renderItem = ${bR.toString()};
135
+ const isValidImageUrl = ${MS.toString()};
136
+ const camelToKebab = ${dR.toString()};
137
+ const hex8ToRgba = ${fR.toString()};
138
+ const styleObjectToString = ${pR.toString()};
139
+ const applyShadowColor = ${mR.toString()};
140
+ const getElementAnimationStyle = ${yR.toString()};
141
+ const measureTextHeight = ${hR.toString()};
142
+ const checkCondition = ${gR.toString()};
143
+ const formatValue = ${_R.toString()};
144
+ const getSafeTimingFunction = ${vR.toString()};
145
+ const computeLayout = ${bR.toString()};
146
+ const computeItemHeight = ${xR.toString()};
147
+ const renderItem = ${SR.toString()};
147
148
 
148
149
  const itemHeightFallback = ${t.canvasHeight||0};
149
150
  const newestPosition = "${t.listSettings&&t.listSettings.newestPosition||`bottom`}";
@@ -188,4 +189,4 @@ For more information, see https://radix-ui.com/primitives/docs/components/${n.do
188
189
  } catch(e) { console.error("Smart List Init Error", e); }
189
190
  })();
190
191
  <\/script>
191
- `;e.EditorContent=cR,e.generateHTML=CR});
192
+ `;e.EditorContent=uR,e.generateHTML=TR});