polotno 4.1.1 → 4.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/polotno.bundle.js CHANGED
@@ -269,8 +269,8 @@ https://polotno.com/docs/server-api`,Zg={unsplashList:({query:e,page:t=1})=>`${q
269
269
  li, li::before {
270
270
  ${d(i.fill)};
271
271
  }
272
- </style>`),`<div style="${m}" contentEditable dir="${lS(vv(o))}">${Sv(o).replace(/\n/g,`<br/>`)}</div>${h}`}function xS({fontFamily:e,fontSize:t,lineHeight:n}){if(typeof n==`number`)return n;let r=document.createElement(`div`);r.style.fontFamily=e,r.style.fontSize=t+`px`,r.style.lineHeight=n,r.innerText=`Test text`,document.body.appendChild(r);try{return r.offsetHeight/t}finally{document.body.removeChild(r)}}var SS={warm:e=>t=>{let n=t.data;e=Math.max(0,Math.min(1,e));for(let t=0;t<n.length;t+=4)n[t]=Math.min(n[t]+30*e,255),n[t+1]=Math.min(n[t+1]+15*e,255);return t},cold:e=>t=>{let n=t.data;e=Math.max(0,Math.min(1,e));for(let t=0;t<n.length;t+=4)n[t]=Math.min(n[t]-15*e,255),n[t+1]=Math.min(n[t+1]-10*e,255),n[t+2]=Math.min(n[t+2]+15*e,255);return t},natural:e=>t=>{let n=t.data;e=Math.max(0,Math.min(1,e));for(let t=0;t<n.length;t+=4){n[t]=Math.min(n[t]*(1+.1*e),255),n[t+1]=Math.min(n[t+1]*(1+.1*e),255),n[t+2]=Math.min(n[t+2]*(1+.1*e),255);let r=(n[t]+n[t+1]+n[t+2])/3;n[t]=Math.min((n[t]-r)*(1+.2*e)+r,255),n[t+1]=Math.min((n[t+1]-r)*(1+.2*e)+r,255),n[t+2]=Math.min((n[t+2]-r)*(1+.2*e)+r,255)}return t},temperature:e=>t=>{let n=t.data;e=Math.max(-1,Math.min(1,e));for(let t=0;t<n.length;t+=4){let r=n[t];n[t+1];let i=n[t+2];n[t]=Math.min(Math.max(r+15*e,0),255),n[t+2]=Math.min(Math.max(i-15*e,0),255)}return t},contrast:e=>t=>{let n=t.data;e=Math.max(-1,Math.min(1,e));let r=e*100,i=259*(r+255)/(255*(259-r));for(let e=0;e<n.length;e+=4)n[e]=Math.min(Math.max(i*(n[e]-128)+128,0),255),n[e+1]=Math.min(Math.max(i*(n[e+1]-128)+128,0),255),n[e+2]=Math.min(Math.max(i*(n[e+2]-128)+128,0),255);return t},shadows:e=>t=>{let n=t.data;e=Math.max(-1,Math.min(1,e));for(let t=0;t<n.length;t+=4){let r=(n[t]+n[t+1]+n[t+2])/3;if(r<128){let i=1+e*(1-r/128)*2;n[t]=Math.min(Math.max(n[t]*i,0),255),n[t+1]=Math.min(Math.max(n[t+1]*i,0),255),n[t+2]=Math.min(Math.max(n[t+2]*i,0),255)}}return t},white:e=>t=>{let n=t.data;e=Math.max(-1,Math.min(1,e));for(let t=0;t<n.length;t+=4){let r=n[t],i=n[t+1],a=n[t+2],o=(r+i+a)/3;if(o>128){let s=1+e*((o-128)/127);n[t]=Math.min(Math.max(r*s,0),255),n[t+1]=Math.min(Math.max(i*s,0),255),n[t+2]=Math.min(Math.max(a*s,0),255)}}return t},black:e=>t=>{let n=t.data;e=Math.max(-1,Math.min(1,e));for(let t=0;t<n.length;t+=4){let r=n[t],i=n[t+1],a=n[t+2],o=(r+i+a)/3;if(o<128){let s=1+e*((128-o)/128);n[t]=Math.min(Math.max(r*s,0),255),n[t+1]=Math.min(Math.max(i*s,0),255),n[t+2]=Math.min(Math.max(a*s,0),255)}}return t},vibrance:e=>t=>{let n=t.data;e=Math.max(-1,Math.min(1,e));for(let t=0;t<n.length;t+=4){let r=n[t],i=n[t+1],a=n[t+2],o=Math.max(r,i,a),s=(r+i+a)/3,c=o===0?0:(o-s)/o,l=e<0?(1-c)*e*1.5:e*.5;n[t]=Math.min(Math.max(r-(o-r)*l,0),255),n[t+1]=Math.min(Math.max(i-(o-i)*l,0),255),n[t+2]=Math.min(Math.max(a-(o-a)*l,0),255)}return t},saturation:e=>t=>{let n=t.data;e=Math.max(-1,Math.min(1,e));for(let t=0;t<n.length;t+=4){let r=n[t],i=n[t+1],a=n[t+2],o=.2126*r+.7152*i+.0722*a;n[t]=Math.min(Math.max(o+(r-o)*(1+e),0),255),n[t+1]=Math.min(Math.max(o+(i-o)*(1+e),0),255),n[t+2]=Math.min(Math.max(o+(a-o)*(1+e),0),255)}return t}};function CS(e,t){if(!e||!Zp(t))return;let n={filters:[]},r={};t.brightnessEnabled&&(n.filters.push(Ju.Filters.Brighten),n.brightness=t.brightness),t.blurEnabled&&(n.filters.push(Ju.Filters.Blur),n.blurRadius=t.blurRadius,t.type===`text`&&t.lineHeight<1&&(r.offset=t.fontSize)),t.sepiaEnabled&&n.filters.push(Ju.Filters.Sepia),t.grayscaleEnabled&&n.filters.push(Ju.Filters.Grayscale),t.filters.forEach((e,t)=>{let r=SS[t];r&&n.filters.push(r(e.intensity))}),e.setAttrs(n),n.filters.length?e.cache({...r,pixelRatio:t.store._elementsPixelRatio}):e.clearCache(),e.getLayer()?.batchDraw()}var wS=()=>window.innerWidth<=800||typeof document<`u`&&!!document.querySelector(`.polotno-mobile`),TS=e=>`
273
- @media (max-width: 800px) {
272
+ </style>`),`<div style="${m}" contentEditable dir="${lS(vv(o))}">${Sv(o).replace(/\n/g,`<br/>`)}</div>${h}`}function xS({fontFamily:e,fontSize:t,lineHeight:n}){if(typeof n==`number`)return n;let r=document.createElement(`div`);r.style.fontFamily=e,r.style.fontSize=t+`px`,r.style.lineHeight=n,r.innerText=`Test text`,document.body.appendChild(r);try{return r.offsetHeight/t}finally{document.body.removeChild(r)}}var SS={warm:e=>t=>{let n=t.data;e=Math.max(0,Math.min(1,e));for(let t=0;t<n.length;t+=4)n[t]=Math.min(n[t]+30*e,255),n[t+1]=Math.min(n[t+1]+15*e,255);return t},cold:e=>t=>{let n=t.data;e=Math.max(0,Math.min(1,e));for(let t=0;t<n.length;t+=4)n[t]=Math.min(n[t]-15*e,255),n[t+1]=Math.min(n[t+1]-10*e,255),n[t+2]=Math.min(n[t+2]+15*e,255);return t},natural:e=>t=>{let n=t.data;e=Math.max(0,Math.min(1,e));for(let t=0;t<n.length;t+=4){n[t]=Math.min(n[t]*(1+.1*e),255),n[t+1]=Math.min(n[t+1]*(1+.1*e),255),n[t+2]=Math.min(n[t+2]*(1+.1*e),255);let r=(n[t]+n[t+1]+n[t+2])/3;n[t]=Math.min((n[t]-r)*(1+.2*e)+r,255),n[t+1]=Math.min((n[t+1]-r)*(1+.2*e)+r,255),n[t+2]=Math.min((n[t+2]-r)*(1+.2*e)+r,255)}return t},temperature:e=>t=>{let n=t.data;e=Math.max(-1,Math.min(1,e));for(let t=0;t<n.length;t+=4){let r=n[t];n[t+1];let i=n[t+2];n[t]=Math.min(Math.max(r+15*e,0),255),n[t+2]=Math.min(Math.max(i-15*e,0),255)}return t},contrast:e=>t=>{let n=t.data;e=Math.max(-1,Math.min(1,e));let r=e*100,i=259*(r+255)/(255*(259-r));for(let e=0;e<n.length;e+=4)n[e]=Math.min(Math.max(i*(n[e]-128)+128,0),255),n[e+1]=Math.min(Math.max(i*(n[e+1]-128)+128,0),255),n[e+2]=Math.min(Math.max(i*(n[e+2]-128)+128,0),255);return t},shadows:e=>t=>{let n=t.data;e=Math.max(-1,Math.min(1,e));for(let t=0;t<n.length;t+=4){let r=(n[t]+n[t+1]+n[t+2])/3;if(r<128){let i=1+e*(1-r/128)*2;n[t]=Math.min(Math.max(n[t]*i,0),255),n[t+1]=Math.min(Math.max(n[t+1]*i,0),255),n[t+2]=Math.min(Math.max(n[t+2]*i,0),255)}}return t},white:e=>t=>{let n=t.data;e=Math.max(-1,Math.min(1,e));for(let t=0;t<n.length;t+=4){let r=n[t],i=n[t+1],a=n[t+2],o=(r+i+a)/3;if(o>128){let s=1+e*((o-128)/127);n[t]=Math.min(Math.max(r*s,0),255),n[t+1]=Math.min(Math.max(i*s,0),255),n[t+2]=Math.min(Math.max(a*s,0),255)}}return t},black:e=>t=>{let n=t.data;e=Math.max(-1,Math.min(1,e));for(let t=0;t<n.length;t+=4){let r=n[t],i=n[t+1],a=n[t+2],o=(r+i+a)/3;if(o<128){let s=1+e*((128-o)/128);n[t]=Math.min(Math.max(r*s,0),255),n[t+1]=Math.min(Math.max(i*s,0),255),n[t+2]=Math.min(Math.max(a*s,0),255)}}return t},vibrance:e=>t=>{let n=t.data;e=Math.max(-1,Math.min(1,e));for(let t=0;t<n.length;t+=4){let r=n[t],i=n[t+1],a=n[t+2],o=Math.max(r,i,a),s=(r+i+a)/3,c=o===0?0:(o-s)/o,l=e<0?(1-c)*e*1.5:e*.5;n[t]=Math.min(Math.max(r-(o-r)*l,0),255),n[t+1]=Math.min(Math.max(i-(o-i)*l,0),255),n[t+2]=Math.min(Math.max(a-(o-a)*l,0),255)}return t},saturation:e=>t=>{let n=t.data;e=Math.max(-1,Math.min(1,e));for(let t=0;t<n.length;t+=4){let r=n[t],i=n[t+1],a=n[t+2],o=.2126*r+.7152*i+.0722*a;n[t]=Math.min(Math.max(o+(r-o)*(1+e),0),255),n[t+1]=Math.min(Math.max(o+(i-o)*(1+e),0),255),n[t+2]=Math.min(Math.max(o+(a-o)*(1+e),0),255)}return t}};function CS(e,t){if(!e||!Zp(t))return;let n={filters:[]},r={};t.brightnessEnabled&&(n.filters.push(Ju.Filters.Brighten),n.brightness=t.brightness),t.blurEnabled&&(n.filters.push(Ju.Filters.Blur),n.blurRadius=t.blurRadius,t.type===`text`&&t.lineHeight<1&&(r.offset=t.fontSize)),t.sepiaEnabled&&n.filters.push(Ju.Filters.Sepia),t.grayscaleEnabled&&n.filters.push(Ju.Filters.Grayscale),t.filters.forEach((e,t)=>{let r=SS[t];r&&n.filters.push(r(e.intensity))}),e.setAttrs(n),n.filters.length?e.cache({...r,pixelRatio:t.store._elementsPixelRatio}):e.clearCache(),e.getLayer()?.batchDraw()}var wS=()=>window.innerWidth<768||typeof document<`u`&&!!document.querySelector(`.polotno-mobile`),TS=e=>`
273
+ @media (width < 768px) {
274
274
  ${e}
275
275
  }
276
276
 
@@ -612,7 +612,7 @@ code, pre, kbd, samp { font-size: inherit; }</style>`;function eF(e){return yoe+
612
612
  transform-origin: left top;
613
613
  overflow: hidden;
614
614
  `,MV=[.1,.2,.5,1,2,5,10,20,25,50,100,200,500,1e3,2e3,5e3,1e4],NV=30,PV=e=>MV.find(t=>e(t)>NV)||1e4,FV=W(({store:e,width:t,height:n,pageSizes:r,layout:i=`vertical`,renderOnlyActivePage:a})=>{let{rulerStyle:o}=mp(),s=x.useRef(null);if(!e.activePage)return null;let c=i===`horizontal`,l=e.activePage;e.bleedVisible&&l.bleed;let u=l.computedWidth*e.scale,d=l.computedHeight*e.scale,f=(t-u)/2,p=(n-d)/2,m=PV(t=>Ey({unitVal:t,dpi:e.dpi,unit:e.unit})*e.scale),h=Ey({unitVal:m,dpi:e.dpi,unit:e.unit})*e.scale,g=Math.round(u/h)+1,_=Math.round(d/h)+1,v=Ob(e.selectedShapes),{backgroundColor:y,textColor:b,borderColor:S,borderSize:C,tickColor:w,tickSize:T}=o;return(0,J.jsx)(DV,{ref:s,className:`polotno-rulers`,style:{display:`flex`,flexDirection:`column`},children:c?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,position:`sticky`,top:0,zIndex:1},children:[(0,J.jsx)(`div`,{className:`polotno-ruler-corner`,style:{width:`14px`,height:`14px`,flexShrink:0,marginRight:`-14px`,boxSizing:`border-box`,backgroundColor:y,borderRight:`${C}px solid ${S}`,borderBottom:`${C}px solid ${S}`,position:`sticky`,left:0,zIndex:2}}),(a?[e.activePage]:e.pages).map((n,i)=>{if(!n)return null;let a=r?r[i]:t,o=(a-n.computedWidth*e.scale)/2;return(0,J.jsxs)(OV,{style:{width:a+`px`,flexShrink:0,position:`relative`,backgroundColor:y,color:b,borderBottom:`${C}px solid ${S}`},className:`polotno-x-ruler`,children:[[...Array(g)].map((t,n)=>(0,J.jsx)(AV,{className:`polotno-ruler-tick`,style:{left:o+n*h+`px`,width:h+`px`,borderLeft:`${T}px solid ${w}`},children:e.unit===`px`||m>=1?Math.round(m*n):(m*n).toFixed(1)},n)),e.selectedShapes[0]?.page===n&&(0,J.jsx)(`div`,{className:`polotno-ruler-selection`,style:{position:`absolute`,left:o+v.x*e.scale+`px`,height:`14px`,width:v.width*e.scale,backgroundColor:`rgba(0,0,0,0.15)`}})]},n.id)})]}),(0,J.jsxs)(kV,{style:{height:n+`px`,position:`sticky`,left:0,marginTop:`-14px`,backgroundColor:y,color:b,borderRight:`${C}px solid ${S}`},className:`polotno-y-ruler`,children:[[...Array(_)].map((t,n)=>(0,J.jsx)(jV,{className:`polotno-ruler-tick`,style:{top:p+n*h+`px`,width:h+`px`,borderLeft:`${T}px solid ${w}`},children:e.unit===`px`||m>=1?Math.round(m*n):(m*n).toFixed(1)},n)),!!e.selectedShapes.length&&(0,J.jsx)(`div`,{className:`polotno-ruler-selection`,style:{position:`absolute`,top:p+v.y*e.scale+`px`,width:`14px`,height:v.height*e.scale,backgroundColor:`rgba(0,0,0,0.15)`}})]})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(OV,{style:{width:t+`px`,backgroundColor:y,color:b,borderBottom:`${C}px solid ${S}`},className:`polotno-x-ruler`,children:[[...Array(g)].map((t,n)=>(0,J.jsx)(AV,{className:`polotno-ruler-tick`,style:{left:f+n*h+`px`,width:h+`px`,borderLeft:`${T}px solid ${w}`},children:e.unit===`px`||m>=1?Math.round(m*n):(m*n).toFixed(1)},n)),!!e.selectedShapes.length&&(0,J.jsx)(`div`,{className:`polotno-ruler-selection`,style:{position:`absolute`,left:f+v.x*e.scale+`px`,height:`14px`,width:v.width*e.scale,backgroundColor:`rgba(0,0,0,0.15)`}})]}),(a?[e.activePage]:e.pages).map((t,i)=>{if(!t)return null;let a=r?r[i]:n,o=(a-t.computedHeight*e.scale)/2,s=i===0?14:0;return(0,J.jsxs)(kV,{style:{height:a-s+`px`,backgroundColor:y,color:b,borderRight:`${C}px solid ${S}`},className:`polotno-y-ruler`,children:[[...Array(_)].map((t,n)=>(0,J.jsx)(jV,{className:`polotno-ruler-tick`,style:{top:o+n*h-s+`px`,width:h+`px`,borderLeft:`${T}px solid ${w}`},children:e.unit===`px`||m>=1?Math.round(m*n):(m*n).toFixed(1)},n)),e.selectedShapes[0]?.page===t&&(0,J.jsx)(`div`,{className:`polotno-ruler-selection`,style:{position:`absolute`,top:o+v.y*e.scale-s+`px`,width:`14px`,height:v.height*e.scale,backgroundColor:`rgba(0,0,0,0.15)`}})]},t.id)})]})})});function IV(e){let[t,n]=x.useState(null),[r,i]=x.useState(`loading`);return x.useEffect(()=>{let t=new Audio(e),r=()=>{i(`loaded`),n(t)},a=()=>{i(`failed`),n(null)};return t.addEventListener(`canplay`,r),t.addEventListener(`error`,a),()=>{t.removeEventListener(`canplay`,r),t.removeEventListener(`error`,a)}},[e]),[t,r]}var LV=W(({audio:e,store:t})=>{let[n,r]=IV(e.src);return x.useEffect(()=>{n&&t.history.ignore(()=>{e.set({duration:n.duration*1e3})})},[n,e,t.history]),x.useEffect(()=>{if(!n)return;let r=()=>{n.currentTime=e.startTime*e.duration/1e3},i=()=>{let t=e.endTime*e.duration/1e3;n.currentTime>=t&&(n.pause(),n.currentTime=e.startTime*e.duration/1e3)};n.addEventListener(`ended`,r),n.addEventListener(`timeupdate`,i);let a=nr(()=>{let r=t.animatedElementsIds;if(r.length&&!r.includes(e.id))return;let i=t.currentTime-e.delay,a=e.speed,o=e.duration*(e.endTime-e.startTime),s=i>=0&&i<e.visibleDuration;if(t.isPlaying&&t.animatedElementsIds.length===0&&s)n.volume=e.volume,n.playbackRate=a,n.preservesPitch=!1,n.paused&&n.play();else{n.pause();return}let c=i*a%o/1e3+e.startTime*e.duration/1e3,l=n.currentTime;Math.abs(l-c)>.5&&c!==l&&(n.currentTime=c)});return()=>{n.pause(),n.removeEventListener(`ended`,r),n.removeEventListener(`timeupdate`,i),a()}},[t.isPlaying,e.startTime,e.endTime,e.volume,e.speed,n]),null}),RV={data:[],pageId:``},zV=`polotno_clipboard`,BV=(e,t)=>{RV={data:JSON.parse(JSON.stringify(e)),pageId:t||``};try{localStorage.setItem(zV,JSON.stringify(e)),localStorage.setItem(`polotno_clipboard_page`,t||``)}catch{}},VV=()=>{try{let e=localStorage.getItem(zV),t=localStorage.getItem(`polotno_clipboard_page`);if(e)return{data:JSON.parse(e),pageId:t}}catch{}return RV},HV=e=>{e.selectedElements.length!==0&&BV(e.selectedElements.map(e=>e.toJSON()),e.activePage?.id)},UV=e=>{BV(e.selectedElements.map(e=>e.toJSON()),e.activePage?.id);let t=e.selectedElements.filter(e=>e.removable).map(e=>e.id);e.deleteElements(t)},WV=e=>{e.history.transaction(()=>{let t=0,n=0,{data:r,pageId:i}=VV();if(i===e.activePage?.id)t=e.width/20,n=e.height/20;else{let i=[];hx({children:r},e=>{e.type!==`group`&&i.push(e)});let a=Ob(i);a.maxX>e.width&&(t=-a.minX),a.maxY>e.height&&(n=-a.minY)}let a=[];hx({children:r},e=>{delete e.id,e.type!==`group`&&(e.x+=t,e.y+=n)}),r.forEach(t=>{let n=e.activePage?.addElement(t);n&&a.push(n.id)}),BV(r,e.activePage?.id),e.selectElements(a)})};function GV(e,t){let n=[];e.forEach(e=>{if(e.removable===!1)return;let t=e.clone();e.type===`group`?t.children.forEach(e=>{e.set({x:e.x+50,y:e.y+50})}):t.set({x:e.x+50,y:e.y+50}),n.push(t.id)}),t.selectElements(n)}var KV=e=>{if(e.type!==`group`)return Db(e);let t=1/0,n=1/0,r=-1/0,i=-1/0;return e.children.forEach(e=>{let a=KV(e);t=Math.min(t,a.x),n=Math.min(n,a.y),r=Math.max(r,a.x+a.width),i=Math.max(i,a.y+a.height)}),{x:t,y:n,width:r-t,height:i-n}},qV=(e,t,n)=>{if(e.type!==`group`){let r=Db(e),i=t-r.x,a=n-r.y;e.set({x:e.x+i,y:e.y+a})}else{let r=t-KV(e).x,i=n-KV(e).y;e.children.forEach(e=>{let t=KV(e);qV(e,t.x+r,t.y+i)})}};function JV(e){let t=e.activePage?.computedWidth;e.selectedElements.forEach(e=>{t=Math.min(t,KV(e).x)}),e.selectedElements.length===1&&(t=0),e.selectedElements.forEach(e=>{let n=KV(e);qV(e,n.x-n.x+t,n.y)})}function YV(e){let t=0;e.selectedElements.forEach(e=>{let n=KV(e);t=Math.max(t,n.x+n.width)}),e.selectedElements.length===1&&(t=e.activePage?.computedWidth),e.selectedElements.forEach(e=>{let n=KV(e);qV(e,t-n.width,n.y)})}function XV(e){let t=e.activePage?.computedHeight;e.selectedElements.forEach(e=>{t=Math.min(t,KV(e).y)}),e.selectedElements.length===1&&(t=0),e.selectedElements.forEach(e=>{let n=KV(e);qV(e,n.x,n.y-n.y+t)})}function ZV(e){let t=e.activePage?.computedHeight,n=0;e.selectedElements.forEach(e=>{let r=KV(e);t=Math.min(t,r.y),n=Math.max(n,r.y+r.height)});let r=(n+t)/2;e.selectedElements.length===1&&(r=e.activePage?.computedHeight/2),e.selectedElements.forEach(e=>{let t=KV(e);qV(e,t.x,r-t.height/2)})}function QV(e){let t=0;e.selectedElements.forEach(e=>{let n=KV(e);t=Math.max(t,n.y+n.height)}),e.selectedElements.length===1&&(t=e.activePage?.computedHeight),e.selectedElements.forEach(e=>{let n=KV(e);qV(e,n.x,t-n.height)})}function $V(e){let t=e.activePage?.computedWidth,n=0;e.selectedElements.forEach(e=>{let r=KV(e);t=Math.min(t,r.x),n=Math.max(n,r.x+r.width)});let r=(n+t)/2;e.selectedElements.length===1&&(r=e.activePage?.computedWidth/2),e.selectedElements.forEach(e=>{let t=KV(e);qV(e,r-t.width/2,t.y)})}var eH=`rgba(191, 191, 191, 100)`;function tH(e){if(e.selectedElements.length!==1)return null;let t=e.selectedElements[0];return t.type===`table`?t:null}function nH(e,t,n){let r=e.getCell(t,n);r&&e.focusCell(r.id)}function rH(e,t,n){let r=e.getCell(t,n);r&&e.enterCellEdit(r.id)}function iH(e){let t=e.cells.find(t=>t.id===e._anchorCellId);if(!t)return null;let n=e.focusedCells;if(n.length<=1)return{row:t.row,col:t.col};let r=1/0,i=-1,a=1/0,o=-1;for(let e of n)e.row<r&&(r=e.row),e.row>i&&(i=e.row),e.col<a&&(a=e.col),e.col>o&&(o=e.col);return{row:t.row===r?i:r,col:t.col===a?o:a}}function aH(e,t,n){let r=t._focusedCellIds.length>0,i=!!t._editingCellId;if(!r&&!i)return!1;if(i){if(e.key===`Escape`)return e.preventDefault(),t.exitCellEdit(),!0;if(e.key===`Tab`){e.preventDefault();let n=t.editingCell;if(t.exitCellEdit(),n)if(e.shiftKey){let e=n.col-1,r=n.row;e<0&&(--r,e=t.cols-1),r<0&&(r=t.rows-1,e=t.cols-1),rH(t,r,e)}else{let e=n.col+1,r=n.row;e>=t.cols&&(r+=1,e=0),r>=t.rows&&(r=0,e=0),rH(t,r,e)}return!0}if(e.metaKey||e.ctrlKey){let n=t.editingCell;if(n){if(e.key===`b`)return e.preventDefault(),n.set({fontWeight:n.fontWeight===`bold`?`normal`:`bold`}),!0;if(e.key===`i`)return e.preventDefault(),n.set({fontStyle:n.fontStyle===`italic`?`normal`:`italic`}),!0;if(e.key===`u`){e.preventDefault();let t=n.textDecoration.split(` `).filter(Boolean),r=t.includes(`underline`);return n.set({textDecoration:r?t.filter(e=>e!==`underline`).join(` `):[...t,`underline`].join(` `)}),!0}}}return!0}if(e.key===`Escape`)return e.preventDefault(),t.clearCellFocus(),!0;let a=t.focusedCells[0];if(!a)return!1;let o=a.row,s=a.col;if(e.key===`Enter`)return e.preventDefault(),t.enterCellEdit(a.id),!0;if(e.key===`Tab`){if(e.preventDefault(),e.shiftKey){let e=s-1,n=o;e<0&&(--n,e=t.cols-1),n<0&&(n=t.rows-1,e=t.cols-1),nH(t,n,e)}else{let e=s+1,n=o;e>=t.cols&&(n+=1,e=0),n>=t.rows&&(n=0,e=0),nH(t,n,e)}return!0}if(e.key===`ArrowRight`||e.key===`ArrowLeft`||e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),e.shiftKey){let n=iH(t)||{row:o,col:s},r=n.row,i=n.col;e.key===`ArrowRight`&&(i=Math.min(n.col+1,t.cols-1)),e.key===`ArrowLeft`&&(i=Math.max(n.col-1,0)),e.key===`ArrowDown`&&(r=Math.min(n.row+1,t.rows-1)),e.key===`ArrowUp`&&(r=Math.max(n.row-1,0)),t.focusCellRange(r,i)}else e.key===`ArrowRight`&&nH(t,o,Math.min(s+1,t.cols-1)),e.key===`ArrowLeft`&&nH(t,o,Math.max(s-1,0)),e.key===`ArrowDown`&&nH(t,Math.min(o+1,t.rows-1),s),e.key===`ArrowUp`&&nH(t,Math.max(o-1,0),s);return!0}let c=e.ctrlKey||e.metaKey;if(!c&&!e.shiftKey&&!e.altKey&&(e.key===`Delete`||e.key===`Backspace`))return e.preventDefault(),t.focusedCells.forEach(e=>{e.set({text:``})}),!0;if(c&&e.shiftKey&&!e.altKey&&e.code===`Equal`){e.preventDefault();let r=t.getFocusedCellRange(),i=r?r.maxRow+1:o+1;return n.history.transaction(()=>{t.addRow(i)}),!0}if(c&&e.shiftKey&&e.altKey&&e.code===`Equal`){e.preventDefault();let r=t.getFocusedCellRange(),i=r?r.maxCol+1:s+1;return n.history.transaction(()=>{t.addColumn(i)}),!0}if(c&&!e.shiftKey&&e.code===`Backspace`){let r=t.getFocusedCellRange();if(r&&r.minCol===0&&r.maxCol===t.cols-1&&t.rows>1)return e.preventDefault(),n.history.transaction(()=>{t.removeRowRange(r.minRow,r.maxRow)}),!0}if(c&&e.shiftKey&&e.code===`Backspace`){let r=t.getFocusedCellRange();if(r&&r.minRow===0&&r.maxRow===t.rows-1&&t.cols>1)return e.preventDefault(),n.history.transaction(()=>{t.removeColumnRange(r.minCol,r.maxCol)}),!0}if(c&&e.code===`KeyC`){e.preventDefault();let n=t.focusedCells.map(e=>vv(e.text));return navigator.clipboard.writeText(n.join(`
615
- `)),!0}return c&&e.code===`KeyV`?(e.preventDefault(),navigator.clipboard.readText().then(e=>{let n=t.focusedCells[0];n&&n.set({text:e})}),!0):c&&e.code===`KeyA`?(e.preventDefault(),t.cells.forEach(e=>{t.focusCell(e.id,!0)}),!0):!1}function oH(e,t){if(t.role===Dw.VIEWER)return;let n=document.activeElement,r=document.querySelector(`.polotno-workspace-container`),i=n?.tagName===`INPUT`||n?.tagName===`TEXTAREA`||!!n?.isContentEditable,a=!!(n&&r?.contains(n)),o=i&&!a,s=tH(t);if(!o&&s&&aH(e,s,t)||i)return;let c=document.activeElement===r||a;if(!c){let e=window.getSelection();if(e&&e.toString().length>0)return}if(e.key===`Alt`){let n=r;(c||t.distanceGuidesVisible||n&&n.matches(`:hover`))&&e.preventDefault();return}let l=t.selectedElements.filter(e=>e.removable).map(e=>e.id);(e.keyCode===46||e.keyCode===8)&&t.deleteElements(l);let u=e.ctrlKey||e.metaKey,d=e.shiftKey,f=e.altKey;if(e.key===`Escape`){e.preventDefault(),t.tool===`draw`?t.setTool(`selection`):t.selectElements([]);return}if(u&&!d&&(e.key.toLowerCase()===`z`||e.key.toLowerCase()===`y`)&&(e.preventDefault(),t.history.undo()),u&&d&&(e.key.toLowerCase()===`z`||e.key.toLowerCase()===`y`)&&(e.preventDefault(),t.history.redo()),u&&e.code===`KeyA`){e.preventDefault();let n=(t.activePage?.children.filter(e=>e.selectable))?.map(e=>e.id)||[];t.selectElements(n)}if(u&&e.code===`KeyC`&&(e.preventDefault(),HV(t)),u&&e.code===`KeyX`&&(e.preventDefault(),UV(t)),u&&e.code===`KeyV`&&(e.preventDefault(),WV(t)),e.code===`ArrowDown`){e.preventDefault();let n=e.shiftKey?10:1;t.selectedShapes.forEach(e=>{e.draggable&&e.set({y:e.y+n})})}if(e.code===`ArrowUp`){e.preventDefault();let n=e.shiftKey?10:1;t.selectedShapes.forEach(e=>{e.draggable&&e.set({y:e.y-n})})}if(e.code===`ArrowLeft`){e.preventDefault();let n=e.shiftKey?10:1;t.selectedShapes.forEach(e=>{e.draggable&&e.set({x:e.x-n})})}if(e.code===`ArrowRight`){e.preventDefault();let n=e.shiftKey?10:1;t.selectedShapes.forEach(e=>{e.draggable&&e.set({x:e.x+n})})}if(u&&e.code===`KeyG`){e.preventDefault();let n=t.selectedElements[0];if(n&&n.type===`group`){let e=n;t.ungroupElements([e.id])}else t.groupElements(t.selectedElements.map(e=>e.id))}if(u&&e.code===`KeyD`&&(e.preventDefault(),GV(t.selectedElements,t)),e.code===`KeyT`&&!u){e.preventDefault();let n=t.width/2,r=t.width/2-n/2,i=t.height/2-30/2,a=(t.width+t.height)/2160;t.activePage?.addElement({type:`text`,x:r,y:i,width:n,fontSize:30*a,text:`Sample Text`,fontFamily:`Roboto`})}if(e.code===`KeyR`&&!u){e.preventDefault();let n={type:`figure`,x:t.width/4,y:t.height/4,width:300,height:300,fill:eH,stroke:`#0c0c0c`,strokeWidth:0,subType:`rect`};t.activePage?.addElement(n)}if(e.code===`KeyL`&&!u){e.preventDefault();let n=(t.activePage?.computedWidth??0)/3,r={type:`line`,x:(t.activePage?.computedWidth??0)/2-n/2,y:(t.activePage?.computedHeight??0)/2,width:n,color:eH};t.activePage?.addElement(r)}if(e.code===`KeyO`&&!u){e.preventDefault(),e.preventDefault();let n={type:`figure`,x:t.width/4,y:t.height/4,width:300,height:300,fill:eH,stroke:`#0c0c0c`,strokeWidth:0,subType:`circle`};t.activePage?.addElement(n)}u&&e.code===`Equal`&&(e.preventDefault(),t.setScale(t.scale+.1)),u&&e.code===`Minus`&&(e.preventDefault(),t.setScale(t.scale-.1)),f&&(e.code===`KeyA`&&(e.preventDefault(),JV(t)),e.code===`KeyD`&&(e.preventDefault(),YV(t)),e.code===`KeyS`&&(e.preventDefault(),QV(t)),e.code===`KeyW`&&(e.preventDefault(),XV(t)),e.code===`KeyV`&&(e.preventDefault(),ZV(t)),e.code===`KeyH`&&(e.preventDefault(),$V(t))),e.code===`BracketRight`&&(e.preventDefault(),t.selectedElements.forEach(e=>u?e.moveUp():e.moveTop())),e.code===`BracketLeft`&&(e.preventDefault(),t.selectedElements.forEach(e=>u?e.moveDown():e.moveBottom()))}var sH=It({toolbar:{duration:`Duration`,opacity:`Opacity`,effects:`Effects`,blur:`Blur`,curvedText:`Curved text`,curvePower:`Power`,temperature:`Temperature`,saturation:`Saturation`,contrast:`Contrast`,shadows:`Shadows`,white:`White`,black:`Black`,vibrance:`Vibrance`,textBackground:`Background`,backgroundCornerRadius:`Corner radius`,backgroundOpacity:`Opacity`,backgroundPadding:`Padding`,brightness:`Brightness`,filters:`Filters`,sepia:`Sepia`,grayscale:`Grayscale`,cold:`Cold`,natural:`Natural`,warm:`Warm`,textStroke:`Text Stroke`,shadow:`Shadow`,border:`Border`,cornerRadius:`Corner Radius`,copyStyle:`Copy style`,uppercase:`Uppercase`,position:`Position`,layering:`Layering`,toForward:`To Front`,up:`Forward`,down:`Backward`,toBottom:`To back`,alignLeft:`Align left`,alignCenter:`Align center`,alignRight:`Align right`,alignTop:`Align top`,alignMiddle:`Align middle`,alignBottom:`Align bottom`,flip:`Flip`,flipHorizontally:`Flip horizontally`,flipVertically:`Flip vertically`,fitToBackground:`Fit to page`,removeBackground:`Remove background`,removeBackgroundTitle:`Remove background from image`,cancelRemoveBackground:`Cancel`,confirmRemoveBackground:`Confirm`,crop:`Crop`,cropDone:`Done`,cropCancel:`Cancel`,clip:`Apply mask`,removeClip:`Remove mask`,removeMask:`Remove mask`,transparency:`Transparency`,lockedDescription:`Object is locked. Unlock it to allow changes from canvas.`,unlockedDescription:`Object is unlocked. Lock it to prevent changes from canvas.`,removeElements:`Remove elements`,duplicateElements:`Duplicate elements`,download:`Download`,saveAsImage:`Save as image`,saveAsPDF:`Save as PDF`,lineHeight:`Line height`,letterSpacing:`Letter spacing`,offsetX:`Offset X`,offsetY:`Offset Y`,color:`Color`,selectable:`Selectable`,draggable:`Draggable`,removable:`Removable`,resizable:`Resizable`,contentEditable:`Can change content`,styleEditable:`Can change style`,alwaysOnTop:`Always on top`,showInExport:`Show in export`,ungroupElements:`Ungroup`,groupElements:`Group`,lineSize:`Line size`,fade:`Fade`,move:`Move`,zoom:`Zoom`,animate:`Animate`,rotate:`Rotate`,none:`None`,bounce:`Bounce`,blink:`Blink`,strength:`Strength`,spaceEvenly:`Space evenly`,horizontalDistribution:`Horizontally`,verticalDistribution:`Vertically`,strokeWidth:`Stroke Width`,strokeSettings:`Stroke settings`,spacing:`Spacing`,volume:`Volume`,speed:`Speed`,lineStyle:`Line style`,lineStartHead:`Line start`,lineEndHead:`Line end`,textDirection:`Text direction`,fontSize:`Font size`,fontFamily:`Font family`,fontFamilyMixed:`Mixed`,fontsInSelection:`Fonts in selection`,textAlign:`Text align`,verticalAlign:`Vertical align`,bold:`Bold`,italic:`Italic`,underline:`Underline`,strikethrough:`Strikethrough`,cellBackground:`Cell background`,tableBorderSettings:`Border settings`,tableBorderColor:`Border color`,tableBorderWidth:`Border width`,tableBorderStyle:`Border style`,borderModeAll:`All borders`,borderModeOuter:`Outer borders`,borderModeInner:`Inner borders`,borderModeBottomOnly:`Bottom only`,borderModeTopOnly:`Top only`,borderModeLeftOnly:`Left only`,borderModeRightOnly:`Right only`,borderModeInnerHorizontal:`Inner horizontal`,borderModeInnerVertical:`Inner vertical`,tableStructure:`Table structure`,tableRows:`Rows`,tableColumns:`Columns`,insertRowAbove:`Insert row above`,insertRowBelow:`Insert row below`,deleteRow:`Delete row`,insertColumnLeft:`Insert column left`,insertColumnRight:`Insert column right`,deleteColumn:`Delete column`,deleteRows:`Delete rows`,deleteColumns:`Delete columns`,distributeRowsEvenly:`Distribute rows evenly`,distributeColumnsEvenly:`Distribute columns evenly`,cellPadding:`Cell padding`,listFormat:`List`,colorPicker:{solid:`Solid`,linear:`Linear`,angle:`Angle`,colors:`Colors`,resetColors:`Reset`,recolorAll:`Recolor all`},aiText:{aiWrite:`AI write`,rewrite:`Rewrite`,shorten:`Shorten`,continue:`Continue writing`,proofread:`Proofread`,tones:`Tones`,friendly:`Friendly`,professional:`Professional`,humorous:`Humorous`,formal:`Formal`,customPrompt:`Custom prompt`,generatedResult:`Generated result`,cancel:`Cancel`,generate:`Generate`,back:`Back`,tryAgain:`Try Again`,insert:`Insert`,promptPlaceholder:`Describe what you want to generate`}},workspace:{noPages:`There are no pages yet...`,addPage:`Add page`,removePage:`Remove page`,duplicatePage:`Duplicate page`,moveUp:`Move up`,moveDown:`Move down`,moveLeft:`Move left`,moveRight:`Move right`},scale:{reset:`Reset`},error:{removeBackground:`Ops! Something went wrong. Background can not be removed.`},sidePanel:{templates:`Templates`,searchTemplatesWithSameSize:`Show templates with the same size`,searchPlaceholder:`Search...`,otherFormats:`Other formats`,noResults:`No results`,error:`Loading is failed...`,text:`Text`,uploadFont:`Upload font`,myFonts:`My fonts`,photos:`Photos`,videos:`Videos`,animations:`Animations`,effects:`Effects`,elements:`Elements`,shapes:`Shapes`,tables:`Tables`,lines:`Lines`,draw:`Draw`,upload:`Upload`,uploadImage:`Add file`,uploadTip:`Upload your assets`,background:`Background`,resize:`Resize`,layers:`Layers`,animate:`Animate`,layerTypes:{image:`Image`,text:`Text`,svg:`SVG`,line:`Line`,figure:`Figure`,group:`Group`},layersTip:`Elements on your active page:`,noLayers:`No elements on the page...`,namePlaceholder:`Type element name...`,useMagicResize:`Use magic resize`,clipImage:`Mask image`,width:`Width`,height:`Height`,units:`Units`,magicResizeDescription:`Magic resize will automatically resize and move all elements on the canvas`,headerText:`Header`,createHeader:`Create header`,subHeaderText:`Sub Header`,createSubHeader:`Create sub header`,bodyText:`Body text`,createBody:`Create body text`},pagesTimeline:{pages:`Pages`,removePage:`Remove page`,addPage:`Add page`,duplicatePage:`Duplicate page`,removeAudio:`Remove audio`,duplicateAudio:`Duplicate audio`,muteAudio:`Mute`,unmuteAudio:`Unmute`,volume:`Volume`,speed:`Speed`},contextMenu:{duplicate:`Duplicate`,remove:`Remove`,lock:`Lock`,unlock:`Unlock`,copy:`Copy`,paste:`Paste`,copyStyle:`Copy style`,moveUp:`Move up`,moveDown:`Move down`,moveBack:`Move back`,moveForward:`Move forward`}});function cH(e,t){var n=t.split(`.`),r=e,i;for(i=0;i<n.length;++i)if(r[n[i]]==null)return;else r=r[n[i]];return r}var lH=e=>e&&typeof e==`object`;function uH(e,t){Object.keys(t).forEach(n=>{let r=e[n],i=t[n];lH(i)&&lH(r)?uH(r,i):e[n]=i})}function dH(e,t,n=``){Object.keys(t).forEach(r=>{let i=t[r],a=n?`${n}.${r}`:r;lH(i)?lH(e[r])?dH(e[r],i,a):console.warn(`Missing nested translation object at '${a}'`):e[r]===void 0&&console.warn(`Missing translation '${a}'`)})}var fH=Qn((e,{validate:t=!1}={})=>{t&&dH(e,sH),uH(sH,e)}),pH=()=>Wr(sH),mH={},Q=e=>{let t=cH(sH,e);if(t!==void 0)return t;mH[e]||(mH[e]=!0,console.warn(`Missing translation '${e}'`));let n=e.split(`.`),r=n[n.length-1]||` `;return r.charAt(0).toUpperCase()+r.slice(1)},hH=(e,t,n)=>Math.max(t,Math.min(n,e)),gH=(e,t)=>Math.sqrt((t.clientX-e.clientX)**2+(t.clientY-e.clientY)**2),_H=`Polotno warning: <Workspace /> component can not automatically detect its size.
615
+ `)),!0}return c&&e.code===`KeyV`?(e.preventDefault(),navigator.clipboard.readText().then(e=>{let n=t.focusedCells[0];n&&n.set({text:e})}),!0):c&&e.code===`KeyA`?(e.preventDefault(),t.cells.forEach(e=>{t.focusCell(e.id,!0)}),!0):!1}function oH(e,t){if(t.role===Dw.VIEWER)return;let n=document.activeElement,r=document.querySelector(`.polotno-workspace-container`),i=n?.tagName===`INPUT`||n?.tagName===`TEXTAREA`||!!n?.isContentEditable,a=!!(n&&r?.contains(n)),o=i&&!a,s=tH(t);if(!o&&s&&aH(e,s,t)||i)return;let c=document.activeElement===r||a;if(!c){let e=window.getSelection();if(e&&e.toString().length>0)return}if(e.key===`Alt`){let n=r;(c||t.distanceGuidesVisible||n&&n.matches(`:hover`))&&e.preventDefault();return}let l=t.selectedElements.filter(e=>e.removable).map(e=>e.id);(e.keyCode===46||e.keyCode===8)&&t.deleteElements(l);let u=e.ctrlKey||e.metaKey,d=e.shiftKey,f=e.altKey;if(e.key===`Escape`){e.preventDefault(),t.tool===`draw`?t.setTool(`selection`):t.selectElements([]);return}if(u&&!d&&e.key.toLowerCase()===`z`){e.preventDefault(),t.history.undo();return}if(u&&(d&&e.key.toLowerCase()===`z`||e.key.toLowerCase()===`y`)){e.preventDefault(),t.history.redo();return}if(u&&e.code===`KeyA`){e.preventDefault();let n=(t.activePage?.children.filter(e=>e.selectable))?.map(e=>e.id)||[];t.selectElements(n)}if(u&&e.code===`KeyC`&&(e.preventDefault(),HV(t)),u&&e.code===`KeyX`&&(e.preventDefault(),UV(t)),u&&e.code===`KeyV`&&(e.preventDefault(),WV(t)),e.code===`ArrowDown`){e.preventDefault();let n=e.shiftKey?10:1;t.selectedShapes.forEach(e=>{e.draggable&&e.set({y:e.y+n})})}if(e.code===`ArrowUp`){e.preventDefault();let n=e.shiftKey?10:1;t.selectedShapes.forEach(e=>{e.draggable&&e.set({y:e.y-n})})}if(e.code===`ArrowLeft`){e.preventDefault();let n=e.shiftKey?10:1;t.selectedShapes.forEach(e=>{e.draggable&&e.set({x:e.x-n})})}if(e.code===`ArrowRight`){e.preventDefault();let n=e.shiftKey?10:1;t.selectedShapes.forEach(e=>{e.draggable&&e.set({x:e.x+n})})}if(u&&e.code===`KeyG`){e.preventDefault();let n=t.selectedElements[0];if(n&&n.type===`group`){let e=n;t.ungroupElements([e.id])}else t.groupElements(t.selectedElements.map(e=>e.id))}if(u&&e.code===`KeyD`&&(e.preventDefault(),GV(t.selectedElements,t)),e.code===`KeyT`&&!u){e.preventDefault();let n=t.width/2,r=t.width/2-n/2,i=t.height/2-30/2,a=(t.width+t.height)/2160;t.activePage?.addElement({type:`text`,x:r,y:i,width:n,fontSize:30*a,text:`Sample Text`,fontFamily:`Roboto`})}if(e.code===`KeyR`&&!u){e.preventDefault();let n={type:`figure`,x:t.width/4,y:t.height/4,width:300,height:300,fill:eH,stroke:`#0c0c0c`,strokeWidth:0,subType:`rect`};t.activePage?.addElement(n)}if(e.code===`KeyL`&&!u){e.preventDefault();let n=(t.activePage?.computedWidth??0)/3,r={type:`line`,x:(t.activePage?.computedWidth??0)/2-n/2,y:(t.activePage?.computedHeight??0)/2,width:n,color:eH};t.activePage?.addElement(r)}if(e.code===`KeyO`&&!u){e.preventDefault(),e.preventDefault();let n={type:`figure`,x:t.width/4,y:t.height/4,width:300,height:300,fill:eH,stroke:`#0c0c0c`,strokeWidth:0,subType:`circle`};t.activePage?.addElement(n)}u&&e.code===`Equal`&&(e.preventDefault(),t.setScale(t.scale+.1)),u&&e.code===`Minus`&&(e.preventDefault(),t.setScale(t.scale-.1)),f&&(e.code===`KeyA`&&(e.preventDefault(),JV(t)),e.code===`KeyD`&&(e.preventDefault(),YV(t)),e.code===`KeyS`&&(e.preventDefault(),QV(t)),e.code===`KeyW`&&(e.preventDefault(),XV(t)),e.code===`KeyV`&&(e.preventDefault(),ZV(t)),e.code===`KeyH`&&(e.preventDefault(),$V(t))),e.code===`BracketRight`&&(e.preventDefault(),t.selectedElements.forEach(e=>u?e.moveUp():e.moveTop())),e.code===`BracketLeft`&&(e.preventDefault(),t.selectedElements.forEach(e=>u?e.moveDown():e.moveBottom()))}var sH=It({toolbar:{duration:`Duration`,opacity:`Opacity`,effects:`Effects`,blur:`Blur`,curvedText:`Curved text`,curvePower:`Power`,temperature:`Temperature`,saturation:`Saturation`,contrast:`Contrast`,shadows:`Shadows`,white:`White`,black:`Black`,vibrance:`Vibrance`,textBackground:`Background`,backgroundCornerRadius:`Corner radius`,backgroundOpacity:`Opacity`,backgroundPadding:`Padding`,brightness:`Brightness`,filters:`Filters`,sepia:`Sepia`,grayscale:`Grayscale`,cold:`Cold`,natural:`Natural`,warm:`Warm`,textStroke:`Text Stroke`,shadow:`Shadow`,border:`Border`,cornerRadius:`Corner Radius`,copyStyle:`Copy style`,uppercase:`Uppercase`,position:`Position`,layering:`Layering`,toForward:`To Front`,up:`Forward`,down:`Backward`,toBottom:`To back`,alignLeft:`Align left`,alignCenter:`Align center`,alignRight:`Align right`,alignTop:`Align top`,alignMiddle:`Align middle`,alignBottom:`Align bottom`,flip:`Flip`,flipHorizontally:`Flip horizontally`,flipVertically:`Flip vertically`,fitToBackground:`Fit to page`,removeBackground:`Remove background`,removeBackgroundTitle:`Remove background from image`,cancelRemoveBackground:`Cancel`,confirmRemoveBackground:`Confirm`,crop:`Crop`,cropDone:`Done`,cropCancel:`Cancel`,clip:`Apply mask`,removeClip:`Remove mask`,removeMask:`Remove mask`,transparency:`Transparency`,lockedDescription:`Object is locked. Unlock it to allow changes from canvas.`,unlockedDescription:`Object is unlocked. Lock it to prevent changes from canvas.`,removeElements:`Remove elements`,duplicateElements:`Duplicate elements`,download:`Download`,saveAsImage:`Save as image`,saveAsPDF:`Save as PDF`,lineHeight:`Line height`,letterSpacing:`Letter spacing`,offsetX:`Offset X`,offsetY:`Offset Y`,color:`Color`,selectable:`Selectable`,draggable:`Draggable`,removable:`Removable`,resizable:`Resizable`,contentEditable:`Can change content`,styleEditable:`Can change style`,alwaysOnTop:`Always on top`,showInExport:`Show in export`,ungroupElements:`Ungroup`,groupElements:`Group`,lineSize:`Line size`,fade:`Fade`,move:`Move`,zoom:`Zoom`,animate:`Animate`,rotate:`Rotate`,none:`None`,bounce:`Bounce`,blink:`Blink`,strength:`Strength`,spaceEvenly:`Space evenly`,horizontalDistribution:`Horizontally`,verticalDistribution:`Vertically`,strokeWidth:`Stroke Width`,strokeSettings:`Stroke settings`,spacing:`Spacing`,volume:`Volume`,speed:`Speed`,lineStyle:`Line style`,lineStartHead:`Line start`,lineEndHead:`Line end`,textDirection:`Text direction`,fontSize:`Font size`,fontFamily:`Font family`,fontFamilyMixed:`Mixed`,fontsInSelection:`Fonts in selection`,textAlign:`Text align`,verticalAlign:`Vertical align`,bold:`Bold`,italic:`Italic`,underline:`Underline`,strikethrough:`Strikethrough`,cellBackground:`Cell background`,tableBorderSettings:`Border settings`,tableBorderColor:`Border color`,tableBorderWidth:`Border width`,tableBorderStyle:`Border style`,borderModeAll:`All borders`,borderModeOuter:`Outer borders`,borderModeInner:`Inner borders`,borderModeBottomOnly:`Bottom only`,borderModeTopOnly:`Top only`,borderModeLeftOnly:`Left only`,borderModeRightOnly:`Right only`,borderModeInnerHorizontal:`Inner horizontal`,borderModeInnerVertical:`Inner vertical`,tableStructure:`Table structure`,tableRows:`Rows`,tableColumns:`Columns`,insertRowAbove:`Insert row above`,insertRowBelow:`Insert row below`,deleteRow:`Delete row`,insertColumnLeft:`Insert column left`,insertColumnRight:`Insert column right`,deleteColumn:`Delete column`,deleteRows:`Delete rows`,deleteColumns:`Delete columns`,distributeRowsEvenly:`Distribute rows evenly`,distributeColumnsEvenly:`Distribute columns evenly`,cellPadding:`Cell padding`,listFormat:`List`,colorPicker:{solid:`Solid`,linear:`Linear`,angle:`Angle`,colors:`Colors`,resetColors:`Reset`,recolorAll:`Recolor all`},aiText:{aiWrite:`AI write`,rewrite:`Rewrite`,shorten:`Shorten`,continue:`Continue writing`,proofread:`Proofread`,tones:`Tones`,friendly:`Friendly`,professional:`Professional`,humorous:`Humorous`,formal:`Formal`,customPrompt:`Custom prompt`,generatedResult:`Generated result`,cancel:`Cancel`,generate:`Generate`,back:`Back`,tryAgain:`Try Again`,insert:`Insert`,promptPlaceholder:`Describe what you want to generate`}},workspace:{noPages:`There are no pages yet...`,addPage:`Add page`,removePage:`Remove page`,duplicatePage:`Duplicate page`,moveUp:`Move up`,moveDown:`Move down`,moveLeft:`Move left`,moveRight:`Move right`},scale:{reset:`Reset`},error:{removeBackground:`Ops! Something went wrong. Background can not be removed.`},sidePanel:{templates:`Templates`,searchTemplatesWithSameSize:`Show templates with the same size`,searchPlaceholder:`Search...`,otherFormats:`Other formats`,noResults:`No results`,error:`Loading is failed...`,text:`Text`,uploadFont:`Upload font`,myFonts:`My fonts`,photos:`Photos`,videos:`Videos`,animations:`Animations`,effects:`Effects`,elements:`Elements`,shapes:`Shapes`,tables:`Tables`,lines:`Lines`,draw:`Draw`,upload:`Upload`,uploadImage:`Add file`,uploadTip:`Upload your assets`,background:`Background`,resize:`Resize`,layers:`Layers`,animate:`Animate`,layerTypes:{image:`Image`,text:`Text`,svg:`SVG`,line:`Line`,figure:`Figure`,group:`Group`},layersTip:`Elements on your active page:`,noLayers:`No elements on the page...`,namePlaceholder:`Type element name...`,useMagicResize:`Use magic resize`,clipImage:`Mask image`,width:`Width`,height:`Height`,units:`Units`,magicResizeDescription:`Magic resize will automatically resize and move all elements on the canvas`,headerText:`Header`,createHeader:`Create header`,subHeaderText:`Sub Header`,createSubHeader:`Create sub header`,bodyText:`Body text`,createBody:`Create body text`},pagesTimeline:{pages:`Pages`,removePage:`Remove page`,addPage:`Add page`,duplicatePage:`Duplicate page`,removeAudio:`Remove audio`,duplicateAudio:`Duplicate audio`,muteAudio:`Mute`,unmuteAudio:`Unmute`,volume:`Volume`,speed:`Speed`},contextMenu:{duplicate:`Duplicate`,remove:`Remove`,lock:`Lock`,unlock:`Unlock`,copy:`Copy`,paste:`Paste`,copyStyle:`Copy style`,moveUp:`Move up`,moveDown:`Move down`,moveBack:`Move back`,moveForward:`Move forward`}});function cH(e,t){var n=t.split(`.`),r=e,i;for(i=0;i<n.length;++i)if(r[n[i]]==null)return;else r=r[n[i]];return r}var lH=e=>e&&typeof e==`object`;function uH(e,t){Object.keys(t).forEach(n=>{let r=e[n],i=t[n];lH(i)&&lH(r)?uH(r,i):e[n]=i})}function dH(e,t,n=``){Object.keys(t).forEach(r=>{let i=t[r],a=n?`${n}.${r}`:r;lH(i)?lH(e[r])?dH(e[r],i,a):console.warn(`Missing nested translation object at '${a}'`):e[r]===void 0&&console.warn(`Missing translation '${a}'`)})}var fH=Qn((e,{validate:t=!1}={})=>{t&&dH(e,sH),uH(sH,e)}),pH=()=>Wr(sH),mH={},Q=e=>{let t=cH(sH,e);if(t!==void 0)return t;mH[e]||(mH[e]=!0,console.warn(`Missing translation '${e}'`));let n=e.split(`.`),r=n[n.length-1]||` `;return r.charAt(0).toUpperCase()+r.slice(1)},hH=(e,t,n)=>Math.max(t,Math.min(n,e)),gH=(e,t)=>Math.sqrt((t.clientX-e.clientX)**2+(t.clientY-e.clientY)**2),_H=`Polotno warning: <Workspace /> component can not automatically detect its size.
616
616
  Width or height of parent elements is equal 0.
617
617
  Please make sure it has non-zero size. You may need to adjust it with your styles. <Workspace /> will automatically fit into parent container.
618
618
  For simpler debugging here is the log of the parent element:`,vH=(e,t,n,r,i)=>{let a=x.useRef(0),o=x.useRef(0),s=x.useRef(null),c=x.useRef(null),l=x.useRef(!1),u=x.useRef(r.pages.length);l.current=u.current!==r.pages.length,u.current=r.pages.length,x.useEffect(()=>{let t=e.current,n=()=>{a.current=t.scrollLeft,o.current=t.scrollTop,s.current=t.scrollWidth,c.current=t.scrollHeight};return t.addEventListener(`scroll`,n),n(),()=>{t.removeEventListener(`scroll`,n)}},[]),x.useLayoutEffect(()=>{if(!e.current)return;if(l.current){let t=e.current;s.current=t.scrollWidth,c.current=t.scrollHeight,a.current=t.scrollLeft,o.current=t.scrollTop;return}let t=e.current,n=s.current,r=c.current;if(n===null||r===null){s.current=t.scrollWidth,c.current=t.scrollHeight,a.current=t.scrollLeft,o.current=t.scrollTop;return}i.current=!0;let u=t.offsetWidth,d=t.offsetHeight,f=(a.current+u/2)/n,p=(o.current+d/2)/r,m=Math.max(0,t.scrollWidth-u),h=Math.max(0,t.scrollHeight-d);t.scrollLeft=hH(f*t.scrollWidth-u/2,0,m),t.scrollTop=hH(p*t.scrollHeight-d/2,0,h),s.current=t.scrollWidth,c.current=t.scrollHeight,a.current=t.scrollLeft,o.current=t.scrollTop},[n,t])},yH=({element:e,scrollTop:t,scrollLeft:n,duration:r=300,onFinish:i=()=>{}})=>{let a=t!==void 0,o=a?e.scrollTop:e.scrollLeft,s=a?t:n,c=s-o,l=0,u=!1;if(r===0)return a?e.scrollTop=s:e.scrollLeft=s,()=>{};let d=()=>{if(u)return;l+=20;let t=f(l,o,c,r);a?e.scrollTop=t:e.scrollLeft=t,l<r?setTimeout(d,20):i()},f=(e,t,n,r)=>(e/=r/2,e<1?n/2*e*e+t:(e--,-n/2*(e*(e-2)-1)+t));return d(),()=>{u=!0}},bH=(e,t,n,r,i,a,o,s,c,l)=>{let u=x.useRef(!1),d=x.useRef(null),f=x.useRef(!1),p=c===`horizontal`;x.useEffect(()=>{let t=e.current,n=()=>{o.current};return t.addEventListener(`scroll`,n),()=>{t.removeEventListener(`scroll`,n)}},[]);let m=r.pages.indexOf(r.activePage);return x.useLayoutEffect(()=>{if(s||!r.activePage||!e.current||u.current)return;let a=e.current,o=r.pages.indexOf(r.activePage),c=t[o]||0,d=p?a.scrollLeft:a.scrollTop,m=p?a.scrollWidth-a.clientWidth:a.scrollHeight-a.clientHeight,h=Math.min(c,Math.max(0,m)),g=n[o]||n[0]||0,_=()=>{};return(Math.abs(h-d)>g*i||f.current)&&(f.current=!0,_=yH({element:a,...p?{scrollLeft:h}:{scrollTop:h},onFinish:()=>{f.current=!1,l?.()},duration:r.isPlaying?0:300})),_},[r.activePage,m,r.isPlaying,s,c,t,n]),{handleScroll:e=>{if(s||f.current)return;u.current=!0,clearTimeout(d.current),d.current=setTimeout(()=>{u.current=!1},300);let n=(p?e.currentTarget.scrollLeft:e.currentTarget.scrollTop)+(p?a.width:a.height)/3,i=0;for(let e=t.length-1;e>=0;e--)if(n>=t[e]){i=e;break}let o=r.pages[i];o&&r.activePage!==o&&o.select()}}},xH=({store:e})=>(0,J.jsxs)(`div`,{style:{position:`absolute`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,textAlign:`center`},children:[(0,J.jsx)(`p`,{children:Q(`workspace.noPages`)}),(0,J.jsx)(`button`,{onClick:()=>{e.addPage()},children:Q(`workspace.addPage`)})]}),SH=({width:e,height:t,xPadding:n,yPadding:r,backgroundColor:i})=>(0,J.jsx)(`div`,{style:{width:e+`px`,height:t+`px`,backgroundColor:i,paddingLeft:n+`px`,paddingRight:n+`px`,paddingTop:r+`px`,paddingBottom:r+`px`,flexShrink:0},children:(0,J.jsx)(`div`,{style:{width:` 100%`,height:`100%`,backgroundColor:`white`}})}),CH=W(({store:e,layout:t=`vertical`,pageControlsEnabled:n,backgroundColor:r,transparencyBackgroundColor:i,pageBorderColor:a,activePageBorderColor:o,bleedColor:s,snapGuideStroke:c,snapGuideStrokeWidth:l,snapGuideDash:u,selectionRectFill:d,selectionRectStroke:f,selectionRectStrokeWidth:p,transformLabelFill:m,transformLabelTextFill:h,cropOverlayFill:g,transformerStyle:_,innerImageCropTransformerStyle:v,outerImageCropTransformerStyle:y,highlighterStyle:b,mediaLoadingStyle:S,mediaErrorStyle:C,textOverflowIndicatorStyle:w,distanceGuideStroke:T,distanceLabelFill:E,distanceLabelTextFill:D,rulerBackgroundColor:O,rulerTextColor:k,rulerBorderColor:A,rulerBorderSize:j,rulerTickColor:M,rulerTickSize:N,components:P,onKeyDown:F,paddingX:I,paddingY:L,pageGap:ee,altCloneEnabled:R=!0,groupSelectionMode:z=`drill`,visiblePagesOffset:B,renderOnlyActivePage:V,scrollToPageThreshold:H=.5,tooltipSafeArea:te})=>{let U=t===`horizontal`,ne=I??20,re=L??55,[ie,ae]=x.useState({width:100,height:100}),oe=x.useRef(ie),se=x.useRef(null),ce=x.useRef(null),le=x.useRef(0),ue=e.bleedVisible?Math.max(0,...e.pages.map(e=>e.bleed)):0,de=Math.max(...e.pages.map(e=>e.computedWidth)),fe=Math.max(...e.pages.map(e=>e.computedHeight)),pe=e.activePage?.computedHeight||0,me=de+ue*2,he=(V?pe:fe)+ue*2,ge=async({skipTimeout:t}={skipTimeout:!1})=>{if(t||await new Promise(e=>setTimeout(e,50)),se.current===null||!Number.isFinite(me)||!Number.isFinite(he))return;let n=se.current.getBoundingClientRect();(n.width===0||n.height===0)&&(console.warn(_H),console.log(se.current));let r=ce.current.clientWidth||n.width,i={width:r,height:n.height};(oe.current.width!==i.width||oe.current.height!==i.height)&&(ae(i),oe.current=i);let a=(r-ne*2)/me,o=e.pages.length>1?3.1:2,s=(n.height-re*o)/he,c=(r-ne*(e.pages.length>1?3.1:2))/me,l=(n.height-re*2)/he,u=e.pages.length?Math.max(Math.min(U?c:a,U?l:s),.01):1;e.scaleToFit!==u&&(e.setScale(u),e._setScaleToFit(u))};x.useLayoutEffect(()=>{ge({skipTimeout:!0})},[]),x.useEffect(()=>{ge()},[me,he,L,I]),x.useLayoutEffect(()=>{ge({skipTimeout:!0})},[e.openedSidePanel]),x.useEffect(()=>{e.__()},[]),x.useEffect(()=>{let e=se.current;if(window.ResizeObserver){let t=new ResizeObserver(()=>{ge({skipTimeout:!0})});return t.observe(e),()=>t.unobserve(e)}else{let e=setInterval(()=>{ge({skipTimeout:!0})},100);return()=>clearInterval(e)}},[me,he]);let _e=V?1:e.pages.length,ve,ye;if(U){let t=me*e.scale*_e;ve=Math.max(ne,(ie.width-t)/_e/2),ye=Math.max(re,(ie.height-he*e.scale)/2)}else{ve=Math.max(ne,(ie.width-me*e.scale)/2);let t=he*e.scale*_e;ye=Math.max(re,(ie.height-t)/_e/2)}Number.isNaN(ve)&&(ve=ne),Number.isNaN(ye)&&(ye=re),x.useEffect(()=>{let t=t=>{(F||oH)(t,e)};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[]),x.useEffect(()=>{let t=t=>{if(t.ctrlKey||t.metaKey){t.preventDefault();let n=Math.max(5,e.scaleToFit),r=Math.min(.1,e.scaleToFit);U&&me>0&&Number.isFinite(me)&&(r=Math.max(r,300/me)),r=Math.max(r,.01);let i=hH(t.deltaY<0?e.scale*1.03:e.scale/1.03,r,n);e.setScale(i);return}},n=ce.current;return n?.addEventListener(`wheel`,t),()=>n?.removeEventListener(`wheel`,t)},[U,me,e]),x.useEffect(()=>{let t=ce.current;if(!t)return;let n=e=>{e.touches.length===2&&(le.current=gH(e.touches[0],e.touches[1]))},r=n=>{if(n.touches.length===2&&le.current>0){n.preventDefault();let r=gH(n.touches[0],n.touches[1]),i=r/le.current,a=Math.max(5,e.scaleToFit),o=Math.min(.1,e.scaleToFit);U&&me>0&&Number.isFinite(me)&&(o=Math.max(o,300/me)),o=Math.max(o,.01);let s=e.scale,c=hH(s*i,o,a),l=c/s,u=t.getBoundingClientRect(),d=(n.touches[0].clientX+n.touches[1].clientX)/2-u.left,f=(n.touches[0].clientY+n.touches[1].clientY)/2-u.top,p=t.scrollLeft+d,m=t.scrollTop+f;Ee.current=!0,e.setScale(c),t.scrollLeft=p*l-d,t.scrollTop=m*l-f,le.current=r}},i=()=>{le.current=0};return t.addEventListener(`touchstart`,n,{passive:!0}),t.addEventListener(`touchmove`,r,{passive:!1}),t.addEventListener(`touchend`,i,{passive:!0}),()=>{t.removeEventListener(`touchstart`,n),t.removeEventListener(`touchmove`,r),t.removeEventListener(`touchend`,i)}},[U,me,e]);let be=ee!==void 0;be&&ee/2;let xe=e.pages.map(t=>{if(U){let n=(t.computedWidth+ue*2)*e.scale;return be?n+ee:n+ve*2}else{let n=(t.computedHeight+ue*2)*e.scale;return be?n+ee:n+ye*2}}),Se=[],Ce=be?U?ve:ye:0;for(let e=0;e<xe.length;e++)Se.push(Ce),Ce+=xe[e];let we=xe.reduce((e,t)=>e+t,0),Te=be?we+(U?ve*2:ye*2):we,Ee=x.useRef(!1),[,De]=x.useReducer(e=>e+1,0);vH(ce,Te,e.scale,e,Ee);let{handleScroll:Oe}=bH(ce,Se,xe,e,H,ie,Ee,V,t,De),ke=ie.width>=me*e.scale+ve*2,Ae=ie.height>=he*e.scale+ye*2,je=r||`rgba(232, 232, 232, 0.9)`,Me=P?.NoPages||xH,Ne=U?ie.width:ie.height,Pe=ce.current?U?ce.current.scrollLeft:ce.current.scrollTop:0,Fe=e=>{for(let t=Se.length-1;t>=0;t--)if(e>=Se[t])return t;return 0},Ie=Math.max(0,Fe(Pe)),Le=Math.min(e.pages.length-1,Fe(Pe+Ne)),Re=B??1,ze=Math.max(0,Ie-Re),Be=Math.min(e.pages.length-1,Le+Re);return(0,J.jsx)(pp,{value:bp({cropOverlayFill:g,workspaceBackgroundColor:r,pageBorderColor:a,activePageBorderColor:o,bleedColor:s,transparencyBackgroundColor:i,transformerStyle:_,innerImageCropTransformerStyle:v,outerImageCropTransformerStyle:y,highlighterStyle:b,snapGuideStroke:c,snapGuideStrokeWidth:l,snapGuideDash:u,selectionRectFill:d,selectionRectStroke:f,selectionRectStrokeWidth:p,transformLabelFill:m,transformLabelTextFill:h,distanceGuideStroke:T,distanceLabelFill:E,distanceLabelTextFill:D,mediaLoadingStyle:S,mediaErrorStyle:C,textOverflowIndicatorStyle:w,rulerBackgroundColor:O,rulerTextColor:k,rulerBorderColor:A,rulerBorderSize:j,rulerTickColor:M,rulerTickSize:N}),children:(0,J.jsx)(`div`,{ref:se,style:{width:`100%`,height:`100%`,position:`relative`,outline:`none`,flex:1,backgroundColor:je,overflow:`hidden`},tabIndex:0,className:`polotno-workspace-container`,children:(0,J.jsxs)(`div`,{ref:ce,onScroll:Oe,style:{position:`absolute`,top:0,left:0,width:`100%`,height:`100%`,display:`flex`,flexDirection:U?`row`:`column`,overflow:`auto`,overflowX:U?`auto`:ke?`hidden`:`auto`,overflowY:U&&Ae?`hidden`:`auto`,...be&&{paddingTop:U?0:ye,paddingBottom:U?0:ye,paddingLeft:U?ve:0,paddingRight:U?ve:0,boxSizing:`border-box`}},className:`polotno-workspace-inner`,children:[e.pages.map((r,i)=>{let a=r===e.activePage;if(V&&!a&&!(r._exportingOrRendering||r._forceMount))return null;let o=a||i>=ze&&i<=Be||r._exportingOrRendering||r._forceMount,s=U?xe[i]:me*e.scale+ve*2,c=U?he*e.scale+ye*2:xe[i];if(!o)return(0,J.jsx)(`div`,{style:{flexShrink:0},children:(0,J.jsx)(SH,{width:s,height:c,backgroundColor:je,xPadding:ve,yPadding:ye})},r.id);let l=(0,J.jsx)(EV,{page:r,xPadding:ve,yPadding:ye,width:s,height:c,store:e,pageControlsEnabled:n,altCloneEnabled:R,groupSelectionMode:z,components:P,viewportSize:ie,layout:t,tooltipSafeArea:te},r.id);return(r._exportingOrRendering||r._forceMount)&&!a&&V?(0,J.jsx)(`div`,{style:{display:`none`,flexShrink:0},children:l},r.id):l}),e.rulesVisible&&(0,J.jsx)(FV,{store:e,xPadding:ve,yPadding:ye,width:me*e.scale+ve*2,height:he*e.scale+ye*2,pageSizes:xe,layout:t,renderOnlyActivePage:V}),e.pages.length===0&&(0,J.jsx)(Me,{store:e}),e.audios.map(t=>(0,J.jsx)(LV,{audio:t,store:e},t.id))]})})})}),wH=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),TH=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),EH=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),DH=e=>{let t=EH(e);return t.charAt(0).toUpperCase()+t.slice(1)},OH={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},kH=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},AH=(0,x.createContext)({}),jH=()=>(0,x.useContext)(AH),MH=(0,x.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=jH()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,x.createElement)(`svg`,{ref:c,...OH,width:t??l??OH.width,height:t??l??OH.height,stroke:e??f,strokeWidth:m,className:wH(`lucide`,p,i),...!a&&!kH(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,x.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),NH=(e,t)=>{let n=(0,x.forwardRef)(({className:n,...r},i)=>(0,x.createElement)(MH,{ref:i,iconNode:t,className:wH(`lucide-${TH(DH(e))}`,`lucide-${e}`,n),...r}));return n.displayName=DH(e),n},PH=NH(`align-center-horizontal`,[[`path`,{d:`M2 12h20`,key:`9i4pu4`}],[`path`,{d:`M10 16v4a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-4`,key:`11f1s0`}],[`path`,{d:`M10 8V4a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v4`,key:`t14dx9`}],[`path`,{d:`M20 16v1a2 2 0 0 1-2 2h-2a2 2 0 0 1-2-2v-1`,key:`1w07xs`}],[`path`,{d:`M14 8V7c0-1.1.9-2 2-2h2a2 2 0 0 1 2 2v1`,key:`1apec2`}]]),FH=NH(`align-center-vertical`,[[`path`,{d:`M12 2v20`,key:`t6zp3m`}],[`path`,{d:`M8 10H4a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h4`,key:`14d6g8`}],[`path`,{d:`M16 10h4a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2h-4`,key:`1e2lrw`}],[`path`,{d:`M8 20H7a2 2 0 0 1-2-2v-2c0-1.1.9-2 2-2h1`,key:`1fkdwx`}],[`path`,{d:`M16 14h1a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2h-1`,key:`1euafb`}]]),IH=NH(`align-end-horizontal`,[[`rect`,{width:`6`,height:`16`,x:`4`,y:`2`,rx:`2`,key:`z5wdxg`}],[`rect`,{width:`6`,height:`9`,x:`14`,y:`9`,rx:`2`,key:`um7a8w`}],[`path`,{d:`M22 22H2`,key:`19qnx5`}]]),LH=NH(`align-end-vertical`,[[`rect`,{width:`16`,height:`6`,x:`2`,y:`4`,rx:`2`,key:`10wcwx`}],[`rect`,{width:`9`,height:`6`,x:`9`,y:`14`,rx:`2`,key:`4p5bwg`}],[`path`,{d:`M22 22V2`,key:`12ipfv`}]]),RH=NH(`align-horizontal-space-around`,[[`rect`,{width:`6`,height:`10`,x:`9`,y:`7`,rx:`2`,key:`yn7j0q`}],[`path`,{d:`M4 22V2`,key:`tsjzd3`}],[`path`,{d:`M20 22V2`,key:`1bnhr8`}]]),zH=NH(`align-start-horizontal`,[[`rect`,{width:`6`,height:`16`,x:`4`,y:`6`,rx:`2`,key:`1n4dg1`}],[`rect`,{width:`6`,height:`9`,x:`14`,y:`6`,rx:`2`,key:`17khns`}],[`path`,{d:`M22 2H2`,key:`fhrpnj`}]]),BH=NH(`align-start-vertical`,[[`rect`,{width:`9`,height:`6`,x:`6`,y:`14`,rx:`2`,key:`lpm2y7`}],[`rect`,{width:`16`,height:`6`,x:`6`,y:`4`,rx:`2`,key:`rdj6ps`}],[`path`,{d:`M2 2v20`,key:`1ivd8o`}]]),VH=NH(`align-vertical-justify-center`,[[`rect`,{width:`14`,height:`6`,x:`5`,y:`16`,rx:`2`,key:`1i8z2d`}],[`rect`,{width:`10`,height:`6`,x:`7`,y:`2`,rx:`2`,key:`ypihtt`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),HH=NH(`align-vertical-justify-end`,[[`rect`,{width:`14`,height:`6`,x:`5`,y:`12`,rx:`2`,key:`4l4tp2`}],[`rect`,{width:`10`,height:`6`,x:`7`,y:`2`,rx:`2`,key:`ypihtt`}],[`path`,{d:`M2 22h20`,key:`272qi7`}]]),UH=NH(`align-vertical-justify-start`,[[`rect`,{width:`14`,height:`6`,x:`5`,y:`16`,rx:`2`,key:`1i8z2d`}],[`rect`,{width:`10`,height:`6`,x:`7`,y:`6`,rx:`2`,key:`13squh`}],[`path`,{d:`M2 2h20`,key:`1ennik`}]]),WH=NH(`align-vertical-space-around`,[[`rect`,{width:`10`,height:`6`,x:`7`,y:`9`,rx:`2`,key:`b1zbii`}],[`path`,{d:`M22 20H2`,key:`1p1f7z`}],[`path`,{d:`M22 4H2`,key:`1b7qnq`}]]),GH=NH(`arrow-down-left`,[[`path`,{d:`M17 7 7 17`,key:`15tmo1`}],[`path`,{d:`M17 17H7V7`,key:`1org7z`}]]),KH=NH(`arrow-down-right`,[[`path`,{d:`m7 7 10 10`,key:`1fmybs`}],[`path`,{d:`M17 7v10H7`,key:`6fjiku`}]]),qH=NH(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),JH=NH(`arrow-left-right`,[[`path`,{d:`M8 3 4 7l4 4`,key:`9rb6wj`}],[`path`,{d:`M4 7h16`,key:`6tx8e3`}],[`path`,{d:`m16 21 4-4-4-4`,key:`siv7j2`}],[`path`,{d:`M20 17H4`,key:`h6l3hr`}]]),YH=NH(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),XH=NH(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),ZH=NH(`arrow-up-down`,[[`path`,{d:`m21 16-4 4-4-4`,key:`f6ql7i`}],[`path`,{d:`M17 20V4`,key:`1ejh1v`}],[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}]]),QH=NH(`arrow-up-left`,[[`path`,{d:`M7 17V7h10`,key:`11bw93`}],[`path`,{d:`M17 17 7 7`,key:`2786uv`}]]),$H=NH(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),eU=NH(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),tU=NH(`ban`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}]]),nU=NH(`bold`,[[`path`,{d:`M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8`,key:`mg9rjx`}]]),rU=NH(`case-sensitive`,[[`path`,{d:`m2 16 4.039-9.69a.5.5 0 0 1 .923 0L11 16`,key:`d5nyq2`}],[`path`,{d:`M22 9v7`,key:`pvm9v3`}],[`path`,{d:`M3.304 13h6.392`,key:`1q3zxz`}],[`circle`,{cx:`18.5`,cy:`12.5`,r:`3.5`,key:`z97x68`}]]),iU=NH(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),aU=NH(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),oU=NH(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),sU=NH(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),cU=NH(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),lU=NH(`chevrons-down`,[[`path`,{d:`m7 6 5 5 5-5`,key:`1lc07p`}],[`path`,{d:`m7 13 5 5 5-5`,key:`1d48rs`}]]),uU=NH(`chevrons-up`,[[`path`,{d:`m17 11-5-5-5 5`,key:`e8nh98`}],[`path`,{d:`m17 18-5-5-5 5`,key:`2avn1x`}]]),dU=NH(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),fU=NH(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),pU=NH(`cloud-upload`,[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242`,key:`1pljnt`}],[`path`,{d:`m8 17 4-4 4 4`,key:`1quai1`}]]),mU=NH(`contrast`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 18a6 6 0 0 0 0-12v12z`,key:`j4l70d`}]]),hU=NH(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),gU=NH(`credit-card`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`5`,rx:`2`,key:`ynyp8z`}],[`line`,{x1:`2`,x2:`22`,y1:`10`,y2:`10`,key:`1b3vmo`}]]),_U=NH(`crop`,[[`path`,{d:`M6 2v14a2 2 0 0 0 2 2h14`,key:`ron5a4`}],[`path`,{d:`M18 22V8a2 2 0 0 0-2-2H2`,key:`7s9ehn`}]]),vU=NH(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),yU=NH(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),bU=NH(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),xU=NH(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),SU=NH(`files`,[[`path`,{d:`M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8`,key:`14sh0y`}],[`path`,{d:`M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z`,key:`1970lx`}],[`path`,{d:`M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1`,key:`l4dndm`}]]),CU=NH(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),wU=NH(`highlighter`,[[`path`,{d:`m9 11-6 6v3h9l3-3`,key:`1a3l36`}],[`path`,{d:`m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4`,key:`14a9rk`}]]),TU=NH(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),EU=NH(`italic`,[[`line`,{x1:`19`,x2:`10`,y1:`4`,y2:`4`,key:`15jd3p`}],[`line`,{x1:`14`,x2:`5`,y1:`20`,y2:`20`,key:`bu0au3`}],[`line`,{x1:`15`,x2:`9`,y1:`4`,y2:`20`,key:`uljnxc`}]]),DU=NH(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),OU=NH(`layout-template`,[[`rect`,{width:`18`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`f1a2em`}],[`rect`,{width:`9`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`jqznyg`}],[`rect`,{width:`5`,height:`7`,x:`16`,y:`14`,rx:`1`,key:`q5h2i8`}]]),kU=NH(`list-ordered`,[[`path`,{d:`M11 5h10`,key:`1cz7ny`}],[`path`,{d:`M11 12h10`,key:`1438ji`}],[`path`,{d:`M11 19h10`,key:`11t30w`}],[`path`,{d:`M4 4h1v5`,key:`10yrso`}],[`path`,{d:`M4 9h2`,key:`r1h2o0`}],[`path`,{d:`M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02`,key:`xtkcd5`}]]),AU=NH(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),jU=NH(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),MU=NH(`lock-open`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 9.9-1`,key:`1mm8w8`}]]),NU=NH(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),PU=NH(`mouse-pointer`,[[`path`,{d:`M12.586 12.586 19 19`,key:`ea5xo7`}],[`path`,{d:`M3.688 3.037a.497.497 0 0 0-.651.651l6.5 15.999a.501.501 0 0 0 .947-.062l1.569-6.083a2 2 0 0 1 1.448-1.479l6.124-1.579a.5.5 0 0 0 .063-.947z`,key:`277e5u`}]]),FU=NH(`paint-bucket`,[[`path`,{d:`M11 7 6 2`,key:`1jwth8`}],[`path`,{d:`M18.992 12H2.041`,key:`xw1gg`}],[`path`,{d:`M21.145 18.38A3.34 3.34 0 0 1 20 16.5a3.3 3.3 0 0 1-1.145 1.88c-.575.46-.855 1.02-.855 1.595A2 2 0 0 0 20 22a2 2 0 0 0 2-2.025c0-.58-.285-1.13-.855-1.595`,key:`1nkol4`}],[`path`,{d:`m8.5 4.5 2.148-2.148a1.205 1.205 0 0 1 1.704 0l7.296 7.296a1.205 1.205 0 0 1 0 1.704l-7.592 7.592a3.615 3.615 0 0 1-5.112 0l-3.888-3.888a3.615 3.615 0 0 1 0-5.112L5.67 7.33`,key:`1nk1rd`}]]),IU=NH(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),LU=NH(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),RU=NH(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),zU=NH(`pilcrow`,[[`path`,{d:`M13 4v16`,key:`8vvj80`}],[`path`,{d:`M17 4v16`,key:`7dpous`}],[`path`,{d:`M19 4H9.5a4.5 4.5 0 0 0 0 9H13`,key:`sh4n9v`}]]),BU=NH(`pipette`,[[`path`,{d:`m12 9-8.414 8.414A2 2 0 0 0 3 18.828v1.344a2 2 0 0 1-.586 1.414A2 2 0 0 1 3.828 21h1.344a2 2 0 0 0 1.414-.586L15 12`,key:`1y3wsu`}],[`path`,{d:`m18 9 .4.4a1 1 0 1 1-3 3l-3.8-3.8a1 1 0 1 1 3-3l.4.4 3.4-3.4a1 1 0 1 1 3 3z`,key:`110lr1`}],[`path`,{d:`m2 22 .414-.414`,key:`jhxm08`}]]),VU=NH(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),HU=NH(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),UU=NH(`redo-2`,[[`path`,{d:`m15 14 5-5-5-5`,key:`12vg1m`}],[`path`,{d:`M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13`,key:`6uklza`}]]),WU=NH(`scaling`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M14 15H9v-5`,key:`pi4jk9`}],[`path`,{d:`M16 3h5v5`,key:`1806ms`}],[`path`,{d:`M21 3 9 15`,key:`15kdhq`}]]),GU=NH(`scissors`,[[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M8.12 8.12 12 12`,key:`1alkpv`}],[`path`,{d:`M20 4 8.12 15.88`,key:`xgtan2`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`path`,{d:`M14.8 14.8 20 20`,key:`ptml3r`}]]),KU=NH(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),qU=NH(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),JU=NH(`shapes`,[[`path`,{d:`M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z`,key:`1bo67w`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}],[`circle`,{cx:`17.5`,cy:`17.5`,r:`3.5`,key:`w3z12y`}]]),YU=NH(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),XU=NH(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),ZU=NH(`strikethrough`,[[`path`,{d:`M16 4H9a3 3 0 0 0-2.83 4`,key:`43sutm`}],[`path`,{d:`M14 12a4 4 0 0 1 0 8H6`,key:`nlfj13`}],[`line`,{x1:`4`,x2:`20`,y1:`12`,y2:`12`,key:`1e0a9i`}]]),QU=NH(`text-align-center`,[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M17 12H7`,key:`16if0g`}],[`path`,{d:`M19 19H5`,key:`vjpgq2`}]]),$U=NH(`text-align-end`,[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M21 19H7`,key:`4cu937`}]]),eW=NH(`text-align-justify`,[[`path`,{d:`M3 5h18`,key:`1u36vt`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`path`,{d:`M3 19h18`,key:`awlh7x`}]]),tW=NH(`text-align-start`,[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M17 19H3`,key:`z6ezky`}]]),nW=NH(`text-cursor-input`,[[`path`,{d:`M12 20h-1a2 2 0 0 1-2-2 2 2 0 0 1-2 2H6`,key:`1528k5`}],[`path`,{d:`M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7`,key:`13ksps`}],[`path`,{d:`M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1`,key:`1n9rhb`}],[`path`,{d:`M6 4h1a2 2 0 0 1 2 2 2 2 0 0 1 2-2h1`,key:`1mj8rg`}],[`path`,{d:`M9 6v12`,key:`velyjx`}]]),rW=NH(`text-wrap`,[[`path`,{d:`m16 16-3 3 3 3`,key:`117b85`}],[`path`,{d:`M3 12h14.5a1 1 0 0 1 0 7H13`,key:`18xa6z`}],[`path`,{d:`M3 19h6`,key:`1ygdsz`}],[`path`,{d:`M3 5h18`,key:`1u36vt`}]]),iW=NH(`timer`,[[`line`,{x1:`10`,x2:`14`,y1:`2`,y2:`2`,key:`14vaq8`}],[`line`,{x1:`12`,x2:`15`,y1:`14`,y2:`11`,key:`17fdiu`}],[`circle`,{cx:`12`,cy:`14`,r:`8`,key:`1e1u0o`}]]),aW=NH(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),oW=NH(`type`,[[`path`,{d:`M12 4v16`,key:`1654pz`}],[`path`,{d:`M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2`,key:`e0r10z`}],[`path`,{d:`M9 20h6`,key:`s66wpe`}]]),sW=NH(`underline`,[[`path`,{d:`M6 4v6a6 6 0 0 0 12 0V4`,key:`9kb039`}],[`line`,{x1:`4`,x2:`20`,y1:`20`,y2:`20`,key:`nun2al`}]]),cW=NH(`undo-2`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]),lW=NH(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),uW=NH(`video`,[[`path`,{d:`m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5`,key:`ftymec`}],[`rect`,{x:`2`,y:`6`,width:`14`,height:`12`,rx:`2`,key:`158x01`}]]),dW=NH(`volume-2`,[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`path`,{d:`M16 9a5 5 0 0 1 0 6`,key:`1q6k2b`}],[`path`,{d:`M19.364 18.364a9 9 0 0 0 0-12.728`,key:`ijwkga`}]]),fW=NH(`volume-x`,[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`line`,{x1:`22`,x2:`16`,y1:`9`,y2:`15`,key:`1ewh16`}],[`line`,{x1:`16`,x2:`22`,y1:`9`,y2:`15`,key:`5ykzw1`}]]),pW=NH(`wand-sparkles`,[[`path`,{d:`m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72`,key:`ul74o6`}],[`path`,{d:`m14 7 3 3`,key:`1r5n42`}],[`path`,{d:`M5 6v4`,key:`ilb8ba`}],[`path`,{d:`M19 14v4`,key:`blhpug`}],[`path`,{d:`M10 2v2`,key:`7u0qdc`}],[`path`,{d:`M7 8H3`,key:`zfb6yr`}],[`path`,{d:`M21 16h-4`,key:`1cnmox`}],[`path`,{d:`M11 3H9`,key:`1obp7u`}]]),mW=NH(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),hW=NH(`zoom-in`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`11`,x2:`11`,y1:`8`,y2:`14`,key:`1vmskp`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]),gW=NH(`zoom-out`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]),_W=({path:e,...t})=>(0,J.jsx)(`svg`,{width:24,height:24,viewBox:`0 0 24 24`,fill:`currentColor`,role:`img`,...t,children:(0,J.jsx)(`path`,{d:e})}),vW={"action.duplicate":hU,"action.remove":aW,"action.lock":NU,"action.unlock":MU,"action.undo":cW,"action.redo":UU,"action.add":HU,"action.more":vU,"action.settings":qU,"action.search":KU,"action.close":mW,"action.confirm":iU,"action.none":tU,"action.visible":bU,"action.hidden":yU,"action.dragHandle":CU,"action.eyeDropper":BU,"action.unmuted":dW,"action.muted":fW,"action.help":dU,"ui.chevronUp":cU,"ui.chevronDown":aU,"ui.chevronLeft":oU,"ui.chevronRight":sU,"layering.menu":DU,"layering.up":cU,"layering.down":aU,"layering.top":uU,"layering.bottom":lU,"text.bold":nU,"text.italic":EU,"text.underline":sW,"text.strikethrough":ZU,"text.alignLeft":tW,"text.alignCenter":QU,"text.alignRight":$U,"text.alignJustify":eW,"text.valignTop":UH,"text.valignMiddle":VH,"text.valignBottom":HH,"text.uppercase":rU,"text.spacing":rW,"text.bulletList":AU,"text.numberedList":kU,"text.paragraph":zU,"text.richText":nW,"text.uploadFont":lW,"position.alignLeft":BH,"position.alignCenter":FH,"position.alignRight":LH,"position.alignTop":zH,"position.alignMiddle":PH,"position.alignBottom":IH,"position.distributeVertical":WH,"position.distributeHorizontal":RH,"sidePanel.templates":OU,"sidePanel.text":oW,"sidePanel.photos":TU,"sidePanel.elements":JU,"sidePanel.upload":pU,"sidePanel.background":FU,"sidePanel.pages":SU,"sidePanel.layers":DU,"sidePanel.resize":WU,"sidePanel.draw":RU,"sidePanel.videos":uW,"toolbar.opacity":mU,"toolbar.filters":pW,"toolbar.aiWrite":YU,"toolbar.duration":iW,"toolbar.trim":GU,"toolbar.flipHorizontal":JH,"toolbar.flipVertical":ZH,"toolbar.zoomIn":hW,"toolbar.zoomOut":gW,"toolbar.crop":_U,"download.export":lW,"download.image":TU,"download.pdf":xU,"download.video":uW,"draw.select":PU,"draw.brush":XU,"draw.highlighter":wU,"background.colorPicker":IU,"pagesTimeline.play":VU,"pagesTimeline.pause":LU,"size.instagram":e=>(0,J.jsx)(_W,{...e,path:`M7.0301.084c-1.2768.0602-2.1487.264-2.911.5634-.7888.3075-1.4575.72-2.1228 1.3877-.6652.6677-1.075 1.3368-1.3802 2.127-.2954.7638-.4956 1.6365-.552 2.914-.0564 1.2775-.0689 1.6882-.0626 4.947.0062 3.2586.0206 3.6671.0825 4.9473.061 1.2765.264 2.1482.5635 2.9107.308.7889.72 1.4573 1.388 2.1228.6679.6655 1.3365 1.0743 2.1285 1.38.7632.295 1.6361.4961 2.9134.552 1.2773.056 1.6884.069 4.9462.0627 3.2578-.0062 3.668-.0207 4.9478-.0814 1.28-.0607 2.147-.2652 2.9098-.5633.7889-.3086 1.4578-.72 2.1228-1.3881.665-.6682 1.0745-1.3378 1.3795-2.1284.2957-.7632.4966-1.636.552-2.9124.056-1.2809.0692-1.6898.063-4.948-.0063-3.2583-.021-3.6668-.0817-4.9465-.0607-1.2797-.264-2.1487-.5633-2.9117-.3084-.7889-.72-1.4568-1.3876-2.1228C21.2982 1.33 20.628.9208 19.8378.6165 19.074.321 18.2017.1197 16.9244.0645 15.6471.0093 15.236-.0044 11.977.0017 8.718.0078 8.31.0223 7.0301.084m.1409 21.6206c-1.1704-.0512-1.8053-.2453-2.2287-.408-.5606-.216-.96-.4771-1.3819-.895-.422-.4178-.6811-.8186-.9-1.378-.1644-.4234-.3624-1.058-.4171-2.228-.0595-1.2645-.072-1.6442-.079-4.848-.007-3.2037.0053-3.583.0607-4.848.0508-1.169.2461-1.8042.4084-2.2273.216-.5613.4762-.96.8945-1.3816.4184-.4217.8189-.6814 1.3783-.9003.4232-.1651 1.0578-.3617 2.2274-.4171 1.2655-.06 1.6447-.0723 4.848-.0794 3.2033-.007 3.5835.0052 4.8495.0606 1.169.0515 1.8046.2455 2.2273.4081.5608.216.96.4762 1.3816.8949.4216.4187.6814.8181.9003 1.3783.1654.4221.3617 1.0564.4169 2.2256.0599 1.2655.0738 1.645.0796 4.848.0058 3.203-.0055 3.5834-.061 4.848-.051 1.17-.245 1.8052-.408 2.2287-.216.5604-.4763.96-.8954 1.3814-.419.4215-.8181.6811-1.3783.9-.4226.1649-1.0578.3617-2.2256.4171-1.2655.0596-1.6447.0723-4.8483.0793-3.2036.007-3.5827-.0056-4.848-.0606m9.7823-16.1281a1.44 1.44 0 1 0 1.4376-1.4424 1.44 1.44 0 0 0-1.4376 1.4424M5.8385 12.0017a6.162 6.162 0 1 0 12.3236-.0096 6.162 6.162 0 0 0-12.3236.0096M8 12.0033A4 4 0 1 1 12.0067 16 4 4 0 0 1 8 12.0033`}),"size.facebook":e=>(0,J.jsx)(_W,{...e,path:`M9.101 23.691v-7.98H6.627v-3.667h2.474v-1.58c0-4.085 1.848-5.978 5.858-5.978.401 0 .955.042 1.468.103a8.68 8.68 0 0 1 1.141.195v3.325a8.623 8.623 0 0 0-.653-.036 26.805 26.805 0 0 0-.733-.009c-.707 0-1.259.096-1.675.309a1.686 1.686 0 0 0-.679.622c-.258.42-.374.995-.374 1.752v1.297h3.919l-.386 2.103-.287 1.564h-3.246v8.245C19.396 23.238 24 18.179 24 12.044c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.628 3.874 10.35 9.101 11.647Z`}),"size.youtube":e=>(0,J.jsx)(_W,{...e,path:`M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z`}),"size.linkedin":e=>(0,J.jsx)(_W,{...e,path:`M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.062 2.062 0 0 1-2.063-2.065 2.064 2.064 0 1 1 2.063 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z`}),"size.twitter":e=>(0,J.jsx)(_W,{...e,path:`M23.953 4.57a10 10 0 0 1-2.825.775 4.958 4.958 0 0 0 2.163-2.723c-.951.555-2.005.959-3.127 1.184a4.92 4.92 0 0 0-8.384 4.482C7.69 8.095 4.067 6.13 1.64 3.162a4.822 4.822 0 0 0-.666 2.475c0 1.71.87 3.213 2.188 4.096a4.904 4.904 0 0 1-2.228-.616v.06a4.923 4.923 0 0 0 3.946 4.827 4.996 4.996 0 0 1-2.212.085 4.936 4.936 0 0 0 4.604 3.417 9.867 9.867 0 0 1-6.102 2.105c-.39 0-.779-.023-1.17-.067a13.995 13.995 0 0 0 7.557 2.209c9.053 0 13.998-7.496 13.998-13.985 0-.21 0-.42-.015-.63A9.935 9.935 0 0 0 24 4.59z`}),"size.video":uW,"size.print":xU,"size.businessCard":gU,"animation.directionRight":XH,"animation.directionLeft":YH,"animation.directionUp":eU,"animation.directionDown":qH,"animation.directionBottomRight":KH,"animation.directionBottomLeft":GH,"animation.directionTopRight":$H,"animation.directionTopLeft":QH,"animation.typeMove":e=>(0,J.jsx)(`svg`,{width:`28`,height:`28`,viewBox:`0 0 28 28`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,style:{margin:0},...e,children:(0,J.jsx)(`path`,{d:`M9.88114 6.74408C9.79978 6.66282 9.73524 6.56631 9.69121 6.46009C9.64718 6.35387 9.62451 6.24001 9.62451 6.12502C9.62451 6.01003 9.64718 5.89617 9.69121 5.78994C9.73524 5.68372 9.79978 5.58722 9.88114 5.50595L13.3811 2.00595C13.4624 1.9246 13.5589 1.86006 13.6651 1.81603C13.7714 1.77199 13.8852 1.74933 14.0002 1.74933C14.1152 1.74933 14.229 1.77199 14.3353 1.81603C14.4415 1.86006 14.538 1.9246 14.6193 2.00595L18.1193 5.50595C18.2834 5.67014 18.3757 5.89282 18.3757 6.12502C18.3757 6.35721 18.2834 6.57989 18.1193 6.74408C17.9551 6.90827 17.7324 7.0005 17.5002 7.0005C17.268 7.0005 17.0453 6.90827 16.8811 6.74408L14.8752 4.73705V10.5C14.8752 10.7321 14.783 10.9546 14.6189 11.1187C14.4548 11.2828 14.2323 11.375 14.0002 11.375C13.7681 11.375 13.5456 11.2828 13.3815 11.1187C13.2174 10.9546 13.1252 10.7321 13.1252 10.5V4.73705L11.1193 6.74408C11.038 6.82543 10.9415 6.88997 10.8353 6.93401C10.729 6.97804 10.6152 7.00071 10.5002 7.00071C10.3852 7.00071 10.2714 6.97804 10.1651 6.93401C10.0589 6.88997 9.9624 6.82543 9.88114 6.74408ZM16.8811 21.256L14.8752 23.263V17.5C14.8752 17.268 14.783 17.0454 14.6189 16.8813C14.4548 16.7172 14.2323 16.625 14.0002 16.625C13.7681 16.625 13.5456 16.7172 13.3815 16.8813C13.2174 17.0454 13.1252 17.268 13.1252 17.5V23.263L11.1193 21.256C10.9551 21.0918 10.7324 20.9995 10.5002 20.9995C10.268 20.9995 10.0453 21.0918 9.88114 21.256C9.71695 21.4201 9.62471 21.6428 9.62471 21.875C9.62471 22.1072 9.71695 22.3299 9.88114 22.4941L13.3811 25.9941C13.4624 26.0754 13.5589 26.14 13.6651 26.184C13.7714 26.228 13.8852 26.2507 14.0002 26.2507C14.1152 26.2507 14.229 26.228 14.3353 26.184C14.4415 26.14 14.538 26.0754 14.6193 25.9941L18.1193 22.4941C18.2834 22.3299 18.3757 22.1072 18.3757 21.875C18.3757 21.6428 18.2834 21.4201 18.1193 21.256C17.9551 21.0918 17.7324 20.9995 17.5002 20.9995C17.268 20.9995 17.0453 21.0918 16.8811 21.256ZM25.9943 13.381L22.4943 9.88095C22.3301 9.71677 22.1074 9.62453 21.8752 9.62453C21.643 9.62453 21.4203 9.71677 21.2561 9.88095C21.092 10.0451 20.9997 10.2678 20.9997 10.5C20.9997 10.7322 21.092 10.9549 21.2561 11.1191L23.2632 13.125H17.5002C17.2681 13.125 17.0456 13.2172 16.8815 13.3813C16.7174 13.5454 16.6252 13.768 16.6252 14C16.6252 14.2321 16.7174 14.4546 16.8815 14.6187C17.0456 14.7828 17.2681 14.875 17.5002 14.875H23.2632L21.2561 16.881C21.092 17.0451 20.9997 17.2678 20.9997 17.5C20.9997 17.7322 21.092 17.9549 21.2561 18.1191C21.4203 18.2833 21.643 18.3755 21.8752 18.3755C22.1074 18.3755 22.3301 18.2833 22.4943 18.1191L25.9943 14.6191C26.0756 14.5378 26.1402 14.4413 26.1842 14.3351C26.2282 14.2289 26.2509 14.115 26.2509 14C26.2509 13.885 26.2282 13.7712 26.1842 13.6649C26.1402 13.5587 26.0756 13.4622 25.9943 13.381ZM4.73723 14.875H10.5002C10.7323 14.875 10.9548 14.7828 11.1189 14.6187C11.283 14.4546 11.3752 14.2321 11.3752 14C11.3752 13.768 11.283 13.5454 11.1189 13.3813C10.9548 13.2172 10.7323 13.125 10.5002 13.125H4.73723L6.74426 11.1191C6.90845 10.9549 7.00069 10.7322 7.00069 10.5C7.00069 10.2678 6.90845 10.0451 6.74426 9.88095C6.58008 9.71677 6.35739 9.62453 6.1252 9.62453C5.89301 9.62453 5.67032 9.71677 5.50614 9.88095L2.00614 13.381C1.92478 13.4622 1.86024 13.5587 1.81621 13.6649C1.77218 13.7712 1.74951 13.885 1.74951 14C1.74951 14.115 1.77218 14.2289 1.81621 14.3351C1.86024 14.4413 1.92478 14.5378 2.00614 14.6191L5.50614 18.1191C5.67032 18.2833 5.89301 18.3755 6.1252 18.3755C6.35739 18.3755 6.58008 18.2833 6.74426 18.1191C6.90845 17.9549 7.00069 17.7322 7.00069 17.5C7.00069 17.2678 6.90845 17.0451 6.74426 16.881L4.73723 14.875Z`,fill:`currentColor`})}),"animation.typeFade":e=>(0,J.jsxs)(`svg`,{width:`28`,height:`28`,viewBox:`0 0 28 28`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,style:{margin:0},...e,children:[(0,J.jsx)(`circle`,{cx:`7`,cy:`14`,r:`5`,fill:`currentColor`,fillOpacity:`0.2`,stroke:`currentColor`,strokeWidth:`2`,strokeOpacity:`0.3`}),(0,J.jsx)(`circle`,{cx:`14`,cy:`14`,r:`5`,fill:`currentColor`,fillOpacity:`0.5`,stroke:`currentColor`,strokeWidth:`2`,strokeOpacity:`0.6`}),(0,J.jsx)(`circle`,{cx:`21`,cy:`14`,r:`5`,fill:`currentColor`,fillOpacity:`0.9`,stroke:`currentColor`,strokeWidth:`2`,strokeOpacity:`1`})]}),"animation.typeZoom":e=>(0,J.jsx)(`svg`,{width:`28`,height:`28`,viewBox:`0 0 28 28`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,style:{margin:0},...e,children:(0,J.jsx)(`path`,{d:`M15.75 11.375V7C15.75 6.76793 15.8422 6.54537 16.0063 6.38128C16.1704 6.21719 16.3929 6.125 16.625 6.125C16.8571 6.125 17.0796 6.21719 17.2437 6.38128C17.4078 6.54537 17.5 6.76793 17.5 7V9.26297L22.1309 4.63094C22.2951 4.46675 22.5178 4.37451 22.75 4.37451C22.9822 4.37451 23.2049 4.46675 23.3691 4.63094C23.5332 4.79512 23.6255 5.0178 23.6255 5.25C23.6255 5.48219 23.5332 5.70488 23.3691 5.86906L18.737 10.5H21C21.2321 10.5 21.4546 10.5922 21.6187 10.7563C21.7828 10.9204 21.875 11.1429 21.875 11.375C21.875 11.6071 21.7828 11.8296 21.6187 11.9937C21.4546 12.1578 21.2321 12.25 21 12.25H16.625C16.3929 12.25 16.1704 12.1578 16.0063 11.9937C15.8422 11.8296 15.75 11.6071 15.75 11.375ZM11.375 15.75H7C6.76793 15.75 6.54537 15.8422 6.38128 16.0063C6.21719 16.1704 6.125 16.3929 6.125 16.625C6.125 16.8571 6.21719 17.0796 6.38128 17.2437C6.54537 17.4078 6.76793 17.5 7 17.5H9.26297L4.63094 22.1309C4.46675 22.2951 4.37451 22.5178 4.37451 22.75C4.37451 22.9822 4.46675 23.2049 4.63094 23.3691C4.79512 23.5332 5.0178 23.6255 5.25 23.6255C5.48219 23.6255 5.70488 23.5332 5.86906 23.3691L10.5 18.737V21C10.5 21.2321 10.5922 21.4546 10.7563 21.6187C10.9204 21.7828 11.1429 21.875 11.375 21.875C11.6071 21.875 11.8296 21.7828 11.9937 21.6187C12.1578 21.4546 12.25 21.2321 12.25 21V16.625C12.25 16.3929 12.1578 16.1704 11.9937 16.0063C11.8296 15.8422 11.6071 15.75 11.375 15.75ZM18.737 17.5H21C21.2321 17.5 21.4546 17.4078 21.6187 17.2437C21.7828 17.0796 21.875 16.8571 21.875 16.625C21.875 16.3929 21.7828 16.1704 21.6187 16.0063C21.4546 15.8422 21.2321 15.75 21 15.75H16.625C16.3929 15.75 16.1704 15.8422 16.0063 16.0063C15.8422 16.1704 15.75 16.3929 15.75 16.625V21C15.75 21.2321 15.8422 21.4546 16.0063 21.6187C16.1704 21.7828 16.3929 21.875 16.625 21.875C16.8571 21.875 17.0796 21.7828 17.2437 21.6187C17.4078 21.4546 17.5 21.2321 17.5 21V18.737L22.1309 23.3691C22.2122 23.4504 22.3087 23.5148 22.415 23.5588C22.5212 23.6028 22.635 23.6255 22.75 23.6255C22.865 23.6255 22.9788 23.6028 23.085 23.5588C23.1913 23.5148 23.2878 23.4504 23.3691 23.3691C23.4504 23.2878 23.5148 23.1913 23.5588 23.085C23.6028 22.9788 23.6255 22.865 23.6255 22.75C23.6255 22.635 23.6028 22.5212 23.5588 22.415C23.5148 22.3087 23.4504 22.2122 23.3691 22.1309L18.737 17.5ZM11.375 6.125C11.1429 6.125 10.9204 6.21719 10.7563 6.38128C10.5922 6.54537 10.5 6.76793 10.5 7V9.26297L5.86906 4.63094C5.70488 4.46675 5.48219 4.37451 5.25 4.37451C5.0178 4.37451 4.79512 4.46675 4.63094 4.63094C4.46675 4.79512 4.37451 5.0178 4.37451 5.25C4.37451 5.48219 4.46675 5.70488 4.63094 5.86906L9.26297 10.5H7C6.76793 10.5 6.54537 10.5922 6.38128 10.7563C6.21719 10.9204 6.125 11.1429 6.125 11.375C6.125 11.6071 6.21719 11.8296 6.38128 11.9937C6.54537 12.1578 6.76793 12.25 7 12.25H11.375C11.6071 12.25 11.8296 12.1578 11.9937 11.9937C12.1578 11.8296 12.25 11.6071 12.25 11.375V7C12.25 6.76793 12.1578 6.54537 11.9937 6.38128C11.8296 6.21719 11.6071 6.125 11.375 6.125Z`,fill:`currentColor`})}),"animation.typeRotate":e=>(0,J.jsx)(`svg`,{width:`28`,height:`28`,viewBox:`0 0 28 28`,xmlns:`http://www.w3.org/2000/svg`,style:{margin:0},...e,children:(0,J.jsx)(`path`,{d:`M9.625 11.375H4.375C4.14294 11.375 3.92038 11.2828 3.75628 11.1187C3.59219 10.9546 3.5 10.7321 3.5 10.5V5.25001C3.5 5.01794 3.59219 4.79538 3.75628 4.63129C3.92038 4.46719 4.14294 4.37501 4.375 4.37501C4.60706 4.37501 4.82962 4.46719 4.99372 4.63129C5.15781 4.79538 5.25 5.01794 5.25 5.25001V8.38797L6.85016 6.78782C8.80164 4.82651 11.452 3.72026 14.2188 3.71219H14.2767C17.0199 3.70513 19.6555 4.77908 21.6125 6.70141C21.7723 6.86488 21.8618 7.0844 21.8618 7.313C21.8618 7.5416 21.7723 7.76112 21.6126 7.92461C21.4528 8.0881 21.2354 8.18257 21.0068 8.18781C20.7783 8.19306 20.5568 8.10865 20.3897 7.95266C18.7584 6.3515 16.5625 5.45684 14.2767 5.46219H14.2275C11.9221 5.46929 9.71368 6.39096 8.08719 8.02485L6.48703 9.62501H9.625C9.85706 9.62501 10.0796 9.71719 10.2437 9.88129C10.4078 10.0454 10.5 10.2679 10.5 10.5C10.5 10.7321 10.4078 10.9546 10.2437 11.1187C10.0796 11.2828 9.85706 11.375 9.625 11.375ZM23.625 16.625H18.375C18.1429 16.625 17.9204 16.7172 17.7563 16.8813C17.5922 17.0454 17.5 17.2679 17.5 17.5C17.5 17.7321 17.5922 17.9546 17.7563 18.1187C17.9204 18.2828 18.1429 18.375 18.375 18.375H21.513L19.9128 19.9752C18.2866 21.6088 16.0786 22.5304 13.7736 22.5378H13.7244C11.4386 22.5432 9.24264 21.6485 7.61141 20.0473C7.52991 19.964 7.43257 19.8977 7.32511 19.8525C7.21764 19.8073 7.10223 19.784 6.98564 19.784C6.86904 19.784 6.75363 19.8073 6.64617 19.8525C6.53872 19.8978 6.44138 19.964 6.35989 20.0474C6.2784 20.1308 6.2144 20.2296 6.17164 20.3381C6.12889 20.4466 6.10824 20.5625 6.11091 20.679C6.11359 20.7956 6.13953 20.9105 6.18721 21.0169C6.2349 21.1232 6.30337 21.219 6.38859 21.2986C8.3456 23.2209 10.9812 24.2949 13.7244 24.2878H13.7812C16.5476 24.2795 19.1975 23.1732 21.1488 21.2122L22.75 19.612V22.75C22.75 22.9821 22.8422 23.2046 23.0063 23.3687C23.1704 23.5328 23.3929 23.625 23.625 23.625C23.8571 23.625 24.0796 23.5328 24.2437 23.3687C24.4078 23.2046 24.5 22.9821 24.5 22.75V17.5C24.5 17.2679 24.4078 17.0454 24.2437 16.8813C24.0796 16.7172 23.8571 16.625 23.625 16.625Z`,fill:`currentColor`})}),"animation.typeBlink":e=>(0,J.jsx)(`svg`,{width:`28`,height:`28`,viewBox:`0 0 28 28`,xmlns:`http://www.w3.org/2000/svg`,style:{margin:0},...e,children:(0,J.jsx)(`path`,{d:`M24.9374 19.1406C24.8375 19.1976 24.7273 19.2343 24.6132 19.2487C24.499 19.263 24.3831 19.2547 24.2722 19.2243C24.1613 19.1938 24.0574 19.1417 23.9666 19.0711C23.8758 19.0004 23.7999 18.9126 23.7431 18.8125L21.6649 15.1813C20.4568 15.9982 19.124 16.6136 17.7187 17.0034L18.3607 20.8556C18.3797 20.969 18.3761 21.0851 18.3502 21.1971C18.3242 21.3091 18.2765 21.4149 18.2096 21.5085C18.1428 21.602 18.0582 21.6815 17.9606 21.7423C17.8631 21.8031 17.7545 21.8441 17.641 21.863C17.5944 21.8706 17.5472 21.8746 17.4999 21.875C17.2929 21.8747 17.0928 21.801 16.935 21.667C16.7772 21.5331 16.672 21.3475 16.6381 21.1433L16.007 17.3611C14.6761 17.5463 13.326 17.5463 11.9951 17.3611L11.364 21.1433C11.33 21.3479 11.2245 21.5337 11.0663 21.6677C10.908 21.8018 10.7073 21.8752 10.4999 21.875C10.4516 21.8748 10.4033 21.8708 10.3556 21.863C10.2421 21.8441 10.1335 21.8031 10.036 21.7423C9.93842 21.6815 9.8538 21.602 9.78696 21.5085C9.72012 21.4149 9.67238 21.3091 9.64645 21.1971C9.62053 21.0851 9.61694 20.969 9.63588 20.8556L10.2812 17.0034C8.87641 16.6123 7.54441 15.9958 6.33713 15.178L4.26557 18.8125C4.14954 19.0147 3.95794 19.1625 3.73292 19.2234C3.50791 19.2843 3.26791 19.2534 3.06573 19.1374C2.86354 19.0213 2.71573 18.8297 2.65481 18.6047C2.59389 18.3797 2.62485 18.1397 2.74088 17.9375L4.92838 14.1094C4.16002 13.4456 3.45348 12.7134 2.81744 11.9219C2.73812 11.8333 2.67768 11.7295 2.63981 11.6168C2.60194 11.5041 2.58744 11.3849 2.59718 11.2664C2.60693 11.1479 2.64071 11.0327 2.69649 10.9277C2.75226 10.8227 2.82884 10.7301 2.92156 10.6557C3.01428 10.5813 3.1212 10.5266 3.23578 10.4948C3.35036 10.4631 3.4702 10.4551 3.58799 10.4712C3.70578 10.4873 3.81905 10.5273 3.92088 10.5887C4.02271 10.65 4.11096 10.7315 4.18026 10.8281C5.99588 13.0747 9.17213 15.75 13.9999 15.75C18.8278 15.75 22.004 13.0714 23.8196 10.8281C23.8881 10.7295 23.9762 10.6461 24.0783 10.583C24.1805 10.5199 24.2945 10.4785 24.4133 10.4614C24.5321 10.4442 24.6532 10.4517 24.769 10.4834C24.8848 10.5151 24.9928 10.5702 25.0864 10.6454C25.18 10.7207 25.2571 10.8143 25.3129 10.9206C25.3687 11.0269 25.402 11.1435 25.4108 11.2633C25.4196 11.383 25.4037 11.5032 25.364 11.6166C25.3244 11.7299 25.2618 11.8338 25.1803 11.9219C24.5442 12.7134 23.8377 13.4456 23.0693 14.1094L25.2568 17.9375C25.3155 18.0373 25.3539 18.1477 25.3696 18.2625C25.3853 18.3772 25.3781 18.4939 25.3484 18.6058C25.3187 18.7177 25.2671 18.8226 25.1965 18.9144C25.126 19.0062 25.0379 19.0831 24.9374 19.1406Z`,fill:`currentColor`})}),"animation.typeBounce":e=>(0,J.jsx)(`svg`,{width:`28`,height:`28`,viewBox:`0 0 28 28`,xmlns:`http://www.w3.org/2000/svg`,style:{margin:0},...e,children:(0,J.jsx)(`path`,{d:`M14 3.5C18.6944 3.5 22.5 7.30558 22.5 12C22.5 16.6944 18.6944 20.5 14 20.5C9.30558 20.5 5.5 16.6944 5.5 12C5.5 7.30558 9.30558 3.5 14 3.5ZM14 5.25C10.2721 5.25 7.25 8.27208 7.25 12C7.25 15.7279 10.2721 18.75 14 18.75C17.7279 18.75 20.75 15.7279 20.75 12C20.75 8.27208 17.7279 5.25 14 5.25ZM14 7C16.7614 7 19 9.23858 19 12C19 14.7614 16.7614 17 14 17C11.2386 17 9 14.7614 9 12C9 9.23858 11.2386 7 14 7ZM14 8.75C12.2051 8.75 10.75 10.2051 10.75 12C10.75 13.7949 12.2051 15.25 14 15.25C15.7949 15.25 17.25 13.7949 17.25 12C17.25 10.2051 15.7949 8.75 14 8.75ZM14 10.5C14.8284 10.5 15.5 11.1716 15.5 12C15.5 12.8284 14.8284 13.5 14 13.5C13.1716 13.5 12.5 12.8284 12.5 12C12.5 11.1716 13.1716 10.5 14 10.5Z`,fill:`currentColor`})})},yW=It.map(),bW=Qn(e=>{for(let t of Object.keys(e)){let n=e[t];if(n!=null){if(typeof n!=`function`&&typeof n!=`object`){console.warn(`polotno: setIcons('${t}') expects a React component, received ${typeof n}. Ignored.`);continue}yW.set(t,n)}}});Qn(()=>yW.clear());var $=W(({name:e,...t})=>(0,J.jsx)(yW.get(e)??vW[e],{"data-pn-icon":``,...t}));function xW(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=xW(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function SW(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=xW(e))&&(r&&(r+=` `),r+=t);return r}var CW=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},wW=(e,t)=>({classGroupId:e,validator:t}),TW=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),EW=`-`,DW=[],OW=`arbitrary..`,kW=e=>{let t=MW(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return jW(e);let n=e.split(EW);return AW(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?CW(i,t):t:i||DW}return n[e]||DW}}},AW=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=AW(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(EW):e.slice(t).join(EW),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},jW=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?OW+r:void 0})(),MW=e=>{let{theme:t,classGroups:n}=e;return NW(n,t)},NW=(e,t)=>{let n=TW();for(let r in e){let i=e[r];PW(i,n,r,t)}return n},PW=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];FW(i,t,n,r)}},FW=(e,t,n,r)=>{if(typeof e==`string`){IW(e,t,n);return}if(typeof e==`function`){LW(e,t,n,r);return}RW(e,t,n,r)},IW=(e,t,n)=>{let r=e===``?t:zW(t,e);r.classGroupId=n},LW=(e,t,n,r)=>{if(BW(e)){PW(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(wW(n,e))},RW=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];PW(o,zW(t,a),n,r)}},zW=(e,t)=>{let n=e,r=t.split(EW),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=TW(),n.nextPart.set(t,i)),n=i}return n},BW=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,VW=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},HW=`!`,UW=`:`,WW=[],GW=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),KW=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===UW){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(HW)?(c=s.slice(0,-1),l=!0):s.startsWith(HW)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return GW(t,l,c,u)};if(t){let e=t+UW,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):GW(WW,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},qW=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},JW=e=>({cache:VW(e.cacheSize),parseClassName:KW(e),sortModifiers:qW(e),postfixLookupClassGroupIds:YW(e),...kW(e)}),YW=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e<n.length;e++)t[n[e]]=!0;return t},XW=/\s+/,ZW=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(XW),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let h=!!m,g;if(h){g=r(p.substring(0,m));let e=g&&o[g]?r(p):void 0;e&&e!==g&&(g=e,h=!1)}else g=r(p);if(!g){if(!h){l=t+(l.length>0?` `+l:l);continue}if(g=r(p),!g){l=t+(l.length>0?` `+l:l);continue}h=!1}let _=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),v=f?_+HW:_,y=v+g;if(s.indexOf(y)>-1)continue;s.push(y);let b=i(g,h);for(let e=0;e<b.length;++e){let t=b[e];s.push(v+t)}l=t+(l.length>0?` `+l:l)}return l},QW=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=$W(n))&&(i&&(i+=` `),i+=r);return i},$W=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=$W(e[r]))&&(n&&(n+=` `),n+=t);return n},eG=(e,...t)=>{let n,r,i,a,o=o=>(n=JW(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=ZW(e,n);return i(e,a),a};return a=o,(...e)=>a(QW(...e))},tG=[],nG=e=>{let t=t=>t[e]||tG;return t.isThemeGetter=!0,t},rG=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,iG=/^\((?:(\w[\w-]*):)?(.+)\)$/i,aG=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,oG=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,sG=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,cG=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,lG=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,uG=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,dG=e=>aG.test(e),fG=e=>!!e&&!Number.isNaN(Number(e)),pG=e=>!!e&&Number.isInteger(Number(e)),mG=e=>e.endsWith(`%`)&&fG(e.slice(0,-1)),hG=e=>oG.test(e),gG=()=>!0,_G=e=>sG.test(e)&&!cG.test(e),vG=()=>!1,yG=e=>lG.test(e),bG=e=>uG.test(e),xG=e=>!wG(e)&&!MG(e),SG=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),CG=e=>BG(e,WG,vG),wG=e=>rG.test(e),TG=e=>BG(e,GG,_G),EG=e=>BG(e,KG,fG),DG=e=>BG(e,JG,gG),OG=e=>BG(e,qG,vG),kG=e=>BG(e,HG,vG),AG=e=>BG(e,UG,bG),jG=e=>BG(e,YG,yG),MG=e=>iG.test(e),NG=e=>VG(e,GG),PG=e=>VG(e,qG),FG=e=>VG(e,HG),IG=e=>VG(e,WG),LG=e=>VG(e,UG),RG=e=>VG(e,YG,!0),zG=e=>VG(e,JG,!0),BG=(e,t,n)=>{let r=rG.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},VG=(e,t,n=!1)=>{let r=iG.exec(e);return r?r[1]?t(r[1]):n:!1},HG=e=>e===`position`||e===`percentage`,UG=e=>e===`image`||e===`url`,WG=e=>e===`length`||e===`size`||e===`bg-size`,GG=e=>e===`length`,KG=e=>e===`number`,qG=e=>e===`family-name`,JG=e=>e===`number`||e===`weight`,YG=e=>e===`shadow`,XG=()=>{let e=nG(`color`),t=nG(`font`),n=nG(`text`),r=nG(`font-weight`),i=nG(`tracking`),a=nG(`leading`),o=nG(`breakpoint`),s=nG(`container`),c=nG(`spacing`),l=nG(`radius`),u=nG(`shadow`),d=nG(`inset-shadow`),f=nG(`text-shadow`),p=nG(`drop-shadow`),m=nG(`blur`),h=nG(`perspective`),g=nG(`aspect`),_=nG(`ease`),v=nG(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),MG,wG],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[MG,wG,c],T=()=>[dG,`full`,`auto`,...w()],E=()=>[pG,`none`,`subgrid`,MG,wG],D=()=>[`auto`,{span:[`full`,pG,MG,wG]},pG,MG,wG],O=()=>[pG,`auto`,MG,wG],k=()=>[`auto`,`min`,`max`,`fr`,MG,wG],A=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],j=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],M=()=>[`auto`,...w()],N=()=>[dG,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[dG,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],F=()=>[dG,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],I=()=>[e,MG,wG],L=()=>[...b(),FG,kG,{position:[MG,wG]}],ee=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],R=()=>[`auto`,`cover`,`contain`,IG,CG,{size:[MG,wG]}],z=()=>[mG,NG,TG],B=()=>[``,`none`,`full`,l,MG,wG],V=()=>[``,fG,NG,TG],H=()=>[`solid`,`dashed`,`dotted`,`double`],te=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],U=()=>[fG,mG,FG,kG],ne=()=>[``,`none`,m,MG,wG],re=()=>[`none`,fG,MG,wG],ie=()=>[`none`,fG,MG,wG],ae=()=>[fG,MG,wG],oe=()=>[dG,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[hG],breakpoint:[hG],color:[gG],container:[hG],"drop-shadow":[hG],ease:[`in`,`out`,`in-out`],font:[xG],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[hG],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[hG],shadow:[hG],spacing:[`px`,fG],text:[hG],"text-shadow":[hG],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,dG,wG,MG,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,MG,wG]}],"container-named":[SG],columns:[{columns:[fG,wG,MG,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[pG,`auto`,MG,wG]}],basis:[{basis:[dG,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[fG,dG,`auto`,`initial`,`none`,wG]}],grow:[{grow:[``,fG,MG,wG]}],shrink:[{shrink:[``,fG,MG,wG]}],order:[{order:[pG,`first`,`last`,`none`,MG,wG]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...A(),`normal`]}],"justify-items":[{"justify-items":[...j(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...j()]}],"align-content":[{content:[`normal`,...A()]}],"align-items":[{items:[...j(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...j(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...j(),`baseline`]}],"place-self":[{"place-self":[`auto`,...j()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mbs:[{mbs:M()}],mbe:[{mbe:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:N()}],"inline-size":[{inline:[`auto`,...P()]}],"min-inline-size":[{"min-inline":[`auto`,...P()]}],"max-inline-size":[{"max-inline":[`none`,...P()]}],"block-size":[{block:[`auto`,...F()]}],"min-block-size":[{"min-block":[`auto`,...F()]}],"max-block-size":[{"max-block":[`none`,...F()]}],w:[{w:[s,`screen`,...N()]}],"min-w":[{"min-w":[s,`screen`,`none`,...N()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...N()]}],h:[{h:[`screen`,`lh`,...N()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...N()]}],"max-h":[{"max-h":[`screen`,`lh`,...N()]}],"font-size":[{text:[`base`,n,NG,TG]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,zG,DG]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,mG,wG]}],"font-family":[{font:[PG,OG,t]}],"font-features":[{"font-features":[wG]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,MG,wG]}],"line-clamp":[{"line-clamp":[fG,`none`,MG,EG]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,MG,wG]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,MG,wG]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...H(),`wavy`]}],"text-decoration-thickness":[{decoration:[fG,`from-font`,`auto`,MG,TG]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[fG,`auto`,MG,wG]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"tab-size":[{tab:[pG,MG,wG]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,MG,wG]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,MG,wG]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:L()}],"bg-repeat":[{bg:ee()}],"bg-size":[{bg:R()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},pG,MG,wG],radial:[``,MG,wG],conic:[pG,MG,wG]},LG,AG]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:z()}],"gradient-via-pos":[{via:z()}],"gradient-to-pos":[{to:z()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:B()}],"rounded-s":[{"rounded-s":B()}],"rounded-e":[{"rounded-e":B()}],"rounded-t":[{"rounded-t":B()}],"rounded-r":[{"rounded-r":B()}],"rounded-b":[{"rounded-b":B()}],"rounded-l":[{"rounded-l":B()}],"rounded-ss":[{"rounded-ss":B()}],"rounded-se":[{"rounded-se":B()}],"rounded-ee":[{"rounded-ee":B()}],"rounded-es":[{"rounded-es":B()}],"rounded-tl":[{"rounded-tl":B()}],"rounded-tr":[{"rounded-tr":B()}],"rounded-br":[{"rounded-br":B()}],"rounded-bl":[{"rounded-bl":B()}],"border-w":[{border:V()}],"border-w-x":[{"border-x":V()}],"border-w-y":[{"border-y":V()}],"border-w-s":[{"border-s":V()}],"border-w-e":[{"border-e":V()}],"border-w-bs":[{"border-bs":V()}],"border-w-be":[{"border-be":V()}],"border-w-t":[{"border-t":V()}],"border-w-r":[{"border-r":V()}],"border-w-b":[{"border-b":V()}],"border-w-l":[{"border-l":V()}],"divide-x":[{"divide-x":V()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":V()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...H(),`hidden`,`none`]}],"divide-style":[{divide:[...H(),`hidden`,`none`]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-bs":[{"border-bs":I()}],"border-color-be":[{"border-be":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...H(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[fG,MG,wG]}],"outline-w":[{outline:[``,fG,NG,TG]}],"outline-color":[{outline:I()}],shadow:[{shadow:[``,`none`,u,RG,jG]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":[`none`,d,RG,jG]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:V()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[fG,TG]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":V()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":[`none`,f,RG,jG]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[fG,MG,wG]}],"mix-blend":[{"mix-blend":[...te(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":te()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[fG]}],"mask-image-linear-from-pos":[{"mask-linear-from":U()}],"mask-image-linear-to-pos":[{"mask-linear-to":U()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":U()}],"mask-image-t-to-pos":[{"mask-t-to":U()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":U()}],"mask-image-r-to-pos":[{"mask-r-to":U()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":U()}],"mask-image-b-to-pos":[{"mask-b-to":U()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":U()}],"mask-image-l-to-pos":[{"mask-l-to":U()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":U()}],"mask-image-x-to-pos":[{"mask-x-to":U()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":U()}],"mask-image-y-to-pos":[{"mask-y-to":U()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[MG,wG]}],"mask-image-radial-from-pos":[{"mask-radial-from":U()}],"mask-image-radial-to-pos":[{"mask-radial-to":U()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[fG]}],"mask-image-conic-from-pos":[{"mask-conic-from":U()}],"mask-image-conic-to-pos":[{"mask-conic-to":U()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:L()}],"mask-repeat":[{mask:ee()}],"mask-size":[{mask:R()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,MG,wG]}],filter:[{filter:[``,`none`,MG,wG]}],blur:[{blur:ne()}],brightness:[{brightness:[fG,MG,wG]}],contrast:[{contrast:[fG,MG,wG]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,RG,jG]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:[``,fG,MG,wG]}],"hue-rotate":[{"hue-rotate":[fG,MG,wG]}],invert:[{invert:[``,fG,MG,wG]}],saturate:[{saturate:[fG,MG,wG]}],sepia:[{sepia:[``,fG,MG,wG]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,MG,wG]}],"backdrop-blur":[{"backdrop-blur":ne()}],"backdrop-brightness":[{"backdrop-brightness":[fG,MG,wG]}],"backdrop-contrast":[{"backdrop-contrast":[fG,MG,wG]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,fG,MG,wG]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[fG,MG,wG]}],"backdrop-invert":[{"backdrop-invert":[``,fG,MG,wG]}],"backdrop-opacity":[{"backdrop-opacity":[fG,MG,wG]}],"backdrop-saturate":[{"backdrop-saturate":[fG,MG,wG]}],"backdrop-sepia":[{"backdrop-sepia":[``,fG,MG,wG]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,MG,wG]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[fG,`initial`,MG,wG]}],ease:[{ease:[`linear`,`initial`,_,MG,wG]}],delay:[{delay:[fG,MG,wG]}],animate:[{animate:[`none`,v,MG,wG]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,MG,wG]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:re()}],"rotate-x":[{"rotate-x":re()}],"rotate-y":[{"rotate-y":re()}],"rotate-z":[{"rotate-z":re()}],scale:[{scale:ie()}],"scale-x":[{"scale-x":ie()}],"scale-y":[{"scale-y":ie()}],"scale-z":[{"scale-z":ie()}],"scale-3d":[`scale-3d`],skew:[{skew:ae()}],"skew-x":[{"skew-x":ae()}],"skew-y":[{"skew-y":ae()}],transform:[{transform:[MG,wG,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:oe()}],"translate-x":[{"translate-x":oe()}],"translate-y":[{"translate-y":oe()}],"translate-z":[{"translate-z":oe()}],"translate-none":[`translate-none`],zoom:[{zoom:[pG,MG,wG]}],accent:[{accent:I()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:I()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,MG,wG]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":I()}],"scrollbar-track-color":[{"scrollbar-track":I()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,MG,wG]}],fill:[{fill:[`none`,...I()]}],"stroke-w":[{stroke:[fG,NG,TG,EG]}],stroke:[{stroke:[`none`,...I()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}},ZG=(e,{cacheSize:t,prefix:n,experimentalParseClassName:r,extend:i={},override:a={}})=>(QG(e,`cacheSize`,t),QG(e,`prefix`,n),QG(e,`experimentalParseClassName`,r),$G(e.theme,a.theme),$G(e.classGroups,a.classGroups),$G(e.conflictingClassGroups,a.conflictingClassGroups),$G(e.conflictingClassGroupModifiers,a.conflictingClassGroupModifiers),QG(e,`postfixLookupClassGroups`,a.postfixLookupClassGroups),QG(e,`orderSensitiveModifiers`,a.orderSensitiveModifiers),eK(e.theme,i.theme),eK(e.classGroups,i.classGroups),eK(e.conflictingClassGroups,i.conflictingClassGroups),eK(e.conflictingClassGroupModifiers,i.conflictingClassGroupModifiers),tK(e,i,`postfixLookupClassGroups`),tK(e,i,`orderSensitiveModifiers`),e),QG=(e,t,n)=>{n!==void 0&&(e[t]=n)},$G=(e,t)=>{if(t)for(let n in t)QG(e,n,t[n])},eK=(e,t)=>{if(t)for(let n in t)tK(e,t,n)},tK=(e,t,n)=>{let r=t[n];r!==void 0&&(e[n]=e[n]?e[n].concat(r):r)},nK=((e,...t)=>typeof e==`function`?eG(XG,e,...t):eG(()=>ZG(XG(),e),...t))({prefix:`pn`});function rK(...e){return nK(SW(e))}function iK(e,t,n){return Math.max(t,Math.min(n,e))}function aK(e){return Array.isArray(e)?e[0]:e}var oK=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,sK=SW,cK=(e,t)=>n=>{if(t?.variants==null)return sK(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=oK(t)||oK(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return sK(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},lK=cK(`pn:inline-flex pn:shrink-0 pn:items-center pn:justify-center pn:gap-2 pn:rounded-md pn:text-sm pn:font-medium pn:whitespace-nowrap pn:transition-all pn:outline-none pn:focus-visible:border-ring pn:focus-visible:ring-[3px] pn:focus-visible:ring-ring/50 pn:disabled:pointer-events-none pn:disabled:opacity-50 pn:aria-invalid:border-destructive pn:aria-invalid:ring-destructive/20 pn:dark:aria-invalid:ring-destructive/40 pn:[&_svg]:pointer-events-none pn:[&_svg]:shrink-0 pn:[&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`pn:bg-primary pn:text-primary-foreground pn:hover:bg-primary/90`,destructive:`pn:bg-destructive pn:text-white pn:hover:bg-destructive/90 pn:focus-visible:ring-destructive/20 pn:dark:bg-destructive/60 pn:dark:focus-visible:ring-destructive/40`,outline:`pn:border pn:bg-background pn:shadow-xs pn:hover:bg-accent pn:hover:text-accent-foreground pn:dark:border-input pn:dark:bg-input/30 pn:dark:hover:bg-input/50`,secondary:`pn:bg-secondary pn:text-secondary-foreground pn:hover:bg-secondary/80`,ghost:`pn:hover:bg-accent pn:hover:text-accent-foreground pn:dark:hover:bg-accent/50`},size:{default:`pn:h-9 pn:px-4 pn:py-2 pn:has-[>svg]:px-3`,sm:`pn:h-8 pn:gap-1.5 pn:rounded-md pn:px-3 pn:has-[>svg]:px-2.5`,lg:`pn:h-10 pn:rounded-md pn:px-6 pn:has-[>svg]:px-4`,icon:`pn:size-9`,"icon-sm":`pn:size-8`}},defaultVariants:{variant:`default`,size:`default`}}),uK=x.forwardRef(({className:e,variant:t=`default`,size:n=`default`,...r},i)=>(0,J.jsx)(`button`,{ref:i,"data-slot":`button`,"data-variant":t,"data-size":n,className:rK(lK({variant:t,size:n,className:e})),...r}));uK.displayName=`Button`;var dK={};function fK(e,t){let n=x.useRef(dK);return n.current===dK&&(n.current=e(t)),n}var pK=[],mK=void 0;function hK(){return mK}function gK(e){pK.push(e)}function _K(e){let t=(t,n)=>{let r=fK(yK).current,i;try{mK=r;for(let e of pK)e.before(r);i=e(t,n);for(let e of pK)e.after(r);r.didInitialize=!0}finally{mK=void 0}return i};return t.displayName=e.displayName||e.name,t}function vK(e){return x.forwardRef(_K(e))}function yK(){return{didInitialize:!1}}function bK(e){let t=x.useRef(!0);t.current&&(t.current=!1,e())}var xK=typeof document<`u`?x.useLayoutEffect:()=>{};function SK(e,t){return function(n,...r){let i=new URL(e);return i.searchParams.set(`code`,n.toString()),r.forEach(e=>i.searchParams.append(`args[]`,e)),`${t} error #${n}; visit ${i} for the full message.`}}var CK=SK(`https://base-ui.com/production-error`,`Base UI`),wK=x.createContext(void 0);function TK(e){let t=x.useContext(wK);if(t===void 0&&!e)throw Error(CK(72));return t}var EK=[];function DK(e){x.useEffect(e,EK)}var OK=0,kK=class e{static create(){return new e}currentId=OK;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=OK,t()},e)}isStarted(){return this.currentId!==OK}clear=()=>{this.currentId!==OK&&(clearTimeout(this.currentId),this.currentId=OK)};disposeEffect=()=>this.clear};function AK(){let e=fK(kK.create).current;return DK(e.disposeEffect),e}var jK=typeof navigator<`u`,MK=VK(),NK=UK(),PK=HK(),FK=typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter:none`),IK=MK.platform===`MacIntel`&&MK.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(MK.platform);jK&&/firefox/i.test(PK);var LK=jK&&/apple/i.test(navigator.vendor);jK&&/Edg/i.test(PK);var RK=jK&&/android/i.test(NK)||/android/i.test(PK),zK=jK&&NK.toLowerCase().startsWith(`mac`)&&!navigator.maxTouchPoints,BK=PK.includes(`jsdom/`);function VK(){if(!jK)return{platform:``,maxTouchPoints:-1};let e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??-1}}function HK(){if(!jK)return``;let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:e,version:t})=>`${e}/${t}`).join(` `):navigator.userAgent}function UK(){if(!jK)return``;let e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??``}function WK(e){e.preventDefault(),e.stopPropagation()}function GK(e){return`nativeEvent`in e}function KK(e){return e.pointerType===``&&e.isTrusted?!0:RK&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function qK(e){return BK?!1:!RK&&e.width===0&&e.height===0||RK&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function JK(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function YK(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}function XK(){return typeof window<`u`}function ZK(e){return eq(e)?(e.nodeName||``).toLowerCase():`#document`}function QK(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function $K(e){return((eq(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function eq(e){return XK()?e instanceof Node||e instanceof QK(e).Node:!1}function tq(e){return XK()?e instanceof Element||e instanceof QK(e).Element:!1}function nq(e){return XK()?e instanceof HTMLElement||e instanceof QK(e).HTMLElement:!1}function rq(e){return!XK()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof QK(e).ShadowRoot}function iq(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=hq(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function aq(e){return/^(table|td|th)$/.test(ZK(e))}function oq(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var sq=/transform|translate|scale|rotate|perspective|filter/,cq=/paint|layout|strict|content/,lq=e=>!!e&&e!==`none`,uq;function dq(e){let t=tq(e)?hq(e):e;return lq(t.transform)||lq(t.translate)||lq(t.scale)||lq(t.rotate)||lq(t.perspective)||!pq()&&(lq(t.backdropFilter)||lq(t.filter))||sq.test(t.willChange||``)||cq.test(t.contain||``)}function fq(e){let t=_q(e);for(;nq(t)&&!mq(t);){if(dq(t))return t;if(oq(t))return null;t=_q(t)}return null}function pq(){return uq??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),uq}function mq(e){return/^(html|body|#document)$/.test(ZK(e))}function hq(e){return QK(e).getComputedStyle(e)}function gq(e){return tq(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function _q(e){if(ZK(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||rq(e)&&e.host||$K(e);return rq(t)?t.host:t}function vq(e){let t=_q(e);return mq(t)?e.ownerDocument?e.ownerDocument.body:e.body:nq(t)&&iq(t)?t:vq(t)}function yq(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=vq(e),i=r===e.ownerDocument?.body,a=QK(r);if(i){let e=bq(a);return t.concat(a,a.visualViewport||[],iq(r)?r:[],e&&n?yq(e):[])}else return t.concat(r,yq(r,[],n))}function bq(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var xq=`data-base-ui-focusable`,Sq=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,Cq=`ArrowLeft`,wq=`ArrowRight`,Tq=`ArrowUp`,Eq=`ArrowDown`;function Dq(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function Oq(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&rq(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function kq(e){return`composedPath`in e?e.composedPath()[0]:e.target}function Aq(e,t){if(!tq(e))return!1;let n=e;if(t.hasElement(n))return!n.hasAttribute(`data-trigger-disabled`);for(let[,e]of t.entries())if(Oq(e,n))return!e.hasAttribute(`data-trigger-disabled`);return!1}function jq(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function Mq(e){return e.matches(`html,body`)}function Nq(e){return nq(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function Pq(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${Sq}`)!=null}function Fq(e){return e?e.getAttribute(`role`)===`combobox`&&Nq(e):!1}function Iq(e){if(!e||BK)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function Lq(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function Rq(e,t){return t!=null&&!JK(t)?0:typeof e==`function`?e():e}function zq(e,t,n){let r=Rq(e,n);return typeof r==`number`?r:r?.[t]}function Bq(e){return typeof e==`function`?e():e}function Vq(e,t){return t||e===`click`||e===`mousedown`}function Hq(e){return e?.includes(`mouse`)&&e!==`mousedown`}function Uq(){}var Wq=Object.freeze([]),Gq=Object.freeze({}),Kq=`none`,qq=`trigger-press`,Jq=`trigger-hover`,Yq=`trigger-focus`,Xq=`outside-press`,Zq=`item-press`,Qq=`close-press`,$q=`track-press`,eJ=`input-change`,tJ=`focus-out`,nJ=`escape-key`,rJ=`list-navigation`,iJ=`keyboard`,aJ=`drag`,oJ=`cancel-open`,sJ=`sibling-open`,cJ=`disabled`,lJ=`missing`,uJ=`initial`,dJ=`imperative-action`,fJ=`window-resize`;function pJ(e,t,n,r){let i=!1,a=!1,o=r??Gq;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}function mJ(e,t,n){let r=n??Gq;return{reason:e,event:t??new Event(`base-ui`),...r}}var hJ=x.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new kK,currentIdRef:{current:null},currentContextRef:{current:null}});function gJ(e){let{children:t,delay:n,timeoutMs:r=0}=e,i=x.useRef(n),a=x.useRef(n),o=x.useRef(null),s=x.useRef(null),c=AK();return(0,J.jsx)(hJ.Provider,{value:x.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:a,currentIdRef:o,timeoutMs:r,currentContextRef:s,timeout:c}),[r,c]),children:t})}function _J(e,t={open:!1}){let{open:n}=t,r=`rootStore`in e?e.rootStore:e,i=r.useState(`floatingId`),{currentIdRef:a,delayRef:o,timeoutMs:s,initialDelayRef:c,currentContextRef:l,hasProvider:u,timeout:d}=x.useContext(hJ),[f,p]=x.useState(!1);return xK(()=>{function e(){p(!1),l.current?.setIsInstantPhase(!1),a.current=null,l.current=null,o.current=c.current}if(a.current&&!n&&a.current===i){if(p(!1),s){let t=i;return d.start(s,()=>{r.select(`open`)||a.current&&a.current!==t||e()}),()=>{d.clear()}}e()}},[n,i,a,o,s,c,l,d,r]),xK(()=>{if(!n)return;let e=l.current,t=a.current;d.clear(),l.current={onOpenChange:r.setOpen,setIsInstantPhase:p},a.current=i,o.current={open:0,close:zq(c.current,`close`)},t!==null&&t!==i?(p(!0),e?.setIsInstantPhase(!0),e?.onOpenChange(!1,pJ(Kq))):(p(!1),e?.setIsInstantPhase(!1))},[n,i,r,a,o,c,l,d]),xK(()=>()=>{l.current=null},[l]),x.useMemo(()=>({hasProvider:u,delayRef:o,isInstantPhase:f}),[u,o,f])}function vJ(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function yJ(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}function bJ(e,t,n,r){let i=fK(SJ).current;return CJ(i,e,t,n,r)&&TJ(i,[e,t,n,r]),i.callback}function xJ(e){let t=fK(SJ).current;return wJ(t,e)&&TJ(t,e),t.callback}function SJ(){return{callback:null,cleanup:null,refs:[]}}function CJ(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function wJ(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function TJ(e,t){if(e.refs=t,t.every(e=>e==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&=(e.cleanup(),null),n!=null){let r=Array(t.length).fill(null);for(let e=0;e<t.length;e+=1){let i=t[e];if(i!=null)switch(typeof i){case`function`:{let t=i(n);typeof t==`function`&&(r[e]=t);break}case`object`:i.current=n;break;default:}}e.cleanup=()=>{for(let e=0;e<t.length;e+=1){let n=t[e];if(n!=null)switch(typeof n){case`function`:{let t=r[e];typeof t==`function`?t():n(null);break}case`object`:n.current=null;break;default:}}}}}}function EJ(e){let t=fK(DJ,e).current;return t.next=e,xK(t.effect),t}function DJ(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var OJ={...x},kJ=OJ.useInsertionEffect,AJ=kJ&&kJ!==OJ.useLayoutEffect?kJ:e=>e();function jJ(e){let t=fK(MJ).current;return t.next=e,AJ(t.effect),t.trampoline}function MJ(){let e={next:void 0,callback:NJ,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function NJ(){}var PJ=null;globalThis.requestAnimationFrame;var FJ=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n<t.length;n+=1)t[n]?.(e)};request(e){let t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||=(requestAnimationFrame(this.tick),!0),t}cancel(e){let t=e-this.startId;t<0||t>=this.callbacks.length||(this.callbacks[t]=null,--this.callbacksCount)}},IJ=class e{static create(){return new e}static request(e){return FJ.request(e)}static cancel(e){return FJ.cancel(e)}currentId=PJ;request(e){this.cancel(),this.currentId=FJ.request(()=>{this.currentId=PJ,e()})}cancel=()=>{this.currentId!==PJ&&(FJ.cancel(this.currentId),this.currentId=PJ)};disposeEffect=()=>this.cancel};function LJ(){let e=fK(IJ.create).current;return DK(e.disposeEffect),e}function RJ(e){return e?.ownerDocument||document}var zJ={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},BJ={...zJ,position:`fixed`,top:0,left:0},VJ={...zJ,position:`absolute`},HJ=x.forwardRef(function(e,t){let[n,r]=x.useState();xK(()=>{LK&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,J.jsx)(`span`,{...e,ref:t,style:BJ,"aria-hidden":n?void 0:!0,...i,"data-base-ui-focus-guard":``})}),UJ=[`top`,`right`,`bottom`,`left`],WJ=Math.min,GJ=Math.max,KJ=Math.round,qJ=Math.floor,JJ=e=>({x:e,y:e}),YJ={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function XJ(e,t,n){return GJ(e,WJ(t,n))}function ZJ(e,t){return typeof e==`function`?e(t):e}function QJ(e){return e.split(`-`)[0]}function $J(e){return e.split(`-`)[1]}function eY(e){return e===`x`?`y`:`x`}function tY(e){return e===`y`?`height`:`width`}function nY(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function rY(e){return eY(nY(e))}function iY(e,t,n){n===void 0&&(n=!1);let r=$J(e),i=rY(e),a=tY(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=pY(o)),[o,pY(o)]}function aY(e){let t=pY(e);return[oY(e),t,oY(t)]}function oY(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var sY=[`left`,`right`],cY=[`right`,`left`],lY=[`top`,`bottom`],uY=[`bottom`,`top`];function dY(e,t,n){switch(e){case`top`:case`bottom`:return n?t?cY:sY:t?sY:cY;case`left`:case`right`:return t?lY:uY;default:return[]}}function fY(e,t,n,r){let i=$J(e),a=dY(QJ(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(oY)))),a}function pY(e){let t=QJ(e);return YJ[t]+e.slice(t.length)}function mY(e){return{top:0,right:0,bottom:0,left:0,...e}}function hY(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:mY(e)}function gY(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 _Y(e,t,n){return Math.floor(e/t)!==n}function vY(e,t){return t<0||t>=e.length}function yY(e,t){return xY(e.current,{disabledIndices:t})}function bY(e,t){return xY(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function xY(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:i=1}={}){let a=t;do a+=n?-i:i;while(a>=0&&a<=e.length-1&&EY(e,a,r));return a}function SY(e,{event:t,orientation:n,loopFocus:r,onLoop:i,rtl:a,cols:o,disabledIndices:s,minIndex:c,maxIndex:l,prevIndex:u,stopEvent:d=!1}){let f=u,p;if(t.key===`ArrowUp`?p=`up`:t.key===`ArrowDown`&&(p=`down`),p){let n=[],a=[],m=!1,h=0;{let t=null,r=-1;e.forEach((e,i)=>{if(e==null)return;h+=1;let o=e.closest(`[role="row"]`);o&&(m=!0),(o!==t||r===-1)&&(t=o,r+=1,n[r]=[]),n[r].push(i),a[i]=r})}let g=!1,_=0;if(m)for(let e of n){let t=e.length;t>_&&(_=t),t!==o&&(g=!0)}let v=g&&h<e.length,y=_||o,b=o=>{if(!g||u===-1)return;let c=a[u];if(c==null)return;let l=n[c].indexOf(u),d=o===`up`?-1:1;for(let o=c+d,f=0;f<n.length;f+=1,o+=d){if(o<0||o>=n.length){if(!r||v)return;if(o=o<0?n.length-1:0,i){let e=Math.min(l,n[o].length-1);o=a[i(t,u,n[o][e]??n[o][0])]??o}}let c=n[o];for(let t=Math.min(l,c.length-1);t>=0;--t){let n=c[t];if(!EY(e,n,s))return n}}},x=t=>{if(!v||u===-1)return;let n=u%y,i=t===`up`?-y:y,a=l-l%y,o=qJ(l/y)+1;for(let t=u-n+i,c=0;c<o;c+=1,t+=i){if(t<0||t>l){if(!r)return;t=t<0?a:0}let i=Math.min(t+y-1,l);for(let r=Math.min(t+n,i);r>=t;--r)if(!EY(e,r,s))return r}};d&&WK(t);let S=b(p)??x(p);if(S!==void 0)f=S;else if(u===-1)f=p===`up`?l:c;else if(f=xY(e,{startingIndex:u,amount:y,decrement:p===`up`,disabledIndices:s}),r){if(p===`up`&&(u-y<c||f<0)){let e=u%y,n=l%y,r=l-(n-e);f=n===e?l:n>e?r:r-y,i&&(f=i(t,u,f))}p===`down`&&u+y>l&&(f=xY(e,{startingIndex:u%y-y,amount:y,disabledIndices:s}),i&&(f=i(t,u,f)))}vY(e,f)&&(f=u)}if(n===`both`){let n=qJ(u/o);t.key===(a?`ArrowLeft`:`ArrowRight`)&&(d&&WK(t),u%o===o-1?r&&(f=xY(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f))):(f=xY(e,{startingIndex:u,disabledIndices:s}),r&&_Y(f,o,n)&&(f=xY(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f)))),_Y(f,o,n)&&(f=u)),t.key===(a?`ArrowRight`:`ArrowLeft`)&&(d&&WK(t),u%o===0?r&&(f=xY(e,{startingIndex:u+(o-u%o),decrement:!0,disabledIndices:s}),i&&(f=i(t,u,f))):(f=xY(e,{startingIndex:u,decrement:!0,disabledIndices:s}),r&&_Y(f,o,n)&&(f=xY(e,{startingIndex:u+(o-u%o),decrement:!0,disabledIndices:s}),i&&(f=i(t,u,f)))),_Y(f,o,n)&&(f=u));let c=qJ(l/o)===n;vY(e,f)&&(r&&c?(f=t.key===(a?`ArrowRight`:`ArrowLeft`)?l:xY(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f))):f=u)}return f}function CY(e,t,n){let r=[],i=0;return e.forEach(({width:e,height:a},o)=>{let s=!1;for(n&&(i=0);!s;){let n=[];for(let r=0;r<e;r+=1)for(let e=0;e<a;e+=1)n.push(i+r+e*t);i%t+e<=t&&n.every(e=>r[e]==null)?(n.forEach(e=>{r[e]=o}),s=!0):i+=1}}),[...r]}function wY(e,t,n,r,i){if(e===-1)return-1;let a=n.indexOf(e),o=t[e];switch(i){case`tl`:return a;case`tr`:return o?a+o.width-1:a;case`bl`:return o?a+(o.height-1)*r:a;case`br`:return n.lastIndexOf(e);default:return-1}}function TY(e,t){return t.flatMap((t,n)=>e.includes(t)?[n]:[])}function EY(e,t,n){if(typeof n==`function`?n(t):n?.includes(t)??!1)return!0;let r=e[t];return r?OY(r)?!n&&(r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`):!0:!1}function DY(e){return e.visibility===`hidden`||e.visibility===`collapse`}function OY(e,t=e?hq(e):null){return!e||!e.isConnected||!t||DY(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}var kY=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`;function AY(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return rq(n)?n.host:null}function jY(e){for(let t of Array.from(e.children))if(ZK(t)===`summary`)return t;return null}function MY(e,t){let n=jY(t);return!!n&&(e===n||Oq(n,e))}function NY(e){let t=e?ZK(e):``;return e!=null&&e.matches(kY)&&(t!==`summary`||e.parentElement!=null&&ZK(e.parentElement)===`details`&&jY(e.parentElement)===e)&&(t!==`details`||jY(e)==null)&&(t!==`input`||e.type!==`hidden`)}function PY(e){if(!NY(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=AY(t)){let n=t!==e,r=ZK(t)===`slot`;if(t.hasAttribute(`inert`)||n&&ZK(t)===`details`&&!t.open&&!MY(e,t)||t.hasAttribute(`hidden`)||!r&&!FY(t,n))return!1}return!0}function FY(e,t){let n=hq(e);return t?n.display!==`none`:OY(e,n)}function IY(e){let t=e.tabIndex;if(t<0){let t=ZK(e);if(t===`details`||t===`audio`||t===`video`||nq(e)&&e.isContentEditable)return 0}return t}function LY(e){if(ZK(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function RY(e,t){let n=LY(e);if(!n)return!0;let r=t.find(e=>{let t=LY(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=LY(e);return t?.name===n.name&&t.form===n.form})===n}function zY(e){if(nq(e)&&ZK(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return nq(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function BY(e,t){zY(e).forEach(e=>{NY(e)&&t.push(e),BY(e,t)})}function VY(e,t,n){zY(e).forEach(e=>{nq(e)&&e.matches(t)&&n.push(e),VY(e,t,n)})}function HY(e){return PY(e)&&IY(e)>=0}function UY(e){let t=[];return BY(e,t),t.filter(PY)}function WY(e){let t=UY(e);return t.filter(e=>IY(e)>=0&&RY(e,t))}function GY(e,t){let n=WY(e),r=n.length;if(r===0)return;let i=Dq(RJ(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function KY(e){return GY(RJ(e).body,1)||e}function qY(e){return GY(RJ(e).body,-1)||e}function JY(e,t){if(!e)return null;let n=WY(RJ(e).body),r=n.length;if(r===0)return null;let i=n.indexOf(e);return i===-1?null:n[(i+t+r)%r]}function YY(e){return JY(e,1)}function XY(e){return JY(e,-1)}function ZY(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!Oq(n,r)}function QY(e){WY(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function $Y(e){let t=[];VY(e,`[data-tabindex]`,t),t.forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}function eX(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...eX(e,t.id,n)])}function tX(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){let t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}function nX(e){return`data-base-ui-${e}`}var rX=0;function iX(e,t={}){let{preventScroll:n=!1,sync:r=!1,shouldFocus:i}=t;cancelAnimationFrame(rX);function a(){i&&!i()||e?.focus({preventScroll:n})}if(r)return a(),Uq;let o=requestAnimationFrame(a);return rX=o,()=>{rX===o&&(cancelAnimationFrame(o),rX=0)}}var aX={inert:new WeakMap,"aria-hidden":new WeakMap},oX=`data-base-ui-inert`,sX={inert:new WeakSet,"aria-hidden":new WeakSet},cX=new WeakMap,lX=0;function uX(e){return sX[e]}function dX(e){return e?rq(e)?e.host:dX(e.parentNode):null}var fX=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=dX(t);return e.contains(n)?n:null}).filter(e=>e!=null),pX=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},mX=(e,t,n)=>{let r=[],i=e=>{!e||n.has(e)||Array.from(e.children).forEach(e=>{ZK(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function hX(e,t,n,r,{mark:i=!0,markerIgnoreElements:a=[]}){let o=r?`inert`:n?`aria-hidden`:null,s=null,c=null,l=fX(t,e),u=i?fX(t,a):[],d=new Set(u),f=i?mX(t,pX(l),new Set(l)).filter(e=>!d.has(e)):[],p=[],m=[];if(o){let e=aX[o],n=uX(o);c=n,s=e;let r=fX(t,Array.from(t.querySelectorAll(`[aria-live]`))),i=l.concat(r);mX(t,pX(i),new Set(i)).forEach(t=>{let r=t.getAttribute(o),i=r!==null&&r!==`false`,a=(e.get(t)||0)+1;e.set(t,a),p.push(t),a===1&&i&&n.add(t),i||t.setAttribute(o,o===`inert`?``:`true`)})}return i&&f.forEach(e=>{let t=(cX.get(e)||0)+1;cX.set(e,t),m.push(e),t===1&&e.setAttribute(oX,``)}),lX+=1,()=>{s&&p.forEach(e=>{let t=(s.get(e)||0)-1;s.set(e,t),t||(!c?.has(e)&&o&&e.removeAttribute(o),c?.delete(e))}),i&&m.forEach(e=>{let t=(cX.get(e)||0)-1;cX.set(e,t),t||e.removeAttribute(oX)}),--lX,lX||(aX.inert=new WeakMap,aX[`aria-hidden`]=new WeakMap,sX.inert=new WeakSet,sX[`aria-hidden`]=new WeakSet,cX=new WeakMap)}}function gX(e,t={}){let{ariaHidden:n=!1,inert:r=!1,mark:i=!0,markerIgnoreElements:a=[]}=t,o=RJ(e[0]).body;return hX(e,o,n,r,{mark:i,markerIgnoreElements:a})}var _X=0;function vX(e,t=`mui`){let[n,r]=x.useState(e),i=e||n;return x.useEffect(()=>{n??(_X+=1,r(`${t}-${_X}`))},[n,t]),i}var yX=OJ.useId;function bX(e,t){if(yX!==void 0){let n=yX();return e??(t?`${t}-${n}`:n)}return vX(e,t)}var xX=19;function SX(e){return xX>=e}function CX(e){if(!x.isValidElement(e))return null;let t=e,n=t.props;return(SX(19)?n?.ref:t.ref)??null}function wX(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function TX(e,t){let n={};for(let r in e){let i=e[r];if(t?.hasOwnProperty(r)){let e=t[r](i);e!=null&&Object.assign(n,e);continue}i===!0?n[`data-${r.toLowerCase()}`]=``:i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function EX(e,t){return typeof e==`function`?e(t):e}function DX(e,t){return typeof e==`function`?e(t):e}var OX={};function kX(e,t,n,r,i){if(!n&&!r&&!i&&!e)return jX(t);let a=jX(e);return t&&(a=MX(a,t)),n&&(a=MX(a,n)),r&&(a=MX(a,r)),i&&(a=MX(a,i)),a}function AX(e){if(e.length===0)return OX;if(e.length===1)return jX(e[0]);let t=jX(e[0]);for(let n=1;n<e.length;n+=1)t=MX(t,e[n]);return t}function jX(e){return IX(e)?{...LX(e,OX)}:NX(e)}function MX(e,t){return IX(t)?LX(t,e):PX(e,t)}function NX(e){let t={...e};for(let e in t){let n=t[e];FX(e,n)&&(t[e]=zX(n))}return t}function PX(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=wX(e.style,r);break;case`className`:e[n]=VX(e.className,r);break;default:FX(n,r)?e[n]=RX(e[n],r):e[n]=r}}return e}function FX(e,t){let n=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return n===111&&r===110&&i>=65&&i<=90&&(typeof t==`function`||t===void 0)}function IX(e){return typeof e==`function`}function LX(e,t){return IX(e)?e(t):e??OX}function RX(e,t){return t?e?(...n)=>{let r=n[0];if(HX(r)){let i=r;BX(i);let a=t(...n);return i.baseUIHandlerPrevented||e?.(...n),a}let i=t(...n);return e?.(...n),i}:zX(t):e}function zX(e){return e&&((...t)=>{let n=t[0];return HX(n)&&BX(n),e(...t)})}function BX(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function VX(e,t){return t?e?t+` `+e:t:e}function HX(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function UX(e,t,n={}){let r=t.render,i=WX(t,n);return n.enabled===!1?null:qX(e,r,i,n.state??Gq)}function WX(e,t={}){let{className:n,style:r,render:i}=e,{state:a=Gq,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?EX(n,a):void 0,d=l?DX(r,a):void 0,f=l?TX(a,c):Gq,p=l&&s?GX(s):void 0,m=l?wX(f,p)??{}:Gq;return typeof document<`u`&&(l?Array.isArray(o)?m.ref=xJ([m.ref,CX(i),...o]):m.ref=bJ(m.ref,CX(i),o):bJ(null,null)),l?(u!==void 0&&(m.className=VX(m.className,u)),d!==void 0&&(m.style=wX(m.style,d)),m):Gq}function GX(e){return Array.isArray(e)?AX(e):kX(void 0,e)}var KX=Symbol.for(`react.lazy`);function qX(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=kX(n,t.props);e.ref=n.ref;let i=t;return i?.$$typeof===KX&&(i=x.Children.toArray(t)[0]),x.cloneElement(i,e)}if(e&&typeof e==`string`)return JX(e,n);throw Error(CK(8))}function JX(e,t){return e===`button`?(0,x.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,x.createElement)(`img`,{alt:``,...t,key:t.key}):x.createElement(e,t)}var YX={style:{transition:`none`}},XX=`data-base-ui-click-trigger`,ZX={fallbackAxisSide:`none`},QX={fallbackAxisSide:`end`},$X={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0},eZ=x.createContext(null),tZ=()=>x.useContext(eZ),nZ=nX(`portal`);function rZ(e={}){let{ref:t,container:n,componentProps:r=Gq,elementProps:i}=e,a=bX(),o=tZ()?.portalNode,[s,c]=x.useState(null),[l,u]=x.useState(null),d=jJ(e=>{e!==null&&u(e)}),f=x.useRef(null);xK(()=>{if(n===null){f.current&&(f.current=null,u(null),c(null));return}if(a==null)return;let e=(n&&(eq(n)?n:n.current))??o??document.body;if(e==null){f.current&&(f.current=null,u(null),c(null));return}f.current!==e&&(f.current=e,u(null),c(e))},[n,o,a]);let p=UX(`div`,r,{ref:[t,d],props:[{id:a,[nZ]:``},i]});return{portalNode:l,portalSubtree:s&&p?ia.createPortal(p,s):null}}var iZ=x.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,container:o,renderGuards:s,...c}=e,{portalNode:l,portalSubtree:u}=rZ({container:o,ref:t,componentProps:e,elementProps:c}),d=x.useRef(null),f=x.useRef(null),p=x.useRef(null),m=x.useRef(null),[h,g]=x.useState(null),_=x.useRef(!1),v=h?.modal,y=h?.open,b=typeof s==`boolean`?s:!!h&&!h.modal&&h.open&&!!l;x.useEffect(()=>{if(!l||v)return;function e(e){l&&e.relatedTarget&&ZY(e)&&(e.type===`focusin`?_.current&&=($Y(l),!1):(QY(l),_.current=!0))}return yJ(vJ(l,`focusin`,e,!0),vJ(l,`focusout`,e,!0))},[l,v]),x.useEffect(()=>{!l||y!==!1||($Y(l),_.current=!1)},[y,l]);let S=x.useMemo(()=>({beforeOutsideRef:d,afterOutsideRef:f,beforeInsideRef:p,afterInsideRef:m,portalNode:l,setFocusManagerState:g}),[l]);return(0,J.jsxs)(x.Fragment,{children:[u,(0,J.jsxs)(eZ.Provider,{value:S,children:[b&&l&&(0,J.jsx)(HJ,{"data-type":`outside`,ref:d,onFocus:e=>{ZY(e,l)?p.current?.focus():qY(h?h.domReference:null)?.focus()}}),b&&l&&(0,J.jsx)(`span`,{"aria-owns":l.id,style:$X}),l&&ia.createPortal(a,l),b&&l&&(0,J.jsx)(HJ,{"data-type":`outside`,ref:f,onFocus:e=>{ZY(e,l)?m.current?.focus():(KY(h?h.domReference:null)?.focus(),h?.closeOnFocusOut&&h?.onOpenChange(!1,pJ(`focus-out`,e.nativeEvent)))}})]})]})});function aZ(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}var oZ=class{nodesRef={current:[]};events=aZ();addNode(e){this.nodesRef.current.push(e)}removeNode(e){let t=this.nodesRef.current.findIndex(t=>t===e);t!==-1&&this.nodesRef.current.splice(t,1)}},sZ=x.createContext(null),cZ=x.createContext(null),lZ=()=>x.useContext(sZ)?.id||null,uZ=e=>{let t=x.useContext(cZ);return e??t};function dZ(e){let t=bX(),n=uZ(e),r=lZ();return xK(()=>{if(!t)return;let e={id:t,parentId:r};return n?.addNode(e),()=>{n?.removeNode(e)}},[n,t,r]),t}function fZ(e){let{children:t,id:n}=e,r=lZ();return(0,J.jsx)(sZ.Provider,{value:x.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function pZ(e){let{children:t,externalTree:n}=e,r=fK(()=>n??new oZ).current;return(0,J.jsx)(cZ.Provider,{value:r,children:t})}function mZ(e){return e==null?e:`current`in e?e.current:e}function hZ(e,t){let n=QK(kq(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||`keyboard`:`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var gZ=20,_Z=[];function vZ(){_Z=_Z.filter(e=>e.deref()?.isConnected)}function yZ(e){vZ(),e&&ZK(e)!==`body`&&(_Z.push(new WeakRef(e)),_Z.length>gZ&&(_Z=_Z.slice(-20)))}function bZ(){return vZ(),_Z[_Z.length-1]?.deref()}function xZ(e){return e?HY(e)?e:WY(e)[0]||e:null}function SZ(e,t){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!t.current.includes(`floating`)&&!e.getAttribute(`role`)?.includes(`dialog`))return;let n=UY(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return HY(e)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),r=e.getAttribute(`tabindex`);t.current.includes(`floating`)||n.length===0?r!==`0`&&e.setAttribute(`tabindex`,`0`):(r!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function CZ(e){let{context:t,children:n,disabled:r=!1,initialFocus:i=!0,returnFocus:a=!0,restoreFocus:o=!1,modal:s=!0,closeOnFocusOut:c=!0,openInteractionType:l=``,nextFocusableElement:u,previousFocusableElement:d,beforeContentFocusGuardRef:f,externalTree:p,getInsideElements:m}=e,h=`rootStore`in t?t.rootStore:t,g=h.useState(`open`),_=h.useState(`domReferenceElement`),v=h.useState(`floatingElement`),{events:y,dataRef:b}=h.context,S=jJ(()=>b.current.floatingContext?.nodeId),C=i===!1,w=Fq(_)&&C,T=x.useRef([`content`]),E=EJ(i),D=EJ(a),O=EJ(l),k=uZ(p),A=tZ(),j=x.useRef(!1),M=x.useRef(!1),N=x.useRef(!1),P=x.useRef(null),F=x.useRef(``),I=x.useRef(``),L=x.useRef(null),ee=x.useRef(null),R=bJ(L,f,A?.beforeInsideRef),z=bJ(ee,A?.afterInsideRef),B=AK(),V=AK(),H=LJ(),te=A!=null,U=Lq(v),ne=jJ((e=U)=>e?WY(e):[]),re=jJ(()=>m?.().filter(e=>e!=null)??[]);x.useEffect(()=>{if(r||!s)return;function e(e){e.key===`Tab`&&Oq(U,Dq(RJ(U)))&&ne().length===0&&!w&&WK(e)}return vJ(RJ(U),`keydown`,e)},[r,U,s,w,ne]),x.useEffect(()=>{if(r||!g)return;let e=RJ(U);function t(){N.current=!1}function n(e){let t=kq(e),n=re();N.current=!(Oq(v,t)||Oq(_,t)||Oq(A?.portalNode,t)||n.some(e=>e===t||Oq(e,t))),I.current=e.pointerType||`keyboard`,t?.closest(`[data-base-ui-click-trigger]`)&&(M.current=!0)}function i(){I.current=`keyboard`}return yJ(vJ(e,`pointerdown`,n,!0),vJ(e,`pointerup`,t,!0),vJ(e,`pointercancel`,t,!0),vJ(e,`keydown`,i,!0))},[r,v,_,U,g,A,re]),x.useEffect(()=>{if(r||!c)return;let e=RJ(U);function t(){M.current=!0,V.start(0,()=>{M.current=!1})}function n(e){let t=kq(e);HY(t)&&(P.current=t)}function i(t){let n=t.relatedTarget,r=t.currentTarget,i=kq(t);queueMicrotask(()=>{let a=S(),c=h.context.triggerElements,l=re(),f=n?.hasAttribute(nX(`focus-guard`))&&[L.current,ee.current,A?.beforeInsideRef.current,A?.afterInsideRef.current,A?.beforeOutsideRef.current,A?.afterOutsideRef.current,mZ(d),mZ(u)].includes(n),p=!(Oq(_,n)||Oq(v,n)||Oq(n,v)||Oq(A?.portalNode,n)||l.some(e=>e===n||Oq(e,n))||n!=null&&c.hasElement(n)||c.hasMatchingElement(e=>Oq(e,n))||f||k&&(eX(k.nodesRef.current,a).find(e=>Oq(e.context?.elements.floating,n)||Oq(e.context?.elements.domReference,n))||tX(k.nodesRef.current,a).find(e=>[e.context?.elements.floating,Lq(e.context?.elements.floating)].includes(n)||e.context?.elements.domReference===n)));if(r===_&&U&&SZ(U,T),o&&r!==_&&!OY(i)&&Dq(e)===e.body){if(nq(U)&&(U.focus(),o===`popup`)){H.request(()=>{U.focus()});return}let e=ne(),t=P.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||U;nq(n)&&n.focus()}if(b.current.insideReactTree){b.current.insideReactTree=!1;return}(w||!s)&&n&&p&&!M.current&&(w||n!==bZ())&&(j.current=!0,h.setOpen(!1,pJ(tJ,t)))})}function a(){N.current||(b.current.insideReactTree=!0,B.start(0,()=>{b.current.insideReactTree=!1}))}let l=nq(_)?_:null;if(!(!v&&!l))return yJ(l&&vJ(l,`focusout`,i),l&&vJ(l,`pointerdown`,t),v&&vJ(v,`focusin`,n),v&&vJ(v,`focusout`,i),v&&A&&vJ(v,`focusout`,a,!0))},[r,_,v,U,s,k,A,h,c,o,ne,w,S,T,b,B,V,H,u,d,re]),x.useEffect(()=>{if(r||!v||!g)return;let e=Array.from(A?.portalNode?.querySelectorAll(`[${nX(`portal`)}]`)||[]),t=(k?tX(k.nodesRef.current,S()):[]).find(e=>Fq(e.context?.elements.domReference||null))?.context?.elements.domReference,n=gX([v,...e,L.current,ee.current,A?.beforeOutsideRef.current,A?.afterOutsideRef.current,...re(),t,mZ(d),mZ(u),w?_:null].filter(e=>e!=null),{ariaHidden:s||w,mark:!1}),i=gX([v,...e].filter(e=>e!=null));return()=>{i(),n()}},[g,r,_,v,s,A,w,k,S,u,d,re]),xK(()=>{if(!g||r||!nq(U))return;let e=RJ(U),t=Dq(e);queueMicrotask(()=>{let n=E.current,r=typeof n==`function`?n(O.current||``):n;if(r===void 0||r===!1||Oq(U,t))return;let i=null,a=()=>(i??=ne(U),i[0]||U),o;o=r===!0||r===null?a():mZ(r),o||=a();let s=Oq(U,Dq(e));iX(o,{preventScroll:o===U,shouldFocus(){if(s)return!0;let t=Dq(e);return!(t!==o&&Oq(U,t))}})})},[r,g,U,ne,E,O]),xK(()=>{if(r||!U)return;let e=RJ(U);yZ(Dq(e));function t(e){if(e.open||(F.current=hZ(e.nativeEvent,I.current)),e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`&&(j.current=!0),e.reason===`outside-press`)if(e.nested)j.current=!1;else if(KK(e.nativeEvent)||qK(e.nativeEvent))j.current=!1;else{let e=!1;RJ(U).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?j.current=!1:j.current=!0}}y.on(`openchange`,t);function n(){let e=D.current,t=typeof e==`function`?e(F.current):e;if(t===void 0||t===!1)return null;if(t===null&&(t=!0),typeof t==`boolean`)return _?.isConnected?_:bZ()||null;let n=_?.isConnected?_:bZ();return mZ(t)||n||null}return()=>{y.off(`openchange`,t);let r=Dq(e),i=re(),a=Oq(v,r)||i.some(e=>e===r||Oq(e,r))||k&&eX(k.nodesRef.current,S(),!1).some(e=>Oq(e.context?.elements.floating,r)),o=D.current,s=n();queueMicrotask(()=>{let t=xZ(s),n=typeof o!=`boolean`;o&&!j.current&&nq(t)&&(!(!n&&t!==r&&r!==e.body)||a)&&t.focus({preventScroll:!0}),j.current=!1})}},[r,v,U,D,y,k,_,S,re]),xK(()=>{if(!FK||g||!v)return;let e=Dq(RJ(v));!nq(e)||!Nq(e)||Oq(v,e)&&e.blur()},[g,v]),xK(()=>{if(!(r||!A))return A.setFocusManagerState({modal:s,closeOnFocusOut:c,open:g,onOpenChange:h.setOpen,domReference:_}),()=>{A.setFocusManagerState(null)}},[r,A,s,g,h,c,_]),xK(()=>{if(!(r||!U))return SZ(U,T),()=>{queueMicrotask(vZ)}},[r,U,T]);let ie=!r&&(s?!w:!0)&&(te||s);return(0,J.jsxs)(x.Fragment,{children:[ie&&(0,J.jsx)(HJ,{"data-type":`inside`,ref:R,onFocus:e=>{if(s){let e=ne();iX(e[e.length-1])}else A?.portalNode&&(j.current=!1,ZY(e,A.portalNode)?KY(_)?.focus():mZ(d??A.beforeOutsideRef)?.focus())}}),n,ie&&(0,J.jsx)(HJ,{"data-type":`inside`,ref:z,onFocus:e=>{s?iX(ne()[0]):A?.portalNode&&(c&&(j.current=!0),ZY(e,A.portalNode)?qY(_)?.focus():mZ(u??A.afterOutsideRef)?.focus())}})]})}function wZ(e,t={}){let{enabled:n=!0,event:r=`click`,toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:o=!0,touchOpenDelay:s=0,reason:c=qq}=t,l=`rootStore`in e?e.rootStore:e,u=l.context.dataRef,d=x.useRef(void 0),f=LJ(),p=AK(),m=x.useMemo(()=>{function e(e,t,n,r){let i=pJ(c,t,n);e&&r===`touch`&&s>0?p.start(s,()=>{l.setOpen(!0,i)}):l.setOpen(e,i)}function t(e,t,n){let r=u.current.openEvent,a=l.select(`domReferenceElement`)!==t;return e&&a||!e||!i?!0:r&&o?!n(r.type):!1}return{onPointerDown(e){d.current=e.pointerType},onMouseDown(n){let i=d.current,o=n.nativeEvent,s=l.select(`open`);if(n.button!==0||r===`click`||JK(i,!0)&&a)return;let c=t(s,n.currentTarget,e=>e===`click`||e===`mousedown`),u=kq(o);if(Nq(u)){e(c,o,u,i);return}let p=n.currentTarget;f.request(()=>{e(c,o,p,i)})},onClick(n){if(r===`mousedown-only`)return;let i=d.current;if(r===`mousedown`&&i){d.current=void 0;return}JK(i,!0)&&a||e(t(l.select(`open`),n.currentTarget,e=>e===`click`||e===`mousedown`||e===`keydown`||e===`keyup`),n.nativeEvent,n.currentTarget,i)},onKeyDown(){d.current=void 0}}},[u,r,a,c,l,o,i,f,p,s]);return x.useMemo(()=>n?{reference:m}:Gq,[n,m])}function TZ(e,t){let n=null,r=null,i=!1;return{contextElement:e||void 0,getBoundingClientRect(){let a=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},o=t.axis===`x`||t.axis===`both`,s=t.axis===`y`||t.axis===`both`,c=[`mouseenter`,`mousemove`].includes(t.dataRef.current.openEvent?.type||``)&&t.pointerType!==`touch`,l=a.width,u=a.height,d=a.x,f=a.y;return n==null&&t.x&&o&&(n=a.x-t.x),r==null&&t.y&&s&&(r=a.y-t.y),d-=n||0,f-=r||0,l=0,u=0,!i||c?(l=t.axis===`y`?a.width:0,u=t.axis===`x`?a.height:0,d=o&&t.x!=null?t.x:d,f=s&&t.y!=null?t.y:f):i&&!c&&(u=t.axis===`x`?a.height:u,l=t.axis===`y`?a.width:l),i=!0,{width:l,height:u,x:d,y:f,top:f,right:d+l,bottom:f+u,left:d}}}}function EZ(e){return e!=null&&e.clientX!=null}function DZ(e,t={}){let{enabled:n=!0,axis:r=`both`}=t,i=`rootStore`in e?e.rootStore:e,a=i.useState(`open`),o=i.useState(`floatingElement`),s=i.useState(`domReferenceElement`),c=i.context.dataRef,l=x.useRef(!1),u=x.useRef(null),[d,f]=x.useState(),[p,m]=x.useState([]),h=jJ(e=>{i.set(`positionReference`,e)}),g=jJ((e,t,n)=>{l.current||c.current.openEvent&&!EZ(c.current.openEvent)||i.set(`positionReference`,TZ(n??s,{x:e,y:t,axis:r,dataRef:c,pointerType:d}))}),_=jJ(e=>{a?u.current||(g(e.clientX,e.clientY,e.currentTarget),m([])):g(e.clientX,e.clientY,e.currentTarget)}),v=JK(d)?o:a;x.useEffect(()=>{if(!n){h(s);return}if(!v)return;function e(){u.current?.(),u.current=null}let t=QK(o);function r(t){Oq(o,kq(t))?e():g(t.clientX,t.clientY)}return!c.current.openEvent||EZ(c.current.openEvent)?u.current=vJ(t,`mousemove`,r):h(s),e},[v,n,o,c,s,i,g,h,p]),x.useEffect(()=>()=>{i.set(`positionReference`,null)},[i]),x.useEffect(()=>{n&&!o&&(l.current=!1)},[n,o]),x.useEffect(()=>{!n&&a&&(l.current=!0)},[n,a]);let y=x.useMemo(()=>{function e(e){f(e.pointerType)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:_,onMouseEnter:_}},[_]);return x.useMemo(()=>n?{reference:y,trigger:y}:{},[n,y])}var OZ={intentional:`onClick`,sloppy:`onPointerDown`};function kZ(){return!1}function AZ(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function jZ(e,t={}){let{enabled:n=!0,escapeKey:r=!0,outsidePress:i=!0,outsidePressEvent:a=`sloppy`,referencePress:o=kZ,referencePressEvent:s=`sloppy`,bubbles:c,externalTree:l}=t,u=`rootStore`in e?e.rootStore:e,d=u.useState(`open`),f=u.useState(`floatingElement`),{dataRef:p}=u.context,m=uZ(l),h=jJ(typeof i==`function`?i:()=>!1),g=typeof i==`function`?h:i,_=g!==!1,v=jJ(()=>a),{escapeKey:y,outsidePress:b}=AZ(c),S=x.useRef(!1),C=x.useRef(!1),w=x.useRef(!1),T=x.useRef(!1),E=x.useRef(``),D=x.useRef(null),O=AK(),k=AK(),A=jJ(()=>{k.clear(),p.current.insideReactTree=!1}),j=jJ(e=>{let t=p.current.floatingContext?.nodeId;return(m?eX(m.nodesRef.current,t):[]).some(t=>t.context?.open&&!t.context.dataRef.current[e])}),M=jJ(e=>jq(e,u.select(`floatingElement`))||jq(e,u.select(`domReferenceElement`))),N=jJ(e=>{o()&&u.setOpen(!1,pJ(qq,e.nativeEvent))}),P=jJ(e=>{if(!d||!n||!r||e.key!==`Escape`||T.current||!y&&j(`__escapeKeyBubbles`))return;let t=pJ(nJ,GK(e)?e.nativeEvent:e);u.setOpen(!1,t),t.isCanceled||e.preventDefault(),!y&&!t.isPropagationAllowed&&e.stopPropagation()}),F=jJ(()=>{p.current.insideReactTree=!0,k.start(0,A)}),I=jJ(e=>{if(!d||!n||e.button!==0)return;let t=kq(e.nativeEvent);Oq(u.select(`floatingElement`),t)&&(S.current||(S.current=!0,C.current=!1))}),L=jJ(e=>{!d||!n||(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&S.current&&(C.current=!0)});x.useEffect(()=>{if(!d||!n)return;p.current.__escapeKeyBubbles=y,p.current.__outsidePressBubbles=b;let e=new kK,t=new kK;function i(){e.clear(),T.current=!0}function a(){e.start(pq()?5:0,()=>{T.current=!1})}function o(){w.current=!0,t.start(0,()=>{w.current=!1})}function s(){S.current=!1,C.current=!1}function c(){let e=E.current,t=e===`pen`||!e?`mouse`:e,n=v(),r=typeof n==`function`?n():n;return typeof r==`string`?r:r[t]}function l(e){let t=c();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}function h(e){let t=p.current.floatingContext?.nodeId,n=m&&eX(m.nodesRef.current,t).some(t=>jq(e,t.context?.elements.floating));return M(e)||n}function x(e){if(l(e)){e.type!==`click`&&!M(e)&&(t.clear(),w.current=!1),A();return}if(p.current.insideReactTree){A();return}let n=kq(e),r=`[${nX(`inert`)}]`,i=tq(n)?n.getRootNode():null,a=Array.from((rq(i)?i:RJ(u.select(`floatingElement`))).querySelectorAll(r)),o=u.context.triggerElements;if(n&&(o.hasElement(n)||o.hasMatchingElement(e=>Oq(e,n))))return;let s=tq(n)?n:null;for(;s&&!mq(s);){let e=_q(s);if(mq(e)||!tq(e))break;s=e}if(!(a.length&&tq(n)&&!Mq(n)&&!Oq(n,u.select(`floatingElement`))&&a.every(e=>!Oq(s,e)))){if(nq(n)&&!(`touches`in e)){let t=mq(n),r=hq(n),i=/auto|scroll/,a=t||i.test(r.overflowX),o=t||i.test(r.overflowY),s=a&&n.clientWidth>0&&n.scrollWidth>n.clientWidth,c=o&&n.clientHeight>0&&n.scrollHeight>n.clientHeight,l=r.direction===`rtl`,u=c&&(l?e.offsetX<=n.offsetWidth-n.clientWidth:e.offsetX>n.clientWidth),d=s&&e.offsetY>n.clientHeight;if(u||d)return}if(!h(e)){if(c()===`intentional`&&w.current){t.clear(),w.current=!1;return}typeof g==`function`&&!g(e)||j(`__outsidePressBubbles`)||(u.setOpen(!1,pJ(Xq,e)),A())}}}function k(e){c()!==`sloppy`||e.pointerType===`touch`||!u.select(`open`)||!n||M(e)||x(e)}function N(e){if(c()!==`sloppy`||!u.select(`open`)||!n||M(e))return;let t=e.touches[0];t&&(D.current={startTime:Date.now(),startX:t.clientX,startY:t.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},O.start(1e3,()=>{D.current&&(D.current.dismissOnTouchEnd=!1,D.current.dismissOnMouseDown=!1)}))}function F(e,t){let n=kq(e);if(!n)return;let r=vJ(n,e.type,()=>{t(e),r()})}function I(e){E.current=`touch`,F(e,N)}function L(e){O.clear(),e.type===`pointerdown`&&(E.current=e.pointerType),!(e.type===`mousedown`&&D.current&&!D.current.dismissOnMouseDown)&&F(e,e=>{e.type===`pointerdown`?k(e):x(e)})}function ee(e){if(!S.current)return;let n=C.current;if(s(),c()===`intentional`){if(e.type===`pointercancel`){n&&o();return}if(!h(e)){if(n){o();return}typeof g==`function`&&!g(e)||(t.clear(),w.current=!0,A())}}}function R(e){if(c()!==`sloppy`||!D.current||M(e))return;let t=e.touches[0];if(!t)return;let n=Math.abs(t.clientX-D.current.startX),r=Math.abs(t.clientY-D.current.startY),i=Math.sqrt(n*n+r*r);i>5&&(D.current.dismissOnTouchEnd=!0),i>10&&(x(e),O.clear(),D.current=null)}function z(e){F(e,R)}function B(e){c()!==`sloppy`||!D.current||M(e)||(D.current.dismissOnTouchEnd&&x(e),O.clear(),D.current=null)}function V(e){F(e,B)}let H=RJ(f),te=yJ(r&&yJ(vJ(H,`keydown`,P),vJ(H,`compositionstart`,i),vJ(H,`compositionend`,a)),_&&yJ(vJ(H,`click`,L,!0),vJ(H,`pointerdown`,L,!0),vJ(H,`pointerup`,ee,!0),vJ(H,`pointercancel`,ee,!0),vJ(H,`mousedown`,L,!0),vJ(H,`mouseup`,ee,!0),vJ(H,`touchstart`,I,!0),vJ(H,`touchmove`,z,!0),vJ(H,`touchend`,V,!0)));return()=>{te(),e.clear(),t.clear(),s(),w.current=!1}},[p,f,r,_,g,d,n,y,b,P,A,v,j,M,m,u,O]),x.useEffect(A,[g,A]);let ee=x.useMemo(()=>({onKeyDown:P,[OZ[s]]:N,...s!==`intentional`&&{onClick:N}}),[P,N,s]),R=x.useMemo(()=>({onKeyDown:P,onPointerDown:L,onMouseDown:L,onClickCapture:F,onMouseDownCapture(e){F(),I(e)},onPointerDownCapture(e){F(),I(e)},onMouseUpCapture:F,onTouchEndCapture:F,onTouchMoveCapture:F}),[P,F,I,L]);return x.useMemo(()=>n?{reference:ee,floating:R,trigger:ee}:{},[n,ee,R])}function MZ(e,t,n){let{reference:r,floating:i}=e,a=nY(t),o=rY(t),s=tY(o),c=QJ(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($J(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 NZ(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}=ZJ(t,e),p=hY(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=gY(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=gY(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 PZ=50,FZ=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:NZ},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=MZ(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<PZ&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=MZ(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},IZ=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}=ZJ(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=QJ(r),_=nY(o),v=QJ(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[pY(o)]:aY(o)),x=p!==`none`;!d&&x&&b.push(...fY(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=iY(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`&&_!==nY(t))||T.every(e=>nY(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=nY(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 LZ(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function RZ(e){return UJ.some(t=>e[t]>=0)}var zZ=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=ZJ(e,t);switch(i){case`referenceHidden`:{let e=LZ(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:RZ(e)}}}case`escaped`:{let e=LZ(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:RZ(e)}}}default:return{}}}}},BZ=new Set([`left`,`top`]);async function VZ(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=QJ(n),s=$J(n),c=nY(n)===`y`,l=BZ.has(o)?-1:1,u=a&&c?-1:1,d=ZJ(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 HZ=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 VZ(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}}}}},UZ=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}=ZJ(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=nY(QJ(i)),p=eY(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=XJ(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=XJ(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}}}}}},WZ=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}=ZJ(e,t),u={x:n,y:r},d=nY(i),f=eY(d),p=u[f],m=u[d],h=ZJ(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=BZ.has(QJ(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}}}},GZ=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}=ZJ(e,t),u=await o.detectOverflow(t,l),d=QJ(i),f=$J(i),p=nY(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=WJ(h-u[g],v),x=WJ(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=GJ(u.left,0),t=GJ(u.right,0),n=GJ(u.top,0),r=GJ(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:GJ(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:GJ(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 KZ(e){let t=hq(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=nq(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=KJ(n)!==a||KJ(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function qZ(e){return tq(e)?e:e.contextElement}function JZ(e){let t=qZ(e);if(!nq(t))return JJ(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=KZ(t),o=(a?KJ(n.width):n.width)/r,s=(a?KJ(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var YZ=JJ(0);function XZ(e){let t=QK(e);return!pq()||!t.visualViewport?YZ:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function ZZ(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==QK(e)?!1:t}function QZ(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=qZ(e),o=JJ(1);t&&(r?tq(r)&&(o=JZ(r)):o=JZ(e));let s=ZZ(a,n,r)?XZ(a):JJ(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=QK(a),t=r&&tq(r)?QK(r):r,n=e,i=bq(n);for(;i&&r&&t!==n;){let e=JZ(i),t=i.getBoundingClientRect(),r=hq(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=QK(i),i=bq(n)}}return gY({width:u,height:d,x:c,y:l})}function $Z(e,t){let n=gq(e).scrollLeft;return t?t.left+n:QZ($K(e)).left+n}function eQ(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-$Z(e,n),y:n.top+t.scrollTop}}function tQ(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=$K(r),s=t?oq(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=JJ(1),u=JJ(0),d=nq(r);if((d||!d&&!a)&&((ZK(r)!==`body`||iq(o))&&(c=gq(r)),d)){let e=QZ(r);l=JZ(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?eQ(o,c):JJ(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 nQ(e){return Array.from(e.getClientRects())}function rQ(e){let t=$K(e),n=gq(e),r=e.ownerDocument.body,i=GJ(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=GJ(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+$Z(e),s=-n.scrollTop;return hq(r).direction===`rtl`&&(o+=GJ(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var iQ=25;function aQ(e,t){let n=QK(e),r=$K(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=pq();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=$Z(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<=iQ&&(a-=o)}else l<=iQ&&(a+=l);return{width:a,height:o,x:s,y:c}}function oQ(e,t){let n=QZ(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=nq(e)?JZ(e):JJ(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function sQ(e,t,n){let r;if(t===`viewport`)r=aQ(e,n);else if(t===`document`)r=rQ($K(e));else if(tq(t))r=oQ(t,n);else{let n=XZ(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return gY(r)}function cQ(e,t){let n=_q(e);return n===t||!tq(n)||mq(n)?!1:hq(n).position===`fixed`||cQ(n,t)}function lQ(e,t){let n=t.get(e);if(n)return n;let r=yq(e,[],!1).filter(e=>tq(e)&&ZK(e)!==`body`),i=null,a=hq(e).position===`fixed`,o=a?_q(e):e;for(;tq(o)&&!mq(o);){let t=hq(o),n=dq(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||iq(o)&&!n&&cQ(e,o))?r=r.filter(e=>e!==o):i=t,o=_q(o)}return t.set(e,r),r}function uQ(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?oq(t)?[]:lQ(t,this._c):[].concat(n),r],o=sQ(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=sQ(t,a[e],i);s=GJ(n.top,s),c=WJ(n.right,c),l=WJ(n.bottom,l),u=GJ(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function dQ(e){let{width:t,height:n}=KZ(e);return{width:t,height:n}}function fQ(e,t,n){let r=nq(t),i=$K(t),a=n===`fixed`,o=QZ(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=JJ(0);function l(){c.x=$Z(i)}if(r||!r&&!a)if((ZK(t)!==`body`||iq(i))&&(s=gq(t)),r){let e=QZ(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?eQ(i,s):JJ(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 pQ(e){return hq(e).position===`static`}function mQ(e,t){if(!nq(e)||hq(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return $K(e)===n&&(n=n.ownerDocument.body),n}function hQ(e,t){let n=QK(e);if(oq(e))return n;if(!nq(e)){let t=_q(e);for(;t&&!mq(t);){if(tq(t)&&!pQ(t))return t;t=_q(t)}return n}let r=mQ(e,t);for(;r&&aq(r)&&pQ(r);)r=mQ(r,t);return r&&mq(r)&&pQ(r)&&!dq(r)?n:r||fq(e)||n}var gQ=async function(e){let t=this.getOffsetParent||hQ,n=this.getDimensions,r=await n(e.floating);return{reference:fQ(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function _Q(e){return hq(e).direction===`rtl`}var vQ={convertOffsetParentRelativeRectToViewportRelativeRect:tQ,getDocumentElement:$K,getClippingRect:uQ,getOffsetParent:hQ,getElementRects:gQ,getClientRects:nQ,getDimensions:dQ,getScale:JZ,isElement:tq,isRTL:_Q};function yQ(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function bQ(e,t){let n=null,r,i=$K(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=qJ(d),h=qJ(i.clientWidth-(u+f)),g=qJ(i.clientHeight-(d+p)),_=qJ(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:GJ(0,WJ(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&&!yQ(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 xQ(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=qZ(e),u=i||a?[...l?yq(l):[],...t?yq(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?bQ(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?QZ(e):null;c&&g();function g(){let t=QZ(e);h&&!yQ(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 SQ=HZ,CQ=UZ,wQ=IZ,TQ=GZ,EQ=zZ,DQ=WZ,OQ=(e,t,n)=>{let r=new Map,i={platform:vQ,...n},a={...i.platform,_c:r};return FZ(e,t,{...i,platform:a})},kQ=typeof document<`u`?x.useLayoutEffect:function(){};function AQ(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(!AQ(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)&&!AQ(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function jQ(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function MQ(e,t){let n=jQ(e);return Math.round(t*n)/n}function NQ(e){let t=x.useRef(e);return kQ(()=>{t.current=e}),t}function PQ(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=x.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=x.useState(r);AQ(f,r)||p(r);let[m,h]=x.useState(null),[g,_]=x.useState(null),v=x.useCallback(e=>{e!==C.current&&(C.current=e,h(e))},[]),y=x.useCallback(e=>{e!==w.current&&(w.current=e,_(e))},[]),b=a||m,S=o||g,C=x.useRef(null),w=x.useRef(null),T=x.useRef(u),E=c!=null,D=NQ(c),O=NQ(i),k=NQ(l),A=x.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),OQ(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!AQ(T.current,t)&&(T.current=t,ia.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);kQ(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=x.useRef(!1);kQ(()=>(j.current=!0,()=>{j.current=!1}),[]),kQ(()=>{if(b&&(C.current=b),S&&(w.current=S),b&&S){if(D.current)return D.current(b,S,A);A()}},[b,S,A,D,E]);let M=x.useMemo(()=>({reference:C,floating:w,setReference:v,setFloating:y}),[v,y]),N=x.useMemo(()=>({reference:b,floating:S}),[b,S]),P=x.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=MQ(N.floating,u.x),r=MQ(N.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...jQ(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,u.x,u.y]);return x.useMemo(()=>({...u,update:A,refs:M,elements:N,floatingStyles:P}),[u,A,M,N,P])}var FQ=(e,t)=>{let n=SQ(e);return{name:n.name,fn:n.fn,options:[e,t]}},IQ=(e,t)=>{let n=CQ(e);return{name:n.name,fn:n.fn,options:[e,t]}},LQ=(e,t)=>({fn:DQ(e).fn,options:[e,t]}),RQ=(e,t)=>{let n=wQ(e);return{name:n.name,fn:n.fn,options:[e,t]}},zQ=(e,t)=>{let n=TQ(e);return{name:n.name,fn:n.fn,options:[e,t]}},BQ=(e,t)=>{let n=EQ(e);return{name:n.name,fn:n.fn,options:[e,t]}},VQ=(e,t,n,r,i,a,...o)=>{if(o.length>0)throw Error(CK(1));let s;if(e&&t&&n&&r&&i&&a)s=(o,s,c,l)=>a(e(o,s,c,l),t(o,s,c,l),n(o,s,c,l),r(o,s,c,l),i(o,s,c,l),s,c,l);else if(e&&t&&n&&r&&i)s=(a,o,s,c)=>i(e(a,o,s,c),t(a,o,s,c),n(a,o,s,c),r(a,o,s,c),o,s,c);else if(e&&t&&n&&r)s=(i,a,o,s)=>r(e(i,a,o,s),t(i,a,o,s),n(i,a,o,s),a,o,s);else if(e&&t&&n)s=(r,i,a,o)=>n(e(r,i,a,o),t(r,i,a,o),i,a,o);else if(e&&t)s=(n,r,i,a)=>t(e(n,r,i,a),r,i,a);else if(e)s=e;else throw Error(`Missing arguments`);return s},HQ=c((e=>{var t=m(),n=ha();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),UQ=c(((e,t)=>{t.exports=HQ()}))(),WQ=SX(19)?qQ:JQ;function GQ(e,t,n,r,i){return WQ(e,t,n,r,i)}function KQ(e,t,n,r,i){let a=x.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,ga.useSyncExternalStore)(e.subscribe,a,a)}gK({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);(r.didChange||!Object.is(r.value,i))&&(t=!0,r.value=i,r.didChange=!1)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,ga.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function qQ(e,t,n,r,i){let a=hK();if(!a)return KQ(e,t,n,r,i);let o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],(s.store!==e||s.selector!==t||!Object.is(s.a1,n)||!Object.is(s.a2,r)||!Object.is(s.a3,i))&&(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.didChange=!0)):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i),didChange:!1},a.syncHooks.push(s)),s.value}function JQ(e,t,n,r,i){return(0,UQ.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var YQ=class{constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return GQ(this,e,t,n,r)}},XQ=class extends YQ{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){x.useDebugValue(e);let n=this;xK(()=>{n.state[e]!==t&&n.set(e,t)},[n,e,t])}useSyncedValueWithCleanup(e,t){let n=this;xK(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;xK(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){x.useDebugValue(e);let n=this,r=t!==void 0;xK(()=>{r&&!Object.is(n.state[e],t)&&n.setState({...n.state,[e]:t})},[n,e,t,r])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return x.useDebugValue(e),GQ(this,this.selectors[e],t,n,r)}useContextCallback(e,t){x.useDebugValue(e);let n=jJ(t??Uq);this.context[e]=n}useStateSetter(e){let t=x.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}},ZQ={open:VQ(e=>e.open),transitionStatus:VQ(e=>e.transitionStatus),domReferenceElement:VQ(e=>e.domReferenceElement),referenceElement:VQ(e=>e.positionReference??e.referenceElement),floatingElement:VQ(e=>e.floatingElement),floatingId:VQ(e=>e.floatingId)},QQ=class extends XQ{constructor(e){let{syncOnly:t,nested:n,onOpenChange:r,triggerElements:i,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:aZ(),nested:n,triggerElements:i},ZQ),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&&YK(t))&&(this.context.dataRef.current.openEvent=e?t:void 0)};dispatchOpenChange=(e,t)=>{this.syncOpenEvent(e,t.event);let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit(`openchange`,n)};setOpen=(e,t)=>{if(this.syncOnly){this.context.onOpenChange?.(e,t);return}this.dispatchOpenChange(e,t),this.context.onOpenChange?.(e,t)}};function $Q(e){let{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:i,nested:a,onOpenChange:o}=e,s=t.useState(`open`),c=t.useState(`activeTriggerElement`),l=t.useState(n?`popupElement`:`positionerElement`),u=t.context.triggerElements,d=o,f=x.useRef(null);r===void 0&&f.current===null&&(f.current=new QQ({open:s,transitionStatus:void 0,referenceElement:c,floatingElement:l,triggerElements:u,onOpenChange:d,floatingId:i,syncOnly:!0,nested:a}));let p=r??f.current;return t.useSyncedValue(`floatingId`,i),xK(()=>{let e={open:s,floatingId:i,referenceElement:c,floatingElement:l};tq(c)&&(e.domReferenceElement=c),p.state.positionReference===p.state.referenceElement&&(e.positionReference=c),p.update(e)},[s,i,c,l,p]),p.context.onOpenChange=d,p.context.nested=a,p}function e$(e,t=!1,n=!1){let[r,i]=x.useState(e&&t?`idle`:void 0),[a,o]=x.useState(e);return e&&!a&&(o(!0),i(`starting`)),!e&&a&&r!==`ending`&&!n&&i(`ending`),!e&&!a&&r===`ending`&&i(void 0),xK(()=>{if(!e&&a&&r!==`ending`&&n){let e=IJ.request(()=>{i(`ending`)});return()=>{IJ.cancel(e)}}},[e,a,r,n]),xK(()=>{if(!e||t)return;let n=IJ.request(()=>{i(void 0)});return()=>{IJ.cancel(n)}},[t,e]),xK(()=>{if(!e||!t)return;e&&a&&r!==`idle`&&i(`starting`);let n=IJ.request(()=>{i(`idle`)});return()=>{IJ.cancel(n)}},[t,e,a,r]),{mounted:a,setMounted:o,transitionStatus:r}}var t$=function(e){return e.startingStyle=`data-starting-style`,e.endingStyle=`data-ending-style`,e}({}),n$={[t$.startingStyle]:``},r$={[t$.endingStyle]:``},i$={transitionStatus(e){return e===`starting`?n$:e===`ending`?r$:null}};function a$(e,t=!1,n=!0){let r=LJ();return jJ((i,a=null)=>{r.cancel();let o=mZ(e);if(o==null)return;let s=o,c=()=>{ia.flushSync(i)};if(typeof s.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function l(){Promise.all(s.getAnimations().map(e=>e.finished)).then(()=>{a?.aborted||c()}).catch(()=>{if(n){a?.aborted||c();return}let e=s.getAnimations();!a?.aborted&&e.length>0&&e.some(e=>e.pending||e.playState!==`finished`)&&l()})}if(t){let e=t$.startingStyle;if(!s.hasAttribute(e)){r.request(l);return}let t=new MutationObserver(()=>{s.hasAttribute(e)||(t.disconnect(),l())});t.observe(s,{attributes:!0,attributeFilter:[e]}),a?.addEventListener(`abort`,()=>t.disconnect(),{once:!0});return}r.request(l)})}function o$(e){let{enabled:t=!0,open:n,ref:r,onComplete:i}=e,a=jJ(i),o=a$(r,n,!1);x.useEffect(()=>{if(!t)return;let e=new AbortController;return o(a,e.signal),()=>{e.abort()}},[t,n,a,o])}var s$={tabIndex:-1,[xq]:``};function c$(e,t,n=!1){let r=bX(),i=lZ()!=null,a=x.useRef(null);e===void 0&&a.current===null&&(a.current=t(r,i));let o=e??a.current;return $Q({popupStore:o,treatPopupAsFloatingElement:n,floatingRootContext:o.state.floatingRootContext,floatingId:r,nested:i,onOpenChange:o.setOpen}),{store:o,internalStore:a.current}}function l$(e,t){let n=x.useRef(null),r=x.useRef(null);return x.useCallback(i=>{if(e===void 0)return;let a=!1;if(n.current!==null){let e=n.current,i=r.current,o=t.context.triggerElements.getById(e);i&&o===i&&(t.context.triggerElements.delete(e),a=!0),n.current=null,r.current=null}if(i!==null&&(n.current=e,r.current=i,t.context.triggerElements.add(e,i),a=!0),a){let e=t.context.triggerElements.size;t.select(`open`)&&t.state.triggerCount!==e&&t.set(`triggerCount`,e)}},[t,e])}function u$(e,t,n){let r=n?.id??null;(r||t)&&(e.activeTriggerId=r,e.activeTriggerElement=n??null)}function d$(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=l$(e,n),o=jJ(t=>{if(a(t),!t)return;let i=n.select(`open`),o=n.select(`activeTriggerId`);if(o===e){n.update({activeTriggerElement:t,...i?r:null});return}o==null&&i&&n.update({activeTriggerId:e,activeTriggerElement:t,...r})});return xK(()=>{i&&n.update({activeTriggerElement:t.current,...r})},[i,n,t,...Object.values(r)]),{registerTrigger:o,isMountedByThisTrigger:i}}function f$(e){let t=e.useState(`open`);xK(()=>{if(!t){e.state.triggerCount!==0&&e.set(`triggerCount`,0);return}let n=e.context.triggerElements.size,r={};if(e.state.triggerCount!==n&&(r.triggerCount=n),!e.select(`activeTriggerId`)&&n===1){let t=e.context.triggerElements.entries().next();if(!t.done){let[e,n]=t.value;r.activeTriggerId=e,r.activeTriggerElement=n}}(r.triggerCount!==void 0||r.activeTriggerId!==void 0)&&e.update(r)},[t,e,e.useState(`triggerCount`)])}function p$(e,t,n){let{mounted:r,setMounted:i,transitionStatus:a}=e$(e);t.useSyncedValues({mounted:r,transitionStatus:a});let o=jJ(()=>{i(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)}),s=t.useState(`preventUnmountingOnClose`);return o$({enabled:r&&!e&&!s,open:e,ref:t.context.popupRef,onComplete(){e||o()}}),{forceUnmount:o,transitionStatus:a}}function m$(e,t){e.useSyncedValues(t),xK(()=>()=>{e.update({activeTriggerProps:Gq,inactiveTriggerProps:Gq,popupProps:Gq})},[e])}function h$(e,t){xK(()=>{!t&&e.state.openMethod!==null&&e.set(`openMethod`,null)},[t,e]),xK(()=>()=>{e.state.openMethod!==null&&e.set(`openMethod`,null)},[e])}var g$=class{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(e,t){let n=this.idMap.get(e);n!==t&&(n!==void 0&&this.elementsSet.delete(n),this.elementsSet.add(t),this.idMap.set(e,t))}delete(e){let t=this.idMap.get(e);t&&(this.elementsSet.delete(t),this.idMap.delete(e))}hasElement(e){return this.elementsSet.has(e)}hasMatchingElement(e){for(let t of this.elementsSet)if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}};function _$(){return new QQ({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new g$,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function v$(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:_$(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:Gq,inactiveTriggerProps:Gq,popupProps:Gq}}function y$(e,t,n=!1){return new QQ({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0})}var b$=VQ(e=>e.triggerIdProp??e.activeTriggerId),x$=VQ(e=>e.openProp??e.open),S$=VQ(e=>(e.popupElement?.id??e.floatingId)||void 0);function C$(e,t){return t!==void 0&&x$(e)&&b$(e)===t}function w$(e,t){return C$(e,t)?!0:t!==void 0&&x$(e)&&b$(e)==null&&e.triggerCount===1}var T$={open:x$,mounted:VQ(e=>e.mounted),transitionStatus:VQ(e=>e.transitionStatus),floatingRootContext:VQ(e=>e.floatingRootContext),triggerCount:VQ(e=>e.triggerCount),preventUnmountingOnClose:VQ(e=>e.preventUnmountingOnClose),payload:VQ(e=>e.payload),activeTriggerId:b$,activeTriggerElement:VQ(e=>e.mounted?e.activeTriggerElement:null),popupId:S$,isTriggerActive:VQ((e,t)=>t!==void 0&&b$(e)===t),isOpenedByTrigger:VQ((e,t)=>C$(e,t)),isMountedByTrigger:VQ((e,t)=>t!==void 0&&b$(e)===t&&e.mounted),triggerProps:VQ((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),triggerPopupId:VQ((e,t)=>w$(e,t)?S$(e):void 0),popupProps:VQ(e=>e.popupProps),popupElement:VQ(e=>e.popupElement),positionerElement:VQ(e=>e.positionerElement)};function E$(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=bX(),a=lZ()!=null,o=fK(()=>new QQ({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new g$,floatingId:i,syncOnly:!1,nested:a})).current;return xK(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=tq(r.reference)?r.reference:null),r.floating!==void 0&&(e.floatingElement=r.floating),o.update(e)},[t,i,r.reference,r.floating,o]),o.context.onOpenChange=n,o.context.nested=a,o}function D$(e={}){let{nodeId:t,externalTree:n}=e,r=E$(e),i=e.rootContext||r,a=i.useState(`referenceElement`),o=i.useState(`floatingElement`),s=i.useState(`domReferenceElement`),c=i.useState(`open`),l=i.useState(`floatingId`),[u,d]=x.useState(null),[f,p]=x.useState(void 0),[m,h]=x.useState(void 0),g=x.useRef(null),_=uZ(n),v=x.useMemo(()=>({reference:a,floating:o,domReference:s}),[a,o,s]),y=PQ({...e,elements:{...v,...u&&{reference:u}}}),b=tq(f)?f:null,S=m===void 0?i.state.floatingElement:m;i.useSyncedValue(`referenceElement`,f??null),i.useSyncedValue(`domReferenceElement`,f===void 0?s:b),i.useSyncedValue(`floatingElement`,S);let C=x.useCallback(e=>{let t=tq(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;d(t),y.refs.setReference(t)},[y.refs]),w=x.useCallback(e=>{(tq(e)||e===null)&&(g.current=e,p(e)),(tq(y.refs.reference.current)||y.refs.reference.current===null||e!==null&&!tq(e))&&y.refs.setReference(e)},[y.refs,p]),T=x.useCallback(e=>{h(e),y.refs.setFloating(e)},[y.refs]),E=x.useMemo(()=>({...y.refs,setReference:w,setFloating:T,setPositionReference:C,domReference:g}),[y.refs,w,T,C]),D=x.useMemo(()=>({...y.elements,domReference:s}),[y.elements,s]),O=x.useMemo(()=>({...y,dataRef:i.context.dataRef,open:c,onOpenChange:i.setOpen,events:i.context.events,floatingId:l,refs:E,elements:D,nodeId:t,rootStore:i}),[y,E,D,t,i,c,l]);return xK(()=>{s&&(g.current=s)},[s]),xK(()=>{i.context.dataRef.current.floatingContext=O;let e=_?.nodesRef.current.find(e=>e.id===t);e&&(e.context=O)}),x.useMemo(()=>({...y,context:O,refs:E,elements:D,rootStore:i}),[y,E,D,O,i])}var O$=zK&&LK;function k$(e,t={}){let{enabled:n=!0,delay:r}=t,i=`rootStore`in e?e.rootStore:e,{events:a,dataRef:o}=i.context,s=x.useRef(!1),c=x.useRef(null),l=x.useRef(!0),u=AK();x.useEffect(()=>{let e=i.select(`domReferenceElement`);if(!n)return;let t=QK(e);function r(){let e=i.select(`domReferenceElement`);!i.select(`open`)&&nq(e)&&e===Dq(RJ(e))&&(s.current=!0)}function a(){l.current=!0}function o(){l.current=!1}return yJ(vJ(t,`blur`,r),O$&&vJ(t,`keydown`,a,!0),O$&&vJ(t,`pointerdown`,o,!0))},[i,n]),x.useEffect(()=>{if(!n)return;function e(e){if(e.reason===`trigger-press`||e.reason===`escape-key`){let e=i.select(`domReferenceElement`);tq(e)&&(c.current=e,s.current=!0)}}return a.on(`openchange`,e),()=>{a.off(`openchange`,e)}},[a,n,i]);let d=x.useMemo(()=>{function e(){s.current=!1,c.current=null}return{onMouseLeave(){e()},onFocus(t){let n=t.currentTarget;if(s.current){if(c.current===n)return;e()}let a=kq(t.nativeEvent);if(tq(a)){if(O$&&!t.relatedTarget){if(!l.current&&!Nq(a))return}else if(!Iq(a))return}let o=Aq(t.relatedTarget,i.context.triggerElements),{nativeEvent:d,currentTarget:f}=t,p=typeof r==`function`?r():r;if(i.select(`open`)&&o||p===0||p===void 0){i.setOpen(!0,pJ(Yq,d,f));return}u.start(p,()=>{s.current||i.setOpen(!0,pJ(Yq,d,f))})},onBlur(t){e();let n=t.relatedTarget,r=t.nativeEvent,a=tq(n)&&n.hasAttribute(nX(`focus-guard`))&&n.getAttribute(`data-type`)===`outside`;u.start(0,()=>{let e=i.select(`domReferenceElement`),t=Dq(RJ(e));!n&&t===e||Oq(o.current.floatingContext?.refs.floating.current,t)||Oq(e,t)||a||Aq(n??t,i.context.triggerElements)||i.setOpen(!1,pJ(Yq,r))})}}},[o,r,i,u]);return x.useMemo(()=>n?{reference:d,trigger:d}:{},[n,d])}var A$=class e{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new kK,this.restTimeout=new kK,this.handleCloseOptions=void 0}static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},j$=new WeakMap;function M$(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&j$.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),j$.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function N$(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=j$.get(n);a&&a!==e&&M$(a),M$(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,j$.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function P$(e){let t=e.context.dataRef.current,n=fK(()=>t.hoverInteractionState??A$.create()).current;return t.hoverInteractionState||=n,DK(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function F$(e,t={}){let{enabled:n=!0,closeDelay:r=0,nodeId:i}=t,a=`rootStore`in e?e.rootStore:e,o=a.useState(`open`),s=a.useState(`floatingElement`),c=a.useState(`domReferenceElement`),{dataRef:l}=a.context,u=uZ(),d=lZ(),f=P$(a),p=AK(),m=jJ(()=>Vq(l.current.openEvent?.type,f.interactedInside)),h=jJ(()=>Hq(l.current.openEvent?.type)),g=jJ(()=>{M$(f)});xK(()=>{o||(f.pointerType=void 0,f.restTimeoutPending=!1,f.interactedInside=!1,g())},[o,f,g]),x.useEffect(()=>g,[g]),xK(()=>{if(n&&o&&f.handleCloseOptions?.blockPointerEvents&&h()&&tq(c)&&s){let e=c,t=s,n=RJ(s),r=u?.nodesRef.current.find(e=>e.id===d)?.context?.elements.floating;r&&(r.style.pointerEvents=``);let i=f.pointerEventsScopeElement===t?null:f.pointerEventsScopeElement,a=r===t?null:r;return N$(f,{scopeElement:f.handleCloseOptions?.getScope?.()??i??a??e.closest(`[data-rootownerid]`)??n.body,referenceElement:e,floatingElement:t}),()=>{g()}}},[n,o,c,s,f,h,u,d,g]),x.useEffect(()=>{if(!n)return;function e(){return!!(u&&d&&eX(u.nodesRef.current,d).length>0)}function t(e){let t=zq(r,`close`,f.pointerType),n=()=>{a.setOpen(!1,pJ(Jq,e)),u?.events.emit(`floating.closed`,e)};t?f.openChangeTimeout.start(t,n):(f.openChangeTimeout.clear(),n())}function o(e){let t=kq(e);if(!Pq(t)){f.interactedInside=!1;return}f.interactedInside=t?.closest(`[aria-haspopup]`)!=null}function c(){f.openChangeTimeout.clear(),p.clear(),u?.events.off(`floating.closed`,_),g()}function h(n){if(e()&&u){u.events.on(`floating.closed`,_);return}if(Aq(n.relatedTarget,a.context.triggerElements))return;let r=l.current.floatingContext?.nodeId??i,o=n.relatedTarget;if(!(u&&r&&tq(o)&&eX(u.nodesRef.current,r,!1).some(e=>Oq(e.context?.elements.floating,o)))){if(f.handler){f.handler(n);return}g(),m()||t(n)}}function _(t){!u||!d||e()||p.start(0,()=>{u.events.off(`floating.closed`,_),a.setOpen(!1,pJ(Jq,t)),u.events.emit(`floating.closed`,t)})}let v=s;return yJ(v&&vJ(v,`mouseenter`,c),v&&vJ(v,`mouseleave`,h),v&&vJ(v,`pointerdown`,o,!0),()=>{u?.events.off(`floating.closed`,_)})},[n,s,a,l,r,i,m,g,f,u,d,p])}var I$={current:null};function L$(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0,triggerElementRef:c=I$,externalTree:l,isActiveTrigger:u=!0,getHandleCloseContext:d,isClosing:f,shouldOpen:p}=t,m=`rootStore`in e?e.rootStore:e,{dataRef:h,events:g}=m.context,_=uZ(l),v=P$(m),y=x.useRef(!1),b=EJ(i),S=EJ(r),C=EJ(o),w=EJ(n),T=EJ(p),E=EJ(f),D=jJ(()=>Vq(h.current.openEvent?.type,v.interactedInside)),O=jJ(()=>T.current?.()!==!1),k=jJ((e,t,n)=>{let r=m.context.triggerElements;if(r.hasElement(t))return!e||!Oq(e,t);if(!tq(n))return!1;let i=n;return r.hasMatchingElement(e=>Oq(e,i))&&(!e||!Oq(e,i))}),A=jJ(()=>{v.handler&&=(RJ(m.select(`domReferenceElement`)).removeEventListener(`mousemove`,v.handler),void 0)}),j=jJ(()=>{M$(v)});return u&&(v.handleCloseOptions=b.current?.__options),x.useEffect(()=>A,[A]),x.useEffect(()=>{if(!n)return;function e(e){e.open?y.current=!1:(y.current=e.reason===Jq,A(),v.openChangeTimeout.clear(),v.restTimeout.clear(),v.blockMouseMove=!0,v.restTimeoutPending=!1)}return g.on(`openchange`,e),()=>{g.off(`openchange`,e)}},[n,g,v,A]),x.useEffect(()=>{if(!n)return;function e(e,t=!0){let n=zq(S.current,`close`,v.pointerType);n?v.openChangeTimeout.start(n,()=>{m.setOpen(!1,pJ(Jq,e)),_?.events.emit(`floating.closed`,e)}):t&&(v.openChangeTimeout.clear(),m.setOpen(!1,pJ(Jq,e)),_?.events.emit(`floating.closed`,e))}let t=c.current??(u?m.select(`domReferenceElement`):null);if(!tq(t))return;function r(e){if(v.openChangeTimeout.clear(),v.blockMouseMove=!1,a&&!JK(v.pointerType))return;let t=Bq(C.current),n=zq(S.current,`open`,v.pointerType),r=kq(e),i=e.currentTarget??null,o=m.select(`domReferenceElement`),s=i;if(tq(r)&&!m.context.triggerElements.hasElement(r)){for(let e of m.context.triggerElements.elements())if(Oq(e,r)){s=e;break}}tq(i)&&tq(o)&&!m.context.triggerElements.hasElement(i)&&Oq(i,o)&&(s=o);let c=s==null?!1:k(o,s,r),l=m.select(`open`),u=E.current?.()??m.select(`transitionStatus`)===`ending`,d=!l&&u&&y.current,f=!c&&tq(s)&&tq(o)&&Oq(o,s)&&d,p=t>0&&!n,h=c&&(l||d)||f,g=!l||c;if(h){O()&&m.setOpen(!0,pJ(Jq,e,s));return}p||(n?v.openChangeTimeout.start(n,()=>{g&&O()&&m.setOpen(!0,pJ(Jq,e,s))}):g&&O()&&m.setOpen(!0,pJ(Jq,e,s)))}function i(t){if(D()){j();return}A();let n=RJ(m.select(`domReferenceElement`));v.restTimeout.clear(),v.restTimeoutPending=!1;let r=h.current.floatingContext??d?.();if(!Aq(t.relatedTarget,m.context.triggerElements)){if(b.current&&r){m.select(`open`)||v.openChangeTimeout.clear();let i=c.current;v.handler=b.current({...r,tree:_,x:t.clientX,y:t.clientY,onClose(){j(),A(),w.current&&!D()&&i===m.select(`domReferenceElement`)&&e(t,!0)}}),n.addEventListener(`mousemove`,v.handler),v.handler(t);return}(v.pointerType!==`touch`||!Oq(m.select(`floatingElement`),t.relatedTarget))&&e(t)}}return s?yJ(vJ(t,`mousemove`,r,{once:!0}),vJ(t,`mouseenter`,r),vJ(t,`mouseleave`,i)):yJ(vJ(t,`mouseenter`,r),vJ(t,`mouseleave`,i))},[A,j,h,S,m,n,b,v,u,k,D,a,s,C,c,_,w,d,E,O]),x.useMemo(()=>{if(!n)return;function e(e){v.pointerType=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e,n=e.currentTarget,r=m.select(`domReferenceElement`),i=m.select(`open`),o=k(r,n,e.target);if(a&&!JK(v.pointerType))return;if(i&&o&&v.handleCloseOptions?.blockPointerEvents){let e=m.select(`floatingElement`);e&&N$(v,{scopeElement:v.handleCloseOptions?.getScope?.()??n.ownerDocument.body,referenceElement:n,floatingElement:e})}let s=Bq(C.current);if(i&&!o||s===0||!o&&v.restTimeoutPending&&e.movementX**2+e.movementY**2<2)return;v.restTimeout.clear();function c(){if(v.restTimeoutPending=!1,D())return;let e=m.select(`open`);!v.blockMouseMove&&(!e||o)&&O()&&m.setOpen(!0,pJ(Jq,t,n))}v.pointerType===`touch`?ia.flushSync(()=>{c()}):o&&i?c():(v.restTimeoutPending=!0,v.restTimeout.start(s,c))}}},[n,v,D,k,a,m,C,O])}var R$=`Escape`;function z$(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function B$(e,t){return z$(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function V$(e,t,n){return z$(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function H$(e,t,n){return z$(t,n?e===Cq:e===wq,e===Eq)}function U$(e,t,n,r){return t===`both`||t===`horizontal`&&r&&r>1?e===R$:z$(t,n?e===wq:e===Cq,e===Tq)}function W$(e,t){let{listRef:n,activeIndex:r,onNavigate:i=()=>{},enabled:a=!0,selectedIndex:o=null,allowEscape:s=!1,loopFocus:c=!1,nested:l=!1,rtl:u=!1,virtual:d=!1,focusItemOnOpen:f=`auto`,focusItemOnHover:p=!0,openOnArrowKeyDown:m=!0,disabledIndices:h=void 0,orientation:g=`vertical`,parentOrientation:_,cols:v=1,id:y,resetOnPointerLeave:b=!0,externalTree:S}=t,C=`rootStore`in e?e.rootStore:e,w=C.useState(`open`),T=C.useState(`floatingElement`),E=C.useState(`domReferenceElement`),D=C.context.dataRef,O=Lq(T),k=Fq(E),A=EJ(O),j=lZ(),M=uZ(S),N=x.useRef(f),P=x.useRef(o??-1),F=x.useRef(null),I=x.useRef(!0),L=jJ(e=>{i(P.current===-1?null:P.current,e)}),ee=x.useRef(L),R=x.useRef(!!T),z=x.useRef(w),B=x.useRef(!1),V=x.useRef(!1),H=x.useRef(null),te=EJ(h),U=EJ(w),ne=EJ(o),re=EJ(b),ie=LJ(),ae=LJ(),oe=jJ(()=>{function e(e){d?M?.events.emit(`virtualfocus`,e):H.current=iX(e,{sync:B.current,preventScroll:!0})}let t=n.current[P.current],r=V.current;t&&e(t),(B.current?e=>e():e=>ie.request(e))(()=>{let i=n.current[P.current]||t;i&&(t||e(i),fe&&(r||!I.current)&&i.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});xK(()=>{D.current.orientation=g},[D,g]),xK(()=>{a&&(w&&T?(P.current=o??-1,N.current&&o!=null&&(V.current=!0,L())):R.current&&(P.current=-1,ee.current()))},[a,w,T,o,L]),xK(()=>{if(a){if(!w){B.current=!1;return}if(T)if(r==null){if(B.current=!1,ne.current!=null)return;if(R.current&&(P.current=-1,oe()),(!z.current||!R.current)&&N.current&&(F.current!=null||N.current===!0&&F.current==null)){let e=0,t=()=>{n.current[0]==null?(e<2&&(e?e=>ae.request(e):queueMicrotask)(t),e+=1):(P.current=F.current==null||V$(F.current,g,u)||l?yY(n):bY(n),F.current=null,L())};t()}}else vY(n.current,r)||(P.current=r,oe(),V.current=!1)}},[a,w,T,r,ne,l,n,g,u,L,oe,ae]),xK(()=>{if(!a||T||!M||d||!R.current)return;let e=M.nodesRef.current,t=e.find(e=>e.id===j)?.context?.elements.floating,n=Dq(RJ(T)),r=e.some(e=>e.context&&Oq(e.context.elements.floating,n));t&&!r&&I.current&&t.focus({preventScroll:!0})},[a,T,M,j,d]),xK(()=>{ee.current=L,z.current=w,R.current=!!T}),xK(()=>{w||(F.current=null,N.current=f)},[w,f]);let se=r!=null,ce=jJ(e=>{if(!U.current)return;let t=n.current.indexOf(e.currentTarget);t!==-1&&(P.current!==t||r!==t)&&(P.current=t,L(e))}),le=jJ(()=>_??M?.nodesRef.current.find(e=>e.id===j)?.context?.dataRef?.current.orientation),ue=jJ(()=>yY(n,te.current)),de=jJ(e=>{if(I.current=!1,B.current=!0,e.which===229||!U.current&&e.currentTarget===A.current)return;if(l&&U$(e.key,g,u,v)){B$(e.key,le())||WK(e),C.setOpen(!1,pJ(rJ,e.nativeEvent)),nq(E)&&(d?M?.events.emit(`virtualfocus`,E):E.focus());return}let t=P.current,r=yY(n,h),i=bY(n,h);if(k||(e.key===`Home`&&(WK(e),P.current=r,L(e)),e.key===`End`&&(WK(e),P.current=i,L(e))),v>1){let t=Array.from({length:n.current.length},()=>({width:1,height:1})),a=CY(t,v,!1),o=a.findIndex(e=>e!=null&&!EY(n.current,e,h)),s=a.reduce((e,t,r)=>t!=null&&!EY(n.current,t,h)?r:e,-1),l=a[SY(a.map(e=>e==null?null:n.current[e]),{event:e,orientation:g,loopFocus:c,rtl:u,cols:v,disabledIndices:TY([...(typeof h==`function`?null:h)||n.current.map((e,t)=>EY(n.current,t,h)?t:void 0),void 0],a),minIndex:o,maxIndex:s,prevIndex:wY(P.current>i?r:P.current,t,a,v,e.key===`ArrowDown`?`bl`:e.key===(u?`ArrowLeft`:`ArrowRight`)?`tr`:`tl`),stopEvent:!0})];if(l!=null&&(P.current=l,L(e)),g===`both`)return}if(B$(e.key,g)){if(WK(e),w&&!d&&Dq(e.currentTarget.ownerDocument)===e.currentTarget){P.current=V$(e.key,g,u)?r:i,L(e);return}V$(e.key,g,u)?c?t>=i?s&&t!==n.current.length?P.current=-1:(B.current=!1,P.current=r):P.current=xY(n.current,{startingIndex:t,disabledIndices:h}):P.current=Math.min(i,xY(n.current,{startingIndex:t,disabledIndices:h})):c?t<=r?s&&t!==-1?P.current=n.current.length:(B.current=!1,P.current=i):P.current=xY(n.current,{startingIndex:t,decrement:!0,disabledIndices:h}):P.current=Math.max(r,xY(n.current,{startingIndex:t,decrement:!0,disabledIndices:h})),vY(n.current,P.current)&&(P.current=-1),L(e)}}),fe=x.useMemo(()=>({onFocus(e){B.current=!0,ce(e)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(e){B.current=!0,V.current=!1,p&&ce(e)},onPointerLeave(e){if(!U.current||!I.current||e.pointerType===`touch`)return;B.current=!0;let t=e.relatedTarget;if(!(!p||n.current.includes(t))&&re.current&&(H.current?.(),H.current=null,P.current=-1,L(e),!d)){let e=A.current,t=Dq(RJ(e));e&&Oq(e,t)&&e.focus({preventScroll:!0})}}}),[ce,U,A,p,n,L,re,d]),pe=x.useMemo(()=>d&&w&&se&&{"aria-activedescendant":`${y}-${r}`},[d,w,se,y,r]),me=x.useMemo(()=>({"aria-orientation":g===`both`?void 0:g,...k?{}:pe,onKeyDown(e){if(e.key===`Tab`&&e.shiftKey&&w&&!d){let t=kq(e.nativeEvent);if(t&&!Oq(A.current,t))return;WK(e),C.setOpen(!1,pJ(tJ,e.nativeEvent)),nq(E)&&E.focus();return}de(e)},onPointerMove(){I.current=!0}}),[pe,de,A,g,k,C,w,d,E]),he=x.useMemo(()=>{function e(e){C.setOpen(!0,pJ(rJ,e.nativeEvent,e.currentTarget))}function t(e){f===`auto`&&KK(e.nativeEvent)&&(N.current=!d)}function n(e){N.current=f,f===`auto`&&qK(e.nativeEvent)&&(N.current=!0)}return{onKeyDown(t){let n=C.select(`open`);I.current=!1;let r=t.key.startsWith(`Arrow`),i=H$(t.key,le(),u),a=B$(t.key,g),o=(l?i:a)||t.key===`Enter`||t.key.trim()===``;if(d&&n)return de(t);if(!(!n&&!m&&r)){if(o){let e=B$(t.key,le());F.current=l&&e?null:t.key}if(l){i&&(WK(t),n?(P.current=ue(),L(t)):e(t));return}a&&(ne.current!=null&&(P.current=ne.current),WK(t),!n&&m?e(t):de(t),n&&L(t))}},onFocus(e){C.select(`open`)&&!d&&(P.current=-1,L(e))},onPointerDown:n,onPointerEnter:n,onMouseDown:t,onClick:t}},[de,f,ue,l,L,C,m,g,le,u,ne,d]),ge=x.useMemo(()=>({...pe,...he}),[pe,he]);return x.useMemo(()=>a?{reference:ge,floating:me,item:fe,trigger:he}:{},[a,ge,me,he,fe])}function G$(e,t){let{listRef:n,elementsRef:r,activeIndex:i,onMatch:a,onTyping:o,enabled:s=!0,resetMs:c=750,selectedIndex:l=null}=t,u=`rootStore`in e?e.rootStore:e,d=u.useState(`open`),f=AK(),p=x.useRef(``),m=x.useRef(l??i??-1),h=x.useRef(null),g=jJ(e=>{function t(e){let t=r?.current[e];return!t||OY(t)}function s(e,n,r=0){if(e.length===0)return-1;let i=(r%e.length+e.length)%e.length,a=n.toLocaleLowerCase();for(let n=0;n<e.length;n+=1){let r=(i+n)%e.length;if(!(!e[r]?.toLocaleLowerCase().startsWith(a)||!t(r)))return r}return-1}let u=n.current;if(p.current.length>0&&e.key===` `&&(WK(e),o?.(!0)),p.current.length>0&&p.current[0]!==` `&&s(u,p.current)===-1&&e.key!==` `&&o?.(!1),u==null||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;d&&e.key!==` `&&(WK(e),o?.(!0));let g=p.current===``;g&&(m.current=l??i??-1),u.every(e=>e?e[0]?.toLocaleLowerCase()!==e[1]?.toLocaleLowerCase():!0)&&p.current===e.key&&(p.current=``,m.current=h.current),p.current+=e.key,f.start(c,()=>{p.current=``,m.current=h.current,o?.(!1)});let _=((g?l??i??-1:m.current)??0)+1,v=s(u,p.current,_);v===-1?e.key!==` `&&(p.current=``,o?.(!1)):(a?.(v),h.current=v)}),_=jJ(e=>{let t=e.relatedTarget,n=u.select(`domReferenceElement`),r=u.select(`floatingElement`);Oq(n,t)||Oq(r,t)||(f.clear(),p.current=``,m.current=h.current,o?.(!1))});xK(()=>{!d&&l!==null||(f.clear(),h.current=null,p.current!==``&&(p.current=``))},[d,l,f]),xK(()=>{d&&p.current===``&&(m.current=l??i??-1)},[d,l,i]);let v=x.useMemo(()=>({onKeyDown:g,onBlur:_}),[g,_]);return x.useMemo(()=>s?{reference:v,floating:v}:{},[s,v])}var K$=.1,q$=K$*K$,J$=.5;function Y$(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function X$(e,t,n,r,i,a,o,s,c,l){let u=!1;return Y$(e,t,n,r,i,a)&&(u=!u),Y$(e,t,i,a,o,s)&&(u=!u),Y$(e,t,o,s,c,l)&&(u=!u),Y$(e,t,c,l,n,r)&&(u=!u),u}function Z$(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function Q$(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function $$(e={}){let{blockPointerEvents:t=!1}=e,n=new kK,r=({x:e,y:t,placement:r,elements:i,onClose:a,nodeId:o,tree:s})=>{let c=r?.split(`-`)[0],l=!1,u=null,d=null,f=typeof performance<`u`?performance.now():0;function p(e,t){let n=performance.now(),r=n-f;if(u===null||d===null||r===0)return u=e,d=t,f=n,!1;let i=e-u,a=t-d,o=i*i+a*a,s=r*r*q$;return u=e,d=t,f=n,o<s}function m(){n.clear(),a()}return function(r){n.clear();let a=i.domReference,u=i.floating;if(!a||!u||c==null||e==null||t==null)return;let{clientX:d,clientY:f}=r,h=kq(r),g=r.type===`mouseleave`,_=Oq(u,h),v=Oq(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&tq(r.relatedTarget)&&Oq(u,r.relatedTarget))return;function y(){return!!(s&&eX(s.nodesRef.current,o).length>0)}function b(){y()||m()}if(y())return;let x=a.getBoundingClientRect(),S=u.getBoundingClientRect(),C=e>S.right-S.width/2,w=t>S.bottom-S.height/2,T=S.width>x.width,E=S.height>x.height,D=(T?x:S).left,O=(T?x:S).right,k=(E?x:S).top,A=(E?x:S).bottom;if(c===`top`&&t>=x.bottom-1||c===`bottom`&&t<=x.top+1||c===`left`&&e>=x.right-1||c===`right`&&e<=x.left+1){b();return}let j=!1;switch(c){case`top`:j=Q$(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=Q$(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=Q$(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=Q$(d,f,x.right-1,A,S.left+1,k);break;default:}if(j)return;if(l&&!Z$(d,f,x)){b();return}if(!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?J$/2:J$*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+J$+1,o=C||T?S.bottom-J$:S.top,s=C?T?S.bottom-J$:S.top:S.bottom-J$;M=X$(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?J$/2:J$*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-J$,o=C||T?S.top+J$:S.bottom,s=C?T?S.top+J$:S.bottom:S.top+J$;M=X$(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?J$/2:J$*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+J$+1,o=w||E?S.right-J$:S.left,s=w?E?S.right-J$:S.left:S.right-J$;M=X$(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?J$/2:J$*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-J$,o=w||E?S.left+J$:S.right,s=w?E?S.left+J$:S.right:S.left+J$;M=X$(d,f,a,r,a,i,o,S.top,s,S.bottom);break}default:}M?l||n.start(40,b):b()}};return r.__options={...e,blockPointerEvents:t},r}var e1={...T$,disabled:VQ(e=>e.disabled),instantType:VQ(e=>e.instantType),isInstantPhase:VQ(e=>e.isInstantPhase),trackCursorAxis:VQ(e=>e.trackCursorAxis),disableHoverablePopup:VQ(e=>e.disableHoverablePopup),lastOpenChangeReason:VQ(e=>e.openChangeReason),closeOnClick:VQ(e=>e.closeOnClick),closeDelay:VQ(e=>e.closeDelay),hasViewport:VQ(e=>e.hasViewport)},t1=class e extends XQ{constructor(e,t,n=!1){let r=new g$,i={...n1(),...e};i.floatingRootContext=y$(r,t,n),super(i,{popupRef:x.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:r},e1)}setOpen=(e,t)=>{let n=t.reason,r=n===Jq,i=e&&n===`trigger-focus`,a=!e&&(n===`trigger-press`||n===`escape-key`);if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let o=()=>{let r={open:e,openChangeReason:n};i?r.instantType=`focus`:a?r.instantType=`dismiss`:n===`trigger-hover`&&(r.instantType=void 0),u$(r,e,t.trigger),this.update(r)};r?ia.flushSync(o):o()};cancelPendingOpen(e){this.state.floatingRootContext.dispatchOpenChange(!1,pJ(qq,e))}static useStore(t,n){return c$(t,(t,r)=>new e(n,t,r)).store}};function n1(){return{...v$(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:`none`,disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,hasViewport:!1}}var r1=_K(function(e){let{disabled:t=!1,defaultOpen:n=!1,open:r,disableHoverablePopup:i=!1,trackCursorAxis:a=`none`,actionsRef:o,onOpenChange:s,onOpenChangeComplete:c,handle:l,triggerId:u,defaultTriggerId:d=null,children:f}=e,p=t1.useStore(l?.store,{open:n,openProp:r,activeTriggerId:d,triggerIdProp:u});bK(()=>{r===void 0&&p.state.open===!1&&n===!0&&p.update({open:!0,activeTriggerId:d})}),p.useControlledProp(`openProp`,r),p.useControlledProp(`triggerIdProp`,u),p.useContextCallback(`onOpenChange`,s),p.useContextCallback(`onOpenChangeComplete`,c);let m=p.useState(`open`),h=!t&&m,g=p.useState(`activeTriggerId`),_=p.useState(`mounted`),v=p.useState(`payload`);p.useSyncedValues({trackCursorAxis:a,disableHoverablePopup:i}),p.useSyncedValue(`disabled`,t),f$(p);let{forceUnmount:y,transitionStatus:b}=p$(h,p),S=p.useState(`isInstantPhase`),C=p.useState(`instantType`),w=p.useState(`lastOpenChangeReason`),T=x.useRef(null);xK(()=>{m&&t&&p.setOpen(!1,pJ(cJ))},[m,t,p]),xK(()=>{b===`ending`&&w===`none`||b!==`ending`&&S?(C!==`delay`&&(T.current=C),p.set(`instantType`,`delay`)):T.current!==null&&(p.set(`instantType`,T.current),T.current=null)},[b,S,w,C,p]),xK(()=>{h&&(g??p.set(`payload`,void 0))},[p,g,h]);let E=x.useCallback(()=>{p.setOpen(!1,pJ(dJ))},[p]);x.useImperativeHandle(o,()=>({unmount:y,close:E}),[y,E]);let D=h||_||!t&&a!==`none`;return(0,J.jsxs)(wK.Provider,{value:p,children:[D&&(0,J.jsx)(i1,{store:p,disabled:t,trackCursorAxis:a}),typeof f==`function`?f({payload:v}):f]})});function i1({store:e,disabled:t,trackCursorAxis:n}){let r=e.useState(`floatingRootContext`),i=jZ(r,{enabled:!t,referencePress:()=>e.select(`closeOnClick`)}),a=DZ(r,{enabled:!t&&n!==`none`,axis:n===`none`?void 0:n});return m$(e,{activeTriggerProps:x.useMemo(()=>kX(a.reference,i.reference),[a.reference,i.reference]),inactiveTriggerProps:x.useMemo(()=>kX(a.trigger,i.trigger),[a.trigger,i.trigger]),popupProps:x.useMemo(()=>kX(s$,a.floating,i.floating),[a.floating,i.floating])}),null}var a1=function(e){return e.open=`data-open`,e.closed=`data-closed`,e[e.startingStyle=t$.startingStyle]=`startingStyle`,e[e.endingStyle=t$.endingStyle]=`endingStyle`,e.anchorHidden=`data-anchor-hidden`,e.side=`data-side`,e.align=`data-align`,e}({}),o1=function(e){return e.popupOpen=`data-popup-open`,e.pressed=`data-pressed`,e}({}),s1={[o1.popupOpen]:``},c1={[o1.popupOpen]:``,[o1.pressed]:``},l1={[a1.open]:``},u1={[a1.closed]:``},d1={[a1.anchorHidden]:``},f1={open(e){return e?s1:null}},p1={open(e){return e?c1:null}},m1={open(e){return e?l1:u1},anchorHidden(e){return e?d1:null}};function h1(e){return bX(e,`base-ui`)}var g1=x.createContext(void 0);function _1(){return x.useContext(g1)}var v1=function(e){return e[e.popupOpen=o1.popupOpen]=`popupOpen`,e.triggerDisabled=`data-trigger-disabled`,e}({}),y1=`data-base-ui-tooltip-trigger`;function b1(e){if(`composedPath`in e){let t=e.composedPath();for(let e=0;e<t.length;e+=1){let n=t[e];if(tq(n))return n}}let t=e.target;return tq(t)?t:null}function x1(e){let t=e;for(;t;){if(t.hasAttribute(y1))return t;let e=t.parentElement;if(e){t=e;continue}let n=t.getRootNode();t=`host`in n&&tq(n.host)?n.host:null}return null}var S1=vK(function(e,t){let{render:n,className:r,style:i,handle:a,payload:o,disabled:s,delay:c,closeOnClick:l=!0,closeDelay:u,id:d,...f}=e,p=TK(!0),m=a?.store??p;if(!m)throw Error(CK(82));let h=h1(d),g=m.useState(`isTriggerActive`,h),_=m.useState(`isOpenedByTrigger`,h),v=m.useState(`floatingRootContext`),y=x.useRef(null),b=c??600,S=u??0,{registerTrigger:C,isMountedByThisTrigger:w}=d$(h,y,m,{payload:o,closeOnClick:l,closeDelay:S}),T=_1(),{delayRef:E,isInstantPhase:D,hasProvider:O}=_J(v,{open:_}),k=P$(v);m.useSyncedValue(`isInstantPhase`,D);let A=m.useState(`disabled`),j=s??A,M=EJ(j),N=m.useState(`trackCursorAxis`),P=m.useState(`disableHoverablePopup`),F=x.useRef(!1),I=AK(),L=x.useRef(void 0);function ee(){let e=T?.delay,t=typeof E.current==`object`?E.current.open:void 0,n=b;return O&&(n=t===0?0:c??e??b),n}function R(e){let t=y.current;if(!t||!e)return!1;let n=x1(e);return n!==null&&n!==t&&Oq(t,n)}function z(e){let t=R(e);return F.current=t,t&&(k.openChangeTimeout.clear(),k.restTimeout.clear(),k.restTimeoutPending=!1,I.clear()),t}let B=L$(v,{enabled:!j,mouseOnly:!0,move:!1,handleClose:!P&&N!==`both`?$$():null,restMs:ee,delay(){let e=typeof E.current==`object`?E.current.close:void 0,t=S;return u==null&&O&&(t=e),{close:t}},triggerElementRef:y,isActiveTrigger:g,isClosing:()=>m.select(`transitionStatus`)===`ending`,shouldOpen(){return!F.current}}),V=k$(v,{enabled:!j}).reference,H=e=>{let t=F.current,n=b1(e),r=z(n),i=y.current,a=i&&n&&Oq(i,n);if(r&&m.select(`open`)&&m.select(`lastOpenChangeReason`)===`trigger-hover`){m.setOpen(!1,pJ(Jq,e));return}if(t&&!r&&a&&!M.current&&!m.select(`open`)&&i&&JK(L.current)){let t=()=>{!F.current&&!M.current&&!m.select(`open`)&&m.setOpen(!0,pJ(Jq,e,i))},n=ee();n===0?(I.clear(),t()):I.start(n,t)}},te=m.useState(`triggerProps`,w);return UX(`button`,e,{state:{open:_},ref:[t,C,y],props:[B,V,w||N!==`none`?te:void 0,{onMouseOver(e){H(e.nativeEvent)},onFocus(e){R(b1(e.nativeEvent))&&e.preventBaseUIHandler()},onMouseLeave(){F.current=!1,I.clear(),L.current=void 0},onPointerEnter(e){L.current=e.pointerType},onPointerDown(e){L.current=e.pointerType,m.set(`closeOnClick`,l),l&&!m.select(`open`)&&m.cancelPendingOpen(e.nativeEvent)},onClick(e){l&&!m.select(`open`)&&m.cancelPendingOpen(e.nativeEvent)},id:h,[v1.triggerDisabled]:j?``:void 0,[y1]:j?void 0:``},f],stateAttributesMapping:f1})}),C1=x.createContext(void 0);function w1(){let e=x.useContext(C1);if(e===void 0)throw Error(CK(70));return e}var T1=x.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,style:o,...s}=e,{portalNode:c,portalSubtree:l}=rZ({container:r,ref:t,componentProps:e,elementProps:s});return!l&&!c?null:(0,J.jsxs)(x.Fragment,{children:[l,c&&ia.createPortal(n,c)]})}),E1=x.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return TK().useState(`mounted`)||n?(0,J.jsx)(C1.Provider,{value:n,children:(0,J.jsx)(T1,{ref:t,...r})}):null}),D1=x.createContext(void 0);function O1(){let e=x.useContext(D1);if(e===void 0)throw Error(CK(71));return e}var Ele=x.createContext(void 0);function k1(){return x.useContext(Ele)?.direction??`ltr`}var Dle=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,offsetParent:d=`real`}=ZJ(e,t)||{};if(l==null)return{};let f=hY(u),p={x:n,y:r},m=rY(i),h=tY(m),g=await o.getDimensions(l),_=m===`y`,v=_?`top`:`left`,y=_?`bottom`:`right`,b=_?`clientHeight`:`clientWidth`,x=a.reference[h]+a.reference[m]-p[m]-a.floating[h],S=p[m]-a.reference[m],C=d===`real`?await o.getOffsetParent?.(l):s.floating,w=s.floating[b]||a.floating[h];(!w||!await o.isElement?.(C))&&(w=s.floating[b]||a.floating[h]);let T=x/2-S/2,E=w/2-g[h]/2-1,D=Math.min(f[v],E),O=Math.min(f[y],E),k=D,A=w-g[h]-O,j=w/2-g[h]/2+T,M=XJ(k,j,A),N=!c.arrow&&$J(i)!=null&&j!==M&&a.reference[h]/2-(j<k?D:O)-g[h]/2<0,P=N?j<k?j-k:j-A:0;return{[m]:p[m]+P,data:{[m]:M,centerOffset:j-M-P,...N&&{alignmentOffset:P}},reset:N}}}),Ole=(e,t)=>({...Dle(e),options:[e,t]}),kle={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0;return{data:{referenceHidden:(await BQ().fn(e)).data?.referenceHidden||a}}}},A1={sideX:`left`,sideY:`top`},j1={name:`adaptiveOrigin`,async fn(e){let{x:t,y:n,rects:{floating:r},elements:{floating:i},platform:a,strategy:o,placement:s}=e,c=QK(i),l=c.getComputedStyle(i);if(!(l.transitionDuration!==`0s`&&l.transitionDuration!==``))return{x:t,y:n,data:A1};let u=await a.getOffsetParent?.(i),d={width:0,height:0};if(o===`fixed`&&c?.visualViewport)d={width:c.visualViewport.width,height:c.visualViewport.height};else if(u===c){let e=RJ(i);d={width:e.documentElement.clientWidth,height:e.documentElement.clientHeight}}else await a.isElement?.(u)&&(d=await a.getDimensions(u));let f=QJ(s),p=t,m=n;f===`left`&&(p=d.width-(t+r.width)),f===`top`&&(m=d.height-(n+r.height));let h=f===`left`?`right`:A1.sideX,g=f===`top`?`bottom`:A1.sideY;return{x:p,y:m,data:{sideX:h,sideY:g}}}};function M1(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function N1(e,t,n){let{rects:r,placement:i}=e;return{side:M1(t,QJ(i),n),align:$J(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function P1(e){let{anchor:t,positionMethod:n=`absolute`,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,collisionBoundary:s,collisionPadding:c=5,sticky:l=!1,arrowPadding:u=5,disableAnchorTracking:d=!1,inline:f,keepMounted:p=!1,floatingRootContext:m,mounted:h,collisionAvoidance:g,shiftCrossAxis:_=!1,nodeId:v,adaptiveOrigin:y,lazyFlip:b=!1,externalTree:S}=e,[C,w]=x.useState(null);!h&&C!==null&&w(null);let T=g.side||`flip`,E=g.align||`flip`,D=g.fallbackAxisSide||`end`,O=typeof t==`function`?t:void 0,k=jJ(O),A=O?k:t,j=EJ(t),M=EJ(h),N=k1()===`rtl`,P=C||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":N?`left`:`right`,"inline-start":N?`right`:`left`}[r],F=a===`center`?P:`${P}-${a}`,I=c,L=+(r===`bottom`),ee=+(r===`top`),R=+(r===`right`),z=+(r===`left`);typeof I==`number`?I={top:I+L,right:I+z,bottom:I+ee,left:I+R}:I&&={top:(I.top||0)+L,right:(I.right||0)+z,bottom:(I.bottom||0)+ee,left:(I.left||0)+R};let B={boundary:s===`clipping-ancestors`?`clippingAncestors`:s,padding:I},V=x.useRef(null),H=EJ(i),te=EJ(o),U=typeof i==`function`?0:i,ne=typeof o==`function`?0:o,re=[];f&&re.push(f),re.push(FQ(e=>{let t=N1(e,r,N),n=typeof H.current==`function`?H.current(t):H.current,i=typeof te.current==`function`?te.current(t):te.current;return{mainAxis:n,crossAxis:i,alignmentAxis:i}},[U,ne,N,r]));let ie=E===`none`&&T!==`shift`,ae=!ie&&(l||_||T===`shift`),oe=T===`none`?null:RQ({...B,padding:{top:I.top+1,right:I.right+1,bottom:I.bottom+1,left:I.left+1},mainAxis:!_&&T===`flip`,crossAxis:E===`flip`?`alignment`:!1,fallbackAxisSideDirection:D}),se=ie?null:IQ(e=>{let t=RJ(e.elements.floating).documentElement;return{...B,rootBoundary:_?{x:0,y:0,width:t.clientWidth,height:t.clientHeight}:void 0,mainAxis:E!==`none`,crossAxis:ae,limiter:l||_?void 0:LQ(e=>{if(!V.current)return{};let{width:t,height:n}=V.current.getBoundingClientRect(),r=nY(QJ(e.placement)),i=r===`y`?t:n,a=r===`y`?I.left+I.right:I.top+I.bottom;return{offset:i/2+a/2}})}},[B,l,_,I,E]);T===`shift`||E===`shift`||a===`center`?re.push(se,oe):re.push(oe,se),re.push(zQ({...B,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!M.current)return;let i=e.style;i.setProperty(`--available-width`,`${t}px`),i.setProperty(`--available-height`,`${n}px`);let a=QK(e).devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(`--anchor-width`,`${u}px`),i.setProperty(`--anchor-height`,`${d}px`)}}),Ole(e=>({element:V.current||RJ(e.elements.floating).createElement(`div`),padding:u,offsetParent:`floating`}),[u]),{name:`transformOrigin`,fn(e){let{elements:t,middlewareData:n,placement:a,rects:o,y:s}=e,c=QJ(a),l=nY(c),u=V.current,d=n.arrow?.x||0,f=n.arrow?.y||0,p=u?.clientWidth||0,m=u?.clientHeight||0,h=d+p/2,g=f+m/2,_=Math.abs(n.shift?.y||0),v=o.reference.height/2,y=typeof i==`function`?i(N1(e,r,N)):i,b=_>y,x={top:`${h}px calc(100% + ${y}px)`,bottom:`${h}px ${-y}px`,left:`calc(100% + ${y}px) ${g}px`,right:`${-y}px ${g}px`}[c],S=`${h}px ${o.reference.y+v-s}px`;return t.floating.style.setProperty(`--transform-origin`,ae&&l===`y`&&b?S:x),{}}},kle,y),xK(()=>{!h&&m&&m.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[h,m]);let ce=x.useMemo(()=>({elementResize:!d&&typeof ResizeObserver<`u`,layoutShift:!d&&typeof IntersectionObserver<`u`}),[d]),{refs:le,elements:ue,x:de,y:fe,middlewareData:pe,update:me,placement:he,context:ge,isPositioned:_e,floatingStyles:ve}=D$({rootContext:m,open:p?h:void 0,placement:F,middleware:re,strategy:n,whileElementsMounted:p?void 0:(...e)=>xQ(...e,ce),nodeId:v,externalTree:S}),{sideX:ye,sideY:be}=pe.adaptiveOrigin||A1,xe=_e?n:`fixed`,Se=x.useMemo(()=>{let e=y?{position:xe,[ye]:de,[be]:fe}:{position:xe,...ve};return _e||(e.opacity=0),e},[y,xe,ye,de,be,fe,ve,_e]),Ce=x.useRef(null);xK(()=>{if(!h)return;let e=j.current,t=typeof e==`function`?e():e,n=(F1(t)?t.current:t)||null;n!==Ce.current&&(le.setPositionReference(n),Ce.current=n)},[h,le,A,j]),x.useEffect(()=>{if(!h)return;let e=j.current;typeof e!=`function`&&F1(e)&&e.current!==Ce.current&&(le.setPositionReference(e.current),Ce.current=e.current)},[h,le,A,j]),x.useEffect(()=>{if(p&&h&&ue.domReference&&ue.floating)return xQ(ue.domReference,ue.floating,me,ce)},[p,h,ue,me,ce]);let we=QJ(he),Te=M1(r,we,N),Ee=$J(he)||`center`,De=!!pe.hide?.referenceHidden;xK(()=>{b&&h&&_e&&w(we)},[b,h,_e,we]);let Oe=x.useMemo(()=>({position:`absolute`,top:pe.arrow?.y,left:pe.arrow?.x}),[pe.arrow]),ke=pe.arrow?.centerOffset!==0;return x.useMemo(()=>({positionerStyles:Se,arrowStyles:Oe,arrowRef:V,arrowUncentered:ke,side:Te,align:Ee,physicalSide:we,anchorHidden:De,refs:le,context:ge,isPositioned:_e,update:me}),[Se,Oe,V,ke,Te,Ee,we,De,le,ge,_e,me])}function F1(e){return e!=null&&`current`in e}function I1(e){return e===`starting`?YX:Gq}function L1(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),UX(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},I1(r),i],stateAttributesMapping:m1})}var Ale=x.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`top`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=QX,style:g,..._}=e,v=TK(),y=w1(),b=v.useState(`open`),S=v.useState(`mounted`),C=v.useState(`trackCursorAxis`),w=v.useState(`disableHoverablePopup`),T=v.useState(`floatingRootContext`),E=v.useState(`instantType`),D=v.useState(`transitionStatus`),O=P1({anchor:i,positionMethod:a,floatingRootContext:T,mounted:S,side:o,sideOffset:c,align:s,alignOffset:l,collisionBoundary:u,collisionPadding:d,sticky:p,arrowPadding:f,disableAnchorTracking:m,keepMounted:y,collisionAvoidance:h,adaptiveOrigin:v.useState(`hasViewport`)?j1:void 0}),k=L1(e,x.useMemo(()=>({open:b,side:O.side,align:O.align,anchorHidden:O.anchorHidden,instant:C===`none`?E:`tracking-cursor`}),[b,O.side,O.align,O.anchorHidden,C,E]),{styles:O.positionerStyles,transitionStatus:D,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!S,inert:!b||C===`both`||w});return(0,J.jsx)(D1.Provider,{value:O,children:k})}),jle={...m1,...i$},Mle=x.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=TK(),{side:s,align:c}=O1(),l=o.useState(`open`),u=o.useState(`instantType`),d=o.useState(`transitionStatus`),f=o.useState(`popupProps`),p=o.useState(`floatingRootContext`),m=o.useState(`disabled`),h=o.useState(`closeDelay`);o$({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}}),F$(p,{enabled:!m,closeDelay:h});let g=o.useStateSetter(`popupElement`);return UX(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:d},ref:[t,o.context.popupRef,g],props:[f,I1(d),a],stateAttributesMapping:jle})}),Nle=x.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=TK(),{arrowRef:s,side:c,align:l,arrowUncentered:u,arrowStyles:d}=O1();return UX(`div`,e,{state:{open:o.useState(`open`),side:c,align:l,uncentered:u,instant:o.useState(`instantType`)},ref:[t,s],props:[{style:d,"aria-hidden":!0},a],stateAttributesMapping:m1})}),R1=function(e){let{delay:t,closeDelay:n,timeout:r=400}=e,i=x.useMemo(()=>({delay:t,closeDelay:n}),[t,n]),a=x.useMemo(()=>({open:t,close:n}),[t,n]);return(0,J.jsx)(g1.Provider,{value:i,children:(0,J.jsx)(gJ,{delay:a,timeoutMs:r,children:e.children})})};function z1(e){return SX(19)?e:e?`true`:void 0}function Ple(e){let[t,n]=x.useState({current:e,previous:null});return e!==t.current&&n({current:e,previous:t.current}),t.previous}var B1=x.createContext(null),Fle=typeof window<`u`&&window.location.hostname===`localhost`||typeof globalThis<`u`&&globalThis.process?.env?.NODE_ENV===`development`,V1=!1;function H1(e){return!e||typeof window>`u`?`light`:window.getComputedStyle(e).getPropertyValue(`--pn-default-background`).trim()?`dark`:`light`}function U1({elementRef:e,children:t}){let n=x.useContext(B1),[r,i]=x.useState({container:null,scheme:`light`});x.useEffect(()=>{let t=()=>i({container:e.current??null,scheme:H1(e.current)});t();let n=[e.current,document.documentElement].filter(Boolean),r=new MutationObserver(t);return n.forEach(e=>r.observe(e,{attributes:!0,attributeFilter:[`class`,`data-polotno-theme`]})),()=>r.disconnect()},[e]);let a=x.useMemo(()=>({container:n?.container??r.container,scheme:r.scheme}),[n?.container,r.container,r.scheme]);return(0,J.jsx)(B1.Provider,{value:a,children:t})}function W1(){let e=x.useContext(B1),[t,n]=x.useState(`light`);x.useEffect(()=>{e||(Fle&&!V1&&(V1=!0,console.warn("[polotno] Render Polotno UI inside <PolotnoContainer> or a `.polotno-ui` element.")),n(H1(document.querySelector(`.polotno-ui, [data-polotno-theme], [class*="polotno-"]:not(.polotno-portal)`))))},[e]);let r=e?.container??void 0;return r?{container:r,className:`polotno-portal`}:{className:`polotno-portal`,...(e?.scheme??t)===`dark`?{"data-polotno-theme":`dark`}:{}}}var G1=x.createContext(!1);function Ile({delay:e=0,...t}){return(0,J.jsx)(G1.Provider,{value:!0,children:(0,J.jsx)(R1,{delay:e,...t})})}function K1({...e}){let t=x.useContext(G1),n=(0,J.jsx)(r1,{"data-slot":`tooltip`,...e});return t?n:(0,J.jsx)(R1,{delay:0,children:n})}function q1({...e}){return(0,J.jsx)(S1,{"data-slot":`tooltip-trigger`,...e})}var J1=x.forwardRef(({className:e,side:t,sideOffset:n=4,align:r=`center`,children:i,...a},o)=>{let{container:s,className:c,...l}=W1();return(0,J.jsx)(E1,{container:s,children:(0,J.jsx)(Ale,{side:t,sideOffset:n,align:r,positionMethod:`fixed`,className:`pn:z-50`,children:(0,J.jsxs)(Mle,{ref:o,"data-slot":`tooltip-content`,...l,className:rK(c,`pn:z-50 pn:w-fit origin-(--transform-origin) pn:animate-in pn:rounded-md pn:bg-foreground pn:px-3 pn:py-1.5 pn:text-xs pn:text-balance pn:text-background pn:fade-in-0 pn:zoom-in-95 pn:data-[side=bottom]:slide-in-from-top-2 pn:data-[side=left]:slide-in-from-right-2 pn:data-[side=right]:slide-in-from-left-2 pn:data-[side=top]:slide-in-from-bottom-2 pn:data-[closed]:animate-out pn:data-[closed]:fade-out-0 pn:data-[closed]:zoom-out-95`,e),...a,children:[i,(0,J.jsx)(Nle,{className:rK(`pn:z-50 pn:size-2.5 pn:translate-y-[calc(-50%_-_2px)] pn:rotate-45 pn:rounded-[2px] pn:bg-foreground pn:fill-foreground`,`pn:data-[side=bottom]:top-1`,`pn:data-[side=top]:-bottom-2.5`,`pn:data-[side=left]:top-1/2! pn:data-[side=left]:-right-1 pn:data-[side=left]:-translate-y-1/2`,`pn:data-[side=right]:top-1/2! pn:data-[side=right]:-left-1 pn:data-[side=right]:-translate-y-1/2`,`pn:data-[side=inline-end]:top-1/2! pn:data-[side=inline-end]:-left-1 pn:data-[side=inline-end]:-translate-y-1/2`,`pn:data-[side=inline-start]:top-1/2! pn:data-[side=inline-start]:-right-1 pn:data-[side=inline-start]:-translate-y-1/2`)})]})})})});J1.displayName=`TooltipContent`;var Y1=x.forwardRef(({label:e,active:t,side:n,hideTooltipWhenDisabled:r=!1,variant:i=`ghost`,size:a=`icon-sm`,disabled:o,className:s,children:c,...l},u)=>{let d=(0,J.jsx)(uK,{ref:u,variant:i,size:a,disabled:o,"aria-label":e,"data-active":t||void 0,className:rK(t&&`pn:bg-muted`,s),...l,children:c});return r&&o?d:(0,J.jsxs)(K1,{children:[(0,J.jsx)(q1,{render:d}),(0,J.jsx)(J1,{side:n,children:e})]})});Y1.displayName=`TooltipIconButton`;var Lle=e=>{let t=Ju.Util.colorToRGBA(e);return(t?.299*t.r+.587*t.g+.114*t.b:232)>150?`rgba(0, 0, 0, 0.6)`:`rgba(255, 255, 255, 0.85)`},Rle=W(({store:e,page:t,xPadding:n,yPadding:r,layout:i=`vertical`})=>{let a=e.pages.length>1,o=e.pages.indexOf(t),s=i===`horizontal`,c=s?`ui.chevronLeft`:`ui.chevronUp`,l=s?`ui.chevronRight`:`ui.chevronDown`,u=Q(s?`workspace.moveLeft`:`workspace.moveUp`),d=Q(s?`workspace.moveRight`:`workspace.moveDown`),{workspaceBackgroundColor:f}=mp(),p=Lle(f);return e.tool!==`selection`||e.role===Dw.VIEWER?null:(0,J.jsxs)(`div`,{className:`polotno-page-controls`,style:{position:`absolute`,top:r-40+`px`,right:n+`px`,color:p},children:[a&&(0,J.jsx)(Y1,{label:u,disabled:o===0,onClick:()=>{t.setZIndex(o-1)},children:(0,J.jsx)($,{name:c})}),a&&(0,J.jsx)(Y1,{label:d,disabled:o===e.pages.length-1,onClick:()=>{let n=e.pages.indexOf(t);t.setZIndex(n+1)},children:(0,J.jsx)($,{name:l})}),(0,J.jsx)(Y1,{label:Q(`workspace.duplicatePage`),onClick:()=>{t.clone()},children:(0,J.jsx)($,{name:`action.duplicate`})}),a&&(0,J.jsx)(Y1,{label:Q(`workspace.removePage`),onClick:()=>{e.deletePages([t.id])},children:(0,J.jsx)($,{name:`action.remove`})}),(0,J.jsx)(Y1,{label:Q(`workspace.addPage`),onClick:()=>{let n=e.addPage({bleed:e.activePage?.bleed||0,width:e.activePage?.width||`auto`,height:e.activePage?.height||`auto`}),r=e.pages.indexOf(t);n.setZIndex(r+1)},children:(0,J.jsx)($,{name:`action.add`})})]})}),X1=x.createContext(void 0);function Z1(e){let t=x.useContext(X1);if(t===void 0&&!e)throw Error(CK(47));return t}function zle(){return{...v$(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}var Ble={...T$,disabled:VQ(e=>e.disabled),instantType:VQ(e=>e.instantType),openMethod:VQ(e=>e.openMethod),openChangeReason:VQ(e=>e.openChangeReason),modal:VQ(e=>e.modal),focusManagerModal:VQ(e=>e.focusManagerModal),stickIfOpen:VQ(e=>e.stickIfOpen),titleElementId:VQ(e=>e.titleElementId),descriptionElementId:VQ(e=>e.descriptionElementId),openOnHover:VQ(e=>e.openOnHover),closeDelay:VQ(e=>e.closeDelay),hasViewport:VQ(e=>e.hasViewport)},Vle=class e extends XQ{constructor(e,t,n=!1){let r={...zle(),...e},i=new g$;r.open&&e?.mounted===void 0&&(r.mounted=!0),r.floatingRootContext=y$(i,t,n),super(r,{popupRef:x.createRef(),backdropRef:x.createRef(),internalBackdropRef:x.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:x.createRef(),beforeContentFocusGuardRef:x.createRef(),stickIfOpenTimeout:new kK,triggerElements:i},Ble)}setOpen=(e,t)=>{let n=t.reason===Jq,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null);t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)};let a=this.select(`activeTriggerId`);if(!e&&t.reason===`close-press`&&t.trigger==null&&a!=null&&(t.trigger=this.context.triggerElements.getById(a)??this.select(`activeTriggerElement`)??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let o=()=>{let n={open:e,openChangeReason:t.reason};u$(n,e,t.trigger),this.update(n)};n?(this.set(`stickIfOpen`,!0),this.context.stickIfOpenTimeout.start(500,()=>{this.set(`stickIfOpen`,!1)}),ia.flushSync(o)):o(),r||i?this.set(`instantType`,r?`click`:`dismiss`):t.reason===`focus-out`?this.set(`instantType`,`focus`):this.set(`instantType`,void 0)};static useStore(t,n){let{store:r,internalStore:i}=c$(t,(t,r)=>new e(n,t,r));return x.useEffect(()=>i?.disposeEffect(),[i]),r}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()};function Q1({props:e}){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,modal:o=!1,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=Vle.useStore(s?.store,{modal:o,open:r,openProp:n,activeTriggerId:l,triggerIdProp:c});bK(()=>{n===void 0&&u.state.open===!1&&r===!0&&u.update({open:!0,activeTriggerId:l})}),u.useControlledProp(`openProp`,n),u.useControlledProp(`triggerIdProp`,c);let d=u.useState(`open`),f=u.useState(`mounted`),p=u.useState(`payload`),m=lZ()!=null;u.useContextCallback(`onOpenChange`,i),u.useContextCallback(`onOpenChangeComplete`,a),h$(u,d),f$(u);let{forceUnmount:h}=p$(d,u,()=>{u.update({stickIfOpen:!0,openChangeReason:null})});u.useSyncedValues({modal:o,nested:m}),x.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]);let g=x.useCallback(()=>{u.setOpen(!1,pJ(dJ))},[u]);x.useImperativeHandle(e.actionsRef,()=>({unmount:h,close:g}),[h,g]);let _=d||f,v=x.useMemo(()=>({store:u}),[u]);return(0,J.jsxs)(X1.Provider,{value:v,children:[_&&(0,J.jsx)(Ule,{store:u,modal:o}),typeof t==`function`?t({payload:p}):t]})}function Hle(e){return Z1(!0)?(0,J.jsx)(Q1,{props:e}):(0,J.jsx)(pZ,{children:(0,J.jsx)(Q1,{props:e})})}function Ule({store:e,modal:t}){let n=jZ(e.useState(`floatingRootContext`),{outsidePressEvent:{mouse:t===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}});return m$(e,{activeTriggerProps:n.reference??Gq,inactiveTriggerProps:n.trigger??Gq,popupProps:x.useMemo(()=>kX(s$,n.floating),[n.floating])}),null}var $1=x.createContext(void 0);function e0(e=!1){let t=x.useContext($1);if(t===void 0&&!e)throw Error(CK(16));return t}function Wle(e){let{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=e,o=r&&t!==!1,s=r&&t===!1;return{props:x.useMemo(()=>{let e={onKeyDown(e){n&&t&&e.key!==`Tab`&&e.preventDefault()}};return r||(e.tabIndex=i,!a&&n&&(e.tabIndex=t?i:-1)),(a&&(t||o)||!a&&n)&&(e[`aria-disabled`]=n),a&&(!t||s)&&(e.disabled=n),e},[r,n,t,o,s,a,i])}}function t0(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=x.useRef(null),s=e0(!0),c=a??s!==void 0,{props:l}=Wle({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),u=x.useCallback(()=>{let e=o.current;n0(e)&&c&&t&&l.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,l.disabled,c]);return xK(u,[u]),{getButtonProps:x.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:s,...u}=e;return kX({onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(BX(e),o?.(e),e.baseUIHandlerPrevented))return;let r=e.target===e.currentTarget,a=e.currentTarget,s=n0(a),l=!i&&Gle(a),u=r&&(i?s:!l),d=e.key===`Enter`,f=e.key===` `,p=a.getAttribute(`role`),m=p?.startsWith(`menuitem`)||p===`option`||p===`gridcell`;if(r&&c&&f){if(e.defaultPrevented&&m)return;e.preventDefault(),l||i&&s?(a.click(),e.preventBaseUIHandler()):u&&(n?.(e),e.preventBaseUIHandler());return}u&&(!i&&(f||d)&&e.preventDefault(),!i&&d&&n?.(e))},onKeyUp(e){if(!t){if(BX(e),a?.(e),e.target===e.currentTarget&&i&&c&&n0(e.currentTarget)&&e.key===` `){e.preventDefault();return}e.baseUIHandlerPrevented||e.target===e.currentTarget&&!i&&!c&&e.key===` `&&n?.(e)}},onPointerDown(e){if(t){e.preventDefault();return}s?.(e)}},i?{type:`button`}:{role:`button`},l,u)},[t,l,c,i]),buttonRef:jJ(e=>{o.current=e,u()})}}function n0(e){return nq(e)&&e.tagName===`BUTTON`}function Gle(e){return!!(e?.tagName===`A`&&e?.href)}function r0(e,t){let n=x.useRef(null);function r(t){ia.flushSync(()=>{e.setOpen(!1,pJ(tJ,t.nativeEvent,t.currentTarget))}),XY(n.current)?.focus()}function i(n){let r=e.select(`positionerElement`);if(r&&ZY(n,r))e.context.beforeContentFocusGuardRef.current?.focus();else{ia.flushSync(()=>{e.setOpen(!1,pJ(tJ,n.nativeEvent,n.currentTarget))});let i=YY(e.context.triggerFocusTargetRef.current||t.current);for(;i!==null&&Oq(r,i);){let e=i;if(i=KY(i),i===e)break}i?.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}function Kle(e){let t=x.useRef(``),n=x.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:x.useCallback(n=>{if(n.detail===0){e(n,`keyboard`);return}`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``},[e]),onPointerDown:n}}function i0(e,t){let n=x.useRef(e),r=jJ(t);xK(()=>{n.current!==e&&r(n.current)},[e,r]),xK(()=>{n.current=e},[e])}function a0(e,t){let{onClick:n,onPointerDown:r}=Kle(jJ((n,r)=>{(typeof e==`function`?e():e)||t(r||(IK?`touch`:``))}));return x.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}function o0(e){let[t,n]=x.useState(null),r=a0(e,n);return i0(e,t=>{t&&!e&&n(null)}),x.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}var qle=x.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,handle:s,payload:c,openOnHover:l=!1,delay:u=300,closeDelay:d=0,id:f,...p}=e,m=Z1(!0),h=s?.store??m?.store;if(!h)throw Error(CK(74));let g=h1(f),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`triggerPopupId`,g),S=x.useRef(null),{registerTrigger:C,isMountedByThisTrigger:w}=d$(g,S,h,{payload:c,disabled:a,openOnHover:l,closeDelay:d}),T=h.useState(`openChangeReason`),E=h.useState(`stickIfOpen`),D=h.useState(`openMethod`),O=h.useState(`focusManagerModal`),k=L$(v,{enabled:v!=null&&l&&(D!==`touch`||T!==`trigger-press`),mouseOnly:!0,move:!1,handleClose:$$(),restMs:u,delay:{close:d},triggerElementRef:S,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),A=wZ(v,{enabled:v!=null,stickIfOpen:E}),j=a0(()=>h.select(`open`),e=>{h.set(`openMethod`,e)}),M=h.useState(`triggerProps`,w),{getButtonProps:N,buttonRef:P}=t0({disabled:a,native:o}),F={open(e){return e&&T===`trigger-press`?p1.open(e):f1.open(e)}},{preFocusGuardRef:I,handlePreFocusGuardFocus:L,handleFocusTargetFocus:ee}=r0(h,S),R=UX(`button`,e,{state:{disabled:a,open:y},ref:[P,t,C,S],props:[A.reference,k,M,j,{[XX]:``,id:g,"aria-haspopup":`dialog`,"aria-expanded":y,"aria-controls":b},p,N],stateAttributesMapping:F});return w&&!O?(0,J.jsxs)(x.Fragment,{children:[(0,J.jsx)(HJ,{ref:I,onFocus:L}),(0,J.jsx)(x.Fragment,{children:R},g),(0,J.jsx)(HJ,{ref:h.context.triggerFocusTargetRef,onFocus:ee})]}):(0,J.jsx)(x.Fragment,{children:R},g)}),s0=x.createContext(void 0);function Jle(){let e=x.useContext(s0);if(e===void 0)throw Error(CK(45));return e}var Yle=x.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=Z1();return i.useState(`mounted`)||n?(0,J.jsx)(s0.Provider,{value:n,children:(0,J.jsx)(iZ,{ref:t,...r})}):null}),c0=x.createContext(void 0);function Xle(){let e=x.useContext(c0);if(!e)throw Error(CK(46));return e}var l0=x.forwardRef(function(e,t){let{cutout:n,...r}=e,i;if(n){let e=n.getBoundingClientRect();i=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${e.left}px ${e.top}px,${e.left}px ${e.bottom}px,${e.right}px ${e.bottom}px,${e.right}px ${e.top}px,${e.left}px ${e.top}px)`}return(0,J.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})}),u0={},d0={},f0=``;function Zle(e){if(typeof document>`u`)return!1;let t=RJ(e);return QK(t).innerWidth-t.documentElement.clientWidth>0}function Qle(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=RJ(e),n=t.documentElement,r=t.body,i=iq(n)?n:r,a=i.style.overflowY,o=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,i.style.overflowY=`scroll`;let s=i.offsetWidth;i.style.overflowY=`hidden`;let c=i.offsetWidth;return i.style.overflowY=a,n.style.scrollbarGutter=o,s===c}function $le(e){let t=RJ(e),n=t.documentElement,r=t.body,i=iq(n)?n:r,a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(i.style,a)}}function eue(e){let t=RJ(e),n=t.documentElement,r=t.body,i=QK(n),a=0,o=0,s=!1,c=IJ.create();if(FK&&(i.visualViewport?.scale??1)!==1)return()=>{};function l(){let t=i.getComputedStyle(n),c=i.getComputedStyle(r),l=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;a=n.scrollTop,o=n.scrollLeft,u0={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},f0=n.style.scrollBehavior,d0={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};let u=n.scrollHeight>n.clientHeight,d=n.scrollWidth>n.clientWidth,f=t.overflowY===`scroll`||c.overflowY===`scroll`,p=t.overflowX===`scroll`||c.overflowX===`scroll`,m=Math.max(0,i.innerWidth-r.clientWidth),h=Math.max(0,i.innerHeight-r.clientHeight),g=parseFloat(c.marginTop)+parseFloat(c.marginBottom),_=parseFloat(c.marginLeft)+parseFloat(c.marginRight),v=iq(n)?n:r;if(s=Qle(e),s){n.style.scrollbarGutter=l,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`;return}Object.assign(n.style,{scrollbarGutter:l,overflowY:`hidden`,overflowX:`hidden`}),(u||f)&&(n.style.overflowY=`scroll`),(d||p)&&(n.style.overflowX=`scroll`),Object.assign(r.style,{position:`relative`,height:g||h?`calc(100dvh - ${g+h}px)`:`100dvh`,width:_||m?`calc(100vw - ${_+m}px)`:`100vw`,boxSizing:`border-box`,overflow:`hidden`,scrollBehavior:`unset`}),r.scrollTop=a,r.scrollLeft=o,n.setAttribute(`data-base-ui-scroll-locked`,``),n.style.scrollBehavior=`unset`}function u(){Object.assign(n.style,u0),Object.assign(r.style,d0),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=f0)}function d(){u(),c.request(l)}l();let f=vJ(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var tue=new class{lockCount=0;restore=null;timeoutLock=kK.create();timeoutUnlock=kK.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(this.lockCount===0||this.restore!==null)return;let t=RJ(e).documentElement,n=QK(t).getComputedStyle(t).overflowY;if(n===`hidden`||n===`clip`){this.restore=Uq;return}let r=IK||!Zle(e);this.restore=r?$le(e):eue(e)}};function p0(e=!0,t=null){xK(()=>{if(e)return tue.acquire(t)},[e,t])}var nue=20;function m0(e,t,n,r){let[i,a]=x.useState(!1);xK(()=>{if(!e||!t||n==null){a(!1);return}let r=RJ(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-nue)},[e,t,n]),p0(e&&(!t||i),r)}var rue=x.forwardRef(function(e,t){let{render:n,className:r,style:i,anchor:a,positionMethod:o=`absolute`,side:s=`bottom`,align:c=`center`,sideOffset:l=0,alignOffset:u=0,collisionBoundary:d=`clipping-ancestors`,collisionPadding:f=5,arrowPadding:p=5,sticky:m=!1,disableAnchorTracking:h=!1,collisionAvoidance:g=QX,..._}=e,{store:v}=Z1(),y=Jle(),b=dZ(),S=v.useState(`floatingRootContext`),C=v.useState(`mounted`),w=v.useState(`open`),T=v.useState(`openChangeReason`),E=v.useState(`activeTriggerElement`),D=v.useState(`modal`),O=v.useState(`openMethod`),k=v.useState(`positionerElement`),A=v.useState(`instantType`),j=v.useState(`transitionStatus`),M=v.useState(`hasViewport`),N=x.useRef(null),P=a$(k,!1,!1),F=P1({anchor:a,floatingRootContext:S,positionMethod:o,mounted:C,side:s,sideOffset:l,align:c,alignOffset:u,arrowPadding:p,collisionBoundary:d,collisionPadding:f,sticky:m,disableAnchorTracking:h,keepMounted:y,nodeId:b,collisionAvoidance:g,adaptiveOrigin:M?j1:void 0}),I=S.useState(`domReferenceElement`);xK(()=>{let e=I,t=N.current;if(e&&(N.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return P(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[I,P,v]),m0(w&&D===!0&&T!==`trigger-hover`,O===`touch`,k,E);let L=x.useCallback(e=>{v.set(`positionerElement`,e)},[v]),ee=L1(e,{open:w,side:F.side,align:F.align,anchorHidden:F.anchorHidden,instant:A},{styles:F.positionerStyles,transitionStatus:j,props:_,refs:[t,L],hidden:!C,inert:!w});return(0,J.jsxs)(c0.Provider,{value:F,children:[C&&D===!0&&T!==`trigger-hover`&&(0,J.jsx)(l0,{ref:v.context.internalBackdropRef,inert:z1(!w),cutout:E}),(0,J.jsx)(fZ,{id:b,children:ee})]})}),h0=`ArrowUp`,g0=`ArrowDown`,_0=`ArrowLeft`,v0=`ArrowRight`,y0=`Home`,b0=`PageUp`,x0=`PageDown`,S0=new Set([_0,v0]),iue=new Set([_0,v0,y0,`End`]),C0=new Set([h0,g0]),aue=new Set([h0,g0,y0,`End`]),w0=new Set([...S0,...C0]),T0=new Set([...w0,y0,`End`]),oue=new Set([`Shift`,`Control`,`Alt`,`Meta`]);function sue(e){return nq(e)&&e.tagName===`INPUT`}function E0(e){return!!(sue(e)&&e.selectionStart!=null||nq(e)&&e.tagName===`TEXTAREA`)}function D0(e,t,n,r){if(!e||!t||!t.scrollTo)return;let i=e.scrollLeft,a=e.scrollTop,o=e.clientWidth<e.scrollWidth,s=e.clientHeight<e.scrollHeight;if(o&&r!==`vertical`){let r=O0(e,t,`left`),a=k0(e),o=k0(t);n===`ltr`&&(r+t.offsetWidth+o.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight?i=r+t.offsetWidth+o.scrollMarginRight-e.clientWidth+a.scrollPaddingRight:r-o.scrollMarginLeft<e.scrollLeft+a.scrollPaddingLeft&&(i=r-o.scrollMarginLeft-a.scrollPaddingLeft)),n===`rtl`&&(r-o.scrollMarginRight<e.scrollLeft+a.scrollPaddingLeft?i=r-o.scrollMarginLeft-a.scrollPaddingLeft:r+t.offsetWidth+o.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight&&(i=r+t.offsetWidth+o.scrollMarginRight-e.clientWidth+a.scrollPaddingRight))}if(s&&r!==`horizontal`){let n=O0(e,t,`top`),r=k0(e),i=k0(t);n-i.scrollMarginTop<e.scrollTop+r.scrollPaddingTop?a=n-i.scrollMarginTop-r.scrollPaddingTop:n+t.offsetHeight+i.scrollMarginBottom>e.scrollTop+e.clientHeight-r.scrollPaddingBottom&&(a=n+t.offsetHeight+i.scrollMarginBottom-e.clientHeight+r.scrollPaddingBottom)}e.scrollTo({left:i,top:a,behavior:`auto`})}function O0(e,t,n){let r=n===`left`?`offsetLeft`:`offsetTop`,i=0;for(;t.offsetParent&&(i+=t[r],t.offsetParent!==e);)t=t.offsetParent;return i}function k0(e){let t=getComputedStyle(e);return{scrollMarginTop:parseFloat(t.scrollMarginTop)||0,scrollMarginRight:parseFloat(t.scrollMarginRight)||0,scrollMarginBottom:parseFloat(t.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(t.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(t.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(t.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(t.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(t.scrollPaddingLeft)||0}}var cue=x.createContext(void 0);function A0(e){let t=x.useContext(cue);if(t===void 0&&!e)throw Error(CK(69));return t}var lue=x.createContext(void 0);function uue(){let[e,t]=x.useState(0),n=jJ(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:x.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}function due(e){let{value:t,children:n}=e;return(0,J.jsx)(lue.Provider,{value:t,children:n})}var fue={...m1,...i$},pue=x.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...s}=e,{store:c}=Z1(),l=Xle(),u=A0(!0)!=null,{context:d,hasClosePart:f}=uue(),p=c.useState(`open`),m=c.useState(`openMethod`),h=c.useState(`instantType`),g=c.useState(`transitionStatus`),_=c.useState(`popupProps`),v=c.useState(`titleElementId`),y=c.useState(`descriptionElementId`),b=c.useState(`modal`),S=c.useState(`mounted`),C=c.useState(`openChangeReason`),w=c.useState(`activeTriggerElement`),T=c.useState(`floatingRootContext`),E=T.useState(`floatingId`),D=c.useState(`disabled`),O=c.useState(`openOnHover`),k=c.useState(`closeDelay`),A=s.id??E;o$({open:p,ref:c.context.popupRef,onComplete(){p&&c.context.onOpenChangeComplete?.(!0)}}),F$(T,{enabled:O&&!D,closeDelay:k});function j(e){return e===`touch`?c.context.popupRef.current:!0}let M=a===void 0?j:a,N=b!==!1&&f;c.useSyncedValue(`focusManagerModal`,N);let P=x.useCallback(e=>{c.set(`popupElement`,e)},[c]),F=UX(`div`,e,{state:{open:p,side:l.side,align:l.align,instant:h,transitionStatus:g},ref:[t,c.context.popupRef,P],props:[_,{id:A,role:`dialog`,...s$,"aria-labelledby":v,"aria-describedby":y,onKeyDown(e){u&&T0.has(e.key)&&e.stopPropagation()}},I1(g),s],stateAttributesMapping:fue});return(0,J.jsx)(CZ,{context:T,openInteractionType:m,modal:N,disabled:!S||C===`trigger-hover`,initialFocus:M,returnFocus:o,restoreFocus:`popup`,previousFocusableElement:nq(w)?w:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:(0,J.jsx)(due,{value:d,children:F})})});function j0({...e}){return(0,J.jsx)(Hle,{"data-slot":`popover`,...e})}function M0({...e}){return(0,J.jsx)(qle,{"data-slot":`popover-trigger`,...e})}var N0=x.forwardRef(({className:e,side:t,align:n=`center`,sideOffset:r=4,alignOffset:i,...a},o)=>{let{container:s,className:c,...l}=W1();return(0,J.jsx)(Yle,{container:s,children:(0,J.jsx)(rue,{side:t,align:n,sideOffset:r,alignOffset:i,positionMethod:`fixed`,className:`pn:z-50`,children:(0,J.jsx)(pue,{ref:o,"data-slot":`popover-content`,...l,className:rK(c,`pn:z-50 pn:w-72 origin-(--transform-origin) pn:rounded-md pn:border pn:bg-popover pn:p-4 pn:text-popover-foreground pn:shadow-md pn:outline-hidden pn:data-[side=bottom]:slide-in-from-top-2 pn:data-[side=left]:slide-in-from-right-2 pn:data-[side=right]:slide-in-from-left-2 pn:data-[side=top]:slide-in-from-bottom-2 pn:data-[closed]:animate-out pn:data-[closed]:fade-out-0 pn:data-[closed]:zoom-out-95 pn:data-[open]:animate-in pn:data-[open]:fade-in-0 pn:data-[open]:zoom-in-95`,e),...a})})})});N0.displayName=`PopoverContent`;var mue=({items:e,itemRender:t,overflowBtnWidth:n=40,gap:r=0})=>{let i=x.useRef(null),a=x.useRef(null),[o,s]=x.useState(e.length),c=x.useCallback(()=>{let t=i.current,o=a.current;if(!t||!o)return;let c=t.offsetWidth,l=Array.from(o.children).filter(e=>!e.dataset.overflow).map(e=>e.offsetWidth);if(l.reduce((e,t)=>e+t,0)+r*Math.max(0,l.length-1)<=c){s(e.length);return}let u=Math.max(0,c-n-r),d=0,f=0;for(let e of l){let t=d===0?e:d+r+e;if(t>u)break;d=t,f++}s(f)},[e.length,n,r]);x.useLayoutEffect(()=>{c()}),x.useLayoutEffect(()=>{let e=i.current;if(e&&window.ResizeObserver){let t=new ResizeObserver(c);return t.observe(e),()=>t.disconnect()}},[c]);let l=e.slice(0,o),u=e.slice(o);return(0,J.jsxs)(`div`,{ref:i,className:`pn:flex pn:w-full pn:items-center`,style:{gap:r},children:[l.map(e=>(0,J.jsx)(x.Fragment,{children:t(e)},e)),u.length>0&&(0,J.jsxs)(j0,{children:[(0,J.jsx)(M0,{render:(0,J.jsx)(uK,{variant:`ghost`,size:`icon-sm`,"aria-label":`More`,onMouseDownCapture:e=>{e.preventDefault()},children:(0,J.jsx)(vU,{className:`pn:size-4`})})}),(0,J.jsx)(N0,{side:`bottom`,className:`pn:w-auto pn:p-2.5`,initialFocus:!1,children:(0,J.jsx)(`div`,{style:{display:`flex`,gap:r},children:u.map(e=>(0,J.jsx)(x.Fragment,{children:t(e)},e))})})]}),(0,J.jsxs)(`div`,{ref:a,"aria-hidden":!0,className:`pn:pointer-events-none pn:absolute pn:-z-10 pn:flex pn:items-center pn:opacity-0`,style:{left:0,top:0,gap:r},children:[e.map(e=>(0,J.jsx)(x.Fragment,{children:t(e)},e)),(0,J.jsx)(uK,{variant:`ghost`,size:`icon-sm`,"data-overflow":`true`,children:(0,J.jsx)(vU,{className:`pn:size-4`})})]})]})},hue=6,P0=({type:e,usedItems:t,components:n})=>{let r=[];return Object.keys(n||{}).forEach(i=>{if(i.toLowerCase().indexOf(e)===0&&i.toLowerCase()!==e){if(!n[i]){console.error(`Polotno error: Toolbar has invalid React component "${i}"`);return}t.includes(i)||r.push(i)}}),t.filter(e=>!!e).concat(r)},F0=({items:e,itemRender:t})=>{let[n,r]=x.useState(0),i=x.useRef(null),a=()=>{if(i.current===null)return;let e=i.current.parentElement,t=0;e&&(Array.from(e.children).forEach(e=>{e!==i.current&&(t+=e.offsetWidth)}),r(Math.max(44,e.offsetWidth-t-10)))};return x.useLayoutEffect(()=>{a()}),x.useLayoutEffect(()=>{let e=i.current.parentElement,t=e?.parentElement;if(window.ResizeObserver){let n=new ResizeObserver(a);e&&n.observe(e),t&&n.observe(t);let r=new MutationObserver(a);return e&&r.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`style`,`class`]}),()=>{n.disconnect(),r.disconnect()}}else{let e=setInterval(a,100);return()=>clearInterval(e)}},[]),(0,J.jsx)(`div`,{style:{width:n+`px`},ref:i,className:`pn-element-container pn:flex pn:items-center pn:max-md:!w-auto pn:pn-mobile:!w-auto`,children:(0,J.jsx)(mue,{items:e,itemRender:t,gap:hue})})},I0=x.forwardRef(({className:e,...t},n)=>(0,J.jsx)(jU,{ref:n,role:`status`,"aria-label":`Loading`,className:rK(`pn:size-4 pn:animate-spin`,e),...t}));I0.displayName=`Spinner`;var L0=x.forwardRef(({className:e,...t},n)=>(0,J.jsx)(`textarea`,{ref:n,"data-slot":`textarea`,className:rK(`pn:flex pn:field-sizing-content pn:min-h-16 pn:w-full pn:rounded-md pn:border pn:border-input pn:bg-transparent pn:px-3 pn:py-2 pn:text-base pn:shadow-xs pn:transition-[color,box-shadow] pn:outline-none pn:placeholder:text-muted-foreground pn:focus-visible:border-ring pn:focus-visible:ring-[3px] pn:focus-visible:ring-ring/50 pn:disabled:cursor-not-allowed pn:disabled:opacity-50 pn:aria-invalid:border-destructive pn:aria-invalid:ring-destructive/20 pn:md:text-sm pn:dark:bg-input/30 pn:dark:aria-invalid:ring-destructive/40`,e),...t}));L0.displayName=`Textarea`;var R0=x.createContext(!1),z0=x.createContext(void 0);function B0(e){let t=x.useContext(z0);if(e===!1&&t===void 0)throw Error(CK(27));return t}var gue={...m1,...i$},_ue=x.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,{store:s}=B0(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`);return UX(`div`,e,{state:{open:c,transitionStatus:s.useState(`transitionStatus`)},ref:[s.context.backdropRef,t],stateAttributesMapping:gue,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})}),V0=x.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,...s}=e,{store:c}=B0(),l=c.useState(`open`),{getButtonProps:u,buttonRef:d}=t0({disabled:a,native:o}),f={disabled:a};function p(e){l&&c.setOpen(!1,pJ(Qq,e.nativeEvent))}return UX(`button`,e,{state:f,ref:[t,d],props:[{onClick:p},s,u]})}),vue=x.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{store:s}=B0(),c=h1(a);return s.useSyncedValueWithCleanup(`descriptionElementId`,c),UX(`p`,e,{ref:t,props:[{id:c},o]})}),yue=function(e){return e.nestedDialogs=`--nested-dialogs`,e}({}),bue=function(e){return e[e.open=a1.open]=`open`,e[e.closed=a1.closed]=`closed`,e[e.startingStyle=a1.startingStyle]=`startingStyle`,e[e.endingStyle=a1.endingStyle]=`endingStyle`,e.nested=`data-nested`,e.nestedDialogOpen=`data-nested-dialog-open`,e}({}),H0=x.createContext(void 0);function xue(){let e=x.useContext(H0);if(e===void 0)throw Error(CK(26));return e}var Sue={...m1,...i$,nestedDialogOpen(e){return e?{[bue.nestedDialogOpen]:``}:null}},Cue=x.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,initialFocus:o,...s}=e,{store:c}=B0(),l=c.useState(`descriptionElementId`),u=c.useState(`disablePointerDismissal`),d=c.useState(`floatingRootContext`),f=c.useState(`popupProps`),p=c.useState(`modal`),m=c.useState(`mounted`),h=c.useState(`nested`),g=c.useState(`nestedOpenDialogCount`),_=c.useState(`open`),v=c.useState(`openMethod`),y=c.useState(`titleElementId`),b=c.useState(`transitionStatus`),x=c.useState(`role`),S=d.useState(`floatingId`),C=s.id??S;xue(),o$({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});function w(e){return e===`touch`?c.context.popupRef.current:!0}let T=o===void 0?w:o,E=g>0,D=c.useStateSetter(`popupElement`),O=UX(`div`,e,{state:{open:_,nested:h,transitionStatus:b,nestedDialogOpen:E},props:[f,{id:C,"aria-labelledby":y??void 0,"aria-describedby":l??void 0,role:x,...s$,hidden:!m,onKeyDown(e){T0.has(e.key)&&e.stopPropagation()},style:{[yue.nestedDialogs]:g}},s],ref:[t,c.context.popupRef,D],stateAttributesMapping:Sue});return(0,J.jsx)(CZ,{context:d,openInteractionType:v,disabled:!m,closeOnFocusOut:!u,initialFocus:T,returnFocus:a,modal:p!==!1,restoreFocus:`popup`,children:O})}),wue=x.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=B0(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,J.jsx)(H0.Provider,{value:n,children:(0,J.jsxs)(iZ,{ref:t,...r,children:[a&&o===!0&&(0,J.jsx)(l0,{ref:i.context.internalBackdropRef,inert:z1(!s)}),e.children]})}):null});function Tue(e){let{store:t,parentContext:n,actionsRef:r,isDrawer:i}=e,a=t.useState(`open`);h$(t,a),f$(t);let{forceUnmount:o}=p$(a,t),s=x.useCallback(()=>{t.setOpen(!1,pJ(dJ))},[t]);return x.useImperativeHandle(r,()=>({unmount:o,close:s}),[o,s]),{parentContext:n,isDrawer:i}}function Eue({store:e,dialogRoot:t}){let{parentContext:n,isDrawer:r}=t,i=e.useState(`open`),a=e.useState(`disablePointerDismissal`),o=e.useState(`modal`),s=e.useState(`popupElement`),c=e.useState(`floatingRootContext`),[l,u]=x.useState(0),[d,f]=x.useState(0),p=l===0,m=jZ(c,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?`intentional`:{mouse:o===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(t){if(!e.context.outsidePressEnabledRef.current||`button`in t&&t.button!==0||`touches`in t&&t.touches.length!==1)return!1;let n=kq(t);if(p&&!a){let t=n;return o&&(e.context.internalBackdropRef.current||e.context.backdropRef.current)?e.context.internalBackdropRef.current===t||e.context.backdropRef.current===t||Oq(t,s)&&!t?.hasAttribute(`data-base-ui-portal`):!0}return!1},escapeKey:p});return p0(i&&o===!0,s),e.useContextCallback(`onNestedDialogOpen`,(e,t)=>{u(e),f(t)}),e.useContextCallback(`onNestedDialogClose`,()=>{u(0),f(0)}),x.useEffect(()=>(n?.onNestedDialogOpen&&i&&n.onNestedDialogOpen(l+1,d+ +!!r),n?.onNestedDialogClose&&!i&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&i&&n.onNestedDialogClose()}),[r,i,l,d,n]),m$(e,{activeTriggerProps:m.reference??Gq,inactiveTriggerProps:m.trigger??Gq,popupProps:x.useMemo(()=>kX(s$,m.floating),[m.floating]),nestedOpenDialogCount:l,nestedOpenDrawerCount:d}),null}var Due={...T$,modal:VQ(e=>e.modal),nested:VQ(e=>e.nested),nestedOpenDialogCount:VQ(e=>e.nestedOpenDialogCount),nestedOpenDrawerCount:VQ(e=>e.nestedOpenDrawerCount),disablePointerDismissal:VQ(e=>e.disablePointerDismissal),openMethod:VQ(e=>e.openMethod),descriptionElementId:VQ(e=>e.descriptionElementId),titleElementId:VQ(e=>e.titleElementId),viewportElement:VQ(e=>e.viewportElement),role:VQ(e=>e.role)},Oue=class e extends XQ{constructor(e,t,n=!1){let r=new g$,i=kue(e);i.floatingRootContext=y$(r,t,n),super(i,{popupRef:x.createRef(),backdropRef:x.createRef(),internalBackdropRef:x.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:r,onOpenChange:void 0,onOpenChangeComplete:void 0},Due)}setOpen=(e,t)=>{if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let n={open:e};u$(n,e,t.trigger),this.update(n)};static useStore(t,n){return c$(t,(t,r)=>new e(n,t,r),!0).store}};function kue(e={}){return{...v$(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:`dialog`,...e}}function Aue(e,t=`dialog`){let{children:n,open:r,defaultOpen:i=!1,onOpenChange:a,onOpenChangeComplete:o,disablePointerDismissal:s=!1,modal:c=!0,actionsRef:l,handle:u,triggerId:d,defaultTriggerId:f=null}=e,p=t===`drawer`,m=t===`alert-dialog`,h=m?!0:c,g=m||s,_=m?`alertdialog`:`dialog`,v=B0(!0),y={modal:h,disablePointerDismissal:g,nested:!!v,role:_},b=Oue.useStore(u?.store,{open:i,openProp:r,activeTriggerId:f,triggerIdProp:d,...y});bK(()=>{let e=r===void 0&&b.state.open===!1&&i===!0?{open:!0,activeTriggerId:f}:null;m?b.update(e?{...y,...e}:y):e&&b.update(e)}),b.useControlledProp(`openProp`,r),b.useControlledProp(`triggerIdProp`,d),b.useSyncedValues(y),b.useContextCallback(`onOpenChange`,a),b.useContextCallback(`onOpenChangeComplete`,o);let S=b.useState(`open`),C=b.useState(`mounted`),w=b.useState(`payload`),T=Tue({store:b,actionsRef:l,parentContext:v?.store.context,isDrawer:p}),E=S||C,D=x.useMemo(()=>({store:b}),[b]);return(0,J.jsx)(R0.Provider,{value:!1,children:(0,J.jsxs)(z0.Provider,{value:D,children:[E&&(0,J.jsx)(Eue,{store:b,dialogRoot:T}),typeof n==`function`?n({payload:w}):n]})})}function jue(e){return Aue(e,x.useContext(R0)?`drawer`:`dialog`)}var Mue=x.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{store:s}=B0(),c=h1(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),UX(`h2`,e,{ref:t,props:[{id:c},o]})});function U0({...e}){return(0,J.jsx)(jue,{"data-slot":`dialog`,...e})}function Nue({...e}){return(0,J.jsx)(wue,{"data-slot":`dialog-portal`,...e})}var W0=x.forwardRef(({className:e,...t},n)=>(0,J.jsx)(_ue,{ref:n,"data-slot":`dialog-overlay`,className:rK(`pn:fixed pn:inset-0 pn:z-50 pn:bg-black/50 pn:data-[closed]:animate-out pn:data-[closed]:fade-out-0 pn:data-[open]:animate-in pn:data-[open]:fade-in-0`,e),...t}));W0.displayName=`DialogOverlay`;var G0=x.forwardRef(({className:e,children:t,showCloseButton:n=!0,...r},i)=>{let{container:a,className:o,...s}=W1();return(0,J.jsxs)(Nue,{container:a,children:[(0,J.jsx)(W0,{}),(0,J.jsxs)(Cue,{ref:i,"data-slot":`dialog-content`,...s,className:rK(o,`pn:fixed pn:top-[50%] pn:left-[50%] pn:z-50 pn:grid pn:w-full pn:max-w-[calc(100%-2rem)] pn:translate-x-[-50%] pn:translate-y-[-50%] pn:gap-4 pn:rounded-lg pn:border pn:bg-background pn:p-6 pn:shadow-lg pn:duration-200 pn:outline-none pn:data-[closed]:animate-out pn:data-[closed]:fade-out-0 pn:data-[closed]:zoom-out-95 pn:data-[open]:animate-in pn:data-[open]:fade-in-0 pn:data-[open]:zoom-in-95 pn:sm:max-w-lg`,e),...r,children:[t,n&&(0,J.jsxs)(V0,{"data-slot":`dialog-close`,className:`pn:absolute pn:top-4 pn:right-4 pn:rounded-xs pn:opacity-70 pn:ring-offset-background pn:transition-opacity pn:hover:opacity-100 pn:focus:ring-2 pn:focus:ring-ring pn:focus:ring-offset-2 pn:focus:outline-hidden pn:disabled:pointer-events-none pn:[&_svg]:pointer-events-none pn:[&_svg]:shrink-0 pn:[&_svg:not([class*='size-'])]:size-4`,children:[(0,J.jsx)(mW,{}),(0,J.jsx)(`span`,{className:`pn:sr-only`,children:`Close`})]})]})]})});G0.displayName=`DialogContent`;var K0=x.forwardRef(({className:e,...t},n)=>(0,J.jsx)(`div`,{ref:n,"data-slot":`dialog-header`,className:rK(`pn:flex pn:flex-col pn:gap-2 pn:text-center pn:sm:text-left`,e),...t}));K0.displayName=`DialogHeader`;var q0=x.forwardRef(({className:e,showCloseButton:t=!1,children:n,...r},i)=>(0,J.jsxs)(`div`,{ref:i,"data-slot":`dialog-footer`,className:rK(`pn:flex pn:flex-col-reverse pn:gap-2 pn:sm:flex-row pn:sm:justify-end`,e),...r,children:[n,t&&(0,J.jsx)(V0,{render:(0,J.jsx)(uK,{variant:`outline`}),children:`Close`})]}));q0.displayName=`DialogFooter`;var J0=x.forwardRef(({className:e,...t},n)=>(0,J.jsx)(Mue,{ref:n,"data-slot":`dialog-title`,className:rK(`pn:text-lg pn:leading-none pn:font-semibold`,e),...t}));J0.displayName=`DialogTitle`;var Pue=x.forwardRef(({className:e,...t},n)=>(0,J.jsx)(vue,{ref:n,"data-slot":`dialog-description`,className:rK(`pn:text-sm pn:text-muted-foreground`,e),...t}));Pue.displayName=`DialogDescription`;var Y0=async({text:e=``,command:t,tone:n})=>{try{let r=await fetch(Zg.aiText(),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({text:e,command:t,tone:n})});if(!r.ok){let e=await r.text();throw console.error(e),Error(`Failed to rewrite text`)}return(await r.json()).response}catch(t){return console.error(t),e}},Fue=[{text:`friendly`},{text:`professional`},{text:`humorous`},{text:`formal`}],X0=W(({store:e})=>{let t=e.selectedElements.length>0,[n,r]=x.useState(!1),[i,a]=x.useState(!1),[o,s]=x.useState(1),[c,l]=x.useState(``),[u,d]=x.useState(``),[f,p]=x.useState(!1),m=x.useRef(null),h=e.selectedElements.some(e=>!e.contentEditable);x.useEffect(()=>{i&&o===1&&setTimeout(()=>{m.current?.focus()},100)},[i,o]);let g=async(t,n)=>{r(!0);let i=e.selectedElements[0].id,a=e.selectedElements[0].text,o=await Y0({text:a,command:t,tone:n}),s=e.getElementById(i);s&&(s.set({text:o}),r(!1))},_=async()=>{p(!0),d(await Y0({command:`custom`,text:e.selectedElements[0].text,tone:c})),p(!1),s(2)},v=()=>{let t=e.selectedElements[0].id,n=e.getElementById(t);n&&n.set({text:u}),a(!1),s(1),l(``),d(``)};if(h)return null;if(n)return(0,J.jsxs)(uK,{variant:`ghost`,size:`sm`,disabled:!0,children:[(0,J.jsx)(I0,{}),`AI write`]});let y=rK(`pn:flex pn:w-full pn:cursor-default pn:items-center pn:rounded-none pn:px-2 pn:py-1.5 pn:text-left pn:text-xs pn:outline-hidden pn:hover:bg-accent pn:hover:text-accent-foreground pn:disabled:pointer-events-none pn:disabled:opacity-50`);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(j0,{children:[(0,J.jsx)(M0,{disabled:!t,render:(0,J.jsxs)(uK,{variant:`ghost`,size:`sm`,disabled:!t,children:[(0,J.jsx)($,{name:`toolbar.aiWrite`,className:`pn:size-4`}),Q(`toolbar.aiText.aiWrite`)]})}),(0,J.jsxs)(N0,{className:`pn:w-48 pn:p-1`,align:`start`,children:[(0,J.jsx)(`button`,{type:`button`,className:y,onClick:()=>{g(`rewrite`)},children:Q(`toolbar.aiText.rewrite`)}),(0,J.jsx)(`button`,{type:`button`,className:y,onClick:()=>{g(`shorten`)},children:Q(`toolbar.aiText.shorten`)}),(0,J.jsx)(`button`,{type:`button`,className:y,onClick:()=>{g(`continue`)},children:Q(`toolbar.aiText.continue`)}),(0,J.jsx)(`button`,{type:`button`,className:y,onClick:()=>{g(`proofread`)},children:Q(`toolbar.aiText.proofread`)}),(0,J.jsx)(`div`,{className:`pn:px-2 pn:pt-2 pn:pb-1 pn:text-xs pn:font-medium pn:text-muted-foreground`,children:Q(`toolbar.aiText.tones`)}),Fue.map(e=>(0,J.jsx)(`button`,{type:`button`,className:y,onClick:()=>{g(`tone`,e.text)},children:Q(`toolbar.aiText.${e.text}`)},e.text)),(0,J.jsx)(`div`,{className:`pn:my-1 pn:h-px pn:bg-border`}),(0,J.jsx)(`button`,{type:`button`,className:y,onClick:e=>{e.preventDefault(),e.stopPropagation(),a(!0)},children:Q(`toolbar.aiText.customPrompt`)})]})]}),(0,J.jsx)(U0,{open:i,onOpenChange:e=>{!e&&!f&&(a(!1),s(1),l(``),d(``))},children:(0,J.jsxs)(G0,{children:[(0,J.jsx)(K0,{children:(0,J.jsx)(J0,{children:Q(o===1?`toolbar.aiText.customPrompt`:`toolbar.aiText.generatedResult`)})}),o===1?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(L0,{ref:m,value:c,onChange:e=>l(e.target.value),placeholder:Q(`toolbar.aiText.promptPlaceholder`),disabled:f,style:{minHeight:100}}),(0,J.jsxs)(q0,{children:[(0,J.jsx)(uK,{variant:`outline`,onClick:()=>a(!1),disabled:f,children:Q(`toolbar.aiText.cancel`)}),(0,J.jsxs)(uK,{onClick:_,disabled:!c||f,children:[f&&(0,J.jsx)(I0,{}),Q(`toolbar.aiText.generate`)]})]})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(L0,{value:u,onChange:e=>d(e.target.value),style:{minHeight:100}}),(0,J.jsxs)(q0,{children:[(0,J.jsx)(uK,{variant:`outline`,onClick:()=>s(1),disabled:f,children:Q(`toolbar.aiText.back`)}),(0,J.jsxs)(uK,{variant:`outline`,onClick:_,disabled:f,children:[f&&(0,J.jsx)(I0,{}),Q(`toolbar.aiText.tryAgain`)]}),(0,J.jsx)(uK,{onClick:v,disabled:f,children:Q(`toolbar.aiText.insert`)})]})]})]})})]})}),Z0=({store:e})=>{let t=e.selectedElements.length>0,n=e.selectedElements.every(e=>e.removable===!1),r=!t||n;return{duplicate:(0,x.useCallback)(()=>{GV(e.selectedElements,e)},[e]),disabled:r}},Q0=W(({store:e})=>{let{disabled:t,duplicate:n}=Z0({store:e});return(0,J.jsx)(Y1,{label:Q(`toolbar.duplicateElements`),side:`bottom`,hideTooltipWhenDisabled:!0,disabled:t,onClick:()=>n(),children:(0,J.jsx)($,{name:`action.duplicate`,className:`pn:size-4`})})}),$0=({store:e})=>{let t=e.selectedElements.filter(e=>e.removable),n=(0,x.useCallback)(()=>{e.deleteElements(t.map(e=>e.id))},[e,t]);return{disabled:!t.length,remove:n}},e2=W(({store:e})=>{let{disabled:t,remove:n}=$0({store:e});return(0,J.jsx)(Y1,{label:Q(`toolbar.removeElements`),side:`bottom`,hideTooltipWhenDisabled:!0,disabled:t,onClick:()=>n(),style:{marginLeft:`auto`},children:(0,J.jsx)($,{name:`action.remove`,className:`pn:size-4`})})}),t2=e=>{if(e.type!==`group`)return Db(e);let t=1/0,n=1/0,r=-1/0,i=-1/0;return e.children.forEach(e=>{let a=t2(e);t=Math.min(t,a.x),n=Math.min(n,a.y),r=Math.max(r,a.x+a.width),i=Math.max(i,a.y+a.height)}),{x:t,y:n,width:r-t,height:i-n}},n2=(e,t,n)=>{if(e.type!==`group`){let r=Db(e),i=t-r.x,a=n-r.y;e.set({x:e.x+i,y:e.y+a})}else{let r=t-t2(e).x,i=n-t2(e).y;e.children.forEach(e=>{let t=t2(e);n2(e,t.x+r,t.y+i)})}},r2=({icon:e,text:t,disabled:n,onClick:r})=>(0,J.jsxs)(`button`,{type:`button`,disabled:n,onClick:r,className:`pn:flex pn:w-full pn:appearance-none pn:cursor-pointer pn:items-center pn:gap-2 pn:rounded-none pn:border-0 pn:bg-transparent pn:px-[7px] pn:py-[5px] pn:text-left pn:text-sm pn:outline-hidden pn:hover:bg-accent pn:hover:text-accent-foreground pn:disabled:pointer-events-none pn:disabled:cursor-default pn:disabled:opacity-50 pn:[&_svg]:size-4 pn:[&_svg]:shrink-0`,children:[e,(0,J.jsx)(`span`,{children:t})]}),i2=({title:e})=>(0,J.jsx)(`div`,{className:`pn:-mx-1 pn:mt-1 pn:border-t pn:border-border pn:pt-2 pn:pb-1 pn:px-2 pn:text-xs pn:font-semibold pn:text-foreground pn:first:mt-0 pn:first:border-t-0 pn:first:pt-1`,children:e}),a2=W(({store:e})=>{let t=e.selectedElements.length>0,n=e.selectedElements.every(e=>e.draggable),r=n&&e.selectedElements.length>1;return(0,J.jsxs)(j0,{children:[(0,J.jsx)(M0,{disabled:!t,render:(0,J.jsxs)(uK,{variant:`ghost`,size:`sm`,className:`polotno-position`,disabled:!t,"aria-label":Q(`toolbar.position`),children:[(0,J.jsx)($,{name:`layering.menu`,className:`pn:size-4`}),Q(`toolbar.position`)]})}),(0,J.jsxs)(N0,{className:`pn:w-[280px] pn:p-1 pn:gap-0`,align:`start`,children:[(0,J.jsx)(i2,{title:Q(`toolbar.layering`)}),(0,J.jsxs)(`div`,{className:`pn:flex`,children:[(0,J.jsxs)(`div`,{className:`pn:w-1/2`,children:[(0,J.jsx)(r2,{icon:(0,J.jsx)($,{name:`layering.up`}),text:Q(`toolbar.up`),disabled:!e.selectedElements.some(e=>e.parent?.canMoveElementsUp([e.id])),onClick:()=>{e.selectedElements.forEach(e=>e.moveUp())}}),(0,J.jsx)(r2,{icon:(0,J.jsx)($,{name:`layering.top`}),text:Q(`toolbar.toForward`),disabled:!e.selectedElements.some(e=>e.parent?.canMoveElementsTop([e.id])),onClick:()=>{e.selectedElements.forEach(e=>e.moveTop())}})]}),(0,J.jsxs)(`div`,{className:`pn:w-1/2`,children:[(0,J.jsx)(r2,{icon:(0,J.jsx)($,{name:`layering.down`}),text:Q(`toolbar.down`),disabled:!e.selectedElements.some(e=>e.parent?.canMoveElementsDown([e.id])),onClick:()=>{e.selectedElements.forEach(e=>e.moveDown())}}),(0,J.jsx)(r2,{icon:(0,J.jsx)($,{name:`layering.bottom`}),text:Q(`toolbar.toBottom`),disabled:!e.selectedElements.some(e=>e.parent?.canMoveElementsBottom([e.id])),onClick:()=>{e.selectedElements.forEach(e=>e.moveBottom())}})]})]}),n&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(i2,{title:Q(`toolbar.position`)}),(0,J.jsxs)(`div`,{className:`pn:flex`,children:[(0,J.jsxs)(`div`,{className:`pn:w-1/2`,children:[(0,J.jsx)(r2,{icon:(0,J.jsx)($,{name:`position.alignLeft`}),text:Q(`toolbar.alignLeft`),onClick:()=>{JV(e)}}),(0,J.jsx)(r2,{icon:(0,J.jsx)($,{name:`position.alignCenter`}),text:Q(`toolbar.alignCenter`),onClick:()=>{$V(e)}}),(0,J.jsx)(r2,{icon:(0,J.jsx)($,{name:`position.alignRight`}),text:Q(`toolbar.alignRight`),onClick:()=>{YV(e)}})]}),(0,J.jsxs)(`div`,{className:`pn:w-1/2`,children:[(0,J.jsx)(r2,{icon:(0,J.jsx)($,{name:`position.alignTop`}),text:Q(`toolbar.alignTop`),onClick:()=>{XV(e)}}),(0,J.jsx)(r2,{icon:(0,J.jsx)($,{name:`position.alignMiddle`}),text:Q(`toolbar.alignMiddle`),onClick:()=>{ZV(e)}}),(0,J.jsx)(r2,{icon:(0,J.jsx)($,{name:`position.alignBottom`}),text:Q(`toolbar.alignBottom`),onClick:()=>{QV(e)}})]})]})]}),r&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(i2,{title:Q(`toolbar.spaceEvenly`)}),(0,J.jsxs)(`div`,{className:`pn:flex`,children:[(0,J.jsx)(`div`,{className:`pn:w-1/2`,children:(0,J.jsx)(r2,{icon:(0,J.jsx)($,{name:`position.distributeVertical`}),text:Q(`toolbar.verticalDistribution`),onClick:()=>{let t=e.activePage?.computedHeight,n=0,r=0;e.selectedElements.forEach(e=>{let i=t2(e);t=Math.min(t,i.y),n=Math.max(n,i.y+i.height),r+=i.height});let i=(n-t-r)/(e.selectedElements.length-1),a=e.selectedElements.slice().sort((e,t)=>{let n=t2(e),r=t2(t);return n.y-r.y}),o=0;a.forEach(e=>{let n=t2(e);n2(e,n.x,t+o),o+=n.height+i})}})}),(0,J.jsx)(`div`,{className:`pn:w-1/2`,children:(0,J.jsx)(r2,{icon:(0,J.jsx)($,{name:`position.distributeHorizontal`}),text:Q(`toolbar.horizontalDistribution`),onClick:()=>{let t=e.activePage?.computedWidth,n=0,r=0;e.selectedElements.forEach(e=>{let i=t2(e);t=Math.min(t,i.x),n=Math.max(n,i.x+i.width),r+=i.width});let i=(n-t-r)/(e.selectedElements.length-1),a=e.selectedElements.slice().sort((e,t)=>{let n=t2(e),r=t2(t);return n.x-r.x}),o=0;a.forEach(e=>{let n=t2(e);n2(e,t+o,n.y),o+=n.width+i})}})})]})]})]})]})}),o2=W(({store:e})=>{let t=e.selectedElements.length>1,n=e.selectedElements.length===1&&e.selectedElements[0].type===`group`;return(0,J.jsxs)(J.Fragment,{children:[t&&(0,J.jsx)(uK,{variant:`ghost`,size:`sm`,onClick:()=>{e.groupElements(e.selectedElements.map(e=>e.id))},style:{marginLeft:`auto`},children:Q(`toolbar.groupElements`)}),n&&(0,J.jsx)(uK,{variant:`ghost`,size:`sm`,onClick:()=>{e.ungroupElements([e.selectedElements[0].id])},style:{marginLeft:`auto`},children:Q(`toolbar.ungroupElements`)})]})}),s2=x.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return UX(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},o]})}),c2=x.forwardRef(({className:e,orientation:t=`horizontal`,...n},r)=>(0,J.jsx)(s2,{ref:r,"data-slot":`separator`,orientation:t,className:rK(`pn:shrink-0 pn:bg-border pn:data-[orientation=horizontal]:h-px pn:data-[orientation=horizontal]:w-full pn:data-[orientation=vertical]:h-full pn:data-[orientation=vertical]:w-px`,e),...n}));c2.displayName=`Separator`;var l2=x.forwardRef(({className:e,height:t,elevated:n=!0,floating:r=!1,attached:i,style:a,...o},s)=>(0,J.jsx)(`div`,{ref:s,"data-slot":`navbar`,className:rK(`pn:z-10 pn:flex pn:items-center pn:whitespace-nowrap pn:bg-[var(--pn-toolbar,var(--background))] pn:px-4 pn:text-[var(--pn-toolbar-foreground,var(--foreground))]`,i===`bottom`&&`pn:border-b pn:border-border pn:shadow-[0_6px_10px_-8px_rgba(17,20,24,0.25)] pn:dark:shadow-[0_6px_10px_-8px_rgba(0,0,0,0.5)]`,i===`top`&&`pn:border-t pn:border-border pn:shadow-[0_-6px_10px_-8px_rgba(17,20,24,0.25)] pn:dark:shadow-[0_-6px_10px_-8px_rgba(0,0,0,0.5)]`,!i&&n&&`pn:shadow-[0_0_0_1px_rgba(17,20,24,0.1),0_1px_3px_0_rgba(0,0,0,0.1),0_1px_2px_-1px_rgba(0,0,0,0.1)] pn:dark:shadow-[0_0_0_1px_rgba(255,255,255,0.1),0_1px_3px_0_rgba(0,0,0,0.4),0_1px_2px_-1px_rgba(0,0,0,0.4)]`,r&&`pn:rounded-[5px]`,e),style:{height:t==null?`var(--pn-toolbar-height, 50px)`:`${t}px`,...a},...o}));l2.displayName=`Navbar`;var u2=x.forwardRef(({className:e,align:t=`left`,...n},r)=>(0,J.jsx)(`div`,{ref:r,"data-slot":`navbar-group`,className:rK(`pn:flex pn:items-center`,t===`right`&&`pn:ml-auto`,e),...n}));u2.displayName=`NavbarGroup`;var d2=x.forwardRef(({className:e,...t},n)=>(0,J.jsx)(c2,{ref:n,"data-slot":`navbar-divider`,orientation:`vertical`,className:rK(`pn:!h-5 pn:self-center pn:mx-2`,e),...t}));d2.displayName=`NavbarDivider`;var f2=Object.assign(l2,{Group:u2,Divider:d2});function p2(e,t){return e.classList.contains(t)?e:e.parentElement?p2(e.parentElement,t):null}var Iue=()=>null,m2=48,Lue=W(({store:e,page:t,components:n,stageRef:r,tooltipSafeArea:i})=>{let a=e.selectedShapes.every(e=>e.page===t),o=x.useRef(null),[s,c]=x.useState(!1),l=e._hasCroppedImages;x.useEffect(()=>{let e=()=>{c(!0)},t=()=>{c(!1)};r?.current?.on(`dragstart`,e),r?.current?.on(`dragend`,t);let n=r?.current?.findOne(`Transformer`);return n?.on(`transformstart`,e),n?.on(`transformend`,t),()=>{r?.current?.off(`dragstart`,e),r?.current?.off(`dragend`,t),n?.off(`transformstart`,e),n?.off(`transformend`,t)}},[]);let[u,d]=x.useState({fit:!0,needCalculate:!1,token:Math.random()});x.useEffect(()=>{e.selectedElements.length!==0&&d({fit:!0,needCalculate:!0,token:Math.random()})},[e.selectedElements,s,e.scale]);function f(){if(!o.current||!u.needCalculate)return;let e=p2(o.current,`polotno-workspace-container`);if(!e)return;let t=e.getBoundingClientRect(),n=o.current.getBoundingClientRect(),a=n.top-t.top,s=n.bottom-t.top,c=i?.top||0,l=i?.bottom||0,f=r?.current,m=-1/0,h=1/0;if(f){let e=f.container().getBoundingClientRect(),n=f.scaleY();m=e.top+f.y()+p.y*n-t.top,h=e.top+f.y()+(p.y+p.height)*n-t.top}let g=a>=20+c&&m-s>=m2,_=s-t.height<=-20-l&&a-h>=m2;d(g?{fit:!0,needCalculate:!1,token:u.token}:_?{fit:!1,needCalculate:!1,token:u.token}:{fit:u.fit,needCalculate:!1,token:u.token})}if(x.useLayoutEffect(()=>{let e=setTimeout(()=>{f()},100);return()=>{clearTimeout(e)}},[u.needCalculate,o.current,u.token]),x.useEffect(()=>{if(!r?.current)return;let t=p2(r.current.content,`polotno-workspace-inner`);if(!t)return;let n=()=>{e.selectedElements.length&&d({fit:!0,needCalculate:!0,token:Math.random()})};return t?.addEventListener(`scroll`,n),()=>{t?.removeEventListener(`scroll`,n)}},[]),e.selectedShapes.length===0||s||!a||e.activePage!==t||l)return null;let p=Ob(e.selectedShapes),m=n?.Position||a2,h=n?.Duplicate||Q0,g=n?.Remove||e2,_=n?.Group||o2,v=n?.Lock||Iue,y=e.selectedElements[0]?.type,b={...n_.aiTextEnabled?{TextAiWrite:X0}:{},...n||{}},S=P0({components:b,type:y,usedItems:[]});return(0,J.jsx)(Mx,{parentNodeFunc:({stage:e})=>e?.container()?.closest(`.polotno-workspace-container`)||e?.container()?.parentNode,transformFunc:e=>{let t=p.x+p.width/2,n=r?.current?.container(),a=n?.getBoundingClientRect()||{left:0,top:0,width:0,height:0,right:0,bottom:0,x:0,y:0,toJSON:()=>({})},s=(n?.closest(`.polotno-workspace-container`))?.getBoundingClientRect()||{left:0,top:0,width:1/0,height:1/0,right:0,bottom:0,x:0,y:0,toJSON:()=>({})},c=a.left-s.left,l=a.top-s.top,d=o.current?o.current.getBoundingClientRect().height:34,f=(i?.top||0)+8,m=l+e.y+p.y*e.scaleY,h=u.fit;if(h){let e=m-80,t=f+d/2;Math.max(t,e)+d/2>m-m2&&(h=!1)}let g=h?p.y*e.scaleY-80:p.y*e.scaleY+p.height*e.scaleY+80,_=c+e.x+t*e.scaleX,v=_-p.width*e.scaleX/2,y=_+p.width*e.scaleX/2,b=Math.min(50,p.width/2*e.scaleX),x=y>=b&&v<=s.width-b,S=o.current?o.current.getBoundingClientRect().width:0,C=i?.left||0,w=i?.right||0;if(Number.isFinite(s.width)&&S>0&&x){let e=8+S/2+C,t=s.width-8-S/2-w;t>=e&&(_=Math.max(e,Math.min(_,t)))}y<b&&(_-=S+8),v>s.width-b&&(_+=S+8);let T=l+e.y+g,E=o.current?o.current.getBoundingClientRect().height:34,D=(i?.top||0)+8,O=(i?.bottom||0)+8;return Number.isFinite(s.height)&&(T=Math.max(D+E/2,T),T=Math.min(s.height-O-E/2,T)),{...e,x:_,y:T,scaleX:1,scaleY:1}},divProps:{style:{pointerEvents:`none`,position:`absolute`,visibility:u.needCalculate?`hidden`:`visible`,zIndex:9}},children:(0,J.jsx)(`div`,{ref:e=>{o.current=e,!o.current&&e&&f()},className:`polotno-selection-tooltip`,style:{pointerEvents:`none`},children:(0,J.jsxs)(f2,{floating:!0,height:34,className:`pn:gap-0.5 pn:bg-popover pn:px-0.5`,style:{transform:`translate(-50%, -50%)`,pointerEvents:`auto`},children:[S.map(t=>{let n=b[t];return(0,J.jsx)(n,{elements:e.selectedElements,element:e.selectedElements[0],store:e},t)}),(0,J.jsx)(_,{store:e}),(0,J.jsx)(v,{store:e}),(0,J.jsx)(h,{store:e}),(0,J.jsx)(g,{store:e}),(0,J.jsx)(m,{store:e})]})})})}),h2=({store:e})=>{let t=e.selectedShapes.length>0,n=e.selectedShapes[0]?.locked,r=(0,x.useCallback)(()=>{e.selectedShapes.forEach(e=>e.set({draggable:n,contentEditable:n,styleEditable:n,resizable:n,removable:n}))},[n,e]);return{disabled:!t,lock:r,locked:n}},g2=x.createContext(void 0);function _2(e=!0){let t=x.useContext(g2);if(t===void 0&&!e)throw Error(CK(25));return t}var v2=x.createContext(void 0);function y2(e){let t=x.useContext(v2);if(t===void 0&&!e)throw Error(CK(33));return t}var b2=x.createContext(void 0);function x2(e){let t=x.useContext(b2);if(t===void 0&&!e)throw Error(CK(36));return t}function S2({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=x.useRef(e!==void 0),[a,o]=x.useState(t);return[i?e:a,x.useCallback(e=>{i||o(e)},[])]}var C2=x.createContext(void 0);function Rue(){let e=x.useContext(C2);if(e===void 0)throw Error(CK(30));return e}function zue(e){let{closeOnClick:t,highlighted:n,id:r,nodeId:i,store:a,typingRef:o,itemRef:s,itemMetadata:c}=e,{events:l}=a.useState(`floatingTreeRoot`),u=_2(!0),d=u!==void 0;return x.useMemo(()=>({id:r,role:`menuitem`,tabIndex:n?0:-1,onKeyDown(e){e.key===` `&&o?.current&&e.preventDefault()},onMouseMove(e){i&&l.emit(`itemhover`,{nodeId:i,target:e.currentTarget})},onClick(e){t&&l.emit(`close`,{domEvent:e,reason:Zq})},onMouseUp(e){if(u){let t=u.initialCursorPointRef.current;if(u.initialCursorPointRef.current=null,d&&t&&Math.abs(e.clientX-t.x)<=1&&Math.abs(e.clientY-t.y)<=1||d&&!zK&&e.button===2)return}s.current&&a.context.allowMouseUpTriggerRef.current&&(!d||e.button===2)&&(!c||c.type===`regular-item`)&&s.current.click()}}),[t,n,r,l,i,a,o,s,u,d,c])}var w2={type:`regular-item`};function T2(e){let{closeOnClick:t,disabled:n=!1,highlighted:r,id:i,store:a,typingRef:o=a.context.typingRef,nativeButton:s,itemMetadata:c,nodeId:l}=e,u=x.useRef(null),{getButtonProps:d,buttonRef:f}=t0({disabled:n,focusableWhenDisabled:!0,native:s,composite:!0}),p=zue({closeOnClick:t,highlighted:r,id:i,nodeId:l,store:a,typingRef:o,itemRef:u,itemMetadata:c}),m=x.useCallback(e=>kX(p,{onMouseEnter(){c.type===`submenu-trigger`&&c.setActive()}},e,d),[p,d,c]),h=bJ(u,f);return x.useMemo(()=>({getItemProps:m,itemRef:h}),[m,h])}var E2=x.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function Bue(){return x.useContext(E2)}var D2=function(e){return e[e.None=0]=`None`,e[e.GuessFromOrder=1]=`GuessFromOrder`,e}({});function O2(e={}){let{label:t,metadata:n,textRef:r,indexGuessBehavior:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,elementsRef:l,labelsRef:u,nextIndexRef:d}=Bue(),f=x.useRef(-1),[p,m]=x.useState(a??(i===D2.GuessFromOrder?()=>{if(f.current===-1){let e=d.current;d.current+=1,f.current=e}return f.current}:-1)),h=x.useRef(null),g=x.useCallback(e=>{if(h.current=e,p!==-1&&e!==null&&(l.current[p]=e,u)){let n=t!==void 0;u.current[p]=n?t:r?.current?.textContent??e.textContent}},[p,l,u,t,r]);return xK(()=>{if(a!=null)return;let e=h.current;if(e)return o(e,n),()=>{s(e)}},[a,o,s,n]),xK(()=>{if(a==null)return c(e=>{let t=h.current?e.get(h.current)?.index:null;t!=null&&m(t)})},[a,c,m]),x.useMemo(()=>({ref:g,index:p}),[p,g])}var k2=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.disabled=`data-disabled`,e.highlighted=`data-highlighted`,e}({}),A2={checked(e){return e?{[k2.checked]:``}:{[k2.unchecked]:``}},...i$},Vue=x.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!1,checked:l,defaultChecked:u,onCheckedChange:d,style:f,...p}=e,m=O2({label:a}),h=y2(!0),g=h1(i),{store:_}=x2(),v=_.useState(`isActive`,m.index),y=_.useState(`itemProps`),[b,S]=S2({controlled:l,default:u??!1,name:`MenuCheckboxItem`,state:`checked`}),{getItemProps:C,itemRef:w}=T2({closeOnClick:c,disabled:s,highlighted:v,id:g,store:_,nativeButton:o,nodeId:h?.context.nodeId,itemMetadata:w2}),T=x.useMemo(()=>({disabled:s,highlighted:v,checked:b}),[s,v,b]);function E(e){let t=pJ(Zq,e.nativeEvent,void 0,{preventUnmountOnClose(){}});d?.(!b,t),!t.isCanceled&&S(e=>!e)}let D=UX(`div`,e,{state:T,stateAttributesMapping:A2,props:[y,{role:`menuitemcheckbox`,"aria-checked":b,onClick:E},p,C],ref:[w,t,m.ref]});return(0,J.jsx)(C2.Provider,{value:T,children:D})}),Hue=x.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=Rue(),c=x.useRef(null),{transitionStatus:l,setMounted:u}=e$(s.checked);return o$({open:s.checked,ref:c,onComplete(){s.checked||u(!1)}}),UX(`span`,e,{state:{checked:s.checked,disabled:s.disabled,highlighted:s.highlighted,transitionStatus:l},ref:[t,c],stateAttributesMapping:A2,props:{"aria-hidden":!0,...o},enabled:a||s.checked})}),Uue=x.createContext(void 0);function Wue(){let e=x.useContext(Uue);if(e===void 0)throw Error(CK(31));return e}var Gue=x.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=h1(a),c=Wue();return xK(()=>(c(s),()=>{c(void 0)}),[c,s]),UX(`div`,e,{ref:t,props:{id:s,role:`presentation`,...o}})}),Kue=x.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!0,style:l,...u}=e,d=O2({label:a}),f=y2(!0),p=h1(i),{store:m}=x2(),h=m.useState(`isActive`,d.index),g=m.useState(`itemProps`),{getItemProps:_,itemRef:v}=T2({closeOnClick:c,disabled:s,highlighted:h,id:p,store:m,nativeButton:o,nodeId:f?.context.nodeId,itemMetadata:w2});return UX(`div`,e,{state:{disabled:s,highlighted:h},props:[g,u,_],ref:[v,t,d.ref]})}),que={...m1,...i$},j2=x.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s}=x2(),{side:c,align:l}=y2(),u=A0(!0)!=null,d=s.useState(`open`),f=s.useState(`transitionStatus`),p=s.useState(`popupProps`),m=s.useState(`mounted`),h=s.useState(`instantType`),g=s.useState(`activeTriggerElement`),_=s.useState(`parent`),v=s.useState(`lastOpenChangeReason`),y=s.useState(`rootId`),b=s.useState(`floatingRootContext`),S=s.useState(`floatingTreeRoot`),C=s.useState(`closeDelay`),w=s.useState(`activeTriggerElement`),T=s.useState(`hoverEnabled`),E=s.useState(`disabled`),D=_.type===`context-menu`;o$({open:d,ref:s.context.popupRef,onComplete(){d&&s.context.onOpenChangeComplete?.(!0)}}),x.useEffect(()=>{function e(e){s.setOpen(!1,pJ(e.reason,e.domEvent))}return S.events.on(`close`,e),()=>{S.events.off(`close`,e)}},[S.events,s]),F$(b,{enabled:T&&!E&&!D&&_.type!==`menubar`,closeDelay:C});let O=x.useCallback(e=>{s.set(`popupElement`,e)},[s]),k=UX(`div`,e,{state:{transitionStatus:f,side:c,align:l,open:d,nested:_.type===`menu`,instant:h},ref:[t,s.context.popupRef,O],stateAttributesMapping:que,props:[p,{onKeyDown(e){u&&T0.has(e.key)&&e.stopPropagation()}},I1(f),o,{"data-rootownerid":y}]}),A=_.type===void 0||D;return(g||_.type===`menubar`&&v!==`outside-press`)&&(A=!0),(0,J.jsx)(CZ,{context:b,modal:D,disabled:!m,returnFocus:a===void 0?A:a,initialFocus:_.type!==`menu`,restoreFocus:!0,externalTree:_.type===`menubar`?void 0:S,previousFocusableElement:w,nextFocusableElement:_.type===void 0?s.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:_.type===void 0?s.context.beforeContentFocusGuardRef:void 0,children:k})}),M2=x.createContext(void 0);function Jue(){let e=x.useContext(M2);if(e===void 0)throw Error(CK(32));return e}var N2=x.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=x2();return i.useState(`mounted`)||n?(0,J.jsx)(M2.Provider,{value:n,children:(0,J.jsx)(iZ,{ref:t,...r})}):null});function P2(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=jJ(i),o=x.useRef(0),s=fK(Xue).current,c=fK(Yue).current,[l,u]=x.useState(0),d=x.useRef(l),f=jJ((e,t)=>{c.set(e,t??null),d.current+=1,u(d.current)}),p=jJ(e=>{c.delete(e),d.current+=1,u(d.current)}),m=x.useMemo(()=>{let e=new Map;return Array.from(c.keys()).filter(e=>e.isConnected).sort(Zue).forEach((t,n)=>{let r=c.get(t)??{};e.set(t,{...r,index:n})}),e},[c,l]);xK(()=>{if(typeof MutationObserver!=`function`||m.size===0)return;let e=new MutationObserver(e=>{let t=new Set,n=e=>t.has(e)?t.delete(e):t.add(e);e.forEach(e=>{e.removedNodes.forEach(n),e.addedNodes.forEach(n)}),t.size===0&&(d.current+=1,u(d.current))});return m.forEach((t,n)=>{n.parentElement&&e.observe(n.parentElement,{childList:!0})}),()=>{e.disconnect()}},[m]),xK(()=>{d.current===l&&(n.current.length!==m.size&&(n.current.length=m.size),r&&r.current.length!==m.size&&(r.current.length=m.size),o.current=m.size),a(m)},[a,m,n,r,l]),xK(()=>()=>{n.current=[]},[n]),xK(()=>()=>{r&&(r.current=[])},[r]);let h=jJ(e=>(s.add(e),()=>{s.delete(e)}));xK(()=>{s.forEach(e=>e(m))},[s,m]);let g=x.useMemo(()=>({register:f,unregister:p,subscribeMapChange:h,elementsRef:n,labelsRef:r,nextIndexRef:o}),[f,p,h,n,r,o]);return(0,J.jsx)(E2.Provider,{value:g,children:t})}function Yue(){return new Map}function Xue(){return new Set}function Zue(e,t){let n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}var F2=x.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o,align:s,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=ZX,style:g,..._}=e,{store:v}=x2(),y=Jue(),b=_2(!0),S=v.useState(`parent`),C=v.useState(`floatingRootContext`),w=v.useState(`floatingTreeRoot`),T=v.useState(`mounted`),E=v.useState(`open`),D=v.useState(`modal`),O=v.useState(`openMethod`),k=v.useState(`activeTriggerElement`),A=v.useState(`transitionStatus`),j=v.useState(`positionerElement`),M=v.useState(`instantType`),N=v.useState(`hasViewport`),P=v.useState(`lastOpenChangeReason`),F=v.useState(`floatingNodeId`),I=v.useState(`floatingParentNodeId`),L=C.useState(`domReferenceElement`),ee=x.useRef(null),R=a$(j,!1,!1),z=n,B=c,V=l,H=s,te=h;S.type===`context-menu`&&(z=n??S.context?.anchor,H??=`start`,!o&&H!==`center`&&(V=e.alignOffset??2,B=e.sideOffset??-5));let U=o,ne=H;S.type===`menu`?(U??=`inline-end`,ne??=`start`,te=e.collisionAvoidance??QX):S.type===`menubar`&&(U??=`bottom`,ne??=`start`);let re=S.type===`context-menu`,ie=P1({anchor:z,floatingRootContext:C,positionMethod:b?`fixed`:r,mounted:T,side:U,sideOffset:B,align:ne,alignOffset:V,arrowPadding:re?0:f,collisionBoundary:u,collisionPadding:d,sticky:p,nodeId:F,keepMounted:y,disableAnchorTracking:m,collisionAvoidance:te,shiftCrossAxis:re&&!(`side`in te&&te.side===`flip`),externalTree:w,adaptiveOrigin:N?j1:void 0});x.useEffect(()=>{function e(e){e.open&&(e.parentNodeId===F&&v.set(`hoverEnabled`,!1),e.nodeId!==F&&e.parentNodeId===v.select(`floatingParentNodeId`)&&v.setOpen(!1,pJ(sJ)))}return w.events.on(`menuopenchange`,e),()=>{w.events.off(`menuopenchange`,e)}},[v,w.events,F]),x.useEffect(()=>{if(v.select(`floatingParentNodeId`)==null)return;function e(e){if(e.open||e.nodeId!==v.select(`floatingParentNodeId`))return;let t=e.reason??`sibling-open`;v.setOpen(!1,pJ(t))}return w.events.on(`menuopenchange`,e),()=>{w.events.off(`menuopenchange`,e)}},[w.events,v]);let ae=AK();x.useEffect(()=>{E||ae.clear()},[E,ae]),x.useEffect(()=>{function e(e){if(!(!E||e.nodeId!==v.select(`floatingParentNodeId`)))if(e.target&&k&&k!==e.target){let e=v.select(`closeDelay`);e>0?ae.isStarted()||ae.start(e,()=>{v.setOpen(!1,pJ(sJ))}):v.setOpen(!1,pJ(sJ))}else ae.clear()}return w.events.on(`itemhover`,e),()=>{w.events.off(`itemhover`,e)}},[w.events,E,k,v,ae]),x.useEffect(()=>{let e={open:E,nodeId:F,parentNodeId:I,reason:v.select(`lastOpenChangeReason`)};w.events.emit(`menuopenchange`,e)},[w.events,E,v,F,I]),xK(()=>{let e=L,t=ee.current;if(e&&(ee.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return R(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[L,R,v]);let oe={open:E,side:ie.side,align:ie.align,anchorHidden:ie.anchorHidden,nested:S.type===`menu`,instant:M},se=S.type===`menubar`&&S.context.modal;m0(E&&(se||D&&P!==`trigger-hover`),O===`touch`,j,k);let ce=L1(e,oe,{styles:ie.positionerStyles,transitionStatus:A,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!T,inert:!E}),le=T&&S.type!==`menu`&&(S.type!==`menubar`&&D&&P!==`trigger-hover`||S.type===`menubar`&&S.context.modal),ue=null;return S.type===`menubar`?ue=S.context.contentElement:S.type===void 0&&(ue=k),(0,J.jsxs)(v2.Provider,{value:ie,children:[le&&(0,J.jsx)(l0,{ref:S.type===`context-menu`||S.type===`nested-context-menu`?S.context.internalBackdropRef:null,inert:z1(!E),cutout:ue}),(0,J.jsx)(fZ,{id:F,children:(0,J.jsx)(P2,{elementsRef:v.context.itemDomElements,labelsRef:v.context.itemLabels,children:ce})})]})}),Que=x.createContext(void 0);function $ue(){let e=x.useContext(Que);if(e===void 0)throw Error(CK(34));return e}var I2=x.createContext(void 0);function ede(){let e=x.useContext(I2);if(e===void 0)throw Error(CK(35));return e}var tde=x.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!1,value:l,style:u,...d}=e,f=O2({label:a}),p=y2(!0),m=h1(i),{store:h}=x2(),g=h.useState(`isActive`,f.index),_=h.useState(`itemProps`),{value:v,setValue:y,disabled:b}=$ue(),S=b||s,C=v===l,{getItemProps:w,itemRef:T}=T2({closeOnClick:c,disabled:S,highlighted:g,id:m,store:h,nativeButton:o,nodeId:p?.context.nodeId,itemMetadata:w2}),E=x.useMemo(()=>({disabled:S,highlighted:g,checked:C}),[S,g,C]);function D(e){y(l,pJ(Zq,e.nativeEvent,void 0,{preventUnmountOnClose(){}}))}let O=UX(`div`,e,{state:E,stateAttributesMapping:A2,props:[_,{role:`menuitemradio`,"aria-checked":C,onClick:D},d,w],ref:[T,t,f.ref]});return(0,J.jsx)(I2.Provider,{value:E,children:O})}),nde=x.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=ede(),c=x.useRef(null),{transitionStatus:l,setMounted:u}=e$(s.checked);return o$({open:s.checked,ref:c,onComplete(){s.checked||u(!1)}}),UX(`span`,e,{state:{checked:s.checked,disabled:s.disabled,highlighted:s.highlighted,transitionStatus:l},stateAttributesMapping:A2,ref:[t,c],props:{"aria-hidden":!0,...o},enabled:a||s.checked})}),rde=x.createContext(null);function L2(e){let t=x.useContext(rde);if(t===null&&!e)throw Error(CK(5));return t}var ide={...T$,disabled:VQ(e=>e.parent.type===`menubar`&&e.parent.context.disabled||e.disabled),modal:VQ(e=>(e.parent.type===void 0||e.parent.type===`context-menu`)&&(e.modal??!0)),openMethod:VQ(e=>e.openMethod),allowMouseEnter:VQ(e=>e.allowMouseEnter),stickIfOpen:VQ(e=>e.stickIfOpen),parent:VQ(e=>e.parent),rootId:VQ(e=>e.parent.type===`menu`?e.parent.store.select(`rootId`):e.parent.type===void 0?e.rootId:e.parent.context.rootId),activeIndex:VQ(e=>e.activeIndex),isActive:VQ((e,t)=>e.activeIndex===t),hoverEnabled:VQ(e=>e.hoverEnabled),instantType:VQ(e=>e.instantType),lastOpenChangeReason:VQ(e=>e.openChangeReason),floatingTreeRoot:VQ(e=>e.parent.type===`menu`?e.parent.store.select(`floatingTreeRoot`):e.floatingTreeRoot),floatingNodeId:VQ(e=>e.floatingNodeId),floatingParentNodeId:VQ(e=>e.floatingParentNodeId),itemProps:VQ(e=>e.itemProps),closeDelay:VQ(e=>e.closeDelay),hasViewport:VQ(e=>e.hasViewport),keyboardEventRelay:VQ(e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type===`menu`)return e.parent.store.select(`keyboardEventRelay`)})},ade=class e extends XQ{constructor(e){super({...ode(),...e},{positionerRef:x.createRef(),popupRef:x.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:x.createRef(),beforeContentFocusGuardRef:x.createRef(),onOpenChangeComplete:void 0,triggerElements:new g$},ide),this.unsubscribeParentListener=this.observe(`parent`,e=>{if(this.unsubscribeParentListener?.(),e.type===`menu`){let t=e.store.select(`rootId`),n=e.store.select(`floatingTreeRoot`),r=e.store.select(`keyboardEventRelay`);this.unsubscribeParentListener=e.store.subscribe(()=>{let i=e.store.select(`rootId`),a=e.store.select(`floatingTreeRoot`),o=e.store.select(`keyboardEventRelay`);t===i&&n===a&&r===o||(t=i,n=a,r=o,this.notifyAll())}),this.context.allowMouseUpTriggerRef=e.store.context.allowMouseUpTriggerRef;return}e.type!==void 0&&(this.context.allowMouseUpTriggerRef=e.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,t){this.state.floatingRootContext.context.events.emit(`setOpen`,{open:e,eventDetails:t})}static useStore(t,n){let r=fK(()=>new e(n)).current;return t??r}unsubscribeParentListener=null};function ode(){return{...v$(),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new oZ,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:Gq,keyboardEventRelay:void 0,closeDelay:0,hasViewport:!1}}var R2=x.createContext(void 0);function z2(){return x.useContext(R2)}var B2=_K(function(e){let{children:t,open:n,onOpenChange:r,onOpenChangeComplete:i,defaultOpen:a=!1,disabled:o=!1,modal:s,loopFocus:c=!0,orientation:l=`vertical`,actionsRef:u,closeParentOnEsc:d=!1,handle:f,triggerId:p,defaultTriggerId:m=null,highlightItemOnHover:h=!0}=e,g=_2(!0),_=x2(!0),v=L2(!0),y=z2(),b=x.useMemo(()=>y&&_?{type:`menu`,store:_.store}:v?{type:`menubar`,context:v}:g&&!_?{type:`context-menu`,context:g}:{type:void 0},[g,_,v,y]),S=ade.useStore(f?.store,{open:a,openProp:n,activeTriggerId:m,triggerIdProp:p,parent:b});bK(()=>{n===void 0&&S.state.open===!1&&a===!0&&S.update({open:!0,activeTriggerId:m})}),S.useControlledProp(`openProp`,n),S.useControlledProp(`triggerIdProp`,p),S.useContextCallback(`onOpenChangeComplete`,i);let C=bX(),w=bX(),T=S.useState(`floatingTreeRoot`),E=dZ(T),D=lZ(),O=S.useState(`open`),k=S.useState(`activeTriggerElement`),A=S.useState(`positionerElement`),j=S.useState(`hoverEnabled`),M=S.useState(`disabled`),N=S.useState(`lastOpenChangeReason`),P=S.useState(`parent`),F=S.useState(`activeIndex`),I=S.useState(`payload`),L=S.useState(`floatingParentNodeId`),ee=x.useRef(null),R=x.useRef(P.type!==`context-menu`),z=AK(),B=x.useRef(!0),V=AK(),H=L!=null,{openMethod:te,triggerProps:U}=o0(O);S.useSyncedValues({disabled:o,modal:P.type===void 0?s:void 0,openMethod:te,rootId:C}),f$(S);let{forceUnmount:ne}=p$(O,S,()=>{S.update({allowMouseEnter:!1,stickIfOpen:!0})});xK(()=>{g&&!_?S.update({parent:{type:`context-menu`,context:g},floatingNodeId:E,floatingParentNodeId:D}):_&&S.update({floatingNodeId:E,floatingParentNodeId:D})},[g,_,E,D,S]),x.useEffect(()=>{if(O||(ee.current=null),P.type===`context-menu`){if(!O){z.clear(),R.current=!1;return}z.start(500,()=>{R.current=!0})}},[z,O,P.type]),xK(()=>{!O&&!j&&S.set(`hoverEnabled`,!0)},[O,j,S]);let re=jJ((e,t)=>{let n=t.reason;if(O===e&&t.trigger===k&&N===n||(t.preventUnmountOnClose=()=>{S.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&(t.trigger=k??void 0),r?.(e,t),t.isCanceled))return;S.state.floatingRootContext.dispatchOpenChange(e,t);let i=t.event;if(e===!1&&i?.type===`click`&&i.pointerType===`touch`&&!B.current)return;if(!e&&F!==null){let e=S.context.itemDomElements.current[F];queueMicrotask(()=>{e?.setAttribute(`tabindex`,`-1`)})}e&&n===`trigger-focus`?(B.current=!1,V.start(300,()=>{B.current=!0})):(B.current=!0,V.clear());let a=(n===`trigger-press`||n===`item-press`)&&i.detail===0&&i?.isTrusted,o=!e&&(n===`escape-key`||n==null),s={open:e,openChangeReason:n};ee.current=t.event??null;let c=t.trigger?.id??null;(c||e)&&(s.activeTriggerId=c,s.activeTriggerElement=t.trigger??null),S.update(s),P.type===`menubar`&&(n===`trigger-focus`||n===`focus-out`||n===`trigger-hover`||n===`list-navigation`||n===`sibling-open`)?S.set(`instantType`,`group`):a||o?S.set(`instantType`,a?`click`:`dismiss`):S.set(`instantType`,void 0)}),ie=$Q({popupStore:S,floatingId:w,nested:D!=null,onOpenChange:re}),ae=ie.context.events;x.useEffect(()=>{let e=({open:e,eventDetails:t})=>re(e,t);return ae.on(`setOpen`,e),()=>{ae?.off(`setOpen`,e)}},[ae,re]);let oe=x.useCallback(()=>{S.setOpen(!1,pJ(dJ))},[S]);x.useImperativeHandle(u,()=>({unmount:ne,close:oe}),[ne,oe]);let se;P.type===`context-menu`&&(se=P.context),x.useImperativeHandle(se?.positionerRef,()=>A,[A]),x.useImperativeHandle(se?.actionsRef,()=>({setOpen:re}),[re]);let ce=jZ(ie,{enabled:!M,bubbles:{escapeKey:d&&P.type===`menu`},outsidePress(){return P.type!==`context-menu`||ee.current?.type===`contextmenu`?!0:R.current},externalTree:H?T:void 0}),le=k1(),ue=x.useCallback(e=>{S.select(`activeIndex`)!==e&&S.set(`activeIndex`,e)},[S]),de=W$(ie,{enabled:!M,listRef:S.context.itemDomElements,activeIndex:F,nested:P.type!==void 0,loopFocus:c,orientation:l,parentOrientation:P.type===`menubar`?P.context.orientation:void 0,rtl:le===`rtl`,disabledIndices:Wq,onNavigate:ue,openOnArrowKeyDown:P.type!==`context-menu`,externalTree:H?T:void 0,focusItemOnHover:h}),fe=x.useCallback(e=>{S.context.typingRef.current=e},[S]),pe=G$(ie,{listRef:S.context.itemLabels,elementsRef:S.context.itemDomElements,activeIndex:F,resetMs:500,onMatch:e=>{O&&e!==F&&S.set(`activeIndex`,e)},onTyping:fe});m$(S,{floatingRootContext:ie,activeTriggerProps:x.useMemo(()=>{let e=kX(pe.reference,de.reference,ce.reference,{onMouseMove(){S.set(`allowMouseEnter`,!0)}},U);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=O,e},[S,pe.reference,de.reference,ce.reference,U,O]),inactiveTriggerProps:x.useMemo(()=>{let e=kX(de.trigger,ce.trigger,U);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=!1,e},[de.trigger,ce.trigger,U]),popupProps:x.useMemo(()=>kX(s$,{id:w,role:`menu`,"aria-labelledby":k?.id,onMouseMove(){S.set(`allowMouseEnter`,!0),P.type===`menu`&&S.set(`hoverEnabled`,!1)},onClick(){S.select(`hoverEnabled`)&&S.set(`hoverEnabled`,!1)},onKeyDown(e){let t=S.select(`keyboardEventRelay`);t&&!e.isPropagationStopped()&&t(e)}},pe.floating,de.floating,ce.floating),[k,w,P.type,S,pe.floating,de.floating,ce.floating]),itemProps:de.item??Gq});let me=x.useMemo(()=>({store:S,parent:b}),[S,b]),he=(0,J.jsx)(b2.Provider,{value:me,children:typeof t==`function`?t({payload:I}):t});return P.type===void 0||P.type===`context-menu`?(0,J.jsx)(pZ,{externalTree:T,children:he}):he});function sde(e){let t=x2().store,n=x.useMemo(()=>({parentMenu:t}),[t]);return(0,J.jsx)(R2.Provider,{value:n,children:(0,J.jsx)(B2,{...e})})}function V2(e){let t=e.getBoundingClientRect(),n=QK(e),r=n.getComputedStyle(e,`::before`),i=n.getComputedStyle(e,`::after`);if(!(r.content!==`none`||i.content!==`none`))return t;let a=parseFloat(r.width)||0,o=parseFloat(r.height)||0,s=parseFloat(i.width)||0,c=parseFloat(i.height)||0,l=Math.max(t.width,a,s),u=Math.max(t.height,o,c),d=l-t.width,f=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-f/2,bottom:t.bottom+f/2}}function H2(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=e0(),{ref:i,index:a}=O2(e),o=n===a,s=x.useRef(null),c=bJ(i,s);return{compositeProps:x.useMemo(()=>({tabIndex:o?0:-1,onFocus(){r(a)},onMouseMove(){let e=s.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!o&&!n&&e.focus()}}),[o,r,a,t]),compositeRef:c,index:a}}function U2(e){let{render:t,className:n,style:r,state:i=Gq,props:a=Wq,refs:o=Wq,metadata:s,stateAttributesMapping:c,tag:l=`div`,...u}=e,{compositeProps:d,compositeRef:f}=H2({metadata:s});return UX(l,e,{state:i,ref:[...o,f],props:[d,...a,u],stateAttributesMapping:c})}function W2(e){if(nq(e)&&e.hasAttribute(`data-rootownerid`))return e.getAttribute(`data-rootownerid`)??void 0;if(!mq(e))return W2(_q(e))}function cde(e){let{enabled:t=!0,mouseDownAction:n,open:r}=e,i=x.useRef(!1);return x.useMemo(()=>t?{onMouseDown:e=>{(n===`open`&&!r||n===`close`&&r)&&(i.current=!0,RJ(e.currentTarget).addEventListener(`click`,()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:Gq,[t,n,r])}var G2=2,lde=vK(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,id:s,openOnHover:c,delay:l=100,closeDelay:u=0,handle:d,payload:f,...p}=e,m=x2(!0),h=d?.store??m?.store;if(!h)throw Error(CK(85));let g=h1(s),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`triggerPopupId`,g),S=x.useRef(null),C=dde(),w=e0(!0),T=uZ(),E=x.useMemo(()=>T??new oZ,[T]),{registerTrigger:D,isMountedByThisTrigger:O}=d$(g,S,h,{payload:f,closeDelay:u,parent:C,floatingTreeRoot:E,floatingNodeId:dZ(E),floatingParentNodeId:lZ(),keyboardEventRelay:w?.relayKeyboardEvent}),k=C.type===`menubar`,A=h.useState(`disabled`),j=a||A||k&&C.context.disabled,{getButtonProps:M,buttonRef:N}=t0({disabled:j,native:o});x.useEffect(()=>{!y&&C.type===void 0&&(h.context.allowMouseUpTriggerRef.current=!1)},[h,y,C.type]);let P=x.useRef(null),F=AK(),I=jJ(e=>{if(!P.current)return;F.clear(),h.context.allowMouseUpTriggerRef.current=!1;let t=e.target;if(Oq(P.current,t)||Oq(h.select(`positionerElement`),t)||t===P.current||t!=null&&W2(t)===h.select(`rootId`))return;let n=V2(P.current);e.clientX>=n.left-G2&&e.clientX<=n.right+G2&&e.clientY>=n.top-G2&&e.clientY<=n.bottom+G2||E.events.emit(`close`,{domEvent:e,reason:oJ})});x.useEffect(()=>{y&&h.select(`lastOpenChangeReason`)===`trigger-hover`&&RJ(P.current).addEventListener(`mouseup`,I,{once:!0})},[y,I,h]);let L=k&&C.context.hasSubmenuOpen,ee=L$(v,{enabled:(c??L)&&!j&&C.type!==`context-menu`&&(!k||L&&!O),handleClose:$$({blockPointerEvents:!k}),mouseOnly:!0,move:!1,restMs:C.type===void 0?l:void 0,delay:{close:u},triggerElementRef:S,externalTree:E,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),R=ude(y,h.select(`lastOpenChangeReason`)),z=wZ(v,{enabled:!j&&C.type!==`context-menu`,event:y&&k?`click`:`mousedown`,toggle:!0,ignoreMouse:!1,stickIfOpen:C.type===void 0?R:!1}),B=k$(v,{enabled:!j&&L}),V=cde({open:y,enabled:k,mouseDownAction:`open`}),H=x.useMemo(()=>kX(B.reference,z.reference),[B.reference,z.reference]),te=h.useState(`triggerProps`,O),{preFocusGuardRef:U,handlePreFocusGuardFocus:ne,handleFocusTargetFocus:re}=r0(h,S),ie={disabled:j,open:y},ae=[P,t,N,D,S],oe=[H,ee??Gq,te,{"aria-haspopup":`menu`,"aria-controls":b,id:g,onMouseDown:e=>{h.select(`open`)||(F.start(200,()=>{h.context.allowMouseUpTriggerRef.current=!0}),RJ(e.currentTarget).addEventListener(`mouseup`,I,{once:!0}))}},k?{role:`menuitem`}:{},V,p,M],se=UX(`button`,e,{enabled:!k,stateAttributesMapping:p1,state:ie,ref:ae,props:oe});return k?(0,J.jsx)(U2,{tag:`button`,render:n,className:r,style:i,state:ie,refs:ae,props:oe,stateAttributesMapping:p1}):y?(0,J.jsxs)(x.Fragment,{children:[(0,J.jsx)(HJ,{ref:U,onFocus:ne},`${g}-pre-focus-guard`),(0,J.jsx)(x.Fragment,{children:se},g),(0,J.jsx)(HJ,{ref:h.context.triggerFocusTargetRef,onFocus:re},`${g}-post-focus-guard`)]}):(0,J.jsx)(x.Fragment,{children:se},g)});function ude(e,t){let n=AK(),[r,i]=x.useState(!1);return xK(()=>{e&&t===`trigger-hover`?(i(!0),n.start(500,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function dde(){let e=_2(!0),t=x2(!0),n=L2(!0);return x.useMemo(()=>n?{type:`menubar`,context:n}:e&&!t?{type:`context-menu`,context:e}:{type:void 0},[e,t,n])}function fde(e){return e==null||e.hasAttribute(`disabled`)||e.getAttribute(`aria-disabled`)===`true`}var pde=x.forwardRef(function(e,t){let{render:n,className:r,style:i,label:a,id:o,nativeButton:s=!1,openOnHover:c=!0,delay:l=100,closeDelay:u=0,disabled:d=!1,...f}=e,p=O2(),m=y2(),{store:h}=x2(),g=h1(o),_=h.useState(`open`),v=h.useState(`floatingRootContext`),y=h.useState(`floatingTreeRoot`),b=h.useState(`triggerPopupId`,g),S=l$(g,h),C=x.useCallback(e=>{let t=S(e);return e!==null&&h.select(`open`)&&h.select(`activeTriggerId`)==null&&h.update({activeTriggerId:g,activeTriggerElement:e,closeDelay:u}),t},[S,u,h,g]),w=x.useRef(null),T=x.useCallback(e=>{w.current=e,h.set(`activeTriggerElement`,e)},[h]),E=z2();if(!E?.parentMenu)throw Error(CK(37));h.useSyncedValue(`closeDelay`,u);let D=E.parentMenu,O=D.useState(`itemProps`),k=D.useState(`isActive`,p.index),A=x.useMemo(()=>({type:`submenu-trigger`,setActive(){D.set(`activeIndex`,p.index)}}),[D,p.index]),j=h.useState(`disabled`),M=d||j,{getItemProps:N,itemRef:P}=T2({closeOnClick:!1,disabled:M,highlighted:k,id:g,store:h,typingRef:D.context.typingRef,nativeButton:s,itemMetadata:A,nodeId:m?.context.nodeId}),F=h.useState(`hoverEnabled`),I=D.useState(`allowMouseEnter`),L=L$(v,{enabled:F&&c&&!M,handleClose:$$({blockPointerEvents:!0}),mouseOnly:!0,move:!0,restMs:l,delay:I?{open:l,close:u}:0,triggerElementRef:w,externalTree:y,isClosing:()=>h.select(`transitionStatus`)===`ending`}),ee=wZ(v,{enabled:!M,event:`mousedown`,toggle:!c,ignoreMouse:c,stickIfOpen:!1}).reference??Gq,R=h.useState(`triggerProps`,!0);return delete R.id,UX(`div`,e,{state:{disabled:M,highlighted:k,open:_},stateAttributesMapping:f1,props:[ee,L,R,O,{"aria-controls":b,tabIndex:_||k?0:-1,onBlur(){k&&D.set(`activeIndex`,null)}},f,N],ref:[t,p.ref,P,C,T]})});function mde(e){let[t,n]=x.useState({getBoundingClientRect(){return DOMRect.fromRect({width:0,height:0,x:0,y:0})}}),r=x.useRef(null),i=x.useRef(null),a=x.useRef(null),o=x.useRef(null),s=x.useRef(!0),c=x.useRef(null),l=bX(),u=x.useMemo(()=>({anchor:t,setAnchor:n,actionsRef:a,backdropRef:r,internalBackdropRef:i,positionerRef:o,allowMouseUpTriggerRef:s,initialCursorPointRef:c,rootId:l}),[t,l]);return(0,J.jsx)(g2.Provider,{value:u,children:(0,J.jsx)(b2.Provider,{value:void 0,children:(0,J.jsx)(B2,{...e})})})}function K2({...e}){return(0,J.jsx)(B2,{"data-slot":`dropdown-menu`,...e})}function q2({...e}){return(0,J.jsx)(lde,{"data-slot":`dropdown-menu-trigger`,...e})}var J2=x.forwardRef(({className:e,side:t,align:n=`start`,sideOffset:r=4,alignOffset:i,anchor:a,...o},s)=>{let{container:c,className:l,...u}=W1();return(0,J.jsx)(N2,{container:c,children:(0,J.jsx)(F2,{side:t,align:n,sideOffset:r,alignOffset:i,anchor:a,positionMethod:`fixed`,className:`pn:z-50`,children:(0,J.jsx)(j2,{ref:s,"data-slot":`dropdown-menu-content`,...u,className:rK(l,`pn:z-50 max-h-(--available-height) pn:min-w-[8rem] origin-(--transform-origin) pn:overflow-x-hidden pn:overflow-y-auto pn:rounded-md pn:border pn:bg-popover pn:p-1 pn:text-popover-foreground pn:shadow-md pn:data-[side=bottom]:slide-in-from-top-2 pn:data-[side=left]:slide-in-from-right-2 pn:data-[side=right]:slide-in-from-left-2 pn:data-[side=top]:slide-in-from-bottom-2 pn:data-[closed]:animate-out pn:data-[closed]:fade-out-0 pn:data-[closed]:zoom-out-95 pn:data-[open]:animate-in pn:data-[open]:fade-in-0 pn:data-[open]:zoom-in-95`,e),...o})})})});J2.displayName=`DropdownMenuContent`;var Y2=x.forwardRef(({className:e,inset:t,variant:n=`default`,onSelect:r,onClick:i,...a},o)=>(0,J.jsx)(Kue,{ref:o,"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:rK(`pn:relative pn:flex pn:cursor-default pn:items-center pn:gap-2 pn:rounded-sm pn:px-2 pn:py-1.5 pn:text-sm pn:outline-hidden pn:select-none pn:data-highlighted:bg-accent pn:data-highlighted:text-accent-foreground pn:data-[disabled]:pointer-events-none pn:data-[disabled]:opacity-50 pn:data-[inset]:pl-8 pn:data-[variant=destructive]:text-destructive pn:data-[variant=destructive]:data-highlighted:bg-destructive/10 pn:data-[variant=destructive]:data-highlighted:text-destructive pn:dark:data-[variant=destructive]:data-highlighted:bg-destructive/20 pn:[&_svg]:pointer-events-none pn:[&_svg]:shrink-0 pn:[&_svg:not([class*='size-'])]:size-4 pn:[&_svg:not([class*='text-'])]:text-muted-foreground pn:data-[variant=destructive]:*:[svg]:text-destructive!`,e),onClick:e=>{i?.(e),r?.(e)},...a}));Y2.displayName=`DropdownMenuItem`;var hde=x.forwardRef(({className:e,children:t,checked:n,...r},i)=>(0,J.jsxs)(Vue,{ref:i,"data-slot":`dropdown-menu-checkbox-item`,className:rK(`pn:relative pn:flex pn:cursor-default pn:items-center pn:gap-2 pn:rounded-sm pn:py-1.5 pn:pr-2 pn:pl-8 pn:text-sm pn:outline-hidden pn:select-none pn:data-highlighted:bg-accent pn:data-highlighted:text-accent-foreground pn:data-[disabled]:pointer-events-none pn:data-[disabled]:opacity-50 pn:[&_svg]:pointer-events-none pn:[&_svg]:shrink-0 pn:[&_svg:not([class*='size-'])]:size-4`,e),checked:n,...r,children:[(0,J.jsx)(`span`,{className:`pn:pointer-events-none pn:absolute pn:left-2 pn:flex pn:size-3.5 pn:items-center pn:justify-center`,children:(0,J.jsx)(Hue,{children:(0,J.jsx)(iU,{className:`pn:size-4`})})}),t]}));hde.displayName=`DropdownMenuCheckboxItem`;var gde=x.forwardRef(({className:e,children:t,...n},r)=>(0,J.jsxs)(tde,{ref:r,"data-slot":`dropdown-menu-radio-item`,className:rK(`pn:relative pn:flex pn:cursor-default pn:items-center pn:gap-2 pn:rounded-sm pn:py-1.5 pn:pr-2 pn:pl-8 pn:text-sm pn:outline-hidden pn:select-none pn:data-highlighted:bg-accent pn:data-highlighted:text-accent-foreground pn:data-[disabled]:pointer-events-none pn:data-[disabled]:opacity-50 pn:[&_svg]:pointer-events-none pn:[&_svg]:shrink-0 pn:[&_svg:not([class*='size-'])]:size-4`,e),...n,children:[(0,J.jsx)(`span`,{className:`pn:pointer-events-none pn:absolute pn:left-2 pn:flex pn:size-3.5 pn:items-center pn:justify-center`,children:(0,J.jsx)(nde,{children:(0,J.jsx)(fU,{className:`pn:size-2 pn:fill-current`})})}),t]}));gde.displayName=`DropdownMenuRadioItem`;var _de=x.forwardRef(({className:e,inset:t,...n},r)=>(0,J.jsx)(Gue,{ref:r,"data-slot":`dropdown-menu-label`,"data-inset":t,className:rK(`pn:px-2 pn:py-1.5 pn:text-sm pn:font-medium pn:data-[inset]:pl-8`,e),...n}));_de.displayName=`DropdownMenuLabel`;var X2=x.forwardRef(({className:e,...t},n)=>(0,J.jsx)(s2,{ref:n,"data-slot":`dropdown-menu-separator`,className:rK(`pn:-mx-1 pn:my-1 pn:h-px pn:bg-border`,e),...t}));X2.displayName=`DropdownMenuSeparator`;var vde=x.forwardRef(({className:e,...t},n)=>(0,J.jsx)(`span`,{ref:n,"data-slot":`dropdown-menu-shortcut`,className:rK(`pn:ml-auto pn:text-xs pn:tracking-widest pn:text-muted-foreground`,e),...t}));vde.displayName=`DropdownMenuShortcut`;function yde({...e}){return(0,J.jsx)(sde,{"data-slot":`dropdown-menu-sub`,...e})}var Z2=x.forwardRef(({className:e,inset:t,children:n,...r},i)=>(0,J.jsxs)(pde,{ref:i,"data-slot":`dropdown-menu-sub-trigger`,"data-inset":t,className:rK(`pn:flex pn:cursor-default pn:items-center pn:gap-2 pn:rounded-sm pn:px-2 pn:py-1.5 pn:text-sm pn:outline-hidden pn:select-none pn:data-highlighted:bg-accent pn:data-highlighted:text-accent-foreground pn:data-[inset]:pl-8 pn:data-[popup-open]:bg-accent pn:data-[popup-open]:text-accent-foreground pn:[&_svg]:pointer-events-none pn:[&_svg]:shrink-0 pn:[&_svg:not([class*='size-'])]:size-4 pn:[&_svg:not([class*='text-'])]:text-muted-foreground`,e),...r,children:[n,(0,J.jsx)(sU,{className:`pn:ml-auto pn:size-4`})]}));Z2.displayName=`DropdownMenuSubTrigger`;var Q2=x.forwardRef(({className:e,side:t=`right`,align:n=`start`,sideOffset:r=0,alignOffset:i=-3,...a},o)=>{let{container:s,className:c,...l}=W1();return(0,J.jsx)(N2,{container:s,children:(0,J.jsx)(F2,{side:t,align:n,sideOffset:r,alignOffset:i,positionMethod:`fixed`,className:`pn:z-50`,children:(0,J.jsx)(j2,{ref:o,"data-slot":`dropdown-menu-sub-content`,...l,className:rK(c,`pn:z-50 pn:min-w-[8rem] origin-(--transform-origin) pn:overflow-hidden pn:rounded-md pn:border pn:bg-popover pn:p-1 pn:text-popover-foreground pn:shadow-lg pn:data-[side=bottom]:slide-in-from-top-2 pn:data-[side=left]:slide-in-from-right-2 pn:data-[side=right]:slide-in-from-left-2 pn:data-[side=top]:slide-in-from-bottom-2 pn:data-[closed]:animate-out pn:data-[closed]:fade-out-0 pn:data-[closed]:zoom-out-95 pn:data-[open]:animate-in pn:data-[open]:fade-in-0 pn:data-[open]:zoom-in-95`,e),...a})})})});Q2.displayName=`DropdownMenuSubContent`;var bde=W(({store:e,isOpen:t,offset:n,setIsOpen:r})=>{let i=()=>{r(!1)},{disabled:a,duplicate:o}=Z0({store:e}),{disabled:s,remove:c}=$0({store:e}),{disabled:l,lock:u,locked:d}=h2({store:e}),f=d?(0,J.jsx)($,{name:`action.lock`}):(0,J.jsx)($,{name:`action.unlock`});return e.selectedElements.length===0?null:(0,J.jsx)(mde,{open:t,onOpenChange:e=>{e||i()},children:(0,J.jsxs)(J2,{align:`start`,anchor:{getBoundingClientRect:()=>({x:n.x,y:n.y,width:0,height:0,top:n.y,left:n.x,right:n.x,bottom:n.y,toJSON(){}})},className:`polotno-context-menu`,children:[(0,J.jsxs)(Y2,{onSelect:e=>{e.preventDefault(),u()},disabled:l,children:[f,(0,J.jsx)(`span`,{children:Q(d?`contextMenu.unlock`:`contextMenu.lock`)})]}),(0,J.jsxs)(Y2,{onSelect:()=>{o()},disabled:a,children:[(0,J.jsx)($,{name:`action.duplicate`}),(0,J.jsx)(`span`,{children:Q(`contextMenu.duplicate`)})]}),(0,J.jsxs)(Y2,{onSelect:()=>{c()},disabled:s,children:[(0,J.jsx)($,{name:`action.remove`}),(0,J.jsx)(`span`,{children:Q(`contextMenu.remove`)})]}),(0,J.jsx)(X2,{}),(0,J.jsxs)(yde,{children:[(0,J.jsxs)(Z2,{children:[(0,J.jsx)($,{name:`layering.menu`}),(0,J.jsx)(`span`,{children:Q(`toolbar.layering`)})]}),(0,J.jsxs)(Q2,{className:`polotno-context-menu`,children:[(0,J.jsxs)(Y2,{onSelect:t=>{t.preventDefault(),e.selectedElements.forEach(e=>e.moveTop())},disabled:!e.selectedElements.some(e=>e.parent?.canMoveElementsTop([e.id])),children:[(0,J.jsx)($,{name:`layering.top`}),(0,J.jsx)(`span`,{children:Q(`toolbar.toForward`)})]}),(0,J.jsxs)(Y2,{onSelect:t=>{t.preventDefault(),e.selectedElements.forEach(e=>e.moveUp())},disabled:!e.selectedElements.some(e=>e.parent?.canMoveElementsUp([e.id])),children:[(0,J.jsx)($,{name:`layering.up`}),(0,J.jsx)(`span`,{children:Q(`toolbar.up`)})]}),(0,J.jsxs)(Y2,{onSelect:t=>{t.preventDefault(),e.selectedElements.forEach(e=>e.moveDown())},disabled:!e.selectedElements.some(e=>e.parent?.canMoveElementsDown([e.id])),children:[(0,J.jsx)($,{name:`layering.down`}),(0,J.jsx)(`span`,{children:Q(`toolbar.down`)})]}),(0,J.jsxs)(Y2,{onSelect:t=>{t.preventDefault(),e.selectedElements.forEach(e=>e.moveBottom())},disabled:!e.selectedElements.some(e=>e.parent?.canMoveElementsBottom([e.id])),children:[(0,J.jsx)($,{name:`layering.bottom`}),(0,J.jsx)(`span`,{children:Q(`toolbar.toBottom`)})]})]})]}),e.selectedElements[0]?.type===`table`&&(()=>{let t=e.selectedElements[0],n=t.focusedCells[0],r=n!=null,{minRow:i,maxRow:a,minCol:o,maxCol:s}=t.getFocusedCellRange()??(n?{minRow:n.row,maxRow:n.row,minCol:n.col,maxCol:n.col}:{minRow:0,maxRow:0,minCol:0,maxCol:0}),c=a>i,l=s>o;return(0,J.jsxs)(J.Fragment,{children:[r&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(X2,{}),(0,J.jsx)(Y2,{onSelect:()=>{e.history.transaction(()=>{t.addRow(i)})},children:(0,J.jsx)(`span`,{children:Q(`toolbar.insertRowAbove`)})}),(0,J.jsx)(Y2,{onSelect:()=>{e.history.transaction(()=>{t.addRow(a+1)})},children:(0,J.jsx)(`span`,{children:Q(`toolbar.insertRowBelow`)})}),(0,J.jsx)(Y2,{disabled:t.rows<=a-i+1,onSelect:()=>{e.history.transaction(()=>{t.removeRowRange(i,a)})},children:(0,J.jsx)(`span`,{children:Q(c?`toolbar.deleteRows`:`toolbar.deleteRow`)})}),(0,J.jsx)(X2,{}),(0,J.jsx)(Y2,{onSelect:()=>{e.history.transaction(()=>{t.addColumn(o)})},children:(0,J.jsx)(`span`,{children:Q(`toolbar.insertColumnLeft`)})}),(0,J.jsx)(Y2,{onSelect:()=>{e.history.transaction(()=>{t.addColumn(s+1)})},children:(0,J.jsx)(`span`,{children:Q(`toolbar.insertColumnRight`)})}),(0,J.jsx)(Y2,{disabled:t.cols<=s-o+1,onSelect:()=>{e.history.transaction(()=>{t.removeColumnRange(o,s)})},children:(0,J.jsx)(`span`,{children:Q(l?`toolbar.deleteColumns`:`toolbar.deleteColumn`)})})]}),(0,J.jsx)(X2,{}),(0,J.jsx)(Y2,{onSelect:()=>{e.history.transaction(()=>{t.distributeRowsEvenly()})},children:(0,J.jsx)(`span`,{children:Q(`toolbar.distributeRowsEvenly`)})}),(0,J.jsx)(Y2,{onSelect:()=>{e.history.transaction(()=>{t.distributeColumnsEvenly()})},children:(0,J.jsx)(`span`,{children:Q(`toolbar.distributeColumnsEvenly`)})})]})})()]})})}),xde=({components:e,...t})=>(e||={},e.PageControls=e.PageControls??Rle,e.Tooltip=e.Tooltip??Lue,e.ContextMenu=e.ContextMenu??bde,(0,J.jsx)(CH,{...t,components:e}));function Sde(e=480){let t=(0,x.useRef)(null),[n,r]=(0,x.useState)(!1),i=(0,x.useCallback)(()=>{t.current&&r(t.current.clientWidth<e)},[e]);return(0,x.useEffect)(()=>{let e=t.current;if(!e)return;let n=new ResizeObserver(()=>i());n.observe(e);let r=new MutationObserver(()=>i());return r.observe(e,{childList:!0,subtree:!0,attributes:!0}),window.addEventListener(`resize`,i),requestAnimationFrame(i),()=>{n.disconnect(),r.disconnect(),window.removeEventListener(`resize`,i)}},[i]),{containerRef:t,condensed:n}}var Cde=W(({store:e})=>(0,J.jsxs)(`div`,{className:`pn:flex pn:items-center pn:pr-[10px]`,children:[(0,J.jsx)(uK,{variant:`ghost`,size:`icon-sm`,onClick:()=>{e.history.undo()},disabled:!e.history.canUndo,"aria-label":`Undo`,children:(0,J.jsx)($,{name:`action.undo`,className:`pn:size-4`})}),(0,J.jsx)(uK,{variant:`ghost`,size:`icon-sm`,onClick:()=>{e.history.redo()},disabled:!e.history.canRedo,"aria-label":`Redo`,children:(0,J.jsx)($,{name:`action.redo`,className:`pn:size-4`})})]}));function $2(){return $2=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},$2.apply(null,arguments)}function e4(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function t4(e,t){return t4=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},t4(e,t)}function wde(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,t4(e,t)}var n4=Number.isNaN||function(e){return typeof e==`number`&&e!==e};function Tde(e,t){return!!(e===t||n4(e)&&n4(t))}function Ede(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(!Tde(e[n],t[n]))return!1;return!0}function r4(e,t){t===void 0&&(t=Ede);var n,r=[],i,a=!1;function o(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];return a&&n===this&&t(o,r)?i:(i=e.apply(this,o),a=!0,n=this,r=o,i)}return o}var i4=typeof performance==`object`&&typeof performance.now==`function`?function(){return performance.now()}:function(){return Date.now()};function a4(e){cancelAnimationFrame(e.id)}function Dde(e,t){var n=i4();function r(){i4()-n>=t?e.call(null):i.id=requestAnimationFrame(r)}var i={id:requestAnimationFrame(r)};return i}var o4=-1;function s4(e){if(e===void 0&&(e=!1),o4===-1||e){var t=document.createElement(`div`),n=t.style;n.width=`50px`,n.height=`50px`,n.overflow=`scroll`,document.body.appendChild(t),o4=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return o4}var c4=null;function l4(e){if(e===void 0&&(e=!1),c4===null||e){var t=document.createElement(`div`),n=t.style;n.width=`50px`,n.height=`50px`,n.overflow=`scroll`,n.direction=`rtl`;var r=document.createElement(`div`),i=r.style;return i.width=`100px`,i.height=`100px`,t.appendChild(r),document.body.appendChild(t),t.scrollLeft>0?c4=`positive-descending`:(t.scrollLeft=1,c4=t.scrollLeft===0?`negative`:`positive-ascending`),document.body.removeChild(t),c4}return c4}var Ode=150,kde=function(e,t){return e};function Ade(e){var t,n=e.getItemOffset,r=e.getEstimatedTotalSize,i=e.getItemSize,a=e.getOffsetForIndexAndAlignment,o=e.getStartIndexForOffset,s=e.getStopIndexForStartIndex,c=e.initInstanceProps,l=e.shouldResetStyleCacheOnItemSizeChange,u=e.validateProps;return t=function(e){wde(t,e);function t(t){var r=e.call(this,t)||this;return r._instanceProps=c(r.props,e4(r)),r._outerRef=void 0,r._resetIsScrollingTimeoutId=null,r.state={instance:e4(r),isScrolling:!1,scrollDirection:`forward`,scrollOffset:typeof r.props.initialScrollOffset==`number`?r.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},r._callOnItemsRendered=void 0,r._callOnItemsRendered=r4(function(e,t,n,i){return r.props.onItemsRendered({overscanStartIndex:e,overscanStopIndex:t,visibleStartIndex:n,visibleStopIndex:i})}),r._callOnScroll=void 0,r._callOnScroll=r4(function(e,t,n){return r.props.onScroll({scrollDirection:e,scrollOffset:t,scrollUpdateWasRequested:n})}),r._getItemStyle=void 0,r._getItemStyle=function(e){var t=r.props,a=t.direction,o=t.itemSize,s=t.layout,c=r._getItemStyleCache(l&&o,l&&s,l&&a),u;if(c.hasOwnProperty(e))u=c[e];else{var d=n(r.props,e,r._instanceProps),f=i(r.props,e,r._instanceProps),p=a===`horizontal`||s===`horizontal`,m=a===`rtl`,h=p?d:0;c[e]=u={position:`absolute`,left:m?void 0:h,right:m?h:void 0,top:p?0:d,height:p?`100%`:f,width:p?f:`100%`}}return u},r._getItemStyleCache=void 0,r._getItemStyleCache=r4(function(e,t,n){return{}}),r._onScrollHorizontal=function(e){var t=e.currentTarget,n=t.clientWidth,i=t.scrollLeft,a=t.scrollWidth;r.setState(function(e){if(e.scrollOffset===i)return null;var t=r.props.direction,o=i;if(t===`rtl`)switch(l4()){case`negative`:o=-i;break;case`positive-descending`:o=a-n-i;break}return o=Math.max(0,Math.min(o,a-n)),{isScrolling:!0,scrollDirection:e.scrollOffset<o?`forward`:`backward`,scrollOffset:o,scrollUpdateWasRequested:!1}},r._resetIsScrollingDebounced)},r._onScrollVertical=function(e){var t=e.currentTarget,n=t.clientHeight,i=t.scrollHeight,a=t.scrollTop;r.setState(function(e){if(e.scrollOffset===a)return null;var t=Math.max(0,Math.min(a,i-n));return{isScrolling:!0,scrollDirection:e.scrollOffset<t?`forward`:`backward`,scrollOffset:t,scrollUpdateWasRequested:!1}},r._resetIsScrollingDebounced)},r._outerRefSetter=function(e){var t=r.props.outerRef;r._outerRef=e,typeof t==`function`?t(e):typeof t==`object`&&t&&t.hasOwnProperty(`current`)&&(t.current=e)},r._resetIsScrollingDebounced=function(){r._resetIsScrollingTimeoutId!==null&&a4(r._resetIsScrollingTimeoutId),r._resetIsScrollingTimeoutId=Dde(r._resetIsScrolling,Ode)},r._resetIsScrolling=function(){r._resetIsScrollingTimeoutId=null,r.setState({isScrolling:!1},function(){r._getItemStyleCache(-1,null)})},r}t.getDerivedStateFromProps=function(e,t){return jde(e,t),u(e),null};var d=t.prototype;return d.scrollTo=function(e){e=Math.max(0,e),this.setState(function(t){return t.scrollOffset===e?null:{scrollDirection:t.scrollOffset<e?`forward`:`backward`,scrollOffset:e,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},d.scrollToItem=function(e,t){t===void 0&&(t=`auto`);var n=this.props,r=n.itemCount,i=n.layout,o=this.state.scrollOffset;e=Math.max(0,Math.min(e,r-1));var s=0;if(this._outerRef){var c=this._outerRef;s=i===`vertical`?c.scrollWidth>c.clientWidth?s4():0:c.scrollHeight>c.clientHeight?s4():0}this.scrollTo(a(this.props,e,t,o,this._instanceProps,s))},d.componentDidMount=function(){var e=this.props,t=e.direction,n=e.initialScrollOffset,r=e.layout;if(typeof n==`number`&&this._outerRef!=null){var i=this._outerRef;t===`horizontal`||r===`horizontal`?i.scrollLeft=n:i.scrollTop=n}this._callPropsCallbacks()},d.componentDidUpdate=function(){var e=this.props,t=e.direction,n=e.layout,r=this.state,i=r.scrollOffset;if(r.scrollUpdateWasRequested&&this._outerRef!=null){var a=this._outerRef;if(t===`horizontal`||n===`horizontal`)if(t===`rtl`)switch(l4()){case`negative`:a.scrollLeft=-i;break;case`positive-ascending`:a.scrollLeft=i;break;default:var o=a.clientWidth;a.scrollLeft=a.scrollWidth-o-i;break}else a.scrollLeft=i;else a.scrollTop=i}this._callPropsCallbacks()},d.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&a4(this._resetIsScrollingTimeoutId)},d.render=function(){var e=this.props,t=e.children,n=e.className,i=e.direction,a=e.height,o=e.innerRef,s=e.innerElementType,c=e.innerTagName,l=e.itemCount,u=e.itemData,d=e.itemKey,f=d===void 0?kde:d,p=e.layout,m=e.outerElementType,h=e.outerTagName,g=e.style,_=e.useIsScrolling,v=e.width,y=this.state.isScrolling,b=i===`horizontal`||p===`horizontal`,S=b?this._onScrollHorizontal:this._onScrollVertical,C=this._getRangeToRender(),w=C[0],T=C[1],E=[];if(l>0)for(var D=w;D<=T;D++)E.push((0,x.createElement)(t,{data:u,key:f(D,u),index:D,isScrolling:_?y:void 0,style:this._getItemStyle(D)}));var O=r(this.props,this._instanceProps);return(0,x.createElement)(m||h||`div`,{className:n,onScroll:S,ref:this._outerRefSetter,style:$2({position:`relative`,height:a,width:v,overflow:`auto`,WebkitOverflowScrolling:`touch`,willChange:`transform`,direction:i},g)},(0,x.createElement)(s||c||`div`,{children:E,ref:o,style:{height:b?`100%`:O,pointerEvents:y?`none`:void 0,width:b?O:`100%`}}))},d._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered==`function`&&this.props.itemCount>0){var e=this._getRangeToRender(),t=e[0],n=e[1],r=e[2],i=e[3];this._callOnItemsRendered(t,n,r,i)}if(typeof this.props.onScroll==`function`){var a=this.state,o=a.scrollDirection,s=a.scrollOffset,c=a.scrollUpdateWasRequested;this._callOnScroll(o,s,c)}},d._getRangeToRender=function(){var e=this.props,t=e.itemCount,n=e.overscanCount,r=this.state,i=r.isScrolling,a=r.scrollDirection,c=r.scrollOffset;if(t===0)return[0,0,0,0];var l=o(this.props,c,this._instanceProps),u=s(this.props,l,c,this._instanceProps),d=!i||a===`backward`?Math.max(1,n):1,f=!i||a===`forward`?Math.max(1,n):1;return[Math.max(0,l-d),Math.max(0,Math.min(t-1,u+f)),l,u]},t}(x.PureComponent),t.defaultProps={direction:`ltr`,itemData:void 0,layout:`vertical`,overscanCount:2,useIsScrolling:!1},t}var jde=function(e,t){e.children,e.direction,e.height,e.layout,e.innerTagName,e.outerTagName,e.width,t.instance},Mde=Ade({getItemOffset:function(e,t){return t*e.itemSize},getItemSize:function(e,t){return e.itemSize},getEstimatedTotalSize:function(e){var t=e.itemCount;return e.itemSize*t},getOffsetForIndexAndAlignment:function(e,t,n,r,i,a){var o=e.direction,s=e.height,c=e.itemCount,l=e.itemSize,u=e.layout,d=e.width,f=o===`horizontal`||u===`horizontal`?d:s,p=Math.max(0,c*l-f),m=Math.min(p,t*l),h=Math.max(0,t*l-f+l+a);switch(n===`smart`&&(n=r>=h-f&&r<=m+f?`auto`:`center`),n){case`start`:return m;case`end`:return h;case`center`:var g=Math.round(h+(m-h)/2);return g<Math.ceil(f/2)?0:g>p+Math.floor(f/2)?p:g;default:return r>=h&&r<=m?r:r<h?h:m}},getStartIndexForOffset:function(e,t){var n=e.itemCount,r=e.itemSize;return Math.max(0,Math.min(n-1,Math.floor(t/r)))},getStopIndexForStartIndex:function(e,t,n){var r=e.direction,i=e.height,a=e.itemCount,o=e.itemSize,s=e.layout,c=e.width,l=r===`horizontal`||s===`horizontal`,u=t*o,d=Math.ceil(((l?c:i)+n-u)/o);return Math.max(0,Math.min(a-1,t+d-1))},initInstanceProps:function(e){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(e){e.itemSize}}),u4=Object.prototype.hasOwnProperty;function d4(e,t){var n,r;if(e===t)return!0;if(e&&t&&(n=e.constructor)===t.constructor){if(n===Date)return e.getTime()===t.getTime();if(n===RegExp)return e.toString()===t.toString();if(n===Array){if((r=e.length)===t.length)for(;r--&&d4(e[r],t[r]););return r===-1}if(!n||typeof e==`object`){for(n in r=0,e)if(u4.call(e,n)&&++r&&!u4.call(t,n)||!(n in t)||!d4(e[n],t[n]))return!1;return Object.keys(t).length===r}}return e!==e&&t!==t}var f4=new WeakMap,p4=()=>{},m4=Object,h4=e=>e===void 0,g4=e=>typeof e==`function`,_4=(e,t)=>({...e,...t}),v4=e=>g4(e.then),y4={},b4={},x4=`undefined`,S4=typeof window!=x4,C4=typeof document!=x4,Nde=S4&&`Deno`in window,Pde=()=>S4&&typeof window.requestAnimationFrame!=x4,w4=(e,t)=>{let n=f4.get(e);return[()=>!h4(t)&&e.get(t)||y4,r=>{if(!h4(t)){let i=e.get(t);t in b4||(b4[t]=i),n[5](t,_4(i,r),i||y4)}},n[6],()=>!h4(t)&&t in b4?b4[t]:!h4(t)&&e.get(t)||y4]},T4=!0,Fde=()=>T4,[E4,D4]=S4&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[p4,p4],Ide=()=>{let e=C4&&document.visibilityState;return h4(e)||e!==`hidden`},Lde=e=>(C4&&document.addEventListener(`visibilitychange`,e),E4(`focus`,e),()=>{C4&&document.removeEventListener(`visibilitychange`,e),D4(`focus`,e)}),Rde=e=>{let t=()=>{T4=!0,e()},n=()=>{T4=!1};return E4(`online`,t),E4(`offline`,n),()=>{D4(`online`,t),D4(`offline`,n)}},zde={isOnline:Fde,isVisible:Ide},Bde={initFocus:Lde,initReconnect:Rde},O4=!x.useId,k4=!S4||Nde,Vde=e=>Pde()?window.requestAnimationFrame(e):setTimeout(e,1),A4=k4?x.useEffect:x.useLayoutEffect,j4=typeof navigator<`u`&&navigator.connection,M4=!k4&&j4&&([`slow-2g`,`2g`].includes(j4.effectiveType)||j4.saveData),N4=new WeakMap,Hde=e=>m4.prototype.toString.call(e),P4=(e,t)=>e===`[object ${t}]`,Ude=0,F4=e=>{let t=typeof e,n=Hde(e),r=P4(n,`Date`),i=P4(n,`RegExp`),a=P4(n,`Object`),o,s;if(m4(e)===e&&!r&&!i){if(o=N4.get(e),o)return o;if(o=++Ude+`~`,N4.set(e,o),Array.isArray(e)){for(o=`@`,s=0;s<e.length;s++)o+=F4(e[s])+`,`;N4.set(e,o)}if(a){o=`#`;let t=m4.keys(e).sort();for(;!h4(s=t.pop());)h4(e[s])||(o+=s+`:`+F4(e[s])+`,`);N4.set(e,o)}}else o=r?e.toJSON():t==`symbol`?e.toString():t==`string`?JSON.stringify(e):``+e;return o},I4=e=>{if(g4(e))try{e=e()}catch{e=``}let t=e;return e=typeof e==`string`?e:(Array.isArray(e)?e.length:e)?F4(e):``,[e,t]},Wde=0,L4=()=>++Wde;async function R4(...e){let[t,n,r,i]=e,a=_4({populateCache:!0,throwOnError:!0},typeof i==`boolean`?{revalidate:i}:i||{}),o=a.populateCache,s=a.rollbackOnError,c=a.optimisticData,l=e=>typeof s==`function`?s(e):s!==!1,u=a.throwOnError;if(g4(n)){let e=n,r=[],i=t.keys();for(let n of i)!/^\$(inf|sub)\$/.test(n)&&e(t.get(n)._k)&&r.push(n);return Promise.all(r.map(d))}return d(n);async function d(n){let[i]=I4(n);if(!i)return;let[s,d]=w4(t,i),[f,p,m,h]=f4.get(t),g=()=>{let e=f[i];return(g4(a.revalidate)?a.revalidate(s().data,n):a.revalidate!==!1)&&(delete m[i],delete h[i],e&&e[0])?e[0](2).then(()=>s().data):s().data};if(e.length<3)return g();let _=r,v,y=!1,b=L4();p[i]=[b,0];let x=!h4(c),S=s(),C=S.data,w=S._c,T=h4(w)?C:w;if(x&&(c=g4(c)?c(T,C):c,d({data:c,_c:T})),g4(_))try{_=_(T)}catch(e){v=e,y=!0}if(_&&v4(_))if(_=await _.catch(e=>{v=e,y=!0}),b!==p[i][0]){if(y)throw v;return _}else y&&x&&l(v)&&(o=!0,d({data:T,_c:void 0}));if(o&&(y||(g4(o)?d({data:o(_,T),error:void 0,_c:void 0}):d({data:_,error:void 0,_c:void 0}))),p[i][1]=L4(),Promise.resolve(g()).then(()=>{d({_c:void 0})}),y){if(u)throw v;return}return _}}var z4=(e,t)=>{for(let n in e)e[n][0]&&e[n][0](t)},B4=(e,t)=>{if(!f4.has(e)){let n=_4(Bde,t),r=Object.create(null),i=R4.bind(void 0,e),a=p4,o=Object.create(null),s=(e,t)=>{let n=o[e]||[];return o[e]=n,n.push(t),()=>n.splice(n.indexOf(t),1)},c=(t,n,r)=>{e.set(t,n);let i=o[t];if(i)for(let e of i)e(n,r)},l=()=>{if(!f4.has(e)&&(f4.set(e,[r,Object.create(null),Object.create(null),Object.create(null),i,c,s]),!k4)){let t=n.initFocus(setTimeout.bind(void 0,z4.bind(void 0,r,0))),i=n.initReconnect(setTimeout.bind(void 0,z4.bind(void 0,r,1)));a=()=>{t&&t(),i&&i(),f4.delete(e)}}};return l(),[e,i,l,a]}return[e,f4.get(e)[4]]},Gde=(e,t,n,r,i)=>{let a=n.errorRetryCount,o=i.retryCount,s=~~((Math.random()+.5)*(1<<(o<8?o:8)))*n.errorRetryInterval;!h4(a)&&o>a||setTimeout(r,s,i)},Kde=d4,[V4,qde]=B4(new Map),H4=_4({onLoadingSlow:p4,onSuccess:p4,onError:p4,onErrorRetry:Gde,onDiscarded:p4,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:M4?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:M4?5e3:3e3,compare:Kde,isPaused:()=>!1,cache:V4,mutate:qde,fallback:{}},zde),U4=(e,t)=>{let n=_4(e,t);if(t){let{use:r,fallback:i}=e,{use:a,fallback:o}=t;r&&a&&(n.use=r.concat(a)),i&&o&&(n.fallback=_4(i,o))}return n},W4=(0,x.createContext)({}),Jde=e=>{let{value:t}=e,n=(0,x.useContext)(W4),r=g4(t),i=(0,x.useMemo)(()=>r?t(n):t,[r,n,t]),a=(0,x.useMemo)(()=>r?i:U4(n,i),[r,n,i]),o=i&&i.provider,s=(0,x.useRef)(void 0);o&&!s.current&&(s.current=B4(o(a.cache||V4),i));let c=s.current;return c&&(a.cache=c[0],a.mutate=c[1]),A4(()=>{if(c)return c[2]&&c[2](),c[3]},[]),(0,x.createElement)(W4.Provider,_4(e,{value:a}))},Yde=`$inf$`,G4=S4&&window.__SWR_DEVTOOLS_USE__,Xde=G4?window.__SWR_DEVTOOLS_USE__:[],Zde=()=>{G4&&(window.__SWR_DEVTOOLS_REACT__=x.default)},K4=e=>g4(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(e[1]===null?e[2]:e[1])||{}],Qde=()=>{let e=(0,x.useContext)(W4);return(0,x.useMemo)(()=>_4(H4,e),[e])},$de=Xde.concat(e=>(t,n,r)=>e(t,n&&((...e)=>{let[r]=I4(t),[,,,i]=f4.get(V4);if(r.startsWith(`$inf$`))return n(...e);let a=i[r];return h4(a)?n(...e):(delete i[r],a)}),r)),efe=e=>function(...t){let n=Qde(),[r,i,a]=K4(t),o=U4(n,a),s=e,{use:c}=o,l=(c||[]).concat($de);for(let e=l.length;e--;)s=l[e](s);return s(r,i||o.fetcher||null,o)},tfe=(e,t,n)=>{let r=t[e]||(t[e]=[]);return r.push(n),()=>{let e=r.indexOf(n);e>=0&&(r[e]=r[r.length-1],r.pop())}},nfe=(e,t)=>(...n)=>{let[r,i,a]=K4(n),o=(a.use||[]).concat(t);return e(r,i,{...a,use:o})};Zde();var q4=x.use||(e=>{switch(e.status){case`pending`:throw e;case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:throw e.status=`pending`,e.then(t=>{e.status=`fulfilled`,e.value=t},t=>{e.status=`rejected`,e.reason=t}),e}}),J4={dedupe:!0},Y4=Promise.resolve(void 0),rfe=()=>p4,ife=(e,t,n)=>{let{cache:r,compare:i,suspense:a,fallbackData:o,revalidateOnMount:s,revalidateIfStale:c,refreshInterval:l,refreshWhenHidden:u,refreshWhenOffline:d,keepPreviousData:f,strictServerPrefetchWarning:p}=n,[m,h,g,_]=f4.get(r),[v,y]=I4(e),b=(0,x.useRef)(!1),S=(0,x.useRef)(!1),C=(0,x.useRef)(v),w=(0,x.useRef)(t),T=(0,x.useRef)(n),E=()=>T.current,D=()=>E().isVisible()&&E().isOnline(),[O,k,A,j]=w4(r,v),M=(0,x.useRef)({}).current,N=h4(o)?h4(n.fallback)?void 0:n.fallback[v]:o,P=(e,t)=>{for(let n in M){let r=n;if(r===`data`){if(!i(e[r],t[r])&&(!h4(e[r])||!i(H,t[r])))return!1}else if(t[r]!==e[r])return!1}return!0},F=!b.current,I=(0,x.useMemo)(()=>{let e=O(),n=j(),r=e=>{let n=_4(e);return delete n._k,!(!v||!t||E().isPaused())&&(F&&!h4(s)?s:h4(h4(N)?n.data:N)||c)?{isValidating:!0,isLoading:!0,...n}:n},i=r(e),a=e===n?i:r(n),o=i;return[()=>{let e=r(O());return P(e,o)?(o.data=e.data,o.isLoading=e.isLoading,o.isValidating=e.isValidating,o.error=e.error,o):(o=e,e)},()=>a]},[r,v]),L=(0,ga.useSyncExternalStore)((0,x.useCallback)(e=>A(v,(t,n)=>{P(n,t)||e()}),[r,v]),I[0],I[1]),ee=m[v]&&m[v].length>0,R=L.data,z=h4(R)?N&&v4(N)?q4(N):N:R,B=L.error,V=(0,x.useRef)(z),H=f?h4(R)?h4(V.current)?z:V.current:R:z,te=v&&h4(z),U=(0,x.useRef)(null);!k4&&(0,ga.useSyncExternalStore)(rfe,()=>(U.current=!1,U),()=>(U.current=!0,U));let ne=U.current;p&&ne&&!a&&te&&console.warn(`Missing pre-initiated data for serialized key "${v}" during server-side rendering. Data fetching should be initiated on the server and provided to SWR via fallback data. You can set "strictServerPrefetchWarning: false" to disable this warning.`);let re=!v||!t||E().isPaused()||ee&&!h4(B)?!1:F&&!h4(s)?s:a?h4(z)?!1:c:h4(z)||c,ie=F&&re,ae=h4(L.isValidating)?ie:L.isValidating,oe=h4(L.isLoading)?ie:L.isLoading,se=(0,x.useCallback)(async e=>{let t=w.current;if(!v||!t||S.current||E().isPaused())return!1;let r,a,o=!0,s=e||{},c=!g[v]||!s.dedupe,l=()=>O4?!S.current&&v===C.current&&b.current:v===C.current,u={isValidating:!1,isLoading:!1},d=()=>{k(u)},f=()=>{let e=g[v];e&&e[1]===a&&delete g[v]},p={isValidating:!0};h4(O().data)&&(p.isLoading=!0);try{if(c&&(k(p),n.loadingTimeout&&h4(O().data)&&setTimeout(()=>{o&&l()&&E().onLoadingSlow(v,n)},n.loadingTimeout),g[v]=[t(y),L4()]),[r,a]=g[v],r=await r,c&&setTimeout(f,n.dedupingInterval),!g[v]||g[v][1]!==a)return c&&l()&&E().onDiscarded(v),!1;u.error=void 0;let e=h[v];if(!h4(e)&&(a<=e[0]||a<=e[1]||e[1]===0))return d(),c&&l()&&E().onDiscarded(v),!1;let s=O().data;u.data=i(s,r)?s:r,c&&l()&&E().onSuccess(r,v,n)}catch(e){f();let t=E(),{shouldRetryOnError:n}=t;t.isPaused()||(u.error=e,c&&l()&&(t.onError(e,v,t),(n===!0||g4(n)&&n(e))&&(!E().revalidateOnFocus||!E().revalidateOnReconnect||D())&&t.onErrorRetry(e,v,t,e=>{let t=m[v];t&&t[0]&&t[0](3,e)},{retryCount:(s.retryCount||0)+1,dedupe:!0})))}return o=!1,d(),!0},[v,r]),ce=(0,x.useCallback)((...e)=>R4(r,C.current,...e),[]);if(A4(()=>{w.current=t,T.current=n,h4(R)||(V.current=R)}),A4(()=>{if(!v)return;let e=se.bind(void 0,J4),t=0;E().revalidateOnFocus&&(t=Date.now()+E().focusThrottleInterval);let n=tfe(v,m,(n,r={})=>{if(n==0){let n=Date.now();E().revalidateOnFocus&&n>t&&D()&&(t=n+E().focusThrottleInterval,e())}else if(n==1)E().revalidateOnReconnect&&D()&&e();else if(n==2)return se();else if(n==3)return se(r)});return S.current=!1,C.current=v,b.current=!0,k({_k:y}),re&&(g[v]||(h4(z)||k4?e():Vde(e))),()=>{S.current=!0,n()}},[v]),A4(()=>{let e;function t(){let t=g4(l)?l(O().data):l;t&&e!==-1&&(e=setTimeout(n,t))}function n(){!O().error&&(u||E().isVisible())&&(d||E().isOnline())?se(J4).then(t):t()}return t(),()=>{e&&=(clearTimeout(e),-1)}},[l,u,d,v]),(0,x.useDebugValue)(H),a){if(!O4&&k4&&te)throw Error(`Fallback data is required when using Suspense in SSR.`);te&&(w.current=t,T.current=n,S.current=!1);let e=_[v];if(q4(!h4(e)&&te?ce(e):Y4),!h4(B)&&te)throw B;let r=te?se(J4):Y4;!h4(H)&&te&&(r.status=`fulfilled`,r.value=!0),q4(r)}return{mutate:ce,get data(){return M.data=!0,H},get error(){return M.error=!0,B},get isValidating(){return M.isValidating=!0,ae},get isLoading(){return M.isLoading=!0,oe}}};m4.defineProperty(Jde,`defaultValue`,{value:H4});var X4=efe(ife),Z4=function(e){return e.disabled=`data-disabled`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),afe={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Q4={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},ofe={disabled:!1,...Q4},$4={valid(e){return e===null?null:e?{[Z4.valid]:``}:{[Z4.invalid]:``}}},sfe={invalid:void 0,name:void 0,validityData:{state:afe,errors:[],error:``,value:``,initialValue:null},setValidityData:Uq,disabled:void 0,touched:Q4.touched,setTouched:Uq,dirty:Q4.dirty,setDirty:Uq,filled:Q4.filled,setFilled:Uq,focused:Q4.focused,setFocused:Uq,validate:()=>null,validationMode:`onSubmit`,validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:ofe,markedDirtyRef:{current:!1},registerFieldControl:Uq,validation:{getValidationProps:(e=Gq)=>e,getInputValidationProps:(e=Gq)=>e,inputRef:{current:null},commit:async()=>{}}},cfe=x.createContext(sfe);function e3(e=!0){let t=x.useContext(cfe);if(t.setValidityData===Uq&&!e)throw Error(CK(28));return t}var lfe=x.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Uq,validationMode:`onSubmit`,submitAttemptedRef:{current:!1}});function t3(){return x.useContext(lfe)}var ufe=x.createContext({controlId:void 0,registerControlId:Uq,labelId:void 0,setLabelId:Uq,messageIds:[],setMessageIds:Uq,getDescriptionProps:e=>e});function n3(){return x.useContext(ufe)}function dfe(e,t,n,r=!0,i){let[a,o]=x.useState(),s=h1(i?`${i}-label`:void 0),c=e??t??a;return xK(()=>{let i=e||t||!r?void 0:ffe(n.current,s);a!==i&&o(i)}),c}function ffe(e,t){let n=pfe(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function pfe(e){if(!e)return;let t=e.parentElement;if(t&&t.tagName===`LABEL`)return t;let n=e.id;if(n){let t=e.nextElementSibling;if(t&&t.htmlFor===n)return t}let r=e.labels;return r&&r[0]}function r3(e={}){let{id:t,implicit:n=!1,controlRef:r}=e,{controlId:i,registerControlId:a}=n3(),o=h1(t),s=n?i:void 0,c=fK(()=>Symbol(`labelable-control`)),l=x.useRef(!1),u=x.useRef(t!=null),d=jJ(()=>{!l.current||a===Uq||(l.current=!1,a(c.current,void 0))});return xK(()=>{if(a===Uq)return;let e;if(n){let n=r?.current;e=tq(n)&&n.closest(`label`)!=null?t??null:s??o}else if(t!=null)u.current=!0,e=t;else if(u.current)e=o;else{d();return}if(e===void 0){d();return}l.current=!0,a(c.current,e)},[t,r,s,a,n,o,c,d]),x.useEffect(()=>d,[d]),i??o}function i3(e,t,n,r,i=!0){let{registerFieldControl:a}=e3(),o=x.useRef(null);o.current||=Symbol(),xK(()=>{let s=o.current;if(!(!s||!i))return a(s,{controlRef:e,getValue:r,id:t,value:n}),()=>{a(s,void 0)}},[e,i,r,t,a,n])}var mfe=x.forwardRef(function(e,t){let{render:n,className:r,id:i,name:a,value:o,disabled:s=!1,onValueChange:c,defaultValue:l,autoFocus:u=!1,style:d,...f}=e,{state:p,name:m,disabled:h,setTouched:g,setDirty:_,validityData:v,setFocused:y,setFilled:b,validationMode:S,validation:C}=e3(),w=h||s,T=m??a,E={...p,disabled:w},{labelId:D}=n3(),O=r3({id:i});xK(()=>{let e=o!=null;C.inputRef.current?.value||e&&o!==``?b(!0):e&&o===``&&b(!1)},[C.inputRef,b,o]);let k=x.useRef(null);xK(()=>{u&&k.current===Dq(RJ(k.current))&&y(!0)},[u,y]);let[A]=S2({controlled:o,default:l,name:`FieldControl`,state:`value`}),j=o!==void 0,M=j?A:void 0,N=jJ(()=>C.inputRef.current?.value);return i3(C.inputRef,O,M,N),UX(`input`,e,{ref:[t,k],state:E,props:[{id:O,disabled:w,name:T,ref:C.inputRef,"aria-labelledby":D,autoFocus:u,...j?{value:M}:{defaultValue:l},onChange(e){let t=e.currentTarget.value;c?.(t,pJ(Kq,e.nativeEvent)),_(t!==v.initialValue),b(t!==``)},onFocus(){y(!0)},onBlur(e){g(!0),y(!1),S===`onBlur`&&C.commit(e.currentTarget.value)},onKeyDown(e){e.currentTarget.tagName===`INPUT`&&e.key===`Enter`&&(g(!0),C.commit(e.currentTarget.value))}},C.getInputValidationProps(),f],stateAttributesMapping:$4})}),hfe=x.forwardRef(function(e,t){return(0,J.jsx)(mfe,{ref:t,...e})}),a3=x.forwardRef(({className:e,type:t,...n},r)=>(0,J.jsx)(hfe,{ref:r,type:t,"data-slot":`input`,className:rK(`pn:h-9 pn:w-full pn:min-w-0 pn:rounded-md pn:border pn:border-input pn:bg-transparent pn:px-3 pn:py-1 pn:text-base pn:shadow-xs pn:transition-[color,box-shadow] pn:outline-none pn:selection:bg-primary pn:selection:text-primary-foreground pn:file:inline-flex pn:file:h-7 pn:file:border-0 pn:file:bg-transparent pn:file:text-sm pn:file:font-medium pn:file:text-foreground pn:placeholder:text-muted-foreground pn:disabled:pointer-events-none pn:disabled:cursor-not-allowed pn:disabled:opacity-50 pn:md:text-sm pn:dark:bg-input/30`,`pn:focus-visible:border-ring pn:focus-visible:ring-[3px] pn:focus-visible:ring-ring/50`,`pn:aria-invalid:border-destructive pn:aria-invalid:ring-destructive/20 pn:dark:aria-invalid:ring-destructive/40`,e),...n}));a3.displayName=`Input`;var o3=x.forwardRef(({value:e,onValueChange:t,...n},r)=>{let[i,a]=x.useState(e.toString()),o=x.useRef(i);x.useEffect(()=>{a(e.toString()),o.current=e.toString()},[e]);let{min:s,max:c}=n,l=e=>{let n=e.target.value;a(n);let r=Number(n);Number.isNaN(r)||typeof s==`number`&&r<s||typeof c==`number`&&r>c||t(r)},u=typeof s==`number`||typeof c==`number`,d=e=>{if(u){let n=Number(e.target.value);if(!Number.isNaN(n)){let e=n;typeof s==`number`&&(e=Math.max(s,e)),typeof c==`number`&&(e=Math.min(c,e)),a(e.toString()),e!==n&&t(e)}}n.onBlur?.(e)},{buttonPosition:f,onBlur:p,className:m,stepper:h=!0,style:g,disabled:_,...v}=n,y=Number(n.step)||1,b=n=>{if(_)return;let r=parseFloat(o.current),i=(Number.isNaN(r)?Number(e)||0:r)+n*y;typeof s==`number`&&(i=Math.max(s,i)),typeof c==`number`&&(i=Math.min(c,i)),i=parseFloat(i.toFixed(4)),o.current=String(i),a(String(i)),t(i)},S=x.useRef({}),C=()=>{clearTimeout(S.current.timeout),clearInterval(S.current.interval),S.current={}},w=(e,t)=>{if(!_){try{e.currentTarget.setPointerCapture(e.pointerId)}catch{}b(t),S.current.timeout=window.setTimeout(()=>{S.current.interval=window.setInterval(()=>b(t),50)},300)}};x.useEffect(()=>C,[]);let T=(0,J.jsx)(a3,{ref:r,type:`number`,value:i,onChange:l,onBlur:d,disabled:_,className:rK(`pn:h-8 pn:text-center pn:text-sm pn:[appearance:textfield] pn:[&::-webkit-inner-spin-button]:appearance-none pn:[&::-webkit-outer-spin-button]:appearance-none`,h&&`pn:pr-6`,m),style:h?void 0:g,...v});return h?(0,J.jsxs)(`div`,{className:`pn:relative pn:w-full pn:min-w-16`,style:g,children:[T,(0,J.jsxs)(`div`,{className:`pn:absolute pn:inset-y-0 pn:right-0 pn:flex pn:w-5 pn:flex-col pn:border-l pn:border-input`,children:[(0,J.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-label":`Increment`,disabled:_,className:`pn:flex pn:flex-1 pn:cursor-pointer pn:appearance-none pn:items-center pn:justify-center pn:border-0 pn:bg-transparent pn:text-muted-foreground pn:hover:bg-muted pn:hover:text-foreground pn:disabled:pointer-events-none pn:disabled:opacity-50`,onMouseDown:e=>e.preventDefault(),onPointerDown:e=>w(e,1),onPointerUp:C,onPointerCancel:C,children:(0,J.jsx)(cU,{className:`pn:size-3`})}),(0,J.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-label":`Decrement`,disabled:_,className:`pn:flex pn:flex-1 pn:cursor-pointer pn:appearance-none pn:items-center pn:justify-center pn:border-0 pn:border-t pn:border-input pn:bg-transparent pn:text-muted-foreground pn:hover:bg-muted pn:hover:text-foreground pn:disabled:pointer-events-none pn:disabled:opacity-50`,onMouseDown:e=>e.preventDefault(),onPointerDown:e=>w(e,-1),onPointerUp:C,onPointerCancel:C,children:(0,J.jsx)(aU,{className:`pn:size-3`})})]})]}):T});o3.displayName=`NumericInput`;var s3=o3,c3=x.forwardRef(({className:e,...t},n)=>(0,J.jsx)(`div`,{ref:n,"data-slot":`input-group`,role:`group`,className:rK(`pn:group/input-group pn:relative pn:flex pn:w-full pn:items-center pn:rounded-md pn:border pn:border-input pn:shadow-xs pn:transition-[color,box-shadow] pn:outline-none pn:dark:bg-input/30`,`pn:h-9 pn:min-w-0 pn:has-[>textarea]:h-auto`,`pn:has-[>[data-align=inline-start]]:[&>input]:pl-2`,`pn:has-[>[data-align=inline-end]]:[&>input]:pr-2`,`pn:has-[>[data-align=block-start]]:h-auto pn:has-[>[data-align=block-start]]:flex-col pn:has-[>[data-align=block-start]]:[&>input]:pb-3`,`pn:has-[>[data-align=block-end]]:h-auto pn:has-[>[data-align=block-end]]:flex-col pn:has-[>[data-align=block-end]]:[&>input]:pt-3`,`pn:has-[[data-slot=input-group-control]:focus-visible]:border-ring pn:has-[[data-slot=input-group-control]:focus-visible]:ring-[3px] pn:has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50`,`pn:has-[[data-slot][aria-invalid=true]]:border-destructive pn:has-[[data-slot][aria-invalid=true]]:ring-destructive/20 pn:dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40`,e),...t}));c3.displayName=`InputGroup`;var gfe=cK(`pn:flex pn:h-auto pn:cursor-text pn:items-center pn:justify-center pn:gap-2 pn:py-1.5 pn:text-sm pn:font-medium pn:text-muted-foreground pn:select-none pn:group-data-[disabled=true]/input-group:opacity-50 pn:[&>kbd]:rounded-[calc(var(--radius)-5px)] pn:[&>svg:not([class*='size-'])]:size-4`,{variants:{align:{"inline-start":`pn:order-first pn:pl-3 pn:has-[>button]:ml-[-0.45rem] pn:has-[>kbd]:ml-[-0.35rem]`,"inline-end":`pn:order-last pn:pr-3 pn:has-[>button]:mr-[-0.45rem] pn:has-[>kbd]:mr-[-0.35rem]`,"block-start":`pn:order-first pn:w-full pn:justify-start pn:px-3 pn:pt-3 pn:group-has-[>input]/input-group:pt-2.5 pn:[.border-b]:pb-3`,"block-end":`pn:order-last pn:w-full pn:justify-start pn:px-3 pn:pb-3 pn:group-has-[>input]/input-group:pb-2.5 pn:[.border-t]:pt-3`}},defaultVariants:{align:`inline-start`}}),l3=x.forwardRef(({className:e,align:t=`inline-start`,...n},r)=>(0,J.jsx)(`div`,{ref:r,role:`group`,"data-slot":`input-group-addon`,"data-align":t,className:rK(gfe({align:t}),e),onClick:e=>{e.target.closest(`button`)||e.currentTarget.parentElement?.querySelector(`input`)?.focus()},...n}));l3.displayName=`InputGroupAddon`;var u3=x.forwardRef(({className:e,...t},n)=>(0,J.jsx)(a3,{ref:n,"data-slot":`input-group-control`,className:rK(`pn:flex-1 pn:rounded-none pn:border-0 pn:bg-transparent pn:shadow-none pn:focus-visible:ring-0 pn:dark:bg-transparent`,e),...t}));u3.displayName=`InputGroupInput`;function d3(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}function f3(e,t,n=(e,t)=>e===t){return e.length===t.length&&e.every((e,r)=>n(e,t[r]))}function _fe(e){return e==null?void 0:`${e}-label`}function p3(e,t){return e??t}function m3(e,t){return e-t}function vfe(e,t,n){let r=e.slice();return r[t]=n,r.sort(m3)}function h3(e,t,n,r,i,a){let o=e;return o=d3(o,n,r),i&&(o=vfe(a,t,d3(o,a[t-1]||-1/0,a[t+1]||1/0))),o}function g3(e,t,n){if(!Array.isArray(e))return!0;let r=e.reduce((e,t,n,r)=>(n===r.length-1||e.push(Math.abs(t-r[n+1])),e),[]);return Math.min(...r)>=t*n}var _3={activeThumbIndex:()=>null,max:()=>null,min:()=>null,minStepsBetweenValues:()=>null,step:()=>null,values:()=>null,...$4},v3=x.createContext(void 0);function y3(){let e=x.useContext(v3);if(e===void 0)throw Error(CK(62));return e}function yfe(e){return`key`in e?iJ:eJ}function bfe(e,t){return typeof e==`number`&&typeof t==`number`?e===t:Array.isArray(e)&&Array.isArray(t)?f3(e,t):!1}var xfe=x.forwardRef(function(e,t){let{"aria-labelledby":n,className:r,defaultValue:i,disabled:a=!1,id:o,format:s,largeStep:c=10,locale:l,render:u,max:d=100,min:f=0,minStepsBetweenValues:p=0,form:m,name:h,onValueChange:g,onValueCommitted:_,orientation:v=`horizontal`,step:y=1,thumbCollisionBehavior:b=`push`,thumbAlignment:S=`center`,value:C,style:w,...T}=e,E=h1(o),D=_fe(E),O=jJ(g),k=jJ(_),{clearErrors:A}=t3(),{state:j,disabled:M,name:N,setTouched:P,setDirty:F,validityData:I,shouldValidateOnChange:L,validation:ee}=e3(),{labelId:R}=n3(),[z,B]=x.useState(),V=n??p3(R,z),H=M||a,te=N??h,[U,ne]=S2({controlled:C,default:i??f,name:`Slider`}),re=x.useRef(null),ie=x.useRef(null),ae=x.useRef([]),oe=x.useRef(null),se=x.useRef(null),ce=x.useRef(-1),le=x.useRef(null),ue=x.useRef(null),de=x.useRef(`none`),fe=EJ(s),[pe,me]=x.useState(-1),[he,ge]=x.useState(-1),[_e,ve]=x.useState(!1),[ye,be]=x.useState(()=>new Map),[xe,Se]=x.useState([void 0,void 0]),Ce=jJ(e=>{me(e),e!==-1&&ge(e)});i3(ie,E,U),i0(U,()=>{A(te),L()?ee.commit(U):ee.commit(U,!0);let e=I.initialValue,t;t=Array.isArray(U)&&Array.isArray(e)?!f3(U,e):U!==e,F(t)});let we=jJ(e=>{e&&(ie.current=e)}),Te=Array.isArray(U),Ee=x.useMemo(()=>Te?U.slice().sort(m3):[d3(U,f,d)],[d,f,Te,U]),De=jJ((e,t)=>{if(Number.isNaN(e)||bfe(e,U))return;let n=t??pJ(`none`,void 0,void 0,{activeThumbIndex:-1});de.current=n.reason;let r=n.event,i=new(r.constructor??Event)(r.type,r);Object.defineProperty(i,"target",{writable:!0,value:{value:e,name:te}}),n.event=i,ue.current=e,O(e,n),!n.isCanceled&&ne(e)}),Oe=jJ((e,t,n)=>{let r=h3(e,t,f,d,Te,Ee);if(g3(r,y,p)){let e=yfe(n);De(r,pJ(e,n.nativeEvent,void 0,{activeThumbIndex:t})),P(!0),k(ue.current??r,mJ(e,n.nativeEvent))}});xK(()=>{let e=Dq(RJ(re.current));H&&Oq(re.current,e)&&e.blur()},[H]),H&&pe!==-1&&Ce(-1);let ke=x.useMemo(()=>({...j,activeThumbIndex:pe,disabled:H,dragging:_e,orientation:v,max:d,min:f,minStepsBetweenValues:p,step:y,values:Ee}),[j,pe,H,_e,d,f,p,v,y,Ee]),Ae=x.useMemo(()=>({active:pe,controlRef:ie,disabled:H,dragging:_e,validation:ee,formatOptionsRef:fe,handleInputChange:Oe,indicatorPosition:xe,inset:S!==`center`,labelId:V,rootLabelId:D,largeStep:c,lastUsedThumbIndex:he,lastChangedValueRef:ue,lastChangeReasonRef:de,form:m,locale:l,max:d,min:f,minStepsBetweenValues:p,name:te,onValueCommitted:k,orientation:v,pressedInputRef:oe,pressedThumbCenterOffsetRef:se,pressedThumbIndexRef:ce,pressedValuesRef:le,registerFieldControlRef:we,renderBeforeHydration:S===`edge`,setActive:Ce,setDragging:ve,setIndicatorPosition:Se,setLabelId:B,setValue:De,state:ke,step:y,thumbCollisionBehavior:b,thumbMap:ye,thumbRefs:ae,values:Ee}),[pe,ie,V,D,H,_e,ee,fe,Oe,xe,c,he,ue,de,m,l,d,f,p,te,k,v,oe,se,ce,le,we,Ce,ve,Se,B,De,ke,y,b,S,ye,ae,Ee]),je=UX(`div`,e,{state:ke,ref:[t,re],props:[{"aria-labelledby":V,id:E,role:`group`},ee.getValidationProps,T],stateAttributesMapping:_3});return(0,J.jsx)(v3.Provider,{value:Ae,children:(0,J.jsx)(P2,{elementsRef:ae,onMapChange:be,children:je})})}),b3=new Map;function Sfe(e,t){let n=JSON.stringify({locale:e,options:t}),r=b3.get(n);if(r)return r;let i=new Intl.NumberFormat(e,t);return b3.set(n,i),i}function x3(e,t,n){return e==null?``:Sfe(t,n).format(e)}function S3(e){let t=e.getBoundingClientRect();return{x:(t.left+t.right)/2,y:(t.top+t.bottom)/2}}function C3(e){if(e===0)return 0;if(Math.abs(e)<1){let t=e.toExponential().split(`e-`),n=t[0].split(`.`)[1];return(n?n.length:0)+parseInt(t[1],10)}let t=e.toString().split(`.`)[1];return t?t.length:0}function w3(e,t,n){let r=Math.round((e-n)/t)*t+n;return Number(r.toFixed(Math.max(C3(t),C3(n))))}function T3({values:e,index:t,nextValue:n,min:r,max:i,step:a,minStepsBetweenValues:o,initialValues:s}){if(e.length===0)return[];let c=e.slice(),l=a*o,u=c.length-1,d=s??e;c[t]=d3(n,r+t*l,i-(u-t)*l);for(let e=t+1;e<=u;e+=1){let t=c[e-1]+l,n=i-(u-e)*l,r=d[e]??c[e],a=Math.max(c[e],t);r<a&&(a=Math.max(r,t)),c[e]=d3(a,t,n)}for(let e=t-1;e>=0;--e){let t=c[e+1]-l,n=r+e*l,i=d[e]??c[e],a=Math.min(c[e],t);i>a&&(a=Math.min(i,t)),c[e]=d3(a,n,t)}for(let e=0;e<=u;e+=1)c[e]=Number(c[e].toFixed(12));return c}function Cfe({behavior:e,values:t,currentValues:n,initialValues:r,pressedIndex:i,nextValue:a,min:o,max:s,step:c,minStepsBetweenValues:l}){let u=n??t,d=r??t;if(!(u.length>1))return{value:a,thumbIndex:0,didSwap:!1};let f=c*l;switch(e){case`swap`:{let e=u[i],t=1e-7,n=u.slice(),r=n[i-1],p=n[i+1],m=d3(a,r==null?o:r+f,p==null?s:p-f),h=Number(m.toFixed(12));n[i]=h;let g=a>e,_=a<e,v=g&&p!=null&&a>=p-t,y=_&&r!=null&&a<=r+t;if(!v&&!y)return{value:n,thumbIndex:i,didSwap:!1};let b=v?i+1:i-1,x=n.map((e,t)=>t===i?h:d[t]??u[t]),S=a;S=v?Math.max(a,n[b]):Math.min(a,n[b]);let C=T3({values:n,index:b,nextValue:S,min:o,max:s,step:c,minStepsBetweenValues:l,initialValues:x}),w=v?b-1:b+1;if(w>=0&&w<C.length){let e=C[w-1],t=C[w+1],n=e==null?o:e+f;n=Math.max(n,o+w*f);let r=t==null?s:t-f;r=Math.min(r,s-(C.length-1-w)*f);let i=d3(h,n,r);C[w]=Number(i.toFixed(12))}return{value:C,thumbIndex:b,didSwap:!0}}case`push`:return{value:T3({values:u,index:i,nextValue:a,min:o,max:s,step:c,minStepsBetweenValues:l}),thumbIndex:i,didSwap:!1};default:{let e=u.slice(),t=e[i-1],n=e[i+1],r=d3(a,t==null?o:t+f,n==null?s:n-f);return e[i]=Number(r.toFixed(12)),{value:e,thumbIndex:i,didSwap:!1}}}}var wfe=2;function Tfe(e,t){if(!e)return{start:0,end:0};function n(e){let t=e==null?0:parseFloat(e);return Number.isNaN(t)?0:t}let r=t?`Top`:`InlineStart`,i=t?`Bottom`:`InlineEnd`;return{start:n(e[`border${r}Width`])+n(e[`padding${r}`]),end:n(e[`border${i}Width`])+n(e[`padding${i}`])}}function E3(e,t){if(t.current!=null&&e.changedTouches){let n=e;for(let e=0;e<n.changedTouches.length;e+=1){let r=n.changedTouches[e];if(r.identifier===t.current)return{x:r.clientX,y:r.clientY}}return null}return{x:e.clientX,y:e.clientY}}var Efe=x.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{disabled:o,dragging:s,inset:c,lastChangedValueRef:l,lastChangeReasonRef:u,max:d,min:f,minStepsBetweenValues:p,onValueCommitted:m,orientation:h,pressedInputRef:g,pressedThumbCenterOffsetRef:_,pressedThumbIndexRef:v,pressedValuesRef:y,registerFieldControlRef:b,renderBeforeHydration:S,setActive:C,setDragging:w,setValue:T,state:E,step:D,thumbCollisionBehavior:O,thumbRefs:k,values:A}=y3(),j=k1(),M=A.length>1,N=h===`vertical`,P=x.useRef(null),F=x.useRef(null),I=jJ(e=>{e&&F.current==null&&(F.current=QK(e).getComputedStyle(e))}),L=x.useRef(null),ee=x.useRef(0),R=x.useRef(0),z=EJ(A);function B(e){v.current!==e&&(v.current=e);let t=k.current[e];if(!t){_.current=null,g.current=null;return}g.current=t.querySelector(`input[type="range"]`)}function V(e){let t=P.current;if(!t)return null;let{width:n,height:r,bottom:i,left:a,right:o}=t.getBoundingClientRect(),s=Tfe(F.current,N),c=R.current,l=(N?r:n)-s.start-s.end-c*2,u=_.current??0,m=e.x-u,h=e.y-u,g=d3(((N?i-h-s.end:(j===`rtl`?o-m:m-a)-s.start)-c)/l,0,1),b=(d-f)*g+f;if(b=w3(b,D,f),b=d3(b,f,d),!M)return{value:b,thumbIndex:0,didSwap:!1};let x=v.current;if(x<0)return null;let S=Cfe({behavior:O,values:A,currentValues:z.current??A,initialValues:y.current,pressedIndex:x,nextValue:b,min:f,max:d,step:D,minStepsBetweenValues:p});return O===`swap`&&S.didSwap?B(S.thumbIndex):v.current=S.thumbIndex,S}function H(e){y.current=M?A.slice():null,z.current=A;let t=v.current,n=t;if(t>-1&&t<A.length){if(A[t]===d){let e=t;for(;e>0&&A[e-1]===d;)--e;n=e}}else{let t=N?`y`:`x`,r;n=-1;for(let i=0;i<k.current.length;i+=1){let a=k.current[i];if(tq(a)){let o=S3(a),s=Math.abs(e[t]-o[t]);(r===void 0||s<=r)&&(n=i,r=s)}}}if(n>-1&&n!==t&&B(n),c){let e=k.current[n];tq(e)&&(R.current=e.getBoundingClientRect()[N?`height`:`width`]/2)}}function te(e){let t=k.current?.[e]?.querySelector(`input[type="range"]`);t&&t.focus({preventScroll:!0,focusVisible:!1})}let U=jJ(e=>{let t=E3(e,L);if(t==null)return;if(ee.current+=1,e.type===`pointermove`&&e.buttons===0){ne(e);return}let n=V(t);n!=null&&g3(n.value,D,p)&&(!s&&ee.current>wfe&&w(!0),T(n.value,pJ(aJ,e,void 0,{activeThumbIndex:n.thumbIndex})),z.current=Array.isArray(n.value)?n.value:[n.value],n.didSwap&&te(n.thumbIndex))});function ne(e){C(-1),w(!1),g.current=null,_.current=null;let t=E3(e,L),n=t==null?null:V(t);if(n!=null){let t=u.current;m(l.current??n.value,mJ(t,e))}`pointerType`in e&&P.current?.hasPointerCapture(e.pointerId)&&P.current?.releasePointerCapture(e.pointerId),v.current=-1,L.current=null,y.current=null,ie()}let re=jJ(e=>{if(o)return;let t=e.changedTouches[0];t!=null&&(L.current=t.identifier);let n=E3(e,L);if(n!=null){H(n);let t=V(n);if(t==null)return;te(t.thumbIndex),T(t.value,pJ($q,e,void 0,{activeThumbIndex:t.thumbIndex})),z.current=Array.isArray(t.value)?t.value:[t.value],t.didSwap&&te(t.thumbIndex)}ee.current=0;let r=RJ(P.current);r.addEventListener(`touchmove`,U,{passive:!0}),r.addEventListener(`touchend`,ne,{passive:!0})}),ie=jJ(()=>{let e=RJ(P.current);e.removeEventListener(`pointermove`,U),e.removeEventListener(`pointerup`,ne),e.removeEventListener(`touchmove`,U),e.removeEventListener(`touchend`,ne),y.current=null}),ae=LJ();return x.useEffect(()=>{let e=P.current;if(!e)return()=>ie();let t=vJ(e,`touchstart`,re,{passive:!0});return()=>{t(),ae.cancel(),ie()}},[ie,re,P,ae]),x.useEffect(()=>{o&&ie()},[o,ie]),UX(`div`,e,{state:E,ref:[t,b,P,I],props:[{"data-base-ui-slider-control":S?``:void 0,onPointerDown(e){let t=P.current,n=kq(e.nativeEvent);if(!t||o||e.defaultPrevented||!tq(n)||e.button!==0)return;let r=E3(e,L);if(r!=null){H(r);let n=V(r);if(n==null)return;Oq(k.current[n.thumbIndex],Dq(RJ(t)))?e.preventDefault():ae.request(()=>{te(n.thumbIndex)}),w(!0),_.current??(T(n.value,pJ($q,e.nativeEvent,void 0,{activeThumbIndex:n.thumbIndex})),z.current=Array.isArray(n.value)?n.value:[n.value],n.didSwap&&te(n.thumbIndex))}e.nativeEvent.pointerId&&t.setPointerCapture(e.nativeEvent.pointerId),ee.current=0;let i=RJ(P.current);i.addEventListener(`pointermove`,U,{passive:!0}),i.addEventListener(`pointerup`,ne,{once:!0})}},a],stateAttributesMapping:_3})}),Dfe=x.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{state:o}=y3();return UX(`div`,e,{state:o,ref:t,props:[{style:{position:`relative`}},a],stateAttributesMapping:_3})});function Ofe(){return Uq}function kfe(){return!1}function Afe(){return!0}function D3(){return(0,ga.useSyncExternalStore)(Ofe,kfe,Afe)}function O3(e,t,n){return(e-t)*100/(n-t)}var jfe=x.createContext(void 0),Mfe={disableStyleElements:!1};function k3(){return x.useContext(jfe)??Mfe}var Nfe=function(e){return e.index=`data-index`,e.dragging=`data-dragging`,e.orientation=`data-orientation`,e.disabled=`data-disabled`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.focused=`data-focused`,e}({}),Pfe=new Set([...T0,b0,x0]);function Ffe(e,t,n,r){if(!(t<0))return e.length===2?t===0?`${x3(e[t],r,n)} start range`:`${x3(e[t],r,n)} end range`:n?x3(e[t],r,n):void 0}function A3(e,t,n,r,i){let a=n===1?e+t:e-t;return d3(Number(a.toFixed(Math.max(C3(e),C3(t),C3(r)))),r,i)}var Ife=x.forwardRef(function(e,t){let{render:n,children:r,className:i,"aria-describedby":a,"aria-label":o,"aria-labelledby":s,disabled:c=!1,getAriaLabel:l,getAriaValueText:u,id:d,index:f,inputRef:p,onBlur:m,onFocus:h,onKeyDown:g,tabIndex:_,style:v,...y}=e,{nonce:b}=k3(),S=h1(d),{active:C,lastUsedThumbIndex:w,controlRef:T,disabled:E,validation:D,formatOptionsRef:O,handleInputChange:k,inset:A,labelId:j,largeStep:M,locale:N,max:P,min:F,minStepsBetweenValues:I,form:L,name:ee,orientation:R,pressedInputRef:z,pressedThumbCenterOffsetRef:B,pressedThumbIndexRef:V,renderBeforeHydration:H,setActive:te,setIndicatorPosition:U,state:ne,step:re,values:ie}=y3(),ae=k1(),oe=c||E,se=ie.length>1,ce=R===`vertical`,le=ae===`rtl`,{setTouched:ue,setFocused:de,validationMode:fe}=e3(),pe=x.useRef(null),me=x.useRef(null),he=x.useRef(!1),ge=h1(),_e=r3(),ve=se?ge:_e,{ref:ye,index:be}=O2({metadata:x.useMemo(()=>({inputId:ve}),[ve])}),xe=se?f??be:0,Se=xe===ie.length-1,Ce=ie[xe],we=O3(Ce,F,P),[Te,Ee]=x.useState(),De=D3(),Oe=w>=0&&w<ie.length?w:-1,ke=jJ(()=>{let e=T.current,t=pe.current;if(!e||!t)return;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),i=ce?`height`:`width`,a=r[i]-n[i],o=(n[i]/2+a*we/100)/r[i]*100,s=Number.isFinite(o)?o:void 0;Ee(s),xe===0?U(e=>[s,e[1]]):Se&&U(e=>[e[0],s])});xK(()=>{A&&queueMicrotask(ke)},[ke,A]),xK(()=>{A&&ke()},[ke,A,we]),xK(()=>{if(!A)return;let e=T.current,t=pe.current;if(!e||!t)return;let n=QK(e).ResizeObserver;if(typeof n!=`function`)return;let r=new n(ke);return r.observe(e),r.observe(t),()=>{r.disconnect()}},[T,ke,A]);let Ae=ce?`bottom`:`insetInlineStart`,je=ce?`left`:`top`,Me;se?C===xe?Me=2:Oe===xe&&(Me=1):C===xe&&(Me=1);let Ne;Ne=A?{"--position":`${Te??0}%`,visibility:H&&De||Te===void 0?`hidden`:void 0,position:`absolute`,[Ae]:`var(--position)`,[je]:`50%`,translate:`${(ce||!le?-1:1)*50}% ${(ce?1:-1)*50}%`,zIndex:Me}:Number.isFinite(we)?{position:`absolute`,[Ae]:`${we}%`,[je]:`50%`,translate:`${(ce||!le?-1:1)*50}% ${(ce?1:-1)*50}%`,zIndex:Me}:BJ;let Pe;R===`vertical`&&(Pe=le?`vertical-rl`:`vertical-lr`);let Fe=typeof l==`function`?l(xe):o,Ie=kX({"aria-label":Fe,"aria-labelledby":s??(Fe==null?j:void 0),"aria-describedby":a,"aria-orientation":R,"aria-valuenow":Ce,"aria-valuetext":typeof u==`function`?u(x3(Ce,N,O.current??void 0),Ce,xe):Ffe(ie,xe,O.current??void 0,N),disabled:oe,form:L,id:ve,max:P,min:F,name:ee,onChange(e){k(e.currentTarget.valueAsNumber,xe,e)},onFocus(e){let t=he.current;he.current=!1,te(xe),de(!0),t&&e.stopPropagation()},onBlur(e){if(he.current){e.stopPropagation();return}pe.current&&(te(-1),ue(!0),de(!1),fe===`onBlur`&&D.commit(h3(Ce,xe,F,P,se,ie)))},onKeyDown(e){if(!Pfe.has(e.key))return;T0.has(e.key)&&e.stopPropagation();let t=null,n=w3(Ce,re,F);switch(e.key){case h0:t=A3(n,e.shiftKey?M:re,1,F,P);break;case v0:t=A3(n,e.shiftKey?M:re,le?-1:1,F,P);break;case g0:t=A3(n,e.shiftKey?M:re,-1,F,P);break;case _0:t=A3(n,e.shiftKey?M:re,le?1:-1,F,P);break;case b0:t=A3(n,M,1,F,P);break;case x0:t=A3(n,M,-1,F,P);break;case`End`:t=P,se&&(t=Number.isFinite(ie[xe+1])?ie[xe+1]-re*I:P);break;case y0:t=F,se&&(t=Number.isFinite(ie[xe-1])?ie[xe-1]+re*I:F);break;default:break}if(t!==null){let n=e.currentTarget;Iq(n)||(he.current=!0,n.blur(),n.focus({preventScroll:!0,focusVisible:!0})),k(t,xe,e),e.preventDefault()}},step:re,style:{...BJ,width:`100%`,height:`100%`,writingMode:Pe},tabIndex:_??void 0,type:`range`,value:Ce??``},D.getInputValidationProps),Le=bJ(me,D.inputRef,p);return UX(`div`,e,{state:ne,ref:[t,ye,pe],props:[{[Nfe.index]:xe,children:(0,J.jsxs)(x.Fragment,{children:[r,(0,J.jsx)(`input`,{ref:Le,...Ie,suppressHydrationWarning:!0}),A&&De&&H&&Se&&(0,J.jsx)(`script`,{nonce:b,dangerouslySetInnerHTML:{__html:'!function(){const t=document.currentScript?.parentElement;if(!t)return;const e=t.closest("[data-base-ui-slider-control]");if(!e)return;const r=e.querySelector("[data-base-ui-slider-indicator]"),i=e.getBoundingClientRect(),n="vertical"===e.getAttribute("data-orientation")?"height":"width",o=e.querySelectorAll(\'input[type="range"]\'),l=o.length>1,s=o.length-1;let a=null,u=null;for(let t=0;t<o.length;t+=1){const e=o[t],y=parseFloat(e.getAttribute("value")??"");if(Number.isNaN(y))return;const c=e.parentElement;if(!c)return;const p=parseFloat(e.getAttribute("max")??"100"),g=parseFloat(e.getAttribute("min")??"0"),b=c?.getBoundingClientRect(),d=i[n]-b[n],m=100*(y-g)/(p-g),v=(b[n]/2+d*m/100)/i[n]*100;c.style.setProperty("--position",`${v}%`),Number.isFinite(v)&&(c.style.removeProperty("visibility"),r&&(0===t?(a=v,r.style.setProperty("--start-position",`${v}%`),l||r.style.removeProperty("visibility")):t===s&&(u=v-(a??0),r.style.setProperty("--end-position",`${v}%`),r.style.setProperty("--relative-size",`${u}%`),r.style.removeProperty("visibility"))))}}();'},suppressHydrationWarning:!0})]}),id:S,onBlur:m,onFocus:h,onPointerDown(e){if(V.current=xe,pe.current!=null){let t=R===`horizontal`?`x`:`y`,n=S3(pe.current);B.current=(R===`horizontal`?e.clientX:e.clientY)-n[t]}me.current!=null&&z.current!==me.current&&(z.current=me.current)},style:Ne,suppressHydrationWarning:H||void 0},y],stateAttributesMapping:_3})});function Lfe(e,t,n,r,i,a){let o=n===void 0||t&&r===void 0?`hidden`:void 0,s=e?`bottom`:`insetInlineStart`,c=e?`height`:`width`,l={visibility:i&&a?`hidden`:o,position:e?`absolute`:`relative`,[e?`width`:`height`]:`inherit`};return l[`--start-position`]=`${n??0}%`,t?(l[`--relative-size`]=`${(r??0)-(n??0)}%`,l[s]=`var(--start-position)`,l[c]=`var(--relative-size)`,l):(l[s]=0,l[c]=`var(--start-position)`,l)}function Rfe(e,t,n,r){let i=e?`bottom`:`insetInlineStart`,a=e?`height`:`width`,o={position:e?`absolute`:`relative`,[e?`width`:`height`]:`inherit`};if(!t)return o[i]=0,o[a]=`${n}%`,o;let s=r-n;return o[i]=`${n}%`,o[a]=`${s}%`,o}var zfe=x.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{indicatorPosition:o,inset:s,max:c,min:l,orientation:u,renderBeforeHydration:d,state:f,values:p}=y3(),m=D3(),h=u===`vertical`,g=p.length>1,_=s?Lfe(h,g,o[0],o[1],d,m):Rfe(h,g,O3(p[0],l,c),O3(p[p.length-1],l,c));return UX(`div`,e,{state:f,ref:t,props:[{"data-base-ui-slider-indicator":d?``:void 0,style:_,suppressHydrationWarning:d||void 0},a],stateAttributesMapping:_3})}),j3=x.forwardRef(({className:e,defaultValue:t,value:n,min:r=0,max:i=100,...a},o)=>{let s=x.useMemo(()=>Array.isArray(n)?n:Array.isArray(t)?t:[r,i],[n,t,r,i]);return(0,J.jsx)(xfe,{ref:o,"data-slot":`slider`,defaultValue:t,value:n,min:r,max:i,thumbAlignment:`edge`,className:rK(`pn:relative pn:w-full pn:data-[orientation=vertical]:h-full pn:data-[orientation=vertical]:min-h-44 pn:data-[orientation=vertical]:w-auto`,e),...a,children:(0,J.jsxs)(Efe,{className:rK(`pn:relative pn:flex pn:w-full pn:touch-none pn:items-center pn:select-none pn:data-[disabled]:opacity-50 pn:data-[orientation=vertical]:h-full pn:data-[orientation=vertical]:w-auto pn:data-[orientation=vertical]:flex-col`),children:[(0,J.jsx)(Dfe,{"data-slot":`slider-track`,className:rK(`pn:relative pn:grow pn:overflow-hidden pn:rounded-full pn:bg-muted pn:data-[orientation=horizontal]:h-1.5 pn:data-[orientation=horizontal]:w-full pn:data-[orientation=vertical]:h-full pn:data-[orientation=vertical]:w-1.5`),children:(0,J.jsx)(zfe,{"data-slot":`slider-range`,className:rK(`pn:absolute pn:bg-primary pn:data-[orientation=horizontal]:h-full pn:data-[orientation=vertical]:w-full`)})}),Array.from({length:s.length},(e,t)=>(0,J.jsx)(Ife,{"data-slot":`slider-thumb`,className:`pn:block pn:size-4 pn:shrink-0 pn:rounded-full pn:border pn:border-primary pn:bg-background pn:shadow-sm pn:ring-ring/50 pn:transition-[color,box-shadow] pn:hover:ring-4 pn:focus-visible:ring-4 pn:focus-visible:outline-hidden pn:disabled:pointer-events-none pn:disabled:opacity-50`},t))]})})});j3.displayName=`Slider`;var M3=x.createContext(void 0);function Bfe(){let e=x.useContext(M3);if(e===void 0)throw Error(CK(63));return e}var N3=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.disabled=`data-disabled`,e.readonly=`data-readonly`,e.required=`data-required`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),P3={...$4,checked(e){return e?{[N3.checked]:``}:{[N3.unchecked]:``}}},Vfe=x.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i,"aria-labelledby":a,form:o,id:s,inputRef:c,name:l,nativeButton:u=!1,onCheckedChange:d,readOnly:f=!1,required:p=!1,disabled:m=!1,render:h,uncheckedValue:g,value:_,style:v,...y}=e,{clearErrors:b}=t3(),{state:S,setTouched:C,setDirty:w,validityData:T,setFilled:E,setFocused:D,shouldValidateOnChange:O,validationMode:k,disabled:A,name:j,validation:M}=e3(),{labelId:N}=n3(),P=A||m,F=j??l,I=x.useRef(null),L=bJ(I,c,M.inputRef),ee=x.useRef(null),R=h1(),z=r3({id:s,implicit:!1,controlRef:ee}),B=u?void 0:z,[V,H]=S2({controlled:n,default:!!i,name:`Switch`,state:`checked`});i3(ee,R,V),xK(()=>{I.current&&E(I.current.checked)},[I,E]),i0(V,()=>{b(F),w(V!==T.initialValue),E(V),O()?M.commit(V):M.commit(V,!0)});let{getButtonProps:te,buttonRef:U}=t0({disabled:P,native:u}),ne=dfe(a,N,I,!u,B),re={id:u?z:R,role:`switch`,"aria-checked":V,"aria-readonly":f||void 0,"aria-required":p||void 0,"aria-labelledby":ne,onFocus(){P||D(!0)},onBlur(){let e=I.current;!e||P||(C(!0),D(!1),k===`onBlur`&&M.commit(e.checked))},onClick(e){if(f||P)return;e.preventDefault();let t=I.current;t&&t.dispatchEvent(new(QK(t)).PointerEvent(`click`,{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey}))}},ie=kX({checked:V,disabled:P,form:o,id:B,name:F,required:p,style:F?VJ:BJ,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,ref:L,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(f){e.preventDefault();return}let t=e.currentTarget.checked,n=pJ(Kq,e.nativeEvent);d?.(t,n),!n.isCanceled&&H(t)},onFocus(){ee.current?.focus()}},M.getInputValidationProps,_===void 0?Gq:{value:_}),ae=x.useMemo(()=>({...S,checked:V,disabled:P,readOnly:f,required:p}),[S,V,P,f,p]),oe=UX(`span`,e,{state:ae,ref:[t,ee,U],props:[re,M.getValidationProps,y,te],stateAttributesMapping:P3});return(0,J.jsxs)(M3.Provider,{value:ae,children:[oe,!V&&F&&g!==void 0&&(0,J.jsx)(`input`,{type:`hidden`,form:o,name:F,value:g}),(0,J.jsx)(`input`,{...ie,suppressHydrationWarning:!0})]})}),Hfe=x.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e;return UX(`span`,e,{state:Bfe(),ref:t,stateAttributesMapping:P3,props:a})}),F3=x.forwardRef(({className:e,...t},n)=>(0,J.jsx)(Vfe,{ref:n,"data-slot":`switch`,className:rK(`pn:peer pn:group/switch pn:relative pn:inline-flex pn:shrink-0 pn:items-center pn:rounded-full pn:border pn:border-transparent pn:shadow-xs pn:transition-all pn:outline-none pn:after:absolute pn:after:-inset-x-3 pn:after:-inset-y-2 pn:focus-visible:border-ring pn:focus-visible:ring-[3px] pn:focus-visible:ring-ring/50 pn:aria-invalid:border-destructive pn:aria-invalid:ring-[3px] pn:aria-invalid:ring-destructive/20 pn:dark:aria-invalid:border-destructive/50 pn:dark:aria-invalid:ring-destructive/40 pn:data-disabled:cursor-not-allowed pn:data-disabled:opacity-50 pn:h-[1.15rem] pn:w-8 pn:data-checked:bg-primary pn:data-unchecked:bg-input pn:dark:data-unchecked:bg-input/80`,e),...t,children:(0,J.jsx)(Hfe,{"data-slot":`switch-thumb`,className:rK(`pn:pointer-events-none pn:block pn:rounded-full pn:bg-background pn:ring-0 pn:transition-transform pn:size-4 pn:data-checked:translate-x-[calc(100%-2px)] pn:data-unchecked:translate-x-0 pn:dark:data-checked:bg-primary-foreground pn:dark:data-unchecked:bg-foreground`)})}));F3.displayName=`Switch`;function I3({label:e,value:t,onChange:n,min:r,max:i,step:a=1,disabled:o,className:s,visible:c=!0,enabled:l,onEnabledChange:u,sliderMax:d,onCommit:f}){if(!c)return null;let p=e=>{let t=e;return typeof r==`number`&&(t=Math.max(r,t)),typeof i==`number`&&(t=Math.min(i,t)),t},m=(0,J.jsx)(o3,{value:t,onValueChange:e=>n(p(e)),min:r,max:i,step:a,disabled:o,style:{width:64}}),h=(0,J.jsx)(j3,{value:[t],onValueChange:e=>n(p(aK(e))),onValueCommitted:f?e=>f(p(aK(e))):void 0,min:r,max:d??i,step:a,disabled:o});return u?(0,J.jsxs)(`div`,{className:rK(`pn:py-1`,s),children:[(0,J.jsxs)(`div`,{className:`pn:flex pn:items-center pn:justify-between pn:gap-2 pn:py-1`,children:[(0,J.jsx)(`label`,{className:`pn:text-sm pn:font-medium`,children:e}),(0,J.jsx)(F3,{checked:!!l,onCheckedChange:u,disabled:o})]}),l&&(0,J.jsxs)(`div`,{className:`pn:mt-1.5 pn:flex pn:items-center pn:gap-2.5 pn:rounded-lg pn:bg-muted/60 pn:px-3 pn:py-2.5`,children:[(0,J.jsx)(`div`,{className:`pn:flex-1`,children:h}),m]})]}):(0,J.jsxs)(`div`,{className:rK(`pn:flex pn:flex-col pn:gap-2 pn:py-2`,s),children:[(0,J.jsxs)(`div`,{className:`pn:flex pn:items-center pn:justify-between pn:gap-2`,children:[(0,J.jsx)(`label`,{className:`pn:text-sm`,children:e}),m]}),h]})}function L3(e,t){return e[(e.indexOf(t)+1)%e.length]}var R3=()=>(0,J.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,J.jsx)(`line`,{x1:`3`,y1:`6`,x2:`21`,y2:`6`,strokeWidth:`1`}),(0,J.jsx)(`line`,{x1:`3`,y1:`12`,x2:`21`,y2:`12`,strokeWidth:`2`}),(0,J.jsx)(`line`,{x1:`3`,y1:`18`,x2:`21`,y2:`18`,strokeWidth:`3`})]}),z3={solid:()=>(0,J.jsx)(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,children:(0,J.jsx)(`line`,{x2:`24`,y1:`50%`,y2:`50%`,stroke:`currentColor`,strokeWidth:`2`})}),large:()=>(0,J.jsx)(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,children:(0,J.jsx)(`line`,{x1:`-1`,x2:`25`,y1:`50%`,y2:`50%`,stroke:`currentColor`,strokeDasharray:`12 2`,strokeWidth:`2`})}),medium:()=>(0,J.jsx)(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,children:(0,J.jsx)(`line`,{x1:`1`,x2:`23`,y1:`50%`,y2:`50%`,stroke:`currentColor`,strokeDasharray:`6 2`,strokeWidth:`2`})}),small:()=>(0,J.jsx)(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,children:(0,J.jsx)(`line`,{x1:`1`,x2:`23`,y1:`50%`,y2:`50%`,stroke:`currentColor`,strokeDasharray:`2 2`,strokeWidth:`2`})})},B3=({active:e,onClick:t,icon:n,...r})=>(0,J.jsx)(uK,{variant:`outline`,size:`sm`,onClick:t,className:rK(e&&`pn:bg-muted`),...r,children:n}),V3=e=>{let t=x.useRef(e);return t.current=e,x.useCallback((...e)=>t.current(...e),[])},Ufe=e=>{let t=[`r`,`g`,`b`,`a`,`h`,`s`,`l`,`v`],n=0,r=0;return yD(t,t=>{e[t]&&(n+=1,isNaN(e[t])||(r+=1),(t===`s`||t===`l`)&&/^\d+%$/.test(e[t])&&(r+=1))}),n===r?e:!1},H3=(e,t)=>{let n=e.hex?Py(e.hex):Py(e),r=n.toHsl(),i=n.toHsv(),a=n.toRgb(),o=n.toHex();return r.s===0&&(r.h=t||0,i.h=t||0),{hsl:r,hex:o===`000000`&&a.a===0?`transparent`:`#`+o,rgb:a,hsv:i,oldHue:e.h||t||r.h,source:e.source}},Wfe=e=>{if(e===`transparent`)return!0;let t=+(String(e).charAt(0)===`#`);return e.length!==4+t&&e.length<7+t&&Py(e).isValid()},Gfe=(e,t,n)=>{let{width:r,height:i}=n.getBoundingClientRect(),a=typeof e.pageX==`number`?e.pageX:e.touches[0].pageX,o=typeof e.pageY==`number`?e.pageY:e.touches[0].pageY,s=a-(n.getBoundingClientRect().left+window.pageXOffset),c=o-(n.getBoundingClientRect().top+window.pageYOffset),l=s;l<0?l=0:l>r&&(l=r);let u=c;u<0?u=0:u>i&&(u=i);let d=l/r,f=1-u/i;return{h:t.h,s:d,v:f,a:t.a,source:`hsv`}},Kfe=(e,t,n,r)=>{let i=r.clientWidth,a=r.clientHeight,o=typeof e.pageX==`number`?e.pageX:e.touches[0].pageX,s=typeof e.pageY==`number`?e.pageY:e.touches[0].pageY,c=o-(r.getBoundingClientRect().left+window.pageXOffset),l=s-(r.getBoundingClientRect().top+window.pageYOffset);if(t===`vertical`){let e;if(e=l<0?359:l>a?0:360*(-(l*100/a)+100)/100,n.h!==e)return{h:e,s:n.s,l:n.l,a:n.a,source:`hsl`}}else{let e;if(e=c<0?0:c>i?359:360*(c*100/i)/100,n.h!==e)return{h:e,s:n.s,l:n.l,a:n.a,source:`hsl`}}return null},qfe=(e,t,n,r,i)=>{let a=i.clientWidth,o=i.clientHeight,s=typeof e.pageX==`number`?e.pageX:e.touches[0].pageX,c=typeof e.pageY==`number`?e.pageY:e.touches[0].pageY,l=s-(i.getBoundingClientRect().left+window.pageXOffset),u=c-(i.getBoundingClientRect().top+window.pageYOffset);if(n===`vertical`){let e;if(e=u<0?0:u>o?1:Math.round(u*100/o)/100,t.a!==e)return{h:t.h,s:t.s,l:t.l,a:e,source:`rgb`}}else{let e;if(e=l<0?0:l>a?1:Math.round(l*100/a)/100,r!==e)return{h:t.h,s:t.s,l:t.l,a:e,source:`rgb`}}return null},U3={},Jfe=(e,t,n,r)=>{if(typeof document>`u`&&!r)return null;let i=r?new r:document.createElement(`canvas`);i.width=n*2,i.height=n*2;let a=i.getContext(`2d`);return a?(a.fillStyle=e,a.fillRect(0,0,i.width,i.height),a.fillStyle=t,a.fillRect(0,0,n,n),a.translate(n,n),a.fillRect(0,0,n,n),i.toDataURL()):null},Yfe=(e,t,n,r)=>{let i=e+`-`+t+`-`+n+(r?`-server`:``);if(U3[i])return U3[i];let a=Jfe(e,t,n,r);return U3[i]=a,a},Xfe=`linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%)`,W3=Yfe(`transparent`,`rgba(0,0,0,.08)`,8)||void 0,G3=W3?`url(${W3})`:void 0;function Zfe(e,t){let n=e.target;for(;n;){if(n.classList?.contains(t))return!0;n=n.parentElement}return!1}function Qfe({hsl:e,hsv:t,onChange:n}){let r=x.useRef(null),i=V3(t=>{r.current&&n(Gfe(t,e,r.current))}),a=V3(()=>{window.removeEventListener(`mousemove`,i),window.removeEventListener(`mouseup`,a)});return x.useEffect(()=>()=>{window.removeEventListener(`mousemove`,i),window.removeEventListener(`mouseup`,a)},[i,a]),(0,J.jsxs)(`div`,{ref:r,className:`pn:relative pn:aspect-[5/3] pn:w-full pn:cursor-crosshair pn:touch-none pn:overflow-hidden pn:rounded-sm pn:ring-1 pn:ring-inset pn:ring-black/15 pn:dark:ring-white/15`,style:{background:`hsl(${e.h}, 100%, 50%)`},onMouseDown:e=>{i(e),window.addEventListener(`mousemove`,i),window.addEventListener(`mouseup`,a)},onTouchStart:e=>i(e),onTouchMove:e=>i(e),children:[(0,J.jsx)(`div`,{className:`pn:absolute pn:inset-0`,style:{background:`linear-gradient(to right, #fff, rgba(255,255,255,0))`},children:(0,J.jsx)(`div`,{className:`pn:absolute pn:inset-0`,style:{background:`linear-gradient(to top, #000, rgba(0,0,0,0))`}})}),(0,J.jsx)(`div`,{className:`pn:pointer-events-none pn:absolute pn:size-3 pn:-translate-x-1/2 pn:-translate-y-1/2 pn:rounded-full pn:border-2 pn:border-white pn:shadow-[0_0_0_1px_rgba(0,0,0,0.3)]`,style:{left:`${t.s*100}%`,top:`${-(t.v*100)+100}%`}})]})}function K3({ariaLabel:e,style:t,pointerLeft:n,calc:r,onChange:i,children:a}){let o=x.useRef(null),s=V3(e=>{if(o.current){let t=r(e,o.current);t&&i(t)}}),c=V3(()=>{window.removeEventListener(`mousemove`,s),window.removeEventListener(`mouseup`,c)});return x.useEffect(()=>()=>{window.removeEventListener(`mousemove`,s),window.removeEventListener(`mouseup`,c)},[s,c]),(0,J.jsxs)(`div`,{ref:o,role:`slider`,"aria-label":e,className:`pn:relative pn:h-2.5 pn:w-full pn:cursor-pointer pn:touch-none pn:rounded-full pn:ring-1 pn:ring-inset pn:ring-black/15 pn:dark:ring-white/15`,style:t,onMouseDown:e=>{s(e),window.addEventListener(`mousemove`,s),window.addEventListener(`mouseup`,c)},onTouchStart:e=>s(e),onTouchMove:e=>s(e),children:[a,(0,J.jsx)(`div`,{className:`pn:pointer-events-none pn:absolute pn:top-1/2 pn:size-3.5 pn:-translate-x-1/2 pn:-translate-y-1/2 pn:rounded-full pn:border-2 pn:border-white pn:bg-transparent pn:shadow-[0_0_0_1px_rgba(0,0,0,0.4)]`,style:{left:`${Math.min(1,Math.max(0,n))*100}%`}})]})}function $fe({hsl:e,onChange:t}){return(0,J.jsx)(K3,{ariaLabel:`Hue`,style:{background:Xfe},pointerLeft:e.h/360,calc:(t,n)=>{let r=Kfe(t,`horizontal`,e,n);return r&&r.h>=360&&(r.h=359),r},onChange:t})}function epe({hsl:e,rgb:t,onChange:n}){let r=`linear-gradient(to right, rgba(${t.r},${t.g},${t.b},0), rgba(${t.r},${t.g},${t.b},1))`;return(0,J.jsx)(K3,{ariaLabel:`Alpha`,style:{background:G3},pointerLeft:t.a,calc:(n,r)=>qfe(n,e,`horizontal`,t.a,r),onChange:n,children:(0,J.jsx)(`div`,{className:`pn:absolute pn:inset-0 pn:rounded-full`,style:{background:r}})})}function tpe({hex:e,onChange:t}){let[n,r]=x.useState(e.replace(`#`,``));return x.useEffect(()=>{r(e.replace(`#`,``))},[e]),(0,J.jsx)(a3,{value:n,spellCheck:!1,onChange:e=>{let n=e.target.value.replace(`#`,``);r(n),Wfe(`#`+n)&&t({hex:`#`+n,source:`hex`})},className:`pn:h-7 pn:w-full pn:text-center pn:uppercase`,style:{fontSize:11,paddingLeft:4,paddingRight:4}})}function q3({children:e}){return(0,J.jsx)(`span`,{className:`pn:text-[11px] pn:text-muted-foreground`,children:e})}function npe({rgb:e,hsl:t,hex:n,disableAlpha:r,onChange:i}){let a={stepper:!1,style:{fontSize:11,paddingLeft:3,paddingRight:3}};return(0,J.jsxs)(`div`,{className:`pn:grid pn:items-end pn:gap-1.5 pn:pt-3`,style:{gridTemplateColumns:`2fr ${r?`1fr 1fr 1fr`:`1fr 1fr 1fr 1fr`}`},children:[(0,J.jsxs)(`div`,{className:`pn:flex pn:min-w-0 pn:flex-col pn:items-center pn:gap-1`,children:[(0,J.jsx)(tpe,{hex:n,onChange:i}),(0,J.jsx)(q3,{children:`Hex`})]}),[`r`,`g`,`b`].map(t=>(0,J.jsxs)(`div`,{className:`pn:flex pn:min-w-0 pn:flex-col pn:items-center pn:gap-1`,children:[(0,J.jsx)(o3,{value:e[t],min:0,max:255,onValueChange:n=>i({...e,[t]:n,source:`rgb`}),className:`pn:h-7 pn:w-full pn:text-center`,...a}),(0,J.jsx)(q3,{children:t.toUpperCase()})]},t)),!r&&(0,J.jsxs)(`div`,{className:`pn:flex pn:min-w-0 pn:flex-col pn:items-center pn:gap-1`,children:[(0,J.jsx)(o3,{value:Math.round(e.a*100),min:0,max:100,onValueChange:e=>i({h:t.h,s:t.s,l:t.l,a:Math.min(100,Math.max(0,e))/100,source:`rgb`}),className:`pn:h-7 pn:w-full pn:text-center`,...a}),(0,J.jsx)(q3,{children:`A`})]})]})}function rpe({colors:e,onChange:t}){return!e||!e.length?null:(0,J.jsx)(`div`,{className:`pn:mt-3 pn:grid pn:grid-cols-8 pn:gap-1.5 pn:border-t pn:border-border pn:pt-3`,children:e.map(e=>{let n=typeof e==`string`?{color:e}:e;return(0,J.jsx)(`button`,{type:`button`,title:n.title||n.color,"aria-label":n.title||n.color,onMouseDown:e=>e.preventDefault(),onClick:()=>t({hex:n.color,source:`hex`}),className:`pn:aspect-square pn:w-full pn:cursor-pointer pn:rounded-sm pn:ring-1 pn:ring-inset pn:ring-black/15 pn:dark:ring-white/15`,style:{background:n.color}},n.color+(n.title||``))})})}function ipe({rgb:e}){return(0,J.jsx)(`div`,{className:`pn:relative pn:size-7 pn:shrink-0 pn:self-center pn:overflow-hidden pn:rounded-sm`,style:{background:G3},children:(0,J.jsx)(`div`,{className:`pn:absolute pn:inset-0 pn:rounded-sm pn:ring-1 pn:ring-inset pn:ring-black/20 pn:dark:ring-white/20`,style:{background:`rgba(${e.r},${e.g},${e.b},${e.a})`}})})}var ape=({color:e,onChange:t,presetColors:n=[],disableAlpha:r=!1,className:i=``})=>{let[a,o]=x.useState(()=>H3(e,0)),s=x.useRef(a.oldHue);x.useEffect(()=>{let t=H3(e,s.current);s.current=t.oldHue,o(e=>e.rgb.r===t.rgb.r&&e.rgb.g===t.rgb.g&&e.rgb.b===t.rgb.b&&Math.round(e.rgb.a*255)===Math.round(t.rgb.a*255)?e:t)},[e]);let{rgb:c,hsl:l,hsv:u,hex:d}=a,f=V3((e,n)=>{if(!Ufe(e))return;let r=H3(e,e.h??s.current);s.current=r.oldHue,o(r),t(r,n)}),p=V3((e,t)=>{f(c.a===0?{...e,a:1}:e,t)}),[m,h]=x.useState(!1),g=x.useRef(null),_=V3(()=>{g.current&&=(g.current.destroy(),null)}),v=V3(e=>{if(m){let t=g.current?.fill();t&&f(Ju.Util.colorToRGBA(t)),_(),Zfe(e,`color-picker-button`)||h(!1),e.stopPropagation(),e.stopImmediatePropagation()}}),y=V3(e=>{if(!m)return;let t=Ju.stages.find(t=>{let n=t.getContent().parentElement?.parentElement;if(!n)return!1;let r=n.getBoundingClientRect();return r.left<e.clientX&&r.left+r.width>e.clientX&&r.top<e.clientY&&r.top+r.height>e.clientY});if(!t){_();return}let n=t.getContent().getBoundingClientRect(),r={x:e.clientX-n.left,y:e.clientY-n.top},i=t.children[0],a=i.getNativeCanvasElement(),o=i.getCanvas().getPixelRatio(),{data:s}=a.getContext(`2d`).getImageData(r.x*o,r.y*o,1,1),c=t.findOne(`.line-guides`);c.findOne(`.picker`)||(g.current&&g.current.destroy(),g.current=new Ju.Circle({name:`picker`,radius:14,stroke:`black`,strokeWidth:1}),c.add(g.current)),g.current.setAbsolutePosition({x:r.x-15,y:r.y-15}),g.current.fill(`rgb(`+s[0]+`,`+s[1]+`,`+s[2]+`)`)});return x.useEffect(()=>(window.addEventListener(`mousemove`,y),window.addEventListener(`mousedown`,v,!0),window.addEventListener(`touchstart`,v,!0),()=>{window.removeEventListener(`mousemove`,y),window.removeEventListener(`mousedown`,v,!0),window.removeEventListener(`touchstart`,v,!0),_()}),[y,v,_]),x.useEffect(()=>{m||_()},[m,_]),x.useEffect(()=>(m&&(document.body.style.cursor=`crosshair`),()=>{document.body.style.cursor=``}),[m]),(0,J.jsxs)(`div`,{className:rK(`polotno-color-picker pn:flex pn:w-full pn:flex-col`,i),onMouseDown:e=>{e.target.tagName!==`INPUT`&&e.preventDefault()},children:[(0,J.jsx)(Qfe,{hsl:l,hsv:u,onChange:p}),(0,J.jsxs)(`div`,{className:`pn:flex pn:items-stretch pn:gap-2 pn:pt-3`,children:[(0,J.jsxs)(`div`,{className:`pn:flex pn:flex-1 pn:flex-col pn:justify-center pn:gap-2`,style:{paddingLeft:8,paddingRight:8},children:[(0,J.jsx)($fe,{hsl:l,onChange:p}),!r&&(0,J.jsx)(epe,{hsl:l,rgb:c,onChange:f})]}),(0,J.jsx)(ipe,{rgb:c}),(0,J.jsx)(uK,{variant:`ghost`,size:`icon-sm`,className:rK(`color-picker-button pn:size-7 pn:self-center`,m&&`pn:bg-muted`),onClickCapture:e=>{h(e=>!e),e.stopPropagation()},children:(0,J.jsx)($,{name:`action.eyeDropper`,className:`pn:size-4`})})]}),(0,J.jsx)(npe,{rgb:c,hsl:l,hex:d,disableAlpha:r,onChange:f}),(0,J.jsx)(rpe,{colors:n,onChange:f})]})},J3=x.createContext(void 0);function Y3(){let e=x.useContext(J3);if(e===void 0)throw Error(CK(64));return e}var ope=function(e){return e.activationDirection=`data-activation-direction`,e.orientation=`data-orientation`,e}({}),X3={tabActivationDirection:e=>({[ope.activationDirection]:e})},spe=x.forwardRef(function(e,t){let{className:n,defaultValue:r=0,onValueChange:i,orientation:a=`horizontal`,render:o,value:s,style:c,...l}=e,u=e.defaultValue!==void 0,d=x.useRef([]),[f,p]=x.useState(()=>new Map),[m,h]=S2({controlled:s,default:r,name:`Tabs`,state:`value`}),g=s!==void 0,[_,v]=x.useState(()=>new Map),y=x.useCallback(e=>{if(e===void 0)return null;for(let[t,n]of _.entries())if(n!=null&&e===(n.value??n.index))return t;return null},[_]),[b,S]=x.useState(()=>({previousValue:m,tabActivationDirection:`none`})),{previousValue:C,tabActivationDirection:w}=b,T=w,E=!1;C!==m&&(T=Z3(C,m,a,_),E=C!=null&&m!=null&&y(m)==null);let D=E?C:m,O=C!==D||w!==T;xK(()=>{O&&S({previousValue:D,tabActivationDirection:T})},[D,O,T]);let k=jJ((e,t)=>{t.activationDirection=Z3(m,e,a,_),i?.(e,t),!t.isCanceled&&h(e)}),A=jJ((e,t)=>{i?.(e,pJ(t,void 0,void 0,{activationDirection:`none`}))}),j=jJ((e,t)=>{p(n=>{if(n.get(e)===t)return n;let r=new Map(n);return r.set(e,t),r})}),M=jJ((e,t)=>{p(n=>{if(!n.has(e)||n.get(e)!==t)return n;let r=new Map(n);return r.delete(e),r})}),N=x.useCallback(e=>f.get(e),[f]),P=x.useCallback(e=>{for(let t of _.values())if(e===t?.value)return t?.id},[_]),F=x.useMemo(()=>({getTabElementBySelectedValue:y,getTabIdByPanelValue:P,getTabPanelIdByValue:N,onValueChange:k,orientation:a,registerMountedTabPanel:j,setTabMap:v,unregisterMountedTabPanel:M,tabActivationDirection:T,value:m}),[y,P,N,k,a,j,v,M,T,m]),I=x.useMemo(()=>{for(let e of _.values())if(e!=null&&e.value===m)return e},[_,m]),L=x.useMemo(()=>{for(let e of _.values())if(e!=null&&!e.disabled)return e.value},[_]),ee=x.useRef(!u),R=x.useRef(u),z=x.useRef(!1);xK(()=>{if(g)return;function e(e,t){h(e),S(t=>t.previousValue===e&&t.tabActivationDirection===`none`?t:{previousValue:e,tabActivationDirection:`none`}),A(e,t),ee.current=!1}if(_.size===0){if(!z.current||m===null)return;e(null,lJ);return}z.current=!0;let t=I?.disabled,n=I==null&&m!==null;if(!t&&m===r&&(R.current=!1),R.current&&t&&m===r)return;let i=ee.current;if(t||n){let n=L??null;if(m===n){ee.current=!1;return}let r=lJ;i?r=uJ:t&&(r=cJ),e(n,r);return}i&&I!=null&&(A(m,uJ),ee.current=!1)},[r,L,g,A,I,h,_,m]);let B=UX(`div`,e,{state:{orientation:a,tabActivationDirection:T},ref:t,props:l,stateAttributesMapping:X3});return(0,J.jsx)(J3.Provider,{value:F,children:(0,J.jsx)(P2,{elementsRef:d,children:B})})});function Z3(e,t,n,r){if(e==null||t==null)return`none`;let i=null,a=null;for(let[n,o]of r.entries()){if(o==null)continue;let r=o.value??o.index;if(e===r&&(i=n),t===r&&(a=n),i!=null&&a!=null)break}if(i==null||a==null)return i!==a&&(typeof e==`number`||typeof e==`string`)&&typeof e==typeof t?n===`horizontal`?t>e?`right`:`left`:t>e?`down`:`up`:`none`;let o=i.getBoundingClientRect(),s=a.getBoundingClientRect();if(n===`horizontal`){if(s.left<o.left)return`left`;if(s.left>o.left)return`right`}else{if(s.top<o.top)return`up`;if(s.top>o.top)return`down`}return`none`}var cpe=`data-composite-item-active`,Q3=x.createContext(void 0);function lpe(){let e=x.useContext(Q3);if(e===void 0)throw Error(CK(65));return e}var upe=x.forwardRef(function(e,t){let{className:n,disabled:r=!1,render:i,value:a,id:o,nativeButton:s=!0,style:c,...l}=e,{value:u,getTabPanelIdByValue:d,orientation:f}=Y3(),{activateOnFocus:p,highlightedTabIndex:m,onTabActivation:h,registerTabResizeObserverElement:g,setHighlightedTabIndex:_,tabsListElement:v}=lpe(),y=h1(o),{compositeProps:b,compositeRef:S,index:C}=H2({metadata:x.useMemo(()=>({disabled:r,id:y,value:a}),[r,y,a])}),w=a===u,T=x.useRef(!1),E=x.useRef(null);x.useEffect(()=>{let e=E.current;if(e)return g(e)},[g]),xK(()=>{if(T.current){T.current=!1;return}if(!(w&&C>-1&&m!==C))return;let e=v;if(e!=null){let t=Dq(RJ(e));if(t&&Oq(e,t))return}r||_(C)},[w,C,m,_,r,v]);let{getButtonProps:D,buttonRef:O}=t0({disabled:r,native:s,focusableWhenDisabled:!0}),k=d(a),A=x.useRef(!1),j=x.useRef(!1);function M(e){w||r||h(a,pJ(Kq,e.nativeEvent,void 0,{activationDirection:`none`}))}function N(e){w||(C>-1&&!r&&_(C),!r&&p&&(!A.current||A.current&&j.current)&&h(a,pJ(Kq,e.nativeEvent,void 0,{activationDirection:`none`})))}function P(e){if(w||r)return;A.current=!0;function t(){A.current=!1,j.current=!1}(!e.button||e.button===0)&&(j.current=!0,RJ(e.currentTarget).addEventListener(`pointerup`,t,{once:!0}))}return UX(`button`,e,{state:{disabled:r,active:w,orientation:f},ref:[t,O,S,E],props:[b,{role:`tab`,"aria-controls":k,"aria-selected":w,id:y,onClick:M,onFocus:N,onPointerDown:P,[cpe]:w?``:void 0,onKeyDownCapture(){T.current=!0}},l,D]})}),dpe=function(e){return e.index=`data-index`,e.activationDirection=`data-activation-direction`,e.orientation=`data-orientation`,e.hidden=`data-hidden`,e[e.startingStyle=t$.startingStyle]=`startingStyle`,e[e.endingStyle=t$.endingStyle]=`endingStyle`,e}({}),fpe={...X3,...i$},ppe=x.forwardRef(function(e,t){let{className:n,value:r,render:i,keepMounted:a=!1,style:o,...s}=e,{value:c,getTabIdByPanelValue:l,orientation:u,tabActivationDirection:d,registerMountedTabPanel:f,unregisterMountedTabPanel:p}=Y3(),m=h1(),{ref:h,index:g}=O2({metadata:x.useMemo(()=>({id:m,value:r}),[m,r])}),_=r===c,{mounted:v,transitionStatus:y,setMounted:b}=e$(_),S=!v,C=l(r),w={hidden:S,orientation:u,tabActivationDirection:d,transitionStatus:y},T=x.useRef(null),E=UX(`div`,e,{state:w,ref:[t,h,T],props:[{"aria-labelledby":C,hidden:S,id:m,role:`tabpanel`,tabIndex:_?0:-1,inert:z1(!_),[dpe.index]:g},s],stateAttributesMapping:fpe});return o$({open:_,ref:T,onComplete(){_||b(!1)}}),xK(()=>{if(!(S&&!a)&&m!=null)return f(r,m),()=>{p(r,m)}},[S,a,r,m,f,p]),a||v?E:null}),mpe=[];function hpe(e){let{itemSizes:t,cols:n=1,loopFocus:r=!0,onLoop:i,dense:a=!1,orientation:o=`both`,direction:s,highlightedIndex:c,onHighlightedIndexChange:l,rootRef:u,enableHomeAndEndKeys:d=!1,stopEventPropagation:f=!1,disabledIndices:p,modifierKeys:m=mpe}=e,[h,g]=x.useState(0),_=n>1,v=x.useRef(null),y=bJ(v,u),b=x.useRef([]),S=x.useRef(!1),C=c??h,w=jJ((e,t=!1)=>{if((l??g)(e),t){let t=b.current[e];D0(v.current,t,s,o)}}),T=jJ(e=>{if(e.size===0||S.current)return;S.current=!0;let t=Array.from(e.keys()),n=t.find(e=>e?.hasAttribute(`data-composite-item-active`))??null,r=n?t.indexOf(n):-1;r!==-1&&w(r),D0(v.current,n,s,o)}),E=jJ((e,t,n)=>i?i?.(e,t,n,b):n),D=x.useMemo(()=>({"aria-orientation":o===`both`?void 0:o,ref:y,onFocus(e){let t=v.current,n=kq(e.nativeEvent);!t||n==null||!E0(n)||n.setSelectionRange(0,n.value.length??0)},onKeyDown(e){let c=d?T0:w0;if(!c.has(e.key)||gpe(e,m)||!v.current)return;let l=s===`rtl`,u=l?_0:v0,h={horizontal:u,vertical:g0,both:u}[o],g=l?v0:_0,y={horizontal:g,vertical:h0,both:g}[o],x=kq(e.nativeEvent);if(x!=null&&E0(x)&&!fde(x)){let t=x.selectionStart,n=x.selectionEnd,r=x.value??``;if(t==null||e.shiftKey||t!==n||e.key!==y&&t<r.length||e.key!==h&&t>0)return}let S=C,T=yY(b,p),D=bY(b,p);if(_){let i=t||Array.from({length:b.current.length},()=>({width:1,height:1})),s=CY(i,n,a),c=s.findIndex(e=>e!=null&&!EY(b.current,e,p)),u=s.reduce((e,t,n)=>t!=null&&!EY(b.current,t,p)?n:e,-1);S=s[SY(s.map(e=>e==null?null:b.current[e]),{event:e,orientation:o,loopFocus:r,onLoop:E,cols:n,disabledIndices:TY([...p||b.current.map((e,t)=>EY(b.current,t)?t:void 0),void 0],s),minIndex:c,maxIndex:u,prevIndex:wY(C>D?T:C,i,s,n,e.key===`ArrowDown`?`bl`:e.key===`ArrowRight`?`tr`:`tl`),rtl:l})]}let O={horizontal:[u],vertical:[g0],both:[u,g0]}[o],k={horizontal:[g],vertical:[h0],both:[g,h0]}[o],A=_?c:{horizontal:d?iue:S0,vertical:d?aue:C0,both:c}[o];d&&(e.key===`Home`?S=T:e.key===`End`&&(S=D)),S===C&&(O.includes(e.key)||k.includes(e.key))&&(r&&S===D&&O.includes(e.key)?(S=T,i&&(S=i(e,C,S,b))):r&&S===T&&k.includes(e.key)?(S=D,i&&(S=i(e,C,S,b))):S=xY(b.current,{startingIndex:S,decrement:k.includes(e.key),disabledIndices:p})),S!==C&&!vY(b.current,S)&&(f&&e.stopPropagation(),A.has(e.key)&&e.preventDefault(),w(S,!0),queueMicrotask(()=>{b.current[S]?.focus()}))}}),[n,a,s,p,b,d,C,_,t,r,i,E,y,m,w,o,f]);return x.useMemo(()=>({props:D,highlightedIndex:C,onHighlightedIndexChange:w,elementsRef:b,disabledIndices:p,onMapChange:T,relayKeyboardEvent:D.onKeyDown}),[D,C,w,b,p,T])}function gpe(e,t){for(let n of oue.values())if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function $3(e){let{render:t,className:n,style:r,refs:i=Wq,props:a=Wq,state:o=Gq,stateAttributesMapping:s,highlightedIndex:c,onHighlightedIndexChange:l,orientation:u,dense:d,itemSizes:f,loopFocus:p,onLoop:m,cols:h,enableHomeAndEndKeys:g,onMapChange:_,stopEventPropagation:v=!0,rootRef:y,disabledIndices:b,modifierKeys:S,highlightItemOnHover:C=!1,tag:w=`div`,...T}=e,{props:E,highlightedIndex:D,onHighlightedIndexChange:O,elementsRef:k,onMapChange:A,relayKeyboardEvent:j}=hpe({itemSizes:f,cols:h,loopFocus:p,onLoop:m,dense:d,orientation:u,highlightedIndex:c,onHighlightedIndexChange:l,rootRef:y,stopEventPropagation:v,enableHomeAndEndKeys:g,direction:k1(),disabledIndices:b,modifierKeys:S}),M=UX(w,e,{state:o,ref:i,props:[E,...a,T],stateAttributesMapping:s}),N=x.useMemo(()=>({highlightedIndex:D,onHighlightedIndexChange:O,highlightItemOnHover:C,relayKeyboardEvent:j}),[D,O,C,j]);return(0,J.jsx)($1.Provider,{value:N,children:(0,J.jsx)(P2,{elementsRef:k,onMapChange:e=>{_?.(e),A(e)},children:M})})}var _pe=x.forwardRef(function(e,t){let{activateOnFocus:n=!1,className:r,loopFocus:i=!0,render:a,style:o,...s}=e,{onValueChange:c,orientation:l,value:u,setTabMap:d,tabActivationDirection:f}=Y3(),[p,m]=x.useState(0),[h,g]=x.useState(null),_=x.useRef(new Set),v=x.useRef(new Set),y=x.useRef(null);x.useEffect(()=>{if(typeof ResizeObserver>`u`)return;let e=new ResizeObserver(()=>{_.current.forEach(e=>{e()})});return y.current=e,h&&e.observe(h),v.current.forEach(t=>{e.observe(t)}),()=>{e.disconnect(),y.current=null}},[h]);let b=jJ(e=>(_.current.add(e),()=>{_.current.delete(e)})),S=jJ(e=>(v.current.add(e),y.current?.observe(e),()=>{v.current.delete(e),y.current?.unobserve(e)})),C=jJ((e,t)=>{e!==u&&c(e,t)}),w={orientation:l,tabActivationDirection:f},T={"aria-orientation":l===`vertical`?`vertical`:void 0,role:`tablist`},E=x.useMemo(()=>({activateOnFocus:n,highlightedTabIndex:p,registerIndicatorUpdateListener:b,registerTabResizeObserverElement:S,onTabActivation:C,setHighlightedTabIndex:m,tabsListElement:h}),[n,p,b,S,C,m,h]);return(0,J.jsx)(Q3.Provider,{value:E,children:(0,J.jsx)($3,{render:a,className:r,style:o,state:w,refs:[t,g],props:[T,s],stateAttributesMapping:X3,highlightedIndex:p,enableHomeAndEndKeys:!0,loopFocus:i,orientation:l,onHighlightedIndexChange:m,onMapChange:d,disabledIndices:Wq})})}),e6=x.forwardRef(({className:e,orientation:t=`horizontal`,...n},r)=>(0,J.jsx)(spe,{ref:r,"data-slot":`tabs`,orientation:t,className:rK(`pn:group/tabs pn:flex pn:gap-2 pn:data-[orientation=horizontal]:flex-col`,e),...n}));e6.displayName=`Tabs`;var vpe=cK(`pn:group/tabs-list pn:inline-flex pn:w-fit pn:items-center pn:justify-center pn:rounded-lg pn:p-[3px] pn:text-muted-foreground pn:group-data-[orientation=horizontal]/tabs:h-9 pn:group-data-[orientation=vertical]/tabs:h-fit pn:group-data-[orientation=vertical]/tabs:flex-col pn:data-[variant=line]:rounded-none`,{variants:{variant:{default:`pn:bg-muted`,line:`pn:gap-1 pn:bg-transparent`}},defaultVariants:{variant:`default`}}),t6=x.forwardRef(({className:e,variant:t=`default`,...n},r)=>(0,J.jsx)(_pe,{ref:r,"data-slot":`tabs-list`,"data-variant":t,className:rK(vpe({variant:t}),e),...n}));t6.displayName=`TabsList`;var n6=x.forwardRef(({className:e,...t},n)=>(0,J.jsx)(upe,{ref:n,"data-slot":`tabs-trigger`,className:rK(`pn:relative pn:inline-flex pn:h-[calc(100%-1px)] pn:flex-1 pn:items-center pn:justify-center pn:gap-1.5 pn:rounded-md pn:border pn:border-transparent pn:px-2 pn:py-1 pn:text-sm pn:font-medium pn:whitespace-nowrap pn:text-foreground/60 pn:transition-all pn:group-data-[orientation=vertical]/tabs:w-full pn:group-data-[orientation=vertical]/tabs:justify-start pn:hover:text-foreground pn:focus-visible:border-ring pn:focus-visible:ring-[3px] pn:focus-visible:ring-ring/50 pn:focus-visible:outline-1 pn:focus-visible:outline-ring pn:disabled:pointer-events-none pn:disabled:opacity-50 pn:group-data-[variant=default]/tabs-list:data-active:shadow-sm pn:group-data-[variant=line]/tabs-list:data-active:shadow-none pn:dark:text-muted-foreground pn:dark:hover:text-foreground pn:[&_svg]:pointer-events-none pn:[&_svg]:shrink-0 pn:[&_svg:not([class*='size-'])]:size-4`,`pn:group-data-[variant=line]/tabs-list:bg-transparent pn:group-data-[variant=line]/tabs-list:data-active:bg-transparent pn:dark:group-data-[variant=line]/tabs-list:data-active:border-transparent pn:dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`pn:data-active:bg-background pn:data-active:text-foreground pn:dark:data-active:border-input pn:dark:data-active:bg-input/30 pn:dark:data-active:text-foreground`,`pn:after:absolute pn:after:bg-foreground pn:after:opacity-0 pn:after:transition-opacity pn:group-data-[orientation=horizontal]/tabs:after:inset-x-0 pn:group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] pn:group-data-[orientation=horizontal]/tabs:after:h-0.5 pn:group-data-[orientation=vertical]/tabs:after:inset-y-0 pn:group-data-[orientation=vertical]/tabs:after:-right-1 pn:group-data-[orientation=vertical]/tabs:after:w-0.5 pn:group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,e),...t}));n6.displayName=`TabsTrigger`;var r6=x.forwardRef(({className:e,...t},n)=>(0,J.jsx)(ppe,{ref:n,"data-slot":`tabs-content`,className:rK(`pn:flex-1 pn:outline-none`,e),...t}));r6.displayName=`TabsContent`;var i6=[`#D0021B`,`#F5A623`,`#F8E71C`,`#8B572A`,`#7ED321`,`#417505`,`#BD10E0`,`#9013FE`,`#4A90E2`,`#50E3C2`,`#B8E986`,`#000000`,`#4A4A4A`,`#9B9B9B`,`#FFFFFF`].reverse(),ype=e=>{let t=[];e.pages.forEach(e=>{e.children.forEach(e=>{e.shadowEnabled&&t.push(e.shadowColor),e.type===`text`&&(t.push(e.fill),e.backgroundEnabled&&t.push(e.backgroundColor),e.strokeWidth&&t.push(e.stroke)),e.type===`svg`&&t.push(...e.colorsReplace.values()),e.type===`figure`&&(t.push(e.fill),e.strokeWidth&&t.push(e.stroke)),e.type===`line`&&t.push(e.color)})});let n=[];return t.forEach(e=>{if(Qy(e)){let{stops:t}=$y(e);n.push(...t.map(e=>e.color))}else n.push(e)}),[...new Set(n)]},a6=({style:e,color:t,onChange:n,...r})=>{let[i,a]=x.useState(t);x.useEffect(()=>{a(t)},[t]);let o=x.useRef(void 0),s=x.useRef(void 0),c=e=>{let{r:t,g:r,b:i,a:c}=e.rgb,l=`rgba(${t},${r},${i},${c})`;a(l),s.current=l,!o.current&&(o.current=window.setTimeout(()=>{o.current=0,n(s.current||l)},50))};return(0,J.jsx)(`div`,{className:`pn-color-picker-solid`,style:e,onMouseDown:e=>{e.target.tagName!==`INPUT`&&e.preventDefault()},children:(0,J.jsx)(ape,{color:i,...r,onChange:c})})},o6=e=>e.map(e=>`${e.color} ${e.offset*100}%`).join(`,`),bpe=({value:e,onChange:t,preset:n})=>{let{rotation:r,stops:i}=$y(e),a=x.useRef(i);a.current=i;let o=x.useRef(r);o.current=r;let[s,c]=x.useState(0),[l,u]=x.useState(-1),d=x.useRef(null),f=x.useRef(!1),p=e=>{f.current=!0};return x.useEffect(()=>{l>-1&&(a.current.splice(l,1),t(`linear-gradient(${o.current}deg, ${o6(a.current)})`),u(-1))},[l]),x.useEffect(()=>{d.current?.focus()},[]),x.useEffect(()=>{let e=e=>{if(f.current){let n=d.current.getBoundingClientRect(),r=e.clientX-n.left,l=r/n.width,p=l<-.5||l>1.5;if(i.length>2&&p){c(0),f.current=!1,u(s);return}let m=Math.min(1,Math.max(0,r/n.width)),h=[...a.current];h[s].offset=m,t(`linear-gradient(${o.current}deg, ${o6(h)})`)}},n=()=>{f.current=!1};return window.addEventListener(`mousemove`,e),window.addEventListener(`mouseup`,n),()=>{window.removeEventListener(`mousemove`,e),window.removeEventListener(`mouseup`,n)}},[s,a]),(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`div`,{style:{width:`calc(100% - 35px)`,height:`60px`,position:`relative`},children:[(0,J.jsx)(`div`,{ref:d,tabIndex:0,style:{position:`absolute`,top:0,left:0,width:`100%`,marginLeft:`15px`,height:`100%`,zIndex:0,outline:`none`},onKeyDownCapture:e=>{if(e.key===`Backspace`){if(e.preventDefault(),e.stopPropagation(),a.current.length<=2)return;a.current.splice(s,1),s>=a.current.length&&c(a.current.length-1),t(`linear-gradient(${o.current}deg, ${o6(a.current)})`)}},onMouseDown:e=>{let n=e.currentTarget.getBoundingClientRect(),a=e.clientX-n.left,o=Math.min(1,Math.max(0,a/n.width)),s=i[0].color;i.push({color:s,offset:o}),i.sort((e,t)=>e.offset-t.offset),c(i.findIndex(e=>e.offset===o)),p(),t(`linear-gradient(${r}deg, ${o6(i)})`)}}),i.map(({offset:e,color:t},n)=>(0,J.jsx)(`div`,{style:{position:`absolute`,top:`10px`,left:`${e*100}%`,border:n===s?`2px solid rgb(0, 161, 255)`:`2px solid rgb(0, 0, 0, 0)`,padding:`2px`},onMouseDown:e=>{e.stopPropagation(),c(n),p(e)},children:(0,J.jsx)(s6,{background:t,style:{margin:0}})},n))]}),(0,J.jsx)(`div`,{style:{width:`calc(100% - 30px)`,height:`10px`,marginLeft:`15px`,background:`linear-gradient(90deg,${o6(i)})`}}),(0,J.jsx)(`div`,{style:{padding:`10px`},children:(0,J.jsx)(I3,{label:Q(`toolbar.colorPicker.angle`),value:r,min:0,max:360,onChange:e=>{t(`linear-gradient(${e}deg,${o6(i)})`)}})}),(0,J.jsx)(a6,{color:i[s].color,presetColors:n,onChange:e=>{let n=[...i];n[s].color=e,t(`linear-gradient(${r}deg, ${o6(n)})`)}})]})},xpe=W(({value:e,onChange:t,preset:n,store:r})=>{let[i,a]=x.useState(Qy(e)?`gradient`:`solid`);return(0,J.jsx)(`div`,{style:{padding:`5px`},children:(0,J.jsxs)(e6,{value:i,onValueChange:e=>a(e),className:`pn:w-full`,children:[(0,J.jsxs)(t6,{className:`pn:flex pn:w-full pn:flex-row`,children:[(0,J.jsx)(n6,{value:`solid`,className:`pn:flex-1`,children:Q(`toolbar.colorPicker.solid`)}),(0,J.jsx)(n6,{value:`gradient`,className:`pn:flex-1`,children:Q(`toolbar.colorPicker.linear`)})]}),(0,J.jsx)(r6,{value:`solid`,className:`pn:w-full`,children:(0,J.jsx)(a6,{color:e,onChange:t,presetColors:n,style:{padding:`0`}})}),(0,J.jsx)(r6,{value:`gradient`,className:`ember-panel pn:w-full`,children:(0,J.jsx)(bpe,{value:e,onChange:t,store:r,preset:n})})]})})}),Spe=`url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 8 8'%3E%3Cg fill='rgba(112, 112, 116, 1)' fill-opacity='1'%3E%3Cpath fill-rule='evenodd' d='M0 0h4v4H0V0zm4 4h4v4H4V4z'/%3E%3C/g%3E%3C/svg%3E")`,s6=x.forwardRef(function({size:e=30,background:t,style:n={},className:r,children:i=null,...a},o){let s=typeof t==`string`?t:`transparent`,c=s.includes(`gradient`)?s:`linear-gradient(${s}, ${s}), ${Spe}`;return(0,J.jsx)(`div`,{ref:o,role:`button`,tabIndex:0,"aria-label":`Pick color`,onMouseDown:e=>e.preventDefault(),className:rK(`pn:flex pn:cursor-pointer pn:items-center pn:justify-center pn:overflow-hidden pn:rounded-md pn:border pn:border-foreground/30`,r),style:{width:e+`px`,height:e+`px`,backgroundImage:c,...n},...a,children:i})}),c6=e=>{let t=ype(e).slice(0,8).filter(e=>!i6.find(t=>lb(t,e)));return t.concat(i6.slice(0,16-t.length).reverse())};function Cpe(e){c6=e}var l6=({value:e,onChange:t,size:n,store:r,gradientEnabled:i,children:a,style:o,onOpen:s,onClose:c})=>{let l=c6(r),[u,d]=x.useState(!1);return(0,J.jsxs)(j0,{open:u,onOpenChange:e=>{d(e),e?s?.():c?.()},children:[(0,J.jsx)(M0,{nativeButton:!1,render:(0,J.jsx)(s6,{size:n,background:e,style:o,children:a})}),(0,J.jsx)(N0,{className:`pn:w-[280px] pn:p-0`,initialFocus:!1,children:i?(0,J.jsx)(xpe,{preset:l,value:e,onChange:t,store:r}):(0,J.jsx)(`div`,{style:{padding:`5px`},children:(0,J.jsx)(a6,{color:e,onChange:t,presetColors:l})})})]})},wpe=300,Tpe=0,Epe=W(({textEl:e,eachSet:t})=>{let[n,r]=x.useState(null),i=x.useRef(0),a=x.useRef(null),o=n??e.curvePower*100,s=n_.htmlRenderEnabled&&!n_.renderTagTextEnabled?wpe:Tpe,c=e=>{t({curvePower:e/100}),i.current=Date.now()};return(0,J.jsx)(j3,{value:[o],onValueChange:e=>{let t=iK(aK(e),-100,100);if(r(t),a.current&&clearTimeout(a.current),s===0){c(t);return}let n=Date.now()-i.current;n>=s?c(t):a.current=setTimeout(()=>{c(t)},s-n)},onValueCommitted:e=>{let t=aK(e);a.current&&clearTimeout(a.current),r(null),c(iK(t,-100,100))},min:-100,max:100,step:1})});W(e=>(console.error(`[polotno] FiltersPicker was removed — effects live in the Effects side panel (use EffectsPicker / the default export). Rendering nothing.`),null));var u6=W(({element:e,store:t})=>e.contentEditable?(0,J.jsxs)(uK,{variant:`ghost`,size:`sm`,onClickCapture:e=>{e.stopPropagation(),t.openSidePanel(`effects`)},children:[(0,J.jsx)($,{name:`toolbar.filters`}),Q(`toolbar.effects`)]}):null),Dpe=cK(`pn:flex pn:w-fit pn:items-stretch pn:has-[>[data-slot=button-group]]:gap-2 pn:[&>*]:focus-visible:relative pn:[&>*]:focus-visible:z-10 pn:has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md pn:[&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit pn:[&>input]:flex-1`,{variants:{orientation:{horizontal:`pn:[&>*:not(:first-child)]:rounded-l-none pn:[&>*:not(:first-child)]:border-l-0 pn:[&>*:not(:last-child)]:rounded-r-none`,vertical:`pn:flex-col pn:[&>*:not(:first-child)]:rounded-t-none pn:[&>*:not(:first-child)]:border-t-0 pn:[&>*:not(:last-child)]:rounded-b-none`}},defaultVariants:{orientation:`horizontal`}}),d6=x.forwardRef(({className:e,orientation:t,fill:n=!1,...r},i)=>(0,J.jsx)(`div`,{ref:i,role:`group`,"data-slot":`button-group`,"data-orientation":t,className:rK(Dpe({orientation:t}),n&&`pn:w-full`,e),...r}));d6.displayName=`ButtonGroup`;var f6=x.createContext(null),p6=x.createContext(null);function m6(){let e=x.useContext(f6);if(e===null)throw Error(CK(60));return e}function h6(){let e=x.useContext(p6);if(e===null)throw Error(CK(61));return e}var Ope=(e,t)=>Object.is(e,t);function g6(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function kpe(e,t,n){return!e||e.length===0?!1:e.some(e=>e===void 0?!1:g6(t,e,n))}function _6(e,t,n){return!e||e.length===0?-1:e.findIndex(e=>e===void 0?!1:g6(e,t,n))}function Ape(e,t,n){return e.filter(e=>!g6(t,e,n))}function v6(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function y6(e){return e!=null&&e.length>0&&typeof e[0]==`object`&&e[0]!=null&&`items`in e[0]}function jpe(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(y6(t)){for(let e of t)for(let t of e.items)if(t&&t.value==null&&t.label!=null)return!0;return!1}for(let e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function b6(e,t){if(t&&e!=null)return t(e)??``;if(e&&typeof e==`object`){if(`label`in e&&e.label!=null)return String(e.label);if(`value`in e)return String(e.value)}return v6(e)}function x6(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?v6(e.value):v6(e)}function S6(e,t,n){function r(){return b6(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e==`object`&&`label`in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??r();if(Array.isArray(t)){let n=t,i=y6(n)?n.flatMap(e=>e.items):n;if(typeof e!=`object`||!e){let t=i.find(t=>t.value===e);return t&&t.label!=null?t.label:r()}if(`value`in e){let t=i.find(t=>t&&t.value===e.value);if(t&&t.label!=null)return t.label}}return r()}function Mpe(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push((0,J.jsx)(x.Fragment,{children:S6(r,t,n)},i)),e),[])}var C6={id:VQ(e=>e.id),labelId:VQ(e=>e.labelId),modal:VQ(e=>e.modal),multiple:VQ(e=>e.multiple),items:VQ(e=>e.items),itemToStringLabel:VQ(e=>e.itemToStringLabel),itemToStringValue:VQ(e=>e.itemToStringValue),isItemEqualToValue:VQ(e=>e.isItemEqualToValue),value:VQ(e=>e.value),hasSelectedValue:VQ(e=>{let{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:x6(t,r)!==``}),hasNullItemLabel:VQ((e,t)=>t?jpe(e.items):!1),open:VQ(e=>e.open),mounted:VQ(e=>e.mounted),forceMount:VQ(e=>e.forceMount),transitionStatus:VQ(e=>e.transitionStatus),openMethod:VQ(e=>e.openMethod),activeIndex:VQ(e=>e.activeIndex),selectedIndex:VQ(e=>e.selectedIndex),isActive:VQ((e,t)=>e.activeIndex===t),isSelected:VQ((e,t,n)=>{let r=e.isItemEqualToValue,i=e.value;return e.multiple?Array.isArray(i)&&i.some(e=>g6(n,e,r)):e.selectedIndex===t&&e.selectedIndex!==null?!0:g6(n,i,r)}),isSelectedByFocus:VQ((e,t)=>e.selectedIndex===t),popupProps:VQ(e=>e.popupProps),triggerProps:VQ(e=>e.triggerProps),triggerElement:VQ(e=>e.triggerElement),positionerElement:VQ(e=>e.positionerElement),listElement:VQ(e=>e.listElement),popupSide:VQ(e=>e.popupSide),scrollUpArrowVisible:VQ(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:VQ(e=>e.scrollDownArrowVisible),hasScrollArrows:VQ(e=>e.hasScrollArrows)};function w6(e,t){return Math.max(0,e-t)}function T6(e,t){if(t<=0)return 0;let n=d3(e,0,t),r=n,i=t-n,a=r<=1,o=i<=1;return a&&o?r<=i?0:t:a?0:o?t:n}function Npe(e){let{id:t,value:n,defaultValue:r=null,onValueChange:i,open:a,defaultOpen:o=!1,onOpenChange:s,name:c,form:l,autoComplete:u,disabled:d=!1,readOnly:f=!1,required:p=!1,modal:m=!0,actionsRef:h,inputRef:g,onOpenChangeComplete:_,items:v,multiple:y=!1,itemToStringLabel:b,itemToStringValue:S,isItemEqualToValue:C=Ope,highlightItemOnHover:w=!0,children:T}=e,{clearErrors:E}=t3(),{setDirty:D,setTouched:O,setFocused:k,shouldValidateOnChange:A,validityData:j,setFilled:M,name:N,disabled:P,validation:F,validationMode:I}=e3(),L=r3({id:t}),ee=P||d,R=N??c,[z,B]=S2({controlled:n,default:y?r??Wq:r,name:`Select`,state:`value`}),[V,H]=S2({controlled:a,default:o,name:`Select`,state:`open`}),te=x.useRef([]),U=x.useRef([]),ne=x.useRef(null),re=x.useRef(null),ie=x.useRef(0),ae=x.useRef(null),oe=x.useRef([]),se=x.useRef(!1),ce=x.useRef(!1),le=x.useRef(null),ue=x.useRef(null),de=x.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),fe=x.useRef(!1),{mounted:pe,setMounted:me,transitionStatus:he}=e$(V),{openMethod:ge,triggerProps:_e}=o0(V),ve=fK(()=>new YQ({id:L,labelId:void 0,modal:m,multiple:y,itemToStringLabel:b,itemToStringValue:S,isItemEqualToValue:C,value:z,open:V,mounted:pe,transitionStatus:he,items:v,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,ye=GQ(ve,C6.activeIndex),be=GQ(ve,C6.selectedIndex),xe=GQ(ve,C6.triggerElement),Se=GQ(ve,C6.positionerElement),Ce=Ple(ge),we=ge??Ce,Te=x.useMemo(()=>y&&Array.isArray(z)&&z.length===0?``:x6(z,S),[y,z,S]),Ee=x.useMemo(()=>y&&Array.isArray(z)?z.map(e=>x6(e,S)):x6(z,S),[y,z,S]);i3(EJ(ve.state.triggerElement),L,z,jJ(()=>Ee));let De=x.useRef(z),Oe=y?Array.isArray(z)&&z.length>0:z!=null;xK(()=>{z!==De.current&&ve.set(`forceMount`,!0)},[ve,z]),xK(()=>{M(Oe)},[Oe,M]),xK(function(){let e=oe.current,t;if(y){let n=Array.isArray(z)?z:[];if(n.length===0)t=null;else{let r=n[n.length-1],i=_6(e,r,C);t=i===-1?null:i}}else{let n=_6(e,z,C);t=n===-1?null:n}t===null&&(ue.current=null),!V&&ve.set(`selectedIndex`,t)},[Oe,y,V,z,oe,C,ve,ue]),i0(z,()=>{E(R),D(z!==j.initialValue),A()?F.commit(z):F.commit(z,!0)});let ke=jJ((e,t)=>{if(s?.(e,t),!t.isCanceled&&(H(e),!e&&(t.reason===`focus-out`||t.reason===`outside-press`)&&(O(!0),k(!1),I===`onBlur`&&F.commit(z)),!e&&ve.state.activeIndex!==null)){let e=te.current[ve.state.activeIndex];queueMicrotask(()=>{e?.setAttribute(`tabindex`,`-1`)})}}),Ae=jJ(()=>{me(!1),ve.update({activeIndex:null,openMethod:null}),_?.(!1)});o$({enabled:!h,open:V,ref:ne,onComplete(){V||Ae()}}),x.useImperativeHandle(h,()=>({unmount:Ae}),[Ae]);let je=jJ((e,t)=>{i?.(e,t),!t.isCanceled&&B(e)}),Me=jJ(()=>{let e=ve.state.listElement||ne.current;if(!e)return;let t=w6(e.scrollHeight,e.clientHeight),n=T6(e.scrollTop,t),r=n>0,i=n<t;ve.state.scrollUpArrowVisible!==r&&ve.set(`scrollUpArrowVisible`,r),ve.state.scrollDownArrowVisible!==i&&ve.set(`scrollDownArrowVisible`,i)}),Ne=E$({open:V,onOpenChange:ke,elements:{reference:xe,floating:Se}}),Pe=wZ(Ne,{enabled:!f&&!ee,event:`mousedown`}),Fe=jZ(Ne),Ie=W$(Ne,{enabled:!f&&!ee,listRef:te,activeIndex:ye,selectedIndex:be,disabledIndices:Wq,onNavigate(e){e===null&&!V||ve.set(`activeIndex`,e)},focusItemOnHover:w}),Le=G$(Ne,{enabled:!f&&!ee&&(V||!y),listRef:U,activeIndex:ye,selectedIndex:be,onMatch(e){V?ve.set(`activeIndex`,e):je(oe.current[e],pJ(`none`))},onTyping(e){se.current=e}}),Re=x.useMemo(()=>{let e=kX(Le.reference,Ie.reference,Fe.reference,Pe.reference,_e);return L&&(e.id=L),e},[Pe.reference,Le.reference,Ie.reference,Fe.reference,_e,L]),ze=x.useMemo(()=>kX(s$,Le.floating,Ie.floating,Fe.floating),[Le.floating,Ie.floating,Fe.floating]),Be=Ie.item??Gq;bK(()=>{ve.update({popupProps:ze,triggerProps:Re})}),xK(()=>{ve.update({id:L,modal:m,multiple:y,value:z,open:V,mounted:pe,transitionStatus:he,popupProps:ze,triggerProps:Re,items:v,itemToStringLabel:b,itemToStringValue:S,isItemEqualToValue:C,openMethod:we})},[ve,L,m,y,z,V,pe,he,ze,Re,v,b,S,C,we]);let Ve=x.useMemo(()=>({store:ve,name:R,required:p,disabled:ee,readOnly:f,multiple:y,highlightItemOnHover:w,setValue:je,setOpen:ke,listRef:te,popupRef:ne,scrollHandlerRef:re,handleScrollArrowVisibility:Me,scrollArrowsMountedCountRef:ie,itemProps:Be,events:Ne.context.events,valueRef:ae,valuesRef:oe,labelsRef:U,typingRef:se,selectionRef:de,firstItemTextRef:le,selectedItemTextRef:ue,validation:F,onOpenChangeComplete:_,keyboardActiveRef:ce,alignItemWithTriggerActiveRef:fe,initialValueRef:De}),[ve,R,p,ee,f,y,w,je,ke,Be,Ne.context.events,F,_,Me]),He=bJ(g,F.inputRef),Ue=y&&Array.isArray(z)&&z.length>0,We=y?void 0:R,Ge=x.useMemo(()=>!y||!Array.isArray(z)||!R?null:z.map(e=>{let t=x6(e,S);return(0,J.jsx)(`input`,{type:`hidden`,form:l,name:R,value:t},t)}),[y,z,l,R,S]);return(0,J.jsx)(f6.Provider,{value:Ve,children:(0,J.jsxs)(p6.Provider,{value:Ne,children:[T,(0,J.jsx)(`input`,{...F.getInputValidationProps({onFocus(){ve.state.triggerElement?.focus({focusVisible:!0})},onChange(e){if(e.nativeEvent.defaultPrevented||ee||f){e.preventBaseUIHandler?.();return}let t=e.currentTarget.value,n=pJ(Kq,e.nativeEvent);function r(){if(y)return;let e=oe.current.find(e=>x6(e,S).toLowerCase()===t.toLowerCase()||b6(e,b).toLowerCase()===t.toLowerCase());e!=null&&(D(e!==j.initialValue),je(e,n),A()&&F.commit(e))}ve.set(`forceMount`,!0),queueMicrotask(r)}}),id:L&&We==null?`${L}-hidden-input`:void 0,form:l,name:We,autoComplete:u,value:Te,disabled:ee,required:p&&!Ue,readOnly:f,ref:He,style:R?VJ:BJ,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Ge]})})}var E6=2,Ppe=400,Fpe={...p1,...$4,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},Ipe=x.forwardRef(function(e,t){let{render:n,className:r,id:i,disabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{setTouched:l,setFocused:u,validationMode:d,state:f,disabled:p}=e3(),{labelId:m}=n3(),{store:h,setOpen:g,selectionRef:_,validation:v,readOnly:y,required:b,alignItemWithTriggerActiveRef:S,disabled:C,keyboardActiveRef:w}=m6(),T=p||C||a,E=GQ(h,C6.open),D=GQ(h,C6.mounted),O=GQ(h,C6.value),k=GQ(h,C6.triggerProps),A=GQ(h,C6.positionerElement),j=GQ(h,C6.listElement),M=GQ(h,C6.popupSide),N=GQ(h,C6.id),P=GQ(h,C6.labelId),F=GQ(h,C6.hasSelectedValue),I=D&&A?M:null,L=i??N,ee=p3(m,P);r3({id:L});let R=EJ(A),z=x.useRef(null),{getButtonProps:B,buttonRef:V}=t0({disabled:T,native:o}),H=bJ(t,z,V,jJ(e=>{h.set(`triggerElement`,e)})),te=AK(),U=AK(),ne=AK();x.useEffect(()=>{if(E)return ne.start(Ppe,()=>{_.current.allowUnselectedMouseUp=!0,_.current.allowSelectedMouseUp=!0}),()=>{ne.clear()};_.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},U.clear()},[E,_,U,ne]);let re=kX(k,{id:L,role:`combobox`,"aria-expanded":E?`true`:`false`,"aria-haspopup":`listbox`,"aria-controls":E?j?.id??Lq(A)?.id:void 0,"aria-labelledby":ee,"aria-readonly":y||void 0,"aria-required":b||void 0,tabIndex:T?-1:0,ref:H,onFocus(e){u(!0),E&&S.current&&g(!1,pJ(Kq,e.nativeEvent)),te.start(0,()=>{h.set(`forceMount`,!0)})},onBlur(e){Oq(A,e.relatedTarget)||(l(!0),u(!1),d===`onBlur`&&v.commit(O))},onPointerMove(){w.current=!1},onKeyDown(){w.current=!0},onMouseDown(e){if(E)return;let t=RJ(e.currentTarget);function n(e){if(!z.current)return;let t=e.target;if(Oq(z.current,t)||Oq(R.current,t)||t===z.current)return;let n=V2(z.current);e.clientX>=n.left-E6&&e.clientX<=n.right+E6&&e.clientY>=n.top-E6&&e.clientY<=n.bottom+E6||g(!1,pJ(oJ,e))}U.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},v.getValidationProps,c,B);re.role=`combobox`;let ie={...f,open:E,disabled:T,value:O,readOnly:y,popupSide:I,placeholder:!F};return UX(`button`,e,{ref:[t,z],state:ie,stateAttributesMapping:Fpe,props:re})}),Lpe={value:()=>null},Rpe=x.forwardRef(function(e,t){let{className:n,render:r,children:i,placeholder:a,style:o,...s}=e,{store:c,valueRef:l}=m6(),u=GQ(c,C6.value),d=GQ(c,C6.items),f=GQ(c,C6.itemToStringLabel),p=GQ(c,C6.hasSelectedValue),m=!p&&a!=null&&i==null,h=GQ(c,C6.hasNullItemLabel,m),g={value:u,placeholder:!p},_=null;return _=typeof i==`function`?i(u):i??(!p&&a!=null&&!h?a:Array.isArray(u)?Mpe(u,d,f):S6(u,d,f)),UX(`span`,e,{state:g,ref:[t,l],props:[{children:_},s],stateAttributesMapping:Lpe})}),zpe=x.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{store:o}=m6();return UX(`span`,e,{state:{open:GQ(o,C6.open)},ref:t,props:[{"aria-hidden":!0,children:`▼`},a],stateAttributesMapping:f1})}),Bpe=x.createContext(void 0),Vpe=x.forwardRef(function(e,t){let{store:n}=m6(),r=GQ(n,C6.mounted),i=GQ(n,C6.forceMount);return r||i?(0,J.jsx)(Bpe.Provider,{value:!0,children:(0,J.jsx)(iZ,{ref:t,...e})}):null}),D6=x.createContext(void 0);function O6(){let e=x.useContext(D6);if(!e)throw Error(CK(59));return e}function k6(e,t){e&&Object.assign(e.style,t)}var A6={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`},Hpe={position:`fixed`},Upe=x.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o=`bottom`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m,alignItemWithTrigger:h=!0,collisionAvoidance:g=ZX,style:_,...v}=e,{store:y,listRef:b,labelsRef:S,alignItemWithTriggerActiveRef:C,selectedItemTextRef:w,valuesRef:T,initialValueRef:E,popupRef:D,setValue:O}=m6(),k=h6(),A=GQ(y,C6.open),j=GQ(y,C6.mounted),M=GQ(y,C6.modal),N=GQ(y,C6.value),P=GQ(y,C6.openMethod),F=GQ(y,C6.positionerElement),I=GQ(y,C6.triggerElement),L=GQ(y,C6.isItemEqualToValue),ee=GQ(y,C6.transitionStatus),R=x.useRef(null),z=x.useRef(null),[B,V]=x.useState(h),H=j&&B&&P!==`touch`;!j&&B!==h&&V(h),xK(()=>{j||(C6.scrollUpArrowVisible(y.state)&&y.set(`scrollUpArrowVisible`,!1),C6.scrollDownArrowVisible(y.state)&&y.set(`scrollDownArrowVisible`,!1))},[y,j]),x.useImperativeHandle(C,()=>H),m0((H||M)&&A,P===`touch`,F,I);let te=P1({anchor:n,floatingRootContext:k,positionMethod:r,mounted:j,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m??H,collisionAvoidance:g,keepMounted:!0}),U=H?`none`:te.side,ne=H?Hpe:te.positionerStyles,re={open:A,side:U,align:te.align,anchorHidden:te.anchorHidden};xK(()=>{y.set(`popupSide`,te.side)},[y,te.side]);let ie=L1(e,re,{styles:ne,transitionStatus:ee,props:v,refs:[t,jJ(e=>{y.set(`positionerElement`,e)})],hidden:!j,inert:!A}),ae=x.useRef(0),oe=jJ(e=>{if(e.size===0&&ae.current===0||T.current.length===0)return;let t=ae.current;if(ae.current=e.size,e.size===t)return;let n=pJ(Kq);if(t!==0&&!y.state.multiple&&N!==null&&_6(T.current,N,L)===-1){let e=E.current,t=e!=null&&_6(T.current,e,L)!==-1?e:null;O(t,n),t===null&&(y.set(`selectedIndex`,null),w.current=null)}if(t!==0&&y.state.multiple&&Array.isArray(N)){let e=e=>_6(T.current,e,L)!==-1,t=N.filter(t=>e(t));(t.length!==N.length||t.some(e=>!kpe(N,e,L)))&&(O(t,n),t.length===0&&(y.set(`selectedIndex`,null),w.current=null))}if(A&&H){y.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};k6(F,e),k6(D.current,e)}}),se=x.useMemo(()=>({...te,side:U,alignItemWithTriggerActive:H,setControlledAlignItemWithTrigger:V,scrollUpArrowRef:R,scrollDownArrowRef:z}),[te,U,H,V]);return(0,J.jsx)(P2,{elementsRef:b,labelsRef:S,onMapChange:oe,children:(0,J.jsxs)(D6.Provider,{value:se,children:[j&&M&&(0,J.jsx)(l0,{inert:z1(!A),cutout:I}),ie]})})}),j6=`base-ui-disable-scrollbar`,M6={className:j6,getElement(e){return(0,J.jsx)(`style`,{nonce:e,href:j6,precedence:`base-ui:low`,children:`.${j6}{scrollbar-width:none}.${j6}::-webkit-scrollbar{display:none}`})}},Wpe={...m1,...i$},Gpe=x.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s,popupRef:c,onOpenChangeComplete:l,setOpen:u,valueRef:d,firstItemTextRef:f,selectedItemTextRef:p,keyboardActiveRef:m,multiple:h,handleScrollArrowVisibility:g,scrollHandlerRef:_,listRef:v,highlightItemOnHover:y}=m6(),{side:b,align:S,alignItemWithTriggerActive:C,isPositioned:w,setControlledAlignItemWithTrigger:T,scrollDownArrowRef:E,scrollUpArrowRef:D}=O6(),O=A0(!0)!=null,k=h6(),A=k1(),{nonce:j,disableStyleElements:M}=k3(),N=GQ(s,C6.id),P=GQ(s,C6.open),F=GQ(s,C6.mounted),I=GQ(s,C6.popupProps),L=GQ(s,C6.transitionStatus),ee=GQ(s,C6.triggerElement),R=GQ(s,C6.positionerElement),z=GQ(s,C6.listElement),B=x.useRef(!1),V=x.useRef(!1),H=x.useRef({}),te=LJ(),U=jJ(e=>{if(!R||!c.current||!V.current)return;if(B.current||!C){g();return}let t=R.style.top===`0px`,n=R.style.bottom===`0px`;if(!t&&!n){g();return}let r=F6(R),i=I6(R.getBoundingClientRect().height,`y`,r),a=RJ(R),o=getComputedStyle(R),s=parseFloat(o.marginTop),l=parseFloat(o.marginBottom),u=N6(getComputedStyle(c.current)),d=Math.min(a.documentElement.clientHeight-s-l,u),f=e.scrollTop,p=P6(e),m=0,h=null,_=!1,v=!1,y=e=>{R.style.height=`${e}px`},b=(t,n)=>{let r=d3(t,0,d-i);r>0&&y(i+r),e.scrollTop=n,d-(i+r)<=1&&(B.current=!0),g()},x=t?p-f:f,S=Math.min(i+x,d);if(m=S,x<=1){b(x,t?p:0);return}if(d-S>1?t?v=!0:h=0:(_=!0,n&&f<p&&(h=f-(x-(i+x-d)))),m=Math.ceil(m),m!==0&&y(m),v||h!=null){let t=P6(e),n=v?t:d3(h,0,t);Math.abs(e.scrollTop-n)>1&&(e.scrollTop=n)}(_||m>=d-1)&&(B.current=!0),g()});x.useImperativeHandle(_,()=>U,[U]),o$({open:P,ref:c,onComplete(){P&&l?.(!0)}});let ne={open:P,transitionStatus:L,side:b,align:S};xK(()=>{!R||!c.current||Object.keys(H.current).length||(H.current={top:R.style.top||`0`,left:R.style.left||`0`,right:R.style.right,height:R.style.height,bottom:R.style.bottom,minHeight:R.style.minHeight,maxHeight:R.style.maxHeight,marginTop:R.style.marginTop,marginBottom:R.style.marginBottom})},[c,R]),xK(()=>{P||C||(V.current=!1,B.current=!1,k6(R,H.current))},[P,C,R,c]),xK(()=>{let e=c.current;if(!P||!ee||!R||!e||C&&!w||s.state.transitionStatus===`ending`)return;if(!C){V.current=!0,te.request(g),e.style.removeProperty(`--transform-origin`);return}let t=Kpe(e);e.style.removeProperty(`--transform-origin`);try{let t=p.current;t?.isConnected||(t=!C6.hasSelectedValue(s.state)&&f.current?.isConnected?f.current:null);let n=d.current,r=getComputedStyle(R),i=getComputedStyle(e),a=RJ(ee),o=QK(R),c=F6(ee),l=L6(ee.getBoundingClientRect(),c),u=L6(R.getBoundingClientRect(),c),m=l.height,h=z||e,_=h.scrollHeight,b=parseFloat(i.borderBottomWidth),x=parseFloat(r.marginTop)||10,S=parseFloat(r.marginBottom)||10,C=parseFloat(r.minHeight)||100,w=N6(i),E=a.documentElement.clientHeight-x-S,D=a.documentElement.clientWidth,O=E-l.bottom+m,k,j=A===`rtl`?l.right-u.width:l.left,M=0;if(t&&n){let e=L6(n.getBoundingClientRect(),c);k=L6(t.getBoundingClientRect(),c),j=u.left+(A===`rtl`?e.right-k.right:e.left-k.left);let r=e.top-l.top+e.height/2;M=k.top-u.top+k.height/2-r}let N=O+M+S+b,P=Math.min(E,N),F=E-x-S,I=N-P,L=D-5;R.style.left=`${d3(j,5,L-u.width)}px`,R.style.height=`${P}px`,R.style.maxHeight=`auto`,R.style.marginTop=`${x}px`,R.style.marginBottom=`${S}px`,e.style.height=`100%`;let te=P6(h),U=I>=te-1;U&&(P=Math.min(E,u.height)-(I-te));let ne=l.top<20||l.bottom>E-20||Math.ceil(P)+1<Math.min(_,C),re=(o.visualViewport?.scale??1)!==1&&FK;if(ne||re){V.current=!0,k6(R,H.current),T(!1);return}let ie=Math.max(C,P);if(U){let e=Math.max(0,E-N);R.style.top=u.height>=F?`0`:`${e}px`,R.style.height=`${P}px`,h.scrollTop=P6(h)}else R.style.bottom=`0`,h.scrollTop=I;if(k){let t=u.top,n=u.height,r=k.top+k.height/2,i=d3(n>0?(r-t)/n*100:50,0,100);e.style.setProperty(`--transform-origin`,`50% ${i}%`)}(ie===E||P>=w)&&(B.current=!0),g(),y&&s.state.selectedIndex===null&&s.state.activeIndex===null&&v.current[0]!=null&&s.set(`activeIndex`,0),V.current=!0}finally{t()}},[s,P,R,ee,d,f,p,c,g,C,T,te,E,D,z,v,y,A,w]),x.useEffect(()=>{if(!C||!R||!P)return;let e=QK(R);function t(e){u(!1,pJ(fJ,e))}return vJ(e,`resize`,t)},[u,C,R,P]);let re={...z?{role:`presentation`,"aria-orientation":void 0}:{role:`listbox`,"aria-multiselectable":h||void 0,id:`${N}-list`},onKeyDown(e){m.current=!0,O&&T0.has(e.key)&&e.stopPropagation()},onMouseMove(){m.current=!1},onScroll(e){z||U(e.currentTarget)},...C&&{style:z?{height:`100%`}:A6}},ie=UX(`div`,e,{ref:[t,c],state:ne,stateAttributesMapping:Wpe,props:[I,re,I1(L),{className:!z&&C?M6.className:void 0},o]});return(0,J.jsxs)(x.Fragment,{children:[!M&&M6.getElement(j),(0,J.jsx)(CZ,{context:k,modal:!1,disabled:!F,returnFocus:a,restoreFocus:!0,children:ie})]})});function N6(e){let t=e.maxHeight||``;return t.endsWith(`px`)&&parseFloat(t)||1/0}function P6(e){return w6(e.scrollHeight,e.clientHeight)}function F6(e){return vQ.getScale(e)}function I6(e,t,n){return e/n[t]}function L6(e,t){return gY({x:I6(e.x,`x`,t),y:I6(e.y,`y`,t),width:I6(e.width,`x`,t),height:I6(e.height,`y`,t)})}var R6=[[`transform`,`none`],[`scale`,`1`],[`translate`,`0 0`]];function Kpe(e){let{style:t}=e,n={};for(let[e,r]of R6)n[e]=t.getPropertyValue(e),t.setProperty(e,r,`important`);return()=>{for(let[e]of R6){let r=n[e];r?t.setProperty(e,r):t.removeProperty(e)}}}var qpe=x.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{store:o,scrollHandlerRef:s}=m6(),{alignItemWithTriggerActive:c}=O6(),l=GQ(o,C6.hasScrollArrows),u=GQ(o,C6.openMethod),d=GQ(o,C6.multiple),f={id:`${GQ(o,C6.id)}-list`,role:`listbox`,"aria-multiselectable":d||void 0,onScroll(e){s.current?.(e.currentTarget)},...c&&{style:A6},className:l&&u!==`touch`?M6.className:void 0};return UX(`div`,e,{ref:[t,jJ(e=>{o.set(`listElement`,e)})],props:[f,a]})}),z6=x.createContext(void 0);function B6(){let e=x.useContext(z6);if(!e)throw Error(CK(57));return e}var Jpe=x.memo(x.forwardRef(function(e,t){let{render:n,className:r,style:i,value:a=null,label:o,disabled:s=!1,nativeButton:c=!1,...l}=e,u=x.useRef(null),d=O2({label:o,textRef:u,indexGuessBehavior:D2.GuessFromOrder}),{store:f,itemProps:p,setOpen:m,setValue:h,selectionRef:g,typingRef:_,valuesRef:v,multiple:y,selectedItemTextRef:b}=m6(),S=GQ(f,C6.isActive,d.index),C=GQ(f,C6.isSelected,d.index,a),w=GQ(f,C6.isSelectedByFocus,d.index),T=GQ(f,C6.isItemEqualToValue),E=d.index,D=E!==-1,O=x.useRef(null);xK(()=>{if(!D)return;let e=v.current;return e[E]=a,()=>{delete e[E]}},[D,E,a,v]),xK(()=>{if(!D)return;let e=f.state.value,t=e;y&&Array.isArray(e)&&e.length>0&&(t=e[e.length-1]),t!==void 0&&g6(a,t,T)&&(f.set(`selectedIndex`,E),u.current&&(b.current=u.current))},[D,E,y,T,f,a,b]);let k=x.useRef(null),A=x.useRef(`mouse`),j=x.useRef(!1),{getButtonProps:M,buttonRef:N}=t0({disabled:s,focusableWhenDisabled:!0,native:c,composite:!0}),P={disabled:s,selected:C,highlighted:S};function F(e){let t=f.state.value;if(y){let n=Array.isArray(t)?t:[];h(C?Ape(n,a,T):[...n,a],pJ(Zq,e))}else h(a,pJ(Zq,e)),m(!1,pJ(Zq,e))}function I(){g.current.dragY=0}let L={role:`option`,"aria-selected":C,tabIndex:S?0:-1,onKeyDown(e){k.current=e.key,f.set(`activeIndex`,E),e.key===` `&&_.current&&e.preventDefault()},onClick(e){let t=e.type===`click`&&A.current!==`touch`,n=e.nativeEvent.pointerType,r=t&&KK(e.nativeEvent)&&(n!==void 0||S),i=t&&!r&&!j.current;j.current=!1,!(e.type===`keydown`&&k.current===null)&&(s||e.type===`keydown`&&k.current===` `&&_.current||i||(k.current=null,F(e.nativeEvent)))},onPointerEnter(e){A.current=e.pointerType},onPointerMove(e){if(e.pointerType===`mouse`&&e.buttons===1){let t=g.current;t.dragY+=e.movementY,t.dragY**2>=64&&(t.allowUnselectedMouseUp=!0)}},onPointerDown(e){A.current=e.pointerType,j.current=!0,I()},onMouseUp(){if(I(),s||A.current===`touch`||j.current)return;let e=!g.current.allowSelectedMouseUp&&C,t=!g.current.allowUnselectedMouseUp&&!C;e||t||(j.current=!0,O.current?.click(),j.current=!1)}},ee=UX(`div`,e,{ref:[N,t,d.ref,O],state:P,props:[p,L,l,M]}),R=x.useMemo(()=>({selected:C,index:E,textRef:u,selectedByFocus:w,hasRegistered:D}),[C,E,u,w,D]);return(0,J.jsx)(z6.Provider,{value:R,children:ee})})),Ype=x.forwardRef(function(e,t){let n=e.keepMounted??!1,{selected:r}=B6();return n||r?(0,J.jsx)(Xpe,{...e,ref:t}):null}),Xpe=x.memo(x.forwardRef((e,t)=>{let{render:n,className:r,style:i,keepMounted:a,...o}=e,{selected:s}=B6(),c=x.useRef(null),{transitionStatus:l,setMounted:u}=e$(s),d=UX(`span`,e,{ref:[t,c],state:{selected:s,transitionStatus:l},props:[{"aria-hidden":!0,children:`✔️`},o],stateAttributesMapping:i$});return o$({open:s,ref:c,onComplete(){s||u(!1)}}),d})),Zpe=x.memo(x.forwardRef(function(e,t){let{index:n,textRef:r,selectedByFocus:i,hasRegistered:a}=B6(),{firstItemTextRef:o,selectedItemTextRef:s}=m6(),{render:c,className:l,style:u,...d}=e;return UX(`div`,e,{ref:[x.useCallback(e=>{e&&(a&&n===0&&(o.current=e),a&&i&&(s.current=e))},[o,s,n,i,a]),t,r],props:d})})),V6=x.forwardRef(function(e,t){let{render:n,className:r,style:i,direction:a,keepMounted:o=!1,...s}=e,c=a===`up`,{store:l,popupRef:u,listRef:d,handleScrollArrowVisibility:f,scrollArrowsMountedCountRef:p}=m6(),{side:m,scrollDownArrowRef:h,scrollUpArrowRef:g}=O6(),_=GQ(l,c?C6.scrollUpArrowVisible:C6.scrollDownArrowVisible),v=GQ(l,C6.openMethod),y=_&&v!==`touch`,b=AK(),x=c?g:h,{transitionStatus:S,setMounted:C}=e$(y);xK(()=>(p.current+=1,l.state.hasScrollArrows||l.set(`hasScrollArrows`,!0),()=>{p.current=Math.max(0,p.current-1),p.current===0&&l.state.hasScrollArrows&&l.set(`hasScrollArrows`,!1)}),[l,p]),o$({open:y,ref:x,onComplete(){y||C(!1)}});let w=UX(`div`,e,{ref:[t,x],state:{direction:a,visible:y,side:m,transitionStatus:S},props:[{"aria-hidden":!0,children:c?`▲`:`▼`,style:{position:`absolute`},onMouseMove(e){if(e.movementX===0&&e.movementY===0||b.isStarted())return;l.set(`activeIndex`,null);function t(){let e=l.state.listElement??u.current;if(!e)return;l.set(`activeIndex`,null),f();let n=w6(e.scrollHeight,e.clientHeight),r=T6(e.scrollTop,n),i=r===(c?0:n),a=d.current;if(r!==e.scrollTop&&(e.scrollTop=r),a.length===0&&l.set(c?`scrollUpArrowVisible`:`scrollDownArrowVisible`,!i),i){b.clear();return}if(a.length>0){let t=x.current?.offsetHeight||0;e.scrollTop=Qpe(a,c,r,e.clientHeight,t,n)}b.start(40,t)}b.start(40,t)},onMouseLeave(){b.clear()}},s]});return y||o?w:null});function Qpe(e,t,n,r,i,a){if(t){let t=0,r=n+i-1;for(let n=0;n<e.length;n+=1){let i=e[n];if(i&&i.offsetTop>=r){t=n;break}}let o=Math.max(0,t-1),s=e[o];return o<t&&s?T6(s.offsetTop-i,a):0}let o=e.length-1,s=n+r-i+1;for(let t=0;t<e.length;t+=1){let n=e[t];if(n&&n.offsetTop+n.offsetHeight>s){o=Math.max(0,t-1);break}}let c=Math.min(e.length-1,o+1),l=e[c];return c>o&&l?T6(l.offsetTop+l.offsetHeight-r+i,a):a}var $pe=x.forwardRef(function(e,t){return(0,J.jsx)(V6,{...e,ref:t,direction:`down`})}),eme=x.forwardRef(function(e,t){return(0,J.jsx)(V6,{...e,ref:t,direction:`up`})}),H6=x.createContext(void 0);function tme(){let e=x.useContext(H6);if(e===void 0)throw Error(CK(56));return e}var nme=x.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,[o,s]=x.useState(),c=x.useMemo(()=>({labelId:o,setLabelId:s}),[o,s]),l=UX(`div`,e,{ref:t,props:[{role:`group`,"aria-labelledby":o},a]});return(0,J.jsx)(H6.Provider,{value:c,children:l})}),rme=x.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{setLabelId:s}=tme(),c=h1(a);return xK(()=>{s(c)},[c,s]),UX(`div`,e,{ref:t,props:[{id:c},o]})}),U6=Npe,ime=x.forwardRef(({className:e,...t},n)=>(0,J.jsx)(nme,{ref:n,"data-slot":`select-group`,className:rK(`pn:scroll-my-1`,e),...t}));ime.displayName=`SelectGroup`;function W6({...e}){return(0,J.jsx)(Rpe,{"data-slot":`select-value`,...e})}var G6=x.forwardRef(({className:e,size:t=`default`,children:n,...r},i)=>(0,J.jsxs)(Ipe,{ref:i,"data-slot":`select-trigger`,"data-size":t,className:rK(`pn:flex pn:w-fit pn:items-center pn:justify-between pn:gap-2 pn:rounded-md pn:border pn:border-input pn:bg-transparent pn:px-3 pn:py-2 pn:text-sm pn:whitespace-nowrap pn:shadow-xs pn:transition-[color,box-shadow] pn:outline-none pn:focus-visible:border-ring pn:focus-visible:ring-[3px] pn:focus-visible:ring-ring/50 pn:disabled:cursor-not-allowed pn:disabled:opacity-50 pn:aria-invalid:border-destructive pn:aria-invalid:ring-destructive/20 pn:data-[placeholder]:text-muted-foreground pn:data-[size=default]:h-9 pn:data-[size=sm]:h-8 pn:*:data-[slot=select-value]:line-clamp-1 pn:*:data-[slot=select-value]:flex pn:*:data-[slot=select-value]:items-center pn:*:data-[slot=select-value]:gap-2 pn:dark:bg-input/30 pn:dark:hover:bg-input/50 pn:dark:aria-invalid:ring-destructive/40 pn:[&_svg]:pointer-events-none pn:[&_svg]:shrink-0 pn:[&_svg:not([class*='size-'])]:size-4 pn:[&_svg:not([class*='text-'])]:text-muted-foreground`,e),...r,children:[n,(0,J.jsx)(zpe,{render:(0,J.jsx)(aU,{className:`pn:size-4 pn:opacity-50`})})]}));G6.displayName=`SelectTrigger`;var K6=x.forwardRef(({className:e,children:t,side:n,align:r=`center`,sideOffset:i,alignItemWithTrigger:a=!0,...o},s)=>{let{container:c,className:l,...u}=W1();return(0,J.jsx)(Vpe,{container:c,children:(0,J.jsx)(Upe,{side:n,align:r,sideOffset:i,alignItemWithTrigger:a,positionMethod:`fixed`,className:`pn:z-50`,children:(0,J.jsxs)(Gpe,{ref:s,"data-slot":`select-content`,"data-align-trigger":a,...u,className:rK(l,`pn:relative pn:z-50 max-h-(--available-height) pn:min-w-[8rem] origin-(--transform-origin) pn:overflow-x-hidden pn:overflow-y-auto pn:rounded-md pn:border pn:bg-popover pn:text-popover-foreground pn:shadow-md pn:data-[align-trigger=true]:animate-none pn:data-[side=bottom]:slide-in-from-top-2 pn:data-[side=left]:slide-in-from-right-2 pn:data-[side=right]:slide-in-from-left-2 pn:data-[side=top]:slide-in-from-bottom-2 pn:data-[closed]:animate-out pn:data-[closed]:fade-out-0 pn:data-[closed]:zoom-out-95 pn:data-[open]:animate-in pn:data-[open]:fade-in-0 pn:data-[open]:zoom-in-95`,e),...o,children:[(0,J.jsx)(J6,{}),(0,J.jsx)(qpe,{className:`pn:p-1`,children:t}),(0,J.jsx)(Y6,{})]})})})});K6.displayName=`SelectContent`;var ame=x.forwardRef(({className:e,...t},n)=>(0,J.jsx)(rme,{ref:n,"data-slot":`select-label`,className:rK(`pn:px-2 pn:py-1.5 pn:text-xs pn:text-muted-foreground`,e),...t}));ame.displayName=`SelectLabel`;var q6=x.forwardRef(({className:e,children:t,...n},r)=>(0,J.jsxs)(Jpe,{ref:r,"data-slot":`select-item`,className:rK(`pn:relative pn:flex pn:w-full pn:cursor-default pn:items-center pn:gap-2 pn:rounded-sm pn:py-1.5 pn:pr-8 pn:pl-2 pn:text-sm pn:outline-hidden pn:select-none pn:data-highlighted:bg-accent pn:data-highlighted:text-accent-foreground pn:data-[disabled]:pointer-events-none pn:data-[disabled]:opacity-50 pn:[&_svg]:pointer-events-none pn:[&_svg]:shrink-0 pn:[&_svg:not([class*='size-'])]:size-4 pn:[&_svg:not([class*='text-'])]:text-muted-foreground pn:*:[span]:last:flex pn:*:[span]:last:items-center pn:*:[span]:last:gap-2`,e),...n,children:[(0,J.jsx)(`span`,{"data-slot":`select-item-indicator`,className:`pn:absolute pn:right-2 pn:flex pn:size-3.5 pn:items-center pn:justify-center`,children:(0,J.jsx)(Ype,{children:(0,J.jsx)(iU,{className:`pn:size-4`})})}),(0,J.jsx)(Zpe,{children:t})]}));q6.displayName=`SelectItem`;var ome=x.forwardRef(({className:e,...t},n)=>(0,J.jsx)(s2,{ref:n,"data-slot":`select-separator`,className:rK(`pn:pointer-events-none pn:-mx-1 pn:my-1 pn:h-px pn:bg-border`,e),...t}));ome.displayName=`SelectSeparator`;var J6=x.forwardRef(({className:e,...t},n)=>(0,J.jsx)(eme,{ref:n,"data-slot":`select-scroll-up-button`,className:rK(`pn:flex pn:cursor-default pn:items-center pn:justify-center pn:py-1`,e),...t,children:(0,J.jsx)(cU,{className:`pn:size-4`})}));J6.displayName=`SelectScrollUpButton`;var Y6=x.forwardRef(({className:e,...t},n)=>(0,J.jsx)($pe,{ref:n,"data-slot":`select-scroll-down-button`,className:rK(`pn:flex pn:cursor-default pn:items-center pn:justify-center pn:py-1`,e),...t,children:(0,J.jsx)(aU,{className:`pn:size-4`})}));Y6.displayName=`SelectScrollDownButton`;var X6=({checked:e,label:t,onChange:n})=>(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginTop:`8px`},children:[(0,J.jsx)(`label`,{className:`pn:text-xs`,children:t}),(0,J.jsx)(F3,{checked:e,onCheckedChange:n})]}),sme=W(({element:e,store:t,enabled:n})=>{let r=e.animations.find(e=>e.type===`enter`),i=e.animations.find(e=>e.type===`exit`);return n?(0,J.jsxs)(d6,{fill:!0,children:[(0,J.jsx)(uK,{variant:`outline`,size:`sm`,className:rK(`pn:flex-1`,r?.enabled&&!i?.enabled&&`pn:bg-accent pn:text-accent-foreground`),onClick:()=>{t.history.transaction(()=>{e.setAnimation(`enter`,{enabled:!0}),e.setAnimation(`exit`,{enabled:!1})})},children:`Enter`}),(0,J.jsx)(uK,{variant:`outline`,size:`sm`,className:rK(`pn:flex-1`,r?.enabled&&i?.enabled&&`pn:bg-accent pn:text-accent-foreground`),onClick:()=>{t.history.transaction(()=>{e.setAnimation(`enter`,{enabled:!0}),e.setAnimation(`exit`,{enabled:!0})})},children:`Both`}),(0,J.jsx)(uK,{variant:`outline`,size:`sm`,className:rK(`pn:flex-1`,i?.enabled&&!r?.enabled&&`pn:bg-accent pn:text-accent-foreground`),onClick:()=>{t.history.transaction(()=>{e.setAnimation(`enter`,{enabled:!1}),e.setAnimation(`exit`,{enabled:!0})})},children:`Exit`})]}):null}),cme=[`right`,`left`,`up`,`down`,`bottom-right`,`bottom-left`,`top-right`,`top-left`],Z6={right:(0,J.jsx)($,{name:`animation.directionRight`,className:`pn:size-4`}),left:(0,J.jsx)($,{name:`animation.directionLeft`,className:`pn:size-4`}),up:(0,J.jsx)($,{name:`animation.directionUp`,className:`pn:size-4`}),down:(0,J.jsx)($,{name:`animation.directionDown`,className:`pn:size-4`}),"bottom-right":(0,J.jsx)($,{name:`animation.directionBottomRight`,className:`pn:size-4`}),"bottom-left":(0,J.jsx)($,{name:`animation.directionBottomLeft`,className:`pn:size-4`}),"top-right":(0,J.jsx)($,{name:`animation.directionTopRight`,className:`pn:size-4`}),"top-left":(0,J.jsx)($,{name:`animation.directionTopLeft`,className:`pn:size-4`})},lme=W(({value:e,onChange:t})=>(0,J.jsx)(`div`,{style:{paddingTop:`10px`},children:(0,J.jsxs)(U6,{value:e,onValueChange:e=>{e!==null&&t(e)},children:[(0,J.jsx)(G6,{className:`pn:w-full`,children:(0,J.jsx)(W6,{children:(0,J.jsxs)(`span`,{className:`pn:flex pn:items-center pn:gap-2`,children:[Z6[e],e]})})}),(0,J.jsx)(K6,{children:cme.map(e=>(0,J.jsx)(q6,{value:e,children:(0,J.jsxs)(`span`,{className:`pn:flex pn:items-center pn:gap-2`,children:[Z6[e],e]})},e))})]})})),ume=W(({element:e})=>{let t=e.animations.find(e=>e.type===`enter`);return t?(0,J.jsxs)(`div`,{style:{padding:`10px`},children:[(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,paddingTop:`5px`,paddingBottom:`5px`},children:[(0,J.jsx)(`div`,{children:`Delay`}),(0,J.jsx)(`div`,{children:(0,J.jsx)(s3,{value:parseFloat((t.delay/1e3).toFixed(2)),onValueChange:t=>{e.setAnimation(`enter`,{delay:t*1e3})},style:{width:`50px`},step:.01,min:0,max:2.5})})]}),(0,J.jsx)(j3,{min:0,max:1e3,step:1,value:[t.delay],onValueChange:t=>{let n=aK(t);e.setAnimation(`enter`,{delay:n})}})]}):null}),dme=W(({element:e})=>{let t=e.animations.find(e=>e.type===`enter`);return t?(0,J.jsxs)(`div`,{style:{padding:`10px`},children:[(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,paddingTop:`5px`,paddingBottom:`5px`},children:[(0,J.jsx)(`div`,{children:`Duration`}),(0,J.jsx)(`div`,{children:(0,J.jsx)(s3,{value:parseFloat((t.duration/1e3).toFixed(2)),onValueChange:t=>{e.setAnimation(`enter`,{duration:t*1e3}),e.setAnimation(`exit`,{duration:t*1e3})},style:{width:`50px`},step:.01,min:0,max:2.5})})]}),(0,J.jsx)(j3,{min:0,max:2500,step:1,value:[t.duration],onValueChange:t=>{let n=aK(t);e.setAnimation(`enter`,{duration:n}),e.setAnimation(`exit`,{duration:n})}})]}):null});W(({element:e,store:t,elements:n})=>{let r=n||[e],i=r[0],a=(e,n)=>{t.history.transaction(()=>{r.forEach(t=>{t.setAnimation(`enter`,{name:e,...n}),t.setAnimation(`exit`,{name:e,...n,from:n.to,to:n.from})})}),n.enabled&&(t.play({animatedElementsIds:r.map(e=>e.id),currentTime:i.page.startTime}),setTimeout(()=>{t.stop()},1e3))},o=(e,n)=>{t.history.transaction(()=>{r.forEach(t=>{t.setAnimation(`loop`,{name:e,...n})})}),n.enabled&&(t.play({animatedElementsIds:r.map(e=>e.id),currentTime:i.page.startTime}),setTimeout(()=>{t.stop()},1e3))},s=(e,t)=>!!((e?i.animations?.filter(t=>t.name===e):i.animations)||[]).find(e=>e.enabled);return(0,J.jsxs)(j0,{children:[(0,J.jsx)(M0,{render:(0,J.jsx)(uK,{variant:`ghost`,size:`sm`,children:Q(`toolbar.animate`)})}),(0,J.jsxs)(N0,{align:`start`,initialFocus:!1,style:{padding:`15px`,paddingTop:`25px`,width:`230px`},children:[(0,J.jsx)(X6,{checked:s(`fade`),label:Q(`toolbar.fade`),onChange:e=>{a(`fade`,{enabled:e})}}),(0,J.jsx)(X6,{checked:s(`move`),label:Q(`toolbar.move`),onChange:e=>{a(`move`,{enabled:e})}}),(0,J.jsx)(X6,{checked:s(`zoom`),label:Q(`toolbar.zoom`),onChange:e=>{a(`zoom`,{enabled:e})}}),(0,J.jsx)(sme,{element:i,store:t,enabled:s()}),s(`move`)&&(0,J.jsx)(lme,{value:i.animations.find(e=>e.name===`move`)?.data?.direction||`right`,onChange:e=>{a(`move`,{data:{direction:e},enabled:!0})}}),s()&&(0,J.jsx)(ume,{store:t,element:i}),s()&&(0,J.jsx)(dme,{store:t,element:i}),(0,J.jsx)(X6,{checked:s(`rotate`),label:Q(`toolbar.rotate`),onChange:e=>{o(`rotate`,{enabled:e})}})]})]})});var Q6=W(({element:e,store:t})=>e.contentEditable?(0,J.jsx)(uK,{variant:`ghost`,size:`sm`,onClickCapture:e=>{e.stopPropagation(),t.openSidePanel(`animation`)},children:Q(`toolbar.animate`)}):null),fme=Dv(),pme=({fontFamily:e,handleClick:t,modifiers:n,store:r,isCustom:i})=>{let[a,o]=x.useState(!i);x.useEffect(()=>{a||r.loadFont(e)},[e,a]);let s=()=>{o(!1)};if(e===`_divider`)return(0,J.jsx)(`div`,{style:{paddingTop:`10px`},children:(0,J.jsx)(c2,{})});let c=a?(0,J.jsx)(`img`,{src:$g(e),alt:e,onError:s,className:`pn:h-5 pn:dark:invert`}):e;return(0,J.jsx)(`button`,{type:`button`,onClick:t,disabled:n.disabled,"data-active":n.active||void 0,className:rK(`pn:flex pn:w-full pn:items-center pn:rounded-sm pn:px-2 pn:py-1.5 pn:text-left pn:text-sm pn:hover:bg-muted`,n.active&&`pn:bg-muted`),style:{fontFamily:`"`+e+`"`},children:c})},mme=({onChange:e,defaultValue:t})=>{let n=x.useRef(null);return x.useEffect(()=>{n.current&&n.current.focus()},[]),(0,J.jsxs)(c3,{children:[(0,J.jsx)(`span`,{className:`pn:flex pn:items-center pn:pl-2 pn:pr-1 pn:text-muted-foreground`,children:(0,J.jsx)($,{name:`action.search`,className:`pn:size-3.5 pn:shrink-0 pn:opacity-50`})}),(0,J.jsx)(`input`,{ref:n,"data-slot":`input-group-control`,defaultValue:t,onChange:t=>e(t.target.value),className:`pn:h-full pn:w-full pn:flex-1 pn:border-0 pn:bg-transparent pn:px-2 pn:text-xs pn:outline-none pn:placeholder:text-muted-foreground`})]})},$6=({store:e,fonts:t,activeFont:n,activeFontLabel:r,onFontSelect:i,mixed:a,mixedFonts:o,open:s,onOpenChange:c})=>{let[l,u]=x.useState(``),d=t.filter(e=>e?.toLowerCase().indexOf(l.toLowerCase())>=0);return(0,J.jsxs)(j0,{open:s,onOpenChange:c,children:[(0,J.jsxs)(K1,{children:[(0,J.jsx)(q1,{render:(0,J.jsx)(M0,{render:(0,J.jsxs)(uK,{variant:`ghost`,size:`sm`,className:`pn:gap-1 pn:overflow-hidden pn:whitespace-nowrap`,style:{fontFamily:a?void 0:`"`+n+`"`,fontStyle:a?`italic`:void 0,color:a?`#5c7080`:void 0},"aria-label":Q(`toolbar.fontFamily`),children:[(0,J.jsx)(`span`,{className:`pn:truncate`,children:a?Q(`toolbar.fontFamilyMixed`):r}),(0,J.jsx)($,{name:`ui.chevronDown`,className:`pn:size-3 pn:shrink-0 pn:opacity-50`})]})})}),(0,J.jsx)(J1,{side:`bottom`,children:a&&o&&o.length>0?`${Q(`toolbar.fontsInSelection`)}: ${o.join(`, `)}`:Q(`toolbar.fontFamily`)})]}),(0,J.jsx)(N0,{className:`pn:w-[230px] pn:p-2`,align:`start`,children:(0,J.jsxs)(`div`,{children:[(0,J.jsx)(mme,{onChange:e=>u(e),defaultValue:l}),(0,J.jsx)(`div`,{style:{paddingTop:`5px`},children:(0,J.jsx)(Mde,{height:Math.min(400,d.length*30)+10,width:210,itemCount:d.length,itemSize:30,children:({index:t,style:r})=>{let a=d[t];return(0,J.jsx)(`div`,{style:r,children:(0,J.jsx)(pme,{fontFamily:a,modifiers:{active:n===a},handleClick:()=>i(a),store:e,isCustom:e.fonts.find(e=>e.fontFamily===a)||Ov.find(e=>e.fontFamily===a)},a)})}})})]})})]})},e8={},t8=e=>e8[e]?Promise.resolve(e8[e]):fetch(e).then(e=>e.json()).then(t=>(e8[e]=t,t)),n8=W(({elements:e,store:t})=>{let[n,r]=x.useState(!1),{data:i,mutate:a}=X4(n?Qg():null,t8,{isPaused:()=>Tv(),fallbackData:[]});x.useEffect(()=>{a()},[Tv()]);let o=t.fonts.concat(Ov).map(e=>e.fontFamily).concat(i?.length&&!Tv()?i:fme),s=e[0].fontFamily;s.length>15&&(s=s.slice(0,15)+`...`);let c=[];return t.find(e=>(e.type===`text`&&c.push(e.fontFamily),!1)),(0,J.jsx)($6,{fonts:[...new Set(c.concat(`_divider`).concat(o))],activeFont:e[0].fontFamily,activeFontLabel:s,store:t,open:n,onOpenChange:r,onFontSelect:n=>{t.history.transaction(()=>{e.forEach(e=>{e.set({fontFamily:n})})})}})}),r8=W(({elements:e,store:t})=>{let[n,r]=x.useState(!1),[i,a]=x.useState(!1);return(0,J.jsxs)(K1,{open:i?!1:n,onOpenChange:e=>{i||r(e)},children:[(0,J.jsx)(q1,{render:(0,J.jsx)(s3,{"aria-label":Q(`toolbar.fontSize`),onFocus:()=>a(!0),onBlur:()=>a(!1),onValueChange:n=>{t.history.transaction(()=>{e.forEach(e=>{e.set({fontSize:n,width:Math.max(n,e.width)})})})},value:Math.round(e[0].fontSize),style:{width:`50px`},min:5,max:t.height*4})}),(0,J.jsx)(J1,{side:`bottom`,children:Q(`toolbar.fontSize`)})]})}),i8=[`left`,`center`,`right`,`justify`],a8=[`top`,`middle`,`bottom`],o8={top:(0,J.jsx)($,{name:`text.valignTop`,className:`pn:size-4`}),middle:(0,J.jsx)($,{name:`text.valignMiddle`,className:`pn:size-4`}),bottom:(0,J.jsx)($,{name:`text.valignBottom`,className:`pn:size-4`})},s8=W(({elements:e,store:t})=>{let n=e[0],r=n.fontWeight===`bold`||n.fontWeight===`700`,i=n.fontStyle===`italic`,a=n.textDecoration.indexOf(`underline`)>=0,o=n.textDecoration.indexOf(`line-through`)>=0;return(0,J.jsxs)(`div`,{className:`pn:flex pn:items-center pn:gap-0.5`,children:[(0,J.jsxs)(K1,{children:[(0,J.jsx)(q1,{render:(0,J.jsx)(uK,{variant:`ghost`,size:`icon-sm`,onMouseDown:e=>{e.preventDefault()},onClick:()=>{let r=L3(i8,n.align);t.history.transaction(()=>{e.forEach(e=>{e.set({align:r})})})},"aria-label":Q(`toolbar.textAlign`),children:n.align===`left`?(0,J.jsx)($,{name:`text.alignLeft`,className:`pn:size-4`}):n.align===`center`?(0,J.jsx)($,{name:`text.alignCenter`,className:`pn:size-4`}):n.align===`right`?(0,J.jsx)($,{name:`text.alignRight`,className:`pn:size-4`}):(0,J.jsx)($,{name:`text.alignJustify`,className:`pn:size-4`})})}),(0,J.jsx)(J1,{side:`bottom`,children:Q(`toolbar.textAlign`)})]}),n_.textVerticalResizeEnabled&&(0,J.jsxs)(K1,{children:[(0,J.jsx)(q1,{render:(0,J.jsx)(uK,{variant:`ghost`,size:`icon-sm`,onMouseDown:e=>{e.preventDefault()},onClick:()=>{let r=L3(a8,n.verticalAlign);t.history.transaction(()=>{e.forEach(e=>{e.set({verticalAlign:r})})})},"aria-label":Q(`toolbar.verticalAlign`),children:o8[n.verticalAlign]})}),(0,J.jsx)(J1,{side:`bottom`,children:Q(`toolbar.verticalAlign`)})]}),(0,J.jsx)(Y1,{label:Q(`toolbar.bold`),side:`bottom`,active:r,onMouseDown:e=>{e.preventDefault()},onClick:()=>{let r=n.fontWeight===`bold`||n.fontWeight===`700`;t.history.transaction(()=>{e.forEach(e=>{r?e.set({fontWeight:`normal`}):e.set({fontWeight:`bold`})})})},children:(0,J.jsx)($,{name:`text.bold`,className:`pn:size-4`})}),(0,J.jsx)(Y1,{label:Q(`toolbar.italic`),side:`bottom`,active:i,onMouseDown:e=>{e.preventDefault()},onClick:()=>{let r=n.fontStyle===`italic`;t.history.transaction(()=>{e.forEach(e=>{r?e.set({fontStyle:`normal`}):e.set({fontStyle:`italic`})})})},children:(0,J.jsx)($,{name:`text.italic`,className:`pn:size-4`})}),(0,J.jsx)(Y1,{label:Q(`toolbar.underline`),side:`bottom`,active:a,onMouseDown:e=>{e.preventDefault()},onClick:()=>{let r=n.textDecoration.split(` `);r.indexOf(`underline`)>=0?r=r.filter(e=>e!==`underline`):r.push(`underline`),t.history.transaction(()=>{e.forEach(e=>{e.set({textDecoration:r.join(` `)})})})},children:(0,J.jsx)($,{name:`text.underline`,className:`pn:size-4`})}),(0,J.jsx)(Y1,{label:Q(`toolbar.strikethrough`),side:`bottom`,active:o,onMouseDown:e=>{e.preventDefault()},onClick:()=>{let r=n.textDecoration.split(` `);r.indexOf(`line-through`)>=0?r=r.filter(e=>e!==`line-through`):r.push(`line-through`),t.history.transaction(()=>{e.forEach(e=>{e.set({textDecoration:r.join(` `)})})})},children:(0,J.jsx)($,{name:`text.strikethrough`,className:`pn:size-4`})})]})}),c8=W(({elements:e,store:t})=>{let n=e[0].textTransform==`uppercase`;return(0,J.jsx)(`div`,{className:`pn:flex pn:items-center pn:gap-0.5`,children:(0,J.jsx)(Y1,{label:Q(`toolbar.uppercase`),active:n,onMouseDown:e=>{e.preventDefault()},onClick:()=>{t.history.transaction(()=>{e.forEach(e=>{e.set({textTransform:e.textTransform===`uppercase`?`none`:`uppercase`})})})},children:(0,J.jsx)($,{name:`text.uppercase`,className:`pn:size-4`})})})}),l8=W(({elements:e,store:t})=>(0,J.jsx)(l6,{value:e[0].fill,gradientEnabled:!0,onChange:n=>t.history.transaction(()=>{e.forEach(e=>{e.set({fill:n})})}),store:t})),u8=W(({elements:e,store:t})=>{let n=e[0],r=n=>{t.history.transaction(()=>{e.forEach(e=>{e.set(n)})})},i=typeof n.lineHeight==`number`?n.lineHeight*100:120;return(0,J.jsxs)(j0,{children:[(0,J.jsxs)(K1,{children:[(0,J.jsx)(q1,{render:(0,J.jsx)(M0,{render:(0,J.jsx)(uK,{variant:`ghost`,size:`icon-sm`,"aria-label":Q(`toolbar.spacing`),children:(0,J.jsx)($,{name:`text.spacing`,className:`pn:size-5`})})})}),(0,J.jsx)(J1,{side:`bottom`,children:Q(`toolbar.spacing`)})]}),(0,J.jsxs)(N0,{align:`start`,className:`pn:w-[230px] pn:p-[15px]`,children:[(0,J.jsx)(I3,{label:Q(`toolbar.lineHeight`),value:Math.round(i),onChange:e=>r({lineHeight:e/100}),min:50,max:250}),(0,J.jsx)(I3,{label:Q(`toolbar.letterSpacing`),value:Math.round(n.letterSpacing*100),onChange:e=>r({letterSpacing:e/100}),min:-50,max:250})]})]})}),hme={TextFontFamily:n8,TextFontSize:r8,TextFontVariant:s8,TextTransform:c8,TextFill:l8,TextSpacing:u8,TextAiWrite:X0,TextFilters:u6,TextAnimations:Q6},d8=W(({store:e,components:t})=>{let n=e.selectedElements;return(0,J.jsx)(F0,{items:P0({type:`text`,usedItems:[`TextFill`,`TextFontFamily`,`TextFontSize`,`TextFontVariant`,`TextSpacing`,`TextTransform`,`TextFilters`,n_.animationsEnabled&&`TextAnimations`,n_.aiTextEnabled&&`TextAiWrite`],components:t}),itemRender:r=>{let i=t?.[r]||hme[r];return i?(0,J.jsx)(i,{elements:n,element:n[0],store:e},r):null}})}),gme=`—`,f8=JM(`div`)`
@@ -720,7 +720,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
720
720
  Plugins prop is no longer supported.
721
721
  Instead, mount it with "Sortable.mount(new MultiDrag())"
722
722
  Please read the updated README.md at https://github.com/SortableJS/react-sortablejs.
723
- `)}componentDidMount(){if(this.ref.current===null)return;let e=this.makeOptions();o(n).create(this.ref.current,e)}componentDidUpdate(e){e.disabled!==this.props.disabled&&this.sortable&&this.sortable.option(`disabled`,this.props.disabled)}render(){let{tag:e,style:t,className:n,id:r}=this.props,a={style:t,className:n,id:r},o=!e||e===null?`div`:e;return(0,i.createElement)(o,{ref:this.ref,...a},this.getChildren())}getChildren(){let{children:e,dataIdAttr:t,selectedClass:n=`sortable-selected`,chosenClass:a=`sortable-chosen`,dragClass:s=`sortable-drag`,fallbackClass:c=`sortable-falback`,ghostClass:l=`sortable-ghost`,swapClass:u=`sortable-swap-highlight`,filter:d=`sortable-filter`,list:f}=this.props;if(!e||e==null)return null;let p=t||`data-id`;return i.Children.map(e,(e,t)=>{if(e===void 0)return;let s=f[t]||{},{className:c}=e.props,l=typeof d==`string`&&{[d.replace(`.`,``)]:!!s.filtered},u=o(r)(c,{[n]:s.selected,[a]:s.chosen,...l});return(0,i.cloneElement)(e,{[p]:e.key,className:u})})}get sortable(){let e=this.ref.current;if(e===null)return null;let t=Object.keys(e).find(e=>e.includes(`Sortable`));return t?e[t]:null}makeOptions(){let e=[`onAdd`,`onChoose`,`onDeselect`,`onEnd`,`onRemove`,`onSelect`,`onSpill`,`onStart`,`onUnchoose`,`onUpdate`],t=[`onChange`,`onClone`,`onFilter`,`onSort`],n=x(this.props);e.forEach(e=>n[e]=this.prepareOnHandlerPropAndDOM(e)),t.forEach(e=>n[e]=this.prepareOnHandlerProp(e));let r=(e,t)=>{let{onMove:n}=this.props,r=e.willInsertAfter||-1;if(!n)return r;let i=n(e,t,this.sortable,S);return i===void 0?!1:i};return{...n,onMove:r}}prepareOnHandlerPropAndDOM(e){return t=>{this.callOnHandlerProp(t,e),this[e](t)}}prepareOnHandlerProp(e){return t=>{this.callOnHandlerProp(t,e)}}callOnHandlerProp(e,t){let n=this.props[t];n&&n(e,this.sortable,S)}onAdd(e){let{list:t,setList:n,clone:r}=this.props,i=h(e,[...S.dragging.props.list]);d(i),n(v(i,t,e,r).map(e=>Object.assign(e,{selected:!1})),this.sortable,S)}onRemove(e){let{list:t,setList:n}=this.props,r=y(e),i=h(e,t);p(i);let s=[...t];if(e.pullMode!==`clone`)s=_(i,s);else{let t=i;switch(r){case`multidrag`:t=i.map((t,n)=>({...t,element:e.clones[n]}));break;case`normal`:t=i.map(t=>({...t,element:e.clone}));break;default:o(a)(!0,`mode "${r}" cannot clone. Please remove "props.clone" from <ReactSortable/> when using the "${r}" plugin`)}d(t),i.forEach(t=>{let n=t.oldIndex,r=this.props.clone(t.item,e);s.splice(n,1,r)})}s=s.map(e=>Object.assign(e,{selected:!1})),n(s,this.sortable,S)}onUpdate(e){let{list:t,setList:n}=this.props,r=h(e,t);return d(r),p(r),n(g(r,t),this.sortable,S)}onStart(){S.dragging=this}onEnd(){S.dragging=null}onChoose(e){let{list:t,setList:n}=this.props;n(t.map((t,n)=>{let r=t;return n===e.oldIndex&&(r=Object.assign(t,{chosen:!0})),r}),this.sortable,S)}onUnchoose(e){let{list:t,setList:n}=this.props;n(t.map((t,n)=>{let r=t;return n===e.oldIndex&&(r=Object.assign(r,{chosen:!1})),r}),this.sortable,S)}onSpill(e){let{removeOnSpill:t,revertOnSpill:n}=this.props;t&&!n&&l(e.item)}onSelect(e){let{list:t,setList:n}=this.props,r=t.map(e=>Object.assign(e,{selected:!1}));e.newIndicies.forEach(t=>{let n=t.index;if(n===-1){console.log(`"${e.type}" had indice of "${t.index}", which is probably -1 and doesn't usually happen here.`),console.log(e);return}r[n].selected=!0}),n(r,this.sortable,S)}onDeselect(e){let{list:t,setList:n}=this.props,r=t.map(e=>Object.assign(e,{selected:!1}));e.newIndicies.forEach(e=>{let t=e.index;t!==-1&&(r[t].selected=!0)}),n(r,this.sortable,S)}};c(t.exports,{})}))(),n_e=W(({element:e,store:t})=>{let n=t.selectedElements.indexOf(e)>=0,[r,i]=x.useState(!1),a=()=>i(!0),o=()=>i(!1),s=r?e.name:e.name||vv(e.text)||`#${e.id}`;return(0,J.jsx)(`div`,{onMouseDown:n=>{let r=n.ctrlKey||n.metaKey||n.shiftKey?[...t.selectedElementsIds]:[];r.indexOf(e.id)<0&&r.push(e.id),t.selectElements(r)},className:rK(`pn:rounded-md pn:border pn:bg-card pn:p-[5px] pn:mx-[1px] pn:mb-[5px] pn:shadow-sm`,n&&`selected pn:border-primary pn:bg-primary/10`),style:{display:e.selectable||t.role===`admin`?`auto`:`none`},children:(0,J.jsxs)(`div`,{className:`pn:flex pn:items-center pn:justify-between`,children:[(0,J.jsxs)(`div`,{className:`pn:flex pn:items-center`,style:{lineHeight:`30px`},children:[(0,J.jsx)(`div`,{className:`drag-handle`,style:{display:`flex`,justifyContent:`center`,alignItems:`center`,cursor:`move`,height:`30px`},children:(0,J.jsx)($,{name:`action.dragHandle`,className:`pn:size-4`})}),(0,J.jsx)(`div`,{style:{padding:`0 7px`,opacity:.5,width:`60px`},children:Q(`sidePanel.layerTypes.`+e.type)}),(0,J.jsx)(`div`,{style:{maxWidth:`142px`},children:(0,J.jsx)(a3,{value:s,onFocus:a,onBlur:o,placeholder:Q(`sidePanel.namePlaceholder`),onChange:t=>{e.set({name:t.target.value})},onKeyDown:e=>{(e.key===`Enter`||e.key===`Escape`)&&(o(),e.target.blur())},className:`pn:h-7 pn:border-none pn:bg-transparent pn:dark:bg-transparent pn:px-1 pn:shadow-none pn:focus-visible:ring-1`,style:{minWidth:130}})})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(uK,{variant:`ghost`,size:`icon-sm`,onClick:()=>{e.set({visible:!e.visible})},children:e?.visible?(0,J.jsx)($,{name:`action.visible`}):(0,J.jsx)($,{name:`action.hidden`})}),(0,J.jsx)(uK,{variant:`ghost`,size:`icon-sm`,onClick:()=>{e.set({draggable:e.locked,contentEditable:e.locked,styleEditable:e.locked,resizable:e.locked,removable:e.locked})},children:e?.locked?(0,J.jsx)($,{name:`action.lock`}):(0,J.jsx)($,{name:`action.unlock`})}),(0,J.jsx)(uK,{variant:`ghost`,size:`icon-sm`,disabled:!e.removable,onClick:()=>{t.deleteElements([e.id])},style:{marginLeft:`auto`},children:(0,J.jsx)($,{name:`action.remove`})})]})]})})}),r_e=W(({store:e})=>{let t=t=>{let n=t.filter(e=>e!=null&&e.id!=null);n.forEach((t,r)=>{let i=n.length-r-1,a=String(t.id),o=e.getElementById(a),s=e.activePage?.children.indexOf(o);o&&s!==i&&e.activePage?.setElementZIndex(o.id,i)})},n=e.activePage?.children.map(e=>({id:e.id}))||[];n.reverse();let r=wS();return(0,J.jsxs)(`div`,{style:{height:`100%`,overflow:`auto`},children:[(0,J.jsx)(`div`,{style:{height:`40px`,paddingTop:`5px`},children:Q(`sidePanel.layersTip`)}),(0,J.jsxs)(`div`,{children:[n.length===0?(0,J.jsx)(`div`,{children:Q(`sidePanel.noLayers`)}):null,(0,J.jsx)(t_e.ReactSortable,{list:n,setList:t,direction:`horizontal`,handle:r?`.drag-handle`:void 0,children:n.map(({id:t})=>(0,J.jsx)(n_e,{element:e.getElementById(t),store:e},t))})]})]})}),i_e=[{name:`Instagram`,icon:(0,J.jsx)($,{name:`size.instagram`}),sizes:[[`Post`,1080,1080,`px`,(0,J.jsx)($,{name:`size.instagram`})],[`Story`,1080,1920,`px`,(0,J.jsx)($,{name:`size.instagram`})],[`Ad`,1080,1080,`px`,(0,J.jsx)($,{name:`size.instagram`})]]},{name:`Facebook`,icon:(0,J.jsx)($,{name:`size.facebook`}),sizes:[[`Post (Landscape)`,1200,630,`px`,(0,J.jsx)($,{name:`size.facebook`})],[`Post (Square)`,1080,1080,`px`,(0,J.jsx)($,{name:`size.facebook`})],[`Cover`,851,315,`px`,(0,J.jsx)($,{name:`size.facebook`})]]},{name:`Youtube`,icon:(0,J.jsx)($,{name:`size.youtube`}),sizes:[[`Thumbnail`,1280,720,`px`,(0,J.jsx)($,{name:`size.youtube`})],[`Channel`,2560,1440,`px`,(0,J.jsx)($,{name:`size.youtube`})],[`Short`,1080,1920,`px`,(0,J.jsx)($,{name:`size.youtube`})]]},{name:`LinkedIn`,icon:(0,J.jsx)($,{name:`size.linkedin`}),sizes:[[`Post`,1200,627,`px`,(0,J.jsx)($,{name:`size.linkedin`})],[`Banner`,1584,396,`px`,(0,J.jsx)($,{name:`size.linkedin`})],[`Square`,1080,1080,`px`,(0,J.jsx)($,{name:`size.linkedin`})]]},{name:`Twitter`,icon:(0,J.jsx)($,{name:`size.twitter`}),sizes:[[`Post`,1600,900,`px`,(0,J.jsx)($,{name:`size.twitter`})],[`Header`,1500,500,`px`,(0,J.jsx)($,{name:`size.twitter`})],[`Square`,1080,1080,`px`,(0,J.jsx)($,{name:`size.twitter`})]]},{name:`Video`,icon:(0,J.jsx)($,{name:`size.video`}),sizes:[[`Full HD`,1920,1080,`px`,(0,J.jsx)($,{name:`size.video`})],[`4K UHD`,3840,2160,`px`,(0,J.jsx)($,{name:`size.video`})],[`Vertical HD`,1080,1920,`px`,(0,J.jsx)($,{name:`size.video`})],[`Square HD`,1080,1080,`px`,(0,J.jsx)($,{name:`size.video`})]]},{name:`Print`,icon:(0,J.jsx)($,{name:`size.print`}),sizes:[[`Invitation`,14,14,`cm`,(0,J.jsx)($,{name:`size.print`})],[`A4 Portrait`,21,29.7,`cm`,(0,J.jsx)($,{name:`size.print`})],[`A4 Landscape`,29.7,21,`cm`,(0,J.jsx)($,{name:`size.print`})],[`A3`,29.7,42,`cm`,(0,J.jsx)($,{name:`size.print`})],[`Letter Portrait`,8.5,11,`in`,(0,J.jsx)($,{name:`size.print`})],[`Letter Landscape`,11,8.5,`in`,(0,J.jsx)($,{name:`size.print`})],[`Business card`,3.5,2,`in`,(0,J.jsx)($,{name:`size.businessCard`})],[`Poster`,18,24,`in`,(0,J.jsx)($,{name:`size.print`})]]}],a_e=10,k9=({value:e,onChange:t,...n})=>{let[r,i]=x.useState(e.toString()),a=x.useRef(e);a.current=r;let o=()=>{t(Math.max(n.min||0,parseFloat(a.current)))};x.useEffect(()=>{i(String(e))},[e]);let s=Number(n.step)||1,c=r=>{let o=parseFloat(a.current),c=(Number.isNaN(o)?Number(e)||0:o)+r*s;typeof n.min==`number`&&(c=Math.max(n.min,c)),typeof n.max==`number`&&(c=Math.min(n.max,c)),c=parseFloat(c.toFixed(4)),i(String(c)),t(c)},{className:l,...u}=n;return(0,J.jsxs)(`div`,{className:`pn:relative`,children:[(0,J.jsx)(a3,{...u,type:`number`,value:r.toString(),className:rK(`pn:pr-6 pn:[appearance:textfield] pn:[&::-webkit-inner-spin-button]:appearance-none pn:[&::-webkit-outer-spin-button]:appearance-none`,l),onChange:e=>{let t=e.target.value;Number.isNaN(parseFloat(t))?t===``&&i(t):i(t)},onBlur:o,onFocus:e=>e.target.select(),onKeyDown:e=>{e.key===`Enter`&&o()}}),(0,J.jsxs)(`div`,{className:`pn:absolute pn:inset-y-0 pn:right-0 pn:flex pn:w-5 pn:flex-col pn:border-l pn:border-input`,children:[(0,J.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-label":`Increment`,className:`pn:flex pn:flex-1 pn:appearance-none pn:cursor-pointer pn:items-center pn:justify-center pn:border-0 pn:bg-transparent pn:text-muted-foreground pn:hover:bg-muted pn:hover:text-foreground`,onClick:()=>c(1),children:(0,J.jsx)($,{name:`ui.chevronUp`,className:`pn:size-3`})}),(0,J.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-label":`Decrement`,className:`pn:flex pn:flex-1 pn:appearance-none pn:cursor-pointer pn:items-center pn:justify-center pn:border-0 pn:border-t pn:border-input pn:bg-transparent pn:text-muted-foreground pn:hover:bg-muted pn:hover:text-foreground`,onClick:()=>c(-1),children:(0,J.jsx)($,{name:`ui.chevronDown`,className:`pn:size-3`})})]})]})},o_e=({width:e,height:t})=>{let n=e/t;return(0,J.jsx)(`span`,{className:`pn:flex pn:size-5 pn:shrink-0 pn:items-center pn:justify-center pn:text-muted-foreground`,children:(0,J.jsx)(`span`,{className:`pn:rounded-[2px] pn:border pn:border-current`,style:{width:n>=1?18:Math.max(4,18*n),height:n>=1?Math.max(4,18/n):18}})})},s_e=W(({store:e})=>{let[t,n]=x.useState(!0),[r,i]=x.useState(e.width),[a,o]=x.useState(e.height),s=wy({px:a_e,unit:e.unit,dpi:e.dpi}),c=e.activePage?.computedWidth||e.width;x.useEffect(()=>{i(Ty({px:c,unit:e.unit,dpi:e.dpi}))},[c,e.unit,e.dpi]);let l=e.activePage?.computedHeight||e.height;x.useEffect(()=>{o(Ty({px:l,unit:e.unit,dpi:e.dpi}))},[l,e.unit,e.dpi]);let u=(t,n,r)=>{e.setSize(t,n,r),e.activePage?.width!==`auto`&&e.activePage?.set({width:t}),e.activePage?.height!==`auto`&&e.activePage?.set({height:n})};return(0,J.jsxs)(`div`,{style:{height:`100%`,overflow:`auto`,paddingRight:`3px`},children:[(0,J.jsxs)(`div`,{style:{paddingBottom:`15px`},children:[(0,J.jsxs)(`label`,{className:`pn:flex pn:items-center pn:justify-between`,style:{marginTop:`8px`,marginBottom:`25px`},children:[(0,J.jsxs)(`span`,{className:`pn:flex pn:items-center pn:gap-1.5`,children:[Q(`sidePanel.useMagicResize`),` `,(0,J.jsxs)(K1,{children:[(0,J.jsx)(q1,{render:(0,J.jsx)(`span`,{className:`pn:inline-flex`,children:(0,J.jsx)($,{name:`action.help`,className:`pn:size-4`})})}),(0,J.jsx)(J1,{side:`bottom`,children:Q(`sidePanel.magicResizeDescription`)})]})]}),(0,J.jsx)(F3,{checked:t,onCheckedChange:e=>{n(!!e)}})]}),(0,J.jsxs)(`div`,{className:`pn:inline-block pn:w-1/2`,children:[Q(`sidePanel.width`),` (`,e.unit,`)`]}),(0,J.jsx)(`div`,{className:`pn:inline-block pn:w-1/2`,children:(0,J.jsx)(k9,{value:r,onChange:e=>{e||=s,i(e)},min:s,max:1e4,step:e.unit===`px`?1:.1})})]}),(0,J.jsxs)(`div`,{style:{paddingBottom:`15px`},children:[(0,J.jsxs)(`div`,{className:`pn:inline-block pn:w-1/2`,children:[Q(`sidePanel.height`),` (`,e.unit,`)`]}),(0,J.jsx)(`div`,{className:`pn:inline-block pn:w-1/2`,children:(0,J.jsx)(k9,{value:a,onChange:e=>{e||=s,o(e)},min:s,max:1e4,step:e.unit===`px`?1:.1})})]}),(0,J.jsxs)(`div`,{style:{paddingBottom:`15px`},children:[(0,J.jsx)(`div`,{className:`pn:inline-block pn:w-1/2`,children:Q(`sidePanel.units`)}),(0,J.jsx)(`div`,{className:`pn:inline-block pn:w-1/2`,children:(0,J.jsxs)(U6,{value:e.unit,onValueChange:t=>{let n=t;e.setUnit({unit:n,dpi:e.dpi})},children:[(0,J.jsx)(G6,{className:`pn:w-full`,children:(0,J.jsx)(W6,{})}),(0,J.jsxs)(K6,{children:[(0,J.jsx)(q6,{value:`px`,children:`px`}),(0,J.jsx)(q6,{value:`cm`,children:`cm`}),(0,J.jsx)(q6,{value:`in`,children:`in`})]})]})})]}),(0,J.jsx)(`div`,{style:{paddingBottom:`15px`},children:(0,J.jsx)(uK,{className:`pn:w-full`,variant:`default`,onClick:()=>{u(Ey({unitVal:r,dpi:e.dpi,unit:e.unit}),Ey({unitVal:a,dpi:e.dpi,unit:e.unit}),t)},children:Q(`sidePanel.resize`)})}),i_e.map(({name:n,icon:r,sizes:i})=>(0,J.jsxs)(x.Fragment,{children:[(0,J.jsxs)(`div`,{className:`pn:flex pn:items-center pn:gap-1.5 pn:pt-3 pn:pb-1 pn:text-[13px] pn:font-semibold`,children:[r,n]}),(0,J.jsx)(`div`,{className:`pn:mb-1.5 pn:flex pn:flex-col`,children:i.map(([n,r,i,a])=>(0,J.jsxs)(uK,{variant:`ghost`,className:`pn:h-9 pn:w-full pn:justify-start pn:gap-2.5 pn:px-2 pn:text-[13px] pn:font-normal`,onClick:()=>{let n=Ey({unitVal:r,dpi:e.dpi,unit:a}),o=Ey({unitVal:i,dpi:e.dpi,unit:a});e.setUnit({unit:a,dpi:e.dpi}),u(n,o,t)},children:[(0,J.jsx)(o_e,{width:r,height:i}),(0,J.jsx)(`span`,{className:`pn:truncate`,children:n}),(0,J.jsxs)(`span`,{className:`pn:ml-auto pn:shrink-0 pn:text-xs pn:text-muted-foreground`,children:[r,`×`,i,` `,a]})]},n))})]},n))]})}),A9=x.createContext(void 0);function c_e(e=!0){let t=x.useContext(A9);if(t===void 0&&!e)throw Error(CK(7));return t}var l_e=function(e){return e.disabled=`data-disabled`,e.orientation=`data-orientation`,e.multiple=`data-multiple`,e}({}),j9={multiple(e){return e?{[l_e.multiple]:``}:null}},u_e=x.forwardRef(function(e,t){let{defaultValue:n,disabled:r=!1,loopFocus:i=!0,onValueChange:a,orientation:o=`horizontal`,multiple:s=!1,value:c,className:l,render:u,style:d,...f}=e,p=A0(!0),m=x.useMemo(()=>c!==void 0||n!==void 0,[c,n]),h=(p?.disabled??!1)||r,[g,_]=S2({controlled:c,default:c===void 0?n??Wq:void 0,name:`ToggleGroup`,state:`value`}),v=jJ((e,t,n)=>{let r;s?(r=g.slice(),t?r.push(e):r.splice(g.indexOf(e),1)):r=t?[e]:[],a?.(r,n),!n.isCanceled&&_(r)}),y={disabled:h,multiple:s,orientation:o},b=x.useMemo(()=>({disabled:h,orientation:o,setGroupValue:v,value:g,isValueInitialized:m}),[h,o,v,g,m]),S={role:`group`},C=UX(`div`,e,{enabled:!!p,state:y,ref:t,props:[S,f],stateAttributesMapping:j9});return(0,J.jsx)(A9.Provider,{value:b,children:p?C:(0,J.jsx)($3,{render:u,className:l,style:d,state:y,refs:[t],props:[S,f],stateAttributesMapping:j9,loopFocus:i,enableHomeAndEndKeys:!0,orientation:o})})}),M9=x.forwardRef(function(e,t){let{className:n,defaultPressed:r=!1,disabled:i=!1,form:a,onPressedChange:o,pressed:s,render:c,type:l,value:u,nativeButton:d=!0,style:f,...p}=e,m=h1(u||void 0),h=c_e(),g=h?.value??[],_=h?void 0:r,v=(i||h?.disabled)??!1,[y,b]=S2({controlled:h?m!==void 0&&g.indexOf(m)>-1:s,default:_,name:`Toggle`,state:`pressed`}),{getButtonProps:x,buttonRef:S}=t0({disabled:v,native:d}),C={disabled:v,pressed:y},w=[S,t],T=[{"aria-pressed":y,onClick(e){let t=!y,n=pJ(Kq,e.nativeEvent);m&&h?.setGroupValue?.(m,t,n),o?.(t,n),!n.isCanceled&&b(t)}},p,x],E=UX(`button`,e,{enabled:!h,state:C,ref:w,props:T});return h?(0,J.jsx)(U2,{tag:`button`,render:c,className:n,style:f,state:C,refs:w,props:T}):E}),N9=cK(`pn:inline-flex pn:items-center pn:justify-center pn:gap-2 pn:rounded-md pn:text-sm pn:font-medium pn:whitespace-nowrap pn:transition-[color,box-shadow] pn:outline-none pn:hover:bg-muted pn:hover:text-muted-foreground pn:focus-visible:border-ring pn:focus-visible:ring-[3px] pn:focus-visible:ring-ring/50 pn:disabled:pointer-events-none pn:disabled:opacity-50 pn:aria-invalid:border-destructive pn:aria-invalid:ring-destructive/20 pn:data-pressed:bg-accent pn:data-pressed:text-accent-foreground pn:dark:aria-invalid:ring-destructive/40 pn:[&_svg]:pointer-events-none pn:[&_svg]:shrink-0 pn:[&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`pn:bg-transparent`,outline:`pn:border pn:border-input pn:bg-transparent pn:shadow-xs pn:hover:bg-accent pn:hover:text-accent-foreground`},size:{default:`pn:h-9 pn:min-w-9 pn:px-2`}},defaultVariants:{variant:`default`,size:`default`}}),d_e=x.forwardRef(({className:e,variant:t,size:n,...r},i)=>(0,J.jsx)(M9,{ref:i,"data-slot":`toggle`,className:rK(N9({variant:t,size:n,className:e})),...r}));d_e.displayName=`Toggle`;var P9=x.createContext({size:`default`,variant:`default`}),F9=x.forwardRef(({className:e,variant:t,size:n,children:r,...i},a)=>(0,J.jsx)(u_e,{ref:a,"data-slot":`toggle-group`,"data-variant":t,"data-size":n,className:rK(`pn:group/toggle-group pn:flex pn:w-fit pn:items-center pn:rounded-md`,e),...i,children:(0,J.jsx)(P9.Provider,{value:{variant:t,size:n},children:r})}));F9.displayName=`ToggleGroup`;var I9=x.forwardRef(({className:e,children:t,variant:n,size:r,...i},a)=>{let o=x.useContext(P9);return(0,J.jsx)(M9,{ref:a,"data-slot":`toggle-group-item`,"data-variant":o.variant||n,"data-size":o.size||r,className:rK(N9({variant:o.variant||n,size:o.size||r}),`pn:w-auto pn:min-w-0 pn:shrink-0 pn:px-3 pn:focus:z-10 pn:focus-visible:z-10`,`pn:rounded-none pn:shadow-none pn:first:rounded-l-md pn:last:rounded-r-md pn:data-[variant=outline]:border-l-0 pn:data-[variant=outline]:first:border-l`,e),...i,children:t})});I9.displayName=`ToggleGroupItem`;var L9=(e,t,n)=>Math.max(t,Math.min(n,e)),R9=(e,t)=>Array.from(e.keys()).find(e=>lb(e,t)),f_e=(e,t)=>{let n=R9(e,t);return e.get(n||``)||t},p_e=W(({store:e})=>{let{brushType:t,strokeWidth:n,stroke:r,opacity:i}=e.toolOptions,a=e.tool===`selection`,o=e.selectedElements,s=o.length===1&&o[0].type===`svg`,c=s?o[0]:null,l=db(c?.src||``),u=l.length>0?l[0]:null,d=t=>{t===`selection`?e.setTool(`selection`):(e.selectElements([]),e.setTool(`draw`),e.setToolOptions({brushType:t,opacity:t===`highlighter`?.5:1,strokeWidth:t===`highlighter`?30:n||5}))},f=t=>{e.setToolOptions({strokeWidth:t})},p=t=>{e.setToolOptions({stroke:t})},m=t=>{e.setToolOptions({opacity:t})},h=e=>{if(c&&u){let t=R9(c.colorsReplace,u)||u;c.replaceColor(t,e)}},g=e=>{c&&c.set({opacity:e})};return x.useEffect(()=>()=>{e.setTool(`selection`)},[]),(0,J.jsxs)(`div`,{className:`pn:flex pn:h-full pn:flex-col pn:overflow-auto pn:pr-1`,children:[(0,J.jsxs)(`div`,{style:{marginBottom:`30px`},children:[(0,J.jsx)(`h3`,{className:`pn:mb-[15px] pn:text-sm pn:font-semibold pn:uppercase pn:text-muted-foreground`,children:`Tool`}),(0,J.jsx)(`div`,{style:{padding:`0 5px`},children:(0,J.jsxs)(F9,{variant:`outline`,value:[a?`selection`:t],onValueChange:e=>{let t=e[0];t&&d(t)},className:`pn:w-full`,children:[(0,J.jsxs)(I9,{value:`selection`,className:`pn:flex-1`,children:[(0,J.jsx)($,{name:`draw.select`}),`Selection`]}),(0,J.jsxs)(I9,{value:`brush`,className:`pn:flex-1`,children:[(0,J.jsx)($,{name:`draw.brush`}),`Brush`]}),(0,J.jsxs)(I9,{value:`highlighter`,className:`pn:flex-1`,children:[(0,J.jsx)($,{name:`draw.highlighter`}),`Highlighter`]})]})})]}),!s&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{style:{marginBottom:`30px`,opacity:a?.5:1},children:(0,J.jsx)(I3,{label:`Stroke Width`,value:n,onChange:e=>f(L9(e,1,50)),min:1,max:50,disabled:a})}),(0,J.jsx)(`div`,{style:{marginBottom:`30px`,opacity:a?.5:1,pointerEvents:a?`none`:`auto`},children:(0,J.jsx)(N8,{label:`Color`,className:`pn:py-[5px]`,children:(0,J.jsx)(l6,{value:r,size:30,onChange:p,store:e})})}),(0,J.jsx)(`div`,{style:{marginBottom:`30px`,opacity:a?.5:1},children:(0,J.jsx)(I3,{label:`Opacity`,value:Math.round(i*100),onChange:e=>m(L9(e,0,100)/100),min:0,max:100,disabled:a})})]}),s&&u&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{style:{marginBottom:`30px`},children:(0,J.jsx)(N8,{label:`Color`,className:`pn:py-[5px]`,children:(0,J.jsx)(l6,{value:f_e(c.colorsReplace,u),size:30,onChange:h,store:e,gradientEnabled:!0})})}),(0,J.jsx)(`div`,{style:{marginBottom:`30px`},children:(0,J.jsx)(I3,{label:`Opacity`,value:Math.round(c.opacity*100),onChange:e=>g(L9(e,0,100)/100),min:0,max:100})})]})]})}),m_e=({items:e,onSelect:t,loadMore:n,isLoading:r,error:i,getCredit:a})=>{let o=(0,x.useRef)(null),s=(0,x.useCallback)(e=>{r||(o.current&&o.current.disconnect(),o.current=new IntersectionObserver(e=>{e[0].isIntersecting&&n()}),e&&o.current.observe(e))},[r]);return i?(0,J.jsx)(`div`,{children:i.message}):!e||e.length===0?null:(0,J.jsx)(`div`,{className:`pn:h-full pn:overflow-auto`,children:[e.filter((e,t)=>t%2==1),e.filter((e,t)=>t%2==0)].map((e,n)=>(0,J.jsxs)(`div`,{className:`pn:float-left pn:w-1/2`,children:[e.map(e=>(0,J.jsx)(h_e,{item:e,onClick:()=>t(e),onDragStart:()=>{hV(((n,r)=>{t(e,n,r)}))},onDragEnd:()=>hV(null),getCredit:a},e.id)),(0,J.jsx)(`div`,{ref:s,className:`pn:p-12`,children:r&&(0,J.jsx)(I0,{className:`pn:size-5 pn:mx-auto pn:text-muted-foreground`})})]},n))})},h_e=({item:e,onClick:t,onDragEnd:n,onDragStart:r,getCredit:i})=>{let a=(0,x.useRef)(null),o=()=>{a.current?.play()?.catch(()=>{})},s=()=>{a.current?.pause(),a.current&&(a.current.currentTime=0)},c=e.video_files.find(e=>e.quality===`sd`)?.link||``;if(!c)return null;let l=new Date(e.duration*1e3).toISOString(),u;return u=e.duration>3600?l.substring(11,19):l.substring(14,19),(0,J.jsx)(`div`,{className:`pn:group/video pn:w-full pn:p-[5px] pn:hover:[&_.video-grid__item-credit]:opacity-100`,children:(0,J.jsxs)(`div`,{className:`pn:relative`,draggable:!0,onClick:t,onDragEnd:n,onDragStart:r,onMouseEnter:o,onMouseLeave:s,children:[(0,J.jsx)(`video`,{poster:e.video_pictures[0].picture,controls:!1,ref:a,muted:!0,preload:`none`,playsInline:!0,className:`pn:block pn:max-h-[300px] pn:min-h-[50px] pn:w-full pn:cursor-pointer pn:rounded-[5px] pn:object-cover pn:shadow-[0_0_5px_rgba(16,22,26,0.3)]`,children:(0,J.jsx)(`source`,{src:c})}),(0,J.jsx)(`div`,{className:`pn:absolute pn:right-2 pn:top-2 pn:flex pn:items-center pn:justify-center pn:rounded-full pn:bg-black/50 pn:px-[7px] pn:py-[2px] pn:text-center pn:text-white`,children:(0,J.jsx)(`span`,{className:`pn:text-xs`,children:u})}),i&&(0,J.jsx)(`div`,{className:`video-grid__item-credit pn:absolute pn:inset-x-0 pn:bottom-0 pn:bg-gradient-to-b pn:from-transparent pn:via-black/40 pn:to-black/60 pn:p-[3px] pn:text-center pn:text-[10px] pn:text-white pn:opacity-0 pn:[&_a]:text-white pn:[&_a]:underline`,children:i(e)})]})})},g_e=`https://api.polotno.com/api/pexels/videos`,__e=({query:e,page:t})=>`${g_e}/${e?`search`:`popular`}?query=${e}&per_page=20&page=${t}&KEY=${h_()}`,v_e=W(({store:e})=>{let{setQuery:t,loadMore:n,isReachingEnd:r,data:i,isLoading:a,error:o}=J8({defaultQuery:``,getAPI:({page:e,query:t})=>__e({page:e,query:t}),getSize:e=>e.total_results/e.per_page});return(0,J.jsxs)(`div`,{className:`pn:flex pn:h-full pn:flex-col`,children:[(0,J.jsx)(Y8,{style:{marginBottom:`20px`},placeholder:Q(`sidePanel.searchPlaceholder`),onChange:e=>{t(e.target.value)}}),(0,J.jsxs)(`p`,{className:`pn:text-center pn:text-sm pn:text-muted-foreground`,children:[`Videos by`,` `,(0,J.jsx)(`a`,{href:`https://www.pexels.com/`,target:`_blank`,className:`pn:font-medium pn:text-foreground pn:underline pn:underline-offset-2`,children:`Pexels`})]}),(0,J.jsx)(m_e,{items:i?.map(e=>e.videos).flat().filter(Boolean)??[],onSelect:async(t,n,r)=>{a5({src:t.video_files.find(e=>e.quality===`hd`)?.link||t.video_files[0].link,store:e,droppedPos:n,targetElement:r,attrs:{width:t.width,height:t.height}})},isLoading:a,error:o,loadMore:!r&&n,getCredit:e=>(0,J.jsxs)(`span`,{children:[`Video by`,` `,(0,J.jsx)(`a`,{href:e.user.url,target:`_blank`,rel:`noreferrer`,children:e.user.name}),` `,`on`,` `,(0,J.jsx)(`a`,{href:`https://pexels.com/?utm_source=polotno&utm_medium=referral`,target:`_blank`,rel:`noreferrer noopener`,children:`Pexels`})]})})]})});function z9({title:e,onClose:t}){return(0,J.jsxs)(`div`,{className:`pn:flex pn:justify-between`,children:[(0,J.jsx)(`h3`,{className:`pn:m-0 pn:leading-[30px]`,children:e}),(0,J.jsx)(uK,{variant:`ghost`,size:`icon-sm`,onClick:t,children:(0,J.jsx)(mW,{})})]})}var y_e={width:300,height:300,fill:`lightgray`,stroke:`#0c0c0c`,strokeWidth:0,url:``},b_e=Object.keys(_b),x_e=[y_e],B9=[];b_e.forEach(e=>{x_e.forEach(t=>{B9.push({subType:e,...t})})}),B9.forEach(e=>{e.url=sb(yb(e))});var S_e=W(({store:e})=>{let t=Math.ceil(B9.length/4)||1,n=e.selectedElements.map(e=>e.id).join(`,`),r=e.openedSidePanel===`image-clip`;return x.useEffect(()=>{r&&(n||e.restoreSidePanel())},[r,n]),(0,J.jsxs)(`div`,{style:{height:`100%`,display:`flex`,flexDirection:`column`,overflow:`auto`},children:[(0,J.jsx)(z9,{title:Q(`sidePanel.clipImage`),onClose:()=>e.restoreSidePanel()}),(0,J.jsx)(`div`,{style:{height:t*110+`px`},children:(0,J.jsx)(B8,{shadowEnabled:!1,rowsNumber:4,images:B9,getPreview:e=>e.url,isLoading:!1,itemHeight:100,onSelect:async(t,n,r)=>{(r?[r]:e.selectedElements).forEach(e=>{(e.type===`image`||e.type===`video`)&&e.contentEditable&&e.set({clipSrc:t.url})})}})})]})}),C_e=W(({element:e,store:t,enabled:n})=>{let r=e.animations.find(e=>e.type===`enter`),i=e.animations.find(e=>e.type===`exit`);return n?(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`div`,{style:{padding:`10px 0px`},children:`Animate`}),(0,J.jsxs)(`div`,{style:{display:`flex`,gap:10},children:[(0,J.jsx)(uK,{variant:`outline`,className:rK(`pn:flex-1`,r?.enabled&&!i?.enabled&&`pn:bg-muted`),onClick:()=>{t.history.transaction(()=>{e.setAnimation(`enter`,{enabled:!0}),e.setAnimation(`exit`,{enabled:!1})})},children:`Enter`}),(0,J.jsx)(uK,{variant:`outline`,className:rK(`pn:flex-1`,r?.enabled&&i?.enabled&&`pn:bg-muted`),onClick:()=>{t.history.transaction(()=>{e.setAnimation(`enter`,{enabled:!0}),e.setAnimation(`exit`,{enabled:!0})})},children:`Both`}),(0,J.jsx)(uK,{variant:`outline`,className:rK(`pn:flex-1`,i?.enabled&&!r?.enabled&&`pn:bg-muted`),onClick:()=>{t.history.transaction(()=>{e.setAnimation(`enter`,{enabled:!1}),e.setAnimation(`exit`,{enabled:!0})})},children:`Exit`})]})]}):null}),w_e=[`right`,`left`,`up`,`down`,`bottom-right`,`bottom-left`,`top-right`,`top-left`],V9={right:(0,J.jsx)($,{name:`animation.directionRight`}),left:(0,J.jsx)($,{name:`animation.directionLeft`}),up:(0,J.jsx)($,{name:`animation.directionUp`}),down:(0,J.jsx)($,{name:`animation.directionDown`}),"bottom-right":(0,J.jsx)($,{name:`animation.directionBottomRight`}),"bottom-left":(0,J.jsx)($,{name:`animation.directionBottomLeft`}),"top-right":(0,J.jsx)($,{name:`animation.directionTopRight`}),"top-left":(0,J.jsx)($,{name:`animation.directionTopLeft`})},T_e=W(({value:e,onChange:t})=>(0,J.jsxs)(`div`,{style:{paddingTop:`10px`},children:[(0,J.jsx)(`div`,{style:{paddingBottom:`10px`},children:`Direction`}),(0,J.jsxs)(U6,{value:e,onValueChange:e=>{e!==null&&t(e)},children:[(0,J.jsx)(G6,{className:`pn:w-full`,children:(0,J.jsxs)(`div`,{className:`pn:flex pn:items-center pn:gap-2`,children:[V9[e],(0,J.jsx)(W6,{})]})}),(0,J.jsx)(K6,{children:w_e.map(e=>(0,J.jsx)(q6,{value:e,children:(0,J.jsxs)(`div`,{className:`pn:flex pn:items-center pn:gap-2`,children:[V9[e],e]})},e))})]})]})),E_e=W(({value:e,onChange:t})=>(0,J.jsxs)(`div`,{style:{paddingTop:`10px`},children:[(0,J.jsx)(`div`,{style:{paddingBottom:`10px`},children:`Direction`}),(0,J.jsxs)(U6,{value:e,onValueChange:e=>{e!==null&&t(e)},children:[(0,J.jsx)(G6,{className:`pn:w-full`,children:(0,J.jsx)(W6,{children:e===`out`?`Zoom Out`:`Zoom In`})}),(0,J.jsxs)(K6,{children:[(0,J.jsx)(q6,{value:`in`,children:`Zoom In`}),(0,J.jsx)(q6,{value:`out`,children:`Zoom Out`})]})]})]})),D_e=W(({element:e})=>{let t=e.animations.find(e=>e.type===`enter`);if(!t)return null;let n=e.page.duration;return(0,J.jsx)(`div`,{style:{padding:`10px`},children:(0,J.jsx)(I3,{label:`Delay`,value:parseFloat((t.delay/1e3).toFixed(2)),onChange:t=>{e.setAnimation(`enter`,{delay:t*1e3})},min:0,max:n/1e3,step:.01})})}),O_e=W(({element:e,store:t})=>{let n=e.animations.find(e=>e.type===`loop`&&e.enabled);return n?(0,J.jsx)(`div`,{style:{padding:`10px`},children:(0,J.jsx)(I3,{label:`Speed`,value:500/n.duration,onChange:t=>{e.setAnimation(`loop`,{duration:500/t})},min:.1,max:3,step:.01,onCommit:()=>{let n=t.activePage;t.play({animatedElementsIds:[e.id],currentTime:e.page.startTime}),setTimeout(()=>{t.stop(),n&&t.selectPage(n.id)},1e3)}})}):null}),k_e=W(({element:e})=>{let t=e.animations.find(e=>e.type===`enter`);if(!t)return null;let n=e.page.duration;return(0,J.jsx)(`div`,{style:{padding:`10px`},children:(0,J.jsx)(I3,{label:`Duration`,value:parseFloat((t.duration/1e3).toFixed(2)),onChange:t=>{e.setAnimation(`enter`,{duration:t*1e3}),e.setAnimation(`exit`,{duration:t*1e3})},min:0,max:n/1e3,step:.01})})}),A_e=(e,t)=>{let n;return(...r)=>{n&&clearTimeout(n),n=setTimeout(()=>{e(...r)},t)}},H9=W(({element:e,store:t,animationName:n})=>{let r=e.animations.find(e=>e.name===n&&e.enabled);if(!r)return null;let i=r.data?.strength??1,a=r=>{t.history.transaction(()=>{e.animations.forEach(t=>{if(t.name===n){let n=t.data||{};e.setAnimation(t.type,{data:{...n,strength:r}})}})});let i=t.activePage;A_e(()=>{t.isPlaying||(t.play({animatedElementsIds:[e.id],currentTime:e.page.startTime}),setTimeout(()=>{t.stop(),i&&t.selectPage(i.id)},1e3))},300)()},o=Math.max(3,i);return(0,J.jsx)(`div`,{style:{padding:`10px`},children:(0,J.jsx)(I3,{label:Q(`toolbar.strength`),value:parseFloat(i.toFixed(2)),onChange:e=>a(e),min:.1,sliderMax:o,step:.05})})}),j_e=W(({element:e})=>{let t=e.animations.find(e=>e.type===`exit`);if(!t)return null;let n=e.page.duration;return(0,J.jsx)(`div`,{style:{padding:`10px`},children:(0,J.jsx)(I3,{label:`End Delay`,value:parseFloat((t.delay/1e3).toFixed(2)),onChange:t=>{e.setAnimation(`exit`,{delay:t*1e3})},min:0,max:n/1e3,step:.01})})}),M_e=[{key:`move`,icon:`animation.typeMove`,label:`toolbar.move`},{key:`fade`,icon:`animation.typeFade`,label:`toolbar.fade`},{key:`zoom`,icon:`animation.typeZoom`,label:`toolbar.zoom`}],N_e=[{key:`rotate`,icon:`animation.typeRotate`,label:`toolbar.rotate`},{key:`blink`,icon:`animation.typeBlink`,label:`toolbar.blink`},{key:`bounce`,icon:`animation.typeBounce`,label:`toolbar.bounce`}],P_e=W(({store:e})=>{let t=e.selectedElements,n=t[0],r=n,i=t.map(e=>e.id).join(`,`),a=e.openedSidePanel===`animation`;if(x.useEffect(()=>{a&&(!n||!n.animations)&&e.restoreSidePanel()},[a,i]),!n||!n.animations)return null;let o=(r,i)=>{if(e.history.transaction(()=>{t.forEach(e=>{e.setAnimation(`enter`,{name:r,...i}),e.setAnimation(`exit`,{name:r,...i,from:i.to,to:i.from})})}),i.enabled){let r=e.activePage;e.play({animatedElementsIds:t.map(e=>e.id),currentTime:n.page.startTime}),setTimeout(()=>{e.stop(),r&&e.selectPage(r.id)},1e3)}},s=(r,i)=>{if(e.history.transaction(()=>{t.forEach(e=>{e.setAnimation(`loop`,{name:r,...i})})}),i.enabled){let r=e.activePage;e.play({animatedElementsIds:t.map(e=>e.id),currentTime:n.page.startTime}),setTimeout(()=>{e.stop(),r&&e.selectPage(r.id)},1e3)}},c=e=>!!((e?n.animations?.filter(t=>t.name===e||t.type===e):n.animations)||[]).find(e=>e.enabled),l=c(`move`)||c(`fade`)||c(`zoom`),u=c(`rotate`)||c(`blink`)||c(`bounce`);return(0,J.jsxs)(`div`,{style:{height:`100%`,display:`flex`,flexDirection:`column`,overflow:`auto`,padding:`0 10px`},children:[(0,J.jsx)(`div`,{style:{paddingBottom:`10px`},children:(0,J.jsx)(z9,{title:Q(`sidePanel.animate`),onClose:()=>e.restoreSidePanel()})}),(0,J.jsxs)(`div`,{style:{paddingTop:`10px`,lineHeight:`35px`},children:[`Animations`,` `,(0,J.jsx)(uK,{variant:`outline`,style:{marginLeft:`10px`,display:l?`inline-flex`:`none`},onClick:()=>{r.set({animations:[]})},children:`Remove All`})]}),(0,J.jsxs)(`div`,{style:{paddingTop:`25px`},children:[(0,J.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(100px, 1fr))`,gap:`5px`,paddingBottom:`10px`},children:M_e.map(({key:e,icon:t,label:n})=>(0,J.jsx)(`div`,{children:(0,J.jsxs)(uK,{variant:`outline`,size:`lg`,className:rK(`pn:flex pn:h-auto pn:w-full pn:flex-col pn:items-center pn:gap-2 pn:p-5`,c(e)&&`pn:bg-muted`),onClick:()=>{o(e,{enabled:!c(e)})},children:[(0,J.jsx)($,{name:t}),Q(n)]})},e))}),(0,J.jsxs)(`div`,{className:`pn:bg-black/5 pn:dark:bg-white/5`,style:{display:l?`block`:`none`,padding:`10px`},children:[(0,J.jsx)(C_e,{element:n,store:e,enabled:c(`enter`)||c(`exit`)}),c(`move`)&&(0,J.jsx)(T_e,{value:n.animations.find(e=>e.name===`move`)?.data?.direction||`right`,onChange:e=>{o(`move`,{data:{direction:e},enabled:!0})}}),c(`move`)&&(0,J.jsx)(H9,{store:e,element:r,animationName:`move`}),c(`zoom`)&&(0,J.jsx)(E_e,{value:n.animations.find(e=>e.name===`zoom`)?.data?.direction||`in`,onChange:e=>{o(`zoom`,{data:{direction:e},enabled:!0})}}),c(`zoom`)&&(0,J.jsx)(H9,{store:e,element:r,animationName:`zoom`}),c(`enter`)&&(0,J.jsx)(D_e,{store:e,element:r}),c(`enter`)&&(0,J.jsx)(k_e,{store:e,element:r}),c(`exit`)&&(0,J.jsx)(j_e,{store:e,element:r})]}),(0,J.jsxs)(`div`,{style:{paddingTop:`10px`,lineHeight:`35px`},children:[`Effects`,` `,(0,J.jsx)(uK,{variant:`outline`,style:{marginLeft:`10px`,display:u?`inline-flex`:`none`},onClick:()=>{r.set({animations:[]})},children:`Remove All`})]}),(0,J.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(100px, 1fr))`,gap:`5px`,paddingTop:`10px`},children:N_e.map(({key:e,icon:t,label:n})=>(0,J.jsx)(`div`,{children:(0,J.jsxs)(uK,{variant:`outline`,size:`lg`,className:rK(`pn:flex pn:h-auto pn:w-full pn:flex-col pn:items-center pn:gap-2 pn:p-5`,c(e)&&`pn:bg-muted`),onClick:()=>{s(e,{enabled:!c(e)})},children:[(0,J.jsx)($,{name:t}),Q(n)]})},e))}),u&&(0,J.jsx)(O_e,{store:e,element:r}),c(`bounce`)&&(0,J.jsx)(H9,{store:e,element:r,animationName:`bounce`})]})]})});function U9({label:e,enabled:t,onEnabledChange:n,visible:r=!0,disabled:i,className:a,children:o}){if(!r)return null;let s=n?!!t:!0;return(0,J.jsxs)(`div`,{className:rK(`pn:py-1`,a),children:[(0,J.jsxs)(`div`,{className:`pn:flex pn:items-center pn:justify-between pn:gap-2 pn:py-1`,children:[(0,J.jsx)(`label`,{className:`pn:text-sm pn:font-medium`,children:e}),n&&(0,J.jsx)(F3,{checked:!!t,onCheckedChange:n,disabled:i})]}),s&&(0,J.jsx)(`div`,{className:`pn:mt-1.5 pn:rounded-lg pn:bg-muted/60 pn:px-3 pn:py-1`,children:o})]})}var W9=({title:e,imageSrc:t,effect:n,onClick:r,active:i})=>{let a=B_e(n);return(0,J.jsxs)(`div`,{className:`pn:flex pn:flex-col pn:gap-2 pn:cursor-pointer pn:flex-grow-0 pn:w-[calc(33%-16px)]`,onClick:r,children:[(0,J.jsxs)(`div`,{className:`pn:relative pn:h-[90px] pn:rounded-[10px] pn:box-border`,children:[(0,J.jsx)(`div`,{"data-active":i?`true`:void 0,className:rK(`pn:absolute pn:-left-1 pn:-top-1 pn:-bottom-1 pn:-right-1 pn:flex pn:rounded-[15px] pn:p-[2px] pn:transition-[border] pn:duration-200 pn:border-2 pn:border-transparent`,i&&`pn:border-white`)}),(0,J.jsx)(a,{src:t})]}),(0,J.jsx)(`span`,{className:`pn:text-center`,children:e})]})},G9=({className:e,style:t,...n})=>(0,J.jsx)(`img`,{className:rK(`pn:h-full pn:w-full pn:rounded-[10px] pn:object-cover`,e),style:t,...n}),F_e=e=>(0,J.jsx)(G9,{style:{filter:`sepia(1)`},...e}),I_e=e=>(0,J.jsx)(G9,{style:{filter:`grayscale(1)`},...e}),L_e=e=>(0,J.jsx)(G9,{style:{filter:Sb(xb.warm)?.filter},...e}),R_e=e=>{let t=Sb(xb.cold),n=t?.html,r=t?.filter;return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{style:{display:`none`},dangerouslySetInnerHTML:{__html:n||``}}),(0,J.jsx)(G9,{style:{filter:r},...e})]})},z_e=e=>(0,J.jsx)(G9,{style:{filter:Sb(xb.natural)?.filter},...e}),B_e=e=>{switch(e){case xb.sepia:return F_e;case xb.grayscale:return I_e;case xb.warm:return L_e;case xb.cold:return R_e;case xb.natural:return z_e;default:return G9}},K9=(e,t,n)=>Math.max(t,Math.min(n,e)),V_e=[[`temperature`,`toolbar.temperature`],[`contrast`,`toolbar.contrast`],[`shadows`,`toolbar.shadows`],[`white`,`toolbar.white`],[`black`,`toolbar.black`],[`vibrance`,`toolbar.vibrance`],[`saturation`,`toolbar.saturation`]],q9=({store:e,color:t,onColorChange:n,value:r,onValueChange:i,min:a,max:o})=>(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,padding:`8px 0`},children:[(0,J.jsx)(l6,{value:t,size:30,gradientEnabled:!0,onChange:n,store:e}),(0,J.jsx)(`div`,{style:{flex:1,paddingLeft:`10px`,paddingRight:`10px`},children:(0,J.jsx)(j3,{value:[r],onValueChange:e=>i(K9(aK(e),a,o)),min:a,max:o,step:1})}),(0,J.jsx)(o3,{value:r,onValueChange:e=>i(K9(e,a,o)),min:a,max:o,style:{width:64}})]}),H_e=W(({store:e})=>{let t=e.selectedElements,n=t[0],r=t.map(e=>e.id).join(`,`),i=e.openedSidePanel===`effects`;if(x.useEffect(()=>{i&&(!n||!n.filters)&&e.restoreSidePanel()},[i,r]),!n||!n.filters)return null;let a=n.type===`text`,o=n.type===`image`,s=n.type===`svg`,c=o||s,l=n=>{e.history.transaction(()=>{t.forEach(e=>{e.set(n)})})},u=(n,r)=>{e.history.transaction(()=>{t.forEach(e=>{let t=Number(r);return r!=0&&!r&&(t=e.filters.has(n)?null:1),Rb.includes(n)||e.set({grayscaleEnabled:n===`grayscale`&&!!r,sepiaEnabled:n===`sepia`&&!!r}),e.setFilter(n,t)})})};return(0,J.jsxs)(`div`,{style:{height:`100%`,display:`flex`,flexDirection:`column`,overflow:`auto`,padding:`0 10px`},children:[(0,J.jsx)(z9,{title:Q(`sidePanel.effects`),onClose:()=>e.restoreSidePanel()}),c&&(0,J.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`16px`,marginTop:`16px`},children:(0,J.jsxs)(`div`,{style:{display:`flex`,gap:`16px`,flexWrap:`wrap`},children:[(0,J.jsx)(W9,{active:n.grayscaleEnabled,onClick:()=>{u(`grayscale`,!n.grayscaleEnabled)},title:Q(`toolbar.grayscale`),imageSrc:n.src,effect:xb.grayscale}),(0,J.jsx)(W9,{active:n.sepiaEnabled,onClick:()=>{u(`sepia`,!n.sepiaEnabled)},title:Q(`toolbar.sepia`),imageSrc:n.src,effect:xb.sepia}),(0,J.jsx)(W9,{active:n.filters.has(`cold`),onClick:()=>{u(`cold`,n.filters.has(`cold`)?null:1)},title:Q(`toolbar.cold`),imageSrc:n.src,effect:xb.cold}),(0,J.jsx)(W9,{active:n.filters.has(`natural`),onClick:()=>{u(`natural`,n.filters.has(`natural`)?null:1)},title:Q(`toolbar.natural`),imageSrc:n.src,effect:xb.natural}),(0,J.jsx)(W9,{active:n.filters.has(`warm`),onClick:()=>{u(`warm`,n.filters.has(`warm`)?null:1)},title:Q(`toolbar.warm`),imageSrc:n.src,effect:xb.warm})]})}),(0,J.jsx)(I3,{label:Q(`toolbar.blur`),enabled:n.blurEnabled,visible:c||a,onEnabledChange:e=>{l({blurEnabled:e})},value:n.blurRadius,onChange:e=>{l({blurRadius:e})},min:0,max:100}),(0,J.jsx)(I3,{label:Q(`toolbar.brightness`),visible:c,enabled:n.brightnessEnabled,onEnabledChange:e=>{l({brightnessEnabled:e})},value:Math.round(n.brightness*100),onChange:e=>{l({brightness:e/100})},min:-100,max:100}),V_e.map(([e,t])=>(0,J.jsx)(I3,{label:Q(t),visible:c,enabled:n.filters.has(e),onEnabledChange:t=>{u(e,t?0:null)},value:Math.round((n.filters.get(e)?.intensity??0)*100),onChange:t=>{u(e,t/100)},min:-100,max:100},e)),a&&(0,J.jsxs)(U9,{label:Q(`toolbar.curvedText`)||`Curved text`,enabled:!!n.curveEnabled,onEnabledChange:e=>l({curveEnabled:e}),children:[(0,J.jsx)(N8,{label:Q(`toolbar.curvePower`)||`Curve`,className:`pn:py-2`,children:(0,J.jsx)(o3,{value:Math.round(n.curvePower*100),onValueChange:e=>{l({curvePower:K9(e,-100,100)/100})},style:{width:64},min:-100,max:100})}),(0,J.jsx)(Epe,{textEl:n,eachSet:l})]}),a&&(0,J.jsx)(U9,{label:Q(`toolbar.textStroke`),enabled:!!n.strokeWidth,onEnabledChange:e=>l({strokeWidth:e?2:0}),children:(0,J.jsx)(q9,{store:e,color:n.stroke,onColorChange:e=>{l({stroke:e})},value:n.strokeWidth,onValueChange:e=>{l({strokeWidth:e})},min:1,max:Math.max(1,Math.round(n.fontSize/2))})}),a&&(0,J.jsxs)(U9,{label:Q(`toolbar.textBackground`),enabled:!!n.backgroundEnabled,onEnabledChange:e=>l({backgroundEnabled:e}),children:[(0,J.jsx)(I3,{label:Q(`toolbar.backgroundCornerRadius`),value:Math.round(n.backgroundCornerRadius*100),onChange:e=>l({backgroundCornerRadius:e/100}),min:0,max:100}),(0,J.jsx)(I3,{label:Q(`toolbar.backgroundPadding`),value:Math.round(n.backgroundPadding*100),onChange:e=>l({backgroundPadding:e/100}),min:0,max:100}),(0,J.jsx)(I3,{label:Q(`toolbar.opacity`),value:Math.round(n.backgroundOpacity*100),onChange:e=>l({backgroundOpacity:e/100}),min:0,max:100}),(0,J.jsx)(N8,{label:Q(`toolbar.color`),className:`pn:py-2`,children:(0,J.jsx)(l6,{value:n.backgroundColor,size:30,onChange:e=>{l({backgroundColor:e})},store:e})})]}),c&&(0,J.jsx)(U9,{label:Q(`toolbar.border`),enabled:!!n.borderSize,onEnabledChange:e=>l({borderSize:e?2:0}),children:(0,J.jsx)(q9,{store:e,color:n.borderColor,onColorChange:e=>{l({borderColor:e})},value:n.borderSize,onValueChange:e=>{l({borderSize:e})},min:1,max:Math.max(1,Math.round(Math.min(n.width,n.height)/2))})}),c&&(0,J.jsx)(I3,{label:Q(`toolbar.cornerRadius`),visible:c,enabled:n.cornerRadius!==0,onEnabledChange:e=>{l({cornerRadius:e?Math.min(n.width/4,n.height/4):0})},value:Math.min(n.cornerRadius,Math.round(Math.min(n.width/2,n.height/2))),onChange:e=>{l({cornerRadius:e})},min:1,max:Math.round(Math.min(n.width/2,n.height/2))}),(0,J.jsxs)(U9,{label:Q(`toolbar.shadow`),enabled:n.shadowEnabled,onEnabledChange:e=>l({shadowEnabled:e}),children:[(0,J.jsx)(I3,{label:Q(`toolbar.blur`),value:n.shadowBlur,onChange:e=>{l({shadowBlur:e})},min:0,max:50}),(0,J.jsx)(I3,{label:Q(`toolbar.offsetX`),value:n.shadowOffsetX,onChange:e=>{l({shadowOffsetX:e})},min:-50,max:50}),(0,J.jsx)(I3,{label:Q(`toolbar.offsetY`),value:n.shadowOffsetY,onChange:e=>{l({shadowOffsetY:e})},min:-50,max:50}),(0,J.jsx)(I3,{label:Q(`toolbar.opacity`),value:Math.round(n.shadowOpacity*100),onChange:e=>{l({shadowOpacity:e/100})},min:0,max:100}),(0,J.jsx)(N8,{label:Q(`toolbar.color`),className:`pn:py-2`,children:(0,J.jsx)(l6,{value:n.shadowColor,size:30,onChange:e=>{l({shadowColor:e})},store:e})})]})]})}),U_e={name:`templates`,Tab:W(e=>(0,J.jsx)(z8,{name:Q(`sidePanel.templates`),...e,children:(0,J.jsx)($,{name:`sidePanel.templates`})})),Panel:({store:e})=>(0,J.jsx)(qhe,{store:e})},J9={name:`text`,Tab:W(e=>(0,J.jsx)(z8,{name:Q(`sidePanel.text`),...e,children:(0,J.jsx)($,{name:`sidePanel.text`})})),Panel:({store:e})=>(0,J.jsx)(Qhe,{store:e})},W_e={name:`photos`,Tab:W(e=>(0,J.jsx)(z8,{name:Q(`sidePanel.photos`),...e,children:(0,J.jsx)($,{name:`sidePanel.photos`})})),Panel:({store:e})=>(0,J.jsx)($he,{store:e})},G_e={name:`elements`,Tab:W(e=>(0,J.jsx)(z8,{name:Q(`sidePanel.elements`),iconSize:16,...e,children:(0,J.jsx)($,{name:`sidePanel.elements`})})),Panel:({store:e})=>(0,J.jsx)(dge,{store:e})},K_e={name:`upload`,Tab:W(e=>(0,J.jsx)(z8,{name:Q(`sidePanel.upload`),...e,children:(0,J.jsx)($,{name:`sidePanel.upload`})})),Panel:({store:e})=>(0,J.jsx)(_ge,{store:e})},q_e={name:`background`,Tab:W(e=>(0,J.jsx)(z8,{name:Q(`sidePanel.background`),...e,children:(0,J.jsx)($,{name:`sidePanel.background`})})),Panel:({store:e})=>(0,J.jsx)(yge,{store:e})};W(e=>(0,J.jsx)(z8,{name:Q(`sidePanel.pages`),...e,children:(0,J.jsx)($,{name:`sidePanel.pages`})}));var J_e={name:`layers`,Tab:W(e=>(0,J.jsx)(z8,{name:Q(`sidePanel.layers`),...e,children:(0,J.jsx)($,{name:`sidePanel.layers`})})),Panel:({store:e})=>(0,J.jsx)(r_e,{store:e})},Y_e={name:`size`,Tab:W(e=>(0,J.jsx)(z8,{name:Q(`sidePanel.resize`),...e,children:(0,J.jsx)($,{name:`sidePanel.resize`})})),Panel:({store:e})=>(0,J.jsx)(s_e,{store:e})},X_e={name:`draw`,Tab:W(e=>(0,J.jsx)(z8,{name:Q(`sidePanel.draw`),...e,children:(0,J.jsx)($,{name:`sidePanel.draw`})})),Panel:({store:e})=>(0,J.jsx)(p_e,{store:e})},Z_e={name:`videos`,Tab:e=>(0,J.jsx)(z8,{name:Q(`sidePanel.videos`),...e,children:(0,J.jsx)($,{name:`sidePanel.videos`})}),Panel:v_e},Y9=[U_e,J9,W_e,G_e,X_e,K_e,q_e,J_e,Y_e],Q_e={name:`image-clip`,Tab:()=>null,Panel:S_e},$_e={name:`effects`,Tab:()=>null,Panel:H_e},eve={name:`animation`,Tab:()=>null,Panel:P_e},tve=[Q_e,$_e],nve=e=>{let t=x.useRef(!0);t.current&&(t.current=!1,e())},rve=({onClick:e})=>(0,J.jsxs)(`div`,{className:`pn-side-panel-hide-button pn:absolute pn:right-[-14px] pn:top-1/2 pn:z-10 pn:h-24 pn:w-[15px] pn:cursor-pointer pn:max-md:hidden pn:pn-mobile:hidden`,onClick:e,children:[(0,J.jsx)(`svg`,{width:`15`,height:`96`,viewBox:`0 0 16 96`,xmlns:`http://www.w3.org/2000/svg`,children:(0,J.jsx)(`path`,{className:`pn:stroke-border pn:fill-background`,d:`M 1 7 C 2 9 4 10 7.2 13.28 C 7.45 13.4625 7.6 13.6 7.7 13.8048 L 7.8 13.8 C 9.8 15.8 11.6 17.6 12.9 19.7 C 14 21.6 14.7 23.9 14.9 27 H 15 V 68 C 15 71.7 14.3 74.3 13 76.6 C 11.7 78.8 9.9 80.5 7.8 82.6344 L 7.79 82.6 C 7.6 82.8 7.4507 83 7.2729 83.2127 C 3.9102 86.5228 2 87 1 90`})}),(0,J.jsx)(`div`,{className:`pn:absolute pn:left-1/2 pn:top-1/2 pn:text-[0.5rem] pn:text-muted-foreground pn:hover:text-foreground`,style:{transform:`translate(-50%, -50%) scaleY(2)`},children:`<`})]}),X9=W(({store:e,sections:t,defaultSection:n=`photos`})=>{nve(()=>{e.openSidePanel(n)});let r=DS();x.useLayoutEffect(()=>{r?e.openSidePanel(``):e.openSidePanel(n)},[r]);let i=[...t||Y9];if(tve.forEach(e=>{i.find(t=>t.name===e.name)||i.push(e)}),n_.animationsEnabled){if(!i.find(e=>e.name===`videos`)){let e=Math.floor(i.length/2);i.splice(e,0,Z_e)}if(!i.find(e=>e.name===`animations`)){let e=Math.floor(i.length/2);i.splice(e,0,eve)}}let a=i.filter(e=>e.visibleInList??!0),o=t=>{let n=t.target,i=n.closest(`.polotno-close-panel`),a=n.closest(`.polotno-mobile`);i&&(r||a)&&e.openSidePanel(``)},s=x.useRef(null),c=x.useRef(null),l=x.useRef(new Set);return e.openedSidePanel&&l.current.add(e.openedSidePanel),(0,J.jsx)(U1,{elementRef:c,children:(0,J.jsxs)(`div`,{ref:c,className:rK(`polotno-side-panel pn-side-panel pn:relative pn:flex pn:h-full pn:bg-background pn:p-0 pn:text-foreground`,`pn:md:border-r pn:md:border-border`,`pn:max-md:h-auto pn:max-md:w-full pn:pn-mobile:h-auto pn:pn-mobile:w-full`,!e.openedSidePanel&&`collapsed`),children:[(0,J.jsx)(`div`,{ref:s,className:rK(`polotno-side-tabs-container pn:bg-background pn:max-md:w-full pn:max-md:overflow-auto pn:pn-mobile:w-full pn:pn-mobile:overflow-auto pn:md:overflow-y-auto pn:md:overflow-x-hidden pn:md:min-w-[72px]`,e.openedSidePanel&&`pn:md:border-r pn:md:border-border`),children:(0,J.jsx)(`div`,{className:`polotno-side-tabs-inner pn:flex pn:flex-col pn:max-md:flex-row pn:max-md:min-w-min pn:pn-mobile:flex-row pn:pn-mobile:min-w-min`,children:a.map(({name:t,Tab:n})=>(0,J.jsx)(n,{active:t===e.openedSidePanel,onClick:()=>{if(t===e.openedSidePanel&&r){e.openSidePanel(``);return}e.openSidePanel(t)}},t))})}),i.map(({name:t,Panel:n})=>l.current.has(t)&&(0,J.jsx)(`div`,{className:rK(`polotno-panel-container pn-side-panel-content pn:h-full pn:px-2.5 pn:pt-2.5`,`pn:w-[var(--pn-sidebar-width,350px)]`,!e.openedSidePanel&&`pn:w-0`,t!==e.openedSidePanel&&`pn:hidden`,`pn:max-md:absolute pn:max-md:bottom-[54px] pn:max-md:z-[100] pn:max-md:!h-[50vh] pn:max-md:w-full pn:max-md:bg-background`,`pn:pn-mobile:absolute pn:pn-mobile:bottom-[54px] pn:pn-mobile:z-[100] pn:pn-mobile:!h-[50vh] pn:pn-mobile:w-full pn:pn-mobile:bg-background`),onClick:o,children:(0,J.jsx)(n,{store:e})},t)),e.openedSidePanel&&r&&(0,J.jsx)(`div`,{className:`polotno-close-panel`,style:{position:`absolute`,left:0,bottom:`72px`,width:`100vw`,height:`100vh`,zIndex:99,backgroundColor:`rgba(0,0,0,0.05)`},onClick:()=>e.openSidePanel(``)}),e.openedSidePanel&&(0,J.jsx)(rve,{onClick:()=>e.openSidePanel(``)})]})})});X9.displayName=`SidePanel`;var ive=cK(`pn:h-[35px] pn:rounded-md pn:bg-background pn:shadow-md`),Z9=1.2,Q9=[.1,.25,.5,.75,1,1.5,2,3,5],ave=Q9[Q9.length-1],ove=Q9[0],sve=W(({store:e})=>{let t=Math.max(ave,e.scaleToFit),n=Math.min(ove,e.scaleToFit),r=e.scale<t;return(0,J.jsxs)(`div`,{className:`pn:flex pn:h-[35px] pn:items-center`,children:[(0,J.jsx)(uK,{variant:`ghost`,size:`icon-sm`,onClick:()=>{e.setScale(e.scale/Z9)},disabled:!(e.scale>n),"aria-label":`Zoom out`,children:(0,J.jsx)($,{name:`toolbar.zoomOut`,className:`pn:size-4`})}),(0,J.jsxs)(j0,{children:[(0,J.jsx)(M0,{render:(0,J.jsx)(uK,{variant:`ghost`,size:`sm`,"aria-label":`Zoom level`,children:Math.round(e.scale*100)+`%`})}),(0,J.jsx)(N0,{className:`pn:w-auto pn:min-w-[80px] pn:p-1`,children:(0,J.jsxs)(`div`,{className:`pn:flex pn:flex-col`,children:[Q9.map(t=>(0,J.jsx)(uK,{variant:`ghost`,size:`sm`,className:`pn:justify-start`,onClick:async()=>{e.setScale(t)},children:Math.round(t*100)+`%`},t)),(0,J.jsx)(uK,{variant:`ghost`,size:`sm`,className:`pn:justify-start`,onClick:async()=>{e.setScale(e.scaleToFit)},children:Q(`scale.reset`)})]})})]}),(0,J.jsx)(uK,{variant:`ghost`,size:`icon-sm`,onClick:()=>{e.setScale(e.scale*Z9)},disabled:!r,"aria-label":`Zoom in`,children:(0,J.jsx)($,{name:`toolbar.zoomIn`,className:`pn:size-4`})})]})}),cve=W(({store:e})=>(0,J.jsx)(`div`,{className:`pn:relative pn:h-0`,children:(0,J.jsx)(`div`,{className:rK(ive(),`pn:absolute pn:bottom-[5px] pn:left-1/2 pn:-translate-x-1/2 pn:overflow-hidden pn:max-md:hidden`),children:(0,J.jsx)(`div`,{className:`pn:flex pn:h-full pn:items-center pn:px-[5px]`,children:(0,J.jsx)(sve,{store:e})})})})),lve=JM(`div`)`
723
+ `)}componentDidMount(){if(this.ref.current===null)return;let e=this.makeOptions();o(n).create(this.ref.current,e)}componentDidUpdate(e){e.disabled!==this.props.disabled&&this.sortable&&this.sortable.option(`disabled`,this.props.disabled)}render(){let{tag:e,style:t,className:n,id:r}=this.props,a={style:t,className:n,id:r},o=!e||e===null?`div`:e;return(0,i.createElement)(o,{ref:this.ref,...a},this.getChildren())}getChildren(){let{children:e,dataIdAttr:t,selectedClass:n=`sortable-selected`,chosenClass:a=`sortable-chosen`,dragClass:s=`sortable-drag`,fallbackClass:c=`sortable-falback`,ghostClass:l=`sortable-ghost`,swapClass:u=`sortable-swap-highlight`,filter:d=`sortable-filter`,list:f}=this.props;if(!e||e==null)return null;let p=t||`data-id`;return i.Children.map(e,(e,t)=>{if(e===void 0)return;let s=f[t]||{},{className:c}=e.props,l=typeof d==`string`&&{[d.replace(`.`,``)]:!!s.filtered},u=o(r)(c,{[n]:s.selected,[a]:s.chosen,...l});return(0,i.cloneElement)(e,{[p]:e.key,className:u})})}get sortable(){let e=this.ref.current;if(e===null)return null;let t=Object.keys(e).find(e=>e.includes(`Sortable`));return t?e[t]:null}makeOptions(){let e=[`onAdd`,`onChoose`,`onDeselect`,`onEnd`,`onRemove`,`onSelect`,`onSpill`,`onStart`,`onUnchoose`,`onUpdate`],t=[`onChange`,`onClone`,`onFilter`,`onSort`],n=x(this.props);e.forEach(e=>n[e]=this.prepareOnHandlerPropAndDOM(e)),t.forEach(e=>n[e]=this.prepareOnHandlerProp(e));let r=(e,t)=>{let{onMove:n}=this.props,r=e.willInsertAfter||-1;if(!n)return r;let i=n(e,t,this.sortable,S);return i===void 0?!1:i};return{...n,onMove:r}}prepareOnHandlerPropAndDOM(e){return t=>{this.callOnHandlerProp(t,e),this[e](t)}}prepareOnHandlerProp(e){return t=>{this.callOnHandlerProp(t,e)}}callOnHandlerProp(e,t){let n=this.props[t];n&&n(e,this.sortable,S)}onAdd(e){let{list:t,setList:n,clone:r}=this.props,i=h(e,[...S.dragging.props.list]);d(i),n(v(i,t,e,r).map(e=>Object.assign(e,{selected:!1})),this.sortable,S)}onRemove(e){let{list:t,setList:n}=this.props,r=y(e),i=h(e,t);p(i);let s=[...t];if(e.pullMode!==`clone`)s=_(i,s);else{let t=i;switch(r){case`multidrag`:t=i.map((t,n)=>({...t,element:e.clones[n]}));break;case`normal`:t=i.map(t=>({...t,element:e.clone}));break;default:o(a)(!0,`mode "${r}" cannot clone. Please remove "props.clone" from <ReactSortable/> when using the "${r}" plugin`)}d(t),i.forEach(t=>{let n=t.oldIndex,r=this.props.clone(t.item,e);s.splice(n,1,r)})}s=s.map(e=>Object.assign(e,{selected:!1})),n(s,this.sortable,S)}onUpdate(e){let{list:t,setList:n}=this.props,r=h(e,t);return d(r),p(r),n(g(r,t),this.sortable,S)}onStart(){S.dragging=this}onEnd(){S.dragging=null}onChoose(e){let{list:t,setList:n}=this.props;n(t.map((t,n)=>{let r=t;return n===e.oldIndex&&(r=Object.assign(t,{chosen:!0})),r}),this.sortable,S)}onUnchoose(e){let{list:t,setList:n}=this.props;n(t.map((t,n)=>{let r=t;return n===e.oldIndex&&(r=Object.assign(r,{chosen:!1})),r}),this.sortable,S)}onSpill(e){let{removeOnSpill:t,revertOnSpill:n}=this.props;t&&!n&&l(e.item)}onSelect(e){let{list:t,setList:n}=this.props,r=t.map(e=>Object.assign(e,{selected:!1}));e.newIndicies.forEach(t=>{let n=t.index;if(n===-1){console.log(`"${e.type}" had indice of "${t.index}", which is probably -1 and doesn't usually happen here.`),console.log(e);return}r[n].selected=!0}),n(r,this.sortable,S)}onDeselect(e){let{list:t,setList:n}=this.props,r=t.map(e=>Object.assign(e,{selected:!1}));e.newIndicies.forEach(e=>{let t=e.index;t!==-1&&(r[t].selected=!0)}),n(r,this.sortable,S)}};c(t.exports,{})}))(),n_e=W(({element:e,store:t})=>{let n=t.selectedElements.indexOf(e)>=0,[r,i]=x.useState(!1),a=()=>i(!0),o=()=>i(!1),s=r?e.name:e.name||vv(e.text)||`#${e.id}`;return(0,J.jsx)(`div`,{onMouseDown:n=>{let r=n.ctrlKey||n.metaKey||n.shiftKey?[...t.selectedElementsIds]:[];r.indexOf(e.id)<0&&r.push(e.id),t.selectElements(r)},className:rK(`pn:rounded-md pn:border pn:bg-card pn:p-[5px] pn:mx-[1px] pn:mb-[5px] pn:shadow-sm`,n&&`selected pn:border-primary pn:bg-primary/10`),style:{display:e.selectable||t.role===`admin`?`auto`:`none`},children:(0,J.jsxs)(`div`,{className:`pn:flex pn:items-center pn:justify-between`,children:[(0,J.jsxs)(`div`,{className:`pn:flex pn:items-center`,style:{lineHeight:`30px`},children:[(0,J.jsx)(`div`,{className:`drag-handle`,style:{display:`flex`,justifyContent:`center`,alignItems:`center`,cursor:`move`,height:`30px`},children:(0,J.jsx)($,{name:`action.dragHandle`,className:`pn:size-4`})}),(0,J.jsx)(`div`,{style:{padding:`0 7px`,opacity:.5,width:`60px`},children:Q(`sidePanel.layerTypes.`+e.type)}),(0,J.jsx)(`div`,{style:{maxWidth:`142px`},children:(0,J.jsx)(a3,{value:s,onFocus:a,onBlur:o,placeholder:Q(`sidePanel.namePlaceholder`),onChange:t=>{e.set({name:t.target.value})},onKeyDown:e=>{(e.key===`Enter`||e.key===`Escape`)&&(o(),e.target.blur())},className:`pn:h-7 pn:border-none pn:bg-transparent pn:dark:bg-transparent pn:px-1 pn:shadow-none pn:focus-visible:ring-1`,style:{minWidth:130}})})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(uK,{variant:`ghost`,size:`icon-sm`,onClick:()=>{e.set({visible:!e.visible})},children:e?.visible?(0,J.jsx)($,{name:`action.visible`}):(0,J.jsx)($,{name:`action.hidden`})}),(0,J.jsx)(uK,{variant:`ghost`,size:`icon-sm`,onClick:()=>{e.set({draggable:e.locked,contentEditable:e.locked,styleEditable:e.locked,resizable:e.locked,removable:e.locked})},children:e?.locked?(0,J.jsx)($,{name:`action.lock`}):(0,J.jsx)($,{name:`action.unlock`})}),(0,J.jsx)(uK,{variant:`ghost`,size:`icon-sm`,disabled:!e.removable,onClick:()=>{t.deleteElements([e.id])},style:{marginLeft:`auto`},children:(0,J.jsx)($,{name:`action.remove`})})]})]})})}),r_e=W(({store:e})=>{let t=t=>{let n=t.filter(e=>e!=null&&e.id!=null);n.forEach((t,r)=>{let i=n.length-r-1,a=String(t.id),o=e.getElementById(a),s=e.activePage?.children.indexOf(o);o&&s!==i&&e.activePage?.setElementZIndex(o.id,i)})},n=e.activePage?.children.map(e=>({id:e.id}))||[];n.reverse();let r=wS();return(0,J.jsxs)(`div`,{style:{height:`100%`,overflow:`auto`},children:[(0,J.jsx)(`div`,{style:{height:`40px`,paddingTop:`5px`},children:Q(`sidePanel.layersTip`)}),(0,J.jsxs)(`div`,{children:[n.length===0?(0,J.jsx)(`div`,{children:Q(`sidePanel.noLayers`)}):null,(0,J.jsx)(t_e.ReactSortable,{list:n,setList:t,direction:`horizontal`,handle:r?`.drag-handle`:void 0,children:n.map(({id:t})=>(0,J.jsx)(n_e,{element:e.getElementById(t),store:e},t))})]})]})}),i_e=[{name:`Instagram`,icon:(0,J.jsx)($,{name:`size.instagram`}),sizes:[[`Post`,1080,1080,`px`,(0,J.jsx)($,{name:`size.instagram`})],[`Story`,1080,1920,`px`,(0,J.jsx)($,{name:`size.instagram`})],[`Ad`,1080,1080,`px`,(0,J.jsx)($,{name:`size.instagram`})]]},{name:`Facebook`,icon:(0,J.jsx)($,{name:`size.facebook`}),sizes:[[`Post (Landscape)`,1200,630,`px`,(0,J.jsx)($,{name:`size.facebook`})],[`Post (Square)`,1080,1080,`px`,(0,J.jsx)($,{name:`size.facebook`})],[`Cover`,851,315,`px`,(0,J.jsx)($,{name:`size.facebook`})]]},{name:`Youtube`,icon:(0,J.jsx)($,{name:`size.youtube`}),sizes:[[`Thumbnail`,1280,720,`px`,(0,J.jsx)($,{name:`size.youtube`})],[`Channel`,2560,1440,`px`,(0,J.jsx)($,{name:`size.youtube`})],[`Short`,1080,1920,`px`,(0,J.jsx)($,{name:`size.youtube`})]]},{name:`LinkedIn`,icon:(0,J.jsx)($,{name:`size.linkedin`}),sizes:[[`Post`,1200,627,`px`,(0,J.jsx)($,{name:`size.linkedin`})],[`Banner`,1584,396,`px`,(0,J.jsx)($,{name:`size.linkedin`})],[`Square`,1080,1080,`px`,(0,J.jsx)($,{name:`size.linkedin`})]]},{name:`Twitter`,icon:(0,J.jsx)($,{name:`size.twitter`}),sizes:[[`Post`,1600,900,`px`,(0,J.jsx)($,{name:`size.twitter`})],[`Header`,1500,500,`px`,(0,J.jsx)($,{name:`size.twitter`})],[`Square`,1080,1080,`px`,(0,J.jsx)($,{name:`size.twitter`})]]},{name:`Video`,icon:(0,J.jsx)($,{name:`size.video`}),sizes:[[`Full HD`,1920,1080,`px`,(0,J.jsx)($,{name:`size.video`})],[`4K UHD`,3840,2160,`px`,(0,J.jsx)($,{name:`size.video`})],[`Vertical HD`,1080,1920,`px`,(0,J.jsx)($,{name:`size.video`})],[`Square HD`,1080,1080,`px`,(0,J.jsx)($,{name:`size.video`})]]},{name:`Print`,icon:(0,J.jsx)($,{name:`size.print`}),sizes:[[`Invitation`,14,14,`cm`,(0,J.jsx)($,{name:`size.print`})],[`A4 Portrait`,21,29.7,`cm`,(0,J.jsx)($,{name:`size.print`})],[`A4 Landscape`,29.7,21,`cm`,(0,J.jsx)($,{name:`size.print`})],[`A3`,29.7,42,`cm`,(0,J.jsx)($,{name:`size.print`})],[`Letter Portrait`,8.5,11,`in`,(0,J.jsx)($,{name:`size.print`})],[`Letter Landscape`,11,8.5,`in`,(0,J.jsx)($,{name:`size.print`})],[`Business card`,3.5,2,`in`,(0,J.jsx)($,{name:`size.businessCard`})],[`Poster`,18,24,`in`,(0,J.jsx)($,{name:`size.print`})]]}],a_e=10,k9=({value:e,onChange:t,...n})=>{let[r,i]=x.useState(e.toString()),a=x.useRef(e);a.current=r;let o=()=>{t(Math.max(n.min||0,parseFloat(a.current)))};x.useEffect(()=>{i(String(e))},[e]);let s=Number(n.step)||1,c=r=>{let o=parseFloat(a.current),c=(Number.isNaN(o)?Number(e)||0:o)+r*s;typeof n.min==`number`&&(c=Math.max(n.min,c)),typeof n.max==`number`&&(c=Math.min(n.max,c)),c=parseFloat(c.toFixed(4)),i(String(c)),t(c)},{className:l,...u}=n;return(0,J.jsxs)(`div`,{className:`pn:relative`,children:[(0,J.jsx)(a3,{...u,type:`number`,value:r.toString(),className:rK(`pn:pr-6 pn:[appearance:textfield] pn:[&::-webkit-inner-spin-button]:appearance-none pn:[&::-webkit-outer-spin-button]:appearance-none`,l),onChange:e=>{let t=e.target.value;Number.isNaN(parseFloat(t))?t===``&&i(t):i(t)},onBlur:o,onFocus:e=>e.target.select(),onKeyDown:e=>{e.key===`Enter`&&o()}}),(0,J.jsxs)(`div`,{className:`pn:absolute pn:inset-y-0 pn:right-0 pn:flex pn:w-5 pn:flex-col pn:border-l pn:border-input`,children:[(0,J.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-label":`Increment`,className:`pn:flex pn:flex-1 pn:appearance-none pn:cursor-pointer pn:items-center pn:justify-center pn:border-0 pn:bg-transparent pn:text-muted-foreground pn:hover:bg-muted pn:hover:text-foreground`,onClick:()=>c(1),children:(0,J.jsx)($,{name:`ui.chevronUp`,className:`pn:size-3`})}),(0,J.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-label":`Decrement`,className:`pn:flex pn:flex-1 pn:appearance-none pn:cursor-pointer pn:items-center pn:justify-center pn:border-0 pn:border-t pn:border-input pn:bg-transparent pn:text-muted-foreground pn:hover:bg-muted pn:hover:text-foreground`,onClick:()=>c(-1),children:(0,J.jsx)($,{name:`ui.chevronDown`,className:`pn:size-3`})})]})]})},o_e=({width:e,height:t})=>{let n=e/t;return(0,J.jsx)(`span`,{className:`pn:flex pn:size-5 pn:shrink-0 pn:items-center pn:justify-center pn:text-muted-foreground`,children:(0,J.jsx)(`span`,{className:`pn:rounded-[2px] pn:border pn:border-current`,style:{width:n>=1?18:Math.max(4,18*n),height:n>=1?Math.max(4,18/n):18}})})},s_e=W(({store:e})=>{let[t,n]=x.useState(!0),[r,i]=x.useState(e.width),[a,o]=x.useState(e.height),s=wy({px:a_e,unit:e.unit,dpi:e.dpi}),c=e.activePage?.computedWidth||e.width;x.useEffect(()=>{i(Ty({px:c,unit:e.unit,dpi:e.dpi}))},[c,e.unit,e.dpi]);let l=e.activePage?.computedHeight||e.height;x.useEffect(()=>{o(Ty({px:l,unit:e.unit,dpi:e.dpi}))},[l,e.unit,e.dpi]);let u=(t,n,r)=>{e.setSize(t,n,r),e.activePage?.width!==`auto`&&e.activePage?.set({width:t}),e.activePage?.height!==`auto`&&e.activePage?.set({height:n})};return(0,J.jsxs)(`div`,{style:{height:`100%`,overflow:`auto`,paddingRight:`3px`},children:[(0,J.jsxs)(`div`,{style:{paddingBottom:`15px`},children:[(0,J.jsxs)(`label`,{className:`pn:flex pn:items-center pn:justify-between`,style:{marginTop:`8px`,marginBottom:`25px`},children:[(0,J.jsxs)(`span`,{className:`pn:flex pn:items-center pn:gap-1.5`,children:[Q(`sidePanel.useMagicResize`),` `,(0,J.jsxs)(K1,{children:[(0,J.jsx)(q1,{render:(0,J.jsx)(`span`,{className:`pn:inline-flex`,children:(0,J.jsx)($,{name:`action.help`,className:`pn:size-4`})})}),(0,J.jsx)(J1,{side:`bottom`,children:Q(`sidePanel.magicResizeDescription`)})]})]}),(0,J.jsx)(F3,{checked:t,onCheckedChange:e=>{n(!!e)}})]}),(0,J.jsxs)(`div`,{className:`pn:inline-block pn:w-1/2`,children:[Q(`sidePanel.width`),` (`,e.unit,`)`]}),(0,J.jsx)(`div`,{className:`pn:inline-block pn:w-1/2`,children:(0,J.jsx)(k9,{value:r,onChange:e=>{e||=s,i(e)},min:s,max:1e4,step:e.unit===`px`?1:.1})})]}),(0,J.jsxs)(`div`,{style:{paddingBottom:`15px`},children:[(0,J.jsxs)(`div`,{className:`pn:inline-block pn:w-1/2`,children:[Q(`sidePanel.height`),` (`,e.unit,`)`]}),(0,J.jsx)(`div`,{className:`pn:inline-block pn:w-1/2`,children:(0,J.jsx)(k9,{value:a,onChange:e=>{e||=s,o(e)},min:s,max:1e4,step:e.unit===`px`?1:.1})})]}),(0,J.jsxs)(`div`,{style:{paddingBottom:`15px`},children:[(0,J.jsx)(`div`,{className:`pn:inline-block pn:w-1/2`,children:Q(`sidePanel.units`)}),(0,J.jsx)(`div`,{className:`pn:inline-block pn:w-1/2`,children:(0,J.jsxs)(U6,{value:e.unit,onValueChange:t=>{let n=t;e.setUnit({unit:n,dpi:e.dpi})},children:[(0,J.jsx)(G6,{className:`pn:w-full`,children:(0,J.jsx)(W6,{})}),(0,J.jsxs)(K6,{children:[(0,J.jsx)(q6,{value:`px`,children:`px`}),(0,J.jsx)(q6,{value:`cm`,children:`cm`}),(0,J.jsx)(q6,{value:`in`,children:`in`})]})]})})]}),(0,J.jsx)(`div`,{style:{paddingBottom:`15px`},children:(0,J.jsx)(uK,{className:`pn:w-full`,variant:`default`,onClick:()=>{u(Ey({unitVal:r,dpi:e.dpi,unit:e.unit}),Ey({unitVal:a,dpi:e.dpi,unit:e.unit}),t)},children:Q(`sidePanel.resize`)})}),i_e.map(({name:n,icon:r,sizes:i})=>(0,J.jsxs)(x.Fragment,{children:[(0,J.jsxs)(`div`,{className:`pn:flex pn:items-center pn:gap-1.5 pn:pt-3 pn:pb-1 pn:text-[13px] pn:font-semibold`,children:[r,n]}),(0,J.jsx)(`div`,{className:`pn:mb-1.5 pn:flex pn:flex-col`,children:i.map(([n,r,i,a])=>(0,J.jsxs)(uK,{variant:`ghost`,className:`pn:h-9 pn:w-full pn:justify-start pn:gap-2.5 pn:px-2 pn:text-[13px] pn:font-normal`,onClick:()=>{let n=Ey({unitVal:r,dpi:e.dpi,unit:a}),o=Ey({unitVal:i,dpi:e.dpi,unit:a});e.setUnit({unit:a,dpi:e.dpi}),u(n,o,t)},children:[(0,J.jsx)(o_e,{width:r,height:i}),(0,J.jsx)(`span`,{className:`pn:truncate`,children:n}),(0,J.jsxs)(`span`,{className:`pn:ml-auto pn:shrink-0 pn:text-xs pn:text-muted-foreground`,children:[r,`×`,i,` `,a]})]},n))})]},n))]})}),A9=x.createContext(void 0);function c_e(e=!0){let t=x.useContext(A9);if(t===void 0&&!e)throw Error(CK(7));return t}var l_e=function(e){return e.disabled=`data-disabled`,e.orientation=`data-orientation`,e.multiple=`data-multiple`,e}({}),j9={multiple(e){return e?{[l_e.multiple]:``}:null}},u_e=x.forwardRef(function(e,t){let{defaultValue:n,disabled:r=!1,loopFocus:i=!0,onValueChange:a,orientation:o=`horizontal`,multiple:s=!1,value:c,className:l,render:u,style:d,...f}=e,p=A0(!0),m=x.useMemo(()=>c!==void 0||n!==void 0,[c,n]),h=(p?.disabled??!1)||r,[g,_]=S2({controlled:c,default:c===void 0?n??Wq:void 0,name:`ToggleGroup`,state:`value`}),v=jJ((e,t,n)=>{let r;s?(r=g.slice(),t?r.push(e):r.splice(g.indexOf(e),1)):r=t?[e]:[],a?.(r,n),!n.isCanceled&&_(r)}),y={disabled:h,multiple:s,orientation:o},b=x.useMemo(()=>({disabled:h,orientation:o,setGroupValue:v,value:g,isValueInitialized:m}),[h,o,v,g,m]),S={role:`group`},C=UX(`div`,e,{enabled:!!p,state:y,ref:t,props:[S,f],stateAttributesMapping:j9});return(0,J.jsx)(A9.Provider,{value:b,children:p?C:(0,J.jsx)($3,{render:u,className:l,style:d,state:y,refs:[t],props:[S,f],stateAttributesMapping:j9,loopFocus:i,enableHomeAndEndKeys:!0,orientation:o})})}),M9=x.forwardRef(function(e,t){let{className:n,defaultPressed:r=!1,disabled:i=!1,form:a,onPressedChange:o,pressed:s,render:c,type:l,value:u,nativeButton:d=!0,style:f,...p}=e,m=h1(u||void 0),h=c_e(),g=h?.value??[],_=h?void 0:r,v=(i||h?.disabled)??!1,[y,b]=S2({controlled:h?m!==void 0&&g.indexOf(m)>-1:s,default:_,name:`Toggle`,state:`pressed`}),{getButtonProps:x,buttonRef:S}=t0({disabled:v,native:d}),C={disabled:v,pressed:y},w=[S,t],T=[{"aria-pressed":y,onClick(e){let t=!y,n=pJ(Kq,e.nativeEvent);m&&h?.setGroupValue?.(m,t,n),o?.(t,n),!n.isCanceled&&b(t)}},p,x],E=UX(`button`,e,{enabled:!h,state:C,ref:w,props:T});return h?(0,J.jsx)(U2,{tag:`button`,render:c,className:n,style:f,state:C,refs:w,props:T}):E}),N9=cK(`pn:inline-flex pn:items-center pn:justify-center pn:gap-2 pn:rounded-md pn:text-sm pn:font-medium pn:whitespace-nowrap pn:transition-[color,box-shadow] pn:outline-none pn:hover:bg-muted pn:hover:text-muted-foreground pn:focus-visible:border-ring pn:focus-visible:ring-[3px] pn:focus-visible:ring-ring/50 pn:disabled:pointer-events-none pn:disabled:opacity-50 pn:aria-invalid:border-destructive pn:aria-invalid:ring-destructive/20 pn:data-pressed:bg-accent pn:data-pressed:text-accent-foreground pn:dark:aria-invalid:ring-destructive/40 pn:[&_svg]:pointer-events-none pn:[&_svg]:shrink-0 pn:[&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`pn:bg-transparent`,outline:`pn:border pn:border-input pn:bg-transparent pn:shadow-xs pn:hover:bg-accent pn:hover:text-accent-foreground`},size:{default:`pn:h-9 pn:min-w-9 pn:px-2`}},defaultVariants:{variant:`default`,size:`default`}}),d_e=x.forwardRef(({className:e,variant:t,size:n,...r},i)=>(0,J.jsx)(M9,{ref:i,"data-slot":`toggle`,className:rK(N9({variant:t,size:n,className:e})),...r}));d_e.displayName=`Toggle`;var P9=x.createContext({size:`default`,variant:`default`}),F9=x.forwardRef(({className:e,variant:t,size:n,children:r,...i},a)=>(0,J.jsx)(u_e,{ref:a,"data-slot":`toggle-group`,"data-variant":t,"data-size":n,className:rK(`pn:group/toggle-group pn:flex pn:w-fit pn:items-center pn:rounded-md`,e),...i,children:(0,J.jsx)(P9.Provider,{value:{variant:t,size:n},children:r})}));F9.displayName=`ToggleGroup`;var I9=x.forwardRef(({className:e,children:t,variant:n,size:r,...i},a)=>{let o=x.useContext(P9);return(0,J.jsx)(M9,{ref:a,"data-slot":`toggle-group-item`,"data-variant":o.variant||n,"data-size":o.size||r,className:rK(N9({variant:o.variant||n,size:o.size||r}),`pn:w-auto pn:min-w-0 pn:shrink-0 pn:px-3 pn:focus:z-10 pn:focus-visible:z-10`,`pn:rounded-none pn:shadow-none pn:first:rounded-l-md pn:last:rounded-r-md pn:data-[variant=outline]:border-l-0 pn:data-[variant=outline]:first:border-l`,e),...i,children:t})});I9.displayName=`ToggleGroupItem`;var L9=(e,t,n)=>Math.max(t,Math.min(n,e)),R9=(e,t)=>Array.from(e.keys()).find(e=>lb(e,t)),f_e=(e,t)=>{let n=R9(e,t);return e.get(n||``)||t},p_e=W(({store:e})=>{let{brushType:t,strokeWidth:n,stroke:r,opacity:i}=e.toolOptions,a=e.tool===`selection`,o=e.selectedElements,s=o.length===1&&o[0].type===`svg`,c=s?o[0]:null,l=db(c?.src||``),u=l.length>0?l[0]:null,d=t=>{t===`selection`?e.setTool(`selection`):(e.selectElements([]),e.setTool(`draw`),e.setToolOptions({brushType:t,opacity:t===`highlighter`?.5:1,strokeWidth:t===`highlighter`?30:n||5}))},f=t=>{e.setToolOptions({strokeWidth:t})},p=t=>{e.setToolOptions({stroke:t})},m=t=>{e.setToolOptions({opacity:t})},h=e=>{if(c&&u){let t=R9(c.colorsReplace,u)||u;c.replaceColor(t,e)}},g=e=>{c&&c.set({opacity:e})};return x.useEffect(()=>()=>{e.setTool(`selection`)},[]),(0,J.jsxs)(`div`,{className:`pn:flex pn:h-full pn:flex-col pn:overflow-auto pn:pr-1`,children:[(0,J.jsxs)(`div`,{style:{marginBottom:`30px`},children:[(0,J.jsx)(`h3`,{className:`pn:mb-[15px] pn:text-sm pn:font-semibold pn:uppercase pn:text-muted-foreground`,children:`Tool`}),(0,J.jsx)(`div`,{style:{padding:`0 5px`},children:(0,J.jsxs)(F9,{variant:`outline`,value:[a?`selection`:t],onValueChange:e=>{let t=e[0];t&&d(t)},className:`pn:w-full`,children:[(0,J.jsxs)(I9,{value:`selection`,className:`pn:flex-1`,children:[(0,J.jsx)($,{name:`draw.select`}),`Selection`]}),(0,J.jsxs)(I9,{value:`brush`,className:`pn:flex-1`,children:[(0,J.jsx)($,{name:`draw.brush`}),`Brush`]}),(0,J.jsxs)(I9,{value:`highlighter`,className:`pn:flex-1`,children:[(0,J.jsx)($,{name:`draw.highlighter`}),`Highlighter`]})]})})]}),!s&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{style:{marginBottom:`30px`,opacity:a?.5:1},children:(0,J.jsx)(I3,{label:`Stroke Width`,value:n,onChange:e=>f(L9(e,1,50)),min:1,max:50,disabled:a})}),(0,J.jsx)(`div`,{style:{marginBottom:`30px`,opacity:a?.5:1,pointerEvents:a?`none`:`auto`},children:(0,J.jsx)(N8,{label:`Color`,className:`pn:py-[5px]`,children:(0,J.jsx)(l6,{value:r,size:30,onChange:p,store:e})})}),(0,J.jsx)(`div`,{style:{marginBottom:`30px`,opacity:a?.5:1},children:(0,J.jsx)(I3,{label:`Opacity`,value:Math.round(i*100),onChange:e=>m(L9(e,0,100)/100),min:0,max:100,disabled:a})})]}),s&&u&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{style:{marginBottom:`30px`},children:(0,J.jsx)(N8,{label:`Color`,className:`pn:py-[5px]`,children:(0,J.jsx)(l6,{value:f_e(c.colorsReplace,u),size:30,onChange:h,store:e,gradientEnabled:!0})})}),(0,J.jsx)(`div`,{style:{marginBottom:`30px`},children:(0,J.jsx)(I3,{label:`Opacity`,value:Math.round(c.opacity*100),onChange:e=>g(L9(e,0,100)/100),min:0,max:100})})]})]})}),m_e=({items:e,onSelect:t,loadMore:n,isLoading:r,error:i,getCredit:a})=>{let o=(0,x.useRef)(null),s=(0,x.useCallback)(e=>{r||(o.current&&o.current.disconnect(),o.current=new IntersectionObserver(e=>{e[0].isIntersecting&&n()}),e&&o.current.observe(e))},[r]);return i?(0,J.jsx)(`div`,{children:i.message}):!e||e.length===0?null:(0,J.jsx)(`div`,{className:`pn:h-full pn:overflow-auto`,children:[e.filter((e,t)=>t%2==1),e.filter((e,t)=>t%2==0)].map((e,n)=>(0,J.jsxs)(`div`,{className:`pn:float-left pn:w-1/2`,children:[e.map(e=>(0,J.jsx)(h_e,{item:e,onClick:()=>t(e),onDragStart:()=>{hV(((n,r)=>{t(e,n,r)}))},onDragEnd:()=>hV(null),getCredit:a},e.id)),(0,J.jsx)(`div`,{ref:s,className:`pn:p-12`,children:r&&(0,J.jsx)(I0,{className:`pn:size-5 pn:mx-auto pn:text-muted-foreground`})})]},n))})},h_e=({item:e,onClick:t,onDragEnd:n,onDragStart:r,getCredit:i})=>{let a=(0,x.useRef)(null),o=()=>{a.current?.play()?.catch(()=>{})},s=()=>{a.current?.pause(),a.current&&(a.current.currentTime=0)},c=e.video_files.find(e=>e.quality===`sd`)?.link||``;if(!c)return null;let l=new Date(e.duration*1e3).toISOString(),u;return u=e.duration>3600?l.substring(11,19):l.substring(14,19),(0,J.jsx)(`div`,{className:`pn:group/video pn:w-full pn:p-[5px] pn:hover:[&_.video-grid__item-credit]:opacity-100`,children:(0,J.jsxs)(`div`,{className:`pn:relative`,draggable:!0,onClick:t,onDragEnd:n,onDragStart:r,onMouseEnter:o,onMouseLeave:s,children:[(0,J.jsx)(`video`,{poster:e.video_pictures[0].picture,controls:!1,ref:a,muted:!0,preload:`none`,playsInline:!0,className:`pn:block pn:max-h-[300px] pn:min-h-[50px] pn:w-full pn:cursor-pointer pn:rounded-[5px] pn:object-cover pn:shadow-[0_0_5px_rgba(16,22,26,0.3)]`,children:(0,J.jsx)(`source`,{src:c})}),(0,J.jsx)(`div`,{className:`pn:absolute pn:right-2 pn:top-2 pn:flex pn:items-center pn:justify-center pn:rounded-full pn:bg-black/50 pn:px-[7px] pn:py-[2px] pn:text-center pn:text-white`,children:(0,J.jsx)(`span`,{className:`pn:text-xs`,children:u})}),i&&(0,J.jsx)(`div`,{className:`video-grid__item-credit pn:absolute pn:inset-x-0 pn:bottom-0 pn:bg-gradient-to-b pn:from-transparent pn:via-black/40 pn:to-black/60 pn:p-[3px] pn:text-center pn:text-[10px] pn:text-white pn:opacity-0 pn:[&_a]:text-white pn:[&_a]:underline`,children:i(e)})]})})},g_e=`https://api.polotno.com/api/pexels/videos`,__e=({query:e,page:t})=>`${g_e}/${e?`search`:`popular`}?query=${e}&per_page=20&page=${t}&KEY=${h_()}`,v_e=W(({store:e})=>{let{setQuery:t,loadMore:n,isReachingEnd:r,data:i,isLoading:a,error:o}=J8({defaultQuery:``,getAPI:({page:e,query:t})=>__e({page:e,query:t}),getSize:e=>e.total_results/e.per_page});return(0,J.jsxs)(`div`,{className:`pn:flex pn:h-full pn:flex-col`,children:[(0,J.jsx)(Y8,{style:{marginBottom:`20px`},placeholder:Q(`sidePanel.searchPlaceholder`),onChange:e=>{t(e.target.value)}}),(0,J.jsxs)(`p`,{className:`pn:text-center pn:text-sm pn:text-muted-foreground`,children:[`Videos by`,` `,(0,J.jsx)(`a`,{href:`https://www.pexels.com/`,target:`_blank`,className:`pn:font-medium pn:text-foreground pn:underline pn:underline-offset-2`,children:`Pexels`})]}),(0,J.jsx)(m_e,{items:i?.map(e=>e.videos).flat().filter(Boolean)??[],onSelect:async(t,n,r)=>{a5({src:t.video_files.find(e=>e.quality===`hd`)?.link||t.video_files[0].link,store:e,droppedPos:n,targetElement:r,attrs:{width:t.width,height:t.height}})},isLoading:a,error:o,loadMore:!r&&n,getCredit:e=>(0,J.jsxs)(`span`,{children:[`Video by`,` `,(0,J.jsx)(`a`,{href:e.user.url,target:`_blank`,rel:`noreferrer`,children:e.user.name}),` `,`on`,` `,(0,J.jsx)(`a`,{href:`https://pexels.com/?utm_source=polotno&utm_medium=referral`,target:`_blank`,rel:`noreferrer noopener`,children:`Pexels`})]})})]})});function z9({title:e,onClose:t}){return(0,J.jsxs)(`div`,{className:`pn:flex pn:justify-between`,children:[(0,J.jsx)(`h3`,{className:`pn:m-0 pn:leading-[30px]`,children:e}),(0,J.jsx)(uK,{variant:`ghost`,size:`icon-sm`,onClick:t,children:(0,J.jsx)(mW,{})})]})}var y_e={width:300,height:300,fill:`lightgray`,stroke:`#0c0c0c`,strokeWidth:0,url:``},b_e=Object.keys(_b),x_e=[y_e],B9=[];b_e.forEach(e=>{x_e.forEach(t=>{B9.push({subType:e,...t})})}),B9.forEach(e=>{e.url=sb(yb(e))});var S_e=W(({store:e})=>{let t=Math.ceil(B9.length/4)||1,n=e.selectedElements.map(e=>e.id).join(`,`),r=e.openedSidePanel===`image-clip`;return x.useEffect(()=>{r&&(n||e.restoreSidePanel())},[r,n]),(0,J.jsxs)(`div`,{style:{height:`100%`,display:`flex`,flexDirection:`column`,overflow:`auto`},children:[(0,J.jsx)(z9,{title:Q(`sidePanel.clipImage`),onClose:()=>e.restoreSidePanel()}),(0,J.jsx)(`div`,{style:{height:t*110+`px`},children:(0,J.jsx)(B8,{shadowEnabled:!1,rowsNumber:4,images:B9,getPreview:e=>e.url,isLoading:!1,itemHeight:100,onSelect:async(t,n,r)=>{(r?[r]:e.selectedElements).forEach(e=>{(e.type===`image`||e.type===`video`)&&e.contentEditable&&e.set({clipSrc:t.url})})}})})]})}),C_e=W(({element:e,store:t,enabled:n})=>{let r=e.animations.find(e=>e.type===`enter`),i=e.animations.find(e=>e.type===`exit`);return n?(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`div`,{style:{padding:`10px 0px`},children:`Animate`}),(0,J.jsxs)(`div`,{style:{display:`flex`,gap:10},children:[(0,J.jsx)(uK,{variant:`outline`,className:rK(`pn:flex-1`,r?.enabled&&!i?.enabled&&`pn:bg-muted`),onClick:()=>{t.history.transaction(()=>{e.setAnimation(`enter`,{enabled:!0}),e.setAnimation(`exit`,{enabled:!1})})},children:`Enter`}),(0,J.jsx)(uK,{variant:`outline`,className:rK(`pn:flex-1`,r?.enabled&&i?.enabled&&`pn:bg-muted`),onClick:()=>{t.history.transaction(()=>{e.setAnimation(`enter`,{enabled:!0}),e.setAnimation(`exit`,{enabled:!0})})},children:`Both`}),(0,J.jsx)(uK,{variant:`outline`,className:rK(`pn:flex-1`,i?.enabled&&!r?.enabled&&`pn:bg-muted`),onClick:()=>{t.history.transaction(()=>{e.setAnimation(`enter`,{enabled:!1}),e.setAnimation(`exit`,{enabled:!0})})},children:`Exit`})]})]}):null}),w_e=[`right`,`left`,`up`,`down`,`bottom-right`,`bottom-left`,`top-right`,`top-left`],V9={right:(0,J.jsx)($,{name:`animation.directionRight`}),left:(0,J.jsx)($,{name:`animation.directionLeft`}),up:(0,J.jsx)($,{name:`animation.directionUp`}),down:(0,J.jsx)($,{name:`animation.directionDown`}),"bottom-right":(0,J.jsx)($,{name:`animation.directionBottomRight`}),"bottom-left":(0,J.jsx)($,{name:`animation.directionBottomLeft`}),"top-right":(0,J.jsx)($,{name:`animation.directionTopRight`}),"top-left":(0,J.jsx)($,{name:`animation.directionTopLeft`})},T_e=W(({value:e,onChange:t})=>(0,J.jsxs)(`div`,{style:{paddingTop:`10px`},children:[(0,J.jsx)(`div`,{style:{paddingBottom:`10px`},children:`Direction`}),(0,J.jsxs)(U6,{value:e,onValueChange:e=>{e!==null&&t(e)},children:[(0,J.jsx)(G6,{className:`pn:w-full`,children:(0,J.jsxs)(`div`,{className:`pn:flex pn:items-center pn:gap-2`,children:[V9[e],(0,J.jsx)(W6,{})]})}),(0,J.jsx)(K6,{children:w_e.map(e=>(0,J.jsx)(q6,{value:e,children:(0,J.jsxs)(`div`,{className:`pn:flex pn:items-center pn:gap-2`,children:[V9[e],e]})},e))})]})]})),E_e=W(({value:e,onChange:t})=>(0,J.jsxs)(`div`,{style:{paddingTop:`10px`},children:[(0,J.jsx)(`div`,{style:{paddingBottom:`10px`},children:`Direction`}),(0,J.jsxs)(U6,{value:e,onValueChange:e=>{e!==null&&t(e)},children:[(0,J.jsx)(G6,{className:`pn:w-full`,children:(0,J.jsx)(W6,{children:e===`out`?`Zoom Out`:`Zoom In`})}),(0,J.jsxs)(K6,{children:[(0,J.jsx)(q6,{value:`in`,children:`Zoom In`}),(0,J.jsx)(q6,{value:`out`,children:`Zoom Out`})]})]})]})),D_e=W(({element:e})=>{let t=e.animations.find(e=>e.type===`enter`);if(!t)return null;let n=e.page.duration;return(0,J.jsx)(`div`,{style:{padding:`10px`},children:(0,J.jsx)(I3,{label:`Delay`,value:parseFloat((t.delay/1e3).toFixed(2)),onChange:t=>{e.setAnimation(`enter`,{delay:t*1e3})},min:0,max:n/1e3,step:.01})})}),O_e=W(({element:e,store:t})=>{let n=e.animations.find(e=>e.type===`loop`&&e.enabled);return n?(0,J.jsx)(`div`,{style:{padding:`10px`},children:(0,J.jsx)(I3,{label:`Speed`,value:500/n.duration,onChange:t=>{e.setAnimation(`loop`,{duration:500/t})},min:.1,max:3,step:.01,onCommit:()=>{let n=t.activePage;t.play({animatedElementsIds:[e.id],currentTime:e.page.startTime}),setTimeout(()=>{t.stop(),n&&t.selectPage(n.id)},1e3)}})}):null}),k_e=W(({element:e})=>{let t=e.animations.find(e=>e.type===`enter`);if(!t)return null;let n=e.page.duration;return(0,J.jsx)(`div`,{style:{padding:`10px`},children:(0,J.jsx)(I3,{label:`Duration`,value:parseFloat((t.duration/1e3).toFixed(2)),onChange:t=>{e.setAnimation(`enter`,{duration:t*1e3}),e.setAnimation(`exit`,{duration:t*1e3})},min:0,max:n/1e3,step:.01})})}),A_e=(e,t)=>{let n;return(...r)=>{n&&clearTimeout(n),n=setTimeout(()=>{e(...r)},t)}},H9=W(({element:e,store:t,animationName:n})=>{let r=e.animations.find(e=>e.name===n&&e.enabled);if(!r)return null;let i=r.data?.strength??1,a=r=>{t.history.transaction(()=>{e.animations.forEach(t=>{if(t.name===n){let n=t.data||{};e.setAnimation(t.type,{data:{...n,strength:r}})}})});let i=t.activePage;A_e(()=>{t.isPlaying||(t.play({animatedElementsIds:[e.id],currentTime:e.page.startTime}),setTimeout(()=>{t.stop(),i&&t.selectPage(i.id)},1e3))},300)()},o=Math.max(3,i);return(0,J.jsx)(`div`,{style:{padding:`10px`},children:(0,J.jsx)(I3,{label:Q(`toolbar.strength`),value:parseFloat(i.toFixed(2)),onChange:e=>a(e),min:.1,sliderMax:o,step:.05})})}),j_e=W(({element:e})=>{let t=e.animations.find(e=>e.type===`exit`);if(!t)return null;let n=e.page.duration;return(0,J.jsx)(`div`,{style:{padding:`10px`},children:(0,J.jsx)(I3,{label:`End Delay`,value:parseFloat((t.delay/1e3).toFixed(2)),onChange:t=>{e.setAnimation(`exit`,{delay:t*1e3})},min:0,max:n/1e3,step:.01})})}),M_e=[{key:`move`,icon:`animation.typeMove`,label:`toolbar.move`},{key:`fade`,icon:`animation.typeFade`,label:`toolbar.fade`},{key:`zoom`,icon:`animation.typeZoom`,label:`toolbar.zoom`}],N_e=[{key:`rotate`,icon:`animation.typeRotate`,label:`toolbar.rotate`},{key:`blink`,icon:`animation.typeBlink`,label:`toolbar.blink`},{key:`bounce`,icon:`animation.typeBounce`,label:`toolbar.bounce`}],P_e=W(({store:e})=>{let t=e.selectedElements,n=t[0],r=n,i=t.map(e=>e.id).join(`,`),a=e.openedSidePanel===`animation`;if(x.useEffect(()=>{a&&(!n||!n.animations)&&e.restoreSidePanel()},[a,i]),!n||!n.animations)return null;let o=(r,i)=>{if(e.history.transaction(()=>{t.forEach(e=>{e.setAnimation(`enter`,{name:r,...i}),e.setAnimation(`exit`,{name:r,...i,from:i.to,to:i.from})})}),i.enabled){let r=e.activePage;e.play({animatedElementsIds:t.map(e=>e.id),currentTime:n.page.startTime}),setTimeout(()=>{e.stop(),r&&e.selectPage(r.id)},1e3)}},s=(r,i)=>{if(e.history.transaction(()=>{t.forEach(e=>{e.setAnimation(`loop`,{name:r,...i})})}),i.enabled){let r=e.activePage;e.play({animatedElementsIds:t.map(e=>e.id),currentTime:n.page.startTime}),setTimeout(()=>{e.stop(),r&&e.selectPage(r.id)},1e3)}},c=e=>!!((e?n.animations?.filter(t=>t.name===e||t.type===e):n.animations)||[]).find(e=>e.enabled),l=c(`move`)||c(`fade`)||c(`zoom`),u=c(`rotate`)||c(`blink`)||c(`bounce`);return(0,J.jsxs)(`div`,{style:{height:`100%`,display:`flex`,flexDirection:`column`,overflow:`auto`,padding:`0 10px`},children:[(0,J.jsx)(`div`,{style:{paddingBottom:`10px`},children:(0,J.jsx)(z9,{title:Q(`sidePanel.animate`),onClose:()=>e.restoreSidePanel()})}),(0,J.jsxs)(`div`,{style:{paddingTop:`10px`,lineHeight:`35px`},children:[`Animations`,` `,(0,J.jsx)(uK,{variant:`outline`,style:{marginLeft:`10px`,display:l?`inline-flex`:`none`},onClick:()=>{r.set({animations:[]})},children:`Remove All`})]}),(0,J.jsxs)(`div`,{style:{paddingTop:`25px`},children:[(0,J.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(100px, 1fr))`,gap:`5px`,paddingBottom:`10px`},children:M_e.map(({key:e,icon:t,label:n})=>(0,J.jsx)(`div`,{children:(0,J.jsxs)(uK,{variant:`outline`,size:`lg`,className:rK(`pn:flex pn:h-auto pn:w-full pn:flex-col pn:items-center pn:gap-2 pn:p-5`,c(e)&&`pn:bg-muted`),onClick:()=>{o(e,{enabled:!c(e)})},children:[(0,J.jsx)($,{name:t}),Q(n)]})},e))}),(0,J.jsxs)(`div`,{className:`pn:bg-black/5 pn:dark:bg-white/5`,style:{display:l?`block`:`none`,padding:`10px`},children:[(0,J.jsx)(C_e,{element:n,store:e,enabled:c(`enter`)||c(`exit`)}),c(`move`)&&(0,J.jsx)(T_e,{value:n.animations.find(e=>e.name===`move`)?.data?.direction||`right`,onChange:e=>{o(`move`,{data:{direction:e},enabled:!0})}}),c(`move`)&&(0,J.jsx)(H9,{store:e,element:r,animationName:`move`}),c(`zoom`)&&(0,J.jsx)(E_e,{value:n.animations.find(e=>e.name===`zoom`)?.data?.direction||`in`,onChange:e=>{o(`zoom`,{data:{direction:e},enabled:!0})}}),c(`zoom`)&&(0,J.jsx)(H9,{store:e,element:r,animationName:`zoom`}),c(`enter`)&&(0,J.jsx)(D_e,{store:e,element:r}),c(`enter`)&&(0,J.jsx)(k_e,{store:e,element:r}),c(`exit`)&&(0,J.jsx)(j_e,{store:e,element:r})]}),(0,J.jsxs)(`div`,{style:{paddingTop:`10px`,lineHeight:`35px`},children:[`Effects`,` `,(0,J.jsx)(uK,{variant:`outline`,style:{marginLeft:`10px`,display:u?`inline-flex`:`none`},onClick:()=>{r.set({animations:[]})},children:`Remove All`})]}),(0,J.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(100px, 1fr))`,gap:`5px`,paddingTop:`10px`},children:N_e.map(({key:e,icon:t,label:n})=>(0,J.jsx)(`div`,{children:(0,J.jsxs)(uK,{variant:`outline`,size:`lg`,className:rK(`pn:flex pn:h-auto pn:w-full pn:flex-col pn:items-center pn:gap-2 pn:p-5`,c(e)&&`pn:bg-muted`),onClick:()=>{s(e,{enabled:!c(e)})},children:[(0,J.jsx)($,{name:t}),Q(n)]})},e))}),u&&(0,J.jsx)(O_e,{store:e,element:r}),c(`bounce`)&&(0,J.jsx)(H9,{store:e,element:r,animationName:`bounce`})]})]})});function U9({label:e,enabled:t,onEnabledChange:n,visible:r=!0,disabled:i,className:a,children:o}){if(!r)return null;let s=n?!!t:!0;return(0,J.jsxs)(`div`,{className:rK(`pn:py-1`,a),children:[(0,J.jsxs)(`div`,{className:`pn:flex pn:items-center pn:justify-between pn:gap-2 pn:py-1`,children:[(0,J.jsx)(`label`,{className:`pn:text-sm pn:font-medium`,children:e}),n&&(0,J.jsx)(F3,{checked:!!t,onCheckedChange:n,disabled:i})]}),s&&(0,J.jsx)(`div`,{className:`pn:mt-1.5 pn:rounded-lg pn:bg-muted/60 pn:px-3 pn:py-1`,children:o})]})}var W9=({title:e,imageSrc:t,effect:n,onClick:r,active:i})=>{let a=B_e(n);return(0,J.jsxs)(`div`,{className:`pn:flex pn:flex-col pn:gap-2 pn:cursor-pointer pn:flex-grow-0 pn:w-[calc(33%-16px)]`,onClick:r,children:[(0,J.jsxs)(`div`,{className:`pn:relative pn:h-[90px] pn:rounded-[10px] pn:box-border`,children:[(0,J.jsx)(`div`,{"data-active":i?`true`:void 0,className:rK(`pn:absolute pn:-left-1 pn:-top-1 pn:-bottom-1 pn:-right-1 pn:flex pn:rounded-[15px] pn:p-[2px] pn:transition-[border] pn:duration-200 pn:border-2 pn:border-transparent`,i&&`pn:border-white`)}),(0,J.jsx)(a,{src:t})]}),(0,J.jsx)(`span`,{className:`pn:text-center`,children:e})]})},G9=({className:e,style:t,...n})=>(0,J.jsx)(`img`,{className:rK(`pn:h-full pn:w-full pn:rounded-[10px] pn:object-cover`,e),style:t,...n}),F_e=e=>(0,J.jsx)(G9,{style:{filter:`sepia(1)`},...e}),I_e=e=>(0,J.jsx)(G9,{style:{filter:`grayscale(1)`},...e}),L_e=e=>(0,J.jsx)(G9,{style:{filter:Sb(xb.warm)?.filter},...e}),R_e=e=>{let t=Sb(xb.cold),n=t?.html,r=t?.filter;return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{style:{display:`none`},dangerouslySetInnerHTML:{__html:n||``}}),(0,J.jsx)(G9,{style:{filter:r},...e})]})},z_e=e=>(0,J.jsx)(G9,{style:{filter:Sb(xb.natural)?.filter},...e}),B_e=e=>{switch(e){case xb.sepia:return F_e;case xb.grayscale:return I_e;case xb.warm:return L_e;case xb.cold:return R_e;case xb.natural:return z_e;default:return G9}},K9=(e,t,n)=>Math.max(t,Math.min(n,e)),V_e=[[`temperature`,`toolbar.temperature`],[`contrast`,`toolbar.contrast`],[`shadows`,`toolbar.shadows`],[`white`,`toolbar.white`],[`black`,`toolbar.black`],[`vibrance`,`toolbar.vibrance`],[`saturation`,`toolbar.saturation`]],q9=({store:e,color:t,onColorChange:n,value:r,onValueChange:i,min:a,max:o})=>(0,J.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,padding:`8px 0`},children:[(0,J.jsx)(l6,{value:t,size:30,gradientEnabled:!0,onChange:n,store:e}),(0,J.jsx)(`div`,{style:{flex:1,paddingLeft:`10px`,paddingRight:`10px`},children:(0,J.jsx)(j3,{value:[r],onValueChange:e=>i(K9(aK(e),a,o)),min:a,max:o,step:1})}),(0,J.jsx)(o3,{value:r,onValueChange:e=>i(K9(e,a,o)),min:a,max:o,style:{width:64}})]}),H_e=W(({store:e})=>{let t=e.selectedElements,n=t[0],r=t.map(e=>e.id).join(`,`),i=e.openedSidePanel===`effects`;if(x.useEffect(()=>{i&&(!n||!n.filters)&&e.restoreSidePanel()},[i,r]),!n||!n.filters)return null;let a=n.type===`text`,o=n.type===`image`,s=n.type===`svg`,c=o||s,l=n=>{e.history.transaction(()=>{t.forEach(e=>{e.set(n)})})},u=(n,r)=>{e.history.transaction(()=>{t.forEach(e=>{let t=Number(r);return r!=0&&!r&&(t=e.filters.has(n)?null:1),Rb.includes(n)||e.set({grayscaleEnabled:n===`grayscale`&&!!r,sepiaEnabled:n===`sepia`&&!!r}),e.setFilter(n,t)})})};return(0,J.jsxs)(`div`,{style:{height:`100%`,display:`flex`,flexDirection:`column`,overflow:`auto`,padding:`0 10px`},children:[(0,J.jsx)(z9,{title:Q(`sidePanel.effects`),onClose:()=>e.restoreSidePanel()}),c&&(0,J.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`16px`,marginTop:`16px`},children:(0,J.jsxs)(`div`,{style:{display:`flex`,gap:`16px`,flexWrap:`wrap`},children:[(0,J.jsx)(W9,{active:n.grayscaleEnabled,onClick:()=>{u(`grayscale`,!n.grayscaleEnabled)},title:Q(`toolbar.grayscale`),imageSrc:n.src,effect:xb.grayscale}),(0,J.jsx)(W9,{active:n.sepiaEnabled,onClick:()=>{u(`sepia`,!n.sepiaEnabled)},title:Q(`toolbar.sepia`),imageSrc:n.src,effect:xb.sepia}),(0,J.jsx)(W9,{active:n.filters.has(`cold`),onClick:()=>{u(`cold`,n.filters.has(`cold`)?null:1)},title:Q(`toolbar.cold`),imageSrc:n.src,effect:xb.cold}),(0,J.jsx)(W9,{active:n.filters.has(`natural`),onClick:()=>{u(`natural`,n.filters.has(`natural`)?null:1)},title:Q(`toolbar.natural`),imageSrc:n.src,effect:xb.natural}),(0,J.jsx)(W9,{active:n.filters.has(`warm`),onClick:()=>{u(`warm`,n.filters.has(`warm`)?null:1)},title:Q(`toolbar.warm`),imageSrc:n.src,effect:xb.warm})]})}),(0,J.jsx)(I3,{label:Q(`toolbar.blur`),enabled:n.blurEnabled,visible:c||a,onEnabledChange:e=>{l({blurEnabled:e})},value:n.blurRadius,onChange:e=>{l({blurRadius:e})},min:0,max:100}),(0,J.jsx)(I3,{label:Q(`toolbar.brightness`),visible:c,enabled:n.brightnessEnabled,onEnabledChange:e=>{l({brightnessEnabled:e})},value:Math.round(n.brightness*100),onChange:e=>{l({brightness:e/100})},min:-100,max:100}),V_e.map(([e,t])=>(0,J.jsx)(I3,{label:Q(t),visible:c,enabled:n.filters.has(e),onEnabledChange:t=>{u(e,t?0:null)},value:Math.round((n.filters.get(e)?.intensity??0)*100),onChange:t=>{u(e,t/100)},min:-100,max:100},e)),a&&(0,J.jsxs)(U9,{label:Q(`toolbar.curvedText`)||`Curved text`,enabled:!!n.curveEnabled,onEnabledChange:e=>l({curveEnabled:e}),children:[(0,J.jsx)(N8,{label:Q(`toolbar.curvePower`)||`Curve`,className:`pn:py-2`,children:(0,J.jsx)(o3,{value:Math.round(n.curvePower*100),onValueChange:e=>{l({curvePower:K9(e,-100,100)/100})},style:{width:64},min:-100,max:100})}),(0,J.jsx)(Epe,{textEl:n,eachSet:l})]}),a&&(0,J.jsx)(U9,{label:Q(`toolbar.textStroke`),enabled:!!n.strokeWidth,onEnabledChange:e=>l({strokeWidth:e?2:0}),children:(0,J.jsx)(q9,{store:e,color:n.stroke,onColorChange:e=>{l({stroke:e})},value:n.strokeWidth,onValueChange:e=>{l({strokeWidth:e})},min:1,max:Math.max(1,Math.round(n.fontSize/2))})}),a&&(0,J.jsxs)(U9,{label:Q(`toolbar.textBackground`),enabled:!!n.backgroundEnabled,onEnabledChange:e=>l({backgroundEnabled:e}),children:[(0,J.jsx)(I3,{label:Q(`toolbar.backgroundCornerRadius`),value:Math.round(n.backgroundCornerRadius*100),onChange:e=>l({backgroundCornerRadius:e/100}),min:0,max:100}),(0,J.jsx)(I3,{label:Q(`toolbar.backgroundPadding`),value:Math.round(n.backgroundPadding*100),onChange:e=>l({backgroundPadding:e/100}),min:0,max:100}),(0,J.jsx)(I3,{label:Q(`toolbar.opacity`),value:Math.round(n.backgroundOpacity*100),onChange:e=>l({backgroundOpacity:e/100}),min:0,max:100}),(0,J.jsx)(N8,{label:Q(`toolbar.color`),className:`pn:py-2`,children:(0,J.jsx)(l6,{value:n.backgroundColor,size:30,onChange:e=>{l({backgroundColor:e})},store:e})})]}),c&&(0,J.jsx)(U9,{label:Q(`toolbar.border`),enabled:!!n.borderSize,onEnabledChange:e=>l({borderSize:e?2:0}),children:(0,J.jsx)(q9,{store:e,color:n.borderColor,onColorChange:e=>{l({borderColor:e})},value:n.borderSize,onValueChange:e=>{l({borderSize:e})},min:1,max:Math.max(1,Math.round(Math.min(n.width,n.height)/2))})}),c&&(0,J.jsx)(I3,{label:Q(`toolbar.cornerRadius`),visible:c,enabled:n.cornerRadius!==0,onEnabledChange:e=>{l({cornerRadius:e?Math.min(n.width/4,n.height/4):0})},value:Math.min(n.cornerRadius,Math.round(Math.min(n.width/2,n.height/2))),onChange:e=>{l({cornerRadius:e})},min:1,max:Math.round(Math.min(n.width/2,n.height/2))}),(0,J.jsxs)(U9,{label:Q(`toolbar.shadow`),enabled:n.shadowEnabled,onEnabledChange:e=>l({shadowEnabled:e}),children:[(0,J.jsx)(I3,{label:Q(`toolbar.blur`),value:n.shadowBlur,onChange:e=>{l({shadowBlur:e})},min:0,max:50}),(0,J.jsx)(I3,{label:Q(`toolbar.offsetX`),value:n.shadowOffsetX,onChange:e=>{l({shadowOffsetX:e})},min:-50,max:50}),(0,J.jsx)(I3,{label:Q(`toolbar.offsetY`),value:n.shadowOffsetY,onChange:e=>{l({shadowOffsetY:e})},min:-50,max:50}),(0,J.jsx)(I3,{label:Q(`toolbar.opacity`),value:Math.round(n.shadowOpacity*100),onChange:e=>{l({shadowOpacity:e/100})},min:0,max:100}),(0,J.jsx)(N8,{label:Q(`toolbar.color`),className:`pn:py-2`,children:(0,J.jsx)(l6,{value:n.shadowColor,size:30,onChange:e=>{l({shadowColor:e})},store:e})})]})]})}),U_e={name:`templates`,Tab:W(e=>(0,J.jsx)(z8,{name:Q(`sidePanel.templates`),...e,children:(0,J.jsx)($,{name:`sidePanel.templates`})})),Panel:({store:e})=>(0,J.jsx)(qhe,{store:e})},J9={name:`text`,Tab:W(e=>(0,J.jsx)(z8,{name:Q(`sidePanel.text`),...e,children:(0,J.jsx)($,{name:`sidePanel.text`})})),Panel:({store:e})=>(0,J.jsx)(Qhe,{store:e})},W_e={name:`photos`,Tab:W(e=>(0,J.jsx)(z8,{name:Q(`sidePanel.photos`),...e,children:(0,J.jsx)($,{name:`sidePanel.photos`})})),Panel:({store:e})=>(0,J.jsx)($he,{store:e})},G_e={name:`elements`,Tab:W(e=>(0,J.jsx)(z8,{name:Q(`sidePanel.elements`),iconSize:16,...e,children:(0,J.jsx)($,{name:`sidePanel.elements`})})),Panel:({store:e})=>(0,J.jsx)(dge,{store:e})},K_e={name:`upload`,Tab:W(e=>(0,J.jsx)(z8,{name:Q(`sidePanel.upload`),...e,children:(0,J.jsx)($,{name:`sidePanel.upload`})})),Panel:({store:e})=>(0,J.jsx)(_ge,{store:e})},q_e={name:`background`,Tab:W(e=>(0,J.jsx)(z8,{name:Q(`sidePanel.background`),...e,children:(0,J.jsx)($,{name:`sidePanel.background`})})),Panel:({store:e})=>(0,J.jsx)(yge,{store:e})};W(e=>(0,J.jsx)(z8,{name:Q(`sidePanel.pages`),...e,children:(0,J.jsx)($,{name:`sidePanel.pages`})}));var J_e={name:`layers`,Tab:W(e=>(0,J.jsx)(z8,{name:Q(`sidePanel.layers`),...e,children:(0,J.jsx)($,{name:`sidePanel.layers`})})),Panel:({store:e})=>(0,J.jsx)(r_e,{store:e})},Y_e={name:`size`,Tab:W(e=>(0,J.jsx)(z8,{name:Q(`sidePanel.resize`),...e,children:(0,J.jsx)($,{name:`sidePanel.resize`})})),Panel:({store:e})=>(0,J.jsx)(s_e,{store:e})},X_e={name:`draw`,Tab:W(e=>(0,J.jsx)(z8,{name:Q(`sidePanel.draw`),...e,children:(0,J.jsx)($,{name:`sidePanel.draw`})})),Panel:({store:e})=>(0,J.jsx)(p_e,{store:e})},Z_e={name:`videos`,Tab:e=>(0,J.jsx)(z8,{name:Q(`sidePanel.videos`),...e,children:(0,J.jsx)($,{name:`sidePanel.videos`})}),Panel:v_e},Y9=[U_e,J9,W_e,G_e,X_e,K_e,q_e,J_e,Y_e],Q_e={name:`image-clip`,Tab:()=>null,Panel:S_e},$_e={name:`effects`,Tab:()=>null,Panel:H_e},eve={name:`animation`,Tab:()=>null,Panel:P_e},tve=[Q_e,$_e],nve=e=>{let t=x.useRef(!0);t.current&&(t.current=!1,e())},rve=({onClick:e})=>(0,J.jsxs)(`div`,{className:`pn-side-panel-hide-button pn:absolute pn:right-[-14px] pn:top-1/2 pn:z-10 pn:h-24 pn:w-[15px] pn:cursor-pointer pn:max-md:hidden pn:pn-mobile:hidden`,onClick:e,children:[(0,J.jsx)(`svg`,{width:`15`,height:`96`,viewBox:`0 0 16 96`,xmlns:`http://www.w3.org/2000/svg`,children:(0,J.jsx)(`path`,{className:`pn:stroke-border pn:fill-background`,d:`M 1 7 C 2 9 4 10 7.2 13.28 C 7.45 13.4625 7.6 13.6 7.7 13.8048 L 7.8 13.8 C 9.8 15.8 11.6 17.6 12.9 19.7 C 14 21.6 14.7 23.9 14.9 27 H 15 V 68 C 15 71.7 14.3 74.3 13 76.6 C 11.7 78.8 9.9 80.5 7.8 82.6344 L 7.79 82.6 C 7.6 82.8 7.4507 83 7.2729 83.2127 C 3.9102 86.5228 2 87 1 90`})}),(0,J.jsx)(`div`,{className:`pn:absolute pn:left-1/2 pn:top-1/2 pn:text-[0.5rem] pn:text-muted-foreground pn:hover:text-foreground`,style:{transform:`translate(-50%, -50%) scaleY(2)`},children:`<`})]}),X9=W(({store:e,sections:t,defaultSection:n=`photos`})=>{nve(()=>{e.openSidePanel(n)});let r=DS();x.useLayoutEffect(()=>{r?e.openSidePanel(``):e.openSidePanel(n)},[r]);let i=[...t||Y9];if(tve.forEach(e=>{i.find(t=>t.name===e.name)||i.push(e)}),n_.animationsEnabled){if(!i.find(e=>e.name===`videos`)){let e=Math.floor(i.length/2);i.splice(e,0,Z_e)}if(!i.find(e=>e.name===`animations`)){let e=Math.floor(i.length/2);i.splice(e,0,eve)}}let a=i.filter(e=>e.visibleInList??!0),o=t=>{let n=t.target,i=n.closest(`.polotno-close-panel`),a=n.closest(`.polotno-mobile`);i&&(r||a)&&e.openSidePanel(``)},s=x.useRef(null),c=x.useRef(null),l=x.useRef(new Set);return e.openedSidePanel&&l.current.add(e.openedSidePanel),(0,J.jsx)(U1,{elementRef:c,children:(0,J.jsxs)(`div`,{ref:c,className:rK(`polotno-side-panel pn-side-panel pn:relative pn:flex pn:h-full pn:bg-background pn:p-0 pn:text-foreground`,`pn:md:border-r pn:md:border-border`,`pn:max-md:h-auto pn:max-md:w-full pn:pn-mobile:h-auto pn:pn-mobile:w-full`,`pn:max-md:border-t pn:max-md:border-border pn:pn-mobile:border-t pn:pn-mobile:border-border`,!e.openedSidePanel&&`collapsed`),children:[(0,J.jsx)(`div`,{ref:s,className:rK(`polotno-side-tabs-container pn:bg-background pn:max-md:w-full pn:max-md:overflow-auto pn:pn-mobile:w-full pn:pn-mobile:overflow-auto pn:md:overflow-y-auto pn:md:overflow-x-hidden pn:md:min-w-[72px]`,e.openedSidePanel&&`pn:md:border-r pn:md:border-border`),children:(0,J.jsx)(`div`,{className:`polotno-side-tabs-inner pn:flex pn:flex-col pn:max-md:flex-row pn:max-md:min-w-min pn:pn-mobile:flex-row pn:pn-mobile:min-w-min`,children:a.map(({name:t,Tab:n})=>(0,J.jsx)(n,{active:t===e.openedSidePanel,onClick:()=>{if(t===e.openedSidePanel&&r){e.openSidePanel(``);return}e.openSidePanel(t)}},t))})}),i.map(({name:t,Panel:n})=>l.current.has(t)&&(0,J.jsx)(`div`,{className:rK(`polotno-panel-container pn-side-panel-content pn:h-full pn:px-2.5 pn:pt-2.5`,`pn:w-[var(--pn-sidebar-width,350px)]`,!e.openedSidePanel&&`pn:w-0`,t!==e.openedSidePanel&&`pn:hidden`,`pn:max-md:absolute pn:max-md:bottom-[54px] pn:max-md:z-[100] pn:max-md:!h-[50vh] pn:max-md:w-full pn:max-md:bg-background`,`pn:pn-mobile:absolute pn:pn-mobile:bottom-[54px] pn:pn-mobile:z-[100] pn:pn-mobile:!h-[50vh] pn:pn-mobile:w-full pn:pn-mobile:bg-background`),onClick:o,children:(0,J.jsx)(n,{store:e})},t)),e.openedSidePanel&&r&&(0,J.jsx)(`div`,{className:`polotno-close-panel`,style:{position:`absolute`,left:0,bottom:`72px`,width:`100vw`,height:`100vh`,zIndex:99,backgroundColor:`rgba(0,0,0,0.05)`},onClick:()=>e.openSidePanel(``)}),e.openedSidePanel&&(0,J.jsx)(rve,{onClick:()=>e.openSidePanel(``)})]})})});X9.displayName=`SidePanel`;var ive=cK(`pn:h-[35px] pn:rounded-md pn:bg-background pn:shadow-md`),Z9=1.2,Q9=[.1,.25,.5,.75,1,1.5,2,3,5],ave=Q9[Q9.length-1],ove=Q9[0],sve=W(({store:e})=>{let t=Math.max(ave,e.scaleToFit),n=Math.min(ove,e.scaleToFit),r=e.scale<t;return(0,J.jsxs)(`div`,{className:`pn:flex pn:h-[35px] pn:items-center`,children:[(0,J.jsx)(uK,{variant:`ghost`,size:`icon-sm`,onClick:()=>{e.setScale(e.scale/Z9)},disabled:!(e.scale>n),"aria-label":`Zoom out`,children:(0,J.jsx)($,{name:`toolbar.zoomOut`,className:`pn:size-4`})}),(0,J.jsxs)(j0,{children:[(0,J.jsx)(M0,{render:(0,J.jsx)(uK,{variant:`ghost`,size:`sm`,"aria-label":`Zoom level`,children:Math.round(e.scale*100)+`%`})}),(0,J.jsx)(N0,{className:`pn:w-auto pn:min-w-[80px] pn:p-1`,children:(0,J.jsxs)(`div`,{className:`pn:flex pn:flex-col`,children:[Q9.map(t=>(0,J.jsx)(uK,{variant:`ghost`,size:`sm`,className:`pn:justify-start`,onClick:async()=>{e.setScale(t)},children:Math.round(t*100)+`%`},t)),(0,J.jsx)(uK,{variant:`ghost`,size:`sm`,className:`pn:justify-start`,onClick:async()=>{e.setScale(e.scaleToFit)},children:Q(`scale.reset`)})]})})]}),(0,J.jsx)(uK,{variant:`ghost`,size:`icon-sm`,onClick:()=>{e.setScale(e.scale*Z9)},disabled:!r,"aria-label":`Zoom in`,children:(0,J.jsx)($,{name:`toolbar.zoomIn`,className:`pn:size-4`})})]})}),cve=W(({store:e})=>(0,J.jsx)(`div`,{className:`pn:relative pn:h-0`,children:(0,J.jsx)(`div`,{className:rK(ive(),`pn:absolute pn:bottom-[5px] pn:left-1/2 pn:-translate-x-1/2 pn:overflow-hidden pn:max-md:hidden`),children:(0,J.jsx)(`div`,{className:`pn:flex pn:h-full pn:items-center pn:px-[5px]`,children:(0,J.jsx)(sve,{store:e})})})})),lve=JM(`div`)`
724
724
  display: flex;
725
725
  height: 100%;
726
726
  width: 100%;