setta 0.0.5.dev0__py3-none-any.whl → 0.0.5.dev1__py3-none-any.whl

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.
@@ -348,12 +348,12 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
348
348
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function kfe(t,e){if(t){if(typeof t=="string")return yA(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return yA(t,e)}}function yA(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Prt(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r=[],i=!0,s=!1,o,a;try{for(n=n.call(t);!(i=(o=n.next()).done)&&(r.push(o.value),!(e&&r.length===e));i=!0);}catch(l){s=!0,a=l}finally{try{!i&&n.return!=null&&n.return()}finally{if(s)throw a}}return r}}function Art(t){if(Array.isArray(t))return t}function Kq(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function cr(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Kq(Object(n),!0).forEach(function(r){bA(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Kq(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function bA(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function h4(t,e){if(t==null)return{};var n=Rrt(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Rrt(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var pD=_.forwardRef(function(t,e){var n=t.children,r=h4(t,brt),i=Efe(r),s=i.open,o=h4(i,xrt);return _.useImperativeHandle(e,function(){return{open:s}},[s]),ke.createElement(_.Fragment,null,n(cr(cr({},o),{},{open:s})))});pD.displayName="Dropzone";var Cfe={disabled:!1,getFilesFromEvent:Wnt,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!1,autoFocus:!1};pD.defaultProps=Cfe;pD.propTypes={children:Be.func,accept:Be.objectOf(Be.arrayOf(Be.string)),multiple:Be.bool,preventDropOnDocument:Be.bool,noClick:Be.bool,noKeyboard:Be.bool,noDrag:Be.bool,noDragEventsBubbling:Be.bool,minSize:Be.number,maxSize:Be.number,maxFiles:Be.number,disabled:Be.bool,getFilesFromEvent:Be.func,onFileDialogCancel:Be.func,onFileDialogOpen:Be.func,useFsAccessApi:Be.bool,autoFocus:Be.bool,onDragEnter:Be.func,onDragLeave:Be.func,onDragOver:Be.func,onDrop:Be.func,onDropAccepted:Be.func,onDropRejected:Be.func,onError:Be.func,validator:Be.func};var xA={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function Efe(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=cr(cr({},Cfe),t),n=e.accept,r=e.disabled,i=e.getFilesFromEvent,s=e.maxSize,o=e.minSize,a=e.multiple,l=e.maxFiles,c=e.onDragEnter,u=e.onDragLeave,f=e.onDragOver,h=e.onDrop,d=e.onDropAccepted,p=e.onDropRejected,g=e.onFileDialogCancel,m=e.onFileDialogOpen,v=e.useFsAccessApi,y=e.autoFocus,b=e.preventDropOnDocument,S=e.noClick,k=e.noKeyboard,E=e.noDrag,T=e.noDragEventsBubbling,C=e.onError,A=e.validator,R=_.useMemo(function(){return vrt(n)},[n]),Q=_.useMemo(function(){return grt(n)},[n]),L=_.useMemo(function(){return typeof m=="function"?m:Jq},[m]),z=_.useMemo(function(){return typeof g=="function"?g:Jq},[g]),B=_.useRef(null),q=_.useRef(null),Z=_.useReducer($rt,xA),J=B7(Z,2),I=J[0],j=J[1],M=I.isFocused,X=I.isFileDialogActive,se=_.useRef(typeof window<"u"&&window.isSecureContext&&v&&mrt()),H=function(){!se.current&&X&&setTimeout(function(){if(q.current){var Ce=q.current.files;Ce.length||(j({type:"closeDialog"}),z())}},300)};_.useEffect(function(){return window.addEventListener("focus",H,!1),function(){window.removeEventListener("focus",H,!1)}},[q,X,z,se]);var de=_.useRef([]),fe=function(Ce){B.current&&B.current.contains(Ce.target)||(Ce.preventDefault(),de.current=[])};_.useEffect(function(){return b&&(document.addEventListener("dragover",Gq,!1),document.addEventListener("drop",fe,!1)),function(){b&&(document.removeEventListener("dragover",Gq),document.removeEventListener("drop",fe))}},[B,b]),_.useEffect(function(){return!r&&y&&B.current&&B.current.focus(),function(){}},[B,y,r]);var ve=_.useCallback(function(we){C?C(we):console.error(we)},[C]),F=_.useCallback(function(we){we.preventDefault(),we.persist(),Re(we),de.current=[].concat(_rt(de.current),[we.target]),_w(we)&&Promise.resolve(i(we)).then(function(Ce){if(!(f4(we)&&!T)){var ue=Ce.length,Se=ue>0&&frt({files:Ce,accept:R,minSize:o,maxSize:s,multiple:a,maxFiles:l,validator:A}),Ae=ue>0&&!Se;j({isDragAccept:Se,isDragReject:Ae,isDragActive:!0,type:"setDraggedFiles"}),c&&c(we)}}).catch(function(Ce){return ve(Ce)})},[i,c,ve,T,R,o,s,a,l,A]),oe=_.useCallback(function(we){we.preventDefault(),we.persist(),Re(we);var Ce=_w(we);if(Ce&&we.dataTransfer)try{we.dataTransfer.dropEffect="copy"}catch{}return Ce&&f&&f(we),!1},[f,T]),le=_.useCallback(function(we){we.preventDefault(),we.persist(),Re(we);var Ce=de.current.filter(function(Se){return B.current&&B.current.contains(Se)}),ue=Ce.indexOf(we.target);ue!==-1&&Ce.splice(ue,1),de.current=Ce,!(Ce.length>0)&&(j({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),_w(we)&&u&&u(we))},[B,u,T]),pe=_.useCallback(function(we,Ce){var ue=[],Se=[];we.forEach(function(Ae){var et=xfe(Ae,R),ot=B7(et,2),$t=ot[0],Ct=ot[1],kn=wfe(Ae,o,s),_r=B7(kn,2),gr=_r[0],Cn=_r[1],Jt=A?A(Ae):null;if($t&&gr&&!Jt)ue.push(Ae);else{var Tt=[Ct,Cn];Jt&&(Tt=Tt.concat(Jt)),Se.push({file:Ae,errors:Tt.filter(function(Fn){return Fn})})}}),(!a&&ue.length>1||a&&l>=1&&ue.length>l)&&(ue.forEach(function(Ae){Se.push({file:Ae,errors:[urt]})}),ue.splice(0)),j({acceptedFiles:ue,fileRejections:Se,type:"setFiles"}),h&&h(ue,Se,Ce),Se.length>0&&p&&p(Se,Ce),ue.length>0&&d&&d(ue,Ce)},[j,a,R,o,s,l,h,d,p,A]),De=_.useCallback(function(we){we.preventDefault(),we.persist(),Re(we),de.current=[],_w(we)&&Promise.resolve(i(we)).then(function(Ce){f4(we)&&!T||pe(Ce,we)}).catch(function(Ce){return ve(Ce)}),j({type:"reset"})},[i,pe,ve,T]),xe=_.useCallback(function(){if(se.current){j({type:"openDialog"}),L();var we={multiple:a,types:Q};window.showOpenFilePicker(we).then(function(Ce){return i(Ce)}).then(function(Ce){pe(Ce,null),j({type:"closeDialog"})}).catch(function(Ce){Ort(Ce)?(z(Ce),j({type:"closeDialog"})):yrt(Ce)?(se.current=!1,q.current?(q.current.value=null,q.current.click()):ve(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no <input> was provided."))):ve(Ce)});return}q.current&&(j({type:"openDialog"}),L(),q.current.value=null,q.current.click())},[j,L,z,v,pe,ve,Q,a]),je=_.useCallback(function(we){!B.current||!B.current.isEqualNode(we.target)||(we.key===" "||we.key==="Enter"||we.keyCode===32||we.keyCode===13)&&(we.preventDefault(),xe())},[B,xe]),He=_.useCallback(function(){j({type:"focus"})},[]),nt=_.useCallback(function(){j({type:"blur"})},[]),xt=_.useCallback(function(){S||(prt()?setTimeout(xe,0):xe())},[S,xe]),Ze=function(Ce){return r?null:Ce},Oe=function(Ce){return k?null:Ze(Ce)},be=function(Ce){return E?null:Ze(Ce)},Re=function(Ce){T&&Ce.stopPropagation()},Ke=_.useMemo(function(){return function(){var we=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},Ce=we.refKey,ue=Ce===void 0?"ref":Ce,Se=we.role,Ae=we.onKeyDown,et=we.onFocus,ot=we.onBlur,$t=we.onClick,Ct=we.onDragEnter,kn=we.onDragOver,_r=we.onDragLeave,gr=we.onDrop,Cn=h4(we,wrt);return cr(cr(bA({onKeyDown:Oe(Ja(Ae,je)),onFocus:Oe(Ja(et,He)),onBlur:Oe(Ja(ot,nt)),onClick:Ze(Ja($t,xt)),onDragEnter:be(Ja(Ct,F)),onDragOver:be(Ja(kn,oe)),onDragLeave:be(Ja(_r,le)),onDrop:be(Ja(gr,De)),role:typeof Se=="string"&&Se!==""?Se:"presentation"},ue,B),!r&&!k?{tabIndex:0}:{}),Cn)}},[B,je,He,nt,xt,F,oe,le,De,k,E,r]),ze=_.useCallback(function(we){we.stopPropagation()},[]),Ye=_.useMemo(function(){return function(){var we=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},Ce=we.refKey,ue=Ce===void 0?"ref":Ce,Se=we.onChange,Ae=we.onClick,et=h4(we,Srt),ot=bA({accept:R,multiple:a,type:"file",style:{display:"none"},onChange:Ze(Ja(Se,De)),onClick:Ze(Ja(Ae,ze)),tabIndex:-1},ue,q);return cr(cr({},ot),et)}},[q,n,a,De,r]);return cr(cr({},I),{},{isFocused:M&&!r,getRootProps:Ke,getInputProps:Ye,rootRef:B,inputRef:q,open:Ze(xe)})}function $rt(t,e){switch(e.type){case"focus":return cr(cr({},t),{},{isFocused:!0});case"blur":return cr(cr({},t),{},{isFocused:!1});case"openDialog":return cr(cr({},xA),{},{isFileDialogActive:!0});case"closeDialog":return cr(cr({},t),{},{isFileDialogActive:!1});case"setDraggedFiles":return cr(cr({},t),{},{isDragActive:e.isDragActive,isDragAccept:e.isDragAccept,isDragReject:e.isDragReject});case"setFiles":return cr(cr({},t),{},{acceptedFiles:e.acceptedFiles,fileRejections:e.fileRejections});case"reset":return cr({},xA);default:return t}}function Jq(){}function Tfe(t,e,n){const r=fi(i=>{var o;const s={};for(const a of e)(o=i.x[a])!=null&&o.value&&(s[a]=n(i.x[a]));return s},ae.isEqual);return zy(()=>{const i=new AbortController,s=[];for(const o of e)o in r||s.push(o);return s.length>0&&PAe(t,s,i.signal),()=>{i.abort()}},[e]),r}function Mrt(t){const{artifactIds:e,activeLayer:n,allLayersMetadata:r,size:i,canvasSettings:s}=te(l=>{const c=W3(t,l),u=l.x[t].canvasSettings,f=l.artifactGroups[u.activeLayerId],h=mD(t,l);return{activeLayer:f,artifactIds:c,allLayersMetadata:h,size:l.x[t].size,canvasSettings:u}},ae.isEqual),o=Tfe(t,e,l=>ae.pick(l,["type"])),a=[];for(const l of r)a.push(...l.artifactIdsUsed.filter(c=>c in o)),delete l.artifactIdsUsed;return{activeLayer:n,allLayersMetadata:r,size:i,canvasSettings:s,loadedArtifacts:o,loadedArtifactIdsWithDuplicates:a}}function Pfe(t,e){const n=te(r=>W3(t,r),ae.isEqual);return Tfe(t,n,e)}function mD(t,e){const{artifactGroupIds:n}=e.x[t],r=[];for(const i of n){const s={id:i,...e.artifactGroups[i]};s.artifactIdsUsed=s.artifactTransforms.map(o=>o.artifactId),delete s.artifactTransforms,r.push(s)}return r}function W3(t,e){const n=new Set;for(const r of e.x[t].artifactGroupIds)for(const i of e.artifactGroups[r].artifactTransforms)n.add(i.artifactId);return n}function gD(t,e,n){const r=_.useCallback(i=>{i.forEach(s=>{const o=new FileReader;o.onload=async()=>{const a=await RAe(n,o.result);await Dte({sectionId:t,createNewArtifactGroup:e,value:a,artifactType:n})},o.onerror=a=>{console.error("Error reading file:",a)},o.readAsDataURL(s)})},[t,e]);return Efe({onDrop:r})}const Afe="Collapsible",[Irt,Rfe]=Oo(Afe),[Drt,vD]=Irt(Afe),Lrt=_.forwardRef((t,e)=>{const{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:s,onOpenChange:o,...a}=t,[l=!1,c]=Nl({prop:r,defaultProp:i,onChange:o});return _.createElement(Drt,{scope:n,disabled:s,contentId:ff(),open:l,onOpenToggle:_.useCallback(()=>c(u=>!u),[c])},_.createElement(gn.div,Ee({"data-state":OD(l),"data-disabled":s?"":void 0},a,{ref:e})))}),Nrt="CollapsibleTrigger",Qrt=_.forwardRef((t,e)=>{const{__scopeCollapsible:n,...r}=t,i=vD(Nrt,n);return _.createElement(gn.button,Ee({type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":OD(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled},r,{ref:e,onClick:gt(t.onClick,i.onOpenToggle)}))}),$fe="CollapsibleContent",jrt=_.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=vD($fe,t.__scopeCollapsible);return _.createElement(zd,{present:n||i.open},({present:s})=>_.createElement(Brt,Ee({},r,{ref:e,present:s})))}),Brt=_.forwardRef((t,e)=>{const{__scopeCollapsible:n,present:r,children:i,...s}=t,o=vD($fe,n),[a,l]=_.useState(r),c=_.useRef(null),u=In(e,c),f=_.useRef(0),h=f.current,d=_.useRef(0),p=d.current,g=o.open||a,m=_.useRef(g),v=_.useRef();return _.useEffect(()=>{const y=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(y)},[]),Pc(()=>{const y=c.current;if(y){v.current=v.current||{transitionDuration:y.style.transitionDuration,animationName:y.style.animationName},y.style.transitionDuration="0s",y.style.animationName="none";const b=y.getBoundingClientRect();f.current=b.height,d.current=b.width,m.current||(y.style.transitionDuration=v.current.transitionDuration,y.style.animationName=v.current.animationName),l(r)}},[o.open,r]),_.createElement(gn.div,Ee({"data-state":OD(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!g},s,{ref:u,style:{["--radix-collapsible-content-height"]:h?`${h}px`:void 0,["--radix-collapsible-content-width"]:p?`${p}px`:void 0,...t.style}}),g&&i)});function OD(t){return t?"open":"closed"}const zrt=Lrt,Frt=Qrt,Wrt=jrt,Gf="Accordion",Vrt=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[yD,Urt,qrt]=Zm(Gf),[V3,bEt]=Oo(Gf,[qrt,Rfe]),bD=Rfe(),Mfe=ke.forwardRef((t,e)=>{const{type:n,...r}=t,i=r,s=r;return ke.createElement(yD.Provider,{scope:t.__scopeAccordion},n==="multiple"?ke.createElement(Yrt,Ee({},s,{ref:e})):ke.createElement(Zrt,Ee({},i,{ref:e})))});Mfe.propTypes={type(t){const e=t.value||t.defaultValue;return t.type&&!["single","multiple"].includes(t.type)?new Error("Invalid prop `type` supplied to `Accordion`. Expected one of `single | multiple`."):t.type==="multiple"&&typeof e=="string"?new Error("Invalid prop `type` supplied to `Accordion`. Expected `single` when `defaultValue` or `value` is type `string`."):t.type==="single"&&Array.isArray(e)?new Error("Invalid prop `type` supplied to `Accordion`. Expected `multiple` when `defaultValue` or `value` is type `string[]`."):null}};const[Ife,Xrt]=V3(Gf),[Dfe,Hrt]=V3(Gf,{collapsible:!1}),Zrt=ke.forwardRef((t,e)=>{const{value:n,defaultValue:r,onValueChange:i=()=>{},collapsible:s=!1,...o}=t,[a,l]=Nl({prop:n,defaultProp:r,onChange:i});return ke.createElement(Ife,{scope:t.__scopeAccordion,value:a?[a]:[],onItemOpen:l,onItemClose:ke.useCallback(()=>s&&l(""),[s,l])},ke.createElement(Dfe,{scope:t.__scopeAccordion,collapsible:s},ke.createElement(Lfe,Ee({},o,{ref:e}))))}),Yrt=ke.forwardRef((t,e)=>{const{value:n,defaultValue:r,onValueChange:i=()=>{},...s}=t,[o=[],a]=Nl({prop:n,defaultProp:r,onChange:i}),l=ke.useCallback(u=>a((f=[])=>[...f,u]),[a]),c=ke.useCallback(u=>a((f=[])=>f.filter(h=>h!==u)),[a]);return ke.createElement(Ife,{scope:t.__scopeAccordion,value:o,onItemOpen:l,onItemClose:c},ke.createElement(Dfe,{scope:t.__scopeAccordion,collapsible:!0},ke.createElement(Lfe,Ee({},s,{ref:e}))))}),[Grt,U3]=V3(Gf),Lfe=ke.forwardRef((t,e)=>{const{__scopeAccordion:n,disabled:r,dir:i,orientation:s="vertical",...o}=t,a=ke.useRef(null),l=In(a,e),c=Urt(n),f=jd(i)==="ltr",h=gt(t.onKeyDown,d=>{var p;if(!Vrt.includes(d.key))return;const g=d.target,m=c().filter(A=>{var R;return!((R=A.ref.current)!==null&&R!==void 0&&R.disabled)}),v=m.findIndex(A=>A.ref.current===g),y=m.length;if(v===-1)return;d.preventDefault();let b=v;const S=0,k=y-1,E=()=>{b=v+1,b>k&&(b=S)},T=()=>{b=v-1,b<S&&(b=k)};switch(d.key){case"Home":b=S;break;case"End":b=k;break;case"ArrowRight":s==="horizontal"&&(f?E():T());break;case"ArrowDown":s==="vertical"&&E();break;case"ArrowLeft":s==="horizontal"&&(f?T():E());break;case"ArrowUp":s==="vertical"&&T();break}const C=b%y;(p=m[C].ref.current)===null||p===void 0||p.focus()});return ke.createElement(Grt,{scope:n,disabled:r,direction:i,orientation:s},ke.createElement(yD.Slot,{scope:n},ke.createElement(gn.div,Ee({},o,{"data-orientation":s,ref:l,onKeyDown:r?void 0:h}))))}),wA="AccordionItem",[Krt,xD]=V3(wA),Jrt=ke.forwardRef((t,e)=>{const{__scopeAccordion:n,value:r,...i}=t,s=U3(wA,n),o=Xrt(wA,n),a=bD(n),l=ff(),c=r&&o.value.includes(r)||!1,u=s.disabled||t.disabled;return ke.createElement(Krt,{scope:n,open:c,disabled:u,triggerId:l},ke.createElement(zrt,Ee({"data-orientation":s.orientation,"data-state":c?"open":"closed"},a,i,{ref:e,disabled:u,open:c,onOpenChange:f=>{f?o.onItemOpen(r):o.onItemClose(r)}})))}),eit="AccordionHeader",tit=ke.forwardRef((t,e)=>{const{__scopeAccordion:n,...r}=t,i=U3(Gf,n),s=xD(eit,n);return ke.createElement(gn.h3,Ee({"data-orientation":i.orientation,"data-state":sit(s.open),"data-disabled":s.disabled?"":void 0},r,{ref:e}))}),eX="AccordionTrigger",nit=ke.forwardRef((t,e)=>{const{__scopeAccordion:n,...r}=t,i=U3(Gf,n),s=xD(eX,n),o=Hrt(eX,n),a=bD(n);return ke.createElement(yD.ItemSlot,{scope:n},ke.createElement(Frt,Ee({"aria-disabled":s.open&&!o.collapsible||void 0,"data-orientation":i.orientation,id:s.triggerId},a,r,{ref:e})))}),rit="AccordionContent",iit=ke.forwardRef((t,e)=>{const{__scopeAccordion:n,...r}=t,i=U3(Gf,n),s=xD(rit,n),o=bD(n);return ke.createElement(Wrt,Ee({role:"region","aria-labelledby":s.triggerId,"data-orientation":i.orientation},o,r,{ref:e,style:{["--radix-accordion-content-height"]:"var(--radix-collapsible-content-height)",["--radix-accordion-content-width"]:"var(--radix-collapsible-content-width)",...t.style}}))});function sit(t){return t?"open":"closed"}const wD=Mfe,q3=Jrt,Nfe=tit,X3=nit,IO=iit;function oit(t){return ft({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M64 32C28.7 32 0 60.7 0 96V416c0 35.3 28.7 64 64 64H384c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64H64zm297.1 84L257.3 234.6 379.4 396H283.8L209 298.1 123.3 396H75.8l111-126.9L69.7 116h98l67.7 89.5L313.6 116h47.5zM323.3 367.6L153.4 142.9H125.1L296.9 367.6h26.3z"},child:[]}]})(t)}function ait(t){return ft({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M304 240V16.6c0-9 7-16.6 16-16.6C443.7 0 544 100.3 544 224c0 9-7.6 16-16.6 16H304zM32 272C32 150.7 122.1 50.3 239 34.3c9.2-1.3 17 6.1 17 15.4V288L412.5 444.5c6.7 6.7 6.2 17.7-1.5 23.1C371.8 495.6 323.8 512 272 512C139.5 512 32 404.6 32 272zm526.4 16c9.3 0 16.6 7.8 15.4 17c-7.7 55.9-34.6 105.6-73.9 142.3c-6 5.6-15.4 5.2-21.2-.7L320 288H558.4z"},child:[]}]})(t)}function lit(t){return ft({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M264.5 5.2c14.9-6.9 32.1-6.9 47 0l218.6 101c8.5 3.9 13.9 12.4 13.9 21.8s-5.4 17.9-13.9 21.8l-218.6 101c-14.9 6.9-32.1 6.9-47 0L45.9 149.8C37.4 145.8 32 137.3 32 128s5.4-17.9 13.9-21.8L264.5 5.2zM476.9 209.6l53.2 24.6c8.5 3.9 13.9 12.4 13.9 21.8s-5.4 17.9-13.9 21.8l-218.6 101c-14.9 6.9-32.1 6.9-47 0L45.9 277.8C37.4 273.8 32 265.3 32 256s5.4-17.9 13.9-21.8l53.2-24.6 152 70.2c23.4 10.8 50.4 10.8 73.8 0l152-70.2zm-152 198.2l152-70.2 53.2 24.6c8.5 3.9 13.9 12.4 13.9 21.8s-5.4 17.9-13.9 21.8l-218.6 101c-14.9 6.9-32.1 6.9-47 0L45.9 405.8C37.4 401.8 32 393.3 32 384s5.4-17.9 13.9-21.8l53.2-24.6 152 70.2c23.4 10.8 50.4 10.8 73.8 0z"},child:[]}]})(t)}function cit(t){return ft({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M32 119.4C12.9 108.4 0 87.7 0 64C0 28.7 28.7 0 64 0c23.7 0 44.4 12.9 55.4 32H456.6C467.6 12.9 488.3 0 512 0c35.3 0 64 28.7 64 64c0 23.7-12.9 44.4-32 55.4V392.6c19.1 11.1 32 31.7 32 55.4c0 35.3-28.7 64-64 64c-23.7 0-44.4-12.9-55.4-32H119.4c-11.1 19.1-31.7 32-55.4 32c-35.3 0-64-28.7-64-64c0-23.7 12.9-44.4 32-55.4V119.4zM456.6 96H119.4c-5.6 9.7-13.7 17.8-23.4 23.4V392.6c9.7 5.6 17.8 13.7 23.4 23.4H456.6c5.6-9.7 13.7-17.8 23.4-23.4V119.4c-9.7-5.6-17.8-13.7-23.4-23.4zM128 160c0-17.7 14.3-32 32-32H288c17.7 0 32 14.3 32 32v96c0 17.7-14.3 32-32 32H160c-17.7 0-32-14.3-32-32V160zM256 320h32c35.3 0 64-28.7 64-64V224h64c17.7 0 32 14.3 32 32v96c0 17.7-14.3 32-32 32H288c-17.7 0-32-14.3-32-32V320z"},child:[]}]})(t)}const uit=({sectionId:t,availableArtifacts:e,onDrop:n,draggedId:r,onDeleteArtifact:i})=>{const o=te(p=>mD(t,p),ae.isEqual).toReversed(),[a,l]=_.useState(null),c=(p,g)=>{l(g)},u=()=>{l(null)},f=(p,g)=>{l(null);const m=p.dataTransfer.getData("text/plain");n(m,g)},h=p=>!r||a!==p.id?"border-setta-300 dark:border-setta-600":"border-blue-500 dark:border-blue-600 bg-blue-50 dark:bg-blue-800 dark:[&_*]:text-white/50";function d(p){switch(p){case"img":return x.jsx("i",{className:"gg-image text-setta-300 dark:text-setta-600"});case"brushStrokes":return x.jsx(tI,{className:"text-setta-300 dark:text-setta-600"})}}return x.jsxs(x.Fragment,{children:[x.jsx("h3",{className:"mt-1 text-sm font-bold text-setta-400 dark:text-setta-600",children:"Add / Remove Layer Contents"}),x.jsx("section",{className:"mb-4 rounded-xl border border-white bg-white px-4 py-2 shadow-[inset_0_3px_8px_0_rgb(0_0_0_/_0.15)] dark:border-setta-700 dark:bg-setta-800 dark:shadow-[inset_0_1px_8px_0_rgb(0_0_0_/_0.6)]",children:o.map(p=>x.jsxs("div",{className:`-mx-2 mb-2 rounded-lg px-2 py-1 transition-colors hover:bg-setta-100/30 dark:hover:bg-setta-900/50 ${h(p)} ${r?"cursor-copy border border-dashed border-blue-500":"border !border-transparent"}`,onDragOver:g=>c(g,p.id),onDragLeave:u,onDrop:g=>f(g,p.id),children:[x.jsxs("header",{className:"flex gap-1",children:[x.jsx(cit,{className:"text-setta-300 dark:text-setta-600"}),x.jsx("h4",{className:"truncate text-xs font-bold uppercase text-setta-600 dark:text-setta-400",children:p.name})]}),x.jsx("div",{className:"ml-2",children:p.artifactIdsUsed.toReversed().map((g,m)=>{var v,y;return x.jsxs("div",{className:"group flex items-center justify-between text-xs text-setta-600 dark:text-setta-400",children:[x.jsxs("div",{className:"flex gap-1",children:[d((v=e[g])==null?void 0:v.type),x.jsx("p",{children:(y=e[g])==null?void 0:y.name})]}),x.jsx("button",{onClick:()=>i(p.id,p.artifactIdsUsed.length-1-m),className:"cursor-pointer p-1 opacity-0 transition-opacity hover:text-red-500 group-hover:opacity-100",children:x.jsx(eHe,{size:14})})]},m)})})]},p.id))})]})};function Qfe({availableArtifacts:t,onDragStart:e,onDragEnd:n,onClick:r,getItemStyle:i}){const[s,o]=_.useState({}),a=!!e;return a?x.jsx(fit,{availableArtifacts:t,onDragStart:e,onDragEnd:n,onClick:r,getItemStyle:i,draggable:a,loadedDetails:s}):x.jsx(hit,{availableArtifacts:t,onDragStart:e,onDragEnd:n,onClick:r,getItemStyle:i,draggable:a,loadedDetails:s})}function fit({availableArtifacts:t,onDragStart:e,onDragEnd:n,onClick:r,getItemStyle:i,draggable:s,loadedDetails:o}){return x.jsxs(x.Fragment,{children:[x.jsx("h3",{className:"mt-1 text-sm font-bold text-setta-400 dark:text-setta-600",children:"Available Layer Objects (Drag & Drop)"}),x.jsx(wD,{type:"multiple",className:"flex w-full flex-col gap-2 rounded-lg bg-setta-500/10 px-4 py-4",children:Object.entries(t).map(([a,l])=>x.jsxs(q3,{value:l.name,className:`flex flex-col rounded-lg bg-white shadow-md transition-shadow hover:shadow-xl dark:bg-setta-800 dark:!shadow-setta-900 ${s?"cursor-move":"cursor-pointer"} mx-1 justify-center border px-2 py-1 ${(i==null?void 0:i(a))??"border-transparent hover:border-white dark:border-setta-700 dark:hover:bg-setta-700"}`,draggable:s,onDragStart:c=>e==null?void 0:e(c,a),onDragEnd:n,onClick:()=>r==null?void 0:r(a,l.type),children:[x.jsxs("div",{className:"flex flex-1 flex-col",children:[x.jsxs("div",{className:"flex items-center justify-between",children:[x.jsxs("header",{className:"flex min-w-0",children:[x.jsx("p",{className:"truncate text-xs font-bold text-setta-600 dark:text-setta-200",children:l.name}),x.jsx("p",{className:"ml-2 truncate text-xs text-setta-500 dark:text-setta-400",children:l.type})]}),x.jsx(X3,{className:"cursor-pointer p-2",children:x.jsx(Tle,{className:"transform text-setta-500 transition-transform duration-200 ease-in-out group-data-[state=open]:rotate-180 dark:text-setta-400"})})]}),!!l.path&&x.jsx("div",{className:"mb-2 truncate text-xs text-setta-500 dark:text-setta-400",children:l.path})]}),x.jsx(IO,{className:"data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden",children:x.jsx("div",{className:"rounded-md bg-setta-50 px-3 py-2 dark:bg-setta-900/50",children:o[l.id]?x.jsx("pre",{className:"text-xs text-setta-900 dark:text-setta-100",children:JSON.stringify(o[l.id],null,2)}):x.jsx("div",{className:"text-xs text-setta-500 dark:text-setta-400",children:"No additional details available"})})})]},a))})]})}function hit({availableArtifacts:t,onDragStart:e,onDragEnd:n,onClick:r,getItemStyle:i,draggable:s,loadedDetails:o}){return x.jsxs(x.Fragment,{children:[x.jsx("h3",{className:"mb-2 text-sm font-bold text-setta-400 dark:text-setta-600",children:"Available Objects"}),x.jsx(wD,{type:"multiple",className:"flex w-full flex-col gap-2",children:Object.entries(t).map(([a,l])=>x.jsxs(q3,{value:l.name,className:`flex flex-col rounded-lg bg-white shadow-md transition-shadow hover:shadow-xl dark:bg-setta-800 dark:!shadow-setta-900 ${s?"cursor-move":"cursor-pointer"} mx-1 justify-center border px-2 py-1 ${(i==null?void 0:i(a))??"border-transparent hover:border-white dark:border-setta-700 dark:hover:bg-setta-700"}`,draggable:s,onDragStart:c=>e==null?void 0:e(c,a),onDragEnd:n,onClick:()=>r==null?void 0:r(a,l.type),children:[x.jsxs("div",{className:"flex flex-1 flex-col",children:[x.jsxs("div",{className:"flex items-center justify-between",children:[x.jsxs("header",{className:"flex min-w-0",children:[x.jsx("p",{className:"truncate text-xs font-bold text-setta-600 dark:text-setta-200",children:l.name}),x.jsx("p",{className:"ml-2 truncate text-xs text-setta-500 dark:text-setta-400",children:l.type})]}),x.jsx(X3,{className:"cursor-pointer p-2",children:x.jsx(Tle,{className:"transform text-setta-500 transition-transform duration-200 ease-in-out group-data-[state=open]:rotate-180 dark:text-setta-400"})})]}),!!l.path&&x.jsx("div",{className:"mb-2 truncate text-xs text-setta-500 dark:text-setta-400",children:l.path})]}),x.jsx(IO,{className:"data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden",children:x.jsx("div",{className:"rounded-md bg-setta-50 px-3 py-2 dark:bg-setta-900/50",children:o[l.id]?x.jsx("pre",{className:"text-xs text-setta-900 dark:text-setta-100",children:JSON.stringify(o[l.id],null,2)}):x.jsx("div",{className:"text-xs text-setta-500 dark:text-setta-400",children:"No additional details available"})})})]},a))})]})}function dit({sectionId:t,sectionTypeName:e}){const n=Bfe(e),[r,i]=_.useState(null),s=(c,u)=>{te.setState(f=>{const h=f.artifactGroups[u],d=n[c].type;h.artifactTransforms.push(y$(c,e,d))})},o=(c,u)=>{te.setState(f=>{const h=f.artifactGroups[c];h.artifactTransforms=h.artifactTransforms.filter((d,p)=>p!==u)})},a=()=>{i(null)},l=(c,u)=>{c.dataTransfer.setData("text/plain",u),i(u)};return x.jsxs("div",{className:"flex flex-1 flex-col gap-1 overflow-x-clip overflow-y-scroll [&>*]:mx-[2px]",children:[x.jsx(uit,{sectionId:t,availableArtifacts:n,onDrop:s,draggedId:r,onDeleteArtifact:o}),x.jsx(Qfe,{availableArtifacts:n,onDragStart:l,onDragEnd:a})]})}function jfe({sectionId:t,sectionTypeName:e}){const n=Bfe(e),r=te(o=>W3(t,o),ae.isEqual);function i(o){return r.has(o)?"!bg-blue-500 [&_*]:!text-white dark:!bg-blue-800 hover:bg-blue-50 dark:hover:bg-blue-900 border-transparent":null}function s(o,a){te.setState(l=>{Ite({sectionId:t,sectionTypeName:e,artifactId:o,artifactType:a,add:!r.has(o),state:l})})}return x.jsx(Qfe,{availableArtifacts:n,getItemStyle:i,onClick:s})}function Bfe(t){const[e,n]=_.useState({}),r=fi(i=>{const s={};for(const[o,a]of Object.entries(i.x))Y.ALLOWED_ARTIFACT_TYPES[t].includes(a.type)&&(s[o]=a);return s},ae.isEqual);return _.useEffect(()=>{async function i(){const s=await JPe(t);s.status==200&&n(s.data)}i()},[]),{...e,...r}}function pit({sectionId:t}){return x.jsxs("div",{className:"flex-1 overflow-x-hidden overflow-y-scroll [&>*]:mr-[2px]",children:[x.jsx(mit,{sectionId:t}),x.jsx(jfe,{sectionId:t,sectionTypeName:Y.CHART})]})}function mit({sectionId:t}){const e=te(r=>r.x[t].chartSettings,ae.isEqual),n=Ut(r=>r.chartDisplayedSeriesNames[t],ae.isEqual);return x.jsxs("div",{className:"flex flex-col gap-1",children:[x.jsx("h3",{className:"mt-1 font-bold text-setta-400 dark:text-setta-500",children:"Chart Config"}),x.jsx(yit,{sectionId:t,selectedChartType:e.type}),x.jsx(git,{sectionId:t,chartSettings:e,valueHeaders:n})]})}function git({sectionId:t,chartSettings:e,valueHeaders:n}){switch(e.type){case"line":return x.jsx(vit,{sectionId:t,chartSettings:e,valueHeaders:n});case"scatter":return x.jsx(Oit,{sectionId:t,chartSettings:e,valueHeaders:n});default:return null}}function vit({sectionId:t,chartSettings:e,valueHeaders:n}){const r=[{name:"xAxisLog",title:"X-Axis Log Scale"},{name:"y1AxisLog",title:"Y1-Axis Log Scale"},{name:"y2AxisLog",title:"Y2-Axis Log Scale"}];return x.jsxs(x.Fragment,{children:[x.jsx(zfe,{sectionId:t,valueHeaders:n,selectedXAxisColumn:e.xAxisColumn,xAxisCanBeNull:!0}),x.jsx(Ffe,{sectionId:t,optionsWithToggle:r,chartSettings:e})]})}function Oit({sectionId:t,chartSettings:e,valueHeaders:n}){const r=[{name:"xAxisLog",title:"X-Axis Log Scale"},{name:"y1AxisLog",title:"Y1-Axis Log Scale"},{name:"y2AxisLog",title:"Y2-Axis Log Scale"}];return x.jsxs(x.Fragment,{children:[x.jsx(zfe,{sectionId:t,valueHeaders:n,selectedXAxisColumn:e.xAxisColumn}),x.jsx(bit,{sectionId:t,valueHeaders:n,selectedCategoryColumn:e.categoryColumn}),x.jsx(Ffe,{sectionId:t,optionsWithToggle:r,chartSettings:e})]})}function yit({sectionId:t,selectedChartType:e}){return x.jsxs(x.Fragment,{children:[x.jsx("label",{htmlFor:"chartType",className:"block text-xs font-medium text-setta-700 dark:text-setta-300",children:"Chart Type"}),x.jsx(Yd,{allItems:Sit,value:e,onSelectedItemChange:n=>wit(t,n)})]})}function zfe({sectionId:t,valueHeaders:e,selectedXAxisColumn:n,xAxisCanBeNull:r}){const i=[{group:"Column Names",items:(e==null?void 0:e.map(s=>({id:s,name:s})))??[]}];return x.jsxs(x.Fragment,{children:[x.jsx("label",{htmlFor:"xAxisColumn",className:"block text-xs font-medium text-setta-700 dark:text-setta-300",children:"X-Axis Column"}),x.jsx(Yd,{allItems:i,value:n,onSelectedItemChange:s=>SD(t,"xAxisColumn",s),selectedItemCanBeNull:r})]})}function bit({sectionId:t,valueHeaders:e,selectedCategoryColumn:n}){const r=[{group:"Column Names",items:(e==null?void 0:e.map(i=>({id:i,name:i})))??[]}];return x.jsxs(x.Fragment,{children:[x.jsx("label",{htmlFor:"categoryColumn",className:"block text-xs font-medium text-setta-700 dark:text-setta-300",children:"Category Column"}),x.jsx(Yd,{allItems:r,value:n,onSelectedItemChange:i=>SD(t,"categoryColumn",i)})]})}function Ffe({sectionId:t,optionsWithToggle:e,chartSettings:n}){return x.jsxs("div",{className:"flex flex-col gap-2 py-6",children:[x.jsx("h4",{className:"font-semibold text-setta-400 dark:text-setta-400",children:"Chart Labels"}),e.map(r=>x.jsx(xit,{sectionId:t,name:r.name,title:r.title,value:n[r.name]},`${r.name}`))]})}function xit({sectionId:t,name:e,value:n,title:r}){return x.jsxs("div",{className:"flex items-center justify-between",children:[x.jsx("label",{htmlFor:e,className:"cursor-pointer text-xs font-medium text-setta-700 dark:text-setta-300",children:r}),x.jsx("input",{type:"checkbox",id:e,className:"h-4 w-4 cursor-pointer rounded bg-setta-500/50 text-blue-500 outline outline-offset-2 outline-transparent checked:bg-blue-500 focus-visible:!outline-blue-500 dark:text-blue-400 dark:focus-visible:ring-blue-400",checked:n,onChange:i=>SD(t,e,i.target.checked)})]})}function SD(t,e,n){te.setState(r=>{r.x[t].chartSettings[e]=n})}function wit(t,e){te.setState(n=>{n.x[t].chartSettings.type=e;const r=W3(t,n);Nte(Array.from(r),t,n)})}const Sit=[{group:"Chart Types",items:["line","scatter"].map(t=>({id:t,name:t}))}],_it=[{group:"Start Methods",items:["fork","spawn","forkserver"].map(t=>({id:t,name:t}))}];function kit({sectionId:t}){const e=te(r=>r.x[t].subprocessStartMethod);function n(r){te.setState(i=>{i.x[t].subprocessStartMethod=r})}return x.jsx("div",{className:"mb-2 mt-2 w-full select-text",children:x.jsxs("div",{className:"flex w-full items-center gap-3",children:[x.jsx("p",{className:"select-none text-sm font-bold text-setta-400 dark:text-setta-600",children:"Subprocess Start Method"}),x.jsx(Yd,{allItems:_it,value:e,onSelectedItemChange:n})]})})}function rn(t,e,{checkForDefaultPrevented:n=!0}={}){return function(i){if(t==null||t(i),n===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}function Cit(t,e){typeof t=="function"?t(e):t!=null&&(t.current=e)}function H3(...t){return e=>t.forEach(n=>Cit(n,e))}function Qs(...t){return _.useCallback(H3(...t),t)}function Wfe(t,e=[]){let n=[];function r(s,o){const a=_.createContext(o),l=n.length;n=[...n,o];const c=f=>{var v;const{scope:h,children:d,...p}=f,g=((v=h==null?void 0:h[t])==null?void 0:v[l])||a,m=_.useMemo(()=>p,Object.values(p));return x.jsx(g.Provider,{value:m,children:d})};c.displayName=s+"Provider";function u(f,h){var g;const d=((g=h==null?void 0:h[t])==null?void 0:g[l])||a,p=_.useContext(d);if(p)return p;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${s}\``)}return[c,u]}const i=()=>{const s=n.map(o=>_.createContext(o));return function(a){const l=(a==null?void 0:a[t])||s;return _.useMemo(()=>({[`__scope${t}`]:{...a,[t]:l}}),[a,l])}};return i.scopeName=t,[r,Eit(i,...e)]}function Eit(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(s)[`__scope${c}`];return{...a,...f}},{});return _.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}function Na(t){const e=_.useRef(t);return _.useEffect(()=>{e.current=t}),_.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}function Vfe({prop:t,defaultProp:e,onChange:n=()=>{}}){const[r,i]=Tit({defaultProp:e,onChange:n}),s=t!==void 0,o=s?t:r,a=Na(n),l=_.useCallback(c=>{if(s){const f=typeof c=="function"?c(t):c;f!==t&&a(f)}else i(c)},[s,t,i,a]);return[o,l]}function Tit({defaultProp:t,onChange:e}){const n=_.useState(t),[r]=n,i=_.useRef(r),s=Na(e);return _.useEffect(()=>{i.current!==r&&(s(r),i.current=r)},[r,i,s]),n}var DO=_.forwardRef((t,e)=>{const{children:n,...r}=t,i=_.Children.toArray(n),s=i.find(Ait);if(s){const o=s.props.children,a=i.map(l=>l===s?_.Children.count(o)>1?_.Children.only(null):_.isValidElement(o)?o.props.children:null:l);return x.jsx(SA,{...r,ref:e,children:_.isValidElement(o)?_.cloneElement(o,void 0,a):null})}return x.jsx(SA,{...r,ref:e,children:n})});DO.displayName="Slot";var SA=_.forwardRef((t,e)=>{const{children:n,...r}=t;if(_.isValidElement(n)){const i=$it(n);return _.cloneElement(n,{...Rit(r,n.props),ref:e?H3(e,i):i})}return _.Children.count(n)>1?_.Children.only(null):null});SA.displayName="SlotClone";var Pit=({children:t})=>x.jsx(x.Fragment,{children:t});function Ait(t){return _.isValidElement(t)&&t.type===Pit}function Rit(t,e){const n={...e};for(const r in e){const i=t[r],s=e[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{s(...a),i(...a)}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...t,...n}}function $it(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var Mit=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],ps=Mit.reduce((t,e)=>{const n=_.forwardRef((r,i)=>{const{asChild:s,...o}=r,a=s?DO:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),x.jsx(a,{...o,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});function Ufe(t,e){t&&Qi.flushSync(()=>t.dispatchEvent(e))}function _D(t,e=[]){let n=[];function r(s,o){const a=_.createContext(o),l=n.length;n=[...n,o];function c(f){const{scope:h,children:d,...p}=f,g=(h==null?void 0:h[t][l])||a,m=_.useMemo(()=>p,Object.values(p));return x.jsx(g.Provider,{value:m,children:d})}function u(f,h){const d=(h==null?void 0:h[t][l])||a,p=_.useContext(d);if(p)return p;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${s}\``)}return c.displayName=s+"Provider",[c,u]}const i=()=>{const s=n.map(o=>_.createContext(o));return function(a){const l=(a==null?void 0:a[t])||s;return _.useMemo(()=>({[`__scope${t}`]:{...a,[t]:l}}),[a,l])}};return i.scopeName=t,[r,Iit(i,...e)]}function Iit(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(s)[`__scope${c}`];return{...a,...f}},{});return _.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}function qfe(t){const e=t+"CollectionProvider",[n,r]=_D(e),[i,s]=n(e,{collectionRef:{current:null},itemMap:new Map}),o=d=>{const{scope:p,children:g}=d,m=ke.useRef(null),v=ke.useRef(new Map).current;return x.jsx(i,{scope:p,itemMap:v,collectionRef:m,children:g})};o.displayName=e;const a=t+"CollectionSlot",l=ke.forwardRef((d,p)=>{const{scope:g,children:m}=d,v=s(a,g),y=Qs(p,v.collectionRef);return x.jsx(DO,{ref:y,children:m})});l.displayName=a;const c=t+"CollectionItemSlot",u="data-radix-collection-item",f=ke.forwardRef((d,p)=>{const{scope:g,children:m,...v}=d,y=ke.useRef(null),b=Qs(p,y),S=s(c,g);return ke.useEffect(()=>(S.itemMap.set(y,{ref:y,...v}),()=>void S.itemMap.delete(y))),x.jsx(DO,{[u]:"",ref:b,children:m})});f.displayName=c;function h(d){const p=s(t+"CollectionConsumer",d);return ke.useCallback(()=>{const m=p.collectionRef.current;if(!m)return[];const v=Array.from(m.querySelectorAll(`[${u}]`));return Array.from(p.itemMap.values()).sort((S,k)=>v.indexOf(S.ref.current)-v.indexOf(k.ref.current))},[p.collectionRef,p.itemMap])}return[{Provider:o,Slot:l,ItemSlot:f},h,r]}var Dit=_.createContext(void 0);function Xfe(t){const e=_.useContext(Dit);return t||e||"ltr"}function Lit(t,e=globalThis==null?void 0:globalThis.document){const n=Na(t);_.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var Nit="DismissableLayer",_A="dismissableLayer.update",Qit="dismissableLayer.pointerDownOutside",jit="dismissableLayer.focusOutside",tX,Hfe=_.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Zfe=_.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:o,onDismiss:a,...l}=t,c=_.useContext(Hfe),[u,f]=_.useState(null),h=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,d]=_.useState({}),p=Qs(e,T=>f(T)),g=Array.from(c.layers),[m]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),v=g.indexOf(m),y=u?g.indexOf(u):-1,b=c.layersWithOutsidePointerEventsDisabled.size>0,S=y>=v,k=Fit(T=>{const C=T.target,A=[...c.branches].some(R=>R.contains(C));!S||A||(i==null||i(T),o==null||o(T),T.defaultPrevented||a==null||a())},h),E=Wit(T=>{const C=T.target;[...c.branches].some(R=>R.contains(C))||(s==null||s(T),o==null||o(T),T.defaultPrevented||a==null||a())},h);return Lit(T=>{y===c.layers.size-1&&(r==null||r(T),!T.defaultPrevented&&a&&(T.preventDefault(),a()))},h),_.useEffect(()=>{if(u)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(tX=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),nX(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=tX)}},[u,h,n,c]),_.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),nX())},[u,c]),_.useEffect(()=>{const T=()=>d({});return document.addEventListener(_A,T),()=>document.removeEventListener(_A,T)},[]),x.jsx(ps.div,{...l,ref:p,style:{pointerEvents:b?S?"auto":"none":void 0,...t.style},onFocusCapture:rn(t.onFocusCapture,E.onFocusCapture),onBlurCapture:rn(t.onBlurCapture,E.onBlurCapture),onPointerDownCapture:rn(t.onPointerDownCapture,k.onPointerDownCapture)})});Zfe.displayName=Nit;var Bit="DismissableLayerBranch",zit=_.forwardRef((t,e)=>{const n=_.useContext(Hfe),r=_.useRef(null),i=Qs(e,r);return _.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),x.jsx(ps.div,{...t,ref:i})});zit.displayName=Bit;function Fit(t,e=globalThis==null?void 0:globalThis.document){const n=Na(t),r=_.useRef(!1),i=_.useRef(()=>{});return _.useEffect(()=>{const s=a=>{if(a.target&&!r.current){let l=function(){Yfe(Qit,n,c,{discrete:!0})};const c={originalEvent:a};a.pointerType==="touch"?(e.removeEventListener("click",i.current),i.current=l,e.addEventListener("click",i.current,{once:!0})):l()}else e.removeEventListener("click",i.current);r.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",s),e.removeEventListener("click",i.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function Wit(t,e=globalThis==null?void 0:globalThis.document){const n=Na(t),r=_.useRef(!1);return _.useEffect(()=>{const i=s=>{s.target&&!r.current&&Yfe(jit,n,{originalEvent:s},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function nX(){const t=new CustomEvent(_A);document.dispatchEvent(t)}function Yfe(t,e,n,{discrete:r}){const i=n.originalEvent.target,s=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&i.addEventListener(t,e,{once:!0}),r?Ufe(i,s):i.dispatchEvent(s)}var z7=0;function Vit(){_.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??rX()),document.body.insertAdjacentElement("beforeend",t[1]??rX()),z7++,()=>{z7===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),z7--}},[])}function rX(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var F7="focusScope.autoFocusOnMount",W7="focusScope.autoFocusOnUnmount",iX={bubbles:!1,cancelable:!0},Uit="FocusScope",Gfe=_.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=t,[a,l]=_.useState(null),c=Na(i),u=Na(s),f=_.useRef(null),h=Qs(e,g=>l(g)),d=_.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;_.useEffect(()=>{if(r){let g=function(b){if(d.paused||!a)return;const S=b.target;a.contains(S)?f.current=S:$u(f.current,{select:!0})},m=function(b){if(d.paused||!a)return;const S=b.relatedTarget;S!==null&&(a.contains(S)||$u(f.current,{select:!0}))},v=function(b){if(document.activeElement===document.body)for(const k of b)k.removedNodes.length>0&&$u(a)};document.addEventListener("focusin",g),document.addEventListener("focusout",m);const y=new MutationObserver(v);return a&&y.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",g),document.removeEventListener("focusout",m),y.disconnect()}}},[r,a,d.paused]),_.useEffect(()=>{if(a){oX.add(d);const g=document.activeElement;if(!a.contains(g)){const v=new CustomEvent(F7,iX);a.addEventListener(F7,c),a.dispatchEvent(v),v.defaultPrevented||(qit(Git(Kfe(a)),{select:!0}),document.activeElement===g&&$u(a))}return()=>{a.removeEventListener(F7,c),setTimeout(()=>{const v=new CustomEvent(W7,iX);a.addEventListener(W7,u),a.dispatchEvent(v),v.defaultPrevented||$u(g??document.body,{select:!0}),a.removeEventListener(W7,u),oX.remove(d)},0)}}},[a,c,u,d]);const p=_.useCallback(g=>{if(!n&&!r||d.paused)return;const m=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,v=document.activeElement;if(m&&v){const y=g.currentTarget,[b,S]=Xit(y);b&&S?!g.shiftKey&&v===S?(g.preventDefault(),n&&$u(b,{select:!0})):g.shiftKey&&v===b&&(g.preventDefault(),n&&$u(S,{select:!0})):v===y&&g.preventDefault()}},[n,r,d.paused]);return x.jsx(ps.div,{tabIndex:-1,...o,ref:h,onKeyDown:p})});Gfe.displayName=Uit;function qit(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if($u(r,{select:e}),document.activeElement!==n)return}function Xit(t){const e=Kfe(t),n=sX(e,t),r=sX(e.reverse(),t);return[n,r]}function Kfe(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function sX(t,e){for(const n of t)if(!Hit(n,{upTo:e}))return n}function Hit(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function Zit(t){return t instanceof HTMLInputElement&&"select"in t}function $u(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&Zit(t)&&e&&t.select()}}var oX=Yit();function Yit(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=aX(t,e),t.unshift(e)},remove(e){var n;t=aX(t,e),(n=t[0])==null||n.resume()}}}function aX(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function Git(t){return t.filter(e=>e.tagName!=="A")}var _d=globalThis!=null&&globalThis.document?_.useLayoutEffect:()=>{},Kit=Lp["useId".toString()]||(()=>{}),Jit=0;function kA(t){const[e,n]=_.useState(Kit());return _d(()=>{t||n(r=>r??String(Jit++))},[t]),t||(e?`radix-${e}`:"")}const est=["top","right","bottom","left"],Rf=Math.min,io=Math.max,d4=Math.round,kw=Math.floor,_l=t=>({x:t,y:t}),tst={left:"right",right:"left",bottom:"top",top:"bottom"},nst={start:"end",end:"start"};function CA(t,e,n){return io(t,Rf(e,n))}function eu(t,e){return typeof t=="function"?t(e):t}function tu(t){return t.split("-")[0]}function fg(t){return t.split("-")[1]}function kD(t){return t==="x"?"y":"x"}function CD(t){return t==="y"?"height":"width"}function $f(t){return["top","bottom"].includes(tu(t))?"y":"x"}function ED(t){return kD($f(t))}function rst(t,e,n){n===void 0&&(n=!1);const r=fg(t),i=ED(t),s=CD(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=p4(o)),[o,p4(o)]}function ist(t){const e=p4(t);return[EA(t),e,EA(e)]}function EA(t){return t.replace(/start|end/g,e=>nst[e])}function sst(t,e,n){const r=["left","right"],i=["right","left"],s=["top","bottom"],o=["bottom","top"];switch(t){case"top":case"bottom":return n?e?i:r:e?r:i;case"left":case"right":return e?s:o;default:return[]}}function ost(t,e,n,r){const i=fg(t);let s=sst(tu(t),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(EA)))),s}function p4(t){return t.replace(/left|right|bottom|top/g,e=>tst[e])}function ast(t){return{top:0,right:0,bottom:0,left:0,...t}}function Jfe(t){return typeof t!="number"?ast(t):{top:t,right:t,bottom:t,left:t}}function m4(t){const{x:e,y:n,width:r,height:i}=t;return{width:r,height:i,top:n,left:e,right:e+r,bottom:n+i,x:e,y:n}}function lX(t,e,n){let{reference:r,floating:i}=t;const s=$f(e),o=ED(e),a=CD(o),l=tu(e),c=s==="y",u=r.x+r.width/2-i.width/2,f=r.y+r.height/2-i.height/2,h=r[a]/2-i[a]/2;let d;switch(l){case"top":d={x:u,y:r.y-i.height};break;case"bottom":d={x:u,y:r.y+r.height};break;case"right":d={x:r.x+r.width,y:f};break;case"left":d={x:r.x-i.width,y:f};break;default:d={x:r.x,y:r.y}}switch(fg(e)){case"start":d[o]-=h*(n&&c?-1:1);break;case"end":d[o]+=h*(n&&c?-1:1);break}return d}const lst=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,a=s.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(e));let c=await o.getElementRects({reference:t,floating:e,strategy:i}),{x:u,y:f}=lX(c,r,l),h=r,d={},p=0;for(let g=0;g<a.length;g++){const{name:m,fn:v}=a[g],{x:y,y:b,data:S,reset:k}=await v({x:u,y:f,initialPlacement:r,placement:h,strategy:i,middlewareData:d,rects:c,platform:o,elements:{reference:t,floating:e}});u=y??u,f=b??f,d={...d,[m]:{...d[m],...S}},k&&p<=50&&(p++,typeof k=="object"&&(k.placement&&(h=k.placement),k.rects&&(c=k.rects===!0?await o.getElementRects({reference:t,floating:e,strategy:i}):k.rects),{x:u,y:f}=lX(c,h,l)),g=-1)}return{x:u,y:f,placement:h,strategy:i,middlewareData:d}};async function LO(t,e){var n;e===void 0&&(e={});const{x:r,y:i,platform:s,rects:o,elements:a,strategy:l}=t,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:h=!1,padding:d=0}=eu(e,t),p=Jfe(d),m=a[h?f==="floating"?"reference":"floating":f],v=m4(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(m)))==null||n?m:m.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),y=f==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,b=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),S=await(s.isElement==null?void 0:s.isElement(b))?await(s.getScale==null?void 0:s.getScale(b))||{x:1,y:1}:{x:1,y:1},k=m4(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:y,offsetParent:b,strategy:l}):y);return{top:(v.top-k.top+p.top)/S.y,bottom:(k.bottom-v.bottom+p.bottom)/S.y,left:(v.left-k.left+p.left)/S.x,right:(k.right-v.right+p.right)/S.x}}const cst=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:i,rects:s,platform:o,elements:a,middlewareData:l}=e,{element:c,padding:u=0}=eu(t,e)||{};if(c==null)return{};const f=Jfe(u),h={x:n,y:r},d=ED(i),p=CD(d),g=await o.getDimensions(c),m=d==="y",v=m?"top":"left",y=m?"bottom":"right",b=m?"clientHeight":"clientWidth",S=s.reference[p]+s.reference[d]-h[d]-s.floating[p],k=h[d]-s.reference[d],E=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c));let T=E?E[b]:0;(!T||!await(o.isElement==null?void 0:o.isElement(E)))&&(T=a.floating[b]||s.floating[p]);const C=S/2-k/2,A=T/2-g[p]/2-1,R=Rf(f[v],A),Q=Rf(f[y],A),L=R,z=T-g[p]-Q,B=T/2-g[p]/2+C,q=CA(L,B,z),Z=!l.arrow&&fg(i)!=null&&B!==q&&s.reference[p]/2-(B<L?R:Q)-g[p]/2<0,J=Z?B<L?B-L:B-z:0;return{[d]:h[d]+J,data:{[d]:q,centerOffset:B-q-J,...Z&&{alignmentOffset:J}},reset:Z}}}),ust=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:i,middlewareData:s,rects:o,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:g=!0,...m}=eu(t,e);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const v=tu(i),y=$f(a),b=tu(a)===a,S=await(l.isRTL==null?void 0:l.isRTL(c.floating)),k=h||(b||!g?[p4(a)]:ist(a)),E=p!=="none";!h&&E&&k.push(...ost(a,g,p,S));const T=[a,...k],C=await LO(e,m),A=[];let R=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&A.push(C[v]),f){const B=rst(i,o,S);A.push(C[B[0]],C[B[1]])}if(R=[...R,{placement:i,overflows:A}],!A.every(B=>B<=0)){var Q,L;const B=(((Q=s.flip)==null?void 0:Q.index)||0)+1,q=T[B];if(q)return{data:{index:B,overflows:R},reset:{placement:q}};let Z=(L=R.filter(J=>J.overflows[0]<=0).sort((J,I)=>J.overflows[1]-I.overflows[1])[0])==null?void 0:L.placement;if(!Z)switch(d){case"bestFit":{var z;const J=(z=R.filter(I=>{if(E){const j=$f(I.placement);return j===y||j==="y"}return!0}).map(I=>[I.placement,I.overflows.filter(j=>j>0).reduce((j,M)=>j+M,0)]).sort((I,j)=>I[1]-j[1])[0])==null?void 0:z[0];J&&(Z=J);break}case"initialPlacement":Z=a;break}if(i!==Z)return{reset:{placement:Z}}}return{}}}};function cX(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function uX(t){return est.some(e=>t[e]>=0)}const fst=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:r="referenceHidden",...i}=eu(t,e);switch(r){case"referenceHidden":{const s=await LO(e,{...i,elementContext:"reference"}),o=cX(s,n.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:uX(o)}}}case"escaped":{const s=await LO(e,{...i,altBoundary:!0}),o=cX(s,n.floating);return{data:{escapedOffsets:o,escaped:uX(o)}}}default:return{}}}}};async function hst(t,e){const{placement:n,platform:r,elements:i}=t,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=tu(n),a=fg(n),l=$f(n)==="y",c=["left","top"].includes(o)?-1:1,u=s&&l?-1:1,f=eu(e,t);let{mainAxis:h,crossAxis:d,alignmentAxis:p}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof p=="number"&&(d=a==="end"?p*-1:p),l?{x:d*u,y:h*c}:{x:h*c,y:d*u}}const dst=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:i,y:s,placement:o,middlewareData:a}=e,l=await hst(e,t);return o===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:o}}}}},pst=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:i}=e,{mainAxis:s=!0,crossAxis:o=!1,limiter:a={fn:m=>{let{x:v,y}=m;return{x:v,y}}},...l}=eu(t,e),c={x:n,y:r},u=await LO(e,l),f=$f(tu(i)),h=kD(f);let d=c[h],p=c[f];if(s){const m=h==="y"?"top":"left",v=h==="y"?"bottom":"right",y=d+u[m],b=d-u[v];d=CA(y,d,b)}if(o){const m=f==="y"?"top":"left",v=f==="y"?"bottom":"right",y=p+u[m],b=p-u[v];p=CA(y,p,b)}const g=a.fn({...e,[h]:d,[f]:p});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[h]:s,[f]:o}}}}}},mst=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:i,rects:s,middlewareData:o}=e,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=eu(t,e),u={x:n,y:r},f=$f(i),h=kD(f);let d=u[h],p=u[f];const g=eu(a,e),m=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(l){const b=h==="y"?"height":"width",S=s.reference[h]-s.floating[b]+m.mainAxis,k=s.reference[h]+s.reference[b]-m.mainAxis;d<S?d=S:d>k&&(d=k)}if(c){var v,y;const b=h==="y"?"width":"height",S=["top","left"].includes(tu(i)),k=s.reference[f]-s.floating[b]+(S&&((v=o.offset)==null?void 0:v[f])||0)+(S?0:m.crossAxis),E=s.reference[f]+s.reference[b]+(S?0:((y=o.offset)==null?void 0:y[f])||0)-(S?m.crossAxis:0);p<k?p=k:p>E&&(p=E)}return{[h]:d,[f]:p}}}},gst=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:i,rects:s,platform:o,elements:a}=e,{apply:l=()=>{},...c}=eu(t,e),u=await LO(e,c),f=tu(i),h=fg(i),d=$f(i)==="y",{width:p,height:g}=s.floating;let m,v;f==="top"||f==="bottom"?(m=f,v=h===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(v=f,m=h==="end"?"top":"bottom");const y=g-u.top-u.bottom,b=p-u.left-u.right,S=Rf(g-u[m],y),k=Rf(p-u[v],b),E=!e.middlewareData.shift;let T=S,C=k;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(C=b),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(T=y),E&&!h){const R=io(u.left,0),Q=io(u.right,0),L=io(u.top,0),z=io(u.bottom,0);d?C=p-2*(R!==0||Q!==0?R+Q:io(u.left,u.right)):T=g-2*(L!==0||z!==0?L+z:io(u.top,u.bottom))}await l({...e,availableWidth:C,availableHeight:T});const A=await o.getDimensions(a.floating);return p!==A.width||g!==A.height?{reset:{rects:!0}}:{}}}};function Z3(){return typeof window<"u"}function hg(t){return ehe(t)?(t.nodeName||"").toLowerCase():"#document"}function co(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Vl(t){var e;return(e=(ehe(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function ehe(t){return Z3()?t instanceof Node||t instanceof co(t).Node:!1}function Qa(t){return Z3()?t instanceof Element||t instanceof co(t).Element:!1}function Ml(t){return Z3()?t instanceof HTMLElement||t instanceof co(t).HTMLElement:!1}function fX(t){return!Z3()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof co(t).ShadowRoot}function eb(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=ja(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!["inline","contents"].includes(i)}function vst(t){return["table","td","th"].includes(hg(t))}function Y3(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function TD(t){const e=PD(),n=Qa(t)?ja(t):t;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function Ost(t){let e=Mf(t);for(;Ml(e)&&!xm(e);){if(TD(e))return e;if(Y3(e))return null;e=Mf(e)}return null}function PD(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function xm(t){return["html","body","#document"].includes(hg(t))}function ja(t){return co(t).getComputedStyle(t)}function G3(t){return Qa(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Mf(t){if(hg(t)==="html")return t;const e=t.assignedSlot||t.parentNode||fX(t)&&t.host||Vl(t);return fX(e)?e.host:e}function the(t){const e=Mf(t);return xm(e)?t.ownerDocument?t.ownerDocument.body:t.body:Ml(e)&&eb(e)?e:the(e)}function NO(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=the(t),s=i===((r=t.ownerDocument)==null?void 0:r.body),o=co(i);if(s){const a=TA(o);return e.concat(o,o.visualViewport||[],eb(i)?i:[],a&&n?NO(a):[])}return e.concat(i,NO(i,[],n))}function TA(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function nhe(t){const e=ja(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=Ml(t),s=i?t.offsetWidth:n,o=i?t.offsetHeight:r,a=d4(n)!==s||d4(r)!==o;return a&&(n=s,r=o),{width:n,height:r,$:a}}function AD(t){return Qa(t)?t:t.contextElement}function Rp(t){const e=AD(t);if(!Ml(e))return _l(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:s}=nhe(e);let o=(s?d4(n.width):n.width)/r,a=(s?d4(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const yst=_l(0);function rhe(t){const e=co(t);return!PD()||!e.visualViewport?yst:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function bst(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==co(t)?!1:e}function kd(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),s=AD(t);let o=_l(1);e&&(r?Qa(r)&&(o=Rp(r)):o=Rp(t));const a=bst(s,n,r)?rhe(s):_l(0);let l=(i.left+a.x)/o.x,c=(i.top+a.y)/o.y,u=i.width/o.x,f=i.height/o.y;if(s){const h=co(s),d=r&&Qa(r)?co(r):r;let p=h,g=TA(p);for(;g&&r&&d!==p;){const m=Rp(g),v=g.getBoundingClientRect(),y=ja(g),b=v.left+(g.clientLeft+parseFloat(y.paddingLeft))*m.x,S=v.top+(g.clientTop+parseFloat(y.paddingTop))*m.y;l*=m.x,c*=m.y,u*=m.x,f*=m.y,l+=b,c+=S,p=co(g),g=TA(p)}}return m4({width:u,height:f,x:l,y:c})}function RD(t,e){const n=G3(t).scrollLeft;return e?e.left+n:kd(Vl(t)).left+n}function ihe(t,e,n){n===void 0&&(n=!1);const r=t.getBoundingClientRect(),i=r.left+e.scrollLeft-(n?0:RD(t,r)),s=r.top+e.scrollTop;return{x:i,y:s}}function xst(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const s=i==="fixed",o=Vl(r),a=e?Y3(e.floating):!1;if(r===o||a&&s)return n;let l={scrollLeft:0,scrollTop:0},c=_l(1);const u=_l(0),f=Ml(r);if((f||!f&&!s)&&((hg(r)!=="body"||eb(o))&&(l=G3(r)),Ml(r))){const d=kd(r);c=Rp(r),u.x=d.x+r.clientLeft,u.y=d.y+r.clientTop}const h=o&&!f&&!s?ihe(o,l,!0):_l(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+h.x,y:n.y*c.y-l.scrollTop*c.y+u.y+h.y}}function wst(t){return Array.from(t.getClientRects())}function Sst(t){const e=Vl(t),n=G3(t),r=t.ownerDocument.body,i=io(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=io(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+RD(t);const a=-n.scrollTop;return ja(r).direction==="rtl"&&(o+=io(e.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:a}}function _st(t,e){const n=co(t),r=Vl(t),i=n.visualViewport;let s=r.clientWidth,o=r.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;const c=PD();(!c||c&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:s,height:o,x:a,y:l}}function kst(t,e){const n=kd(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,s=Ml(t)?Rp(t):_l(1),o=t.clientWidth*s.x,a=t.clientHeight*s.y,l=i*s.x,c=r*s.y;return{width:o,height:a,x:l,y:c}}function hX(t,e,n){let r;if(e==="viewport")r=_st(t,n);else if(e==="document")r=Sst(Vl(t));else if(Qa(e))r=kst(e,n);else{const i=rhe(t);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return m4(r)}function she(t,e){const n=Mf(t);return n===e||!Qa(n)||xm(n)?!1:ja(n).position==="fixed"||she(n,e)}function Cst(t,e){const n=e.get(t);if(n)return n;let r=NO(t,[],!1).filter(a=>Qa(a)&&hg(a)!=="body"),i=null;const s=ja(t).position==="fixed";let o=s?Mf(t):t;for(;Qa(o)&&!xm(o);){const a=ja(o),l=TD(o);!l&&a.position==="fixed"&&(i=null),(s?!l&&!i:!l&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||eb(o)&&!l&&she(t,o))?r=r.filter(u=>u!==o):i=a,o=Mf(o)}return e.set(t,r),r}function Est(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const o=[...n==="clippingAncestors"?Y3(e)?[]:Cst(e,this._c):[].concat(n),r],a=o[0],l=o.reduce((c,u)=>{const f=hX(e,u,i);return c.top=io(f.top,c.top),c.right=Rf(f.right,c.right),c.bottom=Rf(f.bottom,c.bottom),c.left=io(f.left,c.left),c},hX(e,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function Tst(t){const{width:e,height:n}=nhe(t);return{width:e,height:n}}function Pst(t,e,n){const r=Ml(e),i=Vl(e),s=n==="fixed",o=kd(t,!0,s,e);let a={scrollLeft:0,scrollTop:0};const l=_l(0);if(r||!r&&!s)if((hg(e)!=="body"||eb(i))&&(a=G3(e)),r){const h=kd(e,!0,s,e);l.x=h.x+e.clientLeft,l.y=h.y+e.clientTop}else i&&(l.x=RD(i));const c=i&&!r&&!s?ihe(i,a):_l(0),u=o.left+a.scrollLeft-l.x-c.x,f=o.top+a.scrollTop-l.y-c.y;return{x:u,y:f,width:o.width,height:o.height}}function V7(t){return ja(t).position==="static"}function dX(t,e){if(!Ml(t)||ja(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Vl(t)===n&&(n=n.ownerDocument.body),n}function ohe(t,e){const n=co(t);if(Y3(t))return n;if(!Ml(t)){let i=Mf(t);for(;i&&!xm(i);){if(Qa(i)&&!V7(i))return i;i=Mf(i)}return n}let r=dX(t,e);for(;r&&vst(r)&&V7(r);)r=dX(r,e);return r&&xm(r)&&V7(r)&&!TD(r)?n:r||Ost(t)||n}const Ast=async function(t){const e=this.getOffsetParent||ohe,n=this.getDimensions,r=await n(t.floating);return{reference:Pst(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Rst(t){return ja(t).direction==="rtl"}const $st={convertOffsetParentRelativeRectToViewportRelativeRect:xst,getDocumentElement:Vl,getClippingRect:Est,getOffsetParent:ohe,getElementRects:Ast,getClientRects:wst,getDimensions:Tst,getScale:Rp,isElement:Qa,isRTL:Rst};function Mst(t,e){let n=null,r;const i=Vl(t);function s(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),s();const{left:c,top:u,width:f,height:h}=t.getBoundingClientRect();if(a||e(),!f||!h)return;const d=kw(u),p=kw(i.clientWidth-(c+f)),g=kw(i.clientHeight-(u+h)),m=kw(c),y={rootMargin:-d+"px "+-p+"px "+-g+"px "+-m+"px",threshold:io(0,Rf(1,l))||1};let b=!0;function S(k){const E=k[0].intersectionRatio;if(E!==l){if(!b)return o();E?o(!1,E):r=setTimeout(()=>{o(!1,1e-7)},1e3)}b=!1}try{n=new IntersectionObserver(S,{...y,root:i.ownerDocument})}catch{n=new IntersectionObserver(S,y)}n.observe(t)}return o(!0),s}function Ist(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=AD(t),u=i||s?[...c?NO(c):[],...NO(e)]:[];u.forEach(v=>{i&&v.addEventListener("scroll",n,{passive:!0}),s&&v.addEventListener("resize",n)});const f=c&&a?Mst(c,n):null;let h=-1,d=null;o&&(d=new ResizeObserver(v=>{let[y]=v;y&&y.target===c&&d&&(d.unobserve(e),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var b;(b=d)==null||b.observe(e)})),n()}),c&&!l&&d.observe(c),d.observe(e));let p,g=l?kd(t):null;l&&m();function m(){const v=kd(t);g&&(v.x!==g.x||v.y!==g.y||v.width!==g.width||v.height!==g.height)&&n(),g=v,p=requestAnimationFrame(m)}return n(),()=>{var v;u.forEach(y=>{i&&y.removeEventListener("scroll",n),s&&y.removeEventListener("resize",n)}),f==null||f(),(v=d)==null||v.disconnect(),d=null,l&&cancelAnimationFrame(p)}}const Dst=dst,Lst=pst,Nst=ust,Qst=gst,jst=fst,pX=cst,Bst=mst,zst=(t,e,n)=>{const r=new Map,i={platform:$st,...n},s={...i.platform,_c:r};return lst(t,e,{...i,platform:s})};var r2=typeof document<"u"?_.useLayoutEffect:_.useEffect;function g4(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,i;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!g4(t[r],e[r]))return!1;return!0}if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,i[r]))return!1;for(r=n;r--!==0;){const s=i[r];if(!(s==="_owner"&&t.$$typeof)&&!g4(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function ahe(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function mX(t,e){const n=ahe(t);return Math.round(e*n)/n}function U7(t){const e=_.useRef(t);return r2(()=>{e.current=t}),e}function Fst(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:o}={},transform:a=!0,whileElementsMounted:l,open:c}=t,[u,f]=_.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[h,d]=_.useState(r);g4(h,r)||d(r);const[p,g]=_.useState(null),[m,v]=_.useState(null),y=_.useCallback(I=>{I!==E.current&&(E.current=I,g(I))},[]),b=_.useCallback(I=>{I!==T.current&&(T.current=I,v(I))},[]),S=s||p,k=o||m,E=_.useRef(null),T=_.useRef(null),C=_.useRef(u),A=l!=null,R=U7(l),Q=U7(i),L=U7(c),z=_.useCallback(()=>{if(!E.current||!T.current)return;const I={placement:e,strategy:n,middleware:h};Q.current&&(I.platform=Q.current),zst(E.current,T.current,I).then(j=>{const M={...j,isPositioned:L.current!==!1};B.current&&!g4(C.current,M)&&(C.current=M,Qi.flushSync(()=>{f(M)}))})},[h,e,n,Q,L]);r2(()=>{c===!1&&C.current.isPositioned&&(C.current.isPositioned=!1,f(I=>({...I,isPositioned:!1})))},[c]);const B=_.useRef(!1);r2(()=>(B.current=!0,()=>{B.current=!1}),[]),r2(()=>{if(S&&(E.current=S),k&&(T.current=k),S&&k){if(R.current)return R.current(S,k,z);z()}},[S,k,z,R,A]);const q=_.useMemo(()=>({reference:E,floating:T,setReference:y,setFloating:b}),[y,b]),Z=_.useMemo(()=>({reference:S,floating:k}),[S,k]),J=_.useMemo(()=>{const I={position:n,left:0,top:0};if(!Z.floating)return I;const j=mX(Z.floating,u.x),M=mX(Z.floating,u.y);return a?{...I,transform:"translate("+j+"px, "+M+"px)",...ahe(Z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:j,top:M}},[n,a,Z.floating,u.x,u.y]);return _.useMemo(()=>({...u,update:z,refs:q,elements:Z,floatingStyles:J}),[u,z,q,Z,J])}const Wst=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:i}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?pX({element:r.current,padding:i}).fn(n):{}:r?pX({element:r,padding:i}).fn(n):{}}}},Vst=(t,e)=>({...Dst(t),options:[t,e]}),Ust=(t,e)=>({...Lst(t),options:[t,e]}),qst=(t,e)=>({...Bst(t),options:[t,e]}),Xst=(t,e)=>({...Nst(t),options:[t,e]}),Hst=(t,e)=>({...Qst(t),options:[t,e]}),Zst=(t,e)=>({...jst(t),options:[t,e]}),Yst=(t,e)=>({...Wst(t),options:[t,e]});var Gst="Arrow",lhe=_.forwardRef((t,e)=>{const{children:n,width:r=10,height:i=5,...s}=t;return x.jsx(ps.svg,{...s,ref:e,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:x.jsx("polygon",{points:"0,0 30,0 15,10"})})});lhe.displayName=Gst;var Kst=lhe;function Jst(t){const[e,n]=_.useState(void 0);return _d(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let o,a;if("borderBoxSize"in s){const l=s.borderBoxSize,c=Array.isArray(l)?l[0]:l;o=c.inlineSize,a=c.blockSize}else o=t.offsetWidth,a=t.offsetHeight;n({width:o,height:a})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}var $D="Popper",[che,uhe]=_D($D),[eot,fhe]=che($D),hhe=t=>{const{__scopePopper:e,children:n}=t,[r,i]=_.useState(null);return x.jsx(eot,{scope:e,anchor:r,onAnchorChange:i,children:n})};hhe.displayName=$D;var dhe="PopperAnchor",phe=_.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...i}=t,s=fhe(dhe,n),o=_.useRef(null),a=Qs(e,o);return _.useEffect(()=>{s.onAnchorChange((r==null?void 0:r.current)||o.current)}),r?null:x.jsx(ps.div,{...i,ref:a})});phe.displayName=dhe;var MD="PopperContent",[tot,not]=che(MD),mhe=_.forwardRef((t,e)=>{var F,oe,le,pe,De,xe;const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:s="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:u=0,sticky:f="partial",hideWhenDetached:h=!1,updatePositionStrategy:d="optimized",onPlaced:p,...g}=t,m=fhe(MD,n),[v,y]=_.useState(null),b=Qs(e,je=>y(je)),[S,k]=_.useState(null),E=Jst(S),T=(E==null?void 0:E.width)??0,C=(E==null?void 0:E.height)??0,A=r+(s!=="center"?"-"+s:""),R=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},Q=Array.isArray(c)?c:[c],L=Q.length>0,z={padding:R,boundary:Q.filter(iot),altBoundary:L},{refs:B,floatingStyles:q,placement:Z,isPositioned:J,middlewareData:I}=Fst({strategy:"fixed",placement:A,whileElementsMounted:(...je)=>Ist(...je,{animationFrame:d==="always"}),elements:{reference:m.anchor},middleware:[Vst({mainAxis:i+C,alignmentAxis:o}),l&&Ust({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?qst():void 0,...z}),l&&Xst({...z}),Hst({...z,apply:({elements:je,rects:He,availableWidth:nt,availableHeight:xt})=>{const{width:Ze,height:Oe}=He.reference,be=je.floating.style;be.setProperty("--radix-popper-available-width",`${nt}px`),be.setProperty("--radix-popper-available-height",`${xt}px`),be.setProperty("--radix-popper-anchor-width",`${Ze}px`),be.setProperty("--radix-popper-anchor-height",`${Oe}px`)}}),S&&Yst({element:S,padding:a}),sot({arrowWidth:T,arrowHeight:C}),h&&Zst({strategy:"referenceHidden",...z})]}),[j,M]=Ohe(Z),X=Na(p);_d(()=>{J&&(X==null||X())},[J,X]);const se=(F=I.arrow)==null?void 0:F.x,H=(oe=I.arrow)==null?void 0:oe.y,de=((le=I.arrow)==null?void 0:le.centerOffset)!==0,[fe,ve]=_.useState();return _d(()=>{v&&ve(window.getComputedStyle(v).zIndex)},[v]),x.jsx("div",{ref:B.setFloating,"data-radix-popper-content-wrapper":"",style:{...q,transform:J?q.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:fe,["--radix-popper-transform-origin"]:[(pe=I.transformOrigin)==null?void 0:pe.x,(De=I.transformOrigin)==null?void 0:De.y].join(" "),...((xe=I.hide)==null?void 0:xe.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:x.jsx(tot,{scope:n,placedSide:j,onArrowChange:k,arrowX:se,arrowY:H,shouldHideArrow:de,children:x.jsx(ps.div,{"data-side":j,"data-align":M,...g,ref:b,style:{...g.style,animation:J?void 0:"none"}})})})});mhe.displayName=MD;var ghe="PopperArrow",rot={top:"bottom",right:"left",bottom:"top",left:"right"},vhe=_.forwardRef(function(e,n){const{__scopePopper:r,...i}=e,s=not(ghe,r),o=rot[s.placedSide];return x.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:x.jsx(Kst,{...i,ref:n,style:{...i.style,display:"block"}})})});vhe.displayName=ghe;function iot(t){return t!==null}var sot=t=>({name:"transformOrigin",options:t,fn(e){var m,v,y;const{placement:n,rects:r,middlewareData:i}=e,o=((m=i.arrow)==null?void 0:m.centerOffset)!==0,a=o?0:t.arrowWidth,l=o?0:t.arrowHeight,[c,u]=Ohe(n),f={start:"0%",center:"50%",end:"100%"}[u],h=(((v=i.arrow)==null?void 0:v.x)??0)+a/2,d=(((y=i.arrow)==null?void 0:y.y)??0)+l/2;let p="",g="";return c==="bottom"?(p=o?f:`${h}px`,g=`${-l}px`):c==="top"?(p=o?f:`${h}px`,g=`${r.floating.height+l}px`):c==="right"?(p=`${-l}px`,g=o?f:`${d}px`):c==="left"&&(p=`${r.floating.width+l}px`,g=o?f:`${d}px`),{data:{x:p,y:g}}}});function Ohe(t){const[e,n="center"]=t.split("-");return[e,n]}var oot=hhe,aot=phe,lot=mhe,cot=vhe,uot="Portal",yhe=_.forwardRef((t,e)=>{var a;const{container:n,...r}=t,[i,s]=_.useState(!1);_d(()=>s(!0),[]);const o=n||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?MR.createPortal(x.jsx(ps.div,{...r,ref:e}),o):null});yhe.displayName=uot;function fot(t,e){return _.useReducer((n,r)=>e[n][r]??n,t)}var tb=t=>{const{present:e,children:n}=t,r=hot(e),i=typeof n=="function"?n({present:r.isPresent}):_.Children.only(n),s=Qs(r.ref,dot(i));return typeof n=="function"||r.isPresent?_.cloneElement(i,{ref:s}):null};tb.displayName="Presence";function hot(t){const[e,n]=_.useState(),r=_.useRef({}),i=_.useRef(t),s=_.useRef("none"),o=t?"mounted":"unmounted",[a,l]=fot(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return _.useEffect(()=>{const c=Cw(r.current);s.current=a==="mounted"?c:"none"},[a]),_d(()=>{const c=r.current,u=i.current;if(u!==t){const h=s.current,d=Cw(c);t?l("MOUNT"):d==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&h!==d?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,l]),_d(()=>{if(e){let c;const u=e.ownerDocument.defaultView??window,f=d=>{const g=Cw(r.current).includes(d.animationName);if(d.target===e&&g&&(l("ANIMATION_END"),!i.current)){const m=e.style.animationFillMode;e.style.animationFillMode="forwards",c=u.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=m)})}},h=d=>{d.target===e&&(s.current=Cw(r.current))};return e.addEventListener("animationstart",h),e.addEventListener("animationcancel",f),e.addEventListener("animationend",f),()=>{u.clearTimeout(c),e.removeEventListener("animationstart",h),e.removeEventListener("animationcancel",f),e.removeEventListener("animationend",f)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:_.useCallback(c=>{c&&(r.current=getComputedStyle(c)),n(c)},[])}}function Cw(t){return(t==null?void 0:t.animationName)||"none"}function dot(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var q7="rovingFocusGroup.onEntryFocus",pot={bubbles:!1,cancelable:!0},K3="RovingFocusGroup",[PA,bhe,mot]=qfe(K3),[got,xhe]=_D(K3,[mot]),[vot,Oot]=got(K3),whe=_.forwardRef((t,e)=>x.jsx(PA.Provider,{scope:t.__scopeRovingFocusGroup,children:x.jsx(PA.Slot,{scope:t.__scopeRovingFocusGroup,children:x.jsx(yot,{...t,ref:e})})}));whe.displayName=K3;var yot=_.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:s,currentTabStopId:o,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...f}=t,h=_.useRef(null),d=Qs(e,h),p=Xfe(s),[g=null,m]=Vfe({prop:o,defaultProp:a,onChange:l}),[v,y]=_.useState(!1),b=Na(c),S=bhe(n),k=_.useRef(!1),[E,T]=_.useState(0);return _.useEffect(()=>{const C=h.current;if(C)return C.addEventListener(q7,b),()=>C.removeEventListener(q7,b)},[b]),x.jsx(vot,{scope:n,orientation:r,dir:p,loop:i,currentTabStopId:g,onItemFocus:_.useCallback(C=>m(C),[m]),onItemShiftTab:_.useCallback(()=>y(!0),[]),onFocusableItemAdd:_.useCallback(()=>T(C=>C+1),[]),onFocusableItemRemove:_.useCallback(()=>T(C=>C-1),[]),children:x.jsx(ps.div,{tabIndex:v||E===0?-1:0,"data-orientation":r,...f,ref:d,style:{outline:"none",...t.style},onMouseDown:rn(t.onMouseDown,()=>{k.current=!0}),onFocus:rn(t.onFocus,C=>{const A=!k.current;if(C.target===C.currentTarget&&A&&!v){const R=new CustomEvent(q7,pot);if(C.currentTarget.dispatchEvent(R),!R.defaultPrevented){const Q=S().filter(Z=>Z.focusable),L=Q.find(Z=>Z.active),z=Q.find(Z=>Z.id===g),q=[L,z,...Q].filter(Boolean).map(Z=>Z.ref.current);khe(q,u)}}k.current=!1}),onBlur:rn(t.onBlur,()=>y(!1))})})}),She="RovingFocusGroupItem",_he=_.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:s,...o}=t,a=kA(),l=s||a,c=Oot(She,n),u=c.currentTabStopId===l,f=bhe(n),{onFocusableItemAdd:h,onFocusableItemRemove:d}=c;return _.useEffect(()=>{if(r)return h(),()=>d()},[r,h,d]),x.jsx(PA.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:x.jsx(ps.span,{tabIndex:u?0:-1,"data-orientation":c.orientation,...o,ref:e,onMouseDown:rn(t.onMouseDown,p=>{r?c.onItemFocus(l):p.preventDefault()}),onFocus:rn(t.onFocus,()=>c.onItemFocus(l)),onKeyDown:rn(t.onKeyDown,p=>{if(p.key==="Tab"&&p.shiftKey){c.onItemShiftTab();return}if(p.target!==p.currentTarget)return;const g=wot(p,c.orientation,c.dir);if(g!==void 0){if(p.metaKey||p.ctrlKey||p.altKey||p.shiftKey)return;p.preventDefault();let v=f().filter(y=>y.focusable).map(y=>y.ref.current);if(g==="last")v.reverse();else if(g==="prev"||g==="next"){g==="prev"&&v.reverse();const y=v.indexOf(p.currentTarget);v=c.loop?Sot(v,y+1):v.slice(y+1)}setTimeout(()=>khe(v))}})})})});_he.displayName=She;var bot={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function xot(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function wot(t,e,n){const r=xot(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return bot[r]}function khe(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function Sot(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var _ot=whe,kot=_he,Che=Nre(),X7=function(){},J3=_.forwardRef(function(t,e){var n=_.useRef(null),r=_.useState({onScrollCapture:X7,onWheelCapture:X7,onTouchMoveCapture:X7}),i=r[0],s=r[1],o=t.forwardProps,a=t.children,l=t.className,c=t.removeScrollBar,u=t.enabled,f=t.shards,h=t.sideCar,d=t.noIsolation,p=t.inert,g=t.allowPinchZoom,m=t.as,v=m===void 0?"div":m,y=t.gapMode,b=fM(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=h,k=Lre([n,e]),E=Fr(Fr({},b),i);return _.createElement(_.Fragment,null,u&&_.createElement(S,{sideCar:Che,removeScrollBar:c,shards:f,noIsolation:d,inert:p,setCallbacks:s,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?_.cloneElement(_.Children.only(a),Fr(Fr({},E),{ref:k})):_.createElement(v,Fr({},E,{className:l,ref:k}),a))});J3.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};J3.classNames={fullWidth:iv,zeroRight:rv};var AA=!1;if(typeof window<"u")try{var Ew=Object.defineProperty({},"passive",{get:function(){return AA=!0,!0}});window.addEventListener("test",Ew,Ew),window.removeEventListener("test",Ew,Ew)}catch{AA=!1}var E0=AA?{passive:!1}:!1,Cot=function(t){return t.tagName==="TEXTAREA"},Ehe=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!Cot(t)&&n[e]==="visible")},Eot=function(t){return Ehe(t,"overflowY")},Tot=function(t){return Ehe(t,"overflowX")},gX=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=The(t,r);if(i){var s=Phe(t,r),o=s[1],a=s[2];if(o>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Pot=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},Aot=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},The=function(t,e){return t==="v"?Eot(e):Tot(e)},Phe=function(t,e){return t==="v"?Pot(e):Aot(e)},Rot=function(t,e){return t==="h"&&e==="rtl"?-1:1},$ot=function(t,e,n,r,i){var s=Rot(t,window.getComputedStyle(e).direction),o=s*r,a=n.target,l=e.contains(a),c=!1,u=o>0,f=0,h=0;do{var d=Phe(t,a),p=d[0],g=d[1],m=d[2],v=g-m-s*p;(p||v)&&The(t,a)&&(f+=v,h+=p),a instanceof ShadowRoot?a=a.host:a=a.parentNode}while(!l&&a!==document.body||l&&(e.contains(a)||e===a));return(u&&(i&&Math.abs(f)<1||!i&&o>f)||!u&&(i&&Math.abs(h)<1||!i&&-o>h))&&(c=!0),c},Tw=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},vX=function(t){return[t.deltaX,t.deltaY]},OX=function(t){return t&&"current"in t?t.current:t},Mot=function(t,e){return t[0]===e[0]&&t[1]===e[1]},Iot=function(t){return`
349
349
  .block-interactivity-`.concat(t,` {pointer-events: none;}
350
350
  .allow-interactivity-`).concat(t,` {pointer-events: all;}
351
- `)},Dot=0,T0=[];function Lot(t){var e=_.useRef([]),n=_.useRef([0,0]),r=_.useRef(),i=_.useState(Dot++)[0],s=_.useState(hM)[0],o=_.useRef(t);_.useEffect(function(){o.current=t},[t]),_.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var g=S_([t.lockRef.current],(t.shards||[]).map(OX),!0).filter(Boolean);return g.forEach(function(m){return m.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),g.forEach(function(m){return m.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var a=_.useCallback(function(g,m){if("touches"in g&&g.touches.length===2||g.type==="wheel"&&g.ctrlKey)return!o.current.allowPinchZoom;var v=Tw(g),y=n.current,b="deltaX"in g?g.deltaX:y[0]-v[0],S="deltaY"in g?g.deltaY:y[1]-v[1],k,E=g.target,T=Math.abs(b)>Math.abs(S)?"h":"v";if("touches"in g&&T==="h"&&E.type==="range")return!1;var C=gX(T,E);if(!C)return!0;if(C?k=T:(k=T==="v"?"h":"v",C=gX(T,E)),!C)return!1;if(!r.current&&"changedTouches"in g&&(b||S)&&(r.current=k),!k)return!0;var A=r.current||k;return $ot(A,m,g,A==="h"?b:S,!0)},[]),l=_.useCallback(function(g){var m=g;if(!(!T0.length||T0[T0.length-1]!==s)){var v="deltaY"in m?vX(m):Tw(m),y=e.current.filter(function(k){return k.name===m.type&&(k.target===m.target||m.target===k.shadowParent)&&Mot(k.delta,v)})[0];if(y&&y.should){m.cancelable&&m.preventDefault();return}if(!y){var b=(o.current.shards||[]).map(OX).filter(Boolean).filter(function(k){return k.contains(m.target)}),S=b.length>0?a(m,b[0]):!o.current.noIsolation;S&&m.cancelable&&m.preventDefault()}}},[]),c=_.useCallback(function(g,m,v,y){var b={name:g,delta:m,target:v,should:y,shadowParent:Not(v)};e.current.push(b),setTimeout(function(){e.current=e.current.filter(function(S){return S!==b})},1)},[]),u=_.useCallback(function(g){n.current=Tw(g),r.current=void 0},[]),f=_.useCallback(function(g){c(g.type,vX(g),g.target,a(g,t.lockRef.current))},[]),h=_.useCallback(function(g){c(g.type,Tw(g),g.target,a(g,t.lockRef.current))},[]);_.useEffect(function(){return T0.push(s),t.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",l,E0),document.addEventListener("touchmove",l,E0),document.addEventListener("touchstart",u,E0),function(){T0=T0.filter(function(g){return g!==s}),document.removeEventListener("wheel",l,E0),document.removeEventListener("touchmove",l,E0),document.removeEventListener("touchstart",u,E0)}},[]);var d=t.removeScrollBar,p=t.inert;return _.createElement(_.Fragment,null,p?_.createElement(s,{styles:Iot(i)}):null,d?_.createElement(zre,{gapMode:t.gapMode}):null)}function Not(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const Qot=jre(Che,Lot);var Ahe=_.forwardRef(function(t,e){return _.createElement(J3,Fr({},t,{ref:e,sideCar:Qot}))});Ahe.classNames=J3.classNames;const jot=Ahe;var RA=["Enter"," "],Bot=["ArrowDown","PageUp","Home"],Rhe=["ArrowUp","PageDown","End"],zot=[...Bot,...Rhe],Fot={ltr:[...RA,"ArrowRight"],rtl:[...RA,"ArrowLeft"]},Wot={ltr:["ArrowLeft"],rtl:["ArrowRight"]},nb="Menu",[QO,Vot,Uot]=qfe(nb),[Gd,$he]=Wfe(nb,[Uot,uhe,xhe]),ek=uhe(),Mhe=xhe(),[qot,Kd]=Gd(nb),[Xot,rb]=Gd(nb),Ihe=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:i,onOpenChange:s,modal:o=!0}=t,a=ek(e),[l,c]=_.useState(null),u=_.useRef(!1),f=Na(s),h=Xfe(i);return _.useEffect(()=>{const d=()=>{u.current=!0,document.addEventListener("pointerdown",p,{capture:!0,once:!0}),document.addEventListener("pointermove",p,{capture:!0,once:!0})},p=()=>u.current=!1;return document.addEventListener("keydown",d,{capture:!0}),()=>{document.removeEventListener("keydown",d,{capture:!0}),document.removeEventListener("pointerdown",p,{capture:!0}),document.removeEventListener("pointermove",p,{capture:!0})}},[]),x.jsx(oot,{...a,children:x.jsx(qot,{scope:e,open:n,onOpenChange:f,content:l,onContentChange:c,children:x.jsx(Xot,{scope:e,onClose:_.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:u,dir:h,modal:o,children:r})})})};Ihe.displayName=nb;var Hot="MenuAnchor",ID=_.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,i=ek(n);return x.jsx(aot,{...i,...r,ref:e})});ID.displayName=Hot;var DD="MenuPortal",[Zot,Dhe]=Gd(DD,{forceMount:void 0}),Lhe=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:i}=t,s=Kd(DD,e);return x.jsx(Zot,{scope:e,forceMount:n,children:x.jsx(tb,{present:n||s.open,children:x.jsx(yhe,{asChild:!0,container:i,children:r})})})};Lhe.displayName=DD;var qo="MenuContent",[Yot,LD]=Gd(qo),Nhe=_.forwardRef((t,e)=>{const n=Dhe(qo,t.__scopeMenu),{forceMount:r=n.forceMount,...i}=t,s=Kd(qo,t.__scopeMenu),o=rb(qo,t.__scopeMenu);return x.jsx(QO.Provider,{scope:t.__scopeMenu,children:x.jsx(tb,{present:r||s.open,children:x.jsx(QO.Slot,{scope:t.__scopeMenu,children:o.modal?x.jsx(Got,{...i,ref:e}):x.jsx(Kot,{...i,ref:e})})})})}),Got=_.forwardRef((t,e)=>{const n=Kd(qo,t.__scopeMenu),r=_.useRef(null),i=Qs(e,r);return _.useEffect(()=>{const s=r.current;if(s)return G5(s)},[]),x.jsx(ND,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:rn(t.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Kot=_.forwardRef((t,e)=>{const n=Kd(qo,t.__scopeMenu);return x.jsx(ND,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),ND=_.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:f,onInteractOutside:h,onDismiss:d,disableOutsideScroll:p,...g}=t,m=Kd(qo,n),v=rb(qo,n),y=ek(n),b=Mhe(n),S=Vot(n),[k,E]=_.useState(null),T=_.useRef(null),C=Qs(e,T,m.onContentChange),A=_.useRef(0),R=_.useRef(""),Q=_.useRef(0),L=_.useRef(null),z=_.useRef("right"),B=_.useRef(0),q=p?jot:_.Fragment,Z=p?{as:DO,allowPinchZoom:!0}:void 0,J=j=>{var F,oe;const M=R.current+j,X=S().filter(le=>!le.disabled),se=document.activeElement,H=(F=X.find(le=>le.ref.current===se))==null?void 0:F.textValue,de=X.map(le=>le.textValue),fe=uat(de,M,H),ve=(oe=X.find(le=>le.textValue===fe))==null?void 0:oe.ref.current;(function le(pe){R.current=pe,window.clearTimeout(A.current),pe!==""&&(A.current=window.setTimeout(()=>le(""),1e3))})(M),ve&&setTimeout(()=>ve.focus())};_.useEffect(()=>()=>window.clearTimeout(A.current),[]),Vit();const I=_.useCallback(j=>{var X,se;return z.current===((X=L.current)==null?void 0:X.side)&&hat(j,(se=L.current)==null?void 0:se.area)},[]);return x.jsx(Yot,{scope:n,searchRef:R,onItemEnter:_.useCallback(j=>{I(j)&&j.preventDefault()},[I]),onItemLeave:_.useCallback(j=>{var M;I(j)||((M=T.current)==null||M.focus(),E(null))},[I]),onTriggerLeave:_.useCallback(j=>{I(j)&&j.preventDefault()},[I]),pointerGraceTimerRef:Q,onPointerGraceIntentChange:_.useCallback(j=>{L.current=j},[]),children:x.jsx(q,{...Z,children:x.jsx(Gfe,{asChild:!0,trapped:i,onMountAutoFocus:rn(s,j=>{var M;j.preventDefault(),(M=T.current)==null||M.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:x.jsx(Zfe,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:f,onInteractOutside:h,onDismiss:d,children:x.jsx(_ot,{asChild:!0,...b,dir:v.dir,orientation:"vertical",loop:r,currentTabStopId:k,onCurrentTabStopIdChange:E,onEntryFocus:rn(l,j=>{v.isUsingKeyboardRef.current||j.preventDefault()}),preventScrollOnEntryFocus:!0,children:x.jsx(lot,{role:"menu","aria-orientation":"vertical","data-state":Jhe(m.open),"data-radix-menu-content":"",dir:v.dir,...y,...g,ref:C,style:{outline:"none",...g.style},onKeyDown:rn(g.onKeyDown,j=>{const X=j.target.closest("[data-radix-menu-content]")===j.currentTarget,se=j.ctrlKey||j.altKey||j.metaKey,H=j.key.length===1;X&&(j.key==="Tab"&&j.preventDefault(),!se&&H&&J(j.key));const de=T.current;if(j.target!==de||!zot.includes(j.key))return;j.preventDefault();const ve=S().filter(F=>!F.disabled).map(F=>F.ref.current);Rhe.includes(j.key)&&ve.reverse(),lat(ve)}),onBlur:rn(t.onBlur,j=>{j.currentTarget.contains(j.target)||(window.clearTimeout(A.current),R.current="")}),onPointerMove:rn(t.onPointerMove,jO(j=>{const M=j.target,X=B.current!==j.clientX;if(j.currentTarget.contains(M)&&X){const se=j.clientX>B.current?"right":"left";z.current=se,B.current=j.clientX}}))})})})})})})});Nhe.displayName=qo;var Jot="MenuGroup",QD=_.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return x.jsx(ps.div,{role:"group",...r,ref:e})});QD.displayName=Jot;var eat="MenuLabel",Qhe=_.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return x.jsx(ps.div,{...r,ref:e})});Qhe.displayName=eat;var v4="MenuItem",yX="menu.itemSelect",tk=_.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...i}=t,s=_.useRef(null),o=rb(v4,t.__scopeMenu),a=LD(v4,t.__scopeMenu),l=Qs(e,s),c=_.useRef(!1),u=()=>{const f=s.current;if(!n&&f){const h=new CustomEvent(yX,{bubbles:!0,cancelable:!0});f.addEventListener(yX,d=>r==null?void 0:r(d),{once:!0}),Ufe(f,h),h.defaultPrevented?c.current=!1:o.onClose()}};return x.jsx(jhe,{...i,ref:l,disabled:n,onClick:rn(t.onClick,u),onPointerDown:f=>{var h;(h=t.onPointerDown)==null||h.call(t,f),c.current=!0},onPointerUp:rn(t.onPointerUp,f=>{var h;c.current||(h=f.currentTarget)==null||h.click()}),onKeyDown:rn(t.onKeyDown,f=>{const h=a.searchRef.current!=="";n||h&&f.key===" "||RA.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});tk.displayName=v4;var jhe=_.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...s}=t,o=LD(v4,n),a=Mhe(n),l=_.useRef(null),c=Qs(e,l),[u,f]=_.useState(!1),[h,d]=_.useState("");return _.useEffect(()=>{const p=l.current;p&&d((p.textContent??"").trim())},[s.children]),x.jsx(QO.ItemSlot,{scope:n,disabled:r,textValue:i??h,children:x.jsx(kot,{asChild:!0,...a,focusable:!r,children:x.jsx(ps.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:c,onPointerMove:rn(t.onPointerMove,jO(p=>{r?o.onItemLeave(p):(o.onItemEnter(p),p.defaultPrevented||p.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:rn(t.onPointerLeave,jO(p=>o.onItemLeave(p))),onFocus:rn(t.onFocus,()=>f(!0)),onBlur:rn(t.onBlur,()=>f(!1))})})})}),tat="MenuCheckboxItem",Bhe=_.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...i}=t;return x.jsx(Uhe,{scope:t.__scopeMenu,checked:n,children:x.jsx(tk,{role:"menuitemcheckbox","aria-checked":O4(n)?"mixed":n,...i,ref:e,"data-state":BD(n),onSelect:rn(i.onSelect,()=>r==null?void 0:r(O4(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Bhe.displayName=tat;var zhe="MenuRadioGroup",[nat,rat]=Gd(zhe,{value:void 0,onValueChange:()=>{}}),Fhe=_.forwardRef((t,e)=>{const{value:n,onValueChange:r,...i}=t,s=Na(r);return x.jsx(nat,{scope:t.__scopeMenu,value:n,onValueChange:s,children:x.jsx(QD,{...i,ref:e})})});Fhe.displayName=zhe;var Whe="MenuRadioItem",Vhe=_.forwardRef((t,e)=>{const{value:n,...r}=t,i=rat(Whe,t.__scopeMenu),s=n===i.value;return x.jsx(Uhe,{scope:t.__scopeMenu,checked:s,children:x.jsx(tk,{role:"menuitemradio","aria-checked":s,...r,ref:e,"data-state":BD(s),onSelect:rn(r.onSelect,()=>{var o;return(o=i.onValueChange)==null?void 0:o.call(i,n)},{checkForDefaultPrevented:!1})})})});Vhe.displayName=Whe;var jD="MenuItemIndicator",[Uhe,iat]=Gd(jD,{checked:!1}),qhe=_.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...i}=t,s=iat(jD,n);return x.jsx(tb,{present:r||O4(s.checked)||s.checked===!0,children:x.jsx(ps.span,{...i,ref:e,"data-state":BD(s.checked)})})});qhe.displayName=jD;var sat="MenuSeparator",Xhe=_.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return x.jsx(ps.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});Xhe.displayName=sat;var oat="MenuArrow",Hhe=_.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,i=ek(n);return x.jsx(cot,{...i,...r,ref:e})});Hhe.displayName=oat;var aat="MenuSub",[xEt,Zhe]=Gd(aat),A1="MenuSubTrigger",Yhe=_.forwardRef((t,e)=>{const n=Kd(A1,t.__scopeMenu),r=rb(A1,t.__scopeMenu),i=Zhe(A1,t.__scopeMenu),s=LD(A1,t.__scopeMenu),o=_.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=s,c={__scopeMenu:t.__scopeMenu},u=_.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return _.useEffect(()=>u,[u]),_.useEffect(()=>{const f=a.current;return()=>{window.clearTimeout(f),l(null)}},[a,l]),x.jsx(ID,{asChild:!0,...c,children:x.jsx(jhe,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":Jhe(n.open),...t,ref:H3(e,i.onTriggerChange),onClick:f=>{var h;(h=t.onClick)==null||h.call(t,f),!(t.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:rn(t.onPointerMove,jO(f=>{s.onItemEnter(f),!f.defaultPrevented&&!t.disabled&&!n.open&&!o.current&&(s.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:rn(t.onPointerLeave,jO(f=>{var d,p;u();const h=(d=n.content)==null?void 0:d.getBoundingClientRect();if(h){const g=(p=n.content)==null?void 0:p.dataset.side,m=g==="right",v=m?-5:5,y=h[m?"left":"right"],b=h[m?"right":"left"];s.onPointerGraceIntentChange({area:[{x:f.clientX+v,y:f.clientY},{x:y,y:h.top},{x:b,y:h.top},{x:b,y:h.bottom},{x:y,y:h.bottom}],side:g}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(f),f.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:rn(t.onKeyDown,f=>{var d;const h=s.searchRef.current!=="";t.disabled||h&&f.key===" "||Fot[r.dir].includes(f.key)&&(n.onOpenChange(!0),(d=n.content)==null||d.focus(),f.preventDefault())})})})});Yhe.displayName=A1;var Ghe="MenuSubContent",Khe=_.forwardRef((t,e)=>{const n=Dhe(qo,t.__scopeMenu),{forceMount:r=n.forceMount,...i}=t,s=Kd(qo,t.__scopeMenu),o=rb(qo,t.__scopeMenu),a=Zhe(Ghe,t.__scopeMenu),l=_.useRef(null),c=Qs(e,l);return x.jsx(QO.Provider,{scope:t.__scopeMenu,children:x.jsx(tb,{present:r||s.open,children:x.jsx(QO.Slot,{scope:t.__scopeMenu,children:x.jsx(ND,{id:a.contentId,"aria-labelledby":a.triggerId,...i,ref:c,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:u=>{var f;o.isUsingKeyboardRef.current&&((f=l.current)==null||f.focus()),u.preventDefault()},onCloseAutoFocus:u=>u.preventDefault(),onFocusOutside:rn(t.onFocusOutside,u=>{u.target!==a.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:rn(t.onEscapeKeyDown,u=>{o.onClose(),u.preventDefault()}),onKeyDown:rn(t.onKeyDown,u=>{var d;const f=u.currentTarget.contains(u.target),h=Wot[o.dir].includes(u.key);f&&h&&(s.onOpenChange(!1),(d=a.trigger)==null||d.focus(),u.preventDefault())})})})})})});Khe.displayName=Ghe;function Jhe(t){return t?"open":"closed"}function O4(t){return t==="indeterminate"}function BD(t){return O4(t)?"indeterminate":t?"checked":"unchecked"}function lat(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function cat(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function uat(t,e,n){const i=e.length>1&&Array.from(e).every(c=>c===e[0])?e[0]:e,s=n?t.indexOf(n):-1;let o=cat(t,Math.max(s,0));i.length===1&&(o=o.filter(c=>c!==n));const l=o.find(c=>c.toLowerCase().startsWith(i.toLowerCase()));return l!==n?l:void 0}function fat(t,e){const{x:n,y:r}=t;let i=!1;for(let s=0,o=e.length-1;s<e.length;o=s++){const a=e[s].x,l=e[s].y,c=e[o].x,u=e[o].y;l>r!=u>r&&n<(c-a)*(r-l)/(u-l)+a&&(i=!i)}return i}function hat(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return fat(n,e)}function jO(t){return e=>e.pointerType==="mouse"?t(e):void 0}var dat=Ihe,pat=ID,mat=Lhe,gat=Nhe,vat=QD,Oat=Qhe,yat=tk,bat=Bhe,xat=Fhe,wat=Vhe,Sat=qhe,_at=Xhe,kat=Hhe,Cat=Yhe,Eat=Khe,zD="DropdownMenu",[Tat,wEt]=Wfe(zD,[$he]),ms=$he(),[Pat,ede]=Tat(zD),tde=t=>{const{__scopeDropdownMenu:e,children:n,dir:r,open:i,defaultOpen:s,onOpenChange:o,modal:a=!0}=t,l=ms(e),c=_.useRef(null),[u=!1,f]=Vfe({prop:i,defaultProp:s,onChange:o});return x.jsx(Pat,{scope:e,triggerId:kA(),triggerRef:c,contentId:kA(),open:u,onOpenChange:f,onOpenToggle:_.useCallback(()=>f(h=>!h),[f]),modal:a,children:x.jsx(dat,{...l,open:u,onOpenChange:f,dir:r,modal:a,children:n})})};tde.displayName=zD;var nde="DropdownMenuTrigger",rde=_.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...i}=t,s=ede(nde,n),o=ms(n);return x.jsx(pat,{asChild:!0,...o,children:x.jsx(ps.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...i,ref:H3(e,s.triggerRef),onPointerDown:rn(t.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(s.onOpenToggle(),s.open||a.preventDefault())}),onKeyDown:rn(t.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&s.onOpenToggle(),a.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});rde.displayName=nde;var Aat="DropdownMenuPortal",ide=t=>{const{__scopeDropdownMenu:e,...n}=t,r=ms(e);return x.jsx(mat,{...r,...n})};ide.displayName=Aat;var sde="DropdownMenuContent",ode=_.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=ede(sde,n),s=ms(n),o=_.useRef(!1);return x.jsx(gat,{id:i.contentId,"aria-labelledby":i.triggerId,...s,...r,ref:e,onCloseAutoFocus:rn(t.onCloseAutoFocus,a=>{var l;o.current||(l=i.triggerRef.current)==null||l.focus(),o.current=!1,a.preventDefault()}),onInteractOutside:rn(t.onInteractOutside,a=>{const l=a.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,u=l.button===2||c;(!i.modal||u)&&(o.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});ode.displayName=sde;var Rat="DropdownMenuGroup",$at=_.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=ms(n);return x.jsx(vat,{...i,...r,ref:e})});$at.displayName=Rat;var Mat="DropdownMenuLabel",Iat=_.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=ms(n);return x.jsx(Oat,{...i,...r,ref:e})});Iat.displayName=Mat;var Dat="DropdownMenuItem",ade=_.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=ms(n);return x.jsx(yat,{...i,...r,ref:e})});ade.displayName=Dat;var Lat="DropdownMenuCheckboxItem",Nat=_.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=ms(n);return x.jsx(bat,{...i,...r,ref:e})});Nat.displayName=Lat;var Qat="DropdownMenuRadioGroup",jat=_.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=ms(n);return x.jsx(xat,{...i,...r,ref:e})});jat.displayName=Qat;var Bat="DropdownMenuRadioItem",zat=_.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=ms(n);return x.jsx(wat,{...i,...r,ref:e})});zat.displayName=Bat;var Fat="DropdownMenuItemIndicator",Wat=_.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=ms(n);return x.jsx(Sat,{...i,...r,ref:e})});Wat.displayName=Fat;var Vat="DropdownMenuSeparator",Uat=_.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=ms(n);return x.jsx(_at,{...i,...r,ref:e})});Uat.displayName=Vat;var qat="DropdownMenuArrow",Xat=_.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=ms(n);return x.jsx(kat,{...i,...r,ref:e})});Xat.displayName=qat;var Hat="DropdownMenuSubTrigger",Zat=_.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=ms(n);return x.jsx(Cat,{...i,...r,ref:e})});Zat.displayName=Hat;var Yat="DropdownMenuSubContent",Gat=_.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=ms(n);return x.jsx(Eat,{...i,...r,ref:e,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Gat.displayName=Yat;var lde=tde,Kat=rde,Jat=ide,cde=ode,ude=ade;function elt({onChange:t,config:e}){const n=e.colorChoices??[],r=()=>{const a=[...n,{color:"#ff0000",description:""}];t("colorChoices",()=>a)},i=a=>{const l=n.filter((c,u)=>u!==a);t("colorChoices",()=>l)},s=(a,l)=>{const c=n.map((u,f)=>f===a?{...u,color:l}:u);t("colorChoices",()=>c)},o=(a,l)=>{const c=n.map((u,f)=>f===a?{...u,description:l}:u);t("colorChoices",()=>c)};return x.jsx(fde,{colors:n,addColor:r,removeColor:i,updateColor:s,updateDescription:o})}const fde=({colors:t,addColor:e,removeColor:n,updateColor:r,updateDescription:i})=>x.jsxs(x.Fragment,{children:[x.jsxs("button",{onClick:e,className:"my-1 flex cursor-pointer items-center justify-between rounded-xl bg-setta-100 px-3 py-0.5 uppercase text-setta-500 hover:bg-setta-200 dark:bg-setta-850 dark:text-setta-500 dark:hover:bg-setta-850","aria-label":"Add color",children:[x.jsx("p",{className:"text-sm font-black ",children:"Add Colors"}),x.jsx("i",{className:"gg-add !scale-90"})]}),x.jsx("div",{className:"flex flex-col gap-2 overflow-y-auto",children:t.map(({color:s,description:o},a)=>x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsxs("div",{className:"flex flex-auto items-center gap-1 overflow-hidden",children:[x.jsx("input",{type:"color",value:s,onChange:l=>r(a,l.target.value),className:"min-h-6 min-w-6 cursor-pointer rounded-full !border !border-solid !border-setta-500/20 p-0 dark:!border-setta-500/40 [&::-moz-color-swatch]:rounded"}),x.jsx("input",{type:"text",value:o,onChange:l=>i(a,l.target.value),placeholder:"Add description...",className:"h-[calc(100%_-_2px)] w-[calc(100%_-_2px)] truncate rounded border px-2 py-1 text-xs text-setta-700 focus:outline-none focus:ring-2 focus:ring-blue-500 dark:text-setta-400 dark:placeholder-setta-700"})]}),x.jsx("button",{onClick:()=>n(a),className:"flex cursor-pointer items-center rounded-full p-1 text-gray-400 hover:bg-gray-100 hover:text-gray-700","aria-label":"Remove color",children:x.jsx("i",{className:"gg-close !scale-75"})})]},a))})]});function FD({colorChoices:t,value:e,onChange:n,onEscape:r,wrapperClassName:i,colorPickerChoicesClasses:s,isDisabled:o}){const a=G8e(e);return x.jsx("div",{className:i,children:x.jsx(tlt,{colorChoices:t,value:a,onChange:n,onEscape:r,colorPickerChoicesClasses:s,isDisabled:o})})}function tlt({colorChoices:t,value:e,onChange:n,onEscape:r,colorPickerChoicesClasses:i,isDisabled:s}){const o={"--bg":e,background:"var(--bg)",color:"lch(from var(--bg) calc((49.44 - l) * infinity) 0 0)"};return(t==null?void 0:t.length)>0?x.jsx(nlt,{color:e,setColor:n,colorChoices:t,colorPickerChoicesClasses:i,isDisabled:s,onEscape:r}):x.jsxs(x.Fragment,{children:[x.jsx("i",{className:"gg-color-picker single-cell-child pointer-events-none mr-0.5 mt-0.5 place-self-center",style:o}),x.jsx("input",{id:"colorPicker",type:"color",value:e,onChange:a=>n(a.target.value),className:"single-cell-child flex !h-[calc(100%_-_2px)] min-h-0 !w-[calc(100%_-_2px)] min-w-0 cursor-pointer items-center justify-between overflow-hidden !rounded-lg !border !border-solid !border-setta-500/20 dark:!border-setta-500/40",disabled:s,onKeyDown:a=>{a.code==="Escape"&&(r==null||r())}})]})}function nlt({color:t,setColor:e,colorChoices:n,colorPickerChoicesClasses:r,isDisabled:i,onEscape:s}){let o=n.find(l=>l.color===t);o||(o=n[0]);const a={"--bg":o.color,background:"var(--bg)",color:"lch(from var(--bg) calc((49.44 - l) * infinity) 0 0)"};return x.jsxs(lde,{modal:!1,children:[x.jsxs(Kat,{className:r,disabled:i,onKeyDown:l=>{l.code==="Escape"&&(l.stopPropagation(),s==null||s())},children:[x.jsx("div",{className:"single-cell-child min-w-0s m-auto h-full min-h-0 w-full rounded-lg !border !border-solid !border-setta-500/20 dark:!border-setta-500/40",style:{backgroundColor:o.color}}),x.jsxs("div",{className:"single-cell-child flex items-center justify-between overflow-hidden",children:[x.jsx("p",{className:"ml-[2px] truncate pl-2.5 text-xs font-semibold @[90px]:inline-block",style:a,children:o.description}),x.jsx("i",{className:"gg-chevron-down px-2",style:a})]})]}),x.jsx(Jat,{children:x.jsx(cde,{className:"z-20 flex flex-col rounded bg-white p-2 shadow-md dark:bg-setta-800",align:"start",style:{minWidth:"var(--radix-dropdown-menu-trigger-width)"},children:n.map((l,c)=>x.jsxs(ude,{className:"flex cursor-pointer items-center rounded px-2 py-1 hover:bg-setta-100 dark:hover:bg-setta-700",onSelect:()=>e(l.color),children:[x.jsx("div",{className:"mr-2 h-4 w-4 rounded-full",style:{backgroundColor:l.color}}),x.jsx("p",{className:"max-w-48 truncate text-xs text-setta-500 dark:text-setta-300",children:l.description})]},c))})})]})}function rlt({sectionId:t}){return x.jsxs(x.Fragment,{children:[x.jsx(ilt,{sectionId:t}),x.jsx(dit,{sectionId:t,sectionTypeName:Y.DRAW})]})}function ilt({sectionId:t}){const e=te(o=>{var a;return((a=o.x[t].canvasSettings)==null?void 0:a.colorChoices)??[]},ae.isEqual),n=()=>{Pw(t,[...e,{color:"#000000",description:""}])},r=o=>{Pw(t,e.filter((a,l)=>l!==o))},i=(o,a)=>{Pw(t,e.map((l,c)=>c===o?{...l,color:a}:l))},s=(o,a)=>{Pw(t,e.map((l,c)=>c===o?{...l,description:a}:l))};return x.jsx(fde,{colors:e,addColor:n,removeColor:r,updateColor:i,updateDescription:s})}function Pw(t,e){te.setState(n=>{const r=n.x[t];r.canvasSettings.colorChoices=e})}function slt({sectionId:t}){const[e,n]=_.useState(""),[r,i]=_.useState(""),s=a=>a.toLowerCase().includes("<iframe")?"":"Input must contain an iframe tag",o=a=>{const l=a.target.value;n(l);const c=s(l);i(c),c||te.setState(u=>{u.x[t].iframeCode=l})};return x.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[x.jsxs("header",{className:"py-4",children:[x.jsx("h2",{className:"text-sm font-bold text-setta-700 dark:text-setta-300",children:"Iframe Code"}),x.jsx("p",{className:"text-xs text-setta-600 dark:text-setta-500",children:"Paste your iframe HTML below"})]}),x.jsxs("section",{className:"flex-1 overflow-y-auto",children:[x.jsx("textarea",{value:e,onChange:o,className:"h-48 w-full resize-y rounded-md border border-solid border-setta-200 bg-white/80 p-3 font-mono text-sm text-setta-800 placeholder-setta-300 focus:!border-blue-500 focus:outline-0 focus:ring-0 dark:border-setta-700 dark:bg-setta-900 dark:text-setta-300 dark:placeholder-setta-600",placeholder:"<iframe src='...'></iframe>",spellCheck:"false"}),r&&x.jsx("div",{className:"dark:red-500 my-2 rounded border border-red-600 bg-red-500 px-4 py-3 font-bold text-white",children:r})]})]})}function olt({sectionId:t}){return x.jsx(jfe,{sectionId:t,sectionTypeName:Y.IMAGE})}function alt(){return null}function WD({value:t,defaultVal:e,onChange:n,onEscape:r,isDisabled:i,outerDivClassName:s,twRootClasses:o,twThumbClasses:a}){const l=typeof t=="string"?t==="true":t;return x.jsx("div",{className:s,children:x.jsx(sM,{checked:l,disabled:i,onCheckedChange:n,twRootClasses:o,twThumbClasses:a,onKeyDown:c=>{c.code==="Escape"&&(c.stopPropagation(),r==null||r())}})})}async function llt(t){return await jt({body:{docstring:t},address:Y.ROUTE_DOCSTRING_TO_MARKDOWN})}function clt({sectionId:t}){const{renderMarkdown:e,description:n,variantIsFrozen:r}=Fte(t);async function i(s){let o;if(s){const a=await llt(n);o=a.status===200?a.data:n}else o=n;te.setState(a=>{Yt(t,a).description=o,a.x[t].renderMarkdown=s})}return x.jsxs("div",{className:"flex w-full items-center justify-between gap-4 ",children:[x.jsx("p",{className:"text-xs font-bold text-setta-700 dark:text-setta-300",children:"Render Markdown"}),x.jsx(WD,{isDisabled:r,value:e,onChange:i,outerDivClassName:"flex items-center"})]})}function ult({sectionId:t}){const e=te(s=>s.x[t].jsonSource),[n,r]=_.useState(e??"");async function i(s){const o=s.target.value;let a=null,l=null,c=null,u=null;if(o){const f=await gPe(t,o);f.status===200&&({codeInfo:a,codeInfoCols:l,sectionVariants:c,sections:u}=f.data.project)}te.setState(f=>{f.x[t].jsonSource=o,Z$({sections:u,sectionVariants:c,codeInfo:a,codeInfoCols:l,state:f})})}return _.useEffect(()=>{r(e??"")},[e]),x.jsx("div",{className:"mb-2 mt-2 w-full select-text",children:x.jsxs("div",{className:"flex w-full items-center gap-3",children:[x.jsx("p",{className:"select-none text-sm font-bold text-setta-400 dark:text-setta-600",children:"JSON Source"}),x.jsx("input",{className:"mr-[2px] w-full truncate rounded-full bg-white px-4 py-1 text-sm text-setta-700 ring-2 ring-setta-200 focus:ring-2 focus:ring-blue-500 dark:bg-setta-900 dark:text-setta-400 dark:ring-setta-700",value:n,onChange:s=>r(s.target.value),onBlur:i})]})})}function flt({sectionId:t}){const e=te(s=>s.x[t].social),[n,r]=_.useState(e??"");function i(s){const o=s.target.value;o&&te.setState(a=>{a.x[t].social=o})}return x.jsx("div",{className:"mb-2 mt-2 w-full select-text",children:x.jsxs("div",{className:"flex w-full items-center gap-3",children:[x.jsx("p",{className:"select-none text-sm font-bold text-setta-400 dark:text-setta-600",children:"Social Media URL"}),x.jsx("input",{className:"mr-[2px] w-full truncate rounded-full bg-white px-4 py-1 text-sm text-setta-700 ring-2 ring-setta-200 focus:ring-2 focus:ring-blue-500 dark:bg-setta-900 dark:text-setta-400 dark:ring-setta-700",value:n,onChange:s=>r(s.target.value),onBlur:i,placeholder:"https://www.youtube.com/"})]})})}const hlt=ke.forwardRef(({sectionId:t},e)=>x.jsx(plt,{sectionId:t})),dlt=ke.memo(hlt);function plt({sectionId:t}){return x.jsx("div",{className:"flex min-h-0 flex-col gap-1 overflow-y-clip",children:x.jsx(mlt,{sectionId:t})})}function mlt({sectionId:t}){switch(te(n=>dn(t,n))){case Y.SECTION:case Y.GLOBAL_VARIABLES:return x.jsx(ult,{sectionId:t});case Y.CODE:return x.jsx(kit,{sectionId:t});case Y.INFO:return x.jsx(clt,{sectionId:t});case Y.DRAW:return x.jsx(rlt,{sectionId:t});case Y.IMAGE:return x.jsx(olt,{sectionId:t});case Y.CHART:return x.jsx(pit,{sectionId:t});case Y.SOCIAL:return x.jsx(flt,{sectionId:t});case Y.IFRAME:return x.jsx(slt,{sectionId:t})}}function glt(t){return ft({tag:"svg",attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M593.8 59.1H46.2C20.7 59.1 0 79.8 0 105.2v301.5c0 25.5 20.7 46.2 46.2 46.2h547.7c25.5 0 46.2-20.7 46.1-46.1V105.2c0-25.4-20.7-46.1-46.2-46.1zM338.5 360.6H277v-120l-61.5 76.9-61.5-76.9v120H92.3V151.4h61.5l61.5 76.9 61.5-76.9h61.5v209.2zm135.3 3.1L381.5 256H443V151.4h61.5V256H566z"},child:[]}]})(t)}function vlt(t){return ft({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M549.655 124.083c-6.281-23.65-24.787-42.276-48.284-48.597C458.781 64 288 64 288 64S117.22 64 74.629 75.486c-23.497 6.322-42.003 24.947-48.284 48.597-11.412 42.867-11.412 132.305-11.412 132.305s0 89.438 11.412 132.305c6.281 23.65 24.787 41.5 48.284 47.821C117.22 448 288 448 288 448s170.78 0 213.371-11.486c23.497-6.321 42.003-24.171 48.284-47.821 11.412-42.867 11.412-132.305 11.412-132.305s0-89.438-11.412-132.305zm-317.51 213.508V175.185l142.739 81.205-142.739 81.201z"},child:[]}]})(t)}function Olt(t){return ft({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z"},child:[]}]})(t)}function ylt(t){return ft({tag:"svg",attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M257.981 272.971L63.638 467.314c-9.373 9.373-24.569 9.373-33.941 0L7.029 444.647c-9.357-9.357-9.375-24.522-.04-33.901L161.011 256 6.99 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L257.981 239.03c9.373 9.372 9.373 24.568 0 33.941zM640 456v-32c0-13.255-10.745-24-24-24H312c-13.255 0-24 10.745-24 24v32c0 13.255 10.745 24 24 24h304c13.255 0 24-10.745 24-24z"},child:[]}]})(t)}function blt(t){return ft({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M440.1 355.2l-39.2-23 34.1-9.3c8.4-2.3 13.4-11.1 11.1-19.6l-4.1-15.5c-2.2-8.5-10.9-13.6-19.3-11.3L343 298.2 271.2 256l71.9-42.2 79.7 21.7c8.4 2.3 17-2.8 19.3-11.3l4.1-15.5c2.2-8.5-2.7-17.3-11.1-19.6l-34.1-9.3 39.2-23c7.5-4.4 10.1-14.2 5.8-21.9l-7.9-13.9c-4.3-7.7-14-10.3-21.5-5.9l-39.2 23 9.1-34.7c2.2-8.5-2.7-17.3-11.1-19.6l-15.2-4.1c-8.4-2.3-17 2.8-19.3 11.3l-21.3 81-71.9 42.2v-84.5L306 70.4c6.1-6.2 6.1-16.4 0-22.6l-11.1-11.3c-6.1-6.2-16.1-6.2-22.2 0l-24.9 25.4V16c0-8.8-7-16-15.7-16h-15.7c-8.7 0-15.7 7.2-15.7 16v46.1l-24.9-25.4c-6.1-6.2-16.1-6.2-22.2 0L142.1 48c-6.1 6.2-6.1 16.4 0 22.6l58.3 59.3v84.5l-71.9-42.2-21.3-81c-2.2-8.5-10.9-13.6-19.3-11.3L72.7 84c-8.4 2.3-13.4 11.1-11.1 19.6l9.1 34.7-39.2-23c-7.5-4.4-17.1-1.8-21.5 5.9l-7.9 13.9c-4.3 7.7-1.8 17.4 5.8 21.9l39.2 23-34.1 9.1c-8.4 2.3-13.4 11.1-11.1 19.6L6 224.2c2.2 8.5 10.9 13.6 19.3 11.3l79.7-21.7 71.9 42.2-71.9 42.2-79.7-21.7c-8.4-2.3-17 2.8-19.3 11.3l-4.1 15.5c-2.2 8.5 2.7 17.3 11.1 19.6l34.1 9.3-39.2 23c-7.5 4.4-10.1 14.2-5.8 21.9L10 391c4.3 7.7 14 10.3 21.5 5.9l39.2-23-9.1 34.7c-2.2 8.5 2.7 17.3 11.1 19.6l15.2 4.1c8.4 2.3 17-2.8 19.3-11.3l21.3-81 71.9-42.2v84.5l-58.3 59.3c-6.1 6.2-6.1 16.4 0 22.6l11.1 11.3c6.1 6.2 16.1 6.2 22.2 0l24.9-25.4V496c0 8.8 7 16 15.7 16h15.7c8.7 0 15.7-7.2 15.7-16v-46.1l24.9 25.4c6.1 6.2 16.1 6.2 22.2 0l11.1-11.3c6.1-6.2 6.1-16.4 0-22.6l-58.3-59.3v-84.5l71.9 42.2 21.3 81c2.2 8.5 10.9 13.6 19.3 11.3L375 428c8.4-2.3 13.4-11.1 11.1-19.6l-9.1-34.7 39.2 23c7.5 4.4 17.1 1.8 21.5-5.9l7.9-13.9c4.6-7.5 2.1-17.3-5.5-21.7z"},child:[]}]})(t)}async function xlt(t){return await jt({body:{filenameGlob:t},address:Y.ROUTE_NEW_JSON_VERSION_NAME})}function hde(t,e,n){const{variantId:r}=n.x[t],i=Yt(t,n).codeInfoColId,s=i?jRe(i,n):null,o=BRe(r,e,s,n);return n.x[t].variantId=o,n.x[t].variantIds.push(o),{newVariantId:o,oldVariantId:r}}async function wlt(t,e,n){if(e){const{name:r}=te.getState().variants[n];await vPe(t,r)}Vi("New Version Created")}async function Slt(t){if(t){const e=await xlt(t);if(e.status===200)return e.data}return Fm()}async function dde(t){const{jsonSource:e}=Pi(t),n=await Slt(e);let r,i;te.setState(s=>{({newVariantId:r,oldVariantId:i}=hde(t,n,s))}),Nd(t,r),wlt(t,e,i)}function pde(t,e){let n;te.setState(r=>{n=r.x[t].variantId,r.x[t].previewVariantId=e}),n!==e&&Nd(t,e)}function mde(t){te.setState(e=>{e.x[t].previewVariantId=null})}function gde(t,e){let n;te.setState(r=>{n=r.x[t].variantId,r.x[t].variantId=e}),n!==e&&Nd(t,e)}function _lt({sectionId:t}){const[e,n]=_.useState(!1);function r(){n(!e)}function i(){dde(t)}return x.jsxs("section",{className:"section-grid-cols section-grid-rows section-grid-areas -mx-3 -my-4 grid flex-1 self-stretch",children:[x.jsxs("header",{className:"absolute right-16 top-[15px] flex items-center gap-2",children:[!e&&x.jsx("button",{className:"flex cursor-pointer items-center justify-center gap-1 rounded-md px-2 py-1 text-xs font-bold text-setta-400 hover:bg-setta-500/20 hover:text-setta-600 dark:text-setta-600 dark:hover:text-setta-400",onClick:i,children:"Add Version"}),x.jsxs("button",{className:"flex cursor-pointer items-center justify-center gap-1 rounded-md px-2 py-1 text-xs font-bold text-setta-400 hover:bg-setta-500/20 hover:text-setta-600 dark:text-setta-600 dark:hover:text-setta-400",onClick:r,children:[x.jsx("i",{className:"gg-pen"}),e?"Done Editing":"Edit"]})]}),x.jsx("ul",{className:"section-full nodrag nowheel grid auto-rows-min grid-cols-subgrid gap-y-2 overflow-y-auto overflow-x-clip pt-6",onMouseLeave:()=>mde(t),children:x.jsx(klt,{sectionId:t,isEditing:e})})]})}function klt({sectionId:t,isEditing:e}){const{currVariantId:n,variantIds:r,defaultVariantId:i}=te(s=>({currVariantId:s.x[t].variantId,variantIds:s.x[t].variantIds,defaultVariantId:s.x[t].defaultVariantId}),ae.isEqual);return e?r.map(s=>x.jsx(Elt,{sectionId:t,id:s,isCurr:n===s,deletable:r.length>1},s)):r.map(s=>x.jsx(Clt,{sectionId:t,id:s,isCurr:n===s,isDefault:s===i},s))}function Clt({sectionId:t,id:e,isCurr:n,isDefault:r}){const{name:i,isFrozen:s}=te(o=>({name:o.variants[e].name,isFrozen:o.variants[e].isFrozen}),ae.isEqual);return x.jsxs("li",{onMouseEnter:()=>pde(t,e),onClick:()=>gde(t,e),className:"section-key-value group/versionitem -my-[0.125rem] flex h-min cursor-pointer items-center justify-between rounded-sm border-b border-transparent px-1 py-[0.125rem] text-xs hover:bg-setta-200/30 dark:hover:bg-setta-800/50",children:[x.jsx("p",{className:`section-key truncate ${n?"font-medium text-setta-600 group-hover/versionitem:text-setta-800 dark:text-setta-300 group-hover/versionitem:dark:text-setta-100":"text-setta-400 dark:text-setta-400"} `,children:i}),x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx("button",{className:`cursor-pointer bg-transparent ${r?"text-green-500":"text-transparent hover:!text-setta-400 group-hover/versionitem:text-setta-400/50"}`,onClick:o=>{o.stopPropagation(),NRe(t,e)},children:x.jsx(oM,{})}),x.jsx("button",{className:`cursor-pointer bg-transparent ${s?"text-blue-500":"text-transparent hover:!text-blue-400 group-hover/versionitem:text-setta-400/50"}`,onClick:o=>{o.stopPropagation(),LRe(e)},children:x.jsx(blt,{})})]})]})}function Elt({sectionId:t,id:e,isCurr:n,deletable:r}){const i=te(h=>h.variants[e].name,ae.isEqual);function s(h){te.setState(d=>{d.variants[e].name=h})}function o(h){const d=te.getState();for(const p of d.x[t].variantIds)if(d.variants[p].name===h)return!1;return!0}const[a,l,c,u]=IM(i,s,o);function f(h){h.stopPropagation(),zRe(t,e,n)}return x.jsxs("li",{className:"section-key-value group/versionitem -my-[0.125rem] flex h-min cursor-pointer items-center justify-between border-b border-setta-200 px-1 py-[0.125rem] text-xs focus-within:!border-blue-500 hover:border-setta-500 dark:border-setta-700 dark:hover:border-setta-500 ",children:[x.jsx("input",{value:a,onChange:l,onBlur:c,onKeyDown:u,className:"flex-1 truncate text-setta-500 focus:text-setta-900 focus:outline-none focus:ring-0 dark:text-setta-400 dark:focus:text-setta-200"}),r&&x.jsx("button",{className:"cursor-pointer bg-transparent text-transparent hover:!text-red-500 active:!text-red-700 group-hover/versionitem:text-setta-400/50",onClick:f,children:x.jsx("i",{className:"gg-trash"})})]})}function Tlt({sectionId:t,paramInfoId:e,configProps:n}){te.setState(r=>{const{uiTypeId:i,oldUITypeId:s}=Plt(t,e,r);yFe({uiTypeId:i,...n,state:r}),i!==s&&sI({uiTypeId:i,sectionId:t,paramInfoId:e,state:r}),Rlt(i,n.configName,r)})}function Plt(t,e,n){const r=n.codeInfo[e].name,{uiTypeColId:i}=n.x[t],s=n.uiTypeCols[i][e].nonPresetUITypeIds,o=Hy(t,e,n),a=mFe({currUIType:o,nonPresetUITypeIds:s,state:n});return a?{uiTypeId:a.id,oldUITypeId:o.id}:{uiTypeId:Alt({uiTypeColId:i,paramInfoId:e,currUIType:o,defaultName:r,state:n}).id,oldUITypeId:o.id}}function Alt({uiTypeColId:t,paramInfoId:e,currUIType:n,defaultName:r,state:i}){const s=eoe({uiType:n,name:r});return i.uiTypes[s.id]=s,i.uiTypeCols[t][e].nonPresetUITypeIds.push(s.id),s}function Rlt(t,e,n){const r=n.uiTypes[t];r.type===Y.SLIDER&&["min","max"].includes(e)&&$lt(r,n)}function $lt(t,e){const{variants:n,uiTypeCols:r}=e;for(const[i,s]of Object.entries(r)){const o=new Set;for(const[a,l]of Object.entries(s))l.uiTypeId===t.id&&o.add(a);if(o.size!==0){for(const a of Object.values(e.x))if(a.uiTypeColId===i){const l=a.variantId;for(const[c,u]of Object.entries(n[l].values))if(o.has(c)){const f=p$({uiType:t,currValue:u.value});f!==u.value&&Y$(l,c,f,e)}}}}}function Mlt(){function t(){Ra.setState({modalType:br.SAVE_UI_TYPE_CONFIG})}return x.jsx(aze,{asChild:!0,children:x.jsx(Fa,{size:"w-4 h-4",padding:"py-2 px-2",bg:"bg-transparent hover:bg-setta-100 dark:hover:bg-setta-800/50",onClick:t,children:x.jsx(bze,{className:"text-setta-500 dark:text-setta-600"})})})}const vde={whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1};function Ilt({divId:t,code:e,theme:n,onMouseDownCapture:r,onFocus:i,className:s,evRefs:o,placeholder:a,language:l}){return e?x.jsx(Llt,{divId:t,code:e,theme:n,onMouseDownCapture:r,onFocus:i,className:s,evRefs:o,language:l}):x.jsx(Dlt,{divId:t,className:s,placeholder:a,onMouseDownCapture:r,onFocus:i})}function Dlt({divId:t,className:e,placeholder:n,onMouseDownCapture:r,onFocus:i}){return x.jsx("span",{id:t,className:`${e} text-gray-600 outline-none`,style:vde,onMouseDownCapture:r,onFocus:i,tabIndex:"0",children:n||x.jsx("br",{})})}function Llt({divId:t,code:e,theme:n,onMouseDownCapture:r,className:i,evRefs:s,language:o,onFocus:a}){var A;const l=Nlt(o).parser.parse(e),c=n[1][2].value,u={},f=new Al,h={};for(const R of s)h[R.startPos]={keywordEndIdx:R.startPos+R.keyword.length,keyword:R.keyword};Hae(l,c,(R,Q,L)=>{f.add(R,Q,u[L]||(u[L]=ht.mark({class:L})))});const d=f.finish(),p=nn.of(e.split(`
351
+ `)},Dot=0,T0=[];function Lot(t){var e=_.useRef([]),n=_.useRef([0,0]),r=_.useRef(),i=_.useState(Dot++)[0],s=_.useState(hM)[0],o=_.useRef(t);_.useEffect(function(){o.current=t},[t]),_.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var g=S_([t.lockRef.current],(t.shards||[]).map(OX),!0).filter(Boolean);return g.forEach(function(m){return m.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),g.forEach(function(m){return m.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var a=_.useCallback(function(g,m){if("touches"in g&&g.touches.length===2||g.type==="wheel"&&g.ctrlKey)return!o.current.allowPinchZoom;var v=Tw(g),y=n.current,b="deltaX"in g?g.deltaX:y[0]-v[0],S="deltaY"in g?g.deltaY:y[1]-v[1],k,E=g.target,T=Math.abs(b)>Math.abs(S)?"h":"v";if("touches"in g&&T==="h"&&E.type==="range")return!1;var C=gX(T,E);if(!C)return!0;if(C?k=T:(k=T==="v"?"h":"v",C=gX(T,E)),!C)return!1;if(!r.current&&"changedTouches"in g&&(b||S)&&(r.current=k),!k)return!0;var A=r.current||k;return $ot(A,m,g,A==="h"?b:S,!0)},[]),l=_.useCallback(function(g){var m=g;if(!(!T0.length||T0[T0.length-1]!==s)){var v="deltaY"in m?vX(m):Tw(m),y=e.current.filter(function(k){return k.name===m.type&&(k.target===m.target||m.target===k.shadowParent)&&Mot(k.delta,v)})[0];if(y&&y.should){m.cancelable&&m.preventDefault();return}if(!y){var b=(o.current.shards||[]).map(OX).filter(Boolean).filter(function(k){return k.contains(m.target)}),S=b.length>0?a(m,b[0]):!o.current.noIsolation;S&&m.cancelable&&m.preventDefault()}}},[]),c=_.useCallback(function(g,m,v,y){var b={name:g,delta:m,target:v,should:y,shadowParent:Not(v)};e.current.push(b),setTimeout(function(){e.current=e.current.filter(function(S){return S!==b})},1)},[]),u=_.useCallback(function(g){n.current=Tw(g),r.current=void 0},[]),f=_.useCallback(function(g){c(g.type,vX(g),g.target,a(g,t.lockRef.current))},[]),h=_.useCallback(function(g){c(g.type,Tw(g),g.target,a(g,t.lockRef.current))},[]);_.useEffect(function(){return T0.push(s),t.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",l,E0),document.addEventListener("touchmove",l,E0),document.addEventListener("touchstart",u,E0),function(){T0=T0.filter(function(g){return g!==s}),document.removeEventListener("wheel",l,E0),document.removeEventListener("touchmove",l,E0),document.removeEventListener("touchstart",u,E0)}},[]);var d=t.removeScrollBar,p=t.inert;return _.createElement(_.Fragment,null,p?_.createElement(s,{styles:Iot(i)}):null,d?_.createElement(zre,{gapMode:t.gapMode}):null)}function Not(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const Qot=jre(Che,Lot);var Ahe=_.forwardRef(function(t,e){return _.createElement(J3,Fr({},t,{ref:e,sideCar:Qot}))});Ahe.classNames=J3.classNames;const jot=Ahe;var RA=["Enter"," "],Bot=["ArrowDown","PageUp","Home"],Rhe=["ArrowUp","PageDown","End"],zot=[...Bot,...Rhe],Fot={ltr:[...RA,"ArrowRight"],rtl:[...RA,"ArrowLeft"]},Wot={ltr:["ArrowLeft"],rtl:["ArrowRight"]},nb="Menu",[QO,Vot,Uot]=qfe(nb),[Gd,$he]=Wfe(nb,[Uot,uhe,xhe]),ek=uhe(),Mhe=xhe(),[qot,Kd]=Gd(nb),[Xot,rb]=Gd(nb),Ihe=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:i,onOpenChange:s,modal:o=!0}=t,a=ek(e),[l,c]=_.useState(null),u=_.useRef(!1),f=Na(s),h=Xfe(i);return _.useEffect(()=>{const d=()=>{u.current=!0,document.addEventListener("pointerdown",p,{capture:!0,once:!0}),document.addEventListener("pointermove",p,{capture:!0,once:!0})},p=()=>u.current=!1;return document.addEventListener("keydown",d,{capture:!0}),()=>{document.removeEventListener("keydown",d,{capture:!0}),document.removeEventListener("pointerdown",p,{capture:!0}),document.removeEventListener("pointermove",p,{capture:!0})}},[]),x.jsx(oot,{...a,children:x.jsx(qot,{scope:e,open:n,onOpenChange:f,content:l,onContentChange:c,children:x.jsx(Xot,{scope:e,onClose:_.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:u,dir:h,modal:o,children:r})})})};Ihe.displayName=nb;var Hot="MenuAnchor",ID=_.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,i=ek(n);return x.jsx(aot,{...i,...r,ref:e})});ID.displayName=Hot;var DD="MenuPortal",[Zot,Dhe]=Gd(DD,{forceMount:void 0}),Lhe=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:i}=t,s=Kd(DD,e);return x.jsx(Zot,{scope:e,forceMount:n,children:x.jsx(tb,{present:n||s.open,children:x.jsx(yhe,{asChild:!0,container:i,children:r})})})};Lhe.displayName=DD;var qo="MenuContent",[Yot,LD]=Gd(qo),Nhe=_.forwardRef((t,e)=>{const n=Dhe(qo,t.__scopeMenu),{forceMount:r=n.forceMount,...i}=t,s=Kd(qo,t.__scopeMenu),o=rb(qo,t.__scopeMenu);return x.jsx(QO.Provider,{scope:t.__scopeMenu,children:x.jsx(tb,{present:r||s.open,children:x.jsx(QO.Slot,{scope:t.__scopeMenu,children:o.modal?x.jsx(Got,{...i,ref:e}):x.jsx(Kot,{...i,ref:e})})})})}),Got=_.forwardRef((t,e)=>{const n=Kd(qo,t.__scopeMenu),r=_.useRef(null),i=Qs(e,r);return _.useEffect(()=>{const s=r.current;if(s)return G5(s)},[]),x.jsx(ND,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:rn(t.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Kot=_.forwardRef((t,e)=>{const n=Kd(qo,t.__scopeMenu);return x.jsx(ND,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),ND=_.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:f,onInteractOutside:h,onDismiss:d,disableOutsideScroll:p,...g}=t,m=Kd(qo,n),v=rb(qo,n),y=ek(n),b=Mhe(n),S=Vot(n),[k,E]=_.useState(null),T=_.useRef(null),C=Qs(e,T,m.onContentChange),A=_.useRef(0),R=_.useRef(""),Q=_.useRef(0),L=_.useRef(null),z=_.useRef("right"),B=_.useRef(0),q=p?jot:_.Fragment,Z=p?{as:DO,allowPinchZoom:!0}:void 0,J=j=>{var F,oe;const M=R.current+j,X=S().filter(le=>!le.disabled),se=document.activeElement,H=(F=X.find(le=>le.ref.current===se))==null?void 0:F.textValue,de=X.map(le=>le.textValue),fe=uat(de,M,H),ve=(oe=X.find(le=>le.textValue===fe))==null?void 0:oe.ref.current;(function le(pe){R.current=pe,window.clearTimeout(A.current),pe!==""&&(A.current=window.setTimeout(()=>le(""),1e3))})(M),ve&&setTimeout(()=>ve.focus())};_.useEffect(()=>()=>window.clearTimeout(A.current),[]),Vit();const I=_.useCallback(j=>{var X,se;return z.current===((X=L.current)==null?void 0:X.side)&&hat(j,(se=L.current)==null?void 0:se.area)},[]);return x.jsx(Yot,{scope:n,searchRef:R,onItemEnter:_.useCallback(j=>{I(j)&&j.preventDefault()},[I]),onItemLeave:_.useCallback(j=>{var M;I(j)||((M=T.current)==null||M.focus(),E(null))},[I]),onTriggerLeave:_.useCallback(j=>{I(j)&&j.preventDefault()},[I]),pointerGraceTimerRef:Q,onPointerGraceIntentChange:_.useCallback(j=>{L.current=j},[]),children:x.jsx(q,{...Z,children:x.jsx(Gfe,{asChild:!0,trapped:i,onMountAutoFocus:rn(s,j=>{var M;j.preventDefault(),(M=T.current)==null||M.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:x.jsx(Zfe,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:f,onInteractOutside:h,onDismiss:d,children:x.jsx(_ot,{asChild:!0,...b,dir:v.dir,orientation:"vertical",loop:r,currentTabStopId:k,onCurrentTabStopIdChange:E,onEntryFocus:rn(l,j=>{v.isUsingKeyboardRef.current||j.preventDefault()}),preventScrollOnEntryFocus:!0,children:x.jsx(lot,{role:"menu","aria-orientation":"vertical","data-state":Jhe(m.open),"data-radix-menu-content":"",dir:v.dir,...y,...g,ref:C,style:{outline:"none",...g.style},onKeyDown:rn(g.onKeyDown,j=>{const X=j.target.closest("[data-radix-menu-content]")===j.currentTarget,se=j.ctrlKey||j.altKey||j.metaKey,H=j.key.length===1;X&&(j.key==="Tab"&&j.preventDefault(),!se&&H&&J(j.key));const de=T.current;if(j.target!==de||!zot.includes(j.key))return;j.preventDefault();const ve=S().filter(F=>!F.disabled).map(F=>F.ref.current);Rhe.includes(j.key)&&ve.reverse(),lat(ve)}),onBlur:rn(t.onBlur,j=>{j.currentTarget.contains(j.target)||(window.clearTimeout(A.current),R.current="")}),onPointerMove:rn(t.onPointerMove,jO(j=>{const M=j.target,X=B.current!==j.clientX;if(j.currentTarget.contains(M)&&X){const se=j.clientX>B.current?"right":"left";z.current=se,B.current=j.clientX}}))})})})})})})});Nhe.displayName=qo;var Jot="MenuGroup",QD=_.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return x.jsx(ps.div,{role:"group",...r,ref:e})});QD.displayName=Jot;var eat="MenuLabel",Qhe=_.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return x.jsx(ps.div,{...r,ref:e})});Qhe.displayName=eat;var v4="MenuItem",yX="menu.itemSelect",tk=_.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...i}=t,s=_.useRef(null),o=rb(v4,t.__scopeMenu),a=LD(v4,t.__scopeMenu),l=Qs(e,s),c=_.useRef(!1),u=()=>{const f=s.current;if(!n&&f){const h=new CustomEvent(yX,{bubbles:!0,cancelable:!0});f.addEventListener(yX,d=>r==null?void 0:r(d),{once:!0}),Ufe(f,h),h.defaultPrevented?c.current=!1:o.onClose()}};return x.jsx(jhe,{...i,ref:l,disabled:n,onClick:rn(t.onClick,u),onPointerDown:f=>{var h;(h=t.onPointerDown)==null||h.call(t,f),c.current=!0},onPointerUp:rn(t.onPointerUp,f=>{var h;c.current||(h=f.currentTarget)==null||h.click()}),onKeyDown:rn(t.onKeyDown,f=>{const h=a.searchRef.current!=="";n||h&&f.key===" "||RA.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});tk.displayName=v4;var jhe=_.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...s}=t,o=LD(v4,n),a=Mhe(n),l=_.useRef(null),c=Qs(e,l),[u,f]=_.useState(!1),[h,d]=_.useState("");return _.useEffect(()=>{const p=l.current;p&&d((p.textContent??"").trim())},[s.children]),x.jsx(QO.ItemSlot,{scope:n,disabled:r,textValue:i??h,children:x.jsx(kot,{asChild:!0,...a,focusable:!r,children:x.jsx(ps.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:c,onPointerMove:rn(t.onPointerMove,jO(p=>{r?o.onItemLeave(p):(o.onItemEnter(p),p.defaultPrevented||p.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:rn(t.onPointerLeave,jO(p=>o.onItemLeave(p))),onFocus:rn(t.onFocus,()=>f(!0)),onBlur:rn(t.onBlur,()=>f(!1))})})})}),tat="MenuCheckboxItem",Bhe=_.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...i}=t;return x.jsx(Uhe,{scope:t.__scopeMenu,checked:n,children:x.jsx(tk,{role:"menuitemcheckbox","aria-checked":O4(n)?"mixed":n,...i,ref:e,"data-state":BD(n),onSelect:rn(i.onSelect,()=>r==null?void 0:r(O4(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Bhe.displayName=tat;var zhe="MenuRadioGroup",[nat,rat]=Gd(zhe,{value:void 0,onValueChange:()=>{}}),Fhe=_.forwardRef((t,e)=>{const{value:n,onValueChange:r,...i}=t,s=Na(r);return x.jsx(nat,{scope:t.__scopeMenu,value:n,onValueChange:s,children:x.jsx(QD,{...i,ref:e})})});Fhe.displayName=zhe;var Whe="MenuRadioItem",Vhe=_.forwardRef((t,e)=>{const{value:n,...r}=t,i=rat(Whe,t.__scopeMenu),s=n===i.value;return x.jsx(Uhe,{scope:t.__scopeMenu,checked:s,children:x.jsx(tk,{role:"menuitemradio","aria-checked":s,...r,ref:e,"data-state":BD(s),onSelect:rn(r.onSelect,()=>{var o;return(o=i.onValueChange)==null?void 0:o.call(i,n)},{checkForDefaultPrevented:!1})})})});Vhe.displayName=Whe;var jD="MenuItemIndicator",[Uhe,iat]=Gd(jD,{checked:!1}),qhe=_.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...i}=t,s=iat(jD,n);return x.jsx(tb,{present:r||O4(s.checked)||s.checked===!0,children:x.jsx(ps.span,{...i,ref:e,"data-state":BD(s.checked)})})});qhe.displayName=jD;var sat="MenuSeparator",Xhe=_.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return x.jsx(ps.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});Xhe.displayName=sat;var oat="MenuArrow",Hhe=_.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,i=ek(n);return x.jsx(cot,{...i,...r,ref:e})});Hhe.displayName=oat;var aat="MenuSub",[xEt,Zhe]=Gd(aat),A1="MenuSubTrigger",Yhe=_.forwardRef((t,e)=>{const n=Kd(A1,t.__scopeMenu),r=rb(A1,t.__scopeMenu),i=Zhe(A1,t.__scopeMenu),s=LD(A1,t.__scopeMenu),o=_.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=s,c={__scopeMenu:t.__scopeMenu},u=_.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return _.useEffect(()=>u,[u]),_.useEffect(()=>{const f=a.current;return()=>{window.clearTimeout(f),l(null)}},[a,l]),x.jsx(ID,{asChild:!0,...c,children:x.jsx(jhe,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":Jhe(n.open),...t,ref:H3(e,i.onTriggerChange),onClick:f=>{var h;(h=t.onClick)==null||h.call(t,f),!(t.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:rn(t.onPointerMove,jO(f=>{s.onItemEnter(f),!f.defaultPrevented&&!t.disabled&&!n.open&&!o.current&&(s.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:rn(t.onPointerLeave,jO(f=>{var d,p;u();const h=(d=n.content)==null?void 0:d.getBoundingClientRect();if(h){const g=(p=n.content)==null?void 0:p.dataset.side,m=g==="right",v=m?-5:5,y=h[m?"left":"right"],b=h[m?"right":"left"];s.onPointerGraceIntentChange({area:[{x:f.clientX+v,y:f.clientY},{x:y,y:h.top},{x:b,y:h.top},{x:b,y:h.bottom},{x:y,y:h.bottom}],side:g}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(f),f.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:rn(t.onKeyDown,f=>{var d;const h=s.searchRef.current!=="";t.disabled||h&&f.key===" "||Fot[r.dir].includes(f.key)&&(n.onOpenChange(!0),(d=n.content)==null||d.focus(),f.preventDefault())})})})});Yhe.displayName=A1;var Ghe="MenuSubContent",Khe=_.forwardRef((t,e)=>{const n=Dhe(qo,t.__scopeMenu),{forceMount:r=n.forceMount,...i}=t,s=Kd(qo,t.__scopeMenu),o=rb(qo,t.__scopeMenu),a=Zhe(Ghe,t.__scopeMenu),l=_.useRef(null),c=Qs(e,l);return x.jsx(QO.Provider,{scope:t.__scopeMenu,children:x.jsx(tb,{present:r||s.open,children:x.jsx(QO.Slot,{scope:t.__scopeMenu,children:x.jsx(ND,{id:a.contentId,"aria-labelledby":a.triggerId,...i,ref:c,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:u=>{var f;o.isUsingKeyboardRef.current&&((f=l.current)==null||f.focus()),u.preventDefault()},onCloseAutoFocus:u=>u.preventDefault(),onFocusOutside:rn(t.onFocusOutside,u=>{u.target!==a.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:rn(t.onEscapeKeyDown,u=>{o.onClose(),u.preventDefault()}),onKeyDown:rn(t.onKeyDown,u=>{var d;const f=u.currentTarget.contains(u.target),h=Wot[o.dir].includes(u.key);f&&h&&(s.onOpenChange(!1),(d=a.trigger)==null||d.focus(),u.preventDefault())})})})})})});Khe.displayName=Ghe;function Jhe(t){return t?"open":"closed"}function O4(t){return t==="indeterminate"}function BD(t){return O4(t)?"indeterminate":t?"checked":"unchecked"}function lat(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function cat(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function uat(t,e,n){const i=e.length>1&&Array.from(e).every(c=>c===e[0])?e[0]:e,s=n?t.indexOf(n):-1;let o=cat(t,Math.max(s,0));i.length===1&&(o=o.filter(c=>c!==n));const l=o.find(c=>c.toLowerCase().startsWith(i.toLowerCase()));return l!==n?l:void 0}function fat(t,e){const{x:n,y:r}=t;let i=!1;for(let s=0,o=e.length-1;s<e.length;o=s++){const a=e[s].x,l=e[s].y,c=e[o].x,u=e[o].y;l>r!=u>r&&n<(c-a)*(r-l)/(u-l)+a&&(i=!i)}return i}function hat(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return fat(n,e)}function jO(t){return e=>e.pointerType==="mouse"?t(e):void 0}var dat=Ihe,pat=ID,mat=Lhe,gat=Nhe,vat=QD,Oat=Qhe,yat=tk,bat=Bhe,xat=Fhe,wat=Vhe,Sat=qhe,_at=Xhe,kat=Hhe,Cat=Yhe,Eat=Khe,zD="DropdownMenu",[Tat,wEt]=Wfe(zD,[$he]),ms=$he(),[Pat,ede]=Tat(zD),tde=t=>{const{__scopeDropdownMenu:e,children:n,dir:r,open:i,defaultOpen:s,onOpenChange:o,modal:a=!0}=t,l=ms(e),c=_.useRef(null),[u=!1,f]=Vfe({prop:i,defaultProp:s,onChange:o});return x.jsx(Pat,{scope:e,triggerId:kA(),triggerRef:c,contentId:kA(),open:u,onOpenChange:f,onOpenToggle:_.useCallback(()=>f(h=>!h),[f]),modal:a,children:x.jsx(dat,{...l,open:u,onOpenChange:f,dir:r,modal:a,children:n})})};tde.displayName=zD;var nde="DropdownMenuTrigger",rde=_.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...i}=t,s=ede(nde,n),o=ms(n);return x.jsx(pat,{asChild:!0,...o,children:x.jsx(ps.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...i,ref:H3(e,s.triggerRef),onPointerDown:rn(t.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(s.onOpenToggle(),s.open||a.preventDefault())}),onKeyDown:rn(t.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&s.onOpenToggle(),a.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});rde.displayName=nde;var Aat="DropdownMenuPortal",ide=t=>{const{__scopeDropdownMenu:e,...n}=t,r=ms(e);return x.jsx(mat,{...r,...n})};ide.displayName=Aat;var sde="DropdownMenuContent",ode=_.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=ede(sde,n),s=ms(n),o=_.useRef(!1);return x.jsx(gat,{id:i.contentId,"aria-labelledby":i.triggerId,...s,...r,ref:e,onCloseAutoFocus:rn(t.onCloseAutoFocus,a=>{var l;o.current||(l=i.triggerRef.current)==null||l.focus(),o.current=!1,a.preventDefault()}),onInteractOutside:rn(t.onInteractOutside,a=>{const l=a.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,u=l.button===2||c;(!i.modal||u)&&(o.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});ode.displayName=sde;var Rat="DropdownMenuGroup",$at=_.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=ms(n);return x.jsx(vat,{...i,...r,ref:e})});$at.displayName=Rat;var Mat="DropdownMenuLabel",Iat=_.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=ms(n);return x.jsx(Oat,{...i,...r,ref:e})});Iat.displayName=Mat;var Dat="DropdownMenuItem",ade=_.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=ms(n);return x.jsx(yat,{...i,...r,ref:e})});ade.displayName=Dat;var Lat="DropdownMenuCheckboxItem",Nat=_.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=ms(n);return x.jsx(bat,{...i,...r,ref:e})});Nat.displayName=Lat;var Qat="DropdownMenuRadioGroup",jat=_.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=ms(n);return x.jsx(xat,{...i,...r,ref:e})});jat.displayName=Qat;var Bat="DropdownMenuRadioItem",zat=_.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=ms(n);return x.jsx(wat,{...i,...r,ref:e})});zat.displayName=Bat;var Fat="DropdownMenuItemIndicator",Wat=_.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=ms(n);return x.jsx(Sat,{...i,...r,ref:e})});Wat.displayName=Fat;var Vat="DropdownMenuSeparator",Uat=_.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=ms(n);return x.jsx(_at,{...i,...r,ref:e})});Uat.displayName=Vat;var qat="DropdownMenuArrow",Xat=_.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=ms(n);return x.jsx(kat,{...i,...r,ref:e})});Xat.displayName=qat;var Hat="DropdownMenuSubTrigger",Zat=_.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=ms(n);return x.jsx(Cat,{...i,...r,ref:e})});Zat.displayName=Hat;var Yat="DropdownMenuSubContent",Gat=_.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=ms(n);return x.jsx(Eat,{...i,...r,ref:e,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Gat.displayName=Yat;var lde=tde,Kat=rde,Jat=ide,cde=ode,ude=ade;function elt({onChange:t,config:e}){const n=e.colorChoices??[],r=()=>{const a=[...n,{color:"#ff0000",description:""}];t("colorChoices",()=>a)},i=a=>{const l=n.filter((c,u)=>u!==a);t("colorChoices",()=>l)},s=(a,l)=>{const c=n.map((u,f)=>f===a?{...u,color:l}:u);t("colorChoices",()=>c)},o=(a,l)=>{const c=n.map((u,f)=>f===a?{...u,description:l}:u);t("colorChoices",()=>c)};return x.jsx(fde,{colors:n,addColor:r,removeColor:i,updateColor:s,updateDescription:o})}const fde=({colors:t,addColor:e,removeColor:n,updateColor:r,updateDescription:i})=>x.jsxs(x.Fragment,{children:[x.jsxs("button",{onClick:e,className:"my-1 flex cursor-pointer items-center justify-between rounded-xl bg-setta-100 px-3 py-0.5 uppercase text-setta-500 hover:bg-setta-200 dark:bg-setta-850 dark:text-setta-500 dark:hover:bg-setta-850","aria-label":"Add color",children:[x.jsx("p",{className:"text-sm font-black ",children:"Add Colors"}),x.jsx("i",{className:"gg-add !scale-90"})]}),x.jsx("div",{className:"flex flex-col gap-2 overflow-y-auto",children:t.map(({color:s,description:o},a)=>x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsxs("div",{className:"flex flex-auto items-center gap-1 overflow-hidden",children:[x.jsx("input",{type:"color",value:s,onChange:l=>r(a,l.target.value),className:"min-h-6 min-w-6 cursor-pointer rounded-full !border !border-solid !border-setta-500/20 p-0 dark:!border-setta-500/40 [&::-moz-color-swatch]:rounded"}),x.jsx("input",{type:"text",value:o,onChange:l=>i(a,l.target.value),placeholder:"Add description...",className:"h-[calc(100%_-_2px)] w-[calc(100%_-_2px)] truncate rounded border px-2 py-1 text-xs text-setta-700 focus:outline-none focus:ring-2 focus:ring-blue-500 dark:text-setta-400 dark:placeholder-setta-700"})]}),x.jsx("button",{onClick:()=>n(a),className:"flex cursor-pointer items-center rounded-full p-1 text-gray-400 hover:bg-gray-100 hover:text-gray-700","aria-label":"Remove color",children:x.jsx("i",{className:"gg-close !scale-75"})})]},a))})]});function FD({colorChoices:t,value:e,onChange:n,onEscape:r,wrapperClassName:i,colorPickerChoicesClasses:s,isDisabled:o}){const a=G8e(e);return x.jsx("div",{className:i,children:x.jsx(tlt,{colorChoices:t,value:a,onChange:n,onEscape:r,colorPickerChoicesClasses:s,isDisabled:o})})}function tlt({colorChoices:t,value:e,onChange:n,onEscape:r,colorPickerChoicesClasses:i,isDisabled:s}){const o={"--bg":e,background:"var(--bg)",color:"lch(from var(--bg) calc((49.44 - l) * infinity) 0 0)"};return(t==null?void 0:t.length)>0?x.jsx(nlt,{color:e,setColor:n,colorChoices:t,colorPickerChoicesClasses:i,isDisabled:s,onEscape:r}):x.jsxs(x.Fragment,{children:[x.jsx("i",{className:"gg-color-picker single-cell-child pointer-events-none mr-0.5 mt-0.5 place-self-center",style:o}),x.jsx("input",{id:"colorPicker",type:"color",value:e,onChange:a=>n(a.target.value),className:"single-cell-child flex !h-[calc(100%_-_2px)] min-h-0 !w-[calc(100%_-_2px)] min-w-0 cursor-pointer items-center justify-between overflow-hidden !rounded-lg !border !border-solid !border-setta-500/20 dark:!border-setta-500/40",disabled:s,onKeyDown:a=>{a.code==="Escape"&&(r==null||r())}})]})}function nlt({color:t,setColor:e,colorChoices:n,colorPickerChoicesClasses:r,isDisabled:i,onEscape:s}){let o=n.find(l=>l.color===t);o||(o=n[0]);const a={"--bg":o.color,background:"var(--bg)",color:"lch(from var(--bg) calc((49.44 - l) * infinity) 0 0)"};return x.jsxs(lde,{modal:!1,children:[x.jsxs(Kat,{className:r,disabled:i,onKeyDown:l=>{l.code==="Escape"&&(l.stopPropagation(),s==null||s())},children:[x.jsx("div",{className:"single-cell-child min-w-0s m-auto h-full min-h-0 w-full rounded-lg !border !border-solid !border-setta-500/20 dark:!border-setta-500/40",style:{backgroundColor:o.color}}),x.jsxs("div",{className:"single-cell-child flex items-center justify-between overflow-hidden",children:[x.jsx("p",{className:"ml-[2px] truncate pl-2.5 text-xs font-semibold @[90px]:inline-block",style:a,children:o.description}),x.jsx("i",{className:"gg-chevron-down px-2",style:a})]})]}),x.jsx(Jat,{children:x.jsx(cde,{className:"z-20 flex flex-col rounded bg-white p-2 shadow-md dark:bg-setta-800",align:"start",style:{minWidth:"var(--radix-dropdown-menu-trigger-width)"},children:n.map((l,c)=>x.jsxs(ude,{className:"flex cursor-pointer items-center rounded px-2 py-1 hover:bg-setta-100 dark:hover:bg-setta-700",onSelect:()=>e(l.color),children:[x.jsx("div",{className:"mr-2 h-4 w-4 rounded-full",style:{backgroundColor:l.color}}),x.jsx("p",{className:"max-w-48 truncate text-xs text-setta-500 dark:text-setta-300",children:l.description})]},c))})})]})}function rlt({sectionId:t}){return x.jsxs(x.Fragment,{children:[x.jsx(ilt,{sectionId:t}),x.jsx(dit,{sectionId:t,sectionTypeName:Y.DRAW})]})}function ilt({sectionId:t}){const e=te(o=>{var a;return((a=o.x[t].canvasSettings)==null?void 0:a.colorChoices)??[]},ae.isEqual),n=()=>{Pw(t,[...e,{color:"#000000",description:""}])},r=o=>{Pw(t,e.filter((a,l)=>l!==o))},i=(o,a)=>{Pw(t,e.map((l,c)=>c===o?{...l,color:a}:l))},s=(o,a)=>{Pw(t,e.map((l,c)=>c===o?{...l,description:a}:l))};return x.jsx(fde,{colors:e,addColor:n,removeColor:r,updateColor:i,updateDescription:s})}function Pw(t,e){te.setState(n=>{const r=n.x[t];r.canvasSettings.colorChoices=e})}function slt({sectionId:t}){const[e,n]=_.useState(""),[r,i]=_.useState(""),s=a=>a.toLowerCase().includes("<iframe")?"":"Input must contain an iframe tag",o=a=>{const l=a.target.value;n(l);const c=s(l);i(c),c||te.setState(u=>{u.x[t].iframeCode=l})};return x.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[x.jsxs("header",{className:"py-4",children:[x.jsx("h2",{className:"text-sm font-bold text-setta-700 dark:text-setta-300",children:"Iframe Code"}),x.jsx("p",{className:"text-xs text-setta-600 dark:text-setta-500",children:"Paste your iframe HTML below"})]}),x.jsxs("section",{className:"flex-1 overflow-y-auto",children:[x.jsx("textarea",{value:e,onChange:o,className:"h-48 w-full resize-y rounded-md border border-solid border-setta-200 bg-white/80 p-3 font-mono text-sm text-setta-800 placeholder-setta-300 focus:!border-blue-500 focus:outline-0 focus:ring-0 dark:border-setta-700 dark:bg-setta-900 dark:text-setta-300 dark:placeholder-setta-600",placeholder:"<iframe src='...'></iframe>",spellCheck:"false"}),r&&x.jsx("div",{className:"dark:red-500 my-2 rounded border border-red-600 bg-red-500 px-4 py-3 font-bold text-white",children:r})]})]})}function olt({sectionId:t}){return x.jsx(jfe,{sectionId:t,sectionTypeName:Y.IMAGE})}function alt(){return null}function WD({value:t,defaultVal:e,onChange:n,onEscape:r,isDisabled:i,outerDivClassName:s,twRootClasses:o,twThumbClasses:a}){const l=typeof t=="string"?t==="true":t;return x.jsx("div",{className:s,children:x.jsx(sM,{checked:l,disabled:i,onCheckedChange:n,twRootClasses:o,twThumbClasses:a,onKeyDown:c=>{c.code==="Escape"&&(c.stopPropagation(),r==null||r())}})})}async function llt(t){return await jt({body:{docstring:t},address:Y.ROUTE_DOCSTRING_TO_MARKDOWN})}function clt({sectionId:t}){const{renderMarkdown:e,description:n,variantIsFrozen:r}=Fte(t);async function i(s){let o;if(s){const a=await llt(n);o=a.status===200?a.data:n}else o=n;te.setState(a=>{Yt(t,a).description=o,a.x[t].renderMarkdown=s})}return x.jsxs("div",{className:"flex w-full items-center justify-between gap-4 ",children:[x.jsx("p",{className:"text-xs font-bold text-setta-700 dark:text-setta-300",children:"Render Markdown"}),x.jsx(WD,{isDisabled:r,value:e,onChange:i,outerDivClassName:"flex items-center"})]})}function ult({sectionId:t}){const e=te(s=>s.x[t].jsonSource),[n,r]=_.useState(e??"");async function i(s){const o=s.target.value;let a=null,l=null,c=null,u=null;if(o){const f=await gPe(t,o);f.status===200&&({codeInfo:a,codeInfoCols:l,sectionVariants:c,sections:u}=f.data.project)}te.setState(f=>{f.x[t].jsonSource=o,Z$({sections:u,sectionVariants:c,codeInfo:a,codeInfoCols:l,state:f})})}return _.useEffect(()=>{r(e??"")},[e]),x.jsx("div",{className:"mb-2 mt-2 w-full select-text",children:x.jsxs("div",{className:"flex w-full items-center gap-3",children:[x.jsx("p",{className:"select-none text-sm font-bold text-setta-400 dark:text-setta-600",children:"JSON Source"}),x.jsx("input",{className:"mr-[2px] w-full truncate rounded-full bg-white px-4 py-1 text-sm text-setta-700 ring-2 ring-setta-200 focus:ring-2 focus:ring-blue-500 dark:bg-setta-900 dark:text-setta-400 dark:ring-setta-700",value:n,onChange:s=>r(s.target.value),onBlur:i})]})})}function flt({sectionId:t}){const e=te(s=>s.x[t].social),[n,r]=_.useState(e??"");function i(s){const o=s.target.value;o&&te.setState(a=>{a.x[t].social=o})}return x.jsx("div",{className:"mb-2 mt-2 w-full select-text",children:x.jsxs("div",{className:"flex w-full items-center gap-3",children:[x.jsx("p",{className:"select-none text-sm font-bold text-setta-400 dark:text-setta-600",children:"Social Media URL"}),x.jsx("input",{className:"mr-[2px] w-full truncate rounded-full bg-white px-4 py-1 text-sm text-setta-700 ring-2 ring-setta-200 focus:ring-2 focus:ring-blue-500 dark:bg-setta-900 dark:text-setta-400 dark:ring-setta-700",value:n,onChange:s=>r(s.target.value),onBlur:i,placeholder:"https://www.youtube.com/"})]})})}const hlt=ke.forwardRef(({sectionId:t},e)=>x.jsx(plt,{sectionId:t})),dlt=ke.memo(hlt);function plt({sectionId:t}){return x.jsx("div",{className:"flex min-h-0 flex-col gap-1 overflow-y-clip",children:x.jsx(mlt,{sectionId:t})})}function mlt({sectionId:t}){switch(te(n=>dn(t,n))){case Y.SECTION:case Y.GLOBAL_VARIABLES:return x.jsx(ult,{sectionId:t});case Y.CODE:return x.jsx(kit,{sectionId:t});case Y.INFO:return x.jsx(clt,{sectionId:t});case Y.DRAW:return x.jsx(rlt,{sectionId:t});case Y.IMAGE:return x.jsx(olt,{sectionId:t});case Y.CHART:return x.jsx(pit,{sectionId:t});case Y.SOCIAL:return x.jsx(flt,{sectionId:t});case Y.IFRAME:return x.jsx(slt,{sectionId:t})}}function glt(t){return ft({tag:"svg",attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M593.8 59.1H46.2C20.7 59.1 0 79.8 0 105.2v301.5c0 25.5 20.7 46.2 46.2 46.2h547.7c25.5 0 46.2-20.7 46.1-46.1V105.2c0-25.4-20.7-46.1-46.2-46.1zM338.5 360.6H277v-120l-61.5 76.9-61.5-76.9v120H92.3V151.4h61.5l61.5 76.9 61.5-76.9h61.5v209.2zm135.3 3.1L381.5 256H443V151.4h61.5V256H566z"},child:[]}]})(t)}function vlt(t){return ft({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M549.655 124.083c-6.281-23.65-24.787-42.276-48.284-48.597C458.781 64 288 64 288 64S117.22 64 74.629 75.486c-23.497 6.322-42.003 24.947-48.284 48.597-11.412 42.867-11.412 132.305-11.412 132.305s0 89.438 11.412 132.305c6.281 23.65 24.787 41.5 48.284 47.821C117.22 448 288 448 288 448s170.78 0 213.371-11.486c23.497-6.321 42.003-24.171 48.284-47.821 11.412-42.867 11.412-132.305 11.412-132.305s0-89.438-11.412-132.305zm-317.51 213.508V175.185l142.739 81.205-142.739 81.201z"},child:[]}]})(t)}function Olt(t){return ft({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z"},child:[]}]})(t)}function ylt(t){return ft({tag:"svg",attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M257.981 272.971L63.638 467.314c-9.373 9.373-24.569 9.373-33.941 0L7.029 444.647c-9.357-9.357-9.375-24.522-.04-33.901L161.011 256 6.99 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L257.981 239.03c9.373 9.372 9.373 24.568 0 33.941zM640 456v-32c0-13.255-10.745-24-24-24H312c-13.255 0-24 10.745-24 24v32c0 13.255 10.745 24 24 24h304c13.255 0 24-10.745 24-24z"},child:[]}]})(t)}function blt(t){return ft({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M440.1 355.2l-39.2-23 34.1-9.3c8.4-2.3 13.4-11.1 11.1-19.6l-4.1-15.5c-2.2-8.5-10.9-13.6-19.3-11.3L343 298.2 271.2 256l71.9-42.2 79.7 21.7c8.4 2.3 17-2.8 19.3-11.3l4.1-15.5c2.2-8.5-2.7-17.3-11.1-19.6l-34.1-9.3 39.2-23c7.5-4.4 10.1-14.2 5.8-21.9l-7.9-13.9c-4.3-7.7-14-10.3-21.5-5.9l-39.2 23 9.1-34.7c2.2-8.5-2.7-17.3-11.1-19.6l-15.2-4.1c-8.4-2.3-17 2.8-19.3 11.3l-21.3 81-71.9 42.2v-84.5L306 70.4c6.1-6.2 6.1-16.4 0-22.6l-11.1-11.3c-6.1-6.2-16.1-6.2-22.2 0l-24.9 25.4V16c0-8.8-7-16-15.7-16h-15.7c-8.7 0-15.7 7.2-15.7 16v46.1l-24.9-25.4c-6.1-6.2-16.1-6.2-22.2 0L142.1 48c-6.1 6.2-6.1 16.4 0 22.6l58.3 59.3v84.5l-71.9-42.2-21.3-81c-2.2-8.5-10.9-13.6-19.3-11.3L72.7 84c-8.4 2.3-13.4 11.1-11.1 19.6l9.1 34.7-39.2-23c-7.5-4.4-17.1-1.8-21.5 5.9l-7.9 13.9c-4.3 7.7-1.8 17.4 5.8 21.9l39.2 23-34.1 9.1c-8.4 2.3-13.4 11.1-11.1 19.6L6 224.2c2.2 8.5 10.9 13.6 19.3 11.3l79.7-21.7 71.9 42.2-71.9 42.2-79.7-21.7c-8.4-2.3-17 2.8-19.3 11.3l-4.1 15.5c-2.2 8.5 2.7 17.3 11.1 19.6l34.1 9.3-39.2 23c-7.5 4.4-10.1 14.2-5.8 21.9L10 391c4.3 7.7 14 10.3 21.5 5.9l39.2-23-9.1 34.7c-2.2 8.5 2.7 17.3 11.1 19.6l15.2 4.1c8.4 2.3 17-2.8 19.3-11.3l21.3-81 71.9-42.2v84.5l-58.3 59.3c-6.1 6.2-6.1 16.4 0 22.6l11.1 11.3c6.1 6.2 16.1 6.2 22.2 0l24.9-25.4V496c0 8.8 7 16 15.7 16h15.7c8.7 0 15.7-7.2 15.7-16v-46.1l24.9 25.4c6.1 6.2 16.1 6.2 22.2 0l11.1-11.3c6.1-6.2 6.1-16.4 0-22.6l-58.3-59.3v-84.5l71.9 42.2 21.3 81c2.2 8.5 10.9 13.6 19.3 11.3L375 428c8.4-2.3 13.4-11.1 11.1-19.6l-9.1-34.7 39.2 23c7.5 4.4 17.1 1.8 21.5-5.9l7.9-13.9c4.6-7.5 2.1-17.3-5.5-21.7z"},child:[]}]})(t)}async function xlt(t){return await jt({body:{filenameGlob:t},address:Y.ROUTE_NEW_JSON_VERSION_NAME})}function hde(t,e,n){const{variantId:r}=n.x[t],i=Yt(t,n).codeInfoColId,s=i?jRe(i,n):null,o=BRe(r,e,s,n);return n.x[t].variantId=o,n.x[t].variantIds.push(o),{newVariantId:o,oldVariantId:r}}async function wlt(t,e,n){if(e){const{name:r}=te.getState().variants[n];await vPe(t,r)}Vi("New Version Created")}async function Slt(t){if(t){const e=await xlt(t);if(e.status===200)return e.data}return Fm()}async function dde(t){const{jsonSource:e}=Pi(t),n=await Slt(e);let r,i;te.setState(s=>{({newVariantId:r,oldVariantId:i}=hde(t,n,s))}),Nd(t,r),wlt(t,e,i)}function pde(t,e){let n;te.setState(r=>{n=r.x[t].variantId,r.x[t].previewVariantId=e}),n!==e&&Nd(t,e)}function mde(t){te.setState(e=>{e.x[t].previewVariantId=null})}function gde(t,e){let n;te.setState(r=>{n=r.x[t].variantId,r.x[t].variantId=e}),n!==e&&Nd(t,e)}function _lt({sectionId:t}){const[e,n]=_.useState(!1);function r(){n(!e)}function i(){dde(t)}return x.jsxs("section",{className:"section-grid-cols section-grid-rows section-grid-areas -mx-3 -my-4 grid flex-1 self-stretch",children:[x.jsxs("header",{className:"absolute right-16 top-[15px] flex items-center gap-2",children:[!e&&x.jsx("button",{className:"flex cursor-pointer items-center justify-center gap-1 rounded-md px-2 py-1 text-xs font-bold text-setta-400 hover:bg-setta-500/20 hover:text-setta-600 dark:text-setta-600 dark:hover:text-setta-400",onClick:i,children:"Add Version"}),x.jsxs("button",{className:"flex cursor-pointer items-center justify-center gap-1 rounded-md px-2 py-1 text-xs font-bold text-setta-400 hover:bg-setta-500/20 hover:text-setta-600 dark:text-setta-600 dark:hover:text-setta-400",onClick:r,children:[x.jsx("i",{className:"gg-pen"}),e?"Done Editing":"Edit"]})]}),x.jsx("ul",{className:"section-full nodrag nowheel grid auto-rows-min grid-cols-subgrid gap-y-2 overflow-y-auto overflow-x-clip pt-6",onMouseLeave:()=>mde(t),children:x.jsx(klt,{sectionId:t,isEditing:e})})]})}function klt({sectionId:t,isEditing:e}){const{currVariantId:n,variantIds:r,defaultVariantId:i}=te(s=>({currVariantId:s.x[t].variantId,variantIds:s.x[t].variantIds,defaultVariantId:s.x[t].defaultVariantId}),ae.isEqual);return e?r.map(s=>x.jsx(Elt,{sectionId:t,id:s,isCurr:n===s,deletable:r.length>1},s)):r.map(s=>x.jsx(Clt,{sectionId:t,id:s,isCurr:n===s,isDefault:s===i},s))}function Clt({sectionId:t,id:e,isCurr:n,isDefault:r}){const{name:i,isFrozen:s}=te(o=>({name:o.variants[e].name,isFrozen:o.variants[e].isFrozen}),ae.isEqual);return x.jsxs("li",{onMouseEnter:()=>pde(t,e),onClick:()=>gde(t,e),className:`section-key-value group/versionitem -my-[0.125rem] flex h-min cursor-pointer items-center justify-between rounded-sm border-b border-transparent px-1 py-[0.125rem] text-xs hover:bg-setta-200/30 dark:hover:bg-setta-700/50 ${n?"bg-blue-500 dark:bg-blue-700":""}`,children:[x.jsx("p",{className:`section-key truncate ${n?"font-medium text-white group-hover/versionitem:text-setta-800 group-hover/versionitem:dark:text-setta-100":"text-setta-400 dark:text-setta-400"} `,children:i}),x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx("button",{className:`cursor-pointer bg-transparent ${r?"text-green-500":"text-transparent hover:!text-setta-400 group-hover/versionitem:text-setta-400/50"}`,onClick:o=>{o.stopPropagation(),NRe(t,e)},children:x.jsx(oM,{})}),x.jsx("button",{className:`cursor-pointer bg-transparent ${s?"text-blue-500":"text-transparent hover:!text-blue-400 group-hover/versionitem:text-setta-400/50"}`,onClick:o=>{o.stopPropagation(),LRe(e)},children:x.jsx(blt,{})})]})]})}function Elt({sectionId:t,id:e,isCurr:n,deletable:r}){const i=te(h=>h.variants[e].name,ae.isEqual);function s(h){te.setState(d=>{d.variants[e].name=h})}function o(h){const d=te.getState();for(const p of d.x[t].variantIds)if(d.variants[p].name===h)return!1;return!0}const[a,l,c,u]=IM(i,s,o);function f(h){h.stopPropagation(),zRe(t,e,n)}return x.jsxs("li",{className:"section-key-value group/versionitem -my-[0.125rem] flex h-min cursor-pointer items-center justify-between border-b border-setta-200 px-1 py-[0.125rem] text-xs focus-within:!border-blue-500 hover:border-setta-500 dark:border-setta-700 dark:hover:border-setta-500 ",children:[x.jsx("input",{value:a,onChange:l,onBlur:c,onKeyDown:u,className:"flex-1 truncate text-setta-500 focus:text-setta-900 focus:outline-none focus:ring-0 dark:text-setta-400 dark:focus:text-setta-200"}),r&&x.jsx("button",{className:"cursor-pointer bg-transparent text-transparent hover:!text-red-500 active:!text-red-700 group-hover/versionitem:text-setta-400/50",onClick:f,children:x.jsx("i",{className:"gg-trash"})})]})}function Tlt({sectionId:t,paramInfoId:e,configProps:n}){te.setState(r=>{const{uiTypeId:i,oldUITypeId:s}=Plt(t,e,r);yFe({uiTypeId:i,...n,state:r}),i!==s&&sI({uiTypeId:i,sectionId:t,paramInfoId:e,state:r}),Rlt(i,n.configName,r)})}function Plt(t,e,n){const r=n.codeInfo[e].name,{uiTypeColId:i}=n.x[t],s=n.uiTypeCols[i][e].nonPresetUITypeIds,o=Hy(t,e,n),a=mFe({currUIType:o,nonPresetUITypeIds:s,state:n});return a?{uiTypeId:a.id,oldUITypeId:o.id}:{uiTypeId:Alt({uiTypeColId:i,paramInfoId:e,currUIType:o,defaultName:r,state:n}).id,oldUITypeId:o.id}}function Alt({uiTypeColId:t,paramInfoId:e,currUIType:n,defaultName:r,state:i}){const s=eoe({uiType:n,name:r});return i.uiTypes[s.id]=s,i.uiTypeCols[t][e].nonPresetUITypeIds.push(s.id),s}function Rlt(t,e,n){const r=n.uiTypes[t];r.type===Y.SLIDER&&["min","max"].includes(e)&&$lt(r,n)}function $lt(t,e){const{variants:n,uiTypeCols:r}=e;for(const[i,s]of Object.entries(r)){const o=new Set;for(const[a,l]of Object.entries(s))l.uiTypeId===t.id&&o.add(a);if(o.size!==0){for(const a of Object.values(e.x))if(a.uiTypeColId===i){const l=a.variantId;for(const[c,u]of Object.entries(n[l].values))if(o.has(c)){const f=p$({uiType:t,currValue:u.value});f!==u.value&&Y$(l,c,f,e)}}}}}function Mlt(){function t(){Ra.setState({modalType:br.SAVE_UI_TYPE_CONFIG})}return x.jsx(aze,{asChild:!0,children:x.jsx(Fa,{size:"w-4 h-4",padding:"py-2 px-2",bg:"bg-transparent hover:bg-setta-100 dark:hover:bg-setta-800/50",onClick:t,children:x.jsx(bze,{className:"text-setta-500 dark:text-setta-600"})})})}const vde={whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1};function Ilt({divId:t,code:e,theme:n,onMouseDownCapture:r,onFocus:i,className:s,evRefs:o,placeholder:a,language:l}){return e?x.jsx(Llt,{divId:t,code:e,theme:n,onMouseDownCapture:r,onFocus:i,className:s,evRefs:o,language:l}):x.jsx(Dlt,{divId:t,className:s,placeholder:a,onMouseDownCapture:r,onFocus:i})}function Dlt({divId:t,className:e,placeholder:n,onMouseDownCapture:r,onFocus:i}){return x.jsx("span",{id:t,className:`${e} text-gray-600 outline-none`,style:vde,onMouseDownCapture:r,onFocus:i,tabIndex:"0",children:n||x.jsx("br",{})})}function Llt({divId:t,code:e,theme:n,onMouseDownCapture:r,className:i,evRefs:s,language:o,onFocus:a}){var A;const l=Nlt(o).parser.parse(e),c=n[1][2].value,u={},f=new Al,h={};for(const R of s)h[R.startPos]={keywordEndIdx:R.startPos+R.keyword.length,keyword:R.keyword};Hae(l,c,(R,Q,L)=>{f.add(R,Q,u[L]||(u[L]=ht.mark({class:L})))});const d=f.finish(),p=nn.of(e.split(`
352
352
  `)),g=[];let m,v,[y,b,S,k]=[null,null,null,null];const E=Dd.getState().fullNameToInfo,T=d.iter();for(let R=1;R<=p.lines;R++){const Q=p.line(R);v=!0,m=Q.from;const L=[];for(;T.value&&T.from<Q.to;){if(v=!1,T.from>m&&L.push(p.sliceString(m,T.from)),y===null&&T.from in h){const{keyword:Z,keywordEndIdx:J}=h[T.from];Z in E&&(y=Z,b=T.from,S=J,k=E[y].componentIndices)}const z=`${T.value.spec.class} ${y?"italic":""}`,B=y?y.slice(0,iAe(k,T.to-b)):null,q=y?Z=>_nt({event:Z,variable:B}):()=>{};L.push(x.jsx("span",{className:z,onClick:q,children:p.sliceString(T.from,Math.min(Q.to,T.to))},`line-${R}-${T.from}`)),m=T.to,m>=S&&(y=null,b=null,S=null,k=null),T.next()}L.push(p.sliceString(m,Q.to)),v&&L.push(x.jsx("br",{},`br-${R}`)),g.push(x.jsx("div",{className:"cm-line",children:L},`line-${R}`))}const C=((A=n[0][0])==null?void 0:A.value)||"";return x.jsx("div",{id:t,className:`${i} ${C} outline-none`,style:vde,onMouseDownCapture:r,onFocus:a,tabIndex:"0",children:g})}function Nlt(t){switch(t){case"python":return n2;case"javascript":return Ca;case"json":return Hce;default:return null}}function nk({dataSectionId:t,visualSectionId:e,paramInfoId:n,value:r,defaultVal:i,onChange:s,onBlur:o,onMouseDown:a,dummyCodeClassName:l,realCodeClassName:c,singleLine:u,keyComboActions:f,onEscape:h,onTab:d,color:p,language:g,evRefs:m,dummyDivId:v,autocomplete:y=!0,initializeGenCode:b=!0,isKeyName:S=!1,isDisabled:k=!1}){const[E,T]=_.useState(null),[C,A]=_.useState(!1),R=R3(p);function Q(){setTimeout(()=>{T(null),A(!1)},0),o==null||o()}function L(B){if(k){a==null||a(B);return}B.button===0&&(T(B),a3(e)),a==null||a(B)}function z(){k||(g==="python"&&b&&WNe({sectionId:t,paramInfoId:n}),E||T("tab"))}return x.jsxs(x.Fragment,{children:[!C&&x.jsx(Ilt,{divId:v,code:r,onMouseDownCapture:L,onFocus:z,className:l,theme:R,evRefs:m,placeholder:i,language:g}),E&&x.jsx(Qlt,{dataSectionId:t,visualSectionId:e,paramInfoId:n,value:r,defaultVal:i,onChange:s,className:c,singleLine:u,keyComboActions:f,onEscape:h,onTab:d,onBlur:Q,initialEvent:E,realIsInitialized:C,setRealIsInitialized:A,theme:R,evRefs:m,language:g,autocomplete:y,isKeyName:S})]})}function Qlt({dataSectionId:t,visualSectionId:e,paramInfoId:n,value:r,defaultVal:i,onChange:s,className:o,singleLine:a,keyComboActions:l,onEscape:c,onBlur:u,onTab:f,initialEvent:h,realIsInitialized:d,setRealIsInitialized:p,theme:g,evRefs:m,language:v,autocomplete:y,isKeyName:b}){const S=`CodeMirror-${e}-${n}${b?"-keyName":""}`,k=_.useMemo(()=>ufe(m),[JSON.stringify(m)]),E=_.useCallback(y?dfe(t,n,zie,v):()=>null,[t,n,y,v]),T=F3({sectionId:e,language:v,completionsFn:E,keywordStylizer:k,singleLine:a,tabToAutocomplete:!0,keyComboActions:l,onTab:f,onEscape:c}),C=wnt({evRefs:m,initialEvent:h,setRealIsInitialized:p,divId:S,value:r,defaultVal:i});return x.jsx(Ky,{id:S,className:`${o} ${d?"":"opacity-0"}`,value:r,placeholder:i,basicSetup:{lineNumbers:!1,foldGutter:!1,highlightActiveLine:!1,tabSize:4},onCreateEditor:C,theme:g,extensions:T,onChange:s,onBlur:u,indentWithTab:!1,tabIndex:"0"})}function VD({sectionId:t,paramInfoId:e}){return a_(n=>n.textFields[hfe({sectionId:t,paramInfoId:e})])}function jlt(t){return a_(e=>e.parametersRequest[t])}function Blt({onChange:t,config:e}){const n=e.choices??[],r=()=>{const o=[...n,{id:"",name:""}];t("choices",()=>o)},i=o=>{const a=n.filter((l,c)=>c!==o);t("choices",()=>a)},s=(o,a)=>{const l=n.map((c,u)=>u===o?{id:a,name:a}:c);t("choices",()=>l)};return x.jsxs(x.Fragment,{children:[x.jsxs("button",{onClick:r,className:"my-1 flex cursor-pointer items-center justify-between rounded-xl bg-setta-100 px-3 py-0.5 uppercase text-setta-500 hover:bg-setta-200 dark:bg-setta-850 dark:text-setta-500 dark:hover:bg-setta-850","aria-label":"Add choice",children:[x.jsx("p",{className:"text-sm font-black ",children:"Add Choices"}),x.jsx("i",{className:"gg-add !scale-90"})]}),x.jsx("div",{className:"flex flex-col gap-2 overflow-y-auto",children:n.map((o,a)=>x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx("div",{className:"flex flex-auto items-center gap-1 overflow-hidden",children:x.jsx("input",{type:"text",value:o.id,onChange:l=>s(a,l.target.value),placeholder:"Add description...",className:"m-[2px] w-full truncate rounded border px-2 py-1 text-xs text-setta-700 focus:outline-none focus:ring-2 focus:ring-blue-500 dark:text-setta-400 dark:placeholder-setta-700"})}),x.jsx("button",{onClick:()=>i(a),className:"flex cursor-pointer items-center rounded-full p-1 text-gray-400 hover:bg-gray-100 hover:text-gray-700","aria-label":"Remove choice",children:x.jsx("i",{className:"gg-close !scale-75"})})]},a))})]})}function Ode({choices:t,value:e,onChange:n,outerDivClasses:r,isDisabled:i}){const s=[{group:"Choices",items:t?t.filter(o=>o.id):[]}];return x.jsx(Yd,{outerDivClasses:r,allItems:s,value:e||null,onSelectedItemChange:n,small:!0,isDisabled:i})}function yde({className:t,value:e,onChange:n,onEscape:r,isDisabled:i}){const[s,o]=_.useState(!1),a=()=>{o(!s)};return x.jsxs(x.Fragment,{children:[x.jsx("input",{className:t,value:e,onChange:l=>n(l.target.value),disabled:i,type:s?"text":"password",onKeyDown:l=>{l.code==="Escape"&&(r==null||r())}}),x.jsx("button",{type:"button",onClick:a,className:"section-value grid-row-start-1 cursor-pointer justify-self-end text-setta-400 hover:text-setta-600 dark:text-setta-500 dark:hover:text-setta-300",tabIndex:-1,children:s?x.jsx(Nse,{}):x.jsx(Lse,{})})]})}function zlt(t,[e,n]){return Math.min(n,Math.max(e,t))}const bde=["PageUp","PageDown"],xde=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],wde={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},ib="Slider",[$A,Flt,Wlt]=Zm(ib),[Sde,SEt]=Oo(ib,[Wlt]),[Vlt,rk]=Sde(ib),Ult=_.forwardRef((t,e)=>{const{name:n,min:r=0,max:i=100,step:s=1,orientation:o="horizontal",disabled:a=!1,minStepsBetweenThumbs:l=0,defaultValue:c=[r],value:u,onValueChange:f=()=>{},onValueCommit:h=()=>{},inverted:d=!1,...p}=t,[g,m]=_.useState(null),v=In(e,B=>m(B)),y=_.useRef(new Set),b=_.useRef(0),S=o==="horizontal",k=g?!!g.closest("form"):!0,E=S?qlt:Xlt,[T=[],C]=Nl({prop:u,defaultProp:c,onChange:B=>{var q;(q=[...y.current][b.current])===null||q===void 0||q.focus(),f(B)}}),A=_.useRef(T);function R(B){const q=nct(T,B);z(B,q)}function Q(B){z(B,b.current)}function L(){const B=A.current[b.current];T[b.current]!==B&&h(T)}function z(B,q,{commit:Z}={commit:!1}){const J=oct(s),I=act(Math.round((B-r)/s)*s+r,J),j=zlt(I,[r,i]);C((M=[])=>{const X=ect(M,j,q);if(sct(X,l*s)){b.current=X.indexOf(j);const se=String(X)!==String(M);return se&&Z&&h(X),se?X:M}else return M})}return _.createElement(Vlt,{scope:t.__scopeSlider,disabled:a,min:r,max:i,valueIndexToChangeRef:b,thumbs:y.current,values:T,orientation:o},_.createElement($A.Provider,{scope:t.__scopeSlider},_.createElement($A.Slot,{scope:t.__scopeSlider},_.createElement(E,Ee({"aria-disabled":a,"data-disabled":a?"":void 0},p,{ref:v,onPointerDown:gt(p.onPointerDown,()=>{a||(A.current=T)}),min:r,max:i,inverted:d,onSlideStart:a?void 0:R,onSlideMove:a?void 0:Q,onSlideEnd:a?void 0:L,onHomeKeyDown:()=>!a&&z(r,0,{commit:!0}),onEndKeyDown:()=>!a&&z(i,T.length-1,{commit:!0}),onStepKeyDown:({event:B,direction:q})=>{if(!a){const I=bde.includes(B.key)||B.shiftKey&&xde.includes(B.key)?10:1,j=b.current,M=T[j],X=s*I*q;z(M+X,j,{commit:!0})}}})))),k&&T.map((B,q)=>_.createElement(Jlt,{key:q,name:n?n+(T.length>1?"[]":""):void 0,value:B})))}),[_de,kde]=Sde(ib,{startEdge:"left",endEdge:"right",size:"width",direction:1}),qlt=_.forwardRef((t,e)=>{const{min:n,max:r,dir:i,inverted:s,onSlideStart:o,onSlideMove:a,onSlideEnd:l,onStepKeyDown:c,...u}=t,[f,h]=_.useState(null),d=In(e,b=>h(b)),p=_.useRef(),g=jd(i),m=g==="ltr",v=m&&!s||!m&&s;function y(b){const S=p.current||f.getBoundingClientRect(),k=[0,S.width],T=UD(k,v?[n,r]:[r,n]);return p.current=S,T(b-S.left)}return _.createElement(_de,{scope:t.__scopeSlider,startEdge:v?"left":"right",endEdge:v?"right":"left",direction:v?1:-1,size:"width"},_.createElement(Cde,Ee({dir:g,"data-orientation":"horizontal"},u,{ref:d,style:{...u.style,["--radix-slider-thumb-transform"]:"translateX(-50%)"},onSlideStart:b=>{const S=y(b.clientX);o==null||o(S)},onSlideMove:b=>{const S=y(b.clientX);a==null||a(S)},onSlideEnd:()=>{p.current=void 0,l==null||l()},onStepKeyDown:b=>{const k=wde[v?"from-left":"from-right"].includes(b.key);c==null||c({event:b,direction:k?-1:1})}})))}),Xlt=_.forwardRef((t,e)=>{const{min:n,max:r,inverted:i,onSlideStart:s,onSlideMove:o,onSlideEnd:a,onStepKeyDown:l,...c}=t,u=_.useRef(null),f=In(e,u),h=_.useRef(),d=!i;function p(g){const m=h.current||u.current.getBoundingClientRect(),v=[0,m.height],b=UD(v,d?[r,n]:[n,r]);return h.current=m,b(g-m.top)}return _.createElement(_de,{scope:t.__scopeSlider,startEdge:d?"bottom":"top",endEdge:d?"top":"bottom",size:"height",direction:d?1:-1},_.createElement(Cde,Ee({"data-orientation":"vertical"},c,{ref:f,style:{...c.style,["--radix-slider-thumb-transform"]:"translateY(50%)"},onSlideStart:g=>{const m=p(g.clientY);s==null||s(m)},onSlideMove:g=>{const m=p(g.clientY);o==null||o(m)},onSlideEnd:()=>{h.current=void 0,a==null||a()},onStepKeyDown:g=>{const v=wde[d?"from-bottom":"from-top"].includes(g.key);l==null||l({event:g,direction:v?-1:1})}})))}),Cde=_.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:i,onSlideEnd:s,onHomeKeyDown:o,onEndKeyDown:a,onStepKeyDown:l,...c}=t,u=rk(ib,n);return _.createElement(gn.span,Ee({},c,{ref:e,onKeyDown:gt(t.onKeyDown,f=>{f.key==="Home"?(o(f),f.preventDefault()):f.key==="End"?(a(f),f.preventDefault()):bde.concat(xde).includes(f.key)&&(l(f),f.preventDefault())}),onPointerDown:gt(t.onPointerDown,f=>{const h=f.target;h.setPointerCapture(f.pointerId),f.preventDefault(),u.thumbs.has(h)?h.focus():r(f)}),onPointerMove:gt(t.onPointerMove,f=>{f.target.hasPointerCapture(f.pointerId)&&i(f)}),onPointerUp:gt(t.onPointerUp,f=>{const h=f.target;h.hasPointerCapture(f.pointerId)&&(h.releasePointerCapture(f.pointerId),s(f))})}))}),Hlt="SliderTrack",Zlt=_.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,i=rk(Hlt,n);return _.createElement(gn.span,Ee({"data-disabled":i.disabled?"":void 0,"data-orientation":i.orientation},r,{ref:e}))}),bX="SliderRange",Ylt=_.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,i=rk(bX,n),s=kde(bX,n),o=_.useRef(null),a=In(e,o),l=i.values.length,c=i.values.map(h=>Ede(h,i.min,i.max)),u=l>1?Math.min(...c):0,f=100-Math.max(...c);return _.createElement(gn.span,Ee({"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0},r,{ref:a,style:{...t.style,[s.startEdge]:u+"%",[s.endEdge]:f+"%"}}))}),xX="SliderThumb",Glt=_.forwardRef((t,e)=>{const n=Flt(t.__scopeSlider),[r,i]=_.useState(null),s=In(e,a=>i(a)),o=_.useMemo(()=>r?n().findIndex(a=>a.ref.current===r):-1,[n,r]);return _.createElement(Klt,Ee({},t,{ref:s,index:o}))}),Klt=_.forwardRef((t,e)=>{const{__scopeSlider:n,index:r,...i}=t,s=rk(xX,n),o=kde(xX,n),[a,l]=_.useState(null),c=In(e,m=>l(m)),u=V5(a),f=s.values[r],h=f===void 0?0:Ede(f,s.min,s.max),d=tct(r,s.values.length),p=u==null?void 0:u[o.size],g=p?rct(p,h,o.direction):0;return _.useEffect(()=>{if(a)return s.thumbs.add(a),()=>{s.thumbs.delete(a)}},[a,s.thumbs]),_.createElement("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[o.startEdge]:`calc(${h}% + ${g}px)`}},_.createElement($A.ItemSlot,{scope:t.__scopeSlider},_.createElement(gn.span,Ee({role:"slider","aria-label":t["aria-label"]||d,"aria-valuemin":s.min,"aria-valuenow":f,"aria-valuemax":s.max,"aria-orientation":s.orientation,"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,tabIndex:s.disabled?void 0:0},i,{ref:c,style:f===void 0?{display:"none"}:t.style,onFocus:gt(t.onFocus,()=>{s.valueIndexToChangeRef.current=r})}))))}),Jlt=t=>{const{value:e,...n}=t,r=_.useRef(null),i=iM(e);return _.useEffect(()=>{const s=r.current,o=window.HTMLInputElement.prototype,l=Object.getOwnPropertyDescriptor(o,"value").set;if(i!==e&&l){const c=new Event("input",{bubbles:!0});l.call(s,e),s.dispatchEvent(c)}},[i,e]),_.createElement("input",Ee({style:{display:"none"}},n,{ref:r,defaultValue:e}))};function ect(t=[],e,n){const r=[...t];return r[n]=e,r.sort((i,s)=>i-s)}function Ede(t,e,n){return 100/(n-e)*(t-e)}function tct(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function nct(t,e){if(t.length===1)return 0;const n=t.map(i=>Math.abs(i-e)),r=Math.min(...n);return n.indexOf(r)}function rct(t,e,n){const r=t/2,s=UD([0,50],[0,r]);return(r-s(e)*n)*n}function ict(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function sct(t,e){if(e>0){const n=ict(t);return Math.min(...n)>=e}return!0}function UD(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(t[1]-t[0]);return e[0]+r*(n-t[0])}}function oct(t){return(String(t).split(".")[1]||"").length}function act(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}const lct=Ult,cct=Zlt,uct=Ylt,fct=Glt;function hct({twClasses:t,...e}){const n=`nodrag border-0 border-b cursor-auto border-setta-300 dark:border-setta-700 border-solid text-xs dark:text-setta-300 font-code focus-visible:border-blue-400 ${t}`;return x.jsx("input",{...e,className:n})}function dct({options:t,onChange:e,onBlur:n,config:r}){return x.jsx("div",{className:"mt-1 flex flex-col",children:t.map((i,s)=>x.jsxs("div",{className:"flex flex-grow items-center justify-between rounded-full px-3 py-[0.33rem] hover:bg-[#cbd5e02b]",children:[x.jsx("p",{className:"flex-1 font-sans text-xs font-semibold text-setta-600",children:i}),x.jsx(hct,{twClasses:"justify-end",placeholder:i,onChange:o=>e(i,o.target.value),onBlur:o=>n(i,o.target.value),value:r[i]},`${i}-${s}`)]},`SimpleConfig-${s}`))})}function pct({onChange:t,config:e}){const n=["min","max","step"],[r,i]=_.useState(e);function s(a,l){i({...r,[a]:l})}function o(a,l){const c=ae.toNumber(l);if(l===""||!ae.isFinite(c)||!mct(a,c,r)){i(e);return}t(a,()=>c)}return _.useEffect(()=>{i(e)},[e]),x.jsx(dct,{options:n,onChange:s,onBlur:o,config:r})}function mct(t,e,n){let{step:r,min:i,max:s}=n;return t==="min"?i=e:t==="max"?s=e:r=e,i<s&&r<=s-i}function wm({value:t,defaultVal:e,onChange:n,onEscape:r,onCommit:i,min:s,max:o,step:a,isDisabled:l,wrapperDivClass:c,sliderRootClassName:u,sliderTrackClassName:f,sliderRangeClassName:h,sliderThumbClassName:d,textInputClassName:p}){return x.jsxs("div",{className:c,children:[x.jsx(vct,{value:t,defaultVal:e,onChange:n,onCommit:i,min:s,max:o,step:a,isDisabled:l,sliderRootClassName:u,sliderTrackClassName:f,sliderRangeClassName:h,sliderThumbClassName:d}),x.jsx(gct,{className:p,value:t,onChange:n,onCommit:i,onEscape:r,min:s,max:o})]})}function gct({className:t,value:e,onChange:n,onCommit:r,onEscape:i,min:s,max:o,step:a}){const[l,c]=_.useState(e);function u(h){c(h.target.value)}function f(h){const d=ae.toNumber(h.target.value);if(h.target.value===""||!ae.isFinite(d)){c(e);return}const p=Hc(d,s,o);c(p),n==null||n(p),r==null||r(p)}return _.useEffect(()=>{c(e)},[e]),x.jsx("input",{className:t,value:l,onChange:u,onBlur:f,onKeyDown:h=>{h.code==="Escape"&&(i==null||i())}})}function vct({value:t,defaultVal:e,onChange:n,onCommit:r,min:i,max:s,step:o,isDisabled:a,sliderRootClassName:l,sliderTrackClassName:c,sliderRangeClassName:u,sliderThumbClassName:f}){const h=ae.toNumber(t),d=isNaN(h)?i:Hc(ae.toNumber(t),i,s);return x.jsxs(lct,{className:l,value:[d],defaultValue:[e],min:i,max:s,step:o,disabled:a,onValueChange:p=>n==null?void 0:n(p[0]),onValueCommit:p=>r==null?void 0:r(p[0]),children:[x.jsx(cct,{className:c,children:x.jsx(uct,{className:u})}),x.jsx(fct,{className:f})]})}function Oct(){return null}function yct({name:t,...e}){switch(t){default:return x.jsx(Oct,{...e});case Y.SLIDER:return x.jsx(pct,{...e});case Y.SWITCH:return x.jsx(alt,{...e});case Y.COLOR_PICKER:return x.jsx(elt,{...e});case Y.DROPDOWN:return x.jsx(Blt,{...e})}}function bct({sectionId:t,paramInfoId:e,value:n,onChange:r,maybeErrorMessage:i,evRefs:s}){const o=Ut(p=>p.isSelectingParams),{uiType:a,configLanguage:l,defaultVal:c,disabledOrFrozen:u}=te(p=>({uiType:Hy(t,e,p),configLanguage:p.x[t].configLanguage,defaultVal:p.codeInfo[e].defaultVal,disabledOrFrozen:p.codeInfo[e].isDisabled||Yt(t,p).isFrozen}),ae.isEqual),f=VD({sectionId:t,paramInfoId:e}),h=o||u;function d(){ng(null,t,!1)}switch(a.type){case Y.TEXT:return x.jsxs(x.Fragment,{children:[x.jsx(nk,{dummyDivId:`${t}-${e}-ParamInput`,dataSectionId:t,visualSectionId:t,paramInfoId:e,value:n,defaultVal:c,onChange:r,onEscape:m=>{m||d()},dummyCodeClassName:`section-value self-end peer/textinput ${i?"[&_*]:!text-red-500":""} nodrag ${h?"":"cursor-text select-text"} break-words font-mono text-xs [tab-size:4] [word-break:break-word] py-[.125rem]`,realCodeClassName:`nodrag self-end peer/textinput ${i?"[&_*]:!text-red-500":""} [&_*]:!outline-0 cursor-text select-text [&_.cm-activeLine]:!px-0 [&_.cm-activeLine]:!bg-setta-200/10 [&_.cm-content]:!py-0 [&_.cm-content]:!px-0 [&_.cm-line]:!px-0 [&_.cm-content]:text-xs section-value py-[.125rem]`,language:l,evRefs:s,isDisabled:h}),f&&x.jsx("i",{className:"section-value gg-spinner self-center justify-self-end text-blue-500/70"}),x.jsx("span",{className:`section-value grid-row-start-1 border-box self-end border-b border-setta-200/50 dark:border-setta-600/30 ${o?"":"peer-focus-within/textinput:border-blue-400"}`})]});case Y.SLIDER:{const{min:m,max:v,step:y}=a.config;return x.jsx(wm,{value:n,defaultVal:c,onChange:r,onEscape:d,min:m,max:v,step:y,isDisabled:h,wrapperDivClass:`${Cl} cursor-pointer @container/slider section-value flex gap-1`,sliderRootClassName:" data[orientation='vertical']:flex-col data[orientation='vertical']:w-5 data[orientation='vertical']:h-24 SliderRoot relative flex w-full touch-none select-none items-center data-[orientation='horizontal']:h-5",sliderTrackClassName:"relative flex-grow rounded-full bg-setta-200 data-[orientation='horizontal']:h-[3px] data-[orientation='vertical']:w-[3px] dark:bg-setta-700",sliderRangeClassName:"absolute h-full rounded-full bg-blue-500",sliderThumbClassName:`${YR} block h-3 w-3 cursor-pointer
353
353
  rounded-full border-2 border-setta-300 bg-white shadow-sm drop-shadow-md hover:!bg-setta-100 hover:dark:!bg-setta-700 focus-visible:!border-blue-500 focus-visible:bg-blue-500 focus-visible:dark:bg-blue-700 focus-visible:outline-none dark:border-setta-400 dark:bg-setta-600 data-[disabled]:pointer-events-none`,textInputClassName:"hidden my-auto mr-[1px] h-5/6 w-8 cursor-auto resize-none rounded-lg border border-solid border-setta-300/20 bg-white px-2 text-center font-mono text-xs focus-visible:border-blue-300 dark:border-setta-875 dark:bg-setta-875 dark:text-setta-300 @[132px]/slider:block"})}case Y.SWITCH:return x.jsx(WD,{value:n,defaultVal:c,onChange:r,onEscape:d,isDisabled:h,outerDivClassName:"section-value flex justify-self-start self-center",twRootClasses:"nodrag"});case Y.COLOR_PICKER:const{colorChoices:p}=a.config;return x.jsx(FD,{colorChoices:p,value:n,onChange:r,onEscape:d,wrapperClassName:"section-value single-cell-container min-w-0 w-[calc(100%_-_2px)] justify-self-start self-center h-[calc(100%_-_4px)] min-h-0",colorPickerChoicesClasses:"flex-1 cursor-pointer items-center overflow-hidden rounded-lg single-cell-container colorpicker h-full min-h-0 w-full min-w-0 items-center text-white",isDisabled:h});case Y.DROPDOWN:const{choices:g}=a.config;return x.jsx(Ode,{choices:g,value:n,onChange:r,outerDivClasses:"section-value flex justify-self-start self-center [&_search]:my-auto",isDisabled:h});case Y.PASSWORD:return x.jsxs(x.Fragment,{children:[x.jsx(yde,{className:`${h?"":"cursor-text select-text"} nodrag section-value peer/textinput flex min-w-0 max-w-[calc(100%_-_1.1rem)] self-center justify-self-start font-mono text-xs text-[rgb(3,_47,_98);] dark:text-[rgb(165,_214,_255)]`,value:n,onChange:r,onEscape:d,isDisabled:h}),x.jsx("span",{className:`section-value grid-row-start-1 border-box self-end border-b border-setta-200/50 dark:border-setta-600/30 ${o?"":"peer-focus-within/textinput:border-blue-400"}`})]})}}function xct({dataSectionId:t,visualSectionId:e,paramInfoId:n,value:r,defaultVal:i,onChange:s,evRefs:o,isDisabled:a}){const{uiType:l,configLanguage:c}=te(h=>({uiType:Hy(t,n,h),configLanguage:h.x[t].configLanguage}),ae.isEqual),u=VD({dataSectionId:t,paramInfoId:n}),f=Ut(h=>h.isSelectingParams);switch(l.type){default:return x.jsxs(x.Fragment,{children:[x.jsx(nk,{dataSectionId:t,visualSectionId:e,paramInfoId:n,value:r,defaultVal:i,onChange:s,dummyCodeClassName:"section-key-value peer/textinput self-end grid-row-start-1 mx-3 py-[.125rem] nodrag cursor-text select-text break-words px-0 font-mono text-xs [tab-size:4] [word-break:break-word]",realCodeClassName:"section-key-value peer/textinput self-end grid-row-start-1 py-[.125rem] mx-3 nodrag [&_*]:!outline-0 cursor-text select-text [&_.cm-activeLine]:!px-0 [&_.cm-activeLine]:!bg-setta-200/10 [&_.cm-content]:!py-0 [&_.cm-content]:!px-0 [&_.cm-line]:!px-0 [&_.cm-content]:text-xs first:[&_.cm-line>*]:mt-[3px]",language:c,evRefs:o,isDisabled:a}),u&&x.jsx("i",{className:"section-value gg-spinner self-center justify-self-end text-blue-500/70"}),x.jsx("span",{className:`section-key-value grid-row-start-1 border-box mx-3 self-end border-b border-setta-200/50 ${f?"":"peer-focus-within/textinput:border-blue-400"} dark:border-setta-600/30`})]});case Y.SLIDER:{const{min:p,max:g,step:m}=l.config;return x.jsx(wm,{value:r,defaultVal:i,onChange:s,min:p,max:g,step:m,isDisabled:a,wrapperDivClass:"section-key-value flex gap-1 ml-2",sliderRootClassName:"data[orientation='vertical']:flex-col data[orientation='vertical']:w-5 data[orientation='vertical']:h-24 SliderRoot relative flex w-full touch-none select-none items-center data-[orientation='horizontal']:h-5",sliderTrackClassName:"relative flex-grow rounded-full bg-setta-200 data-[orientation='horizontal']:h-[3px] data-[orientation='vertical']:w-[3px] dark:bg-setta-700",sliderRangeClassName:"absolute h-full rounded-full bg-blue-500",sliderThumbClassName:`${YR} block h-3 w-3 cursor-pointer
354
354
  rounded-full border-2 border-setta-300 bg-white shadow-sm drop-shadow-md hover:bg-setta-100 focus:border-blue-500 focus-visible:outline-none dark:border-setta-400 dark:bg-setta-600`,textInputClassName:"w-8 cursor-auto resize-none rounded-lg border border-solid border-setta-300/20 bg-white px-2 text-center font-mono text-xs focus-visible:border-blue-300 dark:border-setta-875 dark:bg-setta-875 dark:text-setta-300"})}case Y.SWITCH:return x.jsx(WD,{value:r,defaultVal:i,onChange:s,isDisabled:a,outerDivClassName:"section-key-value flex justify-self-start self-center ml-2",twRootClasses:"nodrag"});case Y.COLOR_PICKER:const{colorChoices:h}=l.config;return x.jsx(FD,{colorChoices:h,value:r,onChange:s,wrapperClassName:"section-key-value single-cell-container w-[calc(100%_-_1.25rem)] min-h-0 flex justify-self-start self-center ml-2",colorPickerChoicesClasses:"flex-1 cursor-pointer items-center overflow-hidden rounded-lg single-cell-container colorpicker h-full min-h-0 w-full min-w-0 items-center text-white",isDisabled:a});case Y.DROPDOWN:const{choices:d}=l.config;return x.jsx(Ode,{choices:d,value:r,onChange:s,outerDivClasses:"section-key-value w-[calc(100%_-_1.15rem)] ml-2 flex justify-self-start self-center [&_search]:my-auto",isDisabled:a});case Y.PASSWORD:return x.jsx(yde,{className:`${a?"":"cursor-text select-text"} nodrag section-value flex self-center justify-self-start`,value:r,onChange:s,isDisabled:a})}}function wct(t){const e=pFe[t.type];return rI(t)?`${t.name} - (${e})`:e}function Sct(t,e,n,r){const i=[],s=ae.filter(t,n);for(const o of Object.values(t))if(!(!e(o)||!iI(o)))if(Jse(o))if(o.id===r)i.push(o);else{const a=s.find(l=>l.type===o.type);i.push(a??o)}else i.push(o);return i.map(o=>({id:o.id,name:wct(o),presetType:o.presetType,displayType:o.presetType??Y.PRESET_UI_TYPE_BASE}))}function _ct(t,e,n){return te(r=>{const i=Sle(t,e,"nonPresetUITypeIds",r),s=a=>Y.NON_SECTION_TYPES.includes(a.type),o=a=>toe(a,i);return Sct(r.uiTypes,s,o,n)},ae.isEqual)}function kct({onDropdownSelect:t,selectedId:e,availableUITypes:n}){const r=ae.groupBy(n,"displayType"),i=Object.keys(r).map(s=>({group:s,items:r[s]}));return x.jsx(Yd,{allItems:i,value:e,onSelectedItemChange:t})}function Cct({sectionId:t,paramInfoId:e,selectedId:n,...r}){const i=_ct(t,e,n);return x.jsx(kct,{availableUITypes:i,selectedId:n,...r})}function Ect({onDropdownSelect:t,selectedId:e,selectedType:n,onConfigChange:r,sectionId:i,paramInfoId:s,config:o}){return x.jsxs(x.Fragment,{children:[x.jsx(Cct,{sectionId:i,paramInfoId:s,onDropdownSelect:t,selectedId:e}),x.jsx(yct,{name:n,config:o,onChange:r})]})}const Tct=ke.memo($ct,ae.isEqual),Pct=ke.forwardRef(({sectionId:t},e)=>{const n=mfe(t);return x.jsx(Rct,{sectionId:t,paramInfos:n})}),Act=ke.memo(Pct);function Rct({sectionId:t,paramInfos:e}){const[n,r]=MM(e,["name"],50),i="flex-grow outline-0 min-w-0 w-full cursor-auto bg-transparent [border-width:0_0_1px_0] border-solid border-setta-200 dark:border-setta-800 focus-visible:!border-blue-300 pl-5 py-1 truncate placeholder-setta-400 dark:placeholder-setta-700 text-sm";return x.jsxs("div",{className:"flex flex-1 flex-col gap-1 overflow-y-hidden",children:[x.jsx(Ud,{inputStyles:i,placeholder:"Filter",leftElement:x.jsx("i",{className:"gg-sort-az !scale-75 text-setta-600 dark:text-setta-400"}),onChange:s=>r(s.target.value)}),x.jsx("div",{className:"mt-4 flex flex-col gap-2 overflow-y-scroll [&>*]:mx-[2px]",children:t&&n.map((s,o)=>x.jsx(Tct,{sectionId:t,paramInfo:s},`${s.name}-${o}`))})]})}function $ct({sectionId:t,paramInfo:e}){const n=e.id,r=te(a=>Hy(t,n,a),ae.isEqual),i=e.name,s=a=>{te.setState(l=>{sI({uiTypeId:a,sectionId:t,paramInfoId:n,state:l})})},o=(a,l)=>{Tlt({sectionId:t,paramInfoId:n,configProps:{configName:a,newValueFn:l}})};return x.jsxs("div",{className:"flex flex-col self-stretch text-left last:mb-[400px] hover:opacity-100 hover:duration-500 [&:hover_.uicfg-title]:text-black dark:[&:hover_.uicfg-title]:text-setta-200",children:[x.jsxs("div",{className:"flex items-center justify-between",children:[x.jsx("p",{className:"uicfg-title truncate text-xs font-semibold text-setta-500",children:i}),x.jsx("div",{className:"flex gap-[0.1rem] place-self-end",children:x.jsx(Mlt,{})})]}),x.jsx(Ect,{onDropdownSelect:s,selectedId:r.id,selectedType:r.type,onConfigChange:o,config:r.config,sectionId:t,paramInfoId:n})]})}const Mct=oT;function Ict(){const t=ir(u=>u.ids,ae.isEqual),{tab:e,requiredTabs:n,uiTypeName:r,renderMarkdown:i}=jXe(t[0]),[s]=Ot.uiEditorVis.hook(),[o]=Ot.uiEditorWidth.hook(),a=i?"Markdown Editor":"Text Editor",l=e===Gp?a:null,c={vis:s,tab:e,onTabClick:Cle(r),className:"flex h-10 w-10 cursor-pointer items-center justify-center text-2xl focus-visible:border-transparent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-light-blue-500",requiredTabs:n};return x.jsxs("div",{id:"UiEditorPane",className:"contents",onKeyDown:yNe,children:[x.jsxs("div",{className:"absolute right-0 z-[19] flex h-[calc(100%_-_48px)] w-[50px] flex-col items-center gap-1 border-l border-setta-200/75 bg-setta-50 py-3 dark:border-setta-850 dark:bg-setta-900",children:[x.jsx(Nh,{tabName:al,...c,...Rr({content:"Section Config"}),children:x.jsx(nHe,{})}),x.jsx(Nh,{tabName:Yp,...c,...Rr({content:"Parameter UI Config"}),children:x.jsx(KXe,{})}),x.jsx(Nh,{tabName:tO,...c,...Rr({content:"Parameter Info Editing"}),children:x.jsx(cHe,{})}),x.jsx(Nh,{tabName:Gp,...c,...Rr({content:a}),children:x.jsx(rHe,{})}),x.jsx(Nh,{tabName:Sc,...c,...Rr({content:"Section Variants"}),children:x.jsx(dHe,{})})]}),x.jsx(wle,{paneName:Mct,right:!0,minimumWidth:425,vis:s,width:o,children:t.length===1&&s?x.jsx(Dct,{sectionId:t[0],tab:e,inputTitle:l}):x.jsx(Nct,{})})]})}function Dct({sectionId:t,tab:e,inputTitle:n}){const r=n??K7e[e];return x.jsxs("div",{className:"flex h-full min-h-0 w-[calc(100%_-_3rem)] min-w-0 flex-1 flex-col overflow-hidden pr-1.5",children:[x.jsx("h2",{className:"mb-1 cursor-pointer select-none text-xs font-bold uppercase tracking-tight text-setta-300 dark:text-setta-500",children:r}),x.jsx(Lct,{sectionId:t,tab:e})]})}function Lct({sectionId:t,tab:e}){switch(e){case al:return x.jsx(dlt,{sectionId:t});case Yp:return x.jsx(Act,{sectionId:t});case tO:return x.jsx(Qnt,{sectionId:t});case Gp:return x.jsx(Rnt,{sectionId:t});case Sc:return x.jsx(_lt,{sectionId:t})}}function Nct(){return x.jsx("aside",{className:"grid h-full min-h-0 w-[calc(100%_-_2rem)]",children:x.jsxs("div",{className:"flex flex-col items-center gap-4 place-self-center",children:[x.jsx(Ple,{className:"h-20 w-20 text-setta-300 dark:text-setta-700 "}),x.jsx("h4",{className:"text-center text-lg font-bold tracking-widest text-setta-300 dark:text-setta-600",children:"Select A Section to Edit"})]})})}function Qct(t){return ft({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",strokeWidth:"2",d:"M2.99787498,0.999999992 L17.4999998,0.999999992 L20.9999998,4.50000005 L21,23 L3,23 L2.99787498,0.999999992 Z M16,1 L16,6 L21,6 M9,12 L15,18 M15,12 L9,18"},child:[]}]})(t)}function jct(t){return ft({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",strokeWidth:"2",d:"M12,17 C9.27272727,17 6,14.2222222 6,12 C6,9.77777778 9.27272727,7 12,7 C14.7272727,7 18,9.77777778 18,12 C18,14.2222222 14.7272727,17 12,17 Z M11,12 C11,12.55225 11.44775,13 12,13 C12.55225,13 13,12.55225 13,12 C13,11.44775 12.55225,11 12,11 C11.44775,11 11,11.44775 11,12 Z"},child:[]}]})(t)}function Bct(){return x.jsx("div",{className:"single-cell-container absolute inset-0 ",children:x.jsxs("div",{className:"single-cell-child my-auto flex flex-col items-center gap-6 text-setta-400 dark:text-setta-700",children:[x.jsx(Qct,{className:"h-24 w-24"}),x.jsx("h1",{className:"text-5xl font-black ",children:"Project Not Found"})]})})}function Yr({children:t,onClick:e,onMouseOver:n}){return x.jsx(ude,{className:"flex cursor-pointer flex-row items-center gap-2 rounded-md px-2 py-[0.15rem] font-sans text-xs font-semibold text-setta-700 outline-none hover:bg-setta-100 hover:ring-0 focus-visible:ring-1 dark:text-setta-100 dark:hover:bg-setta-700",onClick:e,onMouseOver:n,children:t})}function qD(t,e,n){t.preventDefault();const r={isOpen:!0,x:t.clientX,y:t.clientY,...n};xy.setState(i=>({[e]:{...i[e],...r}}))}function zct(t){qD(t,"pane")}function Fct(t,e){qD(t,"selection",{nodeIds:e})}function Wct(t,e){qD(t,"typeError",{paramInfoId:e})}function Sm(){xy.getState().reset()}function XD({children:t,x:e,y:n,isOpen:r,closeContextMenu:i}){const s=Vct(r,i),[o,a]=_.useState({top:-9999,left:-9999,opacity:0}),l=_.useRef(null);return _.useEffect(()=>{if(!r){a({top:-9999,left:-9999,opacity:0});return}requestAnimationFrame(()=>{if(l.current){const c=l.current.getBoundingClientRect(),u=window.innerHeight,f=window.innerWidth;let h=n,d=e;n+c.height>u&&(h=n-c.height),e+c.width>f&&(d=e-c.width),h<_z&&(n+c.height<=u?h=n:h=_z),d<0&&(d=0),a({top:h,left:d,opacity:1})}})},[e,n,r]),x.jsx(lde,{open:r,modal:!1,children:x.jsx(cde,{className:"absolute z-10 flex w-[clamp(5rem,_20vw,_10rem)] min-w-32 cursor-pointer flex-col rounded-md border border-solid border-setta-500/50 bg-white px-2 py-2 shadow-xl dark:bg-setta-900",style:{left:o.left,top:o.top,opacity:o.opacity},ref:c=>{s.current=c,l.current=c},children:t})})}function Vct(t,e){const n=_.useRef(null);return _.useEffect(()=>{function r(i){n.current&&!n.current.contains(i.target)&&t&&e()}return document.addEventListener("mousedown",r),()=>{document.removeEventListener("mousedown",r)}},[n,t]),n}function Uct(){const{isOpen:t,x:e,y:n}=xy(s=>s.pane,ae.isEqual),r=te(s=>s.singletonSections,ae.isEqual);function i(s){return()=>{te.setState(o=>{_M({position:Vf({x:e,y:n}),state:o,...s})}),hn(!0),Sm()}}return x.jsxs(XD,{x:e,y:n,closeContextMenu:Sm,isOpen:t,children:[x.jsx("p",{className:"mx-2 mb-2 min-w-[100px] border-b border-setta-100 py-1 text-xs font-bold uppercase text-setta-300 dark:border-setta-700 dark:text-setta-500",children:"Create New"}),x.jsx(Yr,{onClick:i({type:Y.SECTION}),children:"Section"}),x.jsx(Yr,{onClick:i({type:Y.LIST_ROOT}),children:"List"}),x.jsx(Yr,{onClick:i({type:Y.DICT_ROOT}),children:"Dict"}),x.jsx(Yr,{onClick:i({type:Y.GROUP}),children:"Group"}),x.jsx(Yr,{onClick:i({type:Y.INFO}),children:"Info"}),!r[Y.GLOBAL_VARIABLES]&&x.jsx(Yr,{onClick:i({type:Y.GLOBAL_VARIABLES}),children:"Global Variables"}),x.jsx(Yr,{onClick:i({type:Y.CODE,sectionProps:{codeLanguage:"python"}}),children:"Python Code"}),x.jsx(Yr,{onClick:i({type:Y.CODE,sectionProps:{codeLanguage:"bash"}}),children:"Bash Script"}),x.jsx(Yr,{onClick:i({type:Y.TERMINAL}),children:"Terminal"}),!r[Y.GLOBAL_PARAM_SWEEP]&&x.jsx(Yr,{onClick:i({type:Y.GLOBAL_PARAM_SWEEP}),children:"Global Param Sweep"}),x.jsx(Yr,{onClick:i({type:Y.DRAW}),children:"Drawing Area"}),x.jsx(Yr,{onClick:i({type:Y.IMAGE}),children:"Image"}),x.jsx(Yr,{onClick:i({type:Y.CHART}),children:"Chart"}),x.jsx(Yr,{onClick:i({type:Y.SOCIAL}),children:"Social"}),x.jsx(Yr,{onClick:i({type:Y.IFRAME}),children:"IFrame"})]})}function _m(t,e){const n=[...new Set(jne(t,e))],r=n.filter(i=>e.uiTypes[e.x[i].uiTypeId].type===Y.TERMINAL);Hct(n,e),r&&mNe(r),HT(n),Une(n)}function qct(t,e,n=1){te.setState(r=>{if(t){const i=Yt(e,r).children;_m(i.slice(0,n),r)}else{const i=r.x[e].parentId,s=Yt(i,r).children,o=s.indexOf(e)+1;_m(s.slice(o,o+n),r)}}),hn(!0)}function Xct(){const t=ir.getState().ids;te.setState(e=>{_m(t,e)}),hn(!0)}function Hct(t,e){var r,i;const n=new Set(t);for(const s of n){const o=(r=e.x[s])==null?void 0:r.parentId;o&&((i=e.x[o])!=null&&i.variantId)&&am(o,l=>l.filter(c=>c!==s),e);let a=!1;for(const l of Object.values(e.variants))if(l.children.includes(s)){a=!0;break}if(!a){for(const l of e.x[s].variantIds)delete e.variants[l];delete e.x[s]}}for(const[s,o]of Object.entries(e.x))n.has(o.paramSweepSectionId)&&(e.x[s].paramSweepSectionId=null)}async function Tde(t){return await jt({body:{sectionsAndOtherInfo:t},address:Y.ROUTE_COPY_SECTIONS})}async function Zct(){const t=ir.getState().ids;if(t.length>0&&window.getSelection().toString()===""){const e=Pde(t);await navigator.clipboard.writeText(JSON.stringify({data:e,copyType:"sections"}))}}function Pde(t){const e=te.getState(),n=Yct(t,e),r=Gct(n,e),i=Kct(n,e),s=Jct(n,i,e),o=eut(r,e),a=tut(o,e),l=nut(n);return{sections:n,sectionVariants:r,uiTypeCols:i,uiTypes:s,codeInfoCols:o,codeInfo:a,relativePositions:l}}function Yct(t,e){const n=jne(t,e),r=ae.pick(e.x,n),i=ae.pickBy(r,s=>dn(s.id)!==Y.PARAM_SWEEP?!0:!!ky(s.id,r));return ae.size(r)!==ae.size(i)&&Vi("Lone param sweeps won't be included in copy"),i}function Gct(t,e){const n={};for(const r of Object.values(t))Object.assign(n,ae.pick(e.variants,r.variantIds));return n}function Kct(t,e){return ae.pick(e.uiTypeCols,ae.map(t,n=>n.uiTypeColId))}function Jct(t,e,n){const r=[];for(const i of Object.values(t))r.push(i.uiTypeId),r.push(...i.nonPresetUITypeIds);for(const i of Object.values(e))for(const s of Object.values(i))r.push(s.uiTypeId),r.push(...s.nonPresetUITypeIds);return ae.pick(n.uiTypes,r)}function eut(t,e){return ae.pick(e.codeInfoCols,ae.map(t,n=>n.codeInfoColId))}function tut(t,e){let n=[];for(const r of Object.values(t)){const{ids:i}=LAe(e.codeInfo,r.children);for(const s of i)n.push(e.codeInfo[s])}return n=ae.keyBy(ae.cloneDeep(n),r=>r.id),n}function nut(t){const e={};for(const i of Object.keys(t)){const s=Uf(i);s&&(e[i]={x:s.x,y:s.y,zIndex:0})}let n=1/0,r=1/0;for(const i of Object.values(e))i.x<n&&(n=i.x),i.y<r&&(r=i.y);return ae.mapValues(e,i=>({x:i.x-n,y:i.y-r,zIndex:i.zIndex}))}function wX(t,e,n){BO(t,e,n),ae.isNil(e.width)||rut(t,e.width,n)}function rut(t,e,n){const i=B5(t,s=>{const{parentId:o}=n.x[s];return o&&!n.x[o].isHorizontalOrientation?o:null});MA({sectionId:i,exclude:t,width:e,state:n})}function MA({sectionId:t,exclude:e,width:n,state:r}){const i=RRe(t,r);for(const s of i)s!==e&&BO(s,{width:n},r)}function Ade(t,e,n,r){const i=e/t;return t<n||e<r?(t<n&&(t=n,e=t*i),e<r&&(e=r,t=e/i),{height:Math.round(t),width:Math.round(e)}):{height:t,width:e}}function iut(t,e,n,r){if(t==="auto"&&e==="auto")return{height:n,width:r};const i=r/n;if(t==="auto")return{height:e/i,width:e};if(e==="auto"){const o=t*i;return{height:t,width:o}}const s=e/t;if(s>i){const o=t*i;return{height:t,width:o}}else return s<i?{height:e/i,width:e}:{height:t,width:e}}function BO(t,e,n){n.x[t].size={...n.x[t].size,...e}}function Rde({sectionIds:t,oldParentIds:e,newParentIds:n,positions:r,oldParentId:i,newParentId:s,state:o}){for(const[a,l]of t.entries())$de({oldParentId:e?e[l]:i,newParentId:n?n[l]:s,oldSectionId:l,newSectionId:l,newIndex:a,position:r?r[l]:null,state:o})}function $de({oldParentId:t,newParentId:e,oldSectionId:n,newSectionId:r,newIndex:i,position:s,state:o}){sut({oldParentId:t,newParentId:e,oldSectionId:n,newSectionId:r,newIndex:i,position:s,state:o}),out(e,r,o)}function sut({oldParentId:t,newParentId:e,oldSectionId:n,newSectionId:r,newIndex:i,position:s,state:o}){t?am(t,a=>a.filter(l=>l!==n),o):Une([n]),e?am(e,a=>Zee(a,i,r),o):eM([{id:r,position:s,zIndex:0,tempZIndex:0}]),o.x[r].parentId=e}function out(t,e,n){if(!t)return;if(n.uiTypes[n.x[t].uiTypeId].type===Y.GROUP){const{isHorizontalOrientation:i}=n.x[t];if(!i){const s=n.variants[n.x[t].variantId].children;if(s.length>0){const o=n.x[s[0]].size.width;MA({sectionId:e,width:o,state:n})}}}else{const i=n.x[t].size.width;MA({sectionId:e,width:i,state:n})}}async function aut({sectionId:t,oldParentId:e,newParentId:n}){if(!e||e===n)return t;const{variantIds:r}=Pi(e);if(r.length<=1)return t;const{variantId:i}=Pi(t),s=te.getState().variants;let o=!1;for(const a of r){if(a===i)continue;if(s[a].children.findIndex(u=>u===t)!==-1){o=!0;break}}if(o){const a=await Tde(Pde([t]));if(a.status===200)return a.data}return t}function Mde({nodeIds:t,x:e,y:n}){let r;te.setState(i=>{r=_M({type:Y.GROUP,position:{x:e,y:n},state:i}),Rde({oldParentId:null,newParentId:r,sectionIds:t,state:i}),i.shouldRenameReferences=!0}),Vd([r]),hn(!0)}async function lut(){const t=ir.getState().ids,e=[...mr.getState().x].filter(r=>t.includes(r[0]));if(e.length>0){const r=e.map(o=>o[1].id),i=Math.min(...e.map(o=>o[1].position.x)),s=Math.min(...e.map(o=>o[1].position.y));Mde({nodeIds:r,x:i,y:s}),qe.setState({nodesSelectionDims:null})}}function Ide(t,e){if(dn(t,e)!==Y.GROUP)return;const n=Yt(t,e).children,r={};n.forEach(i=>{const{x:s,y:o}=Uf(i);r[i]={x:s,y:o}}),Rde({oldParentId:t,newParentId:null,sectionIds:n,positions:r,state:e}),_m([t],e),e.shouldRenameReferences=!0}function cut(){te.setState(t=>{const e=ir.getState().ids;e.length===1&&Ide(e[0],t)}),hn(!0)}function uut(){const{isOpen:t,x:e,y:n,nodeIds:r}=xy(u=>u.selection,ae.isEqual),i=te(u=>r.map(f=>u.x[f].positionAndSizeLocked).every(f=>f)),s=()=>{Sm(),qe.setState({nodesSelectionDims:null})};function o(){Mde({nodeIds:r,...Vf({x:e,y:n})}),s()}function a(){te.setState(u=>{_m(r,u)}),s(),E_(),hn(!0)}function l(){te.setState(u=>{for(const f of r)u.x[f].positionAndSizeLocked=!i}),s()}const c=i?"Unlock Position & Size":"Lock Position & Size";return x.jsxs(XD,{x:e,y:n,isOpen:t,closeContextMenu:s,children:[x.jsx(Yr,{onClick:o,children:"Create Group"}),x.jsx(Yr,{onClick:a,children:"Delete"}),x.jsx(Yr,{onClick:l,children:c})]})}function fut(){const{isOpen:t,x:e,y:n,paramInfoId:r}=xy(a=>a.typeError,ae.isEqual),i=te(a=>{var l;return!!((l=a.codeInfo[r])!=null&&l.ignoreTypeErrors)});function s(){let a;te.setState(l=>{a=!i,l.codeInfo[r].ignoreTypeErrors=a}),a&&vp.setState(l=>{_Re(r,l)}),Sm()}const o=i?"Enable Type Errors":"Ignore Type Errors";return x.jsx(XD,{x:e,y:n,isOpen:t,closeContextMenu:Sm,children:x.jsx(Yr,{onClick:s,children:o})})}const hut=ke.forwardRef(({},t)=>{const{width:e,height:n}=cn(r=>({width:r.width,height:r.height}),ae.isEqual);return x.jsxs(x.Fragment,{children:[x.jsx("div",{style:{width:`${e}px`,height:`${n}px`},className:"flex items-center justify-center rounded-xl bg-setta-100/70 shadow-inner dark:bg-setta-500/60",ref:t,children:x.jsx(lHe,{className:"scale-150 text-xl font-black text-setta-50 dark:text-setta-400/70"})}),x.jsx("div",{className:"flex-auto bg-transparent"})]})}),dut=ke.forwardRef(({},t)=>{const e=qe(o=>o.transform[2]),{width:n,height:r}=cn(o=>({width:o.width,height:o.height}),ae.isEqual),i=n*e,s=r*e;return x.jsx("div",{style:{width:`${i}px`,height:`${s}px`},className:"rounded-xl bg-blue-500/90 shadow-lg dark:bg-blue-700/90",ref:t})}),put=ke.forwardRef((t,e)=>cn(r=>r.activeId)&&x.jsx(T8e,{dropAnimation:null,children:x.jsx(dut,{ref:e})}));function mut(){return n8e(Lz(i$),Lz(r$,{coordinateGetter:X8e}))}const sb={INVALID:"INVALID"},gut={INVALID:"Invalid"};function vut({active:t}){const{width:e,height:n}=vEe(t.id),r=cn.getState();r.setActive({id:t.id,isTopLevel:t.data.current.isTopLevel,width:e,height:n}),r.isMovingFree&&qf.getState().replaceWithTemp(t.id)}function Out(){return cn(e=>e.isMovingFree)?yut:()=>{}}function yut({active:t,collisions:e}){var i;const n=(i=e[0])==null?void 0:i.triggerDistCondition,r=cn.getState();if(n!==r.triggerDistCondition){cn.setState({triggerDistCondition:n});const s=e[0];s&&s.id===r.overId&&Dde({active:t,over:s,collisions:e,calledFromOnDragMove:!0})}}function but(){return cn(e=>e.isMovingFree)?Dde:()=>{}}function Dde({active:t,over:e,collisions:n,calledFromOnDragMove:r}){const i=HD(e),s=cn.getState(),o=qf.getState(),a=$y(t.id),l=IA(a);if(n.length===0){o.removeChild(a),R1(null);return}if(r&&s.triggerDistCondition){SX({active:t,over:e,dndChildrenState:o,oldParentId:l,dndSectionId:a,collisions:n});return}if(!r&&i&&xut(s,i)<100){R1(i);return}if(s.setTime(i),!i){o.removeChild(a),R1(i);return}if(s.triggerDistCondition){SX({active:t,over:e,dndChildrenState:o,oldParentId:l,dndSectionId:a,collisions:n});return}if(a===i){R1(i);return}const c=IA(i)??i;Lde({active:t,over:e,dndSectionId:a,oldParentId:l,newParentId:c,dndChildrenState:o,collisions:n})}function Lde({active:t,over:e,dndSectionId:n,oldParentId:r,newParentId:i,dndChildrenState:s,collisions:o}){const a=HD(e),l=wut(t.id,i);if(l===sb.INVALID){s.removeChild(n),cn.setState({behaviorDropType:l,overId:a});return}const c=Yt(i).children.length;if(c===1&&om(t.id)===i){s.addChild({oldParentId:r,newParentId:i,childId:n,index:0});return}if(a===i&&c>0){s.removeChild(n);return}if(i!==r){const f=s.x[i].indexOf(a);let h=f;f>=0?o[0].pastHalfway&&(h=f+1):h=0,s.addChild({oldParentId:r,newParentId:i,childId:n,index:h})}R1(a)}function SX({active:t,over:e,dndChildrenState:n,oldParentId:r,dndSectionId:i,collisions:s}){const o=HD(e);o!==i&&Lde({active:t,over:e,dndSectionId:i,oldParentId:r,newParentId:o,dndChildrenState:n,collisions:s})}function R1(t){cn.setState({behaviorDropType:null,overId:t})}function xut(t,e){return Date.now()-(t.times[e]??0)}function IA(t){return qf.getState().y[t]}function wut(t,e){return!Cut(e)||Sut(t)&&!_ut(e)||Yt(e).isFrozen||kut(t)?sb.INVALID:null}function HD(t){return t?t.id:null}function Sut(t){return![Y.SECTION,Y.LIST_ROOT,Y.DICT_ROOT].includes(dn(t))}function _ut(t){return dn(t)===Y.GROUP}function kut(t){return te.getState().singletonSections[Y.GLOBAL_VARIABLES]===t}function Cut(t){return Gse(dn(t))}function Eut(){return{droppable:{frequency:cn(n=>n.isMovingFree&&!!n.activeId)?200:t$.Optimized}}}const Tut=({transform:t})=>({...t,y:0}),Put=({transform:t})=>({...t,x:0});function Aut(t,e){var o,a;if(!t)return e;if(!e)return t;const n=(o=t.data.droppableContainer.data.current.sortable)==null?void 0:o.containerId,r=(a=e.data.droppableContainer.data.current.sortable)==null?void 0:a.containerId;if(n&&!r)return t;if(!n&&r)return e;const i=t.data.intersectionRatio,s=e.data.intersectionRatio;if(n&&r){const l=t.data.absTriggerDist,c=e.data.absTriggerDist,u=t.data.triggerDist,f=e.data.triggerDist;if(l-c===0)return s-i>0?e:t;if(u>0&&f>0)return l-c>0?e:t;if(l-c>0)return f<0?e:t;if(c-l>0)return u<0?t:e}return s-i>0?e:t}function Rut(t,e){const n=Math.max(e.top,t.top),r=Math.max(e.left,t.left),i=Math.min(e.left+e.width,t.left+t.width),s=Math.min(e.top+e.height,t.top+t.height),o=i-r,a=s-n;if(r<i&&n<s){const l=o*a;return Number(l.toFixed(4))}return 0}function $ut(t,e,n){return!(e!=null&&e.data.droppableContainer.data.current.isTopLevel)&&(!(e!=null&&e.data.droppableContainer.data.current.hasNested)||(e==null?void 0:e.data.droppableContainer.data.current.onlyChildId)===t)&&(e==null?void 0:e.data.triggerDist)>(n?20:100)*qe.getState().transform[2]}let Aw=null,H7=null;function Mut({active:t,collisionRect:e,droppableRects:n,droppableContainers:r}){var h,d,p,g;let i=null;const{left:s,top:o}=e;let a,l,c,u,f;for(const m of r)c=m.id,l=n.get(c),l&&t.id!==c&&(a=Rut(l,e),a&&(Aw===c&&(a*=1.1),f=(d=Pi((h=m.data.current.sortable)==null?void 0:h.containerId))==null?void 0:d.isHorizontalOrientation,u=f?o-l.top:s-l.left,i=Aut(i,{id:c,data:{droppableContainer:m,absTriggerDist:Math.abs(u),triggerDist:u,intersectionRatio:a}})));if(i){let m=0;Aw===i.id&&(H7===!0?m=10:H7===!1&&(m=-10));const v=(g=Pi((p=i.data.droppableContainer.data.current.sortable)==null?void 0:p.containerId))==null?void 0:g.isHorizontalOrientation;return v?i.pastHalfway=(e.left+e.right)/2+m>(n.get(i.id).left+n.get(i.id).right)/2:i.pastHalfway=(e.top+e.bottom)/2+m>(n.get(i.id).top+n.get(i.id).bottom)/2,i.triggerDistCondition=$ut(t.id,i,v),Aw=i.id,H7=i.pastHalfway,[i]}return Aw=null,[]}function Iut(t,e){return t?e?t.data.distance<e.data.distance?t:e:t:e}function _X(t,e){return e?[t.left,t.left+t.width]:[t.top,t.top+t.height]}const Dut=({active:t,collisionRect:e,droppableRects:n,droppableContainers:r})=>{var a;if(!t.data.current.sortable)return[];let i=null;const s=Pi(t.data.current.sortable.containerId).isHorizontalOrientation,o=_X(e,s);for(const l of r){const{id:c}=l,u=n.get(c);if(u&&t.data.current.sortable.containerId===((a=l.data.current.sortable)==null?void 0:a.containerId)){const f=_X(u,s),h=Math.abs(o[0]-f[0])+Math.abs(o[1]-f[1]);i=Iut(i,{id:c,data:{droppableContainer:l,distance:h}})}}return i?[i]:[]};function Lut(){const{isSorting:t,activeId:e}=cn(i=>({isSorting:i.isSorting,activeId:i.activeId}),ae.isEqual);return{modifiers:Nut(t,e),collisionDetection:t?Dut:Mut}}function Nut(t,e){if(t&&e){const n=om(e);if(n)return Pi(n).isHorizontalOrientation?[Tut]:[Put]}return null}function Qut({active:t,over:e}){e&&t.id!==e.id&&(te.setState(n=>{var r;am((r=t.data.current.sortable)==null?void 0:r.containerId,Z8e(t,e),n)}),hn(!0))}async function jut({active:t,over:e,collisions:n,dummyRef:r}){const i=qf.getState(),s=t.id,o=$y(s),a=e==null?void 0:e.id,l=om(s);let c=i.y[o]??null,u=null,f=null,h=null;const d=cn.getState().behaviorDropType;if(c){const m=i.x[c];u=m.indexOf(o);const v=m.indexOf(a),y=n[0].pastHalfway,b=m.length;f=s$(u,v,y,b)}else if(!a){f=0;const{x:m,y:v}=r.current.getBoundingClientRect();if(h=Vf({x:m,y:v}),!l){VRe(s,h);return}}if(d===sb.INVALID){m_();return}if(l===c&&Ll(l).children.indexOf(s)===f){m_();return}const p=await aut({sectionId:s,oldParentId:l,newParentId:c});let g;te.setState(m=>{p.sections?(Z$({...p,state:m}),g=Object.keys(p.sections)[0]):g=p,$de({oldParentId:l,newParentId:c,oldSectionId:s,newSectionId:g,newIndex:f,position:h,state:m}),m.shouldRenameReferences=!0})}function But(){const t=_.useRef(null);function e({active:n,over:r,collisions:i}){cn.getState().isSorting?Qut({active:n,over:r}):cn.getState().isMovingFree?jut({active:n,over:r,collisions:i,dummyRef:t}):m_();const s=o=>({isMovingFree:o.getState().isMovingFree,isSorting:o.getState().isSorting,disabled:o.getState().disabled});cn.getState().reset(s)}return{dummyRef:t,onDragEnd:e}}function zut({children:t}){const{dummyRef:e,onDragEnd:n}=But(),r=Out(),i=but(),{modifiers:s,collisionDetection:o}=Lut(),a=mut(),l=Eut();return x.jsxs(f8e,{sensors:a,collisionDetection:o,onDragStart:vut,onDragMove:r,onDragEnd:n,onDragOver:i,modifiers:s,measuring:l,autoScroll:!1,children:[t,x.jsx(put,{ref:e})]})}const Ah=({children:t,className:e,...n})=>x.jsx("button",{type:"button",className:qd(["react-flow__controls-button",e]),...n,children:t});Ah.displayName="ControlButton";function Fut(){return x.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:x.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function Wut(){return x.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:x.jsx("path",{d:"M0 0h32v4.2H0z"})})}function Vut(){return x.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:x.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function Uut(){const{minZoom:t,maxZoom:e}=Nt(n=>({minZoom:n.gui.minZoom,maxZoom:n.gui.maxZoom}),Ma);return qe(n=>({minZoomReached:n.transform[2]<=t,maxZoomReached:n.transform[2]>=e}),Ma)}const Nde=({position:t="bottom-left"})=>{const[e,n]=_.useState(!1),{minZoomReached:r,maxZoomReached:i}=Uut();qe(h=>h.nodesDraggable||h.elementsSelectable,Ma);const s=qe(h=>h.fitViewOnInit),[o]=Ot.snapToGrid.hook(),[a]=Ot.overviewTrueWidth.hook(),[l]=Ot.showMinimap.hook(),c="!bg-blue-500 dark:!bg-blue-700 !text-white";if(_.useEffect(()=>{n(!0)},[]),!e)return null;const u=()=>{mee()},f=()=>{gee()};return x.jsxs(ooe,{className:"react-flow__controls overflow-hidden rounded-md border border-solid border-setta-800/10 shadow-lg transition-transform dark:border-setta-300/30",position:t,style:{transform:`translateX(${a}px)`},"data-testid":"rf__controls",children:[x.jsx(Ah,{onClick:u,className:"react-flow__controls-zoomin bg-setta-50 hover:bg-setta-200 dark:border-setta-800 dark:bg-setta-700 dark:text-setta-300 dark:hover:bg-setta-800 dark:[&_svg]:fill-setta-300",title:"zoom in","aria-label":"zoom in",disabled:i,children:x.jsx(Vut,{})}),x.jsx(Ah,{onClick:f,className:"react-flow__controls-zoomout bg-setta-50 hover:bg-setta-200 dark:border-setta-800 dark:bg-setta-700 dark:text-setta-300 dark:hover:bg-setta-800 dark:[&_svg]:fill-setta-300",title:"zoom out","aria-label":"zoom out",disabled:r,children:x.jsx(Wut,{})}),x.jsx(Ah,{className:`react-flow__controls-fitview hover:bg-setta-200 dark:border-setta-800 dark:text-setta-300 dark:hover:bg-setta-800 dark:[&_svg]:fill-setta-300 ${s?c:"bg-setta-50 dark:bg-setta-700"}`,onClick:Vne,title:"fit view","aria-label":"fit view",children:x.jsx(Fut,{})}),x.jsx(Ah,{onClick:q$e,className:`hover:bg-setta-200 dark:border-setta-800 dark:text-setta-300 dark:hover:bg-setta-800 dark:[&_svg]:fill-setta-300 ${o?c:"bg-setta-50 dark:bg-setta-700"}`,children:x.jsx(uHe,{})}),x.jsx(Ah,{className:"react-flow__controls-button dark: bg-setta-50 hover:bg-setta-200 dark:border-setta-800 dark:bg-setta-700 dark:text-setta-300 dark:hover:bg-setta-800",onClick:vee,children:x.jsx(pHe,{})}),x.jsx(Ah,{onClick:V$e,className:`hover:bg-setta-200 dark:border-setta-800 dark:text-setta-300 dark:hover:bg-setta-800 dark:[&_svg]:fill-setta-300 ${l?c:"bg-setta-50 dark:bg-setta-700"}`,children:x.jsx(UFe,{})})]})};Nde.displayName="Controls";const qut=_.memo(Nde);function Xut({color:t,dimensions:e,lineWidth:n}){return x.jsx("path",{stroke:t,strokeWidth:n,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})}function Hut({color:t,radius:e}){return x.jsx("circle",{cx:e,cy:e,r:e,fill:t})}var i2=(t=>(t.Lines="lines",t.Dots="dots",t.Cross="cross",t))(i2||{});function Qde(){const[e]=Ot.darkMode.hook(),n=Nt(c=>e?c.gui.gridColorDarkMode:c.gui.gridColor),r=Nt(c=>c.gui.gridPatternSize),i=Nt(c=>c.gui.snapGrid),s=Nt(c=>i2[c.gui.gridPattern]),o=_.useRef(null),a=s===i2.Dots,l=s===i2.Cross;return x.jsxs("svg",{className:"react-flow__background",style:{position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:o,"data-testid":"rf__background",children:[x.jsx(Yut,{offset:2,gapXY:i,patternColor:n,patternSize:r,isCross:l,isDots:a}),x.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:"url(#ReactFlowBackground)"})]})}Qde.displayName="Background";const Zut=_.memo(Qde),Yut=_.memo(({offset:t,gapXY:e,patternColor:n,patternSize:r,isCross:i,isDots:s})=>{const o=qe(f=>f.transform,Ma),a=[e[0]*o[2]||1,e[1]*o[2]||1],l=r*o[2],c=i?[l,l]:a,u=s?[l/t,l/t]:[c[0]/t,c[1]/t];return x.jsx("pattern",{id:"ReactFlowBackground",x:o[0]%a[0],y:o[1]%a[1],width:a[0],height:a[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${u[0]},-${u[1]})`,children:s?x.jsx(Hut,{color:n,radius:l/t}):x.jsx(Xut,{dimensions:c,color:n,lineWidth:r*o[2]})})});function Gut(){return _.useCallback(({sourceEvent:e})=>{const{transform:n}=qe.getState(),r=e.touches?e.touches[0].clientX:e.clientX,i=e.touches?e.touches[0].clientY:e.clientY,s={x:(r-n[0])/n[2],y:(i-n[1])/n[2]};return{xSnapped:s.x,ySnapped:s.y,...s}},[])}function Kut(t,e,n){let r=t;do{if(r!=null&&r.matches(e))return!0;if(r===n.current)return!1;r=r.parentElement}while(r);return!1}function Jut(t,e,n,r){const{ids:i}=ir.getState(),s=i.includes(r);return Array.from(t.values()).filter(o=>(!r&&i.includes(o.id)||s&&i.includes(o.id)||!s&&o.id===r)&&(o.draggable||e&&typeof o.draggable>"u")).map(o=>{var a,l;return{id:o.id,position:o.position||{x:0,y:0},distance:{x:n.x-(((a=o.position)==null?void 0:a.x)??0),y:n.y-(((l=o.position)==null?void 0:l.y)??0)},delta:{x:0,y:0},width:o.width,height:o.height}})}function jde({nodeRef:t,disabled:e=!1,nodeId:n,isSelectable:r}){const[i,s]=_.useState(!1),o=_.useRef([]),a=_.useRef({x:null,y:null}),l=_.useRef(0),c=_.useRef(null),u=_.useRef({x:0,y:0}),f=_.useRef(null),h=_.useRef(!1),d=_.useRef(!1),p=Gut();return _.useEffect(()=>{if(t!=null&&t.current){const g=Mo(t.current),m=({x:b,y:S},k=!1)=>{const{nodesSelectionDims:E,shiftNodesSelection:T,setNodesSelection:C}=qe.getState(),{snapGrid:A}=Nt.getState().gui,[R]=Ot.snapToGrid.state(),Q={x:b-a.current.x,y:S-a.current.y};a.current={x:b,y:S};let L=!1;o.current=o.current.map(z=>{const B={x:b-z.distance.x,y:S-z.distance.y};return k&&R&&(B.x=A[0]*Math.round(B.x/A[0]),B.y=A[1]*Math.round(B.y/A[1])),L=L||z.position.x!==B.x||z.position.y!==B.y,z.position=B,z}),L&&(Xne(o.current),!n&&E&&(k&&R?C(o.current.length):T(Q)),s(!0))},v=()=>{if(!c.current)return;const[b,S]=cEe(u.current,c.current);if(b!==0||S!==0){const{transform:k,panBy:E}=qe.getState(),T=(a.current.x??0)-b/k[2],C=(a.current.y??0)-S/k[2];E({x:b,y:S})&&m({x:T,y:C})}l.current=requestAnimationFrame(v)},y=b=>{const{multiSelectionActive:S,nodesDraggable:k}=qe.getState(),E=mr.getState().x;d.current=!0,!r&&!S&&n&&ir.getState().ids.includes(n);const T=p(b);a.current=T,o.current=Jut(E,k,T,n),o.current&&(WRe(o.current),Ut.setState({mouseDownDraggingSection:!0}))};if(e)g.on(".drag",null);else{const b=t6e().on("start",S=>{const{domNode:k,nodeDragThreshold:E}=qe.getState();E===0&&y(S);const T=p(S);a.current=T,c.current=(k==null?void 0:k.getBoundingClientRect())||null,u.current=i_(S.sourceEvent,c.current)}).on("drag",S=>{var C,A;const k=p(S),{autoPanOnNodeDrag:E,nodeDragThreshold:T}=qe.getState();if(!h.current&&d.current&&E&&(h.current=!0,v()),!d.current){const R=k.xSnapped-(((C=a==null?void 0:a.current)==null?void 0:C.x)??0),Q=k.ySnapped-(((A=a==null?void 0:a.current)==null?void 0:A.y)??0);Math.sqrt(R*R+Q*Q)>T&&y(S)}(a.current.x!==k.xSnapped||a.current.y!==k.ySnapped)&&o.current&&d.current&&(f.current=S.sourceEvent,u.current=i_(S.sourceEvent,c.current),m(k))}).on("end",S=>{Ut.setState({mouseDownDraggingSection:!1}),d.current&&(Ot.snapToGrid.state()[0]&&m(a.current,!0),s(!1),h.current=!1,d.current=!1,cancelAnimationFrame(l.current),o.current&&o3(o.current.map(k=>k.id),!0))}).filter(S=>{const k=S.target;return!S.button&&!Kut(k,`.${eEe}`,t)});return g.call(b),()=>{g.on(".drag",null)}}}},[t,e,r,n,p]),i}const Bde=t=>{const{nodesSelectionDims:e,nodesDraggable:n,shiftNodesSelection:r}=qe.getState(),{snapGrid:i}=Nt.getState().gui,[s]=Ot.snapToGrid.state(),o=ir.getState().ids,a=Hm().filter(p=>o.includes(p.id)&&(p.draggable||n&&typeof p.draggable>"u")),l=s?i[0]:5,c=s?i[1]:5,u=t.isShiftPressed?4:1,f=t.x*l*u,h=t.y*c*u,d=a.map(p=>{if(p.position){const g={x:p.position.x+f,y:p.position.y+h};s&&(g.x=i[0]*Math.round(g.x/i[0]),g.y=i[1]*Math.round(g.y/i[1])),p.position=g}return p});Xne(d),e&&r({x:f,y:h})};var zde={},Fde={},ZD={exports:{}},Vn=String,Wde=function(){return{isColorSupported:!1,reset:Vn,bold:Vn,dim:Vn,italic:Vn,underline:Vn,inverse:Vn,hidden:Vn,strikethrough:Vn,black:Vn,red:Vn,green:Vn,yellow:Vn,blue:Vn,magenta:Vn,cyan:Vn,white:Vn,gray:Vn,bgBlack:Vn,bgRed:Vn,bgGreen:Vn,bgYellow:Vn,bgBlue:Vn,bgMagenta:Vn,bgCyan:Vn,bgWhite:Vn}};ZD.exports=Wde();ZD.exports.createColors=Wde;var eft=ZD.exports;(function(t){Object.defineProperty(t,"__esModule",{value:!0});function e(l,c){for(var u in c)Object.defineProperty(l,u,{enumerable:!0,get:c[u]})}e(t,{dim:function(){return o},default:function(){return a}});const n=r(eft);function r(l){return l&&l.__esModule?l:{default:l}}let i=new Set;function s(l,c,u){typeof process<"u"&&{}.JEST_WORKER_ID||u&&i.has(u)||(u&&i.add(u),console.warn(""),c.forEach(f=>console.warn(l,"-",f)))}function o(l){return n.default.dim(l)}const a={info(l,c){s(n.default.bold(n.default.cyan("info")),...Array.isArray(l)?[l]:[c,l])},warn(l,c){s(n.default.bold(n.default.yellow("warn")),...Array.isArray(l)?[l]:[c,l])},risk(l,c){s(n.default.bold(n.default.magenta("risk")),...Array.isArray(l)?[l]:[c,l])}}})(Fde);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return i}});const e=n(Fde);function n(s){return s&&s.__esModule?s:{default:s}}function r({version:s,from:o,to:a}){e.default.warn(`${o}-color-renamed`,[`As of Tailwind CSS ${s}, \`${o}\` has been renamed to \`${a}\`.`,"Update your configuration file to silence this warning."])}const i={inherit:"inherit",current:"currentColor",transparent:"transparent",black:"#000",white:"#fff",slate:{50:"#f8fafc",100:"#f1f5f9",200:"#e2e8f0",300:"#cbd5e1",400:"#94a3b8",500:"#64748b",600:"#475569",700:"#334155",800:"#1e293b",900:"#0f172a",950:"#020617"},gray:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#6b7280",600:"#4b5563",700:"#374151",800:"#1f2937",900:"#111827",950:"#030712"},zinc:{50:"#fafafa",100:"#f4f4f5",200:"#e4e4e7",300:"#d4d4d8",400:"#a1a1aa",500:"#71717a",600:"#52525b",700:"#3f3f46",800:"#27272a",900:"#18181b",950:"#09090b"},neutral:{50:"#fafafa",100:"#f5f5f5",200:"#e5e5e5",300:"#d4d4d4",400:"#a3a3a3",500:"#737373",600:"#525252",700:"#404040",800:"#262626",900:"#171717",950:"#0a0a0a"},stone:{50:"#fafaf9",100:"#f5f5f4",200:"#e7e5e4",300:"#d6d3d1",400:"#a8a29e",500:"#78716c",600:"#57534e",700:"#44403c",800:"#292524",900:"#1c1917",950:"#0c0a09"},red:{50:"#fef2f2",100:"#fee2e2",200:"#fecaca",300:"#fca5a5",400:"#f87171",500:"#ef4444",600:"#dc2626",700:"#b91c1c",800:"#991b1b",900:"#7f1d1d",950:"#450a0a"},orange:{50:"#fff7ed",100:"#ffedd5",200:"#fed7aa",300:"#fdba74",400:"#fb923c",500:"#f97316",600:"#ea580c",700:"#c2410c",800:"#9a3412",900:"#7c2d12",950:"#431407"},amber:{50:"#fffbeb",100:"#fef3c7",200:"#fde68a",300:"#fcd34d",400:"#fbbf24",500:"#f59e0b",600:"#d97706",700:"#b45309",800:"#92400e",900:"#78350f",950:"#451a03"},yellow:{50:"#fefce8",100:"#fef9c3",200:"#fef08a",300:"#fde047",400:"#facc15",500:"#eab308",600:"#ca8a04",700:"#a16207",800:"#854d0e",900:"#713f12",950:"#422006"},lime:{50:"#f7fee7",100:"#ecfccb",200:"#d9f99d",300:"#bef264",400:"#a3e635",500:"#84cc16",600:"#65a30d",700:"#4d7c0f",800:"#3f6212",900:"#365314",950:"#1a2e05"},green:{50:"#f0fdf4",100:"#dcfce7",200:"#bbf7d0",300:"#86efac",400:"#4ade80",500:"#22c55e",600:"#16a34a",700:"#15803d",800:"#166534",900:"#14532d",950:"#052e16"},emerald:{50:"#ecfdf5",100:"#d1fae5",200:"#a7f3d0",300:"#6ee7b7",400:"#34d399",500:"#10b981",600:"#059669",700:"#047857",800:"#065f46",900:"#064e3b",950:"#022c22"},teal:{50:"#f0fdfa",100:"#ccfbf1",200:"#99f6e4",300:"#5eead4",400:"#2dd4bf",500:"#14b8a6",600:"#0d9488",700:"#0f766e",800:"#115e59",900:"#134e4a",950:"#042f2e"},cyan:{50:"#ecfeff",100:"#cffafe",200:"#a5f3fc",300:"#67e8f9",400:"#22d3ee",500:"#06b6d4",600:"#0891b2",700:"#0e7490",800:"#155e75",900:"#164e63",950:"#083344"},sky:{50:"#f0f9ff",100:"#e0f2fe",200:"#bae6fd",300:"#7dd3fc",400:"#38bdf8",500:"#0ea5e9",600:"#0284c7",700:"#0369a1",800:"#075985",900:"#0c4a6e",950:"#082f49"},blue:{50:"#eff6ff",100:"#dbeafe",200:"#bfdbfe",300:"#93c5fd",400:"#60a5fa",500:"#3b82f6",600:"#2563eb",700:"#1d4ed8",800:"#1e40af",900:"#1e3a8a",950:"#172554"},indigo:{50:"#eef2ff",100:"#e0e7ff",200:"#c7d2fe",300:"#a5b4fc",400:"#818cf8",500:"#6366f1",600:"#4f46e5",700:"#4338ca",800:"#3730a3",900:"#312e81",950:"#1e1b4b"},violet:{50:"#f5f3ff",100:"#ede9fe",200:"#ddd6fe",300:"#c4b5fd",400:"#a78bfa",500:"#8b5cf6",600:"#7c3aed",700:"#6d28d9",800:"#5b21b6",900:"#4c1d95",950:"#2e1065"},purple:{50:"#faf5ff",100:"#f3e8ff",200:"#e9d5ff",300:"#d8b4fe",400:"#c084fc",500:"#a855f7",600:"#9333ea",700:"#7e22ce",800:"#6b21a8",900:"#581c87",950:"#3b0764"},fuchsia:{50:"#fdf4ff",100:"#fae8ff",200:"#f5d0fe",300:"#f0abfc",400:"#e879f9",500:"#d946ef",600:"#c026d3",700:"#a21caf",800:"#86198f",900:"#701a75",950:"#4a044e"},pink:{50:"#fdf2f8",100:"#fce7f3",200:"#fbcfe8",300:"#f9a8d4",400:"#f472b6",500:"#ec4899",600:"#db2777",700:"#be185d",800:"#9d174d",900:"#831843",950:"#500724"},rose:{50:"#fff1f2",100:"#ffe4e6",200:"#fecdd3",300:"#fda4af",400:"#fb7185",500:"#f43f5e",600:"#e11d48",700:"#be123c",800:"#9f1239",900:"#881337",950:"#4c0519"},get lightBlue(){return r({version:"v2.2",from:"lightBlue",to:"sky"}),this.sky},get warmGray(){return r({version:"v3.0",from:"warmGray",to:"stone"}),this.stone},get trueGray(){return r({version:"v3.0",from:"trueGray",to:"neutral"}),this.neutral},get coolGray(){return r({version:"v3.0",from:"coolGray",to:"gray"}),this.gray},get blueGray(){return r({version:"v3.0",from:"blueGray",to:"slate"}),this.slate}}})(zde);let Z7=zde;var tft=(Z7.__esModule?Z7:{default:Z7}).default;const nft=ra(tft);function rft({sectionId:t,isGroup:e}){const n=e?"":"0.75rem",r=e?"":"-0.75rem";return cn(i=>{const s=i.overId===t?i.behaviorDropType:null;return{behaviorDropType:s,style:s===sb.INVALID?{borderRadius:"1.5rem",padding:n,margin:r,backgroundColor:nft.red[600]}:{}}},ae.isEqual)}function ift(t){const{isSorting:e,isMovingFree:n}=zne(),r=cn(c=>c.disabled[t]),i=cn(c=>c.setDisabled),s=C5(t);_.useEffect(()=>{i(t,{draggable:s,droppable:!0})},[s]);function o(c){let u=om(t);for(;u;){if(c===u)return!0;u=om(u)}return!1}function a({active:c}){var u;s||(n&&c.id!==t&&!o(c.id)?i(t,{draggable:!1,droppable:!1}):e&&((u=c.data.current.sortable)==null?void 0:u.containerId)===t&&i(t,{draggable:!1,droppable:!1}))}function l(){i(t,{draggable:s,droppable:!0})}return jJ({onDragStart:a,onDragEnd:l,onDragCancel:l}),r??{draggable:s,droppable:!0}}function Vde({sectionId:t,isTopLevel:e}){const{hasNested:n,disabled:r,onlyChildId:i}=te(s=>{var l,c,u;const o=(l=s.x[t])==null?void 0:l.variantId,a=o?s.variants[o].children:[];return{hasNested:a.length>0,onlyChildId:a.length===1?a[0]:null,disabled:(c=s.x[t])!=null&&c.positionAndSizeLocked?(u=s.x[t])==null?void 0:u.positionAndSizeLocked:null}},ae.isEqual);return{id:t,data:{isTopLevel:e,hasNested:n,onlyChildId:i},disabled:r}}function Ude(){const t=cn(n=>n.isSorting||n.isMovingFree),e=qe(n=>n.moveSectionActivationKeyPressed||n.selectionKeyPressed||n.multiSelectionActive||n.zoomActivationKeyPressed);return t||e}function sft({sectionId:t,withNested:e,selfOnly:n}){ka.setState(r=>{e?r.withNested[t]=e:r.selfOnly[t]=n})}function oft({sectionId:t}){ka.setState(e=>{delete e.withNested[t],delete e.selfOnly[t]})}function qde(t,e){const n=_.useRef(null);return _.useEffect(()=>(sft({sectionId:t,[e]:n.current}),()=>oft({sectionId:t})),[]),n}function aft({sectionId:t}){const e=te(r=>r.x[t].isHorizontalOrientation);function n(){$Re(t)}return x.jsx(Fa,{icon:e?x.jsx(oHe,{}):x.jsx(sHe,{}),color:"text-setta-400 dark:text-setta-600 hover:text-setta-500 dark:hover:text-setta-400",bg:"bg-transparent justify-content-center mr-1",size:"w-4 h-4",padding:"p-0",onClick:n})}function Xde({sectionId:t}){const{isGroup:e,positionAndSizeLocked:n}=te(o=>({isGroup:dn(t,o)===Y.GROUP,positionAndSizeLocked:o.x[t].positionAndSizeLocked}),ae.isEqual),r=n?"gg-lock":"gg-lock-unlock",i=e?n?"[&>i]:!-mt-[6px]":"[&>i]:!scale-50 [&>i]:!-mt-[9px]":"[&>i]:!scale-[.4]";function s(){MRe(t)}return x.jsx(Fa,{icon:x.jsx("i",{className:r}),color:`${n?"dark:text-orange-500 text-orange-600 hover:!text-orange-100 dark:hover:!text-orange-100":e?"text-setta-400 dark:text-setta-600":"text-setta-600"} hover:text-orange-500 dark:hover:text-orange-700`,bg:`${n?"shadow-[inset_0_1px_1px_0_rgb(0_0_0_/_0.1)] dark:shadow-none dark:border-transparent dark:bg-transparent hover:bg-orange-500 dark:hover:bg-orange-500":"bg-transparent"} ${i}`,size:e?"w-5 h-5":"w-4 h-4",padding:"p-0 mr-1",onClick:s})}function lft(t){return ft({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M12 18a6 6 0 1 0 0-12 6 6 0 0 0 0 12Z"},child:[]}]})(t)}function cft(t){return ft({tag:"svg",attr:{role:"img",viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M21.038,4.9l-7.577-4.498C13.009,0.134,12.505,0,12,0c-0.505,0-1.009,0.134-1.462,0.403L2.961,4.9 C2.057,5.437,1.5,6.429,1.5,7.503v8.995c0,1.073,0.557,2.066,1.462,2.603l7.577,4.497C10.991,23.866,11.495,24,12,24 c0.505,0,1.009-0.134,1.461-0.402l7.577-4.497c0.904-0.537,1.462-1.529,1.462-2.603V7.503C22.5,6.429,21.943,5.437,21.038,4.9z M15.17,18.946l0.013,0.646c0.001,0.078-0.05,0.167-0.111,0.198l-0.383,0.22c-0.061,0.031-0.111-0.007-0.112-0.085L14.57,19.29 c-0.328,0.136-0.66,0.169-0.872,0.084c-0.04-0.016-0.057-0.075-0.041-0.142l0.139-0.584c0.011-0.046,0.036-0.092,0.069-0.121 c0.012-0.011,0.024-0.02,0.036-0.026c0.022-0.011,0.043-0.014,0.062-0.006c0.229,0.077,0.521,0.041,0.802-0.101 c0.357-0.181,0.596-0.545,0.592-0.907c-0.003-0.328-0.181-0.465-0.613-0.468c-0.55,0.001-1.064-0.107-1.072-0.917 c-0.007-0.667,0.34-1.361,0.889-1.8l-0.007-0.652c-0.001-0.08,0.048-0.168,0.111-0.2l0.37-0.236 c0.061-0.031,0.111,0.007,0.112,0.087l0.006,0.653c0.273-0.109,0.511-0.138,0.726-0.088c0.047,0.012,0.067,0.076,0.048,0.151 l-0.144,0.578c-0.011,0.044-0.036,0.088-0.065,0.116c-0.012,0.012-0.025,0.021-0.038,0.028c-0.019,0.01-0.038,0.013-0.057,0.009 c-0.098-0.022-0.332-0.073-0.699,0.113c-0.385,0.195-0.52,0.53-0.517,0.778c0.003,0.297,0.155,0.387,0.681,0.396 c0.7,0.012,1.003,0.318,1.01,1.023C16.105,17.747,15.736,18.491,15.17,18.946z M19.143,17.859c0,0.06-0.008,0.116-0.058,0.145 l-1.916,1.164c-0.05,0.029-0.09,0.004-0.09-0.056v-0.494c0-0.06,0.037-0.093,0.087-0.122l1.887-1.129 c0.05-0.029,0.09-0.004,0.09,0.056V17.859z M20.459,6.797l-7.168,4.427c-0.894,0.523-1.553,1.109-1.553,2.187v8.833 c0,0.645,0.26,1.063,0.66,1.184c-0.131,0.023-0.264,0.039-0.398,0.039c-0.42,0-0.833-0.114-1.197-0.33L3.226,18.64 c-0.741-0.44-1.201-1.261-1.201-2.142V7.503c0-0.881,0.46-1.702,1.201-2.142l7.577-4.498c0.363-0.216,0.777-0.33,1.197-0.33 c0.419,0,0.833,0.114,1.197,0.33l7.577,4.498c0.624,0.371,1.046,1.013,1.164,1.732C21.686,6.557,21.12,6.411,20.459,6.797z"},child:[]}]})(t)}function uft(t){return ft({tag:"svg",attr:{role:"img",viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M14.25.18l.9.2.73.26.59.3.45.32.34.34.25.34.16.33.1.3.04.26.02.2-.01.13V8.5l-.05.63-.13.55-.21.46-.26.38-.3.31-.33.25-.35.19-.35.14-.33.1-.3.07-.26.04-.21.02H8.77l-.69.05-.59.14-.5.22-.41.27-.33.32-.27.35-.2.36-.15.37-.1.35-.07.32-.04.27-.02.21v3.06H3.17l-.21-.03-.28-.07-.32-.12-.35-.18-.36-.26-.36-.36-.35-.46-.32-.59-.28-.73-.21-.88-.14-1.05-.05-1.23.06-1.22.16-1.04.24-.87.32-.71.36-.57.4-.44.42-.33.42-.24.4-.16.36-.1.32-.05.24-.01h.16l.06.01h8.16v-.83H6.18l-.01-2.75-.02-.37.05-.34.11-.31.17-.28.25-.26.31-.23.38-.2.44-.18.51-.15.58-.12.64-.1.71-.06.77-.04.84-.02 1.27.05zm-6.3 1.98l-.23.33-.08.41.08.41.23.34.33.22.41.09.41-.09.33-.22.23-.34.08-.41-.08-.41-.23-.33-.33-.22-.41-.09-.41.09zm13.09 3.95l.28.06.32.12.35.18.36.27.36.35.35.47.32.59.28.73.21.88.14 1.04.05 1.23-.06 1.23-.16 1.04-.24.86-.32.71-.36.57-.4.45-.42.33-.42.24-.4.16-.36.09-.32.05-.24.02-.16-.01h-8.22v.82h5.84l.01 2.76.02.36-.05.34-.11.31-.17.29-.25.25-.31.24-.38.2-.44.17-.51.15-.58.13-.64.09-.71.07-.77.04-.84.01-1.27-.04-1.07-.14-.9-.2-.73-.25-.59-.3-.45-.33-.34-.34-.25-.34-.16-.33-.1-.3-.04-.25-.02-.2.01-.13v-5.34l.05-.64.13-.54.21-.46.26-.38.3-.32.33-.24.35-.2.35-.14.33-.1.3-.06.26-.04.21-.02.13-.01h5.84l.69-.05.59-.14.5-.21.41-.28.33-.32.27-.35.2-.36.15-.36.1-.35.07-.32.04-.28.02-.21V6.07h2.09l.14.01zm-6.47 14.25l-.23.33-.08.41.08.41.23.33.33.23.41.08.41-.08.33-.23.23-.33.08-.41-.08-.41-.23-.33-.33-.23-.41-.08-.41.08z"},child:[]}]})(t)}function fft(t,e){return dn(t)===Y.SOCIAL&&GD(e.x[t].social)}function hft(t,e){return dn(t)===Y.SOCIAL&&YD(e.x[t].social)}function YD(t){return t&&(t.includes("youtube")||t.includes("youtu.be"))}function GD(t){return t&&(t.includes("twitter")||t.includes("x.com"))}function kX({sectionId:t,sectionTypeName:e,isInOtherProjectConfigs:n,isListElement:r}){if(r)return x.jsx(gft,{sectionId:t});if(n)return x.jsx(dft,{sectionId:t});switch(e){case Y.CODE:return x.jsx(mft,{sectionId:t,classes:"text-setta-300 group-hover/card-section:text-blue-500 dark:group-hover/card-section:text-[#0084ff] dark:text-setta-500 transition-colors"});case Y.TERMINAL:return x.jsx(Oft,{sectionId:t});case Y.GLOBAL_PARAM_SWEEP:case Y.GLOBAL_VARIABLES:return x.jsx(B$e,{className:"text-setta-300 transition-colors group-hover/card-section:text-green-500 dark:text-setta-500 "});case Y.PARAM_SWEEP:return x.jsx(aHe,{className:"text-setta-300 transition-colors group-hover/card-section:text-blue-500 dark:text-setta-500 dark:group-hover/card-section:text-[#0084ff] "});case Y.INFO:return x.jsx(vft,{sectionId:t});case Y.IMAGE:return x.jsx("div",{className:"relative",children:x.jsx("i",{className:"gg-image absolute inset-0 !scale-50 text-setta-300 transition-colors group-hover/card-section:text-blue-500 dark:text-setta-500 dark:group-hover/card-section:text-[#0084ff]"})});case Y.DRAW:return x.jsx(tI,{className:"p-0 text-setta-300 transition-colors group-hover/card-section:text-blue-500 dark:text-setta-500 dark:group-hover/card-section:text-[#0084ff] "});case Y.IFRAME:return x.jsx("div",{className:"relative flex w-2 justify-center",children:x.jsx("i",{className:"gg-code-slash !rotate-[14deg] !scale-50 text-setta-300 transition-colors group-hover/card-section:text-blue-500 dark:text-setta-500 dark:group-hover/card-section:text-[#0084ff]"})});case Y.SOCIAL:return x.jsx(pft,{sectionId:t});case Y.GROUP:return x.jsx(lit,{className:`[&_*]:!scale-120 text-setta-400 transition-colors group-hover/group-section:text-blue-600 dark:text-setta-500 dark:group-hover/group-section:text-[#0084ff]
355
355
  `});case Y.CHART:return x.jsx(ait,{className:`text-setta-300 transition-colors group-hover/card-section:text-blue-500 dark:text-setta-500 dark:group-hover/card-section:text-[#0084ff]
356
- `});default:return x.jsx("i",{className:"gg-menu group/card-section:hover:bg !scale-110 text-setta-300 transition-colors group-hover/card-section:text-blue-500 dark:text-setta-500 dark:group-hover/card-section:text-[#0084ff] "})}}function dft({sectionId:t}){const e=te(n=>dn(t,n)===Y.GROUP);return x.jsx("i",{className:`gg-link group/card-section:hover:bg transition-colors group-hover/card-section:text-pink-500 dark:group-hover/card-section:text-[#ff00ff] ${e?"-rotate-45 !scale-75 text-purple-600 dark:text-purple-700":"text-purple-500 dark:text-purple-500"}`})}function pft({sectionId:t}){const{isYouTube:e,isTwitter:n}=te(r=>({isYouTube:YD(r.x[t].social),isTwitter:GD(r.x[t].social)}),ae.isEqual);return e?x.jsx(vlt,{className:"fill-setta-300 transition-colors group-hover/card-section:fill-blue-500 dark:fill-setta-500 dark:group-hover/card-section:fill-[#0084ff] "}):n?x.jsx(oit,{className:"fill-setta-300 transition-colors group-hover/card-section:fill-blue-500 dark:fill-setta-500 dark:group-hover/card-section:fill-[#0084ff] "}):x.jsx(lft,{className:"text-setta-300 transition-colors group-hover/card-section:text-blue-500 dark:text-setta-500 dark:group-hover/card-section:text-[#0084ff] "})}function mft({sectionId:t,classes:e}){switch(te(r=>r.x[t].codeLanguage)){case"python":return x.jsx(uft,{className:e});case"javascript":return x.jsx(FFe,{className:e});case"bash":return x.jsx(cft,{className:e});default:return null}}function gft({sectionId:t}){const e=BAe(t);return x.jsxs("p",{className:"group/card-section:hover:bg font-mono text-[9px] tracking-tighter text-setta-300 transition-colors group-hover/card-section:text-blue-500 dark:text-setta-500 dark:group-hover/card-section:text-[#0084ff] ",children:["[",e,"]"]})}function vft({sectionId:t}){return te(n=>n.x[t].renderMarkdown)?x.jsx(glt,{className:"text-transparent transition-colors group-hover/card-section:text-blue-500 dark:text-setta-500 dark:text-transparent dark:group-hover/card-section:text-[#0084ff]"}):x.jsx(iHe,{className:"text-transparent transition-colors group-hover/card-section:text-blue-500 dark:text-setta-500 dark:text-transparent dark:group-hover/card-section:text-[#0084ff]"})}function Oft({sectionId:t}){return te(n=>n.x[t].isReadOnlyTerminal)?x.jsx(jct,{className:"text-setta-300 transition-colors group-hover/card-section:text-blue-500 dark:text-setta-500 dark:group-hover/card-section:text-[#0084ff] ",...Rr({title:"Read-only terminal"})}):x.jsx(ylt,{className:"text-setta-300 transition-colors group-hover/card-section:text-blue-500 dark:text-setta-500 dark:group-hover/card-section:text-[#0084ff] ",...Rr({title:"Read/write terminal"})})}function yft({sectionId:t}){async function e(){YPe(t)}return x.jsx(mn,{onClick:e,children:"Add artifact by filepath"})}function bft({sectionId:t}){function e(n){const r=te.getState().singletonSections.inMemoryFnStdoutTerminal;r?rg(r):te.setState(i=>{_ie(t,{isReadOnlyTerminal:!0,uiTypeId:Nm.TERMINAL},i)})}return x.jsx(mn,{onClick:e,children:"Add Stdout Terminal"})}function CX({sectionId:t}){function e(){const{variantId:n}=Pi(t);te.setState(r=>{for(const i of Object.keys(r.variants[n].values))r.variants[n].values[i]=Wm()}),hn(!0),Nd(t,n)}return x.jsx(mn,{onClick:e,children:"Clear Values"})}function n1({sectionId:t}){async function e(){dde(t)}return x.jsx(mn,{onClick:e,children:"New Version"})}function xft({sectionId:t}){const{hasParams:e,hideSearch:n,hideParams:r}=te(s=>({hasParams:NAe(t,s),hideSearch:s.x[t].hideSearch,hideParams:s.x[t].hideParams}),ae.isEqual);function i(){te.setState(s=>{s.x[t].hideParams=!r})}return!e&&!n&&x.jsx(mn,{onClick:i,children:r?"Show Params":"Hide Params"})}function wft({sectionId:t}){const{selectedItem:e,hideSearch:n,hideParams:r}=te(s=>({selectedItem:Yt(t,s).selectedItem,hideSearch:s.x[t].hideSearch,hideParams:s.x[t].hideParams}),ae.isEqual);function i(){te.setState(s=>{s.x[t].hideSearch=!n})}return!e&&!r&&x.jsx(mn,{onClick:i,children:n?"Show Search":"Hide Search"})}function EX({sectionId:t}){const e=te(r=>r.x[t].hideUnpinnedParams);function n(){te.setState(r=>{r.x[t].hideUnpinnedParams=!e})}return x.jsx(mn,{onClick:n,children:e?"Show Unpinned Params":"Hide Unpinned Params"})}function TX({sectionId:t}){function e(n){const{paramSweepSectionId:r}=te.getState().x[t];r?rg(r):Sft(t)}return x.jsx(mn,{onClick:e,children:"Add Param Sweep"})}function Sft(t){const e=Kn();te.setState(n=>{n.x[t].paramSweepSectionId=e,_ie(t,{id:e,name:Kse(n.x[t].name),uiTypeId:Nm.PARAM_SWEEP},n)})}function r1({sectionId:t}){function e(){Bne([t]);const{variantId:n}=Pi(t);Nd(t,n)}return x.jsx(mn,{onClick:e,children:"Reset To Default Version"})}function _ft({sectionId:t}){const{displayMode:e,renderMarkdown:n,variantIsFrozen:r}=te(o=>({displayMode:o.x[t].displayMode,renderMarkdown:o.x[t].renderMarkdown,variantIsFrozen:Yt(t,o).isFrozen}),ae.isEqual);function i(){te.setState(o=>{o.x[t].displayMode=e===so.RENDER?so.EDIT:so.RENDER})}const s=n?"Markdown":"Plaintext";return x.jsx(mn,{onClick:i,disabled:r,children:e===so.EDIT?`Render ${s}`:`Edit ${s}`})}function kft({sectionId:t}){const e=te(i=>i.x[t].renderMarkdown);function n(){te.setState(i=>{i.x[t].renderMarkdown=!e})}const r=e?"Plaintext":"Markdown";return x.jsx(mn,{onClick:n,children:`Convert to ${r}`})}function Rw({sectionId:t}){const e=te(r=>r.x[t].displayMode);function n(){te.setState(r=>{const i=e===so.YAML?so.GUI:so.YAML;r.x[t].displayMode=i;const{height:s,width:o}=r.x[t].size;if(i===so.YAML&&(s==="auto"||o==="auto")){r.x[t].tempSavedSize=r.x[t].size;const{width:a,height:l}=Uf(t);r.x[t].size={width:a,height:l}}})}return x.jsx(mn,{onClick:n,children:e===so.YAML?"Show GUI":"Show Yaml"})}function Cft({sectionId:t}){function e(){te.setState(n=>{Ide(t,n)}),hn(!0)}return x.jsx(mn,{onClick:e,children:"Ungroup"})}function Hde({sectionId:t,sectionTypeName:e,isInOtherProjectConfigs:n}){const r=Tft(e),i=QXe(t),s=`nodrag w-[14px] h-[14px] flex cursor-pointer select-none items-center justify-center rounded-full ${i?"ml-1 p-0.5":"p-1"} mr-1 -ml-0.5 aspect-square font-semibold leading-none text-setta-700 outline-none transition-colors duration-150 hover:bg-setta-100 focus-visible:ring-2 dark:text-setta-200 dark:hover:bg-setta-800 [&_*]:data-[state=open]:!text-setta-300 dark:[&_*]:data-[state=open]:!text-setta-500`,o=`nodrag flex select-none items-center justify-center rounded-full ${i?"ml-1 p-0.5":"p-0.5"} mr-1 aspect-square font-semibold leading-none text-setta-700 outline-none transition-colors duration-150 dark:text-setta-200`;return r.length===0?x.jsx("div",{className:o,children:x.jsx(kX,{sectionId:t,sectionTypeName:e,isInOtherProjectConfigs:n,isListElement:i})}):x.jsx(tie,{className:Cl,children:x.jsx(Eft,{triggerClassName:s,trigger:x.jsx(kX,{sectionId:t,sectionTypeName:e,isInOtherProjectConfigs:n,isListElement:i}),children:r.map((a,l)=>x.jsx(a,{sectionId:t},l))})})}function Eft({children:t,trigger:e,triggerClassName:n}){return x.jsx(gie,{triggerClassName:n,contentClassName:"z-20 min-w-[200px] rounded-md border border-solid border-setta-100 bg-white p-1 shadow-xl transition-all will-change-[transform,opacity] dark:border-setta-700/50 dark:bg-setta-850",contentAlign:"start",contentSideOffset:5,contentAlignOffset:-3,trigger:e,children:t})}function Tft(t){switch(t){case Y.INFO:return[_ft,kft,n1,r1];case Y.SECTION:return[n1,TX,wft,xft,EX,Rw,CX,r1];case Y.GLOBAL_VARIABLES:return[n1,TX,EX,Rw,CX,r1];case Y.PARAM_SWEEP:return[n1,Rw,r1];case Y.GLOBAL_PARAM_SWEEP:return[Rw];case Y.LIST_ROOT:case Y.DICT_ROOT:case Y.CODE:return[n1,r1,bft];case Y.GROUP:return[Cft];case Y.DRAW:case Y.IMAGE:case Y.CHART:return[yft];default:return[]}}function Zde({sectionId:t,titleProps:e}){const{sectionName:n,titleIsEditable:r}=$ft(t);return r?x.jsx(Aft,{sectionId:t,sectionName:n,titleProps:e,...Rr({title:n})}):x.jsx(Pft,{sectionName:n,className:e.fixed,...Rr({title:n})})}function Pft({sectionName:t,className:e,onMouseEnter:n,onMouseLeave:r}){return x.jsx("h2",{className:e,onMouseEnter:n,onMouseLeave:r,children:t})}function Aft({sectionId:t,sectionName:e,titleProps:n,onMouseEnter:r,onMouseLeave:i}){function s(h){Rft(t,h)}function o(h){return!Mft(t,h)}const[a,l,c,u,f]=IM(e,s,o);return x.jsx(Kie,{value:a,onChange:l,onBlur:c,onKeyDown:u,titleProps:n,doubleClickToEdit:!0,onMouseEnter:r,onMouseLeave:i,blurTriggeredByEscapeKey:f})}function Rft(t,e){te.setState(n=>{const r=n.x[t];r.name=e,r.paramSweepSectionId&&(n.x[paramSweepSectionId].name=Kse(e)),n.shouldRenameReferences=!0}),hn(!0)}function $ft(t){return te(e=>{const n=[Y.GLOBAL_VARIABLES,Y.PARAM_SWEEP,Y.GLOBAL_PARAM_SWEEP].includes(dn(t,e)),r=II(t,[Y.LIST_ROOT],e);return{sectionName:e.x[t].name,titleIsEditable:!r&&!n}})}function Mft(t,e){const n=te.getState(),{parentId:r}=n.x[t],i=r?Yt(r).children:mr.getState().x.keys();for(const s of i)if(n.x[s].name===e)return!0;return!1}function Ift(t){switch(t){case Y.CODE:return"bg-white dark:bg-setta-900";case Y.TERMINAL:return"bg-setta-950 overflow-clip";case Y.GLOBAL_PARAM_SWEEP:return"@container/multipane";case Y.GLOBAL_VARIABLES:return"bg-white dark:bg-black";default:return"bg-setta-50 dark:bg-setta-860"}}function Yde({jsonSourceMissing:t,isActiveSection:e,isGlobalVariables:n,isInOtherProjectConfigs:r}){return t?"outline-red-600 dark:outline-red-400":e&&n?"outline-green-600 dark:outline-turquoise-400":r?e?"outline-purple-600 dark:outline-purple-700":"outline-transparent [&:active:not(:has(button:active,:active.setta-prevent-section-active-css))]:outline-fuchsia-400":e?"outline-blue-600 dark:outline-blue-700":"outline-transparent [&:active:not(:has(button:active,:active.setta-prevent-section-active-css))]:outline-cyan-300"}function Gde(t,e){return n=>{if(n.target.closest(`button, [role="menuitem"], .${lT}`)||Dft())return;if(n.stopPropagation(),Ut.getState().mouseDownDrawArea){Ut.setState({mouseDownDrawArea:!1});return}if(Ut.getState().isSelectingParams){const i=QAe(t,te.getState());!e&&i?yW([t]):e&&!i&&HT([t])}else qe.getState().multiSelectionActive?e?HT([t]):yW([t]):Vd([t]);const r=B5(t);o3([r],!1)}}function Kde(t){return qf(e=>{var n;return((n=e.x[t])==null?void 0:n.length)>0})}function Dft(t=5){const{lastMouseDownLocation:e,lastMouseUpLocation:n}=Ut.getState();if(!e||!n)return!1;const r=n.x-e.x,i=n.y-e.y;return Math.sqrt(r*r+i*i)>t}function Lft({isGroup:t,sectionId:e,droppableRef:n,draggableRef:r,className:i,style:s,trueDragListeners:o,children:a}){const l=qde(e,"withNested");function c(f){l.current=f,n&&n(f),r&&r(f)}const u={ref:c,...o};return t?x.jsx(Qft,{sectionId:e,commonProps:u,refForPosition:l,className:i,style:s,children:a}):x.jsx("div",{className:`${i} focus-visible:outline-none`,style:s,...u,onKeyDown:f=>Oie(f,l,e),tabIndex:"-1",children:a})}const Nft=ke.memo(Lft,ae.isEqual);function Qft({sectionId:t,commonProps:e,refForPosition:n,className:r,style:i,children:s}){const o=Kde(t),a=ir(d=>d.ids.includes(t)),{positionAndSizeLocked:l,isInOtherProjectConfigs:c}=te(d=>({positionAndSizeLocked:d.x[t].positionAndSizeLocked,isInOtherProjectConfigs:d.x[t].isInOtherProjectConfigs}),ae.isEqual),f=Ude()?"pointer-events-none select-none":"",h=Yde({isActiveSection:a,isInOtherProjectConfigs:c});return x.jsxs("div",{className:`group/group-section flex min-w-[250px] flex-col items-stretch px-6 pb-6 pt-2 focus-visible:outline-none ${r}`,...e,onClick:Gde(t,a),onKeyDown:d=>Oie(d,n,t),tabIndex:"-1",style:i,children:[x.jsx("div",{className:`outline outline-4 ${h} transition-radius absolute left-0 right-0 top-0 z-0 h-full w-full ${l?"rounded-sm border-setta-400/90 dark:border-setta-975":"rounded-3xl border-setta-50/50 dark:border-setta-700"} border border-solid bg-setta-100/60 outline outline-2 outline-transparent dark:bg-setta-950/70`}),x.jsxs("div",{className:"z-10 flex min-h-10 w-full items-center",children:[x.jsx(Hde,{sectionId:t,sectionTypeName:Y.GROUP,isInOtherProjectConfigs:c}),x.jsx("div",{className:`${f} relative my-auto mr-2 flex min-h-10 w-full items-center overflow-hidden`,children:x.jsx(jft,{sectionId:t})}),x.jsxs("div",{className:"z-10 ml-auto flex items-center",children:[x.jsx(aft,{sectionId:t}),x.jsx(Xde,{sectionId:t})]})]}),!o&&x.jsx("div",{className:"z-10 -mx-4 mt-4 flex flex-row items-center justify-center rounded-xl border-4 border-dashed border-setta-300 px-4 py-3 text-sm text-setta-500/80 dark:border-setta-700 dark:text-setta-500",children:"Drop A Section Here."}),s]})}function jft({sectionId:t}){const e={editing:"absolute nodrag cursor-text box-border px-1 focus-visible:ring-0 focus-visible:outline-none focus-visible:border-blue-500 rounded-lg border border-solid border-transparent w-full tracking-tighter text-setta-500 dark:text-setta-500 cursor-pointer flex-shrink",notEditing:"absolute cursor-pointer box-border px-1 focus-visible:ring-0 focus-visible:outline-none focus-visible:border-blue-500 rounded-lg border border-solid border-transparent w-full truncate tracking-tighter text-setta-500 dark:text-setta-500 flex-shrink"};return x.jsx(Zde,{sectionId:t,titleProps:e})}function Bft({behaviorDropType:t,children:e,isGroup:n}){const r=gut[t];return x.jsxs(x.Fragment,{children:[t&&x.jsx(zft,{text:r,behaviorDropType:t,isGroup:n}),e]})}function zft({text:t,behaviorDropType:e,isGroup:n}){return x.jsx("div",{className:`absolute z-20 grid h-full w-full justify-center ${n?"[place-content:end_center]":"place-content-center"}`,children:x.jsx(Fft,{text:t,behaviorDropType:e,isGroup:n})})}function Fft({text:t,behaviorDropType:e,isGroup:n}){const r=e===sb.INVALID;return x.jsx("div",{className:`grid h-8 min-w-60 select-none place-items-center rounded-full text-sm font-bold uppercase tracking-widest text-white shadow-md backdrop-blur-sm transition-opacity ${r?"[background-color:rgba(220,_38,_38,_0.8)]":"[background-color:rgba(37,_99,_235,_0.8)]"} ${n&&"mb-8"}`,children:x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx(z$e,{}),t]})})}function Wft({isGroup:t,sectionId:e,isTopLevel:n,droppableRef:r,draggableRef:i,dragListeners:s,children:o}){const{style:a,behaviorDropType:l}=rft({sectionId:e,isGroup:t});return x.jsx(Bft,{behaviorDropType:l,isGroup:t,children:x.jsx(Uft,{isGroup:t,sectionId:e,isTopLevel:n,droppableRef:r,draggableRef:i,dragListeners:s,style:a,children:o})})}const Jde=ke.memo(Wft,(t,e)=>t.isGroup===e.isGroup&&t.children===e.children&&ae.isEqual(t.dragListeners,e.dragListeners));function Vft({isGroup:t,sectionId:e,isTopLevel:n,droppableRef:r,draggableRef:i,dragListeners:s,style:o,children:a}){const l=cn(p=>p.activeId===e),{isSorting:c,isMovingFree:u}=zne(),f=u||!n&&c?s:{},h=c||u?"nodrag":"",d=l?{...o,opacity:.5}:o;return x.jsx(Nft,{isGroup:t,sectionId:e,droppableRef:r,draggableRef:i,trueDragListeners:f,className:h,style:d,children:a})}const Uft=ke.memo(Vft,ae.isEqual);function qft({isGroup:t,sectionId:e,children:n}){const r=cn(l=>l.activeId===e),i=Vde({sectionId:e,isTopLevel:!0}),{setNodeRef:s}=Wee({...i,disabled:r}),{listeners:o,setNodeRef:a}=Fee(i);return x.jsx(Jde,{isGroup:t,sectionId:e,isTopLevel:!0,droppableRef:s,draggableRef:a,dragListeners:o,children:n})}function Xft({isGroup:t,sectionId:e,dragListeners:n,children:r,isTopLevel:i}){return i?x.jsx(qft,{isGroup:t,sectionId:e,children:r}):x.jsx(Jde,{isGroup:t,sectionId:e,isTopLevel:i,dragListeners:n,children:r})}function Hft({sectionId:t,items:e,children:n}){const r=ift(t),i=cn(s=>s.isSorting?s.activeId:s.overId);return x.jsx(L8e,{id:t,items:e,strategy:Zft(r,i),disabled:r,children:n})}function PX(){return[{x:0,y:0,scaleX:1,scaleY:1},-1]}function Zft(t,e){if(t.draggable||t.droppable)return PX;if(e){const n=IA(e);if(n)return Pi(n).isHorizontalOrientation?P8e:I8e}return PX}function Yft({sectionId:t}){return F5(t)?x.jsx(Jft,{sectionId:t}):x.jsx(e0e,{sectionId:t,forceApplyTransform:!1})}const Gft=ke.memo(Yft);function Kft({sectionId:t}){const[e,n]=_.useState(!0);return _.useEffect(()=>{n(!1)},[]),x.jsx(e0e,{sectionId:t,forceApplyTransform:e})}const Jft=ke.memo(Kft);function eht({sectionId:t,forceApplyTransform:e}){const n=sht(),r=Vde({sectionId:t,isTopLevel:!1}),{attributes:{role:i,...s},listeners:o,setNodeRef:a,transform:l,transition:c,overIndex:u,items:f}=V8e({...r,animateLayoutChanges:n});return x.jsx(rht,{sectionId:t,attributes:s,listeners:o,setNodeRef:a,transform:l,transition:c,applyTransform:e||u!==null&&u!==-1||f.length===1&&f[0]===t&&F5(t)})}const e0e=ke.memo(eht);function tht({sectionId:t,attributes:e,listeners:n,setNodeRef:r,transform:i,transition:s,applyTransform:o}){const a=cn(f=>f.overId===t),l=iht(o?i:null),u={style:{transform:wf.Translate.toString(l),transition:s,zIndex:a?500:void 0},ref:r,...e};return x.jsx("div",{className:"relative flex w-full outline-none",...u,tabIndex:"-1",children:x.jsx(nht,{sectionId:t,applyTransform:o,listeners:n})})}function nht({sectionId:t,applyTransform:e,listeners:n}){return F5(t)?e?x.jsx(hut,{}):null:x.jsx(e1e,{sectionId:t,dragListeners:n})}const rht=ke.memo(tht,(t,e)=>t.sectionId===e.sectionId&&t.transform===e.transform&&t.transition===e.transition&&ae.isEqual(t.listeners,e.listeners));function iht(t){if(t){const e=qe.getState().transform[2];return{...t,x:t.x/e,y:t.y/e}}return t}function sht(){const t=cn(e=>e.isSorting);return()=>t}function oht({sectionId:t,isGroup:e}){return Kde(t)&&x.jsx("div",{className:"flex flex-col",children:x.jsx(aht,{sectionId:t,isGroup:e})})}function aht({sectionId:t,isGroup:e}){const n=qf(r=>r.x[t]);return x.jsx(Hft,{sectionId:t,items:n,children:x.jsx(lht,{childIds:n,sectionId:t,isGroup:e})})}function lht({childIds:t,sectionId:e,isGroup:n}){const r=()=>{rg(e)},i=te(s=>s.x[e].isHorizontalOrientation);return x.jsxs("div",{className:"flex items-stretch",children:[!n&&x.jsx("div",{className:"mr-2 mt-2 min-h-full w-2 rounded-full bg-white/30 transition-all duration-75 hover:cursor-pointer hover:bg-white/50 dark:bg-setta-700 hover:dark:bg-setta-600",onClick:r}),x.jsx("div",{className:`mt-2 flex ${i?"flex-row":"flex-col "} items-start gap-2`,children:t.map(s=>x.jsx(Gft,{sectionId:s},`Nested-Sec-${s}`))})]})}const ks={any:"any",auto_only:"auto_only",manual_only:"manual_only"};function y4(t){return t==="auto"?t:parseInt(t)}function AX(t,e,n){return n!==ks.manual_only?t:e}function cht({direction:t,ref:e,sizeMode:n,aspectRatio:r}){const i=y4(e.style.width),s=y4(e.style.height),o=AX("auto",i,n.width),a=AX("auto",s,n.height);return t==="bottomRight"?{width:o,height:a}:t==="right"&&n.width?r?{width:o,height:a}:{width:o}:t==="bottom"&&n.height?r?{width:o,height:a}:{height:a}:{}}function uht({direction:t,ref:e,sizeMode:n,aspectRatio:r}){const i=y4(e.style.width),s=y4(e.style.height);return t==="bottomRight"?{width:i,height:s}:t==="right"&&n.width?r?{width:i,height:s}:{width:i}:t==="bottom"&&n.height?r?{width:i,height:s}:{height:s}:{}}function t0e({props:t,sizeMode:e,aspectRatio:n}){const[r,i,s,o]=t;return o.width===0&&o.height===0&&r.detail===2?cht({direction:i,ref:s,sizeMode:e,aspectRatio:n}):uht({direction:i,ref:s,sizeMode:e,aspectRatio:n})}const DA=1e5,fht=1e5,hht=64,n0e=50,r0e=32;function KD({sectionType:t,hideSearch:e,hideParams:n,isMinimized:r}){if(r)return r0e;if(t===Y.SECTION)return e?78:n?58:104;if(t===Y.LIST_ROOT||t===Y.DICT_ROOT)return n0e;if(t===Y.GLOBAL_VARIABLES)return 78;if(t===Y.CODE)return 58.2;if(t===Y.INFO)return 98;if(t===Y.PARAM_SWEEP)return 50;if(t===Y.TERMINAL)return 100;if(t===Y.GLOBAL_PARAM_SWEEP)return 112;if(t===Y.DRAW||t===Y.IMAGE)return 100;if(t===Y.CHART)return 300;if(t===Y.SOCIAL)return 50}function dht({sectionType:t,isMinimized:e}){return e?r0e:t===Y.LIST_ROOT||t===Y.DICT_ROOT?n0e:DA}function JD({sectionType:t,isTwitter:e}){return e?370:t===Y.DRAW?402:t===Y.CHART?300:200}function pht({isTwitter:t}){return t?574:fht}function mht({sectionType:t,hideParams:e,isTwitter:n}){if(t===Y.SECTION){if(e)return{height:ks.auto_only,width:ks.any}}else if(t===Y.TERMINAL||t===Y.CHART)return{height:ks.manual_only,width:ks.manual_only};return n?{height:ks.auto_only,width:ks.any}:{height:ks.any,width:ks.any}}function ght(t){return te(e=>{const n=fft(t,e),r=dn(t,e),i=e.x[t].hideSearch,s=e.x[t].hideParams,o=e.x[t].isMinimized,a=KD({sectionType:r,hideSearch:i,hideParams:s,isMinimized:o}),l=dht({sectionType:r,isMinimized:o}),c=JD({sectionType:r,isTwitter:n}),u=pht({isTwitter:n}),f=mht({sectionType:r,hideParams:s,isTwitter:n});return{minHeight:a,maxHeight:l,minWidth:c,maxWidth:u,sizeMode:f}},ae.isEqual)}function dg(){const[t,e]=_.useState(!1),n=_.useRef(null);return _.useEffect(()=>{if(!n.current)return;function r(){n.current&&e(n.current.scrollHeight>n.current.clientHeight)}const i=new ResizeObserver(()=>{r()}),s=new MutationObserver(()=>{r()});return i.observe(n.current),s.observe(n.current,{childList:!0,subtree:!0,characterData:!0,attributes:!0}),r(),()=>{i.disconnect(),s.disconnect()}},[]),{ref:n,isScrollable:t}}async function LA(t,e){const n=dn(t),r=KD({sectionType:n}),i=JD({sectionType:n}),s=te.getState().x[t].size;let o=iut(s.height,s.width,e.height,e.width);o=Ade(o.height,o.width,r,i);const a=24;o.height+=a,te.setState(l=>{ik({sectionId:t,aspectRatio:e.width/e.height,aspectRatioExtraHeight:a,size:o,state:l})})}function vht(t,e){const[n,r]=_.useState(null),i=te(s=>{const{width:o,height:a}=s.x[t].size;return o==="auto"||a==="auto"});return _.useEffect(()=>{const s={width:e.width,height:e.height};ae.isEqual(s,n)||LA(t,s),r(s)},[e.src]),_.useEffect(()=>{n&&LA(t,n)},[i]),n!==null}function Oht({sectionId:t,imgSize:e,isNewImg:n,sectionWidth:r,sectionHeight:i,state:s}){let o={};if(e){if(r==="auto"||i==="auto"||n){const c=Y.DRAW,u=KD({sectionType:c}),f=JD({sectionType:c});o=Ade(e.height,e.width,u-120,f-24),BO(t,{width:o.width+24,height:o.height+120},s)}else o.width=r-24,o.height=i-120;n&&ik({sectionId:t,aspectRatio:e.width/e.height,aspectRatioExtraHeight:120,aspectRatioExtraWidth:24,state:s})}else{const[c,u]=[500,500];o.width=r==="auto"?c:r-24,o.height=i==="auto"?u:i-120,(r==="auto"||i==="auto")&&BO(t,{width:o.width+24,height:o.height+120},s)}return o}function yht(t){const n={width:640,height:360},{width:r,height:i}=te(a=>a.x[t].size,ae.isEqual);function s(){n.height+=22,te.setState(a=>{ik({sectionId:t,aspectRatio:16/9,aspectRatioExtraHeight:22,size:n,state:a})})}return _.useEffect(()=>{(r==="auto"||i==="auto")&&s()},[r,i]),_.useEffect(()=>{LA(t,n)},[]),r==="auto"||i==="auto"?{}:{width:r,height:i-22}}function bht(t){_.useEffect(()=>{te.setState(e=>{ik({sectionId:t,aspectRatio:null,aspectRatioExtraHeight:null,aspectRatioExtraWidth:null,size:{height:"auto"},state:e})})},[])}function ik({sectionId:t,size:e,aspectRatio:n,aspectRatioExtraHeight:r,aspectRatioExtraWidth:i,state:s}){const o=s.x[t];o.aspectRatio=n,o.aspectRatioExtraHeight=r,o.aspectRatioExtraWidth=i,e&&BO(t,e,s)}function eL({children:t,onResizeStart:e,as:n,...r}){const{scale:i,onResizeStart:s}=xht();function o(...a){e&&e(...a),s(...a)}return x.jsx(xle,{...r,scale:i,as:n,onResizeStart:o,children:t})}function xht(){const[t,e]=_.useState(1);function n(){e(qe.getState().transform[2])}return{scale:t,onResizeStart:n}}function wht({sectionId:t,bgColor:e,isYouTube:n,isActiveSection:r,positionAndSizeLocked:i,children:s,as:o}){const{minHeight:a,maxHeight:l,minWidth:c,maxWidth:u,sizeMode:f}=ght(t);return x.jsx(Sht,{sectionId:t,bgColor:e,isYouTube:n,isActiveSection:r,positionAndSizeLocked:i,minHeight:a,maxHeight:l,minWidth:c,maxWidth:u,sizeMode:f,as:o,children:s})}function Sht({sectionId:t,bgColor:e,isYouTube:n,isActiveSection:r,positionAndSizeLocked:i,minHeight:s,maxHeight:o,minWidth:a,maxWidth:l,sizeMode:c,children:u,as:f}){_.useEffect(()=>{const E={};c.height===ks.auto_only&&(E.height="auto"),c.width===ks.auto_only&&(E.width="auto"),ae.size(E)>0&&te.setState(T=>{wX(t,E,T)})},[c.height,c.width]);const{size:h,aspectRatio:d,aspectRatioExtraHeight:p,aspectRatioExtraWidth:g}=kht(t);function m(){te.setState(E=>{RX(t,"start",E)})}function v(...E){const T=t0e({props:E,sizeMode:c,aspectRatio:d});te.setState(C=>{wX(t,T,C),RX(t,"end",C)}),hn(!0)}const y=s!==o&&c.height!==ks.auto_only,b=c.width!==ks.auto_only,S=Nt(E=>E.gui.snapGrid),k=Ot.snapToGrid.hook()[0];return x.jsx(_ht,{sectionId:t,as:f,bgColor:e,isYouTube:n,isActiveSection:r,size:h,minHeight:s,maxHeight:o,minWidth:a,maxWidth:l,heightResizable:y,widthResizable:b,positionAndSizeLocked:i,onResizeStart:m,onResizeStop:v,aspectRatio:d,aspectRatioExtraHeight:p,aspectRatioExtraWidth:g,snapGrid:S,snapToGrid:k,children:u})}function _ht({sectionId:t,as:e,bgColor:n,isYouTube:r,isActiveSection:i,size:s,minHeight:o,maxHeight:a,minWidth:l,maxWidth:c,heightResizable:u,widthResizable:f,positionAndSizeLocked:h,onResizeStart:d,onResizeStop:p,aspectRatio:g,aspectRatioExtraHeight:m,aspectRatioExtraWidth:v,snapGrid:y,snapToGrid:b,children:S}){const k=Ude(),E=k||h?!1:{top:!1,left:!1,bottom:u,right:f,topRight:!1,bottomRight:u&&f,topLeft:!1,bottomLeft:!1},T=`${k?"pointer-events-none select-none":""} ${n} section-grid-cols section-grid-rows section-grid-areas grid h-full transition-radius ${h?"rounded-sm":"rounded-xl shadow-md"} before:content-none before:block before:absolute before:top-0 before:right-0 before:bottom-0 before:left-0 before:border before:border-white dark:before:border-setta-700 ${r?"overflow-clip":""} ${i?"z-[150]":"z-10"}`;return x.jsx(eL,{id:`${t}-CustomResizable`,as:e,size:s,minHeight:o,maxHeight:a,minWidth:l,maxWidth:c,onResizeStart:d,onResizeStop:p,lockAspectRatio:g,lockAspectRatioExtraHeight:m,lockAspectRatioExtraWidth:v,handleWrapperClass:"absolute pointer-events-none [&>*]:pointer-events-auto h-full bottom-0 w-full nodrag [&>div]:z-20",enable:E,className:T,handleStyles:{right:{right:"-8px"},bottom:{bottom:"-8px"}},handleClasses:{right:`${lT} ${Cl} ${Jp}`,bottom:`${lT} ${Cl} ${Jp}`},grid:b?y:null,children:S})}function kht(t){return te(e=>{const n=e.x[t];return n.isMinimized?{size:n.size,aspectRatio:!1,aspectRatioExtraHeight:0,aspectRatioExtraWidth:0}:{size:n.size,aspectRatio:n.aspectRatio??!1,aspectRatioExtraHeight:n.aspectRatioExtraHeight??0,aspectRatioExtraWidth:n.aspectRatioExtraWidth??0}},ae.isEqual)}function RX(t,e,n){n.x[t].resizeEvent=e}const i0e="Popover",[s0e,_Et]=Oo(i0e,[Z5]),sk=Z5(),[Cht,Jd]=s0e(i0e),Eht=t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:o=!1}=t,a=sk(e),l=_.useRef(null),[c,u]=_.useState(!1),[f=!1,h]=Nl({prop:r,defaultProp:i,onChange:s});return _.createElement(Ere,a,_.createElement(Cht,{scope:e,contentId:ff(),triggerRef:l,open:f,onOpenChange:h,onOpenToggle:_.useCallback(()=>h(d=>!d),[h]),hasCustomAnchor:c,onCustomAnchorAdd:_.useCallback(()=>u(!0),[]),onCustomAnchorRemove:_.useCallback(()=>u(!1),[]),modal:o},n))},Tht="PopoverTrigger",Pht=_.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=Jd(Tht,n),s=sk(n),o=In(e,i.triggerRef),a=_.createElement(gn.button,Ee({type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":l0e(i.open)},r,{ref:o,onClick:gt(t.onClick,i.onOpenToggle)}));return i.hasCustomAnchor?a:_.createElement(Tre,Ee({asChild:!0},s),a)}),o0e="PopoverPortal",[Aht,Rht]=s0e(o0e,{forceMount:void 0}),$ht=t=>{const{__scopePopover:e,forceMount:n,children:r,container:i}=t,s=Jd(o0e,e);return _.createElement(Aht,{scope:e,forceMount:n},_.createElement(zd,{present:n||s.open},_.createElement(Are,{asChild:!0,container:i},r)))},zO="PopoverContent",Mht=_.forwardRef((t,e)=>{const n=Rht(zO,t.__scopePopover),{forceMount:r=n.forceMount,...i}=t,s=Jd(zO,t.__scopePopover);return _.createElement(zd,{present:r||s.open},s.modal?_.createElement(Iht,Ee({},i,{ref:e})):_.createElement(Dht,Ee({},i,{ref:e})))}),Iht=_.forwardRef((t,e)=>{const n=Jd(zO,t.__scopePopover),r=_.useRef(null),i=In(e,r),s=_.useRef(!1);return _.useEffect(()=>{const o=r.current;if(o)return G5(o)},[]),_.createElement(dM,{as:lm,allowPinchZoom:!0},_.createElement(a0e,Ee({},t,{ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:gt(t.onCloseAutoFocus,o=>{var a;o.preventDefault(),s.current||(a=n.triggerRef.current)===null||a===void 0||a.focus()}),onPointerDownOutside:gt(t.onPointerDownOutside,o=>{const a=o.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0,c=a.button===2||l;s.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:gt(t.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})))}),Dht=_.forwardRef((t,e)=>{const n=Jd(zO,t.__scopePopover),r=_.useRef(!1);return _.createElement(a0e,Ee({},t,{ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var s;if((s=t.onCloseAutoFocus)===null||s===void 0||s.call(t,i),!i.defaultPrevented){var o;r.current||(o=n.triggerRef.current)===null||o===void 0||o.focus(),i.preventDefault()}r.current=!1},onInteractOutside:i=>{var s,o;(s=t.onInteractOutside)===null||s===void 0||s.call(t,i),i.defaultPrevented||(r.current=!0);const a=i.target;((o=n.triggerRef.current)===null||o===void 0?void 0:o.contains(a))&&i.preventDefault()}}))}),a0e=_.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:o,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:u,...f}=t,h=Jd(zO,n),d=sk(n);return hre(),_.createElement(dre,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s},_.createElement(ure,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>h.onOpenChange(!1)},_.createElement(Pre,Ee({"data-state":l0e(h.open),role:"dialog",id:h.contentId},d,f,{ref:e,style:{...f.style,["--radix-popover-content-transform-origin"]:"var(--radix-popper-transform-origin)"}}))))}),Lht="PopoverClose",Nht=_.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=Jd(Lht,n);return _.createElement(gn.button,Ee({type:"button"},r,{ref:e,onClick:gt(t.onClick,()=>i.onOpenChange(!1))}))}),Qht=_.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=sk(n);return _.createElement(GMe,Ee({},i,r,{ref:e}))});function l0e(t){return t?"open":"closed"}const jht=Eht,Bht=Pht,zht=$ht,Fht=Mht,Wht=Nht,Vht=Qht;function $1({trigger:t,contentClasses:e,children:n,open:r,close:i=!1,closeClasses:s,onOpenChange:o,arrowClasses:a}){return x.jsxs(jht,{open:r,onOpenChange:o,children:[x.jsx(Bht,{asChild:!0,children:t}),x.jsx(zht,{children:x.jsxs(Fht,{className:e,children:[i&&x.jsx(Wht,{className:s,children:i}),x.jsx(Vht,{className:a||"[fill:rgb(229,_231,_235)] dark:[fill:rgb(51,_65,_85)]"}),n]})})]})}function c0e({sectionId:t,isRoot:e,popover:n=!1}){const r=C5(t),i=c=>{$Ne(e,t,c)},s=c=>{qct(e,t,c)},o=c=>{c&&!isNaN(c)?l(parseInt(c)):l("")},[a,l]=_.useState(1);return x.jsxs("div",{className:`section-key-value section-row-main -mx-2 flex items-center gap-1 rounded-lg bg-setta-100 pl-2 pr-1 dark:bg-setta-950 ${n?"border border-solid border-white py-1 shadow-lg dark:border-setta-800":""}`,children:[e?x.jsxs(x.Fragment,{children:[x.jsx(hHe,{className:"text-setta-300 dark:text-setta-600"}),x.jsx("p",{className:"text-[10px] font-bold text-setta-500",children:"Children: "})]}):x.jsx("p",{className:"text-[10px] text-setta-500",children:"Siblings"}),x.jsx("input",{className:"nodrag max-w-[3ch] cursor-auto rounded-md bg-white px-2 text-xs focus-visible:ring-2 dark:bg-setta-800 dark:text-setta-300",value:a,onChange:c=>o(c.target.value),disabled:r}),x.jsx("button",{className:"nodrag gg-math-minus rounded-full focus-visible:ring-2 dark:text-setta-300",onClick:()=>s(a),role:"button",disabled:r}),x.jsx("button",{className:"nodrag gg-math-plus rounded-full focus-visible:ring-2 dark:text-setta-300",onClick:()=>i(a),role:"button",disabled:r})]})}function Uht({onClick:t,...e}){return x.jsx(Fa,{...e,icon:x.jsx("i",{className:"gg-close"}),color:"text-setta-600 hover:text-white",bg:"bg-transparent hover:bg-red-500",size:"min-w-4 h-4",padding:"p-0",onClick:t})}function qht({sectionId:t,twClasses:e,...n}){const r=te(s=>s.x[t].isMinimized);function i(){te.setState(s=>{s.x[t].isMinimized=!r})}return x.jsx(Fa,{...n,icon:r?x.jsx("i",{className:"gg-maximize !scale-[.4]"}):x.jsx("i",{className:"gg-math-minus"}),color:"text-setta-600 hover:text-white",bg:"bg-transparent hover:bg-blue-500 justify-content-center mr-1",size:"w-4 h-4",padding:"p-0",twClasses:e,onClick:i})}function Xht({sectionId:t}){function e(){const{runInMemory:n}=Pi(t);n?RM([t]):$M([t])}return x.jsx(Fa,{icon:x.jsx(lre,{}),color:"text-setta-600 hover:text-green-500 active:!text-blue-700",bg:"bg-transparent",size:"w-4 h-4",padding:"p-0 mr-1",onClick:e,...Rr({title:"Run this code block"})})}function Hht({sectionId:t}){const e=te(r=>r.x[t].runInMemory);function n(){te.setState(r=>{r.x[t].runInMemory=!e})}return x.jsx(Fa,{icon:x.jsx(tHe,{}),color:`${e?"text-blue-500 hover:!text-cyan-200":"text-setta-600 hover:!text-blue-500"} active:!text-blue-500`,bg:`${e?"hover:bg-blue-500":"bg-transparent"}`,size:"w-4 h-4",padding:"p-0 mr-1",onClick:n,...Rr({title:"Toggle In-Memory Code"})})}function Zht({sectionId:t,isActiveSection:e,sectionTypeName:n,isInOtherProjectConfigs:r,isRoot:i}){const s=()=>{te.setState(a=>{_m([t],a)}),hn(!0)},o=NXe(t)&&!i;return x.jsxs("header",{className:"section-title mx-2 flex flex-row items-center",children:[x.jsx(Hde,{sectionId:t,sectionTypeName:n,isInOtherProjectConfigs:r}),n!==Y.INFO&&x.jsx(x.Fragment,{children:x.jsx(Yht,{sectionId:t,isActiveSection:e,isInOtherProjectConfigs:r,sectionTypeName:n})}),x.jsxs("div",{className:"z-10 ml-auto flex items-center",children:[o&&x.jsx($1,{arrowClasses:"fill-white dark:fill-setta-800",contentClasses:"z-20",trigger:x.jsx(Fa,{twClasses:"[&_*]:hover:text-setta-500 [&_*]:dark:hover:text-setta-400",bg:"bg-transparent",children:x.jsx(fHe,{className:"text-setta-300 dark:text-setta-700"})}),children:x.jsx(c0e,{sectionId:t,isRoot:i,popover:!0})}),n===Y.CODE&&x.jsxs(x.Fragment,{children:[x.jsx(Xht,{sectionId:t})," ",x.jsx(Hht,{sectionId:t})," "]}),x.jsx(Xde,{sectionId:t}),!i&&x.jsx(qht,{sectionId:t}),x.jsx(Uht,{onClick:s})]})]})}function Yht({sectionId:t,isActiveSection:e,isInOtherProjectConfigs:n,sectionTypeName:r}){return x.jsx(Zde,{sectionId:t,titleProps:Kht({isActiveSection:e,isInOtherProjectConfigs:n,sectionTypeName:r})})}const Ght=ke.memo(Zht);function Kht({isActiveSection:t,isInOtherProjectConfigs:e,sectionTypeName:n}){const r="cursor-text nodrag px-1 py-0 leading-5 -ml-1 bg-setta-100 focus-visible:ring-0 focus-visible:outline-none rounded-md box-border border border-solid border-transparent focus-visible:border-blue-500 dark:bg-setta-800 w-3/5 dark:text-white font-bold text-[.7rem] tracking-tight",i=n===Y.GLOBAL_VARIABLES,s=Jht({isActiveSection:t,isInOtherProjectConfigs:e,isGlobalVariables:i,sectionTypeName:n});return i?{fixed:s}:{editing:r,notEditing:s,fixed:"select-none italic focus-visible:ring-0 focus-visible:outline-none box-border border border-solid border-transparent focus-visible:border-blue-500 tracking-tighter text-xs text-setta-400 max-w-full truncate pr-0.5"}}function Jht({isActiveSection:t,isInOtherProjectConfigs:e,isGlobalVariables:n,sectionTypeName:r}){let i="",s="font-bold";return t?e?i="text-purple-800 dark:text-purple-200":n?i="text-green-800 dark:text-green-200":r===Y.TERMINAL?i="text-blue-400":i="text-blue-600 dark:text-blue-400":r===Y.TERMINAL?i="text-setta-300":i="text-setta-700 dark:text-setta-300",n&&(s="uppercase font-bold"),`px-1 py-0 -ml-1 w-3/5 focus-visible:ring-0 focus-visible:outline-none box-border rounded-md border border-solid border-transparent focus-visible:border-blue-500 leading-5 font-bold tracking-tight cursor-pointer max-w-full text-[.7rem] truncate ${i} ${s}`}/*!
356
+ `});default:return x.jsx("i",{className:"gg-menu group/card-section:hover:bg !scale-110 text-setta-300 transition-colors group-hover/card-section:text-blue-500 dark:text-setta-500 dark:group-hover/card-section:text-[#0084ff] "})}}function dft({sectionId:t}){const e=te(n=>dn(t,n)===Y.GROUP);return x.jsx("i",{className:`gg-link group/card-section:hover:bg transition-colors group-hover/card-section:text-pink-500 dark:group-hover/card-section:text-[#ff00ff] ${e?"-rotate-45 !scale-75 text-purple-600 dark:text-purple-700":"text-purple-500 dark:text-purple-500"}`})}function pft({sectionId:t}){const{isYouTube:e,isTwitter:n}=te(r=>({isYouTube:YD(r.x[t].social),isTwitter:GD(r.x[t].social)}),ae.isEqual);return e?x.jsx(vlt,{className:"fill-setta-300 transition-colors group-hover/card-section:fill-blue-500 dark:fill-setta-500 dark:group-hover/card-section:fill-[#0084ff] "}):n?x.jsx(oit,{className:"fill-setta-300 transition-colors group-hover/card-section:fill-blue-500 dark:fill-setta-500 dark:group-hover/card-section:fill-[#0084ff] "}):x.jsx(lft,{className:"text-setta-300 transition-colors group-hover/card-section:text-blue-500 dark:text-setta-500 dark:group-hover/card-section:text-[#0084ff] "})}function mft({sectionId:t,classes:e}){switch(te(r=>r.x[t].codeLanguage)){case"python":return x.jsx(uft,{className:e});case"javascript":return x.jsx(FFe,{className:e});case"bash":return x.jsx(cft,{className:e});default:return null}}function gft({sectionId:t}){const e=BAe(t);return x.jsxs("p",{className:"group/card-section:hover:bg font-mono text-[9px] tracking-tighter text-setta-300 transition-colors group-hover/card-section:text-blue-500 dark:text-setta-500 dark:group-hover/card-section:text-[#0084ff] ",children:["[",e,"]"]})}function vft({sectionId:t}){return te(n=>n.x[t].renderMarkdown)?x.jsx(glt,{className:"text-transparent transition-colors group-hover/card-section:text-blue-500 dark:text-setta-500 dark:text-transparent dark:group-hover/card-section:text-[#0084ff]"}):x.jsx(iHe,{className:"text-transparent transition-colors group-hover/card-section:text-blue-500 dark:text-setta-500 dark:text-transparent dark:group-hover/card-section:text-[#0084ff]"})}function Oft({sectionId:t}){return te(n=>n.x[t].isReadOnlyTerminal)?x.jsx(jct,{className:"text-setta-300 transition-colors group-hover/card-section:text-blue-500 dark:text-setta-500 dark:group-hover/card-section:text-[#0084ff] ",...Rr({title:"Read-only terminal"})}):x.jsx(ylt,{className:"text-setta-300 transition-colors group-hover/card-section:text-blue-500 dark:text-setta-500 dark:group-hover/card-section:text-[#0084ff] ",...Rr({title:"Read/write terminal"})})}function yft({sectionId:t}){async function e(){YPe(t)}return x.jsx(mn,{onClick:e,children:"Add artifact by filepath"})}function bft({sectionId:t}){function e(n){const r=te.getState().singletonSections.inMemoryFnStdoutTerminal;r?rg(r):te.setState(i=>{_ie(t,{isReadOnlyTerminal:!0,uiTypeId:Nm.TERMINAL},i)})}return x.jsx(mn,{onClick:e,children:"Add Stdout Terminal"})}function CX({sectionId:t}){function e(){const{variantId:n}=Pi(t);te.setState(r=>{for(const i of Object.keys(r.variants[n].values))r.variants[n].values[i]=Wm()}),hn(!0),Nd(t,n)}return x.jsx(mn,{onClick:e,children:"Clear Values"})}function n1({sectionId:t}){async function e(){dde(t)}return x.jsx(mn,{onClick:e,children:"New Version"})}function xft({sectionId:t}){const{hasParams:e,hideSearch:n,hideParams:r}=te(s=>({hasParams:NAe(t,s),hideSearch:s.x[t].hideSearch,hideParams:s.x[t].hideParams}),ae.isEqual);function i(){te.setState(s=>{s.x[t].hideParams=!r})}return!e&&!n&&x.jsx(mn,{onClick:i,children:r?"Show Params":"Hide Params"})}function wft({sectionId:t}){const{selectedItem:e,hideSearch:n,hideParams:r}=te(s=>({selectedItem:Yt(t,s).selectedItem,hideSearch:s.x[t].hideSearch,hideParams:s.x[t].hideParams}),ae.isEqual);function i(){te.setState(s=>{s.x[t].hideSearch=!n})}return!e&&!r&&x.jsx(mn,{onClick:i,children:n?"Show Search":"Hide Search"})}function EX({sectionId:t}){const e=te(r=>r.x[t].hideUnpinnedParams);function n(){te.setState(r=>{r.x[t].hideUnpinnedParams=!e})}return x.jsx(mn,{onClick:n,children:e?"Show Unpinned Params":"Hide Unpinned Params"})}function TX({sectionId:t}){function e(n){const{paramSweepSectionId:r}=te.getState().x[t];r?rg(r):Sft(t)}return x.jsx(mn,{onClick:e,children:"Add Param Sweep"})}function Sft(t){const e=Kn();te.setState(n=>{n.x[t].paramSweepSectionId=e,_ie(t,{id:e,name:Kse(n.x[t].name),uiTypeId:Nm.PARAM_SWEEP},n)})}function r1({sectionId:t}){function e(){Bne([t]);const{variantId:n}=Pi(t);Nd(t,n)}return x.jsx(mn,{onClick:e,children:"Reset To Default Version"})}function _ft({sectionId:t}){const{displayMode:e,renderMarkdown:n,variantIsFrozen:r}=te(o=>({displayMode:o.x[t].displayMode,renderMarkdown:o.x[t].renderMarkdown,variantIsFrozen:Yt(t,o).isFrozen}),ae.isEqual);function i(){te.setState(o=>{o.x[t].displayMode=e===so.RENDER?so.EDIT:so.RENDER})}const s=n?"Markdown":"Plaintext";return x.jsx(mn,{onClick:i,disabled:r,children:e===so.EDIT?`Render ${s}`:`Edit ${s}`})}function kft({sectionId:t}){const e=te(i=>i.x[t].renderMarkdown);function n(){te.setState(i=>{i.x[t].renderMarkdown=!e})}const r=e?"Plaintext":"Markdown";return x.jsx(mn,{onClick:n,children:`Convert to ${r}`})}function Rw({sectionId:t}){const e=te(r=>r.x[t].displayMode);function n(){te.setState(r=>{const i=e===so.YAML?so.GUI:so.YAML;r.x[t].displayMode=i;const{height:s,width:o}=r.x[t].size;if(i===so.YAML&&(s==="auto"||o==="auto")){r.x[t].tempSavedSize=r.x[t].size;const{width:a,height:l}=Uf(t);r.x[t].size={width:a,height:l}}})}return x.jsx(mn,{onClick:n,children:e===so.YAML?"Show GUI":"Show Yaml"})}function Cft({sectionId:t}){function e(){te.setState(n=>{Ide(t,n)}),hn(!0)}return x.jsx(mn,{onClick:e,children:"Ungroup"})}function Hde({sectionId:t,sectionTypeName:e,isInOtherProjectConfigs:n}){const r=Tft(e),i=QXe(t),s=`nodrag w-[14px] h-[14px] flex cursor-pointer select-none items-center justify-center rounded-full ${i?"ml-1 p-0.5":"p-1"} mr-1 -ml-0.5 aspect-square font-semibold leading-none text-setta-700 outline-none transition-colors duration-150 hover:bg-setta-100 focus-visible:ring-2 dark:text-setta-200 dark:hover:bg-setta-800 [&_*]:data-[state=open]:!text-setta-300 dark:[&_*]:data-[state=open]:!text-setta-500`,o=`nodrag flex select-none items-center justify-center rounded-full ${i?"ml-1 p-0.5":"p-0.5"} mr-1 aspect-square font-semibold leading-none text-setta-700 outline-none transition-colors duration-150 dark:text-setta-200`;return r.length===0?x.jsx("div",{className:o,children:x.jsx(kX,{sectionId:t,sectionTypeName:e,isInOtherProjectConfigs:n,isListElement:i})}):x.jsx(tie,{className:Cl,children:x.jsx(Eft,{triggerClassName:s,trigger:x.jsx(kX,{sectionId:t,sectionTypeName:e,isInOtherProjectConfigs:n,isListElement:i}),children:r.map((a,l)=>x.jsx(a,{sectionId:t},l))})})}function Eft({children:t,trigger:e,triggerClassName:n}){return x.jsx(gie,{triggerClassName:n,contentClassName:"z-20 min-w-[200px] rounded-md border border-solid border-setta-100 bg-white p-1 shadow-xl transition-all will-change-[transform,opacity] dark:border-setta-700/50 dark:bg-setta-850",contentAlign:"start",contentSideOffset:5,contentAlignOffset:-3,trigger:e,children:t})}function Tft(t){switch(t){case Y.INFO:return[_ft,kft,n1,r1];case Y.SECTION:return[n1,TX,wft,xft,EX,Rw,CX,r1];case Y.GLOBAL_VARIABLES:return[n1,TX,EX,Rw,CX,r1];case Y.PARAM_SWEEP:return[n1,Rw,r1];case Y.GLOBAL_PARAM_SWEEP:return[Rw];case Y.LIST_ROOT:case Y.DICT_ROOT:case Y.CODE:return[n1,r1,bft];case Y.GROUP:return[Cft];case Y.DRAW:case Y.IMAGE:case Y.CHART:return[yft];default:return[]}}function Zde({sectionId:t,titleProps:e}){const{sectionName:n,titleIsEditable:r}=$ft(t);return r?x.jsx(Aft,{sectionId:t,sectionName:n,titleProps:e,...Rr({title:n})}):x.jsx(Pft,{sectionName:n,className:e.fixed,...Rr({title:n})})}function Pft({sectionName:t,className:e,onMouseEnter:n,onMouseLeave:r}){return x.jsx("h2",{className:e,onMouseEnter:n,onMouseLeave:r,children:t})}function Aft({sectionId:t,sectionName:e,titleProps:n,onMouseEnter:r,onMouseLeave:i}){function s(h){Rft(t,h)}function o(h){return!Mft(t,h)}const[a,l,c,u,f]=IM(e,s,o);return x.jsx(Kie,{value:a,onChange:l,onBlur:c,onKeyDown:u,titleProps:n,doubleClickToEdit:!0,onMouseEnter:r,onMouseLeave:i,blurTriggeredByEscapeKey:f})}function Rft(t,e){te.setState(n=>{const r=n.x[t];r.name=e,r.paramSweepSectionId&&(n.x[paramSweepSectionId].name=Kse(e)),n.shouldRenameReferences=!0}),hn(!0)}function $ft(t){return te(e=>{const n=[Y.GLOBAL_VARIABLES,Y.PARAM_SWEEP,Y.GLOBAL_PARAM_SWEEP].includes(dn(t,e)),r=II(t,[Y.LIST_ROOT],e);return{sectionName:e.x[t].name,titleIsEditable:!r&&!n}})}function Mft(t,e){const n=te.getState(),{parentId:r}=n.x[t],i=r?Yt(r).children:mr.getState().x.keys();for(const s of i)if(n.x[s].name===e)return!0;return!1}function Ift(t){switch(t){case Y.CODE:return"bg-white dark:bg-setta-900";case Y.TERMINAL:return"bg-setta-950 overflow-clip";case Y.GLOBAL_PARAM_SWEEP:return"@container/multipane";case Y.GLOBAL_VARIABLES:return"bg-white dark:bg-black";default:return"bg-setta-50 dark:bg-setta-860"}}function Yde({jsonSourceMissing:t,isActiveSection:e,isGlobalVariables:n,isInOtherProjectConfigs:r}){return t?"outline-red-600 dark:outline-red-400":e&&n?"outline-green-600 dark:outline-turquoise-400":r?e?"outline-purple-600 dark:outline-purple-700":"outline-transparent [&:active:not(:has(button:active,:active.setta-prevent-section-active-css))]:outline-fuchsia-400":e?"outline-blue-600 dark:outline-blue-700":"outline-transparent [&:active:not(:has(button:active,:active.setta-prevent-section-active-css))]:outline-cyan-300"}function Gde(t,e){return n=>{if(n.target.closest(`button, [role="menuitem"], .${lT}`)||Dft())return;if(n.stopPropagation(),Ut.getState().mouseDownDrawArea){Ut.setState({mouseDownDrawArea:!1});return}if(Ut.getState().isSelectingParams){const i=QAe(t,te.getState());!e&&i?yW([t]):e&&!i&&HT([t])}else qe.getState().multiSelectionActive?e?HT([t]):yW([t]):Vd([t]);const r=B5(t);o3([r],!1)}}function Kde(t){return qf(e=>{var n;return((n=e.x[t])==null?void 0:n.length)>0})}function Dft(t=5){const{lastMouseDownLocation:e,lastMouseUpLocation:n}=Ut.getState();if(!e||!n)return!1;const r=n.x-e.x,i=n.y-e.y;return Math.sqrt(r*r+i*i)>t}function Lft({isGroup:t,sectionId:e,droppableRef:n,draggableRef:r,className:i,style:s,trueDragListeners:o,children:a}){const l=qde(e,"withNested");function c(f){l.current=f,n&&n(f),r&&r(f)}const u={ref:c,...o};return t?x.jsx(Qft,{sectionId:e,commonProps:u,refForPosition:l,className:i,style:s,children:a}):x.jsx("div",{className:`${i} focus-visible:outline-none`,style:s,...u,onKeyDown:f=>Oie(f,l,e),tabIndex:"-1",children:a})}const Nft=ke.memo(Lft,ae.isEqual);function Qft({sectionId:t,commonProps:e,refForPosition:n,className:r,style:i,children:s}){const o=Kde(t),a=ir(d=>d.ids.includes(t)),{positionAndSizeLocked:l,isInOtherProjectConfigs:c}=te(d=>({positionAndSizeLocked:d.x[t].positionAndSizeLocked,isInOtherProjectConfigs:d.x[t].isInOtherProjectConfigs}),ae.isEqual),f=Ude()?"pointer-events-none select-none":"",h=Yde({isActiveSection:a,isInOtherProjectConfigs:c});return x.jsxs("div",{className:`group/group-section flex min-w-[250px] flex-col items-stretch px-6 pb-6 pt-2 focus-visible:outline-none ${r}`,...e,onClick:Gde(t,a),onKeyDown:d=>Oie(d,n,t),tabIndex:"-1",style:i,children:[x.jsx("div",{className:`outline outline-4 ${h} transition-radius absolute left-0 right-0 top-0 z-0 h-full w-full ${l?"rounded-sm border-setta-400/90 dark:border-setta-975/35":"rounded-3xl border-setta-50/50 dark:border-setta-700"} border border-solid bg-setta-100/40 outline outline-2 outline-transparent backdrop-blur-[1px] dark:bg-setta-950/20`}),x.jsxs("div",{className:"z-10 flex min-h-10 w-full items-center",children:[x.jsx(Hde,{sectionId:t,sectionTypeName:Y.GROUP,isInOtherProjectConfigs:c}),x.jsx("div",{className:`${f} relative my-auto mr-2 flex min-h-10 w-full items-center overflow-hidden`,children:x.jsx(jft,{sectionId:t})}),x.jsxs("div",{className:"z-10 ml-auto flex items-center",children:[x.jsx(aft,{sectionId:t}),x.jsx(Xde,{sectionId:t})]})]}),!o&&x.jsx("div",{className:"z-10 -mx-4 mt-4 flex flex-row items-center justify-center rounded-xl border-4 border-dashed border-setta-300 px-4 py-3 text-sm text-setta-500/80 dark:border-setta-700 dark:text-setta-500",children:"Drop A Section Here."}),s]})}function jft({sectionId:t}){const e={editing:"absolute nodrag cursor-text box-border px-1 focus-visible:ring-0 focus-visible:outline-none focus-visible:border-blue-500 rounded-lg border border-solid border-transparent w-full tracking-tighter text-setta-500 dark:text-setta-500 cursor-pointer flex-shrink",notEditing:"absolute cursor-pointer box-border px-1 focus-visible:ring-0 focus-visible:outline-none focus-visible:border-blue-500 rounded-lg border border-solid border-transparent w-full truncate tracking-tighter text-setta-500 dark:text-setta-500 flex-shrink"};return x.jsx(Zde,{sectionId:t,titleProps:e})}function Bft({behaviorDropType:t,children:e,isGroup:n}){const r=gut[t];return x.jsxs(x.Fragment,{children:[t&&x.jsx(zft,{text:r,behaviorDropType:t,isGroup:n}),e]})}function zft({text:t,behaviorDropType:e,isGroup:n}){return x.jsx("div",{className:`absolute z-20 grid h-full w-full justify-center ${n?"[place-content:end_center]":"place-content-center"}`,children:x.jsx(Fft,{text:t,behaviorDropType:e,isGroup:n})})}function Fft({text:t,behaviorDropType:e,isGroup:n}){const r=e===sb.INVALID;return x.jsx("div",{className:`grid h-8 min-w-60 select-none place-items-center rounded-full text-sm font-bold uppercase tracking-widest text-white shadow-md backdrop-blur-sm transition-opacity ${r?"[background-color:rgba(220,_38,_38,_0.8)]":"[background-color:rgba(37,_99,_235,_0.8)]"} ${n&&"mb-8"}`,children:x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx(z$e,{}),t]})})}function Wft({isGroup:t,sectionId:e,isTopLevel:n,droppableRef:r,draggableRef:i,dragListeners:s,children:o}){const{style:a,behaviorDropType:l}=rft({sectionId:e,isGroup:t});return x.jsx(Bft,{behaviorDropType:l,isGroup:t,children:x.jsx(Uft,{isGroup:t,sectionId:e,isTopLevel:n,droppableRef:r,draggableRef:i,dragListeners:s,style:a,children:o})})}const Jde=ke.memo(Wft,(t,e)=>t.isGroup===e.isGroup&&t.children===e.children&&ae.isEqual(t.dragListeners,e.dragListeners));function Vft({isGroup:t,sectionId:e,isTopLevel:n,droppableRef:r,draggableRef:i,dragListeners:s,style:o,children:a}){const l=cn(p=>p.activeId===e),{isSorting:c,isMovingFree:u}=zne(),f=u||!n&&c?s:{},h=c||u?"nodrag":"",d=l?{...o,opacity:.5}:o;return x.jsx(Nft,{isGroup:t,sectionId:e,droppableRef:r,draggableRef:i,trueDragListeners:f,className:h,style:d,children:a})}const Uft=ke.memo(Vft,ae.isEqual);function qft({isGroup:t,sectionId:e,children:n}){const r=cn(l=>l.activeId===e),i=Vde({sectionId:e,isTopLevel:!0}),{setNodeRef:s}=Wee({...i,disabled:r}),{listeners:o,setNodeRef:a}=Fee(i);return x.jsx(Jde,{isGroup:t,sectionId:e,isTopLevel:!0,droppableRef:s,draggableRef:a,dragListeners:o,children:n})}function Xft({isGroup:t,sectionId:e,dragListeners:n,children:r,isTopLevel:i}){return i?x.jsx(qft,{isGroup:t,sectionId:e,children:r}):x.jsx(Jde,{isGroup:t,sectionId:e,isTopLevel:i,dragListeners:n,children:r})}function Hft({sectionId:t,items:e,children:n}){const r=ift(t),i=cn(s=>s.isSorting?s.activeId:s.overId);return x.jsx(L8e,{id:t,items:e,strategy:Zft(r,i),disabled:r,children:n})}function PX(){return[{x:0,y:0,scaleX:1,scaleY:1},-1]}function Zft(t,e){if(t.draggable||t.droppable)return PX;if(e){const n=IA(e);if(n)return Pi(n).isHorizontalOrientation?P8e:I8e}return PX}function Yft({sectionId:t}){return F5(t)?x.jsx(Jft,{sectionId:t}):x.jsx(e0e,{sectionId:t,forceApplyTransform:!1})}const Gft=ke.memo(Yft);function Kft({sectionId:t}){const[e,n]=_.useState(!0);return _.useEffect(()=>{n(!1)},[]),x.jsx(e0e,{sectionId:t,forceApplyTransform:e})}const Jft=ke.memo(Kft);function eht({sectionId:t,forceApplyTransform:e}){const n=sht(),r=Vde({sectionId:t,isTopLevel:!1}),{attributes:{role:i,...s},listeners:o,setNodeRef:a,transform:l,transition:c,overIndex:u,items:f}=V8e({...r,animateLayoutChanges:n});return x.jsx(rht,{sectionId:t,attributes:s,listeners:o,setNodeRef:a,transform:l,transition:c,applyTransform:e||u!==null&&u!==-1||f.length===1&&f[0]===t&&F5(t)})}const e0e=ke.memo(eht);function tht({sectionId:t,attributes:e,listeners:n,setNodeRef:r,transform:i,transition:s,applyTransform:o}){const a=cn(f=>f.overId===t),l=iht(o?i:null),u={style:{transform:wf.Translate.toString(l),transition:s,zIndex:a?500:void 0},ref:r,...e};return x.jsx("div",{className:"relative flex w-full outline-none",...u,tabIndex:"-1",children:x.jsx(nht,{sectionId:t,applyTransform:o,listeners:n})})}function nht({sectionId:t,applyTransform:e,listeners:n}){return F5(t)?e?x.jsx(hut,{}):null:x.jsx(e1e,{sectionId:t,dragListeners:n})}const rht=ke.memo(tht,(t,e)=>t.sectionId===e.sectionId&&t.transform===e.transform&&t.transition===e.transition&&ae.isEqual(t.listeners,e.listeners));function iht(t){if(t){const e=qe.getState().transform[2];return{...t,x:t.x/e,y:t.y/e}}return t}function sht(){const t=cn(e=>e.isSorting);return()=>t}function oht({sectionId:t,isGroup:e}){return Kde(t)&&x.jsx("div",{className:"flex flex-col",children:x.jsx(aht,{sectionId:t,isGroup:e})})}function aht({sectionId:t,isGroup:e}){const n=qf(r=>r.x[t]);return x.jsx(Hft,{sectionId:t,items:n,children:x.jsx(lht,{childIds:n,sectionId:t,isGroup:e})})}function lht({childIds:t,sectionId:e,isGroup:n}){const r=()=>{rg(e)},i=te(s=>s.x[e].isHorizontalOrientation);return x.jsxs("div",{className:"flex items-stretch",children:[!n&&x.jsx("div",{className:"mr-2 mt-2 min-h-full w-2 rounded-full bg-white/30 transition-all duration-75 hover:cursor-pointer hover:bg-white/50 dark:bg-setta-700 hover:dark:bg-setta-600",onClick:r}),x.jsx("div",{className:`mt-2 flex ${i?"flex-row":"flex-col "} items-start gap-2`,children:t.map(s=>x.jsx(Gft,{sectionId:s},`Nested-Sec-${s}`))})]})}const ks={any:"any",auto_only:"auto_only",manual_only:"manual_only"};function y4(t){return t==="auto"?t:parseInt(t)}function AX(t,e,n){return n!==ks.manual_only?t:e}function cht({direction:t,ref:e,sizeMode:n,aspectRatio:r}){const i=y4(e.style.width),s=y4(e.style.height),o=AX("auto",i,n.width),a=AX("auto",s,n.height);return t==="bottomRight"?{width:o,height:a}:t==="right"&&n.width?r?{width:o,height:a}:{width:o}:t==="bottom"&&n.height?r?{width:o,height:a}:{height:a}:{}}function uht({direction:t,ref:e,sizeMode:n,aspectRatio:r}){const i=y4(e.style.width),s=y4(e.style.height);return t==="bottomRight"?{width:i,height:s}:t==="right"&&n.width?r?{width:i,height:s}:{width:i}:t==="bottom"&&n.height?r?{width:i,height:s}:{height:s}:{}}function t0e({props:t,sizeMode:e,aspectRatio:n}){const[r,i,s,o]=t;return o.width===0&&o.height===0&&r.detail===2?cht({direction:i,ref:s,sizeMode:e,aspectRatio:n}):uht({direction:i,ref:s,sizeMode:e,aspectRatio:n})}const DA=1e5,fht=1e5,hht=64,n0e=50,r0e=32;function KD({sectionType:t,hideSearch:e,hideParams:n,isMinimized:r}){if(r)return r0e;if(t===Y.SECTION)return e?78:n?58:104;if(t===Y.LIST_ROOT||t===Y.DICT_ROOT)return n0e;if(t===Y.GLOBAL_VARIABLES)return 78;if(t===Y.CODE)return 58.2;if(t===Y.INFO)return 98;if(t===Y.PARAM_SWEEP)return 50;if(t===Y.TERMINAL)return 100;if(t===Y.GLOBAL_PARAM_SWEEP)return 112;if(t===Y.DRAW||t===Y.IMAGE)return 100;if(t===Y.CHART)return 300;if(t===Y.SOCIAL)return 50}function dht({sectionType:t,isMinimized:e}){return e?r0e:t===Y.LIST_ROOT||t===Y.DICT_ROOT?n0e:DA}function JD({sectionType:t,isTwitter:e}){return e?370:t===Y.DRAW?402:t===Y.CHART?300:200}function pht({isTwitter:t}){return t?574:fht}function mht({sectionType:t,hideParams:e,isTwitter:n}){if(t===Y.SECTION){if(e)return{height:ks.auto_only,width:ks.any}}else if(t===Y.TERMINAL||t===Y.CHART)return{height:ks.manual_only,width:ks.manual_only};return n?{height:ks.auto_only,width:ks.any}:{height:ks.any,width:ks.any}}function ght(t){return te(e=>{const n=fft(t,e),r=dn(t,e),i=e.x[t].hideSearch,s=e.x[t].hideParams,o=e.x[t].isMinimized,a=KD({sectionType:r,hideSearch:i,hideParams:s,isMinimized:o}),l=dht({sectionType:r,isMinimized:o}),c=JD({sectionType:r,isTwitter:n}),u=pht({isTwitter:n}),f=mht({sectionType:r,hideParams:s,isTwitter:n});return{minHeight:a,maxHeight:l,minWidth:c,maxWidth:u,sizeMode:f}},ae.isEqual)}function dg(){const[t,e]=_.useState(!1),n=_.useRef(null);return _.useEffect(()=>{if(!n.current)return;function r(){n.current&&e(n.current.scrollHeight>n.current.clientHeight)}const i=new ResizeObserver(()=>{r()}),s=new MutationObserver(()=>{r()});return i.observe(n.current),s.observe(n.current,{childList:!0,subtree:!0,characterData:!0,attributes:!0}),r(),()=>{i.disconnect(),s.disconnect()}},[]),{ref:n,isScrollable:t}}async function LA(t,e){const n=dn(t),r=KD({sectionType:n}),i=JD({sectionType:n}),s=te.getState().x[t].size;let o=iut(s.height,s.width,e.height,e.width);o=Ade(o.height,o.width,r,i);const a=24;o.height+=a,te.setState(l=>{ik({sectionId:t,aspectRatio:e.width/e.height,aspectRatioExtraHeight:a,size:o,state:l})})}function vht(t,e){const[n,r]=_.useState(null),i=te(s=>{const{width:o,height:a}=s.x[t].size;return o==="auto"||a==="auto"});return _.useEffect(()=>{const s={width:e.width,height:e.height};ae.isEqual(s,n)||LA(t,s),r(s)},[e.src]),_.useEffect(()=>{n&&LA(t,n)},[i]),n!==null}function Oht({sectionId:t,imgSize:e,isNewImg:n,sectionWidth:r,sectionHeight:i,state:s}){let o={};if(e){if(r==="auto"||i==="auto"||n){const c=Y.DRAW,u=KD({sectionType:c}),f=JD({sectionType:c});o=Ade(e.height,e.width,u-120,f-24),BO(t,{width:o.width+24,height:o.height+120},s)}else o.width=r-24,o.height=i-120;n&&ik({sectionId:t,aspectRatio:e.width/e.height,aspectRatioExtraHeight:120,aspectRatioExtraWidth:24,state:s})}else{const[c,u]=[500,500];o.width=r==="auto"?c:r-24,o.height=i==="auto"?u:i-120,(r==="auto"||i==="auto")&&BO(t,{width:o.width+24,height:o.height+120},s)}return o}function yht(t){const n={width:640,height:360},{width:r,height:i}=te(a=>a.x[t].size,ae.isEqual);function s(){n.height+=22,te.setState(a=>{ik({sectionId:t,aspectRatio:16/9,aspectRatioExtraHeight:22,size:n,state:a})})}return _.useEffect(()=>{(r==="auto"||i==="auto")&&s()},[r,i]),_.useEffect(()=>{LA(t,n)},[]),r==="auto"||i==="auto"?{}:{width:r,height:i-22}}function bht(t){_.useEffect(()=>{te.setState(e=>{ik({sectionId:t,aspectRatio:null,aspectRatioExtraHeight:null,aspectRatioExtraWidth:null,size:{height:"auto"},state:e})})},[])}function ik({sectionId:t,size:e,aspectRatio:n,aspectRatioExtraHeight:r,aspectRatioExtraWidth:i,state:s}){const o=s.x[t];o.aspectRatio=n,o.aspectRatioExtraHeight=r,o.aspectRatioExtraWidth=i,e&&BO(t,e,s)}function eL({children:t,onResizeStart:e,as:n,...r}){const{scale:i,onResizeStart:s}=xht();function o(...a){e&&e(...a),s(...a)}return x.jsx(xle,{...r,scale:i,as:n,onResizeStart:o,children:t})}function xht(){const[t,e]=_.useState(1);function n(){e(qe.getState().transform[2])}return{scale:t,onResizeStart:n}}function wht({sectionId:t,bgColor:e,isYouTube:n,isActiveSection:r,positionAndSizeLocked:i,children:s,as:o}){const{minHeight:a,maxHeight:l,minWidth:c,maxWidth:u,sizeMode:f}=ght(t);return x.jsx(Sht,{sectionId:t,bgColor:e,isYouTube:n,isActiveSection:r,positionAndSizeLocked:i,minHeight:a,maxHeight:l,minWidth:c,maxWidth:u,sizeMode:f,as:o,children:s})}function Sht({sectionId:t,bgColor:e,isYouTube:n,isActiveSection:r,positionAndSizeLocked:i,minHeight:s,maxHeight:o,minWidth:a,maxWidth:l,sizeMode:c,children:u,as:f}){_.useEffect(()=>{const E={};c.height===ks.auto_only&&(E.height="auto"),c.width===ks.auto_only&&(E.width="auto"),ae.size(E)>0&&te.setState(T=>{wX(t,E,T)})},[c.height,c.width]);const{size:h,aspectRatio:d,aspectRatioExtraHeight:p,aspectRatioExtraWidth:g}=kht(t);function m(){te.setState(E=>{RX(t,"start",E)})}function v(...E){const T=t0e({props:E,sizeMode:c,aspectRatio:d});te.setState(C=>{wX(t,T,C),RX(t,"end",C)}),hn(!0)}const y=s!==o&&c.height!==ks.auto_only,b=c.width!==ks.auto_only,S=Nt(E=>E.gui.snapGrid),k=Ot.snapToGrid.hook()[0];return x.jsx(_ht,{sectionId:t,as:f,bgColor:e,isYouTube:n,isActiveSection:r,size:h,minHeight:s,maxHeight:o,minWidth:a,maxWidth:l,heightResizable:y,widthResizable:b,positionAndSizeLocked:i,onResizeStart:m,onResizeStop:v,aspectRatio:d,aspectRatioExtraHeight:p,aspectRatioExtraWidth:g,snapGrid:S,snapToGrid:k,children:u})}function _ht({sectionId:t,as:e,bgColor:n,isYouTube:r,isActiveSection:i,size:s,minHeight:o,maxHeight:a,minWidth:l,maxWidth:c,heightResizable:u,widthResizable:f,positionAndSizeLocked:h,onResizeStart:d,onResizeStop:p,aspectRatio:g,aspectRatioExtraHeight:m,aspectRatioExtraWidth:v,snapGrid:y,snapToGrid:b,children:S}){const k=Ude(),E=k||h?!1:{top:!1,left:!1,bottom:u,right:f,topRight:!1,bottomRight:u&&f,topLeft:!1,bottomLeft:!1},T=`${k?"pointer-events-none select-none":""} ${n} section-grid-cols section-grid-rows section-grid-areas grid h-full transition-radius ${h?"rounded-sm":"rounded-xl shadow-md"} before:content-none before:block before:absolute before:top-0 before:right-0 before:bottom-0 before:left-0 before:border before:border-white dark:before:border-setta-700 ${r?"overflow-clip":""} ${i?"z-[150]":"z-10"}`;return x.jsx(eL,{id:`${t}-CustomResizable`,as:e,size:s,minHeight:o,maxHeight:a,minWidth:l,maxWidth:c,onResizeStart:d,onResizeStop:p,lockAspectRatio:g,lockAspectRatioExtraHeight:m,lockAspectRatioExtraWidth:v,handleWrapperClass:"absolute pointer-events-none [&>*]:pointer-events-auto h-full bottom-0 w-full nodrag [&>div]:z-20",enable:E,className:T,handleStyles:{right:{right:"-8px"},bottom:{bottom:"-8px"}},handleClasses:{right:`${lT} ${Cl} ${Jp}`,bottom:`${lT} ${Cl} ${Jp}`},grid:b?y:null,children:S})}function kht(t){return te(e=>{const n=e.x[t];return n.isMinimized?{size:n.size,aspectRatio:!1,aspectRatioExtraHeight:0,aspectRatioExtraWidth:0}:{size:n.size,aspectRatio:n.aspectRatio??!1,aspectRatioExtraHeight:n.aspectRatioExtraHeight??0,aspectRatioExtraWidth:n.aspectRatioExtraWidth??0}},ae.isEqual)}function RX(t,e,n){n.x[t].resizeEvent=e}const i0e="Popover",[s0e,_Et]=Oo(i0e,[Z5]),sk=Z5(),[Cht,Jd]=s0e(i0e),Eht=t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:o=!1}=t,a=sk(e),l=_.useRef(null),[c,u]=_.useState(!1),[f=!1,h]=Nl({prop:r,defaultProp:i,onChange:s});return _.createElement(Ere,a,_.createElement(Cht,{scope:e,contentId:ff(),triggerRef:l,open:f,onOpenChange:h,onOpenToggle:_.useCallback(()=>h(d=>!d),[h]),hasCustomAnchor:c,onCustomAnchorAdd:_.useCallback(()=>u(!0),[]),onCustomAnchorRemove:_.useCallback(()=>u(!1),[]),modal:o},n))},Tht="PopoverTrigger",Pht=_.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=Jd(Tht,n),s=sk(n),o=In(e,i.triggerRef),a=_.createElement(gn.button,Ee({type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":l0e(i.open)},r,{ref:o,onClick:gt(t.onClick,i.onOpenToggle)}));return i.hasCustomAnchor?a:_.createElement(Tre,Ee({asChild:!0},s),a)}),o0e="PopoverPortal",[Aht,Rht]=s0e(o0e,{forceMount:void 0}),$ht=t=>{const{__scopePopover:e,forceMount:n,children:r,container:i}=t,s=Jd(o0e,e);return _.createElement(Aht,{scope:e,forceMount:n},_.createElement(zd,{present:n||s.open},_.createElement(Are,{asChild:!0,container:i},r)))},zO="PopoverContent",Mht=_.forwardRef((t,e)=>{const n=Rht(zO,t.__scopePopover),{forceMount:r=n.forceMount,...i}=t,s=Jd(zO,t.__scopePopover);return _.createElement(zd,{present:r||s.open},s.modal?_.createElement(Iht,Ee({},i,{ref:e})):_.createElement(Dht,Ee({},i,{ref:e})))}),Iht=_.forwardRef((t,e)=>{const n=Jd(zO,t.__scopePopover),r=_.useRef(null),i=In(e,r),s=_.useRef(!1);return _.useEffect(()=>{const o=r.current;if(o)return G5(o)},[]),_.createElement(dM,{as:lm,allowPinchZoom:!0},_.createElement(a0e,Ee({},t,{ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:gt(t.onCloseAutoFocus,o=>{var a;o.preventDefault(),s.current||(a=n.triggerRef.current)===null||a===void 0||a.focus()}),onPointerDownOutside:gt(t.onPointerDownOutside,o=>{const a=o.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0,c=a.button===2||l;s.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:gt(t.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})))}),Dht=_.forwardRef((t,e)=>{const n=Jd(zO,t.__scopePopover),r=_.useRef(!1);return _.createElement(a0e,Ee({},t,{ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var s;if((s=t.onCloseAutoFocus)===null||s===void 0||s.call(t,i),!i.defaultPrevented){var o;r.current||(o=n.triggerRef.current)===null||o===void 0||o.focus(),i.preventDefault()}r.current=!1},onInteractOutside:i=>{var s,o;(s=t.onInteractOutside)===null||s===void 0||s.call(t,i),i.defaultPrevented||(r.current=!0);const a=i.target;((o=n.triggerRef.current)===null||o===void 0?void 0:o.contains(a))&&i.preventDefault()}}))}),a0e=_.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:o,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:u,...f}=t,h=Jd(zO,n),d=sk(n);return hre(),_.createElement(dre,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s},_.createElement(ure,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>h.onOpenChange(!1)},_.createElement(Pre,Ee({"data-state":l0e(h.open),role:"dialog",id:h.contentId},d,f,{ref:e,style:{...f.style,["--radix-popover-content-transform-origin"]:"var(--radix-popper-transform-origin)"}}))))}),Lht="PopoverClose",Nht=_.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=Jd(Lht,n);return _.createElement(gn.button,Ee({type:"button"},r,{ref:e,onClick:gt(t.onClick,()=>i.onOpenChange(!1))}))}),Qht=_.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=sk(n);return _.createElement(GMe,Ee({},i,r,{ref:e}))});function l0e(t){return t?"open":"closed"}const jht=Eht,Bht=Pht,zht=$ht,Fht=Mht,Wht=Nht,Vht=Qht;function $1({trigger:t,contentClasses:e,children:n,open:r,close:i=!1,closeClasses:s,onOpenChange:o,arrowClasses:a}){return x.jsxs(jht,{open:r,onOpenChange:o,children:[x.jsx(Bht,{asChild:!0,children:t}),x.jsx(zht,{children:x.jsxs(Fht,{className:e,children:[i&&x.jsx(Wht,{className:s,children:i}),x.jsx(Vht,{className:a||"[fill:rgb(229,_231,_235)] dark:[fill:rgb(51,_65,_85)]"}),n]})})]})}function c0e({sectionId:t,isRoot:e,popover:n=!1}){const r=C5(t),i=c=>{$Ne(e,t,c)},s=c=>{qct(e,t,c)},o=c=>{c&&!isNaN(c)?l(parseInt(c)):l("")},[a,l]=_.useState(1);return x.jsxs("div",{className:`section-key-value section-row-main -mx-2 flex items-center gap-1 rounded-lg bg-setta-100 pl-2 pr-1 dark:bg-setta-950 ${n?"border border-solid border-white py-1 shadow-lg dark:border-setta-800":""}`,children:[e?x.jsxs(x.Fragment,{children:[x.jsx(hHe,{className:"text-setta-300 dark:text-setta-600"}),x.jsx("p",{className:"text-[10px] font-bold text-setta-500",children:"Children: "})]}):x.jsx("p",{className:"text-[10px] text-setta-500",children:"Siblings"}),x.jsx("input",{className:"nodrag max-w-[3ch] cursor-auto rounded-md bg-white px-2 text-xs focus-visible:ring-2 dark:bg-setta-800 dark:text-setta-300",value:a,onChange:c=>o(c.target.value),disabled:r}),x.jsx("button",{className:"nodrag gg-math-minus rounded-full focus-visible:ring-2 dark:text-setta-300",onClick:()=>s(a),role:"button",disabled:r}),x.jsx("button",{className:"nodrag gg-math-plus rounded-full focus-visible:ring-2 dark:text-setta-300",onClick:()=>i(a),role:"button",disabled:r})]})}function Uht({onClick:t,...e}){return x.jsx(Fa,{...e,icon:x.jsx("i",{className:"gg-close"}),color:"text-setta-600 hover:text-white",bg:"bg-transparent hover:bg-red-500",size:"min-w-4 h-4",padding:"p-0",onClick:t})}function qht({sectionId:t,twClasses:e,...n}){const r=te(s=>s.x[t].isMinimized);function i(){te.setState(s=>{s.x[t].isMinimized=!r})}return x.jsx(Fa,{...n,icon:r?x.jsx("i",{className:"gg-maximize !scale-[.4]"}):x.jsx("i",{className:"gg-math-minus"}),color:"text-setta-600 hover:text-white",bg:"bg-transparent hover:bg-blue-500 justify-content-center mr-1",size:"w-4 h-4",padding:"p-0",twClasses:e,onClick:i})}function Xht({sectionId:t}){function e(){const{runInMemory:n}=Pi(t);n?RM([t]):$M([t])}return x.jsx(Fa,{icon:x.jsx(lre,{}),color:"text-setta-600 hover:text-green-500 active:!text-blue-700",bg:"bg-transparent",size:"w-4 h-4",padding:"p-0 mr-1",onClick:e,...Rr({title:"Run this code block"})})}function Hht({sectionId:t}){const e=te(r=>r.x[t].runInMemory);function n(){te.setState(r=>{r.x[t].runInMemory=!e})}return x.jsx(Fa,{icon:x.jsx(tHe,{}),color:`${e?"text-blue-500 hover:!text-cyan-200":"text-setta-600 hover:!text-blue-500"} active:!text-blue-500`,bg:`${e?"hover:bg-blue-500":"bg-transparent"}`,size:"w-4 h-4",padding:"p-0 mr-1",onClick:n,...Rr({title:"Toggle In-Memory Code"})})}function Zht({sectionId:t,isActiveSection:e,sectionTypeName:n,isInOtherProjectConfigs:r,isRoot:i}){const s=()=>{te.setState(a=>{_m([t],a)}),hn(!0)},o=NXe(t)&&!i;return x.jsxs("header",{className:"section-title mx-2 flex flex-row items-center",children:[x.jsx(Hde,{sectionId:t,sectionTypeName:n,isInOtherProjectConfigs:r}),n!==Y.INFO&&x.jsx(x.Fragment,{children:x.jsx(Yht,{sectionId:t,isActiveSection:e,isInOtherProjectConfigs:r,sectionTypeName:n})}),x.jsxs("div",{className:"z-10 ml-auto flex items-center",children:[o&&x.jsx($1,{arrowClasses:"fill-white dark:fill-setta-800",contentClasses:"z-20",trigger:x.jsx(Fa,{twClasses:"[&_*]:hover:text-setta-500 [&_*]:dark:hover:text-setta-400",bg:"bg-transparent",children:x.jsx(fHe,{className:"text-setta-300 dark:text-setta-700"})}),children:x.jsx(c0e,{sectionId:t,isRoot:i,popover:!0})}),n===Y.CODE&&x.jsxs(x.Fragment,{children:[x.jsx(Xht,{sectionId:t})," ",x.jsx(Hht,{sectionId:t})," "]}),x.jsx(Xde,{sectionId:t}),!i&&x.jsx(qht,{sectionId:t}),x.jsx(Uht,{onClick:s})]})]})}function Yht({sectionId:t,isActiveSection:e,isInOtherProjectConfigs:n,sectionTypeName:r}){return x.jsx(Zde,{sectionId:t,titleProps:Kht({isActiveSection:e,isInOtherProjectConfigs:n,sectionTypeName:r})})}const Ght=ke.memo(Zht);function Kht({isActiveSection:t,isInOtherProjectConfigs:e,sectionTypeName:n}){const r="cursor-text nodrag px-1 py-0 leading-5 -ml-1 bg-setta-100 focus-visible:ring-0 focus-visible:outline-none rounded-md box-border border border-solid border-transparent focus-visible:border-blue-500 dark:bg-setta-800 w-3/5 dark:text-white font-bold text-[.7rem] tracking-tight",i=n===Y.GLOBAL_VARIABLES,s=Jht({isActiveSection:t,isInOtherProjectConfigs:e,isGlobalVariables:i,sectionTypeName:n});return i?{fixed:s}:{editing:r,notEditing:s,fixed:"select-none italic focus-visible:ring-0 focus-visible:outline-none box-border border border-solid border-transparent focus-visible:border-blue-500 tracking-tighter text-xs text-setta-400 max-w-full truncate pr-0.5"}}function Jht({isActiveSection:t,isInOtherProjectConfigs:e,isGlobalVariables:n,sectionTypeName:r}){let i="",s="font-bold";return t?e?i="text-purple-800 dark:text-purple-200":n?i="text-green-800 dark:text-green-200":r===Y.TERMINAL?i="text-blue-400":i="text-blue-600 dark:text-blue-400":r===Y.TERMINAL?i="text-setta-300":i="text-setta-700 dark:text-setta-300",n&&(s="uppercase font-bold"),`px-1 py-0 -ml-1 w-3/5 focus-visible:ring-0 focus-visible:outline-none box-border rounded-md border border-solid border-transparent focus-visible:border-blue-500 leading-5 font-bold tracking-tight cursor-pointer max-w-full text-[.7rem] truncate ${i} ${s}`}/*!
357
357
  * @kurkle/color v0.3.4
358
358
  * https://github.com/kurkle/color#readme
359
359
  * (c) 2024 Jukka Kurkela